My first commit!

The main feature is the addition of -mx and -mh command-line parameters to EDuke32 and Mapster32. These parameters include a con and def "module" respectively. This translates into essentially including the file from the bottom of the compiled script.

I fixed the classic buggy behavior of the BROKEHYDROPLANT and REACTOR2 sprites.

I also fixed a small, long-standing bug where FRAMEEFFECT1 blurs are not affected by sector floorpal. You can see one example of this by shrinking the Enforcer on the upper inside of the toppled building in E3L11: Freeway.

I tweaked the Makefile so that it would automatically regenerate the keep.me files in the $(OBJ) and $(EOBJ) directories after they are deleted for cleaning.

One final change is a slight positioning cleanup of both programs' --help dialog boxes.

git-svn-id: https://svn.eduke32.com/eduke32@1937 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2011-07-21 22:39:29 +00:00
parent 049cc20022
commit 8b5761c14d
9 changed files with 304 additions and 263 deletions

View file

@ -313,6 +313,8 @@ $(RSRC)/editor_banner.c: $(RSRC)/build.bmp
clean:
-rm -f $(OBJ)/* eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) core* duke3d_w32$(EXESUFFIX) && $(MAKE) -C $(JAUDIOLIBDIR) clean && $(MAKE) -C $(ENETDIR) clean
echo "" > $(OBJ)/keep.me
veryclean: clean
-rm -f $(EOBJ)/* $(RSRC)/*banner*
echo "" > $(EOBJ)/keep.me

View file

@ -758,6 +758,9 @@ int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, i
extern char defsfilename[BMAX_PATH];
extern char *g_defNamePtr;
extern char **g_defModules;
extern int g_defModulesNum;
#ifdef USE_OPENGL
typedef struct

View file

@ -566,6 +566,10 @@ int32_t app_main(int32_t argc, const char **argv)
if (!loaddefinitionsfile(g_defNamePtr))
initprintf("Definitions file loaded.\n");
for (i=0; i < g_defModulesNum; ++i)
Bfree (g_defModules[i]);
Bfree (g_defModules);
k = 0;
for (i=0; i<256; i++)
{

View file

@ -117,6 +117,28 @@ static const char *skyfaces[6] =
"left face", "top face", "bottom face"
};
static int32_t defsparser(scriptfile *script);
static void defsparser_include(const char *fn, scriptfile *script, char *cmdtokptr)
{
scriptfile *included;
included = scriptfile_fromfile(fn);
if (!included)
{
if (!Bstrcasecmp(cmdtokptr,"null"))
initprintf("Warning: Failed including %s as module\n", fn);
else
initprintf("Warning: Failed including %s on line %s:%d\n",
fn, script->filename,scriptfile_getlinum(script,cmdtokptr));
}
else
{
defsparser(included);
scriptfile_close(included);
}
}
static int32_t defsparser(scriptfile *script)
{
int32_t tokn;
@ -192,38 +214,12 @@ static int32_t defsparser(scriptfile *script)
{
char *fn;
if (!scriptfile_getstring(script,&fn))
{
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
{
defsparser(included);
scriptfile_close(included);
}
}
defsparser_include(fn, script, cmdtokptr);
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);
}
defsparser_include(defsfilename, script, cmdtokptr);
break;
}
case T_DEFINE:
@ -1970,6 +1966,7 @@ int32_t loaddefinitionsfile(const char *fn)
{
scriptfile *script;
int32_t f = flushlogwindow;
int32_t i;
script = scriptfile_fromfile(fn);
if (!script) return -1;
@ -1979,6 +1976,9 @@ int32_t loaddefinitionsfile(const char *fn)
flushlogwindow = 0;
defsparser(script);
for (i=0; i < g_defModulesNum; ++i)
defsparser_include(g_defModules[i], NULL, "null");
flushlogwindow = f;
scriptfile_close(script);
scriptfile_clearsymbols();

View file

@ -94,6 +94,11 @@ static char *gamecon = "\0";
static int32_t g_skipDefaultCons = 0;
static int32_t g_skipDefaultDefs = 0; // primarily for NAM/WWII GI appeasement
char **g_scriptModules = NULL;
int g_scriptModulesNum = 0;
char **g_defModules = NULL;
int g_defModulesNum = 0;
#pragma pack(push,1)
sound_t g_sounds[MAXSOUNDS];
#pragma pack(pop)
@ -8340,22 +8345,24 @@ void ExtPreSaveMap(void)
static void G_ShowParameterHelp(void)
{
const char *s = "Usage: mapster32 [OPTIONS] [FILE]\n\n"
"-gFILE, -grp FILE Use extra group file FILE\n"
"-hFILE Use definitions file FILE\n"
"-xFILE Use FILE instead of GAME.CON for getting sound definitions\n"
"-gFILE, -grp FILE\tUse extra group file FILE\n"
"-hFILE\t\tUse definitions file FILE\n"
"-xFILE\t\tUse FILE instead of GAME.CON for getting sound definitions\n"
"-mh FILE\t\tInclude additional definitions module FILE\n"
"-mx FILE\t\tInclude additional CON module FILE for getting sound definitions\n"
"-jDIR, -game_dir DIR\n"
" Adds DIR to the file path stack\n"
"-cachesize # Sets cache size, in Kb\n"
"-check Enables map pointer checking when saving\n"
"-namesfile FILE Uses FILE instead of NAMES.H for tile names\n"
"-nocheck Disables map pointer checking when saving (default)\n" // kept for script compat
"\t\tAdds DIR to the file path stack\n"
"-cachesize #\tSets cache size, in Kb\n"
"-check\t\tEnables map pointer checking when saving\n"
"-namesfile FILE\tUses FILE instead of NAMES.H for tile names\n"
"-nocheck\t\tDisables map pointer checking when saving (default)\n" // kept for script compat
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
"-setup Displays the configuration dialog\n"
"-setup\t\tDisplays the configuration dialog\n"
#endif
#if !defined(_WIN32)
"-usecwd Read game data and configuration file from working directory\n"
"-usecwd\t\tRead game data and configuration file from working directory\n"
#endif
"\n-?, -help, --help Display this help message and exit"
"\n-?, -help, --help\tDisplay this help message and exit"
;
Bsprintf(tempbuf, "Mapster32 %s %s", VERSION, s_buildRev);
wm_msgbox(tempbuf, "%s", s);
@ -8534,6 +8541,32 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
i++;
continue;
}
if (!Bstrcasecmp(c+1,"mx"))
{
if (argc > i+1)
{
g_scriptModules = (char **) Brealloc (g_scriptModules, (g_scriptModulesNum+1) * sizeof(char *));
g_scriptModules[g_scriptModulesNum] = Bmalloc(Bstrlen((char *)argv[i+1]) + 1);
Bstrcpy(g_scriptModules[g_scriptModulesNum], (char *)argv[i+1]);
++g_scriptModulesNum;
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"mh"))
{
if (argc > i+1)
{
g_defModules = (char **) Brealloc (g_defModules, (g_defModulesNum+1) * sizeof(char *));
g_defModules[g_defModulesNum] = Bmalloc(Bstrlen((char *)argv[i+1]) + 1);
Bstrcpy(g_defModules[g_defModulesNum], (char *)argv[i+1]);
++g_defModulesNum;
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"nm") || !Bstrcasecmp(c+1,"ns"))
{
COPYARG(i);
@ -9288,7 +9321,7 @@ static int32_t registerosdcommands(void)
#endif
// M32 script
OSD_RegisterFunction("include", "include <filnames...>: compiles one or more M32 script files", osdcmd_include);
OSD_RegisterFunction("include", "include <filenames...>: compiles one or more M32 script files", osdcmd_include);
OSD_RegisterFunction("do", "do (m32 script ...): executes M32 script statements", osdcmd_do);
OSD_RegisterFunction("script_info", "script_info: shows information about compiled M32 script", osdcmd_scriptinfo);
OSD_RegisterFunction("script_expertmode", "script_expertmode: toggles M32 script expert mode", osdcmd_vars_pk);
@ -9508,6 +9541,28 @@ static void DoAutoload(const char *fn)
}
}
int32_t parsegroupfiles(scriptfile *script);
void parsegroupfiles_include(const char *fn, scriptfile *script, char *cmdtokptr)
{
scriptfile *included;
included = scriptfile_fromfile(fn);
if (!included)
{
if (!Bstrcasecmp(cmdtokptr,"null"))
initprintf("Warning: Failed including %s as module\n", fn);
else
initprintf("Warning: Failed including %s on line %s:%d\n",
fn, script->filename,scriptfile_getlinum(script,cmdtokptr));
}
else
{
parsegroupfiles(included);
scriptfile_close(included);
}
}
int32_t parsegroupfiles(scriptfile *script)
{
int32_t tokn;
@ -9555,39 +9610,13 @@ int32_t parsegroupfiles(scriptfile *script)
{
char *fn;
if (!scriptfile_getstring(script,&fn))
{
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
{
parsegroupfiles(included);
scriptfile_close(included);
}
}
parsegroupfiles_include(fn, script, cmdtokptr);
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);
}
parsegroupfiles_include(defsfilename, script, cmdtokptr);
break;
}
break;
@ -9606,12 +9635,16 @@ int32_t parsegroupfiles(scriptfile *script)
int32_t loadgroupfiles(const char *fn)
{
scriptfile *script;
int32_t i;
script = scriptfile_fromfile(fn);
if (!script) return -1;
parsegroupfiles(script);
for (i=0; i < g_defModulesNum; ++i)
parsegroupfiles_include(g_defModules[i], NULL, "null");
scriptfile_close(script);
scriptfile_clearsymbols();
@ -9963,6 +9996,34 @@ static int32_t loadtilegroups(const char *fn)
}
/// vvv Parse CON files partially to get sound definitions
static int32_t parseconsounds(scriptfile *script);
static void parseconsounds_include(const char *fn, scriptfile *script, char *cmdtokptr)
{
scriptfile *included;
included = scriptfile_fromfile(fn);
if (!included)
{
if (!Bstrcasecmp(cmdtokptr,"null"))
initprintf("Warning: Failed including %s as module\n", fn);
else
initprintf("Warning: Failed including %s on line %s:%d\n",
fn, script->filename,scriptfile_getlinum(script,cmdtokptr));
}
else
{
parseconsounds(included);
scriptfile_close(included);
/*
// why?
int32_t tmp = parseconsounds(included);
scriptfile_close(included);
if (tmp < 0) return tmp;
*/
}
}
static int32_t parseconsounds(scriptfile *script)
{
int32_t tokn;
@ -9990,41 +10051,12 @@ static int32_t parseconsounds(scriptfile *script)
{
char *fn;
if (!scriptfile_getstring(script,&fn))
{
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;
}
}
parseconsounds_include(fn, script, cmdtokptr);
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;
}
parseconsounds_include(defaultgameconfile(), script, cmdtokptr);
break;
}
case T_DEFINE:
@ -10142,7 +10174,7 @@ END:
static int32_t loadconsounds(const char *fn)
{
scriptfile *script;
int32_t ret;
int32_t ret, i;
initprintf("Loading sounds from '%s'\n",fn);
@ -10153,6 +10185,14 @@ static int32_t loadconsounds(const char *fn)
return -1;
}
ret = parseconsounds(script);
for (i=0; i < g_scriptModulesNum; ++i)
{
parseconsounds_include(g_scriptModules[i], NULL, "null");
Bfree(g_scriptModules[i]);
}
Bfree(g_scriptModules);
if (ret < 0)
initprintf("There was an error parsing '%s'.\n", fn);
else if (ret == 0)
@ -10297,8 +10337,7 @@ int32_t ExtInit(void)
if (g_defNamePtr != defsfilename)
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
loadgroupfiles(g_defNamePtr); // the defs are actually loaded in app_main in build.c
{
struct strllist *s;

View file

@ -125,6 +125,11 @@ char *g_scriptNamePtr = defaultconfilename[0];
char *g_gameNamePtr = NULL;
char *g_rtsNamePtr = NULL;
char **g_scriptModules = NULL;
int g_scriptModulesNum = 0;
char **g_defModules = NULL;
int g_defModulesNum = 0;
extern int32_t lastvisinc;
int32_t g_Shareware = 0;
@ -6614,9 +6619,6 @@ skip:
case WATERSPLASH2__STATIC:
t->picnum = WATERSPLASH2+t1;
break;
case REACTOR2__STATIC:
t->picnum = s->picnum + T3;
break;
case SHELL__STATIC:
t->picnum = s->picnum+(T1&1);
case SHOTGUNSHELL__STATIC:
@ -6641,7 +6643,11 @@ skip:
if (!actor[s->owner].dispicnum)
t->picnum = actor[i].t_data[1];
else t->picnum = actor[s->owner].dispicnum;
t->pal = sprite[s->owner].pal;
if (sector[t->sectnum].floorpal && sector[t->sectnum].floorpal < g_numRealPalettes && !A_CheckSpriteFlags(s->owner,SPRITE_NOPAL))
t->pal = sector[t->sectnum].floorpal;
else t->pal = sprite[s->owner].pal;
t->shade = sprite[s->owner].shade;
t->ang = sprite[s->owner].ang;
t->cstat = 2|sprite[s->owner].cstat;
@ -7940,6 +7946,8 @@ static void G_ShowParameterHelp(void)
"-j[dir]\t\tAdds a directory to EDuke32's search list\n"
"-l#\t\tWarp to level #, see -v\n"
"-map [file.map]\tLoads a map\n"
"-mh [file.def]\tInclude an additional def module\n"
"-mx [file.con]\tInclude an additional CON script module\n"
"-m\t\tDisable monsters\n"
"-nam\t\tRun in NAM/NAPALM compatibility mode\n"
"-rts [file.rts]\tLoad custom Remote Ridicule sound bank\n"
@ -7980,7 +7988,7 @@ static void G_ShowDebugHelp(void)
"-name [name]\tPlayer name in multiplay\n"
"-nD\t\tDump default gamevars to gamevars.txt\n"
"-noautoload\tDisable loading content from autoload dir\n"
"-nodinput\tDisable DirectInput (joystick) support\n"
"-nodinput\t\tDisable DirectInput (joystick) support\n"
"-nologo\t\tSkip the logo anim\n"
"-ns/-nm\t\tDisable sound or music\n"
"-q#\t\tFake multiplayer with # (2-8) players\n"
@ -8123,6 +8131,33 @@ static int32_t S_DefineMusic(char *ID,char *name)
return 0;
}
static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload);
static void parsedefinitions_game_include(const char *fn, scriptfile *script, char *cmdtokptr, const int32_t preload)
{
scriptfile *included = scriptfile_fromfile(fn);
if (!included)
{
if (!Bstrcasecmp(cmdtokptr,"null") || script == NULL) // this is a bit overboard to prevent unused parameter warnings
{
// initprintf("Warning: Failed including %s as module\n", fn);
}
/*
else
{
initprintf("Warning: Failed including %s on line %s:%d\n",
fn, script->filename,scriptfile_getlinum(script,cmdtokptr));
}
*/
}
else
{
parsedefinitions_game(included, preload);
scriptfile_close(included);
}
}
static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload)
{
int32_t tokn;
@ -8187,36 +8222,12 @@ static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload)
{
char *fn;
if (!scriptfile_getstring(script,&fn))
{
scriptfile *included = scriptfile_fromfile(fn);
if (!included)
{
// initprintf("Warning: Failed including %s on line %s:%d\n",
// fn, script->filename,scriptfile_getlinum(script,cmdtokptr));
}
else
{
parsedefinitions_game(included, preload);
scriptfile_close(included);
}
}
parsedefinitions_game_include(fn, script, cmdtokptr, preload);
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);
}
parsedefinitions_game_include(defsfilename, script, cmdtokptr, preload);
break;
}
case T_NOAUTOLOAD:
@ -8340,12 +8351,16 @@ static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload)
static int32_t loaddefinitions_game(const char *fn, int32_t preload)
{
scriptfile *script;
int32_t i;
script = scriptfile_fromfile((char *)fn);
if (!script) return -1;
parsedefinitions_game(script, preload);
for (i=0; i < g_defModulesNum; ++i)
parsedefinitions_game_include(g_defModules[i], NULL, "null", preload);
scriptfile_close(script);
scriptfile_clearsymbols();
@ -8621,6 +8636,32 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
i++;
continue;
}
if (!Bstrcasecmp(c+1,"mx"))
{
if (argc > i+1)
{
g_scriptModules = (char **) Brealloc (g_scriptModules, (g_scriptModulesNum+1) * sizeof(char *));
g_scriptModules[g_scriptModulesNum] = Bmalloc(Bstrlen((char *)argv[i+1]) + 1);
Bstrcpy(g_scriptModules[g_scriptModulesNum], (char *)argv[i+1]);
++g_scriptModulesNum;
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"mh"))
{
if (argc > i+1)
{
g_defModules = (char **) Brealloc (g_defModules, (g_defModulesNum+1) * sizeof(char *));
g_defModules[g_defModulesNum] = Bmalloc(Bstrlen((char *)argv[i+1]) + 1);
Bstrcpy(g_defModules[g_defModulesNum], (char *)argv[i+1]);
++g_defModulesNum;
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"condebug"))
{
g_scriptDebug = 1;
@ -10071,6 +10112,10 @@ CLEAN_DIRECTORY:
loaddefinitions_game(g_defNamePtr, FALSE);
}
for (i=0; i < g_defModulesNum; ++i)
Bfree (g_defModules[i]);
Bfree (g_defModules);
if (numplayers == 1 && boardfilename[0] != 0)
{
ud.m_level_number = 7;

View file

@ -179,12 +179,13 @@ extern cactype cac[];
// this is checked against http://eduke32.com/VERSION
extern const char *s_buildDate;
extern char *g_grpNamePtr;
extern char *g_defNamePtr;
extern char *g_gameNamePtr;
extern char *g_gameNamePtr;
extern char *g_grpNamePtr;
extern char *g_grpNamePtr;
extern char *g_scriptNamePtr;
extern char *g_gameNamePtr;
extern char *g_rtsNamePtr;
extern char **g_scriptModules;
extern int g_scriptModulesNum;
extern char CheatStrings[][MAXCHEATLEN];
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
extern char boardfilename[BMAX_PATH];

View file

@ -1858,6 +1858,67 @@ static int32_t C_CountCaseStatements()
return lCount;
}
static void C_Include(const char *confile)
{
int32_t temp_ScriptLineNumber;
int32_t temp_ifelse_check;
int32_t j;
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);
return;
}
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);
return;
}
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);
}
static int32_t C_ParseCommand(int32_t loop)
{
int32_t i, j=0, k=0, tw, otw;
@ -2358,129 +2419,12 @@ static int32_t C_ParseCommand(int32_t loop)
}
tempbuf[j] = '\0';
{
int32_t temp_ScriptLineNumber;
int32_t temp_ifelse_check;
char *origtptr, *mptr;
char parentScriptFileName[255];
int32_t fp;
fp = kopen4loadfrommod(tempbuf,g_loadFromGroupOnly);
if (fp < 0)
{
g_numCompilerErrors++;
initprintf("%s:%d: error: could not find file `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf);
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,tempbuf);
continue;
}
initprintf("Including: %s (%d bytes)\n",tempbuf, 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, tempbuf);
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);
}
C_Include(tempbuf);
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);
}
C_Include(defaultconfile());
continue;
case CON_AI:
@ -5844,6 +5788,13 @@ void C_Compile(const char *filenam)
C_ParseCommand(1);
for (i=0; i < g_scriptModulesNum; ++i)
{
C_Include(g_scriptModules[i]);
Bfree(g_scriptModules[i]);
}
Bfree(g_scriptModules);
flushlogwindow = 1;
if (g_numCompilerErrors > 63)

View file

@ -2181,13 +2181,9 @@ void A_DamageObject(int32_t i,int32_t sn)
break;
case BROKEHYDROPLANT__STATIC:
if (CS&1)
{
A_PlaySound(GLASS_BREAKING,i);
SZ += 16<<8;
CS = 0;
A_SpawnWallGlass(i,-1,5);
}
deletesprite(i);
break;
case TOILET__STATIC: