Browse Source

Merge changes for weapons from SoHL1.5.

echoes
Night Owl 6 years ago
parent
commit
e6cf0db4b9
  1. 60
      cl_dll/ev_hldm.cpp
  2. 2
      cl_dll/hl/hl_events.cpp
  3. 4
      dlls/combat.cpp
  4. 23
      dlls/crowbar.cpp
  5. 6
      dlls/glock.cpp
  6. 1
      dlls/hgrunt.cpp
  7. 21
      dlls/mp5.cpp
  8. 2
      dlls/python.cpp
  9. 6
      dlls/rpg.cpp
  10. 6
      dlls/shotgun.cpp
  11. 6
      dlls/squeakgrenade.cpp
  12. 16
      dlls/util.cpp
  13. 1
      dlls/util.h
  14. 57
      dlls/weapons.cpp
  15. 65
      dlls/weapons.h

60
cl_dll/ev_hldm.cpp

@ -59,7 +59,6 @@ void EV_FireMP52( struct event_args_s *args ); @@ -59,7 +59,6 @@ void EV_FireMP52( struct event_args_s *args );
void EV_FirePython( struct event_args_s *args );
void EV_FireGauss( struct event_args_s *args );
void EV_SpinGauss( struct event_args_s *args );
void EV_Crowbar( struct event_args_s *args );
void EV_FireCrossbow( struct event_args_s *args );
void EV_FireCrossbow2( struct event_args_s *args );
void EV_FireRpg( struct event_args_s *args );
@ -1125,65 +1124,6 @@ void EV_FireGauss( event_args_t *args ) @@ -1125,65 +1124,6 @@ void EV_FireGauss( event_args_t *args )
// GAUSS END
//======================
//======================
// CROWBAR START
//======================
enum crowbar_e
{
CROWBAR_IDLE = 0,
CROWBAR_DRAW,
CROWBAR_HOLSTER,
CROWBAR_ATTACK1HIT,
CROWBAR_ATTACK1MISS,
CROWBAR_ATTACK2MISS,
CROWBAR_ATTACK2HIT,
CROWBAR_ATTACK3MISS,
#ifndef CROWBAR_IDLE_ANIM
CROWBAR_ATTACK3HIT
#else
CROWBAR_ATTACK3HIT,
CROWBAR_IDLE2,
CROWBAR_IDLE3
#endif
};
int g_iSwing;
//Only predict the miss sounds, hit sounds are still played
//server side, so players don't get the wrong idea.
void EV_Crowbar( event_args_t *args )
{
int idx;
vec3_t origin;
vec3_t angles;
vec3_t velocity;
idx = args->entindex;
VectorCopy( args->origin, origin );
//Play Swing sound
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/cbar_miss1.wav", 1, ATTN_NORM, 0, PITCH_NORM );
if( EV_IsLocal( idx ) )
{
switch( (g_iSwing++) % 3 )
{
case 0:
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 );
break;
case 1:
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK2MISS, 1 );
break;
case 2:
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK3MISS, 1 );
break;
}
}
}
//======================
// CROWBAR END
//======================
//======================
// CROSSBOW START
//======================

2
cl_dll/hl/hl_events.cpp

@ -29,7 +29,6 @@ void EV_FireMP52( struct event_args_s *args ); @@ -29,7 +29,6 @@ void EV_FireMP52( struct event_args_s *args );
void EV_FirePython( struct event_args_s *args );
void EV_FireGauss( struct event_args_s *args );
void EV_SpinGauss( struct event_args_s *args );
void EV_Crowbar( struct event_args_s *args );
void EV_FireCrossbow( struct event_args_s *args );
void EV_FireCrossbow2( struct event_args_s *args );
void EV_FireRpg( struct event_args_s *args );
@ -67,7 +66,6 @@ void Game_HookEvents( void ) @@ -67,7 +66,6 @@ void Game_HookEvents( void )
gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss );
gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss );
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust );
gEngfuncs.pfnHookEvent( "events/crowbar.sc", EV_Crowbar );
gEngfuncs.pfnHookEvent( "events/crossbow1.sc", EV_FireCrossbow );
gEngfuncs.pfnHookEvent( "events/crossbow2.sc", EV_FireCrossbow2 );
gEngfuncs.pfnHookEvent( "events/rpg.sc", EV_FireRpg );

4
dlls/combat.cpp

