Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/commonlibsse_ng/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ commonlibsse_ng_derive = { path = "../commonlibsse_ng_derive", optional = true }
windows = { workspace = true, features = [
"Win32_Devices_HumanInterfaceDevice",
"Win32_Globalization",
"Win32_Graphics_Direct3D11",
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_System_Com",
Expand Down
1 change: 1 addition & 0 deletions crates/commonlibsse_ng/src/re/a.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod Actor;
pub mod ActorValues;
188 changes: 188 additions & 0 deletions crates/commonlibsse_ng/src/re/a/ActorValues.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
#[commonlibsse_ng_derive_internal::ffi_enum]
#[repr(u32)]
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum ActorValue {
#[default]
None = u32::MAX,
Aggression = 0,
Confidence = 1,
Energy = 2,
Morality = 3,
Mood = 4,
Assistance = 5,
OneHanded = 6,
TwoHanded = 7,
Archery = 8,
Block = 9,
Smithing = 10,
HeavyArmor = 11,
LightArmor = 12,
Pickpocket = 13,
Lockpicking = 14,
Sneak = 15,
Alchemy = 16,
Speech = 17,
Alteration = 18,
Conjuration = 19,
Destruction = 20,
Illusion = 21,
Restoration = 22,
Enchanting = 23,
Health = 24,
Magicka = 25,
Stamina = 26,
HealRate = 27,
MagickaRate = 28,
StaminaRate = 29,
SpeedMult = 30,
InventoryWeight = 31,
CarryWeight = 32,
CriticalChance = 33,
MeleeDamage = 34,
UnarmedDamage = 35,
Mass = 36,
VoicePoints = 37,
VoiceRate = 38,
DamageResist = 39,
PoisonResist = 40,
ResistFire = 41,
ResistShock = 42,
ResistFrost = 43,
ResistMagic = 44,
ResistDisease = 45,
PerceptionCondition = 46,
EnduranceCondition = 47,
LeftAttackCondition = 48,
RightAttackCondition = 49,
LeftMobilityCondition = 50,
RightMobilityCondition = 51,
BrainCondition = 52,
Paralysis = 53,
Invisibility = 54,
NightEye = 55,
DetectLifeRange = 56,
WaterBreathing = 57,
WaterWalking = 58,
IgnoreCrippledLimbs = 59,
Fame = 60,
Infamy = 61,
JumpingBonus = 62,
WardPower = 63,
RightItemCharge = 64,
ArmorPerks = 65,
ShieldPerks = 66,
WardDeflection = 67,
Variable01 = 68,
Variable02 = 69,
Variable03 = 70,
Variable04 = 71,
Variable05 = 72,
Variable06 = 73,
Variable07 = 74,
Variable08 = 75,
Variable09 = 76,
Variable10 = 77,
BowSpeedBonus = 78,
FavorActive = 79,
FavorsPerDay = 80,
FavorsPerDayTimer = 81,
LeftItemCharge = 82,
AbsorbChance = 83,
Blindness = 84,
WeaponSpeedMult = 85,
ShoutRecoveryMult = 86,
BowStaggerBonus = 87,
Telekinesis = 88,
FavorPointsBonus = 89,
LastBribedIntimidated = 90,
LastFlattered = 91,
MovementNoiseMult = 92,
BypassVendorStolenCheck = 93,
BypassVendorKeywordCheck = 94,
WaitingForPlayer = 95,
OneHandedModifier = 96,
TwoHandedModifier = 97,
MarksmanModifier = 98,
BlockModifier = 99,
SmithingModifier = 100,
HeavyArmorModifier = 101,
LightArmorModifier = 102,
PickpocketModifier = 103,
LockpickingModifier = 104,
SneakingModifier = 105,
AlchemyModifier = 106,
SpeechcraftModifier = 107,
AlterationModifier = 108,
ConjurationModifier = 109,
DestructionModifier = 110,
IllusionModifier = 111,
RestorationModifier = 112,
EnchantingModifier = 113,
OneHandedSkillAdvance = 114,
TwoHandedSkillAdvance = 115,
MarksmanSkillAdvance = 116,
BlockSkillAdvance = 117,
SmithingSkillAdvance = 118,
HeavyArmorSkillAdvance = 119,
LightArmorSkillAdvance = 120,
PickpocketSkillAdvance = 121,
LockpickingSkillAdvance = 122,
SneakingSkillAdvance = 123,
AlchemySkillAdvance = 124,
SpeechcraftSkillAdvance = 125,
AlterationSkillAdvance = 126,
ConjurationSkillAdvance = 127,
DestructionSkillAdvance = 128,
IllusionSkillAdvance = 129,
RestorationSkillAdvance = 130,
EnchantingSkillAdvance = 131,
LeftWeaponSpeedMultiply = 132,
DragonSouls = 133,
CombatHealthRegenMultiply = 134,
OneHandedPowerModifier = 135,
TwoHandedPowerModifier = 136,
MarksmanPowerModifier = 137,
BlockPowerModifier = 138,
SmithingPowerModifier = 139,
HeavyArmorPowerModifier = 140,
LightArmorPowerModifier = 141,
PickpocketPowerModifier = 142,
LockpickingPowerModifier = 143,
SneakingPowerModifier = 144,
AlchemyPowerModifier = 145,
SpeechcraftPowerModifier = 146,
AlterationPowerModifier = 147,
ConjurationPowerModifier = 148,
DestructionPowerModifier = 149,
IllusionPowerModifier = 150,
RestorationPowerModifier = 151,
EnchantingPowerModifier = 152,
DragonRend = 153,
AttackDamageMult = 154,
HealRateMult = 155,
MagickaRateMult = 156,
StaminaRateMult = 157,
WerewolfPerks = 158,
VampirePerks = 159,
GrabActorOffset = 160,
Grabbed = 161,
DEPRECATED05 = 162,
ReflectDamage = 163,
}

impl ActorValue {
/// enum length.
pub const TOTAL: usize = 164;
}

#[repr(u32)]
pub enum ACTOR_VALUE_MODIFIER {
Permanent = 0,
Temporary = 1,
Damage = 2,
}

impl ACTOR_VALUE_MODIFIER {
/// enum length.
pub const TOTAL: usize = 3;
}
3 changes: 3 additions & 0 deletions crates/commonlibsse_ng/src/re/b.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
pub mod BGSActorCellEvent;
pub mod BGSActorEvent;
pub mod BGSAddToPlayerInventoryEvent;
pub mod BGSDirectionalAmbientLightingColors;
pub mod BGSEncounterZone;
pub mod BGSLoadFormBuffer;
pub mod BGSMessage;
pub mod BGSSaveFormBuffer;
pub mod BGSSaveGameBuffer;
pub mod BGSTextureSet;
pub mod BSAnimationGraphChannel;
pub mod BSAnimationGraphManager;
pub mod BSAnimationUpdateData;
Expand All @@ -30,6 +32,7 @@ pub mod BSTEvent;
pub mod BSTHashMap;
pub mod BSTList;
pub mod BSTSmartPointer;
pub mod BSTextureSet;
pub mod BSTimer;
pub mod BShkFloatController;
pub mod BShkbAnimationGraph;
Expand Down
37 changes: 37 additions & 0 deletions crates/commonlibsse_ng/src/re/b/BGSAddToPlayerInventoryEvent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use crate::re::BGSLocation;
use crate::re::BSPointerHandle::ObjectRefHandle;
use crate::re::TESForm::TESForm;

#[commonlibsse_ng_derive_internal::ffi_enum]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u32)]
pub enum ACQUIRE_TYPE {
None = 0,
Steal = 1,
Buy = 2,
PickPocket = 3,
Pickup = 4,
Container = 5,
DeadBody = 6,
}

#[derive(Debug, Clone, PartialEq)]
pub struct BGSAddToPlayerInventoryEvent {
ownerRef: ObjectRefHandle,
containerRef: ObjectRefHandle,
location: *mut BGSLocation,
itemBase: *mut TESForm,
acquireType: ACQUIRE_TYPEFlags,
}
const _: () = assert!(core::mem::size_of::<BGSAddToPlayerInventoryEvent>() == 0x20);

impl BGSAddToPlayerInventoryEvent {
#[commonlibsse_ng_derive_internal::relocate(
cast_as = "*mut u32",
default = "None",
id(se = 508412, ae = 380074)
)]
pub fn get_index() -> Option<u32> {
|as_type: AsType| unsafe { as_type.as_ref().map(|p| *p) }
}
}
39 changes: 39 additions & 0 deletions crates/commonlibsse_ng/src/re/b/BGSTextureSet.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use crate::re::BSTextureSet::BSTextureSet;
use crate::re::DecalData::DecalData;
use crate::re::BSResource;
use crate::re::TESBoundObject::TESBoundObject;
use crate::re::TESTexture::TESTexture;

