- consolidation of texts for episode and skill menus

So far without localization capability - the engine cannot handle it yet.
This commit is contained in:
Christoph Oelckers 2019-11-25 00:02:00 +01:00
parent d7bc013eee
commit 1f1e39fac0
20 changed files with 144 additions and 192 deletions

View file

@ -43,6 +43,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sfx.h" #include "sfx.h"
#include "view.h" #include "view.h"
#include "eventq.h" #include "eventq.h"
#include "menu/menu.h"
BEGIN_BLD_NS BEGIN_BLD_NS
@ -236,7 +237,9 @@ void levelLoadDefaults(void)
if (!BloodINI->SectionExists(buffer)) if (!BloodINI->SectionExists(buffer))
break; break;
EPISODEINFO *pEpisodeInfo = &gEpisodeInfo[i]; EPISODEINFO *pEpisodeInfo = &gEpisodeInfo[i];
strncpy(pEpisodeInfo->at0, BloodINI->GetKeyString(buffer, "Title", buffer), 31); auto ep_str = BloodINI->GetKeyString(buffer, "Title", buffer);
strncpy(pEpisodeInfo->at0, ep_str, 31);
gVolumeNames[i] = ep_str; // For the menu.
strncpy(pEpisodeInfo->at8f08, BloodINI->GetKeyString(buffer, "CutSceneA", ""), BMAX_PATH); strncpy(pEpisodeInfo->at8f08, BloodINI->GetKeyString(buffer, "CutSceneA", ""), BMAX_PATH);
pEpisodeInfo->at9028 = BloodINI->GetKeyInt(buffer, "CutWavA", -1); pEpisodeInfo->at9028 = BloodINI->GetKeyInt(buffer, "CutWavA", -1);
if (pEpisodeInfo->at9028 == 0) if (pEpisodeInfo->at9028 == 0)

View file

@ -259,6 +259,49 @@ int GameMain()
return r; return r;
} }
//==========================================================================
//
// Try to keep all initializations of global string variables in this one place
//
//==========================================================================
#define LOCALIZED_STRING(s) s // change to "${" s "}" later, once all text output functions can replace text macros
void SetDefaultStrings()
{
// Hard coded texts for the episode and skill selection menus.
if (g_gameType & GAMEFLAG_DUKE)
{
gVolumeNames[0] = LOCALIZED_STRING("L.A. Meltdown");
gVolumeNames[1] = LOCALIZED_STRING("Lunar Apocalypse");
gVolumeNames[2] = LOCALIZED_STRING("Shrapnel City");
gSkillNames[0] = LOCALIZED_STRING("Piece Of Cake");
gSkillNames[1] = LOCALIZED_STRING("Let's Rock");
gSkillNames[2] = LOCALIZED_STRING("Come Get Some");
gSkillNames[3] = LOCALIZED_STRING("Damn I'm Good");
}
else if (g_gameType & GAMEFLAG_BLOOD)
{
gSkillNames[0] = LOCALIZED_STRING("STILL KICKING");
gSkillNames[1] = LOCALIZED_STRING("PINK ON THE INSIDE");
gSkillNames[2] = LOCALIZED_STRING("LIGHTLY BROILED");
gSkillNames[3] = LOCALIZED_STRING("WELL DONE");
gSkillNames[4] = LOCALIZED_STRING("EXTRA CRISPY");
}
else if (g_gameType & GAMEFLAG_SW)
{
gVolumeNames[0] = LOCALIZED_STRING("Enter the Wang");
gVolumeNames[1] = LOCALIZED_STRING("Code of Honor");
gVolumeSubtitles[0] = LOCALIZED_STRING("Four levels (Shareware Version)");
gVolumeSubtitles[1] = LOCALIZED_STRING("Eighteen levels (Full Version Only)");
gSkillNames[0] = LOCALIZED_STRING("Tiny grasshopper");
gSkillNames[1] = LOCALIZED_STRING("I Have No Fear");
gSkillNames[2] = LOCALIZED_STRING("Who Wants Wang");
gSkillNames[3] = LOCALIZED_STRING("No Pain, No Gain");
}
}
//========================================================================== //==========================================================================
// //
// //
@ -385,9 +428,7 @@ int CONFIG_Init()
Mus_Init(); Mus_Init();
InitStatistics(); InitStatistics();
M_Init(); M_Init();
SetDefaultStrings();
return gi->app_main(); return gi->app_main();
} }

View file

@ -12,6 +12,17 @@
EXTERN_CVAR(Float, snd_menuvolume) EXTERN_CVAR(Float, snd_menuvolume)
EXTERN_CVAR(Int, m_use_mouse); EXTERN_CVAR(Int, m_use_mouse);
enum
{
MAXSKILLS = 7,
MAXVOLUMES = 7,
};
// These get filled in by the map definition parsers of the front ends.
extern FString gSkillNames[MAXSKILLS];
extern FString gVolumeNames[MAXVOLUMES];
extern FString gVolumeSubtitles[MAXVOLUMES];
extern int32_t gVolumeFlags[MAXVOLUMES];
const int MENU_TICRATE = 30; const int MENU_TICRATE = 30;
extern bool help_disabled, credits_disabled; extern bool help_disabled, credits_disabled;

View file

@ -49,6 +49,11 @@
void ClearSaveGames(); void ClearSaveGames();
FString gSkillNames[MAXSKILLS];
FString gVolumeNames[MAXVOLUMES];
FString gVolumeSubtitles[MAXVOLUMES];
int32_t gVolumeFlags[MAXVOLUMES];
MenuDescriptorList MenuDescriptors; MenuDescriptorList MenuDescriptors;
static FListMenuDescriptor DefaultListMenuSettings; // contains common settings for all list menus static FListMenuDescriptor DefaultListMenuSettings; // contains common settings for all list menus
static FOptionMenuDescriptor DefaultOptionMenuSettings; // contains common settings for all Option menus static FOptionMenuDescriptor DefaultOptionMenuSettings; // contains common settings for all Option menus

View file

@ -128,36 +128,24 @@ void Menu_Init(void)
// prepare episodes // prepare episodes
k = 0; k = 0;
for (i = 0; i < g_volumeCnt; ++i)
if (gVolumeNames[i].IsNotEmpty())
{ {
if (g_volumeNames[i][0]) if (!(gVolumeFlags[i] & EF_HIDEFROMSP))
{
if (!(g_volumeFlags[i] & EF_HIDEFROMSP))
{ {
MEL_EPISODE[i] = &ME_EPISODE[i]; MEL_EPISODE[i] = &ME_EPISODE[i];
ME_EPISODE[i] = ME_EPISODE_TEMPLATE; ME_EPISODE[i] = ME_EPISODE_TEMPLATE;
ME_EPISODE[i].name = g_volumeNames[i]; ME_EPISODE[i].name = gVolumeNames[i];
} }
// if (!(EpisodeFlags[i] & EF_HIDEFROMMP)) // if (!(EpisodeFlags[i] & EF_HIDEFROMMP))
{ {
MEOSN_NetEpisodes[k] = g_volumeNames[i]; MEOSN_NetEpisodes[k] = gVolumeNames[i];
MEOSV_NetEpisodes[k] = i; MEOSV_NetEpisodes[k] = i;
k++; k++;
} }
} }
// prepare levels
MEOS_NETOPTIONS_LEVEL[i] = MEOS_NETOPTIONS_LEVEL_TEMPLATE;
for (j = 0; j < MAXLEVELS; ++j)
{
MEOSN_NetLevels[i][j] = g_mapInfo[MAXLEVELS * i + j].name;
if (g_mapInfo[i * MAXLEVELS + j].filename != NULL)
MEOS_NETOPTIONS_LEVEL[i].numOptions = j + 1;
}
MEOS_NETOPTIONS_LEVEL[i].optionNames = MEOSN_NetLevels[i];
}
M_EPISODE.numEntries = g_volumeCnt + 2; M_EPISODE.numEntries = g_volumeCnt + 2;
MEL_EPISODE[g_volumeCnt] = &ME_Space4_Redfont; MEL_EPISODE[g_volumeCnt] = &ME_Space4_Redfont;

View file

