Browse Source

Update trigger_playerfreeze

opforfixed
Roman Chistokhodov 5 years ago
parent
commit
eb086db702
  1. 71
      dlls/gearbox/gearbox_triggers.cpp
  2. 2
      dlls/player.cpp
  3. 1
      dlls/player.h

71
dlls/gearbox/gearbox_triggers.cpp

@ -135,71 +135,22 @@ LINK_ENTITY_TO_CLASS(trigger_geneworm_hit, CTriggerMultiple); @@ -135,71 +135,22 @@ LINK_ENTITY_TO_CLASS(trigger_geneworm_hit, CTriggerMultiple);
// CPlayerFreeze
//=========================================================
class CPlayerFreeze : public CBaseDelay
class CTriggerPlayerFreeze : public CBaseDelay
{
public:
void Spawn(void);
void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
static TYPEDESCRIPTION m_SaveData[];
EHANDLE m_hPlayer;
};
LINK_ENTITY_TO_CLASS(trigger_playerfreeze, CPlayerFreeze);
TYPEDESCRIPTION CPlayerFreeze::m_SaveData[] =
{
DEFINE_FIELD(CPlayerFreeze, m_hPlayer, FIELD_EHANDLE),
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
};
IMPLEMENT_SAVERESTORE(CPlayerFreeze, CBaseDelay);
LINK_ENTITY_TO_CLASS( trigger_playerfreeze, CTriggerPlayerFreeze )
void CPlayerFreeze::Spawn(void)
void CTriggerPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
CBaseDelay::Spawn();
if( !pActivator || !pActivator->IsPlayer() )
pActivator = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) );
m_hPlayer.Set(NULL);
CBaseEntity* pPlayer = UTIL_PlayerByIndex( 1 );
if (pPlayer)
{
m_hPlayer = pPlayer;
}
}
void CPlayerFreeze::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
CBaseEntity* pPlayer = NULL;
if (!m_hPlayer.Get())
{
CBaseEntity* pPlayer = UTIL_PlayerByIndex(1);
if (pPlayer)
{
m_hPlayer = pPlayer;
}
}
if (m_hPlayer.Get())
{
#ifdef DEBUG
ASSERT(m_hPlayer != NULL);
#endif
m_hPlayer->pev->movetype = (m_hPlayer->pev->movetype == MOVETYPE_NONE)
? MOVETYPE_WALK
: MOVETYPE_NONE;
}
if( pActivator && (pActivator->pev->flags & FL_FROZEN) )
( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( TRUE );
else
{
ALERT(at_console, "ERROR: Couldn't find player entity.\n");
}
SetThink(&CPlayerFreeze::SUB_Remove);
pev->nextthink = gpGlobals->time;
}
( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( FALSE );
}

2
dlls/player.cpp

@ -120,7 +120,6 @@ TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] = @@ -120,7 +120,6 @@ TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] =
DEFINE_FIELD( CBasePlayer, m_iFOV, FIELD_INTEGER ),
DEFINE_FIELD(CBasePlayer, m_fInXen, FIELD_BOOLEAN),
DEFINE_FIELD(CBasePlayer, m_fIsFrozen, FIELD_BOOLEAN),
//DEFINE_FIELD( CBasePlayer, m_fDeadTime, FIELD_FLOAT ), // only used in multiplayer games
//DEFINE_FIELD( CBasePlayer, m_fGameHUDInitialized, FIELD_INTEGER ), // only used in multiplayer games
@ -2950,7 +2949,6 @@ void CBasePlayer::Spawn( void ) @@ -2950,7 +2949,6 @@ void CBasePlayer::Spawn( void )
m_flNextChatTime = gpGlobals->time;
m_fInXen = FALSE;
m_fIsFrozen = FALSE;
g_pGameRules->PlayerSpawn( this );
}

1
dlls/player.h

@ -336,7 +336,6 @@ public: @@ -336,7 +336,6 @@ public:
// Op4 player attributes.
//
BOOL m_fInXen;
BOOL m_fIsFrozen;
friend class CDisplacer;
friend class CTriggerXenReturn;

Loading…
Cancel
Save