@ -1429,6 +1429,8 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin @@ -1429,6 +1429,8 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin
Vector vecRight = gpGlobals->v_right;
Vector vecUp = gpGlobals->v_up;
UTIL_MuzzleLight( vecSrc, 160, 255, 255, 128, 0, 0 );
if( pevAttacker == NULL )
pevAttacker = pev; // the default attacker is ourselves
@ -1569,6 +1571,8 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi @@ -1569,6 +1571,8 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
float x = 0.0f, y = 0.0f;
float z;
UTIL_MuzzleLight( vecSrc, 160, 255, 255, 128, 0, 0 );
if( pevAttacker == NULL )
pevAttacker = pev; // the default attacker is ourselves

23
dlls/crowbar.cpp

@ -67,8 +67,6 @@ void CCrowbar::Precache( void ) @@ -67,8 +67,6 @@ void CCrowbar::Precache( void )
PRECACHE_SOUND( "weapons/cbar_hitbod2.wav" );
PRECACHE_SOUND( "weapons/cbar_hitbod3.wav" );
PRECACHE_SOUND( "weapons/cbar_miss1.wav" );
m_usCrowbar = PRECACHE_EVENT( 1, "events/crowbar.sc" );
}
int CCrowbar::GetItemInfo( ItemInfo *p )
@ -201,12 +199,6 @@ int CCrowbar::Swing( int fFirst ) @@ -201,12 +199,6 @@ int CCrowbar::Swing( int fFirst )
}
}
#endif
if( fFirst )
{
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar,
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0,
0, 0, 0 );
}
if( tr.flFraction >= 1.0 )
{
@ -217,6 +209,21 @@ int CCrowbar::Swing( int fFirst ) @@ -217,6 +209,21 @@ int CCrowbar::Swing( int fFirst )
#ifdef CROWBAR_IDLE_ANIM
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
#endif
switch( ( m_iSwing++ ) % 3 )
{
case 0:
SendWeaponAnim( CROWBAR_ATTACK1MISS );
break;
case 1:
SendWeaponAnim( CROWBAR_ATTACK2MISS );
break;
case 2:
SendWeaponAnim( CROWBAR_ATTACK3MISS );
break;
}
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/cbar_miss1.wav", 1, ATTN_NORM, 0, 94 + RANDOM_LONG( 0, 0xF ) );
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
}

6
dlls/glock.cpp

@ -50,6 +50,12 @@ void CGlock::Spawn() @@ -50,6 +50,12 @@ void CGlock::Spawn()
FallInit();// get ready to fall down.
}
void CGlock::Holster( int skiplocal )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
SendWeaponAnim( GLOCK_HOLSTER );
}
void CGlock::Precache( void )
{
PRECACHE_MODEL( "models/v_9mmhandgun.mdl" );

1
dlls/hgrunt.cpp

@ -540,6 +540,7 @@ BOOL CHGrunt::CheckRangeAttack2( float flDot, float flDist ) @@ -540,6 +540,7 @@ BOOL CHGrunt::CheckRangeAttack2( float flDot, float flDist )
// crap, I might blow my own guy up. Don't throw a grenade and don't check again for a while.
m_flNextGrenadeCheck = gpGlobals->time + 1; // one full second.
m_fThrowGrenade = FALSE;
return m_fThrowGrenade; //AJH need this or it is overridden later.
}
}

21
dlls/mp5.cpp

@ -32,7 +32,8 @@ enum mp5_e @@ -32,7 +32,8 @@ enum mp5_e
MP5_DEPLOY,
MP5_FIRE1,
MP5_FIRE2,
MP5_FIRE3
MP5_FIRE3,
MP5_HOLSTER
};
LINK_ENTITY_TO_CLASS( weapon_mp5, CMP5 )
@ -120,20 +121,26 @@ BOOL CMP5::Deploy() @@ -120,20 +121,26 @@ BOOL CMP5::Deploy()
return DefaultDeploy( "models/v_9mmAR.mdl", "models/p_9mmAR.mdl", MP5_DEPLOY, "mp5" );
}
void CMP5::Holster( int skiplocal /* = 0 */)
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
SendWeaponAnim( MP5_HOLSTER );
}
void CMP5::PrimaryAttack()
{
// don't fire underwater
if (m_pPlayer->pev->waterlevel == 3 && m_pPlayer->pev->watertype > CONTENT_FLYFIELD)
{
PlayEmptySound();
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15;
return;
}
if( m_iClip <= 0 )
{
PlayEmptySound();
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15;
return;
}
@ -171,7 +178,7 @@ void CMP5::PrimaryAttack() @@ -171,7 +178,7 @@ void CMP5::PrimaryAttack()
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, RANDOM_LONG( MP5_FIRE1, MP5_FIRE3 ), m_iShell, 0, 0 );
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
// HEV suit - indicate out of ammo condition
@ -180,7 +187,7 @@ void CMP5::PrimaryAttack() @@ -180,7 +187,7 @@ void CMP5::PrimaryAttack()
m_flNextPrimaryAttack = GetNextAttackDelay( 0.1 );
if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
@ -191,7 +198,7 @@ void CMP5::SecondaryAttack( void ) @@ -191,7 +198,7 @@ void CMP5::SecondaryAttack( void )
if (m_pPlayer->pev->waterlevel == 3 && m_pPlayer->pev->watertype > CONTENT_FLYFIELD)
{
PlayEmptySound( );
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15;
return;
}
@ -234,6 +241,8 @@ void CMP5::SecondaryAttack( void ) @@ -234,6 +241,8 @@ void CMP5::SecondaryAttack( void )
if( !m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] )
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
m_pPlayer->pev->punchangle.x -= 10;
}
void CMP5::Reload( void )

