mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 02:15:32 +00:00
added secondary saved game header record
This commit is contained in:
parent
1c7a4d4b3a
commit
dc75627d53
4 changed files with 81 additions and 0 deletions
|
@ -40,6 +40,7 @@ add_component_dir (esm
|
||||||
loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpcc
|
loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpcc
|
||||||
loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat
|
loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat
|
||||||
loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref filter
|
loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref filter
|
||||||
|
savedgame
|
||||||
)
|
)
|
||||||
|
|
||||||
add_component_dir (misc
|
add_component_dir (misc
|
||||||
|
|
|
@ -83,6 +83,9 @@ enum RecNameInts
|
||||||
REC_STAT = 0x54415453,
|
REC_STAT = 0x54415453,
|
||||||
REC_WEAP = 0x50414557,
|
REC_WEAP = 0x50414557,
|
||||||
|
|
||||||
|
// format 0 - saved games
|
||||||
|
REC_SAVE = 0x45564153,
|
||||||
|
|
||||||
// format 1
|
// format 1
|
||||||
REC_FILT = 0x544C4946
|
REC_FILT = 0x544C4946
|
||||||
};
|
};
|
||||||
|
|
36
components/esm/savedgame.cpp
Normal file
36
components/esm/savedgame.cpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
#include "savedgame.hpp"
|
||||||
|
|
||||||
|
#include "esmreader.hpp"
|
||||||
|
#include "esmwriter.hpp"
|
||||||
|
#include "defs.hpp"
|
||||||
|
|
||||||
|
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE;
|
||||||
|
|
||||||
|
void ESM::SavedGame::load (ESMReader &esm)
|
||||||
|
{
|
||||||
|
mPlayerName = esm.getHNString("PNAM");
|
||||||
|
esm.getHNOT (mPlayerLevel, "PLEV");
|
||||||
|
mPlayerClass = esm.getHNString("PCLA");
|
||||||
|
mPlayerCell = esm.getHNString("PCEL");
|
||||||
|
esm.getHNT (mInGameTime, "TSTM", 16);
|
||||||
|
esm.getHNT (mTimePlayed, "TIME");
|
||||||
|
|
||||||
|
while (esm.isNextSub ("DEPE"))
|
||||||
|
mContentFiles.push_back (esm.getHString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ESM::SavedGame::save (ESMWriter &esm) const
|
||||||
|
{
|
||||||
|
esm.writeHNCString (mPlayerName, "PNAM");
|
||||||
|
esm.writeHNT ("PLEV", mPlayerLevel);
|
||||||
|
esm.writeHNCString (mPlayerClass, "PCLA");
|
||||||
|
esm.writeHNCString (mPlayerCell, "PCEL");
|
||||||
|
esm.writeHNT ("TSTM", mInGameTime, 16);
|
||||||
|
esm.writeHNT ("TIME", mTimePlayed);
|
||||||
|
|
||||||
|
for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
|
||||||
|
iter!=mContentFiles.end(); ++iter)
|
||||||
|
esm.writeHNCString (*iter, "DEPE");
|
||||||
|
|
||||||
|
}
|
41
components/esm/savedgame.hpp
Normal file
41
components/esm/savedgame.hpp
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#ifndef OPENMW_ESM_SAVEDGAME_H
|
||||||
|
#define OPENMW_ESM_SAVEDGAME_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace ESM
|
||||||
|
{
|
||||||
|
class ESMReader;
|
||||||
|
class ESMWriter;
|
||||||
|
|
||||||
|
// format 0, saved games only
|
||||||
|
|
||||||
|
struct SavedGame
|
||||||
|
{
|
||||||
|
static unsigned int sRecordId;
|
||||||
|
|
||||||
|
struct TimeStamp
|
||||||
|
{
|
||||||
|
float mGameHour;
|
||||||
|
int mDay;
|
||||||
|
int mMonth;
|
||||||
|
int mYear;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::string> mContentFiles;
|
||||||
|
std::string mPlayerName;
|
||||||
|
int mPlayerLevel;
|
||||||
|
std::string mPlayerClass;
|
||||||
|
std::string mPlayerCell;
|
||||||
|
TimeStamp mInGameTime;
|
||||||
|
float mTimePlayed;
|
||||||
|
|
||||||
|
/// \todo add field for screenshot
|
||||||
|
|
||||||
|
void load (ESMReader &esm);
|
||||||
|
void save (ESMWriter &esm) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue