Frontend fixes + triangle for back as default

This commit is contained in:
eray orçunus 2020-04-12 20:22:28 +03:00
parent bde3ef4f43
commit 8b2138f7bd
5 changed files with 62 additions and 42 deletions

View File

@ -44,16 +44,27 @@
#define FEET_IN_METER 3.33f #define FEET_IN_METER 3.33f
#endif #endif
#define SCROLLABLE_STATS_PAGE
#ifdef SCROLLABLE_STATS_PAGE #ifdef SCROLLABLE_STATS_PAGE
#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS) #define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS)
#else #else
#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS) #define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS)
#endif #endif
#ifdef TRIANGLE_BACK_BUTTON
#define GetBackJustUp GetTriangleJustUp
#define GetBackJustDown GetTriangleJustDown
#elif defined(CIRCLE_BACK_BUTTON)
#define GetBackJustUp GetCircleJustUp
#define GetBackJustDown GetCircleJustDown
#else
#define GetBackJustUp GetSquareJustUp
#define GetBackJustDown GetSquareJustDown
#endif
#ifdef MENU_MAP #ifdef MENU_MAP
bool CMenuManager::bMenuMapActive = false; bool CMenuManager::bMenuMapActive = false;
bool CMenuManager::bMapMouseShownOnce = false; bool CMenuManager::bMapMouseShownOnce = false;
bool CMenuManager::bMapLoaded = false;
float CMenuManager::fMapSize; float CMenuManager::fMapSize;
float CMenuManager::fMapCenterY; float CMenuManager::fMapCenterY;
float CMenuManager::fMapCenterX; float CMenuManager::fMapCenterX;
@ -359,11 +370,6 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
inline void inline void
CMenuManager::ThingsToDoBeforeLeavingPage() 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) { if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
} else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) { } else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
@ -719,13 +725,6 @@ CMenuManager::Draw()
else else
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName); str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break; 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: case MENUPAGE_SAVE_OVERWRITE_CONFIRM:
if (Slots[m_nCurrSaveSlot + 1] == SLOT_EMPTY) if (Slots[m_nCurrSaveSlot + 1] == SLOT_EMPTY)
str = TheText.Get("FESZ_QZ"); str = TheText.Get("FESZ_QZ");
@ -743,20 +742,12 @@ CMenuManager::Draw()
break; 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 #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 here. // 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); CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(menuXYpadding), str);
#else #else
CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str); CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str);
#endif #endif
}
} }
CFont::SetCentreSize(SCREEN_WIDTH); CFont::SetCentreSize(SCREEN_WIDTH);
@ -3337,6 +3328,7 @@ CMenuManager::Process(void)
m_bWantToRestart = false; m_bWantToRestart = false;
InitialiseChangedLanguageSettings(); InitialiseChangedLanguageSettings();
// Just a hack by R* to not make game continuously resume/pause. But we it seems we can live with it.
if (CPad::GetPad(0)->GetEscapeJustDown()) if (CPad::GetPad(0)->GetEscapeJustDown())
RequestFrontEndStartUp(); RequestFrontEndStartUp();
@ -3662,7 +3654,7 @@ CMenuManager::ProcessButtonPresses(void)
} }
#ifndef TIDY_UP_PBP #ifndef TIDY_UP_PBP
if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustDown()) { if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustDown()) {
m_bShowMouse = false; m_bShowMouse = false;
goBack = true; goBack = true;
} }
@ -3741,7 +3733,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) { if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) {
optionSelected = true; optionSelected = true;
} }
if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustUp()) { if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
if (m_nCurrScreen != MENUPAGE_START_MENU) { if (m_nCurrScreen != MENUPAGE_START_MENU) {
goBack = true; goBack = true;
} }
@ -4009,7 +4001,7 @@ CMenuManager::ProcessButtonPresses(void)
} }
#ifndef TIDY_UP_PBP #ifndef TIDY_UP_PBP
if (CPad::GetPad(0)->GetSquareJustDown()) { if (CPad::GetPad(0)->GetBackJustDown()) {
if (m_nCurrScreen != MENUPAGE_START_MENU && m_nCurrScreen != MENUPAGE_PAUSE_MENU) { if (m_nCurrScreen != MENUPAGE_START_MENU && m_nCurrScreen != MENUPAGE_PAUSE_MENU) {
m_bShowMouse = false; m_bShowMouse = false;
goBack = true; goBack = true;
@ -4050,11 +4042,11 @@ CMenuManager::ProcessButtonPresses(void)
if (!goDown && !goUp && !optionSelected) { if (!goDown && !goUp && !optionSelected) {
if (m_nCurrScreen != MENUPAGE_START_MENU) { if (m_nCurrScreen != MENUPAGE_START_MENU) {
if (isPlainTextScreen(m_nCurrScreen)) { if (isPlainTextScreen(m_nCurrScreen)) {
if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustUp()) { if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
goBack = true; goBack = true;
} }
} else { } else {
if (CPad::GetPad(0)->GetEscapeJustDown() || (m_nCurrScreen != MENUPAGE_PAUSE_MENU && CPad::GetPad(0)->GetSquareJustDown())) { if (CPad::GetPad(0)->GetEscapeJustDown() || (m_nCurrScreen != MENUPAGE_PAUSE_MENU && CPad::GetPad(0)->GetBackJustDown())) {
m_bShowMouse = false; m_bShowMouse = false;
goBack = true; goBack = true;
} }
@ -4300,12 +4292,7 @@ CMenuManager::ProcessButtonPresses(void)
} else { } else {
#ifdef MENU_MAP #ifdef MENU_MAP
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu == MENUPAGE_MAP) { if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu == MENUPAGE_MAP) {
fMapCenterX = SCREEN_WIDTH / 2; bMapLoaded = false;
fMapCenterY = SCREEN_HEIGHT / 3;
fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio();
bMapMouseShownOnce = false;
CPad::GetPad(0)->Clear(false);
CPad::GetPad(1)->Clear(false);
} }
#endif #endif
@ -4913,8 +4900,19 @@ CMenuManager::SwitchMenuOnAndOff()
pControlEdit = nil; pControlEdit = nil;
m_bShutDownFrontEndRequested = false; m_bShutDownFrontEndRequested = false;
DisplayComboButtonErrMsg = false; DisplayComboButtonErrMsg = false;
CPad::GetPad(0)->Clear(0);
CPad::GetPad(1)->Clear(0); #ifdef REGISTER_START_BUTTON
int16 start1 = CPad::GetPad(0)->PCTempJoyState.Start, start2 = CPad::GetPad(0)->PCTempKeyState.Start,
start3 = CPad::GetPad(0)->OldState.Start, start4 = CPad::GetPad(0)->NewState.Start;
#endif
CPad::GetPad(0)->Clear(false);
CPad::GetPad(1)->Clear(false);
#ifdef REGISTER_START_BUTTON
CPad::GetPad(0)->PCTempJoyState.Start = start1;
CPad::GetPad(0)->PCTempKeyState.Start = start2;
CPad::GetPad(0)->OldState.Start = start3;
CPad::GetPad(0)->NewState.Start = start4;
#endif
m_nCurrScreen = MENUPAGE_NONE; m_nCurrScreen = MENUPAGE_NONE;
} }
} }
@ -5243,6 +5241,20 @@ CMenuManager::PrintMap(void)
bMenuMapActive = true; bMenuMapActive = true;
CRadar::InitFrontEndMap(); CRadar::InitFrontEndMap();
if (!bMapLoaded) {
fMapCenterX = SCREEN_WIDTH / 2;
fMapCenterY = SCREEN_HEIGHT / 3;
fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio();
bMapMouseShownOnce = false;
bMapLoaded = true;
// Let's wait for a frame to not toggle the waypoint
if (CPad::GetPad(0)->NewState.Cross) {
bMenuMapActive = false;
return;
}
}
// Because fMapSize is half of the map length, and map consists of 3x3 tiles. // Because fMapSize is half of the map length, and map consists of 3x3 tiles.
float halfTile = fMapSize / 3.0f; float halfTile = fMapSize / 3.0f;
@ -5601,6 +5613,9 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
} }
#endif #endif
#undef GetBackJustUp
#undef GetBackJustDown
STARTPATCHES STARTPATCHES
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

