From 818e7b5bd47ac3365241d1a1a6d5217ccdefb821 Mon Sep 17 00:00:00 2001 From: toasterparty Date: Sat, 3 Feb 2024 08:55:15 -0800 Subject: [PATCH] optional layer for custom poi --- src/patch_config.rs | 1 + src/patches.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/patch_config.rs b/src/patch_config.rs index 21e098bc..26a5450a 100644 --- a/src/patch_config.rs +++ b/src/patch_config.rs @@ -131,6 +131,7 @@ pub struct PickupConfig pub struct ScanConfig { pub id: Option, + pub layer: Option, pub position: [f32;3], pub combat_visible: Option, pub rotation: Option, diff --git a/src/patches.rs b/src/patches.rs index db8a92cb..3f83313d 100644 --- a/src/patches.rs +++ b/src/patches.rs @@ -3366,16 +3366,19 @@ fn patch_add_poi<'r>( strg_id: ResId, position: [f32;3], id: Option, + layer: Option, ) -> Result<(), String> { + let layer = layer.unwrap_or(0) as usize; + let instance_id = match id { Some(id) => id, - None => area.new_object_id_from_layer_id(0), + None => area.new_object_id_from_layer_id(layer), }; let scly = area.mrea().scly_section_mut(); let layers = scly.layers.as_mut_vec(); - layers[0].objects.as_mut_vec().push( + layers[layer].objects.as_mut_vec().push( structs::SclyObject { instance_id: instance_id, connections: vec![].into(), @@ -15067,6 +15070,7 @@ fn build_and_run_patches<'r>(gc_disc: &mut structs::GcDisc<'r>, config: &PatchCo custom_asset_ids::SHORELINES_POI_STRG, [-98.0624, -162.3933, 28.5371], None, + None, ), ); } @@ -15079,6 +15083,7 @@ fn build_and_run_patches<'r>(gc_disc: &mut structs::GcDisc<'r>, config: &PatchCo custom_asset_ids::CFLDG_POI_STRG, [-44.0, 361.0, -120.0], None, + None, ), ); @@ -15997,7 +16002,7 @@ fn build_and_run_patches<'r>(gc_disc: &mut structs::GcDisc<'r>, config: &PatchCo patcher.add_scly_patch( (pak_name.as_bytes(), room_info.room_id.to_u32()), - move |ps, area| patch_add_poi(ps, area, game_resources, scan_id.clone(), strg_id.clone(), scan.position, scan.id), + move |ps, area| patch_add_poi(ps, area, game_resources, scan_id.clone(), strg_id.clone(), scan.position, scan.id, scan.layer), ); if scan.combat_visible.unwrap_or(false) {