Browse Source

remake for monster_skrillex and some fixes

clcampaign
RAINBOW2000 8 years ago
parent
commit
40c8ce754c
  1. 52
      dlls/cross.cpp
  2. 2
      dlls/crowbar.cpp
  3. 43
      dlls/glock2.cpp
  4. 40
      dlls/katana.cpp
  5. 38
      dlls/needle.cpp
  6. 67
      dlls/pepsigun.cpp
  7. 39
      dlls/rock.cpp
  8. 17
      dlls/rpg.cpp
  9. 57
      dlls/sawnoff.cpp
  10. 740
      dlls/skrillex.cpp
  11. 348
      dlls/sniper.cpp
  12. 183
      dlls/weapons.h

52
dlls/cross.cpp

@ -14,6 +14,36 @@
#define BOLT_WATER_VELOCITY 1300 #define BOLT_WATER_VELOCITY 1300
class CCrowbar2 : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( ) { return 3; }
int GetItemInfo(ItemInfo *p);
void FireBolt( void );
void FireSniperBolt( void );
void PrimaryAttack( void );
int AddToPlayer( CBasePlayer *pPlayer );
BOOL Deploy( );
void Holster( int skiplocal = 0 );
void WeaponIdle( void );
int m_fInZoom; // don't save this
virtual BOOL UseDecrement( void )
{
return FALSE;
}
private:
unsigned short m_usCrossbow12;
unsigned short m_usCrossbow22;
};
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS() // UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
// //
// OVERLOADS SOME ENTVARS: // OVERLOADS SOME ENTVARS:
@ -294,7 +324,7 @@ void CCrowbar2::Holster( int skiplocal /* = 0 */ )
SecondaryAttack(); SecondaryAttack();
} }
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5;
if( m_iClip ) if( m_iClip )
{ {
SendWeaponAnim( CROSSBOW_HOLSTER ); SendWeaponAnim( CROSSBOW_HOLSTER );
@ -320,7 +350,7 @@ void CCrowbar2::PrimaryAttack( void )
// this function only gets called in multiplayer // this function only gets called in multiplayer
void CCrowbar2::FireSniperBolt() void CCrowbar2::FireSniperBolt()
{ {
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.35; m_flNextPrimaryAttack = gpGlobals->time + 0.35;
TraceResult tr; TraceResult tr;
@ -405,14 +435,14 @@ void CCrowbar2::FireBolt()
// HEV suit - indicate out of ammo condition // HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 ); m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.35; m_flNextPrimaryAttack = gpGlobals->time + 0.35;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.35; m_flNextSecondaryAttack = gpGlobals->time + 0.35;
if( m_iClip != 0 ) if( m_iClip != 0 )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0; m_flTimeWeaponIdle = gpGlobals->time + 5.0;
else else
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75; m_flTimeWeaponIdle = gpGlobals->time + 0.75;
} }
@ -422,7 +452,7 @@ void CCrowbar2::WeaponIdle( void )
ResetEmptySound(); ResetEmptySound();
if( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() ) if( m_flTimeWeaponIdle < gpGlobals->time )
{ {
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 ); float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand <= 0.75 ) if( flRand <= 0.75 )
@ -435,19 +465,19 @@ void CCrowbar2::WeaponIdle( void )
{ {
SendWeaponAnim( CROSSBOW_IDLE ); SendWeaponAnim( CROSSBOW_IDLE );
} }
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
} }
else else
{ {
if( m_iClip ) if( m_iClip )
{ {
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 30.0; m_flTimeWeaponIdle = gpGlobals->time + 90.0 / 30.0;
} }
else else
{ {
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0 / 30.0; m_flTimeWeaponIdle = gpGlobals->time + 80.0 / 30.0;
} }
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
} }
} }
} }

2
dlls/crowbar.cpp

@ -27,7 +27,7 @@
LINK_ENTITY_TO_CLASS( weapon_crowbar, CCrowbar ) LINK_ENTITY_TO_CLASS( weapon_crowbar, CCrowbar )
enum gauss_e enum crowbar_e
{ {
CROWBAR_IDLE = 0, CROWBAR_IDLE = 0,
CROWBAR_DRAW, CROWBAR_DRAW,

43
dlls/glock2.cpp

@ -20,6 +20,33 @@ enum glock_e
GLOCK_ADD_SILENCER GLOCK_ADD_SILENCER
}; };
class CGlock2 : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 2; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
void SecondaryAttack( void );
void GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim );
BOOL Deploy( void );
void Reload( void );
void WeaponIdle( void );
virtual BOOL UseDecrement( void )
{
return FALSE;
}
private:
int m_iShell;
unsigned short m_usFireGlock1;
unsigned short m_usFireGlock2;
};
LINK_ENTITY_TO_CLASS( weapon_glock2, CGlock2 ) LINK_ENTITY_TO_CLASS( weapon_glock2, CGlock2 )
void CGlock2::Spawn() void CGlock2::Spawn()
@ -93,7 +120,7 @@ void CGlock2::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
if( m_fFireOnEmpty ) if( m_fFireOnEmpty )
{ {
PlayEmptySound(); PlayEmptySound();
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2; m_flNextPrimaryAttack = gpGlobals->time + 0.2;
} }
return; return;
@ -142,13 +169,13 @@ void CGlock2::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 );
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + flCycleTime; m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->time + flCycleTime;
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
// HEV suit - indicate out of ammo condition // HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 ); m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
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 CGlock2::Reload( void ) void CGlock2::Reload( void )
@ -165,7 +192,7 @@ void CGlock2::Reload( void )
if( iResult ) if( iResult )
{ {
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
} }
} }
@ -175,7 +202,7 @@ void CGlock2::WeaponIdle( void )
m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) if( m_flTimeWeaponIdle > gpGlobals->time )
return; return;
// only idle if the slid isn't back // only idle if the slid isn't back
@ -187,17 +214,17 @@ void CGlock2::WeaponIdle( void )
if( flRand <= 0.3 + 0 * 0.75 ) if( flRand <= 0.3 + 0 * 0.75 )
{ {
iAnim = GLOCK_IDLE3; iAnim = GLOCK_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 49.0 / 16; m_flTimeWeaponIdle = gpGlobals->time + 49.0 / 16;
} }
else if( flRand <= 0.6 + 0 * 0.875 ) else if( flRand <= 0.6 + 0 * 0.875 )
{ {
iAnim = GLOCK_IDLE1; iAnim = GLOCK_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0 / 16.0; m_flTimeWeaponIdle = gpGlobals->time + 60.0 / 16.0;
} }
else else
{ {
iAnim = GLOCK_IDLE2; iAnim = GLOCK_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0 / 16.0; m_flTimeWeaponIdle = gpGlobals->time + 40.0 / 16.0;
} }
SendWeaponAnim( iAnim, 1 ); SendWeaponAnim( iAnim, 1 );
} }

40
dlls/katana.cpp

@ -25,9 +25,7 @@
#define CROWBAR_BODYHIT_VOLUME 128 #define CROWBAR_BODYHIT_VOLUME 128
#define CROWBAR_WALLHIT_VOLUME 512 #define CROWBAR_WALLHIT_VOLUME 512
LINK_ENTITY_TO_CLASS( weapon_katana, CKatana ) enum katana_e
enum gauss_e
{ {
CROWBAR_IDLE = 0, CROWBAR_IDLE = 0,
CROWBAR_DRAW, CROWBAR_DRAW,
@ -40,6 +38,32 @@ enum gauss_e
CROWBAR_ATTACK3HIT CROWBAR_ATTACK3HIT
}; };
class CKatana : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 1; }
void EXPORT SwingAgain( void );
void EXPORT Smack( void );
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
int Swing( int fFirst );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
int m_iSwing;
TraceResult m_trHit;
virtual BOOL UseDecrement( void )
{
return FALSE;
}
private:
unsigned short m_usKatana;
};
LINK_ENTITY_TO_CLASS( weapon_katana, CKatana )
void CKatana::Spawn( ) void CKatana::Spawn( )
{ {
@ -89,7 +113,7 @@ BOOL CKatana::Deploy()
void CKatana::Holster( int skiplocal /* = 0 */ ) void CKatana::Holster( int skiplocal /* = 0 */ )
{ {
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5;
SendWeaponAnim( CROWBAR_HOLSTER ); SendWeaponAnim( CROWBAR_HOLSTER );
} }
@ -192,7 +216,7 @@ int CKatana::Swing( int fFirst )
if( fFirst ) if( fFirst )
{ {
// miss // miss
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; m_flNextPrimaryAttack = gpGlobals->time + 0.5;
// player "shoot" animation // player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
@ -223,7 +247,7 @@ int CKatana::Swing( int fFirst )
ClearMultiDamage(); ClearMultiDamage();
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() ) if( ( m_flNextPrimaryAttack + 1 < gpGlobals->time ) || g_pGameRules->IsMultiplayer() )
{ {
// first swing does full damage // first swing does full damage
pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB ); pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB );
@ -298,10 +322,10 @@ int CKatana::Swing( int fFirst )
m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME; m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME;
#endif #endif
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; m_flNextPrimaryAttack = gpGlobals->time + 0.25;
SetThink( &CKatana::Smack ); SetThink( &CKatana::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.2; pev->nextthink = gpGlobals->time + 0.2;
} }
return fDidHit; return fDidHit;
} }

