mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 09:31:14 +00:00
- added a 'testfinale' CCMD, so that the layout of finale texts can be tested more easily
# Conflicts: # src/gamedata/stringtable.cpp # src/gamedata/stringtable.h # Conflicts: # src/intermission/intermission_parse.cpp
This commit is contained in:
parent
ef1047db20
commit
b6799e7843
4 changed files with 60 additions and 1 deletions
|
@ -53,6 +53,7 @@
|
|||
#include "d_net.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "utf8.h"
|
||||
#include "templates.h"
|
||||
|
||||
FIntermissionDescriptorList IntermissionDescriptors;
|
||||
|
||||
|
@ -361,6 +362,7 @@ void DIntermissionScreenText::Drawer ()
|
|||
|
||||
int cx = (mTextX - 160)*CleanXfac + screen->GetWidth() / 2;
|
||||
int cy = (mTextY - 100)*CleanYfac + screen->GetHeight() / 2;
|
||||
cx = MAX<int>(0, cx);
|
||||
int startx = cx;
|
||||
|
||||
// Does this text fall off the end of the screen? If so, try to eliminate some margins first.
|
||||
|
|
|
@ -38,8 +38,9 @@
|
|||
#include "intermission/intermission.h"
|
||||
#include "g_level.h"
|
||||
#include "w_wad.h"
|
||||
#include "gi.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "gstrings.h"
|
||||
#include "gi.h"
|
||||
|
||||
|
||||
static void ReplaceIntermission(FName intname,FIntermissionDescriptor *desc)
|
||||
|
@ -906,3 +907,37 @@ void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CCMD(testfinale)
|
||||
{
|
||||
if (argv.argc() < 2)
|
||||
{
|
||||
Printf("Usage: testfinale stringlabel [langId]\n");
|
||||
return;
|
||||
}
|
||||
const char *text;
|
||||
|
||||
if (argv.argc() == 2)
|
||||
{
|
||||
text = GStrings.GetString(argv[1], nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto len = strlen(argv[2]);
|
||||
if (len < 2 || len > 3)
|
||||
{
|
||||
Printf("Language ID must be 2 or 3 characters\n");
|
||||
return;
|
||||
}
|
||||
auto id = MAKE_ID(tolower(argv[2][0]), tolower(argv[2][1]), tolower(argv[2][2]), 0);
|
||||
text = GStrings.GetLanguageString(argv[1], id);
|
||||
}
|
||||
if (text == nullptr)
|
||||
{
|
||||
Printf("Text does not exist\n");
|
||||
return;
|
||||
}
|
||||
|
||||
F_StartFinale(gameinfo.finaleMusic, gameinfo.finaleOrder, -1, 0, gameinfo.FinaleFlat, text, false, false, true, true, false);
|
||||
}
|
|
@ -264,6 +264,27 @@ const char *FStringTable::GetString(const char *name, uint32_t *langtable) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// Finds a string by name in a given language
|
||||
const char *FStringTable::GetLanguageString(const char *name, uint32_t langtable) const
|
||||
{
|
||||
if (name == nullptr || *name == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
FName nm(name, true);
|
||||
if (nm != NAME_None)
|
||||
{
|
||||
auto map = allStrings.CheckKey(langtable);
|
||||
if (map == nullptr) return nullptr;
|
||||
auto item = map->CheckKey(nm);
|
||||
if (item)
|
||||
{
|
||||
return item->GetChars();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Finds a string by name and returns its value. If the string does
|
||||
// not exist, returns the passed name instead.
|
||||
const char *FStringTable::operator() (const char *name) const
|
||||
|
|
|
@ -76,6 +76,7 @@ public:
|
|||
UpdateLanguage();
|
||||
}
|
||||
|
||||
const char *GetLanguageString(const char *name, uint32_t langtable) const;
|
||||
const char *GetString(const char *name, uint32_t *langtable) const;
|
||||
const char *operator() (const char *name) const; // Never returns NULL
|
||||
const char *operator[] (const char *name) const
|
||||
|
|
Loading…
Reference in a new issue