Handle 16-bit GoalCounter and TotalItemCounter
Fix vanilla sword + shield item Fix how progressive items handled Clean up compasses.asm
This commit is contained in:
@@ -1,16 +1,6 @@
|
||||
;--------------------------------------------------------------------------------
|
||||
; $7F5010 - Scratch Space
|
||||
;--------------------------------------------------------------------------------
|
||||
; The number of items in a dungeon never changes. use this macro instead of
|
||||
; HexToDec when drawing the "??/XX" item counter
|
||||
; %DrawConstantNumber(1,4) draws 14
|
||||
;--------------------------------------------------------------------------------
|
||||
;macro DrawConstantNumber(digit1,digit2)
|
||||
; LDA.w #$2490+<digit1> : STA $7EC79A
|
||||
; LDA.w #$2490+<digit2> : STA $7EC79C
|
||||
; SEP #$20
|
||||
;endmacro
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
DrawDungeonCompassCounts:
|
||||
LDX $1B : BNE + : RTL : + ; Skip if outdoors
|
||||
@@ -64,76 +54,3 @@ InitCompassTotalsRAM:
|
||||
CPX #$0F : !BLT -
|
||||
RTL
|
||||
|
||||
;CompassCountDungeonHandlers: ; pointers to functions that handle dungeon-specific code
|
||||
; dw CompassCount_Escape, CompassCount_Escape ; (hyrule castle, sewers)
|
||||
; dw CompassCount_Eastern, CompassCount_Desert, CompassCount_Agah
|
||||
; dw CompassCount_Swamp, CompassCount_PoD, CompassCount_Mire
|
||||
; dw CompassCount_Skull, CompassCount_Ice, CompassCount_Hera
|
||||
; dw CompassCount_Thieves, CompassCount_Trock, CompassCount_Gt
|
||||
;}
|
||||
;
|
||||
;CompassCount_Escape:
|
||||
; %DrawConstantNumber(0,8)
|
||||
; LDA SewersLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Eastern:
|
||||
; %DrawConstantNumber(0,6)
|
||||
; LDA EPLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Desert:
|
||||
; %DrawConstantNumber(0,6)
|
||||
; LDA DPLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Agah:
|
||||
; %DrawConstantNumber(0,2)
|
||||
; LDA CTLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Swamp:
|
||||
; %DrawConstantNumber(1,0)
|
||||
; LDA SPLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_PoD:
|
||||
; %DrawConstantNumber(1,4)
|
||||
; LDA PDLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Mire:
|
||||
; %DrawConstantNumber(0,8)
|
||||
; LDA MMLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Skull:
|
||||
; %DrawConstantNumber(0,8)
|
||||
; LDA SWLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Ice:
|
||||
; %DrawConstantNumber(0,8)
|
||||
; LDA IPLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Hera:
|
||||
; %DrawConstantNumber(0,6)
|
||||
; LDA THLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Thieves:
|
||||
; %DrawConstantNumber(0,8)
|
||||
; LDA TTLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Trock:
|
||||
; %DrawConstantNumber(1,2)
|
||||
; LDA TRLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
;CompassCount_Gt:
|
||||
; %DrawConstantNumber(2,7)
|
||||
; LDA GTLocations
|
||||
; JMP DrawDungeonCompassCounts_return_spot
|
||||
;
|
||||
|
||||
19
elder.asm
19
elder.asm
@@ -40,25 +40,30 @@ RTL
|
||||
|
||||
Elder_Code:
|
||||
{
|
||||
LDA GoalItemRequirement : BEQ .despawn
|
||||
LDA InvincibleGanon : CMP #$05 : BEQ .despawn
|
||||
LDA TurnInGoalItems : BNE +
|
||||
REP #$20
|
||||
LDA.l GoalItemRequirement : BEQ .despawn
|
||||
LDA.l InvincibleGanon : AND.w #$00FF : CMP.w #$0005 : BEQ .despawn
|
||||
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
|
||||
.despawn
|
||||
SEP #$20
|
||||
STZ $0DD0, X ; despawn self
|
||||
RTS
|
||||
+
|
||||
|
||||
SEP #$20
|
||||
LDA.b #$96
|
||||
LDY.b #$01
|
||||
|
||||
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage : BCC .dont_show
|
||||
LDA GoalCounter
|
||||
CMP GoalItemRequirement : !BLT +
|
||||
REP #$20
|
||||
LDA.l GoalCounter
|
||||
CMP.l GoalItemRequirement : !BLT +
|
||||
SEP #$20
|
||||
JSL.l ActivateGoal
|
||||
+
|
||||
.dont_show
|
||||
|
||||
.done
|
||||
LDA $1A : LSR #5 : AND.b #$01 : STA $0DC0, X
|
||||
SEP #$20
|
||||
LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X
|
||||
RTS
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@ CheckGanonVulnerability:
|
||||
|
||||
; 05 = require goal item
|
||||
.goal_item
|
||||
LDA.l GoalCounter : CMP GoalItemRequirement
|
||||
REP #$20
|
||||
LDA.l GoalCounter : CMP.l GoalItemRequirement
|
||||
SEP #$20
|
||||
RTS
|
||||
|
||||
; 06 = light speed
|
||||
|
||||
@@ -354,7 +354,9 @@ AddInventory:
|
||||
LDA PreFluteLocations : INC : STA PreFluteLocations ; Increment Pre Mirror Counter
|
||||
+
|
||||
|
||||
REP #$20
|
||||
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
|
||||
SEP #$20
|
||||
|
||||
.itemCounts
|
||||
|
||||
@@ -522,15 +524,15 @@ AddInventory:
|
||||
JSR .incrementBow
|
||||
JMP .done
|
||||
+ CPY.b #$5E : BNE + ; Progressive Sword
|
||||
LDA SwordEquipment : TAX
|
||||
LDA SwordEquipment : INC : TAX
|
||||
JSR .incrementSword
|
||||
JMP .done
|
||||
+ CPY.b #$5F : BNE + ; Progressive Shield
|
||||
LDA ShieldEquipment : TAX
|
||||
LDA ShieldEquipment : INC : TAX
|
||||
JSR .incrementShield
|
||||
JMP .done
|
||||
+ CPY.b #$60 : BNE + ; Progressive Armor
|
||||
LDA ArmorEquipment : TAX
|
||||
LDA ArmorEquipment : INC : TAX
|
||||
JSR .incrementMail
|
||||
JMP .done
|
||||
+ CPY.b #$61 : BNE + ; Progressive Lifting Glove
|
||||
|
||||
@@ -73,13 +73,9 @@ RTS
|
||||
JMP .done
|
||||
.isUncleSwordShield
|
||||
PHA
|
||||
LDA HighestSword
|
||||
STA [$00] ; already set to 1 if we had no sword, always keep highest
|
||||
LDA HighestSword : STA [$00] ; already set to 1 if we had no sword, always keep highest
|
||||
INC $00
|
||||
LDA HighestShield : BNE + ; keep our shield unless we have no shield
|
||||
INC A
|
||||
+
|
||||
STA [$00]
|
||||
LDA HighestShield : STA [$00]
|
||||
PLA
|
||||
RTS
|
||||
;================================================================================
|
||||
|
||||
58
newhud.asm
58
newhud.asm
@@ -61,32 +61,27 @@ SEP #$30
|
||||
!GOAL_DRAW_ADDRESS = "$7EC72A"
|
||||
;================================================================================
|
||||
|
||||
SEP #$20
|
||||
REP #$20
|
||||
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
|
||||
|
||||
LDA.l GoalCounter
|
||||
JSR HudHexToDec3Digit
|
||||
REP #$20
|
||||
JSR HudHexToDec4Digit
|
||||
|
||||
LDA.l GoalItemIcon : STA !GOAL_DRAW_ADDRESS ; draw star icon
|
||||
LDA.l GoalItemIcon : STA.l !GOAL_DRAW_ADDRESS ; draw star icon
|
||||
|
||||
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
|
||||
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
|
||||
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
|
||||
|
||||
SEP #$20
|
||||
LDA.l GoalItemRequirement : CMP.b #$FF : BEQ .skip
|
||||
|
||||
LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
|
||||
LDA.l GoalItemRequirement
|
||||
JSR HudHexToDec3Digit
|
||||
REP #$20
|
||||
JSR HudHexToDec4Digit
|
||||
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
|
||||
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
|
||||
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
|
||||
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
|
||||
BRA .done
|
||||
.skip
|
||||
REP #$20
|
||||
LDA.w #$207F ; transparent tile
|
||||
STA !GOAL_DRAW_ADDRESS+8
|
||||
STA !GOAL_DRAW_ADDRESS+10
|
||||
@@ -96,7 +91,6 @@ SEP #$30
|
||||
;================================================================================
|
||||
; Draw Dungeon Compass Counts
|
||||
;================================================================================
|
||||
REP #$20
|
||||
LDA.l CompassMode : AND #$00FF : BEQ + ; skip if CompassMode is 0.
|
||||
JSL.l DrawDungeonCompassCounts ; compasses.asm
|
||||
+
|
||||
@@ -263,27 +257,27 @@ RTS
|
||||
; in: A(b) - Byte to Convert
|
||||
; out: $05 - $07 (high - low)
|
||||
;================================================================================
|
||||
HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one...
|
||||
LDY.b #$90
|
||||
-
|
||||
CMP.b #100 : !BLT +
|
||||
INY
|
||||
SBC.b #100 : BRA -
|
||||
+
|
||||
STY $05 : LDY.b #$90 ; Store 100s digit and reset Y
|
||||
-
|
||||
CMP.b #10 : !BLT +
|
||||
INY
|
||||
SBC.b #10 : BRA -
|
||||
+
|
||||
STY $06 : LDY #$90 ; Store 10s digit and reset Y
|
||||
CMP.b #1 : !BLT +
|
||||
-
|
||||
INY
|
||||
DEC : BNE -
|
||||
+
|
||||
STY $07 ; Store 1s digit
|
||||
RTS
|
||||
;HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one...
|
||||
; LDY.b #$90
|
||||
; -
|
||||
; CMP.b #100 : !BLT +
|
||||
; INY
|
||||
; SBC.b #100 : BRA -
|
||||
; +
|
||||
; STY $05 : LDY.b #$90 ; Store 100s digit and reset Y
|
||||
; -
|
||||
; CMP.b #10 : !BLT +
|
||||
; INY
|
||||
; SBC.b #10 : BRA -
|
||||
; +
|
||||
; STY $06 : LDY #$90 ; Store 10s digit and reset Y
|
||||
; CMP.b #1 : !BLT +
|
||||
; -
|
||||
; INY
|
||||
; DEC : BNE -
|
||||
; +
|
||||
; STY $07 ; Store 1s digit
|
||||
;RTS
|
||||
|
||||
;================================================================================
|
||||
; 8-bit registers
|
||||
|
||||
23
newitems.asm
23
newitems.asm
@@ -165,14 +165,14 @@ ProcessEventItems:
|
||||
LDA RNGItem : INC : STA RNGItem
|
||||
|
||||
SEP #$10 ; set 8-bit index registers
|
||||
|
||||
REP #$20 ; set 16-bit accumulator
|
||||
LDA GoalItemRequirement : BEQ ++
|
||||
LDA GoalCounter : INC : STA GoalCounter
|
||||
CMP GoalItemRequirement : !BLT ++
|
||||
LDA TurnInGoalItems : BNE ++
|
||||
LDA TurnInGoalItems : AND.w #$00FF : BNE ++
|
||||
JSL.l ActivateGoal
|
||||
++
|
||||
|
||||
SEP #$20 ; set 8-bit accumulator
|
||||
LDX.b #$01 : BRA .done
|
||||
+
|
||||
LDX.b #$00
|
||||
@@ -187,13 +187,6 @@ RTS
|
||||
AddReceivedItemExpandedGetItem:
|
||||
PHX
|
||||
|
||||
;JSR.w ProcessEventItems : CPX.b #$00 : BEQ ++
|
||||
; ;JSL.l Main_ShowTextMessage_Alt
|
||||
; LDA GoalCounter : INC : STA GoalCounter
|
||||
; LDA.b #$01 : STA $7F50XX
|
||||
; JMP .done
|
||||
;++
|
||||
;STA $FFFFFF
|
||||
LDA $02D8 ; check inventory
|
||||
JSL.l FreeDungeonItemNotice
|
||||
CMP.b #$0B : BNE + ; Bow
|
||||
@@ -319,12 +312,14 @@ AddReceivedItemExpandedGetItem:
|
||||
BRA .multi_collect
|
||||
+ CMP.b #$6C : BNE + ; Goal Collectable (Multi/Power Star) Alternate Graphic
|
||||
.multi_collect
|
||||
LDA GoalItemRequirement : BEQ ++
|
||||
LDA GoalCounter : INC : STA GoalCounter
|
||||
CMP GoalItemRequirement : !BLT ++
|
||||
LDA TurnInGoalItems : BNE ++
|
||||
REP #$20 ; set 16-bit accumulator
|
||||
LDA.l GoalItemRequirement : BEQ ++
|
||||
LDA.l GoalCounter : INC : STA.l GoalCounter
|
||||
CMP.w GoalItemRequirement : !BLT ++
|
||||
LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++
|
||||
JSL.l ActivateGoal
|
||||
++
|
||||
SEP #$20 ; set 8-bit accumulator
|
||||
JMP .done
|
||||
+ CMP.b #$6D : BNE + ; Server Request F0
|
||||
JSL.l ItemGetServiceRequest_F0
|
||||
|
||||
@@ -201,7 +201,9 @@ RTL
|
||||
DecrementItemCounter:
|
||||
PHA
|
||||
LDA StatsLocked : BNE +
|
||||
REP #$20
|
||||
LDA TotalItemCounter : DEC : STA TotalItemCounter
|
||||
SEP #$20
|
||||
+
|
||||
PLA
|
||||
RTL
|
||||
@@ -350,14 +352,15 @@ StatsFinalPrep:
|
||||
|
||||
LDA RupeesSpent : !ADD DisplayRupees : STA !RUPEES_COLLECTED
|
||||
LDA RupeesSpent+1 : ADC DisplayRupees+1 : STA !RUPEES_COLLECTED+1
|
||||
|
||||
|
||||
REP #$20
|
||||
LDA TotalItemCounter : !SUB ChestsOpened : STA !NONCHEST_COUNTER
|
||||
|
||||
.done
|
||||
PLP : PLX : PLA
|
||||
LDA.b #$19 : STA $10 ; thing we wrote over, load triforce room
|
||||
STZ $11
|
||||
STZ $B0
|
||||
STZ $11
|
||||
STZ $B0
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
; Notes:
|
||||
|
||||
14
tables.asm
14
tables.asm
@@ -805,13 +805,9 @@ org $308165 ; PC 0x180165
|
||||
GoalItemIcon:
|
||||
dw #$280E ; #$280D = Star - #$280E = Triforce Piece (default)
|
||||
;================================================================================
|
||||
org $308167 ; PC 0x180167
|
||||
org $308167 ; PC 0x180167-0x180167
|
||||
GoalItemRequirement:
|
||||
db #$00 ; #$00 = Off (default) - #$XX = Require $XX Goal Items - #$FF = Counter-Only
|
||||
;================================================================================
|
||||
org $308168 ; PC 0x180168
|
||||
ByrnaCaveSpikeDamage:
|
||||
db #$08 ; #$08 = 1 Heart (default) - #$02 = 1/4 Heart
|
||||
dw $0000 ; #$0000 = Off (default) - #$XXXX = Require $XX Goal Items - #$FFFF = Counter-Only
|
||||
;================================================================================
|
||||
org $308169 ; PC 0x180169
|
||||
AgahnimDoorStyle:
|
||||
@@ -934,7 +930,11 @@ org $308194 ; PC 0x180194
|
||||
TurnInGoalItems:
|
||||
db #$01 ; #$00 = Instant win if last goal item collected. $01 = (Default) must turn in goal items
|
||||
;--------------------------------------------------------------------------------
|
||||
; 0x180195 - 0x1801FF (unused)
|
||||
org $308195 ; PC 0x180195
|
||||
ByrnaCaveSpikeDamage:
|
||||
db #$08 ; #$08 = 1 Heart (default) - #$02 = 1/4 Heart
|
||||
;--------------------------------------------------------------------------------
|
||||
; 0x180196 - 0x1801FF (unused)
|
||||
;================================================================================
|
||||
org $308200 ; PC 0x180200 - 0x18020B
|
||||
RedClockAmount:
|
||||
|
||||
Reference in New Issue
Block a user