38
dlls/needle.cpp

@ -25,9 +25,35 @@
#define NEEDLE_BODYHIT_VOLUME 128 #define NEEDLE_BODYHIT_VOLUME 128
#define NEEDLE_WALLHIT_VOLUME 512 #define NEEDLE_WALLHIT_VOLUME 512
class CNeedle : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 1; }
void EXPORT SwingAgain( void );
void EXPORT Smack( void );
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
int Swing( int fFirst );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
int m_iSwing;
TraceResult m_trHit;
virtual BOOL UseDecrement( void )
{
return FALSE;
}
private:
unsigned short m_usNeedle;
};
LINK_ENTITY_TO_CLASS( weapon_needle, CNeedle ) LINK_ENTITY_TO_CLASS( weapon_needle, CNeedle )
enum gauss_e enum needle_e
{ {
NEEDLE_IDLE1, NEEDLE_IDLE1,
NEEDLE_GIVESHOT, NEEDLE_GIVESHOT,
@ -77,7 +103,7 @@ BOOL CNeedle::Deploy()
void CNeedle::Holster( int skiplocal /* = 0 */ ) void CNeedle::Holster( int skiplocal /* = 0 */ )
{ {
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5;
SendWeaponAnim( NEEDLE_IDLE1 ); SendWeaponAnim( NEEDLE_IDLE1 );
} }
@ -184,7 +210,7 @@ FindHullIntersection2( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlay
if( fFirst ) if( fFirst )
{ {
// miss // miss
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; m_flNextPrimaryAttack = gpGlobals->time + 0.5;
// player "shoot" animation // player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
@ -215,7 +241,7 @@ FindHullIntersection2( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlay
ClearMultiDamage(); ClearMultiDamage();
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() ) if( ( m_flNextPrimaryAttack + 1 < gpGlobals->time ) || g_pGameRules->IsMultiplayer() )
{ {
// first swing does full damage // first swing does full damage
pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB ); pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB );
@ -290,10 +316,10 @@ FindHullIntersection2( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlay
m_pPlayer->m_iWeaponVolume = flVol * NEEDLE_WALLHIT_VOLUME; m_pPlayer->m_iWeaponVolume = flVol * NEEDLE_WALLHIT_VOLUME;
#endif #endif
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; m_flNextPrimaryAttack = gpGlobals->time + 0.25;
SetThink( &CNeedle::Smack ); SetThink( &CNeedle::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.2; pev->nextthink = gpGlobals->time + 0.2;
} }
return fDidHit; return fDidHit;
} }

67
dlls/pepsigun.cpp

@ -12,6 +12,8 @@
#define HANDGRENADE_PRIMARY_VOLUME 450 #define HANDGRENADE_PRIMARY_VOLUME 450
#define WEAPON_PEPSIGUN 22 #define WEAPON_PEPSIGUN 22
enum handgrenade_e enum handgrenade_e
{ {
HANDGRENADE_IDLE = 0, HANDGRENADE_IDLE = 0,
@ -22,32 +24,6 @@ enum handgrenade_e
HANDGRENADE_DRAW HANDGRENADE_DRAW
}; };
class CPepsigun : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 4; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
void Reload( void );
BOOL Deploy( void );
BOOL CanHolster( void );
void Holster( int skiplocal = 0 );
void WeaponIdle( void );
int m_fInReload;
float m_flNextReload;
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
return FALSE;
#endif
}
}
LINK_ENTITY_TO_CLASS( weapon_pepsigun, CPepsigun ) LINK_ENTITY_TO_CLASS( weapon_pepsigun, CPepsigun )
LINK_ENTITY_TO_CLASS( ammo_pepsi, CPepsigun ) LINK_ENTITY_TO_CLASS( ammo_pepsi, CPepsigun )
@ -105,7 +81,7 @@ BOOL CPepsigun::CanHolster( void )
void CPepsigun::Holster( int skiplocal /* = 0 */ ) void CPepsigun::Holster( int skiplocal /* = 0 */ )
{ {
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5;
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ) if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{ {
@ -124,11 +100,16 @@ void CPepsigun::Holster( int skiplocal /* = 0 */ )
void CPepsigun::PrimaryAttack() void CPepsigun::PrimaryAttack()
{ {
m_flStartThrow = gpGlobals->time;
m_flReleaseThrow = 0;
m_flTimeWeaponIdle = gpGlobals->time + 0.25;
if(m_iClip > 0) if(m_iClip > 0)
{ {
m_flStartThrow = gpGlobals->time; m_flStartThrow = gpGlobals->time;
m_flReleaseThrow = 0; m_flReleaseThrow = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.25; m_flTimeWeaponIdle = gpGlobals->time + 0.25;
} }
} }
void CPepsigun::Reload( void ) void CPepsigun::Reload( void )
@ -137,7 +118,7 @@ void CPepsigun::Reload( void )
return; return;
// don't reload until recoil is done // don't reload until recoil is done
if( m_flNextPrimaryAttack > UTIL_WeaponTimeBase() ) if( m_flNextPrimaryAttack > gpGlobals->time)
return; return;
// check to see if we're ready to reload // check to see if we're ready to reload
@ -145,15 +126,15 @@ void CPepsigun::Reload( void )
{ {
SendWeaponAnim( HANDGRENADE_OPEN ); SendWeaponAnim( HANDGRENADE_OPEN );
m_fInSpecialReload = 1; m_fInSpecialReload = 1;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.6; m_pPlayer->m_flNextAttack = gpGlobals->time+ 0.6;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6; m_flTimeWeaponIdle = gpGlobals->time + 0.6;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.0; m_flNextPrimaryAttack = gpGlobals->time + 1.0;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0; m_flNextSecondaryAttack = gpGlobals->time + 1.0;
return; return;
} }
else if( m_fInSpecialReload == 1 ) else if( m_fInSpecialReload == 1 )
{ {
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) if( m_flTimeWeaponIdle > gpGlobals->time )
return; return;
// was waiting for gun to move to side // was waiting for gun to move to side
m_fInSpecialReload = 2; m_fInSpecialReload = 2;
@ -165,8 +146,8 @@ void CPepsigun::Reload( void )
SendWeaponAnim( HANDGRENADE_INSERT ); SendWeaponAnim( HANDGRENADE_INSERT );
m_flNextReload = UTIL_WeaponTimeBase() + 0.5; m_flNextReload = gpGlobals->time + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5; m_flTimeWeaponIdle = gpGlobals->time + 0.5;
} }
else else
{ {
@ -200,7 +181,7 @@ void CPepsigun::WeaponIdle( void )
if( m_flReleaseThrow == 0 && m_flStartThrow ) if( m_flReleaseThrow == 0 && m_flStartThrow )
m_flReleaseThrow = gpGlobals->time; m_flReleaseThrow = gpGlobals->time;
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) if( m_flTimeWeaponIdle > gpGlobals->time )
return; return;
if( m_flStartThrow ) if( m_flStartThrow )
@ -250,8 +231,8 @@ void CPepsigun::WeaponIdle( void )
m_flReleaseThrow = 0; m_flReleaseThrow = 0;
m_flStartThrow = 0; m_flStartThrow = 0;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; m_flNextPrimaryAttack = gpGlobals->time + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5; m_flTimeWeaponIdle = gpGlobals->time + 0.5;
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ) if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
@ -259,7 +240,7 @@ void CPepsigun::WeaponIdle( void )
// just threw last grenade // just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw // set attack times in the future, and weapon idle in the future so we can see the whole throw
// animation, weapon idle will automatically retire the weapon for us. // animation, weapon idle will automatically retire the weapon for us.
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;// ensure that the animation can finish playing m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = gpGlobals->time + 0.5;// ensure that the animation can finish playing
} }
return; return;
} }
@ -278,7 +259,7 @@ void CPepsigun::WeaponIdle( void )
return; return;
} }
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flReleaseThrow = -1; m_flReleaseThrow = -1;
return; return;
} }
@ -290,11 +271,11 @@ void CPepsigun::WeaponIdle( void )
if( flRand <= 0.75 ) if( flRand <= 0.75 )
{ {
iAnim = HANDGRENADE_IDLE; iAnim = HANDGRENADE_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again. m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again.
} }
else else
{ {
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0; m_flTimeWeaponIdle = gpGlobals->time + 75.0 / 30.0;
} }
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
// HEV suit - indicate out of ammo condition // HEV suit - indicate out of ammo condition

39
dlls/rock.cpp

