mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used." git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5a632bc1f0
commit
ef61e48c25
15 changed files with 740 additions and 294 deletions
|
@ -755,7 +755,11 @@ int32_t md_loadmodel(const char *fn);
|
||||||
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags);
|
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags);
|
||||||
// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
|
// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
|
||||||
|
|
||||||
|
extern char defsfilename[BMAX_PATH];
|
||||||
|
extern char *g_defNamePtr;
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// maps build tiles to particular animation frames of a model
|
// maps build tiles to particular animation frames of a model
|
||||||
|
|
|
@ -95,7 +95,6 @@ extern const char *mapster32_fullpath;
|
||||||
extern char *testplay_addparam;
|
extern char *testplay_addparam;
|
||||||
extern const char *g_namesFileName;
|
extern const char *g_namesFileName;
|
||||||
|
|
||||||
extern const char *defsfilename; // set in bstub.c
|
|
||||||
extern int32_t g_maxCacheSize;
|
extern int32_t g_maxCacheSize;
|
||||||
|
|
||||||
extern int32_t g_lazy_tileselector;
|
extern int32_t g_lazy_tileselector;
|
||||||
|
|
|
@ -563,7 +563,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
|
Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
|
||||||
initcrc();
|
initcrc();
|
||||||
|
|
||||||
if (!loaddefinitionsfile(defsfilename))
|
if (!loaddefinitionsfile(g_defNamePtr))
|
||||||
initprintf("Definitions file loaded.\n");
|
initprintf("Definitions file loaded.\n");
|
||||||
|
|
||||||
k = 0;
|
k = 0;
|
||||||
|
|
|
@ -80,7 +80,8 @@ enum scripttoken_t
|
||||||
T_CACHESIZE,
|
T_CACHESIZE,
|
||||||
T_IMPORTTILE,
|
T_IMPORTTILE,
|
||||||
T_MUSIC,T_ID,T_SOUND,
|
T_MUSIC,T_ID,T_SOUND,
|
||||||
T_TILEFROMTEXTURE, T_XOFFSET, T_YOFFSET
|
T_TILEFROMTEXTURE, T_XOFFSET, T_YOFFSET,
|
||||||
|
T_INCLUDEDEFAULT
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct { const char *text; int32_t tokenid; } tokenlist;
|
typedef struct { const char *text; int32_t tokenid; } tokenlist;
|
||||||
|
@ -125,6 +126,8 @@ static int32_t defsparser(scriptfile *script)
|
||||||
{
|
{
|
||||||
{ "include", T_INCLUDE },
|
{ "include", T_INCLUDE },
|
||||||
{ "#include", T_INCLUDE },
|
{ "#include", T_INCLUDE },
|
||||||
|
{ "includedefault", T_INCLUDEDEFAULT },
|
||||||
|
{ "#includedefault", T_INCLUDEDEFAULT },
|
||||||
{ "define", T_DEFINE },
|
{ "define", T_DEFINE },
|
||||||
{ "#define", T_DEFINE },
|
{ "#define", T_DEFINE },
|
||||||
|
|
||||||
|
@ -206,6 +209,23 @@ static int32_t defsparser(scriptfile *script)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case T_INCLUDEDEFAULT:
|
||||||
|
{
|
||||||
|
scriptfile *included;
|
||||||
|
|
||||||
|
included = scriptfile_fromfile(defsfilename);
|
||||||
|
if (!included)
|
||||||
|
{
|
||||||
|
initprintf("Warning: Failed including %s on line %s:%d\n",
|
||||||
|
defsfilename, script->filename,scriptfile_getlinum(script,cmdtokptr));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
defsparser(included);
|
||||||
|
scriptfile_close(included);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case T_DEFINE:
|
case T_DEFINE:
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
|
|
@ -62,20 +62,36 @@ static int32_t g_fillCurSector = 0;
|
||||||
static char g_modDir[BMAX_PATH];
|
static char g_modDir[BMAX_PATH];
|
||||||
|
|
||||||
// static char *startwin_labeltext = "Starting Mapster32...";
|
// static char *startwin_labeltext = "Starting Mapster32...";
|
||||||
static char setupfilename[]= "mapster32.cfg";
|
static char *setupfilename = "mapster32.cfg";
|
||||||
static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp";
|
static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp";
|
||||||
static char *g_grpNamePtr = defaultduke3dgrp;
|
static char *g_grpNamePtr = defaultduke3dgrp;
|
||||||
|
char *g_defNamePtr = defsfilename;
|
||||||
static int32_t fixmapbeforesaving = 0;
|
static int32_t fixmapbeforesaving = 0;
|
||||||
static int32_t lastsave = -180*60;
|
static int32_t lastsave = -180*60;
|
||||||
static int32_t NoAutoLoad = 0;
|
static int32_t NoAutoLoad = 0;
|
||||||
static int32_t spnoclip=1;
|
static int32_t spnoclip=1;
|
||||||
|
|
||||||
static char default_tiles_cfg[] = "tiles.cfg";
|
static char *default_tiles_cfg = "tiles.cfg";
|
||||||
static int32_t pathsearchmode_oninit;
|
static int32_t pathsearchmode_oninit;
|
||||||
|
|
||||||
// Sound in Mapster32
|
// Sound in Mapster32
|
||||||
static char defaultgamecon[] = "game.con";
|
static char defaultgamecon[2][BMAX_PATH] = { "eduke.con", "game.con" };
|
||||||
static char *gamecon = defaultgamecon;
|
|
||||||
|
char * defaultgameconfile(void)
|
||||||
|
{
|
||||||
|
int32_t script; // scriptfile *script;
|
||||||
|
|
||||||
|
script = kopen4load(defaultgamecon[0],0); // script = scriptfile_fromfile(defaultgamecon[0]);
|
||||||
|
|
||||||
|
if (script >= 0)
|
||||||
|
return defaultgamecon[0];
|
||||||
|
|
||||||
|
return defaultgamecon[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *gamecon = "\0";
|
||||||
|
static int32_t g_skipDefaultCons = 0;
|
||||||
|
static int32_t g_skipDefaultDefs = 0; // primarily for NAM/WWII GI appeasement
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
sound_t g_sounds[MAXSOUNDS];
|
sound_t g_sounds[MAXSOUNDS];
|
||||||
|
@ -8489,6 +8505,10 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
if (!Bstrcasecmp(c+1,"nam"))
|
if (!Bstrcasecmp(c+1,"nam"))
|
||||||
{
|
{
|
||||||
Bstrcpy(g_grpNamePtr, "nam.grp");
|
Bstrcpy(g_grpNamePtr, "nam.grp");
|
||||||
|
Bstrcpy(defaultduke3dgrp, "nam.grp");
|
||||||
|
Bstrcpy(defsfilename, "nam.def");
|
||||||
|
// Bstrcpy(g_defNamePtr, "nam.def");
|
||||||
|
Bstrcpy(defaultgamecon[0], "nam.con");
|
||||||
COPYARG(i);
|
COPYARG(i);
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -8508,6 +8528,10 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
if (!Bstrcasecmp(c+1,"ww2gi"))
|
if (!Bstrcasecmp(c+1,"ww2gi"))
|
||||||
{
|
{
|
||||||
Bstrcpy(g_grpNamePtr, "ww2gi.grp");
|
Bstrcpy(g_grpNamePtr, "ww2gi.grp");
|
||||||
|
Bstrcpy(defaultduke3dgrp, "ww2gi.grp");
|
||||||
|
Bstrcpy(defaultgamecon[0], "ww2gi.con");
|
||||||
|
Bstrcpy(defsfilename, "ww2gi.def");
|
||||||
|
// Bstrcpy(g_defNamePtr, "ww2gi.def");
|
||||||
COPYARG(i);
|
COPYARG(i);
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -8568,9 +8592,10 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
c++;
|
c++;
|
||||||
if (*c)
|
if (*c)
|
||||||
{
|
{
|
||||||
defsfilename = c;
|
g_defNamePtr = c;
|
||||||
|
g_skipDefaultDefs = 1;
|
||||||
COPYARG(i);
|
COPYARG(i);
|
||||||
initprintf("Using DEF file: %s.\n",defsfilename);
|
initprintf("Using DEF file: %s.\n",g_defNamePtr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'j':
|
case 'j':
|
||||||
|
@ -8592,7 +8617,9 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
c++;
|
c++;
|
||||||
if (!*c) break;
|
if (!*c) break;
|
||||||
gamecon = c;
|
gamecon = c;
|
||||||
|
g_skipDefaultCons = 1;
|
||||||
COPYARG(i);
|
COPYARG(i);
|
||||||
|
initprintf("Using CON file '%s'.\n",gamecon);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8610,14 +8637,17 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
else if (!Bstrcasecmp(k,".def"))
|
else if (!Bstrcasecmp(k,".def"))
|
||||||
{
|
{
|
||||||
COPYARG(i);
|
COPYARG(i);
|
||||||
defsfilename = (char *)argv[i++];
|
g_defNamePtr = (char *)argv[i++];
|
||||||
initprintf("Using DEF file: %s.\n",defsfilename);
|
g_skipDefaultDefs = 1;
|
||||||
|
initprintf("Using DEF file: %s.\n",g_defNamePtr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!Bstrcasecmp(k,".con"))
|
else if (!Bstrcasecmp(k,".con"))
|
||||||
{
|
{
|
||||||
COPYARG(i);
|
COPYARG(i);
|
||||||
gamecon = (char *)argv[i++];
|
gamecon = (char *)argv[i++];
|
||||||
|
g_skipDefaultCons = 1;
|
||||||
|
initprintf("Using CON file '%s'.\n",gamecon);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9392,6 +9422,7 @@ enum
|
||||||
T_OFFSETA,
|
T_OFFSETA,
|
||||||
|
|
||||||
T_DEFINESOUND,
|
T_DEFINESOUND,
|
||||||
|
T_INCLUDEDEFAULT,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -9447,6 +9478,8 @@ int32_t parsegroupfiles(scriptfile *script)
|
||||||
{
|
{
|
||||||
{ "include", T_INCLUDE },
|
{ "include", T_INCLUDE },
|
||||||
{ "#include", T_INCLUDE },
|
{ "#include", T_INCLUDE },
|
||||||
|
{ "includedefault", T_INCLUDEDEFAULT },
|
||||||
|
{ "#includedefault", T_INCLUDEDEFAULT },
|
||||||
{ "loadgrp", T_LOADGRP },
|
{ "loadgrp", T_LOADGRP },
|
||||||
{ "noautoload", T_NOAUTOLOAD }
|
{ "noautoload", T_NOAUTOLOAD }
|
||||||
};
|
};
|
||||||
|
@ -9501,6 +9534,24 @@ int32_t parsegroupfiles(scriptfile *script)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case T_INCLUDEDEFAULT:
|
||||||
|
{
|
||||||
|
scriptfile *included;
|
||||||
|
|
||||||
|
included = scriptfile_fromfile(defsfilename);
|
||||||
|
if (!included)
|
||||||
|
{
|
||||||
|
initprintf("Warning: Failed including %s on line %s:%d\n",
|
||||||
|
defsfilename, script->filename,scriptfile_getlinum(script,cmdtokptr));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
parsegroupfiles(included);
|
||||||
|
scriptfile_close(included);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case T_NOAUTOLOAD:
|
case T_NOAUTOLOAD:
|
||||||
NoAutoLoad = 1;
|
NoAutoLoad = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -9883,6 +9934,8 @@ static int32_t parseconsounds(scriptfile *script)
|
||||||
{
|
{
|
||||||
{ "include", T_INCLUDE },
|
{ "include", T_INCLUDE },
|
||||||
{ "#include", T_INCLUDE },
|
{ "#include", T_INCLUDE },
|
||||||
|
{ "includedefault", T_INCLUDEDEFAULT },
|
||||||
|
{ "#includedefault", T_INCLUDEDEFAULT },
|
||||||
{ "define", T_DEFINE },
|
{ "define", T_DEFINE },
|
||||||
{ "#define", T_DEFINE },
|
{ "#define", T_DEFINE },
|
||||||
{ "definesound", T_DEFINESOUND },
|
{ "definesound", T_DEFINESOUND },
|
||||||
|
@ -9916,6 +9969,25 @@ static int32_t parseconsounds(scriptfile *script)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case T_INCLUDEDEFAULT:
|
||||||
|
{
|
||||||
|
char * fn = defaultgameconfile();
|
||||||
|
scriptfile *included;
|
||||||
|
|
||||||
|
included = scriptfile_fromfile(fn);
|
||||||
|
if (!included)
|
||||||
|
{
|
||||||
|
initprintf("Warning: Failed including %s on line %s:%d\n",
|
||||||
|
fn, script->filename,scriptfile_getlinum(script,cmdtokptr));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int32_t tmp = parseconsounds(included);
|
||||||
|
scriptfile_close(included);
|
||||||
|
if (tmp < 0) return tmp;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case T_DEFINE:
|
case T_DEFINE:
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -10178,10 +10250,15 @@ int32_t ExtInit(void)
|
||||||
|
|
||||||
if (getenv("DUKE3DDEF"))
|
if (getenv("DUKE3DDEF"))
|
||||||
{
|
{
|
||||||
defsfilename = getenv("DUKE3DDEF");
|
g_defNamePtr = getenv("DUKE3DDEF");
|
||||||
initprintf("Using '%s' as definitions file\n", defsfilename);
|
g_skipDefaultDefs = 1;
|
||||||
|
initprintf("Using '%s' as definitions file\n", g_defNamePtr);
|
||||||
}
|
}
|
||||||
loadgroupfiles(defsfilename);
|
if (g_skipDefaultDefs == 0)
|
||||||
|
Bstrcpy(g_defNamePtr, defsfilename); // it MAY have changed, with NAM/WWII GI
|
||||||
|
|
||||||
|
loadgroupfiles(g_defNamePtr);
|
||||||
|
// the defs are actually loaded in app_main in build.c
|
||||||
|
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
struct strllist *s;
|
||||||
|
@ -10922,7 +10999,12 @@ void ExtCheckKeys(void)
|
||||||
if (!soundinit)
|
if (!soundinit)
|
||||||
{
|
{
|
||||||
g_numsounds = 0;
|
g_numsounds = 0;
|
||||||
|
|
||||||
|
if (g_skipDefaultCons == 0)
|
||||||
|
loadconsounds(defaultgameconfile()); // Bstrcpy(gamecon, defaultgameconfile());
|
||||||
|
else
|
||||||
loadconsounds(gamecon);
|
loadconsounds(gamecon);
|
||||||
|
|
||||||
if (g_numsounds > 0)
|
if (g_numsounds > 0)
|
||||||
{
|
{
|
||||||
if (S_SoundStartup() != 0)
|
if (S_SoundStartup() != 0)
|
||||||
|
|
|
@ -105,6 +105,7 @@ uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[76
|
||||||
uint8_t *basepaltable[BASEPALCOUNT] = { palette, water_pal, slime_pal, dre_alms, title_pal, ending_pal, NULL };
|
uint8_t *basepaltable[BASEPALCOUNT] = { palette, water_pal, slime_pal, dre_alms, title_pal, ending_pal, NULL };
|
||||||
|
|
||||||
static int32_t g_skipDefaultCons = 0;
|
static int32_t g_skipDefaultCons = 0;
|
||||||
|
static int32_t g_skipDefaultDefs = 0; // primarily for NAM/WWII GI appeasement
|
||||||
|
|
||||||
int32_t voting = -1;
|
int32_t voting = -1;
|
||||||
int32_t vote_map = -1, vote_episode = -1;
|
int32_t vote_map = -1, vote_episode = -1;
|
||||||
|
@ -114,12 +115,12 @@ static int32_t g_noLogoAnim = 0;
|
||||||
static int32_t g_noLogo = 0;
|
static int32_t g_noLogo = 0;
|
||||||
|
|
||||||
char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp";
|
char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp";
|
||||||
static char defaultduke3ddef[BMAX_PATH] = "duke3d.def";
|
char defsfilename[BMAX_PATH] = "duke3d.def";
|
||||||
static char defaultconfilename[BMAX_PATH] = { "EDUKE.CON" };
|
static char defaultconfilename[2][BMAX_PATH] = { "EDUKE.CON", "GAME.CON" };
|
||||||
|
|
||||||
char *g_grpNamePtr = defaultduke3dgrp;
|
char *g_grpNamePtr = defaultduke3dgrp;
|
||||||
char *g_defNamePtr = defaultduke3ddef;
|
char *g_defNamePtr = defsfilename;
|
||||||
char *g_scriptNamePtr = defaultconfilename;
|
char *g_scriptNamePtr = defaultconfilename[0];
|
||||||
char *g_gameNamePtr = NULL;
|
char *g_gameNamePtr = NULL;
|
||||||
|
|
||||||
extern int32_t lastvisinc;
|
extern int32_t lastvisinc;
|
||||||
|
@ -183,6 +184,18 @@ int32_t kopen4loadfrommod(const char *filename, char searchfirst)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char * defaultconfile(void)
|
||||||
|
{
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
i = kopen4load(defaultconfilename[0],0);
|
||||||
|
|
||||||
|
if (i >= 0)
|
||||||
|
return defaultconfilename[0];
|
||||||
|
|
||||||
|
return defaultconfilename[1];
|
||||||
|
}
|
||||||
|
|
||||||
enum gametokens
|
enum gametokens
|
||||||
{
|
{
|
||||||
T_EOF = -2,
|
T_EOF = -2,
|
||||||
|
@ -194,6 +207,7 @@ enum gametokens
|
||||||
T_CACHESIZE = 2,
|
T_CACHESIZE = 2,
|
||||||
T_ALLOW = 2,
|
T_ALLOW = 2,
|
||||||
T_NOAUTOLOAD,
|
T_NOAUTOLOAD,
|
||||||
|
T_INCLUDEDEFAULT,
|
||||||
T_MUSIC,
|
T_MUSIC,
|
||||||
T_SOUND,
|
T_SOUND,
|
||||||
T_FILE,
|
T_FILE,
|
||||||
|
@ -1869,6 +1883,8 @@ void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e)
|
||||||
|
|
||||||
void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step)
|
void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step)
|
||||||
{
|
{
|
||||||
|
if (getrendermode() >= 3) return;
|
||||||
|
|
||||||
if (step > 0)
|
if (step > 0)
|
||||||
{
|
{
|
||||||
for (; start < end; start += step)
|
for (; start < end; start += step)
|
||||||
|
@ -8006,6 +8022,8 @@ static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload)
|
||||||
{
|
{
|
||||||
{ "include", T_INCLUDE },
|
{ "include", T_INCLUDE },
|
||||||
{ "#include", T_INCLUDE },
|
{ "#include", T_INCLUDE },
|
||||||
|
{ "includedefault", T_INCLUDEDEFAULT },
|
||||||
|
{ "#includedefault", T_INCLUDEDEFAULT },
|
||||||
{ "loadgrp", T_LOADGRP },
|
{ "loadgrp", T_LOADGRP },
|
||||||
{ "cachesize", T_CACHESIZE },
|
{ "cachesize", T_CACHESIZE },
|
||||||
{ "noautoload", T_NOAUTOLOAD },
|
{ "noautoload", T_NOAUTOLOAD },
|
||||||
|
@ -8075,6 +8093,22 @@ static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case T_INCLUDEDEFAULT:
|
||||||
|
{
|
||||||
|
scriptfile *included = scriptfile_fromfile(defsfilename);
|
||||||
|
|
||||||
|
if (!included)
|
||||||
|
{
|
||||||
|
// initprintf("Warning: Failed including %s on line %s:%d\n",
|
||||||
|
// defsfilename, script->filename,scriptfile_getlinum(script,cmdtokptr));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
parsedefinitions_game(included, preload);
|
||||||
|
scriptfile_close(included);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case T_NOAUTOLOAD:
|
case T_NOAUTOLOAD:
|
||||||
if (preload)
|
if (preload)
|
||||||
g_noAutoLoad = 1;
|
g_noAutoLoad = 1;
|
||||||
|
@ -8343,18 +8377,20 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
}
|
}
|
||||||
if (!Bstrcasecmp(c+1,"nam"))
|
if (!Bstrcasecmp(c+1,"nam"))
|
||||||
{
|
{
|
||||||
Bsprintf(defaultduke3dgrp, "nam.grp");
|
Bstrcpy(defaultduke3dgrp, "nam.grp");
|
||||||
Bsprintf(defaultduke3ddef, "nam.def");
|
Bstrcpy(defsfilename, "nam.def");
|
||||||
Bsprintf(defaultconfilename, "nam.con");
|
// Bstrcpy(g_defNamePtr, "nam.def");
|
||||||
|
Bstrcpy(defaultconfilename[0], "nam.con");
|
||||||
g_gameType = GAME_NAM;
|
g_gameType = GAME_NAM;
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!Bstrcasecmp(c+1,"ww2gi"))
|
if (!Bstrcasecmp(c+1,"ww2gi"))
|
||||||
{
|
{
|
||||||
Bsprintf(defaultduke3dgrp, "ww2gi.grp");
|
Bstrcpy(defaultduke3dgrp, "ww2gi.grp");
|
||||||
Bsprintf(defaultduke3ddef, "ww2gi.def");
|
Bstrcpy(defsfilename, "ww2gi.def");
|
||||||
Bsprintf(defaultconfilename, "ww2gi.con");
|
// Bstrcpy(g_defNamePtr, "ww2gi.def");
|
||||||
|
Bstrcpy(defaultconfilename[0], "ww2gi.con");
|
||||||
g_gameType = GAME_WW2;
|
g_gameType = GAME_WW2;
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -8567,6 +8603,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
if (*c)
|
if (*c)
|
||||||
{
|
{
|
||||||
g_defNamePtr = c;
|
g_defNamePtr = c;
|
||||||
|
g_skipDefaultDefs = 1;
|
||||||
initprintf("Using DEF file: %s.\n",g_defNamePtr);
|
initprintf("Using DEF file: %s.\n",g_defNamePtr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -8739,6 +8776,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
if (!Bstrcasecmp(k,".def"))
|
if (!Bstrcasecmp(k,".def"))
|
||||||
{
|
{
|
||||||
g_defNamePtr = (char *)argv[i++];
|
g_defNamePtr = (char *)argv[i++];
|
||||||
|
g_skipDefaultDefs = 1;
|
||||||
initprintf("Using DEF file: %s.\n",g_defNamePtr);
|
initprintf("Using DEF file: %s.\n",g_defNamePtr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -9002,7 +9040,7 @@ void G_Shutdown(void)
|
||||||
|
|
||||||
static void G_CompileScripts(void)
|
static void G_CompileScripts(void)
|
||||||
{
|
{
|
||||||
int32_t i, psm = pathsearchmode;
|
int32_t psm = pathsearchmode;
|
||||||
|
|
||||||
label = (char *)&sprite[0]; // V8: 16384*44/64 = 11264 V7: 4096*44/64 = 2816
|
label = (char *)&sprite[0]; // V8: 16384*44/64 = 11264 V7: 4096*44/64 = 2816
|
||||||
labelcode = (intptr_t *)§or[0]; // V8: 4096*40/4 = 40960 V7: 1024*40/4 = 10240
|
labelcode = (intptr_t *)§or[0]; // V8: 4096*40/4 = 40960 V7: 1024*40/4 = 10240
|
||||||
|
@ -9013,24 +9051,15 @@ static void G_CompileScripts(void)
|
||||||
pathsearchmode = 1;
|
pathsearchmode = 1;
|
||||||
if (g_skipDefaultCons == 0)
|
if (g_skipDefaultCons == 0)
|
||||||
{
|
{
|
||||||
i = kopen4loadfrommod(g_scriptNamePtr,0);
|
Bsprintf(g_scriptNamePtr,defaultconfile());
|
||||||
if (i!=-1)
|
|
||||||
kclose(i);
|
|
||||||
else Bsprintf(g_scriptNamePtr,"GAME.CON");
|
|
||||||
}
|
}
|
||||||
C_Compile(g_scriptNamePtr);
|
C_Compile(g_scriptNamePtr);
|
||||||
|
|
||||||
if (g_loadFromGroupOnly)
|
if (g_loadFromGroupOnly) // g_loadFromGroupOnly is true only when compiling fails and internal defaults are utilized
|
||||||
{
|
{
|
||||||
if (g_skipDefaultCons == 0)
|
if (g_skipDefaultCons == 0)
|
||||||
{
|
{
|
||||||
i = kopen4loadfrommod("EDUKE.CON",1);
|
Bsprintf(g_scriptNamePtr,defaultconfile());
|
||||||
if (i!=-1)
|
|
||||||
{
|
|
||||||
Bsprintf(g_scriptNamePtr,"EDUKE.CON");
|
|
||||||
kclose(i);
|
|
||||||
}
|
|
||||||
else Bsprintf(g_scriptNamePtr,"GAME.CON");
|
|
||||||
}
|
}
|
||||||
C_Compile(g_scriptNamePtr);
|
C_Compile(g_scriptNamePtr);
|
||||||
}
|
}
|
||||||
|
@ -9541,7 +9570,11 @@ int32_t app_main(int32_t argc,const char **argv)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i = CONFIG_ReadSetup();
|
i = CONFIG_ReadSetup();
|
||||||
if (getenv("DUKE3DGRP")) g_grpNamePtr = getenv("DUKE3DGRP");
|
if (getenv("DUKE3DGRP"))
|
||||||
|
{
|
||||||
|
g_grpNamePtr = getenv("DUKE3DGRP");
|
||||||
|
initprintf("Using %s as main GRP file\n", g_grpNamePtr);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
@ -9649,12 +9682,13 @@ int32_t app_main(int32_t argc,const char **argv)
|
||||||
{
|
{
|
||||||
// overwrite the default GRP and CON so that if the user chooses
|
// overwrite the default GRP and CON so that if the user chooses
|
||||||
// something different, they get what they asked for
|
// something different, they get what they asked for
|
||||||
Bsprintf(defaultduke3dgrp, WW2GI ? "ww2gi.grp" : "nam.grp");
|
Bstrcpy(defaultduke3dgrp, WW2GI ? "ww2gi.grp" : "nam.grp");
|
||||||
Bsprintf(defaultduke3ddef, WW2GI ? "ww2gi.def" : "nam.def");
|
Bstrcpy(defsfilename, WW2GI ? "ww2gi.def" : "nam.def");
|
||||||
Bsprintf(defaultconfilename, WW2GI ? "ww2gi.con" : "nam.con");
|
// Bstrcpy(g_defNamePtr, WW2GI ? "ww2gi.def" : "nam.def");
|
||||||
|
Bstrcpy(defaultconfilename[0], WW2GI ? "ww2gi.con" : "nam.con");
|
||||||
|
|
||||||
Bsprintf(GametypeNames[0],"GRUNTMATCH (SPAWN)");
|
Bstrcpy(GametypeNames[0],"GRUNTMATCH (SPAWN)");
|
||||||
Bsprintf(GametypeNames[2],"GRUNTMATCH (NO SPAWN)");
|
Bstrcpy(GametypeNames[2],"GRUNTMATCH (NO SPAWN)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_modDir[0] != '/')
|
if (g_modDir[0] != '/')
|
||||||
|
@ -9804,6 +9838,15 @@ CLEAN_DIRECTORY:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getenv("DUKE3DDEF"))
|
||||||
|
{
|
||||||
|
g_defNamePtr = getenv("DUKE3DDEF");
|
||||||
|
g_skipDefaultDefs = 1;
|
||||||
|
initprintf("Using '%s' as definitions file\n", g_defNamePtr);
|
||||||
|
}
|
||||||
|
if (g_skipDefaultDefs == 0)
|
||||||
|
Bstrcpy(g_defNamePtr, defsfilename); // it MAY have changed, with NAM/WWII GI
|
||||||
|
|
||||||
flushlogwindow = 0;
|
flushlogwindow = 0;
|
||||||
loaddefinitions_game(g_defNamePtr, TRUE);
|
loaddefinitions_game(g_defNamePtr, TRUE);
|
||||||
// flushlogwindow = 1;
|
// flushlogwindow = 1;
|
||||||
|
|
|
@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define USERQUOTE_LEFTOFFSET 5
|
#define USERQUOTE_LEFTOFFSET 5
|
||||||
#define USERQUOTE_RIGHTOFFSET 14
|
#define USERQUOTE_RIGHTOFFSET 14
|
||||||
|
|
||||||
#define MAXCHEATLEN 20
|
|
||||||
#define NUMCHEATCODES (int32_t)(sizeof(CheatStrings)/sizeof(CheatStrings[0]))
|
|
||||||
|
|
||||||
enum GametypeFlags_t {
|
enum GametypeFlags_t {
|
||||||
GAMETYPE_COOP = 0x00000001,
|
GAMETYPE_COOP = 0x00000001,
|
||||||
GAMETYPE_WEAPSTAY = 0x00000002,
|
GAMETYPE_WEAPSTAY = 0x00000002,
|
||||||
|
@ -254,6 +251,7 @@ int32_t G_PrintGameText(int32_t f,int32_t tile,int32_t x,int32_t y,const char *t
|
||||||
int32_t GetTime(void);
|
int32_t GetTime(void);
|
||||||
int32_t _EnterText(int32_t small,int32_t x,int32_t y,char *t,int32_t dalen,int32_t c);
|
int32_t _EnterText(int32_t small,int32_t x,int32_t y,char *t,int32_t dalen,int32_t c);
|
||||||
int32_t kopen4loadfrommod(const char *filename,char searchfirst);
|
int32_t kopen4loadfrommod(const char *filename,char searchfirst);
|
||||||
|
char * defaultconfile(void);
|
||||||
int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
|
int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
|
||||||
extern inline int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits);
|
extern inline int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits);
|
||||||
int32_t startwin_run(void);
|
int32_t startwin_run(void);
|
||||||
|
|
|
@ -81,6 +81,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] =
|
||||||
{ CON_IFSERVER, 20100722 },
|
{ CON_IFSERVER, 20100722 },
|
||||||
{ CON_CALCHYPOTENUSE, 20100927 },
|
{ CON_CALCHYPOTENUSE, 20100927 },
|
||||||
{ CON_CLIPMOVENOSLIDE, 20101009 },
|
{ CON_CLIPMOVENOSLIDE, 20101009 },
|
||||||
|
{ CON_INCLUDEDEFAULT, 20110615 },
|
||||||
};
|
};
|
||||||
|
|
||||||
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
|
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
|
||||||
|
@ -559,6 +560,7 @@ const char *keyw[] =
|
||||||
"rayintersect", // 357
|
"rayintersect", // 357
|
||||||
"calchypotenuse", // 358
|
"calchypotenuse", // 358
|
||||||
"clipmovenoslide", // 359
|
"clipmovenoslide", // 359
|
||||||
|
"includedefault", // 360
|
||||||
"<null>"
|
"<null>"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1113,7 +1115,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
|
||||||
if ((intptr_t)script[i] < (intptr_t)&script[0] || (intptr_t)script[i] >= (intptr_t)&script[g_scriptSize])
|
if ((intptr_t)script[i] < (intptr_t)&script[0] || (intptr_t)script[i] >= (intptr_t)&script[g_scriptSize])
|
||||||
{
|
{
|
||||||
g_numCompilerErrors++;
|
g_numCompilerErrors++;
|
||||||
initprintf("Internal compiler error at %"PRIdPTR" (0x%"PRIxPTR")\n",i,i);
|
initprintf("Internal compiler error at %" PRIdPTR " (0x%" PRIxPTR ")\n",i,i);
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptptrs[i] = 1;
|
scriptptrs[i] = 1;
|
||||||
|
@ -2414,6 +2416,71 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case CON_INCLUDEDEFAULT:
|
||||||
|
C_SkipComments();
|
||||||
|
|
||||||
|
{
|
||||||
|
char * confile = defaultconfile();
|
||||||
|
|
||||||
|
int32_t temp_ScriptLineNumber;
|
||||||
|
int32_t temp_ifelse_check;
|
||||||
|
char *origtptr, *mptr;
|
||||||
|
char parentScriptFileName[255];
|
||||||
|
int32_t fp;
|
||||||
|
|
||||||
|
fp = kopen4loadfrommod(confile,g_loadFromGroupOnly);
|
||||||
|
if (fp < 0)
|
||||||
|
{
|
||||||
|
g_numCompilerErrors++;
|
||||||
|
initprintf("%s:%d: error: could not find file `%s'.\n",g_szScriptFileName,g_lineNumber,confile);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
j = kfilelength(fp);
|
||||||
|
|
||||||
|
mptr = (char *)Bmalloc(j+1);
|
||||||
|
if (!mptr)
|
||||||
|
{
|
||||||
|
kclose(fp);
|
||||||
|
g_numCompilerErrors++;
|
||||||
|
initprintf("%s:%d: error: could not allocate %d bytes to include `%s'.\n",
|
||||||
|
g_szScriptFileName,g_lineNumber,j,confile);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
initprintf("Including: %s (%d bytes)\n",confile, j);
|
||||||
|
kread(fp, mptr, j);
|
||||||
|
kclose(fp);
|
||||||
|
mptr[j] = 0;
|
||||||
|
|
||||||
|
if (*textptr == '"') // skip past the closing quote if it's there so we don't screw up the next line
|
||||||
|
textptr++;
|
||||||
|
origtptr = textptr;
|
||||||
|
|
||||||
|
Bstrcpy(parentScriptFileName, g_szScriptFileName);
|
||||||
|
Bstrcpy(g_szScriptFileName, confile);
|
||||||
|
temp_ScriptLineNumber = g_lineNumber;
|
||||||
|
g_lineNumber = 1;
|
||||||
|
temp_ifelse_check = g_checkingIfElse;
|
||||||
|
g_checkingIfElse = 0;
|
||||||
|
|
||||||
|
textptr = mptr;
|
||||||
|
|
||||||
|
C_SkipComments();
|
||||||
|
|
||||||
|
C_ParseCommand(1);
|
||||||
|
|
||||||
|
Bstrcpy(g_szScriptFileName, parentScriptFileName);
|
||||||
|
g_totalLines += g_lineNumber;
|
||||||
|
g_lineNumber = temp_ScriptLineNumber;
|
||||||
|
g_checkingIfElse = temp_ifelse_check;
|
||||||
|
|
||||||
|
textptr = origtptr;
|
||||||
|
|
||||||
|
Bfree(mptr);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
|
||||||
case CON_AI:
|
case CON_AI:
|
||||||
if (g_parsingActorPtr || g_processingState)
|
if (g_parsingActorPtr || g_processingState)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define LABEL_HASPARM2 1
|
#define LABEL_HASPARM2 1
|
||||||
#define LABEL_ISSTRING 2
|
#define LABEL_ISSTRING 2
|
||||||
|
|
||||||
|
#define MAXCHEATLEN 20
|
||||||
|
#define NUMCHEATCODES (int32_t)(sizeof(CheatStrings)/sizeof(CheatStrings[0]))
|
||||||
|
|
||||||
extern hashtable_t h_gamevars;
|
extern hashtable_t h_gamevars;
|
||||||
extern hashtable_t h_arrays;
|
extern hashtable_t h_arrays;
|
||||||
extern hashtable_t h_keywords;
|
extern hashtable_t h_keywords;
|
||||||
|
@ -162,8 +165,7 @@ enum ScriptError_t
|
||||||
WARNING_DUPLICATEDEFINITION,
|
WARNING_DUPLICATEDEFINITION,
|
||||||
WARNING_EVENTSYNC,
|
WARNING_EVENTSYNC,
|
||||||
WARNING_LABELSONLY,
|
WARNING_LABELSONLY,
|
||||||
WARNING_NAMEMATCHESVAR,
|
WARNING_NAMEMATCHESVAR
|
||||||
WARNING_REVEVENTSYNC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PlayerLabel_t
|
enum PlayerLabel_t
|
||||||
|
@ -931,6 +933,7 @@ enum ScriptKeywords_t
|
||||||
CON_RAYINTERSECT, // 357
|
CON_RAYINTERSECT, // 357
|
||||||
CON_CALCHYPOTENUSE, // 358
|
CON_CALCHYPOTENUSE, // 358
|
||||||
CON_CLIPMOVENOSLIDE, // 359
|
CON_CLIPMOVENOSLIDE, // 359
|
||||||
|
CON_INCLUDEDEFAULT, // 360
|
||||||
CON_END
|
CON_END
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -669,8 +669,7 @@ void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register
|
||||||
//Bsprintf(g_szBuf,"SGVI: %d ('%s') to %d for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer);
|
//Bsprintf(g_szBuf,"SGVI: %d ('%s') to %d for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer);
|
||||||
//AddLog(g_szBuf);
|
//AddLog(g_szBuf);
|
||||||
|
|
||||||
switch (aGameVars[id].dwFlags &
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
(GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
aGameVars[id].val.lValue=lValue;
|
aGameVars[id].val.lValue=lValue;
|
||||||
|
@ -780,8 +779,7 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
|
||||||
goto badvarid;
|
goto badvarid;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (aGameVars[id].dwFlags &
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
(GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
||||||
|
@ -813,8 +811,7 @@ wtf:
|
||||||
|
|
||||||
void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
|
void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
|
||||||
{
|
{
|
||||||
switch (aGameVars[id].dwFlags &
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
(GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
aGameVars[id].val.lValue=lValue;
|
aGameVars[id].val.lValue=lValue;
|
||||||
|
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifndef __gamevars_h__
|
#ifndef __gamevars_h__
|
||||||
#define __gamevars_h__
|
#define __gamevars_h__
|
||||||
|
|
||||||
|
#include "gamedef.h"
|
||||||
|
|
||||||
// store global game definitions
|
// store global game definitions
|
||||||
enum GamevarFlags_t {
|
enum GamevarFlags_t {
|
||||||
MAXGAMEVARS = 2048, // must be a power of two
|
MAXGAMEVARS = 2048, // must be a power of two
|
||||||
|
@ -43,6 +45,7 @@ enum GamevarFlags_t {
|
||||||
GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
|
GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
|
||||||
GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars
|
GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars
|
||||||
GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets
|
GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets
|
||||||
|
GAMEVAR_NONGLOBAL = (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR|GAMEVAR_SPECIAL|MAXGAMEVARS<<1),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GamearrayFlags_t {
|
enum GamearrayFlags_t {
|
||||||
|
@ -94,4 +97,221 @@ void Gv_RefreshPointers(void);
|
||||||
void Gv_ResetSystemDefaults(void);
|
void Gv_ResetSystemDefaults(void);
|
||||||
void Gv_ResetVars(void);
|
void Gv_ResetVars(void);
|
||||||
void Gv_WriteSave(FILE *fil,int32_t newbehav);
|
void Gv_WriteSave(FILE *fil,int32_t newbehav);
|
||||||
|
|
||||||
|
static inline void __fastcall Gv_AddVar(register int32_t id, register int32_t lValue)
|
||||||
|
{
|
||||||
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
aGameVars[id].val.lValue += lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_p] += lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERACTOR:
|
||||||
|
if ((unsigned)vm.g_i > MAXSPRITES-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_i] += lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_INTPTR:
|
||||||
|
*((int32_t *)aGameVars[id].val.lValue) += (int32_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_SHORTPTR:
|
||||||
|
*((int16_t *)aGameVars[id].val.lValue) += (int16_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_CHARPTR:
|
||||||
|
*((uint8_t *)aGameVars[id].val.lValue) +=(uint8_t)lValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __fastcall Gv_SubVar(register int32_t id, register int32_t lValue)
|
||||||
|
{
|
||||||
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
aGameVars[id].val.lValue -= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_p] -= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERACTOR:
|
||||||
|
if ((unsigned)vm.g_i > MAXSPRITES-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_i] -= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_INTPTR:
|
||||||
|
*((int32_t *)aGameVars[id].val.lValue) -= (int32_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_SHORTPTR:
|
||||||
|
*((int16_t *)aGameVars[id].val.lValue) -= (int16_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_CHARPTR:
|
||||||
|
*((uint8_t *)aGameVars[id].val.lValue) -=(uint8_t)lValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __fastcall Gv_MulVar(register int32_t id, register int32_t lValue)
|
||||||
|
{
|
||||||
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
aGameVars[id].val.lValue *= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_p] *= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERACTOR:
|
||||||
|
if ((unsigned)vm.g_i > MAXSPRITES-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_i] *= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_INTPTR:
|
||||||
|
*((int32_t *)aGameVars[id].val.lValue) *= (int32_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_SHORTPTR:
|
||||||
|
*((int16_t *)aGameVars[id].val.lValue) *= (int16_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_CHARPTR:
|
||||||
|
*((uint8_t *)aGameVars[id].val.lValue) *=(uint8_t)lValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __fastcall Gv_DivVar(register int32_t id, register int32_t lValue)
|
||||||
|
{
|
||||||
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
aGameVars[id].val.lValue /= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_p] /= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERACTOR:
|
||||||
|
if ((unsigned)vm.g_i > MAXSPRITES-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_i] /= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_INTPTR:
|
||||||
|
*((int32_t *)aGameVars[id].val.lValue) /= (int32_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_SHORTPTR:
|
||||||
|
*((int16_t *)aGameVars[id].val.lValue) /= (int16_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_CHARPTR:
|
||||||
|
*((uint8_t *)aGameVars[id].val.lValue) /=(uint8_t)lValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __fastcall Gv_ModVar(register int32_t id, register int32_t lValue)
|
||||||
|
{
|
||||||
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
aGameVars[id].val.lValue %= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_p] %= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERACTOR:
|
||||||
|
if ((unsigned)vm.g_i > MAXSPRITES-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_i] %= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_INTPTR:
|
||||||
|
*((int32_t *)aGameVars[id].val.lValue) %= (int32_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_SHORTPTR:
|
||||||
|
*((int16_t *)aGameVars[id].val.lValue) %= (int16_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_CHARPTR:
|
||||||
|
*((uint8_t *)aGameVars[id].val.lValue) %=(uint8_t)lValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __fastcall Gv_AndVar(register int32_t id, register int32_t lValue)
|
||||||
|
{
|
||||||
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
aGameVars[id].val.lValue &= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_p] &= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERACTOR:
|
||||||
|
if ((unsigned)vm.g_i > MAXSPRITES-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_i] &= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_INTPTR:
|
||||||
|
*((int32_t *)aGameVars[id].val.lValue) &= (int32_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_SHORTPTR:
|
||||||
|
*((int16_t *)aGameVars[id].val.lValue) &= (int16_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_CHARPTR:
|
||||||
|
*((uint8_t *)aGameVars[id].val.lValue) &=(uint8_t)lValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __fastcall Gv_XorVar(register int32_t id, register int32_t lValue)
|
||||||
|
{
|
||||||
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
aGameVars[id].val.lValue ^= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_p] ^= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERACTOR:
|
||||||
|
if ((unsigned)vm.g_i > MAXSPRITES-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_i] ^= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_INTPTR:
|
||||||
|
*((int32_t *)aGameVars[id].val.lValue) ^= (int32_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_SHORTPTR:
|
||||||
|
*((int16_t *)aGameVars[id].val.lValue) ^= (int16_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_CHARPTR:
|
||||||
|
*((uint8_t *)aGameVars[id].val.lValue) ^=(uint8_t)lValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __fastcall Gv_OrVar(register int32_t id, register int32_t lValue)
|
||||||
|
{
|
||||||
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
aGameVars[id].val.lValue |= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_p] |= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_PERACTOR:
|
||||||
|
if ((unsigned)vm.g_i > MAXSPRITES-1) return;
|
||||||
|
aGameVars[id].val.plValues[vm.g_i] |= lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_INTPTR:
|
||||||
|
*((int32_t *)aGameVars[id].val.lValue) |= (int32_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_SHORTPTR:
|
||||||
|
*((int16_t *)aGameVars[id].val.lValue) |= (int16_t)lValue;
|
||||||
|
return;
|
||||||
|
case GAMEVAR_CHARPTR:
|
||||||
|
*((uint8_t *)aGameVars[id].val.lValue) |=(uint8_t)lValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
// #define VULGARITY
|
// #define VULGARITY
|
||||||
|
|
||||||
const char *defsfilename = "duke3d.def";
|
char defsfilename[BMAX_PATH] = "duke3d.def";
|
||||||
|
|
||||||
#define COLOR_RED 248
|
#define COLOR_RED 248
|
||||||
#define COLOR_WHITE 31
|
#define COLOR_WHITE 31
|
||||||
|
|
|
@ -194,7 +194,8 @@ inline int32_t G_CheckPlayerInSector(int32_t sect)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
TRAVERSE_CONNECT(i)
|
TRAVERSE_CONNECT(i)
|
||||||
if (sprite[g_player[i].ps->i].sectnum == sect) return i;
|
if ((unsigned)g_player[i].ps->i < MAXSPRITES && sprite[g_player[i].ps->i].sectnum == sect)
|
||||||
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,38 +485,27 @@ int32_t G_ActivateWarpElevators(int32_t s,int32_t d) //Parm = sectoreffectornum
|
||||||
|
|
||||||
while (i >= 0)
|
while (i >= 0)
|
||||||
{
|
{
|
||||||
if (SLT == 17)
|
if (SLT == 17 && SHT == sprite[s].hitag)
|
||||||
if (SHT == sprite[s].hitag)
|
|
||||||
if ((klabs(sector[sn].floorz-actor[s].t_data[2]) > SP) ||
|
if ((klabs(sector[sn].floorz-actor[s].t_data[2]) > SP) ||
|
||||||
(sector[SECT].hitag == (sector[sn].hitag-d)))
|
(sector[SECT].hitag == (sector[sn].hitag-d)))
|
||||||
break;
|
break;
|
||||||
i = nextspritestat[i];
|
i = nextspritestat[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i==-1)
|
if (i == -1)
|
||||||
{
|
|
||||||
d = 0;
|
|
||||||
return 1; // No find
|
return 1; // No find
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
A_PlaySound(d ? ELEVATOR_ON : ELEVATOR_OFF, s);
|
||||||
if (d == 0)
|
|
||||||
A_PlaySound(ELEVATOR_OFF,s);
|
|
||||||
else A_PlaySound(ELEVATOR_ON,s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
i = headspritestat[STAT_EFFECTOR];
|
i = headspritestat[STAT_EFFECTOR];
|
||||||
while (i >= 0)
|
do
|
||||||
{
|
{
|
||||||
if (SLT == 17)
|
if (SLT == 17 && SHT == sprite[s].hitag)
|
||||||
if (SHT == sprite[s].hitag)
|
T1 = T2 = d; //Make all check warp
|
||||||
{
|
|
||||||
T1 = d;
|
|
||||||
T2 = d; //Make all check warp
|
|
||||||
}
|
|
||||||
i = nextspritestat[i];
|
i = nextspritestat[i];
|
||||||
}
|
}
|
||||||
|
while (i >= 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,8 +520,7 @@ void G_OperateSectors(int32_t sn, int32_t ii)
|
||||||
|
|
||||||
case 30:
|
case 30:
|
||||||
j = sector[sn].hitag;
|
j = sector[sn].hitag;
|
||||||
if (actor[j].tempang == 0 ||
|
if (actor[j].tempang == 0 || actor[j].tempang == 256)
|
||||||
actor[j].tempang == 256)
|
|
||||||
A_CallSound(sn,ii);
|
A_CallSound(sn,ii);
|
||||||
if (sprite[j].extra == 1)
|
if (sprite[j].extra == 1)
|
||||||
sprite[j].extra = 3;
|
sprite[j].extra = 3;
|
||||||
|
@ -548,8 +537,7 @@ void G_OperateSectors(int32_t sn, int32_t ii)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 26: //The split doors
|
case 26: //The split doors
|
||||||
i = GetAnimationGoal(&sptr->ceilingz);
|
if (GetAnimationGoal(&sptr->ceilingz) == -1) //if the door has stopped
|
||||||
if (i == -1) //if the door has stopped
|
|
||||||
{
|
{
|
||||||
g_haltSoundHack = 1;
|
g_haltSoundHack = 1;
|
||||||
sptr->lotag &= 0xff00;
|
sptr->lotag &= 0xff00;
|
||||||
|
|
|
@ -57,14 +57,17 @@ void S_SoundStartup(void)
|
||||||
initdata = (void *) win_gethwnd();
|
initdata = (void *) win_gethwnd();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
initprintf("Initializing sound...\n");
|
initprintf("Initializing sound... ");
|
||||||
|
|
||||||
if (FX_Init(fxdevicetype, ud.config.NumVoices, ud.config.NumChannels, ud.config.NumBits, ud.config.MixRate, initdata) != FX_Ok)
|
if (FX_Init(fxdevicetype, ud.config.NumVoices, ud.config.NumChannels, ud.config.NumBits, ud.config.MixRate, initdata) != FX_Ok)
|
||||||
{
|
{
|
||||||
initprintf("%s\n", FX_ErrorString(FX_Error));
|
initprintf("failed! %s\n", FX_ErrorString(FX_Error));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initprintf("%d voices, %d channels, %d-bit %dKHz\n", ud.config.NumVoices, ud.config.NumChannels,
|
||||||
|
ud.config.NumBits, ud.config.MixRate);
|
||||||
|
|
||||||
for (i=g_maxSoundPos; i >= 0 ; i--)
|
for (i=g_maxSoundPos; i >= 0 ; i--)
|
||||||
{
|
{
|
||||||
int32_t j = MAXSOUNDINSTANCES-1;
|
int32_t j = MAXSOUNDINSTANCES-1;
|
||||||
|
|
Loading…
Reference in a new issue