Per-Item improved magic consumption

This commit is contained in:
2024-11-25 00:03:09 -06:00
parent a949230f34
commit 30122cfa3d
7 changed files with 144 additions and 9 deletions

View File

@@ -163,6 +163,7 @@ incsrc mothula.asm
incsrc switches.asm incsrc switches.asm
incsrc zoom_on_carry.asm incsrc zoom_on_carry.asm
incsrc iframes.asm incsrc iframes.asm
incsrc improve_items.asm
warnpc $A58000 warnpc $A58000
org $A28000 org $A28000

Binary file not shown.

Binary file not shown.

114
improve_items.asm Normal file
View File

@@ -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

View File

@@ -418,6 +418,8 @@ AddYMarker:
.drawTile .drawTile
STA.w $FFC4, Y STA.w $FFC4, Y
JSL AddMagicMarker
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -143,25 +143,25 @@ endmacro
%ReceiptProps($04, -5, 4, $2D, $F35A, $01, fighter_shield, skip) ; 04 - Fighter shield %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($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($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($07, -5, 4, $09, $F345, $FF, magic_item, skip) ; 07 - Fire rod
%ReceiptProps($08, -5, 4, $09, $F346, $01, skip, skip) ; 08 - Ice 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($09, -4, 4, $0A, $F34B, $01, skip, skip) ; 09 - Hammer
%ReceiptProps($0A, -4, 4, $08, $F342, $01, skip, skip) ; 0A - Hookshot %ReceiptProps($0A, -4, 4, $08, $F342, $01, skip, skip) ; 0A - Hookshot
%ReceiptProps($0B, -4, 4, $05, $F340, $01, bow, skip) ; 0B - Bow %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($0C, -2, 5, $10, $F341, $01, blue_boomerang, skip) ; 0C - Blue Boomerang
%ReceiptProps($0D, -4, 0, $0B, $F344, $02, powder, skip) ; 0D - Powder %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($0E, -4, 0, $2C, $F35C, $FF, skip, skip) ; 0E - Bottle refill (bee)
%ReceiptProps($0F, -4, 0, $1B, $F347, $01, skip, skip) ; 0F - Bombos %ReceiptProps($0F, -4, 0, $1B, $F347, $FF, magic_item, skip) ; 0F - Bombos
%ReceiptProps($10, -4, 0, $1A, $F348, $01, skip, skip) ; 10 - Ether %ReceiptProps($10, -4, 0, $1A, $F348, $FF, magic_item, skip) ; 10 - Ether
%ReceiptProps($11, -4, 0, $1C, $F349, $01, skip, skip) ; 11 - Quake %ReceiptProps($11, -4, 0, $1C, $F349, $FF, magic_item, skip) ; 11 - Quake
%ReceiptProps($12, -4, 0, $14, $F34A, $01, skip, skip) ; 12 - Lamp %ReceiptProps($12, -4, 0, $14, $F34A, $FF, magic_item, skip) ; 12 - Lamp
%ReceiptProps($13, -4, 4, $19, $F34C, $01, shovel, skip) ; 13 - Shovel %ReceiptProps($13, -4, 4, $19, $F34C, $01, shovel, skip) ; 13 - Shovel
%ReceiptProps($14, -4, 0, $0C, $F34C, $02, flute_inactive, skip) ; 14 - Flute %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($16, -4, 0, $1D, $F35C, $FF, skip, bottles) ; 16 - Bottle
%ReceiptProps($17, -4, 0, $2F, $F36B, $FF, skip, skip) ; 17 - Heart piece %ReceiptProps($17, -4, 0, $2F, $F36B, $FF, skip, skip) ; 17 - Heart piece
%ReceiptProps($18, -4, 4, $07, $F351, $01, skip, skip) ; 18 - Byrna %ReceiptProps($18, -4, 4, $07, $F351, $FF, magic_item, skip) ; 18 - Byrna
%ReceiptProps($19, -4, 0, $15, $F352, $01, skip, skip) ; 19 - Cape %ReceiptProps($19, -4, 0, $15, $F352, $FF, magic_item, skip) ; 19 - Cape
%ReceiptProps($1A, -4, 0, $12, $F353, $02, skip, skip) ; 1A - Mirror %ReceiptProps($1A, -4, 0, $12, $F353, $02, skip, skip) ; 1A - Mirror
%ReceiptProps($1B, -4, 0, $0D, $F354, $02, skip, skip) ; 1B - Glove %ReceiptProps($1B, -4, 0, $0D, $F354, $02, skip, skip) ; 1B - Glove
%ReceiptProps($1C, -4, 0, $0D, $F354, $03, skip, skip) ; 1C - Mitts %ReceiptProps($1C, -4, 0, $0D, $F354, $03, skip, skip) ; 1C - Mitts

View File

@@ -360,6 +360,22 @@ ItemBehavior:
LDA.b #70 : STA.l ArrowsFiller ; fill arrows LDA.b #70 : STA.l ArrowsFiller ; fill arrows
RTS 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 .magic_2
LDA.l MagicConsumption : CMP.b #$02 : !BGE + LDA.l MagicConsumption : CMP.b #$02 : !BGE +
INC : STA.l MagicConsumption ; upgrade magic 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 ;Return BowEquipment but also draw silver arrows if you have the upgrade even if you don't have the bow
CheckHUDSilverArrows: CheckHUDSilverArrows:
JSL.l CheckMagicLevel
LDA.l ArrowMode : BNE .rupee_bow LDA.l ArrowMode : BNE .rupee_bow
LDA.l BowEquipment : TAX : BEQ .nobow LDA.l BowEquipment : TAX : BEQ .nobow
JSL.l DrawHUDArrows_normal JSL.l DrawHUDArrows_normal