make add tag take mutable tag mgr

This commit is contained in:
bgkillas 2025-07-24 11:59:34 -04:00
parent 9d822debff
commit 8bd7cd8475
4 changed files with 17 additions and 8 deletions

View file

@ -12,7 +12,8 @@ pub struct ComponentData {
pub enabled: bool,
unk2: [u8; 3],
pub tags: BitSet<8>,
unk3: [usize; 4],
unk3: StdVec<usize>,
unk4: usize,
}
#[repr(C)]
#[derive(Debug)]
@ -233,7 +234,7 @@ impl BitSet<8> {
false
}
}
pub fn add_tag(&mut self, tag_manager: &TagManager<u8>, tag: &StdString) {
pub fn add_tag(&mut self, tag_manager: &mut TagManager<u8>, tag: &StdString) {
if let Some(n) = tag_manager.tag_indices.get(tag) {
self.set(*n, true)
}

View file

@ -545,7 +545,7 @@ impl Entity {
}
pub fn add_tag(
&'static mut self,
tag_manager: &TagManager<u16>,
tag_manager: &mut TagManager<u16>,
entity_manager: &mut EntityManager,
tag: &StdString,
) {

View file

@ -304,6 +304,9 @@ pub struct Vec2 {
pub y: f32,
}
impl Vec2 {
pub fn splat(v: f32) -> Self {
Self { x: v, y: v }
}
pub fn abs(&self, other: &Vec2) -> f32 {
(self.y - other.y).hypot(self.x - other.x)
}

View file

@ -497,8 +497,7 @@ impl Cell {
#[repr(C)]
#[derive(Debug)]
pub struct GameWorld {
pub cam1: Vec2,
pub cam2: Vec2,
pub cam: AABB,
unknown1: [isize; 13],
pub grid_world: &'static mut GridWorld,
//likely more data
@ -712,7 +711,7 @@ impl Debug for ChunkMap {
f.debug_struct("ChunkMap")
.field("len", &self.len)
.field("unknown", &self.unknown)
.field(
/*.field(
"chunk_array",
&self
.chunk_array
@ -722,7 +721,7 @@ impl Debug for ChunkMap {
a.as_ref().map(|a| (i % 512 - 256, i / 512 - 256, a))
})
.collect::<Vec<_>>(),
)
)*/
.field("chunk_count", &self.chunk_count)
.field("min_chunk", &self.min_chunk)
.field("max_chunk", &self.max_chunk)
@ -815,7 +814,13 @@ pub struct GridWorld {
unk: [isize; 292],
pub cam_pos: Vec2i,
pub cam_dimen: Vec2i,
unknown: [isize; 21],
unknown: [isize; 6],
unk_cam: IAABB,
unk2_cam: IAABB,
unkown3: isize,
pub cam: IAABB,
unkown2: isize,
unk_counter: isize,
pub world_update_count: isize,
pub chunk_map: ChunkMap,
unknown2: [isize; 40],