@ -22,6 +22,27 @@ enum handgrenade_e
}; };
class CRock : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 5; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
BOOL Deploy( void );
BOOL CanHolster( void );
void Holster( int skiplocal = 0 );
void WeaponIdle( void );
virtual BOOL UseDecrement( void )
{
return FALSE;
}
};
LINK_ENTITY_TO_CLASS( weapon_rock, CRock ) LINK_ENTITY_TO_CLASS( weapon_rock, CRock )
void CRock::Spawn() void CRock::Spawn()
@ -76,7 +97,7 @@ BOOL CRock::CanHolster( void )
void CRock::Holster( int skiplocal /* = 0 */ ) void CRock::Holster( int skiplocal /* = 0 */ )
{ {
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5;
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ) if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{ {
@ -99,7 +120,7 @@ void CRock::PrimaryAttack()
m_flStartThrow = gpGlobals->time; m_flStartThrow = gpGlobals->time;
m_flReleaseThrow = 0; m_flReleaseThrow = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5; m_flTimeWeaponIdle = gpGlobals->time + 0.5;
} }
} }
@ -108,7 +129,7 @@ void CRock::WeaponIdle( void )
if( m_flReleaseThrow == 0 && m_flStartThrow ) if( m_flReleaseThrow == 0 && m_flStartThrow )
m_flReleaseThrow = gpGlobals->time; m_flReleaseThrow = gpGlobals->time;
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) if( m_flTimeWeaponIdle > gpGlobals->time )
return; return;
if( m_flStartThrow ) if( m_flStartThrow )
@ -157,8 +178,8 @@ void CRock::WeaponIdle( void )
m_flReleaseThrow = 0; m_flReleaseThrow = 0;
m_flStartThrow = 0; m_flStartThrow = 0;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; m_flNextPrimaryAttack = gpGlobals->time + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5; m_flTimeWeaponIdle = gpGlobals->time + 0.5;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
@ -167,7 +188,7 @@ void CRock::WeaponIdle( void )
// just threw last grenade // just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw // set attack times in the future, and weapon idle in the future so we can see the whole throw
// animation, weapon idle will automatically retire the weapon for us. // animation, weapon idle will automatically retire the weapon for us.
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;// ensure that the animation can finish playing m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = gpGlobals->time + 0.5;// ensure that the animation can finish playing
} }
return; return;
} }
@ -186,7 +207,7 @@ void CRock::WeaponIdle( void )
return; return;
} }
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flReleaseThrow = -1; m_flReleaseThrow = -1;
return; return;
} }
@ -198,12 +219,12 @@ void CRock::WeaponIdle( void )
if( flRand <= 0.75 ) if( flRand <= 0.75 )
{ {
iAnim = HANDGRENADE_IDLE; iAnim = HANDGRENADE_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again. m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again.
} }
else else
{ {
iAnim = HANDGRENADE_FIDGET; iAnim = HANDGRENADE_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0; m_flTimeWeaponIdle = gpGlobals->time + 75.0 / 30.0;
} }
SendWeaponAnim( iAnim ); SendWeaponAnim( iAnim );

17
dlls/rpg.cpp

@ -15,6 +15,7 @@ enum rpg_e
RPG_FIDGET, RPG_FIDGET,
RPG_RELOAD, // to reload RPG_RELOAD, // to reload
RPG_FIRE2, // to empty RPG_FIRE2, // to empty
RPG_FIRE1, // crack-life second fire
RPG_HOLSTER1, // loaded RPG_HOLSTER1, // loaded
RPG_DRAW1, // loaded RPG_DRAW1, // loaded
RPG_HOLSTER2, // unloaded RPG_HOLSTER2, // unloaded
@ -420,6 +421,7 @@ void CRpg::PrimaryAttack()
{ {
if( m_iClip ) if( m_iClip )
{ {
static int gun = 0;
m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME; m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
@ -428,7 +430,13 @@ void CRpg::PrimaryAttack()
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
UTIL_MakeVectors( m_pPlayer->pev->v_angle ); UTIL_MakeVectors( m_pPlayer->pev->v_angle );
Vector vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -8; Vector vecSrc;
if( gun )
vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -8;
else
vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * -8 + gpGlobals->v_up * -8;
CRpgRocket *pRocket = CRpgRocket::CreateRpgRocket( vecSrc, m_pPlayer->pev->v_angle, m_pPlayer, this ); CRpgRocket *pRocket = CRpgRocket::CreateRpgRocket( vecSrc, m_pPlayer->pev->v_angle, m_pPlayer, this );
@ -445,12 +453,15 @@ void CRpg::PrimaryAttack()
#else #else
flags = 0; flags = 0;
#endif #endif
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usRpg ); //PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usRpg );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "weapons/rocketfire1.wav", 0.9, ATTN_NORM, 0, PITCH_NORM );
EMIT_SOUND_DYN( edict(), CHAN_ITEM, "weapons/glauncher.wav", 0.7, ATTN_NORM, 0, PITCH_NORM );
SendWeaponAnim( RPG_FIRE2 + 1 - gun );
m_iClip--; m_iClip--;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.25; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.25;
gun = !gun;
} }
else else
{ {

57
dlls/sawnoff.cpp

@ -40,6 +40,35 @@ enum sawnoff_e
SAWNOFF_IDLE_DEEP SAWNOFF_IDLE_DEEP
}; };
class CSawnoff : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( ) { return 3; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
void PrimaryAttack( void );
void SecondaryAttack( void );
BOOL Deploy( );
void Reload( void );
void WeaponIdle( void );
int m_fInReload;
float m_flNextReload;
int m_iShell;
virtual BOOL UseDecrement( void )
{
return FALSE;
}
private:
unsigned short m_usDoubleFire;
unsigned short m_usSingleFire;
};
LINK_ENTITY_TO_CLASS( weapon_sawnoff, CSawnoff ) LINK_ENTITY_TO_CLASS( weapon_sawnoff, CSawnoff )
void CSawnoff::Spawn() void CSawnoff::Spawn()
@ -119,7 +148,7 @@ void CSawnoff::PrimaryAttack()
if( m_pPlayer->pev->waterlevel == 3 ) if( m_pPlayer->pev->waterlevel == 3 )
{ {
PlayEmptySound(); PlayEmptySound();
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15; m_flNextPrimaryAttack = gpGlobals->time + 0.15;
return; return;
} }
@ -172,12 +201,12 @@ void CSawnoff::PrimaryAttack()
if( m_iClip != 0 ) if( m_iClip != 0 )
m_flPumpTime = gpGlobals->time + 0.5; m_flPumpTime = gpGlobals->time + 0.5;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75; m_flNextPrimaryAttack = gpGlobals->time + 0.75;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75; m_flNextSecondaryAttack = gpGlobals->time + 0.75;
if( m_iClip != 0 ) if( m_iClip != 0 )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0; m_flTimeWeaponIdle = gpGlobals->time + 5.0;
else else
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75; m_flTimeWeaponIdle = gpGlobals->time + 0.75;
m_fInSpecialReload = 0; m_fInSpecialReload = 0;
} }
@ -187,7 +216,7 @@ void CSawnoff::SecondaryAttack( void )
if( m_pPlayer->pev->waterlevel == 3 ) if( m_pPlayer->pev->waterlevel == 3 )
{ {
PlayEmptySound(); PlayEmptySound();
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15; m_flNextPrimaryAttack = gpGlobals->time + 0.15;
return; return;
} }
@ -243,10 +272,10 @@ void CSawnoff::SecondaryAttack( void )
if( m_iClip != 0 ) if( m_iClip != 0 )
m_flPumpTime = gpGlobals->time + 0.95; m_flPumpTime = gpGlobals->time + 0.95;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.5; m_flNextPrimaryAttack = gpGlobals->time + 1.5;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5; m_flNextSecondaryAttack = gpGlobals->time + 1.5;
if( m_iClip != 0 ) if( m_iClip != 0 )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 6.0; m_flTimeWeaponIdle = gpGlobals->time + 6.0;
else else
m_flTimeWeaponIdle = 1.5; m_flTimeWeaponIdle = 1.5;
@ -276,7 +305,7 @@ void CSawnoff::WeaponIdle( void )
m_flPumpTime = 0; m_flPumpTime = 0;
} }
if( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() ) if( m_flTimeWeaponIdle < gpGlobals->time )
{ {
if( m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ) if( m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{ {
@ -296,7 +325,7 @@ void CSawnoff::WeaponIdle( void )
// play cocking sound // play cocking sound
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/scock1.wav", 1, ATTN_NORM, 0, 95 + RANDOM_LONG( 0, 0x1f ) ); EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/scock1.wav", 1, ATTN_NORM, 0, 95 + RANDOM_LONG( 0, 0x1f ) );
m_fInSpecialReload = 0; m_fInSpecialReload = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5; m_flTimeWeaponIdle = gpGlobals->time + 1.5;
} }
} }
else else
@ -306,17 +335,17 @@ void CSawnoff::WeaponIdle( void )
if( flRand <= 0.8 ) if( flRand <= 0.8 )
{ {
iAnim = SAWNOFF_IDLE_DEEP; iAnim = SAWNOFF_IDLE_DEEP;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 60.0 / 12.0 );// * RANDOM_LONG( 2, 5 ); m_flTimeWeaponIdle = gpGlobals->time + ( 60.0 / 12.0 );// * RANDOM_LONG( 2, 5 );
} }
else if( flRand <= 0.95 ) else if( flRand <= 0.95 )
{ {
iAnim = SAWNOFF_IDLE; iAnim = SAWNOFF_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 20.0 / 9.0 ); m_flTimeWeaponIdle = gpGlobals->time + ( 20.0 / 9.0 );
} }
else else
{ {
iAnim = SAWNOFF_IDLE4; iAnim = SAWNOFF_IDLE4;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 20.0 / 9.0 ); m_flTimeWeaponIdle = gpGlobals->time + ( 20.0 / 9.0 );
} }
SendWeaponAnim( iAnim ); SendWeaponAnim( iAnim );
} }

