1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-22 18:10:00 +00:00

Merge pull request #695 from erorcun/master

new frontend customization
This commit is contained in:
erorcun 2020-08-25 00:57:30 +03:00 committed by GitHub
commit e01f249025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 1247 additions and 521 deletions

View file

@ -30,7 +30,7 @@ bool PrintDebugCode = false;
int16 DebugCamMode;
#ifdef FREE_CAM
bool CCamera::bFreeCam;
bool CCamera::bFreeCam = false;
int nPreviousMode = -1;
#endif

File diff suppressed because it is too large Load diff

View file

@ -155,7 +155,10 @@ enum eSaveSlot
SAVESLOT_6,
SAVESLOT_7,
SAVESLOT_8,
SAVESLOT_LABEL = 36
SAVESLOT_LABEL = 36,
#ifdef CUSTOM_FRONTEND_OPTIONS
SAVESLOT_CFO
#endif
};
#ifdef MENU_MAP
@ -235,14 +238,15 @@ enum eMenuScreen
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
MENUPAGE_MISSION_RETRY = 57,
MENUPAGE_58 = 58,
#ifdef MENU_MAP
MENUPAGE_MAP = 59,
#endif
#ifdef GRAPHICS_MENU_OPTIONS
MENUPAGE_GRAPHICS_SETTINGS,
MENUPAGE_MAP,
#endif
MENUPAGE_UNK, // 58 in game. Map page is added above, because last screen in CMenuScreens should always be empty to make CFO work
#ifdef CUSTOM_FRONTEND_OPTIONS
MENUPAGES = 65 // for some room to add more screen
#else
MENUPAGES
#endif
};
enum eMenuAction
@ -362,24 +366,15 @@ enum eMenuAction
MENUACTION_UNK112,
MENUACTION_REJECT_RETRY,
MENUACTION_UNK114,
#ifdef IMPROVED_VIDEOMODE
MENUACTION_SCREENFORMAT,
#endif
#ifdef ANISOTROPIC_FILTERING
MENUACTION_MIPMAPS,
MENUACTION_TEXTURE_FILTERING,
#endif
#ifdef MULTISAMPLING
MENUACTION_MULTISAMPLING,
#endif
#ifdef NO_ISLAND_LOADING
MENUACTION_ISLANDLOADING,
#endif
#ifdef PS2_ALPHA_TEST
MENUACTION_PS2_ALPHA_TEST,
#endif
#ifdef CUTSCENE_BORDERS_SWITCH
MENUACTION_CUTSCENEBORDERS,
//#ifdef ANISOTROPIC_FILTERING
// MENUACTION_MIPMAPS,
// MENUACTION_TEXTURE_FILTERING,
//#endif
//#ifdef NO_ISLAND_LOADING
// MENUACTION_ISLANDLOADING,
//#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
MENUACTION_TRIGGERFUNC
#endif
};
@ -466,7 +461,7 @@ struct BottomBarOption
struct CMenuScreen
{
char m_ScreenName[8];
int32 unk; // 2 on MENUPAGE_MULTIPLAYER_START, 1 on everywhere else
int32 unk; // 2 on MENUPAGE_MULTIPLAYER_START, 1 on everywhere else, 0 on unused.
int32 m_PreviousPage[2]; // eMenuScreen
int32 m_ParentEntry[2]; // row
@ -475,7 +470,7 @@ struct CMenuScreen
int32 m_Action; // eMenuAction
char m_EntryName[8];
int32 m_SaveSlot; // eSaveSlot
int32 m_TargetMenu; // eMenuScreen
int32 m_TargetMenu; // eMenuScreen // FrontendOption ID if it's a custom option
} m_aEntries[NUM_MENUROWS];
};
@ -701,8 +696,6 @@ public:
void PageUpList(bool);
void PageDownList(bool);
int8 GetPreviousPageOption();
// uint8 GetNumberOfMenuOptions();
};
#ifndef IMPROVED_VIDEOMODE
@ -710,6 +703,6 @@ VALIDATE_SIZE(CMenuManager, 0x564);
#endif
extern CMenuManager FrontEndMenuManager;
extern CMenuScreen aScreens[];
extern CMenuScreen aScreens[MENUPAGES];
#endif

View file

@ -86,6 +86,7 @@
#include "ZoneCull.h"
#include "Zones.h"
#include "debugmenu.h"
#include "frontendoption.h"
#include "postfx.h"
#include "custompipes.h"
@ -292,6 +293,10 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
#ifdef CUSTOM_FRONTEND_OPTIONS
CustomFrontendOptionsPopulate();
#endif
return true;
}

View file

