mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- better handling for maps without names.
Use the file's base part as name if that happens.
This commit is contained in:
parent
db29fc1a01
commit
4cc22e155f
6 changed files with 18 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "gstrings.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
// Localization capable replacement of the game specific solutions.
|
||||
|
||||
|
@ -15,6 +16,7 @@ struct MapRecord
|
|||
int parTime;
|
||||
int designerTime;
|
||||
FString fileName;
|
||||
FString labelName;
|
||||
FString name;
|
||||
FString music;
|
||||
int cdSongId;
|
||||
|
@ -28,6 +30,7 @@ struct MapRecord
|
|||
|
||||
const char *DisplayName()
|
||||
{
|
||||
if (name.IsEmpty()) return labelName;
|
||||
return GStrings.localize(name);
|
||||
}
|
||||
void SetName(const char *n)
|
||||
|
@ -35,6 +38,12 @@ struct MapRecord
|
|||
name = n;
|
||||
MakeStringLocalizable(name);
|
||||
}
|
||||
void SetFileName(const char* n)
|
||||
{
|
||||
fileName = n;
|
||||
labelName = ExtractFileBase(n);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
extern MapRecord mapList[512];
|
||||
|
|
|
@ -5172,7 +5172,7 @@ repeatcase:
|
|||
|
||||
Bcorrectfilename(tempbuf,0);
|
||||
|
||||
mapList[j * MAXLEVELS + k].fileName = tempbuf;
|
||||
mapList[j * MAXLEVELS + k].SetFileName(tempbuf);
|
||||
|
||||
C_SkipComments();
|
||||
|
||||
|
|
|
@ -1819,7 +1819,7 @@ int G_EnterLevel(int gameMode)
|
|||
|
||||
if (VOLUMEONE || !Menu_HaveUserMap())
|
||||
{
|
||||
if (mm.name.IsEmpty() || mm.fileName.IsEmpty())
|
||||
if (mm.fileName.IsEmpty())
|
||||
{
|
||||
OSD_Printf(OSDTEXT_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1);
|
||||
return 1;
|
||||
|
|
|
@ -1871,7 +1871,7 @@ static int32_t C_ParseCommand(int32_t loop)
|
|||
|
||||
Bcorrectfilename(tempbuf,0);
|
||||
|
||||
mapList[j *MAXLEVELS+k].fileName = tempbuf;
|
||||
mapList[j *MAXLEVELS+k].SetFileName(tempbuf);
|
||||
|
||||
C_SkipComments();
|
||||
|
||||
|
|
|
@ -2340,7 +2340,7 @@ int G_EnterLevel(int gameMode)
|
|||
mii = (ud.volume_number*MAXLEVELS)+ud.level_number;
|
||||
auto &mi = mapList[mii];
|
||||
|
||||
if ( mi.name.IsEmpty() || mi.fileName.IsEmpty())
|
||||
if (mi.fileName.IsEmpty())
|
||||
{
|
||||
if (RR && g_lastLevel)
|
||||
{
|
||||
|
|
|
@ -1025,15 +1025,11 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
else if (g_levelTextTime < 5)
|
||||
o |= 1;
|
||||
|
||||
if (mapList[(ud.volume_number*MAXLEVELS) + ud.level_number].name.IsNotEmpty())
|
||||
{
|
||||
char const * const fn = currentboardfilename[0] != 0 &&
|
||||
ud.volume_number == 0 && ud.level_number == 7
|
||||
? currentboardfilename
|
||||
: mapList[(ud.volume_number*MAXLEVELS) + ud.level_number].DisplayName();
|
||||
|
||||
menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, fn, o, TEXT_XCENTER);
|
||||
}
|
||||
char const * const fn = currentboardfilename[0] != 0 &&
|
||||
ud.volume_number == 0 && ud.level_number == 7
|
||||
? currentboardfilename
|
||||
: mapList[(ud.volume_number*MAXLEVELS) + ud.level_number].DisplayName();
|
||||
menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, fn, o, TEXT_XCENTER);
|
||||
}
|
||||
|
||||
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1)
|
||||
|
@ -2045,8 +2041,6 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
else
|
||||
{
|
||||
lastmapname = mapList[G_LastMapInfoIndex()].DisplayName();
|
||||
if (!lastmapname || !*lastmapname) // this isn't right but it's better than no name at all
|
||||
lastmapname = mapList[G_LastMapInfoIndex()].fileName;
|
||||
}
|
||||
|
||||
if (RR)
|
||||
|
@ -2625,8 +2619,6 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
else
|
||||
{
|
||||
lastmapname = mapList[G_LastMapInfoIndex()].DisplayName();
|
||||
if (!lastmapname || !*lastmapname) // this isn't right but it's better than no name at all
|
||||
lastmapname = mapList[G_LastMapInfoIndex()].fileName;
|
||||
}
|
||||
|
||||
if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel)
|
||||
|
|
Loading…
Reference in a new issue