From 0ca29d08733b163d26cbacb147e9b1586f2317f8 Mon Sep 17 00:00:00 2001 From: Torben Date: Thu, 2 Nov 2023 22:21:13 +0100 Subject: [PATCH 1/2] Add interact_type and break_line_of_sight properties to osrs location config --- src/definitions/location_configs.rs | 34 +++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/definitions/location_configs.rs b/src/definitions/location_configs.rs index ba9e91c0..37688f19 100644 --- a/src/definitions/location_configs.rs +++ b/src/definitions/location_configs.rs @@ -51,7 +51,8 @@ pub struct LocationConfig { pub dim_y: Option, #[cfg(feature = "2008_3_shim")] pub unknown_16: Option, - pub unknown_17: Option, + pub interact_type: Option, + pub break_line_of_sight: Option, pub is_transparent: Option, /// Flag for whether this object has a red rather than a white line on the map. pub unknown_19: Option, @@ -237,6 +238,13 @@ impl LocationConfig { if buffer.has_remaining() { return Err(NotExhausted::new(buffer.remaining())); } else { + #[cfg(feature = "osrs")] + { + if loc.breakroutefinding.unwrap_or(false) { + loc.interact_type = Some(0); + loc.break_line_of_sight = Some(false); + } + } break Ok(loc); } } @@ -260,8 +268,20 @@ impl LocationConfig { #[cfg(feature = "2008_3_shim")] 16 => loc.unknown_16 = Some(true), - 17 => loc.unknown_17 = Some(false), - 18 => loc.is_transparent = Some(true), + 17 => { + #[cfg(feature = "osrs")] + { + loc.interact_type = Some(0); + } + loc.break_line_of_sight = Some(false) + }, + 18 => { + #[cfg(feature = "osrs")] + { + loc.break_line_of_sight = Some(false); + } + loc.is_transparent = Some(true) + }, 19 => loc.unknown_19 = Some(buffer.try_get_u8()?), 21 => loc.unknown_21 = Some(true), 22 => loc.unknown_22 = Some(true), @@ -269,7 +289,13 @@ impl LocationConfig { 24 => loc.unknown_24 = buffer.try_get_smart32()?, #[cfg(feature = "legacy")] 25 => loc.unknown_25 = Some(true), - 27 => loc.unknown_27 = Some(false), + 27 => { + #[cfg(feature = "osrs")] + { + loc.interact_type = Some(1); + } + loc.unknown_27 = Some(false) + }, 28 => loc.unknown_28 = Some(buffer.try_get_u8()?), 29 => loc.ambient = Some(buffer.try_get_i8()?), opcode @ 30..=34 => { From a0eda5df286c70d46772d22f0c2d002c8a24a436 Mon Sep 17 00:00:00 2001 From: Torben Date: Fri, 3 Nov 2023 01:13:06 +0100 Subject: [PATCH 2/2] fmt --- src/definitions/location_configs.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/definitions/location_configs.rs b/src/definitions/location_configs.rs index 37688f19..8dd73de1 100644 --- a/src/definitions/location_configs.rs +++ b/src/definitions/location_configs.rs @@ -274,14 +274,14 @@ impl LocationConfig { loc.interact_type = Some(0); } loc.break_line_of_sight = Some(false) - }, + } 18 => { #[cfg(feature = "osrs")] { loc.break_line_of_sight = Some(false); } loc.is_transparent = Some(true) - }, + } 19 => loc.unknown_19 = Some(buffer.try_get_u8()?), 21 => loc.unknown_21 = Some(true), 22 => loc.unknown_22 = Some(true), @@ -295,7 +295,7 @@ impl LocationConfig { loc.interact_type = Some(1); } loc.unknown_27 = Some(false) - }, + } 28 => loc.unknown_28 = Some(buffer.try_get_u8()?), 29 => loc.ambient = Some(buffer.try_get_i8()?), opcode @ 30..=34 => {