@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "savegame.h" #include "savegame.h"
#include "printf.h" #include "printf.h"
#include "m_argv.h" #include "m_argv.h"
#include "menu/menu.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS
@ -2033,7 +2034,7 @@ void C_DefineVolumeFlags(int32_t vol, int32_t flags)
{ {
Bassert((unsigned)vol < MAXVOLUMES); Bassert((unsigned)vol < MAXVOLUMES);
g_volumeFlags[vol] = flags; gVolumeFlags[vol] = flags;
} }
void C_UndefineVolume(int32_t vol) void C_UndefineVolume(int32_t vol)
@ -2043,12 +2044,12 @@ void C_UndefineVolume(int32_t vol)
for (bssize_t i = 0; i < MAXLEVELS; i++) for (bssize_t i = 0; i < MAXLEVELS; i++)
C_UndefineLevel(vol, i); C_UndefineLevel(vol, i);
g_volumeNames[vol][0] = '\0'; gVolumeNames[vol] = "";
g_volumeCnt = 0; g_volumeCnt = 0;
for (bssize_t i = MAXVOLUMES-1; i >= 0; i--) for (bssize_t i = MAXVOLUMES-1; i >= 0; i--)
{ {
if (g_volumeNames[i][0]) if (gVolumeNames[i].IsNotEmpty())
{ {
g_volumeCnt = i+1; g_volumeCnt = i+1;
break; break;
@ -2060,12 +2061,12 @@ void C_UndefineSkill(int32_t skill)
{ {
Bassert((unsigned)skill < MAXSKILLS); Bassert((unsigned)skill < MAXSKILLS);
g_skillNames[skill][0] = '\0'; gSkillNames[skill] = "";
g_skillCnt = 0; g_skillCnt = 0;
for (bssize_t i = MAXSKILLS-1; i >= 0; i--) for (bssize_t i = MAXSKILLS-1; i >= 0; i--)
{ {
if (g_skillNames[i][0]) if (gSkillNames[i][0])
{ {
g_skillCnt = i+1; g_skillCnt = i+1;
break; break;
@ -5015,23 +5016,11 @@ repeatcase:
continue; continue;
} }
i = 0; i = strcspn(textptr, "\r\n");
gVolumeNames[j] = FString(textptr, i);
textptr += i;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
{
g_volumeNames[j][i] = *textptr;
textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(g_volumeNames[j])-1))
{
initprintf("%s:%d: warning: truncating volume name to %d characters.\n",
g_scriptFileName,g_lineNumber,(int32_t)sizeof(g_volumeNames[j])-1);
g_warningCnt++;
scriptSkipLine();
break;
}
}
g_volumeCnt = j+1; g_volumeCnt = j+1;
g_volumeNames[j][i] = '\0';
continue; continue;
case CON_DEFINEVOLUMEFLAGS: case CON_DEFINEVOLUMEFLAGS:
@ -5128,27 +5117,14 @@ repeatcase:
continue; continue;
} }
i = 0; i = strcspn(textptr, "\r\n");
gSkillNames[j] = FString(textptr, i);
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr+=i;
{
g_skillNames[j][i] = *textptr;
textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(g_skillNames[j])-1))
{
initprintf("%s:%d: warning: truncating skill name to %d characters.\n",
g_scriptFileName,g_lineNumber,(int32_t)sizeof(g_skillNames[j])-1);
g_warningCnt++;
scriptSkipLine();
break;
}
}
g_skillNames[j][i] = '\0';
for (i=0; i<MAXSKILLS; i++) for (i=0; i<MAXSKILLS; i++)
if (g_skillNames[i][0] == 0) if (gSkillNames[i].IsEmpty())
break; break;
g_skillCnt = i; g_skillCnt = i;
continue; continue;

View file

@ -3827,7 +3827,9 @@ badindex:
CON_ERRPRINTF("invalid volume %d\n", ud.volume_number); CON_ERRPRINTF("invalid volume %d\n", ud.volume_number);
abort_after_error(); abort_after_error();
} }
Bstrcpy(apStrings[q], g_volumeNames[ud.volume_number]); // length is no longer limited so a check is needed.
Bstrncpy(apStrings[q], gVolumeNames[ud.volume_number], MAXQUOTELEN);
apStrings[q][MAXQUOTELEN-1] = 0;
break; break;
case STR_YOURTIME: Bstrcpy(apStrings[q], G_PrintYourTime()); break; case STR_YOURTIME: Bstrcpy(apStrings[q], G_PrintYourTime()); break;
case STR_PARTIME: Bstrcpy(apStrings[q], G_PrintParTime()); break; case STR_PARTIME: Bstrcpy(apStrings[q], G_PrintParTime()); break;

View file

