From a66440c90808b00a4919fdda09a2c4301dddfdc7 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 26 Jul 2006 01:10:33 +0000 Subject: [PATCH] A few cleanups We're also no longer using upx -9 in MakeDistributions, because it breaks binaries git-svn-id: https://svn.eduke32.com/eduke32@249 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/build.h | 1 - polymer/build/src/defs.c | 46 -------- polymer/eduke32/MakeDistributions | 2 +- polymer/eduke32/source/astub.c | 70 ++++++++++++ polymer/eduke32/source/config.c | 4 +- polymer/eduke32/source/game.c | 181 +++++++++++++++++++----------- 6 files changed, 188 insertions(+), 116 deletions(-) diff --git a/polymer/build/include/build.h b/polymer/build/include/build.h index c0ed07520..6f6a551c1 100644 --- a/polymer/build/include/build.h +++ b/polymer/build/include/build.h @@ -497,7 +497,6 @@ int md_undefinetile(int tile); int md_undefinemodel(int modelid); int loaddefinitionsfile(char *fn); -int loadgroupfiles(char *fn); extern long mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy long loadoldboard(char *filename, char fromwhere, long *daposx, long *daposy, long *daposz, short *daang, short *dacursectnum); diff --git a/polymer/build/src/defs.c b/polymer/build/src/defs.c index bfd3e6375..f8f759244 100644 --- a/polymer/build/src/defs.c +++ b/polymer/build/src/defs.c @@ -1161,50 +1161,4 @@ int loaddefinitionsfile(char *fn) return 0; } -static int defsparserpassone(scriptfile *script) -{ - int tokn; - char *cmdtokptr; - while (1) { - tokn = getatoken(script,basetokens,sizeof(basetokens)/sizeof(tokenlist)); - cmdtokptr = script->ltextptr; - switch (tokn) { - case T_LOADGRP: - { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - int j = initgroupfile(fn); - - if( j == -1 ) - initprintf("Could not find GRP file %s.\n",fn); - else - initprintf("Using GRP file %s.\n",fn); - } - } - break; - case T_EOF: - return(0); - default: - break; - } - } - return 0; -} - -int loadgroupfiles(char *fn) -{ - scriptfile *script; - - script = scriptfile_fromfile(fn); - if (!script) return -1; - - defsparserpassone(script); - - scriptfile_close(script); - scriptfile_clearsymbols(); - - return 0; -} - // vim:ts=4: diff --git a/polymer/eduke32/MakeDistributions b/polymer/eduke32/MakeDistributions index cccefa0c0..9ab06fc93 100644 --- a/polymer/eduke32/MakeDistributions +++ b/polymer/eduke32/MakeDistributions @@ -38,7 +38,7 @@ source: binary: make RELEASE=1 - upx -9 mapster32.exe eduke32.exe duke3d_w32.exe setup.exe + upx mapster32.exe eduke32.exe duke3d_w32.exe setup.exe rm -rf $(binarydir) mkdir $(binarydir) # mkdir $(binarydir) $(binarydir)/models diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index f063cd761..0b646b2f6 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -39,6 +39,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) #include "keys.h" #include "types.h" #include "keyboard.h" +#include "scriptfile.h" #define VERSION " 1.0.6" @@ -4006,6 +4007,75 @@ int osdcmd_quit(const osdfuncparm_t *parm) return OSDCMD_OK; } +enum { + T_EOF = -2, + T_ERROR = -1, + T_LOADGRP = 0, +}; + +typedef struct { char *text; int tokenid; } tokenlist; + +static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens) +{ + char *tok; + int i; + + if (!sf) return T_ERROR; + tok = scriptfile_gettoken(sf); + if (!tok) return T_EOF; + + for(i=0;iltextptr; + switch (tokn) { + case T_LOADGRP: + { + char *fn; + if (!scriptfile_getstring(script,&fn)) + { + int j = initgroupfile(fn); + + if( j == -1 ) + initprintf("Could not find GRP file %s.\n",fn); + else + initprintf("Using GRP file %s.\n",fn); + } + } + break; + case T_EOF: + return(0); + default: + break; + } + } + + scriptfile_close(script); + scriptfile_clearsymbols(); + + return 0; +} + int ExtInit(void) { long rv = 0; diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 2d7ec3f30..807513a41 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -587,7 +587,7 @@ int32 CONFIG_ReadSetup( void ) setupread = 1; - if (SafeFileExists(setupfilename)) // JBF 20031211 + if (SafeFileExists(setupfilename) && scripthandle < 0) // JBF 20031211 scripthandle = SCRIPT_Load( setupfilename ); if (scripthandle < 0) return -1; @@ -662,7 +662,6 @@ int32 CONFIG_ReadSetup( void ) dummy = usehightile; SCRIPT_GetNumber( scripthandle, "Screen Setup", "UseHightile",&dummy); usehightile = dummy != 0; SCRIPT_GetNumber( scripthandle, "Misc", "Executions",&ud.executions); - ud.executions++; SCRIPT_GetNumber( scripthandle, "Setup", "ForceSetup",&ForceSetup); SCRIPT_GetNumber( scripthandle, "Misc", "RunMode",&RunMode); SCRIPT_GetNumber( scripthandle, "Misc", "Crosshairs",&ud.crosshair); @@ -765,6 +764,7 @@ void CONFIG_WriteSetup( void ) SCRIPT_PutNumber( scripthandle, "Misc", "Color",ud.color,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "Crosshairs",ud.crosshair,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "DemoCams",ud.democams,false,false); + ud.executions++; SCRIPT_PutNumber( scripthandle, "Misc", "Executions",ud.executions,false,false); SCRIPT_PutNumber( scripthandle, "Setup", "ForceSetup",ForceSetup,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "IDPlayers",ud.idplayers,false,false); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 6590fb60a..80d19ff4d 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -45,7 +45,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "util_lib.h" -#define VERSION " 1.4.0svn" +#define VERSION " 1.4.0 beta 2.1" #define HEAD "EDuke32"VERSION" (shareware mode)" #define HEAD2 "EDuke32"VERSION @@ -77,6 +77,73 @@ static char **netparam = NULL; int votes[MAXPLAYERS], gotvote[MAXPLAYERS], voting = -1; +int recfilep,totalreccnt; +char debug_on = 0,actor_tog = 0,*rtsptr,memorycheckoveride=0; + +extern char syncstate; +extern int32 numlumps; + +FILE *frecfilep = (FILE *)NULL; +void pitch_test( void ); + +char restorepalette,screencapt,nomorelogohack; +int sendmessagecommand = -1; + +char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp"; +char *duke3dgrp = defaultduke3dgrp; +static char *duke3ddef = "duke3d.def"; + +extern long lastvisinc; + +// JBF 20031221: These ought to disappear when things mature +extern int showmultidiags; +extern int netmode, nethostplayers; +extern char netjoinhost[64]; +int startupnetworkgame(void); +int processnetworkrequests(void); + +char colstrip[1024]; + +int shareware = 0; +int gametype = 0; + +#define MAXUSERQUOTES 4 +long quotebot, quotebotgoal; +short user_quote_time[MAXUSERQUOTES]; +char user_quote[MAXUSERQUOTES][178]; +// char typebuflen,typebuf[41]; + +long tempwallptr; + +long nonsharedtimer; + +enum { + T_EOF = -2, + T_ERROR = -1, + T_INTERFACE = 0, + T_LOADGRP = 0, + T_MODE = 1, + T_ALLOW +}; + +typedef struct { char *text; int tokenid; } tokenlist; + +static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens) +{ + char *tok; + int i; + + if (!sf) return T_ERROR; + tok = scriptfile_gettoken(sf); + if (!tok) return T_EOF; + + for(i=0;iltextptr; switch (tokn) { case T_INTERFACE: @@ -7722,6 +7729,51 @@ static int stringsort(const char *p1, const char *p2) return Bstrcmp(&p1[0],&p2[0]); } +static tokenlist grptokens[] = + { + { "loadgrp", T_LOADGRP }, + }; + +int loadgroupfiles(char *fn) +{ + int tokn; + char *cmdtokptr; + scriptfile *script; + + script = scriptfile_fromfile(fn); + if (!script) return -1; + + while (1) { + tokn = getatoken(script,grptokens,sizeof(grptokens)/sizeof(tokenlist)); + cmdtokptr = script->ltextptr; + switch (tokn) { + case T_LOADGRP: + { + char *fn; + if (!scriptfile_getstring(script,&fn)) + { + int j = initgroupfile(fn); + + if( j == -1 ) + initprintf("Could not find GRP file %s.\n",fn); + else + initprintf("Using GRP file %s.\n",fn); + } + } + break; + case T_EOF: + return(0); + default: + break; + } + } + + scriptfile_close(script); + scriptfile_clearsymbols(); + + return 0; +} + void checkcommandline(int argc,char **argv) { short i, j; @@ -8797,9 +8849,6 @@ void backtomenu(void) KB_FlushKeyboardQueue(); } -int shareware = 0; -int gametype = 0; - int load_script(char *szScript) { FILE* fp = fopenfrompath(szScript, "r");