@ -2,54 +2,14 @@
#include "Frontend.h"
#ifdef PC_MENU
#ifdef CUTSCENE_BORDERS_SWITCH
#define MENU_CUTSCENE_BORDERS_SWITCH(screen) MENUACTION_CUTSCENEBORDERS, "FEM_CSB", SAVESLOT_NONE, screen,
#else
#define MENU_CUTSCENE_BORDERS_SWITCH(screen)
#endif
// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp.
#ifdef IMPROVED_VIDEOMODE
#define MENU_IMPROVED_VIDEOMODE(screen) MENUACTION_SCREENFORMAT, "FEM_SCF", SAVESLOT_NONE, screen,
#else
#define MENU_IMPROVED_VIDEOMODE(screen)
#endif
#ifdef ANISOTROPIC_FILTERING
#define MENU_MIPMAPS(screen) MENUACTION_MIPMAPS, "FED_MIP", SAVESLOT_NONE, screen,
#define MENU_TEXTURE_FILTERING(screen) MENUACTION_TEXTURE_FILTERING, "FED_FIL", SAVESLOT_NONE, screen,
#else
#define MENU_MIPMAPS(screen)
#define MENU_TEXTURE_FILTERING(screen)
#endif
#ifdef MULTISAMPLING
#define MENU_MULTISAMPLING(screen) MENUACTION_MULTISAMPLING, "FED_AAS", SAVESLOT_NONE, screen,
#else
#define MENU_MULTISAMPLING(screen)
#endif
#ifdef NO_ISLAND_LOADING
#define MENU_ISLAND_LOADING(screen) MENUACTION_ISLANDLOADING, "FEM_ISL", SAVESLOT_NONE, screen,
#else
#define MENU_ISLAND_LOADING(screen)
#endif
#ifdef PS2_ALPHA_TEST
#define MENU_PS2_ALPHA_TEST(screen) MENUACTION_PS2_ALPHA_TEST, "FEM_2PR", SAVESLOT_NONE, screen,
#else
#define MENU_PS2_ALPHA_TEST(screen)
#endif
CMenuScreen aScreens[] = {
CMenuScreen aScreens[MENUPAGES] = {
// MENUPAGE_NONE = 0
{ "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// MENUPAGE_STATS = 1
#ifdef MENU_MAP
{ "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
#else
{ "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@ -62,11 +22,7 @@ CMenuScreen aScreens[] = {
},
// MENUPAGE_BRIEFS = 3
#ifdef MENU_MAP
{ "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4,
#else
{ "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@ -91,7 +47,6 @@ CMenuScreen aScreens[] = {
},
// MENUPAGE_DISPLAY_SETTINGS = 6
#ifndef GRAPHICS_MENU_OPTIONS
{ "FET_DIS", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
@ -99,28 +54,11 @@ CMenuScreen aScreens[] = {
MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENU_CUTSCENE_BORDERS_SWITCH(MENUPAGE_DISPLAY_SETTINGS)
MENU_MIPMAPS(MENUPAGE_DISPLAY_SETTINGS)
MENU_TEXTURE_FILTERING(MENUPAGE_DISPLAY_SETTINGS)
MENU_ISLAND_LOADING(MENUPAGE_DISPLAY_SETTINGS)
MENU_PS2_ALPHA_TEST(MENUPAGE_DISPLAY_SETTINGS)
MENU_MULTISAMPLING(MENUPAGE_DISPLAY_SETTINGS)
MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENU_IMPROVED_VIDEOMODE(MENUPAGE_DISPLAY_SETTINGS)
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
#else
{ "FET_DIS", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENU_CUTSCENE_BORDERS_SWITCH(MENUPAGE_DISPLAY_SETTINGS)
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif // GRAPHICS_MENU_OPTIONS
// MENUPAGE_LANGUAGE_SETTINGS = 7
{ "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
@ -381,28 +319,17 @@ CMenuScreen aScreens[] = {
},
// MENUPAGE_OPTIONS = 41
#ifdef MENU_MAP
{ "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5,
#else
{ "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,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS,
#ifdef GRAPHICS_MENU_OPTIONS
MENUACTION_CHANGEMENU, "FET_GRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
#endif
MENUACTION_CHANGEMENU, "FET_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_PLAYERSETUP, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_EXIT = 42
#ifdef MENU_MAP
{ "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6,
#else
{ "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
#endif
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_DONTCANCEL, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
@ -463,9 +390,6 @@ CMenuScreen aScreens[] = {
{ "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
MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP,
#endif
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
@ -510,38 +434,19 @@ CMenuScreen aScreens[] = {
},
#endif
// MENUPAGE_58 = 58
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
},
#ifdef MENU_MAP
// MENUPAGE_MAP = 59
// MENUPAGE_MAP
{ "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
MENUACTION_UNK110, "", SAVESLOT_NONE, MENUPAGE_NONE, // to prevent cross/enter to go back
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif
#ifdef GRAPHICS_MENU_OPTIONS
// MENUPAGE_GRAPHICS_SETTINGS = 60
{ "FET_GRA", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENU_MIPMAPS(MENUPAGE_GRAPHICS_SETTINGS)
MENU_TEXTURE_FILTERING(MENUPAGE_GRAPHICS_SETTINGS)
MENU_ISLAND_LOADING(MENUPAGE_GRAPHICS_SETTINGS)
MENU_PS2_ALPHA_TEST(MENUPAGE_GRAPHICS_SETTINGS)
MENU_MULTISAMPLING(MENUPAGE_GRAPHICS_SETTINGS)
MENU_IMPROVED_VIDEOMODE(MENUPAGE_GRAPHICS_SETTINGS)
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif
// MENUPAGE_UNK
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
},
};
#endif

View file

@ -249,7 +249,8 @@ enum Config {
# define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
# define TRIANGLE_BACK_BUTTON
//# define CIRCLE_BACK_BUTTON
# define GRAPHICS_MENU_OPTIONS
# define CUSTOM_FRONTEND_OPTIONS
# define GRAPHICS_MENU_OPTIONS // otherwise Advanced Options menu will appear if Display is full
#endif
// Script

View file

@ -71,6 +71,321 @@ mysrand(unsigned int seed)
myrand_seed = seed;
}
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "frontendoption.h"
#include "platform.h"
#include "Font.h"
void ReloadFrontendOptions(void)
{
CustomFrontendOptionsPopulate();
}
void RestoreDefGraphics(int8 action) {
if (action != FEOPTION_ACTION_SELECT)
return;
#ifdef PS2_ALPHA_TEST
gPS2alphaTest = false;
#endif
#ifdef MULTISAMPLING
FrontEndMenuManager.m_nPrefsMSAALevel = FrontEndMenuManager.m_nDisplayMSAALevel = 0;
#endif
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
CMenuManager::m_PrefsFrameLimiter = true;
CMenuManager::m_PrefsVsyncDisp = true;
CMenuManager::m_PrefsVsync = true;
CMenuManager::m_PrefsUseWideScreen = false;
FrontEndMenuManager.m_nDisplayVideoMode = FrontEndMenuManager.m_nPrefsVideoMode;
#ifdef GTA3_1_1_PATCH
if (_dwOperatingSystemVersion == OS_WIN98) {
CMBlur::BlurOn = false;
CMBlur::MotionBlurClose();
} else {
CMBlur::BlurOn = true;
CMBlur::MotionBlurOpen(Scene.camera);
}
#else
CMBlur::BlurOn = true;
#endif
FrontEndMenuManager.SaveSettings();
#endif
}
void RestoreDefDisplay(int8 action) {
if (action != FEOPTION_ACTION_SELECT)
return;
#ifdef CUTSCENE_BORDERS_SWITCH
CMenuManager::m_PrefsCutsceneBorders = true;
#endif
#ifdef FREE_CAM
TheCamera.bFreeCam = false;
#endif
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
CMenuManager::m_PrefsBrightness = 256;
CMenuManager::m_PrefsLOD = 1.2f;
CRenderer::ms_lodDistScale = 1.2f;
CMenuManager::m_PrefsShowSubtitles = true;
FrontEndMenuManager.SaveSettings();
#endif
}
#ifdef MULTISAMPLING
void MultiSamplingGoBack() {
FrontEndMenuManager.m_nDisplayMSAALevel = FrontEndMenuManager.m_nPrefsMSAALevel;
}
void MultiSamplingButtonPress(int8 action) {
if (action == FEOPTION_ACTION_SELECT) {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nPrefsMSAALevel = FrontEndMenuManager.m_nDisplayMSAALevel;
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode);
FrontEndMenuManager.SetHelperText(0);
FrontEndMenuManager.SaveSettings();
}
} else if (action == FEOPTION_ACTION_LEFT || action == FEOPTION_ACTION_RIGHT) {
if (FrontEndMenuManager.m_bGameNotLoaded) {
FrontEndMenuManager.m_nDisplayMSAALevel += (action == FEOPTION_ACTION_RIGHT ? 1 : -1);
int i = 0;
int maxAA = RwD3D8EngineGetMaxMultiSamplingLevels();
while (maxAA != 1) {
i++;
maxAA >>= 1;
}
if (FrontEndMenuManager.m_nDisplayMSAALevel < 0)
FrontEndMenuManager.m_nDisplayMSAALevel = i;
else if (FrontEndMenuManager.m_nDisplayMSAALevel > i)
FrontEndMenuManager.m_nDisplayMSAALevel = 0;
}
} else if (action == FEOPTION_ACTION_FOCUSLOSS) {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nDisplayMSAALevel = FrontEndMenuManager.m_nPrefsMSAALevel;
FrontEndMenuManager.SetHelperText(3);
}
}
}
wchar* MultiSamplingDraw(bool *disabled, bool userHovering) {
static wchar unicodeTemp[64];
if (userHovering) {
if (FrontEndMenuManager.m_nDisplayMSAALevel == FrontEndMenuManager.m_nPrefsMSAALevel) {
if (FrontEndMenuManager.m_nHelperTextMsgId == 1) // Press enter to apply
FrontEndMenuManager.ResetHelperText();
} else {
FrontEndMenuManager.SetHelperText(1);
}
}
if (!FrontEndMenuManager.m_bGameNotLoaded)
*disabled = true;
switch (FrontEndMenuManager.m_nDisplayMSAALevel) {
case 0:
return TheText.Get("FEM_OFF");
default:
sprintf(gString, "%iX", 1 << (FrontEndMenuManager.m_nDisplayMSAALevel));
AsciiToUnicode(gString, unicodeTemp);
return unicodeTemp;
}
}
#endif
#ifdef MORE_LANGUAGES
void LangPolSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
void LangRusSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
void LangJapSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
#endif
#ifdef IMPROVED_VIDEOMODE
void ScreenModeChange(int8 displayedValue)
{
if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) {
FrontEndMenuManager.m_nPrefsWindowed = displayedValue;
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution
FrontEndMenuManager.SetHelperText(0);
FrontEndMenuManager.SaveSettings();
}
}
#endif
#ifdef FREE_CAM
void FreeCamChange(int8 displayedValue)
{
TheCamera.bFreeCam = !!displayedValue;
FrontEndMenuManager.SaveSettings();
}
#endif
#ifdef CUTSCENE_BORDERS_SWITCH
void BorderModeChange(int8 displayedValue)
{
CMenuManager::m_PrefsCutsceneBorders = !!displayedValue;
FrontEndMenuManager.SaveSettings();
}
#endif
#ifdef PS2_ALPHA_TEST
void PS2AlphaTestChange(int8 displayedValue)
{
gPS2alphaTest = !!displayedValue;
FrontEndMenuManager.SaveSettings();
}
#endif
// Important: Make sure to read the warnings/informations in frontendoption.h!!
void
CustomFrontendOptionsPopulate(void)
{
RemoveCustomFrontendOptions(); // if exist
// -- Graphics/display seperation preperation starts - don't add options in here!
#ifdef GRAPHICS_MENU_OPTIONS
int graphicsMenu = FrontendScreenAdd("FET_GRA", MENUSPRITE_MAINMENU, MENUPAGE_OPTIONS, 50, 0, 20,
FONT_HEADING, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, true);
int newDisplayMenu = FrontendScreenAdd("FET_DIS", MENUSPRITE_MAINMENU, MENUPAGE_OPTIONS, 50, 0, 20,
FONT_HEADING, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, true);
FrontendOptionSetCursor(MENUPAGE_OPTIONS, 2, true);
FrontendOptionAddRedirect(TheText.Get("FET_DIS"), newDisplayMenu, 0);
FrontendOptionSetCursor(MENUPAGE_OPTIONS, 3);
FrontendOptionAddRedirect(TheText.Get("FET_GRA"), graphicsMenu, 0);
#define SWITCH_TO_GRAPHICS_MENU FrontendOptionSetCursor(graphicsMenu, -1);
#define SWITCH_TO_DISPLAY_MENU FrontendOptionSetCursor(newDisplayMenu, -1);
#define CLONE_OPTION(a, b, c, d) FrontendOptionAddBuiltinAction(a, b, c, d);
#define ADD_BACK FrontendOptionAddBackButton(TheText.Get("FEDS_TB"));
#define ADD_RESTORE_DEFAULTS(a) FrontendOptionAddDynamic(TheText.Get("FET_DEF"), nil, nil, a, nil);
#else
int advancedDisplayMenu = FrontendScreenAdd("FET_ADV", MENUSPRITE_MAINMENU, MENUPAGE_DISPLAY_SETTINGS, 50, 0, 20,
FONT_HEADING, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, true);
bool movedToAdvMenu = false;
#define SWITCH_TO_GRAPHICS_MENU \
if (GetNumberOfMenuOptions(MENUPAGE_DISPLAY_SETTINGS) >= 12) { \
FrontendOptionSetCursor(advancedDisplayMenu, -1); \
movedToAdvMenu = true; \
} else { \
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3); \
}
#define SWITCH_TO_DISPLAY_MENU SWITCH_TO_GRAPHICS_MENU
#define CLONE_OPTION(a, b, c, d)
#define ADD_BACK
#define ADD_RESTORE_DEFAULTS(a)
#endif
// -- Graphics/display seperation preperation end
static const wchar* off_on[] = { TheText.Get("FEM_OFF"), TheText.Get("FEM_ON") };
#ifdef MORE_LANGUAGES
FrontendOptionSetCursor(MENUPAGE_LANGUAGE_SETTINGS, -2);
FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, nil, LangPolSelect, nil);
FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, nil, LangRusSelect, nil);
FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, nil, LangJapSelect, nil);
#endif
#ifdef MENU_MAP
FrontendOptionSetCursor(MENUPAGE_PAUSE_MENU, 2);
FrontendOptionAddRedirect(TheText.Get("FEG_MAP"), MENUPAGE_MAP);
#endif
// -- Start of graphics menu - add options in display order!
SWITCH_TO_GRAPHICS_MENU
CLONE_OPTION(TheText.Get("FED_RES"), MENUACTION_SCREENRES, nil, nil);
CLONE_OPTION(TheText.Get("FED_WIS"), MENUACTION_WIDESCREEN, nil, nil)
#ifdef IMPROVED_VIDEOMODE
static const wchar* screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" };
// Storing isn't enabled because it's handled in Frontend
FrontendOptionAddSelect(TheText.Get("FEM_SCF"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil);
#endif
CLONE_OPTION(TheText.Get("FEM_VSC"), MENUACTION_FRAMESYNC, nil, nil);
CLONE_OPTION(TheText.Get("FEM_FRM"), MENUACTION_FRAMELIMIT, nil, nil);
#ifdef MULTISAMPLING
SWITCH_TO_GRAPHICS_MENU
FrontendOptionAddDynamic(TheText.Get("FED_AAS"), MultiSamplingDraw, (int8*)&FrontEndMenuManager.m_nPrefsMSAALevel, MultiSamplingButtonPress, MultiSamplingGoBack, true);
#endif
CLONE_OPTION(TheText.Get("FED_TRA"), MENUACTION_TRAILS, nil, nil);
#ifdef PS2_ALPHA_TEST
SWITCH_TO_GRAPHICS_MENU
FrontendOptionAddSelect(TheText.Get("FEM_2PR"), off_on, 2, (int8*)&gPS2alphaTest, false, PS2AlphaTestChange, nil, true);
#endif
ADD_RESTORE_DEFAULTS(RestoreDefGraphics)
ADD_BACK
// ---- End of Graphics Menu ----
// -- Start of Display menu - add options in display order!
SWITCH_TO_DISPLAY_MENU
CLONE_OPTION(TheText.Get("FED_BRI"), MENUACTION_BRIGHTNESS, nil, nil);
CLONE_OPTION(TheText.Get("FEM_LOD"), MENUACTION_DRAWDIST, nil, nil);
#ifdef CUTSCENE_BORDERS_SWITCH
SWITCH_TO_DISPLAY_MENU
FrontendOptionAddSelect(TheText.Get("FEM_CSB"), off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil, true);
#endif
#ifdef FREE_CAM
SWITCH_TO_DISPLAY_MENU
static const wchar* text = (wchar*)L"FREE CAM";
FrontendOptionAddSelect(text, off_on, 2, (int8*)&TheCamera.bFreeCam, false, FreeCamChange, nil, true);
#endif
CLONE_OPTION(TheText.Get("FED_SUB"), MENUACTION_SUBTITLES, nil, nil);
// Add link to advanced graphics menu if it's filled.
#ifndef GRAPHICS_MENU_OPTIONS
if (movedToAdvMenu) {
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3);
FrontendOptionAddRedirect(TheText.Get("FET_ADV"), advancedDisplayMenu, 0);
FrontendOptionSetCursor(advancedDisplayMenu, -1);
FrontendOptionAddBackButton(TheText.Get("FEDS_TB"));
}
#endif
ADD_RESTORE_DEFAULTS(RestoreDefDisplay)
ADD_BACK
}
#endif
#ifdef DEBUGMENU
void WeaponCheat();
void HealthCheat();
@ -405,6 +720,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
#ifdef CUSTOM_FRONTEND_OPTIONS
DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions);
#endif
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil);
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);

View file

@ -0,0 +1,298 @@
#include "common.h"
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "frontendoption.h"
#include "Text.h"
int numCustomFrontendOptions = 0;
FrontendOption *customFrontendOptions;
int numCustomFrontendScreens = 0;
FrontendScreen* customFrontendScreens;
int numFrontendOptionReplacements = 0;
CMenuScreen::CMenuEntry* frontendOptionReplacements;
int lastOgScreen = MENUPAGES; // means no new pages
int optionCursor = -2;
int currentMenu;
bool optionOverwrite = false;
void ChangeScreen(int screen, int option, bool fadeIn)
{
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.m_bGameNotLoaded ?
aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[0];
FrontEndMenuManager.ThingsToDoBeforeGoingBack();
ChangeScreen(screen, option, fadeIn);
}
uint8
GetNumberOfMenuOptions(int screen)
{
uint8 Rows = 0;
for (int i = 0; i < NUM_MENUROWS; i++) {
if (aScreens[screen].m_aEntries[i].m_Action == MENUACTION_NOTHING)
break;
++Rows;
}
return Rows;
}
uint8
GetLastMenuScreen()
{
uint8 page = -1;
for (int i = 0; i < MENUPAGES; i++) {
if (strcmp(aScreens[i].m_ScreenName, "") == 0 && aScreens[i].unk == 0)
break;
++page;
}
return page;
}
// Used before populating options, but effective in InitialiseChangedLanguageSettings and debugmenu
void
RemoveCustomFrontendOptions()
{
if (numCustomFrontendOptions != 0) {
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
if (aScreens[i].m_aEntries[j].m_SaveSlot == SAVESLOT_CFO) {
int ogOptionId = customFrontendOptions[aScreens[i].m_aEntries[j].m_TargetMenu].ogOptionId;
if (ogOptionId == -1) {
int k;
for (k = j; k < NUM_MENUROWS - 1; k++) {
memcpy(&aScreens[i].m_aEntries[k], &aScreens[i].m_aEntries[k + 1], sizeof(CMenuScreen::CMenuEntry));
}
aScreens[i].m_aEntries[k].m_Action = MENUACTION_NOTHING;
aScreens[i].m_aEntries[k].m_SaveSlot = SAVESLOT_NONE;
aScreens[i].m_aEntries[k].m_EntryName[0] = '\0';
j--;
} else {
memcpy(&aScreens[i].m_aEntries[j], &frontendOptionReplacements[ogOptionId], sizeof(CMenuScreen::CMenuEntry));
}
}
}
}
free(customFrontendOptions);
numCustomFrontendOptions = 0;
if (numFrontendOptionReplacements != 0) {
free(frontendOptionReplacements);
numFrontendOptionReplacements = 0;
}
}
if (numCustomFrontendScreens == 0)
return;
for (int i = 0; i < MENUPAGES; i++) {
if (i > lastOgScreen) {
aScreens[i].m_ScreenName[0] = '\0';
aScreens[i].unk = 0;
}
}
free(customFrontendScreens);
numCustomFrontendScreens = 0;
lastOgScreen = MENUPAGES;
}
int8 RegisterNewScreen(char *name, int prevPage)
{
if (lastOgScreen == MENUPAGES)
lastOgScreen = GetLastMenuScreen();
numCustomFrontendScreens++;
if (numCustomFrontendScreens == 1)
customFrontendScreens = (FrontendScreen*)malloc(5 * sizeof(FrontendScreen));
else if (numCustomFrontendScreens % 5 == 1)
customFrontendScreens = (FrontendScreen*)realloc(customFrontendScreens, (numCustomFrontendScreens + 4) * sizeof(FrontendScreen));
assert(customFrontendScreens != nil && "Custom frontend screens can't be allocated");
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].unk = 1;
return id;
}
int8 RegisterNewOption()
{
numCustomFrontendOptions++;
if (numCustomFrontendOptions == 1)
customFrontendOptions = (FrontendOption*)malloc(5 * sizeof(FrontendOption));
else if (numCustomFrontendOptions % 5 == 1)
customFrontendOptions = (FrontendOption*)realloc(customFrontendOptions, (numCustomFrontendOptions + 4) * sizeof(FrontendOption));
assert(customFrontendOptions != nil && "Custom frontend options can't be allocated");
uint8 numOptions = GetNumberOfMenuOptions(currentMenu);
uint8 curIdx;
if (optionCursor < 0) {
optionCursor = curIdx = numOptions + optionCursor + 1;
} else
curIdx = optionCursor;
if (!optionOverwrite) {
if (aScreens[currentMenu].m_aEntries[curIdx].m_Action != MENUACTION_NOTHING) {
for (int i = numOptions - 1; i >= curIdx; i--) {
memcpy(&aScreens[currentMenu].m_aEntries[i + 1], &aScreens[currentMenu].m_aEntries[i], sizeof(CMenuScreen::CMenuEntry));
}
}
}
optionCursor++;
if (optionOverwrite) {
numFrontendOptionReplacements++;
if (numFrontendOptionReplacements == 1)
frontendOptionReplacements = (CMenuScreen::CMenuEntry*)malloc(5 * sizeof(CMenuScreen::CMenuEntry));
else if (numFrontendOptionReplacements % 5 == 1)
frontendOptionReplacements = (CMenuScreen::CMenuEntry*)realloc(frontendOptionReplacements, (numFrontendOptionReplacements + 4) * sizeof(CMenuScreen::CMenuEntry));
memcpy(&frontendOptionReplacements[numFrontendOptionReplacements - 1], &aScreens[currentMenu].m_aEntries[curIdx], sizeof(CMenuScreen::CMenuEntry));
customFrontendOptions[numCustomFrontendOptions - 1].ogOptionId = numFrontendOptionReplacements - 1;
} else {
customFrontendOptions[numCustomFrontendOptions - 1].ogOptionId = -1;
}
customFrontendOptions[numCustomFrontendOptions - 1].screen = currentMenu;
aScreens[currentMenu].m_aEntries[curIdx].m_Action = MENUACTION_TRIGGERFUNC;
aScreens[currentMenu].m_aEntries[curIdx].m_SaveSlot = SAVESLOT_CFO;
aScreens[currentMenu].m_aEntries[curIdx].m_TargetMenu = numCustomFrontendOptions - 1;
aScreens[currentMenu].m_aEntries[curIdx].m_EntryName[0] = 1; // just something to fool it
return curIdx;
}
void FrontendOptionSetCursor(int screen, int8 option, bool overwrite)
{
currentMenu = screen;
optionCursor = option;
optionOverwrite = overwrite;
}
void FrontendOptionAddBuiltinAction(const wchar* leftText, int action, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc) {
int8 screenOptionOrder = RegisterNewOption();
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
// To fool the Frontend, we will still display the text passed via first param.
switch (action) {
case MENUACTION_SCREENRES:
strcpy(aScreens[currentMenu].m_aEntries[screenOptionOrder].m_EntryName, "FED_RES");
break;
case MENUACTION_AUDIOHW:
strcpy(aScreens[currentMenu].m_aEntries[screenOptionOrder].m_EntryName, "FEA_3DH");
break;
}
aScreens[currentMenu].m_aEntries[screenOptionOrder].m_Action = action;
option.type = FEOPTION_BUILTIN_ACTION;
option.buttonPressFunc = buttonPressFunc;
TextCopy(option.leftText, leftText);
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = returnPrevPageFunc;
option.save = false;
}
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc, bool save)
{
int8 screenOptionOrder = RegisterNewOption();
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.type = FEOPTION_SELECT;
TextCopy(option.leftText, leftText);
option.rightTexts = rightTexts;
option.numRightTexts = numRightTexts;
option.value = var;
option.displayedValue = *var;
option.lastSavedValue = *var;
option.save = save;
option.onlyApplyOnEnter = onlyApplyOnEnter;
option.changeFunc = changeFunc;
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = returnPrevPageFunc;
}
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc, bool save)
{
int8 screenOptionOrder = RegisterNewOption();
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.type = FEOPTION_DYNAMIC;
option.drawFunc = drawFunc;
option.buttonPressFunc = buttonPressFunc;
TextCopy(option.leftText, leftText);
option.value = var;
option.save = save;
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = returnPrevPageFunc;
}
void FrontendOptionAddRedirect(const wchar* text, int to, int8 selectedOption, bool fadeIn)
{
int8 screenOptionOrder = RegisterNewOption();
FrontendOption &option = customFrontendOptions[numCustomFrontendOptions - 1];
option.type = FEOPTION_REDIRECT;
option.to = to;
option.option = selectedOption;
option.fadeIn = fadeIn;
TextCopy(option.leftText, text);
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = nil;
option.save = false;
}
void FrontendOptionAddBackButton(const wchar* text, bool fadeIn)
{
int8 screenOptionOrder = RegisterNewOption();
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.type = FEOPTION_GOBACK;
option.fadeIn = fadeIn;
TextCopy(option.leftText, text);
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = nil;
option.save = false;
}
uint8 FrontendScreenAdd(char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight,
int8 font, float fontScaleX, float fontScaleY, int8 alignment, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc) {
uint8 screenOrder = RegisterNewScreen(gxtKey, prevPage);
FrontendScreen &screen = customFrontendScreens[numCustomFrontendScreens - 1];
screen.id = screenOrder;
screen.sprite = sprite;
screen.prevPage = prevPage;
strncpy(screen.name, gxtKey, 8);
screen.columnWidth = columnWidth;
screen.headerHeight = headerHeight;
screen.lineHeight = lineHeight;
screen.font = font;
screen.fontScaleX = fontScaleX;
screen.fontScaleY = fontScaleY;
screen.alignment = alignment;
screen.returnPrevPageFunc = returnPrevPageFunc;
return screenOrder;
}
#endif

