mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:59:54 +00:00
added records for storing journals in saved game files
This commit is contained in:
parent
43f5f16731
commit
eec9821cd8
6 changed files with 116 additions and 1 deletions
|
@ -40,7 +40,7 @@ add_component_dir (esm
|
|||
loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpcc
|
||||
loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat
|
||||
loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref filter
|
||||
savedgame
|
||||
savedgame journalentry queststate
|
||||
)
|
||||
|
||||
add_component_dir (misc
|
||||
|
|
|
@ -85,6 +85,8 @@ enum RecNameInts
|
|||
|
||||
// format 0 - saved games
|
||||
REC_SAVE = 0x45564153,
|
||||
REC_JOUR = 0x524f55a4,
|
||||
REC_QUES = 0x53455551,
|
||||
|
||||
// format 1
|
||||
REC_FILT = 0x544C4946
|
||||
|
|
35
components/esm/journalentry.cpp
Normal file
35
components/esm/journalentry.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
#include "journalentry.hpp"
|
||||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
|
||||
void ESM::JournalEntry::load (ESMReader &esm)
|
||||
{
|
||||
esm.getHNOT (mType, "JETY");
|
||||
mTopic = esm.getHNString ("YETO");
|
||||
mInfo = esm.getHNString ("YEIN");
|
||||
mText = esm.getHNString ("TEXT");
|
||||
|
||||
if (mType==Type_Journal)
|
||||
{
|
||||
esm.getHNT (mDay, "JEDA");
|
||||
esm.getHNT (mMonth, "JEMO");
|
||||
esm.getHNT (mDayOfMonth, "JEDM");
|
||||
}
|
||||
}
|
||||
|
||||
void ESM::JournalEntry::save (ESMWriter &esm) const
|
||||
{
|
||||
esm.writeHNT ("JETY", mType);
|
||||
esm.writeHNString ("YETO", mTopic);
|
||||
esm.writeHNString ("YEIN", mInfo);
|
||||
esm.writeHNString ("TEXT", mText);
|
||||
|
||||
if (mType==Type_Journal)
|
||||
{
|
||||
esm.writeHNT ("JEDA", mDay);
|
||||
esm.writeHNT ("JEMO", mMonth);
|
||||
esm.writeHNT ("JEDM", mDayOfMonth);
|
||||
}
|
||||
}
|
35
components/esm/journalentry.hpp
Normal file
35
components/esm/journalentry.hpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef OPENMW_ESM_JOURNALENTRY_H
|
||||
#define OPENMW_ESM_JOURNALENTRY_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ESMReader;
|
||||
class ESMWriter;
|
||||
|
||||
// format 0, saved games only
|
||||
|
||||
struct JournalEntry
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Type_Journal = 0,
|
||||
Type_Topic = 1,
|
||||
Type_Quest = 2
|
||||
};
|
||||
|
||||
int mType;
|
||||
std::string mTopic;
|
||||
std::string mInfo;
|
||||
std::string mText;
|
||||
int mDay; // time stamp
|
||||
int mMonth;
|
||||
int mDayOfMonth;
|
||||
|
||||
void load (ESMReader &esm);
|
||||
void save (ESMWriter &esm) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
19
components/esm/queststate.cpp
Normal file
19
components/esm/queststate.cpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
#include "queststate.hpp"
|
||||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
|
||||
void ESM::QuestState::load (ESMReader &esm)
|
||||
{
|
||||
mTopic = esm.getHNString ("YETO");
|
||||
esm.getHNOT (mState, "QSTAT");
|
||||
esm.getHNOT (mFinished, "QFIN");
|
||||
}
|
||||
|
||||
void ESM::QuestState::save (ESMWriter &esm) const
|
||||
{
|
||||
esm.writeHNString ("YETO", mTopic);
|
||||
esm.writeHNT ("QSTAT", mState);
|
||||
esm.writeHNT ("QFIN", mFinished);
|
||||
}
|
24
components/esm/queststate.hpp
Normal file
24
components/esm/queststate.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef OPENMW_ESM_QUESTSTATE_H
|
||||
#define OPENMW_ESM_QUESTSTATE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ESMReader;
|
||||
class ESMWriter;
|
||||
|
||||
// format 0, saved games only
|
||||
|
||||
struct QuestState
|
||||
{
|
||||
std::string mTopic;
|
||||
int mState;
|
||||
unsigned char mFinished;
|
||||
|
||||
void load (ESMReader &esm);
|
||||
void save (ESMWriter &esm) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue