Skip to content

Commit

Permalink
Use bw_dat for collision rect
Browse files Browse the repository at this point in the history
  • Loading branch information
neivv committed Oct 25, 2018
1 parent 505702e commit bb3362a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 0 additions & 9 deletions src/bw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,6 @@ lazy_static! {
samase::read_file("scripts\\aiscript.bin").unwrap() as usize;
static ref SAMASE_BWSCRIPT_BIN: usize =
samase::read_file("scripts\\bwscript.bin").unwrap() as usize;
static ref SAMASE_UNITS_DAT: usize = samase::read_file("arr\\units.dat").unwrap() as usize;
}

pub fn collision_rect(unit: UnitId) -> Rect {
unsafe {
assert!(unit.0 < 0xe4);
let dat = *SAMASE_UNITS_DAT as *const u8;
*(dat.offset(0x3124 + unit.0 as isize * 8) as *const Rect)
}
}

pub fn aiscript_bin() -> *mut u8 {
Expand Down
2 changes: 1 addition & 1 deletion src/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl Unit {
}

pub fn collision_rect(&self) -> bw::Rect {
let collision_rect = bw::collision_rect(self.id());
let collision_rect = self.id().dimensions();
let position = self.position();
bw::Rect {
left: position.x - collision_rect.left,
Expand Down

0 comments on commit bb3362a

Please sign in to comment.