summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Camera.cpp10
-rw-r--r--src/core/Camera.h1
-rw-r--r--src/core/CutsceneMgr.h2
-rw-r--r--src/core/Frontend.cpp2
-rw-r--r--src/core/PlayerInfo.cpp42
-rw-r--r--src/core/PlayerInfo.h2
-rw-r--r--src/core/PlayerSkin.cpp6
-rw-r--r--src/core/Stats.cpp3
-rw-r--r--src/core/Stats.h4
-rw-r--r--src/core/Streaming.cpp8
-rw-r--r--src/core/Wanted.cpp2
-rw-r--r--src/core/Wanted.h1
-rw-r--r--src/core/World.cpp1
-rw-r--r--src/core/World.h1
-rw-r--r--src/core/config.h5
-rw-r--r--src/core/main.cpp8
-rw-r--r--src/core/re3.cpp4
17 files changed, 87 insertions, 15 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 775ab46a..28cced53 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -1349,6 +1349,14 @@ CCamera::TakeControlWithSpline(short nSwitch)
//FindPlayerPed(); // unused
};
+void CCamera::SetCameraDirectlyInFrontForFollowPed_CamOnAString()
+{
+ m_bCamDirectlyInFront = true;
+ CPlayerPed *player = FindPlayerPed();
+ if (player)
+ m_PedOrientForBehindOrInFront = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y);
+}
+
STARTPATCHES
InjectHook(0x42C760, (bool (CCamera::*)(const CVector &center, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP);
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);
@@ -1357,6 +1365,8 @@ STARTPATCHES
InjectHook(0x46FD80, &CCamera::SetMotionBlurAlpha, PATCH_JUMP);
InjectHook(0x46F940, &CCamera::RenderMotionBlur, PATCH_JUMP);
+ InjectHook(0x46FC90, &CCamera::SetCameraDirectlyInFrontForFollowPed_CamOnAString, PATCH_JUMP);
+
InjectHook(0x456F40, WellBufferMe, PATCH_JUMP);
InjectHook(0x4582F0, &CCam::GetVectorsReadyForRW, PATCH_JUMP);
InjectHook(0x457710, &CCam::DoAverageOnVector, PATCH_JUMP);
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 0fd372c3..7d765a06 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -489,6 +489,7 @@ int m_iModeObbeCamIsInForCar;
void SetCamCutSceneOffSet(const CVector&);
void TakeControlWithSpline(short);
void RestoreWithJumpCut(void);
+ void SetCameraDirectlyInFrontForFollowPed_CamOnAString(void);
void dtor(void) { this->CCamera::~CCamera(); }
};
diff --git a/src/core/CutsceneMgr.h b/src/core/CutsceneMgr.h
index 9b942030..7215a123 100644
--- a/src/core/CutsceneMgr.h
+++ b/src/core/CutsceneMgr.h
@@ -10,7 +10,6 @@ class CCutsceneHead;
class CCutsceneMgr
{
static bool &ms_running;
- static bool &ms_cutsceneProcessing;
static CCutsceneObject *(&ms_pCutsceneObjects)[NUMCUTSCENEOBJECTS];
static int32 &ms_numCutsceneObjs;
@@ -25,6 +24,7 @@ class CCutsceneMgr
public:
static CDirectory *&ms_pCutsceneDir;
static uint32 &ms_cutsceneLoadStatus;
+ static bool &ms_cutsceneProcessing;
static bool IsRunning(void) { return ms_running; }
static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 30b80634..0be25e8a 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -997,7 +997,7 @@ void CMenuManager::DrawFrontEndNormal()
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- CRect mouse(0.0f, 0.0f, SCREEN_SCALE_X(75.0f), SCREEN_SCALE_X(75.0f));
+ CRect mouse(0.0f, 0.0f, SCREEN_SCALE_X(75.0f), SCREEN_SCALE_Y(75.0f));
mouse.Translate(m_nMousePosX, m_nMousePosY);
CRect shad = mouse;
shad.Translate(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(3.0f));
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index dc72848d..be2c0687 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -5,25 +5,32 @@
#include "Frontend.h"
#include "Vehicle.h"
#include "PlayerSkin.h"
+#include "Darkel.h"
+#include "Messages.h"
+#include "Text.h"
+#include "Stats.h"
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }
WRAPPER void CPlayerInfo::AwardMoneyForExplosion(CVehicle *vehicle) { EAXJMP(0x4A15F0); }
WRAPPER void CPlayerInfo::Process(void) { EAXJMP(0x49FD30); }
-void CPlayerInfo::SetPlayerSkin(char *skin)
+void
+CPlayerInfo::SetPlayerSkin(char *skin)
{
strncpy(m_aSkinName, skin, 32);
LoadPlayerSkin();
}
-CVector& CPlayerInfo::GetPos()
+CVector&
+CPlayerInfo::GetPos()
{
if (m_pPed->bInVehicle && m_pPed->m_pMyVehicle)
return m_pPed->m_pMyVehicle->GetPosition();
return m_pPed->GetPosition();
}
-void CPlayerInfo::LoadPlayerSkin()
+void
+CPlayerInfo::LoadPlayerSkin()
{
DeletePlayerSkin();
@@ -32,7 +39,8 @@ void CPlayerInfo::LoadPlayerSkin()
m_pSkinTexture = CPlayerSkin::GetSkinTexture(DEFAULT_SKIN_NAME);
}
-void CPlayerInfo::DeletePlayerSkin()
+void
+CPlayerInfo::DeletePlayerSkin()
{
if (m_pSkinTexture) {
RwTextureDestroy(m_pSkinTexture);
@@ -40,7 +48,33 @@ void CPlayerInfo::DeletePlayerSkin()
}
}
+void
+CPlayerInfo::KillPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_WASTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
+ CStats::TimesDied++;
+}
+
+void
+CPlayerInfo::ArrestPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_BUSTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
+ CStats::TimesArrested++;
+}
+
STARTPATCHES
InjectHook(0x4A1700, &CPlayerInfo::LoadPlayerSkin, PATCH_JUMP);
InjectHook(0x4A1750, &CPlayerInfo::DeletePlayerSkin, PATCH_JUMP);
+InjectHook(0x4A12E0, &CPlayerInfo::KillPlayer, PATCH_JUMP);
+InjectHook(0x4A1330, &CPlayerInfo::ArrestPlayer, PATCH_JUMP);
ENDPATCHES
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index f0b879ee..5784e1fb 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -73,6 +73,8 @@ public:
void SetPlayerSkin(char* skin);
CVector& GetPos();
void Process(void);
+ void KillPlayer(void);
+ void ArrestPlayer(void);
};
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
diff --git a/src/core/PlayerSkin.cpp b/src/core/PlayerSkin.cpp
index 111333ec..82427491 100644
--- a/src/core/PlayerSkin.cpp
+++ b/src/core/PlayerSkin.cpp
@@ -137,11 +137,15 @@ CPlayerSkin::RenderFrontendSkinEdit(void)
{
static float rotation = 0.0f;
RwRGBAReal AmbientColor = { 0.65f, 0.65f, 0.65f, 1.0f };
- const RwV3d pos = { 1.35f, 0.35f, 7.725f };
+ RwV3d pos = { 1.35f, 0.35f, 7.725f };
const RwV3d axis1 = { 1.0f, 0.0f, 0.0f };
const RwV3d axis2 = { 0.0f, 0.0f, 1.0f };
static uint32 LastFlash = 0;
+#ifdef ASPECT_RATIO_SCALE
+ pos.x = 1.35f * (SCREEN_ASPECT_RATIO / DEFAULT_ASPECT_RATIO);
+#endif
+
RwFrame *frame = RpClumpGetFrame(gpPlayerClump);
if (CTimer::GetTimeInMillisecondsPauseMode() - LastFlash > 7) {
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index d4d91dac..9641e8f0 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -9,6 +9,9 @@ int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64;
int32 *CStats::PedsKilledOfThisType = (int32*)0x880DBC;
+int32 &CStats::TimesDied = *(int32*)0x8E2BDC;
+int32 &CStats::TimesArrested = *(int32*)0x8E2BEC;
+int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C;
void CStats::AnotherKillFrenzyPassed()
{
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 53c40ca3..7bae8c51 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -11,7 +11,11 @@ public:
static int32 &PeopleKilledByOthers;
static int32 &HelisDestroyed;
static int32 *PedsKilledOfThisType; //[NUM_PEDTYPES]
+ static int32 &TimesDied;
+ static int32 &TimesArrested;
+ static int32 &KillsSinceLastCheckpoint;
public:
static void AnotherKillFrenzyPassed();
+ static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; };
}; \ No newline at end of file
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 227a4a9f..e59b2b39 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1021,7 +1021,7 @@ CStreaming::RemoveAllUnusedModels(void)
for(i = 0; i < MAXVEHICLESLOADED; i++)
RemoveLoadedVehicle();
- for(i = NUMDEFAULTMODELS; i < MODELINFOSIZE; i++){
+ for(i = NUM_DEFAULT_MODELS; i < MODELINFOSIZE; i++){
if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED &&
ms_aInfoForModel[i].m_flags & STREAMFLAGS_DONT_REMOVE &&
CModelInfo::GetModelInfo(i)->m_refCount == 0){
@@ -2405,8 +2405,8 @@ CStreaming::MemoryCardSave(uint8 *buffer, uint32 *length)
{
int i;
- *length = NUMDEFAULTMODELS;
- for(i = 0; i < NUMDEFAULTMODELS; i++)
+ *length = NUM_DEFAULT_MODELS;
+ for(i = 0; i < NUM_DEFAULT_MODELS; i++)
if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED)
buffer[i] = ms_aInfoForModel[i].m_flags;
else
@@ -2418,7 +2418,7 @@ CStreaming::MemoryCardLoad(uint8 *buffer, uint32 length)
{
uint32 i;
- assert(length == NUMDEFAULTMODELS);
+ assert(length == NUM_DEFAULT_MODELS);
for(i = 0; i < length; i++)
if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED)
if(buffer[i] != 0xFF)
diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp
index 26b115e3..bafe0ae1 100644
--- a/src/core/Wanted.cpp
+++ b/src/core/Wanted.cpp
@@ -12,6 +12,8 @@
int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714; // 6
int32 &CWanted::nMaximumWantedLevel = *(int32*)0x5F7718; // 6400
+WRAPPER void CWanted::Reset() { EAXJMP(0x4AD790) };
+
void
CWanted::Initialise()
{
diff --git a/src/core/Wanted.h b/src/core/Wanted.h
index 34a4b58d..1303365d 100644
--- a/src/core/Wanted.h
+++ b/src/core/Wanted.h
@@ -76,6 +76,7 @@ public:
bool AddCrimeToQ(eCrimeType type, int32 id, const CVector &pos, bool reported, bool policeDoesntCare);
void ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesntCare);
void UpdateWantedLevel();
+ void Reset();
bool IsIgnored(void) { return m_bIgnoredByCops || m_bIgnoredByEveryone; }
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 1598967a..3a8367f1 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -41,6 +41,7 @@ bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA;
WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); }
WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); }
WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); }
+WRAPPER void CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8) { EAXJMP(0x4B4E70) };
void
CWorld::Initialise()
diff --git a/src/core/World.h b/src/core/World.h
index 523585e7..f420207c 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -85,6 +85,7 @@ public:
}
}
static void ClearScanCodes(void);
+ static void ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8);
static bool CameraToIgnoreThisObject(CEntity *ent);
diff --git a/src/core/config.h b/src/core/config.h
index cfad6d85..a3fbac1b 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -32,7 +32,6 @@ enum Config {
NUMDUMMIES = 2802, // 2368 on PS2
NUMAUDIOSCRIPTOBJECTS = 256,
NUMCUTSCENEOBJECTS = 50,
- NUMDEFAULTMODELS = 200,
NUMTEMPOBJECTS = 30,
@@ -84,7 +83,9 @@ enum Config {
NUM_PATH_NODES_IN_AUTOPILOT = 8,
NUM_ACCIDENTS = 20,
- NUM_FIRES = 40
+ NUM_FIRES = 40,
+
+ NUMPEDROUTES = 200,
};
// We'll use this once we're ready to become independent of the game
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 50494ef3..8985d56a 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -199,7 +199,11 @@ Idle(void *arg)
Render2dStuff();
}else{
float viewWindow = DEFAULT_VIEWWINDOW;
+#ifdef ASPECT_RATIO_SCALE
+ CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
+#else
CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
+#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@@ -234,7 +238,11 @@ FrontendIdle(void)
return;
float viewWindow = DEFAULT_VIEWWINDOW;
+#ifdef ASPECT_RATIO_SCALE
+ CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
+#else
CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
+#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 19b3c691..b9b5c76e 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -146,7 +146,7 @@ LetThemFollowYou(void) {
CPed *nearPed = player->m_nearPeds[i];
if (nearPed && !nearPed->IsPlayer()) {
nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
- nearPed->m_pedFormation = rand() & 7;
+ nearPed->m_pedFormation = (eFormation)(1 + (rand() & 7));
nearPed->bScriptObjectiveCompleted = false;
}
}
@@ -349,7 +349,7 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
- DebugMenuAddCmd("Debug", "Make peds around you follow you", LetThemFollowYou);
+ DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou);
#ifndef MASTER
DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil);
#endif