Merge pull request #131 from gennariarmando/master

Frontend fixes.
This commit is contained in:
aap 2019-07-14 10:22:52 +02:00 committed by GitHub
commit c6afa42f9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 258 additions and 253 deletions

View File

@ -27,7 +27,7 @@
#include "PlayerInfo.h" #include "PlayerInfo.h"
#include "World.h" #include "World.h"
#define ALL_ORIGINAL_FRONTEND 1 #define ALL_ORIGINAL_FRONTEND FALSE
int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78; int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78;
int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92; int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
@ -74,7 +74,6 @@ int32 &nTimeForSomething = *(int32*)0x628D54;
//int32 *pControlTemp = 0; //int32 *pControlTemp = 0;
// Frontend inputs. // Frontend inputs.
bool GetPadBack(); bool GetPadBack();
bool GetPadExitEnter(); bool GetPadExitEnter();
bool GetPadForward(); bool GetPadForward();
@ -727,13 +726,6 @@ void CMenuManager::Draw()
} }
// Mouse support. // Mouse support.
// TODO: inputs for these pages.
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
}
else if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
}
else {
static bool bIsMouseInPosition = false; static bool bIsMouseInPosition = false;
if (m_nMenuFadeAlpha >= 255 && GetMouseInput()) { if (m_nMenuFadeAlpha >= 255 && GetMouseInput()) {
CVector2D vecInputSize = { SCREEN_SCALE_X(20.0f), SCREEN_SCALE_FROM_RIGHT(20.0f) }; CVector2D vecInputSize = { SCREEN_SCALE_X(20.0f), SCREEN_SCALE_FROM_RIGHT(20.0f) };
@ -752,27 +744,26 @@ void CMenuManager::Draw()
m_nPrevOption = m_nCurrOption; m_nPrevOption = m_nCurrOption;
if (GetMouseForward()) if (GetMouseForward())
m_nHoverOption = HOVEROPTION_NULL; m_nHoverOption = HOVEROPTION_42;
else else
m_nHoverOption = HOVEROPTION_DEFAULT; m_nHoverOption = HOVEROPTION_DEFAULT;
} }
} }
}
// Sliders // Sliders
// TODO: CheckHover // TODO: CheckHover
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_BRIGHTNESS: case MENUACTION_BRIGHTNESS:
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsBrightness/512.0f); DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsBrightness / 512.0f);
break; break;
case MENUACTION_DRAWDIST: case MENUACTION_DRAWDIST:
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), (m_PrefsLOD - 0.8f) * 1.0f); DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), (m_PrefsLOD - 0.8f) * 1.0f);
break; break;
case MENUACTION_MUSICVOLUME: case MENUACTION_MUSICVOLUME:
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsMusicVolume/128.0f); DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsMusicVolume / 128.0f);
break; break;
case MENUACTION_SFXVOLUME: case MENUACTION_SFXVOLUME:
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsSfxVolume/128.0f); DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsSfxVolume / 128.0f);
break; break;
case MENUACTION_MOUSESENS: case MENUACTION_MOUSESENS:
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0f); DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0f);
@ -1332,57 +1323,58 @@ void CMenuManager::Process(void)
m_bStartGameLoading = false; m_bStartGameLoading = false;
InitialiseChangedLanguageSettings(); InitialiseChangedLanguageSettings();
if (CPad::GetPad(0)->GetEscapeJustDown()) //
RequestFrontEndStartUp();
SwitchMenuOnAndOff(); SwitchMenuOnAndOff();
// Be able to re-open menu correctly. // Be able to re-open menu correctly.
if (m_bMenuActive) { if (!m_bMenuActive) {
if (GetPadExitEnter())
RequestFrontEndStartUp();
UnloadTextures();
field_452 = 0;
SwitchToNewScreen(MENUPAGE_NONE);
pEditString = 0;
field_113 = 0;
return;
}
// Load frontend textures. // Load frontend textures.
LoadAllTextures(); LoadAllTextures();
// Set save/delete game pages. // Set save/delete game pages.
if (m_nCurrScreen == MENUPAGE_DELETING) { if (m_nCurrScreen == MENUPAGE_DELETING) {
bool SlotPopulated = false; int8 DeleteSlot = PcSaveHelper.DeleteSlot(m_nCurrSaveSlot);
if (PcSaveHelper.DeleteSlot(m_nCurrSaveSlot)) { if (DeleteSlot) {
PcSaveHelper.PopulateSlotInfo(); SwitchToNewScreen(MENUPAGE_DELETE_SUCCESS);
SlotPopulated = true;
}
if (SlotPopulated) {
m_nPrevScreen = m_nCurrScreen;
m_nCurrScreen = MENUPAGE_DELETE_SUCCESS;
m_nCurrOption = 0;
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
} }
else else
SaveLoadFileError_SetUpErrorScreen(); SaveLoadFileError_SetUpErrorScreen();
} }
if (m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS) { else if (m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS) {
int8 SaveSlot = PcSaveHelper.SaveSlot(m_nCurrSaveSlot); int8 SaveSlot = PcSaveHelper.SaveSlot(m_nCurrSaveSlot);
PcSaveHelper.PopulateSlotInfo();
if (SaveSlot) { if (SaveSlot) {
m_nPrevScreen = m_nCurrScreen; SwitchToNewScreen(MENUPAGE_SAVE_SUCCESSFUL);
m_nCurrScreen = MENUPAGE_SAVE_SUCCESSFUL;
m_nCurrOption = 0;
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
} }
else else
SaveLoadFileError_SetUpErrorScreen(); SaveLoadFileError_SetUpErrorScreen();
} }
if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) { else if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) {
if (CheckSlotDataValid(m_nCurrSaveSlot)) { int8 CheckSlot = CheckSlotDataValid(m_nCurrSaveSlot);
if (CheckSlot) {
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == 0; TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == 0;
if (m_PrefsVsyncDisp != m_PrefsVsync) if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp; m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service(); DMAudio.Service();
m_bStartGameLoading = 1; m_bStartGameLoading = true;
RequestFrontEndShutdown(); RequestFrontEndShutdown();
m_bLoadingSavedGame = 1; m_bLoadingSavedGame = true;
b_FoundRecentSavedGameWantToLoad = 1; b_FoundRecentSavedGameWantToLoad = true;
DMAudio.SetEffectsFadeVol(0); DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0); DMAudio.SetMusicFadeVol(0);
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds()); DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
@ -1394,7 +1386,7 @@ void CMenuManager::Process(void)
ProcessButtonPresses(); ProcessButtonPresses();
// Set binding keys. // Set binding keys.
if (pEditString && CPad::EditString(pEditString, 0) == nil) { if (pEditString && CPad::EditString(pEditString, 0) != nil) {
if (*pEditString == 0) if (*pEditString == 0)
strcpy(pEditString, "NoName"); strcpy(pEditString, "NoName");
pEditString = nil; pEditString = nil;
@ -1419,7 +1411,6 @@ void CMenuManager::Process(void)
MouseButtonJustClicked = 4; MouseButtonJustClicked = 4;
else if (GetMouseWheelDown()) else if (GetMouseWheelDown())
MouseButtonJustClicked = 5; MouseButtonJustClicked = 5;
//XXX two more buttons
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown(); JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
@ -1432,7 +1423,7 @@ void CMenuManager::Process(void)
TypeOfControl = 0; TypeOfControl = 0;
if (!field_534) { if (!field_534) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); //DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
pControlEdit = nil; pControlEdit = nil;
field_113 = 0; field_113 = 0;
m_KeyPressedCode = -1; m_KeyPressedCode = -1;
@ -1445,7 +1436,7 @@ void CMenuManager::Process(void)
field_535 = 1; field_535 = 1;
} }
else { else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); //DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction(m_CurrCntrlAction, i); ControlsManager.ClearSettingsAssociatedWithAction(m_CurrCntrlAction, i);
field_534 = false; field_534 = false;
@ -1459,8 +1450,7 @@ void CMenuManager::Process(void)
} }
if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) { if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) {
m_nCurrScreen = m_nPrevScreen; SwitchToNewScreen(m_nPrevScreen);
m_nCurrOption = 0;
} }
// Reset pad shaking. // Reset pad shaking.
@ -1468,18 +1458,6 @@ void CMenuManager::Process(void)
CPad::StopPadsShaking(); CPad::StopPadsShaking();
VibrationTime = 0; VibrationTime = 0;
} }
}
else {
UnloadTextures();
field_452 = 0;
*(bool*)0x5F33E4 = true;
// byte_5F33E4 = 1; // unused
m_nPrevScreen = 0;
m_nCurrScreen = m_nPrevScreen;
m_nCurrOption = 0;
pEditString = nil;
field_113 = 0;
}
if (!m_bStartGameLoading) { if (!m_bStartGameLoading) {
if (m_bGameNotLoaded) if (m_bGameNotLoaded)
@ -1493,15 +1471,12 @@ WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); }
#else #else
void CMenuManager::ProcessButtonPresses() void CMenuManager::ProcessButtonPresses()
{ {
if(pEditString) if (pEditString || pControlEdit)
return;
if(pControlEdit)
return; return;
// Update mouse position // Update mouse position
m_nMouseOldPosX = m_nMousePosX; m_nMouseOldPosX = m_nMousePosX;
m_nMouseOldPosY = m_nMousePosY; m_nMouseOldPosY = m_nMousePosY;
m_nMousePosX = m_nMouseTempPosX; m_nMousePosX = m_nMouseTempPosX;
m_nMousePosY = m_nMouseTempPosY; m_nMousePosY = m_nMouseTempPosY;
@ -1522,56 +1497,25 @@ void CMenuManager::ProcessButtonPresses()
if (m_nCurrScreen == MENUPAGE_MULTIPLAYER_FIND_GAME || m_nCurrScreen == MENUPAGE_SKIN_SELECT || m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { if (m_nCurrScreen == MENUPAGE_MULTIPLAYER_FIND_GAME || m_nCurrScreen == MENUPAGE_SKIN_SELECT || m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) if (m_nCurrScreen == MENUPAGE_SKIN_SELECT)
field_440 = m_nSkinsTotal; m_nCurrExSize = m_nSkinsTotal;
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)
field_440 = m_ControlMethod ? 30 : 25; m_nCurrExSize = m_ControlMethod ? 30 : 25;
if (field_44C > field_440)
field_44C = field_440 - 1;
}
if (!GetPadBack() || m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS || field_535) if (!GetPadBack() || m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS || field_535)
field_535 = 0; field_535 = 0;
else if (field_536 == 19) { else if (m_nCurrExLayer == 19) {
m_nHoverOption = 42; m_nHoverOption = HOVEROPTION_42;
field_113 = 1; field_113 = 1;
field_456 = 1; field_456 = 1;
m_bKeyChangeNotProcessed = 1; m_bKeyChangeNotProcessed = true;
pControlEdit = &m_KeyPressedCode; pControlEdit = &m_KeyPressedCode;
} }
if (GetPadForward()) { bool Trigger = false;
switch (field_536) { if (!Trigger) {
case 19:
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
field_113 = 1;
field_456 = 1;
pControlEdit = &m_KeyPressedCode;
}
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
field_536 = 9;
}
m_nHoverOption = HOVEROPTION_NULL;
SaveSettings();
break;
case 21:
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
field_536 = 9;
break;
default:
break;
}
}
bool once = false;
if (!once) {
once = true;
nTimeForSomething = 0; nTimeForSomething = 0;
Trigger = true;
} }
if ((CTimer::GetTimeInMillisecondsPauseMode() - nTimeForSomething) > 200) { if ((CTimer::GetTimeInMillisecondsPauseMode() - nTimeForSomething) > 200) {
@ -1582,6 +1526,52 @@ void CMenuManager::ProcessButtonPresses()
field_524 = 0; field_524 = 0;
nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode(); nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
} }
if (CPad::GetPad(0)->NewKeyState.TAB && !CPad::GetPad(0)->OldKeyState.TAB) {
switch (m_nCurrExLayer) {
case 9:
m_nCurrExLayer = 19;
break;
case 19:
m_nCurrExLayer = 21;
break;
case 21:
m_nCurrExLayer = 9;
break;
}
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT && m_nCurrExLayer == 21 && !strcmp(m_aSkinName, m_PrefsSkinFile)) {
m_nCurrExLayer = 9;
}
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS && m_nCurrExLayer == 21)
m_nCurrExLayer = 9;
}
if (GetPadForward()) {
switch (m_nCurrExLayer) {
case 19:
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
field_113 = 1;
field_456 = 1;
pControlEdit = &m_KeyPressedCode;
}
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
m_nCurrExLayer = 9;
}
m_nHoverOption = HOVEROPTION_42;
SaveSettings();
break;
case 21:
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
m_nCurrExLayer = 9;
break;
default:
break;
}
}
} }
// Get number of menu options. // Get number of menu options.
@ -1591,6 +1581,8 @@ void CMenuManager::ProcessButtonPresses()
if (GetPadMoveUp()) { if (GetPadMoveUp()) {
m_nPrevOption = m_nCurrOption; m_nPrevOption = m_nCurrOption;
m_nCurrOption -= 1; m_nCurrOption -= 1;
m_nCurrExOption -= 1;
//field_438 -= 1;
if (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) { if (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) {
if (m_nCurrOption < MENUROW_1) if (m_nCurrOption < MENUROW_1)
@ -1601,11 +1593,16 @@ void CMenuManager::ProcessButtonPresses()
m_nCurrOption = NumberOfMenuOptions; m_nCurrOption = NumberOfMenuOptions;
} }
if (m_nCurrExOption < 0)
m_nCurrExOption = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
} }
else if (GetPadMoveDown()) { else if (GetPadMoveDown()) {
m_nPrevOption = m_nCurrOption; m_nPrevOption = m_nCurrOption;
m_nCurrOption += 1; m_nCurrOption += 1;
m_nCurrExOption += 1;
//field_438 = += 1;
if (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) { if (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) {
if (m_nCurrOption > NumberOfMenuOptions) if (m_nCurrOption > NumberOfMenuOptions)
@ -1616,6 +1613,9 @@ void CMenuManager::ProcessButtonPresses()
m_nCurrOption = MENUROW_0; m_nCurrOption = MENUROW_0;
} }
if (m_nCurrExOption > m_nCurrExSize - 1)
m_nCurrExOption = m_nCurrExSize - 1;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
} }
@ -1637,6 +1637,8 @@ void CMenuManager::ProcessButtonPresses()
} }
else else
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]); SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
PlayEscSound = true;
break; break;
default: default:
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]); SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
@ -1675,7 +1677,7 @@ void CMenuManager::ProcessButtonPresses()
} }
break; break;
default: default:
m_nHoverOption = HOVEROPTION_NULL; m_nHoverOption = HOVEROPTION_42;
break; break;
} }
} }
@ -1871,11 +1873,13 @@ void CMenuManager::ProcessOnOffMenuOptions()
break; break;
case MENUACTION_UPDATESAVE: case MENUACTION_UPDATESAVE:
PcSaveHelper.PopulateSlotInfo(); PcSaveHelper.PopulateSlotInfo();
if (!m_bGameNotLoaded) {
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrOption].m_aEntries[m_nCurrOption].m_SaveSlot <= SAVESLOT_8) { if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrOption].m_aEntries[m_nCurrOption].m_SaveSlot <= SAVESLOT_8) {
m_nCurrSaveSlot = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 2; m_nCurrSaveSlot = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 2;
SwitchToNewScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu); SwitchToNewScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu);
} }
}
break; break;
case MENUACTION_CHECKSAVE: case MENUACTION_CHECKSAVE:
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrOption].m_aEntries[m_nCurrOption].m_SaveSlot <= SAVESLOT_8) { if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrOption].m_aEntries[m_nCurrOption].m_SaveSlot <= SAVESLOT_8) {
@ -2120,32 +2124,24 @@ void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
case 1: case 1:
case 2: case 2:
case 3: case 3:
m_nPrevScreen = m_nCurrScreen; SwitchToNewScreen(MENUPAGE_SAVE_FAILED);
m_nCurrScreen = MENUPAGE_SAVE_FAILED;
m_nCurrOption = MENUROW_0;
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
break; break;
break; break;
case 4: case 4:
case 5: case 5:
case 6: case 6:
this->m_nPrevScreen = m_nCurrScreen; SwitchToNewScreen(MENUPAGE_LOAD_FAILED);
this->m_nCurrScreen = MENUPAGE_LOAD_FAILED;
m_nCurrOption = MENUROW_0;
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
break; break;
case 7: case 7:
this->m_nPrevScreen = m_nCurrScreen; SwitchToNewScreen(MENUPAGE_LOAD_FAILED_2);
this->m_nCurrScreen = MENUPAGE_LOAD_FAILED_2;
m_nCurrOption = MENUROW_0;
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
break; break;
case 8: case 8:
case 9: case 9:
case 10: case 10:
m_nPrevScreen = m_nCurrScreen; SwitchToNewScreen(MENUPAGE_DELETE_FAILED);
m_nCurrScreen = MENUPAGE_DELETE_FAILED;
m_nCurrOption = MENUROW_0;
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
break; break;
default: default:
@ -2221,7 +2217,6 @@ void CMenuManager::ShutdownJustMenu()
} }
#endif #endif
// We won't ever use this again.
#if ALL_ORIGINAL_FRONTEND #if ALL_ORIGINAL_FRONTEND
WRAPPER float CMenuManager::StretchX(float) { EAXJMP(0x48ABE0); } WRAPPER float CMenuManager::StretchX(float) { EAXJMP(0x48ABE0); }
#else #else
@ -2230,7 +2225,11 @@ float CMenuManager::StretchX(float x)
if (SCREEN_WIDTH == 640) if (SCREEN_WIDTH == 640)
return x; return x;
else else
#ifndef ASPECT_RATIO_SCALE
return SCREEN_WIDTH * x * 0.0015625f; return SCREEN_WIDTH * x * 0.0015625f;
#else
return SCREEN_SCALE_X(x);
#endif
} }
#endif #endif
@ -2349,7 +2348,7 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
return Rows; return Rows;
} }
void CMenuManager::SwitchToNewScreen(int8 screen) void CMenuManager::SwitchToNewScreen(int32 screen)
{ {
ResetHelperText(); ResetHelperText();
@ -2373,6 +2372,10 @@ void CMenuManager::SwitchToNewScreen(int8 screen)
m_nPrevScreen = m_nCurrScreen; m_nPrevScreen = m_nCurrScreen;
m_nCurrScreen = screen; m_nCurrScreen = screen;
m_nCurrOption = MENUROW_0; m_nCurrOption = MENUROW_0;
//
m_nCurrExOption = MENUROW_0;
m_nCurrExLayer = 19;
//
m_nMenuFadeAlpha = 0; m_nMenuFadeAlpha = 0;
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
} }
@ -2386,7 +2389,6 @@ void CMenuManager::SwitchToNewScreen(int8 screen)
// Set player skin. // Set player skin.
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) { if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
CPlayerSkin::BeginFrontEndSkinEdit(); CPlayerSkin::BeginFrontEndSkinEdit();
field_535 = 19;
m_bSkinsFound = false; m_bSkinsFound = false;
} }
@ -2399,7 +2401,7 @@ void CMenuManager::SwitchToNewScreen(int8 screen)
DMAudio.StopFrontEndTrack(); DMAudio.StopFrontEndTrack();
} }
void CMenuManager::SetDefaultPreferences(int8 screen) void CMenuManager::SetDefaultPreferences(int32 screen)
{ {
switch (screen) { switch (screen) {
case MENUPAGE_SOUND_SETTINGS: case MENUPAGE_SOUND_SETTINGS:
@ -2540,7 +2542,7 @@ bool GetMouseForward()
bool GetMouseBack() bool GetMouseBack()
{ {
return GetMouseClickRight; return GetMouseClickRight();
} }
bool GetMousePos() bool GetMousePos()
@ -2581,7 +2583,8 @@ bool GetMouseInput()
} }
STARTPATCHES STARTPATCHES
#ifndef ALL_ORIGINAL_FRONTEND #if ALL_ORIGINAL_FRONTEND
#else
InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP); InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP); InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP);
InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP); InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
@ -2589,6 +2592,8 @@ STARTPATCHES
InjectHook(0x48AE60, &CMenuManager::ProcessOnOffMenuOptions, PATCH_JUMP); InjectHook(0x48AE60, &CMenuManager::ProcessOnOffMenuOptions, PATCH_JUMP);
InjectHook(0x488EE0, &CMenuManager::LoadSettings, PATCH_JUMP); InjectHook(0x488EE0, &CMenuManager::LoadSettings, PATCH_JUMP);
InjectHook(0x488CC0, &CMenuManager::SaveSettings, PATCH_JUMP); InjectHook(0x488CC0, &CMenuManager::SaveSettings, PATCH_JUMP);
InjectHook(0x48ABE0, &CMenuManager::StretchX, PATCH_JUMP);
InjectHook(0x48AC20, &CMenuManager::StretchY, PATCH_JUMP);
for (int i = 1; i < ARRAY_SIZE(aScreens); i++) for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]); Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);

View File

@ -328,7 +328,7 @@ enum eCheckHover
HOVEROPTION_19, HOVEROPTION_19,
HOVEROPTION_20, HOVEROPTION_20,
HOVEROPTION_CHANGESKIN, HOVEROPTION_CHANGESKIN,
HOVEROPTION_NULL = 42, HOVEROPTION_42 = 42,
}; };
enum eMenuColumns enum eMenuColumns
@ -413,10 +413,10 @@ public:
tSkinInfo *m_pSelectedSkin; tSkinInfo *m_pSelectedSkin;
tSkinInfo *field_438; tSkinInfo *field_438;
float field_43C; float field_43C;
int field_440; int m_nCurrExSize;
int m_nSkinsTotal; int m_nSkinsTotal;
char _unk0[4]; char _unk0[4];
int field_44C; int m_nCurrExOption;
bool m_bSkinsFound; bool m_bSkinsFound;
bool m_bQuitGameNoCD; bool m_bQuitGameNoCD;
char field_452; char field_452;
@ -439,7 +439,7 @@ public:
int field_530; int field_530;
char field_534; char field_534;
char field_535; char field_535;
int8 field_536; int8 m_nCurrExLayer;
int m_nHelperTextAlpha; int m_nHelperTextAlpha;
int m_nMouseOldPosX; int m_nMouseOldPosX;
int m_nMouseOldPosY; int m_nMouseOldPosY;
@ -452,6 +452,7 @@ public:
int m_nCurrSaveSlot; int m_nCurrSaveSlot;
int m_nScreenChangeDelayTimer; int m_nScreenChangeDelayTimer;
public:
static int32 &OS_Language; static int32 &OS_Language;
static int8 &m_PrefsUseVibration; static int8 &m_PrefsUseVibration;
static int8 &m_DisplayControllerOnFoot; static int8 &m_DisplayControllerOnFoot;
@ -516,17 +517,16 @@ public:
void SaveSettings(); void SaveSettings();
void SetHelperText(int text); void SetHelperText(int text);
void ShutdownJustMenu(); void ShutdownJustMenu();
static float StretchX(float); float StretchX(float);
static float StretchY(float); float StretchY(float);
void SwitchMenuOnAndOff(); void SwitchMenuOnAndOff();
void UnloadTextures(); void UnloadTextures();
void WaitForUserCD(); void WaitForUserCD();
// New content: // New content:
uint8 GetNumberOfMenuOptions(); uint8 GetNumberOfMenuOptions();
void SwitchToNewScreen(int8 screen); void SwitchToNewScreen(int32 screen);
void SetDefaultPreferences(int8 screen); void SetDefaultPreferences(int32 screen);
}; };
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error"); static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");

View File

@ -325,7 +325,7 @@ void CHud::Draw()
else { else {
Clip = AmmoInClip; Clip = AmmoInClip;
if (TotalAmmo - AmmoInClip > 9999) if ((TotalAmmo - AmmoInClip) > 9999)
Ammo = 9999; Ammo = 9999;
else else
Ammo = TotalAmmo - AmmoInClip; Ammo = TotalAmmo - AmmoInClip;