Don't show menu map and new languages if gamefiles isn't copied

This commit is contained in:
erorcun 2021-02-07 20:35:43 +03:00
parent c7ba01b034
commit d224f8b7ee
6 changed files with 67 additions and 55 deletions

View file

@ -3655,7 +3655,13 @@ CMenuManager::LoadAllTextures()
m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
}
#ifdef MENU_MAP
static bool menuOptionAdded = false;
for (int i = 0; i < ARRAY_SIZE(MapFilenames); i++) {
if (!menuOptionAdded && RwTextureRead(MapFilenames[i][0], MapFilenames[i][1])) {
FrontendOptionSetCursor(MENUPAGE_PAUSE_MENU, 2, false);
FrontendOptionAddBuiltinAction("FEG_MAP", MENUACTION_CHANGEMENU, MENUPAGE_MAP, SAVESLOT_NONE);
menuOptionAdded = true;
}
m_aMapSprites[i].SetTexture(MapFilenames[i][0], MapFilenames[i][1]);
m_aMapSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
}

View file

@ -235,11 +235,11 @@ enum eMenuScreen
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
MENUPAGE_MISSION_RETRY = 57,
#ifdef CUSTOM_FRONTEND_OPTIONS
#ifdef MENU_MAP
MENUPAGE_MAP = 58,
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
#ifdef GRAPHICS_MENU_OPTIONS
MENUPAGE_GRAPHICS_SETTINGS,
#endif

View file

@ -394,9 +394,6 @@ CMenuScreen aScreens[MENUPAGES] = {
{ "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,
@ -441,14 +438,6 @@ CMenuScreen aScreens[MENUPAGES] = {
},
#endif
#ifdef MENU_MAP
// MENUPAGE_MAP
{ "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 2,
MENUACTION_UNK110, "", SAVESLOT_NONE, MENUPAGE_NONE, // to prevent cross/enter to go back
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif
// MENUPAGE_UNK
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,

View file

@ -195,38 +195,6 @@ void IslandLoadingAfterChange(int8 before, int8 after) {
}
#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
#ifndef MULTISAMPLING
void GraphicsGoBack() {
}
@ -497,11 +465,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
MENUACTION_LANG_GER, "FEL_GER", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
MENUACTION_LANG_ITA, "FEL_ITA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
MENUACTION_LANG_SPA, "FEL_SPA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
#ifdef MORE_LANGUAGES
MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, nil, LangPolSelect) },
MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, nil, LangRusSelect) },
MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, nil, LangJapSelect) },
#endif
// CustomFrontendOptionsPopulate will add languages here, if files are found
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
@ -836,9 +800,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
{ "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_RESUME, "FEM_RES", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEN_STA", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME },
#ifdef MENU_MAP
MENUACTION_CHANGEMENU, "FEG_MAP", { nil, SAVESLOT_NONE, MENUPAGE_MAP },
#endif
// CMenuManager::LoadAllTextures will add map here, if MENU_MAP enabled and map textures are found
MENUACTION_CHANGEMENU, "FEP_STA", { nil, SAVESLOT_NONE, MENUPAGE_STATS },
MENUACTION_CHANGEMENU, "FEP_BRI", { nil, SAVESLOT_NONE, MENUPAGE_BRIEFS },
MENUACTION_CHANGEMENU, "FET_OPT", { nil, SAVESLOT_NONE, MENUPAGE_OPTIONS },

View file

@ -312,7 +312,6 @@ enum Config {
# define PS2_MENU
//# define PS2_MENU_USEALLPAGEICONS
#else
# define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
# ifdef XINPUT
# define GAMEPAD_MENU // Add gamepad menu
@ -326,6 +325,7 @@ enum Config {
# define CUSTOM_FRONTEND_OPTIONS
# ifdef CUSTOM_FRONTEND_OPTIONS
# define MENU_MAP // VC-like menu map. Won't appear if you don't have our menu.txd
# define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable
# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
# define CUTSCENE_BORDERS_SWITCH

View file

@ -85,16 +85,49 @@ mysrand(unsigned int seed)
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "frontendoption.h"
#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
void
CustomFrontendOptionsPopulate(void)
{
// 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
int fd;
#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");
fd = CFileMgr::OpenFile("neo/neo.txd","r");
if (fd) {
#ifdef GRAPHICS_MENU_OPTIONS
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
@ -113,6 +146,28 @@ CustomFrontendOptionsPopulate(void)
}
#endif
// Add outsourced language translations, if files are found
#ifdef MORE_LANGUAGES
FrontendOptionSetCursor(MENUPAGE_LANGUAGE_SETTINGS, 5, false);
fd = CFileMgr::OpenFile("text/polish.gxt","r");
if (fd) {
FrontendOptionAddDynamic("FEL_POL", nil, nil, LangPolSelect, nil, nil);
CFileMgr::CloseFile(fd);
}
fd = CFileMgr::OpenFile("text/russian.gxt","r");
if (fd) {
FrontendOptionAddDynamic("FEL_RUS", nil, nil, LangRusSelect, nil, nil);
CFileMgr::CloseFile(fd);
}
fd = CFileMgr::OpenFile("text/japanese.gxt","r");
if (fd) {
FrontendOptionAddDynamic("FEL_JAP", nil, nil, LangJapSelect, nil, nil);
CFileMgr::CloseFile(fd);
}
#endif
}
#endif