summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2019-07-24 20:00:08 +0200
committerGitHub <noreply@github.com>2019-07-24 20:00:08 +0200
commit81ee1c509a8d05189901dd59c268bf47a6188eb8 (patch)
treed836f70678f2ce7b5d86a6745f34b45232ff71d0 /src/core
parentupdate (diff)
parentMerge branch 'master' into master (diff)
downloadre3-81ee1c509a8d05189901dd59c268bf47a6188eb8.tar
re3-81ee1c509a8d05189901dd59c268bf47a6188eb8.tar.gz
re3-81ee1c509a8d05189901dd59c268bf47a6188eb8.tar.bz2
re3-81ee1c509a8d05189901dd59c268bf47a6188eb8.tar.lz
re3-81ee1c509a8d05189901dd59c268bf47a6188eb8.tar.xz
re3-81ee1c509a8d05189901dd59c268bf47a6188eb8.tar.zst
re3-81ee1c509a8d05189901dd59c268bf47a6188eb8.zip
Diffstat (limited to '')
-rw-r--r--src/core/Camera.cpp10
-rw-r--r--src/core/Camera.h5
-rw-r--r--src/core/Clock.cpp7
-rw-r--r--src/core/Clock.h2
-rw-r--r--src/core/Collision.cpp243
-rw-r--r--src/core/EventList.cpp238
-rw-r--r--src/core/EventList.h67
-rw-r--r--src/core/FileLoader.cpp8
-rw-r--r--src/core/Frontend.cpp636
-rw-r--r--src/core/Frontend.h51
-rw-r--r--src/core/General.h16
-rw-r--r--src/core/MenuScreens.h118
-rw-r--r--src/core/Messages.cpp5
-rw-r--r--src/core/Messages.h5
-rw-r--r--src/core/Pad.cpp70
-rw-r--r--src/core/Pad.h31
-rw-r--r--src/core/Pools.cpp10
-rw-r--r--src/core/Pools.h11
-rw-r--r--src/core/Stats.cpp1
-rw-r--r--src/core/Stats.h1
-rw-r--r--src/core/Streaming.cpp2
-rw-r--r--src/core/SurfaceTable.h2
-rw-r--r--src/core/Wanted.cpp306
-rw-r--r--src/core/Wanted.h73
-rw-r--r--src/core/World.cpp163
-rw-r--r--src/core/World.h4
-rw-r--r--src/core/common.h16
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp2
-rw-r--r--src/core/main.h3
-rw-r--r--src/core/re3.cpp127
31 files changed, 1644 insertions, 590 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 166928c1..a66d6ac9 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -23,7 +23,7 @@ WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); }
WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); }
WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); }
WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); }
-WRAPPER void CCamera::CamShake(float) { EAXJMP(0x46B100); }
+WRAPPER void CamShakeNoPos(CCamera*, float) { EAXJMP(0x46B100); }
bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
@@ -95,6 +95,14 @@ CCamera::GetLookDirection(void)
return LOOKING_FORWARD;;
}
+bool
+CCamera::GetLookingForwardFirstPerson()
+{
+ return Cams[ActiveCam].Mode == CCam::MODE_FIRSTPERSON &&
+ Cams[ActiveCam].DirectionWasLooking == LOOKING_FORWARD;
+}
+
+
WRAPPER void CCamera::Fade(float timeout, int16 direction) { EAXJMP(0x46B3A0); }
WRAPPER void CCamera::ProcessFade(void) { EAXJMP(0x46F080); }
WRAPPER void CCamera::ProcessMusicFade(void) { EAXJMP(0x46F1E0); }
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 84af9d55..1a2aae79 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -441,6 +441,7 @@ int m_iModeObbeCamIsInForCar;
static bool &m_bUseMouse3rdPerson;
+ bool Get_Just_Switched_Status() { return m_bJust_Switched; }
inline const CMatrix GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
bool IsPointVisible(const CVector &center, const CMatrix *mat);
@@ -448,6 +449,7 @@ int m_iModeObbeCamIsInForCar;
bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
int GetLookDirection(void);
+ bool GetLookingForwardFirstPerson(void);
void Fade(float timeout, int16 direction);
int GetScreenFadeStatus(void);
@@ -466,7 +468,6 @@ int m_iModeObbeCamIsInForCar;
void DrawBordersForWideScreen(void);
void Restore(void);
void SetWidescreenOff(void);
- void CamShake(float);
void dtor(void) { this->CCamera::~CCamera(); }
};
@@ -479,3 +480,5 @@ static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error");
static_assert(offsetof(CCamera, Cams) == 0x1A4, "CCamera: error");
static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
extern CCamera &TheCamera;
+
+void CamShakeNoPos(CCamera*, float);
diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp
index 707b0e57..a97dcb5f 100644
--- a/src/core/Clock.cpp
+++ b/src/core/Clock.cpp
@@ -15,7 +15,7 @@ uint8 &CClock::ms_Stored_nGameClockHours = *(uint8*)0x95CD7B;
uint8 &CClock::ms_Stored_nGameClockMinutes = *(uint8*)0x95CD9B;
uint16 &CClock::ms_Stored_nGameClockSeconds = *(uint16*)0x95CC9C;
uint32 &CClock::ms_nMillisecondsPerGameMinute = *(uint32*)0x8F2C64;
-int32 &CClock::ms_nLastClockTick = *(int32*)0x9430E4;
+uint32 &CClock::ms_nLastClockTick = *(uint32*)0x9430E4;
bool &CClock::ms_bClockHasBeenStored = *(bool*)0x95CD82;
void
@@ -67,10 +67,7 @@ CClock::Update(void)
}
}
}
- ms_nGameClockSeconds +=
- 60
- * (CTimer::GetTimeInMilliseconds() - ms_nLastClockTick)
- / ms_nMillisecondsPerGameMinute;
+ ms_nGameClockSeconds = 60 * (CTimer::GetTimeInMilliseconds() - ms_nLastClockTick) / ms_nMillisecondsPerGameMinute;
}
void
diff --git a/src/core/Clock.h b/src/core/Clock.h
index e11b2293..ea4263bd 100644
--- a/src/core/Clock.h
+++ b/src/core/Clock.h
@@ -9,7 +9,7 @@ class CClock
static uint8 &ms_Stored_nGameClockMinutes;
static uint16 &ms_Stored_nGameClockSeconds;
static uint32 &ms_nMillisecondsPerGameMinute;
- static int32 &ms_nLastClockTick;
+ static uint32 &ms_nLastClockTick;
static bool &ms_bClockHasBeenStored;
public:
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index 1ed08867..7982e77d 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -18,6 +18,7 @@
#include "CutsceneMgr.h"
#include "RenderBuffer.h"
#include "SurfaceTable.h"
+#include "Lines.h"
#include "Collision.h"
enum Direction
@@ -1356,6 +1357,7 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin
void
CCollision::CalculateTrianglePlanes(CColModel *model)
{
+ assert(model);
if(model->numTriangles == 0)
return;
@@ -1366,7 +1368,6 @@ CCollision::CalculateTrianglePlanes(CColModel *model)
lptr->Remove();
ms_colModelCache.head.Insert(lptr);
}else{
- assert(model);
lptr = ms_colModelCache.Insert(model);
if(lptr == nil){
// make room if we have to, remove last in list
@@ -1387,6 +1388,223 @@ CCollision::CalculateTrianglePlanes(CColModel *model)
void
CCollision::DrawColModel(const CMatrix &mat, const CColModel &colModel)
{
+ int i;
+ CVector min, max;
+ CVector verts[8];
+ CVector c;
+ float r;
+
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
+
+ min = colModel.boundingBox.min;
+ max = colModel.boundingBox.max;
+
+ verts[0] = mat * CVector(min.x, min.y, min.z);
+ verts[1] = mat * CVector(min.x, min.y, max.z);
+ verts[2] = mat * CVector(min.x, max.y, min.z);
+ verts[3] = mat * CVector(min.x, max.y, max.z);
+ verts[4] = mat * CVector(max.x, min.y, min.z);
+ verts[5] = mat * CVector(max.x, min.y, max.z);
+ verts[6] = mat * CVector(max.x, max.y, min.z);
+ verts[7] = mat * CVector(max.x, max.y, max.z);
+
+ CLines::RenderLineWithClipping(
+ verts[0].x, verts[0].y, verts[0].z,
+ verts[1].x, verts[1].y, verts[1].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[1].x, verts[1].y, verts[1].z,
+ verts[3].x, verts[3].y, verts[3].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[3].x, verts[3].y, verts[3].z,
+ verts[2].x, verts[2].y, verts[2].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[2].x, verts[2].y, verts[2].z,
+ verts[0].x, verts[0].y, verts[0].z,
+ 0xFF0000FF, 0xFF0000FF);
+
+ CLines::RenderLineWithClipping(
+ verts[4].x, verts[4].y, verts[4].z,
+ verts[5].x, verts[5].y, verts[5].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[5].x, verts[5].y, verts[5].z,
+ verts[7].x, verts[7].y, verts[7].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[7].x, verts[7].y, verts[7].z,
+ verts[6].x, verts[6].y, verts[6].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[6].x, verts[6].y, verts[6].z,
+ verts[4].x, verts[4].y, verts[4].z,
+ 0xFF0000FF, 0xFF0000FF);
+
+ CLines::RenderLineWithClipping(
+ verts[0].x, verts[0].y, verts[0].z,
+ verts[4].x, verts[4].y, verts[4].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[1].x, verts[1].y, verts[1].z,
+ verts[5].x, verts[5].y, verts[5].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[2].x, verts[2].y, verts[2].z,
+ verts[6].x, verts[6].y, verts[6].z,
+ 0xFF0000FF, 0xFF0000FF);
+ CLines::RenderLineWithClipping(
+ verts[3].x, verts[3].y, verts[3].z,
+ verts[7].x, verts[7].y, verts[7].z,
+ 0xFF0000FF, 0xFF0000FF);
+
+ for(i = 0; i < colModel.numSpheres; i++){
+ c = mat * colModel.spheres[i].center;
+ r = colModel.spheres[i].radius;
+
+ CLines::RenderLineWithClipping(
+ c.x, c.y, c.z-r,
+ c.x-r, c.y-r, c.z,
+ 0xFF00FFFF, 0xFF00FFFF);
+ CLines::RenderLineWithClipping(
+ c.x, c.y, c.z-r,
+ c.x-r, c.y+r, c.z,
+ 0xFF00FFFF, 0xFF00FFFF);
+ CLines::RenderLineWithClipping(
+ c.x, c.y, c.z-r,
+ c.x+r, c.y-r, c.z,
+ 0xFF00FFFF, 0xFF00FFFF);
+ CLines::RenderLineWithClipping(
+ c.x, c.y, c.z-r,
+ c.x+r, c.y+r, c.z,
+ 0xFF00FFFF, 0xFF00FFFF);
+ CLines::RenderLineWithClipping(
+ c.x-r, c.y-r, c.z,
+ c.x, c.y, c.z+r,
+ 0xFF00FFFF, 0xFF00FFFF);
+ CLines::RenderLineWithClipping(
+ c.x-r, c.y+r, c.z,
+ c.x, c.y, c.z+r,
+ 0xFF00FFFF, 0xFF00FFFF);
+ CLines::RenderLineWithClipping(
+ c.x+r, c.y-r, c.z,
+ c.x, c.y, c.z+r,
+ 0xFF00FFFF, 0xFF00FFFF);
+ CLines::RenderLineWithClipping(
+ c.x+r, c.y+r, c.z,
+ c.x, c.y, c.z+r,
+ 0xFF00FFFF, 0xFF00FFFF);
+ }
+
+ for(i = 0; i < colModel.numLines; i++){
+ verts[0] = colModel.lines[i].p0;
+ verts[1] = colModel.lines[i].p1;
+
+ verts[0] = mat * verts[0];
+ verts[1] = mat * verts[1];
+
+ CLines::RenderLineWithClipping(
+ verts[0].x, verts[0].y, verts[0].z,
+ verts[1].x, verts[1].y, verts[1].z,
+ 0x00FFFFFF, 0x00FFFFFF);
+ }
+
+ for(i = 0; i < colModel.numBoxes; i++){
+ min = colModel.boxes[i].min;
+ max = colModel.boxes[i].max;
+
+ verts[0] = mat * CVector(min.x, min.y, min.z);
+ verts[1] = mat * CVector(min.x, min.y, max.z);
+ verts[2] = mat * CVector(min.x, max.y, min.z);
+ verts[3] = mat * CVector(min.x, max.y, max.z);
+ verts[4] = mat * CVector(max.x, min.y, min.z);
+ verts[5] = mat * CVector(max.x, min.y, max.z);
+ verts[6] = mat * CVector(max.x, max.y, min.z);
+ verts[7] = mat * CVector(max.x, max.y, max.z);
+
+ CLines::RenderLineWithClipping(
+ verts[0].x, verts[0].y, verts[0].z,
+ verts[1].x, verts[1].y, verts[1].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[1].x, verts[1].y, verts[1].z,
+ verts[3].x, verts[3].y, verts[3].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[3].x, verts[3].y, verts[3].z,
+ verts[2].x, verts[2].y, verts[2].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[2].x, verts[2].y, verts[2].z,
+ verts[0].x, verts[0].y, verts[0].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ CLines::RenderLineWithClipping(
+ verts[4].x, verts[4].y, verts[4].z,
+ verts[5].x, verts[5].y, verts[5].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[5].x, verts[5].y, verts[5].z,
+ verts[7].x, verts[7].y, verts[7].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[7].x, verts[7].y, verts[7].z,
+ verts[6].x, verts[6].y, verts[6].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[6].x, verts[6].y, verts[6].z,
+ verts[4].x, verts[4].y, verts[4].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ CLines::RenderLineWithClipping(
+ verts[0].x, verts[0].y, verts[0].z,
+ verts[4].x, verts[4].y, verts[4].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[1].x, verts[1].y, verts[1].z,
+ verts[5].x, verts[5].y, verts[5].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[2].x, verts[2].y, verts[2].z,
+ verts[6].x, verts[6].y, verts[6].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(
+ verts[3].x, verts[3].y, verts[3].z,
+ verts[7].x, verts[7].y, verts[7].z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ }
+
+ for(i = 0; i < colModel.numTriangles; i++){
+ colModel.GetTrianglePoint(verts[0], colModel.triangles[i].a);
+ colModel.GetTrianglePoint(verts[1], colModel.triangles[i].b);
+ colModel.GetTrianglePoint(verts[2], colModel.triangles[i].c);
+ verts[0] = mat * verts[0];
+ verts[1] = mat * verts[1];
+ verts[2] = mat * verts[2];
+ CLines::RenderLineWithClipping(
+ verts[0].x, verts[0].y, verts[0].z,
+ verts[1].x, verts[1].y, verts[1].z,
+ 0x00FF00FF, 0x00FF00FF);
+ CLines::RenderLineWithClipping(
+ verts[0].x, verts[0].y, verts[0].z,
+ verts[2].x, verts[2].y, verts[2].z,
+ 0x00FF00FF, 0x00FF00FF);
+ CLines::RenderLineWithClipping(
+ verts[1].x, verts[1].y, verts[1].z,
+ verts[2].x, verts[2].y, verts[2].z,
+ 0x00FF00FF, 0x00FF00FF);
+ }
+
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
}
void
@@ -1407,7 +1625,6 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
-extern int gDbgSurf;
for(i = 0; i < colModel.numTriangles; i++){
colModel.GetTrianglePoint(verts[0], colModel.triangles[i].a);
@@ -1417,7 +1634,7 @@ extern int gDbgSurf;
verts[1] = mat * verts[1];
verts[2] = mat * verts[2];
- // TODO: surface
+ // game doesn't do this
r = 255;
g = 128;
b = 0;
@@ -1457,10 +1674,15 @@ extern int gDbgSurf;
b *= f;
}
- // TODO: make some surface types flicker?
-//if(s != gDbgSurf) continue;
+ if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
+ s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
+ if(CTimer::GetFrameCounter() & 1){
+ r = 0;
+ g = 0;
+ b = 0;
+ }
- if(s > SURFACE_32){
+ if(s > SURFACE_GATE){
r = CGeneral::GetRandomNumber();
g = CGeneral::GetRandomNumber();
b = CGeneral::GetRandomNumber();
@@ -1533,8 +1755,13 @@ extern int gDbgSurf;
b *= f;
}
- // TODO: make some surface types flicker?
-//if(s != gDbgSurf) continue;
+ if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
+ s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
+ if(CTimer::GetFrameCounter() & 1){
+ r = 0;
+ g = 0;
+ b = 0;
+ }
RenderBuffer::StartStoring(36, 8, &iptr, &vptr);
RwIm3DVertexSetRGBA(&vptr[0], r, g, b, 255);
diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp
new file mode 100644
index 00000000..a833cc8e
--- /dev/null
+++ b/src/core/EventList.cpp
@@ -0,0 +1,238 @@
+#include "common.h"
+#include "patcher.h"
+#include "Pools.h"
+#include "ModelIndices.h"
+#include "World.h"
+#include "Wanted.h"
+#include "Eventlist.h"
+
+int32 CEventList::ms_nFirstFreeSlotIndex;
+//CEvent gaEvent[NUMEVENTS];
+CEvent *gaEvent = (CEvent*)0x6EF830;
+
+enum
+{
+ EVENT_STATE_0,
+ EVENT_STATE_CANDELETE,
+ EVENT_STATE_CLEAR,
+};
+
+void
+CEventList::Initialise(void)
+{
+ int i;
+
+ debug("Initialising CEventList...");
+ for(i = 0; i < NUMEVENTS; i++){
+ gaEvent[i].type = EVENT_NULL;
+ gaEvent[i].entityType = EVENT_ENTITY_NONE;
+ gaEvent[i].entityRef = 0;
+ gaEvent[i].posn.x = 0.0f;
+ gaEvent[i].posn.y = 0.0f;
+ gaEvent[i].posn.z = 0.0f;
+ gaEvent[i].timeout = 0;
+ gaEvent[i].state = EVENT_STATE_0;
+ }
+ ms_nFirstFreeSlotIndex = 0;
+}
+
+void
+CEventList::Update(void)
+{
+ int i;
+
+ ms_nFirstFreeSlotIndex = 0;
+ for(i = 0; i < NUMEVENTS; i++){
+ if(gaEvent[i].type == EVENT_NULL)
+ continue;
+ if(CTimer::GetTimeInMilliseconds() > gaEvent[i].timeout || gaEvent[i].state == EVENT_STATE_CANDELETE){
+ gaEvent[i].type = EVENT_NULL;
+ gaEvent[i].state = EVENT_STATE_0;
+ }
+ if(gaEvent[i].state == EVENT_STATE_CLEAR)
+ gaEvent[i].state = EVENT_STATE_CANDELETE;
+ }
+}
+
+void
+CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent, CPed *criminal, int32 timeout)
+{
+ int i;
+ int ref;
+ bool copsDontCare;
+
+ copsDontCare = false;
+ switch(entityType){
+ case EVENT_ENTITY_PED:
+ ref = CPools::GetPedRef((CPed*)ent);
+ if(ent->GetModelIndex() >= MI_GANG01 && ent->GetModelIndex() <= MI_CRIMINAL02)
+ copsDontCare = true;
+ break;
+ case EVENT_ENTITY_VEHICLE:
+ ref = CPools::GetVehicleRef((CVehicle*)ent);
+ break;
+ case EVENT_ENTITY_OBJECT:
+ ref = CPools::GetObjectRef((CObject*)ent);
+ break;
+ default:
+ Error("Undefined entity type, RegisterEvent, EventList.cpp");
+ ref = 0;
+ break;
+ }
+
+ // only update time if event exists already
+ for(i = 0; i < NUMEVENTS; i++)
+ if(gaEvent[i].type == type &&
+ gaEvent[i].entityType == entityType &&
+ gaEvent[i].entityRef == ref){
+ gaEvent[i].timeout = CTimer::GetTimeInMilliseconds() + timeout;
+ return;
+ }
+
+ for(i = ms_nFirstFreeSlotIndex; i < NUMEVENTS; i++)
+ if(gaEvent[i].type == EVENT_NULL){
+ ms_nFirstFreeSlotIndex = i;
+ break;
+ }
+ if(i < NUMEVENTS){
+ gaEvent[i].type = type;
+ gaEvent[i].entityType = entityType;
+ gaEvent[i].timeout = CTimer::GetTimeInMilliseconds() + timeout;
+ gaEvent[i].entityRef = ref;
+ gaEvent[i].posn = ent->GetPosition();
+ gaEvent[i].criminal = criminal;
+ if(gaEvent[i].criminal)
+ gaEvent[i].criminal->RegisterReference((CEntity**)&gaEvent[i].criminal);
+ if(type == EVENT_GUNSHOT)
+ gaEvent[i].state = EVENT_STATE_CLEAR;
+ else
+ gaEvent[i].state = EVENT_STATE_0;
+ }
+
+ if(criminal == FindPlayerPed())
+ ReportCrimeForEvent(type, (uintptr)ent, copsDontCare);
+}
+
+void
+CEventList::RegisterEvent(eEventType type, CVector posn, int32 timeout)
+{
+ int i;
+
+ // only update time if event exists already
+ for(i = 0; i < NUMEVENTS; i++)
+ if(gaEvent[i].type == type &&
+ gaEvent[i].posn.x == posn.x &&
+ gaEvent[i].posn.y == posn.y &&
+ gaEvent[i].posn.z == posn.z &&
+ gaEvent[i].entityType == EVENT_ENTITY_NONE){
+ gaEvent[i].timeout = CTimer::GetTimeInMilliseconds() + timeout;
+ return;
+ }
+
+ for(i = ms_nFirstFreeSlotIndex; i < NUMEVENTS; i++)
+ if(gaEvent[i].type == EVENT_NULL){
+ ms_nFirstFreeSlotIndex = i;
+ break;
+ }
+ if(i < NUMEVENTS){
+ gaEvent[i].type = type;
+ gaEvent[i].entityType = EVENT_ENTITY_NONE;
+ gaEvent[i].timeout = CTimer::GetTimeInMilliseconds() + timeout;
+ gaEvent[i].posn = posn;
+ gaEvent[i].entityRef = 0;
+ if(type == EVENT_GUNSHOT)
+ gaEvent[i].state = EVENT_STATE_CLEAR;
+ else
+ gaEvent[i].state = EVENT_STATE_0;
+ }
+}
+
+bool
+CEventList::GetEvent(eEventType type, int32 *event)
+{
+ int i;
+ for(i = 0; i < NUMEVENTS; i++)
+ if(gaEvent[i].type == type){
+ *event = i;
+ return true;
+ }
+ return false;
+}
+
+void
+CEventList::ClearEvent(int32 event)
+{
+ if(gaEvent[event].state != EVENT_STATE_CANDELETE)
+ gaEvent[event].state = EVENT_STATE_CLEAR;
+}
+
+bool
+CEventList::FindClosestEvent(eEventType type, CVector posn, int32 *event)
+{
+ int i;
+ float dist;
+ bool found = false;
+ float mindist = 60.0f;
+
+ for(i = 0; i < NUMEVENTS; i++){
+ if(gaEvent[i].type != type)
+ continue;
+ dist = (posn - gaEvent[i].posn).Magnitude();
+ if(dist < mindist){
+ mindist = dist;
+ found = true;
+ *event = i;
+ }
+ }
+ return found;
+}
+
+void
+CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCare)
+{
+ eCrimeType crime;
+ switch(type){
+ case EVENT_ASSAULT: crime = CRIME_HIT_PED; break;
+ case EVENT_RUN_REDLIGHT: crime = CRIME_RUN_REDLIGHT; break;
+ case EVENT_ASSAULT_POLICE: crime = CRIME_HIT_COP; break;
+ case EVENT_GUNSHOT: crime = CRIME_POSSESSION_GUN; break;
+ case EVENT_STEAL_CAR: crime = CRIME_STEAL_CAR; break;
+ case EVENT_HIT_AND_RUN: crime = CRIME_RUNOVER_PED; break;
+ case EVENT_HIT_AND_RUN_COP: crime = CRIME_RUNOVER_COP; break;
+ case EVENT_SHOOT_PED: crime = CRIME_SHOOT_PED; break;
+ case EVENT_SHOOT_COP: crime = CRIME_SHOOT_COP; break;
+ case EVENT_PED_SET_ON_FIRE: crime = CRIME_PED_BURNED; break;
+ case EVENT_COP_SET_ON_FIRE: crime = CRIME_COP_BURNED; break;
+ case EVENT_CAR_SET_ON_FIRE: crime = CRIME_VEHICLE_BURNED; break;
+ default: crime = CRIME_NONE; break;
+ }
+
+ if(crime == CRIME_NONE)
+ return;
+
+ CVector playerPedCoors = FindPlayerPed()->GetPosition();
+ CVector playerCoors = FindPlayerCoors();
+
+ if(CWanted::WorkOutPolicePresence(playerCoors, 14.0f) != 0){
+ FindPlayerPed()->m_pWanted->RegisterCrime_Immediately(crime, playerPedCoors, crimeId, copsDontCare);
+ FindPlayerPed()->m_pWanted->SetWantedLevelNoDrop(1);
+ }else
+ FindPlayerPed()->m_pWanted->RegisterCrime(crime, playerPedCoors, crimeId, copsDontCare);
+
+ if(type == EVENT_ASSAULT_POLICE)
+ FindPlayerPed()->SetWantedLevelNoDrop(1);
+ if(type == EVENT_SHOOT_COP)
+ FindPlayerPed()->SetWantedLevelNoDrop(2);
+
+}
+
+STARTPATCHES
+ InjectHook(0x475B60, CEventList::Initialise, PATCH_JUMP);
+ InjectHook(0x475BE0, CEventList::Update, PATCH_JUMP);
+ InjectHook(0x475C50, (void (*)(eEventType,eEventEntity,CEntity *,CPed *,int32))CEventList::RegisterEvent, PATCH_JUMP);
+ InjectHook(0x475E10, (void (*)(eEventType,CVector,int32))CEventList::RegisterEvent, PATCH_JUMP);
+ InjectHook(0x475F40, CEventList::GetEvent, PATCH_JUMP);
+ InjectHook(0x475F70, CEventList::ClearEvent, PATCH_JUMP);
+ InjectHook(0x475F90, CEventList::FindClosestEvent, PATCH_JUMP);
+ InjectHook(0x476070, CEventList::ReportCrimeForEvent, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/core/EventList.h b/src/core/EventList.h
new file mode 100644
index 00000000..9f5756be
--- /dev/null
+++ b/src/core/EventList.h
@@ -0,0 +1,67 @@
+#pragma once
+
+class CEntity;
+class CPed;
+
+enum eEventType
+{
+ EVENT_NULL,
+ EVENT_ASSAULT,
+ EVENT_RUN_REDLIGHT,
+ EVENT_ASSAULT_POLICE,
+ EVENT_GUNSHOT,
+ EVENT_INJURED_PED,
+ EVENT_DEAD_PED,
+ EVENT_FIRE,
+ EVENT_STEAL_CAR,
+ EVENT_HIT_AND_RUN,
+ EVENT_HIT_AND_RUN_COP,
+ EVENT_SHOOT_PED,
+ EVENT_SHOOT_COP,
+ EVENT_EXPLOSION,
+ EVENT_PED_SET_ON_FIRE,
+ EVENT_COP_SET_ON_FIRE,
+ EVENT_CAR_SET_ON_FIRE,
+ EVENT_ASSAULT_NASTYWEAPON,
+ EVENT_ASSAULT_NASTYWEAPON_POLICE,
+ EVENT_ICECREAM,
+ EVENT_ATM,
+ EVENT_SHOPSTALL,
+ EVENT_SHOPWINDOW,
+ EVENT_LAST_EVENT
+};
+
+enum eEventEntity
+{
+ EVENT_ENTITY_NONE,
+ EVENT_ENTITY_PED,
+ EVENT_ENTITY_VEHICLE,
+ EVENT_ENTITY_OBJECT
+};
+
+struct CEvent
+{
+ eEventType type;
+ eEventEntity entityType;
+ int32 entityRef;
+ CPed *criminal;
+ CVector posn;
+ uint32 timeout;
+ int32 state;
+};
+
+class CEventList
+{
+ static int32 ms_nFirstFreeSlotIndex;
+public:
+ static void Initialise(void);
+ static void Update(void);
+ static void RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent, CPed *criminal, int32 timeout);
+ static void RegisterEvent(eEventType type, CVector posn, int32 timeout);
+ static bool GetEvent(eEventType type, int32 *event);
+ static void ClearEvent(int32 event);
+ static bool FindClosestEvent(eEventType type, CVector posn, int32 *event);
+ static void ReportCrimeForEvent(eEventType type, int32, bool);
+};
+
+extern CEvent *gaEvent; \ No newline at end of file
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index 0c53ae66..14dc91cd 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -1,7 +1,7 @@
#include "common.h"
#include "main.h"
#include "patcher.h"
-#include "math/Quaternion.h"
+#include "Quaternion.h"
#include "ModelInfo.h"
#include "ModelIndices.h"
#include "TempColModels.h"
@@ -361,10 +361,10 @@ CFileLoader::LoadClumpFile(const char *filename)
nodename = GetFrameNodeName(RpClumpGetFrame(clump));
GetNameAndLOD(nodename, name, &n);
mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(name, nil);
- assert(mi->IsClump());
- if(mi)
+ if(mi){
+ assert(mi->IsClump());
mi->SetClump(clump);
- else
+ }else
RpClumpDestroy(clump);
}
}
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 77666b12..1de5c94f 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -26,46 +26,47 @@
#include "PlayerSkin.h"
#include "PlayerInfo.h"
#include "World.h"
+#include "Renderer.h"
#define ALL_ORIGINAL_FRONTEND 1
-int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78;
+int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78; // 9
int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
int8 &CMenuManager::m_DisplayControllerOnFoot = *(int8*)0x95CD8D;
-int8 &CMenuManager::m_PrefsVsync = *(int8*)0x5F2E58;
-int8 &CMenuManager::m_PrefsVsyncDisp = *(int8*)0x5F2E5C;
-int8 &CMenuManager::m_PrefsFrameLimiter = *(int8*)0x5F2E60;
-int8 &CMenuManager::m_PrefsShowSubtitles = *(int8*)0x5F2E54;
+int8 &CMenuManager::m_PrefsVsync = *(int8*)0x5F2E58; // 1
+int8 &CMenuManager::m_PrefsVsyncDisp = *(int8*)0x5F2E5C; // 1
+int8 &CMenuManager::m_PrefsFrameLimiter = *(int8*)0x5F2E60; // 1
+int8 &CMenuManager::m_PrefsShowSubtitles = *(int8*)0x5F2E54; // 1
int8 &CMenuManager::m_PrefsSpeakers = *(int8*)0x95CD7E;
-int8 &CMenuManager::m_ControlMethod = *(int8*)0x8F5F7C;
-int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74;
-int8 &CMenuManager::m_PrefsLanguage = *(int8*)0x941238;
+int32 &CMenuManager::m_ControlMethod = *(int32*)0x8F5F7C;
+int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74; // 1
+int32 &CMenuManager::m_PrefsLanguage = *(int32*)0x941238;
-bool &CMenuManager::m_PrefsAllowNastyGame = *(bool*)0x5F2E64;
+bool &CMenuManager::m_PrefsAllowNastyGame = *(bool*)0x5F2E64; // true
bool &CMenuManager::m_bStartUpFrontEndRequested = *(bool*)0x95CCF4;
bool &CMenuManager::m_bShutDownFrontEndRequested = *(bool*)0x95CD6A;
int8 &CMenuManager::m_PrefsUseWideScreen = *(int8*)0x95CD23;
int8 &CMenuManager::m_PrefsRadioStation = *(int8*)0x95CDA4;
-int8 &CMenuManager::m_bDisableMouseSteering = *(int8*)0x60252C;
-int32 &CMenuManager::m_PrefsBrightness = *(int32*)0x5F2E50;
+int8 &CMenuManager::m_bDisableMouseSteering = *(int8*)0x60252C; // 1
+int32 &CMenuManager::m_PrefsBrightness = *(int32*)0x5F2E50; // 256
float &CMenuManager::m_PrefsLOD = *(float*)0x8F42C4;
int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC;
-int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C;
-int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48;
+int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C; // 102
+int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48; // 102
-char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74;
+char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74; //[256] "$$\"\""
-int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70;
+int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70; // -1
CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
// Move this somewhere else.
-float lodMultiplier = *(float*)0x5F726C;
+float &CRenderer::ms_lodDistScale = *(float*)0x5F726C; // 1.2
// Stuff not in CMenuManager:
uint32 &VibrationTime = *(uint32*)0x628CF8;
-char* pEditString = (char*)0x628D00;
+char *&pEditString = *(char**)0x628D00;
int32 *&pControlEdit = *(int32**)0x628D08;
bool &DisplayComboButtonErrMsg = *(bool*)0x628D14;
int32 &MouseButtonJustClicked = *(int32*)0x628D0C;
@@ -74,7 +75,6 @@ int32 &nTimeForSomething = *(int32*)0x628D54;
//int32 *pControlTemp = 0;
// Frontend inputs.
-
bool GetPadBack();
bool GetPadExitEnter();
bool GetPadForward();
@@ -149,7 +149,7 @@ char *MenuFilenames[] = {
nil, nil
};
-#if ALL_ORIGINAL_FRONTEND
+#if 0
WRAPPER void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2) { EAXJMP(0x483870); }
#else
void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2)
@@ -177,7 +177,7 @@ void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* st
}
#endif
-#if ALL_ORIGINAL_FRONTEND
+#if 0
WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); }
#else
void CMenuManager::CentreMousePointer()
@@ -205,7 +205,7 @@ void CMenuManager::CheckCodesForControls(int, int)
}
#endif
-#if ALL_ORIGINAL_FRONTEND
+#if 0
WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); }
#else
bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
@@ -217,74 +217,35 @@ bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
void CMenuManager::CheckSliderMovement(int value)
{
- float fBrightness = 0.0f;
- float fDrawDistance = 0.0f;
- float fRadioVolume = 0.0f;
- float fSfxVolume = 0.0f;
- float fMouseSens = 0.0f;
-
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_BRIGHTNESS:
- fBrightness = m_PrefsBrightness + (value * (512.0f) / 16.0f);
-
- if (fBrightness > 511.0f)
- fBrightness = 511.0f;
- else if (fBrightness < 0.0f)
- fBrightness = 0.0f;
-
- m_PrefsBrightness = fBrightness;
- SaveSettings();
+ m_PrefsBrightness += m_PrefsBrightness + value * (512/16);
+ m_PrefsBrightness = clamp(m_PrefsBrightness, 0, 511);
break;
case MENUACTION_DRAWDIST:
- fDrawDistance = m_PrefsLOD + (value * (1.8f - 0.8f) / 16.0f);
-
- if (fDrawDistance > 1.8f)
- fDrawDistance = 1.8f;
- else if (fDrawDistance < 0.8f)
- fDrawDistance = 0.8f;
-
- m_PrefsLOD = fDrawDistance;
- SaveSettings();
+ m_PrefsLOD += value * ((1.8f - 0.8f)/16.0f);
+ m_PrefsLOD = clamp(m_PrefsLOD, 0.8f, 1.8f);
+ CRenderer::ms_lodDistScale = m_PrefsLOD;
break;
case MENUACTION_MUSICVOLUME:
- fRadioVolume = m_PrefsMusicVolume + (value * (128.0f) / 16.0f);
-
- if (fRadioVolume > 127.0f)
- fRadioVolume = 127.0f;
- else if (fRadioVolume < 0.0f)
- fRadioVolume = 0.0f;
-
- m_PrefsMusicVolume = fRadioVolume;
- DMAudio.SetMusicMasterVolume(fRadioVolume);
- SaveSettings();
+ m_PrefsMusicVolume += value * (128/16);
+ m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127);
+ DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
break;
case MENUACTION_SFXVOLUME:
- fSfxVolume = m_PrefsSfxVolume + (value * (128.0f) / 16.0f);
-
- if (fSfxVolume > 127)
- fSfxVolume = 127;
- else if (fSfxVolume < 0.0f)
- fSfxVolume = 0.0f;
-
- m_PrefsSfxVolume = fSfxVolume;
- DMAudio.SetEffectsMasterVolume(fSfxVolume);
- SaveSettings();
+ m_PrefsSfxVolume += value * (128/16);
+ m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 127);
+ DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
break;
case MENUACTION_MOUSESENS:
- fMouseSens = TheCamera.m_fMouseAccelHorzntl + (value * (0.005f - 0.0003125f) / 16.0f);
-
- if (fMouseSens > 0.005f)
- fMouseSens = 0.005f;
- else if (fMouseSens < 0.0003125f)
- fMouseSens = 0.0003125f;
-
- TheCamera.m_fMouseAccelHorzntl = fMouseSens;
-
- // BUG: game doesn't set Y Axis.
- TheCamera.m_fMouseAccelVertical = fMouseSens;
- SaveSettings();
+ TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ???
+ TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f/3200.0f, 1.0f/200.0f);
+ TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl;
break;
+ default:
+ return;
}
+ SaveSettings();
}
#if 1
@@ -471,7 +432,7 @@ void CMenuManager::Draw()
CFont::PrintString(SCREEN_SCALE_X(MENUACTION_POS_X), SCREEN_SCALE_Y(MENUACTION_POS_Y), str);
}
- for (int i = 0; i < MENUROWS; ++i) {
+ for (int i = 0; i < NUM_MENUROWS; ++i) {
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0]) {
wchar *textToPrint[MENUCOLUMNS] = { nil, nil };
bool Locked = false;
@@ -543,7 +504,7 @@ void CMenuManager::Draw()
case AR_16_9:
textToPrint[MENUCOLUMN_RIGHT] = (wchar*)L"16:9";
break;
- }
+ }
#endif
break;
case MENUACTION_RADIO:
@@ -611,7 +572,7 @@ void CMenuManager::Draw()
break;
case MENUACTION_MOUSESTEER:
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_bDisableMouseSteering ? "FEM_ON" : "FEM_OFF");
- break;
+ break;
}
CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
@@ -711,7 +672,7 @@ void CMenuManager::Draw()
CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
CSprite2d::DrawRect(CRect(SCREEN_STRETCH_X(11.0f), vecPositions.y - SCREEN_STRETCH_Y(fBarSize * 0.13f), SCREEN_STRETCH_FROM_RIGHT(11.0f), vecPositions.y + SCREEN_STRETCH_Y(fBarSize)), CRGBA(100, 200, 50, 50));
}
- else
+ else
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
// Draw
@@ -727,35 +688,27 @@ void CMenuManager::Draw()
}
// Mouse support.
- // TODO: inputs for these pages.
- if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
- }
- else if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
-
- }
- else {
- static bool bIsMouseInPosition = false;
- if (m_nMenuFadeAlpha >= 255 && GetMouseInput()) {
- CVector2D vecInputSize = { SCREEN_SCALE_X(20.0f), SCREEN_SCALE_FROM_RIGHT(20.0f) };
- if (m_bShowMouse &&
- ((CheckHover(vecInputSize.x, vecInputSize.y, vecPositions.y, vecPositions.y + SCREEN_STRETCH_Y(20.0f)))))
- bIsMouseInPosition = true;
- else
- bIsMouseInPosition = false;
+ static bool bIsMouseInPosition = false;
+ if (m_nMenuFadeAlpha >= 255 && GetMouseInput()) {
+ CVector2D vecInputSize = { SCREEN_SCALE_X(20.0f), SCREEN_SCALE_FROM_RIGHT(20.0f) };
+ if (m_bShowMouse &&
+ ((CheckHover(vecInputSize.x, vecInputSize.y, vecPositions.y, vecPositions.y + SCREEN_STRETCH_Y(20.0f)))))
+ bIsMouseInPosition = true;
+ else
+ bIsMouseInPosition = false;
- if (bIsMouseInPosition) {
- if (m_nCurrOption != i) {
- m_nCurrOption = i;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
- }
+ if (bIsMouseInPosition) {
+ if (m_nCurrOption != i) {
+ m_nCurrOption = i;
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ }
- m_nPrevOption = m_nCurrOption;
+ m_nPrevOption = m_nCurrOption;
- if (GetMouseForward())
- m_nHoverOption = HOVEROPTION_NULL;
- else
- m_nHoverOption = HOVEROPTION_DEFAULT;
- }
+ if (GetMouseForward())
+ m_nHoverOption = HOVEROPTION_42;
+ else
+ m_nHoverOption = HOVEROPTION_DEFAULT;
}
}
@@ -763,16 +716,16 @@ void CMenuManager::Draw()
// TODO: CheckHover
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_BRIGHTNESS:
- DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsBrightness/512.0f);
+ DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsBrightness / 512.0f);
break;
case MENUACTION_DRAWDIST:
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), (m_PrefsLOD - 0.8f) * 1.0f);
break;
case MENUACTION_MUSICVOLUME:
- DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsMusicVolume/128.0f);
+ DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsMusicVolume / 128.0f);
break;
case MENUACTION_SFXVOLUME:
- DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsSfxVolume/128.0f);
+ DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsSfxVolume / 128.0f);
break;
case MENUACTION_MOUSESENS:
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0f);
@@ -859,7 +812,7 @@ void CMenuManager::DrawControllerSetupScreen()
}
#endif
-#if ALL_ORIGINAL_FRONTEND
+#if 0
WRAPPER void CMenuManager::DrawFrontEnd(void) { EAXJMP(0x47A540); }
#else
void CMenuManager::DrawFrontEnd()
@@ -867,7 +820,7 @@ void CMenuManager::DrawFrontEnd()
CFont::SetAlphaFade(255.0f);
if (m_nCurrScreen == MENUPAGE_NONE) {
- m_nMenuFadeAlpha = 0;
+ // m_nMenuFadeAlpha = 0;
if (m_bGameNotLoaded)
m_nCurrScreen = MENUPAGE_START_MENU;
@@ -875,31 +828,27 @@ void CMenuManager::DrawFrontEnd()
m_nCurrScreen = MENUPAGE_PAUSE_MENU;
}
- if (!m_nCurrOption && aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL)
- m_nCurrOption = MENUROW_1;
+ if (m_nCurrOption == 0 && aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL)
+ m_nCurrOption = 1;
CMenuManager::DrawFrontEndNormal();
CMenuManager::PrintErrorMessage();
}
#endif
-#if ALL_ORIGINAL_FRONTEND
+#if 0
WRAPPER void CMenuManager::DrawFrontEndNormal(void) { EAXJMP(0x47A5B0); }
#else
void CMenuManager::DrawFrontEndNormal()
{
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE);
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
- RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void *)rwTEXTUREADDRESSCLAMP);
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
- eMenuSprites previousSprite = MENUSPRITE_MAINMENU;
+ LoadSplash(nil);
+
+ eMenuSprites previousSprite = MENUSPRITE_MAINMENU; // actually uninitialized
if (m_nMenuFadeAlpha < 255) {
switch (m_nPrevScreen) {
case MENUPAGE_STATS:
@@ -939,13 +888,16 @@ void CMenuManager::DrawFrontEndNormal()
break;
}
- if (m_nPrevScreen == MENUPAGE_NONE)
- CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255));
+ if (m_nPrevScreen == m_nCurrScreen)
+ CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255-m_nMenuFadeAlpha));
else
- m_aMenuSprites[previousSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
+ m_aMenuSprites[previousSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255-m_nMenuFadeAlpha));
}
- eMenuSprites currentSprite = MENUSPRITE_MAINMENU;
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+
+ eMenuSprites currentSprite = MENUSPRITE_MAINMENU; // actually uninitialized
switch (m_nCurrScreen) {
case MENUPAGE_STATS:
case MENUPAGE_START_MENU:
@@ -984,38 +936,45 @@ void CMenuManager::DrawFrontEndNormal()
break;
}
- uint32 savedShade;
- uint32 savedAlpha;
- RwRenderStateGet(rwRENDERSTATESHADEMODE, &savedShade);
- RwRenderStateSet(rwRENDERSTATESHADEMODE, reinterpret_cast<void *>(rwSHADEMODEGOURAUD));
- RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &savedAlpha);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast<void *>(TRUE));
- if (m_nMenuFadeAlpha >= 255) {
- m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
- }
- else {
- if (m_nMenuFadeAlpha < 255) {
- m_nMenuFadeAlpha += 0.1f * 255.0f;
-
- if (m_nMenuFadeAlpha >= 255)
- m_nMenuFadeAlpha = 255;
+ if (m_nMenuFadeAlpha < 255) {
+ static int LastFade = 0;
- m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, m_nMenuFadeAlpha));
+ if(CTimer::GetTimeInMillisecondsPauseMode() - LastFade > 10){
+ m_nMenuFadeAlpha += 20;
+ LastFade = CTimer::GetTimeInMillisecondsPauseMode();
}
- else
+
+ if (m_nMenuFadeAlpha > 255){
m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
+ }else{
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, m_nMenuFadeAlpha));
+ }
+ }
+ else {
+ m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
+ // TODO: what is this? waiting mouse?
+ if(field_518 == 4){
+ if(m_nHoverOption == 3 || m_nHoverOption == 4 || m_nHoverOption == 5 || m_nHoverOption == 6 || m_nHoverOption == 7)
+ field_518 = 2;
+ else
+ field_518 = 1;
+ }
}
// GTA LOGO
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_PAUSE_MENU) {
if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
m_aMenuSprites[MENUSPRITE_GTA3LOGO].Draw(CRect((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(115.0f), SCREEN_SCALE_Y(70.0f), (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(115.0f), SCREEN_SCALE_Y(180.0f)), CRGBA(255, 255, 255, FadeIn(255)));
else
m_aMenuSprites[MENUSPRITE_GTALOGO].Draw(CRect((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(95.0f), SCREEN_SCALE_Y(40.0f), (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(95.0f), SCREEN_SCALE_Y(210.0f)), CRGBA(255, 255, 255, FadeIn(255)));
}
- RwRenderStateSet(rwRENDERSTATESHADEMODE, reinterpret_cast<void *>(savedShade));
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast<void *>(savedAlpha));
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
CMenuManager::DrawPlayerSetupScreen();
@@ -1031,8 +990,25 @@ void CMenuManager::DrawFrontEndNormal()
CFont::DrawFonts();
// Draw mouse
- if (m_bShowMouse)
- m_aMenuSprites[MENUSPRITE_MOUSE].Draw(m_nMousePosX, m_nMousePosY, SCREEN_SCALE_X(60.0f), SCREEN_SCALE_Y(60.0f), CRGBA(255, 255, 255, 255));
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
+ if (m_bShowMouse) {
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+
+ CRect mouse(0.0f, 0.0f, SCREEN_SCALE_X(75.0f), SCREEN_SCALE_X(75.0f));
+ mouse.Translate(m_nMousePosX, m_nMousePosY);
+ CRect shad = mouse;
+ shad.Translate(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(3.0f));
+ if(field_518 == 4){
+ m_aMenuSprites[MENUSPRITE_MOUSET].Draw(shad, CRGBA(100, 100, 100, 50));
+ m_aMenuSprites[MENUSPRITE_MOUSET].Draw(mouse, CRGBA(255, 255, 255, 255));
+ }else{
+ m_aMenuSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50));
+ m_aMenuSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255));
+ }
+ }
}
#endif
@@ -1045,7 +1021,7 @@ void CMenuManager::DrawPlayerSetupScreen()
}
#endif
-#if ALL_ORIGINAL_FRONTEND
+#if 0
WRAPPER int CMenuManager::FadeIn(int alpha) { EAXJMP(0x48AC60); }
#else
int CMenuManager::FadeIn(int alpha)
@@ -1054,11 +1030,7 @@ int CMenuManager::FadeIn(int alpha)
m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS ||
m_nCurrScreen == MENUPAGE_DELETING)
return alpha;
-
- if (m_nMenuFadeAlpha >= alpha)
- return alpha;
-
- return m_nMenuFadeAlpha;
+ return min(m_nMenuFadeAlpha, alpha);
}
#endif
@@ -1116,7 +1088,7 @@ void CMenuManager::LoadAllTextures()
CMenuManager::CentreMousePointer();
DMAudio.ChangeMusicMode(0);
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
- m_nCurrOption = MENUROW_0;
+ m_nCurrOption = 0;
m_PrefsRadioStation = DMAudio.GetRadioInCar();
if (DMAudio.IsMP3RadioChannelAvailable()) {
@@ -1165,7 +1137,7 @@ void CMenuManager::LoadAllTextures()
}
#endif
-#if ALL_ORIGINAL_FRONTEND
+#if 0
WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); }
#else
void CMenuManager::LoadSettings()
@@ -1173,46 +1145,47 @@ void CMenuManager::LoadSettings()
CFileMgr::SetDirMyDocuments();
- uint8 prevLang = m_PrefsLanguage;
+ int32 prevLang = m_PrefsLanguage;
+ CMBlur::BlurOn = true;
MousePointerStateHelper.bInvertVertically = true;
static char Ver;
int fileHandle = CFileMgr::OpenFile("gta3.set", "r");
if (fileHandle) {
- CFileMgr::Read(fileHandle, buf(&Ver), sizeof(Ver));
+ CFileMgr::Read(fileHandle, (char*)&Ver, sizeof(Ver));
if (strncmp(&Ver, "THIS FILE IS NOT VALID YET", 26)) {
CFileMgr::Seek(fileHandle, 0, 0);
ControlsManager.LoadSettings(fileHandle);
- CFileMgr::Read(fileHandle, buf(gString), 20);
- CFileMgr::Read(fileHandle, buf(gString), 20);
- CFileMgr::Read(fileHandle, buf(gString), 4);
- CFileMgr::Read(fileHandle, buf(gString), 4);
- CFileMgr::Read(fileHandle, buf(gString), 1);
- CFileMgr::Read(fileHandle, buf(gString), 1);
- CFileMgr::Read(fileHandle, buf(gString), 1);
- CFileMgr::Read(fileHandle, buf(&TheCamera.m_bHeadBob), 1);
- CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelHorzntl), 4);
- CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelVertical), 4);
- CFileMgr::Read(fileHandle, buf(&MousePointerStateHelper.bInvertVertically), 1);
- CFileMgr::Read(fileHandle, buf(&CVehicle::m_bDisableMouseSteering), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsSfxVolume), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsMusicVolume), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsRadioStation), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsSpeakers), 1);
- CFileMgr::Read(fileHandle, buf(&m_nPrefsAudio3DProviderIndex), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsDMA), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsBrightness), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsLOD), 4);
- CFileMgr::Read(fileHandle, buf(&m_PrefsShowSubtitles), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsUseWideScreen), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsVsyncDisp), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsFrameLimiter), 1);
- CFileMgr::Read(fileHandle, buf(&m_nDisplayVideoMode), 1);
- CFileMgr::Read(fileHandle, buf(&CMBlur::BlurOn), 1);
- CFileMgr::Read(fileHandle, buf(m_PrefsSkinFile), 256);
- CFileMgr::Read(fileHandle, buf(&m_ControlMethod), 1);
- CFileMgr::Read(fileHandle, buf(&m_PrefsLanguage), 1);
+ CFileMgr::Read(fileHandle, gString, 20);
+ CFileMgr::Read(fileHandle, gString, 20);
+ CFileMgr::Read(fileHandle, gString, 4);
+ CFileMgr::Read(fileHandle, gString, 4);
+ CFileMgr::Read(fileHandle, gString, 1);
+ CFileMgr::Read(fileHandle, gString, 1);
+ CFileMgr::Read(fileHandle, gString, 1);
+ CFileMgr::Read(fileHandle, (char*)&TheCamera.m_bHeadBob, 1);
+ CFileMgr::Read(fileHandle, (char*)&TheCamera.m_fMouseAccelHorzntl, 4);
+ CFileMgr::Read(fileHandle, (char*)&TheCamera.m_fMouseAccelVertical, 4);
+ CFileMgr::Read(fileHandle, (char*)&MousePointerStateHelper.bInvertVertically, 1);
+ CFileMgr::Read(fileHandle, (char*)&CVehicle::m_bDisableMouseSteering, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsSfxVolume, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsMusicVolume, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsRadioStation, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsSpeakers, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_nPrefsAudio3DProviderIndex, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsDMA, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsBrightness, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsLOD, 4);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsShowSubtitles, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsUseWideScreen, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsVsyncDisp, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsFrameLimiter, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_nDisplayVideoMode, 1);
+ CFileMgr::Read(fileHandle, (char*)&CMBlur::BlurOn, 1);
+ CFileMgr::Read(fileHandle, m_PrefsSkinFile, 256);
+ CFileMgr::Read(fileHandle, (char*)&m_ControlMethod, 1);
+ CFileMgr::Read(fileHandle, (char*)&m_PrefsLanguage, 1);
}
}
@@ -1220,7 +1193,7 @@ void CMenuManager::LoadSettings()
CFileMgr::SetDir("");
m_PrefsVsync = m_PrefsVsyncDisp;
- lodMultiplier = m_PrefsLOD;
+ CRenderer::ms_lodDistScale = m_PrefsLOD;
if (m_nPrefsAudio3DProviderIndex == -1)
m_nPrefsAudio3DProviderIndex = -2;
@@ -1237,25 +1210,72 @@ void CMenuManager::LoadSettings()
debug("The previously saved language is now in use");
}
- /*struct _WIN32_FIND_DATAA FindFileData;
- HANDLE H = FindFirstFileA("skins\*.bmp", &FindFileData);
- char Dest;
+ struct _WIN32_FIND_DATAA FindFileData;
+ char skinfile[256+16]; // ?? + 16?
bool SkinFound = false;
-
- for (int i = 1; H != (HANDLE)-1 && i; i = FindNextFileA(H, &FindFileData)) {
- strcpy(&Dest, buf(m_PrefsSkinFile));
- strcat(&Dest, ".bmp");
- if (!strcmp(FindFileData.cFileName, &Dest))
+ HANDLE handle = FindFirstFileA("skins\\*.bmp", &FindFileData);
+ for (int i = 1; handle != (HANDLE)-1 && i; i = FindNextFileA(handle, &FindFileData)) {
+ strcpy(skinfile, m_PrefsSkinFile);
+ strcat(skinfile, ".bmp");
+ if (strcmp(FindFileData.cFileName, skinfile) == 0)
SkinFound = true;
}
-
- FindClose(H);
+ FindClose(handle);
if (!SkinFound) {
debug("Default skin set as no other skins are available OR saved skin not found!");
- strcpy((char *)CMenuManager::m_PrefsSkinFile, "$$\"\"");
+ strcpy(m_PrefsSkinFile, "$$\"\"");
strcpy(m_aSkinName, "$$\"\"");
- }*/
+ }
+}
+#endif
+
+#if 0
+WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); }
+#else
+void CMenuManager::SaveSettings()
+{
+ static char RubbishString[48] = "stuffmorestuffevenmorestuff etc";
+
+ CFileMgr::SetDirMyDocuments();
+
+ int fileHandle = CFileMgr::OpenFile("gta3.set", "w");
+ if (fileHandle) {
+
+ ControlsManager.SaveSettings(fileHandle);
+ CFileMgr::Write(fileHandle, RubbishString, 20);
+ CFileMgr::Write(fileHandle, RubbishString, 20);
+ CFileMgr::Write(fileHandle, RubbishString, 4);
+ CFileMgr::Write(fileHandle, RubbishString, 4);
+ CFileMgr::Write(fileHandle, RubbishString, 1);
+ CFileMgr::Write(fileHandle, RubbishString, 1);
+ CFileMgr::Write(fileHandle, RubbishString, 1);
+ CFileMgr::Write(fileHandle, (char*)&TheCamera.m_bHeadBob, 1);
+ CFileMgr::Write(fileHandle, (char*)&TheCamera.m_fMouseAccelHorzntl, 4);
+ CFileMgr::Write(fileHandle, (char*)&TheCamera.m_fMouseAccelVertical, 4);
+ CFileMgr::Write(fileHandle, (char*)&MousePointerStateHelper.bInvertVertically, 1);
+ CFileMgr::Write(fileHandle, (char*)&CVehicle::m_bDisableMouseSteering, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsSfxVolume, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsMusicVolume, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsRadioStation, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsSpeakers, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_nPrefsAudio3DProviderIndex, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsDMA, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsBrightness, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsLOD, sizeof(m_PrefsLOD));
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsShowSubtitles, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsUseWideScreen, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsVsyncDisp, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsFrameLimiter, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_nDisplayVideoMode, 1);
+ CFileMgr::Write(fileHandle, (char*)&CMBlur::BlurOn, 1);
+ CFileMgr::Write(fileHandle, m_PrefsSkinFile, 256);
+ CFileMgr::Write(fileHandle, (char*)&m_ControlMethod, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_PrefsLanguage, 1);
+ }
+
+ CFileMgr::CloseFile(fileHandle);
+ CFileMgr::SetDir("");
}
#endif
@@ -1319,7 +1339,7 @@ void CMenuManager::PrintStats()
}
#endif
-#if ALL_ORIGINAL_FRONTEND
+#if 0
WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); }
#else
void CMenuManager::Process(void)
@@ -1423,7 +1443,7 @@ void CMenuManager::Process(void)
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
- int32 TypeOfControl = 0;
+ int32 TypeOfControl = 0;
if (JoyButtonJustClicked)
TypeOfControl = 3;
if (MouseButtonJustClicked)
@@ -1468,11 +1488,10 @@ void CMenuManager::Process(void)
CPad::StopPadsShaking();
VibrationTime = 0;
}
- }
- else {
+
+ } else {
UnloadTextures();
field_452 = 0;
- *(bool*)0x5F33E4 = true;
// byte_5F33E4 = 1; // unused
m_nPrevScreen = 0;
m_nCurrScreen = m_nPrevScreen;
@@ -1493,15 +1512,12 @@ WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); }
#else
void CMenuManager::ProcessButtonPresses()
{
- if(pEditString)
- return;
- if(pControlEdit)
+ if (pEditString || pControlEdit)
return;
// Update mouse position
m_nMouseOldPosX = m_nMousePosX;
m_nMouseOldPosY = m_nMousePosY;
-
m_nMousePosX = m_nMouseTempPosX;
m_nMousePosY = m_nMouseTempPosY;
@@ -1521,28 +1537,58 @@ void CMenuManager::ProcessButtonPresses()
m_bShowMouse = false;
if (m_nCurrScreen == MENUPAGE_MULTIPLAYER_FIND_GAME || m_nCurrScreen == MENUPAGE_SKIN_SELECT || m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
- if (m_nCurrScreen == MENUPAGE_SKIN_SELECT)
- field_440 = m_nSkinsTotal;
+ if (m_nCurrScreen == MENUPAGE_SKIN_SELECT)
+ m_nCurrExSize = m_nSkinsTotal;
- if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
- field_440 = m_ControlMethod ? 30 : 25;
-
- if (field_44C > field_440)
- field_44C = field_440 - 1;
- }
+ if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)
+ m_nCurrExSize = m_ControlMethod ? 30 : 25;
if (!GetPadBack() || m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS || field_535)
field_535 = 0;
- else if (field_536 == 19) {
- m_nHoverOption = 42;
+ else if (m_nCurrExLayer == 19) {
+ m_nHoverOption = HOVEROPTION_42;
field_113 = 1;
field_456 = 1;
- m_bKeyChangeNotProcessed = 1;
+ m_bKeyChangeNotProcessed = true;
pControlEdit = &m_KeyPressedCode;
}
+ bool Trigger = false;
+ if (!Trigger) {
+ nTimeForSomething = 0;
+ Trigger = true;
+ }
+
+ if ((CTimer::GetTimeInMillisecondsPauseMode() - nTimeForSomething) > 200) {
+ field_520 = 0;
+ field_521 = 0;
+ field_522 = 0;
+ field_523 = 0;
+ field_524 = 0;
+ nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+
+ if (CPad::GetPad(0)->NewKeyState.TAB && !CPad::GetPad(0)->OldKeyState.TAB) {
+ switch (m_nCurrExLayer) {
+ case 9:
+ m_nCurrExLayer = 19;
+ break;
+ case 19:
+ m_nCurrExLayer = 21;
+ break;
+ case 21:
+ m_nCurrExLayer = 9;
+ break;
+ }
+ if (m_nCurrScreen == MENUPAGE_SKIN_SELECT && m_nCurrExLayer == 21 && !strcmp(m_aSkinName, m_PrefsSkinFile)) {
+ m_nCurrExLayer = 9;
+ }
+ if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS && m_nCurrExLayer == 21)
+ m_nCurrExLayer = 9;
+ }
+
if (GetPadForward()) {
- switch (field_536) {
+ switch (m_nCurrExLayer) {
case 19:
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
field_113 = 1;
@@ -1552,36 +1598,21 @@ void CMenuManager::ProcessButtonPresses()
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
- field_536 = 9;
+ m_nCurrExLayer = 9;
}
- m_nHoverOption = HOVEROPTION_NULL;
+ m_nHoverOption = HOVEROPTION_42;
SaveSettings();
break;
case 21:
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
- field_536 = 9;
+ m_nCurrExLayer = 9;
break;
default:
break;
}
}
-
- bool once = false;
- if (!once) {
- once = true;
- nTimeForSomething = 0;
- }
-
- if ((CTimer::GetTimeInMillisecondsPauseMode() - nTimeForSomething) > 200) {
- field_520 = 0;
- field_521 = 0;
- field_522 = 0;
- field_523 = 0;
- field_524 = 0;
- nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
- }
}
// Get number of menu options.
@@ -1591,31 +1622,41 @@ void CMenuManager::ProcessButtonPresses()
if (GetPadMoveUp()) {
m_nPrevOption = m_nCurrOption;
m_nCurrOption -= 1;
+ m_nCurrExOption -= 1;
+ //field_438 -= 1;
if (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) {
- if (m_nCurrOption < MENUROW_1)
+ if (m_nCurrOption < 1)
m_nCurrOption = NumberOfMenuOptions;
}
else {
- if (m_nCurrOption < MENUROW_0)
+ if (m_nCurrOption < 0)
m_nCurrOption = NumberOfMenuOptions;
}
+ if (m_nCurrExOption < 0)
+ m_nCurrExOption = 0;
+
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
}
else if (GetPadMoveDown()) {
m_nPrevOption = m_nCurrOption;
m_nCurrOption += 1;
+ m_nCurrExOption += 1;
+ //field_438 = += 1;
if (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) {
if (m_nCurrOption > NumberOfMenuOptions)
- m_nCurrOption = MENUROW_1;
+ m_nCurrOption = 1;
}
else {
if (m_nCurrOption > NumberOfMenuOptions)
- m_nCurrOption = MENUROW_0;
+ m_nCurrOption = 0;
}
+ if (m_nCurrExOption > m_nCurrExSize - 1)
+ m_nCurrExOption = m_nCurrExSize - 1;
+
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
}
@@ -1637,6 +1678,8 @@ void CMenuManager::ProcessButtonPresses()
}
else
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
+
+ PlayEscSound = true;
break;
default:
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
@@ -1675,7 +1718,7 @@ void CMenuManager::ProcessButtonPresses()
}
break;
default:
- m_nHoverOption = HOVEROPTION_NULL;
+ m_nHoverOption = HOVEROPTION_42;
break;
}
}
@@ -1871,10 +1914,12 @@ void CMenuManager::ProcessOnOffMenuOptions()
break;
case MENUACTION_UPDATESAVE:
PcSaveHelper.PopulateSlotInfo();
- if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrOption].m_aEntries[m_nCurrOption].m_SaveSlot <= SAVESLOT_8) {
- m_nCurrSaveSlot = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 2;
+ if (!m_bGameNotLoaded) {
+ if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrOption].m_aEntries[m_nCurrOption].m_SaveSlot <= SAVESLOT_8) {
+ m_nCurrSaveSlot = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 2;
- SwitchToNewScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu);
+ SwitchToNewScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu);
+ }
}
break;
case MENUACTION_CHECKSAVE:
@@ -2120,32 +2165,24 @@ void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
case 1:
case 2:
case 3:
- m_nPrevScreen = m_nCurrScreen;
- m_nCurrScreen = MENUPAGE_SAVE_FAILED;
- m_nCurrOption = MENUROW_0;
+ SwitchToNewScreen(MENUPAGE_SAVE_FAILED);
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
break;
break;
case 4:
case 5:
case 6:
- this->m_nPrevScreen = m_nCurrScreen;
- this->m_nCurrScreen = MENUPAGE_LOAD_FAILED;
- m_nCurrOption = MENUROW_0;
+ SwitchToNewScreen(MENUPAGE_LOAD_FAILED);
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
break;
case 7:
- this->m_nPrevScreen = m_nCurrScreen;
- this->m_nCurrScreen = MENUPAGE_LOAD_FAILED_2;
- m_nCurrOption = MENUROW_0;
+ SwitchToNewScreen(MENUPAGE_LOAD_FAILED_2);
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
break;
case 8:
case 9:
case 10:
- m_nPrevScreen = m_nCurrScreen;
- m_nCurrScreen = MENUPAGE_DELETE_FAILED;
- m_nCurrOption = MENUROW_0;
+ SwitchToNewScreen(MENUPAGE_DELETE_FAILED);
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
break;
default:
@@ -2165,53 +2202,6 @@ void CMenuManager::SetHelperText(int text)
#endif
#if ALL_ORIGINAL_FRONTEND
-WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); }
-#else
-void CMenuManager::SaveSettings()
-{
- CFileMgr::SetDirMyDocuments();
-
- int fileHandle = CFileMgr::OpenFile("gta3.set", "w");
- if (fileHandle) {
-
- ControlsManager.SaveSettings(fileHandle);
- CFileMgr::Write(fileHandle, buf("stuffmorestuffevenmorestuff etc"), 20);
- CFileMgr::Write(fileHandle, buf("stuffmorestuffevenmorestuff etc"), 20);
- CFileMgr::Write(fileHandle, buf("stuffmorestuffevenmorestuff etc"), 4);
- CFileMgr::Write(fileHandle, buf("stuffmorestuffevenmorestuff etc"), 4);
- CFileMgr::Write(fileHandle, buf("stuffmorestuffevenmorestuff etc"), 1);
- CFileMgr::Write(fileHandle, buf("stuffmorestuffevenmorestuff etc"), 1);
- CFileMgr::Write(fileHandle, buf("stuffmorestuffevenmorestuff etc"), 1);
- CFileMgr::Write(fileHandle, buf(&TheCamera.m_bHeadBob), 1);
- CFileMgr::Write(fileHandle, buf(&TheCamera.m_fMouseAccelHorzntl), 4);
- CFileMgr::Write(fileHandle, buf(&TheCamera.m_fMouseAccelVertical), 4);
- CFileMgr::Write(fileHandle, buf(&MousePointerStateHelper.bInvertVertically), 1);
- CFileMgr::Write(fileHandle, buf(&CVehicle::m_bDisableMouseSteering), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsSfxVolume), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsMusicVolume), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsRadioStation), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsSpeakers), 1);
- CFileMgr::Write(fileHandle, buf(&m_nPrefsAudio3DProviderIndex), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsDMA), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsBrightness), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsLOD), sizeof(m_PrefsLOD));
- CFileMgr::Write(fileHandle, buf(&m_PrefsShowSubtitles), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsUseWideScreen), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsVsyncDisp), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsFrameLimiter), 1);
- CFileMgr::Write(fileHandle, buf(&m_nDisplayVideoMode), 1);
- CFileMgr::Write(fileHandle, buf(&CMBlur::BlurOn), 1);
- CFileMgr::Write(fileHandle, buf(m_PrefsSkinFile), 256);
- CFileMgr::Write(fileHandle, buf(&m_ControlMethod), 1);
- CFileMgr::Write(fileHandle, buf(&m_PrefsLanguage), 1);
- }
-
- CFileMgr::CloseFile(fileHandle);
- CFileMgr::SetDir("");
-}
-#endif
-
-#if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::ShutdownJustMenu() { EAXJMP(0x488920); }
#else
void CMenuManager::ShutdownJustMenu()
@@ -2221,7 +2211,6 @@ void CMenuManager::ShutdownJustMenu()
}
#endif
-// We won't ever use this again.
#if ALL_ORIGINAL_FRONTEND
WRAPPER float CMenuManager::StretchX(float) { EAXJMP(0x48ABE0); }
#else
@@ -2230,7 +2219,11 @@ float CMenuManager::StretchX(float x)
if (SCREEN_WIDTH == 640)
return x;
else
+#ifndef ASPECT_RATIO_SCALE
return SCREEN_WIDTH * x * 0.0015625f;
+#else
+ return SCREEN_SCALE_X(x);
+#endif
}
#endif
@@ -2337,10 +2330,11 @@ void CMenuManager::WaitForUserCD()
#endif
// New content:
+#if 0
uint8 CMenuManager::GetNumberOfMenuOptions()
{
- uint8 Rows = MENUROW_NONE;
- for (int i = 0; i < MENUROWS; i++) {
+ uint8 Rows = -1;
+ for (int i = 0; i < NUM_MENUROWS; i++) {
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_NOTHING)
break;
@@ -2349,7 +2343,7 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
return Rows;
}
-void CMenuManager::SwitchToNewScreen(int8 screen)
+void CMenuManager::SwitchToNewScreen(int32 screen)
{
ResetHelperText();
@@ -2372,21 +2366,24 @@ void CMenuManager::SwitchToNewScreen(int8 screen)
if (screen) {
m_nPrevScreen = m_nCurrScreen;
m_nCurrScreen = screen;
- m_nCurrOption = MENUROW_0;
+ m_nCurrOption = 0;
+ //
+ m_nCurrExOption = 0;
+ m_nCurrExLayer = 19;
+ //
m_nMenuFadeAlpha = 0;
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
else {
m_nPrevScreen = MENUPAGE_NONE;
m_nCurrScreen = MENUPAGE_NONE;
- m_nCurrOption = MENUROW_0;
+ m_nCurrOption = 0;
}
}
// Set player skin.
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
CPlayerSkin::BeginFrontEndSkinEdit();
- field_535 = 19;
m_bSkinsFound = false;
}
@@ -2399,7 +2396,7 @@ void CMenuManager::SwitchToNewScreen(int8 screen)
DMAudio.StopFrontEndTrack();
}
-void CMenuManager::SetDefaultPreferences(int8 screen)
+void CMenuManager::SetDefaultPreferences(int32 screen)
{
switch (screen) {
case MENUPAGE_SOUND_SETTINGS:
@@ -2446,6 +2443,7 @@ void CMenuManager::SetDefaultPreferences(int8 screen)
break;
}
}
+#endif
// Frontend inputs.
bool GetPadBack()
@@ -2480,7 +2478,7 @@ bool GetPadMoveUp()
bool GetPadMoveDown()
{
- return
+ return
(CPad::GetPad(0)->NewState.DPadDown && !CPad::GetPad(0)->OldState.DPadDown) ||
(CPad::GetPad(0)->NewKeyState.DOWN && !CPad::GetPad(0)->OldKeyState.DOWN) ||
(CPad::GetPad(0)->NewState.LeftStickY > 0 && !(CPad::GetPad(0)->OldState.LeftStickY > 0));
@@ -2540,7 +2538,7 @@ bool GetMouseForward()
bool GetMouseBack()
{
- return GetMouseClickRight;
+ return GetMouseClickRight();
}
bool GetMousePos()
@@ -2581,7 +2579,8 @@ bool GetMouseInput()
}
STARTPATCHES
-#ifndef ALL_ORIGINAL_FRONTEND
+#if ALL_ORIGINAL_FRONTEND
+#else
InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP);
InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
@@ -2589,8 +2588,13 @@ STARTPATCHES
InjectHook(0x48AE60, &CMenuManager::ProcessOnOffMenuOptions, PATCH_JUMP);
InjectHook(0x488EE0, &CMenuManager::LoadSettings, PATCH_JUMP);
InjectHook(0x488CC0, &CMenuManager::SaveSettings, PATCH_JUMP);
+ InjectHook(0x48ABE0, &CMenuManager::StretchX, PATCH_JUMP);
+ InjectHook(0x48AC20, &CMenuManager::StretchY, PATCH_JUMP);
for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);
#endif
+
+ InjectHook(0x488EE0, &CMenuManager::LoadSettings, PATCH_JUMP);
+ InjectHook(0x488CC0, &CMenuManager::SaveSettings, PATCH_JUMP);
ENDPATCHES \ No newline at end of file
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 9a3cdd50..b588b1af 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -43,8 +43,6 @@
#define MENUSLIDER_X 306.0f
-#define buf(a) (char*)(a)
-
enum eLanguages
{
LANGUAGE_AMERICAN,
@@ -328,7 +326,7 @@ enum eCheckHover
HOVEROPTION_19,
HOVEROPTION_20,
HOVEROPTION_CHANGESKIN,
- HOVEROPTION_NULL = 42,
+ HOVEROPTION_42 = 42,
};
enum eMenuColumns
@@ -339,28 +337,9 @@ enum eMenuColumns
MENUCOLUMNS,
};
-enum eMenuRow
+enum
{
- MENUROW_NONE = -1,
- MENUROW_0,
- MENUROW_1,
- MENUROW_2,
- MENUROW_3,
- MENUROW_4,
- MENUROW_5,
- MENUROW_6,
- MENUROW_7,
- MENUROW_8,
- MENUROW_9,
- MENUROW_10,
- MENUROW_11,
- MENUROW_12,
- MENUROW_13,
- MENUROW_14,
- MENUROW_15,
- MENUROW_16,
- MENUROW_17,
- MENUROWS,
+ NUM_MENUROWS = 18,
};
struct tSkinInfo
@@ -377,7 +356,7 @@ struct CMenuScreen
char m_ScreenName[8];
int32 unk;
int32 m_PreviousPage[2]; // eMenuScreen
- int32 m_ParentEntry[2]; // eMenuRow
+ int32 m_ParentEntry[2]; // row
struct CMenuEntry
{
@@ -385,7 +364,7 @@ struct CMenuScreen
char m_EntryName[8];
int32 m_SaveSlot; // eSaveSlot
int32 m_TargetMenu; // eMenuScreen
- } m_aEntries[MENUROWS];
+ } m_aEntries[NUM_MENUROWS];
};
class CMenuManager
@@ -413,10 +392,10 @@ public:
tSkinInfo *m_pSelectedSkin;
tSkinInfo *field_438;
float field_43C;
- int field_440;
+ int m_nCurrExSize;
int m_nSkinsTotal;
char _unk0[4];
- int field_44C;
+ int m_nCurrExOption;
bool m_bSkinsFound;
bool m_bQuitGameNoCD;
char field_452;
@@ -439,7 +418,7 @@ public:
int field_530;
char field_534;
char field_535;
- int8 field_536;
+ int8 m_nCurrExLayer;
int m_nHelperTextAlpha;
int m_nMouseOldPosX;
int m_nMouseOldPosY;
@@ -452,6 +431,7 @@ public:
int m_nCurrSaveSlot;
int m_nScreenChangeDelayTimer;
+public:
static int32 &OS_Language;
static int8 &m_PrefsUseVibration;
static int8 &m_DisplayControllerOnFoot;
@@ -462,9 +442,9 @@ public:
static int8 &m_PrefsFrameLimiter;
static int8 &m_PrefsShowSubtitles;
static int8 &m_PrefsSpeakers;
- static int8 &m_ControlMethod;
+ static int32 &m_ControlMethod;
static int8 &m_PrefsDMA;
- static int8 &m_PrefsLanguage;
+ static int32 &m_PrefsLanguage;
static int8 &m_bDisableMouseSteering;
static int32 &m_PrefsBrightness;
static float &m_PrefsLOD;
@@ -516,17 +496,16 @@ public:
void SaveSettings();
void SetHelperText(int text);
void ShutdownJustMenu();
- static float StretchX(float);
- static float StretchY(float);
+ float StretchX(float);
+ float StretchY(float);
void SwitchMenuOnAndOff();
void UnloadTextures();
void WaitForUserCD();
// New content:
uint8 GetNumberOfMenuOptions();
- void SwitchToNewScreen(int8 screen);
- void SetDefaultPreferences(int8 screen);
-
+ void SwitchToNewScreen(int32 screen);
+ void SetDefaultPreferences(int32 screen);
};
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
diff --git a/src/core/General.h b/src/core/General.h
index 64613478..7c0c9562 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -36,6 +36,22 @@ public:
}
}
+ static float LimitAngle(float angle)
+ {
+ float result = angle;
+
+ while (result >= 180.0f) {
+ result -= 2 * 180.0f;
+ }
+
+ while (result < -180.0f) {
+ result += 2 * 180.0f;
+ }
+
+ return result;
+ }
+
+
static float LimitRadianAngle(float angle)
{
float result;
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h
index 866dfc03..b464d657 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.h
@@ -2,15 +2,15 @@
const CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, },
+ { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// MENUPAGE_STATS = 1
- { "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_5, MENUROW_2,
+ { "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_NEW_GAME = 2
- { "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_0, MENUROW_1,
+ { "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
MENUACTION_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
@@ -18,17 +18,17 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_BRIEFS = 3
- { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_6, MENUROW_3,
+ { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENU_CONTROLLER_SETTINGS = 4
- { "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_0, MENUROW_0,
+ { "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
},
// MENUPAGE_SOUND_SETTINGS = 5
- { "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_1, MENUROW_1,
+ { "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1,
MENUACTION_MUSICVOLUME, "FEA_MUS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_SFXVOLUME, "FEA_SFX", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
@@ -40,7 +40,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_GRAPHICS_SETTINGS = 6
- { "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_2, MENUROW_2,
+ { "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@@ -54,7 +54,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_LANGUAGE_SETTINGS = 7
- { "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_3, MENUROW_3,
+ { "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE,
@@ -64,7 +64,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
- { "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_1, MENUROW_1,
+ { "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
@@ -77,7 +77,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
- { "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_2, MENUROW_2,
+ { "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
@@ -90,96 +90,96 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_NEW_GAME_RELOAD = 10
- { "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_0, MENUROW_0,
+ { "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0,
MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_LOAD_SLOT_CONFIRM = 11
- { "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QL", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
},
// MENUPAGE_DELETE_SLOT_CONFIRM = 12
- { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QD", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_DELETING,
},
// MENUPAGE_13 = 13
- { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_LOADING_IN_PROGRESS = 14
- { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FED_LDW", SAVESLOT_NONE, MENUPAGE_LOAD_SLOT_CONFIRM,
},
// MENUPAGE_DELETING_IN_PROGRESS = 15
- { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FEDL_WR", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_16 = 16
- { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_LOE", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_DELETE_FAILED = 17
- { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_DEE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
},
// MENUPAGE_DEBUG_MENU = 18
- { "FED_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FED_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MEMORY_CARD_1 = 19
- { "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MEMORY_CARD_2 = 20
- { "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_MAIN = 21
- { "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_SAVE_FAILED_1 = 22
- { "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVE_FAILED_2 = 23
- { "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVE = 24
- { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_UPDATESAVE, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_NO_MEMORY_CARD = 25
- { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_CHOOSE_SAVE_SLOT = 26
- { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_UPDATESAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
@@ -192,49 +192,49 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_SAVING_IN_PROGRESS,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_MULTIPLAYER_MAP = 28
- { "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_CONNECTION = 29
- { "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_FIND_GAME = 30
- { "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_MODE = 31
- { "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_CREATE = 32
- { "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_START = 33
- { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_SKIN_SELECT_OLD = 34
- { "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_CONTROLLER_PC = 35
- { "FET_CTL", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_0, MENUROW_0,
+ { "FET_CTL", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
@@ -243,32 +243,32 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CONTROLLER_PC_OLD1 = 36
- { "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_0, MENUROW_0,
+ { "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0,
},
// MENUPAGE_CONTROLLER_PC_OLD2 = 37
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_CONTROLLER_PC_OLD3 = 38
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_CONTROLLER_PC_OLD4 = 39
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_CONTROLLER_DEBUG = 40
- { "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_OPTIONS = 41
- { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_1, MENUROW_4,
+ { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@@ -278,65 +278,65 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_EXIT = 42
- { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_2, MENUROW_5,
+ { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCLEGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVING_IN_PROGRESS = 43
- { "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
+ { "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FES_WAR", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVE_SUCCESSFUL = 44
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE,
MENUACTION_UPDATEMEMCARDSAVE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_DELETING = 45
- { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "FED_DLW", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_DELETE_SUCCESS = 46
- { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "DEL_FNM", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
},
// MENUPAGE_SAVE_FAILED = 47
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_LOAD_FAILED = 48
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_LOAD_FAILED_2 = 49
- { "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
+ { "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_LUN", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
},
// MENUPAGE_FILTER_GAME = 50
- { "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_START_MENU = 51
- { "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
MENUACTION_CHANGEMENU, "FEM_QT", SAVESLOT_NONE, MENUPAGE_EXIT,
},
// MENUPAGE_PAUSE_MENU = 52
- { "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
@@ -346,22 +346,22 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_MODE = 53
- { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_SKIN_SELECT = 54
- { "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_4, MENUROW_4,
+ { "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4,
//MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
},
// MENUPAGE_KEYBOARD_CONTROLS = 55
- { "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_1, MENUROW_1,
+ { "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
//MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
},
// MENUPAGE_MOUSE_CONTROLS = 56
- { "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_2, MENUROW_2,
+ { "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
MENUACTION_MOUSESENS, "FEC_MSH", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_INVVERT, "FEC_IVV", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
@@ -369,12 +369,12 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_57 = 57
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_58 = 58
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
+ { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
};
diff --git a/src/core/Messages.cpp b/src/core/Messages.cpp
index 7fc23593..c6f3bc1b 100644
--- a/src/core/Messages.cpp
+++ b/src/core/Messages.cpp
@@ -9,6 +9,11 @@ WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned sho
WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); }
WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); }
WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); }
+WRAPPER void CMessages::AddBigMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529EB0); }
+WRAPPER void CMessages::AddMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529900); }
+WRAPPER void CMessages::AddMessageJumpQ(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529A10); }
+WRAPPER void CMessages::AddMessageSoon(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529AF0); }
+WRAPPER void CMessages::ClearMessages() { EAXJMP(0x529CE0); }
tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08;
tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0;
diff --git a/src/core/Messages.h b/src/core/Messages.h
index 69cf117c..51c36212 100644
--- a/src/core/Messages.h
+++ b/src/core/Messages.h
@@ -41,4 +41,9 @@ public:
static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst);
static void InsertPlayerControlKeysInString(wchar* src);
static int GetWideStringLength(wchar *src);
+ static void AddBigMessage(wchar* key, uint32 time, uint16 pos);
+ static void AddMessage(wchar* key, uint32 time, uint16 pos);
+ static void AddMessageJumpQ(wchar* key, uint32 time, uint16 pos);
+ static void AddMessageSoon(wchar* key, uint32 time, uint16 pos);
+ static void ClearMessages();
};
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 9c5e1c8a..736e1e9d 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -155,7 +155,7 @@ void CPad::Clear(bool bResetPlayerControls)
ShakeDur = 0;
if ( bResetPlayerControls )
- DisablePlayerControls = false;
+ DisablePlayerControls = PLAYERCONTROL_ENABLED;
bApplyBrakes = false;
@@ -659,7 +659,7 @@ CPad *CPad::GetPad(int32 pad)
int16 CPad::GetSteeringLeftRight(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -692,7 +692,7 @@ int16 CPad::GetSteeringLeftRight(void)
int16 CPad::GetSteeringUpDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -725,7 +725,7 @@ int16 CPad::GetSteeringUpDown(void)
int16 CPad::GetCarGunUpDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -752,7 +752,7 @@ int16 CPad::GetCarGunUpDown(void)
int16 CPad::GetCarGunLeftRight(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -779,7 +779,7 @@ int16 CPad::GetCarGunLeftRight(void)
int16 CPad::GetPedWalkLeftRight(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -813,7 +813,7 @@ int16 CPad::GetPedWalkLeftRight(void)
int16 CPad::GetPedWalkUpDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -876,7 +876,7 @@ int16 CPad::GetAnalogueUpDown(void)
bool CPad::GetLookLeft(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.LeftShoulder2 && !NewState.RightShoulder2);
@@ -884,7 +884,7 @@ bool CPad::GetLookLeft(void)
bool CPad::GetLookRight(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.RightShoulder2 && !NewState.LeftShoulder2);
@@ -893,7 +893,7 @@ bool CPad::GetLookRight(void)
bool CPad::GetLookBehindForCar(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.RightShoulder2 && NewState.LeftShoulder2);
@@ -901,7 +901,7 @@ bool CPad::GetLookBehindForCar(void)
bool CPad::GetLookBehindForPed(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!NewState.RightShock;
@@ -909,7 +909,7 @@ bool CPad::GetLookBehindForPed(void)
bool CPad::GetHorn(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -948,7 +948,7 @@ bool CPad::GetHorn(void)
bool CPad::HornJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -988,7 +988,7 @@ bool CPad::HornJustDown(void)
bool CPad::GetCarGunFired(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1015,7 +1015,7 @@ bool CPad::GetCarGunFired(void)
bool CPad::CarGunJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1042,7 +1042,7 @@ bool CPad::CarGunJustDown(void)
int16 CPad::GetHandBrake(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -1075,7 +1075,7 @@ int16 CPad::GetHandBrake(void)
int16 CPad::GetBrake(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -1113,7 +1113,7 @@ int16 CPad::GetBrake(void)
bool CPad::GetExitVehicle(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1140,7 +1140,7 @@ bool CPad::GetExitVehicle(void)
bool CPad::ExitVehicleJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1167,7 +1167,7 @@ bool CPad::ExitVehicleJustDown(void)
int32 CPad::GetWeapon(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1200,7 +1200,7 @@ int32 CPad::GetWeapon(void)
bool CPad::WeaponJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1233,7 +1233,7 @@ bool CPad::WeaponJustDown(void)
int16 CPad::GetAccelerate(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -1319,7 +1319,7 @@ bool CPad::CycleCameraModeDownJustDown(void)
bool CPad::ChangeStationJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1359,7 +1359,7 @@ bool CPad::ChangeStationJustDown(void)
bool CPad::CycleWeaponLeftJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
@@ -1367,7 +1367,7 @@ bool CPad::CycleWeaponLeftJustDown(void)
bool CPad::CycleWeaponRightJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.RightShoulder2 && !OldState.RightShoulder2);
@@ -1375,7 +1375,7 @@ bool CPad::CycleWeaponRightJustDown(void)
bool CPad::GetTarget(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1402,7 +1402,7 @@ bool CPad::GetTarget(void)
bool CPad::TargetJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1429,7 +1429,7 @@ bool CPad::TargetJustDown(void)
bool CPad::JumpJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.Square && !OldState.Square);
@@ -1437,7 +1437,7 @@ bool CPad::JumpJustDown(void)
bool CPad::GetSprint(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1464,7 +1464,7 @@ bool CPad::GetSprint(void)
bool CPad::ShiftTargetLeftJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
@@ -1472,7 +1472,7 @@ bool CPad::ShiftTargetLeftJustDown(void)
bool CPad::ShiftTargetRightJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.RightShoulder2 && !OldState.RightShoulder2);
@@ -1592,7 +1592,7 @@ bool CPad::GetAnaloguePadRightJustUp(void)
bool CPad::ForceCameraBehindPlayer(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1625,7 +1625,7 @@ bool CPad::ForceCameraBehindPlayer(void)
bool CPad::SniperZoomIn(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1652,7 +1652,7 @@ bool CPad::SniperZoomIn(void)
bool CPad::SniperZoomOut(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1824,7 +1824,7 @@ char *CPad::EditString(char *pStr, int32 nSize)
}
// numbers
- for ( int32 i = 0; i < ('0' - '9' + 1); i++ )
+ for ( int32 i = 0; i < ('9' - '0' + 1); i++ )
{
if ( GetPad(0)->GetCharJustDown(i + '0') && pos < nSize - 1 )
{
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 62585377..4f129e85 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -51,6 +51,17 @@ enum Key
};
*/
+enum {
+ PLAYERCONTROL_ENABLED = 0,
+ PLAYERCONTROL_DISABLED_1 = 1,
+ PLAYERCONTROL_DISABLED_2 = 2,
+ PLAYERCONTROL_DISABLED_4 = 4,
+ PLAYERCONTROL_DISABLED_8 = 8,
+ PLAYERCONTROL_DISABLED_10 = 16,
+ PLAYERCONTROL_DISABLED_20 = 32,
+ PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls
+ PLAYERCONTROL_DISABLED_80 = 128,
+};
class CControllerState
{
@@ -186,9 +197,9 @@ public:
int16 Mode;
int16 ShakeDur;
uint8 ShakeFreq;
- int8 bHornHistory[5];
+ bool bHornHistory[5];
uint8 iCurrHornHistory;
- bool DisablePlayerControls;
+ uint8 DisablePlayerControls;
int8 bApplyBrakes;
char _unk[12]; //int32 unk[3];
char _pad0[3];
@@ -289,6 +300,10 @@ public:
// mouse
bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
+ bool GetRightMouseJustDown() { return !!(NewMouseControllerState.RMB && !OldMouseControllerState.RMB); }
+ bool GetMiddleMouseJustDown() { return !!(NewMouseControllerState.MMB && !OldMouseControllerState.MMB); }
+ float GetMouseX() { return NewMouseControllerState.x; }
+ float GetMouseY() { return NewMouseControllerState.y; }
// keyboard
@@ -354,6 +369,13 @@ public:
bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
+/*
+ int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; }
+ int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; }
+ int32 GetRightShoulder1(void) { return NewState.RightShoulder1; }
+ int32 GetRightShoulder2(void) { return NewState.RightShoulder2; }
+*/
+
bool GetTriangle() { return !!NewState.Triangle; }
bool GetCircle() { return !!NewState.Circle; }
bool GetCross() { return !!NewState.Cross; }
@@ -366,10 +388,11 @@ public:
bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; }
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; }
+
+ bool ArePlayerControlsDisabled(void) { return DisablePlayerControls != PLAYERCONTROL_ENABLED; }
};
VALIDATE_SIZE(CPad, 0xFC);
+extern CPad *Pads; //[2]
#define IsButtonJustDown(pad, btn) \
(!(pad)->OldState.btn && (pad)->NewState.btn)
-
-void LittleTest(void);
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index f7f93292..404cd558 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -9,11 +9,13 @@ CBuildingPool *&CPools::ms_pBuildingPool = *(CBuildingPool**)0x8F2C04;
CTreadablePool *&CPools::ms_pTreadablePool = *(CTreadablePool**)0x8F2568;
CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28;
CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18;
+CAudioScriptObjectPool *&CPools::ms_pAudioScriptObjectPool = *(CAudioScriptObjectPool**)0x8F1B6C;
void
CPools::Initialise(void)
{
// TODO: unused right now
+ assert(0);
ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES);
ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS);
ms_pPedPool = new CPedPool(NUMPEDS);
@@ -22,4 +24,12 @@ CPools::Initialise(void)
ms_pTreadablePool = new CTreadablePool(NUMTREADABLES);
ms_pObjectPool = new CObjectPool(NUMOBJECTS);
ms_pDummyPool = new CDummyPool(NUMDUMMIES);
+ ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS);
}
+
+int32 CPools::GetPedRef(CPed *ped) { return ms_pPedPool->GetIndex(ped); }
+CPed *CPools::GetPed(int32 handle) { return ms_pPedPool->GetAt(handle); }
+int32 CPools::GetVehicleRef(CVehicle *vehicle) { return ms_pVehiclePool->GetIndex(vehicle); }
+CVehicle *CPools::GetVehicle(int32 handle) { return ms_pVehiclePool->GetAt(handle); }
+int32 CPools::GetObjectRef(CObject *object) { return ms_pObjectPool->GetIndex(object); }
+CObject *CPools::GetObject(int32 handle) { return ms_pObjectPool->GetAt(handle); }
diff --git a/src/core/Pools.h b/src/core/Pools.h
index 3496064c..bdf668c2 100644
--- a/src/core/Pools.h
+++ b/src/core/Pools.h
@@ -8,6 +8,7 @@
#include "PlayerPed.h"
#include "Automobile.h"
#include "DummyPed.h"
+#include "AudioManager.h"
typedef CPool<CPtrNode> CCPtrNodePool;
typedef CPool<CEntryInfoNode> CEntryInfoNodePool;
@@ -17,6 +18,7 @@ typedef CPool<CBuilding> CBuildingPool;
typedef CPool<CTreadable> CTreadablePool;
typedef CPool<CObject, CCutsceneHead> CObjectPool;
typedef CPool<CDummy, CDummyPed> CDummyPool;
+typedef CPool<cAudioScriptObject, cAudioScriptObject> CAudioScriptObjectPool;
class CPools
{
@@ -28,7 +30,7 @@ class CPools
static CTreadablePool *&ms_pTreadablePool;
static CObjectPool *&ms_pObjectPool;
static CDummyPool *&ms_pDummyPool;
- // ms_pAudioScriptObjectPool
+ static CAudioScriptObjectPool *&ms_pAudioScriptObjectPool;
public:
static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; }
static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; }
@@ -38,6 +40,13 @@ public:
static CTreadablePool *GetTreadablePool(void) { return ms_pTreadablePool; }
static CObjectPool *GetObjectPool(void) { return ms_pObjectPool; }
static CDummyPool *GetDummyPool(void) { return ms_pDummyPool; }
+ static CAudioScriptObjectPool *GetAudioScriptObjectPool(void) { return ms_pAudioScriptObjectPool; }
static void Initialise(void);
+ static int32 GetPedRef(CPed *ped);
+ static CPed *GetPed(int32 handle);
+ static int32 GetVehicleRef(CVehicle *vehicle);
+ static CVehicle *GetVehicle(int32 handle);
+ static int32 GetObjectRef(CObject *object);
+ static CObject *GetObject(int32 handle);
};
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 921586bb..01bbf82e 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -4,6 +4,7 @@
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
int32 &CStats::HeadShots = *(int32*)0x8F647C;
bool& CStats::CommercialPassed = *(bool*)0x8F4334;
+bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 30058a59..c536465f 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -6,6 +6,7 @@ public:
static int32 &DaysPassed;
static int32 &HeadShots;
static bool& CommercialPassed;
+ static bool& IndustrialPassed;
static int32 &NumberKillFrenziesPassed;
static int32 &PeopleKilledByOthers;
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index a23e35be..9d9241e4 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1048,8 +1048,6 @@ CStreaming::RemoveReferencedTxds(int32 mem)
return false;
}
-// TODO: RemoveCurrentZonesModels
-
void
CStreaming::RemoveUnusedModelsInLoadedList(void)
{
diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h
index e1882e69..27f4ecca 100644
--- a/src/core/SurfaceTable.h
+++ b/src/core/SurfaceTable.h
@@ -77,6 +77,8 @@ enum eSurfaceType
SURFACE_LOOSE30,
SURFACE_BOLLARD,
SURFACE_GATE,
+
+ // These are illegal
SURFACE_SAND33,
SURFACE_ROAD34,
};
diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp
index 4608bfef..7b865311 100644
--- a/src/core/Wanted.cpp
+++ b/src/core/Wanted.cpp
@@ -1,65 +1,102 @@
#include "common.h"
#include "patcher.h"
+#include "Pools.h"
+#include "ModelIndices.h"
+#include "Timer.h"
+#include "World.h"
+#include "ZoneCull.h"
+#include "Darkel.h"
+#include "DMAudio.h"
#include "Wanted.h"
-int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714;
+int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714; // 6
+int32 &CWanted::nMaximumWantedLevel = *(int32*)0x5F7718; // 6400
-bool CWanted::AreSwatRequired()
+void
+CWanted::Initialise()
+{
+ int i;
+
+ m_nChaos = 0;
+ m_nLastUpdateTime = 0;
+ m_nLastWantedLevelChange = 0;
+ m_CurrentCops = 0;
+ m_MaxCops = 0;
+ m_MaximumLawEnforcerVehicles = 0;
+ m_RoadblockDensity = 0;
+ m_bIgnoredByCops = false;
+ m_bIgnoredByEveryone = false;
+ m_bSwatRequired = false;
+ m_bFbiRequired = false;
+ m_bArmyRequired = false;
+ m_fCrimeSensitivity = 1.0f;
+ m_nWantedLevel = 0;
+ m_CopsBeatingSuspect = 0;
+ for(i = 0; i < 10; i++)
+ m_pCops[i] = nil;
+ ClearQdCrimes();
+}
+
+bool
+CWanted::AreSwatRequired()
{
return m_nWantedLevel >= 4;
}
-bool CWanted::AreFbiRequired()
+bool
+CWanted::AreFbiRequired()
{
return m_nWantedLevel >= 5;
}
-bool CWanted::AreArmyRequired()
+bool
+CWanted::AreArmyRequired()
{
return m_nWantedLevel >= 6;
}
-int CWanted::NumOfHelisRequired()
+int32
+CWanted::NumOfHelisRequired()
{
- if (m_IsIgnoredByCops)
+ if (m_bIgnoredByCops)
return 0;
- // Return value is number of helicopters, no need to name them.
switch (m_nWantedLevel) {
- case WANTEDLEVEL_3:
- case WANTEDLEVEL_4:
+ case 3:
+ case 4:
return 1;
- case WANTEDLEVEL_5:
- case WANTEDLEVEL_6:
+ case 5:
+ case 6:
return 2;
default:
return 0;
}
}
-void CWanted::SetWantedLevel(int32 level)
+void
+CWanted::SetWantedLevel(int32 level)
{
ClearQdCrimes();
switch (level) {
- case NOTWANTED:
+ case 0:
m_nChaos = 0;
break;
- case WANTEDLEVEL_1:
+ case 1:
m_nChaos = 60;
break;
- case WANTEDLEVEL_2:
+ case 2:
m_nChaos = 220;
break;
- case WANTEDLEVEL_3:
+ case 3:
m_nChaos = 420;
break;
- case WANTEDLEVEL_4:
+ case 4:
m_nChaos = 820;
break;
- case WANTEDLEVEL_5:
+ case 5:
m_nChaos = 1620;
break;
- case WANTEDLEVEL_6:
+ case 6:
m_nChaos = 3220;
break;
default:
@@ -70,61 +107,212 @@ void CWanted::SetWantedLevel(int32 level)
UpdateWantedLevel();
}
-void CWanted::SetWantedLevelNoDrop(int32 level)
+void
+CWanted::SetWantedLevelNoDrop(int32 level)
{
if (level > m_nWantedLevel)
SetWantedLevel(level);
}
-void CWanted::ClearQdCrimes()
+void
+CWanted::SetMaximumWantedLevel(int32 level)
{
- for (int i = 0; i < 16; i++) {
- m_sCrimes[i].m_eCrimeType = CRIME_NONE;
+ switch(level){
+ case 0:
+ nMaximumWantedLevel = 0;
+ MaximumWantedLevel = 0;
+ break;
+ case 1:
+ nMaximumWantedLevel = 120;
+ MaximumWantedLevel = 1;
+ break;
+ case 2:
+ nMaximumWantedLevel = 300;
+ MaximumWantedLevel = 2;
+ break;
+ case 3:
+ nMaximumWantedLevel = 600;
+ MaximumWantedLevel = 3;
+ break;
+ case 4:
+ nMaximumWantedLevel = 1200;
+ MaximumWantedLevel = 4;
+ break;
+ case 5:
+ nMaximumWantedLevel = 2400;
+ MaximumWantedLevel = 5;
+ break;
+ case 6:
+ nMaximumWantedLevel = 4800;
+ MaximumWantedLevel = 6;
+ break;
}
}
-void CWanted::UpdateWantedLevel()
+void
+CWanted::RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare)
+{
+ AddCrimeToQ(type, id, coors, false, policeDoesntCare);
+}
+
+void
+CWanted::RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare)
+{
+ if(!AddCrimeToQ(type, id, coors, false, policeDoesntCare))
+ ReportCrimeNow(type, coors, policeDoesntCare);
+}
+
+void
+CWanted::ClearQdCrimes()
+{
+ for (int i = 0; i < 16; i++)
+ m_aCrimes[i].m_nType = CRIME_NONE;
+}
+
+// returns whether the crime had been reported already
+bool
+CWanted::AddCrimeToQ(eCrimeType type, int32 id, const CVector &coors, bool reported, bool policeDoesntCare)
+{
+ int i;
+
+ for(i = 0; i < 16; i++)
+ if(m_aCrimes[i].m_nType == type && m_aCrimes[i].m_nId == id){
+ if(m_aCrimes[i].m_bReported)
+ return true;
+ if(reported)
+ m_aCrimes[i].m_bReported = reported;
+ return false;
+ }
+
+ for(i = 0; i < 16; i++)
+ if(m_aCrimes[i].m_nType == CRIME_NONE)
+ break;
+ if(i < 16){
+ m_aCrimes[i].m_nType = type;
+ m_aCrimes[i].m_nId = id;
+ m_aCrimes[i].m_vecPosn = coors;
+ m_aCrimes[i].m_nTime = CTimer::GetTimeInMilliseconds();
+ m_aCrimes[i].m_bReported = reported;
+ m_aCrimes[i].m_bPoliceDoesntCare = policeDoesntCare;
+ }
+ return false;
+}
+
+void
+CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesntCare)
+{
+ float sensitivity, chaos;
+ int wantedLevelDrop;
+
+ if(CDarkel::FrenzyOnGoing())
+ sensitivity = m_fCrimeSensitivity*0.3f;
+ else
+ sensitivity = m_fCrimeSensitivity;
+
+ wantedLevelDrop = min(CCullZones::GetWantedLevelDrop(), 100);
+
+ chaos = (1.0f - wantedLevelDrop/100.0f) * sensitivity;
+ if (policeDoesntCare)
+ chaos *= 0.333f;
+ switch(type){
+ case CRIME_POSSESSION_GUN:
+ break;
+ case CRIME_HIT_PED:
+ m_nChaos += 5.0f*chaos;
+ break;
+ case CRIME_HIT_COP:
+ m_nChaos += 45.0f*chaos;
+ break;
+ case CRIME_SHOOT_PED:
+ m_nChaos += 30.0f*chaos;
+ break;
+ case CRIME_SHOOT_COP:
+ m_nChaos += 80.0f*chaos;
+ break;
+ case CRIME_STEAL_CAR:
+ m_nChaos += 15.0f*chaos;
+ break;
+ case CRIME_RUN_REDLIGHT:
+ m_nChaos += 10.0f*chaos;
+ break;
+ case CRIME_RECKLESS_DRIVING:
+ m_nChaos += 5.0f*chaos;
+ break;
+ case CRIME_SPEEDING:
+ m_nChaos += 5.0f*chaos;
+ break;
+ case CRIME_RUNOVER_PED:
+ m_nChaos += 18.0f*chaos;
+ break;
+ case CRIME_RUNOVER_COP:
+ m_nChaos += 80.0f*chaos;
+ break;
+ case CRIME_SHOOT_HELI:
+ m_nChaos += 400.0f*chaos;
+ break;
+ case CRIME_PED_BURNED:
+ m_nChaos += 20.0f*chaos;
+ break;
+ case CRIME_COP_BURNED:
+ m_nChaos += 80.0f*chaos;
+ break;
+ case CRIME_VEHICLE_BURNED:
+ m_nChaos += 20.0f*chaos;
+ break;
+ case CRIME_DESTROYED_CESSNA:
+ m_nChaos += 500.0f*chaos;
+ break;
+ default:
+ // Error("Undefined crime type, RegisterCrime, Crime.cpp"); // different file for some reason
+ Error("Undefined crime type, RegisterCrime, Wanted.cpp");
+ }
+ DMAudio.ReportCrime(type, coors);
+ UpdateWantedLevel();
+}
+
+void
+CWanted::UpdateWantedLevel()
{
int32 CurrWantedLevel = m_nWantedLevel;
if (m_nChaos >= 0 && m_nChaos < 40) {
- m_nWantedLevel = NOTWANTED;
+ m_nWantedLevel = 0;
m_MaximumLawEnforcerVehicles = 0;
m_MaxCops = 0;
m_RoadblockDensity = 0;
}
else if (m_nChaos >= 40 && m_nChaos < 200) {
- m_nWantedLevel = WANTEDLEVEL_1;
+ m_nWantedLevel = 1;
m_MaximumLawEnforcerVehicles = 1;
m_MaxCops = 1;
m_RoadblockDensity = 0;
}
else if (m_nChaos >= 200 && m_nChaos < 400) {
- m_nWantedLevel = WANTEDLEVEL_2;
+ m_nWantedLevel = 2;
m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 3;
m_RoadblockDensity = 0;
}
else if (m_nChaos >= 400 && m_nChaos < 800) {
- m_nWantedLevel = WANTEDLEVEL_3;
+ m_nWantedLevel = 3;
m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 4;
m_RoadblockDensity = 4;
}
else if (m_nChaos >= 800 && m_nChaos < 1600) {
- m_nWantedLevel = WANTEDLEVEL_4;
+ m_nWantedLevel = 4;
m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 6;
m_RoadblockDensity = 8;
}
else if (m_nChaos >= 1600 && m_nChaos < 3200) {
- m_nWantedLevel = WANTEDLEVEL_5;
+ m_nWantedLevel = 5;
m_MaximumLawEnforcerVehicles = 3;
m_MaxCops = 8;
m_RoadblockDensity = 10;
}
else if (m_nChaos >= 3200) {
- m_nWantedLevel = WANTEDLEVEL_6;
+ m_nWantedLevel = 6;
m_MaximumLawEnforcerVehicles = 3;
m_MaxCops = 10;
m_RoadblockDensity = 12;
@@ -132,4 +320,58 @@ void CWanted::UpdateWantedLevel()
if (CurrWantedLevel != m_nWantedLevel)
m_nLastWantedLevelChange = CTimer::GetTimeInMilliseconds();
-} \ No newline at end of file
+}
+
+int32
+CWanted::WorkOutPolicePresence(CVector posn, float radius)
+{
+ int i;
+ CPed *ped;
+ CVehicle *vehicle;
+ int numPolice = 0;
+
+ i = CPools::GetPedPool()->GetSize();
+ while(--i >= 0){
+ ped = CPools::GetPedPool()->GetSlot(i);
+ if(ped &&
+ IsPolicePedModel(ped->GetModelIndex()) &&
+ (posn - ped->GetPosition()).Magnitude() < radius)
+ numPolice++;
+ }
+
+ i = CPools::GetVehiclePool()->GetSize();
+ while(--i >= 0){
+ vehicle = CPools::GetVehiclePool()->GetSlot(i);
+ if(vehicle &&
+ vehicle->bIsLawEnforcer &&
+ IsPoliceVehicleModel(vehicle->GetModelIndex()) &&
+ vehicle != FindPlayerVehicle() &&
+ vehicle->m_status != STATUS_ABANDONED && vehicle->m_status != STATUS_WRECKED &&
+ (posn - vehicle->GetPosition()).Magnitude() < radius)
+ numPolice++;
+ }
+
+ return numPolice;
+}
+
+STARTPATCHES
+ InjectHook(0x4AD6E0, &CWanted::Initialise, PATCH_JUMP);
+// InjectHook(0x4AD790, &CWanted::Reset, PATCH_JUMP);
+// InjectHook(0x4AD7B0, &CWanted::Update, PATCH_JUMP);
+ InjectHook(0x4AD900, &CWanted::UpdateWantedLevel, PATCH_JUMP);
+ InjectHook(0x4AD9F0, &CWanted::RegisterCrime, PATCH_JUMP);
+ InjectHook(0x4ADA10, &CWanted::RegisterCrime_Immediately, PATCH_JUMP);
+ InjectHook(0x4ADA50, &CWanted::SetWantedLevel, PATCH_JUMP);
+ InjectHook(0x4ADAC0, &CWanted::SetWantedLevelNoDrop, PATCH_JUMP);
+ InjectHook(0x4ADAE0, &CWanted::SetMaximumWantedLevel, PATCH_JUMP);
+ InjectHook(0x4ADBA0, &CWanted::AreSwatRequired, PATCH_JUMP);
+ InjectHook(0x4ADBC0, &CWanted::AreFbiRequired, PATCH_JUMP);
+ InjectHook(0x4ADBE0, &CWanted::AreArmyRequired, PATCH_JUMP);
+ InjectHook(0x4ADC00, &CWanted::NumOfHelisRequired, PATCH_JUMP);
+// InjectHook(0x4ADC40, &CWanted::ResetPolicePursuit, PATCH_JUMP);
+ InjectHook(0x4ADD00, &CWanted::WorkOutPolicePresence, PATCH_JUMP);
+ InjectHook(0x4ADF20, &CWanted::ClearQdCrimes, PATCH_JUMP);
+ InjectHook(0x4ADFD0, &CWanted::AddCrimeToQ, PATCH_JUMP);
+// InjectHook(0x4AE090, &CWanted::UpdateCrimesQ, PATCH_JUMP);
+ InjectHook(0x4AE110, &CWanted::ReportCrimeNow, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/core/Wanted.h b/src/core/Wanted.h
index d3f6638b..1a72f839 100644
--- a/src/core/Wanted.h
+++ b/src/core/Wanted.h
@@ -1,16 +1,38 @@
#pragma once
-#include "Entity.h"
-#include "math/Vector.h"
-#include "CopPed.h"
-
-enum eWantedLevel {
- NOTWANTED,
- WANTEDLEVEL_1,
- WANTEDLEVEL_2,
- WANTEDLEVEL_3,
- WANTEDLEVEL_4,
- WANTEDLEVEL_5,
- WANTEDLEVEL_6,
+
+class CEntity;
+class CCopPed;
+
+enum eCrimeType
+{
+ CRIME_NONE,
+ CRIME_POSSESSION_GUN,
+ CRIME_HIT_PED,
+ CRIME_HIT_COP,
+ CRIME_SHOOT_PED,
+ CRIME_SHOOT_COP,
+ CRIME_STEAL_CAR,
+ CRIME_RUN_REDLIGHT,
+ CRIME_RECKLESS_DRIVING,
+ CRIME_SPEEDING,
+ CRIME_RUNOVER_PED,
+ CRIME_RUNOVER_COP,
+ CRIME_SHOOT_HELI,
+ CRIME_PED_BURNED,
+ CRIME_COP_BURNED,
+ CRIME_VEHICLE_BURNED,
+ CRIME_DESTROYED_CESSNA,
+};
+
+class CCrimeBeingQd
+{
+public:
+ eCrimeType m_nType;
+ uint32 m_nId;
+ int32 m_nTime;
+ CVector m_vecPosn;
+ bool m_bReported;
+ bool m_bPoliceDoesntCare;
};
class CWanted
@@ -23,28 +45,37 @@ public:
uint8 m_CurrentCops;
uint8 m_MaxCops;
uint8 m_MaximumLawEnforcerVehicles;
- int8 field_19;
+ uint8 m_CopsBeatingSuspect;
int16 m_RoadblockDensity;
- uint8 m_IsIgnoredByCops : 1;
- uint8 m_IsIgnoredByEveryOne : 1;
- uint8 m_IsSwatRequired : 1;
- uint8 m_IsFbiRequired : 1;
- uint8 m_IdArmyRequired : 1;
- int8 field_23;
+ uint8 m_bIgnoredByCops : 1;
+ uint8 m_bIgnoredByEveryone : 1;
+ uint8 m_bSwatRequired : 1;
+ uint8 m_bFbiRequired : 1;
+ uint8 m_bArmyRequired : 1;
int32 m_nWantedLevel;
- CCrime m_sCrimes[16];
+ CCrimeBeingQd m_aCrimes[16];
CCopPed *m_pCops[10];
+
static int32 &MaximumWantedLevel;
+ static int32 &nMaximumWantedLevel;
public:
+ void Initialise();
bool AreSwatRequired();
bool AreFbiRequired();
bool AreArmyRequired();
- int NumOfHelisRequired();
+ int32 NumOfHelisRequired();
void SetWantedLevel(int32);
void SetWantedLevelNoDrop(int32 level);
+ void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
+ void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
void ClearQdCrimes();
+ bool AddCrimeToQ(eCrimeType type, int32 id, const CVector &pos, bool reported, bool policeDoesntCare);
+ void ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesntCare);
void UpdateWantedLevel();
+
+ static int32 WorkOutPolicePresence(CVector posn, float radius);
+ static void SetMaximumWantedLevel(int32 level);
};
static_assert(sizeof(CWanted) == 0x204, "CWanted: error");
diff --git a/src/core/World.cpp b/src/core/World.cpp
index a31f87a7..829a64d4 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -11,11 +11,13 @@
#include "Garages.h"
#include "TempColModels.h"
#include "World.h"
+#include "ModelIndices.h"
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
+CColPoint &CWorld::ms_testSpherePoint = *(CColPoint*)0x6E64C0;
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
CPlayerInfo *CWorld::Players = (CPlayerInfo *)0x9412F0;
@@ -26,6 +28,8 @@ bool &CWorld::bSecondShift = *(bool*)0x95CD54;
bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
+WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); }
+
void
CWorld::Add(CEntity *ent)
{
@@ -603,12 +607,12 @@ CWorld::FindObjectsInRange(CVector &centre, float distance, bool ignoreZ, short
minY = 0;
int maxX = GetSectorIndexX(centre.x + distance);
- if (maxX >= 100)
- maxX = 100;
+ if (maxX >= NUMSECTORS_X)
+ maxX = NUMSECTORS_X;
int maxY = GetSectorIndexY(centre.y + distance);
- if (maxY >= 100)
- maxY = 100;
+ if (maxY >= NUMSECTORS_Y)
+ maxY = NUMSECTORS_Y;
AdvanceCurrentScanCode();
@@ -617,27 +621,156 @@ CWorld::FindObjectsInRange(CVector &centre, float distance, bool ignoreZ, short
for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY);
if (checkBuildings) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ }
+ if (checkVehicles) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ }
+ if (checkPeds) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ }
+ if (checkObjects) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ }
+ if (checkDummies) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ }
+ }
+ }
+}
+
+CEntity*
+CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity* entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
+{
+ CEntity* foundE = nil;
+
+ int minX = GetSectorIndexX(centre.x - distance);
+ if (minX <= 0)
+ minX = 0;
+
+ int minY = GetSectorIndexY(centre.y - distance);
+ if (minY <= 0)
+ minY = 0;
+
+ int maxX = GetSectorIndexX(centre.x + distance);
+ if (maxX >= NUMSECTORS_X)
+ maxX = NUMSECTORS_X;
+
+ int maxY = GetSectorIndexY(centre.y + distance);
+ if (maxY >= NUMSECTORS_Y)
+ maxY = NUMSECTORS_Y;
+
+ AdvanceCurrentScanCode();
+
+ for (int curY = minY; curY <= maxY; curY++) {
+ for (int curX = minX; curX <= maxX; curX++) {
+ CSector* sector = GetSector(curX, curY);
+ if (checkBuildings) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
}
if (checkVehicles) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
}
if (checkPeds) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
}
if (checkObjects) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, entityToIgnore, ignoreSomeObjects);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, entityToIgnore, ignoreSomeObjects);
+ if (foundE)
+ return foundE;
}
if (checkDummies) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
}
}
}
+ return foundE;
+}
+
+CEntity*
+CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float radius, CEntity *entityToIgnore, bool ignoreSomeObjects)
+{
+ static CColModel sphereCol;
+
+ sphereCol.boundingSphere.center.x = 0.0f;
+ sphereCol.boundingSphere.center.y = 0.0f;
+ sphereCol.boundingSphere.center.z = 0.0f;
+ sphereCol.boundingSphere.radius = radius;
+ sphereCol.boundingBox.min.x = -radius;
+ sphereCol.boundingBox.min.y = -radius;
+ sphereCol.boundingBox.min.z = -radius;
+ sphereCol.boundingBox.max.x = radius;
+ sphereCol.boundingBox.max.y = radius;
+ sphereCol.boundingBox.max.z = radius;
+ sphereCol.numSpheres = 1;
+ sphereCol.spheres = &sphereCol.boundingSphere;
+ sphereCol.numLines = 0;
+ sphereCol.numBoxes = 0;
+ sphereCol.numTriangles = 0;
+ sphereCol.ownsCollisionVolumes = false;
+
+ CMatrix sphereMat;
+ sphereMat.SetTranslate(spherePos);
+
+ for(CPtrNode *node=list.first; node; node = node->next) {
+ CEntity *e = (CEntity*)node->item;
+
+ if (e->m_scanCode != GetCurrentScanCode()) {
+ e->m_scanCode = GetCurrentScanCode();
+
+ if (e != entityToIgnore && e->bUsesCollision && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
+ CVector diff = spherePos - e->GetPosition();
+ float distance = diff.Magnitude();
+
+ if (e->GetBoundRadius() + radius > distance) {
+ CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel();
+ int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(),
+ *eCol, &ms_testSpherePoint, nil, nil);
+
+ if (collidedSpheres != 0 ||
+ (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR &&
+ e->m_modelIndex != MI_DODO && radius + eCol->boundingBox.max.x > distance)) {
+ return e;
+ }
+ }
+ }
+ }
+ }
+
+ return nil;
}
float
@@ -790,6 +923,8 @@ STARTPATCHES
InjectHook(0x4B2200, CWorld::FindObjectsInRange, PATCH_JUMP);
InjectHook(0x4B2540, CWorld::FindObjectsInRangeSectorList, PATCH_JUMP);
+ InjectHook(0x4B4AC0, CWorld::TestSphereAgainstSectorList, PATCH_JUMP);
+ InjectHook(0x4B4710, CWorld::TestSphereAgainstWorld, PATCH_JUMP);
InjectHook(0x4B3A80, CWorld::FindGroundZForCoord, PATCH_JUMP);
InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP);
InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP);
diff --git a/src/core/World.h b/src/core/World.h
index d6063d70..fd9d6fc3 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -56,6 +56,7 @@ class CWorld
static CPtrList &ms_listMovingEntityPtrs;
static CSector (*ms_aSectors)[NUMSECTORS_X]; // [NUMSECTORS_Y][NUMSECTORS_X];
static uint16 &ms_nCurrentScanCode;
+ static CColPoint &ms_testSpherePoint;
public:
static uint8 &PlayerInFocus;
@@ -94,11 +95,14 @@ public:
static bool GetIsLineOfSightSectorClear(CSector &sector, 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 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);
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
static float FindRoofZFor3DCoord(float x, float y, float z, bool *found);
+ static void RemoveReferencesToDeletedObject(CEntity*);
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
diff --git a/src/core/common.h b/src/core/common.h
index 71c27492..9a5683c6 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -97,11 +97,11 @@ extern void **rwengine;
#define SCREEN_SCALE_AR(a) (a)
#endif
-#include "math/maths.h"
-#include "math/Vector.h"
-#include "math/Vector2D.h"
-#include "math/Matrix.h"
-#include "math/Rect.h"
+#include "maths.h"
+#include "Vector.h"
+#include "Vector2D.h"
+#include "Matrix.h"
+#include "Rect.h"
class CRGBA
{
@@ -139,7 +139,8 @@ inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x))
#define PI M_PI
-#define TWOPI PI*2
+#define TWOPI (PI*2)
+#define HALFPI (PI/2)
#define DEGTORAD(x) ((x) * PI / 180.0f)
#define RADTODEG(x) ((x) * 180.0f / PI)
@@ -178,6 +179,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
+#define ABS(a) (((a) < 0) ? (-a) : (a))
#define STRINGIFY(x) #x
@@ -294,4 +296,4 @@ _TWEEKCLASS(CTweakInt32, int32);
_TWEEKCLASS(CTweakUInt32, uint32);
_TWEEKCLASS(CTweakFloat, float);
-#undef _TWEEKCLASS \ No newline at end of file
+#undef _TWEEKCLASS
diff --git a/src/core/config.h b/src/core/config.h
index 2dbfc95f..892a06b6 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -63,6 +63,7 @@ enum Config {
NUMONSCREENTIMERENTRIES = 1,
NUMRADARBLIPS = 32,
NUMPICKUPS = 336,
+ NUMEVENTS = 64,
};
// 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 e301b470..04fee197 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -295,6 +295,8 @@ void
RenderDebugShit(void)
{
// CTheScripts::RenderTheScriptDebugLines()
+ if(gbShowCollisionLines)
+ CRenderer::RenderCollisionLines();
}
void
diff --git a/src/core/main.h b/src/core/main.h
index 9f27e05e..9b3c27f5 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -27,4 +27,5 @@ void LoadingIslandScreen(const char *levelName);
CSprite2d *LoadSplash(const char *name);
char *GetLevelSplashScreen(int level);
char *GetRandomSplashScreen(void);
-void ValidateVersion(); \ No newline at end of file
+void LittleTest(void);
+void ValidateVersion();
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index e3aece97..a0032bc6 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -10,6 +10,7 @@
#include "Clock.h"
#include "World.h"
#include "Vehicle.h"
+#include "ModelIndices.h"
#include "Streaming.h"
#include "PathFind.h"
#include "Boat.h"
@@ -58,8 +59,6 @@ mysrand(unsigned int seed)
myrand_seed = seed;
}
-int gDbgSurf;
-
void (*DebugMenuProcess)(void);
void (*DebugMenuRender)(void);
static void stub(void) { }
@@ -102,60 +101,43 @@ void ChittyChittyBangBangCheat();
void StrongGripCheat();
void NastyLimbsCheat();
-// needs too much stuff for now
-#if 0
+DebugMenuEntry *carCol1;
+DebugMenuEntry *carCol2;
+
void
-spawnCar(int id)
+SpawnCar(int id)
{
CVector playerpos;
CStreaming::RequestModel(id, 0);
CStreaming::LoadAllRequestedModels(false);
if(CStreaming::HasModelLoaded(id)){
- FindPlayerCoors(playerpos);
+ playerpos = FindPlayerCoors();
int node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false);
if(node < 0)
return;
CVehicle *v;
- if(CModelInfo::IsBoatModel(id)){
-// CBoat* boat = (CBoat*)CVehicle__new(0x484);
-// boat = boat->ctor(id, 1);
-// v = (CVehicle*)(boat);
- }else{
-// CAutomobile *au = (CAutomobile*)CVehicle__new(0x5A8);
-// au = au->ctor(id, 1);
-// v = (CVehicle*)au;
- }
-/*
- // unlock doors
- FIELD(int, v, 0x224) = 1;
- // set player owned
- FIELD(uint8, v, 0x1F7) |= 4;
-
- DebugMenuEntrySetAddress(carCol1, &FIELD(uchar, v, 0x19C));
- DebugMenuEntrySetAddress(carCol2, &FIELD(uchar, v, 0x19D));
- //if(id == MODELID_ESPERANTO)
- // FIELD(uchar, v, 0x19C) = 54;
-
- v->matrix.matrix.pos.x = ThePaths.nodes[node].x;
- v->matrix.matrix.pos.y = ThePaths.nodes[node].y;
- v->matrix.matrix.pos.z = ThePaths.nodes[node].z + 4.0f;
- float x = v->matrix.matrix.pos.x;
- float y = v->matrix.matrix.pos.y;
- float z = v->matrix.matrix.pos.z;
- v->matrix.SetRotate(0.0f, 0.0f, 3.49f);
- v->matrix.matrix.pos.x += x;
- v->matrix.matrix.pos.y += y;
- v->matrix.matrix.pos.z += z;
- v->bfTypeStatus = v->bfTypeStatus & 7 | 0x20;
- FIELD(int, v, 0x224) = 1;
-*/
+ if(CModelInfo::IsBoatModel(id))
+ return;
+ else
+ v = new CAutomobile(id, RANDOM_VEHICLE);
+
+ v->bHasBeenOwnedByPlayer = true;
+ if(carCol1)
+ DebugMenuEntrySetAddress(carCol1, &v->m_currentColour1);
+ if(carCol2)
+ DebugMenuEntrySetAddress(carCol2, &v->m_currentColour2);
+
+ v->GetPosition() = ThePaths.m_pathNodes[node].pos;
+ v->GetPosition().z += 4.0f;
+ v->SetOrientation(0.0f, 0.0f, 3.49f);
+ v->m_status = STATUS_ABANDONED;
+ v->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(v);
}
}
-#endif
-void
+static void
FixCar(void)
{
CVehicle *veh = FindPlayerVehicle();
@@ -168,6 +150,34 @@ FixCar(void)
((CAutomobile*)veh)->Fix();
}
+static void
+ToggleComedy(void)
+{
+ CVehicle *veh = FindPlayerVehicle();
+ if(veh == nil)
+ return;
+ veh->bComedyControls = !veh->bComedyControls;
+}
+
+static void
+PlaceOnRoad(void)
+{
+ CVehicle *veh = FindPlayerVehicle();
+ if(veh == nil)
+ return;
+
+ if(veh->IsCar())
+ ((CAutomobile*)veh)->PlaceOnRoadProperly();
+}
+
+static const char *carnames[] = {
+ "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", "manana", "infernus", "blista", "pony",
+ "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "kuruma", "bobcat", "mrwhoop", "bfinject", "corpse", "police", "enforcer",
+ "securica", "banshee", "predator", "bus", "rhino", "barracks", "train", "chopper", "dodo", "coach", "cabbie", "stallion", "rumpo", "rcbandit",
+ "bellyup", "mrwongs", "mafia", "yardie", "yakuza", "diablos", "columb", "hoods", "airtrain", "deaddodo", "speeder", "reefer", "panlant", "flatbed",
+ "yankee", "escape", "borgnine", "toyz", "ghost",
+};
+
static std::list<CTweakVar *> TweakVarsList;
static bool bAddTweakVarsNow = false;
static const char *pTweakVarsDefaultPath = NULL;
@@ -259,15 +269,48 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat);
DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat);
+ static int spawnCarId = MI_LANDSTAL;
+ e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_GHOST, carnames);
+ DebugMenuEntrySetWrap(e, true);
+ DebugMenuAddCmd("Spawn", "Spawn Car", [](){
+ if(spawnCarId == MI_TRAIN ||
+ spawnCarId == MI_CHOPPER ||
+ spawnCarId == MI_AIRTRAIN ||
+ spawnCarId == MI_DEADDODO ||
+ spawnCarId == MI_ESCAPE)
+ return;
+ SpawnCar(spawnCarId);
+ });
+ static uint8 dummy;
+ carCol1 = DebugMenuAddVar("Spawn", "First colour", &dummy, nil, 1, 0, 255, nil);
+ carCol2 = DebugMenuAddVar("Spawn", "Second colour", &dummy, nil, 1, 0, 255, nil);
+ DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); });
+ DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); });
+ DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); });
+ DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); });
+ DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); });
+ DebugMenuAddCmd("Spawn", "Spawn Kuruma", [](){ SpawnCar(MI_KURUMA); });
+ DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); });
+ DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); });
+ DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
+ DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
+ DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); });
+ DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
+
+
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
+ DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
+ DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
+
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);
DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil);
DebugMenuAddVarBool8("Debug", "Don't render Buildings", (int8*)&gbDontRenderBuildings, nil);
DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", (int8*)&gbDontRenderBigBuildings, nil);
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);
- DebugMenuAddVar("Debug", "Dbg Surface", &gDbgSurf, nil, 1, 0, 34, nil);
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);