Browse Source

Alternate between shell and link ejection in M249

opfor
Roman Chistokhodov 1 year ago
parent
commit
5e722bfaba
  1. 3
      cl_dll/ev_hldm.cpp
  2. 5
      dlls/gearbox/m249.cpp
  3. 2
      dlls/weapons.h

3
cl_dll/ev_hldm.cpp

@ -1984,7 +1984,8 @@ void EV_FireM249( event_args_t *args )
AngleVectors( angles, forward, right, up ); AngleVectors( angles, forward, right, up );
shell = gEngfuncs.pEventAPI->EV_FindModelIndex( "models/saw_shell.mdl" );// brass shell const bool bAlternatingEject = args->bparam1 != 0;
shell = bAlternatingEject ? gEngfuncs.pEventAPI->EV_FindModelIndex("models/saw_link.mdl") : gEngfuncs.pEventAPI->EV_FindModelIndex( "models/saw_shell.mdl" );// brass shell
if( EV_IsLocal( idx ) ) if( EV_IsLocal( idx ) )
{ {

5
dlls/gearbox/m249.cpp

@ -51,6 +51,7 @@ void CM249::Spawn()
m_iDefaultAmmo = M249_DEFAULT_GIVE; m_iDefaultAmmo = M249_DEFAULT_GIVE;
m_fInSpecialReload = 0; m_fInSpecialReload = 0;
m_bAlternatingEject = false;
FallInit();// get ready to fall down. FallInit();// get ready to fall down.
} }
@ -63,6 +64,7 @@ void CM249::Precache(void)
PRECACHE_MODEL("models/p_saw.mdl"); PRECACHE_MODEL("models/p_saw.mdl");
m_iShell = PRECACHE_MODEL("models/saw_shell.mdl");// brass shellTE_MODEL m_iShell = PRECACHE_MODEL("models/saw_shell.mdl");// brass shellTE_MODEL
m_iLink = PRECACHE_MODEL("models/saw_link.mdl");
PRECACHE_MODEL("models/w_saw_clip.mdl"); PRECACHE_MODEL("models/w_saw_clip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav"); PRECACHE_SOUND("items/9mmclip1.wav");
@ -146,6 +148,7 @@ void CM249::PrimaryAttack()
m_iClip--; m_iClip--;
UpdateTape(); UpdateTape();
m_bAlternatingEject = !m_bAlternatingEject;
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
// player "shoot" animation // player "shoot" animation
@ -177,7 +180,7 @@ void CM249::PrimaryAttack()
flags = 0; flags = 0;
#endif #endif
PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usM249, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, pev->body, 0, 0); PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usM249, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, pev->body, m_bAlternatingEject ? 1 : 0, 0);
#if !CLIENT_DLL #if !CLIENT_DLL

2
dlls/weapons.h

@ -1252,6 +1252,8 @@ public:
virtual BOOL ShouldWeaponIdle(void) { return TRUE; } virtual BOOL ShouldWeaponIdle(void) { return TRUE; }
float m_flNextAnimTime; float m_flNextAnimTime;
int m_iShell; int m_iShell;
int m_iLink;
bool m_bAlternatingEject;
virtual BOOL UseDecrement(void) virtual BOOL UseDecrement(void)
{ {

Loading…
Cancel
Save