@ -35,19 +35,14 @@ const char *s_buildDate = "20120522";
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
char g_volumeNames[MAXVOLUMES][33] = { "L.A. Meltdown", "Lunar Apocalypse", "Shrapnel City" };
char g_skillNames[MAXSKILLS][33] = { "Piece Of Cake", "Let's Rock", "Come Get Some", "Damn I'm Good" };
char g_gametypeNames[MAXGAMETYPES][33] char g_gametypeNames[MAXGAMETYPES][33]
= { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" }; = { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" };
#else #else
char g_volumeNames[MAXVOLUMES][33];
char g_skillNames[MAXSKILLS][33];
char g_gametypeNames[MAXGAMETYPES][33] char g_gametypeNames[MAXGAMETYPES][33]
= { "Deathmatch (Spawn)", "Cooperative Play", "Deathmatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" }; = { "Deathmatch (Spawn)", "Cooperative Play", "Deathmatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" };
#endif #endif
int32_t g_volumeFlags[MAXVOLUMES];
int32_t g_gametypeFlags[MAXGAMETYPES] = int32_t g_gametypeFlags[MAXGAMETYPES] =
{ {
GAMETYPE_FRAGBAR | GAMETYPE_FRAGBAR |

View file

@ -163,8 +163,6 @@ extern double g_gameUpdateAvgTime;
#ifndef global_c_ #ifndef global_c_
extern char CheatKeys[2]; extern char CheatKeys[2];
extern char g_gametypeNames[MAXGAMETYPES][33]; extern char g_gametypeNames[MAXGAMETYPES][33];
extern char g_skillNames[MAXSKILLS][33];
extern char g_volumeNames[MAXVOLUMES][33];
extern int32_t g_actorRespawnTime; extern int32_t g_actorRespawnTime;
extern int32_t g_bouncemineRadius; extern int32_t g_bouncemineRadius;
@ -186,7 +184,7 @@ extern int32_t g_volumeCnt;
extern int16_t g_blimpSpawnItems[15]; extern int16_t g_blimpSpawnItems[15];
extern int32_t g_gametypeFlags[MAXGAMETYPES]; extern int32_t g_gametypeFlags[MAXGAMETYPES];
extern int32_t g_volumeFlags[MAXVOLUMES];
extern const char *s_buildDate; extern const char *s_buildDate;
#endif #endif
@ -194,7 +192,6 @@ extern const char *s_buildDate;
enum enum
{ {
EF_HIDEFROMSP = 1<<0, EF_HIDEFROMSP = 1<<0,
// EF_HIDEFROMMP = 1<<1,
}; };
EXTERN_INLINE_HEADER void G_UpdateInterpolations(void); EXTERN_INLINE_HEADER void G_UpdateInterpolations(void);

View file

@ -1552,29 +1552,6 @@ void Menu_Init(void)
MEOSN_Keys[i] = KB_ScanCodeToString(i); MEOSN_Keys[i] = KB_ScanCodeToString(i);
MEOSN_Keys[NUMKEYS-1] = MenuKeyNone; MEOSN_Keys[NUMKEYS-1] = MenuKeyNone;
// prepare episodes
k = 0;
for (i = 0; i < g_volumeCnt; ++i)
{
if (g_volumeNames[i][0])
{
if (!(g_volumeFlags[i] & EF_HIDEFROMSP))
{
MEL_EPISODE[i] = &ME_EPISODE[i];
ME_EPISODE[i] = ME_EPISODE_TEMPLATE;
ME_EPISODE[i].name = g_volumeNames[i];
}
// if (!(EpisodeFlags[i] & EF_HIDEFROMMP))
{
MEOSN_NetEpisodes[k] = g_volumeNames[i];
MEOSV_NetEpisodes[k] = i;
k++;
}
}
// prepare levels // prepare levels
MEOS_NETOPTIONS_LEVEL[i] = MEOS_NETOPTIONS_LEVEL_TEMPLATE; MEOS_NETOPTIONS_LEVEL[i] = MEOS_NETOPTIONS_LEVEL_TEMPLATE;
for (j = 0; j < MAXLEVELS; ++j) for (j = 0; j < MAXLEVELS; ++j)
@ -2156,7 +2133,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
mminitext(origin.x + ((90+60)<<16), origin.y + (90<<16), g_gametypeNames[m_coop], MF_Minifont.pal_deselected_right); mminitext(origin.x + ((90+60)<<16), origin.y + (90<<16), g_gametypeNames[m_coop], MF_Minifont.pal_deselected_right);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8)<<16), g_volumeNames[ud.m_volume_number], MF_Minifont.pal_deselected_right); mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8)<<16), gVolumeNames[ud.m_volume_number], MF_Minifont.pal_deselected_right);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8)<<16), g_mapInfo[MAXLEVELS*ud.m_volume_number+m_level_number].name, MF_Minifont.pal_deselected_right); mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8)<<16), g_mapInfo[MAXLEVELS*ud.m_volume_number+m_level_number].name, MF_Minifont.pal_deselected_right);
if (ud.m_monsters_off == 0 || ud.m_player_skill > 0) if (ud.m_monsters_off == 0 || ud.m_player_skill > 0)
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), g_skillNames[ud.m_player_skill], MF_Minifont.pal_deselected_right); mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), g_skillNames[ud.m_player_skill], MF_Minifont.pal_deselected_right);
@ -2302,15 +2279,6 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
break; break;
} }
#ifdef EDUKE32_ANDROID_MENU
case MENU_SKILL:
{
static const char *s[] = { "EASY - Few enemies, and lots of stuff.", "MEDIUM - Normal difficulty.", "HARD - For experienced players.", "EXPERTS - Lots of enemies, plus they respawn!" };
if (M_SKILL.currentEntry < ARRAY_SSIZE(s))
mgametextcenter(origin.x, origin.y + (168<<16), s[M_SKILL.currentEntry]);
}
break;
#endif
case MENU_SAVECLEANVERIFY: case MENU_SAVECLEANVERIFY:
videoFadeToBlack(1); videoFadeToBlack(1);
@ -2334,16 +2302,6 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
Bsprintf(tempbuf, "Resume game from sequence point:\n\"%s\"", msv.brief.name); Bsprintf(tempbuf, "Resume game from sequence point:\n\"%s\"", msv.brief.name);
Menu_DrawVerifyPrompt(origin.x, origin.y, tempbuf, 2); Menu_DrawVerifyPrompt(origin.x, origin.y, tempbuf, 2);
} }
else if (msv.isOldVer)
{
#if 1
mgametextcenter(origin.x, origin.y + (90<<16), "You're not supposed to be here.");
#else
Bsprintf(tempbuf, "Start new game:\n%s / %s"
, g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, g_skillNames[ud.player_skill-1]);
Menu_DrawVerifyPrompt(origin.x, origin.y, tempbuf, 2);
#endif
}
else else
{ {
Bsprintf(tempbuf, "Load game:\n\"%s\"", msv.brief.name); Bsprintf(tempbuf, "Load game:\n\"%s\"", msv.brief.name);

View file

@ -1339,7 +1339,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
ud.secretlevel = 0; ud.secretlevel = 0;
ud.skill_voice = -1; ud.skill_voice = -1;
ud.volume_number = volumeNum; ud.volume_number = volumeNum;
STAT_StartNewGame(g_volumeNames[volumeNum], skillNum); STAT_StartNewGame(gVolumeNames[volumeNum], skillNum);
g_lastAutoSaveArbitraryID = -1; g_lastAutoSaveArbitraryID = -1;
g_lastautosave.reset(); g_lastautosave.reset();

View file

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sbar.h" #include "sbar.h"
#include "screens.h" #include "screens.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "menu/menu.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS
@ -961,7 +962,7 @@ void G_DisplayRest(int32_t smoothratio)
if (G_HaveUserMap()) if (G_HaveUserMap())
levelname = boardfilename; levelname = boardfilename;
else if (!(G_GetLogoFlags() & LOGO_HIDEEPISODE)) else if (!(G_GetLogoFlags() & LOGO_HIDEEPISODE))
minitext(5, a+6, g_volumeNames[ud.volume_number], 0, 2+8+16+256); minitext(5, a+6, gVolumeNames[ud.volume_number], 0, 2+8+16+256);
minitext(5, a+6+6, levelname, 0, 2+8+16+256); minitext(5, a+6+6, levelname, 0, 2+8+16+256);
} }
} }

