From 5c528b269ecb53e520a35c0fcd6d68fed06f1e02 Mon Sep 17 00:00:00 2001 From: Karkat Date: Thu, 15 Feb 2018 00:28:14 -0500 Subject: [PATCH] let's dev 2/15/18 added money arrow mode to classic fixed generic key mode hud after falling into holes --- LTTP_RND_GeneralBugfixes.asm | 5 ++- hooks.asm | 29 +++++++-------- hud.asm | 3 +- newitems.asm | 30 ++++++++++++++-- pendantcrystalhud.asm | 27 ++++++++++++++ retro.asm | 69 ++++++++++++++++++++---------------- tables.asm | 13 ++++++- 7 files changed, 127 insertions(+), 49 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index c4a401a..7065de9 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -26,7 +26,7 @@ org $3FFFFF ; <- 1FFFFF db #$00 ; expand file to 2mb org $1FFFF8 ; <- FFFF8 timestamp rom -db #$20, #$18, #$02, #$11 ; year/month/day +db #$20, #$18, #$02, #$15 ; year/month/day ;================================================================================ @@ -491,6 +491,9 @@ DrawEquipment: ; this returns short org $0DFA78 HUD_RebuildLong: +org $0DFA88 +HUD_RebuildIndoor_Palace: + org $0EEE10 Messaging_Text: diff --git a/hooks.asm b/hooks.asm index 7c2db06..4effc0e 100644 --- a/hooks.asm +++ b/hooks.asm @@ -984,10 +984,10 @@ org $0DFCC4 ; <- 6FCC4 STA $7EC75C ; nudge bomb 1s digit right org $0DFCDC ; <- 6FCDC -STA $7EC760 ; nudge arrow 10s digit right +JSL.l DrawArrowTens org $0DFCE8 ; <- 6FCE8 -STA $7EC762 ; nudge arrow 1s digit right +JSL.l DrawArrowOnes ;org $0DFD0A ; <- 6FD0A - headsup_display.asm : 900 ;STA $7EC766 ; nudge key digit right @@ -1004,7 +1004,7 @@ org $0DFB29 ; <- headsup_display.asm : 688 (LDA.b #$86 : STA $7EC71E) ;LDA.b #$24 : STA $7EC721 ;LDA.b #$87 : STA $7EC722 ;LDA.b #$24 : STA $7EC723 -JSL.l DrawHUDSilverArrows : BRA + +JSL.l DrawHUDArrows : BRA + NOP #18 + ;-------------------------------------------------------------------------------- @@ -1150,9 +1150,12 @@ JSL.l SaveKeys org $0282EC ; <- 102EC - Bank02.asm:650 - (STA $7EF36F) JSL.l ClearOWKeys ;-------------------------------------------------------------------------------- -org $0DFA80 ; <- 6FA80 ; headsup_display.asm:596 - (LDA.b #$00 : STA $7EC017) +org $0DFA80 ; <- 6FA80 : headsup_display.asm:596 - (LDA.b #$00 : STA $7EC017) JSL.l HUDRebuildIndoor : NOP #4 ;-------------------------------------------------------------------------------- +org $029A35 ; <- 11A35 : Bank02.asm:4789 - (JSL HUD.RebuildIndoor.palace) +JSL.l HUDRebuildIndoorHole +;-------------------------------------------------------------------------------- org $0DFD02 ; <- 6FD02 ; headsup_display.asm:900 - (LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC764) JSL.l DrawKeyIcon : NOP #8 ;-------------------------------------------------------------------------------- @@ -1512,10 +1515,10 @@ STZ $1CE8 : NOP org $1EE523 ; <- F6523 sprite_kiki.asm : 373 kiki will open door NOP #4 -org $1EE414 ; <- F6414 sprite_kiki.asm : 193 don't have 10 rupees -NOP #4 -org $1EE50C ; <- F650C sprite_kiki.asm : 356 don't have 100 rupees -NOP #4 +;org $1EE414 ; <- F6414 sprite_kiki.asm : 193 don't have 10 rupees +;NOP #4 +;org $1EE50C ; <- F650C sprite_kiki.asm : 356 don't have 100 rupees +;NOP #4 ;---------------------------------------------------- ;-- Witch org $05E4FB ; <- 2E4FB sprite_witch.asm : 165 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) @@ -2053,11 +2056,9 @@ org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit ;================================================================================ ; Hook bow use - to use rupees instead of actual arrows ;-------------------------------------------------------------------------------- -org $07A055 -NOP #$12 ; Remove archery minigame code +org $07A055 ; <- Bank07.asm:5205 (LDA $0B99 : BEQ BRANCH_DELTA) +JSL.l ArrowGame : NOP #14 -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 +org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON) +JSL.l DecrementArrows : SKIP #2 : NOP #5 ;================================================================================ diff --git a/hud.asm b/hud.asm index bb01530..1eba643 100644 --- a/hud.asm +++ b/hud.asm @@ -3,7 +3,8 @@ HUD_TileMap: dw $207F, $207F, $2850, $A856 dw $2852, $285B, $285B, $285C ;dw $207F, $3CA8, $207F, $207F, $207F - dw $207F, $3C02, $3C03, $207F, $207F + dw $207F, $3C02, $3C03, $207F, $207F ; normal mode + ;dw $3C02, $3C03, $207F, $207F, $207F ; rupee arrows dw $2C88, $2C89, $207F, $20A7 dw $20A9, $207F, $2871 ;, $207F dw $207F, $207F, $288B, $288F diff --git a/newitems.asm b/newitems.asm index 176db05..0f98dcf 100755 --- a/newitems.asm +++ b/newitems.asm @@ -316,6 +316,13 @@ AddReceivedItemExpandedGetItem: + CMP.b #$A0 : !BLT + : CMP.b #$B0 : !BGE + ; Free Small Key AND #$0F : TAX LDA $7EF37C, X : INC : STA $7EF37C, X ; Increment Key Count + + CPX.b #$00 : BNE + + STA $7EF37D ; copy HC to sewers + + : CPX.b #$01 : BNE + + STA $7EF37C ; copy sewers to HC + + + LDA.l GenericKeys : BEQ + .generic LDA $7EF36F : INC : STA $7EF36F @@ -833,15 +840,34 @@ RTL ;-------------------------------------------------------------------------------- ;Return $7EF340 but also draw silver arrows if you have the upgrade even if you don't have the bow CheckHUDSilverArrows: + LDA.l ArrowMode : BEQ .normal + .rupee_arrows + JSL.l DrawHUDArrows + LDA $7EF340 + RTL + .normal LDA $7EF340 : BNE + LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ ++ - JSL.l DrawHUDSilverArrows + JSL.l DrawHUDArrows ++ LDA $7EF340 + RTL ;-------------------------------------------------------------------------------- -DrawHUDSilverArrows: +DrawHUDArrows: +LDA.l ArrowMode : BEQ .normal + .rupee_arrows + LDA.b #$7F : STA $7EC720 ; draw no arrows + LDA.b #$24 : STA $7EC721 + LDA.b #$7F : STA $7EC722 + LDA.b #$24 : STA $7EC723 + + LDA.b #$86 : STA $7EC714 ; draw silver arrow marker + LDA.b #$24 : STA $7EC715 + LDA.b #$87 : STA $7EC716 + LDA.b #$24 : STA $7EC717 +RTL + .normal LDA.b #$86 : STA $7EC720 ; draw silver arrow marker LDA.b #$24 : STA $7EC721 LDA.b #$87 : STA $7EC722 diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index e1393ce..df43a1b 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -18,6 +18,19 @@ FlipLWDWFlag: PLP RTL ;================================================================================ +HUDRebuildIndoorHole: + PHA + LDA.l GenericKeys : BEQ .normal + .generic + PLA + LDA $7EF38B ; generic key count + JSL.l HUD_RebuildIndoor_Palace +RTL + .normal + PLA + JSL.l HUD_RebuildIndoor_Palace +RTL +;================================================================================ HUDRebuildIndoor: LDA.l GenericKeys : BEQ .normal .generic @@ -228,6 +241,20 @@ RTL ;$388 = Turtle Rock ;$389 = Ganon's Tower ;-------------------------------------------------------------------------------- +DrawArrowTens: + PHA : LDA.l ArrowMode : AND.w #$00FF : BNE + + PLA : STA $7EC760 : RTL + + + PLA +RTL +;-------------------------------------------------------------------------------- +DrawArrowOnes: + PHA : LDA.l ArrowMode : AND.w #$00FF : BNE + + PLA : STA $7EC762 : RTL + + + PLA +RTL +;-------------------------------------------------------------------------------- DrawBootsInMenuLocation: LDA.l HUDDungeonItems : BNE + LDA.w #$1608 : STA $00 diff --git a/retro.asm b/retro.asm index 8deb136..c9f9d91 100644 --- a/retro.asm +++ b/retro.asm @@ -1,31 +1,40 @@ -CheckEnoughRupeeArrows: -{ - LDA $0B99 : BNE .minigame_arrow - LDA $7EF340 : CMP #$03 : BCS .skip_arrow_check ;03 is the silver bow without arrows - LDA $7EF377 : BEQ .no_arrows - .skip_arrow_check - PHX - REP #$30 ;Set 16bit mode - LDA $7EF340 : AND #$00FF : TAX - 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 +DecrementArrows: + LDA.l ArrowMode : BNE .rupees + .normal + LDA $7EF377 : BEQ .done + DEC A : STA $7EF377 + .rupees + LDA $7EF340 : AND.b #$01 : BEQ + + LDA.b #$00 : RTL + + + PHX + REP #$20 ; set 16-bit accumulator + LDA $7EF360 : BEQ + + PHA : LDA $7EF340 : DEC : AND #$0002 : TAX : PLA + !SUB.l ArrowModeWoodArrowCost, X ; CMP.w #$0000 + BMI .not_enough_money + STA $7EF360 : BRA + + .not_enough_money + LDA.w #$0000 + + + SEP #$20 ; set 8-bit accumulator + PLX + .done + CMP.b #$00 +RTL - 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 - .no_arrows - 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 -} +ArrowGame: + LDA $0B99 : BEQ + + DEC $0B99 ; reduce minigame arrow count + LDA.l ArrowMode : BNE .rupees + .normal + LDA $7EF377 : INC #2 : STA $7EF377 ; increment arrow count (by 2 for some reason) + .rupees + PHX + REP #$20 ; set 16-bit accumulator + PHA : LDA $7EF340 : DEC : AND #$0002 : TAX : PLA + LDA $7EF360 : !ADD.l ArrowModeWoodArrowCost, X : STA $7EF360 + SEP #$20 ; set 8-bit accumulator + PLX + + +RTL diff --git a/tables.asm b/tables.asm index 57ffca9..d64031e 100644 --- a/tables.asm +++ b/tables.asm @@ -131,7 +131,7 @@ org $30803B ; PC 0x18003B MapMode: db #$00 ; #$00 = Always On (default) - #$01 = Require Map Item CompassMode: -db #$02 ; #$00 = Off (default) - #$01 = Display Dungeon Count w/Compass - #$02 = Display Dungeon Count Always +db #$00 ; #$00 = Off (default) - #$01 = Display Dungeon Count w/Compass - #$02 = Display Dungeon Count Always ;-------------------------------------------------------------------------------- org $30803D ; PC 0x18003D PersistentFloodgate: @@ -739,6 +739,14 @@ org $308174 ; PC 0x180174 FixFakeWorld: db #$00 ; #00 = Fix Off (Default) - #$01 = Fix On ;================================================================================ +org $308175 ; PC 0x180175 +ArrowMode: +db #$00 ; #00 = Normal (Default) - #$01 = Rupees +ArrowModeWoodArrowCost: ; keep these together +dw #$0005 ; #$0005 = 5 (Default) +ArrowModeSilverArrowCost: ; keep these together +dw #$000A ; #$000A = 10 (Default) +;================================================================================ org $308190 ; PC 0x180190 TimerStyle: db #$00 ; #$00 = Off (Default) - #$01 Countdown - #$02 = Stopwatch @@ -1327,6 +1335,9 @@ dw #9999 ; Rupee Limit ; $7F50C5 - Cucco Attack Modifier ; $7F50C6 - Old Man Dash Modifier ; $7F50C7 - Ice Physics Modifier +; $7F50C8 - Infinite Arrows Modifier +; $7F50C9 - Infinite Bombs Modifier +; $7F50CA - Infinite Magic Modifier ; $7F50D0 - $7F50FF - Block Cypher Parameters ; $7F5100 - $7F51FF - Block Cypher Buffer