summaryrefslogtreecommitdiffstats
path: root/src/vehicles/Plane.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-07-21 09:58:53 +0200
committeraap <aap@papnet.eu>2020-07-21 09:58:53 +0200
commit0fba76a5652b3d9c4a3ecb809a601208fceed11d (patch)
tree9017fb0f2e69e1512d9c7dd35c8f6c28c6ec9dd5 /src/vehicles/Plane.cpp
parentfixed COcclusion (diff)
downloadre3-0fba76a5652b3d9c4a3ecb809a601208fceed11d.tar
re3-0fba76a5652b3d9c4a3ecb809a601208fceed11d.tar.gz
re3-0fba76a5652b3d9c4a3ecb809a601208fceed11d.tar.bz2
re3-0fba76a5652b3d9c4a3ecb809a601208fceed11d.tar.lz
re3-0fba76a5652b3d9c4a3ecb809a601208fceed11d.tar.xz
re3-0fba76a5652b3d9c4a3ecb809a601208fceed11d.tar.zst
re3-0fba76a5652b3d9c4a3ecb809a601208fceed11d.zip
Diffstat (limited to 'src/vehicles/Plane.cpp')
-rw-r--r--src/vehicles/Plane.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp
index a3754854..ffe9ffbf 100644
--- a/src/vehicles/Plane.cpp
+++ b/src/vehicles/Plane.cpp
@@ -16,6 +16,7 @@
#include "Fluff.h"
#include "World.h"
#include "HandlingMgr.h"
+#include "Heli.h"
#include "Plane.h"
//--MIAMI: file done
@@ -88,6 +89,9 @@ CPlane::CPlane(int32 id, uint8 CreatedBy)
m_level = LEVEL_GENERIC;
m_isFarAway = false;
+#ifdef CPLANE_ROTORS
+ m_fRotorRotation = 0.0f;
+#endif
}
CPlane::~CPlane()
@@ -99,6 +103,21 @@ void
CPlane::SetModelIndex(uint32 id)
{
CVehicle::SetModelIndex(id);
+#ifdef CPLANE_ROTORS
+ int i;
+ for(i = 0; i < NUM_PLANE_NODES; i++)
+ m_aPlaneNodes[i] = nil;
+ if(GetModelIndex() == MI_CHOPPER){
+ // This is surprisingly annoying...
+ RwFrame *heliNodes[NUM_HELI_NODES];
+ for(i = 0; i < NUM_HELI_NODES; i++)
+ heliNodes[i] = nil;
+ CClumpModelInfo::FillFrameArray(GetClump(), heliNodes);
+ m_aPlaneNodes[PLANE_TOPROTOR] = heliNodes[HELI_TOPROTOR];
+ m_aPlaneNodes[PLANE_BACKROTOR] = heliNodes[HELI_BACKROTOR];
+ }else
+ CClumpModelInfo::FillFrameArray(GetClump(), m_aPlaneNodes);
+#endif
}
void
@@ -629,6 +648,29 @@ CPlane::PreRender(void)
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
}
+
+#ifdef CPLANE_ROTORS
+ CMatrix mat;
+ CVector pos;
+ m_fRotorRotation += 3.14f/6.5f;
+ if(m_fRotorRotation > 6.28f)
+ m_fRotorRotation -= 6.28f;
+
+ if(m_aPlaneNodes[PLANE_TOPROTOR]){
+ mat.Attach(RwFrameGetMatrix(m_aPlaneNodes[PLANE_TOPROTOR]));
+ pos = mat.GetPosition();
+ mat.SetRotateZ(m_fRotorRotation);
+ mat.Translate(pos);
+ mat.UpdateRW();
+ }
+ if(m_aPlaneNodes[PLANE_BACKROTOR]){
+ mat.Attach(RwFrameGetMatrix(m_aPlaneNodes[PLANE_BACKROTOR]));
+ pos = mat.GetPosition();
+ mat.SetRotateX(m_fRotorRotation);
+ mat.Translate(pos);
+ mat.UpdateRW();
+ }
+#endif
}
void