2
dlls/python.cpp

@ -123,7 +123,7 @@ void CPython::Holster( int skiplocal /* = 0 */ ) @@ -123,7 +123,7 @@ void CPython::Holster( int skiplocal /* = 0 */ )
SecondaryAttack();
}
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
SendWeaponAnim( PYTHON_HOLSTER );
}

6
dlls/rpg.cpp

@ -436,8 +436,10 @@ void CRpg::Holster( int skiplocal /* = 0 */ ) @@ -436,8 +436,10 @@ void CRpg::Holster( int skiplocal /* = 0 */ )
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
SendWeaponAnim( RPG_HOLSTER1 );
if( m_iClip )
SendWeaponAnim( RPG_HOLSTER1 );
else
SendWeaponAnim( RPG_HOLSTER2 );
#ifndef CLIENT_DLL
if( m_pSpot )
{

6
dlls/shotgun.cpp

@ -113,6 +113,12 @@ BOOL CShotgun::Deploy() @@ -113,6 +113,12 @@ BOOL CShotgun::Deploy()
return DefaultDeploy( "models/v_shotgun.mdl", "models/p_shotgun.mdl", SHOTGUN_DRAW, "shotgun" );
}
void CShotgun::Holster( int skiplocal )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
SendWeaponAnim( SHOTGUN_HOLSTER );
}
void CShotgun::PrimaryAttack()
{
// don't fire underwater

6
dlls/squeakgrenade.cpp

@ -475,6 +475,9 @@ void CSqueak::Holster( int skiplocal /* = 0 */ ) @@ -475,6 +475,9 @@ void CSqueak::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
SendWeaponAnim( SQUEAK_DOWN );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_SNARK );
@ -482,9 +485,6 @@ void CSqueak::Holster( int skiplocal /* = 0 */ ) @@ -482,9 +485,6 @@ void CSqueak::Holster( int skiplocal /* = 0 */ )
SetNextThink( 0.1 );
return;
}
SendWeaponAnim( SQUEAK_DOWN );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
}
void CSqueak::PrimaryAttack()

16
dlls/util.cpp

@ -33,6 +33,22 @@ @@ -33,6 +33,22 @@
#include "movewith.h"
#include "locus.h"
void UTIL_MuzzleLight( Vector vecSrc, float flRadius, byte r, byte g, byte b, float flTime, float flDecay )
{
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( flRadius * 0.1f ); // radius * 0.1
WRITE_BYTE( r ); // r
WRITE_BYTE( g ); // g
WRITE_BYTE( b ); // b
WRITE_BYTE( flTime * 10.0f ); // time * 10
WRITE_BYTE( flDecay * 0.1f ); // decay * 0.1
MESSAGE_END();
}
float UTIL_WeaponTimeBase( void )
{
#if defined( CLIENT_WEAPONS )

1
dlls/util.h

@ -614,4 +614,5 @@ int GetStdLightStyle (int iStyle); //LRC- declared here so it can be used by eve @@ -614,4 +614,5 @@ int GetStdLightStyle (int iStyle); //LRC- declared here so it can be used by eve
// needs to deal with the standard lightstyles.
// LRC- for aliases and groups
CBaseEntity* UTIL_FollowReference( CBaseEntity* pStartEntity, const char* szName );
void UTIL_MuzzleLight( Vector vecSrc, float flRadius, byte r, byte g, byte b, float flTime, float flDecay );
#endif // UTIL_H

57
dlls/weapons.cpp

@ -300,6 +300,7 @@ void W_Precache( void ) @@ -300,6 +300,7 @@ void W_Precache( void )
UTIL_PrecacheOther( "item_antidote" );
UTIL_PrecacheOther( "item_security" );
UTIL_PrecacheOther( "item_longjump" );
//UTIL_PrecacheOtherWeapon( "weapon_debug" );
// shotgun
UTIL_PrecacheOtherWeapon( "weapon_shotgun" );
@ -386,6 +387,17 @@ void W_Precache( void ) @@ -386,6 +387,17 @@ void W_Precache( void )
PRECACHE_SOUND( "items/weapondrop1.wav" );// weapon falls to the ground
}
void CBasePlayerItem::KeyValue( KeyValueData *pkvd ) //AJH
{
if (FStrEq(pkvd->szKeyName, "master"))
{
m_sMaster = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CBaseDelay::KeyValue( pkvd );
}
TYPEDESCRIPTION CBasePlayerItem::m_SaveData[] =
{
DEFINE_FIELD( CBasePlayerItem, m_pPlayer, FIELD_CLASSPTR ),
@ -415,6 +427,7 @@ TYPEDESCRIPTION CBasePlayerWeapon::m_SaveData[] = @@ -415,6 +427,7 @@ TYPEDESCRIPTION CBasePlayerWeapon::m_SaveData[] =
DEFINE_FIELD( CBasePlayerWeapon, m_iDefaultAmmo, FIELD_INTEGER ),
//DEFINE_FIELD( CBasePlayerWeapon, m_iClientClip, FIELD_INTEGER ), reset to zero on load so hud gets updated correctly
//DEFINE_FIELD( CBasePlayerWeapon, m_iClientWeaponState, FIELD_INTEGER ), reset to zero on load so hud gets updated correctly
DEFINE_FIELD( CBasePlayerWeapon, m_sMaster, FIELD_STRING ), // AJH master entity for Lockable weapons
};
IMPLEMENT_SAVERESTORE( CBasePlayerWeapon, CBasePlayerItem )
@ -577,11 +590,35 @@ void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) @@ -577,11 +590,35 @@ void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther )
{
AttachToPlayer( pPlayer );
EMIT_SOUND( ENT( pPlayer->pev ), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM );
if( !gEvilImpulse101 )
{
int i;
char sample[32];
char weapon_name[32];
strcpy(weapon_name, STRING(pev->classname));
if(strncmp(weapon_name, "weapon_", 7) == 0)
i = 7;
else if (strncmp(weapon_name, "item_", 5) == 0)
i = 5;
else
i = 0;
sprintf( sample, "!%s", weapon_name + i );
pPlayer->SetSuitUpdate( sample, FALSE, SUIT_NEXT_IN_30SEC );
}
}
SUB_UseTargets( pOther, USE_TOGGLE, 0 ); // UNDONE: when should this happen?
}
void CBasePlayerItem::Spawn()
{
pev->animtime = gpGlobals->time + 0.1;
CBaseAnimating::Spawn();
}
BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted )
{
#if defined( CLIENT_WEAPONS )
@ -745,6 +782,9 @@ void CBasePlayerWeapon :: SetNextThink( float delay ) @@ -745,6 +782,9 @@ void CBasePlayerWeapon :: SetNextThink( float delay )
// CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal
int CBasePlayerWeapon::AddDuplicate( CBasePlayerItem *pOriginal )
{
if( !UTIL_IsMasterTriggered( m_sMaster, m_pPlayer ) )
return FALSE; // AJH allows for locked weapons
if( m_iDefaultAmmo )
{
return ExtractAmmo( (CBasePlayerWeapon *)pOriginal );
@ -758,6 +798,9 @@ int CBasePlayerWeapon::AddDuplicate( CBasePlayerItem *pOriginal ) @@ -758,6 +798,9 @@ int CBasePlayerWeapon::AddDuplicate( CBasePlayerItem *pOriginal )
int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer )
{
if( !UTIL_IsMasterTriggered( m_sMaster, m_pPlayer ) )
return FALSE; // AJH allows for locked weapons
int bResult = CBasePlayerItem::AddToPlayer( pPlayer );
pPlayer->pev->weapons |= ( 1 << m_iId );
@ -905,16 +948,7 @@ BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, char *szName, int iMax ) @@ -905,16 +948,7 @@ BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, char *szName, int iMax )
//=========================================================
BOOL CBasePlayerWeapon::IsUseable( void )
{
if( m_iClip <= 0 )
{
if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] <= 0 && iMaxAmmo1() != -1 )
{
// clip is empty (or nonexistant) and the player has no more ammo of this type.
return FALSE;
}
}
return TRUE;
return CanDeploy();
}
BOOL CBasePlayerWeapon::CanDeploy( void )
@ -1067,6 +1101,9 @@ void CBasePlayerAmmo::DefaultTouch( CBaseEntity *pOther ) @@ -1067,6 +1101,9 @@ void CBasePlayerAmmo::DefaultTouch( CBaseEntity *pOther )
return;
}
if( !UTIL_IsMasterTriggered( m_sMaster, m_pPlayer ) )
return; // AJH allows for locked weapons
if( AddAmmo( pOther ) )
{
if( g_pGameRules->AmmoShouldRespawn( this ) == GR_AMMO_RESPAWN_YES )

65
dlls/weapons.h

@ -66,18 +66,19 @@ public: @@ -66,18 +66,19 @@ public:
#define WEAPON_CROWBAR 1
#define WEAPON_GLOCK 2
#define WEAPON_PYTHON 3
#define WEAPON_MP5 4
#define WEAPON_CHAINGUN 5
#define WEAPON_CROSSBOW 6
#define WEAPON_SHOTGUN 7
#define WEAPON_RPG 8
#define WEAPON_GAUSS 9
#define WEAPON_EGON 10
#define WEAPON_HORNETGUN 11
#define WEAPON_HANDGRENADE 12
#define WEAPON_TRIPMINE 13
#define WEAPON_SATCHEL 14
#define WEAPON_SNARK 15
#define WEAPON_GENERIC 4
#define WEAPON_MP5 5
#define WEAPON_DEBUG 6
#define WEAPON_CROSSBOW 7
#define WEAPON_SHOTGUN 8
#define WEAPON_RPG 9
#define WEAPON_GAUSS 10
#define WEAPON_EGON 11
#define WEAPON_HORNETGUN 12
#define WEAPON_HANDGRENADE 13
#define WEAPON_TRIPMINE 14
#define WEAPON_SATCHEL 15
#define WEAPON_SNARK 16
#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))
@ -216,6 +217,9 @@ class CBasePlayerItem : public CBaseAnimating @@ -216,6 +217,9 @@ class CBasePlayerItem : public CBaseAnimating
public:
virtual void SetObjectCollisionBox( void );
#ifndef CLIENT_DLL // AJH for lockable weapons
virtual void KeyValue( KeyValueData* pkvd);
#endif
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
@ -257,11 +261,23 @@ public: @@ -257,11 +261,23 @@ public:
static ItemInfo ItemInfoArray[ MAX_WEAPONS ];
static AmmoInfo AmmoInfoArray[ MAX_AMMO_SLOTS ];
string_t m_sMaster; //AJH for lockable weapons
CBasePlayer *m_pPlayer;
CBasePlayerItem *m_pNext;
int m_iId; // WEAPON_???
virtual int iItemSlot( void ) { return 0; } // return 0 to MAX_ITEMS_SLOTS, used in hud
#ifndef CLIENT_DLL//AJH Test Debug
virtual void Spawn();
#endif//AJH
virtual int iItemSlot( void )
{
ItemInfo II;
if(GetItemInfo(&II))
return II.iSlot + 1;
else
return 0;// return 0 to MAX_ITEMS_SLOTS, used in hud
}
int iItemPosition( void ) { return ItemInfoArray[ m_iId ].iPosition; }
const char *pszAmmo1( void ) { return ItemInfoArray[ m_iId ].pszAmmo1; }
@ -328,6 +344,7 @@ public: @@ -328,6 +344,7 @@ public:
virtual BOOL ShouldWeaponIdle( void ) {return FALSE; };
virtual void Holster( int skiplocal = 0 );
virtual BOOL UseDecrement( void ) { return FALSE; };
//void KeyValue( KeyValueData *pkvd );
//LRC - used by weaponstrip
void DrainClip(CBasePlayer* pPlayer, BOOL keep, int i9mm, int i357, int iBuck, int iBolt, int iARGren, int iRock, int iUranium, int iSatchel, int iSnark, int iTrip, int iGren );
@ -341,7 +358,7 @@ public: @@ -341,7 +358,7 @@ public:
float GetNextAttackDelay( float delay );
float m_flPumpTime;
int m_fInSpecialReload; // Are we in the middle of a reload for the shotguns
int m_fInSpecialReload; // Are we in the middle of a reload for the shotguns
float m_flNextPrimaryAttack; // soonest time ItemPostFrame will call PrimaryAttack
float m_flNextSecondaryAttack; // soonest time ItemPostFrame will call SecondaryAttack
float m_flTimeWeaponIdle; // soonest time ItemPostFrame will call WeaponIdle
@ -351,6 +368,7 @@ public: @@ -351,6 +368,7 @@ public:
int m_iClientClip; // the last version of m_iClip sent to hud dll
int m_iClientWeaponState; // the last version of the weapon state sent to hud dll (is current weapon, is on target)
int m_fInReload; // Are we in the middle of a reload;
int m_iClipSize;//This required weapon_generic, defintion in same class will crash'es compile
int m_iDefaultAmmo;// how much ammo you get when you pick up this weapon as placed by a level designer.
@ -359,7 +377,7 @@ public: @@ -359,7 +377,7 @@ public:
float m_flLastFireTime;
};
class CBasePlayerAmmo : public CBaseEntity
class CBasePlayerAmmo : public CBasePlayerItem //AJH
{
public:
virtual void Spawn( void );
@ -468,7 +486,6 @@ class CGlock : public CBasePlayerWeapon @@ -468,7 +486,6 @@ class CGlock : public CBasePlayerWeapon
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 2; }
int GetItemInfo( ItemInfo *p );
int AddToPlayer( CBasePlayer *pPlayer );
@ -476,6 +493,7 @@ public: @@ -476,6 +493,7 @@ public:
void SecondaryAttack( void );
void GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
void Reload( void );
void WeaponIdle( void );
@ -500,7 +518,6 @@ class CCrowbar : public CBasePlayerWeapon @@ -500,7 +518,6 @@ class CCrowbar : 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 );
@ -533,7 +550,6 @@ class CPython : public CBasePlayerWeapon @@ -533,7 +550,6 @@ class CPython : 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 );
@ -564,7 +580,6 @@ class CMP5 : public CBasePlayerWeapon @@ -564,7 +580,6 @@ class CMP5 : public CBasePlayerWeapon
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 3; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
@ -572,6 +587,7 @@ public: @@ -572,6 +587,7 @@ public:
void SecondaryAttack( void );
int SecondaryAmmoIndex( void );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
void Reload( void );
void WeaponIdle( void );
BOOL IsUseable();
@ -597,7 +613,6 @@ class CCrossbow : public CBasePlayerWeapon @@ -597,7 +613,6 @@ class CCrossbow : public CBasePlayerWeapon
public:
void Spawn( void );
void Precache( void );
int iItemSlot( ) { return 3; }
int GetItemInfo(ItemInfo *p);
void FireBolt( void );
@ -636,13 +651,13 @@ public: @@ -636,13 +651,13 @@ public:
#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 Holster( int skiplocal = 0 );
void Reload( void );
void WeaponTick();
void WeaponIdle( void );
@ -690,7 +705,6 @@ public: @@ -690,7 +705,6 @@ public:
void Spawn( void );
void Precache( void );
void Reload( void );
int iItemSlot( void ) { return 4; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
@ -750,7 +764,6 @@ public: @@ -750,7 +764,6 @@ public:
#endif
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 4; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
BOOL IsUseable();
@ -797,7 +810,6 @@ public: @@ -797,7 +810,6 @@ public:
#endif
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 4; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
@ -863,7 +875,6 @@ public: @@ -863,7 +875,6 @@ public:
#endif
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 4; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
@ -897,7 +908,6 @@ class CHandGrenade : public CBasePlayerWeapon @@ -897,7 +908,6 @@ class CHandGrenade : public CBasePlayerWeapon
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 5; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
@ -926,7 +936,6 @@ public: @@ -926,7 +936,6 @@ public:
#endif
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 5; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
void PrimaryAttack( void );
@ -955,7 +964,6 @@ class CTripmine : public CBasePlayerWeapon @@ -955,7 +964,6 @@ class CTripmine : public CBasePlayerWeapon
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 5; }
int GetItemInfo(ItemInfo *p);
void SetObjectCollisionBox( void )
{
@ -987,7 +995,6 @@ class CSqueak : public CBasePlayerWeapon @@ -987,7 +995,6 @@ class CSqueak : public CBasePlayerWeapon
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 5; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );

Loading…
Cancel
Save