740
dlls/skrillex.cpp

@ -1,4 +1,3 @@
//This will be remake
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
@ -14,86 +13,121 @@
* *
****/ ****/
//========================================================= //=========================================================
// Zombie // Alien slave monster
//========================================================= //=========================================================
// UNDONE: Don't flinch every time you get hit
#include "extdll.h" #include "extdll.h"
#include "util.h" #include "util.h"
#include "cbase.h" #include "cbase.h"
#include "monsters.h" #include "monsters.h"
#include "squadmonster.h"
#include "schedule.h" #include "schedule.h"
#include "effects.h"
#include "weapons.h"
#include "soundent.h"
extern DLL_GLOBAL int g_iSkillLevel;
//========================================================= //=========================================================
// Monster's Anim Events Go Here // Monster's Anim Events Go Here
//========================================================= //=========================================================
#define ZOMBIE_AE_ATTACK_RIGHT 0x01 #define ISLAVE_AE_CLAW ( 1 )
#define ZOMBIE_AE_ATTACK_LEFT 0x02 #define ISLAVE_AE_CLAWRAKE ( 2 )
#define ZOMBIE_AE_ATTACK_BOTH 0x03 #define ISLAVE_AE_ZAP_POWERUP ( 3 )
#define ISLAVE_AE_ZAP_SHOOT ( 4 )
#define ISLAVE_AE_ZAP_DONE ( 5 )
#define ZOMBIE_FLINCH_DELAY 2 // at most one flinch every n secs #define ISLAVE_MAX_BEAMS 8
class CSkrillex : public CBaseMonster class CSkrillex : public CSquadMonster
{ {
public: public:
void Spawn( void ); void Spawn( void );
void Precache( void ); void Precache( void );
void SetYawSpeed( void ); void SetYawSpeed( void );
int ISoundMask( void );
int Classify( void ); int Classify( void );
int IRelationship( CBaseEntity *pTarget );
void HandleAnimEvent( MonsterEvent_t *pEvent ); void HandleAnimEvent( MonsterEvent_t *pEvent );
int IgnoreConditions( void ); BOOL CheckRangeAttack1( float flDot, float flDist );
BOOL CheckRangeAttack2( float flDot, float flDist );
void CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation );
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType );
int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
float m_flNextFlinch;
void PainSound( void );
void AlertSound( void );
void IdleSound( void ); void IdleSound( void );
void AttackSound( void );
static const char *pAttackSounds[]; void Killed( entvars_t *pevAttacker, int iGib );
static const char *pIdleSounds[];
static const char *pAlertSounds[]; void StartTask( Task_t *pTask );
static const char *pPainSounds[]; Schedule_t *GetSchedule( void );
Schedule_t *GetScheduleOfType( int Type );
CUSTOM_SCHEDULES
int Save( CSave &save );
int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
void ClearBeams();
void ArmBeam( int side );
void WackBeam( int side, CBaseEntity *pEntity );
void ZapBeam( int side );
void BeamGlow( void );
int m_iBravery;
CBeam *m_pBeam[ISLAVE_MAX_BEAMS];
int m_iBeams;
float m_flNextAttack;
int m_voicePitch;
EHANDLE m_hDead;
static const char *pAttackHitSounds[]; static const char *pAttackHitSounds[];
static const char *pAttackMissSounds[]; static const char *pAttackMissSounds[];
static const char *pPainSounds[];
// No range attacks static const char *pDeathSounds[];
BOOL CheckRangeAttack1( float flDot, float flDist ) { return FALSE; }
BOOL CheckRangeAttack2( float flDot, float flDist ) { return FALSE; }
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
}; };
LINK_ENTITY_TO_CLASS( monster_skrillex, CSkrillex ) LINK_ENTITY_TO_CLASS( monster_skrillex, CSkrillex )
const char *CSkrillex::pAttackHitSounds[] = TYPEDESCRIPTION CSkrillex::m_SaveData[] =
{ {
"skrillex/fire.wav", DEFINE_FIELD( CSkrillex, m_iBravery, FIELD_INTEGER ),
};
DEFINE_ARRAY( CSkrillex, m_pBeam, FIELD_CLASSPTR, ISLAVE_MAX_BEAMS ),
DEFINE_FIELD( CSkrillex, m_iBeams, FIELD_INTEGER ),
DEFINE_FIELD( CSkrillex, m_flNextAttack, FIELD_TIME ),
DEFINE_FIELD( CSkrillex, m_voicePitch, FIELD_INTEGER ),
DEFINE_FIELD( CSkrillex, m_hDead, FIELD_EHANDLE ),
const char *CSkrillex::pAttackMissSounds[] =
{
"skrillex/fire.wav",
}; };
const char *CSkrillex::pAttackSounds[] = IMPLEMENT_SAVERESTORE( CSkrillex, CSquadMonster )
const char *CSkrillex::pAttackHitSounds[] =
{ {
"skrillex/fire.wav", "skrillex/charge.wav",
}; };
const char *CSkrillex::pIdleSounds[] = const char *CSkrillex::pAttackMissSounds[] =
{ {
"turret/tu_alert.wav", "skrillex/charge.wav",
}; };
const char *CSkrillex::pAlertSounds[] = const char *CSkrillex::pPainSounds[] =
{ {
"turret/tu_alert.wav", "aslave/slv_null.wav",
}; };
const char *CSkrillex::pPainSounds[] = const char *CSkrillex::pDeathSounds[] =
{ {
"turret/tu_alert.wav", "aslave/slv_null.wav",
"aslave/slv_null.wav",
}; };
//========================================================= //=========================================================
@ -102,152 +136,327 @@ const char *CSkrillex::pPainSounds[] =
//========================================================= //=========================================================
int CSkrillex::Classify( void ) int CSkrillex::Classify( void )
{ {
return CLASS_ALIEN_MONSTER; return CLASS_ALIEN_MILITARY;
} }
//========================================================= int CSkrillex::IRelationship( CBaseEntity *pTarget )
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
void CSkrillex::SetYawSpeed( void )
{ {
int ys; if( ( pTarget->IsPlayer() ) )
if( ( pev->spawnflags & SF_MONSTER_WAIT_UNTIL_PROVOKED ) && ! ( m_afMemory & bits_MEMORY_PROVOKED ) )
return R_NO;
return CBaseMonster::IRelationship( pTarget );
}
ys = 120; void CSkrillex::CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation )
#if 0 {
switch ( m_Activity ) // ALERT( at_aiconsole, "help " );
// skip ones not on my netname
if( FStringNull( pev->netname ) )
return;
CBaseEntity *pEntity = NULL;
while( ( pEntity = UTIL_FindEntityByString( pEntity, "netname", STRING( pev->netname ) ) ) != NULL)
{ {
float d = ( pev->origin - pEntity->pev->origin ).Length();
if( d < flDist )
{
CBaseMonster *pMonster = pEntity->MyMonsterPointer();
if( pMonster )
{
pMonster->m_afMemory |= bits_MEMORY_PROVOKED;
pMonster->PushEnemy( hEnemy, vecLocation );
}
}
} }
#endif
pev->yaw_speed = ys;
} }
int CSkrillex::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
void CSkrillex::IdleSound( void )
{ {
// Take 30% damage from bullets if( RANDOM_LONG( 0, 2 ) == 0 )
if( bitsDamageType == DMG_BULLET )
{ {
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5; SENTENCEG_PlayRndSz( ENT( pev ), "SLV_IDLE", 0.85, ATTN_NORM, 0, m_voicePitch );
vecDir = vecDir.Normalize();
float flForce = DamageForce( flDamage );
pev->velocity = pev->velocity + vecDir * flForce;
flDamage *= 0.3;
} }
#if 0
// HACK HACK -- until we fix this. int side = RANDOM_LONG( 0, 1 ) * 2 - 1;
if( IsAlive() )
PainSound(); ClearBeams();
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType ); ArmBeam( side );
UTIL_MakeAimVectors( pev->angles );
Vector vecSrc = pev->origin + gpGlobals->v_right * 2 * side;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecSrc.x ); // X
WRITE_COORD( vecSrc.y ); // Y
WRITE_COORD( vecSrc.z ); // Z
WRITE_BYTE( 8 ); // radius * 0.1
WRITE_BYTE( 255 ); // r
WRITE_BYTE( 180 ); // g
WRITE_BYTE( 96 ); // b
WRITE_BYTE( 10 ); // time * 10
WRITE_BYTE( 0 ); // decay * 0.1
MESSAGE_END();
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "debris/flesh1.wav", 1, ATTN_NORM, 0, 100 );
#endif
} }
void CSkrillex::PainSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
if( RANDOM_LONG( 0, 5 ) < 2 ) //=========================================================
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch ); // ISoundMask - returns a bit mask indicating which types
// of sounds this monster regards.
//=========================================================
int CSkrillex::ISoundMask( void )
{
return bits_SOUND_WORLD |
bits_SOUND_COMBAT |
bits_SOUND_DANGER |
bits_SOUND_PLAYER;
} }
void CSkrillex::AlertSound( void ) void CSkrillex::Killed( entvars_t *pevAttacker, int iGib )
{ {
int pitch = 95 + RANDOM_LONG( 0, 9 ); ClearBeams();
CSquadMonster::Killed( pevAttacker, iGib );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[ RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
} }
void CSkrillex::IdleSound( void ) //=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
void CSkrillex::SetYawSpeed( void )
{ {
int pitch = 95 + RANDOM_LONG( 0, 9 ); int ys;
// Play a random idle sound switch( m_Activity )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) -1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); {
} case ACT_WALK:
ys = 50;
break;
case ACT_RUN:
ys = 70;
break;
case ACT_IDLE:
ys = 50;
break;
default:
ys = 90;
break;
}
void CSkrillex::AttackSound( void ) pev->yaw_speed = ys;
{
// Play a random attack sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
} }
//========================================================= //=========================================================
// HandleAnimEvent - catches the monster-specific messages // HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played. // that occur when tagged animation frames are played.
//
// Returns number of events handled, 0 if none.
//========================================================= //=========================================================
void CSkrillex::HandleAnimEvent( MonsterEvent_t *pEvent ) void CSkrillex::HandleAnimEvent( MonsterEvent_t *pEvent )
{ {
// ALERT( at_console, "event %d : %f\n", pEvent->event, pev->frame );
switch( pEvent->event ) switch( pEvent->event )
{ {
case ZOMBIE_AE_ATTACK_RIGHT: case ISLAVE_AE_CLAW:
{ {
// do stuff for this event. // SOUND HERE!
//ALERT( at_console, "Slash right!\n" ); CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.slaveDmgClaw, DMG_SLASH );
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH );
if( pHurt ) if( pHurt )
{ {
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{ {
pHurt->pev->punchangle.z = -18; pHurt->pev->punchangle.z = -18;
pHurt->pev->punchangle.x = 5; pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
} }
// Play a random attack hit sound // Play a random attack hit sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5 , 5 ) ); EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
}
else
{
// Play a random attack miss sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
} }
else // Play a random attack miss sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
} }
break; break;
case ZOMBIE_AE_ATTACK_LEFT: case ISLAVE_AE_CLAWRAKE:
{ {
// do stuff for this event. CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.slaveDmgClawrake, DMG_SLASH );
//ALERT( at_console, "Slash left!\n" );
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH );
if( pHurt ) if( pHurt )
{ {
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{ {
pHurt->pev->punchangle.z = 18; pHurt->pev->punchangle.z = -18;
pHurt->pev->punchangle.x = 5; pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 100;
} }
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
} }
else else
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); {
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
}
}
break;
case ISLAVE_AE_ZAP_POWERUP:
{
// speed up attack when on hard
if( g_iSkillLevel == SKILL_HARD )
pev->framerate = 1.5;
UTIL_MakeAimVectors( pev->angles );
if( RANDOM_LONG( 0, 1 ) ) if( m_iBeams == 0 )
AttackSound(); {
Vector vecSrc = pev->origin + gpGlobals->v_forward * 2;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecSrc.x ); // X
WRITE_COORD( vecSrc.y ); // Y
WRITE_COORD( vecSrc.z ); // Z
WRITE_BYTE( 12 ); // radius * 0.1
WRITE_BYTE( 255 ); // r
WRITE_BYTE( 180 ); // g
WRITE_BYTE( 96 ); // b
WRITE_BYTE( 20 / pev->framerate ); // time * 10
WRITE_BYTE( 0 ); // decay * 0.1
MESSAGE_END();
}
if( m_hDead != NULL )
{
WackBeam( -1, m_hDead );
WackBeam( 1, m_hDead );
}
else
{
ArmBeam( -1 );
ArmBeam( 1 );
BeamGlow();
}
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "skrillex/fire.wav", 1, ATTN_NORM, 0, 100 + m_iBeams * 10 );
pev->skin = m_iBeams / 2;
} }
break; break;
case ZOMBIE_AE_ATTACK_BOTH: case ISLAVE_AE_ZAP_SHOOT:
{ {
// do stuff for this event. ClearBeams();
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgBothSlash, DMG_SLASH );
if( pHurt ) if( m_hDead != NULL )
{ {
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) Vector vecDest = m_hDead->pev->origin + Vector( 0, 0, 38 );
TraceResult trace;
UTIL_TraceHull( vecDest, vecDest, dont_ignore_monsters, human_hull, m_hDead->edict(), &trace );
if( !trace.fStartSolid )
{ {
pHurt->pev->punchangle.x = 5; CBaseEntity *pNew = Create( "monster_skrillex", m_hDead->pev->origin, m_hDead->pev->angles );
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -100; CBaseMonster *pNewMonster = pNew->MyMonsterPointer( );
pNew->pev->spawnflags |= 1;
WackBeam( -1, pNew );
WackBeam( 1, pNew );
UTIL_Remove( m_hDead );
/*
CBaseEntity *pEffect = Create( "test_effect", pNew->Center(), pev->angles );
pEffect->Use( this, this, USE_ON, 1 );
*/
break;
} }
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
} }
else ClearMultiDamage();
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
UTIL_MakeAimVectors( pev->angles );
ZapBeam( -1 );
ZapBeam( 1 );
if( RANDOM_LONG( 0, 1 ) ) // STOP_SOUND( ENT( pev ), CHAN_WEAPON, "debris/zap4.wav" );
AttackSound(); ApplyMultiDamage( pev, pev );
m_flNextAttack = gpGlobals->time + RANDOM_FLOAT( 0.5, 4.0 );
}
break;
case ISLAVE_AE_ZAP_DONE:
{
ClearBeams();
} }
break; break;
default: default:
CBaseMonster::HandleAnimEvent( pEvent ); CSquadMonster::HandleAnimEvent( pEvent );
break; break;
} }
} }
//=========================================================
// CheckRangeAttack1 - normal beam attack
//=========================================================
BOOL CSkrillex::CheckRangeAttack1( float flDot, float flDist )
{
if( m_flNextAttack > gpGlobals->time )
{
return FALSE;
}
return CSquadMonster::CheckRangeAttack1( flDot, flDist );
}
//=========================================================
// CheckRangeAttack2 - check bravery and try to resurect dead comrades
//=========================================================
BOOL CSkrillex::CheckRangeAttack2( float flDot, float flDist )
{
return FALSE;
if( m_flNextAttack > gpGlobals->time )
{
return FALSE;
}
m_hDead = NULL;
m_iBravery = 0;
CBaseEntity *pEntity = NULL;
while( ( pEntity = UTIL_FindEntityByClassname( pEntity, "monster_skrillex" ) ) != NULL )
{
TraceResult tr;
UTIL_TraceLine( EyePosition(), pEntity->EyePosition(), ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 || tr.pHit == pEntity->edict() )
{
if( pEntity->pev->deadflag == DEAD_DEAD )
{
float d = ( pev->origin - pEntity->pev->origin ).Length();
if( d < flDist )
{
m_hDead = pEntity;
flDist = d;
}
m_iBravery--;
}
else
{
m_iBravery++;
}
}
}
if( m_hDead != NULL )
return TRUE;
else
return FALSE;
}
//=========================================================
// StartTask
//=========================================================
void CSkrillex::StartTask( Task_t *pTask )
{
ClearBeams();
CSquadMonster::StartTask( pTask );
}
//========================================================= //=========================================================
// Spawn // Spawn
//========================================================= //=========================================================
@ -255,17 +464,20 @@ void CSkrillex::Spawn()
{ {
Precache(); Precache();
SET_MODEL( ENT(pev), "models/skrillex.mdl" ); SET_MODEL( ENT( pev ), "models/skrillex.mdl" );
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX ); UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
pev->solid = SOLID_SLIDEBOX; pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP; pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_RED; m_bloodColor = BLOOD_COLOR_RED;
pev->health = 6000; pev->effects = 0;
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin. pev->health = 2000;
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result ) pev->view_ofs = Vector( 0, 0, 64 );// position of the eyes relative to monster's origin.
m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello
m_MonsterState = MONSTERSTATE_NONE; m_MonsterState = MONSTERSTATE_NONE;
m_afCapability = bits_CAP_DOORS_GROUP; m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_RANGE_ATTACK2 | bits_CAP_DOORS_GROUP;
m_voicePitch = RANDOM_LONG( 85, 110 );
MonsterInit(); MonsterInit();
} }
@ -278,6 +490,9 @@ void CSkrillex::Precache()
int i; int i;
PRECACHE_MODEL( "models/skrillex.mdl" ); PRECACHE_MODEL( "models/skrillex.mdl" );
PRECACHE_MODEL( "sprites/shit.spr" );
PRECACHE_SOUND( "skrillex/fire.wav" );
PRECACHE_SOUND( "skrillex/charge.wav" );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ ) for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackHitSounds[i] ); PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
@ -285,43 +500,284 @@ void CSkrillex::Precache()
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ ) for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackMissSounds[i] ); PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ ) for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackSounds[i] ); PRECACHE_SOUND((char *)pPainSounds[i] );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ ) for( i = 0; i < ARRAYSIZE( pDeathSounds ); i++ )
PRECACHE_SOUND( (char *)pIdleSounds[i] ); PRECACHE_SOUND( (char *)pDeathSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ ) UTIL_PrecacheOther( "test_effect" );
PRECACHE_SOUND( (char *)pAlertSounds[i] ); }
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ ) //=========================================================
PRECACHE_SOUND( (char *)pPainSounds[i] ); // TakeDamage - get provoked when injured
//=========================================================
int CSkrillex::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
// don't slash one of your own
if( ( bitsDamageType & DMG_SLASH ) && pevAttacker && IRelationship( Instance( pevAttacker ) ) < R_DL )
return 0;
m_afMemory |= bits_MEMORY_PROVOKED;
return CSquadMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
void CSkrillex::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
if( bitsDamageType & DMG_SHOCK )
return;
CSquadMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );
} }
//========================================================= //=========================================================
// AI Schedules Specific to this monster // AI Schedules Specific to this monster
//========================================================= //=========================================================
int CSkrillex::IgnoreConditions( void ) // primary range attack
Task_t tlSkrillexAttack1[] =
{ {
int iIgnore = CBaseMonster::IgnoreConditions(); { TASK_STOP_MOVING, 0 },
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_RANGE_ATTACK1, (float)0 },
};
if( ( m_Activity == ACT_MELEE_ATTACK1 ) || ( m_Activity == ACT_MELEE_ATTACK1 ) ) Schedule_t slSkrillexAttack1[] =
{
{ {
#if 0 tlSkrillexAttack1,
if( pev->health < 20 ) ARRAYSIZE ( tlSkrillexAttack1 ),
iIgnore |= ( bits_COND_LIGHT_DAMAGE| bits_COND_HEAVY_DAMAGE ); bits_COND_CAN_MELEE_ATTACK1 |
else bits_COND_HEAR_SOUND |
#endif bits_COND_HEAVY_DAMAGE,
if( m_flNextFlinch >= gpGlobals->time )
iIgnore |= ( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ); bits_SOUND_DANGER,
"Slave Range Attack1"
},
};
DEFINE_CUSTOM_SCHEDULES( CSkrillex )
{
slSkrillexAttack1,
};
IMPLEMENT_CUSTOM_SCHEDULES( CSkrillex, CSquadMonster )
//=========================================================
//=========================================================
Schedule_t *CSkrillex::GetSchedule( void )
{
ClearBeams();
/*
if( pev->spawnflags )
{
pev->spawnflags = 0;
return GetScheduleOfType( SCHED_RELOAD );
}
*/
if( HasConditions( bits_COND_HEAR_SOUND ) )
{
CSound *pSound;
pSound = PBestSound();
ASSERT( pSound != NULL );
if( pSound && ( pSound->m_iType & bits_SOUND_DANGER ) )
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_BEST_SOUND );
if( pSound->m_iType & bits_SOUND_COMBAT )
m_afMemory |= bits_MEMORY_PROVOKED;
} }
if( ( m_Activity == ACT_SMALL_FLINCH ) || ( m_Activity == ACT_BIG_FLINCH ) ) switch( m_MonsterState )
{ {
if( m_flNextFlinch < gpGlobals->time ) case MONSTERSTATE_COMBAT:
m_flNextFlinch = gpGlobals->time + ZOMBIE_FLINCH_DELAY; // dead enemy
if( HasConditions( bits_COND_ENEMY_DEAD ) )
{
// call base class, all code to handle dead enemies is centralized there.
return CBaseMonster::GetSchedule();
} }
return iIgnore; if( pev->health < 20 || m_iBravery < 0 )
{
if( !HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) )
{
m_failSchedule = SCHED_CHASE_ENEMY;
if( HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) )
{
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY );
}
if( HasConditions( bits_COND_SEE_ENEMY ) && HasConditions( bits_COND_ENEMY_FACING_ME ) )
{
// ALERT( at_console, "exposed\n");
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY );
}
}
}
break;
default:
break;
}
return CSquadMonster::GetSchedule();
}
Schedule_t *CSkrillex::GetScheduleOfType( int Type )
{
switch( Type )
{
case SCHED_FAIL:
if( HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) )
{
return CSquadMonster::GetScheduleOfType( SCHED_MELEE_ATTACK1 );
}
break;
case SCHED_RANGE_ATTACK1:
return slSkrillexAttack1;
case SCHED_RANGE_ATTACK2:
return slSkrillexAttack1;
}
return CSquadMonster::GetScheduleOfType( Type );
}
//=========================================================
// ArmBeam - small beam from arm to nearby geometry
//=========================================================
void CSkrillex::ArmBeam( int side )
{
TraceResult tr;
float flDist = 1.0;
if( m_iBeams >= ISLAVE_MAX_BEAMS )
return;
UTIL_MakeAimVectors( pev->angles );
Vector vecSrc = pev->origin + gpGlobals->v_up * 36 + gpGlobals->v_right * side * 16 + gpGlobals->v_forward * 32;
for( int i = 0; i < 3; i++ )
{
Vector vecAim = gpGlobals->v_right * side * RANDOM_FLOAT( 0, 1 ) + gpGlobals->v_up * RANDOM_FLOAT( -1, 1 );
TraceResult tr1;
UTIL_TraceLine( vecSrc, vecSrc + vecAim * 512, dont_ignore_monsters, ENT( pev ), &tr1 );
if( flDist > tr1.flFraction )
{
tr = tr1;
flDist = tr.flFraction;
}
}
// Couldn't find anything close enough
if( flDist == 1.0 )
return;
DecalGunshot( &tr, BULLET_PLAYER_CROWBAR );
m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/shit.spr", 30 );
if( !m_pBeam[m_iBeams] )
return;
m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, entindex() );
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 );
// m_pBeam[m_iBeams]->SetColor( 180, 255, 96 );
m_pBeam[m_iBeams]->SetColor( 6, 0, 106 );
m_pBeam[m_iBeams]->SetBrightness( 64 );
m_pBeam[m_iBeams]->SetNoise( 80 );
m_iBeams++;
}
//=========================================================
// BeamGlow - brighten all beams
//=========================================================
void CSkrillex::BeamGlow()
{
int b = m_iBeams * 32;
if( b > 255 )
b = 255;
for( int i = 0; i < m_iBeams; i++ )
{
if( m_pBeam[i]->GetBrightness() != 255 )
{
m_pBeam[i]->SetBrightness( b );
}
}
}
//=========================================================
// WackBeam - regenerate dead colleagues
//=========================================================
void CSkrillex::WackBeam( int side, CBaseEntity *pEntity )
{
Vector vecDest;
float flDist = 1.0;
if( m_iBeams >= ISLAVE_MAX_BEAMS )
return;
if( pEntity == NULL )
return;
m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/shit.spr", 30 );
if( !m_pBeam[m_iBeams] )
return;
m_pBeam[m_iBeams]->PointEntInit( pEntity->Center(), entindex() );
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 );
m_pBeam[m_iBeams]->SetColor( 0, 5, 196 );
m_pBeam[m_iBeams]->SetBrightness( 55 );
m_pBeam[m_iBeams]->SetNoise( 80 );
m_iBeams++;
}
//=========================================================
// ZapBeam - heavy damage directly forward
//=========================================================
void CSkrillex::ZapBeam( int side )
{
Vector vecSrc, vecAim;
TraceResult tr;
CBaseEntity *pEntity;
if( m_iBeams >= ISLAVE_MAX_BEAMS )
return;
vecSrc = pev->origin + gpGlobals->v_up * 36;
vecAim = ShootAtEnemy( vecSrc );
float deflection = 0.01;
vecAim = vecAim + side * gpGlobals->v_right * RANDOM_FLOAT( 0, deflection ) + gpGlobals->v_up * RANDOM_FLOAT( -deflection, deflection );
UTIL_TraceLine( vecSrc, vecSrc + vecAim * 1024, dont_ignore_monsters, ENT( pev ), &tr );
m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/shit.spr", 50 );
if( !m_pBeam[m_iBeams] )
return;
m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, entindex() );
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 );
m_pBeam[m_iBeams]->SetColor( 0, 0, 206 );
m_pBeam[m_iBeams]->SetBrightness( 55 );
m_pBeam[m_iBeams]->SetNoise( 20 );
m_iBeams++;
pEntity = CBaseEntity::Instance( tr.pHit );
if( pEntity != NULL && pEntity->pev->takedamage )
{
pEntity->TraceAttack( pev, gSkillData.slaveDmgZap, vecAim, &tr, DMG_SHOCK );
}
}
//=========================================================
// ClearBeams - remove all beams
//=========================================================
void CSkrillex::ClearBeams()
{
for( int i = 0; i < ISLAVE_MAX_BEAMS; i++ )
{
if( m_pBeam[i] )
{
UTIL_Remove( m_pBeam[i] );
m_pBeam[i] = NULL;
}
}
m_iBeams = 0;
pev->skin = 0;
} }