@ -196,7 +196,7 @@ enum eMenuScreen
MENUPAGE_NEW_GAME_RELOAD = 10, MENUPAGE_NEW_GAME_RELOAD = 10,
MENUPAGE_LOAD_SLOT_CONFIRM = 11, MENUPAGE_LOAD_SLOT_CONFIRM = 11,
MENUPAGE_DELETE_SLOT_CONFIRM = 12, MENUPAGE_DELETE_SLOT_CONFIRM = 12,
MENUPAGE_NO_MEMORY_CARD = 13, MENUPAGE_NO_MEMORY_CARD = 13, // hud adjustment page in mobile
MENUPAGE_LOADING_IN_PROGRESS = 14, MENUPAGE_LOADING_IN_PROGRESS = 14,
MENUPAGE_DELETING_IN_PROGRESS = 15, MENUPAGE_DELETING_IN_PROGRESS = 15,
MENUPAGE_PS2_LOAD_FAILED = 16, MENUPAGE_PS2_LOAD_FAILED = 16,
@ -240,7 +240,7 @@ enum eMenuScreen
MENUPAGE_SKIN_SELECT = 54, MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55, MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56, MENUPAGE_MOUSE_CONTROLS = 56,
MENUPAGE_57 = 57, MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile
MENUPAGE_58 = 58, MENUPAGE_58 = 58,
#ifdef MENU_MAP #ifdef MENU_MAP
MENUPAGE_MAP = 59, MENUPAGE_MAP = 59,
@ -570,6 +570,7 @@ public:
#ifdef MENU_MAP #ifdef MENU_MAP
static bool bMenuMapActive; static bool bMenuMapActive;
static bool bMapMouseShownOnce; static bool bMapMouseShownOnce;
static bool bMapLoaded;
static float fMapSize; static float fMapSize;
static float fMapCenterY; static float fMapCenterY;
static float fMapCenterX; static float fMapCenterX;

