1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 20:20:02 +00:00

Continue to Frontend, fix savegame list bug

This commit is contained in:
eray orçunus 2020-08-14 22:41:04 +03:00
parent f403a63a5c
commit 8b3ca9564b
6 changed files with 510 additions and 674 deletions

View file

@ -12727,18 +12727,18 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
ScriptParams[0] = pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels; ScriptParams[0] = pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels;
ScriptParams[1] = pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels; ScriptParams[1] = *(int*)&pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels;
ScriptParams[2] = pPlayerInfo->m_nLastTimeSpentOnWheelie; ScriptParams[2] = pPlayerInfo->m_nLastTimeSpentOnWheelie;
ScriptParams[3] = pPlayerInfo->m_nLastDistanceTravelledOnWheelie; ScriptParams[3] = *(int*)&pPlayerInfo->m_nLastDistanceTravelledOnWheelie;
ScriptParams[4] = pPlayerInfo->m_nLastTimeSpentOnStoppie; ScriptParams[4] = pPlayerInfo->m_nLastTimeSpentOnStoppie;
ScriptParams[5] = pPlayerInfo->m_nLastDistanceTravelledOnStoppie; ScriptParams[5] = *(int*)&pPlayerInfo->m_nLastDistanceTravelledOnStoppie;
StoreParameters(&m_nIp, 6); StoreParameters(&m_nIp, 6);
pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels = 0; pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels = 0;
pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels = 0; pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels = 0.0f;
pPlayerInfo->m_nLastTimeSpentOnWheelie = 0; pPlayerInfo->m_nLastTimeSpentOnWheelie = 0;
pPlayerInfo->m_nLastDistanceTravelledOnWheelie = 0; pPlayerInfo->m_nLastDistanceTravelledOnWheelie = 0.0f;
pPlayerInfo->m_nLastTimeSpentOnStoppie = 0; pPlayerInfo->m_nLastTimeSpentOnStoppie = 0;
pPlayerInfo->m_nLastDistanceTravelledOnStoppie = 0; pPlayerInfo->m_nLastDistanceTravelledOnStoppie = 0.0f;
return 0; return 0;
} }
//case COMMAND_DISARM_CHAR: //case COMMAND_DISARM_CHAR:

View file

