2010-08-02 08:13:51 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
|
|
|
|
|
|
|
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
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-08-02 08:13:51 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef __savegame_h__
|
|
|
|
#define __savegame_h__
|
|
|
|
|
2014-05-17 12:36:40 +00:00
|
|
|
#include "game.h"
|
|
|
|
|
2013-05-19 19:29:18 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
# define SV_MAJOR_VER 2
|
|
|
|
#else
|
|
|
|
# define SV_MAJOR_VER 1
|
|
|
|
#endif
|
2012-03-14 22:31:49 +00:00
|
|
|
#define SV_MINOR_VER 3
|
2011-12-25 15:34:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#pragma pack(push,1)
|
2011-12-25 15:34:06 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char headerstr[11];
|
|
|
|
uint8_t majorver, minorver, ptrsize;
|
|
|
|
uint16_t bytever;
|
|
|
|
// 16 bytes
|
|
|
|
|
|
|
|
uint8_t comprthres;
|
|
|
|
uint8_t recdiffsp, diffcompress, synccompress;
|
|
|
|
// 4 bytes
|
|
|
|
|
|
|
|
int32_t reccnt, snapsiz;
|
|
|
|
// 8 bytes
|
|
|
|
|
2014-05-17 12:36:40 +00:00
|
|
|
char savename[MAXSAVEGAMENAME];
|
2011-12-25 15:34:06 +00:00
|
|
|
uint8_t numplayers, volnum, levnum, skill;
|
2014-09-07 18:10:15 +00:00
|
|
|
char boardfn[BMAX_PATH];
|
2011-12-25 15:34:06 +00:00
|
|
|
// 282 bytes
|
2013-08-04 20:37:45 +00:00
|
|
|
} savehead_t;
|
2010-08-02 08:13:51 +00:00
|
|
|
#pragma pack(pop)
|
|
|
|
|
2013-08-04 20:37:45 +00:00
|
|
|
EDUKE32_STATIC_ASSERT(sizeof(savehead_t) == 310);
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t sv_updatestate(int32_t frominit);
|
|
|
|
int32_t sv_readdiff(int32_t fil);
|
|
|
|
uint32_t sv_writediff(FILE *fil);
|
2011-12-25 15:34:06 +00:00
|
|
|
int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h);
|
|
|
|
int32_t sv_loadsnapshot(int32_t fil, int32_t spot, savehead_t *h);
|
|
|
|
int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress);
|
2010-08-02 08:13:51 +00:00
|
|
|
void sv_freemem();
|
|
|
|
int32_t G_SavePlayer(int32_t spot);
|
|
|
|
int32_t G_LoadPlayer(int32_t spot);
|
2011-12-25 15:34:06 +00:00
|
|
|
int32_t G_LoadSaveHeaderNew(int32_t spot, savehead_t *saveh);
|
|
|
|
//int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh);
|
2010-08-02 08:13:51 +00:00
|
|
|
void ReadSaveGameHeaders(void);
|
2012-09-05 17:25:43 +00:00
|
|
|
void G_SavePlayerMaybeMulti(int32_t slot);
|
|
|
|
void G_LoadPlayerMaybeMulti(int32_t slot);
|
2012-03-11 17:37:08 +00:00
|
|
|
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
extern void sv_postyaxload(void);
|
|
|
|
#endif
|
|
|
|
|
2012-11-13 10:50:06 +00:00
|
|
|
// XXX: The 'bitptr' decl really belongs into gamedef.h, but we don't want to
|
|
|
|
// pull all of it in savegame.c?
|
2010-08-02 08:13:51 +00:00
|
|
|
extern char *bitptr;
|
2014-05-17 12:36:40 +00:00
|
|
|
extern uint8_t g_oldverSavegame[MAXSAVEGAMES];
|
2011-07-29 22:07:49 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
P2I_BACK_BIT = 1,
|
|
|
|
P2I_ONLYNON0_BIT = 2,
|
|
|
|
|
|
|
|
P2I_FWD = 0,
|
|
|
|
P2I_BACK = 1,
|
|
|
|
|
|
|
|
P2I_FWD_NON0 = 0+2,
|
|
|
|
P2I_BACK_NON0 = 1+2,
|
|
|
|
};
|
2012-11-11 17:57:01 +00:00
|
|
|
void G_Util_PtrToIdx(void *ptr, int32_t count, const void *base, int32_t mode);
|
|
|
|
void G_Util_PtrToIdx2(void *ptr, int32_t count, size_t stride, const void *base, int32_t mode);
|
2011-07-29 22:07:49 +00:00
|
|
|
|
2013-10-27 21:12:22 +00:00
|
|
|
#ifdef LUNATIC
|
2014-01-31 21:13:03 +00:00
|
|
|
extern const char *(*El_SerializeGamevars)(int32_t *slenptr, int32_t levelnum);
|
2013-10-27 21:12:22 +00:00
|
|
|
#endif
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#endif
|