commonlibsse_ng\re\h/
hkbCharacterSetup.rs

1//! # hkbCharacterSetup
2//!
3//! This module defines the `hkbCharacterSetup` struct, which inherits from `hkReferencedObject` and represents
4//! the character setup in the game's engine. It includes a virtual table for C++ compatibility
5//! and maintains the original memory layout.
6
7use crate::re::hkArray::hkArray;
8use crate::re::hkCriticalSection;
9use crate::re::hkRefPtr::hkRefPtr;
10use crate::re::hkReferencedObject::hkReferencedObject;
11use crate::re::hkaMirroredSkeleton;
12use crate::re::hkaSkeleton;
13use crate::re::hkaSkeletonMapper;
14use crate::re::hkbAnimationBindingSet;
15use crate::re::hkbCharacterData;
16use crate::re::hkbSymbolIdMap;
17use crate::re::offsets_rtti::RTTI_hkbCharacterSetup;
18use crate::re::offsets_vtable::VTABLE_hkbCharacterSetup;
19use crate::rel::id::VariantID;
20
21#[repr(C)]
22pub struct hkbCharacterSetup {
23    /// Base class `hkReferencedObject`.
24    pub __base: hkReferencedObject,
25
26    /// The array of retargeting skeleton mappers.
27    /// - Offset: `0x10`
28    pub retargetingSkeletonMappers: hkArray<hkRefPtr<hkaSkeletonMapper>>,
29
30    /// The reference to the animation skeleton.
31    /// - Offset: `0x20`
32    pub animationSkeleton: hkRefPtr<hkaSkeleton>,
33
34    /// The reference to the ragdoll-to-animation skeleton mapper.
35    /// - Offset: `0x28`
36    pub ragdollToAnimationSkeletonMapper: hkRefPtr<hkaSkeletonMapper>,
37
38    /// The reference to the animation-to-ragdoll skeleton mapper.
39    /// - Offset: `0x30`
40    pub animationToRagdollSkeletonMapper: hkRefPtr<hkaSkeletonMapper>,
41
42    /// The animation binding set.
43    /// - Offset: `0x38`
44    pub animationBindingSet: hkRefPtr<hkbAnimationBindingSet>,
45
46    /// The character data.
47    /// - Offset: `0x40`
48    pub data: hkRefPtr<hkbCharacterData>,
49
50    /// The unscaled animation skeleton.
51    /// - Offset: `0x48`
52    pub unscaledAnimationSkeleton: hkRefPtr<hkaSkeleton>,
53
54    /// The mirrored skeleton.
55    /// - Offset: `0x50`
56    pub mirroredSkeleton: hkRefPtr<hkaMirroredSkeleton>,
57
58    /// The character property ID map.
59    /// - Offset: `0x58`
60    pub characterPropertyIdMap: hkRefPtr<hkbSymbolIdMap>,
61
62    /// The critical section.
63    /// - Offset: `0x60`
64    pub criticalSection: hkCriticalSection,
65
66    // Padding and alignment.
67    pub _pad: [u8; 8],
68}
69
70impl crate::re::hkRefPtr::hkRefPtrCounted for hkbCharacterSetup {}
71
72const _: () = {
73    assert!(core::mem::offset_of!(hkbCharacterSetup, __base) == 0x0);
74    assert!(core::mem::offset_of!(hkbCharacterSetup, retargetingSkeletonMappers) == 0x10);
75    assert!(core::mem::offset_of!(hkbCharacterSetup, animationSkeleton) == 0x20);
76    assert!(core::mem::offset_of!(hkbCharacterSetup, ragdollToAnimationSkeletonMapper) == 0x28);
77    assert!(core::mem::offset_of!(hkbCharacterSetup, animationToRagdollSkeletonMapper) == 0x30);
78    assert!(core::mem::offset_of!(hkbCharacterSetup, animationBindingSet) == 0x38);
79    assert!(core::mem::offset_of!(hkbCharacterSetup, data) == 0x40);
80    assert!(core::mem::offset_of!(hkbCharacterSetup, unscaledAnimationSkeleton) == 0x48);
81    assert!(core::mem::offset_of!(hkbCharacterSetup, mirroredSkeleton) == 0x50);
82    assert!(core::mem::offset_of!(hkbCharacterSetup, characterPropertyIdMap) == 0x58);
83    assert!(core::mem::offset_of!(hkbCharacterSetup, criticalSection) == 0x60);
84    assert!(core::mem::size_of::<hkbCharacterSetup>() == 0x68);
85};
86
87impl Default for hkbCharacterSetup {
88    fn default() -> Self {
89        Self::new()
90    }
91}
92
93impl hkbCharacterSetup {
94    /// Address & Offset of the runtime type information (RTTI) identifier.
95    pub const RTTI: VariantID = RTTI_hkbCharacterSetup;
96
97    /// Address & Offset of the virtual function table.
98    pub const VTABLE: [VariantID; 1] = VTABLE_hkbCharacterSetup;
99
100    /// Creates a new `hkbCharacterSetup` instance with default values.
101    ///
102    /// - `__base`: Default `hkReferencedObject`
103    /// - `retargetingSkeletonMappers`: Empty `hkArray`
104    /// - `animationSkeleton`: Default `hkRefPtr`
105    /// - Other fields initialized to their default values.
106    #[inline]
107    pub fn new() -> Self {
108        Self {
109            __base: hkReferencedObject::new(),
110            retargetingSkeletonMappers: hkArray::new(),
111            animationSkeleton: hkRefPtr::default(),
112            ragdollToAnimationSkeletonMapper: hkRefPtr::default(),
113            animationToRagdollSkeletonMapper: hkRefPtr::default(),
114            animationBindingSet: hkRefPtr::default(),
115            data: hkRefPtr::default(),
116            unscaledAnimationSkeleton: hkRefPtr::default(),
117            mirroredSkeleton: hkRefPtr::default(),
118            characterPropertyIdMap: hkRefPtr::default(),
119            criticalSection: hkCriticalSection,
120            _pad: [0; 8], // Padding to align structure
121        }
122    }
123}