diff --git a/dlls/gearbox/gearbox_triggers.cpp b/dlls/gearbox/gearbox_triggers.cpp index 65643d5b..6283129a 100644 --- a/dlls/gearbox/gearbox_triggers.cpp +++ b/dlls/gearbox/gearbox_triggers.cpp @@ -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; -} \ No newline at end of file + ( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( FALSE ); +} diff --git a/dlls/player.cpp b/dlls/player.cpp index d98c4363..30caccd9 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -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 ) m_flNextChatTime = gpGlobals->time; m_fInXen = FALSE; - m_fIsFrozen = FALSE; g_pGameRules->PlayerSpawn( this ); } diff --git a/dlls/player.h b/dlls/player.h index 17872d6e..48b75aff 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -336,7 +336,6 @@ public: // Op4 player attributes. // BOOL m_fInXen; - BOOL m_fIsFrozen; friend class CDisplacer; friend class CTriggerXenReturn;