Browse Source

Other solution for weapon animation.

poke646
Night Owl 8 years ago
parent
commit
56b2a6bc4c
  1. 44
      dlls/poke646/bradnailer.cpp
  2. 38
      dlls/poke646/xensquasher.cpp
  3. 16
      dlls/weapons.h
  4. 2
      dlls/world.cpp

44
dlls/poke646/bradnailer.cpp

@ -102,7 +102,7 @@ void CBradnailer::Holster(int skiplocal /*= 0*/) @@ -102,7 +102,7 @@ void CBradnailer::Holster(int skiplocal /*= 0*/)
{
m_fInReload = FALSE;// cancel any reload in progress.
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5;
SendWeaponAnim(BRADNAILER_HOLSTER);
m_fInAttack = 0;
@ -117,7 +117,7 @@ void CBradnailer::SecondaryAttack(void) @@ -117,7 +117,7 @@ void CBradnailer::SecondaryAttack(void)
return;
}
if (m_flNextSecondaryAttack > UTIL_WeaponTimeBase())
if (m_flNextSecondaryAttack > gpGlobals->time)
return;
if (m_fInAttack == 0)
@ -130,14 +130,14 @@ void CBradnailer::SecondaryAttack(void) @@ -130,14 +130,14 @@ void CBradnailer::SecondaryAttack(void)
m_fInAttack = 1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.7;
m_flNextSecondaryAttack = GetNextAttackDelay(0.7);
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 2.0;
m_flTimeWeaponIdle = gpGlobals->time + 0.7;
m_flNextSecondaryAttack = gpGlobals->time + 0.7;
m_flNextPrimaryAttack = gpGlobals->time + 2.0;
return;
}
else if (m_fInAttack == 1)
{
if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase())
if (m_flTimeWeaponIdle < gpGlobals->time)
{
#ifndef CLIENT_DLL
//ALERT(at_console, "Fire\n");
@ -146,8 +146,8 @@ void CBradnailer::SecondaryAttack(void) @@ -146,8 +146,8 @@ void CBradnailer::SecondaryAttack(void)
m_fInAttack = 1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.2f;
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
m_flTimeWeaponIdle = gpGlobals->time + 0.2f;
m_flNextPrimaryAttack = gpGlobals->time + 0.5;
}
}
}
@ -156,7 +156,7 @@ void CBradnailer::PrimaryAttack(void) @@ -156,7 +156,7 @@ void CBradnailer::PrimaryAttack(void)
{
if (m_fInAttack != 0)
{
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
m_flNextPrimaryAttack = gpGlobals->time + 0.5;
return;
}
@ -169,9 +169,9 @@ void CBradnailer::PrimaryAttack(void) @@ -169,9 +169,9 @@ void CBradnailer::PrimaryAttack(void)
Fire(0.01f, 0.3f, TRUE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(0.3f);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->time + 0.3f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
}
void CBradnailer::Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL fFastShoot)
@ -182,11 +182,11 @@ void CBradnailer::Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL @@ -182,11 +182,11 @@ void CBradnailer::Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL
int flags;
#if defined( CLIENT_WEAPONS )
flags = FEV_NOTHOST;
#else
//#if defined( CLIENT_WEAPONS )
// flags = FEV_NOTHOST;
//#else
flags = 0;
#endif
//#endif
// player "shoot" animation
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
@ -253,7 +253,7 @@ void CBradnailer::Reload(void) @@ -253,7 +253,7 @@ void CBradnailer::Reload(void)
if (m_fInAttack != 0)
return;
if (m_flNextPrimaryAttack > UTIL_WeaponTimeBase())
if (m_flNextPrimaryAttack > gpGlobals->time)
return;
if (m_pPlayer->ammo_nails <= 0)
@ -282,7 +282,7 @@ void CBradnailer::WeaponIdle(void) @@ -282,7 +282,7 @@ void CBradnailer::WeaponIdle(void)
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
if (m_flTimeWeaponIdle > gpGlobals->time)
return;
if (m_fInAttack != 0)
@ -294,8 +294,8 @@ void CBradnailer::WeaponIdle(void) @@ -294,8 +294,8 @@ void CBradnailer::WeaponIdle(void)
SendWeaponAnim(BRADNAILER_TILT_TO_UPRIGHT, UseDecrement());
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(0.5f);
m_flTimeWeaponIdle = gpGlobals->time + 0.5f;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->time + 0.5f;
}
else
{
@ -308,17 +308,17 @@ void CBradnailer::WeaponIdle(void) @@ -308,17 +308,17 @@ void CBradnailer::WeaponIdle(void)
if (flRand <= 0.3 + 0 * 0.75)
{
iAnim = BRADNAILER_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 49.0 / 16;
m_flTimeWeaponIdle = gpGlobals->time + 49.0 / 16;
}
else if (flRand <= 0.6 + 0 * 0.875)
{
iAnim = BRADNAILER_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0 / 16.0;
m_flTimeWeaponIdle = gpGlobals->time + 60.0 / 16.0;
}
else
{
iAnim = BRADNAILER_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0 / 16.0;
m_flTimeWeaponIdle = gpGlobals->time + 40.0 / 16.0;
}
SendWeaponAnim(iAnim, 1);
}

