Add "rtsname" token to grpinfo grammar.

git-svn-id: https://svn.eduke32.com/eduke32@6645 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-02-11 05:03:55 +00:00
parent 0cbb522ff0
commit d68c9b45c6
10 changed files with 35 additions and 7 deletions

View file

@ -144,6 +144,8 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows);
#define EDUKE32_TMRTIC t[ti++]=getticks()
#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
void Duke_CommonCleanup(void);
#ifdef __cplusplus
}
#endif

View file

@ -7838,6 +7838,8 @@ void uninitengine(void)
DO_FREE_AND_NULL(multipsky);
DO_FREE_AND_NULL(multipskytile);
pskynummultis = 0;
DO_FREE_AND_NULL(g_defNamePtr);
}

View file

@ -10091,6 +10091,8 @@ void ExtUnInit(void)
for (i = numhelppages-1; i >= 0; i--) Bfree(helppage[i]);
Bfree(helppage);
#endif
Duke_CommonCleanup();
}
void ExtPreCheckKeys(void) // just before drawrooms

View file

@ -426,7 +426,8 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
{
if (argc > i+1)
{
g_rtsNamePtr = argv[i+1];
free(g_rtsNamePtr);
g_rtsNamePtr = dup_filename(argv[i+1]);
Bstrncpyz(ud.rtsname, g_rtsNamePtr, sizeof(ud.rtsname));
initprintf("Using RTS file \"%s\".\n", ud.rtsname);
i++;
@ -819,7 +820,8 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
}
if (!Bstrcasecmp(k, ".rts"))
{
g_rtsNamePtr = argv[i++];
free(g_rtsNamePtr);
g_rtsNamePtr = dup_filename(argv[i++]);
Bstrncpyz(ud.rtsname, g_rtsNamePtr, sizeof(ud.rtsname));
initprintf("Using RTS file \"%s\".\n", ud.rtsname);
continue;

View file

@ -48,6 +48,8 @@ static const char *defaultgameconfilename[GAMECOUNT] = { "EDUKE.CON", "NAM.CON",
char *g_grpNamePtr = NULL;
// g_scriptNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_scriptNamePtr = NULL;
// g_rtsNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_rtsNamePtr = NULL;
void clearGrpNamePtr(void)
{
@ -448,6 +450,9 @@ void G_LoadGroups(int32_t autoload)
if (type->defname && g_defNamePtr == NULL)
g_defNamePtr = dup_filename(type->defname);
if (type->rtsname && g_rtsNamePtr == NULL)
g_rtsNamePtr = dup_filename(type->rtsname);
}
else
{
@ -1170,4 +1175,11 @@ int32_t S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic)
return origfp;
}
void Duke_CommonCleanup(void)
{
DO_FREE_AND_NULL(g_grpNamePtr);
DO_FREE_AND_NULL(g_scriptNamePtr);
DO_FREE_AND_NULL(g_rtsNamePtr);
}
#endif

View file

@ -89,6 +89,7 @@ extern const char *g_gameNamePtr;
extern char *g_grpNamePtr;
extern char *g_scriptNamePtr;
extern char *g_rtsNamePtr;
extern const char *G_DefaultGrpFile(void);
extern const char *G_GrpFile(void);

View file

@ -93,9 +93,6 @@ int32_t g_Debug = 0;
const char *defaultrtsfilename[GAMECOUNT] = { "DUKE.RTS", "NAM.RTS", "NAPALM.RTS", "WW2GI.RTS" };
// g_rtsNamePtr can point to an argv[] element
const char *g_rtsNamePtr = NULL;
int32_t g_Shareware = 0;
// This was 32 for a while, but I think lowering it to 24 will help things like the Dingoo.
@ -5585,6 +5582,8 @@ static void G_Cleanup(void)
hash_loop(&h_dukeanim, G_FreeHashAnim);
hash_free(&h_dukeanim);
Duke_CommonCleanup();
}
/*

View file

@ -276,8 +276,6 @@ extern user_defs ud;
// this is checked against http://eduke32.com/VERSION
extern const char *s_buildDate;
extern const char *g_rtsNamePtr;
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
static inline int G_HaveUserMap(void)

View file

@ -118,6 +118,7 @@ static void LoadList(const char * filename)
T_SCRIPTNAME,
T_DEFNAME,
T_FLAGS,
T_RTSNAME,
};
static const tokenlist profiletokens[] =
@ -132,6 +133,7 @@ static void LoadList(const char * filename)
{
int32_t gsize = 0, gcrcval = 0, gflags = GAMEFLAG_DUKE, gdepcrc = DUKE15_CRC;
char *gname = NULL, *gscript = NULL, *gdef = NULL;
char *grts = NULL;
char *grpend = NULL;
static const tokenlist grpinfotokens[] =
@ -139,6 +141,7 @@ static void LoadList(const char * filename)
{ "name", T_GAMENAME },
{ "scriptname", T_SCRIPTNAME },
{ "defname", T_DEFNAME },
{ "rtsname", T_RTSNAME },
{ "crc", T_CRC },
{ "dependency", T_DEPCRC },
{ "size", T_SIZE },
@ -160,6 +163,8 @@ static void LoadList(const char * filename)
scriptfile_getstring(script,&gscript); break;
case T_DEFNAME:
scriptfile_getstring(script,&gdef); break;
case T_RTSNAME:
scriptfile_getstring(script,&grts); break;
case T_FLAGS:
scriptfile_getsymbol(script,&gflags); gflags &= GAMEFLAGMASK; break;
@ -190,6 +195,9 @@ static void LoadList(const char * filename)
if (gdef)
fg->defname = dup_filename(gdef);
if (grts)
fg->rtsname = dup_filename(grts);
}
break;
}
@ -241,6 +249,7 @@ static void FreeGameList(void)
Bfree(listgrps->name);
Bfree(listgrps->scriptname);
Bfree(listgrps->defname);
Bfree(listgrps->rtsname);
grpinfo_t * const fg = listgrps->next;
Bfree(listgrps);

View file

@ -82,6 +82,7 @@ typedef struct grpinfo_t {
int32_t dependency;
char *scriptname;
char *defname;
char *rtsname;
void (*postprocessing)(int32_t);
struct grpinfo_t *next;
} grpinfo_t;