Subversion Repositories eduke32

Rev

Rev 4541 | Rev 4712 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1677 terminx 1
//-------------------------------------------------------------------------
2
/*
3
Copyright (C) 2010 EDuke32 developers and contributors
4
 
5
This file is part of EDuke32.
6
 
7
EDuke32 is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License version 2
9
as published by the Free Software Foundation.
10
 
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 
15
See the GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
4541 hendricks2 19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
1677 terminx 20
*/
21
//-------------------------------------------------------------------------
22
 
23
#ifndef __savegame_h__
24
#define __savegame_h__
25
 
4472 hendricks2 26
#include "game.h"
27
 
3789 helixhorne 28
#ifdef LUNATIC
29
# define SV_MAJOR_VER 2
30
#else
31
# define SV_MAJOR_VER 1
32
#endif
2483 helixhorne 33
#define SV_MINOR_VER 3
2207 helixhorne 34
 
1677 terminx 35
#pragma pack(push,1)
2207 helixhorne 36
typedef struct
37
{
38
    char headerstr[11];
39
    uint8_t majorver, minorver, ptrsize;
40
    uint16_t bytever;
41
    // 16 bytes
42
 
43
    uint8_t comprthres;
44
    uint8_t recdiffsp, diffcompress, synccompress;
45
    // 4 bytes
46
 
47
    int32_t reccnt, snapsiz;
48
    // 8 bytes
49
 
4472 hendricks2 50
    char savename[MAXSAVEGAMENAME];
2207 helixhorne 51
    uint8_t numplayers, volnum, levnum, skill;
4589 helixhorne 52
    char boardfn[BMAX_PATH];
2207 helixhorne 53
    // 282 bytes
3975 helixhorne 54
} savehead_t;
1677 terminx 55
#pragma pack(pop)
56
 
3975 helixhorne 57
EDUKE32_STATIC_ASSERT(sizeof(savehead_t) == 310);
58
 
1677 terminx 59
int32_t sv_updatestate(int32_t frominit);
60
int32_t sv_readdiff(int32_t fil);
61
uint32_t sv_writediff(FILE *fil);
2207 helixhorne 62
int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h);
63
int32_t sv_loadsnapshot(int32_t fil, int32_t spot, savehead_t *h);
64
int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress);
1677 terminx 65
void sv_freemem();
66
int32_t G_SavePlayer(int32_t spot);
67
int32_t G_LoadPlayer(int32_t spot);
2207 helixhorne 68
int32_t G_LoadSaveHeaderNew(int32_t spot, savehead_t *saveh);
69
//int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh);
1677 terminx 70
void ReadSaveGameHeaders(void);
2999 helixhorne 71
void G_SavePlayerMaybeMulti(int32_t slot);
72
void G_LoadPlayerMaybeMulti(int32_t slot);
2449 helixhorne 73
 
74
#ifdef YAX_ENABLE
75
extern void sv_postyaxload(void);
76
#endif
77
 
3156 helixhorne 78
// XXX: The 'bitptr' decl really belongs into gamedef.h, but we don't want to
79
// pull all of it in savegame.c?
1677 terminx 80
extern char *bitptr;
4472 hendricks2 81
extern uint8_t g_oldverSavegame[MAXSAVEGAMES];
1950 helixhorne 82
 
83
enum
84
{
85
    P2I_BACK_BIT = 1,
86
    P2I_ONLYNON0_BIT = 2,
87
 
88
    P2I_FWD = 0,
89
    P2I_BACK = 1,
90
 
91
    P2I_FWD_NON0 = 0+2,
92
    P2I_BACK_NON0 = 1+2,
93
};
3150 helixhorne 94
void G_Util_PtrToIdx(void *ptr, int32_t count, const void *base, int32_t mode);
95
void G_Util_PtrToIdx2(void *ptr, int32_t count, size_t stride, const void *base, int32_t mode);
1950 helixhorne 96
 
4119 helixhorne 97
#ifdef LUNATIC
4286 helixhorne 98
extern const char *(*El_SerializeGamevars)(int32_t *slenptr, int32_t levelnum);
1677 terminx 99
#endif
4119 helixhorne 100
 
101
#endif