summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-04-14 23:10:50 +0200
committerSergeanur <s.anureev@yandex.ua>2020-04-14 23:10:50 +0200
commite373d0526ef07183cba8e89aba46f2ab416e67ba (patch)
treee6b2052e078cd2ad2ae1503262421c6858a20a0f /src/core
parentCFont (diff)
parentRwMatFX support with linked RW libs (diff)
downloadre3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.gz
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.bz2
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.lz
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.xz
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.zst
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Cam.cpp18
-rw-r--r--src/core/Camera.cpp68
-rw-r--r--src/core/Camera.h37
-rw-r--r--src/core/Collision.cpp83
-rw-r--r--src/core/Collision.h1
-rw-r--r--src/core/CutsceneMgr.cpp440
-rw-r--r--src/core/CutsceneMgr.h50
-rw-r--r--src/core/Debug.cpp2
-rw-r--r--src/core/FileLoader.cpp167
-rw-r--r--src/core/FileLoader.h3
-rw-r--r--src/core/FrontEndControls.cpp1881
-rw-r--r--src/core/FrontEndControls.h712
-rw-r--r--src/core/Frontend.cpp3031
-rw-r--r--src/core/Frontend.h259
-rw-r--r--src/core/Game.cpp20
-rw-r--r--src/core/Game.h1
-rw-r--r--src/core/MenuScreens.h207
-rw-r--r--src/core/NodeName.cpp77
-rw-r--r--src/core/NodeName.h4
-rw-r--r--src/core/Pad.cpp407
-rw-r--r--src/core/Pad.h18
-rw-r--r--src/core/PlayerInfo.cpp900
-rw-r--r--src/core/PlayerSkin.cpp173
-rw-r--r--src/core/PlayerSkin.h21
-rw-r--r--src/core/Pools.cpp345
-rw-r--r--src/core/Profile.cpp71
-rw-r--r--src/core/Profile.h28
-rw-r--r--src/core/Radar.cpp2813
-rw-r--r--src/core/Radar.h34
-rw-r--r--src/core/RwClumpRead.cpp230
-rw-r--r--src/core/RwHelper.cpp381
-rw-r--r--src/core/RwHelper.h40
-rw-r--r--src/core/RwMatFX.cpp213
-rw-r--r--src/core/RwTexRead.cpp140
-rw-r--r--src/core/Stats.cpp303
-rw-r--r--src/core/Stats.h43
-rw-r--r--src/core/Streaming.cpp4
-rw-r--r--src/core/Timer.cpp36
-rw-r--r--src/core/Timer.h8
-rw-r--r--src/core/TxdStore.cpp209
-rw-r--r--src/core/TxdStore.h44
-rw-r--r--src/core/World.cpp2
-rw-r--r--src/core/World.h2
-rw-r--r--src/core/common.h6
-rw-r--r--src/core/config.h18
-rw-r--r--src/core/main.cpp1931
-rw-r--r--src/core/obrstr.cpp236
-rw-r--r--src/core/obrstr.h16
-rw-r--r--src/core/re3.cpp27
-rw-r--r--src/core/rw.cpp415
-rw-r--r--src/core/timebars.cpp240
-rw-r--r--src/core/timebars.h10
52 files changed, 10442 insertions, 5983 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 5b7a53e9..cfdea46a 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -3511,7 +3511,7 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
Up = CVector(0.0f, 0.0f, 1.0f);
if(TheCamera.m_bStartingSpline)
- m_fTimeElapsedFloat += CTimer::GetTimeStepInMilliseconds();
+ m_fTimeElapsedFloat += CTimer::GetTimeStepNonClippedInMilliseconds();
else{
m_fTimeElapsedFloat = 0.0f;
m_uiFinishTime = MS(TheCamera.m_arrPathArray[2].m_arr_PathData[10*((int)TheCamera.m_arrPathArray[2].m_arr_PathData[0]-1) + 1]);
@@ -4672,15 +4672,15 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
else {
switch ((int)TheCamera.CarZoomIndicator) {
// near
- case 1:
+ case CAM_ZOOM_1:
zoomModeAlphaOffset = ZmOneAlphaOffsetLCS[alphaArrPos];
break;
// mid
- case 2:
+ case CAM_ZOOM_2:
zoomModeAlphaOffset = ZmTwoAlphaOffsetLCS[alphaArrPos];
break;
// far
- case 3:
+ case CAM_ZOOM_3:
zoomModeAlphaOffset = ZmThreeAlphaOffsetLCS[alphaArrPos];
break;
default:
@@ -4705,14 +4705,12 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
}
} else {
// 0.6f = fTestShiftHeliCamTarget
- TargetCoors.x += 0.6f * car->GetUp().x * colMaxZ;
- TargetCoors.y += 0.6f * car->GetUp().y * colMaxZ;
- TargetCoors.z += 0.6f * car->GetUp().z * colMaxZ;
+ TargetCoors += 0.6f * car->GetUp() * colMaxZ;
}
float minDistForVehType = CARCAM_SET[camSetArrPos][4];
- if ((int)TheCamera.CarZoomIndicator == 1 && (camSetArrPos < 2 || camSetArrPos == 7)) {
+ if (TheCamera.CarZoomIndicator == CAM_ZOOM_1 && (camSetArrPos < 2 || camSetArrPos == 7)) {
minDistForVehType = minDistForVehType * 0.65f;
}
@@ -4904,8 +4902,8 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// yMovement = 0.0;
if (!nextDirectionIsForward) {
- yMovement = 0.0;
- xMovement = 0.0;
+ yMovement = 0.0f;
+ xMovement = 0.0f;
}
if (camSetArrPos == 0 || camSetArrPos == 7) {
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index e5bc09c8..91dd6573 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -124,8 +124,8 @@ CCamera::Init(void)
m_WideScreenOn = false;
m_fFOV_Wide_Screen = 0.0f;
m_bRestoreByJumpCut = false;
- CarZoomIndicator = 2.0f;
- PedZoomIndicator = 2.0f;
+ CarZoomIndicator = CAM_ZOOM_2;
+ PedZoomIndicator = CAM_ZOOM_2;
CarZoomValueSmooth = 0.0f;
m_fPedZoomValueSmooth = 0.0f;
pTargetEntity = nil;
@@ -142,7 +142,7 @@ CCamera::Init(void)
PlayerExhaustion = 1.0f;
DebugCamMode = CCam::MODE_NONE;
m_PedOrientForBehindOrInFront = 0.0f;
- if(!FrontEndMenuManager.m_bStartGameLoading){
+ if(!FrontEndMenuManager.m_bWantToRestart){
m_bFading = false;
CDraw::FadeValue = 0;
m_fFLOATingFade = 0.0f;
@@ -151,7 +151,7 @@ CCamera::Init(void)
m_fFLOATingFadeMusic = 0.0f;
}
m_bMoveCamToAvoidGeom = false;
- if(FrontEndMenuManager.m_bStartGameLoading)
+ if(FrontEndMenuManager.m_bWantToRestart)
m_bMoveCamToAvoidGeom = true;
m_bStartingSpline = false;
m_iTypeOfSwitch = INTERPOLATION;
@@ -623,11 +623,11 @@ CCamera::CamControl(void)
if(CPad::GetPad(0)->CycleCameraModeUpJustDown() && !CReplay::IsPlayingBack() &&
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
!m_WideScreenOn)
- CarZoomIndicator -= 1.0f;
+ CarZoomIndicator--;
if(CPad::GetPad(0)->CycleCameraModeDownJustDown() && !CReplay::IsPlayingBack() &&
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
!m_WideScreenOn)
- CarZoomIndicator += 1.0f;
+ CarZoomIndicator++;
if(!m_bFailedCullZoneTestPreviously){
if(CarZoomIndicator < CAM_ZOOM_1STPRS) CarZoomIndicator = CAM_ZOOM_CINEMATIC;
else if(CarZoomIndicator > CAM_ZOOM_CINEMATIC) CarZoomIndicator = CAM_ZOOM_1STPRS;
@@ -727,12 +727,24 @@ CCamera::CamControl(void)
if(CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage){
CarZoomValue = 0.0f;
ReqMode = CCam::MODE_1STPERSON;
- }else if(CarZoomIndicator == CAM_ZOOM_1)
- CarZoomValue = 0.05f;
+ }
+#ifdef FREE_CAM
+ else if (bFreeCam) {
+ if (CarZoomIndicator == CAM_ZOOM_1)
+ CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1;
+ else if (CarZoomIndicator == CAM_ZOOM_2)
+ CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2;
+ else if (CarZoomIndicator == CAM_ZOOM_3)
+ CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3;
+ }
+#endif
+ else if(CarZoomIndicator == CAM_ZOOM_1)
+ CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_1;
else if(CarZoomIndicator == CAM_ZOOM_2)
- CarZoomValue = 1.9f;
+ CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_2;
else if(CarZoomIndicator == CAM_ZOOM_3)
- CarZoomValue = 3.9f;
+ CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_3;
+
if(CarZoomIndicator == CAM_ZOOM_TOPDOWN && !m_bPlayerIsInGarage){
CarZoomValue = 1.0f;
ReqMode = CCam::MODE_TOPDOWN;
@@ -800,7 +812,7 @@ CCamera::CamControl(void)
else
PedZoomIndicator = CAM_ZOOM_TOPDOWN;
}else
- PedZoomIndicator -= 1.0f;
+ PedZoomIndicator--;
}
if(CPad::GetPad(0)->CycleCameraModeDownJustDown() && !CReplay::IsPlayingBack() &&
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
@@ -811,7 +823,7 @@ CCamera::CamControl(void)
else
PedZoomIndicator = CAM_ZOOM_TOPDOWN;
}else
- PedZoomIndicator += 1.0f;
+ PedZoomIndicator++;
}
// disabled obbe's cam here
if(PedZoomIndicator < CAM_ZOOM_1) PedZoomIndicator = CAM_ZOOM_TOPDOWN;
@@ -1211,7 +1223,7 @@ CCamera::CamControl(void)
ReqMode == CCam::MODE_1STPERSON_RUNABOUT || ReqMode == CCam::MODE_M16_1STPERSON_RUNABOUT ||
ReqMode == CCam::MODE_FIGHT_CAM_RUNABOUT || ReqMode == CCam::MODE_HELICANNON_1STPERSON ||
WhoIsInControlOfTheCamera == CAMCONTROL_SCRIPT ||
- m_bJustCameOutOfGarage || m_bPlayerIsInGarage)
+ m_bJustCameOutOfGarage || m_bPlayerIsInGarage)
canUseObbeCam = false;
if(m_bObbeCinematicPedCamOn && canUseObbeCam)
@@ -1512,7 +1524,7 @@ CCamera::UpdateTargetEntity(void)
cantOpen = false;
if(PLAYER->GetPedState() == PED_ENTER_CAR && !cantOpen){
- if(!enteringCar && CarZoomIndicator != 0.0f){
+ if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS){
pTargetEntity = PLAYER->m_pMyVehicle;
if(PLAYER->m_pMyVehicle == nil)
pTargetEntity = PLAYER;
@@ -1520,7 +1532,7 @@ CCamera::UpdateTargetEntity(void)
}
if((PLAYER->GetPedState() == PED_CARJACK || PLAYER->GetPedState() == PED_OPEN_DOOR) && !cantOpen){
- if(!enteringCar && CarZoomIndicator != 0.0f)
+ if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS)
#ifdef GTA_PS2_STUFF
// dunno if this has any amazing effects
{
@@ -1537,7 +1549,7 @@ CCamera::UpdateTargetEntity(void)
pTargetEntity = FindPlayerPed();
if(PLAYER->GetPedState() == PED_DRAG_FROM_CAR)
pTargetEntity = FindPlayerPed();
- if(pTargetEntity->IsVehicle() && CarZoomIndicator != 0.0f && FindPlayerPed()->GetPedState() == PED_ARRESTED)
+ if(pTargetEntity->IsVehicle() && CarZoomIndicator != CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED)
pTargetEntity = FindPlayerPed();
}
}
@@ -2956,11 +2968,23 @@ CCamera::SetZoomValueFollowPedScript(int16 dist)
void
CCamera::SetZoomValueCamStringScript(int16 dist)
{
- switch (dist) {
- case 0: m_fCarZoomValueScript = 0.05f; break;
- case 1: m_fCarZoomValueScript = 1.9f; break;
- case 2: m_fCarZoomValueScript = 3.9f; break;
- default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+#ifdef FREE_CAM
+ if (bFreeCam) {
+ switch (dist) {
+ case 0: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1; break;
+ case 1: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2; break;
+ case 2: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3; break;
+ default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+ }
+ } else
+#endif
+ {
+ switch (dist) {
+ case 0: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_1; break;
+ case 1: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_2; break;
+ case 2: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_3; break;
+ default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+ }
}
m_bUseScriptZoomValueCar = true;
@@ -3245,7 +3269,7 @@ void
CCamera::SetRwCamera(RwCamera *cam)
{
m_pRwCamera = cam;
- m_viewMatrix.Attach(&m_pRwCamera->viewMatrix, false);
+ m_viewMatrix.Attach(RwCameraGetViewMatrix(m_pRwCamera), false);
CMBlur::MotionBlurOpen(m_pRwCamera);
}
diff --git a/src/core/Camera.h b/src/core/Camera.h
index f21fe913..eca4518a 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -16,12 +16,29 @@ enum
};
#define DEFAULT_NEAR (0.9f)
-#define CAM_ZOOM_1STPRS (0.0f)
-#define CAM_ZOOM_1 (1.0f)
-#define CAM_ZOOM_2 (2.0f)
-#define CAM_ZOOM_3 (3.0f)
-#define CAM_ZOOM_TOPDOWN (4.0f)
-#define CAM_ZOOM_CINEMATIC (5.0f)
+enum
+{
+ CAM_ZOOM_1STPRS,
+ CAM_ZOOM_1,
+ CAM_ZOOM_2,
+ CAM_ZOOM_3,
+ CAM_ZOOM_TOPDOWN,
+ CAM_ZOOM_CINEMATIC,
+};
+
+#ifdef FREE_CAM // LCS values
+#define FREE_CAR_ZOOM_VALUE_1 (-1.0f)
+#define FREE_CAR_ZOOM_VALUE_2 (2.0f)
+#define FREE_CAR_ZOOM_VALUE_3 (6.0f)
+
+#define FREE_BOAT_ZOOM_VALUE_1 (-2.41f)
+#define FREE_BOAT_ZOOM_VALUE_2 (6.49f)
+#define FREE_BOAT_ZOOM_VALUE_3 (15.0f)
+#endif
+
+#define DEFAULT_CAR_ZOOM_VALUE_1 (0.05f)
+#define DEFAULT_CAR_ZOOM_VALUE_2 (1.9f)
+#define DEFAULT_CAR_ZOOM_VALUE_3 (3.9f)
class CCam
{
@@ -398,7 +415,11 @@ uint32 unknown; // some counter having to do with music
float CamFrontXNorm;
float CamFrontYNorm;
+#if 0 // TODO: FIX_BUGS once GenericLoad is done
+ int32 CarZoomIndicator;
+#else
float CarZoomIndicator;
+#endif
float CarZoomValue;
float CarZoomValueSmooth;
@@ -434,7 +455,11 @@ uint32 unknown; // some counter having to do with music
float m_ScreenReductionSpeed;
float m_AlphaForPlayerAnim1rstPerson;
float Orientation;
+#if 0 // TODO: FIX_BUGS once GenericLoad is done
+ int32 PedZoomIndicator;
+#else
float PedZoomIndicator;
+#endif
float PlayerExhaustion;
float SoundDistUp, SoundDistLeft, SoundDistRight;
float SoundDistUpAsRead, SoundDistLeftAsRead, SoundDistRightAsRead;
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index 94ef769e..c884f751 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -34,8 +34,6 @@ enum Direction
eLevelName &CCollision::ms_collisionInMemory = *(eLevelName*)0x8F6250;
CLinkList<CColModel*> &CCollision::ms_colModelCache = *(CLinkList<CColModel*>*)0x95CB58;
-WRAPPER bool CCollision::IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CColPoint &point, CStoredCollPoly *poly) { EAXJMP(0x4105A0); }
-
void
CCollision::Init(void)
{
@@ -927,6 +925,87 @@ CCollision::ProcessVerticalLineTriangle(const CColLine &line,
}
bool
+CCollision::IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CColPoint &point, CStoredCollPoly *poly)
+{
+ float t;
+
+ if(!poly->valid)
+ return false;
+
+ // maybe inlined?
+ CColTriangle tri;
+ tri.a = 0;
+ tri.b = 1;
+ tri.c = 2;
+ CColTrianglePlane plane;
+ plane.Set(poly->verts, tri);
+
+ const CVector &va = poly->verts[tri.a];
+ const CVector &vb = poly->verts[tri.b];
+ const CVector &vc = poly->verts[tri.c];
+ CVector p0 = pos;
+ CVector p1(pos.x, pos.y, z);
+
+ // The rest is pretty much CCollision::ProcessLineTriangle
+
+ // if points are on the same side, no collision
+ if(plane.CalcPoint(p0) * plane.CalcPoint(p1) > 0.0f)
+ return poly->valid = false;
+
+ // intersection parameter on line
+ t = -plane.CalcPoint(p0) / DotProduct(p1 - p0, plane.normal);
+ // find point of intersection
+ CVector p = p0 + (p1-p0)*t;
+
+ CVector2D vec1, vec2, vec3, vect;
+ switch(plane.dir){
+ case DIR_X_POS:
+ vec1.x = va.y; vec1.y = va.z;
+ vec2.x = vc.y; vec2.y = vc.z;
+ vec3.x = vb.y; vec3.y = vb.z;
+ vect.x = p.y; vect.y = p.z;
+ break;
+ case DIR_X_NEG:
+ vec1.x = va.y; vec1.y = va.z;
+ vec2.x = vb.y; vec2.y = vb.z;
+ vec3.x = vc.y; vec3.y = vc.z;
+ vect.x = p.y; vect.y = p.z;
+ break;
+ case DIR_Y_POS:
+ vec1.x = va.z; vec1.y = va.x;
+ vec2.x = vc.z; vec2.y = vc.x;
+ vec3.x = vb.z; vec3.y = vb.x;
+ vect.x = p.z; vect.y = p.x;
+ break;
+ case DIR_Y_NEG:
+ vec1.x = va.z; vec1.y = va.x;
+ vec2.x = vb.z; vec2.y = vb.x;
+ vec3.x = vc.z; vec3.y = vc.x;
+ vect.x = p.z; vect.y = p.x;
+ break;
+ case DIR_Z_POS:
+ vec1.x = va.x; vec1.y = va.y;
+ vec2.x = vc.x; vec2.y = vc.y;
+ vec3.x = vb.x; vec3.y = vb.y;
+ vect.x = p.x; vect.y = p.y;
+ break;
+ case DIR_Z_NEG:
+ vec1.x = va.x; vec1.y = va.y;
+ vec2.x = vb.x; vec2.y = vb.y;
+ vec3.x = vc.x; vec3.y = vc.y;
+ vect.x = p.x; vect.y = p.y;
+ break;
+ default:
+ assert(0);
+ }
+ if(CrossProduct2D(vec2-vec1, vect-vec1) < 0.0f) return poly->valid = false;
+ if(CrossProduct2D(vec3-vec1, vect-vec1) > 0.0f) return poly->valid = false;
+ if(CrossProduct2D(vec3-vec2, vect-vec2) < 0.0f) return poly->valid = false;
+ point.point = p;
+ return poly->valid = true;
+}
+
+bool
CCollision::ProcessLineTriangle(const CColLine &line ,
const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
CColPoint &point, float &mindist)
diff --git a/src/core/Collision.h b/src/core/Collision.h
index 429fc17f..1cbd1690 100644
--- a/src/core/Collision.h
+++ b/src/core/Collision.h
@@ -144,7 +144,6 @@ public:
static bool ProcessLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough);
static bool ProcessVerticalLine(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough, CStoredCollPoly *poly);
static int32 ProcessColModels(const CMatrix &matrixA, CColModel &modelA, const CMatrix &matrixB, CColModel &modelB, CColPoint *spherepoints, CColPoint *linepoints, float *linedists);
- // TODO:
static bool IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CColPoint &point, CStoredCollPoly *poly);
static float DistToLine(const CVector *l0, const CVector *l1, const CVector *point);
diff --git a/src/core/CutsceneMgr.cpp b/src/core/CutsceneMgr.cpp
deleted file mode 100644
index 283f34b8..00000000
--- a/src/core/CutsceneMgr.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-#define WITHWINDOWS // just for VK_SPACE
-#include "common.h"
-#include "patcher.h"
-#include "General.h"
-#include "CutsceneMgr.h"
-#include "Directory.h"
-#include "Camera.h"
-#include "Streaming.h"
-#include "FileMgr.h"
-#include "main.h"
-#include "AnimManager.h"
-#include "AnimBlendAssociation.h"
-#include "AnimBlendAssocGroup.h"
-#include "AnimBlendClumpData.h"
-#include "Pad.h"
-#include "DMAudio.h"
-#include "World.h"
-#include "PlayerPed.h"
-#include "Wanted.h"
-#include "CutsceneHead.h"
-#include "RpAnimBlend.h"
-#include "ModelIndices.h"
-#include "TempColModels.h"
-
-const struct {
- const char *szTrackName;
- int iTrackId;
-} musicNameIdAssoc[] = {
- { "JB", STREAMED_SOUND_NEWS_INTRO },
- { "BET", STREAMED_SOUND_BANK_INTRO },
- { "L1_LG", STREAMED_SOUND_CUTSCENE_LUIGI1_LG },
- { "L2_DSB", STREAMED_SOUND_CUTSCENE_LUIGI2_DSB },
- { "L3_DM", STREAMED_SOUND_CUTSCENE_LUIGI3_DM },
- { "L4_PAP", STREAMED_SOUND_CUTSCENE_LUIGI4_PAP },
- { "L5_TFB", STREAMED_SOUND_CUTSCENE_LUIGI5_TFB },
- { "J0_DM2", STREAMED_SOUND_CUTSCENE_JOEY0_DM2 },
- { "J1_LFL", STREAMED_SOUND_CUTSCENE_JOEY1_LFL },
- { "J2_KCL", STREAMED_SOUND_CUTSCENE_JOEY2_KCL },
- { "J3_VH", STREAMED_SOUND_CUTSCENE_JOEY3_VH },
- { "J4_ETH", STREAMED_SOUND_CUTSCENE_JOEY4_ETH },
- { "J5_DST", STREAMED_SOUND_CUTSCENE_JOEY5_DST },
- { "J6_TBJ", STREAMED_SOUND_CUTSCENE_JOEY6_TBJ },
- { "T1_TOL", STREAMED_SOUND_CUTSCENE_TONI1_TOL },
- { "T2_TPU", STREAMED_SOUND_CUTSCENE_TONI2_TPU },
- { "T3_MAS", STREAMED_SOUND_CUTSCENE_TONI3_MAS },
- { "T4_TAT", STREAMED_SOUND_CUTSCENE_TONI4_TAT },
- { "T5_BF", STREAMED_SOUND_CUTSCENE_TONI5_BF },
- { "S0_MAS", STREAMED_SOUND_CUTSCENE_SAL0_MAS },
- { "S1_PF", STREAMED_SOUND_CUTSCENE_SAL1_PF },
- { "S2_CTG", STREAMED_SOUND_CUTSCENE_SAL2_CTG },
- { "S3_RTC", STREAMED_SOUND_CUTSCENE_SAL3_RTC },
- { "S5_LRQ", STREAMED_SOUND_CUTSCENE_SAL5_LRQ },
- { "S4_BDBA", STREAMED_SOUND_CUTSCENE_SAL4_BDBA },
- { "S4_BDBB", STREAMED_SOUND_CUTSCENE_SAL4_BDBB },
- { "S2_CTG2", STREAMED_SOUND_CUTSCENE_SAL2_CTG2 },
- { "S4_BDBD", STREAMED_SOUND_CUTSCENE_SAL4_BDBD },
- { "S5_LRQB", STREAMED_SOUND_CUTSCENE_SAL5_LRQB },
- { "S5_LRQC", STREAMED_SOUND_CUTSCENE_SAL5_LRQC },
- { "A1_SS0", STREAMED_SOUND_CUTSCENE_ASUKA_1_SSO },
- { "A2_PP", STREAMED_SOUND_CUTSCENE_ASUKA_2_PP },
- { "A3_SS", STREAMED_SOUND_CUTSCENE_ASUKA_3_SS },
- { "A4_PDR", STREAMED_SOUND_CUTSCENE_ASUKA_4_PDR },
- { "A5_K2FT", STREAMED_SOUND_CUTSCENE_ASUKA_5_K2FT},
- { "K1_KBO", STREAMED_SOUND_CUTSCENE_KENJI1_KBO },
- { "K2_GIS", STREAMED_SOUND_CUTSCENE_KENJI2_GIS },
- { "K3_DS", STREAMED_SOUND_CUTSCENE_KENJI3_DS },
- { "K4_SHI", STREAMED_SOUND_CUTSCENE_KENJI4_SHI },
- { "K5_SD", STREAMED_SOUND_CUTSCENE_KENJI5_SD },
- { "R0_PDR2", STREAMED_SOUND_CUTSCENE_RAY0_PDR2 },
- { "R1_SW", STREAMED_SOUND_CUTSCENE_RAY1_SW },
- { "R2_AP", STREAMED_SOUND_CUTSCENE_RAY2_AP },
- { "R3_ED", STREAMED_SOUND_CUTSCENE_RAY3_ED },
- { "R4_GF", STREAMED_SOUND_CUTSCENE_RAY4_GF },
- { "R5_PB", STREAMED_SOUND_CUTSCENE_RAY5_PB },
- { "R6_MM", STREAMED_SOUND_CUTSCENE_RAY6_MM },
- { "D1_STOG", STREAMED_SOUND_CUTSCENE_DONALD1_STOG },
- { "D2_KK", STREAMED_SOUND_CUTSCENE_DONALD2_KK },
- { "D3_ADO", STREAMED_SOUND_CUTSCENE_DONALD3_ADO },
- { "D5_ES", STREAMED_SOUND_CUTSCENE_DONALD5_ES },
- { "D7_MLD", STREAMED_SOUND_CUTSCENE_DONALD7_MLD },
- { "D4_GTA", STREAMED_SOUND_CUTSCENE_DONALD4_GTA },
- { "D4_GTA2", STREAMED_SOUND_CUTSCENE_DONALD4_GTA2 },
- { "D6_STS", STREAMED_SOUND_CUTSCENE_DONALD6_STS },
- { "A6_BAIT", STREAMED_SOUND_CUTSCENE_ASUKA6_BAIT },
- { "A7_ETG", STREAMED_SOUND_CUTSCENE_ASUKA7_ETG },
- { "A8_PS", STREAMED_SOUND_CUTSCENE_ASUKA8_PS },
- { "A9_ASD", STREAMED_SOUND_CUTSCENE_ASUKA9_ASD },
- { "K4_SHI2", STREAMED_SOUND_CUTSCENE_KENJI4_SHI2 },
- { "C1_TEX", STREAMED_SOUND_CUTSCENE_CATALINA1_TEX },
- { "EL_PH1", STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 },
- { "EL_PH2", STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 },
- { "EL_PH3", STREAMED_SOUND_CUTSCENE_ELBURRO3_PH3 },
- { "EL_PH4", STREAMED_SOUND_CUTSCENE_ELBURRO4_PH4 },
- { "YD_PH1", STREAMED_SOUND_CUTSCENE_YARDIE_PH1 },
- { "YD_PH2", STREAMED_SOUND_CUTSCENE_YARDIE_PH2 },
- { "YD_PH3", STREAMED_SOUND_CUTSCENE_YARDIE_PH3 },
- { "YD_PH4", STREAMED_SOUND_CUTSCENE_YARDIE_PH4 },
- { "HD_PH1", STREAMED_SOUND_CUTSCENE_HOODS_PH1 },
- { "HD_PH2", STREAMED_SOUND_CUTSCENE_HOODS_PH2 },
- { "HD_PH3", STREAMED_SOUND_CUTSCENE_HOODS_PH3 },
- { "HD_PH4", STREAMED_SOUND_CUTSCENE_HOODS_PH4 },
- { "HD_PH5", STREAMED_SOUND_CUTSCENE_HOODS_PH5 },
- { "MT_PH1", STREAMED_SOUND_CUTSCENE_MARTY_PH1 },
- { "MT_PH2", STREAMED_SOUND_CUTSCENE_MARTY_PH2 },
- { "MT_PH3", STREAMED_SOUND_CUTSCENE_MARTY_PH3 },
- { "MT_PH4", STREAMED_SOUND_CUTSCENE_MARTY_PH4 },
- { NULL, NULL }
-};
-
-int
-FindCutsceneAudioTrackId(const char *szCutsceneName)
-{
- for (int i = 0; musicNameIdAssoc[i].szTrackName; i++) {
- if (!CGeneral::faststricmp(musicNameIdAssoc[i].szTrackName, szCutsceneName))
- return musicNameIdAssoc[i].iTrackId;
- }
- return -1;
-}
-
-bool &CCutsceneMgr::ms_running = *(bool*)0x95CCF5;
-bool &CCutsceneMgr::ms_cutsceneProcessing = *(bool*)0x95CD9F;
-CDirectory *&CCutsceneMgr::ms_pCutsceneDir = *(CDirectory**)0x8F5F88;
-CCutsceneObject *(&CCutsceneMgr::ms_pCutsceneObjects)[NUMCUTSCENEOBJECTS] = *(CCutsceneObject*(*)[NUMCUTSCENEOBJECTS]) *(uintptr*) 0x862170;
-int32 &CCutsceneMgr::ms_numCutsceneObjs = *(int32*)0x942FA4;
-bool &CCutsceneMgr::ms_loaded = *(bool*)0x95CD95;
-bool &CCutsceneMgr::ms_animLoaded = *(bool*)0x95CDA0;
-bool &CCutsceneMgr::ms_useLodMultiplier = *(bool*)0x95CD74;
-char(&CCutsceneMgr::ms_cutsceneName)[CUTSCENENAMESIZE] = *(char(*)[CUTSCENENAMESIZE]) *(uintptr*)0x70D9D0;
-CAnimBlendAssocGroup &CCutsceneMgr::ms_cutsceneAssociations = *(CAnimBlendAssocGroup*)0x709C58;
-CVector &CCutsceneMgr::ms_cutsceneOffset = *(CVector*)0x8F2C0C;
-float &CCutsceneMgr::ms_cutsceneTimer = *(float*)0x941548;
-uint32 &CCutsceneMgr::ms_cutsceneLoadStatus = *(uint32*)0x95CB40;
-
-RpAtomic *
-CalculateBoundingSphereRadiusCB(RpAtomic *atomic, void *data)
-{
- float radius = RpAtomicGetBoundingSphereMacro(atomic)->radius;
- RwV3d center = RpAtomicGetBoundingSphereMacro(atomic)->center;
-
- for (RwFrame *frame = RpAtomicGetFrame(atomic); RwFrameGetParent(frame); frame = RwFrameGetParent(frame))
- RwV3dTransformPoints(&center, &center, 1, RwFrameGetMatrix(frame));
-
- float size = RwV3dLength(&center) + radius;
- if (size > *(float *)data)
- *(float *)data = size;
- return atomic;
-}
-
-void
-CCutsceneMgr::Initialise(void)
-{
- ms_numCutsceneObjs = 0;
- ms_loaded = false;
- ms_running = false;
- ms_animLoaded = false;
- ms_cutsceneProcessing = false;
- ms_useLodMultiplier = false;
-
- ms_pCutsceneDir = new CDirectory(CUTSCENEDIRSIZE);
- ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
-}
-
-void
-CCutsceneMgr::Shutdown(void)
-{
- delete ms_pCutsceneDir;
-}
-
-void
-CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
-{
- int file;
- uint32 size;
- uint32 offset;
- CPlayerPed *pPlayerPed;
-
- ms_cutsceneProcessing = true;
- if (!strcasecmp(szCutsceneName, "jb"))
- ms_useLodMultiplier = true;
- CTimer::Stop();
-
- ms_pCutsceneDir->numEntries = 0;
- ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
-
- CStreaming::RemoveUnusedModelsInLoadedList();
- CGame::DrasticTidyUpMemory(true);
-
- strcpy(ms_cutsceneName, szCutsceneName);
- file = CFileMgr::OpenFile("ANIM\\CUTS.IMG", "rb");
-
- // Load animations
- sprintf(gString, "%s.IFP", szCutsceneName);
- if (ms_pCutsceneDir->FindItem(gString, offset, size)) {
- CStreaming::MakeSpaceFor(size << 11);
- CStreaming::ImGonnaUseStreamingMemory();
- CFileMgr::Seek(file, offset << 11, SEEK_SET);
- CAnimManager::LoadAnimFile(file, false);
- ms_cutsceneAssociations.CreateAssociations(szCutsceneName);
- CStreaming::IHaveUsedStreamingMemory();
- ms_animLoaded = true;
- } else {
- ms_animLoaded = false;
- }
-
- // Load camera data
- sprintf(gString, "%s.DAT", szCutsceneName);
- if (ms_pCutsceneDir->FindItem(gString, offset, size)) {
- CFileMgr::Seek(file, offset << 11, SEEK_SET);
- TheCamera.LoadPathSplines(file);
- }
-
- CFileMgr::CloseFile(file);
-
- if (CGeneral::faststricmp(ms_cutsceneName, "end")) {
- DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
- int trackId = FindCutsceneAudioTrackId(szCutsceneName);
- if (trackId != -1) {
- printf("Start preload audio %s\n", szCutsceneName);
- DMAudio.PreloadCutSceneMusic(trackId);
- printf("End preload audio %s\n", szCutsceneName);
- }
- }
-
- ms_cutsceneTimer = 0.0f;
- ms_loaded = true;
- ms_cutsceneOffset = CVector(0.0f, 0.0f, 0.0f);
-
- pPlayerPed = FindPlayerPed();
- CTimer::Update();
-
- pPlayerPed->m_pWanted->ClearQdCrimes();
- pPlayerPed->bIsVisible = false;
- pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
- CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80;
- CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true);
-}
-
-void
-CCutsceneMgr::SetHeadAnim(const char *animName, CObject *pObject)
-{
- CCutsceneHead *pCutsceneHead = (CCutsceneHead*)pObject;
- char szAnim[CUTSCENENAMESIZE * 2];
-
- sprintf(szAnim, "%s_%s", ms_cutsceneName, animName);
- pCutsceneHead->PlayAnimation(szAnim);
-}
-
-void
-CCutsceneMgr::FinishCutscene()
-{
- CCutsceneMgr::ms_cutsceneTimer = TheCamera.GetCutSceneFinishTime() * 0.001f;
- TheCamera.FinishCutscene();
-
- FindPlayerPed()->bIsVisible = true;
- CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
-}
-
-void
-CCutsceneMgr::SetupCutsceneToStart(void)
-{
- TheCamera.SetCamCutSceneOffSet(ms_cutsceneOffset);
- TheCamera.TakeControlWithSpline(JUMP_CUT);
- TheCamera.SetWideScreenOn();
-
- ms_cutsceneOffset.z++;
-
- for (int i = ms_numCutsceneObjs - 1; i >= 0; i--) {
- assert(RwObjectGetType(ms_pCutsceneObjects[i]->m_rwObject) == rpCLUMP);
- if (CAnimBlendAssociation *pAnimBlendAssoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)ms_pCutsceneObjects[i]->m_rwObject)) {
- assert(pAnimBlendAssoc->hierarchy->sequences[0].HasTranslation());
- ms_pCutsceneObjects[i]->GetPosition() = ms_cutsceneOffset + ((KeyFrameTrans*)pAnimBlendAssoc->hierarchy->sequences[0].GetKeyFrame(0))->translation;
- CWorld::Add(ms_pCutsceneObjects[i]);
- pAnimBlendAssoc->SetRun();
- } else {
- ms_pCutsceneObjects[i]->GetPosition() = ms_cutsceneOffset;
- }
- }
-
- CTimer::Update();
- CTimer::Update();
- ms_running = true;
- ms_cutsceneTimer = 0.0f;
-}
-
-void
-CCutsceneMgr::SetCutsceneAnim(const char *animName, CObject *pObject)
-{
- CAnimBlendAssociation *pNewAnim;
- CAnimBlendClumpData *pAnimBlendClumpData;
-
- assert(RwObjectGetType(pObject->m_rwObject) == rpCLUMP);
- RpAnimBlendClumpRemoveAllAssociations((RpClump*)pObject->m_rwObject);
-
- pNewAnim = ms_cutsceneAssociations.CopyAnimation(animName);
- pNewAnim->SetCurrentTime(0.0f);
- pNewAnim->flags |= ASSOC_HAS_TRANSLATION;
- pNewAnim->flags &= ~ASSOC_RUNNING;
-
- pAnimBlendClumpData = *RPANIMBLENDCLUMPDATA(pObject->m_rwObject);
- pAnimBlendClumpData->link.Prepend(&pNewAnim->link);
-}
-
-CCutsceneHead *
-CCutsceneMgr::AddCutsceneHead(CObject *pObject, int modelId)
-{
- CCutsceneHead *pHead = new CCutsceneHead(pObject);
- pHead->SetModelIndex(modelId);
- CWorld::Add(pHead);
- ms_pCutsceneObjects[ms_numCutsceneObjs++] = pHead;
- return pHead;
-}
-
-CCutsceneObject *
-CCutsceneMgr::CreateCutsceneObject(int modelId)
-{
- CBaseModelInfo *pModelInfo;
- CColModel *pColModel;
- float radius;
- RpClump *clump;
- CCutsceneObject *pCutsceneObject;
-
- if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
- pModelInfo = CModelInfo::GetModelInfo(modelId);
- pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
- radius = 0.0f;
-
- pModelInfo->SetColModel(pColModel);
- clump = (RpClump*)pModelInfo->GetRwObject();
- assert(RwObjectGetType(clump) == rpCLUMP);
- RpClumpForAllAtomics(clump, CalculateBoundingSphereRadiusCB, &radius);
-
- pColModel->boundingSphere.radius = radius;
- pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
- pColModel->boundingBox.max = CVector(radius, radius, radius);
- }
-
- pCutsceneObject = new CCutsceneObject();
- pCutsceneObject->SetModelIndex(modelId);
- ms_pCutsceneObjects[ms_numCutsceneObjs++] = pCutsceneObject;
- return pCutsceneObject;
-}
-
-void
-CCutsceneMgr::DeleteCutsceneData(void)
-{
- if (!ms_loaded) return;
-
- ms_cutsceneProcessing = false;
- ms_useLodMultiplier = false;
-
- for (--ms_numCutsceneObjs; ms_numCutsceneObjs >= 0; ms_numCutsceneObjs--) {
- CWorld::Remove(ms_pCutsceneObjects[ms_numCutsceneObjs]);
- ms_pCutsceneObjects[ms_numCutsceneObjs]->DeleteRwObject();
- delete ms_pCutsceneObjects[ms_numCutsceneObjs];
- }
- ms_numCutsceneObjs = 0;
-
- if (ms_animLoaded)
- CAnimManager::RemoveLastAnimFile();
-
- ms_animLoaded = false;
- TheCamera.RestoreWithJumpCut();
- TheCamera.SetWideScreenOff();
- ms_running = false;
- ms_loaded = false;
-
- FindPlayerPed()->bIsVisible = true;
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80;
- CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
-
- if (CGeneral::faststricmp(ms_cutsceneName, "end")) {
- DMAudio.StopCutSceneMusic();
- if (CGeneral::faststricmp(ms_cutsceneName, "bet"))
- DMAudio.ChangeMusicMode(MUSICMODE_GAME);
- }
- CTimer::Stop();
- CGame::DrasticTidyUpMemory(TheCamera.GetScreenFadeStatus() == 2);
- CTimer::Update();
-}
-
-void
-CCutsceneMgr::Update(void)
-{
- enum {
- CUTSCENE_LOADING_0 = 0,
- CUTSCENE_LOADING_AUDIO,
- CUTSCENE_LOADING_2,
- CUTSCENE_LOADING_3,
- CUTSCENE_LOADING_4
- };
-
- switch (ms_cutsceneLoadStatus) {
- case CUTSCENE_LOADING_AUDIO:
- SetupCutsceneToStart();
- if (CGeneral::faststricmp(ms_cutsceneName, "end"))
- DMAudio.PlayPreloadedCutSceneMusic();
- ms_cutsceneLoadStatus++;
- break;
- case CUTSCENE_LOADING_2:
- case CUTSCENE_LOADING_3:
- ms_cutsceneLoadStatus++;
- break;
- case CUTSCENE_LOADING_4:
- ms_cutsceneLoadStatus = CUTSCENE_LOADING_0;
- break;
- default:
- break;
- }
-
- if (!ms_running) return;
-
- ms_cutsceneTimer += CTimer::GetTimeStepNonClipped() * 0.02f;
- if (CGeneral::faststricmp(ms_cutsceneName, "end") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
- if (CPad::GetPad(0)->GetCrossJustDown()
- || (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
- || CPad::GetPad(0)->GetLeftMouseJustDown()
- || CPad::GetPad(0)->GetEnterJustDown()
- || CPad::GetPad(0)->GetCharJustDown(VK_SPACE))
- FinishCutscene();
- }
-}
-
-bool CCutsceneMgr::HasCutsceneFinished(void) { return TheCamera.GetPositionAlongSpline() == 1.0f; }
-
-STARTPATCHES
- InjectHook(0x4045D0, &CCutsceneMgr::Initialise, PATCH_JUMP);
- InjectHook(0x404630, &CCutsceneMgr::Shutdown, PATCH_JUMP);
- InjectHook(0x404650, &CCutsceneMgr::LoadCutsceneData, PATCH_JUMP);
- InjectHook(0x405140, &CCutsceneMgr::FinishCutscene, PATCH_JUMP);
- InjectHook(0x404D80, &CCutsceneMgr::SetHeadAnim, PATCH_JUMP);
- InjectHook(0x404DC0, &CCutsceneMgr::SetupCutsceneToStart, PATCH_JUMP);
- InjectHook(0x404D20, &CCutsceneMgr::SetCutsceneAnim, PATCH_JUMP);
- InjectHook(0x404CD0, &CCutsceneMgr::AddCutsceneHead, PATCH_JUMP);
- InjectHook(0x404BE0, &CCutsceneMgr::CreateCutsceneObject, PATCH_JUMP);
- InjectHook(0x4048E0, &CCutsceneMgr::DeleteCutsceneData, PATCH_JUMP);
- InjectHook(0x404EE0, &CCutsceneMgr::Update, PATCH_JUMP);
- InjectHook(0x4051B0, &CCutsceneMgr::GetCutsceneTimeInMilleseconds, PATCH_JUMP);
- InjectHook(0x4051F0, &CCutsceneMgr::HasCutsceneFinished, PATCH_JUMP);
- InjectHook(0x404B40, &CalculateBoundingSphereRadiusCB, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/core/CutsceneMgr.h b/src/core/CutsceneMgr.h
deleted file mode 100644
index 7b809964..00000000
--- a/src/core/CutsceneMgr.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#pragma once
-#include "CutsceneObject.h"
-
-#define CUTSCENENAMESIZE 8
-
-class CDirectory;
-class CAnimBlendAssocGroup;
-class CCutsceneHead;
-
-class CCutsceneMgr
-{
- static bool &ms_running;
- static CCutsceneObject *(&ms_pCutsceneObjects)[NUMCUTSCENEOBJECTS];
-
- static int32 &ms_numCutsceneObjs;
- static bool &ms_loaded;
- static bool &ms_animLoaded;
- static bool &ms_useLodMultiplier;
-
- static char(&ms_cutsceneName)[CUTSCENENAMESIZE];
- static CAnimBlendAssocGroup &ms_cutsceneAssociations;
- static CVector &ms_cutsceneOffset;
- static float &ms_cutsceneTimer;
- static bool &ms_cutsceneProcessing;
-public:
- static CDirectory *&ms_pCutsceneDir;
- static uint32 &ms_cutsceneLoadStatus;
-
- static void SetRunning(bool running) { ms_running = running; }
- static bool IsRunning(void) { return ms_running; }
- static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
- static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
- static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }
- static int GetCutsceneTimeInMilleseconds(void) { return 1000.0f * ms_cutsceneTimer; }
- static char *GetCutsceneName(void) { return ms_cutsceneName; }
- static void SetCutsceneOffset(const CVector& vec) { ms_cutsceneOffset = vec; }
- static bool HasCutsceneFinished(void);
-
- static void Initialise(void);
- static void Shutdown(void);
- static void LoadCutsceneData(const char *szCutsceneName);
- static void FinishCutscene(void);
- static void SetHeadAnim(const char *animName, CObject *pObject);
- static void SetupCutsceneToStart(void);
- static void SetCutsceneAnim(const char *animName, CObject *pObject);
- static CCutsceneHead *AddCutsceneHead(CObject *pObject, int modelId);
- static CCutsceneObject *CreateCutsceneObject(int modelId);
- static void DeleteCutsceneData(void);
- static void Update(void);
-};
diff --git a/src/core/Debug.cpp b/src/core/Debug.cpp
index 2b713198..917c99ab 100644
--- a/src/core/Debug.cpp
+++ b/src/core/Debug.cpp
@@ -24,7 +24,7 @@ CDebug::DebugAddText(const char *str)
{
int32 i = 0;
if (*str != '\0') {
- while (i < MAX_STR_LEN) {
+ while (i < MAX_STR_LEN - 1) {
ms_aTextBuffer[ms_nCurrentTextLine][i++] = *(str++);
if (*str == '\0')
break;
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index 6305bf33..e0a0fafc 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -25,8 +25,6 @@
#include "CdStream.h"
#include "FileLoader.h"
-WRAPPER void CFileLoader::ReloadPaths(const char *filename) { EAXJMP(0x476DB0); }
-
char CFileLoader::ms_line[256];
const char*
@@ -311,7 +309,7 @@ CFileLoader::FindRelatedModelInfoCB(RpAtomic *atomic, void *data)
int n;
RpClump *clump = (RpClump*)data;
- nodename = GetFrameNodeName(RpClumpGetFrame(atomic));
+ nodename = GetFrameNodeName(RpAtomicGetFrame(atomic));
GetNameAndLOD(nodename, name, &n);
mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(name, nil);
if(mi){
@@ -1198,6 +1196,165 @@ CFileLoader::LoadMapZones(const char *filename)
debug("Finished loading IPL\n");
}
+void
+CFileLoader::ReloadPaths(const char *filename)
+{
+ enum {
+ NONE,
+ PATH,
+ };
+ char *line;
+ int section = NONE;
+ int id, pathType, pathIndex = -1;
+ char pathTypeStr[20];
+ debug("Reloading paths from %s...\n", filename);
+
+ int fd = CFileMgr::OpenFile(filename, "r");
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '\0' || *line == '#')
+ continue;
+
+ if (section == NONE) {
+ if (strncmp(line, "path", 4) == 0) {
+ section = PATH;
+ ThePaths.AllocatePathFindInfoMem(4500);
+ }
+ } else if (strncmp(line, "end", 3) == 0) {
+ section = NONE;
+ } else {
+ switch (section) {
+ case PATH:
+ if (pathIndex == -1) {
+ id = LoadPathHeader(line, pathTypeStr);
+ if (strncmp(pathTypeStr, "ped", 4) == 0)
+ pathType = 1;
+ else if (strncmp(pathTypeStr, "car", 4) == 0)
+ pathType = 0;
+ pathIndex = 0;
+ } else {
+ if (pathType == 1)
+ LoadPedPathNode(line, id, pathIndex);
+ else if (pathType == 0)
+ LoadCarPathNode(line, id, pathIndex);
+ pathIndex++;
+ if (pathIndex == 12)
+ pathIndex = -1;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
+
+void
+CFileLoader::ReloadObjectTypes(const char *filename)
+{
+ enum {
+ NONE,
+ OBJS,
+ TOBJ,
+ TWODFX
+ };
+ char *line;
+ int section = NONE;
+ CModelInfo::ReInit2dEffects();
+ debug("Reloading object types from %s...\n", filename);
+
+ CFileMgr::ChangeDir("\\DATA\\MAPS\\");
+ int fd = CFileMgr::OpenFile(filename, "r");
+ CFileMgr::ChangeDir("\\");
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '\0' || *line == '#')
+ continue;
+
+ if (section == NONE) {
+ if (strncmp(line, "objs", 4) == 0) section = OBJS;
+ else if (strncmp(line, "tobj", 4) == 0) section = TOBJ;
+ else if (strncmp(line, "2dfx", 4) == 0) section = TWODFX;
+ } else if (strncmp(line, "end", 3) == 0) {
+ section = NONE;
+ } else {
+ switch (section) {
+ case OBJS:
+ case TOBJ:
+ ReloadObject(line);
+ break;
+ case TWODFX:
+ Load2dEffect(line);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
+
+void
+CFileLoader::ReloadObject(const char *line)
+{
+ int id, numObjs;
+ char model[24], txd[24];
+ float dist[3];
+ uint32 flags;
+ CSimpleModelInfo *mi;
+
+ if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
+ return;
+
+ switch(numObjs){
+ case 1:
+ sscanf(line, "%d %s %s %d %f %d",
+ &id, model, txd, &numObjs, &dist[0], &flags);
+ break;
+ case 2:
+ sscanf(line, "%d %s %s %d %f %f %d",
+ &id, model, txd, &numObjs, &dist[0], &dist[1], &flags);
+ break;
+ case 3:
+ sscanf(line, "%d %s %s %d %f %f %f %d",
+ &id, model, txd, &numObjs, &dist[0], &dist[1], &dist[2], &flags);
+ break;
+ }
+
+ mi = (CSimpleModelInfo*) CModelInfo::GetModelInfo(id);
+ if (
+#ifdef FIX_BUGS
+ mi &&
+#endif
+ mi->m_type == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
+ mi->SetLodDistances(dist);
+ SetModelInfoFlags(mi, flags);
+ } else {
+ printf("Can't reload %s\n", model);
+ }
+}
+
+// unused mobile function - crashes
+void
+CFileLoader::ReLoadScene(const char *filename)
+{
+ char *line;
+ CFileMgr::ChangeDir("\\DATA\\");
+ int fd = CFileMgr::OpenFile(filename, "r");
+ CFileMgr::ChangeDir("\\");
+
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '#')
+ continue;
+
+ if (strncmp(line, "EXIT", 9) == 0) // BUG: 9?
+ break;
+
+ if (strncmp(line, "IDE", 3) == 0) {
+ LoadObjectTypes(line + 4);
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
STARTPATCHES
InjectHook(0x476290, CFileLoader::LoadLevel, PATCH_JUMP);
@@ -1233,4 +1390,8 @@ STARTPATCHES
InjectHook(0x478A90, CFileLoader::LoadCullZone, PATCH_JUMP);
InjectHook(0x478550, CFileLoader::LoadMapZones, PATCH_JUMP);
+
+ InjectHook(0x476DB0, CFileLoader::ReloadPaths, PATCH_JUMP);
+ InjectHook(0x476F30, CFileLoader::ReloadObjectTypes, PATCH_JUMP);
+ InjectHook(0x4772B0, CFileLoader::ReloadObject, PATCH_JUMP);
ENDPATCHES
diff --git a/src/core/FileLoader.h b/src/core/FileLoader.h
index 1b390279..87b8fe61 100644
--- a/src/core/FileLoader.h
+++ b/src/core/FileLoader.h
@@ -43,4 +43,7 @@ public:
static void LoadMapZones(const char *filename);
static void ReloadPaths(const char *filename);
+ static void ReloadObjectTypes(const char *filename);
+ static void ReloadObject(const char *line);
+ static void ReLoadScene(const char *filename); // unused mobile function
};
diff --git a/src/core/FrontEndControls.cpp b/src/core/FrontEndControls.cpp
new file mode 100644
index 00000000..866be42f
--- /dev/null
+++ b/src/core/FrontEndControls.cpp
@@ -0,0 +1,1881 @@
+#include "common.h"
+#include "main.h"
+#include "Timer.h"
+#include "Pad.h"
+#include "ControllerConfig.h"
+#include "VisibilityPlugins.h"
+#include "Sprite2d.h"
+#include "Text.h"
+#include "Font.h"
+#include "Frontend.h"
+#include "FrontEndControls.h"
+
+
+void
+CPlaceableShText::Draw(float x, float y)
+{
+ if(m_text == nil)
+ return;
+
+ if(m_bRightJustify)
+ CFont::SetRightJustifyOn();
+ if(m_bDropShadow){
+ CFont::SetDropShadowPosition(m_shadowOffset.x);
+ CFont::SetDropColor(m_shadowColor);
+ }
+ CFont::SetColor(m_color);
+ CFont::PrintString(x+m_position.x, y+m_position.y, m_text);
+ if(m_bDropShadow)
+ CFont::SetDropShadowPosition(0);
+ if(m_bRightJustify)
+ CFont::SetRightJustifyOff();
+}
+
+void
+CPlaceableShText::Draw(const CRGBA &color, float x, float y)
+{
+ if(m_text == nil)
+ return;
+
+ if(m_bRightJustify)
+ CFont::SetRightJustifyOn();
+ if(m_bDropShadow){
+ CFont::SetDropShadowPosition(m_shadowOffset.x);
+ CFont::SetDropColor(m_shadowColor);
+ }
+ CFont::SetColor(color);
+ CFont::PrintString(x+m_position.x, y+m_position.y, m_text);
+ if(m_bDropShadow)
+ CFont::SetDropShadowPosition(0);
+ if(m_bRightJustify)
+ CFont::SetRightJustifyOff();
+}
+
+void
+CPlaceableShTextTwoLines::Draw(float x, float y)
+{
+ if(m_line1.m_text == nil && m_line2.m_text == nil)
+ return;
+
+ if(m_bRightJustify)
+ CFont::SetRightJustifyOn();
+ if(m_bDropShadow){
+ CFont::SetDropShadowPosition(m_shadowOffset.x);
+ CFont::SetDropColor(m_shadowColor);
+ }
+
+ if(m_line1.m_text){
+ CFont::SetColor(m_line1.m_color);
+ CFont::PrintString(x+m_line1.m_position.x, y+m_line1.m_position.y, m_line1.m_text);
+ }
+ if(m_line2.m_text){
+ CFont::SetColor(m_line2.m_color);
+ CFont::PrintString(x+m_line2.m_position.x, y+m_line2.m_position.y, m_line2.m_text);
+ }
+
+ if(m_bDropShadow)
+ CFont::SetDropShadowPosition(0);
+ if(m_bRightJustify)
+ CFont::SetRightJustifyOff();
+}
+
+void
+CPlaceableShTextTwoLines::Draw(const CRGBA &color, float x, float y)
+{
+ if(m_line1.m_text == nil && m_line2.m_text == nil)
+ return;
+
+ if(m_bRightJustify)
+ CFont::SetRightJustifyOn();
+ if(m_bDropShadow){
+ CFont::SetDropShadowPosition(m_shadowOffset.x);
+ CFont::SetDropColor(m_shadowColor);
+ }
+
+ if(m_line1.m_text){
+ CFont::SetColor(color);
+ CFont::PrintString(x+m_line1.m_position.x, y+m_line1.m_position.y, m_line1.m_text);
+ }
+ if(m_line2.m_text){
+ CFont::SetColor(color);
+ CFont::PrintString(x+m_line2.m_position.x, y+m_line2.m_position.y, m_line2.m_text);
+ }
+
+ if(m_bDropShadow)
+ CFont::SetDropShadowPosition(0);
+ if(m_bRightJustify)
+ CFont::SetRightJustifyOff();
+}
+
+void
+CPlaceableShOption::Draw(const CRGBA &highlightColor, float x, float y, bool bHighlight)
+{
+ if(bHighlight)
+ CPlaceableShText::Draw(highlightColor, x, y);
+ else if(m_bSelected)
+ CPlaceableShText::Draw(m_selectedColor, x, y);
+ else
+ CPlaceableShText::Draw(x, y);
+}
+
+void
+CPlaceableShOptionTwoLines::Draw(const CRGBA &highlightColor, float x, float y, bool bHighlight)
+{
+ if(bHighlight)
+ CPlaceableShTextTwoLines::Draw(highlightColor, x, y);
+ else if(m_bSelected)
+ CPlaceableShTextTwoLines::Draw(m_selectedColor, x, y);
+ else
+ CPlaceableShTextTwoLines::Draw(x, y);
+}
+
+void
+CPlaceableSprite::Draw(float x, float y)
+{
+ Draw(m_color, x, y);
+}
+
+void
+CPlaceableSprite::Draw(const CRGBA &color, float x, float y)
+{
+ if(m_pSprite)
+ m_pSprite->Draw(CRect(m_position.x+x, m_position.y+y,
+ m_position.x+x + m_size.x, m_position.y+y + m_size.y),
+ color);
+}
+
+void
+CPlaceableShSprite::Draw(float x, float y)
+{
+ if(m_bDropShadow)
+ m_shadow.Draw(m_shadow.m_color, m_sprite.m_position.x+x, m_sprite.m_position.y+y);
+ m_sprite.Draw(x, y);
+}
+
+
+/*
+ * CMenuPictureAndText
+ */
+
+void
+CMenuPictureAndText::SetNewOldShadowWrapX(bool bWrapX, float newWrapX, float oldWrapX)
+{
+ m_bWrap = bWrapX;
+ m_wrapX = newWrapX;
+ m_oldWrapx = oldWrapX;
+}
+
+void
+CMenuPictureAndText::SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale)
+{
+ m_bSetTextScale = bTextScale;
+ m_textScale = newScale;
+ m_oldTextScale = oldScale;
+}
+
+void
+CMenuPictureAndText::SetTextsColor(CRGBA const &color)
+{
+ int i;
+ for(i = 0; i < m_numTexts; i++)
+ m_texts[i].m_color = color;
+}
+
+void
+CMenuPictureAndText::AddText(wchar *text, float positionX, float positionY, CRGBA const &color, bool bRightJustify)
+{
+ int i;
+ if(m_numTexts >= 20)
+ return;
+ i = m_numTexts++;
+ m_texts[i].m_text = text;
+ m_texts[i].m_position.x = positionX;
+ m_texts[i].m_position.y = positionY;
+ m_texts[i].m_color = color;
+ m_texts[i].m_bRightJustify = bRightJustify;
+}
+
+void
+CMenuPictureAndText::AddPicture(CSprite2d *sprite, CSprite2d *shadow, float positionX, float positionY, float width, float height, CRGBA const &color)
+{
+ int i;
+ if(m_numSprites >= 5)
+ return;
+ i = m_numSprites++;
+ m_sprites[i].m_sprite.m_pSprite = sprite;
+ m_sprites[i].m_shadow.m_pSprite = shadow;
+ m_sprites[i].m_sprite.m_position.x = positionX;
+ m_sprites[i].m_sprite.m_position.y = positionY;
+ m_sprites[i].m_sprite.m_size.x = width;
+ m_sprites[i].m_sprite.m_size.y = height;
+ m_sprites[i].m_shadow.m_size.x = width;
+ m_sprites[i].m_shadow.m_size.y = height;
+ m_sprites[i].m_sprite.m_color = color;
+}
+
+void
+CMenuPictureAndText::AddPicture(CSprite2d *sprite, float positionX, float positionY, float width, float height, CRGBA const &color)
+{
+ int i;
+ if(m_numSprites >= 5)
+ return;
+ i = m_numSprites++;
+ m_sprites[i].m_sprite.m_pSprite = sprite;
+ m_sprites[i].m_shadow.m_pSprite = nil;
+ m_sprites[i].m_sprite.m_position.x = positionX;
+ m_sprites[i].m_sprite.m_position.y = positionY;
+ m_sprites[i].m_sprite.m_size.x = width;
+ m_sprites[i].m_sprite.m_size.y = height;
+ m_sprites[i].m_shadow.m_size.x = width;
+ m_sprites[i].m_shadow.m_size.y = height;
+ m_sprites[i].m_sprite.m_color = color;
+}
+
+void
+CMenuPictureAndText::Draw(CRGBA const &,CRGBA const &, float x, float y)
+{
+ int i;
+
+ for(i = 0; i < m_numSprites; i++)
+ m_sprites[i].Draw(m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ for(i = 0; i < m_numTexts; i++)
+ if(m_bWrap)
+ m_texts[i].DrawShWrap(m_position.x+x, m_position.y+y, m_wrapX, m_oldWrapx);
+ else
+ m_texts[i].Draw(m_position.x+x, m_position.y+y);
+ if(m_bSetTextScale)
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+}
+
+void
+CMenuPictureAndText::SetAlpha(uint8 alpha)
+{
+ int i;
+
+ for(i = 0; i < m_numSprites; i++)
+ m_sprites[i].SetAlpha(alpha);
+ for(i = 0; i < m_numTexts; i++)
+ m_texts[i].SetAlpha(alpha);
+}
+
+void
+CMenuPictureAndText::SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset)
+{
+ int i;
+
+ for(i = 0; i < 5; i++)
+ m_sprites[i].SetShadows(bDropShadows, shadowColor, shadowOffset);
+ for(i = 0; i < 20; i++)
+ m_texts[i].SetShadows(bDropShadows, shadowColor, shadowOffset);
+}
+
+/*
+ * CMenuMultiChoice
+ */
+
+void
+CMenuMultiChoice::AddTitle(wchar *text, float positionX, float positionY, bool bRightJustify)
+{
+ m_title.m_text = text;
+ m_title.SetPosition(positionX, positionY, bRightJustify);
+}
+
+CPlaceableShOption*
+CMenuMultiChoice::AddOption(wchar *text, float positionX, float positionY, bool bSelected, bool bRightJustify)
+{
+ if(m_numOptions == NUM_MULTICHOICE_OPTIONS)
+ return nil;
+ m_options[m_numOptions].m_text = text;
+ m_options[m_numOptions].SetPosition(positionX, positionY);
+ m_options[m_numOptions].m_bSelected = bSelected;
+ m_options[m_numOptions].m_bRightJustify = bRightJustify;
+ return &m_options[m_numOptions++];
+}
+
+void
+CMenuMultiChoice::SetColors(const CRGBA &title, const CRGBA &normal, const CRGBA &selected)
+{
+ int i;
+ m_title.SetColor(title);
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].SetColors(normal, selected);
+}
+
+void
+CMenuMultiChoice::SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale)
+{
+ m_bSetTextScale = bTextScale;
+ m_textScale = newScale;
+ m_oldTextScale = oldScale;
+ m_bSetTitleTextScale = bTitleTextScale;
+}
+
+void
+CMenuMultiChoice::Draw(CRGBA const &optionHighlight ,CRGBA const &titleHighlight, float x, float y)
+{
+ int i;
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ if(m_cursor == -1)
+ m_title.Draw(m_position.x+x, m_position.y+y);
+ else
+ m_title.Draw(titleHighlight, m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ if(m_cursor == -1)
+ for(i = 0; i < m_numOptions; i++)
+ m_options[i].Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+ else
+ for(i = 0; i < m_numOptions; i++){
+ if(i == m_cursor)
+ m_options[i].Draw(optionHighlight, m_position.x+x, m_position.y+y);
+ else
+ m_options[i].Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+ }
+
+ if(m_bSetTextScale){
+ CFont::DrawFonts();
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+ }
+}
+
+void
+CMenuMultiChoice::DrawNormal(float x, float y)
+{
+ int i;
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ m_title.Draw(m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ for(i = 0; i < m_numOptions; i++)
+ m_options[i].Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+
+ if(m_bSetTextScale){
+ CFont::DrawFonts();
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+ }
+}
+
+void
+CMenuMultiChoice::DrawHighlighted(CRGBA const &titleHighlight, float x, float y)
+{
+ int i;
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ if(m_cursor == -1)
+ m_title.Draw(m_position.x+x, m_position.y+y);
+ else
+ m_title.Draw(titleHighlight, m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ for(i = 0; i < m_numOptions; i++)
+ m_options[i].Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+
+ if(m_bSetTextScale){
+ CFont::DrawFonts();
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+ }
+}
+
+void
+CMenuMultiChoice::SetAlpha(uint8 alpha)
+{
+ int i;
+ m_title.SetAlpha(alpha);
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].SetAlpha(alpha);
+}
+
+void
+CMenuMultiChoice::SetShadows(bool bDropShadows, CRGBA const &shadowColor, CVector2D const &shadowOffset)
+{
+ int i;
+ m_title.SetShadows(bDropShadows, shadowColor, shadowOffset);
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].SetShadows(bDropShadows, shadowColor, shadowOffset);
+}
+
+
+bool
+CMenuMultiChoice::GoNext(void)
+{
+ if(m_cursor == m_numOptions-1){
+ m_cursor = -1;
+ return false;
+ }else{
+ m_cursor++;
+ return true;
+ }
+}
+
+bool
+CMenuMultiChoice::GoPrev(void)
+{
+ if(m_cursor == 0){
+ m_cursor = -1;
+ return false;
+ }else{
+ m_cursor--;
+ return true;
+ }
+}
+
+void
+CMenuMultiChoice::SelectCurrentOptionUnderCursor(void)
+{
+ int i;
+ if(m_cursor == -1)
+ return;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].m_bSelected = false;
+ m_options[m_cursor].m_bSelected = true;
+}
+
+int
+CMenuMultiChoice::GetMenuSelection(void)
+{
+ int i;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ if(m_options[i].m_bSelected)
+ return i;
+ return -1;
+}
+
+void
+CMenuMultiChoice::SetMenuSelection(int selection)
+{
+ int i;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].m_bSelected = false;
+ m_options[selection%NUM_MULTICHOICE_OPTIONS].m_bSelected = true;
+}
+
+/*
+ * CMenuMultiChoiceTriggered
+ */
+
+void
+CMenuMultiChoiceTriggered::Initialise(void)
+{
+ int i;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_triggers[i] = nil;
+ m_defaultCancel = nil;
+}
+
+CPlaceableShOption*
+CMenuMultiChoiceTriggered::AddOption(wchar *text, float positionX, float positionY, Trigger trigger, bool bSelected, bool bRightJustify)
+{
+ CPlaceableShOption *option;
+ option = CMenuMultiChoice::AddOption(text, positionX, positionY, bSelected, bRightJustify);
+ if(option)
+ m_triggers[m_numOptions-1] = trigger;
+ return option;
+}
+
+void
+CMenuMultiChoiceTriggered::SelectCurrentOptionUnderCursor(void)
+{
+ CMenuMultiChoice::SelectCurrentOptionUnderCursor();
+ if(m_cursor != -1)
+ m_triggers[m_cursor](this);
+}
+
+void
+CMenuMultiChoiceTriggered::SelectDefaultCancelAction(void)
+{
+ if(m_defaultCancel)
+ m_defaultCancel(this);
+}
+
+/*
+ * CMenuMultiChoiceTriggeredAlways
+ */
+
+void
+CMenuMultiChoiceTriggeredAlways::Draw(CRGBA const &optionHighlight, CRGBA const &titleHighlight, float x, float y)
+{
+ if(m_alwaysTrigger)
+ m_alwaysTrigger(this);
+ CMenuMultiChoiceTriggered::Draw(optionHighlight, titleHighlight, x, y);
+}
+
+void
+CMenuMultiChoiceTriggeredAlways::DrawNormal(float x, float y)
+{
+ if(m_alwaysNormalTrigger)
+ m_alwaysNormalTrigger(this);
+ CMenuMultiChoiceTriggered::DrawNormal(x, y);
+}
+
+void
+CMenuMultiChoiceTriggeredAlways::DrawHighlighted(CRGBA const &titleHighlight, float x, float y)
+{
+ if(m_alwaysHighlightTrigger)
+ m_alwaysHighlightTrigger(this);
+ CMenuMultiChoiceTriggered::DrawHighlighted(titleHighlight, x, y);
+}
+
+/*
+ * CMenuMultiChoicePictured
+ */
+
+void
+CMenuMultiChoicePictured::Initialise(void)
+{
+ int i;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_bHasSprite[i] = false;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_sprites[i].m_pSprite = nil;
+}
+
+CPlaceableShOption*
+CMenuMultiChoicePictured::AddOption(CSprite2d *sprite, float positionX, float positionY, const CVector2D &size, bool bSelected)
+{
+ CPlaceableShOption *option;
+ option = CMenuMultiChoice::AddOption(nil, 0.0f, 0.0f, bSelected, false);
+ if(option){
+ m_sprites[m_numOptions-1].m_pSprite = sprite;
+ m_sprites[m_numOptions-1].SetPosition(positionX, positionY);
+ m_sprites[m_numOptions-1].m_size = size;
+ m_bHasSprite[m_numOptions-1] = true;
+ }
+ return option;
+}
+
+void
+CMenuMultiChoicePictured::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y)
+{
+ int i;
+
+ // The title and all the text
+ CMenuMultiChoice::Draw(optionHighlight, titleHighlight, x, y);
+
+ CRGBA selectedColor = m_options[0].GetSelectedColor();
+ CRGBA color = m_options[0].GetColor();
+
+ // The sprites
+ if(m_cursor == -1){
+ for(i = 0; i < m_numOptions; i++)
+ if(m_bHasSprite[i]){
+ if(m_options[i].m_bSelected)
+ m_sprites[i].Draw(selectedColor, m_position.x+x, m_position.y+y);
+ else
+ m_sprites[i].Draw(color, m_position.x+x, m_position.y+y);
+ }
+ }else{
+ for(i = 0; i < m_numOptions; i++)
+ if(i == m_cursor){
+ if(m_bHasSprite[i])
+ m_sprites[i].Draw(CRGBA(255, 255, 255, 255), m_position.x+x, m_position.y+y);
+ }else{
+ if(m_bHasSprite[i]){
+ if(m_options[i].m_bSelected)
+ m_sprites[i].Draw(selectedColor, m_position.x+x, m_position.y+y);
+ else
+ m_sprites[i].Draw(color, m_position.x+x, m_position.y+y);
+ }
+ }
+ }
+}
+
+void
+CMenuMultiChoicePictured::DrawNormal(float x, float y)
+{
+ int i;
+
+ // The title and all the text
+ CMenuMultiChoice::DrawNormal(x, y);
+
+ CRGBA selectedColor = m_options[0].GetSelectedColor();
+ CRGBA color = m_options[0].GetColor();
+
+ // The sprites
+ for(i = 0; i < m_numOptions; i++)
+ if(m_bHasSprite[i]){
+ if(m_options[i].m_bSelected)
+ m_sprites[i].Draw(selectedColor, m_position.x+x, m_position.y+y);
+ else
+ m_sprites[i].Draw(color, m_position.x+x, m_position.y+y);
+ }
+}
+
+void
+CMenuMultiChoicePictured::DrawHighlighted(const CRGBA &titleHighlight, float x, float y)
+{
+ int i;
+
+ // The title and all the text
+ CMenuMultiChoice::DrawHighlighted(titleHighlight, x, y);
+
+ CRGBA selectedColor = m_options[0].GetSelectedColor();
+ CRGBA color = m_options[0].GetColor();
+
+ // The sprites
+ for(i = 0; i < m_numOptions; i++)
+ if(m_bHasSprite[i]){
+ if(m_options[i].m_bSelected)
+ m_sprites[i].Draw(selectedColor, m_position.x+x, m_position.y+y);
+ else
+ m_sprites[i].Draw(color, m_position.x+x, m_position.y+y);
+ }
+}
+
+void
+CMenuMultiChoicePictured::SetAlpha(uint8 alpha)
+{
+ int i;
+ CMenuMultiChoice::SetAlpha(alpha);
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_sprites[i].SetAlpha(alpha);
+
+}
+
+
+/*
+ * CMenuMultiChoicePicturedTriggered
+ */
+
+void
+CMenuMultiChoicePicturedTriggered::Initialise(void)
+{
+ int i;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_triggers[i] = nil;
+ m_defaultCancel = nil; // missing on PS2
+}
+
+CPlaceableShOption*
+CMenuMultiChoicePicturedTriggered::AddOption(CSprite2d *sprite, float positionX, float positionY, const CVector2D &size, Trigger trigger, bool bSelected)
+{
+ CPlaceableShOption *option;
+ option = CMenuMultiChoicePictured::AddOption(sprite, positionX, positionY, size, bSelected);
+ if(option)
+ m_triggers[m_numOptions-1] = trigger;
+ return option;
+}
+
+void
+CMenuMultiChoicePicturedTriggered::SelectCurrentOptionUnderCursor(void)
+{
+ CMenuMultiChoice::SelectCurrentOptionUnderCursor();
+ if(m_cursor != -1)
+ m_triggers[m_cursor](this);
+}
+
+void
+CMenuMultiChoicePicturedTriggered::SelectDefaultCancelAction(void)
+{
+ if(m_defaultCancel)
+ m_defaultCancel(this);
+}
+
+/*
+ * CMenuMultiChoicePicturedTriggeredAnyMove
+ */
+
+void
+CMenuMultiChoicePicturedTriggeredAnyMove::Initialise(void)
+{
+ int i;
+ CMenuMultiChoicePicturedTriggered::Initialise();
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++){
+ m_moveTab[i].right = -1;
+ m_moveTab[i].left = -1;
+ m_moveTab[i].down = -1;
+ m_moveTab[i].up = -1;
+ }
+}
+
+CPlaceableShOption*
+CMenuMultiChoicePicturedTriggeredAnyMove::AddOption(CSprite2d *sprite, FEC_MOVETAB *moveTab, float positionX, float positionY, const CVector2D &size, Trigger trigger, bool bSelected)
+{
+ CPlaceableShOption *option;
+ option = CMenuMultiChoicePicturedTriggered::AddOption(sprite, positionX, positionY, size, trigger, bSelected);
+ if(option && moveTab)
+ m_moveTab[m_numOptions-1] = *moveTab;
+ return option;
+}
+
+bool
+CMenuMultiChoicePicturedTriggeredAnyMove::GoDown(void)
+{
+ int move = m_moveTab[m_cursor].down;
+ if(move == -1)
+ return GoNext();
+ m_cursor = move;
+ return true;
+}
+
+bool
+CMenuMultiChoicePicturedTriggeredAnyMove::GoUp(void)
+{
+ int move = m_moveTab[m_cursor].up;
+ if(move == -1)
+ return GoPrev();
+ m_cursor = move;
+ return true;
+}
+
+bool
+CMenuMultiChoicePicturedTriggeredAnyMove::GoLeft(void)
+{
+ int move = m_moveTab[m_cursor].left;
+ if(move == -1)
+ return GoPrev();
+ m_cursor = move;
+ return true;
+}
+
+bool
+CMenuMultiChoicePicturedTriggeredAnyMove::GoRight(void)
+{
+ int move = m_moveTab[m_cursor].right;
+ if(move == -1)
+ return GoNext();
+ m_cursor = move;
+ return true;
+}
+
+
+/*
+ * CMenuMultiChoiceTwoLines
+ */
+
+void
+CMenuMultiChoiceTwoLines::AddTitle(wchar *text, float positionX, float positionY, bool bRightJustify)
+{
+ m_title.m_text = text;
+ m_title.SetPosition(positionX, positionY, bRightJustify);
+}
+
+CPlaceableShOptionTwoLines*
+CMenuMultiChoiceTwoLines::AddOption(wchar *text, float positionX, float positionY, bool bSelected, bool bRightJustify)
+{
+ return AddOption(text, positionX, positionY, nil, 0.0f, 0.0f, bSelected, bRightJustify);
+}
+
+CPlaceableShOptionTwoLines*
+CMenuMultiChoiceTwoLines::AddOption(wchar *text1, float positionX1, float positionY1, wchar *text2, float positionX2, float positionY2, bool bSelected, bool bRightJustify)
+{
+ if(m_numOptions == NUM_MULTICHOICE_OPTIONS)
+ return nil;
+ m_options[m_numOptions].m_line1.m_text = text1;
+ m_options[m_numOptions].m_line2.m_text = text2;
+ m_options[m_numOptions].m_line1.SetPosition(positionX1, positionY1);
+ m_options[m_numOptions].m_line2.SetPosition(positionX2, positionY2);
+ m_options[m_numOptions].m_bSelected = bSelected;
+ m_options[m_numOptions].m_bRightJustify = bRightJustify;
+ return &m_options[m_numOptions++];
+}
+
+
+void
+CMenuMultiChoiceTwoLines::SetColors(const CRGBA &title, const CRGBA &normal, const CRGBA &selected)
+{
+ int i;
+ m_title.SetColor(title);
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].SetColors(normal, selected);
+}
+
+void
+CMenuMultiChoiceTwoLines::SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale)
+{
+ m_bSetTextScale = bTextScale;
+ m_textScale = newScale;
+ m_oldTextScale = oldScale;
+ m_bSetTitleTextScale = bTitleTextScale;
+}
+
+void
+CMenuMultiChoiceTwoLines::Draw(CRGBA const &optionHighlight ,CRGBA const &titleHighlight, float x, float y)
+{
+ int i;
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ if(m_cursor == -1)
+ m_title.Draw(m_position.x+x, m_position.y+y);
+ else
+ m_title.Draw(titleHighlight, m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ if(m_cursor == -1)
+ for(i = 0; i < m_numOptions; i++)
+ m_options[i].Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+ else
+ for(i = 0; i < m_numOptions; i++){
+ if(i == m_cursor)
+ m_options[i].Draw(optionHighlight, m_position.x+x, m_position.y+y);
+ else
+ m_options[i].Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+ }
+
+ if(m_bSetTextScale){
+ CFont::DrawFonts();
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+ }
+}
+
+void
+CMenuMultiChoiceTwoLines::DrawNormal(float x, float y)
+{
+ int i;
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ m_title.Draw(m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ for(i = 0; i < m_numOptions; i++)
+ m_options[i].Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+
+ if(m_bSetTextScale){
+ CFont::DrawFonts();
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+ }
+}
+
+void
+CMenuMultiChoiceTwoLines::DrawHighlighted(CRGBA const &titleHighlight, float x, float y)
+{
+ int i;
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ if(m_cursor == -1)
+ m_title.Draw(m_position.x+x, m_position.y+y);
+ else
+ m_title.Draw(titleHighlight, m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ for(i = 0; i < m_numOptions; i++)
+ m_options[i].Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+
+ if(m_bSetTextScale){
+ CFont::DrawFonts();
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+ }
+}
+
+void
+CMenuMultiChoiceTwoLines::SetAlpha(uint8 alpha)
+{
+ int i;
+ m_title.SetAlpha(alpha);
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].SetAlpha(alpha);
+}
+
+void
+CMenuMultiChoiceTwoLines::SetShadows(bool bDropShadows, CRGBA const &shadowColor, CVector2D const &shadowOffset)
+{
+ int i;
+ m_title.SetShadows(bDropShadows, shadowColor, shadowOffset);
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].SetShadows(bDropShadows, shadowColor, shadowOffset);
+}
+
+
+bool
+CMenuMultiChoiceTwoLines::GoNext(void)
+{
+ if(m_cursor == m_numOptions-1){
+ m_cursor = -1;
+ return false;
+ }else{
+ m_cursor++;
+ return true;
+ }
+}
+
+bool
+CMenuMultiChoiceTwoLines::GoPrev(void)
+{
+ if(m_cursor == 0){
+ m_cursor = -1;
+ return false;
+ }else{
+ m_cursor--;
+ return true;
+ }
+}
+
+void
+CMenuMultiChoiceTwoLines::SelectCurrentOptionUnderCursor(void)
+{
+ int i;
+ if(m_cursor == -1)
+ return;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].m_bSelected = false;
+ m_options[m_cursor].m_bSelected = true;
+}
+
+int
+CMenuMultiChoiceTwoLines::GetMenuSelection(void)
+{
+ int i;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ if(m_options[i].m_bSelected)
+ return i;
+ return -1;
+}
+
+void
+CMenuMultiChoiceTwoLines::SetMenuSelection(int selection)
+{
+ int i;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_options[i].m_bSelected = false;
+ m_options[selection%NUM_MULTICHOICE_OPTIONS].m_bSelected = true;
+}
+
+/*
+ * CMenuMultiChoiceTwoLinesTriggered
+ */
+
+void
+CMenuMultiChoiceTwoLinesTriggered::Initialise(void)
+{
+ int i;
+ for(i = 0; i < NUM_MULTICHOICE_OPTIONS; i++)
+ m_triggers[i] = nil;
+ m_defaultCancel = nil;
+}
+
+CPlaceableShOptionTwoLines*
+CMenuMultiChoiceTwoLinesTriggered::AddOption(wchar *text, float positionX, float positionY, Trigger trigger, bool bSelected, bool bRightJustify)
+{
+ CPlaceableShOptionTwoLines *option;
+ option = CMenuMultiChoiceTwoLines::AddOption(text, positionX, positionY, bSelected, bRightJustify);
+ if(option)
+ m_triggers[m_numOptions-1] = trigger;
+ return option;
+}
+
+CPlaceableShOptionTwoLines*
+CMenuMultiChoiceTwoLinesTriggered::AddOption(wchar *text1, float positionX1, float positionY1, wchar *text2, float positionX2, float positionY2, Trigger trigger, bool bSelected, bool bRightJustify)
+{
+ CPlaceableShOptionTwoLines *option;
+ option = CMenuMultiChoiceTwoLines::AddOption(text1, positionX1, positionY1, text2, positionX2, positionY2, bSelected, bRightJustify);
+ if(option)
+ m_triggers[m_numOptions-1] = trigger;
+ return option;
+}
+
+void
+CMenuMultiChoiceTwoLinesTriggered::SelectCurrentOptionUnderCursor(void)
+{
+ CMenuMultiChoiceTwoLines::SelectCurrentOptionUnderCursor();
+ if(m_cursor != -1)
+ m_triggers[m_cursor](this);
+}
+
+void
+CMenuMultiChoiceTwoLinesTriggered::SelectDefaultCancelAction(void)
+{
+ if(m_defaultCancel)
+ m_defaultCancel(this);
+}
+
+
+/*
+ * CMenuOnOff
+ */
+
+void
+CMenuOnOff::SetColors(const CRGBA &title, const CRGBA &options)
+{
+ m_title.SetColors(title, title);
+ m_options[0].SetColor(options);
+ m_options[1].SetColor(options);
+}
+
+void
+CMenuOnOff::SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale)
+{
+ m_bSetTextScale = bTextScale;
+ m_textScale = newScale;
+ m_oldTextScale = oldScale;
+ m_bSetTitleTextScale = bTitleTextScale;
+}
+
+void
+CMenuOnOff::SetOptionPosition(float x, float y, bool bRightJustify)
+{
+ m_options[0].SetPosition(x, y, bRightJustify);
+ m_options[1].SetPosition(x, y, bRightJustify);
+}
+
+void
+CMenuOnOff::AddTitle(wchar *text, bool bSelected, float positionX, float positionY, bool bRightJustify)
+{
+ m_title.m_text = text;
+ m_title.m_bSelected = bSelected;
+ m_title.SetPosition(positionX, positionY, bRightJustify);
+}
+
+void
+CMenuOnOff::Draw(CRGBA const &optionHighlight, CRGBA const &titleHighlight, float x, float y)
+{
+ if(m_type == 1){
+ m_options[0].m_text = TheText.Get("FEM_NO");
+ m_options[1].m_text = TheText.Get("FEM_YES");
+ }else if(m_type == 0){
+ m_options[0].m_text = TheText.Get("FEM_OFF");
+ m_options[1].m_text = TheText.Get("FEM_ON");
+ }
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ if(m_bActive)
+ m_title.Draw(titleHighlight, m_position.x+x, m_position.y+y);
+ else
+ m_title.Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ if(m_bActive){
+ if(m_title.m_bSelected)
+ m_options[1].Draw(optionHighlight, m_position.x+x, m_position.y+y);
+ else
+ m_options[0].Draw(optionHighlight, m_position.x+x, m_position.y+y);
+ }else{
+ if(m_title.m_bSelected)
+ m_options[1].Draw(m_position.x+x, m_position.y+y);
+ else
+ m_options[0].Draw(m_position.x+x, m_position.y+y);
+ }
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+}
+
+void
+CMenuOnOff::DrawNormal(float x, float y)
+{
+ if(m_type == 1){
+ m_options[0].m_text = TheText.Get("FEM_NO");
+ m_options[1].m_text = TheText.Get("FEM_YES");
+ }else if(m_type == 0){
+ m_options[0].m_text = TheText.Get("FEM_OFF");
+ m_options[1].m_text = TheText.Get("FEM_ON");
+ }
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ m_title.Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ if(m_title.m_bSelected)
+ m_options[1].Draw(m_position.x+x, m_position.y+y);
+ else
+ m_options[0].Draw(m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+}
+
+void
+CMenuOnOff::DrawHighlighted(CRGBA const &titleHighlight, float x, float y)
+{
+ if(m_type == 1){
+ m_options[0].m_text = TheText.Get("FEM_NO");
+ m_options[1].m_text = TheText.Get("FEM_YES");
+ }else if(m_type == 0){
+ m_options[0].m_text = TheText.Get("FEM_OFF");
+ m_options[1].m_text = TheText.Get("FEM_ON");
+ }
+
+ if(m_bSetTextScale && m_bSetTitleTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+ if(m_bActive)
+ m_title.Draw(titleHighlight, m_position.x+x, m_position.y+y);
+ else
+ m_title.Draw(CRGBA(0,0,0,0), m_position.x+x, m_position.y+y, false);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_textScale.x, m_textScale.y);
+
+ if(m_title.m_bSelected)
+ m_options[1].Draw(m_position.x+x, m_position.y+y);
+ else
+ m_options[0].Draw(m_position.x+x, m_position.y+y);
+
+ if(m_bSetTextScale)
+ CFont::SetScale(m_oldTextScale.x, m_oldTextScale.y);
+}
+
+void
+CMenuOnOff::SetAlpha(uint8 alpha)
+{
+ m_title.SetAlpha(alpha);
+ m_options[0].SetAlpha(alpha);
+ m_options[1].SetAlpha(alpha);
+}
+
+void
+CMenuOnOff::SetShadows(bool bDropShadows, CRGBA const &shadowColor, CVector2D const &shadowOffset)
+{
+ m_title.SetShadows(bDropShadows, shadowColor, shadowOffset);
+ m_options[0].SetShadows(bDropShadows, shadowColor, shadowOffset);
+ m_options[1].SetShadows(bDropShadows, shadowColor, shadowOffset);
+}
+
+/*
+ * CMenuOnOffTriggered
+ */
+
+void
+CMenuOnOffTriggered::SetOptionPosition(float x, float y, Trigger trigger, bool bRightJustify)
+{
+ CMenuOnOff::SetOptionPosition(x, y, bRightJustify);
+ if(trigger)
+ m_trigger = trigger;
+}
+
+void
+CMenuOnOffTriggered::SelectCurrentOptionUnderCursor(void)
+{
+ CMenuOnOff::SelectCurrentOptionUnderCursor();
+ if(m_trigger)
+ m_trigger(this);
+}
+
+
+
+/*
+ * CMenuSlider
+ */
+
+char CMenuSlider::Buf8[8];
+wchar CMenuSlider::Buf16[8];
+
+void
+CMenuSlider::SetColors(const CRGBA &title, const CRGBA &percentage, const CRGBA &left, const CRGBA &right)
+{
+ m_title.SetColor(title);
+ m_percentageText.SetColor(percentage);
+ m_colors[0] = left;
+ m_colors[1] = right;
+}
+
+
+void
+CMenuSlider::AddTickBox(float positionX, float positionY, float width, float heightLeft, float heightRight)
+{
+ m_box.SetPosition(positionX, positionY);
+ m_size[0].x = width;
+ m_size[0].y = heightLeft;
+ m_size[1].x = width;
+ m_size[1].y = heightRight;
+}
+
+void
+CMenuSlider::AddTitle(wchar *text, float positionX, float positionY)
+{
+ m_title.m_text = text;
+ m_title.SetPosition(positionX, positionY);
+}
+
+static CRGBA SELECTED_TEXT_COLOR_0(255, 182, 48, 255);
+
+void
+CMenuSlider::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y)
+{
+ if(m_bActive){
+ CRGBA selectionCol = m_colors[0];
+ if(selectionCol.red == SELECTED_TEXT_COLOR_0.red &&
+ selectionCol.green == SELECTED_TEXT_COLOR_0.green &&
+ selectionCol.blue == SELECTED_TEXT_COLOR_0.blue &&
+ selectionCol.alpha == SELECTED_TEXT_COLOR_0.alpha)
+ selectionCol = m_colors[1];
+
+ if(m_style == 1){
+ // solid bar
+ CRGBA shadowCol = m_box.GetShadowColor();
+ float f = m_value/1000.0f;
+ CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
+ if(m_box.m_bDropShadow)
+ CSprite2d::DrawRect(
+ CRect(boxPos.x + m_box.m_shadowOffset.x,
+ boxPos.y + m_box.m_shadowOffset.y,
+ boxPos.x + m_box.m_shadowOffset.x + m_size[0].x,
+ boxPos.y + m_box.m_shadowOffset.y + m_size[0].y),
+ shadowCol);
+ CSprite2d::DrawRect(
+ CRect(boxPos.x, boxPos.y,
+ boxPos.x + m_size[0].x, boxPos.y + m_size[0].y),
+ m_colors[1]);
+ CSprite2d::DrawRect(
+ CRect(boxPos.x, boxPos.y,
+ boxPos.x + m_size[0].x*f, boxPos.y + m_size[0].y),
+ selectionCol);
+ }else if(m_style == 0){
+ // ticks...
+ CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
+ DrawTicks(boxPos, m_size[0], m_size[1].y,
+ m_value/1000.0f, m_colors[0], selectionCol, m_colors[1],
+ m_box.m_bDropShadow, m_box.m_shadowOffset, m_box.GetShadowColor());
+ }
+
+ m_title.Draw(titleHighlight, m_position.x+x, m_position.y+y);
+
+ if(m_bDrawPercentage){
+ sprintf(Buf8, "%d%%", m_value/10);
+ AsciiToUnicode(Buf8, Buf16);
+ m_percentageText.m_text = Buf16;
+ m_percentageText.Draw(optionHighlight, m_position.x+x, m_position.y+y);
+ }
+ }else
+ CMenuSlider::DrawNormal(x, y);
+}
+
+void
+CMenuSlider::DrawNormal(float x, float y)
+{
+ if(m_style == 1){
+ // solid bar
+ CRGBA shadowCol = m_box.GetShadowColor();
+ float f = m_value/1000.0f;
+ CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
+ if(m_box.m_bDropShadow)
+ CSprite2d::DrawRect(
+ CRect(boxPos.x + m_box.m_shadowOffset.x,
+ boxPos.y + m_box.m_shadowOffset.y,
+ boxPos.x + m_box.m_shadowOffset.x + m_size[0].x,
+ boxPos.y + m_box.m_shadowOffset.y + m_size[0].y),
+ shadowCol);
+ CSprite2d::DrawRect(
+ CRect(boxPos.x, boxPos.y,
+ boxPos.x + m_size[0].x, boxPos.y + m_size[0].y),
+ m_colors[1]);
+ CSprite2d::DrawRect(
+ CRect(boxPos.x, boxPos.y,
+ boxPos.x + m_size[0].x*f, boxPos.y + m_size[0].y),
+ m_colors[0]);
+ }else if(m_style == 0){
+ // ticks...
+ CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
+ DrawTicks(boxPos, m_size[0], m_size[1].y,
+ m_value/1000.0f, m_colors[0], m_colors[1],
+ m_box.m_bDropShadow, m_box.m_shadowOffset, m_box.GetShadowColor());
+ }
+
+ m_title.Draw(m_position.x+x, m_position.y+y);
+
+ if(m_bDrawPercentage){
+ sprintf(Buf8, "%d%%", m_value/10);
+ AsciiToUnicode(Buf8, Buf16);
+ m_percentageText.m_text = Buf16;
+ m_percentageText.Draw(m_percentageText.GetColor(), m_position.x+x, m_position.y+y);
+ }
+}
+
+void
+CMenuSlider::DrawHighlighted(const CRGBA &titleHighlight, float x, float y)
+{
+ if(m_bActive)
+ m_title.Draw(titleHighlight, m_position.x+x, m_position.y+y);
+ else
+ m_title.Draw(m_position.x+x, m_position.y+y);
+
+ if(m_style == 1){
+ // solid bar
+ CRGBA shadowCol = m_box.GetShadowColor();
+ float f = m_value/1000.0f;
+ CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
+ if(m_box.m_bDropShadow)
+ CSprite2d::DrawRect(
+ CRect(boxPos.x + m_box.m_shadowOffset.x,
+ boxPos.y + m_box.m_shadowOffset.y,
+ boxPos.x + m_box.m_shadowOffset.x + m_size[0].x,
+ boxPos.y + m_box.m_shadowOffset.y + m_size[0].y),
+ shadowCol);
+ CSprite2d::DrawRect(
+ CRect(boxPos.x, boxPos.y,
+ boxPos.x + m_size[0].x, boxPos.y + m_size[0].y),
+ m_colors[1]);
+ CSprite2d::DrawRect(
+ CRect(boxPos.x, boxPos.y,
+ boxPos.x + m_size[0].x*f, boxPos.y + m_size[0].y),
+ m_colors[0]);
+ }else if(m_style == 0){
+ // ticks...
+ CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
+ DrawTicks(boxPos, m_size[0], m_size[1].y,
+ m_value/1000.0f, m_colors[0], m_colors[1],
+ m_box.m_bDropShadow, m_box.m_shadowOffset, m_box.GetShadowColor());
+ }
+
+ if(m_bDrawPercentage){
+ sprintf(Buf8, "%d%%", m_value/10);
+ AsciiToUnicode(Buf8, Buf16);
+ m_percentageText.m_text = Buf16;
+ m_percentageText.Draw(m_percentageText.GetColor(), m_position.x+x, m_position.y+y);
+ }
+}
+
+void
+CMenuSlider::DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &selCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor)
+{
+ int i;
+ int numTicks = size.x / 8.0f;
+ float dy = heightRight - size.y;
+ float stepy = dy / numTicks;
+ int left = level*numTicks;
+ int drewSelection = 0;
+ for(i = 0; i < numTicks; i++){
+ CRect rect(position.x + 8.0f*i, position.y + dy - stepy*i,
+ position.x + 8.0f*i + 4.0f, position.y + dy + size.y);
+ if(bShadow){
+ CRect shadowRect = rect;
+ shadowRect.left += shadowOffset.x;
+ shadowRect.right += shadowOffset.x;
+ shadowRect.top += shadowOffset.y;
+ shadowRect.bottom += shadowOffset.y;
+ CSprite2d::DrawRect(shadowRect, shadowColor);
+ }
+ if(i < left)
+ CSprite2d::DrawRect(rect, leftCol);
+ else if(!drewSelection){
+ CSprite2d::DrawRect(rect, selCol);
+ drewSelection = 1;
+ }else
+ CSprite2d::DrawRect(rect, rightCol);
+ }
+}
+
+void
+CMenuSlider::DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor)
+{
+ int i;
+ int numTicks = size.x / 8.0f;
+ float dy = heightRight - size.y;
+ float stepy = dy / numTicks;
+ int left = level*numTicks;
+ for(i = 0; i < numTicks; i++){
+ CRect rect(position.x + 8.0f*i, position.y + dy - stepy*i,
+ position.x + 8.0f*i + 4.0f, position.y + dy + size.y);
+ if(bShadow){
+ CRect shadowRect = rect;
+ shadowRect.left += shadowOffset.x;
+ shadowRect.right += shadowOffset.x;
+ shadowRect.top += shadowOffset.y;
+ shadowRect.bottom += shadowOffset.y;
+ CSprite2d::DrawRect(shadowRect, shadowColor);
+ }
+ if(i < left)
+ CSprite2d::DrawRect(rect, leftCol);
+ else
+ CSprite2d::DrawRect(rect, rightCol);
+ }
+}
+
+void
+CMenuSlider::SetAlpha(uint8 alpha)
+{
+ m_title.SetAlpha(alpha);
+ m_box.SetAlpha(alpha);
+ m_someAlpha = alpha;
+ m_percentageText.SetAlpha(alpha);
+ m_colors[0].alpha = alpha;
+ m_colors[1].alpha = alpha;
+}
+
+void
+CMenuSlider::SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset)
+{
+ m_title.SetShadows(bDropShadows, shadowColor, shadowOffset);
+ m_box.SetShadows(bDropShadows, shadowColor, shadowOffset);
+ m_percentageText.SetShadows(bDropShadows, shadowColor, shadowOffset);
+}
+
+/*
+ * CMenuSliderTriggered
+ */
+
+void
+CMenuSliderTriggered::AddTickBox(float positionX, float positionY, float width, float heightLeft, float heightRight, Trigger trigger, Trigger alwaysTrigger)
+{
+ CMenuSlider::AddTickBox(positionX, positionY, width, heightLeft, heightRight);
+ m_trigger = trigger;
+ m_alwaysTrigger = alwaysTrigger;
+}
+
+void
+CMenuSliderTriggered::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y)
+{
+ CMenuSlider::Draw(optionHighlight, titleHighlight, x, y);
+ if(m_alwaysTrigger)
+ m_alwaysTrigger(this);
+}
+
+bool
+CMenuSliderTriggered::GoLeft(void)
+{
+ CMenuSlider::GoLeft();
+ if(m_trigger)
+ m_trigger(this);
+ return true;
+}
+
+bool
+CMenuSliderTriggered::GoRight(void)
+{
+ CMenuSlider::GoRight();
+ if(m_trigger)
+ m_trigger(this);
+ return true;
+}
+
+bool
+CMenuSliderTriggered::GoLeftStill(void)
+{
+ CMenuSlider::GoLeftStill();
+ if(m_trigger)
+ m_trigger(this);
+ return true;
+}
+
+bool
+CMenuSliderTriggered::GoRightStill(void)
+{
+ CMenuSlider::GoRightStill();
+ if(m_trigger)
+ m_trigger(this);
+ return true;
+}
+
+/*
+ * CMenuLineLister
+ */
+
+CMenuLineLister::CMenuLineLister(void)
+ : m_numLines(0), m_width(0.0f), m_height(0.0f),
+ m_scrollPosition(0.0f), m_scrollSpeed(1.0f), m_lineSpacing(15.0f), field_10E8(0)
+{
+ int i;
+ for(i = 0; i < NUM_LINELISTER_LINES_TOTAL; i++){
+ m_lineAlphas[i] = 0;
+ m_lineFade[i] = 0;
+ }
+}
+
+
+void
+CMenuLineLister::SetLinesColor(const CRGBA &color)
+{
+ int i;
+ for(i = 0; i < NUM_LINELISTER_LINES_TOTAL; i++){
+ m_linesLeft[i].SetColor(color);
+ m_linesRight[i].SetColor(color);
+ }
+}
+
+void
+CMenuLineLister::ResetNumberOfTextLines(void)
+{
+ int i;
+ m_numLines = 0;
+ for(i = 0; i < NUM_LINELISTER_LINES_TOTAL; i++){
+ m_lineAlphas[i] = 0;
+ m_lineFade[i] = 0;
+ }
+ for(i = 0; i < NUM_LINELISTER_LINES_TOTAL; i++){
+ // note this doesn't clear lines 0-14, probably an oversight
+ GetLeftLine(i)->m_text = nil;
+ GetRightLine(i)->m_text = nil;
+ }
+}
+
+bool
+CMenuLineLister::AddTextLine(wchar *left, wchar *right)
+{
+ CPlaceableShText *leftLine, *rightLine;
+ if(m_numLines == NUM_LINELISTER_LINES)
+ return false;
+ leftLine = GetLeftLine(m_numLines);
+ leftLine->m_text = left;
+ leftLine->SetPosition(0.0f, m_lineSpacing*(m_numLines+15));
+ rightLine = GetRightLine(m_numLines);
+ rightLine->m_text = right;
+ rightLine->SetPosition(leftLine->m_position.x, leftLine->m_position.y);
+ m_numLines++;
+ return true;
+}
+
+void
+CMenuLineLister::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y)
+{
+ int i, n;
+
+ m_scrollPosition += m_scrollSpeed;
+ n = m_numLines + 15;
+ if(m_scrollSpeed > 0.0f){
+ if(m_scrollPosition > n*m_lineSpacing)
+ m_scrollPosition = 0.0f;
+ }else{
+ if(m_scrollPosition < 0.0f)
+ m_scrollPosition = n*m_lineSpacing;
+ }
+ // this is a weird condition....
+ for(i = 0;
+ m_scrollPosition < i*m_lineSpacing || m_scrollPosition >= (i+1)*m_lineSpacing;
+ i++);
+
+ float screenPos = 0.0f;
+ for(; i < n; i++){
+ CVector2D linePos = m_linesLeft[i].m_position;
+
+ if(linePos.y+m_position.y - (m_scrollPosition+m_position.y) < 64.0f)
+ m_lineFade[i] = -4.0f*Abs(m_scrollSpeed);
+ else
+ m_lineFade[i] = 4.0f*Abs(m_scrollSpeed);
+ int newAlpha = m_lineAlphas[i] + m_lineFade[i];
+ if(newAlpha < 0) newAlpha = 0;
+ if(newAlpha > 255) newAlpha = 255;
+ m_lineAlphas[i] = newAlpha;
+
+ uint8 alpha = m_linesLeft[i].m_shadowColor.alpha;
+
+ // apply alpha
+ m_linesLeft[i].SetAlpha((alpha*m_lineAlphas[i])>>8);
+ m_linesRight[i].SetAlpha((alpha*m_lineAlphas[i])>>8);
+
+ m_linesLeft[i].Draw(m_position.x+x, m_position.y+y - m_scrollPosition);
+ CFont::SetRightJustifyOn();
+ m_linesRight[i].Draw(m_position.x+x + m_width, m_position.y+y - m_scrollPosition);
+ CFont::SetRightJustifyOff();
+
+ // restore alpha
+ m_linesLeft[i].SetAlpha(alpha);
+ m_linesRight[i].SetAlpha(alpha);
+
+ screenPos += m_lineSpacing;
+ if(screenPos >= m_height)
+ break;
+ }
+
+ m_scrollSpeed = 1.0f;
+}
+
+void
+CMenuLineLister::SetAlpha(uint8 alpha)
+{
+ int i;
+ for(i = 0; i < NUM_LINELISTER_LINES_TOTAL; i++){
+ m_linesLeft[i].SetAlpha(alpha);
+ m_linesRight[i].SetAlpha(alpha);
+ }
+}
+
+void
+CMenuLineLister::SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset)
+{
+ int i;
+ for(i = 0; i < NUM_LINELISTER_LINES_TOTAL; i++){
+ m_linesLeft[i].SetShadows(bDropShadows, shadowColor, shadowOffset);
+ m_linesRight[i].SetShadows(bDropShadows, shadowColor, shadowOffset);
+ }
+}
+
+
+/*
+ * CMenuPage
+ */
+
+void
+CMenuPage::Initialise(void)
+{
+ int i;
+ m_numControls = 0;
+ m_pCurrentControl = nil;
+ m_cursor = 0;
+ for(i = 0; i < NUM_PAGE_WIDGETS; i++)
+ m_controls[i] = nil;
+}
+
+bool
+CMenuPage::AddMenu(CMenuBase *widget)
+{
+ if(m_numControls >= NUM_PAGE_WIDGETS)
+ return false;
+ m_controls[m_numControls] = widget;
+ if(m_numControls == 0){
+ m_pCurrentControl = widget;
+ m_cursor = 0;
+ }
+ m_numControls++;
+ return true;
+}
+
+bool
+CMenuPage::IsActiveMenuTwoState(void)
+{
+ return m_pCurrentControl && m_pCurrentControl->m_bTwoState;
+}
+
+void
+CMenuPage::ActiveMenuTwoState_SelectNextPosition(void)
+{
+ int sel;
+ if(m_pCurrentControl == nil || !m_pCurrentControl->m_bTwoState)
+ return;
+ m_pCurrentControl->GoFirst();
+ sel = m_pCurrentControl->GetMenuSelection();
+ if(sel == 1)
+ m_pCurrentControl->SelectCurrentOptionUnderCursor();
+ else if(sel == 0){
+ m_pCurrentControl->GoNext();
+ m_pCurrentControl->SelectCurrentOptionUnderCursor();
+ }
+}
+
+void
+CMenuPage::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y)
+{
+ int i;
+ for(i = 0; i < m_numControls; i++)
+ if(m_controls[i]){
+ if(i == m_cursor)
+ m_controls[i]->Draw(optionHighlight, titleHighlight, x, y);
+ else
+ m_controls[i]->DrawNormal(x, y);
+ }
+}
+
+void
+CMenuPage::DrawHighlighted(const CRGBA &titleHighlight, float x, float y)
+{
+ int i;
+ for(i = 0; i< m_numControls; i++)
+ if(m_controls[i]){
+ if(i == m_cursor)
+ m_controls[i]->DrawHighlighted(titleHighlight, x, y);
+ else
+ m_controls[i]->DrawNormal(x, y);
+ }
+}
+
+void
+CMenuPage::DrawNormal(float x, float y)
+{
+ int i;
+ for(i = 0; i< m_numControls; i++)
+ if(m_controls[i])
+ m_controls[i]->DrawNormal(x, y);
+}
+
+void
+CMenuPage::ActivatePage(void)
+{
+ m_cursor = 0;
+ if(m_numControls == 0)
+ return;
+ for(;;){
+ m_pCurrentControl = m_controls[m_cursor];
+ if(m_pCurrentControl->GoFirst())
+ return;
+ if(m_cursor == m_numControls-1)
+ m_cursor = 0;
+ else
+ m_cursor++;
+ }
+}
+
+void
+CMenuPage::SetAlpha(uint8 alpha)
+{
+ int i;
+ for(i = 0; i< m_numControls; i++)
+ if(m_controls[i])
+ m_controls[i]->SetAlpha(alpha);
+}
+
+void
+CMenuPage::SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset)
+{
+ int i;
+ for(i = 0; i< m_numControls; i++)
+ if(m_controls[i])
+ m_controls[i]->SetShadows(bDropShadows, shadowColor, shadowOffset);
+}
+
+void
+CMenuPage::GoUpMenuOnPage(void)
+{
+ if(m_pCurrentControl == nil)
+ return;
+ m_pCurrentControl->DeactivateMenu();
+ do{
+ if(m_cursor == 0)
+ m_cursor = m_numControls-1;
+ else
+ m_cursor--;
+ m_pCurrentControl = m_controls[m_cursor];
+ }while(!m_pCurrentControl->GoLast());
+}
+
+void
+CMenuPage::GoDownMenuOnPage(void)
+{
+ if(m_pCurrentControl == nil)
+ return;
+ m_pCurrentControl->DeactivateMenu();
+ do{
+ if(m_cursor == m_numControls-1)
+ m_cursor = 0;
+ else
+ m_cursor++;
+ m_pCurrentControl = m_controls[m_cursor];
+ }while(!m_pCurrentControl->GoFirst());
+}
+
+void
+CMenuPage::GoLeftMenuOnPage(void)
+{
+ // same as up
+ if(m_pCurrentControl == nil)
+ return;
+ m_pCurrentControl->DeactivateMenu();
+ do{
+ if(m_cursor == 0)
+ m_cursor = m_numControls-1;
+ else
+ m_cursor--;
+ m_pCurrentControl = m_controls[m_cursor];
+ }while(!m_pCurrentControl->GoLast());
+}
+
+void
+CMenuPage::GoRightMenuOnPage(void)
+{
+ // same as right
+ if(m_pCurrentControl == nil)
+ return;
+ m_pCurrentControl->DeactivateMenu();
+ do{
+ if(m_cursor == m_numControls-1)
+ m_cursor = 0;
+ else
+ m_cursor++;
+ m_pCurrentControl = m_controls[m_cursor];
+ }while(!m_pCurrentControl->GoFirst());
+}
+
+/*
+ * CMenuPageAnyMove
+ */
+
+void
+CMenuPageAnyMove::Initialise(void)
+{
+ int i;
+ CMenuPage::Initialise();
+ for(i = 0; i < NUM_PAGE_WIDGETS; i++){
+ m_moveTab[i].left = -1;
+ m_moveTab[i].right = -1;
+ m_moveTab[i].up = -1;
+ m_moveTab[i].down = -1;
+ }
+}
+
+bool
+CMenuPageAnyMove::AddMenu(CMenuBase *widget, FEC_MOVETAB *moveTab)
+{
+ if(AddMenu(widget)){
+ m_moveTab[m_numControls-1] = *moveTab;
+ return true;
+ }
+ return false;
+}
+
+void
+CMenuPageAnyMove::GoUpMenuOnPage(void)
+{
+ if(m_pCurrentControl == nil)
+ return;
+ m_pCurrentControl->DeactivateMenu();
+ int move = m_moveTab[m_cursor].up;
+ if(move == -1)
+ CMenuPage::GoUpMenuOnPage();
+ else{ // BUG: no else in original code
+ m_cursor = move;
+ m_pCurrentControl = m_controls[m_cursor];
+ m_pCurrentControl->GoLast();
+ }
+}
+
+void
+CMenuPageAnyMove::GoDownMenuOnPage(void)
+{
+ if(m_pCurrentControl == nil)
+ return;
+ m_pCurrentControl->DeactivateMenu();
+ int move = m_moveTab[m_cursor].down;
+ if(move == -1)
+ CMenuPage::GoDownMenuOnPage();
+ else{ // BUG: no else in original code
+ m_cursor = move;
+ m_pCurrentControl = m_controls[m_cursor];
+ m_pCurrentControl->GoLast();
+ }
+}
+
+void
+CMenuPageAnyMove::GoLeftMenuOnPage(void)
+{
+ if(m_pCurrentControl == nil)
+ return;
+ m_pCurrentControl->DeactivateMenu();
+ int move = m_moveTab[m_cursor].left;
+ if(move == -1)
+ CMenuPage::GoLeftMenuOnPage();
+ else{ // BUG: no else in original code
+ m_cursor = move;
+ m_pCurrentControl = m_controls[m_cursor];
+ m_pCurrentControl->GoLast();
+ }
+}
+
+void
+CMenuPageAnyMove::GoRightMenuOnPage(void)
+{
+ if(m_pCurrentControl == nil)
+ return;
+ m_pCurrentControl->DeactivateMenu();
+ int move = m_moveTab[m_cursor].right;
+ if(move == -1)
+ CMenuPage::GoRightMenuOnPage();
+ else{ // BUG: no else in original code
+ m_cursor = move;
+ m_pCurrentControl = m_controls[m_cursor];
+ m_pCurrentControl->GoLast();
+ }
+}
diff --git a/src/core/FrontEndControls.h b/src/core/FrontEndControls.h
new file mode 100644
index 00000000..5b6f95bb
--- /dev/null
+++ b/src/core/FrontEndControls.h
@@ -0,0 +1,712 @@
+#pragma once
+
+enum {
+ NUM_MULTICHOICE_OPTIONS = 16,
+ // 50 actual lines and 15 for spacing
+ NUM_LINELISTER_LINES = 50,
+ NUM_LINELISTER_LINES_TOTAL = NUM_LINELISTER_LINES + 15,
+ NUM_PAGE_WIDGETS = 10,
+};
+
+
+class CPlaceableText
+{
+public:
+ CVector2D m_position;
+ CRGBA m_color;
+ wchar *m_text;
+
+ CPlaceableText(void)
+ : m_position(0.0f, 0.0f), m_color(255, 255, 255, 255) {}
+ void SetPosition(float x, float y) { m_position.x = x; m_position.y = y; }
+ void SetColor(const CRGBA &color) { m_color = color; }
+ CRGBA GetColor(void) { return m_color; }
+ void SetAlpha(uint8 alpha) { m_color.alpha = alpha; }
+};
+
+// No trace of this in the game but it makes the other classes simpler
+class CPlaceableTextTwoLines
+{
+public:
+ CPlaceableText m_line1;
+ CPlaceableText m_line2;
+
+ void SetColor(const CRGBA &color) { m_line1.SetColor(color); m_line2.SetColor(color); }
+ void SetAlpha(uint8 alpha) { m_line1.SetAlpha(alpha); m_line2.SetAlpha(alpha); }
+};
+
+// No trace of this in the game but it makes the other classes simpler
+class CShadowInfo
+{
+public:
+ bool m_bRightJustify;
+ bool m_bDropShadow;
+ CRGBA m_shadowColor;
+ CVector2D m_shadowOffset;
+
+ CShadowInfo(void)
+ : m_bRightJustify(false), m_bDropShadow(false),
+ m_shadowColor(255, 255, 255, 255),
+ m_shadowOffset(-1.0f, -1.0f) {}
+ CRGBA GetShadowColor(void) { return m_shadowColor; }
+ void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset){
+ m_bDropShadow = bDropShadows;
+ m_shadowColor = shadowColor;
+ m_shadowOffset = shadowOffset;
+ }
+};
+
+// No trace of this in the game but it makes the other classes simpler
+class CSelectable
+{
+public:
+ bool m_bSelected;
+ CRGBA m_selectedColor;
+
+ CSelectable(void) : m_bSelected(false) {}
+ CRGBA GetSelectedColor(void) { return m_selectedColor; }
+};
+
+class CPlaceableShText : public CPlaceableText, public CShadowInfo
+{
+public:
+ using CPlaceableText::SetPosition;
+ void SetPosition(float x, float y, bool bRightJustify) { SetPosition(x, y); m_bRightJustify = bRightJustify; }
+ void SetAlpha(uint8 alpha) { m_shadowColor.alpha = alpha; CPlaceableText::SetAlpha(alpha); }
+
+ void Draw(float x, float y);
+ void Draw(const CRGBA &color, float x, float y);
+ // unused arguments it seems
+ void DrawShWrap(float x, float y, float wrapX, float wrapY) { Draw(x, y); }
+};
+
+class CPlaceableShTextTwoLines : public CPlaceableTextTwoLines, public CShadowInfo
+{
+public:
+ void SetAlpha(uint8 alpha) { m_shadowColor.alpha = alpha; CPlaceableTextTwoLines::SetAlpha(alpha); }
+
+ void Draw(float x, float y);
+ void Draw(const CRGBA &color, float x, float y);
+};
+
+class CPlaceableShOption : public CPlaceableShText, public CSelectable
+{
+public:
+ void SetColors(const CRGBA &normal, const CRGBA &selection) { CPlaceableShText::SetColor(normal); m_selectedColor = selection; }
+ void SetAlpha(uint8 alpha) { m_selectedColor.alpha = alpha; CPlaceableShText::SetAlpha(alpha); }
+
+ using CPlaceableShText::Draw;
+ void Draw(const CRGBA &highlightColor, float x, float y, bool bHighlight);
+};
+
+class CPlaceableShOptionTwoLines : public CPlaceableShTextTwoLines, public CSelectable
+{
+public:
+ void SetColors(const CRGBA &normal, const CRGBA &selection) { CPlaceableShTextTwoLines::SetColor(normal); m_selectedColor = selection; }
+ void SetAlpha(uint8 alpha) { m_selectedColor.alpha = alpha; CPlaceableShTextTwoLines::SetAlpha(alpha); }
+
+ using CPlaceableShTextTwoLines::Draw;
+ void Draw(const CRGBA &highlightColor, float x, float y, bool bHighlight);
+};
+
+class CPlaceableSprite
+{
+public:
+ CSprite2d *m_pSprite;
+ CVector2D m_position;
+ CVector2D m_size;
+ CRGBA m_color;
+
+ CPlaceableSprite(void)
+ : m_pSprite(nil), m_position(0.0f, 0.0f),
+ m_size(0.0f, 0.0f), m_color(255, 255, 255, 255) {}
+
+ void SetPosition(float x, float y) { m_position.x = x; m_position.y = y; }
+ void SetAlpha(uint8 alpha) { m_color.alpha = alpha; }
+
+ void Draw(float x, float y);
+ void Draw(const CRGBA &color, float x, float y);
+};
+
+class CPlaceableShSprite
+{
+public:
+ CPlaceableSprite m_sprite;
+ CPlaceableSprite m_shadow;
+ bool m_bDropShadow;
+
+ CPlaceableShSprite(void) : m_bDropShadow(false) {}
+
+ void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset){
+ m_bDropShadow = bDropShadows;
+ m_shadow.m_color = shadowColor;
+ m_shadow.m_position = shadowOffset;
+ }
+ void SetAlpha(uint8 alpha) { m_sprite.SetAlpha(alpha); m_shadow.SetAlpha(alpha); }
+
+ void Draw(float x, float y);
+};
+
+
+class CMenuBase
+{
+public:
+ CVector2D m_position;
+ bool m_bTwoState;
+
+ CMenuBase(void)
+ : m_position(0.0f, 0.0f), m_bTwoState(false) {}
+ void SetPosition(float x, float y) { m_position.x = x; m_position.y = y; }
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y) = 0;
+ virtual void DrawNormal(float x, float y) = 0;
+ virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y) = 0;
+ virtual void SetAlpha(uint8 alpha) = 0;
+ virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset) = 0;
+ virtual bool GoNext(void) = 0;
+ virtual bool GoPrev(void) = 0;
+ virtual bool GoDown(void) = 0;
+ virtual bool GoUp(void) = 0;
+ virtual bool GoDownStill(void) = 0;
+ virtual bool GoUpStill(void) = 0;
+ virtual bool GoLeft(void) = 0;
+ virtual bool GoRight(void) = 0;
+ virtual bool GoLeftStill(void) = 0;
+ virtual bool GoRightStill(void) = 0;
+ virtual bool GoFirst(void) = 0;
+ virtual bool GoLast(void) = 0;
+ virtual void SelectCurrentOptionUnderCursor(void) = 0;
+ virtual void SelectDefaultCancelAction(void) = 0;
+ virtual void ActivateMenu(bool first) = 0;
+ virtual void DeactivateMenu(void) = 0;
+ virtual int GetMenuSelection(void) = 0;
+ virtual void SetMenuSelection(int selection) = 0;
+};
+
+class CMenuDummy : public CMenuBase
+{
+public:
+ bool m_bActive;
+
+ virtual void Draw(const CRGBA &, const CRGBA &, float x, float y) {}
+ virtual void DrawNormal(float x, float y) {}
+ virtual void DrawHighlighted(const CRGBA &, float x, float y) {}
+ virtual void SetAlpha(uint8 alpha) {}
+ virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset) {}
+ virtual bool GoNext(void) { DeactivateMenu(); return false; }
+ virtual bool GoPrev(void) { DeactivateMenu(); return false; }
+ virtual bool GoDown(void) { return GoNext(); }
+ virtual bool GoUp(void) { return GoPrev(); }
+ virtual bool GoDownStill(void) { return false; }
+ virtual bool GoUpStill(void) { return false; }
+ virtual bool GoLeft(void) { return true; }
+ virtual bool GoRight(void) { return true; }
+ virtual bool GoLeftStill(void) { return true; }
+ virtual bool GoRightStill(void) { return true; }
+ virtual bool GoFirst(void) { ActivateMenu(true); return true; }
+ virtual bool GoLast(void) { ActivateMenu(true); return true; }
+ virtual void SelectCurrentOptionUnderCursor(void) {}
+ virtual void SelectDefaultCancelAction(void) {}
+ virtual void ActivateMenu(bool first) { m_bActive = true; }
+ virtual void DeactivateMenu(void) { m_bActive = false; }
+ virtual int GetMenuSelection(void) { return -1; }
+ virtual void SetMenuSelection(int) {}
+};
+
+class CMenuPictureAndText : public CMenuBase
+{
+public:
+ int m_numSprites;
+ CPlaceableShSprite m_sprites[5];
+ int m_numTexts;
+ CPlaceableShText m_texts[20];
+
+ CVector2D m_oldTextScale;
+ CVector2D m_textScale;
+ bool m_bSetTextScale;
+
+ float m_wrapX;
+ float m_oldWrapx;
+ bool m_bWrap;
+ // missing some?
+
+
+ CMenuPictureAndText(void)
+ : m_numSprites(0), m_numTexts(0),
+ m_bSetTextScale(false), m_bWrap(false) {}
+
+ void SetNewOldShadowWrapX(bool bWrapX, float newWrapX, float oldWrapX);
+ void SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale);
+ void SetTextsColor(const CRGBA &color);
+ void AddText(wchar *text, float positionX, float positionY, const CRGBA &color, bool bRightJustify);
+ void AddPicture(CSprite2d *sprite, CSprite2d *shadow, float positionX, float positionY, float width, float height, const CRGBA &color);
+ void AddPicture(CSprite2d *sprite, float positionX, float positionY, float width, float height, const CRGBA &color);
+
+ virtual void Draw(const CRGBA &, const CRGBA &, float x, float y);
+ virtual void DrawNormal(float x, float y) { Draw(CRGBA(0,0,0,0), CRGBA(0,0,0,0), x, y); }
+ virtual void DrawHighlighted(const CRGBA &, float x, float y) { Draw(CRGBA(0,0,0,0), CRGBA(0,0,0,0), x, y); }
+ virtual void SetAlpha(uint8 alpha);
+ virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
+ virtual bool GoNext(void) { return false; }
+ virtual bool GoPrev(void) { return false; }
+ virtual bool GoDown(void) { return GoNext(); }
+ virtual bool GoUp(void) { return GoPrev(); }
+ virtual bool GoDownStill(void) { return false; }
+ virtual bool GoUpStill(void) { return false; }
+ virtual bool GoLeft(void) { return true; }
+ virtual bool GoRight(void) { return true; }
+ virtual bool GoLeftStill(void) { return true; }
+ virtual bool GoRightStill(void) { return true; }
+ virtual bool GoFirst(void) { return false; }
+ virtual bool GoLast(void) { return false; }
+ virtual void SelectCurrentOptionUnderCursor(void) {}
+ virtual void SelectDefaultCancelAction(void) {}
+ virtual void ActivateMenu(bool first) {}
+ virtual void DeactivateMenu(void) {}
+ virtual int GetMenuSelection(void) { return -1; }
+ virtual void SetMenuSelection(int) {}
+};
+
+class CMenuMultiChoice : public CMenuBase
+{
+public:
+ int m_numOptions;
+ CPlaceableShText m_title;
+ CPlaceableShOption m_options[NUM_MULTICHOICE_OPTIONS];
+ int m_cursor;
+ CVector2D m_oldTextScale;
+ CVector2D m_textScale;
+ bool m_bSetTextScale;
+ bool m_bSetTitleTextScale;
+
+ CMenuMultiChoice(void)
+ : m_numOptions(0), m_cursor(-1),
+ m_bSetTextScale(false), m_bSetTitleTextScale(false) {}
+
+ void AddTitle(wchar *text, float positionX, float positionY, bool bRightJustify);
+ CPlaceableShOption *AddOption(wchar *text, float positionX, float positionY, bool bSelected, bool bRightJustify);
+ void SetColors(const CRGBA &title, const CRGBA &normal, const CRGBA &selected);
+ void SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale);
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
+ virtual void DrawNormal(float x, float y);
+ virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
+ virtual void SetAlpha(uint8 alpha);
+ virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
+ virtual bool GoNext(void);
+ virtual bool GoPrev(void);
+ virtual bool GoDown(void) { return GoNext(); }
+ virtual bool GoUp(void) { return GoPrev(); }
+ virtual bool GoDownStill(void) { return false; }
+ virtual bool GoUpStill(void) { return false; }
+ virtual bool GoLeft(void) { return GoPrev(); }
+ virtual bool GoRight(void) { return GoNext(); }
+ virtual bool GoLeftStill(void) { return true; }
+ virtual bool GoRightStill(void) { return true; }
+ virtual bool GoFirst(void) { m_cursor = 0; return true; }
+ virtual bool GoLast(void) { m_cursor = m_numOptions-1; return true; }
+ virtual void SelectCurrentOptionUnderCursor(void);
+ virtual void SelectDefaultCancelAction(void) {}
+ virtual void ActivateMenu(bool first) { m_cursor = first ? 0 : m_numOptions-1; }
+ virtual void DeactivateMenu(void) { m_cursor = -1; }
+ virtual int GetMenuSelection(void);
+ virtual void SetMenuSelection(int selection);
+};
+
+class CMenuMultiChoiceTriggered : public CMenuMultiChoice
+{
+public:
+ typedef void (*Trigger)(CMenuMultiChoiceTriggered *);
+
+ Trigger m_triggers[NUM_MULTICHOICE_OPTIONS];
+ Trigger m_defaultCancel;
+
+ CMenuMultiChoiceTriggered(void) { Initialise(); }
+
+ void Initialise(void);
+ CPlaceableShOption *AddOption(wchar *text, float positionX, float positionY, Trigger trigger, bool bSelected, bool bRightJustify);
+
+ virtual void SelectCurrentOptionUnderCursor(void);
+ virtual void SelectDefaultCancelAction(void);
+};
+
+class CMenuMultiChoiceTriggeredAlways : public CMenuMultiChoiceTriggered
+{
+public:
+ Trigger m_alwaysNormalTrigger;
+ Trigger m_alwaysHighlightTrigger;
+ Trigger m_alwaysTrigger;
+
+ CMenuMultiChoiceTriggeredAlways(void)
+ : m_alwaysNormalTrigger(nil), m_alwaysHighlightTrigger(nil), m_alwaysTrigger(nil) {}
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
+ virtual void DrawNormal(float x, float y);
+ virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
+};
+
+class CMenuMultiChoicePictured : public CMenuMultiChoice
+{
+public:
+ CPlaceableSprite m_sprites[NUM_MULTICHOICE_OPTIONS];
+ bool m_bHasSprite[NUM_MULTICHOICE_OPTIONS];
+
+ CMenuMultiChoicePictured(void) { Initialise(); }
+ void Initialise(void);
+ using CMenuMultiChoice::AddOption;
+ CPlaceableShOption *AddOption(CSprite2d *sprite, float positionX, float positionY, const CVector2D &size, bool bSelected);
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
+ virtual void DrawNormal(float x, float y);
+ virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
+ virtual void SetAlpha(uint8 alpha);
+ // unnecessary - same as base class
+// virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
+};
+
+class CMenuMultiChoicePicturedTriggered : public CMenuMultiChoicePictured
+{
+public:
+ typedef void (*Trigger)(CMenuMultiChoicePicturedTriggered *);
+
+ Trigger m_triggers[NUM_MULTICHOICE_OPTIONS];
+ Trigger m_defaultCancel;
+
+ CMenuMultiChoicePicturedTriggered(void) { Initialise(); }
+
+ void Initialise(void);
+ using CMenuMultiChoicePictured::AddOption;
+ CPlaceableShOption *AddOption(CSprite2d *sprite, float positionX, float positionY, const CVector2D &size, Trigger trigger, bool bSelected);
+
+ virtual void SelectCurrentOptionUnderCursor(void);
+ virtual void SelectDefaultCancelAction(void);
+};
+
+struct FEC_MOVETAB
+{
+ int8 right;
+ int8 left;
+ int8 down;
+ int8 up;
+};
+
+class CMenuMultiChoicePicturedTriggeredAnyMove : public CMenuMultiChoicePicturedTriggered
+{
+public:
+ FEC_MOVETAB m_moveTab[NUM_MULTICHOICE_OPTIONS];
+
+ CMenuMultiChoicePicturedTriggeredAnyMove(void) { Initialise(); }
+
+ void Initialise(void);
+ using CMenuMultiChoicePicturedTriggered::AddOption;
+ CPlaceableShOption *AddOption(CSprite2d *sprite, FEC_MOVETAB *moveTab, float positionX, float positionY, const CVector2D &size, Trigger trigger, bool bSelected);
+
+ virtual bool GoDown(void);
+ virtual bool GoUp(void);
+ virtual bool GoLeft(void);
+ virtual bool GoRight(void);
+};
+
+// copy of CMenuMultiChoice pretty much except for m_options type
+class CMenuMultiChoiceTwoLines : public CMenuBase
+{
+public:
+ int m_numOptions;
+ CPlaceableShText m_title;
+ CPlaceableShOptionTwoLines m_options[NUM_MULTICHOICE_OPTIONS];
+ int m_cursor;
+ CVector2D m_oldTextScale;
+ CVector2D m_textScale;
+ bool m_bSetTextScale;
+ bool m_bSetTitleTextScale;
+
+ CMenuMultiChoiceTwoLines(void)
+ : m_numOptions(0), m_cursor(-1),
+ m_bSetTextScale(false), m_bSetTitleTextScale(false) {}
+
+ void AddTitle(wchar *text, float positionX, float positionY, bool bRightJustify);
+ CPlaceableShOptionTwoLines *AddOption(wchar *text, float positionX, float positionY, bool bSelected, bool bRightJustify);
+ CPlaceableShOptionTwoLines *AddOption(wchar *text1, float positionX1, float positionY1, wchar *text2, float positionX2, float positionY2, bool bSelected, bool bRightJustify);
+ void SetColors(const CRGBA &title, const CRGBA &normal, const CRGBA &selected);
+ void SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale);
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
+ virtual void DrawNormal(float x, float y);
+ virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
+ virtual void SetAlpha(uint8 alpha);
+ virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
+ virtual bool GoNext(void);
+ virtual bool GoPrev(void);
+ virtual bool GoDown(void) { return GoNext(); }
+ virtual bool GoUp(void) { return GoPrev(); }
+ virtual bool GoDownStill(void) { return true; }
+ virtual bool GoUpStill(void) { return true; }
+ virtual bool GoLeft(void) { return GoPrev(); }
+ virtual bool GoRight(void) { return GoNext(); }
+ virtual bool GoLeftStill(void) { return true; }
+ virtual bool GoRightStill(void) { return true; }
+ virtual bool GoFirst(void) { m_cursor = 0; return true; }
+ virtual bool GoLast(void) { m_cursor = m_numOptions-1; return true; }
+ virtual void SelectCurrentOptionUnderCursor(void);
+ virtual void SelectDefaultCancelAction(void) {}
+ virtual void ActivateMenu(bool first) { m_cursor = first ? 0 : m_numOptions-1; }
+ virtual void DeactivateMenu(void) { m_cursor = -1; }
+ virtual int GetMenuSelection(void);
+ virtual void SetMenuSelection(int selection);
+};
+
+// copy of CMenuMultiChoiceTriggered except for m_options
+class CMenuMultiChoiceTwoLinesTriggered : public CMenuMultiChoiceTwoLines
+{
+public:
+ typedef void (*Trigger)(CMenuMultiChoiceTwoLinesTriggered *);
+
+ Trigger m_triggers[NUM_MULTICHOICE_OPTIONS];
+ Trigger m_defaultCancel;
+
+ CMenuMultiChoiceTwoLinesTriggered(void) { Initialise(); }
+
+ void Initialise(void);
+ CPlaceableShOptionTwoLines *AddOption(wchar *text, float positionX, float positionY, Trigger trigger, bool bSelected, bool bRightJustify);
+ CPlaceableShOptionTwoLines *AddOption(wchar *text1, float positionX1, float positionY1, wchar *text2, float positionX2, float positionY2, Trigger trigger, bool bSelected, bool bRightJustify);
+
+ virtual void SelectCurrentOptionUnderCursor(void);
+ virtual void SelectDefaultCancelAction(void);
+};
+
+
+class CMenuOnOff : public CMenuBase
+{
+public:
+ CPlaceableShOption m_title;
+ CPlaceableShText m_options[2];
+ bool m_bActive;
+ bool m_bSetTextScale;
+ bool m_bSetTitleTextScale;
+ CVector2D m_textScale;
+ CVector2D m_oldTextScale;
+ int m_type; // 0: on/off 1: yes/no
+
+ void SetColors(const CRGBA &title, const CRGBA &options);
+ void SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale);
+ void SetOptionPosition(float x, float y, bool bRightJustify);
+ void AddTitle(wchar *text, bool bSelected, float positionX, float positionY, bool bRightJustify);
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
+ virtual void DrawNormal(float x, float y);
+ virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
+ virtual void SetAlpha(uint8 alpha);
+ virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
+ virtual bool GoNext(void) { DeactivateMenu(); return false; }
+ virtual bool GoPrev(void) { DeactivateMenu(); return false; }
+ virtual bool GoDown(void) { return GoNext(); }
+ virtual bool GoUp(void) { return GoPrev(); }
+ virtual bool GoDownStill(void) { return false; }
+ virtual bool GoUpStill(void) { return false; }
+ virtual bool GoLeft(void) { SelectCurrentOptionUnderCursor(); return true; }
+ virtual bool GoRight(void) { SelectCurrentOptionUnderCursor(); return true; }
+ virtual bool GoLeftStill(void) { return true; }
+ virtual bool GoRightStill(void) { return true; }
+ virtual bool GoFirst(void) { ActivateMenu(true); return true; }
+ virtual bool GoLast(void) { ActivateMenu(true); return true; }
+ virtual void SelectCurrentOptionUnderCursor(void) { m_title.m_bSelected ^= 1; }
+ virtual void SelectDefaultCancelAction(void) {}
+ virtual void ActivateMenu(bool first) { m_bActive = true; }
+ virtual void DeactivateMenu(void) { m_bActive = false; }
+ virtual int GetMenuSelection(void) { return m_title.m_bSelected; }
+ virtual void SetMenuSelection(int selection) { m_title.m_bSelected = selection; }
+};
+
+class CMenuOnOffTriggered : public CMenuOnOff
+{
+public:
+ typedef void (*Trigger)(CMenuOnOffTriggered *);
+
+ Trigger m_trigger;
+
+ void SetOptionPosition(float x, float y, Trigger trigger, bool bRightJustify);
+
+ virtual void SelectCurrentOptionUnderCursor(void);
+};
+
+class CMenuSlider : public CMenuBase
+{
+public:
+ CPlaceableShText m_title;
+ CPlaceableShText m_box; // not really a text
+ CRGBA m_colors[2]; // left and right
+ CVector2D m_size[2]; // left and right
+ int m_value;
+ CPlaceableShText m_percentageText;
+ bool m_bDrawPercentage;
+// char field_8D;
+// char field_8E;
+// char field_8F;
+ uint8 m_someAlpha;
+// char field_91;
+// char field_92;
+// char field_93;
+ bool m_bActive;
+ int m_style;
+
+ static char Buf8[8];
+ static wchar Buf16[8];
+
+ CMenuSlider(void)
+ : m_value(0), m_bDrawPercentage(false), m_bActive(false), m_style(0) {}
+
+ void SetColors(const CRGBA &title, const CRGBA &percentage, const CRGBA &left, const CRGBA &right);
+ void DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &selCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor);
+ void DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor);
+ void AddTickBox(float positionX, float positionY, float width, float heigthLeft, float heightRight);
+ void AddTitle(wchar *text, float positionX, float positionY);
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
+ virtual void DrawNormal(float x, float y);
+ virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
+ virtual void SetAlpha(uint8 alpha);
+ virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
+ virtual bool GoNext(void) { DeactivateMenu(); return false; }
+ virtual bool GoPrev(void) { DeactivateMenu(); return false; }
+ virtual bool GoDown(void) { return GoNext(); }
+ virtual bool GoUp(void) { return GoPrev(); }
+ virtual bool GoDownStill(void) { return false; }
+ virtual bool GoUpStill(void) { return false; }
+ virtual bool GoLeft(void) { if(m_value < 0) m_value = 0; return true; }
+ virtual bool GoRight(void) { if(m_value > 1000) m_value = 1000; return true; }
+ virtual bool GoLeftStill(void) { m_value -= 8; if(m_value < 0) m_value = 0; return true; }
+ virtual bool GoRightStill(void) { m_value += 8; if(m_value > 1000) m_value = 1000; return true; }
+ virtual bool GoFirst(void) { ActivateMenu(true); return true; }
+ virtual bool GoLast(void) { ActivateMenu(true); return true; }
+ virtual void SelectCurrentOptionUnderCursor(void) {}
+ virtual void SelectDefaultCancelAction(void) {}
+ virtual void ActivateMenu(bool first) { m_bActive = true; }
+ virtual void DeactivateMenu(void) { m_bActive = false; }
+ virtual int GetMenuSelection(void) { return m_value/10; }
+ virtual void SetMenuSelection(int selection) { m_value = selection*10; }
+};
+
+class CMenuSliderTriggered : public CMenuSlider
+{
+public:
+ typedef void (*Trigger)(CMenuSliderTriggered *);
+
+ Trigger m_trigger;
+ Trigger m_alwaysTrigger;
+
+ CMenuSliderTriggered(void)
+ : m_trigger(nil), m_alwaysTrigger(nil) {}
+
+ void AddTickBox(float positionX, float positionY, float width, float heigthLeft, float heightRight, Trigger trigger, Trigger alwaysTrigger);
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
+ virtual bool GoLeft(void);
+ virtual bool GoRight(void);
+ virtual bool GoLeftStill(void);
+ virtual bool GoRightStill(void);
+};
+
+
+class CMenuLineLister : public CMenuBase
+{
+public:
+ float m_width;
+ float m_height;
+ int m_numLines;
+ CPlaceableShText m_linesLeft[NUM_LINELISTER_LINES_TOTAL];
+ CPlaceableShText m_linesRight[NUM_LINELISTER_LINES_TOTAL];
+ uint8 m_lineAlphas[NUM_LINELISTER_LINES_TOTAL];
+ int8 m_lineFade[NUM_LINELISTER_LINES_TOTAL];
+ float m_scrollPosition;
+ float m_scrollSpeed;
+ int field_10E8;
+ float m_lineSpacing;
+
+ CMenuLineLister(void);
+
+ void SetLinesColor(const CRGBA &color);
+ void ResetNumberOfTextLines(void);
+ bool AddTextLine(wchar *left, wchar *right);
+
+ CPlaceableShText *GetLeftLine(int i) { return &m_linesLeft[(i%NUM_LINELISTER_LINES) + 15]; };
+ CPlaceableShText *GetRightLine(int i) { return &m_linesRight[(i%NUM_LINELISTER_LINES) + 15]; };
+
+ virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
+ virtual void DrawNormal(float x, float y) { Draw(CRGBA(0,0,0,0), CRGBA(0,0,0,0), x, y); }
+ virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y) { Draw(CRGBA(0,0,0,0), CRGBA(0,0,0,0), x, y); }
+ virtual void SetAlpha(uint8 alpha);
+ virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
+ virtual bool GoNext(void) { return false; }
+ virtual bool GoPrev(void) { return false; }
+ virtual bool GoDown(void) { return GoNext(); }
+ virtual bool GoUp(void) { return GoPrev(); }
+ virtual bool GoDownStill(void) { m_scrollSpeed = 0.0f; return true; }
+ virtual bool GoUpStill(void) { m_scrollSpeed *= 6.0f; return true; }
+ virtual bool GoLeft(void) { return true; }
+ virtual bool GoRight(void) { return true; }
+ virtual bool GoLeftStill(void) { return true; }
+ virtual bool GoRightStill(void) { return true; }
+ virtual bool GoFirst(void) { return true; }
+ virtual bool GoLast(void) { return true; }
+ virtual void SelectCurrentOptionUnderCursor(void) {}
+ virtual void SelectDefaultCancelAction(void) {}
+ virtual void ActivateMenu(bool first) {}
+ virtual void DeactivateMenu(void) {}
+ virtual int GetMenuSelection(void) { return -1; }
+ virtual void SetMenuSelection(int selection) {}
+};
+
+class CMenuPage
+{
+public:
+ CMenuBase *m_controls[NUM_PAGE_WIDGETS];
+ int m_numControls;
+ CMenuBase *m_pCurrentControl;
+ int m_cursor;
+
+ CMenuPage(void) { Initialise(); }
+ void Initialise(void);
+ bool AddMenu(CMenuBase *widget);
+
+ bool IsActiveMenuTwoState(void);
+ void ActiveMenuTwoState_SelectNextPosition(void);
+ void Draw(const CRGBA &,const CRGBA &, float, float);
+ void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
+ void DrawNormal(float x, float y);
+ void ActivatePage(void);
+ void SetAlpha(uint8 alpha);
+ void SetShadows(bool, const CRGBA &, const CVector2D &);
+ void GoPrev(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoPrev()) m_pCurrentControl->GoLast(); } }
+ void GoNext(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoNext()) m_pCurrentControl->GoFirst(); } }
+ void GoLeft(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoLeft()) m_pCurrentControl->GoLast(); } }
+ void GoRight(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoRight()) m_pCurrentControl->GoFirst(); } }
+ void GoUp(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoUp()) m_pCurrentControl->GoLast(); } }
+ void GoDown(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoDown()) m_pCurrentControl->GoFirst(); } }
+ void GoLeftStill(void) { if(m_pCurrentControl) m_pCurrentControl->GoLeftStill(); }
+ void GoRightStill(void) { if(m_pCurrentControl) m_pCurrentControl->GoRightStill(); }
+ void GoUpStill(void) { if(m_pCurrentControl) m_pCurrentControl->GoUpStill(); }
+ void GoDownStill(void) { if(m_pCurrentControl) m_pCurrentControl->GoDownStill(); }
+ void SelectDefaultCancelAction(void) { if(m_pCurrentControl) m_pCurrentControl->SelectDefaultCancelAction(); }
+ void SelectCurrentOptionUnderCursor(void) { if(m_pCurrentControl) m_pCurrentControl->SelectCurrentOptionUnderCursor(); }
+
+ virtual void GoUpMenuOnPage(void);
+ virtual void GoDownMenuOnPage(void);
+ virtual void GoLeftMenuOnPage(void);
+ virtual void GoRightMenuOnPage(void);
+};
+
+class CMenuPageAnyMove : public CMenuPage
+{
+public:
+ FEC_MOVETAB m_moveTab[NUM_PAGE_WIDGETS];
+
+ CMenuPageAnyMove(void) { Initialise(); }
+ void Initialise(void);
+ using CMenuPage::AddMenu;
+ bool AddMenu(CMenuBase *widget, FEC_MOVETAB *moveTab);
+
+ virtual void GoUpMenuOnPage(void);
+ virtual void GoDownMenuOnPage(void);
+ virtual void GoLeftMenuOnPage(void);
+ virtual void GoRightMenuOnPage(void);
+}; \ No newline at end of file
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 74729fec..75effc8a 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -8,6 +8,7 @@
#include "Pad.h"
#include "Text.h"
#include "main.h"
+#include "RwHelper.h"
#include "Timer.h"
#include "Game.h"
#include "DMAudio.h"
@@ -27,11 +28,48 @@
#include "World.h"
#include "Renderer.h"
#include "CdStream.h"
+#include "Radar.h"
+#include "Stats.h"
+#include "Messages.h"
+#include "FileLoader.h"
-#define DONT_USE_SUSPICIOUS_FUNCS 1
#define TIDY_UP_PBP // ProcessButtonPresses
#define MAX_VISIBLE_LIST_ROW 30
-#define LIST_HEIGHT 263.0f
+#define SCROLLBAR_MAX_HEIGHT 263.0f // not in end result
+
+#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
+#define MILES_IN_METER 0.000621371192f
+#define FEET_IN_METER 3.28084f
+#else
+#define MILES_IN_METER 0.00059880241f
+#define FEET_IN_METER 3.33f
+#endif
+
+#ifdef SCROLLABLE_STATS_PAGE
+#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS)
+#else
+#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS)
+#endif
+
+#ifdef TRIANGLE_BACK_BUTTON
+#define GetBackJustUp GetTriangleJustUp
+#define GetBackJustDown GetTriangleJustDown
+#elif defined(CIRCLE_BACK_BUTTON)
+#define GetBackJustUp GetCircleJustUp
+#define GetBackJustDown GetCircleJustDown
+#else
+#define GetBackJustUp GetSquareJustUp
+#define GetBackJustDown GetSquareJustDown
+#endif
+
+#ifdef MENU_MAP
+bool CMenuManager::bMenuMapActive = false;
+bool CMenuManager::bMapMouseShownOnce = false;
+bool CMenuManager::bMapLoaded = false;
+float CMenuManager::fMapSize;
+float CMenuManager::fMapCenterY;
+float CMenuManager::fMapCenterX;
+#endif
#ifdef PS2_LIKE_MENU
BottomBarOption bbNames[8];
@@ -44,56 +82,66 @@ int curBottomBarOption = -1;
int hoveredBottomBarOption = -1;
#endif
-WRAPPER void CMenuManager::PrintController(void) { EAXJMP(0x483990); }
-
-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; // 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;
-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; // 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;
-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; // 102
-int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48; // 102
-
-char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74; //[256] "$$\"\""
+int32 CMenuManager::OS_Language = LANG_ENGLISH; // *(int32*)0x5F2F78;
+int8 CMenuManager::m_PrefsUseVibration; // = *(int8*)0x95CD92;
+int8 CMenuManager::m_DisplayControllerOnFoot; // = *(int8*)0x95CD8D;
+int8 CMenuManager::m_PrefsVsync = 1; // *(int8*)0x5F2E58;
+int8 CMenuManager::m_PrefsVsyncDisp = 1; // *(int8*)0x5F2E5C;
+int8 CMenuManager::m_PrefsFrameLimiter = 1; // *(int8*)0x5F2E60;
+int8 CMenuManager::m_PrefsShowSubtitles = 1; // *(int8*)0x5F2E54;
+int8 CMenuManager::m_PrefsSpeakers; // = *(int8*)0x95CD7E;
+int32 CMenuManager::m_ControlMethod; // = *(int32*)0x8F5F7C;
+int8 CMenuManager::m_PrefsDMA = 1; // *(int8*)0x5F2F74;
+int32 CMenuManager::m_PrefsLanguage; // = *(int32*)0x941238;
+uint8 CMenuManager::m_PrefsStereoMono; // *(bool*)0x95CDB5; // unused except restore settings
+
+bool CMenuManager::m_PrefsAllowNastyGame = true; // *(bool*)0x5F2E64;
+bool CMenuManager::m_bStartUpFrontEndRequested; // = *(bool*)0x95CCF4;
+bool CMenuManager::m_bShutDownFrontEndRequested; // = *(bool*)0x95CD6A;
+
+int8 CMenuManager::m_PrefsUseWideScreen; // = *(int8*)0x95CD23;
+int8 CMenuManager::m_PrefsRadioStation; // = *(int8*)0x95CDA4;
+int32 CMenuManager::m_PrefsBrightness = 256; // = *(int32*)0x5F2E50;
+float CMenuManager::m_PrefsLOD; // = *(float*)0x8F42C4;
+int8 CMenuManager::m_bFrontEnd_ReloadObrTxtGxt; // = *(int8*)0x628CFC;
+int32 CMenuManager::m_PrefsMusicVolume = 102; // = *(int32*)0x5F2E4C;
+int32 CMenuManager::m_PrefsSfxVolume = 102; // = *(int32*)0x5F2E48;
+
+char CMenuManager::m_PrefsSkinFile[256] = "$$\"\""; // = (char*)0x5F2E74;
+
+int32 CMenuManager::m_KeyPressedCode = -1; // = *(int32*)0x5F2E70;
+
+// Originally that was PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway)
+#ifdef PS2_LIKE_MENU
+const CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255);
+#else
+const CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color
+#endif
-int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70; // -1
+const float menuXYpadding = MENUACTION_POS_Y; // *(float*)0x5F355C; // not original name
+float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE; //*(float*)0x5F2E40;
+float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE; //*(float*)0x5F2E44;
-float &CMenuManager::menuXYpadding = *(float*)0x5F355C; // don't know the original name. MENUACTION_X_MARGIN, never changes
-float &CMenuManager::actionTextScaleX = *(float*)0x5F2E40;
-float &CMenuManager::actionTextScaleY = *(float*)0x5F2E44;
+bool holdingScrollBar; // *(bool*)0x628D59; // not original name
+int32 CMenuManager::m_SelectedMap; // *(int32*)0x8E2880;
+int32 CMenuManager::m_SelectedGameType; // *(int32*)0x942F88;
-int32 &CMenuManager::sthWithButtons = *(int32*)0x8E2880;
-int32 &CMenuManager::sthWithButtons2 = *(int32*)0x942F88;
+// Used in a hidden menu
+uint8 CMenuManager::m_PrefsPlayerRed = 255;
+uint8 CMenuManager::m_PrefsPlayerGreen = 128;
+uint8 CMenuManager::m_PrefsPlayerBlue; // why??
-CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
+CMenuManager FrontEndMenuManager; // = *(CMenuManager*)0x8F59D8;
// Move this somewhere else.
-float &CRenderer::ms_lodDistScale = *(float*)0x5F726C; // 1.2
-
-// Stuff not in CMenuManager:
-uint32 &TimeToStopPadShaking = *(uint32*)0x628CF8;
-char *&pEditString = *(char**)0x628D00;
-int32 *&pControlEdit = *(int32**)0x628D08;
-bool &DisplayComboButtonErrMsg = *(bool*)0x628D14;
-int32 &MouseButtonJustClicked = *(int32*)0x628D0C;
-int32 &JoyButtonJustClicked = *(int32*)0x628D10;
-bool &holdingScrollBar = *(bool*)0x628D59;
+float CRenderer::ms_lodDistScale = 1.2f; // *(float*)0x5F726C;
+
+uint32 TimeToStopPadShaking; // = *(uint32*)0x628CF8;
+char *pEditString; // = *(char**)0x628D00;
+int32 *pControlEdit; // = *(int32**)0x628D08;
+bool DisplayComboButtonErrMsg; // = *(bool*)0x628D14;
+int32 MouseButtonJustClicked; // = *(int32*)0x628D0C;
+int32 JoyButtonJustClicked; // = *(int32*)0x628D10;
//int32 *pControlTemp = 0;
#ifndef MASTER
@@ -131,7 +179,22 @@ const char* FrontendFilenames[][2] = {
{"fe_radio7", "" }, // MSX_FM
{"fe_radio8", "" }, // FLASHBACK
{"fe_radio9", "" }, // CHATTERBOX
-};
+};
+
+#ifdef MENU_MAP
+const char* MapFilenames[][2] = {
+ {"mapMid01", "mapMid01A"},
+ {"mapMid02", "mapMid02A"},
+ {"mapMid03", "mapMid03A"},
+ {"mapBot01", "mapBot01A"},
+ {"mapBot02", "mapBot02A"},
+ {"mapBot03", "mapBot03A"},
+ {"mapTop01", "mapTop01A"},
+ {"mapTop02", "mapTop02A"},
+ {"mapTop03", "mapTop03A"},
+};
+CSprite2d CMenuManager::m_aMapSprites[NUM_MAP_SPRITES];
+#endif
// 0x5F3344
const char* MenuFilenames[][2] = {
@@ -160,7 +223,7 @@ const char* MenuFilenames[][2] = {
#ifdef ASPECT_RATIO_SCALE
// All of the defines below replace the StretchX function. Otherwise use SCREEN_SCALE_X.
#define MENU_X_LEFT_ALIGNED(x) ScaleAndCenterX(x)
-#define MENU_X_RIGHT_ALIGNED(x) ScaleAndCenterX(DEFAULT_SCREEN_WIDTH - x)
+#define MENU_X_RIGHT_ALIGNED(x) ScaleAndCenterX(DEFAULT_SCREEN_WIDTH - (x))
#define MENU_X(x) SCREEN_SCALE_X(x)
#define MENU_Y(y) SCREEN_SCALE_Y(y)
float
@@ -183,8 +246,6 @@ ScaleAndCenterX(float x)
#define MENU_Y(y) StretchY(y)
#endif
-#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS)
-
#ifdef PS2_LIKE_MENU
#define ChangeScreen(screen, option, updateDelay, withReverseAlpha) \
do { \
@@ -224,14 +285,14 @@ ScaleAndCenterX(float x)
#define ProcessSlider(value, increaseAction, decreaseAction, hoverStartX, hoverEndX) \
do { \
- lastBarX = DisplaySlider(SCREEN_STRETCH_FROM_RIGHT(MENUSLIDER_X + columnWidth), MENU_Y(bitAboveNextItemY), MENU_Y(freeSpaceInLine), MENU_Y(usableLineHeight), MENU_X(MENUSLIDER_UNK), value); \
+ lastActiveBarX = DisplaySlider(SCREEN_STRETCH_FROM_RIGHT(MENUSLIDER_X + columnWidth), MENU_Y(bitAboveNextItemY), MENU_Y(smallestSliderBar), MENU_Y(usableLineHeight), MENU_X(MENUSLIDER_UNK), value); \
if (i != m_nCurrOption || !itemsAreSelectable) \
break; \
\
- if (CheckHover(hoverStartX, lastBarX - MENU_X(10.0f), MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \
+ if (CheckHover(hoverStartX, lastActiveBarX - MENU_X(10.0f), MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \
m_nHoverOption = decreaseAction; \
\
- if (!CheckHover(MENU_X(10.0f) + lastBarX, hoverEndX, MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \
+ if (!CheckHover(MENU_X(10.0f) + lastActiveBarX, hoverEndX, MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \
break; \
\
m_nHoverOption = increaseAction; \
@@ -248,7 +309,7 @@ CMenuManager::ScrollUpListByOne()
if (m_nFirstVisibleRowOnList > 0) {
m_nSelectedListRow--;
m_nFirstVisibleRowOnList--;
- m_nCurListItemY -= LIST_HEIGHT / m_nTotalListRow;
+ m_nScrollbarTopMargin -= SCROLLBAR_MAX_HEIGHT / m_nTotalListRow;
}
} else {
m_nSelectedListRow--;
@@ -262,7 +323,7 @@ CMenuManager::ScrollDownListByOne()
if (m_nFirstVisibleRowOnList < m_nTotalListRow - MAX_VISIBLE_LIST_ROW) {
m_nSelectedListRow++;
m_nFirstVisibleRowOnList++;
- m_nCurListItemY += LIST_HEIGHT / m_nTotalListRow;
+ m_nScrollbarTopMargin += SCROLLBAR_MAX_HEIGHT / m_nTotalListRow;
}
} else {
if (m_nSelectedListRow < m_nTotalListRow - 1) {
@@ -285,7 +346,7 @@ CMenuManager::PageUpList(bool playSoundOnSuccess)
m_nFirstVisibleRowOnList = 0;
m_nSelectedListRow = 0;
}
- m_nCurListItemY = (LIST_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
+ m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
}
}
@@ -303,7 +364,7 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW;
m_nSelectedListRow = m_nTotalListRow - 1;
}
- m_nCurListItemY = (LIST_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
+ m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
}
}
@@ -335,18 +396,18 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
// ------ Functions not in the game/inlined ends
void
-CMenuManager::BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2)
+CMenuManager::BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2)
{
if (!text)
return;
if (stat2) {
- if (aFloat)
+ if (itsFloat)
sprintf(gString2, " %.2f %s %.2f", *(float*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(float*)stat2);
else
sprintf(gString2, " %d %s %d", *(int*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(int*)stat2);
} else if (stat) {
- if (aFloat)
+ if (itsFloat)
sprintf(gString2, " %.2f", *(float*)stat);
else
sprintf(gString2, " %d", *(int*)stat);
@@ -357,14 +418,12 @@ CMenuManager::BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2)
AsciiToUnicode(gString2, gUString2);
}
-#if 0
-WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); }
-#else
-void CMenuManager::CentreMousePointer()
+void
+CMenuManager::CentreMousePointer()
{
tagPOINT Point;
- if (SCREEN_WIDTH * 0.5f == 0.0f && 0.0f == SCREEN_HEIGHT * 0.5f) {
+ if (SCREEN_WIDTH * 0.5f != 0.0f && 0.0f != SCREEN_HEIGHT * 0.5f) {
Point.x = SCREEN_WIDTH / 2;
Point.y = SCREEN_HEIGHT / 2;
ClientToScreen(PSGLOBAL(window), &Point);
@@ -374,28 +433,85 @@ void CMenuManager::CentreMousePointer()
PSGLOBAL(lastMousePos.y) = SCREEN_HEIGHT / 2;
}
}
-#endif
-#if 1
-WRAPPER int CMenuManager::CheckCodesForControls(int32) { EAXJMP(0x48A950); }
-#else
-void CMenuManager::CheckCodesForControls(int, int)
+void
+CMenuManager::CheckCodesForControls(int typeOfControl)
{
- DisplayComboButtonErrMsg = 0;
+ DisplayComboButtonErrMsg = false;
+ bool invalidKey = false;
+ bool escPressed = false;
+ eControllerType typeToSave;
+ // GetStartOptionsCntrlConfigScreens();
+ e_ControllerAction action = (e_ControllerAction) m_CurrCntrlAction;
+
+ if (typeOfControl == KEYBOARD) {
+ if (*pControlEdit == rsESC) {
+ escPressed = true;
+ } else if (*pControlEdit > rsF3 && *pControlEdit != rsF9 && *pControlEdit != rsLWIN &&
+ *pControlEdit != rsRWIN && *pControlEdit != rsRALT) {
+ typeToSave = KEYBOARD;
+ if (ControlsManager.GetControllerKeyAssociatedWithAction(action, KEYBOARD) != rsNULL &&
+ *pControlEdit != ControlsManager.GetControllerKeyAssociatedWithAction(action, KEYBOARD)) {
+ typeToSave = OPTIONAL_EXTRA;
+ }
+ } else {
+ invalidKey = true;
+ }
+ } else if (typeOfControl == MOUSE) {
+ typeToSave = MOUSE;
+ } else if (typeOfControl == JOYSTICK) {
+ typeToSave = JOYSTICK;
+ if (ControlsManager.GetIsActionAButtonCombo(action))
+ DisplayComboButtonErrMsg = true;
+ }
+
+ ControlsManager.ClearSettingsAssociatedWithAction(action, typeToSave);
+ if (!DisplayComboButtonErrMsg && !escPressed && !invalidKey) {
+ if (typeOfControl == KEYBOARD) {
+ ControlsManager.DeleteMatchingActionInitiators(action, *pControlEdit, KEYBOARD);
+ ControlsManager.DeleteMatchingActionInitiators(action, *pControlEdit, OPTIONAL_EXTRA);
+ } else {
+ if (typeOfControl == MOUSE) {
+ ControlsManager.DeleteMatchingActionInitiators(action, MouseButtonJustClicked, MOUSE);
+ } else if (typeOfControl == JOYSTICK) {
+ ControlsManager.DeleteMatchingActionInitiators(action, JoyButtonJustClicked, JOYSTICK);
+ }
+ }
+ if (typeOfControl == KEYBOARD) {
+ ControlsManager.SetControllerKeyAssociatedWithAction(action, *pControlEdit, typeToSave);
+
+ } else if (typeOfControl == MOUSE) {
+ ControlsManager.SetControllerKeyAssociatedWithAction(action, MouseButtonJustClicked, typeToSave);
+ } else {
+ if (typeOfControl == JOYSTICK) {
+ ControlsManager.SetControllerKeyAssociatedWithAction(action, JoyButtonJustClicked, typeToSave);
+ }
+ }
+ pControlEdit = nil;
+ m_bWaitingForNewKeyBind = false;
+ m_KeyPressedCode = -1;
+ m_bStartWaitingForKeyBind = false;
+ SaveSettings();
+ }
+
+ if (escPressed) {
+ pControlEdit = nil;
+ m_bWaitingForNewKeyBind = false;
+ m_KeyPressedCode = -1;
+ m_bStartWaitingForKeyBind = false;
+ SaveSettings();
+ }
}
-#endif
-#if 0
-WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); }
-#else
-bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
+bool
+CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
{
return m_nMousePosX > x1 && m_nMousePosX < x2 &&
m_nMousePosY > y1 && m_nMousePosY < y2;
}
-#endif
-void CMenuManager::CheckSliderMovement(int value)
+void
+CMenuManager::CheckSliderMovement(int value)
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_BRIGHTNESS:
@@ -431,110 +547,113 @@ void CMenuManager::CheckSliderMovement(int value)
SaveSettings();
}
-#if 1
-WRAPPER int CMenuManager::CostructStatLine(int) { EAXJMP(0x482800); }
-#else
-int CMenuManager::CostructStatLine(int)
+void
+CMenuManager::DisplayHelperText()
{
+ // there was a unused static bool
+ static uint32 LastFlash = 0;
+ int32 alpha;
-}
-#endif
-
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::DisplayHelperText() { EAXJMP(0x48B490); }
-#else
-void CMenuManager::DisplayHelperText()
-{
- static int32 AlphaText = 255;
- static int32 Time = 0;
+ if (m_nHelperTextMsgId != 0 && m_nHelperTextMsgId != 1) {
- if (m_nHelperTextMsgId && m_nHelperTextMsgId != 1) {
- if (CTimer::GetTimeInMillisecondsPauseMode() - Time > 10) {
- Time = CTimer::GetTimeInMillisecondsPauseMode();
+ // FIX: High fps bug
+#ifndef FIX_BUGS
+ if (CTimer::GetTimeInMillisecondsPauseMode() - LastFlash > 10) {
+ LastFlash = CTimer::GetTimeInMillisecondsPauseMode();
m_nHelperTextAlpha -= 2;
+ }
+#else
+ static float fadeAlpha = 0.0f; // To keep it precisely
+ if (m_nHelperTextAlpha >= 255 && fadeAlpha < 250) fadeAlpha = m_nHelperTextAlpha;
- if (AlphaText < 1)
- ResetHelperText();
+ // -2 per every 33 ms (1000.f/30.f - original frame limiter fps)
+ fadeAlpha -= (frameTime / 33.0f) * 2.0f;
+ m_nHelperTextAlpha = fadeAlpha;
+#endif
+ if (m_nHelperTextAlpha < 1)
+ ResetHelperText();
- AlphaText = m_nHelperTextAlpha > 255 ? 255 : m_nHelperTextAlpha;
- }
+ alpha = m_nHelperTextAlpha > 255 ? 255 : m_nHelperTextAlpha;
}
- wchar *HelperTextToPrint = nil;
+ CFont::SetCentreOn();
+ CFont::SetScale(SCREEN_SCALE_X(SMALLESTTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_HEADING);
+
// TODO: name this cases?
switch (m_nHelperTextMsgId) {
- case 0:
- HelperTextToPrint = TheText.Get("FET_MIG");
- break;
- case 1:
- HelperTextToPrint = TheText.Get("FET_APP");
- break;
- case 2:
- HelperTextToPrint = TheText.Get("FET_HRD");
- break;
- case 3:
- HelperTextToPrint = TheText.Get("FET_RSO");
- break;
- case 4:
- HelperTextToPrint = TheText.Get("FET_RSC");
- break;
- default:
- break;
+ case 0:
+ {
+ int action = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
+ if (action != MENUACTION_CHANGEMENU && action != MENUACTION_REDEFCTRL && action != MENUACTION_RESTOREDEF) {
+ CFont::SetColor(CRGBA(255, 255, 255, 255));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_MIG"));
+ }
+ break;
+ }
+ case 1:
+ CFont::SetColor(CRGBA(255, 255, 255, 255));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_APP"));
+ break;
+ case 2:
+ CFont::SetColor(CRGBA(255, 255, 255, alpha));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_HRD"));
+ break;
+ case 3:
+ CFont::SetColor(CRGBA(255, 255, 255, alpha));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_RSO"));
+ break;
+ case 4:
+ CFont::SetColor(CRGBA(255, 255, 255, alpha));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_RSC"));
+ break;
+ default:
+ break;
}
-
- CFont::SetAlignment(ALIGN_CENTER);
- CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f));
- CFont::SetFontStyle(FONT_HEADING);
- CFont::SetDropColor(CRGBA(0, 0, 0, AlphaText));
- CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
- CFont::SetColor(CRGBA(255, 255, 255, AlphaText));
-
- CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_FROM_BOTTOM(120.0f), HelperTextToPrint);
+ CFont::SetRightJustifyOff();
}
-#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER int CMenuManager::DisplaySlider(float, float, float, float, float, float) { EAXJMP(0x488420); }
-#else
-int CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightSize, float rectSize, float progress)
+int
+CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostRightBarSize, float rectSize, float progress)
{
CRGBA color;
- float sizeRange;
+ float maxBarHeight;
- float input = 0.0f;
+ int lastActiveBarX = 0;
+ float curBarX = 0.0f;
+ float spacing = SCREEN_SCALE_X(10.0f);
for (int i = 0; i < 16; i++) {
- input = i * rectSize/16.0f + x;
+ curBarX = i * rectSize/16.0f + x;
- if (i/16.0f + 1/32.0f < progress)
+ if (i / 16.0f + 1 / 32.0f < progress) {
color = CRGBA(255, 217, 106, FadeIn(255));
- else
+ lastActiveBarX = curBarX;
+ } else
color = CRGBA(185, 120, 0, FadeIn(255));
- sizeRange = max(leftSize, rightSize);
+ maxBarHeight = max(mostLeftBarSize, mostRightBarSize);
- float _x = i * rectSize/16.0f + x;
- float _y = y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f;
- float _w = SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x;
- float _h = y + sizeRange;
- float _s = SCREEN_SCALE_X(2.0f);
- CSprite2d::DrawRect(CRect(_x + _s, _y + _s, _w + _s, _h + _s), CRGBA(0, 0, 0, FadeIn(255))); // Shadow
- CSprite2d::DrawRect(CRect(i * rectSize/16.0f + x, y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f, SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x, y + sizeRange), color);
+ float curBarFreeSpace = ((16 - i) * mostLeftBarSize + i * mostRightBarSize) / 16.0f;
+ float left = curBarX;
+ float top = y + maxBarHeight - curBarFreeSpace;
+ float right = spacing + curBarX;
+ float bottom = y + maxBarHeight;
+ float shadowOffset = SCREEN_SCALE_X(2.0f);
+ CSprite2d::DrawRect(CRect(left + shadowOffset, top + shadowOffset, right + shadowOffset, bottom + shadowOffset), CRGBA(0, 0, 0, FadeIn(200))); // Shadow
+ CSprite2d::DrawRect(CRect(left, top, right, bottom), color);
}
- return input;
+ return lastActiveBarX;
}
-#endif
-#if 0
-WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x48AB40); }
-#else
-void CMenuManager::DoSettingsBeforeStartingAGame()
+void
+CMenuManager::DoSettingsBeforeStartingAGame()
{
CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service();
- m_bStartGameLoading = true;
+ m_bWantToRestart = true;
ShutdownJustMenu();
UnloadTextures();
@@ -542,20 +661,17 @@ void CMenuManager::DoSettingsBeforeStartingAGame()
DMAudio.SetMusicFadeVol(0);
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
}
-#endif
-#if 0
-WRAPPER void CMenuManager::Draw() { EAXJMP(0x47AE00); }
-#else
-void CMenuManager::Draw()
+void
+CMenuManager::Draw()
{
CFont::SetBackgroundOff();
CFont::SetPropOn();
CFont::SetCentreOff();
CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn();
- CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENUACTION_X_MARGIN));
- CFont::SetRightJustifyWrap(SCREEN_SCALE_X(38.0f));
+ CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
switch (m_nCurrScreen) {
case MENUPAGE_STATS:
@@ -564,6 +680,11 @@ void CMenuManager::Draw()
case MENUPAGE_BRIEFS:
PrintBriefs();
break;
+#ifdef MENU_MAP
+ case MENUPAGE_MAP:
+ PrintMap();
+ break;
+#endif
}
// Header height isn't accounted, we will add that later.
@@ -591,8 +712,8 @@ void CMenuManager::Draw()
}
CFont::SetFontStyle(FONTJAP(FONT_BANK));
- CFont::SetScale(MENU_X(0.9f * actionTextScaleX), MENU_Y(0.9f * actionTextScaleY));
- CFont::SetRightJustifyOff(); // AG used SetAlignment(ALIGN_LEFT);
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y));
+ CFont::SetRightJustifyOff();
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
// Label
@@ -623,10 +744,10 @@ void CMenuManager::Draw()
}
#ifdef FIX_BUGS
- // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in menu.
- CFont::PrintString(MENU_X_LEFT_ALIGNED(MENUACTION_X_MARGIN), MENU_Y(menuXYpadding), str);
+ // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in here.
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(menuXYpadding), str);
#else
- CFont::PrintString(MENUACTION_X_MARGIN, menuXYpadding, str);
+ CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str);
#endif
}
@@ -647,7 +768,7 @@ void CMenuManager::Draw()
headerHeight = 240;
lineHeight = 24;
CFont::SetFontStyle(FONTJAP(FONT_HEADING));
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
case MENUPAGE_SOUND_SETTINGS:
@@ -664,7 +785,7 @@ void CMenuManager::Draw()
headerHeight = 0;
lineHeight = 20;
CFont::SetFontStyle(FONTJAP(FONT_HEADING));
- CFont::SetScale(MENU_X(actionTextScaleX = 0.55f), MENU_Y(actionTextScaleY = 0.8f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = MEDIUMTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = MEDIUMTEXT_Y_SCALE));
CFont::SetRightJustifyOff();
break;
case MENUPAGE_CHOOSE_LOAD_SLOT:
@@ -674,7 +795,7 @@ void CMenuManager::Draw()
headerHeight = 38;
lineHeight = 20;
CFont::SetFontStyle(FONTJAP(FONT_BANK));
- CFont::SetScale(MENU_X(actionTextScaleX = 0.45f), MENU_Y(actionTextScaleY = 0.7f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE));
CFont::SetRightJustifyOff();
break;
case MENUPAGE_NEW_GAME_RELOAD:
@@ -686,7 +807,7 @@ void CMenuManager::Draw()
headerHeight = 60;
lineHeight = 24;
CFont::SetFontStyle(FONTJAP(FONT_HEADING));
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
case MENUPAGE_START_MENU:
@@ -694,7 +815,7 @@ void CMenuManager::Draw()
headerHeight = 140;
lineHeight = 24;
CFont::SetFontStyle(FONTJAP(FONT_HEADING));
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
case MENUPAGE_PAUSE_MENU:
@@ -702,7 +823,7 @@ void CMenuManager::Draw()
headerHeight = 117;
lineHeight = 24;
CFont::SetFontStyle(FONTJAP(FONT_HEADING));
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
#ifdef PS2_SAVE_DIALOG
@@ -711,7 +832,7 @@ void CMenuManager::Draw()
headerHeight = 60;
lineHeight = 24;
CFont::SetFontStyle(FONTJAP(FONT_BANK));
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
break;
#endif
default:
@@ -719,11 +840,15 @@ void CMenuManager::Draw()
headerHeight = 40;
lineHeight = 24;
CFont::SetFontStyle(FONTJAP(FONT_HEADING));
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
}
+#ifdef PS2_LIKE_MENU
+ CFont::SetFontStyle(FONT_BANK);
+#endif
+
switch (m_nCurrScreen) {
case MENUPAGE_CONTROLLER_PC_OLD1:
case MENUPAGE_CONTROLLER_PC_OLD2:
@@ -733,14 +858,14 @@ void CMenuManager::Draw()
if (m_bWaitingForNewKeyBind)
itemsAreSelectable = false;
- CMenuManager::DrawControllerScreenExtraText(nextYToUse - 8.0f, 350, lineHeight);
+ DrawControllerScreenExtraText(nextYToUse - 8.0f, MENU_X_LEFT_ALIGNED(350), lineHeight);
break;
default:
break;
}
float usableLineHeight = lineHeight * 0.9f; // also height of biggest bar in slider
- float freeSpaceInLine = lineHeight * 0.1f; // also height of smallest bar in slider(weird)
+ float smallestSliderBar = lineHeight * 0.1f;
bool foundTheHoveringItem = false;
wchar unicodeTemp[64];
@@ -768,7 +893,7 @@ void CMenuManager::Draw()
case MENUACTION_CHANGEMENU: {
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu) {
case MENUPAGE_MULTIPLAYER_MAP:
- switch (sthWithButtons) {
+ switch (m_SelectedMap) {
case 0:
rightText = TheText.Get("FEM_MA0");
break;
@@ -798,7 +923,7 @@ void CMenuManager::Draw()
}
break;
case MENUPAGE_MULTIPLAYER_MODE:
- switch (sthWithButtons2) {
+ switch (m_SelectedGameType) {
case 0:
rightText = TheText.Get("FEN_TY0");
break;
@@ -833,7 +958,7 @@ void CMenuManager::Draw()
break;
}
case MENUACTION_CTRLVIBRATION:
- if (CMenuManager::m_PrefsUseVibration)
+ if (m_PrefsUseVibration)
rightText = TheText.Get("FEM_ON");
else
rightText = TheText.Get("FEM_OFF");
@@ -999,23 +1124,23 @@ void CMenuManager::Draw()
#endif
m_nMousePosY < MENU_Y((nextYToCheck + 2) + usableLineHeight)) {
- static int lastHoveringOption = -99;
- static int lastScreen = m_nCurrScreen;
+ static int oldOption = -99;
+ static int oldScreen = m_nCurrScreen;
m_nPrevOption = rowToCheck;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrOption = rowToCheck;
m_bShowMouse = true;
}
- if (lastHoveringOption != m_nCurrOption) {
- if (lastScreen == m_nCurrScreen && m_bShowMouse)
+ if (oldOption != m_nCurrOption) {
+ if (oldScreen == m_nCurrScreen && m_bShowMouse)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
- lastHoveringOption = m_nCurrOption;
- lastScreen = m_nCurrScreen;
+ oldOption = m_nCurrOption;
+ oldScreen = m_nCurrScreen;
}
- if (lastScreen == m_nPrevScreen)
- lastScreen = m_nCurrScreen;
+ if (oldScreen == m_nPrevScreen)
+ oldScreen = m_nCurrScreen;
m_nHoverOption = HOVEROPTION_RANDOM_ITEM;
foundTheHoveringItem = true;
@@ -1098,7 +1223,7 @@ void CMenuManager::Draw()
// Sliders
// We stretch slider start X here(like original code), because it will always be center of screen
- int lastBarX;
+ int lastActiveBarX;
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_BRIGHTNESS:
ProcessSlider(m_PrefsBrightness / 512.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
@@ -1156,45 +1281,646 @@ void CMenuManager::Draw()
break;
}
- if (m_nCurrScreen == MENUPAGE_CONTROLLER_SETTINGS) {
+ if (m_nCurrScreen == MENUPAGE_CONTROLLER_SETTINGS)
PrintController();
+ else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT_OLD) {
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(180), MENU_Y(98), MENU_X_LEFT_ALIGNED(230), MENU_Y(123)), CRGBA(255, 255, 255, FadeIn(255)));
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(181), MENU_Y(99), MENU_X_LEFT_ALIGNED(229), MENU_Y(122)), CRGBA(m_PrefsPlayerRed, m_PrefsPlayerGreen, m_PrefsPlayerBlue, FadeIn(255)));
}
-/* else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT_OLD) {
- CSprite2d::DrawRect(CRect(StretchX(180), MENU_Y(98), StretchX(230), MENU_Y(123)), CRGBA(255, 255, 255, FadeIn(255)));
- CSprite2d::DrawRect(CRect(StretchX(181), MENU_Y(99), StretchX(229), MENU_Y(233)), CRGBA(Player color from PickNewPlayerColour, FadeIn(255)));
+
+}
+
+int
+CMenuManager::GetNumOptionsCntrlConfigScreens(void)
+{
+ int number = 0;
+ switch (m_nCurrScreen) {
+ case MENUPAGE_CONTROLLER_PC_OLD3:
+ number = 2;
+ break;
+ case MENUPAGE_CONTROLLER_DEBUG:
+ number = 4;
+ break;
+ case MENUPAGE_KEYBOARD_CONTROLS:
+ switch (m_ControlMethod) {
+ case CONTROL_STANDARD:
+ number = 25;
+ break;
+ case CONTROL_CLASSIC:
+ number = 30;
+ break;
+ }
+ break;
}
-*/
+ return number;
}
+
+void
+CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 column)
+{
+ int controllerAction = PED_FIREWEAPON;
+ // GetStartOptionsCntrlConfigScreens();
+ int numOptions = GetNumOptionsCntrlConfigScreens();
+ int bindingMargin = MENU_X(3.0f);
+ float rowHeight;
+ switch (m_ControlMethod) {
+ case CONTROL_STANDARD:
+ rowHeight = CONTSETUP_STANDARD_ROW_HEIGHT;
+ break;
+ case CONTROL_CLASSIC:
+ rowHeight = CONTSETUP_CLASSIC_ROW_HEIGHT;
+ break;
+ default:
+ break;
+ }
+
+ // MENU_Y(rowHeight * 0.0f + yStart);
+ for (int optionIdx = 0, nextY = MENU_Y(yStart); optionIdx < numOptions; nextY = MENU_Y(++optionIdx * rowHeight + yStart)) {
+ int nextX = xStart;
+ int bindingsForThisOpt = 0;
+ CFont::SetColor(CRGBA(155, 155, 155, FadeIn(255)));
+
+ if (column == CONTSETUP_PED_COLUMN) {
+ switch (optionIdx) {
+ case 0:
+ controllerAction = PED_FIREWEAPON;
+ break;
+ case 1:
+ controllerAction = PED_CYCLE_WEAPON_RIGHT;
+ break;
+ case 2:
+ controllerAction = PED_CYCLE_WEAPON_LEFT;
+ break;
+ case 3:
+ controllerAction = GO_FORWARD;
+ break;
+ case 4:
+ controllerAction = GO_BACK;
+ break;
+ case 5:
+ controllerAction = GO_LEFT;
+ break;
+ case 6:
+ controllerAction = GO_RIGHT;
+ break;
+ case 7:
+ controllerAction = PED_SNIPER_ZOOM_IN;
+ break;
+ case 8:
+ controllerAction = PED_SNIPER_ZOOM_OUT;
+ break;
+ case 9:
+ controllerAction = VEHICLE_ENTER_EXIT;
+ break;
+ case 10:
+ case 11:
+ case 12:
+ case 16:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ controllerAction = -1;
+ break;
+ case 13:
+ controllerAction = CAMERA_CHANGE_VIEW_ALL_SITUATIONS;
+ break;
+ case 14:
+ controllerAction = PED_JUMPING;
+ break;
+ case 15:
+ controllerAction = PED_SPRINT;
+ break;
+ case 17:
+ controllerAction = PED_LOCK_TARGET;
+ break;
+ case 22:
+ controllerAction = PED_LOOKBEHIND;
+ break;
+ case 23:
+ if (m_ControlMethod == CONTROL_STANDARD)
+ controllerAction = -1;
+ else
+ controllerAction = PED_1RST_PERSON_LOOK_LEFT;
+ break;
+ case 24:
+ if (m_ControlMethod == CONTROL_STANDARD)
+ controllerAction = -1;
+ else
+ controllerAction = PED_1RST_PERSON_LOOK_RIGHT;
+ break;
+ case 25:
+ controllerAction = PED_1RST_PERSON_LOOK_UP;
+ break;
+ case 26:
+ controllerAction = PED_1RST_PERSON_LOOK_DOWN;
+ break;
+ case 27:
+ controllerAction = PED_CYCLE_TARGET_LEFT;
+ break;
+ case 28:
+ controllerAction = PED_CYCLE_TARGET_RIGHT;
+ break;
+ case 29:
+ controllerAction = PED_CENTER_CAMERA_BEHIND_PLAYER;
+ break;
+ default:
+ break;
+ }
+ } else if (column == CONTSETUP_VEHICLE_COLUMN) {
+ switch (optionIdx) {
+ case 0:
+ controllerAction = PED_FIREWEAPON;
+ break;
+ case 1:
+ case 2:
+ case 7:
+ case 8:
+ case 14:
+ case 15:
+ case 17:
+ case 25:
+ case 26:
+ case 27:
+ case 28:
+ case 29:
+ controllerAction = -1;
+ break;
+ case 3:
+ controllerAction = VEHICLE_ACCELERATE;
+ break;
+ case 4:
+ controllerAction = VEHICLE_BRAKE;
+ break;
+ case 5:
+ controllerAction = GO_LEFT;
+ break;
+ case 6:
+ controllerAction = GO_RIGHT;
+ break;
+ case 9:
+ controllerAction = VEHICLE_ENTER_EXIT;
+ break;
+ case 10:
+ controllerAction = VEHICLE_CHANGE_RADIO_STATION;
+ break;
+ case 11:
+ controllerAction = VEHICLE_HORN;
+ break;
+ case 12:
+ controllerAction = TOGGLE_SUBMISSIONS;
+ break;
+ case 13:
+ controllerAction = CAMERA_CHANGE_VIEW_ALL_SITUATIONS;
+ break;
+ case 16:
+ controllerAction = VEHICLE_HANDBRAKE;
+ break;
+ case 18:
+ controllerAction = VEHICLE_TURRETLEFT;
+ break;
+ case 19:
+ controllerAction = VEHICLE_TURRETRIGHT;
+ break;
+ case 20:
+ controllerAction = VEHICLE_TURRETUP;
+ break;
+ case 21:
+ controllerAction = VEHICLE_TURRETDOWN;
+ break;
+ case 22:
+ controllerAction = -2;
+ break;
+ case 23:
+ controllerAction = VEHICLE_LOOKLEFT;
+ break;
+ case 24:
+ controllerAction = VEHICLE_LOOKRIGHT;
+ break;
+ default:
+ break;
+ }
+ }
+ int bindingWhite = 155;
+
+ // Highlight selected column(and make its text black)
+ if (m_nSelectedListRow == optionIdx) {
+ int bgY = m_nSelectedListRow * rowHeight + yStart + 1.0f;
+ if (m_nCurrExLayer == HOVEROPTION_LIST) {
+
+ if (column == CONTSETUP_PED_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_PED_COLUMN) {
+#ifdef FIX_BUGS
+ if (controllerAction == -1) {
+ CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
+ MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150)));
+ } else {
+ CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
+ MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210)));
+ }
+#else
+ if (controllerAction == -1) {
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY),
+ MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150)));
+ } else {
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY),
+ MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210)));
+ }
#endif
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
+ bindingWhite = 0;
-#if 1
-WRAPPER void CMenuManager::DrawControllerBound(int, int, int, uint8) { EAXJMP(0x489710); }
+ } else if (column == CONTSETUP_VEHICLE_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_VEHICLE_COLUMN) {
+#ifdef FIX_BUGS
+ if (controllerAction == -1) {
+ CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
+ MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150)));
+ } else {
+ CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
+ MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210)));
+ }
#else
-void CMenuManager::DrawControllerBound(int, int, int, uint8)
-{
+ if (controllerAction == -1) {
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(410.0f), MENU_Y(bgY), MENU_X_LEFT_ALIGNED(600.0f), MENU_Y(bgY + 10)), CRGBA(235, 170, 50, FadeIn(150)));
+ } else {
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(410.0f), MENU_Y(bgY), MENU_X_LEFT_ALIGNED(600.0f), MENU_Y(bgY + 10)), CRGBA(255, 217, 106, FadeIn(210)));
+ }
+#endif
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
+ bindingWhite = 0;
+ }
+ }
+ }
+
+ // Print bindings, including seperator (-) between them
+ CFont::SetScale(MENU_X(0.25f), MENU_Y(0.6f));
+ for (int contSetOrder = SETORDER_1; contSetOrder < MAX_SETORDERS && controllerAction != -1; contSetOrder++) {
+ wchar *settingText = ControlsManager.GetControllerSettingTextWithOrderNumber((e_ControllerAction)controllerAction, (eContSetOrder)contSetOrder);
+ if (settingText) {
+ ++bindingsForThisOpt;
+ if (bindingsForThisOpt > 1) {
+ wchar *seperator = TheText.Get("FEC_IBT");
+ CFont::SetColor(CRGBA(20, 20, 20, FadeIn(80)));
+ CFont::PrintString(nextX, nextY, seperator);
+ CFont::SetColor(CRGBA(bindingWhite, bindingWhite, bindingWhite, FadeIn(255)));
+ nextX += CFont::GetStringWidth(seperator, true) + bindingMargin;
+ }
+ CFont::PrintString(nextX, nextY, settingText);
+ nextX += CFont::GetStringWidth(settingText, true) + bindingMargin;
+ }
+ }
+ if (controllerAction == -1) {
+ CFont::SetColor(CRGBA(20, 20, 20, FadeIn(80)));
+ CFont::PrintString(nextX, nextY, TheText.Get("FEC_NUS")); // not used
+ } else if (controllerAction == -2) {
+ CFont::SetColor(CRGBA(20, 20, 20, FadeIn(80)));
+ CFont::PrintString(nextX, nextY, TheText.Get("FEC_CMP")); // combo: l+r
+ } else if (bindingsForThisOpt == 0) {
+ if (m_nSelectedListRow != optionIdx) {
+ CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
+ CFont::PrintString(nextX, nextY, TheText.Get("FEC_UNB")); // unbound
+ } else if (m_bWaitingForNewKeyBind) {
+ if (column != m_nSelectedContSetupColumn) {
+ CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
+ CFont::PrintString(nextX, nextY, TheText.Get("FEC_UNB")); // unbound
+ }
+ } else {
+ if (column != m_nSelectedContSetupColumn) {
+ CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
+ }
+ CFont::PrintString(nextX, nextY, TheText.Get("FEC_UNB")); // unbound
+ }
+ }
+ if (column == CONTSETUP_PED_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_PED_COLUMN ||
+ column == CONTSETUP_VEHICLE_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_VEHICLE_COLUMN) {
+
+ if (optionIdx == m_nSelectedListRow && controllerAction != -1 && controllerAction != -2) {
+ m_CurrCntrlAction = controllerAction;
+ if (m_bWaitingForNewKeyBind) {
+ static bool showWaitingText = false;
+ if (bindingsForThisOpt > 0) {
+ wchar *seperator = TheText.Get("FEC_IBT");
+ CFont::PrintString(nextX, nextY, seperator);
+ nextX += CFont::GetStringWidth(seperator, true) + bindingMargin;
+ }
+ static uint32 lastWaitingTextFlash = 0;
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastWaitingTextFlash > 150) {
+ showWaitingText = !showWaitingText;
+ lastWaitingTextFlash = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+ if (showWaitingText) {
+ CFont::SetColor(CRGBA(55, 55, 55, FadeIn(255)));
+ CFont::PrintString(nextX, nextY, TheText.Get("FEC_QUE")); // "???"
+ }
+ CFont::SetCentreOn();
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
+ if (m_bKeyChangeNotProcessed) {
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_CIG")); // BACKSPACE TO CLEAR - LMB,RETURN TO CHANGE
+ } else {
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_RIG")); // SELECT A NEW CONTROL FOR THIS ACTION OR ESC TO CANCEL
+ }
+
+ CFont::SetRightJustifyOff();
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(0);
+ if (!m_bKeyIsOK)
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+
+ m_bKeyIsOK = true;
+ } else {
+ CFont::SetCentreOn();
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_CIG")); // BACKSPACE TO CLEAR - LMB,RETURN TO CHANGE
+ CFont::SetRightJustifyOff();
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_BANK);
+ m_bKeyIsOK = false;
+ m_bKeyChangeNotProcessed = false;
+ }
+ } else if (optionIdx == m_nSelectedListRow) {
+ CFont::SetCentreOn();
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetColor(CRGBA(55, 55, 55, FadeIn(255)));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_EIG")); // CANNOT SET A CONTROL FOR THIS ACTION
+ CFont::SetRightJustifyOff();
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_BANK);
+ }
+ }
+ }
}
-#endif
-#if 1
-WRAPPER void CMenuManager::DrawControllerScreenExtraText(int, int, int) { EAXJMP(0x4892F0); }
-#else
-void CMenuManager::DrawControllerScreenExtraText(int, int, int)
+void
+CMenuManager::DrawControllerScreenExtraText(int yStart, int xStart, int lineHeight)
{
+ int extraTextStart = GetStartOptionsCntrlConfigScreens();
+ int numOpts = GetNumOptionsCntrlConfigScreens();
+ int spacing = MENU_X(10.0f);
+ for (int i = extraTextStart; i < extraTextStart + numOpts; i++) {
+ int numTextsPrinted = 0;
+ int nextX = xStart;
+ for (int j = 1; j < 5; j++) {
+ wchar *text = ControlsManager.GetControllerSettingTextWithOrderNumber((e_ControllerAction)i, (eContSetOrder)j);
+ if (text)
+ ++numTextsPrinted;
+
+ if (text) {
+ // Seperator
+ if (numTextsPrinted > 1) {
+ CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT"));
+ nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX;
+ }
+ CFont::PrintString(nextX, MENU_Y(yStart), text);
+ }
+ if (text)
+ nextX = CFont::GetStringWidth(text, true) + spacing + nextX;
+ }
+ if (m_nCurrOption == i - extraTextStart && m_bWaitingForNewKeyBind) {
+ static bool waitingTextVisible = false;
+
+ // Seperator
+ if (numTextsPrinted > 0) {
+ CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT"));
+ nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX;
+ }
+ static uint32 lastStateChange = 0;
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastStateChange > 150) {
+ waitingTextVisible = !waitingTextVisible;
+ lastStateChange = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+ if (waitingTextVisible) {
+ CFont::SetColor(CRGBA(255, 255, 0, FadeIn(255)));
+ CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_QUE"));
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ }
+ }
+ yStart += lineHeight;
+ }
+ wchar *error = nil;
+ if (DisplayComboButtonErrMsg)
+ error = ControlsManager.GetButtonComboText((e_ControllerAction)(m_nCurrOption + extraTextStart));
+ if (error) {
+ CFont::SetColor(CRGBA(233, 22, 159, 255));
+ CFont::PrintString(xStart, MENU_Y(yStart + 10), error);
+ }
}
+
+void
+CMenuManager::DrawControllerSetupScreen()
+{
+ float rowHeight;
+ switch (m_ControlMethod) {
+ case CONTROL_STANDARD:
+ rowHeight = CONTSETUP_STANDARD_ROW_HEIGHT;
+ break;
+ case CONTROL_CLASSIC:
+ rowHeight = CONTSETUP_CLASSIC_ROW_HEIGHT;
+ break;
+ default:
+ break;
+ }
+ CFont::SetBackgroundOff();
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
+
+ // Page header
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
+ CFont::SetRightJustifyOn();
+ CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT));
+ CFont::SetFontStyle(FONT_HEADING);
+ switch (m_ControlMethod) {
+ case CONTROL_STANDARD:
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y),
+ TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
+ break;
+ case CONTROL_CLASSIC:
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y),
+ TheText.Get("FET_CTI"));
+ break;
+ default:
+ break;
+ }
+ wchar *actionTexts[31];
+ actionTexts[0] = TheText.Get("FEC_FIR");
+ actionTexts[1] = TheText.Get("FEC_NWE");
+ actionTexts[2] = TheText.Get("FEC_PWE");
+ actionTexts[3] = TheText.Get("FEC_FOR");
+ actionTexts[4] = TheText.Get("FEC_BAC");
+ actionTexts[5] = TheText.Get("FEC_LEF");
+ actionTexts[6] = TheText.Get("FEC_RIG");
+ actionTexts[7] = TheText.Get("FEC_ZIN");
+ actionTexts[8] = TheText.Get("FEC_ZOT");
+ actionTexts[9] = TheText.Get("FEC_EEX");
+ actionTexts[10] = TheText.Get("FEC_RAD");
+ actionTexts[11] = TheText.Get("FEC_HRN");
+ actionTexts[12] = TheText.Get("FEC_SUB");
+ actionTexts[13] = TheText.Get("FEC_CMR");
+ actionTexts[14] = TheText.Get("FEC_JMP");
+ actionTexts[15] = TheText.Get("FEC_SPN");
+ actionTexts[16] = TheText.Get("FEC_HND");
+ actionTexts[17] = TheText.Get("FEC_TAR");
+ if (m_ControlMethod == CONTROL_CLASSIC) {
+ actionTexts[18] = TheText.Get("FEC_TFL");
+ actionTexts[19] = TheText.Get("FEC_TFR");
+ actionTexts[20] = TheText.Get("FEC_TFU");
+ actionTexts[21] = TheText.Get("FEC_TFD");
+ actionTexts[22] = TheText.Get("FEC_LBA");
+ actionTexts[23] = TheText.Get("FEC_LOL");
+ actionTexts[24] = TheText.Get("FEC_LOR");
+ actionTexts[25] = TheText.Get("FEC_LUD");
+ actionTexts[26] = TheText.Get("FEC_LDU");
+ actionTexts[27] = TheText.Get("FEC_NTR");
+ actionTexts[28] = TheText.Get("FEC_PTT");
+ actionTexts[29] = TheText.Get("FEC_CEN");
+ actionTexts[30] = nil;
+ } else {
+ actionTexts[18] = TheText.Get("FEC_TFL");
+ actionTexts[19] = TheText.Get("FEC_TFR");
+ actionTexts[20] = TheText.Get("FEC_TFU");
+ actionTexts[21] = TheText.Get("FEC_TFD");
+ actionTexts[22] = TheText.Get("FEC_LBA");
+ actionTexts[23] = TheText.Get("FEC_LOL");
+ actionTexts[24] = TheText.Get("FEC_LOR");
+ actionTexts[25] = nil;
+ }
+
+ // Gray panel background
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT), MENU_Y(CONTSETUP_LIST_TOP),
+ MENU_X_RIGHT_ALIGNED(CONTSETUP_LIST_RIGHT), SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_LIST_BOTTOM)),
+ CRGBA(200, 200, 50, FadeIn(50)));
+
+ if (m_nCurrExLayer == HOVEROPTION_LIST)
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+ else
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+
+ // List header
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_1_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CAC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CFT"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CCR"));
+ CFont::SetRightJustifyOff();
+ CFont::SetScale(MENU_X_LEFT_ALIGNED(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_BANK);
+ int yStart;
+ if (m_ControlMethod == CONTROL_CLASSIC)
+ yStart = CONTSETUP_LIST_HEADER_HEIGHT + 29;
+ else
+ yStart = CONTSETUP_LIST_HEADER_HEIGHT + 34;
+
+ for (int i = 0; i < ARRAY_SIZE(actionTexts); ++i) {
+ wchar *actionText = actionTexts[i];
+ if (!actionText)
+ break;
+
+ if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT + 2.0f) &&
+ m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X + CONTSETUP_BOUND_COLUMN_WIDTH)) {
+
+ float curOptY = i * rowHeight + yStart;
+ if (m_nMousePosY > MENU_Y(curOptY) && m_nMousePosY < MENU_Y(rowHeight + curOptY)) {
+ if (m_nPrevOption != i && m_nCurrExLayer == HOVEROPTION_LIST)
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+
+ m_nPrevOption = i;
+ if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
+ m_nCurrExLayer = HOVEROPTION_LIST;
+ m_nSelectedListRow = i;
+
+ // why different number for 3rd column hovering X?? this function is a mess
+#ifdef FIX_BUGS
+ if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH)) {
+#else
+ if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(370.0f)) {
#endif
+ if (m_nSelectedContSetupColumn != CONTSETUP_PED_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST)
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
-#if 1
-WRAPPER void CMenuManager::DrawControllerSetupScreen() { EAXJMP(0x481210); }
+ m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN;
+#ifdef FIX_BUGS
+ } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH) && m_nMousePosX < SCREEN_WIDTH) {
#else
-void CMenuManager::DrawControllerSetupScreen()
-{
+ } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(370.0f) && m_nMousePosX < SCREEN_WIDTH) {
+#endif
+ if (m_nSelectedContSetupColumn != CONTSETUP_VEHICLE_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST)
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
+ }
+ }
+ // what??
+ if (m_nHoverOption == HOVEROPTION_SKIN) {
+ if (i == m_nSelectedListRow) {
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ m_bWaitingForNewKeyBind = true;
+ m_bStartWaitingForKeyBind = true;
+ pControlEdit = &m_KeyPressedCode;
+ }
+ } else
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ }
+ }
+ if (m_nSelectedListRow != 35)
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ else if (m_nCurrExLayer == HOVEROPTION_LIST)
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+
+ CFont::SetRightJustifyOff();
+ if (m_PrefsLanguage != LANGUAGE_GERMAN || i != 20 && i != 21)
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ else
+ CFont::SetScale(MENU_X(0.32f), MENU_Y(SMALLESTTEXT_Y_SCALE));
+
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_1_X), MENU_Y(i * rowHeight + yStart), actionText);
+ }
+ DrawControllerBound(yStart, MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X), rowHeight, CONTSETUP_PED_COLUMN);
+ DrawControllerBound(yStart, MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), rowHeight, CONTSETUP_VEHICLE_COLUMN);
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
+
+ if ((m_nMousePosX > MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT) - CFont::GetStringWidth(TheText.Get("FEDS_TB"), true)
+ && m_nMousePosX < MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT) && m_nMousePosY > SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM)
+ && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM - CONTSETUP_BACK_HEIGHT)) || m_nCurrExLayer == HOVEROPTION_BACK) {
+ m_nHoverOption = HOVEROPTION_BACK;
+
+ } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT + 2.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X + CONTSETUP_BOUND_COLUMN_WIDTH)
+ && m_nMousePosY > MENU_Y(CONTSETUP_LIST_TOP + CONTSETUP_LIST_HEADER_HEIGHT) && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_LIST_BOTTOM + 5.0f)) {
+ m_nHoverOption = HOVEROPTION_LIST;
+
+ } else {
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ }
+
+ // Back button and it's shadow
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
+ CFont::SetRightJustifyOn();
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90)));
+ for (int i = 0; i < 2; i++) {
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT - 2.0f - i),
+ SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM - 4.0f - i), TheText.Get("FEDS_TB"));
+
+ if (m_nHoverOption == HOVEROPTION_BACK)
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+ else
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ }
}
-#endif
-void CMenuManager::DrawFrontEnd()
+void
+CMenuManager::DrawFrontEnd()
{
CFont::SetAlphaFade(255.0f);
@@ -1251,7 +1977,8 @@ void CMenuManager::DrawFrontEnd()
}
#ifdef PS2_SAVE_DIALOG
-void CMenuManager::DrawFrontEndSaveZone()
+void
+CMenuManager::DrawFrontEndSaveZone()
{
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -1263,7 +1990,7 @@ void CMenuManager::DrawFrontEndSaveZone()
m_nMenuFadeAlpha = 255;
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
- CMenuManager::Draw();
+ Draw();
CFont::DrawFonts();
@@ -1294,7 +2021,8 @@ void CMenuManager::DrawFrontEndSaveZone()
#endif
#ifdef PS2_LIKE_MENU
-void CMenuManager::DrawFrontEndNormal()
+void
+CMenuManager::DrawFrontEndNormal()
{
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -1370,13 +2098,11 @@ void CMenuManager::DrawFrontEndNormal()
reverseAlpha = false;
ChangeScreen(pendingScreen, pendingOption, true, false);
} else {
- float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
-
// +20 per every 33 ms (1000.f/30.f - original frame limiter fps)
if (!reverseAlpha)
- fadeAlpha += (timestep * 100.f) * 20.f / 33.f;
+ fadeAlpha += (frameTime) * 20.f / 33.f;
else
- fadeAlpha = max(0.0f, fadeAlpha - (timestep * 100.f) * 30.f / 33.f);
+ fadeAlpha = max(0.0f, fadeAlpha - (frameTime) * 30.f / 33.f);
m_nMenuFadeAlpha = fadeAlpha;
}
@@ -1385,8 +2111,7 @@ void CMenuManager::DrawFrontEndNormal()
if (lastState == 0) fadeAlpha = 255.f;
if (reverseAlpha) {
- float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
- fadeAlpha -= (timestep * 100.f) * 30.f / 33.f;
+ fadeAlpha -= (frameTime) * 30.f / 33.f;
m_nMenuFadeAlpha = fadeAlpha;
}
@@ -1408,18 +2133,18 @@ void CMenuManager::DrawFrontEndNormal()
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
- CMenuManager::DrawPlayerSetupScreen();
+ DrawPlayerSetupScreen();
break;
case MENUPAGE_KEYBOARD_CONTROLS:
- CMenuManager::DrawControllerSetupScreen();
+ DrawControllerSetupScreen();
break;
default:
- CMenuManager::Draw();
+ Draw();
break;
}
#define optionWidth MENU_X(66.0f)
- #define rawOptionHeight 20.0f
+ #define rawOptionHeight 22.0f
#define optionBottom SCREEN_SCALE_FROM_BOTTOM(20.0f)
#define optionTop SCREEN_SCALE_FROM_BOTTOM(20.0f + rawOptionHeight)
#define leftPadding MENU_X_LEFT_ALIGNED(90.0f)
@@ -1427,7 +2152,7 @@ void CMenuManager::DrawFrontEndNormal()
hoveredBottomBarOption = -1;
if (curBottomBarOption != -1) {
- // This active tab sprite is weird...
+ // This active tab sprite is needlessly big
m_aFrontEndSprites[FE2_TABACTIVE].Draw(CRect(leftPadding - MENU_X(2.0f) + (optionWidth) * curBottomBarOption, optionTop,
leftPadding - MENU_X(5.0f) + optionWidth * (curBottomBarOption + 2), optionBottom + MENU_Y(rawOptionHeight - 9.0f)),
CRGBA(CRGBA(255, 255, 255, 255)));
@@ -1488,7 +2213,8 @@ void CMenuManager::DrawFrontEndNormal()
}
}
#else
-void CMenuManager::DrawFrontEndNormal()
+void
+CMenuManager::DrawFrontEndNormal()
{
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -1594,10 +2320,8 @@ void CMenuManager::DrawFrontEndNormal()
static float fadeAlpha = 0.0f;
if (m_nMenuFadeAlpha == 0 && fadeAlpha > 1.0f) fadeAlpha = 0.0f;
- float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
-
// +20 per every 33 ms (1000.f/30.f - original frame limiter fps)
- fadeAlpha += (timestep * 100.f) * 20.f / 33.f;
+ fadeAlpha += (frameTime) * 20.f / 33.f;
m_nMenuFadeAlpha = fadeAlpha;
#else
static uint32 LastFade = 0;
@@ -1642,13 +2366,13 @@ void CMenuManager::DrawFrontEndNormal()
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
- CMenuManager::DrawPlayerSetupScreen();
+ DrawPlayerSetupScreen();
break;
case MENUPAGE_KEYBOARD_CONTROLS:
- CMenuManager::DrawControllerSetupScreen();
+ DrawControllerSetupScreen();
break;
default:
- CMenuManager::Draw();
+ Draw();
break;
}
@@ -1680,19 +2404,421 @@ void CMenuManager::DrawFrontEndNormal()
}
#endif
-#if 1
-WRAPPER void CMenuManager::DrawPlayerSetupScreen() { EAXJMP(0x47F2B0); }
-#else
-void CMenuManager::DrawPlayerSetupScreen()
+void
+CMenuManager::DrawPlayerSetupScreen()
{
+ CFont::SetBackgroundOff();
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
-}
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
+ CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT));
+ CFont::SetRightJustifyOn();
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get("FET_PS"));
+
+ // lstrcpy's changed with strcpy
+
+ if (!m_bSkinsEnumerated) {
+ OutputDebugString("Enumerating skin filenames from skins...");
+ m_pSkinListHead.nextSkin = nil;
+ m_pSelectedSkin = &m_pSkinListHead;
+ m_pSelectedSkin->nextSkin = new tSkinInfo;
+ m_pSelectedSkin = m_pSelectedSkin->nextSkin;
+ m_pSelectedSkin->skinId = 0;
+ strcpy(m_pSelectedSkin->skinNameOriginal, "$$\"\"");
+ strcpy(m_pSelectedSkin->skinNameDisplayed, UnicodeToAscii(TheText.Get("FET_DSN")));
+ int nextSkinId = 1;
+ m_pSelectedSkin->nextSkin = nil;
+
+ WIN32_FIND_DATA FindFileData;
+ SYSTEMTIME SystemTime;
+ HANDLE handle = FindFirstFile("skins\\*.bmp", &FindFileData);
+ for (int i = 1; handle != INVALID_HANDLE_VALUE && i; i = FindNextFile(handle, &FindFileData)) {
+ if (strncmp(FindFileData.cFileName, "$$\"\"", 5) != 0) {
+ m_pSelectedSkin->nextSkin = new tSkinInfo;
+ m_pSelectedSkin = m_pSelectedSkin->nextSkin;
+ m_pSelectedSkin->skinId = nextSkinId;
+ strcpy(m_pSelectedSkin->skinNameOriginal, FindFileData.cFileName);
+ strcpy(m_pSelectedSkin->skinNameDisplayed, FindFileData.cFileName);
+ FileTimeToSystemTime(&FindFileData.ftLastWriteTime, &SystemTime);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &SystemTime, 0, m_pSelectedSkin->date, 255);
+ ++nextSkinId;
+ m_pSelectedSkin->nextSkin = nil;
+ }
+ }
+ FindClose(handle);
+ m_nSkinsTotal = nextSkinId;
+ char nameTemp[256];
+ for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin; m_pSelectedSkin = m_pSelectedSkin->nextSkin) {
+ // Drop extension
+ int oldLength = strlen(m_pSelectedSkin->skinNameDisplayed);
+ m_pSelectedSkin->skinNameDisplayed[oldLength - 4] = '\0';
+ m_pSelectedSkin->skinNameOriginal[oldLength - 4] = '\0';
+
+ // Fill to 40 bytes-39 chars, idk why. This is done in sepearate function in game.
+ strncpy(nameTemp, m_pSelectedSkin->skinNameDisplayed, 39); // game doesn't do that, but in our day strncpy to same string is forbidden
+ strncpy(m_pSelectedSkin->skinNameDisplayed, nameTemp, 39);
+ if (oldLength - 4 > 39)
+ m_pSelectedSkin->skinNameDisplayed[39] = '\0';
+
+ // Make string lowercase, except first letter
+ strlwr(m_pSelectedSkin->skinNameDisplayed);
+ strncpy(nameTemp, m_pSelectedSkin->skinNameDisplayed, 1);
+ strupr(nameTemp);
+ strncpy(m_pSelectedSkin->skinNameDisplayed, nameTemp, 1);
+
+ // Change some chars
+#ifdef FIX_BUGS
+ for (int k = 0; m_pSelectedSkin->skinNameDisplayed[k] != '\0'; ++k) {
+#else
+ for (int k = 0; m_pSelectedSkin->skinNameOriginal[k] != '\0'; ++k) {
#endif
+ if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "_", 1))
+ strncpy(&m_pSelectedSkin->skinNameDisplayed[k], " ", 1);
+ if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "@", 1))
+ strncpy(&m_pSelectedSkin->skinNameDisplayed[k], " ", 1);
+ if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "{", 1))
+ strncpy(&m_pSelectedSkin->skinNameDisplayed[k], "(", 1);
+ if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "}", 1))
+ strncpy(&m_pSelectedSkin->skinNameDisplayed[k], ")", 1);
+ if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "£", 1))
+ strncpy(&m_pSelectedSkin->skinNameDisplayed[k], "$", 1);
+ }
-#if 0
-WRAPPER int CMenuManager::FadeIn(int alpha) { EAXJMP(0x48AC60); }
+ // Make letters after whitespace uppercase
+ for (int l = 0; m_pSelectedSkin->skinNameDisplayed[l] != '\0'; ++l) {
+ if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[l], " ", 1)) {
+ if (m_pSelectedSkin->skinNameDisplayed[l + 1]) {
+ strncpy(nameTemp, &m_pSelectedSkin->skinNameDisplayed[l + 1], 1);
+ strupr(nameTemp);
+ strncpy(&m_pSelectedSkin->skinNameDisplayed[l + 1], nameTemp, 1);
+ }
+ }
+ }
+ }
+ OutputDebugString("Finished enumerating skin files.");
+ m_bSkinsEnumerated = true;
+ }
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(PLAYERSETUP_LIST_LEFT), MENU_Y(PLAYERSETUP_LIST_TOP),
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM)), CRGBA(200, 200, 50, FadeIn(50)));
+
+ // Header (Skin - Date)
+ if (m_nCurrExLayer == HOVEROPTION_LIST) {
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+ } else {
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ }
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
+ CFont::SetRightJustifyOn();
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_DATE_COLUMN_RIGHT), MENU_Y(PLAYERSETUP_LIST_TOP), TheText.Get("FES_DAT"));
+ switch (m_PrefsLanguage) {
+ case LANGUAGE_FRENCH:
+ case LANGUAGE_SPANISH:
+ CFont::SetScale(MENU_X(0.6f), MENU_Y(MENUACTION_SCALE_MULT));
+ break;
+ default:
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
+ break;
+ }
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(PLAYERSETUP_SKIN_COLUMN_LEFT), MENU_Y(PLAYERSETUP_LIST_TOP), TheText.Get("FES_SKN"));
+
+ // Skin list
+ CFont::SetRightJustifyOff();
+ CFont::SetScale(MENU_X(PLAYERSETUP_ROW_TEXT_X_SCALE), MENU_Y(PLAYERSETUP_ROW_TEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_BANK);
+ if (m_nSkinsTotal > 0) {
+ for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin->skinId != m_nFirstVisibleRowOnList;
+ m_pSelectedSkin = m_pSelectedSkin->nextSkin);
+
+ int rowTextY = PLAYERSETUP_LIST_BODY_TOP - 1;
+ int orderInVisibles = 0;
+ int rowEndY = PLAYERSETUP_LIST_BODY_TOP + PLAYERSETUP_ROW_HEIGHT + 1;
+ int rowStartY = PLAYERSETUP_LIST_BODY_TOP;
+ for (int rowIdx = m_nFirstVisibleRowOnList;
+ rowIdx < m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW && m_pSelectedSkin; ) {
+
+ if (m_nMousePosX > MENU_X_LEFT_ALIGNED(PLAYERSETUP_LIST_LEFT) && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT)) {
+ if (m_nMousePosY > MENU_Y(rowStartY) && m_nMousePosY < MENU_Y(rowEndY)) {
+ m_nPrevOption = rowIdx;
+ if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
+ m_nCurrExLayer = HOVEROPTION_LIST;
+ }
+ if (m_nHoverOption == HOVEROPTION_SKIN) {
+ if (rowIdx == m_nSelectedListRow) {
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ if (m_nSkinsTotal > 0) {
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ strcpy(m_PrefsSkinFile, m_aSkinName);
+ CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
+ SaveSettings();
+ }
+ } else {
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ m_nCurrExLayer = HOVEROPTION_LIST;
+ m_nSelectedListRow = rowIdx;
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ }
+ }
+ }
+ }
+
+ // Preview skin/change color of row when we focused on another row.
+ if (orderInVisibles == m_nSelectedListRow - m_nFirstVisibleRowOnList) {
+ CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
+ static int lastSelectedSkin = -1;
+ if (m_nSelectedListRow != lastSelectedSkin) {
+ strcpy(m_aSkinName, m_pSelectedSkin->skinNameOriginal);
+ CWorld::Players[0].SetPlayerSkin(m_aSkinName);
+ }
+ lastSelectedSkin = m_nSelectedListRow;
+ } else if (!strcmp(m_PrefsSkinFile, m_pSelectedSkin->skinNameOriginal)) {
+ CFont::SetColor(CRGBA(255, 255, 155, FadeIn(255)));
+ } else {
+ CFont::SetColor(CRGBA(155, 155, 155, FadeIn(255)));
+ }
+ wchar unicodeTemp[80];
+ AsciiToUnicode(m_pSelectedSkin->skinNameDisplayed, unicodeTemp);
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(PLAYERSETUP_SKIN_COLUMN_LEFT), MENU_Y(rowTextY), unicodeTemp);
+
+ // If not "Default skin" option
+ if (rowIdx != 0) {
+ char dateTemp[32];
+ sprintf(dateTemp, "%s", m_pSelectedSkin->date);
+ AsciiToUnicode(dateTemp, unicodeTemp);
+ CFont::SetRightJustifyOn();
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_DATE_COLUMN_RIGHT), MENU_Y(rowTextY), unicodeTemp);
+ }
+ ++orderInVisibles;
+ rowEndY += PLAYERSETUP_ROW_HEIGHT;
+ rowStartY += PLAYERSETUP_ROW_HEIGHT;
+ rowTextY += PLAYERSETUP_ROW_HEIGHT;
+ ++rowIdx;
+ m_pSelectedSkin = m_pSelectedSkin->nextSkin;
+ }
+ // Scrollbar background
+ CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), MENU_Y(PLAYERSETUP_LIST_TOP),
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2 - PLAYERSETUP_SCROLLBAR_WIDTH), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM)), CRGBA(100, 100, 66, FadeIn(205)));
+
+ // Scrollbar
+ float scrollbarHeight = SCROLLBAR_MAX_HEIGHT / m_nSkinsTotal * (float) MAX_VISIBLE_LIST_ROW;
+ float scrollbarBottom, scrollbarTop;
+ if (m_nSkinsTotal <= MAX_VISIBLE_LIST_ROW) {
+ scrollbarBottom = SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 4.0f);
+ scrollbarTop = MENU_Y(PLAYERSETUP_LIST_BODY_TOP);
+
+ // Shadow
+ CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 4), scrollbarTop,
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 1 - PLAYERSETUP_SCROLLBAR_WIDTH), scrollbarBottom + MENU_Y(1.0f)), CRGBA(50, 50, 50, FadeIn(255)));
+ } else {
+#ifdef FIX_BUGS
+ scrollbarBottom = MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 8 + m_nScrollbarTopMargin + scrollbarHeight);
+ scrollbarTop = MENU_Y(PLAYERSETUP_LIST_BODY_TOP + m_nScrollbarTopMargin);
+#else
+ scrollbarBottom = MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 4 + m_nScrollbarTopMargin + scrollbarHeight - SCROLLBAR_MAX_HEIGHT / m_nSkinsTotal);
+ scrollbarTop = MENU_Y(SCROLLBAR_MAX_HEIGHT / m_nSkinsTotal + PLAYERSETUP_LIST_BODY_TOP - 3 + m_nScrollbarTopMargin);
+#endif
+ // Shadow
+ CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 4), scrollbarTop,
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 1 - PLAYERSETUP_SCROLLBAR_WIDTH), scrollbarBottom + MENU_Y(1.0f)),
+ CRGBA(50, 50, 50, FadeIn(255)));
+
+ }
+ CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 4), scrollbarTop,
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - PLAYERSETUP_SCROLLBAR_WIDTH), scrollbarBottom),
+ CRGBA(235, 170, 50, FadeIn(255)));
+
+ // FIX: Scroll button dimensions are buggy, because:
+ // 1 - stretches the original image
+ // 2 - leaves gap between button and scrollbar
+ if (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_UP) {
+#ifdef FIX_BUGS
+ m_aMenuSprites[MENUSPRITE_UPON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), MENU_Y(PLAYERSETUP_LIST_TOP),
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), MENU_Y(PLAYERSETUP_LIST_TOP + PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)),
+ CRGBA(255, 255, 255, FadeIn(255)));
+#else
+ m_aMenuSprites[MENUSPRITE_UPON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), MENU_Y(PLAYERSETUP_LIST_TOP),
+ MENU_X_RIGHT_ALIGNED(-20.0f), MENU_Y(PLAYERSETUP_LIST_TOP + 58)),
+ CRGBA(255, 255, 255, FadeIn(255)));
+#endif
+ } else {
+#ifdef FIX_BUGS
+ m_aMenuSprites[MENUSPRITE_UPOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), MENU_Y(PLAYERSETUP_LIST_TOP),
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), MENU_Y(PLAYERSETUP_LIST_TOP + PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)),
+ CRGBA(255, 255, 255, FadeIn(255)));
+#else
+ m_aMenuSprites[MENUSPRITE_UPOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), MENU_Y(PLAYERSETUP_LIST_TOP),
+ MENU_X_RIGHT_ALIGNED(-21.0f), MENU_Y(PLAYERSETUP_LIST_TOP + 58)),
+ CRGBA(255, 255, 255, FadeIn(255)));
+#endif
+ }
+
+ if (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_DOWN) {
+#ifdef FIX_BUGS
+ m_aMenuSprites[MENUSPRITE_DOWNON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1),
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)),
+ CRGBA(255, 255, 255, FadeIn(255)));
+#else
+ m_aMenuSprites[MENUSPRITE_DOWNON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), SCREEN_SCALE_FROM_BOTTOM(141.0f),
+ MENU_X_RIGHT_ALIGNED(-20.0f), SCREEN_SCALE_FROM_BOTTOM(83.0f)),
+ CRGBA(255, 255, 255, FadeIn(255)));
+#endif
+ } else {
+#ifdef FIX_BUGS
+ m_aMenuSprites[MENUSPRITE_DOWNOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1),
+ MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)),
+ CRGBA(255, 255, 255, FadeIn(255)));
#else
-int CMenuManager::FadeIn(int alpha)
+ m_aMenuSprites[MENUSPRITE_DOWNOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), SCREEN_SCALE_FROM_BOTTOM(141.0f),
+ MENU_X_RIGHT_ALIGNED(-21.0f), SCREEN_SCALE_FROM_BOTTOM(83.0f)),
+ CRGBA(255, 255, 255, FadeIn(255)));
+#endif
+
+ }
+ CPlayerSkin::RenderFrontendSkinEdit();
+
+ // Big apply button
+ if (strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
+ CFont::SetFontStyle(FONT_HEADING);
+ switch (m_PrefsLanguage) {
+ case LANGUAGE_FRENCH:
+ CFont::SetScale(MENU_X(1.1f), MENU_Y(1.9f));
+ break;
+ case LANGUAGE_GERMAN:
+ CFont::SetScale(MENU_X(0.85f), MENU_Y(1.9f));
+ break;
+ case LANGUAGE_ITALIAN:
+ case LANGUAGE_SPANISH:
+ CFont::SetScale(MENU_X(1.4f), MENU_Y(1.9f));
+ break;
+ default:
+ CFont::SetScale(MENU_X(1.9f), MENU_Y(1.9f));
+ break;
+ }
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(120)));
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(20.0f), MENU_Y(220.0f), TheText.Get("FET_APL"));
+ }
+ CFont::SetFontStyle(FONT_HEADING);
+
+ CFont::SetScale(MENU_X(SMALLTEXT_X_SCALE), MENU_Y(SMALLTEXT_Y_SCALE));
+
+ if ((m_nMousePosX > MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 1) - CFont::GetStringWidth(TheText.Get("FEDS_TB"), true)
+ && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 1)
+ && m_nMousePosY > SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 3)
+ && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 26))
+ || m_nCurrExLayer == HOVEROPTION_BACK) {
+ if (m_nHoverOption != HOVEROPTION_BACK)
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+
+ m_nHoverOption = HOVEROPTION_BACK;
+
+ } else if ((strcmp(m_aSkinName, m_PrefsSkinFile) != 0
+ && m_nMousePosX > MENU_X_LEFT_ALIGNED(PLAYERSETUP_LIST_LEFT)
+ && m_nMousePosX < MENU_X_LEFT_ALIGNED(PLAYERSETUP_LIST_LEFT) + CFont::GetStringWidth(TheText.Get("FES_SET"), true)
+ && m_nMousePosY > SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 3)
+ && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 26))
+ || m_nCurrExLayer == HOVEROPTION_USESKIN) {
+ if (m_nHoverOption != HOVEROPTION_USESKIN)
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+
+ m_nHoverOption = HOVEROPTION_USESKIN;
+
+ } else if (m_nMousePosX > MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2)
+ && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - PLAYERSETUP_SCROLLBAR_WIDTH - 2)
+ && m_nMousePosY > MENU_Y(PLAYERSETUP_LIST_TOP)
+ && m_nMousePosY < MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 3)) {
+ if (m_nHoverOption != HOVEROPTION_CLICKED_SCROLL_UP && m_nHoverOption != HOVEROPTION_CLICKED_SCROLL_DOWN)
+ m_nHoverOption = HOVEROPTION_OVER_SCROLL_UP;
+
+ } else if (m_nMousePosX > MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2)
+ && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - PLAYERSETUP_SCROLLBAR_WIDTH - 2)
+ && m_nMousePosY > SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1)
+ && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM)) {
+ if (m_nHoverOption != HOVEROPTION_CLICKED_SCROLL_UP && m_nHoverOption != HOVEROPTION_CLICKED_SCROLL_DOWN)
+ m_nHoverOption = HOVEROPTION_OVER_SCROLL_DOWN;
+
+ } else if (m_nMousePosX > MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2)
+ && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - PLAYERSETUP_SCROLLBAR_WIDTH - 2)
+ && m_nMousePosY > MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 3)
+#ifdef FIX_BUGS
+ && m_nMousePosY < MENU_Y(PLAYERSETUP_LIST_BODY_TOP + m_nScrollbarTopMargin)) {
+#else
+ && m_nMousePosY < MENU_Y(SCROLLBAR_MAX_HEIGHT / m_nTotalListRow + PLAYERSETUP_LIST_BODY_TOP - 3 + m_nScrollbarTopMargin)) {
+#endif
+ m_nHoverOption = HOVEROPTION_PAGEUP;
+
+ } else if (m_nMousePosX > MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2)
+ && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - PLAYERSETUP_SCROLLBAR_WIDTH - 2)
+#ifdef FIX_BUGS
+ && m_nMousePosY > MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 8 + m_nScrollbarTopMargin + scrollbarHeight)
+#else
+ && m_nMousePosY > MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 3 + m_nScrollbarTopMargin + scrollbarHeight - SCROLLBAR_MAX_HEIGHT / m_nTotalListRow)
+#endif
+ && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1)) {
+ m_nHoverOption = HOVEROPTION_PAGEDOWN;
+
+ } else if (m_nMousePosX > MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 4)
+ && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - PLAYERSETUP_SCROLLBAR_WIDTH)
+#ifdef FIX_BUGS
+ && m_nMousePosY > MENU_Y(PLAYERSETUP_LIST_BODY_TOP + m_nScrollbarTopMargin)
+ && m_nMousePosY < MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 8 + m_nScrollbarTopMargin + scrollbarHeight)) {
+#else
+ && m_nMousePosY > MENU_Y(SCROLLBAR_MAX_HEIGHT / m_nTotalListRow + PLAYERSETUP_LIST_BODY_TOP - 3 + m_nScrollbarTopMargin)
+ && m_nMousePosY < MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 3 + m_nScrollbarTopMargin + scrollbarHeight - SCROLLBAR_MAX_HEIGHT / m_nTotalListRow)) {
+#endif
+ m_nHoverOption = HOVEROPTION_HOLDING_SCROLLBAR;
+
+ } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(PLAYERSETUP_LIST_LEFT) && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT)
+ && m_nMousePosY > MENU_Y(PLAYERSETUP_LIST_BODY_TOP + 1) && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM)) {
+ m_nHoverOption = HOVEROPTION_LIST;
+
+ } else {
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ }
+ }
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(MENU_X(SMALLTEXT_X_SCALE), MENU_Y(SMALLTEXT_Y_SCALE));
+ CFont::SetRightJustifyOn();
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90)));
+
+ // Back button
+ for (int i = 0; i < 2; i++) {
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3 - i), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 5 - i), TheText.Get("FEDS_TB"));
+ if (m_nHoverOption == HOVEROPTION_BACK) {
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+ } else {
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ }
+ }
+ CFont::SetRightJustifyOff();
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90)));
+
+ // Use skin button
+ for (int i = 0; i < 2; i++) {
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(i + PLAYERSETUP_LIST_LEFT), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 5 - i), TheText.Get("FES_SET"));
+ if (!strcmp(m_aSkinName, m_PrefsSkinFile)) {
+ CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255)));
+ } else if (m_nHoverOption == HOVEROPTION_USESKIN) {
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+ } else {
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ }
+ }
+
+}
+
+int
+CMenuManager::FadeIn(int alpha)
{
if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS ||
m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS ||
@@ -1701,27 +2827,57 @@ int CMenuManager::FadeIn(int alpha)
return min(m_nMenuFadeAlpha, alpha);
}
-#endif
-#if 1
-WRAPPER void CMenuManager::FilterOutColorMarkersFromString(uint16, CRGBA &) { EAXJMP(0x4889C0); }
-#else
-void CMenuManager::FilterOutColorMarkersFromString(uint16, CRGBA &)
+void
+CMenuManager::FilterOutColorMarkersFromString(wchar *str, CRGBA &newColor)
{
-
+ int newIdx = 0;
+ wchar copy[256], *c;
+ UnicodeStrcpy(copy, str);
+
+ for (c = copy; *c != '\0'; c++) {
+ if (*c == '~') {
+ c++;
+ switch (*c) {
+ case 'b': newColor = CRGBA(40, 40, 255, 255); break;
+ case 'g': newColor = CRGBA(40, 235, 40, 255); break;
+ // There is no case for "h", is that a mistake?
+ case 'l': newColor = CRGBA(0, 0, 0, 255); break;
+ case 'p': newColor = CRGBA(255, 0, 255, 255); break;
+ case 'r': newColor = CRGBA(255, 0, 0, 255); break;
+ case 'w': newColor = CRGBA(255, 255, 255, 255); break;
+ case 'y': newColor = CRGBA(255, 255, 0, 255); break;
+ }
+ while (*c != '~') c++;
+ } else {
+ str[newIdx++] = *c;
+ }
+ }
+ str[newIdx] = '\0';
}
-#endif
-#if 1
-WRAPPER int CMenuManager::GetStartOptionsCntrlConfigScreens() { EAXJMP(0x489270); }
-#else
-int CMenuManager::GetStartOptionsCntrlConfigScreens()
+int
+CMenuManager::GetStartOptionsCntrlConfigScreens()
{
-
+ int number = 0;
+ switch (m_nCurrScreen) {
+ case MENUPAGE_CONTROLLER_PC_OLD3:
+ number = 34;
+ break;
+ case MENUPAGE_CONTROLLER_DEBUG:
+ number = 35;
+ break;
+ case MENUPAGE_KEYBOARD_CONTROLS:
+ number = 0;
+ break;
+ default:
+ break;
+ }
+ return number;
}
-#endif
-void CMenuManager::InitialiseChangedLanguageSettings()
+void
+CMenuManager::InitialiseChangedLanguageSettings()
{
if (m_bFrontEnd_ReloadObrTxtGxt) {
m_bFrontEnd_ReloadObrTxtGxt = false;
@@ -1732,7 +2888,7 @@ void CMenuManager::InitialiseChangedLanguageSettings()
CGame::frenchGame = false;
CGame::germanGame = false;
#ifdef MORE_LANGUAGES
- switch (CMenuManager::m_PrefsLanguage) {
+ switch (m_PrefsLanguage) {
case LANGUAGE_RUSSIAN:
CFont::ReloadFonts(FONT_LANGSET_RUSSIAN);
break;
@@ -1745,7 +2901,7 @@ void CMenuManager::InitialiseChangedLanguageSettings()
}
#endif
- switch (CMenuManager::m_PrefsLanguage) {
+ switch (m_PrefsLanguage) {
case LANGUAGE_FRENCH:
CGame::frenchGame = true;
break;
@@ -1763,22 +2919,23 @@ void CMenuManager::InitialiseChangedLanguageSettings()
}
}
-void CMenuManager::LoadAllTextures()
+void
+CMenuManager::LoadAllTextures()
{
if (m_bSpritesLoaded)
return;
- CMenuManager::CentreMousePointer();
+ CentreMousePointer();
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
m_nCurrOption = 0;
m_PrefsRadioStation = DMAudio.GetRadioInCar();
if (DMAudio.IsMP3RadioChannelAvailable()) {
- if (CMenuManager::m_PrefsRadioStation > USERTRACK)
- CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
- } else if (CMenuManager::m_PrefsRadioStation > CHATTERBOX)
- CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
+ if (m_PrefsRadioStation > USERTRACK)
+ m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
+ } else if (m_PrefsRadioStation > CHATTERBOX)
+ m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
CFileMgr::SetDir("");
//CFileMgr::SetDir("");
@@ -1818,14 +2975,18 @@ void CMenuManager::LoadAllTextures()
m_aMenuSprites[i].SetTexture(MenuFilenames[i][0], MenuFilenames[i][1]);
m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
}
-
+#ifdef MENU_MAP
+ for (int i = 0; i < ARRAY_SIZE(MapFilenames); i++) {
+ m_aMapSprites[i].SetTexture(MapFilenames[i][0], MapFilenames[i][1]);
+ m_aMapSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
+ }
+#endif
m_bSpritesLoaded = true;
CTxdStore::PopCurrentTxd();
}
-#if 0
-WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); }
-#else
-void CMenuManager::LoadSettings()
+
+void
+CMenuManager::LoadSettings()
{
CFileMgr::SetDirMyDocuments();
int fileHandle = CFileMgr::OpenFile("gta3.set", "r");
@@ -1914,12 +3075,9 @@ void CMenuManager::LoadSettings()
strcpy(m_aSkinName, "$$\"\"");
}
}
-#endif
-#if 0
-WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); }
-#else
-void CMenuManager::SaveSettings()
+void
+CMenuManager::SaveSettings()
{
static char RubbishString[48] = "stuffmorestuffevenmorestuff etc";
@@ -1962,44 +3120,117 @@ void CMenuManager::SaveSettings()
CFileMgr::CloseFile(fileHandle);
CFileMgr::SetDir("");
}
-#endif
-#if 1
-WRAPPER void CMenuManager::MessageScreen(char *) { EAXJMP(0x48B7E0); }
-#else
-void CMenuManager::MessageScreen(char *)
+bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
+void DoRWStuffEndOfFrame(void);
+
+void
+CMenuManager::MessageScreen(const char *text)
{
+ CSprite2d *splash = LoadSplash(nil);
+ if (!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255))
+ return;
+
+ CSprite2d::SetRecipNearClip();
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+ DefinedState();
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
+ splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
+
+ CFont::SetBackgroundOff();
+ CFont::SetPropOn();
+ CFont::SetJustifyOn();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f));
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_FROM_RIGHT(170.0f));
+ CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(120.0f), SCREEN_SCALE_Y(150.0f), SCREEN_SCALE_FROM_RIGHT(120.0f), SCREEN_SCALE_FROM_BOTTOM(220.0f)), CRGBA(50, 50, 50, 210));
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetCentreSize(SCREEN_SCALE_X(380.0f));
+ CFont::SetCentreOn();
+ CFont::SetColor(CRGBA(255, 217, 106, 255));
+ CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE));
+ CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(170.0f), TheText.Get(text));
+ CFont::DrawFonts();
+ DoRWStuffEndOfFrame();
}
-#endif
-#if 1
-WRAPPER void CMenuManager::PickNewPlayerColour() { EAXJMP(0x488C40); }
-#else
-void CMenuManager::PickNewPlayerColour()
+void
+CMenuManager::PickNewPlayerColour()
{
-
+ m_PrefsPlayerRed = 0;
+ m_PrefsPlayerGreen = 0;
+ m_PrefsPlayerBlue = 0;
+ while (true) {
+ int sum = m_PrefsPlayerRed + m_PrefsPlayerGreen + m_PrefsPlayerBlue;
+ if (sum >= 100 && sum <= 650)
+ break;
+ m_PrefsPlayerRed = CGeneral::GetRandomNumber();
+ m_PrefsPlayerGreen = CGeneral::GetRandomNumber();
+ m_PrefsPlayerBlue = CGeneral::GetRandomNumber();
+ }
}
-#endif
-#if 1
-WRAPPER void CMenuManager::PrintBriefs() { EAXJMP(0x484D60); }
-#else
-void CMenuManager::PrintBriefs()
+void
+CMenuManager::PrintBriefs()
{
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetRightJustifyOff();
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
+
+ float nextY = 40.0f;
+ CRGBA newColor;
+ for (int i = 4; i >= 0; i--) {
+ tPreviousBrief &brief = CMessages::PreviousBriefs[i];
+ if (brief.m_pText) {
+ CMessages::InsertNumberInString(brief.m_pText,
+ brief.m_nNumber[0], brief.m_nNumber[1],
+ brief.m_nNumber[2], brief.m_nNumber[3],
+ brief.m_nNumber[4], brief.m_nNumber[5], gUString);
+ CMessages::InsertStringInString(gUString, brief.m_pString);
+ CMessages::InsertPlayerControlKeysInString(gUString);
+ newColor = TEXT_COLOR;
+ FilterOutColorMarkersFromString(gUString, newColor);
-}
+#ifdef PS2_LIKE_MENU
+ // This PS2 code was always here, but unused
+ bool rgSame = newColor.r == TEXT_COLOR.r && newColor.g == TEXT_COLOR.g;
+ bool bSame = rgSame && newColor.b == TEXT_COLOR.b;
+ bool colorNotChanged = bSame; /* && newColor.a == TEXT_COLOR.a; */
+
+ if (!colorNotChanged) {
+ newColor.r /= 2;
+ newColor.g /= 2;
+ newColor.b /= 2;
+ }
+ CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); // But this is from PS2
+ CFont::SetDropShadowPosition(1);
#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::PrintErrorMessage() { EAXJMP(0x484F70); }
-#else
-void CMenuManager::PrintErrorMessage()
+#if defined(FIX_BUGS) || defined(PS2_LIKE_MENU)
+ newColor.a = FadeIn(255);
+ CFont::SetColor(newColor);
+#endif
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(50.0f), nextY, gUString);
+ nextY += MENU_Y(menuXYpadding);
+ }
+ }
+
+#ifdef PS2_LIKE_MENU
+ CFont::SetDropShadowPosition(0);
+#endif
+}
+
+// Not sure about name. Not to be confused with CPad::PrintErrorMessage
+void
+CMenuManager::PrintErrorMessage()
{
if (!CPad::bDisplayNoControllerMessage && !CPad::bObsoleteControllerMessage)
return;
- CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_WIDTH - SCREEN_SCALE_X(20.0f), SCREEN_HEIGHT - SCREEN_SCALE_Y(140.0f)), CRGBA(64, 16, 16, 224));
+ CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f)), CRGBA(64, 16, 16, 224));
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOff();
CFont::SetPropOn();
@@ -2007,36 +3238,106 @@ void CMenuManager::PrintErrorMessage()
CFont::SetJustifyOn();
CFont::SetRightJustifyOff();
CFont::SetBackGroundOnlyTextOn();
- CFont::SetWrapx(SCREEN_WIDTH - 40.0f);
- CFont::SetColor(CRGBA(165, 165, 165, 255));
- CFont::SetScale(SCREEN_SCALE_X(0.9f), SCREEN_SCALE_Y(0.9f));
- CFont::PrintString(SCREEN_SCALE_X(40.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(60.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT"));
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(40.0f));
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_X(50.0f), SCREEN_SCALE_Y(180.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT"));
+#else
+ CFont::PrintString(SCREEN_SCALE_X(50.0f), SCREEN_SCALE_Y(40.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT"));
+#endif
CFont::DrawFonts();
}
-#endif
-#if 1
-WRAPPER void CMenuManager::PrintStats() { EAXJMP(0x482100); }
-#else
-void CMenuManager::PrintStats()
+void
+CMenuManager::PrintStats()
{
+ int rowNum = ConstructStatLine(99999);
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
+ float nextYChange, y, alphaMult;
+
+ // Scroll stats with mouse
+#ifdef SCROLLABLE_STATS_PAGE
+ static float scrollY = 0;
+ static uint32 lastChange = m_nScreenChangeDelayTimer;
+ if (CPad::GetPad(0)->GetLeftMouse()) {
+ scrollY += (m_nMouseOldPosY - m_nMousePosY);
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ } else {
+ scrollY += MENU_Y(STATS_SLIDE_Y_PER_SECOND) / 1000.0f * (CTimer::GetTimeInMillisecondsPauseMode() - lastChange);
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+#else
+ // MENU_Y(30.0f) per second
+ float scrollY = MENU_Y(STATS_SLIDE_Y_PER_SECOND) * (CTimer::GetTimeInMillisecondsPauseMode() - m_nScreenChangeDelayTimer) / 1000.0f;
+#endif
+
+ for (int row = 0; row < rowNum; ++row) {
+ // Put just got hidden text at the top back to the bottom, in circular fashion
+ for (y = MENU_Y(STATS_ROW_HEIGHT - 1) * row + SCREEN_HEIGHT - scrollY; MENU_Y(STATS_PUT_BACK_TO_BOTTOM_Y) > y; y += nextYChange) {
+ nextYChange = (MENU_Y(STATS_ROW_HEIGHT) + rowNum) * MENU_Y(STATS_ROW_HEIGHT - 1);
+ }
+
+ // If it's still on screen
+ if (y > 0.0f && SCREEN_HEIGHT > y) {
+ ConstructStatLine(row);
+ // But about to dim from top
+ if (y - MENU_Y(STATS_BOTTOM_MARGIN) < MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH)) {
+ if ((y - MENU_Y(STATS_BOTTOM_MARGIN)) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH) < 0.0f)
+ alphaMult = 0.0f;
+ else
+ alphaMult = (y - MENU_Y(STATS_BOTTOM_MARGIN)) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH);
+
+ // About to dim from bottom
+ } else if (y > SCREEN_SCALE_FROM_BOTTOM(STATS_TOP_DIMMING_AREA_LENGTH) - MENU_Y(STATS_BOTTOM_DIMMING_AREA_LENGTH)) {
+ if ((SCREEN_SCALE_FROM_BOTTOM(STATS_BOTTOM_DIMMING_AREA_LENGTH) - y) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH) < 0.0f)
+ alphaMult = 0.0f;
+ else
+ alphaMult = (SCREEN_SCALE_FROM_BOTTOM(STATS_BOTTOM_DIMMING_AREA_LENGTH) - y) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH);
+ } else
+ alphaMult = 1.0f;
+
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255.0f * alphaMult)));
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(STATS_ROW_X_MARGIN), y - MENU_Y(STATS_BOTTOM_MARGIN - STATS_TOP_MARGIN), gUString);
+ CFont::SetRightJustifyOn();
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(STATS_ROW_X_MARGIN), y - MENU_Y(STATS_BOTTOM_MARGIN - STATS_TOP_MARGIN), gUString2);
+ }
+ }
+ // Game doesn't do that, but it's better
+ float nextX = MENU_X_LEFT_ALIGNED(STATS_RATING_X);
+
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), TheText.Get("CRIMRA")); nextX += MENU_X(10.0f) + CFont::GetStringWidth(TheText.Get("CRIMRA"), true);
+ UnicodeStrcpy(gUString, CStats::FindCriminalRatingString());
+ CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), gUString); nextX += MENU_X(6.0f) + CFont::GetStringWidth(gUString, true);
+ sprintf(gString, "%d", CStats::FindCriminalRatingNumber());
+ AsciiToUnicode(gString, gUString);
+ CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), gUString);
+
+ // ::Draw already does that.
+ /*
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
+ CFont::SetRightJustifyOn();
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT));
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
+ */
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
}
-#endif
-#if 0
-WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); }
-#else
-void CMenuManager::Process(void)
+void
+CMenuManager::Process(void)
{
m_bMenuStateChanged = false;
if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus() != FADE_0)
return;
- m_bStartGameLoading = false;
+ m_bWantToRestart = false;
InitialiseChangedLanguageSettings();
+ // Just a hack by R* to not make game continuously resume/pause. But we it seems we can live with it.
if (CPad::GetPad(0)->GetEscapeJustDown())
RequestFrontEndStartUp();
@@ -2076,9 +3377,9 @@ void CMenuManager::Process(void)
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service();
- m_bStartGameLoading = true;
+ m_bWantToRestart = true;
RequestFrontEndShutDown();
- m_bLoadingSavedGame = true;
+ m_bWantToLoad = true;
b_FoundRecentSavedGameWantToLoad = true;
DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0);
@@ -2103,8 +3404,8 @@ void CMenuManager::Process(void)
m_bStartWaitingForKeyBind = false;
else {
pControlEdit = CPad::EditCodesForControls(pControlEdit, 1);
- JoyButtonJustClicked = 0;
- MouseButtonJustClicked = 0;
+ JoyButtonJustClicked = false;
+ MouseButtonJustClicked = false;
if (CPad::GetPad(0)->GetLeftMouseJustDown())
MouseButtonJustClicked = 1;
@@ -2120,13 +3421,13 @@ void CMenuManager::Process(void)
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
- int32 TypeOfControl = 0;
+ int32 TypeOfControl = KEYBOARD;
if (JoyButtonJustClicked)
- TypeOfControl = 3;
+ TypeOfControl = JOYSTICK;
if (MouseButtonJustClicked)
- TypeOfControl = 2;
+ TypeOfControl = MOUSE;
if (*pControlEdit != rsNULL)
- TypeOfControl = 0;
+ TypeOfControl = KEYBOARD;
if (!m_bKeyIsOK) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
@@ -2134,14 +3435,12 @@ void CMenuManager::Process(void)
m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false;
- }
- else if (!m_bKeyChangeNotProcessed) {
+ } else if (!m_bKeyChangeNotProcessed) {
if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked)
CheckCodesForControls(TypeOfControl);
field_535 = true;
- }
- else {
+ } else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i);
@@ -2155,7 +3454,7 @@ void CMenuManager::Process(void)
}
}
- if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) {
+ if ((m_nCurrScreen == MENUPAGE_NO_MEMORY_CARD || m_nCurrScreen == MENUPAGE_PS2_LOAD_FAILED) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) {
m_nCurrScreen = m_nPrevScreen;
m_nCurrOption = 0;
}
@@ -2175,16 +3474,12 @@ void CMenuManager::Process(void)
m_bWaitingForNewKeyBind = false;
}
- if (!m_bStartGameLoading) {
+ if (!m_bWantToRestart) {
if (m_bGameNotLoaded)
DMAudio.Service();
}
}
-#endif
-#if 0
-WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); }
-#else
void
CMenuManager::ProcessButtonPresses(void)
{
@@ -2232,7 +3527,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#endif
if (CPad::GetPad(0)->GetBackspaceJustDown() && m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS && !field_535) {
- if (m_nCurrExLayer == 19) {
+ if (m_nCurrExLayer == HOVEROPTION_LIST) {
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
m_bWaitingForNewKeyBind = true;
m_bStartWaitingForKeyBind = true;
@@ -2258,21 +3553,21 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
m_bShowMouse = false;
switch (m_nCurrExLayer) {
- case 9:
+ case HOVEROPTION_BACK:
default:
- m_nCurrExLayer = 19;
+ m_nCurrExLayer = HOVEROPTION_LIST;
break;
- case 19:
- m_nCurrExLayer = 21;
+ case HOVEROPTION_LIST:
+ m_nCurrExLayer = HOVEROPTION_USESKIN;
break;
- case 21:
- m_nCurrExLayer = 9;
+ case HOVEROPTION_USESKIN:
+ m_nCurrExLayer = HOVEROPTION_BACK;
}
- if (((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && (m_nCurrExLayer == 21)) && strcmp(m_aSkinName, m_PrefsSkinFile) == 0) {
- m_nCurrExLayer = 9;
+ if (((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && (m_nCurrExLayer == HOVEROPTION_USESKIN)) && strcmp(m_aSkinName, m_PrefsSkinFile) == 0) {
+ m_nCurrExLayer = HOVEROPTION_BACK;
}
- if ((m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) && (m_nCurrExLayer == 21)) {
- m_nCurrExLayer = 9;
+ if ((m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) && (m_nCurrExLayer == HOVEROPTION_USESKIN)) {
+ m_nCurrExLayer = HOVEROPTION_BACK;
}
}
@@ -2287,7 +3582,7 @@ CMenuManager::ProcessButtonPresses(void)
// Up
if (pressed) {
- m_nCurrExLayer = 19;
+ m_nCurrExLayer = HOVEROPTION_LIST;
if (!m_bPressedUpOnList) {
m_bPressedUpOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
@@ -2309,7 +3604,7 @@ CMenuManager::ProcessButtonPresses(void)
// Down
if (pressed) {
- m_nCurrExLayer = 19;
+ m_nCurrExLayer = HOVEROPTION_LIST;
if (!m_bPressedDownOnList) {
m_bPressedDownOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
@@ -2324,7 +3619,7 @@ CMenuManager::ProcessButtonPresses(void)
if (!CPad::GetPad(0)->GetPageUp()) {
m_bPressedPgUpOnList = false;
} else {
- m_nCurrExLayer = 19;
+ m_nCurrExLayer = HOVEROPTION_LIST;
if (!m_bPressedPgUpOnList) {
m_bPressedPgUpOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
@@ -2336,7 +3631,7 @@ CMenuManager::ProcessButtonPresses(void)
if (!CPad::GetPad(0)->GetPageDown()) {
m_bPressedPgDnOnList = false;
} else {
- m_nCurrExLayer = 19;
+ m_nCurrExLayer = HOVEROPTION_LIST;
if (!m_bPressedPgDnOnList) {
m_bPressedPgDnOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
@@ -2346,29 +3641,29 @@ CMenuManager::ProcessButtonPresses(void)
}
}
if (CPad::GetPad(0)->GetHome()) {
- m_nCurrExLayer = 19;
+ m_nCurrExLayer = HOVEROPTION_LIST;
m_bShowMouse = false;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) {
m_nFirstVisibleRowOnList = 0;
}
m_nSelectedListRow = 0;
- m_nCurListItemY = (LIST_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
+ m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
}
if (CPad::GetPad(0)->GetEnd()) {
- m_nCurrExLayer = 19;
+ m_nCurrExLayer = HOVEROPTION_LIST;
m_bShowMouse = false;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) {
m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW;
}
m_nSelectedListRow = m_nTotalListRow - 1;
- m_nCurListItemY = (LIST_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
+ m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
}
}
#ifndef TIDY_UP_PBP
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustDown()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustDown()) {
m_bShowMouse = false;
goBack = true;
}
@@ -2385,10 +3680,10 @@ CMenuManager::ProcessButtonPresses(void)
case HOVEROPTION_PAGEDOWN:
PageDownList(true);
break;
- case HOVEROPTION_CHANGESKIN:
+ case HOVEROPTION_USESKIN:
if (m_nSkinsTotal > 0) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- m_pSelectedSkin = m_sSkin.field_304;
+ m_pSelectedSkin = m_pSkinListHead.nextSkin;
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
SaveSettings();
@@ -2404,8 +3699,8 @@ CMenuManager::ProcessButtonPresses(void)
case HOVEROPTION_OVER_SCROLL_DOWN:
m_nHoverOption = HOVEROPTION_CLICKED_SCROLL_DOWN;
break;
- case HOVEROPTION_19:
- m_nHoverOption = HOVEROPTION_20;
+ case HOVEROPTION_LIST:
+ m_nHoverOption = HOVEROPTION_SKIN;
}
} else if ((CPad::GetPad(0)->GetLeftMouseJustUp())
&& ((m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_UP || (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_DOWN)))) {
@@ -2418,7 +3713,7 @@ CMenuManager::ProcessButtonPresses(void)
if ((m_nHoverOption == HOVEROPTION_HOLDING_SCROLLBAR) || holdingScrollBar) {
holdingScrollBar = true;
// TODO: This part is a bit hard to reverse. Not much code tho
- assert(0 && "Not done yet");
+ assert(0 && "Holding scrollbar isn't done yet");
} else {
switch (m_nHoverOption) {
case HOVEROPTION_OVER_SCROLL_UP:
@@ -2447,7 +3742,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) {
optionSelected = true;
}
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustUp()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
if (m_nCurrScreen != MENUPAGE_START_MENU) {
goBack = true;
}
@@ -2492,10 +3787,10 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef TIDY_UP_PBP
if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0;
+ m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
} else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) {
@@ -2506,82 +3801,82 @@ CMenuManager::ProcessButtonPresses(void)
switch (m_nHoverOption) {
case HOVEROPTION_RADIO_0:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
+ m_PrefsRadioStation = HEAD_RADIO;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_1:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = DOUBLE_CLEF;
+ m_PrefsRadioStation = DOUBLE_CLEF;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_2:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = JAH_RADIO;
+ m_PrefsRadioStation = JAH_RADIO;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_3:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = RISE_FM;
+ m_PrefsRadioStation = RISE_FM;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_4:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = LIPS_106;
+ m_PrefsRadioStation = LIPS_106;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_5:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = GAME_FM;
+ m_PrefsRadioStation = GAME_FM;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_6:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = MSX_FM;
+ m_PrefsRadioStation = MSX_FM;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_7:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = FLASHBACK;
+ m_PrefsRadioStation = FLASHBACK;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_8:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = CHATTERBOX;
+ m_PrefsRadioStation = CHATTERBOX;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_9:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = USERTRACK;
+ m_PrefsRadioStation = USERTRACK;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RANDOM_ITEM:
@@ -2598,74 +3893,74 @@ CMenuManager::ProcessButtonPresses(void)
#ifndef TIDY_UP_PBP
switch (m_nHoverOption) {
case HOVEROPTION_INCREASE_BRIGHTNESS:
- CMenuManager::m_PrefsBrightness = CMenuManager::m_PrefsBrightness + 32;
- if (CMenuManager::m_PrefsBrightness < 0) {
- CMenuManager::m_PrefsBrightness = 0;
+ m_PrefsBrightness = m_PrefsBrightness + 32;
+ if (m_PrefsBrightness < 0) {
+ m_PrefsBrightness = 0;
}
- if (510 < CMenuManager::m_PrefsBrightness) {
- CMenuManager::m_PrefsBrightness = 511;
+ if (510 < m_PrefsBrightness) {
+ m_PrefsBrightness = 511;
}
SaveSettings();
break;
case HOVEROPTION_DECREASE_BRIGHTNESS:
- CMenuManager::m_PrefsBrightness = CMenuManager::m_PrefsBrightness - 32;
- if (CMenuManager::m_PrefsBrightness < 0) {
- CMenuManager::m_PrefsBrightness = 0;
+ m_PrefsBrightness = m_PrefsBrightness - 32;
+ if (m_PrefsBrightness < 0) {
+ m_PrefsBrightness = 0;
}
- if (510 < CMenuManager::m_PrefsBrightness) {
- CMenuManager::m_PrefsBrightness = 511;
+ if (510 < m_PrefsBrightness) {
+ m_PrefsBrightness = 511;
}
SaveSettings();
break;
case HOVEROPTION_INCREASE_DRAWDIST:
- CMenuManager::m_PrefsLOD = CMenuManager::m_PrefsLOD + (1.0f / 16);
+ m_PrefsLOD = m_PrefsLOD + (1.0f / 16);
m_PrefsLOD = min(1.8f, m_PrefsLOD);
- CRenderer::ms_lodDistScale = CMenuManager::m_PrefsLOD;
+ CRenderer::ms_lodDistScale = m_PrefsLOD;
SaveSettings();
break;
case HOVEROPTION_DECREASE_DRAWDIST:
- CMenuManager::m_PrefsLOD = CMenuManager::m_PrefsLOD - (1.0f / 16);
+ m_PrefsLOD = m_PrefsLOD - (1.0f / 16);
m_PrefsLOD = max(0.8f, m_PrefsLOD);
- CRenderer::ms_lodDistScale = CMenuManager::m_PrefsLOD;
+ CRenderer::ms_lodDistScale = m_PrefsLOD;
SaveSettings();
break;
case HOVEROPTION_INCREASE_MUSICVOLUME:
- CMenuManager::m_PrefsMusicVolume = CMenuManager::m_PrefsMusicVolume + 8;
+ m_PrefsMusicVolume = m_PrefsMusicVolume + 8;
m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127);
- DMAudio.SetMusicMasterVolume(uchar)(CMenuManager::m_PrefsMusicVolume);
+ DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume);
SaveSettings();
break;
case HOVEROPTION_DECREASE_MUSICVOLUME:
- CMenuManager::m_PrefsMusicVolume = CMenuManager::m_PrefsMusicVolume - 8;
- if (CMenuManager::m_PrefsMusicVolume < 0) {
- CMenuManager::m_PrefsMusicVolume = 0;
+ m_PrefsMusicVolume = m_PrefsMusicVolume - 8;
+ if (m_PrefsMusicVolume < 0) {
+ m_PrefsMusicVolume = 0;
}
- if (126 < CMenuManager::m_PrefsMusicVolume) {
- CMenuManager::m_PrefsMusicVolume = 127;
+ if (126 < m_PrefsMusicVolume) {
+ m_PrefsMusicVolume = 127;
}
- DMAudio.SetMusicMasterVolume(uchar)(CMenuManager::m_PrefsMusicVolume);
+ DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume);
SaveSettings();
break;
case HOVEROPTION_INCREASE_SFXVOLUME:
- CMenuManager::m_PrefsSFXVolume = CMenuManager::m_PrefsSFXVolume + 8;
- if (CMenuManager::m_PrefsSFXVolume < 0) {
- CMenuManager::m_PrefsSFXVolume = 0;
+ m_PrefsSFXVolume = m_PrefsSFXVolume + 8;
+ if (m_PrefsSFXVolume < 0) {
+ m_PrefsSFXVolume = 0;
}
- if (126 < CMenuManager::m_PrefsSFXVolume) {
- CMenuManager::m_PrefsSFXVolume = 127;
+ if (126 < m_PrefsSFXVolume) {
+ m_PrefsSFXVolume = 127;
}
- DMAudio.SetEffectsMasterVolume(uchar)(CMenuManager::m_PrefsSFXVolume);
+ DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume);
SaveSettings();
break;
case HOVEROPTION_DECREASE_SFXVOLUME:
- CMenuManager::m_PrefsSFXVolume = CMenuManager::m_PrefsSFXVolume - 8;
- if (CMenuManager::m_PrefsSFXVolume < 0) {
- CMenuManager::m_PrefsSFXVolume = 0;
+ m_PrefsSFXVolume = m_PrefsSFXVolume - 8;
+ if (m_PrefsSFXVolume < 0) {
+ m_PrefsSFXVolume = 0;
}
- if (126 < CMenuManager::m_PrefsSFXVolume) {
- CMenuManager::m_PrefsSFXVolume = 127;
+ if (126 < m_PrefsSFXVolume) {
+ m_PrefsSFXVolume = 127;
}
- DMAudio.SetEffectsMasterVolume(uchar)(CMenuManager::m_PrefsSFXVolume);
+ DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume);
SaveSettings();
break;
case HOVEROPTION_INCREASE_MOUSESENS:
@@ -2715,7 +4010,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#ifndef TIDY_UP_PBP
- if (CPad::GetPad(0)->GetSquareJustDown()) {
+ if (CPad::GetPad(0)->GetBackJustDown()) {
if (m_nCurrScreen != MENUPAGE_START_MENU && m_nCurrScreen != MENUPAGE_PAUSE_MENU) {
m_bShowMouse = false;
goBack = true;
@@ -2756,11 +4051,11 @@ CMenuManager::ProcessButtonPresses(void)
if (!goDown && !goUp && !optionSelected) {
if (m_nCurrScreen != MENUPAGE_START_MENU) {
if (isPlainTextScreen(m_nCurrScreen)) {
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustUp()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
goBack = true;
}
} else {
- if (CPad::GetPad(0)->GetEscapeJustDown() || (m_nCurrScreen != MENUPAGE_PAUSE_MENU && CPad::GetPad(0)->GetSquareJustDown())) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || (m_nCurrScreen != MENUPAGE_PAUSE_MENU && CPad::GetPad(0)->GetBackJustDown())) {
m_bShowMouse = false;
goBack = true;
}
@@ -2869,7 +4164,7 @@ CMenuManager::ProcessButtonPresses(void)
default:
goBack = true;
break;
- case 19:
+ case HOVEROPTION_LIST:
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
m_bWaitingForNewKeyBind = true;
m_bStartWaitingForKeyBind = true;
@@ -2878,16 +4173,16 @@ CMenuManager::ProcessButtonPresses(void)
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
- m_nCurrExLayer = 9;
- CMenuManager::SaveSettings();
+ m_nCurrExLayer = HOVEROPTION_BACK;
+ SaveSettings();
}
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
break;
- case 21:
+ case HOVEROPTION_USESKIN:
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
- m_nCurrExLayer = 9;
+ m_nCurrExLayer = HOVEROPTION_BACK;
SaveSettings();
break;
}
@@ -2898,7 +4193,7 @@ CMenuManager::ProcessButtonPresses(void)
*/
} else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
if (m_nSkinsTotal > 0) {
- m_pSelectedSkin = (tSkinInfo*)(m_sSkin).field_304;
+ m_pSelectedSkin = m_pSkinListHead.nextSkin;
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
SaveSettings();
@@ -2915,47 +4210,47 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef TIDY_UP_PBP
assumeIncrease = true;
#else
- ++CMenuManager::m_PrefsRadioStation;
- if (cDMAudio::IsMP3RadioChannelAvailable()) {
- if (CMenuManager::m_PrefsRadioStation > USERTRACK)
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
- } else if (CMenuManager::m_PrefsRadioStation > CHATTERBOX) {
- CMenuManager::m_PrefsRadioStation = USERTRACK;
+ ++m_PrefsRadioStation;
+ if (DMAudio.IsMP3RadioChannelAvailable()) {
+ if (m_PrefsRadioStation > USERTRACK)
+ m_PrefsRadioStation = HEAD_RADIO;
+ } else if (m_PrefsRadioStation > CHATTERBOX) {
+ m_PrefsRadioStation = USERTRACK;
}
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
#endif
break;
case MENUACTION_LANG_ENG:
m_PrefsLanguage = LANGUAGE_AMERICAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- CMenuManager::SaveSettings();
+ InitialiseChangedLanguageSettings();
+ SaveSettings();
break;
case MENUACTION_LANG_FRE:
m_PrefsLanguage = LANGUAGE_FRENCH;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- CMenuManager::SaveSettings();
+ InitialiseChangedLanguageSettings();
+ SaveSettings();
break;
case MENUACTION_LANG_GER:
m_PrefsLanguage = LANGUAGE_GERMAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- CMenuManager::SaveSettings();
+ InitialiseChangedLanguageSettings();
+ SaveSettings();
break;
case MENUACTION_LANG_ITA:
m_PrefsLanguage = LANGUAGE_ITALIAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- CMenuManager::SaveSettings();
+ InitialiseChangedLanguageSettings();
+ SaveSettings();
break;
case MENUACTION_LANG_SPA:
m_PrefsLanguage = LANGUAGE_SPANISH;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
+ InitialiseChangedLanguageSettings();
SaveSettings();
break;
#ifdef MORE_LANGUAGES
@@ -2968,7 +4263,7 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_LANG_JAP:
m_PrefsLanguage = LANGUAGE_JAPANESE;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
+ InitialiseChangedLanguageSettings();
SaveSettings();
break;
#endif
@@ -3000,7 +4295,7 @@ CMenuManager::ProcessButtonPresses(void)
if (changeMenu) {
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) {
#ifndef TIDY_UP_PBP
- CMenuManager::ResetHelperText();
+ ResetHelperText();
if (!m_bGameNotLoaded)
ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
else
@@ -3010,6 +4305,12 @@ CMenuManager::ProcessButtonPresses(void)
break;
#endif
} else {
+#ifdef MENU_MAP
+ if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu == MENUPAGE_MAP) {
+ bMapLoaded = false;
+ }
+
+#endif
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
}
}
@@ -3028,11 +4329,10 @@ CMenuManager::ProcessButtonPresses(void)
break;
}
case MENUACTION_NEWGAME:
- CMenuManager::DoSettingsBeforeStartingAGame();
+ DoSettingsBeforeStartingAGame();
break;
case MENUACTION_RELOADIDE:
- // TODO
- // CFileLoader::ReloadObjectTypes("GTA3.IDE");
+ CFileLoader::ReloadObjectTypes("GTA3.IDE");
break;
case MENUACTION_RELOADIPL:
CGame::ReloadIPLs();
@@ -3043,7 +4343,7 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_MEMCARDSAVECONFIRM:
return;
case MENUACTION_RESUME_FROM_SAVEZONE:
- CMenuManager::RequestFrontEndShutDown();
+ RequestFrontEndShutDown();
break;
case MENUACTION_MPMAP_LIBERTY:
case MENUACTION_MPMAP_REDLIGHT:
@@ -3053,8 +4353,8 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_MPMAP_INDUSTPARK:
case MENUACTION_MPMAP_DOCKS:
case MENUACTION_MPMAP_STAUNTON:
- sthWithButtons = option - MENUACTION_MPMAP_LIBERTY;
- CMenuManager::SaveSettings();
+ m_SelectedMap = option - MENUACTION_MPMAP_LIBERTY;
+ SaveSettings();
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
break;
case MENUACTION_MPMAP_DEATHMATCH1:
@@ -3065,14 +4365,14 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_MPMAP_CAPTURE:
case MENUACTION_MPMAP_RATRACE:
case MENUACTION_MPMAP_DOMINATION:
- sthWithButtons2 = option - MENUACTION_MPMAP_DEATHMATCH1;
- CMenuManager::SaveSettings();
+ m_SelectedGameType = option - MENUACTION_MPMAP_DEATHMATCH1;
+ SaveSettings();
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
break;
case MENUACTION_REDEFCTRL:
ChangeScreen(MENUPAGE_KEYBOARD_CONTROLS, 0, true, true);
m_nSelectedListRow = 0;
- m_nCurrExLayer = 19;
+ m_nCurrExLayer = HOVEROPTION_LIST;
break;
case MENUACTION_GETKEY:
m_CurrCntrlAction = GetStartOptionsCntrlConfigScreens() + m_nCurrOption;
@@ -3087,10 +4387,10 @@ CMenuManager::ProcessButtonPresses(void)
break;
case MENUACTION_RESUME:
#ifndef TIDY_UP_PBP
- if (CMenuManager::m_PrefsVsyncDisp != CMenuManager::m_PrefsVsync) {
- CMenuManager::m_PrefsVsync = CMenuManager::m_PrefsVsyncDisp;
+ if (m_PrefsVsyncDisp != m_PrefsVsync) {
+ m_PrefsVsync = m_PrefsVsyncDisp;
}
- CMenuManager::RequestFrontEndShutDown();
+ RequestFrontEndShutDown();
#else
goBack = true;
#endif
@@ -3137,31 +4437,30 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_PLAYERSETUP:
CPlayerSkin::BeginFrontendSkinEdit();
ChangeScreen(MENUPAGE_SKIN_SELECT, 0, true, true);
- m_nCurrExLayer = 19;
- m_bSkinsFound = 0;
+ m_nCurrExLayer = HOVEROPTION_LIST;
+ m_bSkinsEnumerated = false;
break;
case MENUACTION_RESTOREDEF:
if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
- CMenuManager::m_PrefsSfxVolume = 102;
+ m_PrefsSfxVolume = 102;
m_PrefsSpeakers = 0;
- CMenuManager::m_PrefsMusicVolume = 102;
- // unused
- // byte_95CDB5 = 0;
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
+ m_PrefsMusicVolume = 102;
+ m_PrefsStereoMono = 0;
+ m_PrefsRadioStation = HEAD_RADIO;
DMAudio.SetMusicMasterVolume(102);
- DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume);
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
SaveSettings();
} else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) {
- CMenuManager::m_PrefsFrameLimiter = true;
- CMenuManager::m_PrefsBrightness = 256;
- CMenuManager::m_PrefsVsyncDisp = true;
- CMenuManager::m_PrefsLOD = 1.2f;
- CMenuManager::m_PrefsVsync = true;
+ m_PrefsFrameLimiter = true;
+ m_PrefsBrightness = 256;
+ m_PrefsVsyncDisp = true;
+ m_PrefsLOD = 1.2f;
+ m_PrefsVsync = true;
CRenderer::ms_lodDistScale = 1.2f;
- CMenuManager::m_PrefsUseWideScreen = false;
- CMenuManager::m_PrefsShowSubtitles = true;
+ m_PrefsUseWideScreen = false;
+ m_PrefsShowSubtitles = true;
m_nDisplayVideoMode = m_nPrefsVideoMode;
CMBlur::BlurOn = true;
SaveSettings();
@@ -3175,23 +4474,23 @@ CMenuManager::ProcessButtonPresses(void)
PSGLOBAL(joy1)->GetCapabilities(&devCaps);
ControlsManager.InitDefaultControlConfigJoyPad(devCaps.dwButtons);
}
- CMenuManager::m_ControlMethod = CONTROL_STANDARD;
+ m_ControlMethod = CONTROL_STANDARD;
MousePointerStateHelper.bInvertVertically = false;
TheCamera.m_fMouseAccelHorzntl = 0.0025f;
CVehicle::m_bDisableMouseSteering = true;
TheCamera.m_bHeadBob = false;
SaveSettings();
}
- CMenuManager::SetHelperText(2);
+ SetHelperText(2);
break;
case MENUACTION_CTRLMETHOD:
#ifndef TIDY_UP_PBP
- if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC) {
+ if (m_ControlMethod == CONTROL_CLASSIC) {
CCamera::m_bUseMouse3rdPerson = true;
- CMenuManager::m_ControlMethod = CONTROL_STANDARD;
+ m_ControlMethod = CONTROL_STANDARD;
} else {
CCamera::m_bUseMouse3rdPerson = false;
- CMenuManager::m_ControlMethod = CONTROL_CLASSIC;
+ m_ControlMethod = CONTROL_CLASSIC;
}
SaveSettings();
#else
@@ -3200,7 +4499,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
case MENUACTION_LOADRADIO:
ChangeScreen(MENUPAGE_SOUND_SETTINGS, 0, true, true);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK");
break;
}
@@ -3209,7 +4508,7 @@ CMenuManager::ProcessButtonPresses(void)
}
if (goBack) {
- CMenuManager::ResetHelperText();
+ ResetHelperText();
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0);
#ifdef PS2_LIKE_MENU
if (m_nCurrScreen == MENUPAGE_PAUSE_MENU || bottomBarActive) {
@@ -3217,10 +4516,10 @@ CMenuManager::ProcessButtonPresses(void)
if (m_nCurrScreen == MENUPAGE_PAUSE_MENU) {
#endif
if (!m_bGameNotLoaded && !m_bMenuStateChanged) {
- if (CMenuManager::m_PrefsVsyncDisp != CMenuManager::m_PrefsVsync) {
- CMenuManager::m_PrefsVsync = CMenuManager::m_PrefsVsyncDisp;
+ if (m_PrefsVsyncDisp != m_PrefsVsync) {
+ m_PrefsVsync = m_PrefsVsyncDisp;
}
- CMenuManager::RequestFrontEndShutDown();
+ RequestFrontEndShutDown();
}
// We're already resuming, we don't need further processing.
@@ -3233,7 +4532,7 @@ CMenuManager::ProcessButtonPresses(void)
#else
else if (m_nCurrScreen == MENUPAGE_CHOOSE_SAVE_SLOT) {
#endif
- CMenuManager::RequestFrontEndShutDown();
+ RequestFrontEndShutDown();
}
// It's now in ThingsToDoBeforeLeavingPage()
#ifndef TIDY_UP_PBP
@@ -3281,13 +4580,13 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetPedWalkLeftRight() < 0 || CPad::GetPad(0)->GetDPadLeft()) {
static uint32 lastSliderDecrease = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderDecrease > 150) {
- CMenuManager::CheckSliderMovement(-1);
+ CheckSliderMovement(-1);
lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode();
}
} else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetPedWalkLeftRight() > 0 || CPad::GetPad(0)->GetDPadRight()) {
static uint32 lastSliderIncrease = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderIncrease > 150) {
- CMenuManager::CheckSliderMovement(1);
+ CheckSliderMovement(1);
lastSliderIncrease = CTimer::GetTimeInMillisecondsPauseMode();
}
}
@@ -3297,7 +4596,7 @@ CMenuManager::ProcessButtonPresses(void)
increase = true;
} else if (CPad::GetPad(0)->GetMouseWheelUpJustDown() && m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) {
increase = true;
- CMenuManager::CheckSliderMovement(1);
+ CheckSliderMovement(1);
m_bShowMouse = true;
}
@@ -3305,7 +4604,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) {
if (m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) {
decrease = true;
- CMenuManager::CheckSliderMovement(-1);
+ CheckSliderMovement(-1);
m_bShowMouse = true;
}
}
@@ -3322,22 +4621,22 @@ CMenuManager::ProcessButtonPresses(void)
if (changeValueBy != 0) {
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_RADIO:
- CMenuManager::m_PrefsRadioStation += changeValueBy;
+ m_PrefsRadioStation += changeValueBy;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
if (DMAudio.IsMP3RadioChannelAvailable()) {
- if (CMenuManager::m_PrefsRadioStation < HEAD_RADIO)
- CMenuManager::m_PrefsRadioStation = USERTRACK;
- if (CMenuManager::m_PrefsRadioStation > USERTRACK)
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
+ if (m_PrefsRadioStation < HEAD_RADIO)
+ m_PrefsRadioStation = USERTRACK;
+ if (m_PrefsRadioStation > USERTRACK)
+ m_PrefsRadioStation = HEAD_RADIO;
} else {
- if (CMenuManager::m_PrefsRadioStation < HEAD_RADIO)
- CMenuManager::m_PrefsRadioStation = CHATTERBOX;
- if (CMenuManager::m_PrefsRadioStation > CHATTERBOX)
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
+ if (m_PrefsRadioStation < HEAD_RADIO)
+ m_PrefsRadioStation = CHATTERBOX;
+ if (m_PrefsRadioStation > CHATTERBOX)
+ m_PrefsRadioStation = HEAD_RADIO;
}
- CMenuManager::SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ SaveSettings();
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case MENUACTION_SCREENRES:
@@ -3373,34 +4672,31 @@ CMenuManager::ProcessButtonPresses(void)
m_PrefsSpeakers -= changeValueBy;
m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2);
DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
- CMenuManager::SaveSettings();
+ SaveSettings();
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
}
break;
case MENUACTION_CTRLMETHOD:
- CMenuManager::m_ControlMethod = !m_ControlMethod;
+ m_ControlMethod = !m_ControlMethod;
CCamera::m_bUseMouse3rdPerson = !m_ControlMethod;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::SaveSettings();
+ SaveSettings();
break;
}
ProcessOnOffMenuOptions();
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
if (changeValueBy < 1) {
- field_530 = 0;
+ m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN;
} else {
- field_530 = 14;
+ m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
}
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
}
}
}
-#endif
-#if 0
-WRAPPER void CMenuManager::ProcessOnOffMenuOptions() { EAXJMP(0x48AE60); }
-#else
-void CMenuManager::ProcessOnOffMenuOptions()
+void
+CMenuManager::ProcessOnOffMenuOptions()
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_CTRLVIBRATION:
@@ -3478,7 +4774,9 @@ void CMenuManager::ProcessOnOffMenuOptions()
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
break;
case MENUACTION_MP_PLAYERCOLOR:
- assert(0 && "Not implemented");
+ PickNewPlayerColour();
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ SaveSettings();
break;
case MENUACTION_SHOWHEADBOB:
TheCamera.m_bHeadBob = !TheCamera.m_bHeadBob;
@@ -3503,34 +4801,29 @@ void CMenuManager::ProcessOnOffMenuOptions()
break;
}
}
-#endif
-void CMenuManager::RequestFrontEndShutDown()
+void
+CMenuManager::RequestFrontEndShutDown()
{
m_bShutDownFrontEndRequested = true;
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
}
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::RequestFrontEndStartUp() { EAXJMP(0x488770); }
-#else
-void CMenuManager::RequestFrontEndStartUp()
+void
+CMenuManager::RequestFrontEndStartUp()
{
m_bStartUpFrontEndRequested = true;
}
-#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::ResetHelperText() { EAXJMP(0x48B470); }
-#else
-void CMenuManager::ResetHelperText()
+void
+CMenuManager::ResetHelperText()
{
m_nHelperTextMsgId = 0;
m_nHelperTextAlpha = 300;
}
-#endif
-void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
+void
+CMenuManager::SaveLoadFileError_SetUpErrorScreen()
{
switch (PcSaveHelper.nErrorCode) {
case SAVESTATUS_ERR_SAVE_CREATE:
@@ -3554,27 +4847,22 @@ void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
}
}
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::SetHelperText(int text) { EAXJMP(0x48B450); }
-#else
-void CMenuManager::SetHelperText(int text)
+void
+CMenuManager::SetHelperText(int text)
{
m_nHelperTextMsgId = text;
m_nHelperTextAlpha = 300;
}
-#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::ShutdownJustMenu() { EAXJMP(0x488920); }
-#else
-void CMenuManager::ShutdownJustMenu()
+void
+CMenuManager::ShutdownJustMenu()
{
m_bMenuActive = false;
CTimer::EndUserPause();
}
-#endif
-float CMenuManager::StretchX(float x)
+float
+CMenuManager::StretchX(float x)
{
if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH)
return x;
@@ -3592,12 +4880,10 @@ float CMenuManager::StretchY(float y)
return SCREEN_STRETCH_Y(y);
}
-#if 0
-WRAPPER void CMenuManager::SwitchMenuOnAndOff() { EAXJMP(0x488790); }
-#else
-void CMenuManager::SwitchMenuOnAndOff()
+void
+CMenuManager::SwitchMenuOnAndOff()
{
- bool menuWasActive = !!m_bMenuActive;
+ bool menuWasActive = GetIsMenuActive();
// Reminder: You need REGISTER_START_BUTTON defined to make it work.
if (CPad::GetPad(0)->GetStartJustDown()
@@ -3627,9 +4913,20 @@ void CMenuManager::SwitchMenuOnAndOff()
m_bStartUpFrontEndRequested = false;
pControlEdit = nil;
m_bShutDownFrontEndRequested = false;
- DisplayComboButtonErrMsg = 0;
- CPad::GetPad(0)->Clear(0);
- CPad::GetPad(1)->Clear(0);
+ DisplayComboButtonErrMsg = false;
+
+#ifdef REGISTER_START_BUTTON
+ int16 start1 = CPad::GetPad(0)->PCTempJoyState.Start, start2 = CPad::GetPad(0)->PCTempKeyState.Start,
+ start3 = CPad::GetPad(0)->OldState.Start, start4 = CPad::GetPad(0)->NewState.Start;
+#endif
+ CPad::GetPad(0)->Clear(false);
+ CPad::GetPad(1)->Clear(false);
+#ifdef REGISTER_START_BUTTON
+ CPad::GetPad(0)->PCTempJoyState.Start = start1;
+ CPad::GetPad(0)->PCTempKeyState.Start = start2;
+ CPad::GetPad(0)->OldState.Start = start3;
+ CPad::GetPad(0)->NewState.Start = start4;
+#endif
m_nCurrScreen = MENUPAGE_NONE;
}
}
@@ -3662,12 +4959,9 @@ void CMenuManager::SwitchMenuOnAndOff()
m_bStartUpFrontEndRequested = false;
m_bShutDownFrontEndRequested = false;
}
-#endif
-#if 0
-WRAPPER void CMenuManager::UnloadTextures() { EAXJMP(0x47A440); }
-#else
-void CMenuManager::UnloadTextures()
+void
+CMenuManager::UnloadTextures()
{
if (!m_bSpritesLoaded)
return;
@@ -3682,33 +4976,645 @@ void CMenuManager::UnloadTextures()
printf("REMOVE menu textures\n");
for (int i = 0; i < ARRAY_SIZE(MenuFilenames); ++i)
m_aMenuSprites[i].Delete();
-
+#ifdef MENU_MAP
+ for (int i = 0; i < ARRAY_SIZE(MapFilenames); ++i)
+ m_aMapSprites[i].Delete();
+#endif
int menu = CTxdStore::FindTxdSlot("menu");
CTxdStore::RemoveTxd(menu);
m_bSpritesLoaded = false;
}
+
+void
+CMenuManager::WaitForUserCD()
+{
+ CSprite2d *splash;
+ char *splashscreen = nil;
+
+#ifndef RANDOMSPLASH
+ if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
+ splashscreen = "mainsc2";
+ else
+ splashscreen = "mainsc1";
#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); }
-#else
-void CMenuManager::WaitForUserCD()
+ splash = LoadSplash(splashscreen);
+
+ if (RsGlobal.quit)
+ return;
+
+ HandleExit();
+ CPad::UpdatePads();
+ MessageScreen("NO_PCCD");
+
+ if (CPad::GetPad(0)->GetEscapeJustDown()) {
+ m_bQuitGameNoCD = true;
+ RsEventHandler(rsQUITAPP, nil);
+ }
+}
+
+void
+CMenuManager::PrintController(void)
{
- LoadSplash(0);
- if (!RsGlobal.quit) {
- HandleExit();
- CPad::UpdatePads();
- MessageScreen("NO_PCCD");
+ // FIX: Originally this function doesn't have StretchX/Y, everything had constant pixel size (due to screen was abandoned early?)
+ // Also texts and their alignment were very bad, so I tried to make them readable (commented out the original code, and marked the ones I added with X)
+
+ m_aFrontEndSprites[FE_CONTROLLERSH].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(240.0f), MENU_Y(180.0f), CRGBA(0, 0, 0, 255));
+ m_aFrontEndSprites[FE_CONTROLLER].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(235.2f), MENU_Y(175.2f), CRGBA(255, 255, 255, 255));
+ if (m_DisplayControllerOnFoot) {
+ if (CTimer::GetTimeInMillisecondsPauseMode() & 0x400)
+ m_aFrontEndSprites[FE_ARROWS1].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(235.2f), MENU_Y(175.2f), CRGBA(255, 255, 255, 255));
+ else
+ m_aFrontEndSprites[FE_ARROWS3].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(235.2f), MENU_Y(175.2f), CRGBA(255, 255, 255, 255));
+ } else {
+ if (CTimer::GetTimeInMillisecondsPauseMode() & 0x400)
+ m_aFrontEndSprites[FE_ARROWS2].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(235.2f), MENU_Y(175.2f), CRGBA(255, 255, 255, 255));
+ else
+ m_aFrontEndSprites[FE_ARROWS4].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(235.2f), MENU_Y(175.2f), CRGBA(255, 255, 255, 255));
+ }
- if (GetPadBack()) {
- m_bQuitGameNoCD = true;
- RsEventHandler(rsQUITAPP, 0);
+ CFont::SetFontStyle(FONT_BANK); // X
+
+ // CFont::SetScale(0.4f, 0.4f);
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); // X
+
+ // CFont::SetColor(CRGBA(128, 128, 128, FadeIn(255)));
+ CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); // X
+ CFont::SetDropShadowPosition(1); // X
+ CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255))); // X
+
+ if (m_DisplayControllerOnFoot) {
+ switch (CPad::GetPad(0)->Mode) {
+ case 0:
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_LOF"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_MOV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_CAM"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_ENV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_ATT"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_RUN"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
+ break;
+ case 1:
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_LOF"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_CAM"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_NA"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_ENV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_ATT"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_RUN"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
+ break;
+ case 2:
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_ENV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_MOV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_CAM"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_LOF"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_RUN"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_ATT"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
+ break;
+ case 3:
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_NA"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_CAM"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_LOF"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_RUN"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_ATT"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
+ break;
+ default:
+ return;
+ }
+ } else {
+ switch (CPad::GetPad(0)->Mode) {
+ case 0:
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_LL"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_RSC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_VES"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_VES"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_HO3"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_CAM"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_PAU"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_LB"));
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_LR"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_HAB"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_BRA"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_EXV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_CAW"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_ACC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_TUC"));
+ // FIX: Coordinates of this line is undefined in PC...
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(304.0f), TheText.Get("FEC_SM3"));
+ break;
+ case 1:
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_LL"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_HOR"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_CAM"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_VES"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_NA"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_RSC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_PAU"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_LB"));
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_LR"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_HAB"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_BRA"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_EXV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_CAW"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_ACC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_TUC"));
+ // FIX: Coordinates of this line is undefined in PC...
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(304.0f), TheText.Get("FEC_SM3"));
+ break;
+ case 2:
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_LL"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_EXV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_VES"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_VES"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_RS3"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_CAM"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_PAU"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_LB"));
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_LR"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_HOR"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_BRA"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_HAB"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_CAW"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_ACC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_TUC"));
+ // FIX: Coordinates of this line is undefined in PC...
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(304.0f), TheText.Get("FEC_SM3"));
+ break;
+ case 3:
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_LL"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_HAB"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_TUC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_VES"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_HO3"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_CAM"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_PAU"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_LB"));
+ CFont::SetRightJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_LR"));
+ CFont::SetJustifyOn(); // X
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_CAW"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_SMT"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_EXV"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_RSC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_NA"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_ACC"));
+ // FIX: Coordinates of this line is undefined in PC...
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(304.0f), TheText.Get("FEC_BRA"));
+ break;
+ default:
+ return;
}
}
+
+ CFont::SetDropShadowPosition(0); // X
}
+
+#ifdef MENU_MAP
+
+#define ZOOM(x, y, in) \
+ do { \
+ if(fMapSize > SCREEN_WIDTH * 2 && in) \
+ break; \
+ float z2 = in? 1.1f : 1.f/1.1f; \
+ fMapCenterX += (x - fMapCenterX) * (1.0f - z2); \
+ fMapCenterY += (y - fMapCenterY) * (1.0f - z2); \
+ \
+ if (fMapSize < SCREEN_WIDTH / 3 && !in) \
+ break; \
+ \
+ fMapSize *= z2; \
+ } while(0) \
+
+void
+CMenuManager::PrintMap(void)
+{
+ bMenuMapActive = true;
+ CRadar::InitFrontEndMap();
+
+ if (!bMapLoaded) {
+ fMapCenterX = SCREEN_WIDTH / 2;
+ fMapCenterY = SCREEN_HEIGHT / 3;
+ fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio();
+ bMapMouseShownOnce = false;
+ bMapLoaded = true;
+
+ // Let's wait for a frame to not toggle the waypoint
+ if (CPad::GetPad(0)->NewState.Cross) {
+ bMenuMapActive = false;
+ return;
+ }
+ }
+
+ // Because fMapSize is half of the map length, and map consists of 3x3 tiles.
+ float halfTile = fMapSize / 3.0f;
+
+ // Darken background a bit
+ CSprite2d::DrawRect(CRect(0, 0,
+ SCREEN_WIDTH, SCREEN_HEIGHT),
+ CRGBA(0, 0, 0, FadeIn(128)));
+
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+
+ if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
+ m_aMapSprites[MAPTOP1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY - fMapSize,
+ fMapCenterX - halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
+ m_aMapSprites[MAPTOP2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY - fMapSize,
+ fMapCenterX + halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
+ m_aMapSprites[MAPTOP3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - fMapSize,
+ fMapCenterX + fMapSize, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPMID1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY - halfTile,
+ fMapCenterX - halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPMID2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY - halfTile,
+ fMapCenterX + halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPMID3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - halfTile,
+ fMapCenterX + fMapSize, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
+ m_aMapSprites[MAPBOT1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY + halfTile,
+ fMapCenterX - halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
+ m_aMapSprites[MAPBOT2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY + halfTile,
+ fMapCenterX + halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
+ m_aMapSprites[MAPBOT3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY + halfTile,
+ fMapCenterX + fMapSize, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ CRadar::DrawBlips();
+
+ CVector2D mapPoint;
+ mapPoint.x = m_nMousePosX;
+ mapPoint.y = m_nMousePosY;
+
+ if (m_bShowMouse) {
+ bMapMouseShownOnce = true;
+ } else if (!bMapMouseShownOnce) {
+ mapPoint.x = SCREEN_WIDTH / 2;
+ mapPoint.y = SCREEN_HEIGHT / 2;
+ }
+
+ CSprite2d::DrawRect(CRect(mapPoint.x - MENU_X(1.0f), 0.0f,
+ mapPoint.x + MENU_X(1.0f), SCREEN_HEIGHT),
+ CRGBA(0, 0, 0, 150));
+ CSprite2d::DrawRect(CRect(0.0f, mapPoint.y + MENU_X(1.0f),
+ SCREEN_WIDTH, mapPoint.y - MENU_X(1.0f)),
+ CRGBA(0, 0, 0, 150));
+
+ if (CPad::GetPad(0)->GetRightMouseJustDown() || CPad::GetPad(0)->GetCrossJustDown()) {
+ if (mapPoint.y > fMapCenterY - fMapSize && mapPoint.y < fMapCenterY + fMapSize &&
+ mapPoint.x > fMapCenterX - fMapSize && mapPoint.x < fMapCenterX + fMapSize) {
+
+ float diffX = fMapCenterX - fMapSize, diffY = fMapCenterY - fMapSize;
+ float x = ((mapPoint.x - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f;
+ float y = 2000.0f - ((mapPoint.y - diffY) / (fMapSize * 2)) * 4000.0f;
+ CRadar::ToggleTargetMarker(x, y);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ }
+ }
+
+ if (CPad::GetPad(0)->GetLeftMouse()) {
+ fMapCenterX += m_nMousePosX - m_nMouseOldPosX;
+ fMapCenterY += m_nMousePosY - m_nMouseOldPosY;
+ } else if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetDPadLeft()) {
+ fMapCenterX += 15.0f;
+ } else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetDPadRight()) {
+ fMapCenterX -= 15.0f;
+ } else if (CPad::GetPad(0)->GetLeftStickX()) {
+ fMapCenterX -= CPad::GetPad(0)->GetLeftStickX() / 128.0f * 20.0f;
+ }
+
+ if (CPad::GetPad(0)->GetUp() || CPad::GetPad(0)->GetDPadUp()) {
+ fMapCenterY += 15.0f;
+ } else if (CPad::GetPad(0)->GetDown() || CPad::GetPad(0)->GetDPadDown()) {
+ fMapCenterY -= 15.0f;
+ } else if (CPad::GetPad(0)->GetLeftStickY()) {
+ fMapCenterY -= CPad::GetPad(0)->GetLeftStickY() / 128.0f * 20.0f;
+ }
+
+ if (CPad::GetPad(0)->GetMouseWheelDown() || CPad::GetPad(0)->GetPageDown() || CPad::GetPad(0)->GetRightShoulder2()) {
+ if (CPad::GetPad(0)->GetMouseWheelDown())
+ ZOOM(mapPoint.x, mapPoint.y, false);
+ else
+ ZOOM(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, false);
+ } else if (CPad::GetPad(0)->GetMouseWheelUp() || CPad::GetPad(0)->GetPageUp() || CPad::GetPad(0)->GetRightShoulder1()) {
+ if (CPad::GetPad(0)->GetMouseWheelUp())
+ ZOOM(mapPoint.x, mapPoint.y, true);
+ else
+ ZOOM(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, true);
+ }
+
+ if (fMapCenterX - fMapSize > SCREEN_WIDTH / 2)
+ fMapCenterX = fMapSize + SCREEN_WIDTH / 2;
+
+ if (fMapCenterX + fMapSize < SCREEN_WIDTH / 2)
+ fMapCenterX = SCREEN_WIDTH / 2 - fMapSize;
+
+ if (fMapCenterY + fMapSize < SCREEN_HEIGHT - MENU_Y(60.0f))
+ fMapCenterY = SCREEN_HEIGHT - MENU_Y(60.0f) - fMapSize;
+
+ fMapCenterY = min(fMapCenterY, fMapSize); // To not show beyond north border
+
+ bMenuMapActive = false;
+
+ // CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(5.0f)); // From VC
+ // CFont::SetRightJustifyWrap(10.0f);
+
+ CSprite2d::DrawRect(CRect(MENU_X(14.0f), SCREEN_STRETCH_FROM_BOTTOM(95.0f),
+ SCREEN_STRETCH_FROM_RIGHT(11.0f), SCREEN_STRETCH_FROM_BOTTOM(59.0f)),
+ CRGBA(235, 170, 50, 255));
+
+ CFont::SetScale(MENU_X(0.4f), MENU_Y(0.7f));
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
+
+ float nextX = MENU_X(30.0f), nextY = 95.0f;
+ wchar *text;
+#define TEXT_PIECE(key,extraSpace) \
+ text = TheText.Get(key); CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), text); nextX += CFont::GetStringWidth(text, true) + MENU_X(extraSpace);
+
+ TEXT_PIECE("FEC_MWF", 3.0f);
+ TEXT_PIECE("FEC_PGU", 1.0f);
+ TEXT_PIECE("FEC_IBT", 1.0f);
+ TEXT_PIECE("FEC_ZIN", 20.0f);
+ TEXT_PIECE("FEC_MWB", 3.0f);
+ TEXT_PIECE("FEC_PGD", 1.0f);
+ TEXT_PIECE("FEC_IBT", 1.0f);
+ CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_ZOT")); nextX = MENU_X(30.0f); nextY -= 11.0f;
+ TEXT_PIECE("FEC_UPA", 2.0f);
+ TEXT_PIECE("FEC_DWA", 2.0f);
+ TEXT_PIECE("FEC_LFA", 2.0f);
+ TEXT_PIECE("FEC_RFA", 2.0f);
+ TEXT_PIECE("FEC_MSL", 1.0f);
+ TEXT_PIECE("FEC_IBT", 1.0f);
+ CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_MOV")); nextX = MENU_X(30.0f); nextY -= 11.0f;
+ TEXT_PIECE("FEC_MSR", 2.0f);
+ TEXT_PIECE("FEC_IBT", 1.0f);
+ CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_TAR"));
+#undef TEXT_PIECE
+}
+
+#undef ZOOM
#endif
+// rowIdx 99999 returns total numbers of rows. otherwise it returns 0.
+int
+CMenuManager::ConstructStatLine(int rowIdx)
+{
+#define STAT_LINE(str, left, isFloat, right) \
+ do { \
+ if(counter == rowIdx){ \
+ BuildStatLine(str, left, isFloat, right); \
+ return 0; \
+ } counter++; \
+ } while(0)
+
+ int counter = 0, nTemp;
+
+ STAT_LINE("PL_STAT", nil, false, nil);
+
+ int percentCompleted = (CStats::TotalProgressInGame == 0 ? 0 :
+ CStats::ProgressMade * 100.0f / (CGame::nastyGame ? CStats::TotalProgressInGame : CStats::TotalProgressInGame - 1));
+ percentCompleted = min(percentCompleted, 100);
+
+ STAT_LINE("PER_COM", &percentCompleted, false, nil);
+ STAT_LINE("NMISON", &CStats::MissionsGiven, false, nil);
+ STAT_LINE("FEST_MP", &CStats::MissionsPassed, 0, &CStats::TotalNumberMissions);
+ if (CGame::nastyGame) {
+ STAT_LINE("FEST_RP", &CStats::NumberKillFrenziesPassed, 0, &CStats::TotalNumberKillFrenzies);
+ }
+
+ CPlayerInfo &player = CWorld::Players[CWorld::PlayerInFocus];
+ float packagesPercent = 0.0f;
+ if (player.m_nTotalPackages != 0)
+ packagesPercent = player.m_nCollectedPackages * 100.0f / player.m_nTotalPackages;
+
+ STAT_LINE("PERPIC", &packagesPercent, 0, &(nTemp = 100));
+ STAT_LINE("NOUNIF", &CStats::TotalNumberOfUniqueJumps, 0, &CStats::NumberOfUniqueJumpsFound);
+ STAT_LINE("DAYSPS", &CStats::DaysPassed, false, nil);
+ if (CGame::nastyGame) {
+ STAT_LINE("PE_WAST", &CStats::PeopleKilledByPlayer, false, nil);
+ STAT_LINE("PE_WSOT", &CStats::PeopleKilledByOthers, false, nil);
+ }
+ STAT_LINE("CAR_EXP", &CStats::CarsExploded, false, nil);
+ STAT_LINE("TM_BUST", &CStats::TimesArrested, false, nil);
+ STAT_LINE("TM_DED", &CStats::TimesDied, false, nil);
+ STAT_LINE("GNG_WST", &(nTemp = CStats::PedsKilledOfThisType[PEDTYPE_GANG9] + CStats::PedsKilledOfThisType[PEDTYPE_GANG8]
+ + CStats::PedsKilledOfThisType[PEDTYPE_GANG7] + CStats::PedsKilledOfThisType[PEDTYPE_GANG6]
+ + CStats::PedsKilledOfThisType[PEDTYPE_GANG5] + CStats::PedsKilledOfThisType[PEDTYPE_GANG4]
+ + CStats::PedsKilledOfThisType[PEDTYPE_GANG3] + CStats::PedsKilledOfThisType[PEDTYPE_GANG2]
+ + CStats::PedsKilledOfThisType[PEDTYPE_GANG1]), false, nil);
+ STAT_LINE("DED_CRI", &(nTemp = CStats::PedsKilledOfThisType[PEDTYPE_CRIMINAL]), false, nil);
+ STAT_LINE("HEL_DST", &CStats::HelisDestroyed, false, nil);
+ STAT_LINE("KGS_EXP", &CStats::KgsOfExplosivesUsed, false, nil);
+ STAT_LINE("ACCURA", &(nTemp = (CStats::InstantHitsFiredByPlayer == 0 ? 0 :
+ CStats::InstantHitsHitByPlayer * 100.0f / CStats::InstantHitsFiredByPlayer)), false, nil);
+
+ if (CStats::ElBurroTime > 0) {
+ STAT_LINE("ELBURRO", &CStats::ElBurroTime, false, nil);
+ }
+ if (CStats::Record4x4One > 0) {
+ STAT_LINE("FEST_R1", &CStats::Record4x4One, false, nil);
+ }
+ if (CStats::Record4x4Two > 0) {
+ STAT_LINE("FEST_R2", &CStats::Record4x4Two, false, nil);
+ }
+ if (CStats::Record4x4Three > 0) {
+ STAT_LINE("FEST_R3", &CStats::Record4x4Three, false, nil);
+ }
+ if (CStats::Record4x4Mayhem > 0) {
+ STAT_LINE("FEST_RM", &CStats::Record4x4Mayhem, false, nil);
+ }
+ if (CStats::LongestFlightInDodo > 0) {
+ STAT_LINE("FEST_LF", &CStats::LongestFlightInDodo, false, nil);
+ }
+ if (CStats::TimeTakenDefuseMission > 0) {
+ STAT_LINE("FEST_BD", &CStats::TimeTakenDefuseMission, false, nil);
+ }
+ STAT_LINE("CAR_CRU", &CStats::CarsCrushed, false, nil);
+
+ if (CStats::HighestScores[0] > 0) {
+ STAT_LINE("FEST_BB", nil, false, nil);
+ STAT_LINE("FEST_H0", &CStats::HighestScores[0], false, nil);
+ }
+ if (CStats::HighestScores[4] + CStats::HighestScores[3] + CStats::HighestScores[2] + CStats::HighestScores[1] > 0) {
+ STAT_LINE("FEST_GC", nil, false, nil);
+ }
+ if (CStats::HighestScores[1] > 0) {
+ STAT_LINE("FEST_H1", &CStats::HighestScores[1], false, nil);
+ }
+ if (CStats::HighestScores[2] > 0) {
+ STAT_LINE("FEST_H2", &CStats::HighestScores[2], false, nil);
+ }
+ if (CStats::HighestScores[3] > 0) {
+ STAT_LINE("FEST_H3", &CStats::HighestScores[3], false, nil);
+ }
+ if (CStats::HighestScores[4] > 0) {
+ STAT_LINE("FEST_H4", &CStats::HighestScores[4], false, nil);
+ }
+
+ switch (m_PrefsLanguage) {
+ case LANGUAGE_AMERICAN:
+#ifndef USE_MEASUREMENTS_IN_METERS
+ float fTemp;
+ STAT_LINE("FEST_DF", &(fTemp = CStats::DistanceTravelledOnFoot * MILES_IN_METER), true, nil);
+ STAT_LINE("FEST_DC", &(fTemp = CStats::DistanceTravelledInVehicle * MILES_IN_METER), true, nil);
+ STAT_LINE("MMRAIN", &CStats::mmRain, false, nil);
+ STAT_LINE("MXCARD", &(fTemp = CStats::MaximumJumpDistance * FEET_IN_METER), true, nil);
+ STAT_LINE("MXCARJ", &(fTemp = CStats::MaximumJumpHeight * FEET_IN_METER), true, nil);
+ break;
+#endif
+ case LANGUAGE_FRENCH:
+ case LANGUAGE_GERMAN:
+ case LANGUAGE_ITALIAN:
+ case LANGUAGE_SPANISH:
+#ifdef MORE_LANGUAGES
+ case LANGUAGE_RUSSIAN:
+#endif
+ STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, true, nil);
+ STAT_LINE("FESTDCM", &CStats::DistanceTravelledInVehicle, true, nil);
+ STAT_LINE("MMRAIN", &CStats::mmRain, false, nil);
+ STAT_LINE("MXCARDM", &CStats::MaximumJumpDistance, true, nil);
+ STAT_LINE("MXCARJM", &CStats::MaximumJumpHeight, true, nil);
+ break;
+ default:
+ break;
+ }
+
+ STAT_LINE("MXFLIP", &CStats::MaximumJumpFlips, false, nil);
+ STAT_LINE("MXJUMP", &CStats::MaximumJumpSpins, false, nil);
+ STAT_LINE("BSTSTU", nil, false, nil);
+
+ if (counter == rowIdx) {
+ gUString[0] = '\0';
+ switch (CStats::BestStuntJump) {
+ case 1:
+ UnicodeStrcpy(gUString2, TheText.Get("INSTUN"));
+ return 0;
+ case 2:
+ UnicodeStrcpy(gUString2, TheText.Get("PRINST"));
+ return 0;
+ case 3:
+ UnicodeStrcpy(gUString2, TheText.Get("DBINST"));
+ return 0;
+ case 4:
+ UnicodeStrcpy(gUString2, TheText.Get("DBPINS"));
+ return 0;
+ case 5:
+ UnicodeStrcpy(gUString2, TheText.Get("TRINST"));
+ return 0;
+ case 6:
+ UnicodeStrcpy(gUString2, TheText.Get("PRTRST"));
+ return 0;
+ case 7:
+ UnicodeStrcpy(gUString2, TheText.Get("QUINST"));
+ return 0;
+ case 8:
+ UnicodeStrcpy(gUString2, TheText.Get("PQUINS"));
+ return 0;
+ default:
+ UnicodeStrcpy(gUString2, TheText.Get("NOSTUC"));
+ return 0;
+ }
+ }
+ counter++;
+ STAT_LINE("PASDRO", &CStats::PassengersDroppedOffWithTaxi, false, nil);
+ STAT_LINE("MONTAX", &CStats::MoneyMadeWithTaxi, false, nil);
+ STAT_LINE("FEST_LS", &CStats::LivesSavedWithAmbulance, false, nil);
+ STAT_LINE("FEST_HA", &CStats::HighestLevelAmbulanceMission, false, nil);
+ STAT_LINE("FEST_CC", &CStats::CriminalsCaught, false, nil);
+ STAT_LINE("FEST_FE", &CStats::FiresExtinguished, false, nil);
+ STAT_LINE("DAYPLC", &(nTemp = CTimer::GetTimeInMilliseconds() + 100), false, nil);
+ return counter;
+
+#undef STAT_LINE
+}
+
#if 0
uint8 CMenuManager::GetNumberOfMenuOptions()
{
@@ -3723,12 +5629,12 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
}
#endif
+#undef GetBackJustUp
+#undef GetBackJustDown
+
STARTPATCHES
-#if DONT_USE_SUSPICIOUS_FUNCS
-#else
for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);
-#endif
InjectHook(0x4856F0, &CMenuManager::ProcessButtonPresses, PATCH_JUMP);
InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
@@ -3741,4 +5647,5 @@ STARTPATCHES
InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP);
InjectHook(0x48AB40, &CMenuManager::DoSettingsBeforeStartingAGame, PATCH_JUMP);
InjectHook(0x48AE60, &CMenuManager::ProcessOnOffMenuOptions, PATCH_JUMP);
+ InjectHook(0x489710, &CMenuManager::DrawControllerBound, PATCH_JUMP);
ENDPATCHES \ No newline at end of file
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 74b3990e..792f0c45 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -7,27 +7,10 @@
#define MENUHEADER_WIDTH 0.84f
#define MENUHEADER_HEIGHT 1.6f
-#define MENUACTION_X_MARGIN 40.0f
+#define MENU_X_MARGIN 40.0f
#define MENUACTION_POS_Y 60.0f
-#define MENUACTION_WIDTH 0.405f
-#define MENUACTION_HEIGHT 0.63f
-
-#define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f
-#define MENUCOLUMN_MAX_Y 149.0f
-#define MENUCOLUMN_MID_Y 100.0f
-#define MENUCOLUMN_MIN_Y 110.0f
-#define MENUCOLUMN_PAUSE_Y 25.0f
-#define MENUCOLUMN_START_Y 9.0f
-#define MENUCOLUMN_FEDS 139.0f
-
-#define MENUCOLUMN_SAVE_X 121.0f
-#define MENUCOLUMN_SAVE_Y 111.0f
-
-#define MENUCOLUMN_SPACING_MAX 24.0f
-#define MENUCOLUMN_SPACING_MIN 20.0f
-
-#define MENUSELECT_BOX_MAX 20.5f
-#define MENUSELECT_BOX_MIN 17.0f
+#define MENUACTION_WIDTH 38.0f
+#define MENUACTION_SCALE_MULT 0.9f
#ifndef ASPECT_RATIO_SCALE
#define MENURADIO_ICON_X 31.5f
@@ -38,12 +21,63 @@
#define MENURADIO_ICON_W 60.0f
#define MENURADIO_ICON_H 60.0f
-#define MENUDROP_COLOR_A 150
-#define MENUDROP_COLOR_SIZE -1
-
#define MENUSLIDER_X 256.0f
#define MENUSLIDER_UNK 256.0f
+#define BIGTEXT_X_SCALE 0.75f
+#define BIGTEXT_Y_SCALE 0.9f
+#define MEDIUMTEXT_X_SCALE 0.55f
+#define MEDIUMTEXT_Y_SCALE 0.8f
+#define SMALLTEXT_X_SCALE 0.45f
+#define SMALLTEXT_Y_SCALE 0.7f
+#define SMALLESTTEXT_X_SCALE 0.4f
+#define SMALLESTTEXT_Y_SCALE 0.6f
+
+#define PLAYERSETUP_LIST_TOP 28.0f
+#define PLAYERSETUP_LIST_BOTTOM 125.0f
+#define PLAYERSETUP_LIST_LEFT 200.0f
+#define PLAYERSETUP_LIST_RIGHT 36.0f
+#ifdef FIX_BUGS // See the scrollbar button drawing code
+#define PLAYERSETUP_SCROLLBAR_WIDTH 19.0f
+#else
+#define PLAYERSETUP_SCROLLBAR_WIDTH 16.0f
+#endif
+#define PLAYERSETUP_SCROLLBUTTON_HEIGHT 17.0f
+#define PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION 64
+#define PLAYERSETUP_ROW_TEXT_X_SCALE 0.4f
+#define PLAYERSETUP_ROW_TEXT_Y_SCALE 0.6f
+#define PLAYERSETUP_SKIN_COLUMN_LEFT 220.0f
+#define PLAYERSETUP_DATE_COLUMN_RIGHT 56.0f
+#define PLAYERSETUP_LIST_BODY_TOP 47
+#define PLAYERSETUP_ROW_HEIGHT 9
+
+#define STATS_SLIDE_Y_PER_SECOND 30.0f
+#define STATS_ROW_HEIGHT 20.0f
+#define STATS_ROW_X_MARGIN 50.0f
+#define STATS_BOTTOM_MARGIN 135.0f
+#define STATS_TOP_MARGIN 40.0f
+#define STATS_TOP_DIMMING_AREA_LENGTH (93.0f - STATS_TOP_MARGIN)
+#define STATS_BOTTOM_DIMMING_AREA_LENGTH 55.0f
+#define STATS_PUT_BACK_TO_BOTTOM_Y 50.0f
+#define STATS_RATING_X 24.0f
+#define STATS_RATING_Y 20.0f
+
+#define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f
+#define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f
+#define CONTSETUP_BOUND_HIGHLIGHT_HEIGHT 10
+#define CONTSETUP_BOUND_COLUMN_WIDTH 190.0f
+#define CONTSETUP_LIST_HEADER_HEIGHT 20.0f
+#define CONTSETUP_LIST_TOP 28.0f
+#define CONTSETUP_LIST_RIGHT 18.0f
+#define CONTSETUP_LIST_BOTTOM 120.0f
+#define CONTSETUP_LIST_LEFT 18.0f
+#define CONTSETUP_COLUMN_1_X 40.0f
+#define CONTSETUP_COLUMN_2_X 210.0f
+#define CONTSETUP_COLUMN_3_X (CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH + 10.0f)
+#define CONTSETUP_BACK_RIGHT 35.0f
+#define CONTSETUP_BACK_BOTTOM 122.0f
+#define CONTSETUP_BACK_HEIGHT 25.0f
+
enum eLanguages
{
LANGUAGE_AMERICAN,
@@ -87,6 +121,8 @@ enum eFrontendSprites
FE_RADIO7,
FE_RADIO8,
FE_RADIO9,
+
+ NUM_FE_SPRITES
};
enum eMenuSprites
@@ -110,6 +146,8 @@ enum eMenuSprites
MENUSPRITE_UPOFF,
MENUSPRITE_UPON,
MENUSPRITE_GTA3LOGO,
+ MENUSPRITE_UNUSED,
+ NUM_MENU_SPRITES
};
enum eSaveSlot
@@ -127,6 +165,22 @@ enum eSaveSlot
SAVESLOT_LABEL = 36
};
+#ifdef MENU_MAP
+enum MapSprites
+{
+ MAPMID1,
+ MAPMID2,
+ MAPMID3,
+ MAPBOT1,
+ MAPBOT2,
+ MAPBOT3,
+ MAPTOP1,
+ MAPTOP2,
+ MAPTOP3,
+ NUM_MAP_SPRITES
+};
+#endif
+
enum eMenuScreen
{
MENUPAGE_DISABLED = -1,
@@ -143,19 +197,19 @@ enum eMenuScreen
MENUPAGE_NEW_GAME_RELOAD = 10,
MENUPAGE_LOAD_SLOT_CONFIRM = 11,
MENUPAGE_DELETE_SLOT_CONFIRM = 12,
- MENUPAGE_13 = 13,
+ MENUPAGE_NO_MEMORY_CARD = 13, // hud adjustment page in mobile
MENUPAGE_LOADING_IN_PROGRESS = 14,
MENUPAGE_DELETING_IN_PROGRESS = 15,
- MENUPAGE_16 = 16,
+ MENUPAGE_PS2_LOAD_FAILED = 16,
MENUPAGE_DELETE_FAILED = 17,
MENUPAGE_DEBUG_MENU = 18,
- MENUPAGE_MEMORY_CARD_1 = 19,
- MENUPAGE_MEMORY_CARD_2 = 20,
+ MENUPAGE_MEMORY_CARD_DEBUG = 19,
+ MENUPAGE_MEMORY_CARD_TEST = 20,
MENUPAGE_MULTIPLAYER_MAIN = 21,
- MENUPAGE_SAVE_FAILED_1 = 22,
- MENUPAGE_SAVE_FAILED_2 = 23,
+ MENUPAGE_PS2_SAVE_FAILED = 22,
+ MENUPAGE_PS2_SAVE_FAILED_2 = 23,
MENUPAGE_SAVE = 24,
- MENUPAGE_NO_MEMORY_CARD = 25,
+ MENUPAGE_NO_MEMORY_CARD_2 = 25,
MENUPAGE_CHOOSE_SAVE_SLOT = 26,
MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27,
MENUPAGE_MULTIPLAYER_MAP = 28,
@@ -187,8 +241,11 @@ enum eMenuScreen
MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
- MENUPAGE_57 = 57,
+ MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile
MENUPAGE_58 = 58,
+#ifdef MENU_MAP
+ MENUPAGE_MAP = 59,
+#endif
MENUPAGES
};
@@ -322,7 +379,7 @@ enum eCheckHover
HOVEROPTION_6,
HOVEROPTION_7,
HOVEROPTION_8,
- HOVEROPTION_BACK, // used in controller setup
+ HOVEROPTION_BACK, // also layer in controller setup and skin menu
HOVEROPTION_10,
HOVEROPTION_11,
HOVEROPTION_OVER_SCROLL_UP,
@@ -332,9 +389,9 @@ enum eCheckHover
HOVEROPTION_HOLDING_SCROLLBAR,
HOVEROPTION_PAGEUP,
HOVEROPTION_PAGEDOWN,
- HOVEROPTION_19,
- HOVEROPTION_20,
- HOVEROPTION_CHANGESKIN,
+ HOVEROPTION_LIST, // also layer in controller setup and skin menu
+ HOVEROPTION_SKIN,
+ HOVEROPTION_USESKIN, // also layer in controller setup and skin menu
HOVEROPTION_RADIO_0,
HOVEROPTION_RADIO_1,
HOVEROPTION_RADIO_2,
@@ -369,13 +426,20 @@ enum eControlMethod
CONTROL_CLASSIC,
};
+// Why??
+enum ControllerSetupColumn
+{
+ CONTSETUP_PED_COLUMN = 0,
+ CONTSETUP_VEHICLE_COLUMN = 14,
+};
+
struct tSkinInfo
{
- int32 field_0;
- char skinName[256];
- char currSkinName[256];
+ int32 skinId;
+ char skinNameDisplayed[256];
+ char skinNameOriginal[256];
char date[256];
- tSkinInfo *field_304;
+ tSkinInfo *nextSkin;
};
struct BottomBarOption
@@ -387,7 +451,7 @@ struct BottomBarOption
struct CMenuScreen
{
char m_ScreenName[8];
- int32 unk;
+ int32 unk; // 2 on MENUPAGE_MULTIPLAYER_START, 1 on everywhere else
int32 m_PreviousPage[2]; // eMenuScreen
int32 m_ParentEntry[2]; // row
@@ -413,7 +477,7 @@ public:
bool m_bMenuActive;
bool m_bMenuStateChanged;
bool m_bWaitingForNewKeyBind;
- bool m_bStartGameLoading;
+ bool m_bWantToRestart;
bool m_bFirstTime;
bool m_bGameNotLoaded;
int32 m_nMousePosX;
@@ -421,24 +485,24 @@ public:
int32 m_nMouseTempPosX;
int32 m_nMouseTempPosY;
bool m_bShowMouse;
- tSkinInfo m_sSkin;
+ tSkinInfo m_pSkinListHead;
tSkinInfo *m_pSelectedSkin;
int32 m_nFirstVisibleRowOnList;
- float m_nCurListItemY;
+ float m_nScrollbarTopMargin;
int32 m_nTotalListRow;
int32 m_nSkinsTotal;
char _unk0[4];
int32 m_nSelectedListRow;
- bool m_bSkinsFound;
+ bool m_bSkinsEnumerated;
bool m_bQuitGameNoCD;
bool m_bRenderGameInMenu;
bool m_bSaveMenuActive;
- bool m_bLoadingSavedGame;
+ bool m_bWantToLoad;
char field_455;
bool m_bStartWaitingForKeyBind;
bool m_bSpritesLoaded;
- CSprite2d m_aFrontEndSprites[28];
- CSprite2d m_aMenuSprites[20];
+ CSprite2d m_aFrontEndSprites[NUM_FE_SPRITES];
+ CSprite2d m_aMenuSprites[NUM_MENU_SPRITES];
int32 field_518;
int32 m_nMenuFadeAlpha;
bool m_bPressedPgUpOnList;
@@ -448,10 +512,10 @@ public:
bool m_bPressedScrollButton;
int32 m_CurrCntrlAction;
char _unk1[4];
- int32 field_530;
+ int32 m_nSelectedContSetupColumn;
bool m_bKeyIsOK;
bool field_535;
- int8 m_nCurrExLayer; // TODO: What's that?
+ int8 m_nCurrExLayer;
int32 m_nHelperTextAlpha;
int32 m_nMouseOldPosX;
int32 m_nMouseOldPosY;
@@ -468,47 +532,58 @@ public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
public:
- static int32 &OS_Language;
- static int8 &m_PrefsUseVibration;
- static int8 &m_DisplayControllerOnFoot;
- static int8 &m_PrefsUseWideScreen;
- static int8 &m_PrefsRadioStation;
- static int8 &m_PrefsVsync;
- static int8 &m_PrefsVsyncDisp;
- static int8 &m_PrefsFrameLimiter;
- static int8 &m_PrefsShowSubtitles;
- static int8 &m_PrefsSpeakers;
- static int32 &m_ControlMethod;
- static int8 &m_PrefsDMA;
- static int32 &m_PrefsLanguage;
- static int32 &m_PrefsBrightness;
- static float &m_PrefsLOD;
- static int8 &m_bFrontEnd_ReloadObrTxtGxt;
- static int32 &m_PrefsMusicVolume;
- static int32 &m_PrefsSfxVolume;
- static char *m_PrefsSkinFile;
- static int32 &m_KeyPressedCode;
-
- static bool &m_bStartUpFrontEndRequested;
- static bool &m_bShutDownFrontEndRequested;
- static bool &m_PrefsAllowNastyGame;
+ static int32 OS_Language;
+ static int8 m_PrefsUseVibration;
+ static int8 m_DisplayControllerOnFoot;
+ static int8 m_PrefsUseWideScreen;
+ static int8 m_PrefsRadioStation;
+ static int8 m_PrefsVsync;
+ static int8 m_PrefsVsyncDisp;
+ static int8 m_PrefsFrameLimiter;
+ static int8 m_PrefsShowSubtitles;
+ static int8 m_PrefsSpeakers;
+ static int32 m_ControlMethod;
+ static int8 m_PrefsDMA;
+ static int32 m_PrefsLanguage;
+ static int32 m_PrefsBrightness;
+ static float m_PrefsLOD;
+ static int8 m_bFrontEnd_ReloadObrTxtGxt;
+ static int32 m_PrefsMusicVolume;
+ static int32 m_PrefsSfxVolume;
+ static char m_PrefsSkinFile[256];
+ static int32 m_KeyPressedCode;
+
+ static bool m_bStartUpFrontEndRequested;
+ static bool m_bShutDownFrontEndRequested;
+ static bool m_PrefsAllowNastyGame;
- static float &menuXYpadding;
- static float &actionTextScaleX;
- static float &actionTextScaleY;
- static int32 &sthWithButtons;
- static int32 &sthWithButtons2;
-
-#ifndef MASTER
- static bool m_PrefsMarketing;
- static bool m_PrefsDisableTutorials;
-#endif // !MASTER
-
+ static uint8 m_PrefsStereoMono;
+ static int32 m_SelectedMap;
+ static int32 m_SelectedGameType;
+ static uint8 m_PrefsPlayerRed;
+ static uint8 m_PrefsPlayerGreen;
+ static uint8 m_PrefsPlayerBlue;
+
+#ifndef MASTER
+ static bool m_PrefsMarketing;
+ static bool m_PrefsDisableTutorials;
+#endif // !MASTER
+
+#ifdef MENU_MAP
+ static bool bMenuMapActive;
+ static bool bMapMouseShownOnce;
+ static bool bMapLoaded;
+ static float fMapSize;
+ static float fMapCenterY;
+ static float fMapCenterX;
+ static CSprite2d m_aMapSprites[NUM_MAP_SPRITES];
+ void PrintMap();
+#endif
public:
- static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);
+ static void BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2);
static void CentreMousePointer();
- int CheckCodesForControls(int32);
+ void CheckCodesForControls(int);
bool CheckHover(int x1, int x2, int y1, int y2);
void CheckSliderMovement(int);
int CostructStatLine(int);
@@ -516,7 +591,7 @@ public:
int DisplaySlider(float, float, float, float, float, float);
void DoSettingsBeforeStartingAGame();
void Draw();
- void DrawControllerBound(int, int, int, uint8);
+ void DrawControllerBound(int32, int32, int32, int8);
void DrawControllerScreenExtraText(int, int, int);
void DrawControllerSetupScreen();
void DrawFrontEnd();
@@ -526,13 +601,13 @@ public:
#endif
void DrawPlayerSetupScreen();
int FadeIn(int alpha);
- void FilterOutColorMarkersFromString(uint16, CRGBA &);
+ void FilterOutColorMarkersFromString(wchar*, CRGBA &);
int GetStartOptionsCntrlConfigScreens();
static void InitialiseChangedLanguageSettings();
void LoadAllTextures();
void LoadSettings();
- static void MessageScreen(char *);
- static void PickNewPlayerColour();
+ void MessageScreen(const char *);
+ void PickNewPlayerColour();
void PrintBriefs();
static void PrintErrorMessage();
void PrintStats();
@@ -552,6 +627,8 @@ public:
void UnloadTextures();
void WaitForUserCD();
void PrintController();
+ int GetNumOptionsCntrlConfigScreens();
+ int ConstructStatLine(int);
// New (not in function or inlined in the game)
void ThingsToDoBeforeLeavingPage();
@@ -565,4 +642,4 @@ public:
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
-extern CMenuManager &FrontEndMenuManager;
+extern CMenuManager FrontEndMenuManager;
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 8571e93e..daac3ec5 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -89,8 +89,6 @@
-#define DEFAULT_VIEWWINDOW (0.7f)
-
eLevelName &CGame::currLevel = *(eLevelName*)0x941514;
bool &CGame::bDemoMode = *(bool*)0x5F4DD0;
bool &CGame::nastyGame = *(bool*)0x5F4DD4;
@@ -492,7 +490,7 @@ void CGame::ReInitGameObjectVariables(void)
CParticle::ReloadConfig();
CCullZones::ResolveVisibilities();
- if ( !FrontEndMenuManager.m_bLoadingSavedGame )
+ if ( !FrontEndMenuManager.m_bWantToLoad )
{
CCranes::InitCranes();
CTheScripts::StartTestScript();
@@ -566,7 +564,7 @@ void CGame::InitialiseWhenRestarting(void)
TheCamera.Init();
- if ( FrontEndMenuManager.m_bLoadingSavedGame == true )
+ if ( FrontEndMenuManager.m_bWantToLoad == true )
{
RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition());
@@ -574,7 +572,7 @@ void CGame::InitialiseWhenRestarting(void)
ReInitGameObjectVariables();
- if ( FrontEndMenuManager.m_bLoadingSavedGame == true )
+ if ( FrontEndMenuManager.m_bWantToLoad == true )
{
if ( GenericLoad() == true )
{
@@ -593,7 +591,7 @@ void CGame::InitialiseWhenRestarting(void)
ShutDownForRestart();
CTimer::Stop();
CTimer::Initialise();
- FrontEndMenuManager.m_bLoadingSavedGame = false;
+ FrontEndMenuManager.m_bWantToLoad = false;
ReInitGameObjectVariables();
currLevel = LEVEL_INDUSTRIAL;
CCollision::SortOutCollisionAfterLoad();
@@ -609,6 +607,9 @@ extern void (*DebugMenuProcess)(void);
void CGame::Process(void)
{
CPad::UpdatePads();
+#ifdef GTA_PS2
+ ProcessTidyUpMemory();
+#endif
TheCamera.SetMotionBlurAlpha(0);
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
@@ -695,6 +696,13 @@ void CGame::TidyUpMemory(bool, bool)
#endif
}
+void CGame::ProcessTidyUpMemory(void)
+{
+#ifdef PS2
+ // meow
+#endif
+}
+
STARTPATCHES
InjectHook(0x48BB80, CGame::InitialiseOnceBeforeRW, PATCH_JUMP);
InjectHook(0x48BBA0, CGame::InitialiseRenderWare, PATCH_JUMP);
diff --git a/src/core/Game.h b/src/core/Game.h
index 318ff54b..30581893 100644
--- a/src/core/Game.h
+++ b/src/core/Game.h
@@ -39,4 +39,5 @@ public:
// NB: these do something on PS2
static void TidyUpMemory(bool, bool);
static void DrasticTidyUpMemory(bool);
+ static void ProcessTidyUpMemory(void);
};
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h
index 45c5e5d6..8ce2d313 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.h
@@ -1,18 +1,22 @@
#pragma once
-// There are some missing/wrong entries in here.
+// TODO: There are some missing/wrong entries in here.
const CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
+ { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
- // MENUPAGE_STATS = 1 - Both PrintStats and Draw were printing the page name, so deleted the string Draw looked for.
- { ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
+ // MENUPAGE_STATS = 1
+#ifdef MENU_MAP
+ { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
+#else
+ { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
+#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_NEW_GAME = 2
- { "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
+ { "FET_SGA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_POPULATESLOTS_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
@@ -20,12 +24,16 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_BRIEFS = 3
- { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
+#ifdef MENU_MAP
+ { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4,
+#else
+ { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
+#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENU_CONTROLLER_SETTINGS = 4
- { "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
+ { "FET_CON", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
MENUACTION_CTRLCONFIG, "FEC_CCF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
MENUACTION_CTRLDISPLAY, "FEC_CDP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
MENUACTION_CTRLVIBRATION, "FEC_VIB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
@@ -33,7 +41,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_SOUND_SETTINGS = 5
- { "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1,
+ { "FET_AUD", 1, 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,
@@ -45,7 +53,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_GRAPHICS_SETTINGS = 6
- { "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
+ { "FET_DIS", 1, 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,
@@ -59,7 +67,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_LANGUAGE_SETTINGS = 7
- { "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
+ { "FET_LAN", 1, 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,
@@ -73,7 +81,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
- { "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
+ { "FET_LG", 1, 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,
@@ -86,7 +94,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
- { "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
+ { "FET_DG", 1, 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,
@@ -99,104 +107,123 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_NEW_GAME_RELOAD = 10
- { "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0,
+ { "FET_NG", 1, 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_NEW_GAME_RELOAD,
},
// MENUPAGE_LOAD_SLOT_CONFIRM = 11
- { "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0,
+ { "FET_LG", 1, 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, 0, 0,
+ { "FET_DG", 1, 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, 0, 0,
-
+ // MENUPAGE_NO_MEMORY_CARD = 13
+ { "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ // hud adjustment page in mobile
},
// MENUPAGE_LOADING_IN_PROGRESS = 14
- { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_LG", 1, 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, 0, 0,
+ { "FET_DG", 1, 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, 0, 0,
+ // MENUPAGE_PS2_LOAD_FAILED = 16
+ { "FET_LG", 1, 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, 0, 0,
+ { "FET_DG", 1, 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, 0, 0,
-
+ { "FED_DBG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 4, 0,
+ MENUACTION_RELOADIDE, "FED_RID", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_RELOADIPL, "FED_RIP", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SETDBGFLAG, "FED_DFL", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SWITCHBIGWHITEDEBUGLIGHT, "FED_DLS", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_PEDROADGROUPS, "FED_SPR", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CARROADGROUPS, "FED_SCR", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_COLLISIONPOLYS, "FED_SCP", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_PARSEHEAP, "FED_PAH", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SHOWCULL, "FED_SCZ", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_DEBUGSTREAM, "FED_DSR", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
- // MENUPAGE_MEMORY_CARD_1 = 19
- { "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ // MENUPAGE_MEMORY_CARD_DEBUG = 19
+ { "FEM_MCM", 1, MENUPAGE_NONE, MENUPAGE_NONE, 7, 0,
+ MENUACTION_REGMEMCARD1, "FEM_RMC", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_TESTFORMATMEMCARD1, "FEM_TFM", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_TESTUNFORMATMEMCARD1, "FEM_TUM", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CREATEROOTDIR, "FEM_CRD", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CREATELOADICONS, "FEM_CLI", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_FILLWITHGUFF, "FEM_FFF", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SAVEONLYTHEGAME, "FEM_SOG", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SAVEGAME, "FEM_STG", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SAVEGAMEUNDERGTA, "FEM_STS", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CREATECOPYPROTECTED, "FEM_CPD", SAVESLOT_NONE, MENUPAGE_NONE,
},
- // MENUPAGE_MEMORY_CARD_2 = 20
- { "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ // MENUPAGE_MEMORY_CARD_TEST = 20
+ { "FEM_MC2", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_MAIN = 21
- { "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_MP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
- // MENUPAGE_SAVE_FAILED_1 = 22
- { "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ // MENUPAGE_PS2_SAVE_FAILED = 22
+ { "MCDNSP", 1, 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, 0, 0,
+ // MENUPAGE_PS2_SAVE_FAILED_2 = 23
+ { "MCGNSP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
// Unused in PC but anyway
// MENUPAGE_SAVE = 24
#ifdef PS2_SAVE_DIALOG
- { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_CHANGEMENU, "FESZ_SA", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
#else
- { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif
- // MENUPAGE_NO_MEMORY_CARD = 25
- { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ // MENUPAGE_NO_MEMORY_CARD_2 = 25
+ { "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_CHOOSE_SAVE_SLOT = 26
- { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
@@ -209,59 +236,58 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
+ { "FET_SG", 1, 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, 0, 0,
+ { "FET_MAP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_CONNECTION = 29
- { "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_CON", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_FIND_GAME = 30
- { "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_FG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_MODE = 31
- { "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_GT", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_CREATE = 32
- { "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_HG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_START = 33
- { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FEN_STA", 2, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_SKIN_SELECT_OLD = 34
- { "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_PS", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_CONTROLLER_PC = 35
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
+ { "FET_CTL", 1, 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,
-
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_CONTROLLER_PC_OLD1 = 36
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0,
+ { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0,
MENUACTION_GETKEY, "FEC_PLB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
MENUACTION_GETKEY, "FEC_CWL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
MENUACTION_GETKEY, "FEC_CWR", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
@@ -275,12 +301,12 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CONTROLLER_PC_OLD2 = 37
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
+ { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
},
// MENUPAGE_CONTROLLER_PC_OLD3 = 38
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
+ { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
MENUACTION_GETKEY, "FEC_LUP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
MENUACTION_GETKEY, "FEC_LDN", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
MENUACTION_GETKEY, "FEC_SMS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
@@ -289,17 +315,25 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CONTROLLER_PC_OLD4 = 39
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
+ { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
},
// MENUPAGE_CONTROLLER_DEBUG = 40
- { "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ { "FEC_DBG", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
+ MENUACTION_GETKEY, "FEC_TGD", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
+ MENUACTION_GETKEY, "FEC_TDO", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
+ MENUACTION_GETKEY, "FEC_TSS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
+ MENUACTION_GETKEY, "FEC_SMS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
+ MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_OPTIONS = 41
- { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
+#ifdef MENU_MAP
+ { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5,
+#else
+ { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
+#endif
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@@ -309,67 +343,74 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_EXIT = 42
- { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
+#ifdef MENU_MAP
+ { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6,
+#else
+ { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
+#endif
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVING_IN_PROGRESS = 43
- { "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
+ { "", 1, 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, 0, 0,
+ { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE,
MENUACTION_RESUME_FROM_SAVEZONE, "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, 0, 0,
+ { "FET_DG", 1, 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, 0, 0,
+ { "FET_DG", 1, 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, 0, 0,
+ { "FET_SG", 1, 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, 0, 0,
+ { "FET_SG", 1, 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, 0, 0,
+ { "FET_LG", 1, 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, 0, 0,
+ { "FIL_FLT", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_START_MENU = 51
- { "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FEM_MM", 1, 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, 0, 0,
+ { "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
+#ifdef MENU_MAP
+ MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP,
+#endif
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
@@ -377,22 +418,24 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_MODE = 53
- { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ { "FEN_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
+ MENUACTION_CHANGEMENU, "FET_SP", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
+ MENUACTION_INITMP, "FET_MP", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
+ MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SKIN_SELECT = 54
- { "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4,
- MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
+ { "FET_PSU", 1, 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, 1, 1,
- MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
+ { "FET_STI", 1, 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, 2, 2,
+ { "FET_MTI", 1, 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,
@@ -400,12 +443,18 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_57 = 57
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
+ // mission failed, wanna restart page in mobile
},
// MENUPAGE_58 = 58
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
},
+
+#ifdef MENU_MAP
+ // MENUPAGE_MAP = 59
+ { "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
+ },
+#endif
};
diff --git a/src/core/NodeName.cpp b/src/core/NodeName.cpp
deleted file mode 100644
index 2aea3c83..00000000
--- a/src/core/NodeName.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "NodeName.h"
-
-static int32 &gPluginOffset = *(int32*)0x64C610;
-
-enum
-{
- ID_NODENAME = MAKECHUNKID(rwVENDORID_ROCKSTAR, 0xFE),
-};
-
-#define NODENAMEEXT(o) (RWPLUGINOFFSET(char, o, gPluginOffset))
-
-void*
-NodeNameConstructor(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
-{
- if(gPluginOffset > 0)
- NODENAMEEXT(object)[0] = '\0';
- return object;
-}
-
-void*
-NodeNameDestructor(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
-{
- return object;
-}
-
-void*
-NodeNameCopy(void *dstObject, const void *srcObject, RwInt32 offsetInObject, RwInt32 sizeInObject)
-{
- strncpy(NODENAMEEXT(dstObject), NODENAMEEXT(srcObject), 23);
- return nil;
-}
-
-RwStream*
-NodeNameStreamRead(RwStream *stream, RwInt32 binaryLength, void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
-{
- RwStreamRead(stream, NODENAMEEXT(object), binaryLength);
- NODENAMEEXT(object)[binaryLength] = '\0';
- return stream;
-}
-
-RwStream*
-NodeNameStreamWrite(RwStream *stream, RwInt32 binaryLength, const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
-{
- RwStreamWrite(stream, NODENAMEEXT(object), binaryLength);
- return stream;
-}
-
-RwInt32
-NodeNameStreamGetSize(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
-{
- // game checks for null pointer on node name extension but that really happen
- return rwstrlen(NODENAMEEXT(object));
-}
-
-bool
-NodeNamePluginAttach(void)
-{
- gPluginOffset = RwFrameRegisterPlugin(24, ID_NODENAME,
- NodeNameConstructor,
- NodeNameDestructor,
- NodeNameCopy);
- RwFrameRegisterPluginStream(ID_NODENAME,
- NodeNameStreamRead,
- NodeNameStreamWrite,
- NodeNameStreamGetSize);
- return gPluginOffset != -1;
-}
-
-char*
-GetFrameNodeName(RwFrame *frame)
-{
- if(gPluginOffset < 0)
- return nil;
- return NODENAMEEXT(frame);
-}
diff --git a/src/core/NodeName.h b/src/core/NodeName.h
deleted file mode 100644
index 1a3e057b..00000000
--- a/src/core/NodeName.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#pragma once
-
-bool NodeNamePluginAttach(void);
-char *GetFrameNodeName(RwFrame *frame);
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 6bbe00f2..f83998b8 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -21,19 +21,26 @@
#include "Hud.h"
#include "Text.h"
#include "Timer.h"
+#include "Record.h"
#include "World.h"
#include "Vehicle.h"
#include "Ped.h"
#include "Population.h"
+#include "Record.h"
#include "Replay.h"
#include "Weather.h"
#include "win.h"
+#include "Streaming.h"
+#include "PathFind.h"
+#include "Wanted.h"
+#include "General.h"
CPad *Pads = (CPad*)0x6F0360; // [2]
CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C;
bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52;
bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8;
+bool CPad::bOldDisplayNoControllerMessage;
bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48;
CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70;
@@ -49,29 +56,217 @@ CMouseControllerState &CPad::PCTempMouseControllerState = *(CMouseControllerStat
_TODO("gbFastTime");
extern bool &gbFastTime;
-WRAPPER void WeaponCheat() { EAXJMP(0x490D90); }
-WRAPPER void HealthCheat() { EAXJMP(0x490E70); }
-WRAPPER void TankCheat() { EAXJMP(0x490EE0); }
-WRAPPER void BlowUpCarsCheat() { EAXJMP(0x491040); }
-WRAPPER void ChangePlayerCheat() { EAXJMP(0x4910B0); }
-WRAPPER void MayhemCheat() { EAXJMP(0x4911C0); }
-WRAPPER void EverybodyAttacksPlayerCheat() { EAXJMP(0x491270); }
-WRAPPER void WeaponsForAllCheat() { EAXJMP(0x491370); }
-WRAPPER void FastTimeCheat() { EAXJMP(0x4913A0); }
-WRAPPER void SlowTimeCheat() { EAXJMP(0x4913F0); }
-WRAPPER void MoneyCheat() { EAXJMP(0x491430); }
-WRAPPER void ArmourCheat() { EAXJMP(0x491460); }
-WRAPPER void WantedLevelUpCheat() { EAXJMP(0x491490); }
-WRAPPER void WantedLevelDownCheat() { EAXJMP(0x4914F0); }
-WRAPPER void SunnyWeatherCheat() { EAXJMP(0x491520); }
-WRAPPER void CloudyWeatherCheat() { EAXJMP(0x491550); }
-WRAPPER void RainyWeatherCheat() { EAXJMP(0x491580); }
-WRAPPER void FoggyWeatherCheat() { EAXJMP(0x4915B0); }
-WRAPPER void FastWeatherCheat() { EAXJMP(0x4915E0); }
-WRAPPER void OnlyRenderWheelsCheat() { EAXJMP(0x491610); }
-WRAPPER void ChittyChittyBangBangCheat() { EAXJMP(0x491640); }
-WRAPPER void StrongGripCheat() { EAXJMP(0x491670); }
-WRAPPER void NastyLimbsCheat() { EAXJMP(0x4916A0); }
+void WeaponCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT2"), true);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_BASEBALLBAT, 0);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_COLT45, 100);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_UZI, 100);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_SHOTGUN, 20);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_AK47, 200);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_M16, 200);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_SNIPERRIFLE, 5);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_ROCKETLAUNCHER, 5);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_MOLOTOV, 5);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_GRENADE, 5);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_FLAMETHROWER, 200);
+}
+
+void HealthCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT3"), true);
+ FindPlayerPed()->m_fHealth = 100.0f;
+ if (FindPlayerVehicle()) {
+ FindPlayerVehicle()->m_fHealth = 1000.0f;
+ if (FindPlayerVehicle()->m_vehType == VEHICLE_TYPE_CAR)
+ ((CAutomobile*)FindPlayerVehicle())->Damage.SetEngineStatus(0);
+ }
+}
+
+void TankCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ CStreaming::RequestModel(MI_RHINO, 0);
+ CStreaming::LoadAllRequestedModels(false);
+ if (CStreaming::ms_aInfoForModel[MI_RHINO].m_loadState == STREAMSTATE_LOADED) {
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ int32 node = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 100.0f);
+
+ if (node < 0) return;
+
+#ifdef FIX_BUGS
+ CAutomobile* tank = new CAutomobile(MI_RHINO, RANDOM_VEHICLE);
+#else
+ CAutomobile *tank = new CAutomobile(MI_RHINO, MISSION_VEHICLE);
+#endif
+ if (tank != nil) {
+ CVector pos = ThePaths.m_pathNodes[node].pos;
+ pos.z += 4.0f;
+ tank->GetPosition() = pos;
+ tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f));
+
+ tank->m_status = STATUS_ABANDONED;
+ tank->m_nDoorLock = CARLOCK_UNLOCKED;
+ CWorld::Add(tank);
+ }
+ }
+}
+
+void BlowUpCarsCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+
+ int i = CPools::GetVehiclePool()->GetSize();
+ while (i-- > 0) {
+ if (CVehicle *veh = CPools::GetVehiclePool()->GetSlot(i))
+ veh->BlowUpCar(nil);
+ }
+}
+
+void ChangePlayerCheat()
+{
+ int modelId;
+
+ if (FindPlayerPed()->IsPedInControl() && CModelInfo::GetModelInfo("player", nil)) {
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ CPlayerPed *ped = FindPlayerPed();
+ AssocGroupId AnimGrp = ped->m_animGroup;
+ do
+ {
+ do
+ modelId = CGeneral::GetRandomNumberInRange(0, MI_CAS_WOM+1);
+ while (!CModelInfo::GetModelInfo(modelId));
+ } while (modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL04 || modelId == MI_TAXI_D);
+
+ uint8 flags = CStreaming::ms_aInfoForModel[modelId].m_flags;
+ ped->DeleteRwObject();
+ CStreaming::RequestModel(modelId, STREAMFLAGS_DEPENDENCY| STREAMFLAGS_DONT_REMOVE);
+ CStreaming::LoadAllRequestedModels(false);
+ ped->m_modelIndex = -1;
+ ped->SetModelIndex(modelId);
+ ped->m_animGroup = AnimGrp;
+ if (modelId != MI_PLAYER) {
+ if (!(flags & STREAMFLAGS_DONT_REMOVE))
+ CStreaming::SetModelIsDeletable(modelId);
+ }
+ }
+}
+
+void MayhemCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ for (int i = PEDTYPE_CIVMALE; i < PEDTYPE_SPECIAL; i++)
+ CPedType::SetThreats(i, PED_FLAG_PLAYER1 | PED_FLAG_PLAYER2 | PED_FLAG_PLAYER3 | PED_FLAG_PLAYER4 |
+ PED_FLAG_CIVMALE | PED_FLAG_CIVFEMALE | PED_FLAG_COP | PED_FLAG_GANG1 |
+ PED_FLAG_GANG2 | PED_FLAG_GANG3 | PED_FLAG_GANG4 | PED_FLAG_GANG5 |
+ PED_FLAG_GANG6 | PED_FLAG_GANG7 | PED_FLAG_GANG8 | PED_FLAG_GANG9 |
+ PED_FLAG_EMERGENCY | PED_FLAG_PROSTITUTE | PED_FLAG_CRIMINAL | PED_FLAG_SPECIAL );
+}
+
+void EverybodyAttacksPlayerCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ for (int i = PEDTYPE_CIVMALE; i < PEDTYPE_SPECIAL; i++)
+ CPedType::AddThreat(i, PED_FLAG_PLAYER1);
+}
+
+void WeaponsForAllCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ CPopulation::ms_bGivePedsWeapons = !CPopulation::ms_bGivePedsWeapons;
+}
+
+void FastTimeCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ if (CTimer::GetTimeScale() < 4.0f)
+ CTimer::SetTimeScale(CTimer::GetTimeScale() * 2.0f);
+}
+
+void SlowTimeCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ if (CTimer::GetTimeScale() > 0.25f)
+ CTimer::SetTimeScale(CTimer::GetTimeScale() * 0.5f);
+}
+
+void MoneyCheat()
+{
+ CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 250000;
+ CHud::SetHelpMessage(TheText.Get("CHEAT6"), true);
+}
+
+void ArmourCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT4"), true);
+ FindPlayerPed()->m_fArmour = 100.0f;
+}
+
+void WantedLevelUpCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
+ FindPlayerPed()->SetWantedLevel(min(FindPlayerPed()->m_pWanted->m_nWantedLevel + 2, 6));
+}
+
+void WantedLevelDownCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
+ FindPlayerPed()->SetWantedLevel(0);
+}
+
+void SunnyWeatherCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
+ CWeather::ForceWeatherNow(WEATHER_SUNNY);
+}
+
+void CloudyWeatherCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
+ CWeather::ForceWeatherNow(WEATHER_CLOUDY);
+}
+
+void RainyWeatherCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
+ CWeather::ForceWeatherNow(WEATHER_RAINY);
+}
+
+void FoggyWeatherCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
+ CWeather::ForceWeatherNow(WEATHER_FOGGY);
+}
+
+void FastWeatherCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ gbFastTime = !gbFastTime;
+}
+
+void OnlyRenderWheelsCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ CVehicle::bWheelsOnlyCheat = !CVehicle::bWheelsOnlyCheat;
+}
+
+
+void ChittyChittyBangBangCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ CVehicle::bAllDodosCheat = !CVehicle::bAllDodosCheat;
+}
+
+void StrongGripCheat()
+{
+ CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+ CVehicle::bCheat3 = !CVehicle::bCheat3;
+}
+
+void NastyLimbsCheat()
+{
+ CPed::bNastyLimbsCheat = !CPed::bNastyLimbsCheat;
+}
//////////////////////////////////////////////////////////////////////////
#ifdef KANGAROO_CHEAT
@@ -88,7 +283,7 @@ void KangarooCheat()
string = TheText.Get("CHEAT1");
m_fMass = 15.0f;
}
- CHud::SetHelpMessage(string, 1);
+ CHud::SetHelpMessage(string, true);
playerPed->m_ped_flagI80 = !playerPed->m_ped_flagI80;
playerPed->m_fMass = m_fMass;
@@ -137,6 +332,21 @@ void CKeyboardState::Clear()
LWIN = RWIN = APPS = 0;
}
+#ifdef GTA_PS2_STUFF
+void CPad::Initialise(void)
+{
+ for (int i = 0; i < MAX_PADS; i++)
+ {
+ CPad::GetPad(i)->Clear(true);
+ CPad::GetPad(i)->Mode = 0;
+ }
+
+ bObsoleteControllerMessage = false;
+ bOldDisplayNoControllerMessage = false;
+ bDisplayNoControllerMessage = false;
+}
+#endif
+
void CPad::Clear(bool bResetPlayerControls)
{
NewState.Clear();
@@ -164,13 +374,13 @@ void CPad::Clear(bool bResetPlayerControls)
bApplyBrakes = false;
- for ( int32 i = 0; i < _TODOCONST(5); i++ )
+ for ( int32 i = 0; i < HORNHISTORY_SIZE; i++ )
bHornHistory[i] = false;
iCurrHornHistory = 0;
- for ( int32 i = 0; i < _TODOCONST(12); i++ )
- _unk[i] = ' ';
+ for ( int32 i = 0; i < ARRAY_SIZE(CheatString); i++ )
+ CheatString[i] = ' ';
LastTimeTouched = CTimer::GetTimeInMilliseconds();
AverageWeapon = 0;
@@ -429,6 +639,108 @@ void CPad::StartShake_Train(float fX, float fY)
}
}
+#ifdef GTA_PS2_STUFF
+void CPad::AddToCheatString(char c)
+{
+ for ( int32 i = ARRAY_SIZE(CheatString) - 2; i >= 0; i-- )
+ CheatString[i + 1] = CheatString[i];
+
+#define _CHEATCMP(str) strncmp(str, CheatString, sizeof(str)-1)
+ // "4414LDRULDRU" - R2 R2 L1 R2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
+ if ( !_CHEATCMP("URDLURDL4144") )
+ WeaponCheat();
+
+ // "4411LDRULDRU" - R2 R2 L1 L1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
+ else if ( !_CHEATCMP("URDLURDL1144") )
+ MoneyCheat();
+
+ // "4412LDRULDRU" - R2 R2 L1 L2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
+ else if ( !_CHEATCMP("URDLURDL2144") )
+ ArmourCheat();
+
+ // "4413LDRULDRU" - R2 R2 L1 R1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
+ else if ( !_CHEATCMP("URDLURDL3144") )
+ HealthCheat();
+
+ // "4414LRLRLR" - R2 R2 L1 R2 LEFT RIGHT LEFT RIGHT LEFT RIGHT
+ else if ( !_CHEATCMP("RLRLRL4144") )
+ WantedLevelUpCheat();
+
+ // "4414UDUDUD" - R2 R2 L1 R2 UP DOWN UP DOWN UP DOWN
+ else if ( !_CHEATCMP("DUDUDU4144") )
+ WantedLevelDownCheat();
+
+ // "1234432T" - L1 L2 R1 R2 R2 R1 L2 TRIANGLE
+ else if ( !_CHEATCMP("T2344321") )
+ SunnyWeatherCheat();
+
+ // "1234432S" - L1 L2 R1 R2 R2 R1 L2 SQUARE
+ else if ( !_CHEATCMP("S2344321") )
+ CloudyWeatherCheat();
+
+ // "1234432C" - L1 L2 R1 R2 R2 R1 L2 CIRCLE
+ else if ( !_CHEATCMP("C2344321") )
+ RainyWeatherCheat();
+
+ // "1234432X" - L1 L2 R1 R2 R2 R1 L2 CROSS
+ else if ( !_CHEATCMP("X2344321") )
+ FoggyWeatherCheat();
+
+ // "CCCCCC321TCT" - CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE R1 L2 L1 TRIANGLE CIRCLE TRIANGLE
+ else if ( !_CHEATCMP("TCT123CCCCCC") )
+ TankCheat();
+
+ // "CCCSSSSS1TCT" - CIRCLE CIRCLE CIRCLE SQUARE SQUARE SQUARE SQUARE SQUARE L1 TRIANGLE CIRCLE TRIANGLE
+ else if ( !_CHEATCMP("TCT1SSSSSCCC") )
+ FastWeatherCheat();
+
+ // "241324TSCT21" - L2 R2 L1 R1 L2 R2 TRIANGLE SQUARE CIRCLE TRIANGLE L2 L1
+ else if ( !_CHEATCMP("12TCST423142") )
+ BlowUpCarsCheat();
+
+ // "RDLU12ULDR" - RIGHT DOWN LEFT UP L1 L2 UP LEFT DOWN RIGHT
+ else if ( !_CHEATCMP("RDLU21ULDR") )
+ ChangePlayerCheat();
+
+ // "DULUX3421" - DOWN UP LEFT UP CROSS R1 R2 L2 L1
+ else if ( !_CHEATCMP("1243XULUD") )
+ MayhemCheat();
+
+ // "DULUX3412" - DOWN UP LEFT UP CROSS R1 R2 L1 L2
+ else if ( !_CHEATCMP("2143XULUD") )
+ EverybodyAttacksPlayerCheat();
+
+ // "43TX21UD" - R2 R1 TRIANGLE CROSS L2 L1 UP DOWN
+ else if ( !_CHEATCMP("DU12XT34") )
+ WeaponsForAllCheat();
+
+ // "TURDS12" - TRIANGLE UP RIGHT DOWN SQUARE L1 L2
+ else if ( !_CHEATCMP("21SDRUT") )
+ FastTimeCheat();
+
+ // "TURDS34" - TRIANGLE UP RIGHT DOWN SQUARE R1 R2
+ else if ( !_CHEATCMP("43SDRUT") )
+ SlowTimeCheat();
+
+ // "11S4T1T" - L1 L1 SQUARE R2 TRIANGLE L1 TRIANGLE
+ else if ( !_CHEATCMP("T1T4S11") )
+ OnlyRenderWheelsCheat();
+
+ // "R4C32D13" - RIGHT R2 CIRCLE R1 L2 DOWN L1 R1
+ else if ( !_CHEATCMP("31D23C4R") )
+ ChittyChittyBangBangCheat();
+
+ // "3141L33T" - R1 L1 R2 L1 LEFT R1 R1 TRIANGLE
+ else if ( !_CHEATCMP("T33L1413") )
+ StrongGripCheat();
+
+ // "S1CD13TR1X" - SQUARE L1 CIRCLE DOWN L1 R1 TRIANGLE RIGHT L1 CROSS
+ else if ( !_CHEATCMP("X1RT31DC1S") )
+ NastyLimbsCheat();
+#undef _CHEATCMP
+}
+#endif
+
void CPad::AddToPCCheatString(char c)
{
for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- )
@@ -657,16 +969,21 @@ void CPad::Update(int16 unk)
{
OldState = NewState;
- NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
- NewState = ReconcileTwoControllersInput(PCTempMouseState, NewState);
-
+#if (defined GTA_PS2 || defined FIX_BUGS)
+ if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(unk))
+#endif
+ {
+ NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
+ NewState = ReconcileTwoControllersInput(PCTempMouseState, NewState);
+ }
+
PCTempJoyState.Clear();
PCTempKeyState.Clear();
PCTempMouseState.Clear();
ProcessPCSpecificStuff();
- if ( ++iCurrHornHistory >= _TODOCONST(5) )
+ if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
iCurrHornHistory = 0;
bHornHistory[iCurrHornHistory] = GetHorn();
@@ -683,7 +1000,7 @@ void CPad::DoCheats(void)
void CPad::DoCheats(int16 unk)
{
-#ifdef PS2
+#ifdef GTA_PS2_STUFF
if ( GetTriangleJustDown() )
AddToCheatString('T');
@@ -2086,7 +2403,31 @@ int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize)
return pRsKeys;
}
-STARTPATCHES
+STARTPATCHES
+ InjectHook(0x490D90, &WeaponCheat, PATCH_JUMP);
+ InjectHook(0x490E70, &HealthCheat, PATCH_JUMP);
+ InjectHook(0x490EE0, &TankCheat, PATCH_JUMP);
+ InjectHook(0x491040, &BlowUpCarsCheat, PATCH_JUMP);
+ InjectHook(0x4910B0, &ChangePlayerCheat, PATCH_JUMP);
+ InjectHook(0x4911C0, &MayhemCheat, PATCH_JUMP);
+ InjectHook(0x491270, &EverybodyAttacksPlayerCheat, PATCH_JUMP);
+ InjectHook(0x491370, &WeaponsForAllCheat, PATCH_JUMP);
+ InjectHook(0x4913A0, &FastTimeCheat, PATCH_JUMP);
+ InjectHook(0x4913F0, &SlowTimeCheat, PATCH_JUMP);
+ InjectHook(0x491430, &MoneyCheat, PATCH_JUMP);
+ InjectHook(0x491460, &ArmourCheat, PATCH_JUMP);
+ InjectHook(0x491490, &WantedLevelUpCheat, PATCH_JUMP);
+ InjectHook(0x4914F0, &WantedLevelDownCheat, PATCH_JUMP);
+ InjectHook(0x491520, &SunnyWeatherCheat, PATCH_JUMP);
+ InjectHook(0x491550, &CloudyWeatherCheat, PATCH_JUMP);
+ InjectHook(0x491580, &RainyWeatherCheat, PATCH_JUMP);
+ InjectHook(0x4915B0, &FoggyWeatherCheat, PATCH_JUMP);
+ InjectHook(0x4915E0, &FastWeatherCheat, PATCH_JUMP);
+ InjectHook(0x491610, &OnlyRenderWheelsCheat, PATCH_JUMP);
+ InjectHook(0x491640, &ChittyChittyBangBangCheat, PATCH_JUMP);
+ InjectHook(0x491670, &StrongGripCheat, PATCH_JUMP);
+ InjectHook(0x4916A0, &NastyLimbsCheat, PATCH_JUMP);
+
InjectHook(0x4916C0, &CControllerState::Clear, PATCH_JUMP);
InjectHook(0x491760, &CKeyboardState::Clear, PATCH_JUMP);
InjectHook(0x491A10, &CPad::Clear, PATCH_JUMP);
diff --git a/src/core/Pad.h b/src/core/Pad.h
index ca44a9f7..cb705c6b 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -136,6 +136,10 @@ enum
class CPad
{
public:
+ enum
+ {
+ HORNHISTORY_SIZE = 5,
+ };
CControllerState NewState;
CControllerState OldState;
CControllerState PCTempKeyState;
@@ -146,11 +150,11 @@ public:
int16 Mode;
int16 ShakeDur;
uint8 ShakeFreq;
- bool bHornHistory[5];
+ bool bHornHistory[HORNHISTORY_SIZE];
uint8 iCurrHornHistory;
uint8 DisablePlayerControls;
int8 bApplyBrakes;
- char _unk[12]; //int32 unk[3];
+ char CheatString[12];
char _pad0[3];
int32 LastTimeTouched;
int32 AverageWeapon;
@@ -161,6 +165,7 @@ public:
static bool &bDisplayNoControllerMessage;
static bool &bObsoleteControllerMessage;
+ static bool bOldDisplayNoControllerMessage;
static bool &m_bMapPadOneToPadTwo;
static CKeyboardState &OldKeyState;
@@ -172,8 +177,9 @@ public:
static CMouseControllerState &PCTempMouseControllerState;
-
-
+#ifdef GTA_PS2_STUFF
+ static void Initialise(void);
+#endif
void Clear(bool bResetPlayerControls);
void ClearMouseHistory();
void UpdateMouse();
@@ -181,6 +187,9 @@ public:
void StartShake(int16 nDur, uint8 nFreq);
void StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fz);
void StartShake_Train(float fX, float fY);
+#ifdef GTA_PS2_STUFF
+ void AddToCheatString(char c);
+#endif
void AddToPCCheatString(char c);
static void UpdatePads(void);
@@ -409,6 +418,7 @@ public:
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
+ bool GetTriangleJustUp() { return !!(!NewState.Triangle && OldState.Triangle); }
bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); }
bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); }
bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); }
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index ead32ee7..0043c2f4 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -48,45 +48,45 @@ CPlayerInfo::GetPos()
void
CPlayerInfo::LoadPlayerSkin()
-{
- DeletePlayerSkin();
-
- m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
- if (!m_pSkinTexture)
+{
+ DeletePlayerSkin();
+
+ m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
+ if (!m_pSkinTexture)
m_pSkinTexture = CPlayerSkin::GetSkinTexture(DEFAULT_SKIN_NAME);
}
void
CPlayerInfo::DeletePlayerSkin()
-{
- if (m_pSkinTexture) {
- RwTextureDestroy(m_pSkinTexture);
- m_pSkinTexture = nil;
+{
+ if (m_pSkinTexture) {
+ RwTextureDestroy(m_pSkinTexture);
+ m_pSkinTexture = nil;
}
}
-void
-CPlayerInfo::KillPlayer()
-{
- if (m_WBState != WBSTATE_PLAYING) return;
-
- m_WBState = WBSTATE_WASTED;
- m_nWBTime = CTimer::GetTimeInMilliseconds();
- CDarkel::ResetOnPlayerDeath();
- CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
- CStats::TimesDied++;
+void
+CPlayerInfo::KillPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_WASTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
+ CStats::TimesDied++;
}
-void
-CPlayerInfo::ArrestPlayer()
-{
- if (m_WBState != WBSTATE_PLAYING) return;
-
- m_WBState = WBSTATE_BUSTED;
- m_nWBTime = CTimer::GetTimeInMilliseconds();
- CDarkel::ResetOnPlayerDeath();
- CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
- CStats::TimesArrested++;
+void
+CPlayerInfo::ArrestPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_BUSTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
+ CStats::TimesArrested++;
}
bool
@@ -105,102 +105,102 @@ CPlayerInfo::PlayerFailedCriticalMission()
CDarkel::ResetOnPlayerDeath();
}
-void
-CPlayerInfo::Clear(void)
-{
- m_pPed = nil;
- m_pRemoteVehicle = nil;
- if (m_pVehicleEx) {
- m_pVehicleEx->bUsingSpecialColModel = false;
- m_pVehicleEx = nil;
- }
- m_nVisibleMoney = 0;
- m_nMoney = m_nVisibleMoney;
- m_WBState = WBSTATE_PLAYING;
- m_nWBTime = 0;
- m_nTrafficMultiplier = 0;
- m_fRoadDensity = 1.0f;
- m_bInRemoteMode = false;
- m_bUnusedTaxiThing = false;
- m_nUnusedTaxiTimer = 0;
- m_nCollectedPackages = 0;
- m_nTotalPackages = 3;
- m_nTimeLastHealthLoss = 0;
- m_nTimeLastArmourLoss = 0;
- m_nNextSexFrequencyUpdateTime = 0;
- m_nNextSexMoneyUpdateTime = 0;
- m_nSexFrequency = 0;
- m_pHooker = nil;
- m_nTimeTankShotGun = 0;
- field_248 = 0;
- m_nUpsideDownCounter = 0;
- m_bInfiniteSprint = false;
- m_bFastReload = false;
- m_bGetOutOfJailFree = false;
- m_bGetOutOfHospitalFree = false;
- m_nPreviousTimeRewardedForExplosion = 0;
- m_nExplosionsSinceLastReward = 0;
+void
+CPlayerInfo::Clear(void)
+{
+ m_pPed = nil;
+ m_pRemoteVehicle = nil;
+ if (m_pVehicleEx) {
+ m_pVehicleEx->bUsingSpecialColModel = false;
+ m_pVehicleEx = nil;
+ }
+ m_nVisibleMoney = 0;
+ m_nMoney = m_nVisibleMoney;
+ m_WBState = WBSTATE_PLAYING;
+ m_nWBTime = 0;
+ m_nTrafficMultiplier = 0;
+ m_fRoadDensity = 1.0f;
+ m_bInRemoteMode = false;
+ m_bUnusedTaxiThing = false;
+ m_nUnusedTaxiTimer = 0;
+ m_nCollectedPackages = 0;
+ m_nTotalPackages = 3;
+ m_nTimeLastHealthLoss = 0;
+ m_nTimeLastArmourLoss = 0;
+ m_nNextSexFrequencyUpdateTime = 0;
+ m_nNextSexMoneyUpdateTime = 0;
+ m_nSexFrequency = 0;
+ m_pHooker = nil;
+ m_nTimeTankShotGun = 0;
+ field_248 = 0;
+ m_nUpsideDownCounter = 0;
+ m_bInfiniteSprint = false;
+ m_bFastReload = false;
+ m_bGetOutOfJailFree = false;
+ m_bGetOutOfHospitalFree = false;
+ m_nPreviousTimeRewardedForExplosion = 0;
+ m_nExplosionsSinceLastReward = 0;
}
-void
-CPlayerInfo::BlowUpRCBuggy(void)
-{
- if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
- return;
-
- CRemote::TakeRemoteControlledCarFromPlayer();
- m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
+void
+CPlayerInfo::BlowUpRCBuggy(void)
+{
+ if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
+ return;
+
+ CRemote::TakeRemoteControlledCarFromPlayer();
+ m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
}
-
-void
-CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
-{
- if (!car || car == m_pPed->m_pMyVehicle) {
- if (m_pPed->EnteringCar())
- m_pPed->QuitEnteringCar();
- }
- if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
- m_pPed->ClearObjective();
+
+void
+CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
+{
+ if (!car || car == m_pPed->m_pMyVehicle) {
+ if (m_pPed->EnteringCar())
+ m_pPed->QuitEnteringCar();
+ }
+ if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
+ m_pPed->ClearObjective();
}
-void
-CPlayerInfo::MakePlayerSafe(bool toggle)
-{
- if (toggle) {
- CTheScripts::ResetCountdownToMakePlayerUnsafe();
- m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
- CWorld::StopAllLawEnforcersInTheirTracks();
- CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20;
- CPad::StopPadsShaking();
- m_pPed->bBulletProof = true;
- m_pPed->bFireProof = true;
- m_pPed->bCollisionProof = true;
- m_pPed->bMeleeProof = true;
- m_pPed->bOnlyDamagedByPlayer = true;
- m_pPed->bExplosionProof = true;
- m_pPed->m_bCanBeDamaged = false;
- ((CPlayerPed*)m_pPed)->ClearAdrenaline();
- CancelPlayerEnteringCars(false);
- gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
- CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
- CProjectileInfo::RemoveAllProjectiles();
- CWorld::SetAllCarsCanBeDamaged(false);
- CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
- CReplay::DisableReplays();
-
- } else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
- m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20;
- m_pPed->bBulletProof = false;
- m_pPed->bFireProof = false;
- m_pPed->bCollisionProof = false;
- m_pPed->bMeleeProof = false;
- m_pPed->bOnlyDamagedByPlayer = false;
- m_pPed->bExplosionProof = false;
- m_pPed->m_bCanBeDamaged = true;
- CWorld::SetAllCarsCanBeDamaged(true);
- CReplay::EnableReplays();
- }
+void
+CPlayerInfo::MakePlayerSafe(bool toggle)
+{
+ if (toggle) {
+ CTheScripts::ResetCountdownToMakePlayerUnsafe();
+ m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
+ CWorld::StopAllLawEnforcersInTheirTracks();
+ CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20;
+ CPad::StopPadsShaking();
+ m_pPed->bBulletProof = true;
+ m_pPed->bFireProof = true;
+ m_pPed->bCollisionProof = true;
+ m_pPed->bMeleeProof = true;
+ m_pPed->bOnlyDamagedByPlayer = true;
+ m_pPed->bExplosionProof = true;
+ m_pPed->m_bCanBeDamaged = false;
+ ((CPlayerPed*)m_pPed)->ClearAdrenaline();
+ CancelPlayerEnteringCars(false);
+ gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
+ CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
+ CProjectileInfo::RemoveAllProjectiles();
+ CWorld::SetAllCarsCanBeDamaged(false);
+ CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
+ CReplay::DisableReplays();
+
+ } else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
+ m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
+ CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20;
+ m_pPed->bBulletProof = false;
+ m_pPed->bFireProof = false;
+ m_pPed->bCollisionProof = false;
+ m_pPed->bMeleeProof = false;
+ m_pPed->bOnlyDamagedByPlayer = false;
+ m_pPed->bExplosionProof = false;
+ m_pPed->m_bCanBeDamaged = true;
+ CWorld::SetAllCarsCanBeDamaged(true);
+ CReplay::EnableReplays();
+ }
}
bool
@@ -216,347 +216,347 @@ CPlayerInfo::IsRestartingAfterArrest()
}
// lastCloseness is passed to other calls of this function
-void
-CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
-{
- // This dist used for determining the angle to face
- CVector2D dist(carToTest->GetPosition() - player->GetPosition());
- float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
- while (neededTurn >= PI) {
- neededTurn -= 2 * PI;
- }
-
- while (neededTurn < -PI) {
- neededTurn += 2 * PI;
- }
-
- // This dist used for evaluating cars' distances, weird...
- // Accounts inverted needed turn (or needed turn in long way) and car dist.
- float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
- if (closeness > *lastCloseness) {
- *lastCloseness = closeness;
- *closestCarOutput = (CVehicle*)carToTest;
- }
+void
+CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
+{
+ // This dist used for determining the angle to face
+ CVector2D dist(carToTest->GetPosition() - player->GetPosition());
+ float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
+ while (neededTurn >= PI) {
+ neededTurn -= 2 * PI;
+ }
+
+ while (neededTurn < -PI) {
+ neededTurn += 2 * PI;
+ }
+
+ // This dist used for evaluating cars' distances, weird...
+ // Accounts inverted needed turn (or needed turn in long way) and car dist.
+ float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
+ if (closeness > *lastCloseness) {
+ *lastCloseness = closeness;
+ *closestCarOutput = (CVehicle*)carToTest;
+ }
}
// There is something unfinished in here... Sadly all IDBs we have have it unfinished.
-void
-CPlayerInfo::AwardMoneyForExplosion(CVehicle *wreckedCar)
-{
- if (CTimer::GetTimeInMilliseconds() - m_nPreviousTimeRewardedForExplosion < 6000)
- ++m_nExplosionsSinceLastReward;
- else
- m_nExplosionsSinceLastReward = 1;
-
- m_nPreviousTimeRewardedForExplosion = CTimer::GetTimeInMilliseconds();
- int award = wreckedCar->pHandling->nMonetaryValue * 0.002f;
- sprintf(gString, "$%d", award);
-#ifdef MONEY_MESSAGES
- // This line is a leftover from PS2, I don't know what it was meant to be.
- // CVector sth(TheCamera.GetPosition() * 4.0f);
-
- CMoneyMessages::RegisterOne(wreckedCar->GetPosition() + CVector(0.0f, 0.0f, 2.0f), gString, 0, 255, 0, 2.0f, 0.5f);
-#endif
- CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
-
- for (int i = m_nExplosionsSinceLastReward; i > 1; --i) {
- CGeneral::GetRandomNumber();
- CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
- }
+void
+CPlayerInfo::AwardMoneyForExplosion(CVehicle *wreckedCar)
+{
+ if (CTimer::GetTimeInMilliseconds() - m_nPreviousTimeRewardedForExplosion < 6000)
+ ++m_nExplosionsSinceLastReward;
+ else
+ m_nExplosionsSinceLastReward = 1;
+
+ m_nPreviousTimeRewardedForExplosion = CTimer::GetTimeInMilliseconds();
+ int award = wreckedCar->pHandling->nMonetaryValue * 0.002f;
+ sprintf(gString, "$%d", award);
+#ifdef MONEY_MESSAGES
+ // This line is a leftover from PS2, I don't know what it was meant to be.
+ // CVector sth(TheCamera.GetPosition() * 4.0f);
+
+ CMoneyMessages::RegisterOne(wreckedCar->GetPosition() + CVector(0.0f, 0.0f, 2.0f), gString, 0, 255, 0, 2.0f, 0.5f);
+#endif
+ CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
+
+ for (int i = m_nExplosionsSinceLastReward; i > 1; --i) {
+ CGeneral::GetRandomNumber();
+ CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
+ }
}
-void
-CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
-{
- // Interesting
- *size = sizeof(CPlayerInfo);
-
-INITSAVEBUF
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
- for (int i = 0; i < sizeof(CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName); i++) {
- WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName[i]);
- }
-// Save struct is different
-// VALIDATESAVEBUF(*size)
+void
+CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
+{
+ // Interesting
+ *size = sizeof(CPlayerInfo);
+
+INITSAVEBUF
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
+ for (int i = 0; i < sizeof(CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName); i++) {
+ WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName[i]);
+ }
+// Save struct is different
+// VALIDATESAVEBUF(*size)
}
-void
-CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
-{
-INITSAVEBUF
- CWorld::Players[CWorld::PlayerInFocus].m_nMoney = ReadSaveBuf<uint32>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_WBState = ReadSaveBuf<int8>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_nWBTime = ReadSaveBuf<uint32>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier = ReadSaveBuf<int16>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity = ReadSaveBuf<float>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney = ReadSaveBuf<int32>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages = ReadSaveBuf<int32>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = ReadSaveBuf<int32>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint = ReadSaveBuf<bool>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_bFastReload = ReadSaveBuf<bool>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree = ReadSaveBuf<bool>(buf);
- CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree = ReadSaveBuf<bool>(buf);
- for (int i = 0; i < sizeof(CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName); i++) {
- CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName[i] = ReadSaveBuf<char>(buf);
- }
-// Save struct is different
-// VALIDATESAVEBUF(size)
+void
+CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
+{
+INITSAVEBUF
+ CWorld::Players[CWorld::PlayerInFocus].m_nMoney = ReadSaveBuf<uint32>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_WBState = ReadSaveBuf<int8>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_nWBTime = ReadSaveBuf<uint32>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier = ReadSaveBuf<int16>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity = ReadSaveBuf<float>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney = ReadSaveBuf<int32>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages = ReadSaveBuf<int32>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = ReadSaveBuf<int32>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint = ReadSaveBuf<bool>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_bFastReload = ReadSaveBuf<bool>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree = ReadSaveBuf<bool>(buf);
+ CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree = ReadSaveBuf<bool>(buf);
+ for (int i = 0; i < sizeof(CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName); i++) {
+ CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName[i] = ReadSaveBuf<char>(buf);
+ }
+// Save struct is different
+// VALIDATESAVEBUF(size)
}
-void
-CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
-{
- for (CPtrNode* node = carList.first; node; node = node->next) {
- CVehicle *car = (CVehicle*)node->item;
- if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
- if (!car->bUsesCollision || !car->IsVehicle())
- continue;
-
- car->m_scanCode = CWorld::GetCurrentScanCode();
- if (car->m_status != STATUS_WRECKED && car->m_status != STATUS_TRAIN_MOVING
- && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
- CVector carCentre = car->GetBoundCentre();
-
- if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f) {
- float dist = (ped->GetPosition() - carCentre).Magnitude2D();
- if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
- EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
- }
- }
- }
- }
- }
+void
+CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
+{
+ for (CPtrNode* node = carList.first; node; node = node->next) {
+ CVehicle *car = (CVehicle*)node->item;
+ if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
+ if (!car->bUsesCollision || !car->IsVehicle())
+ continue;
+
+ car->m_scanCode = CWorld::GetCurrentScanCode();
+ if (car->m_status != STATUS_WRECKED && car->m_status != STATUS_TRAIN_MOVING
+ && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
+ CVector carCentre = car->GetBoundCentre();
+
+ if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f) {
+ float dist = (ped->GetPosition() - carCentre).Magnitude2D();
+ if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
+ EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
+ }
+ }
+ }
+ }
+ }
}
-void
-CPlayerInfo::Process(void)
-{
- // Unused taxi feature. Gives you a dollar for every second with a passenger. Can be toggled via 0x29A opcode.
- bool startTaxiTimer = true;
- if (m_bUnusedTaxiThing && m_pPed->bInVehicle) {
- CVehicle *veh = m_pPed->m_pMyVehicle;
- if ((veh->m_modelIndex == MI_TAXI || veh->m_modelIndex == MI_CABBIE || veh->m_modelIndex == MI_BORGNINE)
- && veh->pDriver == m_pPed && veh->m_nNumPassengers != 0) {
- for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) {
- timePassed -= 1000;
- ++m_nMoney;
- }
- startTaxiTimer = false;
- }
- }
- if (startTaxiTimer)
- m_nUnusedTaxiTimer = CTimer::GetTimeInMilliseconds();
-
- // The effect that makes money counter does while earning/losing money
- if (m_nVisibleMoney != m_nMoney) {
- int diff = m_nMoney - m_nVisibleMoney;
- int diffAbs = Abs(diff);
- int changeBy;
-
- if (diffAbs > 100000)
- changeBy = 12345;
- else if (diffAbs > 10000)
- changeBy = 1234;
- else if (diffAbs > 1000)
- changeBy = 123;
- else if (diffAbs > 50)
- changeBy = 42;
- else
- changeBy = 1;
-
- if (diff < 0)
- m_nVisibleMoney -= changeBy;
- else
- m_nVisibleMoney += changeBy;
- }
-
- if (!(CTimer::GetFrameCounter() & 15)) {
- CVector2D playerPos = m_pPed->bInVehicle ? m_pPed->m_pMyVehicle->GetPosition() : m_pPed->GetPosition();
- m_fRoadDensity = ThePaths.CalcRoadDensity(playerPos.x, playerPos.y);
- }
-
- m_fRoadDensity = clamp(m_fRoadDensity, 0.4f, 1.45f);
-
- // Because vehicle enter/exit use same key binding.
- bool enterOrExitVeh;
- if (m_pPed->bVehExitWillBeInstant && m_pPed->bInVehicle)
- enterOrExitVeh = CPad::GetPad(0)->ExitVehicleJustDown();
- else
- enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();
-
- if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_ODE) {
- if (m_pPed->bInVehicle) {
- if (!m_pRemoteVehicle) {
- CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;
- if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->m_modelIndex)) {
- CVehicle *veh = m_pPed->m_pMyVehicle;
- if (!veh->IsBoat() || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
-
- // This condition will always return true, else block was probably WIP Miami code.
- if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
- if (veh->m_status != STATUS_WRECKED && veh->m_status != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) {
- if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) {
- m_pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh);
- }
- }
- } else {
- CVector sth = 0.7f * veh->GetRight() + veh->GetPosition();
- bool found = false;
- float groundZ = CWorld::FindGroundZFor3DCoord(sth.x, sth.y, 2.0f + sth.z, &found);
-
- if (found)
- sth.z = 1.0f + groundZ;
- m_pPed->m_nPedState = PED_IDLE;
- m_pPed->SetMoveState(PEDMOVE_STILL);
- CPed::PedSetOutCarCB(0, m_pPed);
- CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
- CAnimManager::BlendAnimation(m_pPed->GetClump(), ASSOCGRP_STD, ANIM_FALL_LAND, 100.0f);
- m_pPed->GetPosition() = sth;
- m_pPed->SetMoveState(PEDMOVE_STILL);
- m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed;
- }
- } else {
- // The code in here was under CPed::SetExitBoat in VC, did the same for here.
- m_pPed->SetExitBoat(veh);
- m_pPed->bTryingToReachDryLand = true;
- }
- }
- }
- } else {
- // Enter vehicle
- if (CPad::GetPad(0)->ExitVehicleJustDown()) {
- bool weAreOnBoat = false;
- float lastCloseness = 0.0f;
- CVehicle *carBelow = nil;
- CEntity *surfaceBelow = m_pPed->m_pCurrentPhysSurface;
- if (surfaceBelow && surfaceBelow->IsVehicle()) {
- carBelow = (CVehicle*)surfaceBelow;
- if (carBelow->IsBoat()) {
- weAreOnBoat = true;
- m_pPed->bOnBoat = true;
-#ifdef VC_PED_PORTS
- if (carBelow->m_status != STATUS_WRECKED && carBelow->GetUp().z > 0.3f)
-#else
- if (carBelow->m_status != STATUS_WRECKED)
-#endif
- m_pPed->SetSeekBoatPosition(carBelow);
- }
- }
- // Find closest car
- if (!weAreOnBoat) {
- float minX = m_pPed->GetPosition().x - 10.0f;
- float maxX = 10.0f + m_pPed->GetPosition().x;
- float minY = m_pPed->GetPosition().y - 10.0f;
- float maxY = 10.0f + m_pPed->GetPosition().y;
-
- int minXSector = CWorld::GetSectorIndexX(minX);
- if (minXSector < 0) minXSector = 0;
- int minYSector = CWorld::GetSectorIndexY(minY);
- if (minYSector < 0) minYSector = 0;
- int maxXSector = CWorld::GetSectorIndexX(maxX);
- if (maxXSector > NUMSECTORS_X - 1) maxXSector = NUMSECTORS_X - 1;
- int maxYSector = CWorld::GetSectorIndexY(maxY);
- if (maxYSector > NUMSECTORS_Y - 1) maxYSector = NUMSECTORS_Y - 1;
-
- CWorld::AdvanceCurrentScanCode();
-
- for (int curY = minYSector; curY <= maxYSector; curY++) {
- for (int curX = minXSector; curX <= maxXSector; curX++) {
- CSector *sector = CWorld::GetSector(curX, curY);
- FindClosestCarSectorList(sector->m_lists[ENTITYLIST_VEHICLES], m_pPed,
- minX, minY, maxX, maxY, &lastCloseness, &carBelow);
- FindClosestCarSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], m_pPed,
- minX, minY, maxX, maxY, &lastCloseness, &carBelow);
- }
- }
- }
- // carBelow is now closest vehicle
- if (carBelow && !weAreOnBoat) {
- if (carBelow->m_status == STATUS_TRAIN_NOT_MOVING) {
- m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
- } else if (carBelow->IsBoat()) {
- if (!carBelow->pDriver) {
- m_pPed->m_vehEnterType = 0;
- m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType);
- }
- } else {
- m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow);
- }
- }
- }
- }
- }
- if (m_bInRemoteMode) {
- uint32 timeWithoutRemoteCar = CTimer::GetTimeInMilliseconds() - m_nTimeLostRemoteCar;
- if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING) {
- TheCamera.SetFadeColour(0, 0, 0);
- TheCamera.Fade(1.0f, 0);
- }
- if (timeWithoutRemoteCar > 2000) {
- if (m_WBState == WBSTATE_PLAYING) {
- TheCamera.RestoreWithJumpCut();
- TheCamera.SetFadeColour(0, 0, 0);
- TheCamera.Fade(1.0f, 1);
- TheCamera.Process();
- CTimer::Stop();
- CCullZones::ForceCullZoneCoors(TheCamera.GetPosition());
- CRenderer::RequestObjectsInFrustum();
- CStreaming::LoadAllRequestedModels(false);
- CTimer::Update();
- }
- m_bInRemoteMode = false;
- CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil;
- if (FindPlayerVehicle()) {
- FindPlayerVehicle()->m_status = STATUS_PLAYER;
- }
- }
- }
- if (!(CTimer::GetFrameCounter() & 31)) {
- CVehicle *veh = FindPlayerVehicle();
- if (veh && m_pPed->bInVehicle && veh->GetUp().z < 0.0f
- && veh->m_vecMoveSpeed.Magnitude() < 0.05f && veh->IsCar() && !veh->bIsInWater) {
-
- if (veh->GetUp().z < -0.5f) {
- m_nUpsideDownCounter += 2;
-
- } else {
- m_nUpsideDownCounter++;
- }
- } else {
- m_nUpsideDownCounter = 0;
- }
-
- if (m_nUpsideDownCounter > 6 && veh->bCanBeDamaged) {
- veh->m_fHealth = 249.0f < veh->m_fHealth ? 249.0f : veh->m_fHealth;
- if (veh->IsCar()) {
- CAutomobile* car = (CAutomobile*)veh;
- car->Damage.SetEngineStatus(225);
- car->m_pSetOnFireEntity = nil;
- }
- }
- }
- if (FindPlayerVehicle()) {
- CVehicle *veh = FindPlayerVehicle();
- veh->m_nZoneLevel = -1;
- for (int i = 0; i < ARRAY_SIZE(veh->pPassengers); i++) {
- if (veh->pPassengers[i])
- veh->pPassengers[i]->m_nZoneLevel = 0;
- }
- CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled;
- } else {
- CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled;
- }
+void
+CPlayerInfo::Process(void)
+{
+ // Unused taxi feature. Gives you a dollar for every second with a passenger. Can be toggled via 0x29A opcode.
+ bool startTaxiTimer = true;
+ if (m_bUnusedTaxiThing && m_pPed->bInVehicle) {
+ CVehicle *veh = m_pPed->m_pMyVehicle;
+ if ((veh->m_modelIndex == MI_TAXI || veh->m_modelIndex == MI_CABBIE || veh->m_modelIndex == MI_BORGNINE)
+ && veh->pDriver == m_pPed && veh->m_nNumPassengers != 0) {
+ for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) {
+ timePassed -= 1000;
+ ++m_nMoney;
+ }
+ startTaxiTimer = false;
+ }
+ }
+ if (startTaxiTimer)
+ m_nUnusedTaxiTimer = CTimer::GetTimeInMilliseconds();
+
+ // The effect that makes money counter does while earning/losing money
+ if (m_nVisibleMoney != m_nMoney) {
+ int diff = m_nMoney - m_nVisibleMoney;
+ int diffAbs = Abs(diff);
+ int changeBy;
+
+ if (diffAbs > 100000)
+ changeBy = 12345;
+ else if (diffAbs > 10000)
+ changeBy = 1234;
+ else if (diffAbs > 1000)
+ changeBy = 123;
+ else if (diffAbs > 50)
+ changeBy = 42;
+ else
+ changeBy = 1;
+
+ if (diff < 0)
+ m_nVisibleMoney -= changeBy;
+ else
+ m_nVisibleMoney += changeBy;
+ }
+
+ if (!(CTimer::GetFrameCounter() & 15)) {
+ CVector2D playerPos = m_pPed->bInVehicle ? m_pPed->m_pMyVehicle->GetPosition() : m_pPed->GetPosition();
+ m_fRoadDensity = ThePaths.CalcRoadDensity(playerPos.x, playerPos.y);
+ }
+
+ m_fRoadDensity = clamp(m_fRoadDensity, 0.4f, 1.45f);
+
+ // Because vehicle enter/exit use same key binding.
+ bool enterOrExitVeh;
+ if (m_pPed->bVehExitWillBeInstant && m_pPed->bInVehicle)
+ enterOrExitVeh = CPad::GetPad(0)->ExitVehicleJustDown();
+ else
+ enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();
+
+ if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_ODE) {
+ if (m_pPed->bInVehicle) {
+ if (!m_pRemoteVehicle) {
+ CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;
+ if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->m_modelIndex)) {
+ CVehicle *veh = m_pPed->m_pMyVehicle;
+ if (!veh->IsBoat() || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
+
+ // This condition will always return true, else block was probably WIP Miami code.
+ if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
+ if (veh->m_status != STATUS_WRECKED && veh->m_status != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) {
+ if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) {
+ m_pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh);
+ }
+ }
+ } else {
+ CVector sth = 0.7f * veh->GetRight() + veh->GetPosition();
+ bool found = false;
+ float groundZ = CWorld::FindGroundZFor3DCoord(sth.x, sth.y, 2.0f + sth.z, &found);
+
+ if (found)
+ sth.z = 1.0f + groundZ;
+ m_pPed->m_nPedState = PED_IDLE;
+ m_pPed->SetMoveState(PEDMOVE_STILL);
+ CPed::PedSetOutCarCB(0, m_pPed);
+ CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
+ CAnimManager::BlendAnimation(m_pPed->GetClump(), ASSOCGRP_STD, ANIM_FALL_LAND, 100.0f);
+ m_pPed->GetPosition() = sth;
+ m_pPed->SetMoveState(PEDMOVE_STILL);
+ m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed;
+ }
+ } else {
+ // The code in here was under CPed::SetExitBoat in VC, did the same for here.
+ m_pPed->SetExitBoat(veh);
+ m_pPed->bTryingToReachDryLand = true;
+ }
+ }
+ }
+ } else {
+ // Enter vehicle
+ if (CPad::GetPad(0)->ExitVehicleJustDown()) {
+ bool weAreOnBoat = false;
+ float lastCloseness = 0.0f;
+ CVehicle *carBelow = nil;
+ CEntity *surfaceBelow = m_pPed->m_pCurrentPhysSurface;
+ if (surfaceBelow && surfaceBelow->IsVehicle()) {
+ carBelow = (CVehicle*)surfaceBelow;
+ if (carBelow->IsBoat()) {
+ weAreOnBoat = true;
+ m_pPed->bOnBoat = true;
+#ifdef VC_PED_PORTS
+ if (carBelow->m_status != STATUS_WRECKED && carBelow->GetUp().z > 0.3f)
+#else
+ if (carBelow->m_status != STATUS_WRECKED)
+#endif
+ m_pPed->SetSeekBoatPosition(carBelow);
+ }
+ }
+ // Find closest car
+ if (!weAreOnBoat) {
+ float minX = m_pPed->GetPosition().x - 10.0f;
+ float maxX = 10.0f + m_pPed->GetPosition().x;
+ float minY = m_pPed->GetPosition().y - 10.0f;
+ float maxY = 10.0f + m_pPed->GetPosition().y;
+
+ int minXSector = CWorld::GetSectorIndexX(minX);
+ if (minXSector < 0) minXSector = 0;
+ int minYSector = CWorld::GetSectorIndexY(minY);
+ if (minYSector < 0) minYSector = 0;
+ int maxXSector = CWorld::GetSectorIndexX(maxX);
+ if (maxXSector > NUMSECTORS_X - 1) maxXSector = NUMSECTORS_X - 1;
+ int maxYSector = CWorld::GetSectorIndexY(maxY);
+ if (maxYSector > NUMSECTORS_Y - 1) maxYSector = NUMSECTORS_Y - 1;
+
+ CWorld::AdvanceCurrentScanCode();
+
+ for (int curY = minYSector; curY <= maxYSector; curY++) {
+ for (int curX = minXSector; curX <= maxXSector; curX++) {
+ CSector *sector = CWorld::GetSector(curX, curY);
+ FindClosestCarSectorList(sector->m_lists[ENTITYLIST_VEHICLES], m_pPed,
+ minX, minY, maxX, maxY, &lastCloseness, &carBelow);
+ FindClosestCarSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], m_pPed,
+ minX, minY, maxX, maxY, &lastCloseness, &carBelow);
+ }
+ }
+ }
+ // carBelow is now closest vehicle
+ if (carBelow && !weAreOnBoat) {
+ if (carBelow->m_status == STATUS_TRAIN_NOT_MOVING) {
+ m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
+ } else if (carBelow->IsBoat()) {
+ if (!carBelow->pDriver) {
+ m_pPed->m_vehEnterType = 0;
+ m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType);
+ }
+ } else {
+ m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow);
+ }
+ }
+ }
+ }
+ }
+ if (m_bInRemoteMode) {
+ uint32 timeWithoutRemoteCar = CTimer::GetTimeInMilliseconds() - m_nTimeLostRemoteCar;
+ if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING) {
+ TheCamera.SetFadeColour(0, 0, 0);
+ TheCamera.Fade(1.0f, 0);
+ }
+ if (timeWithoutRemoteCar > 2000) {
+ if (m_WBState == WBSTATE_PLAYING) {
+ TheCamera.RestoreWithJumpCut();
+ TheCamera.SetFadeColour(0, 0, 0);
+ TheCamera.Fade(1.0f, 1);
+ TheCamera.Process();
+ CTimer::Stop();
+ CCullZones::ForceCullZoneCoors(TheCamera.GetPosition());
+ CRenderer::RequestObjectsInFrustum();
+ CStreaming::LoadAllRequestedModels(false);
+ CTimer::Update();
+ }
+ m_bInRemoteMode = false;
+ CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil;
+ if (FindPlayerVehicle()) {
+ FindPlayerVehicle()->m_status = STATUS_PLAYER;
+ }
+ }
+ }
+ if (!(CTimer::GetFrameCounter() & 31)) {
+ CVehicle *veh = FindPlayerVehicle();
+ if (veh && m_pPed->bInVehicle && veh->GetUp().z < 0.0f
+ && veh->m_vecMoveSpeed.Magnitude() < 0.05f && veh->IsCar() && !veh->bIsInWater) {
+
+ if (veh->GetUp().z < -0.5f) {
+ m_nUpsideDownCounter += 2;
+
+ } else {
+ m_nUpsideDownCounter++;
+ }
+ } else {
+ m_nUpsideDownCounter = 0;
+ }
+
+ if (m_nUpsideDownCounter > 6 && veh->bCanBeDamaged) {
+ veh->m_fHealth = 249.0f < veh->m_fHealth ? 249.0f : veh->m_fHealth;
+ if (veh->IsCar()) {
+ CAutomobile* car = (CAutomobile*)veh;
+ car->Damage.SetEngineStatus(225);
+ car->m_pSetOnFireEntity = nil;
+ }
+ }
+ }
+ if (FindPlayerVehicle()) {
+ CVehicle *veh = FindPlayerVehicle();
+ veh->m_nZoneLevel = -1;
+ for (int i = 0; i < ARRAY_SIZE(veh->pPassengers); i++) {
+ if (veh->pPassengers[i])
+ veh->pPassengers[i]->m_nZoneLevel = 0;
+ }
+ CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled;
+ } else {
+ CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled;
+ }
}
STARTPATCHES
diff --git a/src/core/PlayerSkin.cpp b/src/core/PlayerSkin.cpp
deleted file mode 100644
index 4f730b90..00000000
--- a/src/core/PlayerSkin.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "main.h"
-#include "PlayerSkin.h"
-#include "TxdStore.h"
-#include "rtbmp.h"
-#include "ClumpModelInfo.h"
-#include "VisibilityPlugins.h"
-#include "World.h"
-#include "PlayerInfo.h"
-#include "CdStream.h"
-#include "FileMgr.h"
-#include "Directory.h"
-#include "RwHelper.h"
-#include "Timer.h"
-#include "Lights.h"
-
-int CPlayerSkin::m_txdSlot;
-
-void
-FindPlayerDff(uint32 &offset, uint32 &size)
-{
- int file;
- CDirectory::DirectoryInfo info;
-
- file = CFileMgr::OpenFile("models\\gta3.dir", "rb");
-
- do {
- if (!CFileMgr::Read(file, (char*)&info, sizeof(CDirectory::DirectoryInfo)))
- return;
- } while (strcasecmp("player.dff", info.name) != 0);
-
- offset = info.offset;
- size = info.size;
-}
-
-void
-LoadPlayerDff(void)
-{
- RwStream *stream;
- RwMemory mem;
- uint32 offset, size;
- uint8 *buffer;
- bool streamWasAdded = false;
-
- if (CdStreamGetNumImages() == 0) {
- CdStreamAddImage("models\\gta3.img");
- streamWasAdded = true;
- }
-
- FindPlayerDff(offset, size);
- buffer = (uint8*)RwMallocAlign(size << 11, 2048);
- CdStreamRead(0, buffer, offset, size);
- CdStreamSync(0);
-
- mem.start = buffer;
- mem.length = size << 11;
- stream = RwStreamOpen(rwSTREAMMEMORY, rwSTREAMREAD, &mem);
-
- if (RwStreamFindChunk(stream, rwID_CLUMP, nil, nil))
- gpPlayerClump = RpClumpStreamRead(stream);
-
- RwStreamClose(stream, &mem);
- RwFreeAlign(buffer);
-
- if (streamWasAdded)
- CdStreamRemoveImages();
-}
-
-void
-CPlayerSkin::Initialise(void)
-{
- m_txdSlot = CTxdStore::AddTxdSlot("skin");
- CTxdStore::Create(m_txdSlot);
- CTxdStore::AddRef(m_txdSlot);
-}
-
-void
-CPlayerSkin::Shutdown(void)
-{
- CTxdStore::RemoveTxdSlot(m_txdSlot);
-}
-
-RwTexture *
-CPlayerSkin::GetSkinTexture(const char *texName)
-{
- RwTexture *tex;
- RwRaster *raster;
- int32 width, height, depth, format;
-
- CTxdStore::PushCurrentTxd();
- CTxdStore::SetCurrentTxd(m_txdSlot);
- tex = RwTextureRead(texName, NULL);
- CTxdStore::PopCurrentTxd();
- if (tex) return tex;
-
- if (strcmp(DEFAULT_SKIN_NAME, texName) == 0)
- sprintf(gString, "models\\generic\\player.bmp");
- else
- sprintf(gString, "skins\\%s.bmp", texName);
-
- if (RwImage *image = RtBMPImageRead(gString)) {
- RwImageFindRasterFormat(image, rwRASTERTYPETEXTURE, &width, &height, &depth, &format);
- raster = RwRasterCreate(width, height, depth, format);
- RwRasterSetFromImage(raster, image);
-
- tex = RwTextureCreate(raster);
- RwTextureSetName(tex, texName);
- RwTextureSetFilterMode(tex, rwFILTERLINEAR); // filtering bugfix from VC
- RwTexDictionaryAddTexture(CTxdStore::GetSlot(m_txdSlot)->texDict, tex);
-
- RwImageDestroy(image);
- }
- return tex;
-}
-
-void
-CPlayerSkin::BeginFrontendSkinEdit(void)
-{
- LoadPlayerDff();
- RpClumpForAllAtomics(gpPlayerClump, CClumpModelInfo::SetAtomicRendererCB, CVisibilityPlugins::RenderPlayerCB);
- CWorld::Players[0].LoadPlayerSkin();
- gOldFov = CDraw::GetFOV();
- CDraw::SetFOV(30.0f);
-}
-
-void
-CPlayerSkin::EndFrontendSkinEdit(void)
-{
- RpClumpDestroy(gpPlayerClump);
- gpPlayerClump = NULL;
- CDraw::SetFOV(gOldFov);
-}
-
-void
-CPlayerSkin::RenderFrontendSkinEdit(void)
-{
- static float rotation = 0.0f;
- RwRGBAReal AmbientColor = { 0.65f, 0.65f, 0.65f, 1.0f };
- RwV3d pos = { 1.35f, 0.35f, 7.725f };
- const RwV3d axis1 = { 1.0f, 0.0f, 0.0f };
- const RwV3d axis2 = { 0.0f, 0.0f, 1.0f };
- static uint32 LastFlash = 0;
-
-#ifdef ASPECT_RATIO_SCALE
- pos.x = 1.35f * (SCREEN_ASPECT_RATIO / DEFAULT_ASPECT_RATIO);
-#endif
-
- RwFrame *frame = RpClumpGetFrame(gpPlayerClump);
-
- if (CTimer::GetTimeInMillisecondsPauseMode() - LastFlash > 7) {
- rotation += 2.0f;
- if (rotation > 360.0f)
- rotation -= 360.0f;
- LastFlash = CTimer::GetTimeInMillisecondsPauseMode();
- }
- RwFrameTransform(frame, RwFrameGetMatrix(RwCameraGetFrame(Scene.camera)), rwCOMBINEREPLACE);
- RwFrameTranslate(frame, &pos, rwCOMBINEPRECONCAT);
- RwFrameRotate(frame, &axis1, -90.0f, rwCOMBINEPRECONCAT);
- RwFrameRotate(frame, &axis2, rotation, rwCOMBINEPRECONCAT);
- RwFrameUpdateObjects(frame);
- SetAmbientColours(&AmbientColor);
- RpClumpRender(gpPlayerClump);
-}
-
-STARTPATCHES
-InjectHook(0x59B9B0, &CPlayerSkin::Initialise, PATCH_JUMP);
-InjectHook(0x59B9E0, &CPlayerSkin::Shutdown, PATCH_JUMP);
-InjectHook(0x59B9F0, &CPlayerSkin::GetSkinTexture, PATCH_JUMP);
-InjectHook(0x59BC70, &CPlayerSkin::BeginFrontendSkinEdit, PATCH_JUMP);
-InjectHook(0x59BCB0, &CPlayerSkin::EndFrontendSkinEdit, PATCH_JUMP);
-InjectHook(0x59BCE0, &CPlayerSkin::RenderFrontendSkinEdit, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/core/PlayerSkin.h b/src/core/PlayerSkin.h
deleted file mode 100644
index 2d82ec12..00000000
--- a/src/core/PlayerSkin.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma once
-
-#define DEFAULT_SKIN_NAME "$$\"\""
-
-static RpClump *gpPlayerClump;// = *(RpClump**)0x660FF8;
-static float gOldFov;// = *(float*)0x660FFC;
-
-void LoadPlayerDff(void);
-void FindPlayerDff(uint32 &offset, uint32 &size);
-
-class CPlayerSkin
-{
- static int m_txdSlot;
-public:
- static void Initialise();
- static void Shutdown();
- static RwTexture *GetSkinTexture(const char *texName);
- static void BeginFrontendSkinEdit();
- static void EndFrontendSkinEdit();
- static void RenderFrontendSkinEdit();
-}; \ No newline at end of file
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 75536b88..6add9e0c 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -1,8 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "Pools.h"
-#include "World.h"
+
+#include "Boat.h"
+#include "CarCtrl.h"
+#include "Population.h"
#include "ProjectileInfo.h"
+#include "Streaming.h"
+#include "Wanted.h"
+#include "World.h"
CCPtrNodePool *&CPools::ms_pPtrNodePool = *(CCPtrNodePool**)0x943044;
CEntryInfoNodePool *&CPools::ms_pEntryInfoNodePool = *(CEntryInfoNodePool**)0x941448;
@@ -14,13 +20,6 @@ CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28;
CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18;
CAudioScriptObjectPool *&CPools::ms_pAudioScriptObjectPool = *(CAudioScriptObjectPool**)0x8F1B6C;
-WRAPPER void CPools::LoadObjectPool(uint8* buf, uint32 size) { EAXJMP(0x4a2550); }
-WRAPPER void CPools::LoadPedPool(uint8* buf, uint32 size) { EAXJMP(0x4a2b50); }
-WRAPPER void CPools::LoadVehiclePool(uint8* buf, uint32 size) { EAXJMP(0x4a1b40); }
-WRAPPER void CPools::SaveObjectPool(uint8* buf, uint32 *size) { EAXJMP(0x4a22d0); }
-WRAPPER void CPools::SavePedPool(uint8* buf, uint32 *size) { EAXJMP(0x4a29b0); }
-WRAPPER void CPools::SaveVehiclePool(uint8* buf, uint32 *size) { EAXJMP(0x4a2080); }
-
void
CPools::Initialise(void)
{
@@ -99,6 +98,333 @@ CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
}
}
+void CPools::LoadVehiclePool(uint8* buf, uint32 size)
+{
+INITSAVEBUF
+ int nNumCars = ReadSaveBuf<int>(buf);
+ int nNumBoats = ReadSaveBuf<int>(buf);
+ for (int i = 0; i < nNumCars + nNumBoats; i++) {
+ uint32 type = ReadSaveBuf<uint32>(buf);
+ int16 model = ReadSaveBuf<int16>(buf);
+ CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
+ CStreaming::LoadAllRequestedModels(false);
+ int32 slot = ReadSaveBuf<int32>(buf);
+ CVehicle* pVehicle;
+ char* vbuf = new char[max(sizeof(CAutomobile), sizeof(CBoat))];
+ if (type == VEHICLE_TYPE_BOAT) {
+ memcpy(vbuf, buf, sizeof(CBoat));
+ SkipSaveBuf(buf, sizeof(CBoat));
+ CBoat* pBoat = new(slot) CBoat(model, RANDOM_VEHICLE);
+ pVehicle = pBoat;
+ --CCarCtrl::NumRandomCars; // why?
+ }
+ else if (type == VEHICLE_TYPE_CAR) {
+ memcpy(vbuf, buf, sizeof(CAutomobile));
+ SkipSaveBuf(buf, sizeof(CAutomobile));
+ CStreaming::RequestModel(model, 0); // is it needed?
+ CStreaming::LoadAllRequestedModels(false);
+ CAutomobile* pAutomobile = new(slot) CAutomobile(model, RANDOM_VEHICLE);
+ pVehicle = pAutomobile;
+ CCarCtrl::NumRandomCars--; // why?
+ pAutomobile->Damage = ((CAutomobile*)vbuf)->Damage;
+ pAutomobile->SetupDamageAfterLoad();
+ }
+ else
+ assert(0);
+ CVehicle* pBufferVehicle = (CVehicle*)vbuf;
+ pVehicle->GetMatrix() = pBufferVehicle->GetMatrix();
+ pVehicle->VehicleCreatedBy = pBufferVehicle->VehicleCreatedBy;
+ pVehicle->m_currentColour1 = pBufferVehicle->m_currentColour1;
+ pVehicle->m_currentColour2 = pBufferVehicle->m_currentColour2;
+ pVehicle->m_nAlarmState = pBufferVehicle->m_nAlarmState;
+ pVehicle->m_nNumMaxPassengers = pBufferVehicle->m_nNumMaxPassengers;
+ pVehicle->field_1D0[0] = pBufferVehicle->field_1D0[0];
+ pVehicle->field_1D0[1] = pBufferVehicle->field_1D0[1];
+ pVehicle->field_1D0[2] = pBufferVehicle->field_1D0[2];
+ pVehicle->field_1D0[3] = pBufferVehicle->field_1D0[3];
+ pVehicle->m_fSteerAngle = pBufferVehicle->m_fSteerAngle;
+ pVehicle->m_fGasPedal = pBufferVehicle->m_fGasPedal;
+ pVehicle->m_fBrakePedal = pBufferVehicle->m_fBrakePedal;
+ pVehicle->bIsLawEnforcer = pBufferVehicle->bIsLawEnforcer;
+ pVehicle->bIsLocked = pBufferVehicle->bIsLocked;
+ pVehicle->bEngineOn = pBufferVehicle->bEngineOn;
+ pVehicle->bIsHandbrakeOn = pBufferVehicle->bIsHandbrakeOn;
+ pVehicle->bLightsOn = pBufferVehicle->bLightsOn;
+ pVehicle->bFreebies = pBufferVehicle->bFreebies;
+ pVehicle->m_fHealth = pBufferVehicle->m_fHealth;
+ pVehicle->m_nCurrentGear = pBufferVehicle->m_nCurrentGear;
+ pVehicle->m_fChangeGearTime = pBufferVehicle->m_fChangeGearTime;
+ pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath;
+#ifdef FIX_BUGS //must be copypaste
+ pVehicle->m_nBombTimer = pBufferVehicle->m_nBombTimer;
+#else
+ pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath;
+#endif
+ pVehicle->m_nDoorLock = pBufferVehicle->m_nDoorLock;
+ pVehicle->m_status = pBufferVehicle->m_status;
+ pVehicle->m_type = pBufferVehicle->m_type;
+ (pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
+ (pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
+ pVehicle->AutoPilot = pBufferVehicle->AutoPilot;
+ CWorld::Add(pVehicle);
+ delete[] vbuf;
+ }
+VALIDATESAVEBUF(size)
+}
+
+void CPools::SaveVehiclePool(uint8* buf, uint32* size)
+{
+INITSAVEBUF
+ int nNumCars = 0;
+ int nNumBoats = 0;
+ int nPoolSize = GetVehiclePool()->GetSize();
+ for (int i = 0; i < nPoolSize; i++) {
+ CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
+ if (!pVehicle)
+ continue;
+ bool bHasPassenger = false;
+ for (int j = 0; j < ARRAY_SIZE(pVehicle->pPassengers); j++) {
+ if (pVehicle->pPassengers[i])
+ bHasPassenger = true;
+ }
+ if (!pVehicle->pDriver && !bHasPassenger) {
+ if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
+ ++nNumCars;
+ if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
+ ++nNumBoats;
+ }
+ }
+ *size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + sizeof(CAutomobile)) + sizeof(int) +
+ nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + sizeof(CBoat)) + sizeof(int);
+ WriteSaveBuf(buf, nNumCars);
+ WriteSaveBuf(buf, nNumBoats);
+ for (int i = 0; i < nPoolSize; i++) {
+ CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
+ if (!pVehicle)
+ continue;
+ bool bHasPassenger = false;
+ for (int j = 0; j < ARRAY_SIZE(pVehicle->pPassengers); j++) {
+ if (pVehicle->pPassengers[j])
+ bHasPassenger = true;
+ }
+ if (!pVehicle->pDriver && !bHasPassenger) {
+ if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+ WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
+ WriteSaveBuf(buf, pVehicle->m_modelIndex);
+ WriteSaveBuf(buf, GetVehicleRef(pVehicle));
+ memcpy(buf, pVehicle, sizeof(CAutomobile));
+ SkipSaveBuf(buf, sizeof(CAutomobile));
+ }
+ if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+ WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
+ WriteSaveBuf(buf, pVehicle->m_modelIndex);
+ WriteSaveBuf(buf, GetVehicleRef(pVehicle));
+ memcpy(buf, pVehicle, sizeof(CBoat));
+ SkipSaveBuf(buf, sizeof(CBoat));
+ }
+ }
+ }
+VALIDATESAVEBUF(*size)
+}
+
+void CPools::SaveObjectPool(uint8* buf, uint32* size)
+{
+INITSAVEBUF
+ CProjectileInfo::RemoveAllProjectiles();
+ CObject::DeleteAllTempObjects();
+ int nObjects = 0;
+ int nPoolSize = GetObjectPool()->GetSize();
+ for (int i = 0; i < nPoolSize; i++) {
+ CObject* pObject = GetObjectPool()->GetSlot(i);
+ if (!pObject)
+ continue;
+ if (pObject->ObjectCreatedBy == MISSION_OBJECT)
+ ++nObjects;
+ }
+ *size = nObjects * (sizeof(int16) + sizeof(int) + sizeof(CCompressedMatrixNotAligned) + sizeof(uint32) +
+ sizeof(float) + sizeof(CCompressedMatrixNotAligned) + sizeof(uint32) + sizeof(int8) + 7 * sizeof(bool) + sizeof(float) +
+ sizeof(int8) + sizeof(int8) + sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
+ WriteSaveBuf(buf, nObjects);
+ for (int i = 0; i < nPoolSize; i++) {
+ CObject* pObject = GetObjectPool()->GetSlot(i);
+ if (!pObject)
+ continue;
+ if (pObject->ObjectCreatedBy == MISSION_OBJECT) {
+ bool bIsPickup = pObject->bIsPickup;
+ bool bFlag2 = pObject->m_obj_flag2;
+ bool bOutOfStock = pObject->bOutOfStock;
+ bool bGlassCracked = pObject->bGlassCracked;
+ bool bGlassBroken = pObject->bGlassBroken;
+ bool bHasBeenDamaged = pObject->bHasBeenDamaged;
+ bool bUseVehicleColours = pObject->bUseVehicleColours;
+ CCompressedMatrixNotAligned tmp;
+ WriteSaveBuf(buf, pObject->m_modelIndex);
+ WriteSaveBuf(buf, GetObjectRef(pObject));
+ tmp.CompressFromFullMatrix(pObject->GetMatrix());
+ WriteSaveBuf(buf, tmp);
+ WriteSaveBuf(buf, (uint32)0); // game writes ununitialized data here
+ WriteSaveBuf(buf, pObject->m_fUprootLimit);
+ tmp.CompressFromFullMatrix(pObject->m_objectMatrix);
+ WriteSaveBuf(buf, tmp);
+ WriteSaveBuf(buf, (uint32)0); // same
+ WriteSaveBuf(buf, pObject->ObjectCreatedBy);
+ WriteSaveBuf(buf, bIsPickup);
+ WriteSaveBuf(buf, bFlag2);
+ WriteSaveBuf(buf, bOutOfStock);
+ WriteSaveBuf(buf, bGlassCracked);
+ WriteSaveBuf(buf, bGlassBroken);
+ WriteSaveBuf(buf, bHasBeenDamaged);
+ WriteSaveBuf(buf, bUseVehicleColours);
+ WriteSaveBuf(buf, pObject->m_fCollisionDamageMultiplier);
+ WriteSaveBuf(buf, pObject->m_nCollisionDamageEffect);
+ WriteSaveBuf(buf, pObject->m_nSpecialCollisionResponseCases);
+ WriteSaveBuf(buf, pObject->m_nEndOfLifeTime);
+ WriteSaveBuf(buf, (pObject->GetAddressOfEntityProperties())[0]);
+ WriteSaveBuf(buf, (pObject->GetAddressOfEntityProperties())[1]);
+ }
+ }
+VALIDATESAVEBUF(*size)
+}
+
+void CPools::LoadObjectPool(uint8* buf, uint32 size)
+{
+INITSAVEBUF
+ int nObjects = ReadSaveBuf<int>(buf);
+ for (int i = 0; i < nObjects; i++) {
+ int16 mi = ReadSaveBuf<int16>(buf);
+ int ref = ReadSaveBuf<int>(buf);
+ char* obuf = new char[sizeof(CObject)];
+ CObject* pBufferObject = (CObject*)obuf;
+ CCompressedMatrixNotAligned tmp;
+ tmp = ReadSaveBuf<CCompressedMatrixNotAligned>(buf);
+ tmp.DecompressIntoFullMatrix(pBufferObject->GetMatrix());
+ ReadSaveBuf<uint32>(buf);
+ pBufferObject->m_fUprootLimit = ReadSaveBuf<float>(buf);
+ tmp = ReadSaveBuf<CCompressedMatrixNotAligned>(buf);
+ tmp.DecompressIntoFullMatrix(pBufferObject->m_objectMatrix);
+ ReadSaveBuf<uint32>(buf);
+ pBufferObject->ObjectCreatedBy = ReadSaveBuf<int8>(buf);
+ pBufferObject->bIsPickup = ReadSaveBuf<bool>(buf);
+ pBufferObject->m_flagE2 = ReadSaveBuf<bool>(buf);
+ pBufferObject->bOutOfStock = ReadSaveBuf<bool>(buf);
+ pBufferObject->bGlassCracked = ReadSaveBuf<bool>(buf);
+ pBufferObject->bGlassBroken = ReadSaveBuf<bool>(buf);
+ pBufferObject->bHasBeenDamaged = ReadSaveBuf<bool>(buf);
+ pBufferObject->bUseVehicleColours = ReadSaveBuf<bool>(buf);
+ pBufferObject->m_fCollisionDamageMultiplier = ReadSaveBuf<float>(buf);
+ pBufferObject->m_nCollisionDamageEffect = ReadSaveBuf<uint8>(buf);
+ pBufferObject->m_nSpecialCollisionResponseCases = ReadSaveBuf<uint8>(buf);
+ pBufferObject->m_nEndOfLifeTime = ReadSaveBuf<uint32>(buf);
+ (pBufferObject->GetAddressOfEntityProperties())[0] = ReadSaveBuf<uint32>(buf);
+ (pBufferObject->GetAddressOfEntityProperties())[1] = ReadSaveBuf<uint32>(buf);
+ if (GetObjectPool()->GetSlot(ref >> 8))
+ CPopulation::ConvertToDummyObject(GetObjectPool()->GetSlot(ref >> 8));
+ CObject* pObject = new(ref) CObject(mi, false);
+ pObject->GetMatrix() = pBufferObject->GetMatrix();
+ pObject->m_fUprootLimit = pBufferObject->m_fUprootLimit;
+ pObject->m_objectMatrix = pBufferObject->m_objectMatrix;
+ pObject->ObjectCreatedBy = pBufferObject->ObjectCreatedBy;
+ pObject->bIsPickup = pBufferObject->bIsPickup;
+ pObject->m_flagE2 = pBufferObject->m_flagE2;
+ pObject->bOutOfStock = pBufferObject->bOutOfStock;
+ pObject->bGlassCracked = pBufferObject->bGlassCracked;
+ pObject->bGlassBroken = pBufferObject->bGlassBroken;
+ pObject->bHasBeenDamaged = pBufferObject->bHasBeenDamaged;
+ pObject->bUseVehicleColours = pBufferObject->bUseVehicleColours;
+ pObject->m_fCollisionDamageMultiplier = pBufferObject->m_fCollisionDamageMultiplier;
+ pObject->m_nCollisionDamageEffect = pBufferObject->m_nCollisionDamageEffect;
+ pObject->m_nSpecialCollisionResponseCases = pBufferObject->m_nSpecialCollisionResponseCases;
+ pObject->m_nEndOfLifeTime = pBufferObject->m_nEndOfLifeTime;
+ (pObject->GetAddressOfEntityProperties())[0] = (pBufferObject->GetAddressOfEntityProperties())[0];
+ (pObject->GetAddressOfEntityProperties())[1] = (pBufferObject->GetAddressOfEntityProperties())[1];
+ pObject->bHasCollided = false;
+ CWorld::Add(pObject);
+ delete[] obuf;
+ }
+VALIDATESAVEBUF(size)
+}
+
+void CPools::SavePedPool(uint8* buf, uint32* size)
+{
+INITSAVEBUF
+ int nNumPeds = 0;
+ int nPoolSize = GetPedPool()->GetSize();
+ for (int i = 0; i < nPoolSize; i++) {
+ CPed* pPed = GetPedPool()->GetSlot(i);
+ if (!pPed)
+ continue;
+ if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1)
+ nNumPeds++;
+ }
+ *size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + sizeof(CPlayerPed) +
+ sizeof(CWanted::MaximumWantedLevel) + sizeof(CWanted::nMaximumWantedLevel) + MAX_MODEL_NAME);
+ WriteSaveBuf(buf, nNumPeds);
+ for (int i = 0; i < nPoolSize; i++) {
+ CPed* pPed = GetPedPool()->GetSlot(i);
+ if (!pPed)
+ continue;
+ if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) {
+ WriteSaveBuf(buf, pPed->m_nPedType);
+ WriteSaveBuf(buf, pPed->m_modelIndex);
+ WriteSaveBuf(buf, GetPedRef(pPed));
+ memcpy(buf, pPed, sizeof(CPlayerPed));
+ SkipSaveBuf(buf, sizeof(CPlayerPed));
+ WriteSaveBuf(buf, CWanted::MaximumWantedLevel);
+ WriteSaveBuf(buf, CWanted::nMaximumWantedLevel);
+ memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName(), MAX_MODEL_NAME);
+ SkipSaveBuf(buf, MAX_MODEL_NAME);
+ }
+ }
+VALIDATESAVEBUF(*size);
+}
+
+void CPools::LoadPedPool(uint8* buf, uint32 size)
+{
+INITSAVEBUF
+ int nPeds = ReadSaveBuf<int>(buf);
+ for (int i = 0; i < nPeds; i++) {
+ uint32 pedtype = ReadSaveBuf<uint32>(buf);
+ int16 model = ReadSaveBuf<int16>(buf);
+ int ref = ReadSaveBuf<int>(buf);
+ char* pbuf = new char[sizeof(CPlayerPed)];
+ CPlayerPed* pBufferPlayer = (CPlayerPed*)pbuf;
+ CPed* pPed;
+ char name[MAX_MODEL_NAME];
+ // the code implies that there was idea to load non-player ped
+ if (pedtype == PEDTYPE_PLAYER1) { // always true
+ memcpy(pbuf, buf, sizeof(CPlayerPed));
+ SkipSaveBuf(buf, sizeof(CPlayerPed));
+ CWanted::MaximumWantedLevel = ReadSaveBuf<int32>(buf);
+ CWanted::nMaximumWantedLevel = ReadSaveBuf<int32>(buf);
+ memcpy(name, buf, MAX_MODEL_NAME);
+ SkipSaveBuf(buf, MAX_MODEL_NAME);
+ }
+ CStreaming::RequestSpecialModel(model, name, STREAMFLAGS_DONT_REMOVE);
+ CStreaming::LoadAllRequestedModels(false);
+ if (pedtype == PEDTYPE_PLAYER1) {
+ CPlayerPed* pPlayerPed = new(ref) CPlayerPed();
+ for (int i = 0; i < ARRAY_SIZE(pPlayerPed->m_nTargettableObjects); i++)
+ pPlayerPed->m_nTargettableObjects[i] = pBufferPlayer->m_nTargettableObjects[i];
+ pPlayerPed->m_fMaxStamina = pBufferPlayer->m_fMaxStamina;
+ pPed = pPlayerPed;
+ }
+ pPed->GetPosition() = pBufferPlayer->GetPosition();
+ pPed->m_fHealth = pBufferPlayer->m_fHealth;
+ pPed->m_fArmour = pBufferPlayer->m_fArmour;
+ pPed->CharCreatedBy = pBufferPlayer->CharCreatedBy;
+ pPed->m_currentWeapon = 0;
+ pPed->m_maxWeaponTypeAllowed = pBufferPlayer->m_maxWeaponTypeAllowed;
+ for (int i = 0; i < WEAPONTYPE_TOTAL_INVENTORY_WEAPONS; i++)
+ pPed->m_weapons[i] = pBufferPlayer->m_weapons[i];
+ if (pedtype == PEDTYPE_PLAYER1) {
+ pPed->m_wepAccuracy = 100;
+ CWorld::Players[0].m_pPed = (CPlayerPed*)pPed;
+ }
+ CWorld::Add(pPed);
+ delete[] pbuf;
+ }
+VALIDATESAVEBUF(size)
+}
STARTPATCHES
InjectHook(0x4A1770, CPools::Initialise, PATCH_JUMP);
@@ -111,4 +437,7 @@ STARTPATCHES
InjectHook(0x4A1B00, CPools::GetObjectRef, PATCH_JUMP);
InjectHook(0x4A1B20, CPools::GetObject, PATCH_JUMP);
InjectHook(0x4A2DB0, CPools::MakeSureSlotInObjectPoolIsEmpty, PATCH_JUMP);
+ InjectHook(0x4A1B40, CPools::LoadVehiclePool, PATCH_JUMP);
+ InjectHook(0x4A2550, CPools::LoadObjectPool, PATCH_JUMP);
+ InjectHook(0x4A2B50, CPools::LoadPedPool, PATCH_JUMP);
ENDPATCHES
diff --git a/src/core/Profile.cpp b/src/core/Profile.cpp
new file mode 100644
index 00000000..56584d12
--- /dev/null
+++ b/src/core/Profile.cpp
@@ -0,0 +1,71 @@
+#include "common.h"
+#include "Profile.h"
+
+#ifndef MASTER
+float CProfile::ms_afStartTime[NUM_PROFILES];
+float CProfile::ms_afCumulativeTime[NUM_PROFILES];
+float CProfile::ms_afEndTime[NUM_PROFILES];
+float CProfile::ms_afMaxEndTime[NUM_PROFILES];
+float CProfile::ms_afMaxCumulativeTime[NUM_PROFILES];
+char *CProfile::ms_pProfileString[NUM_PROFILES];
+RwRGBA CProfile::ms_aBarColours[NUM_PROFILES];
+
+void CProfile::Initialise()
+{
+ ms_afMaxEndTime[PROFILE_FRAME_RATE] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PHYSICS] = 0.0f;
+ ms_afMaxEndTime[PROFILE_COLLISION] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PED_AI] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = 0.0f;
+ ms_afMaxEndTime[PROFILE_RENDERING_TIME] = 0.0f;
+ ms_afMaxEndTime[PROFILE_TOTAL] = 0.0f;
+
+ ms_pProfileString[PROFILE_FRAME_RATE] = "Frame rate";
+ ms_pProfileString[PROFILE_PHYSICS] = "Physics";
+ ms_pProfileString[PROFILE_COLLISION] = "Collision";
+ ms_pProfileString[PROFILE_PED_AI] = "Ped AI";
+ ms_pProfileString[PROFILE_PROCESSING_TIME] = "Processing time";
+ ms_pProfileString[PROFILE_RENDERING_TIME] = "Rendering time";
+ ms_pProfileString[PROFILE_TOTAL] = "Total";
+
+ ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PHYSICS] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_COLLISION] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PED_AI] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_TOTAL] = 0.0f;
+
+ ms_aBarColours[PROFILE_PHYSICS] = { 0, 127, 255, 255 };
+ ms_aBarColours[PROFILE_COLLISION] = { 0, 255, 255, 255 };
+ ms_aBarColours[PROFILE_PED_AI] = { 255, 0, 0, 255 };
+ ms_aBarColours[PROFILE_PROCESSING_TIME] = { 0, 255, 0, 255 };
+ ms_aBarColours[PROFILE_RENDERING_TIME] = { 0, 0, 255, 255 };
+ ms_aBarColours[PROFILE_TOTAL] = { 255, 255, 255, 255 };
+}
+
+void CProfile::SuspendProfile(eProfile profile)
+{
+ ms_afEndTime[profile] = -ms_afStartTime[profile];
+ ms_afCumulativeTime[profile] -= ms_afStartTime[profile];
+}
+
+void CProfile::ShowResults()
+{
+ ms_afMaxEndTime[PROFILE_FRAME_RATE] = max(ms_afMaxEndTime[PROFILE_FRAME_RATE], ms_afEndTime[PROFILE_FRAME_RATE]);
+ ms_afMaxEndTime[PROFILE_PHYSICS] = max(ms_afMaxEndTime[PROFILE_PHYSICS], ms_afEndTime[PROFILE_PHYSICS]);
+ ms_afMaxEndTime[PROFILE_COLLISION] = max(ms_afMaxEndTime[PROFILE_COLLISION], ms_afEndTime[PROFILE_COLLISION]);
+ ms_afMaxEndTime[PROFILE_PED_AI] = max(ms_afMaxEndTime[PROFILE_PED_AI], ms_afEndTime[PROFILE_PED_AI]);
+ ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxEndTime[PROFILE_PROCESSING_TIME], ms_afEndTime[PROFILE_PROCESSING_TIME]);
+ ms_afMaxEndTime[PROFILE_RENDERING_TIME] = max(ms_afMaxEndTime[PROFILE_RENDERING_TIME], ms_afEndTime[PROFILE_RENDERING_TIME]);
+ ms_afMaxEndTime[PROFILE_TOTAL] = max(ms_afMaxEndTime[PROFILE_TOTAL], ms_afEndTime[PROFILE_TOTAL]);
+
+ ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = max(ms_afMaxCumulativeTime[PROFILE_FRAME_RATE], ms_afCumulativeTime[PROFILE_FRAME_RATE]);
+ ms_afMaxCumulativeTime[PROFILE_PHYSICS] = max(ms_afMaxCumulativeTime[PROFILE_PHYSICS], ms_afCumulativeTime[PROFILE_PHYSICS]);
+ ms_afMaxCumulativeTime[PROFILE_COLLISION] = max(ms_afMaxCumulativeTime[PROFILE_COLLISION], ms_afCumulativeTime[PROFILE_COLLISION]);
+ ms_afMaxCumulativeTime[PROFILE_PED_AI] = max(ms_afMaxCumulativeTime[PROFILE_PED_AI], ms_afCumulativeTime[PROFILE_PED_AI]);
+ ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME], ms_afCumulativeTime[PROFILE_PROCESSING_TIME]);
+ ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME], ms_afCumulativeTime[PROFILE_RENDERING_TIME]);
+ ms_afMaxCumulativeTime[PROFILE_TOTAL] = max(ms_afMaxCumulativeTime[PROFILE_TOTAL], ms_afCumulativeTime[PROFILE_TOTAL]);
+}
+#endif \ No newline at end of file
diff --git a/src/core/Profile.h b/src/core/Profile.h
new file mode 100644
index 00000000..d2e8054b
--- /dev/null
+++ b/src/core/Profile.h
@@ -0,0 +1,28 @@
+#pragma once
+
+enum eProfile
+{
+ PROFILE_FRAME_RATE,
+ PROFILE_PHYSICS,
+ PROFILE_COLLISION,
+ PROFILE_PED_AI,
+ PROFILE_PROCESSING_TIME,
+ PROFILE_RENDERING_TIME,
+ PROFILE_TOTAL,
+ NUM_PROFILES,
+};
+
+class CProfile
+{
+ static float ms_afStartTime[NUM_PROFILES];
+ static float ms_afCumulativeTime[NUM_PROFILES];
+ static float ms_afEndTime[NUM_PROFILES];
+ static float ms_afMaxEndTime[NUM_PROFILES];
+ static float ms_afMaxCumulativeTime[NUM_PROFILES];
+ static char *ms_pProfileString[NUM_PROFILES];
+ static RwRGBA ms_aBarColours[NUM_PROFILES];
+public:
+ static void Initialise();
+ static void SuspendProfile(eProfile profile);
+ static void ShowResults();
+}; \ No newline at end of file
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index f1d8ec96..154e7e9a 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -1,1307 +1,1506 @@
-#include "config.h"
-#include "common.h"
-#include "patcher.h"
-#include "RwHelper.h"
-#include "Radar.h"
-#include "Camera.h"
-#include "Hud.h"
-#include "World.h"
-#include "Frontend.h"
-#include "General.h"
-#include "Vehicle.h"
-#include "Pools.h"
-#include "Script.h"
-#include "TxdStore.h"
-#include "World.h"
-#include "Streaming.h"
-#include "SpecialFX.h"
-
-float &CRadar::m_radarRange = *(float*)0x8E281C;
-CBlip (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(CBlip(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0;
-CVector2D &vec2DRadarOrigin = *(CVector2D*)0x6299B8;
-int32 gRadarTxdIds[64];// = (int*)0x6299C0;
-
-CSprite2d CRadar::AsukaSprite;// = *(CSprite2d*)0x8F1A40;
-CSprite2d CRadar::BombSprite;// = (CSprite2d*)0x8F5FB4;
-CSprite2d CRadar::CatSprite;// = (CSprite2d*)0x885B24;
-CSprite2d CRadar::CentreSprite;// = (CSprite2d*)0x8F6268;
-CSprite2d CRadar::CopcarSprite;// = (CSprite2d*)0x8F1A2C;
-CSprite2d CRadar::DonSprite;// = (CSprite2d*)0x8F2BE0;
-CSprite2d CRadar::EightSprite;// = (CSprite2d*)0x8F2BCC;
-CSprite2d CRadar::ElSprite;// = (CSprite2d*)0x8F1B80;
-CSprite2d CRadar::IceSprite;// = (CSprite2d*)0x9415FC;
-CSprite2d CRadar::JoeySprite;// = (CSprite2d*)0x8F2C00;
-CSprite2d CRadar::KenjiSprite;// = (CSprite2d*)0x8F2C68;
-CSprite2d CRadar::LizSprite;// = (CSprite2d*)0x8F5830;
-CSprite2d CRadar::LuigiSprite;// = (CSprite2d*)0x8F1A3C;
-CSprite2d CRadar::NorthSprite;// = (CSprite2d*)0x8F6274;
-CSprite2d CRadar::RaySprite;// = (CSprite2d*)0x8E2A7C;
-CSprite2d CRadar::SalSprite;// = (CSprite2d*)0x8F29EC;
-CSprite2d CRadar::SaveSprite;// = (CSprite2d*)0x8F5F74;
-CSprite2d CRadar::SpraySprite;// = (CSprite2d*)0x94307C;
-CSprite2d CRadar::TonySprite;// = (CSprite2d*)0x885B58;
-CSprite2d CRadar::WeaponSprite;// = (CSprite2d*)0x941534;
-
-CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
- nil,
- &AsukaSprite,
- &BombSprite,
- &CatSprite,
- &CentreSprite,
- &CopcarSprite,
- &DonSprite,
- &EightSprite,
- &ElSprite,
- &IceSprite,
- &JoeySprite,
- &KenjiSprite,
- &LizSprite,
- &LuigiSprite,
- &NorthSprite,
- &RaySprite,
- &SalSprite,
- &SaveSprite,
- &SpraySprite,
- &TonySprite,
- &WeaponSprite
-};
-
-#define RADAR_NUM_TILES (8)
-#define RADAR_TILE_SIZE (WORLD_SIZE_X / RADAR_NUM_TILES)
-static_assert(RADAR_TILE_SIZE == (WORLD_SIZE_Y / RADAR_NUM_TILES), "CRadar: not a square");
-
-#define RADAR_MIN_RANGE (120.0f)
-#define RADAR_MAX_RANGE (350.0f)
-#define RADAR_MIN_SPEED (0.3f)
-#define RADAR_MAX_SPEED (0.9f)
-
-uint8 CRadar::CalculateBlipAlpha(float dist)
-{
- if (dist <= 1.0f)
- return 255;
-
- if (dist <= 5.0f)
- return (128.0f * ((dist - 1.0f) / 4.0f)) + ((1.0f - (dist - 1.0f) / 4.0f) * 255.0f);
-
- return 128;
-}
-
-void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1)
- ms_RadarTrace[index].m_bDim = bright != 1;
-}
-
-void CRadar::ChangeBlipColour(int32 i, int32 color)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1)
- ms_RadarTrace[index].m_nColor = color;
-}
-
-void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1)
- ms_RadarTrace[index].m_eBlipDisplay = display;
-}
-
-void CRadar::ChangeBlipScale(int32 i, int32 scale)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1)
- ms_RadarTrace[index].m_wScale = scale;
-}
-
-void CRadar::ClearBlip(int32 i)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1) {
- SetRadarMarkerState(index, false);
- ms_RadarTrace[index].m_bInUse = false;
- ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
- ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
- ms_RadarTrace[index].m_IconID = RADAR_SPRITE_NONE;
- }
-}
-
-void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
-{
- for (int i = 0; i < NUMRADARBLIPS; i++) {
- if (type == ms_RadarTrace[i].m_eBlipType && id == ms_RadarTrace[i].m_nEntityHandle) {
- SetRadarMarkerState(i, false);
- ms_RadarTrace[i].m_bInUse = false;
- ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
- ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
- ms_RadarTrace[i].m_IconID = RADAR_SPRITE_NONE;
- }
- };
-}
-
-// Why not a proper clipping algorithm?
-int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
-{
- CVector2D corners[4] = {
- { 1.0f, -1.0f }, // top right
- { 1.0f, 1.0f }, // bottom right
- { -1.0f, 1.0f }, // bottom left
- { -1.0f, -1.0f }, // top left
- };
- CVector2D tmp;
- int i, j, n;
- int laste, e, e1, e2;;
- bool inside[4];
-
- for (i = 0; i < 4; i++)
- inside[i] = IsPointInsideRadar(rect[i]);
-
- laste = -1;
- n = 0;
- for (i = 0; i < 4; i++)
- if (inside[i]) {
- // point is inside, just add
- poly[n++] = rect[i];
- }
- else {
- // point is outside but line to this point might be clipped
- e1 = LineRadarBoxCollision(poly[n], rect[i], rect[(i + 4 - 1) % 4]);
- if (e1 != -1) {
- laste = e1;
- n++;
- }
- // and line from this point might be clipped as well
- e2 = LineRadarBoxCollision(poly[n], rect[i], rect[(i + 1) % 4]);
- if (e2 != -1) {
- if (e1 == -1) {
- // if other line wasn't clipped, i.e. it was complete outside,
- // we may have to insert another vertex if last clipped line
- // was on a different edge
-
- // find the last intersection if we haven't seen it yet
- if (laste == -1)
- for (j = 3; j >= i; j--) {
- // game uses an if here for j == 0
- e = LineRadarBoxCollision(tmp, rect[j], rect[(j + 4 - 1) % 4]);
- if (e != -1) {
- laste = e;
- break;
- }
- }
- assert(laste != -1);
-
- // insert corners that were skipped
- tmp = poly[n];
- for (e = laste; e != e2; e = (e + 1) % 4)
- poly[n++] = corners[e];
- poly[n] = tmp;
- }
- n++;
- }
- }
-
- if (n == 0) {
- // If no points, either the rectangle is completely outside or completely surrounds the radar
- // no idea what's going on here...
- float m = (rect[0].y - rect[1].y) / (rect[0].x - rect[1].x);
- if ((m*rect[3].x - rect[3].y) * (m*rect[0].x - rect[0].y) < 0.0f) {
- m = (rect[0].y - rect[3].y) / (rect[0].x - rect[3].x);
- if ((m*rect[1].x - rect[1].y) * (m*rect[0].x - rect[0].y) < 0.0f) {
- poly[0] = corners[0];
- poly[1] = corners[1];
- poly[2] = corners[2];
- poly[3] = corners[3];
- n = 4;
- }
- }
- }
-
- return n;
-}
-
-bool CRadar::DisplayThisBlip(int32 counter)
-{
- switch (ms_RadarTrace[counter].m_IconID) {
- case RADAR_SPRITE_BOMB:
- case RADAR_SPRITE_SPRAY:
- case RADAR_SPRITE_WEAPON:
- return true;
- default:
- return false;
- }
-}
-
-void CRadar::Draw3dMarkers()
-{
- for (int i = 0; i < NUMRADARBLIPS; i++) {
- if (ms_RadarTrace[i].m_bInUse) {
- switch (ms_RadarTrace[i].m_eBlipType) {
- case BLIP_CAR:
- {
- CEntity *entity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
- if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- CVector pos = entity->GetPosition();
- pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f;
- C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 2.5f, 0, 128, 255, 255, 1024, 0.2f, 5);
- }
- break;
- }
- case BLIP_CHAR:
- {
- CEntity *entity = CPools::GetPedPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
- if (entity != nil) {
- if (((CPed*)entity)->InVehicle())
- entity = ((CPed * )entity)->m_pMyVehicle;
- }
- if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- CVector pos = entity->GetPosition();
- pos.z += 3.0f;
- C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.5f, 0, 128, 255, 255, 1024, 0.2f, 5);
- }
- break;
- }
- case BLIP_OBJECT:
- {
- CEntity *entity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
- if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- CVector pos = entity->GetPosition();
- pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f;
- C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.0f, 0, 128, 255, 255, 1024, 0.2f, 5);
- }
- break;
- }
- case BLIP_COORD:
- break;
- case BLIP_CONTACT_POINT:
- if (!CTheScripts::IsPlayerOnAMission()) {
- if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY)
- C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), 4, ms_RadarTrace[i].m_vecPos, 2.0f, 0, 128, 255, 128, 2048, 0.2f, 0);
- }
- break;
- }
- }
- }
-}
-
-void CRadar::DrawBlips()
-{
- if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
-
- CVector2D out;
- CVector2D in = CVector2D(0.0f, 0.0f);
- TransformRadarPointToScreenSpace(out, in);
-
- float angle;
- if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
- angle = PI + FindPlayerHeading();
-#ifdef FIX_BUGS
- else if (TheCamera.GetLookDirection() != LOOKING_FORWARD)
- angle = FindPlayerHeading() - (PI + (TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind).Heading());
-#endif
- else
- angle = FindPlayerHeading() - (PI + TheCamera.GetForward().Heading());
-
- DrawRotatingRadarSprite(&CentreSprite, out.x, out.y, angle, 255);
-
- CVector2D vec2d;
- vec2d.x = vec2DRadarOrigin.x;
- vec2d.y = M_SQRT2 * m_radarRange + vec2DRadarOrigin.y;
- TransformRealWorldPointToRadarSpace(in, vec2d);
- LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255);
-
- CEntity *blipEntity = nil;
- for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
- if (!ms_RadarTrace[blipId].m_bInUse)
- continue;
-
- switch (ms_RadarTrace[blipId].m_eBlipType) {
- case BLIP_CAR:
- case BLIP_CHAR:
- case BLIP_OBJECT:
- if (ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SAVE
- || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_WEAPON) {
-
- switch (ms_RadarTrace[blipId].m_eBlipType) {
- case BLIP_CAR:
- blipEntity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- break;
- case BLIP_CHAR:
- blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- if (blipEntity != nil) {
- if (((CPed*)blipEntity)->InVehicle())
- blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
- }
- break;
- case BLIP_OBJECT:
- blipEntity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- break;
- default:
- break;
- }
- if (blipEntity) {
- uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- if (CTheScripts::IsDebugOn()) {
- ShowRadarMarker(blipEntity->GetPosition(), color, ms_RadarTrace[blipId].m_Radius);
- ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
- if (ms_RadarTrace[blipId].m_Radius < 1.0f)
- ms_RadarTrace[blipId].m_Radius = 5.0f;
- }
- }
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
- TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
- float dist = LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) {
- DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
- } else {
-#ifdef TRIANGULAR_BLIPS
- CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
- CVector &blipPos = blipEntity->GetPosition();
- uint8 mode = BLIP_MODE_TRIANGULAR_UP;
- if (blipPos.z - pos.z <= 2.0f) {
- if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
- else mode = BLIP_MODE_SQUARE;
- }
- ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
-#else
- ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
-#endif
- }
- }
- }
- }
- break;
- case BLIP_COORD:
- case BLIP_CONTACT_POINT:
- if ((ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SAVE
- || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_WEAPON)
- && (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
-
- uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- if (CTheScripts::IsDebugOn()) {
- ShowRadarMarker(ms_RadarTrace[blipId].m_vecPos, color, ms_RadarTrace[blipId].m_Radius);
- ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
- if (ms_RadarTrace[blipId].m_Radius < 1.0f)
- ms_RadarTrace[blipId].m_Radius = 5.0f;
- }
- }
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
- TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
- float dist = LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) {
- DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
- } else {
-#ifdef TRIANGULAR_BLIPS
- CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
- CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
- uint8 mode = BLIP_MODE_TRIANGULAR_UP;
- if (blipPos.z - pos.z <= 2.0f) {
- if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
- else mode = BLIP_MODE_SQUARE;
- }
- ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
-#else
- ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
-#endif
- }
- }
- }
- break;
- default:
- break;
- }
- }
- for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
- if (!ms_RadarTrace[blipId].m_bInUse)
- continue;
-
- switch (ms_RadarTrace[blipId].m_eBlipType) {
- case BLIP_CAR:
- case BLIP_CHAR:
- case BLIP_OBJECT:
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SAVE
- && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_WEAPON) {
-
- switch (ms_RadarTrace[blipId].m_eBlipType) {
- case BLIP_CAR:
- blipEntity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- break;
- case BLIP_CHAR:
- blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- if (blipEntity != nil) {
- if (((CPed*)blipEntity)->InVehicle())
- blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
- }
- break;
- case BLIP_OBJECT:
- blipEntity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- break;
- default:
- break;
- }
-
- if (blipEntity) {
- uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- if (CTheScripts::IsDebugOn()) {
- ShowRadarMarker(blipEntity->GetPosition(), color, ms_RadarTrace[blipId].m_Radius);
- ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
- if (ms_RadarTrace[blipId].m_Radius < 1.0f)
- ms_RadarTrace[blipId].m_Radius = 5.0f;
- }
- }
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
- TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
- float dist = LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE)
- DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
- else
-#ifdef TRIANGULAR_BLIPS
- {
- CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
- CVector &blipPos = blipEntity->GetPosition();
- uint8 mode = BLIP_MODE_TRIANGULAR_UP;
- if (blipPos.z - pos.z <= 2.0f) {
- if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
- else mode = BLIP_MODE_SQUARE;
- }
- ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
- }
-#else
- ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
-#endif
- }
- }
- }
- break;
- default:
- break;
- }
- }
- for (int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
- if (!ms_RadarTrace[blipId].m_bInUse)
- continue;
-
- switch (ms_RadarTrace[blipId].m_eBlipType) {
- case BLIP_COORD:
- case BLIP_CONTACT_POINT:
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SAVE
- && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_WEAPON
- && (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
-
- uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- if (CTheScripts::IsDebugOn()) {
- ShowRadarMarker(ms_RadarTrace[blipId].m_vecPos, color, ms_RadarTrace[blipId].m_Radius);
- ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
- if (ms_RadarTrace[blipId].m_Radius < 1.0f)
- ms_RadarTrace[blipId].m_Radius = 5.0f;
- }
- }
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
- TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
- float dist = LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE)
- DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
- else
-#ifdef TRIANGULAR_BLIPS
- {
- CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
- CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
- uint8 mode = BLIP_MODE_TRIANGULAR_UP;
- if (blipPos.z - pos.z <= 2.0f) {
- if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
- else mode = BLIP_MODE_SQUARE;
- }
- ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
- }
-#else
- ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
-#endif
- }
- }
- break;
- default:
- break;
- }
- }
- }
-}
-
-void CRadar::DrawMap()
-{
- if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
- if (FindPlayerVehicle()) {
- float speed = FindPlayerSpeed().Magnitude();
- if (speed < RADAR_MIN_SPEED)
- m_radarRange = RADAR_MIN_RANGE;
- else if (speed < RADAR_MAX_SPEED)
- m_radarRange = (speed - RADAR_MIN_SPEED)/(RADAR_MAX_SPEED-RADAR_MIN_SPEED) * (RADAR_MAX_RANGE-RADAR_MIN_RANGE) + RADAR_MIN_RANGE;
- else
- m_radarRange = RADAR_MAX_RANGE;
- }
- else
- m_radarRange = RADAR_MIN_RANGE;
-
- vec2DRadarOrigin = CVector2D(FindPlayerCentreOfWorld_NoSniperShift());
- DrawRadarMap();
- }
-}
-
-void CRadar::DrawRadarMap()
-{
- // Game calculates an unused CRect here
-
- DrawRadarMask();
-
- // top left ist (0, 0)
- int x = floorf((vec2DRadarOrigin.x - WORLD_MIN_X) / RADAR_TILE_SIZE);
- int y = ceilf((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - WORLD_MIN_Y) / RADAR_TILE_SIZE);
- StreamRadarSections(x, y);
-
- RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
- RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
- RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
- RwRenderStateSet(rwRENDERSTATETEXTUREPERSPECTIVE, (void*)FALSE);
-
- DrawRadarSection(x - 1, y - 1);
- DrawRadarSection(x, y - 1);
- DrawRadarSection(x + 1, y - 1);
- DrawRadarSection(x - 1, y);
- DrawRadarSection(x, y);
- DrawRadarSection(x + 1, y);
- DrawRadarSection(x - 1, y + 1);
- DrawRadarSection(x, y + 1);
- DrawRadarSection(x + 1, y + 1);
-}
-
-void CRadar::DrawRadarMask()
-{
- CVector2D corners[4] = {
- CVector2D(1.0f, -1.0f),
- CVector2D(1.0f, 1.0f),
- CVector2D(-1.0f, 1.0f),
- CVector2D(-1.0, -1.0f)
- };
-
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
- RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONALWAYS);
-
- CVector2D out[8];
- CVector2D in;
-
- // Draw the shape we want to mask out from the radar in four segments
- for (int i = 0; i < 4; i++) {
- // First point is always the corner itself
- in.x = corners[i].x;
- in.y = corners[i].y;
- TransformRadarPointToScreenSpace(out[0], in);
-
- // Then generate a quarter of the circle
- for (int j = 0; j < 7; j++) {
- in.x = corners[i].x * Cos(j * (PI / 2.0f / 6.0f));
- in.y = corners[i].y * Sin(j * (PI / 2.0f / 6.0f));
- TransformRadarPointToScreenSpace(out[j + 1], in);
- };
-
- CSprite2d::SetMaskVertices(8, (float *)out);
- RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8);
- };
-
- RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONGREATER);
-}
-
-void CRadar::DrawRadarSection(int32 x, int32 y)
-{
- int i;
- RwTexDictionary *txd;
- CVector2D worldPoly[8];
- CVector2D radarCorners[4];
- CVector2D radarPoly[8];
- CVector2D texCoords[8];
- CVector2D screenPoly[8];
- int numVertices;
- RwTexture *texture = nil;
-
- GetTextureCorners(x, y, worldPoly);
- ClipRadarTileCoords(x, y);
-
- assert(CTxdStore::GetSlot(gRadarTxdIds[x + RADAR_NUM_TILES * y]));
- txd = CTxdStore::GetSlot(gRadarTxdIds[x + RADAR_NUM_TILES * y])->texDict;
- if (txd)
- texture = GetFirstTexture(txd);
- if (texture == nil)
- return;
-
- for (i = 0; i < 4; i++)
- TransformRealWorldPointToRadarSpace(radarCorners[i], worldPoly[i]);
-
- numVertices = ClipRadarPoly(radarPoly, radarCorners);
-
- // FIX: can return earlier here
-// if(numVertices == 0)
- if (numVertices < 3)
- return;
-
- for (i = 0; i < numVertices; i++) {
- TransformRadarPointToRealWorldSpace(worldPoly[i], radarPoly[i]);
- TransformRealWorldToTexCoordSpace(texCoords[i], worldPoly[i], x, y);
- TransformRadarPointToScreenSpace(screenPoly[i], radarPoly[i]);
- }
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(texture));
- CSprite2d::SetVertices(numVertices, (float*)screenPoly, (float*)texCoords, CRGBA(255, 255, 255, 255));
- // check done above now
-// if(numVertices > 2)
- RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), numVertices);
-}
-
-void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
-{
- RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
-}
-
-void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha)
-{
- CVector curPosn[4];
- CVector oldPosn[4];
-
- curPosn[0].x = x - SCREEN_SCALE_X(5.6f);
- curPosn[0].y = y + SCREEN_SCALE_Y(5.6f);
-
- curPosn[1].x = x + SCREEN_SCALE_X(5.6f);
- curPosn[1].y = y + SCREEN_SCALE_Y(5.6f);
-
- curPosn[2].x = x - SCREEN_SCALE_X(5.6f);
- curPosn[2].y = y - SCREEN_SCALE_Y(5.6f);
-
- curPosn[3].x = x + SCREEN_SCALE_X(5.6f);
- curPosn[3].y = y - SCREEN_SCALE_Y(5.6f);
-
- for (uint32 i = 0; i < 4; i++) {
- oldPosn[i] = curPosn[i];
-
- curPosn[i].x = x + (oldPosn[i].x - x) * Cos(angle) + (oldPosn[i].y - y) * Sin(angle);
- curPosn[i].y = y - (oldPosn[i].x - x) * Sin(angle) + (oldPosn[i].y - y) * Cos(angle);
- }
-
- sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
-}
-
-int32 CRadar::GetActualBlipArrayIndex(int32 i)
-{
- if (i == -1)
- return -1;
- else if ((i & 0xFFFF0000) >> 16 != ms_RadarTrace[(uint16)i].m_BlipIndex)
- return -1;
- else
- return (uint16)i;
-}
-
-int32 CRadar::GetNewUniqueBlipIndex(int32 i)
-{
- if (ms_RadarTrace[i].m_BlipIndex >= UINT16_MAX - 1)
- ms_RadarTrace[i].m_BlipIndex = 1;
- else
- ms_RadarTrace[i].m_BlipIndex++;
- return i | (ms_RadarTrace[i].m_BlipIndex << 16);
-}
-
-uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
-{
- int32 c;
- switch (color) {
- case 0:
- if (bright)
- c = 0x712B49FF;
- else
- c = 0x7F0000FF;
- break;
- case 1:
- if (bright)
- c = 0x5FA06AFF;
- else
- c = 0x007F00FF;
- break;
- case 2:
- if (bright)
- c = 0x80A7F3FF;
- else
- c = 0x00007FFF;
- break;
- case 3:
- if (bright)
- c = 0xE1E1E1FF;
- else
- c = 0x7F7F7FFF;
- break;
- case 4:
- if (bright)
- c = 0xFFFF00FF;
- else
- c = 0x7F7F00FF;
- break;
- case 5:
- if (bright)
- c = 0xFF00FFFF;
- else
- c = 0x7F007FFF;
- break;
- case 6:
- if (bright)
- c = 0x00FFFFFF;
- else
- c = 0x007F7FFF;
- break;
- default:
- c = color;
- break;
- };
- return c;
-}
-
-const char* gRadarTexNames[] = {
- "radar00", "radar01", "radar02", "radar03", "radar04", "radar05", "radar06", "radar07",
- "radar08", "radar09", "radar10", "radar11", "radar12", "radar13", "radar14", "radar15",
- "radar16", "radar17", "radar18", "radar19", "radar20", "radar21", "radar22", "radar23",
- "radar24", "radar25", "radar26", "radar27", "radar28", "radar29", "radar30", "radar31",
- "radar32", "radar33", "radar34", "radar35", "radar36", "radar37", "radar38", "radar39",
- "radar40", "radar41", "radar42", "radar43", "radar44", "radar45", "radar46", "radar47",
- "radar48", "radar49", "radar50", "radar51", "radar52", "radar53", "radar54", "radar55",
- "radar56", "radar57", "radar58", "radar59", "radar60", "radar61", "radar62", "radar63",
-};
-
-void
-CRadar::Initialise()
-{
- for (int i = 0; i < NUMRADARBLIPS; i++) {
- ms_RadarTrace[i].m_BlipIndex = 1;
- SetRadarMarkerState(i, false);
- ms_RadarTrace[i].m_bInUse = false;
- ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
- ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
- ms_RadarTrace[i].m_IconID = RADAR_SPRITE_NONE;
- }
-
- m_radarRange = 350.0f;
- for (int i = 0; i < 64; i++)
- gRadarTxdIds[i] = CTxdStore::FindTxdSlot(gRadarTexNames[i]);
-}
-
-float CRadar::LimitRadarPoint(CVector2D &point)
-{
- float dist, invdist;
-
- dist = point.Magnitude();
- if (dist > 1.0f) {
- invdist = 1.0f / dist;
- point.x *= invdist;
- point.y *= invdist;
- }
- return dist;
-}
-
-void CRadar::LoadAllRadarBlips(uint8 *buf, uint32 size)
-{
- Initialise();
-INITSAVEBUF
- CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE);
-
- for (int i = 0; i < NUMRADARBLIPS; i++)
- ms_RadarTrace[i] = ReadSaveBuf<CBlip>(buf);
-
-VALIDATESAVEBUF(size);
-}
-
-void
-CRadar::LoadTextures()
-{
- CTxdStore::PushCurrentTxd();
- CTxdStore::SetCurrentTxd(CTxdStore::FindTxdSlot("hud"));
- AsukaSprite.SetTexture("radar_asuka");
- BombSprite.SetTexture("radar_bomb");
- CatSprite.SetTexture("radar_cat");
- CentreSprite.SetTexture("radar_centre");
- CopcarSprite.SetTexture("radar_copcar");
- DonSprite.SetTexture("radar_don");
- EightSprite.SetTexture("radar_eight");
- ElSprite.SetTexture("radar_el");
- IceSprite.SetTexture("radar_ice");
- JoeySprite.SetTexture("radar_joey");
- KenjiSprite.SetTexture("radar_kenji");
- LizSprite.SetTexture("radar_liz");
- LuigiSprite.SetTexture("radar_luigi");
- NorthSprite.SetTexture("radar_north");
- RaySprite.SetTexture("radar_ray");
- SalSprite.SetTexture("radar_sal");
- SaveSprite.SetTexture("radar_save");
- SpraySprite.SetTexture("radar_spray");
- TonySprite.SetTexture("radar_tony");
- WeaponSprite.SetTexture("radar_weapon");
- CTxdStore::PopCurrentTxd();
-}
-
-void RemoveMapSection(int32 x, int32 y)
-{
- if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
- CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
-}
-
-void CRadar::RemoveRadarSections()
-{
- for (int i = 0; i < 8; i++)
- for (int j = 0; j < 8; j++)
- RemoveMapSection(i, j);
-}
-
-void CRadar::RequestMapSection(int32 x, int32 y)
-{
- ClipRadarTileCoords(x, y);
- CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
-}
-
-void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
-{
- *size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace);
-INITSAVEBUF
- WriteSaveHeader(buf, 'R', 'D', 'R', '\0', *size - SAVE_HEADER_SIZE);
-
- for (int i = 0; i < NUMRADARBLIPS; i++)
- WriteSaveBuf(buf, ms_RadarTrace[i]);
-
-VALIDATESAVEBUF(*size);
-}
-
-void CRadar::SetBlipSprite(int32 i, int32 icon)
-{
- int index = CRadar::GetActualBlipArrayIndex(i);
- if (index != -1) {
- ms_RadarTrace[index].m_IconID = icon;
- }
-}
-
-int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay display)
-{
- int nextBlip;
- for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
- if (!ms_RadarTrace[nextBlip].m_bInUse)
- break;
- }
- ms_RadarTrace[nextBlip].m_eBlipType = type;
- ms_RadarTrace[nextBlip].m_nColor = color;
- ms_RadarTrace[nextBlip].m_bDim = 1;
- ms_RadarTrace[nextBlip].m_bInUse = 1;
- ms_RadarTrace[nextBlip].m_Radius = 1.0f;
- ms_RadarTrace[nextBlip].m_vec2DPos = pos;
- ms_RadarTrace[nextBlip].m_vecPos = pos;
- ms_RadarTrace[nextBlip].m_nEntityHandle = 0;
- ms_RadarTrace[nextBlip].m_wScale = 1;
- ms_RadarTrace[nextBlip].m_eBlipDisplay = display;
- ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
- return CRadar::GetNewUniqueBlipIndex(nextBlip);
-}
-
-int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDisplay display)
-{
- int nextBlip;
- for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
- if (!ms_RadarTrace[nextBlip].m_bInUse)
- break;
- }
- ms_RadarTrace[nextBlip].m_eBlipType = type;
- ms_RadarTrace[nextBlip].m_nColor = color;
- ms_RadarTrace[nextBlip].m_bDim = 1;
- ms_RadarTrace[nextBlip].m_bInUse = 1;
- ms_RadarTrace[nextBlip].m_Radius = 1.0f;
- ms_RadarTrace[nextBlip].m_nEntityHandle = handle;
- ms_RadarTrace[nextBlip].m_wScale = 1;
- ms_RadarTrace[nextBlip].m_eBlipDisplay = display;
- ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
- return GetNewUniqueBlipIndex(nextBlip);
-}
-
-void CRadar::SetRadarMarkerState(int32 counter, bool flag)
-{
- CEntity *e;
- switch (ms_RadarTrace[counter].m_eBlipType) {
- case BLIP_CAR:
- e = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[counter].m_nEntityHandle);
- break;
- case BLIP_CHAR:
- e = CPools::GetPedPool()->GetAt(ms_RadarTrace[counter].m_nEntityHandle);
- break;
- case BLIP_OBJECT:
- e = CPools::GetObjectPool()->GetAt(ms_RadarTrace[counter].m_nEntityHandle);
- break;
- default:
- return;
- }
-
- if (e)
- e->bHasBlip = flag;
-}
-
-void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) {
- float f1 = radius * 1.4f;
- float f2 = radius * 0.5f;
- CVector p1, p2;
-
- p1 = pos + TheCamera.GetUp()*f1;
- p2 = pos + TheCamera.GetUp()*f2;
- CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
-
- p1 = pos - TheCamera.GetUp()*f1;
- p2 = pos - TheCamera.GetUp()*f2;
- CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
-
- p1 = pos + TheCamera.GetRight()*f1;
- p2 = pos + TheCamera.GetRight()*f2;
- CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
-
- p1 = pos - TheCamera.GetRight()*f1;
- p2 = pos - TheCamera.GetRight()*f2;
- CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
-}
-
-void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha)
-{
- if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
- return;
-
- CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha));
- CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha));
-}
-
-void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha, uint8 mode)
-{
- if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
- return;
-
- switch (mode)
- {
- case BLIP_MODE_TRIANGULAR_UP:
- // size++; // VC does size + 1 for triangles
- CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(size + 3.0f), y + SCREEN_SCALE_Y(size + 2.0f), x - (SCREEN_SCALE_X(size + 3.0f)), y + SCREEN_SCALE_Y(size + 2.0f), x, y - (SCREEN_SCALE_Y(size + 3.0f)), x, y - (SCREEN_SCALE_Y(size + 3.0f)), CRGBA(0, 0, 0, alpha));
- CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(size + 1.0f), y + SCREEN_SCALE_Y(size + 1.0f), x - (SCREEN_SCALE_X(size + 1.0f)), y + SCREEN_SCALE_Y(size + 1.0f), x, y - (SCREEN_SCALE_Y(size + 1.0f)), x, y - (SCREEN_SCALE_Y(size + 1.0f)), CRGBA(red, green, blue, alpha));
- break;
- case BLIP_MODE_TRIANGULAR_DOWN:
- // size++; // VC does size + 1 for triangles
- CSprite2d::Draw2DPolygon(x, y + SCREEN_SCALE_Y(size + 2.0f), x, y + SCREEN_SCALE_Y(size + 3.0f), x + SCREEN_SCALE_X(size + 3.0f), y - (SCREEN_SCALE_Y(size + 2.0f)), x - (SCREEN_SCALE_X(size + 3.0f)), y - (SCREEN_SCALE_Y(size + 2.0f)), CRGBA(0, 0, 0, alpha));
- CSprite2d::Draw2DPolygon(x, y + SCREEN_SCALE_Y(size + 1.0f), x, y + SCREEN_SCALE_Y(size + 1.0f), x + SCREEN_SCALE_X(size + 1.0f), y - (SCREEN_SCALE_Y(size + 1.0f)), x - (SCREEN_SCALE_X(size + 1.0f)), y - (SCREEN_SCALE_Y(size + 1.0f)), CRGBA(red, green, blue, alpha));
- break;
- case BLIP_MODE_SQUARE:
- CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha));
- CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha));
- break;
- }
-}
-
-void CRadar::Shutdown()
-{
- AsukaSprite.Delete();
- BombSprite.Delete();
- CatSprite.Delete();
- CentreSprite.Delete();
- CopcarSprite.Delete();
- DonSprite.Delete();
- EightSprite.Delete();
- ElSprite.Delete();
- IceSprite.Delete();
- JoeySprite.Delete();
- KenjiSprite.Delete();
- LizSprite.Delete();
- LuigiSprite.Delete();
- NorthSprite.Delete();
- RaySprite.Delete();
- SalSprite.Delete();
- SaveSprite.Delete();
- SpraySprite.Delete();
- TonySprite.Delete();
- WeaponSprite.Delete();
- RemoveRadarSections();
-}
-
-void CRadar::StreamRadarSections(const CVector &posn)
-{
- StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f));
-}
-
-void CRadar::StreamRadarSections(int32 x, int32 y)
-{
- for (int i = 0; i < RADAR_NUM_TILES; ++i) {
- for (int j = 0; j < RADAR_NUM_TILES; ++j) {
- if ((i >= x - 1 && i <= x + 1) && (j >= y - 1 && j <= y + 1))
- RequestMapSection(i, j);
- else
- RemoveMapSection(i, j);
- };
- };
-}
-
-void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y)
-{
- out.x = in.x - (x * RADAR_TILE_SIZE + WORLD_MIN_X);
- out.y = -(in.y - ((RADAR_NUM_TILES - y) * RADAR_TILE_SIZE + WORLD_MIN_Y));
- out.x /= RADAR_TILE_SIZE;
- out.y /= RADAR_TILE_SIZE;
-}
-
-void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in)
-{
- float s, c;
-
- s = -Sin(TheCamera.GetForward().Heading());
- c = Cos(TheCamera.GetForward().Heading());
-
- if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED) {
- s = 0.0f;
- c = 1.0f;
- }
- else if (TheCamera.GetLookDirection() != LOOKING_FORWARD) {
- CVector forward;
-
- if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON) {
- forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward();
- forward.Normalise(); // a bit useless...
- }
- else
- forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
-
- s = -Sin(forward.Heading());
- c = Cos(forward.Heading());
- }
-
- out.x = s * in.y + c * in.x;
- out.y = c * in.y - s * in.x;
-
- out = out * m_radarRange + vec2DRadarOrigin;
-}
-
-// Radar space goes from -1.0 to 1.0 in x and y, top right is (1.0, 1.0)
-void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
-{
-#ifdef FIX_BUGS
- out.x = (in.x + 1.0f)*0.5f*SCREEN_SCALE_X(RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
-#else
- out.x = (in.x + 1.0f)*0.5f*SCREEN_SCALE_X(RADAR_WIDTH) + RADAR_LEFT;
-#endif
- out.y = (1.0f - in.y)*0.5f*SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
-}
-
-void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in)
-{
- float s, c;
- if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED) {
- s = 0.0f;
- c = 1.0f;
- }
- else if (TheCamera.GetLookDirection() == LOOKING_FORWARD) {
- s = Sin(TheCamera.GetForward().Heading());
- c = Cos(TheCamera.GetForward().Heading());
- }
- else {
- CVector forward;
-
- if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON) {
- forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward();
- forward.Normalise(); // a bit useless...
- }
- else
- forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
-
- s = Sin(forward.Heading());
- c = Cos(forward.Heading());
- }
-
- float x = (in.x - vec2DRadarOrigin.x) * (1.0f / m_radarRange);
- float y = (in.y - vec2DRadarOrigin.y) * (1.0f / m_radarRange);
-
- out.x = s * y + c * x;
- out.y = c * y - s * x;
-}
-
-// Transform from section indices to world coordinates
-void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out)
-{
- x = x - RADAR_NUM_TILES/2;
- y = -(y - RADAR_NUM_TILES/2);
-
- // bottom left
- out[0].x = RADAR_TILE_SIZE * (x);
- out[0].y = RADAR_TILE_SIZE * (y - 1);
-
- // bottom right
- out[1].x = RADAR_TILE_SIZE * (x + 1);
- out[1].y = RADAR_TILE_SIZE * (y - 1);
-
- // top right
- out[2].x = RADAR_TILE_SIZE * (x + 1);
- out[2].y = RADAR_TILE_SIZE * (y);
-
- // top left
- out[3].x = RADAR_TILE_SIZE * (x);
- out[3].y = RADAR_TILE_SIZE * (y);
-}
-
-void CRadar::ClipRadarTileCoords(int32 &x, int32 &y)
-{
- if (x < 0)
- x = 0;
- if (x > RADAR_NUM_TILES-1)
- x = RADAR_NUM_TILES-1;
- if (y < 0)
- y = 0;
- if (y > RADAR_NUM_TILES-1)
- y = RADAR_NUM_TILES-1;
-}
-
-
-bool CRadar::IsPointInsideRadar(const CVector2D &point)
-{
- if (point.x < -1.0f || point.x > 1.0f) return false;
- if (point.y < -1.0f || point.y > 1.0f) return false;
- return true;
-}
-
-// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
-int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
-{
- float d1, d2;
- float t;
- float x, y;
- float shortest = 1.0f;
- int edge = -1;
-
- // clip against left edge, x = -1.0
- d1 = -1.0f - p1.x;
- d2 = -1.0f - p2.x;
- if (d1 * d2 < 0.0f) {
- // they are on opposite sides, get point of intersection
- t = d1 / (d1 - d2);
- y = (p2.y - p1.y)*t + p1.y;
- if (y >= -1.0f && y <= 1.0f && t <= shortest) {
- out.x = -1.0f;
- out.y = y;
- edge = 3;
- shortest = t;
- }
- }
-
- // clip against right edge, x = 1.0
- d1 = p1.x - 1.0f;
- d2 = p2.x - 1.0f;
- if (d1 * d2 < 0.0f) {
- // they are on opposite sides, get point of intersection
- t = d1 / (d1 - d2);
- y = (p2.y - p1.y)*t + p1.y;
- if (y >= -1.0f && y <= 1.0f && t <= shortest) {
- out.x = 1.0f;
- out.y = y;
- edge = 1;
- shortest = t;
- }
- }
-
- // clip against top edge, y = -1.0
- d1 = -1.0f - p1.y;
- d2 = -1.0f - p2.y;
- if (d1 * d2 < 0.0f) {
- // they are on opposite sides, get point of intersection
- t = d1 / (d1 - d2);
- x = (p2.x - p1.x)*t + p1.x;
- if (x >= -1.0f && x <= 1.0f && t <= shortest) {
- out.y = -1.0f;
- out.x = x;
- edge = 0;
- shortest = t;
- }
- }
-
- // clip against bottom edge, y = 1.0
- d1 = p1.y - 1.0f;
- d2 = p2.y - 1.0f;
- if (d1 * d2 < 0.0f) {
- // they are on opposite sides, get point of intersection
- t = d1 / (d1 - d2);
- x = (p2.x - p1.x)*t + p1.x;
- if (x >= -1.0f && x <= 1.0f && t <= shortest) {
- out.y = 1.0f;
- out.x = x;
- edge = 2;
- shortest = t;
- }
- }
-
- return edge;
-}
-
-STARTPATCHES
- InjectHook(0x4A3EF0, CRadar::Initialise, PATCH_JUMP);
- InjectHook(0x4A3F60, CRadar::Shutdown, PATCH_JUMP);
- InjectHook(0x4A4030, CRadar::LoadTextures, PATCH_JUMP);
- InjectHook(0x4A4180, CRadar::GetNewUniqueBlipIndex, PATCH_JUMP);
- InjectHook(0x4A41C0, CRadar::GetActualBlipArrayIndex, PATCH_JUMP);
- InjectHook(0x4A4200, CRadar::DrawMap, PATCH_JUMP);
- InjectHook(0x4A42F0, CRadar::DrawBlips, PATCH_JUMP);
- InjectHook(0x4A4C70, CRadar::Draw3dMarkers, PATCH_JUMP);
- InjectHook(0x4A4F30, CRadar::LimitRadarPoint, PATCH_JUMP);
- InjectHook(0x4A4F90, CRadar::CalculateBlipAlpha, PATCH_JUMP);
- InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP);
- InjectHook(0x4A50D0, CRadar::TransformRealWorldPointToRadarSpace, PATCH_JUMP);
- InjectHook(0x4A5300, CRadar::TransformRadarPointToRealWorldSpace, PATCH_JUMP);
- InjectHook(0x4A5530, CRadar::TransformRealWorldToTexCoordSpace, PATCH_JUMP);
- InjectHook(0x4A5590, CRadar::SetCoordBlip, PATCH_JUMP);
- InjectHook(0x4A5640, CRadar::SetEntityBlip, PATCH_JUMP);
- InjectHook(0x4A56C0, CRadar::ClearBlipForEntity, PATCH_JUMP);
- InjectHook(0x4A5720, CRadar::ClearBlip, PATCH_JUMP);
- InjectHook(0x4A5770, CRadar::ChangeBlipColour, PATCH_JUMP);
- InjectHook(0x4A57A0, CRadar::ChangeBlipBrightness, PATCH_JUMP);
- InjectHook(0x4A57E0, CRadar::ChangeBlipScale, PATCH_JUMP);
- InjectHook(0x4A5810, CRadar::ChangeBlipDisplay, PATCH_JUMP);
- InjectHook(0x4A5840, CRadar::SetBlipSprite, PATCH_JUMP);
- InjectHook(0x4A5870, CRadar::ShowRadarTrace, PATCH_JUMP);
- InjectHook(0x4A59C0, CRadar::ShowRadarMarker, PATCH_JUMP);
- InjectHook(0x4A5BB0, CRadar::GetRadarTraceColour, PATCH_JUMP);
- InjectHook(0x4A5C60, CRadar::SetRadarMarkerState, PATCH_JUMP);
- InjectHook(0x4A5D10, CRadar::DrawRotatingRadarSprite, PATCH_JUMP);
- InjectHook(0x4A5EF0, CRadar::DrawRadarSprite, PATCH_JUMP);
- InjectHook(0x4A60E0, CRadar::RemoveRadarSections, PATCH_JUMP);
- InjectHook(0x4A6100, (void (*)(int32, int32))&CRadar::StreamRadarSections, PATCH_JUMP);
- InjectHook(0x4A64A0, CRadar::ClipRadarPoly, PATCH_JUMP);
- InjectHook(0x4A67E0, CRadar::DrawRadarSection, PATCH_JUMP);
- InjectHook(0x4A69C0, CRadar::DrawRadarMask, PATCH_JUMP);
- InjectHook(0x4A6B60, (void (*)(const CVector&))&CRadar::StreamRadarSections, PATCH_JUMP);
- InjectHook(0x4A6C20, CRadar::DrawRadarMap, PATCH_JUMP);
- InjectHook(0x4A6E30, CRadar::SaveAllRadarBlips, PATCH_JUMP);
- InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP);
-
- InjectHook(0x4A61C0, CRadar::GetTextureCorners, PATCH_JUMP);
- InjectHook(0x4A6160, CRadar::IsPointInsideRadar, PATCH_JUMP);
- InjectHook(0x4A6250, CRadar::LineRadarBoxCollision, PATCH_JUMP);
-ENDPATCHES
+#include "config.h"
+#include "common.h"
+#include "patcher.h"
+#include "RwHelper.h"
+#include "Radar.h"
+#include "Camera.h"
+#include "Hud.h"
+#include "World.h"
+#include "Frontend.h"
+#include "General.h"
+#include "Vehicle.h"
+#include "Pools.h"
+#include "Script.h"
+#include "TxdStore.h"
+#include "World.h"
+#include "Streaming.h"
+#include "SpecialFX.h"
+
+float &CRadar::m_radarRange = *(float*)0x8E281C;
+sRadarTrace (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(sRadarTrace(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0;
+CVector2D &vec2DRadarOrigin = *(CVector2D*)0x6299B8;
+int32 gRadarTxdIds[64];// = (int*)0x6299C0;
+
+CSprite2d CRadar::AsukaSprite;// = *(CSprite2d*)0x8F1A40;
+CSprite2d CRadar::BombSprite;// = (CSprite2d*)0x8F5FB4;
+CSprite2d CRadar::CatSprite;// = (CSprite2d*)0x885B24;
+CSprite2d CRadar::CentreSprite;// = (CSprite2d*)0x8F6268;
+CSprite2d CRadar::CopcarSprite;// = (CSprite2d*)0x8F1A2C;
+CSprite2d CRadar::DonSprite;// = (CSprite2d*)0x8F2BE0;
+CSprite2d CRadar::EightSprite;// = (CSprite2d*)0x8F2BCC;
+CSprite2d CRadar::ElSprite;// = (CSprite2d*)0x8F1B80;
+CSprite2d CRadar::IceSprite;// = (CSprite2d*)0x9415FC;
+CSprite2d CRadar::JoeySprite;// = (CSprite2d*)0x8F2C00;
+CSprite2d CRadar::KenjiSprite;// = (CSprite2d*)0x8F2C68;
+CSprite2d CRadar::LizSprite;// = (CSprite2d*)0x8F5830;
+CSprite2d CRadar::LuigiSprite;// = (CSprite2d*)0x8F1A3C;
+CSprite2d CRadar::NorthSprite;// = (CSprite2d*)0x8F6274;
+CSprite2d CRadar::RaySprite;// = (CSprite2d*)0x8E2A7C;
+CSprite2d CRadar::SalSprite;// = (CSprite2d*)0x8F29EC;
+CSprite2d CRadar::SaveSprite;// = (CSprite2d*)0x8F5F74;
+CSprite2d CRadar::SpraySprite;// = (CSprite2d*)0x94307C;
+CSprite2d CRadar::TonySprite;// = (CSprite2d*)0x885B58;
+CSprite2d CRadar::WeaponSprite;// = (CSprite2d*)0x941534;
+
+CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
+ nil,
+ &AsukaSprite,
+ &BombSprite,
+ &CatSprite,
+ &CentreSprite,
+ &CopcarSprite,
+ &DonSprite,
+ &EightSprite,
+ &ElSprite,
+ &IceSprite,
+ &JoeySprite,
+ &KenjiSprite,
+ &LizSprite,
+ &LuigiSprite,
+ &NorthSprite,
+ &RaySprite,
+ &SalSprite,
+ &SaveSprite,
+ &SpraySprite,
+ &TonySprite,
+ &WeaponSprite
+};
+
+#define RADAR_NUM_TILES (8)
+#define RADAR_TILE_SIZE (WORLD_SIZE_X / RADAR_NUM_TILES)
+static_assert(RADAR_TILE_SIZE == (WORLD_SIZE_Y / RADAR_NUM_TILES), "CRadar: not a square");
+
+#define RADAR_MIN_RANGE (120.0f)
+#define RADAR_MAX_RANGE (350.0f)
+#define RADAR_MIN_SPEED (0.3f)
+#define RADAR_MAX_SPEED (0.9f)
+
+#ifdef MENU_MAP
+CRGBA CRadar::ArrowBlipColour1;
+CRGBA CRadar::ArrowBlipColour2;
+uint16 CRadar::MapLegendCounter;
+uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
+int CRadar::TargetMarkerId = -1;
+#endif
+
+// taken from VC
+float CRadar::cachedCos;
+float CRadar::cachedSin;
+
+void ClipRadarTileCoords(int32 &x, int32 &y)
+{
+ if (x < 0)
+ x = 0;
+ if (x > RADAR_NUM_TILES-1)
+ x = RADAR_NUM_TILES-1;
+ if (y < 0)
+ y = 0;
+ if (y > RADAR_NUM_TILES-1)
+ y = RADAR_NUM_TILES-1;
+}
+
+void RequestMapSection(int32 x, int32 y)
+{
+ ClipRadarTileCoords(x, y);
+ CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
+}
+
+void RemoveMapSection(int32 x, int32 y)
+{
+ if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
+ CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
+}
+
+// Transform from section indices to world coordinates
+void GetTextureCorners(int32 x, int32 y, CVector2D *out)
+{
+ x = x - RADAR_NUM_TILES/2;
+ y = -(y - RADAR_NUM_TILES/2);
+
+ // bottom left
+ out[0].x = RADAR_TILE_SIZE * (x);
+ out[0].y = RADAR_TILE_SIZE * (y - 1);
+
+ // bottom right
+ out[1].x = RADAR_TILE_SIZE * (x + 1);
+ out[1].y = RADAR_TILE_SIZE * (y - 1);
+
+ // top right
+ out[2].x = RADAR_TILE_SIZE * (x + 1);
+ out[2].y = RADAR_TILE_SIZE * (y);
+
+ // top left
+ out[3].x = RADAR_TILE_SIZE * (x);
+ out[3].y = RADAR_TILE_SIZE * (y);
+}
+
+
+bool IsPointInsideRadar(const CVector2D &point)
+{
+ if (point.x < -1.0f || point.x > 1.0f) return false;
+ if (point.y < -1.0f || point.y > 1.0f) return false;
+ return true;
+}
+
+// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
+int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
+{
+ float d1, d2;
+ float t;
+ float x, y;
+ float shortest = 1.0f;
+ int edge = -1;
+
+ // clip against left edge, x = -1.0
+ d1 = -1.0f - p1.x;
+ d2 = -1.0f - p2.x;
+ if (d1 * d2 < 0.0f) {
+ // they are on opposite sides, get point of intersection
+ t = d1 / (d1 - d2);
+ y = (p2.y - p1.y)*t + p1.y;
+ if (y >= -1.0f && y <= 1.0f && t <= shortest) {
+ out.x = -1.0f;
+ out.y = y;
+ edge = 3;
+ shortest = t;
+ }
+ }
+
+ // clip against right edge, x = 1.0
+ d1 = p1.x - 1.0f;
+ d2 = p2.x - 1.0f;
+ if (d1 * d2 < 0.0f) {
+ // they are on opposite sides, get point of intersection
+ t = d1 / (d1 - d2);
+ y = (p2.y - p1.y)*t + p1.y;
+ if (y >= -1.0f && y <= 1.0f && t <= shortest) {
+ out.x = 1.0f;
+ out.y = y;
+ edge = 1;
+ shortest = t;
+ }
+ }
+
+ // clip against top edge, y = -1.0
+ d1 = -1.0f - p1.y;
+ d2 = -1.0f - p2.y;
+ if (d1 * d2 < 0.0f) {
+ // they are on opposite sides, get point of intersection
+ t = d1 / (d1 - d2);
+ x = (p2.x - p1.x)*t + p1.x;
+ if (x >= -1.0f && x <= 1.0f && t <= shortest) {
+ out.y = -1.0f;
+ out.x = x;
+ edge = 0;
+ shortest = t;
+ }
+ }
+
+ // clip against bottom edge, y = 1.0
+ d1 = p1.y - 1.0f;
+ d2 = p2.y - 1.0f;
+ if (d1 * d2 < 0.0f) {
+ // they are on opposite sides, get point of intersection
+ t = d1 / (d1 - d2);
+ x = (p2.x - p1.x)*t + p1.x;
+ if (x >= -1.0f && x <= 1.0f && t <= shortest) {
+ out.y = 1.0f;
+ out.x = x;
+ edge = 2;
+ shortest = t;
+ }
+ }
+
+ return edge;
+}
+
+
+uint8 CRadar::CalculateBlipAlpha(float dist)
+{
+#ifdef MENU_MAP
+ if (CMenuManager::bMenuMapActive)
+ return 255;
+#endif
+ if (dist <= 1.0f)
+ return 255;
+
+ if (dist <= 5.0f)
+ return (128.0f * ((dist - 1.0f) / 4.0f)) + ((1.0f - (dist - 1.0f) / 4.0f) * 255.0f);
+
+ return 128;
+}
+
+void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1)
+ ms_RadarTrace[index].m_bDim = bright != 1;
+}
+
+void CRadar::ChangeBlipColour(int32 i, int32 color)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1)
+ ms_RadarTrace[index].m_nColor = color;
+}
+
+void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1)
+ ms_RadarTrace[index].m_eBlipDisplay = display;
+}
+
+void CRadar::ChangeBlipScale(int32 i, int32 scale)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1)
+ ms_RadarTrace[index].m_wScale = scale;
+}
+
+void CRadar::ClearBlip(int32 i)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1) {
+ SetRadarMarkerState(index, false);
+ ms_RadarTrace[index].m_bInUse = false;
+#ifndef MENU_MAP
+ // Ssshhh
+ ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
+ ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
+ ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE;
+#endif
+ }
+}
+
+void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
+{
+ for (int i = 0; i < NUMRADARBLIPS; i++) {
+ if (type == ms_RadarTrace[i].m_eBlipType && id == ms_RadarTrace[i].m_nEntityHandle) {
+ SetRadarMarkerState(i, false);
+ ms_RadarTrace[i].m_bInUse = false;
+ ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
+ ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
+ ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
+ }
+ };
+}
+
+// Why not a proper clipping algorithm?
+int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
+{
+ CVector2D corners[4] = {
+ { 1.0f, -1.0f }, // top right
+ { 1.0f, 1.0f }, // bottom right
+ { -1.0f, 1.0f }, // bottom left
+ { -1.0f, -1.0f }, // top left
+ };
+ CVector2D tmp;
+ int i, j, n;
+ int laste, e, e1, e2;;
+ bool inside[4];
+
+ for (i = 0; i < 4; i++)
+ inside[i] = IsPointInsideRadar(rect[i]);
+
+ laste = -1;
+ n = 0;
+ for (i = 0; i < 4; i++)
+ if (inside[i]) {
+ // point is inside, just add
+ poly[n++] = rect[i];
+ }
+ else {
+ // point is outside but line to this point might be clipped
+ e1 = LineRadarBoxCollision(poly[n], rect[i], rect[(i + 4 - 1) % 4]);
+ if (e1 != -1) {
+ laste = e1;
+ n++;
+ }
+ // and line from this point might be clipped as well
+ e2 = LineRadarBoxCollision(poly[n], rect[i], rect[(i + 1) % 4]);
+ if (e2 != -1) {
+ if (e1 == -1) {
+ // if other line wasn't clipped, i.e. it was complete outside,
+ // we may have to insert another vertex if last clipped line
+ // was on a different edge
+
+ // find the last intersection if we haven't seen it yet
+ if (laste == -1)
+ for (j = 3; j >= i; j--) {
+ // game uses an if here for j == 0
+ e = LineRadarBoxCollision(tmp, rect[j], rect[(j + 4 - 1) % 4]);
+ if (e != -1) {
+ laste = e;
+ break;
+ }
+ }
+ assert(laste != -1);
+
+ // insert corners that were skipped
+ tmp = poly[n];
+ for (e = laste; e != e2; e = (e + 1) % 4)
+ poly[n++] = corners[e];
+ poly[n] = tmp;
+ }
+ n++;
+ }
+ }
+
+ if (n == 0) {
+ // If no points, either the rectangle is completely outside or completely surrounds the radar
+ // no idea what's going on here...
+ float m = (rect[0].y - rect[1].y) / (rect[0].x - rect[1].x);
+ if ((m*rect[3].x - rect[3].y) * (m*rect[0].x - rect[0].y) < 0.0f) {
+ m = (rect[0].y - rect[3].y) / (rect[0].x - rect[3].x);
+ if ((m*rect[1].x - rect[1].y) * (m*rect[0].x - rect[0].y) < 0.0f) {
+ poly[0] = corners[0];
+ poly[1] = corners[1];
+ poly[2] = corners[2];
+ poly[3] = corners[3];
+ n = 4;
+ }
+ }
+ }
+
+ return n;
+}
+
+bool CRadar::DisplayThisBlip(int32 counter)
+{
+ switch (ms_RadarTrace[counter].m_eRadarSprite) {
+ case RADAR_SPRITE_BOMB:
+ case RADAR_SPRITE_SPRAY:
+ case RADAR_SPRITE_WEAPON:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void CRadar::Draw3dMarkers()
+{
+ for (int i = 0; i < NUMRADARBLIPS; i++) {
+ if (ms_RadarTrace[i].m_bInUse) {
+ switch (ms_RadarTrace[i].m_eBlipType) {
+ case BLIP_CAR:
+ {
+ CEntity *entity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
+ if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ CVector pos = entity->GetPosition();
+ pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f;
+ C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 2.5f, 0, 128, 255, 255, 1024, 0.2f, 5);
+ }
+ break;
+ }
+ case BLIP_CHAR:
+ {
+ CEntity *entity = CPools::GetPedPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
+ if (entity != nil) {
+ if (((CPed*)entity)->InVehicle())
+ entity = ((CPed * )entity)->m_pMyVehicle;
+ }
+ if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ CVector pos = entity->GetPosition();
+ pos.z += 3.0f;
+ C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.5f, 0, 128, 255, 255, 1024, 0.2f, 5);
+ }
+ break;
+ }
+ case BLIP_OBJECT:
+ {
+ CEntity *entity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
+ if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ CVector pos = entity->GetPosition();
+ pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f;
+ C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.0f, 0, 128, 255, 255, 1024, 0.2f, 5);
+ }
+ break;
+ }
+ case BLIP_COORD:
+ break;
+ case BLIP_CONTACT_POINT:
+ if (!CTheScripts::IsPlayerOnAMission()) {
+ if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY)
+ C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), 4, ms_RadarTrace[i].m_vecPos, 2.0f, 0, 128, 255, 128, 2048, 0.2f, 0);
+ }
+ break;
+ }
+ }
+ }
+}
+
+void CRadar::DrawBlips()
+{
+ if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
+
+ CVector2D out;
+ CVector2D in = CVector2D(0.0f, 0.0f);
+ TransformRadarPointToScreenSpace(out, in);
+
+#ifdef MENU_MAP
+ if (!CMenuManager::bMenuMapActive) {
+#endif
+ float angle;
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
+ angle = PI + FindPlayerHeading();
+#ifdef FIX_BUGS
+ else if (TheCamera.GetLookDirection() != LOOKING_FORWARD)
+ angle = FindPlayerHeading() - (PI + (TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind).Heading());
+#endif
+ else
+ angle = FindPlayerHeading() - (PI + TheCamera.GetForward().Heading());
+
+ DrawRotatingRadarSprite(&CentreSprite, out.x, out.y, angle, 255);
+
+ CVector2D vec2d;
+ vec2d.x = vec2DRadarOrigin.x;
+ vec2d.y = M_SQRT2 * m_radarRange + vec2DRadarOrigin.y;
+ TransformRealWorldPointToRadarSpace(in, vec2d);
+ LimitRadarPoint(in);
+ TransformRadarPointToScreenSpace(out, in);
+ DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255);
+#ifdef MENU_MAP
+ }
+#endif
+
+ CEntity *blipEntity = nil;
+ for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
+#ifdef MENU_MAP
+ // A little hack to reuse cleared blips in menu map. hehe
+ if (!CMenuManager::bMenuMapActive || ms_RadarTrace[blipId].m_eBlipType == BLIP_CAR ||
+ ms_RadarTrace[blipId].m_eBlipType == BLIP_CHAR || ms_RadarTrace[blipId].m_eBlipType == BLIP_OBJECT)
+#endif
+ if (!ms_RadarTrace[blipId].m_bInUse)
+ continue;
+
+ switch (ms_RadarTrace[blipId].m_eBlipType) {
+ case BLIP_CAR:
+ case BLIP_CHAR:
+ case BLIP_OBJECT:
+ if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
+ || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON) {
+
+ switch (ms_RadarTrace[blipId].m_eBlipType) {
+ case BLIP_CAR:
+ blipEntity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ break;
+ case BLIP_CHAR:
+ blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ if (blipEntity != nil) {
+ if (((CPed*)blipEntity)->InVehicle())
+ blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
+ }
+ break;
+ case BLIP_OBJECT:
+ blipEntity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ break;
+ default:
+ break;
+ }
+ if (blipEntity) {
+ uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ if (CTheScripts::IsDebugOn()) {
+ ShowRadarMarker(blipEntity->GetPosition(), color, ms_RadarTrace[blipId].m_Radius);
+ ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
+ if (ms_RadarTrace[blipId].m_Radius < 1.0f)
+ ms_RadarTrace[blipId].m_Radius = 5.0f;
+ }
+ }
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
+ TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
+ float dist = LimitRadarPoint(in);
+ TransformRadarPointToScreenSpace(out, in);
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
+ } else {
+#ifdef TRIANGULAR_BLIPS
+ CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
+ CVector &blipPos = blipEntity->GetPosition();
+ uint8 mode = BLIP_MODE_TRIANGULAR_UP;
+ if (blipPos.z - pos.z <= 2.0f) {
+ if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
+ else mode = BLIP_MODE_SQUARE;
+ }
+ ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
+#else
+ ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
+#endif
+ }
+ }
+ }
+ }
+ break;
+ case BLIP_COORD:
+ case BLIP_CONTACT_POINT:
+ if ((ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
+ || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON)
+ && (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
+
+ uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ if (CTheScripts::IsDebugOn()) {
+ ShowRadarMarker(ms_RadarTrace[blipId].m_vecPos, color, ms_RadarTrace[blipId].m_Radius);
+ ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
+ if (ms_RadarTrace[blipId].m_Radius < 1.0f)
+ ms_RadarTrace[blipId].m_Radius = 5.0f;
+ }
+ }
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
+ TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
+ float dist = LimitRadarPoint(in);
+ TransformRadarPointToScreenSpace(out, in);
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
+ } else {
+#ifdef TRIANGULAR_BLIPS
+ CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
+ CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
+ uint8 mode = BLIP_MODE_TRIANGULAR_UP;
+ if (blipPos.z - pos.z <= 2.0f) {
+ if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
+ else mode = BLIP_MODE_SQUARE;
+ }
+ ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
+#else
+ ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
+#endif
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
+ if (!ms_RadarTrace[blipId].m_bInUse)
+ continue;
+
+ switch (ms_RadarTrace[blipId].m_eBlipType) {
+ case BLIP_CAR:
+ case BLIP_CHAR:
+ case BLIP_OBJECT:
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON) {
+
+ switch (ms_RadarTrace[blipId].m_eBlipType) {
+ case BLIP_CAR:
+ blipEntity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ break;
+ case BLIP_CHAR:
+ blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ if (blipEntity != nil) {
+ if (((CPed*)blipEntity)->InVehicle())
+ blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
+ }
+ break;
+ case BLIP_OBJECT:
+ blipEntity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ break;
+ default:
+ break;
+ }
+
+ if (blipEntity) {
+ uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ if (CTheScripts::IsDebugOn()) {
+ ShowRadarMarker(blipEntity->GetPosition(), color, ms_RadarTrace[blipId].m_Radius);
+ ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
+ if (ms_RadarTrace[blipId].m_Radius < 1.0f)
+ ms_RadarTrace[blipId].m_Radius = 5.0f;
+ }
+ }
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
+ TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
+ float dist = LimitRadarPoint(in);
+ TransformRadarPointToScreenSpace(out, in);
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
+ else
+#ifdef TRIANGULAR_BLIPS
+ {
+ CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
+ CVector &blipPos = blipEntity->GetPosition();
+ uint8 mode = BLIP_MODE_TRIANGULAR_UP;
+ if (blipPos.z - pos.z <= 2.0f) {
+ if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
+ else mode = BLIP_MODE_SQUARE;
+ }
+ ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
+ }
+#else
+ ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
+#endif
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ for (int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
+ if (!ms_RadarTrace[blipId].m_bInUse)
+ continue;
+
+ switch (ms_RadarTrace[blipId].m_eBlipType) {
+ case BLIP_COORD:
+ case BLIP_CONTACT_POINT:
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON
+ && (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
+
+ uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ if (CTheScripts::IsDebugOn()) {
+ ShowRadarMarker(ms_RadarTrace[blipId].m_vecPos, color, ms_RadarTrace[blipId].m_Radius);
+ ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
+ if (ms_RadarTrace[blipId].m_Radius < 1.0f)
+ ms_RadarTrace[blipId].m_Radius = 5.0f;
+ }
+ }
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
+ TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
+ float dist = LimitRadarPoint(in);
+ TransformRadarPointToScreenSpace(out, in);
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
+ else
+#ifdef TRIANGULAR_BLIPS
+ {
+ CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
+ CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
+ uint8 mode = BLIP_MODE_TRIANGULAR_UP;
+ if (blipPos.z - pos.z <= 2.0f) {
+ if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
+ else mode = BLIP_MODE_SQUARE;
+ }
+ ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
+ }
+#else
+ ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
+#endif
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+#ifdef MENU_MAP
+ if (CMenuManager::bMenuMapActive) {
+ CVector2D in, out;
+ TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
+ TransformRadarPointToScreenSpace(out, in);
+ DrawYouAreHereSprite(out.x, out.y);
+ }
+#endif
+ }
+}
+
+void CRadar::DrawMap()
+{
+ if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
+#if 1 // from VC
+ CalculateCachedSinCos();
+#endif
+ if (FindPlayerVehicle()) {
+ float speed = FindPlayerSpeed().Magnitude();
+ if (speed < RADAR_MIN_SPEED)
+ m_radarRange = RADAR_MIN_RANGE;
+ else if (speed < RADAR_MAX_SPEED)
+ m_radarRange = (speed - RADAR_MIN_SPEED)/(RADAR_MAX_SPEED-RADAR_MIN_SPEED) * (RADAR_MAX_RANGE-RADAR_MIN_RANGE) + RADAR_MIN_RANGE;
+ else
+ m_radarRange = RADAR_MAX_RANGE;
+ }
+ else
+ m_radarRange = RADAR_MIN_RANGE;
+
+ vec2DRadarOrigin = CVector2D(FindPlayerCentreOfWorld_NoSniperShift());
+ DrawRadarMap();
+ }
+}
+
+void CRadar::DrawRadarMap()
+{
+ // Game calculates an unused CRect here
+
+ DrawRadarMask();
+
+ // top left ist (0, 0)
+ int x = floorf((vec2DRadarOrigin.x - WORLD_MIN_X) / RADAR_TILE_SIZE);
+ int y = ceilf((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - WORLD_MIN_Y) / RADAR_TILE_SIZE);
+ StreamRadarSections(x, y);
+
+ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
+ RwRenderStateSet(rwRENDERSTATETEXTUREPERSPECTIVE, (void*)FALSE);
+
+ DrawRadarSection(x - 1, y - 1);
+ DrawRadarSection(x, y - 1);
+ DrawRadarSection(x + 1, y - 1);
+ DrawRadarSection(x - 1, y);
+ DrawRadarSection(x, y);
+ DrawRadarSection(x + 1, y);
+ DrawRadarSection(x - 1, y + 1);
+ DrawRadarSection(x, y + 1);
+ DrawRadarSection(x + 1, y + 1);
+}
+
+void CRadar::DrawRadarMask()
+{
+ CVector2D corners[4] = {
+ CVector2D(1.0f, -1.0f),
+ CVector2D(1.0f, 1.0f),
+ CVector2D(-1.0f, 1.0f),
+ CVector2D(-1.0, -1.0f)
+ };
+
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+
+ CVector2D out[8];
+ CVector2D in;
+
+ // Draw the shape we want to mask out from the radar in four segments
+ for (int i = 0; i < 4; i++) {
+ // First point is always the corner itself
+ in.x = corners[i].x;
+ in.y = corners[i].y;
+ TransformRadarPointToScreenSpace(out[0], in);
+
+ // Then generate a quarter of the circle
+ for (int j = 0; j < 7; j++) {
+ in.x = corners[i].x * Cos(j * (PI / 2.0f / 6.0f));
+ in.y = corners[i].y * Sin(j * (PI / 2.0f / 6.0f));
+ TransformRadarPointToScreenSpace(out[j + 1], in);
+ };
+
+ CSprite2d::SetMaskVertices(8, (float *)out);
+ RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8);
+ };
+}
+
+void CRadar::DrawRadarSection(int32 x, int32 y)
+{
+ int i;
+ RwTexDictionary *txd;
+ CVector2D worldPoly[8];
+ CVector2D radarCorners[4];
+ CVector2D radarPoly[8];
+ CVector2D texCoords[8];
+ CVector2D screenPoly[8];
+ int numVertices;
+ RwTexture *texture = nil;
+
+ GetTextureCorners(x, y, worldPoly);
+ ClipRadarTileCoords(x, y);
+
+ assert(CTxdStore::GetSlot(gRadarTxdIds[x + RADAR_NUM_TILES * y]));
+ txd = CTxdStore::GetSlot(gRadarTxdIds[x + RADAR_NUM_TILES * y])->texDict;
+ if (txd)
+ texture = GetFirstTexture(txd);
+ if (texture == nil)
+ return;
+
+ for (i = 0; i < 4; i++)
+ TransformRealWorldPointToRadarSpace(radarCorners[i], worldPoly[i]);
+
+ numVertices = ClipRadarPoly(radarPoly, radarCorners);
+
+ // FIX: can return earlier here
+// if(numVertices == 0)
+ if (numVertices < 3)
+ return;
+
+ for (i = 0; i < numVertices; i++) {
+ TransformRadarPointToRealWorldSpace(worldPoly[i], radarPoly[i]);
+ TransformRealWorldToTexCoordSpace(texCoords[i], worldPoly[i], x, y);
+ TransformRadarPointToScreenSpace(screenPoly[i], radarPoly[i]);
+ }
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(texture));
+ CSprite2d::SetVertices(numVertices, (float*)screenPoly, (float*)texCoords, CRGBA(255, 255, 255, 255));
+ // check done above now
+// if(numVertices > 2)
+ RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), numVertices);
+}
+
+void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
+{
+ RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
+#ifdef MENU_MAP
+ if (CMenuManager::bMenuMapActive) {
+ bool alreadyThere = false;
+ for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
+ if (MapLegendList[i] == sprite)
+ alreadyThere = true;
+ }
+ if (!alreadyThere) {
+ MapLegendList[MapLegendCounter] = sprite;
+ MapLegendCounter++;
+ }
+ }
+#endif
+}
+
+void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha)
+{
+ CVector curPosn[4];
+ CVector oldPosn[4];
+
+ curPosn[0].x = x - SCREEN_SCALE_X(5.6f);
+ curPosn[0].y = y + SCREEN_SCALE_Y(5.6f);
+
+ curPosn[1].x = x + SCREEN_SCALE_X(5.6f);
+ curPosn[1].y = y + SCREEN_SCALE_Y(5.6f);
+
+ curPosn[2].x = x - SCREEN_SCALE_X(5.6f);
+ curPosn[2].y = y - SCREEN_SCALE_Y(5.6f);
+
+ curPosn[3].x = x + SCREEN_SCALE_X(5.6f);
+ curPosn[3].y = y - SCREEN_SCALE_Y(5.6f);
+
+ for (uint32 i = 0; i < 4; i++) {
+ oldPosn[i] = curPosn[i];
+
+ curPosn[i].x = x + (oldPosn[i].x - x) * Cos(angle) + (oldPosn[i].y - y) * Sin(angle);
+ curPosn[i].y = y - (oldPosn[i].x - x) * Sin(angle) + (oldPosn[i].y - y) * Cos(angle);
+ }
+
+ sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
+}
+
+int32 CRadar::GetActualBlipArrayIndex(int32 i)
+{
+ if (i == -1)
+ return -1;
+ else if ((i & 0xFFFF0000) >> 16 != ms_RadarTrace[(uint16)i].m_BlipIndex)
+ return -1;
+ else
+ return (uint16)i;
+}
+
+int32 CRadar::GetNewUniqueBlipIndex(int32 i)
+{
+ if (ms_RadarTrace[i].m_BlipIndex >= UINT16_MAX - 1)
+ ms_RadarTrace[i].m_BlipIndex = 1;
+ else
+ ms_RadarTrace[i].m_BlipIndex++;
+ return i | (ms_RadarTrace[i].m_BlipIndex << 16);
+}
+
+uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
+{
+ int32 c;
+ switch (color) {
+ case 0:
+ if (bright)
+ c = 0x712B49FF;
+ else
+ c = 0x7F0000FF;
+ break;
+ case 1:
+ if (bright)
+ c = 0x5FA06AFF;
+ else
+ c = 0x007F00FF;
+ break;
+ case 2:
+ if (bright)
+ c = 0x80A7F3FF;
+ else
+ c = 0x00007FFF;
+ break;
+ case 3:
+ if (bright)
+ c = 0xE1E1E1FF;
+ else
+ c = 0x7F7F7FFF;
+ break;
+ case 4:
+ if (bright)
+ c = 0xFFFF00FF;
+ else
+ c = 0x7F7F00FF;
+ break;
+ case 5:
+ if (bright)
+ c = 0xFF00FFFF;
+ else
+ c = 0x7F007FFF;
+ break;
+ case 6:
+ if (bright)
+ c = 0x00FFFFFF;
+ else
+ c = 0x007F7FFF;
+ break;
+ default:
+ c = color;
+ break;
+ };
+ return c;
+}
+
+const char* gRadarTexNames[] = {
+ "radar00", "radar01", "radar02", "radar03", "radar04", "radar05", "radar06", "radar07",
+ "radar08", "radar09", "radar10", "radar11", "radar12", "radar13", "radar14", "radar15",
+ "radar16", "radar17", "radar18", "radar19", "radar20", "radar21", "radar22", "radar23",
+ "radar24", "radar25", "radar26", "radar27", "radar28", "radar29", "radar30", "radar31",
+ "radar32", "radar33", "radar34", "radar35", "radar36", "radar37", "radar38", "radar39",
+ "radar40", "radar41", "radar42", "radar43", "radar44", "radar45", "radar46", "radar47",
+ "radar48", "radar49", "radar50", "radar51", "radar52", "radar53", "radar54", "radar55",
+ "radar56", "radar57", "radar58", "radar59", "radar60", "radar61", "radar62", "radar63",
+};
+
+void
+CRadar::Initialise()
+{
+ for (int i = 0; i < NUMRADARBLIPS; i++) {
+ ms_RadarTrace[i].m_BlipIndex = 1;
+ SetRadarMarkerState(i, false);
+ ms_RadarTrace[i].m_bInUse = false;
+ ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
+ ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
+ ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
+ }
+
+ m_radarRange = 350.0f;
+ for (int i = 0; i < 64; i++)
+ gRadarTxdIds[i] = CTxdStore::FindTxdSlot(gRadarTexNames[i]);
+}
+
+float CRadar::LimitRadarPoint(CVector2D &point)
+{
+ float dist, invdist;
+
+ dist = point.Magnitude();
+#ifdef MENU_MAP
+ if (CMenuManager::bMenuMapActive)
+ return dist;
+#endif
+ if (dist > 1.0f) {
+ invdist = 1.0f / dist;
+ point.x *= invdist;
+ point.y *= invdist;
+ }
+ return dist;
+}
+
+void CRadar::LoadAllRadarBlips(uint8 *buf, uint32 size)
+{
+ Initialise();
+INITSAVEBUF
+ CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE);
+
+ for (int i = 0; i < NUMRADARBLIPS; i++)
+ ms_RadarTrace[i] = ReadSaveBuf<sRadarTrace>(buf);
+
+VALIDATESAVEBUF(size);
+}
+
+void
+CRadar::LoadTextures()
+{
+ CTxdStore::PushCurrentTxd();
+ CTxdStore::SetCurrentTxd(CTxdStore::FindTxdSlot("hud"));
+ AsukaSprite.SetTexture("radar_asuka");
+ BombSprite.SetTexture("radar_bomb");
+ CatSprite.SetTexture("radar_cat");
+ CentreSprite.SetTexture("radar_centre");
+ CopcarSprite.SetTexture("radar_copcar");
+ DonSprite.SetTexture("radar_don");
+ EightSprite.SetTexture("radar_eight");
+ ElSprite.SetTexture("radar_el");
+ IceSprite.SetTexture("radar_ice");
+ JoeySprite.SetTexture("radar_joey");
+ KenjiSprite.SetTexture("radar_kenji");
+ LizSprite.SetTexture("radar_liz");
+ LuigiSprite.SetTexture("radar_luigi");
+ NorthSprite.SetTexture("radar_north");
+ RaySprite.SetTexture("radar_ray");
+ SalSprite.SetTexture("radar_sal");
+ SaveSprite.SetTexture("radar_save");
+ SpraySprite.SetTexture("radar_spray");
+ TonySprite.SetTexture("radar_tony");
+ WeaponSprite.SetTexture("radar_weapon");
+ CTxdStore::PopCurrentTxd();
+}
+
+void CRadar::RemoveRadarSections()
+{
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 8; j++)
+ RemoveMapSection(i, j);
+}
+
+void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
+{
+ *size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace);
+INITSAVEBUF
+ WriteSaveHeader(buf, 'R', 'D', 'R', '\0', *size - SAVE_HEADER_SIZE);
+
+ for (int i = 0; i < NUMRADARBLIPS; i++)
+ WriteSaveBuf(buf, ms_RadarTrace[i]);
+
+VALIDATESAVEBUF(*size);
+}
+
+void CRadar::SetBlipSprite(int32 i, int32 icon)
+{
+ int index = CRadar::GetActualBlipArrayIndex(i);
+ if (index != -1) {
+ ms_RadarTrace[index].m_eRadarSprite = icon;
+ }
+}
+
+int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay display)
+{
+ int nextBlip;
+ for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
+ if (!ms_RadarTrace[nextBlip].m_bInUse)
+ break;
+ }
+ ms_RadarTrace[nextBlip].m_eBlipType = type;
+ ms_RadarTrace[nextBlip].m_nColor = color;
+ ms_RadarTrace[nextBlip].m_bDim = 1;
+ ms_RadarTrace[nextBlip].m_bInUse = 1;
+ ms_RadarTrace[nextBlip].m_Radius = 1.0f;
+ ms_RadarTrace[nextBlip].m_vec2DPos = pos;
+ ms_RadarTrace[nextBlip].m_vecPos = pos;
+ ms_RadarTrace[nextBlip].m_nEntityHandle = 0;
+ ms_RadarTrace[nextBlip].m_wScale = 1;
+ ms_RadarTrace[nextBlip].m_eBlipDisplay = display;
+ ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
+ return CRadar::GetNewUniqueBlipIndex(nextBlip);
+}
+
+int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDisplay display)
+{
+ int nextBlip;
+ for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
+ if (!ms_RadarTrace[nextBlip].m_bInUse)
+ break;
+ }
+ ms_RadarTrace[nextBlip].m_eBlipType = type;
+ ms_RadarTrace[nextBlip].m_nColor = color;
+ ms_RadarTrace[nextBlip].m_bDim = 1;
+ ms_RadarTrace[nextBlip].m_bInUse = 1;
+ ms_RadarTrace[nextBlip].m_Radius = 1.0f;
+ ms_RadarTrace[nextBlip].m_nEntityHandle = handle;
+ ms_RadarTrace[nextBlip].m_wScale = 1;
+ ms_RadarTrace[nextBlip].m_eBlipDisplay = display;
+ ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
+ return GetNewUniqueBlipIndex(nextBlip);
+}
+
+void CRadar::SetRadarMarkerState(int32 counter, bool flag)
+{
+ CEntity *e;
+ switch (ms_RadarTrace[counter].m_eBlipType) {
+ case BLIP_CAR:
+ e = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[counter].m_nEntityHandle);
+ break;
+ case BLIP_CHAR:
+ e = CPools::GetPedPool()->GetAt(ms_RadarTrace[counter].m_nEntityHandle);
+ break;
+ case BLIP_OBJECT:
+ e = CPools::GetObjectPool()->GetAt(ms_RadarTrace[counter].m_nEntityHandle);
+ break;
+ default:
+ return;
+ }
+
+ if (e)
+ e->bHasBlip = flag;
+}
+
+void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) {
+ float f1 = radius * 1.4f;
+ float f2 = radius * 0.5f;
+ CVector p1, p2;
+
+ p1 = pos + TheCamera.GetUp()*f1;
+ p2 = pos + TheCamera.GetUp()*f2;
+ CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
+
+ p1 = pos - TheCamera.GetUp()*f1;
+ p2 = pos - TheCamera.GetUp()*f2;
+ CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
+
+ p1 = pos + TheCamera.GetRight()*f1;
+ p2 = pos + TheCamera.GetRight()*f2;
+ CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
+
+ p1 = pos - TheCamera.GetRight()*f1;
+ p2 = pos - TheCamera.GetRight()*f2;
+ CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
+}
+
+void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha)
+{
+ if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
+ return;
+
+ CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha));
+ CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha));
+}
+
+void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha, uint8 mode)
+{
+ if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
+ return;
+
+ switch (mode)
+ {
+ case BLIP_MODE_TRIANGULAR_UP:
+ // size++; // VC does size + 1 for triangles
+ CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(size + 3.0f), y + SCREEN_SCALE_Y(size + 2.0f), x - (SCREEN_SCALE_X(size + 3.0f)), y + SCREEN_SCALE_Y(size + 2.0f), x, y - (SCREEN_SCALE_Y(size + 3.0f)), x, y - (SCREEN_SCALE_Y(size + 3.0f)), CRGBA(0, 0, 0, alpha));
+ CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(size + 1.0f), y + SCREEN_SCALE_Y(size + 1.0f), x - (SCREEN_SCALE_X(size + 1.0f)), y + SCREEN_SCALE_Y(size + 1.0f), x, y - (SCREEN_SCALE_Y(size + 1.0f)), x, y - (SCREEN_SCALE_Y(size + 1.0f)), CRGBA(red, green, blue, alpha));
+ break;
+ case BLIP_MODE_TRIANGULAR_DOWN:
+ // size++; // VC does size + 1 for triangles
+ CSprite2d::Draw2DPolygon(x, y + SCREEN_SCALE_Y(size + 2.0f), x, y + SCREEN_SCALE_Y(size + 3.0f), x + SCREEN_SCALE_X(size + 3.0f), y - (SCREEN_SCALE_Y(size + 2.0f)), x - (SCREEN_SCALE_X(size + 3.0f)), y - (SCREEN_SCALE_Y(size + 2.0f)), CRGBA(0, 0, 0, alpha));
+ CSprite2d::Draw2DPolygon(x, y + SCREEN_SCALE_Y(size + 1.0f), x, y + SCREEN_SCALE_Y(size + 1.0f), x + SCREEN_SCALE_X(size + 1.0f), y - (SCREEN_SCALE_Y(size + 1.0f)), x - (SCREEN_SCALE_X(size + 1.0f)), y - (SCREEN_SCALE_Y(size + 1.0f)), CRGBA(red, green, blue, alpha));
+ break;
+ case BLIP_MODE_SQUARE:
+ CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha));
+ CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha));
+ break;
+ }
+#ifdef MENU_MAP
+ // VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips
+ if (CMenuManager::bMenuMapActive) {
+ bool alreadyThere = false;
+ for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
+ if (MapLegendList[i] == -1)
+ alreadyThere = true;
+ }
+ if (!alreadyThere) {
+ MapLegendList[MapLegendCounter] = -1;
+ MapLegendCounter++;
+ ArrowBlipColour1 = CRGBA(red, green, blue, alpha);
+ }
+ }
+#endif
+}
+
+void CRadar::Shutdown()
+{
+ AsukaSprite.Delete();
+ BombSprite.Delete();
+ CatSprite.Delete();
+ CentreSprite.Delete();
+ CopcarSprite.Delete();
+ DonSprite.Delete();
+ EightSprite.Delete();
+ ElSprite.Delete();
+ IceSprite.Delete();
+ JoeySprite.Delete();
+ KenjiSprite.Delete();
+ LizSprite.Delete();
+ LuigiSprite.Delete();
+ NorthSprite.Delete();
+ RaySprite.Delete();
+ SalSprite.Delete();
+ SaveSprite.Delete();
+ SpraySprite.Delete();
+ TonySprite.Delete();
+ WeaponSprite.Delete();
+ RemoveRadarSections();
+}
+
+void CRadar::StreamRadarSections(const CVector &posn)
+{
+ StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f));
+}
+
+void CRadar::StreamRadarSections(int32 x, int32 y)
+{
+ for (int i = 0; i < RADAR_NUM_TILES; ++i) {
+ for (int j = 0; j < RADAR_NUM_TILES; ++j) {
+ if ((i >= x - 1 && i <= x + 1) && (j >= y - 1 && j <= y + 1))
+ RequestMapSection(i, j);
+ else
+ RemoveMapSection(i, j);
+ };
+ };
+}
+
+void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y)
+{
+ out.x = in.x - (x * RADAR_TILE_SIZE + WORLD_MIN_X);
+ out.y = -(in.y - ((RADAR_NUM_TILES - y) * RADAR_TILE_SIZE + WORLD_MIN_Y));
+ out.x /= RADAR_TILE_SIZE;
+ out.y /= RADAR_TILE_SIZE;
+}
+
+void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in)
+{
+ float s, c;
+#if 1
+ s = -cachedSin;
+ c = cachedCos;
+#else
+ // Original code
+
+ s = -Sin(TheCamera.GetForward().Heading());
+ c = Cos(TheCamera.GetForward().Heading());
+
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED) {
+ s = 0.0f;
+ c = 1.0f;
+ }
+ else if (TheCamera.GetLookDirection() != LOOKING_FORWARD) {
+ CVector forward;
+
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON) {
+ forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward();
+ forward.Normalise(); // a bit useless...
+ }
+ else
+ forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
+
+ s = -Sin(forward.Heading());
+ c = Cos(forward.Heading());
+ }
+#endif
+
+ out.x = s * in.y + c * in.x;
+ out.y = c * in.y - s * in.x;
+
+ out = out * m_radarRange + vec2DRadarOrigin;
+}
+
+// Radar space goes from -1.0 to 1.0 in x and y, top right is (1.0, 1.0)
+void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
+{
+#ifdef MENU_MAP
+ if (CMenuManager::bMenuMapActive) {
+ // fMapSize is actually half map size. Radar range is 1000, so if x is -2000, in.x + 2.0f is 0.
+ out.x = (CMenuManager::fMapCenterX - CMenuManager::fMapSize) + (in.x + 2.0f) * CMenuManager::fMapSize * 2.0f / 4.0f;
+ out.y = (CMenuManager::fMapCenterY - CMenuManager::fMapSize) + (2.0f - in.y) * CMenuManager::fMapSize * 2.0f / 4.0f;
+ } else
+#endif
+ {
+#ifdef FIX_BUGS
+ out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
+#else
+ out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(RADAR_WIDTH) + RADAR_LEFT;
+#endif
+ out.y = (1.0f - in.y) * 0.5f * SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
+ }
+}
+
+void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in)
+{
+ float s, c;
+#if 1
+ s = cachedSin;
+ c = cachedCos;
+#else
+ // Original code
+
+ float s, c;
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED) {
+ s = 0.0f;
+ c = 1.0f;
+ }
+ else if (TheCamera.GetLookDirection() == LOOKING_FORWARD) {
+ s = Sin(TheCamera.GetForward().Heading());
+ c = Cos(TheCamera.GetForward().Heading());
+ }
+ else {
+ CVector forward;
+
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON) {
+ forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward();
+ forward.Normalise(); // a bit useless...
+ }
+ else
+ forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
+
+ s = Sin(forward.Heading());
+ c = Cos(forward.Heading());
+ }
+#endif
+
+ float x = (in.x - vec2DRadarOrigin.x) * (1.0f / m_radarRange);
+ float y = (in.y - vec2DRadarOrigin.y) * (1.0f / m_radarRange);
+
+ out.x = s * y + c * x;
+ out.y = c * y - s * x;
+}
+
+void
+CRadar::CalculateCachedSinCos()
+{
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED
+#ifdef MENU_MAP
+ || CMenuManager::bMenuMapActive
+#endif
+ ) {
+ cachedSin = 0.0f;
+ cachedCos = 1.0f;
+ } else if (TheCamera.GetLookDirection() == LOOKING_FORWARD) {
+ cachedSin = Sin(TheCamera.GetForward().Heading());
+ cachedCos = Cos(TheCamera.GetForward().Heading());
+ } else {
+ CVector forward;
+
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON) {
+ forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward();
+ forward.Normalise(); // a bit useless...
+ }
+ else
+ forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
+
+ cachedSin = Sin(forward.Heading());
+ cachedCos = Cos(forward.Heading());
+ }
+}
+
+#ifdef MENU_MAP
+void
+CRadar::InitFrontEndMap()
+{
+ CalculateCachedSinCos();
+ vec2DRadarOrigin.x = 0.0f;
+ vec2DRadarOrigin.y = 0.0f;
+ m_radarRange = 1000.0f; // doesn't mean anything, just affects the calculation in TransformRadarPointToScreenSpace
+ for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
+ MapLegendList[i] = RADAR_SPRITE_NONE;
+ }
+ MapLegendCounter = 0;
+ ArrowBlipColour1 = CRGBA(0, 0, 0, 0);
+ ArrowBlipColour2 = CRGBA(0, 0, 0, 0);
+}
+
+void
+CRadar::DrawYouAreHereSprite(float x, float y)
+{
+ static uint32 lastChange = 0;
+ static bool show = true;
+
+ if (show) {
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 500) {
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ show = !show;
+ }
+ } else {
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 200) {
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ show = !show;
+ }
+ }
+
+ if (show) {
+ float left = x - SCREEN_SCALE_X(12.0f);
+ float top = y - SCREEN_SCALE_Y(2.0f);
+ float right = SCREEN_SCALE_X(12.0) + x;
+ float bottom = y - SCREEN_SCALE_Y(26.0f);
+ CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
+ }
+ MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
+}
+
+void
+CRadar::ToggleTargetMarker(float x, float y)
+{
+ if (TargetMarkerId == -1) {
+ int nextBlip;
+ for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
+ if (!ms_RadarTrace[nextBlip].m_bInUse)
+ break;
+ }
+ ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
+ ms_RadarTrace[nextBlip].m_nColor = 0x333333FF;
+ ms_RadarTrace[nextBlip].m_bDim = 1;
+ ms_RadarTrace[nextBlip].m_bInUse = 1;
+ ms_RadarTrace[nextBlip].m_Radius = 1.0f;
+ CVector pos(x, y, CWorld::FindGroundZForCoord(x,y));
+ ms_RadarTrace[nextBlip].m_vec2DPos = pos;
+ ms_RadarTrace[nextBlip].m_vecPos = pos;
+ ms_RadarTrace[nextBlip].m_nEntityHandle = 0;
+ ms_RadarTrace[nextBlip].m_wScale = 5;
+ ms_RadarTrace[nextBlip].m_eBlipDisplay = BLIP_DISPLAY_BLIP_ONLY;
+ ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
+ TargetMarkerId = CRadar::GetNewUniqueBlipIndex(nextBlip);
+ } else {
+ ClearBlip(TargetMarkerId);
+ TargetMarkerId = -1;
+ }
+}
+#endif
+
+STARTPATCHES
+ InjectHook(0x4A3EF0, CRadar::Initialise, PATCH_JUMP);
+ InjectHook(0x4A3F60, CRadar::Shutdown, PATCH_JUMP);
+ InjectHook(0x4A4030, CRadar::LoadTextures, PATCH_JUMP);
+ InjectHook(0x4A4180, CRadar::GetNewUniqueBlipIndex, PATCH_JUMP);
+ InjectHook(0x4A41C0, CRadar::GetActualBlipArrayIndex, PATCH_JUMP);
+ InjectHook(0x4A4200, CRadar::DrawMap, PATCH_JUMP);
+ InjectHook(0x4A42F0, CRadar::DrawBlips, PATCH_JUMP);
+ InjectHook(0x4A4C70, CRadar::Draw3dMarkers, PATCH_JUMP);
+ InjectHook(0x4A4F30, CRadar::LimitRadarPoint, PATCH_JUMP);
+ InjectHook(0x4A4F90, CRadar::CalculateBlipAlpha, PATCH_JUMP);
+ InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP);
+ InjectHook(0x4A50D0, CRadar::TransformRealWorldPointToRadarSpace, PATCH_JUMP);
+ InjectHook(0x4A5300, CRadar::TransformRadarPointToRealWorldSpace, PATCH_JUMP);
+ InjectHook(0x4A5530, CRadar::TransformRealWorldToTexCoordSpace, PATCH_JUMP);
+ InjectHook(0x4A5590, CRadar::SetCoordBlip, PATCH_JUMP);
+ InjectHook(0x4A5640, CRadar::SetEntityBlip, PATCH_JUMP);
+ InjectHook(0x4A56C0, CRadar::ClearBlipForEntity, PATCH_JUMP);
+ InjectHook(0x4A5720, CRadar::ClearBlip, PATCH_JUMP);
+ InjectHook(0x4A5770, CRadar::ChangeBlipColour, PATCH_JUMP);
+ InjectHook(0x4A57A0, CRadar::ChangeBlipBrightness, PATCH_JUMP);
+ InjectHook(0x4A57E0, CRadar::ChangeBlipScale, PATCH_JUMP);
+ InjectHook(0x4A5810, CRadar::ChangeBlipDisplay, PATCH_JUMP);
+ InjectHook(0x4A5840, CRadar::SetBlipSprite, PATCH_JUMP);
+ InjectHook(0x4A5870, CRadar::ShowRadarTrace, PATCH_JUMP);
+ InjectHook(0x4A59C0, CRadar::ShowRadarMarker, PATCH_JUMP);
+ InjectHook(0x4A5BB0, CRadar::GetRadarTraceColour, PATCH_JUMP);
+ InjectHook(0x4A5C60, CRadar::SetRadarMarkerState, PATCH_JUMP);
+ InjectHook(0x4A5D10, CRadar::DrawRotatingRadarSprite, PATCH_JUMP);
+ InjectHook(0x4A5EF0, CRadar::DrawRadarSprite, PATCH_JUMP);
+ InjectHook(0x4A6020, ClipRadarTileCoords, PATCH_JUMP);
+ InjectHook(0x4A6060, RequestMapSection, PATCH_JUMP);
+ InjectHook(0x4A60A0, RemoveMapSection, PATCH_JUMP);
+ InjectHook(0x4A60E0, CRadar::RemoveRadarSections, PATCH_JUMP);
+ InjectHook(0x4A6100, (void (*)(int32, int32))&CRadar::StreamRadarSections, PATCH_JUMP);
+ InjectHook(0x4A6160, IsPointInsideRadar, PATCH_JUMP);
+ InjectHook(0x4A61C0, GetTextureCorners, PATCH_JUMP);
+ InjectHook(0x4A6250, LineRadarBoxCollision, PATCH_JUMP);
+ InjectHook(0x4A64A0, CRadar::ClipRadarPoly, PATCH_JUMP);
+ InjectHook(0x4A67E0, CRadar::DrawRadarSection, PATCH_JUMP);
+ InjectHook(0x4A69C0, CRadar::DrawRadarMask, PATCH_JUMP);
+ InjectHook(0x4A6B60, (void (*)(const CVector&))&CRadar::StreamRadarSections, PATCH_JUMP);
+ InjectHook(0x4A6C20, CRadar::DrawRadarMap, PATCH_JUMP);
+ InjectHook(0x4A6E30, CRadar::SaveAllRadarBlips, PATCH_JUMP);
+ InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP);
+ //InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP);
+ //InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file
diff --git a/src/core/Radar.h b/src/core/Radar.h
index b0400b0d..27f3a6f0 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -21,6 +21,10 @@ enum eBlipDisplay
enum eRadarSprite
{
+#ifdef MENU_MAP
+ RADAR_SPRITE_ENTITY_BLIP = -2,
+ RADAR_SPRITE_COORD_BLIP = -1,
+#endif
RADAR_SPRITE_NONE = 0,
RADAR_SPRITE_ASUKA = 1,
RADAR_SPRITE_BOMB = 2,
@@ -52,7 +56,7 @@ enum
BLIP_MODE_SQUARE,
};
-struct CBlip
+struct sRadarTrace
{
uint32 m_nColor;
uint32 m_eBlipType; // eBlipType
@@ -65,9 +69,9 @@ struct CBlip
float m_Radius;
int16 m_wScale;
uint16 m_eBlipDisplay; // eBlipDisplay
- uint16 m_IconID; // eRadarSprite
+ uint16 m_eRadarSprite; // eRadarSprite
};
-static_assert(sizeof(CBlip) == 0x30, "CBlip: error");
+static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error");
// Values for screen space
#define RADAR_LEFT (40.0f)
@@ -79,7 +83,7 @@ class CRadar
{
public:
static float &m_radarRange;
- static CBlip (&ms_RadarTrace)[NUMRADARBLIPS];
+ static sRadarTrace (&ms_RadarTrace)[NUMRADARBLIPS];
static CSprite2d AsukaSprite;
static CSprite2d BombSprite;
static CSprite2d CatSprite;
@@ -101,8 +105,20 @@ public:
static CSprite2d TonySprite;
static CSprite2d WeaponSprite;
static CSprite2d *RadarSprites[21];
+ static float cachedCos;
+ static float cachedSin;
+#ifdef MENU_MAP
+#define NUM_MAP_LEGENDS 75
+ static CRGBA ArrowBlipColour1;
+ static CRGBA ArrowBlipColour2;
+ static uint16 MapLegendList[NUM_MAP_LEGENDS];
+ static uint16 MapLegendCounter;
+ static int TargetMarkerId;
-public:
+ static void InitFrontEndMap();
+ static void DrawYouAreHereSprite(float, float);
+ static void ToggleTargetMarker(float, float);
+#endif
static uint8 CalculateBlipAlpha(float dist);
static void ChangeBlipBrightness(int32 i, int32 bright);
static void ChangeBlipColour(int32 i, int32);
@@ -128,7 +144,6 @@ public:
static void LoadAllRadarBlips(uint8 *buf, uint32 size);
static void LoadTextures();
static void RemoveRadarSections();
- static void RequestMapSection(int32 x, int32 y);
static void SaveAllRadarBlips(uint8*, uint32*);
static void SetBlipSprite(int32 i, int32 icon);
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
@@ -145,9 +160,6 @@ public:
static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in);
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
- // no in CRadar in the game:
- static void GetTextureCorners(int32 x, int32 y, CVector2D *out);
- static void ClipRadarTileCoords(int32 &x, int32 &y);
- static bool IsPointInsideRadar(const CVector2D &);
- static int LineRadarBoxCollision(CVector2D &, const CVector2D &, const CVector2D &);
+ // no in CRadar in the game:
+ static void CalculateCachedSinCos();
};
diff --git a/src/core/RwClumpRead.cpp b/src/core/RwClumpRead.cpp
deleted file mode 100644
index c9f027e7..00000000
--- a/src/core/RwClumpRead.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-
-struct rpGeometryList
-{
- RpGeometry **geometries;
- int32 numGeoms;
-};
-
-struct rpAtomicBinary
-{
- RwInt32 frameIndex;
- RwInt32 geomIndex;
- RwInt32 flags;
- RwInt32 unused;
-};
-
-static int32 numberGeometrys;
-static int32 streamPosition;
-static rpGeometryList gGeomList;
-static rwFrameList gFrameList;
-static RpClumpChunkInfo gClumpInfo;
-
-rpGeometryList*
-GeometryListStreamRead1(RwStream *stream, rpGeometryList *geomlist)
-{
- int i;
- RwUInt32 size, version;
- RwInt32 numGeoms;
-
- numberGeometrys = 0;
- if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
- return nil;
- assert(size == 4);
- if(RwStreamRead(stream, &numGeoms, 4) != 4)
- return nil;
-
- numberGeometrys = numGeoms/2;
- geomlist->numGeoms = numGeoms;
- if(geomlist->numGeoms > 0){
- geomlist->geometries = (RpGeometry**)RwMalloc(geomlist->numGeoms * sizeof(RpGeometry*));
- if(geomlist->geometries == nil)
- return nil;
- memset(geomlist->geometries, 0, geomlist->numGeoms * sizeof(RpGeometry*));
- }else
- geomlist->geometries = nil;
-
- for(i = 0; i < numberGeometrys; i++){
- if(!RwStreamFindChunk(stream, rwID_GEOMETRY, nil, &version))
- return nil;
- geomlist->geometries[i] = RpGeometryStreamRead(stream);
- if(geomlist->geometries[i] == nil)
- return nil;
- }
-
- return geomlist;
-}
-
-rpGeometryList*
-GeometryListStreamRead2(RwStream *stream, rpGeometryList *geomlist)
-{
- int i;
- RwUInt32 version;
-
- for(i = numberGeometrys; i < geomlist->numGeoms; i++){
- if(!RwStreamFindChunk(stream, rwID_GEOMETRY, nil, &version))
- return nil;
- geomlist->geometries[i] = RpGeometryStreamRead(stream);
- if(geomlist->geometries[i] == nil)
- return nil;
- }
-
- return geomlist;
-}
-
-void
-GeometryListDeinitialize(rpGeometryList *geomlist)
-{
- int i;
-
- for(i = 0; i < geomlist->numGeoms; i++)
- if(geomlist->geometries[i])
- RpGeometryDestroy(geomlist->geometries[i]);
-
- if(geomlist->numGeoms){
- RwFree(geomlist->geometries);
- geomlist->numGeoms = 0;
- }
-}
-
-RpAtomic*
-ClumpAtomicStreamRead(RwStream *stream, rwFrameList *frmList, rpGeometryList *geomList)
-{
- RwUInt32 size, version;
- rpAtomicBinary a;
- RpAtomic *atomic;
-
- numberGeometrys = 0;
- if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
- return nil;
- assert(size <= sizeof(rpAtomicBinary));
- if(RwStreamRead(stream, &a, size) != size)
- return nil;
-
- atomic = RpAtomicCreate();
- if(atomic == nil)
- return nil;
-
- RpAtomicSetFlags(atomic, a.flags);
-
- if(frmList->numFrames){
- assert(a.frameIndex < frmList->numFrames);
- RpAtomicSetFrame(atomic, frmList->frames[a.frameIndex]);
- }
-
- if(geomList->numGeoms){
- assert(a.geomIndex < geomList->numGeoms);
- RpAtomicSetGeometry(atomic, geomList->geometries[a.geomIndex], 0);
- }else{
- RpGeometry *geom;
- if(!RwStreamFindChunk(stream, rwID_GEOMETRY, nil, &version)){
- RpAtomicDestroy(atomic);
- return nil;
- }
- geom = RpGeometryStreamRead(stream);
- if(geom == nil){
- RpAtomicDestroy(atomic);
- return nil;
- }
- RpAtomicSetGeometry(atomic, geom, 0);
- RpGeometryDestroy(geom);
- }
-
- return atomic;
-}
-
-bool
-RpClumpGtaStreamRead1(RwStream *stream)
-{
- RwUInt32 size, version;
-
- if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
- return false;
- if(version >= 0x33000){
- assert(size == 12);
- if(RwStreamRead(stream, &gClumpInfo, 12) != 12)
- return false;
- }else{
- assert(size == 4);
- if(RwStreamRead(stream, &gClumpInfo, 4) != 4)
- return false;
- }
-
- if(!RwStreamFindChunk(stream, rwID_FRAMELIST, nil, &version))
- return false;
- if(_rwFrameListStreamRead(stream, &gFrameList) == nil)
- return false;
-
- if(!RwStreamFindChunk(stream, rwID_GEOMETRYLIST, nil, &version)){
- rwFrameListDeinitialize(&gFrameList);
- return false;
- }
- if(GeometryListStreamRead1(stream, &gGeomList) == nil){
- rwFrameListDeinitialize(&gFrameList);
- return false;
- }
- streamPosition = stream->Type.memory.position;
- return true;
-}
-
-RpClump*
-RpClumpGtaStreamRead2(RwStream *stream)
-{
- int i;
- RwUInt32 version;
- RpAtomic *atomic;
- RpClump *clump;
-
- clump = RpClumpCreate();
- if(clump == nil)
- return nil;
-
- RwStreamSkip(stream, streamPosition - stream->Type.memory.position);
-
- if(GeometryListStreamRead2(stream, &gGeomList) == nil){
- GeometryListDeinitialize(&gGeomList);
- rwFrameListDeinitialize(&gFrameList);
- RpClumpDestroy(clump);
- return nil;
- }
-
- RpClumpSetFrame(clump, gFrameList.frames[0]);
-
- for(i = 0; i < gClumpInfo.numAtomics; i++){
- if(!RwStreamFindChunk(stream, rwID_ATOMIC, nil, &version)){
- GeometryListDeinitialize(&gGeomList);
- rwFrameListDeinitialize(&gFrameList);
- RpClumpDestroy(clump);
- return nil;
- }
-
- atomic = ClumpAtomicStreamRead(stream, &gFrameList, &gGeomList);
- if(atomic == nil){
- GeometryListDeinitialize(&gGeomList);
- rwFrameListDeinitialize(&gFrameList);
- RpClumpDestroy(clump);
- return nil;
- }
-
- RpClumpAddAtomic(clump, atomic);
- }
-
- GeometryListDeinitialize(&gGeomList);
- rwFrameListDeinitialize(&gFrameList);
- return clump;
-}
-
-void
-RpClumpGtaCancelStream(void)
-{
- GeometryListDeinitialize(&gGeomList);
- rwFrameListDeinitialize(&gFrameList);
- gFrameList.numFrames = 0;
-}
-
-STARTPATCHES
- InjectHook(0x526060, RpClumpGtaStreamRead1, PATCH_JUMP);
- InjectHook(0x526180, RpClumpGtaStreamRead2, PATCH_JUMP);
- InjectHook(0x5262D0, RpClumpGtaCancelStream, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/core/RwHelper.cpp b/src/core/RwHelper.cpp
deleted file mode 100644
index 6325bf15..00000000
--- a/src/core/RwHelper.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-#define WITHD3D
-#include "common.h"
-#include "patcher.h"
-#include "Timecycle.h"
-#include "skeleton.h"
-
-void *
-RwMallocAlign(RwUInt32 size, RwUInt32 align)
-{
- void *mem = (void *)malloc(size + align);
-
- ASSERT(mem != nil);
-
- void *addr = (void *)((((RwUInt32)mem) + align) & ~(align - 1));
-
- ASSERT(addr != nil);
-
- *(((void **)addr) - 1) = mem;
-
- return addr;
-}
-
-void
-RwFreeAlign(void *mem)
-{
- ASSERT(mem != nil);
-
- void *addr = *(((void **)mem) - 1);
-
- ASSERT(addr != nil);
-
- free(addr);
-}
-
-void
-DefinedState(void)
-{
- RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSWRAP);
- RwRenderStateSet(rwRENDERSTATETEXTUREPERSPECTIVE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEGOURAUD);
- RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEALPHAPRIMITIVEBUFFER, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEBORDERCOLOR, (void*)RWRGBALONG(0, 0, 0, 255));
- RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEFOGCOLOR,
- (void*)RWRGBALONG(CTimeCycle::GetFogRed(), CTimeCycle::GetFogGreen(), CTimeCycle::GetFogBlue(), 255));
- RwRenderStateSet(rwRENDERSTATEFOGTYPE, (void*)rwFOGTYPELINEAR);
- RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
-
- // D3D stuff
- RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
- RwD3D8SetRenderState(D3DRS_ALPHAREF, 2);
-}
-
-RwFrame*
-GetFirstFrameCallback(RwFrame *child, void *data)
-{
- *(RwFrame**)data = child;
- return nil;
-}
-
-RwFrame*
-GetFirstChild(RwFrame *frame)
-{
- RwFrame *child;
-
- child = nil;
- RwFrameForAllChildren(frame, GetFirstFrameCallback, &child);
- return child;
-}
-
-RwObject*
-GetFirstObjectCallback(RwObject *object, void *data)
-{
- *(RwObject**)data = object;
- return nil;
-}
-
-RwObject*
-GetFirstObject(RwFrame *frame)
-{
- RwObject *obj;
-
- obj = nil;
- RwFrameForAllObjects(frame, GetFirstObjectCallback, &obj);
- return obj;
-}
-
-RpAtomic*
-GetFirstAtomicCallback(RpAtomic *atm, void *data)
-{
- *(RpAtomic**)data = atm;
- return nil;
-}
-
-RpAtomic*
-GetFirstAtomic(RpClump *clump)
-{
- RpAtomic *atm;
-
- atm = nil;
- RpClumpForAllAtomics(clump, GetFirstAtomicCallback, &atm);
- return atm;
-}
-
-RwTexture*
-GetFirstTextureCallback(RwTexture *tex, void *data)
-{
- *(RwTexture**)data = tex;
- return nil;
-}
-
-RwTexture*
-GetFirstTexture(RwTexDictionary *txd)
-{
- RwTexture *tex;
-
- tex = nil;
- RwTexDictionaryForAllTextures(txd, GetFirstTextureCallback, &tex);
- return tex;
-}
-
-void
-CameraSize(RwCamera * camera, RwRect * rect,
- RwReal viewWindow, RwReal aspectRatio)
-{
- if (camera)
- {
- RwVideoMode videoMode;
- RwRect r;
- RwRect origSize = { 0, 0, 0, 0 }; // FIX just to make the compier happy
- RwV2d vw;
-
- RwEngineGetVideoModeInfo(&videoMode,
- RwEngineGetCurrentVideoMode());
-
- origSize.w = RwRasterGetWidth(RwCameraGetRaster(camera));
- origSize.h = RwRasterGetHeight(RwCameraGetRaster(camera));
-
- if (!rect)
- {
- if (videoMode.flags & rwVIDEOMODEEXCLUSIVE)
- {
- /* For full screen applications, resizing the camera just doesn't
- * make sense, use the video mode size.
- */
-
- r.x = r.y = 0;
- r.w = videoMode.width;
- r.h = videoMode.height;
- rect = &r;
- }
- else
- {
- /*
- rect not specified - reuse current values
- */
- r.w = RwRasterGetWidth(RwCameraGetRaster(camera));
- r.h = RwRasterGetHeight(RwCameraGetRaster(camera));
- r.x = r.y = 0;
- rect = &r;
- }
- }
-
- if (( origSize.w != rect->w ) && ( origSize.h != rect->h ))
- {
- RwRaster *raster;
- RwRaster *zRaster;
-
- /*
- * Destroy rasters...
- */
-
- raster = RwCameraGetRaster(camera);
- if( raster )
- {
- RwRasterDestroy(raster);
- }
-
- zRaster = RwCameraGetZRaster(camera);
- if( zRaster )
- {
- RwRasterDestroy(zRaster);
- }
-
- /*
- * Create new rasters...
- */
-
- raster = RwRasterCreate(rect->w, rect->h, 0, rwRASTERTYPECAMERA);
- zRaster = RwRasterCreate(rect->w, rect->h, 0, rwRASTERTYPEZBUFFER);
-
- if( raster && zRaster )
- {
- RwCameraSetRaster(camera, raster);
- RwCameraSetZRaster(camera, zRaster);
- }
- else
- {
- if( raster )
- {
- RwRasterDestroy(raster);
- }
-
- if( zRaster )
- {
- RwRasterDestroy(zRaster);
- }
-
- rect->x = origSize.x;
- rect->y = origSize.y;
- rect->w = origSize.w;
- rect->h = origSize.h;
-
- /*
- * Use default values...
- */
- raster =
- RwRasterCreate(rect->w, rect->h, 0, rwRASTERTYPECAMERA);
-
- zRaster =
- RwRasterCreate(rect->w, rect->h, 0, rwRASTERTYPEZBUFFER);
-
- RwCameraSetRaster(camera, raster);
- RwCameraSetZRaster(camera, zRaster);
- }
- }
-
- /* Figure out the view window */
- if (videoMode.flags & rwVIDEOMODEEXCLUSIVE)
- {
- /* derive ratio from aspect ratio */
- vw.x = viewWindow;
- vw.y = viewWindow / aspectRatio;
- }
- else
- {
- /* derive from pixel ratios */
- if (rect->w > rect->h)
- {
- vw.x = viewWindow;
- vw.y = (rect->h * viewWindow) / rect->w;
- }
- else
- {
- vw.x = (rect->w * viewWindow) / rect->h;
- vw.y = viewWindow;
- }
- }
-
- RwCameraSetViewWindow(camera, &vw);
-
- RsGlobal.width = rect->w;
- RsGlobal.height = rect->h;
- }
-
- return;
-}
-
-void
-CameraDestroy(RwCamera *camera)
-{
- RwRaster *raster, *tmpRaster;
- RwFrame *frame;
-
- if (camera)
- {
- frame = RwCameraGetFrame(camera);
- if (frame)
- {
- RwFrameDestroy(frame);
- }
-
- raster = RwCameraGetRaster(camera);
- if (raster)
- {
- tmpRaster = RwRasterGetParent(raster);
-
- RwRasterDestroy(raster);
-
- if ((tmpRaster != nil) && (tmpRaster != raster))
- {
- RwRasterDestroy(tmpRaster);
- }
- }
-
- raster = RwCameraGetZRaster(camera);
- if (raster)
- {
- tmpRaster = RwRasterGetParent(raster);
-
- RwRasterDestroy(raster);
-
- if ((tmpRaster != nil) && (tmpRaster != raster))
- {
- RwRasterDestroy(tmpRaster);
- }
- }
-
- RwCameraDestroy(camera);
- }
-
- return;
-}
-
-RwCamera *
-CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
-{
- RwCamera *camera;
-
- camera = RwCameraCreate();
-
- if (camera)
- {
- RwCameraSetFrame(camera, RwFrameCreate());
- RwCameraSetRaster(camera,
- RwRasterCreate(0, 0, 0, rwRASTERTYPECAMERA));
-
- if (zBuffer)
- {
- RwCameraSetZRaster(camera,
- RwRasterCreate(0, 0, 0,
- rwRASTERTYPEZBUFFER));
- }
-
- /* now check that everything is valid */
- if (RwCameraGetFrame(camera) &&
- RwCameraGetRaster(camera) &&
- RwRasterGetParent(RwCameraGetRaster(camera)) &&
- (!zBuffer || (RwCameraGetZRaster(camera) &&
- RwRasterGetParent(RwCameraGetZRaster
- (camera)))))
- {
- /* everything OK */
- return (camera);
- }
- }
-
- /* if we're here then an error must have occurred so clean up */
-
- CameraDestroy(camera);
- return (nil);
-}
-
-WRAPPER void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&) { EAXJMP(0x5926C0); }
-WRAPPER bool CheckVideoCardCaps(void) { EAXJMP(0x592740); }
-WRAPPER void WriteVideoCardCapsFile(void) { EAXJMP(0x5927D0); }
-WRAPPER void ConvertingTexturesScreen(uint32, uint32, const char*) { EAXJMP(0x592880); }
-WRAPPER void DealWithTxdWriteError(uint32, uint32, const char*) { EAXJMP(0x592BF0); }
-WRAPPER bool CreateTxdImageForVideoCard() { EAXJMP(0x592C70); }
-
-void CreateDebugFont()
-{
- ;
-}
-
-void DestroyDebugFont()
-{
- ;
-}
-
-void FlushObrsPrintfs()
-{
- ;
-}
-
-WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
-WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }
-
-STARTPATCHES
- //InjectHook(0x526450, GetFirstObjectCallback, PATCH_JUMP);
- InjectHook(0x526460, GetFirstObject, PATCH_JUMP);
- InjectHook(0x527170, CameraSize, PATCH_JUMP);
- InjectHook(0x527340, CameraDestroy, PATCH_JUMP);
- InjectHook(0x5273B0, CameraCreate, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/core/RwHelper.h b/src/core/RwHelper.h
deleted file mode 100644
index a9f0bdf4..00000000
--- a/src/core/RwHelper.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#pragma once
-
-void *RwMallocAlign(RwUInt32 size, RwUInt32 align);
-void RwFreeAlign(void *mem);
-
-void CreateDebugFont();
-void DestroyDebugFont();
-void FlushObrsPrintfs();
-void DefinedState(void);
-RwFrame *GetFirstChild(RwFrame *frame);
-RwObject *GetFirstObject(RwFrame *frame);
-RpAtomic *GetFirstAtomic(RpClump *clump);
-RwTexture *GetFirstTexture(RwTexDictionary *txd);
-
-RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream);
-RwTexDictionary *RwTexDictionaryGtaStreamRead1(RwStream *stream);
-RwTexDictionary *RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict);
-void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&);
-bool CheckVideoCardCaps(void);
-void WriteVideoCardCapsFile(void);
-void ConvertingTexturesScreen(uint32, uint32, const char*);
-void DealWithTxdWriteError(uint32, uint32, const char*);
-bool CreateTxdImageForVideoCard();
-
-bool RpClumpGtaStreamRead1(RwStream *stream);
-RpClump *RpClumpGtaStreamRead2(RwStream *stream);
-void RpClumpGtaCancelStream(void);
-
-void CameraSize(RwCamera *camera,
- RwRect *rect,
- RwReal viewWindow,
- RwReal aspectRatio);
-void CameraDestroy(RwCamera *camera);
-RwCamera *CameraCreate(RwInt32 width,
- RwInt32 height,
- RwBool zBuffer);
-
-
-void _TexturePoolsInitialise();
-void _TexturePoolsShutdown(); \ No newline at end of file
diff --git a/src/core/RwMatFX.cpp b/src/core/RwMatFX.cpp
deleted file mode 100644
index ca9a633b..00000000
--- a/src/core/RwMatFX.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-#define WITHD3D
-#include "common.h"
-#include "patcher.h"
-
-struct MatFXNothing { int pad[5]; int effect; };
-
-struct MatFXBump
-{
- RwFrame *bumpFrame;
- RwTexture *bumpedTex;
- RwTexture *bumpTex;
- float negBumpCoefficient;
- int pad;
- int effect;
-};
-
-struct MatFXEnv
-{
- RwFrame *envFrame;
- RwTexture *envTex;
- float envCoeff;
- int envFBalpha;
- int pad;
- int effect;
-};
-
-struct MatFXDual
-{
- RwTexture *dualTex;
- RwInt32 srcBlend;
- RwInt32 dstBlend;
-};
-
-
-struct MatFX
-{
- union {
- MatFXNothing n;
- MatFXBump b;
- MatFXEnv e;
- MatFXDual d;
- } fx[2];
- int effects;
-};
-
-int &MatFXMaterialDataOffset = *(int*)0x66188C;
-int &MatFXAtomicDataOffset = *(int*)0x66189C;
-
-#ifdef PS2_MATFX
-
-void
-_rpMatFXD3D8AtomicMatFXDefaultRender(RxD3D8InstanceData *inst, int flags, RwTexture *texture)
-{
- if(flags & (rpGEOMETRYTEXTURED|rpGEOMETRYTEXTURED2) && texture)
- RwD3D8SetTexture(texture, 0);
- else
- RwD3D8SetTexture(nil, 0);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)(inst->vertexAlpha || inst->material->color.alpha != 0xFF));
- RwD3D8SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, inst->vertexAlpha != 0);
- RwD3D8SetPixelShader(0);
- RwD3D8SetVertexShader(inst->vertexShader);
- RwD3D8SetStreamSource(0, inst->vertexBuffer, inst->stride);
-
- if(inst->indexBuffer){
- RwD3D8SetIndices(inst->indexBuffer, inst->baseIndex);
- RwD3D8DrawIndexedPrimitive(inst->primType, 0, inst->numVertices, 0, inst->numIndices);
- }else
- RwD3D8DrawPrimitive(inst->primType, inst->baseIndex, inst->numVertices);
-}
-
-// map [-1; -1] -> [0; 1], flip V
-static RwMatrix scalenormal = {
- { 0.5f, 0.0f, 0.0f }, 0,
- { 0.0f, -0.5f, 0.0f }, 0,
- { 0.0f, 0.0f, 1.0f }, 0,
- { 0.5f, 0.5f, 0.0f }, 0,
-
-};
-
-// flipped U for PS2
-static RwMatrix scalenormal_flipU = {
- { -0.5f, 0.0f, 0.0f }, 0,
- { 0.0f, -0.5f, 0.0f }, 0,
- { 0.0f, 0.0f, 1.0f }, 0,
- { 0.5f, 0.5f, 0.0f }, 0,
-
-};
-
-void
-ApplyEnvMapTextureMatrix(RwTexture *tex, int n, RwFrame *frame)
-{
- RwD3D8SetTexture(tex, n);
- RwD3D8SetTextureStageState(n, D3DRS_ALPHAREF, 2);
- RwD3D8SetTextureStageState(n, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACENORMAL);
- if(frame){
- RwMatrix *envframemat = RwMatrixCreate();
- RwMatrix *tmpmat = RwMatrixCreate();
- RwMatrix *envmat = RwMatrixCreate();
-
- RwMatrixInvert(envframemat, RwFrameGetLTM(frame));
- // PS2
- // can this be simplified?
- *tmpmat = *RwFrameGetLTM(RwCameraGetFrame((RwCamera*)RWSRCGLOBAL(curCamera)));
- RwV3dNegate(&tmpmat->right, &tmpmat->right);
- tmpmat->flags = 0;
- tmpmat->pos.x = 0.0f;
- tmpmat->pos.y = 0.0f;
- tmpmat->pos.z = 0.0f;
- RwMatrixMultiply(envmat, tmpmat, envframemat);
- *tmpmat = *envmat;
- // important because envframemat can have a translation that we don't like
- tmpmat->pos.x = 0.0f;
- tmpmat->pos.y = 0.0f;
- tmpmat->pos.z = 0.0f;
- // for some reason we flip in U as well
- RwMatrixMultiply(envmat, tmpmat, &scalenormal_flipU);
-
- RwD3D8SetTransform(D3DTS_TEXTURE0+n, envmat);
-
- RwMatrixDestroy(envmat);
- RwMatrixDestroy(tmpmat);
- RwMatrixDestroy(envframemat);
- }else
- RwD3D8SetTransform(D3DTS_TEXTURE0+n, &scalenormal);
-}
-
-void
-_rpMatFXD3D8AtomicMatFXEnvRender_ps2(RxD3D8InstanceData *inst, int flags, int sel, RwTexture *texture, RwTexture *envMap)
-{
- MatFX *matfx = *RWPLUGINOFFSET(MatFX*, inst->material, MatFXMaterialDataOffset);
- MatFXEnv *env = &matfx->fx[sel].e;
-
- uint8 intens = (uint8)(env->envCoeff*255.0f);
-
- if(intens == 0 || envMap == nil){
- if(sel == 0)
- _rpMatFXD3D8AtomicMatFXDefaultRender(inst, flags, texture);
- return;
- }
-
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)(inst->vertexAlpha || inst->material->color.alpha != 0xFF));
- if(flags & (rpGEOMETRYTEXTURED|rpGEOMETRYTEXTURED2) && texture)
- RwD3D8SetTexture(texture, 0);
- else
- RwD3D8SetTexture(nil, 0);
- RwD3D8SetPixelShader(0);
- RwD3D8SetVertexShader(inst->vertexShader);
- RwD3D8SetStreamSource(0, inst->vertexBuffer, inst->stride);
- RwD3D8SetIndices(inst->indexBuffer, inst->baseIndex);
- if(inst->indexBuffer)
- RwD3D8DrawIndexedPrimitive(inst->primType, 0, inst->numVertices, 0, inst->numIndices);
- else
- RwD3D8DrawPrimitive(inst->primType, inst->baseIndex, inst->numVertices);
-
- // Effect pass
-
- ApplyEnvMapTextureMatrix(envMap, 0, env->envFrame);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- RwUInt32 src, dst, lighting, zwrite, fog, fogcol;
- RwRenderStateGet(rwRENDERSTATESRCBLEND, &src);
- RwRenderStateGet(rwRENDERSTATEDESTBLEND, &dst);
-
- // This is of course not using framebuffer alpha,
- // but if the diffuse texture had no alpha, the result should actually be rather the same
- if(env->envFBalpha)
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
- else
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
- RwD3D8GetRenderState(D3DRS_LIGHTING, &lighting);
- RwD3D8GetRenderState(D3DRS_ZWRITEENABLE, &zwrite);
- RwD3D8GetRenderState(D3DRS_FOGENABLE, &fog);
- RwD3D8SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
- if(fog){
- RwD3D8GetRenderState(D3DRS_FOGCOLOR, &fogcol);
- RwD3D8SetRenderState(D3DRS_FOGCOLOR, 0);
- }
-
- D3DCOLOR texfactor = D3DCOLOR_RGBA(intens, intens, intens, intens);
- RwD3D8SetRenderState(D3DRS_TEXTUREFACTOR, texfactor);
- RwD3D8SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
- RwD3D8SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_CURRENT);
- RwD3D8SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_TFACTOR);
- // alpha unused
- //RwD3D8SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- //RwD3D8SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CURRENT);
- //RwD3D8SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_TFACTOR);
-
- if(inst->indexBuffer)
- RwD3D8DrawIndexedPrimitive(inst->primType, 0, inst->numVertices, 0, inst->numIndices);
- else
- RwD3D8DrawPrimitive(inst->primType, inst->baseIndex, inst->numVertices);
-
- // Reset states
-
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)src);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)dst);
- RwD3D8SetRenderState(D3DRS_LIGHTING, lighting);
- RwD3D8SetRenderState(D3DRS_ZWRITEENABLE, zwrite);
- if(fog)
- RwD3D8SetRenderState(D3DRS_FOGCOLOR, fogcol);
- RwD3D8SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- RwD3D8SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
- RwD3D8SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, 0);
- RwD3D8SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);
-}
-
-STARTPATCHES
- InjectHook(0x5CF6C0, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP);
-ENDPATCHES
-
-#endif
diff --git a/src/core/RwTexRead.cpp b/src/core/RwTexRead.cpp
deleted file mode 100644
index 6b717b34..00000000
--- a/src/core/RwTexRead.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-#pragma warning( push )
-#pragma warning( disable : 4005)
-#define DIRECTINPUT_VERSION 0x0800
-#include <dinput.h>
-#pragma warning( pop )
-#include "common.h"
-#include "win.h"
-#include "patcher.h"
-#include "Timer.h"
-
-float &texLoadTime = *(float*)0x8F1B50;
-int32 &texNumLoaded = *(int32*)0x8F252C;
-
-RwTexture*
-RwTextureGtaStreamRead(RwStream *stream)
-{
- RwUInt32 size, version;
- RwTexture *tex;
-
- if(!RwStreamFindChunk(stream, rwID_TEXTURENATIVE, &size, &version))
- return nil;
-
- float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
-
- if(!RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, &tex, size)))
- return nil;
-
- if (gGameState == GS_INIT_PLAYING_GAME) {
- texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
- texNumLoaded++;
- }
- return tex;
-}
-
-RwTexture*
-destroyTexture(RwTexture *texture, void *data)
-{
- RwTextureDestroy(texture);
- return texture;
-}
-
-RwTexDictionary*
-RwTexDictionaryGtaStreamRead(RwStream *stream)
-{
- RwUInt32 size, version;
- RwInt32 numTextures;
- RwTexDictionary *texDict;
- RwTexture *tex;
-
- if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
- return nil;
- assert(size == 4);
- if(RwStreamRead(stream, &numTextures, size) != size)
- return nil;
-
- texDict = RwTexDictionaryCreate();
- if(texDict == nil)
- return nil;
-
- while(numTextures--){
- tex = RwTextureGtaStreamRead(stream);
- if(tex == nil){
- RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
- RwTexDictionaryDestroy(texDict);
- return nil;
- }
- RwTexDictionaryAddTexture(texDict, tex);
- }
-
- return texDict;
-}
-
-static int32 numberTextures = -1;
-static int32 streamPosition;
-
-RwTexDictionary*
-RwTexDictionaryGtaStreamRead1(RwStream *stream)
-{
- RwUInt32 size, version;
- RwInt32 numTextures;
- RwTexDictionary *texDict;
- RwTexture *tex;
-
- numberTextures = 0;
- if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
- return nil;
- assert(size == 4);
- if(RwStreamRead(stream, &numTextures, size) != size)
- return nil;
-
- texDict = RwTexDictionaryCreate();
- if(texDict == nil)
- return nil;
-
- numberTextures = numTextures/2;
-
- while(numTextures > numberTextures){
- numTextures--;
-
- tex = RwTextureGtaStreamRead(stream);
- if(tex == nil){
- RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
- RwTexDictionaryDestroy(texDict);
- return nil;
- }
- RwTexDictionaryAddTexture(texDict, tex);
- }
-
- numberTextures = numTextures;
- streamPosition = stream->Type.memory.position;
-
- return texDict;
-}
-
-RwTexDictionary*
-RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
-{
- RwTexture *tex;
-
- RwStreamSkip(stream, streamPosition - stream->Type.memory.position);
-
- while(numberTextures--){
- tex = RwTextureGtaStreamRead(stream);
- if(tex == nil){
- RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
- RwTexDictionaryDestroy(texDict);
- return nil;
- }
- RwTexDictionaryAddTexture(texDict, tex);
- }
-
- return texDict;
-}
-
-STARTPATCHES
- InjectHook(0x592380, RwTextureGtaStreamRead, PATCH_JUMP);
- InjectHook(0x5924A0, RwTexDictionaryGtaStreamRead, PATCH_JUMP);
- InjectHook(0x592550, RwTexDictionaryGtaStreamRead1, PATCH_JUMP);
- InjectHook(0x592650, RwTexDictionaryGtaStreamRead2, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 9478479b..02092a30 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -1,18 +1,18 @@
#include "common.h"
#include "patcher.h"
#include "Stats.h"
-
-WRAPPER void CStats::SaveStats(uint8 *buf, uint32 *size) { EAXJMP(0x4ab3e0); }
+#include "Text.h"
+#include "World.h"
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
int32 &CStats::HeadsPopped = *(int32*)0x8F647C;
-bool& CStats::CommercialPassed = *(bool*)0x8F4334;
-bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
-bool& CStats::SuburbanPassed = *(bool*)0x8F2740;
+int32& CStats::CommercialPassed = *(int32*)0x8F4334;
+int32& CStats::IndustrialPassed = *(int32*)0x8E2A68;
+int32& CStats::SuburbanPassed = *(int32*)0x8F2740;
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64;
-int32 *CStats::PedsKilledOfThisType = (int32*)0x880DBC;
+int32(&CStats::PedsKilledOfThisType)[NUM_PEDTYPES] = *(int32(*)[NUM_PEDTYPES]) * (uintptr*)0x880DBC;
int32 &CStats::TimesDied = *(int32*)0x8E2BDC;
int32 &CStats::TimesArrested = *(int32*)0x8E2BEC;
int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C;
@@ -48,11 +48,73 @@ int32& CStats::LongestFlightInDodo = *(int32*)0x8F5FE4;
int32& CStats::TimeTakenDefuseMission = *(int32*)0x880E24;
int32& CStats::TotalNumberKillFrenzies = *(int32*)0x8E2884;
int32& CStats::TotalNumberMissions = *(int32*)0x8E2820;
-int32& CStats::KgOfExplosivesUsed = *(int32*)0x8F2510;
+int32& CStats::RoundsFiredByPlayer = *(int32*)0x8E2BE8;
+int32& CStats::KgsOfExplosivesUsed = *(int32*)0x8F2510;
+int32& CStats::InstantHitsFiredByPlayer = *(int32*)0x943070;
+int32& CStats::InstantHitsHitByPlayer = *(int32*)0x95CB8C;
+int32& CStats::BestTimeBombDefusal = *(int32*)0x880E24;
+int32& CStats::mmRain = *(int32*)0x8F2C98;
int32& CStats::CarsCrushed = *(int32*)0x943050;
int32(&CStats::FastestTimes)[CStats::TOTAL_FASTEST_TIMES] = *(int32(*)[CStats::TOTAL_FASTEST_TIMES])*(uintptr*)0x6E9128;
int32(&CStats::HighestScores)[CStats::TOTAL_HIGHEST_SCORES] = *(int32(*)[CStats::TOTAL_HIGHEST_SCORES]) * (uintptr*)0x8622B0;
+void CStats::Init()
+{
+ PeopleKilledByOthers = 0;
+ PeopleKilledByPlayer = 0;
+ RoundsFiredByPlayer = 0;
+ CarsExploded = 0;
+ HelisDestroyed = 0;
+ ProgressMade = 0;
+ KgsOfExplosivesUsed = 0;
+ InstantHitsFiredByPlayer = 0;
+ InstantHitsHitByPlayer = 0;
+ CarsCrushed = 0;
+ HeadsPopped = 0;
+ TimesArrested = 0;
+ TimesDied = 0;
+ DaysPassed = 0;
+ NumberOfUniqueJumpsFound = 0;
+ mmRain = 0;
+ MaximumJumpFlips = 0;
+ MaximumJumpSpins = 0;
+ MaximumJumpDistance = 0;
+ MaximumJumpHeight = 0;
+ BestStuntJump = 0;
+ TotalNumberOfUniqueJumps = 0;
+ Record4x4One = 0;
+ LongestFlightInDodo = 0;
+ Record4x4Two = 0;
+ PassengersDroppedOffWithTaxi = 0;
+ Record4x4Three = 0;
+ MoneyMadeWithTaxi = 0;
+ Record4x4Mayhem = 0;
+ LivesSavedWithAmbulance = 0;
+ ElBurroTime = 0;
+ CriminalsCaught = 0;
+ MissionsGiven = 0;
+ HighestLevelAmbulanceMission = 0;
+ MissionsPassed = 0;
+ FiresExtinguished = 0;
+ DistanceTravelledOnFoot = 0;
+ TimeTakenDefuseMission = 0;
+ NumberKillFrenziesPassed = 0;
+ DistanceTravelledInVehicle = 0;
+ TotalNumberKillFrenzies = 0;
+ TotalNumberMissions = 0;
+ KillsSinceLastCheckpoint = 0;
+ TotalLegitimateKills = 0;
+ for (int i = 0; i < TOTAL_FASTEST_TIMES; i++)
+ FastestTimes[i] = 0;
+ for (int i = 0; i < TOTAL_HIGHEST_SCORES; i++)
+ HighestScores[i] = 0;
+ for (int i = 0; i < NUM_PEDTYPES; i++)
+ PedsKilledOfThisType[i] = 0;
+ IndustrialPassed = 0;
+ CommercialPassed = 0;
+ SuburbanPassed = 0;
+}
+
void CStats::RegisterFastestTime(int32 index, int32 time)
{
assert(index >= 0 && index < TOTAL_FASTEST_TIMES);
@@ -138,4 +200,229 @@ void CStats::SetTotalNumberMissions(int32 total)
TotalNumberMissions = total;
}
-WRAPPER void CStats::Init() { EAXJMP(0x4AAC60); } \ No newline at end of file
+wchar *CStats::FindCriminalRatingString()
+{
+ int rating = FindCriminalRatingNumber();
+
+ if (rating < 10) return TheText.Get("RATNG1");
+ if (rating < 25) return TheText.Get("RATNG2");
+ if (rating < 70) return TheText.Get("RATNG3");
+ if (rating < 150) return TheText.Get("RATNG4");
+ if (rating < 250) return TheText.Get("RATNG5");
+ if (rating < 450) return TheText.Get("RATNG6");
+ if (rating < 700) return TheText.Get("RATNG7");
+ if (rating < 1000) return TheText.Get("RATNG8");
+ if (rating < 1400) return TheText.Get("RATNG9");
+ if (rating < 1900) return TheText.Get("RATNG10");
+ if (rating < 2500) return TheText.Get("RATNG11");
+ if (rating < 3200) return TheText.Get("RATNG12");
+ if (rating < 4000) return TheText.Get("RATNG13");
+ if (rating < 5000) return TheText.Get("RATNG14");
+ return TheText.Get("RATNG15");
+}
+
+int32 CStats::FindCriminalRatingNumber()
+{
+ int32 rating;
+
+ rating = FiresExtinguished + 10 * HighestLevelAmbulanceMission + CriminalsCaught + LivesSavedWithAmbulance
+ + 30 * HelisDestroyed + TotalLegitimateKills - 3 * TimesArrested - 3 * TimesDied
+ + CWorld::Players[CWorld::PlayerInFocus].m_nMoney / 5000;
+ if (rating <= 0) rating = 0;
+
+ if (InstantHitsFiredByPlayer > 100)
+ rating += (float)CStats::InstantHitsHitByPlayer / (float)CStats::InstantHitsFiredByPlayer * 500.0f;
+ if (TotalProgressInGame)
+ rating += (float)CStats::ProgressMade / (float)CStats::TotalProgressInGame * 1000.0f;
+ if (!IndustrialPassed && rating >= 3521)
+ rating = 3521;
+ if (!CommercialPassed && rating >= 4552)
+ rating = 4552;
+ return rating;
+}
+
+void CStats::SaveStats(uint8 *buf, uint32 *size)
+{
+ CheckPointReachedSuccessfully();
+ uint8 *buf_start = buf;
+ *size = sizeof(PeopleKilledByPlayer) +
+ sizeof(PeopleKilledByOthers) +
+ sizeof(CarsExploded) +
+ sizeof(RoundsFiredByPlayer) +
+ sizeof(PedsKilledOfThisType) +
+ sizeof(HelisDestroyed) +
+ sizeof(ProgressMade) +
+ sizeof(TotalProgressInGame) +
+ sizeof(KgsOfExplosivesUsed) +
+ sizeof(InstantHitsFiredByPlayer) +
+ sizeof(InstantHitsHitByPlayer) +
+ sizeof(CarsCrushed) +
+ sizeof(HeadsPopped) +
+ sizeof(TimesArrested) +
+ sizeof(TimesDied) +
+ sizeof(DaysPassed) +
+ sizeof(mmRain) +
+ sizeof(MaximumJumpDistance) +
+ sizeof(MaximumJumpHeight) +
+ sizeof(MaximumJumpFlips) +
+ sizeof(MaximumJumpSpins) +
+ sizeof(BestStuntJump) +
+ sizeof(NumberOfUniqueJumpsFound) +
+ sizeof(TotalNumberOfUniqueJumps) +
+ sizeof(MissionsGiven) +
+ sizeof(MissionsPassed) +
+ sizeof(PassengersDroppedOffWithTaxi) +
+ sizeof(MoneyMadeWithTaxi) +
+ sizeof(IndustrialPassed) +
+ sizeof(CommercialPassed) +
+ sizeof(SuburbanPassed) +
+ sizeof(ElBurroTime) +
+ sizeof(DistanceTravelledOnFoot) +
+ sizeof(DistanceTravelledInVehicle) +
+ sizeof(Record4x4One) +
+ sizeof(Record4x4Two) +
+ sizeof(Record4x4Three) +
+ sizeof(Record4x4Mayhem) +
+ sizeof(LivesSavedWithAmbulance) +
+ sizeof(CriminalsCaught) +
+ sizeof(HighestLevelAmbulanceMission) +
+ sizeof(FiresExtinguished) +
+ sizeof(LongestFlightInDodo) +
+ sizeof(TimeTakenDefuseMission) +
+ sizeof(NumberKillFrenziesPassed) +
+ sizeof(TotalNumberKillFrenzies) +
+ sizeof(TotalNumberMissions) +
+ sizeof(FastestTimes) +
+ sizeof(HighestScores) +
+ sizeof(KillsSinceLastCheckpoint) +
+ sizeof(TotalLegitimateKills) +
+ sizeof(LastMissionPassedName);
+
+#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
+ CopyToBuf(buf, PeopleKilledByPlayer);
+ CopyToBuf(buf, PeopleKilledByOthers);
+ CopyToBuf(buf, CarsExploded);
+ CopyToBuf(buf, RoundsFiredByPlayer);
+ CopyToBuf(buf, PedsKilledOfThisType);
+ CopyToBuf(buf, HelisDestroyed);
+ CopyToBuf(buf, ProgressMade);
+ CopyToBuf(buf, TotalProgressInGame);
+ CopyToBuf(buf, KgsOfExplosivesUsed);
+ CopyToBuf(buf, InstantHitsFiredByPlayer);
+ CopyToBuf(buf, InstantHitsHitByPlayer);
+ CopyToBuf(buf, CarsCrushed);
+ CopyToBuf(buf, HeadsPopped);
+ CopyToBuf(buf, TimesArrested);
+ CopyToBuf(buf, TimesDied);
+ CopyToBuf(buf, DaysPassed);
+ CopyToBuf(buf, mmRain);
+ CopyToBuf(buf, MaximumJumpDistance);
+ CopyToBuf(buf, MaximumJumpHeight);
+ CopyToBuf(buf, MaximumJumpFlips);
+ CopyToBuf(buf, MaximumJumpSpins);
+ CopyToBuf(buf, BestStuntJump);
+ CopyToBuf(buf, NumberOfUniqueJumpsFound);
+ CopyToBuf(buf, TotalNumberOfUniqueJumps);
+ CopyToBuf(buf, MissionsGiven);
+ CopyToBuf(buf, MissionsPassed);
+ CopyToBuf(buf, PassengersDroppedOffWithTaxi);
+ CopyToBuf(buf, MoneyMadeWithTaxi);
+ CopyToBuf(buf, IndustrialPassed);
+ CopyToBuf(buf, CommercialPassed);
+ CopyToBuf(buf, SuburbanPassed);
+ CopyToBuf(buf, ElBurroTime);
+ CopyToBuf(buf, DistanceTravelledOnFoot);
+ CopyToBuf(buf, DistanceTravelledInVehicle);
+ CopyToBuf(buf, Record4x4One);
+ CopyToBuf(buf, Record4x4Two);
+ CopyToBuf(buf, Record4x4Three);
+ CopyToBuf(buf, Record4x4Mayhem);
+ CopyToBuf(buf, LivesSavedWithAmbulance);
+ CopyToBuf(buf, CriminalsCaught);
+ CopyToBuf(buf, HighestLevelAmbulanceMission);
+ CopyToBuf(buf, FiresExtinguished);
+ CopyToBuf(buf, LongestFlightInDodo);
+ CopyToBuf(buf, TimeTakenDefuseMission);
+ CopyToBuf(buf, NumberKillFrenziesPassed);
+ CopyToBuf(buf, TotalNumberKillFrenzies);
+ CopyToBuf(buf, TotalNumberMissions);
+ CopyToBuf(buf, FastestTimes);
+ CopyToBuf(buf, HighestScores);
+ CopyToBuf(buf, KillsSinceLastCheckpoint);
+ CopyToBuf(buf, TotalLegitimateKills);
+ CopyToBuf(buf, LastMissionPassedName);
+
+ assert(buf - buf_start == *size);
+#undef CopyToBuf
+}
+
+void CStats::LoadStats(uint8 *buf, uint32 size)
+{
+ uint8* buf_start = buf;
+
+#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); buf += sizeof(data);
+
+ CopyFromBuf(buf, PeopleKilledByPlayer);
+ CopyFromBuf(buf, PeopleKilledByOthers);
+ CopyFromBuf(buf, CarsExploded);
+ CopyFromBuf(buf, RoundsFiredByPlayer);
+ CopyFromBuf(buf, PedsKilledOfThisType);
+ CopyFromBuf(buf, HelisDestroyed);
+ CopyFromBuf(buf, ProgressMade);
+ CopyFromBuf(buf, TotalProgressInGame);
+ CopyFromBuf(buf, KgsOfExplosivesUsed);
+ CopyFromBuf(buf, InstantHitsFiredByPlayer);
+ CopyFromBuf(buf, InstantHitsHitByPlayer);
+ CopyFromBuf(buf, CarsCrushed);
+ CopyFromBuf(buf, HeadsPopped);
+ CopyFromBuf(buf, TimesArrested);
+ CopyFromBuf(buf, TimesDied);
+ CopyFromBuf(buf, DaysPassed);
+ CopyFromBuf(buf, mmRain);
+ CopyFromBuf(buf, MaximumJumpDistance);
+ CopyFromBuf(buf, MaximumJumpHeight);
+ CopyFromBuf(buf, MaximumJumpFlips);
+ CopyFromBuf(buf, MaximumJumpSpins);
+ CopyFromBuf(buf, BestStuntJump);
+ CopyFromBuf(buf, NumberOfUniqueJumpsFound);
+ CopyFromBuf(buf, TotalNumberOfUniqueJumps);
+ CopyFromBuf(buf, MissionsGiven);
+ CopyFromBuf(buf, MissionsPassed);
+ CopyFromBuf(buf, PassengersDroppedOffWithTaxi);
+ CopyFromBuf(buf, MoneyMadeWithTaxi);
+ CopyFromBuf(buf, IndustrialPassed);
+ CopyFromBuf(buf, CommercialPassed);
+ CopyFromBuf(buf, SuburbanPassed);
+ CopyFromBuf(buf, ElBurroTime);
+ CopyFromBuf(buf, DistanceTravelledOnFoot);
+ CopyFromBuf(buf, DistanceTravelledInVehicle);
+ CopyFromBuf(buf, Record4x4One);
+ CopyFromBuf(buf, Record4x4Two);
+ CopyFromBuf(buf, Record4x4Three);
+ CopyFromBuf(buf, Record4x4Mayhem);
+ CopyFromBuf(buf, LivesSavedWithAmbulance);
+ CopyFromBuf(buf, CriminalsCaught);
+ CopyFromBuf(buf, HighestLevelAmbulanceMission);
+ CopyFromBuf(buf, FiresExtinguished);
+ CopyFromBuf(buf, LongestFlightInDodo);
+ CopyFromBuf(buf, TimeTakenDefuseMission);
+ CopyFromBuf(buf, NumberKillFrenziesPassed);
+ CopyFromBuf(buf, TotalNumberKillFrenzies);
+ CopyFromBuf(buf, TotalNumberMissions);
+ CopyFromBuf(buf, FastestTimes);
+ CopyFromBuf(buf, HighestScores);
+ CopyFromBuf(buf, KillsSinceLastCheckpoint);
+ CopyFromBuf(buf, TotalLegitimateKills);
+ CopyFromBuf(buf, LastMissionPassedName);
+
+ assert(buf - buf_start == size);
+#undef CopyFromBuf
+}
+
+STARTPATCHES
+ InjectHook(0x48C5A3, CStats::Init, PATCH_JUMP); // CGame::ReInitGameObjectVariables
+ InjectHook(0x4AB3E0, CStats::SaveStats, PATCH_JUMP);
+ InjectHook(0x4AB670, CStats::LoadStats, PATCH_JUMP);
+ InjectHook(0x4AB090, CStats::FindCriminalRatingString, PATCH_JUMP);
+ InjectHook(0x4AB2A0, CStats::FindCriminalRatingNumber, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 1d220905..ac3259f9 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -1,5 +1,7 @@
#pragma once
+#include "PedType.h"
+
class CStats
{
public:
@@ -8,14 +10,14 @@ public:
TOTAL_HIGHEST_SCORES = 16
};
static int32 &DaysPassed;
- static int32 &HeadsPopped;
- static bool& CommercialPassed;
- static bool& IndustrialPassed;
- static bool& SuburbanPassed;
+ static int32 &HeadsPopped;
+ static int32& CommercialPassed;
+ static int32& IndustrialPassed;
+ static int32& SuburbanPassed;
static int32 &NumberKillFrenziesPassed;
static int32 &PeopleKilledByOthers;
static int32 &HelisDestroyed;
- static int32 *PedsKilledOfThisType; //[NUM_PEDTYPES]
+ static int32(&PedsKilledOfThisType)[ePedType::NUM_PEDTYPES];
static int32 &TimesDied;
static int32 &TimesArrested;
static int32 &KillsSinceLastCheckpoint;
@@ -50,32 +52,39 @@ public:
static int32 &LongestFlightInDodo;
static int32 &TimeTakenDefuseMission;
static int32 &TotalNumberKillFrenzies;
- static int32 &TotalNumberMissions;
+ static int32 &TotalNumberMissions;
+ static int32 &RoundsFiredByPlayer;
+ static int32 &KgsOfExplosivesUsed;
+ static int32 &InstantHitsFiredByPlayer;
+ static int32 &InstantHitsHitByPlayer;
+ static int32 &BestTimeBombDefusal;
+ static int32 &mmRain;
+ static int32 &CarsCrushed;
static int32(&FastestTimes)[TOTAL_FASTEST_TIMES];
static int32(&HighestScores)[TOTAL_HIGHEST_SCORES];
- static int32 &KgOfExplosivesUsed;
- static int32 &CarsCrushed;
public:
+ static void Init(void);
static void RegisterFastestTime(int32, int32);
static void RegisterHighestScore(int32, int32);
- static void AnotherKillFrenzyPassed();
- static void AnotherLifeSavedWithAmbulance();
- static void AnotherCriminalCaught();
- static void RegisterLevelAmbulanceMission(int32);
- static void AnotherFireExtinguished();
+ static void RegisterElBurroTime(int32);
static void Register4x4OneTime(int32);
static void Register4x4TwoTime(int32);
static void Register4x4ThreeTime(int32);
static void Register4x4MayhemTime(int32);
+ static void AnotherLifeSavedWithAmbulance();
+ static void AnotherCriminalCaught();
+ static void RegisterLevelAmbulanceMission(int32);
+ static void AnotherFireExtinguished();
+ static wchar *FindCriminalRatingString();
static void RegisterLongestFlightInDodo(int32);
static void RegisterTimeTakenDefuseMission(int32);
+ static void AnotherKillFrenzyPassed();
static void SetTotalNumberKillFrenzies(int32);
static void SetTotalNumberMissions(int32);
- static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; };
static void CheckPointReachedSuccessfully() { TotalLegitimateKills += KillsSinceLastCheckpoint; KillsSinceLastCheckpoint = 0; };
- static void RegisterElBurroTime(int32);
+ static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; };
+ static int32 FindCriminalRatingNumber();
static void SaveStats(uint8 *buf, uint32 *size);
-
- static void Init(void);
+ static void LoadStats(uint8 *buf, uint32 size);
};
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 3dcb767a..d00edf51 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1247,8 +1247,8 @@ CStreaming::StreamVehiclesAndPeds(void)
static int timeBeforeNextLoad = 0;
static int modelQualityClass = 0;
- if(CRecordDataForGame::RecordingState == RECORDSTATE_1 ||
- CRecordDataForGame::RecordingState == RECORDSTATE_2)
+ if(CRecordDataForGame::IsRecording() ||
+ CRecordDataForGame::IsPlayingBack())
return;
if(FindPlayerPed()->m_pWanted->AreSwatRequired()){
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp
index 18d6b6a3..fda862f1 100644
--- a/src/core/Timer.cpp
+++ b/src/core/Timer.cpp
@@ -34,6 +34,10 @@ LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318;
//UInt32 suspendDepth;
uint32 &suspendDepth = *(uint32*)0x62A320;
+#ifdef FIX_BUGS
+double frameTime;
+#endif
+
void CTimer::Initialise(void)
{
debug("Initialising CTimer...\n");
@@ -90,17 +94,21 @@ void CTimer::Update(void)
float updInCyclesScaled = updInCycles * ms_fTimeScale;
- double upd = updInCyclesScaled / (double)_nCyclesPerMS;
+ // We need that real frame time to fix transparent menu bug.
+#ifndef FIX_BUGS
+ double
+#endif
+ frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
- m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd;
+ m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
if ( GetIsPaused() )
ms_fTimeStep = 0.0f;
else
{
- m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd;
- m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd;
- ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0f;
+ m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
+ m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
+ ms_fTimeStep = frameTime / 1000.0f * 50.0f;
}
}
else
@@ -109,19 +117,23 @@ void CTimer::Update(void)
uint32 updInMs = timer - oldPcTimer;
- double upd = (double)updInMs * ms_fTimeScale;
+ // We need that real frame time to fix transparent menu bug.
+#ifndef FIX_BUGS
+ double
+#endif
+ frameTime = (double)updInMs * ms_fTimeScale;
oldPcTimer = timer;
- m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd;
+ m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
if ( GetIsPaused() )
ms_fTimeStep = 0.0f;
else
{
- m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd;
- m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd;
- ms_fTimeStep = upd / 1000.0f * 50.0f;
+ m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
+ m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
+ ms_fTimeStep = frameTime / 1000.0f * 50.0f;
}
}
@@ -130,7 +142,7 @@ void CTimer::Update(void)
ms_fTimeStepNonClipped = ms_fTimeStep;
- if ( CRecordDataForGame::RecordingState != RECORDSTATE_2 )
+ if ( !CRecordDataForGame::IsPlayingBack() )
{
ms_fTimeStep = min(3.0f, ms_fTimeStep);
@@ -138,7 +150,7 @@ void CTimer::Update(void)
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60;
}
- if ( CRecordDataForChase::Status == RECORDSTATE_1 )
+ if ( CRecordDataForChase::IsRecording() )
{
ms_fTimeStep = 1.0f;
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 16;
diff --git a/src/core/Timer.h b/src/core/Timer.h
index 2498ec8a..a4d674da 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -21,6 +21,7 @@ public:
static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; }
static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
+ static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; }
static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; }
static const uint32 &GetFrameCounter(void) { return m_FrameCounter; }
static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; }
@@ -52,4 +53,11 @@ public:
static void Stop(void);
static void StartUserPause(void);
static void EndUserPause(void);
+
+ friend bool GenericLoad(void);
+ friend bool GenericSave(int file);
};
+
+#ifdef FIX_BUGS
+extern double frameTime;
+#endif
diff --git a/src/core/TxdStore.cpp b/src/core/TxdStore.cpp
deleted file mode 100644
index c751147d..00000000
--- a/src/core/TxdStore.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "templates.h"
-#include "General.h"
-#include "Streaming.h"
-#include "RwHelper.h"
-#include "TxdStore.h"
-
-CPool<TxdDef,TxdDef> *&CTxdStore::ms_pTxdPool = *(CPool<TxdDef,TxdDef>**)0x8F5FB8;
-RwTexDictionary *&CTxdStore::ms_pStoredTxd = *(RwTexDictionary**)0x9405BC;
-
-void
-CTxdStore::Initialise(void)
-{
- if(ms_pTxdPool == nil)
- ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE);
-}
-
-void
-CTxdStore::Shutdown(void)
-{
- if(ms_pTxdPool)
- delete ms_pTxdPool;
-}
-
-void
-CTxdStore::GameShutdown(void)
-{
- int i;
-
- for(i = 0; i < TXDSTORESIZE; i++){
- TxdDef *def = GetSlot(i);
- if(def && GetNumRefs(i) == 0)
- RemoveTxdSlot(i);
- }
-}
-
-int
-CTxdStore::AddTxdSlot(const char *name)
-{
- TxdDef *def = ms_pTxdPool->New();
- assert(def);
- def->texDict = nil;
- def->refCount = 0;
- strcpy(def->name, name);
- return ms_pTxdPool->GetJustIndex(def);
-}
-
-void
-CTxdStore::RemoveTxdSlot(int slot)
-{
- TxdDef *def = GetSlot(slot);
- if(def->texDict)
- RwTexDictionaryDestroy(def->texDict);
- ms_pTxdPool->Delete(def);
-}
-
-int
-CTxdStore::FindTxdSlot(const char *name)
-{
- char *defname;
- int size = ms_pTxdPool->GetSize();
- for(int i = 0; i < size; i++){
- defname = GetTxdName(i);
- if(defname && !CGeneral::faststricmp(defname, name))
- return i;
- }
- return -1;
-}
-
-char*
-CTxdStore::GetTxdName(int slot)
-{
- TxdDef *def = GetSlot(slot);
- return def ? def->name : nil;
-}
-
-void
-CTxdStore::PushCurrentTxd(void)
-{
- ms_pStoredTxd = RwTexDictionaryGetCurrent();
-}
-
-void
-CTxdStore::PopCurrentTxd(void)
-{
- RwTexDictionarySetCurrent(ms_pStoredTxd);
- ms_pStoredTxd = nil;
-}
-
-void
-CTxdStore::SetCurrentTxd(int slot)
-{
- TxdDef *def = GetSlot(slot);
- if(def)
- RwTexDictionarySetCurrent(def->texDict);
-}
-
-void
-CTxdStore::Create(int slot)
-{
- GetSlot(slot)->texDict = RwTexDictionaryCreate();
-}
-
-int
-CTxdStore::GetNumRefs(int slot)
-{
- return GetSlot(slot)->refCount;
-}
-
-void
-CTxdStore::AddRef(int slot)
-{
- GetSlot(slot)->refCount++;
-}
-
-void
-CTxdStore::RemoveRef(int slot)
-{
- if(--GetSlot(slot)->refCount <= 0)
- CStreaming::RemoveModel(slot + STREAM_OFFSET_TXD);
-}
-
-void
-CTxdStore::RemoveRefWithoutDelete(int slot)
-{
- GetSlot(slot)->refCount--;
-}
-
-bool
-CTxdStore::LoadTxd(int slot, RwStream *stream)
-{
- TxdDef *def = GetSlot(slot);
-
- if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
- def->texDict = RwTexDictionaryGtaStreamRead(stream);
- return def->texDict != nil;
- }
- printf("Failed to load TXD\n");
- return false;
-}
-
-bool
-CTxdStore::LoadTxd(int slot, const char *filename)
-{
- RwStream *stream;
- bool ret;
-
- ret = false;
- _rwD3D8TexDictionaryEnableRasterFormatConversion(true);
- do
- stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, filename);
- while(stream == nil);
- ret = LoadTxd(slot, stream);
- RwStreamClose(stream, nil);
- return ret;
-}
-
-bool
-CTxdStore::StartLoadTxd(int slot, RwStream *stream)
-{
- TxdDef *def = GetSlot(slot);
- if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
- def->texDict = RwTexDictionaryGtaStreamRead1(stream);
- return def->texDict != nil;
- }else{
- printf("Failed to load TXD\n");
- return false;
- }
-}
-
-bool
-CTxdStore::FinishLoadTxd(int slot, RwStream *stream)
-{
- TxdDef *def = GetSlot(slot);
- def->texDict = RwTexDictionaryGtaStreamRead2(stream, def->texDict);
- return def->texDict != nil;
-}
-
-void
-CTxdStore::RemoveTxd(int slot)
-{
- TxdDef *def = GetSlot(slot);
- if(def->texDict)
- RwTexDictionaryDestroy(def->texDict);
- def->texDict = nil;
-}
-
-STARTPATCHES
- InjectHook(0x527440, CTxdStore::Initialise, PATCH_JUMP);
- InjectHook(0x527470, CTxdStore::Shutdown, PATCH_JUMP);
- InjectHook(0x527490, CTxdStore::GameShutdown, PATCH_JUMP);
- InjectHook(0x5274E0, CTxdStore::AddTxdSlot, PATCH_JUMP);
- InjectHook(0x5275D0, CTxdStore::FindTxdSlot, PATCH_JUMP);
- InjectHook(0x527590, CTxdStore::GetTxdName, PATCH_JUMP);
- InjectHook(0x527900, CTxdStore::PushCurrentTxd, PATCH_JUMP);
- InjectHook(0x527910, CTxdStore::PopCurrentTxd, PATCH_JUMP);
- InjectHook(0x5278C0, CTxdStore::SetCurrentTxd, PATCH_JUMP);
- InjectHook(0x527830, CTxdStore::Create, PATCH_JUMP);
- InjectHook(0x527A00, CTxdStore::GetNumRefs, PATCH_JUMP);
- InjectHook(0x527930, CTxdStore::AddRef, PATCH_JUMP);
- InjectHook(0x527970, CTxdStore::RemoveRef, PATCH_JUMP);
- InjectHook(0x5279C0, CTxdStore::RemoveRefWithoutDelete, PATCH_JUMP);
- InjectHook(0x527700, (bool (*)(int, RwStream*))CTxdStore::LoadTxd, PATCH_JUMP);
- InjectHook(0x5276B0, (bool (*)(int, const char*))CTxdStore::LoadTxd, PATCH_JUMP);
- InjectHook(0x527770, CTxdStore::StartLoadTxd, PATCH_JUMP);
- InjectHook(0x5277E0, CTxdStore::FinishLoadTxd, PATCH_JUMP);
- InjectHook(0x527870, CTxdStore::RemoveTxd, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/core/TxdStore.h b/src/core/TxdStore.h
deleted file mode 100644
index 12ac708f..00000000
--- a/src/core/TxdStore.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-
-#include "templates.h"
-
-struct TxdDef {
- RwTexDictionary *texDict;
- int refCount;
- char name[20];
-};
-
-class CTxdStore
-{
- static CPool<TxdDef,TxdDef> *&ms_pTxdPool;
- static RwTexDictionary *&ms_pStoredTxd;
-public:
- static void Initialise(void);
- static void Shutdown(void);
- static void GameShutdown(void);
- static int AddTxdSlot(const char *name);
- static void RemoveTxdSlot(int slot);
- static int FindTxdSlot(const char *name);
- static char *GetTxdName(int slot);
- static void PushCurrentTxd(void);
- static void PopCurrentTxd(void);
- static void SetCurrentTxd(int slot);
- static void Create(int slot);
- static int GetNumRefs(int slot);
- static void AddRef(int slot);
- static void RemoveRef(int slot);
- static void RemoveRefWithoutDelete(int slot);
- static bool LoadTxd(int slot, RwStream *stream);
- static bool LoadTxd(int slot, const char *filename);
- static bool StartLoadTxd(int slot, RwStream *stream);
- static bool FinishLoadTxd(int slot, RwStream *stream);
- static void RemoveTxd(int slot);
-
- static TxdDef *GetSlot(int slot) {
- assert(slot >= 0);
- assert(ms_pTxdPool);
- assert(slot < ms_pTxdPool->GetSize());
- return ms_pTxdPool->GetSlot(slot);
- }
- static bool isTxdLoaded(int slot);
-};
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 4a0230ce..d64569b3 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -56,6 +56,8 @@ WRAPPER void CWorld::FindMissionEntitiesIntersectingCube(const CVector&, const C
WRAPPER void CWorld::ClearCarsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B50E0); }
WRAPPER void CWorld::ClearPedsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B52B0); }
WRAPPER void CWorld::CallOffChaseForArea(float, float, float, float) { EAXJMP(0x4B5530); }
+WRAPPER void CWorld::TriggerExplosion(const CVector& a1, float a2, float a3, CEntity *a4, bool a5) { EAXJMP(0x4B1140); }
+WRAPPER void CWorld::SetPedsOnFire(float, float, float, float, CEntity*) { EAXJMP(0x4B3D30); }
void
CWorld::Initialise()
diff --git a/src/core/World.h b/src/core/World.h
index c4103eb2..07e7889f 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -132,6 +132,7 @@ public:
static void SetAllCarsCanBeDamaged(bool);
static void ExtinguishAllCarFiresInArea(CVector, float);
static void SetCarsOnFire(float, float, float, float, CEntity*);
+ static void SetPedsOnFire(float, float, float, float, CEntity*);
static void Initialise();
static void AddParticles();
@@ -140,6 +141,7 @@ public:
static void RepositionCertainDynamicObjects();
static void RemoveStaticObjects();
static void Process();
+ static void TriggerExplosion(const CVector &, float, float, CEntity*, bool);
};
extern CColPoint *gaTempSphereColPoints;
diff --git a/src/core/common.h b/src/core/common.h
index b58b93af..7688b182 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -74,9 +74,11 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
}
+#ifndef RWLIBS
// little hack
extern void **rwengine;
#define RwEngineInstance (*rwengine)
+#endif
#include "skeleton.h"
#include "Draw.h"
@@ -84,12 +86,14 @@ extern void **rwengine;
#define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448)
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
+#define DEFAULT_VIEWWINDOW (0.7f)
// game uses maximumWidth/Height, but this probably won't work
// with RW windowed mode
#define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
+#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
// This scales from PS2 pixel coordinates to the real resolution
#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)
@@ -105,10 +109,8 @@ extern void **rwengine;
#ifdef ASPECT_RATIO_SCALE
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
-#define SCREEN_SCALE_AR2(a) ((a) / (DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO))
#else
#define SCREEN_SCALE_AR(a) (a)
-#define SCREEN_SCALE_AR2(a) (a)
#endif
#include "maths.h"
diff --git a/src/core/config.h b/src/core/config.h
index 373fca2f..f7fde579 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -73,9 +73,13 @@ enum Config {
NUMCORONAS = 56,
NUMPOINTLIGHTS = 32,
NUM3DMARKERS = 32,
+ NUMBRIGHTLIGHTS = 32,
+ NUMSHINYTEXTS = 32,
NUMMONEYMESSAGES = 16,
NUMPICKUPMESSAGES = 16,
NUMBULLETTRACES = 16,
+ NUMMBLURSTREAKS = 4,
+ NUMSKIDMARKS = 32,
NUMONSCREENTIMERENTRIES = 1,
NUMRADARBLIPS = 32,
@@ -83,6 +87,7 @@ enum Config {
NUMSCRIPTEDPICKUPS = 16,
NUMPICKUPS = NUMGENERALPICKUPS + NUMSCRIPTEDPICKUPS,
NUMCOLLECTEDPICKUPS = 20,
+ NUMPACMANPICKUPS = 256,
NUMEVENTS = 64,
NUM_CARGENS = 160,
@@ -120,7 +125,11 @@ enum Config {
NUM_AUDIO_REFLECTIONS = 5,
NUM_SCRIPT_MAX_ENTITIES = 40,
- NUM_GARAGE_STORED_CARS = 6
+ NUM_GARAGE_STORED_CARS = 6,
+
+ NUM_CRANES = 8,
+
+ NUM_EXPLOSIONS = 48,
};
// We'll use this once we're ready to become independent of the game
@@ -145,6 +154,7 @@ enum Config {
//#define MASTER
#if defined GTA_PS2
+# define GTA_PS2_STUFF
# define RANDOMSPLASH
#elif defined GTA_PC
# define GTA3_1_1_PATCH
@@ -183,13 +193,17 @@ enum Config {
// Pad
#define XINPUT
#define KANGAROO_CHEAT
-#define REGISTER_START_BUTTON // currently only in menu sadly. resumes the game
+#define REGISTER_START_BUTTON
// Hud, frontend and radar
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
+#define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
+#define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
+#define TRIANGLE_BACK_BUTTON
+// #define CIRCLE_BACK_BUTTON
// Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 674527f5..f09c2e0a 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1,6 +1,10 @@
#include "common.h"
+#include "rpmatfx.h"
+#include "rphanim.h"
+#include "rpskin.h"
#include "patcher.h"
#include "main.h"
+#include "CdStream.h"
#include "General.h"
#include "RwHelper.h"
#include "Clouds.h"
@@ -49,12 +53,11 @@
#include "Frontend.h"
#include "AnimViewer.h"
#include "Script.h"
+#include "PathFind.h"
#include "Debug.h"
#include "Console.h"
#include "timebars.h"
-
-#define DEFAULT_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
-
+#include "GenericGameStorage.h"
GlobalScene &Scene = *(GlobalScene*)0x726768;
@@ -68,293 +71,68 @@ char *gString2 = (char*)0x878A40;
wchar *gUString = (wchar*)0x74B018;
wchar *gUString2 = (wchar*)0x6EDD70;
-bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;
-
-
-char version_name[64];
float FramesPerSecond = 30.0f;
bool gbPrintShite = false;
bool &gbModelViewer = *(bool*)0x95CD93;
-bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
-bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
-void DoRWStuffEndOfFrame(void);
+int32 frameCount;
+
+RwRGBA gColourTop;
+
+bool gameAlreadyInitialised;
-void RenderScene(void);
-void RenderDebugShit(void);
-void RenderEffects(void);
-void Render2dStuff(void);
-void RenderMenus(void);
-void DoFade(void);
-void Render2dStuffAfterFade(void);
+float NumberOfChunksLoaded;
+#define TOTALNUMCHUNKS 73.0f
+
+bool g_SlowMode = false;
+char version_name[64];
-CSprite2d *LoadSplash(const char *name);
+void GameInit(void);
+void SystemInit(void);
+void TheGame(void);
extern void (*DebugMenuProcess)(void);
extern void (*DebugMenuRender)(void);
void DebugMenuInit(void);
void DebugMenuPopulate(void);
-void PrintGameVersion();
-
-RwRGBA gColourTop;
-
-void
-InitialiseGame(void)
-{
- LoadingScreen(nil, nil, "loadsc0");
- CGame::Initialise("DATA\\GTA3.DAT");
-}
-
-#ifndef MASTER
-void
-TheModelViewer(void)
-{
-#ifdef ASPECT_RATIO_SCALE
- CDraw::SetAspectRatio(CDraw::FindAspectRatio());
-#endif
- CAnimViewer::Update();
- CTimer::Update();
- SetLightsWithTimeOfDayColour(Scene.world);
- CRenderer::ConstructRenderList();
- DoRWStuffStartOfFrame(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
- CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
- 255);
-
- CSprite2d::InitPerFrame();
- CFont::InitPerFrame();
- DefinedState();
- CVisibilityPlugins::InitAlphaEntityList();
- CAnimViewer::Render();
- Render2dStuff();
- DoRWStuffEndOfFrame();
-}
-#endif
void
-Idle(void *arg)
+ValidateVersion()
{
-#ifdef ASPECT_RATIO_SCALE
- CDraw::SetAspectRatio(CDraw::FindAspectRatio());
-#endif
-
- CTimer::Update();
-
-#ifdef TIMEBARS
- tbInit();
-#endif
-
- CSprite2d::InitPerFrame();
- CFont::InitPerFrame();
-
- // We're basically merging FrontendIdle and Idle (just like TheGame on PS2)
-#ifdef PS2_SAVE_DIALOG
- // Only exists on PC FrontendIdle, probably some PS2 bug fix
- if (FrontEndMenuManager.m_bMenuActive)
- CSprite2d::SetRecipNearClip();
-
- if (FrontEndMenuManager.m_bGameNotLoaded) {
- CPad::UpdatePads();
- FrontEndMenuManager.Process();
- } else {
- CPointLights::InitPerFrame();
-#ifdef TIMEBARS
- tbStartTimer(0, "CGame::Process");
-#endif
- CGame::Process();
-#ifdef TIMEBARS
- tbEndTimer("CGame::Process");
- tbStartTimer(0, "DMAudio.Service");
-#endif
- DMAudio.Service();
-
-#ifdef TIMEBARS
- tbEndTimer("DMAudio.Service");
-#endif
- }
-
- if (RsGlobal.quit)
- return;
-#else
- CPointLights::InitPerFrame();
-#ifdef TIMEBARS
- tbStartTimer(0, "CGame::Process");
-#endif
- CGame::Process();
-#ifdef TIMEBARS
- tbEndTimer("CGame::Process");
- tbStartTimer(0, "DMAudio.Service");
-#endif
-
- DMAudio.Service();
-
-#ifdef TIMEBARS
- tbEndTimer("DMAudio.Service");
-#endif
-#endif
-
- if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
- FrontEndMenuManager.m_bStartGameLoading = true;
- FrontEndMenuManager.m_bLoadingSavedGame = false;
- return;
- }
-
- if(FrontEndMenuManager.m_bStartGameLoading || b_FoundRecentSavedGameWantToLoad)
- return;
-
- SetLightsWithTimeOfDayColour(Scene.world);
-
- if(arg == nil)
- return;
-
- if((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu) &&
- TheCamera.GetScreenFadeStatus() != FADE_2){
-#ifdef GTA_PC
- if (!FrontEndMenuManager.m_bRenderGameInMenu) {
- // This is from SA, but it's nice for windowed mode
- RwV2d pos;
- pos.x = SCREEN_WIDTH / 2.0f;
- pos.y = SCREEN_HEIGHT / 2.0f;
- RsMouseSetPos(&pos);
- }
-#endif
-#ifdef TIMEBARS
- tbStartTimer(0, "CnstrRenderList");
-#endif
- CRenderer::ConstructRenderList();
-#ifdef TIMEBARS
- tbEndTimer("CnstrRenderList");
- tbStartTimer(0, "PreRender");
-#endif
- CRenderer::PreRender();
-#ifdef TIMEBARS
- tbEndTimer("PreRender");
-#endif
+ int32 file = CFileMgr::OpenFile("models\\coll\\peds.col", "rb");
+ char buff[128];
- if(CWeather::LightningFlash && !CCullZones::CamNoRain()){
- if(!DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255))
- return;
- }else{
- if(!DoRWStuffStartOfFrame_Horizon(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
- CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
- 255))
- return;
+ if ( file != -1 )
+ {
+ CFileMgr::Seek(file, 100, SEEK_SET);
+
+ for ( int i = 0; i < 128; i++ )
+ {
+ CFileMgr::Read(file, &buff[i], sizeof(char));
+ buff[i] -= 23;
+ if ( buff[i] == '\0' )
+ break;
+ CFileMgr::Seek(file, 99, SEEK_CUR);
}
-
- DefinedState();
-
- // BUG. This has to be done BEFORE RwCameraBeginUpdate
- RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
- RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
-
-#ifdef TIMEBARS
- tbStartTimer(0, "RenderScene");
-#endif
- RenderScene();
-#ifdef TIMEBARS
- tbEndTimer("RenderScene");
-#endif
- RenderDebugShit();
- RenderEffects();
-
-#ifdef TIMEBARS
- tbStartTimer(0, "RenderMotionBlur");
-#endif
- if((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) &&
- TheCamera.m_ScreenReductionPercentage > 0.0f)
- TheCamera.SetMotionBlurAlpha(150);
- TheCamera.RenderMotionBlur();
-#ifdef TIMEBARS
- tbEndTimer("RenderMotionBlur");
- tbStartTimer(0, "Render2dStuff");
-#endif
- Render2dStuff();
-#ifdef TIMEBARS
- tbEndTimer("Render2dStuff");
-#endif
- }else{
- float viewWindow = DEFAULT_VIEWWINDOW;
-#ifdef ASPECT_RATIO_SCALE
- CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
-#else
- CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
-#endif
- CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
- RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
- if(!RsCameraBeginUpdate(Scene.camera))
+
+ if ( !strncmp(buff, "grandtheftauto3", 15) )
+ {
+ strncpy(version_name, &buff[15], 64);
+ CFileMgr::CloseFile(file);
return;
+ }
}
-#ifdef PS2_SAVE_DIALOG
- if (FrontEndMenuManager.m_bMenuActive)
- DefinedState();
-#endif
-#ifdef TIMEBARS
- tbStartTimer(0, "RenderMenus");
-#endif
- RenderMenus();
-#ifdef TIMEBARS
- tbEndTimer("RenderMenus");
- tbStartTimer(0, "DoFade");
-#endif
- DoFade();
-#ifdef TIMEBARS
- tbEndTimer("DoFade");
- tbStartTimer(0, "Render2dStuff-Fade");
-#endif
- Render2dStuffAfterFade();
-#ifdef TIMEBARS
- tbEndTimer("Render2dStuff-Fade");
-#endif
- CCredits::Render();
-
-#ifdef TIMEBARS
- tbDisplay();
-#endif
-
- DoRWStuffEndOfFrame();
-
-// if(g_SlowMode)
-// ProcessSlowMode();
-}
-
-void
-FrontendIdle(void)
-{
-#ifdef ASPECT_RATIO_SCALE
- CDraw::SetAspectRatio(CDraw::FindAspectRatio());
-#endif
-
- CTimer::Update();
- CSprite2d::SetRecipNearClip(); // this should be on InitialiseRenderWare according to PS2 asm. seems like a bug fix
- CSprite2d::InitPerFrame();
- CFont::InitPerFrame();
- CPad::UpdatePads();
- FrontEndMenuManager.Process();
-
- if(RsGlobal.quit)
- return;
-
- float viewWindow = DEFAULT_VIEWWINDOW;
-#ifdef ASPECT_RATIO_SCALE
- CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
-#else
- CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
-#endif
- CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
- RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
- if(!RsCameraBeginUpdate(Scene.camera))
- return;
-
- DefinedState(); // seems redundant, but breaks resolution change.
- RenderMenus();
- DoFade();
- Render2dStuffAfterFade();
-// CFont::DrawFonts(); // redundant
- DoRWStuffEndOfFrame();
+ LoadingScreen("Invalid version", NULL, NULL);
+
+ while(true)
+ {
+ ;
+ }
}
bool
@@ -363,7 +141,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
- CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@@ -381,7 +159,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{
- CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@@ -394,17 +172,6 @@ DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16
return true;
}
-void
-DoRWStuffEndOfFrame(void)
-{
- CDebug::DisplayScreenStrings(); // custom
- CDebug::DebugDisplayTextBuffer();
- FlushObrsPrintfs();
- RwCameraEndUpdate(Scene.camera);
- RsCameraShowRaster(Scene.camera);
-}
-
-
// This is certainly a very useful function
void
DoRWRenderHorizon(void)
@@ -413,127 +180,6 @@ DoRWRenderHorizon(void)
}
void
-RenderScene(void)
-{
- CClouds::Render();
- DoRWRenderHorizon();
- CRenderer::RenderRoads();
- CCoronas::RenderReflections();
- RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
- CRenderer::RenderEverythingBarRoads();
- CRenderer::RenderBoats();
- DefinedState();
- CWaterLevel::RenderWater();
- CRenderer::RenderFadingInEntities();
- CRenderer::RenderVehiclesButNotBoats();
- CWeather::RenderRainStreaks();
-}
-
-void
-RenderDebugShit(void)
-{
- CTheScripts::RenderTheScriptDebugLines();
- if(gbShowCollisionLines)
- CRenderer::RenderCollisionLines();
-}
-
-void
-RenderEffects(void)
-{
- CGlass::Render();
- CWaterCannons::Render();
- CSpecialFX::Render();
- CShadows::RenderStaticShadows();
- CShadows::RenderStoredShadows();
- CSkidmarks::Render();
- CAntennas::Render();
- CRubbish::Render();
- CCoronas::Render();
- CParticle::Render();
- CPacManPickups::Render();
- CWeaponEffects::Render();
- CPointLights::RenderFogEffect();
- CMovingThings::Render();
- CRenderer::RenderFirstPersonVehicle();
-}
-
-void
-Render2dStuff(void)
-{
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
- RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
-
- CReplay::Display();
- CPickups::RenderPickUpText();
-
- if(TheCamera.m_WideScreenOn)
- TheCamera.DrawBordersForWideScreen();
-
- CPed *player = FindPlayerPed();
- int weaponType = 0;
- if(player)
- weaponType = player->GetWeapon()->m_eWeaponType;
-
- bool firstPersonWeapon = false;
- int cammode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
- if(cammode == CCam::MODE_SNIPER ||
- cammode == CCam::MODE_SNIPER_RUNABOUT ||
- cammode == CCam::MODE_ROCKETLAUNCHER ||
- cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT)
- firstPersonWeapon = true;
-
- // Draw black border for sniper and rocket launcher
- if((weaponType == WEAPONTYPE_SNIPERRIFLE || weaponType == WEAPONTYPE_ROCKETLAUNCHER) && firstPersonWeapon){
- CRGBA black(0, 0, 0, 255);
-
- // top and bottom strips
- if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) {
- CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(180)), black);
- CSprite2d::DrawRect(CRect(0.0f, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(170), SCREEN_WIDTH, SCREEN_HEIGHT), black);
- }
- else {
- CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(210)), black);
- CSprite2d::DrawRect(CRect(0.0f, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(210), SCREEN_WIDTH, SCREEN_HEIGHT), black);
- }
- CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH / 2 - SCREEN_SCALE_X(210), SCREEN_HEIGHT), black);
- CSprite2d::DrawRect(CRect(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(210), 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), black);
- }
-
- MusicManager.DisplayRadioStationName();
- TheConsole.Display();
-/*
- if(CSceneEdit::m_bEditOn)
- CSceneEdit::Draw();
- else
-*/
- CHud::Draw();
- CUserDisplay::OnscnTimer.ProcessForDisplay();
- CMessages::Display();
- CDarkel::DrawMessages();
- CGarages::PrintMessages();
- CPad::PrintErrorMessage();
- CFont::DrawFonts();
-
- DebugMenuRender();
-}
-
-void
-RenderMenus(void)
-{
- if(FrontEndMenuManager.m_bMenuActive)
- FrontEndMenuManager.DrawFrontEnd();
-}
-
-bool &JustLoadedDontFadeInYet = *(bool*)0x95CDB4;
-bool &StillToFadeOut = *(bool*)0x95CD99;
-uint32 &TimeStartedCountingForFade = *(uint32*)0x9430EC;
-uint32 &TimeToStayFadedBeforeFadeOut = *(uint32*)0x611564;
-
-void
DoFade(void)
{
if(CTimer::GetIsPaused())
@@ -613,139 +259,95 @@ DoFade(void)
}
}
-float FramesPerSecondCounter;
-int32 FrameSamples;
-
-struct tZonePrint
-{
- char name[12];
- CRect rect;
-};
-
-tZonePrint ZonePrint[] =
-{
- { "suburban", CRect(-1639.4f, 1014.3f, -226.23f, -1347.9f) },
- { "comntop", CRect(-223.52f, 203.62f, 616.79f, -413.6f) },
- { "comnbtm", CRect(-227.24f, -413.6f, 620.51f, -911.84f) },
- { "comse", CRect( 200.35f, -911.84f, 620.51f, -1737.3f) },
- { "comsw", CRect(-223.52f, -911.84f, 200.35f, -1737.3f) },
- { "industsw", CRect( 744.05f, -473.0f, 1067.5f, -1331.5f) },
- { "industne", CRect( 1067.5f, 282.19f, 1915.3f, -473.0f) },
- { "industnw", CRect( 744.05f, 324.95f, 1067.5f, -473.0f) },
- { "industse", CRect( 1070.3f, -473.0f, 1918.1f, -1331.5f) },
- { "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) }
-};
-
-#ifndef MASTER
void
-DisplayGameDebugText()
+DoRWStuffEndOfFrame(void)
{
- static bool bDisplayPosn = false;
- static bool bDisplayRate = false;
+ CDebug::DisplayScreenStrings(); // custom
+ CDebug::DebugDisplayTextBuffer();
+ FlushObrsPrintfs();
+ RwCameraEndUpdate(Scene.camera);
+ RsCameraShowRaster(Scene.camera);
+}
+static RwBool
+PluginAttach(void)
+{
+ if( !RpWorldPluginAttach() )
{
- SETTWEAKPATH("GameDebugText");
- TWEAKBOOL(bDisplayPosn);
- TWEAKBOOL(bDisplayRate);
+ printf("Couldn't attach world plugin\n");
+
+ return FALSE;
}
-
-
- char str[200];
- wchar ustr[200];
- wchar ver[200];
- AsciiToUnicode(version_name, ver);
-
- CFont::SetPropOn();
- CFont::SetBackgroundOff();
- CFont::SetFontStyle(FONT_BANK);
- CFont::SetScale(SCREEN_STRETCH_X(0.5f), SCREEN_STRETCH_Y(0.5f));
- CFont::SetCentreOff();
- CFont::SetRightJustifyOff();
- CFont::SetWrapx(SCREEN_WIDTH);
- CFont::SetJustifyOff();
- CFont::SetBackGroundOnlyTextOff();
- CFont::SetColor(CRGBA(255, 108, 0, 255));
- CFont::PrintString(10.0f, 10.0f, ver);
-
- FrameSamples++;
- FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
- FramesPerSecond = FramesPerSecondCounter / FrameSamples;
-
- if ( FrameSamples > 30 )
+ if( !RpSkinPluginAttach() )
{
- FramesPerSecondCounter = 0.0f;
- FrameSamples = 0;
+ printf("Couldn't attach RpSkin plugin\n");
+
+ return FALSE;
}
-
- if ( !TheCamera.WorldViewerBeingUsed
- && CPad::GetPad(1)->GetSquare()
- && CPad::GetPad(1)->GetTriangle()
- && CPad::GetPad(1)->GetLeftShoulder2JustDown() )
+
+ if( !RpHAnimPluginAttach() )
{
- bDisplayPosn = !bDisplayPosn;
+ printf("Couldn't attach RpHAnim plugin\n");
+
+ return FALSE;
}
-
- if ( CPad::GetPad(1)->GetSquare()
- && CPad::GetPad(1)->GetTriangle()
- && CPad::GetPad(1)->GetRightShoulder2JustDown() )
+
+ if( !NodeNamePluginAttach() )
{
- bDisplayRate = !bDisplayRate;
+ printf("Couldn't attach node name plugin\n");
+
+ return FALSE;
}
- if ( bDisplayPosn || bDisplayRate )
+ if( !CVisibilityPlugins::PluginAttach() )
{
- CVector pos = FindPlayerCoors();
- int32 ZoneId = ARRAY_SIZE(ZonePrint)-1; // no zone
-
- for ( int32 i = 0; i < ARRAY_SIZE(ZonePrint)-1; i++ )
- {
- if ( pos.x > ZonePrint[i].rect.left
- && pos.x < ZonePrint[i].rect.right
- && pos.y > ZonePrint[i].rect.bottom
- && pos.y < ZonePrint[i].rect.top )
- {
- ZoneId = i;
- }
- }
-
- //NOTE: fps should be 30, but its 29 due to different fp2int conversion
- if ( bDisplayRate )
- sprintf(str, "X:%5.1f, Y:%5.1f, Z:%5.1f, F-%d, %s", pos.x, pos.y, pos.z, (int32)FramesPerSecond, ZonePrint[ZoneId].name);
- else
- sprintf(str, "X:%5.1f, Y:%5.1f, Z:%5.1f, %s", pos.x, pos.y, pos.z, ZonePrint[ZoneId].name);
-
- AsciiToUnicode(str, ustr);
+ printf("Couldn't attach visibility plugins\n");
- CFont::SetPropOff();
- CFont::SetBackgroundOff();
- CFont::SetScale(0.7f, 1.5f);
- CFont::SetCentreOff();
- CFont::SetRightJustifyOff();
- CFont::SetJustifyOff();
- CFont::SetBackGroundOnlyTextOff();
- CFont::SetWrapx(640.0f);
- CFont::SetFontStyle(FONT_HEADING);
+ return FALSE;
+ }
+
+ if( !RpAnimBlendPluginAttach() )
+ {
+ printf("Couldn't attach RpAnimBlend plugin\n");
- CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(42.0f, 42.0f, ustr);
+ return FALSE;
+ }
+
+ if( !RpMatFXPluginAttach() )
+ {
+ printf("Couldn't attach RpMatFX plugin\n");
- CFont::SetColor(CRGBA(255, 108, 0, 255));
- CFont::PrintString(40.0f, 40.0f, ustr);
+ return FALSE;
}
+
+ return TRUE;
}
-#endif
-void
-Render2dStuffAfterFade(void)
+static RwBool
+Initialise3D(void *param)
{
-#ifndef MASTER
- DisplayGameDebugText();
- //PrintGameVersion();
-#endif
+ if (RsRwInitialise(param))
+ {
+ //
+ DebugMenuInit();
+ DebugMenuPopulate();
+ //
- CHud::DrawAfterFade();
- CFont::DrawFonts();
+ return CGame::InitialiseRenderWare();
+ }
+
+ return (FALSE);
+}
+
+static void
+Terminate3D(void)
+{
+ CGame::ShutdownRenderWare();
+
+ RsRwTerminate();
+
+ return;
}
CSprite2d splash;
@@ -796,8 +398,41 @@ DestroySplashScreen(void)
splashTxdId = -1;
}
-float NumberOfChunksLoaded;
-#define TOTALNUMCHUNKS 73.0f
+char*
+GetRandomSplashScreen(void)
+{
+ int index;
+ static int index2 = 0;
+ static char splashName[128];
+ static int splashIndex[24] = {
+ 25, 22, 4, 13,
+ 1, 21, 14, 16,
+ 10, 12, 5, 9,
+ 11, 18, 3, 2,
+ 19, 23, 7, 17,
+ 15, 6, 8, 20
+ };
+
+ index = splashIndex[4*index2 + CGeneral::GetRandomNumberInRange(0, 3)];
+ index2++;
+ if(index2 == 6)
+ index2 = 0;
+ sprintf(splashName, "loadsc%d", index);
+ return splashName;
+}
+
+char*
+GetLevelSplashScreen(int level)
+{
+ static char *splashScreens[4] = {
+ nil,
+ "splash1",
+ "splash2",
+ "splash3",
+ };
+
+ return splashScreens[level];
+}
void
ResetLoadingScreenBar()
@@ -820,8 +455,10 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
splash = LoadSplash(splashscreen);
+#ifndef GTA_PS2
if(RsGlobal.quit)
return;
+#endif
if(DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255)){
CSprite2d::SetRecipNearClip();
@@ -914,131 +551,588 @@ LoadingIslandScreen(const char *levelName)
DoRWStuffEndOfFrame();
}
-char*
-GetLevelSplashScreen(int level)
-{
- static char *splashScreens[4] = {
- nil,
- "splash1",
- "splash2",
- "splash3",
- };
-
- return splashScreens[level];
+void
+ProcessSlowMode(void)
+{
+ int16 lX = CPad::GetPad(0)->NewState.LeftStickX;
+ int16 lY = CPad::GetPad(0)->NewState.LeftStickY;
+ int16 rX = CPad::GetPad(0)->NewState.RightStickX;
+ int16 rY = CPad::GetPad(0)->NewState.RightStickY;
+ int16 L1 = CPad::GetPad(0)->NewState.LeftShoulder1;
+ int16 L2 = CPad::GetPad(0)->NewState.LeftShoulder2;
+ int16 R1 = CPad::GetPad(0)->NewState.RightShoulder1;
+ int16 R2 = CPad::GetPad(0)->NewState.RightShoulder2;
+ int16 up = CPad::GetPad(0)->NewState.DPadUp;
+ int16 down = CPad::GetPad(0)->NewState.DPadDown;
+ int16 left = CPad::GetPad(0)->NewState.DPadLeft;
+ int16 right = CPad::GetPad(0)->NewState.DPadRight;
+ int16 start = CPad::GetPad(0)->NewState.Start;
+ int16 select = CPad::GetPad(0)->NewState.Select;
+ int16 square = CPad::GetPad(0)->NewState.Square;
+ int16 triangle = CPad::GetPad(0)->NewState.Triangle;
+ int16 cross = CPad::GetPad(0)->NewState.Cross;
+ int16 circle = CPad::GetPad(0)->NewState.Circle;
+ int16 L3 = CPad::GetPad(0)->NewState.LeftShock;
+ int16 R3 = CPad::GetPad(0)->NewState.RightShock;
+ int16 networktalk = CPad::GetPad(0)->NewState.NetworkTalk;
+ int16 stop = true;
+
+ do
+ {
+ if ( CPad::GetPad(1)->GetLeftShoulder1JustDown() || CPad::GetPad(1)->GetRightShoulder1() )
+ break;
+
+ if ( stop )
+ {
+ CTimer::Stop();
+ stop = false;
+ }
+
+ CPad::UpdatePads();
+
+ RwCameraBeginUpdate(Scene.camera);
+ RwCameraEndUpdate(Scene.camera);
+
+ if ( CPad::GetPad(1)->GetLeftShoulder1JustDown() || CPad::GetPad(1)->GetRightShoulder1() )
+ break;
+
+ } while (!CPad::GetPad(1)->GetRightShoulder1());
+
+
+ CPad::GetPad(0)->OldState.LeftStickX = lX;
+ CPad::GetPad(0)->OldState.LeftStickY = lY;
+ CPad::GetPad(0)->OldState.RightStickX = rX;
+ CPad::GetPad(0)->OldState.RightStickY = rY;
+ CPad::GetPad(0)->OldState.LeftShoulder1 = L1;
+ CPad::GetPad(0)->OldState.LeftShoulder2 = L2;
+ CPad::GetPad(0)->OldState.RightShoulder1 = R1;
+ CPad::GetPad(0)->OldState.RightShoulder2 = R2;
+ CPad::GetPad(0)->OldState.DPadUp = up;
+ CPad::GetPad(0)->OldState.DPadDown = down;
+ CPad::GetPad(0)->OldState.DPadLeft = left;
+ CPad::GetPad(0)->OldState.DPadRight = right;
+ CPad::GetPad(0)->OldState.Start = start;
+ CPad::GetPad(0)->OldState.Select = select;
+ CPad::GetPad(0)->OldState.Square = square;
+ CPad::GetPad(0)->OldState.Triangle = triangle;
+ CPad::GetPad(0)->OldState.Cross = cross;
+ CPad::GetPad(0)->OldState.Circle = circle;
+ CPad::GetPad(0)->OldState.LeftShock = L3;
+ CPad::GetPad(0)->OldState.RightShock = R3;
+ CPad::GetPad(0)->OldState.NetworkTalk = networktalk;
+ CPad::GetPad(0)->NewState.LeftStickX = lX;
+ CPad::GetPad(0)->NewState.LeftStickY = lY;
+ CPad::GetPad(0)->NewState.RightStickX = rX;
+ CPad::GetPad(0)->NewState.RightStickY = rY;
+ CPad::GetPad(0)->NewState.LeftShoulder1 = L1;
+ CPad::GetPad(0)->NewState.LeftShoulder2 = L2;
+ CPad::GetPad(0)->NewState.RightShoulder1 = R1;
+ CPad::GetPad(0)->NewState.RightShoulder2 = R2;
+ CPad::GetPad(0)->NewState.DPadUp = up;
+ CPad::GetPad(0)->NewState.DPadDown = down;
+ CPad::GetPad(0)->NewState.DPadLeft = left;
+ CPad::GetPad(0)->NewState.DPadRight = right;
+ CPad::GetPad(0)->NewState.Start = start;
+ CPad::GetPad(0)->NewState.Select = select;
+ CPad::GetPad(0)->NewState.Square = square;
+ CPad::GetPad(0)->NewState.Triangle = triangle;
+ CPad::GetPad(0)->NewState.Cross = cross;
+ CPad::GetPad(0)->NewState.Circle = circle;
+ CPad::GetPad(0)->NewState.LeftShock = L3;
+ CPad::GetPad(0)->NewState.RightShock = R3;
+ CPad::GetPad(0)->NewState.NetworkTalk = networktalk;
}
-char*
-GetRandomSplashScreen(void)
-{
- int index;
- static int index2 = 0;
- static char splashName[128];
- static int splashIndex[24] = {
- 25, 22, 4, 13,
- 1, 21, 14, 16,
- 10, 12, 5, 9,
- 11, 18, 3, 2,
- 19, 23, 7, 17,
- 15, 6, 8, 20
- };
- index = splashIndex[4*index2 + CGeneral::GetRandomNumberInRange(0, 3)];
- index2++;
- if(index2 == 6)
- index2 = 0;
- sprintf(splashName, "loadsc%d", index);
- return splashName;
-}
+float FramesPerSecondCounter;
+int32 FrameSamples;
-#include "rwcore.h"
-#include "rpworld.h"
-#include "rpmatfx.h"
-#include "rpskin.h"
-#include "rphanim.h"
-#include "rtbmp.h"
+struct tZonePrint
+{
+ char name[12];
+ CRect rect;
+};
-_TODO("temp, move this includes out of here")
+tZonePrint ZonePrint[] =
+{
+ { "suburban", CRect(-1639.4f, 1014.3f, -226.23f, -1347.9f) },
+ { "comntop", CRect(-223.52f, 203.62f, 616.79f, -413.6f) },
+ { "comnbtm", CRect(-227.24f, -413.6f, 620.51f, -911.84f) },
+ { "comse", CRect( 200.35f, -911.84f, 620.51f, -1737.3f) },
+ { "comsw", CRect(-223.52f, -911.84f, 200.35f, -1737.3f) },
+ { "industsw", CRect( 744.05f, -473.0f, 1067.5f, -1331.5f) },
+ { "industne", CRect( 1067.5f, 282.19f, 1915.3f, -473.0f) },
+ { "industnw", CRect( 744.05f, 324.95f, 1067.5f, -473.0f) },
+ { "industse", CRect( 1070.3f, -473.0f, 1918.1f, -1331.5f) },
+ { "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) }
+};
-static RwBool
-PluginAttach(void)
+#ifndef MASTER
+void
+DisplayGameDebugText()
{
- if( !RpWorldPluginAttach() )
+ static bool bDisplayPosn = false;
+ static bool bDisplayRate = false;
+
{
- printf("Couldn't attach world plugin\n");
-
- return FALSE;
+ SETTWEAKPATH("GameDebugText");
+ TWEAKBOOL(bDisplayPosn);
+ TWEAKBOOL(bDisplayRate);
}
+
+
+ char str[200];
+ wchar ustr[200];
+ wchar ver[200];
- if( !RpSkinPluginAttach() )
- {
- printf("Couldn't attach RpSkin plugin\n");
-
- return FALSE;
- }
+ AsciiToUnicode(version_name, ver);
+
+ CFont::SetPropOn();
+ CFont::SetBackgroundOff();
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetScale(SCREEN_STRETCH_X(0.5f), SCREEN_STRETCH_Y(0.5f));
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyOff();
+ CFont::SetWrapx(SCREEN_WIDTH);
+ CFont::SetJustifyOff();
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetColor(CRGBA(255, 108, 0, 255));
+ CFont::PrintString(10.0f, 10.0f, ver);
+
+ FrameSamples++;
+ FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
+ FramesPerSecond = FramesPerSecondCounter / FrameSamples;
- if( !RpHAnimPluginAttach() )
+ if ( FrameSamples > 30 )
{
- printf("Couldn't attach RpHAnim plugin\n");
-
- return FALSE;
+ FramesPerSecondCounter = 0.0f;
+ FrameSamples = 0;
}
-
- if( !NodeNamePluginAttach() )
+
+ if ( !TheCamera.WorldViewerBeingUsed
+ && CPad::GetPad(1)->GetSquare()
+ && CPad::GetPad(1)->GetTriangle()
+ && CPad::GetPad(1)->GetLeftShoulder2JustDown() )
{
- printf("Couldn't attach node name plugin\n");
-
- return FALSE;
+ bDisplayPosn = !bDisplayPosn;
}
-
- if( !CVisibilityPlugins::PluginAttach() )
+
+ if ( CPad::GetPad(1)->GetSquare()
+ && CPad::GetPad(1)->GetTriangle()
+ && CPad::GetPad(1)->GetRightShoulder2JustDown() )
{
- printf("Couldn't attach visibility plugins\n");
-
- return FALSE;
+ bDisplayRate = !bDisplayRate;
}
- if( !RpAnimBlendPluginAttach() )
+ if ( bDisplayPosn || bDisplayRate )
{
- printf("Couldn't attach RpAnimBlend plugin\n");
+ CVector pos = FindPlayerCoors();
+ int32 ZoneId = ARRAY_SIZE(ZonePrint)-1; // no zone
- return FALSE;
- }
-
- if( !RpMatFXPluginAttach() )
- {
- printf("Couldn't attach RpMatFX plugin\n");
+ for ( int32 i = 0; i < ARRAY_SIZE(ZonePrint)-1; i++ )
+ {
+ if ( pos.x > ZonePrint[i].rect.left
+ && pos.x < ZonePrint[i].rect.right
+ && pos.y > ZonePrint[i].rect.bottom
+ && pos.y < ZonePrint[i].rect.top )
+ {
+ ZoneId = i;
+ }
+ }
+
+ //NOTE: fps should be 30, but its 29 due to different fp2int conversion
+ if ( bDisplayRate )
+ sprintf(str, "X:%5.1f, Y:%5.1f, Z:%5.1f, F-%d, %s", pos.x, pos.y, pos.z, (int32)FramesPerSecond, ZonePrint[ZoneId].name);
+ else
+ sprintf(str, "X:%5.1f, Y:%5.1f, Z:%5.1f, %s", pos.x, pos.y, pos.z, ZonePrint[ZoneId].name);
- return FALSE;
+ AsciiToUnicode(str, ustr);
+
+ CFont::SetPropOff();
+ CFont::SetBackgroundOff();
+ CFont::SetScale(0.7f, 1.5f);
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyOff();
+ CFont::SetJustifyOff();
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetWrapx(640.0f);
+ CFont::SetFontStyle(FONT_HEADING);
+
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(42.0f, 42.0f, ustr);
+
+ CFont::SetColor(CRGBA(255, 108, 0, 255));
+ CFont::PrintString(40.0f, 40.0f, ustr);
}
+}
+#endif
- return TRUE;
+void
+RenderScene(void)
+{
+ CClouds::Render();
+ DoRWRenderHorizon();
+ CRenderer::RenderRoads();
+ CCoronas::RenderReflections();
+ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
+ CRenderer::RenderEverythingBarRoads();
+ CRenderer::RenderBoats();
+ DefinedState();
+ CWaterLevel::RenderWater();
+ CRenderer::RenderFadingInEntities();
+ CRenderer::RenderVehiclesButNotBoats();
+ CWeather::RenderRainStreaks();
}
-static RwBool
-Initialise3D(void *param)
+void
+RenderDebugShit(void)
{
- if (RsRwInitialise(param))
- {
- //
- DebugMenuInit();
- DebugMenuPopulate();
- //
+ CTheScripts::RenderTheScriptDebugLines();
+#ifndef FINAL
+ if(gbShowCollisionLines)
+ CRenderer::RenderCollisionLines();
+ ThePaths.DisplayPathData();
+#endif
+}
- return CGame::InitialiseRenderWare();
+void
+RenderEffects(void)
+{
+ CGlass::Render();
+ CWaterCannons::Render();
+ CSpecialFX::Render();
+ CShadows::RenderStaticShadows();
+ CShadows::RenderStoredShadows();
+ CSkidmarks::Render();
+ CAntennas::Render();
+ CRubbish::Render();
+ CCoronas::Render();
+ CParticle::Render();
+ CPacManPickups::Render();
+ CWeaponEffects::Render();
+ CPointLights::RenderFogEffect();
+ CMovingThings::Render();
+ CRenderer::RenderFirstPersonVehicle();
+}
+
+void
+Render2dStuff(void)
+{
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
+
+ CReplay::Display();
+ CPickups::RenderPickUpText();
+
+ if(TheCamera.m_WideScreenOn)
+ TheCamera.DrawBordersForWideScreen();
+
+ CPed *player = FindPlayerPed();
+ int weaponType = 0;
+ if(player)
+ weaponType = player->GetWeapon()->m_eWeaponType;
+
+ bool firstPersonWeapon = false;
+ int cammode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
+ if(cammode == CCam::MODE_SNIPER ||
+ cammode == CCam::MODE_SNIPER_RUNABOUT ||
+ cammode == CCam::MODE_ROCKETLAUNCHER ||
+ cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT)
+ firstPersonWeapon = true;
+
+ // Draw black border for sniper and rocket launcher
+ if((weaponType == WEAPONTYPE_SNIPERRIFLE || weaponType == WEAPONTYPE_ROCKETLAUNCHER) && firstPersonWeapon){
+ CRGBA black(0, 0, 0, 255);
+
+ // top and bottom strips
+ if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) {
+ CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(180)), black);
+ CSprite2d::DrawRect(CRect(0.0f, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(170), SCREEN_WIDTH, SCREEN_HEIGHT), black);
+ }
+ else {
+ CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(210)), black);
+ CSprite2d::DrawRect(CRect(0.0f, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(210), SCREEN_WIDTH, SCREEN_HEIGHT), black);
+ }
+ CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH / 2 - SCREEN_SCALE_X(210), SCREEN_HEIGHT), black);
+ CSprite2d::DrawRect(CRect(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(210), 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), black);
}
- return (FALSE);
+ MusicManager.DisplayRadioStationName();
+ TheConsole.Display();
+/*
+ if(CSceneEdit::m_bEditOn)
+ CSceneEdit::Draw();
+ else
+*/
+ CHud::Draw();
+ CUserDisplay::OnscnTimer.ProcessForDisplay();
+ CMessages::Display();
+ CDarkel::DrawMessages();
+ CGarages::PrintMessages();
+ CPad::PrintErrorMessage();
+ CFont::DrawFonts();
+
+ DebugMenuRender();
}
+void
+RenderMenus(void)
+{
+#ifdef PS2
+ if (FrontEndMenuManager.m_bWantToDraw)
+ {
+ gMainHeap.PushMemId(_TODOCONST(17));
+ FrontEndMenuManager.DrawFrontEnd();
+ gMainHeap.PopMemId();
+ }
+#else
+ if(FrontEndMenuManager.m_bMenuActive)
+ FrontEndMenuManager.DrawFrontEnd();
+#endif
+}
-static void
-Terminate3D(void)
+void
+Render2dStuffAfterFade(void)
{
- CGame::ShutdownRenderWare();
+#ifndef MASTER
+ DisplayGameDebugText();
+#endif
+
+ CHud::DrawAfterFade();
+ CFont::DrawFonts();
+}
+
+void
+Idle(void *arg)
+{
+#ifdef ASPECT_RATIO_SCALE
+ CDraw::SetAspectRatio(CDraw::FindAspectRatio());
+#endif
+
+ CTimer::Update();
+
+#ifdef TIMEBARS
+ tbInit();
+#endif
+
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+
+ // We're basically merging FrontendIdle and Idle (just like TheGame on PS2)
+#ifdef PS2_SAVE_DIALOG
+ // Only exists on PC FrontendIdle, probably some PS2 bug fix
+ if (FrontEndMenuManager.m_bMenuActive)
+ CSprite2d::SetRecipNearClip();
- RsRwTerminate();
+ if (FrontEndMenuManager.m_bGameNotLoaded) {
+ CPad::UpdatePads();
+ FrontEndMenuManager.Process();
+ } else {
+ CPointLights::InitPerFrame();
+#ifdef TIMEBARS
+ tbStartTimer(0, "CGame::Process");
+#endif
+ CGame::Process();
+#ifdef TIMEBARS
+ tbEndTimer("CGame::Process");
+ tbStartTimer(0, "DMAudio.Service");
+#endif
+ DMAudio.Service();
- return;
+#ifdef TIMEBARS
+ tbEndTimer("DMAudio.Service");
+#endif
+ }
+
+ if (RsGlobal.quit)
+ return;
+#else
+ CPointLights::InitPerFrame();
+#ifdef TIMEBARS
+ tbStartTimer(0, "CGame::Process");
+#endif
+ CGame::Process();
+#ifdef TIMEBARS
+ tbEndTimer("CGame::Process");
+ tbStartTimer(0, "DMAudio.Service");
+#endif
+
+ DMAudio.Service();
+
+#ifdef TIMEBARS
+ tbEndTimer("DMAudio.Service");
+#endif
+#endif
+
+ if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
+ FrontEndMenuManager.m_bWantToRestart = true;
+ FrontEndMenuManager.m_bWantToLoad = false;
+ return;
+ }
+
+ if(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
+ return;
+
+ SetLightsWithTimeOfDayColour(Scene.world);
+
+ if(arg == nil)
+ return;
+
+ if((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu) &&
+ TheCamera.GetScreenFadeStatus() != FADE_2)
+ {
+#ifdef GTA_PC
+ if (!FrontEndMenuManager.m_bRenderGameInMenu) {
+ // This is from SA, but it's nice for windowed mode
+ RwV2d pos;
+ pos.x = SCREEN_WIDTH / 2.0f;
+ pos.y = SCREEN_HEIGHT / 2.0f;
+ RsMouseSetPos(&pos);
+ }
+#endif
+#ifdef TIMEBARS
+ tbStartTimer(0, "CnstrRenderList");
+#endif
+ CRenderer::ConstructRenderList();
+#ifdef TIMEBARS
+ tbEndTimer("CnstrRenderList");
+ tbStartTimer(0, "PreRender");
+#endif
+ CRenderer::PreRender();
+#ifdef TIMEBARS
+ tbEndTimer("PreRender");
+#endif
+
+ if(CWeather::LightningFlash && !CCullZones::CamNoRain()){
+ if(!DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255))
+ return;
+ }else{
+ if(!DoRWStuffStartOfFrame_Horizon(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
+ CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
+ 255))
+ return;
+ }
+
+ DefinedState();
+
+ // BUG. This has to be done BEFORE RwCameraBeginUpdate
+ RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
+ RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
+
+#ifdef TIMEBARS
+ tbStartTimer(0, "RenderScene");
+#endif
+ RenderScene();
+#ifdef TIMEBARS
+ tbEndTimer("RenderScene");
+#endif
+ RenderDebugShit();
+ RenderEffects();
+
+#ifdef TIMEBARS
+ tbStartTimer(0, "RenderMotionBlur");
+#endif
+ if((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) &&
+ TheCamera.m_ScreenReductionPercentage > 0.0f)
+ TheCamera.SetMotionBlurAlpha(150);
+ TheCamera.RenderMotionBlur();
+#ifdef TIMEBARS
+ tbEndTimer("RenderMotionBlur");
+ tbStartTimer(0, "Render2dStuff");
+#endif
+ Render2dStuff();
+#ifdef TIMEBARS
+ tbEndTimer("Render2dStuff");
+#endif
+ }else{
+#ifdef ASPECT_RATIO_SCALE
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+#else
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
+#endif
+ CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
+ RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
+ if(!RsCameraBeginUpdate(Scene.camera))
+ return;
+ }
+
+#ifdef PS2_SAVE_DIALOG
+ if (FrontEndMenuManager.m_bMenuActive)
+ DefinedState();
+#endif
+#ifdef TIMEBARS
+ tbStartTimer(0, "RenderMenus");
+#endif
+ RenderMenus();
+#ifdef TIMEBARS
+ tbEndTimer("RenderMenus");
+ tbStartTimer(0, "DoFade");
+#endif
+ DoFade();
+#ifdef TIMEBARS
+ tbEndTimer("DoFade");
+ tbStartTimer(0, "Render2dStuff-Fade");
+#endif
+ Render2dStuffAfterFade();
+#ifdef TIMEBARS
+ tbEndTimer("Render2dStuff-Fade");
+#endif
+ CCredits::Render();
+
+#ifdef TIMEBARS
+ tbDisplay();
+#endif
+
+ DoRWStuffEndOfFrame();
+
+ if(g_SlowMode)
+ ProcessSlowMode();
+}
+
+void
+FrontendIdle(void)
+{
+#ifdef ASPECT_RATIO_SCALE
+ CDraw::SetAspectRatio(CDraw::FindAspectRatio());
+#endif
+
+ CTimer::Update();
+ CSprite2d::SetRecipNearClip(); // this should be on InitialiseRenderWare according to PS2 asm. seems like a bug fix
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+ CPad::UpdatePads();
+ FrontEndMenuManager.Process();
+
+ if(RsGlobal.quit)
+ return;
+
+#ifdef ASPECT_RATIO_SCALE
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+#else
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
+#endif
+ CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
+ RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
+ if(!RsCameraBeginUpdate(Scene.camera))
+ return;
+
+ DefinedState(); // seems redundant, but breaks resolution change.
+ RenderMenus();
+ DoFade();
+ Render2dStuffAfterFade();
+// CFont::DrawFonts(); // redundant
+ DoRWStuffEndOfFrame();
+}
+
+void
+InitialiseGame(void)
+{
+ LoadingScreen(nil, nil, "loadsc0");
+ CGame::Initialise("DATA\\GTA3.DAT");
}
RsEventStatus
@@ -1056,7 +1150,7 @@ AppEventHandler(RsEvent event, void *param)
{
CameraSize(Scene.camera, (RwRect *)param,
- DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
+ SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
return rsEVENTPROCESSED;
}
@@ -1133,58 +1227,615 @@ AppEventHandler(RsEvent event, void *param)
}
}
-void PrintGameVersion()
+#ifndef MASTER
+void
+TheModelViewer(void)
{
- CFont::SetPropOn();
- CFont::SetBackgroundOff();
- CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.5f));
- CFont::SetCentreOff();
- CFont::SetRightJustifyOff();
- CFont::SetBackGroundOnlyTextOff();
- CFont::SetFontStyle(FONT_BANK);
- CFont::SetWrapx(SCREEN_WIDTH);
- CFont::SetDropShadowPosition(0);
- CFont::SetDropColor(CRGBA(0, 0, 0, 255));
- CFont::SetColor(CRGBA(235, 170, 50, 255));
+#if (defined(GTA_PS2) || defined(GTA_XBOX))
+ //TODO
+#else
+#ifdef ASPECT_RATIO_SCALE
+ CDraw::SetAspectRatio(CDraw::FindAspectRatio());
+#endif
+ CAnimViewer::Update();
+ CTimer::Update();
+ SetLightsWithTimeOfDayColour(Scene.world);
+ CRenderer::ConstructRenderList();
+ DoRWStuffStartOfFrame(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
+ CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
+ 255);
- strcpy(gString, "RE3");
- AsciiToUnicode(gString, gUString);
- CFont::PrintString(SCREEN_SCALE_X(10.5f), SCREEN_SCALE_Y(8.0f), gUString);
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+ DefinedState();
+ CVisibilityPlugins::InitAlphaEntityList();
+ CAnimViewer::Render();
+ Render2dStuff();
+ DoRWStuffEndOfFrame();
+#endif
}
+#endif
-void
-ValidateVersion()
+void TheGame(void)
{
- int32 file = CFileMgr::OpenFile("models\\coll\\peds.col", "rb");
- char buff[128];
+ printf("Into TheGame!!!\n");
- if ( file != -1 )
+#ifdef GTA_PS2
+ gMainHeap.PushMemId(_TODOCONST(1));
+#endif
+
+ CTimer::Initialise();
+
+#ifdef GTA_PS2
+ CGame::Initialise();
+#else
+ CGame::Initialise("DATA\\GTA3.DAT");
+#endif
+
+ char *splash = GetRandomSplashScreen(); // inlined here
+
+ LoadingScreen("Starting Game", NULL, splash);
+
+#ifdef GTA_PS2
+ if ( TheMemoryCard.CheckCardInserted(_TODOCONST(0)) == _TODOCONST(26)
+ && TheMemoryCard.ChangeDirectory(_TODOCONST(0), TheMemoryCard.field154)
+ && TheMemoryCard.FindMostRecentFileName(_TODOCONST(0), TheMemoryCard.field37) == 1
+ && TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.field37))
{
- CFileMgr::Seek(file, 100, SEEK_SET);
-
- for ( int i = 0; i < 128; i++ )
+ strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.field37);
+ TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
+
+ if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
{
- CFileMgr::Read(file, &buff[i], sizeof(char));
- buff[i] -= 23;
- if ( buff[i] == '\0' )
+ CMenuManager::m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
+ TheText.Unload();
+ TheText.Load();
+ }
+
+ CGame::currLevel = TheMemoryCard.GetLevelToLoad();
+ }
+#else
+ //TODO
+#endif
+
+ while (true)
+ {
+#ifdef PS2
+ if (TheMemoryCard.m_bWantToLoad)
+#else
+ if (FrontEndMenuManager.m_bWantToLoad)
+#endif
+ {
+ char *splash1 = GetLevelSplashScreen(CGame::currLevel);
+ LoadSplash(splash1);
+ }
+
+#ifdef PS2
+ TheMemoryCard.m_bWantToLoad = false;
+#else
+ FrontEndMenuManager.m_bWantToLoad = false;
+#endif
+
+ CTimer::Update();
+
+#ifdef PS2
+ while (!(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad))
+#else
+ while (!(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad))
+#endif
+ {
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+
+#ifdef GTA_PS2
+ gMainHeap.PushMemId(_TODOCONST(12));
+#endif
+ CPointLights::NumLights = 0;
+ CGame::Process();
+#ifdef GTA_PS2
+ gMainHeap.PopMemId();
+#endif
+
+ DMAudio.Service();
+
+ if (CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing())
+ {
+#ifdef PS2
+ TheMemoryCard.m_bWantToLoad = false;
+#else
+ FrontEndMenuManager.m_bWantToLoad = false;
+#endif
+ FrontEndMenuManager.m_bWantToRestart = true;
break;
- CFileMgr::Seek(file, 99, SEEK_CUR);
+ }
+
+#ifdef PS2
+ if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
+#else
+ if (FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
+#endif
+ break;
+
+ SetLightsWithTimeOfDayColour(Scene.world);
+#ifdef GTA_PS2
+ gMainHeap.PushMemId(_TODOCONST(15));
+#endif
+
+ if (!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu == true && TheCamera.GetScreenFadeStatus() != FADE_2 )
+ {
+#ifdef GTA_PS2
+ gMainHeap.PushMemId(_TODOCONST(11));
+#endif
+ CRenderer::ConstructRenderList();
+ CRenderer::PreRender();
+#ifdef GTA_PS2
+ gMainHeap.PopMemId();
+#endif
+
+ if (CWeather::LightningFlash && !CCullZones::CamNoRain())
+ DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255);
+ else
+ DoRWStuffStartOfFrame_Horizon(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(), CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255);
+
+ DefinedState();
+ RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
+ RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
+
+ RenderScene();
+ RenderDebugShit();
+ RenderEffects();
+
+ if ((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) && TheCamera.m_ScreenReductionPercentage > 0.0f)
+ TheCamera.SetMotionBlurAlpha(150);
+ TheCamera.RenderMotionBlur();
+
+ Render2dStuff();
+ }
+ else
+ {
+ CameraSize(Scene.camera, NULL, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+ CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
+ RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
+ if (!RsCameraBeginUpdate(Scene.camera))
+ break;
+ }
+
+ RenderMenus();
+
+#ifdef PS2
+ if (TheMemoryCard.m_bWantToLoad)
+#else
+ if (FrontEndMenuManager.m_bWantToLoad)
+#endif
+ {
+#ifdef GTA_PS2
+ gMainHeap.PopMemId();
+#endif
+ break;
+ }
+
+ DoFade();
+ Render2dStuffAfterFade();
+ CCredits::Render();
+
+ DoRWStuffEndOfFrame();
+
+ while (frameCount < 2)
+ ;
+
+ frameCount = 0;
+
+ CTimer::Update();
+
+#ifdef GTA_PS2
+ gMainHeap.PopMemId();
+#endif
+
+ if (g_SlowMode)
+ ProcessSlowMode();
}
-
- if ( !strncmp(buff, "grandtheftauto3", 15) )
+
+ CPad::ResetCheats();
+ CPad::StopPadsShaking();
+ DMAudio.ChangeMusicMode(MUSICMODE_DISABLE);
+ CGame::ShutDownForRestart();
+ CTimer::Stop();
+
+#ifdef PS2
+ if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
+#else
+ if (FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
+#endif
{
- strncpy(version_name, &buff[15], 64);
- CFileMgr::CloseFile(file);
- return;
+#ifdef PS2
+ if (TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
+#else
+ if (b_FoundRecentSavedGameWantToLoad)
+#endif
+ {
+ FrontEndMenuManager.m_bWantToRestart = true;
+#ifdef PS2
+ TheMemoryCard.m_bWantToLoad = true;
+#else
+ FrontEndMenuManager.m_bWantToLoad = true;
+#endif
+ }
+
+ CGame::InitialiseWhenRestarting();
+ DMAudio.ChangeMusicMode(MUSICMODE_GAME);
+ FrontEndMenuManager.m_bWantToRestart = false;
+
+ continue;
}
+
+ break;
}
- LoadingScreen("Invalid version", NULL, NULL);
+ DMAudio.Terminate();
+}
+
+
+void SystemInit()
+{
+#ifdef __MWERKS__
+ mwInit();
+#endif
- while(true)
- {
+#ifdef GTA_PS2
+ InitMemoryMgr();
+#endif
+
+#ifdef GTA_PS2
+ CFileMgr::InitCdSystem();
+
+ char path[256];
+
+ sprintf(path, "cdrom0:\\%s%s;1", "SYSTEM\\", "IOPRP23.IMG");
+
+ sceSifInitRpc(0);
+
+ while ( !sceSifRebootIop(path) )
;
+ while( !sceSifSyncIop() )
+ ;
+
+ sceSifInitRpc(0);
+
+ CFileMgr::InitCdSystem();
+
+ sceFsReset();
+#endif
+
+ CFileMgr::Initialise();
+
+#ifdef GTA_PS2
+ CFileMgr::InitCd();
+
+ Char modulepath[256];
+
+ strcpy(modulepath, "cdrom0:\\");
+ strcat(modulepath, "SYSTEM\\");
+ strcat(modulepath, "SIO2MAN.IRX");
+ LoadModule(modulepath);
+
+ strcpy(modulepath, "cdrom0:\\");
+ strcat(modulepath, "SYSTEM\\");
+ strcat(modulepath, "PADMAN.IRX");
+ LoadModule(modulepath);
+
+ strcpy(modulepath, "cdrom0:\\");
+ strcat(modulepath, "SYSTEM\\");
+ strcat(modulepath, "LIBSD.IRX");
+ LoadModule(modulepath);
+
+ strcpy(modulepath, "cdrom0:\\");
+ strcat(modulepath, "SYSTEM\\");
+ strcat(modulepath, "SDRDRV.IRX");
+ LoadModule(modulepath);
+
+ strcpy(modulepath, "cdrom0:\\");
+ strcat(modulepath, "SYSTEM\\");
+ strcat(modulepath, "MCMAN.IRX");
+ LoadModule(modulepath);
+
+ strcpy(modulepath, "cdrom0:\\");
+ strcat(modulepath, "SYSTEM\\");
+ strcat(modulepath, "MCSERV.IRX");
+ LoadModule(modulepath);
+#endif
+
+
+#ifdef GTA_PS2
+ ThreadParam param;
+
+ param.entry = &IdleThread;
+ param.stack = idleThreadStack;
+ param.stackSize = 2048;
+ param.initPriority = 127;
+ param.gpReg = &_gp;
+
+ int thread = CreateThread(&param);
+ StartThread(thread, NULL);
+#else
+ //
+#endif
+
+
+ CPad::Initialise();
+ CPad::GetPad(0)->Mode = 0;
+
+ CGame::frenchGame = false;
+ CGame::germanGame = false;
+ CGame::nastyGame = true;
+ CMenuManager::m_PrefsAllowNastyGame = true;
+
+#ifdef GTA_PS2
+ int32 lang = sceScfGetLanguage();
+ if ( lang == SCE_ITALIAN_LANGUAGE )
+ CMenuManager::m_PrefsLanguage = LANGUAGE_ITALIAN;
+ else if ( lang == SCE_SPANISH_LANGUAGE )
+ CMenuManager::m_PrefsLanguage = LANGUAGE_SPANISH;
+ else if ( lang == SCE_GERMAN_LANGUAGE )
+ {
+ CGame::germanGame = true;
+ CGame::nastyGame = false;
+ CMenuManager::m_PrefsAllowNastyGame = false;
+ CMenuManager::m_PrefsLanguage = LANGUAGE_GERMAN;
}
+ else if ( lang == SCE_FRENCH_LANGUAGE )
+ {
+ CGame::frenchGame = true;
+ CGame::nastyGame = false;
+ CMenuManager::m_PrefsAllowNastyGame = false;
+ CMenuManager::m_PrefsLanguage = LANGUAGE_FRENCH;
+ }
+ else
+ CMenuManager::m_PrefsLanguage = LANGUAGE_AMERICAN;
+
+ FrontEndMenuManager.InitialiseMenuContentsAfterLoadingGame();
+#else
+ //
+#endif
+
+#ifdef PS2
+ TheMemoryCard.Init();
+#endif
+}
+
+void GameInit()
+{
+ if ( !gameAlreadyInitialised )
+ {
+#ifdef GTA_PS2
+ char path[256];
+
+ strcpy(path, "cdrom0:\\");
+ strcat(path, "SYSTEM\\");
+ strcat(path, "CDSTREAM.IRX");
+ LoadModule(path);
+
+ strcpy(path, "cdrom0:\\");
+ strcat(path, "SYSTEM\\");
+ strcat(path, "SAMPMAN.IRX");
+ LoadModule(path);
+
+ strcpy(path, "cdrom0:\\");
+ strcat(path, "SYSTEM\\");
+ strcat(path, "MUSICSTR.IRX");
+ LoadModule(path);
+#endif
+ CdStreamInit(MAX_CDCHANNELS);
+
+#ifdef PS2
+ Initialise3D(); //no params
+#else
+ //TODO
+#endif
+
+#ifdef GTA_PS2
+ char *files[] =
+ {
+ "\\ANIM\\CUTS.IMG;1",
+ "\\ANIM\\CUTS.DIR;1",
+ "\\ANIM\\PED.IFP;1",
+ "\\MODELS\\FRONTEND.TXD;1",
+ "\\MODELS\\FONTS.TXD;1",
+ "\\MODELS\\HUD.TXD;1",
+ "\\MODELS\\PARTICLE.TXD;1",
+ "\\MODELS\\MISC.TXD;1",
+ "\\MODELS\\GENERIC.TXD;1",
+ "\\MODELS\\GTA3.DIR;1",
+ "\\TEXT\\ENGLISH.GXT;1",
+ "\\TEXT\\FRENCH.GXT;1",
+ "\\TEXT\\GERMAN.GXT;1",
+ "\\TEXT\\ITALIAN.GXT;1",
+ "\\TEXT\\SPANISH.GXT;1",
+ "\\TXD\\LOADSC0.TXD;1",
+ "\\TXD\\LOADSC1.TXD;1",
+ "\\TXD\\LOADSC2.TXD;1",
+ "\\TXD\\LOADSC3.TXD;1",
+ "\\TXD\\LOADSC4.TXD;1",
+ "\\TXD\\LOADSC5.TXD;1",
+ "\\TXD\\LOADSC6.TXD;1",
+ "\\TXD\\LOADSC7.TXD;1",
+ "\\TXD\\LOADSC8.TXD;1",
+ "\\TXD\\LOADSC9.TXD;1",
+ "\\TXD\\LOADSC10.TXD;1",
+ "\\TXD\\LOADSC11.TXD;1",
+ "\\TXD\\LOADSC12.TXD;1",
+ "\\TXD\\LOADSC13.TXD;1",
+ "\\TXD\\LOADSC14.TXD;1",
+ "\\TXD\\LOADSC15.TXD;1",
+ "\\TXD\\LOADSC16.TXD;1",
+ "\\TXD\\LOADSC17.TXD;1",
+ "\\TXD\\LOADSC18.TXD;1",
+ "\\TXD\\LOADSC19.TXD;1",
+ "\\TXD\\LOADSC20.TXD;1",
+ "\\TXD\\LOADSC21.TXD;1",
+ "\\TXD\\LOADSC22.TXD;1",
+ "\\TXD\\LOADSC23.TXD;1",
+ "\\TXD\\LOADSC24.TXD;1",
+ "\\TXD\\LOADSC25.TXD;1",
+ "\\TXD\\NEWS.TXD;1",
+ "\\MODELS\\COLL\\GENERIC.COL;1",
+ "\\MODELS\\COLL\\INDUST.COL;1",
+ "\\MODELS\\COLL\\COMMER.COL;1",
+ "\\MODELS\\COLL\\SUBURB.COL;1",
+ "\\MODELS\\COLL\\WEAPONS.COL;1",
+ "\\MODELS\\COLL\\VEHICLES.COL;1",
+ "\\MODELS\\COLL\\PEDS.COL;1",
+ "\\MODELS\\GENERIC\\AIR_VLO.DFF;1",
+ "\\MODELS\\GENERIC\\WEAPONS.DFF;1",
+ "\\MODELS\\GENERIC\\WHEELS.DFF;1",
+ "\\MODELS\\GENERIC\\LOPLYGUY.DFF;1",
+ "\\MODELS\\GENERIC\\ARROW.DFF;1",
+ "\\MODELS\\GENERIC\\ZONECYLB.DFF;1",
+ "\\DATA\\MAPS\\COMNTOP.IPL;1",
+ "\\DATA\\MAPS\\COMNBTM.IPL;1",
+ "\\DATA\\MAPS\\COMSE.IPL;1",
+ "\\DATA\\MAPS\\COMSW.IPL;1",
+ "\\DATA\\MAPS\\CULL.IPL;1",
+ "\\DATA\\MAPS\\INDUSTNE.IPL;1",
+ "\\DATA\\MAPS\\INDUSTNW.IPL;1",
+ "\\DATA\\MAPS\\INDUSTSE.IPL;1",
+ "\\DATA\\MAPS\\INDUSTSW.IPL;1",
+ "\\DATA\\MAPS\\SUBURBNE.IPL;1",
+ "\\DATA\\MAPS\\SUBURBSW.IPL;1",
+ "\\DATA\\MAPS\\OVERVIEW.IPL;1",
+ "\\DATA\\MAPS\\PROPS.IPL;1",
+ "\\DATA\\MAPS\\GTA3.IDE;1",
+ "\\DATA\\PATHS\\FLIGHT.DAT;1",
+ "\\DATA\\PATHS\\FLIGHT2.DAT;1",
+ "\\DATA\\PATHS\\FLIGHT3.DAT;1",
+ "\\DATA\\PATHS\\FLIGHT4.DAT;1",
+ "\\DATA\\PATHS\\TRACKS.DAT;1",
+ "\\DATA\\PATHS\\TRACKS2.DAT;1",
+ "\\DATA\\PATHS\\CHASE0.DAT;1",
+ "\\DATA\\PATHS\\CHASE1.DAT;1",
+ "\\DATA\\PATHS\\CHASE2.DAT;1",
+ "\\DATA\\PATHS\\CHASE3.DAT;1",
+ "\\DATA\\PATHS\\CHASE4.DAT;1",
+ "\\DATA\\PATHS\\CHASE5.DAT;1",
+ "\\DATA\\PATHS\\CHASE6.DAT;1",
+ "\\DATA\\PATHS\\CHASE7.DAT;1",
+ "\\DATA\\PATHS\\CHASE10.DAT;1",
+ "\\DATA\\PATHS\\CHASE11.DAT;1",
+ "\\DATA\\PATHS\\CHASE14.DAT;1",
+ "\\DATA\\PATHS\\CHASE16.DAT;1",
+ "\\DATA\\PATHS\\CHASE18.DAT;1",
+ "\\DATA\\PATHS\\CHASE19.DAT;1"
+ };
+
+ for ( int32 i = 0; i < ARRAY_SIZE(files); i++ )
+ SkyRegisterFileOnCd([i]);
+#endif
+
+ CreateDebugFont();
+
+#ifdef GTA_PS2
+ AddIntcHandler(_TODOCONST(2), VBlankCounter, 0);
+#endif
+
+ CameraSize(Scene.camera, NULL, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
+
+ CSprite2d::SetRecipNearClip();
+ CTxdStore::Initialise();
+#ifdef GTA_PS2
+ gMainHeap.PushMemId(_TODOCONST(9));
+#endif
+ CFont::Initialise();
+ CHud::Initialise();
+#ifdef GTA_PS2
+ gMainHeap.PopMemId();
+#endif
+
+ ValidateVersion();
+
+#ifdef GTA_PS2
+ sceCdCLOCK rtc;
+ sceCdReadClock(&rtc);
+ uint32 seed = rtc.minute + rtc.day;
+ uint32 seed2 = (seed << 4)-seed;
+ uint32 seed3 = (seed2 << 4)-seed2;
+ srand ((seed3<<4)+rtc.second);
+#else
+ //TODO: mysrand();
+#endif
+
+ gameAlreadyInitialised = true;
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+#ifdef __MWERKS__
+ mwInit(); // metrowerks initialisation
+#endif
+
+ SystemInit();
+
+#ifdef PS2
+ int32 state = TheMemoryCard.CheckCardStateAtGameStartUp(_TODOCONST(0));
+
+ if ( state == _TODOCONST(2) || state == _TODOCONST(1) && state != _TODOCONST(3) && state != _TODOCONST(0) )
+ {
+ GameInit();
+
+ TheText.Unload();
+ TheText.Load();
+
+ CFont::Initialise();
+
+ FrontEndMenuManager.DrawMemoryCardStartUpMenus();
+ }
+#endif
+
+#ifdef GTA_PS2
+ {
+ if (gameAlreadyInitialised)
+ RpSkySuspend();
+
+ InitMPEGPlayer();
+
+ PlayMPEG("cdrom0:\\MOVIES\\DMAPAL.PSS;1", false);
+
+ if (CGame::frenchGame || CGame::germanGame)
+ PlayMPEG("cdrom0:\\MOVIES\\INTROPAF.PSS;1", true);
+ else
+ PlayMPEG("cdrom0:\\MOVIES\\INTROPAL.PSS;1", true);
+
+ ShutdownMPEGPlayer();
+
+ if ( gameAlreadyInitialised )
+ RpSkyResume();
+ }
+#else
+ //TODO
+#endif
+
+ GameInit();
+
+ if ( CGame::frenchGame || CGame::germanGame )
+ LoadingScreen(NULL, version_name, "loadsc24");
+ else
+ LoadingScreen(NULL, version_name, "loadsc0");
+
+ DMAudio.Initialise();
+
+ TheGame();
+
+ CGame::ShutDown();
+
+ RwEngineStop();
+ RwEngineClose();
+ RwEngineTerm();
+
+#ifdef __MWERKS__
+ mwExit(); // metrowerks shutdown
+#endif
+
+ return 0;
}
STARTPATCHES
diff --git a/src/core/obrstr.cpp b/src/core/obrstr.cpp
index 3663d134..d9f7e9b4 100644
--- a/src/core/obrstr.cpp
+++ b/src/core/obrstr.cpp
@@ -1,119 +1,119 @@
-#include "common.h"
-#include "Debug.h"
-#include "obrstr.h"
-
-char obrstr[128];
-char obrstr2[128];
-
-void ObrInt(int32 n1)
-{
- IntToStr(n1, obrstr);
- CDebug::DebugAddText(obrstr);
-}
-
-void ObrInt2(int32 n1, int32 n2)
-{
- IntToStr(n1, obrstr);
- strcat(obrstr, " ");
- IntToStr(n2, obrstr2);
- strcat(obrstr, obrstr2);
- CDebug::DebugAddText(obrstr);
-}
-
-void ObrInt3(int32 n1, int32 n2, int32 n3)
-{
- IntToStr(n1, obrstr);
- strcat(obrstr, " ");
- IntToStr(n2, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n3, obrstr2);
- strcat(obrstr, obrstr2);
- CDebug::DebugAddText(obrstr);
-}
-
-void ObrInt4(int32 n1, int32 n2, int32 n3, int32 n4)
-{
- IntToStr(n1, obrstr);
- strcat(obrstr, " ");
- IntToStr(n2, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n3, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n4, obrstr2);
- strcat(obrstr, obrstr2);
- CDebug::DebugAddText(obrstr);
-}
-
-void ObrInt5(int32 n1, int32 n2, int32 n3, int32 n4, int32 n5)
-{
- IntToStr(n1, obrstr);
- strcat(obrstr, " ");
- IntToStr(n2, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n3, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n4, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n5, obrstr2);
- strcat(obrstr, obrstr2);
- CDebug::DebugAddText(obrstr);
-}
-
-void ObrInt6(int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6)
-{
- IntToStr(n1, obrstr);
- strcat(obrstr, " ");
- IntToStr(n2, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n3, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n4, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n5, obrstr2);
- strcat(obrstr, obrstr2);
- strcat(obrstr, " ");
- IntToStr(n6, obrstr2);
- strcat(obrstr, obrstr2);
- CDebug::DebugAddText(obrstr);
-}
-
-void IntToStr(int32 inNum, char *outStr)
-{
- bool isNeg = inNum < 0;
-
- if (isNeg) {
- inNum = -inNum;
- *outStr = '-';
- }
-
- int16 digits = 1;
-
- if (inNum > 9) {
- int32 _inNum = inNum;
- do {
- digits++;
- _inNum /= 10;
- } while (_inNum > 9);
- }
-
- int32 strSize = digits;
- if (isNeg)
- strSize++;
-
- char *pStr = &outStr[strSize];
- int32 i = 0;
- do {
- *(pStr-- - 1) = (inNum % 10) + '0';
- inNum /= 10;
- } while (++i < strSize);
- outStr[strSize] = '\0';
+#include "common.h"
+#include "Debug.h"
+#include "obrstr.h"
+
+char obrstr[128];
+char obrstr2[128];
+
+void ObrInt(int32 n1)
+{
+ IntToStr(n1, obrstr);
+ CDebug::DebugAddText(obrstr);
+}
+
+void ObrInt2(int32 n1, int32 n2)
+{
+ IntToStr(n1, obrstr);
+ strcat(obrstr, " ");
+ IntToStr(n2, obrstr2);
+ strcat(obrstr, obrstr2);
+ CDebug::DebugAddText(obrstr);
+}
+
+void ObrInt3(int32 n1, int32 n2, int32 n3)
+{
+ IntToStr(n1, obrstr);
+ strcat(obrstr, " ");
+ IntToStr(n2, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n3, obrstr2);
+ strcat(obrstr, obrstr2);
+ CDebug::DebugAddText(obrstr);
+}
+
+void ObrInt4(int32 n1, int32 n2, int32 n3, int32 n4)
+{
+ IntToStr(n1, obrstr);
+ strcat(obrstr, " ");
+ IntToStr(n2, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n3, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n4, obrstr2);
+ strcat(obrstr, obrstr2);
+ CDebug::DebugAddText(obrstr);
+}
+
+void ObrInt5(int32 n1, int32 n2, int32 n3, int32 n4, int32 n5)
+{
+ IntToStr(n1, obrstr);
+ strcat(obrstr, " ");
+ IntToStr(n2, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n3, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n4, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n5, obrstr2);
+ strcat(obrstr, obrstr2);
+ CDebug::DebugAddText(obrstr);
+}
+
+void ObrInt6(int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6)
+{
+ IntToStr(n1, obrstr);
+ strcat(obrstr, " ");
+ IntToStr(n2, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n3, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n4, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n5, obrstr2);
+ strcat(obrstr, obrstr2);
+ strcat(obrstr, " ");
+ IntToStr(n6, obrstr2);
+ strcat(obrstr, obrstr2);
+ CDebug::DebugAddText(obrstr);
+}
+
+void IntToStr(int32 inNum, char *outStr)
+{
+ bool isNeg = inNum < 0;
+
+ if (isNeg) {
+ inNum = -inNum;
+ *outStr = '-';
+ }
+
+ int16 digits = 1;
+
+ if (inNum > 9) {
+ int32 _inNum = inNum;
+ do {
+ digits++;
+ _inNum /= 10;
+ } while (_inNum > 9);
+ }
+
+ int32 strSize = digits;
+ if (isNeg)
+ strSize++;
+
+ char *pStr = &outStr[strSize];
+ int32 i = 0;
+ do {
+ *(pStr-- - 1) = (inNum % 10) + '0';
+ inNum /= 10;
+ } while (++i < strSize);
+ outStr[strSize] = '\0';
} \ No newline at end of file
diff --git a/src/core/obrstr.h b/src/core/obrstr.h
index 6838afb5..c1633614 100644
--- a/src/core/obrstr.h
+++ b/src/core/obrstr.h
@@ -1,9 +1,9 @@
-#pragma once
-
-void ObrInt(int32 n1);
-void ObrInt2(int32 n1, int32 n2);
-void ObrInt3(int32 n1, int32 n2, int32 n3);
-void ObrInt4(int32 n1, int32 n2, int32 n3, int32 n4);
-void ObrInt5(int32 n1, int32 n2, int32 n3, int32 n4, int32 n5);
-void ObrInt6(int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6);
+#pragma once
+
+void ObrInt(int32 n1);
+void ObrInt2(int32 n1, int32 n2);
+void ObrInt3(int32 n1, int32 n2, int32 n3);
+void ObrInt4(int32 n1, int32 n2, int32 n3, int32 n4);
+void ObrInt5(int32 n1, int32 n2, int32 n3, int32 n4, int32 n5);
+void ObrInt6(int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6);
void IntToStr(int32 inNum, char *outStr); \ No newline at end of file
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 6d4ff252..321ff172 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -21,10 +21,15 @@
#include "Particle.h"
#include "Console.h"
#include "Debug.h"
+#include "Hud.h"
#include <list>
+#ifndef RWLIBS
void **rwengine = *(void***)0x5A10E1;
+#else
+extern "C" int vsprintf(char* const _Buffer, char const* const _Format, va_list _ArgList);
+#endif
DebugMenuAPI gDebugMenuAPI;
@@ -145,19 +150,6 @@ SpawnCar(int id)
}
static void
-LetThemFollowYou(void) {
- CPed *player = (CPed*) FindPlayerPed();
- for (int i = 0; i < player->m_numNearPeds; i++) {
- CPed *nearPed = player->m_nearPeds[i];
- if (nearPed && !nearPed->IsPlayer()) {
- nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
- nearPed->m_pedFormation = (eFormation)(1 + (rand() & 7));
- nearPed->bScriptObjectiveCompleted = false;
- }
- }
-}
-
-static void
FixCar(void)
{
CVehicle *veh = FindPlayerVehicle();
@@ -337,7 +329,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
+ DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); });
+ DebugMenuAddVarBool8("Debug", "Draw hud", (int8*)&CHud::m_Wants_To_Draw_Hud, nil);
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
@@ -350,6 +344,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", (int8*)0x95CD43, nil);
+ DebugMenuAddVarBool8("Debug", "Show Ped Paths", (int8*)&gbShowPedPaths, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Paths", (int8*)&gbShowCarPaths, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Path Links", (int8*)&gbShowCarPathsLinks, nil);
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
@@ -359,8 +356,6 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
-
- DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou);
#ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);
@@ -458,7 +453,7 @@ void re3_debug(const char *format, ...)
vsprintf_s(re3_buff, re3_buffsize, format, va);
va_end(va);
-// printf("%s", re3_buff);
+ printf("%s", re3_buff);
CDebug::DebugAddText(re3_buff);
}
diff --git a/src/core/rw.cpp b/src/core/rw.cpp
deleted file mode 100644
index 52bcf5bb..00000000
--- a/src/core/rw.cpp
+++ /dev/null
@@ -1,415 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "rwcore.h"
-#include "rpworld.h"
-#include "rpmatfx.h"
-#include "rpskin.h"
-#include "rphanim.h"
-#include "rtbmp.h"
-
-typedef RwV3d *(*rwVectorsMultFn) (RwV3d * pointsOut,
- const RwV3d * pointsIn,
- RwInt32 numPoints,
- const RwMatrix * matrix);
-
-
-WRAPPER void _rwObjectHasFrameSetFrame(void* object, RwFrame* frame) { EAXJMP(0x5BC950); }
-WRAPPER RpAtomic* AtomicDefaultRenderCallBack(RpAtomic* atomic) { EAXJMP(0x59E690); }
-WRAPPER void _rpAtomicResyncInterpolatedSphere(RpAtomic* atomic) { EAXJMP(0x59E6C0); }
-WRAPPER RwSphere const* RpAtomicGetWorldBoundingSphere(RpAtomic* atomic) { EAXJMP(0x59E800); }
-WRAPPER RwInt32 RpClumpGetNumAtomics(RpClump* clump) { EAXJMP(0x59ED50); }
-WRAPPER RpClump* RpClumpRender(RpClump* clump) { EAXJMP(0x59ED80); }
-WRAPPER RpClump* RpClumpForAllAtomics(RpClump* clump, RpAtomicCallBack callback, void* pData) { EAXJMP(0x59EDD0); }
-WRAPPER RpClump* RpClumpForAllCameras(RpClump* clump, RwCameraCallBack callback, void* pData) { EAXJMP(0x59EE10); }
-WRAPPER RpClump* RpClumpForAllLights(RpClump* clump, RpLightCallBack callback, void* pData) { EAXJMP(0x59EE60); }
-WRAPPER RpAtomic* RpAtomicCreate() { EAXJMP(0x59EEB0); }
-WRAPPER RpAtomic* RpAtomicSetGeometry(RpAtomic* atomic, RpGeometry* geometry, RwUInt32 flags) { EAXJMP(0x59EFA0); }
-WRAPPER RwBool RpAtomicDestroy(RpAtomic* atomic) { EAXJMP(0x59F020); }
-WRAPPER RpAtomic* RpAtomicClone(RpAtomic* atomic) { EAXJMP(0x59F0A0); }
-WRAPPER RpClump* RpClumpClone(RpClump* clump) { EAXJMP(0x59F1B0); }
-WRAPPER RpClump* RpClumpCreate() { EAXJMP(0x59F490); }
-WRAPPER RwBool RpClumpDestroy(RpClump* clump) { EAXJMP(0x59F500); }
-WRAPPER RpClump* RpClumpAddAtomic(RpClump* clump, RpAtomic* atomic) { EAXJMP(0x59F680); }
-WRAPPER RpClump* RpClumpRemoveAtomic(RpClump* clump, RpAtomic* atomic) { EAXJMP(0x59F6B0); }
-WRAPPER RpClump* RpClumpRemoveLight(RpClump* clump, RpLight* light) { EAXJMP(0x59F6E0); }
-WRAPPER RpClump* RpClumpStreamRead(RwStream* stream) { EAXJMP(0x59FC50); }
-WRAPPER RwInt32 RpAtomicRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5A0510); }
-WRAPPER RwInt32 RpClumpRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5A0540); }
-WRAPPER RwInt32 RpAtomicRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5A0570); }
-WRAPPER RwInt32 RpAtomicSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB) { EAXJMP(0x5A05A0); }
-WRAPPER RwInt32 RpAtomicSetStreamRightsCallBack(RwUInt32 pluginID, RwPluginDataChunkRightsCallBack rightsCB) { EAXJMP(0x5A05C0); }
-WRAPPER RwInt32 RpAtomicGetPluginOffset(RwUInt32 pluginID) { EAXJMP(0x5A05E0); }
-WRAPPER RpAtomic* RpAtomicSetFrame(RpAtomic* atomic, RwFrame* frame) { EAXJMP(0x5A0600); }
-WRAPPER RwInt32 RwEngineRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor initCB, RwPluginObjectDestructor termCB) { EAXJMP(0x5A0DC0); }
-WRAPPER RwInt32 RwEngineGetPluginOffset(RwUInt32 pluginID) { EAXJMP(0x5A0DF0); }
-WRAPPER RwInt32 RwEngineGetNumSubSystems() { EAXJMP(0x5A0E10); }
-WRAPPER RwSubSystemInfo* RwEngineGetSubSystemInfo(RwSubSystemInfo* subSystemInfo, RwInt32 subSystemIndex) { EAXJMP(0x5A0E40); }
-WRAPPER RwInt32 RwEngineGetCurrentSubSystem() { EAXJMP(0x5A0E70); }
-WRAPPER RwBool RwEngineSetSubSystem(RwInt32 subSystemIndex) { EAXJMP(0x5A0EA0); }
-WRAPPER RwInt32 RwEngineGetNumVideoModes() { EAXJMP(0x5A0ED0); }
-WRAPPER RwVideoMode* RwEngineGetVideoModeInfo(RwVideoMode* modeinfo, RwInt32 modeIndex) { EAXJMP(0x5A0F00); }
-WRAPPER RwInt32 RwEngineGetCurrentVideoMode() { EAXJMP(0x5A0F30); }
-WRAPPER RwBool RwEngineSetVideoMode(RwInt32 modeIndex) { EAXJMP(0x5A0F60); }
-WRAPPER RwBool RwEngineStop() { EAXJMP(0x5A0F90); }
-WRAPPER RwBool RwEngineStart() { EAXJMP(0x5A0FE0); }
-WRAPPER RwBool RwEngineClose() { EAXJMP(0x5A1070); }
-WRAPPER RwBool RwEngineOpen(RwEngineOpenParams* initParams) { EAXJMP(0x5A10E0); }
-WRAPPER RwBool RwEngineTerm() { EAXJMP(0x5A1290); }
-WRAPPER RwBool RwEngineInit(RwMemoryFunctions* memFuncs, RwUInt32 initFlags, RwUInt32 resArenaSize) { EAXJMP(0x5A12D0); }
-WRAPPER void* _rwFrameOpen(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A15E0); }
-WRAPPER void* _rwFrameClose(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A1650); }
-WRAPPER RwFrame* _rwFrameCloneAndLinkClones(RwFrame* root) { EAXJMP(0x5A1690); }
-WRAPPER RwFrame* _rwFramePurgeClone(RwFrame* root) { EAXJMP(0x5A1880); }
-WRAPPER RwBool RwFrameDirty(RwFrame const* frame) { EAXJMP(0x5A1930); }
-WRAPPER void _rwFrameInit(RwFrame* frame) { EAXJMP(0x5A1950); }
-WRAPPER RwFrame* RwFrameCreate() { EAXJMP(0x5A1A00); }
-WRAPPER RwBool RwFrameDestroy(RwFrame* frame) { EAXJMP(0x5A1A30); }
-WRAPPER RwBool RwFrameDestroyHierarchy(RwFrame* frame) { EAXJMP(0x5A1BF0); }
-WRAPPER RwFrame* RwFrameUpdateObjects(RwFrame* frame) { EAXJMP(0x5A1C60); }
-WRAPPER RwMatrix* RwFrameGetLTM(RwFrame* frame) { EAXJMP(0x5A1CE0); }
-WRAPPER RwFrame* RwFrameAddChild(RwFrame* parent, RwFrame* child) { EAXJMP(0x5A1D00); }
-WRAPPER RwFrame* RwFrameRemoveChild(RwFrame* child) { EAXJMP(0x5A1ED0); }
-WRAPPER RwFrame* RwFrameForAllChildren(RwFrame* frame, RwFrameCallBack callBack, void* data) { EAXJMP(0x5A1FC0); }
-WRAPPER RwFrame* RwFrameTranslate(RwFrame* frame, RwV3d const* v, RwOpCombineType combine) { EAXJMP(0x5A2000); }
-WRAPPER RwFrame* RwFrameScale(RwFrame* frame, RwV3d const* v, RwOpCombineType combine) { EAXJMP(0x5A20A0); }
-WRAPPER RwFrame* RwFrameTransform(RwFrame* frame, RwMatrix const* m, RwOpCombineType combine) { EAXJMP(0x5A2140); }
-WRAPPER RwFrame* RwFrameRotate(RwFrame* frame, RwV3d const* axis, RwReal angle, RwOpCombineType combine) { EAXJMP(0x5A21E0); }
-WRAPPER RwFrame* RwFrameSetIdentity(RwFrame* frame) { EAXJMP(0x5A2280); }
-WRAPPER RwFrame* RwFrameForAllObjects(RwFrame* frame, RwObjectCallBack callBack, void* data) { EAXJMP(0x5A2340); }
-WRAPPER RwInt32 RwFrameRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5A2380); }
-WRAPPER RwBool _rwMatrixSetMultFn(rwMatrixMultFn multMat) { EAXJMP(0x5A23B0); }
-WRAPPER RwReal _rwMatrixDeterminant(RwMatrix const* matrix) { EAXJMP(0x5A2520); }
-WRAPPER RwReal _rwMatrixOrthogonalError(RwMatrix const* matrix) { EAXJMP(0x5A2570); }
-WRAPPER RwReal _rwMatrixNormalError(RwMatrix const* matrix) { EAXJMP(0x5A25D0); }
-WRAPPER RwReal _rwMatrixIdentityError(RwMatrix const* matrix) { EAXJMP(0x5A2660); }
-WRAPPER void* _rwMatrixClose(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A2730); }
-WRAPPER void* _rwMatrixOpen(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A2770); }
-WRAPPER RwMatrix* RwMatrixOptimize(RwMatrix* matrix, RwMatrixTolerance const* tolerance) { EAXJMP(0x5A2820); }
-WRAPPER RwMatrix* RwMatrixUpdate(RwMatrix* matrix) { EAXJMP(0x5A28E0); }
-WRAPPER RwMatrix* RwMatrixMultiply(RwMatrix* matrixOut, RwMatrix const* MatrixIn1, RwMatrix const* matrixIn2) { EAXJMP(0x5A28F0); }
-WRAPPER RwMatrix* RwMatrixRotateOneMinusCosineSine(RwMatrix* matrix, RwV3d const* unitAxis, RwReal oneMinusCosine, RwReal sine, RwOpCombineType combineOp) { EAXJMP(0x5A2960); }
-WRAPPER RwMatrix* RwMatrixRotate(RwMatrix* matrix, RwV3d const* axis, RwReal angle, RwOpCombineType combineOp) { EAXJMP(0x5A2BF0); }
-WRAPPER RwMatrix* RwMatrixInvert(RwMatrix* matrixOut, RwMatrix const* matrixIn) { EAXJMP(0x5A2C90); }
-WRAPPER RwMatrix* RwMatrixScale(RwMatrix* matrix, RwV3d const* scale, RwOpCombineType combineOp) { EAXJMP(0x5A2EE0); }
-WRAPPER RwMatrix* RwMatrixTranslate(RwMatrix* matrix, RwV3d const* translation, RwOpCombineType combineOp) { EAXJMP(0x5A3070); }
-WRAPPER RwMatrix* RwMatrixTransform(RwMatrix* matrix, RwMatrix const* transform, RwOpCombineType combineOp) { EAXJMP(0x5A31C0); }
-WRAPPER RwBool RwMatrixDestroy(RwMatrix* mpMat) { EAXJMP(0x5A3300); }
-WRAPPER RwMatrix* RwMatrixCreate() { EAXJMP(0x5A3330); }
-WRAPPER RwBool _rwVectorSetMultFn(rwVectorMultFn multPoint, rwVectorsMultFn multPoints, rwVectorMultFn multVector, rwVectorsMultFn multVectors) { EAXJMP(0x5A3450); }
-WRAPPER RwReal _rwV3dNormalize(RwV3d* out, RwV3d const* in) { EAXJMP(0x5A3600); }
-WRAPPER RwReal RwV3dLength(RwV3d const* in) { EAXJMP(0x5A36A0); }
-WRAPPER RwReal _rwSqrt(RwReal const num) { EAXJMP(0x5A3710); }
-WRAPPER RwReal _rwInvSqrt(RwReal const num) { EAXJMP(0x5A3770); }
-WRAPPER RwV3d* RwV3dTransformPoints(RwV3d* pointsOut, RwV3d const* pointsIn, RwInt32 numPoints, RwMatrix const* matrix) { EAXJMP(0x5A37D0); }
-WRAPPER RwV3d* RwV3dTransformVectors(RwV3d* vectorsOut, RwV3d const* vectorsIn, RwInt32 numPoints, RwMatrix const* matrix) { EAXJMP(0x5A37E0); }
-WRAPPER void* _rwVectorClose(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A37F0); }
-WRAPPER void* _rwVectorOpen(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A3860); }
-WRAPPER RwUInt32 RwStreamRead(RwStream* stream, void* buffer, RwUInt32 length) { EAXJMP(0x5A3AD0); }
-WRAPPER RwStream* RwStreamWrite(RwStream* stream, void const* buffer, RwUInt32 length) { EAXJMP(0x5A3C30); }
-WRAPPER RwStream* RwStreamSkip(RwStream* stream, RwUInt32 offset) { EAXJMP(0x5A3DF0); }
-WRAPPER RwBool RwStreamClose(RwStream* stream, void* pData) { EAXJMP(0x5A3F10); }
-WRAPPER RwStream* RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, void const* pData) { EAXJMP(0x5A3FE0); }
-WRAPPER RwReal RwIm2DGetNearScreenZ() { EAXJMP(0x5A43A0); }
-WRAPPER RwReal RwIm2DGetFarScreenZ() { EAXJMP(0x5A43B0); }
-WRAPPER RwBool RwRenderStateSet(RwRenderState state, void* value) { EAXJMP(0x5A43C0); }
-WRAPPER RwBool RwRenderStateGet(RwRenderState state, void* value) { EAXJMP(0x5A4410); }
-WRAPPER RwBool RwIm2DRenderLine(RwIm2DVertex* vertices, RwInt32 numVertices, RwInt32 vert1, RwInt32 vert2) { EAXJMP(0x5A4420); }
-WRAPPER RwBool RwIm2DRenderPrimitive(RwPrimitiveType primType, RwIm2DVertex* vertices, RwInt32 numVertices) { EAXJMP(0x5A4430); }
-WRAPPER RwBool RwIm2DRenderIndexedPrimitive(RwPrimitiveType primType, RwIm2DVertex* vertices, RwInt32 numVertices, RwImVertexIndex* indices, RwInt32 numIndices) { EAXJMP(0x5A4440); }
-WRAPPER RwCamera* RwCameraEndUpdate(RwCamera* camera) { EAXJMP(0x5A5020); }
-WRAPPER RwCamera* RwCameraBeginUpdate(RwCamera* camera) { EAXJMP(0x5A5030); }
-WRAPPER RwCamera* RwCameraSetViewOffset(RwCamera* camera, RwV2d const* offset) { EAXJMP(0x5A5040); }
-WRAPPER RwCamera* RwCameraSetNearClipPlane(RwCamera* camera, RwReal nearClip) { EAXJMP(0x5A5070); }
-WRAPPER RwCamera* RwCameraSetFarClipPlane(RwCamera* camera, RwReal farClip) { EAXJMP(0x5A5140); }
-WRAPPER RwFrustumTestResult RwCameraFrustumTestSphere(RwCamera const* camera, RwSphere const* sphere) { EAXJMP(0x5A5170); }
-WRAPPER RwCamera* RwCameraClear(RwCamera* camera, RwRGBA* colour, RwInt32 clearMode) { EAXJMP(0x5A51E0); }
-WRAPPER RwCamera* RwCameraShowRaster(RwCamera* camera, void* pDev, RwUInt32 flags) { EAXJMP(0x5A5210); }
-WRAPPER RwCamera* RwCameraSetProjection(RwCamera* camera, RwCameraProjection projection) { EAXJMP(0x5A5240); }
-WRAPPER RwCamera* RwCameraSetViewWindow(RwCamera* camera, RwV2d const* viewWindow) { EAXJMP(0x5A52B0); }
-WRAPPER RwInt32 RwCameraRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5A52F0); }
-WRAPPER RwBool RwCameraDestroy(RwCamera* camera) { EAXJMP(0x5A5320); }
-WRAPPER RwCamera* RwCameraCreate() { EAXJMP(0x5A5360); }
-WRAPPER RwBool RwTextureSetMipmapping(RwBool enable) { EAXJMP(0x5A7100); }
-WRAPPER RwBool RwTextureGetMipmapping() { EAXJMP(0x5A7120); }
-WRAPPER RwBool RwTextureSetAutoMipmapping(RwBool enable) { EAXJMP(0x5A7130); }
-WRAPPER RwBool RwTextureGetAutoMipmapping() { EAXJMP(0x5A7150); }
-WRAPPER RwTexDictionary* RwTexDictionaryCreate() { EAXJMP(0x5A7160); }
-WRAPPER RwBool RwTexDictionaryDestroy(RwTexDictionary* dict) { EAXJMP(0x5A7200); }
-WRAPPER RwTexDictionary const* RwTexDictionaryForAllTextures(RwTexDictionary const* dict, RwTextureCallBack fpCallBack, void* pData) { EAXJMP(0x5A7290); }
-WRAPPER RwTexture* RwTextureCreate(RwRaster* raster) { EAXJMP(0x5A72D0); }
-WRAPPER RwBool RwTextureDestroy(RwTexture* texture) { EAXJMP(0x5A7330); }
-WRAPPER RwTexture* RwTextureSetName(RwTexture* texture, RwChar const* name) { EAXJMP(0x5A73B0); }
-WRAPPER RwTexture* RwTextureSetMaskName(RwTexture* texture, RwChar const* maskName) { EAXJMP(0x5A7420); }
-WRAPPER RwTexture* RwTexDictionaryAddTexture(RwTexDictionary* dict, RwTexture* texture) { EAXJMP(0x5A7490); }
-WRAPPER RwTexture* RwTexDictionaryFindNamedTexture(RwTexDictionary* dict, RwChar const* name) { EAXJMP(0x5A74D0); }
-WRAPPER RwTexDictionary* RwTexDictionarySetCurrent(RwTexDictionary* dict) { EAXJMP(0x5A7550); }
-WRAPPER RwTexDictionary* RwTexDictionaryGetCurrent() { EAXJMP(0x5A7570); }
-WRAPPER RwTexture* RwTextureRead(RwChar const* name, RwChar const* maskName) { EAXJMP(0x5A7580); }
-WRAPPER RwBool RwTextureRasterGenerateMipmaps(RwRaster* raster, RwImage* image) { EAXJMP(0x5A7780); }
-WRAPPER RwImage* RwImageCreate(RwInt32 width, RwInt32 height, RwInt32 depth) { EAXJMP(0x5A9120); }
-WRAPPER RwBool RwImageDestroy(RwImage* image) { EAXJMP(0x5A9180); }
-WRAPPER RwImage* RwImageAllocatePixels(RwImage* image) { EAXJMP(0x5A91E0); }
-WRAPPER RwImage* RwImageFreePixels(RwImage* image) { EAXJMP(0x5A92A0); }
-WRAPPER RwImage* RwImageMakeMask(RwImage* image) { EAXJMP(0x5A92D0); }
-WRAPPER RwImage* RwImageApplyMask(RwImage* image, RwImage const* mask) { EAXJMP(0x5A93A0); }
-WRAPPER RwChar const* RwImageSetPath(RwChar const* path) { EAXJMP(0x5A9750); }
-WRAPPER RwImage* RwImageRead(RwChar const* imageName) { EAXJMP(0x5A9810); }
-WRAPPER RwChar const* RwImageFindFileType(RwChar const* imageName) { EAXJMP(0x5A9B40); }
-WRAPPER RwImage* RwImageReadMaskedImage(RwChar const* imageName, RwChar const* maskname) { EAXJMP(0x5A9C10); }
-WRAPPER RwImage* RwImageCopy(RwImage* destImage, RwImage const* sourceImage) { EAXJMP(0x5A9F50); }
-WRAPPER RwImage* RwImageGammaCorrect(RwImage* image) { EAXJMP(0x5AA130); }
-WRAPPER RwBool RwImageSetGamma(RwReal gammaValue) { EAXJMP(0x5AA2C0); }
-WRAPPER RwStream* _rwStreamWriteVersionedChunkHeader(RwStream* stream, RwInt32 type, RwInt32 size, RwUInt32 version, RwUInt32 buildNum) { EAXJMP(0x5AA4E0); }
-WRAPPER RwBool RwStreamFindChunk(RwStream* stream, RwUInt32 type, RwUInt32* lengthOut, RwUInt32* versionOut) { EAXJMP(0x5AA540); }
-WRAPPER void* RwMemLittleEndian32(void* mem, RwUInt32 size) { EAXJMP(0x5AA640); }
-WRAPPER void* RwMemNative32(void* mem, RwUInt32 size) { EAXJMP(0x5AA650); }
-WRAPPER void* RwMemFloat32ToReal(void* mem, RwUInt32 size) { EAXJMP(0x5AA660); }
-WRAPPER RwStream* RwStreamWriteReal(RwStream* stream, RwReal const* reals, RwUInt32 numBytes) { EAXJMP(0x5AA680); }
-WRAPPER RwStream* RwStreamWriteInt32(RwStream* stream, RwInt32 const* ints, RwUInt32 numBytes) { EAXJMP(0x5AA720); }
-WRAPPER RwStream* RwStreamReadReal(RwStream* stream, RwReal* reals, RwUInt32 numBytes) { EAXJMP(0x5AA740); }
-WRAPPER RwStream* RwStreamReadInt32(RwStream* stream, RwInt32* ints, RwUInt32 numBytes) { EAXJMP(0x5AA7B0); }
-WRAPPER RwUInt32 RwTextureStreamGetSize(RwTexture const* texture) { EAXJMP(0x5AA800); }
-WRAPPER RwTexture const* RwTextureStreamWrite(RwTexture const* texture, RwStream* stream) { EAXJMP(0x5AA870); }
-WRAPPER RwTexture* RwTextureStreamRead(RwStream* stream) { EAXJMP(0x5AAA40); }
-WRAPPER RwTexDictionary const* RwTexDictionaryStreamWrite(RwTexDictionary const* texDict, RwStream* stream) { EAXJMP(0x5AB020); }
-WRAPPER RpMorphTarget const* RpMorphTargetCalcBoundingSphere(RpMorphTarget const* morphTarget, RwSphere* boundingSphere) { EAXJMP(0x5AC890); }
-WRAPPER RwInt32 RpGeometryAddMorphTargets(RpGeometry* geometry, RwInt32 mtcount) { EAXJMP(0x5AC9A0); }
-WRAPPER RpGeometry const* RpGeometryTriangleSetVertexIndices(RpGeometry const* geometry, RpTriangle* triangle, RwUInt16 vert1, RwUInt16 vert2, RwUInt16 vert3) { EAXJMP(0x5ACB60); }
-WRAPPER RpGeometry* RpGeometryTriangleSetMaterial(RpGeometry* geometry, RpTriangle* triangle, RpMaterial* material) { EAXJMP(0x5ACB90); }
-WRAPPER RpGeometry* RpGeometryForAllMaterials(RpGeometry* geometry, RpMaterialCallBack fpCallBack, void* pData) { EAXJMP(0x5ACBF0); }
-WRAPPER RpGeometry* RpGeometryLock(RpGeometry* geometry, RwInt32 lockMode) { EAXJMP(0x5ACC30); }
-WRAPPER RpGeometry* RpGeometryUnlock(RpGeometry* geometry) { EAXJMP(0x5ACC60); }
-WRAPPER RpGeometry* RpGeometryCreate(RwInt32 numVert, RwInt32 numTriangles, RwUInt32 format) { EAXJMP(0x5ACD10); }
-WRAPPER RpGeometry* _rpGeometryAddRef(RpGeometry* geometry) { EAXJMP(0x5ACF40); }
-WRAPPER RwBool RpGeometryDestroy(RpGeometry* geometry) { EAXJMP(0x5ACF50); }
-WRAPPER RwInt32 RpGeometryRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5ACFF0); }
-WRAPPER RwInt32 RpGeometryRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5AD020); }
-WRAPPER RpGeometry* RpGeometryStreamRead(RwStream* stream) { EAXJMP(0x5AD050); }
-WRAPPER RwRaster* RwRasterGetCurrentContext() { EAXJMP(0x5AD6D0); }
-WRAPPER RwRaster* RwRasterUnlock(RwRaster* raster) { EAXJMP(0x5AD6F0); }
-WRAPPER RwRaster* RwRasterRenderFast(RwRaster* raster, RwInt32 x, RwInt32 y) { EAXJMP(0x5AD710); }
-WRAPPER RwRaster* RwRasterUnlockPalette(RwRaster* raster) { EAXJMP(0x5AD750); }
-WRAPPER RwBool RwRasterDestroy(RwRaster* raster) { EAXJMP(0x5AD780); }
-WRAPPER RwRaster* RwRasterPushContext(RwRaster* raster) { EAXJMP(0x5AD7C0); }
-WRAPPER RwInt32 RwRasterRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5AD810); }
-WRAPPER RwUInt8* RwRasterLockPalette(RwRaster* raster, RwInt32 lockMode) { EAXJMP(0x5AD840); }
-WRAPPER RwRaster* RwRasterPopContext() { EAXJMP(0x5AD870); }
-WRAPPER RwInt32 RwRasterGetNumLevels(RwRaster* raster) { EAXJMP(0x5AD8C0); }
-WRAPPER RwRaster* RwRasterShowRaster(RwRaster* raster, void* dev, RwUInt32 flags) { EAXJMP(0x5AD900); }
-WRAPPER RwRaster* RwRasterCreate(RwInt32 width, RwInt32 height, RwInt32 depth, RwInt32 flags) { EAXJMP(0x5AD930); }
-WRAPPER RwUInt8* RwRasterLock(RwRaster* raster, RwUInt8 level, RwInt32 lockMode) { EAXJMP(0x5AD9D0); }
-WRAPPER RpMaterial* RpMaterialCreate() { EAXJMP(0x5ADC30); }
-WRAPPER RwBool RpMaterialDestroy(RpMaterial* material) { EAXJMP(0x5ADCB0); }
-WRAPPER RpMaterial* RpMaterialSetTexture(RpMaterial* material, RwTexture* texture) { EAXJMP(0x5ADD10); }
-WRAPPER RwInt32 RpMaterialRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5ADD40); }
-WRAPPER RwInt32 RpMaterialRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5ADD70); }
-WRAPPER RpMaterial* RpMaterialStreamRead(RwStream* stream) { EAXJMP(0x5ADDA0); }
-WRAPPER RpWorldSector* _rpSectorDefaultRenderCallBack(RpWorldSector* sector) { EAXJMP(0x5AE0B0); }
-WRAPPER RwBool _rpWorldForAllGlobalLights(RpLightCallBack callBack, void* pData) { EAXJMP(0x5AE100); }
-WRAPPER RpWorldSector* _rpWorldSectorForAllLocalLights(RpWorldSector* sector, RpLightCallBack callBack, void* pData) { EAXJMP(0x5AE150); }
-WRAPPER RpWorld* RpWorldUnlock(RpWorld* world) { EAXJMP(0x5AE190); }
-WRAPPER RpWorld* RpWorldSectorGetWorld(RpWorldSector const* sector) { EAXJMP(0x5AE2B0); }
-WRAPPER RwBool RpWorldDestroy(RpWorld* world) { EAXJMP(0x5AE340); }
-WRAPPER RpWorld* RpWorldCreate(RwBBox* boundingBox) { EAXJMP(0x5AE6A0); }
-WRAPPER RwInt32 RpWorldRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5AEA40); }
-WRAPPER RwInt32 RpWorldRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5AEA70); }
-WRAPPER RwBool RpWorldPluginAttach() { EAXJMP(0x5AEAA0); }
-WRAPPER RpWorld* RpWorldAddCamera(RpWorld* world, RwCamera* camera) { EAXJMP(0x5AFB80); }
-WRAPPER RpWorld* RpWorldRemoveCamera(RpWorld* world, RwCamera* camera) { EAXJMP(0x5AFBB0); }
-WRAPPER RpWorld* RpAtomicGetWorld(RpAtomic const* atomic) { EAXJMP(0x5AFC10); }
-WRAPPER RpWorld* RpWorldAddClump(RpWorld* world, RpClump* clump) { EAXJMP(0x5AFC20); }
-WRAPPER RpWorld* RpWorldAddLight(RpWorld* world, RpLight* light) { EAXJMP(0x5AFDA0); }
-WRAPPER RpWorld* RpWorldRemoveLight(RpWorld* world, RpLight* light) { EAXJMP(0x5AFDF0); }
-WRAPPER RwImage* RtBMPImageRead(RwChar const* imageName) { EAXJMP(0x5AFE70); }
-WRAPPER RwBool RpSkinPluginAttach() { EAXJMP(0x5B07D0); }
-WRAPPER RpAtomic* RpSkinAtomicSetHAnimHierarchy(RpAtomic* atomic, RpHAnimHierarchy* hierarchy) { EAXJMP(0x5B1050); }
-WRAPPER RpHAnimHierarchy* RpSkinAtomicGetHAnimHierarchy(RpAtomic const* atomic) { EAXJMP(0x5B1070); }
-WRAPPER RpSkin* RpSkinGeometryGetSkin(RpGeometry* geometry) { EAXJMP(0x5B1080); }
-WRAPPER RpGeometry* RpSkinGeometrySetSkin(RpGeometry* geometry, RpSkin* skin) { EAXJMP(0x5B1090); }
-WRAPPER RwMatrix const* RpSkinGetSkinToBoneMatrices(RpSkin* skin) { EAXJMP(0x5B10D0); }
-WRAPPER RpHAnimHierarchy* RpHAnimHierarchyCreate(RwInt32 numNodes, RwUInt32* nodeFlags, RwInt32* nodeIDs, RpHAnimHierarchyFlag flags, RwInt32 maxKeyFrameSize) { EAXJMP(0x5B10E0); }
-WRAPPER RpHAnimHierarchy* RpHAnimFrameGetHierarchy(RwFrame* frame) { EAXJMP(0x5B11F0); }
-WRAPPER RwBool RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy* hierarchy, RpHAnimAnimation* anim) { EAXJMP(0x5B1200); }
-WRAPPER RwBool RpHAnimHierarchySubAnimTime(RpHAnimHierarchy* hierarchy, RwReal time) { EAXJMP(0x5B12B0); }
-WRAPPER RwBool RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy* hierarchy, RwReal time) { EAXJMP(0x5B1480); }
-WRAPPER RwBool RpHAnimHierarchyUpdateMatrices(RpHAnimHierarchy* hierarchy) { EAXJMP(0x5B1780); }
-WRAPPER RpHAnimAnimation* RpHAnimAnimationStreamRead(RwStream* stream) { EAXJMP(0x5B1C10); }
-WRAPPER RwBool RpHAnimPluginAttach() { EAXJMP(0x5B1D50); }
-WRAPPER RwBool RpMatFXPluginAttach() { EAXJMP(0x5B2640); }
-WRAPPER RpAtomic* RpMatFXAtomicEnableEffects(RpAtomic* atomic) { EAXJMP(0x5B3750); }
-WRAPPER RpMaterial* RpMatFXMaterialSetEffects(RpMaterial* material, RpMatFXMaterialFlags flags) { EAXJMP(0x5B3780); }
-WRAPPER RpMaterial* RpMatFXMaterialSetupEnvMap(RpMaterial* material, RwTexture* texture, RwFrame* frame, RwBool useFrameBufferAlpha, RwReal coef) { EAXJMP(0x5B38D0); }
-WRAPPER RpMaterial* RpMatFXMaterialSetBumpMapTexture(RpMaterial* material, RwTexture* texture) { EAXJMP(0x5B3A40); }
-WRAPPER RwBool RwD3D8SetRenderState(RwUInt32 state, RwUInt32 value) { EAXJMP(0x5B3CF0); }
-WRAPPER void RwD3D8GetRenderState(RwUInt32 state, void* value) { EAXJMP(0x5B3D40); }
-WRAPPER RwBool RwD3D8SetTextureStageState(RwUInt32 stage, RwUInt32 type, RwUInt32 value) { EAXJMP(0x5B3D60); }
-WRAPPER RwBool RwD3D8SetTexture(RwTexture* texture, RwUInt32 stage) { EAXJMP(0x5B53A0); }
-WRAPPER void* RwIm3DTransform(RwIm3DVertex* pVerts, RwUInt32 numVerts, RwMatrix* ltm, RwUInt32 flags) { EAXJMP(0x5B6720); }
-WRAPPER RwBool RwIm3DEnd() { EAXJMP(0x5B67F0); }
-WRAPPER RwBool RwIm3DRenderIndexedPrimitive(RwPrimitiveType primType, RwImVertexIndex* indices, RwInt32 numIndices) { EAXJMP(0x5B6820); }
-WRAPPER RwBool RwIm3DRenderLine(RwInt32 vert1, RwInt32 vert2) { EAXJMP(0x5B6980); }
-WRAPPER RxPipeline* RwIm3DSetTransformPipeline(RxPipeline* pipeline) { EAXJMP(0x5B6A50); }
-WRAPPER RxPipeline* RwIm3DSetRenderPipeline(RxPipeline* pipeline, RwPrimitiveType primType) { EAXJMP(0x5B6AC0); }
-WRAPPER void RwD3D8EngineSetRefreshRate(RwUInt32 refreshRate) { EAXJMP(0x5B95D0); }
-WRAPPER RwBool RwD3D8CameraAttachWindow(void* camera, void* hwnd) { EAXJMP(0x5B9640); }
-WRAPPER RwBool RwD3D8DeviceSupportsDXTTexture() { EAXJMP(0x5BAEB0); }
-WRAPPER RwBool RwD3D8SetVertexShader(RwUInt32 handle) { EAXJMP(0x5BAF90); }
-WRAPPER RwBool RwD3D8SetPixelShader(RwUInt32 handle) { EAXJMP(0x5BAFD0); }
-WRAPPER RwBool RwD3D8SetStreamSource(RwUInt32 streamNumber, void* streamData, RwUInt32 stride) { EAXJMP(0x5BB010); }
-WRAPPER RwBool RwD3D8SetIndices(void* indexData, RwUInt32 baseVertexIndex) { EAXJMP(0x5BB060); }
-WRAPPER RwBool RwD3D8DrawIndexedPrimitive(RwUInt32 primitiveType, RwUInt32 minIndex, RwUInt32 numVertices, RwUInt32 startIndex, RwUInt32 numIndices) { EAXJMP(0x5BB0B0); }
-WRAPPER RwBool RwD3D8DrawPrimitive(RwUInt32 primitiveType, RwUInt32 startVertex, RwUInt32 numVertices) { EAXJMP(0x5BB140); }
-WRAPPER RwBool RwD3D8SetTransform(RwUInt32 state, void const* matrix) { EAXJMP(0x5BB1D0); }
-WRAPPER void RwD3D8GetTransform(RwUInt32 state, void* matrix) { EAXJMP(0x5BB310); }
-WRAPPER RwBool RwD3D8SetTransformWorld(RwMatrix const* matrix) { EAXJMP(0x5BB340); }
-WRAPPER RwBool RwD3D8SetSurfaceProperties(RwRGBA const* color, RwSurfaceProperties const* surfaceProps, RwBool modulate) { EAXJMP(0x5BB490); }
-WRAPPER RwBool RwD3D8SetLight(RwInt32 index, void const* light) { EAXJMP(0x5BB7A0); }
-WRAPPER RwBool RwD3D8EnableLight(RwInt32 index, RwBool enable) { EAXJMP(0x5BB890); }
-WRAPPER RwBool RwD3D8DynamicVertexBufferCreate(RwUInt32 fvf, RwUInt32 size, void** vertexBuffer) { EAXJMP(0x5BB9F0); }
-WRAPPER void RwD3D8DynamicVertexBufferDestroy(void* vertexBuffer) { EAXJMP(0x5BBAE0); }
-WRAPPER RwBool RwD3D8IndexBufferCreate(RwUInt32 numIndices, void** indexBuffer) { EAXJMP(0x5BBB10); }
-WRAPPER RwBool RwD3D8CreatePixelShader(RwUInt32 const* function, RwUInt32* handle) { EAXJMP(0x5BBB40); }
-WRAPPER void RwD3D8DeletePixelShader(RwUInt32 handle) { EAXJMP(0x5BBB90); }
-WRAPPER RwBool RwD3D8SetPixelShaderConstant(RwUInt32 registerAddress, void const* antData, RwUInt32 antCount) { EAXJMP(0x5BBC00); }
-WRAPPER void const* RwD3D8GetCaps() { EAXJMP(0x5BBC30); }
-WRAPPER RwBool RwD3D8CameraIsSphereFullyInsideFrustum(void const* camera, void const* sphere) { EAXJMP(0x5BBC40); }
-WRAPPER RwBool RwD3D8CameraIsBBoxFullyInsideFrustum(void const* camera, void const* boundingBox) { EAXJMP(0x5BBCA0); }
-WRAPPER RwBool RwD3D8DynamicVertexBufferLock(RwUInt32 vertexSize, RwUInt32 numVertex, void** vertexBufferOut, void** vertexDataOut, RwUInt32* baseIndexOut) { EAXJMP(0x5BBD30); }
-WRAPPER RwBool RwD3D8DynamicVertexBufferUnlock(void* vertexBuffer) { EAXJMP(0x5BBEB0); }
-WRAPPER RwBool _rwIntelSSEsupported() { EAXJMP(0x5BBED0); }
-WRAPPER RwImage* RwImageSetFromRaster(RwImage* image, RwRaster* raster) { EAXJMP(0x5BBF10); }
-WRAPPER RwRaster* RwRasterSetFromImage(RwRaster* raster, RwImage* image) { EAXJMP(0x5BBF50); }
-WRAPPER RwImage* RwImageFindRasterFormat(RwImage* ipImage, RwInt32 nRasterType, RwInt32* npWidth, RwInt32* npHeight, RwInt32* npDepth, RwInt32* npFormat) { EAXJMP(0x5BBF80); }
-WRAPPER RwInt32 RwFrameRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5BBFF0); }
-WRAPPER rwFrameList* _rwFrameListDeinitialize(rwFrameList* frameList) { EAXJMP(0x5BC020); }
-WRAPPER rwFrameList* _rwFrameListStreamRead(RwStream* stream, rwFrameList* fl) { EAXJMP(0x5BC050); }
-WRAPPER RpLight* RpLightSetRadius(RpLight* light, RwReal radius) { EAXJMP(0x5BC300); }
-WRAPPER RpLight* RpLightSetColor(RpLight* light, RwRGBAReal const* color) { EAXJMP(0x5BC320); }
-WRAPPER RwReal RpLightGetConeAngle(RpLight const* light) { EAXJMP(0x5BC370); }
-WRAPPER RwInt32 RpLightRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5BC5B0); }
-WRAPPER RpLight* RpLightStreamRead(RwStream* stream) { EAXJMP(0x5BC5E0); }
-WRAPPER RwBool RpLightDestroy(RpLight* light) { EAXJMP(0x5BC780); }
-WRAPPER RpLight* RpLightCreate(RwInt32 type) { EAXJMP(0x5BC7C0); }
-WRAPPER void _rwD3D8TexDictionaryEnableRasterFormatConversion(RwBool enable) { EAXJMP(0x5BE280); }
-WRAPPER RwFileFunctions* RwOsGetFileInterface() { EAXJMP(0x5BF110); }
-WRAPPER RwBool RwFreeListDestroy(RwFreeList* freelist) { EAXJMP(0x5C1720); }
-WRAPPER RwFreeList* RwFreeListCreate(RwInt32 entrySize, RwInt32 entriesPerBlock, RwInt32 alignment) { EAXJMP(0x5C1790); }
-WRAPPER RwInt32 RwFreeListPurge(RwFreeList* freelist) { EAXJMP(0x5C19F0); }
-WRAPPER RwInt32 RwFreeListPurgeAllFreeLists() { EAXJMP(0x5C1B90); }
-WRAPPER RwFreeList* RwFreeListForAllUsed(RwFreeList* freelist, RwFreeListCallBack fpCallBack, void* pData) { EAXJMP(0x5C1D40); }
-WRAPPER RwBool _rxPipelineClose() { EAXJMP(0x5C2780); }
-WRAPPER RwBool _rxPipelineOpen() { EAXJMP(0x5C27E0); }
-WRAPPER RxHeap* RxHeapGetGlobalHeap() { EAXJMP(0x5C2AD0); }
-WRAPPER RxPacket* RxPacketCreate(RxPipelineNode* node) { EAXJMP(0x5C2AE0); }
-WRAPPER RxCluster* RxClusterSetExternalData(RxCluster* cluster, void* data, RwInt32 stride, RwInt32 numElements) { EAXJMP(0x5C2B10); }
-WRAPPER RxCluster* RxClusterSetData(RxCluster* cluster, void* data, RwInt32 stride, RwInt32 numElements) { EAXJMP(0x5C2B70); }
-WRAPPER RxCluster* RxClusterInitializeData(RxCluster* cluster, RwUInt32 numElements, RwUInt16 stride) { EAXJMP(0x5C2BD0); }
-WRAPPER RxCluster* RxClusterResizeData(RxCluster* CurrentCluster, RwUInt32 NumElements) { EAXJMP(0x5C2C40); }
-WRAPPER RxCluster* RxClusterLockWrite(RxPacket* packet, RwUInt32 clusterIndex, RxPipelineNode* node) { EAXJMP(0x5C2C90); }
-WRAPPER RxPipeline* RxPipelineExecute(RxPipeline* pipeline, void* data, RwBool heapReset) { EAXJMP(0x5C2D60); }
-WRAPPER RxPipeline* RxPipelineCreate() { EAXJMP(0x5C2E00); }
-WRAPPER void _rxPipelineDestroy(RxPipeline* Pipeline) { EAXJMP(0x5C2E70); }
-WRAPPER RwBool RwResourcesFreeResEntry(RwResEntry* entry) { EAXJMP(0x5C3080); }
-WRAPPER void _rwResourcesPurge() { EAXJMP(0x5C30F0); }
-WRAPPER RwResEntry* RwResourcesAllocateResEntry(void* owner, RwResEntry** ownerRef, RwInt32 size, RwResEntryDestroyNotify destroyNotify) { EAXJMP(0x5C3170); }
-WRAPPER RwBool RwResourcesEmptyArena() { EAXJMP(0x5C3360); }
-WRAPPER RwBool _rwPluginRegistryOpen() { EAXJMP(0x5C3450); }
-WRAPPER RwBool _rwPluginRegistryClose() { EAXJMP(0x5C3480); }
-WRAPPER RwInt32 _rwPluginRegistryGetPluginOffset(RwPluginRegistry const* reg, RwUInt32 pluginID) { EAXJMP(0x5C3590); }
-WRAPPER RwInt32 _rwPluginRegistryAddPlugin(RwPluginRegistry* reg, RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5C35C0); }
-WRAPPER RwPluginRegistry const* _rwPluginRegistryInitObject(RwPluginRegistry const* reg, void* object) { EAXJMP(0x5C37F0); }
-WRAPPER RwPluginRegistry const* _rwPluginRegistryDeInitObject(RwPluginRegistry const* reg, void* object) { EAXJMP(0x5C3850); }
-WRAPPER RwPluginRegistry const* _rwPluginRegistryCopyObject(RwPluginRegistry const* reg, void* dstObject, void const* srcObject) { EAXJMP(0x5C3880); }
-WRAPPER RwError* RwErrorSet(RwError* code) { EAXJMP(0x5C3910); }
-WRAPPER RwInt32 _rwerror(RwInt32 code, ...) { EAXJMP(0x5C3970); }
-WRAPPER RwInt32 _rwPluginRegistryAddPluginStream(RwPluginRegistry* reg, RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5C3980); }
-WRAPPER RwInt32 _rwPluginRegistryAddPlgnStrmlwysCB(RwPluginRegistry* reg, RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB) { EAXJMP(0x5C39C0); }
-WRAPPER RwInt32 _rwPluginRegistryAddPlgnStrmRightsCB(RwPluginRegistry* reg, RwUInt32 pluginID, RwPluginDataChunkRightsCallBack rightsCB) { EAXJMP(0x5C39F0); }
-WRAPPER RwPluginRegistry const* _rwPluginRegistryReadDataChunks(RwPluginRegistry const* reg, RwStream* stream, void* object) { EAXJMP(0x5C3A20); }
-WRAPPER RwPluginRegistry const* _rwPluginRegistryInvokeRights(RwPluginRegistry const* reg, RwUInt32 id, void* obj, RwUInt32 extraData) { EAXJMP(0x5C3B50); }
-WRAPPER RwInt32 _rwPluginRegistryGetSize(RwPluginRegistry const* reg, void const* object) { EAXJMP(0x5C3BA0); }
-WRAPPER RwPluginRegistry const* _rwPluginRegistryWriteDataChunks(RwPluginRegistry const* reg, RwStream* stream, void const* object) { EAXJMP(0x5C3BE0); }
-WRAPPER RwPluginRegistry const* _rwPluginRegistrySkipDataChunks(RwPluginRegistry const* reg, RwStream* stream) { EAXJMP(0x5C3CB0); }
-WRAPPER RwCamera* RwCameraStreamRead(RwStream* stream) { EAXJMP(0x5C3D30); }
-WRAPPER RwBBox* RwBBoxCalculate(RwBBox* boundBox, RwV3d const* verts, RwInt32 numVerts) { EAXJMP(0x5C5570); }
-WRAPPER RwImage* RwImageResample(RwImage* dstImage, RwImage const* srcImage) { EAXJMP(0x5C72B0); }
-WRAPPER RwImage* RwImageCreateResample(RwImage const* srcImage, RwInt32 width, RwInt32 height) { EAXJMP(0x5C7B30); }
-WRAPPER RxRenderStateVector* RxRenderStateVectorSetDefaultRenderStateVector(RxRenderStateVector* rsvp) { EAXJMP(0x5D9240); }
-WRAPPER RxRenderStateVector* RxRenderStateVectorCreate(RwBool current) { EAXJMP(0x5D9340); }
-WRAPPER void RxRenderStateVectorDestroy(RxRenderStateVector* rsvp) { EAXJMP(0x5D9410); }
-WRAPPER RxRenderStateVector* RxRenderStateVectorLoadDriverState(RxRenderStateVector* rsvp) { EAXJMP(0x5D9460); }
-WRAPPER void _rxEmbeddedPacketBetweenPipelines(RxPipeline* fromPipeline, RxPipeline* toPipeline) { EAXJMP(0x5D95D0); }
-WRAPPER RxPipelineNode* _rxEmbeddedPacketBetweenNodes(RxPipeline* pipeline, RxPipelineNode* nodeFrom, RwUInt32 whichOutput) { EAXJMP(0x5D9740); }
-WRAPPER void _rxPacketDestroy(RxPacket* Packet) { EAXJMP(0x5D9810); }
-WRAPPER RpMaterialList* _rpMaterialListDeinitialize(RpMaterialList* matList) { EAXJMP(0x5C8B10); }
-WRAPPER RpMaterialList* _rpMaterialListInitialize(RpMaterialList* matList) { EAXJMP(0x5C8B70); }
-WRAPPER RpMaterial* _rpMaterialListGetMaterial(RpMaterialList const* matList, RwInt32 matIndex) { EAXJMP(0x5C8B80); }
-WRAPPER RwInt32 _rpMaterialListAppendMaterial(RpMaterialList* matList, RpMaterial* material) { EAXJMP(0x5C8B90); }
-WRAPPER RwInt32 _rpMaterialListFindMaterialIndex(RpMaterialList const* matList, RpMaterial const* material) { EAXJMP(0x5C8C50); }
-WRAPPER RpMaterialList* _rpMaterialListStreamRead(RwStream* stream, RpMaterialList* matList) { EAXJMP(0x5C8C80); }
-WRAPPER RpMeshHeader* _rpMeshHeaderCreate(RwUInt32 size) { EAXJMP(0x5C8FE0); }
-WRAPPER void* _rpMeshClose(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5C8FF0); }
-WRAPPER void* _rpMeshOpen(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5C9020); }
-WRAPPER RpBuildMesh* _rpBuildMeshCreate(RwUInt32 bufferSize) { EAXJMP(0x5C9140); }
-WRAPPER RwBool _rpBuildMeshDestroy(RpBuildMesh* mesh) { EAXJMP(0x5C9220); }
-WRAPPER RwBool _rpMeshDestroy(RpMeshHeader* mesh) { EAXJMP(0x5C9260); }
-WRAPPER RpBuildMesh* _rpBuildMeshAddTriangle(RpBuildMesh* mesh, RpMaterial* material, RwInt32 vert1, RwInt32 vert2, RwInt32 vert3) { EAXJMP(0x5C92A0); }
-WRAPPER RpMeshHeader* _rpMeshHeaderForAllMeshes(RpMeshHeader* meshHeader, RpMeshCallBack fpCallBack, void* pData) { EAXJMP(0x5C9380); }
-WRAPPER RwStream* _rpMeshWrite(RpMeshHeader const* meshHeader, void const* object, RwStream* stream, RpMaterialList const* matList) { EAXJMP(0x5C93C0); }
-WRAPPER RpMeshHeader* _rpMeshRead(RwStream* stream, void const* object, RpMaterialList const* matList) { EAXJMP(0x5C9510); }
-WRAPPER RwInt32 _rpMeshSize(RpMeshHeader const* meshHeader, void const* object) { EAXJMP(0x5C96E0); }
-WRAPPER RpMeshHeader* RpBuildMeshGenerateDefaultTriStrip(RpBuildMesh* buildmesh, void* data) { EAXJMP(0x5C9730); }
-WRAPPER RpMeshHeader* _rpTriListMeshGenerate(RpBuildMesh* buildMesh, void* data) { EAXJMP(0x5CAE10); }
-WRAPPER RpMeshHeader* _rpMeshOptimise(RpBuildMesh* buildmesh, RwUInt32 flags) { EAXJMP(0x5CB230); }
-WRAPPER RwInt32 RpWorldSectorRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5CB2B0); }
-WRAPPER RwInt32 RpWorldSectorRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5CB2E0); }
-WRAPPER RxPipeline* RpWorldSetDefaultSectorPipeline(RxPipeline* pipeline) { EAXJMP(0x5CB630); }
-WRAPPER RxPipeline* RpAtomicSetDefaultPipeline(RxPipeline* pipeline) { EAXJMP(0x5CB670); }
-WRAPPER void RpHAnimStdKeyFrameToMatrix(RwMatrix* matrix, void* voidIFrame) { EAXJMP(0x5CDEE0); }
-WRAPPER void RpHAnimStdKeyFrameInterpolate(void* voidOut, void* voidIn1, void* voidIn2, RwReal time) { EAXJMP(0x5CE000); }
-WRAPPER void RpHAnimStdKeyFrameBlend(void* voidOut, void* voidIn1, void* voidIn2, RwReal alpha) { EAXJMP(0x5CE420); }
-WRAPPER RpHAnimAnimation* RpHAnimStdKeyFrameStreamRead(RwStream* stream, RpHAnimAnimation* animation) { EAXJMP(0x5CE820); }
-WRAPPER RwBool RpHAnimStdKeyFrameStreamWrite(RpHAnimAnimation* animation, RwStream* stream) { EAXJMP(0x5CE8C0); }
-WRAPPER RwInt32 RpHAnimStdKeyFrameStreamGetSize(RpHAnimAnimation* animation) { EAXJMP(0x5CE930); }
-WRAPPER void RpHAnimStdKeyFrameMulRecip(void* voidFrame, void* voidStart) { EAXJMP(0x5CE950); }
-WRAPPER void RpHAnimStdKeyFrameAdd(void* voidOut, void* voidIn1, void* voidIn2) { EAXJMP(0x5CEAB0); }
-WRAPPER void RxHeapFree(RxHeap* heap, void* block) { EAXJMP(0x5D1070); }
-WRAPPER void* RxHeapAlloc(RxHeap* heap, RwUInt32 size) { EAXJMP(0x5D1260); }
-WRAPPER void* RxHeapRealloc(RxHeap* heap, void* block, RwUInt32 newSize, RwBool allowCopy) { EAXJMP(0x5D14D0); }
-WRAPPER RwBool _rxHeapReset(RxHeap* heap) { EAXJMP(0x5D1680); }
-WRAPPER void RxHeapDestroy(RxHeap* heap) { EAXJMP(0x5D16F0); }
-WRAPPER RxHeap* RxHeapCreate(RwUInt32 size) { EAXJMP(0x5D1750); }
-WRAPPER RxNodeOutput RxPipelineNodeFindOutputByName(RxPipelineNode* node, RwChar const* outputname) { EAXJMP(0x5D1EC0); }
-WRAPPER RxNodeInput RxPipelineNodeFindInput(RxPipelineNode* node) { EAXJMP(0x5D1F20); }
-WRAPPER RxPipeline* RxPipelineNodeRequestCluster(RxPipeline* pipeline, RxPipelineNode* node, RxClusterDefinition* clusterDef) { EAXJMP(0x5D1F30); }
-WRAPPER RxPipeline* RxLockedPipeUnlock(RxLockedPipe* pipeline) { EAXJMP(0x5D1FA0); }
-WRAPPER RxLockedPipe* RxPipelineLock(RxPipeline* pipeline) { EAXJMP(0x5D29F0); }
-WRAPPER RxPipelineNode* RxPipelineFindNodeByName(RxPipeline* pipeline, RwChar const* name, RxPipelineNode* start, RwInt32* nodeIndex) { EAXJMP(0x5D2B10); }
-WRAPPER RxLockedPipe* RxLockedPipeAddFragment(RxLockedPipe *pipeline, RwUInt32 *firstIndex, RxNodeDefinition *nodeDef0, ...) { EAXJMP(0x5D2BA0); }
-WRAPPER RxPipeline* RxLockedPipeAddPath(RxLockedPipe* pipeline, RxNodeOutput out, RxNodeInput in) { EAXJMP(0x5D2EE0); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmRenderSetup() { EAXJMP(0x5D31C0); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmMangleTriangleIndices() { EAXJMP(0x5D35C0); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetCullTriangle() { EAXJMP(0x5D3C60); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetClipTriangle() { EAXJMP(0x5D4F80); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetSubmitTriangle() { EAXJMP(0x5D51C0); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmInstance() { EAXJMP(0x5D5400); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetTransform() { EAXJMP(0x5D6000); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmStash() { EAXJMP(0x5D61C0); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmMangleLineIndices() { EAXJMP(0x5D6470); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetClipLine() { EAXJMP(0x5D7230); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetSubmitLine() { EAXJMP(0x5D74C0); }
-WRAPPER RwBool _rwD3D8LightsOpen() { EAXJMP(0x5D9C90); }
-WRAPPER void _rwD3D8LightsClose() { EAXJMP(0x5D9EF0); }
-WRAPPER RwBool _rwD3D8LightsGlobalEnable(RpLightFlag flags) { EAXJMP(0x5D9F80); }
-WRAPPER RwBool _rwD3D8LightLocalEnable(RpLight* light) { EAXJMP(0x5DA210); }
-WRAPPER void _rwD3D8LightsEnable(RwBool enable, RwUInt32 type) { EAXJMP(0x5DA450); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetD3D8WorldSectorAllInOne() { EAXJMP(0x5DAAC0); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetD3D8AtomicAllInOne() { EAXJMP(0x5DC500); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetWorldSectorInstance() { EAXJMP(0x5DCC50); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetWorldSectorEnumerateLights() { EAXJMP(0x5DCD80); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetAtomicInstance() { EAXJMP(0x5DD800); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetAtomicEnumerateLights() { EAXJMP(0x5DD9B0); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetMaterialScatter() { EAXJMP(0x5DDAA0); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetLight() { EAXJMP(0x5DF040); }
-WRAPPER RxNodeDefinition* RxNodeDefinitionGetPostLight() { EAXJMP(0x5DF560); }
-WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); } \ No newline at end of file
diff --git a/src/core/timebars.cpp b/src/core/timebars.cpp
index 30421731..93d85f8d 100644
--- a/src/core/timebars.cpp
+++ b/src/core/timebars.cpp
@@ -1,121 +1,121 @@
-#ifndef MASTER
-#include "common.h"
-#include "Font.h"
-#include "Frontend.h"
-#include "Timer.h"
-#include "Text.h"
-
-#define MAX_TIMERS (50)
-#define MAX_MS_COLLECTED (40)
-
-// enables frame time output
-#define FRAMETIME
-
-struct sTimeBar
-{
- char name[20];
- float startTime;
- float endTime;
- int32 unk;
-};
-
-struct
-{
- sTimeBar Timers[MAX_TIMERS];
- uint32 count;
-} TimerBar;
-float MaxTimes[MAX_TIMERS];
-float MaxFrameTime;
-
-uint32 curMS;
-uint32 msCollected[MAX_MS_COLLECTED];
-#ifdef FRAMETIME
-float FrameInitTime;
-#endif
-
-void tbInit()
-{
- TimerBar.count = 0;
- uint32 i = CTimer::GetFrameCounter() & 0x7F;
- if (i == 0) {
- do
- MaxTimes[i++] = 0.0f;
- while (i != MAX_TIMERS);
-#ifdef FRAMETIME
- MaxFrameTime = 0.0f;
-#endif
- }
-#ifdef FRAMETIME
- FrameInitTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame();
-#endif
-}
-
-void tbStartTimer(int32 unk, char *name)
-{
- strcpy(TimerBar.Timers[TimerBar.count].name, name);
- TimerBar.Timers[TimerBar.count].unk = unk;
- TimerBar.Timers[TimerBar.count].startTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame();
- TimerBar.count++;
-}
-
-void tbEndTimer(char* name)
-{
- uint32 n = 1500;
- for (uint32 i = 0; i < TimerBar.count; i++) {
- if (strcmp(name, TimerBar.Timers[i].name) == 0)
- n = i;
- }
- assert(n != 1500);
- TimerBar.Timers[n].endTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame();
-}
-
-float Diag_GetFPS()
-{
- return 39000.0f / (msCollected[(curMS - 1) % MAX_MS_COLLECTED] - msCollected[curMS % MAX_MS_COLLECTED]);
-}
-
-void tbDisplay()
-{
- char temp[200];
- wchar wtemp[200];
-
-#ifdef FRAMETIME
- float FrameEndTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame();
-#endif
-
- msCollected[(curMS++) % MAX_MS_COLLECTED] = RsTimer();
- CFont::SetBackgroundOff();
- CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
- CFont::SetScale(0.48f, 1.12f);
- CFont::SetCentreOff();
- CFont::SetJustifyOff();
- CFont::SetWrapx(640.0f);
- CFont::SetRightJustifyOff();
- CFont::SetPropOn();
- CFont::SetFontStyle(FONT_BANK);
- sprintf(temp, "FPS: %.2f", Diag_GetFPS());
- AsciiToUnicode(temp, wtemp);
- CFont::SetColor(CRGBA(255, 255, 255, 255));
- if (!CMenuManager::m_PrefsMarketing || !CMenuManager::m_PrefsDisableTutorials) {
- CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * (4.0f / DEFAULT_SCREEN_HEIGHT), wtemp);
-
-#ifndef FINAL
- // Timers output (my own implementation)
- for (uint32 i = 0; i < TimerBar.count; i++) {
- MaxTimes[i] = max(MaxTimes[i], TimerBar.Timers[i].endTime - TimerBar.Timers[i].startTime);
- sprintf(temp, "%s: %.2f", &TimerBar.Timers[i].name[0], MaxTimes[i]);
- AsciiToUnicode(temp, wtemp);
- CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (i + 2)) / DEFAULT_SCREEN_HEIGHT), wtemp);
- }
-
-#ifdef FRAMETIME
- MaxFrameTime = max(MaxFrameTime, FrameEndTime - FrameInitTime);
- sprintf(temp, "Frame Time: %.2f", MaxFrameTime);
- AsciiToUnicode(temp, wtemp);
-
- CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (TimerBar.count + 4)) / DEFAULT_SCREEN_HEIGHT), wtemp);
-#endif // FRAMETIME
-#endif // !FINAL
- }
-}
+#ifndef MASTER
+#include "common.h"
+#include "Font.h"
+#include "Frontend.h"
+#include "Timer.h"
+#include "Text.h"
+
+#define MAX_TIMERS (50)
+#define MAX_MS_COLLECTED (40)
+
+// enables frame time output
+#define FRAMETIME
+
+struct sTimeBar
+{
+ char name[20];
+ float startTime;
+ float endTime;
+ int32 unk;
+};
+
+struct
+{
+ sTimeBar Timers[MAX_TIMERS];
+ uint32 count;
+} TimerBar;
+float MaxTimes[MAX_TIMERS];
+float MaxFrameTime;
+
+uint32 curMS;
+uint32 msCollected[MAX_MS_COLLECTED];
+#ifdef FRAMETIME
+float FrameInitTime;
+#endif
+
+void tbInit()
+{
+ TimerBar.count = 0;
+ uint32 i = CTimer::GetFrameCounter() & 0x7F;
+ if (i == 0) {
+ do
+ MaxTimes[i++] = 0.0f;
+ while (i != MAX_TIMERS);
+#ifdef FRAMETIME
+ MaxFrameTime = 0.0f;
+#endif
+ }
+#ifdef FRAMETIME
+ FrameInitTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame();
+#endif
+}
+
+void tbStartTimer(int32 unk, char *name)
+{
+ strcpy(TimerBar.Timers[TimerBar.count].name, name);
+ TimerBar.Timers[TimerBar.count].unk = unk;
+ TimerBar.Timers[TimerBar.count].startTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame();
+ TimerBar.count++;
+}
+
+void tbEndTimer(char* name)
+{
+ uint32 n = 1500;
+ for (uint32 i = 0; i < TimerBar.count; i++) {
+ if (strcmp(name, TimerBar.Timers[i].name) == 0)
+ n = i;
+ }
+ assert(n != 1500);
+ TimerBar.Timers[n].endTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame();
+}
+
+float Diag_GetFPS()
+{
+ return 39000.0f / (msCollected[(curMS - 1) % MAX_MS_COLLECTED] - msCollected[curMS % MAX_MS_COLLECTED]);
+}
+
+void tbDisplay()
+{
+ char temp[200];
+ wchar wtemp[200];
+
+#ifdef FRAMETIME
+ float FrameEndTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame();
+#endif
+
+ msCollected[(curMS++) % MAX_MS_COLLECTED] = RsTimer();
+ CFont::SetBackgroundOff();
+ CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
+ CFont::SetScale(0.48f, 1.12f);
+ CFont::SetCentreOff();
+ CFont::SetJustifyOff();
+ CFont::SetWrapx(640.0f);
+ CFont::SetRightJustifyOff();
+ CFont::SetPropOn();
+ CFont::SetFontStyle(FONT_BANK);
+ sprintf(temp, "FPS: %.2f", Diag_GetFPS());
+ AsciiToUnicode(temp, wtemp);
+ CFont::SetColor(CRGBA(255, 255, 255, 255));
+ if (!CMenuManager::m_PrefsMarketing || !CMenuManager::m_PrefsDisableTutorials) {
+ CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * (4.0f / DEFAULT_SCREEN_HEIGHT), wtemp);
+
+#ifndef FINAL
+ // Timers output (my own implementation)
+ for (uint32 i = 0; i < TimerBar.count; i++) {
+ MaxTimes[i] = max(MaxTimes[i], TimerBar.Timers[i].endTime - TimerBar.Timers[i].startTime);
+ sprintf(temp, "%s: %.2f", &TimerBar.Timers[i].name[0], MaxTimes[i]);
+ AsciiToUnicode(temp, wtemp);
+ CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (i + 2)) / DEFAULT_SCREEN_HEIGHT), wtemp);
+ }
+
+#ifdef FRAMETIME
+ MaxFrameTime = max(MaxFrameTime, FrameEndTime - FrameInitTime);
+ sprintf(temp, "Frame Time: %.2f", MaxFrameTime);
+ AsciiToUnicode(temp, wtemp);
+
+ CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (TimerBar.count + 4)) / DEFAULT_SCREEN_HEIGHT), wtemp);
+#endif // FRAMETIME
+#endif // !FINAL
+ }
+}
#endif // !MASTER \ No newline at end of file
diff --git a/src/core/timebars.h b/src/core/timebars.h
index 8ffccd8e..6d3b853e 100644
--- a/src/core/timebars.h
+++ b/src/core/timebars.h
@@ -1,6 +1,6 @@
-#pragma once
-
-void tbInit();
-void tbStartTimer(int32, char*);
-void tbEndTimer(char*);
+#pragma once
+
+void tbInit();
+void tbStartTimer(int32, char*);
+void tbEndTimer(char*);
void tbDisplay(); \ No newline at end of file