View file

@ -69,7 +69,6 @@ void FlipNonSquareBlock(T* dst, const T* src, int x, int y, int srcpitch)
FHardwareTexture* GLInstance::CreateIndexedTexture(FTexture* tex) FHardwareTexture* GLInstance::CreateIndexedTexture(FTexture* tex)
{ {
auto siz = tex->GetSize(); auto siz = tex->GetSize();
bool npoty = false;
const uint8_t* p = tex->Get8BitPixels(); const uint8_t* p = tex->Get8BitPixels();
TArray<uint8_t> store(siz.x * siz.y, true); TArray<uint8_t> store(siz.x * siz.y, true);
@ -96,9 +95,6 @@ FHardwareTexture* GLInstance::CreateIndexedTexture(FTexture* tex)
FHardwareTexture* GLInstance::CreateTrueColorTexture(FTexture* tex, int palid, bool checkfulltransparency, bool rgb8bit) FHardwareTexture* GLInstance::CreateTrueColorTexture(FTexture* tex, int palid, bool checkfulltransparency, bool rgb8bit)
{ {
auto siz = tex->GetSize();
bool npoty = false;
auto palette = palid < 0? nullptr : palmanager.GetPaletteData(palid); auto palette = palid < 0? nullptr : palmanager.GetPaletteData(palid);
if (palette == nullptr) return nullptr; if (palette == nullptr) return nullptr;
auto texbuffer = tex->CreateTexBuffer(palette, CTF_ProcessData); auto texbuffer = tex->CreateTexBuffer(palette, CTF_ProcessData);
@ -266,7 +262,7 @@ bool GLInstance::SetTextureInternal(int picnum, FTexture* tex, int palette, int
auto brep = tex->FindReplacement(BRIGHTPAL); auto brep = tex->FindReplacement(BRIGHTPAL);
if (brep) if (brep)
{ {
auto htex = LoadTexture(brep->faces[0], TT_HICREPLACE, 0); LoadTexture(brep->faces[0], TT_HICREPLACE, 0);
UseBrightmaps(true); UseBrightmaps(true);
BindTexture(5, mtex, sampler); BindTexture(5, mtex, sampler);
} }

View file

@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "osd.h" #include "osd.h"
#include "m_crc32.h" #include "m_crc32.h"
#include "printf.h" #include "printf.h"
#include "menu/menu.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -894,7 +895,7 @@ void C_DefineVolumeFlags(int32_t vol, int32_t flags)
{ {
Bassert((unsigned)vol < MAXVOLUMES); Bassert((unsigned)vol < MAXVOLUMES);
g_volumeFlags[vol] = flags; gVolumeFlags[vol] = flags;
} }
int32_t C_AllocQuote(int32_t qnum) int32_t C_AllocQuote(int32_t qnum)
@ -1884,23 +1885,10 @@ static int32_t C_ParseCommand(int32_t loop)
continue; continue;
} }
i = 0; i = strcspn(textptr, "\r\n");
gVolumeNames[j] = FString(textptr, i);
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr+=i;
{
g_volumeNames[j][i] = *textptr;
textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(g_volumeNames[j])-1))
{
initprintf("%s:%d: warning: truncating volume name to %d characters.\n",
g_scriptFileName,g_lineNumber,(int32_t)sizeof(g_volumeNames[j])-1);
g_warningCnt++;
C_NextLine();
break;
}
}
g_volumeCnt = j+1; g_volumeCnt = j+1;
g_volumeNames[j][i] = '\0';
continue; continue;
case CON_DEFINESKILLNAME: case CON_DEFINESKILLNAME:
@ -1921,26 +1909,12 @@ static int32_t C_ParseCommand(int32_t loop)
continue; continue;
} }
i = 0; i = strcspn(textptr, "\r\n");
gSkillNames[j] = FString(textptr, i);
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr+=i;
{
g_skillNames[j][i] = *textptr;
textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(g_skillNames[j])-1))
{
initprintf("%s:%d: warning: truncating skill name to %d characters.\n",
g_scriptFileName,g_lineNumber,(int32_t)sizeof(g_skillNames[j])-1);
g_warningCnt++;
C_NextLine();
break;
}
}
g_skillNames[j][i] = '\0';
for (i=0; i<MAXSKILLS; i++) for (i=0; i<MAXSKILLS; i++)
if (g_skillNames[i][0] == 0) if (gSkillNames[i].IsEmpty())
break; break;
g_skillCnt = i; g_skillCnt = i;