348
dlls/sniper.cpp

@ -13,115 +13,144 @@
#include "nodes.h" #include "nodes.h"
#include "soundent.h" #include "soundent.h"
enum gauss_e class CSnipars : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 2; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
void PrimaryAttack( void );
void SecondaryAttack( void );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
void Reload( void );
void WeaponIdle( void );
void Shoot( float flSpread, float flCycleTime, BOOL fUseAutoAim );
float m_flSoundDelay;
BOOL m_fInZoom;// don't save this.
virtual BOOL UseDecrement( void )
{
return FALSE;
}
private:
//unsigned short m_usFireSniper;
};
enum sniper_e
{ {
SNIPARS_IDLE = 0, SNIPARS_IDLE = 0,
SNIPARS_DRAW, SNIPARS_DRAW,
SNIPARS_FIRE, SNIPARS_FIRE,
SNIPARS_RELOAD SNIPARS_RELOAD
}; };
LINK_ENTITY_TO_CLASS( weapon_snipars, CSnipars ); LINK_ENTITY_TO_CLASS( weapon_snipars, CSnipars );
int CSnipars::GetItemInfo(ItemInfo *p) int CSnipars::GetItemInfo(ItemInfo *p)
{ {
p->pszName = STRING(pev->classname); p->pszName = STRING(pev->classname);
p->pszAmmo1 = "snipars"; p->pszAmmo1 = "snipars";
p->iMaxAmmo1 = _SNIPARS_MAX_CARRY; p->iMaxAmmo1 = _SNIPARS_MAX_CARRY;
p->pszAmmo2 = NULL; p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1; p->iMaxAmmo2 = -1;
p->iMaxClip = SNIPARS_MAX_CLIP; p->iMaxClip = SNIPARS_MAX_CLIP;
p->iFlags = 0; p->iFlags = 0;
p->iSlot = 3; p->iSlot = 3;
p->iPosition = 4; p->iPosition = 4;
p->iId = m_iId = WEAPON_SNIPARS; p->iId = m_iId = WEAPON_SNIPARS;
p->iWeight = SNIPARS_WEIGHT; p->iWeight = SNIPARS_WEIGHT;
return 1; return 1;
} }
int CSnipars::AddToPlayer( CBasePlayer *pPlayer ) int CSnipars::AddToPlayer( CBasePlayer *pPlayer )
{ {
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) ) if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{ {
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev ); MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE( m_iId ); WRITE_BYTE( m_iId );
MESSAGE_END(); MESSAGE_END();
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
void CSnipars::Spawn( ) void CSnipars::Spawn( )
{ {
pev->classname = MAKE_STRING("weapon_snipars"); pev->classname = MAKE_STRING("weapon_snipars");
Precache( ); Precache( );
m_iId = WEAPON_SNIPARS; m_iId = WEAPON_SNIPARS;
SET_MODEL(ENT(pev), "models/w_sniper.mdl"); SET_MODEL(ENT(pev), "models/w_sniper.mdl");
m_iDefaultAmmo = SNIPARS_DEFAULT_GIVE; m_iDefaultAmmo = SNIPARS_DEFAULT_GIVE;
FallInit(); FallInit();
} }
void CSnipars::Precache( void ) void CSnipars::Precache( void )
{ {
PRECACHE_MODEL("models/v_sniper.mdl"); PRECACHE_MODEL("models/v_sniper.mdl");
PRECACHE_MODEL("models/w_sniper.mdl"); PRECACHE_MODEL("models/w_sniper.mdl");
PRECACHE_MODEL("models/p_sniper.mdl"); PRECACHE_MODEL("models/p_sniper.mdl");
PRECACHE_MODEL("models/w_357ammo.mdl"); PRECACHE_MODEL("models/w_357ammo.mdl");
PRECACHE_SOUND("items/9mmclip1.wav"); PRECACHE_SOUND("items/9mmclip1.wav");
PRECACHE_SOUND ("weapons/sniper_shoot1.wav"); PRECACHE_SOUND ("weapons/sniper_shoot1.wav");
PRECACHE_SOUND ("weapons/sniper_shoot2.wav"); PRECACHE_SOUND ("weapons/sniper_shoot2.wav");
PRECACHE_SOUND ("weapons/sniper_shoot3.wav"); PRECACHE_SOUND ("weapons/sniper_shoot3.wav");
PRECACHE_SOUND ("weapons/sniper_shoot4.wav"); PRECACHE_SOUND ("weapons/sniper_shoot4.wav");
PRECACHE_SOUND ("weapons/sniper_shoot5.wav"); PRECACHE_SOUND ("weapons/sniper_shoot5.wav");
m_usFireSniper = PRECACHE_EVENT( 1, "events/glock2.sc" ); //m_usFireSniper = PRECACHE_EVENT( 1, "events/glock1.sc" );
} }
BOOL CSnipars::Deploy( ) BOOL CSnipars::Deploy( )
{ {
return DefaultDeploy( "models/v_sniper.mdl", "models/p_sniper.mdl", SNIPARS_DRAW, "snipars", UseDecrement() ); return DefaultDeploy( "models/v_sniper.mdl", "models/p_sniper.mdl", SNIPARS_DRAW, "snipars", UseDecrement() );
} }
void CSnipars::Holster( int skiplocal /* = 0 */ ) void CSnipars::Holster( int skiplocal /* = 0 */ )
{ {
m_fInReload = FALSE; m_fInReload = FALSE;
if ( m_fInZoom ) if ( m_fInZoom )
{ {
SecondaryAttack(); SecondaryAttack();
} }
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0; m_pPlayer->m_flNextAttack = gpGlobals->time + 1.0;
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
} }
void CSnipars::SecondaryAttack( void ) void CSnipars::SecondaryAttack( void )
{ {
if ( m_pPlayer->pev->fov != 0 ) if ( m_pPlayer->pev->fov != 0 )
{ {
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0;
m_fInZoom = 0; m_fInZoom = 0;
#ifndef CLIENT_DLL UTIL_ScreenFade( m_pPlayer, Vector(0,0,0), 0.5, 0.25, 255, FFADE_IN ); UTIL_ScreenFade( m_pPlayer, Vector(0,0,0), 0.5, 0.25, 255, FFADE_IN );
#endif
} }
else if ( m_pPlayer->pev->fov != 15 ) else if ( m_pPlayer->pev->fov != 15 )
{ {
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 15; m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 15;
m_fInZoom = 1; m_fInZoom = 1;
#ifndef CLIENT_DLL UTIL_ScreenFade( m_pPlayer, Vector(0,0,0), 0.5, 0.25, 255, FFADE_IN ); UTIL_ScreenFade( m_pPlayer, Vector(0,0,0), 0.5, 0.25, 255, FFADE_IN );
#endif }
} pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = UTIL_WeaponTimeBase() + 0.1; m_flNextSecondaryAttack = gpGlobals->time + 1.0;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
} }
void CSnipars::PrimaryAttack( void ) void CSnipars::PrimaryAttack( void )
{ {
Shoot( 0.0001, 1.5, TRUE ); if(m_iClip > 0)
{
Shoot( 0.0001, 1.5, TRUE );
switch( RANDOM_LONG( 0, 3 ) ) switch( RANDOM_LONG( 0, 3 ) )
{ {
case 0: case 0:
@ -140,128 +169,125 @@ Shoot( 0.0001, 1.5, TRUE );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/sniper_shoot5.wav", 1, ATTN_NORM ); EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/sniper_shoot5.wav", 1, ATTN_NORM );
break; break;
}; };
}
} }
void CSnipars::Shoot( float flSpread , float flCycleTime, BOOL fUseAutoAim ) void CSnipars::Shoot( float flSpread , float flCycleTime, BOOL fUseAutoAim )
{ {
if (m_pPlayer->pev->waterlevel == 3)
{
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/sniper_cock1.wav", 0.8, ATTN_NORM);
m_flNextPrimaryAttack = 0.15; return;
}
if (m_iClip <= 0)
{
if (m_fFireOnEmpty)
{
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
}
return;
}
m_iClip -= 1;
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
int flags; if (m_pPlayer->pev->waterlevel == 3)
{
#if defined( CLIENT_WEAPONS ) EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/sniper_cock1.wav", 0.8, ATTN_NORM);
flags = FEV_NOTHOST; m_flNextPrimaryAttack = 0.15; return;
#else flags = 0; }
#endif if (m_iClip <= 0)
{
if (m_fFireOnEmpty)
{
m_flNextPrimaryAttack = gpGlobals->time + 0.2;
}
return;
}
SendWeaponAnim( SNIPARS_FIRE );
m_iClip--;
// player "shoot" animation m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; int flags;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
Vector vecSrc = m_pPlayer->GetGunPosition( ); // player "shoot" animation
Vector vecAiming; m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
if ( fUseAutoAim ) m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
{ m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
}
else
{
vecAiming = gpGlobals->v_forward;
}
Vector vecDir; vecDir = m_pPlayer->FireBulletsPlayer( 5, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_SNIPARS, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); Vector vecSrc = m_pPlayer->GetGunPosition( );
Vector vecAiming;
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireSniper : m_usFireSniper, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); if ( fUseAutoAim )
{
vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
}
else
{
vecAiming = gpGlobals->v_forward;
}
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + flCycleTime; Vector vecDir = m_pPlayer->FireBulletsPlayer( 50, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_SNIPARS, 0, 3, m_pPlayer->pev, m_pPlayer->random_seed );
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) //PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usFireSniper, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 );
pev->effects |= EF_MUZZLEFLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->time + flCycleTime;
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
m_flTimeWeaponIdle = RANDOM_FLOAT( 10, 15 );
} }
void CSnipars::Reload( void ) void CSnipars::Reload( void )
{ {
if ( m_fInZoom ) if ( m_fInZoom )
{ {
SecondaryAttack(); SecondaryAttack();
} }
if ( m_pPlayer->ammo_snipars <= 0 ) if ( m_pPlayer->ammo_snipars <= 0 )
return; return;
if ( m_pPlayer->pev->fov != 0 ) if ( m_pPlayer->pev->fov != 0 )
{ {
m_fInZoom = FALSE; m_fInZoom = FALSE;
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; // 0 means reset to default fov m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; // 0 means reset to default fov
} }
if (m_iClip == 0) //if (m_iClip == 0)
DefaultReload( 5, SNIPARS_RELOAD, 1.5 ); //DefaultReload( 5, SNIPARS_RELOAD, 1.5 );
else //else
DefaultReload( 5, SNIPARS_RELOAD, 1.5 ); DefaultReload( 5, SNIPARS_RELOAD, 1.5 );
} }
void CSnipars::WeaponIdle( void ) void CSnipars::WeaponIdle( void )
{ {
m_pPlayer->GetAutoaimVector( AUTOAIM_2DEGREES ); m_pPlayer->GetAutoaimVector( AUTOAIM_2DEGREES );
if ( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() ) if ( m_flTimeWeaponIdle < gpGlobals->time )
{ {
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 ); float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if (flRand <= 0.75) if (flRand <= 0.75)
{ {
if (m_iClip) if (m_iClip)
{ {
SendWeaponAnim( SNIPARS_IDLE ); SendWeaponAnim( SNIPARS_IDLE );
} }
else else
{ {
SendWeaponAnim( SNIPARS_IDLE ); SendWeaponAnim( SNIPARS_IDLE );
} }
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0 / 12.0; m_flTimeWeaponIdle = gpGlobals->time + 60.0 / 12.0;
} }
} }
} }
class CSniparsAmmo : public CBasePlayerAmmo class CSniparsAmmo : public CBasePlayerAmmo
{ {
void Spawn( void ) void Spawn( void )
{ {
Precache( ); Precache( );
SET_MODEL(ENT(pev), "models/w_sniper.mdl"); SET_MODEL(ENT(pev), "models/w_sniper.mdl");
CBasePlayerAmmo::Spawn( ); CBasePlayerAmmo::Spawn( );
} }
void Precache( void ) void Precache( void )
{ {
PRECACHE_MODEL ("models/w_357ammo.mdl"); PRECACHE_MODEL ("models/w_357ammo.mdl");
PRECACHE_SOUND("items/9mmclip1.wav"); PRECACHE_SOUND("items/9mmclip1.wav");
} }
BOOL AddAmmo( CBaseEntity *pOther ) BOOL AddAmmo( CBaseEntity *pOther )
{ {
if (pOther->GiveAmmo( AMMO_SNIPARSBOX_GIVE, "snipars", _SNIPARS_MAX_CARRY ) != -1) if (pOther->GiveAmmo( AMMO_SNIPARSBOX_GIVE, "snipars", _SNIPARS_MAX_CARRY ) != -1)
{ {
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM); EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
}; };
LINK_ENTITY_TO_CLASS( ammo_snipars2, CSniparsAmmo ); LINK_ENTITY_TO_CLASS( ammo_snipars2, CSniparsAmmo );

183
dlls/weapons.h

@ -1022,139 +1022,23 @@ public:
private: private:
unsigned short m_usSnarkFire; unsigned short m_usSnarkFire;
}; };
class CSawnoff : public CBasePlayerWeapon class CPepsigun : public CBasePlayerWeapon
{
public:
#ifndef CLIENT_DLL
#endif
void Spawn( void );
void Precache( void );
int iItemSlot( ) { return 3; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
void PrimaryAttack( void );
void SecondaryAttack( void );
BOOL Deploy( );
void Reload( void );
void WeaponIdle( void );
int m_fInReload;
float m_flNextReload;
int m_iShell;
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
return FALSE;
#endif
}
private:
unsigned short m_usDoubleFire;
unsigned short m_usSingleFire;
};
class CNeedle : public CBasePlayerWeapon
{ {
public: public:
void Spawn( void ); void Spawn( void );
void Precache( void ); void Precache( void );
int iItemSlot( void ) { return 1; } int iItemSlot( void ) { return 4; }
void EXPORT SwingAgain( void );
void EXPORT Smack( void );
int GetItemInfo(ItemInfo *p); int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
int Swing( int fFirst );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
int m_iSwing;
TraceResult m_trHit;
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
return FALSE;
#endif
}
private:
unsigned short m_usNeedle;
};
class CGlock2 : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 2; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void ); void PrimaryAttack( void );
void SecondaryAttack( void );
void GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim );
BOOL Deploy( void );
void Reload( void ); void Reload( void );
void WeaponIdle( void );
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
return FALSE;
#endif
}
private:
int m_iShell;
unsigned short m_usFireGlock1;
unsigned short m_usFireGlock2;
};
class CKatana : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 1; }
void EXPORT SwingAgain( void );
void EXPORT Smack( void );
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
int Swing( int fFirst );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
int m_iSwing;
TraceResult m_trHit;
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
return FALSE;
#endif
}
private:
unsigned short m_usKatana;
};
class CRock : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 5; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
BOOL Deploy( void ); BOOL Deploy( void );
BOOL CanHolster( void ); BOOL CanHolster( void );
void Holster( int skiplocal = 0 ); void Holster( int skiplocal = 0 );
void WeaponIdle( void ); void WeaponIdle( void );
int m_fInReload;
float m_flNextReload;
virtual BOOL UseDecrement( void ) virtual BOOL UseDecrement( void )
{ {
@ -1166,64 +1050,5 @@ public:
} }
}; };
class CCrowbar2 : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( ) { return 3; }
int GetItemInfo(ItemInfo *p);
void FireBolt( void );
void FireSniperBolt( void );
void PrimaryAttack( void );
int AddToPlayer( CBasePlayer *pPlayer );
BOOL Deploy( );
void Holster( int skiplocal = 0 );
void WeaponIdle( void );
int m_fInZoom; // don't save this
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
return FALSE;
#endif
}
private:
unsigned short m_usCrossbow12;
unsigned short m_usCrossbow22;
};
class CSnipars : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 2; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
void PrimaryAttack( void );
void SecondaryAttack( void );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
void Reload( void );
void WeaponIdle( void );
void Shoot( float flSpread, float flCycleTime, BOOL fUseAutoAim );
float m_flSoundDelay;
BOOL m_fInZoom;// don't save this.
virtual BOOL UseDecrement( void )
{
return false;
}
private:
unsigned short m_usFireSniper;
};
#endif // WEAPONS_H #endif // WEAPONS_H

Loading…
Cancel
Save