/
p_saveg.h
102 lines (83 loc) · 2.68 KB
/
p_saveg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/** @file p_saveg.h Common game-save state management.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. 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 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/
#ifndef LIBCOMMON_SAVESTATE_H
#define LIBCOMMON_SAVESTATE_H
#ifdef __cplusplus
#include "common.h"
class MapStateReader;
class MapStateWriter;
DENG_EXTERN_C int saveToRealPlayerNum[MAXPLAYERS];
#if __JHEXEN__
typedef struct targetplraddress_s {
void **address;
struct targetplraddress_s *next;
} targetplraddress_t;
DENG_EXTERN_C targetplraddress_t *targetPlayerAddrs;
void SV_InitTargetPlayers();
void SV_ClearTargetPlayers();
#endif
/**
* Update mobj flag values from those used in legacy game-save formats
* to their current values.
*
* To be called after loading a legacy game-save for each mobj loaded.
*
* @param mo Mobj whoose flags are to be updated.
* @param ver The MOBJ save version to update from.
*/
void SV_TranslateLegacyMobjFlags(mobj_t *mo, int ver);
typedef struct playerheader_s {
int numPowers;
int numKeys;
int numFrags;
int numWeapons;
int numAmmoTypes;
int numPSprites;
#if __JDOOM64__ || __JHERETIC__ || __JHEXEN__
int numInvItemTypes;
#endif
#if __JHEXEN__
int numArmorTypes;
#endif
#ifdef __cplusplus
void write(Writer *writer);
void read(Reader *reader, int saveVersion);
#endif
} playerheader_t;
void SV_WriteLine(Line *line, MapStateWriter *msw);
void SV_ReadLine(Line *line, MapStateReader *msr);
void SV_WriteSector(Sector *sec, MapStateWriter *msw);
void SV_ReadSector(Sector *sec, MapStateReader *msr);
#endif // __cplusplus
#ifdef __cplusplus
extern "C" {
#endif
#if !__JHEXEN__
/**
* Saves a snapshot of the world, a still image.
* No data of movement is included (server sends it).
*/
void SV_SaveGameClient(uint gameId);
void SV_LoadGameClient(uint gameId);
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif // LIBCOMMON_SAVESTATE_H