From 85a63a0a9ed574ca787712f2340e050f6b6d596b Mon Sep 17 00:00:00 2001 From: aquanight Date: Thu, 22 Jan 2026 21:18:21 -0700 Subject: [PATCH 01/17] Disableable E-Tanks Improved UI --- patches/src/disableable_etanks.asm | 513 +++++++++++++++++++++++++++-- 1 file changed, 478 insertions(+), 35 deletions(-) diff --git a/patches/src/disableable_etanks.asm b/patches/src/disableable_etanks.asm index 496f4969af..eabe7694e3 100644 --- a/patches/src/disableable_etanks.asm +++ b/patches/src/disableable_etanks.asm @@ -1,14 +1,26 @@ !bank_80_free_space_start = $80E3C0 !bank_80_free_space_end = $80E440 +!bank_82_free_space_start = $82F829 +!bank_82_free_space_end = $82F9FF + +!bank_85_free_space_start = $859A25 +!bank_85_free_space_end = $85FFFF + +!current_etank_index = $12 +!count_full_etanks = $14 +!count_enabled_etanks = $16 +!count_all_etanks = $18 +!etank_hud_tile_offset = $1A + + incsrc "constants.asm" org $809BEE jsr hook_draw_tanks -org $82914F - jsl hook_equipment_screen - nop : nop +org $809BFB + jsr hook_blink_selected_etank org !bank_80_free_space_start hook_draw_tanks: @@ -29,64 +41,495 @@ hook_draw_tanks: lda #$9DBF rts -hook_equipment_screen: - lda $8B - and #$2000 ; holding Select? +hook_blink_selected_etank: + ; If we are in the pause menu: + lda $0998 + and #$00ff + cmp #$000F + bne .done + + ; Equipment screen selected + lda $0727 + cmp #$0001 + bne .done + + ; E-Tanks select + lda $0755 + and #$00FF + cmp #$0004 + bne .done + + lda $0755 + and #$ff00 + xba + asl a + + tay + ldx $9CCE,y + + lda $05B5 + bit #$0010 beq .done + + lda $7EC608,x + and #$E3FF ; Remove the palette bits + ora #$1000 ; Set hilight palette + sta $7ec608,x + + stz $0A06 ; Force this to redraw each frame + +.done + lda #$9DD3 ; Hijacked + rts + +warnpc !bank_80_free_space_end + +org $82AC5A + jsr (hook_equipment_screen_main_category_jump_table, X) + +org $82ACEF + jmp hook_tanks_dpad_response + +org $82B03F + jsr hook_beams_dpad_response + nop + nop + +org $82B136 + jsr hook_suits_dpad_response + ; beq to $B14E + +org $82B4F5 + jsr hook_suits_move_higher + nop + nop + +org $82B26A + jmp hook_equipment_screen_selector + +org !bank_82_free_space_start + +hook_equipment_screen_main_category_jump_table: + ; 0 - reserve tank, 1 - beams, 2 - suits/misc, 3 - boots - all go to their vanilla entry points + ; 4 - e-tanks is ours + dw $AC70, $AFBE, $B0C2, $B150, hook_equipment_screen_category_etanks + +hook_tanks_dpad_response: + lda $0755 + and #$FF00 + bne + + jsl dpad_enter_hud + jmp $AD08 ++ + jmp $ACF7 + +hook_beams_dpad_response: + jsl dpad_enter_hud + bcs + + lda $12 + sta $0755 ++ + rts + +hook_suits_dpad_response: + ; Just loaded A from $0755 + and #$ff00 ;Hijacked instruction + beq .varia + rts +.varia + jsl dpad_enter_hud + lda #$0000 + rts + +hook_suits_move_higher: + jsl dpad_enter_hud + bcs + + lda $12 + sta $0755 ++ + rts + +hook_equipment_screen_selector: + lda $0755 + and #$00ff + cmp #$0004 + bcc selector_go_back + + ;lda $0755 + ;xba + ;and #$00ff + ;asl a + ;asl a + ;tax + ; + ;lda positions_etank_selector_sprite_x, X + ;sta $12 + ;lda positions_etank_selector_sprite_y, x + ;sta $14 + ; + ;lda $12 + ;tax + ;lda $14 + ;tay + ; + ;lda #$3600 + ;sta $03 + ; + ;lda #$0014 + ; + ;jsl $81891F + + jmp $B2A0 + +selector_go_back: + lda $09A8 ; Hijacked instruction + jmp $B26D + +positions_etank_selector_sprite_x: + ; X, Y position + dw $000C +positions_etank_selector_sprite_y: + dw $0012 + dw $0014, $0042 + dw $001C, $0042 + dw $0024, $0042 + dw $002C, $0042 + dw $0034, $0042 + dw $003C, $0042 + dw $000C, $003A + dw $0014, $003A + dw $001C, $003A + dw $0024, $003A + dw $002C, $003A + dw $0034, $003A + dw $003C, $003A + +etanks_dpad_right: + lda !etank_hud_tile_offset ; xxxE -> furthest right tank tile + and #$000F + cmp #$000E + beq .no + + lda !current_etank_index + inc a + cmp !count_all_etanks ; Don't go right past the total number of E-Tanks + bcs .no + + lda $0755 + clc + adc #$0100 + sta $0755 + + sec + rts +.no + clc + rts + +etanks_dpad_left: + lda !etank_hud_tile_offset ;xxx2 -> furthest left tank tile + and #$000F + cmp #$0002 + beq .no + + lda !current_etank_index + dec a + cmp !count_full_etanks ; Don't go into full e-tanks + bcc .no + + sep #$20 + dec $0756 + rep #$20 + + sec + rts +.no + clc + rts + +etanks_dpad_down: + lda !etank_hud_tile_offset ; xx4x -> bottom row + and #$00F0 + bne .no + + ; Don't move down into full e-tanks + lda $09C2 + cmp #$02BC ; 700 hp + bcs .no + + lda $0755 + xba + and #$00ff + sec + sbc #$0007 + cmp !count_full_etanks + bcs + + lda !count_full_etanks ++ + sta $0756 + + sec + rts +.no + clc + rts + +etanks_dpad_up: + lda !etank_hud_tile_offset ;xx0x -> top row + and #$00F0 + beq .no + + lda !current_etank_index + clc + adc #$07 + cmp !count_all_etanks + bcc + + lda !count_all_etanks ++ + sep #$20 + sta $0756 + rep #$20 + + sec + rts +.no + clc + rts + +hook_equipment_screen_category_etanks: + + php + rep #$30 + + jsl etank_do_some_math + + lda $8f + bit #$0100 + beq .hook_etank_not_right + + jsr etanks_dpad_right + + bra .hook_etank_done + +.hook_etank_not_right + + lda $8f + bit #$0200 + beq .hook_etank_not_left + + jsr etanks_dpad_left + + bra .hook_etank_done + +.hook_etank_not_left lda $8F - and #$0040 ; newly pressed X? - bne .disable_tank + bit #$0400 + beq .hook_etank_not_down + jsr etanks_dpad_down + bcs .hook_etank_done + +.hook_etank_down_from_hud + ldx #$0000 + lda #$0000 + jsr $B43F ; Move to tanks + cmp #$0000 + bne .hook_etank_down_from_hud_done + jsr $B4B7 ; Move to suits/misc + cmp #$FFFF + bne .hook_etank_down_from_hud_done + jsr $B511 +.hook_etank_down_from_hud_done + clc + bra .hook_etank_done + +.hook_etank_not_down + lda $8F - and #$4000 ; newly pressed Y? - bne .enable_tank + bit #$0800 + beq .hook_etank_not_up + + jsr etanks_dpad_up -.done: - ; run hi-jacked instructions - lda #$0001 - sta $0763 - rtl + bra .hook_etank_done + +.hook_etank_not_up + + lda $8f + bit #$0080 + beq .ret + + + ; Is this a disabled E-Tank + lda !current_etank_index + cmp !count_enabled_etanks + bcs .selected_disabled_tank + + jsl disable_tank + + bra .ret + +.selected_disabled_tank + jsl enable_tank + bra .ret + +.hook_etank_done + bcc .ret + + lda #$0037 + jsl $809049 + +.ret + plp + rts + +warnpc !bank_82_free_space_end + +org !bank_85_free_space_start + +etank_do_some_math: + php + rep #$30 + + lda $0755 + xba + and #$00ff + sta !current_etank_index + + lda $09C2 + sta $4204 + sep #$20 + lda #$64 + sta $4206 + pha + pla + pha + pla + rep #$20 + lda $4214 + sta !count_full_etanks -.disable_tank: lda $09C4 - cmp #$0065 ; Is max health >= 101? - bmi .done + sta $4204 + sep #$20 + lda #$64 + sta $4206 + pha + pla + pha + pla + rep #$20 + lda $4214 + sta !count_enabled_etanks + clc + adc !num_disabled_etanks + sta !count_all_etanks - ; Decrease max health by 100 + lda $12 + asl a + tax + lda $809CCE,X ; There's a nice table here of E-Tank tile offsets that are convenient for our purposes + sta !etank_hud_tile_offset + + plp + rtl + +; Carry set = successful, carry clear = not successful +dpad_enter_hud: + ; Need to save this in case it's being used. + lda $12 + pha + jsl etank_do_some_math + pla + sta $12 + + ; Can we move up here at all. + lda !count_all_etanks + cmp !count_full_etanks + beq .no + + ; Are any not-full etanks enabled + lda !count_full_etanks + cmp !count_enabled_etanks + bcs .all_disabled + + ; Select leftmost enabled tank + lda !count_full_etanks + xba + and #$ff00 + ora #$0004 + bra .yes + +.all_disabled + ; Select rightmost disabled tank + lda !count_all_etanks + dec a + xba + and #$ff00 + ora #$0004 + +.yes + sta $0755 + lda #$0037 + jsl $809049 + stz $0A06 ; Force the HUD to redraw energy + sec - sbc #$0064 - sta $09C4 + rtl - ; Clamp current health to max health +.no + clc + rtl + +disable_tank: + ; Sanity check: can we actually disable this tank? + lda $09C4 + sec + sbc #$0064 cmp $09C2 - bpl .skip_clamp - sta $09C2 + bcc tank_swap_done ; (max health - 100) < current health = bad times -.skip_clamp: - ; Increment disabled ETank count + ; Disable 1 e-tank + lda $09C4 + sec + sbc #$0064 + sta $09C4 + inc !num_disabled_etanks + dec !count_enabled_etanks + + lda !current_etank_index + cmp !count_enabled_etanks + bcc disable_tank ; Repeat until we've disabled all tanks above the current tank - lda #$FFFF - sta $0A06 ; set previous health to invalid value, to trigger it to be redrawn - bra .done + bra tank_swap_good -.enable_tank: +enable_tank: lda !num_disabled_etanks ; is number of disabled ETanks non-zero? - beq .done + beq tank_swap_done ; Decrement disabled ETank count dec !num_disabled_etanks + inc !count_enabled_etanks ; Increase max health by 100 lda $09C4 clc adc #$0064 sta $09C4 + + lda !current_etank_index + cmp !count_enabled_etanks + bcs enable_tank ; Repeat until we've enabled all tanks above the current tank - lda #$FFFF - sta $0A06 ; set previous health to invalid value, to trigger it to be redrawn +tank_swap_good: + lda #$0038 + jsl $809049 - bra .done -warnpc !bank_80_free_space_end +tank_swap_done: + stz $0A06 ; set previous health to invalid value, to trigger it to be redrawn + dec $0A06 + rtl +warnpc !bank_85_free_space_end \ No newline at end of file From f14407d0c1818764ff459aef939c6d78c2c10dfa Mon Sep 17 00:00:00 2001 From: aquanight Date: Fri, 23 Jan 2026 09:38:43 -0700 Subject: [PATCH 02/17] HUD e-tank selector sprite --- patches/ips/disableable_etanks.ips | Bin 147 -> 855 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index 523787324ddec7f3fb3d592c2322ab902451fd9c..18eaa99bcf39257c7a5ac25e5326693da0daabe5 100644 GIT binary patch literal 855 zcmZvaPe>GT6vyA}t~)!UWKF~HYn2+8mUd$!E3ric(J(gHs33(RXdn;TA_QJK#dMg1 zhow2nq7=c8oW;ROj4t_y#TEC^G8EkkK|yd`Y%bwQ!uCejx^#H+`||tz-h1Eoo8R5u z`!`Y`O+bUZyjiJ0%P#ok@0-x_8`r%}c(M#*p@M8qaPbTNahSCXePE#RVBvuplB_qI~&!j?>BkTj`Bo(@fqRwr|$MS+l^E zKKU%EZaBHkLQ%AQRLl+@mvF#A?_`8665U71hK%T_MySvpiRLu=Y8)7+LH^;Y4?OKd zec-CMJsoh`WU_Ddz6HSRl6&S$0CuDNalTZm*?#%d2cky3b0N&>*;mh?R>5hZLQ%4U zk=dN4Hb=hTm(y9}Iz(>iYE1FvqVNrS*F9?j4v`J?ZOFz@HrSUMP7UL;6Z0<5 zL`JKeMySB&m&%i>7LH}8kn$!O)&xq5qH~do*uRmAJNUP`0H{1AU3HCjTX%vlE}0=2 z?2_Cbg3kp`Pu6vIh1;!itCBZ{zOIJ7x87Q=a$6D}AR|M72M$NvGLnZwVX1PE&-CB9 F`3IqhIf(!O delta 129 zcmcc4HknZXx4NT)6B)?`rlz_+wt(}Cdvh+=TKpt+Kf zp*NX5d+ia!fVuY&=eswYEC2uRW#ekNzV;30hfC+)Z~|3I ZWP%kzW%e=(`ZKU8-G1Eg>Xoa%8vu0?H9i0U From 8b0bbf3d420f018e9ece0670dc942e1b1639dc68 Mon Sep 17 00:00:00 2001 From: aquanight Date: Fri, 23 Jan 2026 14:24:58 -0700 Subject: [PATCH 03/17] Use the map cursor, and some Up+A checks --- patches/ips/disableable_etanks.ips | Bin 855 -> 939 bytes patches/src/disableable_etanks.asm | 216 +++++++++++++++++++++-------- 2 files changed, 159 insertions(+), 57 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index 18eaa99bcf39257c7a5ac25e5326693da0daabe5..a2b1624b1b1f91341ace9b3a0223f0746d4f14e2 100644 GIT binary patch delta 435 zcmcc4wwir{GGpaL6-OuIwd(9A85u5UFA`$d&vC3y^Z)(%Kx)4SgbAefcR-jx>eMNL z+jH2sR$iW)z|g75z^WAZqv_Se=?e8_KNyX&7?^z~{9rWs%D}47^5fMjM$>Gdik!8r zuNW&d8P6B2*|+}ChJcNYKi7t`Ycl-5z^?RkO{)*bTA%N0K&%a{ONDwv*%MA?FkE0+ zknkg$Yt^32quDGBtPHH{-~DD}UB8Z%;rIHy-;BT4>jCwDU`zmMTgkwXpv3fa&16nS z`RG$WT7~wW`Ozw}RA|*wkrgW$%vzaOW-utpcQ*Pg*tB*9r%&!C4hB930S0~s2_RMg zVhtcR0AdRu=3rn4%CQ6G*nx8FKsk1x96L~seR4Bni^}vhtxNkm85lpXDlq+Qhy<~j zfNaH|4Za{Y%LhdT+sWEY>bfaE8zg}u4GbTomkJ#f+rXxzxVE){U&#eXa!z1hY0jYJ uIiW!#foaWjhF6p8nSz+6ubF(AsZjzHHvbt;vM@|w0s1T(Y(}=LzZ(EjA)&tj delta 350 zcmZ3@ew}TCGGp;X6-Oi8wd(9A85u69t_@|^{LgTbh2eq}h{^E(HP?!L=jQC^I98|m z|NeX+HHVFB<>k2v6PGIl1^!?(%3@&l$^OA;@|A&AA^yj!SBw>!jH?RP>|1|mL%_zE zpAbVXuqzeMYW3k*>+^jLh_!)rsZehydjin>4~z*Qk(CS#AbPR~qkQzzAFV=rm;Y!L zSt_(@smO|z3}&s&D@7QT=X>j1F{5ZeGT4+9ra zjteNq1(f3g%5eeZxPWq8lMgYrsHo0rUE1Ht!1#ex;qH%yND!L|$o})A!5744`JkvE zF*%D#UDy6+gCtO-f#HMnQlX<_8`zZA&uVSpSGoiwIVZ5MG-puqoY0_=z%)yh;p*gl SOhHVlvnC5MH!{2Wy8!^p#CiGv diff --git a/patches/src/disableable_etanks.asm b/patches/src/disableable_etanks.asm index eabe7694e3..a6442c9097 100644 --- a/patches/src/disableable_etanks.asm +++ b/patches/src/disableable_etanks.asm @@ -4,8 +4,8 @@ !bank_82_free_space_start = $82F829 !bank_82_free_space_end = $82F9FF -!bank_85_free_space_start = $859A25 -!bank_85_free_space_end = $85FFFF +!bank_85_free_space_start = $85AC97 +!bank_85_free_space_end = $85AD81 !current_etank_index = $12 !count_full_etanks = $14 @@ -16,6 +16,11 @@ incsrc "constants.asm" +org $809698 + jsr hook_hud_begin + nop + nop + org $809BEE jsr hook_draw_tanks @@ -23,6 +28,25 @@ org $809BFB jsr hook_blink_selected_etank org !bank_80_free_space_start +hook_hud_begin: + php + rep #$20 + lda $0998 + and #$00ff + cmp #$000f + bne .no + + plp + lda #$14 + sta $212C + rts +.no + ;Hijacked code + plp + lda #$04 + sta $212C + rts + hook_draw_tanks: lda !num_disabled_etanks beq .done @@ -54,27 +78,51 @@ hook_blink_selected_etank: bne .done ; E-Tanks select - lda $0755 - and #$00FF - cmp #$0004 - bne .done + ;lda $0755 + ;and #$00FF + ;cmp #$0004 + ;bne .done - lda $0755 - and #$ff00 - xba - asl a + ; We need to make the entire energy area of the HUD not be priority so that we can draw the sprite on it + ldx #$0012 +- + lda $7EC608,x + and #$DFFF + sta $7EC608,x + lda $7EC648,x + and #$DFFF + sta $7EC648,x + lda $7EC688,x + and #$DFFF + sta $7EC688,x - tay - ldx $9CCE,y - - lda $05B5 - bit #$0010 - beq .done + ;ldy #$001A - lda $7EC608,x - and #$E3FF ; Remove the palette bits - ora #$1000 ; Set hilight palette - sta $7ec608,x + ;ldx $9CCE,y + ;lda $7EC608,x + ;and #$DFFF ; Remove the priority bit + ;sta $7EC608,x + dex + dex + bpl - + + + ;lda $0755 + ;and #$ff00 + ;xba + ;asl a + ; + ;tay + ;ldx $9CCE,y + ; + ;;lda $05B5 + ;;bit #$0010 + ;;beq .done + ; + ;lda $7EC608,x + ;and #$DFFF ; Remove the priority bit + ;;ora #$1000 ; Set hilight palette + ;sta $7ec608,x stz $0A06 ; Force this to redraw each frame @@ -84,6 +132,10 @@ hook_blink_selected_etank: warnpc !bank_80_free_space_end +org $818929 + jsl hook_pause_spritemap + nop + org $82AC5A jsr (hook_equipment_screen_main_category_jump_table, X) @@ -107,6 +159,10 @@ org $82B4F5 org $82B26A jmp hook_equipment_screen_selector +org $82B56B + jsl hook_equipment_button_response_safetynet + nop + org !bank_82_free_space_start hook_equipment_screen_main_category_jump_table: @@ -131,6 +187,37 @@ hook_beams_dpad_response: + rts +hook_pause_spritemap: + cmp #$0068 + bne .no + ldy #hook_pause_spritemap_smallbox + rtl +.no + ;Hijacked code + asl a + tax + ldy $C569,x + rtl + +hook_pause_spritemap_smallbox: + dw $0004 + + dw $0005 + db $05 + dw $EEAF + + dw $01FB + db $05 + dw $AEAF + + dw $0005 + db $FB + dw $6EAF + + dw $01FB + db $FB + dw $2EAF + hook_suits_dpad_response: ; Just loaded A from $0755 and #$ff00 ;Hijacked instruction @@ -155,29 +242,30 @@ hook_equipment_screen_selector: cmp #$0004 bcc selector_go_back - ;lda $0755 - ;xba - ;and #$00ff - ;asl a - ;asl a - ;tax - ; - ;lda positions_etank_selector_sprite_x, X - ;sta $12 - ;lda positions_etank_selector_sprite_y, x - ;sta $14 - ; - ;lda $12 - ;tax - ;lda $14 - ;tay - ; - ;lda #$3600 - ;sta $03 - ; + lda $0755 + xba + and #$00ff + asl a + asl a + tax + + lda positions_etank_selector_sprite_x, X + sta $12 + lda positions_etank_selector_sprite_y, x + sta $14 + + lda $12 + tax + lda $14 + tay + + lda #$3600 + sta $03 + ;lda #$0014 - ; - ;jsl $81891F + lda #$0068 + + jsl $81891F jmp $B2A0 @@ -187,22 +275,22 @@ selector_go_back: positions_etank_selector_sprite_x: ; X, Y position - dw $000C + dw $0008 positions_etank_selector_sprite_y: - dw $0012 - dw $0014, $0042 - dw $001C, $0042 - dw $0024, $0042 - dw $002C, $0042 - dw $0034, $0042 - dw $003C, $0042 - dw $000C, $003A - dw $0014, $003A - dw $001C, $003A - dw $0024, $003A - dw $002C, $003A - dw $0034, $003A - dw $003C, $003A + dw $000E + dw $0010, $000F + dw $0018, $000F + dw $0020, $000F + dw $0028, $000F + dw $0030, $000F + dw $0038, $000F + dw $0008, $0007 + dw $0010, $0007 + dw $0018, $0007 + dw $0020, $0007 + dw $0028, $0007 + dw $0030, $0007 + dw $0038, $0007 etanks_dpad_right: lda !etank_hud_tile_offset ; xxxE -> furthest right tank tile @@ -532,4 +620,18 @@ tank_swap_done: dec $0A06 rtl +hook_equipment_button_response_safetynet: + lda $0755 + and #$00ff + cmp #$0004 + bcc .okay + lda #$0000 + rtl +.okay + ; Hijacked code + lda $8F + bit #$0080 + rtl + + warnpc !bank_85_free_space_end \ No newline at end of file From cb2b18101a2a2f841b6ad351a6b14d54cd3842ef Mon Sep 17 00:00:00 2001 From: aquanight Date: Fri, 23 Jan 2026 14:27:14 -0700 Subject: [PATCH 04/17] Update bank 82 range --- patches/src/disableable_etanks.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/src/disableable_etanks.asm b/patches/src/disableable_etanks.asm index a6442c9097..50d81203c9 100644 --- a/patches/src/disableable_etanks.asm +++ b/patches/src/disableable_etanks.asm @@ -2,7 +2,7 @@ !bank_80_free_space_end = $80E440 !bank_82_free_space_start = $82F829 -!bank_82_free_space_end = $82F9FF +!bank_82_free_space_end = $82F9F8 !bank_85_free_space_start = $85AC97 !bank_85_free_space_end = $85AD81 From 0a775a72a68b6aa6438b399737b3ce3c485f4b4b Mon Sep 17 00:00:00 2001 From: aquanight Date: Fri, 23 Jan 2026 15:01:50 -0700 Subject: [PATCH 05/17] Fix d-pad up --- patches/ips/disableable_etanks.ips | Bin 939 -> 945 bytes patches/src/disableable_etanks.asm | 7 +++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index a2b1624b1b1f91341ace9b3a0223f0746d4f14e2..d2849f1140e901e10fa0a9444eb2ea6443e08038 100644 GIT binary patch delta 45 zcmV+|0Mh@f2eAi`=?c|wtiG?puu!pwvGX_q5*nov7-2jj7- Date: Fri, 23 Jan 2026 15:40:24 -0700 Subject: [PATCH 06/17] Adjust moving down from HUD to include beams --- patches/ips/disableable_etanks.ips | Bin 945 -> 930 bytes patches/src/disableable_etanks.asm | 15 +++++---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index d2849f1140e901e10fa0a9444eb2ea6443e08038..ecbbef845e9aca6d78b606e831a9dee472822da3 100644 GIT binary patch delta 53 zcmdnUzKDIoOU7dxUllMadoAtnWMKNhs-XC@!4AY``5>fV`*VZQN^=G!&j}4aYgcdX IVNzuT08{N1C;$Ke delta 68 zcmZ3)zL9;xOUA1kUllMKMK0~{WMKNhs-XC@!5744`Jkv^`*VZiA_j()3=9hPTTU`C YT;NvNzUAcq{}-4Q1h;OkWm07X0L%; Date: Mon, 26 Jan 2026 19:11:25 -0700 Subject: [PATCH 07/17] Adjust e-tank selection colors --- patches/ips/disableable_etanks.ips | Bin 930 -> 1011 bytes patches/src/disableable_etanks.asm | 44 ++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index ecbbef845e9aca6d78b606e831a9dee472822da3..2ec2ea65a853e15317db513e5fbe727cf580ce2a 100644 GIT binary patch delta 159 zcmZ3){+WG(GGp096-Q2kwd(9A85u5UOw7{|UwL_M0z;=J1FKTtkEU0Qf?F6^lp5Ez zPF!9uu+gRWCS>f delta 78 zcmV-U0I~n`2cid%BLR7lBtZ!?ttSV`0RYe|k!~mvoCXT1)16=di75aDB2oB)>XEH~ k5U=k00R^wF1pxc6ZueE|Xh>XW+y>H|ejMt4gdiU0rr diff --git a/patches/src/disableable_etanks.asm b/patches/src/disableable_etanks.asm index 47d884d08b..490b4ff979 100644 --- a/patches/src/disableable_etanks.asm +++ b/patches/src/disableable_etanks.asm @@ -5,7 +5,7 @@ !bank_82_free_space_end = $82F9EF !bank_85_free_space_start = $85AC97 -!bank_85_free_space_end = $85AD81 +!bank_85_free_space_end = $85ADA7 !current_etank_index = $12 !count_full_etanks = $14 @@ -124,7 +124,7 @@ hook_blink_selected_etank: ;;ora #$1000 ; Set hilight palette ;sta $7ec608,x - stz $0A06 ; Force this to redraw each frame + ;stz $0A06 ; Force this to redraw each frame .done lda #$9DD3 ; Hijacked @@ -163,6 +163,9 @@ org $82B56B jsl hook_equipment_button_response_safetynet nop +org $8291B4 + jsl hook_load_equipment_menu + org !bank_82_free_space_start hook_equipment_screen_main_category_jump_table: @@ -204,19 +207,19 @@ hook_pause_spritemap_smallbox: dw $0005 db $05 - dw $EEAF + dw $EEAE dw $01FB db $05 - dw $AEAF + dw $AEAE dw $0005 db $FB - dw $6EAF + dw $6EAE dw $01FB db $FB - dw $2EAF + dw $2EAE hook_suits_dpad_response: ; Just loaded A from $0755 @@ -632,4 +635,31 @@ hook_equipment_button_response_safetynet: rtl -warnpc !bank_85_free_space_end \ No newline at end of file +hook_load_equipment_menu: + jsl $82AC22 ;Hijacked code + ldx $0330 + lda #$0020 + sta $d0,x + inx + inx + lda.w #tile_modified_map_cursor + sta $d0,x + inx + inx + lda #$00b6 + sta $d0,x + inx + lda #$2AE0 + sta $d0,x + inx + inx + stx $0330 + rtl + +warnpc !bank_85_free_space_end + +org $B6FE80 +tile_modified_map_cursor: + db $00, $00, $00, $00, $3F, $00, $20, $00, $2F, $00, $28, $00, $28, $00, $28, $00 + db $00, $00, $00, $00, $3F, $00, $20, $00, $2F, $00, $28, $00, $28, $00, $28, $00 + From 3c2b4ce5625687789bc19b31ee0fce34590d8b92 Mon Sep 17 00:00:00 2001 From: aquanight Date: Mon, 26 Jan 2026 19:33:35 -0700 Subject: [PATCH 08/17] Comment cleanup --- patches/ips/disableable_etanks.ips | Bin 1011 -> 1014 bytes patches/src/disableable_etanks.asm | 88 ++++++++++------------------- 2 files changed, 30 insertions(+), 58 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index 2ec2ea65a853e15317db513e5fbe727cf580ce2a..77854211944f9772e99213f06f3c0ecf28181138 100644 GIT binary patch delta 67 zcmey&{*8UYD#n(Ht8EzbC%#zC$iI0CBM+mr%G%ZjekFGx$vJ_2r8$F==Y$501g169 X8HFeBW{PFhoh-?$!FX=6J@Xa-QIZ!a delta 65 zcmeyy{+WHkD#pf%t8Ex_CcaqB$hUb4BM+mr;@Z{*ekB(m$vJ_2r8$F==Y$501g169 V83iWqW{PFhnk>nzG1-NA696Gj7D@mB diff --git a/patches/src/disableable_etanks.asm b/patches/src/disableable_etanks.asm index 490b4ff979..03a3a269f5 100644 --- a/patches/src/disableable_etanks.asm +++ b/patches/src/disableable_etanks.asm @@ -5,7 +5,7 @@ !bank_82_free_space_end = $82F9EF !bank_85_free_space_start = $85AC97 -!bank_85_free_space_end = $85ADA7 +!bank_85_free_space_end = $85ADAA !current_etank_index = $12 !count_full_etanks = $14 @@ -31,12 +31,12 @@ org !bank_80_free_space_start hook_hud_begin: php rep #$20 - lda $0998 + lda $0998 ; If [game state] = Fh (pause menu) and #$00ff cmp #$000f bne .no - plp + plp ; Enable BG3 + Sprites in the HUD lda #$14 sta $212C rts @@ -77,13 +77,7 @@ hook_blink_selected_etank: cmp #$0001 bne .done - ; E-Tanks select - ;lda $0755 - ;and #$00FF - ;cmp #$0004 - ;bne .done - - ; We need to make the entire energy area of the HUD not be priority so that we can draw the sprite on it + ; Make the entire energy area of the HUD not be priority so that we can draw sprites on it ldx #$0012 - lda $7EC608,x @@ -96,36 +90,10 @@ hook_blink_selected_etank: and #$DFFF sta $7EC688,x - ;ldy #$001A - - ;ldx $9CCE,y - ;lda $7EC608,x - ;and #$DFFF ; Remove the priority bit - ;sta $7EC608,x dex dex bpl - - - ;lda $0755 - ;and #$ff00 - ;xba - ;asl a - ; - ;tay - ;ldx $9CCE,y - ; - ;;lda $05B5 - ;;bit #$0010 - ;;beq .done - ; - ;lda $7EC608,x - ;and #$DFFF ; Remove the priority bit - ;;ora #$1000 ; Set hilight palette - ;sta $7ec608,x - - ;stz $0A06 ; Force this to redraw each frame - .done lda #$9DD3 ; Hijacked rts @@ -262,13 +230,13 @@ hook_equipment_screen_selector: lda $14 tay - lda #$3600 + lda #$3600 ; Sprite priority 3, palette 3 sta $03 ;lda #$0014 lda #$0068 - jsl $81891F + jsl $81891F ; Draw sprite from pause menu spritemap jmp $B2A0 @@ -280,7 +248,7 @@ positions_etank_selector_sprite_x: ; X, Y position dw $0008 positions_etank_selector_sprite_y: - dw $000E + dw $000F dw $0010, $000F dw $0018, $000F dw $0020, $000F @@ -345,7 +313,7 @@ etanks_dpad_down: ; Don't move down into full e-tanks lda $09C2 - cmp #$02BC ; 700 hp + cmp #$02BC ; [Current energy] >= 700 means all 7 bottom row tanks are full bcs .no lda $0755 @@ -398,7 +366,7 @@ hook_equipment_screen_category_etanks: jsl etank_do_some_math lda $8f - bit #$0100 + bit #$0100 ; P1 D-Pad Right beq .hook_etank_not_right jsr etanks_dpad_right @@ -408,7 +376,7 @@ hook_equipment_screen_category_etanks: .hook_etank_not_right lda $8f - bit #$0200 + bit #$0200 ; P1 D-Pad Left beq .hook_etank_not_left jsr etanks_dpad_left @@ -418,7 +386,7 @@ hook_equipment_screen_category_etanks: .hook_etank_not_left lda $8F - bit #$0400 + bit #$0400 ; P1 D-Pad Down beq .hook_etank_not_down jsr etanks_dpad_down @@ -436,7 +404,7 @@ hook_equipment_screen_category_etanks: .hook_etank_not_down lda $8F - bit #$0800 + bit #$0800 ; P1 D-Pad Up beq .hook_etank_not_up jsr etanks_dpad_up @@ -446,7 +414,7 @@ hook_equipment_screen_category_etanks: .hook_etank_not_up lda $8f - bit #$0080 + bit #$0080 ; P1 Button A beq .ret @@ -484,7 +452,7 @@ etank_do_some_math: lda $0755 xba and #$00ff - sta !current_etank_index + sta !current_etank_index ; current_etank_index from equipment current item lda $09C2 sta $4204 @@ -497,7 +465,7 @@ etank_do_some_math: pla rep #$20 lda $4214 - sta !count_full_etanks + sta !count_full_etanks ; count_full_etanks = current_health / 100 lda $09C4 sta $4204 @@ -510,12 +478,12 @@ etank_do_some_math: pla rep #$20 lda $4214 - sta !count_enabled_etanks + sta !count_enabled_etanks ; count_enabled_etanks = maximum_health / 100 clc adc !num_disabled_etanks - sta !count_all_etanks + sta !count_all_etanks ; count_all_tanks = count_enabled_tanks + num_disabled_tanks - lda $12 + lda !current_etank_index asl a tax lda $809CCE,X ; There's a nice table here of E-Tank tile offsets that are convenient for our purposes @@ -543,7 +511,7 @@ dpad_enter_hud: cmp !count_enabled_etanks bcs .all_disabled - ; Select leftmost enabled tank + ; Select leftmost enabled tank (A button disables all tanks) lda !count_full_etanks xba and #$ff00 @@ -551,7 +519,7 @@ dpad_enter_hud: bra .yes .all_disabled - ; Select rightmost disabled tank + ; Select rightmost disabled tank (A button enables all tanks) lda !count_all_etanks dec a xba @@ -561,8 +529,9 @@ dpad_enter_hud: .yes sta $0755 lda #$0037 - jsl $809049 - stz $0A06 ; Force the HUD to redraw energy + jsl $809049 ; SFX "cursor moved" + stz $0A06 ; Force the HUD to redraw energy - this will cause the HUD to update with de-prioritized tiles so the cursor can draw over it + dec $0A06 sec rtl @@ -590,7 +559,7 @@ disable_tank: lda !current_etank_index cmp !count_enabled_etanks - bcc disable_tank ; Repeat until we've disabled all tanks above the current tank + bcc disable_tank ; Repeat until we've disabled all tanks above and including the selected tank bra tank_swap_good @@ -610,11 +579,11 @@ enable_tank: lda !current_etank_index cmp !count_enabled_etanks - bcs enable_tank ; Repeat until we've enabled all tanks above the current tank + bcs enable_tank ; Repeat until we've enabled all tanks below and including the current tank -tank_swap_good: +tank_swap_good: lda #$0038 - jsl $809049 + jsl $809049 ; SFX "menu selection" tank_swap_done: stz $0A06 ; set previous health to invalid value, to trigger it to be redrawn @@ -622,6 +591,7 @@ tank_swap_done: rtl hook_equipment_button_response_safetynet: + ; If we moved into the e-tank area, don't allow beams/suits/misc/boots to process an A button press and do possible weird things lda $0755 and #$00ff cmp #$0004 @@ -637,6 +607,8 @@ hook_equipment_button_response_safetynet: hook_load_equipment_menu: jsl $82AC22 ;Hijacked code + + ; Write the modified tile to VRAM at $2AE0 ldx $0330 lda #$0020 sta $d0,x From cff40090fa445b690f0b73a36e4a96c73475e4de Mon Sep 17 00:00:00 2001 From: aquanight Date: Mon, 26 Jan 2026 20:05:33 -0700 Subject: [PATCH 09/17] Move tile to avoid conflict with map_areas --- patches/ips/disableable_etanks.ips | Bin 1014 -> 1014 bytes patches/src/disableable_etanks.asm | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index 77854211944f9772e99213f06f3c0ecf28181138..be3b1b677264e4591ae4a95acef054c2c885641d 100644 GIT binary patch delta 38 rcmeyy{*8UZc4n!Be^W2Kc(HOD1CUzzKnuj_Ghoh^u1lDFky#Z0q%ag$ delta 38 rcmeyy{*8UZc4n!De^W2Kc(HOD1CUzzKnuj_Ghoh^u4|Zlky#Z0sE`zw diff --git a/patches/src/disableable_etanks.asm b/patches/src/disableable_etanks.asm index 03a3a269f5..d53bea2c83 100644 --- a/patches/src/disableable_etanks.asm +++ b/patches/src/disableable_etanks.asm @@ -630,7 +630,7 @@ hook_load_equipment_menu: warnpc !bank_85_free_space_end -org $B6FE80 +org $B6FE60 tile_modified_map_cursor: db $00, $00, $00, $00, $3F, $00, $20, $00, $2F, $00, $28, $00, $28, $00, $28, $00 db $00, $00, $00, $00, $3F, $00, $20, $00, $2F, $00, $28, $00, $28, $00, $28, $00 From 744a949b43043609c7513d323d76af19a3401e45 Mon Sep 17 00:00:00 2001 From: aquanight Date: Mon, 26 Jan 2026 20:14:06 -0700 Subject: [PATCH 10/17] Update rom map --- patches/ips/disableable_etanks.ips | Bin 1014 -> 1014 bytes patches/rom_map/Bank 82.txt | 3 ++- patches/rom_map/Bank 85.txt | 3 ++- patches/rom_map/Bank B6.txt | 3 ++- patches/src/disableable_etanks.asm | 8 ++++---- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index be3b1b677264e4591ae4a95acef054c2c885641d..e3bb22404682f096d8e7679ac330f1e5ff1f89b2 100644 GIT binary patch delta 279 zcmeyy{*8UYg8GObO|KXQw=l3My3IoPt1#9-LKeQoWW8crUq3oIr z|1YpB`K@jB;aKbQeGQ1Ufpw`+Zzy}h$qa@IEDO>n%QLES0fkpGFeCt_C;KtVvt9hr zDzx|V_BXm4?+qqKQ|byG-puqoY3I2 zcC|!J~d$^yzv_`zuM6)4jJk}=I@U{%Ur+xm*JLX+`W!J2*R4{Zq8*#2{ED7z-Z z{|oF&PuH~iaIE$Dz6QkFz`9hZHUw*-rgv z7211daxvrm^yzC_m-cruFn(ZFVEWnM1!6M+*@{0K>_BXm4?+sIKQ|byG-puqoY3I2 zcC|! Date: Tue, 27 Jan 2026 18:51:37 -0700 Subject: [PATCH 11/17] Use unused vanilla spritemap slot 10h instead of bludgeoning an extra slot in. --- patches/ips/disableable_etanks.ips | Bin 1014 -> 999 bytes patches/src/disableable_etanks.asm | 65 +++++++++++++---------------- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index e3bb22404682f096d8e7679ac330f1e5ff1f89b2..413460884aae15a3df48e9f0731cfd2218fda3b7 100644 GIT binary patch delta 176 zcmeyy{+xZntcgoBeIkA^8f7ss`xO0PH2KQFs*v{M)hkBRYz9`P8*5u%F*+qNNV71o zGO(_D_nVP*-8xo=-|O;zGyYzu#{dG16$Xq83)bvge`rI%#>|O7p50X1s? z1tQq3h3Wx#FagGJtiG?puu!p%lMewOCCO+2&;+1o_-hKPylKU21ONp91+MP<0R^tE z1pxc5Zu Date: Wed, 28 Jan 2026 19:09:32 -0700 Subject: [PATCH 12/17] Streamline IRQ and cursor positioning --- patches/ips/disableable_etanks.ips | Bin 999 -> 924 bytes patches/src/disableable_etanks.asm | 114 +++++++++++------------------ 2 files changed, 41 insertions(+), 73 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index 413460884aae15a3df48e9f0731cfd2218fda3b7..c3d4b20890a019d4a271c9d4761e3a8366f43bae 100644 GIT binary patch delta 268 zcmaFPK8Ia0z%j(xgF$Qt1Jlwu4ASoym=z8@W=KB3;5^Ymd}5wv=>EA0j7*|HVS^ux zf?F6^l-{mwWmMP<6fpb2sH_W-(1~JT{$u-tQRh7avyb}^Mgw~WR)xqPuU;`4ngLa$ z{$Mo90?O3?U^Mv(lqsHg#ZbJamq)R6P6CizDbnz*V9mbuhc*OkbeYW0=xnCHHkAFf z=6?pMRhk?OAGj8Nhu9j#}1xauK6)A3R IU`l5M01G5tTmS$7 delta 344 zcmbQk{+vB8z%j(xgF$Qt1FOP;$FE*7NWWuXR=D$+LHak4{{EOD`2a&1$03EaGdMN> zGo0jSxWKNlQlwW$F+pP`3y50#hVz3^tJuDCb5`ox%;z{(cjCk`u?rto?w^~0&||Px zo&6*u!v&3r2AZ~)=O!=;Zed_idb_rjQ74Ll`H#U5MxFNz%sy5>7!B-!4)OW%>J_7* z8PEX{KNyX&fHFlt7)`zcWzr_DGvr!Wux8)-LmL7%W={O(oT0fkl>If(ZCqTd_OAKS zDztaqk5-YTLaUaFtXRol*2=t6fI&&Vv(ab4rnM_LeR4N(Fz_=70I>uRD*&+u5E}ro z1rT#Eumk1TfpY9XId-5NJ5Y`tD96q)IiGQg)RP|#UQ7Es8JIq>Dlq?SumiDKJ_squ R|C}t#B+lrz*_0`r5dfI6b147- diff --git a/patches/src/disableable_etanks.asm b/patches/src/disableable_etanks.asm index cfbfe1fc18..301914f7ab 100644 --- a/patches/src/disableable_etanks.asm +++ b/patches/src/disableable_etanks.asm @@ -2,7 +2,7 @@ !bank_80_free_space_end = $80E440 !bank_82_free_space_start = $82F830 -!bank_82_free_space_end = $82F9F6 +!bank_82_free_space_end = $82F9AC !bank_85_free_space_start = $85AD00 !bank_85_free_space_end = $85AE13 @@ -17,35 +17,13 @@ incsrc "constants.asm" org $809698 - jsr hook_hud_begin - nop - nop + lda $9C +assert pc() == $80969A org $809BEE jsr hook_draw_tanks -org $809BFB - jsr hook_blink_selected_etank - org !bank_80_free_space_start -hook_hud_begin: - php - rep #$20 - lda $0998 ; If [game state] = Fh (pause menu) - and #$00ff - cmp #$000f - bne .no - - plp ; Enable BG3 + Sprites in the HUD - lda #$14 - sta $212C - rts -.no - ;Hijacked code - plp - lda #$04 - sta $212C - rts hook_draw_tanks: lda !num_disabled_etanks @@ -61,22 +39,6 @@ hook_draw_tanks: bne .loop .done: - ; run hi-jacked instruction - lda #$9DBF - rts - -hook_blink_selected_etank: - ; If we are in the pause menu: - lda $0998 - and #$00ff - cmp #$000F - bne .done - - ; Equipment screen selected - lda $0727 - cmp #$0001 - bne .done - ; Make the entire energy area of the HUD not be priority so that we can draw sprites on it ldx #$0012 - @@ -94,8 +56,8 @@ hook_blink_selected_etank: dex bpl - -.done - lda #$9DD3 ; Hijacked + ; run hi-jacked instruction + lda #$9DBF rts warnpc !bank_80_free_space_end @@ -157,9 +119,30 @@ hook_pause_spritemap_smallbox: db $00 dw $0000 +org $828215 + jsr hook_ppu_gameplay_setup + +org $82A32D + jsr hook_ppu_gameplay_setup + +org $82A0B3 + jsr hook_ppu_pause_setup + org !bank_82_free_space_start +hook_ppu_gameplay_setup: + ; lda #$04 from vanilla + sta $210C ;hijacked (both 8215 and A32D are this instruction) +hook_ppu_done: + sta $9C + rts + +hook_ppu_pause_setup: + sta $210C + lda #$14 + bra hook_ppu_done + hook_equipment_screen_main_category_jump_table: ; 0 - reserve tank, 1 - beams, 2 - suits/misc, 3 - boots - all go to their vanilla entry points ; 4 - e-tanks is ours @@ -209,20 +192,24 @@ hook_equipment_screen_selector: lda $0755 xba and #$00ff - asl a - asl a + inc tax - lda positions_etank_selector_sprite_x, X - sta $12 - lda positions_etank_selector_sprite_y, x - sta $14 - - lda $12 + and #$0008 + beq .no_adj + ldy #$0007 + txa + sec + sbc #$0007 + bra .no_adj2 + +.no_adj + ldy #$000f + txa +.no_adj2 + asl #$3 tax - lda $14 - tay - + lda #$3600 ; Sprite priority 3, palette 3 sta $03 @@ -237,25 +224,6 @@ selector_go_back: lda $09A8 ; Hijacked instruction jmp $B26D -positions_etank_selector_sprite_x: - ; X, Y position - dw $0008 -positions_etank_selector_sprite_y: - dw $000F - dw $0010, $000F - dw $0018, $000F - dw $0020, $000F - dw $0028, $000F - dw $0030, $000F - dw $0038, $000F - dw $0008, $0007 - dw $0010, $0007 - dw $0018, $0007 - dw $0020, $0007 - dw $0028, $0007 - dw $0030, $0007 - dw $0038, $0007 - etanks_dpad_right: lda !etank_hud_tile_offset ; xxxE -> furthest right tank tile and #$000F From daa69d1e7ca6df4c09cf5d288cf80cecdab16eb8 Mon Sep 17 00:00:00 2001 From: aquanight Date: Wed, 28 Jan 2026 19:59:00 -0700 Subject: [PATCH 13/17] Restore HUD tile priority on unpause (mostly) --- patches/ips/disableable_etanks.ips | Bin 924 -> 938 bytes patches/src/disableable_etanks.asm | 42 +++++++++++++++++------------ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index c3d4b20890a019d4a271c9d4761e3a8366f43bae..8f0d7f3856506ea0b1bc88bcaeb0fa48386b1b7b 100644 GIT binary patch delta 89 zcmbQkzKVT bottom row + lda !etank_hud_tile_offset ; xx4x -> bottom row and #$00F0 bne .no ; Don't move down into full e-tanks lda $09C2 - cmp #$02BC ; [Current energy] >= 700 means all 7 bottom row tanks are full + cmp #$02BC ; [Current energy] >= 700 means all 7 bottom row tanks are full bcs .no lda $0755 @@ -327,7 +335,7 @@ hook_equipment_screen_category_etanks: jsl etank_do_some_math lda $8f - bit #$0100 ; P1 D-Pad Right + bit #$0100 ; P1 D-Pad Right beq .hook_etank_not_right jsr etanks_dpad_right @@ -337,7 +345,7 @@ hook_equipment_screen_category_etanks: .hook_etank_not_right lda $8f - bit #$0200 ; P1 D-Pad Left + bit #$0200 ; P1 D-Pad Left beq .hook_etank_not_left jsr etanks_dpad_left @@ -347,7 +355,7 @@ hook_equipment_screen_category_etanks: .hook_etank_not_left lda $8F - bit #$0400 ; P1 D-Pad Down + bit #$0400 ; P1 D-Pad Down beq .hook_etank_not_down jsr etanks_dpad_down @@ -365,7 +373,7 @@ hook_equipment_screen_category_etanks: .hook_etank_not_down lda $8F - bit #$0800 ; P1 D-Pad Up + bit #$0800 ; P1 D-Pad Up beq .hook_etank_not_up jsr etanks_dpad_up @@ -375,7 +383,7 @@ hook_equipment_screen_category_etanks: .hook_etank_not_up lda $8f - bit #$0080 ; P1 Button A + bit #$0080 ; P1 Button A beq .ret @@ -413,7 +421,7 @@ etank_do_some_math: lda $0755 xba and #$00ff - sta !current_etank_index ; current_etank_index from equipment current item + sta !current_etank_index ; current_etank_index from equipment current item lda $09C2 sta $4204 @@ -426,7 +434,7 @@ etank_do_some_math: pla rep #$20 lda $4214 - sta !count_full_etanks ; count_full_etanks = current_health / 100 + sta !count_full_etanks ; count_full_etanks = current_health / 100 lda $09C4 sta $4204 @@ -439,10 +447,10 @@ etank_do_some_math: pla rep #$20 lda $4214 - sta !count_enabled_etanks ; count_enabled_etanks = maximum_health / 100 + sta !count_enabled_etanks ; count_enabled_etanks = maximum_health / 100 clc adc !num_disabled_etanks - sta !count_all_etanks ; count_all_tanks = count_enabled_tanks + num_disabled_tanks + sta !count_all_etanks ; count_all_tanks = count_enabled_tanks + num_disabled_tanks lda !current_etank_index asl a @@ -593,6 +601,6 @@ warnpc !bank_85_free_space_end org $B6FE60 tile_modified_map_cursor: - db $00, $00, $00, $00, $3F, $00, $20, $00, $2F, $00, $28, $00, $28, $00, $28, $00 - db $00, $00, $00, $00, $3F, $00, $20, $00, $2F, $00, $28, $00, $28, $00, $28, $00 + db $00, $00, $00, $00, $3F, $00, $20, $00, $2F, $00, $28, $00, $28, $00, $28, $00 + db $00, $00, $00, $00, $3F, $00, $20, $00, $2F, $00, $28, $00, $28, $00, $28, $00 From aceffea5d6838889514ef06359e53fffce22a7fa Mon Sep 17 00:00:00 2001 From: aquanight Date: Wed, 28 Jan 2026 20:14:06 -0700 Subject: [PATCH 14/17] Restore the rest of the HUD tile priority on unpause --- patches/ips/disableable_etanks.ips | Bin 938 -> 953 bytes patches/src/disableable_etanks.asm | 15 +++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index 8f0d7f3856506ea0b1bc88bcaeb0fa48386b1b7b..753b69f202b3cd35aeffb2f7f3fc8900e101ebde 100644 GIT binary patch delta 249 zcmZ3*zLR}|1f%yvNx6EBMM4bwIgZt7{=YvTNbUE4FoD$m4hR!SojN6Od*%MQ35-ml z49p6)KNtnKFt8}SUE9hioC_2%_`#^K8Av<-U{uzHDA0*wVE*IvgHh)_1G7)a4@Luf z23Cc%AFp098kzxB6#ZZ{$^y#taQt92`3jV3n7GGKrBkVLR>K@Nu5)Z$K93jm@+h{> zNdS^7MH;>ptl78z(1w7Gfty(vc^Qq){Alo6+TY2*^nq33^^XQS5S!(LkOKS94Mr=? b8I(LHH2ADtEzzI~lHdR;(%bCJl+FkMSbAR^ delta 234 zcmdnVzKVT<1Y_VtNx6ExMM4bwIgZt7{=d&EF(1g-?*Zcg8T&h693bP=DS@ji_s>mW zWD;dyRxtR%D7b}zMd|I@Rz`)*KmoHKjLNzY37seg=0CPS7JLVvETByN4@NeVuRy8diTe!2YkGMUTjwMI$(14v-wM|3TYqRnz($wN z!i>C(M*Dv>crESkWMKNhs&MZ|gB^&?@ Date: Wed, 28 Jan 2026 21:05:30 -0700 Subject: [PATCH 15/17] More efficient restore of the HUD priority --- patches/ips/disableable_etanks.ips | Bin 953 -> 980 bytes patches/src/disableable_etanks.asm | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index 753b69f202b3cd35aeffb2f7f3fc8900e101ebde..e1db113c3e8a4119ebd5298ff37fa1e182ffaf87 100644 GIT binary patch delta 219 zcmdnVeuaHPR!GDTM!_u%EJ|W;X`lj~Cg7>vos$40SBf-zD_FB{{hW;X`lj~CxX+NaQ>k)R!(@I&ImW=v zdW^h`MrVFBcrESkWMKNhs_^ Date: Thu, 29 Jan 2026 20:21:43 -0700 Subject: [PATCH 16/17] Small optimization of etank controller routine --- patches/ips/disableable_etanks.ips | Bin 980 -> 972 bytes patches/src/disableable_etanks.asm | 110 ++++++++++++----------------- 2 files changed, 47 insertions(+), 63 deletions(-) diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index e1db113c3e8a4119ebd5298ff37fa1e182ffaf87..458e64a264b93068bcc627e344c059b933e94b4a 100644 GIT binary patch delta 115 zcmV-(0F3|C2h0bM?*W{V@I3*YlP&?-3#m5%B1w>dXiTlElL-PNOaKAr_y7V1`2YkW z`2Yw~`G5e6`2YZ=62%s<1|p5Eg@6Piu&sp{U top row @@ -346,80 +351,59 @@ etanks_dpad_up: clc rts -hook_equipment_screen_category_etanks: - - php - rep #$30 - - jsl etank_do_some_math - - lda $8f - bit #$0100 ; P1 D-Pad Right - beq .hook_etank_not_right - - jsr etanks_dpad_right - - bra .hook_etank_done - -.hook_etank_not_right - - lda $8f - bit #$0200 ; P1 D-Pad Left - beq .hook_etank_not_left - - jsr etanks_dpad_left +; Controller input table - zero-terminated +hook_equipment_screen_category_etanks_controller_table: + dw $0100 +hook_equipment_screen_category_etanks_controller_table_func: + dw etanks_dpad_right + dw $0200, etanks_dpad_left + dw $0400, etanks_dpad_down + dw $0800, etanks_dpad_up + dw $0080, etanks_a_button + dw $0000 - bra .hook_etank_done +etanks_a_button: + ; Is this a disabled E-Tank + lda !current_etank_index + cmp !count_enabled_etanks + bcs .selected_disabled_tank -.hook_etank_not_left + jsl disable_tank - lda $8F - bit #$0400 ; P1 D-Pad Down - beq .hook_etank_not_down - - jsr etanks_dpad_down - bcs .hook_etank_done + bra .ret -.hook_etank_down_from_hud - lda #$0037 - jsl $809049 - jmp $ABAD +.selected_disabled_tank + jsl enable_tank -.hook_etank_down_from_hud_done +.ret clc - bra .hook_etank_done + rts -.hook_etank_not_down +hook_equipment_screen_category_etanks: - lda $8F - bit #$0800 ; P1 D-Pad Up - beq .hook_etank_not_up + php + rep #$30 - jsr etanks_dpad_up - - bra .hook_etank_done + jsl etank_do_some_math -.hook_etank_not_up + ;for (short* x = hook_equipment_category_etanks_controller_table; *x; x += 2) + ldx #$0000 + bra .start +- + inx #$4 +.start + lda hook_equipment_screen_category_etanks_controller_table,x + beq .ret + ; All bits indicated must be newly pressed lda $8f - bit #$0080 ; P1 Button A beq .ret + and hook_equipment_screen_category_etanks_controller_table,x + cmp hook_equipment_screen_category_etanks_controller_table,x + bne - - - ; Is this a disabled E-Tank - lda !current_etank_index - cmp !count_enabled_etanks - bcs .selected_disabled_tank - - jsl disable_tank - - bra .ret - -.selected_disabled_tank - jsl enable_tank - bra .ret - -.hook_etank_done + ; Found a candidate + jsr (hook_equipment_screen_category_etanks_controller_table_func, x) bcc .ret lda #$0037 From bf841c04d0206822038699565030dbfa22177a1f Mon Sep 17 00:00:00 2001 From: aquanight Date: Thu, 29 Jan 2026 21:53:36 -0700 Subject: [PATCH 17/17] Update description --- .../templates/generate/help/quality/disableable_etanks.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/maprando-web/templates/generate/help/quality/disableable_etanks.html b/rust/maprando-web/templates/generate/help/quality/disableable_etanks.html index 2ba9d6f2af..d03c421b93 100644 --- a/rust/maprando-web/templates/generate/help/quality/disableable_etanks.html +++ b/rust/maprando-web/templates/generate/help/quality/disableable_etanks.html @@ -6,9 +6,9 @@

Disableable E-Tanks