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

View file

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

View file

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

View file

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