mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Remove old functions from savegame.c.
git-svn-id: https://svn.eduke32.com/eduke32@2464 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b359d0dce9
commit
a673b762d0
1 changed files with 0 additions and 767 deletions
|
@ -152,72 +152,6 @@ void ReadSaveGameHeaders(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void ReadSaveGameHeaders(void)
|
||||
{
|
||||
int32_t dummy,j;
|
||||
int32_t i;
|
||||
char fn[13];
|
||||
int32_t fil;
|
||||
|
||||
Bstrcpy(fn,"egam_.sav");
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
int32_t oldver=0;
|
||||
|
||||
fn[4] = i+'0';
|
||||
if ((fil = kopen4loadfrommod(fn,0)) == -1) continue;
|
||||
if (kdfread(&j,sizeof(int32_t),1,fil) != 1)
|
||||
{
|
||||
kclose(fil);
|
||||
continue;
|
||||
}
|
||||
if (kdfread(g_szBuf,j,1,fil) != 1)
|
||||
{
|
||||
kclose(fil);
|
||||
continue;
|
||||
}
|
||||
if (kdfread(&dummy,sizeof(dummy),1,fil) != 1)
|
||||
{
|
||||
kclose(fil);
|
||||
continue;
|
||||
}
|
||||
if (dummy != BYTEVERSION)
|
||||
{
|
||||
oldver = 1;
|
||||
// kclose(fil);
|
||||
// continue;
|
||||
}
|
||||
|
||||
if (kdfread(&dummy,sizeof(dummy),1,fil) != 1)
|
||||
{
|
||||
kclose(fil);
|
||||
continue;
|
||||
}
|
||||
if (kdfread(&ud.savegame[i][0],21,1,fil) != 1)
|
||||
{
|
||||
ud.savegame[i][0] = 0;
|
||||
|
||||
ud.savegame[i][20] = 0;
|
||||
ud.savegame[i][21] = 0;
|
||||
}
|
||||
else ud.savegame[i][19] = 0;
|
||||
|
||||
if (oldver)
|
||||
{
|
||||
// Bmemset(ud.savegame[i], 0, 20);
|
||||
ud.savegame[i][0] = 0;
|
||||
|
||||
ud.savegame[i][20] = 32;
|
||||
ud.savegame[i][21] = 0;
|
||||
}
|
||||
|
||||
kclose(fil);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t G_LoadSaveHeaderNew(int32_t spot, savehead_t *saveh)
|
||||
{
|
||||
char fn[16];
|
||||
|
@ -264,56 +198,6 @@ corrupt:
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh)
|
||||
{
|
||||
char fn[13];
|
||||
int32_t fil;
|
||||
int32_t bv;
|
||||
|
||||
strcpy(fn, "egam0.sav");
|
||||
fn[4] = spot+'0';
|
||||
|
||||
if ((fil = kopen4loadfrommod(fn,0)) == -1) return(-1);
|
||||
|
||||
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,sizeof(bv),1,fil) != 1) goto corrupt;
|
||||
/* if (bv != BYTEVERSION)
|
||||
{
|
||||
P_DoQuote(QUOTE_SAVE_BAD_VERSION,g_player[myconnectindex].ps);
|
||||
kclose(fil);
|
||||
return 1;
|
||||
}*/
|
||||
saveh->byteversion = bv;
|
||||
|
||||
if (kdfread(&saveh->numplr,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
||||
|
||||
if (kdfread(saveh->name,21,1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&saveh->volnum,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&saveh->levnum,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&saveh->plrskl,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(saveh->boardfn,BMAX_PATH,1,fil) != 1) goto corrupt;
|
||||
|
||||
if (waloff[TILE_LOADSHOT] == 0) allocache(&waloff[TILE_LOADSHOT],320*200,&walock[TILE_LOADSHOT]);
|
||||
tilesizx[TILE_LOADSHOT] = 200;
|
||||
tilesizy[TILE_LOADSHOT] = 320;
|
||||
if (kdfread((char *)waloff[TILE_LOADSHOT],320,200,fil) != 200) goto corrupt;
|
||||
invalidatetile(TILE_LOADSHOT,0,255);
|
||||
|
||||
kclose(fil);
|
||||
|
||||
return(0);
|
||||
corrupt:
|
||||
kclose(fil);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void sv_postudload();
|
||||
|
||||
|
@ -420,421 +304,6 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int32_t G_LoadPlayer(int32_t spot)
|
||||
{
|
||||
char fn[13];
|
||||
char mpfn[13];
|
||||
char *fnptr;
|
||||
int32_t fil, bv, i, x;
|
||||
intptr_t j;
|
||||
int32_t nump;
|
||||
|
||||
strcpy(fn, "egam0.sav");
|
||||
strcpy(mpfn, "egamA_00.sav");
|
||||
|
||||
fnptr = fn;
|
||||
fn[4] = spot + '0';
|
||||
|
||||
if ((fil = kopen4loadfrommod(fnptr,0)) == -1) return(-1);
|
||||
|
||||
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,sizeof(bv),1,fil) != 1) return -1;
|
||||
if (bv != BYTEVERSION)
|
||||
{
|
||||
P_DoQuote(QUOTE_SAVE_BAD_VERSION,g_player[myconnectindex].ps);
|
||||
kclose(fil);
|
||||
ototalclock = totalclock;
|
||||
ready2send = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (kdfread(&nump,sizeof(nump),1,fil) != 1) return -1;
|
||||
if (nump != ud.multimode)
|
||||
{
|
||||
kclose(fil);
|
||||
ototalclock = totalclock;
|
||||
ready2send = 1;
|
||||
P_DoQuote(QUOTE_SAVE_BAD_PLAYERS,g_player[myconnectindex].ps);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ud.multimode = nump;
|
||||
|
||||
if (numplayers > 1)
|
||||
{
|
||||
pub = NUMPAGES;
|
||||
pus = NUMPAGES;
|
||||
G_UpdateScreenArea();
|
||||
G_DrawBackground();
|
||||
menutext(160,100, 0, 0,"LOADING...");
|
||||
nextpage();
|
||||
}
|
||||
|
||||
Net_WaitForServer();
|
||||
|
||||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
|
||||
if (numplayers > 1)
|
||||
{
|
||||
if (kdfread(&buf,21,1,fil) != 1) goto corrupt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (kdfread(&ud.savegame[spot][0],21,1,fil) != 1) goto corrupt;
|
||||
ud.savegame[spot][19] = 0;
|
||||
}
|
||||
|
||||
|
||||
if (kdfread(&ud.volume_number,sizeof(ud.volume_number),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.level_number,sizeof(ud.level_number),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.player_skill,sizeof(ud.player_skill),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&boardfilename[0],BMAX_PATH,1,fil) != 1) goto corrupt;
|
||||
|
||||
currentboardfilename[0] = 0;
|
||||
|
||||
if (boardfilename[0])
|
||||
strcpy(currentboardfilename, boardfilename);
|
||||
else if (MapInfo[(ud.volume_number * MAXLEVELS) + ud.level_number].filename)
|
||||
strcpy(currentboardfilename, MapInfo[(ud.volume_number * MAXLEVELS) + ud.level_number].filename);
|
||||
|
||||
if (currentboardfilename[0])
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = Bstrrchr(currentboardfilename,'.');
|
||||
if (!p) strcat(currentboardfilename,".mhk");
|
||||
else
|
||||
{
|
||||
p[1]='m';
|
||||
p[2]='h';
|
||||
p[3]='k';
|
||||
p[4]=0;
|
||||
}
|
||||
|
||||
if (!loadmaphack(currentboardfilename))
|
||||
OSD_Printf("Loaded map hack file '%s'\n",currentboardfilename);
|
||||
}
|
||||
|
||||
Bmemcpy(¤tboardfilename[0],&boardfilename[0],BMAX_PATH);
|
||||
|
||||
ud.m_level_number = ud.level_number;
|
||||
ud.m_volume_number = ud.volume_number;
|
||||
ud.m_player_skill = ud.player_skill;
|
||||
|
||||
//Fake read because lseek won't work with compression
|
||||
walock[TILE_LOADSHOT] = 1;
|
||||
if (waloff[TILE_LOADSHOT] == 0) allocache(&waloff[TILE_LOADSHOT],320*200,&walock[TILE_LOADSHOT]);
|
||||
tilesizx[TILE_LOADSHOT] = 200;
|
||||
tilesizy[TILE_LOADSHOT] = 320;
|
||||
if (kdfread((char *)waloff[TILE_LOADSHOT],320,200,fil) != 200) goto corrupt;
|
||||
invalidatetile(TILE_LOADSHOT,0,255);
|
||||
|
||||
if (kdfread(&numwalls,sizeof(numwalls),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&wall[0],sizeof(walltype),MAXWALLS,fil) != MAXWALLS) goto corrupt;
|
||||
if (kdfread(&numsectors,sizeof(numsectors),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(§or[0],sizeof(sectortype),MAXSECTORS,fil) != MAXSECTORS) goto corrupt;
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
if (kdfread(&numyaxbunches,sizeof(numyaxbunches),1,fil) != 1) goto corrupt;
|
||||
if (numyaxbunches > 0)
|
||||
{
|
||||
if (kdfread(yax_bunchnum,sizeof(yax_bunchnum[0]),numsectors,fil) != numsectors) goto corrupt;
|
||||
if (kdfread(yax_nextwall,sizeof(yax_nextwall[0]),numwalls,fil) != numwalls) goto corrupt;
|
||||
yax_update(2);
|
||||
}
|
||||
else
|
||||
yax_update(1);
|
||||
#endif
|
||||
|
||||
if (kdfread(&sprite[0],sizeof(spritetype),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
|
||||
#ifdef POLYMER
|
||||
// what's the point of doing this when we polymer_resetlights() through polymer_loadboard()
|
||||
// later on anyway?
|
||||
if (kdfread(&lightcount,sizeof(lightcount),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&prlights[0],sizeof(_prlight),lightcount,fil) != lightcount) goto corrupt;
|
||||
#else
|
||||
if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
||||
#endif // POLYMER
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
if (spriteext[i].mdanimtims)
|
||||
spriteext[i].mdanimtims+=mdtims;
|
||||
#endif
|
||||
if (kdfread(&headspritesect[0],sizeof(headspritesect[0]),MAXSECTORS+1,fil) != MAXSECTORS+1) goto corrupt;
|
||||
if (kdfread(&prevspritesect[0],sizeof(prevspritesect[0]),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&nextspritesect[0],sizeof(nextspritesect[0]),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&headspritestat[STAT_DEFAULT],sizeof(headspritestat[STAT_DEFAULT]),MAXSTATUS+1,fil) != MAXSTATUS+1) goto corrupt;
|
||||
if (kdfread(&prevspritestat[STAT_DEFAULT],sizeof(prevspritestat[STAT_DEFAULT]),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&nextspritestat[STAT_DEFAULT],sizeof(nextspritestat[STAT_DEFAULT]),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&g_numCyclers,sizeof(g_numCyclers),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&cyclers[0][0],sizeof(cyclers[0][0])*6,MAXCYCLERS,fil) != MAXCYCLERS) goto corrupt;
|
||||
for (i=0; i<nump; i++)
|
||||
if (kdfread(g_player[i].ps,sizeof(DukePlayer_t),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&g_playerSpawnPoints,sizeof(g_playerSpawnPoints),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&g_numAnimWalls,sizeof(g_numAnimWalls),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&animwall,sizeof(animwall),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&msx[0],sizeof(int32_t),sizeof(msx)/sizeof(int32_t),fil) != sizeof(msx)/sizeof(int32_t)) goto corrupt;
|
||||
if (kdfread(&msy[0],sizeof(int32_t),sizeof(msy)/sizeof(int32_t),fil) != sizeof(msy)/sizeof(int32_t)) goto corrupt;
|
||||
if (kdfread((int16_t *)&g_spriteDeleteQueuePos,sizeof(int16_t),1,fil) != 1) goto corrupt;
|
||||
if (kdfread((int16_t *)&g_spriteDeleteQueueSize,sizeof(int16_t),1,fil) != 1) goto corrupt;
|
||||
if (kdfread((int16_t *)&SpriteDeletionQueue[0],sizeof(int16_t),g_spriteDeleteQueueSize,fil) != g_spriteDeleteQueueSize) goto corrupt;
|
||||
if (kdfread(&g_mirrorCount,sizeof(int16_t),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&g_mirrorWall[0],sizeof(int16_t),64,fil) != 64) goto corrupt;
|
||||
if (kdfread(&g_mirrorSector[0],sizeof(int16_t),64,fil) != 64) goto corrupt;
|
||||
if (kdfread(&show2dsector[0],sizeof(uint8_t),MAXSECTORS>>3,fil) != (MAXSECTORS>>3)) goto corrupt;
|
||||
if (kdfread(&ActorType[0],sizeof(uint8_t),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
|
||||
if (kdfread(&g_numClouds,sizeof(g_numClouds),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&clouds[0],sizeof(int16_t)<<7,1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&cloudx[0],sizeof(int16_t)<<7,1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&cloudy[0],sizeof(int16_t)<<7,1,fil) != 1) goto corrupt;
|
||||
|
||||
if (kdfread(&g_scriptSize,sizeof(g_scriptSize),1,fil) != 1) goto corrupt;
|
||||
if (!g_scriptSize) goto corrupt;
|
||||
|
||||
Bfree(bitptr);
|
||||
bitptr = Bcalloc(1,(((g_scriptSize+7)>>3)+1) * sizeof(uint8_t));
|
||||
if (kdfread(&bitptr[0],sizeof(uint8_t),(g_scriptSize+7)>>3,fil) != ((g_scriptSize+7)>>3)) goto corrupt;
|
||||
|
||||
if (script != NULL)
|
||||
Bfree(script);
|
||||
script = Bcalloc(1,g_scriptSize * sizeof(intptr_t));
|
||||
if (kdfread(&script[0],sizeof(script),g_scriptSize,fil) != g_scriptSize) goto corrupt;
|
||||
for (i=0; i<g_scriptSize; i++)
|
||||
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
|
||||
{
|
||||
j = (intptr_t)script[i]+(intptr_t)&script[0];
|
||||
script[i] = j;
|
||||
}
|
||||
|
||||
if (kdfread(&actorscrptr[0],sizeof(actorscrptr[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_BACK_NON0);
|
||||
|
||||
if (kdfread(&actorLoadEventScrptr[0],sizeof(&actorLoadEventScrptr[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_BACK_NON0);
|
||||
|
||||
if (kdfread(&actor[0],sizeof(actor_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
|
||||
if (kdfread(&lockclock,sizeof(lockclock),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&pskybits,sizeof(pskybits),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil) != MAXPSKYTILES) goto corrupt;
|
||||
|
||||
if (kdfread(&g_animateCount,sizeof(g_animateCount),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&animatesect[0],sizeof(animatesect[0]),MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
||||
if (kdfread(&animateptr[0],sizeof(animateptr[0]),MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
||||
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_BACK);
|
||||
|
||||
if (kdfread(&animategoal[0],sizeof(animategoal[0]),MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
||||
if (kdfread(&animatevel[0],sizeof(animatevel[0]),MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
||||
|
||||
if (kdfread(&g_earthquakeTime,sizeof(g_earthquakeTime),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.from_bonus,sizeof(ud.from_bonus),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.secretlevel,sizeof(ud.secretlevel),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.respawn_monsters,sizeof(ud.respawn_monsters),1,fil) != 1) goto corrupt;
|
||||
ud.m_respawn_monsters = ud.respawn_monsters;
|
||||
if (kdfread(&ud.respawn_items,sizeof(ud.respawn_items),1,fil) != 1) goto corrupt;
|
||||
ud.m_respawn_items = ud.respawn_items;
|
||||
if (kdfread(&ud.respawn_inventory,sizeof(ud.respawn_inventory),1,fil) != 1) goto corrupt;
|
||||
ud.m_respawn_inventory = ud.respawn_inventory;
|
||||
|
||||
if (kdfread(&ud.god,sizeof(ud.god),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.auto_run,sizeof(ud.auto_run),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.crosshair,sizeof(ud.crosshair),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.monsters_off,sizeof(ud.monsters_off),1,fil) != 1) goto corrupt;
|
||||
ud.m_monsters_off = ud.monsters_off;
|
||||
if (kdfread(&ud.last_level,sizeof(ud.last_level),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&ud.eog,sizeof(ud.eog),1,fil) != 1) goto corrupt;
|
||||
|
||||
if (kdfread(&ud.coop,sizeof(ud.coop),1,fil) != 1) goto corrupt;
|
||||
ud.m_coop = ud.coop;
|
||||
if (kdfread(&ud.marker,sizeof(ud.marker),1,fil) != 1) goto corrupt;
|
||||
ud.m_marker = ud.marker;
|
||||
if (kdfread(&ud.ffire,sizeof(ud.ffire),1,fil) != 1) goto corrupt;
|
||||
ud.m_ffire = ud.ffire;
|
||||
|
||||
if (kdfread(&camsprite,sizeof(camsprite),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(connectpoint2,sizeof(connectpoint2),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil) != 1) goto corrupt;
|
||||
for (i=0; i<MAXPLAYERS; i++)
|
||||
if (kdfread((int16_t *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil) != 1) goto corrupt;
|
||||
|
||||
if (kdfread(&randomseed,sizeof(randomseed),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&g_globalRandom,sizeof(g_globalRandom),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(¶llaxyscale,sizeof(parallaxyscale),1,fil) != 1) goto corrupt;
|
||||
|
||||
if (kdfread(&SpriteProjectile[0],sizeof(projectile_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&ProjectileData[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
if (kdfread(&DefaultProjectileData[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
|
||||
if (kdfread(&SpriteFlags[0],sizeof(SpriteFlags[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
|
||||
if (kdfread(&SpriteCacheList[0],sizeof(SpriteCacheList[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
|
||||
if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
||||
|
||||
while (i != MAXQUOTES)
|
||||
{
|
||||
if (ScriptQuotes[i] != NULL)
|
||||
Bfree(ScriptQuotes[i]);
|
||||
|
||||
ScriptQuotes[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
|
||||
|
||||
if (kdfread((char *)ScriptQuotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
||||
}
|
||||
|
||||
if (kdfread(&g_numQuoteRedefinitions,sizeof(g_numQuoteRedefinitions),1,fil) != 1) goto corrupt;
|
||||
|
||||
for (i=0; i<g_numQuoteRedefinitions; i++)
|
||||
{
|
||||
if (ScriptQuoteRedefinitions[i] != NULL)
|
||||
Bfree(ScriptQuoteRedefinitions[i]);
|
||||
|
||||
ScriptQuoteRedefinitions[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
|
||||
|
||||
if (kdfread((char *)ScriptQuoteRedefinitions[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
|
||||
}
|
||||
|
||||
if (kdfread(&DynamicTileMap[0],sizeof(DynamicTileMap[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
|
||||
if (kdfread(&ud.noexits,sizeof(ud.noexits),1,fil) != 1) goto corrupt;
|
||||
ud.m_noexits = ud.noexits;
|
||||
|
||||
|
||||
if (Gv_ReadSave(fil, 0)) goto corrupt;
|
||||
|
||||
kclose(fil);
|
||||
|
||||
|
||||
//1
|
||||
if (g_player[myconnectindex].ps->over_shoulder_on != 0)
|
||||
{
|
||||
g_cameraDistance = 0;
|
||||
g_cameraClock = 0;
|
||||
g_player[myconnectindex].ps->over_shoulder_on = 1;
|
||||
}
|
||||
|
||||
//2
|
||||
screenpeek = myconnectindex;
|
||||
|
||||
// 2.5
|
||||
{
|
||||
Bmemset(gotpic, 0, sizeof(gotpic));
|
||||
S_ClearSoundLocks();
|
||||
G_CacheMapData();
|
||||
|
||||
i = g_musicIndex;
|
||||
g_musicIndex = (ud.volume_number*MAXLEVELS) + ud.level_number;
|
||||
|
||||
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
||||
{
|
||||
char levname[BMAX_PATH];
|
||||
|
||||
G_SetupFilenameBasedMusic(levname, boardfilename, ud.level_number);
|
||||
}
|
||||
|
||||
if (ud.config.MusicToggle)
|
||||
{
|
||||
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL &&
|
||||
(i != g_musicIndex || MapInfo[MAXVOLUMES*MAXLEVELS+2].alt_musicfn))
|
||||
{
|
||||
S_StopMusic();
|
||||
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0], g_musicIndex);
|
||||
}
|
||||
|
||||
S_PauseMusic(0);
|
||||
}
|
||||
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
ud.recstat = 0;
|
||||
|
||||
if (g_player[myconnectindex].ps->jetpack_on)
|
||||
A_PlaySound(DUKE_JETPACK_IDLE, g_player[myconnectindex].ps->i);
|
||||
}
|
||||
|
||||
// g_restorePalette = 1;
|
||||
//3
|
||||
P_UpdateScreenPal(g_player[myconnectindex].ps);
|
||||
|
||||
//3.5
|
||||
G_UpdateScreenArea();
|
||||
FX_SetReverb(0);
|
||||
|
||||
//4
|
||||
if (ud.lockout == 0)
|
||||
{
|
||||
for (x=0; x<g_numAnimWalls; x++)
|
||||
if (wall[animwall[x].wallnum].extra >= 0)
|
||||
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (x=0; x<g_numAnimWalls; x++)
|
||||
switch (DYNAMICTILEMAP(wall[animwall[x].wallnum].picnum))
|
||||
{
|
||||
case FEMPIC1__STATIC:
|
||||
wall[animwall[x].wallnum].picnum = BLANKSCREEN;
|
||||
break;
|
||||
case FEMPIC2__STATIC:
|
||||
case FEMPIC3__STATIC:
|
||||
wall[animwall[x].wallnum].picnum = SCREENBREAK6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//5
|
||||
G_ResetInterpolations();
|
||||
|
||||
//6
|
||||
g_showShareware = 0;
|
||||
everyothertime = 0;
|
||||
|
||||
//7
|
||||
for (i=0; i<MAXPLAYERS; i++)
|
||||
g_player[i].playerquitflag = 1;
|
||||
|
||||
Net_ResetPrediction(); //OBSOLETE
|
||||
|
||||
//7.5
|
||||
ready2send = 1;
|
||||
G_ClearFIFO();
|
||||
Net_WaitForServer();
|
||||
|
||||
//8
|
||||
G_ResetTimers();
|
||||
|
||||
#ifdef POLYMER
|
||||
//8
|
||||
if (getrendermode() == 4)
|
||||
polymer_loadboard();
|
||||
#endif
|
||||
// this light pointer nulling needs to be outside the getrendermode check
|
||||
// because we might be loading the savegame using another renderer but
|
||||
// change to Polymer later
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
{
|
||||
actor[i].lightptr = NULL;
|
||||
actor[i].lightId = -1;
|
||||
}
|
||||
|
||||
return(0);
|
||||
corrupt:
|
||||
Bsprintf(tempbuf,"Save game file \"%s\" is corrupt or of the wrong version.",fnptr);
|
||||
G_GameExit(tempbuf);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t G_SavePlayer(int32_t spot)
|
||||
{
|
||||
|
@ -894,242 +363,6 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int32_t G_SavePlayer(int32_t spot)
|
||||
{
|
||||
int32_t i;
|
||||
intptr_t j;
|
||||
char fn[13];
|
||||
char mpfn[13];
|
||||
char *fnptr;
|
||||
FILE *fil;
|
||||
int32_t bv = BYTEVERSION;
|
||||
|
||||
strcpy(fn, "egam0.sav");
|
||||
strcpy(mpfn, "egamA_00.sav");
|
||||
|
||||
Net_WaitForServer();
|
||||
|
||||
fnptr = fn;
|
||||
fn[4] = spot + '0';
|
||||
|
||||
{
|
||||
char temp[BMAX_PATH];
|
||||
if (g_modDir[0] != '/')
|
||||
Bsprintf(temp,"%s/%s",g_modDir,fnptr);
|
||||
else Bsprintf(temp,"%s",fnptr);
|
||||
|
||||
if ((fil = fopen(temp,"wb")) == 0) return(-1);
|
||||
}
|
||||
|
||||
ready2send = 0;
|
||||
|
||||
Bsprintf(g_szBuf,"EDuke32");
|
||||
i=strlen(g_szBuf);
|
||||
dfwrite(&i,sizeof(i),1,fil);
|
||||
dfwrite(g_szBuf,i,1,fil);
|
||||
|
||||
dfwrite(&bv,sizeof(bv),1,fil);
|
||||
dfwrite(&ud.multimode,sizeof(ud.multimode),1,fil);
|
||||
|
||||
dfwrite(&ud.savegame[spot][0],21,1,fil);
|
||||
dfwrite(&ud.volume_number,sizeof(ud.volume_number),1,fil);
|
||||
dfwrite(&ud.level_number,sizeof(ud.level_number),1,fil);
|
||||
dfwrite(&ud.player_skill,sizeof(ud.player_skill),1,fil);
|
||||
dfwrite(¤tboardfilename[0],BMAX_PATH,1,fil);
|
||||
if (!waloff[TILE_SAVESHOT])
|
||||
{
|
||||
walock[TILE_SAVESHOT] = 254;
|
||||
allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
|
||||
clearbuf((void *)waloff[TILE_SAVESHOT],(200*320)/4,0);
|
||||
walock[TILE_SAVESHOT] = 1;
|
||||
}
|
||||
dfwrite((char *)waloff[TILE_SAVESHOT],320,200,fil);
|
||||
|
||||
dfwrite(&numwalls,sizeof(numwalls),1,fil);
|
||||
dfwrite(&wall[0],sizeof(walltype),MAXWALLS,fil);
|
||||
dfwrite(&numsectors,sizeof(numsectors),1,fil);
|
||||
dfwrite(§or[0],sizeof(sectortype),MAXSECTORS,fil);
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
dfwrite(&numyaxbunches,sizeof(numyaxbunches),1,fil);
|
||||
if (numyaxbunches > 0)
|
||||
{
|
||||
dfwrite(yax_bunchnum,sizeof(yax_bunchnum[0]),numsectors,fil);
|
||||
dfwrite(yax_nextwall,sizeof(yax_nextwall[0]),numwalls,fil);
|
||||
}
|
||||
#endif
|
||||
|
||||
dfwrite(&sprite[0],sizeof(spritetype),MAXSPRITES,fil);
|
||||
#ifdef USE_OPENGL
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
if (spriteext[i].mdanimtims)
|
||||
{
|
||||
spriteext[i].mdanimtims=spriteext[i].mdanimtims-mdtims;
|
||||
if (!spriteext[i].mdanimtims)
|
||||
spriteext[i].mdanimtims++;
|
||||
}
|
||||
#endif
|
||||
dfwrite(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil);
|
||||
|
||||
#ifdef POLYMER
|
||||
dfwrite(&lightcount,sizeof(lightcount),1,fil);
|
||||
dfwrite(&prlights[0],sizeof(_prlight),lightcount,fil);
|
||||
#else
|
||||
i = 0;
|
||||
dfwrite(&i,sizeof(int32_t),1,fil);
|
||||
#endif // POLYMER
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
for (i=0; i<MAXSPRITES; i++)if (spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims;
|
||||
#endif
|
||||
dfwrite(&headspritesect[0],sizeof(headspritesect[0]),MAXSECTORS+1,fil);
|
||||
dfwrite(&prevspritesect[0],sizeof(prevspritesect[0]),MAXSPRITES,fil);
|
||||
dfwrite(&nextspritesect[0],sizeof(nextspritesect[0]),MAXSPRITES,fil);
|
||||
dfwrite(&headspritestat[STAT_DEFAULT],sizeof(headspritestat[0]),MAXSTATUS+1,fil);
|
||||
dfwrite(&prevspritestat[STAT_DEFAULT],sizeof(prevspritestat[0]),MAXSPRITES,fil);
|
||||
dfwrite(&nextspritestat[STAT_DEFAULT],sizeof(nextspritestat[0]),MAXSPRITES,fil);
|
||||
dfwrite(&g_numCyclers,sizeof(g_numCyclers),1,fil);
|
||||
dfwrite(&cyclers[0][0],sizeof(cyclers[0][0])*6,MAXCYCLERS,fil);
|
||||
for (i=0; i<ud.multimode; i++)
|
||||
dfwrite(g_player[i].ps,sizeof(DukePlayer_t),1,fil);
|
||||
dfwrite(&g_playerSpawnPoints,sizeof(g_playerSpawnPoints),1,fil);
|
||||
dfwrite(&g_numAnimWalls,sizeof(g_numAnimWalls),1,fil);
|
||||
dfwrite(&animwall,sizeof(animwall),1,fil);
|
||||
dfwrite(&msx[0],sizeof(int32_t),sizeof(msx)/sizeof(int32_t),fil);
|
||||
dfwrite(&msy[0],sizeof(int32_t),sizeof(msy)/sizeof(int32_t),fil);
|
||||
dfwrite(&g_spriteDeleteQueuePos,sizeof(int16_t),1,fil);
|
||||
dfwrite(&g_spriteDeleteQueueSize,sizeof(int16_t),1,fil);
|
||||
dfwrite(&SpriteDeletionQueue[0],sizeof(int16_t),g_spriteDeleteQueueSize,fil);
|
||||
dfwrite(&g_mirrorCount,sizeof(int16_t),1,fil);
|
||||
dfwrite(&g_mirrorWall[0],sizeof(int16_t),64,fil);
|
||||
dfwrite(&g_mirrorSector[0],sizeof(int16_t),64,fil);
|
||||
dfwrite(&show2dsector[0],sizeof(uint8_t),MAXSECTORS>>3,fil);
|
||||
dfwrite(&ActorType[0],sizeof(uint8_t),MAXTILES,fil);
|
||||
|
||||
dfwrite(&g_numClouds,sizeof(g_numClouds),1,fil);
|
||||
dfwrite(&clouds[0],sizeof(int16_t)<<7,1,fil);
|
||||
dfwrite(&cloudx[0],sizeof(int16_t)<<7,1,fil);
|
||||
dfwrite(&cloudy[0],sizeof(int16_t)<<7,1,fil);
|
||||
|
||||
dfwrite(&g_scriptSize,sizeof(g_scriptSize),1,fil);
|
||||
|
||||
for (i=0; i<g_scriptSize; i++)
|
||||
{
|
||||
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
|
||||
{
|
||||
j = (intptr_t)script[i] - (intptr_t)&script[0];
|
||||
script[i] = j;
|
||||
}
|
||||
}
|
||||
|
||||
dfwrite(&bitptr[0],sizeof(bitptr[0]),(g_scriptSize+7)>>3,fil);
|
||||
dfwrite(&script[0],sizeof(script[0]),g_scriptSize,fil);
|
||||
|
||||
for (i=0; i<g_scriptSize; i++)
|
||||
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
|
||||
{
|
||||
j = script[i]+(intptr_t)&script[0];
|
||||
script[i] = j;
|
||||
}
|
||||
|
||||
G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_FWD_NON0);
|
||||
dfwrite(&actorscrptr[0],sizeof(actorscrptr[0]),MAXTILES,fil);
|
||||
G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_BACK_NON0);
|
||||
|
||||
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_FWD_NON0);
|
||||
dfwrite(&actorLoadEventScrptr[0],sizeof(actorLoadEventScrptr[0]),MAXTILES,fil);
|
||||
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_BACK_NON0);
|
||||
|
||||
dfwrite(&actor[0],sizeof(actor_t),MAXSPRITES,fil);
|
||||
|
||||
dfwrite(&lockclock,sizeof(lockclock),1,fil);
|
||||
dfwrite(&pskybits,sizeof(pskybits),1,fil);
|
||||
dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil);
|
||||
dfwrite(&g_animateCount,sizeof(g_animateCount),1,fil);
|
||||
dfwrite(&animatesect[0],sizeof(animatesect[0]),MAXANIMATES,fil);
|
||||
|
||||
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_FWD);
|
||||
dfwrite(&animateptr[0],sizeof(animateptr[0]),MAXANIMATES,fil);
|
||||
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_BACK);
|
||||
|
||||
dfwrite(&animategoal[0],sizeof(animategoal[0]),MAXANIMATES,fil);
|
||||
dfwrite(&animatevel[0],sizeof(animatevel[0]),MAXANIMATES,fil);
|
||||
|
||||
dfwrite(&g_earthquakeTime,sizeof(g_earthquakeTime),1,fil);
|
||||
dfwrite(&ud.from_bonus,sizeof(ud.from_bonus),1,fil);
|
||||
dfwrite(&ud.secretlevel,sizeof(ud.secretlevel),1,fil);
|
||||
dfwrite(&ud.respawn_monsters,sizeof(ud.respawn_monsters),1,fil);
|
||||
dfwrite(&ud.respawn_items,sizeof(ud.respawn_items),1,fil);
|
||||
dfwrite(&ud.respawn_inventory,sizeof(ud.respawn_inventory),1,fil);
|
||||
dfwrite(&ud.god,sizeof(ud.god),1,fil);
|
||||
dfwrite(&ud.auto_run,sizeof(ud.auto_run),1,fil);
|
||||
dfwrite(&ud.crosshair,sizeof(ud.crosshair),1,fil);
|
||||
dfwrite(&ud.monsters_off,sizeof(ud.monsters_off),1,fil);
|
||||
dfwrite(&ud.last_level,sizeof(ud.last_level),1,fil);
|
||||
dfwrite(&ud.eog,sizeof(ud.eog),1,fil);
|
||||
dfwrite(&ud.coop,sizeof(ud.coop),1,fil);
|
||||
dfwrite(&ud.marker,sizeof(ud.marker),1,fil);
|
||||
dfwrite(&ud.ffire,sizeof(ud.ffire),1,fil);
|
||||
dfwrite(&camsprite,sizeof(camsprite),1,fil);
|
||||
dfwrite(connectpoint2,sizeof(connectpoint2),1,fil);
|
||||
dfwrite(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil);
|
||||
for (i=0; i<MAXPLAYERS; i++)
|
||||
dfwrite((int16_t *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil);
|
||||
|
||||
dfwrite(&randomseed,sizeof(randomseed),1,fil);
|
||||
dfwrite(&g_globalRandom,sizeof(g_globalRandom),1,fil);
|
||||
dfwrite(¶llaxyscale,sizeof(parallaxyscale),1,fil);
|
||||
|
||||
dfwrite(&SpriteProjectile[0],sizeof(projectile_t),MAXSPRITES,fil);
|
||||
dfwrite(&ProjectileData[0],sizeof(projectile_t),MAXTILES,fil);
|
||||
dfwrite(&DefaultProjectileData[0],sizeof(projectile_t),MAXTILES,fil);
|
||||
|
||||
dfwrite(&SpriteFlags[0],sizeof(SpriteFlags[0]),MAXTILES,fil);
|
||||
|
||||
dfwrite(&SpriteCacheList[0],sizeof(SpriteCacheList[0]),MAXTILES,fil);
|
||||
|
||||
for (i=0; i<MAXQUOTES; i++)
|
||||
{
|
||||
if (ScriptQuotes[i] != NULL)
|
||||
{
|
||||
dfwrite(&i,sizeof(int32_t),1,fil);
|
||||
dfwrite(ScriptQuotes[i],MAXQUOTELEN, 1, fil);
|
||||
}
|
||||
}
|
||||
dfwrite(&i,sizeof(int32_t),1,fil);
|
||||
|
||||
dfwrite(&g_numQuoteRedefinitions,sizeof(g_numQuoteRedefinitions),1,fil);
|
||||
for (i=0; i<g_numQuoteRedefinitions; i++)
|
||||
{
|
||||
if (ScriptQuoteRedefinitions[i] != NULL)
|
||||
dfwrite(ScriptQuoteRedefinitions[i],MAXQUOTELEN, 1, fil);
|
||||
}
|
||||
|
||||
dfwrite(&DynamicTileMap[0],sizeof(DynamicTileMap[0]),MAXTILES,fil);
|
||||
|
||||
dfwrite(&ud.noexits,sizeof(ud.noexits),1,fil);
|
||||
|
||||
Gv_WriteSave(fil, 0);
|
||||
|
||||
fclose(fil);
|
||||
|
||||
if (!g_netServer && ud.multimode < 2)
|
||||
{
|
||||
strcpy(ScriptQuotes[QUOTE_RESERVED4],"GAME SAVED");
|
||||
P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps);
|
||||
}
|
||||
|
||||
ready2send = 1;
|
||||
|
||||
Net_WaitForServer();
|
||||
|
||||
ototalclock = totalclock;
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
////////// GENERIC SAVING/LOADING SYSTEM //////////
|
||||
|
||||
|
|
Loading…
Reference in a new issue