#[repr(C)]
pub struct BGSTextureSet {
pub __base: TESBoundObject,
pub __base1: BSTextureSet,
/// - 8: BSTextureSet::Texture::UsedTotal
pub textures: [TESTexture; 8], // 0x040
pub decalData: *mut DecalData, // 0x0C0
pub flags: Flag, // 0x0C8
pub pad0CA: u16, // 0x0CA
/// - 8: BSTextureSet::Texture::UsedTotal
pub textureFileIDs: [BSResource::ID; 8], // 0x0CC
pub pad12C: u32, // 0x12C
}
const _: () = assert!(std::mem::size_of::<BGSTextureSet>() == 0x130);

#[commonlibsse_ng_derive_internal::to_bitflags]
#[repr(u16)]
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Flag {
#[default]
None = 0,
NoSpecularMap = 1 << 0,
FacegenTextures = 1 << 1,
HasModelSpaceNormalMap = 1 << 2,
}

#[commonlibsse_ng_derive_internal::ffi_enum]
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum RecordFlag {
Deleted = 1 << 5,
Ignored = 1 << 12,
}
2 changes: 1 addition & 1 deletion crates/commonlibsse_ng/src/re/b/BSFixedString.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ where
///
/// # Safety
/// This dereferences a pointer that may point to invalid memory.
pub unsafe fn get_proxy(&self) -> Option<&mut BSStringPool::Entry<T>> {
pub const unsafe fn get_proxy(&self) -> Option<&mut BSStringPool::Entry<T>> {
if self.data.is_null() {
return None;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/commonlibsse_ng/src/re/b/BSPointerHandle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl BSUntypedPointerHandle {
}

#[inline]
pub fn reset(&mut self) {
pub const fn reset(&mut self) {
self.handle = 0;
}
}
Expand Down Expand Up @@ -94,7 +94,7 @@ impl<T> BSPointerHandle<T> {
self.handle.has_value()
}

pub fn reset(&mut self) {
pub const fn reset(&mut self) {
self.handle.reset();
}
}
Expand Down
19 changes: 17 additions & 2 deletions crates/commonlibsse_ng/src/re/b/BSResource.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
// pub struct BSResource;
pub struct ID;
use core::ffi::c_char;

#[repr(C)]
#[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FileID {
pub file: u32,
pub ext: [c_char; 4],
}
const _: () = assert!(core::mem::size_of::<FileID>() == 0x8);

#[repr(C)]
#[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ID {
pub __base: FileID,
pub dir: u32,
}
const _: () = assert!(core::mem::size_of::<ID>() == 0xC);
2 changes: 1 addition & 1 deletion crates/commonlibsse_ng/src/re/b/BSTArray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl<T> BSStaticArray<T> {
}

#[inline]
pub fn as_mut_slice(&mut self) -> &mut [T] {
pub const fn as_mut_slice(&mut self) -> &mut [T] {
unsafe { slice::from_raw_parts_mut(self.data.as_ptr(), self.size as usize) }
}

Expand Down
6 changes: 3 additions & 3 deletions crates/commonlibsse_ng/src/re/b/BSTList.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<T> BSSimpleList<T> {
/// `node` must point to a valid node that was boxed and leaked using the list's allocator.
/// This method takes ownership of the node, so the pointer should not be used again.
#[inline]
unsafe fn push_front_node(&mut self, value: NonNull<Node<T>>) {
const unsafe fn push_front_node(&mut self, value: NonNull<Node<T>>) {
self.list_head.next = Some(value);
}

Expand Down Expand Up @@ -143,14 +143,14 @@ impl<T> BSSimpleList<T> {
}

#[inline]
pub fn erase_after(&mut self, pos: &mut Node<T>) {
pub const fn erase_after(&mut self, pos: &mut Node<T>) {
if let Some(mut node) = pos.next.take() {
pos.next = unsafe { node.as_mut().next.take() };
}
}

#[inline]
pub fn clear(&mut self) {
pub const fn clear(&mut self) {
let mut current = self.list_head.next.take();
while let Some(mut node) = current {
current = unsafe { node.as_mut().next.take() };
Expand Down
2 changes: 1 addition & 1 deletion crates/commonlibsse_ng/src/re/b/BSTSmartPointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ where
}

/// Returns a mutable reference to the managed object or `None` if null.
pub fn as_mut(&mut self) -> Option<&mut T> {
pub const fn as_mut(&mut self) -> Option<&mut T> {
unsafe { self.ptr.as_mut() }
}

Expand Down
Loading
Loading