diff --git a/patches/ips/map_progress_maintain.ips b/patches/ips/map_progress_maintain.ips index 68bf7298f..945b0cb72 100644 Binary files a/patches/ips/map_progress_maintain.ips and b/patches/ips/map_progress_maintain.ips differ diff --git a/patches/rom_map/Bank 89.txt b/patches/rom_map/Bank 89.txt index 63b913ae6..b0854aa85 100644 --- a/patches/rom_map/Bank 89.txt +++ b/patches/rom_map/Bank 89.txt @@ -1,4 +1,3 @@ AF00 - AF31: ; hud_expansion_opaque.asm AF60 - B0BA: ; Area FX.asm B100 - B200: nothing item graphics (zeros, used only for Bomb Torizo Room; nothing_item.asm) -B200 - B800 : mapstation partial reveal bitmask. \ No newline at end of file diff --git a/patches/src/map_progress_maintain.asm b/patches/src/map_progress_maintain.asm index 30dc84b59..a5849f7a1 100644 --- a/patches/src/map_progress_maintain.asm +++ b/patches/src/map_progress_maintain.asm @@ -1,9 +1,9 @@ arch snes.cpu lorom -;!map_station_reveal_type = $90F700 ; 0 = Full reveal, 1 = Partial reveal +!map_station_reveal_type = $90F700 ; 0 = Full reveal, 1 = Partial reveal !map_reveal_tile_table = $90FA00 ; must match reference in patch.rs -!bank_90_freespace_start = $90F700 +!bank_90_freespace_start = $90F702 !bank_90_freespace_end = $90F800 @@ -30,8 +30,8 @@ org $90AB6D org $90A98B jmp mark_progress -;org !map_station_reveal_type -; dw $0000 ; default: full reveal +org !map_station_reveal_type + dw $0000 ; default: full reveal org !bank_90_freespace_start mark_progress: @@ -108,13 +108,12 @@ activate_map_station_hook: tax ; X <- map area * $100 ldy #$0080 ; Y <- loop counter (number of words to fill with #$FFFF) - ; lda !map_station_reveal_type - ; bne .partial_only_loop + lda !map_station_reveal_type + bne .partial_only_loop .loop: lda $829727, x sta $702000, x - lda $89b200, x sta $702700, x inx inx @@ -122,12 +121,12 @@ activate_map_station_hook: bne .loop bra .leave -;.partial_only_loop: -; sta $702700, x -; inx -; inx -; dey -; bne .partial_only_loop +.partial_only_loop: + sta $702700, x + inx + inx + dey + bne .partial_only_loop .leave jsr cross_area_reveal rtl diff --git a/rust/data/presets/full-settings/Community Race Season 5.json b/rust/data/presets/full-settings/Community Race Season 5.json index 19b937c1e..60c1d8001 100644 --- a/rust/data/presets/full-settings/Community Race Season 5.json +++ b/rust/data/presets/full-settings/Community Race Season 5.json @@ -4685,20 +4685,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "4-Tiered", "room_outline_revealed": true, "opposite_area_revealed": true, @@ -4856,6 +4842,7 @@ }, "door_locks_size": "Large", "maps_revealed": null, + "map_station_reveal": "Full", "energy_free_shinesparks": false, "all_enemies_respawn": false, "race_mode": true, diff --git a/rust/data/presets/full-settings/Default.json b/rust/data/presets/full-settings/Default.json index b4771744c..61233b989 100644 --- a/rust/data/presets/full-settings/Default.json +++ b/rust/data/presets/full-settings/Default.json @@ -4597,20 +4597,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "3-Tiered", "room_outline_revealed": true, "opposite_area_revealed": false, @@ -4767,6 +4753,7 @@ "item_dot_change": "Fade", "transition_letters": true, "door_locks_size": "Large", + "map_station_reveal": "Full", "energy_free_shinesparks": false, "all_enemies_respawn": false, "disable_spikesuit": false, diff --git a/rust/data/presets/full-settings/Mentor Tournament.json b/rust/data/presets/full-settings/Mentor Tournament.json index d1ec765da..e6f40d238 100644 --- a/rust/data/presets/full-settings/Mentor Tournament.json +++ b/rust/data/presets/full-settings/Mentor Tournament.json @@ -4685,20 +4685,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "4-Tiered", "room_outline_revealed": true, "opposite_area_revealed": true, @@ -4856,6 +4842,7 @@ }, "door_locks_size": "Large", "maps_revealed": null, + "map_station_reveal": "Full", "energy_free_shinesparks": false, "all_enemies_respawn": false, "race_mode": true, diff --git a/rust/data/presets/full-settings/Summer Series Expert Challenge.json b/rust/data/presets/full-settings/Summer Series Expert Challenge.json index 35eb58f7a..63094f3bb 100644 --- a/rust/data/presets/full-settings/Summer Series Expert Challenge.json +++ b/rust/data/presets/full-settings/Summer Series Expert Challenge.json @@ -4597,20 +4597,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "4-Tiered", "room_outline_revealed": true, "opposite_area_revealed": true, @@ -4768,6 +4754,7 @@ }, "door_locks_size": "Large", "maps_revealed": null, + "map_station_reveal": "Full", "energy_free_shinesparks": false, "all_enemies_respawn": false, "race_mode": true, diff --git a/rust/data/presets/quality-of-life/Default.json b/rust/data/presets/quality-of-life/Default.json index b46f4ce1b..46f9ae345 100644 --- a/rust/data/presets/quality-of-life/Default.json +++ b/rust/data/presets/quality-of-life/Default.json @@ -30,20 +30,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "3-Tiered", "room_outline_revealed": true, "opposite_area_revealed": false, diff --git a/rust/data/presets/quality-of-life/High.json b/rust/data/presets/quality-of-life/High.json index 270e3d9cd..cf4f33c04 100644 --- a/rust/data/presets/quality-of-life/High.json +++ b/rust/data/presets/quality-of-life/High.json @@ -30,20 +30,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "4-Tiered", "room_outline_revealed": true, "opposite_area_revealed": true, diff --git a/rust/data/presets/quality-of-life/Low.json b/rust/data/presets/quality-of-life/Low.json index 4b3702b60..a312773b9 100644 --- a/rust/data/presets/quality-of-life/Low.json +++ b/rust/data/presets/quality-of-life/Low.json @@ -30,20 +30,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "Uniques", "room_outline_revealed": false, "opposite_area_revealed": false, diff --git a/rust/data/presets/quality-of-life/Max.json b/rust/data/presets/quality-of-life/Max.json index 8d12d717e..9ce6efe10 100644 --- a/rust/data/presets/quality-of-life/Max.json +++ b/rust/data/presets/quality-of-life/Max.json @@ -30,20 +30,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "4-Tiered", "room_outline_revealed": true, "opposite_area_revealed": true, diff --git a/rust/data/presets/quality-of-life/Off.json b/rust/data/presets/quality-of-life/Off.json index 7262cff5d..3f1702581 100644 --- a/rust/data/presets/quality-of-life/Off.json +++ b/rust/data/presets/quality-of-life/Off.json @@ -30,20 +30,6 @@ "other": "No", "all_areas": false }, - "map_station_activation_settings": { - "preset": "Full", - "save_stations": "Full", - "refill_stations": "Full", - "ship": "Full", - "objectives": "Full", - "area_transitions": "Full", - "items1": "Full", - "items2": "Full", - "items3": "Full", - "items4": "Full", - "other": "Full", - "sub_area": "No" - }, "item_markers": "Simple", "room_outline_revealed": false, "opposite_area_revealed": false, diff --git a/rust/maprando-web/src/main.rs b/rust/maprando-web/src/main.rs index cb7e5584f..a49514cbe 100644 --- a/rust/maprando-web/src/main.rs +++ b/rust/maprando-web/src/main.rs @@ -437,7 +437,6 @@ struct SeedData { item_progression_preset: Option, difficulty: DifficultyConfig, quality_of_life_preset: Option, - map_station_activation_preset: Option, supers_double: bool, escape_autosave: bool, mother_brain_fight: String, @@ -720,11 +719,6 @@ async fn randomize( race_mode: settings.other_settings.race_mode, preset: settings.skill_assumption_settings.preset.clone(), item_progression_preset: settings.item_progression_settings.preset.clone(), - map_station_activation_preset: settings - .quality_of_life_settings - .map_station_activation_settings - .preset - .map(|p| format!("{:?}", p)), difficulty: output.difficulty_tiers[0].clone(), quality_of_life_preset: settings.quality_of_life_settings.preset.clone(), supers_double: settings.quality_of_life_settings.supers_double, diff --git a/rust/maprando-web/src/randomize_helpers.rs b/rust/maprando-web/src/randomize_helpers.rs index 2f35ea7dc..56dba4f54 100644 --- a/rust/maprando-web/src/randomize_helpers.rs +++ b/rust/maprando-web/src/randomize_helpers.rs @@ -11,8 +11,8 @@ use maprando::{ seed_repository::{Seed, SeedFile}, settings::{ AreaAssignmentBaseOrder, AreaAssignmentPreset, CrashFixesPreset, DisableETankSetting, - DoorLocksSize, ETankRefill, FillerItemPriority, ItemCount, MapStationActivationPreset, - RandomizerSettings, SpeedBooster, WallJump, get_objective_groups, + DoorLocksSize, ETankRefill, FillerItemPriority, ItemCount, RandomizerSettings, + SpeedBooster, WallJump, get_objective_groups, }, spoiler_log::SpoilerLog, spoiler_map, @@ -157,18 +157,6 @@ impl SeedHeaderTemplate<'_> { } } - fn map_station_activation_preset(&self) -> &'static str { - match self - .settings - .quality_of_life_settings - .map_station_activation_settings - .preset - { - Some(MapStationActivationPreset::Partial) => "Partial", - Some(MapStationActivationPreset::Full) => "Full", - None => "Custom", - } - } fn game_variations(&self) -> Vec<&str> { let mut game_variations = vec![]; let other_settings = &self.settings.other_settings; @@ -197,6 +185,10 @@ impl SeedHeaderTemplate<'_> { if other_settings.wall_jump == WallJump::Collectible { game_variations.push("Collectible wall jump"); } + if other_settings.map_station_reveal == maprando::settings::MapStationReveal::Partial { + game_variations.push("Map stations give partial reveal"); + } + if other_settings.energy_free_shinesparks { game_variations.push("Energy-free shinesparks"); } diff --git a/rust/maprando-web/templates/generate/game_variations.html b/rust/maprando-web/templates/generate/game_variations.html index b0da89593..0af75efea 100644 --- a/rust/maprando-web/templates/generate/game_variations.html +++ b/rust/maprando-web/templates/generate/game_variations.html @@ -58,6 +58,18 @@ +
+
+ {% include "help/variations/map_station_reveal.html" %} + +
+
+ + + + +
+
{% include "help/variations/energy_free_shinesparks.html" %} diff --git a/rust/maprando-web/templates/generate/help/quality/map_station_activation.html b/rust/maprando-web/templates/generate/help/variations/map_station_reveal.html similarity index 62% rename from rust/maprando-web/templates/generate/help/quality/map_station_activation.html rename to rust/maprando-web/templates/generate/help/variations/map_station_reveal.html index a20d718d5..815b77347 100644 --- a/rust/maprando-web/templates/generate/help/quality/map_station_activation.html +++ b/rust/maprando-web/templates/generate/help/variations/map_station_reveal.html @@ -1,4 +1,9 @@ - \ No newline at end of file diff --git a/rust/maprando-web/templates/generate/map_station_activation.html b/rust/maprando-web/templates/generate/map_station_activation.html deleted file mode 100644 index 1e262e8ca..000000000 --- a/rust/maprando-web/templates/generate/map_station_activation.html +++ /dev/null @@ -1,233 +0,0 @@ - \ No newline at end of file diff --git a/rust/maprando-web/templates/generate/quality_of_life.html b/rust/maprando-web/templates/generate/quality_of_life.html index 12946a159..1e7f2a8c1 100644 --- a/rust/maprando-web/templates/generate/quality_of_life.html +++ b/rust/maprando-web/templates/generate/quality_of_life.html @@ -76,28 +76,6 @@

Quality-of-life options

-
-
- - -
-
- - - - - -
-
-
-
-
Map station activation:
-
{{+ self.map_station_activation_preset() }}
-
Item markers:
{{+ item_markers }}
diff --git a/rust/maprando-web/templates/seed/seed_header.html b/rust/maprando-web/templates/seed/seed_header.html index 61f29c07a..36cdbd392 100644 --- a/rust/maprando-web/templates/seed/seed_header.html +++ b/rust/maprando-web/templates/seed/seed_header.html @@ -155,15 +155,6 @@

-
-
- Map station activation details -
-
- {% include "map_station_activation_details.html" %} -
-
-
Crash fix details diff --git a/rust/maprando/src/patch.rs b/rust/maprando/src/patch.rs index 0804059bd..7313defed 100644 --- a/rust/maprando/src/patch.rs +++ b/rust/maprando/src/patch.rs @@ -1231,6 +1231,36 @@ impl Patcher<'_> { Ok(()) } + fn write_area_bitmask(&mut self) -> Result<()> { + let addr = 0x829727; + + for (room_idx, room) in self.game_data.room_geometry.iter().enumerate() { + let room_x = self.rom.read_u8(room.rom_address + 2)?; + let room_y = self.rom.read_u8(room.rom_address + 3)?; + let area = self.map.area[room_idx]; + + for y in 0..room.map.len() { + for x in 0..room.map[y].len() { + if (room.map[y][x] == 0 && room_idx != self.game_data.toilet_room_idx) + || !self.map.room_mask[room_idx] + { + continue; + } + + let (offset, bitmask) = + xy_to_explored_bit_ptr(room_x + x as isize, room_y + y as isize); + + let bit_addr = addr + area * 0x100 + offset as usize; + let mut curr = self.rom.read_u8(snes2pc(bit_addr))?; + curr |= bitmask as isize; + self.rom.write_u8(snes2pc(bit_addr), curr)?; + } + } + } + + Ok(()) + } + fn fix_save_stations(&mut self) -> Result<()> { let save_station_ptrs = vec![ 0x44C5, 0x44D3, 0x44E1, 0x45CF, 0x45DD, 0x45EB, 0x45F9, 0x4607, 0x46D9, 0x46E7, 0x46F5, @@ -3703,6 +3733,7 @@ pub fn make_rom( patcher.apply_mother_brain_setup_asm()?; patcher.apply_extra_setup_asm()?; patcher.write_extra_room_data()?; + patcher.write_area_bitmask()?; info!("CustomizeSettings: {customize_settings:?}"); customize_rom( diff --git a/rust/maprando/src/patch/map_tiles.rs b/rust/maprando/src/patch/map_tiles.rs index 6a28ce137..dd481d2ba 100644 --- a/rust/maprando/src/patch/map_tiles.rs +++ b/rust/maprando/src/patch/map_tiles.rs @@ -5,8 +5,8 @@ use crate::{ randomize::{LockedDoor, Randomization}, settings::{ DisableETankSetting, DoorLocksSize, EnhancedMapLevel, EnhancedMapOther, EnhancedMapWalls, - InitialMapRevealSettings, ItemMarkers, MapRevealLevel, MapStationActivationLevel, - MapStationActivationSubArea, Objective, RandomizerSettings, + InitialMapRevealSettings, ItemMarkers, MapRevealLevel, MapStationReveal, Objective, + RandomizerSettings, }, }; use maprando_game::{ @@ -2604,6 +2604,16 @@ impl<'a> MapPatcher<'a> { Ok(()) } + fn set_map_activation_behavior(&mut self) -> Result<()> { + match self.settings.other_settings.map_station_reveal { + MapStationReveal::Partial => { + self.rom.write_u16(snes2pc(0x90F700), 0xFFFF)?; + } + MapStationReveal::Full => {} + } + Ok(()) + } + fn sort_dynamic_tile_data(&mut self) -> Result<()> { let interior_priority = [ MapTileInterior::Empty, @@ -3155,129 +3165,6 @@ impl<'a> MapPatcher<'a> { Ok(()) } - fn write_map_station_bitmasks(&mut self) -> Result<()> { - const FULL_MASK_ADDR: usize = 0x829727; - const PARTIAL_MASK_ADDR: usize = 0x89B200; - let mut map_station_subareas = [None; NUM_AREAS]; - let settings = &self - .settings - .quality_of_life_settings - .map_station_activation_settings; - for (room_idx, room) in self.game_data.room_geometry.iter().enumerate() { - let area = self.map.area[room_idx]; - let subarea = self.map.subarea[room_idx]; - for y in 0..room.map.len() { - for x in 0..room.map[y].len() { - let Some((tile_area, map_x, map_y)) = - self.get_room_coords(room.room_id, x as isize, y as isize) - else { - continue; - }; - let Some(tile) = self.map_tile_map.get(&(tile_area, map_x, map_y)) else { - continue; - }; - if tile.interior == MapTileInterior::MapStation { - map_station_subareas[area] = Some(subarea); - } - } - } - } - for area in 0..NUM_AREAS { - for i in 0..0x100 { - self.rom - .write_u8(snes2pc(FULL_MASK_ADDR + area * 0x100 + i), 0)?; - self.rom - .write_u8(snes2pc(PARTIAL_MASK_ADDR + area * 0x100 + i), 0)?; - } - } - for (room_idx, room) in self.game_data.room_geometry.iter().enumerate() { - let room_x = self.rom.read_u8(room.rom_address + 2)?; - let room_y = self.rom.read_u8(room.rom_address + 3)?; - for y in 0..room.map.len() { - for x in 0..room.map[y].len() { - if (room.map[y][x] == 0 && room_idx != self.game_data.toilet_room_idx) - || !self.map.room_mask[room_idx] - { - continue; - } - let Some((area, map_x, map_y)) = - self.get_room_coords(room.room_id, x as isize, y as isize) - else { - continue; - }; - let Some(tile) = self.map_tile_map.get(&(area, map_x, map_y)) else { - continue; - }; - let mut reveal_level = self.get_map_station_reveal(tile); - let tile_subarea = self.map.subarea[room_idx]; - if let Some(map_station_subarea) = map_station_subareas[area] - && tile_subarea != map_station_subarea - && settings.sub_area != MapStationActivationSubArea::Same - { - reveal_level = match settings.sub_area { - MapStationActivationSubArea::Partial => { - MapStationActivationLevel::Partial - } - MapStationActivationSubArea::No => MapStationActivationLevel::No, - MapStationActivationSubArea::Same => unreachable!(), - }; - } - let local_x = room_x + x as isize; - let local_y = room_y + y as isize; - let (offset, bitmask) = xy_to_explored_bit_ptr(local_x, local_y); - let full_addr = FULL_MASK_ADDR + area * 0x100 + offset as usize; - let partial_addr = PARTIAL_MASK_ADDR + area * 0x100 + offset as usize; - match reveal_level { - MapStationActivationLevel::No => {} - MapStationActivationLevel::Partial => { - let mut partial = self.rom.read_u8(snes2pc(partial_addr))?; - partial |= bitmask as isize; - self.rom.write_u8(snes2pc(partial_addr), partial)?; - } - MapStationActivationLevel::Full => { - let mut full = self.rom.read_u8(snes2pc(full_addr))?; - full |= bitmask as isize; - self.rom.write_u8(snes2pc(full_addr), full)?; - let mut partial = self.rom.read_u8(snes2pc(partial_addr))?; - partial |= bitmask as isize; - self.rom.write_u8(snes2pc(partial_addr), partial)?; - } - } - } - } - } - Ok(()) - } - - fn get_map_station_reveal(&self, tile: &MapTile) -> MapStationActivationLevel { - let settings = &self - .settings - .quality_of_life_settings - .map_station_activation_settings; - if let Some(MapTileSpecialType::AreaTransition(_, _)) = tile.special_type { - return if settings.area_transitions == MapStationActivationLevel::No { - MapStationActivationLevel::No - } else { - MapStationActivationLevel::Full - }; - } - match tile.interior { - MapTileInterior::SaveStation => settings.save_stations, - MapTileInterior::EnergyRefill - | MapTileInterior::AmmoRefill - | MapTileInterior::DoubleRefill => settings.refill_stations, - MapTileInterior::Ship => settings.ship, - MapTileInterior::Objective => settings.objectives, - MapTileInterior::Item | MapTileInterior::DoubleItem | MapTileInterior::HiddenItem => { - settings.items1 - } - MapTileInterior::AmmoItem => settings.items2, - MapTileInterior::MediumItem => settings.items3, - MapTileInterior::MajorItem => settings.items4, - _ => settings.other, - } - } - pub fn compute_area_bounds(&mut self) -> Result<()> { for &(area_idx, x, y) in self.map_tile_map.keys() { if x < self.area_min_x[area_idx] { @@ -3345,6 +3232,7 @@ impl<'a> MapPatcher<'a> { } self.indicate_locked_doors()?; self.add_cross_area_arrows()?; + self.set_map_activation_behavior()?; self.indicate_items()?; self.compute_area_bounds()?; self.write_map_tiles()?; @@ -3360,7 +3248,6 @@ impl<'a> MapPatcher<'a> { } self.fix_kraid()?; self.fix_item_colors()?; - self.write_map_station_bitmasks()?; Ok(()) } diff --git a/rust/maprando/src/settings.rs b/rust/maprando/src/settings.rs index e65069b65..4ad550248 100644 --- a/rust/maprando/src/settings.rs +++ b/rust/maprando/src/settings.rs @@ -306,7 +306,6 @@ pub struct QualityOfLifeSettings { // Map: pub enhanced_map_settings: EnhancedMapSettings, pub initial_map_reveal_settings: InitialMapRevealSettings, - pub map_station_activation_settings: MapStationActivationSettings, pub item_markers: ItemMarkers, pub room_outline_revealed: bool, pub opposite_area_revealed: bool, @@ -417,60 +416,6 @@ pub struct InitialMapRevealSettings { pub all_areas: bool, } -#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)] -pub enum MapStationActivationLevel { - No, - Partial, - Full, -} - -impl std::fmt::Display for MapStationActivationLevel { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) - } -} - -#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)] -pub enum MapStationActivationSubArea { - No, - Partial, - Same, -} - -impl std::fmt::Display for MapStationActivationSubArea { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) - } -} - -#[derive(Serialize, Deserialize, Clone, PartialEq)] -pub struct MapStationActivationSettings { - pub preset: Option, - pub save_stations: MapStationActivationLevel, - pub refill_stations: MapStationActivationLevel, - pub ship: MapStationActivationLevel, - pub objectives: MapStationActivationLevel, - pub area_transitions: MapStationActivationLevel, - pub items1: MapStationActivationLevel, - pub items2: MapStationActivationLevel, - pub items3: MapStationActivationLevel, - pub items4: MapStationActivationLevel, - pub other: MapStationActivationLevel, - pub sub_area: MapStationActivationSubArea, -} - -#[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq)] -pub enum MapStationActivationPreset { - Partial, - Full, -} - -impl std::fmt::Display for MapStationActivationPreset { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) - } -} - #[derive(Serialize, Deserialize, Clone, PartialEq)] pub struct EnhancedMapSettings { pub preset: Option, @@ -647,6 +592,7 @@ pub struct OtherSettings { pub wall_jump: WallJump, pub area_assignment: AreaAssignment, pub door_locks_size: DoorLocksSize, + pub map_station_reveal: MapStationReveal, pub energy_free_shinesparks: bool, pub all_enemies_respawn: bool, pub disable_spikesuit: bool, @@ -889,6 +835,12 @@ pub enum ETankRefill { Full, } +#[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq)] +pub enum MapStationReveal { + Partial, + Full, +} + #[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq)] pub enum SaveAnimals { No, @@ -1217,44 +1169,6 @@ fn upgrade_enhanced_map_settings(settings: &mut serde_json::Value) -> Result<()> Ok(()) } -fn upgrade_map_station_activation_settings(settings: &mut serde_json::Value) -> Result<()> { - // Skip if already present - let qol_settings = settings["quality_of_life_settings"] - .as_object_mut() - .context("missing 'quality_of_life_settings'")?; - - if !qol_settings.contains_key("map_station_activation_settings") { - let msa_settings = MapStationActivationSettings { - preset: Some(MapStationActivationPreset::Full), - save_stations: MapStationActivationLevel::Full, - refill_stations: MapStationActivationLevel::Full, - ship: MapStationActivationLevel::Full, - objectives: MapStationActivationLevel::Full, - area_transitions: MapStationActivationLevel::Full, - items1: MapStationActivationLevel::Full, - items2: MapStationActivationLevel::Full, - items3: MapStationActivationLevel::Full, - items4: MapStationActivationLevel::Full, - other: MapStationActivationLevel::Full, - sub_area: MapStationActivationSubArea::Same, - }; - - qol_settings.insert( - "map_station_activation_settings".to_string(), - serde_json::to_value(msa_settings)?, - ); - } - - let msa_settings = qol_settings["map_station_activation_settings"] - .as_object_mut() - .context("map_station_activation_settings is not object")?; - if !msa_settings.contains_key("sub_area") { - msa_settings.insert("sub_area".to_string(), "Same".into()); - } - - Ok(()) -} - fn upgrade_qol_settings(settings: &mut serde_json::Value) -> Result<()> { let etank_refill = settings["other_settings"]["etank_refill"] .as_str() @@ -1353,7 +1267,6 @@ fn upgrade_qol_settings(settings: &mut serde_json::Value) -> Result<()> { } upgrade_initial_map_reveal_settings(settings)?; - upgrade_map_station_activation_settings(settings)?; upgrade_enhanced_map_settings(settings)?; Ok(()) } diff --git a/rust/maprando/tests/logic_scenarios.rs b/rust/maprando/tests/logic_scenarios.rs index a17b0ab23..9a5d5c9d9 100644 --- a/rust/maprando/tests/logic_scenarios.rs +++ b/rust/maprando/tests/logic_scenarios.rs @@ -6,9 +6,9 @@ use maprando::{ randomize::{DifficultyConfig, LockedDoor, Preprocessor, make_locked_door_data}, settings::{ DisableETankSetting, DoorsSettings, EnemyDrops, EnhancedMapSettings, - InitialMapRevealSettings, ItemProgressionSettings, MapStationActivationSettings, Objective, - ObjectiveSettings, OtherSettings, QualityOfLifeSettings, RandomizerSettings, - SkillAssumptionSettings, StartLocationSettings, + InitialMapRevealSettings, ItemProgressionSettings, Objective, ObjectiveSettings, + OtherSettings, QualityOfLifeSettings, RandomizerSettings, SkillAssumptionSettings, + StartLocationSettings, }, traverse::{LockedDoorData, Traverser}, }; @@ -243,20 +243,6 @@ fn get_settings(scenario: &Scenario) -> Result { other: maprando::settings::MapRevealLevel::No, all_areas: false, }, - map_station_activation_settings: MapStationActivationSettings { - preset: Some(maprando::settings::MapStationActivationPreset::Full), - save_stations: maprando::settings::MapStationActivationLevel::Full, - refill_stations: maprando::settings::MapStationActivationLevel::Full, - ship: maprando::settings::MapStationActivationLevel::Full, - objectives: maprando::settings::MapStationActivationLevel::Full, - area_transitions: maprando::settings::MapStationActivationLevel::Full, - items1: maprando::settings::MapStationActivationLevel::Full, - items2: maprando::settings::MapStationActivationLevel::Full, - items3: maprando::settings::MapStationActivationLevel::Full, - items4: maprando::settings::MapStationActivationLevel::Full, - other: maprando::settings::MapStationActivationLevel::Full, - sub_area: maprando::settings::MapStationActivationSubArea::Same, - }, item_markers: maprando::settings::ItemMarkers::Simple, room_outline_revealed: false, opposite_area_revealed: false, @@ -342,6 +328,7 @@ fn get_settings(scenario: &Scenario) -> Result { maprando::settings::AreaAssignmentPreset::Standard, ), door_locks_size: maprando::settings::DoorLocksSize::Large, + map_station_reveal: maprando::settings::MapStationReveal::Full, energy_free_shinesparks: settings.energy_free_shinesparks.unwrap_or(false), all_enemies_respawn: false, speed_booster: maprando::settings::SpeedBooster::Vanilla,