Skip to content

Commit

Permalink
Remove game_player_equip and player_weaponstrip
Browse files Browse the repository at this point in the history
This was causing so many problems with certain maps & gamemodes so it's better to remove the entities from the code entirely.
  • Loading branch information
sabianroberts committed Oct 8, 2024
1 parent c241d10 commit 23a3b0a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 123 deletions.
94 changes: 0 additions & 94 deletions binary/dlls/maprules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,100 +759,6 @@ void CGameCounterSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
}


//
// CGamePlayerEquip / game_playerequip -- Sets the default player equipment
// Flag: USE Only

#define SF_PLAYEREQUIP_USEONLY 0x0001
#define MAX_EQUIP 32

class CGamePlayerEquip : public CRulePointEntity
{
public:
void KeyValue( KeyValueData *pkvd );
void Touch( CBaseEntity *pOther );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );

inline BOOL UseOnly( void ) { return (pev->spawnflags & SF_PLAYEREQUIP_USEONLY) ? TRUE : FALSE; }

private:

void EquipPlayer( CBaseEntity *pPlayer );

string_t m_weaponNames[MAX_EQUIP];
int m_weaponCount[MAX_EQUIP];
};

LINK_ENTITY_TO_CLASS( game_player_equip, CGamePlayerEquip );


void CGamePlayerEquip::KeyValue( KeyValueData *pkvd )
{
CRulePointEntity::KeyValue( pkvd );

if ( !pkvd->fHandled )
{
for ( int i = 0; i < MAX_EQUIP; i++ )
{
if ( !m_weaponNames[i] )
{
char tmp[128];

UTIL_StripToken( pkvd->szKeyName, tmp );

m_weaponNames[i] = ALLOC_STRING(tmp);
m_weaponCount[i] = atoi(pkvd->szValue);
m_weaponCount[i] = V_max(1,m_weaponCount[i]);
pkvd->fHandled = TRUE;
break;
}
}
}
}


void CGamePlayerEquip::Touch( CBaseEntity *pOther )
{
if ( !CanFireForActivator( pOther ) )
return;

if ( UseOnly() )
return;

EquipPlayer( pOther );
}

void CGamePlayerEquip::EquipPlayer( CBaseEntity *pEntity )
{
CBasePlayer *pPlayer = NULL;

if ( pEntity->IsPlayer() )
{
pPlayer = (CBasePlayer *)pEntity;
}

if ( !pPlayer )
return;

for ( int i = 0; i < MAX_EQUIP; i++ )
{
if ( !m_weaponNames[i] )
break;
for ( int j = 0; j < m_weaponCount[i]; j++ )
{
pPlayer->GiveNamedItem( STRING(m_weaponNames[i]) );
}
}
}


void CGamePlayerEquip::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
EquipPlayer( pActivator );
}


//
// CGamePlayerTeam / game_player_team -- Changes the team of the player who fired it
// Flag: Fire once
Expand Down
29 changes: 0 additions & 29 deletions binary/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5690,35 +5690,6 @@ void CDeadHEV :: Spawn( void )
MonsterInitDead();
}


class CStripWeapons : public CPointEntity
{
public:
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );

private:
};

LINK_ENTITY_TO_CLASS( player_weaponstrip, CStripWeapons );

void CStripWeapons :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
CBasePlayer *pPlayer = NULL;

if ( pActivator && pActivator->IsPlayer() )
{
pPlayer = (CBasePlayer *)pActivator;
}
else if ( !g_pGameRules->IsDeathmatch() )
{
pPlayer = (CBasePlayer *)CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) );
}

if ( pPlayer )
pPlayer->RemoveAllItems( FALSE );
}


class CRevertSaved : public CPointEntity
{
public:
Expand Down

0 comments on commit 23a3b0a

Please sign in to comment.