Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option in game config to start with Great Tree Hall bars opened #95

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions schema/randomprime.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,11 @@
"type": "boolean",
"default": false
},
"greatTreeHallBarsOpened": {
"description": "Bars in Tallon Overworld - Great Tree Hall are pre-opened.",
"type": "boolean",
"default": false
},
"incineratorDroneConfig": {
"description": "Replace the 'random add' timer values us in the Incinerator Drone miniboss fight with constants.",
"type": "object",
Expand Down
6 changes: 6 additions & 0 deletions src/patch_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,7 @@ pub struct PatchConfig {
pub remove_mine_security_station_locks: bool,
pub remove_hive_mecha: bool,
pub power_bomb_arboretum_sandstone: bool,
pub great_tree_hall_bars_opened: bool,
pub visible_bounding_box: bool,
pub door_destination_scans: bool,
pub no_hud: bool,
Expand Down Expand Up @@ -1554,6 +1555,7 @@ struct GameConfig {
remove_mine_security_station_locks: Option<bool>,
remove_hive_mecha: Option<bool>,
power_bomb_arboretum_sandstone: Option<bool>,
great_tree_hall_bars_opened: Option<bool>,

incinerator_drone_config: Option<IncineratorDroneConfig>,
maze_seeds: Option<Vec<u32>>,
Expand Down Expand Up @@ -2644,6 +2646,10 @@ impl PatchConfigPrivate {
.game_config
.power_bomb_arboretum_sandstone
.unwrap_or(false),
great_tree_hall_bars_opened: self
.game_config
.great_tree_hall_bars_opened
.unwrap_or(false),

incinerator_drone_config: self.game_config.incinerator_drone_config.clone(),
maze_seeds: self.game_config.maze_seeds.clone(),
Expand Down
35 changes: 35 additions & 0 deletions src/patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15657,6 +15657,37 @@ fn patch_arboretum_sandstone(patcher: &mut PrimePatcher<'_, '_>) {
});
}

fn make_great_tree_hall_bars_opened(patcher: &mut PrimePatcher<'_, '_>)
{
patcher.add_scly_patch(resource_info!("04_over_tree.MREA").into(), |_ps, area| {
let (gate_solved_layer_idx, gate_unsolved_layer_idx) = (
area.get_layer_id_from_name("Gate Solved"),
area.get_layer_id_from_name("Gate Unsolved"),
);
let flags = &mut area.layer_flags.flags;
*flags |= 1 << gate_solved_layer_idx; // Turn on "Gate Solved"
*flags &= !(1 << gate_unsolved_layer_idx); // Turn off "Gate Unsolved"

// disable scan point for closed bars
area.set_memory_relay_active(0x002402c8, 1);

let scly = area.mrea().scly_section_mut();

// activate solved bars
let obj = scly.layers
.as_mut_vec()[0]
.objects
.iter_mut()
.find(|obj| obj.instance_id & 0xffff == 0x1F6)
.and_then(|obj| obj.property_data.as_platform_mut())
.unwrap();

obj.active = 1;

Ok(())
});
}

pub fn patch_iso<T>(config: PatchConfig, mut pn: T) -> Result<(), String>
where
T: structs::ProgressNotifier,
Expand Down Expand Up @@ -17946,6 +17977,10 @@ fn build_and_run_patches<'r>(
patch_arboretum_sandstone(&mut patcher);
}

if config.great_tree_hall_bars_opened {
make_great_tree_hall_bars_opened(&mut patcher);
}

if let Some(bomb_slot_covers) = config.hall_of_the_elders_bomb_slot_covers {
patch_hall_of_the_elders_bomb_slot_covers(&mut patcher, bomb_slot_covers)
}
Expand Down
Loading