Requires frontend changes

Change SRAM ammo capacity upgrades to flatly represent max capacity
This commit is contained in:
cassidoxa
2022-08-08 13:42:19 -04:00
parent aba3ec930d
commit 031e3965b2
6 changed files with 35 additions and 51 deletions

View File

@@ -2,36 +2,26 @@
; Capacity Logic
;================================================================================
IncrementBombs:
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs : BEQ + ; Skip if we can't have bombs
DEC
CMP BombsEquipment
!BLT +
LDA BombsEquipment
CMP.b #99 : !BGE +
INC : STA BombsEquipment
+
LDA.l BombCapacity : BEQ + ; Skip if we can't have bombs
DEC
CMP.l BombsEquipment : !BLT +
LDA.l BombsEquipment
CMP.b #99 : !BGE +
INC : STA.l BombsEquipment
+
RTL
;--------------------------------------------------------------------------------
IncrementArrows:
LDA ArrowCapacityUpgrades ; get arrow upgrades
!ADD.l StartingMaxArrows : DEC
CMP CurrentArrows
!BLT +
LDA CurrentArrows
CMP.b #99 : !BGE +
INC : STA CurrentArrows
+
LDA.l ArrowCapacity : DEC
CMP.l CurrentArrows : !BLT +
LDA.l CurrentArrows
CMP.b #99 : !BGE +
INC : STA.l CurrentArrows
+
RTL
;--------------------------------------------------------------------------------
CompareBombsToMax:
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs
CMP BombsEquipment
LDA.l BombCapacity
CMP.l BombsEquipment
RTL
;--------------------------------------------------------------------------------

View File

@@ -82,8 +82,8 @@ StartingHealth: db $18 ; PC 0x18336C
StartingMaximumHealth: db $18 ; PC 0x18336D
StartingMagic: skip 1 ; PC 0x18336E
StartingSmallKeys: db $FF ; PC 0x18336F
StartingBombCapacityUpgrade: skip 1 ; PC 0x183370
StartingArrowCapacityUpgrade: skip 1 ; PC 0x183371
StartingBombCapacity: db $0A ; PC 0x183370
StartingArrowCapacity: db $1E ; PC 0x183371
InitHeartsFiller: skip 1 ; PC 0x183372
InitMagicFiller: skip 1 ; PC 0x183373
StartingPendants: skip 1 ; PC 0x183374

View File

@@ -695,7 +695,7 @@ RTS
;--------------------------------------------------------------------------------
Link_ReceiveItem_HUDRefresh:
LDA BombsEquipment : BNE + ; skip if we have bombs
LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
LDA BombCapacity : BEQ + ; skip if we can't have bombs
LDA BombsFiller : BEQ + ; skip if we are filling no bombs
DEC : STA BombsFiller ; decrease bomb fill count
LDA.b #$01 : STA BombsEquipment ; increase actual bomb count
@@ -712,7 +712,7 @@ RTL
HandleBombAbsorbtion:
STA BombsFiller ; thing we wrote over
LDA $0303 : BNE + ; skip if we already have some item selected
LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
LDA BombCapacity : BEQ + ; skip if we can't have bombs
LDA.b #$04 : STA $0202 ; set selected item to bombs
LDA.b #$01 : STA $0303 ; set selected item to bombs
JSL.l HUD_RebuildLong

View File

