Browse Source

Fix weapon_pipe.

visitors
Night Owl 7 years ago
parent
commit
ea556922b5
  1. 8
      cl_dll/ev_hldm.cpp
  2. 67
      dlls/visitors/pipe.cpp
  3. 6
      dlls/visitors/sniper.cpp
  4. 33
      dlls/weapons.h

8
cl_dll/ev_hldm.cpp

@ -1773,9 +1773,13 @@ enum pipe_e
PIPE_ATTACK2MISS, PIPE_ATTACK2MISS,
PIPE_ATTACK2HIT, PIPE_ATTACK2HIT,
PIPE_ATTACK3MISS, PIPE_ATTACK3MISS,
#ifndef CROWBAR_IDLE_ANIM
PIPE_ATTACK3HIT
#else
PIPE_ATTACK3HIT, PIPE_ATTACK3HIT,
PIPE_IDLE2, PIPE_IDLE2,
PIPE_IDLE3, PIPE_IDLE3
#endif
}; };
//Only predict the miss sounds, hit sounds are still played //Only predict the miss sounds, hit sounds are still played
@ -1795,8 +1799,6 @@ void EV_Pipe( event_args_t *args )
if( EV_IsLocal( idx ) ) if( EV_IsLocal( idx ) )
{ {
gEngfuncs.pEventAPI->EV_WeaponAnimation( PIPE_ATTACK1MISS, 1 );
switch( ( g_iSwing++ ) % 3 ) switch( ( g_iSwing++ ) % 3 )
{ {
case 0: case 0:

67
dlls/visitors/pipe.cpp

@ -38,9 +38,13 @@ enum pipe_e {
PIPE_ATTACK2MISS, PIPE_ATTACK2MISS,
PIPE_ATTACK2HIT, PIPE_ATTACK2HIT,
PIPE_ATTACK3MISS, PIPE_ATTACK3MISS,
#ifndef CROWBAR_IDLE_ANIM
PIPE_ATTACK3HIT
#else
PIPE_ATTACK3HIT, PIPE_ATTACK3HIT,
PIPE_IDLE2, PIPE_IDLE2,
PIPE_IDLE3, PIPE_IDLE3
#endif
}; };
@ -98,8 +102,10 @@ void CPipe::PrimaryAttack()
{ {
if (!Swing(1)) if (!Swing(1))
{ {
#ifndef CLIENT_DLL
SetThink(&CPipe::SwingAgain); SetThink(&CPipe::SwingAgain);
pev->nextthink = gpGlobals->time + 0.1f; pev->nextthink = gpGlobals->time + 0.5f;
#endif
} }
} }
@ -143,6 +149,9 @@ int CPipe::Swing(int fFirst)
// miss // miss
m_flNextPrimaryAttack = GetNextAttackDelay(0.5); m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
#ifdef CROWBAR_IDLE_ANIM
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
#endif
// player "shoot" animation // player "shoot" animation
m_pPlayer->SetAnimation(PLAYER_ATTACK1); m_pPlayer->SetAnimation(PLAYER_ATTACK1);
} }
@ -170,7 +179,14 @@ int CPipe::Swing(int fFirst)
ClearMultiDamage(); ClearMultiDamage();
// If building with the clientside weapon prediction system,
// UTIL_WeaponTimeBase() is always 0 and m_flNextPrimaryAttack is >= -1.0f, thus making
// m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() always evaluate to false.
#ifdef CLIENT_WEAPONS
if( ( m_flNextPrimaryAttack + 1 == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
#else
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() ) if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
#endif
{ {
// first swing does full damage // first swing does full damage
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar * 2, gpGlobals->v_forward, &tr, DMG_CLUB); pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar * 2, gpGlobals->v_forward, &tr, DMG_CLUB);
@ -194,11 +210,11 @@ int CPipe::Swing(int fFirst)
switch (RANDOM_LONG(0, 2)) switch (RANDOM_LONG(0, 2))
{ {
case 0: case 0:
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1, ATTN_NORM, 0, 75); break; EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1, ATTN_NORM, 0, 100); break;
case 1: case 1:
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1, ATTN_NORM, 0, 75); break; EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1, ATTN_NORM, 0, 100); break;
case 2: case 2:
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1, ATTN_NORM, 0, 75); break; EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1, ATTN_NORM, 0, 100); break;
} }
m_pPlayer->m_iWeaponVolume = PIPE_BODYHIT_VOLUME; m_pPlayer->m_iWeaponVolume = PIPE_BODYHIT_VOLUME;
if (!pEntity->IsAlive()) if (!pEntity->IsAlive())
@ -241,13 +257,44 @@ int CPipe::Swing(int fFirst)
} }
m_pPlayer->m_iWeaponVolume = flVol * PIPE_WALLHIT_VOLUME; m_pPlayer->m_iWeaponVolume = flVol * PIPE_WALLHIT_VOLUME;
#endif
m_flNextPrimaryAttack = GetNextAttackDelay(0.5f); // 0.25f
SetThink(&CPipe::Smack); SetThink(&CPipe::Smack);
pev->nextthink = UTIL_WeaponTimeBase() + 0.2; pev->nextthink = UTIL_WeaponTimeBase() + 0.48;
#endif
m_flNextPrimaryAttack = GetNextAttackDelay(0.5f); // 0.25f
} }
#ifdef CROWBAR_IDLE_ANIM
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
#endif
return fDidHit; return fDidHit;
} }
#ifdef CROWBAR_IDLE_ANIM
void CCrowbar::WeaponIdle( void )
{
if( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
{
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand > 0.9 )
{
iAnim = PIPE_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0;
}
else
{
if( flRand > 0.5 )
{
iAnim = PIPE_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0 / 30.0;
}
else
{
iAnim = PIPE_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0;
}
}
SendWeaponAnim( iAnim );
}
}
#endif

6
dlls/visitors/sniper.cpp

@ -43,7 +43,7 @@ int CSniper::GetItemInfo(ItemInfo *p)
p->iSlot = 3; p->iSlot = 3;
p->iPosition = 1; p->iPosition = 1;
p->iId = m_iId = WEAPON_SNIPER; p->iId = m_iId = WEAPON_SNIPER;
p->iWeight = PYTHON_WEIGHT; p->iWeight = SNIPER_WEIGHT;
return 1; return 1;
} }
@ -120,7 +120,7 @@ void CSniper::SecondaryAttack(void)
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 40; m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 40;
} }
m_flNextSecondaryAttack = 0.5; m_flNextSecondaryAttack = 0.75;
} }
void CSniper::PrimaryAttack() void CSniper::PrimaryAttack()
@ -184,7 +184,7 @@ void CSniper::Reload(void)
if (m_pPlayer->ammo_357 <= 0) if (m_pPlayer->ammo_357 <= 0)
return; return;
int iResult = DefaultReload(SNIPER_MAX_CLIP, SNIPER_RELOAD, 2.0); int iResult = DefaultReload(SNIPER_MAX_CLIP, SNIPER_RELOAD, 2.25);
if (iResult) if (iResult)
{ {

33
dlls/weapons.h

@ -64,22 +64,22 @@ public:
#define WEAPON_NONE 0 #define WEAPON_NONE 0
#define WEAPON_CROWBAR 1 #define WEAPON_CROWBAR 1
#define WEAPON_PIPE 2 #define WEAPON_GLOCK 2
#define WEAPON_GLOCK 3 #define WEAPON_PYTHON 3
#define WEAPON_PYTHON 4 #define WEAPON_MP5 4
#define WEAPON_MP5 5 #define WEAPON_CHAINGUN 5
#define WEAPON_CHAINGUN 6 #define WEAPON_CROSSBOW 6
#define WEAPON_CROSSBOW 7 #define WEAPON_SHOTGUN 7
#define WEAPON_SNIPER 8 #define WEAPON_RPG 8
#define WEAPON_SHOTGUN 9 #define WEAPON_GAUSS 9
#define WEAPON_RPG 10 #define WEAPON_EGON 10
#define WEAPON_GAUSS 11 #define WEAPON_HORNETGUN 11
#define WEAPON_EGON 12 #define WEAPON_HANDGRENADE 12
#define WEAPON_HORNETGUN 13 #define WEAPON_TRIPMINE 13
#define WEAPON_HANDGRENADE 14 #define WEAPON_SATCHEL 14
#define WEAPON_TRIPMINE 15 #define WEAPON_SNARK 15
#define WEAPON_SATCHEL 16 #define WEAPON_SNIPER 16
#define WEAPON_SNARK 17 #define WEAPON_PIPE 17
#define WEAPON_FLASHLIGHT 30 #define WEAPON_FLASHLIGHT 30
#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT)) #define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))
@ -105,6 +105,7 @@ public:
#define SNARK_WEIGHT 5 #define SNARK_WEIGHT 5
#define SATCHEL_WEIGHT -10 #define SATCHEL_WEIGHT -10
#define TRIPMINE_WEIGHT -10 #define TRIPMINE_WEIGHT -10
#define SNIPER_WEIGHT 20
// weapon clip/carry ammo capacities // weapon clip/carry ammo capacities
#define URANIUM_MAX_CARRY 100 #define URANIUM_MAX_CARRY 100

Loading…
Cancel
Save