diff options
Diffstat (limited to 'src/extras/frontendoption.cpp')
-rw-r--r-- | src/extras/frontendoption.cpp | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/src/extras/frontendoption.cpp b/src/extras/frontendoption.cpp index 5d388bfd..2660e75e 100644 --- a/src/extras/frontendoption.cpp +++ b/src/extras/frontendoption.cpp @@ -13,24 +13,9 @@ int optionCursor = -2; int currentMenu; bool optionOverwrite = false; -void ChangeScreen(int screen, int option, bool fadeIn) +void GoBack() { - FrontEndMenuManager.m_nPrevScreen = FrontEndMenuManager.m_nCurrScreen; - FrontEndMenuManager.m_nCurrScreen = screen; - FrontEndMenuManager.m_nCurrOption = option; - if (fadeIn) - FrontEndMenuManager.m_nMenuFadeAlpha = 0; -} - -void GoBack(bool fadeIn) -{ - int screen = !FrontEndMenuManager.m_bGameNotLoaded ? - aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[0]; - int option = FrontEndMenuManager.GetPreviousPageOption(); - - FrontEndMenuManager.ThingsToDoBeforeGoingBack(); - - ChangeScreen(screen, option, fadeIn); + FrontEndMenuManager.SwitchToNewScreen(-1); } uint8 @@ -51,7 +36,7 @@ GetLastMenuScreen() { int8 page = -1; for (int i = 0; i < MENUPAGES; i++) { - if (strcmp(aScreens[i].m_ScreenName, "") == 0 && aScreens[i].m_PreviousPage[0] == MENUPAGE_NONE) + if (strcmp(aScreens[i].m_ScreenName, "") == 0 && aScreens[i].m_PreviousPage == MENUPAGE_NONE) break; ++page; @@ -68,7 +53,7 @@ int8 RegisterNewScreen(const char *name, int prevPage, ReturnPrevPageFunc return int id = lastOgScreen + numCustomFrontendScreens; assert(id < MENUPAGES && "No room for new custom frontend screens! Increase MENUPAGES"); strncpy(aScreens[id].m_ScreenName, name, 8); - aScreens[id].m_PreviousPage[0] = aScreens[id].m_PreviousPage[1] = prevPage; + aScreens[id].m_PreviousPage = prevPage; aScreens[id].returnPrevPageFunc = returnPrevPageFunc; return id; } @@ -101,7 +86,7 @@ void FrontendOptionSetCursor(int screen, int8 option, bool overwrite) optionOverwrite = overwrite; } -void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMenu, int saveSlot) { +void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint8 align, int action, int targetMenu, int saveSlot) { int8 screenOptionOrder = RegisterNewOption(); CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder]; @@ -118,17 +103,23 @@ void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMe strncpy(option.m_EntryName, gxtKey, 8); break; } + option.m_X = x; + option.m_Y = y; + option.m_Align = align; option.m_Action = action; option.m_SaveSlot = saveSlot; option.m_TargetMenu = targetMenu; } -void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveCat, const char* saveKey, bool disableIfGameLoaded) +void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveCat, const char* saveName, bool disableIfGameLoaded) { int8 screenOptionOrder = RegisterNewOption(); CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder]; option.m_Action = MENUACTION_CFO_SELECT; + option.m_X = x; + option.m_Y = y; + option.m_Align = align; strncpy(option.m_EntryName, gxtKey, 8); option.m_CFOSelect = new CCFOSelect(); option.m_CFOSelect->rightTexts = (char**)malloc(numRightTexts * sizeof(char*)); @@ -140,42 +131,39 @@ void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 n option.m_CFOSelect->lastSavedValue = *var; } option.m_CFOSelect->saveCat = saveCat; - option.m_CFOSelect->save = saveKey; + option.m_CFOSelect->save = saveName; option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter; option.m_CFOSelect->changeFunc = changeFunc; option.m_CFOSelect->disableIfGameLoaded = disableIfGameLoaded; } -void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat, const char* saveKey) +void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat, const char* saveName) { int8 screenOptionOrder = RegisterNewOption(); CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder]; option.m_Action = MENUACTION_CFO_DYNAMIC; + option.m_X = x; + option.m_Y = y; + option.m_Align = align; strncpy(option.m_EntryName, gxtKey, 8); option.m_CFODynamic = new CCFODynamic(); option.m_CFODynamic->drawFunc = drawFunc; option.m_CFODynamic->buttonPressFunc = buttonPressFunc; option.m_CFODynamic->value = var; option.m_CFODynamic->saveCat = saveCat; - option.m_CFODynamic->save = saveKey; + option.m_CFODynamic->save = saveName; } -uint8 FrontendScreenAdd(const char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight, - int8 font, float fontScaleX, float fontScaleY, int8 alignment, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc) { +// lineHeight = 0 means game will use MENU_DEFAULT_LINE_HEIGHT +uint8 FrontendScreenAdd(const char* gxtKey, int prevPage, int lineHeight, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc) { uint8 screenOrder = RegisterNewScreen(gxtKey, prevPage, returnPrevPageFunc); CCustomScreenLayout *screen = new CCustomScreenLayout(); aScreens[screenOrder].layout = screen; - screen->sprite = sprite; - screen->columnWidth = columnWidth; - screen->headerHeight = headerHeight; screen->lineHeight = lineHeight; - screen->font = font; - screen->fontScaleX = fontScaleX; - screen->fontScaleY = fontScaleY; - screen->alignment = alignment; + screen->showLeftRightHelper = showLeftRightHelper; return screenOrder; } |