summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/ControllerConfig.cpp14
-rw-r--r--src/core/FileLoader.cpp6
-rw-r--r--src/core/Fire.cpp2
-rw-r--r--src/core/Frontend.cpp35
-rw-r--r--src/core/Frontend.h1
-rw-r--r--src/core/MenuScreens.cpp4
-rw-r--r--src/core/MenuScreensCustom.cpp18
-rw-r--r--src/core/Radar.cpp91
-rw-r--r--src/core/Radar.h4
-rw-r--r--src/core/World.cpp8
-rw-r--r--src/core/common.h6
-rw-r--r--src/core/config.h52
-rw-r--r--src/core/re3.cpp22
14 files changed, 217 insertions, 48 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index ecfade74..d4be8585 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -4816,7 +4816,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
{1.3f, 1.0f, 0.4f, 10.0f, 15.0f, 0.5f, 1.0f, 1.0f, 0.85f, 0.2f, 0.075f, 0.05f, 0.8f, DEGTORAD(45.0f), DEGTORAD(89.0f)}, // cars
{1.1f, 1.0f, 0.1f, 10.0f, 11.0f, 0.5f, 1.0f, 1.0f, 0.85f, 0.2f, 0.075f, 0.05f, 0.75f, DEGTORAD(45.0f), DEGTORAD(89.0f)}, // bike
{1.1f, 1.0f, 0.2f, 10.0f, 15.0f, 0.05f, 0.05f, 0.0f, 0.9f, 0.05f, 0.01f, 0.05f, 1.0f, DEGTORAD(10.0f), DEGTORAD(70.0f)}, // heli (SA values)
- {1.1f, 3.5f, 0.2f, 10.0f, 25.0f, 0.5f, 1.0f, 1.0f, 0.75f, 0.1f, 0.005f, 0.2f, 1.0f, DEGTORAD(89.0f), DEGTORAD(89.0f)}, // plane (SA values)
+ {1.1f, 1.0f, 0.2f, 10.0f, 15.0f, 0.5f, 1.0f, 1.0f, 0.75f, 0.1f, 0.005f, 0.2f, 1.0f, DEGTORAD(89.0f), DEGTORAD(89.0f)}, // plane (SA values)
{0.9f, 1.0f, 0.1f, 10.0f, 15.0f, 0.5f, 1.0f, 0.0f, 0.9f, 0.05f, 0.005f, 0.05f, 1.0f, -0.2f, DEGTORAD(70.0f)}, // boat
{1.1f, 1.0f, 0.2f, 10.0f, 5.0f, 0.5f, 1.0f, 1.0f, 0.75f, 0.1f, 0.005f, 0.2f, 1.0f, DEGTORAD(45.0f), DEGTORAD(89.0f)}, // rc cars
{1.1f, 1.0f, 0.2f, 10.0f, 5.0f, 0.5f, 1.0f, 1.0f, 0.75f, 0.1f, 0.005f, 0.2f, 1.0f, DEGTORAD(20.0f), DEGTORAD(70.0f)}, // rc heli/planes
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index e72af7e4..8775792f 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -2644,6 +2644,14 @@ const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
#undef PS2_CROSS
#undef PS2_SQUARE
+const char *NintendoSwitchButtons_noIcons[][MAX_CONTROLLERACTIONS] =
+ CONTROLLER_BUTTONS("Y", "A", "B", "X", "L", "ZL", "LS", "R", "ZR", "RS", "BACK");
+
+#ifdef BUTTON_ICONS
+const char *NintendoSwitchButtons[][MAX_CONTROLLERACTIONS] =
+ CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK");
+#endif
+
#undef CONTROLLER_BUTTONS
#undef VFB
@@ -2664,6 +2672,9 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *
case CMenuManager::CONTROLLER_DUALSHOCK4:
Buttons = CFont::ButtonsSlot != -1 ? PlayStationButtons : PlayStationButtons_noIcons;
break;
+ case CMenuManager::CONTROLLER_NINTENDO_SWITCH:
+ Buttons = CFont::ButtonsSlot != -1 ? NintendoSwitchButtons : NintendoSwitchButtons_noIcons;
+ break;
default:
#endif
Buttons = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons;
@@ -2679,6 +2690,9 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *
case CMenuManager::CONTROLLER_DUALSHOCK4:
Buttons = PlayStationButtons_noIcons;
break;
+ case CMenuManager::CONTROLLER_NINTENDO_SWITCH:
+ Buttons = NintendoSwitchButtons_noIcons;
+ break;
default:
Buttons = XboxButtons_noIcons;
break;
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index cc2b402b..afa2a66f 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -1135,12 +1135,12 @@ CFileLoader::LoadMLO(const char *line)
char smth[8];
char name[24];
int modelIndex;
- float someFloat;
+ float drawDist;
- sscanf(line, "%s %s %d %f", smth, name, &modelIndex, &someFloat);
+ sscanf(line, "%s %s %d %f", smth, name, &modelIndex, &drawDist);
CMloModelInfo *minfo = CModelInfo::AddMloModel(modelIndex);
minfo->SetModelName(name);
- minfo->field_34 = someFloat;
+ minfo->drawDist = drawDist;
int instId = CModelInfo::GetMloInstanceStore().allocPtr;
minfo->firstInstance = instId;
minfo->lastInstance = instId;
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index 984b21bb..8b184622 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -396,7 +396,7 @@ CFireManager::StartScriptFire(const CVector &pos, CEntity *target, float strengt
if (target) {
if (target->IsPed()) {
ped->m_pFire = fire;
- if (target != (CVehicle *)FindPlayerPed()) {
+ if (target != FindPlayerPed()) {
CVector2D pos = target->GetPosition();
ped->SetFlee(pos, 10000);
ped->SetMoveAnim();
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index ecb893b4..666774fe 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -142,8 +142,12 @@ int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW;
#endif
#ifdef GAMEPAD_MENU
+#ifdef __SWITCH__
+int8 CMenuManager::m_PrefsControllerType = CONTROLLER_NINTENDO_SWITCH;
+#else
int8 CMenuManager::m_PrefsControllerType = CONTROLLER_XBOXONE;
#endif
+#endif
int32 CMenuManager::OS_Language = LANG_ENGLISH;
int8 CMenuManager::m_PrefsUseVibration;
@@ -447,7 +451,7 @@ CMenuManager::ThingsToDoBeforeGoingBack()
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
#ifdef CUSTOM_FRONTEND_OPTIONS
- } else if (ScreenHasOption(m_nCurrScreen, "FEA_3DH")) {
+ } else if (ScreenHasOption(m_nCurrScreen, "FEA_RSS")) {
#else
} else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
#endif
@@ -3674,6 +3678,7 @@ const char* controllerTypesPaths[] = {
"MODELS/FRONTEND_DS4.TXD",
"MODELS/FRONTEND_X360.TXD",
"MODELS/FRONTEND_XONE.TXD",
+ "MODELS/FRONTEND_NSW.TXD",
};
void
@@ -3686,6 +3691,9 @@ CMenuManager::LoadController(int8 type)
case CONTROLLER_DUALSHOCK4:
CFont::LoadButtons("MODELS/PS3BTNS.TXD");
break;
+ case CONTROLLER_NINTENDO_SWITCH:
+ CFont::LoadButtons("MODELS/NSWBTNS.TXD");
+ break;
default:
CFont::LoadButtons("MODELS/X360BTNS.TXD");
break;
@@ -3812,9 +3820,6 @@ CMenuManager::LoadSettings()
if (LoadINISettings()) {
LoadINIControllerSettings();
}
- // if no re3.ini, create it, or update it with new values
- SaveINISettings();
- SaveINIControllerSettings();
#endif
m_PrefsVsync = m_PrefsVsyncDisp;
@@ -4175,14 +4180,14 @@ CMenuManager::Process(void)
if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) {
#ifdef MISSION_REPLAY
if (doingMissionRetry) {
- RetryMission(2, 0);
+ RetryMission(MISSION_RETRY_TYPE_BEGIN_RESTARTING);
m_nCurrSaveSlot = SLOT_COUNT;
doingMissionRetry = false;
}
#endif
if (CheckSlotDataValid(m_nCurrSaveSlot)) {
#ifdef USE_DEBUG_SCRIPT_LOADER
- scriptToLoad = 0;
+ CTheScripts::ScriptToLoad = 0;
#endif
#ifdef PC_PLAYER_CONTROLS
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
@@ -4312,12 +4317,12 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef USE_DEBUG_SCRIPT_LOADER
if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) {
if (CPad::GetPad(0)->GetChar('R')) {
- scriptToLoad = 1;
+ CTheScripts::ScriptToLoad = 1;
DoSettingsBeforeStartingAGame();
return;
}
if (CPad::GetPad(0)->GetChar('D')) {
- scriptToLoad = 2;
+ CTheScripts::ScriptToLoad = 2;
DoSettingsBeforeStartingAGame();
return;
}
@@ -5186,7 +5191,7 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_UNK114:
doingMissionRetry = false;
RequestFrontEndShutDown();
- RetryMission(2, 0);
+ RetryMission(MISSION_RETRY_TYPE_BEGIN_RESTARTING);
return;
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
@@ -5928,6 +5933,18 @@ CMenuManager::PrintController(void)
TEXT_L2R2_Y += 5.0f;
TEXT_SELECT_X += 3.0f;
break;
+ case CONTROLLER_NINTENDO_SWITCH:
+ TEXT_L1_Y += 5.0f;
+ TEXT_L1_Y_VEH = TEXT_L1_Y;
+ TEXT_R1_Y += 5.0f;
+ TEXT_TRIANGLE_Y += 3.0f;
+ TEXT_CIRCLE_Y += 3.0f;
+ TEXT_CROSS_Y += 3.0f;
+ TEXT_LSTICK_Y -= 23.0f;
+ TEXT_DPAD_Y += 25.0;
+ TEXT_RSTICK_Y += 1.0f;
+ TEXT_R3_Y += 1.0f;
+ break;
};
if (m_DisplayControllerOnFoot) {
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 32e5ef9d..6e6c40f7 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -760,6 +760,7 @@ public:
CONTROLLER_DUALSHOCK4,
CONTROLLER_XBOX360,
CONTROLLER_XBOXONE,
+ CONTROLLER_NINTENDO_SWITCH,
};
static int8 m_PrefsControllerType;
diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp
index 3bd9adf4..247de98a 100644
--- a/src/core/MenuScreens.cpp
+++ b/src/core/MenuScreens.cpp
@@ -40,9 +40,13 @@ CMenuScreen aScreens[MENUPAGES] = {
{ "FET_AUD", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1,
MENUACTION_MUSICVOLUME, "FEA_MUS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_SFXVOLUME, "FEA_SFX", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
+#ifdef EXTERNAL_3D_SOUND
MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_SPEAKERCONF, "FEA_SPK", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
+#endif
+#ifdef AUDIO_REFLECTIONS
MENUACTION_DYNAMICACOUSTIC, "FET_DAM", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
+#endif
MENUACTION_RADIO, "FEA_RSS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index 033ed9b9..d33650f8 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -36,7 +36,7 @@
#ifdef CUSTOM_FRONTEND_OPTIONS
-#ifdef IMPROVED_VIDEOMODE
+#if defined(IMPROVED_VIDEOMODE) && !defined(GTA_HANDHELD)
#define VIDEOMODE_SELECTOR MENUACTION_CFO_SELECT, "FEM_SCF", { new CCFOSelect((int8*)&FrontEndMenuManager.m_nPrefsWindowed, "VideoMode", "Windowed", screenModes, 2, true, ScreenModeAfterChange, true) },
#else
#define VIDEOMODE_SELECTOR
@@ -388,7 +388,7 @@ void DetectJoystickGoBack() {
#endif
#ifdef GAMEPAD_MENU
-const char* controllerTypes[] = { "FEC_DS2", "FEC_DS3", "FEC_DS4", "FEC_360", "FEC_ONE" };
+const char* controllerTypes[] = { "FEC_DS2", "FEC_DS3", "FEC_DS4", "FEC_360", "FEC_ONE", "FEC_NSW" };
void ControllerTypeAfterChange(int8 before, int8 after)
{
FrontEndMenuManager.LoadController(after);
@@ -418,10 +418,10 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
},
// MENUPAGE_CONTROLLER_SETTINGS = 4
-#ifdef GAMEPAD_MENU
+#if defined(GAMEPAD_MENU) && !defined(GTA_HANDHELD)
{ "FET_AGS", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
#else
- { "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
+ { "FET_AGS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
#endif
MENUACTION_CTRLCONFIG, "FEC_CCF", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
MENUACTION_CTRLDISPLAY, "FEC_CDP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
@@ -435,9 +435,13 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
{ "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
MENUACTION_MUSICVOLUME, "FEA_MUS", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_SFXVOLUME, "FEA_SFX", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
+#ifdef EXTERNAL_3D_SOUND
MENUACTION_AUDIOHW, "FEA_3DH", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_SPEAKERCONF, "FEA_SPK", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
+#endif
+#ifdef AUDIO_REFLECTIONS
MENUACTION_DYNAMICACOUSTIC, "FET_DAM", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
+#endif
MENUACTION_RADIO, "FEA_RSS", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_RESTOREDEF, "FET_DEF", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
@@ -751,7 +755,11 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
// MENUPAGE_OPTIONS = 41
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
+#ifdef GTA_HANDHELD
+ MENUACTION_CHANGEMENU, "FET_CTL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
+#else
MENUACTION_CHANGEMENU, "FET_CTL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
+#endif
MENUACTION_LOADRADIO, "FET_AUD", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_CHANGEMENU, "FET_DIS", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#ifdef GRAPHICS_MENU_OPTIONS
@@ -885,7 +893,9 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
{ "FET_GFX", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS,
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), GraphicsGoBack,
+#ifndef GTA_HANDHELD
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
+#endif
MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
VIDEOMODE_SELECTOR
MENUACTION_FRAMESYNC, "FEM_VSC", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 77d6cc7f..b29c19eb 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -45,6 +45,9 @@ CSprite2d CRadar::SaveSprite;
CSprite2d CRadar::SpraySprite;
CSprite2d CRadar::TonySprite;
CSprite2d CRadar::WeaponSprite;
+#ifdef MENU_MAP
+CSprite2d CRadar::WaypointSprite;
+#endif
CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
nil,
@@ -67,7 +70,10 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
&SaveSprite,
&SpraySprite,
&TonySprite,
- &WeaponSprite
+ &WeaponSprite,
+#ifdef MENU_MAP
+ &WaypointSprite
+#endif
};
// Why this doesn't coincide with world coordinates i don't know
@@ -441,7 +447,7 @@ void CRadar::Draw3dMarkers()
CEntity *entity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
CVector pos = entity->GetPosition();
- pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f;
+ pos.z += 1.2f * CModelInfo::GetColModel(entity->GetModelIndex())->boundingBox.max.z + 2.5f;
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 2.5f, 0, 128, 255, 255, 1024, 0.2f, 5);
}
break;
@@ -465,7 +471,7 @@ void CRadar::Draw3dMarkers()
CEntity *entity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
CVector pos = entity->GetPosition();
- pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f;
+ pos.z += CModelInfo::GetColModel(entity->GetModelIndex())->boundingBox.max.z + 1.0f + 1.0f;
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.0f, 0, 128, 255, 255, 1024, 0.2f, 5);
}
break;
@@ -485,7 +491,11 @@ void CRadar::Draw3dMarkers()
void CRadar::DrawBlips()
{
- if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
+ if ((!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud)
+#ifdef MENU_MAP
+ || CMenuManager::bMenuMapActive
+#endif
+ ) {
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
@@ -913,6 +923,9 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
{
+#ifdef MENU_MAP
+ if(sprite == RADAR_SPRITE_WAYPOINT) alpha = 255;
+#endif
RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
}
@@ -1018,6 +1031,10 @@ const char* gRadarTexNames[] = {
void
CRadar::Initialise()
{
+#ifdef MENU_MAP
+ TargetMarkerId = -1;
+#endif
+
for (int i = 0; i < NUMRADARBLIPS; i++) {
ms_RadarTrace[i].m_BlipIndex = 1;
SetRadarMarkerState(i, false);
@@ -1086,6 +1103,43 @@ CRadar::LoadTextures()
SpraySprite.SetTexture("radar_spray");
TonySprite.SetTexture("radar_tony");
WeaponSprite.SetTexture("radar_weapon");
+#ifdef MENU_MAP
+ WaypointSprite.SetTexture("radar_waypoint");
+ if(!WaypointSprite.m_pTexture) {
+ // create the texture if it's missing in TXD
+#define WAYPOINT_R (255)
+#define WAYPOINT_G (72)
+#define WAYPOINT_B (77)
+
+ RwRaster *raster = RwRasterCreate(16, 16, 0, rwRASTERTYPETEXTURE | rwRASTERFORMAT8888);
+
+ RwUInt32 *pixels = (RwUInt32 *)RwRasterLock(raster, 0, rwRASTERLOCKWRITE);
+ for(int x = 0; x < 16; x++)
+ for(int y = 0; y < 16; y++)
+ {
+ int x2 = x < 8 ? x : 7 - (x & 7);
+ int y2 = y < 8 ? y : 7 - (y & 7);
+ if ((y2 >= 4 && x2 >= 4) // square in the center is transparent
+ || (x2 < 2 && y2 == 0) // two pixels on each side of first/last line are transparent
+ || (x2 < 1 && y2 == 1)) // one pixel on each side of second to first/last line is transparent
+ pixels[x + y * 16] = 0;
+ else if((x2 == 2 && y2 >= 2)|| (y2 == 2 && x2 >= 2) )// colored square inside
+#ifdef RW_GL3
+ pixels[x + y * 16] = WAYPOINT_R | (WAYPOINT_G << 8) | (WAYPOINT_B << 16) | (255 << 24);
+#else
+ pixels[x + y * 16] = WAYPOINT_B | (WAYPOINT_G << 8) | (WAYPOINT_R << 16) | (255 << 24);
+#endif
+ else
+ pixels[x + y * 16] = 0xFF000000; // black
+ }
+ RwRasterUnlock(raster);
+ WaypointSprite.m_pTexture = RwTextureCreate(raster);
+ RwTextureSetFilterMode(WaypointSprite.m_pTexture, rwFILTERLINEAR);
+#undef WAYPOINT_R
+#undef WAYPOINT_G
+#undef WAYPOINT_B
+ }
+#endif
CTxdStore::PopCurrentTxd();
}
@@ -1103,15 +1157,23 @@ INITSAVEBUF
WriteSaveHeader(buf, 'R', 'D', 'R', '\0', *size - SAVE_HEADER_SIZE);
#ifdef MENU_MAP
+ bool bWaypointDeleted = false;
if (TargetMarkerId != -1) {
ClearBlip(TargetMarkerId);
TargetMarkerId = -1;
+ bWaypointDeleted = true;
}
#endif
for (int i = 0; i < NUMRADARBLIPS; i++)
WriteSaveBuf(buf, ms_RadarTrace[i]);
+
+#ifdef MENU_MAP
+ if(bWaypointDeleted)
+ ToggleTargetMarker(TargetMarkerPos.x, TargetMarkerPos.y);
+#endif
+
VALIDATESAVEBUF(*size);
}
@@ -1216,7 +1278,11 @@ void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) {
void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha)
{
- if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
+ if ((TheCamera.m_WideScreenOn || !CHud::m_Wants_To_Draw_Hud)
+#ifdef MENU_MAP
+ && !CMenuManager::bMenuMapActive
+#endif
+ )
return;
CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha));
@@ -1225,7 +1291,11 @@ void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 gree
void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha, uint8 mode)
{
- if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
+ if ((TheCamera.m_WideScreenOn || !CHud::m_Wants_To_Draw_Hud)
+#ifdef MENU_MAP
+ && !CMenuManager::bMenuMapActive
+#endif
+ )
return;
switch (mode)
@@ -1269,6 +1339,9 @@ void CRadar::Shutdown()
SpraySprite.Delete();
TonySprite.Delete();
WeaponSprite.Delete();
+#ifdef MENU_MAP
+ WaypointSprite.Delete();
+#endif
RemoveRadarSections();
}
@@ -1464,12 +1537,12 @@ CRadar::ToggleTargetMarker(float x, float y)
{
if (TargetMarkerId == -1) {
int nextBlip;
- for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
+ for (nextBlip = NUMRADARBLIPS-1; nextBlip >= 0; nextBlip--) {
if (!ms_RadarTrace[nextBlip].m_bInUse)
break;
}
#ifdef FIX_BUGS
- if (nextBlip == NUMRADARBLIPS)
+ if (nextBlip == 0)
return;
#endif
ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
@@ -1484,7 +1557,7 @@ CRadar::ToggleTargetMarker(float x, float y)
ms_RadarTrace[nextBlip].m_nEntityHandle = 0;
ms_RadarTrace[nextBlip].m_wScale = 5;
ms_RadarTrace[nextBlip].m_eBlipDisplay = BLIP_DISPLAY_BLIP_ONLY;
- ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
+ ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_WAYPOINT;
TargetMarkerId = CRadar::GetNewUniqueBlipIndex(nextBlip);
} else {
ClearBlip(TargetMarkerId);
diff --git a/src/core/Radar.h b/src/core/Radar.h
index 5b38d350..ae87d0fa 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -47,6 +47,9 @@ enum eRadarSprite
RADAR_SPRITE_SPRAY,
RADAR_SPRITE_TONY,
RADAR_SPRITE_WEAPON,
+#ifdef MENU_MAP
+ RADAR_SPRITE_WAYPOINT,
+#endif
RADAR_SPRITE_COUNT
};
@@ -144,6 +147,7 @@ public:
static float cachedCos;
static float cachedSin;
#ifdef MENU_MAP
+ static CSprite2d WaypointSprite;
static int TargetMarkerId;
static CVector TargetMarkerPos;
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 6e8314f4..1c34a633 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -358,7 +358,7 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
} else
colmodel = nil;
} else if(e->bUsesCollision)
- colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
+ colmodel = CModelInfo::GetColModel(e->GetModelIndex());
if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, mindist,
ignoreSeeThrough))
@@ -444,7 +444,7 @@ CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CCol
if(e->m_scanCode != GetCurrentScanCode() && e->bUsesCollision) {
e->m_scanCode = GetCurrentScanCode();
- colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
+ colmodel = CModelInfo::GetColModel(e->GetModelIndex());
if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, mindist,
ignoreSeeThrough, poly))
entity = e;
@@ -645,7 +645,7 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
if(e != pIgnoreEntity && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
- colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
+ colmodel = CModelInfo::GetColModel(e->GetModelIndex());
if(CCollision::TestLineOfSight(line, e->GetMatrix(), *colmodel, ignoreSeeThrough))
return false;
@@ -955,7 +955,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
float distance = diff.Magnitude();
if(e->GetBoundRadius() + radius > distance) {
- CColModel *eCol = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
+ CColModel *eCol = CModelInfo::GetColModel(e->GetModelIndex());
int collidedSpheres =
CCollision::ProcessColModels(sphereMat, OurColModel, e->GetMatrix(), *eCol,
gaTempSphereColPoints, nil, nil);
diff --git a/src/core/common.h b/src/core/common.h
index da162762..0d0528b1 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -11,6 +11,10 @@
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
#endif
+#ifdef __SWITCH__
+#include <switch.h>
+#endif
+
#include <stdint.h>
#include <string.h>
#include <math.h>
@@ -292,6 +296,8 @@ extern wchar *AllocUnicode(const char*src);
#define Clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
+#define Clamp2(v, center, radius) ((v) > (center) ? Min(v, center + radius) : Max(v, center - radius))
+
inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x))
diff --git a/src/core/config.h b/src/core/config.h
index 885f98b8..9f1981be 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -126,13 +126,11 @@ enum Config {
NUMINVISIBLEENTITIES = 150,
NUM_AUDIOENTITY_EVENTS = 4,
- NUM_PED_COMMENTS_BANKS = 2,
NUM_PED_COMMENTS_SLOTS = 20,
- NUM_SOUNDS_SAMPLES_BANKS = 2,
+ NUM_SOUND_QUEUES = 2,
NUM_AUDIOENTITIES = 200,
- NUM_AUDIO_REFLECTIONS = 5,
NUM_SCRIPT_MAX_ENTITIES = 40,
NUM_GARAGE_STORED_CARS = 6,
@@ -158,6 +156,11 @@ enum Config {
#define GTA_VERSION GTA3_PC_11
+// Enable configuration for handheld console ports
+#if defined(__SWITCH__) || defined(PSP2)
+ #define GTA_HANDHELD
+#endif
+
#if defined GTA_PS2
# define GTA_PS2_STUFF
# define RANDOMSPLASH
@@ -166,7 +169,11 @@ enum Config {
# define ANIM_COMPRESSION
# define PS2_MENU
#elif defined GTA_PC
-# define PC_PLAYER_CONTROLS // mouse player/cam mode
+# define EXTERNAL_3D_SOUND
+# define AUDIO_REFLECTIONS
+# ifndef GTA_HANDHELD
+# define PC_PLAYER_CONTROLS // mouse player/cam mode
+# endif
# define GTA_REPLAY
# define GTA_SCENE_EDIT
# define PC_MENU
@@ -259,12 +266,15 @@ enum Config {
#define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds.
#define MORE_LANGUAGES // Add more translations to the game
-#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms
+#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms, needs to be enabled on 64bit builds!
#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
#define NO_MOVIES // add option to disable intro videos
+#define EXTENDED_OFFSCREEN_DESPAWN_RANGE // Use onscreen despawn range for offscreen peds and vehicles to avoid them despawning in the distance when you look
+ // away
+
#if defined(__LP64__) || defined(_WIN64)
#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build
#endif
@@ -319,7 +329,7 @@ enum Config {
#if !defined(RW_GL3) && defined(_WIN32)
#define XINPUT
#endif
-#if defined XINPUT || (defined RW_GL3 && !defined LIBRW_SDL2 && !defined __SWITCH__)
+#if defined XINPUT || (defined RW_GL3 && !defined LIBRW_SDL2 && !defined GTA_HANDHELD)
#define DETECT_JOYSTICK_MENU // Then we'll expect user to enter Controller->Detect joysticks if his joystick isn't detected at the start.
#endif
#define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m
@@ -345,7 +355,7 @@ enum Config {
//# define PS2_MENU_USEALLPAGEICONS
#else
-# ifdef XINPUT
+# if defined(XINPUT) || defined(GTA_HANDHELD)
# define GAMEPAD_MENU // Add gamepad menu
# endif
@@ -409,7 +419,7 @@ enum Config {
// #define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
-//#define PEDS_REPORT_CRIMES_ON_PHONE, requires COMPATIBLE_SAVES
+//#define PEDS_REPORT_CRIMES_ON_PHONE // requires COMPATIBLE_SAVES
// Camera
//#define PS2_CAM_TRANSITION // old way of transitioning between cam modes
@@ -417,13 +427,18 @@ enum Config {
#define FREE_CAM // Rotating cam
// Audio
+#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
+ // originally and making it work in 2d only requires more resource). Will not work on PS2
+#define AUDIO_REFLECTIONS // Enable audio reflections. Disabled on mobile, didn't exist yet on PS2.
#define RADIO_SCROLL_TO_PREV_STATION
#define AUDIO_CACHE
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 44 (PC has 28 originally)
-//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
+#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
#define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused
+#define ATTACH_RELEASING_SOUNDS_TO_ENTITIES // sounds would follow ped and vehicles coordinates if not being queued otherwise
+#define USE_TIME_SCALE_FOR_AUDIO // slow down/speed up sounds according to the speed of the game
#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
#ifdef AUDIO_OPUS
@@ -450,6 +465,7 @@ enum Config {
#undef PS2_ALPHA_TEST
#undef NO_ISLAND_LOADING
#undef PS2_AUDIO_CHANNELS
+ #undef EXTENDED_OFFSCREEN_DESPAWN_RANGE
#define PC_PARTICLE
#define VC_PED_PORTS // To not process collisions always. But should be tested if that's really beneficial
#define VC_RAIN_NERF // Reduces number of rain particles
@@ -461,4 +477,22 @@ enum Config {
#undef PEDS_REPORT_CRIMES_ON_PHONE
#endif
+#ifdef GTA_HANDHELD
+ #define IGNORE_MOUSE_KEYBOARD // ignore mouse & keyboard input
+#endif
+
+#ifdef __SWITCH__
+ #define USE_UNNAMED_SEM // named semaphores are unsupported on the switch
+#endif
+
#endif // VANILLA_DEFINES
+
+#if defined(AUDIO_OAL) && !defined(EXTERNAL_3D_SOUND)
+#error AUDIO_OAL cannot work without EXTERNAL_3D_SOUND
+#endif
+#if defined(GTA_PS2) && defined(EXTERNAL_3D_SOUND)
+#error EXTERNAL_3D_SOUND cannot work on PS2
+#endif
+#if defined(AUDIO_REFLECTIONS) && GTA_VERSION < GTA3_PC_10
+#error AUDIO_REFLECTIONS cannot work with versions below GTA3_PC_10
+#endif \ No newline at end of file
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index b7d89363..a721c238 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -44,10 +44,9 @@
#include "CarCtrl.h"
#include "Population.h"
#include "IniFile.h"
+#include "Zones.h"
-#ifdef DETECT_JOYSTICK_MENU
#include "crossplatform.h"
-#endif
#ifndef _WIN32
#include "assert.h"
@@ -493,8 +492,10 @@ bool LoadINISettings()
ReadIniIfExists("Audio", "SfxVolume", &FrontEndMenuManager.m_PrefsSfxVolume);
ReadIniIfExists("Audio", "MusicVolume", &FrontEndMenuManager.m_PrefsMusicVolume);
ReadIniIfExists("Audio", "Radio", &FrontEndMenuManager.m_PrefsRadioStation);
+#ifdef EXTERNAL_3D_SOUND
ReadIniIfExists("Audio", "SpeakerType", &FrontEndMenuManager.m_PrefsSpeakers);
ReadIniIfExists("Audio", "Provider", &FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
+#endif
ReadIniIfExists("Audio", "DynamicAcoustics", &FrontEndMenuManager.m_PrefsDMA);
ReadIniIfExists("Display", "Brightness", &FrontEndMenuManager.m_PrefsBrightness);
ReadIniIfExists("Display", "DrawDistance", &FrontEndMenuManager.m_PrefsLOD);
@@ -593,8 +594,10 @@ void SaveINISettings()
StoreIni("Audio", "SfxVolume", FrontEndMenuManager.m_PrefsSfxVolume);
StoreIni("Audio", "MusicVolume", FrontEndMenuManager.m_PrefsMusicVolume);
StoreIni("Audio", "Radio", FrontEndMenuManager.m_PrefsRadioStation);
+#ifdef EXTERNAL_3D_SOUND
StoreIni("Audio", "SpeakerType", FrontEndMenuManager.m_PrefsSpeakers);
StoreIni("Audio", "Provider", FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
+#endif
StoreIni("Audio", "DynamicAcoustics", FrontEndMenuManager.m_PrefsDMA);
StoreIni("Display", "Brightness", FrontEndMenuManager.m_PrefsBrightness);
StoreIni("Display", "DrawDistance", FrontEndMenuManager.m_PrefsLOD);
@@ -744,12 +747,15 @@ FixCar(void)
static void
TeleportToWaypoint(void)
{
- if (FindPlayerVehicle()) {
- if (CRadar::TargetMarkerId != -1)
- FindPlayerVehicle()->Teleport(CRadar::TargetMarkerPos + CVector(0.0f, 0.0f, FindPlayerVehicle()->GetColModel()->boundingSphere.center.z));
- } else
- if(CRadar::TargetMarkerId != -1)
- FindPlayerPed()->Teleport(CRadar::TargetMarkerPos + CVector(0.0f, 0.0f, FEET_OFFSET));
+ if (CRadar::TargetMarkerId == -1)
+ return;
+ CEntity* pEntityToTeleport = FindPlayerEntity();
+ CVector vNewPos = CRadar::TargetMarkerPos;
+ CGame::currLevel = CTheZones::GetLevelFromPosition(&vNewPos);
+ CCollision::SortOutCollisionAfterLoad();
+ CStreaming::LoadScene(vNewPos);
+ vNewPos.z = CWorld::FindGroundZForCoord(vNewPos.x, vNewPos.y) + pEntityToTeleport->GetDistanceFromCentreOfMassToBaseOfModel();
+ pEntityToTeleport->Teleport(vNewPos);
}
#endif