mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-03-12 13:31:33 +00:00
HL:Invasion IsInGaz fix for trigger_gaz (weapons must not be able to shoot without triggering it)
This commit is contained in:
parent
6593f650e2
commit
faa9ba8e2d
@ -771,3 +771,39 @@ CBaseEntity *CBaseEntity::Create( const char *szName, const Vector &vecOrigin, c
|
||||
DispatchSpawn( pEntity->edict() );
|
||||
return pEntity;
|
||||
}
|
||||
|
||||
//modif de Roy, we need to solve firing in Gaz non-virtual conundrum
|
||||
BOOL CBaseEntity::IsInGaz ( void )
|
||||
{
|
||||
if( !IsPlayer()) return FALSE; //Quit immediately. This will always be true. CBaseEntity doesn't have an IsPlayer returning TRUE at all.
|
||||
//Oh, but... CBasePlayer has!
|
||||
//However, when combat.cpp calls this function, it calls this version, not the players, since the base function
|
||||
//is for CBaseEntity, it simply asks it if it's the player (which is true in that case). Since it gets called without an actual pointer, it
|
||||
//doesn't know which function to fire and does this one, not the player's (which inherits and overrides this function).
|
||||
//So, if this one gets called in this context, IsPlayer is going to return TRUE, and then this fires up.
|
||||
|
||||
Vector vecPlayer = Center ();
|
||||
|
||||
CBaseEntity *pFind = NULL;
|
||||
edict_t *pTrigger = NULL;
|
||||
pTrigger = FIND_ENTITY_BY_CLASSNAME( NULL, "trigger_gaz" );
|
||||
|
||||
while ( !FNullEnt ( pTrigger ) )
|
||||
{
|
||||
pFind = CBaseEntity::Instance ( pTrigger );
|
||||
|
||||
|
||||
if ( vecPlayer.x > pFind->pev->absmin.x && vecPlayer.x < pFind->pev->absmax.x &&
|
||||
vecPlayer.y > pFind->pev->absmin.y && vecPlayer.y < pFind->pev->absmax.y &&
|
||||
vecPlayer.z > pFind->pev->absmin.z && vecPlayer.z < pFind->pev->absmax.z ) // Player est ds le trigger
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pTrigger = FIND_ENTITY_BY_CLASSNAME( pTrigger, "trigger_gaz" );
|
||||
}
|
||||
|
||||
}
|
||||
return FALSE;
|
||||
}
|
@ -334,7 +334,7 @@ public:
|
||||
virtual BOOL FVisible( const Vector &vecOrigin );
|
||||
|
||||
//modif de Julien
|
||||
BOOL IsInGaz ( void ) { return FALSE; }; //Must NOT be virtual, causes "unimplemented symbol" error in game.
|
||||
BOOL IsInGaz ( void ); //Must NOT be virtual, causes "unimplemented symbol" error in game.
|
||||
BOOL m_bFireInGaz;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user