2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2007-02-08 04:19:39 +00:00
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
|
|
|
Copyright (C) 2004, 2007 - EDuke32 developers
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
This file is part of EDuke32
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "duke3d.h"
|
|
|
|
|
2008-08-16 22:15:46 +00:00
|
|
|
extern char *bitptr;
|
|
|
|
|
2008-08-17 09:01:31 +00:00
|
|
|
#define BITPTR_POINTER 1
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void ReadSaveGameHeaders(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t dummy,j;
|
|
|
|
int32_t i;
|
2006-12-10 06:49:01 +00:00
|
|
|
char fn[13];
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t fil;
|
2006-12-10 06:49:01 +00:00
|
|
|
|
|
|
|
Bstrcpy(fn,"egam_.sav");
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<10; i++)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
|
|
|
fn[4] = i+'0';
|
2008-08-20 09:38:36 +00:00
|
|
|
if ((fil = kopen4loadfrommod(fn,0)) == -1) continue;
|
2009-01-09 09:29:17 +00:00
|
|
|
if (kdfread(&j,sizeof(int32_t),1,fil) != 1)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-08-20 09:38:36 +00:00
|
|
|
kclose(fil);
|
2006-12-10 06:49:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
2008-08-20 09:38:36 +00:00
|
|
|
if (kdfread(g_szBuf,j,1,fil) != 1)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-08-20 09:38:36 +00:00
|
|
|
kclose(fil);
|
2006-12-10 06:49:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
2008-08-20 09:38:36 +00:00
|
|
|
if (kdfread(&dummy,4,1,fil) != 1)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-08-20 09:38:36 +00:00
|
|
|
kclose(fil);
|
2006-12-10 06:49:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
2007-08-27 23:11:49 +00:00
|
|
|
if (dummy != BYTEVERSION)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-08-20 09:38:36 +00:00
|
|
|
kclose(fil);
|
2006-12-10 06:49:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
2008-08-20 09:38:36 +00:00
|
|
|
if (kdfread(&dummy,4,1,fil) != 1)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-08-20 09:38:36 +00:00
|
|
|
kclose(fil);
|
2006-12-10 06:49:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
2008-08-20 09:38:36 +00:00
|
|
|
if (kdfread(&ud.savegame[i][0],19,1,fil) != 1)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
|
|
|
ud.savegame[i][0] = 0;
|
|
|
|
}
|
2008-08-20 09:38:36 +00:00
|
|
|
kclose(fil);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t G_LoadSaveHeader(char spot,struct savehead *saveh)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
char fn[13];
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t fil;
|
|
|
|
int32_t bv;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
strcpy(fn, "egam0.sav");
|
|
|
|
fn[4] = spot+'0';
|
|
|
|
|
2008-08-20 09:27:17 +00:00
|
|
|
if ((fil = kopen4loadfrommod(fn,0)) == -1) return(-1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
walock[TILE_LOADSHOT] = 255;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
|
|
|
|
if (kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt;
|
2006-04-28 00:46:09 +00:00
|
|
|
g_szBuf[bv]=0;
|
2006-09-19 23:02:33 +00:00
|
|
|
// AddLog(g_szBuf);
|
2006-04-28 00:46:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&bv,4,1,fil) != 1) goto corrupt;
|
2008-07-20 11:03:57 +00:00
|
|
|
/* if (bv != BYTEVERSION)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
P_DoQuote(114,g_player[myconnectindex].ps);
|
2008-07-20 11:03:57 +00:00
|
|
|
kclose(fil);
|
|
|
|
return 1;
|
|
|
|
}*/
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
if (kdfread(&saveh->numplr,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
if (kdfread(saveh->name,19,1,fil) != 1) goto corrupt;
|
2009-04-26 05:57:42 +00:00
|
|
|
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;
|
2006-04-13 20:47:06 +00:00
|
|
|
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]);
|
2006-11-15 01:16:55 +00:00
|
|
|
tilesizx[TILE_LOADSHOT] = 200;
|
|
|
|
tilesizy[TILE_LOADSHOT] = 320;
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread((char *)waloff[TILE_LOADSHOT],320,200,fil) != 200) goto corrupt;
|
|
|
|
invalidatetile(TILE_LOADSHOT,0,255);
|
|
|
|
|
|
|
|
kclose(fil);
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
corrupt:
|
2006-04-16 03:42:36 +00:00
|
|
|
kclose(fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t G_LoadPlayer(int32_t spot)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t k;
|
2006-04-13 20:47:06 +00:00
|
|
|
char fn[13];
|
|
|
|
char mpfn[13];
|
2007-08-31 06:18:56 +00:00
|
|
|
char *fnptr, *scriptptrs;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t fil, bv, i, x;
|
2008-06-10 19:28:56 +00:00
|
|
|
intptr_t j;
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t nump;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
strcpy(fn, "egam0.sav");
|
|
|
|
strcpy(mpfn, "egamA_00.sav");
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (spot < 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
multiflag = 1;
|
|
|
|
multiwhat = 0;
|
|
|
|
multipos = -spot-1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (multiflag == 2 && multiwho != myconnectindex)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
fnptr = mpfn;
|
|
|
|
mpfn[4] = spot + 'A';
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.multimode > 9)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
mpfn[6] = (multiwho/10) + '0';
|
|
|
|
mpfn[7] = (multiwho%10) + '0';
|
|
|
|
}
|
|
|
|
else mpfn[7] = multiwho + '0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fnptr = fn;
|
|
|
|
fn[4] = spot + '0';
|
|
|
|
}
|
|
|
|
|
2008-08-20 09:27:17 +00:00
|
|
|
if ((fil = kopen4loadfrommod(fnptr,0)) == -1) return(-1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
ready2send = 0;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
|
|
|
|
if (kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt;
|
2006-04-28 00:46:09 +00:00
|
|
|
g_szBuf[bv]=0;
|
2006-09-19 23:02:33 +00:00
|
|
|
// AddLog(g_szBuf);
|
2006-04-28 00:46:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&bv,4,1,fil) != 1) return -1;
|
2007-08-27 23:11:49 +00:00
|
|
|
if (bv != BYTEVERSION)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
P_DoQuote(114,g_player[myconnectindex].ps);
|
2006-04-13 20:47:06 +00:00
|
|
|
kclose(fil);
|
|
|
|
ototalclock = totalclock;
|
|
|
|
ready2send = 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (kdfread(&nump,sizeof(nump),1,fil) != 1) return -1;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (nump != ud.multimode)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
kclose(fil);
|
|
|
|
ototalclock = totalclock;
|
|
|
|
ready2send = 1;
|
2008-11-20 14:06:36 +00:00
|
|
|
P_DoQuote(124,g_player[myconnectindex].ps);
|
2006-04-13 20:47:06 +00:00
|
|
|
return 1;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
else ud.multimode = nump;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (numplayers > 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
pub = NUMPAGES;
|
|
|
|
pus = NUMPAGES;
|
2008-11-20 14:06:36 +00:00
|
|
|
G_UpdateScreenArea();
|
|
|
|
G_DrawBackground();
|
2006-04-13 20:47:06 +00:00
|
|
|
menutext(160,100,0,0,"LOADING...");
|
|
|
|
nextpage();
|
|
|
|
}
|
|
|
|
|
2009-02-28 07:44:54 +00:00
|
|
|
Net_WaitForEverybody();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
FX_StopAllSounds();
|
2008-11-20 14:06:36 +00:00
|
|
|
S_ClearSoundLocks();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
if (numplayers > 1)
|
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&buf,19,1,fil) != 1) goto corrupt;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&ud.savegame[spot][0],19,1,fil) != 1) goto corrupt;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2008-09-15 02:47:02 +00:00
|
|
|
Bmemcpy(¤tboardfilename[0],&boardfilename[0],BMAX_PATH);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
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]);
|
2006-11-15 01:16:55 +00:00
|
|
|
tilesizx[TILE_LOADSHOT] = 200;
|
|
|
|
tilesizy[TILE_LOADSHOT] = 320;
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread((char *)waloff[TILE_LOADSHOT],320,200,fil) != 200) goto corrupt;
|
|
|
|
invalidatetile(TILE_LOADSHOT,0,255);
|
|
|
|
|
|
|
|
if (kdfread(&numwalls,2,1,fil) != 1) goto corrupt;
|
|
|
|
if (kdfread(&wall[0],sizeof(walltype),MAXWALLS,fil) != MAXWALLS) goto corrupt;
|
|
|
|
if (kdfread(&numsectors,2,1,fil) != 1) goto corrupt;
|
|
|
|
if (kdfread(§or[0],sizeof(sectortype),MAXSECTORS,fil) != MAXSECTORS) goto corrupt;
|
|
|
|
if (kdfread(&sprite[0],sizeof(spritetype),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
2009-01-10 07:38:50 +00:00
|
|
|
if (kdfread(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
2009-04-23 07:09:24 +00:00
|
|
|
|
|
|
|
#ifdef POLYMER
|
2009-04-12 17:22:24 +00:00
|
|
|
if (kdfread(&staticlightcount,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
2009-04-23 07:09:24 +00:00
|
|
|
if (kdfread(&staticlights[0],sizeof(_prlight),staticlightcount,fil) != staticlightcount) goto corrupt;
|
|
|
|
#else
|
|
|
|
if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
|
|
|
#endif // POLYMER
|
2009-04-12 17:22:24 +00:00
|
|
|
|
2008-02-02 16:38:30 +00:00
|
|
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXSPRITES; i++)
|
2008-02-18 08:10:54 +00:00
|
|
|
if (spriteext[i].mdanimtims)
|
|
|
|
spriteext[i].mdanimtims+=mdtims;
|
2008-02-02 16:38:30 +00:00
|
|
|
#endif
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&headspritesect[0],2,MAXSECTORS+1,fil) != MAXSECTORS+1) goto corrupt;
|
|
|
|
if (kdfread(&prevspritesect[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
|
|
|
if (kdfread(&nextspritesect[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&headspritestat[STAT_DEFAULT],2,MAXSTATUS+1,fil) != MAXSTATUS+1) goto corrupt;
|
|
|
|
if (kdfread(&prevspritestat[STAT_DEFAULT],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
|
|
|
if (kdfread(&nextspritestat[STAT_DEFAULT],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
|
|
|
if (kdfread(&g_numCyclers,sizeof(g_numCyclers),1,fil) != 1) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&cyclers[0][0],12,MAXCYCLERS,fil) != MAXCYCLERS) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<nump; i++)
|
2008-11-20 14:06:36 +00:00
|
|
|
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;
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&animwall,sizeof(animwall),1,fil) != 1) goto corrupt;
|
2009-01-09 09:29:17 +00:00
|
|
|
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;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_numClouds,sizeof(g_numClouds),1,fil) != 1) goto corrupt;
|
2009-01-09 09:29:17 +00:00
|
|
|
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;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_scriptSize,sizeof(g_scriptSize),1,fil) != 1) goto corrupt;
|
|
|
|
if (!g_scriptSize) goto corrupt;
|
|
|
|
scriptptrs = Bcalloc(1,g_scriptSize * sizeof(scriptptrs));
|
2008-09-29 02:12:53 +00:00
|
|
|
Bfree(bitptr);
|
2009-01-09 09:29:17 +00:00
|
|
|
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;
|
2007-08-29 05:02:43 +00:00
|
|
|
if (script != NULL)
|
|
|
|
Bfree(script);
|
2008-11-20 14:06:36 +00:00
|
|
|
script = Bcalloc(1,g_scriptSize * sizeof(intptr_t));
|
|
|
|
if (kdfread(&script[0],sizeof(script),g_scriptSize,fil) != g_scriptSize) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_scriptSize; i++)
|
2008-09-12 02:07:44 +00:00
|
|
|
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)script[i]+(intptr_t)&script[0];
|
2006-04-16 03:42:36 +00:00
|
|
|
script[i] = j;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
if (kdfread(&actorscrptr[0],4,MAXTILES,fil) != MAXTILES) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXTILES; i++)
|
2006-11-13 23:12:47 +00:00
|
|
|
if (actorscrptr[i])
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)actorscrptr[i]+(intptr_t)&script[0];
|
|
|
|
actorscrptr[i] = (intptr_t *)j;
|
2006-04-16 03:42:36 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&actorLoadEventScrptr[0],4,MAXTILES,fil) != MAXTILES) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXTILES; i++)
|
2006-11-13 23:12:47 +00:00
|
|
|
if (actorLoadEventScrptr[i])
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)actorLoadEventScrptr[i]+(intptr_t)&script[0];
|
|
|
|
actorLoadEventScrptr[i] = (intptr_t *)j;
|
2006-04-16 03:42:36 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-08-28 23:15:11 +00:00
|
|
|
scriptptrs = Brealloc(scriptptrs, MAXSPRITES * sizeof(scriptptrs));
|
|
|
|
|
2007-08-29 04:01:21 +00:00
|
|
|
if (kdfread(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
2008-12-21 22:46:55 +00:00
|
|
|
if (kdfread(&ActorExtra[0],sizeof(ActorData_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXSPRITES; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)(&script[0]);
|
2006-11-14 21:35:50 +00:00
|
|
|
if (scriptptrs[i]&1) T2 += j;
|
|
|
|
if (scriptptrs[i]&2) T5 += j;
|
|
|
|
if (scriptptrs[i]&4) T6 += j;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_animateCount,sizeof(g_animateCount),1,fil) != 1) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&animatesect[0],2,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
2009-01-09 09:29:17 +00:00
|
|
|
if (kdfread(&animateptr[0],sizeof(int32_t),MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[0]));
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(&animategoal[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
|
|
|
if (kdfread(&animatevel[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_earthquakeTime,sizeof(g_earthquakeTime),1,fil) != 1) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
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(&connecthead,sizeof(connecthead),1,fil) != 1) goto corrupt;
|
|
|
|
if (kdfread(connectpoint2,sizeof(connectpoint2),1,fil) != 1) goto corrupt;
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil) != 1) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXPLAYERS; i++)
|
2009-01-09 09:29:17 +00:00
|
|
|
if (kdfread((int16_t *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil) != 1) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
if (kdfread(&randomseed,sizeof(randomseed),1,fil) != 1) goto corrupt;
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_globalRandom,sizeof(g_globalRandom),1,fil) != 1) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
if (kdfread(¶llaxyscale,sizeof(parallaxyscale),1,fil) != 1) goto corrupt;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&ProjectileData[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt;
|
|
|
|
if (kdfread(&DefaultProjectileData[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&SpriteFlags[0],sizeof(SpriteFlags[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&SpriteCacheList[0],sizeof(SpriteCacheList[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i != MAXQUOTES)
|
2006-04-24 04:57:04 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (ScriptQuotes[i] != NULL)
|
|
|
|
Bfree(ScriptQuotes[i]);
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
ScriptQuotes[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread((char *)ScriptQuotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
|
2009-01-09 09:29:17 +00:00
|
|
|
if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt;
|
2006-04-24 05:42:29 +00:00
|
|
|
}
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_numQuoteRedefinitions,sizeof(g_numQuoteRedefinitions),1,fil) != 1) goto corrupt;
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_numQuoteRedefinitions; i++)
|
2006-04-24 04:57:04 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (ScriptQuoteRedefinitions[i] != NULL)
|
|
|
|
Bfree(ScriptQuoteRedefinitions[i]);
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
ScriptQuoteRedefinitions[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread((char *)ScriptQuoteRedefinitions[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
|
2006-04-24 05:42:29 +00:00
|
|
|
}
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&DynamicTileMap[0],sizeof(DynamicTileMap[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
2006-04-25 22:50:57 +00:00
|
|
|
|
2006-05-04 03:14:49 +00:00
|
|
|
if (kdfread(&ud.noexits,sizeof(ud.noexits),1,fil) != 1) goto corrupt;
|
|
|
|
ud.m_noexits = ud.noexits;
|
|
|
|
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (Gv_ReadSave(fil)) goto corrupt;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
kclose(fil);
|
|
|
|
|
2007-08-27 06:46:31 +00:00
|
|
|
if (g_player[myconnectindex].ps->over_shoulder_on != 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
g_cameraDistance = 0;
|
|
|
|
g_cameraClock = 0;
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[myconnectindex].ps->over_shoulder_on = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
screenpeek = myconnectindex;
|
|
|
|
|
|
|
|
clearbufbyte(gotpic,sizeof(gotpic),0L);
|
2008-11-20 14:06:36 +00:00
|
|
|
S_ClearSoundLocks();
|
|
|
|
G_CacheMapData();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
i = g_musicIndex;
|
|
|
|
g_musicIndex = (ud.volume_number*MAXLEVELS) + ud.level_number;
|
2008-12-30 03:41:21 +00:00
|
|
|
|
|
|
|
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
char levname[BMAX_PATH];
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t fil;
|
2008-12-30 03:41:21 +00:00
|
|
|
|
|
|
|
strcpy(levname, boardfilename);
|
|
|
|
// usermap music based on map filename
|
|
|
|
Bcorrectfilename(levname,0);
|
|
|
|
p = Bstrrchr(levname,'.');
|
|
|
|
if (!p) strcat(levname,".ogg");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p[1]='o';
|
|
|
|
p[2]='g';
|
|
|
|
p[3]='g';
|
|
|
|
p[4]=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
fil = kopen4loadfrommod(levname,0);
|
|
|
|
|
|
|
|
if (fil > -1)
|
|
|
|
{
|
|
|
|
kclose(fil);
|
|
|
|
if (MapInfo[ud.level_number].musicfn1 == NULL)
|
2009-01-09 09:29:17 +00:00
|
|
|
MapInfo[ud.level_number].musicfn1 = Bcalloc(Bstrlen(levname)+1,sizeof(uint8_t));
|
2008-12-30 03:41:21 +00:00
|
|
|
else if ((Bstrlen(levname)+1) > sizeof(MapInfo[ud.level_number].musicfn1))
|
|
|
|
MapInfo[ud.level_number].musicfn1 = Brealloc(MapInfo[ud.level_number].musicfn1,(Bstrlen(levname)+1));
|
|
|
|
Bstrcpy(MapInfo[ud.level_number].musicfn1,levname);
|
|
|
|
}
|
|
|
|
else if (MapInfo[ud.level_number].musicfn1 != NULL)
|
|
|
|
{
|
|
|
|
Bfree(MapInfo[ud.level_number].musicfn1);
|
|
|
|
MapInfo[ud.level_number].musicfn1 = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
p[1]='m';
|
|
|
|
p[2]='i';
|
|
|
|
p[3]='d';
|
|
|
|
p[4]=0;
|
|
|
|
|
|
|
|
fil = kopen4loadfrommod(levname,0);
|
|
|
|
|
|
|
|
if (fil == -1)
|
|
|
|
Bsprintf(levname,"dethtoll.mid");
|
|
|
|
else kclose(fil);
|
|
|
|
|
|
|
|
if (MapInfo[ud.level_number].musicfn == NULL)
|
2009-01-09 09:29:17 +00:00
|
|
|
MapInfo[ud.level_number].musicfn = Bcalloc(Bstrlen(levname)+1,sizeof(uint8_t));
|
2008-12-30 03:41:21 +00:00
|
|
|
else if ((Bstrlen(levname)+1) > sizeof(MapInfo[ud.level_number].musicfn))
|
|
|
|
MapInfo[ud.level_number].musicfn = Brealloc(MapInfo[ud.level_number].musicfn,(Bstrlen(levname)+1));
|
|
|
|
Bstrcpy(MapInfo[ud.level_number].musicfn,levname);
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL && (i != g_musicIndex || MapInfo[MAXVOLUMES*MAXLEVELS+2].musicfn1))
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
|
|
|
MUSIC_StopSong();
|
2009-01-09 09:29:17 +00:00
|
|
|
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex);
|
2007-08-25 01:05:00 +00:00
|
|
|
}
|
2008-04-05 04:18:48 +00:00
|
|
|
MUSIC_Continue();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[myconnectindex].ps->gm = MODE_GAME;
|
2006-04-13 20:47:06 +00:00
|
|
|
ud.recstat = 0;
|
|
|
|
|
2007-08-27 06:46:31 +00:00
|
|
|
if (g_player[myconnectindex].ps->jetpack_on)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_JETPACK_IDLE,g_player[myconnectindex].ps->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
g_restorePalette = 1;
|
|
|
|
P_UpdateScreenPal(g_player[myconnectindex].ps);
|
|
|
|
G_UpdateScreenArea();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
FX_SetReverb(0);
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.lockout == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<g_numAnimWalls; x++)
|
2006-11-14 21:35:50 +00:00
|
|
|
if (wall[animwall[x].wallnum].extra >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<g_numAnimWalls; x++)
|
2008-11-20 14:06:36 +00:00
|
|
|
switch (DynamicTileMap[wall[animwall[x].wallnum].picnum])
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case FEMPIC1__STATIC:
|
|
|
|
wall[animwall[x].wallnum].picnum = BLANKSCREEN;
|
|
|
|
break;
|
|
|
|
case FEMPIC2__STATIC:
|
|
|
|
case FEMPIC3__STATIC:
|
|
|
|
wall[animwall[x].wallnum].picnum = SCREENBREAK6;
|
|
|
|
break;
|
2006-04-16 03:42:36 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
g_numInterpolations = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
startofdynamicinterpolations = 0;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
k = headspritestat[STAT_EFFECTOR];
|
2006-11-13 23:12:47 +00:00
|
|
|
while (k >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (sprite[k].lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 31:
|
2008-11-20 14:06:36 +00:00
|
|
|
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 32:
|
2008-11-20 14:06:36 +00:00
|
|
|
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 25:
|
2008-11-20 14:06:36 +00:00
|
|
|
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
|
|
|
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 17:
|
2008-11-20 14:06:36 +00:00
|
|
|
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
|
|
|
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 11:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
case 16:
|
|
|
|
case 26:
|
|
|
|
case 30:
|
2008-11-20 14:06:36 +00:00
|
|
|
Sect_SetInterpolation(k);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
k = nextspritestat[k];
|
|
|
|
}
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
|
|
|
|
for (i = g_animateCount-1; i>=0; i--)
|
2008-11-20 14:06:36 +00:00
|
|
|
G_SetInterpolation(animateptr[i]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
g_showShareware = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
everyothertime = 0;
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXPLAYERS; i++)
|
2007-08-27 06:46:31 +00:00
|
|
|
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Net_ResetPrediction();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
ready2send = 1;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
mmulti_flushpackets();
|
2006-04-13 20:47:06 +00:00
|
|
|
clearfifo();
|
2009-02-28 07:44:54 +00:00
|
|
|
Net_WaitForEverybody();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_ResetTimers();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-03-28 11:20:05 +00:00
|
|
|
#ifdef POLYMER
|
|
|
|
if (getrendermode() >= 4)
|
|
|
|
polymer_loadboard();
|
|
|
|
#endif
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
return(0);
|
|
|
|
corrupt:
|
2008-02-06 08:23:09 +00:00
|
|
|
Bsprintf(tempbuf,"Save game file \"%s\" is corrupt or of the wrong version.",fnptr);
|
2008-11-20 14:06:36 +00:00
|
|
|
G_GameExit(tempbuf);
|
2006-04-13 20:47:06 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t G_SavePlayer(int32_t spot)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i;
|
2008-06-10 19:28:56 +00:00
|
|
|
intptr_t j;
|
2006-04-13 20:47:06 +00:00
|
|
|
char fn[13];
|
|
|
|
char mpfn[13];
|
2007-08-31 06:18:56 +00:00
|
|
|
char *fnptr, *scriptptrs;
|
2006-04-13 20:47:06 +00:00
|
|
|
FILE *fil;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t bv = BYTEVERSION;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
strcpy(fn, "egam0.sav");
|
|
|
|
strcpy(mpfn, "egamA_00.sav");
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (spot < 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
multiflag = 1;
|
|
|
|
multiwhat = 1;
|
|
|
|
multipos = -spot-1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-02-28 07:44:54 +00:00
|
|
|
Net_WaitForEverybody();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (multiflag == 2 && multiwho != myconnectindex)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
fnptr = mpfn;
|
|
|
|
mpfn[4] = spot + 'A';
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.multimode > 9)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
mpfn[6] = (multiwho/10) + '0';
|
|
|
|
mpfn[7] = multiwho + '0';
|
|
|
|
}
|
|
|
|
else mpfn[7] = multiwho + '0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fnptr = fn;
|
|
|
|
fn[4] = spot + '0';
|
|
|
|
}
|
|
|
|
|
2008-08-20 09:27:17 +00:00
|
|
|
{
|
|
|
|
char temp[BMAX_PATH];
|
2008-08-20 09:38:36 +00:00
|
|
|
if (mod_dir[0] != '/')
|
|
|
|
Bsprintf(temp,"%s/%s",mod_dir,fnptr);
|
|
|
|
else Bsprintf(temp,"%s",fnptr);
|
2008-08-20 09:27:17 +00:00
|
|
|
if ((fil = fopen(temp,"wb")) == 0) return(-1);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
ready2send = 0;
|
|
|
|
|
2006-04-28 00:46:09 +00:00
|
|
|
Bsprintf(g_szBuf,"EDuke32");
|
|
|
|
i=strlen(g_szBuf);
|
|
|
|
dfwrite(&i,sizeof(i),1,fil);
|
|
|
|
dfwrite(g_szBuf,i,1,fil);
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&bv,4,1,fil);
|
|
|
|
dfwrite(&ud.multimode,sizeof(ud.multimode),1,fil);
|
|
|
|
|
|
|
|
dfwrite(&ud.savegame[spot][0],19,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);
|
2008-09-15 02:47:02 +00:00
|
|
|
dfwrite(¤tboardfilename[0],BMAX_PATH,1,fil);
|
2006-11-15 01:16:55 +00:00
|
|
|
if (!waloff[TILE_SAVESHOT])
|
|
|
|
{
|
2006-04-16 03:42:36 +00:00
|
|
|
walock[TILE_SAVESHOT] = 254;
|
2008-02-16 22:27:08 +00:00
|
|
|
allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
|
2006-04-16 03:42:36 +00:00
|
|
|
clearbuf((void*)waloff[TILE_SAVESHOT],(200*320)/4,0);
|
|
|
|
walock[TILE_SAVESHOT] = 1;
|
|
|
|
}
|
|
|
|
dfwrite((char *)waloff[TILE_SAVESHOT],320,200,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
dfwrite(&numwalls,2,1,fil);
|
|
|
|
dfwrite(&wall[0],sizeof(walltype),MAXWALLS,fil);
|
|
|
|
dfwrite(&numsectors,2,1,fil);
|
|
|
|
dfwrite(§or[0],sizeof(sectortype),MAXSECTORS,fil);
|
|
|
|
dfwrite(&sprite[0],sizeof(spritetype),MAXSPRITES,fil);
|
2008-02-02 16:38:30 +00:00
|
|
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXSPRITES; i++)
|
2008-02-18 08:10:54 +00:00
|
|
|
if (spriteext[i].mdanimtims)
|
|
|
|
{
|
|
|
|
spriteext[i].mdanimtims=spriteext[i].mdanimtims-mdtims;
|
|
|
|
if (!spriteext[i].mdanimtims)
|
|
|
|
spriteext[i].mdanimtims++;
|
|
|
|
}
|
2008-02-02 16:38:30 +00:00
|
|
|
#endif
|
2009-01-10 07:38:50 +00:00
|
|
|
dfwrite(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil);
|
2009-04-23 07:09:24 +00:00
|
|
|
|
|
|
|
#ifdef POLYMER
|
2009-04-12 17:22:24 +00:00
|
|
|
dfwrite(&staticlightcount,sizeof(int32_t),1,fil);
|
2009-04-23 07:09:24 +00:00
|
|
|
dfwrite(&staticlights[0],sizeof(_prlight),staticlightcount,fil);
|
|
|
|
#else
|
|
|
|
i = 0;
|
|
|
|
dfwrite(&i,sizeof(int32_t),1,fil);
|
|
|
|
#endif // POLYMER
|
|
|
|
|
2008-02-02 16:38:30 +00:00
|
|
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXSPRITES; i++)if (spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims;
|
2008-02-02 16:38:30 +00:00
|
|
|
#endif
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&headspritesect[0],2,MAXSECTORS+1,fil);
|
|
|
|
dfwrite(&prevspritesect[0],2,MAXSPRITES,fil);
|
|
|
|
dfwrite(&nextspritesect[0],2,MAXSPRITES,fil);
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&headspritestat[STAT_DEFAULT],2,MAXSTATUS+1,fil);
|
|
|
|
dfwrite(&prevspritestat[STAT_DEFAULT],2,MAXSPRITES,fil);
|
|
|
|
dfwrite(&nextspritestat[STAT_DEFAULT],2,MAXSPRITES,fil);
|
|
|
|
dfwrite(&g_numCyclers,sizeof(g_numCyclers),1,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&cyclers[0][0],12,MAXCYCLERS,fil);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<ud.multimode; i++)
|
2008-11-20 14:06:36 +00:00
|
|
|
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);
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&animwall,sizeof(animwall),1,fil);
|
2009-01-09 09:29:17 +00:00
|
|
|
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);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_numClouds,sizeof(g_numClouds),1,fil);
|
2009-01-09 09:29:17 +00:00
|
|
|
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);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_scriptSize,sizeof(g_scriptSize),1,fil);
|
|
|
|
scriptptrs = Bcalloc(1, g_scriptSize * sizeof(scriptptrs));
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_scriptSize; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-09-12 02:07:44 +00:00
|
|
|
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-09-12 02:07:44 +00:00
|
|
|
// scriptptrs[i] = 1;
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)script[i] - (intptr_t)&script[0];
|
2006-04-13 20:47:06 +00:00
|
|
|
script[i] = j;
|
|
|
|
}
|
2008-09-12 02:07:44 +00:00
|
|
|
// else scriptptrs[i] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
// dfwrite(&scriptptrs[0],sizeof(scriptptrs),g_scriptSize,fil);
|
2009-01-09 09:29:17 +00:00
|
|
|
dfwrite(&bitptr[0],sizeof(uint8_t),(g_scriptSize+7)>>3,fil);
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&script[0],sizeof(script),g_scriptSize,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_scriptSize; i++)
|
2008-09-12 02:07:44 +00:00
|
|
|
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = script[i]+(intptr_t)&script[0];
|
2006-04-16 03:42:36 +00:00
|
|
|
script[i] = j;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXTILES; i++)
|
2006-11-13 23:12:47 +00:00
|
|
|
if (actorscrptr[i])
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)actorscrptr[i]-(intptr_t)&script[0];
|
|
|
|
actorscrptr[i] = (intptr_t *)j;
|
2006-04-16 03:42:36 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&actorscrptr[0],4,MAXTILES,fil);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXTILES; i++)
|
2006-11-13 23:12:47 +00:00
|
|
|
if (actorscrptr[i])
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)actorscrptr[i]+(intptr_t)&script[0];
|
|
|
|
actorscrptr[i] = (intptr_t *)j;
|
2006-04-16 03:42:36 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXTILES; i++)
|
2006-11-13 23:12:47 +00:00
|
|
|
if (actorLoadEventScrptr[i])
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)actorLoadEventScrptr[i]-(intptr_t)&script[0];
|
|
|
|
actorLoadEventScrptr[i] = (intptr_t *)j;
|
2006-04-16 03:42:36 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&actorLoadEventScrptr[0],4,MAXTILES,fil);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXTILES; i++)
|
2006-11-13 23:12:47 +00:00
|
|
|
if (actorLoadEventScrptr[i])
|
2006-04-16 03:42:36 +00:00
|
|
|
{
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)actorLoadEventScrptr[i]+(intptr_t)&script[0];
|
|
|
|
actorLoadEventScrptr[i] = (intptr_t *)j;
|
2006-04-16 03:42:36 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-09-29 02:12:53 +00:00
|
|
|
Bfree(scriptptrs);
|
|
|
|
scriptptrs = Bcalloc(1, MAXSPRITES * sizeof(scriptptrs));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXSPRITES; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
scriptptrs[i] = 0;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (actorscrptr[PN] == 0) continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)&script[0];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (T2 >= j && T2 < (intptr_t)(&script[g_scriptSize]))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
scriptptrs[i] |= 1;
|
|
|
|
T2 -= j;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
if (T5 >= j && T5 < (intptr_t)(&script[g_scriptSize]))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
scriptptrs[i] |= 2;
|
|
|
|
T5 -= j;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
if (T6 >= j && T6 < (intptr_t)(&script[g_scriptSize]))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
scriptptrs[i] |= 4;
|
|
|
|
T6 -= j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-29 04:01:21 +00:00
|
|
|
dfwrite(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil);
|
2008-12-21 22:46:55 +00:00
|
|
|
dfwrite(&ActorExtra[0],sizeof(ActorData_t),MAXSPRITES,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXSPRITES; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (actorscrptr[PN] == 0) continue;
|
2008-06-10 19:28:56 +00:00
|
|
|
j = (intptr_t)&script[0];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (scriptptrs[i]&1)
|
2006-04-13 20:47:06 +00:00
|
|
|
T2 += j;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (scriptptrs[i]&2)
|
2006-04-13 20:47:06 +00:00
|
|
|
T5 += j;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (scriptptrs[i]&4)
|
2006-04-13 20:47:06 +00:00
|
|
|
T6 += j;
|
|
|
|
}
|
|
|
|
|
|
|
|
dfwrite(&lockclock,sizeof(lockclock),1,fil);
|
|
|
|
dfwrite(&pskybits,sizeof(pskybits),1,fil);
|
|
|
|
dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil);
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_animateCount,sizeof(g_animateCount),1,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&animatesect[0],2,MAXANIMATES,fil);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(§or[0]));
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&animateptr[0],4,MAXANIMATES,fil);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[0]));
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(&animategoal[0],4,MAXANIMATES,fil);
|
|
|
|
dfwrite(&animatevel[0],4,MAXANIMATES,fil);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_earthquakeTime,sizeof(g_earthquakeTime),1,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
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(&connecthead,sizeof(connecthead),1,fil);
|
|
|
|
dfwrite(connectpoint2,sizeof(connectpoint2),1,fil);
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXPLAYERS; i++)
|
2009-01-09 09:29:17 +00:00
|
|
|
dfwrite((int16_t *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
dfwrite(&randomseed,sizeof(randomseed),1,fil);
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_globalRandom,sizeof(g_globalRandom),1,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
dfwrite(¶llaxyscale,sizeof(parallaxyscale),1,fil);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&ProjectileData[0],sizeof(projectile_t),MAXTILES,fil);
|
|
|
|
dfwrite(&DefaultProjectileData[0],sizeof(projectile_t),MAXTILES,fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&SpriteFlags[0],sizeof(SpriteFlags[0]),MAXTILES,fil);
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&SpriteCacheList[0],sizeof(SpriteCacheList[0]),MAXTILES,fil);
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXQUOTES; i++)
|
2006-04-24 04:57:04 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (ScriptQuotes[i] != NULL)
|
2006-04-24 04:57:04 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
dfwrite(&i,sizeof(int32_t),1,fil);
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(ScriptQuotes[i],MAXQUOTELEN, 1, fil);
|
2006-04-24 04:57:04 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-09 09:29:17 +00:00
|
|
|
dfwrite(&i,sizeof(int32_t),1,fil);
|
2006-04-24 04:57:04 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_numQuoteRedefinitions,sizeof(g_numQuoteRedefinitions),1,fil);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_numQuoteRedefinitions; i++)
|
2006-04-24 04:57:04 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (ScriptQuoteRedefinitions[i] != NULL)
|
|
|
|
dfwrite(ScriptQuoteRedefinitions[i],MAXQUOTELEN, 1, fil);
|
2006-04-24 04:57:04 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&DynamicTileMap[0],sizeof(DynamicTileMap[0]),MAXTILES,fil);
|
2006-04-25 22:50:57 +00:00
|
|
|
|
2006-05-04 03:14:49 +00:00
|
|
|
dfwrite(&ud.noexits,sizeof(ud.noexits),1,fil);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_WriteSave(fil);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
fclose(fil);
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.multimode < 2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
strcpy(ScriptQuotes[122],"GAME SAVED");
|
|
|
|
P_DoQuote(122,g_player[myconnectindex].ps);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ready2send = 1;
|
|
|
|
|
2009-02-28 07:44:54 +00:00
|
|
|
Net_WaitForEverybody();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
ototalclock = totalclock;
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|