View File

@ -128,7 +128,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_NO_MEMORY_CARD = 13 // MENUPAGE_NO_MEMORY_CARD = 13
{ "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, { "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FEC_OFI", SAVESLOT_NONE, MENUPAGE_NONE, // only in mobile. FEC_OFI is missing // hud adjustment page in mobile
}, },
// MENUPAGE_LOADING_IN_PROGRESS = 14 // MENUPAGE_LOADING_IN_PROGRESS = 14
@ -444,7 +444,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_57 = 57 // MENUPAGE_57 = 57
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0, { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
// mission failed, wanna restart page in mobile
}, },
// MENUPAGE_58 = 58 // MENUPAGE_58 = 58

View File

@ -418,6 +418,7 @@ public:
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); } bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); } bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
bool GetTriangleJustUp() { return !!(!NewState.Triangle && OldState.Triangle); }
bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); } bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); }
bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); } bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); }
bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); } bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); }

View File

@ -192,7 +192,7 @@ enum Config {
// Pad // Pad
#define XINPUT #define XINPUT
#define KANGAROO_CHEAT #define KANGAROO_CHEAT
#define REGISTER_START_BUTTON // currently only in menu sadly. resumes the game #define REGISTER_START_BUTTON
// Hud, frontend and radar // Hud, frontend and radar
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios #define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
@ -200,6 +200,9 @@ enum Config {
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box #define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc. // #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
#define MENU_MAP // VC-like menu map. Make sure you have new menu.txd #define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
#define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
#define TRIANGLE_BACK_BUTTON
// #define CIRCLE_BACK_BUTTON
// Script // Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default #define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default