diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/Frontend.cpp | 1689 | ||||
-rw-r--r-- | src/core/Frontend.h | 94 | ||||
-rw-r--r-- | src/core/MenuScreens.h | 189 | ||||
-rw-r--r-- | src/core/Radar.cpp | 8 | ||||
-rw-r--r-- | src/core/Timer.cpp | 32 | ||||
-rw-r--r-- | src/core/Timer.h | 4 | ||||
-rw-r--r-- | src/core/re3.cpp | 2 |
7 files changed, 1378 insertions, 640 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index beebacf9..a0b70f27 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -8,6 +8,7 @@ #include "Pad.h" #include "Text.h" #include "main.h" +#include "RwHelper.h" #include "Timer.h" #include "Game.h" #include "DMAudio.h" @@ -28,14 +29,31 @@ #include "Renderer.h" #include "CdStream.h" #include "Radar.h" +#include "Stats.h" +#include "Messages.h" -#define DONT_USE_SUSPICIOUS_FUNCS 1 #define TIDY_UP_PBP // ProcessButtonPresses #define MAX_VISIBLE_LIST_ROW 30 -#define SCROLLBAR_MAX_HEIGHT 263.0f // actually it's 273. but calculating it from scrollbar drawing code gives 287. i don't know +#define SCROLLBAR_MAX_HEIGHT 263.0f // not in end result + +#ifdef USE_PRECISE_MEASUREMENT_CONVERTION +#define MILES_IN_METER 0.000621371192f +#define FEET_IN_METER 3.28084f +#else +#define MILES_IN_METER 0.00059880241f +#define FEET_IN_METER 3.33f +#endif + +#define SCROLLABLE_STATS_PAGE +#ifdef SCROLLABLE_STATS_PAGE +#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS) +#else +#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS) +#endif #ifdef MENU_MAP bool CMenuManager::bMenuMapActive = false; +bool CMenuManager::bMapMouseShownOnce = false; float CMenuManager::fMapSize; float CMenuManager::fMapCenterY; float CMenuManager::fMapCenterX; @@ -63,6 +81,7 @@ int8 &CMenuManager::m_PrefsSpeakers = *(int8*)0x95CD7E; int32 &CMenuManager::m_ControlMethod = *(int32*)0x8F5F7C; int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74; // 1 int32 &CMenuManager::m_PrefsLanguage = *(int32*)0x941238; +uint8 CMenuManager::m_PrefsStereoMono; // *(bool*)0x95CDB5; // unused except restore settings bool &CMenuManager::m_PrefsAllowNastyGame = *(bool*)0x5F2E64; // true bool &CMenuManager::m_bStartUpFrontEndRequested = *(bool*)0x95CCF4; @@ -80,26 +99,37 @@ char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74; //[256] "$$\"\"" int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70; // -1 -float &CMenuManager::menuXYpadding = *(float*)0x5F355C; // don't know the original name. MENUACTION_X_MARGIN, never changes -float &CMenuManager::actionTextScaleX = *(float*)0x5F2E40; -float &CMenuManager::actionTextScaleY = *(float*)0x5F2E44; +// This is PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway) +#ifdef FIX_BUGS +CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color +#else +CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255); +#endif + +float menuXYpadding = MENUACTION_POS_Y; // *(float*)0x5F355C; // never changes. not original name +float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE; //*(float*)0x5F2E40; +float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE; //*(float*)0x5F2E44; + +bool holdingScrollBar; // *(bool*)0x628D59; // not original name +int32 CMenuManager::m_SelectedMap; // *(int32*)0x8E2880; +int32 CMenuManager::m_SelectedGameType; // *(int32*)0x942F88; -int32 &CMenuManager::sthWithButtons = *(int32*)0x8E2880; -int32 &CMenuManager::sthWithButtons2 = *(int32*)0x942F88; +// Used in a hidden menu +uint8 CMenuManager::m_PrefsPlayerRed = 255; +uint8 CMenuManager::m_PrefsPlayerGreen = 128; +uint8 CMenuManager::m_PrefsPlayerBlue; // why?? CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8; // Move this somewhere else. float &CRenderer::ms_lodDistScale = *(float*)0x5F726C; // 1.2 -// Stuff not in CMenuManager: uint32 &TimeToStopPadShaking = *(uint32*)0x628CF8; char *&pEditString = *(char**)0x628D00; int32 *&pControlEdit = *(int32**)0x628D08; bool &DisplayComboButtonErrMsg = *(bool*)0x628D14; int32 &MouseButtonJustClicked = *(int32*)0x628D0C; int32 &JoyButtonJustClicked = *(int32*)0x628D10; -bool &holdingScrollBar = *(bool*)0x628D59; //int32 *pControlTemp = 0; #ifndef MASTER @@ -204,8 +234,6 @@ ScaleAndCenterX(float x) #define MENU_Y(y) StretchY(y) #endif -#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS) - #ifdef PS2_LIKE_MENU #define ChangeScreen(screen, option, updateDelay, withReverseAlpha) \ do { \ @@ -245,14 +273,14 @@ ScaleAndCenterX(float x) #define ProcessSlider(value, increaseAction, decreaseAction, hoverStartX, hoverEndX) \ do { \ - lastBarX = DisplaySlider(SCREEN_STRETCH_FROM_RIGHT(MENUSLIDER_X + columnWidth), MENU_Y(bitAboveNextItemY), MENU_Y(smallestSliderBar), MENU_Y(usableLineHeight), MENU_X(MENUSLIDER_UNK), value); \ + lastActiveBarX = DisplaySlider(SCREEN_STRETCH_FROM_RIGHT(MENUSLIDER_X + columnWidth), MENU_Y(bitAboveNextItemY), MENU_Y(smallestSliderBar), MENU_Y(usableLineHeight), MENU_X(MENUSLIDER_UNK), value); \ if (i != m_nCurrOption || !itemsAreSelectable) \ break; \ \ - if (CheckHover(hoverStartX, lastBarX - MENU_X(10.0f), MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \ + if (CheckHover(hoverStartX, lastActiveBarX - MENU_X(10.0f), MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \ m_nHoverOption = decreaseAction; \ \ - if (!CheckHover(MENU_X(10.0f) + lastBarX, hoverEndX, MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \ + if (!CheckHover(MENU_X(10.0f) + lastActiveBarX, hoverEndX, MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \ break; \ \ m_nHoverOption = increaseAction; \ @@ -331,6 +359,11 @@ CMenuManager::PageDownList(bool playSoundOnSuccess) inline void CMenuManager::ThingsToDoBeforeLeavingPage() { +#ifndef MASTER + if (m_nCurrScreen == MENUPAGE_NO_MEMORY_CARD || m_nCurrScreen == MENUPAGE_MEMORY_CARD_DEBUG) { + SaveSettings(); + } +#endif if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) { CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); } else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) { @@ -356,18 +389,18 @@ CMenuManager::ThingsToDoBeforeLeavingPage() // ------ Functions not in the game/inlined ends void -CMenuManager::BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2) +CMenuManager::BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2) { if (!text) return; if (stat2) { - if (aFloat) + if (itsFloat) sprintf(gString2, " %.2f %s %.2f", *(float*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(float*)stat2); else sprintf(gString2, " %d %s %d", *(int*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(int*)stat2); } else if (stat) { - if (aFloat) + if (itsFloat) sprintf(gString2, " %.2f", *(float*)stat); else sprintf(gString2, " %d", *(int*)stat); @@ -378,10 +411,8 @@ CMenuManager::BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2) AsciiToUnicode(gString2, gUString2); } -#if 0 -WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); } -#else -void CMenuManager::CentreMousePointer() +void +CMenuManager::CentreMousePointer() { tagPOINT Point; @@ -395,28 +426,85 @@ void CMenuManager::CentreMousePointer() PSGLOBAL(lastMousePos.y) = SCREEN_HEIGHT / 2; } } -#endif -#if 1 -WRAPPER int CMenuManager::CheckCodesForControls(int32) { EAXJMP(0x48A950); } -#else -void CMenuManager::CheckCodesForControls(int, int) +void +CMenuManager::CheckCodesForControls(int typeOfControl) { - DisplayComboButtonErrMsg = 0; + DisplayComboButtonErrMsg = false; + bool invalidKey = false; + bool escPressed = false; + eControllerType typeToSave; + // GetStartOptionsCntrlConfigScreens(); + e_ControllerAction action = (e_ControllerAction) m_CurrCntrlAction; + + if (typeOfControl == KEYBOARD) { + if (*pControlEdit == rsESC) { + escPressed = true; + } else if (*pControlEdit > rsF3 && *pControlEdit != rsF9 && *pControlEdit != rsLWIN && + *pControlEdit != rsRWIN && *pControlEdit != rsRALT) { + typeToSave = KEYBOARD; + if (ControlsManager.GetControllerKeyAssociatedWithAction(action, KEYBOARD) != rsNULL && + *pControlEdit != ControlsManager.GetControllerKeyAssociatedWithAction(action, KEYBOARD)) { + typeToSave = OPTIONAL_EXTRA; + } + } else { + invalidKey = true; + } + } else if (typeOfControl == MOUSE) { + typeToSave = MOUSE; + } else if (typeOfControl == JOYSTICK) { + typeToSave = JOYSTICK; + if (ControlsManager.GetIsActionAButtonCombo(action)) + DisplayComboButtonErrMsg = true; + } + + ControlsManager.ClearSettingsAssociatedWithAction(action, typeToSave); + if (!DisplayComboButtonErrMsg && !escPressed && !invalidKey) { + if (typeOfControl == KEYBOARD) { + ControlsManager.DeleteMatchingActionInitiators(action, *pControlEdit, KEYBOARD); + ControlsManager.DeleteMatchingActionInitiators(action, *pControlEdit, OPTIONAL_EXTRA); + } else { + if (typeOfControl == MOUSE) { + ControlsManager.DeleteMatchingActionInitiators(action, MouseButtonJustClicked, MOUSE); + } else if (typeOfControl == JOYSTICK) { + ControlsManager.DeleteMatchingActionInitiators(action, JoyButtonJustClicked, JOYSTICK); + } + } + if (typeOfControl == KEYBOARD) { + ControlsManager.SetControllerKeyAssociatedWithAction(action, *pControlEdit, typeToSave); + + } else if (typeOfControl == MOUSE) { + ControlsManager.SetControllerKeyAssociatedWithAction(action, MouseButtonJustClicked, typeToSave); + } else { + if (typeOfControl == JOYSTICK) { + ControlsManager.SetControllerKeyAssociatedWithAction(action, JoyButtonJustClicked, typeToSave); + } + } + pControlEdit = nil; + m_bWaitingForNewKeyBind = false; + m_KeyPressedCode = -1; + m_bStartWaitingForKeyBind = false; + SaveSettings(); + } + + if (escPressed) { + pControlEdit = nil; + m_bWaitingForNewKeyBind = false; + m_KeyPressedCode = -1; + m_bStartWaitingForKeyBind = false; + SaveSettings(); + } } -#endif -#if 0 -WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); } -#else -bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2) +bool +CMenuManager::CheckHover(int x1, int x2, int y1, int y2) { return m_nMousePosX > x1 && m_nMousePosX < x2 && m_nMousePosY > y1 && m_nMousePosY < y2; } -#endif -void CMenuManager::CheckSliderMovement(int value) +void +CMenuManager::CheckSliderMovement(int value) { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_BRIGHTNESS: @@ -452,103 +540,106 @@ void CMenuManager::CheckSliderMovement(int value) SaveSettings(); } -#if 1 -WRAPPER int CMenuManager::CostructStatLine(int) { EAXJMP(0x482800); } -#else -int CMenuManager::CostructStatLine(int) +void +CMenuManager::DisplayHelperText() { + // there was a unused static bool + static uint32 LastFlash = 0; + int32 alpha; -} -#endif + if (m_nHelperTextMsgId != 0 && m_nHelperTextMsgId != 1) { -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER void CMenuManager::DisplayHelperText() { EAXJMP(0x48B490); } -#else -void CMenuManager::DisplayHelperText() -{ - static int32 AlphaText = 255; - static int32 Time = 0; - - if (m_nHelperTextMsgId && m_nHelperTextMsgId != 1) { - if (CTimer::GetTimeInMillisecondsPauseMode() - Time > 10) { - Time = CTimer::GetTimeInMillisecondsPauseMode(); + // FIX: High fps bug +#ifndef FIX_BUGS + if (CTimer::GetTimeInMillisecondsPauseMode() - LastFlash > 10) { + LastFlash = CTimer::GetTimeInMillisecondsPauseMode(); m_nHelperTextAlpha -= 2; + } +#else + static float fadeAlpha = 0.0f; // To keep it precisely + if (m_nHelperTextAlpha >= 255 && fadeAlpha < 250) fadeAlpha = m_nHelperTextAlpha; - if (AlphaText < 1) - ResetHelperText(); + // -2 per every 33 ms (1000.f/30.f - original frame limiter fps) + fadeAlpha -= (frameTime / 33.0f) * 2.0f; + m_nHelperTextAlpha = fadeAlpha; +#endif + if (m_nHelperTextAlpha < 1) + ResetHelperText(); - AlphaText = m_nHelperTextAlpha > 255 ? 255 : m_nHelperTextAlpha; - } + alpha = m_nHelperTextAlpha > 255 ? 255 : m_nHelperTextAlpha; } - wchar *HelperTextToPrint = nil; + CFont::SetCentreOn(); + CFont::SetScale(SCREEN_SCALE_X(SMALLESTTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLESTTEXT_Y_SCALE)); + CFont::SetFontStyle(FONT_HEADING); + // TODO: name this cases? switch (m_nHelperTextMsgId) { - case 0: - HelperTextToPrint = TheText.Get("FET_MIG"); - break; - case 1: - HelperTextToPrint = TheText.Get("FET_APP"); - break; - case 2: - HelperTextToPrint = TheText.Get("FET_HRD"); - break; - case 3: - HelperTextToPrint = TheText.Get("FET_RSO"); - break; - case 4: - HelperTextToPrint = TheText.Get("FET_RSC"); - break; - default: - break; + case 0: + { + int action = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; + if (action != MENUACTION_CHANGEMENU && action != MENUACTION_REDEFCTRL && action != MENUACTION_RESTOREDEF) { + CFont::SetColor(CRGBA(255, 255, 255, 255)); + CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_MIG")); + } + break; + } + case 1: + CFont::SetColor(CRGBA(255, 255, 255, 255)); + CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_APP")); + break; + case 2: + CFont::SetColor(CRGBA(255, 255, 255, alpha)); + CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_HRD")); + break; + case 3: + CFont::SetColor(CRGBA(255, 255, 255, alpha)); + CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_RSO")); + break; + case 4: + CFont::SetColor(CRGBA(255, 255, 255, alpha)); + CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_RSC")); + break; + default: + break; } - - CFont::SetAlignment(ALIGN_CENTER); - CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f)); - CFont::SetFontStyle(FONT_HEADING); - CFont::SetDropColor(CRGBA(0, 0, 0, AlphaText)); - CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE); - CFont::SetColor(CRGBA(255, 255, 255, AlphaText)); - - CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_FROM_BOTTOM(120.0f), HelperTextToPrint); + CFont::SetRightJustifyOff(); } -#endif -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER int CMenuManager::DisplaySlider(float, float, float, float, float, float) { EAXJMP(0x488420); } -#else -int CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightSize, float rectSize, float progress) +int +CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostRightBarSize, float rectSize, float progress) { CRGBA color; - float sizeRange; + float maxBarHeight; - float input = 0.0f; + int lastActiveBarX = 0; + float curBarX = 0.0f; + float spacing = SCREEN_SCALE_X(10.0f); for (int i = 0; i < 16; i++) { - input = i * rectSize/16.0f + x; + curBarX = i * rectSize/16.0f + x; - if (i/16.0f + 1/32.0f < progress) + if (i / 16.0f + 1 / 32.0f < progress) { color = CRGBA(255, 217, 106, FadeIn(255)); - else + lastActiveBarX = curBarX; + } else color = CRGBA(185, 120, 0, FadeIn(255)); - sizeRange = max(leftSize, rightSize); + maxBarHeight = max(mostLeftBarSize, mostRightBarSize); - float _x = i * rectSize/16.0f + x; - float _y = y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f; - float _w = SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x; - float _h = y + sizeRange; - float _s = SCREEN_SCALE_X(2.0f); - CSprite2d::DrawRect(CRect(_x + _s, _y + _s, _w + _s, _h + _s), CRGBA(0, 0, 0, FadeIn(255))); // Shadow - CSprite2d::DrawRect(CRect(i * rectSize/16.0f + x, y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f, SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x, y + sizeRange), color); + float curBarFreeSpace = ((16 - i) * mostLeftBarSize + i * mostRightBarSize) / 16.0f; + float left = curBarX; + float top = y + maxBarHeight - curBarFreeSpace; + float right = spacing + curBarX; + float bottom = y + maxBarHeight; + float shadowOffset = SCREEN_SCALE_X(2.0f); + CSprite2d::DrawRect(CRect(left + shadowOffset, top + shadowOffset, right + shadowOffset, bottom + shadowOffset), CRGBA(0, 0, 0, FadeIn(200))); // Shadow + CSprite2d::DrawRect(CRect(left, top, right, bottom), color); } - return input; + return lastActiveBarX; } -#endif -#if 0 -WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x48AB40); } -#else -void CMenuManager::DoSettingsBeforeStartingAGame() +void +CMenuManager::DoSettingsBeforeStartingAGame() { CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD; if (m_PrefsVsyncDisp != m_PrefsVsync) @@ -563,19 +654,16 @@ void CMenuManager::DoSettingsBeforeStartingAGame() DMAudio.SetMusicFadeVol(0); DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds()); } -#endif -#if 0 -WRAPPER void CMenuManager::Draw() { EAXJMP(0x47AE00); } -#else -void CMenuManager::Draw() +void +CMenuManager::Draw() { CFont::SetBackgroundOff(); CFont::SetPropOn(); CFont::SetCentreOff(); CFont::SetJustifyOn(); CFont::SetBackGroundOnlyTextOn(); - CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENUACTION_X_MARGIN)); + CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH)); switch (m_nCurrScreen) { @@ -617,8 +705,8 @@ void CMenuManager::Draw() } CFont::SetFontStyle(FONT_BANK); - CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * actionTextScaleX), MENU_Y(MENUACTION_SCALE_MULT * actionTextScaleY)); - CFont::SetRightJustifyOff(); // AG used SetAlignment(ALIGN_LEFT); + CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y)); + CFont::SetRightJustifyOff(); CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); // Label @@ -631,6 +719,13 @@ void CMenuManager::Draw() else str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName); break; +#ifndef MASTER + case MENUPAGE_NO_MEMORY_CARD: + case MENUPAGE_MEMORY_CARD_DEBUG: + CFont::SetColor(CRGBA(235, 170, 50, FadeIn(127))); // white in mobile, because all texts are white there + str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName); + break; +#endif case MENUPAGE_SAVE_OVERWRITE_CONFIRM: if (Slots[m_nCurrSaveSlot + 1] == SLOT_EMPTY) str = TheText.Get("FESZ_QZ"); @@ -648,12 +743,20 @@ void CMenuManager::Draw() break; } +#ifndef MASTER + if (m_nCurrScreen == MENUPAGE_NO_MEMORY_CARD || m_nCurrScreen == MENUPAGE_MEMORY_CARD_DEBUG) { + // CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); // it's always like that on PC + CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(210.0), str); + } else +#endif + { #ifdef FIX_BUGS - // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in menu. - CFont::PrintString(MENU_X_LEFT_ALIGNED(MENUACTION_X_MARGIN), MENU_Y(menuXYpadding), str); + // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in here. + CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(menuXYpadding), str); #else - CFont::PrintString(MENUACTION_X_MARGIN, menuXYpadding, str); + CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str); #endif + } } CFont::SetCentreSize(SCREEN_WIDTH); @@ -673,7 +776,7 @@ void CMenuManager::Draw() headerHeight = 240; lineHeight = 24; CFont::SetFontStyle(FONT_HEADING); - CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f)); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); CFont::SetCentreOn(); break; case MENUPAGE_SOUND_SETTINGS: @@ -690,7 +793,7 @@ void CMenuManager::Draw() headerHeight = 0; lineHeight = 20; CFont::SetFontStyle(FONT_HEADING); - CFont::SetScale(MENU_X(actionTextScaleX = 0.55f), MENU_Y(actionTextScaleY = 0.8f)); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = MEDIUMTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = MEDIUMTEXT_Y_SCALE)); CFont::SetRightJustifyOff(); break; case MENUPAGE_CHOOSE_LOAD_SLOT: @@ -700,7 +803,7 @@ void CMenuManager::Draw() headerHeight = 38; lineHeight = 20; CFont::SetFontStyle(FONT_BANK); - CFont::SetScale(MENU_X(actionTextScaleX = SMALLTEXT_X_SCALE), MENU_Y(actionTextScaleY = SMALLTEXT_Y_SCALE)); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE)); CFont::SetRightJustifyOff(); break; case MENUPAGE_NEW_GAME_RELOAD: @@ -712,7 +815,7 @@ void CMenuManager::Draw() headerHeight = 60; lineHeight = 24; CFont::SetFontStyle(FONT_HEADING); - CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f)); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); CFont::SetCentreOn(); break; case MENUPAGE_START_MENU: @@ -720,7 +823,7 @@ void CMenuManager::Draw() headerHeight = 140; lineHeight = 24; CFont::SetFontStyle(FONT_HEADING); - CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f)); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); CFont::SetCentreOn(); break; case MENUPAGE_PAUSE_MENU: @@ -728,7 +831,7 @@ void CMenuManager::Draw() headerHeight = 117; lineHeight = 24; CFont::SetFontStyle(FONT_HEADING); - CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f)); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); CFont::SetCentreOn(); break; #ifdef PS2_SAVE_DIALOG @@ -737,7 +840,7 @@ void CMenuManager::Draw() headerHeight = 60; lineHeight = 24; CFont::SetFontStyle(FONT_BANK); - CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f)); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); break; #endif default: @@ -745,7 +848,7 @@ void CMenuManager::Draw() headerHeight = 40; lineHeight = 24; CFont::SetFontStyle(FONT_HEADING); - CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f)); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); CFont::SetCentreOn(); break; } @@ -759,7 +862,7 @@ void CMenuManager::Draw() if (m_bWaitingForNewKeyBind) itemsAreSelectable = false; - CMenuManager::DrawControllerScreenExtraText(nextYToUse - 8.0f, 350, lineHeight); + DrawControllerScreenExtraText(nextYToUse - 8.0f, MENU_X_LEFT_ALIGNED(350), lineHeight); break; default: break; @@ -794,7 +897,7 @@ void CMenuManager::Draw() case MENUACTION_CHANGEMENU: { switch (aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu) { case MENUPAGE_MULTIPLAYER_MAP: - switch (sthWithButtons) { + switch (m_SelectedMap) { case 0: rightText = TheText.Get("FEM_MA0"); break; @@ -824,7 +927,7 @@ void CMenuManager::Draw() } break; case MENUPAGE_MULTIPLAYER_MODE: - switch (sthWithButtons2) { + switch (m_SelectedGameType) { case 0: rightText = TheText.Get("FEN_TY0"); break; @@ -859,7 +962,7 @@ void CMenuManager::Draw() break; } case MENUACTION_CTRLVIBRATION: - if (CMenuManager::m_PrefsUseVibration) + if (m_PrefsUseVibration) rightText = TheText.Get("FEM_ON"); else rightText = TheText.Get("FEM_OFF"); @@ -1025,23 +1128,23 @@ void CMenuManager::Draw() #endif m_nMousePosY < MENU_Y((nextYToCheck + 2) + usableLineHeight)) { - static int lastHoveringOption = -99; - static int lastScreen = m_nCurrScreen; + static int oldOption = -99; + static int oldScreen = m_nCurrScreen; m_nPrevOption = rowToCheck; if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) { m_nCurrOption = rowToCheck; m_bShowMouse = true; } - if (lastHoveringOption != m_nCurrOption) { - if (lastScreen == m_nCurrScreen && m_bShowMouse) + if (oldOption != m_nCurrOption) { + if (oldScreen == m_nCurrScreen && m_bShowMouse) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); - lastHoveringOption = m_nCurrOption; - lastScreen = m_nCurrScreen; + oldOption = m_nCurrOption; + oldScreen = m_nCurrScreen; } - if (lastScreen == m_nPrevScreen) - lastScreen = m_nCurrScreen; + if (oldScreen == m_nPrevScreen) + oldScreen = m_nCurrScreen; m_nHoverOption = HOVEROPTION_RANDOM_ITEM; foundTheHoveringItem = true; @@ -1124,7 +1227,7 @@ void CMenuManager::Draw() // Sliders // We stretch slider start X here(like original code), because it will always be center of screen - int lastBarX; + int lastActiveBarX; switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { case MENUACTION_BRIGHTNESS: ProcessSlider(m_PrefsBrightness / 512.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH); @@ -1184,21 +1287,18 @@ void CMenuManager::Draw() if (m_nCurrScreen == MENUPAGE_CONTROLLER_SETTINGS) PrintController(); - -/* else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT_OLD) { - CSprite2d::DrawRect(CRect(StretchX(180), MENU_Y(98), StretchX(230), MENU_Y(123)), CRGBA(255, 255, 255, FadeIn(255))); - CSprite2d::DrawRect(CRect(StretchX(181), MENU_Y(99), StretchX(229), MENU_Y(233)), CRGBA(Player color from PickNewPlayerColour, FadeIn(255))); + else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT_OLD) { + CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(180), MENU_Y(98), MENU_X_LEFT_ALIGNED(230), MENU_Y(123)), CRGBA(255, 255, 255, FadeIn(255))); + CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(181), MENU_Y(99), MENU_X_LEFT_ALIGNED(229), MENU_Y(122)), CRGBA(m_PrefsPlayerRed, m_PrefsPlayerGreen, m_PrefsPlayerBlue, FadeIn(255))); } -*/ + } -#endif int CMenuManager::GetNumOptionsCntrlConfigScreens(void) { int number = 0; - switch (m_nCurrScreen) - { + switch (m_nCurrScreen) { case MENUPAGE_CONTROLLER_PC_OLD3: number = 2; break; @@ -1227,12 +1327,12 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 int numOptions = GetNumOptionsCntrlConfigScreens(); int bindingMargin = MENU_X(3.0f); float rowHeight; - switch (CMenuManager::m_ControlMethod) { + switch (m_ControlMethod) { case CONTROL_STANDARD: - rowHeight = 10.7f; + rowHeight = CONTSETUP_STANDARD_ROW_HEIGHT; break; case CONTROL_CLASSIC: - rowHeight = 9.0f; + rowHeight = CONTSETUP_CLASSIC_ROW_HEIGHT; break; default: break; @@ -1302,13 +1402,13 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 controllerAction = PED_LOOKBEHIND; break; case 23: - if (CMenuManager::m_ControlMethod == CONTROL_STANDARD) + if (m_ControlMethod == CONTROL_STANDARD) controllerAction = -1; else controllerAction = PED_1RST_PERSON_LOOK_LEFT; break; case 24: - if (CMenuManager::m_ControlMethod == CONTROL_STANDARD) + if (m_ControlMethod == CONTROL_STANDARD) controllerAction = -1; else controllerAction = PED_1RST_PERSON_LOOK_RIGHT; @@ -1415,15 +1515,19 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 if (column == CONTSETUP_PED_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_PED_COLUMN) { #ifdef FIX_BUGS if (controllerAction == -1) { - CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(190.0f), MENU_Y(bgY + 10)), CRGBA(235, 170, 50, FadeIn(150))); + CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH), + MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150))); } else { - CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(190.0f), MENU_Y(bgY + 10)), CRGBA(255, 217, 106, FadeIn(210))); + CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH), + MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210))); } #else if (controllerAction == -1) { - CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY), MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + 10)), CRGBA(235, 170, 50, FadeIn(150))); + CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY), + MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150))); } else { - CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY), MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + 10)), CRGBA(255, 217, 106, FadeIn(210))); + CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY), + MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210))); } #endif CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); @@ -1432,9 +1536,11 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 } else if (column == CONTSETUP_VEHICLE_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_VEHICLE_COLUMN) { #ifdef FIX_BUGS if (controllerAction == -1) { - CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(190.0f), MENU_Y(bgY + 10)), CRGBA(235, 170, 50, FadeIn(150))); + CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH), + MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150))); } else { - CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(190.0f), MENU_Y(bgY + 10)), CRGBA(255, 217, 106, FadeIn(210))); + CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH), + MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210))); } #else if (controllerAction == -1) { @@ -1553,25 +1659,273 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 } } -#if 1 -WRAPPER void CMenuManager::DrawControllerScreenExtraText(int, int, int) { EAXJMP(0x4892F0); } -#else -void CMenuManager::DrawControllerScreenExtraText(int, int, int) +// TODO: Complete aScreens and test that +void +CMenuManager::DrawControllerScreenExtraText(int yStart, int xStart, int lineHeight) { + int extraTextStart = GetStartOptionsCntrlConfigScreens(); + int numOpts = GetNumOptionsCntrlConfigScreens(); + int spacing = MENU_X(10.0f); + for (int i = extraTextStart; i < extraTextStart + numOpts; i++) { + int numTextsPrinted = 0; + int nextX = xStart; + for (int j = 1; j < 5; j++) { + wchar *text = ControlsManager.GetControllerSettingTextWithOrderNumber((e_ControllerAction)i, (eContSetOrder)j); + if (text) + ++numTextsPrinted; + + if (text) { + // Seperator + if (numTextsPrinted > 1) { + CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT")); + nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX; + } + CFont::PrintString(nextX, MENU_Y(yStart), text); + } + if (text) + nextX = CFont::GetStringWidth(text, true) + spacing + nextX; + } + if (m_nCurrOption == i - extraTextStart && m_bWaitingForNewKeyBind) { + static bool waitingTextVisible = false; + // Seperator + if (numTextsPrinted > 0) { + CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT")); + nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX; + } + static uint32 lastStateChange = 0; + if (CTimer::GetTimeInMillisecondsPauseMode() - lastStateChange > 150) { + waitingTextVisible = !waitingTextVisible; + lastStateChange = CTimer::GetTimeInMillisecondsPauseMode(); + } + if (waitingTextVisible) { + CFont::SetColor(CRGBA(255, 255, 0, FadeIn(255))); + CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_QUE")); + CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); + } + } + yStart += lineHeight; + } + wchar *error = nil; + if (DisplayComboButtonErrMsg) + error = ControlsManager.GetButtonComboText((e_ControllerAction)(m_nCurrOption + extraTextStart)); + + if (error) { + CFont::SetColor(CRGBA(233, 22, 159, 255)); + CFont::PrintString(xStart, MENU_Y(yStart + 10), error); + } } + +void +CMenuManager::DrawControllerSetupScreen() +{ + float rowHeight; + switch (m_ControlMethod) { + case CONTROL_STANDARD: + rowHeight = CONTSETUP_STANDARD_ROW_HEIGHT; + break; + case CONTROL_CLASSIC: + rowHeight = CONTSETUP_CLASSIC_ROW_HEIGHT; + break; + default: + break; + } + CFont::SetBackgroundOff(); + CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT)); + CFont::SetPropOn(); + CFont::SetCentreOff(); + CFont::SetJustifyOn(); + CFont::SetRightJustifyOff(); + CFont::SetBackGroundOnlyTextOn(); + CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); + CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH)); + + // Page header + CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); + CFont::SetRightJustifyOn(); + CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); + CFont::SetFontStyle(FONT_HEADING); + switch (m_ControlMethod) { + case CONTROL_STANDARD: + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), + TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); + break; + case CONTROL_CLASSIC: + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), + TheText.Get("FET_CTI")); + break; + default: + break; + } + wchar *actionTexts[31]; + actionTexts[0] = TheText.Get("FEC_FIR"); + actionTexts[1] = TheText.Get("FEC_NWE"); + actionTexts[2] = TheText.Get("FEC_PWE"); + actionTexts[3] = TheText.Get("FEC_FOR"); + actionTexts[4] = TheText.Get("FEC_BAC"); + actionTexts[5] = TheText.Get("FEC_LEF"); + actionTexts[6] = TheText.Get("FEC_RIG"); + actionTexts[7] = TheText.Get("FEC_ZIN"); + actionTexts[8] = TheText.Get("FEC_ZOT"); + actionTexts[9] = TheText.Get("FEC_EEX"); + actionTexts[10] = TheText.Get("FEC_RAD"); + actionTexts[11] = TheText.Get("FEC_HRN"); + actionTexts[12] = TheText.Get("FEC_SUB"); + actionTexts[13] = TheText.Get("FEC_CMR"); + actionTexts[14] = TheText.Get("FEC_JMP"); + actionTexts[15] = TheText.Get("FEC_SPN"); + actionTexts[16] = TheText.Get("FEC_HND"); + actionTexts[17] = TheText.Get("FEC_TAR"); + if (m_ControlMethod == CONTROL_CLASSIC) { + actionTexts[18] = TheText.Get("FEC_TFL"); + actionTexts[19] = TheText.Get("FEC_TFR"); + actionTexts[20] = TheText.Get("FEC_TFU"); + actionTexts[21] = TheText.Get("FEC_TFD"); + actionTexts[22] = TheText.Get("FEC_LBA"); + actionTexts[23] = TheText.Get("FEC_LOL"); + actionTexts[24] = TheText.Get("FEC_LOR"); + actionTexts[25] = TheText.Get("FEC_LUD"); + actionTexts[26] = TheText.Get("FEC_LDU"); + actionTexts[27] = TheText.Get("FEC_NTR"); + actionTexts[28] = TheText.Get("FEC_PTT"); + actionTexts[29] = TheText.Get("FEC_CEN"); + actionTexts[30] = nil; + } else { + actionTexts[18] = TheText.Get("FEC_TFL"); + actionTexts[19] = TheText.Get("FEC_TFR"); + actionTexts[20] = TheText.Get("FEC_TFU"); + actionTexts[21] = TheText.Get("FEC_TFD"); + actionTexts[22] = TheText.Get("FEC_LBA"); + actionTexts[23] = TheText.Get("FEC_LOL"); + actionTexts[24] = TheText.Get("FEC_LOR"); + actionTexts[25] = nil; + } + + // Gray panel background + CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT), MENU_Y(CONTSETUP_LIST_TOP), + MENU_X_RIGHT_ALIGNED(CONTSETUP_LIST_RIGHT), SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_LIST_BOTTOM)), + CRGBA(200, 200, 50, FadeIn(50))); + + if (m_nCurrExLayer == HOVEROPTION_LIST) + CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255))); + else + CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); + + // List header + CFont::SetFontStyle(FONT_HEADING); + CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT)); + CFont::SetRightJustifyOff(); + CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_1_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CAC")); + CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CFT")); + CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CCR")); + CFont::SetRightJustifyOff(); + CFont::SetScale(MENU_X_LEFT_ALIGNED(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); + CFont::SetFontStyle(FONT_BANK); + int yStart; + if (m_ControlMethod == CONTROL_CLASSIC) + yStart = CONTSETUP_LIST_HEADER_HEIGHT + 29; + else + yStart = CONTSETUP_LIST_HEADER_HEIGHT + 34; + + for (int i = 0; i < ARRAY_SIZE(actionTexts); ++i) { + wchar *actionText = actionTexts[i]; + if (!actionText) + break; + + if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT + 2.0f) && + m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X + CONTSETUP_BOUND_COLUMN_WIDTH)) { + + 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) + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + + m_nPrevOption = i; + if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) { + m_nCurrExLayer = HOVEROPTION_LIST; + m_nSelectedListRow = i; + + // why different number for 3rd column hovering X?? this function is a mess +#ifdef FIX_BUGS + if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH)) { +#else + if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(370.0f)) { #endif + if (m_nSelectedContSetupColumn != CONTSETUP_PED_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST) + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); -#if 1 -WRAPPER void CMenuManager::DrawControllerSetupScreen() { EAXJMP(0x481210); } + m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN; +#ifdef FIX_BUGS + } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH) && m_nMousePosX < SCREEN_WIDTH) { #else -void CMenuManager::DrawControllerSetupScreen() -{ + } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(370.0f) && m_nMousePosX < SCREEN_WIDTH) { +#endif + if (m_nSelectedContSetupColumn != CONTSETUP_VEHICLE_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST) + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + + m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN; + } + } + // what?? + if (m_nHoverOption == HOVEROPTION_SKIN) { + if (i == m_nSelectedListRow) { + m_nHoverOption = HOVEROPTION_NOT_HOVERING; + m_bWaitingForNewKeyBind = true; + m_bStartWaitingForKeyBind = true; + pControlEdit = &m_KeyPressedCode; + } + } else + m_nHoverOption = HOVEROPTION_NOT_HOVERING; + } + } + if (m_nSelectedListRow != 35) + CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); + else if (m_nCurrExLayer == HOVEROPTION_LIST) + CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255))); + + CFont::SetRightJustifyOff(); + if (m_PrefsLanguage != LANGUAGE_GERMAN || i != 20 && i != 21) + CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); + else + CFont::SetScale(MENU_X(0.32f), MENU_Y(SMALLESTTEXT_Y_SCALE)); + + CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_1_X), MENU_Y(i * rowHeight + yStart), actionText); + } + DrawControllerBound(yStart, MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X), rowHeight, CONTSETUP_PED_COLUMN); + DrawControllerBound(yStart, MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), rowHeight, CONTSETUP_VEHICLE_COLUMN); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y)); + + if ((m_nMousePosX > MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT) - CFont::GetStringWidth(TheText.Get("FEDS_TB"), true) + && m_nMousePosX < MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT) && m_nMousePosY > SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM) + && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM - CONTSETUP_BACK_HEIGHT)) || m_nCurrExLayer == HOVEROPTION_BACK) { + m_nHoverOption = HOVEROPTION_BACK; + + } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT + 2.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X + CONTSETUP_BOUND_COLUMN_WIDTH) + && m_nMousePosY > MENU_Y(CONTSETUP_LIST_TOP + CONTSETUP_LIST_HEADER_HEIGHT) && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_LIST_BOTTOM + 5.0f)) { + m_nHoverOption = HOVEROPTION_LIST; + + } else { + m_nHoverOption = HOVEROPTION_NOT_HOVERING; + } + // Back button and it's shadow + CFont::SetFontStyle(FONT_HEADING); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y)); + CFont::SetRightJustifyOn(); + CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90))); + for (int i = 0; i < 2; i++) { + CFont::PrintString(MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT - 2.0f - i), + SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM - 4.0f - i), TheText.Get("FEDS_TB")); + + if (m_nHoverOption == HOVEROPTION_BACK) + CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255))); + else + CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); + } } -#endif -void CMenuManager::DrawFrontEnd() +void +CMenuManager::DrawFrontEnd() { CFont::SetAlphaFade(255.0f); @@ -1628,7 +1982,8 @@ void CMenuManager::DrawFrontEnd() } #ifdef PS2_SAVE_DIALOG -void CMenuManager::DrawFrontEndSaveZone() +void +CMenuManager::DrawFrontEndSaveZone() { CSprite2d::InitPerFrame(); CFont::InitPerFrame(); @@ -1640,7 +1995,7 @@ void CMenuManager::DrawFrontEndSaveZone() m_nMenuFadeAlpha = 255; RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); - CMenuManager::Draw(); + Draw(); CFont::DrawFonts(); @@ -1671,7 +2026,8 @@ void CMenuManager::DrawFrontEndSaveZone() #endif #ifdef PS2_LIKE_MENU -void CMenuManager::DrawFrontEndNormal() +void +CMenuManager::DrawFrontEndNormal() { CSprite2d::InitPerFrame(); CFont::InitPerFrame(); @@ -1747,13 +2103,11 @@ void CMenuManager::DrawFrontEndNormal() reverseAlpha = false; ChangeScreen(pendingScreen, pendingOption, true, false); } else { - float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); - // +20 per every 33 ms (1000.f/30.f - original frame limiter fps) if (!reverseAlpha) - fadeAlpha += (timestep * 100.f) * 20.f / 33.f; + fadeAlpha += (frameTime) * 20.f / 33.f; else - fadeAlpha = max(0.0f, fadeAlpha - (timestep * 100.f) * 30.f / 33.f); + fadeAlpha = max(0.0f, fadeAlpha - (frameTime) * 30.f / 33.f); m_nMenuFadeAlpha = fadeAlpha; } @@ -1762,8 +2116,7 @@ void CMenuManager::DrawFrontEndNormal() if (lastState == 0) fadeAlpha = 255.f; if (reverseAlpha) { - float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); - fadeAlpha -= (timestep * 100.f) * 30.f / 33.f; + fadeAlpha -= (frameTime) * 30.f / 33.f; m_nMenuFadeAlpha = fadeAlpha; } @@ -1785,13 +2138,13 @@ void CMenuManager::DrawFrontEndNormal() RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); switch (m_nCurrScreen) { case MENUPAGE_SKIN_SELECT: - CMenuManager::DrawPlayerSetupScreen(); + DrawPlayerSetupScreen(); break; case MENUPAGE_KEYBOARD_CONTROLS: - CMenuManager::DrawControllerSetupScreen(); + DrawControllerSetupScreen(); break; default: - CMenuManager::Draw(); + Draw(); break; } @@ -1865,7 +2218,8 @@ void CMenuManager::DrawFrontEndNormal() } } #else -void CMenuManager::DrawFrontEndNormal() +void +CMenuManager::DrawFrontEndNormal() { CSprite2d::InitPerFrame(); CFont::InitPerFrame(); @@ -1971,10 +2325,8 @@ void CMenuManager::DrawFrontEndNormal() static float fadeAlpha = 0.0f; if (m_nMenuFadeAlpha == 0 && fadeAlpha > 1.0f) fadeAlpha = 0.0f; - float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); - // +20 per every 33 ms (1000.f/30.f - original frame limiter fps) - fadeAlpha += (timestep * 100.f) * 20.f / 33.f; + fadeAlpha += (frameTime) * 20.f / 33.f; m_nMenuFadeAlpha = fadeAlpha; #else static uint32 LastFade = 0; @@ -2019,13 +2371,13 @@ void CMenuManager::DrawFrontEndNormal() RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); switch (m_nCurrScreen) { case MENUPAGE_SKIN_SELECT: - CMenuManager::DrawPlayerSetupScreen(); + DrawPlayerSetupScreen(); break; case MENUPAGE_KEYBOARD_CONTROLS: - CMenuManager::DrawControllerSetupScreen(); + DrawControllerSetupScreen(); break; default: - CMenuManager::Draw(); + Draw(); break; } @@ -2057,10 +2409,8 @@ void CMenuManager::DrawFrontEndNormal() } #endif -#if 0 -WRAPPER void CMenuManager::DrawPlayerSetupScreen() { EAXJMP(0x47F2B0); } -#else -void CMenuManager::DrawPlayerSetupScreen() +void +CMenuManager::DrawPlayerSetupScreen() { CFont::SetBackgroundOff(); CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT)); @@ -2069,7 +2419,7 @@ void CMenuManager::DrawPlayerSetupScreen() CFont::SetJustifyOn(); CFont::SetRightJustifyOff(); CFont::SetBackGroundOnlyTextOn(); - CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENUACTION_X_MARGIN)); + CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH)); CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); @@ -2118,7 +2468,8 @@ void CMenuManager::DrawPlayerSetupScreen() m_pSelectedSkin->skinNameOriginal[oldLength - 4] = '\0'; // Truncate to 40 bytes-39 chars, idk why. This is done in sepearate function in game. - strncpy(m_pSelectedSkin->skinNameDisplayed, m_pSelectedSkin->skinNameDisplayed, 39); + strncpy(nameTemp, m_pSelectedSkin->skinNameDisplayed, 39); // game doesn't do that, but in our day strncpy to same string is forbidden + strncpy(m_pSelectedSkin->skinNameDisplayed, nameTemp, 39); if (oldLength - 4 > 39) m_pSelectedSkin->skinNameDisplayed[39] = '\0'; @@ -2173,7 +2524,7 @@ void CMenuManager::DrawPlayerSetupScreen() CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT)); CFont::SetRightJustifyOn(); CFont::PrintString(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_DATE_COLUMN_RIGHT), MENU_Y(PLAYERSETUP_LIST_TOP), TheText.Get("FES_DAT")); - switch (CMenuManager::m_PrefsLanguage) { + switch (m_PrefsLanguage) { case LANGUAGE_FRENCH: case LANGUAGE_SPANISH: CFont::SetScale(MENU_X(0.6f), MENU_Y(MENUACTION_SCALE_MULT)); @@ -2343,7 +2694,7 @@ void CMenuManager::DrawPlayerSetupScreen() // Big apply button if (strcmp(m_aSkinName, m_PrefsSkinFile) != 0) { CFont::SetFontStyle(FONT_HEADING); - switch (CMenuManager::m_PrefsLanguage) { + switch (m_PrefsLanguage) { case LANGUAGE_FRENCH: CFont::SetScale(MENU_X(1.1f), MENU_Y(1.9f)); break; @@ -2470,12 +2821,9 @@ void CMenuManager::DrawPlayerSetupScreen() } } -#endif -#if 0 -WRAPPER int CMenuManager::FadeIn(int alpha) { EAXJMP(0x48AC60); } -#else -int CMenuManager::FadeIn(int alpha) +int +CMenuManager::FadeIn(int alpha) { if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS || m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS || @@ -2484,27 +2832,57 @@ int CMenuManager::FadeIn(int alpha) return min(m_nMenuFadeAlpha, alpha); } -#endif -#if 1 -WRAPPER void CMenuManager::FilterOutColorMarkersFromString(uint16, CRGBA &) { EAXJMP(0x4889C0); } -#else -void CMenuManager::FilterOutColorMarkersFromString(uint16, CRGBA &) +void +CMenuManager::FilterOutColorMarkersFromString(wchar *str, CRGBA &newColor) { - + int newIdx = 0; + wchar copy[256], *c; + UnicodeStrcpy(copy, str); + + for (c = copy; *c != '\0'; c++) { + if (*c == '~') { + c++; + switch (*c) { + case 'b': newColor = CRGBA(40, 40, 255, 255); break; + case 'g': newColor = CRGBA(40, 235, 40, 255); break; + // There is no case for "h", is that a mistake? + case 'l': newColor = CRGBA(0, 0, 0, 255); break; + case 'p': newColor = CRGBA(255, 0, 255, 255); break; + case 'r': newColor = CRGBA(255, 0, 0, 255); break; + case 'w': newColor = CRGBA(255, 255, 255, 255); break; + case 'y': newColor = CRGBA(255, 255, 0, 255); break; + } + while (*c != '~') c++; + } else { + str[newIdx++] = *c; + } + } + str[newIdx] = '\0'; } -#endif -#if 1 -WRAPPER int CMenuManager::GetStartOptionsCntrlConfigScreens() { EAXJMP(0x489270); } -#else -int CMenuManager::GetStartOptionsCntrlConfigScreens() +int +CMenuManager::GetStartOptionsCntrlConfigScreens() { - + int number = 0; + switch (m_nCurrScreen) { + case MENUPAGE_CONTROLLER_PC_OLD3: + number = 34; + break; + case MENUPAGE_CONTROLLER_DEBUG: + number = 35; + break; + case MENUPAGE_KEYBOARD_CONTROLS: + number = 0; + break; + default: + break; + } + return number; } -#endif -void CMenuManager::InitialiseChangedLanguageSettings() +void +CMenuManager::InitialiseChangedLanguageSettings() { if (m_bFrontEnd_ReloadObrTxtGxt) { m_bFrontEnd_ReloadObrTxtGxt = false; @@ -2515,7 +2893,7 @@ void CMenuManager::InitialiseChangedLanguageSettings() CGame::frenchGame = false; CGame::germanGame = false; #ifdef MORE_LANGUAGES - switch (CMenuManager::m_PrefsLanguage) { + switch (m_PrefsLanguage) { case LANGUAGE_RUSSIAN: CFont::ReloadFonts(FONT_LANGSET_RUSSIAN); break; @@ -2525,7 +2903,7 @@ void CMenuManager::InitialiseChangedLanguageSettings() } #endif - switch (CMenuManager::m_PrefsLanguage) { + switch (m_PrefsLanguage) { case LANGUAGE_FRENCH: CGame::frenchGame = true; break; @@ -2543,22 +2921,23 @@ void CMenuManager::InitialiseChangedLanguageSettings() } } -void CMenuManager::LoadAllTextures() +void +CMenuManager::LoadAllTextures() { if (m_bSpritesLoaded) return; - CMenuManager::CentreMousePointer(); + CentreMousePointer(); DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0); m_nCurrOption = 0; m_PrefsRadioStation = DMAudio.GetRadioInCar(); if (DMAudio.IsMP3RadioChannelAvailable()) { - if (CMenuManager::m_PrefsRadioStation > USERTRACK) - CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10; - } else if (CMenuManager::m_PrefsRadioStation > CHATTERBOX) - CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9; + if (m_PrefsRadioStation > USERTRACK) + m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10; + } else if (m_PrefsRadioStation > CHATTERBOX) + m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9; CFileMgr::SetDir(""); //CFileMgr::SetDir(""); @@ -2607,10 +2986,9 @@ void CMenuManager::LoadAllTextures() m_bSpritesLoaded = true; CTxdStore::PopCurrentTxd(); } -#if 0 -WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); } -#else -void CMenuManager::LoadSettings() + +void +CMenuManager::LoadSettings() { CFileMgr::SetDirMyDocuments(); int fileHandle = CFileMgr::OpenFile("gta3.set", "r"); @@ -2699,12 +3077,9 @@ void CMenuManager::LoadSettings() strcpy(m_aSkinName, "$$\"\""); } } -#endif -#if 0 -WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); } -#else -void CMenuManager::SaveSettings() +void +CMenuManager::SaveSettings() { static char RubbishString[48] = "stuffmorestuffevenmorestuff etc"; @@ -2747,44 +3122,115 @@ void CMenuManager::SaveSettings() CFileMgr::CloseFile(fileHandle); CFileMgr::SetDir(""); } -#endif -#if 1 -WRAPPER void CMenuManager::MessageScreen(char *) { EAXJMP(0x48B7E0); } -#else -void CMenuManager::MessageScreen(char *) +bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); +void DoRWStuffEndOfFrame(void); + +void +CMenuManager::MessageScreen(const char *text) { + CSprite2d *splash = LoadSplash(nil); + if (!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255)) + return; + + CSprite2d::SetRecipNearClip(); + CSprite2d::InitPerFrame(); + CFont::InitPerFrame(); + DefinedState(); + + RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP); + splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255)); + CFont::SetBackgroundOff(); + CFont::SetPropOn(); + CFont::SetJustifyOn(); + CFont::SetBackGroundOnlyTextOn(); + CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f)); + CFont::SetRightJustifyWrap(SCREEN_SCALE_FROM_RIGHT(170.0f)); + CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(120.0f), SCREEN_SCALE_Y(150.0f), SCREEN_SCALE_FROM_RIGHT(120.0f), SCREEN_SCALE_FROM_BOTTOM(220.0f)), CRGBA(50, 50, 50, 210)); + CFont::SetFontStyle(FONT_BANK); + CFont::SetCentreSize(SCREEN_SCALE_X(380.0f)); + CFont::SetCentreOn(); + CFont::SetColor(CRGBA(255, 217, 106, 255)); + CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE)); + CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(170.0f), TheText.Get(text)); + CFont::DrawFonts(); + DoRWStuffEndOfFrame(); } -#endif -#if 1 -WRAPPER void CMenuManager::PickNewPlayerColour() { EAXJMP(0x488C40); } -#else -void CMenuManager::PickNewPlayerColour() +void +CMenuManager::PickNewPlayerColour() { - + m_PrefsPlayerRed = 0; + m_PrefsPlayerGreen = 0; + m_PrefsPlayerBlue = 0; + while (true) { + int sum = m_PrefsPlayerRed + m_PrefsPlayerGreen + m_PrefsPlayerBlue; + if (sum >= 100 && sum <= 650) + break; + m_PrefsPlayerRed = CGeneral::GetRandomNumber(); + m_PrefsPlayerGreen = CGeneral::GetRandomNumber(); + m_PrefsPlayerBlue = CGeneral::GetRandomNumber(); + } } -#endif -#if 1 -WRAPPER void CMenuManager::PrintBriefs() { EAXJMP(0x484D60); } -#else -void CMenuManager::PrintBriefs() +void +CMenuManager::PrintBriefs() { + CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); + CFont::SetFontStyle(FONT_BANK); + CFont::SetRightJustifyOff(); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why + + float nextY = 40.0f; + CRGBA newColor; + for (int i = 4; i >= 0; i--) { + tPreviousBrief &brief = CMessages::PreviousBriefs[i]; + if (brief.m_pText) { + CMessages::InsertNumberInString(brief.m_pText, + brief.m_nNumber[0], brief.m_nNumber[1], + brief.m_nNumber[2], brief.m_nNumber[3], + brief.m_nNumber[4], brief.m_nNumber[5], gUString); + CMessages::InsertStringInString(gUString, brief.m_pString); + CMessages::InsertPlayerControlKeysInString(gUString); + newColor = TEXT_COLOR; + FilterOutColorMarkersFromString(gUString, newColor); + + // newColor wasn't used at all! let's fix this + bool rgSame = newColor.r == TEXT_COLOR.r && newColor.g == TEXT_COLOR.g; + bool bSame = rgSame && newColor.b == TEXT_COLOR.b; + bool colorNotChanged = bSame +#ifndef FIX_BUGS + && newColor.a == TEXT_COLOR.a +#endif + ; -} + if (!colorNotChanged) { + newColor.r /= 2; + newColor.g /= 2; + newColor.b /= 2; + } +#ifdef FIX_BUGS + newColor.a = FadeIn(255); + // because some colors aren't visible, due to they were made for PS2 + CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); + CFont::SetDropShadowPosition(1); + CFont::SetColor(newColor); #endif + CFont::PrintString(MENU_X_LEFT_ALIGNED(50.0f), nextY, gUString); + nextY += MENU_Y(menuXYpadding); + } + } +} -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER void CMenuManager::PrintErrorMessage() { EAXJMP(0x484F70); } -#else -void CMenuManager::PrintErrorMessage() +// Not sure about name. Not to be confused with CPad::PrintErrorMessage +void +CMenuManager::PrintErrorMessage() { if (!CPad::bDisplayNoControllerMessage && !CPad::bObsoleteControllerMessage) return; - CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_WIDTH - SCREEN_SCALE_X(20.0f), SCREEN_HEIGHT - SCREEN_SCALE_Y(140.0f)), CRGBA(64, 16, 16, 224)); + CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f)), CRGBA(64, 16, 16, 224)); CFont::SetFontStyle(FONT_BANK); CFont::SetBackgroundOff(); CFont::SetPropOn(); @@ -2792,27 +3238,96 @@ void CMenuManager::PrintErrorMessage() CFont::SetJustifyOn(); CFont::SetRightJustifyOff(); CFont::SetBackGroundOnlyTextOn(); - CFont::SetWrapx(SCREEN_WIDTH - 40.0f); - CFont::SetColor(CRGBA(165, 165, 165, 255)); - CFont::SetScale(SCREEN_SCALE_X(0.9f), SCREEN_SCALE_Y(0.9f)); - CFont::PrintString(SCREEN_SCALE_X(40.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(60.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT")); + CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(40.0f)); +#ifdef FIX_BUGS + CFont::PrintString(SCREEN_SCALE_X(50.0f), SCREEN_SCALE_Y(180.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT")); +#else + CFont::PrintString(SCREEN_SCALE_X(50.0f), SCREEN_SCALE_Y(40.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT")); +#endif CFont::DrawFonts(); } -#endif -#if 1 -WRAPPER void CMenuManager::PrintStats() { EAXJMP(0x482100); } -#else -void CMenuManager::PrintStats() +void +CMenuManager::PrintStats() { + int rowNum = ConstructStatLine(99999); + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why + float nextYChange, y, alphaMult; + + // Scroll stats with mouse +#ifdef SCROLLABLE_STATS_PAGE + static float scrollY = 0; + static uint32 lastChange = m_nScreenChangeDelayTimer; + if (CPad::GetPad(0)->GetLeftMouse()) { + scrollY += (m_nMouseOldPosY - m_nMousePosY); + lastChange = CTimer::GetTimeInMillisecondsPauseMode(); + } else { + scrollY += MENU_Y(STATS_SLIDE_Y_PER_SECOND) / 1000.0f * (CTimer::GetTimeInMillisecondsPauseMode() - lastChange); + lastChange = CTimer::GetTimeInMillisecondsPauseMode(); + } +#else + // MENU_Y(30.0f) per second + float scrollY = MENU_Y(STATS_SLIDE_Y_PER_SECOND) * (CTimer::GetTimeInMillisecondsPauseMode() - m_nScreenChangeDelayTimer) / 1000.0f; +#endif + + for (int row = 0; row < rowNum; ++row) { + // Put just got hidden text at the top back to the bottom, in circular fashion + for (y = MENU_Y(STATS_ROW_HEIGHT - 1) * row + SCREEN_HEIGHT - scrollY; MENU_Y(STATS_PUT_BACK_TO_BOTTOM_Y) > y; y += nextYChange) { + nextYChange = (MENU_Y(STATS_ROW_HEIGHT) + rowNum) * MENU_Y(STATS_ROW_HEIGHT - 1); + } + + // If it's still on screen + if (y > 0.0f && SCREEN_HEIGHT > y) { + ConstructStatLine(row); + + // But about to dim from top + if (y - MENU_Y(STATS_BOTTOM_MARGIN) < MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH)) { + if ((y - MENU_Y(STATS_BOTTOM_MARGIN)) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH) < 0.0f) + alphaMult = 0.0f; + else + alphaMult = (y - MENU_Y(STATS_BOTTOM_MARGIN)) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH); + + // About to dim from bottom + } else if (y > SCREEN_SCALE_FROM_BOTTOM(STATS_TOP_DIMMING_AREA_LENGTH) - MENU_Y(STATS_BOTTOM_DIMMING_AREA_LENGTH)) { + if ((SCREEN_SCALE_FROM_BOTTOM(STATS_BOTTOM_DIMMING_AREA_LENGTH) - y) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH) < 0.0f) + alphaMult = 0.0f; + else + alphaMult = (SCREEN_SCALE_FROM_BOTTOM(STATS_BOTTOM_DIMMING_AREA_LENGTH) - y) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH); + } else + alphaMult = 1.0f; + CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255.0f * alphaMult))); + CFont::SetRightJustifyOff(); + CFont::PrintString(MENU_X_LEFT_ALIGNED(STATS_ROW_X_MARGIN), y - MENU_Y(STATS_BOTTOM_MARGIN - STATS_TOP_MARGIN), gUString); + CFont::SetRightJustifyOn(); + CFont::PrintString(MENU_X_RIGHT_ALIGNED(STATS_ROW_X_MARGIN), y - MENU_Y(STATS_BOTTOM_MARGIN - STATS_TOP_MARGIN), gUString2); + } + } + // Game doesn't do that, but it's better + float nextX = MENU_X_LEFT_ALIGNED(STATS_RATING_X); + + CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); + CFont::SetRightJustifyOff(); + CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), TheText.Get("CRIMRA")); nextX += MENU_X(10.0f) + CFont::GetStringWidth(TheText.Get("CRIMRA"), true); + UnicodeStrcpy(gUString, CStats::FindCriminalRatingString()); + CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), gUString); nextX += MENU_X(6.0f) + CFont::GetStringWidth(gUString, true); + sprintf(gString, "%d", CStats::FindCriminalRatingNumber()); + AsciiToUnicode(gString, gUString); + CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), gUString); + + // ::Draw already does that. + /* + CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); + CFont::SetRightJustifyOn(); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); + CFont::PrintString(MENU_X_RIGHT_ALIGNED(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); + */ + CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y)); } -#endif -#if 0 -WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); } -#else -void CMenuManager::Process(void) +void +CMenuManager::Process(void) { m_bMenuStateChanged = false; @@ -2888,8 +3403,8 @@ void CMenuManager::Process(void) m_bStartWaitingForKeyBind = false; else { pControlEdit = CPad::EditCodesForControls(pControlEdit, 1); - JoyButtonJustClicked = 0; - MouseButtonJustClicked = 0; + JoyButtonJustClicked = false; + MouseButtonJustClicked = false; if (CPad::GetPad(0)->GetLeftMouseJustDown()) MouseButtonJustClicked = 1; @@ -2905,13 +3420,13 @@ void CMenuManager::Process(void) JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown(); - int32 TypeOfControl = 0; + int32 TypeOfControl = KEYBOARD; if (JoyButtonJustClicked) - TypeOfControl = 3; + TypeOfControl = JOYSTICK; if (MouseButtonJustClicked) - TypeOfControl = 2; + TypeOfControl = MOUSE; if (*pControlEdit != rsNULL) - TypeOfControl = 0; + TypeOfControl = KEYBOARD; if (!m_bKeyIsOK) { DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); @@ -2919,14 +3434,12 @@ void CMenuManager::Process(void) m_bWaitingForNewKeyBind = false; m_KeyPressedCode = -1; m_bStartWaitingForKeyBind = false; - } - else if (!m_bKeyChangeNotProcessed) { + } else if (!m_bKeyChangeNotProcessed) { if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked) CheckCodesForControls(TypeOfControl); field_535 = true; - } - else { + } else { DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); for (int i = 0; i < 4; i++) ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i); @@ -2940,7 +3453,7 @@ void CMenuManager::Process(void) } } - if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) { + if ((m_nCurrScreen == MENUPAGE_NO_MEMORY_CARD || m_nCurrScreen == MENUPAGE_PS2_LOAD_FAILED) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) { m_nCurrScreen = m_nPrevScreen; m_nCurrOption = 0; } @@ -2965,11 +3478,7 @@ void CMenuManager::Process(void) DMAudio.Service(); } } -#endif -#if 0 -WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); } -#else void CMenuManager::ProcessButtonPresses(void) { @@ -3277,10 +3786,10 @@ CMenuManager::ProcessButtonPresses(void) #ifdef TIDY_UP_PBP if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) { DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0; + m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); } else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) { @@ -3291,82 +3800,82 @@ CMenuManager::ProcessButtonPresses(void) switch (m_nHoverOption) { case HOVEROPTION_RADIO_0: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = HEAD_RADIO; + m_PrefsRadioStation = HEAD_RADIO; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_1: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = DOUBLE_CLEF; + m_PrefsRadioStation = DOUBLE_CLEF; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_2: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = JAH_RADIO; + m_PrefsRadioStation = JAH_RADIO; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_3: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = RISE_FM; + m_PrefsRadioStation = RISE_FM; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_4: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = LIPS_106; + m_PrefsRadioStation = LIPS_106; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_5: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = GAME_FM; + m_PrefsRadioStation = GAME_FM; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_6: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = MSX_FM; + m_PrefsRadioStation = MSX_FM; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_7: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = FLASHBACK; + m_PrefsRadioStation = FLASHBACK; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_8: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = CHATTERBOX; + m_PrefsRadioStation = CHATTERBOX; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_9: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::m_PrefsRadioStation = USERTRACK; + m_PrefsRadioStation = USERTRACK; SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RANDOM_ITEM: @@ -3383,74 +3892,74 @@ CMenuManager::ProcessButtonPresses(void) #ifndef TIDY_UP_PBP switch (m_nHoverOption) { case HOVEROPTION_INCREASE_BRIGHTNESS: - CMenuManager::m_PrefsBrightness = CMenuManager::m_PrefsBrightness + 32; - if (CMenuManager::m_PrefsBrightness < 0) { - CMenuManager::m_PrefsBrightness = 0; + m_PrefsBrightness = m_PrefsBrightness + 32; + if (m_PrefsBrightness < 0) { + m_PrefsBrightness = 0; } - if (510 < CMenuManager::m_PrefsBrightness) { - CMenuManager::m_PrefsBrightness = 511; + if (510 < m_PrefsBrightness) { + m_PrefsBrightness = 511; } SaveSettings(); break; case HOVEROPTION_DECREASE_BRIGHTNESS: - CMenuManager::m_PrefsBrightness = CMenuManager::m_PrefsBrightness - 32; - if (CMenuManager::m_PrefsBrightness < 0) { - CMenuManager::m_PrefsBrightness = 0; + m_PrefsBrightness = m_PrefsBrightness - 32; + if (m_PrefsBrightness < 0) { + m_PrefsBrightness = 0; } - if (510 < CMenuManager::m_PrefsBrightness) { - CMenuManager::m_PrefsBrightness = 511; + if (510 < m_PrefsBrightness) { + m_PrefsBrightness = 511; } SaveSettings(); break; case HOVEROPTION_INCREASE_DRAWDIST: - CMenuManager::m_PrefsLOD = CMenuManager::m_PrefsLOD + (1.0f / 16); + m_PrefsLOD = m_PrefsLOD + (1.0f / 16); m_PrefsLOD = min(1.8f, m_PrefsLOD); - CRenderer::ms_lodDistScale = CMenuManager::m_PrefsLOD; + CRenderer::ms_lodDistScale = m_PrefsLOD; SaveSettings(); break; case HOVEROPTION_DECREASE_DRAWDIST: - CMenuManager::m_PrefsLOD = CMenuManager::m_PrefsLOD - (1.0f / 16); + m_PrefsLOD = m_PrefsLOD - (1.0f / 16); m_PrefsLOD = max(0.8f, m_PrefsLOD); - CRenderer::ms_lodDistScale = CMenuManager::m_PrefsLOD; + CRenderer::ms_lodDistScale = m_PrefsLOD; SaveSettings(); break; case HOVEROPTION_INCREASE_MUSICVOLUME: - CMenuManager::m_PrefsMusicVolume = CMenuManager::m_PrefsMusicVolume + 8; + m_PrefsMusicVolume = m_PrefsMusicVolume + 8; m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127); - DMAudio.SetMusicMasterVolume(uchar)(CMenuManager::m_PrefsMusicVolume); + DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume); SaveSettings(); break; case HOVEROPTION_DECREASE_MUSICVOLUME: - CMenuManager::m_PrefsMusicVolume = CMenuManager::m_PrefsMusicVolume - 8; - if (CMenuManager::m_PrefsMusicVolume < 0) { - CMenuManager::m_PrefsMusicVolume = 0; + m_PrefsMusicVolume = m_PrefsMusicVolume - 8; + if (m_PrefsMusicVolume < 0) { + m_PrefsMusicVolume = 0; } - if (126 < CMenuManager::m_PrefsMusicVolume) { - CMenuManager::m_PrefsMusicVolume = 127; + if (126 < m_PrefsMusicVolume) { + m_PrefsMusicVolume = 127; } - DMAudio.SetMusicMasterVolume(uchar)(CMenuManager::m_PrefsMusicVolume); + DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume); SaveSettings(); break; case HOVEROPTION_INCREASE_SFXVOLUME: - CMenuManager::m_PrefsSFXVolume = CMenuManager::m_PrefsSFXVolume + 8; - if (CMenuManager::m_PrefsSFXVolume < 0) { - CMenuManager::m_PrefsSFXVolume = 0; + m_PrefsSFXVolume = m_PrefsSFXVolume + 8; + if (m_PrefsSFXVolume < 0) { + m_PrefsSFXVolume = 0; } - if (126 < CMenuManager::m_PrefsSFXVolume) { - CMenuManager::m_PrefsSFXVolume = 127; + if (126 < m_PrefsSFXVolume) { + m_PrefsSFXVolume = 127; } - DMAudio.SetEffectsMasterVolume(uchar)(CMenuManager::m_PrefsSFXVolume); + DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume); SaveSettings(); break; case HOVEROPTION_DECREASE_SFXVOLUME: - CMenuManager::m_PrefsSFXVolume = CMenuManager::m_PrefsSFXVolume - 8; - if (CMenuManager::m_PrefsSFXVolume < 0) { - CMenuManager::m_PrefsSFXVolume = 0; + m_PrefsSFXVolume = m_PrefsSFXVolume - 8; + if (m_PrefsSFXVolume < 0) { + m_PrefsSFXVolume = 0; } - if (126 < CMenuManager::m_PrefsSFXVolume) { - CMenuManager::m_PrefsSFXVolume = 127; + if (126 < m_PrefsSFXVolume) { + m_PrefsSFXVolume = 127; } - DMAudio.SetEffectsMasterVolume(uchar)(CMenuManager::m_PrefsSFXVolume); + DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume); SaveSettings(); break; case HOVEROPTION_INCREASE_MOUSESENS: @@ -3664,7 +4173,7 @@ CMenuManager::ProcessButtonPresses(void) strcpy(m_PrefsSkinFile, m_aSkinName); CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); m_nCurrExLayer = HOVEROPTION_BACK; - CMenuManager::SaveSettings(); + SaveSettings(); } m_nHoverOption = HOVEROPTION_NOT_HOVERING; break; @@ -3700,54 +4209,54 @@ CMenuManager::ProcessButtonPresses(void) #ifdef TIDY_UP_PBP assumeIncrease = true; #else - ++CMenuManager::m_PrefsRadioStation; + ++m_PrefsRadioStation; if (DMAudio.IsMP3RadioChannelAvailable()) { - if (CMenuManager::m_PrefsRadioStation > USERTRACK) - CMenuManager::m_PrefsRadioStation = HEAD_RADIO; - } else if (CMenuManager::m_PrefsRadioStation > CHATTERBOX) { - CMenuManager::m_PrefsRadioStation = USERTRACK; + if (m_PrefsRadioStation > USERTRACK) + m_PrefsRadioStation = HEAD_RADIO; + } else if (m_PrefsRadioStation > CHATTERBOX) { + m_PrefsRadioStation = USERTRACK; } SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); #endif break; case MENUACTION_LANG_ENG: m_PrefsLanguage = LANGUAGE_AMERICAN; m_bFrontEnd_ReloadObrTxtGxt = true; - CMenuManager::InitialiseChangedLanguageSettings(); - CMenuManager::SaveSettings(); + InitialiseChangedLanguageSettings(); + SaveSettings(); break; case MENUACTION_LANG_FRE: m_PrefsLanguage = LANGUAGE_FRENCH; m_bFrontEnd_ReloadObrTxtGxt = true; - CMenuManager::InitialiseChangedLanguageSettings(); - CMenuManager::SaveSettings(); + InitialiseChangedLanguageSettings(); + SaveSettings(); break; case MENUACTION_LANG_GER: m_PrefsLanguage = LANGUAGE_GERMAN; m_bFrontEnd_ReloadObrTxtGxt = true; - CMenuManager::InitialiseChangedLanguageSettings(); - CMenuManager::SaveSettings(); + InitialiseChangedLanguageSettings(); + SaveSettings(); break; case MENUACTION_LANG_ITA: m_PrefsLanguage = LANGUAGE_ITALIAN; m_bFrontEnd_ReloadObrTxtGxt = true; - CMenuManager::InitialiseChangedLanguageSettings(); - CMenuManager::SaveSettings(); + InitialiseChangedLanguageSettings(); + SaveSettings(); break; case MENUACTION_LANG_SPA: m_PrefsLanguage = LANGUAGE_SPANISH; m_bFrontEnd_ReloadObrTxtGxt = true; - CMenuManager::InitialiseChangedLanguageSettings(); + InitialiseChangedLanguageSettings(); SaveSettings(); break; #ifdef MORE_LANGUAGES case MENUACTION_LANG_RUS: m_PrefsLanguage = LANGUAGE_RUSSIAN; m_bFrontEnd_ReloadObrTxtGxt = true; - CMenuManager::InitialiseChangedLanguageSettings(); + InitialiseChangedLanguageSettings(); SaveSettings(); break; #endif @@ -3779,7 +4288,7 @@ CMenuManager::ProcessButtonPresses(void) if (changeMenu) { if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) { #ifndef TIDY_UP_PBP - CMenuManager::ResetHelperText(); + ResetHelperText(); if (!m_bGameNotLoaded) ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true); else @@ -3794,6 +4303,9 @@ CMenuManager::ProcessButtonPresses(void) fMapCenterX = SCREEN_WIDTH / 2; fMapCenterY = SCREEN_HEIGHT / 3; fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio(); + bMapMouseShownOnce = false; + CPad::GetPad(0)->Clear(false); + CPad::GetPad(1)->Clear(false); } #endif @@ -3815,7 +4327,7 @@ CMenuManager::ProcessButtonPresses(void) break; } case MENUACTION_NEWGAME: - CMenuManager::DoSettingsBeforeStartingAGame(); + DoSettingsBeforeStartingAGame(); break; case MENUACTION_RELOADIDE: // TODO @@ -3830,7 +4342,7 @@ CMenuManager::ProcessButtonPresses(void) case MENUACTION_MEMCARDSAVECONFIRM: return; case MENUACTION_RESUME_FROM_SAVEZONE: - CMenuManager::RequestFrontEndShutDown(); + RequestFrontEndShutDown(); break; case MENUACTION_MPMAP_LIBERTY: case MENUACTION_MPMAP_REDLIGHT: @@ -3840,8 +4352,8 @@ CMenuManager::ProcessButtonPresses(void) case MENUACTION_MPMAP_INDUSTPARK: case MENUACTION_MPMAP_DOCKS: case MENUACTION_MPMAP_STAUNTON: - sthWithButtons = option - MENUACTION_MPMAP_LIBERTY; - CMenuManager::SaveSettings(); + m_SelectedMap = option - MENUACTION_MPMAP_LIBERTY; + SaveSettings(); ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true); break; case MENUACTION_MPMAP_DEATHMATCH1: @@ -3852,8 +4364,8 @@ CMenuManager::ProcessButtonPresses(void) case MENUACTION_MPMAP_CAPTURE: case MENUACTION_MPMAP_RATRACE: case MENUACTION_MPMAP_DOMINATION: - sthWithButtons2 = option - MENUACTION_MPMAP_DEATHMATCH1; - CMenuManager::SaveSettings(); + m_SelectedGameType = option - MENUACTION_MPMAP_DEATHMATCH1; + SaveSettings(); ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true); break; case MENUACTION_REDEFCTRL: @@ -3874,10 +4386,10 @@ CMenuManager::ProcessButtonPresses(void) break; case MENUACTION_RESUME: #ifndef TIDY_UP_PBP - if (CMenuManager::m_PrefsVsyncDisp != CMenuManager::m_PrefsVsync) { - CMenuManager::m_PrefsVsync = CMenuManager::m_PrefsVsyncDisp; + if (m_PrefsVsyncDisp != m_PrefsVsync) { + m_PrefsVsync = m_PrefsVsyncDisp; } - CMenuManager::RequestFrontEndShutDown(); + RequestFrontEndShutDown(); #else goBack = true; #endif @@ -3929,26 +4441,25 @@ CMenuManager::ProcessButtonPresses(void) break; case MENUACTION_RESTOREDEF: if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) { - CMenuManager::m_PrefsSfxVolume = 102; + m_PrefsSfxVolume = 102; m_PrefsSpeakers = 0; - CMenuManager::m_PrefsMusicVolume = 102; - // unused - // byte_95CDB5 = 0; - CMenuManager::m_PrefsRadioStation = HEAD_RADIO; + m_PrefsMusicVolume = 102; + m_PrefsStereoMono = 0; + m_PrefsRadioStation = HEAD_RADIO; DMAudio.SetMusicMasterVolume(102); - DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); SaveSettings(); } else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { - CMenuManager::m_PrefsFrameLimiter = true; - CMenuManager::m_PrefsBrightness = 256; - CMenuManager::m_PrefsVsyncDisp = true; - CMenuManager::m_PrefsLOD = 1.2f; - CMenuManager::m_PrefsVsync = true; + m_PrefsFrameLimiter = true; + m_PrefsBrightness = 256; + m_PrefsVsyncDisp = true; + m_PrefsLOD = 1.2f; + m_PrefsVsync = true; CRenderer::ms_lodDistScale = 1.2f; - CMenuManager::m_PrefsUseWideScreen = false; - CMenuManager::m_PrefsShowSubtitles = true; + m_PrefsUseWideScreen = false; + m_PrefsShowSubtitles = true; m_nDisplayVideoMode = m_nPrefsVideoMode; CMBlur::BlurOn = true; SaveSettings(); @@ -3962,23 +4473,23 @@ CMenuManager::ProcessButtonPresses(void) PSGLOBAL(joy1)->GetCapabilities(&devCaps); ControlsManager.InitDefaultControlConfigJoyPad(devCaps.dwButtons); } - CMenuManager::m_ControlMethod = CONTROL_STANDARD; + m_ControlMethod = CONTROL_STANDARD; MousePointerStateHelper.bInvertVertically = false; TheCamera.m_fMouseAccelHorzntl = 0.0025f; CVehicle::m_bDisableMouseSteering = true; TheCamera.m_bHeadBob = false; SaveSettings(); } - CMenuManager::SetHelperText(2); + SetHelperText(2); break; case MENUACTION_CTRLMETHOD: #ifndef TIDY_UP_PBP - if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC) { + if (m_ControlMethod == CONTROL_CLASSIC) { CCamera::m_bUseMouse3rdPerson = true; - CMenuManager::m_ControlMethod = CONTROL_STANDARD; + m_ControlMethod = CONTROL_STANDARD; } else { CCamera::m_bUseMouse3rdPerson = false; - CMenuManager::m_ControlMethod = CONTROL_CLASSIC; + m_ControlMethod = CONTROL_CLASSIC; } SaveSettings(); #else @@ -3987,7 +4498,7 @@ CMenuManager::ProcessButtonPresses(void) break; case MENUACTION_LOADRADIO: ChangeScreen(MENUPAGE_SOUND_SETTINGS, 0, true, true); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK"); break; } @@ -3996,7 +4507,7 @@ CMenuManager::ProcessButtonPresses(void) } if (goBack) { - CMenuManager::ResetHelperText(); + ResetHelperText(); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0); #ifdef PS2_LIKE_MENU if (m_nCurrScreen == MENUPAGE_PAUSE_MENU || bottomBarActive) { @@ -4004,10 +4515,10 @@ CMenuManager::ProcessButtonPresses(void) if (m_nCurrScreen == MENUPAGE_PAUSE_MENU) { #endif if (!m_bGameNotLoaded && !m_bMenuStateChanged) { - if (CMenuManager::m_PrefsVsyncDisp != CMenuManager::m_PrefsVsync) { - CMenuManager::m_PrefsVsync = CMenuManager::m_PrefsVsyncDisp; + if (m_PrefsVsyncDisp != m_PrefsVsync) { + m_PrefsVsync = m_PrefsVsyncDisp; } - CMenuManager::RequestFrontEndShutDown(); + RequestFrontEndShutDown(); } // We're already resuming, we don't need further processing. @@ -4020,7 +4531,7 @@ CMenuManager::ProcessButtonPresses(void) #else else if (m_nCurrScreen == MENUPAGE_CHOOSE_SAVE_SLOT) { #endif - CMenuManager::RequestFrontEndShutDown(); + RequestFrontEndShutDown(); } // It's now in ThingsToDoBeforeLeavingPage() #ifndef TIDY_UP_PBP @@ -4068,13 +4579,13 @@ CMenuManager::ProcessButtonPresses(void) if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetPedWalkLeftRight() < 0 || CPad::GetPad(0)->GetDPadLeft()) { static uint32 lastSliderDecrease = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderDecrease > 150) { - CMenuManager::CheckSliderMovement(-1); + CheckSliderMovement(-1); lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode(); } } else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetPedWalkLeftRight() > 0 || CPad::GetPad(0)->GetDPadRight()) { static uint32 lastSliderIncrease = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderIncrease > 150) { - CMenuManager::CheckSliderMovement(1); + CheckSliderMovement(1); lastSliderIncrease = CTimer::GetTimeInMillisecondsPauseMode(); } } @@ -4084,7 +4595,7 @@ CMenuManager::ProcessButtonPresses(void) increase = true; } else if (CPad::GetPad(0)->GetMouseWheelUpJustDown() && m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) { increase = true; - CMenuManager::CheckSliderMovement(1); + CheckSliderMovement(1); m_bShowMouse = true; } @@ -4092,7 +4603,7 @@ CMenuManager::ProcessButtonPresses(void) if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) { if (m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) { decrease = true; - CMenuManager::CheckSliderMovement(-1); + CheckSliderMovement(-1); m_bShowMouse = true; } } @@ -4109,22 +4620,22 @@ CMenuManager::ProcessButtonPresses(void) if (changeValueBy != 0) { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_RADIO: - CMenuManager::m_PrefsRadioStation += changeValueBy; + m_PrefsRadioStation += changeValueBy; DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); if (DMAudio.IsMP3RadioChannelAvailable()) { - if (CMenuManager::m_PrefsRadioStation < HEAD_RADIO) - CMenuManager::m_PrefsRadioStation = USERTRACK; - if (CMenuManager::m_PrefsRadioStation > USERTRACK) - CMenuManager::m_PrefsRadioStation = HEAD_RADIO; + if (m_PrefsRadioStation < HEAD_RADIO) + m_PrefsRadioStation = USERTRACK; + if (m_PrefsRadioStation > USERTRACK) + m_PrefsRadioStation = HEAD_RADIO; } else { - if (CMenuManager::m_PrefsRadioStation < HEAD_RADIO) - CMenuManager::m_PrefsRadioStation = CHATTERBOX; - if (CMenuManager::m_PrefsRadioStation > CHATTERBOX) - CMenuManager::m_PrefsRadioStation = HEAD_RADIO; + if (m_PrefsRadioStation < HEAD_RADIO) + m_PrefsRadioStation = CHATTERBOX; + if (m_PrefsRadioStation > CHATTERBOX) + m_PrefsRadioStation = HEAD_RADIO; } - CMenuManager::SaveSettings(); - DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + SaveSettings(); + DMAudio.SetRadioInCar(m_PrefsRadioStation); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case MENUACTION_SCREENRES: @@ -4160,15 +4671,15 @@ CMenuManager::ProcessButtonPresses(void) m_PrefsSpeakers -= changeValueBy; m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2); DMAudio.SetSpeakerConfig(m_PrefsSpeakers); - CMenuManager::SaveSettings(); + SaveSettings(); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); } break; case MENUACTION_CTRLMETHOD: - CMenuManager::m_ControlMethod = !m_ControlMethod; + m_ControlMethod = !m_ControlMethod; CCamera::m_bUseMouse3rdPerson = !m_ControlMethod; DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); - CMenuManager::SaveSettings(); + SaveSettings(); break; } ProcessOnOffMenuOptions(); @@ -4182,12 +4693,9 @@ CMenuManager::ProcessButtonPresses(void) } } } -#endif -#if 0 -WRAPPER void CMenuManager::ProcessOnOffMenuOptions() { EAXJMP(0x48AE60); } -#else -void CMenuManager::ProcessOnOffMenuOptions() +void +CMenuManager::ProcessOnOffMenuOptions() { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_CTRLVIBRATION: @@ -4265,7 +4773,9 @@ void CMenuManager::ProcessOnOffMenuOptions() DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); break; case MENUACTION_MP_PLAYERCOLOR: - assert(0 && "Not implemented"); + PickNewPlayerColour(); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + SaveSettings(); break; case MENUACTION_SHOWHEADBOB: TheCamera.m_bHeadBob = !TheCamera.m_bHeadBob; @@ -4290,34 +4800,29 @@ void CMenuManager::ProcessOnOffMenuOptions() break; } } -#endif -void CMenuManager::RequestFrontEndShutDown() +void +CMenuManager::RequestFrontEndShutDown() { m_bShutDownFrontEndRequested = true; DMAudio.ChangeMusicMode(MUSICMODE_GAME); } -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER void CMenuManager::RequestFrontEndStartUp() { EAXJMP(0x488770); } -#else -void CMenuManager::RequestFrontEndStartUp() +void +CMenuManager::RequestFrontEndStartUp() { m_bStartUpFrontEndRequested = true; } -#endif -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER void CMenuManager::ResetHelperText() { EAXJMP(0x48B470); } -#else -void CMenuManager::ResetHelperText() +void +CMenuManager::ResetHelperText() { m_nHelperTextMsgId = 0; m_nHelperTextAlpha = 300; } -#endif -void CMenuManager::SaveLoadFileError_SetUpErrorScreen() +void +CMenuManager::SaveLoadFileError_SetUpErrorScreen() { switch (PcSaveHelper.nErrorCode) { case SAVESTATUS_ERR_SAVE_CREATE: @@ -4341,27 +4846,22 @@ void CMenuManager::SaveLoadFileError_SetUpErrorScreen() } } -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER void CMenuManager::SetHelperText(int text) { EAXJMP(0x48B450); } -#else -void CMenuManager::SetHelperText(int text) +void +CMenuManager::SetHelperText(int text) { m_nHelperTextMsgId = text; m_nHelperTextAlpha = 300; } -#endif -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER void CMenuManager::ShutdownJustMenu() { EAXJMP(0x488920); } -#else -void CMenuManager::ShutdownJustMenu() +void +CMenuManager::ShutdownJustMenu() { m_bMenuActive = false; CTimer::EndUserPause(); } -#endif -float CMenuManager::StretchX(float x) +float +CMenuManager::StretchX(float x) { if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) return x; @@ -4379,10 +4879,8 @@ float CMenuManager::StretchY(float y) return SCREEN_STRETCH_Y(y); } -#if 0 -WRAPPER void CMenuManager::SwitchMenuOnAndOff() { EAXJMP(0x488790); } -#else -void CMenuManager::SwitchMenuOnAndOff() +void +CMenuManager::SwitchMenuOnAndOff() { bool menuWasActive = !!m_bMenuActive; @@ -4414,7 +4912,7 @@ void CMenuManager::SwitchMenuOnAndOff() m_bStartUpFrontEndRequested = false; pControlEdit = nil; m_bShutDownFrontEndRequested = false; - DisplayComboButtonErrMsg = 0; + DisplayComboButtonErrMsg = false; CPad::GetPad(0)->Clear(0); CPad::GetPad(1)->Clear(0); m_nCurrScreen = MENUPAGE_NONE; @@ -4449,12 +4947,9 @@ void CMenuManager::SwitchMenuOnAndOff() m_bStartUpFrontEndRequested = false; m_bShutDownFrontEndRequested = false; } -#endif -#if 0 -WRAPPER void CMenuManager::UnloadTextures() { EAXJMP(0x47A440); } -#else -void CMenuManager::UnloadTextures() +void +CMenuManager::UnloadTextures() { if (!m_bSpritesLoaded) return; @@ -4478,26 +4973,34 @@ void CMenuManager::UnloadTextures() m_bSpritesLoaded = false; } -#endif -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); } -#else -void CMenuManager::WaitForUserCD() +void +CMenuManager::WaitForUserCD() { - LoadSplash(0); - if (!RsGlobal.quit) { - HandleExit(); - CPad::UpdatePads(); - MessageScreen("NO_PCCD"); - - if (GetPadBack()) { - m_bQuitGameNoCD = true; - RsEventHandler(rsQUITAPP, 0); - } + CSprite2d *splash; + char *splashscreen = nil; + +#ifndef RANDOMSPLASH + if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame) + splashscreen = "mainsc2"; + else + splashscreen = "mainsc1"; +#endif + + splash = LoadSplash(splashscreen); + + if (RsGlobal.quit) + return; + + HandleExit(); + CPad::UpdatePads(); + MessageScreen("NO_PCCD"); + + if (CPad::GetPad(0)->GetEscapeJustDown()) { + m_bQuitGameNoCD = true; + RsEventHandler(rsQUITAPP, nil); } } -#endif void CMenuManager::PrintController(void) @@ -4760,7 +5263,7 @@ CMenuManager::PrintMap(void) fMapCenterX + halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255))); } - if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) { + if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) { m_aMapSprites[MAPTOP3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - fMapSize, fMapCenterX + fMapSize, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255))); } @@ -4775,47 +5278,55 @@ CMenuManager::PrintMap(void) fMapCenterX + halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255))); } - if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) { + if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) { m_aMapSprites[MAPMID3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - halfTile, fMapCenterX + fMapSize, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255))); } - if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - halfTile) { + if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY + halfTile) { m_aMapSprites[MAPBOT1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY + halfTile, fMapCenterX - halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255))); } - if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) { + if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) { m_aMapSprites[MAPBOT2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY + halfTile, fMapCenterX + halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255))); } - if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) { + if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) { m_aMapSprites[MAPBOT3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY + halfTile, fMapCenterX + fMapSize, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255))); } CRadar::DrawBlips(); - if (CPad::GetPad(0)->GetRightMouseJustDown()) { - if (m_nMousePosY > fMapCenterY - fMapSize && m_nMousePosY < fMapCenterY + fMapSize && - m_nMousePosX > fMapCenterX - fMapSize && m_nMousePosX < fMapCenterX + fMapSize) { + CVector2D mapPoint; + mapPoint.x = m_nMousePosX; + mapPoint.y = m_nMousePosY; - float diffX = fMapCenterX - fMapSize, diffY = fMapCenterY - fMapSize; - float x = ((m_nMousePosX - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f; - float y = 2000.0f - ((m_nMousePosY - diffY) / (fMapSize * 2)) * 4000.0f; - CRadar::ToggleTargetMarker(x, y); - } + if (m_bShowMouse) { + bMapMouseShownOnce = true; + } else if (!bMapMouseShownOnce) { + mapPoint.x = SCREEN_WIDTH / 2; + mapPoint.y = SCREEN_HEIGHT / 2; } - if (CPad::GetPad(0)->GetCrossJustDown()) { - if (SCREEN_HEIGHT / 2 > fMapCenterY - fMapSize && SCREEN_HEIGHT / 2 < fMapCenterY + fMapSize && - SCREEN_WIDTH / 2 > fMapCenterX - fMapSize && SCREEN_WIDTH / 2 < fMapCenterX + fMapSize) { + CSprite2d::DrawRect(CRect(mapPoint.x - MENU_X(1.0f), 0.0f, + mapPoint.x + MENU_X(1.0f), SCREEN_HEIGHT), + CRGBA(0, 0, 0, 150)); + CSprite2d::DrawRect(CRect(0.0f, mapPoint.y + MENU_X(1.0f), + SCREEN_WIDTH, mapPoint.y - MENU_X(1.0f)), + CRGBA(0, 0, 0, 150)); + + if (CPad::GetPad(0)->GetRightMouseJustDown() || CPad::GetPad(0)->GetCrossJustDown()) { + if (mapPoint.y > fMapCenterY - fMapSize && mapPoint.y < fMapCenterY + fMapSize && + mapPoint.x > fMapCenterX - fMapSize && mapPoint.x < fMapCenterX + fMapSize) { float diffX = fMapCenterX - fMapSize, diffY = fMapCenterY - fMapSize; - float x = ((SCREEN_WIDTH / 2 - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f; - float y = 2000.0f - ((SCREEN_HEIGHT / 2 - diffY) / (fMapSize * 2)) * 4000.0f; + float x = ((mapPoint.x - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f; + float y = 2000.0f - ((mapPoint.y - diffY) / (fMapSize * 2)) * 4000.0f; CRadar::ToggleTargetMarker(x, y); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); } } @@ -4838,14 +5349,14 @@ CMenuManager::PrintMap(void) fMapCenterY -= CPad::GetPad(0)->GetLeftStickY() / 128.0f * 20.0f; } - if (CPad::GetPad(0)->GetMouseWheelDown() || CPad::GetPad(0)->GetPageUp() || CPad::GetPad(0)->GetRightShoulder2()) { + if (CPad::GetPad(0)->GetMouseWheelDown() || CPad::GetPad(0)->GetPageDown() || CPad::GetPad(0)->GetRightShoulder2()) { if (CPad::GetPad(0)->GetMouseWheelDown()) - ZOOM(m_nMousePosX, m_nMousePosY, false); + ZOOM(mapPoint.x, mapPoint.y, false); else ZOOM(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, false); - } else if (CPad::GetPad(0)->GetMouseWheelUp() || CPad::GetPad(0)->GetPageDown() || CPad::GetPad(0)->GetRightShoulder1()) { + } else if (CPad::GetPad(0)->GetMouseWheelUp() || CPad::GetPad(0)->GetPageUp() || CPad::GetPad(0)->GetRightShoulder1()) { if (CPad::GetPad(0)->GetMouseWheelUp()) - ZOOM(m_nMousePosX, m_nMousePosY, true); + ZOOM(mapPoint.x, mapPoint.y, true); else ZOOM(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, true); } @@ -4880,11 +5391,11 @@ CMenuManager::PrintMap(void) text = TheText.Get(key); CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), text); nextX += CFont::GetStringWidth(text, true) + MENU_X(extraSpace); TEXT_PIECE("FEC_MWF", 3.0f); - TEXT_PIECE("FEC_PGD", 1.0f); + TEXT_PIECE("FEC_PGU", 1.0f); TEXT_PIECE("FEC_IBT", 1.0f); TEXT_PIECE("FEC_ZIN", 20.0f); TEXT_PIECE("FEC_MWB", 3.0f); - TEXT_PIECE("FEC_PGU", 1.0f); + TEXT_PIECE("FEC_PGD", 1.0f); TEXT_PIECE("FEC_IBT", 1.0f); CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_ZOT")); nextX = MENU_X(30.0f); nextY -= 11.0f; TEXT_PIECE("FEC_UPA", 2.0f); @@ -4903,6 +5414,179 @@ CMenuManager::PrintMap(void) #undef ZOOM #endif +// rowIdx 99999 returns total numbers of rows. otherwise it returns 0. +int +CMenuManager::ConstructStatLine(int rowIdx) +{ +#define STAT_LINE(str, left, isFloat, right) \ + do { \ + if(counter == rowIdx){ \ + BuildStatLine(str, left, isFloat, right); \ + return 0; \ + } counter++; \ + } while(0) + + int counter = 0, nTemp; + + STAT_LINE("PL_STAT", nil, false, nil); + + int percentCompleted = (CStats::TotalProgressInGame == 0 ? 0 : + CStats::ProgressMade * 100.0f / (CGame::nastyGame ? CStats::TotalProgressInGame : CStats::TotalProgressInGame - 1)); + percentCompleted = min(percentCompleted, 100); + + STAT_LINE("PER_COM", &percentCompleted, false, nil); + STAT_LINE("NMISON", &CStats::MissionsGiven, false, nil); + STAT_LINE("FEST_MP", &CStats::MissionsPassed, 0, &CStats::TotalNumberMissions); + if (CGame::nastyGame) { + STAT_LINE("FEST_RP", &CStats::NumberKillFrenziesPassed, 0, &CStats::TotalNumberKillFrenzies); + } + + CPlayerInfo &player = CWorld::Players[CWorld::PlayerInFocus]; + float packagesPercent = 0.0f; + if (player.m_nTotalPackages != 0) + packagesPercent = player.m_nCollectedPackages * 100.0f / player.m_nTotalPackages; + + STAT_LINE("PERPIC", &packagesPercent, 0, &(nTemp = 100)); + STAT_LINE("NOUNIF", &CStats::TotalNumberOfUniqueJumps, 0, &CStats::NumberOfUniqueJumpsFound); + STAT_LINE("DAYSPS", &CStats::DaysPassed, false, nil); + if (CGame::nastyGame) { + STAT_LINE("PE_WAST", &CStats::PeopleKilledByPlayer, false, nil); + STAT_LINE("PE_WSOT", &CStats::PeopleKilledByOthers, false, nil); + } + STAT_LINE("CAR_EXP", &CStats::CarsExploded, false, nil); + STAT_LINE("TM_BUST", &CStats::TimesArrested, false, nil); + STAT_LINE("TM_DED", &CStats::TimesDied, false, nil); + STAT_LINE("GNG_WST", &(nTemp = CStats::PedsKilledOfThisType[PEDTYPE_GANG9] + CStats::PedsKilledOfThisType[PEDTYPE_GANG8] + + CStats::PedsKilledOfThisType[PEDTYPE_GANG7] + CStats::PedsKilledOfThisType[PEDTYPE_GANG6] + + CStats::PedsKilledOfThisType[PEDTYPE_GANG5] + CStats::PedsKilledOfThisType[PEDTYPE_GANG4] + + CStats::PedsKilledOfThisType[PEDTYPE_GANG3] + CStats::PedsKilledOfThisType[PEDTYPE_GANG2] + + CStats::PedsKilledOfThisType[PEDTYPE_GANG1]), false, nil); + STAT_LINE("DED_CRI", &(nTemp = CStats::PedsKilledOfThisType[PEDTYPE_CRIMINAL]), false, nil); + STAT_LINE("HEL_DST", &CStats::HelisDestroyed, false, nil); + STAT_LINE("KGS_EXP", &CStats::KgsOfExplosivesUsed, false, nil); + STAT_LINE("ACCURA", &(nTemp = (CStats::InstantHitsFiredByPlayer == 0 ? 0 : + CStats::InstantHitsHitByPlayer * 100.0f / CStats::InstantHitsFiredByPlayer)), false, nil); + + if (CStats::ElBurroTime > 0) { + STAT_LINE("ELBURRO", &CStats::ElBurroTime, false, nil); + } + if (CStats::Record4x4One > 0) { + STAT_LINE("FEST_R1", &CStats::Record4x4One, false, nil); + } + if (CStats::Record4x4Two > 0) { + STAT_LINE("FEST_R2", &CStats::Record4x4Two, false, nil); + } + if (CStats::Record4x4Three > 0) { + STAT_LINE("FEST_R3", &CStats::Record4x4Three, false, nil); + } + if (CStats::Record4x4Mayhem > 0) { + STAT_LINE("FEST_RM", &CStats::Record4x4Mayhem, false, nil); + } + if (CStats::LongestFlightInDodo > 0) { + STAT_LINE("FEST_LF", &CStats::LongestFlightInDodo, false, nil); + } + if (CStats::TimeTakenDefuseMission > 0) { + STAT_LINE("FEST_BD", &CStats::TimeTakenDefuseMission, false, nil); + } + STAT_LINE("CAR_CRU", &CStats::CarsCrushed, false, nil); + + if (CStats::HighestScores[0] > 0) { + STAT_LINE("FEST_BB", nil, false, nil); + STAT_LINE("FEST_H0", &CStats::HighestScores[0], false, nil); + } + if (CStats::HighestScores[4] + CStats::HighestScores[3] + CStats::HighestScores[2] + CStats::HighestScores[1] > 0) { + STAT_LINE("FEST_GC", nil, false, nil); + } + if (CStats::HighestScores[1] > 0) { + STAT_LINE("FEST_H1", &CStats::HighestScores[1], false, nil); + } + if (CStats::HighestScores[2] > 0) { + STAT_LINE("FEST_H2", &CStats::HighestScores[2], false, nil); + } + if (CStats::HighestScores[3] > 0) { + STAT_LINE("FEST_H3", &CStats::HighestScores[3], false, nil); + } + if (CStats::HighestScores[4] > 0) { + STAT_LINE("FEST_H4", &CStats::HighestScores[4], false, nil); + } + + switch (m_PrefsLanguage) { + case LANGUAGE_AMERICAN: +#ifndef USE_MEASUREMENTS_IN_METERS + float fTemp; + STAT_LINE("FEST_DF", &(fTemp = CStats::DistanceTravelledOnFoot * MILES_IN_METER), true, nil); + STAT_LINE("FEST_DC", &(fTemp = CStats::DistanceTravelledInVehicle * MILES_IN_METER), true, nil); + STAT_LINE("MMRAIN", &CStats::mmRain, false, nil); + STAT_LINE("MXCARD", &(fTemp = CStats::MaximumJumpDistance * FEET_IN_METER), true, nil); + STAT_LINE("MXCARJ", &(fTemp = CStats::MaximumJumpHeight * FEET_IN_METER), true, nil); + break; +#endif + case LANGUAGE_FRENCH: + case LANGUAGE_GERMAN: + case LANGUAGE_ITALIAN: + case LANGUAGE_SPANISH: +#ifdef MORE_LANGUAGES + case LANGUAGE_RUSSIAN: +#endif + STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, true, nil); + STAT_LINE("FESTDCM", &CStats::DistanceTravelledInVehicle, true, nil); + STAT_LINE("MMRAIN", &CStats::mmRain, false, nil); + STAT_LINE("MXCARDM", &CStats::MaximumJumpDistance, true, nil); + STAT_LINE("MXCARJM", &CStats::MaximumJumpHeight, true, nil); + break; + default: + break; + } + + STAT_LINE("MXFLIP", &CStats::MaximumJumpFlips, false, nil); + STAT_LINE("MXJUMP", &CStats::MaximumJumpSpins, false, nil); + STAT_LINE("BSTSTU", nil, false, nil); + + if (counter == rowIdx) { + gUString[0] = '\0'; + switch (CStats::BestStuntJump) { + case 1: + UnicodeStrcpy(gUString2, TheText.Get("INSTUN")); + return 0; + case 2: + UnicodeStrcpy(gUString2, TheText.Get("PRINST")); + return 0; + case 3: + UnicodeStrcpy(gUString2, TheText.Get("DBINST")); + return 0; + case 4: + UnicodeStrcpy(gUString2, TheText.Get("DBPINS")); + return 0; + case 5: + UnicodeStrcpy(gUString2, TheText.Get("TRINST")); + return 0; + case 6: + UnicodeStrcpy(gUString2, TheText.Get("PRTRST")); + return 0; + case 7: + UnicodeStrcpy(gUString2, TheText.Get("QUINST")); + return 0; + case 8: + UnicodeStrcpy(gUString2, TheText.Get("PQUINS")); + return 0; + default: + UnicodeStrcpy(gUString2, TheText.Get("NOSTUC")); + return 0; + } + } + counter++; + STAT_LINE("PASDRO", &CStats::PassengersDroppedOffWithTaxi, false, nil); + STAT_LINE("MONTAX", &CStats::MoneyMadeWithTaxi, false, nil); + STAT_LINE("FEST_LS", &CStats::LivesSavedWithAmbulance, false, nil); + STAT_LINE("FEST_HA", &CStats::HighestLevelAmbulanceMission, false, nil); + STAT_LINE("FEST_CC", &CStats::CriminalsCaught, false, nil); + STAT_LINE("FEST_FE", &CStats::FiresExtinguished, false, nil); + STAT_LINE("DAYPLC", &(nTemp = CTimer::GetTimeInMilliseconds() + 100), false, nil); + return counter; + +#undef STAT_LINE +} + #if 0 uint8 CMenuManager::GetNumberOfMenuOptions() { @@ -4918,11 +5602,8 @@ uint8 CMenuManager::GetNumberOfMenuOptions() #endif STARTPATCHES -#if DONT_USE_SUSPICIOUS_FUNCS -#else for (int i = 1; i < ARRAY_SIZE(aScreens); i++) Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]); -#endif InjectHook(0x4856F0, &CMenuManager::ProcessButtonPresses, PATCH_JUMP); InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP); InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP); diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 20cf9e42..a1ee53f2 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -7,28 +7,11 @@ #define MENUHEADER_WIDTH 0.84f #define MENUHEADER_HEIGHT 1.6f -#define MENUACTION_X_MARGIN 40.0f +#define MENU_X_MARGIN 40.0f #define MENUACTION_POS_Y 60.0f -#define MENUACTION_WIDTH 0.38f +#define MENUACTION_WIDTH 38.0f #define MENUACTION_SCALE_MULT 0.9f -#define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f -#define MENUCOLUMN_MAX_Y 149.0f -#define MENUCOLUMN_MID_Y 100.0f -#define MENUCOLUMN_MIN_Y 110.0f -#define MENUCOLUMN_PAUSE_Y 25.0f -#define MENUCOLUMN_START_Y 9.0f -#define MENUCOLUMN_FEDS 139.0f - -#define MENUCOLUMN_SAVE_X 121.0f -#define MENUCOLUMN_SAVE_Y 111.0f - -#define MENUCOLUMN_SPACING_MAX 24.0f -#define MENUCOLUMN_SPACING_MIN 20.0f - -#define MENUSELECT_BOX_MAX 20.5f -#define MENUSELECT_BOX_MIN 17.0f - #ifndef ASPECT_RATIO_SCALE #define MENURADIO_ICON_X 31.5f #else @@ -38,12 +21,13 @@ #define MENURADIO_ICON_W 60.0f #define MENURADIO_ICON_H 60.0f -#define MENUDROP_COLOR_A 150 -#define MENUDROP_COLOR_SIZE -1 - #define MENUSLIDER_X 256.0f #define MENUSLIDER_UNK 256.0f +#define BIGTEXT_X_SCALE 0.75f +#define BIGTEXT_Y_SCALE 0.9f +#define MEDIUMTEXT_X_SCALE 0.55f +#define MEDIUMTEXT_Y_SCALE 0.8f #define SMALLTEXT_X_SCALE 0.45f #define SMALLTEXT_Y_SCALE 0.7f #define SMALLESTTEXT_X_SCALE 0.4f @@ -67,6 +51,33 @@ #define PLAYERSETUP_LIST_BODY_TOP 47 #define PLAYERSETUP_ROW_HEIGHT 9 +#define STATS_SLIDE_Y_PER_SECOND 30.0f +#define STATS_ROW_HEIGHT 20.0f +#define STATS_ROW_X_MARGIN 50.0f +#define STATS_BOTTOM_MARGIN 135.0f +#define STATS_TOP_MARGIN 40.0f +#define STATS_TOP_DIMMING_AREA_LENGTH (93.0f - STATS_TOP_MARGIN) +#define STATS_BOTTOM_DIMMING_AREA_LENGTH 55.0f +#define STATS_PUT_BACK_TO_BOTTOM_Y 50.0f +#define STATS_RATING_X 24.0f +#define STATS_RATING_Y 20.0f + +#define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f +#define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f +#define CONTSETUP_BOUND_HIGHLIGHT_HEIGHT 10 +#define CONTSETUP_BOUND_COLUMN_WIDTH 190.0f +#define CONTSETUP_LIST_HEADER_HEIGHT 20.0f +#define CONTSETUP_LIST_TOP 28.0f +#define CONTSETUP_LIST_RIGHT 18.0f +#define CONTSETUP_LIST_BOTTOM 120.0f +#define CONTSETUP_LIST_LEFT 18.0f +#define CONTSETUP_COLUMN_1_X 40.0f +#define CONTSETUP_COLUMN_2_X 210.0f +#define CONTSETUP_COLUMN_3_X (CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH + 10.0f) +#define CONTSETUP_BACK_RIGHT 35.0f +#define CONTSETUP_BACK_BOTTOM 122.0f +#define CONTSETUP_BACK_HEIGHT 25.0f + enum eLanguages { LANGUAGE_AMERICAN, @@ -185,19 +196,19 @@ enum eMenuScreen MENUPAGE_NEW_GAME_RELOAD = 10, MENUPAGE_LOAD_SLOT_CONFIRM = 11, MENUPAGE_DELETE_SLOT_CONFIRM = 12, - MENUPAGE_13 = 13, + MENUPAGE_NO_MEMORY_CARD = 13, MENUPAGE_LOADING_IN_PROGRESS = 14, MENUPAGE_DELETING_IN_PROGRESS = 15, - MENUPAGE_16 = 16, + MENUPAGE_PS2_LOAD_FAILED = 16, MENUPAGE_DELETE_FAILED = 17, MENUPAGE_DEBUG_MENU = 18, - MENUPAGE_MEMORY_CARD_1 = 19, - MENUPAGE_MEMORY_CARD_2 = 20, + MENUPAGE_MEMORY_CARD_DEBUG = 19, + MENUPAGE_MEMORY_CARD_TEST = 20, MENUPAGE_MULTIPLAYER_MAIN = 21, - MENUPAGE_SAVE_FAILED_1 = 22, - MENUPAGE_SAVE_FAILED_2 = 23, + MENUPAGE_PS2_SAVE_FAILED = 22, + MENUPAGE_PS2_SAVE_FAILED_2 = 23, MENUPAGE_SAVE = 24, - MENUPAGE_NO_MEMORY_CARD = 25, + MENUPAGE_NO_MEMORY_CARD_2 = 25, MENUPAGE_CHOOSE_SAVE_SLOT = 26, MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27, MENUPAGE_MULTIPLAYER_MAP = 28, @@ -438,7 +449,7 @@ struct BottomBarOption struct CMenuScreen { char m_ScreenName[8]; - int32 unk; + int32 unk; // 2 on MENUPAGE_MULTIPLAYER_START, 1 on everywhere else int32 m_PreviousPage[2]; // eMenuScreen int32 m_ParentEntry[2]; // row @@ -544,11 +555,12 @@ public: static bool &m_bShutDownFrontEndRequested; static bool &m_PrefsAllowNastyGame; - static float &menuXYpadding; - static float &actionTextScaleX; - static float &actionTextScaleY; - static int32 &sthWithButtons; - static int32 &sthWithButtons2; + static uint8 m_PrefsStereoMono; + static int32 m_SelectedMap; + static int32 m_SelectedGameType; + static uint8 m_PrefsPlayerRed; + static uint8 m_PrefsPlayerGreen; + static uint8 m_PrefsPlayerBlue; #ifndef MASTER static bool m_PrefsMarketing; @@ -557,6 +569,7 @@ public: #ifdef MENU_MAP static bool bMenuMapActive; + static bool bMapMouseShownOnce; static float fMapSize; static float fMapCenterY; static float fMapCenterX; @@ -565,9 +578,9 @@ public: #endif public: - static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2); + static void BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2); static void CentreMousePointer(); - int CheckCodesForControls(int32); + void CheckCodesForControls(int); bool CheckHover(int x1, int x2, int y1, int y2); void CheckSliderMovement(int); int CostructStatLine(int); @@ -585,13 +598,13 @@ public: #endif void DrawPlayerSetupScreen(); int FadeIn(int alpha); - void FilterOutColorMarkersFromString(uint16, CRGBA &); + void FilterOutColorMarkersFromString(wchar*, CRGBA &); int GetStartOptionsCntrlConfigScreens(); static void InitialiseChangedLanguageSettings(); void LoadAllTextures(); void LoadSettings(); - static void MessageScreen(char *); - static void PickNewPlayerColour(); + void MessageScreen(const char *); + void PickNewPlayerColour(); void PrintBriefs(); static void PrintErrorMessage(); void PrintStats(); @@ -612,6 +625,7 @@ public: void WaitForUserCD(); void PrintController(); int GetNumOptionsCntrlConfigScreens(); + int ConstructStatLine(int); // New (not in function or inlined in the game) void ThingsToDoBeforeLeavingPage(); diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h index bac8f0a8..cece80c7 100644 --- a/src/core/MenuScreens.h +++ b/src/core/MenuScreens.h @@ -1,22 +1,22 @@ #pragma once -// There are some missing/wrong entries in here. +// TODO: There are some missing/wrong entries in here. const CMenuScreen aScreens[] = { // MENUPAGE_NONE = 0 - { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, + { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, - // MENUPAGE_STATS = 1 - Both PrintStats and Draw were printing the page name, so deleted the string Draw looked for. + // MENUPAGE_STATS = 1 #ifdef MENU_MAP - { ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3, + { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3, #else - { ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, + { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, #endif MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_NEW_GAME = 2 - { "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1, + { "FET_SGA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1, MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD, MENUACTION_POPULATESLOTS_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT, MENUACTION_POPULATESLOTS_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, @@ -25,15 +25,15 @@ const CMenuScreen aScreens[] = { // MENUPAGE_BRIEFS = 3 #ifdef MENU_MAP - { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4, + { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4, #else - { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3, + { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3, #endif MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENU_CONTROLLER_SETTINGS = 4 - { "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0, + { "FET_CON", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0, MENUACTION_CTRLCONFIG, "FEC_CCF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, MENUACTION_CTRLDISPLAY, "FEC_CDP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, MENUACTION_CTRLVIBRATION, "FEC_VIB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, @@ -41,7 +41,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_SOUND_SETTINGS = 5 - { "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1, + { "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, MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, @@ -53,7 +53,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_GRAPHICS_SETTINGS = 6 - { "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2, + { "FET_DIS", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2, MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, @@ -67,7 +67,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_LANGUAGE_SETTINGS = 7 - { "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3, + { "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3, MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE, @@ -80,7 +80,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_CHOOSE_LOAD_SLOT = 8 - { "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1, + { "FET_LG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1, MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM, @@ -93,7 +93,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_CHOOSE_DELETE_SLOT = 9 - { "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2, + { "FET_DG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2, MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM, @@ -106,104 +106,123 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_NEW_GAME_RELOAD = 10 - { "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0, + { "FET_NG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0, MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD, }, // MENUPAGE_LOAD_SLOT_CONFIRM = 11 - { "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0, + { "FET_LG", 1, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0, MENUACTION_LABEL, "FESZ_QL", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT, MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS, }, // MENUPAGE_DELETE_SLOT_CONFIRM = 12 - { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0, + { "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0, MENUACTION_LABEL, "FESZ_QD", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_DELETING, }, - // MENUPAGE_13 = 13 - { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, - + // MENUPAGE_NO_MEMORY_CARD = 13 + { "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + MENUACTION_LABEL, "FEC_OFI", SAVESLOT_NONE, MENUPAGE_NONE, // only in mobile. FEC_OFI is missing }, // MENUPAGE_LOADING_IN_PROGRESS = 14 - { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_LG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_LABEL, "FED_LDW", SAVESLOT_NONE, MENUPAGE_LOAD_SLOT_CONFIRM, }, // MENUPAGE_DELETING_IN_PROGRESS = 15 - { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_DG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_LABEL, "FEDL_WR", SAVESLOT_NONE, MENUPAGE_NONE, }, - // MENUPAGE_16 = 16 - { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + // MENUPAGE_PS2_LOAD_FAILED = 16 + { "FET_LG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_LABEL, "FES_LOE", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_DELETE_FAILED = 17 - { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_DG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_LABEL, "FES_DEE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, }, // MENUPAGE_DEBUG_MENU = 18 - { "FED_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, - + { "FED_DBG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 4, 0, + MENUACTION_RELOADIDE, "FED_RID", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_RELOADIPL, "FED_RIP", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_SETDBGFLAG, "FED_DFL", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_SWITCHBIGWHITEDEBUGLIGHT, "FED_DLS", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_PEDROADGROUPS, "FED_SPR", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_CARROADGROUPS, "FED_SCR", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_COLLISIONPOLYS, "FED_SCP", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_PARSEHEAP, "FED_PAH", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_SHOWCULL, "FED_SCZ", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_DEBUGSTREAM, "FED_DSR", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, - // MENUPAGE_MEMORY_CARD_1 = 19 - { "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, - + // MENUPAGE_MEMORY_CARD_DEBUG = 19 + { "FEM_MCM", 1, MENUPAGE_NONE, MENUPAGE_NONE, 7, 0, + MENUACTION_REGMEMCARD1, "FEM_RMC", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_TESTFORMATMEMCARD1, "FEM_TFM", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_TESTUNFORMATMEMCARD1, "FEM_TUM", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_CREATEROOTDIR, "FEM_CRD", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_CREATELOADICONS, "FEM_CLI", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_FILLWITHGUFF, "FEM_FFF", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_SAVEONLYTHEGAME, "FEM_SOG", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_SAVEGAME, "FEM_STG", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_SAVEGAMEUNDERGTA, "FEM_STS", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_CREATECOPYPROTECTED, "FEM_CPD", SAVESLOT_NONE, MENUPAGE_NONE, }, - // MENUPAGE_MEMORY_CARD_2 = 20 - { "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + // MENUPAGE_MEMORY_CARD_TEST = 20 + { "FEM_MC2", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_MULTIPLAYER_MAIN = 21 - { "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_MP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, - // MENUPAGE_SAVE_FAILED_1 = 22 - { "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + // MENUPAGE_PS2_SAVE_FAILED = 22 + { "MCDNSP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE, }, - // MENUPAGE_SAVE_FAILED_2 = 23 - { "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + // MENUPAGE_PS2_SAVE_FAILED_2 = 23 + { "MCGNSP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE, }, // Unused in PC but anyway // MENUPAGE_SAVE = 24 #ifdef PS2_SAVE_DIALOG - { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_CHANGEMENU, "FESZ_SA", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, }, #else - { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_POPULATESLOTS_CHANGEMENU, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, }, #endif - // MENUPAGE_NO_MEMORY_CARD = 25 - { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, - + // MENUPAGE_NO_MEMORY_CARD_2 = 25 + { "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_CHOOSE_SAVE_SLOT = 26 - { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM, @@ -216,49 +235,49 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27 - { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, + { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, MENUACTION_LABEL, "FESZ_QO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_SAVING_IN_PROGRESS, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, }, // MENUPAGE_MULTIPLAYER_MAP = 28 - { "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_MAP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_MULTIPLAYER_CONNECTION = 29 - { "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_CON", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_MULTIPLAYER_FIND_GAME = 30 - { "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_FG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_MULTIPLAYER_MODE = 31 - { "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_GT", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_MULTIPLAYER_CREATE = 32 - { "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_HG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_MULTIPLAYER_START = 33 - { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FEN_STA", 2, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_SKIN_SELECT_OLD = 34 - { "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_PS", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_CONTROLLER_PC = 35 - { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0, + { "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0, MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS, MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, @@ -268,7 +287,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_CONTROLLER_PC_OLD1 = 36 - { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0, + { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0, MENUACTION_GETKEY, "FEC_PLB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1, MENUACTION_GETKEY, "FEC_CWL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1, MENUACTION_GETKEY, "FEC_CWR", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1, @@ -282,12 +301,12 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_CONTROLLER_PC_OLD2 = 37 - { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1, + { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1, }, // MENUPAGE_CONTROLLER_PC_OLD3 = 38 - { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2, + { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2, MENUACTION_GETKEY, "FEC_LUP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3, MENUACTION_GETKEY, "FEC_LDN", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3, MENUACTION_GETKEY, "FEC_SMS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3, @@ -296,20 +315,24 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_CONTROLLER_PC_OLD4 = 39 - { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3, + { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3, }, // MENUPAGE_CONTROLLER_DEBUG = 40 - { "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, - + { "FEC_DBG", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3, + MENUACTION_GETKEY, "FEC_TGD", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG, + MENUACTION_GETKEY, "FEC_TDO", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG, + MENUACTION_GETKEY, "FEC_TSS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG, + MENUACTION_GETKEY, "FEC_SMS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG, + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_OPTIONS = 41 #ifdef MENU_MAP - { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5, + { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5, #else - { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4, + { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4, #endif MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, @@ -321,9 +344,9 @@ const CMenuScreen aScreens[] = { // MENUPAGE_EXIT = 42 #ifdef MENU_MAP - { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6, + { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6, #else - { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5, + { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5, #endif MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, @@ -331,58 +354,58 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_SAVING_IN_PROGRESS = 43 - { "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, + { "", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, MENUACTION_LABEL, "FES_WAR", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_SAVE_SUCCESSFUL = 44 - { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, + { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE, MENUACTION_RESUME_FROM_SAVEZONE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, }, // MENUPAGE_DELETING = 45 - { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0, + { "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0, MENUACTION_LABEL, "FED_DLW", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_DELETE_SUCCESS = 46 - { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0, + { "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0, MENUACTION_LABEL, "DEL_FNM", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, }, // MENUPAGE_SAVE_FAILED = 47 - { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, + { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, }, // MENUPAGE_LOAD_FAILED = 48 - { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, + { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_LOAD_FAILED_2 = 49 - { "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, + { "FET_LG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, MENUACTION_LABEL, "FEC_LUN", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT, }, // MENUPAGE_FILTER_GAME = 50 - { "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FIL_FLT", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_START_MENU = 51 - { "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FEM_MM", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS, MENUACTION_CHANGEMENU, "FEM_QT", SAVESLOT_NONE, MENUPAGE_EXIT, }, // MENUPAGE_PAUSE_MENU = 52 - { "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, #ifdef MENU_MAP @@ -395,22 +418,24 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_CHOOSE_MODE = 53 - { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, - + { "FEN_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1, + MENUACTION_CHANGEMENU, "FET_SP", SAVESLOT_NONE, MENUPAGE_NEW_GAME, + MENUACTION_INITMP, "FET_MP", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN, + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_SKIN_SELECT = 54 - { "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4, - MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN, + { "FET_PSU", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4, + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN, }, // MENUPAGE_KEYBOARD_CONTROLS = 55 - { "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1, - MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, + { "FET_STI", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1, + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, }, // MENUPAGE_MOUSE_CONTROLS = 56 - { "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2, + { "FET_MTI", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2, MENUACTION_MOUSESENS, "FEC_MSH", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_INVVERT, "FEC_IVV", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, @@ -418,18 +443,18 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_57 = 57 - { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0, }, // MENUPAGE_58 = 58 - { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0, }, #ifdef MENU_MAP // MENUPAGE_MAP = 59 - { "FEG_MAP", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, + { "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, }, #endif }; diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 994c94ca..154e7e9a 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1412,8 +1412,8 @@ CRadar::DrawYouAreHereSprite(float x, float y) } } else { if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 200) { - lastChange = CTimer::GetTimeInMillisecondsPauseMode(); - show = !show; + lastChange = CTimer::GetTimeInMillisecondsPauseMode(); + show = !show; } } @@ -1422,7 +1422,7 @@ CRadar::DrawYouAreHereSprite(float x, float y) float top = y - SCREEN_SCALE_Y(2.0f); float right = SCREEN_SCALE_X(12.0) + x; float bottom = y - SCREEN_SCALE_Y(26.0f); - CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 217, 106, 255)); + CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255)); } MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE; } @@ -1503,4 +1503,4 @@ STARTPATCHES InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP); //InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP); //InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP); -ENDPATCHES +ENDPATCHES
\ No newline at end of file diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp index 18d6b6a3..b5e031ed 100644 --- a/src/core/Timer.cpp +++ b/src/core/Timer.cpp @@ -34,6 +34,10 @@ LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318; //UInt32 suspendDepth; uint32 &suspendDepth = *(uint32*)0x62A320; +#ifdef FIX_BUGS +double frameTime; +#endif + void CTimer::Initialise(void) { debug("Initialising CTimer...\n"); @@ -90,17 +94,21 @@ void CTimer::Update(void) float updInCyclesScaled = updInCycles * ms_fTimeScale; - double upd = updInCyclesScaled / (double)_nCyclesPerMS; + // We need that real frame time to fix transparent menu bug. +#ifndef FIX_BUGS + double +#endif + frameTime = updInCyclesScaled / (double)_nCyclesPerMS; - m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd; + m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime; if ( GetIsPaused() ) ms_fTimeStep = 0.0f; else { - m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd; - m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd; - ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0f; + m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime; + m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime; + ms_fTimeStep = frameTime / 1000.0f * 50.0f; } } else @@ -109,19 +117,23 @@ void CTimer::Update(void) uint32 updInMs = timer - oldPcTimer; - double upd = (double)updInMs * ms_fTimeScale; + // We need that real frame time to fix transparent menu bug. +#ifndef FIX_BUGS + double +#endif + frameTime = (double)updInMs * ms_fTimeScale; oldPcTimer = timer; - m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd; + m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime; if ( GetIsPaused() ) ms_fTimeStep = 0.0f; else { - m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd; - m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd; - ms_fTimeStep = upd / 1000.0f * 50.0f; + m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime; + m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime; + ms_fTimeStep = frameTime / 1000.0f * 50.0f; } } diff --git a/src/core/Timer.h b/src/core/Timer.h index 2498ec8a..7b35f79a 100644 --- a/src/core/Timer.h +++ b/src/core/Timer.h @@ -53,3 +53,7 @@ public: static void StartUserPause(void); static void EndUserPause(void); }; + +#ifdef FIX_BUGS +extern double frameTime; +#endif diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 6eae8685..a35a9fd9 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -21,6 +21,7 @@ #include "Particle.h" #include "Console.h" #include "Debug.h" +#include "Hud.h" #include <list> @@ -338,6 +339,7 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); }); DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); }); + DebugMenuAddVarBool8("Debug", "Draw hud", (int8*)&CHud::m_Wants_To_Draw_Hud, nil); DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil); DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus); DebugMenuAddCmd("Debug", "Fix Car", FixCar); |