Rev 4766 | 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 | |||
4747 | terminx | 23 | #ifndef savegame_h_ |
24 | #define savegame_h_ |
||
1677 | terminx | 25 | |
4472 | hendricks2 | 26 | #include "game.h" |
27 | |||
4766 | hendricks2 | 28 | #ifdef __cplusplus |
29 | extern "C" { |
||
30 | #endif |
||
31 | |||
3789 | helixhorne | 32 | #ifdef LUNATIC |
33 | # define SV_MAJOR_VER 2 |
||
34 | #else |
||
35 | # define SV_MAJOR_VER 1 |
||
36 | #endif |
||
2483 | helixhorne | 37 | #define SV_MINOR_VER 3 |
2207 | helixhorne | 38 | |
1677 | terminx | 39 | #pragma pack(push,1) |
2207 | helixhorne | 40 | typedef struct |
41 | { |
||
42 | char headerstr[11]; |
||
43 | uint8_t majorver, minorver, ptrsize; |
||
44 | uint16_t bytever; |
||
45 | // 16 bytes |
||
46 | |||
47 | uint8_t comprthres; |
||
48 | uint8_t recdiffsp, diffcompress, synccompress; |
||
49 | // 4 bytes |
||
50 | |||
51 | int32_t reccnt, snapsiz; |
||
52 | // 8 bytes |
||
53 | |||
4472 | hendricks2 | 54 | char savename[MAXSAVEGAMENAME]; |
2207 | helixhorne | 55 | uint8_t numplayers, volnum, levnum, skill; |
4589 | helixhorne | 56 | char boardfn[BMAX_PATH]; |
2207 | helixhorne | 57 | // 282 bytes |
4990 | terminx | 58 | #ifdef __ANDROID__ |
59 | char skillname[32], volname[32]; |
||
60 | #endif |
||
3975 | helixhorne | 61 | } savehead_t; |
1677 | terminx | 62 | #pragma pack(pop) |
63 | |||
4990 | terminx | 64 | #ifdef __ANDROID__ |
65 | #define SAVEHEAD_SIZE 374 |
||
66 | #else |
||
67 | #define SAVEHEAD_SIZE 310 |
||
68 | #endif |
||
3975 | helixhorne | 69 | |
4990 | terminx | 70 | EDUKE32_STATIC_ASSERT(sizeof(savehead_t) == SAVEHEAD_SIZE); |
71 | |||
1677 | terminx | 72 | int32_t sv_updatestate(int32_t frominit); |
73 | int32_t sv_readdiff(int32_t fil); |
||
74 | uint32_t sv_writediff(FILE *fil); |
||
2207 | helixhorne | 75 | int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h); |
76 | int32_t sv_loadsnapshot(int32_t fil, int32_t spot, savehead_t *h); |
||
77 | int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress); |
||
1677 | terminx | 78 | void sv_freemem(); |
79 | int32_t G_SavePlayer(int32_t spot); |
||
80 | int32_t G_LoadPlayer(int32_t spot); |
||
2207 | helixhorne | 81 | int32_t G_LoadSaveHeaderNew(int32_t spot, savehead_t *saveh); |
1677 | terminx | 82 | void ReadSaveGameHeaders(void); |
2999 | helixhorne | 83 | void G_SavePlayerMaybeMulti(int32_t slot); |
84 | void G_LoadPlayerMaybeMulti(int32_t slot); |
||
2449 | helixhorne | 85 | |
86 | #ifdef YAX_ENABLE |
||
87 | extern void sv_postyaxload(void); |
||
88 | #endif |
||
89 | |||
3156 | helixhorne | 90 | // XXX: The 'bitptr' decl really belongs into gamedef.h, but we don't want to |
91 | // pull all of it in savegame.c? |
||
1677 | terminx | 92 | extern char *bitptr; |
4472 | hendricks2 | 93 | extern uint8_t g_oldverSavegame[MAXSAVEGAMES]; |
1950 | helixhorne | 94 | |
95 | enum |
||
96 | { |
||
97 | P2I_BACK_BIT = 1, |
||
98 | P2I_ONLYNON0_BIT = 2, |
||
99 | |||
100 | P2I_FWD = 0, |
||
101 | P2I_BACK = 1, |
||
102 | |||
103 | P2I_FWD_NON0 = 0+2, |
||
104 | P2I_BACK_NON0 = 1+2, |
||
105 | }; |
||
3150 | helixhorne | 106 | void G_Util_PtrToIdx(void *ptr, int32_t count, const void *base, int32_t mode); |
107 | void G_Util_PtrToIdx2(void *ptr, int32_t count, size_t stride, const void *base, int32_t mode); |
||
1950 | helixhorne | 108 | |
4119 | helixhorne | 109 | #ifdef LUNATIC |
4286 | helixhorne | 110 | extern const char *(*El_SerializeGamevars)(int32_t *slenptr, int32_t levelnum); |
4766 | hendricks2 | 111 | void El_FreeSaveCode(void); |
1677 | terminx | 112 | #endif |
4119 | helixhorne | 113 | |
4990 | terminx | 114 | #ifdef __ANDROID__ |
115 | char const * G_GetStringFromSavegame(const char *filename, int type); |
||
116 | int32_t G_GetScreenshotFromSavegame(const char *filename, char *pal, char *data); |
||
117 | #endif |
||
118 | |||
4766 | hendricks2 | 119 | #ifdef __cplusplus |
120 | } |
||
4119 | helixhorne | 121 | #endif |
4766 | hendricks2 | 122 | |
123 | #endif |