summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/re3.cpp6
-rw-r--r--src/peds/Ped.cpp94
-rw-r--r--src/peds/PedRoutes.cpp2
-rw-r--r--src/peds/PedStats.cpp1
-rw-r--r--src/peds/PedType.cpp2
-rw-r--r--src/peds/PedType.h2
-rw-r--r--src/render/Clouds.cpp14
-rw-r--r--src/render/Clouds.h12
-rw-r--r--src/render/Console.cpp2
-rw-r--r--src/render/Console.h2
-rw-r--r--src/render/Coronas.cpp16
-rw-r--r--src/render/Coronas.h16
12 files changed, 102 insertions, 67 deletions
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index ecf02f39..2046a7f9 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -350,6 +350,9 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Draw hud", (int8*)&CHud::m_Wants_To_Draw_Hud, nil);
DebugMenuAddVarBool8("Debug", "Edit on", (int8*)&CSceneEdit::m_bEditOn, nil);
+#ifdef MENU_MAP
+ DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
+#endif
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
@@ -374,9 +377,6 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
-#ifdef MENU_MAP
- DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
-#endif
#ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 412b1f04..8ea41230 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -1623,6 +1623,15 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
if (ped->IsPlayer())
AudioManager.PlayerJustLeftCar();
+#ifdef VC_PED_PORTS
+ if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) {
+ dragAssoc->SetDeleteCallback(PedSetDraggedOutCarPositionCB, ped);
+ ped->m_fHealth = 0.0f;
+ ped->SetDie(ANIM_FLOOR_HIT, 1000.0f, 0.5f);
+ return;
+ }
+#endif
+
if (quickJackedAssoc) {
dragAssoc->SetDeleteCallback(PedSetQuickDraggedOutCarPositionCB, ped);
} else {
@@ -5186,7 +5195,7 @@ CPed::SetFall(int extraTime, AnimationId animId, uint8 evenIfNotInControl)
}
if (extraTime == -1) {
- m_getUpTimer = -1;
+ m_getUpTimer = UINT32_MAX;
} else if (fallAssoc) {
if (IsPlayer()) {
m_getUpTimer = 1000.0f * fallAssoc->hierarchy->totalLength
@@ -6448,7 +6457,7 @@ CPed::ExitCar(void)
void
CPed::Fall(void)
{
- if (m_getUpTimer != -1 && CTimer::GetTimeInMilliseconds() > m_getUpTimer
+ if (m_getUpTimer != UINT32_MAX && CTimer::GetTimeInMilliseconds() > m_getUpTimer
#ifdef VC_PED_PORTS
&& bIsStanding
#endif
@@ -10663,7 +10672,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
return;
if (ped->EnteringCar()) {
- bool isLow = veh->bLowVehicle;
+ bool isLow = !!veh->bLowVehicle;
if (!veh->bIsBus)
veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_CLOSEDOOR_LHS, 1.0f);
@@ -10691,7 +10700,11 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
#endif
|| !veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, nil))))) {
- if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
+ if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER
+#ifdef VC_PED_PORTS
+ || ped->m_nPedState == PED_CARJACK
+#endif
+ )
veh->bIsBeingCarJacked = false;
ped->m_objective = OBJECTIVE_ENTER_CAR_AS_PASSENGER;
@@ -11027,9 +11040,9 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
PedSetInCarCB(nil, ped);
return;
}
- bool isVan = veh->bIsVan;
- bool isBus = veh->bIsBus;
- bool isLow = veh->bLowVehicle;
+ bool isVan = !!veh->bIsVan;
+ bool isBus = !!veh->bIsBus;
+ bool isLow = !!veh->bLowVehicle;
eDoors enterDoor;
switch (ped->m_vehEnterType) {
case CAR_DOOR_RF:
@@ -11144,7 +11157,7 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
if (!ped->IsNotInWreckedVehicle())
return;
- bool isLow = veh->bLowVehicle;
+ bool isLow = !!veh->bLowVehicle;
int padNo;
if (ped->IsPlayer()) {
@@ -11426,7 +11439,9 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
CMatrix pedMat(ped->GetMatrix());
CVector posAfterBeingDragged = Multiply3x3(pedMat, (itsRearDoor ? -vecPedDraggedOutCarAnimOffset : vecPedDraggedOutCarAnimOffset));
posAfterBeingDragged += ped->GetPosition();
+#ifndef VC_PED_PORTS
posAfterBeingDragged.z += 1.0f;
+#endif
CPedPlacement::FindZCoorForPed(&posAfterBeingDragged);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
ped->GetPosition() = posAfterBeingDragged;
@@ -11476,17 +11491,26 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
&& ped->m_pMyVehicle->VehicleCreatedBy != MISSION_VEHICLE && driver
&& driver->IsPlayer() && !CTheScripts::IsPlayerOnAMission()) {
+#ifndef VC_PED_PORTS
if (CGeneral::GetRandomNumber() & 1)
ped->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, driver);
else
+#endif
ped->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, ped->m_pMyVehicle);
} else {
- ped->m_nPedState = PED_NONE;
- ped->m_nLastPedState = PED_NONE;
- ped->SetFlee(ped->m_pMyVehicle->GetPosition(), 10000);
- ped->bUsePedNodeSeek = true;
- ped->m_pNextPathNode = nil;
+#ifdef VC_PED_PORTS
+ if (ped->m_pedStats->m_temper > ped->m_pedStats->m_fear && ped->CharCreatedBy != MISSION_CHAR
+ && ped->m_pMyVehicle->VehicleCreatedBy != MISSION_VEHICLE && !driver
+ && FindPlayerPed()->m_carInObjective == ped->m_pMyVehicle && !CTheScripts::IsPlayerOnAMission())
+ ped->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, ped->m_pMyVehicle);
+ else
+#endif
+ {
+ ped->m_nPedState = PED_NONE;
+ ped->m_nLastPedState = PED_NONE;
+ ped->SetFindPathAndFlee(ped->m_pMyVehicle->GetPosition(), 10000);
+ }
}
ped->SetGetUp();
}
@@ -12289,24 +12313,36 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void
ped->Say(SOUND_PED_FLEE_RUN);
}
} else {
- if (ped->m_pedStats->m_temper <= ped->m_pedStats->m_fear
- || ped->CharCreatedBy == MISSION_CHAR || veh->VehicleCreatedBy == MISSION_VEHICLE
- || !veh->pDriver || !veh->pDriver->IsPlayer()
- || CTheScripts::IsPlayerOnAMission()) {
+ if (ped->m_pedStats->m_temper > ped->m_pedStats->m_fear
+ && ped->CharCreatedBy != MISSION_CHAR && veh->VehicleCreatedBy != MISSION_VEHICLE
+ && veh->pDriver && veh->pDriver->IsPlayer()
+ && !CTheScripts::IsPlayerOnAMission()) {
- ped->SetFlee(veh->GetPosition(), 10000);
- ped->bUsePedNodeSeek = true;
- ped->m_pNextPathNode = nil;
- if (CGeneral::GetRandomNumber() & 1 || ped->m_pedStats->m_fear > 70) {
- ped->SetMoveState(PEDMOVE_SPRINT);
- ped->Say(SOUND_PED_FLEE_SPRINT);
- } else {
- ped->Say(SOUND_PED_FLEE_RUN);
+#ifndef VC_PED_PORTS
+ if (CGeneral::GetRandomNumber() < MYRAND_MAX / 2) {
+ ped->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, veh->pDriver);
+ } else
+#endif
+ ped->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, veh);
+
+ } else {
+#ifdef VC_PED_PORTS
+ if (ped->m_pedStats->m_temper > ped->m_pedStats->m_fear && ped->CharCreatedBy != MISSION_CHAR
+ && ped->m_pMyVehicle->VehicleCreatedBy != MISSION_VEHICLE && !veh->pDriver
+ && FindPlayerPed()->m_carInObjective == ped->m_pMyVehicle && !CTheScripts::IsPlayerOnAMission())
+ ped->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, veh);
+ else
+#endif
+ {
+ ped->SetFindPathAndFlee(veh->GetPosition(), 10000);
+ if (CGeneral::GetRandomNumber() & 1 || ped->m_pedStats->m_fear > 70) {
+ ped->SetMoveState(PEDMOVE_SPRINT);
+ ped->Say(SOUND_PED_FLEE_SPRINT);
+ } else {
+ ped->Say(SOUND_PED_FLEE_RUN);
+ }
}
- } else if (CGeneral::GetRandomNumber() < 0x3FFF) {
- ped->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, veh->pDriver);
- } else
- ped->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, veh);
+ }
}
}
if (ped->m_nLastPedState == PED_IDLE)
diff --git a/src/peds/PedRoutes.cpp b/src/peds/PedRoutes.cpp
index 3bc17002..b6512edd 100644
--- a/src/peds/PedRoutes.cpp
+++ b/src/peds/PedRoutes.cpp
@@ -3,7 +3,7 @@
#include "main.h"
#include "PedRoutes.h"
-CRouteNode (&gaRoutes)[NUMPEDROUTES] = *(CRouteNode(*)[NUMPEDROUTES]) * (uintptr*)0x62E090;
+CRouteNode gaRoutes[NUMPEDROUTES];
void
CRouteNode::Initialise()
diff --git a/src/peds/PedStats.cpp b/src/peds/PedStats.cpp
index 147f11e2..a2ccb567 100644
--- a/src/peds/PedStats.cpp
+++ b/src/peds/PedStats.cpp
@@ -4,7 +4,6 @@
#include "FileMgr.h"
#include "PedStats.h"
-//CPedStats *(&CPedStats::ms_apPedStats)[NUM_PEDSTATS] = *(CPedStats *(*)[NUM_PEDSTATS]) *(uintptr*)0x9404D4;
CPedStats *CPedStats::ms_apPedStats[NUM_PEDSTATS];
void
diff --git a/src/peds/PedType.cpp b/src/peds/PedType.cpp
index 4c9d6b3f..30af6dcc 100644
--- a/src/peds/PedType.cpp
+++ b/src/peds/PedType.cpp
@@ -3,7 +3,7 @@
#include "FileMgr.h"
#include "PedType.h"
-CPedType *(&CPedType::ms_apPedType)[NUM_PEDTYPES] = *(CPedType *(*)[NUM_PEDTYPES]) *(uintptr*)0x941594;
+CPedType *CPedType::ms_apPedType[NUM_PEDTYPES];
void
CPedType::Initialise(void)
diff --git a/src/peds/PedType.h b/src/peds/PedType.h
index 3d927df5..c0c72550 100644
--- a/src/peds/PedType.h
+++ b/src/peds/PedType.h
@@ -71,7 +71,7 @@ class CPedType
uint32 m_threats;
uint32 m_avoid;
- static CPedType *(&ms_apPedType)[NUM_PEDTYPES];
+ static CPedType *ms_apPedType[NUM_PEDTYPES];
public:
static void Initialise(void);
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index 7debe3d3..02035896 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -16,15 +16,15 @@
#define SMALLSTRIPHEIGHT 4.0f
#define HORIZSTRIPHEIGHT 48.0f
-RwTexture **gpCloudTex = (RwTexture**)0x9411C0; //[5];
+RwTexture *gpCloudTex[5];
-float &CClouds::CloudRotation = *(float*)0x8F5F40;
-uint32 &CClouds::IndividualRotation = *(uint32*)0x943078;
+float CClouds::CloudRotation;
+uint32 CClouds::IndividualRotation;
-float &CClouds::ms_cameraRoll = *(float*)0x8F29CC;
-float &CClouds::ms_horizonZ = *(float*)0x8F31C0;
-CRGBA &CClouds::ms_colourTop = *(CRGBA*)0x94143C;
-CRGBA &CClouds::ms_colourBottom = *(CRGBA*)0x8F2C38;
+float CClouds::ms_cameraRoll;
+float CClouds::ms_horizonZ;
+CRGBA CClouds::ms_colourTop;
+CRGBA CClouds::ms_colourBottom;
void
CClouds::Init(void)
diff --git a/src/render/Clouds.h b/src/render/Clouds.h
index c8000569..4d8cd2c8 100644
--- a/src/render/Clouds.h
+++ b/src/render/Clouds.h
@@ -3,13 +3,13 @@
class CClouds
{
public:
- static float &CloudRotation;
- static uint32 &IndividualRotation;
+ static float CloudRotation;
+ static uint32 IndividualRotation;
- static float &ms_cameraRoll;
- static float &ms_horizonZ;
- static CRGBA &ms_colourTop;
- static CRGBA &ms_colourBottom;
+ static float ms_cameraRoll;
+ static float ms_horizonZ;
+ static CRGBA ms_colourTop;
+ static CRGBA ms_colourBottom;
static void Init(void);
static void Shutdown(void);
diff --git a/src/render/Console.cpp b/src/render/Console.cpp
index 545122b0..bfdb2701 100644
--- a/src/render/Console.cpp
+++ b/src/render/Console.cpp
@@ -9,7 +9,7 @@
#define CONSOLE_Y_POS (10.0f)
#define CONSOLE_LINE_HEIGHT (12.0f)
-CConsole &TheConsole = *(CConsole*)0x8F6498;
+CConsole TheConsole;
void
CConsole::AddLine(char *s, uint8 r, uint8 g, uint8 b)
diff --git a/src/render/Console.h b/src/render/Console.h
index c454d75e..b4fa60c4 100644
--- a/src/render/Console.h
+++ b/src/render/Console.h
@@ -22,4 +22,4 @@ public:
void Init() { m_nCurrentLine = 0; m_nLineCount = 0; }
};
-extern CConsole &TheConsole;
+extern CConsole TheConsole;
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index 68994b0b..d70f70d6 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -48,16 +48,16 @@ FlareDef HeadLightsFlareDef[] = {
};
-RwTexture **gpCoronaTexture = (RwTexture**)0x5FAF44; //[9]
+RwTexture *gpCoronaTexture[9] = { nil, nil, nil, nil, nil, nil, nil, nil, nil };
-float &CCoronas::LightsMult = *(float*)0x5FB088; // 1.0
-float &CCoronas::SunScreenX = *(float*)0x8F4358;
-float &CCoronas::SunScreenY = *(float*)0x8F4354;
-bool &CCoronas::bSmallMoon = *(bool*)0x95CD49;
-bool &CCoronas::SunBlockedByClouds = *(bool*)0x95CD73;
-int &CCoronas::bChangeBrightnessImmediately = *(int*)0x8E2C30;
+float CCoronas::LightsMult = 1.0f;
+float CCoronas::SunScreenX;
+float CCoronas::SunScreenY;
+bool CCoronas::bSmallMoon;
+bool CCoronas::SunBlockedByClouds;
+int CCoronas::bChangeBrightnessImmediately;
-CRegisteredCorona *CCoronas::aCoronas = (CRegisteredCorona*)0x72E518;
+CRegisteredCorona CCoronas::aCoronas[NUMCORONAS];
const char aCoronaSpriteNames[][32] = {
"coronastar",
diff --git a/src/render/Coronas.h b/src/render/Coronas.h
index 359a34ed..4b49e40e 100644
--- a/src/render/Coronas.h
+++ b/src/render/Coronas.h
@@ -1,6 +1,6 @@
#pragma once
-extern RwTexture **gpCoronaTexture; //[9]
+extern RwTexture *gpCoronaTexture[9];
struct CRegisteredCorona
{
@@ -42,7 +42,7 @@ static_assert(sizeof(CRegisteredCorona) == 0x80, "CRegisteredCorona: error");
class CCoronas
{
- static CRegisteredCorona *aCoronas; //[NUMCORONAS];
+ static CRegisteredCorona aCoronas[NUMCORONAS];
public:
enum {
SUN_CORE = 1,
@@ -77,12 +77,12 @@ public:
STREAK_ON,
};
- static float &LightsMult;
- static float &SunScreenY;
- static float &SunScreenX;
- static bool &bSmallMoon;
- static bool &SunBlockedByClouds;
- static int &bChangeBrightnessImmediately;
+ static float LightsMult;
+ static float SunScreenY;
+ static float SunScreenX;
+ static bool bSmallMoon;
+ static bool SunBlockedByClouds;
+ static int bChangeBrightnessImmediately;
static void Init(void);
static void Shutdown(void);