Skip to content
Merged
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
Binary file modified patches/ips/alternate_door_colors.ips
Binary file not shown.
5 changes: 3 additions & 2 deletions patches/rom_map/Bank DF.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
D4DF - D761: ; credits.asm
D91B - DF0A: ; credits.asm
E000 - E127: ; credits.asm
E200 - FEEF: [FREE]
E200 - E212: ; alternate_door_colors.asm
E212 - FEEF: [free]
FEF0 - FEFF: seed name (null-terminated ASCII string)
FF04 - FF04: [FREE]
FF04 - FF04: [free]
FF05 - FF06: randomizer settings:
- bitmask $0001: walljump-boots item enabled
- bitmask $0002: split speedbooster item enabled
Expand Down
56 changes: 36 additions & 20 deletions patches/src/alternate_door_colors.asm
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
arch snes.cpu
lorom

!bank_82_free_space_start = $82FA00
!bank_82_free_space_start = $82FA00
!bank_82_free_space_end = $82FA80

!pb_1 = #$019E
!pb_2 = #$0114
!pb_3 = #$008A
!super_1 = #$43F0
!super_2 = #$2A8A
!super_3 = #$1184
!missile_1 = #$7C1F
!missile_2 = #$5816
!missile_3 = #$340D
!bank_df_free_space_start = $dfe200 ; must match addresses in customize.rs [these colors may be modifided there]
!bank_df_free_space_end = $dfe212

org $82E7D0
jmp hook_load_tileset
Expand Down Expand Up @@ -45,37 +38,60 @@ update_palette:
plb
plb
; Power Bomb door:
lda !pb_1
lda.l pb_1
sta $C002
sta $C202
lda !pb_2
lda.l pb_2
sta $C004
sta $C204
lda !pb_3
lda.l pb_3
sta $C006
sta $C206
; Super door:
lda !super_1
lda.l super_1
sta $C022
sta $C222
lda !super_2
lda.l super_2
sta $C024
sta $C224
lda !super_3
lda.l super_3
sta $C026
sta $C226
; Missile door:
lda !missile_1
lda.l missile_1
sta $C042
sta $C242
lda !missile_2
lda.l missile_2
sta $C044
sta $C244
lda !missile_3
lda.l missile_3
sta $C046
sta $C246

plb
rts

assert pc() <= !bank_82_free_space_end
assert pc() <= !bank_82_free_space_end

org !bank_df_free_space_start

pb_1:
dw $019E
pb_2:
dw $0114
pb_3:
dw $008A
super_1:
dw $43F0
super_2:
dw $2A8A
super_3:
dw $1184
missile_1:
dw $7C1F
missile_2:
dw $5816
missile_3:
dw $340D

assert pc() <= !bank_df_free_space_end
5 changes: 3 additions & 2 deletions patches/src/map_area.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ write_room_name_tiles:
assert pc() <= !bank_82_freespace2_end

org !bank_85_freespace2_start
dw $0000 ; Partially revealed tiles palette value: overwrote by customize.rs if using dark theme
dw $0000 ; partially revealed tiles palette value: overwrote by customize.rs if using dark theme

!bit_offset = $3a
!bit_offset_round = $3e
Expand Down Expand Up @@ -2185,6 +2185,7 @@ draw_sprite:
.sprite_disabled
PLA
BRA .sprite_is_disabled

assert pc() <= !bank_85_freespace3_end

