mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-22 10:20:26 +01:00
239 lines
10 KiB
C++
239 lines
10 KiB
C++
/*
|
|
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
|
|
*/
|
|
|
|
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
|
|
#include "StdH.h"
|
|
|
|
#include <EntitiesMP/ModelHolder.h>
|
|
#include <EntitiesMP/ModelHolder_tables.h>
|
|
void CModelHolder::SetDefaultProperties(void) {
|
|
m_fnModel = CTFILENAME("Models\\Editor\\Axis.mdl");
|
|
m_fnTexture = CTFILENAME("Models\\Editor\\Vector.tex");
|
|
m_fStretchAll = 1.0f;
|
|
m_fStretchX = 1.0f;
|
|
m_fStretchY = 1.0f;
|
|
m_fStretchZ = 1.0f;
|
|
m_strName = "";
|
|
m_strDescription = "";
|
|
m_bColliding = FALSE ;
|
|
m_iModelAnimation = 0;
|
|
m_iTextureAnimation = 0;
|
|
m_bClusterShadows = FALSE ;
|
|
m_bBackground = FALSE ;
|
|
m_bCustomShading = FALSE ;
|
|
m_aShadingDirection = ANGLE3D(AngleDeg (45.0f) , AngleDeg (45.0f) , AngleDeg (45.0f));
|
|
m_colLight = C_WHITE ;
|
|
m_colAmbient = C_BLACK ;
|
|
m_fnmLightAnimation = CTString("");
|
|
m_iLightAnimation = 0;
|
|
m_aoLightAnimation.SetData(NULL);
|
|
|
|
CEntity::SetDefaultProperties();
|
|
}
|
|
|
|
#line 44 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
CAnimData * CModelHolder::GetAnimData(SLONG slPropertyOffset)
|
|
#line 45 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
{
|
|
#line 46 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(slPropertyOffset == offsetof (CModelHolder , m_iModelAnimation )){
|
|
#line 47 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
return GetModelObject () -> GetData ();
|
|
#line 48 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}else if(slPropertyOffset == offsetof (CModelHolder , m_iTextureAnimation )){
|
|
#line 49 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
return GetModelObject () -> mo_toTexture . GetData ();
|
|
#line 50 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}else if(slPropertyOffset == offsetof (CModelHolder , m_iLightAnimation )){
|
|
#line 51 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
return m_aoLightAnimation . GetData ();
|
|
#line 52 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}else {
|
|
#line 53 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
return CEntity :: GetAnimData (slPropertyOffset );
|
|
#line 54 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 55 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
|
|
#line 58 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
BOOL CModelHolder::AdjustShadingParameters(FLOAT3D & vLightDirection,COLOR & colLight,COLOR & colAmbient)
|
|
#line 59 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
{
|
|
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_bCustomShading ){
|
|
#line 62 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_aoLightAnimation . GetData () != NULL ){
|
|
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SLONG colFrame0 , colFrame1 ;FLOAT fRatio ;
|
|
#line 65 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_aoLightAnimation . GetFrame (colFrame0 , colFrame1 , fRatio );
|
|
#line 66 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
UBYTE ubAnimR0 , ubAnimG0 , ubAnimB0 ;
|
|
#line 67 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
UBYTE ubAnimR1 , ubAnimG1 , ubAnimB1 ;
|
|
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
ColorToRGB (colFrame0 , ubAnimR0 , ubAnimG0 , ubAnimB0 );
|
|
#line 69 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
ColorToRGB (colFrame1 , ubAnimR1 , ubAnimG1 , ubAnimB1 );
|
|
#line 72 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
FLOAT fAnimR = NormByteToFloat (Lerp (ubAnimR0 , ubAnimR1 , fRatio ));
|
|
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
FLOAT fAnimG = NormByteToFloat (Lerp (ubAnimG0 , ubAnimG1 , fRatio ));
|
|
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
FLOAT fAnimB = NormByteToFloat (Lerp (ubAnimB0 , ubAnimB1 , fRatio ));
|
|
#line 77 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
UBYTE ubLightR , ubLightG , ubLightB ;
|
|
#line 78 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
UBYTE ubAmbientR , ubAmbientG , ubAmbientB ;
|
|
#line 79 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
ColorToRGB (m_colLight , ubLightR , ubLightG , ubLightB );
|
|
#line 80 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
ColorToRGB (m_colAmbient , ubAmbientR , ubAmbientG , ubAmbientB );
|
|
#line 81 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
colLight = RGBToColor (ubLightR * fAnimR , ubLightG * fAnimG , ubLightB * fAnimB );
|
|
#line 82 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
colAmbient = RGBToColor (ubAmbientR * fAnimR , ubAmbientG * fAnimG , ubAmbientB * fAnimB );
|
|
#line 85 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}else {
|
|
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
colLight = m_colLight ;
|
|
#line 87 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
colAmbient = m_colAmbient ;
|
|
#line 88 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
AnglesToDirectionVector (m_aShadingDirection , vLightDirection );
|
|
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
vLightDirection = - vLightDirection ;
|
|
#line 92 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 93 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
return TRUE ;
|
|
#line 94 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
|
|
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
void CModelHolder::InitModelHolder(void) {
|
|
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fStretchX < 0.01f){m_fStretchX = 0.01f;}
|
|
#line 100 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fStretchY < 0.01f){m_fStretchY = 0.01f;}
|
|
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fStretchZ < 0.01f){m_fStretchZ = 0.01f;}
|
|
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fStretchAll < 0.01f){m_fStretchAll = 0.01f;}
|
|
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fStretchX > 100.0f){m_fStretchX = 100.0f;}
|
|
#line 104 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fStretchY > 100.0f){m_fStretchY = 100.0f;}
|
|
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fStretchZ > 100.0f){m_fStretchZ = 100.0f;}
|
|
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fStretchAll > 100.0f){m_fStretchAll = 100.0f;}
|
|
#line 109 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fnOldModel == ""){
|
|
#line 111 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_fnOldModel = m_fnModel ;
|
|
#line 113 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}else {
|
|
#line 115 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_fnOldModel != m_fnModel ){
|
|
#line 117 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_fnTexture = m_fnModel . FileDir () + m_fnModel . FileName () + CTString (".tex");
|
|
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_fnOldModel = m_fnModel ;
|
|
#line 120 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 121 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
InitAsModel ();
|
|
#line 124 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_bColliding ){
|
|
#line 125 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetPhysicsFlags (EPF_MODEL_FIXED );
|
|
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetCollisionFlags (ECF_MODEL_HOLDER );
|
|
#line 127 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}else {
|
|
#line 128 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetPhysicsFlags (EPF_MODEL_IMMATERIAL );
|
|
#line 129 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetCollisionFlags (ECF_IMMATERIAL );
|
|
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_bClusterShadows ){
|
|
#line 133 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetFlags (GetFlags () | ENF_CLUSTERSHADOWS );
|
|
#line 134 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}else {
|
|
#line 135 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetFlags (GetFlags () & ~ ENF_CLUSTERSHADOWS );
|
|
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 138 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_bBackground ){
|
|
#line 139 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetFlags (GetFlags () | ENF_BACKGROUND );
|
|
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}else {
|
|
#line 141 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetFlags (GetFlags () & ~ ENF_BACKGROUND );
|
|
#line 142 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 145 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
GetModelObject () -> mo_Stretch = FLOAT3D (
|
|
#line 146 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_fStretchAll * m_fStretchX ,
|
|
#line 147 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_fStretchAll * m_fStretchY ,
|
|
#line 148 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_fStretchAll * m_fStretchZ );
|
|
#line 151 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetModel (m_fnModel );
|
|
#line 152 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
SetModelMainTexture (m_fnTexture );
|
|
#line 154 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
GetModelObject () -> PlayAnim (m_iModelAnimation , AOF_LOOPING );
|
|
#line 155 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
GetModelObject () -> mo_toTexture . PlayAnim (m_iTextureAnimation , AOF_LOOPING );
|
|
#line 157 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
try {
|
|
#line 158 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_aoLightAnimation . SetData_t (m_fnmLightAnimation );
|
|
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}catch (char * strError ){
|
|
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
WarningMessage (TRANS ("Cannot load '%s': %s") , (CTString &) m_fnmLightAnimation , strError );
|
|
#line 161 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_fnmLightAnimation = "";
|
|
#line 162 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
if(m_aoLightAnimation . GetData () != NULL ){
|
|
#line 164 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_aoLightAnimation . PlayAnim (m_iLightAnimation , AOF_LOOPING );
|
|
#line 165 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
#line 167 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
m_strDescription . PrintF ("%s,%s" , (CTString &) m_fnModel . FileName () , (CTString &) m_fnTexture . FileName ());
|
|
#line 169 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
return ;
|
|
#line 170 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
}
|
|
BOOL CModelHolder::
|
|
#line 173 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
Main(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT STATE_CModelHolder_Main
|
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CModelHolder::Main expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
|
#line 175 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
InitModelHolder ();
|
|
#line 176 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
Return(STATE_CURRENT,EVoid());
|
|
#line 176 "D:/SE1_GPL/Sources/EntitiesMP/ModelHolder.es"
|
|
return TRUE; ASSERT(FALSE); return TRUE;}; |