mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-26 12:15:53 +01:00
503 lines
22 KiB
C++
503 lines
22 KiB
C++
|
/*
|
||
|
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
|
||
|
*/
|
||
|
|
||
|
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
|
||
|
#include "StdH.h"
|
||
|
|
||
|
#include "EntitiesMP/EnemyBase.h"
|
||
|
|
||
|
#include <EntitiesMP/Watcher.h>
|
||
|
#include <EntitiesMP/Watcher_tables.h>
|
||
|
CEntityEvent *EWatcherInit::MakeCopy(void) { CEntityEvent *peeCopy = new EWatcherInit(*this); return peeCopy;}
|
||
|
EWatcherInit::EWatcherInit() : CEntityEvent(EVENTCODE_EWatcherInit) {;
|
||
|
ClearToDefault(penOwner);
|
||
|
};
|
||
|
CEntityEvent *EWatch::MakeCopy(void) { CEntityEvent *peeCopy = new EWatch(*this); return peeCopy;}
|
||
|
EWatch::EWatch() : CEntityEvent(EVENTCODE_EWatch) {;
|
||
|
ClearToDefault(penSeen);
|
||
|
};
|
||
|
void CWatcher::SetDefaultProperties(void) {
|
||
|
m_penOwner = NULL;
|
||
|
m_tmDelay = 5.0f;
|
||
|
m_fClosestPlayer = UpperLimit(0.0f);
|
||
|
m_iPlayerToCheck = 0;
|
||
|
m_penPrediction = NULL;
|
||
|
CRationalEntity::SetDefaultProperties();
|
||
|
}
|
||
|
|
||
|
#line 40 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
class CEnemyBase * CWatcher::GetOwner(void)
|
||
|
#line 41 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 42 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
ASSERT (m_penOwner != NULL );
|
||
|
#line 43 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return (CEnemyBase *) & * m_penOwner ;
|
||
|
#line 44 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 47 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX CWatcher::GetRandomPlayer(void)
|
||
|
#line 48 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 51 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX ctMaxPlayers = GetMaxPlayers ();
|
||
|
#line 53 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX ctActivePlayers = 0;
|
||
|
#line 54 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{for(INDEX i = 0;i < ctMaxPlayers ;i ++){
|
||
|
#line 55 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(GetPlayerEntity (i ) != NULL ){
|
||
|
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
ctActivePlayers ++;
|
||
|
#line 57 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 58 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}}
|
||
|
#line 61 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(ctActivePlayers == 0){
|
||
|
#line 63 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return 0;
|
||
|
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX iChosenActivePlayer = IRnd () % ctActivePlayers ;
|
||
|
#line 72 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX iActivePlayer = 0;
|
||
|
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{for(INDEX i = 0;i < ctMaxPlayers ;i ++){
|
||
|
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(GetPlayerEntity (i ) != NULL ){
|
||
|
#line 75 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(iActivePlayer == iChosenActivePlayer ){
|
||
|
#line 77 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return i ;
|
||
|
#line 78 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 79 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
iActivePlayer ++;
|
||
|
#line 80 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 81 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}}
|
||
|
#line 82 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
ASSERT (FALSE );
|
||
|
#line 83 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return 0;
|
||
|
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 87 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * CWatcher::FindClosestPlayer(void)
|
||
|
#line 88 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 89 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * penClosestPlayer = NULL ;
|
||
|
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fClosestPlayer = UpperLimit (0.0f);
|
||
|
#line 92 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
for(INDEX iPlayer = 0;iPlayer < GetMaxPlayers ();iPlayer ++){
|
||
|
#line 93 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * penPlayer = GetPlayerEntity (iPlayer );
|
||
|
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(penPlayer != NULL && penPlayer -> GetFlags () & ENF_ALIVE && ! (penPlayer -> GetFlags () & ENF_INVISIBLE )){
|
||
|
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fDistance =
|
||
|
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
(penPlayer -> GetPlacement () . pl_PositionVector - m_penOwner -> GetPlacement () . pl_PositionVector ) . Length ();
|
||
|
#line 100 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(fDistance < fClosestPlayer ){
|
||
|
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
fClosestPlayer = fDistance ;
|
||
|
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
penClosestPlayer = penPlayer ;
|
||
|
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 104 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(penClosestPlayer == NULL ){
|
||
|
#line 109 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
fClosestPlayer = 10.0f;
|
||
|
#line 110 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 111 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_fClosestPlayer = fClosestPlayer ;
|
||
|
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return penClosestPlayer ;
|
||
|
#line 113 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 116 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
void CWatcher::SendWatchEvent(CEntity * penPlayer)
|
||
|
#line 117 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
EWatch eWatch ;
|
||
|
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
eWatch . penSeen = penPlayer ;
|
||
|
#line 120 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_penOwner -> SendEvent (eWatch );
|
||
|
#line 121 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
void CWatcher::CheckIfPlayerVisible(void)
|
||
|
#line 124 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(GetOwner () -> m_bBlind ){
|
||
|
#line 128 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return ;
|
||
|
#line 129 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX ctPlayers = GetMaxPlayers ();
|
||
|
#line 134 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * penPlayer = NULL ;
|
||
|
#line 135 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_iPlayerToCheck = (m_iPlayerToCheck + 1) % ctPlayers ;
|
||
|
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX iFirstChecked = m_iPlayerToCheck ;
|
||
|
#line 137 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FOREVER {
|
||
|
#line 138 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
penPlayer = GetPlayerEntity (m_iPlayerToCheck );
|
||
|
#line 139 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(penPlayer != NULL ){
|
||
|
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
break ;
|
||
|
#line 141 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 142 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_iPlayerToCheck ++;
|
||
|
#line 143 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_iPlayerToCheck %= ctPlayers ;
|
||
|
#line 144 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(m_iPlayerToCheck == iFirstChecked ){
|
||
|
#line 145 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return ;
|
||
|
#line 146 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 147 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 150 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(! (penPlayer -> GetFlags () & ENF_ALIVE ) || (penPlayer -> GetFlags () & ENF_INVISIBLE )){
|
||
|
#line 152 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return ;
|
||
|
#line 153 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 156 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(GetOwner () -> SeeEntity (penPlayer , Cos (GetOwner () -> m_fViewAngle / 2.0f))){
|
||
|
#line 158 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SendWatchEvent (penPlayer );
|
||
|
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
void CWatcher::SetWatchDelays(void)
|
||
|
#line 164 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 165 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
const FLOAT tmMinDelay = 0.1f;
|
||
|
#line 166 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
const FLOAT tmSeeDelay = 5.0f;
|
||
|
#line 167 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
const FLOAT tmTick = _pTimer -> TickQuantum ;
|
||
|
#line 168 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fSeeDistance = GetOwner () -> m_fIgnoreRange ;
|
||
|
#line 169 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fNearDistance = Min (GetOwner () -> m_fStopDistance , GetOwner () -> m_fCloseDistance );
|
||
|
#line 172 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(m_fClosestPlayer <= fNearDistance ){
|
||
|
#line 174 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_tmDelay = tmMinDelay ;
|
||
|
#line 176 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}else {
|
||
|
#line 178 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_tmDelay = tmMinDelay +
|
||
|
#line 179 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
(m_fClosestPlayer - fNearDistance ) * (tmSeeDelay - tmMinDelay ) / (fSeeDistance - fNearDistance );
|
||
|
#line 181 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_tmDelay = floor (m_tmDelay / tmTick ) * tmTick ;
|
||
|
#line 182 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 183 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 186 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
void CWatcher::Watch(void)
|
||
|
#line 187 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 189 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fOrgDistance = m_fClosestPlayer ;
|
||
|
#line 192 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * penClosest = FindClosestPlayer ();
|
||
|
#line 194 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fSeeDistance = GetOwner () -> m_fIgnoreRange ;
|
||
|
#line 195 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fStopDistance = Max (fSeeDistance * 1.5f , GetOwner () -> m_fActivityRange );
|
||
|
#line 198 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(fOrgDistance < fStopDistance && m_fClosestPlayer >= fStopDistance ){
|
||
|
#line 200 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_penOwner -> SendEvent (EStop ());
|
||
|
#line 202 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}else if(fOrgDistance >= fStopDistance && m_fClosestPlayer < fStopDistance ){
|
||
|
#line 204 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_penOwner -> SendEvent (EStart ());
|
||
|
#line 205 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 208 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(m_fClosestPlayer < fSeeDistance ){
|
||
|
#line 210 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CheckIfPlayerVisible ();
|
||
|
#line 211 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 214 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fSenseRange = GetOwner () -> m_fSenseRange ;
|
||
|
#line 215 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(penClosest != NULL && fSenseRange > 0 && m_fClosestPlayer < fSenseRange ){
|
||
|
#line 217 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SendWatchEvent (penClosest );
|
||
|
#line 218 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 221 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SetWatchDelays ();
|
||
|
#line 222 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 225 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * CWatcher::CheckCloserPlayer(CEntity * penCurrentTarget,FLOAT fRange)
|
||
|
#line 226 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 228 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(GetOwner () -> m_bBlind ){
|
||
|
#line 230 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return NULL ;
|
||
|
#line 231 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 233 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * penClosestPlayer = NULL ;
|
||
|
#line 234 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fClosestPlayer =
|
||
|
#line 235 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
(penCurrentTarget -> GetPlacement () . pl_PositionVector - m_penOwner -> GetPlacement () . pl_PositionVector ) . Length ();
|
||
|
#line 236 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
fClosestPlayer = Min (fClosestPlayer , fRange );
|
||
|
#line 239 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
for(INDEX iPlayer = 0;iPlayer < GetMaxPlayers ();iPlayer ++){
|
||
|
#line 240 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * penPlayer = GetPlayerEntity (iPlayer );
|
||
|
#line 241 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(penPlayer == NULL || penPlayer == penCurrentTarget ){
|
||
|
#line 242 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
continue ;
|
||
|
#line 243 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 245 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if((penPlayer -> GetFlags () & ENF_ALIVE ) && ! (penPlayer -> GetFlags () & ENF_INVISIBLE )){
|
||
|
#line 247 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fDistance =
|
||
|
#line 248 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
(penPlayer -> GetPlacement () . pl_PositionVector - m_penOwner -> GetPlacement () . pl_PositionVector ) . Length ();
|
||
|
#line 250 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(fDistance < fClosestPlayer &&
|
||
|
#line 251 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
GetOwner () -> SeeEntity (penPlayer , Cos (GetOwner () -> m_fViewAngle / 2.0f))){
|
||
|
#line 253 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
fClosestPlayer = fDistance ;
|
||
|
#line 254 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
penClosestPlayer = penPlayer ;
|
||
|
#line 255 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 256 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 257 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 259 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return penClosestPlayer ;
|
||
|
#line 260 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 263 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * CWatcher::CheckAnotherPlayer(CEntity * penCurrentTarget)
|
||
|
#line 264 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 266 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(GetOwner () -> m_bBlind || penCurrentTarget == NULL ){
|
||
|
#line 268 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return NULL ;
|
||
|
#line 269 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 272 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * penClosestPlayer = NULL ;
|
||
|
#line 273 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fCurrentDistance =
|
||
|
#line 274 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
(penCurrentTarget -> GetPlacement () . pl_PositionVector - m_penOwner -> GetPlacement () . pl_PositionVector ) . Length ();
|
||
|
#line 275 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fRange = fCurrentDistance * 1.5f;
|
||
|
#line 278 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX iOffset = GetRandomPlayer ();
|
||
|
#line 281 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
INDEX ctPlayers = GetMaxPlayers ();
|
||
|
#line 282 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
for(INDEX iPlayer = 0;iPlayer < ctPlayers ;iPlayer ++){
|
||
|
#line 283 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
CEntity * penPlayer = GetPlayerEntity ((iPlayer + iOffset ) % ctPlayers );
|
||
|
#line 284 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(penPlayer == NULL || penPlayer == penCurrentTarget ){
|
||
|
#line 285 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
continue ;
|
||
|
#line 286 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 288 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if((penPlayer -> GetFlags () & ENF_ALIVE ) && ! (penPlayer -> GetFlags () & ENF_INVISIBLE )){
|
||
|
#line 290 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
FLOAT fDistance =
|
||
|
#line 291 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
(penPlayer -> GetPlacement () . pl_PositionVector - m_penOwner -> GetPlacement () . pl_PositionVector ) . Length ();
|
||
|
#line 293 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(fDistance < fRange &&
|
||
|
#line 294 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
GetOwner () -> SeeEntity (penPlayer , Cos (GetOwner () -> m_fViewAngle / 2.0f))){
|
||
|
#line 296 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return penPlayer ;
|
||
|
#line 297 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 298 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 299 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 301 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return penCurrentTarget ;
|
||
|
#line 302 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
|
||
|
#line 307 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SLONG CWatcher::GetUsedMemory(void)
|
||
|
#line 308 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
{
|
||
|
#line 309 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return (sizeof (CWatcher ) - sizeof (CRationalEntity ) + CRationalEntity :: GetUsedMemory ());
|
||
|
#line 310 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
BOOL CWatcher::
|
||
|
#line 317 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Active(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CWatcher_Active
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CWatcher::Active expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 319 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Jump(STATE_CURRENT,0x02bc0005, FALSE, EInternal());return TRUE;}BOOL CWatcher::H0x02bc0005_Active_03(const CEntityEvent &__eeInput){
|
||
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc0005
|
||
|
if(!(TRUE )){ Jump(STATE_CURRENT,0x02bc0006, FALSE, EInternal());return TRUE;}
|
||
|
#line 321 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Watch ();
|
||
|
#line 323 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SetTimerAfter(m_tmDelay );
|
||
|
Jump(STATE_CURRENT, 0x02bc0003, FALSE, EBegin());return TRUE;}BOOL CWatcher::H0x02bc0003_Active_01(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc0003
|
||
|
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
|
||
|
return TRUE;}ASSERT(FALSE);break;case(EVENTCODE_ETimer):{const ETimer&e= (ETimer&)__eeInput;
|
||
|
UnsetTimer();Jump(STATE_CURRENT,0x02bc0004, FALSE, EInternal());return TRUE;}ASSERT(FALSE);break;case(EVENTCODE_EStop):{const EStop&e= (EStop&)__eeInput;
|
||
|
Jump(STATE_CURRENT, STATE_CWatcher_Inactive, TRUE, EVoid());return TRUE;}ASSERT(FALSE);break;case(EVENTCODE_EStart):{const EStart&e= (EStart&)__eeInput;
|
||
|
UnsetTimer();Jump(STATE_CURRENT,0x02bc0004, FALSE, EInternal());return TRUE;}ASSERT(FALSE);break;case(EVENTCODE_ETeleport):{const ETeleport&e= (ETeleport&)__eeInput;
|
||
|
UnsetTimer();Jump(STATE_CURRENT,0x02bc0004, FALSE, EInternal());return TRUE;}ASSERT(FALSE);break;default: return FALSE; break;
|
||
|
#line 331 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}return TRUE;}BOOL CWatcher::H0x02bc0004_Active_02(const CEntityEvent &__eeInput){
|
||
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc0004
|
||
|
Jump(STATE_CURRENT,0x02bc0005, FALSE, EInternal());return TRUE;
|
||
|
#line 332 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}BOOL CWatcher::H0x02bc0006_Active_04(const CEntityEvent &__eeInput) {
|
||
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc0006
|
||
|
ASSERT(FALSE); return TRUE;};BOOL CWatcher::
|
||
|
#line 336 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Inactive(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CWatcher_Inactive
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CWatcher::Inactive expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 337 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SetTimerAt(THINKTIME_NEVER);
|
||
|
Jump(STATE_CURRENT, 0x02bc0008, FALSE, EBegin());return TRUE;}BOOL CWatcher::H0x02bc0008_Inactive_01(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc0008
|
||
|
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
|
||
|
return TRUE;}ASSERT(FALSE);break;case(EVENTCODE_EStart):{const EStart&e= (EStart&)__eeInput;
|
||
|
Jump(STATE_CURRENT, STATE_CWatcher_Active, TRUE, EVoid());return TRUE;}ASSERT(FALSE);break;default: return FALSE; break;
|
||
|
#line 340 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}return TRUE;}BOOL CWatcher::H0x02bc0009_Inactive_02(const CEntityEvent &__eeInput){
|
||
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc0009
|
||
|
ASSERT(FALSE); return TRUE;};BOOL CWatcher::
|
||
|
#line 344 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Dummy(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CWatcher_Dummy
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CWatcher::Dummy expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 347 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SetTimerAt(THINKTIME_NEVER);
|
||
|
Jump(STATE_CURRENT, 0x02bc000b, FALSE, EBegin());return TRUE;}BOOL CWatcher::H0x02bc000b_Dummy_01(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc000b
|
||
|
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
|
||
|
return TRUE;}ASSERT(FALSE);break;default:{return TRUE;}ASSERT(FALSE);break;
|
||
|
#line 350 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}return TRUE;}BOOL CWatcher::H0x02bc000c_Dummy_02(const CEntityEvent &__eeInput){
|
||
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc000c
|
||
|
; ASSERT(FALSE); return TRUE;};BOOL CWatcher::
|
||
|
#line 353 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Main(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CWatcher_Main
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EWatcherInit, "CWatcher::Main expects 'EWatcherInit' as input!"); const EWatcherInit &eInit = (const EWatcherInit &)__eeInput;
|
||
|
#line 355 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
ASSERT (eInit . penOwner != NULL );
|
||
|
#line 356 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_penOwner = eInit . penOwner ;
|
||
|
#line 359 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
InitAsVoid ();
|
||
|
#line 360 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SetPhysicsFlags (EPF_MODEL_IMMATERIAL );
|
||
|
#line 361 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
SetCollisionFlags (ECF_IMMATERIAL );
|
||
|
#line 364 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
if(GetSP () -> sp_gmGameMode == CSessionProperties :: GM_FLYOVER ){
|
||
|
#line 366 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Jump(STATE_CURRENT, STATE_CWatcher_Dummy, TRUE, EVoid());return TRUE;
|
||
|
#line 368 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
}
|
||
|
#line 372 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
m_iPlayerToCheck = GetRandomPlayer () - 1;
|
||
|
#line 375 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
STATE_CWatcher_Inactive, TRUE;
|
||
|
Jump(STATE_CURRENT, 0x02bc000d, FALSE, EBegin());return TRUE;}BOOL CWatcher::H0x02bc000d_Main_01(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc000d
|
||
|
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: Call(STATE_CURRENT, STATE_CWatcher_Inactive, TRUE, EVoid());return TRUE;case EVENTCODE_EEnd: Jump(STATE_CURRENT,0x02bc000e, FALSE, __eeInput); return TRUE;default: return FALSE; }}BOOL CWatcher::H0x02bc000e_Main_02(const CEntityEvent &__eeInput){
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x02bc000e
|
||
|
const EEnd&__e= (EEnd&)__eeInput;
|
||
|
;
|
||
|
#line 378 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Destroy ();
|
||
|
#line 380 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
Return(STATE_CURRENT,EVoid());
|
||
|
#line 380 "D:/SE1_GPL/Sources/EntitiesMP/Watcher.es"
|
||
|
return TRUE; ASSERT(FALSE); return TRUE;};
|