diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 4aa1fda50..87f1bc12d 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -513,7 +513,7 @@ void CONFIG_SetupJoystick( void ) void readsavenames(void) { - long dummy; + long dummy,j; short i; char fn[13]; BFILE *fil; @@ -524,8 +524,9 @@ void readsavenames(void) { fn[4] = i+'0'; if ((fil = Bfopen(fn,"rb")) == NULL ) continue; - if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; } - + if(dfread(&j,sizeof(long),1,fil) != 1) { Bfclose(fil); continue; } + if(dfread(g_szBuf,j,1,fil) != 1) { Bfclose(fil); continue; } + if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; } if(dummy != BYTEVERSION) return; if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; } if (dfread(&ud.savegame[i][0],19,1,fil) != 1) { ud.savegame[i][0] = 0; } diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index 8759b9224..b39fc7a7c 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -338,7 +338,7 @@ extern void ResetSystemDefaults(void); extern void InitGameVarPointers(void); extern void InitGameVars(void); extern void SaveGameVars(FILE *fil); -extern void ReadGameVars(long fil); +extern int ReadGameVars(long fil); extern int GetGameID(char *szGameLabel); extern long GetGameVarID(int id, short sActor, short sPlayer); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index bc4aa79da..9cabd9615 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -346,7 +346,7 @@ void getpackets(void) } // only dispatch commands here when not in a game - if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } +if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } if(qe == 0 && KB_KeyPressed(sc_LeftControl) && KB_KeyPressed(sc_LeftAlt) && KB_KeyPressed(sc_Delete)) { @@ -368,30 +368,30 @@ void getpackets(void) if (i != other) sendpacket(i,packbuf,packbufleng); } -/* - j = packbuf[1]; - playerquitflag[j] = 0; + /* + j = packbuf[1]; + playerquitflag[j] = 0; - j = -1; - for(i=connecthead;i>=0;i=connectpoint2[i]) - { - if (playerquitflag[i]) { j = i; continue; } + j = -1; + for(i=connecthead;i>=0;i=connectpoint2[i]) + { + if (playerquitflag[i]) { j = i; continue; } - if (i == connecthead) connecthead = connectpoint2[connecthead]; - else connectpoint2[j] = connectpoint2[i]; + if (i == connecthead) connecthead = connectpoint2[connecthead]; + else connectpoint2[j] = connectpoint2[i]; - numplayers--; - ud.multimode--; + numplayers--; + ud.multimode--; - Bsprintf(buf,"%s is history!",ud.user_name[i]); - adduserquote(buf); + Bsprintf(buf,"%s is history!",ud.user_name[i]); + adduserquote(buf); - if (numplayers < 2) - sound(GENERIC_AMBIENCE17); + if (numplayers < 2) + sound(GENERIC_AMBIENCE17); - if(i == 0 && networkmode == 0 ) */ - gameexit( "Game aborted from menu; disconnected."); -// } + if(i == 0 && networkmode == 0 ) */ + gameexit( "Game aborted from menu; disconnected."); + // } break; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index ec89e90ac..8f153b112 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1031,29 +1031,24 @@ void AddLog(char *psz) char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags); -void ReadGameVars(long fil) +int ReadGameVars(long fil) { int i; long l; // AddLog("Reading gamevars from savegame"); - kdfread(&l,sizeof(l),1,fil); - kdfread(g_szBuf,l,1,fil); - g_szBuf[l]=0; - AddLog(g_szBuf); - FreeGameVars(); // nuke 'em from orbit, it's the only way to be sure... // Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__); // AddLog(g_szBuf); - kdfread(&iGameVarCount,sizeof(iGameVarCount),1,fil); + if(kdfread(&iGameVarCount,sizeof(iGameVarCount),1,fil) != 1) goto corrupt; for(i=0;iang; - - j = -1; if(s->picnum == APLAYER) { if(!ps[s->yvel].auto_aim) return -1; @@ -283,6 +280,11 @@ short aim(spritetype *s,short aang,short atwith) } } } + + a = s->ang; + + j = -1; + gotshrinker = s->picnum == APLAYER && *aplWeaponWorksLike[ps[s->yvel].curr_weapon] == SHRINKER_WEAPON; gotfreezer = s->picnum == APLAYER && *aplWeaponWorksLike[ps[s->yvel].curr_weapon] == FREEZE_WEAPON; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 02ec646ce..2d9d4716c 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -35,6 +35,11 @@ int loadpheader(char spot,struct savehead *saveh) walock[TILE_LOADSHOT] = 255; + if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; + if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt; + g_szBuf[bv]=0; + AddLog(g_szBuf); + if (kdfread(&bv,4,1,fil) != 1) goto corrupt; if(bv != BYTEVERSION) { FTA(114,&ps[myconnectindex]); @@ -105,6 +110,11 @@ int loadplayer(signed char spot) ready2send = 0; + if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; + if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt; + g_szBuf[bv]=0; + AddLog(g_szBuf); + if (kdfread(&bv,4,1,fil) != 1) return -1; if(bv != BYTEVERSION) { @@ -315,7 +325,7 @@ int loadplayer(signed char spot) if (kdfread(&dynamictostatic[0],sizeof(dynamictostatic[0]),MAXTILES,fil) != MAXTILES) goto corrupt; - ReadGameVars(fil); + if(ReadGameVars(fil)) goto corrupt; kclose(fil); @@ -476,6 +486,11 @@ int saveplayer(signed char spot) ready2send = 0; + Bsprintf(g_szBuf,"EDuke32"); + i=strlen(g_szBuf); + dfwrite(&i,sizeof(i),1,fil); + dfwrite(g_szBuf,i,1,fil); + dfwrite(&bv,4,1,fil); dfwrite(&ud.multimode,sizeof(ud.multimode),1,fil);