diff --git a/main/events/Mine.sc b/main/events/Mine.sc new file mode 100644 index 00000000..e69de29b diff --git a/main/source/mod/AvHEvents.cpp b/main/source/mod/AvHEvents.cpp index 84deb327..6a4534b4 100644 --- a/main/source/mod/AvHEvents.cpp +++ b/main/source/mod/AvHEvents.cpp @@ -229,6 +229,7 @@ AVH_DECLARE_EVENT(SonicGun) AVH_DECLARE_EVENT(HeavyMachineGun) AVH_DECLARE_EVENT(GrenadeGun) AVH_DECLARE_EVENT(Grenade) +AVH_DECLARE_EVENT(Mine) // Alien weapon events AVH_DECLARE_EVENT(SpitGun) @@ -324,6 +325,7 @@ void Game_HookEvents( void ) gEngfuncs.pfnHookEvent( kHMGEventName, EV_HeavyMachineGun ); gEngfuncs.pfnHookEvent( kGGEventName, EV_GrenadeGun ); gEngfuncs.pfnHookEvent( kGREventName, EV_Grenade ); + gEngfuncs.pfnHookEvent( kMineEventName, EV_Mine ); // Alien weapon events gEngfuncs.pfnHookEvent( kSpitGEventName, EV_SpitGun ); @@ -1273,6 +1275,16 @@ void EV_Grenade(struct event_args_s* inArgs) // } } +void EV_Mine(struct event_args_s* inArgs) +{ + if (EV_IsLocal(inArgs->entindex)) + { + int theAnimation = max(inArgs->iparam2, 0); + + gEngfuncs.pEventAPI->EV_WeaponAnimation(theAnimation, 2); + } +} + char *EV_HLDM_DamageDecal( physent_t *pe ); void CreateDecal(struct pmtrace_s* inTrace) @@ -3614,6 +3626,7 @@ void EV_WeaponAnimation(struct event_args_s* inArgs) { int theAnimation = max(inArgs->iparam2, 0); // 2024 - Set this here to be checked in weapons think later to force animations if needed since event playback doesn't always work. + gEngfuncs.Con_Printf("setanim %d\n", theAnimation); HUD_SetWeaponAnim(theAnimation); gEngfuncs.pEventAPI->EV_WeaponAnimation(theAnimation, 2); } diff --git a/main/source/mod/AvHMarineEquipmentConstants.h b/main/source/mod/AvHMarineEquipmentConstants.h index 8c7a7c21..6ce63b6f 100644 --- a/main/source/mod/AvHMarineEquipmentConstants.h +++ b/main/source/mod/AvHMarineEquipmentConstants.h @@ -136,6 +136,7 @@ const float kMineROF = 1.0f; #define kTripmineActivateSound "weapons/mine_activate.wav" #define kTripmineChargeSound "weapons/mine_charge.wav" #define kTripmineStepOnSound "weapons/mine_step.wav" +#define kMineEventName "events/Mine.sc" #define kMineMinSize Vector( -8, -8, 0) #define kMineMaxSize Vector(8, 8, 2) diff --git a/main/source/mod/AvHMarineWeapons.h b/main/source/mod/AvHMarineWeapons.h index 970fec8a..b2a7d309 100644 --- a/main/source/mod/AvHMarineWeapons.h +++ b/main/source/mod/AvHMarineWeapons.h @@ -530,13 +530,19 @@ public: virtual void Precache(void); + //virtual void PrimaryAttack(void); + virtual bool Resupply(); + + //virtual BOOL ShouldWeaponIdle(void); virtual void Spawn(); virtual bool UsesAmmo(void) const; virtual BOOL UseDecrement(void); + + //virtual void WeaponIdle(void); protected: virtual void FireProjectiles(void); diff --git a/main/source/mod/AvHMine.cpp b/main/source/mod/AvHMine.cpp index 56d4d671..669da6cd 100644 --- a/main/source/mod/AvHMine.cpp +++ b/main/source/mod/AvHMine.cpp @@ -120,6 +120,8 @@ int AvHMine::GetShootAnimation() const { // Return deploy animation for now, this should play fire animation, then a little later, play the deploy animation return 2; + //// Attack animation test. + //return 4; } void AvHMine::Holster(int skiplocal) @@ -307,14 +309,34 @@ void AvHMine::Precache() UTIL_PrecacheOther(kwsDeployedMine); - this->mEvent = PRECACHE_EVENT(1, kWeaponAnimationEvent); + this->mEvent = PRECACHE_EVENT(1, kMineEventName); } +//// Attack animation test. +//void AvHMine::PrimaryAttack(void) +//{ +// AvHMarineWeapon::PrimaryAttack(); +// +// // This makes the predicted clip size go down if you can't place a mine for some reason. +// this->m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.666666f; +// +// if (this->m_flTimeWeaponIdle < 0) +// { +// this->m_flTimeWeaponIdle = 0.666666f; +// } +//} + bool AvHMine::Resupply() { return false; } +//////// Attack animation test. +//BOOL AvHMine::ShouldWeaponIdle(void) +//{ +// return TRUE; +//} + void AvHMine::Spawn() { this->Precache(); @@ -353,3 +375,22 @@ BOOL AvHMine::UseDecrement(void) return true; } +//// Attack animation test. +//void AvHMine::WeaponIdle(void) +//{ +// //if (this->m_flTimeWeaponIdle <= UTIL_WeaponTimeBase() && this->m_flNextPrimaryAttack > UTIL_WeaponTimeBase()) +// if (this->m_flNextPrimaryAttack > UTIL_WeaponTimeBase() && this->m_flNextPrimaryAttack < UTIL_WeaponTimeBase() + 0.333333f) +// { +// this->SendWeaponAnim(2); +// //m_pPlayer->m_flNextAttack +// this->m_pPlayer->SetAnimation(PLAYER_IDLE); +// this->SetNextIdle(); +// ALERT(at_console, "mine special idle\n"); +// } +// else +// { +// ALERT(at_console, "mine normal idle timeidle:%f nextprimatk:%f\n", this->m_flTimeWeaponIdle, this->m_flNextPrimaryAttack); +// AvHMarineWeapon::WeaponIdle(); +// } +//} +