From 30122cfa3d9d1c584908ede739d203cea8701b58 Mon Sep 17 00:00:00 2001 From: Kara Alexandra Date: Mon, 25 Nov 2024 00:03:09 -0600 Subject: [PATCH] Per-Item improved magic consumption --- LTTP_RND_GeneralBugfixes.asm | 1 + data/c2807_v4.bin | Bin 2048 -> 2048 bytes data/c2807_v4.gfx | Bin 1504 -> 1522 bytes improve_items.asm | 114 +++++++++++++++++++++++++++++++++++ inventory.asm | 2 + itemdatatables.asm | 18 +++--- newitems.asm | 18 ++++++ 7 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 improve_items.asm diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 81e2742..4d23e2e 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -163,6 +163,7 @@ incsrc mothula.asm incsrc switches.asm incsrc zoom_on_carry.asm incsrc iframes.asm +incsrc improve_items.asm warnpc $A58000 org $A28000 diff --git a/data/c2807_v4.bin b/data/c2807_v4.bin index 2023b0b43738e02dc62f6577535791938dc6012b..cf00c270f10a69b87b5af7466f11a2161c5f8df0 100644 GIT binary patch delta 68 zcmZn=Xb{*?#LV~n|92q#_W#lTfA;_DCpRz`2>kzF|KI(8`Tyhp@Bcmi=l{P+EC;}1 U;s3*dV&DIM2a0XJz+%7*01r(rnE(I) delta 68 zcmZn=Xb{*?#LV{}1x#*WE)b~ypAUo?|L^_3@&ES!AO9z@9Ds^t{l5hiyZ8U!|IHUz G4445>gfEW( diff --git a/data/c2807_v4.gfx b/data/c2807_v4.gfx index 29994a64fbb1908d21ed8f3c96dd8fd2273f00a0..61ba6282a1fa6e22622038d02b4cd9cad0cd46cb 100644 GIT binary patch delta 133 zcmV;00DAx63-SxFoB}E&{{ZJi|Mv&>|Kh*?KmUIx004hPe@FmHLx2B-Qvw9j|H1!r zgAf2F0F$-?EFKKU*Q?hl?-AE2*Q@_WgH8exNB?*K$N%5`$Nc~Pll}seCI-U(`u>Lg n{Dcn!Ls$P4$N%^J_x%6ewU;n>^eY42}DFUc>J&gbW diff --git a/improve_items.asm b/improve_items.asm new file mode 100644 index 0000000..1ab1795 --- /dev/null +++ b/improve_items.asm @@ -0,0 +1,114 @@ +pushpc + +org $8DE4FE +JSR.w ItemMenu_DrawEnhanced_Short +org $8DE514 +JSR.w ItemMenu_DrawEnhanced_Short +org $8DE52A +JSR.w ItemMenu_DrawEnhanced_Short +org $8DE540 +JSR.w ItemMenu_DrawEnhanced_Short +org $8DE556 +JSR.w ItemMenu_DrawEnhanced_Short +org $8DE56C +JSR.w ItemMenu_DrawEnhanced_Short +org $8DE5FF +JSR.w ItemMenu_DrawEnhanced_Short +org $8DE615 +JSR.w ItemMenu_DrawEnhanced_Short +org $8DE62B +JSR.w ItemMenu_DrawEnhanced_Short + +org $8DFB63 +JSL.l GetItemLevelForHud + +org $8DFFFB +ItemMenu_DrawEnhanced_Short: +JSL.l ItemMenu_DrawEnhanced +RTS + +pullpc + +ItemMenu_DrawEnhanced: + LDA.b $02 + BEQ + + LDA.w #$0008 ++ TAY + + LDX.b $00 + LDA.b ($04),Y + STA.w $0000,X + + INY : INY + + LDA.b ($04),Y + STA.w $0002,X + + INY : INY + + LDA.b ($04),Y + STA.w $0040,X + + INY : INY + + LDA.b ($04),Y + STA.w $0042,X + RTL + +AddMagicMarker: + LDA.w ItemCursor : AND.w #$00FF ; load item value + PHX + TAX + LDA.l CanReduceMagic, X : AND.w #$00FF + BEQ .done + LDA.l EquipmentWRAM-1, X : AND.w #$00FF + DEC : DEC + BMI .done + BEQ .half +.quarter + LDA.w #$3D4C + BRA .write +.half + LDA.w #$3D3F +.write + STA.w $FFC2, Y + LDA.w #$3D37 + STA.w $FFC0, Y +.done + PLX + RTL + +GetItemLevelForHud: + LDA.l CanReduceMagic, X : AND.w #$00FF + BNE + ; it's already $0001, so we can return + LDA.l EquipmentWRAM-1, X ; normal, what we wrote over ++ RTL + +CheckMagicLevel: + LDA.w ItemCursor ; load item value + TAX + LDA.l CanReduceMagic, X + BEQ .normal + LDA.l EquipmentWRAM-1, X + DEC : DEC + BMI .normal + BEQ .half +.quarter + LDA.b #$02 + BRA .write +.half + LDA.b #$01 + BRA .write +.normal + LDA.b #$00 +.write + STA.l MagicConsumption + RTL + + +CanReduceMagic: + db $00 + db $00, $00, $00, $00, $00 + db $01, $01, $01, $01, $01 + db $01, $00, $00, $00, $00 + db $00, $01, $01, $01, $00 diff --git a/inventory.asm b/inventory.asm index 0e977b4..74a22c6 100644 --- a/inventory.asm +++ b/inventory.asm @@ -418,6 +418,8 @@ AddYMarker: .drawTile STA.w $FFC4, Y + + JSL AddMagicMarker RTL ;-------------------------------------------------------------------------------- diff --git a/itemdatatables.asm b/itemdatatables.asm index b1e9a35..bf1f205 100644 --- a/itemdatatables.asm +++ b/itemdatatables.asm @@ -143,25 +143,25 @@ endmacro %ReceiptProps($04, -5, 4, $2D, $F35A, $01, fighter_shield, skip) ; 04 - Fighter shield %ReceiptProps($05, -4, 0, $20, $F35A, $02, red_shield, skip) ; 05 - Fire shield %ReceiptProps($06, -4, 0, $2E, $F35A, $03, mirror_shield, skip) ; 06 - Mirror shield -%ReceiptProps($07, -5, 4, $09, $F345, $01, skip, skip) ; 07 - Fire rod -%ReceiptProps($08, -5, 4, $09, $F346, $01, skip, skip) ; 08 - Ice rod +%ReceiptProps($07, -5, 4, $09, $F345, $FF, magic_item, skip) ; 07 - Fire rod +%ReceiptProps($08, -5, 4, $09, $F346, $FF, magic_item, skip) ; 08 - Ice rod %ReceiptProps($09, -4, 4, $0A, $F34B, $01, skip, skip) ; 09 - Hammer %ReceiptProps($0A, -4, 4, $08, $F342, $01, skip, skip) ; 0A - Hookshot %ReceiptProps($0B, -4, 4, $05, $F340, $01, bow, skip) ; 0B - Bow %ReceiptProps($0C, -2, 5, $10, $F341, $01, blue_boomerang, skip) ; 0C - Blue Boomerang %ReceiptProps($0D, -4, 0, $0B, $F344, $02, powder, skip) ; 0D - Powder %ReceiptProps($0E, -4, 0, $2C, $F35C, $FF, skip, skip) ; 0E - Bottle refill (bee) -%ReceiptProps($0F, -4, 0, $1B, $F347, $01, skip, skip) ; 0F - Bombos -%ReceiptProps($10, -4, 0, $1A, $F348, $01, skip, skip) ; 10 - Ether -%ReceiptProps($11, -4, 0, $1C, $F349, $01, skip, skip) ; 11 - Quake -%ReceiptProps($12, -4, 0, $14, $F34A, $01, skip, skip) ; 12 - Lamp +%ReceiptProps($0F, -4, 0, $1B, $F347, $FF, magic_item, skip) ; 0F - Bombos +%ReceiptProps($10, -4, 0, $1A, $F348, $FF, magic_item, skip) ; 10 - Ether +%ReceiptProps($11, -4, 0, $1C, $F349, $FF, magic_item, skip) ; 11 - Quake +%ReceiptProps($12, -4, 0, $14, $F34A, $FF, magic_item, skip) ; 12 - Lamp %ReceiptProps($13, -4, 4, $19, $F34C, $01, shovel, skip) ; 13 - Shovel %ReceiptProps($14, -4, 0, $0C, $F34C, $02, flute_inactive, skip) ; 14 - Flute -%ReceiptProps($15, -4, 4, $07, $F350, $01, skip, skip) ; 15 - Somaria +%ReceiptProps($15, -4, 4, $07, $F350, $FF, magic_item, skip) ; 15 - Somaria %ReceiptProps($16, -4, 0, $1D, $F35C, $FF, skip, bottles) ; 16 - Bottle %ReceiptProps($17, -4, 0, $2F, $F36B, $FF, skip, skip) ; 17 - Heart piece -%ReceiptProps($18, -4, 4, $07, $F351, $01, skip, skip) ; 18 - Byrna -%ReceiptProps($19, -4, 0, $15, $F352, $01, skip, skip) ; 19 - Cape +%ReceiptProps($18, -4, 4, $07, $F351, $FF, magic_item, skip) ; 18 - Byrna +%ReceiptProps($19, -4, 0, $15, $F352, $FF, magic_item, skip) ; 19 - Cape %ReceiptProps($1A, -4, 0, $12, $F353, $02, skip, skip) ; 1A - Mirror %ReceiptProps($1B, -4, 0, $0D, $F354, $02, skip, skip) ; 1B - Glove %ReceiptProps($1C, -4, 0, $0D, $F354, $03, skip, skip) ; 1C - Mitts diff --git a/newitems.asm b/newitems.asm index dc200ca..6a77bda 100644 --- a/newitems.asm +++ b/newitems.asm @@ -360,6 +360,22 @@ ItemBehavior: LDA.b #70 : STA.l ArrowsFiller ; fill arrows RTS + .magic_item + print pc + LDA.b #$7E + STA.b $02 + REP #$30 + LDA.w ItemReceipts_target, X + STA.b $00 + SEP #$30 + LDA.b [$00] + CMP.b #$03 + BCS + + INC + STA.b [$00] + + + RTS + .magic_2 LDA.l MagicConsumption : CMP.b #$02 : !BGE + INC : STA.l MagicConsumption ; upgrade magic @@ -903,6 +919,8 @@ RTS ;-------------------------------------------------------------------------------- ;Return BowEquipment but also draw silver arrows if you have the upgrade even if you don't have the bow CheckHUDSilverArrows: + JSL.l CheckMagicLevel + LDA.l ArrowMode : BNE .rupee_bow LDA.l BowEquipment : TAX : BEQ .nobow JSL.l DrawHUDArrows_normal