View file

@ -31,13 +31,9 @@ user_defs ud;
const char *s_buildDate = "20120522"; const char *s_buildDate = "20120522";
char g_volumeNames[MAXVOLUMES][33] = { "L.A. Meltdown", "Lunar Apocalypse", "Shrapnel City" };
char g_skillNames[MAXSKILLS][33] = { "Piece Of Cake", "Let's Rock", "Come Get Some", "Damn I'm Good" };
char g_gametypeNames[MAXGAMETYPES][33] char g_gametypeNames[MAXGAMETYPES][33]
= { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" }; = { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" };
int32_t g_volumeFlags[MAXVOLUMES];
int32_t g_gametypeFlags[MAXGAMETYPES] = int32_t g_gametypeFlags[MAXGAMETYPES] =
{ {
GAMETYPE_FRAGBAR | GAMETYPE_FRAGBAR |

View file

@ -261,8 +261,6 @@ extern float g_gameUpdateAvgTime;
#ifndef global_c_ #ifndef global_c_
extern char CheatKeys[2]; extern char CheatKeys[2];
extern char g_gametypeNames[MAXGAMETYPES][33]; extern char g_gametypeNames[MAXGAMETYPES][33];
extern char g_skillNames[MAXSKILLS][33];
extern char g_volumeNames[MAXVOLUMES][33];
extern int32_t g_actorRespawnTime; extern int32_t g_actorRespawnTime;
extern int32_t g_bouncemineRadius; extern int32_t g_bouncemineRadius;
@ -284,7 +282,6 @@ extern int32_t g_volumeCnt;
extern int16_t g_blimpSpawnItems[15]; extern int16_t g_blimpSpawnItems[15];
extern int32_t g_gametypeFlags[MAXGAMETYPES]; extern int32_t g_gametypeFlags[MAXGAMETYPES];
extern int32_t g_volumeFlags[MAXVOLUMES];
extern const char *s_buildDate; extern const char *s_buildDate;
#endif #endif
@ -292,7 +289,6 @@ extern const char *s_buildDate;
enum enum
{ {
EF_HIDEFROMSP = 1<<0, EF_HIDEFROMSP = 1<<0,
// EF_HIDEFROMMP = 1<<1,
}; };
EXTERN_INLINE_HEADER void G_UpdateInterpolations(void); EXTERN_INLINE_HEADER void G_UpdateInterpolations(void);

View file

@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "menus.h" #include "menus.h"
#include "cheats.h" #include "cheats.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "menu/menu.h"
#include "../../glbackend/glbackend.h" #include "../../glbackend/glbackend.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -1535,18 +1536,18 @@ void Menu_Init(void)
k = 0; k = 0;
for (i = 0; i < g_volumeCnt; ++i) for (i = 0; i < g_volumeCnt; ++i)
{ {
if (g_volumeNames[i][0]) if (gVolumeNames[i].IsNotEmpty())
{ {
if (!(g_volumeFlags[i] & EF_HIDEFROMSP)) if (!(gVolumeFlags[i] & EF_HIDEFROMSP))
{ {
MEL_EPISODE[i] = &ME_EPISODE[i]; MEL_EPISODE[i] = &ME_EPISODE[i];
ME_EPISODE[i] = ME_EPISODE_TEMPLATE; ME_EPISODE[i] = ME_EPISODE_TEMPLATE;
ME_EPISODE[i].name = g_volumeNames[i]; ME_EPISODE[i].name = gVolumeNames[i];
} }
// if (!(EpisodeFlags[i] & EF_HIDEFROMMP)) // if (!(EpisodeFlags[i] & EF_HIDEFROMMP))
{ {
MEOSN_NetEpisodes[k] = g_volumeNames[i]; MEOSN_NetEpisodes[k] = gVolumeNames[i];
MEOSV_NetEpisodes[k] = i; MEOSV_NetEpisodes[k] = i;
k++; k++;
@ -1582,13 +1583,13 @@ void Menu_Init(void)
// prepare skills // prepare skills
k = -1; k = -1;
for (i = 0; i < g_skillCnt && g_skillNames[i][0]; ++i) for (i = 0; i < g_skillCnt && gSkillNames[i].IsNotEmpty(); ++i)
{ {
MEL_SKILL[i] = &ME_SKILL[i]; MEL_SKILL[i] = &ME_SKILL[i];
ME_SKILL[i] = ME_SKILL_TEMPLATE; ME_SKILL[i] = ME_SKILL_TEMPLATE;
ME_SKILL[i].name = g_skillNames[i]; ME_SKILL[i].name = gSkillNames[i];
MEOSN_NetSkills[i] = g_skillNames[i]; MEOSN_NetSkills[i] = gSkillNames[i];
k = i; k = i;
} }
@ -2120,10 +2121,10 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
mminitext(origin.x + ((90+60)<<16), origin.y + (90<<16), g_gametypeNames[m_coop], MF_Minifont.pal_deselected_right); mminitext(origin.x + ((90+60)<<16), origin.y + (90<<16), g_gametypeNames[m_coop], MF_Minifont.pal_deselected_right);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8)<<16), g_volumeNames[ud.m_volume_number], MF_Minifont.pal_deselected_right); mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8)<<16), gVolumeNames[ud.m_volume_number], MF_Minifont.pal_deselected_right);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8)<<16), g_mapInfo[MAXLEVELS*ud.m_volume_number+m_level_number].name, MF_Minifont.pal_deselected_right); mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8)<<16), g_mapInfo[MAXLEVELS*ud.m_volume_number+m_level_number].name, MF_Minifont.pal_deselected_right);
if (ud.m_monsters_off == 0 || ud.m_player_skill > 0) if (ud.m_monsters_off == 0 || ud.m_player_skill > 0)
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), g_skillNames[ud.m_player_skill], MF_Minifont.pal_deselected_right); mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), gSkillNames[ud.m_player_skill], MF_Minifont.pal_deselected_right);
else mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), "None", MF_Minifont.pal_deselected_right); else mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), "None", MF_Minifont.pal_deselected_right);
if (m_coop == 0) if (m_coop == 0)
{ {
@ -2199,7 +2200,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
{ {
const char *name = g_mapInfo[(savehead.volnum*MAXLEVELS) + savehead.levnum].name; const char *name = g_mapInfo[(savehead.volnum*MAXLEVELS) + savehead.levnum].name;
Bsprintf(tempbuf, "%s / %s", name ? name : "^10unnamed^0", g_skillNames[savehead.skill-1]); Bsprintf(tempbuf, "%s / %s", name ? name : "^10unnamed^0", gSkillNames[savehead.skill-1].GetChars());
} }
mgametextcenter(origin.x, origin.y + (168<<16), tempbuf); mgametextcenter(origin.x, origin.y + (168<<16), tempbuf);
@ -2261,7 +2262,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
mgametextcenter(origin.x, origin.y + (156<<16), tempbuf); mgametextcenter(origin.x, origin.y + (156<<16), tempbuf);
} }
Bsprintf(tempbuf,"%s / %s",g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, g_skillNames[ud.player_skill-1]); Bsprintf(tempbuf,"%s / %s",g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, gSkillNames[ud.player_skill-1].GetChars());
mgametextcenter(origin.x, origin.y + (168<<16), tempbuf); mgametextcenter(origin.x, origin.y + (168<<16), tempbuf);
if (ud.volume_number == 0 && ud.level_number == 7) if (ud.volume_number == 0 && ud.level_number == 7)
mgametextcenter(origin.x, origin.y + (180<<16), currentboardfilename); mgametextcenter(origin.x, origin.y + (180<<16), currentboardfilename);
@ -2305,7 +2306,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
#ifndef EDUKE32_ANDROID_MENU #ifndef EDUKE32_ANDROID_MENU
"\n(Y/N)" "\n(Y/N)"
#endif #endif
, g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, g_skillNames[ud.player_skill-1]); , g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, gSkillNames[ud.player_skill-1].GetChars());
mgametextcenter(origin.x, origin.y + (90<<16), tempbuf); mgametextcenter(origin.x, origin.y + (90<<16), tempbuf);
} }
else else