; Fixes FX for rare bug when entering right-sided door through East Pants Room
Expand All @@ -2196,4 +2197,4 @@ fix_pants_room_fx:
.no_fix
STX $78D ; replaced code
RTS
assert pc() <= !bank_94_freespace_end
assert pc() <= !bank_94_freespace_end
3 changes: 2 additions & 1 deletion rust/maprando-web/src/seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ async fn customize_seed(
},
door_theme: match req.door_theme.0.as_str() {
"vanilla" => DoorTheme::Vanilla,
"alternate" => DoorTheme::Alternate,
"vibrant" => DoorTheme::Vibrant,
"contrast" => DoorTheme::Contrast,
_ => panic!(
"Unexpected door_theme option: {}",
req.door_theme.0.as_str()
Expand Down
8 changes: 5 additions & 3 deletions rust/maprando-web/templates/seed/customize_seed.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@
<div class="col-md-4">
<label class="col-form-label" for="door_theme">{% include "help/door_colors.html" %}Door colors</label>
</div>
<div class="col-md-6 col-lg-4 btn-group p-0" role="group">
<div class="col-md-8 col-lg-6 btn-group p-0" role="group">
<input type="radio" class="btn-check" name="door_theme" id="doorColorsVanilla" value="vanilla" checked>
<label class="btn btn-outline-primary" style="width:120px" for="doorColorsVanilla">Vanilla</label>
<input type="radio" class="btn-check" name="door_theme" id="doorColorsAlternate" value="alternate">
<label class="btn btn-outline-primary" style="width:120px" for="doorColorsAlternate">Alternate</label>
<input type="radio" class="btn-check" name="door_theme" id="doorColorsVibrant" value="vibrant">
<label class="btn btn-outline-primary" style="width:120px" for="doorColorsVibrant">Vibrant</label>
<input type="radio" class="btn-check" name="door_theme" id="doorColorsContrast" value="contrast">
<label class="btn btn-outline-primary" style="width:120px" for="doorColorsContrast">Contrast</label>
</div>
</div>

Expand Down
10 changes: 7 additions & 3 deletions rust/maprando-web/templates/seed/help/door_colors.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ <h1 class="modal-title fs-5">Door colors</h1>
<p><strong>Vanilla</strong>: Doors have the colors that they do in the vanilla game.</p>
</li>
<li>
<p><strong>Alternate</strong>: Different door colors are used, which may be easier to distinguish for
color-blind players. This is based on a color scheme by Vibrant Colors.</p>
<p><strong>Vibrant</strong>: Different door colors are used, which may be easier to distinguish for
color-blind players.</p>
</li>
<li>
<p><strong>Contrast</strong>: Different door colors are used, which may be easier to distinguish for
color-blind players. Simlar to the Vibrant door colors but the contrast between door colors is more pronounced.</p>
</li>
</ul>
<p>Note that the Alternate setting has side effects on colors in other places, such as in the HUD, some types of
<p>Note that the Vibrant and Contrast settings have side effects on colors in other places, such as in the HUD, some types of
beam doors, and acid.</p>
</div>
<div class="modal-footer">
Expand Down
19 changes: 16 additions & 3 deletions rust/maprando/src/customize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ pub enum TileTheme {
Constant(String),
}

#[derive(Default, Debug, Copy, Clone)]
#[derive(Default, Debug, Copy, Clone, PartialEq)]
pub enum DoorTheme {
#[default]
Vanilla,
Alternate,
Vibrant,
Contrast,
}

#[derive(Default, Debug, Copy, Clone)]
Expand Down Expand Up @@ -528,8 +529,20 @@ pub fn customize_rom(

match settings.door_theme {
DoorTheme::Vanilla => {}
DoorTheme::Alternate => {
DoorTheme::Vibrant => {
apply_ips_patch(rom, Path::new("../patches/ips/alternate_door_colors.ips"))?;
}
DoorTheme::Contrast => {
apply_ips_patch(rom, Path::new("../patches/ips/alternate_door_colors.ips"))?;
rom.write_u16(snes2pc(0xdfe200), 0x03BF)?; // high contrast power bomb door color
rom.write_u16(snes2pc(0xdfe202), 0x0278)?; // high contrast power bomb door color
rom.write_u16(snes2pc(0xdfe204), 0x00EC)?; // high contrast power bomb door color
rom.write_u16(snes2pc(0xdfe206), 0x5BE1)?; // high contrast super door color
rom.write_u16(snes2pc(0xdfe208), 0x3AA0)?; // high contrast super door color
rom.write_u16(snes2pc(0xdfe20a), 0x1DA0)?; // high contrast super door color
rom.write_u16(snes2pc(0xdfe20c), 0x1C1D)?; // high contrast missile door color
rom.write_u16(snes2pc(0xdfe20e), 0x1033)?; // high contrast missile bomb door color
rom.write_u16(snes2pc(0xdfe210), 0x0829)?; // high contrast missile bomb door color
}
}

Expand Down
37 changes: 31 additions & 6 deletions rust/maprando/src/patch/map_tiles.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use hashbrown::{HashMap, HashSet};

use crate::{
customize::{CustomizeSettings, ItemDotChange, MapTheme},
customize::{CustomizeSettings, DoorTheme, ItemDotChange, MapTheme},
randomize::{LockedDoor, Randomization},
settings::{
DisableETankSetting, DoorLocksSize, EnhancedMapLevel, EnhancedMapOther, EnhancedMapWalls,
Expand Down Expand Up @@ -1300,14 +1300,18 @@ pub fn render_tile(
}
}
// Set up arrows of different colors (one per area):
let area_arrow_colors: Vec<usize> = vec![
let mut area_arrow_colors: Vec<usize> = vec![
11, // Crateria: purple (defined above)
14, // Brinstar: green (defined above)
10, // Norfair: red (defined above)
9, // Wrecked Ship: yellow (defined above)
8, // Maridia: blue (defined above)
6, // Tourian: orange
];
// Swap the T and W around if using the Contrast theme
if customize_settings.door_theme == DoorTheme::Contrast {
area_arrow_colors.swap(3, 5);
}

let color_number = area_arrow_colors[area_idx] as u8;
data = data.map(|row| row.map(|c| if c == 3 { color_number } else { c }));
Expand Down Expand Up @@ -2299,15 +2303,36 @@ impl<'a> MapPatcher<'a> {
(b << 10) | (g << 5) | r
}

let (color6, color7, color9, color14) = match self.customize_settings.door_theme {
DoorTheme::Contrast => (
rgb(31, 29, 0),
rgb(29, 0, 7),
rgb(31, 17, 0),
rgb(1, 31, 22),
),
DoorTheme::Vibrant => (
rgb(30, 12, 0),
rgb(31, 0, 31),
rgb(23, 24, 9),
rgb(16, 31, 16),
),
DoorTheme::Vanilla => (
rgb(31, 17, 0),
rgb(27, 2, 18),
rgb(23, 24, 9),
rgb(9, 31, 5),
),
};

let extended_map_palette: Vec<(u8, u16)> = vec![
(14, rgb(7, 31, 7)), // Brinstar green (and green doors)
(14, color14), // Brinstar green (and green doors)
(10, rgb(29, 0, 0)), // Norfair red
(8, rgb(4, 13, 31)), // Maridia blue
(9, rgb(23, 24, 9)), // Wrecked Ship yellow
(9, color9), // Wrecked Ship yellow
(11, rgb(20, 3, 31)), // Crateria purple
(6, rgb(29, 15, 0)), // Tourian, (and orange doors)
(6, color6), // Tourian (and orange doors)
(15, rgb(18, 12, 14)), // Gray door
(7, rgb(27, 2, 27)), // Red (pink) door
(7, color7), // Red (pink) door
(12, rgb(0, 0, 0)), // Black (door lock shadows covering wall)
(5, rgb(0, 0, 0)), // Black (door lock shadows covering air)
(13, rgb(31, 31, 31)), // White (item dots)
Expand Down
Loading