CommonLibVR
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  private:
20  KEEP_FOR_RE()
21  };
22  static_assert(sizeof(ScriptCompiler) == 0x1);
23 
24  class Script : public TESForm
25  {
26  public:
27  inline static constexpr auto RTTI = RTTI_Script;
28  inline static constexpr auto VTABLE = VTABLE_Script;
29  inline static constexpr auto FORMTYPE = FormType::Script;
30 
31  struct RecordFlags
32  {
33  enum RecordFlag : std::uint32_t
34  {
35  };
36  };
37 
38  ~Script() override; // 00
39 
40  static bool GetProcessScripts();
41  static void SetProcessScripts(bool a_ProcessScripts);
42 
43  // override (TESForm)
44  void InitializeData() override; // 04
45  void ClearData() override; // 05
46  bool Load(TESFile* a_mod) override; // 06
47  void InitItemImpl() override; // 13
48 
49  void ClearCommand();
52  [[nodiscard]] std::string GetCommand() const;
53  void SetCommand(std::string_view a_command);
54 
55  template <class... Args>
56  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)
57  {
58  static_assert((std::is_pointer_v<Args> && ...), "arguments must all be pointers");
59  using func_t = bool(const SCRIPT_PARAMETER*, SCRIPT_FUNCTION::ScriptData*, std::uint32_t&, TESObjectREFR*, TESObjectREFR*, Script*, ScriptLocals*, ...);
60  static REL::Relocation<func_t> func{ RELOCATION_ID(21425, 21910) };
61  return func(a_paramInfo, a_scriptData, a_opcodeOffsetPtr, a_thisObj, a_containingObj, a_scriptObj, a_locals, a_args...);
62  }
63 
64  // members
66  std::uint32_t pad34; // 34
67  char* text; // 38
69  float profilerTimer; // 48
70  float questScriptDelay; // 4C
72  std::uint32_t pad54; // 54
76 
77  private:
78  void CompileAndRun_Impl(ScriptCompiler* a_compiler, COMPILER_NAME a_type, TESObjectREFR* a_targetRef);
79  KEEP_FOR_RE()
80  };
81  static_assert(sizeof(Script) == 0x80);
82 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
#define RELOCATION_ID(SE, AE)
Definition: PCH.h:702
Definition: Relocation.h:210
Definition: BSTList.h:10
Definition: Script.h:17
Definition: CommandTable.h:188
Definition: Script.h:25
~Script() override
std::string GetCommand() const
static bool GetProcessScripts()
float questScriptDelay
Definition: Script.h:70
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:56
SCRIPT_FUNCTION::ScriptData * data
Definition: Script.h:68
void CompileAndRun(TESObjectREFR *a_targetRef, COMPILER_NAME a_name=COMPILER_NAME::kSystemWindowCompiler)
static constexpr auto RTTI
Definition: Script.h:27
static constexpr auto FORMTYPE
Definition: Script.h:29
void InitItemImpl() override
void SetCommand(std::string_view a_command)
char * text
Definition: Script.h:67
float questScriptGetSecondsBuffer
Definition: Script.h:71
void ClearCommand()
void ClearData() override
bool Load(TESFile *a_mod) override
SCRIPT_HEADER header
Definition: Script.h:65
BSSimpleList< ScriptVariable * > variables
Definition: Script.h:75
TESQuest * parentQuest
Definition: Script.h:73
static constexpr auto VTABLE
Definition: Script.h:28
std::uint32_t pad54
Definition: Script.h:72
std::uint32_t pad34
Definition: Script.h:66
BSSimpleList< SCRIPT_REFERENCED_OBJECT * > refObjects
Definition: Script.h:74
void InitializeData() override
float profilerTimer
Definition: Script.h:69
Definition: TESFile.h:17
Definition: TESForm.h:40
Definition: TESObjectREFR.h:113
Definition: TESQuest.h:197
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:32
RecordFlag
Definition: Script.h:34