summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-11-09 14:44:36 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2019-11-09 14:44:36 +0100
commit5ef291ddf27aed2c27b39c3c30a9d5d27f7548b9 (patch)
tree710f5904ec705a30d64a568ce5f3ede0e2d91690 /src/core
parentscript stubs (diff)
parentFix link to config.h in readme (diff)
downloadre3-5ef291ddf27aed2c27b39c3c30a9d5d27f7548b9.tar
re3-5ef291ddf27aed2c27b39c3c30a9d5d27f7548b9.tar.gz
re3-5ef291ddf27aed2c27b39c3c30a9d5d27f7548b9.tar.bz2
re3-5ef291ddf27aed2c27b39c3c30a9d5d27f7548b9.tar.lz
re3-5ef291ddf27aed2c27b39c3c30a9d5d27f7548b9.tar.xz
re3-5ef291ddf27aed2c27b39c3c30a9d5d27f7548b9.tar.zst
re3-5ef291ddf27aed2c27b39c3c30a9d5d27f7548b9.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ControllerConfig.cpp162
-rw-r--r--src/core/ControllerConfig.h2
-rw-r--r--src/core/CutsceneMgr.cpp2
-rw-r--r--src/core/Frontend.cpp6
-rw-r--r--src/core/PCSave.h2
-rw-r--r--src/core/Pad.cpp4
-rw-r--r--src/core/Pad.h6
-rw-r--r--src/core/Radar.cpp103
-rw-r--r--src/core/Radar.h4
-rw-r--r--src/core/common.h2
-rw-r--r--src/core/config.h13
-rw-r--r--src/core/re3.cpp1
12 files changed, 163 insertions, 144 deletions
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index d32b8283..f0492b0f 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -16,6 +16,7 @@
#include "ModelIndices.h"
#include "Camera.h"
#include "win.h"
+#include "PCSave.h"
CControllerConfigManager &ControlsManager = *(CControllerConfigManager*)0x8F43A4;
@@ -75,7 +76,7 @@ void CControllerConfigManager::LoadSettings(int32 file)
char buff[29];
CFileMgr::Read(file, buff, sizeof(buff));
- if (!strcmp(buff, "THIS FILE IS NOT VALID YET"))
+ if (!strncmp(buff, TopLineEmptyFile, sizeof(TopLineEmptyFile)-1))
bValid = false;
else
CFileMgr::Seek(file, 0, 0);
@@ -109,7 +110,7 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, rsRSHIFT, KEYBOARD);
}
else
- SetControllerKeyAssociatedWithAction(VEHICLE_HORN, rsSHIFT, OPTIONAL_EXTRA);
+ SetControllerKeyAssociatedWithAction(VEHICLE_HORN, rsSHIFT, OPTIONAL_EXTRA); // BUG: must be KEYBOARD ?
SetControllerKeyAssociatedWithAction (VEHICLE_HANDBRAKE, rsRCTRL, KEYBOARD);
SetControllerKeyAssociatedWithAction (VEHICLE_HANDBRAKE, ' ', OPTIONAL_EXTRA);
@@ -162,11 +163,11 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
#ifndef FIX_BUGS
SetControllerKeyAssociatedWithAction(PED_SPRINT, rsRSHIFT, OPTIONAL_EXTRA); // BUG: must be KEYBOARD
#else
- SetControllerKeyAssociatedWithAction(PED_SPRINT, rsRSHIFT, KEYBOARD); // BUG: must be KEYBOARD ?
+ SetControllerKeyAssociatedWithAction(PED_SPRINT, rsRSHIFT, KEYBOARD);
#endif
}
else
- SetControllerKeyAssociatedWithAction(PED_SPRINT, rsSHIFT, OPTIONAL_EXTRA);
+ SetControllerKeyAssociatedWithAction(PED_SPRINT, rsSHIFT, OPTIONAL_EXTRA); // BUG: must be KEYBOARD ?
SetControllerKeyAssociatedWithAction (PED_CYCLE_TARGET_LEFT, '[', KEYBOARD);
@@ -351,115 +352,48 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
void CControllerConfigManager::InitialiseControllerActionNameArray()
{
- wchar buff[40+2];
-
- AsciiToUnicode("PED_LOOKBEHIND", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_LOOKBEHIND], buff, sizeof(m_aActionNames[PED_LOOKBEHIND]));
-
- AsciiToUnicode("PED_CYCLE_WEAPON_LEFT", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_CYCLE_WEAPON_LEFT], buff, sizeof(m_aActionNames[PED_CYCLE_WEAPON_LEFT]));
-
- AsciiToUnicode("PED_CYCLE_WEAPON_RIGHT", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_CYCLE_WEAPON_RIGHT], buff, sizeof(m_aActionNames[PED_CYCLE_WEAPON_RIGHT]));
-
- AsciiToUnicode("PED_LOCK_TARGET", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_LOCK_TARGET], buff, sizeof(m_aActionNames[PED_LOCK_TARGET]));
-
- AsciiToUnicode("PED_JUMPING", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_JUMPING], buff, sizeof(m_aActionNames[PED_JUMPING]));
-
- AsciiToUnicode("PED_SPRINT", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_SPRINT], buff, sizeof(m_aActionNames[PED_SPRINT]));
-
- AsciiToUnicode("PED_CYCLE_TARGET_LEFT", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_CYCLE_TARGET_LEFT], buff, sizeof(m_aActionNames[PED_CYCLE_TARGET_LEFT]));
-
- AsciiToUnicode("PED_CYCLE_TARGET_RIGHT", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_CYCLE_TARGET_RIGHT], buff, sizeof(m_aActionNames[PED_CYCLE_TARGET_RIGHT]));
-
- AsciiToUnicode("PED_CENTER_CAMERA_BEHIND_PLAYER", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_CENTER_CAMERA_BEHIND_PLAYER], buff, sizeof(m_aActionNames[PED_CENTER_CAMERA_BEHIND_PLAYER]));
-
- AsciiToUnicode("VEHICLE_LOOKBEHIND", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_LOOKBEHIND], buff, sizeof(m_aActionNames[VEHICLE_LOOKBEHIND]));
-
- AsciiToUnicode("VEHICLE_LOOKLEFT", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_LOOKLEFT], buff, sizeof(m_aActionNames[VEHICLE_LOOKLEFT]));
-
- AsciiToUnicode("VEHICLE_LOOKRIGHT", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_LOOKRIGHT], buff, sizeof(m_aActionNames[VEHICLE_LOOKRIGHT]));
-
- AsciiToUnicode("VEHICLE_HORN", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_HORN], buff, sizeof(m_aActionNames[VEHICLE_HORN]));
-
- AsciiToUnicode("VEHICLE_HANDBRAKE", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_HANDBRAKE], buff, sizeof(m_aActionNames[VEHICLE_HANDBRAKE]));
-
- AsciiToUnicode("VEHICLE_ACCELERATE", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_ACCELERATE], buff, sizeof(m_aActionNames[VEHICLE_ACCELERATE]));
-
- AsciiToUnicode("VEHICLE_BRAKE", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_BRAKE], buff, sizeof(m_aActionNames[VEHICLE_BRAKE]));
-
- AsciiToUnicode("VEHICLE_CHANGE_RADIO_STATION", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_CHANGE_RADIO_STATION], buff, sizeof(m_aActionNames[VEHICLE_CHANGE_RADIO_STATION]));
-
- AsciiToUnicode("TOGGLE_SUBMISSIONS", buff);
- CMessages::WideStringCopy(m_aActionNames[TOGGLE_SUBMISSIONS], buff, sizeof(m_aActionNames[TOGGLE_SUBMISSIONS]));
-
- AsciiToUnicode("PED_SNIPER_ZOOM_IN", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_SNIPER_ZOOM_IN], buff, sizeof(m_aActionNames[PED_SNIPER_ZOOM_IN]));
-
- AsciiToUnicode("PED_SNIPER_ZOOM_OUT", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_SNIPER_ZOOM_OUT], buff, sizeof(m_aActionNames[PED_SNIPER_ZOOM_OUT]));
-
- AsciiToUnicode("PED_1RST_PERSON_LOOK_LEFT", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_1RST_PERSON_LOOK_LEFT], buff, sizeof(m_aActionNames[PED_1RST_PERSON_LOOK_LEFT]));
-
- AsciiToUnicode("PED_1RST_PERSON_LOOK_RIGHT", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_1RST_PERSON_LOOK_RIGHT], buff, sizeof(m_aActionNames[PED_1RST_PERSON_LOOK_RIGHT]));
-
- AsciiToUnicode("PED_1RST_PERSON_LOOK_UP", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_1RST_PERSON_LOOK_UP], buff, sizeof(m_aActionNames[PED_1RST_PERSON_LOOK_UP]));
-
- AsciiToUnicode("PED_1RST_PERSON_LOOK_DOWN", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_1RST_PERSON_LOOK_DOWN], buff, sizeof(m_aActionNames[PED_1RST_PERSON_LOOK_DOWN]));
-
- AsciiToUnicode("SHOW_MOUSE_POINTER_TOGGLE", buff);
- CMessages::WideStringCopy(m_aActionNames[SHOW_MOUSE_POINTER_TOGGLE], buff, sizeof(m_aActionNames[SHOW_MOUSE_POINTER_TOGGLE]));
-
- AsciiToUnicode("CAMERA_CHANGE_VIEW_ALL_SITUATIONS", buff);
- CMessages::WideStringCopy(m_aActionNames[CAMERA_CHANGE_VIEW_ALL_SITUATIONS], buff, sizeof(m_aActionNames[CAMERA_CHANGE_VIEW_ALL_SITUATIONS]));
-
- AsciiToUnicode("PED_FIREWEAPON", buff);
- CMessages::WideStringCopy(m_aActionNames[PED_FIREWEAPON], buff, sizeof(m_aActionNames[PED_FIREWEAPON]));
-
- AsciiToUnicode("VEHICLE_ENTER_EXIT", buff);
- CMessages::WideStringCopy(m_aActionNames[VEHICLE_ENTER_EXIT], buff, sizeof(m_aActionNames[VEHICLE_ENTER_EXIT]));
-
- AsciiToUnicode("GO_LEFT", buff);
- CMessages::WideStringCopy(m_aActionNames[GO_LEFT], buff, sizeof(m_aActionNames[GO_LEFT]));
-
- AsciiToUnicode("GO_RIGHT", buff);
- CMessages::WideStringCopy(m_aActionNames[GO_RIGHT], buff, sizeof(m_aActionNames[GO_RIGHT]));
-
- AsciiToUnicode("GO_FORWARD", buff);
- CMessages::WideStringCopy(m_aActionNames[GO_FORWARD], buff, sizeof(m_aActionNames[GO_FORWARD]));
-
- AsciiToUnicode("GO_BACK", buff);
- CMessages::WideStringCopy(m_aActionNames[GO_BACK], buff, sizeof(m_aActionNames[GO_BACK]));
-
- AsciiToUnicode("NETWORK_TALK", buff);
- CMessages::WideStringCopy(m_aActionNames[NETWORK_TALK], buff, sizeof(m_aActionNames[NETWORK_TALK]));
-
- AsciiToUnicode("TOGGLE_DPAD", buff);
- CMessages::WideStringCopy(m_aActionNames[TOGGLE_DPAD], buff, sizeof(m_aActionNames[TOGGLE_DPAD]));
-
- AsciiToUnicode("SWITCH_DEBUG_CAM_ON", buff);
- CMessages::WideStringCopy(m_aActionNames[SWITCH_DEBUG_CAM_ON], buff, sizeof(m_aActionNames[SWITCH_DEBUG_CAM_ON]));
-
- AsciiToUnicode("TAKE_SCREEN_SHOT", buff);
- CMessages::WideStringCopy(m_aActionNames[TAKE_SCREEN_SHOT], buff, sizeof(m_aActionNames[TAKE_SCREEN_SHOT]));
+ wchar buf[ACTIONNAME_LENGTH + 2];
+
+#define SETACTIONNAME(name) AsciiToUnicode(#name, buf); CMessages::WideStringCopy(m_aActionNames[name], buf, ACTIONNAME_LENGTH);
+
+ SETACTIONNAME(PED_LOOKBEHIND);
+ SETACTIONNAME(PED_CYCLE_WEAPON_LEFT);
+ SETACTIONNAME(PED_CYCLE_WEAPON_RIGHT);
+ SETACTIONNAME(PED_LOCK_TARGET);
+ SETACTIONNAME(PED_JUMPING);
+ SETACTIONNAME(PED_SPRINT);
+ SETACTIONNAME(PED_CYCLE_TARGET_LEFT);
+ SETACTIONNAME(PED_CYCLE_TARGET_RIGHT);
+ SETACTIONNAME(PED_CENTER_CAMERA_BEHIND_PLAYER);
+ SETACTIONNAME(VEHICLE_LOOKBEHIND);
+ SETACTIONNAME(VEHICLE_LOOKLEFT);
+ SETACTIONNAME(VEHICLE_LOOKRIGHT);
+ SETACTIONNAME(VEHICLE_HORN);
+ SETACTIONNAME(VEHICLE_HANDBRAKE);
+ SETACTIONNAME(VEHICLE_ACCELERATE);
+ SETACTIONNAME(VEHICLE_BRAKE);
+ SETACTIONNAME(VEHICLE_CHANGE_RADIO_STATION);
+ SETACTIONNAME(TOGGLE_SUBMISSIONS);
+ SETACTIONNAME(PED_SNIPER_ZOOM_IN);
+ SETACTIONNAME(PED_SNIPER_ZOOM_OUT);
+ SETACTIONNAME(PED_1RST_PERSON_LOOK_LEFT);
+ SETACTIONNAME(PED_1RST_PERSON_LOOK_RIGHT);
+ SETACTIONNAME(PED_1RST_PERSON_LOOK_UP);
+ SETACTIONNAME(PED_1RST_PERSON_LOOK_DOWN);
+ SETACTIONNAME(SHOW_MOUSE_POINTER_TOGGLE);
+ SETACTIONNAME(CAMERA_CHANGE_VIEW_ALL_SITUATIONS);
+ SETACTIONNAME(PED_FIREWEAPON);
+ SETACTIONNAME(VEHICLE_ENTER_EXIT);
+ SETACTIONNAME(GO_LEFT);
+ SETACTIONNAME(GO_RIGHT);
+ SETACTIONNAME(GO_FORWARD);
+ SETACTIONNAME(GO_BACK);
+ SETACTIONNAME(NETWORK_TALK);
+ SETACTIONNAME(TOGGLE_DPAD);
+ SETACTIONNAME(SWITCH_DEBUG_CAM_ON);
+ SETACTIONNAME(TAKE_SCREEN_SHOT);
+
+#undef SETACTIONNAME
}
void CControllerConfigManager::UpdateJoyInConfigMenus_ButtonDown(int32 button, int32 padnumber)
@@ -1422,7 +1356,7 @@ bool CControllerConfigManager::GetIsKeyboardKeyJustDown(RsKeyCodes keycode)
return true;
break;
case rsENTER:
- if (CPad::GetPad(PAD1)->GetEnterJustDown())
+ if (CPad::GetPad(PAD1)->GetReturnJustDown())
return true;
break;
case rsLSHIFT:
diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h
index e7abb21d..e04f9583 100644
--- a/src/core/ControllerConfig.h
+++ b/src/core/ControllerConfig.h
@@ -117,7 +117,7 @@ public:
DIJOYSTATE2 m_OldState;
DIJOYSTATE2 m_NewState;
#endif
- wchar m_aActionNames[MAX_CONTROLLERACTIONS][40];
+ wchar m_aActionNames[MAX_CONTROLLERACTIONS][ACTIONNAME_LENGTH];
bool m_aButtonStates[MAX_BUTTONS];
char _pad1[3];
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
diff --git a/src/core/CutsceneMgr.cpp b/src/core/CutsceneMgr.cpp
index f147e8c9..fa322242 100644
--- a/src/core/CutsceneMgr.cpp
+++ b/src/core/CutsceneMgr.cpp
@@ -411,7 +411,7 @@ CCutsceneMgr::Update(void)
if (CPad::GetPad(0)->GetCrossJustDown()
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|| CPad::GetPad(0)->GetLeftMouseJustDown()
- || CPad::GetPad(0)->GetPadEnterJustDown() || CPad::GetPad(0)->GetEnterJustDown() // NOTE: In original code it's a single CPad method
+ || CPad::GetPad(0)->GetEnterJustDown()
|| CPad::GetPad(0)->GetCharJustDown(VK_SPACE))
FinishCutscene();
}
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 984e693f..5911433c 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -1148,12 +1148,12 @@ void CMenuManager::LoadSettings()
CMBlur::BlurOn = true;
MousePointerStateHelper.bInvertVertically = true;
- static char Ver;
+ char Ver[50];
int fileHandle = CFileMgr::OpenFile("gta3.set", "r");
if (fileHandle) {
- CFileMgr::Read(fileHandle, (char*)&Ver, sizeof(Ver));
+ CFileMgr::Read(fileHandle, Ver, 29);
- if (strncmp(&Ver, "THIS FILE IS NOT VALID YET", 26)) {
+ if (strncmp(Ver, TopLineEmptyFile, sizeof(TopLineEmptyFile) - 1)) {
CFileMgr::Seek(fileHandle, 0, 0);
ControlsManager.LoadSettings(fileHandle);
CFileMgr::Read(fileHandle, gString, 20);
diff --git a/src/core/PCSave.h b/src/core/PCSave.h
index 696e158a..42239744 100644
--- a/src/core/PCSave.h
+++ b/src/core/PCSave.h
@@ -19,3 +19,5 @@ extern C_PcSave PcSaveHelper;
extern int *Slots;
extern int *SlotFileName;
extern int *SlotSaveDate;
+
+const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET";
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index f334a255..e5178ef3 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -1855,7 +1855,7 @@ char *CPad::EditString(char *pStr, int32 nSize)
}
// extenter/up/down
- if ( GetPad(0)->GetEnterJustDown() || GetPad(0)->GetUpJustDown() || GetPad(0)->GetDownJustDown() )
+ if ( GetPad(0)->GetReturnJustDown() || GetPad(0)->GetUpJustDown() || GetPad(0)->GetDownJustDown() )
return nil;
return pStr;
@@ -1976,7 +1976,7 @@ int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize)
if ( GetPad(0)->GetCapsLockJustDown() )
*pRsKeys = rsCAPSLK;
- if ( GetPad(0)->GetEnterJustDown() )
+ if ( GetPad(0)->GetReturnJustDown() )
*pRsKeys = rsENTER;
if ( GetPad(0)->GetLeftShiftJustDown() )
diff --git a/src/core/Pad.h b/src/core/Pad.h
index e1223629..89ec4aa2 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -299,7 +299,7 @@ public:
bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); }
bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); }
bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); }
- bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown
+ bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); }
bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); }
bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); }
bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); }
@@ -314,7 +314,7 @@ public:
bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); }
bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); }
bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); }
- bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); }
+ bool GetReturnJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); }
bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); }
bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); }
bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); }
@@ -325,6 +325,8 @@ public:
bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); }
bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); }
bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); }
+ bool GetEnterJustDown() { return GetPadEnterJustDown() || GetReturnJustDown(); }
+ bool GetAltJustDown() { return GetLeftAltJustDown() || GetRightAltJustDown(); }
bool GetChar(int32 c) { return NewKeyState.VK_KEYS[c]; }
bool GetF(int32 n) { return NewKeyState.F[n]; }
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index f1dbb8b4..f06e5317 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -15,7 +15,7 @@
#include "World.h"
#include "Streaming.h"
-float &CRadar::m_RadarRange = *(float*)0x8E281C;
+float &CRadar::m_radarRange = *(float*)0x8E281C;
CBlip (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(CBlip(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0;
CVector2D &vec2DRadarOrigin = *(CVector2D*)0x6299B8;
int *gRadarTxdIds = (int*)0x6299C0;
@@ -288,7 +288,7 @@ void CRadar::DrawBlips()
CVector2D vec2d;
vec2d.x = vec2DRadarOrigin.x;
- vec2d.y = M_SQRT2 * m_RadarRange + vec2DRadarOrigin.y;
+ vec2d.y = M_SQRT2 * m_radarRange + vec2DRadarOrigin.y;
TransformRealWorldPointToRadarSpace(in, vec2d);
LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
@@ -527,14 +527,14 @@ void CRadar::DrawMap()
if (FindPlayerVehicle()) {
float speed = FindPlayerSpeed().Magnitude();
if (speed < RADAR_MIN_SPEED)
- m_RadarRange = RADAR_MIN_RANGE;
+ m_radarRange = RADAR_MIN_RANGE;
else if (speed < RADAR_MAX_SPEED)
- m_RadarRange = (speed - RADAR_MIN_SPEED)/(RADAR_MAX_SPEED-RADAR_MIN_SPEED) * (RADAR_MAX_RANGE-RADAR_MIN_RANGE) + RADAR_MIN_RANGE;
+ m_radarRange = (speed - RADAR_MIN_SPEED)/(RADAR_MAX_SPEED-RADAR_MIN_SPEED) * (RADAR_MAX_RANGE-RADAR_MIN_RANGE) + RADAR_MIN_RANGE;
else
- m_RadarRange = RADAR_MAX_RANGE;
+ m_radarRange = RADAR_MAX_RANGE;
}
else
- m_RadarRange = RADAR_MIN_RANGE;
+ m_radarRange = RADAR_MIN_RANGE;
vec2DRadarOrigin = CVector2D(FindPlayerCentreOfWorld_NoSniperShift());
DrawRadarMap();
@@ -795,12 +795,89 @@ uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
}
#endif
-#if 1
+const char* gRadarTexNames[] = {
+ "radar00",
+ "radar01",
+ "radar02",
+ "radar03",
+ "radar04",
+ "radar05",
+ "radar06",
+ "radar07",
+ "radar08",
+ "radar09",
+ "radar10",
+ "radar11",
+ "radar12",
+ "radar13",
+ "radar14",
+ "radar15",
+ "radar16",
+ "radar17",
+ "radar18",
+ "radar19",
+ "radar20",
+ "radar21",
+ "radar22",
+ "radar23",
+ "radar24",
+ "radar25",
+ "radar26",
+ "radar27",
+ "radar28",
+ "radar29",
+ "radar30",
+ "radar31",
+ "radar32",
+ "radar33",
+ "radar34",
+ "radar35",
+ "radar36",
+ "radar37",
+ "radar38",
+ "radar39",
+ "radar40",
+ "radar41",
+ "radar42",
+ "radar43",
+ "radar44",
+ "radar45",
+ "radar46",
+ "radar47",
+ "radar48",
+ "radar49",
+ "radar50",
+ "radar51",
+ "radar52",
+ "radar53",
+ "radar54",
+ "radar55",
+ "radar56",
+ "radar57",
+ "radar58",
+ "radar59",
+ "radar60",
+ "radar61",
+};
+
+#if 0
WRAPPER void CRadar::Initialise() { EAXJMP(0x4A3EF0); }
#else
-void CRadar::Initialise()
-{
-
+void
+CRadar::Initialise()
+{
+ for (int i = 0; i < NUMRADARBLIPS; i++) {
+ ms_RadarTrace[i].m_BlipIndex = 1;
+ SetRadarMarkerState(i, false);
+ ms_RadarTrace[i].m_bInUse = false;
+ ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
+ ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
+ ms_RadarTrace[i].m_IconID = RADAR_SPRITE_NONE;
+ }
+
+ m_radarRange = 350.0f;
+ for (int i = 0; i < 64; i++)
+ gRadarTxdIds[i] = CTxdStore::FindTxdSlot(gRadarTexNames[i]);
}
#endif
@@ -1102,7 +1179,7 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
out.x = s * in.y + c * in.x;
out.y = c * in.y - s * in.x;
- out = out * m_RadarRange + vec2DRadarOrigin;
+ out = out * m_radarRange + vec2DRadarOrigin;
}
#endif
@@ -1142,8 +1219,8 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
c = Cos(forward.Heading());
}
- float x = (in.x - vec2DRadarOrigin.x) * (1.0f / m_RadarRange);
- float y = (in.y - vec2DRadarOrigin.y) * (1.0f / m_RadarRange);
+ float x = (in.x - vec2DRadarOrigin.x) * (1.0f / m_radarRange);
+ float y = (in.y - vec2DRadarOrigin.y) * (1.0f / m_radarRange);
out.x = s * y + c * x;
out.y = c * y - s * x;
diff --git a/src/core/Radar.h b/src/core/Radar.h
index d6b249db..650c6fb4 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -55,7 +55,7 @@ enum
struct CBlip
{
uint32 m_nColor;
- uint16 m_eBlipType; // eBlipType
+ uint32 m_eBlipType; // eBlipType
int32 m_nEntityHandle;
CVector2D m_vec2DPos;
CVector m_vecPos;
@@ -78,7 +78,7 @@ static_assert(sizeof(CBlip) == 0x30, "CBlip: error");
class CRadar
{
public:
- static float &m_RadarRange;
+ static float &m_radarRange;
static CBlip (&ms_RadarTrace)[NUMRADARBLIPS];
static CSprite2d *AsukaSprite;
static CSprite2d *BombSprite;
diff --git a/src/core/common.h b/src/core/common.h
index a538ddb6..fd5f35b0 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -365,4 +365,4 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
assert(ReadSaveBuf<char>(buf) == b);\
assert(ReadSaveBuf<char>(buf) == c);\
assert(ReadSaveBuf<char>(buf) == d);\
- assert(ReadSaveBuf<uint32>(buf) == size); \ No newline at end of file
+ assert(ReadSaveBuf<uint32>(buf) == size);
diff --git a/src/core/config.h b/src/core/config.h
index 12cb7be8..175a5f61 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -87,6 +87,9 @@ enum Config {
NUM_FIRES = 40,
NUMPEDROUTES = 200,
+
+ NUMVISIBLEENTITIES = 2000,
+ NUMINVISIBLEENTITIES = 150,
};
// We'll use this once we're ready to become independent of the game
@@ -141,17 +144,17 @@ enum Config {
# define CHATTYSPLASH // print what the game is loading
#endif
-#define FIX_BUGS // fix bugs in the game, TODO: use this more
+#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
// Pad
#define KANGAROO_CHEAT
// Hud & radar
#define ASPECT_RATIO_SCALE
-#define TRIANGULAR_BLIPS
+#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
// Script
-#define USE_DEBUG_SCRIPT_LOADER
+#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
// Vehicles
#define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher
@@ -162,6 +165,6 @@ enum Config {
// Peds
#define ANIMATE_PED_COL_MODEL
-#define VC_PED_PORTS
-#define NEW_WALK_AROUND_ALGORITHM
+#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
+#define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 62e9a040..d6bc8148 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -354,6 +354,7 @@ DebugMenuPopulate(void)
#ifndef MASTER
DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil);
DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
+ DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);
#endif
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);