summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2020-07-22 17:21:39 +0200
committerGitHub <noreply@github.com>2020-07-22 17:21:39 +0200
commitb182fa4bb89a770d2e34da162eb46cdbaceb153b (patch)
treeb641e2e0a9dc0edddae8e09d04660c13936798c2 /src/core
parentREADME 64-bit preparation (diff)
parentPeds, Hud, CFO 1/2, fixes - including zone names (diff)
downloadre3-b182fa4bb89a770d2e34da162eb46cdbaceb153b.tar
re3-b182fa4bb89a770d2e34da162eb46cdbaceb153b.tar.gz
re3-b182fa4bb89a770d2e34da162eb46cdbaceb153b.tar.bz2
re3-b182fa4bb89a770d2e34da162eb46cdbaceb153b.tar.lz
re3-b182fa4bb89a770d2e34da162eb46cdbaceb153b.tar.xz
re3-b182fa4bb89a770d2e34da162eb46cdbaceb153b.tar.zst
re3-b182fa4bb89a770d2e34da162eb46cdbaceb153b.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Frontend.cpp365
-rw-r--r--src/core/Frontend.h13
-rw-r--r--src/core/General.h2
-rw-r--r--src/core/MenuScreens.cpp (renamed from src/core/MenuScreens.h)8
-rw-r--r--src/core/Pad.cpp5
-rw-r--r--src/core/Radar.cpp6
-rw-r--r--src/core/User.cpp8
-rw-r--r--src/core/User.h1
-rw-r--r--src/core/Zones.cpp2
-rw-r--r--src/core/config.h1
10 files changed, 275 insertions, 136 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 4c205675..a3b15ac1 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -24,7 +24,6 @@
#include "GenericGameStorage.h"
#include "Script.h"
#include "Camera.h"
-#include "MenuScreens.h"
#include "ControllerConfig.h"
#include "Vehicle.h"
#include "MBlur.h"
@@ -214,75 +213,6 @@ ScaleAndCenterX(float x)
// --- Functions not in the game/inlined starts
-bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
-void DoRWStuffEndOfFrame(void);
-
-#ifdef PS2_LIKE_MENU
-void
-CMenuManager::SwitchToNewScreen(int8 screen)
-{
- if (reverseAlpha) {
- m_nPrevScreen = m_nCurrScreen;
- m_nCurrScreen = pendingScreen;
- m_nCurrOption = pendingOption;
- reverseAlpha = false;
- if (updateDelay)
- m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
- }
- if (withReverseAlpha) {
- pendingOption = option;
- pendingScreen = screen;
- reverseAlpha = true;
- } else {
- m_nPrevScreen = m_nCurrScreen;
- m_nCurrScreen = screen;
- m_nCurrOption = option;
- if (updateDelay)
- m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
- }
- m_nMenuFadeAlpha = 255;
-}
-#else
-
-// --MIAMI: Done except using VC's gMenuPages
-void
-CMenuManager::SwitchToNewScreen(int8 screen)
-{
- bMenuChangeOngoing = true;
- DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
- DrawBackground(true);
- DoRWStuffEndOfFrame();
- DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
- DrawBackground(true);
- DoRWStuffEndOfFrame();
- m_nPrevScreen = m_nCurrScreen;
- m_ShowEmptyBindingError = false;
- ResetHelperText();
-
- ThingsToDoBeforeLeavingPage();
-
- if (screen == -2) {
- int oldScreen = aScreens[m_nCurrScreen].m_PreviousPage;
- int oldOption = (m_nCurrScreen == MENUPAGE_NEW_GAME ? 0 : (m_nCurrScreen == MENUPAGE_OPTIONS ? 1 : (m_nCurrScreen == MENUPAGE_EXIT ? 2 : aScreens[m_nCurrScreen].m_ParentEntry)));
-
- m_nCurrOption = oldOption;
- m_nCurrScreen = oldScreen;
- } else if (screen == 0) {
- m_nCurrScreen = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu;
- m_nCurrOption = 0;
- } else {
- m_nCurrOption = 0;
- m_nCurrScreen = screen;
- }
-
- if (m_nCurrScreen == MENUPAGE_CHOOSE_SAVE_SLOT)
- m_nCurrOption = 8;
- m_nMenuFadeAlpha = 0;
- m_nOptionHighlightTransitionBlend = 0;
- m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
-}
-#endif
-
inline void
CMenuManager::ScrollUpListByOne()
{
@@ -349,7 +279,6 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
}
}
-// TODO(Miami)
inline void
CMenuManager::ThingsToDoBeforeLeavingPage()
{
@@ -373,13 +302,123 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
CPlayerSkin::EndFrontendSkinEdit();
}
- if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) {
- m_nTotalListRow = 0;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ for (int i = 0; i < numCustomFrontendOptions; i++) {
+ FrontendOption& option = customFrontendOptions[i];
+ if (option.type != FEOPTION_REDIRECT && option.type != FEOPTION_GOBACK && m_nCurrScreen == option.screen) {
+ if (option.returnPrevPageFunc)
+ option.returnPrevPageFunc();
+
+ if (m_nCurrOption == option.screenOptionOrder && option.type == FEOPTION_DYNAMIC)
+ option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
+
+ if (option.onlyApplyOnEnter)
+ option.displayedValue = *option.value;
+ }
+ }
+#endif
+}
+
+int8
+CMenuManager::GetPreviousPageOption()
+{
+#ifndef CUSTOM_FRONTEND_OPTIONS
+ return (!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry :
+ (m_nCurrScreen == MENUPAGE_NEW_GAME ? 0 : (m_nCurrScreen == MENUPAGE_OPTIONS ? 1 : (m_nCurrScreen == MENUPAGE_EXIT ? 2 : aScreens[m_nCurrScreen].m_ParentEntry))));
+#else
+ int8 prevPage = aScreens[m_nCurrScreen].m_PreviousPage;
+
+ if (prevPage == -1) // Game also does same
+ return 0;
+
+ prevPage = prevPage == MENUPAGE_NONE ? (!m_bGameNotLoaded ? MENUPAGE_PAUSE_MENU : MENUPAGE_START_MENU) : prevPage;
+
+ for (int i = 0; i < NUM_MENUROWS; i++) {
+ if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) {
+ return i;
+ }
}
+
+ // Couldn't find current screen option on previous page, use default behaviour (maybe save-related screen?)
+ return (!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry :
+ (m_nCurrScreen == MENUPAGE_NEW_GAME ? 0 : (m_nCurrScreen == MENUPAGE_OPTIONS ? 1 : (m_nCurrScreen == MENUPAGE_EXIT ? 2 : aScreens[m_nCurrScreen].m_ParentEntry))));
+#endif
}
// ------ Functions not in the game/inlined ends
+bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
+void DoRWStuffEndOfFrame(void);
+
+#ifdef PS2_LIKE_MENU
+void
+CMenuManager::SwitchToNewScreen(int8 screen)
+{
+ if (reverseAlpha) {
+ m_nPrevScreen = m_nCurrScreen;
+ m_nCurrScreen = pendingScreen;
+ m_nCurrOption = pendingOption;
+ reverseAlpha = false;
+ if (updateDelay)
+ m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+ if (withReverseAlpha) {
+ pendingOption = option;
+ pendingScreen = screen;
+ reverseAlpha = true;
+ } else {
+ m_nPrevScreen = m_nCurrScreen;
+ m_nCurrScreen = screen;
+ m_nCurrOption = option;
+ if (updateDelay)
+ m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+ m_nMenuFadeAlpha = 255;
+}
+#else
+
+// --MIAMI: Done
+void
+CMenuManager::SwitchToNewScreen(int8 screen)
+{
+ bMenuChangeOngoing = true;
+ DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
+ DrawBackground(true);
+ DoRWStuffEndOfFrame();
+ DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
+ DrawBackground(true);
+ DoRWStuffEndOfFrame();
+ m_nPrevScreen = m_nCurrScreen;
+ m_ShowEmptyBindingError = false;
+ ResetHelperText();
+
+ ThingsToDoBeforeLeavingPage();
+
+ if (screen == -2) {
+ int oldScreen = aScreens[m_nCurrScreen].m_PreviousPage;
+ int oldOption = GetPreviousPageOption();
+
+ m_nCurrOption = oldOption;
+ m_nCurrScreen = oldScreen;
+ } else if (screen == 0) {
+ m_nCurrScreen = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu;
+ m_nCurrOption = 0;
+ } else {
+ m_nCurrOption = 0;
+ m_nCurrScreen = screen;
+ }
+
+ if (m_nPrevScreen == MENUPAGE_SKIN_SELECT || m_nPrevScreen == MENUPAGE_KEYBOARD_CONTROLS)
+ m_nTotalListRow = 0;
+
+ if (m_nCurrScreen == MENUPAGE_CHOOSE_SAVE_SLOT)
+ m_nCurrOption = 8;
+ m_nMenuFadeAlpha = 0;
+ m_nOptionHighlightTransitionBlend = 0;
+ m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
+}
+#endif
+
CMenuManager::CMenuManager()
{
m_StatsScrollSpeed = 150.0f;
@@ -463,7 +502,7 @@ CMenuManager::Initialise(void)
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DoRWStuffEndOfFrame();
m_AllowNavigation = false;
- m_menuTransitionProgress = -50;
+ m_menuTransitionProgress = -50; // to start from black
m_nMenuFadeAlpha = 0;
m_nCurrOption = 0;
m_nOptionHighlightTransitionBlend = 0;
@@ -1172,6 +1211,32 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
rightText = TheText.Get("FEA_NM3");
}
break;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && i == option.screenOptionOrder) {
+ leftText = (wchar*)option.leftText;
+ if (option.type == FEOPTION_SELECT) {
+ if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
+ option.displayedValue = 0;
+
+ rightText = (wchar*)option.rightTexts[option.displayedValue];
+
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ if (option.drawFunc) {
+ bool isOptionDisabled = false;
+ rightText = option.drawFunc(&isOptionDisabled);
+ if (isOptionDisabled)
+ CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
+ }
+ }
+ } else {
+ debug("A- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, i, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu, option.screen, option.screenOptionOrder);
+ assert(0 && "Custom frontend options is borked");
+ }
+
+ break;
+#endif
}
// Highlight trapezoid
@@ -1326,6 +1391,24 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
}
}
#endif
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ static int lastOption = m_nCurrOption;
+
+ if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) {
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
+ if (option.onlyApplyOnEnter && m_nCurrOption != i)
+ option.displayedValue = *option.value;
+
+ if (m_nCurrOption != lastOption && lastOption == i) {
+ FrontendOption& oldOption = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[lastOption].m_TargetMenu];
+ if (oldOption.type == FEOPTION_DYNAMIC)
+ oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
+ }
+ }
+
+ if (i == MAX_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i + 1].m_EntryName[0] == '\0')
+ lastOption = m_nCurrOption;
+#endif
// TODO(Miami): check
// Sliders
@@ -1955,10 +2038,10 @@ CMenuManager::DrawControllerSetupScreen()
float curOptY = i * rowHeight + yStart;
if (m_nMousePosY > MENU_Y(curOptY) && m_nMousePosY < MENU_Y(rowHeight + curOptY)) {
- if (m_nPrevOption != i && m_nCurrExLayer == HOVEROPTION_LIST)
+ if (m_nOptionMouseHovering != i && m_nCurrExLayer == HOVEROPTION_LIST)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
- m_nPrevOption = i;
+ m_nOptionMouseHovering = i;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_nSelectedListRow = i;
@@ -2660,7 +2743,7 @@ CMenuManager::DrawPlayerSetupScreen()
if (m_nMousePosX > MENU_X_LEFT_ALIGNED(PLAYERSETUP_LIST_LEFT) && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT)) {
if (m_nMousePosY > MENU_Y(rowStartY) && m_nMousePosY < MENU_Y(rowEndY)) {
- m_nPrevOption = rowIdx;
+ m_nOptionMouseHovering = rowIdx;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST;
}
@@ -3023,6 +3106,10 @@ CMenuManager::InitialiseChangedLanguageSettings()
default:
break;
}
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ CustomFrontendOptionsPopulate();
+#endif
}
}
@@ -3618,7 +3705,7 @@ CMenuManager::ProcessButtonPresses(void)
m_nMousePosY < MENU_Y(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Y + MENU_DEFAULT_LINE_HEIGHT)) {
static int oldScreen = m_nCurrScreen;
- m_nPrevOption = rowToCheck;
+ m_nOptionMouseHovering = rowToCheck;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrOption = rowToCheck;
m_bShowMouse = true;
@@ -3632,7 +3719,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
}
if (m_bShowMouse && m_nMenuFadeAlpha == 255) {
- m_nPrevOption = oldOption;
+ m_nOptionMouseHovering = oldOption;
m_nCurrOption = oldOption;
}
}
@@ -3641,7 +3728,7 @@ CMenuManager::ProcessButtonPresses(void)
if (oldOption != m_nCurrOption) {
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LABEL) {
++m_nCurrOption;
- ++m_nPrevOption;
+ ++m_nOptionMouseHovering;
}
m_nOptionHighlightTransitionBlend = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
@@ -3923,7 +4010,7 @@ CMenuManager::ProcessButtonPresses(void)
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_RESUME &&
#endif
(m_nHoverOption == HOVEROPTION_RANDOM_ITEM)) {
- m_nCurrOption = m_nPrevOption;
+ m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
} else if (CPad::GetPad(0)->GetLeftMouseJustDown()) {
@@ -3937,7 +4024,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
} else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) {
- m_nCurrOption = m_nPrevOption;
+ m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
#else
@@ -4024,7 +4111,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
case HOVEROPTION_RANDOM_ITEM:
if (((m_nCurrOption != 0) || (m_nCurrScreen != MENUPAGE_PAUSE_MENU)) {
- m_nCurrOption = m_nPrevOption;
+ m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
break;
@@ -4358,26 +4445,6 @@ CMenuManager::ProcessButtonPresses(void)
InitialiseChangedLanguageSettings();
SaveSettings();
break;
-#ifdef MORE_LANGUAGES
- case MENUACTION_LANG_PL:
- m_PrefsLanguage = LANGUAGE_POLISH;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
- case MENUACTION_LANG_RUS:
- m_PrefsLanguage = LANGUAGE_RUSSIAN;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
- case MENUACTION_LANG_JAP:
- m_PrefsLanguage = LANGUAGE_JAPANESE;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
-#endif
case MENUACTION_POPULATESLOTS_CHANGEMENU:
PcSaveHelper.PopulateSlotInfo();
@@ -4540,7 +4607,6 @@ CMenuManager::ProcessButtonPresses(void)
} else if (m_nCurrScreen == MENUPAGE_CONTROLLER_PC) {
ControlsManager.MakeControllerActionsBlank();
ControlsManager.InitDefaultControlConfiguration();
- MousePointerStateHelper.GetMouseSetUp();
ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp());
#if !defined RW_GL3
if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_bInitialised) {
@@ -4595,6 +4661,33 @@ CMenuManager::ProcessButtonPresses(void)
}
break;
}
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
+ if (option.type == FEOPTION_SELECT) {
+ if (!option.onlyApplyOnEnter) {
+ option.displayedValue++;
+ if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
+ option.displayedValue = 0;
+ }
+ option.changeFunc(option.displayedValue);
+ *option.value = option.displayedValue;
+
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ option.buttonPressFunc(FEOPTION_ACTION_SELECT);
+ } else if (option.type == FEOPTION_REDIRECT) {
+ ChangeScreen(option.to, option.option, true, option.fadeIn);
+ } else if (option.type == FEOPTION_GOBACK) {
+ goBack = true;
+ }
+ } else {
+ debug("B- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder);
+ assert(0 && "Custom frontend options are borked");
+ }
+
+ break;
+#endif
}
}
ProcessOnOffMenuOptions();
@@ -4641,6 +4734,9 @@ CMenuManager::ProcessButtonPresses(void)
if (oldScreen != -1) {
ThingsToDoBeforeLeavingPage();
+ if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) {
+ m_nTotalListRow = 0;
+ }
#ifdef PS2_LIKE_MENU
if (!bottomBarActive &&
@@ -4797,6 +4893,36 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
+ if (option.type == FEOPTION_SELECT) {
+ if (changeValueBy > 0) {
+ option.displayedValue++;
+ if (option.displayedValue >= option.numRightTexts)
+ option.displayedValue = 0;
+ } else {
+ option.displayedValue--;
+ if (option.displayedValue < 0)
+ option.displayedValue = option.numRightTexts - 1;
+ }
+ if (!option.onlyApplyOnEnter) {
+ option.changeFunc(option.displayedValue);
+ *option.value = option.displayedValue;
+ }
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT);
+ }
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
+ }
+ else {
+ debug("C- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder);
+ assert(0 && "Custom frontend options are borked");
+ }
+
+ break;
+#endif
}
ProcessOnOffMenuOptions();
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
@@ -4890,13 +5016,6 @@ CMenuManager::ProcessOnOffMenuOptions()
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
-#ifdef FREE_CAM
- case MENUACTION_FREECAM:
- TheCamera.bFreeCam = !TheCamera.bFreeCam;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
- SaveSettings();
- break;
-#endif
}
}
@@ -5010,7 +5129,7 @@ CMenuManager::ProcessFileActions()
}
}
-// --MIAMI: Done except DxInput things, are they even needed?
+// --MIAMI: Done
void
CMenuManager::SwitchMenuOnAndOff()
{
@@ -5036,7 +5155,12 @@ CMenuManager::SwitchMenuOnAndOff()
m_bMenuActive = !m_bMenuActive;
if (m_bMenuActive) {
- // TODO(Miami): DxInput??
+#if defined RW_D3D9 || defined RWLIBS
+ if (_InputMouseNeedsExclusive()) {
+ _InputShutdownMouse();
+ _InputInitialiseMouse(false);
+ }
+#endif
Initialise();
LoadAllTextures();
@@ -5049,8 +5173,12 @@ CMenuManager::SwitchMenuOnAndOff()
DoRWStuffEndOfFrame();
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DoRWStuffEndOfFrame();
-
- // TODO(Miami): DxInput??
+#if defined RW_D3D9 || defined RWLIBS
+ if (_InputMouseNeedsExclusive()) {
+ _InputShutdownMouse();
+ _InputInitialiseMouse(true);
+ }
+#endif
#ifdef PS2_LIKE_MENU
bottomBarActive = false;
@@ -5095,7 +5223,12 @@ CMenuManager::SwitchMenuOnAndOff()
m_bMenuActive = true;
m_OnlySaveMenu = true;
- // TODO(Miami): DxInput??
+#if defined RW_D3D9 || defined RWLIBS
+ if (_InputMouseNeedsExclusive()) {
+ _InputShutdownMouse();
+ _InputInitialiseMouse(false);
+ }
+#endif
Initialise();
LoadAllTextures();
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 327bf6fa..83d86d5b 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -265,17 +265,9 @@ enum eMenuAction
MENUACTION_DYNAMICACOUSTIC,
MENUACTION_MOUSESTEER,
MENUACTION_UNK110,
-#ifdef MORE_LANGUAGES
- MENUACTION_LANG_PL,
- MENUACTION_LANG_RUS,
- MENUACTION_LANG_JAP,
-#endif
#ifdef IMPROVED_VIDEOMODE
MENUACTION_SCREENMODE,
#endif
-#ifdef FREE_CAM
- MENUACTION_FREECAM,
-#endif
#ifdef LEGACY_MENU_OPTIONS
MENUACTION_CTRLVIBRATION,
MENUACTION_CTRLCONFIG,
@@ -547,7 +539,7 @@ public:
int32 m_nMouseOldPosY;
int32 m_nHoverOption;
bool m_bShowMouse;
- int32 m_nPrevOption;
+ int32 m_nOptionMouseHovering;
bool m_bStartWaitingForKeyBind;
bool m_bWaitingForNewKeyBind;
bool m_bKeyChangeNotProcessed;
@@ -664,6 +656,7 @@ public:
void ScrollDownListByOne();
void PageUpList(bool);
void PageDownList(bool);
+ int8 GetPreviousPageOption();
// uint8 GetNumberOfMenuOptions();
};
@@ -673,6 +666,6 @@ VALIDATE_SIZE(CMenuManager, 0x688);
#endif
extern CMenuManager FrontEndMenuManager;
-
+extern CMenuScreen aScreens[];
#endif \ No newline at end of file
diff --git a/src/core/General.h b/src/core/General.h
index dbf169e9..7ab444a4 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -108,7 +108,7 @@ public:
if (angle >= TWOPI)
angle -= TWOPI;
- return (int)floorf(angle / DEGTORAD(45.0f));
+ return (int)Floor(angle / DEGTORAD(45.0f));
}
// Unlike usual string comparison functions, these don't care about greater or lesser
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.cpp
index 3f9631c8..6fbf597b 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.cpp
@@ -1,6 +1,8 @@
-#pragma once
+#include "common.h"
+#include "Frontend.h"
+#ifdef PC_MENU
-// --MIAMI: Done except commented things
+// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp.
CMenuScreen aScreens[] = {
// MENUPAGE_STATS = 0
@@ -341,3 +343,5 @@ CMenuScreen aScreens[] = {
},
#endif
};
+
+#endif
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 97cc1786..83930c41 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -39,6 +39,7 @@
#include "General.h"
#include "Fluff.h"
#include "Gangs.h"
+#include "platform.h"
#ifdef GTA_PS2
#include "eetypes.h"
@@ -671,7 +672,7 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
#if defined RW_D3D9 || defined RWLIBS
if ( PSGLOBAL(mouse) == nil )
- _InputInitialiseMouse();
+ _InputInitialiseMouse(!FrontEndMenuManager.m_bMenuActive && _InputMouseNeedsExclusive());
if ( PSGLOBAL(mouse) != nil )
{
@@ -725,7 +726,7 @@ void CPad::UpdateMouse()
{
#if defined RW_D3D9 || defined RWLIBS
if ( PSGLOBAL(mouse) == nil )
- _InputInitialiseMouse();
+ _InputInitialiseMouse(!FrontEndMenuManager.m_bMenuActive && _InputMouseNeedsExclusive());
DIMOUSESTATE2 state;
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index c359793c..559a8cd6 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -778,8 +778,8 @@ void CRadar::DrawRadarMap()
DrawRadarMask();
// top left ist (0, 0)
- int x = floorf((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
- int y = ceilf((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
+ int x = Floor((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
+ int y = Ceil((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
StreamRadarSections(x, y);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
@@ -1332,7 +1332,7 @@ void CRadar::Shutdown()
void CRadar::StreamRadarSections(const CVector &posn)
{
- StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f));
+ StreamRadarSections(Floor((2000.0f + posn.x) / 500.0f), Ceil(7.0f - (2000.0f + posn.y) / 500.0f));
}
void CRadar::StreamRadarSections(int32 x, int32 y)
diff --git a/src/core/User.cpp b/src/core/User.cpp
index 56e37ac4..53196d03 100644
--- a/src/core/User.cpp
+++ b/src/core/User.cpp
@@ -74,6 +74,14 @@ CPlaceName::Display()
CHud::SetZoneName(text);
}
+void
+CPlaceName::ProcessAfterFrontEndShutDown(void)
+{
+ CHud::m_pLastZoneName = nil;
+ CHud::m_ZoneState = 0;
+ m_nAdditionalTimer = 250;
+}
+
CCurrentVehicle::CCurrentVehicle()
{
Init();
diff --git a/src/core/User.h b/src/core/User.h
index 153ef57b..dd53a40a 100644
--- a/src/core/User.h
+++ b/src/core/User.h
@@ -16,6 +16,7 @@ public:
void Init();
void Process();
void Display();
+ void ProcessAfterFrontEndShutDown();
};
class CCurrentVehicle
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 87e85da5..3095b36d 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -104,7 +104,7 @@ CTheZones::Init(void)
NavigationZoneArray[0].maxy = 2000.0f;
NavigationZoneArray[0].maxz = 500.0f;
NavigationZoneArray[0].level = LEVEL_GENERIC;
- NavigationZoneArray[0].type = ZONE_NAVIG;
+ NavigationZoneArray[0].type = ZONE_DEFAULT;
m_CurrLevel = LEVEL_GENERIC;
diff --git a/src/core/config.h b/src/core/config.h
index ef2c9b17..e67db1a3 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -285,7 +285,6 @@ 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
// Camera
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future