mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-22 10:20:26 +01:00
271 lines
13 KiB
C++
271 lines
13 KiB
C++
/*
|
|
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
|
|
*/
|
|
|
|
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
|
|
#include "StdH.h"
|
|
|
|
#include <EntitiesMP/WatchPlayers.h>
|
|
#include <EntitiesMP/WatchPlayers_tables.h>
|
|
void CWatchPlayers::SetDefaultProperties(void) {
|
|
m_penOwner = NULL;
|
|
m_penFar = NULL;
|
|
m_fWaitTime = 0.1f;
|
|
m_fDistance = 100.0f;
|
|
m_bRangeWatcher = TRUE ;
|
|
m_eetEventClose = EET_TRIGGER ;
|
|
m_eetEventFar = EET_ENVIRONMENTSTOP ;
|
|
m_penCurrentWatch = NULL;
|
|
m_bActive = TRUE ;
|
|
m_strName = "";
|
|
CRationalEntity::SetDefaultProperties();
|
|
}
|
|
|
|
#line 34 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
BOOL CWatchPlayers::IsAnyPlayerClose(void) {
|
|
#line 36 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
FLOAT fClosest = 100000.0f;
|
|
#line 37 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
FLOAT fDistance ;
|
|
#line 39 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
m_penCurrentWatch = NULL ;
|
|
#line 41 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
for(INDEX iPlayer = 0;iPlayer < GetMaxPlayers ();iPlayer ++){
|
|
#line 42 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
CEntity * penPlayer = GetPlayerEntity (iPlayer );
|
|
#line 44 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(penPlayer != NULL && penPlayer -> GetFlags () & ENF_ALIVE && ! (penPlayer -> GetFlags () & ENF_INVISIBLE )){
|
|
#line 45 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
fDistance = 100000.0f;
|
|
#line 46 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(m_bRangeWatcher ){
|
|
#line 48 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
fDistance = (penPlayer -> GetPlacement () . pl_PositionVector -
|
|
#line 49 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
GetPlacement () . pl_PositionVector ) . Length ();
|
|
#line 50 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}else {
|
|
#line 51 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(m_penOwner != NULL ){
|
|
#line 53 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
fDistance = (penPlayer -> GetPlacement () . pl_PositionVector -
|
|
#line 54 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
m_penOwner -> GetPlacement () . pl_PositionVector ) . Length ();
|
|
#line 55 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 57 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(fDistance < fClosest ){
|
|
#line 58 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
fClosest = fDistance ;
|
|
#line 59 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
m_penCurrentWatch = penPlayer ;
|
|
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 61 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 62 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
return (fClosest < m_fDistance );
|
|
#line 65 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
|
|
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
void CWatchPlayers::SendCloseEvent(void) {
|
|
#line 70 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(m_bRangeWatcher && m_penOwner == NULL ){
|
|
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}else {
|
|
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SendToTarget (m_penOwner , m_eetEventClose , m_penCurrentWatch );
|
|
#line 75 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 76 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
|
|
#line 79 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
void CWatchPlayers::SendFarEvent(void) {
|
|
#line 81 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(m_bRangeWatcher && m_penOwner == NULL ){
|
|
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}else {
|
|
#line 85 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(m_penFar != NULL ){
|
|
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SendToTarget (m_penFar , m_eetEventFar );
|
|
#line 87 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}else {
|
|
#line 88 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SendToTarget (m_penOwner , m_eetEventFar );
|
|
#line 89 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
BOOL CWatchPlayers::
|
|
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Main(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT STATE_CWatchPlayers_Main
|
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CWatchPlayers::Main expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
|
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
InitAsEditorModel ();
|
|
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SetPhysicsFlags (EPF_MODEL_IMMATERIAL );
|
|
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SetCollisionFlags (ECF_IMMATERIAL );
|
|
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SetModel (MODEL_WATCHPLAYERS );
|
|
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SetModelMainTexture (TEXTURE_WATCHPLAYERS );
|
|
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(m_fWaitTime < 0.1f){
|
|
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
m_fWaitTime = 0.1f;
|
|
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 109 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(m_bActive ){
|
|
#line 110 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Jump(STATE_CURRENT, STATE_CWatchPlayers_Active, TRUE, EVoid());return TRUE;
|
|
#line 111 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}else {
|
|
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Jump(STATE_CURRENT, STATE_CWatchPlayers_Inactive, TRUE, EVoid());return TRUE;
|
|
#line 113 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
} ASSERT(FALSE); return TRUE;};BOOL CWatchPlayers::
|
|
#line 116 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Active(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT STATE_CWatchPlayers_Active
|
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CWatchPlayers::Active expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
|
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
STATE_CWatchPlayers_FarWatch, TRUE;
|
|
Jump(STATE_CURRENT, 0x02be0001, FALSE, EBegin());return TRUE;}BOOL CWatchPlayers::H0x02be0001_Active_01(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be0001
|
|
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: Call(STATE_CURRENT, STATE_CWatchPlayers_FarWatch, TRUE, EVoid());return TRUE;case EVENTCODE_EDeactivate: Jump(STATE_CURRENT,0x02be0002, FALSE, __eeInput); return TRUE;default: return FALSE; }}BOOL CWatchPlayers::H0x02be0002_Active_02(const CEntityEvent &__eeInput){
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be0002
|
|
const EDeactivate&__e= (EDeactivate&)__eeInput;
|
|
;
|
|
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Jump(STATE_CURRENT, STATE_CWatchPlayers_Inactive, TRUE, EVoid());return TRUE; ASSERT(FALSE); return TRUE;};BOOL CWatchPlayers::
|
|
#line 122 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Inactive(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT STATE_CWatchPlayers_Inactive
|
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CWatchPlayers::Inactive expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
|
#line 124 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SetTimerAt(THINKTIME_NEVER);
|
|
Jump(STATE_CURRENT, 0x02be0004, FALSE, EBegin());return TRUE;}BOOL CWatchPlayers::H0x02be0004_Inactive_01(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be0004
|
|
switch(__eeInput.ee_slEvent){case(EVENTCODE_EActivate):{const EActivate&e= (EActivate&)__eeInput;
|
|
|
|
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
UnsetTimer();Jump(STATE_CURRENT,0x02be0005, FALSE, EInternal());return TRUE;
|
|
#line 127 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}ASSERT(FALSE);break;default:{
|
|
#line 129 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
return TRUE;
|
|
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}ASSERT(FALSE);break;
|
|
#line 131 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}return TRUE;}BOOL CWatchPlayers::H0x02be0005_Inactive_02(const CEntityEvent &__eeInput){
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be0005
|
|
|
|
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Jump(STATE_CURRENT, STATE_CWatchPlayers_Active, TRUE, EVoid());return TRUE; ASSERT(FALSE); return TRUE;};BOOL CWatchPlayers::
|
|
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
CloseWatch(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT STATE_CWatchPlayers_CloseWatch
|
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CWatchPlayers::CloseWatch expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
|
#line 137 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Jump(STATE_CURRENT,0x02be0009, FALSE, EInternal());return TRUE;}BOOL CWatchPlayers::H0x02be0009_CloseWatch_03(const CEntityEvent &__eeInput){
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be0009
|
|
if(!(TRUE )){ Jump(STATE_CURRENT,0x02be000a, FALSE, EInternal());return TRUE;}
|
|
#line 138 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SetTimerAfter(m_fWaitTime );
|
|
Jump(STATE_CURRENT, 0x02be0007, FALSE, EBegin());return TRUE;}BOOL CWatchPlayers::H0x02be0007_CloseWatch_01(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be0007
|
|
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
|
|
|
|
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(! IsAnyPlayerClose ()){
|
|
#line 142 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SendFarEvent ();
|
|
#line 143 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Jump(STATE_CURRENT, STATE_CWatchPlayers_FarWatch, TRUE, EVoid());return TRUE;
|
|
#line 144 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 145 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
return TRUE;
|
|
#line 146 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}ASSERT(FALSE);break;case(EVENTCODE_ETimer):{const ETimer&e= (ETimer&)__eeInput;
|
|
UnsetTimer();Jump(STATE_CURRENT,0x02be0008, FALSE, EInternal());return TRUE;}ASSERT(FALSE);break;default: return FALSE; break;
|
|
#line 148 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}return TRUE;}BOOL CWatchPlayers::H0x02be0008_CloseWatch_02(const CEntityEvent &__eeInput){
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be0008
|
|
Jump(STATE_CURRENT,0x02be0009, FALSE, EInternal());return TRUE;
|
|
#line 149 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}BOOL CWatchPlayers::H0x02be000a_CloseWatch_04(const CEntityEvent &__eeInput) {
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be000a
|
|
ASSERT(FALSE); return TRUE;};BOOL CWatchPlayers::
|
|
#line 153 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
FarWatch(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT STATE_CWatchPlayers_FarWatch
|
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CWatchPlayers::FarWatch expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
|
#line 154 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Jump(STATE_CURRENT,0x02be000e, FALSE, EInternal());return TRUE;}BOOL CWatchPlayers::H0x02be000e_FarWatch_03(const CEntityEvent &__eeInput){
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be000e
|
|
if(!(TRUE )){ Jump(STATE_CURRENT,0x02be000f, FALSE, EInternal());return TRUE;}
|
|
#line 155 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SetTimerAfter(m_fWaitTime );
|
|
Jump(STATE_CURRENT, 0x02be000c, FALSE, EBegin());return TRUE;}BOOL CWatchPlayers::H0x02be000c_FarWatch_01(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be000c
|
|
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
|
|
|
|
#line 157 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
if(IsAnyPlayerClose ()){
|
|
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
SendCloseEvent ();
|
|
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
Jump(STATE_CURRENT, STATE_CWatchPlayers_CloseWatch, TRUE, EVoid());return TRUE;
|
|
#line 161 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}
|
|
#line 162 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
return TRUE;
|
|
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}ASSERT(FALSE);break;case(EVENTCODE_ETimer):{const ETimer&e= (ETimer&)__eeInput;
|
|
UnsetTimer();Jump(STATE_CURRENT,0x02be000d, FALSE, EInternal());return TRUE;}ASSERT(FALSE);break;default: return FALSE; break;
|
|
#line 165 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}return TRUE;}BOOL CWatchPlayers::H0x02be000d_FarWatch_02(const CEntityEvent &__eeInput){
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be000d
|
|
Jump(STATE_CURRENT,0x02be000e, FALSE, EInternal());return TRUE;
|
|
#line 166 "D:/SE1_GPL/Sources/EntitiesMP/WatchPlayers.es"
|
|
}BOOL CWatchPlayers::H0x02be000f_FarWatch_04(const CEntityEvent &__eeInput) {
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x02be000f
|
|
ASSERT(FALSE); return TRUE;}; |