ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

savegame.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRIM_SAVEGAME_H
00024 #define GRIM_SAVEGAME_H
00025 
00026 #include "common/savefile.h"
00027 
00028 #include "math/mathfwd.h"
00029 
00030 namespace Grim {
00031 
00032 class Color;
00033 
00034 class SaveGame {
00035 public:
00036     static SaveGame *openForLoading(const Common::String &filename);
00037     static SaveGame *openForSaving(const Common::String &filename);
00038     ~SaveGame();
00039 
00045     static uint SAVEGAME_MAJOR_VERSION;
00052     static uint SAVEGAME_MINOR_VERSION;
00053 
00054     bool isCompatible() const;
00055 
00056     uint saveMajorVersion() const;
00057     uint saveMinorVersion() const;
00058     uint32 beginSection(uint32 sectionTag);
00059     void endSection();
00060     void read(void *data, int size);
00061     void write(const void *data, int size);
00062     uint64 readLEUint64();
00063     uint32 readLEUint32();
00064     uint16 readLEUint16();
00065     int32 readLESint32();
00066     bool readBool();
00067     byte readByte();
00068     void writeLEUint64(uint64 data);
00069     void writeLEUint32(uint32 data);
00070     void writeLEUint16(uint16 data);
00071     void writeLESint32(int32 data);
00072     void writeBool(bool data);
00073     void writeByte(byte data);
00074     void writeString(const Common::String &string);
00075 
00076     void writeVector3d(const Math::Vector3d &vec);
00077     void writeColor(const Grim::Color &color);
00078     void writeFloat(float data);
00079     Math::Vector3d readVector3d();
00080     Grim::Color readColor();
00081     float readFloat();
00082     Common::String readString();
00083 
00084     void checkAlloc(int size);
00085 
00086 protected:
00087     SaveGame();
00088 
00089     uint _majorVersion;
00090     uint _minorVersion;
00091     bool _saving;
00092     Common::InSaveFile *_inSaveFile;
00093     Common::OutSaveFile *_outSaveFile;
00094     uint32 _currentSection;
00095     uint32 _sectionSize;
00096     uint32 _sectionAlloc;
00097     uint32 _sectionPtr;
00098     byte *_sectionBuffer;
00099 
00100     static const int _allocAmmount = 1048576;
00101 };
00102 
00103 } // end of namespace Grim
00104 
00105 #endif


Generated on Sat Mar 16 2019 05:01:52 for ResidualVM by doxygen 1.7.1
curved edge   curved edge