38
dlls/poke646/xensquasher.cpp

@ -168,7 +168,7 @@ void CXenSquasher::PrimaryAttack() @@ -168,7 +168,7 @@ void CXenSquasher::PrimaryAttack()
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
m_flTimeWeaponIdle = gpGlobals->time + 1.0;
// m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.2;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.45;
}
@ -205,24 +205,24 @@ void CXenSquasher::SecondaryAttack() @@ -205,24 +205,24 @@ void CXenSquasher::SecondaryAttack()
m_fPrimaryFire = FALSE;
m_iClip--;// take one ammo just to start the spin
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase();
m_pPlayer->m_flNextAmmoBurn = gpGlobals->time;
// spin up
m_pPlayer->m_iWeaponVolume = XS_PRIMARY_CHARGE_VOLUME;
SendWeaponAnim(XS_SPINUP);
m_fInAttack = 1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
m_flTimeWeaponIdle = gpGlobals->time + 0.5;
m_pPlayer->m_flStartCharge = gpGlobals->time;
m_pPlayer->m_flAmmoStartCharge = UTIL_WeaponTimeBase() + GetFullChargeTime();
m_pPlayer->m_flAmmoStartCharge = gpGlobals->time + GetFullChargeTime();
PLAYBACK_EVENT_FULL(FEV_NOTHOST, m_pPlayer->edict(), m_usXSSpin, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 110, 0, 0, 0);
PLAYBACK_EVENT_FULL(0, m_pPlayer->edict(), m_usXSSpin, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 110, 0, 0, 0);
m_iSoundState = SND_CHANGE_PITCH;
}
else if (m_fInAttack == 1)
{
if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase())
if (m_flTimeWeaponIdle < gpGlobals->time)
{
SendWeaponAnim(XS_SPIN);
m_fInAttack = 2;
@ -231,10 +231,10 @@ void CXenSquasher::SecondaryAttack() @@ -231,10 +231,10 @@ void CXenSquasher::SecondaryAttack()
else
{
// during the charging process, eat one bit of ammo every once in a while
if (UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000)
if (gpGlobals->time >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000)
{
m_iClip--;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.3;
m_pPlayer->m_flNextAmmoBurn = gpGlobals->time + 0.3;
}
if (m_iClip <= 0)
@ -242,12 +242,12 @@ void CXenSquasher::SecondaryAttack() @@ -242,12 +242,12 @@ void CXenSquasher::SecondaryAttack()
// out of ammo! force the gun to fire
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
m_flTimeWeaponIdle = gpGlobals->time + 1.0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
return;
}
if (UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge)
if (gpGlobals->time >= m_pPlayer->m_flAmmoStartCharge)
{
// don't eat any more ammo after gun is fully charged.
m_pPlayer->m_flNextAmmoBurn = 1000;
@ -262,7 +262,7 @@ void CXenSquasher::SecondaryAttack() @@ -262,7 +262,7 @@ void CXenSquasher::SecondaryAttack()
if (m_iSoundState == 0)
ALERT(at_console, "sound state %d\n", m_iSoundState);
PLAYBACK_EVENT_FULL(FEV_NOTHOST, m_pPlayer->edict(), m_usXSSpin, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, pitch, 0, (m_iSoundState == SND_CHANGE_PITCH) ? 1 : 0, 0);
PLAYBACK_EVENT_FULL(0, m_pPlayer->edict(), m_usXSSpin, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, pitch, 0, (m_iSoundState == SND_CHANGE_PITCH) ? 1 : 0, 0);
m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions
@ -276,7 +276,7 @@ void CXenSquasher::SecondaryAttack() @@ -276,7 +276,7 @@ void CXenSquasher::SecondaryAttack()
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/xs_moan3.wav", 1.0, ATTN_NORM, 0, 75 + RANDOM_LONG(0, 0x3f));
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
m_flTimeWeaponIdle = gpGlobals->time + 1.0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
#ifndef CLIENT_DLL
@ -376,13 +376,13 @@ void CXenSquasher::Fire(Vector vecOrigSrc, Vector vecDir, float flDamage) @@ -376,13 +376,13 @@ void CXenSquasher::Fire(Vector vecOrigSrc, Vector vecDir, float flDamage)
// The main firing event is sent unreliably so it won't be delayed.
PLAYBACK_EVENT_FULL(FEV_NOTHOST, m_pPlayer->edict(), m_usXSFire, 0.0, (float *)&m_pPlayer->pev->origin, (float *)&m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0);
PLAYBACK_EVENT_FULL(0, m_pPlayer->edict(), m_usXSFire, 0.0, (float *)&m_pPlayer->pev->origin, (float *)&m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0);
// This reliable event is used to stop the spinning sound
// It's delayed by a fraction of second to make sure it is delayed by 1 frame on the client
// It's sent reliably anyway, which could lead to other delays
PLAYBACK_EVENT_FULL(FEV_NOTHOST | FEV_RELIABLE, m_pPlayer->edict(), m_usXSFire, 0.01, (float *)&m_pPlayer->pev->origin, (float *)&m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1);
PLAYBACK_EVENT_FULL(0 | FEV_RELIABLE, m_pPlayer->edict(), m_usXSFire, 0.01, (float *)&m_pPlayer->pev->origin, (float *)&m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1);
/*ALERT( at_console, "%f %f %f\n%f %f %f\n",
@ -463,14 +463,14 @@ void CXenSquasher::WeaponIdle(void) @@ -463,14 +463,14 @@ void CXenSquasher::WeaponIdle(void)
m_pPlayer->m_flPlayAftershock = 0.0;
}
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
if (m_flTimeWeaponIdle > gpGlobals->time)
return;
if (m_fInAttack != 0)
{
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
m_flTimeWeaponIdle = gpGlobals->time + 2.0;
}
else
{
@ -479,17 +479,17 @@ void CXenSquasher::WeaponIdle(void) @@ -479,17 +479,17 @@ void CXenSquasher::WeaponIdle(void)
if (flRand <= 0.5)
{
iAnim = XS_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + (63.0f / 15.0f);
m_flTimeWeaponIdle = gpGlobals->time + (63.0f / 15.0f);
}
else if (flRand <= 0.75)
{
iAnim = XS_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + (63.0f / 15.0f);
m_flTimeWeaponIdle = gpGlobals->time + (63.0f / 15.0f);
}
else
{
iAnim = XS_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + (93.0f / 30.0f);
m_flTimeWeaponIdle = gpGlobals->time + (93.0f / 30.0f);
}
//return;

16
dlls/weapons.h

@ -1000,11 +1000,11 @@ public: @@ -1000,11 +1000,11 @@ public:
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
//#if defined( CLIENT_WEAPONS )
// return TRUE;
//#else
return FALSE;
#endif
//#endif
}
void Fire( float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL fFastShoot );
@ -1135,11 +1135,11 @@ public: @@ -1135,11 +1135,11 @@ public:
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
//#if defined( CLIENT_WEAPONS )
// return TRUE;
//#else
return FALSE;
#endif
//#endif
}
private:

2
dlls/world.cpp

@ -654,8 +654,6 @@ void CWorld::Precache( void ) @@ -654,8 +654,6 @@ void CWorld::Precache( void )
CVAR_SET_FLOAT( "mp_defaultteam", 0 );
}
CVAR_SET_FLOAT( "cl_lw", 0 ); //Temporary solution for weapon animation.
// g-cont. moved here so cheats will working on restore level
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
}

Loading…
Cancel
Save