@ -66,8 +66,6 @@ CRGBA LIST_BACKGROUND_COLOR(49, 101, 148, 255);
#define FEET_IN_METER 3.33f #define FEET_IN_METER 3.33f
#endif #endif
#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS)
#ifdef TRIANGLE_BACK_BUTTON #ifdef TRIANGLE_BACK_BUTTON
#define GetBackJustUp GetTriangleJustUp #define GetBackJustUp GetTriangleJustUp
#define GetBackJustDown GetTriangleJustDown #define GetBackJustDown GetTriangleJustDown
@ -925,9 +923,9 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
str = TheText.Get(aScreens[MENUPAGE_DELETE_SLOT_CONFIRM].m_aEntries[0].m_EntryName); str = TheText.Get(aScreens[MENUPAGE_DELETE_SLOT_CONFIRM].m_aEntries[0].m_EntryName);
break; break;
case MENUPAGE_SAVE_OVERWRITE_CONFIRM: case MENUPAGE_SAVE_OVERWRITE_CONFIRM:
if (Slots[m_nCurrSaveSlot + 1] == SLOT_OK) if (Slots[m_nCurrSaveSlot] == SLOT_OK)
str = TheText.Get("FESZ_QO"); str = TheText.Get("FESZ_QO");
else if (Slots[m_nCurrSaveSlot + 1] == SLOT_CORRUPTED) else if (Slots[m_nCurrSaveSlot] == SLOT_CORRUPTED)
str = TheText.Get("FESZ_QZ"); str = TheText.Get("FESZ_QZ");
else else
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName); str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
@ -3584,7 +3582,7 @@ CMenuManager::Process(void)
InitialiseChangedLanguageSettings(); InitialiseChangedLanguageSettings();
if (m_bMenuActive) { if (m_bMenuActive) {
ProcessButtonPresses(); UserInput();
ProcessFileActions(); ProcessFileActions();
DMAudio.Service(); DMAudio.Service();
@ -3594,160 +3592,13 @@ CMenuManager::Process(void)
SwitchMenuOnAndOff(); SwitchMenuOnAndOff();
} }
// TODO(Miami) // Original name is unknown
void void
CMenuManager::ProcessButtonPresses(void) CMenuManager::ProcessList(bool &optionSelected, bool &goBack)
{ {
if (m_nCurrScreen == MENUPAGE_OUTRO) if (m_bWaitingForNewKeyBind)
return; return;
if (m_bWaitingForNewKeyBind) {
if (m_bStartWaitingForKeyBind)
m_bStartWaitingForKeyBind = false;
else {
pControlEdit = CPad::EditCodesForControls(pControlEdit, 1);
JoyButtonJustClicked = false;
MouseButtonJustClicked = false;
if (CPad::GetPad(0)->GetLeftMouseJustDown())
MouseButtonJustClicked = 1;
else if (CPad::GetPad(0)->GetRightMouseJustUp())
MouseButtonJustClicked = 3;
else if (CPad::GetPad(0)->GetMiddleMouseJustUp())
MouseButtonJustClicked = 2;
else if (CPad::GetPad(0)->GetMouseWheelUpJustUp())
MouseButtonJustClicked = 4;
else if (CPad::GetPad(0)->GetMouseWheelDownJustUp())
MouseButtonJustClicked = 5;
// TODO two more buttons
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
int32 TypeOfControl = KEYBOARD;
if (JoyButtonJustClicked)
TypeOfControl = JOYSTICK;
if (MouseButtonJustClicked)
TypeOfControl = MOUSE;
if (*pControlEdit != rsNULL)
TypeOfControl = KEYBOARD;
if (!m_bKeyIsOK) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
pControlEdit = nil;
m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false;
}
else if (!m_bKeyChangeNotProcessed) {
if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked)
CheckCodesForControls(TypeOfControl);
field_159 = true;
}
else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i);
m_bKeyIsOK = false;
m_bKeyChangeNotProcessed = false;
pControlEdit = nil;
m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false;
}
}
}
if (pEditString || pControlEdit)
return;
bool goBack = false;
bool optionSelected = false;
bool goUp = false;
bool goDown = false;
#ifdef TIDY_UP_PBP
bool assumeIncrease = false;
#endif
#ifdef USE_DEBUG_SCRIPT_LOADER
if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) {
#ifdef RW_GL3
if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) {
scriptToLoad = 1;
DoSettingsBeforeStartingAGame();
return;
}
#elif defined _WIN32
if (GetAsyncKeyState('R') & 0x8000) {
scriptToLoad = 1;
DoSettingsBeforeStartingAGame();
return;
}
#endif
}
#endif
if (!m_bShowMouse && (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY)) {
m_bShowMouse = true;
}
static int oldOption = -99;
oldOption = m_nCurrOption;
for (int rowToCheck = 0; rowToCheck < NUM_MENUROWS; ++rowToCheck) {
if (aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action == MENUACTION_NOTHING ||
aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action == MENUACTION_LABEL)
continue;
int extraOffset = 0;
if (aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action == MENUACTION_RADIO)
extraOffset = MENURADIO_ICON_SCALE;
if (m_nMousePosY > MENU_Y(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Y) &&
m_nMousePosY < MENU_Y(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Y + MENU_DEFAULT_LINE_HEIGHT)) {
static int oldScreen = m_nCurrScreen;
m_nOptionMouseHovering = rowToCheck;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrOption = rowToCheck;
m_bShowMouse = true;
}
int action = aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action;
if (action != MENUACTION_BRIGHTNESS && action != MENUACTION_DRAWDIST && action != MENUACTION_MUSICVOLUME
&& action != MENUACTION_SFXVOLUME && action != MENUACTION_MOUSESENS && action != MENUACTION_MP3VOLUMEBOOST)
m_nHoverOption = HOVEROPTION_RANDOM_ITEM;
break;
}
if (m_bShowMouse && m_nMenuFadeAlpha == 255) {
m_nOptionMouseHovering = oldOption;
m_nCurrOption = oldOption;
}
}
if (m_bShowMouse) {
if (oldOption != m_nCurrOption) {
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LABEL) {
++m_nCurrOption;
++m_nOptionMouseHovering;
}
m_nOptionHighlightTransitionBlend = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
}
}
m_nMouseOldPosX = m_nMousePosX;
m_nMouseOldPosY = m_nMousePosY;
m_nMousePosX = m_nMouseTempPosX;
m_nMousePosY = m_nMouseTempPosY;
if (m_nMousePosX < 0) m_nMousePosX = 0;
if (m_nMousePosX > SCREEN_WIDTH) m_nMousePosX = SCREEN_WIDTH;
if (m_nMousePosY < 0) m_nMousePosY = 0;
if (m_nMousePosY > SCREEN_HEIGHT) m_nMousePosY = SCREEN_HEIGHT;
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT || m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) { if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
m_nTotalListRow = m_nSkinsTotal; m_nTotalListRow = m_nSkinsTotal;
} }
@ -3970,24 +3821,95 @@ CMenuManager::ProcessButtonPresses(void)
} }
} }
} }
} else if (isPlainTextScreen(m_nCurrScreen)) { }
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) {
optionSelected = true; void
CMenuManager::UserInput(void)
{
bool goBack = false;
bool optionSelected = false;
bool goUp = false;
bool goDown = false;
int8 changeValueBy;
if (!m_AllowNavigation && m_menuTransitionProgress == 255)
m_AllowNavigation = true;
if (!m_bShowMouse && m_nCurrScreen != MENUPAGE_MAP && (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY)) {
m_bShowMouse = true;
} }
if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
if (m_nCurrScreen != MENUPAGE_START_MENU) { static int oldOption = -99;
goBack = true; oldOption = m_nCurrOption;
for (int rowToCheck = 0; rowToCheck < NUM_MENUROWS; ++rowToCheck) {
if (aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action == MENUACTION_NOTHING ||
aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action == MENUACTION_LABEL)
continue;
int extraOffset = 0;
if (aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action == MENUACTION_RADIO)
extraOffset = MENURADIO_ICON_SCALE;
if (m_nMousePosY > MENU_Y(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Y) &&
m_nMousePosY < MENU_Y(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Y + MENU_DEFAULT_LINE_HEIGHT)) {
static int oldScreen = m_nCurrScreen;
m_nOptionMouseHovering = rowToCheck;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrOption = rowToCheck;
m_bShowMouse = true;
}
int action = aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action;
if (action != MENUACTION_BRIGHTNESS && action != MENUACTION_DRAWDIST && action != MENUACTION_MUSICVOLUME
&& action != MENUACTION_SFXVOLUME && action != MENUACTION_MOUSESENS && action != MENUACTION_MP3VOLUMEBOOST)
m_nHoverOption = HOVEROPTION_RANDOM_ITEM;
break;
}
if (m_bShowMouse && m_nMenuFadeAlpha == 255) {
m_nOptionMouseHovering = oldOption;
m_nCurrOption = oldOption;
} }
} }
} else {
if (CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) { if (m_bShowMouse) {
m_bShowMouse = false; if (oldOption != m_nCurrOption) {
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LABEL) {
++m_nCurrOption;
++m_nOptionMouseHovering;
}
m_nOptionHighlightTransitionBlend = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
}
}
m_nMouseOldPosX = m_nMousePosX;
m_nMouseOldPosY = m_nMousePosY;
m_nMousePosX = m_nMouseTempPosX;
m_nMousePosY = m_nMouseTempPosY;
if (m_nMousePosX < 0) m_nMousePosX = 0;
if (m_nMousePosX > SCREEN_WIDTH) m_nMousePosX = SCREEN_WIDTH;
if (m_nMousePosY < 0) m_nMousePosY = 0;
if (m_nMousePosY > SCREEN_HEIGHT) m_nMousePosY = SCREEN_HEIGHT;
changeValueBy = 0;
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS || m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
ProcessList(optionSelected, goBack);
} else {
// TODO(Miami): Seperate that code into a new function from ProcessButtonPresses
// ProcessScrollingExceptLists(goBack);
if (m_AllowNavigation &&
(CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown())) {
m_bShowMouse = false;
goDown = true; goDown = true;
m_nOptionHighlightTransitionBlend = 0; m_nOptionHighlightTransitionBlend = 0;
} else if (CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) {
}
else if (m_AllowNavigation &&
(CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown())) {
m_bShowMouse = false; m_bShowMouse = false;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
goUp = true; goUp = true;
m_nOptionHighlightTransitionBlend = 0; m_nOptionHighlightTransitionBlend = 0;
} }
@ -3997,25 +3919,23 @@ CMenuManager::ProcessButtonPresses(void)
m_bShowMouse = false; m_bShowMouse = false;
optionSelected = true; optionSelected = true;
} }
} else { }
else {
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) { if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) {
m_bShowMouse = false; m_bShowMouse = false;
optionSelected = true; optionSelected = true;
} }
} }
if (CPad::GetPad(0)->GetLeftMouseJustUp()) { if (CPad::GetPad(0)->GetLeftMouseJustUp() && m_nCurrScreen != MENUPAGE_MAP) {
#ifndef TIDY_UP_PBP // TODO(Miami): New radio selector
if (((m_nCurrOption == 0) && (m_nCurrScreen == MENUPAGE_PAUSE_MENU)) && if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM) {
#else
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_RESUME &&
#endif
(m_nHoverOption == HOVEROPTION_RANDOM_ITEM)) {
m_nCurrOption = m_nOptionMouseHovering; m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true; optionSelected = true;
} }
} else if (CPad::GetPad(0)->GetLeftMouseJustDown()) { }
#ifdef TIDY_UP_PBP // TODO(Miami): This part is old radio selector, remove when new is reversed!!
else if (CPad::GetPad(0)->GetLeftMouseJustDown()) {
if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) { if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0; m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0;
@ -4023,191 +3943,13 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.SetRadioInCar(m_PrefsRadioStation); DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED"); OutputDebugString("FRONTEND RADIO STATION CHANGED");
} else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) {
m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
} }
#else
switch (m_nHoverOption) {
case HOVEROPTION_RADIO_0:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = HEAD_RADIO;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_1:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = DOUBLE_CLEF;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_2:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = JAH_RADIO;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_3:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = RISE_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_4:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = LIPS_106;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_5:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = GAME_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_6:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = MSX_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_7:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = FLASHBACK;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_8:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = CHATTERBOX;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_9:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = USERTRACK;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RANDOM_ITEM:
if (((m_nCurrOption != 0) || (m_nCurrScreen != MENUPAGE_PAUSE_MENU)) {
m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
break;
}
#endif
} }
if (CPad::GetPad(0)->GetLeftMouse()) { if (CPad::GetPad(0)->GetLeftMouse()) {
#ifndef TIDY_UP_PBP
switch (m_nHoverOption) {
case HOVEROPTION_INCREASE_BRIGHTNESS:
m_PrefsBrightness = m_PrefsBrightness + 32;
if (m_PrefsBrightness < 0) {
m_PrefsBrightness = 0;
}
if (510 < m_PrefsBrightness) {
m_PrefsBrightness = 511;
}
SaveSettings();
break;
case HOVEROPTION_DECREASE_BRIGHTNESS:
m_PrefsBrightness = m_PrefsBrightness - 32;
if (m_PrefsBrightness < 0) {
m_PrefsBrightness = 0;
}
if (510 < m_PrefsBrightness) {
m_PrefsBrightness = 511;
}
SaveSettings();
break;
case HOVEROPTION_INCREASE_DRAWDIST:
m_PrefsLOD = m_PrefsLOD + (1.0f / 16);
m_PrefsLOD = min(1.8f, m_PrefsLOD);
CRenderer::ms_lodDistScale = m_PrefsLOD;
SaveSettings();
break;
case HOVEROPTION_DECREASE_DRAWDIST:
m_PrefsLOD = m_PrefsLOD - (1.0f / 16);
m_PrefsLOD = max(0.8f, m_PrefsLOD);
CRenderer::ms_lodDistScale = m_PrefsLOD;
SaveSettings();
break;
case HOVEROPTION_INCREASE_MUSICVOLUME:
m_PrefsMusicVolume = m_PrefsMusicVolume + 8;
m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127);
DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume);
SaveSettings();
break;
case HOVEROPTION_DECREASE_MUSICVOLUME:
m_PrefsMusicVolume = m_PrefsMusicVolume - 8;
if (m_PrefsMusicVolume < 0) {
m_PrefsMusicVolume = 0;
}
if (126 < m_PrefsMusicVolume) {
m_PrefsMusicVolume = 127;
}
DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume);
SaveSettings();
break;
case HOVEROPTION_INCREASE_SFXVOLUME:
m_PrefsSFXVolume = m_PrefsSFXVolume + 8;
if (m_PrefsSFXVolume < 0) {
m_PrefsSFXVolume = 0;
}
if (126 < m_PrefsSFXVolume) {
m_PrefsSFXVolume = 127;
}
DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume);
SaveSettings();
break;
case HOVEROPTION_DECREASE_SFXVOLUME:
m_PrefsSFXVolume = m_PrefsSFXVolume - 8;
if (m_PrefsSFXVolume < 0) {
m_PrefsSFXVolume = 0;
}
if (126 < m_PrefsSFXVolume) {
m_PrefsSFXVolume = 127;
}
DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume);
SaveSettings();
break;
case HOVEROPTION_INCREASE_MOUSESENS:
TheCamera.m_fMouseAccelHorzntl += (1.0f / 3000);
TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200);
SaveSettings();
break;
case HOVEROPTION_DECREASE_MOUSESENS:
TheCamera.m_fMouseAccelHorzntl -= (1.0f / 3000);
TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200);
SaveSettings();
break;
}
#else
switch (m_nHoverOption) { switch (m_nHoverOption) {
case HOVEROPTION_INCREASE_BRIGHTNESS: case HOVEROPTION_INCREASE_BRIGHTNESS:
case HOVEROPTION_INCREASE_MP3BOOST:
case HOVEROPTION_INCREASE_DRAWDIST: case HOVEROPTION_INCREASE_DRAWDIST:
case HOVEROPTION_INCREASE_MUSICVOLUME: case HOVEROPTION_INCREASE_MUSICVOLUME:
case HOVEROPTION_INCREASE_SFXVOLUME: case HOVEROPTION_INCREASE_SFXVOLUME:
@ -4215,6 +3957,7 @@ CMenuManager::ProcessButtonPresses(void)
CheckSliderMovement(1); CheckSliderMovement(1);
break; break;
case HOVEROPTION_DECREASE_BRIGHTNESS: case HOVEROPTION_DECREASE_BRIGHTNESS:
case HOVEROPTION_DECREASE_MP3BOOST:
case HOVEROPTION_DECREASE_DRAWDIST: case HOVEROPTION_DECREASE_DRAWDIST:
case HOVEROPTION_DECREASE_MUSICVOLUME: case HOVEROPTION_DECREASE_MUSICVOLUME:
case HOVEROPTION_DECREASE_SFXVOLUME: case HOVEROPTION_DECREASE_SFXVOLUME:
@ -4222,7 +3965,6 @@ CMenuManager::ProcessButtonPresses(void)
CheckSliderMovement(-1); CheckSliderMovement(-1);
break; break;
} }
#endif
} }
if (CPad::GetPad(0)->GetLeftMouseJustUp() || CPad::GetPad(0)->GetLeftJustUp() || CPad::GetPad(0)->GetRightJustUp() if (CPad::GetPad(0)->GetLeftMouseJustUp() || CPad::GetPad(0)->GetLeftJustUp() || CPad::GetPad(0)->GetRightJustUp()
@ -4230,23 +3972,19 @@ CMenuManager::ProcessButtonPresses(void)
|| CPad::GetPad(0)->GetAnaloguePadLeftJustUp() || CPad::GetPad(0)->GetAnaloguePadRightJustUp() || CPad::GetPad(0)->GetAnaloguePadLeftJustUp() || CPad::GetPad(0)->GetAnaloguePadRightJustUp()
|| CPad::GetPad(0)->GetMouseWheelUpJustDown() || CPad::GetPad(0)->GetMouseWheelDownJustDown()) { || CPad::GetPad(0)->GetMouseWheelUpJustDown() || CPad::GetPad(0)->GetMouseWheelDownJustDown()) {
int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
if (option == MENUACTION_BRIGHTNESS || option == MENUACTION_DRAWDIST) if (option == MENUACTION_BRIGHTNESS)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
else if (option == MENUACTION_SFXVOLUME) else if (option == MENUACTION_SFXVOLUME)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_AUDIO_TEST, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_AUDIO_TEST, 0);
else if (option == MENUACTION_MOUSESENS) else if (option == MENUACTION_DRAWDIST || option == MENUACTION_MOUSESTEER)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
} }
if (CPad::GetPad(0)->GetBackJustDown()) { if (CPad::GetPad(0)->GetBackJustDown() || CPad::GetPad(0)->GetEscapeJustDown()) {
if (m_nCurrScreen != MENUPAGE_START_MENU && m_nCurrScreen != MENUPAGE_PAUSE_MENU) { if (m_nCurrScreen != MENUPAGE_NONE && m_nCurrScreen != MENUPAGE_PAUSE_MENU && m_nCurrScreen != MENUPAGE_CHOOSE_SAVE_SLOT
m_bShowMouse = false; && m_nCurrScreen != MENUPAGE_SAVE_CHEAT_WARNING && m_nCurrScreen != MENUPAGE_SAVING_IN_PROGRESS
goBack = true; && m_nCurrScreen != MENUPAGE_DELETING_IN_PROGRESS && m_nCurrScreen != MENUPAGE_OUTRO)
} {
}
if (CPad::GetPad(0)->GetEscapeJustDown()) {
if (m_nCurrScreen != MENUPAGE_START_MENU) {
m_bShowMouse = false; m_bShowMouse = false;
goBack = true; goBack = true;
} }
@ -4255,8 +3993,156 @@ CMenuManager::ProcessButtonPresses(void)
if (((goDown) || (goUp)) || (optionSelected)) { if (((goDown) || (goUp)) || (optionSelected)) {
goBack = false; goBack = false;
} }
} }
int curAction = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetPedWalkLeftRight() < 0 || CPad::GetPad(0)->GetDPadLeft()) {
static PauseModeTime lastSliderDecrease = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderDecrease > 150) {
if (curAction == MENUACTION_BRIGHTNESS || curAction == MENUACTION_MUSICVOLUME ||
curAction == MENUACTION_SFXVOLUME || curAction == MENUACTION_RADIO ||
curAction == MENUACTION_DRAWDIST || curAction == MENUACTION_MOUSESENS ||
curAction == MENUACTION_MP3VOLUMEBOOST)
changeValueBy = -1;
lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode();
}
} else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetPedWalkLeftRight() > 0 || CPad::GetPad(0)->GetDPadRight()) {
static PauseModeTime lastSliderIncrease = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderIncrease > 150) {
if (curAction == MENUACTION_BRIGHTNESS || curAction == MENUACTION_MUSICVOLUME ||
curAction == MENUACTION_SFXVOLUME || curAction == MENUACTION_RADIO ||
curAction == MENUACTION_DRAWDIST || curAction == MENUACTION_MOUSESENS ||
curAction == MENUACTION_MP3VOLUMEBOOST)
changeValueBy = 1;
lastSliderIncrease = CTimer::GetTimeInMillisecondsPauseMode();
}
}
if (CPad::GetPad(0)->GetMouseWheelUpJustDown()) {
changeValueBy = 1;
} else if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) {
changeValueBy = -1;
}
if (m_AllowNavigation) {
if (CPad::GetPad(0)->GetRightJustDown() || CPad::GetPad(0)->GetAnaloguePadRight() || CPad::GetPad(0)->GetDPadRightJustDown()) {
m_bShowMouse = false;
changeValueBy = 1;
}
}
if (m_AllowNavigation) {
if (CPad::GetPad(0)->GetLeftJustDown() || CPad::GetPad(0)->GetAnaloguePadLeft() || CPad::GetPad(0)->GetDPadLeftJustDown()) {
m_bShowMouse = false;
changeValueBy = -1;
}
}
if (changeValueBy != 0) {
if ((m_nCurrScreen == MENUPAGE_SOUND_SETTINGS || m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS || m_nCurrScreen == MENUPAGE_CONTROLLER_PC || m_nCurrScreen == MENUPAGE_MOUSE_CONTROLS)
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_NOTHING
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_LABEL
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_YES
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_NO
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_CHANGEMENU
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_KEYBOARDCTRLS
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_GOBACK
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESTOREDEF
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_DRAWDIST
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_MOUSESENS
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_MP3VOLUMEBOOST) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
}
}
ProcessButtonPresses(goDown, goUp, optionSelected, goBack, changeValueBy);
}
// TODO(Miami)
// Also rename it to ProcessUserInput when it's done
void
CMenuManager::ProcessButtonPresses(uint8 goDown, uint8 goUp, uint8 optionSelected, uint8 goBack, int8 changeAmount)
{
if (m_nCurrScreen == MENUPAGE_OUTRO)
return;
if (m_bWaitingForNewKeyBind) {
if (m_bStartWaitingForKeyBind)
m_bStartWaitingForKeyBind = false;
else {
pControlEdit = CPad::EditCodesForControls(pControlEdit, 1);
JoyButtonJustClicked = false;
MouseButtonJustClicked = false;
if (CPad::GetPad(0)->GetLeftMouseJustDown())
MouseButtonJustClicked = 1;
else if (CPad::GetPad(0)->GetRightMouseJustUp())
MouseButtonJustClicked = 3;
else if (CPad::GetPad(0)->GetMiddleMouseJustUp())
MouseButtonJustClicked = 2;
else if (CPad::GetPad(0)->GetMouseWheelUpJustUp())
MouseButtonJustClicked = 4;
else if (CPad::GetPad(0)->GetMouseWheelDownJustUp())
MouseButtonJustClicked = 5;
// TODO two more buttons
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
int32 TypeOfControl = KEYBOARD;
if (JoyButtonJustClicked)
TypeOfControl = JOYSTICK;
if (MouseButtonJustClicked)
TypeOfControl = MOUSE;
if (*pControlEdit != rsNULL)
TypeOfControl = KEYBOARD;
if (!m_bKeyIsOK) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
pControlEdit = nil;
m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false;
}
else if (!m_bKeyChangeNotProcessed) {
if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked)
CheckCodesForControls(TypeOfControl);
field_159 = true;
}
else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i);
m_bKeyIsOK = false;
m_bKeyChangeNotProcessed = false;
pControlEdit = nil;
m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false;
}
}
}
if (pEditString || pControlEdit)
return;
#ifdef USE_DEBUG_SCRIPT_LOADER
if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) {
#ifdef RW_GL3
if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) {
scriptToLoad = 1;
DoSettingsBeforeStartingAGame();
return;
}
#elif defined _WIN32
if (GetAsyncKeyState('R') & 0x8000) {
scriptToLoad = 1;
DoSettingsBeforeStartingAGame();
return;
}
#endif
}
#endif
#ifdef PS2_LIKE_MENU #ifdef PS2_LIKE_MENU
if (CPad::GetPad(0)->GetLeftMouseJustDown() && hoveredBottomBarOption != -1) { if (CPad::GetPad(0)->GetLeftMouseJustDown() && hoveredBottomBarOption != -1) {
@ -4297,11 +4183,14 @@ CMenuManager::ProcessButtonPresses(void)
} }
#endif #endif
int oldOption = m_nCurrOption;
if (goDown) { if (goDown) {
m_nCurrOption++; m_nCurrOption++;
if (m_nCurrOption == NUM_MENUROWS || (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_NOTHING)) { if (m_nCurrOption == NUM_MENUROWS || (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_NOTHING)) {
m_nCurrOption = 0; m_nCurrOption = 0;
} }
if (oldOption != m_nCurrOption)
m_nOptionHighlightTransitionBlend = 0;
} }
if (goUp) { if (goUp) {
if (m_nCurrOption == (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL)) { if (m_nCurrOption == (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL)) {
@ -4312,6 +4201,8 @@ CMenuManager::ProcessButtonPresses(void)
} else { } else {
m_nCurrOption--; m_nCurrOption--;
} }
if (oldOption != m_nCurrOption)
m_nOptionHighlightTransitionBlend = 0;
} }
if (optionSelected) { if (optionSelected) {
@ -4322,10 +4213,10 @@ CMenuManager::ProcessButtonPresses(void)
strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA", 8) != 0) { strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA", 8) != 0) {
if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) { if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) {
if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY) if (Slots[m_nCurrOption] != SLOT_OK)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0);
else else
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
} else } else
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
} else { } else {
@ -4400,21 +4291,17 @@ CMenuManager::ProcessButtonPresses(void)
option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
switch (option) { switch (option) {
case MENUACTION_RADIO: case MENUACTION_RADIO:
#ifdef TIDY_UP_PBP
assumeIncrease = true;
#else
++m_PrefsRadioStation; ++m_PrefsRadioStation;
if (DMAudio.IsMP3RadioChannelAvailable()) { if (DMAudio.IsMP3RadioChannelAvailable()) {
if (m_PrefsRadioStation > USERTRACK) if (m_PrefsRadioStation > USERTRACK)
m_PrefsRadioStation = HEAD_RADIO; m_PrefsRadioStation = WILDSTYLE;
} else if (m_PrefsRadioStation > CHATTERBOX) { } else if (m_PrefsRadioStation > WAVE) {
m_PrefsRadioStation = USERTRACK; m_PrefsRadioStation = USERTRACK;
} }
SaveSettings(); SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation); DMAudio.SetRadioInCar(m_PrefsRadioStation);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED"); OutputDebugString("FRONTEND RADIO STATION CHANGED");
#endif
break; break;
case MENUACTION_LANG_ENG: case MENUACTION_LANG_ENG:
m_PrefsLanguage = LANGUAGE_AMERICAN; m_PrefsLanguage = LANGUAGE_AMERICAN;
@ -4472,7 +4359,7 @@ CMenuManager::ProcessButtonPresses(void)
if (saveSlot >= 2 && saveSlot <= 9) { if (saveSlot >= 2 && saveSlot <= 9) {
m_nCurrSaveSlot = saveSlot - 2; m_nCurrSaveSlot = saveSlot - 2;
if (Slots[m_nCurrSaveSlot + 1] != SLOT_EMPTY && Slots[m_nCurrSaveSlot + 1] != SLOT_CORRUPTED) { if (Slots[m_nCurrSaveSlot] != SLOT_EMPTY && Slots[m_nCurrSaveSlot] != SLOT_CORRUPTED) {
if (m_nCurrScreen == MENUPAGE_CHOOSE_LOAD_SLOT) { if (m_nCurrScreen == MENUPAGE_CHOOSE_LOAD_SLOT) {
SwitchToNewScreen(MENUPAGE_LOAD_SLOT_CONFIRM); SwitchToNewScreen(MENUPAGE_LOAD_SLOT_CONFIRM);
} else if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) { } else if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) {
@ -4555,16 +4442,12 @@ CMenuManager::ProcessButtonPresses(void)
break; break;
} }
case MENUACTION_SPEAKERCONF: case MENUACTION_SPEAKERCONF:
#ifndef TIDY_UP_PBP
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
if (--m_PrefsSpeakers < 0) if (--m_PrefsSpeakers < 0)
m_PrefsSpeakers = 2; m_PrefsSpeakers = 2;
DMAudio.SetSpeakerConfig(m_PrefsSpeakers); DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
SaveSettings(); SaveSettings();
} }
#else
assumeIncrease = true;
#endif
break; break;
case MENUACTION_PLAYERSETUP: case MENUACTION_PLAYERSETUP:
CPlayerSkin::BeginFrontendSkinEdit(); CPlayerSkin::BeginFrontendSkinEdit();
@ -4634,7 +4517,6 @@ CMenuManager::ProcessButtonPresses(void)
SetHelperText(2); SetHelperText(2);
break; break;
case MENUACTION_CTRLMETHOD: case MENUACTION_CTRLMETHOD:
#ifndef TIDY_UP_PBP
if (m_ControlMethod == CONTROL_CLASSIC) { if (m_ControlMethod == CONTROL_CLASSIC) {
CCamera::m_bUseMouse3rdPerson = true; CCamera::m_bUseMouse3rdPerson = true;
m_ControlMethod = CONTROL_STANDARD; m_ControlMethod = CONTROL_STANDARD;
@ -4643,9 +4525,6 @@ CMenuManager::ProcessButtonPresses(void)
m_ControlMethod = CONTROL_CLASSIC; m_ControlMethod = CONTROL_CLASSIC;
} }
SaveSettings(); SaveSettings();
#else
assumeIncrease = true;
#endif
break; break;
case MENUACTION_LOADRADIO: case MENUACTION_LOADRADIO:
SwitchToNewScreen(MENUPAGE_SOUND_SETTINGS); SwitchToNewScreen(MENUPAGE_SOUND_SETTINGS);
@ -4761,58 +4640,11 @@ CMenuManager::ProcessButtonPresses(void)
return; return;
#endif #endif
int changeValueBy = 0;
bool decrease = false;
#ifdef TIDY_UP_PBP
bool increase = assumeIncrease;
#else
bool increase = false;
#endif
if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetPedWalkLeftRight() < 0 || CPad::GetPad(0)->GetDPadLeft()) {
static PauseModeTime lastSliderDecrease = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderDecrease > 150) {
CheckSliderMovement(-1);
lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode();
}
} else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetPedWalkLeftRight() > 0 || CPad::GetPad(0)->GetDPadRight()) {
static PauseModeTime lastSliderIncrease = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderIncrease > 150) {
CheckSliderMovement(1);
lastSliderIncrease = CTimer::GetTimeInMillisecondsPauseMode();
}
}
if (CPad::GetPad(0)->GetRightJustDown() || CPad::GetPad(0)->GetAnaloguePadRight() || CPad::GetPad(0)->GetDPadRightJustDown()) { if (changeAmount != 0) {
m_bShowMouse = false;
increase = true;
} else if (CPad::GetPad(0)->GetMouseWheelUpJustDown() && m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) {
increase = true;
CheckSliderMovement(1);
m_bShowMouse = true;
}
if (!CPad::GetPad(0)->GetLeftJustDown() && !CPad::GetPad(0)->GetAnaloguePadLeft() && !CPad::GetPad(0)->GetDPadLeftJustDown()) {
if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) {
if (m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) {
decrease = true;
CheckSliderMovement(-1);
m_bShowMouse = true;
}
}
} else {
m_bShowMouse = false;
decrease = true;
}
if (increase)
changeValueBy++;
else if (decrease)
changeValueBy--;
if (changeValueBy != 0) {
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_RADIO: case MENUACTION_RADIO:
m_PrefsRadioStation += changeValueBy; m_PrefsRadioStation += changeAmount;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
if (DMAudio.IsMP3RadioChannelAvailable()) { if (DMAudio.IsMP3RadioChannelAvailable()) {
if (m_PrefsRadioStation < WILDSTYLE) if (m_PrefsRadioStation < WILDSTYLE)
@ -4832,7 +4664,7 @@ CMenuManager::ProcessButtonPresses(void)
break; break;
#ifdef ASPECT_RATIO_SCALE #ifdef ASPECT_RATIO_SCALE
case MENUACTION_WIDESCREEN: case MENUACTION_WIDESCREEN:
if (changeValueBy > 0) { if (changeAmount > 0) {
m_PrefsUseWideScreen++; m_PrefsUseWideScreen++;
if (m_PrefsUseWideScreen > 2) if (m_PrefsUseWideScreen > 2)
m_PrefsUseWideScreen = 0; m_PrefsUseWideScreen = 0;
@ -4849,7 +4681,7 @@ CMenuManager::ProcessButtonPresses(void)
if (m_bGameNotLoaded) { if (m_bGameNotLoaded) {
RwChar** videoMods = _psGetVideoModeList(); RwChar** videoMods = _psGetVideoModeList();
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
if (changeValueBy > 0) { if (changeAmount > 0) {
do { do {
++m_nDisplayVideoMode; ++m_nDisplayVideoMode;
@ -4874,14 +4706,14 @@ CMenuManager::ProcessButtonPresses(void)
#endif #endif
case MENUACTION_AUDIOHW: case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
m_nPrefsAudio3DProviderIndex += changeValueBy; m_nPrefsAudio3DProviderIndex += changeAmount;
m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1); m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1);
} }
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
break; break;
case MENUACTION_SPEAKERCONF: case MENUACTION_SPEAKERCONF:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
m_PrefsSpeakers -= changeValueBy; m_PrefsSpeakers -= changeAmount;
m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2); m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2);
DMAudio.SetSpeakerConfig(m_PrefsSpeakers); DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
SaveSettings(); SaveSettings();
@ -4899,7 +4731,7 @@ CMenuManager::ProcessButtonPresses(void)
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu]; FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) { if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
if (option.type == FEOPTION_SELECT) { if (option.type == FEOPTION_SELECT) {
if (changeValueBy > 0) { if (changeAmount > 0) {
option.displayedValue++; option.displayedValue++;
if (option.displayedValue >= option.numRightTexts) if (option.displayedValue >= option.numRightTexts)
option.displayedValue = 0; option.displayedValue = 0;
@ -4913,7 +4745,7 @@ CMenuManager::ProcessButtonPresses(void)
*option.value = option.displayedValue; *option.value = option.displayedValue;
} }
} else if (option.type == FEOPTION_DYNAMIC) { } else if (option.type == FEOPTION_DYNAMIC) {
option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT); option.buttonPressFunc(changeAmount > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT);
} }
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
} }
@ -4925,14 +4757,14 @@ CMenuManager::ProcessButtonPresses(void)
break; break;
#endif #endif
} }
CheckSliderMovement(changeAmount);
ProcessOnOffMenuOptions(); ProcessOnOffMenuOptions();
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
if (changeValueBy < 1) { if (changeAmount < 1) {
m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN; m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN;
} else { } else {
m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN; m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
} }
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
} }
} }
} }

