ScummVM API documentation
savegame.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * 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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef GRIM_SAVEGAME_H
23#define GRIM_SAVEGAME_H
24
25#include "common/savefile.h"
26
27#include "math/mathfwd.h"
28
29namespace Grim {
30
31class Color;
32
33class SaveGame {
34public:
35 static SaveGame *openForLoading(const Common::String &filename);
36 static SaveGame *openForSaving(const Common::String &filename);
37 ~SaveGame();
38
52
53 bool isCompatible() const;
54
55 uint saveMajorVersion() const;
56 uint saveMinorVersion() const;
57 uint32 beginSection(uint32 sectionTag);
58 void endSection();
59 void read(void *data, int size);
60 void write(const void *data, int size);
61 uint64 readLEUint64();
62 uint32 readLEUint32();
63 uint16 readLEUint16();
64 int32 readLESint32();
65 bool readBool();
66 byte readByte();
67 void writeLEUint64(uint64 data);
68 void writeLEUint32(uint32 data);
69 void writeLEUint16(uint16 data);
70 void writeLESint32(int32 data);
71 void writeBool(bool data);
72 void writeByte(byte data);
73 void writeString(const Common::String &string);
74
75 void writeVector3d(const Math::Vector3d &vec);
76 void writeColor(const Grim::Color &color);
77 void writeFloat(float data);
78 Math::Vector3d readVector3d();
79 Grim::Color readColor();
80 float readFloat();
81 Common::String readString();
82
83 void checkAlloc(int size);
84
85protected:
86 SaveGame();
87
88 uint _majorVersion;
89 uint _minorVersion;
90 bool _saving;
91 Common::InSaveFile *_inSaveFile;
92 Common::OutSaveFile *_outSaveFile;
93 uint32 _currentSection;
94 uint32 _sectionSize;
95 uint32 _sectionAlloc;
96 uint32 _sectionPtr;
97 byte *_sectionBuffer;
98
99 static const int _allocAmmount = 1048576;
100};
101
102} // end of namespace Grim
103
104#endif
Definition: savefile.h:54
Definition: stream.h:745
Definition: str.h:59
Definition: color.h:29
Definition: savegame.h:33
static uint SAVEGAME_MAJOR_VERSION
Definition: savegame.h:44
static uint SAVEGAME_MINOR_VERSION
Definition: savegame.h:51