diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index eaaa7bb28..162393d13 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -38,6 +38,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "scriptfile.h" #include "crc32.h" +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + #define VERSION " 1.2.0devel" static int floor_over_floor; @@ -1163,7 +1168,7 @@ static void ReadHelpFile(const char *name) helppage=malloc(IHELP_INITPAGES * sizeof(helppage_t *)); numallocpages=IHELP_INITPAGES; - if (!helppage) goto ERROR; + if (!helppage) goto HELPFILE_ERROR; i=0; while (!Bfeof(fp) && !ferror(fp)) @@ -1182,7 +1187,7 @@ static void ReadHelpFile(const char *name) if (Bfeof(fp) || charsread<=0) break; hp=Bcalloc(1,sizeof(helppage_t) + IHELP_INITLINES*80); - if (!hp) goto ERROR; + if (!hp) goto HELPFILE_ERROR; hp->numlines = IHELP_INITLINES; if (charsread == 79 && tempbuf[78]!='\n') skip=1; @@ -1193,7 +1198,7 @@ static void ReadHelpFile(const char *name) if (j >= hp->numlines) { hp=realloc(hp, sizeof(helppage_t) + 2*hp->numlines*80); - if (!hp) goto ERROR; + if (!hp) goto HELPFILE_ERROR; hp->numlines *= 2; } @@ -1225,27 +1230,27 @@ static void ReadHelpFile(const char *name) while (!newpage(tempbuf) && !Bfeof(fp) && charsread>0); hp=realloc(hp, sizeof(helppage_t) + j*80); - if (!hp) goto ERROR; + if (!hp) goto HELPFILE_ERROR; hp->numlines=j; if (i >= numallocpages) { helppage = realloc(helppage, 2*numallocpages*sizeof(helppage_t *)); numallocpages *= 2; - if (!helppage) goto ERROR; + if (!helppage) goto HELPFILE_ERROR; } helppage[i] = hp; i++; } helppage = realloc(helppage, i*sizeof(helppage_t *)); - if (!helppage) goto ERROR; + if (!helppage) goto HELPFILE_ERROR; numhelppages = i; Bfclose(fp); return; -ERROR: +HELPFILE_ERROR: Bfclose(fp); initprintf("ReadHelpFile(): ERROR allocating memory.\n"); @@ -6698,6 +6703,12 @@ static void checkcommandline(int argc, const char **argv) addgroup(argv[i++]); continue; } + if (!Bstrcasecmp(k,".def")) + { + defsfilename = (char *)argv[i++]; + initprintf("Using DEF file: %s.\n",defsfilename); + continue; + } } } i++; @@ -6709,6 +6720,12 @@ int ExtPreInit(int argc,const char **argv) { wm_setapptitle("Mapster32"VERSION); +#ifdef _WIN32 + tempbuf[GetModuleFileName(NULL,tempbuf,BMAX_PATH)] = 0; + Bcorrectfilename(tempbuf,1); + chdir(tempbuf); +#endif + OSD_SetLogFile("mapster32.log"); OSD_SetVersionString("Mapster32"VERSION,0,2); initprintf("Mapster32"VERSION" ("__DATE__" "__TIME__")\n"); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index b69b45794..d590503d7 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9369,6 +9369,12 @@ static void checkcommandline(int argc, const char **argv) initprintf("Using CON file '%s'.\n",confilename); continue; } + if (!Bstrcasecmp(k,".def")) + { + duke3ddef = (char *)argv[i++]; + initprintf("Using DEF file: %s.\n",duke3ddef); + continue; + } } } i++; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 743917615..c37bb6bd6 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -3430,6 +3430,7 @@ static int parsecommand(void) case CON_READGAMEVAR: case CON_USERQUOTE: case CON_STARTTRACKVAR: + case CON_CLEARMAPSTATE: transvar(); return 0; @@ -3594,7 +3595,6 @@ static int parsecommand(void) case CON_FLASH: case CON_SAVEMAPSTATE: case CON_LOADMAPSTATE: - case CON_CLEARMAPSTATE: return 0; case CON_DRAGPOINT: diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index ad895e312..eea21f878 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -6504,11 +6504,10 @@ case CON_CHANGESPRITESECT: return 0; case CON_CLEARMAPSTATE: - if (map[ud.volume_number*MAXLEVELS+ud.level_number].savedstate) - { - FreeMapState(ud.volume_number*MAXLEVELS+ud.level_number); - } insptr++; + j = GetGameVarID(*insptr++,g_i,g_p); + if (map[j].savedstate) + FreeMapState(j); return 0; case CON_STOPALLSOUNDS: diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index fddbdabd8..a509541fa 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -105,7 +105,6 @@ static inline void SetBOSS1Palette(); static inline void SetSLIMEPalette(); static inline void SetWATERPalette(); static inline void SetGAMEPalette(); -static void kensetpalette(char *vgapal); extern short grid; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 12f061ebf..36634e3db 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -738,7 +738,7 @@ void menus(void) "Switch weapons when empty", "-", "-", - "Network packets/sec", + "Net packets per second", "-", "-", "Multiplayer macros", diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index fd3823302..71e7c07bd 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -548,8 +548,8 @@ int shoot(int i,int atwith) if (p >= 0) { - int angRange; - int zRange; + int angRange=32; + int zRange=256; SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); @@ -560,7 +560,7 @@ int shoot(int i,int atwith) } if (j >= 0) { - dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); + dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN)) { dal -= (8<<8); @@ -570,8 +570,6 @@ int shoot(int i,int atwith) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } - angRange=32; - zRange=256; SetGameVarID(g_iAngRangeVarID,angRange, i,p); SetGameVarID(g_iZRangeVarID,zRange,i,p); OnEvent(EVENT_GETSHOTRANGE, i,p, -1); @@ -589,7 +587,7 @@ int shoot(int i,int atwith) if (hitspr != -1) { if (sprite[hitspr].statnum == 1 || sprite[hitspr].statnum == 2 || sprite[hitspr].statnum == 10 || sprite[hitspr].statnum == 13) - j = 1; + j = hitspr; } } @@ -885,7 +883,7 @@ DOSKIPBULLETHOLE: } if (j >= 0) { - dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); + dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]); if (sprite[j].picnum != RECON) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); @@ -1115,8 +1113,8 @@ DOSKIPBULLETHOLE: if (p >= 0) { - int angRange; - int zRange; + int angRange=32; + int zRange=256; SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); @@ -1127,7 +1125,7 @@ DOSKIPBULLETHOLE: } if (j >= 0) { - dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); + dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); if (((sprite[j].picnum>=GREENSLIME)&&(sprite[j].picnum<=GREENSLIME+7))||(sprite[j].picnum==ROTATEGUN)) { @@ -1138,9 +1136,6 @@ DOSKIPBULLETHOLE: sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } - angRange=32; - zRange=256; - SetGameVarID(g_iAngRangeVarID,angRange, i,p); SetGameVarID(g_iZRangeVarID,zRange,i,p); @@ -1160,7 +1155,7 @@ DOSKIPBULLETHOLE: if (hitspr != -1) { if (sprite[hitspr].statnum == 1 || sprite[hitspr].statnum == 2 || sprite[hitspr].statnum == 10 || sprite[hitspr].statnum == 13) - j = 1; + j = hitspr; } } @@ -1419,7 +1414,7 @@ SKIPBULLETHOLE: if (j >= 0) { - dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)-(12<<8); + dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)-(12<<8); zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]) ; sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -1519,7 +1514,7 @@ SKIPBULLETHOLE: if (j >= 0) { - dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); + dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]); if (sprite[j].picnum != RECON) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); @@ -1718,7 +1713,7 @@ SKIPBULLETHOLE: if (j >= 0) { - dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); + dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN)) { dal -= (8<<8); @@ -1810,7 +1805,7 @@ SKIPBULLETHOLE: if (j >= 0) { - dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1); + dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1); zvel = ((sprite[j].z-sz-dal-(4<<8))*768) / (ldist(&sprite[g_player[p].ps->i], &sprite[j])); sa = getangle(sprite[j].x-sx,sprite[j].y-sy); }