mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
- some string rework
* removed temporary placeholder content from string init function. All this gets properly read from definition files now. * preinitialize a few quotes that are used for status display purposes and are needed in all games * only use the global episode name table in Blood to avoid redundancy * let SW's swcustom parser write to the global tables instead of local ones.
This commit is contained in:
parent
a74797b97c
commit
9f25c9c117
16 changed files with 73 additions and 115 deletions
|
@ -1357,7 +1357,7 @@ RESTART:
|
|||
//}
|
||||
if (gStartNewGame)
|
||||
{
|
||||
STAT_StartNewGame(gEpisodeInfo[gGameOptions.nEpisode].at0, gGameOptions.nDifficulty);
|
||||
STAT_StartNewGame(gVolumeNames[gGameOptions.nEpisode], gGameOptions.nDifficulty);
|
||||
StartLevel(&gGameOptions);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,8 +235,7 @@ void levelLoadDefaults(void)
|
|||
break;
|
||||
EPISODEINFO *pEpisodeInfo = &gEpisodeInfo[i];
|
||||
auto ep_str = BloodINI->GetKeyString(buffer, "Title", buffer);
|
||||
strncpy(pEpisodeInfo->at0, ep_str, 31);
|
||||
gVolumeNames[i] = ep_str; // For the menu.
|
||||
gVolumeNames[i] = ep_str; // only keep one table for the names. Todo: Consolidate this across games.
|
||||
strncpy(pEpisodeInfo->at8f08, BloodINI->GetKeyString(buffer, "CutSceneA", ""), BMAX_PATH);
|
||||
pEpisodeInfo->at9028 = BloodINI->GetKeyInt(buffer, "CutWavA", -1);
|
||||
if (pEpisodeInfo->at9028 == 0)
|
||||
|
@ -286,7 +285,7 @@ void levelAddUserMap(const char *pzMap)
|
|||
if (pEpisodeInfo->nLevels == 0)
|
||||
{
|
||||
gEpisodeCount++;
|
||||
sprintf(pEpisodeInfo->at0, "Episode %d", nEpisode);
|
||||
gVolumeNames[nEpisode].Format("Episode %d", nEpisode+1);
|
||||
}
|
||||
nLevel = pEpisodeInfo->nLevels++;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ struct LEVELINFO
|
|||
|
||||
struct EPISODEINFO
|
||||
{
|
||||
char at0[32];
|
||||
//char at0[32]; removed, so that the global episode name table can be used for consistency
|
||||
int nLevels;
|
||||
unsigned int bloodbath : 1;
|
||||
unsigned int cutALevel : 4;
|
||||
|
|
|
@ -38,12 +38,14 @@
|
|||
#include "c_cvars.h"
|
||||
#include "configfile.h"
|
||||
|
||||
#include "baselayer.h"
|
||||
#include "c_console.h"
|
||||
#include "gamecvars.h"
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "printf.h"
|
||||
#include "quotemgr.h"
|
||||
|
||||
|
||||
struct FLatchedValue
|
||||
|
@ -1511,8 +1513,23 @@ CCMD (toggle)
|
|||
val = var->GetGenericRep (CVAR_Bool);
|
||||
val.Bool = !val.Bool;
|
||||
var->SetGenericRep (val, CVAR_Bool);
|
||||
Printf ("\"%s\" = \"%s\"\n", var->GetName(),
|
||||
val.Bool ? "true" : "false");
|
||||
const char *statestr = argv.argc() <= 2? "*" : argv[2];
|
||||
if (*statestr == '*')
|
||||
{
|
||||
gi->PrintMessage(PRINT_MEDIUM, "\"%s\" = \"%s\"\n", var->GetName(), val.Bool ? "true" : "false");
|
||||
}
|
||||
else
|
||||
{
|
||||
int state = (int)strtoll(argv[2], nullptr, 0);
|
||||
if (state != 0)
|
||||
{
|
||||
// Order of Duke's quote string varies, some have on first, some off, so use the sign of the parameter to decide.
|
||||
// Positive means Off/On, negative means On/Off
|
||||
int quote = state > 0? state + val.Bool : -(state + val.Bool);
|
||||
auto text = quoteMgr.GetQuote(quote);
|
||||
if (text) gi->PrintMessage(PRINT_MEDIUM, "%s\n", text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "statistics.h"
|
||||
#include "menu.h"
|
||||
#include "gstrings.h"
|
||||
#include "quotemgr.h"
|
||||
#ifndef NETCODE_DISABLE
|
||||
#include "enet.h"
|
||||
#endif
|
||||
|
@ -263,47 +264,40 @@ int GameMain()
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// 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
|
||||
#define LOCALIZED_STRING(s) "$" s
|
||||
|
||||
void SetDefaultStrings()
|
||||
{
|
||||
// Hard coded texts for the episode and skill selection menus.
|
||||
if (g_gameType & GAMEFLAG_DUKE)
|
||||
// Blood hard codes its skill names, so we have to define them manually.
|
||||
if (g_gameType & GAMEFLAG_BLOOD)
|
||||
{
|
||||
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");
|
||||
gSkillNames[0] = "$STILL KICKING";
|
||||
gSkillNames[1] = "$PINK ON THE INSIDE";
|
||||
gSkillNames[2] = "$LIGHTLY BROILED";
|
||||
gSkillNames[3] = "$WELL DONE";
|
||||
gSkillNames[4] = "$EXTRA CRISPY";
|
||||
}
|
||||
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)");
|
||||
//Set a few quotes which are used for common handling of a few status messages
|
||||
quoteMgr.InitializeQuote(23, "$MESSAGES: ON");
|
||||
quoteMgr.InitializeQuote(24, "$MESSAGES:OFF");
|
||||
quoteMgr.InitializeQuote(83, "$MAPFOLLOWOFF");
|
||||
quoteMgr.InitializeQuote(84, "$MAPFOLLOWON");
|
||||
quoteMgr.InitializeQuote(85, "$AUTORUNOFF");
|
||||
quoteMgr.InitializeQuote(86, "$AUTORUNON");
|
||||
#if 0 // todo: print a message
|
||||
if (gAutoRun)
|
||||
viewSetMessage("Auto run ON");
|
||||
else
|
||||
viewSetMessage("Auto run OFF");
|
||||
|
||||
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");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "z_music.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "gstrings.h"
|
||||
#include "quotemgr.h"
|
||||
|
||||
/* Notes
|
||||
|
||||
|
@ -60,23 +61,8 @@
|
|||
|
||||
CVARD(Bool, cl_crosshair, true, CVAR_ARCHIVE, "enable/disable crosshair");
|
||||
CVARD(Bool, cl_automsg, false, CVAR_ARCHIVE, "enable/disable automatically sending messages to all players") // Not implemented for Blood
|
||||
CUSTOM_CVARD(Bool, cl_autorun, true, CVAR_ARCHIVE, "enable/disable autorun")
|
||||
{
|
||||
#if 0 // todo: print a message
|
||||
CVARD(Bool, cl_autorun, true, CVAR_ARCHIVE, "enable/disable autorun")
|
||||
|
||||
if (gAutoRun)
|
||||
viewSetMessage("Auto run ON");
|
||||
else
|
||||
viewSetMessage("Auto run OFF");
|
||||
|
||||
|
||||
RUN MODE OFF
|
||||
RUN MODE ON
|
||||
cl_autorun= 1-cl_autorun;
|
||||
P_DoQuote(QUOTE_RUN_MODE_OFF + cl_autorun, &myplayer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
CVARD(Bool, cl_runmode, true, CVAR_ARCHIVE, "enable/disable modernized run key operation")
|
||||
|
||||
bool G_CheckAutorun(bool button)
|
||||
|
@ -259,18 +245,18 @@ CUSTOM_CVARD(Int, hud_messages, 1, CVAR_ARCHIVE, "enable/disable showing message
|
|||
if (self < 0 || self > 2) self = 1;
|
||||
}
|
||||
|
||||
|
||||
// This cannot be done with the 'toggle' CCMD because it needs to control itself when to output the message
|
||||
CCMD (togglemessages)
|
||||
{
|
||||
if (hud_messages)
|
||||
{
|
||||
gi->PrintMessage(PRINT_MEDIUM, "%s\n", GStrings("MSGOFF"));
|
||||
gi->PrintMessage(PRINT_MEDIUM, "%s\n", quoteMgr.GetQuote(24));
|
||||
hud_messages = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
hud_messages = true;
|
||||
gi->PrintMessage(PRINT_MEDIUM, "%s\n", GStrings("MSGON"));
|
||||
gi->PrintMessage(PRINT_MEDIUM, "%s\n", quoteMgr.GetQuote(23));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "baselayer.h"
|
||||
#include "savegamehelp.h"
|
||||
#include "sjson.h"
|
||||
#include "gstrings.h"
|
||||
|
||||
CVAR(Int, savestatistics, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(String, statfile, "demolitionstat.txt", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -354,7 +355,7 @@ static void LevelStatEntry(FSessionStatistics *es, const char *level, const char
|
|||
|
||||
void STAT_StartNewGame(const char *episode, int skill)
|
||||
{
|
||||
StartEpisode = episode;
|
||||
StartEpisode = GStrings.localize(episode);
|
||||
StartSkill = skill;
|
||||
LevelData.Clear();
|
||||
LevelName = "";
|
||||
|
|
|
@ -114,14 +114,14 @@ private:
|
|||
public:
|
||||
static FString MakeMacro(const char *str)
|
||||
{
|
||||
//return FStringf("${%s}", str);
|
||||
return str;
|
||||
if (*str == '$') return str;
|
||||
return FString("$") + str;
|
||||
}
|
||||
|
||||
static FString MakeMacro(const char *str, size_t len)
|
||||
{
|
||||
//return FStringf("${%.*s}", len, str);
|
||||
return FString(str, len);
|
||||
if (*str == '$') return FString(str, len);
|
||||
return "$" + FString(str, len);
|
||||
}
|
||||
|
||||
const char* localize(const char* str)
|
||||
|
|
|
@ -212,18 +212,6 @@ void C_UndefineVolume(int32_t vol);
|
|||
void C_UndefineSkill(int32_t skill);
|
||||
void C_UndefineLevel(int32_t vol, int32_t lev);
|
||||
#if defined LUNATIC
|
||||
void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5]);
|
||||
void C_DefineQuote(int32_t qnum, const char *qstr);
|
||||
void C_DefineVolumeName(int32_t vol, const char *name);
|
||||
void C_DefineSkillName(int32_t skill, const char *name);
|
||||
void C_DefineLevelName(int32_t vol, int32_t lev, const char *fn,
|
||||
int32_t partime, int32_t designertime,
|
||||
const char *levelname);
|
||||
void C_DefineGameFuncName(int32_t idx, const char *name);
|
||||
void C_DefineGameType(int32_t idx, int32_t flags, const char *name);
|
||||
int32_t C_SetDefName(const char *name);
|
||||
void C_DefineProjectile(int32_t j, int32_t what, int32_t val);
|
||||
void C_SetCfgName(const char *cfgname);
|
||||
#else
|
||||
void C_ReportError(int error);
|
||||
void C_Compile(const char *filenam);
|
||||
|
|
|
@ -89,7 +89,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define QUOTE_RESERVED 115
|
||||
#define QUOTE_RESERVED2 116
|
||||
#define QUOTE_RESERVED3 117
|
||||
#define QUOTE_SAVE_DEAD NOBETAQUOTE(118)
|
||||
#define QUOTE_SAVE_DEAD 118
|
||||
#define QUOTE_CHEAT_ALL_WEAPONS NOBETAQUOTE(119)
|
||||
#define QUOTE_CHEAT_ALL_INV NOBETAQUOTE(120)
|
||||
#define QUOTE_CHEAT_ALL_KEYS NOBETAQUOTE(121)
|
||||
|
|
|
@ -962,7 +962,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
if (G_HaveUserMap())
|
||||
levelname = boardfilename;
|
||||
else if (!(G_GetLogoFlags() & LOGO_HIDEEPISODE))
|
||||
minitext(5, a+6, gVolumeNames[ud.volume_number], 0, 2+8+16+256);
|
||||
minitext(5, a+6, GStrings.localize(gVolumeNames[ud.volume_number]), 0, 2+8+16+256);
|
||||
minitext(5, a+6+6, levelname, 0, 2+8+16+256);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -993,7 +993,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
else
|
||||
{
|
||||
if (!G_HaveUserMap())
|
||||
minitext(5, a+6, gVolumeNames[ud.volume_number], 0, 2+8+16+256);
|
||||
minitext(5, a+6, GStrings.localize(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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -926,8 +926,12 @@ void InitGame()
|
|||
|
||||
LoadKVXFromScript("swvoxfil.txt"); // Load voxels from script file
|
||||
LoadPLockFromScript("swplock.txt"); // Get Parental Lock setup info
|
||||
|
||||
LoadCustomInfoFromScript("demolition/swcustom.txt"); // load the internal definitions. These also apply to the shareware version.
|
||||
if (!SW_SHAREWARE)
|
||||
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
|
||||
{
|
||||
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
|
||||
}
|
||||
|
||||
if (!loaddefinitionsfile(G_DefFile())) buildputs("Definitions file loaded.\n");
|
||||
|
||||
|
@ -1044,28 +1048,6 @@ int ThemeTrack[6] =
|
|||
2,3,13,13,13,14
|
||||
};
|
||||
|
||||
char EpisodeNames[3][MAX_EPISODE_NAME_LEN+2] =
|
||||
{
|
||||
"^Enter the Wang",
|
||||
"^Code of Honor",
|
||||
"^User Maps",
|
||||
};
|
||||
|
||||
char EpisodeSubtitles[3][MAX_EPISODE_SUBTITLE_LEN+1] =
|
||||
{
|
||||
"Four levels (Shareware Version)",
|
||||
"Eighteen levels (Full Version Only)",
|
||||
"Select a user map to play",
|
||||
};
|
||||
|
||||
char SkillNames[4][MAX_SKILL_NAME_LEN+2] =
|
||||
{
|
||||
"^Tiny grasshopper",
|
||||
"^I Have No Fear",
|
||||
"^Who Wants Wang",
|
||||
"^No Pain, No Gain"
|
||||
};
|
||||
|
||||
void InitNewGame(void)
|
||||
{
|
||||
int i, ready_bak;
|
||||
|
|
|
@ -960,11 +960,6 @@ extern const char *ThemeSongs[6]; //
|
|||
#define MAX_EPISODE_NAME_LEN 24
|
||||
extern char EpisodeNames[3][MAX_EPISODE_NAME_LEN+2];
|
||||
|
||||
#define MAX_EPISODE_SUBTITLE_LEN 40
|
||||
extern char EpisodeSubtitles[3][MAX_EPISODE_SUBTITLE_LEN+1];
|
||||
|
||||
#define MAX_SKILL_NAME_LEN 24
|
||||
extern char SkillNames[4][MAX_SKILL_NAME_LEN+2];
|
||||
|
||||
#define MAX_FORTUNES 16
|
||||
extern const char *ReadFortune[MAX_FORTUNES];
|
||||
|
|
|
@ -39,6 +39,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
#include "jsector.h"
|
||||
#include "parent.h"
|
||||
#include "scriptfile.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
BEGIN_SW_NS
|
||||
|
||||
|
@ -723,18 +724,14 @@ void LoadCustomInfoFromScript(const char *filename)
|
|||
{
|
||||
char *t;
|
||||
if (scriptfile_getstring(script, &t)) break;
|
||||
|
||||
strncpy(&EpisodeNames[curmap][1], t, MAX_EPISODE_NAME_LEN);
|
||||
EpisodeNames[curmap][MAX_EPISODE_NAME_LEN+1] = 0;
|
||||
gVolumeNames[curmap] = t;
|
||||
break;
|
||||
}
|
||||
case CM_SUBTITLE:
|
||||
{
|
||||
char *t;
|
||||
if (scriptfile_getstring(script, &t)) break;
|
||||
|
||||
strncpy(EpisodeSubtitles[curmap], t, MAX_EPISODE_SUBTITLE_LEN);
|
||||
EpisodeSubtitles[curmap][MAX_EPISODE_SUBTITLE_LEN] = 0;
|
||||
gVolumeSubtitles[curmap] = t;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -775,8 +772,7 @@ void LoadCustomInfoFromScript(const char *filename)
|
|||
char *t;
|
||||
if (scriptfile_getstring(script, &t)) break;
|
||||
|
||||
strncpy(&SkillNames[curmap][1], t, MAX_SKILL_NAME_LEN);
|
||||
SkillNames[curmap][MAX_SKILL_NAME_LEN+1] = 0;
|
||||
gSkillNames[curmap] = t;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -35,7 +35,7 @@ LAlt "+Strafe"
|
|||
RAlt "+Strafe"
|
||||
LShift "+Run"
|
||||
RShift "+Run"
|
||||
Capslock "+AutoRun"
|
||||
Capslock "toggle autorun 85"
|
||||
PgUp "+Look_Up"
|
||||
PgDn "+Look_Down"
|
||||
Home "+Aim_Up"
|
||||
|
|
Loading…
Reference in a new issue