Skip to content

Commit

Permalink
Don't add new layers when placing respawning items
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterparty committed Apr 10, 2024
1 parent fcd3176 commit 7c07488
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2157,9 +2157,17 @@ fn patch_add_item<'r>(
pickup_model_data.actor_params.thermal_cskr = ResId::invalid();
}

let name = CString::new(format!("Randomizer - Pickup ({:?})", pickup_model_data.name)).unwrap();
area.add_layer(Cow::Owned(name));
let new_layer_idx = area.layer_flags.layer_count as usize - 1;
let respawn = pickup_config.respawn.unwrap_or(false);

let new_layer_idx = {
if !respawn {
let name = CString::new(format!("Randomizer - Pickup ({:?})", pickup_model_data.name)).unwrap();
area.add_layer(Cow::Owned(name));
area.layer_flags.layer_count as usize - 1
} else {
0
}
};

// Add hudmemo string as dependency to room //
let hudmemo_strg: ResId<res_id::STRG> = {
Expand Down Expand Up @@ -2614,7 +2622,7 @@ fn patch_add_item<'r>(
);
}

if !pickup_config.respawn.unwrap_or(false) && new_layer_idx != 0 {
if !respawn && new_layer_idx != 0 {
// Create Special Function to disable layer once item is obtained
// This is needed because otherwise the item would re-appear every
// time the room is loaded
Expand Down

0 comments on commit 7c07488

Please sign in to comment.