View file

@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "savegame.h" #include "savegame.h"
#include "cmdline.h" #include "cmdline.h"
#include "statistics.h" #include "statistics.h"
#include "menu/menu.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -1900,7 +1901,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
ud.player_skill = skillNum; ud.player_skill = skillNum;
ud.secretlevel = 0; ud.secretlevel = 0;
ud.from_bonus = 0; ud.from_bonus = 0;
STAT_StartNewGame(g_volumeNames[volumeNum], skillNum); STAT_StartNewGame(gVolumeNames[volumeNum], skillNum);
ud.last_level = -1; ud.last_level = -1;
g_lastAutoSaveArbitraryID = -1; g_lastAutoSaveArbitraryID = -1;

View file

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "demo.h" #include "demo.h"
#include "mdsprite.h" #include "mdsprite.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "menu/menu.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -993,7 +994,7 @@ void G_DisplayRest(int32_t smoothratio)
else else
{ {
if (!G_HaveUserMap()) if (!G_HaveUserMap())
minitext(5, a+6, g_volumeNames[ud.volume_number], 0, 2+8+16+256); minitext(5, a+6, gVolumeNames[ud.volume_number], 0, 2+8+16+256);
minitext(5, a+6+6, g_mapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name, 0, 2+8+16+256); minitext(5, a+6+6, g_mapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name, 0, 2+8+16+256);
} }
} }

View file

@ -134,15 +134,25 @@ LISTMENU "EpisodeMenu"
{ {
ScriptId 100 ScriptId 100
// Episode names filled in programmatically // Episode names filled in programmatically
NativeTextItem "1", "", "SkillMenu", 1 NativeTextItem "", "", "SkillMenu", 1
NativeTextItem "2", "", "SkillMenu", 2 NativeStaticTextItem ""
NativeTextItem "3", "", "SkillMenu", 3 NativeTextItem "", "", "SkillMenu", 2
NativeTextItem "4", "", "SkillMenu", 4 NativeStaticTextItem ""
NativeTextItem "5", "", "SkillMenu", 5 NativeTextItem "", "", "SkillMenu", 3
NativeTextItem "6", "", "SkillMenu", 6 NativeStaticTextItem ""
NativeTextItem "7", "", "SkillMenu", 7 NativeTextItem "", "", "SkillMenu", 4
NativeStaticTextItem ""
NativeTextItem "", "", "SkillMenu", 5
NativeStaticTextItem ""
NativeTextItem "", "", "SkillMenu", 6
NativeStaticTextItem ""
NativeTextItem "", "", "SkillMenu", 7
//Spacer //Spacer
NativeTextItem "$MNU_USERMAP", "u", "UserMap" NativeTextItem "$MNU_USERMAP", "u", "UserMap"
ifgame(ShadowWarrior)
{
NativeStaticTextItem "$MNU_SELECTUSERMAP"
}
} }
LISTMENU "SkillMenu" LISTMENU "SkillMenu"