Dynamically add pipelines options, only if neo.txd exists

This commit is contained in:
erorcun 2020-12-27 23:26:00 +03:00
parent 637cff3180
commit 9afcc355ff
4 changed files with 37 additions and 24 deletions

View File

@ -3079,6 +3079,13 @@ CMenuManager::LoadSettings()
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME); strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
strcpy(m_aSkinName, DEFAULT_SKIN_NAME); strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
} }
#ifdef CUSTOM_FRONTEND_OPTIONS
// Apparently this func. can be run multiple times at the start.
if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
CustomFrontendOptionsPopulate();
}
#endif
#ifdef LOAD_INI_SETTINGS #ifdef LOAD_INI_SETTINGS
LoadINISettings(); // needs frontend options to be loaded LoadINISettings(); // needs frontend options to be loaded
#endif #endif

View File

@ -67,16 +67,6 @@
#define POSTFX_SELECTORS #define POSTFX_SELECTORS
#endif #endif
#ifdef EXTENDED_PIPELINES
#define PIPELINES_SELECTOR \
MENUACTION_CFO_SELECT, "FED_VPL", { new CCFOSelect((int8*)&CustomPipes::VehiclePipeSwitch, "VehiclePipeline", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), false, nil) }, 0, 0, MENUALIGN_LEFT, \
MENUACTION_CFO_SELECT, "FED_PRM", { new CCFOSelect((int8*)&CustomPipes::RimlightEnable, "NeoRimLight", off_on, 2, false, nil) }, 0, 0, MENUALIGN_LEFT, \
MENUACTION_CFO_SELECT, "FED_WLM", { new CCFOSelect((int8*)&CustomPipes::LightmapEnable, "NeoLightMaps", off_on, 2, false, nil) }, 0, 0, MENUALIGN_LEFT, \
MENUACTION_CFO_SELECT, "FED_RGL", { new CCFOSelect((int8*)&CustomPipes::GlossEnable, "NeoRoadGloss", off_on, 2, false, nil) }, 0, 0, MENUALIGN_LEFT,
#else
#define PIPELINES_SELECTOR
#endif
#ifdef INVERT_LOOK_FOR_PAD #ifdef INVERT_LOOK_FOR_PAD
#define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_ILU", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, nil, off_on, 2, false, nil) }, 150, 0, MENUALIGN_LEFT, #define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_ILU", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, nil, off_on, 2, false, nil) }, 150, 0, MENUALIGN_LEFT,
#else #else
@ -84,7 +74,6 @@
#endif #endif
const char *filterNames[] = { "FEM_NON", "FEM_SIM", "FEM_NRM", "FEM_MOB" }; const char *filterNames[] = { "FEM_NON", "FEM_SIM", "FEM_NRM", "FEM_MOB" };
const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" };
const char *off_on[] = { "FEM_OFF", "FEM_ON" }; const char *off_on[] = { "FEM_OFF", "FEM_ON" };
void RestoreDefGraphics(int8 action) { void RestoreDefGraphics(int8 action) {
@ -385,7 +374,7 @@ CMenuScreenCustom aScreens[] = {
CUTSCENE_BORDERS_TOGGLE CUTSCENE_BORDERS_TOGGLE
FREE_CAM_TOGGLE FREE_CAM_TOGGLE
POSTFX_SELECTORS POSTFX_SELECTORS
PIPELINES_SELECTOR // re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined
MENUACTION_RESTOREDEF, "FET_DEF", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 320, 0, MENUALIGN_CENTER, MENUACTION_RESTOREDEF, "FET_DEF", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 320, 0, MENUALIGN_CENTER,
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 0, MENUALIGN_CENTER, MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 0, MENUALIGN_CENTER,
}, },
@ -696,14 +685,14 @@ CMenuScreenCustom aScreens[] = {
#endif #endif
MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT,
MULTISAMPLING_SELECTOR MULTISAMPLING_SELECTOR
ISLAND_LOADING_SELECTOR
DUALPASS_SELECTOR
#ifdef EXTENDED_COLOURFILTER #ifdef EXTENDED_COLOURFILTER
POSTFX_SELECTORS POSTFX_SELECTORS
#elif defined LEGACY_MENU_OPTIONS #elif defined LEGACY_MENU_OPTIONS
MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT,
#endif #endif
PIPELINES_SELECTOR // re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined
ISLAND_LOADING_SELECTOR
DUALPASS_SELECTOR
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefGraphics) }, 320, 0, MENUALIGN_CENTER, MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefGraphics) }, 320, 0, MENUALIGN_CENTER,
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 0, MENUALIGN_CENTER, MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 0, MENUALIGN_CENTER,
}, },

View File

@ -71,7 +71,6 @@
#include "Ropes.h" #include "Ropes.h"
#include "postfx.h" #include "postfx.h"
#include "custompipes.h" #include "custompipes.h"
#include "frontendoption.h"
#include "screendroplets.h" #include "screendroplets.h"
GlobalScene Scene; GlobalScene Scene;
@ -482,13 +481,6 @@ Initialise3D(void *param)
DebugMenuInit(); DebugMenuInit();
DebugMenuPopulate(); DebugMenuPopulate();
#endif // !DEBUGMENU #endif // !DEBUGMENU
#ifdef CUSTOM_FRONTEND_OPTIONS
// Apparently this func. can be run multiple times at the start.
if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
// needs stored language and TheText to be loaded, and last TheText reload is at the start of here
CustomFrontendOptionsPopulate();
}
#endif
bool ret = CGame::InitialiseRenderWare(); bool ret = CGame::InitialiseRenderWare();
#ifdef EXTENDED_PIPELINES #ifdef EXTENDED_PIPELINES
CustomPipes::CustomPipeInit(); // need Scene.world for this CustomPipes::CustomPipeInit(); // need Scene.world for this

View File

@ -33,9 +33,10 @@
#include "postfx.h" #include "postfx.h"
#include "custompipes.h" #include "custompipes.h"
#include "MemoryHeap.h" #include "MemoryHeap.h"
#include "custompipes.h"
#include "FileMgr.h"
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#include "FileMgr.h"
#include "ControllerConfig.h" #include "ControllerConfig.h"
#endif #endif
@ -84,6 +85,30 @@ void
CustomFrontendOptionsPopulate(void) CustomFrontendOptionsPopulate(void)
{ {
// Moved to an array in MenuScreensCustom.cpp, but APIs are still available. see frontendoption.h // Moved to an array in MenuScreensCustom.cpp, but APIs are still available. see frontendoption.h
// These work only if we have neo folder, so they're dynamically added
#ifdef EXTENDED_PIPELINES
const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" };
const char *off_on[] = { "FEM_OFF", "FEM_ON" };
int fd = CFileMgr::OpenFile("neo/neo.txd","r");
if (fd) {
#ifdef GRAPHICS_MENU_OPTIONS
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
#else
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
#endif
CFileMgr::CloseFile(fd);
}
#endif
} }
#endif #endif