From 5e722bfabab61d870d50e8cfdb15a85c34af66d5 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 21 Jun 2023 01:20:30 +0300 Subject: [PATCH] Alternate between shell and link ejection in M249 --- cl_dll/ev_hldm.cpp | 3 ++- dlls/gearbox/m249.cpp | 5 ++++- dlls/weapons.h | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 1a8a7187..543d093c 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -1984,7 +1984,8 @@ void EV_FireM249( event_args_t *args ) 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 ) ) { diff --git a/dlls/gearbox/m249.cpp b/dlls/gearbox/m249.cpp index 630263a8..c9ae9068 100644 --- a/dlls/gearbox/m249.cpp +++ b/dlls/gearbox/m249.cpp @@ -51,6 +51,7 @@ void CM249::Spawn() m_iDefaultAmmo = M249_DEFAULT_GIVE; m_fInSpecialReload = 0; + m_bAlternatingEject = false; FallInit();// get ready to fall down. } @@ -63,6 +64,7 @@ void CM249::Precache(void) PRECACHE_MODEL("models/p_saw.mdl"); 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_SOUND("items/9mmclip1.wav"); @@ -146,6 +148,7 @@ void CM249::PrimaryAttack() m_iClip--; UpdateTape(); + m_bAlternatingEject = !m_bAlternatingEject; m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; // player "shoot" animation @@ -177,7 +180,7 @@ void CM249::PrimaryAttack() flags = 0; #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 diff --git a/dlls/weapons.h b/dlls/weapons.h index 9e0fc901..7dd9b3b0 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -1252,6 +1252,8 @@ public: virtual BOOL ShouldWeaponIdle(void) { return TRUE; } float m_flNextAnimTime; int m_iShell; + int m_iLink; + bool m_bAlternatingEject; virtual BOOL UseDecrement(void) {