mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-27 03:24:15 +01:00
implemented CHeli
This commit is contained in:
parent
3b9b0646b8
commit
a3e3527a3b
@ -7,8 +7,10 @@ bool& CStats::CommercialPassed = *(bool*)0x8F4334;
|
||||
bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
|
||||
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
|
||||
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
|
||||
int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64;
|
||||
int32 *CStats::PedsKilledOfThisType = (int32*)0x880DBC;
|
||||
|
||||
void CStats::AnotherKillFrenzyPassed()
|
||||
{
|
||||
++NumberKillFrenziesPassed;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ public:
|
||||
static bool& IndustrialPassed;
|
||||
static int32 &NumberKillFrenziesPassed;
|
||||
static int32 &PeopleKilledByOthers;
|
||||
static int32 &HelisDestroyed;
|
||||
static int32 *PedsKilledOfThisType; //[NUM_PEDTYPES]
|
||||
|
||||
public:
|
||||
static void AnotherKillFrenzyPassed();
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
void ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesntCare);
|
||||
void UpdateWantedLevel();
|
||||
|
||||
bool IsIgnored(void) { return m_bIgnoredByCops || m_bIgnoredByEveryone; }
|
||||
|
||||
static int32 WorkOutPolicePresence(CVector posn, float radius);
|
||||
static void SetMaximumWantedLevel(int32 level);
|
||||
};
|
||||
|
@ -646,7 +646,7 @@ CWorld::FindObjectsInRange(CVector ¢re, float distance, bool ignoreZ, short
|
||||
}
|
||||
|
||||
CEntity*
|
||||
CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity* entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
|
||||
CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
|
||||
{
|
||||
CEntity* foundE = nil;
|
||||
|
||||
|
@ -95,8 +95,8 @@ public:
|
||||
static bool GetIsLineOfSightSectorClear(CSector §or, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
|
||||
static bool GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
|
||||
|
||||
static CEntity* TestSphereAgainstWorld(CVector, float, CEntity*, bool, bool, bool, bool, bool, bool);
|
||||
static CEntity* TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
|
||||
static CEntity *TestSphereAgainstWorld(CVector centre, float distance, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects);
|
||||
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
|
||||
static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
|
||||
static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
|
||||
static float FindGroundZForCoord(float x, float y);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "Streaming.h"
|
||||
#include "PathFind.h"
|
||||
#include "Boat.h"
|
||||
#include "Heli.h"
|
||||
#include "Automobile.h"
|
||||
#include "debugmenu_public.h"
|
||||
|
||||
@ -318,6 +319,12 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
|
||||
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "Catalina Heli On", (int8*)&CHeli::CatalinaHeliOn, nil);
|
||||
DebugMenuAddCmd("Debug", "Catalina Fly By", CHeli::StartCatalinaFlyBy);
|
||||
DebugMenuAddCmd("Debug", "Catalina Take Off", CHeli::CatalinaTakeOff);
|
||||
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
|
||||
DebugMenuAddVarBool8("Debug", "Script Heli On", (int8*)0x95CD43, nil);
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
|
||||
@ -347,29 +354,6 @@ delayedPatches10(int a, int b)
|
||||
}
|
||||
*/
|
||||
|
||||
void __declspec(naked) HeadlightsFix()
|
||||
{
|
||||
static const float fMinusOne = -1.0f;
|
||||
_asm
|
||||
{
|
||||
fld [esp+708h-690h]
|
||||
fcomp fMinusOne
|
||||
fnstsw ax
|
||||
and ah, 5
|
||||
cmp ah, 1
|
||||
jnz HeadlightsFix_DontLimit
|
||||
fld fMinusOne
|
||||
fstp [esp+708h-690h]
|
||||
|
||||
HeadlightsFix_DontLimit:
|
||||
fld [esp+708h-690h]
|
||||
fabs
|
||||
fld st
|
||||
push 0x5382F2
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
const int re3_buffsize = 1024;
|
||||
static char re3_buff[re3_buffsize];
|
||||
|
||||
@ -454,10 +438,6 @@ patch()
|
||||
InjectHook(0x475E00, printf, PATCH_JUMP); // _Error
|
||||
|
||||
|
||||
// stolen from silentpatch (sorry)
|
||||
Patch<WORD>(0x5382BF, 0x0EEB);
|
||||
InjectHook(0x5382EC, HeadlightsFix, PATCH_JUMP);
|
||||
|
||||
// InterceptCall(&open_script_orig, open_script, 0x438869);
|
||||
|
||||
// InterceptCall(&RsEventHandler_orig, delayedPatches10, 0x58275E);
|
||||
|
@ -20,6 +20,29 @@ public:
|
||||
}else
|
||||
x = 0.0f;
|
||||
}
|
||||
const CVector2D &operator+=(CVector2D const &right) {
|
||||
x += right.x;
|
||||
y += right.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CVector2D &operator-=(CVector2D const &right) {
|
||||
x -= right.x;
|
||||
y -= right.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CVector2D &operator*=(float right) {
|
||||
x *= right;
|
||||
y *= right;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CVector2D &operator/=(float right) {
|
||||
x /= right;
|
||||
y /= right;
|
||||
return *this;
|
||||
}
|
||||
CVector2D operator-(const CVector2D &rhs) const {
|
||||
return CVector2D(x-rhs.x, y-rhs.y);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "Automobile.h"
|
||||
#include "Train.h"
|
||||
#include "Plane.h"
|
||||
#include "Heli.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "ModelInfo.h"
|
||||
|
||||
@ -98,13 +99,13 @@ RwObjectNameIdAssocation trainIds[] = {
|
||||
};
|
||||
|
||||
RwObjectNameIdAssocation heliIds[] = {
|
||||
{ "chassis_dummy", 1, VEHICLE_FLAG_COLLAPSE },
|
||||
{ "toprotor", 2, 0 },
|
||||
{ "backrotor", 3, 0 },
|
||||
{ "tail", 4, 0 },
|
||||
{ "topknot", 5, 0 },
|
||||
{ "skid_left", 6, 0 },
|
||||
{ "skid_right", 7, 0 },
|
||||
{ "chassis_dummy", HELI_CHASSIS, VEHICLE_FLAG_COLLAPSE },
|
||||
{ "toprotor", HELI_TOPROTOR, 0 },
|
||||
{ "backrotor", HELI_BACKROTOR, 0 },
|
||||
{ "tail", HELI_TAIL, 0 },
|
||||
{ "topknot", HELI_TOPKNOT, 0 },
|
||||
{ "skid_left", HELI_SKID_LEFT, 0 },
|
||||
{ "skid_right", HELI_SKID_RIGHT, 0 },
|
||||
{ nil, 0, 0 }
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,15 +2,98 @@
|
||||
|
||||
#include "Vehicle.h"
|
||||
|
||||
class CObject;
|
||||
|
||||
enum eHeliNodes
|
||||
{
|
||||
HELI_CHASSIS = 1,
|
||||
HELI_TOPROTOR,
|
||||
HELI_BACKROTOR,
|
||||
HELI_TAIL,
|
||||
HELI_TOPKNOT,
|
||||
HELI_SKID_LEFT,
|
||||
HELI_SKID_RIGHT,
|
||||
NUM_HELI_NODES
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HELI_RANDOM0,
|
||||
HELI_RANDOM1,
|
||||
HELI_SCRIPT,
|
||||
HELI_CATALINA,
|
||||
NUM_HELIS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HELI_TYPE_RANDOM,
|
||||
HELI_TYPE_SCRIPT,
|
||||
HELI_TYPE_CATALINA,
|
||||
};
|
||||
|
||||
|
||||
class CHeli : public CVehicle
|
||||
{
|
||||
public:
|
||||
// 0x288
|
||||
uint8 stuff[180];
|
||||
RwFrame *m_aHeliNodes[NUM_HELI_NODES];
|
||||
int8 m_heliStatus;
|
||||
float m_fSearchLightX;
|
||||
float m_fSearchLightY;
|
||||
uint32 m_nExplosionTimer;
|
||||
float m_fRotation;
|
||||
float m_fAngularSpeed;
|
||||
float m_fTargetZ;
|
||||
float m_fSearchLightIntensity;
|
||||
int8 m_nHeliId;
|
||||
int8 m_heliType;
|
||||
int8 m_pathState;
|
||||
float m_aSearchLightHistoryX[6];
|
||||
float m_aSearchLightHistoryY[6];
|
||||
uint32 m_nSearchLightTimer;
|
||||
uint32 m_nShootTimer;
|
||||
uint32 m_nLastShotTime;
|
||||
uint32 m_nBulletDamage;
|
||||
float m_fRotorRotation;
|
||||
float m_fHeliDustZ[8];
|
||||
uint32 m_nPoliceShoutTimer;
|
||||
float m_fTargetOffset;
|
||||
bool m_bTestRight;
|
||||
|
||||
CHeli(int, uint8);
|
||||
static CHeli **pHelis; //[NUM_HELIS]
|
||||
static int16 &NumRandomHelis;
|
||||
static uint32 &TestForNewRandomHelisTimer;
|
||||
static int16 NumScriptHelis; // unused
|
||||
static bool &CatalinaHeliOn;
|
||||
static bool &CatalinaHasBeenShotDown;
|
||||
static bool &ScriptHeliOn;
|
||||
|
||||
CHeli(int32 id, uint8 CreatedBy);
|
||||
CHeli* ctor(int, uint8);
|
||||
|
||||
// from CEntity
|
||||
void SetModelIndex(uint32 id);
|
||||
void ProcessControl(void);
|
||||
void PreRender(void);
|
||||
void Render(void);
|
||||
|
||||
void PreRenderAlways(void);
|
||||
CObject *SpawnFlyingComponent(int32 component);
|
||||
|
||||
static void InitHelis(void);
|
||||
static void UpdateHelis(void);
|
||||
static void SpecialHeliPreRender(void);
|
||||
static bool TestRocketCollision(CVector *coors);
|
||||
static bool TestBulletCollision(CVector *line0, CVector *line1, CVector *bulletPos, int32 damage);
|
||||
|
||||
static void StartCatalinaFlyBy(void);
|
||||
static void RemoveCatalinaHeli(void);
|
||||
static CHeli *FindPointerToCatalinasHeli(void);
|
||||
static void CatalinaTakeOff(void);
|
||||
static void MakeCatalinaHeliFlyAway(void);
|
||||
static bool HasCatalinaBeenShotDown(void);
|
||||
|
||||
static void ActivateHeli(bool activate);
|
||||
};
|
||||
static_assert(sizeof(CHeli) == 0x33C, "CHeli: error");
|
||||
|
@ -137,15 +137,16 @@ CPlane::ProcessControl(void)
|
||||
colors[6] = CRGBA(0, 0, 0, 255);
|
||||
colors[7] = CRGBA(224, 230, 238, 255);
|
||||
|
||||
CVector dir;
|
||||
for(i = 0; i < 40; i++){
|
||||
int rotSpeed = CGeneral::GetRandomNumberInRange(30.0f, 20.0f);
|
||||
dir.x = CGeneral::GetRandomNumberInRange(-2.0f, 2.0f);
|
||||
dir.y = CGeneral::GetRandomNumberInRange(-2.0f, 2.0f);
|
||||
dir.z = CGeneral::GetRandomNumberInRange(0.0f, 2.0f);
|
||||
int rotSpeed = CGeneral::GetRandomNumberInRange(10, 30);
|
||||
if(CGeneral::GetRandomNumber() & 1)
|
||||
rotSpeed = -rotSpeed;
|
||||
int f = ++nFrameGen & 3;
|
||||
CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f),
|
||||
CVector(CGeneral::GetRandomNumberInRange(-2.0f, 2.0f),
|
||||
CGeneral::GetRandomNumberInRange(-2.0f, 2.0f),
|
||||
CGeneral::GetRandomNumberInRange(0.0f, 2.0f)),
|
||||
CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f), dir,
|
||||
nil, CGeneral::GetRandomNumberInRange(0.1f, 1.0f),
|
||||
colors[nFrameGen], rotSpeed, 0, f, 0);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ CTrain::SetModelIndex(uint32 id)
|
||||
int i;
|
||||
|
||||
CVehicle::SetModelIndex(id);
|
||||
for(i = 0; i < 3; i++)
|
||||
for(i = 0; i < NUM_TRAIN_NODES; i++)
|
||||
m_aTrainNodes[i] = nil;
|
||||
CClumpModelInfo::FillFrameArray(GetClump(), m_aTrainNodes);
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ enum
|
||||
enum eTrainNodes
|
||||
{
|
||||
TRAIN_DOOR_LHS = 1,
|
||||
TRAIN_DOOR_RHS
|
||||
TRAIN_DOOR_RHS,
|
||||
NUM_TRAIN_NODES
|
||||
};
|
||||
|
||||
enum eTrainPositions
|
||||
@ -66,7 +67,7 @@ public:
|
||||
uint32 m_nDoorTimer;
|
||||
int16 m_nDoorState;
|
||||
CTrainDoor Doors[2];
|
||||
RwFrame *m_aTrainNodes[3];
|
||||
RwFrame *m_aTrainNodes[NUM_TRAIN_NODES];
|
||||
|
||||
// unused
|
||||
static CVector aStationCoors[3];
|
||||
|
@ -30,6 +30,9 @@ void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehicleP
|
||||
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
|
||||
void CVehicle::operator delete(void *p, int handle) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
|
||||
|
||||
// or Weapon.cpp?
|
||||
WRAPPER void FireOneInstantHitRound(CVector *shotSource, CVector *shotTarget, int32 damage) { EAXJMP(0x563B00); }
|
||||
|
||||
CVehicle::CVehicle(uint8 CreatedBy)
|
||||
{
|
||||
int i;
|
||||
|
@ -106,6 +106,9 @@ enum eFlightModel
|
||||
FLIGHT_MODEL_SEAPLANE
|
||||
};
|
||||
|
||||
// Or Weapon.h?
|
||||
void FireOneInstantHitRound(CVector *shotSource, CVector *shotTarget, int32 damage);
|
||||
|
||||
class CVehicle : public CPhysical
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user