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
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef savegame_h_
|
|
|
|
#define savegame_h_
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2014-05-17 12:36:40 +00:00
|
|
|
#include "game.h"
|
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
|
2013-05-19 19:29:18 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
# define SV_MAJOR_VER 2
|
|
|
|
#else
|
|
|
|
# define SV_MAJOR_VER 1
|
|
|
|
#endif
|
2018-08-09 16:06:49 +00:00
|
|
|
#define SV_MINOR_VER 7
|
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
|
|
|
|
|
2018-03-08 03:55:07 +00:00
|
|
|
uint32_t userbytever;
|
2018-08-09 16:06:49 +00:00
|
|
|
uint32_t scriptcrc;
|
2018-03-08 03:55:07 +00:00
|
|
|
|
2019-12-11 00:10:59 +00:00
|
|
|
uint8_t recdiffsp;
|
2011-12-25 15:34:06 +00:00
|
|
|
// 4 bytes
|
|
|
|
|
|
|
|
int32_t reccnt, snapsiz;
|
|
|
|
// 8 bytes
|
|
|
|
|
|
|
|
uint8_t numplayers, volnum, levnum, skill;
|
2018-03-08 03:55:07 +00:00
|
|
|
// 286 bytes
|
2018-03-08 03:55:02 +00:00
|
|
|
|
2019-11-30 18:23:54 +00:00
|
|
|
uint8_t getPtrSize() const { return ptrsize; }
|
2013-08-04 20:37:45 +00:00
|
|
|
} savehead_t;
|
2010-08-02 08:13:51 +00:00
|
|
|
#pragma pack(pop)
|
|
|
|
|
2019-11-30 18:23:54 +00:00
|
|
|
extern int32_t g_fakeSaveID;
|
2017-12-18 11:24:53 +00:00
|
|
|
extern bool g_saveRequested;
|
|
|
|
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t sv_updatestate(int32_t frominit);
|
2019-10-20 19:04:55 +00:00
|
|
|
int32_t sv_readdiff(FileReader& fil);
|
2019-11-07 23:26:14 +00:00
|
|
|
uint32_t sv_writediff(FileWriter *fil);
|
2019-10-20 19:04:55 +00:00
|
|
|
int32_t sv_loadheader(FileReader &fil, int32_t spot, savehead_t *h);
|
|
|
|
int32_t sv_loadsnapshot(FileReader &fil, int32_t spot, savehead_t *h);
|
2019-12-11 00:10:59 +00:00
|
|
|
int32_t sv_saveandmakesnapshot(FileWriter &fil, char const *name, int8_t spot, int8_t recdiffsp);
|
2010-08-02 08:13:51 +00:00
|
|
|
void sv_freemem();
|
2017-12-18 11:24:53 +00:00
|
|
|
int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh);
|
2010-08-02 08:13:51 +00:00
|
|
|
void ReadSaveGameHeaders(void);
|
2012-03-11 17:37:08 +00:00
|
|
|
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
extern void sv_postyaxload(void);
|
|
|
|
#endif
|
|
|
|
|
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,
|
|
|
|
};
|
2018-10-16 06:08:58 +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
|
|
|
|
2019-11-06 11:29:08 +00:00
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
END_DUKE_NS
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#endif
|