162
src/extras/frontendoption.h Normal file
View file

@ -0,0 +1,162 @@
#pragma once
#include "common.h"
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "Frontend.h"
// Warning:
// All of the code relies on that you won't use more then NUM_MENUROWS(18) options on one page.
// Also congrats if you can make 18 options visible at once.
// About texts:
// All text parameters accept wchar(including hardcoded wchar* and TheText.Get)
// except FrontendScreenAdd(it's char[8] by the design of Frontend).
// All texts reload if custom options reloaded too, which includes language changes and via live reload feature in debug menu!
// Execute direction:
// All of the calls below eventually manipulate the aScreens array, so keep in mind to add/replace options in order,
// i.e. don't set cursor to 8 first and then 3.
// Live reload:
// You can add/change/undo the new options in-game if you use VS. Change what you want, build the changed bits via "Edit and Continue",
// and hit the "Reload custom frontend options" from debug menu. Or call CustomFrontendOptionsPopulate() from somewhere else.
// -- Option types
//
// Static/select: You allocate the variable, pass it to function and game sets it from user input among the strings given to function,
// then you can handle ChangeFunc(only called on enter if onlyApplyOnEnter set, or set immediately)
// and ReturnPrevPageFunc optionally. You can store the option in gta3.set if you pass true to corresponding parameter.
//
// Dynamic: Passing variable to function is only needed if you want to store it, otherwise you should do
// all the operations with ButtonPressFunc, this includes allocating the variable.
// Left-side text is passed while creating and static, but ofc right-side text is dynamic -
// you should return it in DrawFunc, which is called on every draw. ReturnPrevPageFunc is also here if needed.
//
// Redirect: Redirection to another screen. selectedOption parameter is the highlighted option user will see after the redirection.
//
// Built-in action: As the name suggests, any action that game has built-in. But as an extra you can set the option text,
// and can be informed on button press/focus loss via buttonPressFunc. ReturnPrevPageFunc is also here.
#define FEOPTION_SELECT 0
#define FEOPTION_DYNAMIC 1
#define FEOPTION_REDIRECT 2
#define FEOPTION_GOBACK 3
#define FEOPTION_BUILTIN_ACTION 4
// -- Returned via ButtonPressFunc() action param.
#define FEOPTION_ACTION_LEFT 0
#define FEOPTION_ACTION_RIGHT 1
#define FEOPTION_ACTION_SELECT 2
#define FEOPTION_ACTION_FOCUSLOSS 3
// -- Passed via FrontendScreenAdd()
#define FESCREEN_CENTER 0
#define FESCREEN_LEFT_ALIGN 1
#define FESCREEN_RIGHT_ALIGN 2
// -- Callbacks
// pretty much in everything I guess, and optional in all of them
typedef void (*ReturnPrevPageFunc)();
// for static options
typedef void (*ChangeFunc)(int8 displayedValue); // called before updating the value.
// only called on enter if onlyApplyOnEnter set, otherwise called on every value change
// for dynamic options
typedef wchar* (*DrawFunc)(bool* disabled, bool userHovering); // you must return a pointer for right text.
// you can also set *disabled if you want to gray it out.
typedef void (*ButtonPressFunc)(int8 action); // see FEOPTION_ACTIONs above
struct FrontendScreen
{
int id;
char name[8];
eMenuSprites sprite;
int prevPage;
int columnWidth;
int headerHeight;
int lineHeight;
int8 font;
float fontScaleX;
float fontScaleY;
int8 alignment;
bool showLeftRightHelper;
ReturnPrevPageFunc returnPrevPageFunc;
};
struct FrontendOption
{
int8 type;
int8 screenOptionOrder;
int32 screen;
wchar leftText[64];
ReturnPrevPageFunc returnPrevPageFunc;
int8* value;
int8 displayedValue; // only if onlyApplyOnEnter enabled for now
bool save;
int32 ogOptionId; // for replacements, see overwrite parameter of SetCursor
union {
// Only for dynamic / built-in action
struct {
DrawFunc drawFunc;
ButtonPressFunc buttonPressFunc;
};
// Only for static/select
struct {
const wchar** rightTexts;
int8 numRightTexts;
bool onlyApplyOnEnter;
ChangeFunc changeFunc;
int8 lastSavedValue; // only if onlyApplyOnEnter enabled
};
// Only for redirect
struct {
int to;
int8 option;
bool fadeIn;
};
};
};
// -- Internal things
void RemoveCustomFrontendOptions();
void CustomFrontendOptionsPopulate();
extern int lastOgScreen; // for reloading
extern int numCustomFrontendOptions;
extern FrontendOption* customFrontendOptions;
extern int numCustomFrontendScreens;
extern FrontendScreen* customFrontendScreens;
// -- To be used in ButtonPressFunc / ChangeFunc(this one would be weird):
void ChangeScreen(int screen, int option = 0, bool fadeIn = true);
void GoBack(bool fadeIn = true);
uint8 GetNumberOfMenuOptions(int screen);
// -- Placing the cursor to append/overwrite option
//
// Done via FrontendOptionSetCursor(screen, position, overwrite = false), parameters explained below:
// Screen: as the name suggests. Also accepts the screen IDs returned from FrontendScreenAdd.
// Option: if positive, next AddOption call will put the option to there and progress the cursor.
// if negative, cursor will be placed on bottom-(pos+1), so -1 means the very bottom, -2 means before the back button etc.
// Overwrite: Use to overwrite the options, not appending a new one. AddOption calls will still progress the cursor.
void FrontendOptionSetCursor(int screen, int8 option, bool overwrite = false);
// var is optional in AddDynamic, you can enable save parameter if you pass one, otherwise pass nil/0
void FrontendOptionAddBuiltinAction(const wchar* leftText, int action, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc);
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc, bool save = false);
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc, bool save = false);
void FrontendOptionAddRedirect(const wchar* text, int to, int8 selectedOption = 0, bool fadeIn = true);
void FrontendOptionAddBackButton(const wchar* text, bool fadeIn = true);
uint8 FrontendScreenAdd(char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight, int8 font, float fontScaleX, float fontScaleY, int8 alignment, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc = nil);
#endif