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/disableable_etanks.ips
Binary file not shown.
4 changes: 3 additions & 1 deletion patches/rom_map/Bank 83.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ B000 - B700: items_disappear.asm
B700 - B800: rng_fix.asm
B800 - BA00: Mosaic (Area FX.asm)
BA00 - BA15: vanilla_bugfixes.asm
BA15 - F000: [free space]
BA15 - BB00: [free]
BB00 - BC40: disableable_etanks.asm
BC40 - F000: [free space]
F000 - end: Mosaic (FX data)
2 changes: 1 addition & 1 deletion patches/rom_map/Bank 85.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $AA00 - $AAA0: pause_menu_objectives.asm
$AAA0 - $AB00: [FREE]
$AB00 - $ACA0: map_area.asm
$ACA0 - $AD00: load_flash_suit
$AD00 - $AE20: disable_etanks.asm
$AD00 - $AE20: [FREE]
$AE20 - $B000: reserve_backward_fill.asm
$B000 - $B600: vanilla_bugfixes.asm
$B600 - $BA00: map_area.asm
82 changes: 61 additions & 21 deletions patches/src/disableable_etanks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
!bank_82_free_space_start = $82F830
!bank_82_free_space_end = $82F9E0

!bank_85_free_space_start = $85AD00
!bank_85_free_space_end = $85AE13
!bank_83_free_space_start = $83BB00
!bank_83_free_space_end = $83BC40

!current_etank_index = $12
!count_full_etanks = $14
Expand Down Expand Up @@ -141,6 +141,9 @@ org $8291ED

org !bank_82_free_space_start

config_classic:
dw $0000

hook_unpause_loading:
;jsl $809A79 ; Hard re-initialize the HUD after we've messed with it.
ldx #$0012
Expand Down Expand Up @@ -270,10 +273,9 @@ etanks_dpad_right:
cmp !count_all_etanks ; Don't go right past the total number of E-Tanks
bcs .no

lda $0755
clc
adc #$0100
sta $0755
sep #$20
inc $0756
rep #$20

sec
rts
Expand All @@ -287,11 +289,16 @@ etanks_dpad_left:
cmp #$0002
beq .no

lda config_classic
bne .classic

lda !current_etank_index
dec a
cmp !count_full_etanks ; Don't go into full e-tanks
bcc .no

.classic

sep #$20
dec $0756
rep #$20
Expand All @@ -307,24 +314,33 @@ etanks_dpad_down:
and #$00F0
bne .no

lda config_classic
bne .classic

; Don't move down into full e-tanks
lda $09C2
cmp #$02BC ; [Current energy] >= 700 means all 7 bottom row tanks are full
bcs .no
.classic

lda $0755
xba
and #$00ff
lda !current_etank_index
sec
sbc #$0007
cmp !count_full_etanks
tax
lda config_classic
bne +
cpx !count_full_etanks
bcs +
lda !count_full_etanks
ldx !count_full_etanks
+
sta $0756

sep #$10
stx $0756
rep #$10

.done
sec
rts

.no
; Don't go back to hook_equipment_screen_category_etanks
lda #$0037
Expand All @@ -341,14 +357,14 @@ etanks_dpad_up:

lda !current_etank_index
clc
adc #$0007
cmp !count_all_etanks
bcc +
lda !count_all_etanks
adc #$0008
-
dec a
cmp !count_all_etanks
bcs -
cmp !current_etank_index
beq .no
+

sep #$20
sta $0756
rep #$20
Expand Down Expand Up @@ -423,7 +439,7 @@ hook_equipment_screen_category_etanks:

warnpc !bank_82_free_space_end

org !bank_85_free_space_start
org !bank_83_free_space_start

etank_do_some_math:
php
Expand Down Expand Up @@ -481,18 +497,29 @@ dpad_enter_hud:
pla
sta $12

lda.l config_classic
bne .classic

; Can we move up here at all.
lda !count_all_etanks
cmp !count_full_etanks
beq .no

bra .which

.classic
; Have we any tanks at all
lda !count_all_etanks
beq .no

.which
; Are any not-full etanks enabled
lda !count_full_etanks
cmp !count_enabled_etanks
bcs .all_disabled

; Select leftmost enabled tank (A button disables all tanks)
lda !count_full_etanks
cmp !count_all_etanks
xba
and #$ff00
ora #$0004
Expand Down Expand Up @@ -522,11 +549,14 @@ dpad_enter_hud:

