mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
- more work on graphics substitutiion
* added a CVAR that sets how localizable graphics need to be dealt with. * pass the substitution string to OkForLocalization so that proper checks can be performed. * increased item spacing on Doom's list menus to 18 from 16 pixels, because otherwise the diacritic letters would not fit. 20 would have been more ideal but 18 was the limit without compromising its visual style * added a second text-only main menu because here the spacing cannot be changed. Doing so would render any single-patch main menu non-functional. So here the rules are that if substitution takes place, it will swap out the entire menu class. * fixed some issues with the summary screen's "entering" and "finished" graphics.
This commit is contained in:
parent
a0c10df387
commit
48fcdacf06
16 changed files with 191 additions and 112 deletions
|
@ -838,7 +838,7 @@ void FMapInfoParser::ParseCluster()
|
|||
auto fn = Wads.GetWadName(fileno);
|
||||
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
|
||||
{
|
||||
FStringf key("TXT_%.5s_%s", fn, clusterinfo->ExitText);
|
||||
FStringf key("TXT_%.5s_%s", fn, clusterinfo->ExitText.GetChars());
|
||||
if (GStrings.exists(key))
|
||||
{
|
||||
clusterinfo->ExitText = key;
|
||||
|
|
|
@ -59,8 +59,6 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mBackButton)
|
|||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenMapNameFont)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringFont)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedFont)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringPatch)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedPatch)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gibfactor)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, intermissioncounter)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single)
|
||||
|
@ -425,8 +423,6 @@ void FMapInfoParser::ParseGameInfo()
|
|||
GAMEINFOKEY_FONT(mStatscreenMapNameFont, "statscreen_mapnamefont")
|
||||
GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont")
|
||||
GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont")
|
||||
GAMEINFOKEY_PATCH(mStatscreenFinishedPatch, "statscreen_finishedpatch")
|
||||
GAMEINFOKEY_PATCH(mStatscreenEnteringPatch, "statscreen_enteringpatch")
|
||||
GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass")
|
||||
GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.)
|
||||
GAMEINFOKEY_STRING(Dialogue, "dialogue")
|
||||
|
|
|
@ -190,8 +190,6 @@ struct gameinfo_t
|
|||
FGIFont mStatscreenMapNameFont;
|
||||
FGIFont mStatscreenFinishedFont;
|
||||
FGIFont mStatscreenEnteringFont;
|
||||
FGIFont mStatscreenFinishedPatch;
|
||||
FGIFont mStatscreenEnteringPatch;
|
||||
bool norandomplayerclass;
|
||||
bool forcekillscripts;
|
||||
FName statusscreen_single;
|
||||
|
|
|
@ -304,13 +304,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture)
|
|||
ACTION_RETURN_INT(CheckForTexture(name, type, flags));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_TexMan, OkForLocalization)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(name);
|
||||
ACTION_RETURN_INT(true); // work for later. We need the definition to implement the language support
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: ListTextures
|
||||
|
@ -400,6 +393,35 @@ FTexture *FTextureManager::FindTexture(const char *texname, ETextureType usetype
|
|||
return GetTexture(texnum.GetIndex());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: OkForLocalization
|
||||
//
|
||||
//==========================================================================
|
||||
CVAR(Int, cl_localizationmode,0, CVAR_ARCHIVE)
|
||||
|
||||
bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitute)
|
||||
{
|
||||
if (!texnum.isValid()) return false;
|
||||
|
||||
// Todo: Some decisions must be made here whether this texture is ok to use with the current locale settings.
|
||||
return !cl_localizationmode;
|
||||
}
|
||||
|
||||
static int OkForLocalization(int index, const FString &substitute)
|
||||
{
|
||||
return TexMan.OkForLocalization(FSetTextureID(index), substitute);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, OkForLocalization, OkForLocalization)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(name);
|
||||
PARAM_STRING(subst)
|
||||
ACTION_RETURN_INT(OkForLocalization(name, subst));
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: AddTexture
|
||||
|
|
|
@ -562,6 +562,7 @@ public:
|
|||
}
|
||||
|
||||
FTexture *FindTexture(const char *texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny);
|
||||
bool OkForLocalization(FTextureID texnum, const char *substitute);
|
||||
|
||||
void FlushAll();
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "vm.h"
|
||||
#include "events.h"
|
||||
#include "v_video.h"
|
||||
#include "i_system.h"
|
||||
#include "scripting/types.h"
|
||||
|
||||
int DMenu::InMenu;
|
||||
|
@ -404,11 +405,38 @@ DEFINE_ACTION_FUNCTION(DMenu, ActivateMenu)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
EXTERN_CVAR(Int, cl_localizationmode)
|
||||
|
||||
|
||||
void M_SetMenu(FName menu, int param)
|
||||
{
|
||||
// some menus need some special treatment
|
||||
switch (menu)
|
||||
{
|
||||
case NAME_Mainmenu:
|
||||
if (gameinfo.gametype & GAME_DoomStrifeChex)
|
||||
{
|
||||
// For these games we must check up-front if they get localized because in that case another template must be used.
|
||||
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Playerclassmenu);
|
||||
if (desc != nullptr)
|
||||
{
|
||||
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
||||
{
|
||||
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
||||
if (ld->mFromEngine && cl_localizationmode != 0)
|
||||
{
|
||||
// This assumes that replacing one graphic will replace all of them.
|
||||
// So this only checks the "New game" entry for localization capability.
|
||||
FTextureID texid = TexMan.CheckForTexture("M_NGAME", ETextureType::MiscPatch);
|
||||
if (!TexMan.OkForLocalization(texid, "$MNU_NEWGAME"))
|
||||
{
|
||||
menu = NAME_MainmenuTextOnly;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NAME_Episodemenu:
|
||||
// sent from the player class menu
|
||||
GameStartupInfo.Skill = -1;
|
||||
|
@ -416,6 +444,7 @@ void M_SetMenu(FName menu, int param)
|
|||
GameStartupInfo.PlayerClass =
|
||||
param == -1000? nullptr :
|
||||
param == -1? "Random" : GetPrintableDisplayName(PlayerClasses[param].Type).GetChars();
|
||||
M_StartupEpisodeMenu(&GameStartupInfo); // needs player class name from class menu (later)
|
||||
break;
|
||||
|
||||
case NAME_Skillmenu:
|
||||
|
@ -1265,13 +1294,12 @@ DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool c
|
|||
return (DMenuItemBase*)p;
|
||||
}
|
||||
|
||||
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param, const char *label, FFont *font, int color)
|
||||
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param)
|
||||
{
|
||||
auto c = PClass::FindClass("ListMenuItemPatchItem");
|
||||
auto p = c->CreateNew();
|
||||
FString keystr = FString(char(hotkey));
|
||||
FString labelstr = label;
|
||||
VMValue params[] = { p, x, y, height, tex.GetIndex(), &keystr, command.GetIndex(), param, &labelstr, font, color };
|
||||
VMValue params[] = { p, x, y, height, tex.GetIndex(), &keystr, command.GetIndex(), param };
|
||||
auto f = dyn_cast<PFunction>(c->FindSymbol("InitDirect", false));
|
||||
VMCall(f->Variants[0].Implementation, params, countof(params), nullptr, 0);
|
||||
return (DMenuItemBase*)p;
|
||||
|
|
|
@ -149,6 +149,7 @@ public:
|
|||
EColorRange mFontColor;
|
||||
EColorRange mFontColor2;
|
||||
bool mCenter;
|
||||
bool mFromEngine;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
|
@ -164,6 +165,7 @@ public:
|
|||
mFont = NULL;
|
||||
mFontColor = CR_UNTRANSLATED;
|
||||
mFontColor2 = CR_UNTRANSLATED;
|
||||
mFromEngine = false;
|
||||
}
|
||||
|
||||
size_t PropagateMark() override;
|
||||
|
@ -339,6 +341,7 @@ void M_ActivateMenu(DMenu *menu);
|
|||
void M_ClearMenus ();
|
||||
void M_PreviousMenu ();
|
||||
void M_ParseMenuDefs();
|
||||
void M_StartupEpisodeMenu(FGameStartup *gs);
|
||||
void M_StartupSkillMenu(FGameStartup *gs);
|
||||
void M_StartControlPanel (bool makeSound);
|
||||
void M_SetMenu(FName menu, int param = -1);
|
||||
|
@ -352,7 +355,7 @@ DMenuItemBase * CreateOptionMenuItemStaticText(const char *name, int v = -1);
|
|||
DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center);
|
||||
DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings);
|
||||
DMenuItemBase * CreateOptionMenuItemJoyConfigMenu(const char *label, IJoystickConfig *joy);
|
||||
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param, const char *label, FFont *font, int color);
|
||||
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param);
|
||||
DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param);
|
||||
DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool centered = false);
|
||||
|
||||
|
|
|
@ -645,6 +645,7 @@ static void ParseListMenu(FScanner &sc)
|
|||
desc->mWLeft = 0;
|
||||
desc->mWRight = 0;
|
||||
desc->mCenter = false;
|
||||
desc->mFromEngine = Wads.GetLumpFile(sc.LumpNum) == 0; // flags menu if the definition is from the IWAD.
|
||||
|
||||
ParseListMenuBody(sc, desc);
|
||||
ReplaceMenu(sc, desc);
|
||||
|
@ -1078,16 +1079,31 @@ void M_ParseMenuDefs()
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
static void BuildEpisodeMenu()
|
||||
void M_StartupEpisodeMenu(FGameStartup *gs)
|
||||
{
|
||||
// Build episode menu
|
||||
bool success = false;
|
||||
bool isOld = false;
|
||||
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Episodemenu);
|
||||
if (desc != nullptr)
|
||||
{
|
||||
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
||||
{
|
||||
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
||||
|
||||
// Delete previous contents
|
||||
for(unsigned i=0; i<ld->mItems.Size(); i++)
|
||||
{
|
||||
FName n = ld->mItems[i]->mAction;
|
||||
if (n == NAME_Skillmenu)
|
||||
{
|
||||
isOld = true;
|
||||
ld->mItems.Resize(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int posy = (int)ld->mYpos;
|
||||
int topy = posy;
|
||||
|
||||
|
@ -1114,16 +1130,17 @@ static void BuildEpisodeMenu()
|
|||
posy -= topdelta;
|
||||
}
|
||||
|
||||
ld->mSelectedItem = ld->mItems.Size();
|
||||
if (!isOld) ld->mSelectedItem = ld->mItems.Size();
|
||||
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
||||
{
|
||||
DMenuItemBase *it;
|
||||
DMenuItemBase *it = nullptr;
|
||||
if (AllEpisodes[i].mPicName.IsNotEmpty())
|
||||
{
|
||||
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
||||
it = CreateListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i, AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor);
|
||||
if (AllEpisodes[i].mEpisodeName.IsEmpty() || TexMan.OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
|
||||
it = CreateListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i);
|
||||
}
|
||||
else
|
||||
if (it == nullptr)
|
||||
{
|
||||
it = CreateListMenuItemText(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
||||
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
|
||||
|
@ -1142,6 +1159,7 @@ static void BuildEpisodeMenu()
|
|||
}
|
||||
}
|
||||
}
|
||||
else return; // do not recreate the option menu variant, because it is always text based.
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
|
@ -1186,6 +1204,7 @@ static void BuildPlayerclassMenu()
|
|||
{
|
||||
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
||||
// add player display
|
||||
|
||||
ld->mSelectedItem = ld->mItems.Size();
|
||||
|
||||
int posy = (int)ld->mYpos;
|
||||
|
@ -1482,7 +1501,6 @@ static void InitKeySections()
|
|||
|
||||
void M_CreateMenus()
|
||||
{
|
||||
BuildEpisodeMenu();
|
||||
BuildPlayerclassMenu();
|
||||
InitCrosshairsList();
|
||||
InitMusicMenus();
|
||||
|
@ -1617,7 +1635,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
|||
for(unsigned int i = 0; i < MenuSkills.Size(); i++)
|
||||
{
|
||||
FSkillInfo &skill = *MenuSkills[i];
|
||||
DMenuItemBase *li;
|
||||
DMenuItemBase *li = nullptr;
|
||||
// Using a different name for skills that must be confirmed makes handling this easier.
|
||||
FName action = (skill.MustConfirm && !AllEpisodes[gs->Episode].mNoSkill) ?
|
||||
NAME_StartgameConfirm : NAME_Startgame;
|
||||
|
@ -1632,9 +1650,10 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
|||
if (skill.PicName.Len() != 0 && pItemText == nullptr)
|
||||
{
|
||||
FTextureID tex = GetMenuTexture(skill.PicName);
|
||||
li = CreateListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, SkillIndices[i], skill.MenuName, ld->mFont, color);
|
||||
if (skill.MenuName.IsEmpty() || TexMan.OkForLocalization(tex, skill.MenuName))
|
||||
li = CreateListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, SkillIndices[i]);
|
||||
}
|
||||
else
|
||||
if (li == nullptr)
|
||||
{
|
||||
li = CreateListMenuItemText(x, y, ld->mLinespacing, skill.Shortcut,
|
||||
pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, SkillIndices[i]);
|
||||
|
|
|
@ -747,6 +747,7 @@ xx(Pagename)
|
|||
|
||||
// Special menus
|
||||
xx(Mainmenu)
|
||||
xx(MainmenuTextOnly)
|
||||
xx(Episodemenu)
|
||||
xx(Playerclassmenu)
|
||||
xx(HexenDefaultPlayerclassmenu)
|
||||
|
|
|
@ -65,8 +65,6 @@ gameinfo
|
|||
defaultendsequence = "Inter_Pic1"
|
||||
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
|
||||
statscreen_mapnamefont = "BigFont"
|
||||
statscreen_finishedpatch = "WIF"
|
||||
statscreen_enteringpatch = "WIENTER"
|
||||
statscreen_finishedfont = "BigFont", "green"
|
||||
statscreen_enteringfont = "BigFont", "green"
|
||||
statscreen_coop = "CoopStatusScreen"
|
||||
|
|
|
@ -65,8 +65,6 @@ gameinfo
|
|||
defaultendsequence = "Inter_Cast"
|
||||
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
|
||||
statscreen_mapnamefont = "BigFont"
|
||||
statscreen_finishedpatch = "WIF"
|
||||
statscreen_enteringpatch = "WIENTER"
|
||||
statscreen_finishedfont = "BigFont", "red"
|
||||
statscreen_enteringfont = "BigFont", "red"
|
||||
statscreen_coop = "CoopStatusScreen"
|
||||
|
|
|
@ -11,27 +11,25 @@
|
|||
DEFAULTLISTMENU
|
||||
{
|
||||
Font "BigFont", "Untranslated"
|
||||
LineSpacing 20
|
||||
IfGame(Doom)
|
||||
{
|
||||
Selector "M_SKULL1", -32, -5
|
||||
Linespacing 16
|
||||
Font "BigUpper", "Red"
|
||||
LineSpacing 18
|
||||
}
|
||||
IfGame(Chex)
|
||||
{
|
||||
Selector "M_SKULL1", -32, -5
|
||||
Linespacing 16
|
||||
Font "BigFont", "Green"
|
||||
}
|
||||
IfGame(Strife)
|
||||
{
|
||||
Selector "M_CURS1", -28, -5
|
||||
Linespacing 19
|
||||
}
|
||||
IfGame(Heretic, Hexen)
|
||||
{
|
||||
Selector "M_SLCTR1", -28, -1
|
||||
Linespacing 20
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +43,7 @@ LISTMENU "MainMenu"
|
|||
{
|
||||
IfGame(Doom, Chex)
|
||||
{
|
||||
LineSpacing 16 // This must account for some single-graphic replacements, so it cannot be widened
|
||||
StaticPatch 94, 2, "M_DOOM"
|
||||
Position 97, 72
|
||||
IfOption(ReadThis)
|
||||
|
@ -74,24 +73,24 @@ LISTMENU "MainMenu"
|
|||
|
||||
IfGame(Doom, Strife, Chex)
|
||||
{
|
||||
PatchItem "M_NGAME", "n", "PlayerclassMenu", 0, "$MNU_NEWGAME"
|
||||
PatchItem "M_NGAME", "n", "PlayerclassMenu"
|
||||
ifOption(SwapMenu)
|
||||
{
|
||||
PatchItem "M_LOADG", "l", "LoadGameMenu", 0, "$MNU_LOADGAME"
|
||||
PatchItem "M_SAVEG", "s", "SaveGameMenu",0, "$MNU_SAVEGAME"
|
||||
PatchItem "M_OPTION","o", "OptionsMenu", 0, "$MNU_OPTIONS"
|
||||
PatchItem "M_LOADG", "l", "LoadGameMenu", 0
|
||||
PatchItem "M_SAVEG", "s", "SaveGameMenu",0
|
||||
PatchItem "M_OPTION","o", "OptionsMenu", 0
|
||||
}
|
||||
else
|
||||
{
|
||||
PatchItem "M_OPTION","o", "OptionsMenu", 0, "$MNU_OPTIONS"
|
||||
PatchItem "M_LOADG", "l", "LoadGameMenu", 0, "$MNU_LOADGAME"
|
||||
PatchItem "M_SAVEG", "s", "SaveGameMenu", 0, "$MNU_SAVEGAME"
|
||||
PatchItem "M_OPTION","o", "OptionsMenu", 0
|
||||
PatchItem "M_LOADG", "l", "LoadGameMenu", 0
|
||||
PatchItem "M_SAVEG", "s", "SaveGameMenu", 0
|
||||
}
|
||||
ifOption(ReadThis)
|
||||
{
|
||||
PatchItem "M_RDTHIS","r", "ReadThisMenu", 0, "$MNU_INFO"
|
||||
PatchItem "M_RDTHIS","r", "ReadThisMenu", 0
|
||||
}
|
||||
PatchItem "M_QUITG", "q", "QuitMenu", 0, "$MNU_QUITGAME"
|
||||
PatchItem "M_QUITG", "q", "QuitMenu", 0
|
||||
}
|
||||
|
||||
IfGame(Heretic, Hexen)
|
||||
|
@ -104,6 +103,39 @@ LISTMENU "MainMenu"
|
|||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Text only variant of the main menu for Doom, Strife and Chex Quest to be used with localized content.
|
||||
//
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
LISTMENU "MainMenuTextOnly"
|
||||
{
|
||||
IfGame(Doom, Chex)
|
||||
{
|
||||
StaticPatch 94, 2, "M_DOOM"
|
||||
Position 97, 72
|
||||
IfOption(ReadThis)
|
||||
{
|
||||
Position 97, 64
|
||||
}
|
||||
}
|
||||
IfGame(Strife)
|
||||
{
|
||||
StaticPatch 84, 2, "M_STRIFE"
|
||||
Position 97, 45
|
||||
}
|
||||
|
||||
TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu"
|
||||
TextItem "$MNU_OPTIONS", "o", "OptionsMenu"
|
||||
TextItem "$MNU_GAMEFILES", "g", "GameFilesMenu"
|
||||
IfOption(ReadThis)
|
||||
{
|
||||
TextItem "$MNU_INFO", "i", "ReadThisMenu"
|
||||
}
|
||||
TextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Important note about the following template menus:
|
||||
|
|
|
@ -105,7 +105,7 @@ struct TexMan
|
|||
native static Vector2 GetScaledSize(TextureID tex);
|
||||
native static Vector2 GetScaledOffset(TextureID tex);
|
||||
native static int CheckRealHeight(TextureID tex);
|
||||
native static bool OkForLocalization(TextureID patch);
|
||||
native static bool OkForLocalization(TextureID patch, String textSubstitute);
|
||||
|
||||
native static void SetCameraToTexture(Actor viewpoint, String texture, double fov);
|
||||
}
|
||||
|
@ -374,8 +374,6 @@ struct GameInfoStruct native
|
|||
native GIFont mStatscreenMapNameFont;
|
||||
native GIFont mStatscreenEnteringFont;
|
||||
native GIFont mStatscreenFinishedFont;
|
||||
native GIFont mStatscreenEnteringPatch;
|
||||
native GIFont mStatscreenFinishedPatch;
|
||||
native double gibfactor;
|
||||
native bool intermissioncounter;
|
||||
native Name mSliderColor;
|
||||
|
|
|
@ -93,7 +93,7 @@ class ListMenuItemStaticPatch : ListMenuItem
|
|||
Vector2 vec = TexMan.GetScaledSize(mTexture);
|
||||
if (mYpos >= 0)
|
||||
{
|
||||
if (mSubstitute == "" || TexMan.OkForLocalization(mTexture))
|
||||
if (mSubstitute == "" || TexMan.OkForLocalization(mTexture, mSubstitute))
|
||||
{
|
||||
if (mCentered) x -= vec.X / 2;
|
||||
screen.DrawTexture (mTexture, true, x, mYpos, DTA_Clean, true);
|
||||
|
@ -107,7 +107,7 @@ class ListMenuItemStaticPatch : ListMenuItem
|
|||
else
|
||||
{
|
||||
x = (mXpos - 160) * CleanXfac + (Screen.GetWidth()>>1);
|
||||
if (mSubstitute == "" || TexMan.OkForLocalization(mTexture))
|
||||
if (mSubstitute == "" || TexMan.OkForLocalization(mTexture, mSubstitute))
|
||||
{
|
||||
if (mCentered) x -= (vec.X * CleanXfac)/2;
|
||||
screen.DrawTexture (mTexture, true, x, -mYpos*CleanYfac, DTA_CleanNoMove, true);
|
||||
|
@ -303,53 +303,29 @@ class ListMenuItemTextItem : ListMenuItemSelectable
|
|||
class ListMenuItemPatchItem : ListMenuItemSelectable
|
||||
{
|
||||
TextureID mTexture;
|
||||
String mSubstitute;
|
||||
Font mFont;
|
||||
int mColor;
|
||||
|
||||
void Init(ListMenuDescriptor desc, TextureID patch, String hotkey, Name child, int param = 0, String subst = "")
|
||||
|
||||
void Init(ListMenuDescriptor desc, TextureID patch, String hotkey, Name child, int param = 0)
|
||||
{
|
||||
Super.Init(desc.mXpos, desc.mYpos, desc.mLinespacing, child, param);
|
||||
mHotkey = hotkey.CharCodeAt(0);
|
||||
mTexture = patch;
|
||||
mSubstitute = subst;
|
||||
mFont = desc.mFont;
|
||||
mColor = desc.mFontColor;
|
||||
}
|
||||
|
||||
void InitDirect(double x, double y, int height, TextureID patch, String hotkey, Name child, int param = 0, String subst = "", Font fnt = null, int col = Font.CR_UNTRANSLATED)
|
||||
void InitDirect(double x, double y, int height, TextureID patch, String hotkey, Name child, int param = 0)
|
||||
{
|
||||
Super.Init(x, y, height, child, param);
|
||||
mHotkey = hotkey.CharCodeAt(0);
|
||||
mTexture = patch;
|
||||
mSubstitute = subst;
|
||||
mFont = fnt;
|
||||
mColor = col;
|
||||
}
|
||||
|
||||
override void Drawer(bool selected)
|
||||
{
|
||||
if (mSubstitute == "" || TexMan.OkForLocalization(mTexture))
|
||||
{
|
||||
screen.DrawTexture (mTexture, true, mXpos, mYpos, DTA_Clean, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
screen.DrawText(mFont, mColor, mXpos, mYpos, mSubstitute, DTA_Clean, true);
|
||||
}
|
||||
|
||||
screen.DrawTexture (mTexture, true, mXpos, mYpos, DTA_Clean, true);
|
||||
}
|
||||
|
||||
override int GetWidth()
|
||||
{
|
||||
if (mSubstitute == "" || TexMan.OkForLocalization(mTexture))
|
||||
{
|
||||
return TexMan.GetSize(mTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
return max(1, mFont.StringWidth(StringTable.Localize(mSubstitute)));
|
||||
}
|
||||
return TexMan.GetSize(mTexture);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,30 +8,17 @@ class InterBackground native play version("2.5")
|
|||
native virtual void drawBackground(int CurState, bool drawsplat, bool snl_pointeron);
|
||||
}
|
||||
|
||||
// This is obsolete. Hopefully this was never used...
|
||||
struct PatchInfo play version("2.5")
|
||||
{
|
||||
Font mFont;
|
||||
TextureID mPatch;
|
||||
deprecated("3.8") TextureID mPatch;
|
||||
int mColor;
|
||||
|
||||
void Init(GIFont gifont, GIFont gipatch = null)
|
||||
void Init(GIFont gifont)
|
||||
{
|
||||
if (gipatch != null)
|
||||
{
|
||||
mPatch = TexMan.CheckForTexture(gipatch.fontname, TexMan.Type_MiscPatch);
|
||||
if (TexMan.OkForLocalization(mPatch))
|
||||
{
|
||||
mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED;
|
||||
mFont = NULL;
|
||||
}
|
||||
else mPatch.setInvalid();
|
||||
}
|
||||
if (!mPatch.isValid())
|
||||
{
|
||||
mFont = Font.GetFont(gifont.fontname);
|
||||
mColor = Font.FindFontColor(gifont.color);
|
||||
mPatch.SetInvalid();
|
||||
}
|
||||
mFont = Font.GetFont(gifont.fontname);
|
||||
mColor = Font.FindFontColor(gifont.color);
|
||||
if (mFont == NULL)
|
||||
{
|
||||
mFont = BigFont;
|
||||
|
@ -115,6 +102,8 @@ class StatusScreen abstract play version("2.5")
|
|||
TextureID timepic;
|
||||
TextureID par;
|
||||
TextureID sucks;
|
||||
TextureID finishedPatch;
|
||||
TextureID enteringPatch;
|
||||
|
||||
// [RH] Info to dynamically generate the level name graphics
|
||||
String lnametexts[2];
|
||||
|
@ -183,28 +172,43 @@ class StatusScreen abstract play version("2.5")
|
|||
|
||||
//====================================================================
|
||||
//
|
||||
// Draws a text, either as patch or as string from the string table
|
||||
// Only kept so that mods that were accessing it continue to compile
|
||||
//
|
||||
//====================================================================
|
||||
|
||||
int DrawPatchText(int y, PatchInfo pinfo, String stringname)
|
||||
deprecated("3.8") int DrawPatchText(int y, PatchInfo pinfo, String stringname)
|
||||
{
|
||||
String string = Stringtable.Localize(stringname);
|
||||
int midx = screen.GetWidth() / 2;
|
||||
|
||||
if (pinfo.mPatch.isValid())
|
||||
screen.DrawText(pinfo.mFont, pinfo.mColor, midx - pinfo.mFont.StringWidth(string) * CleanXfac/2, y, string, DTA_CleanNoMove, true);
|
||||
return y + pinfo.mFont.GetHeight() * CleanYfac;
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
//
|
||||
// Draws a text, either as patch or as string from the string table
|
||||
//
|
||||
//====================================================================
|
||||
|
||||
int DrawPatchOrText(int y, PatchInfo pinfo, TextureID patch, String stringname)
|
||||
{
|
||||
String string = Stringtable.Localize(stringname);
|
||||
int midx = screen.GetWidth() / 2;
|
||||
|
||||
if (TexMan.OkForLocalization(patch, stringname))
|
||||
{
|
||||
let size = TexMan.GetScaledSize(pinfo.mPatch);
|
||||
screen.DrawTexture(pinfo.mPatch, true, midx - size.X * CleanXfac/2, y, DTA_CleanNoMove, true);
|
||||
let size = TexMan.GetScaledSize(patch);
|
||||
screen.DrawTexture(patch, true, midx - size.X * CleanXfac/2, y, DTA_CleanNoMove, true);
|
||||
return y + int(size.Y * CleanYfac);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
screen.DrawText(pinfo.mFont, pinfo.mColor, midx - pinfo.mFont.StringWidth(string) * CleanXfac/2, y, string, DTA_CleanNoMove, true);
|
||||
return y + pinfo.mFont.GetHeight() * CleanYfac;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//====================================================================
|
||||
//
|
||||
|
@ -215,7 +219,7 @@ class StatusScreen abstract play version("2.5")
|
|||
//
|
||||
//====================================================================
|
||||
|
||||
int drawLF ()
|
||||
virtual int drawLF ()
|
||||
{
|
||||
int y = TITLEY * CleanYfac;
|
||||
|
||||
|
@ -230,7 +234,7 @@ class StatusScreen abstract play version("2.5")
|
|||
if (y < (statsy - finished.mFont.GetHeight()*3/4) * CleanYfac)
|
||||
{
|
||||
// don't draw 'finished' if the level name is too tall
|
||||
y = DrawPatchText(y, finished, "$WI_FINISHED");
|
||||
y = DrawPatchOrText(y, finished, finishedPatch, "$WI_FINISHED");
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
@ -245,11 +249,11 @@ class StatusScreen abstract play version("2.5")
|
|||
//
|
||||
//====================================================================
|
||||
|
||||
void drawEL ()
|
||||
virtual void drawEL ()
|
||||
{
|
||||
int y = TITLEY * CleanYfac;
|
||||
|
||||
y = DrawPatchText(y, entering, "$WI_ENTERING");
|
||||
y = DrawPatchOrText(y, entering, enteringPatch, "$WI_ENTERING");
|
||||
y += entering.mFont.GetHeight() * CleanYfac / 4;
|
||||
DrawName(y, wbs.LName1, lnametexts[1]);
|
||||
}
|
||||
|
@ -688,8 +692,8 @@ class StatusScreen abstract play version("2.5")
|
|||
me = wbs.pnum;
|
||||
for (int i = 0; i < MAXPLAYERS; i++) Plrs[i] = wbs.plyr[i];
|
||||
|
||||
entering.Init(gameinfo.mStatscreenEnteringFont, gameinfo.mStatscreenEnteringPatch);
|
||||
finished.Init(gameinfo.mStatscreenFinishedFont, gameinfo.mStatscreenFinishedPatch);
|
||||
entering.Init(gameinfo.mStatscreenEnteringFont);
|
||||
finished.Init(gameinfo.mStatscreenFinishedFont);
|
||||
mapname.Init(gameinfo.mStatscreenMapNameFont);
|
||||
|
||||
Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills"
|
||||
|
@ -699,6 +703,8 @@ class StatusScreen abstract play version("2.5")
|
|||
Timepic = TexMan.CheckForTexture("WITIME", TexMan.Type_MiscPatch); // "time"
|
||||
Sucks = TexMan.CheckForTexture("WISUCKS", TexMan.Type_MiscPatch); // "sucks"
|
||||
Par = TexMan.CheckForTexture("WIPAR", TexMan.Type_MiscPatch); // "par"
|
||||
enteringPatch = TexMan.CheckForTexture("WIENTER", TexMan.Type_MiscPatch); // "entering"
|
||||
finishedPatch = TexMan.CheckForTexture("WIF", TexMan.Type_MiscPatch); // "finished"
|
||||
|
||||
lnametexts[0] = wbstartstruct.thisname;
|
||||
lnametexts[1] = wbstartstruct.nextname;
|
||||
|
|
|
@ -142,8 +142,11 @@ class DoomStatusScreen : StatusScreen
|
|||
let tcolor = Font.CR_RED;
|
||||
|
||||
// For visual consistency, only use the patches here if all are present.
|
||||
bool useGfx = TexMan.OkForLocalization(Kills) && TexMan.OkForLocalization(Items) && TexMan.OkForLocalization(P_secret) && TexMan.OkForLocalization(Timepic) &&
|
||||
(!wbs.partime || TexMan.OkForLocalization(Par));
|
||||
bool useGfx = TexMan.OkForLocalization(Kills, "$TXT_IMKILLS")
|
||||
&& TexMan.OkForLocalization(Items, "$TXT_IMITEMS")
|
||||
&& TexMan.OkForLocalization(P_secret, "$TXT_IMSECRETS")
|
||||
&& TexMan.OkForLocalization(Timepic, "$TXT_IMTIME")
|
||||
&& (!wbs.partime || TexMan.OkForLocalization(Par, "$TXT_IMPAR"));
|
||||
|
||||
Font printFont;
|
||||
|
||||
|
@ -178,7 +181,7 @@ class DoomStatusScreen : StatusScreen
|
|||
{ // "sucks"
|
||||
int x = 160 - SP_TIMEX;
|
||||
int y = SP_TIMEY;
|
||||
if (useGfx && TexMan.OkForLocalization(Sucks))
|
||||
if (useGfx && TexMan.OkForLocalization(Sucks, "$TXT_IMSUCKS"))
|
||||
{
|
||||
let size = TexMan.GetScaledSize(Sucks);
|
||||
screen.DrawTexture (Sucks, true, x - size.X, y - size.Y - 2, DTA_Clean, true);
|
||||
|
|
Loading…
Reference in a new issue