CommonLibSSE (powerof3)
Script.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/C/CommandTable.h"
4 #include "RE/F/FormTypes.h"
5 #include "RE/T/TESForm.h"
6 
7 namespace RE
8 {
9  enum class COMPILER_NAME
10  {
14  };
15 
17  {
18  public:
19  };
20  static_assert(sizeof(ScriptCompiler) == 0x1);
21 
22  class Script : public TESForm
23  {
24  public:
25  inline static constexpr auto RTTI = RTTI_Script;
26  inline static constexpr auto VTABLE = VTABLE_Script;
27  inline static constexpr auto FORMTYPE = FormType::Script;
28 
29  struct RecordFlags
30  {
31  enum RecordFlag : std::uint32_t
32  {
33  };
34  };
35 
36  ~Script() override; // 00
37 
38  static bool GetProcessScripts();
39  static void SetProcessScripts(bool a_ProcessScripts);
40 
41  // override (TESForm)
42  void InitializeData() override; // 04
43  void ClearData() override; // 05
44  bool Load(TESFile* a_mod) override; // 06
45  void InitItemImpl() override; // 13
46 
47  void ClearCommand();
50  [[nodiscard]] std::string GetCommand() const;
51  void SetCommand(std::string_view a_command);
52 
53  template <class... Args>
54  static bool ParseParameters(const SCRIPT_PARAMETER* a_paramInfo, SCRIPT_FUNCTION::ScriptData* a_scriptData, std::uint32_t& a_opcodeOffsetPtr, TESObjectREFR* a_thisObj, TESObjectREFR* a_containingObj, Script* a_scriptObj, ScriptLocals* a_locals, Args... a_args)
55  {
56  static_assert((std::is_pointer_v<Args> && ...), "arguments must all be pointers");
57  using func_t = bool(const SCRIPT_PARAMETER*, SCRIPT_FUNCTION::ScriptData*, std::uint32_t&, TESObjectREFR*, TESObjectREFR*, Script*, ScriptLocals*, ...);
58  static REL::Relocation<func_t> func{ RELOCATION_ID(21425, 21910) };
59  return func(a_paramInfo, a_scriptData, a_opcodeOffsetPtr, a_thisObj, a_containingObj, a_scriptObj, a_locals, a_args...);
60  }
61 
62  // members
64  std::uint32_t pad34; // 34
65  char* text; // 38
67  float profilerTimer; // 48
68  float questScriptDelay; // 4C
70  std::uint32_t pad54; // 54
74 
75  private:
76  void CompileAndRun_Impl(ScriptCompiler* a_compiler, COMPILER_NAME a_type, TESObjectREFR* a_targetRef);
77  };
78  static_assert(sizeof(Script) == 0x80);
79 }
#define RELOCATION_ID(SE, AE)
Definition: PCH.h:505
Definition: Relocation.h:210
Definition: BSTList.h:10
Definition: Script.h:17
Definition: CommandTable.h:188
Definition: Script.h:23
~Script() override
std::string GetCommand() const
static bool GetProcessScripts()
float questScriptDelay
Definition: Script.h:68
void CompileAndRun(ScriptCompiler *a_compiler, TESObjectREFR *a_targetRef, COMPILER_NAME a_name=COMPILER_NAME::kSystemWindowCompiler)
static void SetProcessScripts(bool a_ProcessScripts)
static bool ParseParameters(const SCRIPT_PARAMETER *a_paramInfo, SCRIPT_FUNCTION::ScriptData *a_scriptData, std::uint32_t &a_opcodeOffsetPtr, TESObjectREFR *a_thisObj, TESObjectREFR *a_containingObj, Script *a_scriptObj, ScriptLocals *a_locals, Args... a_args)
Definition: Script.h:54
SCRIPT_FUNCTION::ScriptData * data
Definition: Script.h:66
void CompileAndRun(TESObjectREFR *a_targetRef, COMPILER_NAME a_name=COMPILER_NAME::kSystemWindowCompiler)
static constexpr auto RTTI
Definition: Script.h:25
static constexpr auto FORMTYPE
Definition: Script.h:27
void InitItemImpl() override
void SetCommand(std::string_view a_command)
char * text
Definition: Script.h:65
float questScriptGetSecondsBuffer
Definition: Script.h:69
void ClearCommand()
void ClearData() override
bool Load(TESFile *a_mod) override
SCRIPT_HEADER header
Definition: Script.h:63
BSSimpleList< ScriptVariable * > variables
Definition: Script.h:73
TESQuest * parentQuest
Definition: Script.h:71
static constexpr auto VTABLE
Definition: Script.h:26
std::uint32_t pad54
Definition: Script.h:70
std::uint32_t pad34
Definition: Script.h:64
BSSimpleList< SCRIPT_REFERENCED_OBJECT * > refObjects
Definition: Script.h:72
void InitializeData() override
float profilerTimer
Definition: Script.h:67
Definition: TESFile.h:17
Definition: TESForm.h:36
Definition: TESObjectREFR.h:114
Definition: TESQuest.h:189
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_Script(static_cast< std::uint64_t >(685316))
constexpr std::array< REL::ID, 1 > VTABLE_Script
Definition: Offsets_VTABLE.h:12628
COMPILER_NAME
Definition: Script.h:10
string(const CharT(&)[N]) -> string< CharT, N - 1 >
Definition: CommandTable.h:280
Definition: CommandTable.h:117
Definition: CommandTable.h:132
Definition: Script.h:30
RecordFlag
Definition: Script.h:32