summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/AnimViewer.cpp163
-rw-r--r--src/core/Cam.cpp511
-rw-r--r--src/core/Camera.cpp643
-rw-r--r--src/core/Camera.h48
-rw-r--r--src/core/CdStreamPosix.cpp16
-rw-r--r--src/core/Collision.cpp243
-rw-r--r--src/core/Collision.h32
-rw-r--r--src/core/Directory.cpp3
-rw-r--r--src/core/FileLoader.cpp16
-rw-r--r--src/core/FileMgr.cpp49
-rw-r--r--src/core/FileMgr.h7
-rw-r--r--src/core/Fire.cpp7
-rw-r--r--src/core/FrontEndControls.cpp82
-rw-r--r--src/core/FrontEndControls.h44
-rw-r--r--src/core/Frontend.cpp489
-rw-r--r--src/core/Frontend.h64
-rw-r--r--src/core/FrontendTriggers.h1393
-rw-r--r--src/core/Frontend_PS2.cpp3034
-rw-r--r--src/core/Frontend_PS2.h244
-rw-r--r--src/core/Game.cpp203
-rw-r--r--src/core/Game.h2
-rw-r--r--src/core/General.h2
-rw-r--r--src/core/MenuScreens.cpp (renamed from src/core/MenuScreens.h)93
-rw-r--r--src/core/Pad.cpp977
-rw-r--r--src/core/Pad.h28
-rw-r--r--src/core/PlayerInfo.cpp10
-rw-r--r--src/core/Pools.cpp43
-rw-r--r--src/core/Radar.cpp6
-rw-r--r--src/core/Range2D.cpp28
-rw-r--r--src/core/Range2D.h11
-rw-r--r--src/core/Range3D.cpp30
-rw-r--r--src/core/Range3D.h11
-rw-r--r--src/core/Stats.cpp4
-rw-r--r--src/core/Stats.h4
-rw-r--r--src/core/Streaming.cpp37
-rw-r--r--src/core/Streaming.h12
-rw-r--r--src/core/SurfaceTable.cpp100
-rw-r--r--src/core/SurfaceTable.h67
-rw-r--r--src/core/TempColModels.cpp36
-rw-r--r--src/core/Timer.h3
-rw-r--r--src/core/Wanted.cpp36
-rw-r--r--src/core/World.cpp70
-rw-r--r--src/core/World.h4
-rw-r--r--src/core/Zones.cpp8
-rw-r--r--src/core/common.h25
-rw-r--r--src/core/config.h57
-rw-r--r--src/core/main.cpp91
-rw-r--r--src/core/main.h3
-rw-r--r--src/core/patcher.cpp94
-rw-r--r--src/core/patcher.h144
-rw-r--r--src/core/re3.cpp135
51 files changed, 7704 insertions, 1758 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index f49f811f..c8d8cb56 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -47,6 +47,12 @@ CAnimViewer::Render(void) {
if (pTarget) {
// pTarget->GetPosition() = CVector(0.0f, 0.0f, 0.0f);
if (pTarget) {
+#ifdef FIX_BUGS
+#ifdef PED_SKIN
+ if(pTarget->IsPed())
+ ((CPed*)pTarget)->UpdateRpHAnim();
+#endif
+#endif
pTarget->Render();
CRenderer::RenderOneNonRoad(pTarget);
}
@@ -67,11 +73,7 @@ CAnimViewer::Initialise(void) {
CReferences::Init();
TheCamera.Init();
TheCamera.SetRwCamera(Scene.camera);
-
- // I didn't get which camera og code selects.
- for (int i = 0; i < 3; i++) {
- TheCamera.Cams[i].Distance = 5.0f;
- }
+ TheCamera.Cams[TheCamera.ActiveCam].Distance = 5.0f;
gbModelViewer = true;
CHud::m_Wants_To_Draw_Hud = false;
@@ -146,30 +148,33 @@ int
LastPedModelId(int modelId)
{
CBaseModelInfo *model;
- for (int i = modelId; i >= 0; i--) {
- model = CModelInfo::GetModelInfo(i);
- if (model->GetModelType() == MITYPE_PED)
- return i;
+ for(;;){
+ assert(modelId < MODELINFOSIZE);
+ model = CModelInfo::GetModelInfo(modelId);
+ if (model && model->GetModelType() == MITYPE_PED)
+ break;
+ modelId--;
}
return modelId;
}
int
-LastVehicleModelId(int modelId)
+FirstCarModelId(int modelId)
{
- CBaseModelInfo* model;
- for (int i = modelId; i >= 0; i--) {
- model = CModelInfo::GetModelInfo(i);
- if (model->GetModelType() == MITYPE_VEHICLE)
- return i;
+ CBaseModelInfo *model;
+ for(;;){
+ assert(modelId < MODELINFOSIZE);
+ model = CModelInfo::GetModelInfo(modelId);
+ if (model && model->GetModelType() == MITYPE_VEHICLE)
+ break;
+ modelId++;
}
return modelId;
}
-// It's me that named this.
int
-FindMeAModelID(int modelId, int wantedChange)
+NextModelId(int modelId, int wantedChange)
{
// Max. 2 trials wasn't here, it's me that added it.
@@ -220,7 +225,6 @@ CAnimViewer::Update(void)
AssocGroupId animGroup = ASSOCGRP_STD;
int nextModelId = modelId;
CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId);
- CEntity *newEntity = nil;
if (modelInfo->GetModelType() == MITYPE_PED) {
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
@@ -261,40 +265,30 @@ CAnimViewer::Update(void)
if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo;
- if (veh->m_vehicleType != VEHICLE_TYPE_CAR) {
- // Not ready yet
-/* if (veh->m_vehicleType == VEHICLE_TYPE_BOAT)
- {
- v33 = (CBoat*)CVehicle::operator new((CVehicle*)0x488, v6);
- CBoat::CBoat(v33, modelId, 1u);
- newEntity = (int)v33;
- pTarget = (int)v33;
- }
- else
- {
-*/ newEntity = pTarget = new CObject(modelId, true);
- if (!modelInfo->GetColModel()) {
- modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
- }
-// }
+ if (veh->m_vehicleType == VEHICLE_TYPE_CAR) {
+ pTarget = new CAutomobile(modelId, RANDOM_VEHICLE);
+ } else if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) {
+ pTarget = new CBoat(modelId, RANDOM_VEHICLE);
} else {
- newEntity = pTarget = new CAutomobile(modelId, RANDOM_VEHICLE);
- newEntity->SetStatus(STATUS_ABANDONED);
+ pTarget = new CObject(modelId, true);
+ if (!modelInfo->GetColModel()) {
+ modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
+ }
}
- newEntity->bIsStuck = true;
+ pTarget->SetStatus(STATUS_ABANDONED);
} else if (modelInfo->GetModelType() == MITYPE_PED) {
- pTarget = newEntity = new CPed(PEDTYPE_CIVMALE);
- newEntity->SetModelIndex(modelId);
+ pTarget = new CPed(PEDTYPE_CIVMALE);
+ pTarget->SetModelIndex(modelId);
} else {
- newEntity = pTarget = new CObject(modelId, true);
+ pTarget = new CObject(modelId, true);
if (!modelInfo->GetColModel())
{
modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
}
- newEntity->bIsStuck = true;
+ pTarget->SetStatus(STATUS_ABANDONED);
}
- newEntity->SetPosition(0.0f, 0.0f, 0.0f);
- CWorld::Add(newEntity);
+ pTarget->SetPosition(0.0f, 0.0f, 0.0f);
+ CWorld::Add(pTarget);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT);
}
if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) {
@@ -302,43 +296,26 @@ CAnimViewer::Update(void)
}
pTarget->GetMatrix().GetPosition().z = 0.0f;
- if (modelInfo->GetModelType() != MITYPE_PED) {
-
- if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
-
- if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
- nextModelId = LastPedModelId(modelId);
- AsciiToUnicode("Switched to peds", gUString);
- CMessages::AddMessage(gUString, 1000, 0);
- } else {
- // Start in mobile
- if (pad->NewState.Square && !pad->OldState.Square) {
- CVehicleModelInfo::LoadVehicleColours();
- AsciiToUnicode("Carcols.dat reloaded", gUString);
- CMessages::AddMessage(gUString, 1000, 0);
- }
- }
- }
- } else {
+ if (modelInfo->GetModelType() == MITYPE_PED) {
((CPed*)pTarget)->bKindaStayInSamePlace = true;
// Triangle in mobile
- if (pad->NewState.Square && !pad->OldState.Square) {
+ if (pad->GetSquareJustDown()) {
reloadIFP = 1;
AsciiToUnicode("IFP reloaded", gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.Cross && !pad->OldState.Cross) {
+ } else if (pad->GetCrossJustDown()) {
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
AsciiToUnicode("Animation restarted", gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.Circle && !pad->OldState.Circle) {
+ } else if (pad->GetCircleJustDown()) {
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE);
AsciiToUnicode("Idle animation playing", gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.DPadUp && pad->OldState.DPadUp == 0) {
+ } else if (pad->GetDPadUpJustDown()) {
animId--;
if (animId < 0) {
animId = NUM_ANIMS - 1;
@@ -349,7 +326,7 @@ CAnimViewer::Update(void)
AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.DPadDown && !pad->OldState.DPadDown) {
+ } else if (pad->GetDPadDownJustDown()) {
animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1);
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
@@ -357,42 +334,48 @@ CAnimViewer::Update(void)
AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else {
- if (pad->NewState.Start && !pad->OldState.Start) {
+ } else if (pad->GetStartJustDown()) {
- } else {
- if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
- nextModelId = LastVehicleModelId(modelId);
- AsciiToUnicode("Switched to vehicles", gUString);
- CMessages::AddMessage(gUString, 1000, 0);
- } else {
- // Originally it was GetPad(1)->LeftShoulder2
- if (pad->NewState.Triangle) {
+ } else if (pad->GetLeftShoulder1JustDown()) {
+ nextModelId = FirstCarModelId(modelId);
+ AsciiToUnicode("Switched to vehicles", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
+ // Originally it was GetPad(1)->LeftShoulder2
+ } else if (pad->NewState.Triangle) {
#ifdef PED_SKIN
- if(IsClumpSkinned(pTarget->GetClump()))
- ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump());
- else
+ if(IsClumpSkinned(pTarget->GetClump()))
+ ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump());
+ else
#endif
- CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(),
- RpClumpGetFrame(pTarget->GetClump()));
- AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
- CMessages::AddMessage(gUString, 100, 0);
- }
- }
- }
+ CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(),
+ RpClumpGetFrame(pTarget->GetClump()));
+ AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
+ CMessages::AddMessage(gUString, 100, 0);
+ }
+ } else if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
+
+ if (pad->GetLeftShoulder1JustDown()) {
+ nextModelId = LastPedModelId(modelId);
+ AsciiToUnicode("Switched to peds", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
+ // Start in mobile
+ } else if (pad->GetSquareJustDown()) {
+ CVehicleModelInfo::LoadVehicleColours();
+ AsciiToUnicode("Carcols.dat reloaded", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
}
}
}
- if (pad->NewState.DPadLeft && pad->OldState.DPadLeft == 0) {
- nextModelId = FindMeAModelID(modelId, -1);
+ if (pad->GetDPadLeftJustDown()) {
+ nextModelId = NextModelId(modelId, -1);
sprintf(gString, "Current model ID: %d", nextModelId);
AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.DPadRight && pad->OldState.DPadRight == 0) {
- nextModelId = FindMeAModelID(modelId, 1);
+ } else if (pad->GetDPadRightJustDown()) {
+ nextModelId = NextModelId(modelId, 1);
sprintf(gString, "Current model ID: %d", nextModelId);
AsciiToUnicode(gString, gUString);
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 6c79604c..fcffce9b 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -5,6 +5,7 @@
#include "World.h"
#include "Vehicle.h"
#include "Automobile.h"
+#include "Boat.h"
#include "Ped.h"
#include "PlayerPed.h"
#include "CopPed.h"
@@ -29,7 +30,7 @@ bool PrintDebugCode = false;
int16 DebugCamMode;
#ifdef FREE_CAM
-bool CCamera::bFreeCam = true;
+bool CCamera::bFreeCam;
int nPreviousMode = -1;
#endif
@@ -39,11 +40,11 @@ CCam::Init(void)
Mode = MODE_FOLLOWPED;
Front = CVector(0.0f, 0.0f, -1.0f);
Up = CVector(0.0f, 0.0f, 1.0f);
- Rotating = 0;
+ Rotating = false;
m_iDoCollisionChecksOnFrameNum = 1;
m_iDoCollisionCheckEveryNumOfFrames = 9;
m_iFrameNumWereAt = 0;
- m_bCollisionChecksOn = 1;
+ m_bCollisionChecksOn = false;
m_fRealGroundDist = 0.0f;
BetaSpeed = 0.0f;
AlphaSpeed = 0.0f;
@@ -51,21 +52,21 @@ CCam::Init(void)
f_max_role_angle = DEGTORAD(5.0f);
Distance = 30.0f;
DistanceSpeed = 0.0f;
- m_pLastCarEntered = 0;
- m_pLastPedLookedAt = 0;
- ResetStatics = 1;
+ m_pLastCarEntered = nil;
+ m_pLastPedLookedAt = nil;
+ ResetStatics = true;
Beta = 0.0f;
- m_bFixingBeta = 0;
+ m_bFixingBeta = false;
CA_MIN_DISTANCE = 0.0f;
CA_MAX_DISTANCE = 0.0f;
- LookingBehind = 0;
- LookingLeft = 0;
- LookingRight = 0;
+ LookingBehind = false;
+ LookingLeft = false;
+ LookingRight = false;
m_fPlayerInFrontSyphonAngleOffSet = DEGTORAD(20.0f);
m_fSyphonModeTargetZOffSet = 0.5f;
m_fRadiusForDead = 1.5f;
DirectionWasLooking = LOOKING_FORWARD;
- LookBehindCamWasInFront = 0;
+ LookBehindCamWasInFront = false;
f_Roll = 0.0f;
f_rollSpeed = 0.0f;
m_fCloseInPedHeightOffset = 0.0f;
@@ -110,7 +111,11 @@ CCam::Process(void)
Fwd.x = CamTargetEntity->GetForward().x;
Fwd.y = CamTargetEntity->GetForward().y;
Fwd.Normalise();
- // Game normalizes again here manually. useless, so skipped
+ float FwdLength = Fwd.Magnitude2D();
+ if(FwdLength != 0.0f){
+ Fwd.x /= FwdLength;
+ Fwd.y /= FwdLength;
+ }
float FwdSpeedX = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().x * Fwd.x;
float FwdSpeedY = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().y * Fwd.y;
@@ -162,7 +167,9 @@ CCam::Process(void)
case MODE_MODELVIEW:
Process_ModelView(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
-// case MODE_BILL:
+ case MODE_BILL:
+ Process_Bill(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
case MODE_SYPHON:
Process_Syphon(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
@@ -210,10 +217,18 @@ CCam::Process(void)
case MODE_PLAYER_FALLEN_WATER:
Process_Player_Fallen_Water(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
-// case MODE_CAM_ON_TRAIN_ROOF:
-// case MODE_CAM_RUNNING_SIDE_TRAIN:
-// case MODE_BLOOD_ON_THE_TRACKS:
-// case MODE_IM_THE_PASSENGER_WOOWOO:
+ case MODE_CAM_ON_TRAIN_ROOF:
+ Process_Cam_On_Train_Roof(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_CAM_RUNNING_SIDE_TRAIN:
+ Process_Cam_Running_Side_Train(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_BLOOD_ON_THE_TRACKS:
+ Process_Blood_On_The_Tracks(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_IM_THE_PASSENGER_WOOWOO:
+ Process_Im_The_Passenger_Woo_Woo(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
case MODE_SYPHON_CRIM_IN_FRONT:
Process_Syphon_Crim_In_Front(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
@@ -263,7 +278,7 @@ CCam::Process(void)
CVector TargetToCam = Source - m_cvecTargetCoorsForFudgeInter;
float DistOnGround = TargetToCam.Magnitude2D();
m_fTrueBeta = CGeneral::GetATanOfXY(TargetToCam.x, TargetToCam.y);
- m_fTrueAlpha = CGeneral::GetATanOfXY(TargetToCam.z, DistOnGround);
+ m_fTrueAlpha = CGeneral::GetATanOfXY(DistOnGround, TargetToCam.z);
if(TheCamera.m_uiTransitionState == 0)
KeepTrackOfTheSpeed(Source, m_cvecTargetCoorsForFudgeInter, Up, m_fTrueAlpha, m_fTrueBeta, FOV);
@@ -419,11 +434,11 @@ CCam::ProcessSpecialHeightRoutines(void)
float DistScale = (2.1f - dist)/2.1f;
if(Mode == MODE_FOLLOWPED){
if(TheCamera.PedZoomIndicator == CAM_ZOOM_1)
- Offset = 0.45*DistScale + PedZDist;
+ Offset = 0.45f*DistScale + PedZDist;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_2)
- Offset = 0.35*DistScale + PedZDist;
+ Offset = 0.35f*DistScale + PedZDist;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_3)
- Offset = 0.25*DistScale + PedZDist;
+ Offset = 0.25f*DistScale + PedZDist;
if(Abs(CGeneral::GetRadianAngleBetweenPoints(CamToPed.x, CamToPed.y, CamToTarget.x, CamToTarget.y)) > HALFPI)
Offset += 0.3f;
m_fPedBetweenCameraHeightOffset = Offset + 1.3f;
@@ -504,11 +519,11 @@ CCam::ProcessSpecialHeightRoutines(void)
switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched)
case SURFACE_GRASS:
- case SURFACE_DIRT:
- case SURFACE_DIRTTRACK:
- case SURFACE_STEEL:
- case SURFACE_TIRE:
- case SURFACE_STONE:
+ case SURFACE_GRAVEL:
+ case SURFACE_MUD_DRY:
+ case SURFACE_THICK_METAL_PLATE:
+ case SURFACE_RUBBER:
+ case SURFACE_STEEP_CLIFF:
OnRoad = true;
if(CCullZones::PlayerNoRain())
@@ -565,9 +580,9 @@ CCam::ProcessSpecialHeightRoutines(void)
if(PreviouslyFailedRoadHeightCheck && m_fCloseInPedHeightOffset < 0.0001f){
if(colPoint.surfaceB != SURFACE_TARMAC &&
colPoint.surfaceB != SURFACE_GRASS &&
- colPoint.surfaceB != SURFACE_DIRT &&
- colPoint.surfaceB != SURFACE_DIRTTRACK &&
- colPoint.surfaceB != SURFACE_STONE){
+ colPoint.surfaceB != SURFACE_GRAVEL &&
+ colPoint.surfaceB != SURFACE_MUD_DRY &&
+ colPoint.surfaceB != SURFACE_STEEP_CLIFF){
if(m_fRoadOffSet > 1.4f)
m_fRoadOffSet = 1.4f;
}else{
@@ -795,7 +810,7 @@ CCam::ClipIfPedInFrontOfPlayer(void)
while(DeltaAngle >= PI) DeltaAngle -= 2*PI;
while(DeltaAngle < -PI) DeltaAngle += 2*PI;
if(Abs(DeltaAngle) < HALFPI){
- fDist = Sqrt(SQR(vDist.x) + SQR(vDist.y));
+ fDist = vDist.Magnitude2D();
if(fDist < 1.25f){
Near = DEFAULT_NEAR - (1.25f - fDist);
if(Near < 0.05f)
@@ -822,9 +837,9 @@ CCam::KeepTrackOfTheSpeed(const CVector &source, const CVector &target, const CV
PreviousUp = up;
}
- m_cvecSourceSpeedOverOneFrame = PreviousSource - source;
- m_cvecTargetSpeedOverOneFrame = PreviousTarget - target;
- m_cvecUpOverOneFrame = PreviousUp - up;
+ m_cvecSourceSpeedOverOneFrame = source - PreviousSource;
+ m_cvecTargetSpeedOverOneFrame = target - PreviousTarget;
+ m_cvecUpOverOneFrame = up - PreviousUp;
m_fFovSpeedOverOneFrame = fov - PreviousFov;
m_fBetaSpeedOverOneFrame = beta - PreviousBeta;
MakeAngleLessThan180(m_fBetaSpeedOverOneFrame);
@@ -846,17 +861,13 @@ CCam::Using3rdPersonMouseCam(void)
(Mode == MODE_FOLLOWPED ||
TheCamera.m_bPlayerIsInGarage &&
FindPlayerPed() && FindPlayerPed()->m_nPedState != PED_DRIVING &&
- Mode != MODE_TOPDOWN && this->CamTargetEntity == FindPlayerPed());
+ Mode != MODE_TOPDOWN && CamTargetEntity == FindPlayerPed());
}
bool
CCam::GetWeaponFirstPersonOn(void)
{
- CEntity *target = this->CamTargetEntity;
- if (target && target->IsPed())
- return ((CPed*)target)->GetWeapon()->m_bAddRotOffset;
-
- return false;
+ return CamTargetEntity && CamTargetEntity->IsPed() && ((CPed*)CamTargetEntity)->GetWeapon()->m_bAddRotOffset;
}
bool
@@ -992,12 +1003,15 @@ CCam::GetPedBetaAngleForClearView(const CVector &Target, float Dist, float BetaO
return 0.0f;
}
-static float DefaultAcceleration = 0.045f;
-static float DefaultMaxStep = 0.15f;
+float DefaultAcceleration = 0.045f;
+float DefaultMaxStep = 0.15f;
void
CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float)
{
+ if(!CamTargetEntity->IsPed())
+ return;
+
const float GroundDist = 1.85f;
CVector TargetCoors, Dist, IdealSource;
@@ -1014,7 +1028,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bool GoingBehind = false;
bool Obscured = false;
bool BuildingCheckObscured = false;
- bool HackPlayerOnStoppingTrain = false;
+ bool StandingInTrain = false;
static int TimeIndicatedWantedToGoDown = 0;
static bool StartedCountingForGoDown = false;
float DeltaBeta;
@@ -1023,12 +1037,6 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bBelowMinDist = false;
bBehindPlayerDesired = false;
-#ifdef FIX_BUGS
- if(!CamTargetEntity->IsPed())
- return;
-#endif
- assert(CamTargetEntity->IsPed());
-
// CenterDist should be > LateralDist because we don't have an angle for safety in this case
float CenterDist, LateralDist;
float AngleToGoToSpeed;
@@ -1094,7 +1102,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
if(FindPlayerVehicle())
if(FindPlayerVehicle()->m_vehType == VEHICLE_TYPE_TRAIN)
- HackPlayerOnStoppingTrain = true;
+ StandingInTrain = true;
if(TheCamera.m_bCamDirectlyInFront){
m_bCollisionChecksOn = true;
@@ -1347,7 +1355,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
if(TheCamera.m_bCamDirectlyBehind || TheCamera.m_bCamDirectlyInFront ||
- HackPlayerOnStoppingTrain || Rotating){
+ StandingInTrain || Rotating){
if(TheCamera.m_bCamDirectlyBehind){
Beta = TargetOrientation + PI;
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
@@ -1358,7 +1366,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
}
- if(HackPlayerOnStoppingTrain){
+ if(StandingInTrain){
Beta = TargetOrientation + PI;
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
@@ -1408,11 +1416,11 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bool foo = false;
switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched)
case SURFACE_GRASS:
- case SURFACE_DIRT:
+ case SURFACE_GRAVEL:
case SURFACE_PAVEMENT:
- case SURFACE_STEEL:
- case SURFACE_TIRE:
- case SURFACE_STONE:
+ case SURFACE_THICK_METAL_PLATE:
+ case SURFACE_RUBBER:
+ case SURFACE_STEEP_CLIFF:
foo = true;
if(foo)
WellBufferMe(TargetHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.4f, 0.05f, false);
@@ -1467,14 +1475,14 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
ResetStatics = false;
}
-static float fBaseDist = 1.7f;
-static float fAngleDist = 2.0f;
-static float fFalloff = 3.0f;
-static float fStickSens = 0.01f;
-static float fTweakFOV = 1.05f;
-static float fTranslateCamUp = 0.8f;
-static int16 nFadeControlThreshhold = 45;
-static float fDefaultAlphaOrient = -0.22f;
+float fBaseDist = 1.7f;
+float fAngleDist = 2.0f;
+float fFalloff = 3.0f;
+float fStickSens = 0.01f;
+float fTweakFOV = 1.05f;
+float fTranslateCamUp = 0.8f;
+int16 nFadeControlThreshhold = 45;
+float fDefaultAlphaOrient = -0.22f;
void
CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float)
@@ -1516,8 +1524,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
- BetaOffset = LookLeftRight * fStickSens * (0.5f/7.0f) * FOV/80.0f * CTimer::GetTimeStep();
- AlphaOffset = LookUpDown * fStickSens * (0.3f/7.0f) * FOV/80.0f * CTimer::GetTimeStep();
+ BetaOffset = LookLeftRight * fStickSens * (1.0f/14.0f) * FOV/80.0f * CTimer::GetTimeStep();
+ AlphaOffset = LookUpDown * fStickSens * (0.6f/14.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
if(TheCamera.GetFading() && TheCamera.GetFadingDirection() == FADE_IN && nFadeControlThreshhold < CDraw::FadeValue ||
@@ -1539,7 +1547,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors = CameraTarget;
TargetCoors.z += fTranslateCamUp;
@@ -1577,7 +1585,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
- if(entity->IsPed() && ColCamDist > 1.0f){
+ if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
@@ -1615,9 +1623,12 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(dist == 0.1f)
Source += (TargetCoors - Source)*0.3f;
+ Near = RwCameraGetNearClipPlane(Scene.camera);
#ifndef FIX_BUGS
// this is totally wrong...
radius = Tan(FOV / 2.0f) * Near;
+#else
+ radius = ViewPlaneWidth*Near;
#endif
// Keep testing
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
@@ -1656,6 +1667,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
}
}
+float fBillsBetaOffset; // made up name, actually in CCam
+
void
CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float)
{
@@ -1675,6 +1688,15 @@ CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, fl
if(Length < 0.002f)
Length = 0.002f;
Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
+#if 1
+ // This is completely made up but Bill's cam manipulates an angle before calling this
+ // and otherwise calculating Beta doesn't make much sense.
+ Beta += fBillsBetaOffset;
+ fBillsBetaOffset = 0.0f;
+ Dist.x = -Length*Cos(Beta);
+ Dist.y = -Length*Sin(Beta);
+ Source = TargetCoors + Dist;
+#endif
if(Length > CA_MAX_DISTANCE){
Source.x = TargetCoors.x + Dist.x/Length * CA_MAX_DISTANCE;
Source.y = TargetCoors.y + Dist.y/Length * CA_MAX_DISTANCE;
@@ -1764,8 +1786,13 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation)
else
WellBufferMe(TargetZOffSet, &RoadHeightFix, &RoadHeightFixSpeed, 0.27f, 0.1f, false);
- if((colpoint.surfaceB == SURFACE_DEFAULT || colpoint.surfaceB >= SURFACE_METAL6) &&
- colpoint.surfaceB != SURFACE_STEEL && colpoint.surfaceB != SURFACE_STONE &&
+ if(colpoint.surfaceB != SURFACE_TARMAC &&
+ colpoint.surfaceB != SURFACE_GRASS &&
+ colpoint.surfaceB != SURFACE_GRAVEL &&
+ colpoint.surfaceB != SURFACE_MUD_DRY &&
+ colpoint.surfaceB != SURFACE_PAVEMENT &&
+ colpoint.surfaceB != SURFACE_THICK_METAL_PLATE &&
+ colpoint.surfaceB != SURFACE_STEEP_CLIFF &&
RoadHeightFix > 1.4f)
RoadHeightFix = 1.4f;
@@ -1775,14 +1802,14 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation)
void
CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, float TargetHeight)
{
+ float AlphaOffset = 0.0f;
+ bool CamClear = true;
+
static float LastTargetAlphaWithCollisionOn = 0.0f;
static float LastTopAlphaSpeed = 0.0f;
static float LastAlphaSpeedStep = 0.0f;
static bool PreviousNearCheckNearClipSmall = false;
- bool CamClear = true;
- float ModeAlpha = 0.0f;
-
if(ResetStatics){
LastTargetAlphaWithCollisionOn = 0.0f;
LastTopAlphaSpeed = 0.0f;
@@ -1797,17 +1824,16 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
if(zoomvalue < 0.1f)
zoomvalue = 0.1f;
if(TheCamera.CarZoomIndicator == CAM_ZOOM_1)
- ModeAlpha = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near
+ AlphaOffset = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near
else if(TheCamera.CarZoomIndicator == CAM_ZOOM_2)
- ModeAlpha = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid
+ AlphaOffset = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid
else if(TheCamera.CarZoomIndicator == CAM_ZOOM_3)
- ModeAlpha = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far
+ AlphaOffset = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far
float Length = (Source - TargetCoors).Magnitude2D();
if(m_bCollisionChecksOn){ // there's another variable (on PC) but it's uninitialised
- CVector Forward = CamTargetEntity->GetForward();
- float CarAlpha = CGeneral::GetATanOfXY(Forward.Magnitude2D(), Forward.z);
+ float CarAlpha = CGeneral::GetATanOfXY(CamTargetEntity->GetForward().Magnitude2D(), CamTargetEntity->GetForward().z);
// this shouldn't be necessary....
while(CarAlpha >= PI) CarAlpha -= 2*PI;
while(CarAlpha < -PI) CarAlpha += 2*PI;
@@ -1815,11 +1841,11 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
- float deltaBeta = Beta - TargetOrientation;
- while(deltaBeta >= PI) deltaBeta -= 2*PI;
- while(deltaBeta < -PI) deltaBeta += 2*PI;
+ float DeltaBeta = Beta - TargetOrientation;
+ while(DeltaBeta >= PI) DeltaBeta -= 2*PI;
+ while(DeltaBeta < -PI) DeltaBeta += 2*PI;
- float BehindCarNess = Cos(deltaBeta); // 1 if behind car, 0 if side, -1 if in front
+ float BehindCarNess = Cos(DeltaBeta); // 1 if behind car, 0 if side, -1 if in front
CarAlpha = -CarAlpha * BehindCarNess;
if(CarAlpha < -0.01f)
CarAlpha = -0.01f;
@@ -1829,10 +1855,10 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
while(DeltaAlpha < -PI) DeltaAlpha += 2*PI;
// What's this?? wouldn't it make more sense to clamp?
float AngleLimit = DEGTORAD(1.8f);
- if(DeltaAlpha < -AngleLimit)
- DeltaAlpha += AngleLimit;
- else if(DeltaAlpha > AngleLimit)
+ if(DeltaAlpha > AngleLimit)
DeltaAlpha -= AngleLimit;
+ else if(DeltaAlpha < -AngleLimit)
+ DeltaAlpha += AngleLimit;
else
DeltaAlpha = 0.0f;
@@ -1851,7 +1877,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
float CarRoof = CWorld::FindRoofZFor3DCoord(TargetCoors.x, TargetCoors.y, CarBottom, &FoundRoofCenter);
// Check sides of the car
- Forward = CamTargetEntity->GetForward(); // we actually still have that...
+ CVector Forward = CamTargetEntity->GetForward();
Forward.Normalise(); // shouldn't be necessary
float CarSideAngle = CGeneral::GetATanOfXY(Forward.x, Forward.y) + PI/2.0f;
float SideX = 2.5f * Cos(CarSideAngle);
@@ -1860,7 +1886,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
CWorld::FindRoofZFor3DCoord(TargetCoors.x - SideX, TargetCoors.y - SideY, CarBottom, &FoundRoofSide2);
// Now find out at what height we'd like to place the camera
- float CamGround = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, TargetCoors.z + Length*Sin(Alpha + ModeAlpha) + m_fCloseInCarHeightOffset, &FoundCamGround);
+ float CamGround = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, TargetCoors.z + Length*Sin(Alpha + AlphaOffset) + m_fCloseInCarHeightOffset, &FoundCamGround);
float CamTargetZ = 0.0f;
if(FoundCamGround){
// This is the normal case
@@ -1890,15 +1916,15 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
TargetAlpha = DEGTORAD(-7.0f);
// huh?
- if(TargetAlpha > ModeAlpha)
+ if(TargetAlpha > AlphaOffset)
CamClear = true;
- // Camera is contrained by collision in some way
+ // Camera is constrained by collision in some way
PreviousNearCheckNearClipSmall = false;
if(!CamClear){
PreviousNearCheckNearClipSmall = true;
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
- DeltaAlpha = TargetAlpha - (Alpha + ModeAlpha);
+ DeltaAlpha = TargetAlpha - (Alpha + AlphaOffset);
while(DeltaAlpha >= PI) DeltaAlpha -= 2*PI;
while(DeltaAlpha < -PI) DeltaAlpha += 2*PI;
@@ -1907,43 +1933,42 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
}
// Now do things if CamClear...but what is that anyway?
- float CamZ = TargetCoors.z + Length*Sin(Alpha + DeltaAlpha + ModeAlpha) + m_fCloseInCarHeightOffset;
+ float CamZ = TargetCoors.z + Length*Sin(Alpha + DeltaAlpha + AlphaOffset) + m_fCloseInCarHeightOffset;
bool FoundGround, FoundRoof;
float CamGround2 = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, CamZ, &FoundGround);
- if(FoundGround){
- if(CamClear)
- if(CamZ - CamGround2 < 1.5f){
- PreviousNearCheckNearClipSmall = true;
- RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
-
- float a;
- if(Length == 0.0f || CamGround2 + 1.5f - TargetCoors.z == 0.0f)
- a = Alpha;
- else
- a = CGeneral::GetATanOfXY(Length, CamGround2 + 1.5f - TargetCoors.z);
- while(a > PI) a -= 2*PI;
- while(a < -PI) a += 2*PI;
- DeltaAlpha = a - Alpha;
- }
- }else{
- if(CamClear){
- float CamRoof2 = CWorld::FindRoofZFor3DCoord(Source.x, Source.y, CamZ, &FoundRoof);
- if(FoundRoof && CamZ - CamRoof2 < 1.5f){
- PreviousNearCheckNearClipSmall = true;
- RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
-
- if(CamRoof2 > TargetCoors.z + 3.5f)
- CamRoof2 = TargetCoors.z + 3.5f;
-
- float a;
- if(Length == 0.0f || CamRoof2 + 1.5f - TargetCoors.z == 0.0f)
- a = Alpha;
- else
- a = CGeneral::GetATanOfXY(Length, CamRoof2 + 1.5f - TargetCoors.z);
- while(a > PI) a -= 2*PI;
- while(a < -PI) a += 2*PI;
- DeltaAlpha = a - Alpha;
- }
+ if(FoundGround && CamClear){
+ if(CamZ - CamGround2 < 1.5f){
+ PreviousNearCheckNearClipSmall = true;
+ RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
+
+ float dz = CamGround2 + 1.5f - TargetCoors.z;
+ float a;
+ if(Length == 0.0f || dz == 0.0f)
+ a = Alpha;
+ else
+ a = CGeneral::GetATanOfXY(Length, dz);
+ while(a > PI) a -= 2*PI;
+ while(a < -PI) a += 2*PI;
+ DeltaAlpha = a - Alpha;
+ }
+ }else if(CamClear){
+ float CamRoof2 = CWorld::FindRoofZFor3DCoord(Source.x, Source.y, CamZ, &FoundRoof);
+ if(FoundRoof && CamZ - CamRoof2 < 1.5f){
+ PreviousNearCheckNearClipSmall = true;
+ RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
+
+ if(CamRoof2 > TargetCoors.z + 3.5f)
+ CamRoof2 = TargetCoors.z + 3.5f;
+
+ float dz = CamRoof2 + 1.5f - TargetCoors.z;
+ float a;
+ if(Length == 0.0f || dz == 0.0f)
+ a = Alpha;
+ else
+ a = CGeneral::GetATanOfXY(Length, dz);
+ while(a > PI) a -= 2*PI;
+ while(a < -PI) a += 2*PI;
+ DeltaAlpha = a - Alpha;
}
}
@@ -1957,7 +1982,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
WellBufferMe(LastTargetAlphaWithCollisionOn, &Alpha, &AlphaSpeed, LastTopAlphaSpeed, LastAlphaSpeedStep, true);
- Source.z = TargetCoors.z + Sin(Alpha + ModeAlpha)*Length + m_fCloseInCarHeightOffset;
+ Source.z = TargetCoors.z + Sin(Alpha + AlphaOffset)*Length + m_fCloseInCarHeightOffset;
}
// Rotate cam behind the car when the car is moving forward
@@ -2107,9 +2132,9 @@ CCam::Process_Cam_On_A_String(const CVector &CameraTarget, float TargetOrientati
CBaseModelInfo *mi = CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex());
CVector Dimensions = mi->GetColModel()->boundingBox.max - mi->GetColModel()->boundingBox.min;
+ CVector TargetCoors = CameraTarget;
float BaseDist = Dimensions.Magnitude2D();
- CVector TargetCoors = CameraTarget;
TargetCoors.z += Dimensions.z - 0.1f; // final
Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
while(Alpha >= PI) Alpha -= 2*PI;
@@ -2144,6 +2169,8 @@ CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
if(ResetStatics)
Source = TargetCoors + Dist*(CA_MAX_DISTANCE + 1.0f);
+ Dist = Source - TargetCoors;
+
float Length = Dist.Magnitude2D();
if(Length < 0.001f){
// This probably shouldn't happen. reset view
@@ -2171,7 +2198,7 @@ CCam::FixCamWhenObscuredByVehicle(const CVector &TargetCoors)
static float HeightFixerCarsObscuring = 0.0f;
static float HeightFixerCarsObscuringSpeed = 0.0f;
CColPoint colPoint;
- CEntity *entity;
+ CEntity *entity = nil;
float HeightTarget = 0.0f;
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, false, true, false, false, false, false, false)){
@@ -2468,8 +2495,8 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float)
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
@@ -2570,13 +2597,13 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
#ifdef GTA3_1_1_PATCH
HeadPos.x = 0.0f;
@@ -2682,12 +2709,12 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@@ -2732,9 +2759,9 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
}else{
assert(CamTargetEntity->IsVehicle());
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex());
- CVector CamPos = mi->m_vehicleType == VEHICLE_TYPE_BOAT ? mi->m_positions[BOAT_POS_FRONTSEAT] : mi->m_positions[CAR_POS_FRONTSEAT];
+ CVector CamPos = mi->GetFrontSeatPosn();
CamPos.x = 0.0f;
- CamPos.y += -0.08f;
+ CamPos.y += 0.08f;
CamPos.z += 0.62f;
FOV = 60.0f;
Source = Multiply3x3(CamTargetEntity->GetMatrix(), CamPos);
@@ -2833,7 +2860,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
CVector Fwd = CamTargetEntity->GetForward();
Fwd.z = 0.0f;
Fwd.Normalise();
- HeadPos = (HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition());
+ HeadPos = HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition();
HeadPos.z += 0.59f;
}
Source = HeadPos;
@@ -2861,13 +2888,13 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@@ -2895,7 +2922,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
FOV /= (255.0f*CTimer::GetTimeStep() + 10000.0f) / 10000.0f;
}
- TheCamera.SetMotionBlur(180, 255, 180, 120, MBLUR_SNIPER);
+ TheCamera.SetMotionBlur(180, 255, 180, 120, MOTION_BLUR_SNIPER);
if(FOV > DefaultFOV)
FOV = DefaultFOV;
@@ -2911,13 +2938,8 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
void
CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float, float)
{
- if(CamTargetEntity->m_rwObject == nil)
- return;
-
-#ifdef FIX_BUGS
if(!CamTargetEntity->IsPed())
return;
-#endif
static bool FailedTestTwelveFramesAgo = false;
RwV3d HeadPos;
@@ -2927,9 +2949,9 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
static float TargetFOV = 0.0f;
if(ResetStatics){
- Beta = TargetOrientation;
+ Beta = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI;
Alpha = 0.0f;
- m_fInitialPlayerOrientation = TargetOrientation;
+ m_fInitialPlayerOrientation = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI;
FailedTestTwelveFramesAgo = false;
// static DPadVertical unused
// static DPadHorizontal unused
@@ -2964,13 +2986,13 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@@ -3009,7 +3031,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
FOVSpeed = 0.0f;
}
- TheCamera.SetMotionBlur(180, 255, 180, 120, MBLUR_SNIPER);
+ TheCamera.SetMotionBlur(180, 255, 180, 120, MOTION_BLUR_SNIPER);
if(FOV > DefaultFOV)
FOV = DefaultFOV;
@@ -3175,6 +3197,12 @@ CCam::Process_Syphon_Crim_In_Front(const CVector &CameraTarget, float, float, fl
while(AimingAngle >= PI) AimingAngle -= 2*PI;
while(AimingAngle < -PI) AimingAngle += 2*PI;
+ if(ResetStatics){
+ if(AimingAngle > 0.0f)
+ m_fPlayerInFrontSyphonAngleOffSet = -m_fPlayerInFrontSyphonAngleOffSet;
+ ResetStatics = false;
+ }
+
if(TheCamera.PlayerWeaponMode.Mode == MODE_SYPHON)
Beta = AimingAngle + m_fPlayerInFrontSyphonAngleOffSet;
@@ -3569,8 +3597,7 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
CVector Left = CrossProduct(Up, Front);
Up = CrossProduct(Front, Left);
Up.Normalise();
- FOV = PsuedoFOV;
- }else{
+ }else if(uiTime >= uiFinishTime){
// end
ArrayMarkerSource = (TheCamera.m_arrPathArray[2].m_arr_PathData[0] - 1)*10 + 1;
ArrayMarkerFront = (TheCamera.m_arrPathArray[3].m_arr_PathData[0] - 1)*10 + 1;
@@ -3597,8 +3624,8 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
CVector Left = CrossProduct(Up, Front);
Up = CrossProduct(Front, Left);
Up.Normalise();
- FOV = PsuedoFOV;
}
+ FOV = PsuedoFOV;
}
void
@@ -3618,12 +3645,13 @@ CCam::Process_WheelCam(const CVector&, float, float, float)
}
CVector NewUp(0.0f, 0.0f, 1.0f);
- CVector Left = CrossProduct(Front, NewUp);
- Left.Normalise();
- NewUp = CrossProduct(Left, Front);
+ CVector Right = CrossProduct(Front, NewUp);
+ Right.Normalise();
+ NewUp = CrossProduct(Right, Front);
+ NewUp.Normalise();
float Roll = Cos((CTimer::GetTimeInMilliseconds()&0x1FFFF)/(float)0x1FFFF * TWOPI);
- Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Left;
+ Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Right;
}
void
@@ -3644,7 +3672,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
if(TheCamera.m_bUseSpecialFovTrain)
FOV = TheCamera.m_fFovForTrain;
- if(CMenuManager::m_ControlMethod == 0 && Using3rdPersonMouseCam()){
+ if(CMenuManager::m_ControlMethod == CONTROL_STANDARD && Using3rdPersonMouseCam()){
CPed *player = FindPlayerPed();
if(player && player->CanStrafeOrMouseControl()){
float Heading = Front.Heading();
@@ -3733,18 +3761,18 @@ CCam::Process_Debug(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
- Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
+ Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
if(CPad::GetPad(0)->GetLeftMouse()){
Alpha += DEGTORAD(CPad::GetPad(0)->GetMouseY()/2.0f);
- Beta -= DEGTORAD(CPad::GetPad(0)->GetMouseX()/2.0f);
+ Beta += DEGTORAD(CPad::GetPad(0)->GetMouseX()/2.0f);
}
- TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 3.0f;
- TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 3.0f;
+ TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
+ TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 3.0f;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
- if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
+ else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || KEYDOWN('W'))
Speed += 0.1f;
@@ -3792,7 +3820,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
+ CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors
@@ -3806,7 +3834,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
Source.y += 1.0f;
GetVectorsReadyForRW();
- CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1;
+#ifdef FIX_BUGS
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA);
+#else
+ CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_CAMERA;
+#endif
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
@@ -3830,14 +3862,14 @@ CCam::Process_Debug(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
- Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
+ Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
- TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 3.0f;
- TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 3.0f;
+ TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
+ TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 3.0f;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
- if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
+ else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
Speed += 0.1f;
@@ -3859,8 +3891,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source;
-
+ CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors
@@ -3903,13 +3934,13 @@ CCam::Process_Editor(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
- Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
+ Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
if(CamTargetEntity && CSceneEdit::m_bCameraFollowActor){
TargetCoors = CamTargetEntity->GetPosition();
}else if(CSceneEdit::m_bRecording){
- TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 7.0f;
- TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 7.0f;
+ TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
+ TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 7.0f;
}else
TargetCoors = CSceneEdit::m_vecCamHeading + Source;
@@ -3917,7 +3948,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
CSceneEdit::m_vecCamHeading = TargetCoors - Source;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
- if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
+ else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
Speed += 0.1f;
@@ -4048,11 +4079,11 @@ bool
CCam::ProcessArrestCamOne(void)
{
FOV = 45.0f;
- if(ResetStatics)
+ if(!ResetStatics)
return true;
#ifdef FIX_BUGS
- if(!CamTargetEntity->IsPed())
+ if(!CamTargetEntity->IsPed() || ((CPlayerPed*)TheCamera.pTargetEntity)->m_pArrestingCop == nil)
return true;
#endif
@@ -4107,18 +4138,18 @@ CCam::ProcessArrestCamTwo(void)
CVector TargetCoors, ToCamera;
float BetaOffset;
float SourceX, SourceY;
- CCam *ActiveCam = &TheCamera.Cams[TheCamera.ActiveCam];
- if(&ActiveCam[1] == this){
+ if(&TheCamera.Cams[TheCamera.ActiveCam] == this){
SourceX = TheCamera.Cams[(TheCamera.ActiveCam + 1) % 2].Source.x;
SourceY = TheCamera.Cams[(TheCamera.ActiveCam + 1) % 2].Source.y;
}else{
- SourceX = ActiveCam[1].Source.x;
- SourceY = ActiveCam[1].Source.y;
+ SourceX = TheCamera.Cams[TheCamera.ActiveCam].Source.x;
+ SourceY = TheCamera.Cams[TheCamera.ActiveCam].Source.y;
}
for(int i = 0; i <= 1; i++){
int Dir = i == 0 ? 1 : -1;
+ FOV = 60.0f;
TargetCoors = player->GetPosition();
Beta = CGeneral::GetATanOfXY(TargetCoors.x-SourceX, TargetCoors.y-SourceY);
BetaOffset = DEGTORAD(Dir*80);
@@ -4412,6 +4443,106 @@ CCam::Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOri
GetVectorsReadyForRW();
}
+void
+CCam::Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar)
+{
+#ifdef FIX_BUGS
+ fBillsBetaOffset += CPad::GetPad(0)->GetRightStickX()/1000.0f;
+#else
+ // just wtf is this? this code must be ancient
+ if(CPad::GetPad(0)->GetStart())
+ fBillsBetaOffset += CPad::GetPad(0)->GetLeftStickX()/1000.0f;
+#endif
+ while(fBillsBetaOffset > TWOPI) fBillsBetaOffset -= TWOPI;
+ while(fBillsBetaOffset < 0.0f) fBillsBetaOffset += TWOPI;
+ TargetOrientation += fBillsBetaOffset;
+ while(TargetOrientation > TWOPI) TargetOrientation -= TWOPI;
+ while(TargetOrientation < 0.0f) TargetOrientation += TWOPI;
+ Process_BehindCar(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+}
+
+void
+CCam::Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 50.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 2.5f;
+ Front = CamTargetEntity->GetForward();
+ Front.Normalise();
+ Source += 1.35f*Front;
+ float heading = CGeneral::GetATanOfXY(Front.x, Front.y) + DEGTORAD(45.0f);
+ Front.x = Cos(heading);
+ Front.y = Sin(heading);
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 50.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 5.45f;
+
+ static CVector Test = -CamTargetEntity->GetForward();
+#ifdef FIX_BUGS
+ if(ResetStatics){
+ Test = -CamTargetEntity->GetForward();
+ ResetStatics = false;
+ }
+#endif
+
+ Source.x += 19.45*Test.x;
+ Source.y += 19.45*Test.y;
+ Front = Test;
+ Front.Normalise();
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 60.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 4.0f;
+ CVector fwd = CamTargetEntity->GetForward();
+ float heading = CGeneral::GetATanOfXY(fwd.x, fwd.y) - DEGTORAD(15.0f);
+ Source.x -= Cos(heading)*10.0f;
+ Source.y -= Sin(heading)*10.0f;
+ heading -= DEGTORAD(5.0f);
+ Front = fwd;
+ Front.x += Cos(heading);
+ Front.y += Sin(heading);
+ Front.z -= 0.056f;
+ Front.Normalise();
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ static float RoofMultiplier = 1.5f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 4.8f;
+ Front = CamTargetEntity->GetForward();
+ Front.Normalise();
+ Source += Front*RoofMultiplier;
+ Up = CamTargetEntity->GetUp();
+ Up.Normalise();
+
+ GetVectorsReadyForRW();
+}
+
+
#ifdef FREE_CAM
void
CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float)
@@ -4494,8 +4625,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
- BetaOffset = LookLeftRight * fStickSens * (0.5f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
- AlphaOffset = LookUpDown * fStickSens * (0.3f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
+ BetaOffset = LookLeftRight * fStickSens * (1.0f/20.0f) * FOV/80.0f * CTimer::GetTimeStep();
+ AlphaOffset = LookUpDown * fStickSens * (0.6f/20.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
// Stop centering once stick has been touched
@@ -4507,7 +4638,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
while(Beta >= PI) Beta -= 2.0f*PI;
while(Beta < -PI) Beta += 2.0f*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
float BetaDiff = TargetOrientation+PI - Beta;
@@ -4567,7 +4698,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
- if(entity->IsPed() && ColCamDist > 1.0f){
+ if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
@@ -4606,6 +4737,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
Source += (TargetCoors - Source)*0.3f;
// Keep testing
+ Near = RwCameraGetNearClipPlane(Scene.camera);
+ radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
i++;
@@ -4927,7 +5060,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// This is not working on cars as SA
// Because III/VC doesn't have any buttons tied to LeftStick if you're not in Classic Configuration, using Dodo or using GInput/Pad, so :shrug:
if (Abs(pad->GetSteeringUpDown()) > 120.0f) {
- if (car->pDriver && car->pDriver->m_objective != OBJECTIVE_LEAVE_VEHICLE) {
+ if (car->pDriver && car->pDriver->m_objective != OBJECTIVE_LEAVE_CAR) {
yMovement += Abs(pad->GetSteeringUpDown()) * (FOV / 80.0f * 3.f / 70.f) * pad->GetSteeringUpDown() * 0.007f * 0.007f * 0.5;
}
}
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 35d230dc..abe0833e 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -30,6 +30,7 @@
#include "Pools.h"
#include "Debug.h"
#include "GenericGameStorage.h"
+#include "MemoryCard.h"
#include "Camera.h"
enum
@@ -91,17 +92,28 @@ CCamera::Init(void)
float fMouseAccelHorzntl = m_fMouseAccelHorzntl;
float fMouseAccelVertical = m_fMouseAccelVertical;
#endif
-#ifdef FIX_BUGS
- static const CCamera DummyCamera = CCamera(0.f);
- *this = DummyCamera;
-#else
- memset(this, 0, sizeof(CCamera)); // getting rid of vtable, eh?
+
+#ifdef PS2_MENU
+ if ( !TheMemoryCard.m_bWantToLoad && !FrontEndMenuManager.m_bWantToRestart ) {
#endif
-#ifdef GTA3_1_1_PATCH
- m_fMouseAccelHorzntl = fMouseAccelHorzntl;
- m_fMouseAccelVertical = fMouseAccelVertical;
+
+ #ifdef FIX_BUGS
+ static const CCamera DummyCamera = CCamera(0.f);
+ *this = DummyCamera;
+ #else
+ memset(this, 0, sizeof(CCamera)); // getting rid of vtable, eh?
+ #endif
+
+ #ifdef GTA3_1_1_PATCH
+ m_fMouseAccelHorzntl = fMouseAccelHorzntl;
+ m_fMouseAccelVertical = fMouseAccelVertical;
+ #endif
+ m_pRwCamera = nil;
+
+#ifdef PS2_MENU
+ }
#endif
- m_pRwCamera = nil;
+
m_1rstPersonRunCloseToAWall = false;
m_fPositionAlongSpline = 0.0f;
m_bCameraJustRestored = false;
@@ -111,7 +123,7 @@ CCamera::Init(void)
Cams[0].Mode = CCam::MODE_FOLLOWPED;
Cams[1].Mode = CCam::MODE_FOLLOWPED;
unknown = 0;
- m_bJustJumpedOutOf1stPersonBecauseOfTarget = 0;
+ m_bJustJumpedOutOf1stPersonBecauseOfTarget = false;
ClearPlayerWeaponMode();
m_bInATunnelAndABigVehicle = false;
m_iModeObbeCamIsInForCar = OBBE_INVALID;
@@ -129,8 +141,8 @@ CCamera::Init(void)
Cams[1].m_fPlayerVelocity = 0.0f;
Cams[2].m_fPlayerVelocity = 0.0f;
m_bHeadBob = false;
- m_fFractionInterToStopMovingTarget = 0.25f;
- m_fFractionInterToStopCatchUpTarget = 0.75f;
+ m_fFractionInterToStopMoving = 0.25f;
+ m_fFractionInterToStopCatchUp = 0.75f;
m_fGaitSwayBuffer = 0.85f;
m_bScriptParametersSetForInterPol = false;
m_uiCamShakeStart = 0;
@@ -168,7 +180,12 @@ CCamera::Init(void)
PlayerExhaustion = 1.0f;
DebugCamMode = CCam::MODE_NONE;
m_PedOrientForBehindOrInFront = 0.0f;
- if(!FrontEndMenuManager.m_bWantToRestart){
+#ifdef PS2_MENU
+ if ( !TheMemoryCard.m_bWantToLoad && !FrontEndMenuManager.m_bWantToRestart )
+#else
+ if(!FrontEndMenuManager.m_bWantToRestart)
+#endif
+ {
m_bFading = false;
CDraw::FadeValue = 0;
m_fFLOATingFade = 0.0f;
@@ -177,7 +194,11 @@ CCamera::Init(void)
m_fFLOATingFadeMusic = 0.0f;
}
m_bMoveCamToAvoidGeom = false;
+#ifdef PS2_MENU
+ if ( TheMemoryCard.m_bWantToLoad || FrontEndMenuManager.m_bWantToRestart )
+#else
if(FrontEndMenuManager.m_bWantToRestart)
+#endif
m_bMoveCamToAvoidGeom = true;
m_bStartingSpline = false;
m_iTypeOfSwitch = INTERPOLATION;
@@ -228,13 +249,14 @@ void
CCamera::Process(void)
{
// static bool InterpolatorNotInitialised = true; // unused
+ static CVector PreviousFudgedTargetCoors; // only PS2
static float PlayerMinDist = 1.6f; // not on PS2
- static bool WasPreviouslyInterSyhonFollowPed = false; // only written
+ static bool WasPreviouslyInterSyhonFollowPed = false; // only used on PS2
float FOV = 0.0f;
float oldBeta, newBeta;
float deltaBeta = 0.0f;
bool lookLRBVehicle = false;
- CVector CamFront, CamUp, CamSource, Target;
+ CVector CamFront, CamUp, CamRight, CamSource, Target;
m_bJust_Switched = false;
m_RealPreviousCameraPosition = GetPosition();
@@ -287,19 +309,19 @@ CCamera::Process(void)
// Stop transition when it's done
if(m_uiTransitionState != 0){
-/*
- // PS2:
+#ifdef PS2_CAM_TRANSITION
if(!m_bWaitForInterpolToFinish){
Cams[(ActiveCam+1)%2].Process();
Cams[(ActiveCam+1)%2].ProcessSpecialHeightRoutines();
}
-*/
- // not PS2 (done in CamControl there it seems)
+#else
+ // done in CamControl on PS2 it seems
if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){
m_uiTransitionState = 0;
m_vecDoingSpecialInterPolation = false;
m_bWaitForInterpolToFinish = false;
}
+#endif
}
if(m_bUseNearClipScript)
@@ -322,19 +344,165 @@ CCamera::Process(void)
if(m_uiTransitionState != 0 && !lookLRBVehicle){
// Process transition
- // different on PS2
+#ifdef PS2_CAM_TRANSITION
+ bool lookingAtPlayerNow = false;
+ bool wasLookingAtPlayer = false;
+ bool transitionPedMode = false;
+ bool setWait = false;
+ if(Cams[ActiveCam].CamTargetEntity == Cams[(ActiveCam+1)%2].CamTargetEntity){
+ if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON ||
+ Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
+ Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
+ Cams[ActiveCam].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON)
+ lookingAtPlayerNow = true;
+ if(Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SYPHON ||
+ Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
+ Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FOLLOWPED ||
+ Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON) // checked twice for some reason
+ wasLookingAtPlayer = true;
+
+ if(!m_vecDoingSpecialInterPolation &&
+ (Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED || Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM) &&
+ (Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FOLLOWPED || Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FIGHT_CAM))
+ transitionPedMode = true;
+ }
+
+ if(lookingAtPlayerNow && wasLookingAtPlayer){
+ CVector playerDist;
+ playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x;
+ playerDist.y = FindPlayerPed()->GetPosition().y - GetPosition().y;
+ playerDist.z = FindPlayerPed()->GetPosition().z - GetPosition().z;
+ if(playerDist.Magnitude() > 17.5f &&
+ (Cams[ActiveCam].Mode == CCam::MODE_SYPHON || Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT))
+ setWait = true;
+ }
+ if(setWait)
+ m_bWaitForInterpolToFinish = true;
+
+
+ uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart;
+ if(currentTime >= m_uiTransitionDuration)
+ currentTime = m_uiTransitionDuration;
+ float inter = (float) currentTime / m_uiTransitionDuration;
+ inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
+
+ if(m_vecDoingSpecialInterPolation){
+ Cams[(ActiveCam+1)%2].Source = m_vecOldSourceForInter;
+ Cams[(ActiveCam+1)%2].Front = m_vecOldFrontForInter;
+ Cams[(ActiveCam+1)%2].Up = m_vecOldUpForInter;
+ Cams[(ActiveCam+1)%2].FOV = m_vecOldFOVForInter;
+ if(WasPreviouslyInterSyhonFollowPed)
+ Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter.z = PreviousFudgedTargetCoors.z;
+ }
+
+ CamSource = inter*Cams[ActiveCam].Source + (1.0f-inter)*Cams[(ActiveCam+1)%2].Source;
+ FOV = inter*Cams[ActiveCam].FOV + (1.0f-inter)*Cams[(ActiveCam+1)%2].FOV;
+
+ CVector tmpFront = Cams[(ActiveCam+1)%2].Front;
+ float Alpha_other = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z);
+ if(Alpha_other > PI) Alpha_other -= TWOPI;
+ float Beta_other = 0.0f;
+ if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
+ Beta_other = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x);
+ tmpFront = Cams[ActiveCam].Front;
+ float Alpha_active = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z);
+ if(Alpha_active > PI) Alpha_active -= TWOPI;
+ float Beta_active = 0.0f;
+ if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
+ Beta_active = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x);
+
+ float DeltaBeta = Beta_active - Beta_other;
+ float Alpha = inter*Alpha_active + (1.0f-inter)*Alpha_other;
+
+ if(m_uiTransitionJUSTStarted){
+ while(DeltaBeta > PI) DeltaBeta -= TWOPI;
+ while(DeltaBeta <= -PI) DeltaBeta += TWOPI;
+ m_uiTransitionJUSTStarted = false;
+ }else{
+ if(DeltaBeta < m_fOldBetaDiff)
+ while(Abs(DeltaBeta - m_fOldBetaDiff) > PI) DeltaBeta += TWOPI;
+ else
+ while(Abs(DeltaBeta - m_fOldBetaDiff) > PI) DeltaBeta -= TWOPI;
+ }
+ m_fOldBetaDiff = DeltaBeta;
+ float Beta = inter*DeltaBeta + Beta_other;
+
+ CVector FudgedTargetCoors;
+ if(lookingAtPlayerNow && wasLookingAtPlayer){
+ // BUG? how is this interpolation ever used when values are overwritten below?
+ float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D();
+ float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating);
+ if(PlayerDist < MinDist){
+ CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(Beta - HALFPI);
+ CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(Beta - HALFPI);
+ }else{
+ CamSource.x = pTargetEntity->GetPosition().x - PlayerDist*Cos(Beta - HALFPI);
+ CamSource.y = pTargetEntity->GetPosition().y - PlayerDist*Sin(Beta - HALFPI);
+ }
+ CColPoint colpoint;
+ CEntity *entity = nil;
+ if(CWorld::ProcessLineOfSight(pTargetEntity->GetPosition(), CamSource, colpoint, entity, true, false, false, true, false, true, true)){
+ CamSource = colpoint.point;
+ RwCameraSetNearClipPlane(Scene.camera, 0.05f);
+ }
+
+ CamFront = pTargetEntity->GetPosition() - CamSource;
+ FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter;
+ PreviousFudgedTargetCoors = FudgedTargetCoors;
+ CamFront.Normalise();
+ CamUp = CVector(0.0f, 0.0f, 1.0f);
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+
+ WasPreviouslyInterSyhonFollowPed = true;
+ }else
+ WasPreviouslyInterSyhonFollowPed = false;
+
+ if(transitionPedMode){
+ FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter;
+ PreviousFudgedTargetCoors = FudgedTargetCoors;
+ CVector CamToTarget = pTargetEntity->GetPosition() - CamSource;
+ float tmpBeta = CGeneral::GetATanOfXY(CamToTarget.x, CamToTarget.y);
+ float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D();
+ float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating);
+ if(PlayerDist < MinDist){
+ CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(tmpBeta - HALFPI);
+ CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(tmpBeta - HALFPI);
+ }
+ CamFront = FudgedTargetCoors - CamSource;
+ CamFront.Normalise();
+ CamUp = CVector(0.0f, 0.0f, 1.0f);
+ CamUp.Normalise();
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+ CamUp.Normalise();
+ }else{
+ CamFront.x = Cos(Alpha) * Sin(Beta);
+ CamFront.y = Cos(Alpha) * -Cos(Beta);
+ CamFront.z = Sin(Alpha);
+ CamFront.Normalise();
+ CamUp = inter*Cams[ActiveCam].Up + (1.0f-inter)*Cams[(ActiveCam+1)%2].Up;
+ CamUp.Normalise();
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+ CamUp.Normalise();
+ }
+#else
uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart;
if(currentTime >= m_uiTransitionDuration)
currentTime = m_uiTransitionDuration;
float fractionInter = (float) currentTime / m_uiTransitionDuration;
- if(fractionInter <= m_fFractionInterToStopMovingTarget){
+ if(fractionInter <= m_fFractionInterToStopMoving){
float inter;
- if(m_fFractionInterToStopMovingTarget == 0.0f)
+ if(m_fFractionInterToStopMoving == 0.0f)
inter = 0.0f;
else
- inter = (m_fFractionInterToStopMovingTarget - fractionInter)/m_fFractionInterToStopMovingTarget;
+ inter = (m_fFractionInterToStopMoving - fractionInter)/m_fFractionInterToStopMoving;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter;
@@ -378,22 +546,24 @@ CCamera::Process(void)
if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CamFront.Normalise();
- CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f));
+ CamRight = CVector(-1.0f, 0.0f, 0.0f);
+ CamUp = CrossProduct(CamFront, CamRight);
+ CamUp.Normalise();
}else{
CamFront.Normalise();
CamUp.Normalise();
- CVector right = CrossProduct(CamFront, CamUp);
- right.Normalise();
- CamUp = CrossProduct(right, CamFront);
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+ CamUp.Normalise();
}
- CamUp.Normalise();
FOV = m_fFOVWhenInterPol;
- }else if(fractionInter > m_fFractionInterToStopMovingTarget && fractionInter <= 1.0f){
+ }else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){
float inter;
- if(m_fFractionInterToStopCatchUpTarget == 0.0f)
+ if(m_fFractionInterToStopCatchUp == 0.0f)
inter = 0.0f;
else
- inter = (fractionInter - m_fFractionInterToStopMovingTarget)/m_fFractionInterToStopCatchUpTarget;
+ inter = (fractionInter - m_fFractionInterToStopMoving)/m_fFractionInterToStopCatchUp;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol);
@@ -433,15 +603,17 @@ CCamera::Process(void)
if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CamFront.Normalise();
- CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f));
+ CamRight = CVector(-1.0f, 0.0f, 0.0f);
+ CamUp = CrossProduct(CamFront, CamRight);
+ CamUp.Normalise();
}else{
CamFront.Normalise();
CamUp.Normalise();
- CVector right = CrossProduct(CamFront, CamUp);
- right.Normalise();
- CamUp = CrossProduct(right, CamFront);
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+ CamUp.Normalise();
}
- CamUp.Normalise();
#ifndef FIX_BUGS
// BUG: FOV was already interpolated but m_fFOVWhenInterPol was not
FOV = m_fFOVWhenInterPol;
@@ -453,6 +625,7 @@ CCamera::Process(void)
float Alpha = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
float Beta = CGeneral::GetATanOfXY(Dist.x, Dist.y);
Cams[ActiveCam].KeepTrackOfTheSpeed(CamSource, Target, CamUp, Alpha, Beta, FOV);
+#endif
}else{
// No transition, take Cam values directly
if(WorldViewerBeingUsed){
@@ -466,7 +639,7 @@ CCamera::Process(void)
CamUp = Cams[ActiveCam].Up;
FOV = Cams[ActiveCam].FOV;
}
- WasPreviouslyInterSyhonFollowPed = false; // unused
+ WasPreviouslyInterSyhonFollowPed = false; // only used on PS2
}
if(m_uiTransitionState != 0)
@@ -493,10 +666,10 @@ CCamera::Process(void)
GetMatrix().GetPosition().y += shakeOffset * (((shakeRand & 0xF0) >> 4) - 7);
GetMatrix().GetPosition().z += shakeOffset * (((shakeRand & 0xF00) >> 8) - 7);
- if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER)
+ if(shakeOffset > 0.0f && m_BlurType != MOTION_BLUR_SNIPER)
SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150));
if(Cams[ActiveCam].Mode == CCam::MODE_1STPERSON && FindPlayerVehicle() && FindPlayerVehicle()->GetUp().z < 0.2f)
- SetMotionBlur(230, 230, 230, 215, MBLUR_NORMAL);
+ SetMotionBlur(230, 230, 230, 215, MOTION_BLUR_LIGHT_SCENE);
CalculateDerivedValues();
CDraw::SetFOV(FOV);
@@ -546,8 +719,10 @@ CCamera::Process(void)
LODDistMultiplier = 70.0f/CDraw::GetFOV() * CDraw::GetAspectRatio()/(4.0f/3.0f);
else
LODDistMultiplier = 1.0f;
+ // missing on PS2
GenerationDistMultiplier = LODDistMultiplier;
LODDistMultiplier *= CRenderer::ms_lodDistScale;
+ //
// Keep track of speed
if(m_bJustInitalised || m_bJust_Switched){
@@ -563,7 +738,7 @@ CCamera::Process(void)
}
m_PreviousCameraPosition = GetPosition();
- // PS2: something doing on with forward vector here
+ // PS2 normalizes a CVector2D GetForward() here. is it used anywhere?
if(Cams[ActiveCam].DirectionWasLooking != LOOKING_FORWARD && Cams[ActiveCam].Mode != CCam::MODE_TOP_DOWN_PED){
Cams[ActiveCam].Source = Cams[ActiveCam].SourceBeforeLookBehind;
@@ -609,6 +784,16 @@ CCamera::CamControl(void)
if(Cams[ActiveCam].CamTargetEntity == nil && pTargetEntity == nil)
pTargetEntity = PLAYER;
+#ifdef PS2_CAM_TRANSITION
+ // Stop transition when it's done
+ if(m_uiTransitionState != 0)
+ if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){
+ m_uiTransitionState = 0;
+ m_vecDoingSpecialInterPolation = false;
+ m_bWaitForInterpolToFinish = false;
+ }
+#endif
+
m_iZoneCullFrameNumWereAt++;
if(m_iZoneCullFrameNumWereAt > m_iCheckCullZoneThisNumFrames)
m_iZoneCullFrameNumWereAt = 1;
@@ -617,7 +802,7 @@ CCamera::CamControl(void)
m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer();
if(m_bLookingAtPlayer){
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_1;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
FindPlayerPed()->bIsVisible = true;
}
@@ -885,7 +1070,7 @@ CCamera::CamControl(void)
m_bFirstPersonBeingUsed = false;
if(m_bFirstPersonBeingUsed){
ReqMode = CCam::MODE_1STPERSON;
- CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_1;
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA);
}
// Zoom value
@@ -994,7 +1179,7 @@ CCamera::CamControl(void)
garageCenter.y = (az->miny + az->maxy)/2.0f;
garageCenter.z = 0.0f;
}else
- garageCenter = pTargetEntity->GetPosition();
+ garageCenter = CVector(pTargetEntity->GetPosition().x, pTargetEntity->GetPosition().y, 0.0f);
}
if(whichDoor == 1)
garageCenterToDoor = garageDoorPos1 - garageCenter;
@@ -1202,6 +1387,7 @@ CCamera::CamControl(void)
// Restore with a jump cut
if(m_bRestoreByJumpCut){
+ // PS2 just sets m_bCamDirectlyBehind here
if(ReqMode != CCam::MODE_FOLLOWPED &&
ReqMode != CCam::MODE_M16_1STPERSON &&
ReqMode != CCam::MODE_SNIPER &&
@@ -1217,6 +1403,7 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity = pTargetEntity;
Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource;
Cams[ActiveCam].m_cvecCamFixedModeUpOffSet = m_vecFixedModeUpOffSet;
+ // PS2 sets this to m_bLookingAtVector
Cams[ActiveCam].m_bCamLookingAtVector = false;
Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition;
m_bRestoreByJumpCut = false;
@@ -1355,7 +1542,7 @@ CCamera::CamControl(void)
switchByJumpCut = true;
if(Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CVector front = Cams[ActiveCam].Source - FindPlayerPed()->GetPosition();
- front.z = 0.0f;
+ front.z = 0.0f; // missing on PS2
front.Normalise();
#ifdef FIX_BUGS
// this is almost as bad as the bugged code
@@ -1392,6 +1579,7 @@ CCamera::CamControl(void)
if((m_uiTransitionState == 0 || switchByJumpCut) && ReqMode != Cams[ActiveCam].Mode){
if(switchByJumpCut){
+ // PS2 just sets m_bCamDirectlyBehind here
if(!m_bPlayerIsInGarage || m_bJustCameOutOfGarage){
if(ReqMode != CCam::MODE_FOLLOWPED &&
ReqMode != CCam::MODE_M16_1STPERSON &&
@@ -1430,6 +1618,8 @@ CCamera::CamControl(void)
if(ReqMode == CCam::MODE_FOLLOWPED && Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM)
startTransition = false;
+#ifndef PS2_CAM_TRANSITION
+ // done in Process on PS2
if(!m_bWaitForInterpolToFinish && m_bLookingAtPlayer && m_uiTransitionState != 0){
CVector playerDist;
playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x;
@@ -1442,6 +1632,7 @@ CCamera::CamControl(void)
m_bWaitForInterpolToFinish = true;
}
}
+#endif
if(m_bWaitForInterpolToFinish)
startTransition = false;
@@ -1451,10 +1642,14 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity);
}
}else if(ReqMode == CCam::MODE_FIXED && pTargetEntity != Cams[ActiveCam].CamTargetEntity && m_bPlayerIsInGarage){
+#ifdef PS2_CAM_TRANSITION
+ StartTransitionWhenNotFinishedInter(ReqMode);
+#else
if(m_uiTransitionState != 0)
StartTransitionWhenNotFinishedInter(ReqMode);
else
StartTransition(ReqMode);
+#endif
pTargetEntity->RegisterReference(&pTargetEntity);
Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity);
}
@@ -1578,7 +1773,7 @@ CCamera::UpdateTargetEntity(void)
pTargetEntity = FindPlayerPed();
if(PLAYER->GetPedState() == PED_DRAG_FROM_CAR)
pTargetEntity = FindPlayerPed();
- if(pTargetEntity->IsVehicle() && CarZoomIndicator != CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED)
+ if(pTargetEntity->IsVehicle() && CarZoomIndicator == CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED)
pTargetEntity = FindPlayerPed();
}
}
@@ -1840,26 +2035,25 @@ CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffS
/*
- * On PS2 the transition happens between Cams[1] and Cams[2].
+ * On PS2 the transition happens between Cams[0] and Cams[1].
* On PC the whole system has been changed.
*/
void
CCamera::StartTransition(int16 newMode)
{
- bool foo = false;
bool switchSyphonMode = false;
bool switchPedToCar = false;
- bool switchPedMode = false;
+ bool switchFromFight = false;
bool switchFromFixed = false;
bool switch1stPersonToVehicle = false;
float betaOffset, targetBeta, camBeta, deltaBeta;
int door;
bool vehicleVertical;
-// missing on PS2
+#ifndef PS2_CAM_TRANSITION
m_bItsOkToLookJustAtThePlayer = false;
- m_fFractionInterToStopMovingTarget = 0.25f;
- m_fFractionInterToStopCatchUpTarget = 0.75f;
+ m_fFractionInterToStopMoving = 0.25f;
+ m_fFractionInterToStopCatchUp = 0.75f;
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
@@ -1873,14 +2067,16 @@ CCamera::StartTransition(int16 newMode)
if(newMode == CCam::MODE_CAM_ON_A_STRING)
switchPedToCar = true;
}
-//
+#endif
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON)
switchSyphonMode = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED)
- switchPedMode = true;
+ switchFromFight = true;
+#ifndef PS2_CAM_TRANSITION
if(Cams[ActiveCam].Mode == CCam::MODE_FIXED)
switchFromFixed = true;
+#endif
m_bUseTransitionBeta = false;
@@ -1899,11 +2095,11 @@ CCamera::StartTransition(int16 newMode)
((CPed*)pTargetEntity)->m_fRotationDest = angle;
}
-/* // PS2
+#ifdef PS2_CAM_TRANSITION
ActiveCam = (ActiveCam+1)%2;
Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode;
- */
+#endif
Cams[ActiveCam].m_cvecCamFixedModeVector = m_vecFixedModeVector;
Cams[ActiveCam].CamTargetEntity = pTargetEntity;
@@ -1934,12 +2130,27 @@ CCamera::StartTransition(int16 newMode)
switch(newMode){
case CCam::MODE_BEHINDCAR:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+ Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
+#endif
+ Cams[ActiveCam].BetaSpeed = 0.0f;
+ break;
+
+ case CCam::MODE_BEHINDBOAT:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+ Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
+#endif
Cams[ActiveCam].BetaSpeed = 0.0f;
break;
case CCam::MODE_FOLLOWPED:
// Getting out of vehicle normally
betaOffset = DEGTORAD(55.0f);
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
if(m_bJustCameOutOfGarage){
m_bUseTransitionBeta = true;
/*
@@ -1953,13 +2164,21 @@ CCamera::StartTransition(int16 newMode)
*/
// this is better:
if(Cams[ActiveCam].Front.x != 0.0f || Cams[ActiveCam].Front.y != 0.0f)
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y) + PI;
+#else
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI;
+#endif
else
Cams[ActiveCam].m_fTransitionBeta = 0.0f;
}
if(m_bTargetJustCameOffTrain)
m_bCamDirectlyInFront = true;
+#ifdef PS2_CAM_TRANSITION
+ if(Cams[(ActiveCam+1)%2].Mode != CCam::MODE_CAM_ON_A_STRING)
+#else
if(Cams[ActiveCam].Mode != CCam::MODE_CAM_ON_A_STRING)
+#endif
break;
m_bUseTransitionBeta = true;
vehicleVertical = false;
@@ -1971,7 +2190,11 @@ CCamera::StartTransition(int16 newMode)
Cams[ActiveCam].m_fTransitionBeta = 0.0f;
break;
}
+#ifdef PS2_CAM_TRANSITION
+ camBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y);
+#else
camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
+#endif
if(((CPed*)pTargetEntity)->m_carInObjective)
targetBeta = CGeneral::GetATanOfXY(((CPed*)pTargetEntity)->m_carInObjective->GetForward().x, ((CPed*)pTargetEntity)->m_carInObjective->GetForward().y);
else
@@ -2027,6 +2250,10 @@ CCamera::StartTransition(int16 newMode)
break;
case CCam::MODE_SYPHON:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
Cams[ActiveCam].Alpha = 0.0f;
Cams[ActiveCam].AlphaSpeed = 0.0f;
break;
@@ -2034,20 +2261,29 @@ CCamera::StartTransition(int16 newMode)
case CCam::MODE_CAM_ON_A_STRING:
// Get into vehicle
betaOffset = DEGTORAD(57.0f);
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage)
break;
m_bUseTransitionBeta = true;
targetBeta = CGeneral::GetATanOfXY(pTargetEntity->GetForward().x, pTargetEntity->GetForward().y);
+#ifdef PS2_CAM_TRANSITION
+ camBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y);
+#else
camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
+#endif
deltaBeta = targetBeta - camBeta;
while(deltaBeta >= PI) deltaBeta -= 2*PI;
while(deltaBeta < -PI) deltaBeta += 2*PI;
deltaBeta = Abs(deltaBeta);
- // switchFromFixed logic again here, skipped
+#ifndef PS2_CAM_TRANSITION
+ switchFromFixed = Cams[ActiveCam].Mode == CCam::MODE_FIXED;
if(switchFromFixed){
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
break;
}
+#endif
door = FindPlayerPed()->m_vehEnterType;
if(deltaBeta > HALFPI){
@@ -2075,15 +2311,23 @@ CCamera::StartTransition(int16 newMode)
}
break;
- case CCam::MODE_BEHINDBOAT:
- Cams[ActiveCam].BetaSpeed = 0.0f;
- break;
-
case CCam::MODE_PED_DEAD_BABY:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
Cams[ActiveCam].Alpha = DEGTORAD(15.0f);
break;
+#ifdef PS2_CAM_TRANSITION
+ case CCam::MODE_PLAYER_FALLEN_WATER:
+ Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition;
+ break;
+#endif
+
case CCam::MODE_FIGHT_CAM:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
Cams[ActiveCam].Beta = 0.0f;
Cams[ActiveCam].BetaSpeed = 0.0f;
Cams[ActiveCam].Alpha = 0.0f;
@@ -2091,33 +2335,40 @@ CCamera::StartTransition(int16 newMode)
break;
}
+#ifndef PS2_CAM_TRANSITION
Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode;
m_uiTransitionDuration = 1350;
if(switchSyphonMode)
m_uiTransitionDuration = 1800;
- else if(switchPedMode)
+ else if(switchFromFight)
m_uiTransitionDuration = 750;
-// not on PS2
else if(switchPedToCar){
- m_fFractionInterToStopMovingTarget = 0.2f;
- m_fFractionInterToStopCatchUpTarget = 0.8f;
+ m_fFractionInterToStopMoving = 0.2f;
+ m_fFractionInterToStopCatchUp = 0.8f;
m_uiTransitionDuration = 950;
}else if(switchFromFixed){
- m_fFractionInterToStopMovingTarget = 0.05f;
- m_fFractionInterToStopCatchUpTarget = 0.95f;
+ m_fFractionInterToStopMoving = 0.05f;
+ m_fFractionInterToStopCatchUp = 0.95f;
}else if(switch1stPersonToVehicle){
- m_fFractionInterToStopMovingTarget = 0.0f;
- m_fFractionInterToStopCatchUpTarget = 1.0f;
+ m_fFractionInterToStopMoving = 0.0f;
+ m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 1;
}else
m_uiTransitionDuration = 1350; // already set above
-//
+#else
+ if(switchSyphonMode)
+ m_uiTransitionDuration = 1800;
+ else if(switchFromFight)
+ m_uiTransitionDuration = 750;
+ else
+ m_uiTransitionDuration = 1350;
+#endif
m_uiTransitionState = 1;
m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds();
m_uiTransitionJUSTStarted = 1;
-// PS2 returns here
+#ifndef PS2_CAM_TRANSITION
if(m_vecDoingSpecialInterPolation){
m_cvecStartingSourceForInterPol = SourceDuringInter;
m_cvecStartingTargetForInterPol = TargetDuringInter;
@@ -2149,19 +2400,27 @@ CCamera::StartTransition(int16 newMode)
m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame;
Cams[ActiveCam].ResetStatics = true;
if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){
- m_fFractionInterToStopMovingTarget = m_fScriptPercentageInterToStopMoving;
- m_fFractionInterToStopCatchUpTarget = m_fScriptPercentageInterToCatchUp;
+ m_fFractionInterToStopMoving = m_fScriptPercentageInterToStopMoving;
+ m_fFractionInterToStopCatchUp = m_fScriptPercentageInterToCatchUp;
m_uiTransitionDuration = m_fScriptTimeForInterPolation;
}
+#endif
}
void
CCamera::StartTransitionWhenNotFinishedInter(int16 mode)
{
+#ifdef PS2_CAM_TRANSITION
+ m_vecOldSourceForInter = GetPosition();
+ m_vecOldFrontForInter = GetForward();
+ m_vecOldUpForInter = GetUp();
+ m_vecOldFOVForInter = CDraw::GetFOV();
+#endif
m_vecDoingSpecialInterPolation = true;
StartTransition(mode);
}
+#ifndef PS2_CAM_TRANSITION
void
CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV)
{
@@ -2174,7 +2433,7 @@ CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up
m_fBetaDuringInterPol = CGeneral::GetATanOfXY(Dist.x, Dist.y);
m_fAlphaDuringInterPol = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
}
-
+#endif
void
@@ -2208,7 +2467,7 @@ CCamera::ProcessWideScreenOn(void)
void
CCamera::DrawBordersForWideScreen(void)
{
- if(m_BlurType == MBLUR_NONE || m_BlurType == MBLUR_NORMAL)
+ if(m_BlurType == MOTION_BLUR_NONE || m_BlurType == MOTION_BLUR_LIGHT_SCENE)
SetMotionBlurAlpha(80);
CSprite2d::DrawRect(
@@ -2244,82 +2503,77 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
switch(obbeMode){
case OBBE_WHEEL:
veh = FindPlayerVehicle();
- if(veh == nil){
- if(CTimer::GetTimeInMilliseconds() > t+5000)
+ if(veh){
+ if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO)
return true;
- SetNearClipScript(0.6f);
- return false;
- }
- if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO)
- return true;
- if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){
- if(CTimer::GetTimeInMilliseconds() > t+5000)
+ if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false))
return true;
- SetNearClipScript(0.6f);
- return false;
}
- return true;
+ if(CTimer::GetTimeInMilliseconds() > t+5000)
+ return true;
+ SetNearClipScript(0.6f);
+ return false;
case OBBE_1:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true;
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- // too close
- if(fwd.Magnitude() < 1.6f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ // too close
+ if(fwd.Magnitude() < 1.6f)
+ return true;
+ return false;
case OBBE_2:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true;
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
-
- if(fwd.Magnitude() < 2.0f)
- // very close, fix near clip
- SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f));
- // too far and driving away from cam
- if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- // too close
- if(fwd.Magnitude() < 1.6f)
- return true;
- return false;
- }
- return true;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
+
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ if(fwd.Magnitude() < 2.0f)
+ // very close, fix near clip
+ SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f));
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ // too close
+ if(fwd.Magnitude() < 1.6f)
+ return true;
+ return false;
case OBBE_3:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_1STPERSON:
return CTimer::GetTimeInMilliseconds() > t+3000;
case OBBE_5:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true;
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_ONSTRING:
return CTimer::GetTimeInMilliseconds() > t+3000;
case OBBE_COPCAR:
@@ -2327,59 +2581,58 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
case OBBE_COPCAR_WHEEL:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true;
- if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){
- if(CTimer::GetTimeInMilliseconds() > t+1000)
- return true;
- SetNearClipScript(0.6f);
- return false;
- }
- return true;
+ if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false))
+ return true;
+ if(CTimer::GetTimeInMilliseconds() > t+1000)
+ return true;
+ SetNearClipScript(0.6f);
+ return false;
// Ped modes
case OBBE_9:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_10:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_11:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_12:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_13:
return CTimer::GetTimeInMilliseconds() > t+5000;
default:
@@ -2654,7 +2907,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
}
}
-static int32 SequenceOfCams[16] = {
+int32 SequenceOfCams[16] = {
OBBE_WHEEL, OBBE_COPCAR, OBBE_3, OBBE_1, OBBE_3, OBBE_COPCAR_WHEEL,
OBBE_2, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_COPCAR, OBBE_2, OBBE_3,
OBBE_5, OBBE_3,
@@ -2690,7 +2943,7 @@ CCamera::ProcessObbeCinemaCameraCar(void)
bDidWeProcessAnyCinemaCam = true;
}
-static int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 };
+int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 };
void
CCamera::ProcessObbeCinemaCameraPed(void)
@@ -2725,15 +2978,15 @@ CCamera::LoadTrainCamNodes(char const *name)
char token[16] = { 0 };
char filename[16] = { 0 };
uint8 *buf;
- int bufpos = 0;
+ size_t bufpos = 0;
int field = 0;
int tokpos = 0;
char c;
int i;
- int len;
+ size_t len;
strcpy(filename, name);
- len = strlen(filename);
+ len = (int)strlen(filename);
filename[len] = '.';
filename[len+1] = 'd';
filename[len+2] = 'a';
@@ -2869,6 +3122,13 @@ CCamera::Process_Train_Camera_Control(void)
if(node >= m_uiNumberOfTrainCamNodes)
node = 0;
}
+#ifdef FIX_BUGS
+ // Not really a bug but be nice and respect the debug mode
+ if(DebugCamMode){
+ TakeControl(target, DebugCamMode, JUMP_CUT, CAMCONTROL_SCRIPT);
+ return;
+ }
+#endif
if(found){
SetWideScreenOn();
@@ -3102,7 +3362,11 @@ CCamera::ProcessMusicFade(void)
if(m_fTimeToFadeMusic == 0.0f)
m_fTimeToFadeMusic = 1.0f;
+#ifdef PS2_MENU
+ if(m_bMoveCamToAvoidGeom || TheMemoryCard.StillToFadeOut){
+#else
if(m_bMoveCamToAvoidGeom || StillToFadeOut){
+#endif
m_fFLOATingFadeMusic = 256.0f;
m_bMoveCamToAvoidGeom = false;
}else
@@ -3218,7 +3482,7 @@ CCamera::GetLookDirection(void)
Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED)
return Cams[ActiveCam].DirectionWasLooking;
- return LOOKING_FORWARD;;
+ return LOOKING_FORWARD;
}
bool
@@ -3276,12 +3540,13 @@ CCamera::UpdateAimingCoors(CVector const &coors)
m_cvecAimingTargetCoors = coors;
}
-void
+bool
CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target)
{
if(CPad::GetPad(0)->GetLookBehindForPed()){
source = pos;
target = dist*Cams[ActiveCam].CamTargetEntity->GetForward() + source;
+ return false;
}else{
float angleX = DEGTORAD((m_f3rdPersonCHairMultX-0.5f) * 1.8f * 0.5f * Cams[ActiveCam].FOV * CDraw::GetAspectRatio());
float angleY = DEGTORAD((0.5f-m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV);
@@ -3290,9 +3555,9 @@ CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source,
target += Cams[ActiveCam].Up * Tan(angleY);
target += CrossProduct(Cams[ActiveCam].Front, Cams[ActiveCam].Up) * Tan(angleX);
target.Normalise();
- float dot = DotProduct(pos - source, target);
- source += dot*target;
+ source += DotProduct(pos - source, target)*target;
target = dist*target + source;
+ return true;
}
}
@@ -3321,9 +3586,9 @@ CCamera::CalculateDerivedValues(void)
{
m_cameraMatrix = Invert(m_matrix);
- float hfov = DEGTORAD(CDraw::GetFOV()/2.0f);
- float c = cos(hfov);
- float s = sin(hfov);
+ float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
+ float c = Cos(hfov);
+ float s = Sin(hfov);
// right plane
m_vecFrustumNormals[0] = CVector(c, -s, 0.0f);
@@ -3357,7 +3622,7 @@ bool
CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
{
RwV3d c;
- c = *(RwV3d*)&center;
+ c = center;
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
if(c.y < CDraw::GetNearClipZ()) return false;
if(c.y > CDraw::GetFarClipZ()) return false;
@@ -3372,7 +3637,7 @@ bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
{
RwV3d c;
- c = *(RwV3d*)&center;
+ c = center;
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
if(c.y + radius < CDraw::GetNearClipZ()) return false;
if(c.y - radius > CDraw::GetFarClipZ()) return false;
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 80fc878e..dd78d952 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -188,7 +188,6 @@ public:
CPed *m_pLastPedLookedAt;// So interpolation works
bool m_bFirstPersonRunAboutActive;
-
CCam(void) { Init(); }
void Init(void);
void Process(void);
@@ -250,11 +249,11 @@ public:
// CCam::Process_Look_At_Cars
// CCam::Process_CheesyZoom
// CCam::Process_Aiming
- // CCam::Process_Bill // same as BehindCar due to unused variables
- // CCam::Process_Im_The_Passenger_Woo_Woo
- // CCam::Process_Blood_On_The_Tracks
- // CCam::Process_Cam_Running_Side_Train
- // CCam::Process_Cam_On_Train_Roof
+ void Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar);
+ void Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float);
+ void Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float);
+ void Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float);
+ void Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float);
// custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
@@ -312,16 +311,16 @@ enum
enum
{
- MBLUR_NONE,
- MBLUR_SNIPER,
- MBLUR_NORMAL,
- MBLUR_INTRO1, // green camera
- MBLUR_INTRO2, // unused
- MBLUR_INTRO3, // bank scene
- MBLUR_INTRO4, // jail break scene
- MBLUR_INTRO5, // explosion
- MBLUR_INTRO6, // player shot
- MBLUR_UNUSED, // pinkish
+ MOTION_BLUR_NONE = 0,
+ MOTION_BLUR_SNIPER,
+ MOTION_BLUR_LIGHT_SCENE,
+ MOTION_BLUR_SECURITY_CAM,
+ MOTION_BLUR_CUT_SCENE,
+ MOTION_BLUR_INTRO,
+ MOTION_BLUR_INTRO2,
+ MOTION_BLUR_SNIPER_ZOOM,
+ MOTION_BLUR_INTRO3,
+ MOTION_BLUR_INTRO4,
};
enum
@@ -426,9 +425,12 @@ public:
float CarZoomValueSmooth;
float DistanceToWater;
+#ifndef PS2_CAM_TRANSITION
float FOVDuringInter;
+#endif
float LODDistMultiplier;
float GenerationDistMultiplier;
+#ifndef PS2_CAM_TRANSITION
float m_fAlphaSpeedAtStartInter;
float m_fAlphaWhenInterPol;
float m_fAlphaDuringInterPol;
@@ -439,6 +441,7 @@ public:
float m_fFOVSpeedAtStartInter;
float m_fStartingBetaForInterPol;
float m_fStartingAlphaForInterPol;
+#endif
float m_PedOrientForBehindOrInFront;
float m_CameraAverageSpeed;
float m_CameraSpeedSoFar;
@@ -488,7 +491,7 @@ public:
CVector m_vecFixedModeSource;
CVector m_vecFixedModeUpOffSet;
CVector m_vecCutSceneOffset;
-
+#ifndef PS2_CAM_TRANSITION
CVector m_cvecStartingSourceForInterPol;
CVector m_cvecStartingTargetForInterPol;
CVector m_cvecStartingUpForInterPol;
@@ -498,11 +501,13 @@ public:
CVector m_vecSourceWhenInterPol;
CVector m_vecTargetWhenInterPol;
CVector m_vecUpWhenInterPol;
-
+#endif
CVector m_vecGameCamPos;
+#ifndef PS2_CAM_TRANSITION
CVector SourceDuringInter;
CVector TargetDuringInter;
CVector UpDuringInter;
+#endif
RwCamera *m_pRwCamera;
CEntity *pTargetEntity;
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
@@ -518,14 +523,13 @@ public:
CVector m_vecOldSourceForInter;
CVector m_vecOldFrontForInter;
CVector m_vecOldUpForInter;
-
float m_vecOldFOVForInter;
float m_fFLOATingFade;
float m_fFLOATingFadeMusic;
float m_fTimeToFadeOut;
float m_fTimeToFadeMusic;
- float m_fFractionInterToStopMovingTarget;
- float m_fFractionInterToStopCatchUpTarget;
+ float m_fFractionInterToStopMoving;
+ float m_fFractionInterToStopCatchUp;
float m_fGaitSwayBuffer;
float m_fScriptPercentageInterToStopMoving;
float m_fScriptPercentageInterToCatchUp;
@@ -624,7 +628,7 @@ public:
void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom);
void ClearPlayerWeaponMode(void);
void UpdateAimingCoors(CVector const &coors);
- void Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
+ bool Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
float Find3rdPersonQuickAimPitch(void);
// Physical camera
diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp
index 4d6bcdab..45fd9832 100644
--- a/src/core/CdStreamPosix.cpp
+++ b/src/core/CdStreamPosix.cpp
@@ -189,10 +189,11 @@ GetGTA3ImgSize(void)
realpath(gImgNames[0], path);
if (stat(path, &statbuf) == -1) {
// Try case-insensitivity
- char *r = (char*)alloca(strlen(gImgNames[0]) + 2);
- if (casepath(gImgNames[0], r))
+ char* real = casepath(gImgNames[0], false);
+ if (real)
{
- realpath(r, path);
+ realpath(real, path);
+ free(real);
if (stat(path, &statbuf) != -1)
goto ok;
}
@@ -210,7 +211,6 @@ CdStreamShutdown(void)
{
// Destroying semaphores and free(gpReadInfo) will be done at threads
#ifndef ONE_THREAD_PER_CHANNEL
- free(gChannelRequestQ.items);
gCdStreamThreadStatus = 2;
sem_post(&gCdStreamSema);
#endif
@@ -442,6 +442,7 @@ void *CdStreamThread(void *param)
sem_destroy(&gpReadInfo[i].pDoneSemaphore);
}
sem_destroy(&gCdStreamSema);
+ free(gChannelRequestQ.items);
#else
sem_destroy(&gpReadInfo[channel].pStartSemaphore);
sem_destroy(&gpReadInfo[channel].pDoneSemaphore);
@@ -460,10 +461,11 @@ CdStreamAddImage(char const *path)
// Fix case sensitivity and backslashes.
if (gImgFiles[gNumImages] == -1) {
- char *r = (char*)alloca(strlen(path) + 2);
- if (casepath(path, r))
+ char* real = casepath(path, false);
+ if (real)
{
- gImgFiles[gNumImages] = open(r, _gdwCdStreamFlags);
+ gImgFiles[gNumImages] = open(real, _gdwCdStreamFlags);
+ free(real);
}
}
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index 01cc323a..99be816f 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -38,7 +38,7 @@ void
CCollision::Init(void)
{
ms_colModelCache.Init(NUMCOLCACHELINKS);
- ms_collisionInMemory = LEVEL_NONE;
+ ms_collisionInMemory = LEVEL_GENERIC;
}
void
@@ -59,7 +59,7 @@ CCollision::Update(void)
return;
// hardcode a level if there are no zones
- if(level == LEVEL_NONE){
+ if(level == LEVEL_GENERIC){
if(CGame::currLevel == LEVEL_INDUSTRIAL &&
playerCoors.x < 400.0f){
level = LEVEL_COMMERCIAL;
@@ -78,7 +78,7 @@ CCollision::Update(void)
}
}
}
- if(level != LEVEL_NONE && level != CGame::currLevel)
+ if(level != LEVEL_GENERIC && level != CGame::currLevel)
CGame::currLevel = level;
if(ms_collisionInMemory != CGame::currLevel)
LoadCollisionWhenINeedIt(forceLevelChange);
@@ -95,10 +95,10 @@ GetCollisionInSectorList(CPtrList &list)
for(node = list.first; node; node = node->next){
e = (CEntity*)node->item;
level = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel()->level;
- if(level != LEVEL_NONE)
+ if(level != LEVEL_GENERIC)
return (eLevelName)level;
}
- return LEVEL_NONE;
+ return LEVEL_GENERIC;
}
// Get a level this sector is in based on collision models
@@ -108,15 +108,15 @@ GetCollisionInSector(CSector &sect)
int level;
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_BUILDINGS]);
- if(level == LEVEL_NONE)
+ if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_BUILDINGS_OVERLAP]);
- if(level == LEVEL_NONE)
+ if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_OBJECTS]);
- if(level == LEVEL_NONE)
+ if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_OBJECTS_OVERLAP]);
- if(level == LEVEL_NONE)
+ if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_DUMMIES]);
- if(level == LEVEL_NONE)
+ if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_DUMMIES_OVERLAP]);
return (eLevelName)level;
}
@@ -133,7 +133,7 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
int xmin, xmax, ymin, ymax;
int x, y;
- level = LEVEL_NONE;
+ level = LEVEL_GENERIC;
playerCoors = FindPlayerCoors();
sx = CWorld::GetSectorIndexX(playerCoors.x);
@@ -161,8 +161,8 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
for(x = xmin; x <= xmax; x++)
for(y = ymin; y <= ymax; y++){
l = GetCollisionInSector(*CWorld::GetSector(x, y));
- if(l != LEVEL_NONE){
- if(level == LEVEL_NONE)
+ if(l != LEVEL_GENERIC){
+ if(level == LEVEL_GENERIC)
level = l;
if(level != l)
multipleLevels = true;
@@ -173,19 +173,23 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
if(multipleLevels && veh && veh->IsBoat())
for(ei = veh->m_entryInfoList.first; ei; ei = ei->next){
level = GetCollisionInSector(*ei->sector);
- if(level != LEVEL_NONE)
+ if(level != LEVEL_GENERIC)
break;
}
}
if(level == CGame::currLevel || forceChange){
CTimer::Stop();
+#ifndef NO_ISLAND_LOADING
DMAudio.SetEffectsFadeVol(0);
CPad::StopPadsShaking();
LoadCollisionScreen(CGame::currLevel);
DMAudio.Service();
+#endif
CPopulation::DealWithZoneChange(ms_collisionInMemory, CGame::currLevel, false);
+
+#ifndef NO_ISLAND_LOADING
CStreaming::RemoveIslandsNotUsed(LEVEL_INDUSTRIAL);
CStreaming::RemoveIslandsNotUsed(LEVEL_COMMERCIAL);
CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN);
@@ -196,19 +200,27 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
CStreaming::RemoveUnusedModelsInLoadedList();
CGame::TidyUpMemory(true, true);
CFileLoader::LoadCollisionFromDatFile(CGame::currLevel);
+#endif
+
ms_collisionInMemory = CGame::currLevel;
CReplay::EmptyReplayBuffer();
- if(CGame::currLevel != LEVEL_NONE)
+#ifndef NO_ISLAND_LOADING
+ if(CGame::currLevel != LEVEL_GENERIC)
LoadSplash(GetLevelSplashScreen(CGame::currLevel));
CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
CStreaming::RemoveUnusedBuildings(CGame::currLevel);
CStreaming::RequestBigBuildings(CGame::currLevel);
+#endif
CStreaming::LoadAllRequestedModels(true);
+#ifndef NO_ISLAND_LOADING
CStreaming::HaveAllBigBuildingsLoaded(CGame::currLevel);
CGame::TidyUpMemory(true, true);
+#endif
CTimer::Update();
+#ifndef NO_ISLAND_LOADING
DMAudio.SetEffectsFadeVol(127);
+#endif
}
}
@@ -217,10 +229,23 @@ CCollision::SortOutCollisionAfterLoad(void)
{
if(ms_collisionInMemory == CGame::currLevel)
return;
-
+#ifndef NO_ISLAND_LOADING
CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel);
- if(CGame::currLevel != LEVEL_NONE){
+#endif
+ if (CGame::currLevel != LEVEL_GENERIC) {
+#ifdef NO_ISLAND_LOADING
+ static bool bAlreadyLoaded = false;
+ if (bAlreadyLoaded) {
+ ms_collisionInMemory = CGame::currLevel;
+ return;
+ }
+ bAlreadyLoaded = true;
+ CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL);
+ CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL);
+ CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN);
+#else
CFileLoader::LoadCollisionFromDatFile(CGame::currLevel);
+#endif
if(!CGame::playingIntro)
LoadSplash(GetLevelSplashScreen(CGame::currLevel));
}
@@ -370,7 +395,7 @@ CCollision::TestVerticalLineBox(const CColLine &line, const CColBox &box)
}
bool
-CCollision::TestLineTriangle(const CColLine &line, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane)
+CCollision::TestLineTriangle(const CColLine &line, const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane)
{
float t;
CVector normal;
@@ -385,9 +410,9 @@ CCollision::TestLineTriangle(const CColLine &line, const CVector *verts, const C
// find point of intersection
CVector p = line.p0 + (line.p1-line.p0)*t;
- const CVector &va = verts[tri.a];
- const CVector &vb = verts[tri.b];
- const CVector &vc = verts[tri.c];
+ const CVector &va = verts[tri.a].Get();
+ const CVector &vb = verts[tri.b].Get();
+ const CVector &vc = verts[tri.c].Get();
CVector2D vec1, vec2, vec3, vect;
// We do the test in 2D. With the plane direction we
@@ -480,15 +505,16 @@ CCollision::TestLineSphere(const CColLine &line, const CColSphere &sph)
bool
CCollision::TestSphereTriangle(const CColSphere &sphere,
- const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane)
+ const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane)
{
// If sphere and plane don't intersect, no collision
- if(Abs(plane.CalcPoint(sphere.center)) > sphere.radius)
+ float planedist = plane.CalcPoint(sphere.center);
+ if(Abs(planedist) > sphere.radius)
return false;
- const CVector &va = verts[tri.a];
- const CVector &vb = verts[tri.b];
- const CVector &vc = verts[tri.c];
+ const CVector &va = verts[tri.a].Get();
+ const CVector &vb = verts[tri.b].Get();
+ const CVector &vc = verts[tri.c].Get();
// calculate two orthogonal basis vectors for the triangle
CVector vec2 = vb - va;
@@ -512,23 +538,29 @@ CCollision::TestSphereTriangle(const CColSphere &sphere,
int testcase = insideAB + insideAC + insideBC;
float dist = 0.0f;
- if(testcase == 1){
+ switch(testcase){
+ case 1:
// closest to a vertex
if(insideAB) dist = (sphere.center - vc).Magnitude();
else if(insideAC) dist = (sphere.center - vb).Magnitude();
else if(insideBC) dist = (sphere.center - va).Magnitude();
else assert(0);
- }else if(testcase == 2){
+ break;
+ case 2:
// closest to an edge
+ // looks like original game as DistToLine manually inlined
if(!insideAB) dist = DistToLine(&va, &vb, &sphere.center);
else if(!insideAC) dist = DistToLine(&va, &vc, &sphere.center);
else if(!insideBC) dist = DistToLine(&vb, &vc, &sphere.center);
else assert(0);
- }else if(testcase == 3){
+ break;
+ case 3:
// center is in triangle
- return true;
- }else
- assert(0); // front fell off
+ dist = Abs(planedist);
+ break;
+ default:
+ assert(0);
+ }
return dist < sphere.radius;
}
@@ -547,21 +579,24 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
if(!TestLineBox(newline, model.boundingBox))
return false;
- for(i = 0; i < model.numSpheres; i++)
- if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD)
- if(TestLineSphere(newline, model.spheres[i]))
- return true;
+ for(i = 0; i < model.numSpheres; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ if(TestLineSphere(newline, model.spheres[i]))
+ return true;
+ }
- for(i = 0; i < model.numBoxes; i++)
- if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD)
- if(TestLineBox(newline, model.boxes[i]))
- return true;
+ for(i = 0; i < model.numBoxes; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue;
+ if(TestLineBox(newline, model.boxes[i]))
+ return true;
+ }
CalculateTrianglePlanes(&model);
- for(i = 0; i < model.numTriangles; i++)
- if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD)
- if(TestLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i]))
- return true;
+ for(i = 0; i < model.numTriangles; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(TestLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i]))
+ return true;
+ }
return false;
}
@@ -836,16 +871,16 @@ CCollision::ProcessLineSphere(const CColLine &line, const CColSphere &sphere, CC
bool
CCollision::ProcessVerticalLineTriangle(const CColLine &line,
- const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
+ const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
CColPoint &point, float &mindist, CStoredCollPoly *poly)
{
float t;
CVector normal;
const CVector &p0 = line.p0;
- const CVector &va = verts[tri.a];
- const CVector &vb = verts[tri.b];
- const CVector &vc = verts[tri.c];
+ const CVector &va = verts[tri.a].Get();
+ const CVector &vb = verts[tri.b].Get();
+ const CVector &vc = verts[tri.c].Get();
// early out bound rect test
if(p0.x < va.x && p0.x < vb.x && p0.x < vc.x) return false;
@@ -910,6 +945,7 @@ CCollision::ProcessVerticalLineTriangle(const CColLine &line,
if(CrossProduct2D(vec2-vec1, vect-vec1) < 0.0f) return false;
if(CrossProduct2D(vec3-vec1, vect-vec1) > 0.0f) return false;
if(CrossProduct2D(vec3-vec2, vect-vec2) < 0.0f) return false;
+ if(t >= mindist) return false;
point.point = p;
point.normal = normal;
point.surfaceA = 0;
@@ -935,16 +971,12 @@ CCollision::IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CCol
return false;
// maybe inlined?
- CColTriangle tri;
- tri.a = 0;
- tri.b = 1;
- tri.c = 2;
CColTrianglePlane plane;
- plane.Set(poly->verts, tri);
+ plane.Set(poly->verts[0], poly->verts[1], poly->verts[2]);
- const CVector &va = poly->verts[tri.a];
- const CVector &vb = poly->verts[tri.b];
- const CVector &vc = poly->verts[tri.c];
+ const CVector &va = poly->verts[0];
+ const CVector &vb = poly->verts[1];
+ const CVector &vc = poly->verts[2];
CVector p0 = pos;
CVector p1(pos.x, pos.y, z);
@@ -1009,7 +1041,7 @@ CCollision::IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CCol
bool
CCollision::ProcessLineTriangle(const CColLine &line ,
- const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
+ const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
CColPoint &point, float &mindist)
{
float t;
@@ -1028,9 +1060,9 @@ CCollision::ProcessLineTriangle(const CColLine &line ,
// find point of intersection
CVector p = line.p0 + (line.p1-line.p0)*t;
- const CVector &va = verts[tri.a];
- const CVector &vb = verts[tri.b];
- const CVector &vc = verts[tri.c];
+ const CVector &va = verts[tri.a].Get();
+ const CVector &vb = verts[tri.b].Get();
+ const CVector &vc = verts[tri.c].Get();
CVector2D vec1, vec2, vec3, vect;
switch(plane.dir){
@@ -1076,6 +1108,7 @@ CCollision::ProcessLineTriangle(const CColLine &line ,
if(CrossProduct2D(vec2-vec1, vect-vec1) < 0.0f) return false;
if(CrossProduct2D(vec3-vec1, vect-vec1) > 0.0f) return false;
if(CrossProduct2D(vec3-vec2, vect-vec2) < 0.0f) return false;
+ if(t >= mindist) return false;
point.point = p;
point.normal = normal;
point.surfaceA = 0;
@@ -1088,7 +1121,7 @@ CCollision::ProcessLineTriangle(const CColLine &line ,
bool
CCollision::ProcessSphereTriangle(const CColSphere &sphere,
- const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
+ const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
CColPoint &point, float &mindistsq)
{
// If sphere and plane don't intersect, no collision
@@ -1097,9 +1130,9 @@ CCollision::ProcessSphereTriangle(const CColSphere &sphere,
if(Abs(planedist) > sphere.radius || distsq > mindistsq)
return false;
- const CVector &va = verts[tri.a];
- const CVector &vb = verts[tri.b];
- const CVector &vc = verts[tri.c];
+ const CVector &va = verts[tri.a].Get();
+ const CVector &vb = verts[tri.b].Get();
+ const CVector &vc = verts[tri.c].Get();
// calculate two orthogonal basis vectors for the triangle
CVector normal;
@@ -1126,25 +1159,31 @@ CCollision::ProcessSphereTriangle(const CColSphere &sphere,
int testcase = insideAB + insideAC + insideBC;
float dist = 0.0f;
CVector p;
- if(testcase == 1){
+ switch(testcase){
+ case 1:
// closest to a vertex
if(insideAB) p = vc;
else if(insideAC) p = vb;
else if(insideBC) p = va;
else assert(0);
dist = (sphere.center - p).Magnitude();
- }else if(testcase == 2){
+ break;
+ case 2:
// closest to an edge
+ // looks like original game as DistToLine manually inlined
if(!insideAB) dist = DistToLine(&va, &vb, &sphere.center, p);
else if(!insideAC) dist = DistToLine(&va, &vc, &sphere.center, p);
else if(!insideBC) dist = DistToLine(&vb, &vc, &sphere.center, p);
else assert(0);
- }else if(testcase == 3){
+ break;
+ case 3:
// center is in triangle
dist = Abs(planedist);
p = sphere.center - normal*planedist;
- }else
- assert(0); // front fell off
+ break;
+ default:
+ assert(0);
+ }
if(dist >= sphere.radius || dist*dist >= mindistsq)
return false;
@@ -1178,18 +1217,21 @@ CCollision::ProcessLineOfSight(const CColLine &line,
return false;
float coldist = mindist;
- for(i = 0; i < model.numSpheres; i++)
- if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD)
- ProcessLineSphere(newline, model.spheres[i], point, coldist);
+ for(i = 0; i < model.numSpheres; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ ProcessLineSphere(newline, model.spheres[i], point, coldist);
+ }
- for(i = 0; i < model.numBoxes; i++)
- if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD)
- ProcessLineBox(newline, model.boxes[i], point, coldist);
+ for(i = 0; i < model.numBoxes; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue;
+ ProcessLineBox(newline, model.boxes[i], point, coldist);
+ }
CalculateTrianglePlanes(&model);
- for(i = 0; i < model.numTriangles; i++)
- if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD)
- ProcessLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist);
+ for(i = 0; i < model.numTriangles; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ ProcessLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist);
+ }
if(coldist < mindist){
point.point = matrix * point.point;
@@ -1218,24 +1260,27 @@ CCollision::ProcessVerticalLine(const CColLine &line,
return false;
float coldist = mindist;
- for(i = 0; i < model.numSpheres; i++)
- if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD)
- ProcessLineSphere(newline, model.spheres[i], point, coldist);
+ for(i = 0; i < model.numSpheres; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ ProcessLineSphere(newline, model.spheres[i], point, coldist);
+ }
- for(i = 0; i < model.numBoxes; i++)
- if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD)
- ProcessLineBox(newline, model.boxes[i], point, coldist);
+ for(i = 0; i < model.numBoxes; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue;
+ ProcessLineBox(newline, model.boxes[i], point, coldist);
+ }
CalculateTrianglePlanes(&model);
TempStoredPoly.valid = false;
- for(i = 0; i < model.numTriangles; i++)
- if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD)
- ProcessVerticalLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist, &TempStoredPoly);
+ for(i = 0; i < model.numTriangles; i++){
+ if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ ProcessVerticalLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist, &TempStoredPoly);
+ }
if(coldist < mindist){
point.point = matrix * point.point;
point.normal = Multiply3x3(matrix, point.normal);
- if(poly && TempStoredPoly.valid){
+ if(TempStoredPoly.valid && poly){
*poly = TempStoredPoly;
poly->verts[0] = matrix * poly->verts[0];
poly->verts[1] = matrix * poly->verts[1];
@@ -1758,15 +1803,15 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
b *= f;
}
- if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
- s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
+ if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE ||
+ s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE)
if(CTimer::GetFrameCounter() & 1){
r = 0;
g = 0;
b = 0;
}
- if(s > SURFACE_GATE){
+ if(s > SURFACE_METAL_GATE){
r = CGeneral::GetRandomNumber();
g = CGeneral::GetRandomNumber();
b = CGeneral::GetRandomNumber();
@@ -1839,8 +1884,8 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
b *= f;
}
- if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
- s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
+ if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE ||
+ s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE)
if(CTimer::GetFrameCounter() & 1){
r = 0;
g = 0;
@@ -1934,7 +1979,7 @@ CColLine::Set(const CVector &p0, const CVector &p1)
}
void
-CColTriangle::Set(const CVector *, int a, int b, int c, uint8 surf, uint8 piece)
+CColTriangle::Set(const CompressedVector *, int a, int b, int c, uint8 surf, uint8 piece)
{
this->a = a;
this->b = b;
@@ -1943,12 +1988,8 @@ CColTriangle::Set(const CVector *, int a, int b, int c, uint8 surf, uint8 piece)
}
void
-CColTrianglePlane::Set(const CVector *v, CColTriangle &tri)
+CColTrianglePlane::Set(const CVector &va, const CVector &vb, const CVector &vc)
{
- const CVector &va = v[tri.a];
- const CVector &vb = v[tri.b];
- const CVector &vc = v[tri.c];
-
normal = CrossProduct(vc-va, vb-va);
normal.Normalise();
dist = DotProduct(normal, va);
@@ -2038,7 +2079,7 @@ CColModel::GetLinkPtr(void)
void
CColModel::GetTrianglePoint(CVector &v, int i) const
{
- v = vertices[i];
+ v = vertices[i].Get();
}
CColModel&
@@ -2117,7 +2158,7 @@ CColModel::operator=(const CColModel &other)
if(vertices)
RwFree(vertices);
if(numVerts){
- vertices = (CVector*)RwMalloc(numVerts*sizeof(CVector));
+ vertices = (CompressedVector*)RwMalloc(numVerts*sizeof(CompressedVector));
for(i = 0; i < numVerts; i++)
vertices[i] = other.vertices[i];
}
diff --git a/src/core/Collision.h b/src/core/Collision.h
index 895f012a..d988f0c2 100644
--- a/src/core/Collision.h
+++ b/src/core/Collision.h
@@ -10,6 +10,19 @@
#define MAX_COLLISION_POINTS 32
#endif
+struct CompressedVector
+{
+#ifdef COMPRESSED_COL_VECTORS
+ int16 x, y, z;
+ CVector Get(void) const { return CVector(x, y, z)/128.0f; };
+ void Set(float x, float y, float z) { this->x = x*128.0f; this->y = y*128.0f; this->z = z*128.0f; };
+#else
+ float x, y, z;
+ CVector Get(void) const { return CVector(x, y, z); };
+ void Set(float x, float y, float z) { this->x = x; this->y = y; this->z = z; };
+#endif
+};
+
struct CColSphere
{
CVector center;
@@ -51,7 +64,7 @@ struct CColTriangle
uint16 c;
uint8 surface;
- void Set(const CVector *v, int a, int b, int c, uint8 surf, uint8 piece);
+ void Set(const CompressedVector *v, int a, int b, int c, uint8 surf, uint8 piece);
};
struct CColTrianglePlane
@@ -60,7 +73,8 @@ struct CColTrianglePlane
float dist;
uint8 dir;
- void Set(const CVector *v, CColTriangle &tri);
+ void Set(const CVector &va, const CVector &vb, const CVector &vc);
+ void Set(const CompressedVector *v, CColTriangle &tri) { Set(v[tri.a].Get(), v[tri.b].Get(), v[tri.c].Get()); }
void GetNormal(CVector &n) const { n = normal; }
float CalcPoint(const CVector &v) const { return DotProduct(normal, v) - dist; };
};
@@ -94,11 +108,11 @@ struct CColModel
int16 numBoxes;
int16 numTriangles;
int32 level;
- bool ownsCollisionVolumes;
+ bool ownsCollisionVolumes; // missing on PS2
CColSphere *spheres;
CColLine *lines;
CColBox *boxes;
- CVector *vertices;
+ CompressedVector *vertices;
CColTriangle *triangles;
CColTrianglePlane *trianglePlanes;
@@ -136,18 +150,18 @@ public:
static bool TestSphereBox(const CColSphere &sph, const CColBox &box);
static bool TestLineBox(const CColLine &line, const CColBox &box);
static bool TestVerticalLineBox(const CColLine &line, const CColBox &box);
- static bool TestLineTriangle(const CColLine &line, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane);
+ static bool TestLineTriangle(const CColLine &line, const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane);
static bool TestLineSphere(const CColLine &line, const CColSphere &sph);
- static bool TestSphereTriangle(const CColSphere &sphere, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane);
+ static bool TestSphereTriangle(const CColSphere &sphere, const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane);
static bool TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, bool ignoreSeeThrough);
static bool ProcessSphereSphere(const CColSphere &s1, const CColSphere &s2, CColPoint &point, float &mindistsq);
static bool ProcessSphereBox(const CColSphere &sph, const CColBox &box, CColPoint &point, float &mindistsq);
static bool ProcessLineBox(const CColLine &line, const CColBox &box, CColPoint &point, float &mindist);
- static bool ProcessVerticalLineTriangle(const CColLine &line, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindist, CStoredCollPoly *poly);
- static bool ProcessLineTriangle(const CColLine &line , const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindist);
+ static bool ProcessVerticalLineTriangle(const CColLine &line, const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindist, CStoredCollPoly *poly);
+ static bool ProcessLineTriangle(const CColLine &line , const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindist);
static bool ProcessLineSphere(const CColLine &line, const CColSphere &sphere, CColPoint &point, float &mindist);
- static bool ProcessSphereTriangle(const CColSphere &sph, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindistsq);
+ static bool ProcessSphereTriangle(const CColSphere &sph, const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindistsq);
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);
diff --git a/src/core/Directory.cpp b/src/core/Directory.cpp
index cc4d65d8..05344065 100644
--- a/src/core/Directory.cpp
+++ b/src/core/Directory.cpp
@@ -30,7 +30,8 @@ CDirectory::ReadDirFile(const char *filename)
bool
CDirectory::WriteDirFile(const char *filename)
{
- int fd, n;
+ int fd;
+ size_t n;
fd = CFileMgr::OpenFileForWriting(filename);
n = CFileMgr::Write(fd, (char*)entries, numEntries*sizeof(DirectoryInfo));
CFileMgr::CloseFile(fd);
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index 6e7188c5..b4da1a5e 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -104,7 +104,9 @@ CFileLoader::LoadLevel(const char *filename)
LoadingScreenLoadingFile(line + 8);
LoadMapZones(line + 8);
}else if(strncmp(line, "SPLASH", 6) == 0){
+#ifndef DISABLE_LOADING_SCREEN
LoadSplash(GetRandomSplashScreen());
+#endif
}else if(strncmp(line, "CDIMAGE", 7) == 0){
CdStreamAddImage(line + 8);
}
@@ -262,12 +264,12 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
int32 numVertices = *(int16*)buf;
buf += 4;
if(numVertices > 0){
- model.vertices = (CVector*)RwMalloc(numVertices*sizeof(CVector));
+ model.vertices = (CompressedVector*)RwMalloc(numVertices*sizeof(CompressedVector));
for(i = 0; i < numVertices; i++){
- model.vertices[i] = *(CVector*)buf;
- if(Abs(model.vertices[i].x) >= 256.0f ||
- Abs(model.vertices[i].y) >= 256.0f ||
- Abs(model.vertices[i].z) >= 256.0f)
+ model.vertices[i].Set(*(float*)buf, *(float*)(buf+4), *(float*)(buf+8));
+ if(Abs(*(float*)buf) >= 256.0f ||
+ Abs(*(float*)(buf+4)) >= 256.0f ||
+ Abs(*(float*)(buf+8)) >= 256.0f)
printf("%s:Collision volume too big\n", modelname);
buf += 12;
}
@@ -945,7 +947,7 @@ CFileLoader::Load2dEffect(const char *line)
&effect->light.dist,
&effect->light.range,
&effect->light.size,
- &effect->light.shadowRange,
+ &effect->light.shadowSize,
&shadowIntens, &lightType, &roadReflection, &flare, &flags);
effect->light.corona = RwTextureRead(corona, nil);
effect->light.shadow = RwTextureRead(shadow, nil);
@@ -977,7 +979,7 @@ CFileLoader::Load2dEffect(const char *line)
&effect->attractor.dir.y,
&effect->attractor.dir.z,
&probability);
- effect->attractor.flags = flags;
+ effect->attractor.type = flags;
effect->attractor.probability = probability;
break;
}
diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp
index 1939c861..ac51f8de 100644
--- a/src/core/FileMgr.cpp
+++ b/src/core/FileMgr.cpp
@@ -4,6 +4,7 @@
#include <direct.h>
#endif
#include "common.h"
+#include "crossplatform.h"
#include "FileMgr.h"
@@ -31,19 +32,16 @@ static myFILE myfiles[NUMFILES];
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
-#include "crossplatform.h"
#define _getcwd getcwd
// Case-insensitivity on linux (from https://github.com/OneSadCookie/fcaseopen)
void mychdir(char const *path)
{
- char *r = (char*)alloca(strlen(path) + 2);
- if (casepath(path, r))
- {
+ char* r = casepath(path, false);
+ if (r) {
chdir(r);
- }
- else
- {
+ free(r);
+ } else {
errno = ENOENT;
}
}
@@ -73,30 +71,7 @@ found:
*p++ = 'b';
*p = '\0';
-#if !defined(_WIN32)
- char *newPath = strdup(filename);
- // Normally casepath() fixes backslashes, but if the mode is sth other than r/rb it will create new file with backslashes on linux, so fix backslashes here
- char *nextBs;
- while(nextBs = strstr(newPath, "\\")){
- *nextBs = '/';
- }
-#else
- const char *newPath = filename;
-#endif
-
- myfiles[fd].file = fopen(newPath, realmode);
-// Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/)
-#if !defined(_WIN32)
- if (!myfiles[fd].file) {
- char *r = (char*)alloca(strlen(newPath) + 2);
- if (casepath(newPath, r))
- {
- myfiles[fd].file = fopen(r, realmode);
- }
- }
-
- free(newPath);
-#endif
+ myfiles[fd].file = fcaseopen(filename, realmode);
if(myfiles[fd].file == nil)
return 0;
return fd;
@@ -163,7 +138,7 @@ myfgets(char *buf, int len, int fd)
return buf;
}
-static int
+static size_t
myfread(void *buf, size_t elt, size_t n, int fd)
{
if(myfiles[fd].isText){
@@ -184,7 +159,7 @@ myfread(void *buf, size_t elt, size_t n, int fd)
return fread(buf, elt, n, myfiles[fd].file);
}
-static int
+static size_t
myfwrite(void *buf, size_t elt, size_t n, int fd)
{
if(myfiles[fd].isText){
@@ -265,11 +240,11 @@ CFileMgr::SetDirMyDocuments(void)
mychdir(_psGetUserFilesFolder());
}
-int
+size_t
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
{
int fd;
- int n, len;
+ size_t n, len;
fd = myfopen(file, mode);
if(fd == 0)
@@ -298,13 +273,13 @@ CFileMgr::OpenFileForWriting(const char *file)
return OpenFile(file, "wb");
}
-int
+size_t
CFileMgr::Read(int fd, const char *buf, int len)
{
return myfread((void*)buf, 1, len, fd);
}
-int
+size_t
CFileMgr::Write(int fd, const char *buf, int len)
{
return myfwrite((void*)buf, 1, len, fd);
diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h
index a6e4b6e5..0ad9daa7 100644
--- a/src/core/FileMgr.h
+++ b/src/core/FileMgr.h
@@ -9,11 +9,12 @@ public:
static void ChangeDir(const char *dir);
static void SetDir(const char *dir);
static void SetDirMyDocuments(void);
- static int LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
+ static size_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static int OpenFile(const char *file, const char *mode);
+ static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file);
- static int Read(int fd, const char *buf, int len);
- static int Write(int fd, const char *buf, int len);
+ static size_t Read(int fd, const char *buf, int len);
+ static size_t Write(int fd, const char *buf, int len);
static bool Seek(int fd, int offset, int whence);
static bool ReadLine(int fd, char *buf, int len);
static int CloseFile(int fd);
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index 933c73da..c6dece6a 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -128,11 +128,8 @@ CFire::ProcessFire(void)
lightpos.z = m_vecPos.z + 5.0f;
if (!m_pEntity) {
- CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos,
- 7.0f, 0.0f, 0.0f, -7.0f,
- 255, // this is 0 on PC which results in no shadow
- nRandNumber / 2, nRandNumber / 2, 0,
- 10.0f, 1.0f, 40.0f, 0, 0.0f);
+ CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, 7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2,
+ nRandNumber / 2, 0, 10.0f, 1.0f, 40.0f, 0, 0.0f);
}
fGreen = nRandNumber / 128;
fRed = nRandNumber / 128;
diff --git a/src/core/FrontEndControls.cpp b/src/core/FrontEndControls.cpp
index 866be42f..68992e16 100644
--- a/src/core/FrontEndControls.cpp
+++ b/src/core/FrontEndControls.cpp
@@ -1,15 +1,13 @@
#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"
+#define X SCREEN_SCALE_X
+#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL)))
void
CPlaceableShText::Draw(float x, float y)
@@ -490,7 +488,7 @@ void
CMenuMultiChoiceTriggered::SelectCurrentOptionUnderCursor(void)
{
CMenuMultiChoice::SelectCurrentOptionUnderCursor();
- if(m_cursor != -1)
+ if(m_cursor != -1 && m_triggers[m_cursor] != nil )
m_triggers[m_cursor](this);
}
@@ -581,7 +579,10 @@ CMenuMultiChoicePictured::Draw(const CRGBA &optionHighlight, const CRGBA &titleH
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);
+ {
+ uint8 color = Max(Max(optionHighlight.r, optionHighlight.g), optionHighlight.b);
+ m_sprites[i].Draw(CRGBA(color, color, color, optionHighlight.a), m_position.x+x, m_position.y+y);
+ }
}else{
if(m_bHasSprite[i]){
if(m_options[i].m_bSelected)
@@ -1210,10 +1211,10 @@ CMenuSlider::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, flo
{
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)
+ if(optionHighlight.red == SELECTED_TEXT_COLOR_0.red &&
+ optionHighlight.green == SELECTED_TEXT_COLOR_0.green &&
+ optionHighlight.blue == SELECTED_TEXT_COLOR_0.blue &&
+ optionHighlight.alpha == SELECTED_TEXT_COLOR_0.alpha)
selectionCol = m_colors[1];
if(m_style == 1){
@@ -1223,10 +1224,10 @@ CMenuSlider::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, flo
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),
+ CRect(boxPos.x + X(m_box.m_shadowOffset.x),
+ boxPos.y + Y(m_box.m_shadowOffset.y),
+ boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
+ boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol);
CSprite2d::DrawRect(
CRect(boxPos.x, boxPos.y,
@@ -1266,10 +1267,10 @@ CMenuSlider::DrawNormal(float x, float y)
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),
+ CRect(boxPos.x + X(m_box.m_shadowOffset.x),
+ boxPos.y + Y(m_box.m_shadowOffset.y),
+ boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
+ boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol);
CSprite2d::DrawRect(
CRect(boxPos.x, boxPos.y,
@@ -1312,10 +1313,10 @@ CMenuSlider::DrawHighlighted(const CRGBA &titleHighlight, float x, float y)
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),
+ CRect(boxPos.x + X(m_box.m_shadowOffset.x),
+ boxPos.y + Y(m_box.m_shadowOffset.y),
+ boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
+ boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol);
CSprite2d::DrawRect(
CRect(boxPos.x, boxPos.y,
@@ -1345,20 +1346,20 @@ 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;
+ int numTicks = size.x / 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);
+ CRect rect(position.x + X(8.0f)*i, position.y + dy - stepy*i,
+ position.x + X(8.0f)*i + X(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;
+ shadowRect.left += X(shadowOffset.x);
+ shadowRect.right += X(shadowOffset.x);
+ shadowRect.top += Y(shadowOffset.y);
+ shadowRect.bottom += Y(shadowOffset.y);
CSprite2d::DrawRect(shadowRect, shadowColor);
}
if(i < left)
@@ -1375,19 +1376,19 @@ 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;
+ int numTicks = size.x / 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);
+ CRect rect(position.x + X(8.0f)*i, position.y + dy - stepy*i,
+ position.x + X(8.0f)*i + X(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;
+ shadowRect.left += X(shadowOffset.x);
+ shadowRect.right += X(shadowOffset.x);
+ shadowRect.top += Y(shadowOffset.y);
+ shadowRect.bottom += Y(shadowOffset.y);
CSprite2d::DrawRect(shadowRect, shadowColor);
}
if(i < left)
@@ -1553,7 +1554,7 @@ CMenuLineLister::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight,
for(; i < n; i++){
CVector2D linePos = m_linesLeft[i].m_position;
- if(linePos.y+m_position.y - (m_scrollPosition+m_position.y) < 64.0f)
+ if(linePos.y+m_position.y - (m_scrollPosition+m_position.y) < Y(64.0f))
m_lineFade[i] = -4.0f*Abs(m_scrollSpeed);
else
m_lineFade[i] = 4.0f*Abs(m_scrollSpeed);
@@ -1652,7 +1653,12 @@ CMenuPage::ActiveMenuTwoState_SelectNextPosition(void)
if(sel == 1)
m_pCurrentControl->SelectCurrentOptionUnderCursor();
else if(sel == 0){
- m_pCurrentControl->GoNext();
+ if ( m_pCurrentControl )
+ {
+ if ( !m_pCurrentControl->GoNext() )
+ m_pCurrentControl->GoFirst();
+ }
+
m_pCurrentControl->SelectCurrentOptionUnderCursor();
}
}
diff --git a/src/core/FrontEndControls.h b/src/core/FrontEndControls.h
index 5b6f95bb..68dab90b 100644
--- a/src/core/FrontEndControls.h
+++ b/src/core/FrontEndControls.h
@@ -8,6 +8,41 @@ enum {
NUM_PAGE_WIDGETS = 10,
};
+class CTriggerCaller
+{
+ bool bHasTrigger;
+ void *pTrigger;
+ void (*pFunc)(void *);
+ int field_C;
+public:
+
+ CTriggerCaller() : bHasTrigger(false), pFunc(nil)
+ {}
+
+ void SetTrigger(void *func, void *trigger)
+ {
+ if ( !bHasTrigger )
+ {
+ pFunc = (void (*)(void *))func;
+ pTrigger = trigger;
+ bHasTrigger = true;
+ }
+ }
+
+ void CallTrigger(void)
+ {
+ if ( bHasTrigger && pFunc != nil )
+ pFunc(pTrigger);
+
+ bHasTrigger = false;
+ pFunc = nil;
+ }
+
+ bool CanCall()
+ {
+ return bHasTrigger;
+ }
+};
class CPlaceableText
{
@@ -17,7 +52,7 @@ public:
wchar *m_text;
CPlaceableText(void)
- : m_position(0.0f, 0.0f), m_color(255, 255, 255, 255) {}
+ : m_position(0.0f, 0.0f), m_color(255, 255, 255, 255), m_text(nil) {}
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; }
@@ -553,11 +588,14 @@ public:
static wchar Buf16[8];
CMenuSlider(void)
- : m_value(0), m_bDrawPercentage(false), m_bActive(false), m_style(0) {}
+ : m_value(0), m_bDrawPercentage(false), m_bActive(false), m_style(0)
+ {
+ AddTickBox(0.0f, 0.0f, 100.0f, 10.0f, 10.0f); //todo
+ }
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 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);
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index d58d0576..95d5f6e6 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -5,6 +5,7 @@
#define WITHWINDOWS
#include "common.h"
+#ifndef PS2_MENU
#include "crossplatform.h"
#include "platform.h"
#include "Frontend.h"
@@ -23,7 +24,6 @@
#include "GenericGameStorage.h"
#include "Script.h"
#include "Camera.h"
-#include "MenuScreens.h"
#include "ControllerConfig.h"
#include "Vehicle.h"
#include "MBlur.h"
@@ -36,6 +36,7 @@
#include "Stats.h"
#include "Messages.h"
#include "FileLoader.h"
+#include "frontendoption.h"
#define TIDY_UP_PBP // ProcessButtonPresses
#define MAX_VISIBLE_LIST_ROW 30
@@ -111,6 +112,10 @@ int8 CMenuManager::m_bFrontEnd_ReloadObrTxtGxt;
int32 CMenuManager::m_PrefsMusicVolume = 102;
int32 CMenuManager::m_PrefsSfxVolume = 102;
+#ifdef CUTSCENE_BORDERS_SWITCH
+bool CMenuManager::m_PrefsCutsceneBorders = true;
+#endif
+
char CMenuManager::m_PrefsSkinFile[256] = DEFAULT_SKIN_NAME;
int32 CMenuManager::m_KeyPressedCode = -1;
@@ -274,8 +279,9 @@ ScaleAndCenterX(float x)
#define ChangeScreen(screen, option, updateDelay, clearAlpha) \
do { \
m_nPrevScreen = m_nCurrScreen; \
+ int newOpt = option; \
m_nCurrScreen = screen; \
- m_nCurrOption = option; \
+ m_nCurrOption = newOpt; \
if(updateDelay) \
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); \
if(clearAlpha) \
@@ -315,7 +321,7 @@ ScaleAndCenterX(float x)
// --- Functions not in the game/inlined starts
-inline void
+void
CMenuManager::ScrollUpListByOne()
{
if (m_nSelectedListRow == m_nFirstVisibleRowOnList) {
@@ -329,7 +335,7 @@ CMenuManager::ScrollUpListByOne()
}
}
-inline void
+void
CMenuManager::ScrollDownListByOne()
{
if (m_nSelectedListRow == m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1) {
@@ -345,13 +351,13 @@ CMenuManager::ScrollDownListByOne()
}
}
-inline void
+void
CMenuManager::PageUpList(bool playSoundOnSuccess)
{
if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) {
if (m_nFirstVisibleRowOnList > 0) {
if(playSoundOnSuccess)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nFirstVisibleRowOnList = Max(0, m_nFirstVisibleRowOnList - MAX_VISIBLE_LIST_ROW);
m_nSelectedListRow = Min(m_nSelectedListRow, m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1);
@@ -363,13 +369,13 @@ CMenuManager::PageUpList(bool playSoundOnSuccess)
}
}
-inline void
+void
CMenuManager::PageDownList(bool playSoundOnSuccess)
{
if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) {
if (m_nFirstVisibleRowOnList < m_nTotalListRow - MAX_VISIBLE_LIST_ROW) {
if(playSoundOnSuccess)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nFirstVisibleRowOnList = Min(m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW, m_nTotalListRow - MAX_VISIBLE_LIST_ROW);
m_nSelectedListRow = Max(m_nSelectedListRow, m_nFirstVisibleRowOnList);
@@ -381,8 +387,8 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
}
}
-inline void
-CMenuManager::ThingsToDoBeforeLeavingPage()
+void
+CMenuManager::ThingsToDoBeforeGoingBack()
{
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
@@ -395,9 +401,6 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
#endif
} else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) {
m_nDisplayVideoMode = m_nPrefsVideoMode;
-#ifdef IMPROVED_VIDEOMODE
- m_nSelectedScreenMode = m_nPrefsWindowed;
-#endif
}
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
@@ -407,6 +410,46 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) {
m_nTotalListRow = 0;
}
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ for (int i = 0; i < numCustomFrontendOptions; i++) {
+ FrontendOption &option = customFrontendOptions[i];
+ if (option.type != FEOPTION_REDIRECT && option.type != FEOPTION_GOBACK && m_nCurrScreen == option.screen) {
+ if (option.returnPrevPageFunc)
+ option.returnPrevPageFunc();
+
+ if (m_nCurrOption == option.screenOptionOrder && option.type == FEOPTION_DYNAMIC)
+ option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
+
+ if (option.onlyApplyOnEnter)
+ option.displayedValue = *option.value;
+ }
+ }
+#endif
+}
+
+int8
+CMenuManager::GetPreviousPageOption()
+{
+#ifndef CUSTOM_FRONTEND_OPTIONS
+ return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0];
+#else
+ int8 prevPage = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0];
+
+ if (prevPage == -1) // Game also does same
+ return 0;
+
+ prevPage = prevPage == MENUPAGE_NONE ? (!m_bGameNotLoaded ? MENUPAGE_PAUSE_MENU : MENUPAGE_START_MENU) : prevPage;
+
+ for (int i = 0; i < NUM_MENUROWS; i++) {
+ if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) {
+ return i;
+ }
+ }
+
+ // Couldn't find current screen option on previous page, use default behaviour (maybe save-related screen?)
+ return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0];
+#endif
}
// ------ Functions not in the game/inlined ends
@@ -615,7 +658,7 @@ CMenuManager::DisplayHelperText()
case 0:
{
int action = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
- if (action != MENUACTION_CHANGEMENU && action != MENUACTION_REDEFCTRL && action != MENUACTION_RESTOREDEF) {
+ if (action != MENUACTION_CHANGEMENU && action != MENUACTION_KEYBOARDCTRLS && 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"));
}
@@ -913,16 +956,23 @@ CMenuManager::Draw()
CFont::SetDropShadowPosition(0);
if (!CheckHover(MENU_X(30.0f), MENU_X(30.0f) + CFont::GetStringWidth(backTx), SCREEN_SCALE_FROM_BOTTOM(125.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f))) {
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
- m_nCurrOption = m_nPrevOption = 0;
+ m_nCurrOption = m_nOptionMouseHovering = 0;
} else {
m_nHoverOption = HOVEROPTION_RANDOM_ITEM;
- m_nCurrOption = m_nPrevOption = 1;
+ m_nCurrOption = m_nOptionMouseHovering = 1;
}
return;
}
#endif
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ static int lastOption = m_nCurrOption;
+#endif
+
for (int i = 0; i < NUM_MENUROWS; ++i) {
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ bool isOptionDisabled = false;
+#endif
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') {
wchar *rightText = nil;
wchar *leftText;
@@ -1105,17 +1155,6 @@ CMenuManager::Draw()
AsciiToUnicode(_psGetVideoModeList()[m_nDisplayVideoMode], unicodeTemp);
rightText = unicodeTemp;
break;
-#ifdef IMPROVED_VIDEOMODE
- case MENUACTION_SCREENMODE:
- if (m_nSelectedScreenMode == 0)
- sprintf(asciiTemp, "FULLSCREEN");
- else
- sprintf(asciiTemp, "WINDOWED");
-
- AsciiToUnicode(asciiTemp, unicodeTemp);
- rightText = unicodeTemp;
- break;
-#endif
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex == -1)
rightText = TheText.Get("FEA_NAH");
@@ -1166,6 +1205,29 @@ CMenuManager::Draw()
case MENUACTION_MOUSESTEER:
rightText = TheText.Get(CVehicle::m_bDisableMouseSteering ? "FEM_OFF" : "FEM_ON");
break;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && i == option.screenOptionOrder) {
+ leftText = (wchar*)option.leftText;
+ if (option.type == FEOPTION_SELECT) {
+ if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
+ option.displayedValue = 0;
+
+ rightText = (wchar*)option.rightTexts[option.displayedValue];
+
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ if (option.drawFunc) {
+ rightText = option.drawFunc(&isOptionDisabled);
+ }
+ }
+ } else {
+ debug("A- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, i, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu, option.screen, option.screenOptionOrder);
+ assert(0 && "Custom frontend options is borked");
+ }
+
+ break;
+#endif
}
float nextItemY = headerHeight + nextYToUse;
@@ -1194,14 +1256,14 @@ CMenuManager::Draw()
static int oldOption = -99;
static int oldScreen = m_nCurrScreen;
- m_nPrevOption = rowToCheck;
+ m_nOptionMouseHovering = rowToCheck;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrOption = rowToCheck;
m_bShowMouse = true;
}
if (oldOption != m_nCurrOption) {
if (oldScreen == m_nCurrScreen && m_bShowMouse)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
oldOption = m_nCurrOption;
oldScreen = m_nCurrScreen;
@@ -1243,10 +1305,15 @@ CMenuManager::Draw()
if (!CFont::Details.centre)
CFont::SetRightJustifyOn();
- if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES")
- && !m_bGameNotLoaded && textLayer == 1) {
- CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255)));
- }
+ if(textLayer == 1)
+ if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES")
+ && !m_bGameNotLoaded
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ || isOptionDisabled
+#endif
+ )
+ CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255)));
+
CFont::PrintString(MENU_X_RIGHT_ALIGNED(columnWidth - textLayer), itemY, rightText);
}
if (i == m_nCurrOption && itemsAreSelectable){
@@ -1287,11 +1354,17 @@ CMenuManager::Draw()
SetHelperText(3);
}
}
-#ifdef IMPROVED_VIDEOMODE
- if (m_nSelectedScreenMode != m_nPrefsWindowed) {
- if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "SCRFOR") != 0
- && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) {
- m_nSelectedScreenMode = m_nPrefsWindowed;
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) {
+ FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
+ if (option.onlyApplyOnEnter && m_nCurrOption != i)
+ option.displayedValue = *option.value;
+
+ if (m_nCurrOption != lastOption && lastOption == i) {
+ FrontendOption &oldOption = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[lastOption].m_TargetMenu];
+ if (oldOption.type == FEOPTION_DYNAMIC)
+ oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
}
}
#endif
@@ -1339,6 +1412,10 @@ CMenuManager::Draw()
}
}
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ lastOption = m_nCurrOption;
+#endif
+
switch (m_nCurrScreen) {
case MENUPAGE_CONTROLLER_SETTINGS:
case MENUPAGE_SOUND_SETTINGS:
@@ -1700,7 +1777,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
if (!m_bKeyIsOK)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_bKeyIsOK = true;
} else {
@@ -1903,10 +1980,10 @@ CMenuManager::DrawControllerSetupScreen()
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);
+ if (m_nOptionMouseHovering != i && m_nCurrExLayer == HOVEROPTION_LIST)
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
- m_nPrevOption = i;
+ m_nOptionMouseHovering = i;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_nSelectedListRow = i;
@@ -1918,7 +1995,7 @@ CMenuManager::DrawControllerSetupScreen()
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);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN;
#ifdef FIX_BUGS
@@ -1927,7 +2004,7 @@ 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);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
}
@@ -2527,7 +2604,7 @@ CMenuManager::DrawPlayerSetupScreen()
char nameTemp[256];
for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin; m_pSelectedSkin = m_pSelectedSkin->nextSkin) {
// Drop extension
- int oldLength = strlen(m_pSelectedSkin->skinNameDisplayed);
+ int oldLength = (int)strlen(m_pSelectedSkin->skinNameDisplayed);
m_pSelectedSkin->skinNameDisplayed[oldLength - 4] = '\0';
m_pSelectedSkin->skinNameOriginal[oldLength - 4] = '\0';
@@ -2617,7 +2694,7 @@ CMenuManager::DrawPlayerSetupScreen()
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;
+ m_nOptionMouseHovering = rowIdx;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST;
}
@@ -2625,13 +2702,13 @@ CMenuManager::DrawPlayerSetupScreen()
if (rowIdx == m_nSelectedListRow) {
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
if (m_nSkinsTotal > 0) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
SaveSettings();
}
} else {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nCurrExLayer = HOVEROPTION_LIST;
m_nSelectedListRow = rowIdx;
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
@@ -2787,7 +2864,7 @@ CMenuManager::DrawPlayerSetupScreen()
&& 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);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nHoverOption = HOVEROPTION_BACK;
@@ -2798,7 +2875,7 @@ CMenuManager::DrawPlayerSetupScreen()
&& 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);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nHoverOption = HOVEROPTION_USESKIN;
@@ -2993,6 +3070,10 @@ CMenuManager::InitialiseChangedLanguageSettings()
default:
break;
}
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ CustomFrontendOptionsPopulate();
+#endif
}
}
@@ -3138,6 +3219,12 @@ CMenuManager::LoadSettings()
CFileMgr::Read(fileHandle, m_PrefsSkinFile, 256);
CFileMgr::Read(fileHandle, (char*)&m_ControlMethod, 1);
CFileMgr::Read(fileHandle, (char*)&m_PrefsLanguage, 1);
+#ifdef FREE_CAM
+ CFileMgr::Read(fileHandle, (char*)&TheCamera.bFreeCam, 1);
+#endif
+#ifdef CUTSCENE_BORDERS_SWITCH
+ CFileMgr::Read(fileHandle, (char *)&CMenuManager::m_PrefsCutsceneBorders, 1);
+#endif
}
}
@@ -3228,6 +3315,12 @@ CMenuManager::SaveSettings()
CFileMgr::Write(fileHandle, m_PrefsSkinFile, 256);
CFileMgr::Write(fileHandle, (char*)&m_ControlMethod, 1);
CFileMgr::Write(fileHandle, (char*)&m_PrefsLanguage, 1);
+#ifdef FREE_CAM
+ CFileMgr::Write(fileHandle, (char*)&TheCamera.bFreeCam, 1);
+#endif
+#ifdef CUTSCENE_BORDERS_SWITCH
+ CFileMgr::Write(fileHandle, (char *)&CMenuManager::m_PrefsCutsceneBorders, 1);
+#endif
}
CFileMgr::CloseFile(fileHandle);
@@ -3497,7 +3590,17 @@ CMenuManager::Process(void)
SaveLoadFileError_SetUpErrorScreen();
}
if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) {
+#ifdef MISSION_REPLAY
+ if (doingMissionRetry) {
+ RetryMission(2, 0);
+ m_nCurrSaveSlot = SLOT_COUNT;
+ doingMissionRetry = false;
+ }
+#endif
if (CheckSlotDataValid(m_nCurrSaveSlot)) {
+#ifdef USE_DEBUG_SCRIPT_LOADER
+ scriptToLoad = 0;
+#endif
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
@@ -3565,7 +3668,7 @@ CMenuManager::Process(void)
field_535 = true;
} else {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i);
m_bKeyIsOK = false;
@@ -3618,6 +3721,24 @@ CMenuManager::ProcessButtonPresses(void)
bool assumeIncrease = false;
#endif
+#ifdef USE_DEBUG_SCRIPT_LOADER
+ if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) {
+#ifdef RW_GL3
+ if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) {
+ scriptToLoad = 1;
+ DoSettingsBeforeStartingAGame();
+ return;
+ }
+#elif defined _WIN32
+ if (GetAsyncKeyState('R') & 0x8000) {
+ scriptToLoad = 1;
+ DoSettingsBeforeStartingAGame();
+ return;
+ }
+#endif
+ }
+#endif
+
if (!m_bShowMouse && (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY)) {
m_bShowMouse = true;
}
@@ -3674,7 +3795,7 @@ CMenuManager::ProcessButtonPresses(void)
}
if (CPad::GetPad(0)->GetTabJustDown()) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_bShowMouse = false;
switch (m_nCurrExLayer) {
case HOVEROPTION_BACK:
@@ -3710,7 +3831,7 @@ CMenuManager::ProcessButtonPresses(void)
if (!m_bPressedUpOnList) {
m_bPressedUpOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
ScrollUpListByOne();
}
} else {
@@ -3732,7 +3853,7 @@ CMenuManager::ProcessButtonPresses(void)
if (!m_bPressedDownOnList) {
m_bPressedDownOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
ScrollDownListByOne();
}
} else {
@@ -3748,7 +3869,7 @@ CMenuManager::ProcessButtonPresses(void)
m_bPressedPgUpOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
PageUpList(false);
}
}
@@ -3760,14 +3881,14 @@ CMenuManager::ProcessButtonPresses(void)
m_bPressedPgDnOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
PageDownList(false);
}
}
if (CPad::GetPad(0)->GetHome()) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) {
m_nFirstVisibleRowOnList = 0;
}
@@ -3777,7 +3898,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetEnd()) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) {
m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW;
}
@@ -3806,7 +3927,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
case HOVEROPTION_USESKIN:
if (m_nSkinsTotal > 0) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_pSelectedSkin = m_pSkinListHead.nextSkin;
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
@@ -3875,11 +3996,11 @@ CMenuManager::ProcessButtonPresses(void)
} else {
if (CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
goDown = true;
} else if (CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
goUp = true;
}
@@ -3904,13 +4025,13 @@ CMenuManager::ProcessButtonPresses(void)
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_RESUME &&
#endif
(m_nHoverOption == HOVEROPTION_RANDOM_ITEM)) {
- m_nCurrOption = m_nPrevOption;
+ m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
} else if (CPad::GetPad(0)->GetLeftMouseJustDown()) {
#ifdef TIDY_UP_PBP
if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3918,13 +4039,13 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
} else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) {
- m_nCurrOption = m_nPrevOption;
+ m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
#else
switch (m_nHoverOption) {
case HOVEROPTION_RADIO_0:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = HEAD_RADIO;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3932,7 +4053,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_1:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = DOUBLE_CLEF;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3940,7 +4061,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_2:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = JAH_RADIO;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3948,7 +4069,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_3:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = RISE_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3956,7 +4077,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_4:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = LIPS_106;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3964,7 +4085,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_5:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = GAME_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3972,7 +4093,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_6:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = MSX_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3980,7 +4101,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_7:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = FLASHBACK;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3988,7 +4109,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_8:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = CHATTERBOX;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3996,7 +4117,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_9:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = USERTRACK;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -4005,7 +4126,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
case HOVEROPTION_RANDOM_ITEM:
if (((m_nCurrOption != 0) || (m_nCurrScreen != MENUPAGE_PAUSE_MENU)) {
- m_nCurrOption = m_nPrevOption;
+ m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
break;
@@ -4126,11 +4247,11 @@ CMenuManager::ProcessButtonPresses(void)
|| CPad::GetPad(0)->GetMouseWheelUpJustDown() || CPad::GetPad(0)->GetMouseWheelDownJustDown()) {
int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
if (option == MENUACTION_BRIGHTNESS || option == MENUACTION_DRAWDIST)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
else if (option == MENUACTION_SFXVOLUME)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_AUDIO_TEST, 0);
else if (option == MENUACTION_MOUSESENS)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
#ifndef TIDY_UP_PBP
@@ -4190,14 +4311,14 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef PS2_LIKE_MENU
if (CPad::GetPad(0)->GetLeftMouseJustDown() && hoveredBottomBarOption != -1) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
bottomBarActive = false;
curBottomBarOption = hoveredBottomBarOption;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, false);
return;
} else if (bottomBarActive) {
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
bottomBarActive = false;
// If there's a menu change with fade ongoing, finish it now
@@ -4207,7 +4328,7 @@ CMenuManager::ProcessButtonPresses(void)
} else if (CPad::GetPad(0)->GetLeftJustDown() || CPad::GetPad(0)->GetAnaloguePadLeft() || CPad::GetPad(0)->GetDPadLeftJustDown()
|| CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (curBottomBarOption > 0)
curBottomBarOption--;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, true);
@@ -4215,7 +4336,7 @@ CMenuManager::ProcessButtonPresses(void)
} else if (CPad::GetPad(0)->GetRightJustDown() || CPad::GetPad(0)->GetAnaloguePadRight() || CPad::GetPad(0)->GetDPadRightJustDown()
|| CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (curBottomBarOption < bbTabCount-1)
curBottomBarOption++;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, true);
@@ -4227,6 +4348,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#endif
+ int prevOption = m_nCurrOption;
if (goDown && (m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME)) {
m_nCurrOption++;
if (m_nCurrOption == NUM_MENUROWS || (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_NOTHING)) {
@@ -4254,9 +4376,9 @@ CMenuManager::ProcessButtonPresses(void)
if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
else
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
} else
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
} else {
// This is duplicate, back button already processed below
#ifndef TIDY_UP_PBP
@@ -4272,7 +4394,7 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
} else {
if (m_nCurrScreen != MENUPAGE_NEW_GAME_RELOAD) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
}
} else if (option != MENUACTION_CHANGEMENU && option != MENUACTION_BRIGHTNESS && option != MENUACTION_DRAWDIST
@@ -4280,7 +4402,7 @@ CMenuManager::ProcessButtonPresses(void)
&& option != MENUACTION_CHECKSAVE && option != MENUACTION_UNK24
&& option != MENUACTION_MOUSESENS && option != MENUACTION_SCREENRES) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
if ((m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) || (m_nCurrScreen == MENUPAGE_SKIN_SELECT)) {
@@ -4322,10 +4444,12 @@ CMenuManager::ProcessButtonPresses(void)
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
SaveSettings();
} else {
- if (!m_bGameNotLoaded)
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
- else
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[0], aScreens[m_nCurrScreen].m_ParentEntry[0], true, true);
+#ifndef TIDY_UP_PBP
+ ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
+ GetPreviousPageOption(), true, true);
+#else
+ goBack = true;
+#endif
}
} else if (m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME) {
option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
@@ -4377,26 +4501,6 @@ CMenuManager::ProcessButtonPresses(void)
InitialiseChangedLanguageSettings();
SaveSettings();
break;
-#ifdef MORE_LANGUAGES
- case MENUACTION_LANG_PL:
- m_PrefsLanguage = LANGUAGE_POLISH;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
- case MENUACTION_LANG_RUS:
- m_PrefsLanguage = LANGUAGE_RUSSIAN;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
- case MENUACTION_LANG_JAP:
- m_PrefsLanguage = LANGUAGE_JAPANESE;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
-#endif
case MENUACTION_POPULATESLOTS_CHANGEMENU:
PcSaveHelper.PopulateSlotInfo();
@@ -4426,10 +4530,8 @@ CMenuManager::ProcessButtonPresses(void)
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) {
#ifndef TIDY_UP_PBP
ResetHelperText();
- if (!m_bGameNotLoaded)
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
- else
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[0], aScreens[m_nCurrScreen].m_ParentEntry[0], true, true);
+ ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
+ GetPreviousPageOption(), true, true);
#else
goBack = true;
break;
@@ -4499,7 +4601,7 @@ CMenuManager::ProcessButtonPresses(void)
SaveSettings();
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
break;
- case MENUACTION_REDEFCTRL:
+ case MENUACTION_KEYBOARDCTRLS:
ChangeScreen(MENUPAGE_KEYBOARD_CONTROLS, 0, true, true);
m_nSelectedListRow = 0;
m_nCurrExLayer = HOVEROPTION_LIST;
@@ -4526,7 +4628,8 @@ CMenuManager::ProcessButtonPresses(void)
#endif
break;
case MENUACTION_DONTCANCEL:
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
+ ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
+ GetPreviousPageOption(), true, true);
break;
case MENUACTION_SCREENRES:
if (m_nDisplayVideoMode != m_nPrefsVideoMode) {
@@ -4536,23 +4639,13 @@ CMenuManager::ProcessButtonPresses(void)
SaveSettings();
}
break;
-#ifdef IMPROVED_VIDEOMODE
- case MENUACTION_SCREENMODE:
- if (m_nSelectedScreenMode != m_nPrefsWindowed) {
- m_nPrefsWindowed = m_nSelectedScreenMode;
- _psSelectScreenVM(m_nPrefsVideoMode); // apply same resolution
- SetHelperText(0);
- SaveSettings();
- }
- break;
-#endif
case MENUACTION_AUDIOHW:
{
int selectedProvider = m_nPrefsAudio3DProviderIndex;
if (selectedProvider != -1) {
m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex);
if (selectedProvider == m_nPrefsAudio3DProviderIndex) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SetHelperText(0);
} else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
@@ -4661,6 +4754,45 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK");
break;
+#ifdef MISSION_REPLAY
+ case MENUACTION_REJECT_RETRY:
+ doingMissionRetry = false;
+ AllowMissionReplay = 0;
+ RequestFrontEndShutDown();
+ break;
+ case MENUACTION_UNK114:
+ doingMissionRetry = false;
+ RequestFrontEndShutDown();
+ RetryMission(2, 0);
+ return;
+#endif
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
+ if (option.type == FEOPTION_SELECT) {
+ if (!option.onlyApplyOnEnter) {
+ option.displayedValue++;
+ if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
+ option.displayedValue = 0;
+ }
+ option.changeFunc(option.displayedValue);
+ *option.value = option.displayedValue;
+
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ option.buttonPressFunc(FEOPTION_ACTION_SELECT);
+ } else if (option.type == FEOPTION_REDIRECT) {
+ ChangeScreen(option.to, option.option, true, option.fadeIn);
+ } else if (option.type == FEOPTION_GOBACK) {
+ goBack = true;
+ }
+ } else {
+ debug("B- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder);
+ assert(0 && "Custom frontend options are borked");
+ }
+
+ break;
+#endif
}
}
ProcessOnOffMenuOptions();
@@ -4668,7 +4800,7 @@ CMenuManager::ProcessButtonPresses(void)
if (goBack) {
ResetHelperText();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0);
#ifdef PS2_LIKE_MENU
if (m_nCurrScreen == MENUPAGE_PAUSE_MENU || bottomBarActive) {
#else
@@ -4693,7 +4825,7 @@ CMenuManager::ProcessButtonPresses(void)
#endif
RequestFrontEndShutDown();
}
- // It's now in ThingsToDoBeforeLeavingPage()
+ // It's now in ThingsToDoBeforeGoingBack()
#ifndef TIDY_UP_PBP
else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
DMAudio.StopFrontEndTrack();
@@ -4702,10 +4834,10 @@ CMenuManager::ProcessButtonPresses(void)
#endif
int oldScreen = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0];
- int oldOption = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0];
+ int oldOption = GetPreviousPageOption();
if (oldScreen != -1) {
- ThingsToDoBeforeLeavingPage();
+ ThingsToDoBeforeGoingBack();
#ifdef PS2_LIKE_MENU
if (!bottomBarActive &&
@@ -4781,7 +4913,7 @@ CMenuManager::ProcessButtonPresses(void)
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_RADIO:
m_PrefsRadioStation += changeValueBy;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
if (DMAudio.IsMP3RadioChannelAvailable()) {
if (m_PrefsRadioStation < HEAD_RADIO)
m_PrefsRadioStation = USERTRACK;
@@ -4803,20 +4935,20 @@ CMenuManager::ProcessButtonPresses(void)
if (changeValueBy > 0) {
m_PrefsUseWideScreen++;
if (m_PrefsUseWideScreen > 2)
- m_PrefsUseWideScreen = 2;
+ m_PrefsUseWideScreen = 0;
} else {
m_PrefsUseWideScreen--;
if (m_PrefsUseWideScreen < 0)
- m_PrefsUseWideScreen = 0;
+ m_PrefsUseWideScreen = 2;
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#endif
case MENUACTION_SCREENRES:
if (m_bGameNotLoaded) {
RwChar** videoMods = _psGetVideoModeList();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (changeValueBy > 0) {
do {
++m_nDisplayVideoMode;
@@ -4834,18 +4966,12 @@ CMenuManager::ProcessButtonPresses(void)
}
}
break;
-#ifdef IMPROVED_VIDEOMODE
- case MENUACTION_SCREENMODE:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
- m_nSelectedScreenMode = !m_nSelectedScreenMode;
- break;
-#endif
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex != -1) {
m_nPrefsAudio3DProviderIndex += changeValueBy;
m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1);
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
break;
case MENUACTION_SPEAKERCONF:
if (m_nPrefsAudio3DProviderIndex != -1) {
@@ -4853,15 +4979,45 @@ CMenuManager::ProcessButtonPresses(void)
m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2);
DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
SaveSettings();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
break;
case MENUACTION_CTRLMETHOD:
m_ControlMethod = !m_ControlMethod;
CCamera::m_bUseMouse3rdPerson = !m_ControlMethod;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
+ if (option.type == FEOPTION_SELECT) {
+ if (changeValueBy > 0) {
+ option.displayedValue++;
+ if (option.displayedValue >= option.numRightTexts)
+ option.displayedValue = 0;
+ } else {
+ option.displayedValue--;
+ if (option.displayedValue < 0)
+ option.displayedValue = option.numRightTexts - 1;
+ }
+ if (!option.onlyApplyOnEnter) {
+ option.changeFunc(option.displayedValue);
+ *option.value = option.displayedValue;
+ }
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT);
+ }
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
+ }
+ else {
+ debug("C- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder);
+ assert(0 && "Custom frontend options are borked");
+ }
+
+ break;
+#endif
}
ProcessOnOffMenuOptions();
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
@@ -4870,7 +5026,7 @@ CMenuManager::ProcessButtonPresses(void)
} else {
m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
}
}
}
@@ -4886,31 +5042,31 @@ CMenuManager::ProcessOnOffMenuOptions()
CPad::GetPad(0)->StartShake(350, 150);
TimeToStopPadShaking = CTimer::GetTimeInMillisecondsPauseMode() + 500;
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_CTRLCONFIG:
CPad::GetPad(0)->Mode++;
if (CPad::GetPad(0)->Mode > 3)
CPad::GetPad(0)->Mode = 0;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_CTRLDISPLAY:
m_DisplayControllerOnFoot = !m_DisplayControllerOnFoot;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_FRAMESYNC:
m_PrefsVsyncDisp = !m_PrefsVsyncDisp;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_FRAMELIMIT:
m_PrefsFrameLimiter = !m_PrefsFrameLimiter;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_TRAILS:
CMBlur::BlurOn = !CMBlur::BlurOn;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
if (CMBlur::BlurOn)
CMBlur::MotionBlurOpen(Scene.camera);
@@ -4919,60 +5075,60 @@ CMenuManager::ProcessOnOffMenuOptions()
break;
case MENUACTION_SUBTITLES:
m_PrefsShowSubtitles = !m_PrefsShowSubtitles;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#ifndef ASPECT_RATIO_SCALE
case MENUACTION_WIDESCREEN:
m_PrefsUseWideScreen = !m_PrefsUseWideScreen;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#endif
case MENUACTION_SETDBGFLAG:
CTheScripts::InvertDebugFlag();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_SWITCHBIGWHITEDEBUGLIGHT:
gbBigWhiteDebugLightSwitchedOn = !gbBigWhiteDebugLightSwitchedOn;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_PEDROADGROUPS:
gbShowPedRoadGroups = !gbShowPedRoadGroups;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_CARROADGROUPS:
gbShowCarRoadGroups = !gbShowCarRoadGroups;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_COLLISIONPOLYS:
gbShowCollisionPolys = !gbShowCollisionPolys;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_MP_PLAYERCOLOR:
PickNewPlayerColour();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_SHOWHEADBOB:
TheCamera.m_bHeadBob = !TheCamera.m_bHeadBob;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_INVVERT:
MousePointerStateHelper.bInvertVertically = !MousePointerStateHelper.bInvertVertically;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_DYNAMICACOUSTIC:
m_PrefsDMA = !m_PrefsDMA;
DMAudio.SetDynamicAcousticModelingStatus(m_PrefsDMA);
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_MOUSESTEER:
CVehicle::m_bDisableMouseSteering = !CVehicle::m_bDisableMouseSteering;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
}
@@ -5083,7 +5239,7 @@ CMenuManager::SwitchMenuOnAndOff()
bottomBarActive = false;
#endif
#ifdef FIX_BUGS
- ThingsToDoBeforeLeavingPage();
+ ThingsToDoBeforeGoingBack();
#endif
ShutdownJustMenu();
SaveSettings();
@@ -5540,7 +5696,7 @@ CMenuManager::PrintMap(void)
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);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
}
@@ -5830,3 +5986,6 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
#undef GetBackJustUp
#undef GetBackJustDown
+#undef ChangeScreen
+
+#endif \ No newline at end of file
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 89517528..7b0e2f4b 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -1,4 +1,7 @@
#pragma once
+#ifdef PS2_MENU
+#include "Frontend_PS2.h"
+#else
#include "Sprite2d.h"
@@ -81,20 +84,6 @@
#define CONTSETUP_BACK_BOTTOM 122.0f
#define CONTSETUP_BACK_HEIGHT 25.0f
-enum eLanguages
-{
- LANGUAGE_AMERICAN,
- LANGUAGE_FRENCH,
- LANGUAGE_GERMAN,
- LANGUAGE_ITALIAN,
- LANGUAGE_SPANISH,
-#ifdef MORE_LANGUAGES
- LANGUAGE_POLISH,
- LANGUAGE_RUSSIAN,
- LANGUAGE_JAPANESE,
-#endif
-};
-
enum eFrontendSprites
{
FE2_MAINPANEL_UL,
@@ -245,7 +234,7 @@ enum eMenuScreen
MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
- MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile
+ MENUPAGE_MISSION_RETRY = 57,
MENUPAGE_58 = 58,
#ifdef MENU_MAP
MENUPAGE_MAP = 59,
@@ -327,7 +316,7 @@ enum eMenuAction
MENUACTION_UNK69,
MENUACTION_UNK70,
MENUACTION_FINDMP,
- MENUACTION_REDEFCTRL,
+ MENUACTION_KEYBOARDCTRLS,
MENUACTION_UNK73,
MENUACTION_INITMP,
MENUACTION_MP_PLAYERCOLOR,
@@ -366,13 +355,12 @@ enum eMenuAction
MENUACTION_UNK108,
MENUACTION_UNK109,
MENUACTION_UNK110,
-#ifdef MORE_LANGUAGES
- MENUACTION_LANG_PL,
- MENUACTION_LANG_RUS,
- MENUACTION_LANG_JAP,
-#endif
-#ifdef IMPROVED_VIDEOMODE
- MENUACTION_SCREENMODE
+ MENUACTION_UNK111,
+ MENUACTION_UNK112,
+ MENUACTION_REJECT_RETRY,
+ MENUACTION_UNK114,
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ MENUACTION_TRIGGERFUNC
#endif
};
@@ -468,7 +456,7 @@ struct CMenuScreen
int32 m_Action; // eMenuAction
char m_EntryName[8];
int32 m_SaveSlot; // eSaveSlot
- int32 m_TargetMenu; // eMenuScreen
+ int32 m_TargetMenu; // eMenuScreen // FrontendOption ID if it's a custom option
} m_aEntries[NUM_MENUROWS];
};
@@ -530,7 +518,7 @@ public:
int32 m_nHoverOption;
int32 m_nCurrScreen;
int32 m_nCurrOption;
- int32 m_nPrevOption;
+ int32 m_nOptionMouseHovering;
int32 m_nPrevScreen;
uint32 field_558;
int32 m_nCurrSaveSlot;
@@ -545,6 +533,19 @@ public:
int32 m_nSelectedScreenMode;
#endif
+ enum LANGUAGE
+ {
+ LANGUAGE_AMERICAN,
+ LANGUAGE_FRENCH,
+ LANGUAGE_GERMAN,
+ LANGUAGE_ITALIAN,
+ LANGUAGE_SPANISH,
+#ifdef MORE_LANGUAGES
+ LANGUAGE_POLISH,
+ LANGUAGE_RUSSIAN,
+ LANGUAGE_JAPANESE,
+#endif
+ };
public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
@@ -581,6 +582,10 @@ public:
static uint8 m_PrefsPlayerGreen;
static uint8 m_PrefsPlayerBlue;
+#ifdef CUTSCENE_BORDERS_SWITCH
+ static bool m_PrefsCutsceneBorders;
+#endif
+
#ifndef MASTER
static bool m_PrefsMarketing;
static bool m_PrefsDisableTutorials;
@@ -647,12 +652,14 @@ public:
int GetNumOptionsCntrlConfigScreens();
int ConstructStatLine(int);
- // New (not in function or inlined in the game)
- void ThingsToDoBeforeLeavingPage();
+ // Those are either inlined in game, not in function yet, or I can't believe that they're not inlined.
+ // Names were made up by me.
+ void ThingsToDoBeforeGoingBack();
void ScrollUpListByOne();
void ScrollDownListByOne();
void PageUpList(bool);
void PageDownList(bool);
+ int8 GetPreviousPageOption();
// uint8 GetNumberOfMenuOptions();
};
@@ -662,3 +669,6 @@ VALIDATE_SIZE(CMenuManager, 0x564);
#endif
extern CMenuManager FrontEndMenuManager;
+extern CMenuScreen aScreens[];
+
+#endif \ No newline at end of file
diff --git a/src/core/FrontendTriggers.h b/src/core/FrontendTriggers.h
new file mode 100644
index 00000000..b2bde09c
--- /dev/null
+++ b/src/core/FrontendTriggers.h
@@ -0,0 +1,1393 @@
+CTriggerCaller MemCardAccessTriggerCaller;
+
+void InitialiseTextsInMenuControllerInCar(CMenuPictureAndText *widget, CMenuManager::CONTRCONFIG cont);
+void InitialiseTextsInMenuControllerOnFoot(CMenuPictureAndText *widget, CMenuManager::CONTRCONFIG cont);
+void TriggerSave_BackToMainMenu(CMenuMultiChoiceTriggered *widget);
+void TriggerSave_BackToMainMenuTwoLines(CMenuMultiChoiceTwoLinesTriggered *widget);
+void TriggerSave_LoadGameLoadGameSelect(CMenuMultiChoiceTwoLinesTriggered *widget);
+void TriggerSave_DeleteGameDeleteGameSelect(CMenuMultiChoiceTwoLinesTriggered *widget);
+void TriggerSaveZone_BackToMainMenuTwoLines(CMenuMultiChoiceTwoLinesTriggered *widget);
+void TriggerSaveZone_BackToMainMenuTwoLines(CMenuMultiChoiceTwoLinesTriggered *widget);
+void TriggerSaveZone_SaveSlots(CMenuMultiChoiceTwoLinesTriggered *widget);
+
+void
+DisplayWarningControllerMsg()
+{
+ if ( CPad::bDisplayNoControllerMessage )
+ {
+ CSprite2d::DrawRect(CRect(X(20.0f), Y(140.0f), X(620.0f), Y(328.0)), CRGBA(64, 16, 16, 224)); // CRect(20.0f, 160.0f, 620.0f, 374.857117f)
+
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(0.84f), Y(1.26f)); // 1.440000
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(40.0f)); // 600.0f
+
+ CPlaceableShText text;
+ text.SetPosition(X(60.0f), Y(180.0f), false); // 205.714294
+ text.SetColor(CRGBA(152, 152, 152, 255));
+ text.m_text = TheText.Get("NOCONTE"); // Please re-insert the analog controller (DUALSHOCK@) or analog controller (DUALSHOCK@2) in controller port 1 to continue
+ text.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR*2.0f);
+ text.SetAlpha(255);
+ text.DrawShWrap(0.0f, 0.0f, X(600.0f+SHADOW_VECTOR.x), YF(600.0f)); //TODO check
+
+ CFont::DrawFonts();
+ }
+ else if ( CPad::bObsoleteControllerMessage )
+ {
+ CSprite2d::DrawRect(CRect(X(20.0f), Y(140.0f), X(620.0f), Y(328.0)), CRGBA(64, 16, 16, 224)); // CRect(20.0f, 160.0f, 620.0f, 374.857117f)
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(0.84f), Y(1.26f)); // 1.440000
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(40.0f)); // 600.0f
+
+ CPlaceableShText text;
+ text.SetPosition(X(60.0f), Y(180.0f), false); // 205.714294
+ text.SetColor(CRGBA(152, 152, 152, 255));
+ text.m_text = TheText.Get("WRCONTE"); // Please re-insert the analog controller (DUALSHOCK@) or analog controller (DUALSHOCK@2) in controller port 1 to continue
+ text.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR*2.0f);
+ text.SetAlpha(255);
+ text.DrawShWrap(0.0f, 0.0f, X(600.0f+SHADOW_VECTOR.x), YF(600.0f)); //TODO check
+
+ CFont::DrawFonts();
+ }
+
+}
+
+void
+TriggerMCSUM_Yes(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ bMemoryCardStartUpMenus_ExitNow = true;
+}
+
+int32 nStatLinesIndex;
+wchar aStatLines[50+1][50];
+wchar *PrintStatLine(char const *text, void *stat, unsigned char itsFloat, void *stat2)
+{
+ if (text && stat && nStatLinesIndex < 50)
+ {
+ char line [64];
+ wchar uline[64];
+
+ memset(line, 0, sizeof(line));
+ memset(uline, 0, sizeof(uline));
+
+ if (stat2)
+ {
+ if ( itsFloat )
+ sprintf(line, " %.2f %s %.2f", *(float*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(float*)stat2);
+ else
+ sprintf(line, " %d %s %d", *(int32*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(int32*)stat2);
+ }
+ else
+ {
+ if (itsFloat)
+ sprintf(line, " %.2f", *(float*)stat);
+ else
+ sprintf(line, " %d", *(int32*)stat);
+ }
+
+ wchar *pStatLine = aStatLines[nStatLinesIndex++];
+
+ AsciiToUnicode(line, uline);
+ UnicodeStrcpy(pStatLine, uline);
+
+ return pStatLine;
+ }
+
+ return nil;
+}
+
+void
+DisplayMemoryCardAccessMsg(wchar *msg, CRGBA const &color)
+{
+ CSprite2d::DrawRect(CRect(X(70.0f), Y(100.0f), X(570.0f), Y(270.0f)), color);
+
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(MEMCARD_ACCESS_MSG_SIZE_X), Y(MEMCARD_ACCESS_MSG_SIZE_Y));
+ CFont::SetPropOn();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(90.0f)); // 550.0f
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(SCRW-X(180.0f)); // 460.0f
+
+ CPlaceableShText text;
+
+ text.SetPosition(X(320.0f), Y(120.0f), false); // 137.142868
+ text.SetColor(CRGBA(200, 200, 200, 255));
+ text.m_text = msg;
+
+ text.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ text.SetAlpha(255);
+ text.Draw(0.0f, 0.0f);
+
+ CFont::DrawFonts();
+ DoRWStuffEndOfFrame();
+}
+
+void
+FillMenuWithMemCardFileListing(CMenuMultiChoiceTwoLinesTriggered *widget, void (*cancelTrigger)(CMenuMultiChoiceTwoLinesTriggered *), void (*selectTrigger)(CMenuMultiChoiceTwoLinesTriggered *), wchar *text, int32 y, int32 height, int32 offset)
+{
+ if ( widget )
+ {
+ int32 selected = 0;
+ if ( bMemoryCardSpecialZone )
+ selected = widget->m_cursor != -1 ? widget->m_cursor : 0;
+
+ widget->DeactivateMenu(); // TODO check
+ widget->m_numOptions = 0;
+ widget->AddTitle(nil, 0.0f, 0.0f, 0);
+
+ TheMemoryCard.PopulateSlotInfo(CARD_ONE);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::NO_ERR_SUCCESS)
+ {
+ widget->AddOption(TheText.Get("FES_CAN"), 0.0f, YF(y), cancelTrigger, 0, 0);
+
+ FrontEndMenuManager.field_3C = 0;
+
+ y += offset;
+
+ char buff[100];
+
+ for ( int32 i = 0; i < CMemoryCard::MAX_SLOTS; i++ )
+ {
+ // SAVE FILE
+ sprintf(buff, "%s %d ", UnicodeToAscii(TheText.Get("FES_SLO")), i+1);
+ AsciiToUnicode(buff, MemoryCard_FileNames[i]);
+
+ wchar *datetime = nil;
+
+ switch ( TheMemoryCard.GetInfoOnSpecificSlot(i) )
+ {
+ case CMemoryCard::SLOT_CORRUPTED:
+ {
+ UnicodeStrcat(MemoryCard_FileNames[i], TheText.Get("FES_ISC")); // IS CORRUPTED
+ datetime = TheMemoryCard.GetDateAndTimeOfSavedGame(i);
+ break;
+ }
+ case CMemoryCard::SLOT_PRESENT:
+ {
+ if ( TheMemoryCard.GetNameOfSavedGame(i) != nil )
+ {
+ UnicodeStrcpy(MemoryCard_FileNames[i], TheMemoryCard.GetNameOfSavedGame(i));
+ datetime = TheMemoryCard.GetDateAndTimeOfSavedGame(i);
+ }
+ else
+ {
+ UnicodeStrcpy(MemoryCard_FileNames[i], TheText.Get("FES_SAG")); // PRESENT
+ datetime = TheMemoryCard.GetDateAndTimeOfSavedGame(i);
+ }
+ break;
+ }
+ case CMemoryCard::SLOT_NOTPRESENT:
+ {
+ UnicodeStrcat(MemoryCard_FileNames[i], TheText.Get("FES_ISF"));
+ datetime = TheMemoryCard.GetDateAndTimeOfSavedGame(i);
+ break;
+ }
+ }
+
+ widget->AddOption(MemoryCard_FileNames[i], 0.0f, YF(y), datetime, 0.0f, YF(float(y)+(0.44f*height)), selectTrigger, 0, 0);
+ y += height;
+ }
+ }
+ else
+ {
+ if ( !gErrorSampleTriggered )
+ {
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
+ gErrorSampleTriggered = true;
+ }
+
+ // Cancel
+ widget->AddOption(TheText.Get("FES_CAN"), 0.0f, YF(y+(height*2)), cancelTrigger, 0, 0);
+
+ FrontEndMenuManager.field_3C = 1;
+
+ y += height;
+
+ TheMemoryCard.PopulateErrorMessage();
+
+ // Error Reading Memory Card (PS2) in MEMORY CARD slot 1 please check and try again.
+ if ( TheMemoryCard.GetErrorMessage())
+ widget->AddTitle(TheMemoryCard.GetErrorMessage(), 0.0f, YF(y), 0);
+ else
+ widget->AddTitle(TheText.Get("FES_GME"), 0.0f, YF(y), 0);
+ }
+
+ widget->SetMenuSelection(0);
+ widget->ActivateMenu(1);
+
+ if ( bMemoryCardSpecialZone )
+ {
+ widget->GoFirst();
+
+ for ( int32 i = 0; i < selected; i++ )
+ widget->GoNext();
+ }
+ }
+}
+
+void
+TriggerSaveZone_FormatFailedOK(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ pActiveMenuPage = &MenuPageSaveZone_SaveGame;
+}
+
+void
+TriggerSaveZone_BackToMainMenu(CMenuMultiChoiceTriggered *widget)
+{
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+ pActiveMenuPage = &MenuPageSaveZone_SaveGame;
+}
+
+void
+TriggerSaveZone_QuitMenu(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ FrontEndMenuManager.m_bMenuActive = false;
+ FrontEndMenuManager.m_bInSaveZone = false;
+ CTimer::EndUserPause();
+ }
+}
+
+void
+TriggerSaveZone_FormatCard(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ FillMenuWithMemCardFileListing(&MenuSaveZoneSSL_1, TriggerSaveZone_BackToMainMenuTwoLines, TriggerSaveZone_SaveSlots, nil, 0, 34, 22);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::NO_ERR_SUCCESS)
+ {
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheText.Get("FES_AFO"), X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(5.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ else if ( TheMemoryCard.GetError() != CMemoryCard::ERR_NOFORMAT)
+ {
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheMemoryCard.GetErrorMessage(), X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(15.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ else
+ {
+ if ( !MemCardAccessTriggerCaller.CanCall() )
+ MemCardAccessTriggerCaller.SetTrigger(TriggerSaveZone_FormatCard, widget);
+ else
+ {
+ // Formatting Memory Card (PS2) in MEMORY CARD slot 1. Please do not remove the Memory Card (PS2), reset or switch off the console.
+ DisplayMemoryCardAccessMsg(TheText.Get("FEFD_WR"), CRGBA(200, 50, 50, 192));
+ TheMemoryCard.FormatCard(CARD_ONE);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::NO_ERR_SUCCESS )
+ pActiveMenuPage = &MenuPageSaveZone_SaveGame;
+ else
+ {
+ TheMemoryCard.PopulateErrorMessage();
+
+ wchar *error = TheText.Get("FESZ_FF"); // Format Failed! Check Memory Card (PS2) in MEMORY CARD slot 1 and please try again.
+
+ // missing switch
+
+ if ( !error ) error = TheText.Get("FES_GME"); // Error Reading Memory Card (PS2) in MEMORY CARD slot 1 please check and try again.
+
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(error, X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(20.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::NO_ERR_SUCCESS )
+ {
+ FillMenuWithMemCardFileListing(&MenuSaveZoneSSL_1, TriggerSaveZone_BackToMainMenuTwoLines, TriggerSaveZone_SaveSlots, nil, 0, 34, 22);
+ pActiveMenuPage = &MenuPageSaveZone_SaveSlots;
+ bMemoryCardSpecialZone = true;
+ bIgnoreTriangleButton = true;
+ pActiveMenuPage->ActivatePage();
+ }
+ else
+ {
+ TheMemoryCard.PopulateErrorMessage();
+
+ // Format Failed! Check Memory Card (PS2) in MEMORY CARD slot 1 and please try again.
+ wchar *error = TheText.Get("FESZ_FF");
+
+ switch ( TheMemoryCard.GetError() )
+ {
+ case CMemoryCard::ERR_WRITEFULLDEVICE:
+ case CMemoryCard::ERR_DIRFULLDEVICE:
+ case CMemoryCard::ERR_SAVEFAILED:
+ {
+ error = TheMemoryCard.GetErrorMessage();
+ break;
+ }
+ }
+
+ // Error Reading Memory Card (PS2) in MEMORY CARD slot 1 please check and try again.
+ if ( !error ) error = TheText.Get("FES_GME");
+
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(error, X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(20.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ }
+ }
+ }
+}
+
+void
+TriggerSaveZone_FormatCardSelect(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ FillMenuWithMemCardFileListing(&MenuSaveZoneSSL_1, TriggerSaveZone_BackToMainMenuTwoLines, TriggerSaveZone_SaveSlots, nil, 0, 34, 22);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::NO_ERR_SUCCESS )
+ {
+ // This Memory Card (PS2) is already formatted.
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheText.Get("FES_AFO"), X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(5.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ else if ( TheMemoryCard.GetError() != CMemoryCard::ERR_NOFORMAT )
+ {
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheMemoryCard.GetErrorMessage(), X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(15.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ else
+ {
+ // Are you sure you wish to format the Memory Card (PS2) in MEMORY CARD slot 1?
+ MenuSaveZoneQYN_1.m_numTexts = 0;
+ MenuSaveZoneQYN_1.AddText(TheText.Get("FESZ_QF"), X(-40.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneQYN_2.m_numOptions = 0;
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_NO"), X(80.0f), YF(20.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_YES"), X(80.0f), 0.0f, TriggerSaveZone_FormatCard, 0, 0);
+
+ MenuPageSaveZone_QuestionYesNo.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_QuestionYesNo;
+ }
+ }
+}
+
+void
+TriggerSaveZone_DeleteSaveGame(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+
+ if ( !MemCardAccessTriggerCaller.CanCall() )
+ MemCardAccessTriggerCaller.SetTrigger(TriggerSaveZone_DeleteSaveGame, widget);
+ else
+ {
+ // Overwriting data. Please do not remove the Memory Card (PS2) in MEMORY CARD slot 1, reset or switch off the console.
+ DisplayMemoryCardAccessMsg(TheText.Get("FESZ_OW"), CRGBA(200, 50, 50, 192));
+
+ TheMemoryCard.DeleteSlot(MemoryCardSlotSelected);
+
+ if ( TheMemoryCard.GetError() != CMemoryCard::NO_ERR_SUCCESS )
+ {
+ TheMemoryCard.PopulateErrorMessage();
+
+ wchar *error = TheText.Get("FES_DEE"); // Deleting Failed! Check Memory Card (PS2) in MEMORY CARD slot 1 and please try again.
+
+ // switch missing
+
+ if ( !error ) error = TheText.Get("FES_GME"); // Error Reading Memory Card (PS2) in MEMORY CARD slot 1 please check and try again.
+
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(error, X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(20.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ else
+ {
+ TheMemoryCard.SaveSlot(MemoryCardSlotSelected);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::NO_ERR_SUCCESS )
+ {
+ // Game saved successfully!
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheText.Get("FESZ_L1"), X(-20.0f), YF(10.0f), TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(110.0f), 0.0f, TriggerSaveZone_QuitMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ else
+ {
+ TheMemoryCard.PopulateErrorMessage();
+
+ wchar *error = TheText.Get("FESZ_SR"); // Save Failed! Check Memory Card (PS2) in MEMORY CARD slot 1 and please try again.
+
+ switch ( TheMemoryCard.GetError() )
+ {
+ case CMemoryCard::ERR_WRITEFULLDEVICE:
+ case CMemoryCard::ERR_DIRFULLDEVICE:
+ case CMemoryCard::ERR_SAVEFAILED:
+ {
+ error = TheMemoryCard.GetErrorMessage();
+ break;
+ }
+ }
+
+ if ( !error ) error = TheText.Get("FES_GME"); // Error Reading Memory Card (PS2) in MEMORY CARD slot 1 please check and try again.
+
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(error, X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(120.0f), YF(30.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ }
+ }
+ }
+}
+
+void
+TriggerSaveZone_SaveGame(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+ if ( !MemCardAccessTriggerCaller.CanCall() )
+ MemCardAccessTriggerCaller.SetTrigger(TriggerSaveZone_SaveGame, widget);
+ else
+ {
+ DisplayMemoryCardAccessMsg(TheText.Get("FESZ_WR"), CRGBA(200, 50, 50, 192));
+
+ TheMemoryCard.SaveSlot(MemoryCardSlotSelected);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::NO_ERR_SUCCESS )
+ {
+ // Game saved successfully!
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheText.Get("FESZ_L1"), X(-20.0f), YF(10.0f), TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(110.0f), 0.0f, TriggerSaveZone_QuitMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ else
+ {
+ TheMemoryCard.PopulateErrorMessage();
+
+ wchar *error = TheText.Get("FESZ_SR"); // Save Failed! Check Memory Card (PS2) in MEMORY CARD slot 1 and please try again.
+
+ switch ( TheMemoryCard.GetError() )
+ {
+ case CMemoryCard::ERR_WRITEFULLDEVICE:
+ case CMemoryCard::ERR_DIRFULLDEVICE:
+ case CMemoryCard::ERR_SAVEFAILED:
+ {
+ error = TheMemoryCard.GetErrorMessage();
+ break;
+ }
+ }
+
+ if ( !error ) error = TheText.Get("FES_GME"); // Error Reading Memory Card (PS2) in MEMORY CARD slot 1 please check and try again.
+
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(error, X(-80.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(120.0f), YF(30.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pActiveMenuPage = &MenuPageSaveZone_Message;
+ }
+ }
+ }
+}
+
+void
+TriggerSaveZone_SaveSlots(CMenuMultiChoiceTwoLinesTriggered *widget)
+{
+ if ( widget )
+ {
+ if ( widget->GetMenuSelection() > 0 )
+ {
+ MemoryCardSlotSelected = widget->GetMenuSelection() - 1;
+
+ switch ( TheMemoryCard.GetInfoOnSpecificSlot(MemoryCardSlotSelected) )
+ {
+ case CMemoryCard::SLOT_PRESENT:
+ case CMemoryCard::SLOT_CORRUPTED:
+ {
+ // Proceed with overwriting this saved game?
+ MenuSaveZoneQYN_1.m_numTexts = 0;
+ MenuSaveZoneQYN_1.AddText(TheText.Get("FESZ_QO"), X(-40.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneQYN_2.m_numOptions = 0;
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_NO"), X(80.0f), YF(20.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_YES"), X(80.0f), 0.0f, TriggerSaveZone_DeleteSaveGame, 0, 0);
+
+ MenuPageSaveZone_QuestionYesNo.ActivatePage();
+ bMemoryCardSpecialZone = false;
+ pActiveMenuPage = &MenuPageSaveZone_QuestionYesNo;
+ break;
+ }
+
+ case CMemoryCard::SLOT_NOTPRESENT:
+ {
+ // PROCEED WITH SAVE ?
+ MenuSaveZoneQYN_1.m_numTexts = 0;
+ MenuSaveZoneQYN_1.AddText(TheText.Get("FESZ_QS"), X(-40.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneQYN_2.m_numOptions = 0;
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_NO"), X(80.0f), YF(20.0f), TriggerSaveZone_BackToMainMenu, 0, 0);
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_YES"), X(80.0f), 0.0f, TriggerSaveZone_SaveGame, 0, 0);
+
+ MenuPageSaveZone_QuestionYesNo.ActivatePage();
+ bMemoryCardSpecialZone = false;
+ pActiveMenuPage = &MenuPageSaveZone_QuestionYesNo;
+ break;
+ }
+ }
+ }
+ }
+}
+
+void
+TriggerSaveZone_SaveGameSelect(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ FillMenuWithMemCardFileListing(&MenuSaveZoneSSL_1, TriggerSaveZone_BackToMainMenuTwoLines, TriggerSaveZone_SaveSlots, nil, 0, 34, 22);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::ERR_NOFORMAT)
+ {
+ gErrorSampleTriggered = false;
+ pActiveMenuPage = &MenuPageSaveZone_FormatCard;
+ }
+ else
+ {
+ bMemoryCardSpecialZone = true;
+ bIgnoreTriangleButton = true;
+ pActiveMenuPage = &MenuPageSaveZone_SaveSlots;
+ }
+
+ pActiveMenuPage->ActivatePage();
+ }
+}
+
+void
+TriggerControls_Vibrations(CMenuOnOffTriggered *widget)
+{
+ if ( widget )
+ {
+ CMenuManager::m_PrefsUseVibration = widget->GetMenuSelection();
+ if ( CMenuManager::m_PrefsUseVibration )
+ {
+ CPad::GetPad(0)->StartShake(300, 150);
+ TimeToStopPadShaking = CTimer::GetTimeInMillisecondsPauseMode() + 500;
+ }
+ }
+}
+
+void
+TriggerControls_ContrDisplay(CMenuMultiChoiceTriggeredAlways *widget)
+{
+ if ( widget )
+ {
+ int32 conf = MenuControls_1.GetMenuSelection();
+ int32 i = MenuControls_2.GetMenuSelection();
+ if ( i == 1 )
+ {
+ if ( conf == CMenuManager::CONFIG_2 )
+ MenuPage_Controls.m_controls[0] = &MenuControls_7;
+ else
+ MenuPage_Controls.m_controls[0] = &MenuControls_4;
+ }
+ else if ( i == 0 )
+ {
+ if ( conf == CMenuManager::CONFIG_2 )
+ MenuPage_Controls.m_controls[0] = &MenuControls_6;
+ else
+ MenuPage_Controls.m_controls[0] = &MenuControls_3;
+ }
+ }
+}
+
+void
+TriggerControls_DrawHNContrConfig(CMenuMultiChoiceTriggeredAlways *widget)
+{
+ if ( widget )
+ {
+ int32 conf = widget->GetMenuSelection();
+
+ InitialiseTextsInMenuControllerOnFoot(&MenuControls_3, (CMenuManager::CONTRCONFIG)conf);
+ InitialiseTextsInMenuControllerInCar (&MenuControls_4, (CMenuManager::CONTRCONFIG)conf);
+
+ int32 i = MenuControls_2.GetMenuSelection();
+ if ( i == 1 )
+ {
+ if ( conf == CMenuManager::CONFIG_2 )
+ MenuPage_Controls.m_controls[0] = &MenuControls_7;
+ else
+ MenuPage_Controls.m_controls[0] = &MenuControls_4;
+ }
+ else if ( i == 0 )
+ {
+ if ( conf == CMenuManager::CONFIG_2 )
+ MenuPage_Controls.m_controls[0] = &MenuControls_6;
+ else
+ MenuPage_Controls.m_controls[0] = &MenuControls_3;
+ }
+ }
+}
+
+void
+TriggerControls_DrawContrConfig(CMenuMultiChoiceTriggeredAlways *widget)
+{
+ if ( widget )
+ {
+ int32 conf = widget->GetMenuSelection();
+ if ( widget->m_cursor != -1 )
+ conf = widget->m_cursor;
+
+ InitialiseTextsInMenuControllerOnFoot(&MenuControls_3, (CMenuManager::CONTRCONFIG)conf);
+ InitialiseTextsInMenuControllerInCar(&MenuControls_4, (CMenuManager::CONTRCONFIG)conf);
+
+ int32 i = MenuControls_2.GetMenuSelection();
+ if ( i == 1 )
+ {
+ if ( conf == CMenuManager::CONFIG_2 )
+ MenuPage_Controls.m_controls[0] = &MenuControls_7;
+ else
+ MenuPage_Controls.m_controls[0] = &MenuControls_4;
+ }
+ else if ( i == 0 )
+ {
+ if ( conf == CMenuManager::CONFIG_2 )
+ MenuPage_Controls.m_controls[0] = &MenuControls_6;
+ else
+ MenuPage_Controls.m_controls[0] = &MenuControls_3;
+ }
+ }
+}
+
+void
+TriggerControls_ContrConfig(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ int32 conf = widget->GetMenuSelection();
+
+ InitialiseTextsInMenuControllerOnFoot(&MenuControls_3, (CMenuManager::CONTRCONFIG)conf);
+ InitialiseTextsInMenuControllerInCar(&MenuControls_4, (CMenuManager::CONTRCONFIG)conf);
+
+ int32 i = MenuControls_2.GetMenuSelection();
+ if ( i == 1 )
+ {
+ if ( conf == CMenuManager::CONFIG_2 )
+ MenuPage_Controls.m_controls[0] = &MenuControls_7;
+ else
+ MenuPage_Controls.m_controls[0] = &MenuControls_4;
+ }
+ else if ( i == 0 )
+ {
+ if ( conf == CMenuManager::CONFIG_2 )
+ MenuPage_Controls.m_controls[0] = &MenuControls_6;
+ else
+ MenuPage_Controls.m_controls[0] = &MenuControls_3;
+ }
+ }
+}
+
+void
+TriggerLanguage_Language(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ if ( CMenuManager::m_PrefsLanguage != widget->GetMenuSelection() )
+ {
+ CMenuManager::m_PrefsLanguage = widget->GetMenuSelection();
+ FrontEndMenuManager.m_bInitialised = false;
+ bFrontEnd_ReloadObrTxtGxt = true;
+ }
+ }
+}
+
+void
+TriggerAudio_RadioStation(CMenuMultiChoicePicturedTriggered *widget)
+{
+ if ( widget )
+ {
+ if ( CMenuManager::m_PrefsRadioStation != widget->GetMenuSelection() )
+ {
+ CMenuManager::m_PrefsRadioStation = widget->GetMenuSelection();
+ DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
+ }
+ }
+}
+
+void
+TriggerAudio_StereoMono(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ if (widget->GetMenuSelection() == 1)
+ {
+ DMAudio.SetMonoMode(true);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MONO, 0);
+ }
+ else
+ {
+ DMAudio.SetMonoMode(false);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_STEREO, 0);
+ }
+ }
+}
+
+void
+TriggerAudio_MusicVolumeAlways(CMenuSliderTriggered *widget)
+{
+ ;
+}
+
+void
+TriggerAudio_SfxVolumeAlways(CMenuSliderTriggered *widget)
+{
+ if ( widget )
+ {
+ static bool bTriggerTest = false;
+
+ CMenuManager::m_PrefsSfxVolume = float(widget->GetMenuSelection()) / 100.0f * 127.0f + 0.5f;
+
+ if ( CMenuManager::m_PrefsSfxVolume == 102 && !CPad::GetPad(0)->GetDPadLeft()&& !CPad::GetPad(0)->GetDPadRight() )
+ {
+ if ( bTriggerTest )
+ {
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_AUDIO_TEST, 0);
+ bTriggerTest = false;
+ }
+ }
+ else
+ bTriggerTest = true;
+
+ FrontEndMenuManager.SetSoundLevelsForMusicMenu();
+ }
+}
+
+void
+TriggerAudio_MusicVolume(CMenuSliderTriggered *widget)
+{
+ if ( widget )
+ {
+ CMenuManager::m_PrefsMusicVolume = float(widget->GetMenuSelection()) / 100.0f * 127.0f + 0.5f;
+ FrontEndMenuManager.SetSoundLevelsForMusicMenu();
+ }
+}
+
+void
+TriggerAudio_SfxVolume(CMenuSliderTriggered *widget)
+{
+ ;
+}
+
+void
+TriggerSave_NewGameNewGame(CMenuMultiChoiceTriggered *widget)
+{
+ FrontEndMenuManager.m_bWantToRestart = true;
+ FrontEndMenuManager.m_bMenuActive = false;
+ FrontEndMenuManager.m_bInSaveZone = false;
+ bIgnoreTriangleButton = false;
+
+ CTimer::EndUserPause();
+
+ FrontEndMenuManager.AnaliseMenuContents();
+
+ DMAudio.SetEffectsFadeVol(0);
+ DMAudio.SetMusicFadeVol(0);
+ DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
+}
+
+void
+TriggerSave_NewGameSelectYes(CMenuMultiChoiceTriggered *widget)
+{
+ // Are you sure you want to start a new game? All progress since the last save game will be lost. Proceed?
+ MenuSaveZoneQYN_1.m_numTexts = 0;
+ MenuSaveZoneQYN_1.AddText(TheText.Get("FESZ_QR"), X(-100.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneQYN_2.m_numOptions = 0;
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_NO"), X(80.0f), YF(30.0f), TriggerSave_BackToMainMenu, 0, 0);
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_YES"), X(80.0f), YF(10.0f), TriggerSave_NewGameNewGame, 0, 0);
+
+ MenuPageSaveZone_QuestionYesNo.ActivatePage();
+ pMenuSave = &MenuPageSaveZone_QuestionYesNo;
+ bIgnoreTriangleButton = true;
+}
+
+void
+TriggerSave_DeleteGameDeleteGame(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+
+ if ( !MemCardAccessTriggerCaller.CanCall() )
+ MemCardAccessTriggerCaller.SetTrigger(TriggerSave_DeleteGameDeleteGame, widget);
+ else
+ {
+ // Deleting data. Please do not remove the Memory Card (PS2) in MEMORY CARD slot 1, reset or switch off the console.
+ DisplayMemoryCardAccessMsg(TheText.Get("FEDL_WR"), CRGBA(200, 50, 50, 192));
+
+ TheMemoryCard.DeleteSlot(MemoryCardSlotSelected);
+
+ if ( TheMemoryCard.GetError() != CMemoryCard::NO_ERR_SUCCESS)
+ {
+ // Deleting Failed! Check Memory Card (PS2) in MEMORY CARD slot 1 and please try again.
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheText.Get("FES_DEE"), X(-80.0f), YF(20.0f), TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(15.0f), TriggerSave_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pMenuSave = &MenuPageSaveZone_Message;
+
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = true;
+ }
+ else
+ {
+ FillMenuWithMemCardFileListing(&MenuSaveLG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_LoadGameLoadGameSelect, nil, 0, 34, 22);
+ FillMenuWithMemCardFileListing(&MenuSaveDG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_DeleteGameDeleteGameSelect, nil, 0, 34, 22);
+
+ pMenuSave = &MenuPage_SaveBasic;
+ pMenuSave->ActivatePage();
+ }
+ }
+ }
+}
+
+void
+TriggerSave_DeleteGameDeleteGameSelect(CMenuMultiChoiceTwoLinesTriggered *widget)
+{
+ if ( widget )
+ {
+ if ( widget->GetMenuSelection() > 0 )
+ {
+ MemoryCardSlotSelected = widget->GetMenuSelection() - 1;
+
+ switch ( TheMemoryCard.GetInfoOnSpecificSlot(MemoryCardSlotSelected) )
+ {
+ case CMemoryCard::SLOT_NOTPRESENT:
+ {
+ break;
+ }
+ case CMemoryCard::SLOT_CORRUPTED:
+ case CMemoryCard::SLOT_PRESENT:
+ {
+ // Proceed with deleting this saved game?
+ MenuSaveZoneQYN_1.m_numTexts = 0;
+ MenuSaveZoneQYN_1.AddText(TheText.Get("FESZ_QD"), X(-40.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneQYN_2.m_numOptions = 0;
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_NO"), X(80.0f), YF(20.0f), TriggerSave_BackToMainMenu, 0, 0);
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_YES"), X(80.0f), 0.0f, TriggerSave_DeleteGameDeleteGame, 0, 0);
+
+ MenuPageSaveZone_QuestionYesNo.ActivatePage();
+ pMenuSave = &MenuPageSaveZone_QuestionYesNo;
+ bMemoryCardSpecialZone = false;
+ break;
+ }
+ }
+ }
+ }
+}
+
+void
+TriggerSave_DeleteGameSelect(CMenuMultiChoiceTriggered *widget)
+{
+ FillMenuWithMemCardFileListing(&MenuSaveDG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_DeleteGameDeleteGameSelect, nil, 0, 34, 22);
+ FillMenuWithMemCardFileListing(&MenuSaveLG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_LoadGameLoadGameSelect, nil, 0, 34, 22);
+
+ pMenuSave = &MenuPage_SaveDeleteGame;
+ pMenuSave->ActivatePage();
+
+ gErrorSampleTriggered = false;
+ bMemoryCardSpecialZone = true;
+ bIgnoreTriangleButton = true;
+}
+
+void
+TriggerSave_LoadGameLoadGame(CMenuMultiChoiceTriggered *widget)
+{
+ if ( widget )
+ {
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+
+ if ( !MemCardAccessTriggerCaller.CanCall() )
+ MemCardAccessTriggerCaller.SetTrigger(TriggerSave_LoadGameLoadGame, widget);
+ else
+ {
+ // Loading data. Please do not remove the Memory Card (PS2) in MEMORY CARD slot 1, reset or switch off the console.
+ DisplayMemoryCardAccessMsg(TheText.Get("FELD_WR"), CRGBA(200, 50, 50, 192));
+ TheMemoryCard.LoadSlotToBuffer(MemoryCardSlotSelected);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::NO_ERR_SUCCESS)
+ {
+ FrontEndMenuManager.m_bWantToRestart = true;
+ FrontEndMenuManager.AnaliseMenuContents();
+ FrontEndMenuManager.m_bMenuActive = false;
+ FrontEndMenuManager.m_bInSaveZone = false;
+
+ CTimer::EndUserPause();
+
+ TheMemoryCard.m_bWantToLoad = true;
+
+ DMAudio.SetEffectsFadeVol(0);
+ DMAudio.SetMusicFadeVol(0);
+ DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
+ }
+ else
+ {
+ // Load Failed! Check Memory Card (PS2) in MEMORY CARD slot 1 and please try again.
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheText.Get("FES_LOE"), X(-80.0f), YF(20.0f), TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), YF(25.0f), TriggerSave_BackToMainMenu, 0, 0);
+
+ pMenuSave = &MenuPageSaveZone_Message;
+ pMenuSave->ActivatePage();
+
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = true;
+ }
+ }
+ }
+}
+
+void
+TriggerSave_LoadGameLoadGameSelect(CMenuMultiChoiceTwoLinesTriggered *widget)
+{
+ if ( widget )
+ {
+ if ( widget->GetMenuSelection() > 0 )
+ {
+ MemoryCardSlotSelected = widget->GetMenuSelection() - 1;
+
+ switch ( TheMemoryCard.GetInfoOnSpecificSlot(MemoryCardSlotSelected) )
+ {
+ case CMemoryCard::SLOT_NOTPRESENT:
+ {
+ break;
+ }
+ case CMemoryCard::SLOT_CORRUPTED:
+ {
+ // Load Failed.
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.AddText(TheText.Get("FES_LOF"), X(50.0f), YF(20.0f), TEXT_COLOR, 0);
+
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(100.0f), 0.0f, TriggerSave_BackToMainMenu, 0, 0);
+
+ MenuPageSaveZone_Message.ActivatePage();
+ pMenuSave = &MenuPageSaveZone_Message;
+ bMemoryCardSpecialZone = false;
+ break;
+ }
+ case CMemoryCard::SLOT_PRESENT:
+ {
+ // All unsaved progress in your current game will be lost. Proceed with loading?
+ MenuSaveZoneQYN_1.m_numTexts = 0;
+ MenuSaveZoneQYN_1.AddText(TheText.Get("FESZ_QL"), X(-40.0f), 0.0f, TEXT_COLOR, 0);
+
+ MenuSaveZoneQYN_2.m_numOptions = 0;
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_NO"), X(80.0f), YF(20.0f), TriggerSave_BackToMainMenu, 0, 0);
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_YES"), X(80.0f), 0.0f, TriggerSave_LoadGameLoadGame, 0, 0);
+
+ MenuPageSaveZone_QuestionYesNo.ActivatePage();
+ pMenuSave = &MenuPageSaveZone_QuestionYesNo;
+ bMemoryCardSpecialZone = false;
+ break;
+ }
+ }
+ }
+ }
+}
+
+void
+TriggerSave_LoadGameSelect(CMenuMultiChoiceTriggered *widget)
+{
+ FillMenuWithMemCardFileListing(&MenuSaveLG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_LoadGameLoadGameSelect, nil, 0, 34, 22);
+ FillMenuWithMemCardFileListing(&MenuSaveDG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_DeleteGameDeleteGameSelect, nil, 0, 34, 22);
+
+ pMenuSave = &MenuPage_SaveLoadGame;
+ pMenuSave->ActivatePage();
+
+ gErrorSampleTriggered = false;
+ bMemoryCardSpecialZone = true;
+ bIgnoreTriangleButton = true;
+}
+
+void
+TriggerSave_BackToMainMenu(CMenuMultiChoiceTriggered *widget)
+{
+ pMenuSave = &MenuPage_SaveBasic;
+ pMenuSave->ActivatePage();
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+}
+
+void InitialiseTextsInMenuControllerInCar(CMenuPictureAndText *widget, CMenuManager::CONTRCONFIG cont)
+{
+ if ( widget )
+ {
+ widget->m_numTexts = 0;
+
+ switch ( cont )
+ {
+ case CMenuManager::CONFIG_1:
+ {
+ widget->AddText(TheText.Get("FEC_LL"), X(50.0f), Y(-14.0f), PAD_TEXT_COLOR, true); // -16.0f
+ widget->AddText(TheText.Get("FEC_RSC"), X(-4.0f), Y(29.0f), PAD_TEXT_COLOR, true); // 33.142860f
+ widget->AddText(TheText.Get("FEC_VES"), X(-4.0f), Y(65.0f), PAD_TEXT_COLOR, true); // 74.285721f
+ widget->AddText(TheText.Get("FEC_VES"), X(-4.0f), Y(97.0f), PAD_TEXT_COLOR, true); // 110.857147f
+ widget->AddText(TheText.Get("FEC_HO3"), X(84.0f), Y(162.0f), PAD_TEXT_COLOR, false); // 185.142868f
+ widget->AddText(TheText.Get("FEC_CAM"), X(103.0f), Y(141.0f), PAD_TEXT_COLOR, false); // 161.142868f
+ widget->AddText(TheText.Get("FEC_PAU"), X(130.0f), Y(128.0f), PAD_TEXT_COLOR, false); // 146.285721f
+ widget->AddText(TheText.Get("FEC_LB"), X(68.0f), Y(-6.0f), PAD_TEXT_COLOR, false); // -6.857143f
+ widget->AddText(TheText.Get("FEC_LR"), X(184.0f), Y(-14.0f), PAD_TEXT_COLOR, false); // -16.0f
+ widget->AddText(TheText.Get("FEC_HAB"), X(238.0f), Y(25.0f), PAD_TEXT_COLOR, false); // 28.571430f
+ widget->AddText(TheText.Get("FEC_BRA"), X(155.0f), Y(18.0f), PAD_TEXT_COLOR, true); // 20.571430f
+ widget->AddText(TheText.Get("FEC_EXV"), X(238.0f), Y(52.0f), PAD_TEXT_COLOR, false); // 59.428574f
+ widget->AddText(TheText.Get("FEC_CAW"), X(238.0f), Y(65.0f), PAD_TEXT_COLOR, false); // 74.285721f
+ widget->AddText(TheText.Get("FEC_ACC"), X(238.0f), Y(78.0f), PAD_TEXT_COLOR, false); // 89.142860f
+ widget->AddText(TheText.Get("FEC_TUC"), X(238.0f), Y(94.0f), PAD_TEXT_COLOR, false); // 107.428574f
+ widget->AddText(TheText.Get("FEC_SM3"), X(238.0f), Y(109.0f), PAD_TEXT_COLOR, false); // 124.571434f
+
+ break;
+ }
+
+ case CMenuManager::CONFIG_2:
+ {
+ widget->AddText(TheText.Get("FEC_LL"), X(50.0f), Y(-14.0f), PAD_TEXT_COLOR, true); // -16.0f
+ widget->AddText(TheText.Get("FEC_HOR"), X(-4.0f), Y(29.0f), PAD_TEXT_COLOR, true); // 33.142860f
+ widget->AddText(TheText.Get("FEC_CAM"), X(-4.0f), Y(65.0f), PAD_TEXT_COLOR, true); // 74.285721f
+ widget->AddText(TheText.Get("FEC_VES"), X(-4.0f), Y(97.0f), PAD_TEXT_COLOR, true); // 110.857147f
+ widget->AddText(TheText.Get("FEC_NA"), X(84.0f), Y(162.0f), PAD_TEXT_COLOR, false); // 185.142868f
+ widget->AddText(TheText.Get("FEC_RSC"), X(103.0f), Y(141.0f), PAD_TEXT_COLOR, false); // 161.142868f
+ widget->AddText(TheText.Get("FEC_PAU"), X(130.0f), Y(128.0f), PAD_TEXT_COLOR, false); // 146.285721f
+ widget->AddText(TheText.Get("FEC_LB"), X(68.0f), Y(-6.0f), PAD_TEXT_COLOR, false); // -6.857143f
+ widget->AddText(TheText.Get("FEC_LR"), X(184.0f), Y(-14.0f), PAD_TEXT_COLOR, false); // -16.0f
+ widget->AddText(TheText.Get("FEC_HAB"), X(238.0f), Y(25.0f), PAD_TEXT_COLOR, false); // 28.571430f
+ widget->AddText(TheText.Get("FEC_BRA"), X(155.0f), Y(18.0f), PAD_TEXT_COLOR, true); // 20.571430f
+ widget->AddText(TheText.Get("FEC_EXV"), X(238.0f), Y(52.0f), PAD_TEXT_COLOR, false); // 59.428574f
+ widget->AddText(TheText.Get("FEC_CAW"), X(238.0f), Y(65.0f), PAD_TEXT_COLOR, false); // 74.285721f
+ widget->AddText(TheText.Get("FEC_ACC"), X(238.0f), Y(78.0f), PAD_TEXT_COLOR, false); // 89.142860f
+ widget->AddText(TheText.Get("FEC_TUC"), X(238.0f), Y(94.0f), PAD_TEXT_COLOR, false); // 107.428574f
+ widget->AddText(TheText.Get("FEC_SM3"), X(238.0f), Y(109.0f), PAD_TEXT_COLOR, false); // 124.571434f
+
+ break;
+ }
+
+ case CMenuManager::CONFIG_3:
+ {
+ widget->AddText(TheText.Get("FEC_LL"), X(50.0f), Y(-14.0f), PAD_TEXT_COLOR, true); // -16.0f
+ widget->AddText(TheText.Get("FEC_EXV"), X(-4.0f), Y(29.0f), PAD_TEXT_COLOR, true); // 33.142860f
+ widget->AddText(TheText.Get("FEC_VES"), X(-4.0f), Y(65.0f), PAD_TEXT_COLOR, true); // 74.285721f
+ widget->AddText(TheText.Get("FEC_VES"), X(-4.0f), Y(97.0f), PAD_TEXT_COLOR, true); // 110.857147f
+ widget->AddText(TheText.Get("FEC_RS3"), X(84.0f), Y(162.0f), PAD_TEXT_COLOR, false); // 185.142868f
+ widget->AddText(TheText.Get("FEC_CAM"), X(103.0f), Y(141.0f), PAD_TEXT_COLOR, false); // 161.142868f
+ widget->AddText(TheText.Get("FEC_PAU"), X(130.0f), Y(128.0f), PAD_TEXT_COLOR, false); // 146.285721f
+ widget->AddText(TheText.Get("FEC_LB"), X(68.0f), Y(-6.0f), PAD_TEXT_COLOR, false); // -6.857143f
+ widget->AddText(TheText.Get("FEC_LR"), X(184.0f), Y(-14.0f), PAD_TEXT_COLOR, false); // -16.0f
+ widget->AddText(TheText.Get("FEC_HOR"), X(238.0f), Y(25.0f), PAD_TEXT_COLOR, false); // 28.571430f
+ widget->AddText(TheText.Get("FEC_BRA"), X(155.0f), Y(18.0f), PAD_TEXT_COLOR, true); // 20.571430f
+ widget->AddText(TheText.Get("FEC_HAB"), X(238.0f), Y(52.0f), PAD_TEXT_COLOR, false); // 59.428574f
+ widget->AddText(TheText.Get("FEC_CAW"), X(238.0f), Y(65.0f), PAD_TEXT_COLOR, false); // 74.285721f
+ widget->AddText(TheText.Get("FEC_ACC"), X(238.0f), Y(78.0f), PAD_TEXT_COLOR, false); // 89.142860f
+ widget->AddText(TheText.Get("FEC_TUC"), X(238.0f), Y(94.0f), PAD_TEXT_COLOR, false); // 107.428574f
+ widget->AddText(TheText.Get("FEC_SM3"), X(238.0f), Y(109.0f), PAD_TEXT_COLOR, false); // 124.571434f
+
+ break;
+ }
+
+ case CMenuManager::CONFIG_4:
+ {
+ widget->AddText(TheText.Get("FEC_LL"), X(50.0f), Y(-14.0f), PAD_TEXT_COLOR, true); // -16.0f
+ widget->AddText(TheText.Get("FEC_HAB"), X(-4.0f), Y(29.0f), PAD_TEXT_COLOR, true); // 33.142860f
+ widget->AddText(TheText.Get("FEC_TUC"), X(-4.0f), Y(65.0f), PAD_TEXT_COLOR, true); // 74.285721f
+ widget->AddText(TheText.Get("FEC_VES"), X(-4.0f), Y(97.0f), PAD_TEXT_COLOR, true); // 110.857147f
+ widget->AddText(TheText.Get("FEC_HO3"), X(84.0f), Y(162.0f), PAD_TEXT_COLOR, false); // 185.142868f
+ widget->AddText(TheText.Get("FEC_CAM"), X(103.0f), Y(141.0f), PAD_TEXT_COLOR, false); // 161.142868f
+ widget->AddText(TheText.Get("FEC_PAU"), X(130.0f), Y(128.0f), PAD_TEXT_COLOR, false); // 146.285721f
+ widget->AddText(TheText.Get("FEC_LB"), X(68.0f), Y(-6.0f), PAD_TEXT_COLOR, false); // -6.857143f
+ widget->AddText(TheText.Get("FEC_LR"), X(184.0f), Y(-14.0f), PAD_TEXT_COLOR, false); // -16.0f
+ widget->AddText(TheText.Get("FEC_CAW"), X(238.0f), Y(25.0f), PAD_TEXT_COLOR, false); // 28.571430f
+ widget->AddText(TheText.Get("FEC_SMT"), X(155.0f), Y(18.0f), PAD_TEXT_COLOR, true); // 20.571430f
+ widget->AddText(TheText.Get("FEC_EXV"), X(238.0f), Y(52.0f), PAD_TEXT_COLOR, false); // 59.428574f
+ widget->AddText(TheText.Get("FEC_RSC"), X(238.0f), Y(65.0f), PAD_TEXT_COLOR, false); // 74.285721f
+ widget->AddText(TheText.Get("FEC_NA"), X(238.0f), Y(78.0f), PAD_TEXT_COLOR, false); // 89.142860f
+ widget->AddText(TheText.Get("FEC_ACC"), X(238.0f), Y(94.0f), PAD_TEXT_COLOR, false); // 107.428574f
+ widget->AddText(TheText.Get("FEC_BRA"), X(238.0f), Y(109.0f), PAD_TEXT_COLOR, false); // 124.571434f
+
+ break;
+ }
+ }
+ }
+}
+
+void InitialiseTextsInMenuControllerOnFoot(CMenuPictureAndText *widget, CMenuManager::CONTRCONFIG cont)
+{
+ if ( widget )
+ {
+ widget->m_numTexts = 0;
+
+
+ switch ( cont )
+ {
+ case CMenuManager::CONFIG_1:
+ {
+ widget->AddText(TheText.Get("FEC_CWL"), X(50.0f), Y(-14.0f), PAD_TEXT_COLOR, true); // -16.0f
+ widget->AddText(TheText.Get("FEC_LOF"), X(-4.0f), Y(25.0f), PAD_TEXT_COLOR, true); // 28.571430f
+ widget->AddText(TheText.Get("FEC_MOV"), X(-4.0f), Y(65.0f), PAD_TEXT_COLOR, true); // 74.285721f
+ widget->AddText(TheText.Get("FEC_MOV"), X(-4.0f), Y(97.0f), PAD_TEXT_COLOR, true); // 110.857147f
+ widget->AddText(TheText.Get("FEC_CAM"), X(103.0f), Y(141.0f), PAD_TEXT_COLOR, false); // 161.142868f
+ widget->AddText(TheText.Get("FEC_PAU"), X(130.0f), Y(128.0f), PAD_TEXT_COLOR, false); // 146.285721f
+ widget->AddText(TheText.Get("FEC_CWR"), X(184.0f), Y(-14.0f), PAD_TEXT_COLOR, false); // -16.0f
+ widget->AddText(TheText.Get("FEC_TAR"), X(238.0f), Y(25.0f), PAD_TEXT_COLOR, false); // 28.571430f
+ widget->AddText(TheText.Get("FEC_JUM"), X(144.0f), Y(18.0f), PAD_TEXT_COLOR, true); // 20.571430f
+ widget->AddText(TheText.Get("FEC_ENV"), X(238.0f), Y(52.0f), PAD_TEXT_COLOR, false); // 59.428574f
+ widget->AddText(TheText.Get("FEC_ATT"), X(238.0f), Y(65.0f), PAD_TEXT_COLOR, false); // 74.285721f
+ widget->AddText(TheText.Get("FEC_RUN"), X(238.0f), Y(78.0f), PAD_TEXT_COLOR, false); // 89.142860f
+ widget->AddText(TheText.Get("FEC_FPC"), X(238.0f), Y(94.0f), PAD_TEXT_COLOR, false); // 107.428574f
+ widget->AddText(TheText.Get("FEC_LB3"), X(238.0f), Y(109.0f), PAD_TEXT_COLOR, false); // 124.571434f
+ widget->AddText(TheText.Get("FEC_R3"), X(238.0f), Y(122.0f), PAD_TEXT_COLOR, false); // 139.428574f
+
+ break;
+ }
+
+ case CMenuManager::CONFIG_2:
+ {
+ widget->AddText(TheText.Get("FEC_CWL"), X(50.0f), Y(-14.0f), PAD_TEXT_COLOR, true); // -16.0f
+ widget->AddText(TheText.Get("FEC_LOF"), X(-4.0f), Y(25.0f), PAD_TEXT_COLOR, true); // 28.571430f
+ widget->AddText(TheText.Get("FEC_CAM"), X(-4.0f), Y(65.0f), PAD_TEXT_COLOR, true); // 74.285721f
+ widget->AddText(TheText.Get("FEC_MOV"), X(-4.0f), Y(97.0f), PAD_TEXT_COLOR, true); // 110.857147f
+ widget->AddText(TheText.Get("FEC_NA"), X(103.0f), Y(141.0f), PAD_TEXT_COLOR, false); // 161.142868f
+ widget->AddText(TheText.Get("FEC_PAU"), X(130.0f), Y(128.0f), PAD_TEXT_COLOR, false); // 146.285721f
+ widget->AddText(TheText.Get("FEC_CWR"), X(184.0f), Y(-14.0f), PAD_TEXT_COLOR, false); // -16.0f
+ widget->AddText(TheText.Get("FEC_TAR"), X(238.0f), Y(25.0f), PAD_TEXT_COLOR, false); // 28.571430f
+ widget->AddText(TheText.Get("FEC_JUM"), X(144.0f), Y(18.0f), PAD_TEXT_COLOR, true); // 20.571430f
+ widget->AddText(TheText.Get("FEC_ENV"), X(238.0f), Y(52.0f), PAD_TEXT_COLOR, false); // 59.428574f
+ widget->AddText(TheText.Get("FEC_ATT"), X(238.0f), Y(65.0f), PAD_TEXT_COLOR, false); // 74.285721f
+ widget->AddText(TheText.Get("FEC_RUN"), X(238.0f), Y(78.0f), PAD_TEXT_COLOR, false); // 89.142860f
+ widget->AddText(TheText.Get("FEC_FPC"), X(238.0f), Y(94.0f), PAD_TEXT_COLOR, false); // 107.428574f
+ widget->AddText(TheText.Get("FEC_LB3"), X(238.0f), Y(109.0f), PAD_TEXT_COLOR, false); // 124.571434f
+ widget->AddText(TheText.Get("FEC_R3"), X(238.0f), Y(122.0f), PAD_TEXT_COLOR, false); // 139.428574f
+
+ break;
+ }
+
+ case CMenuManager::CONFIG_3:
+ {
+ widget->AddText(TheText.Get("FEC_CWL"), X(50.0f), Y(-14.0f), PAD_TEXT_COLOR, true); // -16.0f
+ widget->AddText(TheText.Get("FEC_ENV"), X(-4.0f), Y(25.0f), PAD_TEXT_COLOR, true); // 28.571430f
+ widget->AddText(TheText.Get("FEC_MOV"), X(-4.0f), Y(65.0f), PAD_TEXT_COLOR, true); // 74.285721f
+ widget->AddText(TheText.Get("FEC_MOV"), X(-4.0f), Y(97.0f), PAD_TEXT_COLOR, true); // 110.857147f
+ widget->AddText(TheText.Get("FEC_CAM"), X(103.0f), Y(141.0f), PAD_TEXT_COLOR, false); // 161.142868f
+ widget->AddText(TheText.Get("FEC_PAU"), X(130.0f), Y(128.0f), PAD_TEXT_COLOR, false); // 146.285721f
+ widget->AddText(TheText.Get("FEC_CWR"), X(184.0f), Y(-14.0f), PAD_TEXT_COLOR, false); // -16.0f
+ widget->AddText(TheText.Get("FEC_TAR"), X(238.0f), Y(25.0f), PAD_TEXT_COLOR, false); // 28.571430f
+ widget->AddText(TheText.Get("FEC_JUM"), X(144.0f), Y(18.0f), PAD_TEXT_COLOR, true); // 20.571430f
+ widget->AddText(TheText.Get("FEC_LOF"), X(238.0f), Y(52.0f), PAD_TEXT_COLOR, false); // 59.428574f
+ widget->AddText(TheText.Get("FEC_RUN"), X(238.0f), Y(65.0f), PAD_TEXT_COLOR, false); // 74.285721f
+ widget->AddText(TheText.Get("FEC_ATT"), X(238.0f), Y(78.0f), PAD_TEXT_COLOR, false); // 89.142860f
+ widget->AddText(TheText.Get("FEC_FPC"), X(238.0f), Y(94.0f), PAD_TEXT_COLOR, false); // 107.428574f
+ widget->AddText(TheText.Get("FEC_LB3"), X(238.0f), Y(109.0f), PAD_TEXT_COLOR, false); // 124.571434f
+ widget->AddText(TheText.Get("FEC_R3"), X(238.0f), Y(122.0f), PAD_TEXT_COLOR, false); // 139.428574f
+
+ break;
+ }
+
+ case CMenuManager::CONFIG_4:
+ {
+ widget->AddText(TheText.Get("FEC_CWL"), X(50.0f), Y(-14.0f), PAD_TEXT_COLOR, true); // -16.0f
+ widget->AddText(TheText.Get("FEC_TAR"), X(-4.0f), Y(25.0f), PAD_TEXT_COLOR, true); // 28.571430f
+ widget->AddText(TheText.Get("FEC_NA"), X(-4.0f), Y(65.0f), PAD_TEXT_COLOR, true); // 74.285721f
+ widget->AddText(TheText.Get("FEC_MOV"), X(-4.0f), Y(97.0f), PAD_TEXT_COLOR, true); // 110.857147f
+ widget->AddText(TheText.Get("FEC_CAM"), X(103.0f), Y(141.0f), PAD_TEXT_COLOR, false); // 161.142868f
+ widget->AddText(TheText.Get("FEC_PAU"), X(130.0f), Y(128.0f), PAD_TEXT_COLOR, false); // 146.285721f
+ widget->AddText(TheText.Get("FEC_CWR"), X(184.0f), Y(-14.0f), PAD_TEXT_COLOR, false); // -16.0f
+ widget->AddText(TheText.Get("FEC_ATT"), X(238.0f), Y(25.0f), PAD_TEXT_COLOR, false); // 28.571430f
+ widget->AddText(TheText.Get("FEC_JUM"), X(144.0f), Y(18.0f), PAD_TEXT_COLOR, true); // 20.571430f
+ widget->AddText(TheText.Get("FEC_ENV"), X(238.0f), Y(52.0f), PAD_TEXT_COLOR, false); // 59.428574f
+ widget->AddText(TheText.Get("FEC_LOF"), X(238.0f), Y(65.0f), PAD_TEXT_COLOR, false); // 74.285721f
+ widget->AddText(TheText.Get("FEC_RUN"), X(238.0f), Y(78.0f), PAD_TEXT_COLOR, false); // 89.142860f
+ widget->AddText(TheText.Get("FEC_FPC"), X(238.0f), Y(94.0f), PAD_TEXT_COLOR, false); // 107.428574f
+ widget->AddText(TheText.Get("FEC_LB3"), X(238.0f), Y(109.0f), PAD_TEXT_COLOR, false); // 124.571434f
+ widget->AddText(TheText.Get("FEC_R3"), X(238.0f), Y(122.0f), PAD_TEXT_COLOR, false); // 139.428574f
+
+ break;
+ }
+ }
+ }
+}
+
+void
+TriggerSaveZone_BackToMainMenuTwoLines(CMenuMultiChoiceTwoLinesTriggered *widget)
+{
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+ pActiveMenuPage = &MenuPageSaveZone_SaveGame;
+}
+
+void
+TriggerSave_BackToMainMenuTwoLines(CMenuMultiChoiceTwoLinesTriggered *widget)
+{
+ pMenuSave = &MenuPage_SaveBasic;
+ pMenuSave->ActivatePage();
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+}
+
+void
+SetRandomActiveTextlineColor(uint8 bText)
+{
+ if ( bMemoryCardSpecialZone )
+ rgbaATC = SELECTED_TEXT_COLOR;
+ else
+ {
+ bool bSelected = false;
+ bool bHighlignted = false;
+
+ switch ( FrontEndMenuManager.m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ break;
+ case PAGESTATE_HIGHLIGHTED:
+ bHighlignted = true;
+ break;
+ case PAGESTATE_SELECTED:
+ bSelected = true;
+ break;
+ }
+
+ if ( FrontEndMenuManager.m_bInSaveZone )
+ bSelected = true;
+
+ if ( bSelected || bText )
+ {
+ static uint32 delayTime = 0;
+ static bool bAddVal = true;
+
+ if ( delayTime < CTimer::GetTimeInMillisecondsPauseMode() )
+ {
+ delayTime = CTimer::GetTimeInMillisecondsPauseMode() + 200;
+
+ if ( bAddVal )
+ rgbaATC = TEXT_COLOR;
+ else
+ rgbaATC = SELECTED_TEXT_COLOR;
+
+ bAddVal = !bAddVal;
+ }
+ }
+
+ if ( bHighlignted )
+ {
+ static uint32 delayTime = 0;
+ static bool bAddVal = true;
+
+ if ( delayTime < CTimer::GetTimeInMillisecondsPauseMode() )
+ {
+ delayTime = CTimer::GetTimeInMillisecondsPauseMode() + 200;
+
+ if ( bAddVal )
+ rgbaATC = TITLE_TEXT_COLOR;
+ else
+ rgbaATC = MENU_SELECTED_COLOR;
+
+ bAddVal = !bAddVal;
+ }
+ }
+ }
+}
+
+#ifdef GTA_PC
+
+void
+TriggerDisplay_Trails(CMenuOnOffTriggered *widget)
+{
+ if ( widget )
+ {
+ CMenuManager::m_PrefsShowTrails = widget->GetMenuSelection();
+ CMBlur::BlurOn = CMenuManager::m_PrefsShowTrails;
+
+ if ( CMBlur::BlurOn )
+ CMBlur::MotionBlurOpen(Scene.camera);
+ else
+ CMBlur::MotionBlurClose();
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/core/Frontend_PS2.cpp b/src/core/Frontend_PS2.cpp
new file mode 100644
index 00000000..8e604978
--- /dev/null
+++ b/src/core/Frontend_PS2.cpp
@@ -0,0 +1,3034 @@
+#include "common.h"
+#ifdef PS2_MENU
+#include "platform.h"
+#include "main.h"
+#include "Timer.h"
+#include "Pad.h"
+#include "Sprite2d.h"
+#include "Text.h"
+#include "Font.h"
+#include "Hud.h"
+#include "MBlur.h"
+#include "DMAudio.h"
+#include "Streaming.h"
+#include "Camera.h"
+#include "Credits.h"
+#include "General.h"
+#include "TxdStore.h"
+#include "FileMgr.h"
+#include "Messages.h"
+#include "Frontend_PS2.h"
+#include "Stats.h"
+#include "Game.h"
+#include "World.h"
+#include "PlayerInfo.h"
+#include "FrontendControls.h"
+#include "MemoryCard.h"
+
+#define CRect_SZ(x, y, w, h) CRect(x, y, x+w, y+h)
+
+wchar MemoryCard_FileNames[8][100+1];
+CMenuManager FrontEndMenuManager;
+
+// TEMP: put into header
+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);
+
+
+#define SCRW SCREEN_WIDTH
+#define SCRH SCREEN_HEIGHT
+//#define X SCREEN_STRETCH_X
+//#define Y SCREEN_STRETCH_Y
+#define X SCREEN_SCALE_X
+#define Y SCREEN_SCALE_Y
+
+#define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL)))
+//#define X(x) ((x)/640.0f*SCRW)
+//#define Y(y) ((y)/448.0f*SCRH)
+
+
+static float MENU_TEXT_SIZE_X = 0.644f;
+static float MENU_TEXT_SIZE_Y = 0.84f; //0.96f;
+float BUTTONTAB_TEXT_SIZE_X = 0.35f;
+float BUTTONTAB_TEXT_SIZE_Y = 0.7f; //0.8f;
+float PANEL_TEXT_SIZE_X = 0.8f;
+float PANEL_TEXT_SIZE_Y = 1.2f; //0.96f/0.7f; //??
+float MEMCARD_ACCESS_MSG_SIZE_X = 0.84f;
+float MEMCARD_ACCESS_MSG_SIZE_Y = 1.12f; //1.28f;
+
+CRGBA SELECTED_TEXT_COLOR(255, 182, 48, 255);
+CRGBA BACKGROUND_SPLASH_COLOR(48, 48, 48, 255);
+
+CVector2D CONTR_DESCR_NEW_TEXTSCALE(0.4564f, 0.63f); // 0.72
+CVector2D CONFIGS_NEW_TEXTSCALE(0.49f, 0.7f); // 0.8
+CVector2D AUDIO_OUTPUT_POS(0.0f, 0.0f);
+CVector2D AUDIO_RSTATION_POS(154.0f, 0.0f);
+CVector2D DISPLAY_BRIGHTNESS_POS(0.0f, 0.0f);
+
+CRGBA TEXT_COLOR(150, 110, 30, 255);
+CRGBA PAD_TEXT_COLOR(200, 200, 200, 255);
+CRGBA CRIM_RATING_TEXT_COLOR(255, 182, 48, 255);
+CRGBA SCROLL_TEXT_COLOR(150, 110, 30, 255);
+CRGBA TITLE_TEXT_COLOR(170, 130, 50, 255);
+CRGBA TEXT_SHADOW_COLOR(0, 0, 0, 255);
+CVector2D SHADOW_VECTOR(1.0f, 1.0f);
+CRGBA SLIDER_RIGHT_COLOR(20, 94, 136, 255);
+CRGBA SLIDER_LEFT_COLOR(86, 196, 255, 255);
+CRGBA MENU_SELECTED_COLOR(255, 212, 88, 255);
+CRGBA rgbaATC(96, 96, 96, 255); // active text color. not constant
+
+float BUTTONTAB_TEXT_X_SCALES[NUM_PAGES] = { 1.0f };
+float PANEL_TEXT_X_SCALES[NUM_PAGES] = { 1.0f };
+
+int32 MemoryCardSlotSelected;
+uint32 TimeToStopPadShaking;
+bool bFrontEnd_ReloadObrTxtGxt;
+
+bool bMemoryCardStartUpMenus_ExitNow;
+
+extern CMenuPage MenuPage_SaveBasic;
+CMenuPage *pActiveMenuPage;
+CMenuPage *pMenuSave = &MenuPage_SaveBasic;
+bool bMemoryCardSpecialZone;
+bool bIgnoreTriangleButton;
+bool gErrorSampleTriggered;
+
+bool gMusicPlaying;
+
+CMenuPage MenuPage_Stats;
+ CMenuLineLister MenuStats_1;
+ CMenuPictureAndText MenuStats_2; // criminal rating
+CMenuPage MenuPage_Briefs;
+ CMenuPictureAndText MenuBriefs_1;
+ CMenuDummy MenuBriefs_2;
+CMenuPage MenuPage_SaveBasic;
+ CMenuMultiChoiceTriggered MenuSaveB_1; // "Load Game", "Delete Game", "New Game"
+CMenuPage MenuPage_SaveNewGame;
+ CMenuPictureAndText MenuSaveNG_1; // "Load Game", "Delete Game", "New Game"
+ CMenuMultiChoiceTriggered MenuSaveNG_2; // "No", "Yes"
+CMenuPage MenuPage_SaveLoadGame;
+ CMenuPictureAndText MenuSaveLG_1; // "Load Game", "Delete Game", "New Game"
+ CMenuMultiChoiceTwoLinesTriggered MenuSaveLG_2; // save games
+CMenuPage MenuPage_SaveDeleteGame;
+ CMenuPictureAndText MenuSaveDG_1; // "Load Game", "Delete Game", "New Game"
+ CMenuMultiChoiceTwoLinesTriggered MenuSaveDG_2; // save games
+CMenuPage MenuPage_Controls;
+ CMenuPictureAndText MenuControls_3; // controller images
+ CMenuPictureAndText MenuControls_6;
+ CMenuPictureAndText MenuControls_4;
+ CMenuPictureAndText MenuControls_7;
+ CMenuMultiChoiceTriggeredAlways MenuControls_1; // "Configuration:" "Setup1", "Setup2", "Setup3", "Setup4"
+ CMenuMultiChoiceTriggered MenuControls_2; // "Controller Display:" "On Foot", "In Car"
+ CMenuOnOffTriggered MenuControls_5; // "Vibration:"
+CMenuPageAnyMove MenuPage_Audio;
+ CMenuSliderTriggered MenuAudio_1; // "Music Volume"
+ CMenuMultiChoiceTriggered MenuAudio_4; // "Output:" "Stereo", "Mono"
+ CMenuSliderTriggered MenuAudio_2; // "SFX Volume"
+ CMenuMultiChoicePicturedTriggeredAnyMove MenuAudio_3; // "Radio station select:"
+CMenuPage MenuPage_Display;
+ CMenuSlider MenuDisplay_1; // "Brightness"
+#ifdef GTA_PC
+ CMenuOnOffTriggered MenuDisplay_2; // "Trails:"
+#else
+ CMenuOnOff MenuDisplay_2; // "Trails:"
+#endif
+ CMenuOnOff MenuDisplay_3; // "Subtitles:"
+ CMenuOnOff MenuDisplay_4; // "Wide Screen:"
+CMenuPage MenuPage_Language;
+ CMenuMultiChoiceTriggered MenuLanguage_1; // "English", "French", "German", "Italian", "Spanish"
+
+CMenuPage MenuPageSaveZone_SaveGame;
+ CMenuMultiChoiceTriggered MenuSaveZoneSG_1; // "Save game", "Cancel"
+CMenuPage MenuPageSaveZone_SaveSlots;
+ CMenuMultiChoiceTwoLinesTriggered MenuSaveZoneSSL_1; // "Cancel"
+CMenuPage MenuPageSaveZone_SavedSuccessfully;
+ CMenuPictureAndText MenuSaveZoneSS_1; // "Game saved successfully!" "Your saved filename is:"
+ CMenuMultiChoiceTriggered MenuSaveZoneSS_2; // "Quit"
+CMenuPage MenuPageSaveZone_Message;
+ CMenuPictureAndText MenuSaveZoneMSG_1; // "Save Failed! Check memory card (PS2) in MEMORY CARD slot 1 and please try again."
+ CMenuMultiChoiceTriggered MenuSaveZoneMSG_2; // "OK"
+CMenuPage MenuPageSaveZone_QuestionYesNo;
+ CMenuPictureAndText MenuSaveZoneQYN_1; // "Save Failed! Check memory card (PS2) in MEMORY CARD slot 1 and please try again."
+ CMenuMultiChoiceTriggered MenuSaveZoneQYN_2; // "Yes", "No"
+CMenuPage MenuPageSaveZone_FormatCard;
+ CMenuMultiChoiceTriggered MenuSaveZoneFC_1; // "Memory card (PS2) in MEMORY CARD slot 1 is unformatted. Would you like to format memory card (PS2) in MEMORY CARD slot 1?" "No" "Yes"
+CMenuPage MenuPageSaveZone_ErrorFormat;
+ CMenuMultiChoiceTriggered MenuSaveZoneEF_1; // "Format Failed! Check memory card (PS2) in MEMORY CARD slot 1 and please try again." "OK"
+
+
+VALIDATE_SIZE(CPlaceableText, 0x10);
+VALIDATE_SIZE(CPlaceableShText, 0x20);
+VALIDATE_SIZE(CPlaceableShTextTwoLines, 0x30);
+VALIDATE_SIZE(CPlaceableShOption, 0x28);
+VALIDATE_SIZE(CPlaceableShOptionTwoLines, 0x38);
+VALIDATE_SIZE(CPlaceableSprite, 0x18);
+VALIDATE_SIZE(CPlaceableShSprite, 0x34);
+VALIDATE_SIZE(CMenuMultiChoice, 0x2CC);
+VALIDATE_SIZE(CMenuMultiChoiceTriggered, 0x310);
+VALIDATE_SIZE(CMenuMultiChoiceTwoLines, 0x3CC);
+VALIDATE_SIZE(CMenuOnOff, 0x90);
+
+#include "FrontendTriggers.h"
+
+static const char* FrontendFilenames[][2] =
+{
+ {"fe2_mainpanel_ul", "" },
+ {"fe2_mainpanel_ur", "" },
+ {"fe2_mainpanel_dl", "" },
+ {"fe2_mainpanel_dr", "" },
+ {"fe2_mainpanel_dr2", "" },
+ {"fe2_tabactive", "" },
+ {"fe_iconbrief", "" },
+ {"fe_iconstats", "" },
+ {"fe_iconcontrols", "" },
+ {"fe_iconsave", "" },
+ {"fe_iconaudio", "" },
+ {"fe_icondisplay", "" },
+ {"fe_iconlanguage", "" },
+ {"fe_controller", "" },
+ {"fe_controllersh", "" },
+ {"fe_arrows1", "" },
+ {"fe_arrows2", "" },
+ {"fe_arrows3", "" },
+ {"fe_arrows4", "" },
+ {"fe_radio1", "" },
+ {"fe_radio2", "" },
+ {"fe_radio3", "" },
+ {"fe_radio4", "" },
+ {"fe_radio5", "" },
+ {"fe_radio6", "" },
+ {"fe_radio7", "" },
+ {"fe_radio8", "" },
+ {"fe_radio9", "" },
+};
+
+
+int32 CMenuManager::m_PrefsSfxVolume = 102;
+int32 CMenuManager::m_PrefsMusicVolume = 102;
+int32 CMenuManager::m_PrefsBrightness = 256;
+bool CMenuManager::m_PrefsShowTrails = true;
+bool CMenuManager::m_PrefsShowSubtitles = true;
+bool CMenuManager::m_PrefsAllowNastyGame = true;
+
+int32 CMenuManager::m_PrefsRadioStation = 0;
+int32 CMenuManager::m_PrefsStereoMono = 0;
+int8 CMenuManager::m_PrefsUseWideScreen = 0;
+int32 CMenuManager::m_PrefsLanguage = 0;
+CMenuManager::CONTRCONFIG CMenuManager::m_PrefsControllerConfig = CONFIG_1;
+bool CMenuManager::m_PrefsUseVibration = false;
+
+
+#ifdef GTA_PC
+#include "PlayerSkin.h"
+int32 CMenuManager::OS_Language = 0;
+int8 CMenuManager::m_PrefsVsync = 1;
+int8 CMenuManager::m_PrefsVsyncDisp = 1;
+int8 CMenuManager::m_PrefsFrameLimiter = 1;
+int8 CMenuManager::m_PrefsSpeakers;
+int32 CMenuManager::m_ControlMethod = CONTROL_CLASSIC;
+int8 CMenuManager::m_PrefsDMA = 1;
+float CMenuManager::m_PrefsLOD = 1.0f;
+char CMenuManager::m_PrefsSkinFile[256] = DEFAULT_SKIN_NAME;
+
+#ifndef MASTER
+bool CMenuManager::m_PrefsMarketing;
+bool CMenuManager::m_PrefsDisableTutorials;
+#endif // !MASTER
+
+#ifdef MENU_MAP
+bool CMenuManager::bMenuMapActive;
+float CMenuManager::fMapSize;
+float CMenuManager::fMapCenterY;
+float CMenuManager::fMapCenterX;
+#endif
+
+#endif
+
+
+CMenuManager::CMenuManager(void)
+{
+ int32 i;
+
+ SetSoundLevelsForMusicMenu();
+
+ m_pageState = PAGESTATE_NORMAL;
+ m_currentPage = PAGE_FIRST;
+ m_newPage = PAGE_FIRST;
+ m_bMenuActive = false;
+ m_bSaveMenuActive = false;
+ m_bRenderGameInMenu = false;
+ m_bTexturesLoaded = false;
+ m_nPageLeftTimer = 0;
+ m_nPageRightTimer = 0;
+ m_nChangePageTimer = 0;
+ field_18 = 0;
+ m_fade = 255;
+ m_someAlpha = 255;
+ m_position.x = 0.0f;
+ m_position.y = 0.0f;
+ m_nSlidingDir = SLIDE_TO_BOTTOM;
+ m_nStartPauseTimer = 0;
+ m_nEndPauseTimer = 0;
+ m_bInitialised = false;
+ m_bWantToUpdateContent = false;
+ field_3C = 0;
+ m_bInSaveZone = false;
+
+ for(i = 0; i < NUM_PAGES; i++){
+ BUTTONTAB_TEXT_X_SCALES[i] = 1.0f;
+ PANEL_TEXT_X_SCALES[i] = 1.0f;
+ }
+
+#ifdef GTA_PC
+ TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
+ CMBlur::BlurOn = m_PrefsShowTrails;
+#endif
+}
+
+void
+CMenuManager::LoadAllTextures(void)
+{
+ int32 i;
+
+ if(m_bTexturesLoaded)
+ return;
+
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
+ DMAudio.Service();
+ DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ CSprite2d *splash = LoadSplash(nil);
+ if(splash)
+ splash->Draw(CRect(0.0f, 0.0f, SCRW, SCRH), BACKGROUND_SPLASH_COLOR);
+ else // doesn't exist!!
+ CHud::Sprites[19].Draw(CRect(0.0f, 0.0f, SCRW, SCRH), BACKGROUND_SPLASH_COLOR);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERMIPNEAREST);
+ DoRWStuffEndOfFrame();
+
+ CFileMgr::SetDir("");
+ CFileMgr::SetDir("");
+
+ CTimer::Stop();
+ CStreaming::MakeSpaceFor(60*1024);
+ CStreaming::ImGonnaUseStreamingMemory();
+ CGame::TidyUpMemory(false, true);
+ int32 slot = CTxdStore::FindTxdSlot("frontend");
+ if(slot == -1)
+ slot = CTxdStore::AddTxdSlot("frontend");
+ printf("LOAD frontend\n");
+ CTxdStore::LoadTxd(slot, "MODELS/FRONTEND.TXD");
+ CTxdStore::SetCurrentTxd(slot);
+ CStreaming::IHaveUsedStreamingMemory();
+ CTimer::Update();
+
+ for(i = 0; i < NUM_SPRIRES; i++)
+ {
+ m_sprites[i].SetTexture(FrontendFilenames[i][0], FrontendFilenames[i][1]);
+ m_sprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
+ }
+
+ m_bTexturesLoaded = true;
+}
+
+void
+CMenuManager::UnloadTextures(void)
+{
+ int32 slot;
+ int32 i;
+
+ if ( !m_bTexturesLoaded )
+ return;
+
+ slot = CTxdStore::FindTxdSlot("frontend");
+#ifdef FIX_BUGS
+ for(i = 0; i < NUM_SPRIRES; i++)
+ m_sprites[i].Delete();
+#endif
+
+ printf("REMOVE frontend\n");
+ CTxdStore::RemoveTxd(slot);
+ m_bTexturesLoaded = false;
+}
+
+void
+CMenuManager::InitialiseMenusOnce(void)
+{
+ if(m_bInitialised)
+ return;
+ m_bInitialised = true;
+
+ InitialiseChangedLanguageSettings();
+
+ // Normal menu
+ MenuPage_Stats.Initialise();
+ MenuPage_Briefs.Initialise();
+ MenuPage_SaveBasic.Initialise();
+ MenuPage_SaveNewGame.Initialise();
+ MenuPage_SaveLoadGame.Initialise();
+ MenuPage_SaveDeleteGame.Initialise();
+ MenuPage_Controls.Initialise();
+ MenuPage_Audio.Initialise();
+ MenuPage_Display.Initialise();
+ MenuPage_Language.Initialise();
+
+ // Save menu
+ MenuPageSaveZone_SaveGame.Initialise();
+ MenuPageSaveZone_SaveSlots.Initialise();
+ MenuPageSaveZone_SavedSuccessfully.Initialise();
+ MenuPageSaveZone_Message.Initialise();
+ MenuPageSaveZone_QuestionYesNo.Initialise();
+ MenuPageSaveZone_FormatCard.Initialise();
+ MenuPageSaveZone_ErrorFormat.Initialise();
+
+ /* Stats */
+
+ MenuStats_1.ResetNumberOfTextLines();
+ MenuStats_1.SetPosition(X(75.0f), Y(70.0f));
+ MenuStats_1.m_width = X(480.0f);
+ MenuStats_1.m_height = Y(274.0f);
+ MenuStats_1.field_10E8 = 0; // unknown
+ MenuStats_1.m_lineSpacing = Y(20.0f);
+ MenuStats_1.m_scrollSpeed = 1.0f;
+ MenuStats_1.SetLinesColor(SCROLL_TEXT_COLOR);
+ MenuStats_1.ResetNumberOfTextLines();
+ MenuPage_Stats.AddMenu(&MenuStats_1);
+ MenuStats_2.SetPosition(X(75.0f), Y(50.0f));
+ MenuStats_2.SetTextsColor(CRIM_RATING_TEXT_COLOR);
+ MenuPage_Stats.AddMenu(&MenuStats_2);
+ MenuPage_Stats.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_Stats.ActivatePage();
+
+
+ CVector2D saveGameTextScale(X(0.49f), Y(0.7f));
+ CVector2D defaultTextScale(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+
+ /* Basic Load/Delete/New Game */
+
+ MenuSaveB_1.m_numOptions = 0;
+ MenuSaveB_1.SetPosition(X(220.0f), Y(110.0f));
+ MenuSaveB_1.AddOption(TheText.Get("FES_LGA"), 0.0f, Y(20.0f), TriggerSave_LoadGameSelect, false, true);
+ MenuSaveB_1.AddOption(TheText.Get("FES_DGA"), 0.0f, Y(40.0f), TriggerSave_DeleteGameSelect, false, true);
+ MenuSaveB_1.AddOption(TheText.Get("FES_NGA"), 0.0f, Y(60.0f), TriggerSave_NewGameSelectYes, false, true);
+ MenuSaveB_1.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuPage_SaveBasic.AddMenu(&MenuSaveB_1);
+ MenuPage_SaveBasic.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_SaveBasic.ActivatePage();
+
+ /* New Game - but unused */
+
+ MenuSaveNG_1.m_numTexts = 0;
+ MenuSaveNG_1.SetPosition(X(220.0f), Y(110.0f));
+ MenuSaveNG_1.AddText(TheText.Get("FES_LGA"), 0.0f, Y(20.0f), TEXT_COLOR, true);
+ MenuSaveNG_1.AddText(TheText.Get("FES_DGA"), 0.0f, Y(40.0f), TEXT_COLOR, true);
+ MenuSaveNG_1.AddText(TheText.Get("FES_NGA"), 0.0f, Y(60.0f), SELECTED_TEXT_COLOR, true);
+ MenuPage_SaveNewGame.AddMenu(&MenuSaveNG_1);
+ MenuSaveNG_2.m_numOptions = 0;
+ MenuSaveNG_2.SetPosition(X(250.0f), Y(170.0f));
+ MenuSaveNG_2.AddOption(TheText.Get("FEM_NO"), 0.0f, 0.0f, TriggerSave_BackToMainMenu, false, false);
+ MenuSaveNG_2.AddOption(TheText.Get("FEM_YES"), 0.0f, Y(20.0f), TriggerSave_NewGameSelectYes, false, false);
+ MenuSaveNG_2.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveNG_2.m_defaultCancel = TriggerSave_BackToMainMenu;
+ MenuPage_SaveNewGame.AddMenu(&MenuSaveNG_2);
+ MenuPage_SaveNewGame.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_SaveNewGame.ActivatePage();
+
+ /* Load Game */
+
+ MenuSaveLG_1.m_numTexts = 0;
+ MenuSaveLG_1.SetPosition(X(220.0f), Y(110.0f));
+ MenuSaveLG_1.AddText(TheText.Get("FES_LGA"), 0.0f, Y(20.0f), SELECTED_TEXT_COLOR, true);
+ MenuSaveLG_1.AddText(TheText.Get("FES_DGA"), 0.0f, Y(40.0f), TEXT_COLOR, true);
+ MenuSaveLG_1.AddText(TheText.Get("FES_NGA"), 0.0f, Y(60.0f), TEXT_COLOR, true);
+ MenuPage_SaveLoadGame.AddMenu(&MenuSaveLG_1);
+ MenuSaveLG_2.m_numOptions = 0;
+ MenuSaveLG_2.SetPosition(X(250.0f), Y(60.0f));
+ MenuSaveLG_2.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveLG_2.m_defaultCancel = TriggerSave_BackToMainMenuTwoLines;
+ MenuSaveLG_2.SetNewOldTextScale(true, saveGameTextScale, defaultTextScale, false);
+ MenuPage_SaveLoadGame.AddMenu(&MenuSaveLG_2);
+ MenuPage_SaveLoadGame.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_SaveLoadGame.ActivatePage();
+
+ /* Delete Game */
+
+ MenuSaveDG_1.m_numTexts = 0;
+ MenuSaveDG_1.SetPosition(X(220.0f), Y(110.0f));
+ MenuSaveDG_1.AddText(TheText.Get("FES_LGA"), 0.0f, Y(20.0f), TEXT_COLOR, true);
+ MenuSaveDG_1.AddText(TheText.Get("FES_DGA"), 0.0f, Y(40.0f), SELECTED_TEXT_COLOR, true);
+ MenuSaveDG_1.AddText(TheText.Get("FES_NGA"), 0.0f, Y(60.0f), TEXT_COLOR, true);
+ MenuPage_SaveDeleteGame.AddMenu(&MenuSaveDG_1);
+ MenuSaveDG_2.m_numOptions = 0;
+ MenuSaveDG_2.SetPosition(X(250.0f), Y(60.0f));
+ MenuSaveDG_2.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveDG_2.m_defaultCancel = TriggerSave_BackToMainMenuTwoLines;
+ MenuSaveDG_2.SetNewOldTextScale(true, saveGameTextScale, defaultTextScale, false);
+ MenuPage_SaveDeleteGame.AddMenu(&MenuSaveDG_2);
+ MenuPage_SaveDeleteGame.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_SaveDeleteGame.ActivatePage();
+
+
+ CVector2D briefsTextScale(X(0.525f), Y(0.7f));
+ CVector2D defaultTextScale1(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+
+ /* Briefs */
+
+ MenuBriefs_1.m_numTexts = 0;
+ MenuBriefs_1.SetPosition(X(60.0f), Y(60.0f));
+ MenuBriefs_1.SetTextsColor(TEXT_COLOR);
+ MenuBriefs_1.SetNewOldTextScale(true, briefsTextScale, defaultTextScale1);
+ MenuBriefs_1.SetNewOldShadowWrapX(true, X(600.0f+SHADOW_VECTOR.x), X(600.0f));
+ MenuPage_Briefs.AddMenu(&MenuBriefs_1);
+ MenuPage_Briefs.AddMenu(&MenuBriefs_2);
+ MenuPage_Briefs.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_Briefs.ActivatePage();
+
+
+ CVector2D defaultTextScale2(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+ CVector2D defaultTextScale3(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+ CVector2D CONTR_DESCR_NEW_TEXTSCALE_scaled(X(CONTR_DESCR_NEW_TEXTSCALE.x), Y(CONTR_DESCR_NEW_TEXTSCALE.y));
+ CVector2D CONFIGS_NEW_TEXTSCALE_scaled(X(CONFIGS_NEW_TEXTSCALE.x), Y(CONFIGS_NEW_TEXTSCALE.y));
+
+ /* Controls */
+
+ MenuControls_3.m_numTexts = 0;
+ MenuControls_3.m_numSprites = 0;
+ MenuControls_3.SetPosition(X(170.0f), Y(88.0f));
+ MenuControls_3.AddPicture(&m_sprites[FE_CONTROLLER],
+ &m_sprites[FE_CONTROLLERSH],
+ 0.0f, 0.0f, X(235.2f), Y(175.2), CRGBA(255, 255, 255, 255));
+ MenuControls_3.AddPicture(&m_sprites[FE_ARROWS1],
+ 0.0f, 0.0f, X(235.2f), Y(175.2), CRGBA(255, 255, 255, 255));
+ MenuControls_3.SetNewOldTextScale(true, CONTR_DESCR_NEW_TEXTSCALE_scaled, defaultTextScale2);
+ InitialiseTextsInMenuControllerOnFoot(&MenuControls_3, CMenuManager::m_PrefsControllerConfig);
+ MenuControls_3.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuControls_3.SetNewOldShadowWrapX(true, X(600.0f+SHADOW_VECTOR.x), X(600.0f));
+ MenuPage_Controls.AddMenu(&MenuControls_3);
+
+ MenuControls_6.m_numTexts = 0;
+ MenuControls_6.m_numSprites = 0;
+ MenuControls_6.SetPosition(X(170.0f), Y(88.0f));
+ MenuControls_6.AddPicture(&m_sprites[FE_CONTROLLER],
+ &m_sprites[FE_CONTROLLERSH],
+ 0.0f, 0.0f, X(235.2f), Y(175.2), CRGBA(255, 255, 255, 255));
+ MenuControls_6.AddPicture(&m_sprites[FE_ARROWS3],
+ 0.0f, 0.0f, X(235.2f), Y(175.2), CRGBA(255, 255, 255, 255));
+ MenuControls_6.SetNewOldTextScale(true, CONTR_DESCR_NEW_TEXTSCALE_scaled, defaultTextScale2);
+ InitialiseTextsInMenuControllerOnFoot(&MenuControls_6, CMenuManager::CONFIG_2);
+ MenuControls_6.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuControls_6.SetNewOldShadowWrapX(true, X(600.0f+SHADOW_VECTOR.x), X(600.0f));
+
+ MenuControls_4.m_numTexts = 0;
+ MenuControls_4.m_numSprites = 0;
+ MenuControls_4.SetPosition(X(170.0f), Y(88.0f));
+ MenuControls_4.AddPicture(&m_sprites[FE_CONTROLLER],
+ &m_sprites[FE_CONTROLLERSH],
+ 0.0f, 0.0f, X(235.2f), Y(175.2), CRGBA(255, 255, 255, 255));
+ MenuControls_4.AddPicture(&m_sprites[FE_ARROWS2],
+ 0.0f, 0.0f, X(235.2f), Y(175.2), CRGBA(255, 255, 255, 255));
+ MenuControls_4.SetNewOldTextScale(true, CONTR_DESCR_NEW_TEXTSCALE_scaled, defaultTextScale2);
+ InitialiseTextsInMenuControllerInCar(&MenuControls_4, CMenuManager::m_PrefsControllerConfig);
+ MenuControls_4.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuControls_4.SetNewOldShadowWrapX(true, X(600.0f+SHADOW_VECTOR.x), X(600.0f));
+
+ MenuControls_7.m_numTexts = 0;
+ MenuControls_7.m_numSprites = 0;
+ MenuControls_7.SetPosition(X(170.0f), Y(88.0f));
+ MenuControls_7.AddPicture(&m_sprites[FE_CONTROLLER],
+ &m_sprites[FE_CONTROLLERSH],
+ 0.0f, 0.0f, X(235.2f), Y(175.2), CRGBA(255, 255, 255, 255));
+ MenuControls_7.AddPicture(&m_sprites[FE_ARROWS4],
+ 0.0f, 0.0f, X(235.2f), Y(175.2), CRGBA(255, 255, 255, 255));
+ MenuControls_7.SetNewOldTextScale(true, CONTR_DESCR_NEW_TEXTSCALE_scaled, defaultTextScale2);
+ InitialiseTextsInMenuControllerInCar(&MenuControls_7, CMenuManager::CONFIG_2);
+ MenuControls_7.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuControls_7.SetNewOldShadowWrapX(true, X(600.0f+SHADOW_VECTOR.x), X(600.0f));
+
+ MenuControls_1.m_numOptions = 0;
+ MenuControls_1.SetPosition(X(284.0f), Y(290.0f));
+ MenuControls_1.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, SELECTED_TEXT_COLOR);
+ MenuControls_1.SetNewOldTextScale(true, CONFIGS_NEW_TEXTSCALE_scaled, defaultTextScale3, false);
+ MenuControls_1.AddTitle(TheText.Get("FEC_CCF"), 0.0f, 0.0f, true);
+ MenuControls_1.AddOption(TheText.Get("FEC_CF1"), X(15.0f), Y(2.0f), TriggerControls_ContrConfig, false, false);
+ MenuControls_1.AddOption(TheText.Get("FEC_CF2"), X(85.0f), Y(2.0f), TriggerControls_ContrConfig, false, false);
+ MenuControls_1.AddOption(TheText.Get("FEC_CF3"), X(155.0f), Y(2.0f), TriggerControls_ContrConfig, false, false);
+ MenuControls_1.AddOption(TheText.Get("FEC_CF4"), X(225.0f), Y(2.0f), TriggerControls_ContrConfig, false, false);
+ MenuPage_Controls.AddMenu(&MenuControls_1);
+ MenuControls_1.m_alwaysTrigger = (CMenuMultiChoiceTriggered::Trigger)TriggerControls_DrawContrConfig;
+ MenuControls_1.m_alwaysHighlightTrigger = (CMenuMultiChoiceTriggered::Trigger)TriggerControls_DrawHNContrConfig;
+ MenuControls_1.m_alwaysNormalTrigger = (CMenuMultiChoiceTriggered::Trigger)TriggerControls_DrawHNContrConfig;
+
+ MenuControls_2.m_numOptions = 0;
+ MenuControls_2.SetPosition(X(284.0f), Y(310.0f));
+ MenuControls_2.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, SELECTED_TEXT_COLOR);
+ MenuControls_2.SetNewOldTextScale(true, CONFIGS_NEW_TEXTSCALE_scaled, defaultTextScale3, false);
+ MenuControls_2.AddTitle(TheText.Get("FEC_CDP"), 0.0f, 0.0f, true);
+ MenuControls_2.AddOption(TheText.Get("FEC_ONF"), X(15.0f), Y(2.0f), (CMenuMultiChoiceTriggered::Trigger)TriggerControls_ContrDisplay, false, false);
+ MenuControls_2.AddOption(TheText.Get("FEC_INC"), X(105.0f), Y(2.0f), (CMenuMultiChoiceTriggered::Trigger)TriggerControls_ContrDisplay, false, false);
+ MenuPage_Controls.AddMenu(&MenuControls_2);
+ MenuControls_2.m_bTwoState = true;
+ MenuControls_2.SetMenuSelection(0);
+
+ MenuControls_5.SetPosition(X(284.0f), Y(330.0f));
+ MenuControls_5.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR);
+ MenuControls_5.SetNewOldTextScale(true, CONFIGS_NEW_TEXTSCALE_scaled, defaultTextScale3, false);
+ MenuControls_5.AddTitle(TheText.Get("FEC_VIB"), false, 0.0f, 0.0f, true);
+ MenuControls_5.SetOptionPosition(X(15.0f), Y(2.0f), TriggerControls_Vibrations, false);
+ MenuPage_Controls.AddMenu(&MenuControls_5);
+ MenuPage_Controls.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_Controls.ActivatePage();
+
+
+ /* Audio */
+
+ CVector2D audioOutputScale(X(0.49f), Y(0.63f));
+ CVector2D defaultTextScale4(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+
+ FEC_MOVETAB movetab;
+ MenuAudio_1.SetPosition(X(70.0f), Y(80.0f));
+ MenuAudio_1.SetColors(TEXT_COLOR, TEXT_COLOR, SLIDER_LEFT_COLOR, SLIDER_RIGHT_COLOR);
+ MenuAudio_1.AddTitle(TheText.Get("FEA_MUS"), 0.0f, 0.0f);
+ MenuAudio_1.AddTickBox(X(15.0f), Y(20.0f), X(150.0f), Y(5.0f), Y(45.0f), TriggerAudio_MusicVolume, TriggerAudio_MusicVolumeAlways);
+ movetab.right = 1;
+ movetab.left = 2;
+ movetab.down = 3;
+ movetab.up = 3;
+ MenuPage_Audio.AddMenu(&MenuAudio_1, &movetab);
+
+ MenuAudio_4.m_numOptions = 0;
+ MenuAudio_4.SetPosition(X(280.0f), Y(80.0f));
+ MenuAudio_4.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, SELECTED_TEXT_COLOR);
+ MenuAudio_4.SetNewOldTextScale(true, audioOutputScale, defaultTextScale4, false);
+ MenuAudio_4.AddTitle(TheText.Get("FEA_OUT"), X(AUDIO_OUTPUT_POS.x), Y(AUDIO_OUTPUT_POS.y), false);
+ MenuAudio_4.AddOption(TheText.Get("FEA_ST"), X(-15.0f), Y(30.0f), TriggerAudio_StereoMono, false, false);
+ MenuAudio_4.AddOption(TheText.Get("FEA_MNO"), X(55.0f), Y(30.0f), TriggerAudio_StereoMono, false, false);
+ movetab.right = 2;
+ movetab.left = 0;
+ movetab.down = 3;
+ movetab.up = 3;
+ MenuPage_Audio.AddMenu(&MenuAudio_4, &movetab);
+ MenuAudio_4.m_bTwoState = true;
+
+ MenuAudio_2.SetPosition(X(410.0f), Y(80.0f));
+ MenuAudio_2.SetColors(TEXT_COLOR, TEXT_COLOR, SLIDER_LEFT_COLOR, SLIDER_RIGHT_COLOR);
+ MenuAudio_2.AddTitle(TheText.Get("FEA_SFX"), 0.0f, 0.0f);
+ MenuAudio_2.AddTickBox(X(5.0f), Y(20.0f), X(150.0f), Y(5.0f), Y(45.0f), TriggerAudio_SfxVolume, TriggerAudio_SfxVolumeAlways);
+ movetab.right = 0;
+ movetab.left = 1;
+ movetab.down = 3;
+ movetab.up = 3;
+ MenuPage_Audio.AddMenu(&MenuAudio_2, &movetab);
+
+ MenuAudio_3.m_numOptions = 0;
+ MenuAudio_3.SetPosition(X(50.0f), Y(170.0f));
+ MenuAudio_3.SetColors(TITLE_TEXT_COLOR, CRGBA(64, 64, 64, 255), CRGBA(250, 250, 250, 255));
+ MenuAudio_3.AddTitle(TheText.Get("FEA_RSS"), X(AUDIO_RSTATION_POS.x), Y(AUDIO_RSTATION_POS.y), false);
+ // first row
+ movetab.right = 1;
+ movetab.left = 4;
+ movetab.down = 5;
+ movetab.up = 5;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO1], &movetab, 0.0f, Y(18.0f),
+ CVector2D(X(96.0f), YF(72.0f)), TriggerAudio_RadioStation, false);
+ movetab.right = 2;
+ movetab.left = 0;
+ movetab.down = 6;
+ movetab.up = 6;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO2], &movetab, X(106.0f), Y(20.0f),
+ CVector2D(X(79.2f), YF(81.0f)), TriggerAudio_RadioStation, false);
+ movetab.right = 3;
+ movetab.left = 1;
+ movetab.down = 7;
+ movetab.up = 7;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO5], &movetab, X(210.0f), Y(20.0f),
+ CVector2D(X(86.4f), YF(72.0f)), TriggerAudio_RadioStation, false);
+ movetab.right = 4;
+ movetab.left = 2;
+ movetab.down = 8;
+ movetab.up = 8;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO7], &movetab, X(324.0f), Y(5.0f),
+ CVector2D(X(115.2f), YF(102.0f)), TriggerAudio_RadioStation, false);
+ movetab.right = 0;
+ movetab.left = 3;
+ movetab.down = 8;
+ movetab.up = 8;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO8], &movetab, X(446.0f), Y(5.0f),
+ CVector2D(X(102.96f), YF(101.4f)), TriggerAudio_RadioStation, false);
+ // second row
+ movetab.right = 6;
+ movetab.left = 8;
+ movetab.down = 0;
+ movetab.up = 0;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO3], &movetab, X(60.0f), Y(96.0f),
+ CVector2D(X(87.36f), YF(85.8f)), TriggerAudio_RadioStation, false);
+ movetab.right = 7;
+ movetab.left = 5;
+ movetab.down = 1;
+ movetab.up = 1;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO4], &movetab, X(130.0f), Y(72.0f),
+ CVector2D(X(129.6f), YF(129.0f)), TriggerAudio_RadioStation, false);
+ movetab.right = 8;
+ movetab.left = 6;
+ movetab.down = 2;
+ movetab.up = 2;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO6], &movetab, X(284.0f), Y(108.0f),
+ CVector2D(X(60.0f), YF(60.0f)), TriggerAudio_RadioStation, false);
+ movetab.right = 5;
+ movetab.left = 7;
+ movetab.down = 3;
+ movetab.up = 3;
+ MenuAudio_3.AddOption(&m_sprites[FE_RADIO9], &movetab, X(404.0f), Y(85.0f),
+ CVector2D(X(81.12f), YF(101.4f)), TriggerAudio_RadioStation, false);
+ movetab.right = 2;
+ movetab.left = 0;
+ movetab.down = 1;
+ movetab.up = 1;
+ MenuPage_Audio.AddMenu(&MenuAudio_3, &movetab);
+ MenuPage_Audio.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_Audio.ActivatePage();
+
+
+ /* Display */
+
+ MenuDisplay_1.SetPosition(X(240.0f), Y(140.0f));
+ MenuDisplay_1.SetColors(TEXT_COLOR, TEXT_COLOR, SLIDER_LEFT_COLOR, SLIDER_RIGHT_COLOR);
+ MenuDisplay_1.m_style = 0; // ticks
+ MenuDisplay_1.AddTitle(TheText.Get("FED_BRI"), X(DISPLAY_BRIGHTNESS_POS.x), Y(DISPLAY_BRIGHTNESS_POS.y));
+ MenuDisplay_1.AddTickBox(X(-30.0f), Y(20.0f), X(200.0f), Y(40.0f), Y(40.0f));
+ MenuPage_Display.AddMenu(&MenuDisplay_1);
+ MenuDisplay_2.SetPosition(X(290.0f), Y(240.0f));
+ MenuDisplay_2.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR);
+ MenuDisplay_2.AddTitle(TheText.Get("FED_TRA"), false, 0.0f, 0.0f, true);
+#ifdef GTA_PC
+ MenuDisplay_2.SetOptionPosition(X(40.0f), 0.0f, TriggerDisplay_Trails, false);
+#else
+ MenuDisplay_2.SetOptionPosition(X(40.0f), 0.0f, false);
+#endif
+ MenuDisplay_2.m_bTwoState = true;
+ MenuPage_Display.AddMenu(&MenuDisplay_2);
+ MenuDisplay_3.SetPosition(X(290.0f), Y(260.0f));
+ MenuDisplay_3.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR);
+ MenuDisplay_3.AddTitle(TheText.Get("FED_SUB"), false, 0.0f, 0.0f, true);
+ MenuDisplay_3.SetOptionPosition(X(40.0f), 0.0f, false);
+ MenuDisplay_3.m_bTwoState = true;
+ MenuPage_Display.AddMenu(&MenuDisplay_3);
+ MenuDisplay_4.SetPosition(X(290.0f), Y(280.0f));
+ MenuDisplay_4.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR);
+ MenuDisplay_4.AddTitle(TheText.Get("FED_WIS"), false, 0.0f, 0.0f, true);
+ MenuDisplay_4.SetOptionPosition(X(40.0f), 0.0f, false);
+ MenuDisplay_4.m_bTwoState = true;
+ MenuPage_Display.AddMenu(&MenuDisplay_4);
+ MenuPage_Display.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_Display.ActivatePage();
+
+
+ /* Language */
+ MenuLanguage_1.m_numOptions = 0;
+ MenuLanguage_1.SetPosition(X(288.0f), Y(160.0f));
+ MenuLanguage_1.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, SELECTED_TEXT_COLOR);
+ MenuLanguage_1.AddOption(TheText.Get("FEL_ENG"), 0.0f, 0.0f, TriggerLanguage_Language, false, false);
+ MenuLanguage_1.AddOption(TheText.Get("FEL_FRE"), 0.0f, Y(20.0f), TriggerLanguage_Language, false, false);
+ MenuLanguage_1.AddOption(TheText.Get("FEL_GER"), 0.0f, Y(40.0f), TriggerLanguage_Language, false, false);
+ MenuLanguage_1.AddOption(TheText.Get("FEL_ITA"), 0.0f, Y(60.0f), TriggerLanguage_Language, false, false);
+ MenuLanguage_1.AddOption(TheText.Get("FEL_SPA"), 0.0f, Y(80.0f), TriggerLanguage_Language, false, false);
+ MenuPage_Language.AddMenu(&MenuLanguage_1);
+ MenuPage_Language.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPage_Language.ActivatePage();
+
+
+ /*
+ * Save zone menu
+ */
+
+ CVector2D saveGameTextScale2(X(0.49f), Y(0.7f));
+ CVector2D defaultTextScale5(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+
+ /* Save game */
+
+ MenuSaveZoneSG_1.m_numOptions = 0;
+ MenuSaveZoneSG_1.SetPosition(X(200.0f), Y(100.0f));
+ MenuSaveZoneSG_1.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveZoneSG_1.AddOption(TheText.Get("FESZ_SA"), 0.0f, Y(20.0f), TriggerSaveZone_SaveGameSelect, false, false);
+ MenuSaveZoneSG_1.AddOption(TheText.Get("FESZ_CA"), 0.0f, Y(40.0f), TriggerSaveZone_QuitMenu, false, false);
+ MenuSaveZoneSG_1.m_defaultCancel = TriggerSaveZone_QuitMenu;
+ MenuPageSaveZone_SaveGame.AddMenu(&MenuSaveZoneSG_1);
+ MenuSaveZoneSG_1.SetMenuSelection(1);
+ MenuPageSaveZone_SaveGame.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPageSaveZone_SaveGame.ActivatePage();
+
+ /* Select slot */
+
+ MenuSaveZoneSSL_1.m_numOptions = 0;
+ MenuSaveZoneSSL_1.SetPosition(X(160.0f), Y(100.0f));
+ MenuSaveZoneSSL_1.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveZoneSSL_1.AddOption(TheText.Get("FESZ_CA"), 0.0f, 0.0f, TriggerSaveZone_BackToMainMenuTwoLines, false, false);
+ MenuSaveZoneSSL_1.SetNewOldTextScale(true, saveGameTextScale2, defaultTextScale5, true);
+ MenuPageSaveZone_SaveSlots.AddMenu(&MenuSaveZoneSSL_1);
+ MenuSaveZoneSSL_1.SetMenuSelection(0);
+ MenuPageSaveZone_SaveSlots.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPageSaveZone_SaveSlots.ActivatePage();
+
+ /* Save successful */
+
+ MenuSaveZoneSS_1.m_numTexts = 0;
+ MenuSaveZoneSS_1.SetPosition(X(200.0f), Y(100.0f));
+ MenuSaveZoneSS_1.AddText(TheText.Get("FESZ_L1"), X(-40.0f), 0.0f, TITLE_TEXT_COLOR, false);
+ MenuSaveZoneSS_1.AddText(TheText.Get("FESZ_L2"), X(-40.0f), Y(20.0f), TITLE_TEXT_COLOR, false);
+ // twice this line?
+ MenuSaveZoneSS_1.AddText(TheText.Get("FESZ_L2"), X(-40.0f), Y(40.0f), TEXT_COLOR, false);
+ MenuPageSaveZone_SavedSuccessfully.AddMenu(&MenuSaveZoneSS_1);
+ MenuSaveZoneSS_2.m_numOptions = 0;
+ MenuSaveZoneSS_2.SetPosition(X(200.0f), Y(170.0f));
+ MenuSaveZoneSS_2.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveZoneSS_2.AddOption(TheText.Get("FESZ_QU"), X(60.0f), 0.0f, TriggerSaveZone_QuitMenu, false, false);
+ MenuPageSaveZone_SavedSuccessfully.AddMenu(&MenuSaveZoneSS_2);
+ MenuPageSaveZone_SavedSuccessfully.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPageSaveZone_SavedSuccessfully.ActivatePage();
+
+
+ MenuSaveZoneMSG_1.m_numTexts = 0;
+ MenuSaveZoneMSG_1.SetPosition(X(170.0f), Y(130.0f));
+ MenuSaveZoneMSG_1.AddText(TheText.Get("FESZ_SR"), X(-40.0f), 0.0f, TEXT_COLOR, false);
+ MenuSaveZoneMSG_1.SetTextsColor(TEXT_COLOR);
+ MenuSaveZoneMSG_1.SetNewOldShadowWrapX(true, X(600.0f+SHADOW_VECTOR.x-20.0f), X(580.0f));
+ MenuPageSaveZone_Message.AddMenu(&MenuSaveZoneMSG_1);
+ MenuSaveZoneMSG_2.m_numOptions = 0;
+ MenuSaveZoneMSG_2.SetPosition(X(170.0f), Y(180.0f));
+ MenuSaveZoneMSG_2.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveZoneMSG_2.AddOption(TheText.Get("FESZ_OK"), X(40.0f), 0.0f, TriggerSaveZone_QuitMenu, false, false);
+ MenuPageSaveZone_Message.AddMenu(&MenuSaveZoneMSG_2);
+ MenuPageSaveZone_Message.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPageSaveZone_Message.ActivatePage();
+
+
+ MenuSaveZoneQYN_1.m_numTexts = 0;
+ MenuSaveZoneQYN_1.SetPosition(X(170.0f), Y(130.0f));
+ MenuSaveZoneQYN_1.AddText(TheText.Get("FESZ_SR"), X(-40.0f), 0.0f, TEXT_COLOR, false);
+ MenuSaveZoneQYN_1.SetTextsColor(TEXT_COLOR);
+ MenuSaveZoneQYN_1.SetNewOldShadowWrapX(true, X(600.0f+SHADOW_VECTOR.x-20.0f), X(580.0f));
+ MenuPageSaveZone_QuestionYesNo.AddMenu(&MenuSaveZoneQYN_1);
+ MenuSaveZoneQYN_2.m_numOptions = 0;
+ MenuSaveZoneQYN_2.SetPosition(X(170.0f), Y(180.0f));
+ MenuSaveZoneQYN_2.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_YES"), X(80.0f), 0.0f, TriggerSaveZone_QuitMenu, false, false);
+ MenuSaveZoneQYN_2.AddOption(TheText.Get("FEM_NO"), X(80.0f), Y(20.0f), TriggerSaveZone_QuitMenu, false, false);
+ MenuPageSaveZone_QuestionYesNo.AddMenu(&MenuSaveZoneQYN_2);
+ MenuPageSaveZone_QuestionYesNo.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPageSaveZone_QuestionYesNo.ActivatePage();
+
+ /* Format card */
+
+ MenuSaveZoneFC_1.m_numOptions = 0;
+ MenuSaveZoneFC_1.SetPosition(X(200.0f), Y(100.0f));
+ MenuSaveZoneFC_1.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveZoneFC_1.AddTitle(TheText.Get("FESZ_FM"), X(-100.0f), 0.0f, false);
+ MenuSaveZoneFC_1.AddOption(TheText.Get("FEM_NO"), X(40.0f), Y(95.0f), TriggerSaveZone_BackToMainMenu, false, false);
+ MenuSaveZoneFC_1.AddOption(TheText.Get("FEM_YES"), X(40.0f), Y(75.0f), TriggerSaveZone_FormatCardSelect, false, false);
+ MenuSaveZoneFC_1.m_defaultCancel = TriggerSaveZone_FormatCardSelect;
+ MenuPageSaveZone_FormatCard.AddMenu(&MenuSaveZoneFC_1);
+ MenuPageSaveZone_FormatCard.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPageSaveZone_FormatCard.ActivatePage();
+
+ /* Format error */
+
+ MenuSaveZoneEF_1.m_numOptions = 0;
+ MenuSaveZoneEF_1.SetPosition(X(200.0f), Y(100.0f));
+ MenuSaveZoneEF_1.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ MenuSaveZoneEF_1.AddTitle(TheText.Get("FESZ_FF"), X(-40.0f), 0.0f, false);
+ MenuSaveZoneEF_1.AddOption(TheText.Get("FESZ_OK"), X(70.0f), Y(20.0f), TriggerSaveZone_FormatFailedOK, false, false);
+ MenuPageSaveZone_ErrorFormat.AddMenu(&MenuSaveZoneEF_1);
+ MenuPageSaveZone_ErrorFormat.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ MenuPageSaveZone_ErrorFormat.ActivatePage();
+
+ pActiveMenuPage = &MenuPage_Stats;
+ pActiveMenuPage->ActivatePage();
+
+ InitialiseMenuContents();
+
+ m_bWantToUpdateContent = false;
+}
+
+void
+CMenuManager::InitialiseChangedLanguageSettings(void)
+{
+ if ( bFrontEnd_ReloadObrTxtGxt )
+ {
+ bFrontEnd_ReloadObrTxtGxt = false;
+
+ CTimer::Stop();
+ TheText.Unload();
+ TheText.Load();
+ CTimer::Update();
+
+ FrontEndMenuManager.AnaliseMenuContents();
+ CGame::frenchGame = false;
+ CGame::germanGame = false;
+ if ( m_PrefsAllowNastyGame )
+ CGame::nastyGame = true;
+
+ for ( int32 i = 0; i < NUM_PAGES; i++ )
+ {
+ BUTTONTAB_TEXT_X_SCALES[i] = 1.0f;
+ PANEL_TEXT_X_SCALES[i] = 1.0f;
+ }
+
+ switch ( m_PrefsLanguage )
+ {
+ case LANGUAGE_AMERICAN:
+ {
+ MENU_TEXT_SIZE_X = 0.644f;
+ MENU_TEXT_SIZE_Y = 0.84f;//0.96f;
+
+ BUTTONTAB_TEXT_SIZE_X = 0.35f;
+ BUTTONTAB_TEXT_SIZE_Y = 0.7f;//0.8f;
+
+ BUTTONTAB_TEXT_X_SCALES[6] = 0.94f;
+
+ CONTR_DESCR_NEW_TEXTSCALE.x = 0.4564f;
+ CONTR_DESCR_NEW_TEXTSCALE.y = 0.63f;//0.72f;
+
+ CONFIGS_NEW_TEXTSCALE.x = 0.49f;
+ CONFIGS_NEW_TEXTSCALE.y = 0.7f;//0.8f;
+
+ AUDIO_OUTPUT_POS.x = 0.0f;
+ AUDIO_OUTPUT_POS.y = 0.0f;
+
+ AUDIO_RSTATION_POS.x = 154.0f;
+ AUDIO_RSTATION_POS.y = 0.0f;
+
+ DISPLAY_BRIGHTNESS_POS.x = 0.0f;
+ DISPLAY_BRIGHTNESS_POS.y = 0.0f;
+
+ MEMCARD_ACCESS_MSG_SIZE_X = 0.84f;
+ MEMCARD_ACCESS_MSG_SIZE_Y = 1.12f;//1.28f;
+
+ break;
+ }
+
+ case LANGUAGE_FRENCH:
+ {
+ CGame::frenchGame = true;
+ if ( m_PrefsAllowNastyGame )
+ CGame::nastyGame = false;
+
+ MENU_TEXT_SIZE_X = 0.504f;
+ MENU_TEXT_SIZE_Y = 0.84f;//0.96f;
+
+ BUTTONTAB_TEXT_SIZE_X = 0.32f;
+ BUTTONTAB_TEXT_SIZE_Y = 0.7f;//0.8f;
+
+ BUTTONTAB_TEXT_X_SCALES[0] = 0.84f;
+ BUTTONTAB_TEXT_X_SCALES[3] = 0.84f;
+ PANEL_TEXT_X_SCALES[1] = 0.8f;
+
+ CONTR_DESCR_NEW_TEXTSCALE.x = 0.385f;
+ CONTR_DESCR_NEW_TEXTSCALE.y = 0.63f;//0.72f;
+
+ CONFIGS_NEW_TEXTSCALE.x = 0.455f;
+ CONFIGS_NEW_TEXTSCALE.y = 0.7f;//0.8f;
+
+ AUDIO_OUTPUT_POS.x = -15.0f;
+ AUDIO_OUTPUT_POS.y = 0.0f;
+
+ AUDIO_RSTATION_POS.x = 184.0f;
+ AUDIO_RSTATION_POS.y = 0.0f;
+
+ DISPLAY_BRIGHTNESS_POS.x = 20.0f;
+ DISPLAY_BRIGHTNESS_POS.y = 0.0f;
+
+ MEMCARD_ACCESS_MSG_SIZE_X = 0.84f;
+ MEMCARD_ACCESS_MSG_SIZE_Y = 1.12f;//1.28f;
+
+ break;
+ }
+
+ case LANGUAGE_GERMAN:
+ {
+ CGame::germanGame = true;
+ if ( m_PrefsAllowNastyGame )
+ CGame::nastyGame = false;
+
+ MENU_TEXT_SIZE_X = 0.546f;
+ MENU_TEXT_SIZE_Y = 0.84f;//0.96f;
+
+ BUTTONTAB_TEXT_SIZE_X = 0.32f;
+ BUTTONTAB_TEXT_SIZE_Y = 0.7f;//0.8f;
+
+ CONTR_DESCR_NEW_TEXTSCALE.x = 0.35f;
+ CONTR_DESCR_NEW_TEXTSCALE.y = 0.63f;//0.72f;
+
+ CONFIGS_NEW_TEXTSCALE.x = 0.434f;
+ CONFIGS_NEW_TEXTSCALE.y = 0.7f;//0.8f;
+
+ AUDIO_OUTPUT_POS.x = -15.0f;
+ AUDIO_OUTPUT_POS.y = 0.0f;
+
+ AUDIO_RSTATION_POS.x = 154.0f;
+ AUDIO_RSTATION_POS.y = 0.0f;
+
+ DISPLAY_BRIGHTNESS_POS.x = 20.0f;
+ DISPLAY_BRIGHTNESS_POS.y = 0.0f;
+
+ MEMCARD_ACCESS_MSG_SIZE_X = 0.7f;
+ MEMCARD_ACCESS_MSG_SIZE_Y = 1.12f;//1.28f;
+
+ break;
+ }
+
+ case LANGUAGE_ITALIAN:
+ {
+ MENU_TEXT_SIZE_X = 0.574f;
+ MENU_TEXT_SIZE_Y = 0.84f;//0.96f;
+
+ BUTTONTAB_TEXT_SIZE_X = 0.32f;
+ BUTTONTAB_TEXT_SIZE_Y = 0.7f;//0.8f;
+
+ BUTTONTAB_TEXT_X_SCALES[0] = 0.86f;
+ PANEL_TEXT_X_SCALES[1] = 0.9f;
+
+ CONTR_DESCR_NEW_TEXTSCALE.x = 0.385f;
+ CONTR_DESCR_NEW_TEXTSCALE.y = 0.63f;//0.72f;
+
+ CONFIGS_NEW_TEXTSCALE.x = 0.42f;
+ CONFIGS_NEW_TEXTSCALE.y = 0.7f;//0.8f;
+
+ AUDIO_OUTPUT_POS.x = 10.0f;
+ AUDIO_OUTPUT_POS.y = 0.0f;
+
+ AUDIO_RSTATION_POS.x = 194.0f;
+ AUDIO_RSTATION_POS.y = 0.0f;
+
+ DISPLAY_BRIGHTNESS_POS.x = 10.0f;
+ DISPLAY_BRIGHTNESS_POS.y = 0.0f;
+
+ MEMCARD_ACCESS_MSG_SIZE_X = 0.84f;
+ MEMCARD_ACCESS_MSG_SIZE_Y = 1.12f;//1.28f;
+
+ break;
+ }
+
+ case LANGUAGE_SPANISH:
+ {
+ MENU_TEXT_SIZE_X = 0.546f;
+ MENU_TEXT_SIZE_Y = 0.84f;//0.96f;
+
+ BUTTONTAB_TEXT_SIZE_X = 0.35f;
+ BUTTONTAB_TEXT_SIZE_Y = 0.7f;//0.8f;
+
+ BUTTONTAB_TEXT_X_SCALES[0] = 0.78f;
+ PANEL_TEXT_X_SCALES[1] = 0.95f;
+
+ CONTR_DESCR_NEW_TEXTSCALE.x = 0.364f;
+ CONTR_DESCR_NEW_TEXTSCALE.y = 0.63f;//0.72f;
+
+ CONFIGS_NEW_TEXTSCALE.x = 0.455f;
+ CONFIGS_NEW_TEXTSCALE.y = 0.7f;//0.8f;
+
+ AUDIO_OUTPUT_POS.x = 10.0f;
+ AUDIO_OUTPUT_POS.y = 0.0f;
+
+ AUDIO_RSTATION_POS.x = 124.0f;
+ AUDIO_RSTATION_POS.y = 0.0f;
+
+ DISPLAY_BRIGHTNESS_POS.x = 30.0f;
+ DISPLAY_BRIGHTNESS_POS.y = 0.0f;
+
+ MEMCARD_ACCESS_MSG_SIZE_X = 0.84f;
+ MEMCARD_ACCESS_MSG_SIZE_Y = 1.12f;//1.28f;
+
+ break;
+ }
+ }
+ }
+}
+
+void
+CMenuManager::InitialiseMenuContents(void)
+{
+ if ( m_bWantToUpdateContent == false )
+ {
+ m_bWantToUpdateContent = true;
+
+ m_pageState = PAGESTATE_NORMAL;
+
+ switch ( CPad::GetPad(0)->GetMode() )
+ {
+ case 3: m_PrefsControllerConfig = CONFIG_4; break;
+ case 2: m_PrefsControllerConfig = CONFIG_3; break;
+ case 1: m_PrefsControllerConfig = CONFIG_2; break;
+ case 0: m_PrefsControllerConfig = CONFIG_1; break;
+ }
+
+ MenuControls_1.SetMenuSelection(m_PrefsControllerConfig);
+ MenuControls_5.SetMenuSelection(m_PrefsUseVibration);
+
+ MenuAudio_1.SetMenuSelection(m_PrefsMusicVolume / 127.0f * 100.0f + 0.5f);
+ MenuAudio_2.SetMenuSelection(m_PrefsSfxVolume / 127.0f * 100.0f + 0.5f);
+ MenuAudio_3.SetMenuSelection(m_PrefsRadioStation);
+ MenuAudio_4.SetMenuSelection(m_PrefsStereoMono);
+
+ MenuDisplay_1.SetMenuSelection(m_PrefsBrightness / 512.0f * 100.0f + 0.5f);
+#ifdef PS2
+ m_PrefsShowTrails = BlurOn;
+#else
+ m_PrefsShowTrails = CMBlur::BlurOn;
+#endif
+ MenuDisplay_2.SetMenuSelection(m_PrefsShowTrails);
+ MenuDisplay_3.SetMenuSelection(m_PrefsShowSubtitles);
+ MenuDisplay_4.SetMenuSelection(m_PrefsUseWideScreen);
+
+ MenuLanguage_1.SetMenuSelection(m_PrefsLanguage);
+
+ FillMenuWithMemCardFileListing(&MenuSaveLG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_LoadGameLoadGameSelect, nil, 0, 34, 22);
+ FillMenuWithMemCardFileListing(&MenuSaveDG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_DeleteGameDeleteGameSelect, nil, 0, 34, 22);
+
+ MenuBriefs_1.m_numTexts = 0;
+ MenuBriefs_1.AddText(TheText.Get("FEB_PMB"), 0.0f, 0.0f, TITLE_TEXT_COLOR, 0); // Previous Mission Briefs:
+
+ static wchar StringsToDisplay[NUMPREVIOUSBRIEFS][256];
+
+ CRGBA newColor;
+ int32 brierY = 36;
+
+ for ( int32 i = NUMPREVIOUSBRIEFS-1; 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], StringsToDisplay[i]);
+ CMessages::InsertStringInString(StringsToDisplay[i], brief.m_pString);
+
+ newColor = TEXT_COLOR;
+ FilterOutColorMarkersFromString(StringsToDisplay[i], newColor);
+
+ if (newColor != TEXT_COLOR)
+ {
+ newColor.r /= 2;
+ newColor.g /= 2;
+ newColor.b /= 2;
+ }
+ MenuBriefs_1.AddText(StringsToDisplay[i], 0.0f, YF((float)brierY), newColor, 0);
+ brierY += 54;
+ }
+ }
+
+ MenuStats_1.m_scrollPosition = 0.0f;
+ MenuStats_1.ResetNumberOfTextLines();
+
+ nStatLinesIndex = 0;
+
+ #define STAT_HEADER(str) do { MenuStats_1.AddTextLine(TheText.Get(str), nil); } while(0)
+ #define STAT_PARAM(str) do { MenuStats_1.AddTextLine(nil, TheText.Get(str)); } while(0)
+ #define STAT_LINE(str, left, isFloat, right) do { MenuStats_1.AddTextLine(TheText.Get(str), PrintStatLine(str, left, isFloat, right)); } while(0)
+
+ int32 nTemp;
+
+ STAT_HEADER("PL_STAT");
+
+ int32 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, 0, nil);
+
+ STAT_LINE("NMISON", &CStats::MissionsGiven, 0, 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;
+ int32 nPackagesPercent = packagesPercent;
+ nTemp = 100;
+
+ STAT_LINE("PERPIC", &nPackagesPercent, 0, &nTemp);
+
+ STAT_LINE("NOUNIF", &CStats::NumberOfUniqueJumpsFound, 0, &CStats::TotalNumberOfUniqueJumps);
+
+ STAT_LINE("DAYSPS", &CStats::DaysPassed, 0, nil);
+
+ if ( CGame::nastyGame )
+ {
+ STAT_LINE("PE_WAST", &CStats::PeopleKilledByPlayer, 0, nil);
+ STAT_LINE("PE_WSOT", &CStats::PeopleKilledByOthers, 0, nil);
+ }
+
+ STAT_LINE("CAR_EXP", &CStats::CarsExploded, 0, nil);
+
+ STAT_LINE("TM_BUST", &CStats::TimesArrested, 0, nil);
+
+ STAT_LINE("TM_DED", &CStats::TimesDied, 0, nil);
+
+ 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];
+ STAT_LINE("GNG_WST", &nTemp, 0, nil);
+
+ nTemp = CStats::PedsKilledOfThisType[PEDTYPE_CRIMINAL];
+ STAT_LINE("DED_CRI", &nTemp, 0, nil);
+
+ STAT_LINE("HEL_DST", &CStats::HelisDestroyed, 0, nil);
+
+ STAT_LINE("KGS_EXP", &CStats::KgsOfExplosivesUsed, 0, nil);
+
+ nTemp = (CStats::InstantHitsFiredByPlayer == 0 ? 0 : CStats::InstantHitsHitByPlayer * 100.0f / CStats::InstantHitsFiredByPlayer);
+ STAT_LINE("ACCURA", &nTemp, 0, nil);
+
+ if (CStats::ElBurroTime > 0)
+ STAT_LINE("ELBURRO", &CStats::ElBurroTime, 0, nil);
+
+ if (CStats::Record4x4One > 0)
+ STAT_LINE("FEST_R1", &CStats::Record4x4One, 0, nil);
+
+ if (CStats::Record4x4Two > 0)
+ STAT_LINE("FEST_R2", &CStats::Record4x4Two, 0, nil);
+
+ if (CStats::Record4x4Three > 0)
+ STAT_LINE("FEST_R3", &CStats::Record4x4Three, 0, nil);
+
+ if (CStats::Record4x4Mayhem > 0)
+ STAT_LINE("FEST_RM", &CStats::Record4x4Mayhem, 0, nil);
+
+ if (CStats::LongestFlightInDodo > 0)
+ STAT_LINE("FEST_LF", &CStats::LongestFlightInDodo, 0, nil);
+
+ if (CStats::TimeTakenDefuseMission > 0)
+ STAT_LINE("FEST_BD", &CStats::TimeTakenDefuseMission, 0, nil);
+
+ STAT_LINE("CAR_CRU", &CStats::CarsCrushed, 0, nil);
+
+ if (CStats::HighestScores[0] > 0)
+ {
+ STAT_HEADER("FEST_BB");
+ STAT_LINE("FEST_H0", &CStats::HighestScores[0], 0, nil);
+ }
+
+ int32 hs = 0;
+ for ( int32 i = 1; i < 5; i++ )
+ hs += CStats::HighestScores[i];
+
+ if (hs > 0)
+ STAT_HEADER("FEST_GC");
+
+ if (CStats::HighestScores[1] > 0)
+ STAT_LINE("FEST_H1", &CStats::HighestScores[1], 0, nil);
+
+ if (CStats::HighestScores[2] > 0)
+ STAT_LINE("FEST_H2", &CStats::HighestScores[2], 0, nil);
+
+ if (CStats::HighestScores[3] > 0)
+ STAT_LINE("FEST_H3", &CStats::HighestScores[3], 0, nil);
+
+ if (CStats::HighestScores[4] > 0)
+ STAT_LINE("FEST_H4", &CStats::HighestScores[4], 0, nil);
+
+ STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, 0, nil);
+ STAT_LINE("FESTDCM", &CStats::DistanceTravelledInVehicle, 0, nil);
+ STAT_LINE("MMRAIN", &CStats::mmRain, 0, nil);
+ nTemp = (int32)CStats::MaximumJumpDistance;
+ STAT_LINE("MXCARDM", &nTemp, 0, nil);
+ nTemp = (int32)CStats::MaximumJumpHeight;
+ STAT_LINE("MXCARJM", &nTemp, 0, nil);
+
+ STAT_LINE("MXFLIP", &CStats::MaximumJumpFlips, 0, nil);
+ STAT_LINE("MXJUMP", &CStats::MaximumJumpSpins, 0, nil);
+
+ STAT_HEADER("BSTSTU");
+
+ switch (CStats::BestStuntJump)
+ {
+ case 1: STAT_PARAM("INSTUN"); break;
+ case 2: STAT_PARAM("PRINST"); break;
+ case 3: STAT_PARAM("DBINST"); break;
+ case 4: STAT_PARAM("DBPINS"); break;
+ case 5: STAT_PARAM("TRINST"); break;
+ case 6: STAT_PARAM("PRTRST"); break;
+ case 7: STAT_PARAM("QUINST"); break;
+ case 8: STAT_PARAM("PQUINS"); break;
+ default: STAT_PARAM("NOSTUC"); break;
+ }
+
+ STAT_LINE("PASDRO", &CStats::PassengersDroppedOffWithTaxi, 0, nil);
+ STAT_LINE("MONTAX", &CStats::MoneyMadeWithTaxi, 0, nil);
+ STAT_LINE("FEST_LS", &CStats::LivesSavedWithAmbulance, 0, nil);
+ STAT_LINE("FEST_HA", &CStats::HighestLevelAmbulanceMission, 0, nil);
+ STAT_LINE("FEST_CC", &CStats::CriminalsCaught, 0, nil);
+ STAT_LINE("FEST_FE", &CStats::FiresExtinguished, 0, nil);
+ int32 rnd = ((CGeneral::GetRandomNumber() & 255) + 100) * 2384;
+ STAT_LINE("DAYPLC", &rnd, 0, nil);
+
+ #undef STAT_LINE
+
+ MenuStats_2.m_numTexts = 0;
+ MenuStats_2.AddText(TheText.Get("CRIMRA"), 0.0f, 0.0f, CRIM_RATING_TEXT_COLOR, 0);
+
+ char rating[16];
+ wchar urating[16];
+ sprintf(rating, " %d", CStats::FindCriminalRatingNumber());
+ AsciiToUnicode(rating, urating);
+
+ wchar *pStatLine = aStatLines[nStatLinesIndex++];
+ UnicodeStrcpy(pStatLine, CStats::FindCriminalRatingString());
+ UnicodeStrcat(pStatLine, urating);
+
+ MenuStats_2.AddText(pStatLine, X(MenuStats_1.m_width), 0.0f, CRIM_RATING_TEXT_COLOR, 1);
+
+ MenuSaveZoneSG_1.SetMenuSelection(1);
+ MenuSaveZoneFC_1.SetMenuSelection(1);
+ }
+}
+
+
+void
+CMenuManager::AnaliseMenuContents(void)
+{
+ if ( m_bWantToUpdateContent )
+ {
+ m_bWantToUpdateContent = false;
+
+ m_PrefsControllerConfig = (CONTRCONFIG)MenuControls_1.GetMenuSelection();
+ switch ( m_PrefsControllerConfig )
+ {
+ case CONFIG_4: CPad::GetPad(0)->SetMode(3); break;
+ case CONFIG_3: CPad::GetPad(0)->SetMode(2); break;
+ case CONFIG_2: CPad::GetPad(0)->SetMode(1); break;
+ case CONFIG_1: CPad::GetPad(0)->SetMode(0); break;
+ }
+
+ m_PrefsUseVibration = MenuControls_5.m_title.m_bSelected;
+
+ m_PrefsMusicVolume = float(MenuAudio_1.GetMenuSelection())/100.0f*127.0f+0.5f;
+ m_PrefsSfxVolume = float(MenuAudio_2.GetMenuSelection())/100.0f*127.0f+0.5f;
+ m_PrefsRadioStation = MenuAudio_3.GetMenuSelection();
+ m_PrefsStereoMono = MenuAudio_4.GetMenuSelection();
+ m_PrefsBrightness = float(MenuDisplay_1.GetMenuSelection()) / 100.0f*512.0f + 0.5f;
+ m_PrefsShowTrails = MenuDisplay_2.GetMenuSelection();
+ m_PrefsShowSubtitles = MenuDisplay_3.GetMenuSelection();
+ m_PrefsUseWideScreen = MenuDisplay_4.GetMenuSelection();
+#ifdef PS2
+ BlurOn = m_PrefsShowTrails;
+#else
+ CMBlur::BlurOn = m_PrefsShowTrails;
+#endif
+
+ if ( m_PrefsLanguage != MenuLanguage_1.GetMenuSelection() )
+ {
+ m_PrefsLanguage = MenuLanguage_1.GetMenuSelection();
+ m_bInitialised = false;
+ bFrontEnd_ReloadObrTxtGxt = true;
+ }
+ }
+}
+
+void
+CMenuManager::InitialiseMenuContentsAfterLoadingGame(void)
+{
+ if ( MenuLanguage_1.GetMenuSelection() != m_PrefsLanguage )
+ {
+ m_bInitialised = false;
+ bFrontEnd_ReloadObrTxtGxt = true;
+ }
+}
+
+void
+CMenuManager::DrawFrontEnd(void)
+{
+ CFont::SetAlphaFade(255.0f);
+ if(m_bInSaveZone)
+ DrawFrontEndSaveZone();
+ else
+ DrawFrontEndNormal();
+
+ if ( MemCardAccessTriggerCaller.CanCall() )
+ MemCardAccessTriggerCaller.CallTrigger();
+
+ DisplayWarningControllerMsg();
+}
+
+void
+CMenuManager::DrawFrontEndNormal(void)
+{
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+
+ if ( bMemoryCardSpecialZone )
+ {
+ static uint8 counter = 0;
+
+ counter++;
+
+ if ( (counter & 63 ) == 0 )
+ {
+ FillMenuWithMemCardFileListing(&MenuSaveLG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_LoadGameLoadGameSelect, nil, 0, 34, 22);
+ FillMenuWithMemCardFileListing(&MenuSaveDG_2, TriggerSave_BackToMainMenuTwoLines, TriggerSave_DeleteGameDeleteGameSelect, nil, 0, 34, 22);
+ }
+ }
+
+ m_fade = 255;
+ if ( m_nChangePageTimer != 0 && m_nChangePageTimer >= CTimer::GetTimeInMillisecondsPauseMode() )
+ m_fade = uint32(float(m_nChangePageTimer - CTimer::GetTimeInMillisecondsPauseMode()) / 250.0f * 255.0f);
+
+ m_someAlpha = 255;
+
+ m_position.x = 0.0f;
+ m_position.y = 0.0f;
+
+ if ( m_nStartPauseTimer != 0 && m_nStartPauseTimer >= CTimer::GetTimeInMillisecondsPauseMode() )
+ {
+ float slide = float(m_nStartPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) / 800.0f;
+ float alpha = 1.0f;
+
+ if ((m_nStartPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) <= 1600)
+ alpha = float(m_nStartPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) / 400.0f;
+
+ m_someAlpha = 255 - clamp(alpha, 0.0f, 1.0f) * 255.0f;
+
+ switch ( m_nSlidingDir )
+ {
+ case SLIDE_TO_RIGHT: m_position.x = slide * X(700.0f); break;
+ case SLIDE_TO_TOP: m_position.y = -(slide * Y(500.0f)); break;
+ case SLIDE_TO_LEFT: m_position.x = -(slide * X(700.0f)); break;
+ case SLIDE_TO_BOTTOM: m_position.y = slide * Y(500.0f); break;
+ default: m_position.y = slide * Y(500.0f); break;
+ }
+ }
+
+ if ( m_nEndPauseTimer != 0 && m_nEndPauseTimer >= CTimer::GetTimeInMillisecondsPauseMode() )
+ {
+ float slide = float(m_nEndPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) / 800.0f;
+ float alpha = float((int32)(m_nEndPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) + -266) / 533.0f;
+
+ m_someAlpha = clamp(alpha, 0.0f, 1.0f) * 255.0f;
+
+ switch ( m_nSlidingDir )
+ {
+ case SLIDE_TO_TOP: m_position.y = (1.0f - slide) * Y(500.0f); break;
+ case SLIDE_TO_RIGHT: m_position.x = (1.0f - slide) * X(700.0f); break;
+ case SLIDE_TO_LEFT: m_position.x = (1.0f - slide) * X(700.0f); break;
+ case SLIDE_TO_BOTTOM: m_position.y = -((1.0f - slide) * Y(500.0f)); break;
+ default: m_position.y = -((1.0f - slide) * Y(500.0f)); break;
+ }
+ }
+
+ if ( m_someAlpha < 255 )
+ m_fade = m_someAlpha;
+
+ float posX, posY;
+
+ /* Draw splash */
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ CSprite2d *splash = LoadSplash(nil);
+ if(splash)
+ splash->Draw(CRect(0.0f, 0.0f, SCRW, SCRH), BACKGROUND_SPLASH_COLOR);
+ else
+ // doesn't exist!!
+ CHud::Sprites[19].Draw(CRect(0.0f, 0.0f, SCRW, SCRH), BACKGROUND_SPLASH_COLOR);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERMIPNEAREST);
+
+ /* Draw main panel */
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
+ CRGBA panelColor(255, 255, 255, m_someAlpha);
+ m_sprites[FE2_MAINPANEL_UL].Draw(
+ CRect(m_position.x, m_position.y, m_position.x+SCRW/2.0f, m_position.y+SCRH/2.0f),
+ panelColor);
+ m_sprites[FE2_MAINPANEL_UR].Draw(
+ CRect(m_position.x+SCRW/2.0f, m_position.y, m_position.x+SCRW, m_position.y+SCRH/2.0f),
+ panelColor);
+ m_sprites[FE2_MAINPANEL_DL].Draw(
+ CRect(m_position.x, m_position.y+SCRH/2.0f, m_position.x+SCRW/2.0f, m_position.y+SCRH),
+ panelColor);
+ m_sprites[FE2_MAINPANEL_DR].Draw(
+ CRect(m_position.x+SCRW/2.0f, m_position.y+SCRH/2.0f, m_position.x+SCRW, m_position.y+SCRH),
+ panelColor);
+
+ /* Draw icon backdrop */
+ CRGBA iconColor(255, 255, 255, m_fade*0.75f);
+ float iconX = 48.0f;
+ float iconY = 54.0f;
+ float iconWidth = 540.0f;
+ float iconHeight = 296.0f;
+ int32 sprite = FE_ICONBRIEF;
+
+#ifdef PS2_MENU_USEALLPAGEICONS
+ switch(m_currentPage)
+ {
+ case PAGE_STATS:
+ sprite = FE_ICONSTATS;
+ break;
+ case PAGE_LOAD:
+ sprite = FE_ICONSAVE;
+ break;
+ case PAGE_CONTROLS:
+ sprite = FE_ICONCONTROLS;
+ break;
+ case PAGE_BRIEFS:
+ sprite = FE_ICONBRIEF;
+ break;
+ case PAGE_AUDIO:
+ sprite = FE_ICONAUDIO;
+ break;
+ case PAGE_DISPLAY:
+ sprite = FE_ICONDISPLAY;
+ break;
+ case PAGE_LANGUAGE:
+ sprite = FE_ICONLANGUAGE;
+ break;
+ }
+#else
+ switch(m_currentPage)
+ {
+ case PAGE_STATS:
+ case PAGE_LOAD:
+ case PAGE_CONTROLS:
+ sprite = FE_ICONSTATS; // PS2 has the same texture for stats and brief
+ //sprite = FE_ICONBRIEF;
+ break;
+ case PAGE_BRIEFS:
+ sprite = FE_ICONBRIEF;
+ break;
+ case PAGE_AUDIO:
+ sprite = FE_ICONAUDIO;
+ break;
+ case PAGE_DISPLAY:
+ sprite = FE_ICONDISPLAY;
+ break;
+ case PAGE_LANGUAGE:
+ sprite = FE_ICONLANGUAGE;
+ break;
+ }
+#endif
+ m_sprites[sprite].Draw(
+ CRect_SZ(m_position.x+X(iconX), m_position.y+Y(iconY), X(iconWidth), Y(iconHeight)),
+ iconColor);
+
+ /* Overwrite tab buttons if entered page */
+ bool bOverwriteTab = false;
+
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ case PAGESTATE_HIGHLIGHTED:
+ break;
+
+ case PAGESTATE_SELECTED:
+ bOverwriteTab = true;
+ break;
+ }
+
+ if( bOverwriteTab )
+ {
+ CRGBA shadow(41, 101, 102, m_someAlpha);
+ CRGBA green(40, 48, 57, m_someAlpha);
+ CSprite2d::DrawRect(
+ CRect_SZ(m_position.x+X(82.0f), m_position.y+Y(408.0f), X(476.0f), Y(18.0f)),
+ shadow);
+ CSprite2d::DrawRect(
+ CRect_SZ(m_position.x+X(82.0f), m_position.y+Y(408.0f), X(476.0f), Y(5.0f)),
+ green);
+ }
+// stats, load, briefs, controls, audio, display, language
+
+ /* Shadow of panel on top of tab buttons */
+ CRGBA panelShadow(96, 96, 96, m_someAlpha*0.375f);
+ CSprite2d::DrawRect(CRect_SZ(m_position.x+X(87.0f), m_position.y+Y(408.0f), X(464.0f), Y(3.0f)), panelShadow);
+ /* Draw second shadow - seems unused */
+ if ( m_nChangePageTimer != 0 && CTimer::GetTimeInMillisecondsPauseMode() < m_nChangePageTimer )
+ {
+ posX = 0.0f;
+ switch(field_18)
+ {
+ case PAGE_STATS: posX = 88.0f; break;
+ case PAGE_LOAD: posX = 286.0f; break; // actually controls
+ case PAGE_BRIEFS: posX = 154.0f; break; // actually load
+ case PAGE_CONTROLS: posX = 220.0f; break; // actually briefs
+ case PAGE_AUDIO: posX = 352.0f; break;
+ case PAGE_DISPLAY: posX = 418.0f; break;
+ case PAGE_LANGUAGE: posX = 484.0f; break;
+ }
+ CSprite2d::DrawRect(CRect_SZ(m_position.x+X(posX), m_position.y+Y(411.0f), X(65.0f), Y(3.0f)), panelShadow);
+ }
+
+ /* Active tab */
+ posX = 0.0f;
+ switch(m_currentPage)
+ {
+ case PAGE_STATS: posX = 88.0f; break;
+ case PAGE_LOAD: posX = 154.0f; break;
+ case PAGE_BRIEFS: posX = 220.0f; break;
+ case PAGE_CONTROLS: posX = 286.0f; break;
+ case PAGE_AUDIO: posX = 352.0f; break;
+ case PAGE_DISPLAY: posX = 418.0f; break;
+ case PAGE_LANGUAGE: posX = 484.0f; break;
+ }
+ // PAL has 465 for 407 here - and actually 406 seems right
+ m_sprites[FE2_TABACTIVE].Draw(CRect_SZ(m_position.x+X(posX), m_position.y+YF(465.0f), X(128.0f), Y(32.0f)), CRGBA(255, 255, 255, m_someAlpha));
+
+ /* Draw page title */
+ posX = m_position.x + X(592.0f);
+ posY = m_position.y + Y(376.0f);
+ CRGBA fontCol1(255, 193, 71, m_someAlpha);
+ CRGBA fontCol2(0, 0, 0, m_someAlpha);
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(PANEL_TEXT_SIZE_X), Y(PANEL_TEXT_SIZE_Y));
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyWrap(0.0f);
+ CFont::SetRightJustifyOn();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(40.0f)); // 600.0f
+ const char *key = nil;
+ switch(m_currentPage)
+ {
+ case PAGE_STATS: key = "FEP_STA"; break;
+ case PAGE_LOAD: key = "FEP_SAV"; break;
+ case PAGE_BRIEFS: key = "FEP_BRI"; break;
+ case PAGE_CONTROLS: key = "FEP_CON"; break;
+ case PAGE_AUDIO: key = "FEP_AUD"; break;
+ case PAGE_DISPLAY: key = "FEP_DIS"; break;
+ case PAGE_LANGUAGE: key = "FEP_LAN"; break;
+ }
+ CFont::SetScale(X(PANEL_TEXT_SIZE_X*PANEL_TEXT_X_SCALES[m_currentPage]), Y(PANEL_TEXT_SIZE_Y));
+ CFont::SetColor(fontCol1);
+ CFont::PrintString(posX, posY, TheText.Get(key));
+ CFont::SetColor(fontCol2);
+ CFont::PrintString(posX-X(1.0f), posY-Y(1.0f), TheText.Get(key));
+ CFont::DrawFonts();
+
+ /* Draw controller buttons */
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(0.35f), Y(0.64f));
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(40.0f)); // 600.0f
+ CFont::SetColor(CRGBA(16, 16, 16, m_someAlpha));
+ switch(m_currentPage)
+ {
+ case PAGE_STATS:
+ CFont::PrintString(m_position.x+X(52.0f), m_position.y+Y(360.0f), TheText.Get("FEDS_ST"));
+ CFont::PrintString(m_position.x+X(52.0f), m_position.y+Y(372.0f), TheText.Get("FEDS_AM"));
+ CFont::PrintString(m_position.x+X(242.0f), m_position.y+Y(360.0f), TheText.Get("FEDSSC1"));
+ CFont::PrintString(m_position.x+X(242.0f), m_position.y+Y(372.0f), TheText.Get("FEDSSC2"));
+ break;
+
+ case PAGE_BRIEFS:
+ CFont::PrintString(m_position.x+X(52.0f), m_position.y+Y(360.0f), TheText.Get("FEDS_ST"));
+ CFont::PrintString(m_position.x+X(52.0f), m_position.y+Y(372.0f), TheText.Get("FEDS_AM"));
+ break;
+
+ case PAGE_LOAD:
+ case PAGE_CONTROLS:
+ case PAGE_AUDIO:
+ case PAGE_DISPLAY:
+ case PAGE_LANGUAGE:
+ {
+ CFont::PrintString(m_position.x+X(52.0f), m_position.y+Y(360.0f), TheText.Get("FEDS_SE"));
+ CFont::PrintString(m_position.x+X(52.0f), m_position.y+Y(372.0f), TheText.Get("FEDS_BA"));
+ CFont::PrintString(m_position.x+X(52.0f), m_position.y+Y(384.0f), TheText.Get("FEDS_ST"));
+
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ CFont::PrintString(m_position.x+X(242.0f), m_position.y+Y(372.0f), TheText.Get("FEDS_AM")); // <>-CHANGE MENU
+ break;
+
+ case PAGESTATE_HIGHLIGHTED:
+ case PAGESTATE_SELECTED:
+ {
+ CFont::PrintString(m_position.x+X(242.0f), m_position.y+Y(360.0f+3.5f), TheText.Get("FEA_UP")); // ;
+ CFont::PrintString(m_position.x+X(242.0f), m_position.y+Y(384.0f-3.5f), TheText.Get("FEA_DO")); // =
+ CFont::PrintString(m_position.x+X(242.0f-10.0f), m_position.y+Y(372.0f), TheText.Get("FEA_LE")); // <
+ CFont::PrintString(m_position.x+X(242.0f+11.0f), m_position.y+Y(372.0f), TheText.Get("FEA_RI")); // >
+ CFont::PrintString(m_position.x+X(242.0f+20.0f), m_position.y+Y(372.0f), TheText.Get("FEDSAS3")); // - CHANGE SELECTION
+
+ break;
+ }
+ }
+
+ break;
+ }
+ }
+
+ CFont::DrawFonts();
+
+ /* Draw tab button texts */
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::SetPropOn();
+ CFont::SetCentreOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(40.0f)); // 600.0f
+
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ {
+ CFont::SetColor(CRGBA(16, 16, 16, m_someAlpha));
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_STATS]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(92.0f), m_position.y+Y(408.0f), TheText.Get("FEB_STA"));
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_LOAD]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(158.0f), m_position.y+Y(408.0f), TheText.Get("FEB_SAV"));
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_BRIEFS]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(224.0f), m_position.y+Y(408.0f), TheText.Get("FEB_BRI"));
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_CONTROLS]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(290.0f), m_position.y+Y(408.0f), TheText.Get("FEB_CON"));
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_AUDIO]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(356.0f), m_position.y+Y(408.0f), TheText.Get("FEB_AUD"));
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_DISPLAY]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(422.0f), m_position.y+Y(408.0f), TheText.Get("FEB_DIS"));
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_LANGUAGE]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(488.0f), m_position.y+Y(408.0f), TheText.Get("FEB_LAN"));
+
+ break;
+ }
+
+ case PAGESTATE_HIGHLIGHTED:
+ case PAGESTATE_SELECTED:
+ {
+ CFont::SetColor(CRGBA(16, 16, 16, m_someAlpha));
+ switch(m_currentPage)
+ {
+ // PAL has 466 for 408...probably rounded?
+ case PAGE_STATS:
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_STATS]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(92.0f), m_position.y+Y(408.0f), TheText.Get("FEB_STA"));
+ break;
+ case PAGE_LOAD:
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_LOAD]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(158.0f), m_position.y+Y(408.0f), TheText.Get("FEB_SAV"));
+ break;
+ case PAGE_BRIEFS:
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_BRIEFS]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(224.0f), m_position.y+Y(408.0f), TheText.Get("FEB_BRI"));
+ break;
+ case PAGE_CONTROLS:
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_CONTROLS]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(290.0f), m_position.y+Y(408.0f), TheText.Get("FEB_CON"));
+ break;
+ case PAGE_AUDIO:
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_AUDIO]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(356.0f), m_position.y+Y(408.0f), TheText.Get("FEB_AUD"));
+ break;
+ case PAGE_DISPLAY:
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_DISPLAY]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(422.0f), m_position.y+Y(408.0f), TheText.Get("FEB_DIS"));
+ break;
+ case PAGE_LANGUAGE:
+ CFont::SetScale(X(BUTTONTAB_TEXT_SIZE_X*BUTTONTAB_TEXT_X_SCALES[PAGE_LANGUAGE]), Y(BUTTONTAB_TEXT_SIZE_Y));
+ CFont::PrintString(m_position.x+X(488.0f), m_position.y+Y(408.0f), TheText.Get("FEB_LAN"));
+ break;
+ }
+
+ break;
+ }
+ }
+
+ CFont::DrawFonts();
+
+ pActiveMenuPage = nil;
+ switch(m_currentPage)
+ {
+ case PAGE_STATS: pActiveMenuPage = &MenuPage_Stats; break;
+ case PAGE_LOAD: pActiveMenuPage = pMenuSave; break;
+ case PAGE_BRIEFS: pActiveMenuPage = &MenuPage_Briefs; break;
+ case PAGE_CONTROLS: pActiveMenuPage = &MenuPage_Controls; break;
+ case PAGE_AUDIO: pActiveMenuPage = &MenuPage_Audio; break;
+ case PAGE_DISPLAY: pActiveMenuPage = &MenuPage_Display; break;
+ case PAGE_LANGUAGE: pActiveMenuPage = &MenuPage_Language; break;
+ }
+
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(40.0f)); // 600.0f
+ CFont::SetRightJustifyWrap(X(38.0f));
+
+ if(m_currentPage == PAGE_LANGUAGE)
+ {
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(SCRW-X(40.0f)); // 600.0f
+ }
+
+ if ( m_nEndPauseTimer != 0 )
+ {
+ switch ( m_currentPage )
+ {
+ case PAGE_LOAD:
+ case PAGE_BRIEFS:
+ case PAGE_CONTROLS:
+ break;
+
+ default:
+ CFont::SetWrapx(X(1200.0f));
+ break;
+ }
+ }
+
+ if(pActiveMenuPage)
+ {
+ pActiveMenuPage->SetAlpha(m_fade);
+
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ pActiveMenuPage->DrawNormal(m_position.x, m_position.y);
+ break;
+
+ case PAGESTATE_HIGHLIGHTED:
+ pActiveMenuPage->DrawHighlighted(CRGBA(rgbaATC.r, rgbaATC.g, rgbaATC.b, m_fade), m_position.x, m_position.y);
+ break;
+
+ case PAGESTATE_SELECTED:
+ pActiveMenuPage->Draw(CRGBA(rgbaATC.r, rgbaATC.g, rgbaATC.b, m_fade), CRGBA(MENU_SELECTED_COLOR.r, MENU_SELECTED_COLOR.g, MENU_SELECTED_COLOR.b, m_fade), m_position.x, m_position.y);
+ break;
+ }
+ }
+
+ CFont::DrawFonts();
+ CFont::DrawFonts();
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSWRAP);
+}
+
+void
+CMenuManager::DrawFrontEndSaveZone(void)
+{
+ if ( bMemoryCardSpecialZone )
+ {
+ static uint8 counter = 0;
+ counter++;
+ if ( counter & 63 )
+ {
+ FillMenuWithMemCardFileListing(&MenuSaveZoneSSL_1, TriggerSaveZone_BackToMainMenuTwoLines, TriggerSaveZone_SaveSlots, nil, 0, 34, 22);
+
+ if ( TheMemoryCard.GetError() == CMemoryCard::ERR_NOFORMAT )
+ {
+ pActiveMenuPage = &MenuPageSaveZone_FormatCard;
+ pActiveMenuPage->ActivatePage();
+ bMemoryCardSpecialZone = false;
+ }
+ }
+ }
+
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
+
+ m_fade = 255;
+
+ CSprite2d::DrawRect(CRect(X(50.0f), Y(50.0f), X(590.0f), Y(398.0f)), CRGBA(0, 0, 0, 175)); //CRect(50.0f, 57.142f, 590.0f, 454.857147f)
+
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetRightJustifyWrap(X(70.0f));
+ CFont::SetWrapx(SCRW-X(70.0f)); // 570.0f
+
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->SetAlpha(m_fade);
+ pActiveMenuPage->Draw(CRGBA(rgbaATC.r, rgbaATC.g, rgbaATC.b, m_fade), TITLE_TEXT_COLOR, 0.0f, 0.0f);
+ }
+
+
+ CFont::DrawFonts();
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(0.44f), Y(0.68f)); // 0.44f, 0.777143f
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(40.0f)); //600.0f
+ CFont::SetColor(TEXT_COLOR);
+
+ wchar *text;
+ if ( pActiveMenuPage == &MenuPageSaveZone_FormatCard
+ || pActiveMenuPage == &MenuPageSaveZone_SaveSlots
+ || pActiveMenuPage == &MenuPageSaveZone_SaveGame )
+ {
+ text = TheText.Get("FEDS_SB"); // / button - SELECT " button - BACK
+ }
+ else
+ {
+ text = TheText.Get("FEDS_SE"); // / button - SELECT
+ }
+
+ CFont::PrintString(X(180.0f), Y(376.0f), text); // 180.0f, 429.714294f
+ CFont::DrawFonts();
+
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+}
+
+void
+CMenuManager::DrawMemoryCardStartUpMenus()
+{
+ CFont::SetAlphaFade(255.0f);
+ bMemoryCardStartUpMenus_ExitNow = false;
+
+ CMenuPage page; // + 0x40 data
+ CMenuMultiChoiceTriggered MCMenu;
+ MCMenu.SetPosition(X(320.0f), Y(150.0f)); //171.428574f
+
+ switch ( TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE) )
+ {
+ case CMemoryCard::MCSTATE_NEED_200KB: // 200KB
+ {
+ // There is insufficient space on the Memory Card (PS2) in MEMORY CARD slot 1. At least 200KB is needed to save this application data. Do you wish to start? (YES or NO)
+ MCMenu.AddTitle(TheText.Get("MCGNSP"), 0.0f, 0.0f, 0);
+ break;
+ }
+
+ case CMemoryCard::MCSTATE_NEED_500KB: // 500KB
+ {
+ // There is insufficient space on the Memory Card (PS2) in MEMORY CARD slot 1. At least 500KB is needed to save this application data. Do you wish to start? (YES or NO)
+ MCMenu.AddTitle(TheText.Get("MCDNSP"), 0.0f, 0.0f, 0);
+ break;
+ }
+
+ case CMemoryCard::MCSTATE_OK:
+ case CMemoryCard::MCSTATE_NOCARD:
+ {
+ return;
+ break;
+ }
+ }
+
+ MCMenu.AddOption(TheText.Get("FEM_NO"), X(30.0f), Y(110.0f), nil, 0, 0);// 125.714294f
+ MCMenu.AddOption(TheText.Get("FEM_YES"), X(-30.0f), Y(110.0f), TriggerMCSUM_Yes, 0, 0);// 125.714294f
+ MCMenu.SetColors(TITLE_TEXT_COLOR, TEXT_COLOR, TEXT_COLOR);
+ page.AddMenu(&MCMenu);
+
+ MCMenu.GoFirst();
+
+ page.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+
+ CTimer::Initialise();
+ CTimer::StartUserPause();
+
+ while ( !bMemoryCardStartUpMenus_ExitNow )
+ {
+#ifdef GTA_PC
+ HandleExit();
+
+ if(RsGlobal.quit)
+ return;
+#endif
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadLeftJustDown() )
+ page.GoLeft();
+ if ( CPad::GetPad(0)->GetDPadRightJustDown() )
+ page.GoRight();
+ if ( CPad::GetPad(0)->GetDPadUpJustDown() )
+ page.GoDown();
+ if ( CPad::GetPad(0)->GetDPadDownJustDown() )
+ page.GoUp();
+ if ( CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetRightMouseJustDown() )
+ page.SelectCurrentOptionUnderCursor();
+
+ if ( CPad::GetPad(0)->GetCircleJustDown() || CPad::GetPad(0)->GetEscapeJustDown() )
+ ;
+#else
+ if ( CPad::GetPad(0)->GetDPadLeftJustDown() )
+ page.GoLeft();
+ if ( CPad::GetPad(0)->GetDPadRightJustDown() )
+ page.GoRight();
+ if ( CPad::GetPad(0)->GetDPadUpJustDown() )
+ page.GoDown();
+ if ( CPad::GetPad(0)->GetDPadDownJustDown() )
+ page.GoUp();
+ if ( CPad::GetPad(0)->GetCrossJustDown() )
+ page.SelectCurrentOptionUnderCursor();
+ if ( CPad::GetPad(0)->GetCircleJustDown() )
+ ;
+#endif
+
+ static int32 MemCardStatusWaiter = 0;
+
+ MemCardStatusWaiter++;
+
+ if ( MemCardStatusWaiter > 120 )
+ {
+ MemCardStatusWaiter = 0;
+
+ switch ( TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE) )
+ {
+ case CMemoryCard::MCSTATE_NEED_200KB:
+ {
+ // There is insufficient space on the Memory Card (PS2) in MEMORY CARD slot 1. At least 200KB is needed to save this application data. Do you wish to start? (YES or NO)
+ MCMenu.AddTitle(TheText.Get("MCGNSP"), 0.0f, 0.0f, 0);
+ break;
+ }
+
+ case CMemoryCard::MCSTATE_NEED_500KB:
+ {
+ // There is insufficient space on the Memory Card (PS2) in MEMORY CARD slot 1. At least 500KB is needed to save this application data. Do you wish to start? (YES or NO)
+ MCMenu.AddTitle(TheText.Get("MCDNSP"), 0.0f, 0.0f, 0);
+ break;
+ }
+
+ case CMemoryCard::MCSTATE_NOCARD:
+ {
+ // There is no Memory Card (PS2) in MEMORY CARD slot 1. Do you wish to start? (YES or NO)
+ MCMenu.AddTitle(TheText.Get("MCSTNS"), 0.0f, 0.0f, 0);
+ break;
+ }
+
+ case CMemoryCard::MCSTATE_OK:
+ {
+ bMemoryCardStartUpMenus_ExitNow = true;
+ break;
+ }
+ }
+ }
+
+ DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
+ CFont::InitPerFrame();
+
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ CSprite2d *splash = LoadSplash("splash1");
+ splash->Draw(CRect(0.0f, 0.0f, SCRW, SCRH), BACKGROUND_SPLASH_COLOR);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
+
+ SetRandomActiveTextlineColor(1);
+
+ CRGBA col(rgbaATC.r, rgbaATC.g, rgbaATC.b, 255);
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetScale(X(MENU_TEXT_SIZE_X), Y(MENU_TEXT_SIZE_Y));
+ CFont::SetPropOn();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(60.0f)); // 580.0f
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(SCRW-X(120.0f)); // 520.0f
+
+ MCMenu.Draw(col, TITLE_TEXT_COLOR, 0.0f, 0.0f);
+ CFont::DrawFonts();
+
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetScale(X(0.4f), Y(0.64f)); // 0.731429
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCRW-X(60.0f)); // 580.0f
+ CFont::SetColor(TEXT_COLOR);
+
+
+ CPlaceableShText text;
+ text.SetPosition(X(240.0f), Y(378.0f), false); // 432.000000
+ text.SetColor(TEXT_COLOR);
+ text.m_text = TheText.Get("FEDS_SE"); // / button - SELECT
+ text.SetShadows(true, TEXT_SHADOW_COLOR, SHADOW_VECTOR);
+ text.Draw(0.0f, 0.0f);
+
+ CFont::DrawFonts();
+ DisplayWarningControllerMsg();
+ DoRWStuffEndOfFrame();
+ CPad::UpdatePads();
+ CTimer::Update();
+ }
+
+ CTimer::EndUserPause();
+ CTimer::Stop();
+
+ for ( int32 i = 0; i < 100; i++ )
+ {
+#ifdef GTA_PC
+ HandleExit();
+#endif
+ DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
+
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ CSprite2d *splash = LoadSplash("splash1");
+ splash->Draw(CRect(0.0f, 0.0f, SCRW, SCRH), BACKGROUND_SPLASH_COLOR);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
+
+ DoRWStuffEndOfFrame();
+ }
+}
+
+void
+CMenuManager::Process(void)
+{
+ if ( m_bSaveMenuActive || m_bInSaveZone || TheCamera.GetScreenFadeStatus() == FADE_0 )
+ {
+ InitialiseMenusOnce();
+ m_bWantToRestart = false;
+ WorkOutMenuState(false);
+
+ if ( m_bMenuActive )
+ {
+ if ( !m_bInSaveZone )
+ LoadAllTextures();
+ InitialiseMenuContents();
+ SetRandomActiveTextlineColor(0);
+ ProcessControllerInput();
+ }
+ else
+ {
+ AnaliseMenuContents();
+ pMenuSave = &MenuPage_SaveBasic;
+ m_pageState = PAGESTATE_NORMAL;
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+ UnloadTextures();
+ m_bInSaveZone = false;
+ m_bRenderGameInMenu = false;
+ gErrorSampleTriggered = true;
+ }
+ }
+}
+
+void
+CMenuManager::WorkOutMenuState(uint8 bExit)
+{
+#ifdef GTA_PC
+ bool bIsStartPressed = CPad::GetPad(0)->GetStartJustDown() || (m_pageState == PAGESTATE_NORMAL && CPad::GetPad(0)->GetEscapeJustDown());
+#else
+ bool bIsStartPressed = CPad::GetPad(0)->GetStartJustDown();
+#endif
+ bool bIsCreditsOrDraw = CCredits::AreCreditsDone() || m_bMenuActive;
+ bool bIsDemoOrDraw = m_bMenuActive || CGame::bDemoMode;
+
+ if ( (bIsStartPressed && bIsCreditsOrDraw) || bExit || (!bIsDemoOrDraw && CPad::IsNoOrObsolete()) )
+ {
+ if ( m_nStartPauseTimer == 0 && m_nEndPauseTimer == 0 )
+ {
+ m_bMenuActive = !m_bMenuActive;
+
+ if ( !m_bMenuActive )
+ {
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
+ DMAudio.ChangeMusicMode(MUSICMODE_GAME);
+ gMusicPlaying = false;
+ bMemoryCardSpecialZone = false;
+ bIgnoreTriangleButton = false;
+
+ m_bMenuActive = true;
+
+ m_nEndPauseTimer = CTimer::GetTimeInMillisecondsPauseMode() + 800;
+
+ if ( m_currentPage == PAGE_CONTROLS || m_currentPage == PAGE_BRIEFS || m_currentPage == PAGE_LOAD )
+ {
+ m_nSlidingDir = CGeneral::GetRandomNumber() & (SLIDE_MAX-1);
+
+ switch ( m_nSlidingDir ) //m_nSlidingDir &= ~1;
+ {
+ case SLIDE_TO_LEFT: m_nSlidingDir = SLIDE_TO_TOP; break;
+ case SLIDE_TO_RIGHT: m_nSlidingDir = SLIDE_TO_BOTTOM; break;
+ }
+
+ m_position.y = Y(500.0f); // 571.428589f;
+ }
+ }
+ else
+ {
+ DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
+
+ if ( DMAudio.GetRadioInCar() < 9 )
+ m_PrefsRadioStation = DMAudio.GetRadioInCar();
+ else
+ m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
+
+ CTimer::StartUserPause();
+ CPad::StopPadsShaking();
+ m_nStartPauseTimer = CTimer::GetTimeInMillisecondsPauseMode() + 800;
+ m_nSlidingDir = CGeneral::GetRandomNumber() & (SLIDE_MAX-1);
+
+ switch ( m_nSlidingDir )
+ {
+ case SLIDE_TO_RIGHT: m_position.y = Y(612.5f); break;
+ case SLIDE_TO_LEFT: m_position.y = Y(612.5f); break;
+ case SLIDE_TO_BOTTOM: m_position.y = Y(500.0f); break;
+ case SLIDE_TO_TOP: m_position.y = Y(500.0f); break;
+ default: m_position.y = Y(500.0f); break;
+ }
+
+ if ( m_currentPage == PAGE_CONTROLS || m_currentPage == PAGE_BRIEFS )
+ {
+ m_nSlidingDir = CGeneral::GetRandomNumber() & (SLIDE_MAX-1);
+
+ switch ( m_nSlidingDir ) //m_nSlidingDir &= ~1;
+ {
+ case SLIDE_TO_LEFT: m_nSlidingDir = SLIDE_TO_TOP; break;
+ case SLIDE_TO_RIGHT: m_nSlidingDir = SLIDE_TO_BOTTOM; break;
+ }
+
+ m_position.y = Y(500.0f); //571.428589f
+ }
+ }
+ }
+ }
+
+ if ( m_bSaveMenuActive && !m_bInSaveZone && !TheMemoryCard._bunk2)
+ {
+ m_bSaveMenuActive = false;
+ m_bInSaveZone = true;
+ m_bRenderGameInMenu = true;
+ m_bMenuActive = true;
+ CTimer::StartUserPause();
+ pActiveMenuPage = &MenuPageSaveZone_SaveGame;
+ }
+
+ if ( m_pageState == PAGESTATE_NORMAL && gMusicPlaying )
+ {
+ DMAudio.StopFrontEndTrack();
+ gMusicPlaying = false;
+ }
+
+ if ( m_nChangePageTimer != 0 && CTimer::GetTimeInMillisecondsPauseMode() >= m_nChangePageTimer )
+ {
+ m_nChangePageTimer = 0;
+ pMenuSave = &MenuPage_SaveBasic;
+ m_currentPage = m_newPage;
+ }
+
+ if ( m_nPageLeftTimer != 0 && CTimer::GetTimeInMillisecondsPauseMode() >= m_nPageLeftTimer )
+ m_nPageLeftTimer = 0;
+
+ if ( m_nPageRightTimer != 0 && CTimer::GetTimeInMillisecondsPauseMode() >= m_nPageRightTimer )
+ m_nPageRightTimer = 0;
+
+ if ( m_nStartPauseTimer != 0 && CTimer::GetTimeInMillisecondsPauseMode() >= m_nStartPauseTimer )
+ m_nStartPauseTimer = 0;
+
+ if ( m_nEndPauseTimer != 0 && CTimer::GetTimeInMillisecondsPauseMode() >= m_nEndPauseTimer )
+ {
+ m_nEndPauseTimer = 0;
+ m_bMenuActive = false;
+ m_bMenuActive = false;
+ m_bInSaveZone = false;
+ CTimer::EndUserPause();
+ }
+}
+
+void
+CMenuManager::ProcessControllerInput(void)
+{
+ if ( TimeToStopPadShaking != 0 && TimeToStopPadShaking < CTimer::GetTimeInMillisecondsPauseMode() )
+ {
+ CPad::StopPadsShaking();
+ TimeToStopPadShaking = 0;
+ }
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadLeft() || CPad::GetPad(0)->GetLeft() )
+#else
+ if ( CPad::GetPad(0)->GetDPadLeft() )
+#endif
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ case PAGESTATE_HIGHLIGHTED:
+ break;
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoLeftStill();
+ break;
+ }
+ }
+ }
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadRight() || CPad::GetPad(0)->GetRight() )
+#else
+ if ( CPad::GetPad(0)->GetDPadRight() )
+#endif
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ case PAGESTATE_HIGHLIGHTED:
+ break;
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoRightStill();
+ break;
+ }
+ }
+ }
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadLeftJustDown() || CPad::GetPad(0)->GetLeftJustDown() )
+#else
+ if ( CPad::GetPad(0)->GetDPadLeftJustDown() )
+#endif
+ ProcessDPadLeftJustDown();
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadRightJustDown() || CPad::GetPad(0)->GetRightJustDown() )
+#else
+ if ( CPad::GetPad(0)->GetDPadRightJustDown() )
+#endif
+ ProcessDPadRightJustDown();
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadUp() || CPad::GetPad(0)->GetUp() )
+#else
+ if ( CPad::GetPad(0)->GetDPadUp() )
+#endif
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ {
+ if ( m_currentPage == PAGE_STATS )
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoUpStill();
+ }
+ break;
+ }
+
+ case PAGESTATE_HIGHLIGHTED:
+ break;
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoUpStill();
+ break;
+ }
+ }
+ }
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadDown() || CPad::GetPad(0)->GetDown() )
+#else
+ if ( CPad::GetPad(0)->GetDPadDown() )
+#endif
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ {
+ if ( m_currentPage == PAGE_STATS )
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoDownStill();
+ }
+
+ break;
+ }
+ case PAGESTATE_HIGHLIGHTED:
+ break;
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoDownStill();
+ break;
+ }
+ }
+ }
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadUpJustDown() || CPad::GetPad(0)->GetUpJustDown() )
+#else
+ if ( CPad::GetPad(0)->GetDPadUpJustDown() )
+#endif
+ ProcessDPadUpJustDown();
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetDPadDownJustDown() || CPad::GetPad(0)->GetDownJustDown() )
+#else
+ if ( CPad::GetPad(0)->GetDPadDownJustDown() )
+#endif
+ ProcessDPadDownJustDown();
+
+ if ( CPad::GetPad(0)->GetLeftShoulder1JustDown() )
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ ProcessDPadLeftJustDown();
+ break;
+
+ case PAGESTATE_HIGHLIGHTED:
+ case PAGESTATE_SELECTED:
+ break;
+ }
+ }
+
+ if ( CPad::GetPad(0)->GetRightShoulder1JustDown() )
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ ProcessDPadRightJustDown();
+ break;
+
+ case PAGESTATE_HIGHLIGHTED:
+ case PAGESTATE_SELECTED:
+ break;
+ }
+ }
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetRightMouseJustDown() )
+#else
+ if ( CPad::GetPad(0)->GetCrossJustDown() )
+#endif
+ ProcessDPadCrossJustDown();
+
+#ifdef GTA_PC
+ if ( CPad::GetPad(0)->GetTriangleJustDown() || CPad::GetPad(0)->GetBackspaceJustDown() || (m_pageState != PAGESTATE_NORMAL && CPad::GetPad(0)->GetEscapeJustDown()) )
+#else
+ if ( CPad::GetPad(0)->GetTriangleJustDown() )
+#endif
+ ProcessDPadTriangleJustDown();
+}
+
+
+void
+CMenuManager::ProcessDPadLeftJustDown(void)
+{
+ if ( m_bInSaveZone )
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->GoLeft();
+
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveZoneSSL_1 )
+ {
+ if ( MenuSaveZoneSSL_1.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ }
+ else
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ {
+ if ( !bMemoryCardSpecialZone && !m_bInSaveZone )
+ {
+ if ( m_nChangePageTimer == 0 )
+ {
+ if ( --m_newPage < PAGE_FIRST ) m_newPage = PAGE_LAST;
+
+ m_nPageLeftTimer = CTimer::GetTimeInMillisecondsPauseMode() + 300;
+ m_nPageRightTimer = 0;
+ m_nChangePageTimer = CTimer::GetTimeInMillisecondsPauseMode() + 250;
+ field_18 = m_newPage;
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
+ }
+ }
+
+ break;
+ }
+
+ case PAGESTATE_HIGHLIGHTED:
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoLeftMenuOnPage();
+
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+
+ break;
+ }
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->GoLeft();
+
+ if ( m_currentPage == PAGE_AUDIO)
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuAudio_1 )
+ ;
+ else if ( pActiveMenuPage->m_pCurrentControl == &MenuAudio_2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else if ( m_currentPage == PAGE_DISPLAY)
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuDisplay_1 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveDG_2 )
+ {
+ if ( MenuSaveDG_2.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveLG_2 )
+ {
+ if ( MenuSaveLG_2.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ }
+
+ break;
+ }
+ }
+ }
+}
+
+void
+CMenuManager::ProcessDPadRightJustDown(void)
+{
+ if ( m_bInSaveZone )
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->GoRight();
+
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveZoneSSL_1 )
+ {
+ if ( MenuSaveZoneSSL_1.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ }
+ else
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ {
+ if ( !bMemoryCardSpecialZone && !m_bInSaveZone )
+ {
+ if ( m_nChangePageTimer == 0 )
+ {
+ if ( ++m_newPage > PAGE_LAST ) m_newPage = PAGE_FIRST;
+
+ m_nPageLeftTimer = 0;
+ m_nPageRightTimer = CTimer::GetTimeInMillisecondsPauseMode() + 300;
+ m_nChangePageTimer = CTimer::GetTimeInMillisecondsPauseMode() + 250;
+ field_18 = m_newPage;
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
+ }
+ }
+
+ break;
+ }
+
+ case PAGESTATE_HIGHLIGHTED:
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoRightMenuOnPage();
+
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+
+ break;
+ }
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->GoRight();
+
+ if ( m_currentPage == PAGE_AUDIO)
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuAudio_1 )
+ ;
+ else if ( pActiveMenuPage->m_pCurrentControl == &MenuAudio_2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else if ( m_currentPage == PAGE_DISPLAY)
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuDisplay_1 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveDG_2 )
+ {
+ if ( MenuSaveDG_2.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveLG_2 )
+ {
+ if ( MenuSaveLG_2.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ }
+
+ break;
+ }
+ }
+ }
+}
+
+void
+CMenuManager::ProcessDPadUpJustDown(void)
+{
+ if ( m_bInSaveZone )
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->GoUp();
+
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveZoneSSL_1 )
+ {
+ if ( MenuSaveZoneSSL_1.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ }
+ else
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ break;
+
+ case PAGESTATE_HIGHLIGHTED:
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoUpMenuOnPage();
+
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ break;
+ }
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->GoUp();
+
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveDG_2 )
+ {
+ if ( MenuSaveDG_2.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveLG_2 )
+ {
+ if ( MenuSaveLG_2.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+
+ break;
+ }
+ }
+ }
+}
+
+void
+CMenuManager::ProcessDPadDownJustDown(void)
+{
+ if ( m_bInSaveZone )
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->GoDown();
+
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveZoneSSL_1 )
+ {
+ if ( MenuSaveZoneSSL_1.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ }
+ else
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ break;
+
+ case PAGESTATE_HIGHLIGHTED:
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->GoDownMenuOnPage();
+
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+
+ break;
+ }
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->GoDown();
+
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveDG_2 )
+ {
+ if ( MenuSaveDG_2.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveLG_2 )
+ {
+ if ( MenuSaveLG_2.m_numOptions < 2 )
+ ;
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
+ }
+ break;
+ }
+ }
+ }
+}
+
+void
+CMenuManager::ProcessDPadTriangleJustDown(void)
+{
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->SelectDefaultCancelAction();
+
+ if ( m_bMenuActive || m_bInSaveZone )
+ {
+ if ( bIgnoreTriangleButton )
+ {
+ if ( m_bInSaveZone )
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0);
+ else if ( pActiveMenuPage->m_pCurrentControl == &MenuSaveDG_2 || pActiveMenuPage->m_pCurrentControl == &MenuSaveLG_2 )
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0);
+ }
+ else if ( !bIgnoreTriangleButton )
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ WorkOutMenuState(true);
+ break;
+
+ case PAGESTATE_HIGHLIGHTED:
+ m_pageState = PAGESTATE_NORMAL;
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
+ break;
+
+ case PAGESTATE_SELECTED:
+ {
+ m_pageState = PAGESTATE_HIGHLIGHTED;
+ if ( pActiveMenuPage )
+ {
+ if ( pActiveMenuPage->m_numControls == 1 )
+ {
+ m_pageState = PAGESTATE_NORMAL;
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( !bIgnoreTriangleButton )
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ WorkOutMenuState(false);
+ break;
+
+ case PAGESTATE_HIGHLIGHTED:
+ m_pageState = PAGESTATE_NORMAL;
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
+ break;
+
+ case PAGESTATE_SELECTED:
+ {
+ m_pageState = PAGESTATE_HIGHLIGHTED;
+ if ( pActiveMenuPage )
+ {
+ if ( pActiveMenuPage->m_numControls == 1 )
+ {
+ m_pageState = PAGESTATE_NORMAL;
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
+ }
+ else
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0);
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+void
+CMenuManager::ProcessDPadCrossJustDown(void)
+{
+ if ( m_bInSaveZone )
+ {
+ if ( pActiveMenuPage )
+ pActiveMenuPage->SelectCurrentOptionUnderCursor();
+
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
+ }
+ else
+ {
+ if ( m_currentPage != PAGE_STATS && m_currentPage != PAGE_BRIEFS)
+ {
+ switch ( m_pageState )
+ {
+ case PAGESTATE_NORMAL:
+ {
+ m_pageState = PAGESTATE_HIGHLIGHTED;
+ if ( pActiveMenuPage )
+ {
+ if ( pActiveMenuPage->m_numControls == 1 )
+ m_pageState = PAGESTATE_SELECTED;
+ }
+
+ switch ( m_currentPage )
+ {
+ case PAGE_AUDIO:
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuAudio_1
+ || pActiveMenuPage->m_pCurrentControl == &MenuAudio_2
+ || pActiveMenuPage->m_pCurrentControl == &MenuAudio_3
+ || pActiveMenuPage->m_pCurrentControl == &MenuAudio_4 )
+ {
+ if ( !gMusicPlaying )
+ {
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
+ gMusicPlaying = true;
+ }
+ }
+ else
+ {
+ DMAudio.StopFrontEndTrack();
+ gMusicPlaying = false;
+ }
+ break;
+ }
+ }
+
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
+ break;
+ }
+
+ case PAGESTATE_HIGHLIGHTED:
+ {
+ m_pageState = PAGESTATE_SELECTED;
+ DoHackingMenusAtPageBrowse();
+ if ( pActiveMenuPage )
+ {
+ if ( pActiveMenuPage->IsActiveMenuTwoState())
+ {
+ m_pageState = PAGESTATE_HIGHLIGHTED;
+ pActiveMenuPage->ActiveMenuTwoState_SelectNextPosition();
+ }
+ }
+
+ switch ( m_currentPage )
+ {
+ case PAGE_AUDIO:
+ {
+ if ( pActiveMenuPage->m_pCurrentControl != &MenuAudio_4 )
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
+
+ break;
+ }
+
+ default:
+ {
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
+ DMAudio.StopFrontEndTrack();
+ gMusicPlaying = false;
+ break;
+ }
+ }
+ break;
+ }
+
+ case PAGESTATE_SELECTED:
+ {
+ if ( pActiveMenuPage )
+ {
+ pActiveMenuPage->SelectCurrentOptionUnderCursor();
+
+ switch ( m_currentPage )
+ {
+ case PAGE_AUDIO:
+ {
+ if ( pActiveMenuPage->m_pCurrentControl != &MenuAudio_3 )
+ m_pageState = PAGESTATE_HIGHLIGHTED;
+ break;
+ }
+
+ case PAGE_LOAD:
+ case PAGE_LANGUAGE:
+ break;
+
+ default:
+ m_pageState = PAGESTATE_HIGHLIGHTED;
+ break;
+ }
+ }
+
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
+ break;
+ }
+ }
+ }
+ }
+}
+
+void
+CMenuManager::DoHackingMenusAtPageBrowse(void)
+{
+ if ( pActiveMenuPage )
+ {
+ switch ( m_currentPage )
+ {
+ case PAGE_CONTROLS:
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuControls_1 )
+ {
+ int32 sel = MenuControls_1.GetMenuSelection();
+ MenuControls_1.GoFirst();
+
+ for ( int32 i = 0; i < sel; i++ )
+ MenuControls_1.GoNext();
+ }
+ break;
+ }
+
+ case PAGE_AUDIO:
+ {
+ if ( pActiveMenuPage->m_pCurrentControl == &MenuAudio_3 )
+ {
+ int32 sel = MenuAudio_3.GetMenuSelection();
+ MenuAudio_3.GoFirst();
+
+ for ( int32 i = 0; i < sel; i++ )
+ MenuAudio_3.GoNext();
+ }
+ break;
+ }
+ }
+ }
+}
+
+void
+CMenuManager::SetSoundLevelsForMusicMenu(void)
+{
+ DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
+ DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
+}
+
+void
+CMenuManager::FilterOutColorMarkersFromString(wchar *string, CRGBA &color)
+{
+ wchar buf[300];
+ UnicodeStrcpy(buf, string);
+
+ wchar *src = buf;
+ wchar *dst = string;
+ while ( *src != '\0' )
+ {
+ if ( *src == '~' )
+ {
+ src++;
+
+ if ( *src == 'l' ) color = CRGBA(0, 0, 0, 255);
+ else if ( *src == 'p' ) color = CRGBA(255, 0, 255, 255);
+ else if ( *src == 'y' ) color = CRGBA(255, 255, 0, 255);
+ else if ( *src == 'w' ) color = CRGBA(255, 255, 255, 255);
+ else if ( *src == 'b' ) color = CRGBA(40, 40, 255, 255);
+ else if ( *src == 'g' ) color = CRGBA(40, 235, 40, 255);
+ else if ( *src == 'r' ) color = CRGBA(255, 0, 0, 255);
+
+ while ( *src++ != '~' )
+ ;
+ }
+ else
+ *dst++ = *src++;
+ }
+
+ *dst = '\0';
+}
+
+#endif \ No newline at end of file
diff --git a/src/core/Frontend_PS2.h b/src/core/Frontend_PS2.h
new file mode 100644
index 00000000..2f226dc3
--- /dev/null
+++ b/src/core/Frontend_PS2.h
@@ -0,0 +1,244 @@
+#pragma once
+#include "Sprite2d.h"
+
+enum
+{
+ PAGE_STATS,
+ PAGE_LOAD,
+ PAGE_BRIEFS,
+ PAGE_CONTROLS,
+ PAGE_AUDIO,
+ PAGE_DISPLAY,
+ PAGE_LANGUAGE,
+
+ NUM_PAGES,
+ PAGE_FIRST = PAGE_STATS,
+ PAGE_LAST = PAGE_LANGUAGE,
+};
+
+enum
+{
+ PAGESTATE_NORMAL = 0,
+ PAGESTATE_HIGHLIGHTED,
+ PAGESTATE_SELECTED
+};
+
+
+enum eFrontendSprites
+{
+ FE2_MAINPANEL_UL,
+ FE2_MAINPANEL_UR,
+ FE2_MAINPANEL_DL,
+ FE2_MAINPANEL_DR,
+ FE2_MAINPANEL_DR2,
+ FE2_TABACTIVE,
+ FE_ICONBRIEF,
+ FE_ICONSTATS,
+ FE_ICONCONTROLS,
+ FE_ICONSAVE,
+ FE_ICONAUDIO,
+ FE_ICONDISPLAY,
+ FE_ICONLANGUAGE,
+ FE_CONTROLLER,
+ FE_CONTROLLERSH,
+ FE_ARROWS1,
+ FE_ARROWS2,
+ FE_ARROWS3,
+ FE_ARROWS4,
+ FE_RADIO1,
+ FE_RADIO2,
+ FE_RADIO3,
+ FE_RADIO4,
+ FE_RADIO5,
+ FE_RADIO6,
+ FE_RADIO7,
+ FE_RADIO8,
+ FE_RADIO9,
+
+ NUM_FE_SPRITES
+};
+
+
+class CSprite2d;
+class CVector2D;
+
+#ifdef GTA_PC
+enum eControlMethod
+{
+ CONTROL_STANDARD = 0,
+ CONTROL_CLASSIC,
+};
+#endif
+
+class CMenuManager
+{
+public:
+ enum LANGUAGE
+ {
+ LANGUAGE_AMERICAN,
+ LANGUAGE_FRENCH,
+ LANGUAGE_GERMAN,
+ LANGUAGE_ITALIAN,
+ LANGUAGE_SPANISH,
+#ifdef MORE_LANGUAGES
+ LANGUAGE_POLISH,
+ LANGUAGE_RUSSIAN,
+ LANGUAGE_JAPANESE,
+#endif
+ };
+
+ enum CONTRCONFIG
+ {
+ CONFIG_1 = 0,
+ CONFIG_2,
+ CONFIG_3,
+ CONFIG_4,
+ };
+
+ enum
+ {
+ NUM_SPRIRES = 28,
+ };
+
+ enum
+ {
+ PAGESTATE_NORMAL = 0,
+ PAGESTATE_HIGHLIGHTED = 1,
+ PAGESTATE_SELELECTED = 2,
+ };
+
+ enum
+ {
+ SLIDE_TO_BOTTOM = 0,
+ SLIDE_TO_RIGHT,
+ SLIDE_TO_TOP,
+ SLIDE_TO_LEFT,
+ SLIDE_MAX
+ };
+
+ int32 m_currentPage;
+ int32 m_newPage;
+ int32 m_pageState;
+ uint32 m_nPageLeftTimer;
+ uint32 m_nPageRightTimer;
+ uint32 m_nChangePageTimer;
+ int field_18;
+ uint8 m_fade;
+ uint8 m_someAlpha;
+ //char field_1E; // unused ?
+ //char field_1F; // unused ?
+ uint32 m_nStartPauseTimer;
+ uint32 m_nEndPauseTimer;
+ CVector2D m_position;
+ uint8 m_nSlidingDir;
+ //char field_31; // unused ?
+ //char field_32; // unused ?
+ //char field_33; // unused ?
+ bool m_bInitialised;
+ bool m_bWantToUpdateContent;
+ bool m_bMenuActive;
+ bool m_bWantToRestart;
+ //char field_38; //unused ?
+ bool m_bRenderGameInMenu;
+ bool m_bSaveMenuActive;
+ bool m_bInSaveZone;
+ char field_3C;
+ bool m_bTexturesLoaded;
+ //char field_3E; //unused ?
+ //char field_3F; //unused ?
+ CSprite2d m_sprites[NUM_SPRIRES];
+
+ static int32 m_PrefsSfxVolume;
+ static int32 m_PrefsMusicVolume;
+ static int32 m_PrefsBrightness;
+ static bool m_PrefsShowTrails;
+ static bool m_PrefsShowSubtitles;
+ static bool m_PrefsAllowNastyGame;
+ static int32 m_PrefsRadioStation;
+ static int32 m_PrefsStereoMono;
+ static int8 m_PrefsUseWideScreen;
+ static int32 m_PrefsLanguage;
+ static CONTRCONFIG m_PrefsControllerConfig;
+ static bool m_PrefsUseVibration;
+
+
+#ifdef GTA_PC
+ bool m_bQuitGameNoCD;
+
+ int32 m_nMouseTempPosX;
+ int32 m_nMouseTempPosY;
+ int32 m_nPrefsVideoMode;
+ int32 m_nDisplayVideoMode;
+ int8 m_nPrefsAudio3DProviderIndex;
+
+ static int32 OS_Language;
+ static int8 m_PrefsVsync;
+ static int8 m_PrefsVsyncDisp;
+ static int8 m_PrefsFrameLimiter;
+ static int8 m_PrefsSpeakers;
+ static int32 m_ControlMethod;
+ static int8 m_PrefsDMA;
+ static float m_PrefsLOD;
+ static char m_PrefsSkinFile[256];
+
+#ifndef MASTER
+ static bool m_PrefsMarketing;
+ static bool m_PrefsDisableTutorials;
+#endif // !MASTER
+
+#ifdef MENU_MAP
+ static bool bMenuMapActive;
+ static float fMapSize;
+ static float fMapCenterY;
+ static float fMapCenterX;
+#endif
+
+#ifdef IMPROVED_VIDEOMODE
+ int32 m_nPrefsWidth = 640;
+ int32 m_nPrefsHeight = 480;
+ int32 m_nPrefsDepth = 32;
+ int32 m_nPrefsWindowed = 1;
+ int32 m_nPrefsSubsystem;
+ int32 m_nSelectedScreenMode;
+#endif
+
+ void WaitForUserCD() { }
+#endif
+
+ bool GetIsMenuActive() {return !!m_bMenuActive;}
+
+ CMenuManager(void);
+#ifdef FIX_BUGS
+ ~CMenuManager(void)
+ {
+ UnloadTextures();
+ }
+#endif
+
+ void LoadAllTextures(void);
+ void UnloadTextures(void);
+
+ void InitialiseMenusOnce(void);
+ void InitialiseChangedLanguageSettings(void);
+ void InitialiseMenuContents(void);
+ void AnaliseMenuContents(void);
+ void InitialiseMenuContentsAfterLoadingGame(void);
+ void DrawFrontEnd(void);
+ void DrawFrontEndNormal(void);
+ void DrawFrontEndSaveZone(void);
+ void DrawMemoryCardStartUpMenus(void);
+ void Process(void);
+ void WorkOutMenuState(uint8 bExit);
+ void ProcessControllerInput(void);
+ void ProcessDPadLeftJustDown(void);
+ void ProcessDPadRightJustDown(void);
+ void ProcessDPadUpJustDown(void);
+ void ProcessDPadDownJustDown(void);
+ void ProcessDPadTriangleJustDown(void);
+ void ProcessDPadCrossJustDown(void);
+ void DoHackingMenusAtPageBrowse(void);
+ void SetSoundLevelsForMusicMenu(void);
+ void FilterOutColorMarkersFromString(wchar *string, CRGBA &color);
+};
+
+extern CMenuManager FrontEndMenuManager; \ No newline at end of file
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 33afc956..82e6992d 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -43,6 +43,7 @@
#include "Lights.h"
#include "MBlur.h"
#include "Messages.h"
+#include "MemoryCard.h"
#include "Pad.h"
#include "Particle.h"
#include "ParticleObject.h"
@@ -85,8 +86,7 @@
#include "ZoneCull.h"
#include "Zones.h"
#include "debugmenu.h"
-
-
+#include "frontendoption.h"
eLevelName CGame::currLevel;
bool CGame::bDemoMode = true;
@@ -103,6 +103,43 @@ bool CGame::japaneseGame = false;
int gameTxdSlot;
+
+bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
+void DoRWStuffEndOfFrame(void);
+void MessageScreen(char *msg)
+{
+ //TODO: stretch_screen
+
+ CRect rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ CRGBA color(255, 255, 255, 255);
+
+ DoRWStuffStartOfFrame(50, 50, 50, 0, 0, 0, 255);
+
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+ DefinedState();
+
+ CSprite2d *splash = LoadSplash(NULL);
+ splash->Draw(rect, color, color, color, color);
+ splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_SCALE_X(620.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192));
+
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetBackgroundOff();
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
+ CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
+ CFont::SetJustifyOff();
+ CFont::SetColor(CRGBA(255, 255, 255, 255));
+ CFont::SetDropColor(CRGBA(32, 32, 32, 255));
+ CFont::SetDropShadowPosition(3);
+ CFont::SetPropOn();
+ CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(130.0f), TheText.Get(msg));
+ CFont::DrawFonts();
+
+ DoRWStuffEndOfFrame();
+}
+
bool
CGame::InitialiseOnceBeforeRW(void)
{
@@ -112,6 +149,15 @@ CGame::InitialiseOnceBeforeRW(void)
return true;
}
+#ifndef LIBRW
+#ifdef PS2_MATFX
+void ReplaceMatFxCallback();
+#endif // PS2_MATFX
+#ifdef PS2_ALPHA_TEST
+void ReplaceAtomicPipeCallback();
+#endif // PS2_ALPHA_TEST
+#endif // !LIBRW
+
bool
CGame::InitialiseRenderWare(void)
{
@@ -162,7 +208,14 @@ CGame::InitialiseRenderWare(void)
#else
rw::MatFX::modulateEnvMap = false;
#endif
-#endif
+#else
+#ifdef PS2_MATFX
+ ReplaceMatFxCallback();
+#endif // PS2_MATFX
+#ifdef PS2_ALPHA_TEST
+ ReplaceAtomicPipeCallback();
+#endif // PS2_ALPHA_TEST
+#endif // LIBRW
CFont::Initialise();
CHud::Initialise();
@@ -234,6 +287,9 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetMusicFadeVol(127);
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ CustomFrontendOptionsPopulate();
+#endif
return true;
}
@@ -272,6 +328,9 @@ bool CGame::Initialise(const char* datFile)
CWeather::Init();
CCullZones::Init();
CCollision::Init();
+#ifdef PS2_MENU
+ TheText.Load();
+#endif
CTheZones::Init();
CUserDisplay::Init();
CMessages::Init();
@@ -280,6 +339,11 @@ bool CGame::Initialise(const char* datFile)
CRestart::Initialise();
CWorld::Initialise();
CParticle::Initialise();
+#ifdef PS2
+ gStartX = -180.0f;
+ gStartY = 180.0f;
+ gStartZ = 14.0f;
+#endif
CAnimManager::Initialise();
CCutsceneMgr::Initialise();
CCarCtrl::Init();
@@ -309,9 +373,9 @@ bool CGame::Initialise(const char* datFile)
CStreaming::Init();
CStreaming::LoadInitialVehicles();
CStreaming::LoadInitialPeds();
- CStreaming::RequestBigBuildings(LEVEL_NONE);
+ CStreaming::RequestBigBuildings(LEVEL_GENERIC);
CStreaming::LoadAllRequestedModels(false);
- printf("Streaming uses %dK of its memory", CStreaming::ms_memoryUsed / 1024);
+ printf("Streaming uses %zuK of its memory", CStreaming::ms_memoryUsed / 1024); // original modifier was %d
LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen());
CAnimManager::LoadAnimFiles();
CPed::Initialise();
@@ -363,10 +427,16 @@ bool CGame::Initialise(const char* datFile)
CCredits::Init();
CRecordDataForChase::Init();
CReplay::Init();
- LoadingScreen("Loading the Game", "Start script", nil);
+#ifdef PS2_MENU
+ if ( !TheMemoryCard.m_bWantToLoad )
+ {
+#endif
CTheScripts::StartTestScript();
CTheScripts::Process();
TheCamera.Process();
+#ifdef PS2_MENU
+ }
+#endif
LoadingScreen("Loading the Game", "Load scene", nil);
CModelInfo::RemoveColModelsFromOtherLevels(currLevel);
CCollision::ms_collisionInMemory = currLevel;
@@ -431,8 +501,15 @@ bool CGame::ShutDown(void)
void CGame::ReInitGameObjectVariables(void)
{
CGameLogic::InitAtStartOfGame();
- TheCamera.CCamera::Init();
+#ifdef PS2_MENU
+ if ( !TheMemoryCard.m_bWantToLoad )
+ {
+#endif
+ TheCamera.Init();
TheCamera.SetRwCamera(Scene.camera);
+#ifdef PS2_MENU
+ }
+#endif
CDebug::DebugInitTextBuffer();
CWeather::Init();
CUserDisplay::Init();
@@ -441,11 +518,16 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::bDoingCarCollisions = false;
CHud::ReInitialise();
CRadar::Initialise();
+#ifdef PS2
+ gStartX = -180.0f;
+ gStartY = 180.0f;
+ gStartZ = 14.0f;
+#endif
CCarCtrl::ReInit();
CTimeCycle::Initialise();
CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f;
- CStreaming::RequestBigBuildings(LEVEL_NONE);
+ CStreaming::RequestBigBuildings(LEVEL_GENERIC);
CStreaming::LoadAllRequestedModels(false);
CPed::Initialise();
CEventList::Initialise();
@@ -456,6 +538,10 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::Players[i].Clear();
CWorld::PlayerInFocus = 0;
+#ifdef PS2
+ CWeaponEffects::Init();
+ CSkidmarks::Init();
+#endif
CAntennas::Init();
CGlass::Init();
gPhoneInfo.Initialise();
@@ -471,12 +557,20 @@ void CGame::ReInitGameObjectVariables(void)
CPickups::Init();
CPacManPickups::Init();
CGarages::Init();
+#ifdef PS2
+ CClouds::Init();
+ CRemote::Init();
+#endif
CSpecialFX::Init();
CWaterCannons::Init();
CParticle::ReloadConfig();
CCullZones::ResolveVisibilities();
+#ifdef PS2_MENU
+ if ( !TheMemoryCard.m_bWantToLoad )
+#else
if ( !FrontEndMenuManager.m_bWantToLoad )
+#endif
{
CCranes::InitCranes();
CTheScripts::StartTestScript();
@@ -533,8 +627,10 @@ void CGame::ShutDownForRestart(void)
CRadar::RemoveRadarSections();
FrontEndMenuManager.UnloadTextures();
CParticleObject::RemoveAllParticleObjects();
+#ifndef PS2
CPedType::Shutdown();
CSpecialFX::Shutdown();
+#endif
TidyUpMemory(true, false);
}
@@ -545,19 +641,102 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Initialise();
CSprite2d::SetRecipNearClip();
+
+#ifdef PS2_MENU
+ if ( TheMemoryCard.b_FoundRecentSavedGameWantToLoad == true || TheMemoryCard.m_bWantToLoad == false )
+ {
+ if ( TheMemoryCard.m_bWantToLoad == true )
+ MessageScreen("MCLOAD"); // Loading Data. Please do not remove the Memory Card (PS2) in MEMORY CARD slot 1, reset or switch off the console.
+ else
+ MessageScreen("RESTART"); // Starting new game
+ }
+#endif
+#ifdef PS2_MENU
+ TheMemoryCard.b_FoundRecentSavedGameWantToLoad = false;
+#else
b_FoundRecentSavedGameWantToLoad = false;
+#endif
TheCamera.Init();
+#ifdef PS2_MENU
+ if ( TheMemoryCard.m_bWantToLoad == true )
+ {
+ TheMemoryCard.RestoreForStartLoad();
+ CStreaming::LoadScene(TheCamera.GetPosition());
+ }
+#else
if ( FrontEndMenuManager.m_bWantToLoad == true )
{
RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition());
}
+#endif
ReInitGameObjectVariables();
+#ifdef PS2_MENU
+ if ( TheMemoryCard.m_bWantToLoad == true )
+ {
+ if ( TheMemoryCard.LoadSavedGame() == CMemoryCard::RES_SUCCESS )
+ {
+ for ( int32 i = 0; i < 35; i++ )
+ {
+ MessageScreen("FESZ_LS"); // Load Successful.
+ }
+
+ DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
+ CTrain::InitTrains();
+ CPlane::InitPlanes();
+ }
+ else
+ {
+ for ( int32 i = 0; i < 50; i++ )
+ {
+ DoRWStuffStartOfFrame(50, 50, 50, 0, 0, 0, 255);
+
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+ DefinedState();
+
+ CSprite2d *splash = LoadSplash(NULL);
+ splash->Draw(rect, color, color, color, color);
+ splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_SCALE_X(620.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192));
+
+ //CFont::SetFontStyle(?);
+ CFont::SetBackgroundOff();
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f
+ CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f
+ CFont::SetJustifyOff();
+ CFont::SetColor(CRGBA(255, 255, 255, 255));
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetDropColor(CRGBA(32, 32, 32, 255));
+ CFont::SetDropShadowPosition(3);
+ CFont::SetPropOn();
+ CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(130.0f), TheText.Get("MC_LDFL")); // Load Failed!
+ CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(170.0f), TheText.Get("FES_NOC")); // No Memory Card (PS2) in MEMORY CARD slot 1.
+ CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(240.0f), TheText.Get("MC_NWRE")); // Now Restarting Game.
+ CFont::DrawFonts();
+
+ DoRWStuffEndOfFrame();
+ }
+
+ ShutDownForRestart();
+ CTimer::Stop();
+ CTimer::Initialise();
+ TheMemoryCard.m_bWantToLoad = false;
+ ReInitGameObjectVariables();
+ currLevel = LEVEL_INDUSTRIAL;
+ CCollision::SortOutCollisionAfterLoad();
+
+ FrontEndMenuManager.SetSoundLevelsForMusicMenu();
+ FrontEndMenuManager.InitialiseMenuContentsAfterLoadingGame();
+ }
+ }
+#else
if ( FrontEndMenuManager.m_bWantToLoad == true )
{
if ( GenericLoad() == true )
@@ -583,6 +762,7 @@ void CGame::InitialiseWhenRestarting(void)
CCollision::SortOutCollisionAfterLoad();
}
}
+#endif
CTimer::Update();
@@ -596,8 +776,8 @@ void CGame::Process(void)
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);
+ if (TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_SNIPER || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE)
+ TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
#ifdef DEBUGMENU
DebugMenuProcess();
#endif
@@ -666,6 +846,9 @@ void CGame::Process(void)
CCarCtrl::RemoveDistantCars();
}
}
+#ifdef PS2
+ CMemCheck::DoTest();
+#endif
}
void CGame::DrasticTidyUpMemory(bool)
diff --git a/src/core/Game.h b/src/core/Game.h
index 48f31abc..46e8fc68 100644
--- a/src/core/Game.h
+++ b/src/core/Game.h
@@ -2,7 +2,7 @@
enum eLevelName {
LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel
- LEVEL_NONE = 0,
+ LEVEL_GENERIC = 0,
LEVEL_INDUSTRIAL,
LEVEL_COMMERCIAL,
LEVEL_SUBURBAN
diff --git a/src/core/General.h b/src/core/General.h
index 7ffa99de..dde43c0f 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -108,7 +108,7 @@ public:
if (angle >= TWOPI)
angle -= TWOPI;
- return (int)floorf(angle / DEGTORAD(45.0f));
+ return (int)Floor(angle / DEGTORAD(45.0f));
}
// Unlike usual string comparison functions, these don't care about greater or lesser
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.cpp
index 6c2ebdb8..4685918e 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.cpp
@@ -1,17 +1,15 @@
-#pragma once
+#include "common.h"
+#include "Frontend.h"
+#ifdef PC_MENU
-// TODO: There are some missing/wrong entries in here.
+// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp.
-const CMenuScreen aScreens[] = {
+CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0
{ "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// 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,
},
@@ -24,11 +22,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_BRIEFS = 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,
},
@@ -62,52 +56,44 @@ const CMenuScreen aScreens[] = {
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
-#ifdef IMPROVED_VIDEOMODE
- MENUACTION_SCREENMODE, "SCRFOR", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
-#endif
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_LANGUAGE_SETTINGS = 7
{ "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,
- MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE,
-#ifdef MORE_LANGUAGES
- MENUACTION_LANG_PL, "FEL_POL", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_RUS, "FEL_RUS", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_JAP, "FEL_JAP", SAVESLOT_NONE, MENUPAGE_NONE,
-#endif
+ MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
+ MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
+ MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
+ MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
+ MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
{ "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,
- MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL0", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM,
},
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
{ "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,
- MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL0", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL3", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL4", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL5", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL6", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL7", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
},
// MENUPAGE_NEW_GAME_RELOAD = 10
@@ -284,7 +270,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_CONTROLLER_PC = 35
{ "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_KEYBOARDCTRLS,"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,
@@ -333,11 +319,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_OPTIONS = 41
-#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,
@@ -347,13 +329,9 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_EXIT = 42
-#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_DONTCANCEL, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
},
@@ -412,9 +390,6 @@ const CMenuScreen aScreens[] = {
{ "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,
@@ -445,11 +420,19 @@ const CMenuScreen aScreens[] = {
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
+ // MENUPAGE_MISSION_RETRY = 57
+#ifdef MISSION_REPLAY
- // MENUPAGE_57 = 57
+ { "M_FAIL", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ MENUACTION_LABEL, "FESZ_RM", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
+ MENUACTION_REJECT_RETRY, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE
+ },
+#else
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
// mission failed, wanna restart page in mobile
},
+#endif
// MENUPAGE_58 = 58
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
@@ -464,3 +447,5 @@ const CMenuScreen aScreens[] = {
},
#endif
};
+
+#endif \ No newline at end of file
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 924d4724..7df548aa 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -8,6 +8,7 @@
#include "common.h"
#include "crossplatform.h"
+#include "platform.h"
#ifdef XINPUT
#include <xinput.h>
#pragma comment( lib, "Xinput9_1_0.lib" )
@@ -37,13 +38,27 @@
#include "Wanted.h"
#include "General.h"
+#ifdef GTA_PS2
+#include "eetypes.h"
+#include "libpad.h"
+#endif
+
CPad Pads[MAX_PADS];
+#ifdef GTA_PS2
+u_long128 pad_dma_buf[scePadDmaBufferMax] __attribute__((aligned(64)));
+u_long128 pad2_dma_buf[scePadDmaBufferMax] __attribute__((aligned(64)));
+#endif
+
CMousePointerStateHelper MousePointerStateHelper;
bool CPad::bDisplayNoControllerMessage;
bool CPad::bObsoleteControllerMessage;
bool CPad::bOldDisplayNoControllerMessage;
bool CPad::m_bMapPadOneToPadTwo;
+#ifdef GTA_PS2
+unsigned char act_direct[6];
+unsigned char act_align[6];
+#endif
CKeyboardState CPad::OldKeyState;
CKeyboardState CPad::NewKeyState;
@@ -99,7 +114,7 @@ void TankCheat()
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
@@ -329,15 +344,16 @@ void AltDodoCheat(void)
}
#endif
-#ifdef DETECT_PAD_INPUT_SWITCH
bool
-CControllerState::IsAnyButtonPressed(void)
+CControllerState::CheckForInput(void)
{
- return !!LeftStickX || !!LeftStickY || !!RightStickX || !!RightStickY || !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2 ||
- !!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight || !!Start || !!Select || !!Square || !!Triangle || !!Cross || !!Circle || !!LeftShock ||
- !!RightShock || !!NetworkTalk;
+ return !!RightStickX || !!RightStickY || !!LeftStickX || !!LeftStickY
+ || !!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight
+ || !!Triangle || !!Cross || !!Circle || !!Square
+ || !!Start || !!Select
+ || !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2
+ || !!LeftShock || !!RightShock;
}
-#endif
void
CControllerState::Clear(void)
@@ -353,24 +369,24 @@ CControllerState::Clear(void)
void CKeyboardState::Clear()
{
- for ( int32 i = 0; i < 12; i++ )
+ for ( int32 i = 0; i < ARRAY_SIZE(F); i++ )
F[i] = 0;
-
- for ( int32 i = 0; i < 256; i++ )
+
+ for ( int32 i = 0; i < ARRAY_SIZE(VK_KEYS); i++ )
VK_KEYS[i] = 0;
ESC = INS = DEL = HOME = END = PGUP = PGDN = 0;
-
+
UP = DOWN = LEFT = RIGHT = 0;
-
+
NUMLOCK = 0;
-
+
DIV = MUL = SUB = ADD = 0;
-
+
DECIMAL = NUM1 = NUM2 = NUM3 = NUM4 = 0;
-
+
NUM5 = NUM6 = NUM7 = NUM8 = 0;
-
+
NUM9 = NUM0 = SCROLLLOCK = PAUSE = 0;
BACKSP = TAB = CAPSLOCK = EXTENTER = 0;
@@ -383,15 +399,21 @@ void CKeyboardState::Clear()
#ifdef GTA_PS2_STUFF
void CPad::Initialise(void)
{
+#ifdef GTA_PS2
+ scePadInit(0);
+
+ scePadPortOpen(0, 0, pad_dma_buf );
+ scePadPortOpen(1, 0, pad2_dma_buf );
+#endif
for (int i = 0; i < MAX_PADS; i++)
{
CPad::GetPad(i)->Clear(true);
CPad::GetPad(i)->Mode = 0;
}
-
- bObsoleteControllerMessage = false;
+
+ bObsoleteControllerMessage = false;
bOldDisplayNoControllerMessage = false;
- bDisplayNoControllerMessage = false;
+ bDisplayNoControllerMessage = false;
}
#endif
@@ -399,37 +421,37 @@ void CPad::Clear(bool bResetPlayerControls)
{
NewState.Clear();
OldState.Clear();
-
+
PCTempKeyState.Clear();
PCTempJoyState.Clear();
PCTempMouseState.Clear();
-
+
NewKeyState.Clear();
OldKeyState.Clear();
TempKeyState.Clear();
-
+
NewMouseControllerState.Clear();
OldMouseControllerState.Clear();
PCTempMouseControllerState.Clear();
-
+
Phase = 0;
ShakeFreq = 0;
ShakeDur = 0;
-
+
if ( bResetPlayerControls )
DisablePlayerControls = PLAYERCONTROL_ENABLED;
-
+
bApplyBrakes = false;
-
-
+
+
for ( int32 i = 0; i < HORNHISTORY_SIZE; i++ )
bHornHistory[i] = false;
-
+
iCurrHornHistory = 0;
-
+
for ( int32 i = 0; i < ARRAY_SIZE(CheatString); i++ )
CheatString[i] = ' ';
-
+
LastTimeTouched = CTimer::GetTimeInMilliseconds();
AverageWeapon = 0;
AverageEntries = 0;
@@ -451,7 +473,7 @@ CMouseControllerState::CMouseControllerState()
WHEELDN = 0;
MXB1 = 0;
MXB2 = 0;
-
+
x = 0.0f;
y = 0.0f;
}
@@ -470,16 +492,16 @@ void CMouseControllerState::Clear()
CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
{
CMouseControllerState state;
-
+
#if defined RW_D3D9 || defined RWLIBS
if ( PSGLOBAL(mouse) == nil )
_InputInitialiseMouse();
-
+
if ( PSGLOBAL(mouse) != nil )
{
DIDEVCAPS devCaps;
devCaps.dwSize = sizeof(DIDEVCAPS);
-
+
PSGLOBAL(mouse)->GetCapabilities(&devCaps);
switch ( devCaps.dwButtons )
{
@@ -490,14 +512,14 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
case 7:
case 8:
state.MMB = true;
-
+
case 2:
state.RMB = true;
-
+
case 1:
state.LMB = true;
}
-
+
if ( devCaps.dwAxes == 3 )
{
state.WHEELDN = true;
@@ -523,14 +545,14 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
void CPad::UpdateMouse()
{
+#if defined RW_D3D9 || defined RWLIBS
if ( IsForegroundApp() )
{
-#if defined RW_D3D9 || defined RWLIBS
if ( PSGLOBAL(mouse) == nil )
_InputInitialiseMouse();
-
+
DIMOUSESTATE2 state;
-
+
if ( PSGLOBAL(mouse) != nil && SUCCEEDED(_InputGetMouseState(&state)) )
{
int32 signX = 1;
@@ -543,9 +565,9 @@ void CPad::UpdateMouse()
if ( MousePointerStateHelper.bInvertHorizontally )
signX = -1;
}
-
+
PCTempMouseControllerState.Clear();
-
+
PCTempMouseControllerState.x = (float)(signX * state.lX);
PCTempMouseControllerState.y = (float)(signy * state.lY);
PCTempMouseControllerState.LMB = state.rgbButtons[0] & 128;
@@ -553,16 +575,19 @@ void CPad::UpdateMouse()
PCTempMouseControllerState.MMB = state.rgbButtons[2] & 128;
PCTempMouseControllerState.MXB1 = state.rgbButtons[3] & 128;
PCTempMouseControllerState.MXB2 = state.rgbButtons[4] & 128;
-
+
if ( state.lZ > 0 )
PCTempMouseControllerState.WHEELUP = 1;
else if ( state.lZ < 0 )
PCTempMouseControllerState.WHEELDN = 1;
-
+
OldMouseControllerState = NewMouseControllerState;
NewMouseControllerState = PCTempMouseControllerState;
}
+ }
#else
+ if ( IsForegroundApp() && PSGLOBAL(cursorIsInWindow) )
+ {
double xpos = 1.0f, ypos;
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
if (xpos == 0.f)
@@ -600,19 +625,19 @@ void CPad::UpdateMouse()
OldMouseControllerState = NewMouseControllerState;
NewMouseControllerState = PCTempMouseControllerState;
-#endif
}
+#endif
}
CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &State1, CControllerState const &State2)
{
static CControllerState ReconState;
-
+
ReconState.Clear();
#define _RECONCILE_BUTTON(button) \
{ if ( State1.button || State2.button ) ReconState.button = 255; }
-
+
#define _RECONCILE_AXIS_POSITIVE(axis) \
{ if ( State1.axis >= 0 && State2.axis >= 0 ) ReconState.axis = Max(State1.axis, State2.axis); }
@@ -621,10 +646,10 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
#define _RECONCILE_AXIS(axis) \
{ _RECONCILE_AXIS_POSITIVE(axis); _RECONCILE_AXIS_NEGATIVE(axis); }
-
+
#define _FIX_AXIS_DIR(axis) \
{ if ( State1.axis > 0 && State2.axis < 0 || State1.axis < 0 && State2.axis > 0 ) ReconState.axis = 0; }
-
+
#define _FIX_RECON_DIR(pos, neg, axis) \
{ if ( (ReconState.pos || ReconState.axis < 0) && (ReconState.neg || ReconState.axis > 0) ) { ReconState.pos = 0; ReconState.neg = 0; ReconState.axis = 0; } }
@@ -657,7 +682,7 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
_FIX_RECON_DIR(DPadLeft, DPadRight, LeftStickX);
return ReconState;
-
+
#undef _RECONCILE_BUTTON
#undef _RECONCILE_AXIS_POSITIVE
#undef _RECONCILE_AXIS_NEGATIVE
@@ -670,17 +695,17 @@ void CPad::StartShake(int16 nDur, uint8 nFreq)
{
if ( !CMenuManager::m_PrefsUseVibration )
return;
-
+
if ( CCutsceneMgr::IsRunning() || CGame::playingIntro )
return;
-
+
if ( nFreq == 0 )
{
ShakeDur = 0;
ShakeFreq = 0;
return;
}
-
+
if ( nDur > ShakeDur )
{
ShakeDur = nDur;
@@ -692,12 +717,12 @@ void CPad::StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, floa
{
if ( !CMenuManager::m_PrefsUseVibration )
return;
-
+
if ( CCutsceneMgr::IsRunning() || CGame::playingIntro )
return;
-
+
float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, fZ) ).Magnitude();
-
+
if ( fDist < 70.0f )
{
if ( nFreq == 0 )
@@ -706,7 +731,7 @@ void CPad::StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, floa
ShakeFreq = 0;
return;
}
-
+
if ( nDur > ShakeDur )
{
ShakeDur = nDur;
@@ -719,15 +744,15 @@ void CPad::StartShake_Train(float fX, float fY)
{
if ( !CMenuManager::m_PrefsUseVibration )
return;
-
+
if ( CCutsceneMgr::IsRunning() || CGame::playingIntro )
return;
-
+
if (FindPlayerVehicle() != nil && FindPlayerVehicle()->IsTrain() )
return;
-
+
float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, 0.0f) ).Magnitude2D();
-
+
if ( fDist < 70.0f )
{
int32 freq = (int32)((70.0f - fDist) * 70.0f / 70.0f + 30.0f);
@@ -745,10 +770,10 @@ void CPad::AddToCheatString(char c)
{
for ( int32 i = ARRAY_SIZE(CheatString) - 2; i >= 0; i-- )
CheatString[i + 1] = CheatString[i];
-
+
CheatString[0] = c;
-#define _CHEATCMP(str) strncmp(str, CheatString, sizeof(str)-1)
+#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();
@@ -756,11 +781,11 @@ void CPad::AddToCheatString(char c)
// "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();
@@ -768,59 +793,59 @@ void CPad::AddToCheatString(char c)
// "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();
@@ -828,15 +853,15 @@ void CPad::AddToCheatString(char c)
// "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();
@@ -848,11 +873,11 @@ void CPad::AddToPCCheatString(char c)
{
for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- )
KeyBoardCheatString[i + 1] = KeyBoardCheatString[i];
-
+
KeyBoardCheatString[0] = c;
-
+
#define _CHEATCMP(str) strncmp(str, KeyBoardCheatString, sizeof(str)-1)
-
+
// "GUNSGUNSGUNS"
if ( !_CHEATCMP("SNUGSNUGSNUG") )
WeaponCheat();
@@ -860,93 +885,93 @@ void CPad::AddToPCCheatString(char c)
// "IFIWEREARICHMAN"
if ( !_CHEATCMP("NAMHCIRAEREWIFI") )
MoneyCheat();
-
+
// "GESUNDHEIT"
if ( !_CHEATCMP("TIEHDNUSEG") )
HealthCheat();
-
+
// "MOREPOLICEPLEASE"
if ( !_CHEATCMP("ESAELPECILOPEROM") )
WantedLevelUpCheat();
-
+
// "NOPOLICEPLEASE"
if ( !_CHEATCMP("ESAELPECILOPON") )
WantedLevelDownCheat();
-
+
// "GIVEUSATANK"
if ( !_CHEATCMP("KNATASUEVIG") )
TankCheat();
-
+
// "BANGBANGBANG"
if ( !_CHEATCMP("GNABGNABGNAB") )
BlowUpCarsCheat();
-
+
// "ILIKEDRESSINGUP"
if ( !_CHEATCMP("PUGNISSERDEKILI") )
ChangePlayerCheat();
-
+
// "ITSALLGOINGMAAAD"
if ( !_CHEATCMP("DAAAMGNIOGLLASTI") )
MayhemCheat();
-
+
// "NOBODYLIKESME"
if ( !_CHEATCMP("EMSEKILYDOBON") )
EverybodyAttacksPlayerCheat();
-
+
// "WEAPONSFORALL"
if ( !_CHEATCMP("LLAROFSNOPAEW") )
WeaponsForAllCheat();
-
+
// "TIMEFLIESWHENYOU"
if ( !_CHEATCMP("UOYNEHWSEILFEMIT") )
FastTimeCheat();
-
+
// "BOOOOORING"
if ( !_CHEATCMP("GNIROOOOOB") )
SlowTimeCheat();
-
+
#ifndef GTA3_1_1_PATCH
// "TURTOISE"
if ( !_CHEATCMP("ESIOTRUT") )
ArmourCheat();
-#else
+#else
// "TORTOISE"
if ( !_CHEATCMP("ESIOTROT") )
ArmourCheat();
#endif
-
+
// "SKINCANCERFORME"
if ( !_CHEATCMP("EMROFRECNACNIKS") )
SunnyWeatherCheat();
-
+
// "ILIKESCOTLAND"
if ( !_CHEATCMP("DNALTOCSEKILI") )
CloudyWeatherCheat();
-
+
// "ILOVESCOTLAND"
if ( !_CHEATCMP("DNALTOCSEVOLI") )
RainyWeatherCheat();
-
+
// "PEASOUP"
if ( !_CHEATCMP("PUOSAEP") )
FoggyWeatherCheat();
-
+
// "MADWEATHER"
if ( !_CHEATCMP("REHTAEWDAM") )
FastWeatherCheat();
-
+
// "ANICESETOFWHEELS"
if ( !_CHEATCMP("SLEEHWFOTESECINA") )
OnlyRenderWheelsCheat();
-
+
// "CHITTYCHITTYBB"
if ( !_CHEATCMP("BBYTTIHCYTTIHC") )
ChittyChittyBangBangCheat();
-
+
// "CORNERSLIKEMAD"
if ( !_CHEATCMP("DAMEKILSRENROC") )
StrongGripCheat();
-
+
// "NASTYLIMBSCHEAT"
if ( !_CHEATCMP("TAEHCSBMILYTSAN") )
NastyLimbsCheat();
@@ -974,7 +999,7 @@ void CPad::AddToPCCheatString(char c)
if (!_CHEATCMP("ODODRETSAMOTTNAWI"))
AltDodoCheat();
#endif
-
+
#undef _CHEATCMP
}
@@ -1025,7 +1050,7 @@ void CPad::AffectFromXinput(uint32 pad)
uint16 iLeftMotor = (uint16)((float)ShakeFreq / 255.0f * (float)0xffff);
uint16 iRightMotor = (uint16)((float)ShakeFreq / 255.0f * (float)0xffff);
-
+
if (ShakeDur < CTimer::GetTimeStepInMilliseconds())
ShakeDur = 0;
else
@@ -1040,19 +1065,26 @@ void CPad::AffectFromXinput(uint32 pad)
}
#endif
-void CPad::UpdatePads(void)
+void CPad::UpdatePads(void)
{
bool bUpdate = true;
-
+
GetPad(0)->UpdateMouse();
#ifdef XINPUT
- GetPad(0)->AffectFromXinput(0);
- GetPad(1)->AffectFromXinput(1);
+ GetPad(0)->AffectFromXinput(m_bMapPadOneToPadTwo ? 1 : 0);
+ GetPad(1)->AffectFromXinput(m_bMapPadOneToPadTwo ? 0 : 1);
#else
CapturePad(0);
#endif
+
+ // Improve keyboard input latency part 1
+#ifdef FIX_BUGS
+ OldKeyState = NewKeyState;
+ NewKeyState = TempKeyState;
+#endif
+
#ifdef DETECT_PAD_INPUT_SWITCH
- if (GetPad(0)->PCTempJoyState.IsAnyButtonPressed())
+ if (GetPad(0)->PCTempJoyState.CheckForInput())
IsAffectedByController = true;
else {
#endif
@@ -1062,13 +1094,13 @@ void CPad::UpdatePads(void)
#ifdef DETECT_PAD_INPUT_SWITCH
}
- if (IsAffectedByController && (GetPad(0)->PCTempKeyState.IsAnyButtonPressed() || GetPad(0)->PCTempMouseState.IsAnyButtonPressed()))
+ if (IsAffectedByController && (GetPad(0)->PCTempKeyState.CheckForInput() || GetPad(0)->PCTempMouseState.CheckForInput()))
IsAffectedByController = false;
#endif
-
+
if ( CReplay::IsPlayingBackFromFile() )
bUpdate = false;
-
+
if ( bUpdate )
{
GetPad(0)->Update(0);
@@ -1079,9 +1111,12 @@ void CPad::UpdatePads(void)
GetPad(1)->NewState.Clear();
GetPad(1)->OldState.Clear();
#endif
-
+
+ // Improve keyboard input latency part 2
+#ifndef FIX_BUGS
OldKeyState = NewKeyState;
NewKeyState = TempKeyState;
+#endif
}
void CPad::ProcessPCSpecificStuff(void)
@@ -1089,12 +1124,269 @@ void CPad::ProcessPCSpecificStuff(void)
;
}
-void CPad::Update(int16 unk)
+void CPad::Update(int16 pad)
{
OldState = NewState;
-
+
+#ifdef GTA_PS2
+ bObsoleteControllerMessage = false;
+
+ //int iPressureBtn;
+ int id;
+ int ext_id=0;
+ int state;
+ int rterm_id = 0;
+ unsigned short paddata, tpad;
+ unsigned char rdata[32];
+
+ state = scePadGetState(pad, 0);
+
+ switch(Phase)
+ {
+ case 0:
+ if (state != scePadStateStable && state != scePadStateFindCTP1)
+ break;
+ id = scePadInfoMode(pad, 0, InfoModeCurID, 0);
+ if (id==0) break;
+
+ ext_id = scePadInfoMode(pad, 0, InfoModeCurExID, 0);
+ if (ext_id>0) id = ext_id;
+
+ switch(id)
+ {
+ case 4: // Digital controller
+ Phase = 40; // Try for analog(dualshock)
+ break;
+ case 7: // Dualshock2 controller
+ Phase = 50;
+ break;
+ default:
+ Phase = 99;
+ break;
+ }
+ break;
+
+ // Analog Controller (old dualshock)
+ case 40: // Analog Contoller check valid (otherwise fail phase)
+ if (scePadInfoMode(pad, 0, InfoModeIdTable, -1)==0)
+ {
+ Phase = 99;
+ break;
+ }
+ Phase++;
+
+ case 41: // Analog controller: Request Lock analog mode (asynchronous)
+ if (scePadSetMainMode(pad, 0, 1, 3)==1) Phase++;
+ break;
+
+ case 42: // Analog controller: Check state of previous request
+ if (scePadGetReqState(pad, 0)==scePadReqStateFaild)
+ {
+ Phase--;
+ }
+
+ if (scePadGetReqState(pad, 0)==scePadReqStateComplete)
+ {
+ // Lock mode complete
+ Phase=0; // Accept normal dualshock
+ }
+ break;
+
+ // DualShock 2 Controller
+ case 50: // Analog Contoller check valid (otherwise fail phase)
+ if (scePadInfoMode(pad, 0, InfoModeIdTable, -1)==0)
+ {
+ Phase = 99;
+ break;
+ }
+ Phase++;
+
+ case 51: // Analog controller: Request Lock analog mode (asynchronous)
+ if (scePadSetMainMode(pad, 0, 1, 3)==1) Phase++;
+ break;
+
+ case 52: // Analog controller: Check state of previous request
+ if (scePadGetReqState(pad, 0)==scePadReqStateFaild)
+ {
+ Phase--;
+ }
+
+ if (scePadGetReqState(pad, 0)==scePadReqStateComplete)
+ {
+ // Lock mode complete
+ Phase=0; // Accept normal dualshock
+ }
+ break;
+
+ case 70: // DualShock 2 check pressure sensitive possible
+ if (scePadInfoPressMode(pad, 0)==1)
+ {
+ Phase = 76;
+ break;
+ }
+ Phase = 99;
+ break;
+
+ case 76: // DualShock2 enable pressure sensitive mode (asynchronous function)
+ if (scePadEnterPressMode(pad, 0)==1) Phase++;
+ break;
+
+ case 77: // Dualshock2 check status of request pressure sensitive mode
+ if (scePadGetReqState(pad, 0)==scePadReqStateFaild) Phase--;
+ if (scePadGetReqState(pad, 0)==scePadReqStateComplete)
+ {
+ Phase=80;
+ }
+ break;
+
+ // DualShock 2 Controller
+ case 80: // Set motors
+ if (scePadInfoAct(pad, 0, -1, 0)==0)
+ {
+ Phase = 99;
+ }
+
+ act_align[0] = 0; // Offset 0 for motor0
+ act_align[1] = 1; // Offset 1 for motor1
+
+ act_align[2] = 0xff;
+ act_align[3] = 0xff;
+ act_align[4] = 0xff;
+ act_align[5] = 0xff;
+
+ // Asynchronous function
+ if (scePadSetActAlign(pad, 0, act_align)==0) break;
+ Phase++;
+ break;
+
+
+ case 81:
+ if ( scePadGetState(pad, 0) != scePadStateExecCmd )
+ {
+ Phase = 99;
+ }
+
+ break;
+
+ default:
+ if ( state == scePadStateError ) break;
+
+ if ( state == scePadStateStable || state == scePadStateFindCTP1 )
+ {
+ if ( ShakeDur )
+ {
+ ShakeDur = Max(ShakeDur - CTimer::GetTimeStepInMilliseconds(), 0);
+
+ if ( ShakeDur == 0 )
+ {
+ act_direct[0] = 0;
+ act_direct[1] = 0;
+ scePadSetActDirect(pad, 0, act_direct);
+ }
+ else
+ {
+ act_direct[0] = 0;
+ act_direct[1] = (unsigned char) ShakeFreq;
+ scePadSetActDirect(pad, 0, act_direct);
+ }
+ }
+
+ if (scePadRead( pad, 0, rdata )==0)
+ {
+ NewState.Clear();
+ break;
+ }
+
+ if ((rdata[0] == 0))
+ {
+ paddata = (unsigned short) ( 0xffff ^ ((rdata[2]<<8)|rdata[3]) );
+ rterm_id = (rdata[1]);
+
+ if ( (rterm_id>>4) == 7 ) // DUALSHOCK
+ {
+ if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(pad))
+ {
+ tpad = paddata;
+
+ NewState.DPadUp = ( tpad & SCE_PADLup ) ? 255 : 0;
+ NewState.DPadDown = ( tpad & SCE_PADLdown ) ? 255 : 0;
+ NewState.DPadLeft = ( tpad & SCE_PADLleft ) ? 255 : 0;
+ NewState.DPadRight = ( tpad & SCE_PADLright ) ? 255 : 0;
+ NewState.Triangle = ( tpad & SCE_PADRup ) ? 255 : 0;
+ NewState.Cross = ( tpad & SCE_PADRdown ) ? 255 : 0;
+ NewState.Square = ( tpad & SCE_PADRleft ) ? 255 : 0;
+ NewState.Circle = ( tpad & SCE_PADRright ) ? 255 : 0;
+ NewState.Start = ( tpad & SCE_PADstart ) ? 255 : 0;
+ NewState.Select = ( tpad & SCE_PADselect ) ? 255 : 0;
+ NewState.LeftShoulder1 = ( tpad & SCE_PADL1 ) ? 255 : 0;
+ NewState.LeftShoulder2 = ( tpad & SCE_PADL2 ) ? 255 : 0;
+ NewState.RightShoulder1 = ( tpad & SCE_PADR1 ) ? 255 : 0;
+ NewState.RightShoulder2 = ( tpad & SCE_PADR2 ) ? 255 : 0;
+ NewState.LeftShock = ( tpad & SCE_PADi ) ? 255 : 0;
+ NewState.RightShock = ( tpad & SCE_PADj ) ? 255 : 0;
+ NewState.RightStickX = (short)rdata[4];
+ NewState.RightStickY = (short)rdata[5];
+ NewState.LeftStickX = (short)rdata[6];
+ NewState.LeftStickY = (short)rdata[7];
+
+ #define CLAMP_AXIS(x) (((x) < 43 && (x) >= -42) ? 0 : (((x) > 0) ? (Max((x)-42, 0)*127/85) : Min((x)+42, 0)*127/85))
+ #define FIX_AXIS(x) CLAMP_AXIS((x)-128)
+
+ NewState.RightStickX = FIX_AXIS(NewState.RightStickX);
+ NewState.RightStickY = FIX_AXIS(NewState.RightStickY);
+ NewState.LeftStickX = FIX_AXIS(NewState.LeftStickX);
+ NewState.LeftStickY = FIX_AXIS(NewState.LeftStickY);
+
+ #undef FIX_AXIS
+ #undef CLAMP_AXIS
+ }
+ }
+ else if ( (rterm_id>>4) == 4 ) // Controller (digital)
+ {
+ if ( pad == 0 )
+ bObsoleteControllerMessage = true;
+ NewState.Clear();
+ }
+
+ if ( NewState.IsAnyButtonPressed() )
+ LastTimeTouched = CTimer::GetTimeInMilliseconds();
+
+ break;
+ }
+
+ if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
+ iCurrHornHistory = 0;
+
+ bHornHistory[iCurrHornHistory] = GetHorn();
+ NewState.Clear();
+ return;
+ }
+ break;
+ }
+
+ if ( pad == 0 )
+ {
+ bOldDisplayNoControllerMessage = bDisplayNoControllerMessage;
+ if ( state == scePadStateDiscon )
+ {
+ bDisplayNoControllerMessage = true;
+ Phase = 0;
+ }
+ else
+ bDisplayNoControllerMessage = false;
+ }
+
+ if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
+ iCurrHornHistory = 0;
+
+ bHornHistory[iCurrHornHistory] = GetHorn();
+
+ if ( !bDisplayNoControllerMessage )
+ CGame::bDemoMode = false;
+#endif
+
#if (defined GTA_PS2 || defined FIX_BUGS)
- if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(unk))
+ if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(pad))
#endif
{
NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
@@ -1104,9 +1396,9 @@ void CPad::Update(int16 unk)
PCTempJoyState.Clear();
PCTempKeyState.Clear();
PCTempMouseState.Clear();
-
+
ProcessPCSpecificStuff();
-
+
if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
iCurrHornHistory = 0;
@@ -1130,37 +1422,37 @@ void CPad::DoCheats(int16 unk)
#ifdef GTA_PS2_STUFF
if ( GetTriangleJustDown() )
AddToCheatString('T');
-
+
if ( GetCircleJustDown() )
AddToCheatString('C');
-
+
if ( GetCrossJustDown() )
AddToCheatString('X');
-
+
if ( GetSquareJustDown() )
AddToCheatString('S');
-
+
if ( GetDPadUpJustDown() )
AddToCheatString('U');
-
+
if ( GetDPadDownJustDown() )
AddToCheatString('D');
-
+
if ( GetDPadLeftJustDown() )
AddToCheatString('L');
-
+
if ( GetDPadRightJustDown() )
AddToCheatString('R');
-
+
if ( GetLeftShoulder1JustDown() )
AddToCheatString('1');
-
+
if ( GetLeftShoulder2JustDown() )
AddToCheatString('2');
-
+
if ( GetRightShoulder1JustDown() )
AddToCheatString('3');
-
+
if ( GetRightShoulder2JustDown() )
AddToCheatString('4');
#endif
@@ -1171,9 +1463,22 @@ void CPad::StopPadsShaking(void)
GetPad(0)->StopShaking(0);
}
-void CPad::StopShaking(int16 unk)
+void CPad::StopShaking(int16 pad)
{
- ;
+#ifdef GTA_PS2_STUFF
+ ShakeFreq = 0;
+ ShakeDur = 0;
+
+#ifdef GTA_PS2
+ if ( Phase == 99 )
+ {
+ act_direct[0] = 0;
+ act_direct[1] = 0;
+ scePadSetActDirect(pad, 0, act_direct);
+ }
+#endif
+
+#endif
}
CPad *CPad::GetPad(int32 pad)
@@ -1199,15 +1504,15 @@ int16 CPad::GetSteeringLeftRight(void)
{
int16 axis = NewState.LeftStickX;
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
-
+
if ( Abs(axis) > Abs(dpad) )
return axis;
else
return dpad;
-
+
break;
}
-
+
case 1:
case 3:
{
@@ -1216,7 +1521,7 @@ int16 CPad::GetSteeringLeftRight(void)
break;
}
}
-
+
return 0;
}
@@ -1232,15 +1537,15 @@ int16 CPad::GetSteeringUpDown(void)
{
int16 axis = NewState.LeftStickY;
int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2;
-
+
if ( Abs(axis) > Abs(dpad) )
return axis;
else
return dpad;
-
+
break;
}
-
+
case 1:
case 3:
{
@@ -1249,7 +1554,7 @@ int16 CPad::GetSteeringUpDown(void)
break;
}
}
-
+
return 0;
}
@@ -1265,18 +1570,18 @@ int16 CPad::GetCarGunUpDown(void)
case 2:
{
return NewState.RightStickY;
-
+
break;
}
-
+
case 3:
{
return (NewState.DPadUp - NewState.DPadDown) / 2;
-
+
break;
}
}
-
+
return 0;
}
@@ -1292,18 +1597,18 @@ int16 CPad::GetCarGunLeftRight(void)
case 2:
{
return NewState.RightStickX;
-
+
break;
}
-
+
case 3:
{
return (NewState.DPadRight - NewState.DPadLeft) / 2;
-
+
break;
}
}
-
+
return 0;
}
@@ -1319,15 +1624,15 @@ int16 CPad::GetPedWalkLeftRight(void)
{
int16 axis = NewState.LeftStickX;
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
-
+
if ( Abs(axis) > Abs(dpad) )
return axis;
else
return dpad;
-
+
break;
}
-
+
case 1:
case 3:
{
@@ -1336,7 +1641,7 @@ int16 CPad::GetPedWalkLeftRight(void)
break;
}
}
-
+
return 0;
}
@@ -1353,15 +1658,15 @@ int16 CPad::GetPedWalkUpDown(void)
{
int16 axis = NewState.LeftStickY;
int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2;
-
+
if ( Abs(axis) > Abs(dpad) )
return axis;
else
return dpad;
-
+
break;
}
-
+
case 1:
case 3:
{
@@ -1370,7 +1675,7 @@ int16 CPad::GetPedWalkUpDown(void)
break;
}
}
-
+
return 0;
}
@@ -1383,15 +1688,15 @@ int16 CPad::GetAnalogueUpDown(void)
{
int16 axis = NewState.LeftStickY;
int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2;
-
+
if ( Abs(axis) > Abs(dpad) )
return axis;
else
return dpad;
-
+
break;
}
-
+
case 1:
case 3:
{
@@ -1400,7 +1705,7 @@ int16 CPad::GetAnalogueUpDown(void)
break;
}
}
-
+
return 0;
}
@@ -1408,7 +1713,7 @@ bool CPad::GetLookLeft(void)
{
if ( ArePlayerControlsDisabled() )
return false;
-
+
return !!(NewState.LeftShoulder2 && !NewState.RightShoulder2);
}
@@ -1450,21 +1755,21 @@ bool CPad::GetHorn(void)
break;
}
-
+
case 1:
{
return !!NewState.LeftShoulder1;
break;
}
-
+
case 2:
{
return !!NewState.RightShoulder1;
break;
}
-
+
case 3:
{
return !!NewState.LeftShock;
@@ -1472,7 +1777,7 @@ bool CPad::GetHorn(void)
break;
}
}
-
+
return false;
}
@@ -1489,21 +1794,21 @@ bool CPad::HornJustDown(void)
break;
}
-
+
case 1:
{
return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1);
break;
}
-
+
case 2:
{
return !!(NewState.RightShoulder1 && !OldState.RightShoulder1);
break;
}
-
+
case 3:
{
return !!(NewState.LeftShock && !OldState.LeftShock);
@@ -1511,7 +1816,7 @@ bool CPad::HornJustDown(void)
break;
}
}
-
+
return false;
}
@@ -1531,7 +1836,7 @@ bool CPad::GetCarGunFired(void)
break;
}
-
+
case 3:
{
return !!NewState.RightShoulder1;
@@ -1539,7 +1844,7 @@ bool CPad::GetCarGunFired(void)
break;
}
}
-
+
return false;
}
@@ -1558,7 +1863,7 @@ bool CPad::CarGunJustDown(void)
break;
}
-
+
case 3:
{
return !!(NewState.RightShoulder1 && !OldState.RightShoulder1);
@@ -1566,7 +1871,7 @@ bool CPad::CarGunJustDown(void)
break;
}
}
-
+
return false;
}
@@ -1581,25 +1886,25 @@ int16 CPad::GetHandBrake(void)
case 1:
{
return NewState.RightShoulder1;
-
+
break;
}
-
+
case 2:
{
return NewState.Triangle;
-
+
break;
}
-
+
case 3:
{
return NewState.LeftShoulder1;
-
+
break;
}
}
-
+
return 0;
}
@@ -1614,30 +1919,30 @@ int16 CPad::GetBrake(void)
case 2:
{
return NewState.Square;
-
+
break;
}
-
+
case 1:
{
return NewState.Square;
break;
}
-
+
case 3:
{
int16 axis = 2 * NewState.RightStickY;
-
+
if ( axis < 0 )
return 0;
else
return axis;
-
+
break;
}
}
-
+
return 0;
}
@@ -1653,18 +1958,18 @@ bool CPad::GetExitVehicle(void)
case 3:
{
return !!NewState.Triangle;
-
+
break;
}
-
+
case 2:
{
return !!NewState.LeftShoulder1;
-
+
break;
}
}
-
+
return false;
}
@@ -1680,18 +1985,18 @@ bool CPad::ExitVehicleJustDown(void)
case 3:
{
return !!(NewState.Triangle && !OldState.Triangle);
-
+
break;
}
-
+
case 2:
{
return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1);
-
+
break;
}
}
-
+
return false;
}
@@ -1706,25 +2011,25 @@ int32 CPad::GetWeapon(void)
case 1:
{
return NewState.Circle;
-
+
break;
}
-
+
case 2:
{
return NewState.Cross;
-
+
break;
}
-
+
case 3:
{
return NewState.RightShoulder1;
-
+
break;
}
}
-
+
return false;
}
@@ -1739,25 +2044,25 @@ bool CPad::WeaponJustDown(void)
case 1:
{
return !!(NewState.Circle && !OldState.Circle);
-
+
break;
}
-
+
case 2:
{
return !!(NewState.Cross && !OldState.Cross);
-
+
break;
}
-
+
case 3:
{
return !!(NewState.RightShoulder1 && !OldState.RightShoulder1);
-
+
break;
}
}
-
+
return false;
}
@@ -1772,30 +2077,30 @@ int16 CPad::GetAccelerate(void)
case 2:
{
return NewState.Cross;
-
+
break;
}
-
+
case 1:
{
return NewState.Cross;
-
+
break;
}
-
+
case 3:
{
int16 axis = -2 * NewState.RightStickY;
-
+
if ( axis < 0 )
return 0;
- else
+ else
return axis;
-
+
break;
}
}
-
+
return 0;
}
@@ -1808,18 +2113,18 @@ bool CPad::CycleCameraModeUpJustDown(void)
case 3:
{
return !!(NewState.Select && !OldState.Select);
-
+
break;
}
-
+
case 1:
{
return !!(NewState.DPadUp && !OldState.DPadUp);
-
+
break;
}
}
-
+
return false;
}
@@ -1832,18 +2137,18 @@ bool CPad::CycleCameraModeDownJustDown(void)
case 3:
{
return false;
-
+
break;
}
-
+
case 1:
{
return !!(NewState.DPadDown && !OldState.DPadDown);
-
+
break;
}
}
-
+
return false;
}
@@ -1857,32 +2162,32 @@ bool CPad::ChangeStationJustDown(void)
case 0:
{
return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1);
-
+
break;
}
-
+
case 1:
{
return !!(NewState.Select && !OldState.Select);
-
+
break;
}
-
+
case 2:
{
return !!(NewState.LeftShock && !OldState.LeftShock);
-
+
break;
}
-
+
case 3:
{
return !!(NewState.Circle && !OldState.Circle);
-
+
break;
}
}
-
+
return false;
}
@@ -1891,7 +2196,7 @@ bool CPad::CycleWeaponLeftJustDown(void)
{
if ( ArePlayerControlsDisabled() )
return false;
-
+
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
}
@@ -1915,18 +2220,18 @@ bool CPad::GetTarget(void)
case 2:
{
return !!NewState.RightShoulder1;
-
+
break;
}
-
+
case 3:
{
return !!NewState.LeftShoulder1;
-
+
break;
}
}
-
+
return false;
}
@@ -1942,18 +2247,18 @@ bool CPad::TargetJustDown(void)
case 2:
{
return !!(NewState.RightShoulder1 && !OldState.RightShoulder1);
-
+
break;
}
-
+
case 3:
{
return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1);
-
+
break;
}
}
-
+
return false;
}
@@ -1961,7 +2266,7 @@ bool CPad::JumpJustDown(void)
{
if ( ArePlayerControlsDisabled() )
return false;
-
+
return !!(NewState.Square && !OldState.Square);
}
@@ -1977,18 +2282,18 @@ bool CPad::GetSprint(void)
case 3:
{
return !!NewState.Cross;
-
+
break;
}
-
+
case 2:
{
return !!NewState.Circle;
-
+
break;
}
}
-
+
return false;
}
@@ -2011,9 +2316,9 @@ bool CPad::ShiftTargetRightJustDown(void)
bool CPad::GetAnaloguePadUp(void)
{
static int16 oldfStickY = 0;
-
+
int16 Y = CPad::GetPad(0)->GetAnalogueUpDown();
-
+
if ( Y < 0 && oldfStickY >= 0 )
{
oldfStickY = Y;
@@ -2029,9 +2334,9 @@ bool CPad::GetAnaloguePadUp(void)
bool CPad::GetAnaloguePadDown(void)
{
static int16 oldfStickY = 0;
-
+
int16 Y = CPad::GetPad(0)->GetAnalogueUpDown();
-
+
if ( Y > 0 && oldfStickY <= 0 )
{
oldfStickY = Y;
@@ -2047,9 +2352,9 @@ bool CPad::GetAnaloguePadDown(void)
bool CPad::GetAnaloguePadLeft(void)
{
static int16 oldfStickX = 0;
-
+
int16 X = CPad::GetPad(0)->GetPedWalkLeftRight();
-
+
if ( X < 0 && oldfStickX >= 0 )
{
oldfStickX = X;
@@ -2065,9 +2370,9 @@ bool CPad::GetAnaloguePadLeft(void)
bool CPad::GetAnaloguePadRight(void)
{
static int16 oldfStickX = 0;
-
+
int16 X = CPad::GetPad(0)->GetPedWalkLeftRight();
-
+
if ( X > 0 && oldfStickX <= 0 )
{
oldfStickX = X;
@@ -2083,19 +2388,19 @@ bool CPad::GetAnaloguePadRight(void)
bool CPad::GetAnaloguePadLeftJustUp(void)
{
static int16 oldfStickX = 0;
-
+
int16 X = GetPad(0)->GetPedWalkLeftRight();
-
+
if ( X == 0 && oldfStickX < 0 )
{
oldfStickX = X;
-
+
return true;
}
else
{
oldfStickX = X;
-
+
return false;
}
}
@@ -2103,19 +2408,19 @@ bool CPad::GetAnaloguePadLeftJustUp(void)
bool CPad::GetAnaloguePadRightJustUp(void)
{
static int16 oldfStickX = 0;
-
+
int16 X = GetPad(0)->GetPedWalkLeftRight();
-
+
if ( X == 0 && oldfStickX > 0 )
{
oldfStickX = X;
-
+
return true;
}
else
{
oldfStickX = X;
-
+
return false;
}
}
@@ -2131,25 +2436,25 @@ bool CPad::ForceCameraBehindPlayer(void)
case 1:
{
return !!NewState.LeftShoulder1;
-
+
break;
}
-
+
case 2:
{
return !!NewState.Triangle;
-
+
break;
}
-
+
case 3:
{
return !!NewState.Circle;
-
+
break;
}
}
-
+
return false;
}
@@ -2168,15 +2473,15 @@ bool CPad::SniperZoomIn(void)
break;
}
-
+
case 2:
{
return !!NewState.Triangle;
-
+
break;
}
}
-
+
return false;
}
@@ -2195,15 +2500,15 @@ bool CPad::SniperZoomOut(void)
break;
}
-
+
case 2:
{
return !!NewState.Square;
-
+
break;
}
}
-
+
return false;
}
@@ -2213,7 +2518,7 @@ int16 CPad::SniperModeLookLeftRight(void)
{
int16 axis = NewState.LeftStickX;
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
-
+
if ( Abs(axis) > Abs(dpad) )
return axis;
else
@@ -2227,7 +2532,7 @@ int16 CPad::SniperModeLookUpDown(void)
axis = -axis;
#endif
int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2;
-
+
if ( Abs(axis) > Abs(dpad) )
return axis;
else
@@ -2237,7 +2542,7 @@ int16 CPad::SniperModeLookUpDown(void)
int16 CPad::LookAroundLeftRight(void)
{
float axis = GetPad(0)->NewState.RightStickX;
-
+
if ( Abs(axis) > 85 && !GetLookBehindForPed() )
return (int16) ( (axis + ( ( axis > 0 ) ? -85 : 85) )
* (127.0f / 32.0f) ); // 3.96875f
@@ -2245,7 +2550,7 @@ int16 CPad::LookAroundLeftRight(void)
else if ( TheCamera.Cams[0].Using3rdPersonMouseCam() && Abs(axis) > 10 )
return (int16) ( (axis + ( ( axis > 0 ) ? -10 : 10) )
* (127.0f / 64.0f) ); // 1.984375f
-
+
return 0;
}
@@ -2311,40 +2616,40 @@ void CPad::PrintErrorMessage(void)
TheText.Get("WRCONT") // The controller connected to controller port 1 is an unsupported controller. Grand Theft Auto III requires an analog controller (DUALSHOCK@) or analog controller (DUALSHOCK@2).
);
}
-
+
}
void LittleTest(void)
{
static int32 Cunt = 0;
-
+
Cunt++; // ???
}
void CPad::ResetCheats(void)
{
CWeather::ReleaseWeather();
-
+
CPopulation::ms_bGivePedsWeapons = false;
-
+
CPed::bNastyLimbsCheat = false;
CPed::bPedCheat2 = false;
CPed::bPedCheat3 = false;
-
+
CVehicle::bWheelsOnlyCheat = false;
CVehicle::bAllDodosCheat = false;
CVehicle::bCheat3 = false;
CVehicle::bCheat4 = false;
CVehicle::bCheat5 = false;
-
+
gbFastTime = false;
CTimer::SetTimeScale(1.0f);
}
char *CPad::EditString(char *pStr, int32 nSize)
{
- int32 pos = strlen(pStr);
-
+ int32 pos = (int32)strlen(pStr);
+
// letters
for ( int32 i = 0; i < ('Z' - 'A' + 1); i++ )
{
@@ -2353,15 +2658,15 @@ char *CPad::EditString(char *pStr, int32 nSize)
pStr[pos++] = i + 'A';
pStr[pos] = '\0';
}
-
+
if ( GetPad(0)->GetCharJustDown(i + 'a') && pos < nSize - 1 )
{
pStr[pos++] = i + 'a';
pStr[pos] = '\0';
}
}
-
- // numbers
+
+ // numbers
for ( int32 i = 0; i < ('9' - '0' + 1); i++ )
{
if ( GetPad(0)->GetCharJustDown(i + '0') && pos < nSize - 1 )
@@ -2370,15 +2675,15 @@ char *CPad::EditString(char *pStr, int32 nSize)
pStr[pos] = '\0';
}
}
-
+
// space
if ( GetPad(0)->GetCharJustDown(' ') && pos < nSize - 1 )
{
pStr[pos++] = ' ';
pStr[pos] = '\0';
}
-
-
+
+
// del
if ( GetPad(0)->GetDeleteJustDown() || GetPad(0)->GetBackspaceJustDown() )
{
@@ -2389,7 +2694,7 @@ char *CPad::EditString(char *pStr, int32 nSize)
// extenter/up/down
if ( GetPad(0)->GetReturnJustDown() || GetPad(0)->GetUpJustDown() || GetPad(0)->GetDownJustDown() )
return nil;
-
+
return pStr;
}
@@ -2402,64 +2707,64 @@ int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize)
if ( GetPad(0)->GetCharJustDown(i) )
*pRsKeys = i;
}
-
+
for ( int32 i = 0; i < 12; i++ )
{
if ( GetPad(0)->GetFJustDown(i) )
*pRsKeys = i + rsF1;
}
-
+
if ( GetPad(0)->GetEscapeJustDown() )
*pRsKeys = rsESC;
-
+
if ( GetPad(0)->GetInsertJustDown() )
*pRsKeys = rsINS;
-
+
if ( GetPad(0)->GetDeleteJustDown() )
*pRsKeys = rsDEL;
-
+
if ( GetPad(0)->GetHomeJustDown() )
*pRsKeys = rsHOME;
-
+
if ( GetPad(0)->GetEndJustDown() )
*pRsKeys = rsEND;
-
+
if ( GetPad(0)->GetPageUpJustDown() )
*pRsKeys = rsPGUP;
-
+
if ( GetPad(0)->GetPageDownJustDown() )
*pRsKeys = rsPGDN;
-
+
if ( GetPad(0)->GetUpJustDown() )
*pRsKeys = rsUP;
-
+
if ( GetPad(0)->GetDownJustDown() )
*pRsKeys = rsDOWN;
-
+
if ( GetPad(0)->GetLeftJustDown() )
*pRsKeys = rsLEFT;
-
+
if ( GetPad(0)->GetRightJustDown() )
*pRsKeys = rsRIGHT;
-
+
if ( GetPad(0)->GetScrollLockJustDown() )
*pRsKeys = rsSCROLL;
-
+
if ( GetPad(0)->GetPauseJustDown() )
*pRsKeys = rsPAUSE;
-
+
if ( GetPad(0)->GetNumLockJustDown() )
*pRsKeys = rsNUMLOCK;
-
+
if ( GetPad(0)->GetDivideJustDown() )
*pRsKeys = rsDIVIDE;
-
+
if ( GetPad(0)->GetTimesJustDown() )
*pRsKeys = rsTIMES;
-
+
if ( GetPad(0)->GetMinusJustDown() )
*pRsKeys = rsMINUS;
-
+
if ( GetPad(0)->GetPlusJustDown() )
*pRsKeys = rsPLUS;
@@ -2471,75 +2776,75 @@ int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize)
if ( GetPad(0)->GetPad1JustDown() )
*pRsKeys = rsPADEND;
-
+
if ( GetPad(0)->GetPad2JustDown() )
*pRsKeys = rsPADDOWN;
-
+
if ( GetPad(0)->GetPad3JustDown() )
*pRsKeys = rsPADPGDN;
-
+
if ( GetPad(0)->GetPad4JustDown() )
*pRsKeys = rsPADLEFT;
-
+
if ( GetPad(0)->GetPad5JustDown() )
*pRsKeys = rsPAD5;
-
+
if ( GetPad(0)->GetPad6JustDown() )
*pRsKeys = rsPADRIGHT;
-
+
if ( GetPad(0)->GetPad7JustDown() )
*pRsKeys = rsPADHOME;
-
+
if ( GetPad(0)->GetPad8JustDown() )
*pRsKeys = rsPADUP;
-
+
if ( GetPad(0)->GetPad9JustDown() )
*pRsKeys = rsPADPGUP;
-
+
if ( GetPad(0)->GetPad0JustDown() )
*pRsKeys = rsPADINS;
if ( GetPad(0)->GetBackspaceJustDown() )
*pRsKeys = rsBACKSP;
-
+
if ( GetPad(0)->GetTabJustDown() )
*pRsKeys = rsTAB;
-
+
if ( GetPad(0)->GetCapsLockJustDown() )
*pRsKeys = rsCAPSLK;
-
+
if ( GetPad(0)->GetReturnJustDown() )
*pRsKeys = rsENTER;
-
+
if ( GetPad(0)->GetLeftShiftJustDown() )
*pRsKeys = rsLSHIFT;
-
+
if ( GetPad(0)->GetShiftJustDown() )
*pRsKeys = rsSHIFT;
-
+
if ( GetPad(0)->GetRightShiftJustDown() )
*pRsKeys = rsRSHIFT;
-
+
if ( GetPad(0)->GetLeftCtrlJustDown() )
*pRsKeys = rsLCTRL;
-
+
if ( GetPad(0)->GetRightCtrlJustDown() )
*pRsKeys = rsRCTRL;
-
+
if ( GetPad(0)->GetLeftAltJustDown() )
*pRsKeys = rsLALT;
-
+
if ( GetPad(0)->GetRightAltJustDown() )
*pRsKeys = rsRALT;
-
+
if ( GetPad(0)->GetLeftWinJustDown() )
*pRsKeys = rsLWIN;
-
+
if ( GetPad(0)->GetRightWinJustDown() )
*pRsKeys = rsRWIN;
-
+
if ( GetPad(0)->GetAppsJustDown() )
*pRsKeys = rsAPPS;
-
+
return pRsKeys;
}
diff --git a/src/core/Pad.h b/src/core/Pad.h
index ea771f81..8c3bc752 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -2,14 +2,14 @@
enum {
PLAYERCONTROL_ENABLED = 0,
- PLAYERCONTROL_DISABLED_1 = 1, // used by first person camera
- PLAYERCONTROL_DISABLED_2 = 2,
+ PLAYERCONTROL_CAMERA = 1,
+ PLAYERCONTROL_UNK2 = 2,
PLAYERCONTROL_GARAGE = 4,
- PLAYERCONTROL_DISABLED_8 = 8,
- PLAYERCONTROL_DISABLED_10 = 16,
- PLAYERCONTROL_DISABLED_20 = 32, // used on CPlayerInfo::MakePlayerSafe
- PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls
- PLAYERCONTROL_DISABLED_80 = 128,// used on cutscenes
+ PLAYERCONTROL_UNK8 = 8,
+ PLAYERCONTROL_UNK10 = 16,
+ PLAYERCONTROL_PLAYERINFO = 32,
+ PLAYERCONTROL_PHONE = 64,
+ PLAYERCONTROL_CUTSCENE = 128,
};
class CControllerState
@@ -29,9 +29,7 @@ public:
float GetRightStickX(void) { return RightStickX/32767.0f; };
float GetRightStickY(void) { return RightStickY/32767.0f; };
-#ifdef DETECT_PAD_INPUT_SWITCH
- bool IsAnyButtonPressed();
-#endif
+ bool CheckForInput();
void Clear(void);
};
VALIDATE_SIZE(CControllerState, 0x2A);
@@ -199,13 +197,13 @@ public:
static void UpdatePads(void);
void ProcessPCSpecificStuff(void);
- void Update(int16 unk);
+ void Update(int16 pad);
static void DoCheats(void);
void DoCheats(int16 unk);
static void StopPadsShaking(void);
- void StopShaking(int16 unk);
+ void StopShaking(int16 pad);
static CPad *GetPad(int32 pad);
@@ -444,6 +442,7 @@ public:
bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; }
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; }
+ bool GetStart() { return !!NewState.Start; }
int16 GetLeftStickX(void) { return NewState.LeftStickX; }
int16 GetLeftStickY(void) { return NewState.LeftStickY; }
int16 GetRightStickX(void) { return NewState.RightStickX; }
@@ -453,6 +452,11 @@ public:
void SetDisablePlayerControls(uint8 who) { DisablePlayerControls |= who; }
void SetEnablePlayerControls(uint8 who) { DisablePlayerControls &= ~who; }
bool IsPlayerControlsDisabledBy(uint8 who) { return DisablePlayerControls & who; }
+
+ int16 GetMode() { return Mode; }
+ void SetMode(int16 mode) { Mode = mode; }
+
+ static bool IsNoOrObsolete() { return bDisplayNoControllerMessage || bObsoleteControllerMessage; }
};
VALIDATE_SIZE(CPad, 0xFC);
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index 487f536f..09b3a499 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -174,7 +174,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
CTheScripts::ResetCountdownToMakePlayerUnsafe();
m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
CWorld::StopAllLawEnforcersInTheirTracks();
- CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20;
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
CPad::StopPadsShaking();
m_pPed->bBulletProof = true;
m_pPed->bFireProof = true;
@@ -194,7 +194,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
} else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
m_pPed->bBulletProof = false;
m_pPed->bFireProof = false;
m_pPed->bCollisionProof = false;
@@ -397,7 +397,7 @@ CPlayerInfo::Process(void)
else
enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();
- if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_ODE) {
+ if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) {
if (m_pPed->bInVehicle) {
if (!m_pRemoteVehicle) {
CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;
@@ -409,7 +409,7 @@ CPlayerInfo::Process(void)
if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
if (veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != 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);
+ m_pPed->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
}
}
} else {
@@ -553,7 +553,7 @@ CPlayerInfo::Process(void)
veh->m_nZoneLevel = LEVEL_IGNORE;
for (int i = 0; i < ARRAY_SIZE(veh->pPassengers); i++) {
if (veh->pPassengers[i])
- veh->pPassengers[i]->m_nZoneLevel = LEVEL_NONE;
+ veh->pPassengers[i]->m_nZoneLevel = LEVEL_GENERIC;
}
CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled;
} else {
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 17b9e08d..bd0814d0 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -4,6 +4,9 @@
#include "Boat.h"
#include "CarCtrl.h"
+#ifdef MISSION_REPLAY
+#include "GenericGameStorage.h"
+#endif
#include "Population.h"
#include "ProjectileInfo.h"
#include "Streaming.h"
@@ -206,11 +209,24 @@ INITSAVEBUF
if (pVehicle->pPassengers[j])
bHasPassenger = true;
}
+#ifdef MISSION_REPLAY
+ bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave;
+#ifdef FIX_BUGS
+ if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) {
+#else
+ if (!pVehicle->pDriver && !bHasPassenger) {
+#endif
+ if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
+ ++nNumCars;
+ if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
+ ++nNumBoats;
+#else
if (!pVehicle->pDriver && !bHasPassenger) {
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumCars;
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumBoats;
+#endif
}
}
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
@@ -226,23 +242,42 @@ INITSAVEBUF
if (pVehicle->pPassengers[j])
bHasPassenger = true;
}
+#ifdef MISSION_REPLAY
+ bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave;
+#endif
+#if defined FIX_BUGS && defined MISSION_REPLAY
+ if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) {
+#else
if (!pVehicle->pDriver && !bHasPassenger) {
+#endif
#ifdef COMPATIBLE_SAVES
+#ifdef MISSION_REPLAY
+ if ((pVehicle->IsCar() || pVehicle->IsBoat()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
WriteSaveBuf<int32>(buf, GetVehicleRef(pVehicle));
pVehicle->Save(buf);
}
#else
+#ifdef MISSION_REPLAY
+ if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
memcpy(buf, pVehicle, sizeof(CAutomobile));
SkipSaveBuf(buf, sizeof(CAutomobile));
}
+#ifdef MISSION_REPLAY
+ if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
@@ -400,7 +435,11 @@ INITSAVEBUF
CPed* pPed = GetPedPool()->GetSlot(i);
if (!pPed)
continue;
+#ifdef MISSION_REPLAY
+ if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1)
+#else
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1)
+#endif
nNumPeds++;
}
*size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + CPlayerPed::nSaveStructSize +
@@ -410,7 +449,11 @@ INITSAVEBUF
CPed* pPed = GetPedPool()->GetSlot(i);
if (!pPed)
continue;
+#ifdef MISSION_REPLAY
+ if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1) {
+#else
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) {
+#endif
CopyToBuf(buf, pPed->m_nPedType);
CopyToBuf(buf, pPed->m_modelIndex);
int32 ref = GetPedRef(pPed);
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 9406f1bd..05002a3f 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -746,8 +746,8 @@ void CRadar::DrawRadarMap()
DrawRadarMask();
// top left ist (0, 0)
- int x = floorf((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
- int y = ceilf((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
+ int x = Floor((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
+ int y = Ceil((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
StreamRadarSections(x, y);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
@@ -1251,7 +1251,7 @@ void CRadar::Shutdown()
void CRadar::StreamRadarSections(const CVector &posn)
{
- StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f));
+ StreamRadarSections(Floor((2000.0f + posn.x) / 500.0f), Ceil(7.0f - (2000.0f + posn.y) / 500.0f));
}
void CRadar::StreamRadarSections(int32 x, int32 y)
diff --git a/src/core/Range2D.cpp b/src/core/Range2D.cpp
new file mode 100644
index 00000000..33eafd0e
--- /dev/null
+++ b/src/core/Range2D.cpp
@@ -0,0 +1,28 @@
+#include "common.h"
+#include "Range2D.h"
+#include "General.h"
+
+CRange2D::CRange2D(CVector2D _min, CVector2D _max) : min(_min), max(_max) {}
+
+bool
+CRange2D::IsInRange(CVector2D vec)
+{
+ return min.x < vec.x && max.x > vec.x && min.y < vec.y && max.y > vec.y;
+}
+
+void
+CRange2D::DebugShowRange(float, int)
+{
+}
+
+CVector2D
+CRange2D::GetRandomPointInRange()
+{
+ int distX = Abs(max.x - min.x);
+ int distY = Abs(max.y - min.y);
+
+ float outX = CGeneral::GetRandomNumber() % distX + min.x;
+ float outY = CGeneral::GetRandomNumber() % distY + min.y;
+
+ return CVector2D(outX, outY);
+}
diff --git a/src/core/Range2D.h b/src/core/Range2D.h
new file mode 100644
index 00000000..f239e7de
--- /dev/null
+++ b/src/core/Range2D.h
@@ -0,0 +1,11 @@
+#pragma once
+
+class CRange2D
+{
+ CVector2D min, max;
+public:
+ CRange2D(CVector2D _min, CVector2D _max);
+ bool IsInRange(CVector2D vec);
+ void DebugShowRange(float, int);
+ CVector2D GetRandomPointInRange();
+}; \ No newline at end of file
diff --git a/src/core/Range3D.cpp b/src/core/Range3D.cpp
new file mode 100644
index 00000000..7fa28d67
--- /dev/null
+++ b/src/core/Range3D.cpp
@@ -0,0 +1,30 @@
+#include "common.h"
+#include "Range3D.h"
+#include "General.h"
+
+CRange3D::CRange3D(CVector _min, CVector _max) : min(_min), max(_max) {}
+
+bool
+CRange3D::IsInRange(CVector vec)
+{
+ return min.x < vec.x && max.x > vec.x && min.y < vec.y && max.y > vec.y && min.z < vec.z && max.z > vec.z;
+}
+
+void
+CRange3D::DebugShowRange(float, int)
+{
+}
+
+CVector
+CRange3D::GetRandomPointInRange()
+{
+ int distX = Abs(max.x - min.x);
+ int distY = Abs(max.y - min.y);
+ int distZ = Abs(max.z - min.z);
+
+ float outX = CGeneral::GetRandomNumber() % distX + min.x;
+ float outY = CGeneral::GetRandomNumber() % distY + min.y;
+ float outZ = CGeneral::GetRandomNumber() % distZ + min.z;
+
+ return CVector(outX, outY, outZ);
+}
diff --git a/src/core/Range3D.h b/src/core/Range3D.h
new file mode 100644
index 00000000..f42b523b
--- /dev/null
+++ b/src/core/Range3D.h
@@ -0,0 +1,11 @@
+#pragma once
+
+class CRange3D
+{
+ CVector min, max;
+public:
+ CRange3D(CVector _min, CVector _max);
+ bool IsInRange(CVector vec);
+ void DebugShowRange(float, int);
+ CVector GetRandomPointInRange();
+}; \ No newline at end of file
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 99274e04..9afd8ac3 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -16,8 +16,8 @@ int32 CStats::PedsKilledOfThisType[NUM_PEDTYPES];
int32 CStats::TimesDied;
int32 CStats::TimesArrested;
int32 CStats::KillsSinceLastCheckpoint;
-int32 CStats::DistanceTravelledInVehicle;
-int32 CStats::DistanceTravelledOnFoot;
+float CStats::DistanceTravelledInVehicle;
+float CStats::DistanceTravelledOnFoot;
int32 CStats::ProgressMade;
int32 CStats::TotalProgressInGame;
int32 CStats::CarsExploded;
diff --git a/src/core/Stats.h b/src/core/Stats.h
index ae3c0cb4..5dfcf803 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -21,8 +21,8 @@ public:
static int32 TimesDied;
static int32 TimesArrested;
static int32 KillsSinceLastCheckpoint;
- static int32 DistanceTravelledInVehicle;
- static int32 DistanceTravelledOnFoot;
+ static float DistanceTravelledInVehicle;
+ static float DistanceTravelledOnFoot;
static int32 CarsExploded;
static int32 PeopleKilledByPlayer;
static int32 ProgressMade;
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index c961f53d..40189844 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -45,7 +45,7 @@ int32 CStreaming::ms_oldSectorX;
int32 CStreaming::ms_oldSectorY;
int32 CStreaming::ms_streamingBufferSize;
int8 *CStreaming::ms_pStreamingBuffer[2];
-int32 CStreaming::ms_memoryUsed;
+size_t CStreaming::ms_memoryUsed;
CStreamingChannel CStreaming::ms_channel[2];
int32 CStreaming::ms_channelError;
int32 CStreaming::ms_numVehiclesLoaded;
@@ -62,7 +62,7 @@ uint16 CStreaming::ms_loadedGangCars;
int32 CStreaming::ms_imageOffsets[NUMCDIMAGES];
int32 CStreaming::ms_lastImageRead;
int32 CStreaming::ms_imageSize;
-uint32 CStreaming::ms_memoryAvailable;
+size_t CStreaming::ms_memoryAvailable;
int32 desiredNumVehiclesLoaded = 12;
@@ -202,14 +202,15 @@ CStreaming::Init2(void)
// PC only, figure out how much memory we got
#ifdef GTA_PC
#define MB (1024*1024)
- extern unsigned long _dwMemAvailPhys;
+
+ extern size_t _dwMemAvailPhys;
ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
if(ms_memoryAvailable < 50*MB)
ms_memoryAvailable = 50*MB;
- desiredNumVehiclesLoaded = (ms_memoryAvailable/MB - 50)/3 + 12;
+ desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
- debug("Memory allocated to Streaming is %dMB", ms_memoryAvailable/MB);
+ debug("Memory allocated to Streaming is %zuMB", ms_memoryAvailable/MB); // original modifier was %d
#undef MB
#endif
@@ -725,7 +726,11 @@ CStreaming::RequestBigBuildings(eLevelName level)
n = CPools::GetBuildingPool()->GetSize()-1;
for(i = n; i >= 0; i--){
b = CPools::GetBuildingPool()->GetSlot(i);
- if(b && b->bIsBIGBuilding && b->m_level == level)
+ if(b && b->bIsBIGBuilding
+#ifndef NO_ISLAND_LOADING
+ && b->m_level == level
+#endif
+ )
RequestModel(b->GetModelIndex(), BIGBUILDINGFLAGS);
}
RequestIslands(level);
@@ -735,6 +740,7 @@ CStreaming::RequestBigBuildings(eLevelName level)
void
CStreaming::RequestIslands(eLevelName level)
{
+#ifndef NO_ISLAND_LOADING
switch(level){
case LEVEL_INDUSTRIAL:
RequestModel(islandLODcomInd, BIGBUILDINGFLAGS);
@@ -750,6 +756,7 @@ CStreaming::RequestIslands(eLevelName level)
break;
default: break;
}
+#endif
}
void
@@ -935,12 +942,14 @@ CStreaming::RemoveBuildings(eLevelName level)
void
CStreaming::RemoveUnusedBigBuildings(eLevelName level)
{
+#ifndef NO_ISLAND_LOADING
if(level != LEVEL_INDUSTRIAL)
RemoveBigBuildings(LEVEL_INDUSTRIAL);
if(level != LEVEL_COMMERCIAL)
RemoveBigBuildings(LEVEL_COMMERCIAL);
if(level != LEVEL_SUBURBAN)
RemoveBigBuildings(LEVEL_SUBURBAN);
+#endif
RemoveIslandsNotUsed(level);
}
@@ -960,6 +969,7 @@ DeleteIsland(CEntity *island)
void
CStreaming::RemoveIslandsNotUsed(eLevelName level)
{
+#ifndef NO_ISLAND_LOADING
switch(level){
case LEVEL_INDUSTRIAL:
DeleteIsland(pIslandLODindustEntity);
@@ -977,13 +987,16 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level)
DeleteIsland(pIslandLODcomIndEntity);
break;
default:
+#endif // !NO_ISLAND_LOADING
DeleteIsland(pIslandLODindustEntity);
DeleteIsland(pIslandLODcomIndEntity);
DeleteIsland(pIslandLODcomSubEntity);
DeleteIsland(pIslandLODsubIndEntity);
DeleteIsland(pIslandLODsubComEntity);
+#ifndef NO_ISLAND_LOADING
break;
}
+#endif // !NO_ISLAND_LOADING
}
void
@@ -1073,7 +1086,7 @@ CStreaming::RemoveAllUnusedModels(void)
}
bool
-CStreaming::RemoveReferencedTxds(int32 mem)
+CStreaming::RemoveReferencedTxds(size_t mem)
{
CStreamingInfo *si;
int streamId;
@@ -2189,7 +2202,7 @@ CStreaming::DeleteRwObjectsAfterDeath(const CVector &pos)
}
void
-CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
+CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
{
int ix, iy;
int x, y;
@@ -2370,7 +2383,7 @@ CStreaming::DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y)
}
bool
-CStreaming::DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem)
+CStreaming::DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem)
{
CPtrNode *node;
CEntity *e;
@@ -2391,7 +2404,7 @@ CStreaming::DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem)
}
bool
-CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, int32 mem)
+CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem)
{
CPtrNode *node;
CEntity *e;
@@ -2418,7 +2431,7 @@ CStreaming::MakeSpaceFor(int32 size)
// the code still happens to work in that case because ms_memoryAvailable is unsigned
// but it's not nice....
- while((uint32)ms_memoryUsed >= ms_memoryAvailable - size)
+ while(ms_memoryUsed >= ms_memoryAvailable - size)
if(!RemoveLeastUsedModel()){
DeleteRwObjectsBehindCamera(ms_memoryAvailable - size);
return;
@@ -2480,7 +2493,7 @@ CStreaming::UpdateForAnimViewer(void)
if (CStreaming::ms_channelError == -1) {
CStreaming::AddModelsToRequestList(CVector(0.0f, 0.0f, 0.0f));
CStreaming::LoadRequestedModels();
- sprintf(gString, "Requested %d, memory size %dK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed);
+ sprintf(gString, "Requested %d, memory size %zuK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed); // original modifier was %d
}
else {
CStreaming::RetryLoadFile(CStreaming::ms_channelError);
diff --git a/src/core/Streaming.h b/src/core/Streaming.h
index 84434769..0b2ff124 100644
--- a/src/core/Streaming.h
+++ b/src/core/Streaming.h
@@ -86,7 +86,7 @@ public:
static int32 ms_oldSectorY;
static int32 ms_streamingBufferSize;
static int8 *ms_pStreamingBuffer[2];
- static int32 ms_memoryUsed;
+ static size_t ms_memoryUsed;
static CStreamingChannel ms_channel[2];
static int32 ms_channelError;
static int32 ms_numVehiclesLoaded;
@@ -103,7 +103,7 @@ public:
static int32 ms_imageOffsets[NUMCDIMAGES];
static int32 ms_lastImageRead;
static int32 ms_imageSize;
- static uint32 ms_memoryAvailable;
+ static size_t ms_memoryAvailable;
static void Init(void);
static void Init2(void);
@@ -140,7 +140,7 @@ public:
static bool RemoveLeastUsedModel(void);
static void RemoveAllUnusedModels(void);
static void RemoveUnusedModelsInLoadedList(void);
- static bool RemoveReferencedTxds(int32 mem);
+ static bool RemoveReferencedTxds(size_t mem);
static int32 GetAvailableVehicleSlot(void);
static bool IsTxdUsedByRequestedModels(int32 txdId);
static bool AddToLoadedVehiclesList(int32 modelId);
@@ -176,11 +176,11 @@ public:
static void DeleteFarAwayRwObjects(const CVector &pos);
static void DeleteAllRwObjects(void);
static void DeleteRwObjectsAfterDeath(const CVector &pos);
- static void DeleteRwObjectsBehindCamera(int32 mem);
+ static void DeleteRwObjectsBehindCamera(size_t mem);
static void DeleteRwObjectsInSectorList(CPtrList &list);
static void DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y);
- static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem);
- static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, int32 mem);
+ static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem);
+ static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem);
static void LoadScene(const CVector &pos);
diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp
index e4f9c0cd..b1bcceb6 100644
--- a/src/core/SurfaceTable.cpp
+++ b/src/core/SurfaceTable.cpp
@@ -59,36 +59,36 @@ CSurfaceTable::GetAdhesionGroup(uint8 surfaceType)
case SURFACE_DEFAULT: return ADHESIVE_ROAD;
case SURFACE_TARMAC: return ADHESIVE_ROAD;
case SURFACE_GRASS: return ADHESIVE_LOOSE;
- case SURFACE_DIRT: return ADHESIVE_LOOSE;
- case SURFACE_DIRTTRACK: return ADHESIVE_HARD;
+ case SURFACE_GRAVEL: return ADHESIVE_LOOSE;
+ case SURFACE_MUD_DRY: return ADHESIVE_HARD;
case SURFACE_PAVEMENT: return ADHESIVE_ROAD;
- case SURFACE_METAL6: return ADHESIVE_HARD;
+ case SURFACE_CAR: return ADHESIVE_HARD;
case SURFACE_GLASS: return ADHESIVE_HARD;
- case SURFACE_SCAFFOLD: return ADHESIVE_HARD;
- case SURFACE_METAL_DOOR: return ADHESIVE_HARD;
- case SURFACE_BILLBOARD: return ADHESIVE_HARD;
- case SURFACE_STEEL: return ADHESIVE_HARD;
- case SURFACE_METAL_POLE: return ADHESIVE_HARD;
- case SURFACE_STREET_LIGHT: return ADHESIVE_HARD;
- case SURFACE_METAL14: return ADHESIVE_HARD;
- case SURFACE_METAL15: return ADHESIVE_HARD;
- case SURFACE_METAL_FENCE: return ADHESIVE_HARD;
- case SURFACE_FLESH: return ADHESIVE_RUBBER;
+ case SURFACE_TRANSPARENT_CLOTH: return ADHESIVE_HARD;
+ case SURFACE_GARAGE_DOOR: return ADHESIVE_HARD;
+ case SURFACE_CAR_PANEL: return ADHESIVE_HARD;
+ case SURFACE_THICK_METAL_PLATE: return ADHESIVE_HARD;
+ case SURFACE_SCAFFOLD_POLE: return ADHESIVE_HARD;
+ case SURFACE_LAMP_POST: return ADHESIVE_HARD;
+ case SURFACE_FIRE_HYDRANT: return ADHESIVE_HARD;
+ case SURFACE_GIRDER: return ADHESIVE_HARD;
+ case SURFACE_METAL_CHAIN_FENCE: return ADHESIVE_HARD;
+ case SURFACE_PED: return ADHESIVE_RUBBER;
case SURFACE_SAND: return ADHESIVE_LOOSE;
- case SURFACE_PUDDLE: return ADHESIVE_WET;
- case SURFACE_WOOD: return ADHESIVE_ROAD;
- case SURFACE_WOOD_BOX: return ADHESIVE_ROAD;
- case SURFACE_WOOD_PLANK: return ADHESIVE_ROAD;
- case SURFACE_TIRE: return ADHESIVE_RUBBER;
- case SURFACE_HARD24: return ADHESIVE_HARD;
+ case SURFACE_WATER: return ADHESIVE_WET;
+ case SURFACE_WOOD_CRATES: return ADHESIVE_ROAD;
+ case SURFACE_WOOD_BENCH: return ADHESIVE_ROAD;
+ case SURFACE_WOOD_SOLID: return ADHESIVE_ROAD;
+ case SURFACE_RUBBER: return ADHESIVE_RUBBER;
+ case SURFACE_PLASTIC: return ADHESIVE_HARD;
case SURFACE_HEDGE: return ADHESIVE_LOOSE;
- case SURFACE_STONE: return ADHESIVE_LOOSE;
- case SURFACE_METAL27: return ADHESIVE_HARD;
- case SURFACE_METAL28: return ADHESIVE_HARD;
- case SURFACE_RUBBER29: return ADHESIVE_RUBBER;
- case SURFACE_LOOSE30: return ADHESIVE_LOOSE;
- case SURFACE_BOLLARD: return ADHESIVE_HARD;
- case SURFACE_GATE: return ADHESIVE_HARD;
+ case SURFACE_STEEP_CLIFF: return ADHESIVE_LOOSE;
+ case SURFACE_CONTAINER: return ADHESIVE_HARD;
+ case SURFACE_NEWS_VENDOR: return ADHESIVE_HARD;
+ case SURFACE_WHEELBASE: return ADHESIVE_RUBBER;
+ case SURFACE_CARDBOARDBOX: return ADHESIVE_LOOSE;
+ case SURFACE_TRANSPARENT_STONE: return ADHESIVE_HARD;
+ case SURFACE_METAL_GATE: return ADHESIVE_HARD;
default: return ADHESIVE_ROAD;
}
}
@@ -99,36 +99,36 @@ CSurfaceTable::GetWetMultiplier(uint8 surfaceType)
switch(surfaceType){
case SURFACE_DEFAULT:
case SURFACE_TARMAC:
- case SURFACE_DIRTTRACK:
+ case SURFACE_MUD_DRY:
case SURFACE_PAVEMENT:
- case SURFACE_SCAFFOLD:
- case SURFACE_WOOD:
- case SURFACE_WOOD_BOX:
- case SURFACE_WOOD_PLANK:
+ case SURFACE_TRANSPARENT_CLOTH:
+ case SURFACE_WOOD_CRATES:
+ case SURFACE_WOOD_BENCH:
+ case SURFACE_WOOD_SOLID:
case SURFACE_HEDGE:
- case SURFACE_LOOSE30:
- case SURFACE_BOLLARD:
+ case SURFACE_CARDBOARDBOX:
+ case SURFACE_TRANSPARENT_STONE:
return 1.0f - CWeather::WetRoads*0.25f;
case SURFACE_GRASS:
- case SURFACE_METAL6:
+ case SURFACE_CAR:
case SURFACE_GLASS:
- case SURFACE_METAL_DOOR:
- case SURFACE_BILLBOARD:
- case SURFACE_STEEL:
- case SURFACE_METAL_POLE:
- case SURFACE_STREET_LIGHT:
- case SURFACE_METAL14:
- case SURFACE_METAL15:
- case SURFACE_METAL_FENCE:
- case SURFACE_FLESH:
- case SURFACE_TIRE:
- case SURFACE_HARD24:
- case SURFACE_STONE:
- case SURFACE_METAL27:
- case SURFACE_METAL28:
- case SURFACE_RUBBER29:
- case SURFACE_GATE:
+ case SURFACE_GARAGE_DOOR:
+ case SURFACE_CAR_PANEL:
+ case SURFACE_THICK_METAL_PLATE:
+ case SURFACE_SCAFFOLD_POLE:
+ case SURFACE_LAMP_POST:
+ case SURFACE_FIRE_HYDRANT:
+ case SURFACE_GIRDER:
+ case SURFACE_METAL_CHAIN_FENCE:
+ case SURFACE_PED:
+ case SURFACE_RUBBER:
+ case SURFACE_PLASTIC:
+ case SURFACE_STEEP_CLIFF:
+ case SURFACE_CONTAINER:
+ case SURFACE_NEWS_VENDOR:
+ case SURFACE_WHEELBASE:
+ case SURFACE_METAL_GATE:
return 1.0f - CWeather::WetRoads*0.4f;
default:
diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h
index 768521bf..1f16843d 100644
--- a/src/core/SurfaceTable.h
+++ b/src/core/SurfaceTable.h
@@ -1,45 +1,44 @@
#pragma once
-// TODO: check this
enum eSurfaceType
{
SURFACE_DEFAULT,
SURFACE_TARMAC,
SURFACE_GRASS,
- SURFACE_DIRT,
- SURFACE_DIRTTRACK,
+ SURFACE_GRAVEL,
+ SURFACE_MUD_DRY,
SURFACE_PAVEMENT,
- SURFACE_METAL6,
+ SURFACE_CAR,
SURFACE_GLASS,
- SURFACE_SCAFFOLD,
- SURFACE_METAL_DOOR, // garage door
- SURFACE_BILLBOARD,
- SURFACE_STEEL, //?
- SURFACE_METAL_POLE, // ?
- SURFACE_STREET_LIGHT,
- SURFACE_METAL14,
- SURFACE_METAL15,
- SURFACE_METAL_FENCE,
- SURFACE_FLESH,
+ SURFACE_TRANSPARENT_CLOTH,
+ SURFACE_GARAGE_DOOR,
+ SURFACE_CAR_PANEL,
+ SURFACE_THICK_METAL_PLATE,
+ SURFACE_SCAFFOLD_POLE,
+ SURFACE_LAMP_POST,
+ SURFACE_FIRE_HYDRANT,
+ SURFACE_GIRDER,
+ SURFACE_METAL_CHAIN_FENCE,
+ SURFACE_PED,
SURFACE_SAND,
- SURFACE_PUDDLE,
- SURFACE_WOOD,
- SURFACE_WOOD_BOX,
- SURFACE_WOOD_PLANK,
- SURFACE_TIRE,
- SURFACE_HARD24,
+ SURFACE_WATER,
+ SURFACE_WOOD_CRATES,
+ SURFACE_WOOD_BENCH,
+ SURFACE_WOOD_SOLID,
+ SURFACE_RUBBER,
+ SURFACE_PLASTIC,
SURFACE_HEDGE,
- SURFACE_STONE,
- SURFACE_METAL27,
- SURFACE_METAL28,
- SURFACE_RUBBER29,
- SURFACE_LOOSE30,
- SURFACE_BOLLARD,
- SURFACE_GATE,
+ SURFACE_STEEP_CLIFF,
+ SURFACE_CONTAINER,
+ SURFACE_NEWS_VENDOR,
+ SURFACE_WHEELBASE,
+ SURFACE_CARDBOARDBOX,
+ SURFACE_TRANSPARENT_STONE,
+ SURFACE_METAL_GATE,
// These are illegal
- SURFACE_SAND33,
- SURFACE_ROAD34,
+ SURFACE_SAND_BEACH,
+ SURFACE_CONCRETE_BEACH,
};
enum
@@ -55,6 +54,16 @@ enum
struct CColPoint;
+inline bool
+IsSeeThrough(uint8 surfType)
+{
+ switch(surfType)
+ case SURFACE_GLASS:
+ case SURFACE_TRANSPARENT_CLOTH:
+ return true;
+ return false;
+}
+
class CSurfaceTable
{
static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];
diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp
index 79d6252b..ab73631d 100644
--- a/src/core/TempColModels.cpp
+++ b/src/core/TempColModels.cpp
@@ -36,19 +36,19 @@ CTempColModels::Initialise(void)
#define SET_COLMODEL_SPHERES(colmodel, sphrs)\
colmodel.numSpheres = ARRAY_SIZE(sphrs);\
colmodel.spheres = sphrs;\
- colmodel.level = LEVEL_NONE;\
+ colmodel.level = LEVEL_GENERIC;\
colmodel.ownsCollisionVolumes = false;\
int i;
ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f), SURFACE_DEFAULT, 0);
- ms_colModelBBox.level = LEVEL_NONE;
+ ms_colModelBBox.level = LEVEL_GENERIC;
for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) {
ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelCutObj[i].boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f), SURFACE_DEFAULT, 0);
- ms_colModelCutObj[i].level = LEVEL_NONE;
+ ms_colModelCutObj[i].level = LEVEL_GENERIC;
}
// Ped Spheres
@@ -65,7 +65,7 @@ CTempColModels::Initialise(void)
#else
for (i = 0; i < ARRAY_SIZE(s_aPedGSpheres); i++) {
#endif
- s_aPedSpheres[i].surface = SURFACE_FLESH;
+ s_aPedSpheres[i].surface = SURFACE_PED;
s_aPedSpheres[i].piece = 0;
}
@@ -84,7 +84,7 @@ CTempColModels::Initialise(void)
s_aPed2Spheres[2].center = CVector(0.0f, -0.35f, -0.9f);
for (i = 0; i < ARRAY_SIZE(s_aPed2Spheres); i++) {
- s_aPed2Spheres[i].surface = SURFACE_FLESH;
+ s_aPed2Spheres[i].surface = SURFACE_PED;
s_aPed2Spheres[i].piece = 0;
}
@@ -105,10 +105,10 @@ CTempColModels::Initialise(void)
s_aPedGSpheres[2].center = CVector(0.0f, 0.25f, -0.9f);
s_aPedGSpheres[3].center = CVector(0.0f, 0.65f, -0.9f);
- s_aPedGSpheres[0].surface = SURFACE_FLESH;
- s_aPedGSpheres[1].surface = SURFACE_FLESH;
- s_aPedGSpheres[2].surface = SURFACE_FLESH;
- s_aPedGSpheres[3].surface = SURFACE_FLESH;
+ s_aPedGSpheres[0].surface = SURFACE_PED;
+ s_aPedGSpheres[1].surface = SURFACE_PED;
+ s_aPedGSpheres[2].surface = SURFACE_PED;
+ s_aPedGSpheres[3].surface = SURFACE_PED;
s_aPedGSpheres[0].piece = 4;
s_aPedGSpheres[1].piece = 1;
s_aPedGSpheres[2].piece = 0;
@@ -130,7 +130,7 @@ CTempColModels::Initialise(void)
s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f);
for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) {
- s_aDoorSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aDoorSpheres[i].surface = SURFACE_CAR_PANEL;
s_aDoorSpheres[i].piece = 0;
}
@@ -150,12 +150,12 @@ CTempColModels::Initialise(void)
s_aBumperSpheres[3].center = CVector(-0.85f, -0.05f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBumperSpheres); i++) {
- s_aBumperSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aBumperSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBumperSpheres[i].piece = 0;
}
ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0);
- ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f), SURFACE_DEFAULT, 0);
+ ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, 0.2f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres);
@@ -170,7 +170,7 @@ CTempColModels::Initialise(void)
s_aPanelSpheres[3].center = CVector(-0.15f, 0.45f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aPanelSpheres); i++) {
- s_aPanelSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aPanelSpheres[i].surface = SURFACE_CAR_PANEL;
s_aPanelSpheres[i].piece = 0;
}
@@ -190,7 +190,7 @@ CTempColModels::Initialise(void)
s_aBonnetSpheres[3].center = CVector(0.4f, 0.9f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBonnetSpheres); i++) {
- s_aBonnetSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aBonnetSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBonnetSpheres[i].piece = 0;
}
@@ -210,7 +210,7 @@ CTempColModels::Initialise(void)
s_aBootSpheres[3].center = CVector(0.4f, -0.6f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
- s_aBootSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aBootSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBootSpheres[i].piece = 0;
}
@@ -232,7 +232,7 @@ CTempColModels::Initialise(void)
#else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif
- s_aWheelSpheres[i].surface = SURFACE_RUBBER29;
+ s_aWheelSpheres[i].surface = SURFACE_WHEELBASE;
s_aWheelSpheres[i].piece = 0;
}
@@ -254,7 +254,7 @@ CTempColModels::Initialise(void)
#else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif
- s_aBodyPartSpheres1[i].surface = SURFACE_FLESH;
+ s_aBodyPartSpheres1[i].surface = SURFACE_PED;
s_aBodyPartSpheres1[i].piece = 0;
}
@@ -276,7 +276,7 @@ CTempColModels::Initialise(void)
#else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif
- s_aBodyPartSpheres2[i].surface = SURFACE_FLESH;
+ s_aBodyPartSpheres2[i].surface = SURFACE_PED;
s_aBodyPartSpheres2[i].piece = 0;
}
diff --git a/src/core/Timer.h b/src/core/Timer.h
index e7b6fec8..393242dd 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -18,7 +18,7 @@ public:
static const float &GetTimeStep(void) { return ms_fTimeStep; }
static void SetTimeStep(float ts) { ms_fTimeStep = ts; }
static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; }
- static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
+ static uint32 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; }
@@ -56,6 +56,7 @@ public:
friend bool GenericLoad(void);
friend bool GenericSave(int file);
+ friend class CMemoryCard;
#ifdef FIX_BUGS
static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp
index 7508c9f4..909674d0 100644
--- a/src/core/Wanted.cpp
+++ b/src/core/Wanted.cpp
@@ -161,7 +161,11 @@ CWanted::RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool po
void
CWanted::RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare)
{
- if(!AddCrimeToQ(type, id, coors, false, policeDoesntCare))
+#if defined FIX_SIGNIFICANT_BUGS || defined PEDS_REPORT_CRIMES_ON_PHONE
+ if (!AddCrimeToQ(type, id, coors, true, policeDoesntCare))
+#else
+ if (!AddCrimeToQ(type, id, coors, false, policeDoesntCare))
+#endif
ReportCrimeNow(type, coors, policeDoesntCare);
}
@@ -219,6 +223,9 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
chaos *= 0.333f;
switch(type){
case CRIME_POSSESSION_GUN:
+#ifdef PEDS_REPORT_CRIMES_ON_PHONE
+ m_nChaos += 5.0f*chaos;
+#endif
break;
case CRIME_HIT_PED:
m_nChaos += 5.0f*chaos;
@@ -440,6 +447,30 @@ CWanted::Reset(void)
Initialise();
}
+#ifdef PEDS_REPORT_CRIMES_ON_PHONE
+bool
+CrimeShouldBeReportedOnPhone(eCrimeType crime)
+{
+ switch (crime) {
+ case CRIME_POSSESSION_GUN:
+ case CRIME_HIT_PED:
+ case CRIME_HIT_COP:
+ case CRIME_SHOOT_PED:
+ case CRIME_SHOOT_COP:
+ case CRIME_STEAL_CAR:
+ case CRIME_RECKLESS_DRIVING:
+ case CRIME_RUNOVER_PED:
+ case CRIME_RUNOVER_COP:
+ case CRIME_PED_BURNED:
+ case CRIME_COP_BURNED:
+ case CRIME_VEHICLE_BURNED:
+ return true;
+ default:
+ return false;
+ }
+}
+#endif
+
void
CWanted::UpdateCrimesQ(void)
{
@@ -447,6 +478,9 @@ CWanted::UpdateCrimesQ(void)
CCrimeBeingQd &crime = m_aCrimes[i];
if (crime.m_nType != CRIME_NONE) {
+#ifdef PEDS_REPORT_CRIMES_ON_PHONE
+ if (!CrimeShouldBeReportedOnPhone(crime.m_nType))
+#endif
if (CTimer::GetTimeInMilliseconds() > crime.m_nTime + 500 && !crime.m_bReported) {
ReportCrimeNow(crime.m_nType, crime.m_vecPosn, crime.m_bPoliceDoesntCare);
crime.m_bReported = true;
diff --git a/src/core/World.cpp b/src/core/World.cpp
index edcfd865..9f384048 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -33,22 +33,22 @@
CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
-CPtrList CWorld::ms_bigBuildingsList[4];// = (CPtrList*)0x6FAB60;
-CPtrList CWorld::ms_listMovingEntityPtrs;// = *(CPtrList*)0x8F433C;
-CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];// = (CSector (*)[NUMSECTORS_Y])0x665608;
-uint16 CWorld::ms_nCurrentScanCode;// = *(uint16*)0x95CC64;
+CPtrList CWorld::ms_bigBuildingsList[4];
+CPtrList CWorld::ms_listMovingEntityPtrs;
+CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];
+uint16 CWorld::ms_nCurrentScanCode;
-uint8 CWorld::PlayerInFocus;// = *(uint8 *)0x95CD61;
+uint8 CWorld::PlayerInFocus;
CPlayerInfo CWorld::Players[NUMPLAYERS];
-bool CWorld::bNoMoreCollisionTorque;// = *(bool*)0x95CDCC;
-CEntity *CWorld::pIgnoreEntity;// = *(CEntity**)0x8F6494;
-bool CWorld::bIncludeDeadPeds;// = *(bool*)0x95CD8F;
-bool CWorld::bSecondShift;// = *(bool*)0x95CD54;
-bool CWorld::bForceProcessControl;// = *(bool*)0x95CD6C;
-bool CWorld::bProcessCutsceneOnly;// = *(bool*)0x95CD8B;
+bool CWorld::bNoMoreCollisionTorque;
+CEntity *CWorld::pIgnoreEntity;
+bool CWorld::bIncludeDeadPeds;
+bool CWorld::bSecondShift;
+bool CWorld::bForceProcessControl;
+bool CWorld::bProcessCutsceneOnly;
-bool CWorld::bDoingCarCollisions;// = *(bool*)0x95CD8C;
-bool CWorld::bIncludeCarTyres;// = *(bool*)0x95CDAA;
+bool CWorld::bDoingCarCollisions;
+bool CWorld::bIncludeCarTyres;
void
CWorld::Initialise()
@@ -120,14 +120,14 @@ CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemov
for(int32 i = 0; i < pedPool->GetSize(); i++) {
CPed *pPed = pedPool->GetSlot(i);
if(pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() &&
- CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < radius) {
+ CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < SQR(radius)) {
CPopulation::RemovePed(pPed);
}
}
CVehiclePool *VehiclePool = CPools::GetVehiclePool();
for(int32 i = 0; i < VehiclePool->GetSize(); i++) {
CVehicle *pVehicle = VehiclePool->GetSlot(i);
- if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < radius &&
+ if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < SQR(radius) &&
!pVehicle->bIsLocked && pVehicle->CanBeDeleted()) {
if(pVehicle->pDriver) {
CPopulation::RemovePed(pVehicle->pDriver);
@@ -659,8 +659,8 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
}
void
-CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, short *nextObject,
- short lastObject, CEntity **objects)
+CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects,
+ int16 lastObject, CEntity **objects)
{
float radiusSqr = radius * radius;
float objDistSqr;
@@ -676,16 +676,16 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, floa
else
objDistSqr = diff.MagnitudeSqr();
- if(objDistSqr < radiusSqr && *nextObject < lastObject) {
- if(objects) { objects[*nextObject] = object; }
- (*nextObject)++;
+ if(objDistSqr < radiusSqr && *numObjects < lastObject) {
+ if(objects) { objects[*numObjects] = object; }
+ (*numObjects)++;
}
}
}
}
void
-CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject,
+CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject,
CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds,
bool checkObjects, bool checkDummies)
{
@@ -711,39 +711,39 @@ CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, sh
AdvanceCurrentScanCode();
- *nextObject = 0;
+ *numObjects = 0;
for(int curY = minY; curY <= maxY; curY++) {
for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY);
if(checkBuildings) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre,
- radius, ignoreZ, nextObject, lastObject, objects);
+ radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkVehicles) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre,
- radius, ignoreZ, nextObject, lastObject, objects);
+ radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkPeds) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ,
- nextObject, lastObject, objects);
+ numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
}
if(checkObjects) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre,
- radius, ignoreZ, nextObject, lastObject, objects);
+ radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkDummies) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre,
- radius, ignoreZ, nextObject, lastObject, objects);
+ radius, ignoreZ, numObjects, lastObject, objects);
}
}
}
@@ -949,7 +949,11 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
if(e != entityToIgnore && e->bUsesCollision &&
!(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
+#ifdef FIX_BUGS
+ CVector diff = spherePos - e->GetBoundCentre();
+#else
CVector diff = spherePos - e->GetPosition();
+#endif
float distance = diff.Magnitude();
if(e->GetBoundRadius() + radius > distance) {
@@ -1793,7 +1797,7 @@ CWorld::ClearForRestart(void)
CWorld::Remove(pEntity);
delete pEntity;
}
- for(CPtrNode *pNode = GetBigBuildingList(LEVEL_NONE).first; pNode; pNode = pNode->next) {
+ for(CPtrNode *pNode = GetBigBuildingList(LEVEL_GENERIC).first; pNode; pNode = pNode->next) {
CVehicle *pVehicle = (CVehicle *)pNode->item;
if(pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) {
CWorld::Remove(pVehicle);
diff --git a/src/core/World.h b/src/core/World.h
index 2bcc4e43..9465a914 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -102,8 +102,8 @@ public:
static CEntity *TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects);
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
- static void FindObjectsInRangeSectorList(CPtrList&, Const CVector&, float, bool, short*, short, CEntity**);
- static void FindObjectsInRange(Const CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
+ static void FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects);
+ static void FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies);
static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies);
static float FindGroundZForCoord(float x, float y);
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 4f491a49..1556731b 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -90,7 +90,7 @@ CTheZones::Init(void)
TotalNumberOfZoneInfos = 1; // why 1?
TotalNumberOfZones = 1;
- m_CurrLevel = LEVEL_NONE;
+ m_CurrLevel = LEVEL_GENERIC;
m_pPlayersZone = &ZoneArray[0];
strcpy(ZoneArray[0].name, "CITYZON");
@@ -100,7 +100,7 @@ CTheZones::Init(void)
ZoneArray[0].maxx = 4000.0f;
ZoneArray[0].maxy = 4000.0f;
ZoneArray[0].maxz = 500.0f;
- ZoneArray[0].level = LEVEL_NONE;
+ ZoneArray[0].level = LEVEL_GENERIC;
for(i = 0; i < NUMMAPZONES; i++){
memset(&MapZoneArray[i], 0, sizeof(CZone));
@@ -116,7 +116,7 @@ CTheZones::Init(void)
MapZoneArray[0].maxx = 4000.0f;
MapZoneArray[0].maxy = 4000.0f;
MapZoneArray[0].maxz = 500.0f;
- MapZoneArray[0].level = LEVEL_NONE;
+ MapZoneArray[0].level = LEVEL_GENERIC;
}
void
@@ -577,7 +577,7 @@ CTheZones::FindZoneForPoint(const CVector &pos)
return LEVEL_COMMERCIAL;
if(PointLiesWithinZone(&pos, GetZone(FindZoneByLabelAndReturnIndex("SUB_ZON"))))
return LEVEL_SUBURBAN;
- return LEVEL_NONE;
+ return LEVEL_GENERIC;
}
void
diff --git a/src/core/common.h b/src/core/common.h
index f79b199b..ebb3acb0 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -17,7 +17,11 @@
#if defined _WIN32 && defined WITHD3D
#include <windows.h>
+#ifndef USE_D3D9
#include <d3d8types.h>
+#else
+#include <d3d9types.h>
+#endif
#endif
#include <rwcore.h>
@@ -29,14 +33,15 @@
#define STREAMFILE(str) (((rw::StreamFile*)(str))->file)
#define HIERNODEINFO(hier) ((hier)->nodeInfo)
#define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id)
-#define HANIMFRAMES(anim) ((anim)->keyframes)
+#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->keyframes + (i)*(anim)->interpInfo->animKeyFrameSize)
#else
#define RWHALFPIXEL // always d3d
#define STREAMPOS(str) ((str)->Type.memory.position)
#define STREAMFILE(str) ((str)->Type.file.fpFile)
#define HIERNODEINFO(hier) ((hier)->pNodeInfo)
#define HIERNODEID(hier, i) ((hier)->pNodeInfo[i].nodeID)
-#define HANIMFRAMES(anim) ((anim)->pFrames)
+#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->pFrames + (i)*(anim)->interpInfo->keyFrameSize)
+#define RpHAnimStdInterpFrame RpHAnimStdKeyFrame
#endif
#ifdef RWHALFPIXEL
@@ -103,6 +108,8 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448)
+#define DEFAULT_SCREEN_HEIGHT_PAL (512)
+#define DEFAULT_SCREEN_HEIGHT_NTSC (448)
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
#define DEFAULT_VIEWWINDOW (0.7f)
@@ -111,7 +118,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#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)))
+#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
// This scales from PS2 pixel coordinates to the real resolution
#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)
@@ -153,6 +160,16 @@ public:
CRGBA(void) { }
CRGBA(uint8 r, uint8 g, uint8 b, uint8 a) : r(r), g(g), b(b), a(a) { }
+ bool operator ==(const CRGBA &right)
+ {
+ return this->r == right.r && this->g == right.g && this->b == right.b && this->a == right.a;
+ }
+
+ bool operator !=(const CRGBA &right)
+ {
+ return !(*this == right);
+ }
+
CRGBA &operator =(const CRGBA &right)
{
this->r = right.r;
@@ -404,7 +421,7 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
WriteSaveBuf(buf, b);\
WriteSaveBuf(buf, c);\
WriteSaveBuf(buf, d);\
- WriteSaveBuf(buf, size);
+ WriteSaveBuf<uint32>(buf, size);
#define CheckSaveHeader(buf,a,b,c,d,size)\
assert(ReadSaveBuf<char>(buf) == a);\
diff --git a/src/core/config.h b/src/core/config.h
index f43067d7..94a35782 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -158,6 +158,7 @@ enum Config {
#if defined GTA_PS2
# define GTA_PS2_STUFF
# define RANDOMSPLASH
+# define COMPRESSED_COL_VECTORS
#elif defined GTA_PC
# define GTA3_1_1_PATCH
//# define GTA3_STEAM_PATCH
@@ -186,16 +187,23 @@ enum Config {
# define NO_CDCHECK
# define CHATTYSPLASH // print what the game is loading
# define DEBUGMENU
-//# define TIMEBARS // print debug timers
+# define TIMEBARS // print debug timers
#endif
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
-#define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things
#define MORE_LANGUAGES // Add more translations to the game
+#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
+
+// Rendering/display
+#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
+#define PS2_ALPHA_TEST // emulate ps2 alpha test
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
+#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
+//#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
//#define USE_TEXTURE_POOL
+#define CUTSCENE_BORDERS_SWITCH
// Particle
//#define PC_PARTICLE
@@ -212,23 +220,38 @@ enum Config {
#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
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
#define BETA_SLIDING_TEXT
+#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
+#define PC_MENU
+
+#ifndef PC_MENU
+# define PS2_MENU
+//# define PS2_MENU_USEALLPAGEICONS
+#else
+# 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
+# define CUSTOM_FRONTEND_OPTIONS
+#endif
// Script
-#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
+#define USE_DEBUG_SCRIPT_LOADER // Loads main.scm by default. Hold R for main_freeroam.scm and D for main_d.scm
#define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script
#define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
+#ifdef PC_MENU
+# define MISSION_REPLAY // mobile feature
+#endif
+//#define SIMPLIER_MISSIONS // apply simplifications from mobile
+#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+#define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log
-#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
+#ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
+#endif
// Replay
//#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool!
@@ -245,10 +268,18 @@ enum Config {
// Peds
#define PED_SKIN // support for skinned geometry on peds
#define ANIMATE_PED_COL_MODEL
-#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
+// #define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
+//#define PEDS_REPORT_CRIMES_ON_PHONE
// Camera
+//#define PS2_CAM_TRANSITION // old way of transitioning between cam modes
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
#define FREE_CAM // Rotating cam
+
+// Audio
+#ifndef AUDIO_OAL // is not working yet for openal
+#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
+#endif
+//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS \ No newline at end of file
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 666758c8..a1c64a6d 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -58,6 +58,7 @@
#include "Console.h"
#include "timebars.h"
#include "GenericGameStorage.h"
+#include "MemoryCard.h"
#include "SceneEdit.h"
#include "debugmenu.h"
@@ -73,6 +74,9 @@ float FramesPerSecond = 30.0f;
bool gbPrintShite = false;
bool gbModelViewer;
+#ifdef TIMEBARS
+bool gbShowTimebars;
+#endif
int32 frameCount;
@@ -95,7 +99,6 @@ void TheGame(void);
void DebugMenuPopulate(void);
#endif
-
void
ValidateVersion()
{
@@ -189,14 +192,27 @@ DoFade(void)
if(CTimer::GetIsPaused())
return;
+#ifdef PS2_MENU
+ if(TheMemoryCard.JustLoadedDontFadeInYet){
+ TheMemoryCard.JustLoadedDontFadeInYet = false;
+ TheMemoryCard.TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
+ }
+#else
if(JustLoadedDontFadeInYet){
JustLoadedDontFadeInYet = false;
TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
}
+#endif
+#ifdef PS2_MENU
+ if(TheMemoryCard.StillToFadeOut){
+ if(CTimer::GetTimeInMilliseconds() - TheMemoryCard.TimeStartedCountingForFade > TheMemoryCard.TimeToStayFadedBeforeFadeOut){
+ TheMemoryCard.StillToFadeOut = false;
+#else
if(StillToFadeOut){
if(CTimer::GetTimeInMilliseconds() - TimeStartedCountingForFade > TimeToStayFadedBeforeFadeOut){
StillToFadeOut = false;
+#endif
TheCamera.Fade(3.0f, FADE_IN);
TheCamera.ProcessFade();
TheCamera.ProcessMusicFade();
@@ -238,7 +254,11 @@ DoFade(void)
fadeColor.a = alpha;
}
- if(TheCamera.m_WideScreenOn){
+ if(TheCamera.m_WideScreenOn
+#ifdef CUTSCENE_BORDERS_SWITCH
+ && CMenuManager::m_PrefsCutsceneBorders
+#endif
+ ){
// what's this?
float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
rect.left = 0.0f;
@@ -451,12 +471,16 @@ ResetLoadingScreenBar()
NumberOfChunksLoaded = 0.0f;
}
-// TODO: compare with PS2
void
LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
{
CSprite2d *splash;
+#ifdef DISABLE_LOADING_SCREEN
+ if (str1 && str2)
+ return;
+#endif
+
#ifndef RANDOMSPLASH
if(CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
splashscreen = "mainsc2";
@@ -842,7 +866,11 @@ Render2dStuff(void)
CReplay::Display();
CPickups::RenderPickUpText();
- if(TheCamera.m_WideScreenOn)
+ if(TheCamera.m_WideScreenOn
+#ifdef CUTSCENE_BORDERS_SWITCH
+ && CMenuManager::m_PrefsCutsceneBorders
+#endif
+ )
TheCamera.DrawBordersForWideScreen();
CPed *player = FindPlayerPed();
@@ -896,17 +924,16 @@ Render2dStuff(void)
void
RenderMenus(void)
{
-#ifdef PS2
- if (FrontEndMenuManager.m_bWantToDraw)
+ if (FrontEndMenuManager.m_bMenuActive)
{
+#ifdef PS2
gMainHeap.PushMemId(_TODOCONST(17));
+#endif
FrontEndMenuManager.DrawFrontEnd();
+#ifdef PS2
gMainHeap.PopMemId();
- }
-#else
- if(FrontEndMenuManager.m_bMenuActive)
- FrontEndMenuManager.DrawFrontEnd();
#endif
+ }
}
void
@@ -983,14 +1010,25 @@ Idle(void *arg)
#endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
+#ifdef PS2_MENU
+ TheMemoryCard.m_bWantToLoad = false;
+ FrontEndMenuManager.m_bWantToRestart = true;
+#else
FrontEndMenuManager.m_bWantToRestart = true;
FrontEndMenuManager.m_bWantToLoad = false;
+#endif
return;
}
+#ifdef PS2_MENU
+ if ( FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad )
+#else
if(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
+#endif
+ {
return;
-
+ }
+
SetLightsWithTimeOfDayColour(Scene.world);
if(arg == nil)
@@ -1050,7 +1088,7 @@ Idle(void *arg)
#ifdef TIMEBARS
tbStartTimer(0, "RenderMotionBlur");
#endif
- if((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) &&
+ if((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) &&
TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur();
@@ -1086,6 +1124,11 @@ Idle(void *arg)
tbEndTimer("RenderMenus");
tbStartTimer(0, "DoFade");
#endif
+
+#ifdef PS2_MENU
+ if ( TheMemoryCard.m_bWantToLoad )
+ return;
+#endif
DoFade();
#ifdef TIMEBARS
tbEndTimer("DoFade");
@@ -1097,8 +1140,10 @@ Idle(void *arg)
#endif
CCredits::Render();
+
#ifdef TIMEBARS
- tbDisplay();
+ if (gbShowTimebars)
+ tbDisplay();
#endif
DoRWStuffEndOfFrame();
@@ -1270,6 +1315,7 @@ TheModelViewer(void)
}
#endif
+#ifdef PS2
void TheGame(void)
{
printf("Into TheGame!!!\n");
@@ -1291,12 +1337,12 @@ void TheGame(void)
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))
+ if ( TheMemoryCard.CheckCardInserted(CARD_ONE) == CMemoryCard::NO_ERR_SUCCESS
+ && TheMemoryCard.ChangeDirectory(CARD_ONE, TheMemoryCard.Cards[CARD_ONE].dir)
+ && TheMemoryCard.FindMostRecentFileName(CARD_ONE, TheMemoryCard.MostRecentFile) == true
+ && TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.MostRecentFile))
{
- strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.field37);
+ strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.MostRecentFile);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
@@ -1399,7 +1445,7 @@ void TheGame(void)
RenderDebugShit();
RenderEffects();
- if ((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) && TheCamera.m_ScreenReductionPercentage > 0.0f)
+ if ((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) && TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur();
@@ -1781,8 +1827,6 @@ void GameInit()
}
}
-// Not used anyway. PS2 main() port
-#ifdef _WIN32
int
main(int argc, char *argv[])
{
@@ -1793,9 +1837,10 @@ main(int argc, char *argv[])
SystemInit();
#ifdef PS2
- int32 state = TheMemoryCard.CheckCardStateAtGameStartUp(_TODOCONST(0));
+ int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
- if ( state == _TODOCONST(2) || state == _TODOCONST(1) && state != _TODOCONST(3) && state != _TODOCONST(0) )
+ if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
+ && r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{
GameInit();
diff --git a/src/core/main.h b/src/core/main.h
index 32a880d6..9ad4ed1c 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -14,6 +14,9 @@ extern wchar gUString[256];
extern wchar gUString2[256];
extern bool gbPrintShite;
extern bool gbModelViewer;
+#ifdef TIMEBARS
+extern bool gbShowTimebars;
+#endif
class CSprite2d;
diff --git a/src/core/patcher.cpp b/src/core/patcher.cpp
deleted file mode 100644
index 83e06886..00000000
--- a/src/core/patcher.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-#define WITHWINDOWS
-#include "common.h"
-#include "patcher.h"
-
-#include <algorithm>
-#include <vector>
-
-StaticPatcher *StaticPatcher::ms_head;
-
-StaticPatcher::StaticPatcher(Patcher func)
- : m_func(func)
-{
- m_next = ms_head;
- ms_head = this;
-}
-
-void
-StaticPatcher::Apply()
-{
- StaticPatcher *current = ms_head;
- while(current){
- current->Run();
- current = current->m_next;
- }
- ms_head = nil;
-}
-#ifdef _WIN32
-std::vector<uint32> usedAddresses;
-
-static DWORD protect[2];
-static uint32 protect_address;
-static uint32 protect_size;
-
-void
-Protect_internal(uint32 address, uint32 size)
-{
- protect_address = address;
- protect_size = size;
- VirtualProtect((void*)address, size, PAGE_EXECUTE_READWRITE, &protect[0]);
-}
-
-void
-Unprotect_internal(void)
-{
- VirtualProtect((void*)protect_address, protect_size, protect[0], &protect[1]);
-}
-
-void
-InjectHook_internal(uint32 address, uint32 hook, int type)
-{
- if(std::any_of(usedAddresses.begin(), usedAddresses.end(),
- [address](uint32 value) { return value == address; })) {
- debug("Used address %#06x twice when injecting hook\n", address);
- }
-
- usedAddresses.push_back(address);
-
-
- switch(type){
- case PATCH_JUMP:
- VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &protect[0]);
- *(uint8*)address = 0xE9;
- break;
- case PATCH_CALL:
- VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &protect[0]);
- *(uint8*)address = 0xE8;
- break;
- default:
- VirtualProtect((void*)(address + 1), 4, PAGE_EXECUTE_READWRITE, &protect[0]);
- break;
- }
-
- *(ptrdiff_t*)(address + 1) = hook - address - 5;
- if(type == PATCH_NOTHING)
- VirtualProtect((void*)(address + 1), 4, protect[0], &protect[1]);
- else
- VirtualProtect((void*)address, 5, protect[0], &protect[1]);
-}
-#else
-void
-Protect_internal(uint32 address, uint32 size)
-{
-}
-
-void
-Unprotect_internal(void)
-{
-}
-
-void
-InjectHook_internal(uint32 address, uint32 hook, int type)
-{
-}
-#endif
diff --git a/src/core/patcher.h b/src/core/patcher.h
deleted file mode 100644
index 2722b6fd..00000000
--- a/src/core/patcher.h
+++ /dev/null
@@ -1,144 +0,0 @@
-#pragma once
-
-#define WRAPPER __declspec(naked)
-#define DEPRECATED __declspec(deprecated)
-#define EAXJMP(a) { _asm mov eax, a _asm jmp eax }
-#define VARJMP(a) { _asm jmp a }
-#define WRAPARG(a) UNREFERENCED_PARAMETER(a)
-
-#include <string.h> //memset
-
-enum
-{
- PATCH_CALL,
- PATCH_JUMP,
- PATCH_NOTHING,
-};
-
-enum
-{
- III_10 = 1,
- III_11,
- III_STEAM,
- VC_10,
- VC_11,
- VC_STEAM
-};
-
-extern int gtaversion;
-
-class StaticPatcher
-{
-private:
- using Patcher = void(*)();
-
- Patcher m_func;
- StaticPatcher *m_next;
- static StaticPatcher *ms_head;
-
- void Run() { m_func(); }
-public:
- StaticPatcher(Patcher func);
- static void Apply();
-};
-
-template<typename T>
-inline T AddressByVersion(uint32_t addressIII10, uint32_t addressIII11, uint32_t addressIIISteam, uint32_t addressvc10, uint32_t addressvc11, uint32_t addressvcSteam)
-{
- if(gtaversion == -1){
- if(*(uint32_t*)0x5C1E75 == 0xB85548EC) gtaversion = III_10;
- else if(*(uint32_t*)0x5C2135 == 0xB85548EC) gtaversion = III_11;
- else if(*(uint32_t*)0x5C6FD5 == 0xB85548EC) gtaversion = III_STEAM;
- else if(*(uint32_t*)0x667BF5 == 0xB85548EC) gtaversion = VC_10;
- else if(*(uint32_t*)0x667C45 == 0xB85548EC) gtaversion = VC_11;
- else if(*(uint32_t*)0x666BA5 == 0xB85548EC) gtaversion = VC_STEAM;
- else gtaversion = 0;
- }
- switch(gtaversion){
- case III_10:
- return (T)addressIII10;
- case III_11:
- return (T)addressIII11;
- case III_STEAM:
- return (T)addressIIISteam;
- case VC_10:
- return (T)addressvc10;
- case VC_11:
- return (T)addressvc11;
- case VC_STEAM:
- return (T)addressvcSteam;
- default:
- return (T)0;
- }
-}
-
-inline bool
-is10(void)
-{
- return gtaversion == III_10 || gtaversion == VC_10;
-}
-
-inline bool
-isIII(void)
-{
- return gtaversion >= III_10 && gtaversion <= III_STEAM;
-}
-
-inline bool
-isVC(void)
-{
- return gtaversion >= VC_10 && gtaversion <= VC_STEAM;
-}
-
-#define PTRFROMCALL(addr) (uint32_t)(*(uint32_t*)((uint32_t)addr+1) + (uint32_t)addr + 5)
-#define INTERCEPT(saved, func, a) \
-{ \
- saved = PTRFROMCALL(a); \
- InjectHook(a, func); \
-}
-
-void InjectHook_internal(uint32 address, uint32 hook, int type);
-void Protect_internal(uint32 address, uint32 size);
-void Unprotect_internal(void);
-
-template<typename T, typename AT> inline void
-Patch(AT address, T value)
-{
- Protect_internal((uint32)address, sizeof(T));
- *(T*)address = value;
- Unprotect_internal();
-}
-
-template<typename AT> inline void
-Nop(AT address, unsigned int nCount)
-{
- Protect_internal((uint32)address, nCount);
- memset((void*)address, 0x90, nCount);
- Unprotect_internal();
-}
-
-template <typename T> inline void
-InjectHook(uintptr_t address, T hook, unsigned int nType = PATCH_NOTHING)
-{
- InjectHook_internal(address, reinterpret_cast<uintptr_t>((void *&)hook), nType);
-}
-
-inline void ExtractCall(void *dst, uint32_t a)
-{
- *(uint32_t*)dst = (uint32_t)(*(uint32_t*)(a+1) + a + 5);
-}
-template<typename T>
-inline void InterceptCall(void *dst, T func, uint32_t a)
-{
- ExtractCall(dst, a);
- InjectHook(a, func);
-}
-template<typename T>
-inline void InterceptVmethod(void *dst, T func, uint32_t a)
-{
- *(uint32_t*)dst = *(uint32_t*)a;
- Patch(a, func);
-}
-
-#define STARTPATCHES static StaticPatcher Patcher([](){
-#define ENDPATCHES });
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 9bc6400c..8c0020d0 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -2,7 +2,6 @@
#define WITHWINDOWS
#include "common.h"
#include "crossplatform.h"
-#include "patcher.h"
#include "Renderer.h"
#include "Credits.h"
#include "Camera.h"
@@ -27,6 +26,9 @@
#include "Radar.h"
#include "debugmenu.h"
#include "Frontend.h"
+#include "Text.h"
+#include "WaterLevel.h"
+#include "main.h"
#ifndef _WIN32
#include "assert.h"
@@ -66,6 +68,115 @@ mysrand(unsigned int seed)
myrand_seed = seed;
}
+#ifdef CUSTOM_FRONTEND_OPTIONS
+#include "frontendoption.h"
+#include "platform.h"
+
+void ReloadFrontendOptions(void)
+{
+ CustomFrontendOptionsPopulate();
+}
+
+#ifdef MORE_LANGUAGES
+void LangPolSelect(int8 action)
+{
+ if (action == FEOPTION_ACTION_SELECT) {
+ FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH;
+ FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
+ FrontEndMenuManager.InitialiseChangedLanguageSettings();
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+
+void LangRusSelect(int8 action)
+{
+ if (action == FEOPTION_ACTION_SELECT) {
+ FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN;
+ FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
+ FrontEndMenuManager.InitialiseChangedLanguageSettings();
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+
+void LangJapSelect(int8 action)
+{
+ if (action == FEOPTION_ACTION_SELECT) {
+ FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE;
+ FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
+ FrontEndMenuManager.InitialiseChangedLanguageSettings();
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+#endif
+
+#ifdef IMPROVED_VIDEOMODE
+void ScreenModeChange(int8 displayedValue)
+{
+ if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) {
+ FrontEndMenuManager.m_nPrefsWindowed = displayedValue;
+ _psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution
+ FrontEndMenuManager.SetHelperText(0);
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+#endif
+
+#ifdef FREE_CAM
+void ToggleFreeCam(int8 action)
+{
+ if (action == FEOPTION_ACTION_SELECT) {
+ TheCamera.bFreeCam = !TheCamera.bFreeCam;
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+#endif
+
+#ifdef CUTSCENE_BORDERS_SWITCH
+void BorderModeChange(int8 displayedValue)
+{
+ CMenuManager::m_PrefsCutsceneBorders = !!displayedValue;
+ FrontEndMenuManager.SaveSettings();
+}
+#endif
+
+// Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind
+void
+CustomFrontendOptionsPopulate(void)
+{
+ RemoveCustomFrontendOptions(); // if exist
+
+#ifdef MORE_LANGUAGES
+ FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS);
+ FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil);
+ FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, LangRusSelect, nil);
+ FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, LangJapSelect, nil);
+#endif
+
+#ifdef IMPROVED_VIDEOMODE
+ static const wchar *screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" };
+ FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 8);
+ FrontendOptionAddSelect(TheText.Get("SCRFOR"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil);
+#endif
+
+#ifdef MENU_MAP
+ FrontendOptionSetPosition(MENUPAGE_PAUSE_MENU, 2);
+ FrontendOptionAddRedirect(TheText.Get("FEG_MAP"), MENUPAGE_MAP);
+#endif
+
+#ifdef FREE_CAM
+ static const wchar *text = (wchar*)L"TOGGLE FREE CAM";
+ FrontendOptionSetPosition(MENUPAGE_CONTROLLER_PC, 1);
+ FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil);
+#endif
+
+#ifdef CUTSCENE_BORDERS_SWITCH
+ static const wchar *off_on[] = { TheText.Get("FEM_OFF"), TheText.Get("FEM_ON") };
+ FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 9);
+ FrontendOptionAddSelect((const wchar *)L"CUTSCENE BORDERS", off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil);
+#endif
+}
+#endif
+
#ifdef DEBUGMENU
void WeaponCheat();
void HealthCheat();
@@ -160,6 +271,13 @@ TeleportToWaypoint(void)
}
#endif
+static void
+SwitchCarCollision(void)
+{
+ if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar())
+ FindPlayerVehicle()->bUsesCollision = !FindPlayerVehicle()->bUsesCollision;
+}
+
static int engineStatus;
static void
SetEngineStatus(void)
@@ -357,11 +475,14 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Don't render Peds", &gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
+ DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
+ DebugMenuAddVarBool8("Debug", "pad 1 -> pad 2", &CPad::m_bMapPadOneToPadTwo, nil);
DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
#ifdef MENU_MAP
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
#endif
+ DebugMenuAddCmd("Debug", "Switch car collision", SwitchCarCollision);
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
@@ -374,14 +495,18 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
-#ifdef TOGGLEABLE_BETA_FEATURES
- DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil);
- DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", &CPed::bMakePedsRunToPhonesToReportCrimes, nil);
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions);
#endif
-
+ DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil);
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
+ DebugMenuAddVarBool8("Debug", "Show DebugStuffInRelease", &gbDebugStuffInRelease, nil);
+#ifdef TIMEBARS
+ DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil);
+#endif
+
extern bool PrintDebugCode;
extern int16 DebugCamMode;
DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil);