summaryrefslogtreecommitdiffstats
path: root/src
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
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 '')
-rw-r--r--src/core/config.h2
-rw-r--r--src/vehicles/Plane.cpp42
-rw-r--r--src/vehicles/Plane.h9
3 files changed, 52 insertions, 1 deletions
diff --git a/src/core/config.h b/src/core/config.h
index 14489491..ef2c9b17 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -273,7 +273,7 @@ enum Config {
// Vehicles
#define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher
-//#define REMOVE_TREADABLE_PATHFIND
+#define CPLANE_ROTORS // make the rotors of the NPC police heli rotate
// Pickups
//#define MONEY_MESSAGES
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
diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h
index 5fb05468..c8f02048 100644
--- a/src/vehicles/Plane.h
+++ b/src/vehicles/Plane.h
@@ -4,6 +4,11 @@
enum ePlaneNodes
{
+#ifdef CPLANE_ROTORS
+ // for heli
+ PLANE_TOPROTOR,
+ PLANE_BACKROTOR,
+#endif
PLANE_WHEEL_FRONT = 2,
PLANE_WHEEL_READ,
NUM_PLANE_NODES
@@ -29,6 +34,10 @@ struct CPlaneInterpolationLine
class CPlane : public CVehicle
{
public:
+#ifdef CPLANE_ROTORS
+ RwFrame *m_aPlaneNodes[NUM_PLANE_NODES];
+ float m_fRotorRotation;
+#endif
int16 m_nPlaneId;
int16 m_isFarAway;
int16 m_nCurPathNode;