mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-22 18:30:27 +01:00
460 lines
20 KiB
C++
460 lines
20 KiB
C++
|
/*
|
||
|
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
|
||
|
*/
|
||
|
|
||
|
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
|
||
|
#include "StdH.h"
|
||
|
|
||
|
#include <EntitiesMP/RollingStone.h>
|
||
|
#include <EntitiesMP/RollingStone_tables.h>
|
||
|
void CRollingStone::SetDefaultProperties(void) {
|
||
|
m_fBounce = 0.5f;
|
||
|
m_fHealth = 400.0f;
|
||
|
m_fDamage = 1000.0f;
|
||
|
m_bFixedDamage = FALSE ;
|
||
|
m_fStretch = 1.0f;
|
||
|
m_fDeceleration = 0.9f;
|
||
|
m_fStartSpeed = 50.0f;
|
||
|
m_vStartDir = ANGLE3D(0 , 0 , 0);
|
||
|
m_penDeathTarget = NULL;
|
||
|
m_soBounce0.SetOwner(this);
|
||
|
m_soBounce0.Stop_internal();
|
||
|
m_soBounce1.SetOwner(this);
|
||
|
m_soBounce1.Stop_internal();
|
||
|
m_soBounce2.SetOwner(this);
|
||
|
m_soBounce2.Stop_internal();
|
||
|
m_soBounce3.SetOwner(this);
|
||
|
m_soBounce3.Stop_internal();
|
||
|
m_soBounce4.SetOwner(this);
|
||
|
m_soBounce4.Stop_internal();
|
||
|
m_iNextChannel = 0;
|
||
|
m_soRoll.SetOwner(this);
|
||
|
m_soRoll.Stop_internal();
|
||
|
m_bRollPlaying = FALSE ;
|
||
|
m_qA = FLOATquat3D(0 , 1 , 0 , 0);
|
||
|
m_qALast = FLOATquat3D(0 , 1 , 0 , 0);
|
||
|
m_fASpeed = 0.0f;
|
||
|
m_vR = FLOAT3D(0 , 0 , 1);
|
||
|
CMovableModelEntity::SetDefaultProperties();
|
||
|
}
|
||
|
|
||
|
#line 55 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
void CRollingStone::Precache(void)
|
||
|
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 57 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
PrecacheClass (CLASS_DEBRIS );
|
||
|
#line 58 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
PrecacheModel (MODEL_STONE );
|
||
|
#line 59 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
PrecacheTexture (TEXTURE_STONE );
|
||
|
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
PrecacheSound (SOUND_BOUNCE );
|
||
|
#line 61 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
PrecacheSound (SOUND_ROLL );
|
||
|
#line 62 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
|
||
|
#line 63 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
void CRollingStone::PostMoving() {
|
||
|
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
CMovableModelEntity :: PostMoving ();
|
||
|
#line 67 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(en_penReference != NULL ){
|
||
|
#line 69 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
AdjustSpeeds (en_vReferencePlane );
|
||
|
#line 71 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}else {
|
||
|
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 76 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_qALast = m_qA ;
|
||
|
#line 78 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOATquat3D qRot ;
|
||
|
#line 79 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
qRot . FromAxisAngle (m_vR , m_fASpeed * _pTimer -> TickQuantum * PI / 180);
|
||
|
#line 80 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOATmatrix3D mRot ;
|
||
|
#line 81 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
qRot . ToMatrix (mRot );
|
||
|
#line 82 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_qA = qRot * m_qA ;
|
||
|
#line 83 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(en_ulFlags & ENF_INRENDERING ){
|
||
|
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_qALast = m_qA ;
|
||
|
#line 85 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
|
||
|
#line 89 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
void CRollingStone::AdjustMipFactor(FLOAT & fMipFactor)
|
||
|
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
fMipFactor = 0;
|
||
|
#line 93 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOATquat3D qA ;
|
||
|
#line 94 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
qA = Slerp (_pTimer -> GetLerpFactor () , m_qALast , m_qA );
|
||
|
#line 96 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOATmatrix3D mA ;
|
||
|
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
qA . ToMatrix (mA );
|
||
|
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
ANGLE3D vA ;
|
||
|
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
DecomposeRotationMatrixNoSnap (vA , mA );
|
||
|
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
CAttachmentModelObject * amo = GetModelObject () -> GetAttachmentModel (0);
|
||
|
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
amo -> amo_plRelative . pl_OrientationAngle = vA ;
|
||
|
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
|
||
|
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
void CRollingStone::AdjustSpeedOnOneAxis(FLOAT & fTraNow,FLOAT & aRotNow,BOOL bRolling)
|
||
|
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 113 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fR = 4.0f * m_fStretch ;
|
||
|
#line 115 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fTraNew = (2 * aRotNow * fR + 5 * fTraNow ) / 7;
|
||
|
#line 116 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT aRotNew = fTraNew / fR ;
|
||
|
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
fTraNow = fTraNew ;
|
||
|
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
aRotNow = aRotNew ;
|
||
|
#line 120 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
|
||
|
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
void CRollingStone::AdjustSpeeds(const FLOAT3D & vPlane)
|
||
|
#line 124 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(en_vCurrentTranslationAbsolute . Length () < 1.0f && m_fASpeed < 1.0f){
|
||
|
#line 128 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
en_vCurrentTranslationAbsolute = FLOAT3D (0 , 0 , 0);
|
||
|
#line 129 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_fASpeed = 0.0f;
|
||
|
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
RollSound (0.0f);
|
||
|
#line 131 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
return ;
|
||
|
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 135 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D vTranslationNormal ;
|
||
|
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D vTranslationParallel ;
|
||
|
#line 137 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
GetParallelAndNormalComponents (en_vCurrentTranslationAbsolute , vPlane , vTranslationNormal , vTranslationParallel );
|
||
|
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
BOOL bRolling = vTranslationNormal . Length () < 0.1f;
|
||
|
#line 142 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(bRolling ){
|
||
|
#line 144 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fSpeedTra = vTranslationParallel . Length ();
|
||
|
#line 148 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
RollSound (fSpeedTra );
|
||
|
#line 149 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}else {
|
||
|
#line 150 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
RollSound (0);
|
||
|
#line 151 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 157 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D vRotFromRot = m_vR ;
|
||
|
#line 158 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D vTraFromRot = vPlane * vRotFromRot ;
|
||
|
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
vTraFromRot . Normalize ();
|
||
|
#line 161 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fTraFromRot = 0;
|
||
|
#line 162 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fRotFromRot = m_fASpeed * PI / 180.0f;
|
||
|
#line 165 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D vTraFromTra = vTranslationParallel ;
|
||
|
#line 166 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fTraFromTra = vTraFromTra . Length ();
|
||
|
#line 167 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D vRotFromTra = FLOAT3D (1 , 0 , 0);
|
||
|
#line 168 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fRotFromTra = 0;
|
||
|
#line 169 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(fTraFromTra > 0.001f){
|
||
|
#line 170 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
vTraFromTra /= fTraFromTra ;
|
||
|
#line 171 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
vRotFromTra = vTraFromTra * vPlane ;
|
||
|
#line 172 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
vRotFromTra . Normalize ();
|
||
|
#line 173 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 176 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(Abs (fRotFromRot ) > 0.01f){
|
||
|
#line 178 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
AdjustSpeedOnOneAxis (fTraFromRot , fRotFromRot , bRolling );
|
||
|
#line 179 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 181 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(Abs (fTraFromTra ) > 0.01f){
|
||
|
#line 183 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
AdjustSpeedOnOneAxis (fTraFromTra , fRotFromTra , bRolling );
|
||
|
#line 184 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 187 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOATquat3D qTra ;
|
||
|
#line 188 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
qTra . FromAxisAngle (vRotFromTra , fRotFromTra );
|
||
|
#line 189 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOATquat3D qRot ;
|
||
|
#line 190 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
qRot . FromAxisAngle (vRotFromRot , fRotFromRot );
|
||
|
#line 191 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOATquat3D q = qRot * qTra ;
|
||
|
#line 192 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D vSpeed = vTraFromTra * fTraFromTra + vTraFromRot * fTraFromRot ;
|
||
|
#line 195 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
en_vCurrentTranslationAbsolute = vTranslationNormal + vSpeed ;
|
||
|
#line 196 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
q . ToAxisAngle (m_vR , m_fASpeed );
|
||
|
#line 197 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_fASpeed *= 180 / PI ;
|
||
|
#line 198 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
|
||
|
#line 203 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
void CRollingStone::BounceSound(FLOAT fSpeed) {
|
||
|
#line 204 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fHitStrength = fSpeed * fSpeed ;
|
||
|
#line 206 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fVolume = fHitStrength / 20.0f;
|
||
|
#line 208 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
fVolume = Clamp (fVolume , 0.0f , 2.0f);
|
||
|
#line 210 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fPitch = Lerp (0.2f , 1.0f , Clamp (fHitStrength / 100 , 0.0f , 1.0f));
|
||
|
#line 211 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(fVolume < 0.1f){
|
||
|
#line 212 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
return ;
|
||
|
#line 213 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 214 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
CSoundObject & so = (& m_soBounce0 ) [ m_iNextChannel ];
|
||
|
#line 215 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_iNextChannel = (m_iNextChannel + 1) % 5;
|
||
|
#line 216 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
so . Set3DParameters (200.0f * m_fStretch , 100.0f * m_fStretch , fVolume , fPitch );
|
||
|
#line 217 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
PlaySound (so , SOUND_BOUNCE , SOF_3D );
|
||
|
#line 218 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
|
||
|
#line 220 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
void CRollingStone::RollSound(FLOAT fSpeed)
|
||
|
#line 221 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 222 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fHitStrength = fSpeed * fSpeed * m_fStretch * m_fStretch * m_fStretch ;
|
||
|
#line 224 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fVolume = fHitStrength / 20.0f;
|
||
|
#line 225 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
fVolume = Clamp (fVolume , 0.0f , 1.0f);
|
||
|
#line 226 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fPitch = Lerp (0.2f , 1.0f , Clamp (fHitStrength / 100 , 0.0f , 1.0f));
|
||
|
#line 227 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(fVolume < 0.1f){
|
||
|
#line 228 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(m_bRollPlaying ){
|
||
|
#line 229 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_soRoll . Stop ();
|
||
|
#line 230 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_bRollPlaying = FALSE ;
|
||
|
#line 231 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 232 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
return ;
|
||
|
#line 233 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 234 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_soRoll . Set3DParameters (200.0f * m_fStretch , 100.0f * m_fStretch , fVolume , fPitch );
|
||
|
#line 236 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(! m_bRollPlaying ){
|
||
|
#line 237 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
PlaySound (m_soRoll , SOUND_ROLL , SOF_3D | SOF_LOOP );
|
||
|
#line 238 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_bRollPlaying = TRUE ;
|
||
|
#line 239 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 240 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
BOOL CRollingStone::
|
||
|
#line 244 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
Main(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CRollingStone_Main
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CRollingStone::Main expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 247 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
InitAsModel ();
|
||
|
#line 248 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SetPhysicsFlags (EPF_ONBLOCK_BOUNCE | EPF_PUSHABLE | EPF_MOVABLE | EPF_TRANSLATEDBYGRAVITY );
|
||
|
#line 249 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SetCollisionFlags (ECF_MODEL );
|
||
|
#line 250 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SetModel (MODEL_ROLLINGSTONE );
|
||
|
#line 251 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SetModelMainTexture (TEXTURE_ROLLINGSTONE );
|
||
|
#line 252 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
AddAttachmentToModel (this , * GetModelObject () , 0 , MODEL_STONESPHERE , TEXTURE_ROLLINGSTONE , 0 , 0 , TEXTURE_DETAIL );
|
||
|
#line 254 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
GetModelObject () -> StretchModel (FLOAT3D (m_fStretch , m_fStretch , m_fStretch ));
|
||
|
#line 255 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
ModelChangeNotify ();
|
||
|
#line 257 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
en_fBounceDampNormal = m_fBounce ;
|
||
|
#line 258 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
en_fBounceDampParallel = m_fBounce ;
|
||
|
#line 259 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
en_fAcceleration = en_fDeceleration = m_fDeceleration ;
|
||
|
#line 260 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
en_fCollisionSpeedLimit = 45.0f;
|
||
|
#line 261 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
en_fCollisionDamageFactor = 10.0f;
|
||
|
#line 263 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SetPlacement (CPlacement3D (GetPlacement () . pl_PositionVector , ANGLE3D (0 , 0 , 0)));
|
||
|
#line 264 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_qA = FLOATquat3D (0 , 1 , 0 , 0);
|
||
|
#line 265 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
m_qALast = FLOATquat3D (0 , 1 , 0 , 0);
|
||
|
#line 267 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SetTimerAfter(0.1f);
|
||
|
Jump(STATE_CURRENT, 0x025c0000, FALSE, EBegin());return TRUE;}BOOL CRollingStone::H0x025c0000_Main_01(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x025c0000
|
||
|
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x025c0001, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CRollingStone::H0x025c0001_Main_02(const CEntityEvent &__eeInput){
|
||
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x025c0001
|
||
|
;
|
||
|
#line 269 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SetHealth (m_fHealth );
|
||
|
#line 270 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
AddToMovers ();
|
||
|
#line 272 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SetTimerAt(THINKTIME_NEVER);
|
||
|
Jump(STATE_CURRENT, 0x025c0002, FALSE, EBegin());return TRUE;}BOOL CRollingStone::H0x025c0002_Main_03(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x025c0002
|
||
|
switch(__eeInput.ee_slEvent){case(EVENTCODE_ETrigger):{const ETrigger&e= (ETrigger&)__eeInput;
|
||
|
|
||
|
#line 274 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D v ;
|
||
|
#line 275 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
AnglesToDirectionVector (m_vStartDir , v );
|
||
|
#line 276 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
GiveImpulseTranslationAbsolute (v * m_fStartSpeed );
|
||
|
#line 278 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
return TRUE;
|
||
|
#line 279 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}ASSERT(FALSE);break;case(EVENTCODE_ETouch):
|
||
|
#line 281 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{const ETouch&eTouch= (ETouch&)__eeInput;
|
||
|
|
||
|
#line 285 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(! m_bFixedDamage )
|
||
|
#line 286 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 287 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fDamageFactor = en_vCurrentTranslationAbsolute . Length () / 10.0f;
|
||
|
#line 288 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fAppliedDamage = fDamageFactor * m_fDamage ;
|
||
|
#line 290 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
InflictDirectDamage (eTouch . penOther , this , DMT_CANNONBALL , fAppliedDamage ,
|
||
|
#line 291 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
eTouch . penOther -> GetPlacement () . pl_PositionVector , eTouch . plCollision );
|
||
|
#line 292 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 293 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
else
|
||
|
#line 294 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 295 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(en_vCurrentTranslationAbsolute . Length () != 0.0f)
|
||
|
#line 296 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 298 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
InflictDirectDamage (eTouch . penOther , this , DMT_CANNONBALL , m_fDamage ,
|
||
|
#line 299 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
eTouch . penOther -> GetPlacement () . pl_PositionVector , eTouch . plCollision );
|
||
|
#line 300 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 301 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 304 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
AdjustSpeeds (eTouch . plCollision );
|
||
|
#line 307 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(eTouch . penOther -> GetRenderType () & RT_BRUSH )
|
||
|
#line 308 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 309 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
BounceSound (((FLOAT3D &) eTouch . plCollision ) % en_vCurrentTranslationAbsolute );
|
||
|
#line 311 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fImpactSpeed = en_vCurrentTranslationAbsolute % (- (FLOAT3D &) eTouch . plCollision );
|
||
|
#line 314 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
if(fImpactSpeed > 1000)
|
||
|
#line 315 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
{
|
||
|
#line 317 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
ReceiveDamage (eTouch . penOther , DMT_IMPACT , m_fHealth * 2.0f ,
|
||
|
#line 318 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D (0 , 0 , 0) , FLOAT3D (0 , 0 , 0));
|
||
|
#line 319 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 320 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 321 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
return TRUE;
|
||
|
#line 322 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}ASSERT(FALSE);break;case(EVENTCODE_EDeath):{const EDeath&eDeath= (EDeath&)__eeInput;
|
||
|
|
||
|
#line 324 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
SendToTarget (m_penDeathTarget , EET_TRIGGER , eDeath . eLastDamage . penInflictor );
|
||
|
#line 326 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOATaabbox3D box ;
|
||
|
#line 327 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
GetBoundingBox (box );
|
||
|
#line 328 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT fEntitySize = box . Size () . MaxNorm ();
|
||
|
#line 330 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
Debris_Begin (EIBT_ROCK , DPT_NONE , BET_NONE , fEntitySize , FLOAT3D (1.0f , 2.0f , 3.0f) , FLOAT3D (0 , 0 , 0) , 1.0f , 0.0f);
|
||
|
#line 331 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
for(INDEX iDebris = 0;iDebris < 12;iDebris ++){
|
||
|
#line 332 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
Debris_Spawn (this , this , MODEL_STONE , TEXTURE_STONE , 0 , 0 , 0 , IRnd () % 4 , 0.15f ,
|
||
|
#line 333 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
FLOAT3D (FRnd () * 0.8f + 0.1f , FRnd () * 0.8f + 0.1f , FRnd () * 0.8f + 0.1f));
|
||
|
#line 334 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}
|
||
|
#line 335 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
Destroy ();
|
||
|
#line 336 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
UnsetTimer();Jump(STATE_CURRENT,0x025c0003, FALSE, EInternal());return TRUE;
|
||
|
#line 337 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}ASSERT(FALSE);break;default: return FALSE; break;
|
||
|
#line 338 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
}return TRUE;}BOOL CRollingStone::H0x025c0003_Main_04(const CEntityEvent &__eeInput){
|
||
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT 0x025c0003
|
||
|
|
||
|
#line 341 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
Destroy ();
|
||
|
#line 343 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
Return(STATE_CURRENT,EVoid());
|
||
|
#line 343 "D:/SE1_GPL/Sources/EntitiesMP/RollingStone.es"
|
||
|
return TRUE; ASSERT(FALSE); return TRUE;};
|