Client: Allow game-specific model event overrides.

This commit is contained in:
Marco Cawthorne 2021-01-05 15:51:49 +01:00
parent 6c3814a2b1
commit 507a10eec5
17 changed files with 52 additions and 11 deletions

View File

@ -365,4 +365,5 @@ void
bot::bot(void)
{
classname = "player";
targetname = "_nuclide_bot_";
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

24
src/client/base/event.c Normal file
View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
void
Game_ModelEvent(float flTimeStamp, int iCode, string strData)
{
switch (iCode) {
default:
Event_ProcessModel(flTimeStamp, iCode, strData);
}
}

View File

@ -29,6 +29,7 @@
../base/hud_weaponselect.c
../base/scoreboard.c
../base/input.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -36,6 +36,7 @@
../valve/scoreboard.c
../valve/input.c
../cstrike/radio.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -90,6 +90,7 @@ void View_SetMuzzleflash(int);
void View_PlayAnimation(int);
void View_PlayAnimation(int);
void Vox_Play(string);
void Event_ProcessModel(float, int, string);
/* this really should be done in-engine */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -62,30 +62,36 @@ tries to play an event.
void
Event_ProcessModel(float fTimeStamp, int iCode, string sData)
{
if (iCode == 5004) {
switch(iCode) {
case 5004:
localsound(sData, CHAN_AUTO, 1.0);
} else if (iCode == 5001) {
break;
case 5001:
pSeat->m_eMuzzleflash.alpha = 1.0f;
pSeat->m_eMuzzleflash.scale = 0.25;
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones;
Event_EjectShell();
} else if(iCode == 5011) {
break;
case 5011:
pSeat->m_eMuzzleflash.alpha = 1.0f;
pSeat->m_eMuzzleflash.scale = 0.25;
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 1;
//setmodel(pSeat->m_eMuzzleflash, sprintf("sprites/muzzleflash%s.spr", substring(sData, 1, 1)));
Event_EjectShell();
} else if (iCode == 5021) {
break;
case 5021:
pSeat->m_eMuzzleflash.alpha = 1.0f;
pSeat->m_eMuzzleflash.scale = 0.25;
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 2;
//setmodel(pSeat->m_eMuzzleflash, sprintf("sprites/muzzleflash%s.spr", substring(sData, 1, 1)));
Event_EjectShell();
} else if (iCode == 5031) {
break;
case 5031:
pSeat->m_eMuzzleflash.alpha = 1.0f;
pSeat->m_eMuzzleflash.scale = 0.25;
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 3;
//setmodel(pSeat->m_eMuzzleflash, sprintf("sprites/muzzleflash%s.spr", substring(sData, 1, 1)));
Event_EjectShell();
break;
}
}

View File

@ -32,6 +32,7 @@
../gearbox/hud_weaponselect.c
../valve/scoreboard.c
../valve/input.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -32,6 +32,7 @@
../valve/hud_weaponselect.c
../valve/scoreboard.c
../valve/input.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -12,7 +12,7 @@ player.c
predict.c
npc.c
entities.c
events.c
event.c
view.c
damage.c
chat.c

View File

@ -32,6 +32,7 @@
../valve/hud_weaponselect.c
../valve/scoreboard.c
../valve/input.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -32,6 +32,7 @@
../rewolf/hud_weaponselect.c
../valve/scoreboard.c
../valve/input.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -31,6 +31,7 @@
../valve/hud_weaponselect.c
../valve/scoreboard.c
../valve/input.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -31,6 +31,7 @@
../valve/hud_weaponselect.c
../valve/scoreboard.c
../valve/input.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -31,6 +31,7 @@
../valve/hud_weaponselect.c
../valve/scoreboard.c
../valve/input.c
../base/event.c
../include.src
../../shared/include.src

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -154,7 +154,7 @@ View_DrawViewModel(void)
m_eViewModel.frame2time = pl.weapontime;
m_eViewModel.frame1time = pl.weapontime;
processmodelevents(m_eViewModel.modelindex, m_eViewModel.frame, fBaseTime,
m_eViewModel.frame1time, Event_ProcessModel);
m_eViewModel.frame1time, Game_ModelEvent);
makevectors(view_angles);
m_eViewModel.angles = view_angles;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above