@@ -208,13 +208,11 @@ AddReceivedItemExpandedGetItem:
LDA BowTracking : ORA #$40 : STA BowTracking ; mark silver bow on y-toggle
JMP .done
+ CMP.b #$4C : BNE + ; 50 bombs
;LDA.b #$07 : STA BombCapacityUpgrades ; upgrade bombs
LDA.b #50 : !SUB.l StartingMaxBombs : STA BombCapacityUpgrades ; upgrade bombs
LDA.b #50 : STA BombCapacity ; upgrade bombs
LDA.b #50 : STA BombsFiller ; fill bombs
JMP .done
+ CMP.b #$4D : BNE + ; 70 arrows
;LDA #$07 : STA ArrowCapacityUpgrades ; upgrade arrows
LDA.b #70 : !SUB.l StartingMaxArrows : STA ArrowCapacityUpgrades ; upgrade arrows
LDA.b #70 : STA ArrowCapacity ; upgrade arrows
LDA.b #70 : STA ArrowsFiller ; fill arrows
JMP .done
+ CMP.b #$4E : BNE + ; 1/2 magic
@@ -232,19 +230,19 @@ AddReceivedItemExpandedGetItem:
LDA.b #$02 : STA SwordEquipment ; set master sword
JMP .done
+ CMP.b #$51 : BNE + ; +5 Bombs
LDA BombCapacityUpgrades : !ADD.b #$05 : STA BombCapacityUpgrades ; upgrade bombs +5
LDA BombCapacity : !ADD.b #$05 : STA BombCapacity ; upgrade bombs +5
LDA.l Upgrade5BombsRefill : STA BombsFiller ; fill bombs
JMP .done
+ CMP.b #$52 : BNE + ; +10 Bombs
LDA BombCapacityUpgrades : !ADD.b #$0A : STA BombCapacityUpgrades ; upgrade bombs +10
LDA BombCapacity : !ADD.b #$0A : STA BombCapacity ; upgrade bombs +10
LDA.l Upgrade10BombsRefill : STA BombsFiller ; fill bombs
JMP .done
+ CMP.b #$53 : BNE + ; +5 Arrows
LDA ArrowCapacityUpgrades : !ADD.b #$05 : STA ArrowCapacityUpgrades ; upgrade arrows +5
LDA ArrowCapacity : !ADD.b #$05 : STA ArrowCapacity ; upgrade arrows +5
LDA.l Upgrade5ArrowsRefill : STA ArrowsFiller ; fill arrows
JMP .done
+ CMP.b #$54 : BNE + ; +10 Arrows
LDA ArrowCapacityUpgrades : !ADD.b #$0A : STA ArrowCapacityUpgrades ; upgrade arrows +10
LDA ArrowCapacity : !ADD.b #$0A : STA ArrowCapacity ; upgrade arrows +10
LDA.l Upgrade10ArrowsRefill : STA ArrowsFiller ; fill arrows
JMP .done
+ CMP.b #$55 : BNE + ; Programmable Object 1

View File

@@ -126,8 +126,8 @@ MaximumHealth: skip 1 ; \ Max Health & Current Health
CurrentHealth: skip 1 ; / Max value for both is $A0 | $04 = half heart | $08 = heart
CurrentMagic: skip 1 ; Current magic | Max value is $80
CurrentSmallKeys: skip 1 ; Number of small keys held for current dungeon (integer)
BombCapacityUpgrades: skip 1 ; \ Bomb & Arrow Capacity Upgrades
ArrowCapacityUpgrades: skip 1 ; / Indicates flatly how many can be held above vanilla max (integers)
BombCapacity: skip 1 ; \ Bomb & Arrow Capacity Upgrades
ArrowCapacity: skip 1 ; / Indicates flatly how many can be held (integers)
HeartsFiller: skip 1 ; Hearts collected yet to be filled. Write in multiples of $08
MagicFiller: skip 1 ; Magic collected yet to be filled
PendantsField: skip 1 ; - - - - - g b r (bitfield)
@@ -483,8 +483,8 @@ endmacro
%assertSRAM(CurrentHealth, $7EF36D)
%assertSRAM(CurrentMagic, $7EF36E)
%assertSRAM(CurrentSmallKeys, $7EF36F)
%assertSRAM(BombCapacityUpgrades, $7EF370)
%assertSRAM(ArrowCapacityUpgrades, $7EF371)
%assertSRAM(BombCapacity, $7EF370)
%assertSRAM(ArrowCapacity, $7EF371)
%assertSRAM(HeartsFiller, $7EF372)
%assertSRAM(MagicFiller, $7EF373)
%assertSRAM(PendantsField, $7EF374)

View File

@@ -110,11 +110,7 @@ org $308033 ; PC 0x180033
HeartBeep:
db #$20 ; #$00 = Off - #$20 = Normal (default) - #$40 = Half Speed - #$80 = Quarter Speed
;--------------------------------------------------------------------------------
org $308034 ; PC 0x180034 - 0x180035
StartingMaxBombs:
db #10 ; #10 = Default (10 decimal)
StartingMaxArrows:
db #30 ; #30 = Default (30 decimal)
; 0x180034 - 0x180035 (Unused)
;--------------------------------------------------------------------------------
org $308036 ; PC 0x180036 - 0x180037
RupoorDeduction:
@@ -332,15 +328,15 @@ db $00 ;
;Warp BL : 7A
;Warp BR : 7B
;--------------------------------------------------------------------------------
org $308080 ; PC 0x180080 - 0x180083
org $308080 ; PC 0x180080 - 0x180083 ; Default to fill on upgrade. Can be set to 0 to not fill.
Upgrade5BombsRefill:
db #$00
db #$32
Upgrade10BombsRefill:
db #$00
db #$32
Upgrade5ArrowsRefill:
db #$00
db #$46
Upgrade10ArrowsRefill:
db #$00
db #$46
;--------------------------------------------------------------------------------
org $308084 ; PC 0x180084 - 0x180085
PotionHealthRefill: