summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Game.cpp2
-rw-r--r--src/core/Pad.cpp114
-rw-r--r--src/core/Pad.h14
-rw-r--r--src/core/PlayerSkin.cpp2
-rw-r--r--src/core/Radar.cpp271
-rw-r--r--src/core/Radar.h13
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp53
8 files changed, 292 insertions, 178 deletions
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 9637dc6c..daac3ec5 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -607,7 +607,7 @@ extern void (*DebugMenuProcess)(void);
void CGame::Process(void)
{
CPad::UpdatePads();
-#ifdef PS2
+#ifdef GTA_PS2
ProcessTidyUpMemory();
#endif
TheCamera.SetMotionBlurAlpha(0);
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 2d2b132c..08367b40 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -138,6 +138,7 @@ void CKeyboardState::Clear()
LWIN = RWIN = APPS = 0;
}
+#ifdef GTA_PS2_STUFF
void CPad::Initialise(void)
{
for (int i = 0; i < MAX_PADS; i++)
@@ -150,6 +151,7 @@ void CPad::Initialise(void)
bOldDisplayNoControllerMessage = false;
bDisplayNoControllerMessage = false;
}
+#endif
void CPad::Clear(bool bResetPlayerControls)
{
@@ -178,13 +180,13 @@ void CPad::Clear(bool bResetPlayerControls)
bApplyBrakes = false;
- for ( int32 i = 0; i < _TODOCONST(5); i++ )
+ for ( int32 i = 0; i < HORNHISTORY_SIZE; i++ )
bHornHistory[i] = false;
iCurrHornHistory = 0;
- for ( int32 i = 0; i < _TODOCONST(12); i++ )
- _unk[i] = ' ';
+ for ( int32 i = 0; i < ARRAY_SIZE(CheatString); i++ )
+ CheatString[i] = ' ';
LastTimeTouched = CTimer::GetTimeInMilliseconds();
AverageWeapon = 0;
@@ -443,6 +445,108 @@ void CPad::StartShake_Train(float fX, float fY)
}
}
+#ifdef GTA_PS2_STUFF
+void CPad::AddToCheatString(char c)
+{
+ for ( int32 i = ARRAY_SIZE(CheatString) - 2; i >= 0; i-- )
+ CheatString[i + 1] = CheatString[i];
+
+#define _CHEATCMP(str) strncmp(str, CheatString, sizeof(str)-1)
+ // "4414LDRULDRU" - R2 R2 L1 R2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
+ if ( !_CHEATCMP("URDLURDL4144") )
+ WeaponCheat();
+
+ // "4411LDRULDRU" - R2 R2 L1 L1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
+ else if ( !_CHEATCMP("URDLURDL1144") )
+ MoneyCheat();
+
+ // "4412LDRULDRU" - R2 R2 L1 L2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
+ else if ( !_CHEATCMP("URDLURDL2144") )
+ ArmourCheat();
+
+ // "4413LDRULDRU" - R2 R2 L1 R1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
+ else if ( !_CHEATCMP("URDLURDL3144") )
+ HealthCheat();
+
+ // "4414LRLRLR" - R2 R2 L1 R2 LEFT RIGHT LEFT RIGHT LEFT RIGHT
+ else if ( !_CHEATCMP("RLRLRL4144") )
+ WantedLevelUpCheat();
+
+ // "4414UDUDUD" - R2 R2 L1 R2 UP DOWN UP DOWN UP DOWN
+ else if ( !_CHEATCMP("DUDUDU4144") )
+ WantedLevelDownCheat();
+
+ // "1234432T" - L1 L2 R1 R2 R2 R1 L2 TRIANGLE
+ else if ( !_CHEATCMP("T2344321") )
+ SunnyWeatherCheat();
+
+ // "1234432S" - L1 L2 R1 R2 R2 R1 L2 SQUARE
+ else if ( !_CHEATCMP("S2344321") )
+ CloudyWeatherCheat();
+
+ // "1234432C" - L1 L2 R1 R2 R2 R1 L2 CIRCLE
+ else if ( !_CHEATCMP("C2344321") )
+ RainyWeatherCheat();
+
+ // "1234432X" - L1 L2 R1 R2 R2 R1 L2 CROSS
+ else if ( !_CHEATCMP("X2344321") )
+ FoggyWeatherCheat();
+
+ // "CCCCCC321TCT" - CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE R1 L2 L1 TRIANGLE CIRCLE TRIANGLE
+ else if ( !_CHEATCMP("TCT123CCCCCC") )
+ TankCheat();
+
+ // "CCCSSSSS1TCT" - CIRCLE CIRCLE CIRCLE SQUARE SQUARE SQUARE SQUARE SQUARE L1 TRIANGLE CIRCLE TRIANGLE
+ else if ( !_CHEATCMP("TCT1SSSSSCCC") )
+ FastWeatherCheat();
+
+ // "241324TSCT21" - L2 R2 L1 R1 L2 R2 TRIANGLE SQUARE CIRCLE TRIANGLE L2 L1
+ else if ( !_CHEATCMP("12TCST423142") )
+ BlowUpCarsCheat();
+
+ // "RDLU12ULDR" - RIGHT DOWN LEFT UP L1 L2 UP LEFT DOWN RIGHT
+ else if ( !_CHEATCMP("RDLU21ULDR") )
+ ChangePlayerCheat();
+
+ // "DULUX3421" - DOWN UP LEFT UP CROSS R1 R2 L2 L1
+ else if ( !_CHEATCMP("1243XULUD") )
+ MayhemCheat();
+
+ // "DULUX3412" - DOWN UP LEFT UP CROSS R1 R2 L1 L2
+ else if ( !_CHEATCMP("2143XULUD") )
+ EverybodyAttacksPlayerCheat();
+
+ // "43TX21UD" - R2 R1 TRIANGLE CROSS L2 L1 UP DOWN
+ else if ( !_CHEATCMP("DU12XT34") )
+ WeaponsForAllCheat();
+
+ // "TURDS12" - TRIANGLE UP RIGHT DOWN SQUARE L1 L2
+ else if ( !_CHEATCMP("21SDRUT") )
+ FastTimeCheat();
+
+ // "TURDS34" - TRIANGLE UP RIGHT DOWN SQUARE R1 R2
+ else if ( !_CHEATCMP("43SDRUT") )
+ SlowTimeCheat();
+
+ // "11S4T1T" - L1 L1 SQUARE R2 TRIANGLE L1 TRIANGLE
+ else if ( !_CHEATCMP("T1T4S11") )
+ OnlyRenderWheelsCheat();
+
+ // "R4C32D13" - RIGHT R2 CIRCLE R1 L2 DOWN L1 R1
+ else if ( !_CHEATCMP("31D23C4R") )
+ ChittyChittyBangBangCheat();
+
+ // "3141L33T" - R1 L1 R2 L1 LEFT R1 R1 TRIANGLE
+ else if ( !_CHEATCMP("T33L1413") )
+ StrongGripCheat();
+
+ // "S1CD13TR1X" - SQUARE L1 CIRCLE DOWN L1 R1 TRIANGLE RIGHT L1 CROSS
+ else if ( !_CHEATCMP("X1RT31DC1S") )
+ NastyLimbsCheat();
+#undef _CHEATCMP
+}
+#endif
+
void CPad::AddToPCCheatString(char c)
{
for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- )
@@ -680,7 +784,7 @@ void CPad::Update(int16 unk)
ProcessPCSpecificStuff();
- if ( ++iCurrHornHistory >= _TODOCONST(5) )
+ if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
iCurrHornHistory = 0;
bHornHistory[iCurrHornHistory] = GetHorn();
@@ -697,7 +801,7 @@ void CPad::DoCheats(void)
void CPad::DoCheats(int16 unk)
{
-#ifdef PS2
+#ifdef GTA_PS2_STUFF
if ( GetTriangleJustDown() )
AddToCheatString('T');
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 00dd5540..78bfac1d 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -136,6 +136,10 @@ enum
class CPad
{
public:
+ enum
+ {
+ HORNHISTORY_SIZE = 5,
+ };
CControllerState NewState;
CControllerState OldState;
CControllerState PCTempKeyState;
@@ -146,11 +150,11 @@ public:
int16 Mode;
int16 ShakeDur;
uint8 ShakeFreq;
- bool bHornHistory[5];
+ bool bHornHistory[HORNHISTORY_SIZE];
uint8 iCurrHornHistory;
uint8 DisablePlayerControls;
int8 bApplyBrakes;
- char _unk[12]; //int32 unk[3];
+ char CheatString[12];
char _pad0[3];
int32 LastTimeTouched;
int32 AverageWeapon;
@@ -173,8 +177,9 @@ public:
static CMouseControllerState &PCTempMouseControllerState;
-
+#ifdef GTA_PS2_STUFF
static void Initialise(void);
+#endif
void Clear(bool bResetPlayerControls);
void ClearMouseHistory();
void UpdateMouse();
@@ -182,6 +187,9 @@ public:
void StartShake(int16 nDur, uint8 nFreq);
void StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fz);
void StartShake_Train(float fX, float fY);
+#ifdef GTA_PS2_STUFF
+ void AddToCheatString(char c);
+#endif
void AddToPCCheatString(char c);
static void UpdatePads(void);
diff --git a/src/core/PlayerSkin.cpp b/src/core/PlayerSkin.cpp
index bf780666..28879918 100644
--- a/src/core/PlayerSkin.cpp
+++ b/src/core/PlayerSkin.cpp
@@ -106,7 +106,9 @@ CPlayerSkin::GetSkinTexture(const char *texName)
tex = RwTextureCreate(raster);
RwTextureSetName(tex, texName);
+#ifdef FIX_BUGS
RwTextureSetFilterMode(tex, rwFILTERLINEAR); // filtering bugfix from VC
+#endif
RwTexDictionaryAddTexture(CTxdStore::GetSlot(m_txdSlot)->texDict, tex);
RwImageDestroy(image);
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 07ddb5d8..bcc11c1b 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -17,7 +17,7 @@
#include "SpecialFX.h"
float &CRadar::m_radarRange = *(float*)0x8E281C;
-CBlip (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(CBlip(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0;
+sRadarTrace (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(sRadarTrace(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0;
CVector2D &vec2DRadarOrigin = *(CVector2D*)0x6299B8;
int32 gRadarTxdIds[64];// = (int*)0x6299C0;
@@ -87,6 +87,134 @@ int CRadar::TargetMarkerId = -1;
float CRadar::cachedCos;
float CRadar::cachedSin;
+void ClipRadarTileCoords(int32 &x, int32 &y)
+{
+ if (x < 0)
+ x = 0;
+ if (x > RADAR_NUM_TILES-1)
+ x = RADAR_NUM_TILES-1;
+ if (y < 0)
+ y = 0;
+ if (y > RADAR_NUM_TILES-1)
+ y = RADAR_NUM_TILES-1;
+}
+
+void RequestMapSection(int32 x, int32 y)
+{
+ ClipRadarTileCoords(x, y);
+ CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
+}
+
+void RemoveMapSection(int32 x, int32 y)
+{
+ if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
+ CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
+}
+
+// Transform from section indices to world coordinates
+void GetTextureCorners(int32 x, int32 y, CVector2D *out)
+{
+ x = x - RADAR_NUM_TILES/2;
+ y = -(y - RADAR_NUM_TILES/2);
+
+ // bottom left
+ out[0].x = RADAR_TILE_SIZE * (x);
+ out[0].y = RADAR_TILE_SIZE * (y - 1);
+
+ // bottom right
+ out[1].x = RADAR_TILE_SIZE * (x + 1);
+ out[1].y = RADAR_TILE_SIZE * (y - 1);
+
+ // top right
+ out[2].x = RADAR_TILE_SIZE * (x + 1);
+ out[2].y = RADAR_TILE_SIZE * (y);
+
+ // top left
+ out[3].x = RADAR_TILE_SIZE * (x);
+ out[3].y = RADAR_TILE_SIZE * (y);
+}
+
+
+bool IsPointInsideRadar(const CVector2D &point)
+{
+ if (point.x < -1.0f || point.x > 1.0f) return false;
+ if (point.y < -1.0f || point.y > 1.0f) return false;
+ return true;
+}
+
+// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
+int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
+{
+ float d1, d2;
+ float t;
+ float x, y;
+ float shortest = 1.0f;
+ int edge = -1;
+
+ // clip against left edge, x = -1.0
+ d1 = -1.0f - p1.x;
+ d2 = -1.0f - p2.x;
+ if (d1 * d2 < 0.0f) {
+ // they are on opposite sides, get point of intersection
+ t = d1 / (d1 - d2);
+ y = (p2.y - p1.y)*t + p1.y;
+ if (y >= -1.0f && y <= 1.0f && t <= shortest) {
+ out.x = -1.0f;
+ out.y = y;
+ edge = 3;
+ shortest = t;
+ }
+ }
+
+ // clip against right edge, x = 1.0
+ d1 = p1.x - 1.0f;
+ d2 = p2.x - 1.0f;
+ if (d1 * d2 < 0.0f) {
+ // they are on opposite sides, get point of intersection
+ t = d1 / (d1 - d2);
+ y = (p2.y - p1.y)*t + p1.y;
+ if (y >= -1.0f && y <= 1.0f && t <= shortest) {
+ out.x = 1.0f;
+ out.y = y;
+ edge = 1;
+ shortest = t;
+ }
+ }
+
+ // clip against top edge, y = -1.0
+ d1 = -1.0f - p1.y;
+ d2 = -1.0f - p2.y;
+ if (d1 * d2 < 0.0f) {
+ // they are on opposite sides, get point of intersection
+ t = d1 / (d1 - d2);
+ x = (p2.x - p1.x)*t + p1.x;
+ if (x >= -1.0f && x <= 1.0f && t <= shortest) {
+ out.y = -1.0f;
+ out.x = x;
+ edge = 0;
+ shortest = t;
+ }
+ }
+
+ // clip against bottom edge, y = 1.0
+ d1 = p1.y - 1.0f;
+ d2 = p2.y - 1.0f;
+ if (d1 * d2 < 0.0f) {
+ // they are on opposite sides, get point of intersection
+ t = d1 / (d1 - d2);
+ x = (p2.x - p1.x)*t + p1.x;
+ if (x >= -1.0f && x <= 1.0f && t <= shortest) {
+ out.y = 1.0f;
+ out.x = x;
+ edge = 2;
+ shortest = t;
+ }
+ }
+
+ return edge;
+}
+
+
uint8 CRadar::CalculateBlipAlpha(float dist)
{
#ifdef MENU_MAP
@@ -892,7 +1020,7 @@ INITSAVEBUF
CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE);
for (int i = 0; i < NUMRADARBLIPS; i++)
- ms_RadarTrace[i] = ReadSaveBuf<CBlip>(buf);
+ ms_RadarTrace[i] = ReadSaveBuf<sRadarTrace>(buf);
VALIDATESAVEBUF(size);
}
@@ -925,12 +1053,6 @@ CRadar::LoadTextures()
CTxdStore::PopCurrentTxd();
}
-void RemoveMapSection(int32 x, int32 y)
-{
- if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
- CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
-}
-
void CRadar::RemoveRadarSections()
{
for (int i = 0; i < 8; i++)
@@ -938,12 +1060,6 @@ void CRadar::RemoveRadarSections()
RemoveMapSection(i, j);
}
-void CRadar::RequestMapSection(int32 x, int32 y)
-{
- ClipRadarTileCoords(x, y);
- CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
-}
-
void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
{
*size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace);
@@ -1242,121 +1358,6 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
out.y = c * y - s * x;
}
-// Transform from section indices to world coordinates
-void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out)
-{
- x = x - RADAR_NUM_TILES/2;
- y = -(y - RADAR_NUM_TILES/2);
-
- // bottom left
- out[0].x = RADAR_TILE_SIZE * (x);
- out[0].y = RADAR_TILE_SIZE * (y - 1);
-
- // bottom right
- out[1].x = RADAR_TILE_SIZE * (x + 1);
- out[1].y = RADAR_TILE_SIZE * (y - 1);
-
- // top right
- out[2].x = RADAR_TILE_SIZE * (x + 1);
- out[2].y = RADAR_TILE_SIZE * (y);
-
- // top left
- out[3].x = RADAR_TILE_SIZE * (x);
- out[3].y = RADAR_TILE_SIZE * (y);
-}
-
-void CRadar::ClipRadarTileCoords(int32 &x, int32 &y)
-{
- if (x < 0)
- x = 0;
- if (x > RADAR_NUM_TILES-1)
- x = RADAR_NUM_TILES-1;
- if (y < 0)
- y = 0;
- if (y > RADAR_NUM_TILES-1)
- y = RADAR_NUM_TILES-1;
-}
-
-
-bool CRadar::IsPointInsideRadar(const CVector2D &point)
-{
- if (point.x < -1.0f || point.x > 1.0f) return false;
- if (point.y < -1.0f || point.y > 1.0f) return false;
- return true;
-}
-
-// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
-int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
-{
- float d1, d2;
- float t;
- float x, y;
- float shortest = 1.0f;
- int edge = -1;
-
- // clip against left edge, x = -1.0
- d1 = -1.0f - p1.x;
- d2 = -1.0f - p2.x;
- if (d1 * d2 < 0.0f) {
- // they are on opposite sides, get point of intersection
- t = d1 / (d1 - d2);
- y = (p2.y - p1.y)*t + p1.y;
- if (y >= -1.0f && y <= 1.0f && t <= shortest) {
- out.x = -1.0f;
- out.y = y;
- edge = 3;
- shortest = t;
- }
- }
-
- // clip against right edge, x = 1.0
- d1 = p1.x - 1.0f;
- d2 = p2.x - 1.0f;
- if (d1 * d2 < 0.0f) {
- // they are on opposite sides, get point of intersection
- t = d1 / (d1 - d2);
- y = (p2.y - p1.y)*t + p1.y;
- if (y >= -1.0f && y <= 1.0f && t <= shortest) {
- out.x = 1.0f;
- out.y = y;
- edge = 1;
- shortest = t;
- }
- }
-
- // clip against top edge, y = -1.0
- d1 = -1.0f - p1.y;
- d2 = -1.0f - p2.y;
- if (d1 * d2 < 0.0f) {
- // they are on opposite sides, get point of intersection
- t = d1 / (d1 - d2);
- x = (p2.x - p1.x)*t + p1.x;
- if (x >= -1.0f && x <= 1.0f && t <= shortest) {
- out.y = -1.0f;
- out.x = x;
- edge = 0;
- shortest = t;
- }
- }
-
- // clip against bottom edge, y = 1.0
- d1 = p1.y - 1.0f;
- d2 = p2.y - 1.0f;
- if (d1 * d2 < 0.0f) {
- // they are on opposite sides, get point of intersection
- t = d1 / (d1 - d2);
- x = (p2.x - p1.x)*t + p1.x;
- if (x >= -1.0f && x <= 1.0f && t <= shortest) {
- out.y = 1.0f;
- out.x = x;
- edge = 2;
- shortest = t;
- }
- }
-
- return edge;
-}
-
void
CRadar::CalculateCachedSinCos()
{
@@ -1488,8 +1489,14 @@ STARTPATCHES
InjectHook(0x4A5C60, CRadar::SetRadarMarkerState, PATCH_JUMP);
InjectHook(0x4A5D10, CRadar::DrawRotatingRadarSprite, PATCH_JUMP);
InjectHook(0x4A5EF0, CRadar::DrawRadarSprite, PATCH_JUMP);
+ InjectHook(0x4A6020, ClipRadarTileCoords, PATCH_JUMP);
+ InjectHook(0x4A6060, RequestMapSection, PATCH_JUMP);
+ InjectHook(0x4A60A0, RemoveMapSection, PATCH_JUMP);
InjectHook(0x4A60E0, CRadar::RemoveRadarSections, PATCH_JUMP);
InjectHook(0x4A6100, (void (*)(int32, int32))&CRadar::StreamRadarSections, PATCH_JUMP);
+ InjectHook(0x4A6160, IsPointInsideRadar, PATCH_JUMP);
+ InjectHook(0x4A61C0, GetTextureCorners, PATCH_JUMP);
+ InjectHook(0x4A6250, LineRadarBoxCollision, PATCH_JUMP);
InjectHook(0x4A64A0, CRadar::ClipRadarPoly, PATCH_JUMP);
InjectHook(0x4A67E0, CRadar::DrawRadarSection, PATCH_JUMP);
InjectHook(0x4A69C0, CRadar::DrawRadarMask, PATCH_JUMP);
@@ -1497,8 +1504,6 @@ STARTPATCHES
InjectHook(0x4A6C20, CRadar::DrawRadarMap, PATCH_JUMP);
InjectHook(0x4A6E30, CRadar::SaveAllRadarBlips, PATCH_JUMP);
InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP);
-
- InjectHook(0x4A61C0, CRadar::GetTextureCorners, PATCH_JUMP);
- InjectHook(0x4A6160, CRadar::IsPointInsideRadar, PATCH_JUMP);
- InjectHook(0x4A6250, CRadar::LineRadarBoxCollision, PATCH_JUMP);
+ //InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP);
+ //InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP);
ENDPATCHES
diff --git a/src/core/Radar.h b/src/core/Radar.h
index 6d5bb196..27f3a6f0 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -56,7 +56,7 @@ enum
BLIP_MODE_SQUARE,
};
-struct CBlip
+struct sRadarTrace
{
uint32 m_nColor;
uint32 m_eBlipType; // eBlipType
@@ -71,7 +71,7 @@ struct CBlip
uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite
};
-static_assert(sizeof(CBlip) == 0x30, "CBlip: error");
+static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error");
// Values for screen space
#define RADAR_LEFT (40.0f)
@@ -83,7 +83,7 @@ class CRadar
{
public:
static float &m_radarRange;
- static CBlip (&ms_RadarTrace)[NUMRADARBLIPS];
+ static sRadarTrace (&ms_RadarTrace)[NUMRADARBLIPS];
static CSprite2d AsukaSprite;
static CSprite2d BombSprite;
static CSprite2d CatSprite;
@@ -144,7 +144,6 @@ public:
static void LoadAllRadarBlips(uint8 *buf, uint32 size);
static void LoadTextures();
static void RemoveRadarSections();
- static void RequestMapSection(int32 x, int32 y);
static void SaveAllRadarBlips(uint8*, uint32*);
static void SetBlipSprite(int32 i, int32 icon);
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
@@ -161,10 +160,6 @@ public:
static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in);
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
- // no in CRadar in the game:
- static void GetTextureCorners(int32 x, int32 y, CVector2D *out);
- static void ClipRadarTileCoords(int32 &x, int32 &y);
- static bool IsPointInsideRadar(const CVector2D &);
- static int LineRadarBoxCollision(CVector2D &, const CVector2D &, const CVector2D &);
+ // no in CRadar in the game:
static void CalculateCachedSinCos();
};
diff --git a/src/core/config.h b/src/core/config.h
index f653f724..a2b6eb7d 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -150,6 +150,7 @@ enum Config {
//#define MASTER
#if defined GTA_PS2
+# define GTA_PS2_STUFF
# define RANDOMSPLASH
#elif defined GTA_PC
# define GTA3_1_1_PATCH
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 867867a9..93e4c71c 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -455,8 +455,10 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
splash = LoadSplash(splashscreen);
+#ifndef GTA_PS2
if(RsGlobal.quit)
return;
+#endif
if(DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255)){
CSprite2d::SetRecipNearClip();
@@ -1226,7 +1228,7 @@ AppEventHandler(RsEvent event, void *param)
void
TheModelViewer(void)
{
-#if (defined(PS2) || defined(XBOX))
+#if (defined(GTA_PS2) || defined(GTA_XBOX))
//TODO
#else
#ifdef ASPECT_RATIO_SCALE
@@ -1255,13 +1257,13 @@ void TheGame(void)
{
printf("Into TheGame!!!\n");
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PushMemId(_TODOCONST(1));
#endif
CTimer::Initialise();
-#ifdef PS2
+#ifdef GTA_PS2
CGame::Initialise();
#else
CGame::Initialise("DATA\\GTA3.DAT");
@@ -1271,10 +1273,8 @@ void TheGame(void)
LoadingScreen("Starting Game", NULL, splash);
-#ifdef PS2
- int32 state = TheMemoryCard.CheckCardInserted(_TODOCONST(0));
-
- if (state == _TODOCONST(26)
+#ifdef GTA_PS2
+ if ( TheMemoryCard.CheckCardInserted(_TODOCONST(0)) == _TODOCONST(26)
&& TheMemoryCard.ChangeDirectory(_TODOCONST(0), TheMemoryCard.field154)
&& TheMemoryCard.FindMostRecentFileName(_TODOCONST(0), TheMemoryCard.field37) == 1
&& TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.field37))
@@ -1324,12 +1324,12 @@ void TheGame(void)
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PushMemId(_TODOCONST(12));
#endif
CPointLights::NumLights = 0;
CGame::Process();
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PopMemId();
#endif
@@ -1354,18 +1354,18 @@ void TheGame(void)
break;
SetLightsWithTimeOfDayColour(Scene.world);
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PushMemId(_TODOCONST(15));
#endif
if (!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu == true && TheCamera.GetScreenFadeStatus() != FADE_2 )
{
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PushMemId(_TODOCONST(11));
#endif
CRenderer::ConstructRenderList();
CRenderer::PreRender();
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PopMemId();
#endif
@@ -1405,7 +1405,7 @@ void TheGame(void)
if (FrontEndMenuManager.m_bWantToLoad)
#endif
{
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PopMemId();
#endif
break;
@@ -1424,7 +1424,7 @@ void TheGame(void)
CTimer::Update();
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PopMemId();
#endif
@@ -1478,11 +1478,11 @@ void SystemInit()
mwInit();
#endif
-#ifdef PS2
+#ifdef GTA_PS2
InitMemoryMgr();
#endif
-#ifdef PS2
+#ifdef GTA_PS2
CFileMgr::InitCdSystem();
char path[256];
@@ -1505,10 +1505,9 @@ void SystemInit()
CFileMgr::Initialise();
-#ifdef PS2
+#ifdef GTA_PS2
CFileMgr::InitCd();
-
Char modulepath[256];
strcpy(modulepath, "cdrom0:\\");
@@ -1543,7 +1542,7 @@ void SystemInit()
#endif
-#ifdef PS2
+#ifdef GTA_PS2
ThreadParam param;
param.entry = &IdleThread;
@@ -1567,7 +1566,7 @@ void SystemInit()
CGame::nastyGame = true;
CMenuManager::m_PrefsAllowNastyGame = true;
-#ifdef PS2
+#ifdef GTA_PS2
int32 lang = sceScfGetLanguage();
if ( lang == SCE_ITALIAN_LANGUAGE )
CMenuManager::m_PrefsLanguage = LANGUAGE_ITALIAN;
@@ -1604,7 +1603,7 @@ void GameInit()
{
if ( !gameAlreadyInitialised )
{
-#ifdef PS2
+#ifdef GTA_PS2
char path[256];
strcpy(path, "cdrom0:\\");
@@ -1630,7 +1629,7 @@ void GameInit()
//TODO
#endif
-#ifdef PS2
+#ifdef GTA_PS2
char *files[] =
{
"\\ANIM\\CUTS.IMG;1",
@@ -1730,7 +1729,7 @@ void GameInit()
CreateDebugFont();
-#ifdef PS2
+#ifdef GTA_PS2
AddIntcHandler(_TODOCONST(2), VBlankCounter, 0);
#endif
@@ -1738,18 +1737,18 @@ void GameInit()
CSprite2d::SetRecipNearClip();
CTxdStore::Initialise();
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PushMemId(_TODOCONST(9));
#endif
CFont::Initialise();
CHud::Initialise();
-#ifdef PS2
+#ifdef GTA_PS2
gMainHeap.PopMemId();
#endif
ValidateVersion();
-#ifdef PS2
+#ifdef GTA_PS2
sceCdCLOCK rtc;
sceCdReadClock(&rtc);
uint32 seed = rtc.minute + rtc.day;
@@ -1789,7 +1788,7 @@ main(int argc, char *argv[])
}
#endif
-#ifdef PS2
+#ifdef GTA_PS2
{
if (gameAlreadyInitialised)
RpSkySuspend();