summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--premake5.lua2
-rw-r--r--src/animation/AnimBlendHierarchy.cpp3
-rw-r--r--src/animation/AnimBlendHierarchy.h2
-rw-r--r--src/animation/AnimBlendSequence.cpp3
-rw-r--r--src/animation/AnimManager.cpp91
-rw-r--r--src/animation/AnimManager.h2
-rw-r--r--src/animation/AnimationId.h6
-rw-r--r--src/animation/RpAnimBlend.cpp3
-rw-r--r--src/audio/MusicManager.cpp8
-rw-r--r--src/buildings/Building.cpp (renamed from src/entities/Building.cpp)0
-rw-r--r--src/buildings/Building.h (renamed from src/entities/Building.h)0
-rw-r--r--src/buildings/Solid.h (renamed from src/entities/Solid.h)0
-rw-r--r--src/buildings/Treadable.cpp (renamed from src/entities/Treadable.cpp)0
-rw-r--r--src/buildings/Treadable.h (renamed from src/entities/Treadable.h)0
-rw-r--r--src/collision/Collision.cpp14
-rw-r--r--src/control/Darkel.cpp53
-rw-r--r--src/control/Garages.cpp38
-rw-r--r--src/control/Pickups.cpp4
-rw-r--r--src/control/Replay.cpp39
-rw-r--r--src/control/SceneEdit.cpp36
-rw-r--r--src/control/Script.cpp6
-rw-r--r--src/control/Script.h38
-rw-r--r--src/control/Script3.cpp288
-rw-r--r--src/control/Script4.cpp154
-rw-r--r--src/control/Script5.cpp788
-rw-r--r--src/core/Cam.cpp16
-rw-r--r--src/core/Camera.cpp4
-rw-r--r--src/core/FileLoader.cpp6
-rw-r--r--src/core/FrontEndControls.cpp2
-rw-r--r--src/core/Frontend.cpp115
-rw-r--r--src/core/Frontend.h15
-rw-r--r--src/core/Frontend_PS2.cpp2
-rw-r--r--src/core/Game.cpp82
-rw-r--r--src/core/Game.h4
-rw-r--r--src/core/MenuScreens.cpp2
-rw-r--r--src/core/MenuScreensCustom.cpp28
-rw-r--r--src/core/Pad.cpp20
-rw-r--r--src/core/PlayerInfo.cpp640
-rw-r--r--src/core/PlayerInfo.h21
-rw-r--r--src/core/Radar.h4
-rw-r--r--src/core/World.cpp105
-rw-r--r--src/core/World.h11
-rw-r--r--src/core/common.h36
-rw-r--r--src/core/config.h4
-rw-r--r--src/core/main.cpp247
-rw-r--r--src/core/main.h1
-rw-r--r--src/core/re3.cpp2
-rw-r--r--src/core/templates.h49
-rw-r--r--src/extras/screendroplets.cpp19
-rw-r--r--src/math/Quaternion.h5
-rw-r--r--src/math/Rect.h19
-rw-r--r--src/math/Vector.h25
-rw-r--r--src/math/VuVector.h13
-rw-r--r--src/modelinfo/ModelInfo.cpp50
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp2
-rw-r--r--src/peds/CopPed.cpp2
-rw-r--r--src/peds/EmergencyPed.cpp16
-rw-r--r--src/peds/Ped.cpp88
-rw-r--r--src/peds/Ped.h4
-rw-r--r--src/peds/PedAI.cpp2
-rw-r--r--src/peds/PedFight.cpp2
-rw-r--r--src/peds/PedIK.cpp14
-rw-r--r--src/peds/PedIK.h2
-rw-r--r--src/peds/PlayerPed.cpp8
-rw-r--r--src/render/Clouds.cpp2
-rw-r--r--src/render/Coronas.cpp6
-rw-r--r--src/render/Credits.cpp19
-rw-r--r--src/render/Fluff.cpp10
-rw-r--r--src/render/Font.cpp140
-rw-r--r--src/render/Font.h17
-rw-r--r--src/render/Hud.cpp966
-rw-r--r--src/render/Hud.h72
-rw-r--r--src/render/Particle.cpp4
-rw-r--r--src/render/PointLights.cpp4
-rw-r--r--src/render/Renderer.cpp4
-rw-r--r--src/render/SpecialFX.cpp10
-rw-r--r--src/render/WaterLevel.cpp96
-rw-r--r--src/render/Weather.cpp2
-rw-r--r--src/rw/MemoryHeap.h23
-rw-r--r--src/rw/TexRead.cpp1
-rw-r--r--src/vehicles/Automobile.cpp16
-rw-r--r--src/vehicles/Automobile.h2
-rw-r--r--src/vehicles/Vehicle.cpp5
-rw-r--r--src/vehicles/Vehicle.h8
-rw-r--r--src/weapons/Weapon.cpp4
m---------vendor/librw0
86 files changed, 3271 insertions, 1405 deletions
diff --git a/premake5.lua b/premake5.lua
index 85f4d082..ea26b0ac 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -234,6 +234,7 @@ project "re3"
files { addSrcFiles("src/audio") }
files { addSrcFiles("src/audio/eax") }
files { addSrcFiles("src/audio/oal") }
+ files { addSrcFiles("src/buildings") }
files { addSrcFiles("src/collision") }
files { addSrcFiles("src/control") }
files { addSrcFiles("src/core") }
@@ -257,6 +258,7 @@ project "re3"
includedirs { "src/audio" }
includedirs { "src/audio/eax" }
includedirs { "src/audio/oal" }
+ includedirs { "src/buildings" }
includedirs { "src/collision" }
includedirs { "src/control" }
includedirs { "src/core" }
diff --git a/src/animation/AnimBlendHierarchy.cpp b/src/animation/AnimBlendHierarchy.cpp
index c7800de5..ea669999 100644
--- a/src/animation/AnimBlendHierarchy.cpp
+++ b/src/animation/AnimBlendHierarchy.cpp
@@ -52,8 +52,7 @@ CAnimBlendHierarchy::RemoveQuaternionFlips(void)
void
CAnimBlendHierarchy::RemoveAnimSequences(void)
{
- if(sequences)
- delete[] sequences;
+ delete[] sequences;
numSequences = 0;
}
diff --git a/src/animation/AnimBlendHierarchy.h b/src/animation/AnimBlendHierarchy.h
index e35b4925..40d2731b 100644
--- a/src/animation/AnimBlendHierarchy.h
+++ b/src/animation/AnimBlendHierarchy.h
@@ -15,7 +15,7 @@ public:
char name[24];
CAnimBlendSequence *sequences;
int16 numSequences;
- int16 compressed; // not really used
+ int16 compressed;
float totalLength;
CLink<CAnimBlendHierarchy*> *linkPtr;
diff --git a/src/animation/AnimBlendSequence.cpp b/src/animation/AnimBlendSequence.cpp
index c958b71a..2ae150c1 100644
--- a/src/animation/AnimBlendSequence.cpp
+++ b/src/animation/AnimBlendSequence.cpp
@@ -16,9 +16,10 @@ CAnimBlendSequence::CAnimBlendSequence(void)
CAnimBlendSequence::~CAnimBlendSequence(void)
{
- assert(keyFramesCompressed == nil);
if(keyFrames)
RwFree(keyFrames);
+ if(keyFramesCompressed)
+ RwFree(keyFramesCompressed);
}
void
diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp
index 877dcd76..8d442b72 100644
--- a/src/animation/AnimManager.cpp
+++ b/src/animation/AnimManager.cpp
@@ -57,6 +57,9 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FLOOR_HIT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
+#if GTA_VERSION <= GTA3_PS2_160
+ { ANIM_HIT_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
+#endif
{ ANIM_HIT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_CHEST, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
@@ -78,6 +81,8 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_HGUN_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
+#ifdef PC_PLAYER_CONTROLS
+ // maybe wrong define, but unused anyway
{ ANIM_FPS_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_BAT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_UZI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
@@ -85,6 +90,7 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_FPS_AK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_M16, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_ROCKET, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
+#endif
{ ANIM_FIGHT_IDLE, ASSOC_REPEAT },
{ ANIM_FIGHT2_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_SH_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
@@ -193,6 +199,7 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
};
+#ifdef PC_PLAYER_CONTROLS
AnimAssocDesc aStdAnimDescsSide[] = {
{ ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
@@ -200,6 +207,7 @@ AnimAssocDesc aStdAnimDescsSide[] = {
{ ANIM_IDLE_STANCE, ASSOC_REPEAT },
{ ANIM_WALK_START, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
};
+#endif
char const *aStdAnimations[] = {
"walk_civi",
"run_civi",
@@ -239,6 +247,9 @@ char const *aStdAnimations[] = {
"HIT_back",
"HIT_R",
"FLOOR_hit",
+#if GTA_VERSION <= GTA3_PS2_160
+ "HIT_body",
+#endif
"HIT_bodyblow",
"HIT_chest",
"HIT_head",
@@ -260,6 +271,8 @@ char const *aStdAnimations[] = {
"bomber",
"WEAPON_hgun_rload",
"WEAPON_AK_rload",
+#ifdef PC_PLAYER_CONTROLS
+ // maybe wrong define, but unused anyway
"FPS_PUNCH",
"FPS_BAT",
"FPS_UZI",
@@ -267,6 +280,7 @@ char const *aStdAnimations[] = {
"FPS_AK",
"FPS_M16",
"FPS_ROCKET",
+#endif
"FIGHTIDLE",
"FIGHT2IDLE",
"FIGHTsh_F",
@@ -488,6 +502,7 @@ char const *aPanicChunkyAnimations[] = {
"woman_runpanic",
"idle_stance",
};
+#ifdef PC_PLAYER_CONTROLS
char const *aPlayerStrafeBackAnimations[] = {
"walk_player_back",
"run_player_back",
@@ -530,6 +545,7 @@ char const *aRocketStrafeRightAnimations[] = {
"idle_rocket",
"walkst_rocket_right",
};
+#endif
#define awc(a) ARRAY_SIZE(a), a
const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS] = {
@@ -552,12 +568,14 @@ const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_
{ "oldwoman", "ped", MI_COP, awc(aOldWomanAnimations), aStdAnimDescs },
{ "fatwoman", "ped", MI_COP, awc(aFatWomanAnimations), aStdAnimDescs },
{ "panicchunky", "ped", MI_COP, awc(aPanicChunkyAnimations), aStdAnimDescs },
+#ifdef PC_PLAYER_CONTROLS
{ "playerback", "ped", MI_COP, awc(aPlayerStrafeBackAnimations), aStdAnimDescs },
{ "playerleft", "ped", MI_COP, awc(aPlayerStrafeLeftAnimations), aStdAnimDescsSide },
{ "playerright", "ped", MI_COP, awc(aPlayerStrafeRightAnimations), aStdAnimDescsSide },
{ "rocketback", "ped", MI_COP, awc(aRocketStrafeBackAnimations), aStdAnimDescs },
{ "rocketleft", "ped", MI_COP, awc(aRocketStrafeLeftAnimations), aStdAnimDescsSide },
{ "rocketright", "ped", MI_COP, awc(aRocketStrafeRightAnimations), aStdAnimDescsSide },
+#endif
};
#undef awc
@@ -841,54 +859,57 @@ CAnimManager::LoadAnimFile(int fd, bool compress)
ROUNDSIZE(anim.size);
CFileMgr::Read(fd, buf, anim.size);
int numFrames = *(int*)(buf+28);
+ seq->SetName(buf);
#ifdef PED_SKIN
if(anim.size == 44)
seq->SetBoneTag(*(int*)(buf+40));
#endif
- seq->SetName(buf);
if(numFrames == 0)
continue;
+ bool hasScale = false;
+ bool hasTranslation = false;
CFileMgr::Read(fd, (char*)&info, sizeof(info));
- if(strncmp(info.ident, "KR00", 4) == 0){
- seq->SetNumFrames(numFrames, false);
- KeyFrame *kf = seq->GetKeyFrame(0);
- for(l = 0; l < numFrames; l++, kf++){
- CFileMgr::Read(fd, buf, 0x14);
- kf->rotation.x = -fbuf[0];
- kf->rotation.y = -fbuf[1];
- kf->rotation.z = -fbuf[2];
- kf->rotation.w = fbuf[3];
- kf->deltaTime = fbuf[4]; // absolute time here
- }
- }else if(strncmp(info.ident, "KRT0", 4) == 0){
+ if(strncmp(info.ident, "KRTS", 4) == 0){
+ hasScale = true;
seq->SetNumFrames(numFrames, true);
- KeyFrameTrans *kf = (KeyFrameTrans*)seq->GetKeyFrame(0);
- for(l = 0; l < numFrames; l++, kf++){
- CFileMgr::Read(fd, buf, 0x20);
- kf->rotation.x = -fbuf[0];
- kf->rotation.y = -fbuf[1];
- kf->rotation.z = -fbuf[2];
- kf->rotation.w = fbuf[3];
- kf->translation.x = fbuf[4];
- kf->translation.y = fbuf[5];
- kf->translation.z = fbuf[6];
- kf->deltaTime = fbuf[7]; // absolute time here
- }
- }else if(strncmp(info.ident, "KRTS", 4) == 0){
+ }else if(strncmp(info.ident, "KRT0", 4) == 0){
+ hasTranslation = true;
seq->SetNumFrames(numFrames, true);
- KeyFrameTrans *kf = (KeyFrameTrans*)seq->GetKeyFrame(0);
- for(l = 0; l < numFrames; l++, kf++){
+ }else if(strncmp(info.ident, "KR00", 4) == 0){
+ seq->SetNumFrames(numFrames, false);
+ }
+
+ for(l = 0; l < numFrames; l++){
+ if(hasScale){
CFileMgr::Read(fd, buf, 0x2C);
- kf->rotation.x = -fbuf[0];
- kf->rotation.y = -fbuf[1];
- kf->rotation.z = -fbuf[2];
- kf->rotation.w = fbuf[3];
- kf->translation.x = fbuf[4];
- kf->translation.y = fbuf[5];
- kf->translation.z = fbuf[6];
+ CQuaternion rot(fbuf[0], fbuf[1], fbuf[2], fbuf[3]);
+ rot.Invert();
+ CVector trans(fbuf[4], fbuf[5], fbuf[6]);
+
+ KeyFrameTrans *kf = (KeyFrameTrans*)seq->GetKeyFrame(l);
+ kf->rotation = rot;
+ kf->translation = trans;
// scaling ignored
kf->deltaTime = fbuf[10]; // absolute time here
+ }else if(hasTranslation){
+ CFileMgr::Read(fd, buf, 0x20);
+ CQuaternion rot(fbuf[0], fbuf[1], fbuf[2], fbuf[3]);
+ rot.Invert();
+ CVector trans(fbuf[4], fbuf[5], fbuf[6]);
+
+ KeyFrameTrans *kf = (KeyFrameTrans*)seq->GetKeyFrame(l);
+ kf->rotation = rot;
+ kf->translation = trans;
+ kf->deltaTime = fbuf[7]; // absolute time here
+ }else{
+ CFileMgr::Read(fd, buf, 0x14);
+ CQuaternion rot(fbuf[0], fbuf[1], fbuf[2], fbuf[3]);
+ rot.Invert();
+
+ KeyFrame *kf = (KeyFrame*)seq->GetKeyFrame(l);
+ kf->rotation = rot;
+ kf->deltaTime = fbuf[4]; // absolute time here
}
}
diff --git a/src/animation/AnimManager.h b/src/animation/AnimManager.h
index de15602c..92192c71 100644
--- a/src/animation/AnimManager.h
+++ b/src/animation/AnimManager.h
@@ -24,12 +24,14 @@ enum AssocGroupId
ASSOCGRP_OLDWOMAN,
ASSOCGRP_FATWOMAN,
ASSOCGRP_PANICCHUNKY,
+#ifdef PC_PLAYER_CONTROLS
ASSOCGRP_PLAYERBACK,
ASSOCGRP_PLAYERLEFT,
ASSOCGRP_PLAYERRIGHT,
ASSOCGRP_ROCKETBACK,
ASSOCGRP_ROCKETLEFT,
ASSOCGRP_ROCKETRIGHT,
+#endif
NUM_ANIM_ASSOC_GROUPS
};
diff --git a/src/animation/AnimationId.h b/src/animation/AnimationId.h
index 82fed8bd..4b3dd92d 100644
--- a/src/animation/AnimationId.h
+++ b/src/animation/AnimationId.h
@@ -40,6 +40,9 @@ enum AnimationId
ANIM_HIT_BACK,
ANIM_HIT_RIGHT,
ANIM_FLOOR_HIT,
+#if GTA_VERSION <= GTA3_PS2_160
+ ANIM_HIT_BODY,
+#endif
ANIM_HIT_BODYBLOW,
ANIM_HIT_CHEST,
ANIM_HIT_HEAD,
@@ -61,6 +64,8 @@ enum AnimationId
ANIM_BOMBER,
ANIM_HGUN_RELOAD,
ANIM_AK_RELOAD,
+#ifdef PC_PLAYER_CONTROLS
+ // maybe wrong define, but unused anyway
ANIM_FPS_PUNCH,
ANIM_FPS_BAT,
ANIM_FPS_UZI,
@@ -68,6 +73,7 @@ enum AnimationId
ANIM_FPS_AK,
ANIM_FPS_M16,
ANIM_FPS_ROCKET,
+#endif
ANIM_FIGHT_IDLE,
ANIM_FIGHT2_IDLE,
ANIM_FIGHT_SH_F,
diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp
index dcb656ee..e430e52a 100644
--- a/src/animation/RpAnimBlend.cpp
+++ b/src/animation/RpAnimBlend.cpp
@@ -8,6 +8,7 @@
#include "AnimBlendClumpData.h"
#include "AnimBlendHierarchy.h"
#include "AnimBlendAssociation.h"
+#include "AnimManager.h"
#include "RpAnimBlend.h"
#ifdef PED_SKIN
#include "PedModelInfo.h"
@@ -441,7 +442,7 @@ RpAnimBlendClumpUpdateAnimations(RpClump *clump, float timeDelta)
next = link->next;
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
if(assoc->UpdateBlend(timeDelta)){
- // CAnimManager::UncompressAnimation(v6->hierarchy)
+ CAnimManager::UncompressAnimation(assoc->hierarchy);
updateData.nodes[i++] = assoc->GetNode(0);
if(assoc->flags & ASSOC_MOVEMENT){
totalLength += assoc->hierarchy->totalLength/assoc->speed * assoc->blendAmount;
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index cde1c8f5..54c1b0bc 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -190,9 +190,15 @@ cMusicManager::DisplayRadioStationName()
CFont::SetPropOn();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetCentreOn();
- CFont::SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
+ // Reminder: Game doesn't have "scaling" at all, it just stretches, and it's team's decision here to not let centered text occupy all the screen.
+ // Disable ASPECT_RATIO_SCALE and it'll go back to default behaviour; stretching.
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), pCurrentStation);
+#else
+ CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, SCREEN_SCALE_Y(22.0f) + 2.0f, pCurrentStation);
+#endif
if(gNumRetunePresses)
CFont::SetColor(CRGBA(102, 133, 143, 255));
diff --git a/src/entities/Building.cpp b/src/buildings/Building.cpp
index 00bbb21e..00bbb21e 100644
--- a/src/entities/Building.cpp
+++ b/src/buildings/Building.cpp
diff --git a/src/entities/Building.h b/src/buildings/Building.h
index 3586a8dc..3586a8dc 100644
--- a/src/entities/Building.h
+++ b/src/buildings/Building.h
diff --git a/src/entities/Solid.h b/src/buildings/Solid.h
index 4ca800c2..4ca800c2 100644
--- a/src/entities/Solid.h
+++ b/src/buildings/Solid.h
diff --git a/src/entities/Treadable.cpp b/src/buildings/Treadable.cpp
index 00abbe13..00abbe13 100644
--- a/src/entities/Treadable.cpp
+++ b/src/buildings/Treadable.cpp
diff --git a/src/entities/Treadable.h b/src/buildings/Treadable.h
index c3160f47..c3160f47 100644
--- a/src/entities/Treadable.h
+++ b/src/buildings/Treadable.h
diff --git a/src/collision/Collision.cpp b/src/collision/Collision.cpp
index 41997e32..7fb5c30b 100644
--- a/src/collision/Collision.cpp
+++ b/src/collision/Collision.cpp
@@ -665,7 +665,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
// If we don't intersect with the bounding box, no chance on the rest
if(!TestLineBox(*(CColLine*)newline, model.boundingBox))
@@ -1474,7 +1474,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
if(mindist < 1.0f)
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
@@ -1606,7 +1606,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
if(mindist < 1.0f)
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
@@ -1806,16 +1806,16 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
matAB *= matrixA;
CVuVector bsphereAB; // bounding sphere of A in B space
- TransformPoint(bsphereAB, matAB, *(RwV3d*)modelA.boundingSphere.center); // inlined
+ TransformPoint(bsphereAB, matAB, modelA.boundingSphere.center); // inlined
bsphereAB.w = modelA.boundingSphere.radius;
if(!TestSphereBox(*(CColSphere*)&bsphereAB, modelB.boundingBox))
return 0;
// transform modelA's spheres and lines to B space
- TransformPoints(aSpheresA, modelA.numSpheres, matAB, (RwV3d*)&modelA.spheres->center, sizeof(CColSphere));
+ TransformPoints(aSpheresA, modelA.numSpheres, matAB, &modelA.spheres->center, sizeof(CColSphere));
for(i = 0; i < modelA.numSpheres; i++)
aSpheresA[i].w = modelA.spheres[i].radius;
- TransformPoints(aLinesA, modelA.numLines*2, matAB, (RwV3d*)&modelA.lines->p0, sizeof(CColLine)/2);
+ TransformPoints(aLinesA, modelA.numLines*2, matAB, &modelA.lines->p0, sizeof(CColLine)/2);
// Test them against model B's bounding volumes
int numSpheresA = 0;
@@ -1832,7 +1832,7 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
matBA *= matrixB;
// transform modelB's spheres to A space
- TransformPoints(aSpheresB, modelB.numSpheres, matBA, (RwV3d*)&modelB.spheres->center, sizeof(CColSphere));
+ TransformPoints(aSpheresB, modelB.numSpheres, matBA, &modelB.spheres->center, sizeof(CColSphere));
for(i = 0; i < modelB.numSpheres; i++)
aSpheresB[i].w = modelB.spheres[i].radius;
diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp
index afdfcb82..91d2163d 100644
--- a/src/control/Darkel.cpp
+++ b/src/control/Darkel.cpp
@@ -72,13 +72,21 @@ CDarkel::DrawMessages()
{
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_SCALE_X(610.0f));
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 30));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 30);
+#endif
CFont::SetCentreOn();
CFont::SetPropOn();
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
if (CDarkel::bStandardSoundAndMessages) {
if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
+#else
+ CFont::SetScale(1.3f, 1.3f);
+#endif
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 3000, 11000)));
CFont::SetFontStyle(FONT_BANK);
@@ -88,7 +96,11 @@ CDarkel::DrawMessages()
}
} else {
if (timePassedSinceStart < 8000) {
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
+#else
+ CFont::SetScale(1.3f, 1.3f);
+#endif
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 0, 8000)));
CFont::SetFontStyle(FONT_BANK);
@@ -97,7 +109,11 @@ CDarkel::DrawMessages()
}
}
}
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(0.75f), SCREEN_SCALE_Y(1.5f));
+#else
+ CFont::SetScale(0.75f, 1.5f);
+#endif
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
@@ -107,7 +123,15 @@ CDarkel::DrawMessages()
AsciiToUnicode(gString, gUString);
if (timeLeft > 4000 || CTimer::GetFrameCounter() & 1) {
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(109.0f), gUString);
+#if defined(PS2_HUD) || defined(FIX_BUGS)
+ #ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f - 1.0f), SCREEN_SCALE_Y(108.0f + 1.0f), gUString);
+ #else -
+ CFont::PrintString(SCREEN_WIDTH-(34.0f - 1.0f), 108.0f + 1.0f, gUString);
+ #endif
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f + 1.0f), SCREEN_SCALE_Y(108.0f + 1.0f), gUString);
+#endif
CFont::SetColor(CRGBA(150, 100, 255, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(108.0f), gUString);
}
@@ -120,7 +144,16 @@ CDarkel::DrawMessages()
#else
#define DARKEL_COUNTER_HEIGHT 128.0f
#endif
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT + 1.0f), gUString);
+
+#if defined(PS2_HUD) || defined(FIX_BUGS)
+ #ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f - 1.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT + 1.0f), gUString);
+ #else
+ CFont::PrintString(SCREEN_WIDTH-(34.0f - 1.0f), DARKEL_COUNTER_HEIGHT + 1.0f, gUString);
+ #endif
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f + 1.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT + 1.0f), gUString);
+#endif
CFont::SetColor(CRGBA(255, 128, 128, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT), gUString);
#undef DARKEL_COUNTER_HEIGHT
@@ -132,13 +165,25 @@ CDarkel::DrawMessages()
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
if (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart < 5000) {
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 20);
+#endif
CFont::SetCentreOn();
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
+#else
+ CFont::SetScale(1.5f, 1.5f);
+#endif
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(128, 255, 128, CalcFade(timePassedSinceStart, 0, 5000)));
CFont::SetFontStyle(FONT_BANK);
+#ifdef FIX_BUGS
int y = SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(25.0f - timePassedSinceStart * 0.01f);
+#else
+ int y = (SCREEN_HEIGHT / 2 + 25) - (timePassedSinceStart * 0.01f);
+#endif
CFont::PrintString(SCREEN_WIDTH / 2, y, TheText.Get("KF_3"));
}
}
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 07fc0612..418195c7 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -1397,16 +1397,24 @@ void CGarage::RemoveCarsBlockingDoorNotInside()
void CGarages::PrintMessages()
{
if (CTimer::GetTimeInMilliseconds() > MessageStartTime && CTimer::GetTimeInMilliseconds() < MessageEndTime) {
- CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); // BUG: game doesn't use macro here.
+#ifdef FIX_BUGS
+ CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f));
+#else
+ CFont::SetScale(1.2f, 1.5f);
+#endif
CFont::SetPropOn();
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 50));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 50);
+#endif
CFont::SetCentreOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetColor(CRGBA(0, 0, 0, 255));
-#if defined(GTA_PS2) || defined (FIX_BUGS)
+#if defined(PS2_HUD) || defined (FIX_BUGS)
float y_offset = SCREEN_HEIGHT / 3; // THIS is PS2 calculation
#else
float y_offset = SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(84.0f); // This is PC and results in text being written over some HUD elements
@@ -1414,22 +1422,40 @@ void CGarages::PrintMessages()
if (MessageNumberInString2 >= 0) {
CMessages::InsertNumberInString(TheText.Get(MessageIDString), MessageNumberInString, MessageNumberInString2, -1, -1, -1, -1, gUString);
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), y_offset - SCREEN_SCALE_Y(40.0f) + SCREEN_SCALE_Y(2.0f), gUString);
-
+#else
+ CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, y_offset - 40.0f + 2.0f, gUString);
+#endif
CFont::SetColor(CRGBA(89, 115, 150, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_WIDTH / 2, y_offset - SCREEN_SCALE_Y(40.0f), gUString);
+#else
+ CFont::PrintString(SCREEN_WIDTH / 2, y_offset - 40.0f, gUString);
+#endif
}
else if (MessageNumberInString >= 0) {
CMessages::InsertNumberInString(TheText.Get(MessageIDString), MessageNumberInString, -1, -1, -1, -1, -1, gUString);
-
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), y_offset - SCREEN_SCALE_Y(40.0f) + SCREEN_SCALE_Y(2.0f), gUString);
+#else
+ CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, y_offset - 40.0f + 2.0f, gUString);
+#endif
CFont::SetColor(CRGBA(89, 115, 150, 255));
+
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_WIDTH / 2, y_offset - SCREEN_SCALE_Y(40.0f), gUString);
+#else
+ CFont::PrintString(SCREEN_WIDTH / 2, y_offset - 40.0f, gUString);
+#endif
}
else {
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(2.0f), y_offset - SCREEN_SCALE_Y(2.0f), TheText.Get(MessageIDString));
-
+#else
+ CFont::PrintString(SCREEN_WIDTH / 2 - 2.0f, y_offset - 2.0f, TheText.Get(MessageIDString));
+#endif
CFont::SetColor(CRGBA(89, 115, 150, 255));
CFont::PrintString(SCREEN_WIDTH / 2, y_offset, TheText.Get(MessageIDString));
}
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 19b3d3a7..857f74ec 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -964,7 +964,11 @@ CPickups::RenderPickUpText()
float fScaleX = aMessages[i].m_dist.x / 100.0f;
if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE;
+#ifdef FIX_BUGS
+ CFont::SetScale(SCREEN_SCALE_X(fScaleX), SCREEN_SCALE_Y(fScaleY));
+#else
CFont::SetScale(fScaleX, fScaleY);
+#endif
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH);
CFont::SetJustifyOff();
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 4732ba2f..05880162 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -1038,10 +1038,10 @@ void CReplay::ProcessReplayCamera(void)
TheCamera.GetUp() = CVector(0.0f, 1.0f, 0.0f);
TheCamera.GetRight() = CVector(1.0f, 0.0f, 0.0f);
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
- pm->pos = *(RwV3d*)&TheCamera.GetPosition();
- pm->at = *(RwV3d*)&TheCamera.GetForward();
- pm->up = *(RwV3d*)&TheCamera.GetUp();
- pm->right = *(RwV3d*)&TheCamera.GetRight();
+ pm->pos = TheCamera.GetPosition();
+ pm->at = TheCamera.GetForward();
+ pm->up = TheCamera.GetUp();
+ pm->right = TheCamera.GetRight();
break;
}
case REPLAYCAMMODE_FIXED:
@@ -1057,10 +1057,10 @@ void CReplay::ProcessReplayCamera(void)
TheCamera.GetMatrix().GetUp() = up;
TheCamera.GetMatrix().GetRight() = right;
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
- pm->pos = *(RwV3d*)&TheCamera.GetMatrix().GetPosition();
- pm->at = *(RwV3d*)&TheCamera.GetMatrix().GetForward();
- pm->up = *(RwV3d*)&TheCamera.GetMatrix().GetUp();
- pm->right = *(RwV3d*)&TheCamera.GetMatrix().GetRight();
+ pm->pos = TheCamera.GetMatrix().GetPosition();
+ pm->at = TheCamera.GetMatrix().GetForward();
+ pm->up = TheCamera.GetMatrix().GetUp();
+ pm->right = TheCamera.GetMatrix().GetRight();
break;
}
default:
@@ -1581,10 +1581,10 @@ void CReplay::ProcessLookAroundCam(void)
TheCamera.GetRight() = right;
TheCamera.SetPosition(camera_pt);
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
- pm->pos = *(RwV3d*)&TheCamera.GetPosition();
- pm->at = *(RwV3d*)&TheCamera.GetForward();
- pm->up = *(RwV3d*)&TheCamera.GetUp();
- pm->right = *(RwV3d*)&TheCamera.GetRight();
+ pm->pos = TheCamera.GetPosition();
+ pm->at = TheCamera.GetForward();
+ pm->up = TheCamera.GetUp();
+ pm->right = TheCamera.GetRight();
TheCamera.CalculateDerivedValues();
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
@@ -1616,13 +1616,20 @@ void CReplay::Display()
TimeCount = (TimeCount + 1) % UINT16_MAX;
if ((TimeCount & 0x20) == 0)
return;
- CFont::SetPropOn();
- CFont::SetBackgroundOff();
+
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
- CFont::SetAlignment(ALIGN_LEFT);
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-20));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH-20);
+#endif
+ CFont::SetCentreOff();
+ CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
CFont::SetFontStyle(FONT_BANK);
if (Mode == MODE_PLAYBACK)
- CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY"));
+ CFont::PrintString(SCREEN_WIDTH/15, SCREEN_HEIGHT/10, TheText.Get("REPLAY"));
}
#endif
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp
index 8224c1d4..b7623133 100644
--- a/src/control/SceneEdit.cpp
+++ b/src/control/SceneEdit.cpp
@@ -279,24 +279,44 @@ void CSceneEdit::Draw(void)
#endif
sprintf(str, "Action");
AsciiToUnicode(str, wstr);
- CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(ACTION_MESSAGE_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(ACTION_MESSAGE_Y + SHADOW_OFFSET), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-ACTION_MESSAGE_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-ACTION_MESSAGE_Y) + SHADOW_OFFSET, wstr);
+#endif
CFont::SetColor(CRGBA(193, 164, 120, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(ACTION_MESSAGE_X_RIGHT), SCREEN_SCALE_Y(ACTION_MESSAGE_Y), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-ACTION_MESSAGE_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-ACTION_MESSAGE_Y), wstr);
+#endif
sprintf(str, "Selected");
AsciiToUnicode(str, wstr);
- CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(SELECTED_MESSAGE_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(SELECTED_MESSAGE_Y + SHADOW_OFFSET), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-SELECTED_MESSAGE_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-SELECTED_MESSAGE_Y) + SHADOW_OFFSET, wstr);
+#endif
CFont::SetColor(CRGBA(193, 164, 120, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(SELECTED_MESSAGE_X_RIGHT), SCREEN_SCALE_Y(SELECTED_MESSAGE_Y), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-SELECTED_MESSAGE_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-SELECTED_MESSAGE_Y), wstr);
+#endif
CFont::SetCentreOff();
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.7f));
+#else
+ CFont::SetScale(0.7f, 0.7f);
+#endif
#ifdef FIX_BUGS
CFont::SetFontStyle(FONT_BANK);
#else
CFont::SetFontStyle(FONT_HEADING);
#endif
- CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
for (int i = 0; i < NUM_COMMANDS_TO_DRAW; i++) {
int16 nCommandDrawn = m_nCurrentCommand + i - NUM_COMMANDS_TO_DRAW / 2;
if (nCommandDrawn >= MOVIE_TOTAL_COMMANDS)
@@ -305,13 +325,21 @@ void CSceneEdit::Draw(void)
nCommandDrawn += (MOVIE_TOTAL_COMMANDS - 1);
sprintf(str, "%s", pCommandStrings[nCommandDrawn]);
AsciiToUnicode(str, wstr);
- CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
+#endif
if (nCommandDrawn == m_nCurrentCommand)
CFont::SetColor(CRGBA(156, 91, 40, 255));
else
CFont::SetColor(CRGBA(193, 164, 120, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr);
+#endif
}
}
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 67d2e618..6aa48d81 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -58,7 +58,7 @@ int32 CTheScripts::StoreVehicleIndex;
bool CTheScripts::StoreVehicleWasRandom;
CRunningScript *CTheScripts::pIdleScripts;
CRunningScript *CTheScripts::pActiveScripts;
-uint32 CTheScripts::NextFreeCollectiveIndex;
+int32 CTheScripts::NextFreeCollectiveIndex;
int32 CTheScripts::LastRandomPedId;
uint16 CTheScripts::NumberOfUsedObjects;
bool CTheScripts::bAlreadyRunningAMissionScript;
@@ -1810,8 +1810,8 @@ void CTheScripts::Init()
OnAMissionForContactFlag[i] = 0;
}
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++){
- CollectiveArray[i].index = -1;
- CollectiveArray[i].unk_data = 0;
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
}
NextFreeCollectiveIndex = 0;
LastRandomPedId = -1;
diff --git a/src/control/Script.h b/src/control/Script.h
index 7fc18727..1c4663ce 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -1,5 +1,6 @@
#pragma once
#include "common.h"
+#include "Ped.h"
#include "PedType.h"
#include "Text.h"
#include "Sprite2d.h"
@@ -38,6 +39,10 @@ void FlushLog();
#define KEY_LENGTH_IN_SCRIPT 8
+#if GTA_VERSION <= GTA_PS2_160
+#define GTA_SCRIPT_COLLECTIVE
+#endif
+
struct intro_script_rectangle
{
bool m_bIsUsed;
@@ -213,8 +218,8 @@ enum {
struct tCollectiveData
{
- int32 index;
- uint32 unk_data;
+ int32 colIndex;
+ int32 pedIndex;
};
enum {
@@ -286,7 +291,7 @@ class CTheScripts
static bool StoreVehicleWasRandom;
static CRunningScript *pIdleScripts;
static CRunningScript *pActiveScripts;
- static uint32 NextFreeCollectiveIndex;
+ static int32 NextFreeCollectiveIndex;
static int32 LastRandomPedId;
static uint16 NumberOfUsedObjects;
static bool bAlreadyRunningAMissionScript;
@@ -393,6 +398,25 @@ private:
static int32 GetNewUniqueScriptSphereIndex(int32 index);
static void RemoveScriptSphere(int32 index);
+#ifdef GTA_SCRIPT_COLLECTIVE
+ static void AdvanceCollectiveIndex()
+ {
+ if (NextFreeCollectiveIndex == INT32_MAX)
+ NextFreeCollectiveIndex = 0;
+ else
+ NextFreeCollectiveIndex++;
+ }
+
+ static int AddPedsInVehicleToCollective(int);
+ static int AddPedsInAreaToCollective(float, float, float, float);
+ static int FindFreeSlotInCollectiveArray();
+ static void SetObjectiveForAllPedsInCollective(int, eObjective, int16, int16);
+ static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector, float);
+ static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector);
+ static void SetObjectiveForAllPedsInCollective(int, eObjective, void*);
+ static void SetObjectiveForAllPedsInCollective(int, eObjective);
+#endif
+
friend class CRunningScript;
friend class CHud;
friend void CMissionCleanup::Process();
@@ -511,6 +535,14 @@ private:
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
+#ifdef GTA_SCRIPT_COLLECTIVE
+ void LocateCollectiveCommand(int32, uint32*);
+ void LocateCollectiveCharCommand(int32, uint32*);
+ void LocateCollectiveCarCommand(int32, uint32*);
+ void LocateCollectivePlayerCommand(int32, uint32*);
+ void CollectiveInAreaCheckCommand(int32, uint32*);
+#endif
+
#ifdef MISSION_REPLAY
bool CanAllowMissionReplay();
#endif
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index 1f1ed537..9a37cb6c 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -853,7 +853,12 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_PLAYING);
return 0;
}
- //case COMMAND_SET_COLL_OBJ_NO_OBJ:
+#ifdef GTA_SCRIPT_COLLECTIVE
+ case COMMAND_SET_COLL_OBJ_NO_OBJ:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_NONE);
+ return 0;
+#endif
default:
script_assert(0);
}
@@ -863,65 +868,314 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
int8 CRunningScript::ProcessCommands600To699(int32 command)
{
switch (command){
- /* Collective commands are not implemented until LCS.
+#ifdef GTA_SCRIPT_COLLECTIVE
case COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_ON_FOOT);
+ return 0;
case COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
+ return 0;
case COMMAND_SET_COLL_OBJ_GUARD_SPOT:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[1];
+ if (pos.z <= MAP_Z_LOW_LIMIT)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_GUARD_AREA:
+ {
+ CollectParameters(&m_nIp, 5);
+ float infX = *(float*)&ScriptParams[1];
+ float supX = *(float*)&ScriptParams[3];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ float infY = *(float*)&ScriptParams[2];
+ float supY = *(float*)&ScriptParams[4];
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[2];
+ }
+ CVector pos;
+ pos.x = (infX + supX) / 2;
+ pos.y = (infY + supY) / 2;
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ float radius = Max(pos.x - infX, pos.y - infY);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos, radius);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_WAIT_IN_CAR:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_IN_CAR);
+ return 0;
case COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_LEAVE_CAR:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_LEAVE_CAR);
+ return 0;
case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
+ return 0;
+ }
+ /*
case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_IN_CAR:
case COMMAND_SET_COLL_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE:
case COMMAND_SET_COLL_OBJ_DESTROY_OBJECT:
+ */
case COMMAND_SET_COLL_OBJ_DESTROY_CAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_DESTROY_CAR, pVehicle);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 5);
+ float infX = *(float*)&ScriptParams[1];
+ float supX = *(float*)&ScriptParams[3];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ float infY = *(float*)&ScriptParams[2];
+ float supY = *(float*)&ScriptParams[4];
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[2];
+ }
+ CVector pos;
+ pos.x = (infX + supX) / 2;
+ pos.y = (infY + supY) / 2;
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ float radius = Max(pos.x - infX, pos.y - infY);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius);
+ return 0;
+ }
+ /*
case COMMAND_SET_COLL_OBJ_GOTO_AREA_IN_CAR:
case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET:
case COMMAND_SET_COLL_OBJ_GUARD_ATTACK:
+ */
case COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE:
+ CollectParameters(&m_nIp, 3);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]);
+ return 0;
case COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT:
- case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2]));
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ON_FOOT, pos);
+ return 0;
+ }
+ //case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR:
case COMMAND_SET_COLL_OBJ_RUN_TO_AREA:
+ {
+ CollectParameters(&m_nIp, 5);
+ float infX = *(float*)&ScriptParams[1];
+ float supX = *(float*)&ScriptParams[3];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ float infY = *(float*)&ScriptParams[2];
+ float supY = *(float*)&ScriptParams[4];
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[2];
+ }
+ CVector pos;
+ pos.x = (infX + supX) / 2;
+ pos.y = (infY + supY) / 2;
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ float radius = Max(pos.x - infX, pos.y - infY);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos, radius);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_RUN_TO_COORD:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2]));
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos);
+ return 0;
+ }
case COMMAND_ADD_PEDS_IN_AREA_TO_COLL:
+ {
+ CollectParameters(&m_nIp, 3);
+ float X = *(float*)&ScriptParams[0];
+ float Y = *(float*)&ScriptParams[1];
+ float Z = CWorld::FindGroundZForCoord(X, Y);
+ float radius = *(float*)&ScriptParams[2];
+ ScriptParams[0] = CTheScripts::AddPedsInAreaToCollective(X, Y, Z, radius);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL:
+ CollectParameters(&m_nIp, 1);
+ ScriptParams[0] = CTheScripts::AddPedsInVehicleToCollective(ScriptParams[0]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
case COMMAND_CLEAR_COLL:
+ CollectParameters(&m_nIp, 1);
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CTheScripts::CollectiveArray[i].colIndex == ScriptParams[0]) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ }
+ }
+ return 0;
case COMMAND_IS_COLL_IN_CARS:
+ {
+ CollectParameters(&m_nIp, 1);
+ bool result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ result = false;
+ break;
+ }
+ }
+ UpdateCompareFlag(result);
+ return 0;
+ }
case COMMAND_LOCATE_COLL_ANY_MEANS_2D:
case COMMAND_LOCATE_COLL_ON_FOOT_2D:
case COMMAND_LOCATE_COLL_IN_CAR_2D:
case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D:
+ LocateCollectiveCommand(command, &m_nIp);
+ return 0;
case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D:
case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D:
+ LocateCollectiveCharCommand(command, &m_nIp);
+ return 0;
case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D:
case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D:
+ LocateCollectiveCarCommand(command, &m_nIp);
+ return 0;
case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D:
case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D:
+ LocateCollectivePlayerCommand(command, &m_nIp);
+ return 0;
case COMMAND_IS_COLL_IN_AREA_2D:
case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D:
case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D:
case COMMAND_IS_COLL_STOPPED_IN_AREA_2D:
case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D:
+ CollectiveInAreaCheckCommand(command, &m_nIp);
+ return 0;
case COMMAND_GET_NUMBER_OF_PEDS_IN_COLL:
- */
+ {
+ CollectParameters(&m_nIp, 1);
+ int total = 0;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ total++;
+ }
+ }
+ ScriptParams[0] = total;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+#endif
case COMMAND_SET_CHAR_HEED_THREATS:
{
CollectParameters(&m_nIp, 2);
@@ -1046,7 +1300,31 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius);
return 0;
}
- //case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS:
+#ifdef GTA_SCRIPT_COLLECTIVE
+ case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS:
+ {
+ CollectParameters(&m_nIp, 5);
+ float infX = *(float*)&ScriptParams[1];
+ float supX = *(float*)&ScriptParams[3];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ float infY = *(float*)&ScriptParams[2];
+ float supY = *(float*)&ScriptParams[4];
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[2];
+ }
+ CVector pos;
+ pos.x = (infX + supX) / 2;
+ pos.y = (infY + supY) / 2;
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ float radius = Max(pos.x - infX, pos.y - infY);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius);
+ return 0;
+ }
+#endif
case COMMAND_IS_PLAYER_STOPPED:
{
CollectParameters(&m_nIp, 1);
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index 3629bb4b..986e82f8 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -244,7 +244,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->SetObjective(OBJECTIVE_CATCH_TRAIN);
return 0;
}
- //case COMMAND_SET_COLL_OBJ_CATCH_TRAIN:
+#ifdef GTA_SCRIPT_COLLECTIVE
+ case COMMAND_SET_COLL_OBJ_CATCH_TRAIN:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_CATCH_TRAIN);
+ return 0;
+#endif
case COMMAND_SET_PLAYER_NEVER_GETS_TIRED:
{
CollectParameters(&m_nIp, 2);
@@ -1090,7 +1095,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
case COMMAND_GIVE_PLAYER_DETONATOR:
CGarages::GivePlayerDetonator();
return 0;
- //case COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR:
+#ifdef GTA_SCRIPT_COLLECTIVE
+ case COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_STEAL_ANY_CAR);
+ return 0;
+#endif
case COMMAND_SET_OBJECT_VELOCITY:
{
CollectParameters(&m_nIp, 4);
@@ -2025,3 +2035,143 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
}
return -1;
}
+
+int32 CTheScripts::GetNewUniqueScriptSphereIndex(int32 index)
+{
+ if (ScriptSphereArray[index].m_Index >= UINT16_MAX - 1)
+ ScriptSphereArray[index].m_Index = 1;
+ else
+ ScriptSphereArray[index].m_Index++;
+ return (uint16)index | ScriptSphereArray[index].m_Index << 16;
+}
+
+int32 CTheScripts::GetActualScriptSphereIndex(int32 index)
+{
+ if (index == -1)
+ return -1;
+ uint16 check = (uint32)index >> 16;
+ uint16 array_idx = index & (0xFFFF);
+ script_assert(array_idx < ARRAY_SIZE(ScriptSphereArray));
+ if (check != ScriptSphereArray[array_idx].m_Index)
+ return -1;
+ return array_idx;
+}
+
+void CTheScripts::DrawScriptSpheres()
+{
+ for (int i = 0; i < MAX_NUM_SCRIPT_SPHERES; i++) {
+ if (ScriptSphereArray[i].m_bInUse)
+ C3dMarkers::PlaceMarkerSet(ScriptSphereArray[i].m_Id, MARKERTYPE_CYLINDER, ScriptSphereArray[i].m_vecCenter, ScriptSphereArray[i].m_fRadius,
+ SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0);
+ }
+}
+
+int32 CTheScripts::AddScriptSphere(int32 id, CVector pos, float radius)
+{
+ int16 i = 0;
+ for (i = 0; i < MAX_NUM_SCRIPT_SPHERES; i++) {
+ if (!ScriptSphereArray[i].m_bInUse)
+ break;
+ }
+#ifdef FIX_BUGS
+ if (i == MAX_NUM_SCRIPT_SPHERES)
+ return -1;
+#endif
+ ScriptSphereArray[i].m_bInUse = true;
+ ScriptSphereArray[i].m_Id = id;
+ ScriptSphereArray[i].m_vecCenter = pos;
+ ScriptSphereArray[i].m_fRadius = radius;
+ return GetNewUniqueScriptSphereIndex(i);
+}
+
+void CTheScripts::RemoveScriptSphere(int32 index)
+{
+ index = GetActualScriptSphereIndex(index);
+ if (index == -1)
+ return;
+ ScriptSphereArray[index].m_bInUse = false;
+ ScriptSphereArray[index].m_Id = 0;
+}
+
+void CTheScripts::AddToBuildingSwapArray(CBuilding* pBuilding, int32 old_model, int32 new_model)
+{
+ int i = 0;
+ bool found = false;
+ while (i < MAX_NUM_BUILDING_SWAPS && !found) {
+ if (BuildingSwapArray[i].m_pBuilding == pBuilding)
+ found = true;
+ else
+ i++;
+ }
+ if (found) {
+ if (BuildingSwapArray[i].m_nOldModel == new_model) {
+ BuildingSwapArray[i].m_pBuilding = nil;
+ BuildingSwapArray[i].m_nOldModel = BuildingSwapArray[i].m_nNewModel = -1;
+ }
+ else {
+ BuildingSwapArray[i].m_nNewModel = new_model;
+ }
+ }
+ else {
+ i = 0;
+ while (i < MAX_NUM_BUILDING_SWAPS && !found) {
+ if (BuildingSwapArray[i].m_pBuilding == nil)
+ found = true;
+ else
+ i++;
+ }
+ if (found) {
+ BuildingSwapArray[i].m_pBuilding = pBuilding;
+ BuildingSwapArray[i].m_nNewModel = new_model;
+ BuildingSwapArray[i].m_nOldModel = old_model;
+ }
+ }
+}
+
+void CTheScripts::AddToInvisibilitySwapArray(CEntity* pEntity, bool remove)
+{
+ int i = 0;
+ bool found = false;
+ while (i < MAX_NUM_INVISIBILITY_SETTINGS && !found) {
+ if (InvisibilitySettingArray[i] == pEntity)
+ found = true;
+ else
+ i++;
+ }
+ if (found) {
+ if (remove)
+ InvisibilitySettingArray[i] = nil;
+ }
+ else if (!remove) {
+ i = 0;
+ while (i < MAX_NUM_INVISIBILITY_SETTINGS && !found) {
+ if (InvisibilitySettingArray[i] == nil)
+ found = true;
+ else
+ i++;
+ }
+ if (found)
+ InvisibilitySettingArray[i] = pEntity;
+ }
+}
+
+void CTheScripts::UndoBuildingSwaps()
+{
+ for (int i = 0; i < MAX_NUM_BUILDING_SWAPS; i++) {
+ if (BuildingSwapArray[i].m_pBuilding) {
+ BuildingSwapArray[i].m_pBuilding->ReplaceWithNewModel(BuildingSwapArray[i].m_nOldModel);
+ BuildingSwapArray[i].m_pBuilding = nil;
+ BuildingSwapArray[i].m_nOldModel = BuildingSwapArray[i].m_nNewModel = -1;
+ }
+ }
+}
+
+void CTheScripts::UndoEntityInvisibilitySettings()
+{
+ for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
+ if (InvisibilitySettingArray[i]) {
+ InvisibilitySettingArray[i]->bIsVisible = true;
+ InvisibilitySettingArray[i] = nil;
+ }
+ }
+}
diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp
index 4826192e..c7e190ac 100644
--- a/src/control/Script5.cpp
+++ b/src/control/Script5.cpp
@@ -17,147 +17,6 @@
#include "World.h"
#include "main.h"
-int32 CTheScripts::GetNewUniqueScriptSphereIndex(int32 index)
-{
- if (ScriptSphereArray[index].m_Index >= UINT16_MAX - 1)
- ScriptSphereArray[index].m_Index = 1;
- else
- ScriptSphereArray[index].m_Index++;
- return (uint16)index | ScriptSphereArray[index].m_Index << 16;
-}
-
-int32 CTheScripts::GetActualScriptSphereIndex(int32 index)
-{
- if (index == -1)
- return -1;
- uint16 check = (uint32)index >> 16;
- uint16 array_idx = index & (0xFFFF);
- script_assert(array_idx < ARRAY_SIZE(ScriptSphereArray));
- if (check != ScriptSphereArray[array_idx].m_Index)
- return -1;
- return array_idx;
-}
-
-void CTheScripts::DrawScriptSpheres()
-{
- for (int i = 0; i < MAX_NUM_SCRIPT_SPHERES; i++) {
- if (ScriptSphereArray[i].m_bInUse)
- C3dMarkers::PlaceMarkerSet(ScriptSphereArray[i].m_Id, MARKERTYPE_CYLINDER, ScriptSphereArray[i].m_vecCenter, ScriptSphereArray[i].m_fRadius,
- SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0);
- }
-}
-
-int32 CTheScripts::AddScriptSphere(int32 id, CVector pos, float radius)
-{
- int16 i = 0;
- for (i = 0; i < MAX_NUM_SCRIPT_SPHERES; i++) {
- if (!ScriptSphereArray[i].m_bInUse)
- break;
- }
-#ifdef FIX_BUGS
- if (i == MAX_NUM_SCRIPT_SPHERES)
- return -1;
-#endif
- ScriptSphereArray[i].m_bInUse = true;
- ScriptSphereArray[i].m_Id = id;
- ScriptSphereArray[i].m_vecCenter = pos;
- ScriptSphereArray[i].m_fRadius = radius;
- return GetNewUniqueScriptSphereIndex(i);
-}
-
-void CTheScripts::RemoveScriptSphere(int32 index)
-{
- index = GetActualScriptSphereIndex(index);
- if (index == -1)
- return;
- ScriptSphereArray[index].m_bInUse = false;
- ScriptSphereArray[index].m_Id = 0;
-}
-
-void CTheScripts::AddToBuildingSwapArray(CBuilding* pBuilding, int32 old_model, int32 new_model)
-{
- int i = 0;
- bool found = false;
- while (i < MAX_NUM_BUILDING_SWAPS && !found) {
- if (BuildingSwapArray[i].m_pBuilding == pBuilding)
- found = true;
- else
- i++;
- }
- if (found) {
- if (BuildingSwapArray[i].m_nOldModel == new_model) {
- BuildingSwapArray[i].m_pBuilding = nil;
- BuildingSwapArray[i].m_nOldModel = BuildingSwapArray[i].m_nNewModel = -1;
- }
- else {
- BuildingSwapArray[i].m_nNewModel = new_model;
- }
- }
- else {
- i = 0;
- while (i < MAX_NUM_BUILDING_SWAPS && !found) {
- if (BuildingSwapArray[i].m_pBuilding == nil)
- found = true;
- else
- i++;
- }
- if (found) {
- BuildingSwapArray[i].m_pBuilding = pBuilding;
- BuildingSwapArray[i].m_nNewModel = new_model;
- BuildingSwapArray[i].m_nOldModel = old_model;
- }
- }
-}
-
-void CTheScripts::AddToInvisibilitySwapArray(CEntity* pEntity, bool remove)
-{
- int i = 0;
- bool found = false;
- while (i < MAX_NUM_INVISIBILITY_SETTINGS && !found) {
- if (InvisibilitySettingArray[i] == pEntity)
- found = true;
- else
- i++;
- }
- if (found) {
- if (remove)
- InvisibilitySettingArray[i] = nil;
- }
- else if (!remove) {
- i = 0;
- while (i < MAX_NUM_INVISIBILITY_SETTINGS && !found) {
- if (InvisibilitySettingArray[i] == nil)
- found = true;
- else
- i++;
- }
- if (found)
- InvisibilitySettingArray[i] = pEntity;
- }
-}
-
-void CTheScripts::UndoBuildingSwaps()
-{
- for (int i = 0; i < MAX_NUM_BUILDING_SWAPS; i++) {
- if (BuildingSwapArray[i].m_pBuilding) {
- BuildingSwapArray[i].m_pBuilding->ReplaceWithNewModel(BuildingSwapArray[i].m_nOldModel);
- BuildingSwapArray[i].m_pBuilding = nil;
- BuildingSwapArray[i].m_nOldModel = BuildingSwapArray[i].m_nNewModel = -1;
- }
- }
-}
-
-void CTheScripts::UndoEntityInvisibilitySettings()
-{
- for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
- if (InvisibilitySettingArray[i]) {
- InvisibilitySettingArray[i]->bIsVisible = true;
- InvisibilitySettingArray[i] = nil;
- }
- }
-}
-
-
void CRunningScript::UpdateCompareFlag(bool flag)
{
if (m_bNotFlag)
@@ -1445,6 +1304,487 @@ int16 CRunningScript::GetPadState(uint16 pad, uint16 button)
return 0;
}
+#ifdef GTA_SCRIPT_COLLECTIVE
+void CRunningScript::LocateCollectiveCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug, decided = false;
+ float X, Y, Z, dX, dY, dZ;
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 8 : 6);
+ X = *(float*)&ScriptParams[1];
+ Y = *(float*)&ScriptParams[2];
+ if (b3D) {
+ Z = *(float*)&ScriptParams[3];
+ dX = *(float*)&ScriptParams[4];
+ dY = *(float*)&ScriptParams[5];
+ dZ = *(float*)&ScriptParams[6];
+ debug = ScriptParams[7];
+ }
+ else {
+ dX = *(float*)&ScriptParams[3];
+ dY = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ switch (command) {
+ case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D:
+ if (!CTheScripts::IsPedStopped(pPed)) {
+ result = false;
+ decided = true;
+ }
+ break;
+ default:
+ break;
+ }
+ if (!decided) {
+ bool in_area;
+ if (b3D) {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y &&
+ Z - dZ <= pos.z &&
+ Z + dZ >= pos.z;
+ }
+ else {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
+ result = true;
+ break;
+ case COMMAND_LOCATE_COLL_ON_FOOT_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_LOCATE_COLL_IN_CAR_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ);
+ else
+ CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
+ }
+}
+
+void CRunningScript::LocateCollectiveCharCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug;
+ float X, Y, Z, dX, dY, dZ;
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 6 : 5);
+ CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ script_assert(pTarget);
+ if (pTarget->bInVehicle) {
+ X = pTarget->m_pMyVehicle->GetPosition().x;
+ Y = pTarget->m_pMyVehicle->GetPosition().y;
+ Z = pTarget->m_pMyVehicle->GetPosition().z;
+ }
+ else {
+ X = pTarget->GetPosition().x;
+ Y = pTarget->GetPosition().y;
+ Z = pTarget->GetPosition().z;
+ }
+ dX = *(float*)&ScriptParams[2];
+ dY = *(float*)&ScriptParams[3];
+ if (b3D) {
+ dZ = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ else {
+ debug = ScriptParams[4];
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ bool in_area;
+ if (b3D) {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y &&
+ Z - dZ <= pos.z &&
+ Z + dZ >= pos.z;
+ }
+ else {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D:
+ result = true;
+ break;
+ case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ);
+ else
+ CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
+ }
+}
+
+void CRunningScript::LocateCollectiveCarCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug;
+ float X, Y, Z, dX, dY, dZ;
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 6 : 5);
+ CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ script_assert(pTarget);
+ X = pTarget->GetPosition().x;
+ Y = pTarget->GetPosition().y;
+ Z = pTarget->GetPosition().z;
+ dX = *(float*)&ScriptParams[2];
+ dY = *(float*)&ScriptParams[3];
+ if (b3D) {
+ dZ = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ else {
+ debug = ScriptParams[4];
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ bool in_area;
+ if (b3D) {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y &&
+ Z - dZ <= pos.z &&
+ Z + dZ >= pos.z;
+ }
+ else {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D:
+ result = true;
+ break;
+ case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ);
+ else
+ CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
+ }
+}
+
+void CRunningScript::LocateCollectivePlayerCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug;
+ float X, Y, Z, dX, dY, dZ;
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 6 : 5);
+ CVector pos = CWorld::Players[ScriptParams[1]].GetPos();
+ X = pos.x;
+ Y = pos.y;
+ Z = pos.z;
+ dX = *(float*)&ScriptParams[2];
+ dY = *(float*)&ScriptParams[3];
+ if (b3D) {
+ dZ = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ else {
+ debug = ScriptParams[4];
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ bool in_area;
+ if (b3D) {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y &&
+ Z - dZ <= pos.z &&
+ Z + dZ >= pos.z;
+ }
+ else {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D:
+ result = true;
+ break;
+ case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ);
+ else
+ CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
+ }
+}
+
+void CRunningScript::CollectiveInAreaCheckCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug, decided = false;
+ float infX, infY, infZ, supX, supY, supZ;
+ switch (command) {
+ case COMMAND_IS_COLL_IN_AREA_2D:
+ case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D:
+ case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 8 : 6);
+ infX = *(float*)&ScriptParams[1];
+ infY = *(float*)&ScriptParams[2];
+ if (b3D) {
+ infZ = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[5];
+ supZ = *(float*)&ScriptParams[6];
+ if (infZ > supZ) {
+ infZ = *(float*)&ScriptParams[6];
+ supZ = *(float*)&ScriptParams[3];
+ }
+ debug = ScriptParams[7];
+ }
+ else {
+ supX = *(float*)&ScriptParams[3];
+ supY = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ if (infX > supX) {
+ float tmp = infX;
+ infX = supX;
+ supX = tmp;
+ }
+ if (infY > supY) {
+ float tmp = infY;
+ infY = supY;
+ supY = tmp;
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ switch (command) {
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D:
+ if (!CTheScripts::IsPedStopped(pPed)) {
+ result = false;
+ decided = true;
+ }
+ break;
+ default:
+ break;
+ }
+ if (!decided) {
+ bool in_area;
+ if (b3D) {
+ in_area = infX <= pos.x &&
+ supX >= pos.x &&
+ infY <= pos.y &&
+ supY >= pos.y &&
+ infZ <= pos.z &&
+ supZ >= pos.z;
+ }
+ else {
+ in_area = infX <= pos.x &&
+ supX >= pos.x &&
+ infY <= pos.y &&
+ supY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_IS_COLL_IN_AREA_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_2D:
+ result = true;
+ break;
+ case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, infX, infY, supX, supY, b3D ? (infZ + supZ) / 2 : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(infX, infY, infZ, supX, supY, supZ);
+ else
+ CTheScripts::DrawDebugSquare(infX, infY, supX, supY);
+ }
+}
+#endif
void CTheScripts::PrintListSizes()
{
@@ -1858,6 +2198,172 @@ void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, fl
CShadows::RenderIndicatorShadow(id, 2, gpGoalTex, &center, supX - center.x, 0.0f, 0.0f, center.y - supY, 0);
}
+#ifdef GTA_SCRIPT_COLLECTIVE
+int CTheScripts::AddPedsInVehicleToCollective(int index)
+{
+ int colIndex = NextFreeCollectiveIndex;
+ AdvanceCollectiveIndex();
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(index);
+ script_assert(pVehicle);
+ CPed* pDriver = pVehicle->pDriver;
+ if (pDriver && !pDriver->IsPlayer() && pDriver->CharCreatedBy != MISSION_CHAR && pDriver->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pDriver);
+ }
+ }
+ for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) {
+ CPed* pPassenger = pVehicle->pPassengers[i];
+ if (pPassenger && !pPassenger->IsPlayer() && pPassenger->CharCreatedBy != MISSION_CHAR && pPassenger->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPassenger);
+ }
+ }
+ }
+ return colIndex;
+}
+
+int CTheScripts::AddPedsInAreaToCollective(float x, float y, float z, float radius)
+{
+ int16 numFound;
+ CEntity* pEntities[64];
+ int colIndex = NextFreeCollectiveIndex;
+ AdvanceCollectiveIndex();
+ CWorld::FindObjectsInRange(CVector(x, y, z), radius, true, &numFound, 64, pEntities, false, true, true, false, false);
+ for (int16 i = 0; i < numFound; i++) {
+ if (pEntities[i]->GetType() == ENTITY_TYPE_PED) {
+ CPed* pPed = (CPed*)pEntities[i];
+ if (pPed && !pPed->IsPlayer() && pPed->CharCreatedBy != MISSION_CHAR && pPed->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPed);
+ }
+ }
+ }
+ else if (pEntities[i]->GetType() == ENTITY_TYPE_VEHICLE) {
+ CVehicle* pVehicle = (CVehicle*)pEntities[i];
+ CPed* pDriver = pVehicle->pDriver;
+ if (pDriver && !pDriver->IsPlayer() && pDriver->CharCreatedBy != MISSION_CHAR && pDriver->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pDriver);
+ }
+ }
+ for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) {
+ CPed* pPassenger = pVehicle->pPassengers[i];
+ if (pPassenger && !pPassenger->IsPlayer() && pPassenger->CharCreatedBy != MISSION_CHAR && pPassenger->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPassenger);
+ }
+ }
+ }
+ }
+ }
+ return colIndex;
+}
+
+int CTheScripts::FindFreeSlotInCollectiveArray()
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex == -1)
+ return i;
+ }
+ return -1;
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective, p1, p2);
+ }
+ }
+ }
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective, p1, p2);
+ }
+ }
+ }
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective, p1);
+ }
+ }
+ }
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective, p1);
+ }
+ }
+ }
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective);
+ }
+ }
+ }
+}
+#endif //GTA_SCRIPT_COLLECTIVE
+
bool CTheScripts::IsPedStopped(CPed* pPed)
{
if (pPed->bInVehicle)
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 65a867be..1d73a272 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -144,9 +144,11 @@ CCam::Process(void)
Process_BehindCar(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
case MODE_FOLLOWPED:
+#ifdef PC_PLAYER_CONTROLS
if(CCamera::m_bUseMouse3rdPerson)
Process_FollowPedWithMouse(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
+#endif
#ifdef FREE_CAM
if(CCamera::bFreeCam)
Process_FollowPed_Rotation(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
@@ -2472,7 +2474,7 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float)
ResetStatics = false;
}
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@@ -2573,7 +2575,7 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
}
#if GTA_VERSION < GTA3_PC_11
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@@ -2611,7 +2613,7 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
HeadPos.x = 0.0f;
HeadPos.y = 0.0f;
HeadPos.z = 0.0f;
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f * Cos(m_fInitialPlayerOrientation);
@@ -2700,7 +2702,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
ResetStatics = false;
}
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@@ -2868,7 +2870,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
Source = HeadPos;
// unused:
- // ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&MidPos, PED_MID);
+ // ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(MidPos, PED_MID);
// Source - MidPos;
// Look around
@@ -2963,7 +2965,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
ResetStatics = false;
}
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@@ -3673,6 +3675,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
if(TheCamera.m_bUseSpecialFovTrain)
FOV = TheCamera.m_fFovForTrain;
+#ifdef PC_PLAYER_CONTROLS
if(CMenuManager::m_ControlMethod == CONTROL_STANDARD && Using3rdPersonMouseCam()){
CPed *player = FindPlayerPed();
if(player && player->CanStrafeOrMouseControl()){
@@ -3683,6 +3686,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
TheCamera.pTargetEntity->GetMatrix().UpdateRW();
}
}
+#endif
}
void
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 4551e36f..1f498102 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -60,7 +60,11 @@ enum
// NB: removed explicit TheCamera from all functions
CCamera TheCamera;
+#ifdef PC_PLAYER_CONTROLS
bool CCamera::m_bUseMouse3rdPerson = true;
+#else
+bool CCamera::m_bUseMouse3rdPerson = false;
+#endif
bool bDidWeProcessAnyCinemaCam;
#ifdef IMPROVED_CAMERA
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index b9d475b8..ac488dc9 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -120,8 +120,10 @@ CFileLoader::LoadLevel(const char *filename)
#ifndef DISABLE_LOADING_SCREEN
LoadSplash(GetRandomSplashScreen());
#endif
+#ifndef GTA_PS2
}else if(strncmp(line, "CDIMAGE", 7) == 0){
CdStreamAddImage(line + 8);
+#endif
}
}
@@ -1065,7 +1067,7 @@ CFileLoader::LoadMLOInstance(int id, const char *line)
&rot.x, &rot.y, &rot.z,
&angle);
float rad = Acos(angle) * 2.0f;
- CInstance *inst = CModelInfo::GetMloInstanceStore().alloc();
+ CInstance *inst = CModelInfo::GetMloInstanceStore().Alloc();
minfo->lastInstance++;
RwMatrix *matrix = RwMatrixCreate();
@@ -1305,7 +1307,7 @@ CFileLoader::Load2dEffect(const char *line)
CTxdStore::SetCurrentTxd(CTxdStore::FindTxdSlot("particle"));
mi = CModelInfo::GetModelInfo(id);
- effect = CModelInfo::Get2dEffectStore().alloc();
+ effect = CModelInfo::Get2dEffectStore().Alloc();
mi->Add2dEffect(effect);
effect->pos = CVector(x, y, z);
effect->col = CRGBA(r, g, b, a);
diff --git a/src/core/FrontEndControls.cpp b/src/core/FrontEndControls.cpp
index 68992e16..18f6b3b2 100644
--- a/src/core/FrontEndControls.cpp
+++ b/src/core/FrontEndControls.cpp
@@ -7,7 +7,7 @@
#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)))
+#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL)))
void
CPlaceableShText::Draw(float x, float y)
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 6806230d..9c33c397 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -3,6 +3,7 @@
#include <dinput.h>
#endif
+#define FORCE_PC_SCALING
#define WITHWINDOWS
#include "common.h"
#ifndef PS2_MENU
@@ -80,6 +81,7 @@ const CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255); // PS2 option color
#ifdef SCROLLABLE_PAGES
#define MAX_VISIBLE_OPTION 12
#define MAX_VISIBLE_OPTION_ON_SCREEN (hasNativeList(m_nCurrScreen) ? MAX_VISIBLE_LIST_ROW : MAX_VISIBLE_OPTION)
+#define SCREEN_HAS_AUTO_SCROLLBAR (m_nTotalListRow > MAX_VISIBLE_OPTION && !hasNativeList(m_nCurrScreen))
int GetOptionCount(int screen)
{
@@ -176,7 +178,6 @@ int8 CMenuManager::m_bFrontEnd_ReloadObrTxtGxt;
int32 CMenuManager::m_PrefsMusicVolume = 102;
int32 CMenuManager::m_PrefsSfxVolume = 102;
-
char CMenuManager::m_PrefsSkinFile[256] = DEFAULT_SKIN_NAME;
int32 CMenuManager::m_KeyPressedCode = -1;
@@ -208,7 +209,6 @@ bool CMenuManager::m_PrefsMarketing = false;
bool CMenuManager::m_PrefsDisableTutorials = false;
#endif // !MASTER
-// 0x5F311C
const char* FrontendFilenames[][2] = {
{"fe2_mainpanel_ul", "" },
{"fe2_mainpanel_ur", "" },
@@ -477,7 +477,7 @@ CMenuManager::ThingsToDoBeforeGoingBack()
}
#ifdef SCROLLABLE_PAGES
- if (m_nTotalListRow > MAX_VISIBLE_OPTION && !hasNativeList(m_nCurrScreen)) {
+ if (SCREEN_HAS_AUTO_SCROLLBAR) {
m_nSelectedListRow = 0;
m_nFirstVisibleRowOnList = 0;
m_nScrollbarTopMargin = 0;
@@ -962,25 +962,25 @@ CMenuManager::DisplayHelperText()
int action = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
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"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(HELPER_TEXT_LEFT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_MIG"));
}
break;
}
case 1:
CFont::SetColor(CRGBA(255, 255, 255, 255));
- CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_APP"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(HELPER_TEXT_LEFT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_APP"));
break;
case 2:
CFont::SetColor(CRGBA(255, 255, 255, alpha));
- CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_HRD"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(HELPER_TEXT_LEFT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_HRD"));
break;
case 3:
CFont::SetColor(CRGBA(255, 255, 255, alpha));
- CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_RSO"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(HELPER_TEXT_LEFT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_RSO"));
break;
case 4:
CFont::SetColor(CRGBA(255, 255, 255, alpha));
- CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_RSC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(HELPER_TEXT_LEFT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_RSC"));
break;
default:
break;
@@ -1023,7 +1023,9 @@ CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostR
void
CMenuManager::DoSettingsBeforeStartingAGame()
{
+#ifdef PC_PLAYER_CONTROLS
CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
+#endif
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
@@ -1045,8 +1047,7 @@ CMenuManager::Draw()
CFont::SetCentreOff();
CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn();
-#if GTA_VERSION >= GTA3_PC_11
-#ifdef DRAW_MENU_VERSION_TEXT
+#if GTA_VERSION >= GTA3_PC_11 && defined(DRAW_MENU_VERSION_TEXT)
CFont::SetColor(CRGBA(LABEL_COLOR.r, LABEL_COLOR.g, LABEL_COLOR.b, FadeIn(255)));
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
@@ -1057,7 +1058,6 @@ CMenuManager::Draw()
AsciiToUnicode(gString, gUString);
CFont::PrintString(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 45, gUString);
#endif
-#endif
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
CFont::SetRightJustifyWrap(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN - 2.0f));
@@ -1131,6 +1131,7 @@ CMenuManager::Draw()
#endif
}
+ // Not a bug, we just want HFoV+ on menu
#ifdef ASPECT_RATIO_SCALE
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
#else
@@ -1297,11 +1298,12 @@ CMenuManager::Draw()
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
+ // Thanks R*, for checking mouse hovering in Draw().
static int lastSelectedOpt = m_nCurrOption;
#endif
#ifdef SCROLLABLE_PAGES
- int firstOption = m_nTotalListRow > MAX_VISIBLE_OPTION && !hasNativeList(m_nCurrScreen) ? m_nFirstVisibleRowOnList : 0;
+ int firstOption = SCREEN_HAS_AUTO_SCROLLBAR ? m_nFirstVisibleRowOnList : 0;
for (int i = firstOption; i < firstOption + MAX_VISIBLE_OPTION && i < NUM_MENUROWS; ++i) {
#else
for (int i = 0; i < NUM_MENUROWS; ++i) {
@@ -1334,38 +1336,6 @@ CMenuManager::Draw()
leftText = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName);
}
-#ifdef CUSTOM_FRONTEND_OPTIONS
- if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action < MENUACTION_NOTHING) { // CFO check
- CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
- if (option.m_Action == MENUACTION_CFO_SELECT) {
- if (option.m_CFOSelect->onlyApplyOnEnter){
- if (m_nCurrOption != i) {
- if (option.m_CFOSelect->displayedValue != option.m_CFOSelect->lastSavedValue)
- SetHelperText(3); // Restored original value
-
-// option.displayedValue = option.lastSavedValue = *option.m_CFO->value;
-
- } else {
- if (option.m_CFOSelect->displayedValue != *option.m_CFO->value)
- SetHelperText(1); // Enter to apply
- else if (m_nHelperTextMsgId == 1)
- ResetHelperText(); // Applied
- }
- }
- }
-
- if (m_nCurrOption != lastSelectedOpt && lastSelectedOpt == i) {
- CMenuScreenCustom::CMenuEntry &oldOption = aScreens[m_nCurrScreen].m_aEntries[lastSelectedOpt];
- if (oldOption.m_Action == MENUACTION_CFO_DYNAMIC)
- if(oldOption.m_CFODynamic->buttonPressFunc)
- oldOption.m_CFODynamic->buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
-
- if (oldOption.m_Action == MENUACTION_CFO_SELECT && oldOption.m_CFOSelect->onlyApplyOnEnter)
- oldOption.m_CFOSelect->displayedValue = oldOption.m_CFOSelect->lastSavedValue = *oldOption.m_CFO->value;
- }
- }
-#endif
-
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_CHANGEMENU: {
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu) {
@@ -1584,7 +1554,25 @@ CMenuManager::Draw()
case MENUACTION_CFO_SELECT:
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
if (option.m_Action == MENUACTION_CFO_SELECT) {
- // To whom manipulate option.m_CFO->value of static options externally (like RestoreDef functions)
+
+ if (option.m_CFOSelect->onlyApplyOnEnter){
+ if (m_nCurrOption != i) {
+ if (option.m_CFOSelect->displayedValue != option.m_CFOSelect->lastSavedValue)
+ SetHelperText(3); // Restored original value
+
+ // If that was previously selected option, restore it to default value.
+ // if (m_nCurrOption != lastSelectedOpt && lastSelectedOpt == i)
+ option.m_CFOSelect->displayedValue = option.m_CFOSelect->lastSavedValue = *option.m_CFO->value;
+
+ } else {
+ if (option.m_CFOSelect->displayedValue != *option.m_CFO->value)
+ SetHelperText(1); // Enter to apply
+ else if (m_nHelperTextMsgId == 1)
+ ResetHelperText(); // Applied
+ }
+ }
+
+ // To whom manipulate option.m_CFO->value of select options externally (like RestoreDef functions)
if (*option.m_CFO->value != option.m_CFOSelect->lastSavedValue)
option.m_CFOSelect->displayedValue = option.m_CFOSelect->lastSavedValue = *option.m_CFO->value;
@@ -1594,6 +1582,11 @@ CMenuManager::Draw()
rightText = TheText.Get(option.m_CFOSelect->rightTexts[option.m_CFOSelect->displayedValue]);
} else if (option.m_Action == MENUACTION_CFO_DYNAMIC) {
+ if (m_nCurrOption != lastSelectedOpt && lastSelectedOpt == i) {
+ if(option.m_CFODynamic->buttonPressFunc)
+ option.m_CFODynamic->buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
+ }
+
if (option.m_CFODynamic->drawFunc) {
rightText = option.m_CFODynamic->drawFunc(&isOptionDisabled, m_nCurrOption == i);
}
@@ -1730,7 +1723,9 @@ CMenuManager::Draw()
if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) {
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH") != 0
// To make assigning built-in actions to new custom options possible.
-#ifndef CUSTOM_FRONTEND_OPTIONS
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ && ScreenHasOption(m_nCurrScreen, "FEA_3DH")
+#else
&& m_nCurrScreen == MENUPAGE_SOUND_SETTINGS
#endif
&& m_nPrefsAudio3DProviderIndex != -1) {
@@ -1807,21 +1802,21 @@ CMenuManager::Draw()
#endif
#ifdef SCROLLABLE_PAGES
- #define SCROLLBAR_BOTTOM_X 125.0f // only for background, scrollbar's itself is calculated
+ #define SCROLLBAR_BOTTOM_Y 125.0f // only for background, scrollbar's itself is calculated
#define SCROLLBAR_RIGHT_X 36.0f
#define SCROLLBAR_WIDTH 9.5f
- #define SCROLLBAR_TOP_X 64
+ #define SCROLLBAR_TOP_Y 64
- if (m_nTotalListRow > MAX_VISIBLE_OPTION && !hasNativeList(m_nCurrScreen)) {
+ if (SCREEN_HAS_AUTO_SCROLLBAR) {
// Scrollbar background
- CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 2), MENU_Y(SCROLLBAR_TOP_X),
- MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 2 - SCROLLBAR_WIDTH), SCREEN_SCALE_FROM_BOTTOM(SCROLLBAR_BOTTOM_X)), CRGBA(100, 100, 66, FadeIn(205)));
+ CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 2), MENU_Y(SCROLLBAR_TOP_Y),
+ MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 2 - SCROLLBAR_WIDTH), SCREEN_SCALE_FROM_BOTTOM(SCROLLBAR_BOTTOM_Y)), CRGBA(100, 100, 66, FadeIn(205)));
float scrollbarHeight = SCROLLBAR_MAX_HEIGHT / (m_nTotalListRow / (float) MAX_VISIBLE_OPTION);
float scrollbarBottom, scrollbarTop;
- scrollbarBottom = MENU_Y(SCROLLBAR_TOP_X - 8 + m_nScrollbarTopMargin + scrollbarHeight);
- scrollbarTop = MENU_Y(SCROLLBAR_TOP_X + m_nScrollbarTopMargin);
+ scrollbarBottom = MENU_Y(SCROLLBAR_TOP_Y - 8 + m_nScrollbarTopMargin + scrollbarHeight);
+ scrollbarTop = MENU_Y(SCROLLBAR_TOP_Y + m_nScrollbarTopMargin);
// Scrollbar shadow
CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 4), scrollbarTop,
MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 1 - SCROLLBAR_WIDTH), scrollbarBottom + MENU_Y(1.0f)),
@@ -2132,7 +2127,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
}
// Print bindings, including seperator (-) between them
- CFont::SetScale(MENU_X(0.25f), MENU_Y(0.6f));
+ CFont::SetScale(MENU_X(0.25f), MENU_Y(SMALLESTTEXT_Y_SCALE));
for (; contSetOrder < MAX_SETORDERS && controllerAction != -1; contSetOrder++) {
wchar *settingText = ControlsManager.GetControllerSettingTextWithOrderNumber((e_ControllerAction)controllerAction, (eContSetOrder)contSetOrder);
if (settingText) {
@@ -3113,7 +3108,7 @@ CMenuManager::DrawPlayerSetupScreen()
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], "(", 1);
if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "}", 1))
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], ")", 1);
- if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "�", 1))
+ if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "£", 1))
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], "$", 1);
}
@@ -3158,9 +3153,7 @@ CMenuManager::DrawPlayerSetupScreen()
CFont::PrintString(MENU_X_LEFT_ALIGNED(PLAYERSETUP_SKIN_COLUMN_LEFT), MENU_Y(PLAYERSETUP_LIST_TOP), TheText.Get("FES_SKN"));
// Skin list
- CFont::SetRightJustifyOff();
- CFont::SetScale(MENU_X(PLAYERSETUP_ROW_TEXT_X_SCALE), MENU_Y(PLAYERSETUP_ROW_TEXT_Y_SCALE));
- CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
+ SET_FONT_FOR_LIST_ITEM
if (m_nSkinsTotal > 0) {
for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin->skinId != m_nFirstVisibleRowOnList;
m_pSelectedSkin = m_pSelectedSkin->nextSkin);
@@ -4073,7 +4066,9 @@ CMenuManager::Process(void)
#ifdef USE_DEBUG_SCRIPT_LOADER
scriptToLoad = 0;
#endif
+#ifdef PC_PLAYER_CONTROLS
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
+#endif
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service();
@@ -5175,7 +5170,7 @@ CMenuManager::ProcessButtonPresses(void)
increase = true;
} else if (
#ifdef SCROLLABLE_PAGES
- !(m_nTotalListRow > MAX_VISIBLE_OPTION && !hasNativeList(m_nCurrScreen)) &&
+ !SCREEN_HAS_AUTO_SCROLLBAR &&
#endif
CPad::GetPad(0)->GetMouseWheelUpJustDown() && m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) {
increase = true;
@@ -5188,7 +5183,7 @@ CMenuManager::ProcessButtonPresses(void)
decrease = true;
} else if (
#ifdef SCROLLABLE_PAGES
- !(m_nTotalListRow > MAX_VISIBLE_OPTION && !hasNativeList(m_nCurrScreen)) &&
+ !SCREEN_HAS_AUTO_SCROLLBAR &&
#endif
CPad::GetPad(0)->GetMouseWheelDownJustDown() && m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) {
decrease = true;
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 9f935510..8cf3dd28 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -25,15 +25,18 @@
#define MENUSLIDER_X 256.0f
#define MENUSLIDER_UNK 256.0f
-#define BIGTEXT_X_SCALE 0.75f
+#define BIGTEXT_X_SCALE 0.75f // For FONT_HEADING
#define BIGTEXT_Y_SCALE 0.9f
-#define MEDIUMTEXT_X_SCALE 0.55f
+#define MEDIUMTEXT_X_SCALE 0.55f // For FONT_HEADING
#define MEDIUMTEXT_Y_SCALE 0.8f
-#define SMALLTEXT_X_SCALE 0.45f
+#define SMALLTEXT_X_SCALE 0.45f // used for FONT_HEADING and FONT_BANK, but looks off for HEADING
#define SMALLTEXT_Y_SCALE 0.7f
-#define SMALLESTTEXT_X_SCALE 0.4f
+#define SMALLESTTEXT_X_SCALE 0.4f // used for both FONT_HEADING and FONT_BANK
#define SMALLESTTEXT_Y_SCALE 0.6f
+#define HELPER_TEXT_LEFT_MARGIN 320.0f
+#define HELPER_TEXT_BOTTOM_MARGIN 120.0f
+
#define PLAYERSETUP_LIST_TOP 28.0f
#define PLAYERSETUP_LIST_BOTTOM 125.0f
#define PLAYERSETUP_LIST_LEFT 200.0f
@@ -45,8 +48,6 @@
#endif
#define PLAYERSETUP_SCROLLBUTTON_HEIGHT 17.0f
#define PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION 64
-#define PLAYERSETUP_ROW_TEXT_X_SCALE 0.4f
-#define PLAYERSETUP_ROW_TEXT_Y_SCALE 0.6f
#define PLAYERSETUP_SKIN_COLUMN_LEFT 220.0f
#define PLAYERSETUP_DATE_COLUMN_RIGHT 56.0f
#define PLAYERSETUP_LIST_BODY_TOP 47
@@ -241,8 +242,6 @@ enum eMenuScreen
#ifdef GRAPHICS_MENU_OPTIONS
MENUPAGE_GRAPHICS_SETTINGS,
-#else
- MENUPAGE_ADVANCED_DISPLAY_SETTINGS,
#endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
MENUPAGE_DETECT_JOYSTICK,
diff --git a/src/core/Frontend_PS2.cpp b/src/core/Frontend_PS2.cpp
index 824f342b..1cb944d1 100644
--- a/src/core/Frontend_PS2.cpp
+++ b/src/core/Frontend_PS2.cpp
@@ -43,7 +43,7 @@ void DoRWStuffEndOfFrame(void);
#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 YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL)))
//#define X(x) ((x)/640.0f*SCRW)
//#define Y(y) ((y)/448.0f*SCRH)
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 33302653..126f0341 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -116,8 +116,6 @@ void DoRWStuffEndOfFrame(void);
#ifdef PS2_MENU
void MessageScreen(char *msg)
{
- //TODO: stretch_screen
-
CRect rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
CRGBA color(255, 255, 255, 255);
@@ -129,20 +127,32 @@ void MessageScreen(char *msg)
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));
-
+#ifdef FIX_BUGS
+ splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_WIDTH-SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192));
+#else
+ splash->DrawRect(CRect(20.0f, 110.0f, SCREEN_WIDTH-20.0f, 300.0f), CRGBA(50, 50, 50, 192));
+#endif
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOff();
- CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190));
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
+#else
+ CFont::SetScale(1.0f, 1.0f);
+#endif
CFont::SetCentreOn();
- CFont::SetCentreSize(SCREEN_SCALE_X(450.0f)); // 450.0f
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 190)); // 450.0f
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetDropColor(CRGBA(32, 32, 32, 255));
CFont::SetDropShadowPosition(3);
+ CFont::SetBackGroundOnlyTextOff();
CFont::SetPropOn();
- CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(130.0f), TheText.Get(msg));
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_WIDTH/2, SCREEN_SCALE_Y(130.0f), TheText.Get(msg));
+#else
+ CFont::PrintString(SCREEN_WIDTH/2, 130.0f, TheText.Get(msg));
+#endif
CFont::DrawFonts();
DoRWStuffEndOfFrame();
@@ -254,9 +264,9 @@ CGame::InitialiseRenderWare(void)
CFont::Initialise();
CHud::Initialise();
POP_MEMID();
-#endif
// TODO: define
CPlayerSkin::Initialise();
+#endif
return (true);
}
@@ -307,8 +317,8 @@ bool CGame::InitialiseOnceAfterRW(void)
CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
CPedStats::Initialise();
CTimeCycle::Initialise();
-#endif
+#ifndef GTA_PS2
if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1;
@@ -346,8 +356,9 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume);
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
+#endif
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
-
+#endif
return true;
}
@@ -360,7 +371,11 @@ CGame::FinalShutdown(void)
CdStreamShutdown();
}
+#if GTA_VERSION <= GTA3_PS2_160
+bool CGame::Initialise(void)
+#else
bool CGame::Initialise(const char* datFile)
+#endif
{
#ifdef GTA_PS2
// TODO: upload VU0 collision code here
@@ -447,28 +462,24 @@ bool CGame::Initialise(const char* datFile)
CCarCtrl::Init();
POP_MEMID();
+ PUSH_MEMID(MEMID_DEF_MODELS);
#if GTA_VERSION > GTA3_PS2_160
InitModelIndices();
#endif
-
- PUSH_MEMID(MEMID_DEF_MODELS);
CModelInfo::Initialise();
-#if GTA_VERSION <= GTA3_PS2_160
- CPedStats::Initialise(); // InitialiseOnceAfterRW
-#else
+
+#if GTA_VERSION > GTA3_PS2_160
// probably moved before LoadLevel for multiplayer maps?
CPickups::Init();
CTheCarGenerators::Init();
-#endif
-#ifndef GTA_PS2 // or GTA_VERSION?
CdStreamAddImage("MODELS\\GTA3.IMG");
-#endif
-#if GTA_VERSION > GTA3_PS2_160
CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
CFileLoader::LoadLevel(datFile);
#else
+ CPedStats::Initialise(); // InitialiseOnceAfterRW
+
CFileLoader::LoadLevel("GTA3.DAT");
#endif
@@ -510,7 +521,9 @@ bool CGame::Initialise(const char* datFile)
CStreaming::LoadInitialPeds();
CStreaming::RequestBigBuildings(LEVEL_GENERIC);
CStreaming::LoadAllRequestedModels(false);
+#if GTA_VERSION > GTA3_PS2_160
printf("Streaming uses %zuK of its memory", CStreaming::ms_memoryUsed / 1024); // original modifier was %d
+#endif
LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen());
PUSH_MEMID(MEMID_ANIMATION);
@@ -608,11 +621,11 @@ bool CGame::Initialise(const char* datFile)
CRecordDataForChase::Init();
CReplay::Init();
+ LoadingScreen("Loading the Game", "Start script", nil);
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
#endif
{
- LoadingScreen("Loading the Game", "Start script", nil);
CTheScripts::StartTestScript();
CTheScripts::Process();
TheCamera.Process();
@@ -889,12 +902,19 @@ void CGame::InitialiseWhenRestarting(void)
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(?);
+ splash->Draw(rect, color, color, color, color);
+#ifdef FIX_BUGS
+ splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192));
+#else
+ splash->DrawRect(CRect(20.0f, 110.0f, SCREEN_WIDTH-20.0f, 300.0f), CRGBA(50, 50, 50, 192));
+#endif
+
CFont::SetBackgroundOff();
- CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f
+#ifdef ASPECT_RATIO_SCALE
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // because SCREEN_SCALE_FROM_RIGHT(x) != SCREEN_SCALE_X(640-x)
+#else
+ CFont::SetWrapx(SCREEN_SCALE_X(480.0f));
+#endif
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_X(480.0f));
@@ -904,9 +924,15 @@ void CGame::InitialiseWhenRestarting(void)
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.
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_WIDTH/2, SCREEN_SCALE_Y(130.0f), TheText.Get("MC_LDFL")); // Load Failed!
+ CFont::PrintString(SCREEN_WIDTH/2, SCREEN_SCALE_Y(170.0f), TheText.Get("FES_NOC")); // No Memory Card (PS2) in MEMORY CARD slot 1.
+ CFont::PrintString(SCREEN_WIDTH/2, SCREEN_SCALE_Y(240.0f), TheText.Get("MC_NWRE")); // Now Restarting Game.
+#else
+ CFont::PrintString(SCREEN_WIDTH/2, 130.0f, TheText.Get("MC_LDFL")); // Load Failed!
+ CFont::PrintString(SCREEN_WIDTH/2, 170.0f, TheText.Get("FES_NOC")); // No Memory Card (PS2) in MEMORY CARD slot 1.
+ CFont::PrintString(SCREEN_WIDTH/2, 240.0f, TheText.Get("MC_NWRE")); // Now Restarting Game.
+#endif
CFont::DrawFonts();
DoRWStuffEndOfFrame();
diff --git a/src/core/Game.h b/src/core/Game.h
index b55793af..002033a0 100644
--- a/src/core/Game.h
+++ b/src/core/Game.h
@@ -30,7 +30,11 @@ public:
static void ShutdownRenderWare(void);
static bool InitialiseOnceAfterRW(void);
static void FinalShutdown(void);
+#if GTA_VERSION <= GTA3_PS2_160
+ static bool Initialise(void);
+#else
static bool Initialise(const char *datFile);
+#endif
static bool ShutDown(void);
static void ReInitGameObjectVariables(void);
static void ReloadIPLs(void);
diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp
index 9eff09e6..7c90ea12 100644
--- a/src/core/MenuScreens.cpp
+++ b/src/core/MenuScreens.cpp
@@ -271,7 +271,9 @@ CMenuScreen aScreens[MENUPAGES] = {
// MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
+#ifdef PC_PLAYER_CONTROLS
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
+#endif
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,
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index ae08f5f5..d9fc5065 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -399,7 +399,12 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
VIDEOMODE_SELECTOR
MULTISAMPLING_SELECTOR
- MENUACTION_CHANGEMENU, "FET_ADV", { nil, SAVESLOT_NONE, MENUPAGE_ADVANCED_DISPLAY_SETTINGS },
+ ISLAND_LOADING_SELECTOR
+ DUALPASS_SELECTOR
+ CUTSCENE_BORDERS_TOGGLE
+ FREE_CAM_TOGGLE
+ POSTFX_SELECTORS
+ PIPELINES_SELECTOR
MENUACTION_RESTOREDEF, "FET_DEF", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
@@ -630,7 +635,9 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
// MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
+#ifdef PC_PLAYER_CONTROLS
MENUACTION_CTRLMETHOD, "FET_CME", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
+#endif
MENUACTION_KEYBOARDCTRLS,"FET_RDK", { nil, SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS },
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
MENUACTION_CHANGEMENU, "FEC_JOD", { nil, SAVESLOT_NONE, MENUPAGE_DETECT_JOYSTICK },
@@ -829,31 +836,12 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
#else
MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#endif
-#ifdef EXTENDED_PIPELINES
PIPELINES_SELECTOR
-#endif
ISLAND_LOADING_SELECTOR
DUALPASS_SELECTOR
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefGraphics) },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
-#else
- // MENUPAGE_ADVANCED_DISPLAY_SETTINGS
- { "FET_ADV", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS,
- new CCustomScreenLayout({MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), nil,
-
- ISLAND_LOADING_SELECTOR
- DUALPASS_SELECTOR
- CUTSCENE_BORDERS_TOGGLE
- FREE_CAM_TOGGLE
-#ifdef EXTENDED_COLOURFILTER
- POSTFX_SELECTORS
-#endif
-#ifdef EXTENDED_PIPELINES
- PIPELINES_SELECTOR
-#endif
- MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
- },
#endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index b971f3ec..7dc9aba0 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -2607,10 +2607,18 @@ void CPad::PrintErrorMessage(void)
{
if ( bDisplayNoControllerMessage && !CGame::playingIntro && !FrontEndMenuManager.m_bMenuActive )
{
+#ifdef FIX_BUGS
+ CFont::SetScale(SCREEN_SCALE_X(0.85f), SCREEN_SCALE_Y(1.0f));
+#else
CFont::SetScale(0.85f, 1.0f);
+#endif
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_SCALE_X(SCREEN_WIDTH - 20));
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 20);
+#endif
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
@@ -2624,10 +2632,18 @@ void CPad::PrintErrorMessage(void)
}
else if ( bObsoleteControllerMessage )
{
+#ifdef FIX_BUGS
+ CFont::SetScale(SCREEN_SCALE_X(0.85f), SCREEN_SCALE_Y(1.0f));
+#else
CFont::SetScale(0.85f, 1.0f);
+#endif
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_SCALE_X(SCREEN_WIDTH - 20));
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 20);
+#endif
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index 5866485d..07424736 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -3,6 +3,7 @@
#include "Automobile.h"
#include "Bridge.h"
#include "Camera.h"
+#include "CarCtrl.h"
#include "Cranes.h"
#include "Darkel.h"
#include "Explosion.h"
@@ -31,83 +32,6 @@
#include "ZoneCull.h"
#include "main.h"
-void
-CPlayerInfo::SetPlayerSkin(char *skin)
-{
- strncpy(m_aSkinName, skin, 32);
- LoadPlayerSkin();
-}
-
-const CVector &
-CPlayerInfo::GetPos()
-{
-#ifdef FIX_BUGS
- if (!m_pPed)
- return TheCamera.GetPosition();
-#endif
- if (m_pPed->InVehicle())
- return m_pPed->m_pMyVehicle->GetPosition();
- return m_pPed->GetPosition();
-}
-
-void
-CPlayerInfo::LoadPlayerSkin()
-{
- DeletePlayerSkin();
-
- m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
- if (!m_pSkinTexture)
- m_pSkinTexture = CPlayerSkin::GetSkinTexture(DEFAULT_SKIN_NAME);
-}
-
-void
-CPlayerInfo::DeletePlayerSkin()
-{
- if (m_pSkinTexture) {
- RwTextureDestroy(m_pSkinTexture);
- m_pSkinTexture = nil;
- }
-}
-
-void
-CPlayerInfo::KillPlayer()
-{
- if (m_WBState != WBSTATE_PLAYING) return;
-
- m_WBState = WBSTATE_WASTED;
- m_nWBTime = CTimer::GetTimeInMilliseconds();
- CDarkel::ResetOnPlayerDeath();
- CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
- CStats::TimesDied++;
-}
-
-void
-CPlayerInfo::ArrestPlayer()
-{
- if (m_WBState != WBSTATE_PLAYING) return;
-
- m_WBState = WBSTATE_BUSTED;
- m_nWBTime = CTimer::GetTimeInMilliseconds();
- CDarkel::ResetOnPlayerDeath();
- CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
- CStats::TimesArrested++;
-}
-
-bool
-CPlayerInfo::IsPlayerInRemoteMode()
-{
- return m_pRemoteVehicle || m_bInRemoteMode;
-}
-
-void
-CPlayerInfo::PlayerFailedCriticalMission()
-{
- if (m_WBState != WBSTATE_PLAYING)
- return;
- m_WBState = WBSTATE_FAILED_CRITICAL_MISSION;
- m_nWBTime = CTimer::GetTimeInMilliseconds();
- CDarkel::ResetOnPlayerDeath();
-}
void
CPlayerInfo::Clear(void)
@@ -147,197 +71,6 @@ CPlayerInfo::Clear(void)
}
void
-CPlayerInfo::BlowUpRCBuggy(void)
-{
- if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
- return;
-
- CRemote::TakeRemoteControlledCarFromPlayer();
- m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
-}
-
-void
-CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
-{
- if (!car || car == m_pPed->m_pMyVehicle) {
- if (m_pPed->EnteringCar())
- m_pPed->QuitEnteringCar();
- }
- if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
- m_pPed->ClearObjective();
-}
-
-void
-CPlayerInfo::MakePlayerSafe(bool toggle)
-{
- if (toggle) {
- CTheScripts::ResetCountdownToMakePlayerUnsafe();
- m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
- CWorld::StopAllLawEnforcersInTheirTracks();
- CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
- CPad::StopPadsShaking();
- m_pPed->bBulletProof = true;
- m_pPed->bFireProof = true;
- m_pPed->bCollisionProof = true;
- m_pPed->bMeleeProof = true;
- m_pPed->bOnlyDamagedByPlayer = true;
- m_pPed->bExplosionProof = true;
- m_pPed->m_bCanBeDamaged = false;
- ((CPlayerPed*)m_pPed)->ClearAdrenaline();
- CancelPlayerEnteringCars(nil);
- gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
- CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
- CProjectileInfo::RemoveAllProjectiles();
- CWorld::SetAllCarsCanBeDamaged(false);
- CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
- CReplay::DisableReplays();
-
- } else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
- m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
- CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
- m_pPed->bBulletProof = false;
- m_pPed->bFireProof = false;
- m_pPed->bCollisionProof = false;
- m_pPed->bMeleeProof = false;
- m_pPed->bOnlyDamagedByPlayer = false;
- m_pPed->bExplosionProof = false;
- m_pPed->m_bCanBeDamaged = true;
- CWorld::SetAllCarsCanBeDamaged(true);
- CReplay::EnableReplays();
- }
-}
-
-bool
-CPlayerInfo::IsRestartingAfterDeath()
-{
- return m_WBState == WBSTATE_WASTED;
-}
-
-bool
-CPlayerInfo::IsRestartingAfterArrest()
-{
- return m_WBState == WBSTATE_BUSTED;
-}
-
-// lastCloseness is passed to other calls of this function
-void
-CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
-{
- // This dist used for determining the angle to face
- CVector2D dist(carToTest->GetPosition() - player->GetPosition());
- float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
- while (neededTurn >= PI) {
- neededTurn -= 2 * PI;
- }
-
- while (neededTurn < -PI) {
- neededTurn += 2 * PI;
- }
-
- // This dist used for evaluating cars' distances, weird...
- // Accounts inverted needed turn (or needed turn in long way) and car dist.
- float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
- if (closeness > *lastCloseness) {
- *lastCloseness = closeness;
- *closestCarOutput = (CVehicle*)carToTest;
- }
-}
-
-// There is something unfinished in here... Sadly all IDBs we have have it unfinished.
-void
-CPlayerInfo::AwardMoneyForExplosion(CVehicle *wreckedCar)
-{
- if (CTimer::GetTimeInMilliseconds() - m_nPreviousTimeRewardedForExplosion < 6000)
- ++m_nExplosionsSinceLastReward;
- else
- m_nExplosionsSinceLastReward = 1;
-
- m_nPreviousTimeRewardedForExplosion = CTimer::GetTimeInMilliseconds();
- int award = wreckedCar->pHandling->nMonetaryValue * 0.002f;
- sprintf(gString, "$%d", award);
-#ifdef MONEY_MESSAGES
- // This line is a leftover from PS2, I don't know what it was meant to be.
- // CVector sth(TheCamera.GetPosition() * 4.0f);
-
- CMoneyMessages::RegisterOne(wreckedCar->GetPosition() + CVector(0.0f, 0.0f, 2.0f), gString, 0, 255, 0, 2.0f, 0.5f);
-#endif
- CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
-
- for (int i = m_nExplosionsSinceLastReward; i > 1; --i) {
- CGeneral::GetRandomNumber();
- CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
- }
-}
-
-void
-CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
-{
- // Interesting
- *size = sizeof(CPlayerInfo);
-
-#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
-#undef CopyToBuf
-}
-
-void
-CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
-{
-#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); buf += sizeof(data);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName)
-#undef CopyFromBuf
-}
-
-void
-CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
-{
- for (CPtrNode* node = carList.first; node; node = node->next) {
- CVehicle *car = (CVehicle*)node->item;
- if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
- if (!car->bUsesCollision || !car->IsVehicle())
- continue;
-
- car->m_scanCode = CWorld::GetCurrentScanCode();
- if (car->GetStatus() != STATUS_WRECKED && car->GetStatus() != STATUS_TRAIN_MOVING
- && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
- CVector carCentre = car->GetBoundCentre();
-
- if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f) {
- float dist = (ped->GetPosition() - carCentre).Magnitude2D();
- if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
- EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
- }
- }
- }
- }
- }
-}
-
-void
CPlayerInfo::Process(void)
{
#ifdef FIX_BUGS
@@ -503,13 +236,13 @@ CPlayerInfo::Process(void)
uint32 timeWithoutRemoteCar = CTimer::GetTimeInMilliseconds() - m_nTimeLostRemoteCar;
if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING) {
TheCamera.SetFadeColour(0, 0, 0);
- TheCamera.Fade(1.0f, 0);
+ TheCamera.Fade(1.0f, FADE_OUT);
}
if (timeWithoutRemoteCar > 2000) {
if (m_WBState == WBSTATE_PLAYING) {
TheCamera.RestoreWithJumpCut();
TheCamera.SetFadeColour(0, 0, 0);
- TheCamera.Fade(1.0f, 1);
+ TheCamera.Fade(1.0f, FADE_IN);
TheCamera.Process();
CTimer::Stop();
CCullZones::ForceCullZoneCoors(TheCamera.GetPosition());
@@ -560,3 +293,370 @@ CPlayerInfo::Process(void)
CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled;
}
}
+
+bool
+CPlayerInfo::IsPlayerInRemoteMode()
+{
+ return m_pRemoteVehicle || m_bInRemoteMode;
+}
+
+void
+CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
+{
+ // Interesting
+ *size = sizeof(CPlayerInfo);
+
+#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
+#undef CopyToBuf
+}
+
+void
+CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
+{
+#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); buf += sizeof(data);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName)
+#undef CopyFromBuf
+}
+
+void
+CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
+{
+ for (CPtrNode* node = carList.first; node; node = node->next) {
+ CVehicle *car = (CVehicle*)node->item;
+ if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
+ if (!car->bUsesCollision || !car->IsVehicle())
+ continue;
+
+ car->m_scanCode = CWorld::GetCurrentScanCode();
+ if (car->GetStatus() != STATUS_WRECKED && car->GetStatus() != STATUS_TRAIN_MOVING
+ && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
+ CVector carCentre = car->GetBoundCentre();
+
+ if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f) {
+ float dist = (ped->GetPosition() - carCentre).Magnitude2D();
+ if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
+ EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
+ }
+ }
+ }
+ }
+ }
+}
+
+// lastCloseness is passed to other calls of this function
+void
+CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
+{
+ // This dist used for determining the angle to face
+ CVector2D dist(carToTest->GetPosition() - player->GetPosition());
+ float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
+ while (neededTurn >= PI) {
+ neededTurn -= 2 * PI;
+ }
+
+ while (neededTurn < -PI) {
+ neededTurn += 2 * PI;
+ }
+
+ // This dist used for evaluating cars' distances, weird...
+ // Accounts inverted needed turn (or needed turn in long way) and car dist.
+ float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
+ if (closeness > *lastCloseness) {
+ *lastCloseness = closeness;
+ *closestCarOutput = (CVehicle*)carToTest;
+ }
+}
+
+const CVector &
+CPlayerInfo::GetPos()
+{
+#ifdef FIX_BUGS
+ if (!m_pPed)
+ return TheCamera.GetPosition();
+#endif
+ if (m_pPed->InVehicle())
+ return m_pPed->m_pMyVehicle->GetPosition();
+ return m_pPed->GetPosition();
+}
+
+CVector
+FindPlayerCoors(void)
+{
+#ifdef FIX_BUGS
+ if (CReplay::IsPlayingBack())
+ return TheCamera.GetPosition();
+#endif
+ CPlayerPed *ped = FindPlayerPed();
+ if(ped->InVehicle())
+ return ped->m_pMyVehicle->GetPosition();
+ else
+ return ped->GetPosition();
+}
+
+const CVector &
+FindPlayerSpeed(void)
+{
+#ifdef FIX_BUGS
+ static CVector vecTmpVector(0.0f, 0.0f, 0.0f);
+ if (CReplay::IsPlayingBack())
+ return vecTmpVector;
+#endif
+ CPlayerPed *ped = FindPlayerPed();
+ if(ped->InVehicle())
+ return ped->m_pMyVehicle->m_vecMoveSpeed;
+ else
+ return ped->m_vecMoveSpeed;
+}
+
+CVehicle *
+FindPlayerVehicle(void)
+{
+ CPlayerPed *ped = FindPlayerPed();
+ if(ped && ped->InVehicle()) return ped->m_pMyVehicle;
+ return nil;
+}
+
+CEntity *
+FindPlayerEntity(void)
+{
+ CPlayerPed *ped = FindPlayerPed();
+ if(ped->InVehicle())
+ return ped->m_pMyVehicle;
+ else
+ return ped;
+}
+
+CVehicle *
+FindPlayerTrain(void)
+{
+ if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain())
+ return FindPlayerVehicle();
+ else
+ return nil;
+}
+
+CPlayerPed *
+FindPlayerPed(void)
+{
+ return CWorld::Players[CWorld::PlayerInFocus].m_pPed;
+}
+
+const CVector &
+FindPlayerCentreOfWorld(int32 player)
+{
+#ifdef FIX_BUGS
+ if(CReplay::IsPlayingBack()) return TheCamera.GetPosition();
+#endif
+ if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
+ if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
+ return CWorld::Players[player].m_pPed->GetPosition();
+}
+
+const CVector &
+FindPlayerCentreOfWorld_NoSniperShift(void)
+{
+#ifdef FIX_BUGS
+ if (CReplay::IsPlayingBack()) return TheCamera.GetPosition();
+#endif
+ if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
+ if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
+ return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
+ return FindPlayerPed()->GetPosition();
+}
+
+float
+FindPlayerHeading(void)
+{
+ if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
+ return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetForward().Heading();
+ return FindPlayerPed()->GetForward().Heading();
+}
+
+bool
+CPlayerInfo::IsRestartingAfterDeath()
+{
+ return m_WBState == WBSTATE_WASTED;
+}
+
+bool
+CPlayerInfo::IsRestartingAfterArrest()
+{
+ return m_WBState == WBSTATE_BUSTED;
+}
+
+void
+CPlayerInfo::KillPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_WASTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
+ CStats::TimesDied++;
+}
+
+void
+CPlayerInfo::ArrestPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_BUSTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
+ CStats::TimesArrested++;
+}
+
+void
+CPlayerInfo::PlayerFailedCriticalMission()
+{
+ if (m_WBState != WBSTATE_PLAYING)
+ return;
+ m_WBState = WBSTATE_FAILED_CRITICAL_MISSION;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+}
+
+void
+CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
+{
+ if (!car || car == m_pPed->m_pMyVehicle) {
+ if (m_pPed->EnteringCar())
+ m_pPed->QuitEnteringCar();
+ }
+ if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
+ m_pPed->ClearObjective();
+}
+
+void
+CPlayerInfo::MakePlayerSafe(bool toggle)
+{
+ if (toggle) {
+ CTheScripts::ResetCountdownToMakePlayerUnsafe();
+ m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
+ CWorld::StopAllLawEnforcersInTheirTracks();
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
+ CPad::StopPadsShaking();
+ m_pPed->bBulletProof = true;
+ m_pPed->bFireProof = true;
+ m_pPed->bCollisionProof = true;
+ m_pPed->bMeleeProof = true;
+ m_pPed->bOnlyDamagedByPlayer = true;
+ m_pPed->bExplosionProof = true;
+ m_pPed->m_bCanBeDamaged = false;
+ ((CPlayerPed*)m_pPed)->ClearAdrenaline();
+ CancelPlayerEnteringCars(nil);
+ gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
+ CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
+ CProjectileInfo::RemoveAllProjectiles();
+ CWorld::SetAllCarsCanBeDamaged(false);
+ CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
+ CReplay::DisableReplays();
+
+ } else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
+ m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
+ m_pPed->bBulletProof = false;
+ m_pPed->bFireProof = false;
+ m_pPed->bCollisionProof = false;
+ m_pPed->bMeleeProof = false;
+ m_pPed->bOnlyDamagedByPlayer = false;
+ m_pPed->bExplosionProof = false;
+ m_pPed->m_bCanBeDamaged = true;
+ CWorld::SetAllCarsCanBeDamaged(true);
+ CReplay::EnableReplays();
+ }
+}
+
+void
+CPlayerInfo::BlowUpRCBuggy(void)
+{
+ if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
+ return;
+
+ CRemote::TakeRemoteControlledCarFromPlayer();
+ m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
+}
+
+// There is something unfinished in here... Sadly all IDBs we have have it unfinished.
+void
+CPlayerInfo::AwardMoneyForExplosion(CVehicle *wreckedCar)
+{
+ if (CTimer::GetTimeInMilliseconds() - m_nPreviousTimeRewardedForExplosion < 6000)
+ ++m_nExplosionsSinceLastReward;
+ else
+ m_nExplosionsSinceLastReward = 1;
+
+ m_nPreviousTimeRewardedForExplosion = CTimer::GetTimeInMilliseconds();
+ int award = wreckedCar->pHandling->nMonetaryValue * 0.002f;
+ sprintf(gString, "$%d", award);
+#ifdef MONEY_MESSAGES
+ // This line is a leftover from PS2, I don't know what it was meant to be.
+ // CVector sth(TheCamera.GetPosition() * 4.0f);
+
+ CMoneyMessages::RegisterOne(wreckedCar->GetPosition() + CVector(0.0f, 0.0f, 2.0f), gString, 0, 255, 0, 2.0f, 0.5f);
+#endif
+ CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
+
+ for (int i = m_nExplosionsSinceLastReward; i > 1; --i) {
+ CGeneral::GetRandomNumber();
+ CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
+ }
+}
+
+#ifdef GTA_PC
+void
+CPlayerInfo::SetPlayerSkin(const char *skin)
+{
+ strncpy(m_aSkinName, skin, 32);
+ LoadPlayerSkin();
+}
+
+void
+CPlayerInfo::LoadPlayerSkin()
+{
+ DeletePlayerSkin();
+
+ m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
+ if (!m_pSkinTexture)
+ m_pSkinTexture = CPlayerSkin::GetSkinTexture(DEFAULT_SKIN_NAME);
+}
+
+void
+CPlayerInfo::DeletePlayerSkin()
+{
+ if (m_pSkinTexture) {
+ RwTextureDestroy(m_pSkinTexture);
+ m_pSkinTexture = nil;
+ }
+}
+#endif \ No newline at end of file
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index 94410753..49424b8b 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -54,14 +54,13 @@ public:
bool m_bFastReload;
bool m_bGetOutOfJailFree;
bool m_bGetOutOfHospitalFree;
+#ifdef GTA_PC
char m_aSkinName[32];
RwTexture *m_pSkinTexture;
+#endif
void MakePlayerSafe(bool);
- void LoadPlayerSkin();
- void DeletePlayerSkin();
void AwardMoneyForExplosion(CVehicle *vehicle);
- void SetPlayerSkin(char* skin);
const CVector &GetPos();
void Process(void);
void KillPlayer(void);
@@ -78,7 +77,21 @@ public:
void SavePlayerInfo(uint8 *buf, uint32* size);
void FindClosestCarSectorList(CPtrList&, CPed*, float, float, float, float, float*, CVehicle**);
- ~CPlayerInfo() { };
+#ifdef GTA_PC
+ void LoadPlayerSkin();
+ void SetPlayerSkin(const char *skin);
+ void DeletePlayerSkin();
+#endif
};
+CPlayerPed *FindPlayerPed(void);
+CVehicle *FindPlayerVehicle(void);
+CVehicle *FindPlayerTrain(void);
+CEntity *FindPlayerEntity(void);
+CVector FindPlayerCoors(void);
+const CVector &FindPlayerSpeed(void);
+const CVector &FindPlayerCentreOfWorld(int32 player);
+const CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
+float FindPlayerHeading(void);
+
VALIDATE_SIZE(CPlayerInfo, 0x13C);
diff --git a/src/core/Radar.h b/src/core/Radar.h
index 793d62b0..5caf5bbb 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -86,7 +86,11 @@ VALIDATE_SIZE(sRadarTrace, 0x30);
// Values for screen space
#define RADAR_LEFT (40.0f)
+#ifdef PS2_HUD
+#define RADAR_BOTTOM (44.0f)
+#else
#define RADAR_BOTTOM (47.0f)
+#endif
#define RADAR_WIDTH (94.0f)
#define RADAR_HEIGHT (76.0f)
diff --git a/src/core/World.cpp b/src/core/World.cpp
index da565f22..b2c1696c 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -1361,102 +1361,6 @@ CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList &list, const CVec
}
}
-CPlayerPed *
-FindPlayerPed(void)
-{
- return CWorld::Players[CWorld::PlayerInFocus].m_pPed;
-}
-
-CVehicle *
-FindPlayerVehicle(void)
-{
- CPlayerPed *ped = FindPlayerPed();
- if(ped && ped->InVehicle()) return ped->m_pMyVehicle;
- return nil;
-}
-
-CVehicle *
-FindPlayerTrain(void)
-{
- if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain())
- return FindPlayerVehicle();
- else
- return nil;
-}
-
-CEntity *
-FindPlayerEntity(void)
-{
- CPlayerPed *ped = FindPlayerPed();
- if(ped->InVehicle())
- return ped->m_pMyVehicle;
- else
- return ped;
-}
-
-CVector
-FindPlayerCoors(void)
-{
-#ifdef FIX_BUGS
- if (CReplay::IsPlayingBack())
- return TheCamera.GetPosition();
-#endif
- CPlayerPed *ped = FindPlayerPed();
- if(ped->InVehicle())
- return ped->m_pMyVehicle->GetPosition();
- else
- return ped->GetPosition();
-}
-
-CVector &
-FindPlayerSpeed(void)
-{
-#ifdef FIX_BUGS
- static CVector vecTmpVector(0.0f, 0.0f, 0.0f);
- if (CReplay::IsPlayingBack())
- return vecTmpVector;
-#endif
- CPlayerPed *ped = FindPlayerPed();
- if(ped->InVehicle())
- return ped->m_pMyVehicle->m_vecMoveSpeed;
- else
- return ped->m_vecMoveSpeed;
-}
-
-const CVector &
-FindPlayerCentreOfWorld(int32 player)
-{
-#ifdef FIX_BUGS
- if(CReplay::IsPlayingBack()) return TheCamera.GetPosition();
-#endif
- if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
- if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
- if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
- return CWorld::Players[player].m_pPed->GetPosition();
-}
-
-const CVector &
-FindPlayerCentreOfWorld_NoSniperShift(void)
-{
-#ifdef FIX_BUGS
- if (CReplay::IsPlayingBack()) return TheCamera.GetPosition();
-#endif
- if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
- if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
- return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
- if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
- return FindPlayerPed()->GetPosition();
-}
-
-float
-FindPlayerHeading(void)
-{
- if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
- return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
- if(FindPlayerVehicle()) return FindPlayerVehicle()->GetForward().Heading();
- return FindPlayerPed()->GetForward().Heading();
-}
-
void
CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2)
{
@@ -1955,12 +1859,11 @@ CWorld::Process(void)
} else {
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CEntity *movingEnt = (CEntity *)node->item;
-#ifdef SQUEEZE_PERFORMANCE
- if (movingEnt->bRemoveFromWorld) {
- RemoveEntityInsteadOfProcessingIt(movingEnt);
- } else
-#endif
+#ifdef FIX_BUGS // from VC
+ if(!movingEnt->bRemoveFromWorld && movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
+#else
if(movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
+#endif
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(),
0.02f * (movingEnt->IsObject()
diff --git a/src/core/World.h b/src/core/World.h
index 197f3cee..9d62e79b 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -157,14 +157,3 @@ public:
extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
-class CPlayerPed;
-class CVehicle;
-CPlayerPed *FindPlayerPed(void);
-CVehicle *FindPlayerVehicle(void);
-CVehicle *FindPlayerTrain(void);
-CEntity *FindPlayerEntity(void);
-CVector FindPlayerCoors(void);
-CVector &FindPlayerSpeed(void);
-const CVector &FindPlayerCentreOfWorld(int32 player);
-const CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
-float FindPlayerHeading(void);
diff --git a/src/core/common.h b/src/core/common.h
index d5775e08..ffae30bf 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -116,17 +116,43 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#include "skeleton.h"
#include "Draw.h"
-#define DEFAULT_SCREEN_WIDTH (640)
-#define DEFAULT_SCREEN_HEIGHT (448)
-#define DEFAULT_SCREEN_HEIGHT_PAL (512)
-#define DEFAULT_SCREEN_HEIGHT_NTSC (448)
+#if defined(USE_PROPER_SCALING)
+ #ifdef FORCE_PC_SCALING
+ #define DEFAULT_SCREEN_WIDTH (640)
+ #define DEFAULT_SCREEN_HEIGHT (448)
+ #else
+ #define DEFAULT_SCREEN_WIDTH (640)
+ #define DEFAULT_SCREEN_HEIGHT (480)
+ #endif
+#elif defined(GTA_PS2)
+ #define DEFAULT_SCREEN_WIDTH (640)
+ #define DEFAULT_SCREEN_HEIGHT (480)
+#else //elif defined(GTA_PC)
+ #define DEFAULT_SCREEN_WIDTH (640)
+ #define DEFAULT_SCREEN_HEIGHT (448)
+#endif
+
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
#define DEFAULT_VIEWWINDOW (0.7f)
// game uses maximumWidth/Height, but this probably won't work
// with RW windowed mode
-#define SCREEN_WIDTH ((float)RsGlobal.width)
+#ifdef GTA_PS2
+ #ifdef GTA_PAL
+ #define SCREEN_WIDTH ((float)640)
+ #define SCREEN_HEIGHT ((float)512)
+ #else
+ #define SCREEN_WIDTH ((float)640)
+ #define SCREEN_HEIGHT ((float)448)
+ #endif
+#else
+#define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height)
+#endif
+
+#define SCREEN_HEIGHT_PAL (512)
+#define SCREEN_HEIGHT_NTSC (448)
+
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
diff --git a/src/core/config.h b/src/core/config.h
index 54d53253..e5a97049 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -196,6 +196,7 @@ enum Config {
# define RANDOMSPLASH // use random splash as on PS2
# define PS2_MATFX
# endif
+# define PC_PLAYER_CONTROLS // mouse player/cam mode
# define GTA_REPLAY
# define GTA_SCENE_EDIT
#elif defined GTA_XBOX
@@ -280,6 +281,7 @@ enum Config {
#define BUTTON_ICONS // use textures to show controller buttons
// Hud, frontend and radar
+//#define PS2_HUD
#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
@@ -300,7 +302,7 @@ enum Config {
# define CUSTOM_FRONTEND_OPTIONS
# ifdef CUSTOM_FRONTEND_OPTIONS
-# define GRAPHICS_MENU_OPTIONS // otherwise Advanced Options menu will appear if Display is full
+# define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable
# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
# define CUTSCENE_BORDERS_SWITCH
# define MULTISAMPLING // adds MSAA option
diff --git a/src/core/main.cpp b/src/core/main.cpp
index cc20047f..3a855e20 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -85,7 +85,7 @@ bool gbModelViewer;
bool gbShowTimebars;
#endif
-int32 frameCount;
+volatile int32 frameCount;
RwRGBA gColourTop;
@@ -415,6 +415,63 @@ PluginAttach(void)
return TRUE;
}
+#ifdef GTA_PS2
+#define NUM_PREALLOC_ATOMICS 3245
+#define NUM_PREALLOC_CLUMPS 101
+#define NUM_PREALLOC_FRAMES 2821
+#define NUM_PREALLOC_GEOMETRIES 1404
+#define NUM_PREALLOC_TEXDICTS 106
+#define NUM_PREALLOC_TEXTURES 1900
+#define NUM_PREALLOC_MATERIALS 3300
+bool preAlloc;
+
+void
+PreAllocateRwObjects(void)
+{
+ int i;
+ void **tmp = new void*[0x8000];
+ preAlloc = true;
+
+ for(i = 0; i < NUM_PREALLOC_ATOMICS; i++)
+ tmp[i] = RpAtomicCreate();
+ for(i = 0; i < NUM_PREALLOC_ATOMICS; i++)
+ RpAtomicDestroy((RpAtomic*)tmp[i]);
+
+ for(i = 0; i < NUM_PREALLOC_CLUMPS; i++)
+ tmp[i] = RpClumpCreate();
+ for(i = 0; i < NUM_PREALLOC_CLUMPS; i++)
+ RpClumpDestroy((RpClump*)tmp[i]);
+
+ for(i = 0; i < NUM_PREALLOC_FRAMES; i++)
+ tmp[i] = RwFrameCreate();
+ for(i = 0; i < NUM_PREALLOC_FRAMES; i++)
+ RwFrameDestroy((RwFrame*)tmp[i]);
+
+ for(i = 0; i < NUM_PREALLOC_GEOMETRIES; i++)
+ tmp[i] = RpGeometryCreate(0, 0, 0);
+ for(i = 0; i < NUM_PREALLOC_GEOMETRIES; i++)
+ RpGeometryDestroy((RpGeometry*)tmp[i]);
+
+ for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
+ tmp[i] = RwTexDictionaryCreate();
+ for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
+ RwTexDictionaryDestroy((RwTexDictionary*)tmp[i]);
+
+ for(i = 0; i < NUM_PREALLOC_TEXTURES; i++)
+ tmp[i] = RwTextureCreate(RwRasterCreate(0, 0, 0, 0));
+ for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
+ RwTextureDestroy((RwTexture*)tmp[i]);
+
+ for(i = 0; i < NUM_PREALLOC_MATERIALS; i++)
+ tmp[i] = RpMaterialCreate();
+ for(i = 0; i < NUM_PREALLOC_MATERIALS; i++)
+ RpMaterialDestroy((RpMaterial*)tmp[i]);
+
+ delete[] tmp;
+ preAlloc = false;
+}
+#endif
+
static RwBool
Initialise3D(void *param)
{
@@ -425,11 +482,11 @@ Initialise3D(void *param)
DebugMenuPopulate();
#endif // !DEBUGMENU
#ifdef CUSTOM_FRONTEND_OPTIONS
- // Apparently this func. can be run multiple times at the start.
- if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
- // needs stored language and TheText to be loaded, and last TheText reload is at the start of here
- CustomFrontendOptionsPopulate();
- }
+ // Apparently this func. can be run multiple times at the start.
+ if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
+ // needs stored language and TheText to be loaded, and last TheText reload is at the start of here
+ CustomFrontendOptionsPopulate();
+ }
#endif
bool ret = CGame::InitialiseRenderWare();
#ifdef EXTENDED_PIPELINES
@@ -577,7 +634,12 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
return;
#endif
- if(DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255)){
+#ifndef GTA_PS2
+ if(DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255))
+#else
+ DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
+#endif
+ {
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -639,8 +701,13 @@ LoadingIslandScreen(const char *levelName)
splash = LoadSplash(nil);
name = TheText.Get(levelName);
+
+#ifndef GTA_PS2
if(!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255))
return;
+#else
+ DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
+#endif
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
@@ -649,23 +716,61 @@ LoadingIslandScreen(const char *levelName)
col = CRGBA(255, 255, 255, 255);
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), col, col, col, col);
CFont::SetBackgroundOff();
+#ifdef FIX_BUGS
+ CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
+#else
CFont::SetScale(1.5f, 1.5f);
+#endif
CFont::SetPropOn();
CFont::SetRightJustifyOn();
+#ifdef FIX_BUGS
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(150.0f));
+#else
+ CFont::SetRightJustifyWrap(150.0f);
+#endif
CFont::SetFontStyle(FONT_HEADING);
sprintf(str, "WELCOME TO");
AsciiToUnicode(str, wstr);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetDropShadowPosition(3);
CFont::SetColor(CRGBA(243, 237, 71, 255));
+#if !defined(PS2_HUD) && defined(GTA_PC)
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_STRETCH_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
+#endif
+
+#ifdef PS2_HUD
+ #ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(140.0f), TheText.Get("WELCOME"));
+ #else
+ CFont::PrintString(SCREEN_WIDTH - 20, SCREEN_HEIGHT - 140, TheText.Get("WELCOME"));
+ #endif
+#else
+ #ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
+ #else
+ CFont::PrintString(SCREEN_WIDTH - 20, SCREEN_SCALE_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
+ #endif
+#endif
TextCopy(wstr, name);
TheText.UpperCase(wstr);
CFont::SetColor(CRGBA(243, 237, 71, 255));
+#if !defined(PS2_HUD) && defined(GTA_PC)
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_STRETCH_FROM_BOTTOM(80.0f), wstr);
+#endif
+
+#ifdef PS2_HUD
+ #ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(110.0f), wstr);
+ #else
+ CFont::PrintString(SCREEN_WIDTH-20, SCREEN_HEIGHT - 110, wstr);
+ #endif
+#else
+ #ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(80.0f), wstr);
+ #else
+ CFont::PrintString(SCREEN_WIDTH-20, SCREEN_SCALE_FROM_BOTTOM(80.0f), wstr);
+ #endif
+#endif
CFont::DrawFonts();
DoRWStuffEndOfFrame();
}
@@ -985,8 +1090,12 @@ DisplayGameDebugText()
CFont::SetJustifyOff();
CFont::SetBackGroundOnlyTextOff();
CFont::SetColor(CRGBA(255, 108, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver);
+#else
+ CFont::PrintString(10.0f, 10.0f, ver);
#endif
+#endif // #ifdef DRAW_GAME_VERSION_TEXT
FrameSamples++;
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
@@ -1037,22 +1146,37 @@ DisplayGameDebugText()
AsciiToUnicode(str, ustr);
- // Let's not scale those numbers, they look better that way :eyes:
CFont::SetPropOff();
CFont::SetBackgroundOff();
+#ifdef FIX_BUGS
+ CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(1.5f));
+#else
CFont::SetScale(0.7f, 1.5f);
+#endif
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
CFont::SetJustifyOff();
CFont::SetBackGroundOnlyTextOff();
+#ifdef FIX_BUGS
CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
+#else
+ CFont::SetWrapx(DEFAULT_SCREEN_WIDTH);
+#endif
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(42.0f, 42.0f, ustr);
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_X(40.0f+2.0f), SCREEN_SCALE_Y(40.0f+2.0f), ustr);
+#else
+ CFont::PrintString(40.0f+2.0f, 40.0f+2.0f, ustr);
+#endif
CFont::SetColor(CRGBA(255, 108, 0, 255));
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_X(40.0f), SCREEN_SCALE_Y(40.0f), ustr);
+#else
CFont::PrintString(40.0f, 40.0f, ustr);
+#endif
}
}
#endif
@@ -1275,8 +1399,8 @@ Idle(void *arg)
if((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu) &&
TheCamera.GetScreenFadeStatus() != FADE_2)
{
+#if defined(GTA_PC) && !defined(RW_GL3) && defined(FIX_BUGS)
// This is from SA, but it's nice for windowed mode
-#if defined(GTA_PC) && !defined(RW_GL3)
if (!FrontEndMenuManager.m_bRenderGameInMenu) {
RwV2d pos;
pos.x = SCREEN_WIDTH / 2.0f;
@@ -1564,7 +1688,7 @@ void TheGame(void)
CTimer::Initialise();
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
CGame::Initialise();
#else
CGame::Initialise("DATA\\GTA3.DAT");
@@ -1634,7 +1758,7 @@ void TheGame(void)
PUSH_MEMID(MEMID_RENDER);
- if (!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu == true && TheCamera.GetScreenFadeStatus() != FADE_2 )
+ if ((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu == true) && TheCamera.GetScreenFadeStatus() != FADE_2 )
{
PUSH_MEMID(MEMID_RENDERLIST);
@@ -1642,14 +1766,22 @@ void TheGame(void)
CRenderer::PreRender();
POP_MEMID();
+#ifdef FIX_BUGS
+ // This has to be done BEFORE RwCameraBeginUpdate
+ RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
+ RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
+#endif
+
if (CWeather::LightningFlash && !CCullZones::CamNoRain())
DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255);
else
DoRWStuffStartOfFrame_Horizon(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(), CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255);
DefinedState();
+#ifndef FIX_BUGS
RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
+#endif
RenderScene();
RenderDebugShit();
@@ -1663,11 +1795,14 @@ void TheGame(void)
}
else
{
- CameraSize(Scene.camera, NULL, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+#ifdef ASPECT_RATIO_SCALE
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+#else
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
+#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
- if (!RsCameraBeginUpdate(Scene.camera))
- break;
+ RsCameraBeginUpdate(Scene.camera);
}
RenderMenus();
@@ -1853,6 +1988,20 @@ void SystemInit()
#endif
}
+int VBlankCounter(int ca)
+{
+ frameCount++;
+ ExitHandler();
+ return 0;
+}
+
+// linked against by RW!
+extern "C" void WaitVBlank(void)
+{
+ int32 startFrame = frameCount;
+ while(startFrame == frameCount);
+}
+
void GameInit()
{
if ( !gameAlreadyInitialised )
@@ -1896,11 +2045,16 @@ void GameInit()
"\\MODELS\\MISC.TXD;1",
"\\MODELS\\GENERIC.TXD;1",
"\\MODELS\\GTA3.DIR;1",
+ // TODO: japanese?
+#ifdef GTA_PAL
"\\TEXT\\ENGLISH.GXT;1",
"\\TEXT\\FRENCH.GXT;1",
"\\TEXT\\GERMAN.GXT;1",
"\\TEXT\\ITALIAN.GXT;1",
"\\TEXT\\SPANISH.GXT;1",
+#else
+ "\\TEXT\\AMERICAN.GXT;1",
+#endif
"\\TXD\\LOADSC0.TXD;1",
"\\TXD\\LOADSC1.TXD;1",
"\\TXD\\LOADSC2.TXD;1",
@@ -2014,6 +2168,36 @@ void GameInit()
}
}
+void PlayIntroMPEGs()
+{
+#ifdef GTA_PS2
+ if (gameAlreadyInitialised)
+ RpSkySuspend();
+
+ InitMPEGPlayer();
+
+#ifdef GTA_PAL
+ PlayMPEG("cdrom0:\\MOVIES\\DMAPAL.PSS;1", false);
+
+ if (CGame::frenchGame || CGame::germanGame)
+ PlayMPEG("cdrom0:\\MOVIES\\INTROPAF.PSS;1", true);
+ else
+ PlayMPEG("cdrom0:\\MOVIES\\INTROPAL.PSS;1", true);
+#else
+ PlayMPEG("cdrom0:\\MOVIES\\DMANTSC.PSS;1", false);
+
+ PlayMPEG("cdrom0:\\MOVIES\\INTRNTSC.PSS;1", true);
+#endif
+
+ ShutdownMPEGPlayer();
+
+ if ( gameAlreadyInitialised )
+ RpSkyResume();
+#else
+ //TODO
+#endif
+}
+
int
main(int argc, char *argv[])
{
@@ -2040,35 +2224,8 @@ main(int argc, char *argv[])
// eh?
}
#endif
-
-#ifdef GTA_PS2
- {
- if (gameAlreadyInitialised)
- RpSkySuspend();
-
- InitMPEGPlayer();
-
-#ifdef GTA_PAL
- PlayMPEG("cdrom0:\\MOVIES\\DMAPAL.PSS;1", false);
-
- if (CGame::frenchGame || CGame::germanGame)
- PlayMPEG("cdrom0:\\MOVIES\\INTROPAF.PSS;1", true);
- else
- PlayMPEG("cdrom0:\\MOVIES\\INTROPAL.PSS;1", true);
-#else
- PlayMPEG("cdrom0:\\MOVIES\\DMANTSC.PSS;1", false);
-
- PlayMPEG("cdrom0:\\MOVIES\\INTRNTSC.PSS;1", true);
-#endif
-
- ShutdownMPEGPlayer();
- if ( gameAlreadyInitialised )
- RpSkyResume();
- }
-#else
- //TODO
-#endif
+ PlayIntroMPEGs();
GameInit();
diff --git a/src/core/main.h b/src/core/main.h
index 77fac46a..149c0878 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -29,6 +29,7 @@ class CSprite2d;
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void);
+void PreAllocateRwObjects(void);
void InitialiseGame(void);
void LoadingScreen(const char *str1, const char *str2, const char *splashscreen);
void LoadingIslandScreen(const char *levelName);
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 5974175a..acb6caa2 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -410,7 +410,7 @@ void CTweakVars::Add(CTweakVar *var)
TweakVarsListSize = 0;
}
if(TweakVarsListSize > 63)
- TweakVarsList = (CTweakVar**) realloc(TweakVarsList, (TweakVarsListSize + 1) * sizeof(var));
+ TweakVarsList = (CTweakVar**) realloc(TweakVarsList, (TweakVarsListSize + 1) * sizeof(*var));
TweakVarsList[TweakVarsListSize++] = var;
// TweakVarsList.push_back(var);
diff --git a/src/core/templates.h b/src/core/templates.h
index 166f865c..3a5b314f 100644
--- a/src/core/templates.h
+++ b/src/core/templates.h
@@ -1,31 +1,31 @@
#pragma once
-template<typename T, int n>
+template<typename T, int32 n>
class CStore
{
public:
- int allocPtr;
+ int32 allocPtr;
T store[n];
- T *alloc(void){
- if(this->allocPtr >= n){
+ T *Alloc(void){
+ if(allocPtr >= n){
printf("Size of this thing:%d needs increasing\n", n);
assert(0);
}
- return &this->store[this->allocPtr++];
+ return &store[allocPtr++];
}
- void clear(void){
- this->allocPtr = 0;
+ void Clear(void){
+ allocPtr = 0;
}
- int getIndex(T *item){
- assert(item >= &this->store[0]);
- assert(item < &this->store[n]);
- return item - this->store;
+ int32 GetIndex(T *item){
+ assert(item >= &store[0]);
+ assert(item < &store[n]);
+ return item - store;
}
- T *getItem(int index){
+ T *GetItem(int32 index){
assert(index >= 0);
assert(index < n);
- return &this->store[index];
+ return &store[index];
}
};
@@ -40,12 +40,11 @@ class CPool
};
uint8 u;
} *m_flags;
- int m_size;
- int m_allocPtr;
+ int32 m_size;
+ int32 m_allocPtr;
public:
- CPool(int size){
- // TODO: use new here
+ CPool(int32 size){
m_entries = (U*)new uint8[sizeof(U)*size];
m_flags = (Flags*)new uint8[sizeof(Flags)*size];
m_size = size;
@@ -69,7 +68,7 @@ public:
m_allocPtr = 0;
}
}
- int GetSize(void) const { return m_size; }
+ int32 GetSize(void) const { return m_size; }
T *New(void){
bool wrapped = false;
do
@@ -93,12 +92,12 @@ public:
m_flags[m_allocPtr].id++;
return (T*)&m_entries[m_allocPtr];
}
- T *New(int handle){
+ T *New(int32 handle){
T *entry = (T*)&m_entries[handle>>8];
SetNotFreeAt(handle);
return entry;
}
- void SetNotFreeAt(int handle){
+ void SetNotFreeAt(int32 handle){
int idx = handle>>8;
m_flags[idx].free = 0;
m_flags[idx].id = handle & 0x7F;
@@ -123,21 +122,21 @@ public:
return m_flags[handle>>8].u == (handle & 0xFF) ?
(T*)&m_entries[handle >> 8] : nil;
}
- int GetIndex(T *entry){
+ int32 GetIndex(T *entry){
int i = GetJustIndex_NoFreeAssert(entry);
return m_flags[i].u + (i<<8);
}
- int GetJustIndex(T *entry){
+ int32 GetJustIndex(T *entry){
int index = GetJustIndex_NoFreeAssert(entry);
assert(!IsFreeSlot(index));
return index;
}
- int GetJustIndex_NoFreeAssert(T* entry){
+ int32 GetJustIndex_NoFreeAssert(T* entry){
int index = ((U*)entry - m_entries);
assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required
return index;
}
- int GetNoOfUsedSpaces(void) const{
+ int32 GetNoOfUsedSpaces(void) const{
int i;
int n = 0;
for(i = 0; i < m_size; i++)
@@ -241,7 +240,7 @@ public:
link->Remove(); // remove from list
freeHead.Insert(link); // insert into free list
}
- int Count(void){
+ int32 Count(void){
int n = 0;
CLink<T> *lnk;
for(lnk = head.next; lnk != &tail; lnk = lnk->next)
diff --git a/src/extras/screendroplets.cpp b/src/extras/screendroplets.cpp
index 2d34cdcb..54866bea 100644
--- a/src/extras/screendroplets.cpp
+++ b/src/extras/screendroplets.cpp
@@ -79,8 +79,10 @@ ScreenDroplets::Initialise(void)
void
ScreenDroplets::InitDraw(void)
{
- if(CustomPipes::neoTxd)
- ms_maskTex = CustomPipes::neoTxd->find("dropmask");
+ if(CustomPipes::neoTxd == nil)
+ return;
+
+ ms_maskTex = CustomPipes::neoTxd->find("dropmask");
ms_screenTex = RwTextureCreate(nil);
RwTextureSetFilterMode(ms_screenTex, rwFILTERLINEAR);
@@ -136,6 +138,10 @@ ScreenDroplets::Shutdown(void)
void
ScreenDroplets::Process(void)
{
+ // no need to do anything if we can't render
+ if(CustomPipes::neoTxd == nil)
+ return;
+
ProcessCameraMovement();
SprayDrops();
ProcessMoving();
@@ -173,6 +179,9 @@ ScreenDroplets::Render(void)
{
ScreenDrop *drop;
+ if(CustomPipes::neoTxd == nil)
+ return;
+
DefinedState();
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(ms_maskTex));
RwRenderStateSet(rwRENDERSTATEFOGENABLE, FALSE);
@@ -384,9 +393,9 @@ ScreenDroplets::ProcessCameraMovement(void)
ms_prevCamUp = camUp;
ms_prevCamPos = camPos;
- ms_screenMoveDelta.x = -RwV3dDotProduct(&camMat->right, (RwV3d*)&ms_camMoveDelta);
- ms_screenMoveDelta.y = RwV3dDotProduct(&camMat->up, (RwV3d*)&ms_camMoveDelta);
- ms_screenMoveDelta.z = RwV3dDotProduct(&camMat->at, (RwV3d*)&ms_camMoveDelta);
+ ms_screenMoveDelta.x = -RwV3dDotProduct(&camMat->right, &ms_camMoveDelta);
+ ms_screenMoveDelta.y = RwV3dDotProduct(&camMat->up, &ms_camMoveDelta);
+ ms_screenMoveDelta.z = RwV3dDotProduct(&camMat->at, &ms_camMoveDelta);
ms_screenMoveDelta *= 10.0f;
ms_screenMoveDist = ms_screenMoveDelta.Magnitude2D();
diff --git a/src/math/Quaternion.h b/src/math/Quaternion.h
index a5a34626..47c94f7c 100644
--- a/src/math/Quaternion.h
+++ b/src/math/Quaternion.h
@@ -12,6 +12,11 @@ public:
float MagnitudeSqr(void) const { return x*x + y*y + z*z + w*w; }
void Normalise(void);
void Multiply(const CQuaternion &q1, const CQuaternion &q2);
+ void Invert(void){ // Conjugate would have been a better name
+ x = -x;
+ y = -y;
+ z = -z;
+ }
const CQuaternion &operator+=(CQuaternion const &right) {
x += right.x;
diff --git a/src/math/Rect.h b/src/math/Rect.h
index fa8d8de4..e9b25896 100644
--- a/src/math/Rect.h
+++ b/src/math/Rect.h
@@ -42,13 +42,30 @@ public:
bottom += y;
top += y;
}
- void Grow(float r){
+
+ void Grow(float r) {
left -= r;
right += r;
top -= r;
bottom += r;
}
+ void Grow(float l, float r)
+ {
+ left -= l;
+ top -= l;
+ right += r;
+ bottom += r;
+ }
+
+ void Grow(float l, float r, float t, float b)
+ {
+ left -= l;
+ top -= t;
+ right += r;
+ bottom += b;
+ }
+
float GetWidth(void) { return right - left; }
float GetHeight(void) { return bottom - top; }
};
diff --git a/src/math/Vector.h b/src/math/Vector.h
index 082b296f..776bfcfe 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -1,23 +1,22 @@
#pragma once
-class CVector
+class CVector : public RwV3d
{
public:
- float x, y, z;
CVector(void) {}
- CVector(float x, float y, float z) : x(x), y(y), z(z) {}
-#ifdef RWCORE_H
- CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {}
-
- operator RwV3d (void) const {
- RwV3d vecRw = { this->x, this->y, this->z };
- return vecRw;
+ CVector(float x, float y, float z)
+ {
+ this->x = x;
+ this->y = y;
+ this->z = z;
}
-
- operator RwV3d *(void) {
- return (RwV3d*)this;
+
+ CVector(const RwV3d &v)
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
}
-#endif
// (0,1,0) means no rotation. So get right vector and its atan
float Heading(void) const { return Atan2(-x, y); }
float Magnitude(void) const { return Sqrt(x*x + y*y + z*z); }
diff --git a/src/math/VuVector.h b/src/math/VuVector.h
index f90818e0..30d62cfc 100644
--- a/src/math/VuVector.h
+++ b/src/math/VuVector.h
@@ -8,18 +8,7 @@ public:
CVuVector(float x, float y, float z) : CVector(x, y, z) {}
CVuVector(float x, float y, float z, float w) : CVector(x, y, z), w(w) {}
CVuVector(const CVector &v) : CVector(v.x, v.y, v.z) {}
-#ifdef RWCORE_H
- CVuVector(const RwV3d &v) : CVector(v.x, v.y, v.z) {}
-
- operator RwV3d (void) const {
- RwV3d vecRw = { this->x, this->y, this->z };
- return vecRw;
- }
-
- operator RwV3d *(void) {
- return (RwV3d*)this;
- }
-#endif
+ CVuVector(const RwV3d &v) : CVector(v) {}
/*
void Normalise(void) {
float sq = MagnitudeSqr();
diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp
index 4ee8e72b..dcde0df3 100644
--- a/src/modelinfo/ModelInfo.cpp
+++ b/src/modelinfo/ModelInfo.cpp
@@ -26,15 +26,15 @@ CModelInfo::Initialise(void)
for(i = 0; i < MODELINFOSIZE; i++)
ms_modelInfoPtrs[i] = nil;
- ms_2dEffectStore.clear();
- ms_mloInstanceStore.clear();
- ms_xtraCompsModelStore.clear();
- ms_simpleModelStore.clear();
- ms_timeModelStore.clear();
- ms_mloModelStore.clear();
- ms_clumpModelStore.clear();
- ms_pedModelStore.clear();
- ms_vehicleModelStore.clear();
+ ms_2dEffectStore.Clear();
+ ms_mloInstanceStore.Clear();
+ ms_xtraCompsModelStore.Clear();
+ ms_simpleModelStore.Clear();
+ ms_timeModelStore.Clear();
+ ms_mloModelStore.Clear();
+ ms_clumpModelStore.Clear();
+ ms_pedModelStore.Clear();
+ ms_vehicleModelStore.Clear();
m = AddSimpleModel(MI_CAR_DOOR);
m->SetColModel(&CTempColModels::ms_colModelDoor1);
@@ -108,22 +108,22 @@ CModelInfo::ShutDown(void)
for(i = 0; i < ms_2dEffectStore.allocPtr; i++)
ms_2dEffectStore.store[i].Shutdown();
- ms_2dEffectStore.clear();
- ms_simpleModelStore.clear();
- ms_mloInstanceStore.clear();
- ms_mloModelStore.clear();
- ms_xtraCompsModelStore.clear();
- ms_timeModelStore.clear();
- ms_pedModelStore.clear();
- ms_clumpModelStore.clear();
- ms_vehicleModelStore.clear();
+ ms_2dEffectStore.Clear();
+ ms_simpleModelStore.Clear();
+ ms_mloInstanceStore.Clear();
+ ms_mloModelStore.Clear();
+ ms_xtraCompsModelStore.Clear();
+ ms_timeModelStore.Clear();
+ ms_pedModelStore.Clear();
+ ms_clumpModelStore.Clear();
+ ms_vehicleModelStore.Clear();
}
CSimpleModelInfo*
CModelInfo::AddSimpleModel(int id)
{
CSimpleModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_simpleModelStore.alloc();
+ modelinfo = CModelInfo::ms_simpleModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->Init();
return modelinfo;
@@ -133,7 +133,7 @@ CMloModelInfo *
CModelInfo::AddMloModel(int id)
{
CMloModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_mloModelStore.alloc();
+ modelinfo = CModelInfo::ms_mloModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->m_clump = nil;
modelinfo->firstInstance = 0;
@@ -145,7 +145,7 @@ CTimeModelInfo*
CModelInfo::AddTimeModel(int id)
{
CTimeModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_timeModelStore.alloc();
+ modelinfo = CModelInfo::ms_timeModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->Init();
return modelinfo;
@@ -155,7 +155,7 @@ CClumpModelInfo*
CModelInfo::AddClumpModel(int id)
{
CClumpModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_clumpModelStore.alloc();
+ modelinfo = CModelInfo::ms_clumpModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->m_clump = nil;
return modelinfo;
@@ -165,7 +165,7 @@ CPedModelInfo*
CModelInfo::AddPedModel(int id)
{
CPedModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_pedModelStore.alloc();
+ modelinfo = CModelInfo::ms_pedModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->m_clump = nil;
return modelinfo;
@@ -175,7 +175,7 @@ CVehicleModelInfo*
CModelInfo::AddVehicleModel(int id)
{
CVehicleModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_vehicleModelStore.alloc();
+ modelinfo = CModelInfo::ms_vehicleModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->m_clump = nil;
modelinfo->m_vehicleType = -1;
@@ -245,7 +245,7 @@ CModelInfo::ConstructMloClumps()
void
CModelInfo::ReInit2dEffects()
{
- ms_2dEffectStore.clear();
+ ms_2dEffectStore.Clear();
for (int i = 0; i < MODELINFOSIZE; i++) {
if (ms_modelInfoPtrs[i])
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index 17754211..cc2a7e34 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -471,7 +471,7 @@ CVehicleModelInfo::PreprocessHierarchy(void)
if(desc[i].flags & VEHICLE_FLAG_POS){
f = assoc.frame;
- rwvec = (RwV3d*)&m_positions[desc[i].hierId];
+ rwvec = &m_positions[desc[i].hierId];
*rwvec = *RwMatrixGetPos(RwFrameGetMatrix(f));
for(f = RwFrameGetParent(f); f; f = RwFrameGetParent(f))
RwV3dTransformPoints(rwvec, rwvec, 1, RwFrameGetMatrix(f));
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index b2888082..e518fae4 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -244,7 +244,7 @@ CCopPed::ArrestPlayer(void)
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f);
CVector suspMidPos;
- suspect->m_pedIK.GetComponentPosition((RwV3d*)suspMidPos, PED_MID);
+ suspect->m_pedIK.GetComponentPosition(suspMidPos, PED_MID);
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(suspMidPos.x, suspMidPos.y,
GetPosition().x, GetPosition().y);
diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp
index 65aa97ef..9f87c12b 100644
--- a/src/peds/EmergencyPed.cpp
+++ b/src/peds/EmergencyPed.cpp
@@ -234,8 +234,8 @@ CEmergencyPed::MedicAI(void)
if (nearestAccident) {
m_pRevivedPed = nearestAccident->m_pVictim;
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
- m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID);
- m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
SetSeek((headPos + midPos) * 0.5f, 1.0f);
SetObjective(OBJECTIVE_NONE);
bIsRunning = true;
@@ -274,8 +274,8 @@ CEmergencyPed::MedicAI(void)
m_nEmergencyPedState = EMERGENCY_PED_STOP;
break;
}
- m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID);
- m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
SetSeek((headPos + midPos) * 0.5f, nearestAccident->m_nMedicsPerformingCPR * 0.5f + 1.0f);
SetObjective(OBJECTIVE_NONE);
bIsRunning = true;
@@ -329,8 +329,8 @@ CEmergencyPed::MedicAI(void)
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f)
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
else {
- m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID);
- m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
midPos = (headPos + midPos) * 0.5f;
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
midPos.x, midPos.y,
@@ -351,8 +351,8 @@ CEmergencyPed::MedicAI(void)
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
break;
}
- m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID);
- m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
midPos = (headPos + midPos) * 0.5f;
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
midPos.x, midPos.y,
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 5e1911ec..b5ab2f21 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -960,7 +960,7 @@ CPed::MoveHeadToLook(void)
}
if (m_pLookTarget->IsPed()) {
- ((CPed*)m_pLookTarget)->m_pedIK.GetComponentPosition((RwV3d*) &lookPos, PED_MID);
+ ((CPed*)m_pLookTarget)->m_pedIK.GetComponentPosition(lookPos, PED_MID);
} else {
lookPos = m_pLookTarget->GetPosition();
}
@@ -2677,6 +2677,48 @@ CPed::ProcessControl(void)
}
}
+#ifdef CANCELLABLE_CAR_ENTER
+ static bool cancelJack = false;
+ if (IsPlayer()) {
+ if (EnteringCar() && m_pVehicleAnim) {
+ CPad *pad = CPad::GetPad(0);
+
+ if (!pad->ArePlayerControlsDisabled()) {
+ int vehAnim = m_pVehicleAnim->animId;
+
+ int16 padWalkX = pad->GetPedWalkLeftRight();
+ int16 padWalkY = pad->GetPedWalkUpDown();
+ if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) {
+ if (vehAnim == ANIM_CAR_OPEN_LHS || vehAnim == ANIM_CAR_OPEN_RHS || vehAnim == ANIM_COACH_OPEN_L || vehAnim == ANIM_COACH_OPEN_R ||
+ vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) {
+
+ if (!m_pMyVehicle->pDriver) {
+ cancelJack = false;
+ bCancelEnteringCar = true;
+ } else
+ cancelJack = true;
+ } else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) {
+ cancelJack = true;
+ } else if (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS) {
+ bCancelEnteringCar = true;
+ cancelJack = false;
+ }
+ }
+ if (cancelJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) {
+ cancelJack = false;
+ QuitEnteringCar();
+ RestorePreviousObjective();
+ }
+ if (cancelJack && (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS)) {
+ cancelJack = false;
+ bCancelEnteringCar = true;
+ }
+ }
+ } else
+ cancelJack = false;
+ }
+#endif
+
switch (m_nPedState) {
case PED_IDLE:
Idle();
@@ -2694,49 +2736,7 @@ CPed::ProcessControl(void)
break;
case PED_ENTER_CAR:
case PED_CARJACK:
- {
-#ifdef CANCELLABLE_CAR_ENTER
- if (!IsPlayer() || !m_pVehicleAnim)
- break;
-
- CPad *pad = CPad::GetPad(0);
-
- if (pad->ArePlayerControlsDisabled())
- break;
-
- int vehAnim = m_pVehicleAnim->animId;
-
- static bool cancelJack = false;
- int16 padWalkX = pad->GetPedWalkLeftRight();
- int16 padWalkY = pad->GetPedWalkUpDown();
- if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) {
- if (vehAnim == ANIM_CAR_OPEN_LHS || vehAnim == ANIM_CAR_OPEN_RHS || vehAnim == ANIM_COACH_OPEN_L || vehAnim == ANIM_COACH_OPEN_R ||
- vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) {
-
- if (!m_pMyVehicle->pDriver) {
- cancelJack = false;
- bCancelEnteringCar = true;
- } else
- cancelJack = true;
- } else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) {
- cancelJack = true;
- } else if (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS) {
- bCancelEnteringCar = true;
- cancelJack = false;
- }
- }
- if (cancelJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) {
- cancelJack = false;
- QuitEnteringCar();
- RestorePreviousObjective();
- }
- if (cancelJack && (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS)) {
- cancelJack = false;
- bCancelEnteringCar = true;
- }
-#endif
break;
- }
case PED_FLEE_POS:
ms_vec2DFleePosition.x = m_fleeFromPosX;
ms_vec2DFleePosition.y = m_fleeFromPosY;
@@ -4246,7 +4246,9 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType);
if (veh->pDriver == ped) {
veh->RemoveDriver();
+#ifndef FIX_BUGS // RemoveDriver does it anyway
veh->SetStatus(STATUS_ABANDONED);
+#endif
if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
veh->m_nDoorLock = CARLOCK_UNLOCKED;
if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle())
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 0e398b25..d27853d6 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -898,13 +898,13 @@ public:
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
int32 idx = RpHAnimIDGetIndex(hier, m_pFrames[node]->nodeID);
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
- RwV3dTransformPoints((RwV3d*)&pos, (RwV3d*)&pos, 1, &mats[idx]);
+ RwV3dTransformPoints(&pos, &pos, 1, &mats[idx]);
}else
#endif
{
RwFrame *frame;
for (frame = m_pFrames[node]->frame; frame; frame = RwFrameGetParent(frame))
- RwV3dTransformPoints((RwV3d*)&pos, (RwV3d*)&pos, 1, RwFrameGetMatrix(frame));
+ RwV3dTransformPoints(&pos, &pos, 1, RwFrameGetMatrix(frame));
}
}
diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp
index d4385385..a747c684 100644
--- a/src/peds/PedAI.cpp
+++ b/src/peds/PedAI.cpp
@@ -1141,7 +1141,7 @@ CPed::ProcessObjective(void)
CVector target;
CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f);
if (m_pedInObjective->IsPed())
- m_pedInObjective->m_pedIK.GetComponentPosition((RwV3d*)&target, PED_MID);
+ m_pedInObjective->m_pedIK.GetComponentPosition(target, PED_MID);
else
target = m_pedInObjective->GetPosition();
diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp
index b4be0954..b57364d8 100644
--- a/src/peds/PedFight.cpp
+++ b/src/peds/PedFight.cpp
@@ -1690,7 +1690,7 @@ CPed::FightStrike(CVector &touchedNodePos)
if (m_fightState == FIGHTSTATE_NO_MOVE)
m_fightState = FIGHTSTATE_1;
- m_vecHitLastPos = *touchedNodePos;
+ m_vecHitLastPos = touchedNodePos;
return false;
}
diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp
index ebd41296..8bace9a0 100644
--- a/src/peds/PedIK.cpp
+++ b/src/peds/PedIK.cpp
@@ -137,28 +137,28 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
}
void
-CPedIK::GetComponentPosition(RwV3d *pos, uint32 node)
+CPedIK::GetComponentPosition(RwV3d &pos, uint32 node)
{
RwFrame *f;
RwMatrix *mat;
#ifdef PED_SKIN
if(IsClumpSkinned(m_ped->GetClump())){
- pos->x = 0.0f;
- pos->y = 0.0f;
- pos->z = 0.0f;
+ pos.x = 0.0f;
+ pos.y = 0.0f;
+ pos.z = 0.0f;
mat = GetComponentMatrix(m_ped, node);
// could just copy the position out of the matrix...
- RwV3dTransformPoints(pos, pos, 1, mat);
+ RwV3dTransformPoints(&pos, &pos, 1, mat);
}else
#endif
{
f = m_ped->m_pFrames[node]->frame;
mat = RwFrameGetMatrix(f);
- *pos = mat->pos;
+ pos = mat->pos;
for (f = RwFrameGetParent(f); f; f = RwFrameGetParent(f))
- RwV3dTransformPoints(pos, pos, 1, RwFrameGetMatrix(f));
+ RwV3dTransformPoints(&pos, &pos, 1, RwFrameGetMatrix(f));
}
}
diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h
index e91d7c06..4eeef6f0 100644
--- a/src/peds/PedIK.h
+++ b/src/peds/PedIK.h
@@ -51,7 +51,7 @@ public:
bool PointGunInDirection(float targetYaw, float targetPitch);
bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
bool PointGunAtPosition(CVector const& position);
- void GetComponentPosition(RwV3d *pos, uint32 node);
+ void GetComponentPosition(RwV3d &pos, uint32 node);
static RwMatrix *GetWorldMatrix(RwFrame *source, RwMatrix *destination);
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 86d8e9f5..330d209b 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -929,6 +929,8 @@ void
CPlayerPed::ProcessAnimGroups(void)
{
AssocGroupId groupToSet;
+
+#ifdef PC_PLAYER_CONTROLS
if ((m_fWalkAngle <= -DEGTORAD(50.0f) || m_fWalkAngle >= DEGTORAD(50.0f))
&& TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam()
&& CanStrafeOrMouseControl()) {
@@ -951,7 +953,9 @@ CPlayerPed::ProcessAnimGroups(void)
else
groupToSet = ASSOCGRP_PLAYERBACK;
}
- } else {
+ } else
+#endif
+ {
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER) {
groupToSet = ASSOCGRP_PLAYERROCKET;
} else {
@@ -1146,7 +1150,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#else
CVector markPos;
if (m_pPointGunAt->IsPed()) {
- ((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition((RwV3d*)markPos, PED_MID);
+ ((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition(markPos, PED_MID);
} else {
markPos = m_pPointGunAt->GetPosition();
}
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index 161418b9..b5af6619 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -133,7 +133,7 @@ CClouds::Render(void)
CSprite::InitSpriteBuffer();
int minute = CClock::GetHours()*60 + CClock::GetMinutes();
- RwV3d campos = *(RwV3d*)&TheCamera.GetPosition();
+ RwV3d campos = TheCamera.GetPosition();
// Moon
int moonfadeout = Abs(minute - 180); // fully visible at 3AM
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index 33c3f4bf..48f0f6b9 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -255,7 +255,7 @@ CCoronas::Render(void)
CVector spriteCoors;
float spritew, spriteh;
- if(!CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){
+ if(!CSprite::CalcScreenCoors(aCoronas[i].coors, &spriteCoors, &spritew, &spriteh, true)){
aCoronas[i].offScreen = true;
aCoronas[i].sightClear = false;
}else{
@@ -464,7 +464,7 @@ CCoronas::RenderReflections(void)
CVector spriteCoors;
float spritew, spriteh;
- if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
+ if(CSprite::CalcScreenCoors(coors, &spriteCoors, &spritew, &spriteh, true)){
float drawDist = 0.75f * aCoronas[i].drawDist;
drawDist = Min(drawDist, 55.0f);
if(spriteCoors.z < drawDist){
@@ -531,7 +531,7 @@ CCoronas::DoSunAndMoon(void)
CVector spriteCoors;
float spritew, spriteh;
- if(CSprite::CalcScreenCoors(sunCoors, spriteCoors, &spritew, &spriteh, true)){
+ if(CSprite::CalcScreenCoors(sunCoors, &spriteCoors, &spritew, &spriteh, true)){
SunScreenX = spriteCoors.x;
SunScreenY = spriteCoors.y;
}else{
diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp
index 2c8a9952..60581793 100644
--- a/src/render/Credits.cpp
+++ b/src/render/Credits.cpp
@@ -39,11 +39,20 @@ CCredits::PrintCreditSpace(float space, uint32 &line)
void
CCredits::PrintCreditText(float scaleX, float scaleY, wchar *text, uint32 &lineoffset, float scrolloffset)
{
+#ifdef FIX_BUGS
float start = DEFAULT_SCREEN_HEIGHT + 50.0f;
+#else
+ float start = SCREEN_HEIGHT + 50.0f;
+#endif
float y = lineoffset + start - scrolloffset;
if(y > -50.0f && y < start){
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(scaleX), SCREEN_SCALE_Y(scaleY));
CFont::PrintString(SCREEN_WIDTH/2.0f, SCREEN_SCALE_Y(y), (uint16*)text);
+#else
+ CFont::SetScale(scaleX, scaleY);
+ CFont::PrintString(SCREEN_WIDTH/2.0f, y, (uint16*)text);
+#endif
}
lineoffset += scaleY*25.0f;
}
@@ -62,7 +71,11 @@ CCredits::Render(void)
scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f;
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
+#ifdef FIX_BUGS
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 20);
+#endif
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(220, 220, 220, 220));
@@ -489,8 +502,14 @@ CCredits::Render(void)
if(TheCamera.m_WideScreenOn)
TheCamera.DrawBordersForWideScreen();
+#ifdef FIX_BUGS
if(lineoffset + DEFAULT_SCREEN_HEIGHT - scrolloffset < -10.0f)
+#else
+ if(lineoffset + SCREEN_HEIGHT - scrolloffset < -10.0f)
+#endif
+ {
bCreditsGoing = false;
+ }
}
bool CCredits::AreCreditsDone(void)
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index 690a1d3f..c76d6109 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -655,7 +655,7 @@ void CScrollBar::Render()
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
CVector coronaCoord, screenCoord;
- float screenW, screenH;
+ float screenW, screenH;
for (int i = 1; i < ARRAY_SIZE(m_MessageBar); ++i)
{
for (int j = 0; j < 5; ++j)
@@ -667,7 +667,7 @@ void CScrollBar::Render()
// Render main coronas
if (m_MessageBar[i] & (1 << j))
{
- if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ if (CSprite::CalcScreenCoors(coronaCoord, &screenCoord, &screenW, &screenH, true))
{
CSprite::RenderBufferedOneXLUSprite(
screenCoord.x, screenCoord.y, screenCoord.z,
@@ -679,7 +679,7 @@ void CScrollBar::Render()
// Render smaller and faded coronas for a trailing effect
else if (m_MessageBar[i - 1] & (1 << j))
{
- if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ if (CSprite::CalcScreenCoors(coronaCoord, &screenCoord, &screenW, &screenH, true))
{
CSprite::RenderBufferedOneXLUSprite(
screenCoord.x, screenCoord.y, screenCoord.z,
@@ -834,7 +834,7 @@ void CDigitalClock::Render()
const char* clockMessage = FindDigitalClockMessage();
CVector coronaCoord, screenCoord;
- float screenW, screenH;
+ float screenW, screenH;
for (int c = 0; c < 5; ++c) // for each char to be displayed
{
for (int i = 0; i < 5; ++i) // for each column of coronas
@@ -847,7 +847,7 @@ void CDigitalClock::Render()
coronaCoord.y = m_Position.y + (8 * c + i) * m_Size.y * m_fScale / 8.0f;
coronaCoord.z = m_Position.z + j * m_fScale / 8.0f;
- if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ if (CSprite::CalcScreenCoors(coronaCoord, &screenCoord, &screenW, &screenH, true))
{
CSprite::RenderBufferedOneXLUSprite(
screenCoord.x, screenCoord.y, screenCoord.z,
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index 42ddd0fb..8c183641 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -47,6 +47,8 @@ int16 CFont::Size[LANGSET_MAX][MAX_FONTS][193] = {
#else
int16 CFont::Size[MAX_FONTS][193] = {
#endif
+
+#if !defined(GTA_PS2) || defined(FIX_BUGS)
{
13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31,
23, 16, 22, 21, 24, 23, 23, 20, 23, 22, 10, 35, 26, 26, 26, 26,
@@ -94,6 +96,56 @@ int16 CFont::Size[MAX_FONTS][193] = {
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19
}
+#else // #if defined(GTA_PS2) && !defined(FIX_BUGS)
+ {
+ 13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31,
+ 23, 16, 22, 21, 24, 23, 23, 20, 23, 22, 10, 35, 26, 26, 26, 26,
+ 30, 26, 24, 23, 24, 22, 21, 24, 26, 10, 20, 26, 22, 29, 26, 25,
+ 24, 25, 24, 24, 22, 25, 24, 29, 29, 23, 25, 37, 22, 37, 35, 37,
+ 35, 21, 22, 21, 21, 22, 13, 22, 21, 10, 16, 22, 11, 32, 21, 21,
+ 23, 22, 16, 20, 14, 21, 20, 30, 25, 21, 21, 33, 33, 33, 33, 35,
+ 27, 27, 27, 27, 32, 24, 23, 23, 23, 23, 11, 11, 11, 11, 26, 26,
+ 26, 26, 26, 26, 26, 25, 26, 21, 21, 21, 21, 32, 23, 22, 22, 22,
+ 22, 11, 11, 11, 11, 22, 22, 22, 22, 22, 22, 22, 22, 26, 21, 24,
+ 12, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 18, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 20
+ },
+
+ {
+ 13, 9, 21, 35, 23, 35, 35, 11, 35, 35, 25, 35, 11, 17, 13, 33,
+ 28, 14, 22, 21, 24, 23, 23, 21, 23, 22, 10, 35, 13, 35, 13, 33,
+ 5, 25, 22, 23, 24, 21, 21, 24, 24, 9, 20, 24, 21, 27, 25, 25,
+ 22, 25, 23, 20, 23, 23, 23, 31, 23, 23, 23, 37, 33, 37, 35, 37,
+ 35, 21, 19, 19, 21, 19, 17, 21, 21, 8, 17, 18, 14, 24, 21, 21,
+ 20, 22, 19, 20, 20, 19, 20, 26, 21, 20, 21, 33, 33, 33, 33, 35,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 16
+ },
+
+ {
+ 15, 14, 16, 25, 19, 26, 22, 11, 18, 18, 27, 26, 13, 19, 9, 27,
+ 19, 18, 19, 19, 21, 19, 20, 18, 19, 20, 12, 32, 15, 32, 15, 35,
+ 15, 19, 19, 19, 19, 19, 16, 19, 20, 9, 19, 20, 14, 29, 19, 19,
+ 19, 19, 19, 19, 21, 19, 20, 32, 20, 19, 19, 33, 31, 39, 37, 39,
+ 37, 21, 21, 21, 23, 21, 19, 23, 23, 10, 19, 20, 16, 26, 23, 23,
+ 20, 20, 20, 22, 21, 22, 22, 26, 22, 22, 23, 35, 35, 35, 35, 37,
+ 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9, 9, 9, 9, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 30, 19, 19, 19, 19, 19,
+ 10, 10, 10, 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 23, 35, 12,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 11, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19
+ }
+#endif
+
#ifdef MORE_LANGUAGES
},
{
@@ -276,13 +328,18 @@ CFont::Initialise(void)
SetScale(1.0f, 1.0f);
SetSlantRefPoint(SCREEN_WIDTH, 0.0f);
SetSlant(0.0f);
- SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0));
+ SetColor(CRGBA(255, 255, 255, 0));
SetJustifyOff();
SetCentreOff();
- SetWrapx(SCREEN_WIDTH);
- SetCentreSize(SCREEN_WIDTH);
+#ifdef FIX_BUGS
+ SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
+ SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
+#else
+ SetWrapx(DEFAULT_SCREEN_WIDTH);
+ SetCentreSize(DEFAULT_SCREEN_WIDTH);
+#endif
SetBackgroundOff();
- SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80));
+ SetBackgroundColor(CRGBA(128, 128, 128, 128));
SetBackGroundOnlyTextOff();
SetPropOn();
SetFontStyle(FONT_BANK);
@@ -430,7 +487,11 @@ void
CFont::PrintChar(float x, float y, wchar c)
{
if(x <= 0.0f || x > SCREEN_WIDTH ||
- y <= 0.0f || y > SCREEN_HEIGHT) // BUG: game uses SCREENW again
+#ifdef FIX_BUGS
+ y <= 0.0f || y > SCREEN_HEIGHT)
+#else
+ y <= 0.0f || y > SCREEN_WIDTH)
+#endif
return;
float w = GetCharacterWidth(c) / 32.0f;
@@ -446,18 +507,35 @@ CFont::PrintChar(float x, float y, wchar c)
if(Details.style == FONT_BANK || Details.style == FONT_HEADING){
if(Details.dropShadowPosition != 0){
- CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
+ CSprite2d::AddSpriteToBank(
+#ifdef FIX_BUGS
+ Details.bank + Details.style,
+#else
+ Details.style, // BUG: game doesn't add bank
+#endif
+#ifdef FIX_BUGS
CRect(x + SCREEN_SCALE_X(Details.dropShadowPosition),
y + SCREEN_SCALE_Y(Details.dropShadowPosition),
x + SCREEN_SCALE_X(Details.dropShadowPosition) + 32.0f * Details.scaleX * 1.0f,
y + SCREEN_SCALE_Y(Details.dropShadowPosition) + 40.0f * Details.scaleY * 0.5f),
+#else
+ CRect(x + Details.dropShadowPosition,
+ y + Details.dropShadowPosition,
+ x + Details.dropShadowPosition + 32.0f * Details.scaleX * 1.0f,
+ y + Details.dropShadowPosition + 40.0f * Details.scaleY * 0.5f),
+#endif
Details.dropColor,
xoff/16.0f, yoff/12.8f,
(xoff+1.0f)/16.0f - 0.001f, yoff/12.8f,
xoff/16.0f, (yoff+1.0f)/12.8f,
(xoff+1.0f)/16.0f - 0.001f, (yoff+1.0f)/12.8f - 0.0001f);
}
- CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
+ CSprite2d::AddSpriteToBank(
+#ifdef FIX_BUGS
+ Details.bank + Details.style,
+#else
+ Details.style, // BUG: game doesn't add bank
+#endif
CRect(x, y,
x + 32.0f * Details.scaleX * 1.0f,
y + 40.0f * Details.scaleY * 0.5f),
@@ -469,11 +547,23 @@ CFont::PrintChar(float x, float y, wchar c)
#ifdef MORE_LANGUAGES
}else if (IsJapaneseFont()) {
if (Details.dropShadowPosition != 0) {
- CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
+ CSprite2d::AddSpriteToBank(
+#ifdef FIX_BUGS
+ Details.bank + Details.style,
+#else
+ Details.style, // BUG: game doesn't add bank
+#endif
+#ifdef FIX_BUGS
CRect(x + SCREEN_SCALE_X(Details.dropShadowPosition),
y + SCREEN_SCALE_Y(Details.dropShadowPosition),
x + SCREEN_SCALE_X(Details.dropShadowPosition) + 32.0f * Details.scaleX * 1.0f,
y + SCREEN_SCALE_Y(Details.dropShadowPosition) + 40.0f * Details.scaleY / 2.75f),
+#else
+ CRect(x + Details.dropShadowPosition,
+ y + Details.dropShadowPosition,
+ x + Details.dropShadowPosition + 32.0f * Details.scaleX * 1.0f,
+ y + Details.dropShadowPosition + 40.0f * Details.scaleY / 2.75f),
+#endif
Details.dropColor,
xoff * w / 1024.0f, yoff / 25.6f,
xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, yoff / 25.6f,
@@ -491,7 +581,13 @@ CFont::PrintChar(float x, float y, wchar c)
xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, (yoff + 1.0f) / 25.6f - 0.0001f);
#endif
}else
- CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
+ {
+ CSprite2d::AddSpriteToBank(
+#ifdef FIX_BUGS
+ Details.bank + Details.style,
+#else
+ Details.style, // BUG: game doesn't add bank
+#endif
CRect(x, y,
x + 32.0f * Details.scaleX * w,
y + 32.0f * Details.scaleY * 0.5f),
@@ -500,6 +596,7 @@ CFont::PrintChar(float x, float y, wchar c)
(xoff+w)/16.0f, yoff/16.0f,
xoff/16.0f, (yoff+1.0f)/16.0f,
(xoff+w)/16.0f - 0.0001f, (yoff+1.0f)/16.0f - 0.0001f);
+ }
}
#ifdef MORE_LANGUAGES
@@ -782,7 +879,12 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
numLines = GetNumberLines(xstart, ystart, s);
}else{
#endif
+
+#ifdef FIX_BUGS
if(Details.centre || Details.rightJustify)
+#else
+ if(Details.centre)
+#endif
x = 0.0f;
else
x = xstart;
@@ -800,7 +902,11 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
// reached end of line
if(x > maxlength)
maxlength = x;
+#ifdef FIX_BUGS
if(Details.centre || Details.rightJustify)
+#else
+ if(Details.centre)
+#endif
x = 0.0f;
else
x = xstart;
@@ -1280,14 +1386,14 @@ CFont::ParseToken(wchar *s, wchar*)
case 'n':
NewLine = 1;
break;
- case 'b': SetColor(CRGBA(0x80, 0xA7, 0xF3, 0xFF)); break;
- case 'g': SetColor(CRGBA(0x5F, 0xA0, 0x6A, 0xFF)); break;
- case 'h': SetColor(CRGBA(0xE1, 0xE1, 0xE1, 0xFF)); break;
- case 'l': SetColor(CRGBA(0x00, 0x00, 0x00, 0xFF)); break;
- case 'p': SetColor(CRGBA(0xA8, 0x6E, 0xFC, 0xFF)); break;
- case 'r': SetColor(CRGBA(0x71, 0x2B, 0x49, 0xFF)); break;
- case 'w': SetColor(CRGBA(0xAF, 0xAF, 0xAF, 0xFF)); break;
- case 'y': SetColor(CRGBA(0xD2, 0xC4, 0x6A, 0xFF)); break;
+ case 'b': SetColor(CRGBA(128, 167, 243, 255)); break;
+ case 'g': SetColor(CRGBA(95, 160, 106, 255)); break;
+ case 'h': SetColor(CRGBA(225, 225, 225, 255)); break;
+ case 'l': SetColor(CRGBA(0, 0, 0, 255)); break;
+ case 'p': SetColor(CRGBA(168, 110, 252, 255)); break;
+ case 'r': SetColor(CRGBA(113, 43, 73, 255)); break;
+ case 'w': SetColor(CRGBA(175, 175, 175, 255)); break;
+ case 'y': SetColor(CRGBA(210, 196, 106, 255)); break;
#ifdef BUTTON_ICONS
#if 0 // unused
case 'U': PS2Symbol = BUTTON_UP; break;
diff --git a/src/render/Font.h b/src/render/Font.h
index 7b67e310..bd7e98bb 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -173,23 +173,6 @@ public:
static void SetCentreOff(void) {
Details.centre = false;
}
- static void SetAlignment(uint8 alignment) {
- if (alignment == ALIGN_LEFT) {
- CFont::Details.justify = true;
- CFont::Details.centre = false;
- CFont::Details.rightJustify = false;
- }
- else if (alignment == ALIGN_CENTER) {
- CFont::Details.justify = false;
- CFont::Details.centre = true;
- CFont::Details.rightJustify = false;
- }
- else if (alignment == ALIGN_RIGHT) {
- CFont::Details.justify = false;
- CFont::Details.centre = false;
- CFont::Details.rightJustify = true;
- }
- }
static void SetWrapx(float x) { Details.wrapX = x; }
static void SetCentreSize(float s) { Details.centreSize = s; }
static void SetBackgroundOn(void) { Details.background = true; }
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 1a39e1c7..dcc703e9 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -41,52 +41,56 @@ CRGBA ODDJOB_COLOR(89, 115, 150, 255);
CRGBA ODDJOB2_COLOR(156, 91, 40, 255);
CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255);
-wchar CHud::m_HelpMessage[HELP_MSG_LENGTH];
-wchar CHud::m_LastHelpMessage[HELP_MSG_LENGTH];
-uint32 CHud::m_HelpMessageState;
-uint32 CHud::m_HelpMessageTimer;
-int32 CHud::m_HelpMessageFadeTimer;
-wchar CHud::m_HelpMessageToPrint[HELP_MSG_LENGTH];
-float CHud::m_HelpMessageDisplayTime;
-bool CHud::m_HelpMessageQuick;
-uint32 CHud::m_ZoneState;
-int32 CHud::m_ZoneFadeTimer;
-uint32 CHud::m_ZoneNameTimer;
+
+int16 CHud::m_ItemToFlash;
+CSprite2d CHud::Sprites[NUM_HUD_SPRITES];
wchar *CHud::m_pZoneName;
wchar *CHud::m_pLastZoneName;
wchar *CHud::m_ZoneToPrint;
-uint32 CHud::m_VehicleState;
-int32 CHud::m_VehicleFadeTimer;
-uint32 CHud::m_VehicleNameTimer;
-wchar *CHud::m_VehicleName;
-wchar *CHud::m_pLastVehicleName;
-wchar *CHud::m_pVehicleNameToPrint;
wchar CHud::m_Message[256];
+wchar CHud::m_BigMessage[6][128];
+wchar LastBigMessage[6][128];
wchar CHud::m_PagerMessage[256];
+uint32 CHud::m_ZoneNameTimer;
+int32 CHud::m_ZoneFadeTimer;
+uint32 CHud::m_ZoneState;
+wchar CHud::m_HelpMessage[HELP_MSG_LENGTH];
+wchar CHud::m_LastHelpMessage[HELP_MSG_LENGTH];
+wchar CHud::m_HelpMessageToPrint[HELP_MSG_LENGTH];
+uint32 CHud::m_HelpMessageTimer;
+int32 CHud::m_HelpMessageFadeTimer;
+uint32 CHud::m_HelpMessageState;
+bool CHud::m_HelpMessageQuick;
+float CHud::m_HelpMessageDisplayTime;
+int32 CHud::SpriteBrightness;
bool CHud::m_Wants_To_Draw_Hud;
bool CHud::m_Wants_To_Draw_3dMarkers;
-wchar CHud::m_BigMessage[6][128];
-int16 CHud::m_ItemToFlash;
+wchar *CHud::m_pVehicleName;
+wchar *CHud::m_pLastVehicleName;
+uint32 CHud::m_VehicleNameTimer;
+int32 CHud::m_VehicleFadeTimer;
+uint32 CHud::m_VehicleState;
+wchar *CHud::m_pVehicleNameToPrint;
// These aren't really in CHud
-float CHud::BigMessageInUse[6];
-float CHud::BigMessageAlpha[6];
-float CHud::BigMessageX[6];
-float CHud::OddJob2OffTimer;
-bool CHud::CounterOnLastFrame;
-float CHud::OddJob2XOffset;
-uint16 CHud::CounterFlashTimer;
-uint16 CHud::OddJob2Timer;
-bool CHud::TimerOnLastFrame;
-int16 CHud::OddJob2On;
-uint16 CHud::TimerFlashTimer;
-int16 CHud::PagerSoundPlayed;
-int32 CHud::SpriteBrightness;
-float CHud::PagerXOffset;
-int16 CHud::PagerTimer;
-int16 CHud::PagerOn;
+float BigMessageInUse[6];
+float BigMessageX[6];
+float BigMessageAlpha[6];
+int16 PagerOn;
+int16 PagerTimer;
+float PagerXOffset;
+int16 PagerSoundPlayed;
+int16 OddJob2On;
+uint16 OddJob2Timer;
+float OddJob2XOffset;
+float OddJob2OffTimer;
+bool CounterOnLastFrame;
+uint16 CounterFlashTimer;
+bool TimerOnLastFrame;
+uint16 TimerFlashTimer;
-CSprite2d CHud::Sprites[NUM_HUD_SPRITES];
+RwTexture *gpSniperSightTex;
+RwTexture *gpRocketSightTex;
struct
{
@@ -118,8 +122,144 @@ struct
{"siterocket", "siterocket"}
};
-RwTexture *gpSniperSightTex;
-RwTexture *gpRocketSightTex;
+void CHud::Initialise()
+{
+ m_Wants_To_Draw_Hud = true;
+ m_Wants_To_Draw_3dMarkers = true;
+
+ int HudTXD = CTxdStore::AddTxdSlot("hud");
+ CTxdStore::LoadTxd(HudTXD, "MODELS/HUD.TXD");
+ CTxdStore::AddRef(HudTXD);
+ CTxdStore::PopCurrentTxd();
+ CTxdStore::SetCurrentTxd(HudTXD);
+
+ for (int i = 0; i < NUM_HUD_SPRITES; i++) {
+ Sprites[i].SetTexture(WeaponFilenames[i].name, WeaponFilenames[i].mask);
+ }
+
+ GetRidOfAllHudMessages();
+
+ if (gpSniperSightTex == nil)
+ gpSniperSightTex = RwTextureRead("sitesniper", nil);
+ if (gpRocketSightTex == nil)
+ gpRocketSightTex = RwTextureRead("siterocket", nil);
+
+ CounterOnLastFrame = false;
+ m_ItemToFlash = ITEM_NONE;
+ OddJob2Timer = 0;
+ OddJob2OffTimer = 0.0f;
+ OddJob2On = 0;
+ OddJob2XOffset = 0.0f;
+ CounterFlashTimer = 0;
+ TimerOnLastFrame = false;
+ TimerFlashTimer = 0;
+ SpriteBrightness = 0;
+ PagerOn = 0;
+ PagerTimer = 0;
+ PagerSoundPlayed = 0;
+ PagerXOffset = 150.0f;
+
+ CTxdStore::PopCurrentTxd();
+}
+
+void CHud::Shutdown()
+{
+ for (int i = 0; i < NUM_HUD_SPRITES; ++i) {
+ Sprites[i].Delete();
+ }
+
+ RwTextureDestroy(gpSniperSightTex);
+ gpSniperSightTex = nil;
+
+ RwTextureDestroy(gpRocketSightTex);
+ gpRocketSightTex = nil;
+
+ int HudTXD = CTxdStore::FindTxdSlot("hud");
+ CTxdStore::RemoveTxdSlot(HudTXD);
+}
+
+void CHud::ReInitialise() {
+ m_Wants_To_Draw_Hud = true;
+ m_Wants_To_Draw_3dMarkers = true;
+
+ GetRidOfAllHudMessages();
+
+ CounterOnLastFrame = false;
+ m_ItemToFlash = ITEM_NONE;
+ OddJob2Timer = 0;
+ OddJob2OffTimer = 0.0f;
+ OddJob2On = 0;
+ OddJob2XOffset = 0.0f;
+ CounterFlashTimer = 0;
+ TimerOnLastFrame = false;
+ TimerFlashTimer = 0;
+ SpriteBrightness = 0;
+ PagerOn = 0;
+ PagerTimer = 0;
+ PagerSoundPlayed = 0;
+ PagerXOffset = 150.0f;
+}
+
+void CHud::GetRidOfAllHudMessages()
+{
+ m_ZoneState = 0;
+ m_pLastZoneName = nil;
+ m_ZoneNameTimer = 0;
+ m_pZoneName = nil;
+
+ for (int i = 0; i < HELP_MSG_LENGTH; i++) {
+ m_HelpMessage[i] = 0;
+ m_LastHelpMessage[i] = 0;
+ m_HelpMessageToPrint[i] = 0;
+ }
+
+ m_HelpMessageTimer = 0;
+ m_HelpMessageFadeTimer = 0;
+ m_HelpMessageState = 0;
+ m_HelpMessageQuick = 0;
+ m_HelpMessageDisplayTime = 1.0f;
+ m_pVehicleName = nil;
+ m_pLastVehicleName = nil;
+ m_pVehicleNameToPrint = nil;
+ m_VehicleNameTimer = 0;
+ m_VehicleFadeTimer = 0;
+ m_VehicleState = 0;
+
+ for (int i = 0; i < ARRAY_SIZE(m_Message); i++)
+ m_Message[i] = 0;
+
+ for (int i = 0; i < 6; i++) {
+ BigMessageInUse[i] = 0.0f;
+
+ for (int j = 0; j < 128; j++)
+ m_BigMessage[i][j] = 0;
+ }
+}
+
+void CHud::SetZoneName(wchar *name)
+{
+ m_pZoneName = name;
+}
+
+void CHud::SetHelpMessage(wchar *message, bool quick)
+{
+ if (!CReplay::IsPlayingBack()) {
+ CMessages::WideStringCopy(m_HelpMessage, message, HELP_MSG_LENGTH);
+ CMessages::InsertPlayerControlKeysInString(m_HelpMessage);
+
+ for (int i = 0; i < HELP_MSG_LENGTH; i++) {
+ m_LastHelpMessage[i] = 0;
+ }
+
+ m_HelpMessageState = 0;
+ m_HelpMessageQuick = quick;
+ }
+}
+
+void CHud::SetVehicleName(wchar *name)
+{
+ m_pVehicleName = name;
+}
void CHud::Draw()
{
@@ -127,18 +267,30 @@ void CHud::Draw()
if (CPad::GetPad(1)->GetStartJustDown())
m_Wants_To_Draw_Hud = !m_Wants_To_Draw_Hud;
+#ifdef GTA_PC
if (CReplay::IsPlayingBack())
return;
+#endif
if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) {
bool DrawCrossHair = false;
+#ifdef GTA_PC
bool DrawCrossHairPC = false;
+#endif
int32 WeaponType = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_eWeaponType;
int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
- if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_M16_1STPERSON || Mode == CCam::MODE_HELICANNON_1STPERSON)
+ if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_M16_1STPERSON
+#ifdef GTA_PC
+ || Mode == CCam::MODE_HELICANNON_1STPERSON
+#endif
+ )
+ {
DrawCrossHair = true;
+ }
+
+#ifdef GTA_PC
if (Mode == CCam::MODE_M16_1STPERSON_RUNABOUT || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT || Mode == CCam::MODE_SNIPER_RUNABOUT)
DrawCrossHairPC = true;
@@ -152,8 +304,14 @@ void CHud::Draw()
DrawCrossHairPC = true;
}
}
+#endif
- if (DrawCrossHair || DrawCrossHairPC) {
+ if ( DrawCrossHair
+#ifdef GTA_PC
+ || DrawCrossHairPC
+#endif
+ )
+ {
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
SpriteBrightness = Min(SpriteBrightness+1, 30);
@@ -161,8 +319,9 @@ void CHud::Draw()
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
float fStep = Sin((CTimer::GetTimeInMilliseconds() & 1023)/1024.0f * 6.28f);
- float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
+ float fMultBright = SpriteBrightness / 30.0f * (0.25f * fStep + 0.75f);
CRect rect;
+#ifdef GTA_PC
if (DrawCrossHairPC && TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam()) {
float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX;
float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY;
@@ -188,18 +347,24 @@ void CHud::Draw()
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
}
}
- else {
- if (Mode == CCam::MODE_M16_1STPERSON ||
- Mode == CCam::MODE_M16_1STPERSON_RUNABOUT ||
- Mode == CCam::MODE_HELICANNON_1STPERSON) {
+ else
+#endif
+ {
+ if (Mode == CCam::MODE_M16_1STPERSON
+#ifdef GTA_PC
+ || Mode == CCam::MODE_M16_1STPERSON_RUNABOUT
+ || Mode == CCam::MODE_HELICANNON_1STPERSON
+#endif
+ )
+ {
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f);
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f);
rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f);
rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f);
Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
-
}
+#ifdef GTA_PC
else if (Mode == CCam::MODE_1STPERSON_RUNABOUT) {
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f);
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f * 0.7f);
@@ -209,15 +374,24 @@ void CHud::Draw()
Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
}
- else if (Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT) {
+#endif
+ else if (Mode == CCam::MODE_ROCKETLAUNCHER
+#ifdef GTA_PC
+ || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT
+#endif
+ )
+ {
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRocketSightTex));
-
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, 40.0f, 40.0f, (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255);
+#else
CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_SCALE_X(40.0f), SCREEN_SCALE_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255);
+#endif
}
else {
// Sniper
@@ -279,10 +453,22 @@ void CHud::Draw()
CFont::SetPropOff();
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(43.0f + 2.0f), sPrint);
+#ifdef PS2_HUD
+#define MONEY_X 100.0f
+#else
+#define MONEY_X 110.0f
+#endif
+
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MONEY_X) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(43.0f) + SCREEN_SCALE_Y(2.0f), sPrint);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MONEY_X) + 2.0f, SCREEN_SCALE_Y(43.0f) + 2.0f, sPrint);
+#endif
CFont::SetColor(MONEY_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MONEY_X), SCREEN_SCALE_Y(43.0f), sPrint);
+
+#undef MONEY_X
/*
DrawAmmo
@@ -320,8 +506,20 @@ void CHud::Draw()
/*
DrawWeaponIcon
*/
+#ifdef PS2_HUD
+#define WEAPON_X 91.0f
+#define AMMO_X 59.0f
+#else
+#define WEAPON_X 99.0f
+#define AMMO_X 66.0f
+#endif
+
Sprites[WeaponType].Draw(
- CRect(SCREEN_SCALE_FROM_RIGHT(99.0f), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(91.0f)),
+ CRect(
+ SCREEN_SCALE_FROM_RIGHT(WEAPON_X),
+ SCREEN_SCALE_Y(27.0f),
+ SCREEN_SCALE_FROM_RIGHT(WEAPON_X)+SCREEN_SCALE_X(64.0f),
+ SCREEN_SCALE_Y(27.0f)+SCREEN_SCALE_Y(64.0f)),
CRGBA(255, 255, 255, 255),
0.015f,
0.015f,
@@ -331,7 +529,7 @@ void CHud::Draw()
1.0f,
1.0f,
1.0f);
-
+
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f));
CFont::SetJustifyOff();
@@ -342,12 +540,22 @@ void CHud::Draw()
if (!CDarkel::FrenzyOnGoing() && WeaponType != WEAPONTYPE_UNARMED && WeaponType != WEAPONTYPE_BASEBALLBAT) {
CFont::SetColor(AMMO_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(66.0f), SCREEN_SCALE_Y(73.0f), sPrint);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(AMMO_X), SCREEN_SCALE_Y(73.0f), sPrint);
}
+#undef WEAPON_X
+#undef AMMO_X
+
/*
DrawHealth
*/
+
+#ifdef PS2_HUD
+#define HEALTH_X 100.0f
+#else
+#define HEALTH_X 110.0f
+#endif
+
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetJustifyOff();
@@ -373,20 +581,33 @@ void CHud::Draw()
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint);
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y(2.0f), sPrint);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + 2.0f, SCREEN_SCALE_Y(65.0f) + 2.0f, sPrint);
+#endif
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) {
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon);
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(56.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y(2.0f), sPrintIcon);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + 2.0f - SCREEN_SCALE_X(56.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + 2.0f, sPrintIcon);
+#endif
}
CFont::SetColor(HEALTH_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X), SCREEN_SCALE_Y(65.0f), sPrint);
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) {
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(56.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + 2.0f - SCREEN_SCALE_X(56.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
+#endif
}
}
}
+#undef HEALTH_X
/*
DrawArmour
@@ -403,18 +624,26 @@ void CHud::Draw()
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint);
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y(2.0f), sPrint);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + 2.0f, SCREEN_SCALE_Y(65.0f) + 2.0f, sPrint);
+#endif
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) {
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon);
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(54.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y(2.0f), sPrintIcon);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + 2.0f - SCREEN_SCALE_X(54.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + 2.0f, sPrintIcon);
+#endif
}
CFont::SetColor(ARMOUR_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint);
- if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) {
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
+ if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) {
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) - SCREEN_SCALE_X(54.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
}
}
}
@@ -422,6 +651,13 @@ void CHud::Draw()
/*
DrawWantedLevel
*/
+
+#ifdef PS2_HUD
+#define STARS_X 49.0f
+#else
+#define STARS_X 60.0f
+#endif
+
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetJustifyOff();
@@ -431,22 +667,37 @@ void CHud::Draw()
CFont::SetFontStyle(FONT_HEADING);
AsciiToUnicode("]", sPrintIcon);
+
+ float fStarsX = SCREEN_SCALE_FROM_RIGHT(STARS_X);
for (int i = 0; i < 6; i++) {
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(2.0f + SCREEN_SCALE_FROM_RIGHT(60.0f - 2.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f + 2.0f), sPrintIcon);
+#ifdef FIX_BUGS
+ CFont::PrintString(fStarsX + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(87.0f) + SCREEN_SCALE_Y(2.0f), sPrintIcon);
+#else
+ CFont::PrintString(fStarsX + 2.0f, SCREEN_SCALE_Y(87.0f) + 2.0f, sPrintIcon);
+#endif
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > i
&& (CTimer::GetTimeInMilliseconds() > FindPlayerPed()->m_pWanted->m_nLastWantedLevelChange
+ 2000 || CTimer::GetFrameCounter() & 4)) {
CFont::SetColor(WANTED_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(60.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
+ CFont::PrintString(fStarsX, SCREEN_SCALE_Y(87.0f), sPrintIcon);
}
+
+ fStarsX -= SCREEN_SCALE_X(23.0f);
}
+
+#undef STARS_X
/*
DrawZoneName
*/
+#ifdef PS2_HUD
+#define ZONE_Y 61.0f
+#else
+#define ZONE_Y 30.0f
+#endif
if (m_pZoneName) {
float fZoneAlpha = 255.0f;
@@ -487,7 +738,7 @@ void CHud::Draw()
m_ZoneState = 1;
m_ZoneFadeTimer = 1000;
}
- fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f;
+ fZoneAlpha = m_ZoneFadeTimer / 1000.0f * 255.0f;
break;
case 3:
m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds();
@@ -495,7 +746,7 @@ void CHud::Draw()
m_ZoneState = 0;
m_ZoneFadeTimer = 0;
}
- fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f;
+ fZoneAlpha = m_ZoneFadeTimer / 1000.0f * 255.0f;
break;
case 4:
m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds();
@@ -504,7 +755,7 @@ void CHud::Draw()
m_ZoneToPrint = m_pLastZoneName;
m_ZoneState = 2;
}
- fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f;
+ fZoneAlpha = m_ZoneFadeTimer / 1000.0f * 255.0f;
break;
default:
break;
@@ -512,10 +763,11 @@ void CHud::Draw()
}
#ifndef HUD_ENHANCEMENTS
- if (!m_Message[0]) {
+ if (!m_Message[0])
#else
- if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide zone name if wasted/busted text is displaying
+ if (!m_Message[0] && !m_BigMessage[2][0]) // Hide zone name if wasted/busted text is displaying
#endif
+ {
m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff();
CFont::SetPropOn();
@@ -531,25 +783,37 @@ void CHud::Draw()
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint);
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(ZONE_Y) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + 1.0f, SCREEN_SCALE_FROM_BOTTOM(ZONE_Y) + 1.0f, m_ZoneToPrint);
+#endif
CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(ZONE_Y), m_ZoneToPrint);
}
}
}
+#undef ZONE_Y
/*
DrawVehicleName
*/
- if (m_VehicleName) {
+
+#ifdef PS2_HUD
+#define VEHICLE_Y 81.0f
+#else
+#define VEHICLE_Y 55.0f
+#endif
+
+ if (m_pVehicleName) {
float fVehicleAlpha = 0.0f;
- if (m_VehicleName != m_pLastVehicleName) {
+ if (m_pVehicleName != m_pLastVehicleName) {
switch (m_VehicleState) {
case 0:
m_VehicleState = 2;
- m_pVehicleNameToPrint = m_VehicleName;
+ m_pVehicleNameToPrint = m_pVehicleName;
m_VehicleNameTimer = 0;
m_VehicleFadeTimer = 0;
break;
@@ -563,7 +827,7 @@ void CHud::Draw()
default:
break;
}
- m_pLastVehicleName = m_VehicleName;
+ m_pLastVehicleName = m_pVehicleName;
}
if (m_VehicleState) {
@@ -581,7 +845,7 @@ void CHud::Draw()
m_VehicleState = 1;
m_VehicleFadeTimer = 1000;
}
- fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f;
+ fVehicleAlpha = m_VehicleFadeTimer / 1000.0f * 255.0f;
break;
case 3:
m_VehicleFadeTimer -= CTimer::GetTimeStepInMilliseconds();
@@ -589,7 +853,7 @@ void CHud::Draw()
m_VehicleState = 0;
m_VehicleFadeTimer = 0;
}
- fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f;
+ fVehicleAlpha = m_VehicleFadeTimer / 1000.0f * 255.0f;
break;
case 4:
m_VehicleFadeTimer -= CTimer::GetTimeStepInMilliseconds();
@@ -599,17 +863,18 @@ void CHud::Draw()
m_VehicleNameTimer = 0;
m_VehicleState = 2;
}
- fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f;
+ fVehicleAlpha = m_VehicleFadeTimer / 1000.0f * 255.0f;
break;
default:
break;
}
#ifndef HUD_ENHANCEMENTS
- if (!m_Message[0]) {
+ if (!m_Message[0])
#else
- if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide vehicle name if wasted/busted text is displaying
+ if (!m_Message[0] && !m_BigMessage[2][0]) // Hide vehicle name if wasted/busted text is displaying
#endif
+ {
m_VehicleNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff();
CFont::SetPropOn();
@@ -625,10 +890,15 @@ void CHud::Draw()
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint);
+
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(VEHICLE_Y) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + 1.0f, SCREEN_SCALE_FROM_BOTTOM(VEHICLE_Y) + 1.0f, m_pVehicleNameToPrint);
+#endif
CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(VEHICLE_Y), m_pVehicleNameToPrint);
}
}
}
@@ -638,10 +908,16 @@ void CHud::Draw()
m_VehicleFadeTimer = 0;
m_VehicleNameTimer = 0;
}
+#undef VEHICLE_Y
/*
DrawClock
*/
+#ifdef PS2_HUD
+#define CLOCK_X 101.0f
+#else
+#define CLOCK_X 111.0f
+#endif
CFont::SetJustifyOff();
CFont::SetCentreOff();
CFont::SetBackgroundOff();
@@ -657,10 +933,16 @@ void CHud::Draw()
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), sPrint);
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(CLOCK_X) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), sPrint);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(CLOCK_X) + 2.0f, SCREEN_SCALE_Y(22.0f) + 2.0f, sPrint);
+#endif
CFont::SetColor(CLOCK_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(CLOCK_X), SCREEN_SCALE_Y(22.0f), sPrint);
+
+#undef CLOCK_X
/*
DrawOnScreenTimer
@@ -701,7 +983,11 @@ void CHud::Draw()
CFont::SetPropOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), sTimer);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + 2.0f, SCREEN_SCALE_Y(110.0f) + 2.0f, sTimer);
+#endif
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetColor(TIMER_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(110.0f), sTimer);
@@ -709,8 +995,12 @@ void CHud::Draw()
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) {
CFont::SetPropOn();
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::SetScale(SCREEN_SCALE_X(0.64f), SCREEN_SCALE_Y(1.35f));
+ CFont::SetScale(SCREEN_SCALE_X(0.8f * 0.8f), SCREEN_SCALE_Y(1.35f));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + 2.0f, TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
+#endif
CFont::SetColor(TIMER_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f), SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
@@ -732,7 +1022,6 @@ void CHud::Draw()
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType == COUNTER_DISPLAY_NUMBER) {
AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer);
CFont::SetPropOn();
-
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetCentreOff();
@@ -745,7 +1034,11 @@ void CHud::Draw()
CFont::SetBackGroundOnlyTextOn();
CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), sTimer);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + 2.0f, SCREEN_SCALE_Y(132.0f) + 2.0f, sTimer);
+#endif
CFont::SetColor(COUNTER_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(132.0f), sTimer);
@@ -754,15 +1047,73 @@ void CHud::Draw()
#ifdef FIX_BUGS
counter = Min(counter, 100);
#endif
- CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 80));
- CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_X(counter) / 2.0f + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET + 50.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 255));
+ CSprite2d::DrawRect
+ (
+ CRect
+ (
+#ifdef FIX_BUGS
+ SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f),
+#else
+ SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + 4.0f,
+#endif
+ SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f),
+#ifdef FIX_BUGS
+ SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(4.0f),
+#else
+ SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + 4.0f,
+#endif
+
+#if !defined(PS2_HUD) || defined(FIX_BUGS)
+ SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)
+#else
+ SCREEN_SCALE_Y(132.0f) + 11.0f + SCREEN_SCALE_Y(8.0f)
+#endif
+ ),
+ CRGBA(0, 106, 164, 80)
+ );
+
+ CSprite2d::DrawRect
+ (
+ CRect
+ (
+#ifdef FIX_BUGS
+ SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f),
+#else
+ SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + 4.0f,
+#endif
+ SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f),
+
+#if !defined(PS2_HUD) || defined(FIX_BUGS)
+ SCREEN_SCALE_X(counter) / 2.0f +
+#else
+ (float)(counter) / 2.0f +
+#endif
+
+#ifdef FIX_BUGS
+ SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2.0f + SCREEN_SCALE_X(4.0f),
+#else
+ SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2.0f + 4.0f,
+#endif
+
+#if !defined(PS2_HUD) || defined(FIX_BUGS)
+ SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)
+#else
+ SCREEN_SCALE_Y(132.0f) + 11.0f + SCREEN_SCALE_Y(8.0f)
+#endif
+ ),
+ CRGBA(0, 106, 164, 255)
+ );
}
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) {
CFont::SetPropOn();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + 2.0f, TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
+#endif
CFont::SetColor(COUNTER_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f), SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
@@ -772,6 +1123,7 @@ void CHud::Draw()
}
#undef TIMER_RIGHT_OFFSET
+ /////////////////////////////////
/*
DrawPager
*/
@@ -807,18 +1159,28 @@ void CHud::Draw()
}
}
- Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f - PagerXOffset), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0 + 26.0f - PagerXOffset), SCREEN_SCALE_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255));
-
+#ifdef FIX_BUGS
+ Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X(PagerXOffset), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X(PagerXOffset), SCREEN_SCALE_Y(80.0f) + SCREEN_SCALE_Y(27.0f)), CRGBA(255, 255, 255, 255));
+#else
+ Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f) - PagerXOffset, SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0f) + SCREEN_SCALE_X(26.0f) - PagerXOffset, SCREEN_SCALE_Y(80.0f) + SCREEN_SCALE_Y(27.0f)), CRGBA(255, 255, 255, 255));
+#endif
+
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.84f), SCREEN_SCALE_Y(1.0f));
CFont::SetColor(PAGER_COLOR);
CFont::SetRightJustifyOff();
CFont::SetBackgroundOff();
CFont::SetCentreOff();
+ CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
CFont::SetJustifyOff();
CFont::SetPropOff();
CFont::SetFontStyle(FONT_PAGER);
- CFont::PrintString(SCREEN_SCALE_X(52.0f - PagerXOffset), SCREEN_SCALE_Y(54.0f), m_PagerMessage);
+
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_X(52.0f) - SCREEN_SCALE_X(PagerXOffset), SCREEN_SCALE_Y(54.0f), m_PagerMessage);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(52.0f) - PagerXOffset, SCREEN_SCALE_Y(54.0f), m_PagerMessage);
+#endif
}
/*
@@ -832,7 +1194,20 @@ void CHud::Draw()
#else
rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
#endif
+
+#ifdef PS2_HUD
+ #ifdef FIX_BUGS
+ rect.Grow(SCREEN_SCALE_X(2.0f), SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(4.0f));
+ #else
+ rect.Grow(2.0f, 4.0f);
+ #endif
+#else
+ #ifdef FIX_BUGS
+ rect.Grow(SCREEN_SCALE_X(4.0f), SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(4.0f), SCREEN_SCALE_Y(4.0f));
+ #else
rect.Grow(4.0f);
+ #endif
+#endif
Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR);
CRadar::DrawBlips();
}
@@ -851,7 +1226,11 @@ void CHud::Draw()
if (!CTimer::GetIsUserPaused()) {
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
if (CTheScripts::IntroTextLines[i].m_Text[0] && CTheScripts::IntroTextLines[i].m_bTextBeforeFade) {
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(CTheScripts::IntroTextLines[i].m_fScaleX, CTheScripts::IntroTextLines[i].m_fScaleY);
+#else
CFont::SetScale(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f));
+#endif
CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor);
if (CTheScripts::IntroTextLines[i].m_bJustify)
@@ -869,8 +1248,17 @@ void CHud::Draw()
else
CFont::SetCentreOff();
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetWrapx(CTheScripts::IntroTextLines[i].m_fWrapX);
+#else
CFont::SetWrapx(SCALE_AND_CENTER_X(CTheScripts::IntroTextLines[i].m_fWrapX));
+#endif
+
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetCentreSize(CTheScripts::IntroTextLines[i].m_fCenterSize);
+#else
CFont::SetCentreSize(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fCenterSize));
+#endif
if (CTheScripts::IntroTextLines[i].m_bBackground)
CFont::SetBackgroundOn();
@@ -890,7 +1278,12 @@ void CHud::Draw()
CFont::SetPropOff();
CFont::SetFontStyle(FONT_LOCALE(CTheScripts::IntroTextLines[i].m_nFont));
+
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::PrintString(CTheScripts::IntroTextLines[i].m_fAtX, CTheScripts::IntroTextLines[i].m_fAtY, CTheScripts::IntroTextLines[i].m_Text);
+#else
CFont::PrintString(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - CTheScripts::IntroTextLines[i].m_fAtY), CTheScripts::IntroTextLines[i].m_Text);
+#endif
}
}
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroRectangles); i++) {
@@ -922,11 +1315,20 @@ void CHud::Draw()
/*
DrawSubtitles
*/
+#ifdef PS2_HUD
+#define SUBS_Y 83.0f
+#else
+#define SUBS_Y 68.0f
+#endif
if (m_Message[0] && !m_BigMessage[2][0] && (FrontEndMenuManager.m_PrefsShowSubtitles == 1 || !TheCamera.m_WideScreenOn)) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(0.48f, 1.12f);
+#else
CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.12f));
+#endif
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
@@ -941,7 +1343,8 @@ void CHud::Draw()
2.0f, true, CRGBA(0, 0, 0, 255));
#else
float radarBulge = SCREEN_SCALE_X(40.0f) + SCREEN_SCALE_X(8.0f);
- float rectWidth = SCREEN_WIDTH - SCREEN_SCALE_X(50.0f) - SCREEN_SCALE_X(8.0f) - radarBulge;
+ float rectWidth = SCREEN_SCALE_FROM_RIGHT(50.0f) - SCREEN_SCALE_X(8.0f) - radarBulge;
+
CFont::SetCentreSize(rectWidth);
const int16 shadow = 1;
@@ -950,10 +1353,17 @@ void CHud::Draw()
CFont::SetColor(CRGBA(235, 235, 235, 255));
// I'm not sure shadow substaction was intentional here, might be a leftover if CFont::PrintString was used for a shadow draw call
- CFont::PrintString(rectWidth / 2.0f + radarBulge - SCREEN_SCALE_X(shadow), SCREEN_SCALE_Y(4.0f) + SCREEN_SCALE_FROM_BOTTOM(68.0f) - SCREEN_SCALE_Y(shadow), m_Message);
+ #if defined(FIX_BUGS)
+ CFont::PrintString(rectWidth / 2.0f + radarBulge - SCREEN_SCALE_X(shadow), SCREEN_SCALE_Y(4.0f) + SCREEN_SCALE_FROM_BOTTOM(SUBS_Y) - SCREEN_SCALE_Y(shadow), m_Message);
+ #elif defined(PS2_HUD)
+ CFont::PrintString(rectWidth / 2.0f + radarBulge - shadow, 4.0f + SCREEN_SCALE_FROM_BOTTOM(SUBS_Y) - shadow, m_Message);
+ #else
+ CFont::PrintString(rectWidth / 2.0f + radarBulge - shadow, SCREEN_SCALE_Y(4.0f) + SCREEN_SCALE_FROM_BOTTOM(SUBS_Y) - shadow, m_Message);
+ #endif
CFont::SetDropShadowPosition(0);
-#endif
+#endif // #ifdef XBOX_SUBTITLES
}
+#undef SUBS_Y
/*
DrawBigMessage
@@ -964,15 +1374,33 @@ void CHud::Draw()
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOff();
- CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
+
+ if (CGame::frenchGame || CGame::germanGame)
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(1.8f, 1.8f);
+#else
+ CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
+#endif
+ else
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(1.8f, 1.8f);
+#else
+ CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
+#endif
+
CFont::SetPropOn();
CFont::SetCentreOn();
- CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 25));
+ CFont::SetColor(CRGBA(255, 255, 0, 255));
CFont::SetFontStyle(FONT_HEADING);
// Appearently sliding text in here was abandoned very early, since this text is centered now.
-
- if (BigMessageX[0] >= SCALE_AND_CENTER_X(620.0f)) {
+#ifdef FIX_BUGS
+ if (BigMessageX[0] >= SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH-20))
+#else
+ if (BigMessageX[0] >= SCREEN_WIDTH-20)
+#endif
+ {
BigMessageInUse[0] += CTimer::GetTimeStep();
if (BigMessageInUse[0] >= 120.0f) {
@@ -986,7 +1414,11 @@ void CHud::Draw()
}
}
else {
+#ifdef FIX_BUGS
BigMessageX[0] += SCREEN_SCALE_X((CTimer::GetTimeStepInMilliseconds() * 0.3f));
+#else
+ BigMessageX[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
+#endif
BigMessageAlpha[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
if (BigMessageAlpha[0] > 255.0f)
@@ -999,15 +1431,30 @@ void CHud::Draw()
#else
#define Y_OFFSET 20.0f
#endif
+
+#if defined(FIX_BUGS)
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(Y_OFFSET) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]);
+#elif defined(PS2_HUD) // yeah, that's right. ps2 uses y=ScaleX(a)
+ CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(120.0f) + 2.0f, m_BigMessage[0]);
+#else
+ CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(Y_OFFSET) + 2.0f, m_BigMessage[0]);
+#endif
CFont::SetColor(CRGBA(BIGMESSAGE_COLOR.r, BIGMESSAGE_COLOR.g, BIGMESSAGE_COLOR.b, BigMessageAlpha[0]));
+#if defined(PS2_HUD) && !defined(FIX_BUGS) // same
+ CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(120.0f), m_BigMessage[0]);
+#else
CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f), m_BigMessage[0]);
+#endif
#undef Y_OFFSET
}
else {
BigMessageAlpha[0] = 0.0f;
+#ifdef FIX_BUGS
BigMessageX[0] = SCALE_AND_CENTER_X(-60.0f);
+#else
+ BigMessageX[0] = -60.0f;
+#endif
BigMessageInUse[0] = 1.0f;
}
}
@@ -1016,6 +1463,11 @@ void CHud::Draw()
}
// WastedBustedText
+#ifdef PS2_HUD
+#define WASTEDBUSTED_Y 122.0f
+#else
+#define WASTEDBUSTED_Y 82.0f
+#endif
if (m_BigMessage[2][0]) {
if (BigMessageInUse[2] != 0.0f) {
BigMessageAlpha[2] += (CTimer::GetTimeStepInMilliseconds() * 0.4f);
@@ -1025,20 +1477,31 @@ void CHud::Draw()
CFont::SetBackgroundOff();
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ if (CGame::frenchGame || CGame::germanGame)
+ CFont::SetScale(1.4f, 1.4f);
+ else
+ CFont::SetScale(2.0f, 2.0f);
+#else
if (CGame::frenchGame || CGame::germanGame)
CFont::SetScale(SCREEN_SCALE_X(1.4f), SCREEN_SCALE_Y(1.4f));
else
CFont::SetScale(SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(2.0f));
+#endif
CFont::SetPropOn();
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
- CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]);
+ CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]*0.75f));
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_FROM_BOTTOM(WASTEDBUSTED_Y) + SCREEN_SCALE_Y(4.0f), m_BigMessage[2]);
+#else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + 4.0f, SCREEN_SCALE_FROM_BOTTOM(WASTEDBUSTED_Y) + SCREEN_SCALE_Y(4.0f), m_BigMessage[2]);
+#endif
CFont::SetColor(CRGBA(WASTEDBUSTED_COLOR.r, WASTEDBUSTED_COLOR.g, WASTEDBUSTED_COLOR.b, BigMessageAlpha[2]));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(WASTEDBUSTED_Y), m_BigMessage[2]);
}
else {
BigMessageAlpha[2] = 0.0f;
@@ -1048,6 +1511,7 @@ void CHud::Draw()
else {
BigMessageInUse[2] = 0.0f;
}
+#undef WASTEDBUSTED_Y
}
}
@@ -1064,7 +1528,7 @@ void CHud::DrawAfterFade()
m_HelpMessageState = 2;
m_HelpMessageTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, HELP_MSG_LENGTH);
- m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
+ m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) / 20.0f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
@@ -1100,7 +1564,7 @@ void CHud::DrawAfterFade()
m_HelpMessageState = 1;
m_HelpMessageFadeTimer = 0;
}
- fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
+ fAlpha = m_HelpMessageFadeTimer / 1000.0f * 225.0f;
break;
case 3:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
@@ -1108,7 +1572,7 @@ void CHud::DrawAfterFade()
m_HelpMessageState = 0;
m_HelpMessageFadeTimer = 0;
}
- fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
+ fAlpha = m_HelpMessageFadeTimer / 1000.0f * 225.0f;
break;
case 4:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
@@ -1117,7 +1581,7 @@ void CHud::DrawAfterFade()
m_HelpMessageFadeTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, HELP_MSG_LENGTH);
}
- fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
+ fAlpha = m_HelpMessageFadeTimer / 1000.0f * 225.0f;
break;
default:
break;
@@ -1139,18 +1603,31 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::SetColor(CRGBA(175, 175, 175, 255));
- CFont::SetJustifyOff();
+ CFont::SetJustifyOff();
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
- CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 26.0f - 4.0f));
+ #ifdef FIX_BUGS
+ CFont::SetWrapx(SCREEN_SCALE_X(229.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X(4.0f));
+ #else
+ CFont::SetWrapx(SCREEN_SCALE_X(229.0f) + SCREEN_SCALE_X(26.0f) - 4.0f);
+ #endif
else
#endif
- CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
+ #ifdef FIX_BUGS
+ CFont::SetWrapx(SCREEN_SCALE_X(200.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X(4.0f));
+ #else
+ CFont::SetWrapx(SCREEN_SCALE_X(200.0f) + SCREEN_SCALE_X(26.0f) - 4.0f);
+ #endif
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
- CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
+ CFont::SetColor(CRGBA(175, 175, 175, 255));
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), m_HelpMessageToPrint);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f) + (150.0f - PagerXOffset) * 0.6f, m_HelpMessageToPrint);
+#endif
CFont::SetAlphaFade(255.0f);
}
}
@@ -1158,8 +1635,11 @@ void CHud::DrawAfterFade()
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
intro_text_line &line = CTheScripts::IntroTextLines[i];
if (line.m_Text[0] != '\0' && !line.m_bTextBeforeFade) {
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(line.m_fScaleX, line.m_fScaleY);
+#else
CFont::SetScale(SCREEN_SCALE_X(line.m_fScaleX), SCREEN_SCALE_Y(line.m_fScaleY) / 2);
-
+#endif
CFont::SetColor(line.m_sColor);
if (line.m_bJustify)
CFont::SetJustifyOn();
@@ -1176,8 +1656,14 @@ void CHud::DrawAfterFade()
else
CFont::SetCentreOff();
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetWrapx(line.m_fWrapX);
+ CFont::SetCentreSize(line.m_fCenterSize);
+#else
CFont::SetWrapx(SCALE_AND_CENTER_X(line.m_fWrapX));
CFont::SetCentreSize(SCREEN_SCALE_X(line.m_fCenterSize));
+#endif
+
if (line.m_bBackground)
CFont::SetBackgroundOn();
else
@@ -1195,7 +1681,11 @@ void CHud::DrawAfterFade()
CFont::SetPropOff();
CFont::SetFontStyle(line.m_nFont);
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::PrintString(line.m_fAtX, line.m_fAtY, line.m_Text);
+#else
CFont::PrintString(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH - line.m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - line.m_fAtY), line.m_Text);
+#endif
}
}
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroRectangles); i++) {
@@ -1216,38 +1706,61 @@ void CHud::DrawAfterFade()
/*
DrawBigMessage2
*/
+#ifdef PS2_HUD
+ #define BIGMESSAGE_Y 80.0f
+#else
+ #define BIGMESSAGE_Y 84.0f
+#endif
+
// Oddjob
if (m_BigMessage[3][0]) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(1.2f, 1.5f);
+#else
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f));
+#endif
CFont::SetCentreOn();
CFont::SetPropOn();
- CFont::SetCentreSize(SCREEN_SCALE_X(600.0f));
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 40));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
-
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]);
+
+#ifdef FIX_BUGS
+ CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]);
+#else
+ CFont::PrintString((SCREEN_WIDTH / 2) + 2.0f, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) + 2.0f, m_BigMessage[3]);
+#endif
CFont::SetColor(ODDJOB_COLOR);
- CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[3]);
+
+ CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y), m_BigMessage[3]);
}
if (!m_BigMessage[1][0] && m_BigMessage[4][0]) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(1.2f, 1.5f);
+#else
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f));
+#endif
CFont::SetCentreOn();
CFont::SetPropOn();
- CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
- CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]);
-
+#ifdef FIX_BUGS
+ CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]);
+#else
+ CFont::PrintString((SCREEN_WIDTH / 2) - 2.0f, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) - 2.0f, m_BigMessage[4]);
+#endif
CFont::SetColor(ODDJOB_COLOR);
- CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[4]);
+ CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y), m_BigMessage[4]);
}
+#undef BIGMESSAGE_Y
// Oddjob result
if (OddJob2OffTimer > 0)
@@ -1296,18 +1809,29 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.2f));
CFont::SetCentreOn();
CFont::SetPropOn();
- CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
+ // Not bug, we just want these kind of texts to be wrapped at the center.
+#ifdef ASPECT_RATIO_SCALE
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20.0f));
+#else
+ CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
+#endif
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
#ifdef BETA_SLIDING_TEXT
+ #if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + 2.0f, m_BigMessage[5]);
+ #else
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);
-
+ #endif
CFont::SetColor(ODDJOB2_COLOR);
CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]);
#else
+ #if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + 2.0f, m_BigMessage[5]);
+ #else
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);
-
+ #endif
CFont::SetColor(ODDJOB2_COLOR);
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]);
#endif
@@ -1323,15 +1847,33 @@ void CHud::DrawAfterFade()
CFont::SetBackgroundOff();
if (CGame::frenchGame || FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_SPANISH)
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(0.884f, 1.36f);
+#else
CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f));
+#endif
else
+#if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::SetScale(1.04f, 1.6f);
+#else
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));
+#endif
CFont::SetPropOn();
+#ifdef FIX_BUGS
CFont::SetRightJustifyWrap(SCREEN_SCALE_FROM_RIGHT(DEFAULT_SCREEN_WIDTH + 500.0f));
+#else
+ CFont::SetRightJustifyWrap(-500.0f);
+#endif
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
- if (BigMessageX[1] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
+
+#ifdef FIX_BUGS
+ if (BigMessageX[1] >= SCREEN_WIDTH - SCREEN_SCALE_X(20.0f))
+#else
+ if (BigMessageX[1] >= SCREEN_WIDTH - 20.0f)
+#endif
+ {
BigMessageInUse[1] += CTimer::GetTimeStep();
if (BigMessageInUse[1] >= 120.0f) {
@@ -1343,7 +1885,11 @@ void CHud::DrawAfterFade()
BigMessageAlpha[1] = 0.0f;
}
} else {
+#ifdef FIX_BUGS
BigMessageX[1] += SCREEN_SCALE_X((CTimer::GetTimeStepInMilliseconds() * 0.3f));
+#else
+ BigMessageX[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
+#endif
BigMessageAlpha[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
if (BigMessageAlpha[1] > 255.0f)
@@ -1352,20 +1898,32 @@ void CHud::DrawAfterFade()
CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1]));
#ifdef BETA_SLIDING_TEXT
+ #if defined(PS2_HUD) && !defined(FIX_BUGS)
+ CFont::PrintString(SCREEN_SCALE_X(2.0f) + BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(120.0f) + 2.0f, m_BigMessage[1]);
+ #else
CFont::PrintString(SCREEN_SCALE_X(2.0f) + BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]);
-
+ #endif
CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1]));
CFont::PrintString(BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]);
#else
+ #ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]);
-
+ #elif defined(PS2_HUD)
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + 2.0f, SCREEN_SCALE_FROM_BOTTOM(120.0f) + 2.0f, m_BigMessage[1]);
+ #else
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + 2.0f, SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]);
+ #endif
CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]);
#endif
}
else {
BigMessageAlpha[1] = 0.0f;
+#ifdef FIX_BUGS
BigMessageX[1] = SCREEN_SCALE_FROM_RIGHT(DEFAULT_SCREEN_WIDTH + 60.0f);
+#else
+ BigMessageX[1] = -60.0f;
+#endif
BigMessageInUse[1] = 1.0f;
}
}
@@ -1374,106 +1932,18 @@ void CHud::DrawAfterFade()
}
}
-void CHud::GetRidOfAllHudMessages()
-{
- m_ZoneState = 0;
- m_pLastZoneName = nil;
- m_ZoneNameTimer = 0;
- m_pZoneName = nil;
-
- for (int i = 0; i < HELP_MSG_LENGTH; i++) {
- m_HelpMessage[i] = 0;
- m_LastHelpMessage[i] = 0;
- m_HelpMessageToPrint[i] = 0;
- }
-
- m_HelpMessageTimer = 0;
- m_HelpMessageFadeTimer = 0;
- m_HelpMessageState = 0;
- m_HelpMessageQuick = 0;
- m_HelpMessageDisplayTime = 1.0f;
- m_VehicleName = nil;
- m_pLastVehicleName = nil;
- m_pVehicleNameToPrint = nil;
- m_VehicleNameTimer = 0;
- m_VehicleFadeTimer = 0;
- m_VehicleState = 0;
-
- for (int i = 0; i < ARRAY_SIZE(m_Message); i++)
- m_Message[i] = 0;
-
- for (int i = 0; i < 6; i++) {
- BigMessageInUse[i] = 0.0f;
-
- for (int j = 0; j < 128; j++)
- m_BigMessage[i][j] = 0;
- }
-}
-
-void CHud::Initialise()
+void CHud::SetMessage(wchar *message)
{
- m_Wants_To_Draw_Hud = true;
- m_Wants_To_Draw_3dMarkers = true;
-
- int HudTXD = CTxdStore::AddTxdSlot("hud");
- CTxdStore::LoadTxd(HudTXD, "MODELS/HUD.TXD");
- CTxdStore::AddRef(HudTXD);
- CTxdStore::PopCurrentTxd();
- CTxdStore::SetCurrentTxd(HudTXD);
+ int i = 0;
+ for (i = 0; i < ARRAY_SIZE(m_Message); i++) {
+ if (message[i] == 0)
+ break;
- for (int i = 0; i < NUM_HUD_SPRITES; i++) {
- Sprites[i].SetTexture(WeaponFilenames[i].name, WeaponFilenames[i].mask);
+ m_Message[i] = message[i];
}
-
- GetRidOfAllHudMessages();
-
- if (gpSniperSightTex == nil)
- gpSniperSightTex = RwTextureRead("sitesniper", nil);
- if (gpRocketSightTex == nil)
- gpRocketSightTex = RwTextureRead("siterocket", nil);
-
- CounterOnLastFrame = false;
- m_ItemToFlash = ITEM_NONE;
- OddJob2Timer = 0;
- OddJob2OffTimer = 0.0f;
- OddJob2On = 0;
- OddJob2XOffset = 0.0f;
- CounterFlashTimer = 0;
- TimerOnLastFrame = false;
- TimerFlashTimer = 0;
- SpriteBrightness = 0;
- PagerOn = 0;
- PagerTimer = 0;
- PagerSoundPlayed = 0;
- PagerXOffset = 150.0f;
-
- CTxdStore::PopCurrentTxd();
-}
-
-void CHud::ReInitialise() {
- m_Wants_To_Draw_Hud = true;
- m_Wants_To_Draw_3dMarkers = true;
-
- GetRidOfAllHudMessages();
-
- CounterOnLastFrame = false;
- m_ItemToFlash = ITEM_NONE;
- OddJob2Timer = 0;
- OddJob2OffTimer = 0.0f;
- OddJob2On = 0;
- OddJob2XOffset = 0.0f;
- CounterFlashTimer = 0;
- TimerOnLastFrame = false;
- TimerFlashTimer = 0;
- SpriteBrightness = 0;
- PagerOn = 0;
- PagerTimer = 0;
- PagerSoundPlayed = 0;
- PagerXOffset = 150.0f;
+ m_Message[i] = 0;
}
-wchar LastBigMessage[6][128];
-
void CHud::SetBigMessage(wchar *message, uint16 style)
{
int i = 0;
@@ -1500,33 +1970,9 @@ void CHud::SetBigMessage(wchar *message, uint16 style)
}
LastBigMessage[style][i] = 0;
m_BigMessage[style][i] = 0;
-}
-
-void CHud::SetHelpMessage(wchar *message, bool quick)
-{
- if (!CReplay::IsPlayingBack()) {
- CMessages::WideStringCopy(m_HelpMessage, message, HELP_MSG_LENGTH);
- CMessages::InsertPlayerControlKeysInString(m_HelpMessage);
-
- for (int i = 0; i < HELP_MSG_LENGTH; i++) {
- m_LastHelpMessage[i] = 0;
- }
-
- m_HelpMessageState = 0;
- m_HelpMessageQuick = quick;
- }
-}
-
-void CHud::SetMessage(wchar *message)
-{
- int i = 0;
- for (i = 0; i < ARRAY_SIZE(m_Message); i++) {
- if (message[i] == 0)
- break;
-
- m_Message[i] = message[i];
- }
- m_Message[i] = 0;
+#ifndef FIX_BUGS
+ m_BigMessage[style][i] = 0;
+#endif
}
void CHud::SetPagerMessage(wchar *message)
@@ -1539,30 +1985,4 @@ void CHud::SetPagerMessage(wchar *message)
m_PagerMessage[i] = message[i];
}
m_PagerMessage[i] = 0;
-}
-
-void CHud::SetVehicleName(wchar *name)
-{
- m_VehicleName = name;
-}
-
-void CHud::SetZoneName(wchar *name)
-{
- m_pZoneName = name;
-}
-
-void CHud::Shutdown()
-{
- for (int i = 0; i < NUM_HUD_SPRITES; ++i) {
- Sprites[i].Delete();
- }
-
- RwTextureDestroy(gpSniperSightTex);
- gpSniperSightTex = nil;
-
- RwTextureDestroy(gpRocketSightTex);
- gpRocketSightTex = nil;
-
- int HudTXD = CTxdStore::FindTxdSlot("hud");
- CTxdStore::RemoveTxdSlot(HudTXD);
-}
+} \ No newline at end of file
diff --git a/src/render/Hud.h b/src/render/Hud.h
index bef73cc2..adfdf1fc 100644
--- a/src/render/Hud.h
+++ b/src/render/Hud.h
@@ -37,63 +37,45 @@ enum eSprites
class CHud
{
public:
+ static int16 m_ItemToFlash;
static CSprite2d Sprites[NUM_HUD_SPRITES];
- static wchar m_HelpMessage[HELP_MSG_LENGTH];
- static wchar m_LastHelpMessage[HELP_MSG_LENGTH];
- static uint32 m_HelpMessageState;
- static uint32 m_HelpMessageTimer;
- static int32 m_HelpMessageFadeTimer;
- static wchar m_HelpMessageToPrint[HELP_MSG_LENGTH];
- static float m_HelpMessageDisplayTime;
- static bool m_HelpMessageQuick;
- static uint32 m_ZoneState;
- static int32 m_ZoneFadeTimer;
- static uint32 m_ZoneNameTimer;
static wchar *m_pZoneName;
static wchar *m_pLastZoneName;
static wchar *m_ZoneToPrint;
- static wchar *m_VehicleName;
- static wchar *m_pLastVehicleName;
- static wchar *m_pVehicleNameToPrint;
- static uint32 m_VehicleState;
- static int32 m_VehicleFadeTimer;
- static uint32 m_VehicleNameTimer;
static wchar m_Message[256];
+ static wchar m_BigMessage[6][128];
static wchar m_PagerMessage[256];
+ static uint32 m_ZoneNameTimer;
+ static int32 m_ZoneFadeTimer;
+ static uint32 m_ZoneState;
+ static wchar m_HelpMessage[HELP_MSG_LENGTH];
+ static wchar m_LastHelpMessage[HELP_MSG_LENGTH];
+ static wchar m_HelpMessageToPrint[HELP_MSG_LENGTH];
+ static uint32 m_HelpMessageTimer;
+ static int32 m_HelpMessageFadeTimer;
+ static uint32 m_HelpMessageState;
+ static bool m_HelpMessageQuick;
+ static float m_HelpMessageDisplayTime;
+ static int32 SpriteBrightness;
static bool m_Wants_To_Draw_Hud;
static bool m_Wants_To_Draw_3dMarkers;
- static wchar m_BigMessage[6][128];
- static int16 m_ItemToFlash;
-
- // These aren't really in CHud
- static float BigMessageInUse[6];
- static float BigMessageAlpha[6];
- static float BigMessageX[6];
- static float OddJob2OffTimer;
- static bool CounterOnLastFrame;
- static float OddJob2XOffset;
- static uint16 CounterFlashTimer;
- static uint16 OddJob2Timer;
- static bool TimerOnLastFrame;
- static int16 OddJob2On;
- static uint16 TimerFlashTimer;
- static int16 PagerSoundPlayed;
- static int32 SpriteBrightness;
- static float PagerXOffset;
- static int16 PagerTimer;
- static int16 PagerOn;
-
+ static wchar *m_pVehicleName;
+ static wchar *m_pLastVehicleName;
+ static uint32 m_VehicleNameTimer;
+ static int32 m_VehicleFadeTimer;
+ static uint32 m_VehicleState;
+ static wchar *m_pVehicleNameToPrint;
public:
- static void Draw();
- static void DrawAfterFade();
- static void GetRidOfAllHudMessages();
static void Initialise();
+ static void Shutdown();
static void ReInitialise();
- static void SetBigMessage(wchar *message, uint16 style);
+ static void GetRidOfAllHudMessages();
+ static void SetZoneName(wchar *name);
static void SetHelpMessage(wchar *message, bool quick);
+ static void SetVehicleName(wchar *name);
+ static void Draw();
+ static void DrawAfterFade();
static void SetMessage(wchar *message);
+ static void SetBigMessage(wchar *message, uint16 style);
static void SetPagerMessage(wchar *message);
- static void SetVehicleName(wchar *name);
- static void SetZoneName(wchar *name);
- static void Shutdown();
};
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 2b19486e..f175c264 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -1570,7 +1570,7 @@ void CParticle::Render()
float w;
float h;
- if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) )
+ if ( CSprite::CalcScreenCoors(particle->m_vecPosition, &coors, &w, &h, true) )
{
#ifdef PC_PARTICLE
if ( (!particleBanned || SCREEN_WIDTH * fParticleScaleLimit >= w)
@@ -1650,7 +1650,7 @@ void CParticle::Render()
float fRotation;
float fTrailLength;
- if ( CSprite::CalcScreenCoors(vecPrevPos, particle->m_vecScreenPosition, &fTrailLength, &fRotation, true) )
+ if ( CSprite::CalcScreenCoors(vecPrevPos, &particle->m_vecScreenPosition, &fTrailLength, &fRotation, true) )
{
CVector2D vecDist
(
diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp
index 0713dc6d..6f0b4d46 100644
--- a/src/render/PointLights.cpp
+++ b/src/render/PointLights.cpp
@@ -218,7 +218,7 @@ CPointLights::RenderFogEffect(void)
// more intensity the closer to line
intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH);
- if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
+ if(CSprite::CalcScreenCoors(fogcoors, &spriteCoors, &spritew, &spriteh, true)){
float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x2000;
float size = FogSizes[r>>1];
CSprite::RenderOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
@@ -267,7 +267,7 @@ CPointLights::RenderFogEffect(void)
intensity *= 1.0f - sq(lightdist / FOG_AREA_RADIUS);
CVector fogcoors(xi, yi, point.point.z + 1.6f);
- if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
+ if(CSprite::CalcScreenCoors(fogcoors, &spriteCoors, &spritew, &spriteh, true)){
float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x4000;
float size = FogSizes[r>>1];
CSprite::RenderOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index a0f66819..d47cac31 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -741,7 +741,7 @@ CRenderer::ScanWorld(void)
vectors[CORNER_PRIO_RIGHT].x = vectors[CORNER_LOD_RIGHT].x * 0.2f;
vectors[CORNER_PRIO_RIGHT].y = vectors[CORNER_LOD_RIGHT].y * 0.2f;
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
- RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
+ RwV3dTransformPoints(vectors, vectors, 9, cammatrix);
m_loadingPriority = false;
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
@@ -881,7 +881,7 @@ CRenderer::RequestObjectsInFrustum(void)
vectors[CORNER_PRIO_RIGHT].x = vectors[CORNER_LOD_RIGHT].x * 0.2f;
vectors[CORNER_PRIO_RIGHT].y = vectors[CORNER_LOD_RIGHT].y * 0.2f;
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
- RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
+ RwV3dTransformPoints(vectors, vectors, 9, cammatrix);
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
#ifdef FIX_BUGS
diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp
index 34423d83..ade5db81 100644
--- a/src/render/SpecialFX.cpp
+++ b/src/render/SpecialFX.cpp
@@ -1048,15 +1048,19 @@ CMoneyMessage::Render()
RwV3d vecOut;
float fDistX, fDistY;
if (CSprite::CalcScreenCoors(m_vecPosition + CVector(0.0f, 0.0f, fLifeTime), &vecOut, &fDistX, &fDistY, true)) {
- fDistX *= (0.7 * fLifeTime + 2.0) * m_fSize;
- fDistY *= (0.7 * fLifeTime + 2.0) * m_fSize;
+ fDistX *= (0.7f * fLifeTime + 2.0f) * m_fSize;
+ fDistY *= (0.7f * fLifeTime + 2.0f) * m_fSize;
CFont::SetPropOn();
CFont::SetBackgroundOff();
float fScaleY = Min(fDistY / 100.0f, MAX_SCALE);
float fScaleX = Min(fDistX / 100.0f, MAX_SCALE);
- CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here?
+#ifdef FIX_BUGS
+ CFont::SetScale(SCREEN_SCALE_X(fScaleX), SCREEN_SCALE_Y(fScaleY));
+#else
+ CFont::SetScale(fScaleX, fScaleY);
+#endif
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH);
CFont::SetJustifyOff();
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index 49fc3a22..a0c7ae31 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -62,7 +62,11 @@ CWaterLevel::Initialise(Const char *pWaterDat)
#ifdef MASTER
int32 hFile = -1;
- while ((hFile = CFileMgr::OpenFile("DATA\\waterpro.dat", "rb")) < 0);
+ do
+ {
+ hFile = CFileMgr::OpenFile("DATA\\waterpro.dat", "rb");
+ }
+ while ( hFile < 0 );
#else
int32 hFile = CFileMgr::OpenFile("DATA\\waterpro.dat", "rb");
#endif
@@ -89,7 +93,11 @@ CWaterLevel::Initialise(Const char *pWaterDat)
while ((line = CFileLoader::LoadLine(hFile)))
{
+#ifdef FIX_BUGS
+ if (*line && *line != ';' && !strstr(line, "* ;end of file"))
+#else
if (*line && *line != ';')
+#endif
{
float z, l, b, r, t;
sscanf(line, "%f %f %f %f %f", &z, &l, &b, &r, &t);
@@ -217,8 +225,8 @@ CWaterLevel::Initialise(Const char *pWaterDat)
int32 slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::SetCurrentTxd(slot);
- if ( gpWaterTex == NULL )
- gpWaterTex = RwTextureRead("water_old", NULL);
+ if ( gpWaterTex == nil )
+ gpWaterTex = RwTextureRead("water_old", nil);
gpWaterRaster = RwTextureGetRaster(gpWaterTex);
CTxdStore::PopCurrentTxd();
@@ -235,10 +243,10 @@ CWaterLevel::Shutdown()
FreeBoatWakeArray();
DestroyWavyAtomic();
- if ( gpWaterTex != NULL )
+ if ( gpWaterTex != nil )
{
RwTextureDestroy(gpWaterTex);
- gpWaterTex = NULL;
+ gpWaterTex = nil;
}
}
@@ -260,15 +268,15 @@ CWaterLevel::CreateWavyAtomic()
|rpGEOMETRYPRELIT
|rpGEOMETRYMODULATEMATERIALCOLOR);
- ASSERT(wavyGeometry != NULL);
+ ASSERT(wavyGeometry != nil);
}
{
wavyMaterial = RpMaterialCreate();
- ASSERT(wavyMaterial != NULL);
- ASSERT(gpWaterTex != NULL);
+ ASSERT(wavyMaterial != nil);
+ ASSERT(gpWaterTex != nil);
RpMaterialSetTexture(wavyMaterial, gpWaterTex);
}
@@ -276,7 +284,7 @@ CWaterLevel::CreateWavyAtomic()
{
wavyTriangles = RpGeometryGetTriangles(wavyGeometry);
- ASSERT(wavyTriangles != NULL);
+ ASSERT(wavyTriangles != nil);
/*
[B] [C]
***********
@@ -307,9 +315,9 @@ CWaterLevel::CreateWavyAtomic()
{
wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0);
- ASSERT(wavyMorphTarget != NULL);
+ ASSERT(wavyMorphTarget != nil);
wavyVert = RpMorphTargetGetVertices(wavyMorphTarget);
- ASSERT(wavyVert != NULL);
+ ASSERT(wavyVert != nil);
for ( int32 i = 0; i < 9; i++ )
{
@@ -329,10 +337,10 @@ CWaterLevel::CreateWavyAtomic()
{
wavyFrame = RwFrameCreate();
- ASSERT( wavyFrame != NULL );
+ ASSERT( wavyFrame != nil );
ms_pWavyAtomic = RpAtomicCreate();
- ASSERT( ms_pWavyAtomic != NULL );
+ ASSERT( ms_pWavyAtomic != nil );
RpAtomicSetGeometry(ms_pWavyAtomic, wavyGeometry, 0);
RpAtomicSetFrame(ms_pWavyAtomic, wavyFrame);
@@ -531,7 +539,7 @@ CWaterLevel::GetWaterLevel(float fX, float fY, float fZ, float *pfOutLevel, bool
if ( nBlock == NO_WATER )
return false;
- ASSERT( pfOutLevel != NULL );
+ ASSERT( pfOutLevel != nil );
*pfOutLevel = ms_aWaterZs[nBlock];
float fAngle = (CTimer::GetTimeInMilliseconds() & 4095) * (TWOPI / 4096.0f);
@@ -570,7 +578,7 @@ CWaterLevel::GetWaterLevelNoWaves(float fX, float fY, float fZ, float *pfOutLeve
if ( nBlock == NO_WATER )
return false;
- ASSERT( pfOutLevel != NULL );
+ ASSERT( pfOutLevel != nil );
*pfOutLevel = ms_aWaterZs[nBlock];
return true;
@@ -1243,19 +1251,19 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
CBoat::FillBoatList();
- ASSERT( ms_pWavyAtomic != NULL );
+ ASSERT( ms_pWavyAtomic != nil );
RpGeometry *geometry = RpAtomicGetGeometry(ms_pWavyAtomic);
- ASSERT( geometry != NULL );
+ ASSERT( geometry != nil );
RwRGBA *wavyPreLights = RpGeometryGetPreLightColors(geometry);
RwTexCoords *wavyTexCoords = RpGeometryGetVertexTexCoords(geometry, rwTEXTURECOORDINATEINDEX0);
RwV3d *wavyVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(geometry, 0));
- ASSERT( wavyPreLights != NULL );
- ASSERT( wavyTexCoords != NULL );
- ASSERT( wavyVertices != NULL );
+ ASSERT( wavyPreLights != nil );
+ ASSERT( wavyTexCoords != nil );
+ ASSERT( wavyVertices != nil );
RpGeometryLock(geometry, rpGEOMETRYLOCKVERTICES
| rpGEOMETRYLOCKPRELIGHT
@@ -1278,7 +1286,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
RpGeometryUnlock(geometry);
}
- static CBoat *apBoatList[4] = { NULL };
+ static CBoat *apBoatList[4] = { nil };
if ( apGeomArray[0]
&& nGeomUsed < MAX_BOAT_WAKES
@@ -1292,16 +1300,16 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
RpGeometry *geom = apGeomArray[nGeomUsed++];
- ASSERT( wavyGeometry != NULL );
- ASSERT( geom != NULL );
+ ASSERT( wavyGeometry != nil );
+ ASSERT( geom != nil );
RpAtomic *atomic = RpAtomicCreate();
- ASSERT( atomic != NULL );
+ ASSERT( atomic != nil );
RpAtomicSetGeometry(atomic, geom, 0);
RwFrame *frame = RwFrameCreate();
- ASSERT( frame != NULL );
+ ASSERT( frame != nil );
RwMatrixCopy(RwFrameGetMatrix(frame), RwFrameGetMatrix(RpAtomicGetFrame(ms_pWavyAtomic)));
RpAtomicSetFrame(atomic, frame);
@@ -1312,11 +1320,11 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
RwV3d *geomVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(geom, 0));
RwV3d *wavyVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(wavyGeometry, 0));
- ASSERT( geomTexCoords != NULL );
- ASSERT( wavyTexCoord != NULL );
- ASSERT( geomPreLights != NULL );
- ASSERT( geomVertices != NULL );
- ASSERT( wavyVertices != NULL );
+ ASSERT( geomTexCoords != nil );
+ ASSERT( wavyTexCoord != nil );
+ ASSERT( geomPreLights != nil );
+ ASSERT( geomVertices != nil );
+ ASSERT( wavyVertices != nil );
RpGeometryLock(geom, rpGEOMETRYLOCKVERTICES | rpGEOMETRYLOCKPRELIGHT | rpGEOMETRYLOCKTEXCOORDS);
@@ -1333,7 +1341,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
for ( int32 k = 0; k < 4; k++ )
{
- if ( apBoatList[k] != NULL )
+ if ( apBoatList[k] != nil )
fDistMult += CBoat::IsVertexAffectedByWake(CVector(fVertexX, fVertexY, 0.0f), apBoatList[k]);
}
@@ -1382,7 +1390,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
pos.y = fY;
pos.z = fZ;
- ASSERT( ms_pWavyAtomic != NULL );
+ ASSERT( ms_pWavyAtomic != nil );
RwFrameTranslate(RpAtomicGetFrame(ms_pWavyAtomic), &pos, rwCOMBINEREPLACE);
@@ -1437,7 +1445,7 @@ CWaterLevel::RenderAndEmptyRenderBuffer()
{
LittleTest();
- if ( RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, NULL, rwIM3D_VERTEXUV) )
+ if ( RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, rwIM3D_VERTEXUV) )
{
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored);
RwIm3DEnd();
@@ -1455,29 +1463,29 @@ CWaterLevel::AllocateBoatWakeArray()
PUSH_MEMID(MEMID_STREAM);
- ASSERT(ms_pWavyAtomic != NULL );
+ ASSERT(ms_pWavyAtomic != nil );
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
- ASSERT(wavyGeometry != NULL );
+ ASSERT(wavyGeometry != nil );
RpMorphTarget *wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0);
RpMaterial *wavyMaterial = RpGeometryGetMaterial(wavyGeometry, 0);
- ASSERT(wavyMorphTarget != NULL );
- ASSERT(wavyMaterial != NULL );
+ ASSERT(wavyMorphTarget != nil );
+ ASSERT(wavyMaterial != nil );
for ( int32 geom = 0; geom < MAX_BOAT_WAKES; geom++ )
{
- if ( apGeomArray[geom] == NULL )
+ if ( apGeomArray[geom] == nil )
{
apGeomArray[geom] = RpGeometryCreate(9*9, 8*8*2, rpGEOMETRYTRISTRIP
| rpGEOMETRYPRELIT
| rpGEOMETRYMODULATEMATERIALCOLOR
| rpGEOMETRYTEXTURED);
- ASSERT(apGeomArray[geom] != NULL);
+ ASSERT(apGeomArray[geom] != nil);
RpTriangle *geomTriangles = RpGeometryGetTriangles(apGeomArray[geom]);
- ASSERT( geomTriangles != NULL );
+ ASSERT( geomTriangles != nil );
for ( int32 i = 0; i < 8; i++ )
{
@@ -1511,8 +1519,8 @@ CWaterLevel::AllocateBoatWakeArray()
RpMorphTarget *geomMorphTarget = RpGeometryGetMorphTarget(apGeomArray[geom], 0);
RwV3d *geomVertices = RpMorphTargetGetVertices(geomMorphTarget);
- ASSERT( geomMorphTarget != NULL );
- ASSERT( geomVertices != NULL );
+ ASSERT( geomMorphTarget != nil );
+ ASSERT( geomVertices != nil );
for ( int32 i = 0; i < 9; i++ )
{
@@ -1537,10 +1545,10 @@ CWaterLevel::FreeBoatWakeArray()
{
for ( int32 i = 0; i < MAX_BOAT_WAKES; i++ )
{
- if ( apGeomArray[i] != NULL )
+ if ( apGeomArray[i] != nil )
{
RpGeometryDestroy(apGeomArray[i]);
- apGeomArray[i] = NULL;
+ apGeomArray[i] = nil;
}
}
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index f16467b6..e765f306 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -359,7 +359,7 @@ void CWeather::AddRain()
RwCameraGetFarClipPlane(TheCamera.m_pRwCamera) / (RwCameraGetFarClipPlane(TheCamera.m_pRwCamera) * *(CVector2D*)RwCameraGetViewWindow(TheCamera.m_pRwCamera)).Magnitude();
splash_points[3] = 4.0f * CVector(RwCameraGetViewWindow(TheCamera.m_pRwCamera)->x, RwCameraGetViewWindow(TheCamera.m_pRwCamera)->y, 1.0f) *
RwCameraGetFarClipPlane(TheCamera.m_pRwCamera) / (RwCameraGetFarClipPlane(TheCamera.m_pRwCamera) * *(CVector2D*)RwCameraGetViewWindow(TheCamera.m_pRwCamera)).Magnitude();
- RwV3dTransformPoints((RwV3d*)splash_points, (RwV3d*)splash_points, 4, RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
+ RwV3dTransformPoints(splash_points, splash_points, 4, RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
CVector fp = (splash_points[0] + splash_points[1] + splash_points[2] + splash_points[3]) / 4;
for (int i = 0; i < num_splash_attempts; i++) {
CColPoint point;
diff --git a/src/rw/MemoryHeap.h b/src/rw/MemoryHeap.h
index 23163c1c..cd8cf22c 100644
--- a/src/rw/MemoryHeap.h
+++ b/src/rw/MemoryHeap.h
@@ -17,29 +17,6 @@
enum {
MEMID_FREE,
- // IDs from LCS:
-/*
- MEMID_GAME = 1, // "Game"
- MEMID_WORLD = 2, // "World"
- MEMID_ANIMATION = 3, // "Animation"
- MEMID_POOLS = 4, // "Pools"
- MEMID_DEF_MODELS = 5, // "Default Models"
- MEMID_STREAM = 6, // "Streaming"
- MEMID_STREAM_MODELS = 7, // "Streamed Models"
- MEMID_STREAM_LODS = 8, // "Streamed LODs"
- MEMID_STREAM_TEXUTRES = 9, // "Streamed Textures"
- MEMID_STREAM_COLLISION = 10, // "Streamed Collision"
- MEMID_STREAM_ANIMATION = 11, // "Streamed Animation"
- MEMID_TEXTURES = 12, // "Textures"
- MEMID_COLLISION = 13, // "Collision"
- MEMID_PRE_ALLOC = 14, // "PreAlloc"
- MEMID_GAME_PROCESS = 15, // "Game Process"
- MEMID_SCRIPT = 16, // "Script"
- MEMID_CARS = 17, // "Cars"
- MEMID_RENDER = 18, // "Render"
- MEMID_PED_ATTR = 19, // "Ped Attr"
-*/
- // III:
MEMID_GAME = 1, // "Game"
MEMID_WORLD = 2, // "World"
MEMID_ANIMATION = 3, // "Animation"
diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp
index 7403ae1d..d0addcca 100644
--- a/src/rw/TexRead.cpp
+++ b/src/rw/TexRead.cpp
@@ -297,6 +297,7 @@ ConvertingTexturesScreen(uint32 num, uint32 count, const char *text)
CFont::SetBackgroundOff();
CFont::SetPropOn();
CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.7f));
+ CFont::SetCentreOff();
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f));
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 217, 106, 255));
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index ec71f690..79d3f6af 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -768,7 +768,7 @@ CAutomobile::ProcessControl(void)
adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceB);
WheelState[CARWHEEL_FRONT_LEFT] = m_aWheelState[CARWHEEL_FRONT_LEFT];
- if(Damage.GetWheelStatus(VEHWHEEL_FRONT_LEFT) == WHEEL_STATUS_BURST)
+ if(Damage.GetWheelStatus(CARWHEEL_FRONT_LEFT) == WHEEL_STATUS_BURST)
ProcessWheel(wheelFwd, wheelRight,
contactSpeeds[CARWHEEL_FRONT_LEFT], contactPoints[CARWHEEL_FRONT_LEFT],
m_nWheelsOnGround, fThrust,
@@ -802,7 +802,7 @@ CAutomobile::ProcessControl(void)
adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceB);
WheelState[CARWHEEL_FRONT_RIGHT] = m_aWheelState[CARWHEEL_FRONT_RIGHT];
- if(Damage.GetWheelStatus(VEHWHEEL_FRONT_RIGHT) == WHEEL_STATUS_BURST)
+ if(Damage.GetWheelStatus(CARWHEEL_FRONT_RIGHT) == WHEEL_STATUS_BURST)
ProcessWheel(wheelFwd, wheelRight,
contactSpeeds[CARWHEEL_FRONT_RIGHT], contactPoints[CARWHEEL_FRONT_RIGHT],
m_nWheelsOnGround, fThrust,
@@ -883,7 +883,7 @@ CAutomobile::ProcessControl(void)
adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceB);
WheelState[CARWHEEL_REAR_LEFT] = m_aWheelState[CARWHEEL_REAR_LEFT];
- if(Damage.GetWheelStatus(VEHWHEEL_REAR_LEFT) == WHEEL_STATUS_BURST)
+ if(Damage.GetWheelStatus(CARWHEEL_REAR_LEFT) == WHEEL_STATUS_BURST)
ProcessWheel(wheelFwd, wheelRight,
contactSpeeds[CARWHEEL_REAR_LEFT], contactPoints[CARWHEEL_REAR_LEFT],
m_nWheelsOnGround, fThrust,
@@ -917,7 +917,7 @@ CAutomobile::ProcessControl(void)
adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceB);
WheelState[CARWHEEL_REAR_RIGHT] = m_aWheelState[CARWHEEL_REAR_RIGHT];
- if(Damage.GetWheelStatus(VEHWHEEL_REAR_RIGHT) == WHEEL_STATUS_BURST)
+ if(Damage.GetWheelStatus(CARWHEEL_REAR_RIGHT) == WHEEL_STATUS_BURST)
ProcessWheel(wheelFwd, wheelRight,
contactSpeeds[CARWHEEL_REAR_RIGHT], contactPoints[CARWHEEL_REAR_RIGHT],
m_nWheelsOnGround, fThrust,
@@ -3946,10 +3946,10 @@ void
CAutomobile::BurstTyre(uint8 wheel)
{
switch(wheel){
- case CAR_PIECE_WHEEL_LF: wheel = VEHWHEEL_FRONT_LEFT; break;
- case CAR_PIECE_WHEEL_LR: wheel = VEHWHEEL_REAR_LEFT; break;
- case CAR_PIECE_WHEEL_RF: wheel = VEHWHEEL_FRONT_RIGHT; break;
- case CAR_PIECE_WHEEL_RR: wheel = VEHWHEEL_REAR_RIGHT; break;
+ case CAR_PIECE_WHEEL_LF: wheel = CARWHEEL_FRONT_LEFT; break;
+ case CAR_PIECE_WHEEL_RF: wheel = CARWHEEL_FRONT_RIGHT; break;
+ case CAR_PIECE_WHEEL_LR: wheel = CARWHEEL_REAR_LEFT; break;
+ case CAR_PIECE_WHEEL_RR: wheel = CARWHEEL_REAR_RIGHT; break;
}
int status = Damage.GetWheelStatus(wheel);
diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h
index 604bed17..a5bee226 100644
--- a/src/vehicles/Automobile.h
+++ b/src/vehicles/Automobile.h
@@ -30,8 +30,6 @@ enum eCarNodes
NUM_CAR_NODES,
};
-// These are used for all the wheel arrays
-// DON'T confuse with VEHWHEEL, which are vehicle components
enum {
CARWHEEL_FRONT_LEFT,
CARWHEEL_REAR_LEFT,
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 9adcf148..ba9348f0 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -1171,7 +1171,10 @@ CVehicle::AddPassenger(CPed *passenger, uint8 n)
void
CVehicle::RemoveDriver(void)
{
- SetStatus(STATUS_ABANDONED);
+#ifdef FIX_BUGS
+ if (GetStatus() != STATUS_WRECKED)
+#endif
+ SetStatus(STATUS_ABANDONED);
pDriver = nil;
}
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index 3933f1dd..7066a0ea 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -57,14 +57,6 @@ enum eLights
VEHLIGHT_REAR_RIGHT,
};
-enum eWheels
-{
- VEHWHEEL_FRONT_LEFT,
- VEHWHEEL_FRONT_RIGHT,
- VEHWHEEL_REAR_LEFT,
- VEHWHEEL_REAR_RIGHT,
-};
-
enum
{
CAR_PIECE_BONNET = 1,
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index dc15485e..a987a4c7 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -385,7 +385,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
if ( victimPed->bUsesCollision || victimPed->Dead() || victimPed->Driving() )
{
CVector victimPedPos = victimPed->GetPosition();
- if ( SQR(victimPedRadius) > (victimPedPos-(*fireSource)).MagnitudeSqr() )
+ if ( SQR(victimPedRadius) > (victimPedPos-fireSource).MagnitudeSqr() )
{
CVector collisionDist;
@@ -393,7 +393,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
while ( s < victimPedCol->numSpheres )
{
CColSphere *sphere = &victimPedCol->spheres[s];
- collisionDist = victimPedPos+sphere->center-(*fireSource);
+ collisionDist = victimPedPos+sphere->center-fireSource;
if ( SQR(sphere->radius + info->m_fRadius) > collisionDist.MagnitudeSqr() )
{
diff --git a/vendor/librw b/vendor/librw
-Subproject 2066cf6634383e056cd5dda105e87f8da04b1ed
+Subproject ed9cb45ee9a2749a0a89231bf16f09a5c53bfc9