View file

@ -318,6 +318,8 @@ enum eCheckHover
HOVEROPTION_DECREASE_SFXVOLUME, HOVEROPTION_DECREASE_SFXVOLUME,
HOVEROPTION_INCREASE_MOUSESENS, HOVEROPTION_INCREASE_MOUSESENS,
HOVEROPTION_DECREASE_MOUSESENS, HOVEROPTION_DECREASE_MOUSESENS,
HOVEROPTION_INCREASE_MP3BOOST,
HOVEROPTION_DECREASE_MP3BOOST,
HOVEROPTION_NOT_HOVERING, HOVEROPTION_NOT_HOVERING,
}; };
@ -633,7 +635,9 @@ public:
static void PrintErrorMessage(); static void PrintErrorMessage();
void PrintStats(); void PrintStats();
void Process(); void Process();
void ProcessButtonPresses(); void ProcessList(bool &optionSelected, bool &goBack);
void UserInput();
void ProcessButtonPresses(uint8, uint8, uint8, uint8, int8);
void ProcessFileActions(); void ProcessFileActions();
void ProcessOnOffMenuOptions(); void ProcessOnOffMenuOptions();
void RequestFrontEndShutDown(); void RequestFrontEndShutDown();

View file

@ -57,7 +57,7 @@ wchar SlotSaveDate[SLOT_COUNT][70];
int CheckSum; int CheckSum;
eLevelName m_LevelToLoad; eLevelName m_LevelToLoad;
char SaveFileNameJustSaved[260]; char SaveFileNameJustSaved[260];
int Slots[SLOT_COUNT+1]; int Slots[SLOT_COUNT];
CDate CompileDateAndTime; CDate CompileDateAndTime;
bool b_FoundRecentSavedGameWantToLoad; bool b_FoundRecentSavedGameWantToLoad;

View file

@ -31,7 +31,7 @@ extern wchar SlotFileName[SLOT_COUNT][260];
extern wchar SlotSaveDate[SLOT_COUNT][70]; extern wchar SlotSaveDate[SLOT_COUNT][70];
extern int CheckSum; extern int CheckSum;
extern enum eLevelName m_LevelToLoad; extern enum eLevelName m_LevelToLoad;
extern int Slots[SLOT_COUNT+1]; extern int Slots[SLOT_COUNT];
extern bool b_FoundRecentSavedGameWantToLoad; extern bool b_FoundRecentSavedGameWantToLoad;
extern bool JustLoadedDontFadeInYet; extern bool JustLoadedDontFadeInYet;

View file

@ -88,7 +88,7 @@ void
C_PcSave::PopulateSlotInfo() C_PcSave::PopulateSlotInfo()
{ {
for (int i = 0; i < SLOT_COUNT; i++) { for (int i = 0; i < SLOT_COUNT; i++) {
Slots[i + 1] = SLOT_EMPTY; Slots[i] = SLOT_EMPTY;
SlotFileName[i][0] = '\0'; SlotFileName[i][0] = '\0';
SlotSaveDate[i][0] = '\0'; SlotSaveDate[i][0] = '\0';
} }
@ -108,14 +108,14 @@ C_PcSave::PopulateSlotInfo()
if (file != 0) { if (file != 0) {
CFileMgr::Read(file, (char*)&header, sizeof(header)); CFileMgr::Read(file, (char*)&header, sizeof(header));
if (strncmp((char*)&header, TopLineEmptyFile, sizeof(TopLineEmptyFile)-1) != 0) { if (strncmp((char*)&header, TopLineEmptyFile, sizeof(TopLineEmptyFile)-1) != 0) {
Slots[i + 1] = SLOT_OK; Slots[i] = SLOT_OK;
memcpy(SlotFileName[i], &header.FileName, sizeof(header.FileName)); memcpy(SlotFileName[i], &header.FileName, sizeof(header.FileName));
SlotFileName[i][24] = '\0'; SlotFileName[i][24] = '\0';
} }
CFileMgr::CloseFile(file); CFileMgr::CloseFile(file);
} }
if (Slots[i + 1] == SLOT_OK) { if (Slots[i] == SLOT_OK) {
if (CheckDataNotCorrupt(i, savename)) { if (CheckDataNotCorrupt(i, savename)) {
SYSTEMTIME st; SYSTEMTIME st;
memcpy(&st, &header.SaveDateTime, sizeof(SYSTEMTIME)); memcpy(&st, &header.SaveDateTime, sizeof(SYSTEMTIME));
@ -147,7 +147,7 @@ C_PcSave::PopulateSlotInfo()
} else { } else {
CMessages::InsertNumberInString(TheText.Get("FEC_SLC"), i + 1, -1, -1, -1, -1, -1, SlotFileName[i]); CMessages::InsertNumberInString(TheText.Get("FEC_SLC"), i + 1, -1, -1, -1, -1, -1, SlotFileName[i]);
Slots[i + 1] = SLOT_CORRUPTED; Slots[i] = SLOT_CORRUPTED;
} }
} }
} }