Serious-Engine/Sources/EntitiesMP/PlayerView.cpp
2016-03-11 15:57:17 +02:00

338 lines
14 KiB
C++

/*
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
*/
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
#include "StdH.h"
#include "EntitiesMP/Player.h"
#include "EntitiesMP/PlayerWeapons.h"
#include <EntitiesMP/PlayerView.h>
#include <EntitiesMP/PlayerView_tables.h>
CEntityEvent *EViewInit::MakeCopy(void) { CEntityEvent *peeCopy = new EViewInit(*this); return peeCopy;}
EViewInit::EViewInit() : CEntityEvent(EVENTCODE_EViewInit) {;
ClearToDefault(penOwner);
ClearToDefault(penCamera);
ClearToDefault(vtView);
ClearToDefault(bDeathFixed);
};
#line 26 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
void CPlayerView_Precache(void)
{
CDLLEntityClass *pdec = &CPlayerView_DLLClass;
pdec->PrecacheModel(MODEL_MARKER);
pdec->PrecacheTexture(TEXTURE_MARKER);
}
void CPlayerView::SetDefaultProperties(void) {
m_penOwner = NULL;
m_iViewType = 0;
m_fDistance = 1.0f;
m_vZLast = FLOAT3D(0 , 0 , 0);
m_vTargetLast = FLOAT3D(0 , 0 , 0);
m_bFixed = FALSE ;
m_penPrediction = NULL;
CMovableEntity::SetDefaultProperties();
}
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
void CPlayerView::AddDependentsToPrediction(void)
#line 57 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
{
#line 58 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m_penOwner -> AddToPrediction ();
#line 59 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
void CPlayerView::PreMoving() {}
#line 61 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
void CPlayerView::DoMoving() {
#line 62 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
en_plLastPlacement = GetPlacement ();
#line 63 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
void CPlayerView::PostMoving()
#line 65 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
{
#line 66 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetCameraPosition ();
#line 67 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
CPlacement3D CPlayerView::GetLerpedPlacement(void)const
#line 69 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
{
#line 70 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT fLerpFactor ;
#line 71 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(IsPredictor ()){
#line 72 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
fLerpFactor = _pTimer -> GetLerpFactor ();
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}else {
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
fLerpFactor = _pTimer -> GetLerpFactor2 ();
#line 75 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 76 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
return LerpPlacementsPrecise (en_plLastPlacement , en_plPlacement , fLerpFactor );
#line 78 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 81 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
void CPlayerView::RenderParticles(void)
#line 82 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
{
#line 83 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(Particle_GetViewer () == this ){
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
Particles_ViewerLocal (this );
#line 85 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 88 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
void CPlayerView::SetCameraPosition()
#line 89 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
{
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT fDistance = 1.0f;
#line 92 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
CPlacement3D pl = ((CPlayerEntity &) * m_penOwner ) . en_plViewpoint ;
#line 93 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
BOOL bFollowCrossHair ;
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(m_iViewType == VT_3RDPERSONVIEW ){
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
pl . pl_OrientationAngle (2) -= 12.0f;
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
pl . pl_PositionVector (2) += 1.0f;
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
fDistance = 4.2f;
#line 100 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
bFollowCrossHair = TRUE ;
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}else if(m_iViewType == VT_PLAYERDEATH ){
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
fDistance = 3.5f;
#line 104 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
bFollowCrossHair = FALSE ;
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
pl . pl_OrientationAngle (3) = 0.0f;
#line 110 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
pl . RelativeToAbsolute (m_penOwner -> GetPlacement ());
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vBase ;
#line 113 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
EntityInfo * pei = (EntityInfo *) (m_penOwner -> GetEntityInfo ());
#line 114 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
GetEntityInfoPosition (m_penOwner , pei -> vSourceCenter , vBase );
#line 117 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOATmatrix3D m ;
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
MakeRotationMatrixFast (m , pl . pl_OrientationAngle );
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vRight = m . GetColumn (1);
#line 120 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vUp = m . GetColumn (2);
#line 121 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vFront = m . GetColumn (3);
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vDest [ 5 ];
#line 124 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vDest [ 0 ] = vBase + vFront * fDistance + vUp * 1.0f;
#line 125 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vDest [ 1 ] = vBase + vFront * fDistance - vUp * 1.0f;
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vDest [ 2 ] = vBase + vFront * fDistance + vRight * 1.0f;
#line 127 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vDest [ 3 ] = vBase + vFront * fDistance - vRight * 1.0f;
#line 128 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vDest [ 4 ] = vBase + vFront * fDistance ;
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT fBack = 0;
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
for(INDEX i = 0;i < 5;i ++){
#line 134 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
CCastRay crRay (m_penOwner , vBase , vDest [ i ]);
#line 135 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
crRay . cr_bHitTranslucentPortals = FALSE ;
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
crRay . cr_ttHitModels = CCastRay :: TT_COLLISIONBOX ;
#line 137 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
GetWorld () -> CastRay (crRay );
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(crRay . cr_penHit != NULL ){
#line 142 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
fDistance = Min (fDistance , crRay . cr_fHitDistance - 0.5f);
#line 144 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(crRay . cr_pbpoBrushPolygon != NULL ){
#line 146 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vDir = (vDest [ i ] - vBase ) . Normalize ();
#line 147 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT fD = Abs (FLOAT3D (crRay . cr_pbpoBrushPolygon -> bpo_pbplPlane -> bpl_plAbsolute ) % vDir ) * 0.25f;
#line 148 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
fBack = Max (fBack , fD );
#line 149 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 150 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 152 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 153 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
fDistance = ClampDn (fDistance - fBack , 0.0f);
#line 154 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m_fDistance = fDistance ;
#line 155 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vBase += vFront * fDistance ;
#line 157 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
CPlayerWeapons * ppw = ((CPlayer &) * m_penOwner ) . GetPlayerWeapons ();
#line 158 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(bFollowCrossHair ){
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vTarget = vBase - ppw -> m_vRayHit ;
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT fLen = vTarget . Length ();
#line 161 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(fLen > 0.01){
#line 162 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vTarget /= fLen ;
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}else {
#line 164 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vTarget = FLOAT3D (0 , 1 , 0);
#line 165 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 167 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vX ;
#line 168 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vY = m . GetColumn (2);
#line 169 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
FLOAT3D vZ = vTarget ;
#line 170 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vZ . Normalize ();
#line 172 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(Abs (vY % vZ ) > 0.9f){
#line 173 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vY = - m . GetColumn (3);
#line 174 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 176 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vX = vY * vZ ;
#line 177 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vX . Normalize ();
#line 178 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vY = vZ * vX ;
#line 179 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
vY . Normalize ();
#line 180 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m_vZLast = vZ ;
#line 182 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m (1 , 1) = vX (1);m (1 , 2) = vY (1);m (1 , 3) = vZ (1);
#line 183 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m (2 , 1) = vX (2);m (2 , 2) = vY (2);m (2 , 3) = vZ (2);
#line 184 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m (3 , 1) = vX (3);m (3 , 2) = vY (3);m (3 , 3) = vZ (3);
#line 185 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
DecomposeRotationMatrixNoSnap (pl . pl_OrientationAngle , m );
#line 186 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 188 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(m_bFixed ){
#line 189 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
pl . pl_PositionVector = GetPlacement () . pl_PositionVector ;
#line 190 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
pl . pl_OrientationAngle = ANGLE3D (0 , - 90 , 0);
#line 191 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m_fDistance = (pl . pl_PositionVector - m_penOwner -> GetPlacement () . pl_PositionVector ) . Length ();
#line 192 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
MakeRotationMatrixFast (m , pl . pl_OrientationAngle );
#line 193 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}else {
#line 194 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
pl . pl_PositionVector = vBase ;
#line 195 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 198 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetPlacement_internal (pl , m , TRUE );
#line 199 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
BOOL CPlayerView::
#line 249 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
Main(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CPlayerView_Main
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EViewInit, "CPlayerView::Main expects 'EViewInit' as input!"); const EViewInit &eInit = (const EViewInit &)__eeInput;
#line 251 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
ASSERT (eInit . penOwner != NULL );
#line 252 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m_penOwner = eInit . penOwner ;
#line 253 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m_iViewType = eInit . vtView ;
#line 254 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m_bFixed = eInit . bDeathFixed ;
#line 255 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
ASSERT (IsOfClass (m_penOwner , "Player"));
#line 258 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
InitAsEditorModel ();
#line 259 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetFlags (GetFlags () | ENF_CROSSESLEVELS );
#line 260 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetPhysicsFlags (EPF_MODEL_IMMATERIAL | EPF_MOVABLE );
#line 261 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetCollisionFlags (ECF_IMMATERIAL );
#line 263 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetModel (MODEL_MARKER );
#line 264 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetModelMainTexture (TEXTURE_MARKER );
#line 267 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
if(m_iViewType == VT_PLAYERDEATH ){
#line 268 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
AddToMovers ();
#line 269 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}
#line 271 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SendEvent (EStart ());
#line 272 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetTimerAt(THINKTIME_NEVER);
Jump(STATE_CURRENT, 0x01930001, FALSE, EBegin());return TRUE;}BOOL CPlayerView::H0x01930001_Main_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01930001
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;
#line 275 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
SetCameraPosition ();
#line 276 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
en_plLastPlacement = GetPlacement ();
#line 277 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
m_vTargetLast = ((CPlayer &) * m_penOwner ) . GetPlayerWeapons () -> m_vRayHit ;
#line 278 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
return TRUE;
#line 279 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}ASSERT(FALSE);break;case(EVENTCODE_EEnd):{const EEnd&e= (EEnd&)__eeInput;
UnsetTimer();Jump(STATE_CURRENT,0x01930002, FALSE, EInternal());return TRUE;}ASSERT(FALSE);break;default:{return TRUE;}ASSERT(FALSE);break;
#line 282 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
}return TRUE;}BOOL CPlayerView::H0x01930002_Main_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01930002
#line 284 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
Destroy ();
#line 286 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
Return(STATE_CURRENT,EVoid());
#line 286 "D:/SE1_GPL/Sources/EntitiesMP/PlayerView.es"
return TRUE; ASSERT(FALSE); return TRUE;};