From 6a6b22c3d544b62566c470b4563447b3eeda32da Mon Sep 17 00:00:00 2001 From: sporchia Date: Tue, 13 Feb 2018 08:37:46 -0500 Subject: [PATCH] Zarby's arrow code, will need to be made configurable probably just based on cost per arrow, or a flag and word for each cost, silvers/wooden --- LTTP_RND_GeneralBugfixes.asm | 1 + hooks.asm | 12 ++++++++++++ retro.asm | 27 +++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 retro.asm diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 9695e94..c4a401a 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -133,6 +133,7 @@ incsrc music.asm incsrc cuccostorm.asm incsrc roomloading.asm incsrc icepalacegraphics.asm +incsrc retro.asm incsrc hashalphabet.asm ; <- TAKE OUT THE EXTRA ORGS IN HERE - THIS IS WHY WE COULDN'T ADD MORE FILES EARLIER warnpc $A18000 diff --git a/hooks.asm b/hooks.asm index 84a20d3..7c2db06 100644 --- a/hooks.asm +++ b/hooks.asm @@ -2049,3 +2049,15 @@ org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040) org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit ReloadingFloorsCancel: ;================================================================================ + +;================================================================================ +; Hook bow use - to use rupees instead of actual arrows +;-------------------------------------------------------------------------------- +org $07A055 +NOP #$12 ; Remove archery minigame code + +org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377) (Skip #$02) (DEC A : LDA $7EF377) +JSL CheckEnoughRupeeArrows +skip #$02 ;Skip the BEQ +NOP #$0B ;Remove hud update code for bow/arrow kinda useless / Remove decrease arrow code +;================================================================================ diff --git a/retro.asm b/retro.asm new file mode 100644 index 0000000..b32a400 --- /dev/null +++ b/retro.asm @@ -0,0 +1,27 @@ +CheckEnoughRupeeArrows: +{ + LDA $0B99 : BNE .minigame_arrow + PHX ;save X value which is ancilla of the arrow + REP #$30 ;Set 16bit mode + LDA $7EF340 : AND #$00FF : TAX ;check what bow we have + LDA $7EF360 : CMP.l .rupees_cost, X : BCC .not_enough_rupees ;Load Rupees count + SBC.l .rupees_cost, X : STA $7EF360 ;decrease rupee by 5 + + SEP #$30 + PLX + BRA .ignore_minigame + .minigame_arrow + DEC $0B99 + .ignore_minigame + LDA #$01 ;return 01 if we have enough rupee so it doesnt despawn the arrow + RTL + + .not_enough_rupees + SEP #$30 + PLX + LDA #$00 ;Return 00 if we don't have enough rupee so it despawn the arrow + RTL + + .rupees_cost ;Normal, Normal, Silver, Silver + dw #$0005, #$0005, #$000A, #$000A +}