diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index d9e480b8f..9d0ef324d 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -660,7 +660,19 @@ int32 CONFIG_ReadSetup(void) #ifdef _WIN32 if (g_noSetup == 0 && mod_dir[0] == '/') + { + struct stat st; SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]); + + if (stat(mod_dir, &st) >= 0) + { + if ((st.st_mode & S_IFDIR) != S_IFDIR) + { + initprintf("Invalid mod dir in cfg!\n"); + Bsprintf(mod_dir,"/"); + } + } + } #endif { diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index 7bc7e61ca..feb41cd9c 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -125,7 +125,7 @@ extern int G_GetAngleDelta(int a,int na); extern void A_GetZLimits(int iActor); extern void A_Fall(int iActor); extern void C_Compile(const char *fn); -extern int __fastcall A_GetFurthestAngle(int iActor,int angs); +extern int A_GetFurthestAngle(int iActor,int angs); extern void A_Execute(int iActor,int iPlayer,int lDist); extern void overwritesprite(int thex,int they,int tilenum,int shade,int stat,int dapalnum); extern void gamenumber(int x,int y,int n,int s); @@ -204,7 +204,7 @@ extern void G_DrawTXDigiNumZ(int starttile, int x,int y,int n,int s,int pal,int extern void G_DrawTileSmall(int x,int y,int tilenum,int shade,int orientation); extern void G_DrawTilePalSmall(int x,int y,int tilenum,int shade,int orientation,int p); extern void Gv_ResetVars(void); -extern inline void A_ResetVars(int iActor); +extern void A_ResetVars(int iActor); extern int minitext_(int x,int y,const char *t,int s,int p,int sb); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index c266ff185..a0b8af057 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -11048,6 +11048,86 @@ void app_main(int argc,const char **argv) #endif } + // shitcan the old cache directory +#if defined(POLYMOST) && defined(USE_OPENGL) + { + struct stat st; + char dir[BMAX_PATH]; + + if (mod_dir[0] != '/') + Bsprintf(dir,"%s/",mod_dir); + else dir[0] = '\0'; + + Bsprintf(tempbuf,"%stexcache",dir); + if (stat(tempbuf, &st) >= 0) + { + if ((st.st_mode & S_IFDIR) == S_IFDIR) + { + Bsprintf(tempbuf,"EDuke32 has located an obsolete texture cache in the \"%stexcache\" directory.\n\n" + "Would you like EDuke32 to purge the contents of this directory?",dir); + + if (wm_ynbox("Obsolete Texture Cache Detected",tempbuf)) + { + int ii = 0; + + Bsprintf(tempbuf,"%stexcache",dir); + getfilenames(tempbuf,"*"); +RECURSE: + // initprintf("Cleaning %s\n",tempbuf); + while (findfiles) + { + Bsprintf(g_szBuf,"%s/%s",tempbuf,findfiles->name); + if (unlink(g_szBuf)) + initprintf("ERROR: couldn't remove '%s': %s\n",g_szBuf,strerror(errno)); + findfiles = findfiles->next; + } + while (finddirs) + { + if (!Bstrcmp(finddirs->name, ".") || !Bstrcmp(finddirs->name, "..")) + { + finddirs = finddirs->next; + continue; + } + Bsprintf(g_szBuf,"%s/%s",tempbuf,finddirs->name); + if (rmdir(g_szBuf)) + { + if (errno == EEXIST || errno == ENOTEMPTY) + { + ii = 1; + Bstrcpy(tempbuf,g_szBuf); + getfilenames(tempbuf,"*"); + goto RECURSE; + } + else + { + initprintf("ERROR: couldn't remove '%s': %s\n",g_szBuf,strerror(errno)); + } + } + else + { + initprintf("Removed '%s'\n",g_szBuf); + finddirs = finddirs->next; + } + } + + if (ii) + { + Bsprintf(tempbuf,"%stexcache",dir); + getfilenames(tempbuf,"*"); + ii = 0; + goto RECURSE; + } + + Bsprintf(tempbuf,"%stexcache",dir); + if (rmdir(tempbuf)) + initprintf("ERROR: couldn't remove '%s': %s\n",tempbuf,strerror(errno)); + else initprintf("Removed '%s'\n",tempbuf); + } + } + } + } +#endif + i = initgroupfile(duke3dgrp); if (i == -1) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index e80927307..db68957c0 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -164,7 +164,7 @@ static void P_ForceAngle(DukePlayer_t *p) p->rotscrnang = n>>1; } -static char A_Dodge(spritetype *s) +static int A_Dodge(spritetype *s) { int bx,by,bxvect,byvect,d,i; int mx = s->x, my = s->y; @@ -198,7 +198,7 @@ static char A_Dodge(spritetype *s) return 0; } -int __fastcall A_GetFurthestAngle(int iActor,int angs) +int A_GetFurthestAngle(int iActor,int angs) { spritetype *s = &sprite[iActor]; @@ -4231,7 +4231,7 @@ void A_LoadActor(int iActor) void A_Execute(int iActor,int iPlayer,int lDist) { -// int temp, temp2; + int temp, temp2; // if (actorscrptr[sprite[iActor].picnum] == 0) return; @@ -4283,22 +4283,22 @@ void A_Execute(int iActor,int iPlayer,int lDist) } X_Move(); - /* - if (ud.angleinterpolation) - { - temp = (g_sp->ang & 2047) - sprpos[g_i].ang; - sprpos[g_i].oldang = sprpos[g_i].ang; - if (temp) + + /* if (ud.angleinterpolation) { - temp2 = temp/klabs(temp); - if (klabs(temp) > 1024) temp2 = -(temp2); - sprpos[g_i].angdir = temp2; - sprpos[g_i].angdif = min(ud.angleinterpolation,klabs(temp)); - sprpos[g_i].ang += sprpos[g_i].angdif * sprpos[g_i].angdir; - sprpos[g_i].ang &= 2047; + temp = (g_sp->ang & 2047) - sprpos[g_i].ang; + sprpos[g_i].oldang = sprpos[g_i].ang; + if (temp) + { + temp2 = temp/klabs(temp); + if (klabs(temp) > 1024) temp2 = -(temp2); + sprpos[g_i].angdir = temp2; + sprpos[g_i].angdif = min(ud.angleinterpolation,klabs(temp)); + sprpos[g_i].ang += sprpos[g_i].angdif * sprpos[g_i].angdir; + sprpos[g_i].ang &= 2047; + } } - } - */ + */ if (g_sp->statnum == 6) switch (DynamicTileMap[g_sp->picnum]) { diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 2b26d429a..dd1cea2a9 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -547,7 +547,7 @@ int Gv_NewVar(const char *pszLabel, int lValue, unsigned int dwFlags) return 1; } -inline void A_ResetVars(int iActor) +void A_ResetVars(int iActor) { int i=(MAXGAMEVARS-1); // OSD_Printf("resetting vars for actor %d\n",iActor); @@ -559,7 +559,7 @@ inline void A_ResetVars(int iActor) } } -static inline int Gv_GetVarIndex(const char *szGameLabel) +static int Gv_GetVarIndex(const char *szGameLabel) { int i = HASH_find(&gamevarH,szGameLabel); if (i == -1) diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 17982361b..9db9f6f88 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -369,11 +369,23 @@ static void G_DoLoadScreen(char *statustext, int percent) } if (statustext) gametext(160,180,statustext,0,2+8+16); - j = usehightile; +/* j = usehightile; usehightile = 0; - rotatesprite(33<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(xdim-1,percent,100),ydim-1); - rotatesprite(153<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(xdim-1,percent,100),ydim-1); - usehightile = j; + rotatesprite(34<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(scale(xdim-1,288,320),percent,100),ydim-1); + rotatesprite(154<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(scale(xdim-1,288,320),percent,100),ydim-1); + usehightile = j; */ + { + int ii = scale(288,percent,100); + int x = 32; + j = usehightile; + usehightile = 0; + do + { + rotatesprite(x<<16,140<<16,49152,0,NOTCHON,0,2,2+8+16,0,0,xdim-1,ydim-1); + x++; + } while (x < ii); + usehightile = j; + } X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1); nextpage();