disable_tank:
; Sanity check: can we actually disable this tank?
lda.l config_classic
bne .classic
lda $09C4
sec
sbc #$0064
cmp $09C2
bcc tank_swap_done ; (max health - 100) < current health = bad times
.classic

; Disable 1 e-tank
lda $09C4
Expand All @@ -540,6 +570,16 @@ disable_tank:
lda !current_etank_index
cmp !count_enabled_etanks
bcc disable_tank ; Repeat until we've disabled all tanks above and including the selected tank

lda.l config_classic
beq .skipclamp

lda $09C4
cmp $09C2
bcs .skipclamp ; max health < current health = need to clamp

sta $09C2
.skipclamp

bra tank_swap_good

Expand Down Expand Up @@ -608,7 +648,7 @@ hook_load_equipment_menu:
stx $0330
rtl

warnpc !bank_85_free_space_end
warnpc !bank_83_free_space_end

org $B6FE60
tile_modified_map_cursor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4553,7 +4553,7 @@
"remove_climb_lava": true,
"etank_refill": "Full",
"energy_station_reserves": true,
"disableable_etanks": true,
"disableable_etanks": "Standard",
"reserve_backward_transfer": false,
"buffed_drops": true,
"early_save": true,
Expand Down
2 changes: 1 addition & 1 deletion rust/data/presets/full-settings/Default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4553,7 +4553,7 @@
"remove_climb_lava": true,
"energy_station_reserves": false,
"etank_refill": "Vanilla",
"disableable_etanks": false,
"disableable_etanks": "Off",
"reserve_backward_transfer": false,
"buffed_drops": true,
"early_save": true,
Expand Down
2 changes: 1 addition & 1 deletion rust/data/presets/quality-of-life/Default.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"remove_climb_lava": true,
"energy_station_reserves": false,
"etank_refill": "Vanilla",
"disableable_etanks": false,
"disableable_etanks": "Off",
"reserve_backward_transfer": false,
"buffed_drops": true,
"early_save": true,
Expand Down
2 changes: 1 addition & 1 deletion rust/data/presets/quality-of-life/High.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"remove_climb_lava": true,
"energy_station_reserves": true,
"etank_refill": "Full",
"disableable_etanks": true,
"disableable_etanks": "Standard",
"reserve_backward_transfer": false,
"buffed_drops": true,
"early_save": true,
Expand Down
2 changes: 1 addition & 1 deletion rust/data/presets/quality-of-life/Low.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"remove_climb_lava": false,
"energy_station_reserves": false,
"etank_refill": "Vanilla",
"disableable_etanks": false,
"disableable_etanks": "Off",
"reserve_backward_transfer": false,
"buffed_drops": false,
"early_save": false,
Expand Down
2 changes: 1 addition & 1 deletion rust/data/presets/quality-of-life/Max.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"remove_climb_lava": true,
"energy_station_reserves": true,
"etank_refill": "Full",
"disableable_etanks": true,
"disableable_etanks": "Standard",
"reserve_backward_transfer": true,
"buffed_drops": true,
"early_save": true,
Expand Down
2 changes: 1 addition & 1 deletion rust/data/presets/quality-of-life/Off.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"remove_climb_lava": false,
"energy_station_reserves": false,
"etank_refill": "Vanilla",
"disableable_etanks": false,
"disableable_etanks": "Off",
"reserve_backward_transfer": false,
"buffed_drops": false,
"early_save": false,
Expand Down
15 changes: 13 additions & 2 deletions rust/maprando-web/src/web/randomize/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use maprando::{
randomize::{DifficultyConfig, ItemPriorityGroup, Randomization, get_starting_items},
seed_repository::{Seed, SeedFile},
settings::{
AreaAssignmentBaseOrder, AreaAssignmentPreset, DoorLocksSize, ETankRefill,
FillerItemPriority, ItemCount, RandomizerSettings, SpeedBooster, WallJump,
AreaAssignmentBaseOrder, AreaAssignmentPreset, DisableETankSetting, DoorLocksSize,
ETankRefill, FillerItemPriority, ItemCount, RandomizerSettings, SpeedBooster, WallJump,
get_objective_groups,
},
spoiler_log::SpoilerLog,
Expand Down Expand Up @@ -59,6 +59,7 @@ pub struct SeedHeaderTemplate<'a> {
momentum_conservation: bool,
fanfares: String,
etank_refill: String,
disableable_etanks: String,
doors: String,
start_location_mode: String,
map_layout: String,
Expand Down Expand Up @@ -455,6 +456,16 @@ pub fn render_seed(
ETankRefill::Full => "Full",
}
.to_string(),
disableable_etanks: match seed_data
.settings
.quality_of_life_settings
.disableable_etanks
{
DisableETankSetting::Off => "Off",
DisableETankSetting::Standard => "Standard",
DisableETankSetting::Unrestricted => "Unrestricted",
}
.to_string(),
doors: seed_data.doors.clone(),
start_location_mode: seed_data.start_location_mode.clone(),
map_layout: seed_data.map_layout.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ <h1 class="modal-title fs-5">Disableable E-Tanks</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>If this setting is enabled, the player may disable any unfilled E-Tanks that they have collected, by navigating to the pause equipment screen, and moving the cursor up to the E-Tank area of the HUD.</p>
<p>Move the cursor to select an empty E-Tank, then press the A button to toggle it as enabled or disabled. Disabling an E-Tank will also disable the tanks "above" it, and enabling an E-Tank enables all the tanks "below" it.</p>
<p>Only empty E-Tanks can be disabled. To disable a full tank, Samus will have to take damage first in order to empty the tank.</p>
<p>This option controls the ability to disable E-Tanks during gameplay. When enabled, move the cursor up into the E-Tank area of the HUD, select an E-Tank and press A to toggle it.</p>
<p>Disabling an E-Tank will also disable the tanks "above" it, and enabling an E-Tank enables all the tanks "below" it.</p>
<ul>
<li><b>Off:</b> Disables this feature: Energy Tanks cannot be disabled once collected.</li>
<li><b>Standard:</b> Only empty E-Tanks can be disabled. To disable a full tank, Samus will have to take damage first in order to empty the tank.</li>
<li><b>Unrestricted:</b> Any E-Tank can be disabled. Disabling full tanks will vent the excess energy, leaving Samus with 99 energy plus the remaining enabled tanks.</li>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
Expand Down
12 changes: 7 additions & 5 deletions rust/maprando-web/templates/generate/quality_of_life.html
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,13 @@ <h1 class="modal-title fs-5">Quality-of-life options</h1>
</button>
<label for="preset">Disableable E-Tanks</label>
</div>
<div id="disableableETanks" class="col-2 btn-group" role="group">
<input type="radio" class="btn-check" name="disableable_etanks" id="disableableETanksNo" value="false" checked>
<label class="btn btn-outline-primary" for="disableableETanksNo">No</label>
<input type="radio" class="btn-check" name="disableable_etanks" id="disableableETanksYes" value="true">
<label class="btn btn-outline-primary" for="disableableETanksYes">Yes</label>
<div id="disableableETanks" class="col-4 btn-group" role="group">
<input type="radio" class="btn-check" name="disableable_etanks" id="disableableETanksOff" value="Off" checked>
<label class="btn btn-outline-primary" for="disableableETanksOff">Off</label>
<input type="radio" class="btn-check" name="disableable_etanks" id="disableableETanksStandard" value="Standard">
<label class="btn btn-outline-primary" for="disableableETanksStandard">Standard</label>
<input type="radio" class="btn-check" name="disableable_etanks" id="disableableETanksUnrestricted" value="Unrestricted">
<label class="btn btn-outline-primary" for="disableableETanksUnrestricted">Unrestricted</label>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion rust/maprando-web/templates/generate/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
"remove_climb_lava": formData.get("remove_climb_lava") == "true",
"etank_refill": formData.get("etank_refill"),
"energy_station_reserves": formData.get("energy_station_reserves") == "true",
"disableable_etanks": formData.get("disableable_etanks") == "true",
"disableable_etanks": formData.get("disableable_etanks"),
"reserve_backward_transfer": formData.get("reserve_backward_transfer") == "true",
"buffed_drops": formData.get("buffed_drops") == "true",
"early_save": formData.get("early_save") == "true",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
</div>
<div class="row">
<div class="col-8 col-sm-9 col-md-8 col-lg-7 col-xl-6">Disableable E-Tanks:</div>
<div class="col-4 col-sm-3">{% if settings.quality_of_life_settings.disableable_etanks %}Yes{% else %}No{% endif %}</div>
<div class="col-4 col-sm-3">{{+ disableable_etanks }}</div>
</div>
<div class="row">
<div class="col-8 col-sm-9 col-md-8 col-lg-7 col-xl-6">Reserve energy backward transfer:</div>
Expand Down
Loading