Subversion Repositories eduke32

Rev

Rev 2188 | Rev 2449 | 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
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
*/
21
//-------------------------------------------------------------------------
22
 
23
#ifndef __savegame_h__
24
#define __savegame_h__
25
 
2207 helixhorne 26
#define SV_MAJOR_VER 1
27
#define SV_MINOR_VER 1
28
 
1677 terminx 29
#pragma pack(push,1)
2207 helixhorne 30
# if 0
2188 helixhorne 31
struct savehead_
1677 terminx 32
{
1707 terminx 33
    char name[21];
2188 helixhorne 34
    int32_t byteversion;
1677 terminx 35
    int32_t numplr,volnum,levnum,plrskl;
36
    char boardfn[BMAX_PATH];
37
};
2207 helixhorne 38
# endif
39
 
40
 
41
typedef struct
42
{
43
    char headerstr[11];
44
    uint8_t majorver, minorver, ptrsize;
45
    uint16_t bytever;
46
    // 16 bytes
47
 
48
    uint8_t comprthres;
49
    uint8_t recdiffsp, diffcompress, synccompress;
50
    // 4 bytes
51
 
52
    int32_t reccnt, snapsiz;
53
    // 8 bytes
54
 
55
    char savename[22];  // should be of the same length as ud.savegame[i]
56
    uint8_t numplayers, volnum, levnum, skill;
57
    char boardfn[256];  // BMAX_PATH
58
    // 282 bytes
59
} savehead_t;  // 310 bytes
1677 terminx 60
#pragma pack(pop)
61
 
62
int32_t sv_updatestate(int32_t frominit);
63
int32_t sv_readdiff(int32_t fil);
64
uint32_t sv_writediff(FILE *fil);
2207 helixhorne 65
int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h);
66
int32_t sv_loadsnapshot(int32_t fil, int32_t spot, savehead_t *h);
67
int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress);
1677 terminx 68
void sv_freemem();
69
int32_t G_SavePlayer(int32_t spot);
70
int32_t G_LoadPlayer(int32_t spot);
2207 helixhorne 71
int32_t G_LoadSaveHeaderNew(int32_t spot, savehead_t *saveh);
72
//int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh);
1677 terminx 73
void ReadSaveGameHeaders(void);
74
extern char *bitptr;
1950 helixhorne 75
 
76
enum
77
{
78
    P2I_BACK_BIT = 1,
79
    P2I_ONLYNON0_BIT = 2,
80
 
81
    P2I_FWD = 0,
82
    P2I_BACK = 1,
83
 
84
    P2I_FWD_NON0 = 0+2,
85
    P2I_BACK_NON0 = 1+2,
86
};
87
void G_Util_PtrToIdx(void *ptr, uint32_t len, const void *base, int32_t mode);
88
 
1677 terminx 89
#endif