2012-09-23 18:11:08 +00:00
|
|
|
#ifndef OPENMW_ESM_SCPT_H
|
|
|
|
#define OPENMW_ESM_SCPT_H
|
2010-02-22 13:09:43 +00:00
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2012-09-23 18:41:41 +00:00
|
|
|
#include "esmcommon.hpp"
|
2010-02-22 13:09:43 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2010-02-22 13:09:43 +00:00
|
|
|
|
2012-09-30 20:51:54 +00:00
|
|
|
class ESMReader;
|
|
|
|
class ESMWriter;
|
|
|
|
|
2010-02-22 13:09:43 +00:00
|
|
|
/*
|
|
|
|
* Script definitions
|
|
|
|
*/
|
|
|
|
|
2012-09-30 19:34:53 +00:00
|
|
|
class Script
|
2010-02-22 13:09:43 +00:00
|
|
|
{
|
2010-07-05 03:17:10 +00:00
|
|
|
public:
|
2013-09-24 11:17:28 +00:00
|
|
|
static unsigned int sRecordId;
|
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
struct SCHDstruct
|
|
|
|
{
|
2014-07-25 08:37:34 +00:00
|
|
|
/// Data from script-precompling in the editor.
|
|
|
|
/// \warning Do not use them. OpenCS currently does not precompile scripts.
|
2012-09-17 07:37:50 +00:00
|
|
|
int mNumShorts, mNumLongs, mNumFloats, mScriptDataSize, mStringTableSize;
|
2015-01-22 02:54:33 +00:00
|
|
|
};
|
|
|
|
struct SCHD
|
|
|
|
{
|
|
|
|
NAME32 mName;
|
|
|
|
Script::SCHDstruct mData;
|
2011-04-08 13:58:21 +00:00
|
|
|
}; // 52 bytes
|
|
|
|
|
2012-10-26 18:22:55 +00:00
|
|
|
std::string mId;
|
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
SCHDstruct mData;
|
2011-04-08 13:58:21 +00:00
|
|
|
|
2014-07-25 08:37:34 +00:00
|
|
|
/// Variable names generated by script-precompiling in the editor.
|
|
|
|
/// \warning Do not use this field. OpenCS currently does not precompile scripts.
|
|
|
|
std::vector<std::string> mVarNames;
|
|
|
|
|
|
|
|
/// Bytecode generated from script-precompiling in the editor.
|
|
|
|
/// \warning Do not use this field. OpenCS currently does not precompile scripts.
|
|
|
|
std::vector<unsigned char> mScriptData;
|
|
|
|
|
|
|
|
/// Script source code
|
|
|
|
std::string mScriptText;
|
2011-04-08 13:58:21 +00:00
|
|
|
|
|
|
|
void load(ESMReader &esm);
|
2013-09-16 10:32:35 +00:00
|
|
|
void save(ESMWriter &esm) const;
|
2013-04-07 13:17:35 +00:00
|
|
|
|
|
|
|
void blank();
|
|
|
|
///< Set record to default state (does not touch the ID/index).
|
2015-02-12 03:56:05 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void loadSCVR(ESMReader &esm);
|
2010-02-22 13:09:43 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|