diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 989e2d10d..4ee25814c 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -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 diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index c3a85a491..c1e579d02 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -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 diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index a80e4f476..ec6b0b5e5 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -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++) { diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index e0f952c28..2e6c8aa4e 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -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(); diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 7b51dbc25..3856b0688 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -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 : compiles one or more M32 script files", osdcmd_include); + OSD_RegisterFunction("include", "include : 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; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 7a09b7f8c..32fe390b6 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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; diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 6f8f3d42d..405f44b2c 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -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]; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 02c6fbb66..f60cb5f17 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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) diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index e2eb39ec3..a8ec67c0b 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -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); - } + A_PlaySound(GLASS_BREAKING,i); + A_SpawnWallGlass(i,-1,5); + deletesprite(i); break; case TOILET__STATIC: