diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index d41e00f79..a91a770f0 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -147,6 +147,36 @@ static inline long GetTime(void) return totalclock; } +static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL; +static int numdirs=0, numfiles=0; +static int currentlist=0; + +static void clearfilenames(void) +{ + klistfree(finddirs); + klistfree(findfiles); + finddirs = findfiles = NULL; + numfiles = numdirs = 0; +} + +static int getfilenames(const char *path, char kind[]) +{ + CACHE1D_FIND_REC *r; + + clearfilenames(); + finddirs = klistpath(path,"*",CACHE1D_FIND_DIR); + findfiles = klistpath(path,kind,CACHE1D_FIND_FILE); + for (r = finddirs; r; r=r->next) numdirs++; + for (r = findfiles; r; r=r->next) numfiles++; + + finddirshigh = finddirs; + findfileshigh = findfiles; + currentlist = 0; + if (findfileshigh) currentlist = 1; + + return(0); +} + void ExtLoadMap(const char *mapname) { long i; @@ -4528,6 +4558,23 @@ int ExtInit(void) } initgroupfile(duke3dgrp); + Bsprintf(tempbuf,"autoload/%s",duke3dgrp); + getfilenames(tempbuf,"*.grp"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + Bsprintf(tempbuf,"autoload/%s",duke3dgrp); + getfilenames(tempbuf,"*.zip"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + Bsprintf(tempbuf,"autoload/%s",duke3dgrp); + getfilenames(tempbuf,"*.pk3"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + + getfilenames("autoload","*.grp"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + getfilenames("autoload","*.zip"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + getfilenames("autoload","*.pk3"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + if (getenv("DUKE3DDEF")) { defsfilename = getenv("DUKE3DDEF"); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 193ab53e8..8970f5435 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9672,6 +9672,36 @@ int load_script(const char *szScript) return 1; } +static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL; +static int numdirs=0, numfiles=0; +static int currentlist=0; + +static void clearfilenames(void) +{ + klistfree(finddirs); + klistfree(findfiles); + finddirs = findfiles = NULL; + numfiles = numdirs = 0; +} + +static int getfilenames(const char *path, char kind[]) +{ + CACHE1D_FIND_REC *r; + + clearfilenames(); + finddirs = klistpath(path,"*",CACHE1D_FIND_DIR); + findfiles = klistpath(path,kind,CACHE1D_FIND_FILE); + for (r = finddirs; r; r=r->next) numdirs++; + for (r = findfiles; r; r=r->next) numfiles++; + + finddirshigh = finddirs; + findfileshigh = findfiles; + currentlist = 0; + if (findfileshigh) currentlist = 1; + + return(0); +} + void app_main(int argc,char **argv) { int i, j; @@ -9899,8 +9929,28 @@ void app_main(int argc,char **argv) Bsprintf(gametype_names[2],"GRUNTMATCH (NO SPAWN)"); } - initprintf("Main GRP file: %s.\n", duke3dgrp); - initgroupfile(duke3dgrp); + + if (initgroupfile(duke3dgrp) == -1) + initprintf("Warning: could not find group file '%s'.\n",duke3dgrp); + else initprintf("Using group file '%s' as main group file.\n", duke3dgrp); + + Bsprintf(tempbuf,"autoload/%s",duke3dgrp); + getfilenames(tempbuf,"*.grp"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + Bsprintf(tempbuf,"autoload/%s",duke3dgrp); + getfilenames(tempbuf,"*.zip"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + Bsprintf(tempbuf,"autoload/%s",duke3dgrp); + getfilenames(tempbuf,"*.pk3"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + + getfilenames("autoload","*.grp"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + getfilenames("autoload","*.zip"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + getfilenames("autoload","*.pk3"); + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + loadgroupfiles(duke3ddef); { diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 29cad6769..64642ae09 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -812,6 +812,8 @@ LABELS userdefslabels[]= { "automsg", USERDEFS_AUTOMSG, 0, 0 }, { "idplayers", USERDEFS_IDPLAYERS, 0, 0 }, { "team", USERDEFS_TEAM, 0, 0 }, + { "viewbob", USERDEFS_VIEWBOB, 0, 0 }, + { "weaponsway", USERDEFS_WEAPONSWAY, 0, 0 }, { "", -1, 0, 0 } // END OF LIST }; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 5aebfeacb..b1085c06a 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -314,7 +314,9 @@ enum userdefslabels { USERDEFS_AUTOVOTE, USERDEFS_AUTOMSG, USERDEFS_IDPLAYERS, - USERDEFS_TEAM + USERDEFS_TEAM, + USERDEFS_VIEWBOB, + USERDEFS_WEAPONSWAY }; enum sectorlabels { diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 68f9d5b17..a8b97e762 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -665,6 +665,20 @@ static void DoUserDef(int iSet, int lLabelID, int lVar2) SetGameVarID(lVar2, ud.team, g_i, g_p); break; + case USERDEFS_VIEWBOB: + if (iSet) + ud.viewbob = lValue; + else + SetGameVarID(lVar2, ud.viewbob, g_i, g_p); + break; + + case USERDEFS_WEAPONSWAY: + if (iSet) + ud.weaponsway = lValue; + else + SetGameVarID(lVar2, ud.weaponsway, g_i, g_p); + break; + default: break; } diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index ff136c54f..03800b7fd 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -154,5 +154,5 @@ extern double msens; void ContextHelp(short spritenum); void ResetKeys(); -extern void clearfilenames(void), fixspritesectors(void); +extern void fixspritesectors(void); #define KEY_PRESSED(sc) KB_KeyPressed((sc))