commonlibsse_ng\re\b/
BGSStoryTeller.rs

1use crate::re::BSTArray::BSTArray;
2use crate::re::BSTEvent::BSTEventSink;
3use crate::re::BSTEvent::BSTEventSinkVtbl;
4use crate::re::BSTHashMap::BSTHashMap;
5use crate::re::TESQuest::TESQuest;
6use crate::re::TESQuestStageItemDoneEvent;
7use crate::re::offsets_rtti::RTTI_BGSStoryTeller;
8use crate::re::offsets_vtable::VTABLE_BGSStoryTeller;
9use crate::rel::id::VariantID;
10
11#[repr(C)]
12#[derive(Debug)]
13pub struct BGSStoryTeller {
14    // __base: BSTSingletonSDM<BGSStoryTeller>, // Empty base optimization -> 0 size,
15    pub __base: BSTEventSink<TESQuestStageItemDoneEvent>, // 0x00: vtable size
16    pad09: u8,                                            // 0x09
17    pad0A: u16,                                           // 0x0A
18    pad0C: u32,                                           // 0x0C
19    pub queuedStartQuests: BSTArray<*mut TESQuest>,       // 0x10
20    pub runningQuests: BSTArray<*mut TESQuest>,           // 0x28
21    pub queuedStopQuests: BSTArray<*mut TESQuest>,        // 0x40
22    pub infoClearQuests: BSTArray<*mut TESQuest>,         // 0x58
23    pub helloTopicQuests: BSTArray<*mut TESQuest>,        // 0x70
24    pub greetingTopicQuests: BSTArray<*mut TESQuest>,     // 0x88
25    pub startUpQuestsInitialized: bool,                   // 0xA0
26    padA1: u8,                                            // 0xA1
27    padA2: u16,                                           // 0xA2
28    padA4: u32,                                           // 0xA4
29    pub questStageWaitMap: BSTHashMap<u32, *mut BSTArray<(u32, u32)>>, // 0xA8
30}
31const _: () = assert!(core::mem::size_of::<BGSStoryTeller>() == 0xD8);
32
33impl BGSStoryTeller {
34    pub const RTTI: VariantID = RTTI_BGSStoryTeller;
35    pub const VTABLE: [VariantID; 1] = VTABLE_BGSStoryTeller;
36
37    /// Get vtable this class.
38    ///
39    /// # Panics
40    /// If vtable is null.
41    #[inline]
42    pub const fn vtable(&self) -> &BGSStoryTellerVtbl {
43        debug_assert!(self.__base.vtable.is_some(), "BGSStoryTellerVtbl ptr must not be null ptr");
44        unsafe { self.__base.vtable.unwrap().cast().as_ref() }
45    }
46
47    /// Gets the singleton instance of `BGSStoryTeller`.
48    #[commonlibsse_ng_derive_internal::relocate(
49        cast_as = "*mut *mut BGSStoryTeller",
50        default = "None",
51        deref_once,
52        id(se = 514316, ae = 400476)
53    )]
54    pub fn get_singleton() -> Option<&'static BGSStoryTeller> {
55        |deref_type: DerefType| unsafe { deref_type.as_ref() }
56    }
57
58    /// Gets the mutable singleton instance of `BGSStoryTeller`.
59    #[commonlibsse_ng_derive_internal::relocate(
60        cast_as = "*mut *mut BGSStoryTeller",
61        default = "None",
62        deref_once,
63        id(se = 514316, ae = 400476)
64    )]
65    pub fn get_singleton_mut() -> Option<&'static mut BGSStoryTeller> {
66        |deref_type: DerefType| unsafe { deref_type.as_mut() }
67    }
68
69    #[commonlibsse_ng_derive_internal::relocate_fn(se_id = 31718, ae_id = 32486)]
70    pub fn begin_shut_down_quest(&mut self, quest: *mut TESQuest) {}
71
72    #[commonlibsse_ng_derive_internal::relocate_fn(se_id = 31717, ae_id = 32485)]
73    pub fn begin_start_up_quest(&mut self, quest: *mut TESQuest) {}
74}
75
76#[repr(C)]
77pub struct BGSStoryTellerVtbl {
78    pub __base: BSTEventSinkVtbl<TESQuestStageItemDoneEvent>, // 0x00
79}
80const _: () = {
81    const VFUNC_COUNT: usize = 0x2;
82
83    const EXPECTED_SIZE: usize = VFUNC_COUNT * core::mem::size_of::<usize>();
84    assert!(core::mem::size_of::<BGSStoryTellerVtbl>() == EXPECTED_SIZE);
85};