Free crystals and ability to shuffle dungeon prizes

Overworld map code via Aerinon
This commit is contained in:
cassidoxa
2023-08-06 23:07:39 -04:00
parent cb16ffc20b
commit 87e665965c
26 changed files with 1225 additions and 547 deletions

View File

@@ -62,6 +62,7 @@ incsrc ram.asm
incsrc sram.asm
incsrc registers.asm
incsrc vanillalabels.asm
incsrc overworldmap.asm ; Overwrites some code in bank $8A
org $A08000 ; bank $20
incsrc itemdowngrade.asm

View File

@@ -2,7 +2,7 @@ PalettesCustom:
.master_sword
dw $0000, $7E4E, $6FF4, $1CF5, $7FFF, $1CE7, $7A10, $64A5
.tempered_sword
dw $0000, $093B, $169F, $7E8D, $7FFF, $1CE7, $7A10, $64A5
dw $0000, $7FFF, $1979, $14B6, $39DC, $14A5, $66F7, $45EF
.golden_sword
dw $0000, $033F, $7FFF, $2640, $7FFF, $1CE7, $7A10, $64A5
.fighter_shield
@@ -12,6 +12,6 @@ dw $0000, $7FFF, $27FF, $5E2D, $4F5F, $1CE7, $2E9C, $14B6
.mirror_shield
dw $0000, $7FFF, $27FF, $5E2D, $7399, $1CE7, $02F9, $0233
.crystal
dw $7FFF, $7FFF, $5F9F, $000A, $7E15, $2C24, $75D0, $612B
dw $7FFF, $7FFF, $0000, $5907, $6E0E, $0000, $7FBB, $7672
.off_black
dw $0000, $14A5, $14A5, $14A5, $14A5, $14A5, $14A5, $14A5

View File

@@ -114,14 +114,19 @@ FreeDungeonItemNotice:
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of...
%CopyDialog(Notice_BigKeyOf)
BRA .dungeon
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for dungeon small key
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA.w ScratchBufferV : CMP.b #$AF : BNE ++ : JMP .skip : ++
%CopyDialog(Notice_SmallKeyOf)
LDA.b #$01 : STA.w ScratchBufferNV ; set up a flip for small keys
BRA .dungeon
+
+ : LDA.l FreeItemText : AND.b #$20 : BEQ + ; show message for crystal
LDA.w ScratchBufferV : CMP.b #$B0 : !BLT + ; crystal #
CMP.b #$B7 : !BGE +
%CopyDialog(Notice_Crystal)
JMP .crystal
+
JMP .skip ; it's not something we are going to give a notice for
.dungeon
@@ -170,12 +175,34 @@ FreeDungeonItemNotice:
+ : CMP.b #$0C : BNE + ; ...desert palace
%CopyDialog(Notice_Desert) : JMP .done
+ : CMP.b #$0D : BNE + ; ...eastern palace
%CopyDialog(Notice_Eastern) : BRA .done
%CopyDialog(Notice_Eastern) : JMP .done
+ : CMP.b #$0E : BNE + ; ...hyrule castle
%CopyDialog(Notice_Castle) : BRA .done
%CopyDialog(Notice_Castle) : JMP .done
+ : CMP.b #$0F : BNE + ; ...sewers
%CopyDialog(Notice_Sewers)
+
JMP .done
.crystal
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA.w ScratchBufferV
AND.b #$0F ; looking at low bits only
CMP.b #$00 : BNE +
%CopyDialog(Notice_Six) : JMP .done
+ : CMP.b #$01 : BNE +
%CopyDialog(Notice_One) : JMP .done
+ : CMP.b #$02 : BNE +
%CopyDialog(Notice_Five) : JMP .done
+ : CMP.b #$03 : BNE +
%CopyDialog(Notice_Seven) : JMP .done
+ : CMP.b #$04 : BNE +
%CopyDialog(Notice_Two) : JMP .done
+ : CMP.b #$05 : BNE +
%CopyDialog(Notice_Four) : JMP .done
+ : CMP.b #$06 : BNE +
%CopyDialog(Notice_Three) : JMP .done
+
.done
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer

View File

@@ -1,9 +1,328 @@
;================================================================================
; Dungeon & Boss Drop Fixes
;--------------------------------------------------------------------------------
DropSafeDungeon:
LDA.w DungeonID : CMP.b #$08 : BEQ +
LDA.l $81C6FC, X : JML Sprite_SpawnFallingItem
+
SpawnDungeonPrize:
PHX : PHB
JSL.l ResolveLootIDLong
STA.w ItemReceiptID
TAX
LDA.b #$29 : LDY.b #$06
JSL.l AddAncillaLong
BCS .failed_spawn
LDA.w ItemReceiptID
STA.w AncillaGet,X : STA.w SpriteID,X
JSR.w AddDungeonPrizeAncilla
.failed_spawn
PLB : PLX
RTL
AddDungeonPrizeAncilla:
LDY.w ItemReceiptID
STZ.w AncillaVelocityY,X
STZ.w AncillaVelocityX,X
STZ.w AncillaGeneral,X
STZ.w $0385,X
STZ.w $0C54,X
LDA.b #$D0 : STA.w AncillaVelocityZ,X
LDA.b #$80 : STA.w AncillaZCoord,X
LDA.b #$09 : STA.w AncillaTimer,X
LDA.b #$00 : STA.w $0394,X
LDA.w AncillaGet,X : STA.w ItemReceiptID
LDA.w DungeonID : CMP.b #$14 : BNE .not_hera
LDA.b LinkAbsoluteY+1 : AND.b #$FE
INC A
STA.b Scrap01
STZ.b Scrap00
LDA.b LinkAbsoluteX+1 : AND.b #$FE
INC A
STA.b Scrap03
STZ.b Scrap02
BRA .set_coords_exit
.not_hera
TYA : ASL : TAY
REP #$20
LDA.w #$0078
CLC : ADC.b BG2V
STA.b Scrap00
LDA.w #$0078
CLC : ADC.b BG2H
STA.b Scrap02
SEP #$20
.set_coords_exit
LDA.b Scrap00 : STA.w AncillaCoordYLow,X
LDA.b Scrap01 : STA.w AncillaCoordYHigh,X
LDA.b Scrap02 : STA.w AncillaCoordXLow,X
LDA.b Scrap03 : STA.w AncillaCoordXHigh,X
RTS
PrepPrizeTile:
PHA : PHX : PHY
LDA.w AncillaGet, X
JSL.l ResolveLootIDLong
STA.w SpriteID,X
JSL.l TransferItemReceiptToBuffer_using_ReceiptID
PLY : PLX : PLA
RTL
SetItemPose:
PHA
LDA.w RoomItemsTaken : BIT.b #$80 : BNE +
.one_handed
PLA
JML $8799F2
+
JSR.w CrystalOrPendantBehavior : BCC .one_handed
.two_handed
PLA
JML $8799EE ; cool pose
SetPrizeCoords:
PHX : PHY
STZ.b Scrap03
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
.regular_coords
PLY : PLX
LDY.w AncillaGet,X
RTL
+
JSR.w CrystalOrPendantBehavior : BCC .regular_coords
PLY : PLX
LDY.b #$20 ; Treat as crystal
RTL
SetCutsceneFlag:
; Out: c - Cutscene flag $02 if set, $01 if unset.
PHX
LDY.b #$01 ; wrote over
LDA.w RoomItemsTaken : BIT #$80 : BNE .dungeon_prize
.no_cutscene
PLX
CLC
RTL
.dungeon_prize
JSR.w SetDungeonCompletion
LDA.w ItemReceiptID : TAX
LDA.l InventoryTable_properties,X : BPL .no_cutscene
PLX
SEC
RTL
AnimatePrizeCutscene:
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE +
JSR.w CrystalOrPendantBehavior : BCC +
LDA.w RoomItemsTaken : BIT #$80 : BEQ +
SEC
RTL
+
CLC
RTL
PrizeDropSparkle:
LDA.w AncillaID,X : CMP.b #$29 : BNE .no_sparkle
JSR.w CrystalOrPendantBehavior : BCC .no_sparkle
SEC
RTL
.no_sparkle
CLC
RTL
HandleDropSFX:
LDA.w RoomItemsTaken : BIT #$80 : BEQ .no_sound
JSR.w CrystalOrPendantBehavior : BCC .no_sound
SEC
RTL
.no_sound
CLC
RTL
HandleCrystalsField:
TAX
LDA.w ItemReceiptID : CMP.b #$20 : BNE .not_crystal
TXA
STA.l CrystalsField
RTL
.not_crystal
RTL
MaybeKeepLootID:
PHA
LDA.w RoomItemsTaken : BIT #$80 : BNE .prize
STZ.w ItemReceiptID
STZ.w ItemReceiptPose
PLA
RTL
.prize
STZ.w ItemReceiptPose
PLA
RTL
CheckSpawnPrize:
; In: A - DungeonID
; Out: c - Spawn prize if set
REP #$20
LDX.w DungeonID
LDA.l DungeonItemMasks,X : AND.l DungeonsCompleted : BEQ .spawn
SEP #$20
CLC
RTL
.spawn
SEP #$21
RTL
SetDungeonCompletion:
LDX.w DungeonID : BMI +
REP #$20
LDA.l DungeonItemMasks, X : ORA.l DungeonsCompleted : STA.l DungeonsCompleted
SEP #$20
+
RTS
CheckDungeonCompletion:
LDX.w DungeonID
REP #$20
LDA.l DungeonItemMasks,X : AND.l DungeonsCompleted
SEP #$20
RTL
MaybeOpenDoor:
;LDA.w ItemReceiptID : TAX
LDA.w DungeonID : LSR : TAX
LDA.l DungeonPrizeReceiptID,X : TAX
LDA.l InventoryTable_properties,X : BMI .no_open
REP #$20
LDX.w DungeonID
LDA.l DungeonMask,X : AND.l DungeonsCompleted
SEP #$20
SEC
RTL
.no_open
REP #$20
LDX.w DungeonID
LDA.l DungeonMask,X : AND.l DungeonsCompleted
SEP #$20
CLC
RTL
PendantMusicCheck:
; In: A - Item receipt ID
PHX
TAY
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE .dont_wait
TYX
LDA.l InventoryTable_properties,X : BMI .dont_wait
PLX
SEC
RTL
.dont_wait
PLX
CLC
RTL
PrepPrizeOAMCoordinates:
PHX : PHY
LDY.w AncillaLayer,X
LDA.w $F67F,Y : STA.b $65
STZ.b $64
LDA.w AncillaCoordYLow,X : STA.b Scrap00
LDA.w AncillaCoordYHigh,X : STA.b Scrap01
LDA.w AncillaCoordXLow,X : STA.b Scrap02
LDA.w AncillaCoordXHigh,X : STA.b Scrap03
REP #$20
LDA.b Scrap00
SEC : SBC.w $0122
STA.b Scrap00
LDA.b Scrap02
SEC : SBC.w $011E
STA.b Scrap02
STA.b Scrap04
REP #$20
LDA.w $029E,X
AND.w #$00FF
STA.b $72
LDA.b $00
STA.b $06
SEC
SBC.b $72
STA.b $00
SEP #$20
TXY
LDA.w AncillaGet,X : TAX
LDA.l SpriteProperties_chest_width,X : BNE .wide
TYX
LDA.w AncillaID,X : CMP.b #$3E : BEQ .rising_crystal
REP #$20
LDA.b Scrap00
CLC : ADC.w #$0008
STA.b Scrap08
LDA.b Scrap02
CLC : ADC.w #$0004
STA.b Scrap02 : STA.b Scrap0A
BRA .wide
.rising_crystal
REP #$20
LDA.b Scrap00
CLC : ADC.w #$0008 : STA.b Scrap08
LDA.b Scrap02 : STA.b Scrap0A
.wide
PLY : PLX
SEP #$20
RTL
PrepPrizeShadow:
PHX
LDA.w ItemReceiptID : TAX
LDA.l SpriteProperties_standing_width,X : BNE .wide
LDA.b Scrap02
SEC : SBC.b #$04
STA.b Scrap02
.wide
LDA.b #$20 : STA.b Scrap04 ; What we wrote over
PLX
RTL
CheckPoseItemCoordinates:
PHX
LDA.w ItemReceiptPose : BEQ .done
BIT.b #$02 : BEQ .done
LDA.w AncillaGet,X : TAX
LDA.l SpriteProperties_chest_width,X : BNE .done
LDA.b Scrap02
CLC : ADC.b #$04
STA.b Scrap02
.done
PLX
LDA.w AncillaGet,X
TAX
RTL
CrystalOrPendantBehavior:
; Out: c - Crystal Behavior if set, pendant if unset
PHA : PHX
LDA.w AncillaGet,X : TAX
LDA.l InventoryTable_properties,X : BMI .crystal_behavior
PLX : PLA
CLC
RTS
.crystal_behavior
PLX : PLA
SEC
RTS
CheckDungeonWorld:
; Maintain vanilla door opening behavior with dungeon prizes
TXA : CMP.b #$05 : BCS .dark_world
REP #$02
RTL
.dark_world
SEP #$02
RTL
;--------------------------------------------------------------------------------

View File

@@ -20,6 +20,10 @@ OnDungeonEntrance:
INC.w UpdateHUD
RTL
;--------------------------------------------------------------------------------
OnDungeonBossExit:
JSL.l StatTransitionCounter
RTL
;--------------------------------------------------------------------------------
OnPlayerDead:
PHA
JSL.l SetDeathWorldChecked

View File

@@ -5,9 +5,6 @@ SpawnHauntedGroveItem:
LDA.b OverworldIndex : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA.b IndoorsFlag : BEQ + : RTL : + ; Skip if indoors
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JSL.l PrepDynamicTile
LDA.b #$EB
STA.l MiniGameTime
JSL Sprite_SpawnDynamically

View File

@@ -70,7 +70,7 @@ GetAgahnimLightning:
;1 = Forbid
AllowJoypadInput:
LDA.l PermitSQFromBosses : BEQ .fullCheck
LDA.w ItemsTaken : AND.b #$80 : BEQ .fullCheck
LDA.w RoomItemsTaken : AND.b #$80 : BEQ .fullCheck
LDA.w MedallionFlag : ORA.w CutsceneFlag ; we have heart container, do short check
RTL
.fullCheck

View File

@@ -71,32 +71,27 @@ DrawHeartContainerGFX:
BRA DrawHeartPieceGFX_skipLoad
;--------------------------------------------------------------------------------
HeartContainerSound:
CPY.b #$20 : BEQ + ; Skip for Crystal
CPY.b #$37 : BEQ + ; Skip for Pendants
CPY.b #$38 : BEQ +
CPY.b #$39 : BEQ +
JSL.l CheckIfBossRoom : BCC + ; Skip if not in a boss room
LDA.b #$2E
SEC
RTL
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
JSL.l CheckIfBossRoom : BCC + ; Skip if not in a boss room
LDA.b #$2E
SEC
RTL
+
CLC
RTL
;--------------------------------------------------------------------------------
NormalItemSkipSound:
LDA.w AncillaGet, X ; thing we wrote over
CPY.b #$20 : BEQ + ; Skip for Crystal
CPY.b #$37 : BEQ + ; Skip for Pendants
CPY.b #$38 : BEQ +
CPY.b #$39 : BEQ +
PHA
JSL.l CheckIfBossRoom
PLA
; Out: C - skip sounds if set
JSL.l CheckIfBossRoom : BCS .boss_room
LDA.b #$00
RTL
+
CLC
.boss_room
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
SEC
RTL
+
LDA.b #$20
CLC
RTL
;--------------------------------------------------------------------------------
HeartPieceSpritePrep:

View File

@@ -560,7 +560,7 @@ org $86D192 ; <- 35192 - sprite_absorbable.asm : 274 (STA $7EF36F)
JSL IncrementSmallKeysNoPrimary
;--------------------------------------------------------------------------------
org $80F945 ; <- 7945 - Bank00.asm : 8557 (JSL SavePalaceDeaths)
JSL StatTransitionCounter ; we're not bothering to restore the instruction we wrote over
JSL OnDungeonBossExit
;--------------------------------------------------------------------------------
org $89F443 ; <- 4F443 - module_death.asm : 257 (STA $7EF35C, X)
JSL IncrementFairyRevivalCounter
@@ -928,14 +928,11 @@ org $88C6C8 ; 446C8 - ancilla_receive_item.asm:538 (LDA AddReceiveItem.propertie
JSL CheckReceivedItemPropertiesBeforeLoad
org $88C6DE ; 446DE - ancilla_receive_item.asm:550 (LDA .wide_item_flag, X)
LDA.l SpriteProperties_chest_width, X
JSL.l ItemReceiptWidthCheck
org $88C6F9 ; 446F9 - ancilla_receive_item.asm:570 (LDA AddReceiveItem.properties, X)
JSL CheckReceivedItemPropertiesBeforeLoad
;org $88C70F ; 4470F - ancilla_receive_item.asm : 582 - (LDA.b #$00 : STA ($92), Y)
;JSL LoadNarrowObject
org $8985ED ; 485ED - ancilla_init.asm:693 (LDA $02E9 : CMP.b #$01)
JSL AddReceivedItemExpandedGetItem : NOP
@@ -993,10 +990,32 @@ JSL LockAgahnimDoors : BNE Overworld_Entrance_BRANCH_EPSILON : NOP #6
org $9BBCC1 ; <- DBCC1 - Bank1B.asm : 223 (LDA $0F8004, X : AND.w #$01FF : STA $00)
Overworld_Entrance_BRANCH_EPSILON: ; go here to lock doors
;--------------------------------------------------------------------------------
; -- HOOK THIS LATER TO FUCK WITH BOSS DROPS --
org $81C73E ; <- C73E - Bank01.asm : 10377 (LDA $01C6FC, X : JSL Sprite_SpawnFallingItem)
JSL DropSafeDungeon : NOP #4
; Dungeon Drops
;--------------------------------------------------------------------------------
org $81C50D : JSL.l CheckDungeonWorld
org $81C517 : JSL.l CheckDungeonCompletion
org $81C523 : JSL.l CheckDungeonCompletion
org $81C710 : JSL.l CheckSpawnPrize
BCS RoomTag_GetHeartForPrize_spawn_prize : BRA RoomTag_GetHeartForPrize_delete_tag
org $81C742 : JSL.l SpawnDungeonPrize
org $8799EA : JML.l SetItemPose
org $88C415 : JSL.l PendantMusicCheck
BCS Ancilla22_ItemReceipt_is_pendant : BRA Ancilla22_ItemReceipt_wait_for_music
org $88C452 : JSL.l MaybeKeepLootID : NOP #2
org $88C61D : JSL.l AnimatePrizeCutscene : NOP
org $88C622 : BCC ItemReceipt_Animate_continue
org $88C6BA : JSL.l CheckPoseItemCoordinates
org $88CAD6 : JSL.l HandleDropSFX : NOP #2
org $88CADC : BCC Ancilla29_MilestoneItemReceipt_skip_crystal_sfx
org $88CAE9 : JSL.l PrepPrizeTile
org $88CB23 : JSL.l PrizeDropSparkle : BCC Ancilla29_MilestoneItemReceipt_no_sparkle : NOP #2
org $88CB97 : JSL.l PrepPrizeOAMCoordinates : BRA + : NOP #$12 : +
org $88CBFF : JSL.l PrepPrizeShadow
org $88CC6C : JSL.l HandleCrystalsField
org $88CCA6 : JSL.l PrepPrizeOAMCoordinates : NOP
org $8985FA : JSL.l SetCutsceneFlag : NOP #3 : BCC AncillaAdd_ItemReceipt_not_crystal
org $8988B2 : JSL.l SetPrizeCoords : NOP
;================================================================================
; Uncle / Sage Fixes - Old Man Fixes - Link's House Fixes
@@ -1569,11 +1588,6 @@ JSL HUDRebuildIndoorHole
; Pendant / Crystal Fixes
;--------------------------------------------------------------------------------
;================================================================================
org $898BB0 ; <- 048BB0 - ancilla_init.asm:1663 - (STX $02D8 : JSR AddAncilla)
JSL TryToSpawnCrystalUntilSuccess : NOP
org $81C74B ; <- 00C74B - bank01.asm:10368 - (STZ $AE, X)
NOP #2 ; this STZ is what makes the crystal never spawn if it fails to spawn on the first try
;================================================================================
org $8DE9C8 ; <- 6E9C8 - equipment.asm:1623 - (LDA $7EF3C5 : CMP.b #$03 : BCC .beforeAgahnim)
JSL DrawPendantCrystalDiagram : RTS
;================================================================================
@@ -1596,21 +1610,13 @@ org $82B15C ; <- 1315C - Bank02.asm:7672 - (LDA $7EF3CA : EOR.b #$40 : STA $7EF3
JSL IncrementOWMirror
JSL FlipLWDWFlag : NOP #2
;================================================================================
;Clear level to open doors
org $81C50D ; 0xC50D - Bank01.asm:10032 - (LDA $7EF3CA : BNE .inDarkWorld)
LDA CrystalPendantFlags_2, X
;================================================================================
;Kill enemy to clear level
org $81C715 ; <- C715 - Bank01.asm:10358 - (LDA $7EF3CA : BNE .inDarkWorld)
LDA CrystalPendantFlags_2, X
;================================================================================
org $8AC5BB ; < 545BB - Bank0A.asm:1856 - (LDA $7EF3C7 : CMP.b #$03 : BNE .fail)
JSL OverworldMap_CheckObject : RTS
org $8AC5D8 ; < 545D8 - Bank0A.asm:1885 - (LDA $7EF3C7 : CMP.b #$07 : BNE OverworldMap_CheckPendant_fail)
JSL OverworldMap_CheckObject : RTS
;org $8AC5BB ; < 545BB - Bank0A.asm:1856 - (LDA $7EF3C7 : CMP.b #$03 : BNE .fail)
;JSL OverworldMap_CheckObject : RTS
;org $8AC5D8 ; < 545D8 - Bank0A.asm:1885 - (LDA $7EF3C7 : CMP.b #$07 : BNE OverworldMap_CheckPendant_fail)
;JSL OverworldMap_CheckObject : RTS
;================================================================================
org $8AC53E ; <- 5453E - Bank0A.asm:1771 - (LDA $0AC50D, X : STA $0D)
JSL GetCrystalNumber
LDA.l CrystalNumberTable-1,X
;================================================================================
; EVERY INSTANCE OF STA $7EF3C7 IN THE ENTIRE CODEBASE
org $829D51 : JSL SetLWDWMap
@@ -1625,28 +1631,11 @@ org $898687 : JSL SetLWDWMap
org $9ECEDD : JSL SetLWDWMap
org $9ECF0D : JSL SetLWDWMap
;================================================================================
; EVERY INSTANCE OF LDA $7EF3C7 IN THE ENTIRE CODEBASE
org $85DDFE : JSL GetMapMode
org $85EE25 : JSL GetMapMode
org $85F17D : JSL GetMapMode
org $85FF7D : JSL GetMapMode
org $8AC01A : JSL GetMapMode
org $8AC037 : JSL GetMapMode
org $8AC079 : JSL GetMapMode
org $8AC0B8 : JSL GetMapMode
org $8AC0F8 : JSL GetMapMode
org $8AC137 : JSL GetMapMode
org $8AC179 : JSL GetMapMode
org $8AC1B3 : JSL GetMapMode
org $8AC1F5 : JSL GetMapMode
org $8AC22F : JSL GetMapMode
org $8AC271 : JSL GetMapMode
org $8AC2AB : JSL GetMapMode
org $8AC2ED : JSL GetMapMode
org $8AC327 : JSL GetMapMode
org $8AC369 : JSL GetMapMode
org $8DC849 : JSL GetMapMode
;================================================================================
org $8AC012 ; <- 54012 - Bank0A.asm:1039 (LDA $7EF2DB : AND.b #$20 : BNE BRANCH_DELTA)
@@ -1746,9 +1735,7 @@ org $9ECE47 ; <- F4E47 - sprite_crystal_maiden.asm : 220
JML MaidenCrystalScript
;--------------------------------------------------------------------------------
org $9ECCEB ; <- F4CEB - sprite_crystal_maiden.asm : 25 ; skip all palette nonsense
JML SkipCrystalPalette
org $9ECD39
SkipCrystalPalette:
BRA CrystalCutscene_Initialize_skip_palette
;--------------------------------------------------------------------------------
org $88C3FD ; <- 443FD - ancilla_receive_item.asm : 89
BRA + : NOP #4 : +
@@ -2515,7 +2502,6 @@ org $82ADE9 : JSL TransferItemReceiptToBuffer_using_GraphicsID
org $869261 : JSL TransferItemReceiptToBuffer_using_GraphicsID
; falling items
org $88CAE9 : JSL TransferItemReceiptToBuffer_using_GraphicsID
org $898BD2 : JSL TransferItemReceiptToBuffer_using_GraphicsID
; misc

View File

@@ -191,8 +191,11 @@ RTS
RTS
DungeonIncrement:
LDA.w InventoryTable_properties,Y : BIT.b #$40 : BEQ +
JSL.l CountChestKeyLong
+
LDA.b IndoorsFlag : BEQ .count
LDA.w DungeonID : CMP.b #$FF : BEQ .count
LDA.w DungeonID : BMI .count
CMP.l BallNChainDungeon : BNE +
CPY.b #$32 : BEQ .ballchain_bigkey
+
@@ -266,6 +269,7 @@ RTS
IncrementBossSword:
PHX
LDA.l StatsLocked : BNE .done
LDA.l SwordEquipment : CMP.b #$FF : BNE +
BRA .none
+
@@ -281,6 +285,7 @@ IncrementBossSword:
.none
LDA.l SwordlessBossKills : INC : STA.l SwordlessBossKills
.done
PLX
RTL
.fighter
@@ -308,15 +313,6 @@ IncrementBossSword:
PLX
RTL
SetDungeonCompletion:
; TODO: move this
LDX.w DungeonID : BMI +
REP #$20
LDA.l DungeonMask, X : ORA.l DungeonsCompleted : STA.l DungeonsCompleted
SEP #$20
+
RTS
;--------------------------------------------------------------------------------
Link_ReceiveItem_HUDRefresh:
LDA.l BombsEquipment : BNE + ; skip if we have bombs

View File

@@ -2,7 +2,6 @@ ItemReceipts:
.offset_y : fillbyte $00 : fill 256
.offset_x : fillbyte $00 : fill 256
.graphics : fillbyte $00 : fill 256 ; item_graphics_indices
.width : fillbyte $00 : fill 256 ; wide_item_flag
.target : fillword $0000 : fill 256*2 ; item_target_addr
.value : fillbyte $00 : fill 256 ; item_values
.behavior : fillword $0000 : fill 256*2 ; ItemBehavior
@@ -64,14 +63,14 @@ endmacro
%ReceiptProps($26, -4, 0, $03, $F36C, $FF, skip, skip) ; 26 - Heart container from 4/4
%ReceiptProps($27, -4, 0, $13, $F375, $FF, skip, skip) ; 27 - Bomb
%ReceiptProps($28, -4, 0, $01, $F375, $FF, skip, skip) ; 28 - 3 bombs
%ReceiptProps($29, -4, 0, $1E, $F344, $FF, mushroom, skip) ; 29 - Mushroom
%ReceiptProps($29, -4, 0, $1F, $F344, $FF, mushroom, skip) ; 29 - Mushroom
%ReceiptProps($2A, -2, 5, $10, $F341, $02, red_boomerang, skip) ; 2A - Red boomerang
%ReceiptProps($2B, -4, 0, $00, $F35C, $FF, skip, bottles) ; 2B - Full bottle (red)
%ReceiptProps($2C, -4, 0, $00, $F35C, $FF, skip, bottles) ; 2C - Full bottle (green)
%ReceiptProps($2D, -4, 0, $00, $F35C, $FF, skip, bottles) ; 2D - Full bottle (blue)
%ReceiptProps($2E, -4, 0, $00, $F36D, $FF, skip, bottles) ; 2E - Potion refill (red)
%ReceiptProps($2F, -4, 0, $00, $F36E, $FF, skip, bottles) ; 2F - Potion refill (green)
%ReceiptProps($30, -4, 0, $00, $F36E, $FF, skip, bottles) ; 30 - Potion refill (blue)
%ReceiptProps($2B, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2B - Full bottle (red)
%ReceiptProps($2C, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2C - Full bottle (green)
%ReceiptProps($2D, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2D - Full bottle (blue)
%ReceiptProps($2E, -4, 0, $1E, $F36D, $FF, skip, bottles) ; 2E - Potion refill (red)
%ReceiptProps($2F, -4, 0, $1E, $F36E, $FF, skip, bottles) ; 2F - Potion refill (green)
%ReceiptProps($30, -4, 0, $1E, $F36E, $FF, skip, bottles) ; 30 - Potion refill (blue)
%ReceiptProps($31, -4, 0, $30, $F375, $FF, skip, skip) ; 31 - 10 bombs
%ReceiptProps($32, -4, 0, $22, $F366, $FF, dungeon_bigkey, skip) ; 32 - Big key
%ReceiptProps($33, -4, 0, $21, $F368, $FF, dungeon_map, skip) ; 33 - Map
@@ -199,14 +198,14 @@ endmacro
%ReceiptProps($AD, -4, 4, $0F, $F36A, $FF, free_smallkey, skip) ; AD - Small key of Ganon's Tower
%ReceiptProps($AE, -4, 4, $0F, $F36A, $FF, skip, skip) ; AE - Reserved
%ReceiptProps($AF, -4, 4, $0F, $F36A, $FF, generic_smallkey, skip) ; AF - Generic small key
%ReceiptProps($B0, -4, 0, $49, $F36A, $FF, skip, skip) ; B0 -
%ReceiptProps($B1, -4, 0, $49, $F36A, $FF, skip, skip) ; B1 -
%ReceiptProps($B2, -4, 0, $49, $F36A, $FF, skip, skip) ; B2 -
%ReceiptProps($B3, -4, 0, $49, $F36A, $FF, skip, skip) ; B3 -
%ReceiptProps($B4, -4, 0, $49, $F36A, $FF, skip, skip) ; B4 -
%ReceiptProps($B5, -4, 0, $49, $F36A, $FF, skip, skip) ; B5 -
%ReceiptProps($B6, -4, 0, $49, $F36A, $FF, skip, skip) ; B6 -
%ReceiptProps($B7, -4, 0, $49, $F36A, $FF, skip, skip) ; B7 -
%ReceiptProps($B0, -4, 0, $28, $F36A, $FF, free_crystal, skip) ; B0 - Crystal 6
%ReceiptProps($B1, -4, 0, $28, $F36A, $FF, free_crystal, skip) ; B1 - Crystal 1
%ReceiptProps($B2, -4, 0, $28, $F36A, $FF, free_crystal, skip) ; B2 - Crystal 5
%ReceiptProps($B3, -4, 0, $28, $F36A, $FF, free_crystal, skip) ; B3 - Crystal 7
%ReceiptProps($B4, -4, 0, $28, $F36A, $FF, free_crystal, skip) ; B4 - Crystal 2
%ReceiptProps($B5, -4, 0, $28, $F36A, $FF, free_crystal, skip) ; B5 - Crystal 4
%ReceiptProps($B6, -4, 0, $28, $F36A, $FF, free_crystal, skip) ; B6 - Crystal 3
%ReceiptProps($B7, -4, 0, $49, $F36A, $FF, skip, skip) ; B7 - Reserved
%ReceiptProps($B8, -4, 0, $49, $F36A, $FF, skip, skip) ; B8 -
%ReceiptProps($B9, -4, 0, $49, $F36A, $FF, skip, skip) ; B9 -
%ReceiptProps($BA, -4, 0, $49, $F36A, $FF, skip, skip) ; BA -
@@ -560,10 +559,11 @@ endmacro
%SpriteProps($FF, 2, 2, $04, $04, $0000) ; FF -
;------------------------------------------------------------------------------
; Properties: - - w o a y s t
; Properties: p k w o a y s t
; t = Count for total item counter | s = Count for total in shops
; y = Y item | a = A item
; o = Bomb item | w = Bow item
; k = Chest Key | p = Crystal prize behavior (sparkle, etc) if set
InventoryTable:
.properties : fillbyte $00 : fill 256 ; See above
.stamp : fillword $0000 : fill 256*2 ; Address to stamp with 32-bit time (bank $7E)
@@ -577,55 +577,55 @@ macro InventoryItem(id, props, stamp, stat)
pullpc
endmacro
%InventoryItem($00, $01, SwordTime, $0000) ; 00 - Fighter sword & Shield
%InventoryItem($01, $01, SwordTime, $0000) ; 01 - Master sword
%InventoryItem($00, $81, SwordTime, $0000) ; 00 - Fighter sword & Shield
%InventoryItem($01, $81, SwordTime, $0000) ; 01 - Master sword
%InventoryItem($02, $01, SwordTime, $0000) ; 02 - Tempered sword
%InventoryItem($03, $01, SwordTime, $0000) ; 03 - Butter sword
%InventoryItem($04, $01, $0000, $0000) ; 04 - Fighter shield
%InventoryItem($05, $01, $0000, $0000) ; 05 - Fire shield
%InventoryItem($06, $01, $0000, $0000) ; 06 - Mirror shield
%InventoryItem($07, $05, $0000, $0000) ; 07 - Fire rod
%InventoryItem($08, $05, $0000, $0000) ; 08 - Ice rod
%InventoryItem($09, $05, $0000, $0000) ; 09 - Hammer
%InventoryItem($0A, $05, $0000, $0000) ; 0A - Hookshot
%InventoryItem($0B, $25, $0000, $0000) ; 0B - Bow
%InventoryItem($0C, $05, $0000, $0000) ; 0C - Blue Boomerang
%InventoryItem($0D, $05, $0000, $0000) ; 0D - Powder
%InventoryItem($0E, $01, $0000, $0000) ; 0E - Bottle refill (bee)
%InventoryItem($0F, $05, $0000, $0000) ; 0F - Bombos
%InventoryItem($10, $05, $0000, $0000) ; 10 - Ether
%InventoryItem($11, $05, $0000, $0000) ; 11 - Quake
%InventoryItem($12, $05, $0000, $0000) ; 12 - Lamp
%InventoryItem($13, $05, $0000, $0000) ; 13 - Shovel
%InventoryItem($14, $05, FluteTime, $0000) ; 14 - Flute (inactive)
%InventoryItem($15, $05, $0000, $0000) ; 15 - Somaria
%InventoryItem($16, $05, $0000, $0000) ; 16 - Bottle
%InventoryItem($03, $81, SwordTime, $0000) ; 03 - Butter sword
%InventoryItem($04, $81, $0000, $0000) ; 04 - Fighter shield
%InventoryItem($05, $81, $0000, $0000) ; 05 - Fire shield
%InventoryItem($06, $81, $0000, $0000) ; 06 - Mirror shield
%InventoryItem($07, $85, $0000, $0000) ; 07 - Fire rod
%InventoryItem($08, $85, $0000, $0000) ; 08 - Ice rod
%InventoryItem($09, $85, $0000, $0000) ; 09 - Hammer
%InventoryItem($0A, $85, $0000, $0000) ; 0A - Hookshot
%InventoryItem($0B, $85, $0000, $0000) ; 0B - Bow
%InventoryItem($0C, $85, $0000, $0000) ; 0C - Blue Boomerang
%InventoryItem($0D, $85, $0000, $0000) ; 0D - Powder
%InventoryItem($0E, $81, $0000, $0000) ; 0E - Bottle refill (bee)
%InventoryItem($0F, $85, $0000, $0000) ; 0F - Bombos
%InventoryItem($10, $85, $0000, $0000) ; 10 - Ether
%InventoryItem($11, $85, $0000, $0000) ; 11 - Quake
%InventoryItem($12, $85, $0000, $0000) ; 12 - Lamp
%InventoryItem($13, $85, $0000, $0000) ; 13 - Shovel
%InventoryItem($14, $85, FluteTime, $0000) ; 14 - Flute (inactive)
%InventoryItem($15, $85, $0000, $0000) ; 15 - Somaria
%InventoryItem($16, $85, $0000, $0000) ; 16 - Bottle
%InventoryItem($17, $01, $0000, HeartPieceCounter) ; 17 - Heart piece
%InventoryItem($18, $05, $0000, $0000) ; 18 - Byrna
%InventoryItem($19, $05, $0000, $0000) ; 19 - Cape
%InventoryItem($1A, $05, MirrorTime, $0000) ; 1A - Mirror
%InventoryItem($1B, $09, $0000, $0000) ; 1B - Glove
%InventoryItem($1C, $09, $0000, $0000) ; 1C - Mitts
%InventoryItem($1D, $05, $0000, $0000) ; 1D - Book
%InventoryItem($1E, $09, $0000, $0000) ; 1E - Flippers
%InventoryItem($1F, $01, $0000, $0000) ; 1F - Pearl
%InventoryItem($20, $00, $0000, CrystalCounter) ; 20 - Crystal
%InventoryItem($21, $05, $0000, $0000) ; 21 - Net
%InventoryItem($22, $01, $0000, $0000) ; 22 - Blue mail
%InventoryItem($23, $01, $0000, $0000) ; 23 - Red mail
%InventoryItem($24, $01, $0000, SmallKeyCounter) ; 24 - Small key
%InventoryItem($18, $85, $0000, $0000) ; 18 - Byrna
%InventoryItem($19, $85, $0000, $0000) ; 19 - Cape
%InventoryItem($1A, $85, MirrorTime, $0000) ; 1A - Mirror
%InventoryItem($1B, $89, $0000, $0000) ; 1B - Glove
%InventoryItem($1C, $89, $0000, $0000) ; 1C - Mitts
%InventoryItem($1D, $85, $0000, $0000) ; 1D - Book
%InventoryItem($1E, $89, $0000, $0000) ; 1E - Flippers
%InventoryItem($1F, $81, $0000, $0000) ; 1F - Pearl
%InventoryItem($20, $80, $0000, CrystalCounter) ; 20 - Crystal
%InventoryItem($21, $85, $0000, $0000) ; 21 - Net
%InventoryItem($22, $81, $0000, $0000) ; 22 - Blue mail
%InventoryItem($23, $81, $0000, $0000) ; 23 - Red mail
%InventoryItem($24, $41, $0000, SmallKeyCounter) ; 24 - Small key
%InventoryItem($25, $01, $0000, $0000) ; 25 - Compass
%InventoryItem($26, $00, $0000, $0000) ; 26 - Heart container from 4/4
%InventoryItem($27, $15, $0000, $0000) ; 27 - Bomb
%InventoryItem($28, $15, $0000, $0000) ; 28 - 3 bombs
%InventoryItem($29, $05, $0000, $0000) ; 29 - Mushroom
%InventoryItem($29, $85, $0000, $0000) ; 29 - Mushroom
%InventoryItem($2A, $05, $0000, $0000) ; 2A - Red boomerang
%InventoryItem($2B, $05, $0000, $0000) ; 2B - Full bottle (red)
%InventoryItem($2C, $05, $0000, $0000) ; 2C - Full bottle (green)
%InventoryItem($2D, $05, $0000, $0000) ; 2D - Full bottle (blue)
%InventoryItem($2E, $00, $0000, $0000) ; 2E - Potion refill (red)
%InventoryItem($2F, $00, $0000, $0000) ; 2F - Potion refill (green)
%InventoryItem($30, $00, $0000, $0000) ; 30 - Potion refill (blue)
%InventoryItem($2B, $85, $0000, $0000) ; 2B - Full bottle (red)
%InventoryItem($2C, $85, $0000, $0000) ; 2C - Full bottle (green)
%InventoryItem($2D, $85, $0000, $0000) ; 2D - Full bottle (blue)
%InventoryItem($2E, $80, $0000, $0000) ; 2E - Potion refill (red)
%InventoryItem($2F, $80, $0000, $0000) ; 2F - Potion refill (green)
%InventoryItem($30, $80, $0000, $0000) ; 30 - Potion refill (blue)
%InventoryItem($31, $11, $0000, $0000) ; 31 - 10 bombs
%InventoryItem($32, $01, $0000, $0000) ; 32 - Big key
%InventoryItem($33, $01, $0000, $0000) ; 33 - Map
@@ -635,12 +635,12 @@ endmacro
%InventoryItem($37, $00, $0000, PendantCounter) ; 37 - Green pendant
%InventoryItem($38, $00, $0000, PendantCounter) ; 38 - Red pendant
%InventoryItem($39, $00, $0000, PendantCounter) ; 39 - Blue pendant
%InventoryItem($3A, $25, $0000, $0000) ; 3A - Bow And Arrows
%InventoryItem($3B, $25, $0000, $0000) ; 3B - Silver Bow
%InventoryItem($3C, $05, $0000, $0000) ; 3C - Full bottle (bee)
%InventoryItem($3D, $05, $0000, $0000) ; 3D - Full bottle (fairy)
%InventoryItem($3A, $A5, $0000, $0000) ; 3A - Bow And Arrows
%InventoryItem($3B, $A5, $0000, $0000) ; 3B - Silver Bow
%InventoryItem($3C, $85, $0000, $0000) ; 3C - Full bottle (bee)
%InventoryItem($3D, $85, $0000, $0000) ; 3D - Full bottle (fairy)
%InventoryItem($3E, $01, $0000, HeartContainerCounter) ; 3E - Boss heart
%InventoryItem($3F, $01, $0000, HeartContainerCounter) ; 3F - Sanc heart
%InventoryItem($3F, $81, $0000, HeartContainerCounter) ; 3F - Sanc heart
%InventoryItem($40, $01, $0000, $0000) ; 40 - 100 rupees
%InventoryItem($41, $01, $0000, $0000) ; 41 - 50 rupees
%InventoryItem($42, $01, $0000, $0000) ; 42 - Heart
@@ -649,15 +649,15 @@ endmacro
%InventoryItem($45, $01, $0000, $0000) ; 45 - Small magic
%InventoryItem($46, $01, $0000, $0000) ; 46 - 300 rupees
%InventoryItem($47, $01, $0000, $0000) ; 47 - 20 rupees green
%InventoryItem($48, $05, $0000, $0000) ; 48 - Full bottle (good bee)
%InventoryItem($49, $01, $0000, $0000) ; 49 - Tossed fighter sword
%InventoryItem($4A, $05, FluteTime, $0000) ; 4A - Active Flute
%InventoryItem($4B, $09, BootsTime, $0000) ; 4B - Boots
%InventoryItem($48, $85, $0000, $0000) ; 48 - Full bottle (good bee)
%InventoryItem($49, $81, $0000, $0000) ; 49 - Tossed fighter sword
%InventoryItem($4A, $85, FluteTime, $0000) ; 4A - Active Flute
%InventoryItem($4B, $89, BootsTime, $0000) ; 4B - Boots
%InventoryItem($4C, $15, $0000, CapacityUpgrades) ; 4C - Bomb capacity (50)
%InventoryItem($4D, $01, $0000, CapacityUpgrades) ; 4D - Arrow capacity (70)
%InventoryItem($4E, $01, $0000, CapacityUpgrades) ; 4E - 1/2 magic
%InventoryItem($4F, $01, $0000, CapacityUpgrades) ; 4F - 1/4 magic
%InventoryItem($50, $01, SwordTime, $0000) ; 50 - Master Sword (safe)
%InventoryItem($4E, $81, $0000, CapacityUpgrades) ; 4E - 1/2 magic
%InventoryItem($4F, $81, $0000, CapacityUpgrades) ; 4F - 1/4 magic
%InventoryItem($50, $81, SwordTime, $0000) ; 50 - Master Sword (safe)
%InventoryItem($51, $15, $0000, CapacityUpgrades) ; 51 - Bomb capacity (+5)
%InventoryItem($52, $15, $0000, CapacityUpgrades) ; 52 - Bomb capacity (+10)
%InventoryItem($53, $01, $0000, CapacityUpgrades) ; 53 - Arrow capacity (+5)
@@ -665,27 +665,27 @@ endmacro
%InventoryItem($55, $01, $0000, $0000) ; 55 - Programmable item 1
%InventoryItem($56, $01, $0000, $0000) ; 56 - Programmable item 2
%InventoryItem($57, $01, $0000, $0000) ; 57 - Programmable item 3
%InventoryItem($58, $01, $0000, $0000) ; 58 - Upgrade-only Silver Arrows
%InventoryItem($58, $81, $0000, $0000) ; 58 - Upgrade-only Silver Arrows
%InventoryItem($59, $01, $0000, $0000) ; 59 - Rupoor
%InventoryItem($5A, $01, $0000, $0000) ; 5A - Nothing
%InventoryItem($5B, $01, $0000, $0000) ; 5B - Red clock
%InventoryItem($5C, $01, $0000, $0000) ; 5C - Blue clock
%InventoryItem($5D, $01, $0000, $0000) ; 5D - Green clock
%InventoryItem($5E, $01, $0000, $0000) ; 5E - Progressive sword
%InventoryItem($5F, $01, $0000, $0000) ; 5F - Progressive shield
%InventoryItem($60, $01, $0000, $0000) ; 60 - Progressive armor
%InventoryItem($61, $09, $0000, $0000) ; 61 - Progressive glove
%InventoryItem($5B, $81, $0000, $0000) ; 5B - Red clock
%InventoryItem($5C, $81, $0000, $0000) ; 5C - Blue clock
%InventoryItem($5D, $81, $0000, $0000) ; 5D - Green clock
%InventoryItem($5E, $81, $0000, $0000) ; 5E - Progressive sword
%InventoryItem($5F, $81, $0000, $0000) ; 5F - Progressive shield
%InventoryItem($60, $81, $0000, $0000) ; 60 - Progressive armor
%InventoryItem($61, $89, $0000, $0000) ; 61 - Progressive glove
%InventoryItem($62, $01, $0000, $0000) ; 62 - RNG pool item (single)
%InventoryItem($63, $01, $0000, $0000) ; 63 - RNG pool item (multi)
%InventoryItem($64, $25, $0000, $0000) ; 64 - Progressive bow
%InventoryItem($65, $25, $0000, $0000) ; 65 - Progressive bow
%InventoryItem($64, $A5, $0000, $0000) ; 64 - Progressive bow
%InventoryItem($65, $A5, $0000, $0000) ; 65 - Progressive bow
%InventoryItem($66, $01, $0000, $0000) ; 66 -
%InventoryItem($67, $01, $0000, $0000) ; 67 -
%InventoryItem($68, $01, $0000, $0000) ; 68 -
%InventoryItem($69, $01, $0000, $0000) ; 69 -
%InventoryItem($6A, $01, $0000, $0000) ; 6A - Triforce
%InventoryItem($6B, $01, $0000, $0000) ; 6B - Power star
%InventoryItem($6C, $01, $0000, $0000) ; 6C - Triforce Piece
%InventoryItem($6A, $81, $0000, $0000) ; 6A - Triforce
%InventoryItem($6B, $81, $0000, $0000) ; 6B - Power star
%InventoryItem($6C, $81, $0000, $0000) ; 6C - Triforce Piece
%InventoryItem($6D, $01, $0000, $0000) ; 6D - Server request item
%InventoryItem($6E, $01, $0000, $0000) ; 6E - Server request item (dungeon drop)
%InventoryItem($6F, $01, $0000, $0000) ; 6F -
@@ -721,7 +721,7 @@ endmacro
%InventoryItem($8D, $01, $0000, $0000) ; 8D - Compass of Eastern Palace
%InventoryItem($8E, $01, $0000, $0000) ; 8E - Compass of Hyrule Castle
%InventoryItem($8F, $01, $0000, $0000) ; 8F - Compass of Sewers
%InventoryItem($90, $01, $0000, $0000) ; 90 - Skull key
%InventoryItem($90, $81, $0000, $0000) ; 90 - Skull key
%InventoryItem($91, $01, $0000, $0000) ; 91 - Reserved
%InventoryItem($92, $01, $0000, $0000) ; 92 - Big key of Ganon's Tower
%InventoryItem($93, $01, $0000, $0000) ; 93 - Big key of Turtle Rock
@@ -737,30 +737,30 @@ endmacro
%InventoryItem($9D, $01, $0000, $0000) ; 9D - Big key of Eastern Palace
%InventoryItem($9E, $01, $0000, $0000) ; 9E - Big key of Hyrule Castle
%InventoryItem($9F, $01, $0000, $0000) ; 9F - Big key of Sewers
%InventoryItem($A0, $01, $0000, SmallKeyCounter) ; A0 - Small key of Sewers
%InventoryItem($A1, $01, $0000, SmallKeyCounter) ; A1 - Small key of Hyrule Castle
%InventoryItem($A2, $01, $0000, SmallKeyCounter) ; A2 - Small key of Eastern Palace
%InventoryItem($A3, $01, $0000, SmallKeyCounter) ; A3 - Small key of Desert Palace
%InventoryItem($A4, $01, $0000, SmallKeyCounter) ; A4 - Small key of Agahnim's Tower
%InventoryItem($A5, $01, $0000, SmallKeyCounter) ; A5 - Small key of Swamp Palace
%InventoryItem($A6, $01, $0000, SmallKeyCounter) ; A6 - Small key of Dark Palace
%InventoryItem($A7, $01, $0000, SmallKeyCounter) ; A7 - Small key of Misery Mire
%InventoryItem($A8, $01, $0000, SmallKeyCounter) ; A8 - Small key of Skull Woods
%InventoryItem($A9, $01, $0000, SmallKeyCounter) ; A9 - Small key of Ice Palace
%InventoryItem($AA, $01, $0000, SmallKeyCounter) ; AA - Small key of Tower of Hera
%InventoryItem($AB, $01, $0000, SmallKeyCounter) ; AB - Small key of Thieves' Town
%InventoryItem($AC, $01, $0000, SmallKeyCounter) ; AC - Small key of Turtle Rock
%InventoryItem($AD, $01, $0000, SmallKeyCounter) ; AD - Small key of Ganon's Tower
%InventoryItem($A0, $41, $0000, SmallKeyCounter) ; A0 - Small key of Sewers
%InventoryItem($A1, $41, $0000, SmallKeyCounter) ; A1 - Small key of Hyrule Castle
%InventoryItem($A2, $41, $0000, SmallKeyCounter) ; A2 - Small key of Eastern Palace
%InventoryItem($A3, $41, $0000, SmallKeyCounter) ; A3 - Small key of Desert Palace
%InventoryItem($A4, $41, $0000, SmallKeyCounter) ; A4 - Small key of Agahnim's Tower
%InventoryItem($A5, $41, $0000, SmallKeyCounter) ; A5 - Small key of Swamp Palace
%InventoryItem($A6, $41, $0000, SmallKeyCounter) ; A6 - Small key of Dark Palace
%InventoryItem($A7, $41, $0000, SmallKeyCounter) ; A7 - Small key of Misery Mire
%InventoryItem($A8, $41, $0000, SmallKeyCounter) ; A8 - Small key of Skull Woods
%InventoryItem($A9, $41, $0000, SmallKeyCounter) ; A9 - Small key of Ice Palace
%InventoryItem($AA, $41, $0000, SmallKeyCounter) ; AA - Small key of Tower of Hera
%InventoryItem($AB, $41, $0000, SmallKeyCounter) ; AB - Small key of Thieves' Town
%InventoryItem($AC, $41, $0000, SmallKeyCounter) ; AC - Small key of Turtle Rock
%InventoryItem($AD, $41, $0000, SmallKeyCounter) ; AD - Small key of Ganon's Tower
%InventoryItem($AE, $01, $0000, $0000) ; AE - Reserved
%InventoryItem($AF, $01, $0000, SmallKeyCounter) ; AF - Generic small key
%InventoryItem($B0, $01, $0000, $0000) ; B0 -
%InventoryItem($B1, $01, $0000, $0000) ; B1 -
%InventoryItem($B2, $01, $0000, $0000) ; B2 -
%InventoryItem($B3, $01, $0000, $0000) ; B3 -
%InventoryItem($B4, $01, $0000, $0000) ; B4 -
%InventoryItem($B5, $01, $0000, $0000) ; B5 -
%InventoryItem($B6, $01, $0000, $0000) ; B6 -
%InventoryItem($B7, $01, $0000, $0000) ; B7 -
%InventoryItem($B0, $81, $0000, CrystalCounter) ; B0 - Crystal 6
%InventoryItem($B1, $81, $0000, CrystalCounter) ; B1 - Crystal 1
%InventoryItem($B2, $81, $0000, CrystalCounter) ; B2 - Crystal 5
%InventoryItem($B3, $81, $0000, CrystalCounter) ; B3 - Crystal 7
%InventoryItem($B4, $81, $0000, CrystalCounter) ; B4 - Crystal 2
%InventoryItem($B5, $81, $0000, CrystalCounter) ; B5 - Crystal 4
%InventoryItem($B6, $81, $0000, CrystalCounter) ; B6 - Crystal 3
%InventoryItem($B7, $01, $0000, $0000) ; B7 - Reserved
%InventoryItem($B8, $01, $0000, $0000) ; B8 -
%InventoryItem($B9, $01, $0000, $0000) ; B9 -
%InventoryItem($BA, $01, $0000, $0000) ; BA -
@@ -1017,15 +1017,14 @@ ItemReceiptGraphicsOffsets:
dw BigDecompressionBuffer+$1DC0 ; AD - Small key of Ganon's Tower
dw $0 ; AE - Reserved
dw BigDecompressionBuffer+$1DC0 ; AF - Generic small key
dw $0 ; B0 -
dw $0 ; B1 -
dw $0 ; B2 -
dw $0 ; B3 -
dw $0 ; B4 -
dw $0 ; B5 -
dw $0 ; B6 -
dw $0 ; B7 -
dw BigDecompressionBuffer+$08A0 ; B0 - Crystal 6
dw BigDecompressionBuffer+$08A0 ; B1 - Crystal 1
dw BigDecompressionBuffer+$08A0 ; B2 - Crystal 5
dw BigDecompressionBuffer+$08A0 ; B3 - Crystal 7
dw BigDecompressionBuffer+$08A0 ; B4 - Crystal 2
dw BigDecompressionBuffer+$08A0 ; B5 - Crystal 4
dw BigDecompressionBuffer+$08A0 ; B6 - Crystal 3
dw $0 ; B7 - Reserved
dw $0 ; B8 -
dw $0 ; B9 -
dw $0 ; BA -
@@ -1288,15 +1287,14 @@ StandingItemGraphicsOffsets:
dw BigDecompressionBuffer+$1DC0 ; AD - Small key of Ganon's Tower
dw $0 ; AE - Reserved
dw BigDecompressionBuffer+$1DC0 ; AF - Generic small key
dw $0 ; B0 -
dw $0 ; B1 -
dw $0 ; B2 -
dw $0 ; B3 -
dw $0 ; B4 -
dw $0 ; B5 -
dw $0 ; B6 -
dw $0 ; B7 -
dw BigDecompressionBuffer+$08A0 ; B0 - Crystal 6
dw BigDecompressionBuffer+$08A0 ; B1 - Crystal 1
dw BigDecompressionBuffer+$08A0 ; B2 - Crystal 5
dw BigDecompressionBuffer+$08A0 ; B3 - Crystal 7
dw BigDecompressionBuffer+$08A0 ; B4 - Crystal 2
dw BigDecompressionBuffer+$08A0 ; B5 - Crystal 4
dw BigDecompressionBuffer+$08A0 ; B6 - Crystal 3
dw $0 ; B7 - Reserved
dw $0 ; B8 -
dw $0 ; B9 -
dw $0 ; BA -

View File

@@ -2,11 +2,6 @@
; Item Downgrade Fix
;--------------------------------------------------------------------------------
ItemDowngradeFix:
JSR ItemDowngradeFixMain
JSL CountChestKeyLong
RTL
ItemDowngradeFixMain:
JSL.l AddInventory
BMI .dontWrite ; thing we wrote over part 1
@@ -34,7 +29,7 @@ ItemDowngradeFixMain:
.done
STA.b [Scrap00] ; thing we wrote over part 2
.dontWrite
RTS
RTL
.isPowerGloves
.isBlueShield
.isRedShield
@@ -43,7 +38,7 @@ RTS
.isBowAndArrows
CMP.b [$00] : !BGE .done ; finished if we're upgrading
LDA.b [$00] ; reload old value
RTS
RTL
.isSilverArrowBow
.isRedBoomerang
.isMagicPowder
@@ -54,10 +49,10 @@ RTS
LDA.b [Scrap00] : BNE + ; don't upgrade if we already have the toggle for it
PLA
STA.b [Scrap00]
RTS
RTL
+
PLA
RTS
RTL
.isSword
PHA
LDA.l HighestSword : STA.b Scrap04
@@ -77,5 +72,5 @@ JMP .done
INC.b Scrap00
LDA.l HighestShield : STA.b [Scrap00]
PLA
RTS
RTL
;================================================================================

View File

@@ -27,6 +27,11 @@ Notice_SmallKeyOf:
db $75, $00, $BC, $00, $B6, $00, $AA, $00, $B5, $00, $B5, $00, $FF, $00, $B4, $00, $AE, $00, $C2, $00, $FF, $00, $BD, $00, $B8
dw #$7F7F
;
Notice_Crystal:
db $74, $00, $C2, $00, $B8, $00, $BE, $00, $FF, $00, $B9, $00, $B2, $00, $AC, $00, $B4, $00, $AE, $00, $AD, $00, $FF, $00, $BE, $00, $B9
dw $7F7F
; light world
Notice_LightWorld:
db $76, $00, $B5, $00, $B2, $00, $B0, $00, $B1, $00, $BD, $00, $FF, $00, $C0, $00, $B8, $00, $BB, $00, $B5, $00, $AD
@@ -111,3 +116,32 @@ Notice_Sewers:
Notice_Self:
db $76, $00, $BD, $00, $B1, $00, $B2, $00, $BC, $00, $FF, $00, $AD, $00, $BE, $00, $B7, $00, $B0, $00, $AE, $00, $B8, $00, $B7
dw #$7F7F
; Crystal numbers
Notice_One:
db $75, $00, $AC, $00, $BB, $00, $C2, $00, $BC, $00, $BD, $00, $AA, $00, $B5, $00, $FF, $00, $B8, $00, $B7, $00, $AE
dw #$7F7F
Notice_Two:
db $75, $00, $AC, $00, $BB, $00, $C2, $00, $BC, $00, $BD, $00, $AA, $00, $B5, $00, $FF, $00, $BD, $00, $C0, $00, $B8
dw #$7F7F
Notice_Three:
db $75, $00, $AC, $00, $BB, $00, $C2, $00, $BC, $00, $BD, $00, $AA, $00, $B5, $00, $FF, $00, $BD, $00, $B1, $00, $BB, $00, $AE, $00, $AE
dw #$7F7F
Notice_Four:
db $75, $00, $AC, $00, $BB, $00, $C2, $00, $BC, $00, $BD, $00, $AA, $00, $B5, $00, $FF, $00, $AF, $00, $B8, $00, $BE, $00, $BB
dw #$7F7F
Notice_Five:
db $75, $00, $AC, $00, $BB, $00, $C2, $00, $BC, $00, $BD, $00, $AA, $00, $B5, $00, $FF, $00, $AF, $00, $B2, $00, $BF, $00, $AE
dw #$7F7F
Notice_Six:
db $75, $00, $AC, $00, $BB, $00, $C2, $00, $BC, $00, $BD, $00, $AA, $00, $B5, $00, $FF, $00, $BC, $00, $B2, $00, $C1
dw #$7F7F
Notice_Seven:
db $75, $00, $AC, $00, $BB, $00, $C2, $00, $BC, $00, $BD, $00, $AA, $00, $B5, $00, $FF, $00, $BC, $00, $AE, $00, $BF, $00, $AE, $00, $B7
dw #$7F7F

View File

@@ -24,9 +24,14 @@ Notice_BigKeyOf:
; small key to
Notice_SmallKeyOf:
db $74, $00, $BD, $00, $37, $00, $38, $00, $42, $00, $FF, $00, $38, $00, $42, $00, $FF, $00, $30
db $75, $00, $42, $00, $3C, $00, $30, $00, $3B, $00, $3B, $00, $FF, $00, $3A, $00, $34, $00, $48, $00, $FF, $00, $43, $00, $3e
db $75, $00, $42, $00, $3C, $00, $30, $00, $3B, $00, $3B, $00, $FF, $00, $3A, $00, $34, $00, $48, $00, $FF, $00, $43, $00, $3E
dw #$7F7F
; You picked up
Notice_Crystal:
db $74, $00, $C2, $00, $3E, $00, $44, $00, $FF, $00, $3F, $00, $38, $00, $32, $00, $3A, $00, $34, $00, $33, $00, $FF, $00, $44, $00, $3F
dw $7F7F
; light world
Notice_LightWorld:
db $76, $00, $B5, $00, $38, $00, $36, $00, $37, $00, $43, $00, $FF, $00, $C0, $00, $3E, $00, $41, $00, $3B, $00, $33
@@ -44,12 +49,12 @@ Notice_GTower:
; Turtle Rock
Notice_TRock:
db $76, $00, $BD, $00, $44, $00, $41, $00, $43, $00, $3B, $00, $34, $00, $FF, $00, $BB, $00, $3E, $00, $32, $00, $3a
db $76, $00, $BD, $00, $44, $00, $41, $00, $43, $00, $3B, $00, $34, $00, $FF, $00, $BB, $00, $3E, $00, $32, $00, $3A
dw #$7F7F
; Thieves Town
Notice_Thieves:
db $76, $00, $BD, $00, $37, $00, $38, $00, $34, $00, $45, $00, $34, $00, $42, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $3d
db $76, $00, $BD, $00, $37, $00, $38, $00, $34, $00, $45, $00, $34, $00, $42, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $3D
dw #$7F7F
; Tower of Hera
@@ -110,4 +115,33 @@ Notice_Sewers:
; This Dungeon
Notice_Self:
db $76, $00, $43, $00, $37, $00, $38, $00, $42, $00, $FF, $00, $33, $00, $44, $00, $3D, $00, $36, $00, $34, $00, $3E, $00, $3d
dw #$7F7F
dw #$7F7F
; Crystal numbers
Notice_One:
db $75, $00, $32, $00, $41, $00, $48, $00, $42, $00, $43, $00, $30, $00, $3B, $00, $FF, $00, $3E, $00, $3D, $00, $34
dw #$7F7F
Notice_Two:
db $75, $00, $32, $00, $41, $00, $48, $00, $42, $00, $43, $00, $30, $00, $3B, $00, $FF, $00, $43, $00, $46, $00, $3E
dw #$7F7F
Notice_Three:
db $75, $00, $32, $00, $41, $00, $48, $00, $42, $00, $43, $00, $30, $00, $3B, $00, $FF, $00, $43, $00, $37, $00, $41, $00, $34, $00, $34
dw #$7F7F
Notice_Four:
db $75, $00, $32, $00, $41, $00, $48, $00, $42, $00, $43, $00, $30, $00, $3B, $00, $FF, $00, $35, $00, $3E, $00, $44, $00, $41
dw #$7F7F
Notice_Five:
db $75, $00, $32, $00, $41, $00, $48, $00, $42, $00, $43, $00, $30, $00, $3B, $00, $FF, $00, $35, $00, $38, $00, $45, $00, $34
dw #$7F7F
Notice_Six:
db $75, $00, $32, $00, $41, $00, $48, $00, $42, $00, $43, $00, $30, $00, $3B, $00, $FF, $00, $42, $00, $38, $00, $47
dw #$7F7F
Notice_Seven:
db $75, $00, $32, $00, $41, $00, $48, $00, $42, $00, $43, $00, $30, $00, $3B, $00, $FF, $00, $42, $00, $34, $00, $45, $00, $34, $00, $3D
dw #$7F7F

View File

@@ -177,7 +177,10 @@ NewHUD_DrawPrizeIcon:
.prize
TYX
LDA.l CrystalPendantFlags_2,X
AND.w #$0040
BIT.w #$0080
BNE .no_icon
BIT.w #$0040
BNE .crystal
LDY.w #!PTile
@@ -185,6 +188,10 @@ NewHUD_DrawPrizeIcon:
.crystal
LDY.w #!CTile
BRA .draw_prize
.no_icon
LDY.w #!BlankTile
.draw_prize
STY.w HUDPrizeIcon

View File

@@ -75,14 +75,6 @@ macro ProgrammableItemLogic(index)
?end:
endmacro
macro ValueShift()
TAX : LDA.b #$01
?start:
CPX #$00 : BEQ ?end
ASL
DEX
BRA ?start : ?end:
endmacro
;--------------------------------------------------------------------------------
;carry clear if pass
;carry set if caught
@@ -109,7 +101,7 @@ ProcessEventItems:
REP #$20 ; set 16-bit accumulator
LDA.l GoalItemRequirement : BEQ ++
LDA.l GoalCounter : INC : STA.l GoalCounter
CMP.l GoalItemRequirement : !BLT ++
CMP.l GoalItemRequirement : BCC ++
LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++
JSL.l ActivateGoal
++
@@ -139,6 +131,7 @@ AddReceivedItemExpandedGetItem:
SEP #$30
PLB : PLX
STZ.w ShopPurchaseFlag
LDA.w ItemReceiptMethod : CMP.b #$01 ; thing we wrote over
RTL
@@ -187,42 +180,42 @@ ItemBehavior:
LDX.b #$01
JSR .increment_sword
JSR .increment_shield
REP #$10
RTS
.master_sword
SEP #$10
LDX.b #$02
JSR .increment_sword
REP #$10
RTS
.tempered_sword
SEP #$10
LDX.b #$03
JSR .increment_sword
REP #$10
RTS
.gold_sword
SEP #$10
LDX.b #$04
JSR .increment_sword
REP #$10
RTS
.fighter_shield
SEP #$10
LDX.b #$01
JSR .increment_shield
REP #$10
RTS
.red_shield
SEP #$10
LDX.b #$02
JSR .increment_shield
REP #$10
LDA.w ShopPurchaseFlag : BNE .shop_shield
-
LDX.b #$02
JSR .increment_shield
RTS
.shop_shield
TYX
LDA.l InventoryTable_properties,X : BIT.b #$02 : BNE -
RTS
.mirror_shield
@@ -291,10 +284,12 @@ ItemBehavior:
REP #$20
LDA.w DungeonID : CMP.w #$0003 : BCC ..hc_sewers
TAX
LDA.l DungeonMask,X : ORA.l CompassField : STA.l CompassField
LDA.l DungeonItemMasks,X : TAY
ORA.l CompassField : STA.l CompassField
JMP.w .increment_compass
..hc_sewers
LDA.w #$C000 : ORA.l CompassField : STA.l CompassField
LDA.w #$C000 : TAY
ORA.l CompassField : STA.l CompassField
JMP.w .increment_compass
@@ -302,7 +297,7 @@ ItemBehavior:
REP #$20
LDA.w DungeonID : CMP.w #$0003 : BCC ..hc_sewers
TAX
LDA.l DungeonMask,X : ORA.l BigKeyField : STA.l BigKeyField
LDA.l DungeonItemMasks,X : ORA.l BigKeyField : STA.l BigKeyField
JMP.w .increment_bigkey
..hc_sewers
LDA.w #$C000 : ORA.l BigKeyField : STA.l BigKeyField
@@ -312,10 +307,12 @@ ItemBehavior:
REP #$20
LDA.w DungeonID : CMP.w #$0003 : BCC ..hc_sewers
TAX
LDA.l DungeonMask,X : ORA.l MapField : STA.l MapField
LDA.l DungeonItemMasks,X : TAY
ORA.l MapField : STA.l MapField
JMP.w .increment_map
..hc_sewers
LDA.w #$C000 : ORA.l MapField : STA.l MapField
LDA.w #$C000 : TAY
ORA.l MapField : STA.l MapField
JMP.w .increment_map
.bow_and_arrows
@@ -451,7 +448,7 @@ ItemBehavior:
REP #$20 ; set 16-bit accumulator
LDA.l GoalItemRequirement : BEQ +
LDA.l GoalCounter : INC : STA.l GoalCounter
CMP.w GoalItemRequirement : !BLT +
CMP.w GoalItemRequirement : BCC +
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
JSL.l ActivateGoal
+
@@ -479,12 +476,15 @@ ItemBehavior:
LSR
AND.w #$000F : ASL : TAX
LDA.w DungeonItemIDMap,X : TAX
LDA.l DungeonMask,X : ORA.l MapField : STA.l MapField
LDA.l DungeonItemMasks,X : TAY
ORA.l MapField : STA.l MapField
SEP #$20
JMP.w .increment_map
.hc_map
LDA.b #$C0 : ORA.l MapField+1 : STA.l MapField+1
REP #$20
LDA.w #$C000 : TAY
ORA.l MapField : STA.l MapField
JMP.w .increment_map
.free_compass
@@ -492,12 +492,16 @@ ItemBehavior:
LSR
AND.w #$000F : ASL : TAX
LDA.w DungeonItemIDMap,X : TAX
LDA.l DungeonMask,X : ORA.l CompassField : STA.l CompassField
LDA.l DungeonItemMasks,X : TAY
ORA.l CompassField : STA.l CompassField
SEP #$20
JMP.w .increment_compass
.hc_compass
LDA.b #$C0 : ORA.l CompassField+1 : STA.l CompassField+1
REP #$20
LDA.w #$C000 : TAY
ORA.l CompassField : STA.l CompassField
SEP #$20
JMP.w .increment_compass
.free_bigkey
@@ -505,7 +509,7 @@ ItemBehavior:
LSR
AND.w #$000F : ASL : TAX
LDA.w DungeonItemIDMap,X : TAX
LDA.l DungeonMask,X : ORA.l BigKeyField : STA.l BigKeyField
LDA.l DungeonItemMasks,X : ORA.l BigKeyField : STA.l BigKeyField
SEP #$20
JMP.w .increment_bigkey
@@ -537,50 +541,68 @@ ItemBehavior:
LDA.l CurrentSmallKeys : INC : STA.l CurrentSmallKeys
RTS
.normal
LDA.w DungeonID : CMP.b #$FF : BEQ .done
LDA.w DungeonID : BMI +
LDA.l CurrentSmallKeys : INC : STA.l CurrentSmallKeys
RTS
+
RTS
.increment_sword
LDA.l HighestSword
INC : STA.b Scrap04 : CPX.b Scrap04 : !BLT + ; don't increment unless we're getting a better sword
INC : STA.b Scrap04 : CPX.b Scrap04 : BCC + ; don't increment unless we're getting a better sword
TXA : STA.l HighestSword
+
RTS
.increment_shield
LDA.l HighestShield
INC : STA.b Scrap04 : CPX.b Scrap04 : !BLT + ; don't increment unless we're getting a better shield
INC : STA.b Scrap04 : CPX.b Scrap04 : BCC + ; don't increment unless we're getting a better shield
TXA : STA.l HighestShield
+
RTS
.increment_mail
LDA.l HighestMail
INC : STA.b Scrap04 : CPX.b Scrap04 : !BLT + ; don't increment unless we're getting a better mail
INC : STA.b Scrap04 : CPX.b Scrap04 : BCC + ; don't increment unless we're getting a better mail
TXA : STA.l HighestMail
+
RTS
.increment_bigkey
SEP #$30
SEP #$20
LDA.l BigKeysBigChests
CLC : ADC.b #$10
STA.l BigKeysBigChests
RTS
.increment_map
SEP #$30
SEP #$20
LDA.l MapsCompasses
CLC : ADC.b #$10
STA.l MapsCompasses
JSL.l MaybeFlagMapTotalPickup
RTS
.increment_compass
SEP #$30
SEP #$20
LDA.l MapsCompasses : INC : AND.b #$0F : TAX
LDA.l MapsCompasses : AND.b #$F0 : STA.l MapsCompasses
TXA : ORA.l MapsCompasses : STA.l MapsCompasses
JSL MaybeFlagCompassTotalPickup
RTS
.free_crystal
REP #$20
LSR
AND.w #$000F : TAX
LDA.w #$0000
SEC
-
ROL
DEX
BPL -
SEP #$20
ORA.l CrystalsField : STA.l CrystalsField
.done
RTS
@@ -589,10 +611,10 @@ ResolveReceipt:
PHA : PHX
PHK : PLB
JSL.l PreItemGet
LDA.w ItemReceiptID ; Item Value
LDA.w ItemReceiptID
.get_item
JSR.w AttemptItemSubstitution
JSR.w HandleBowTracking ; Progressive bows get resolved to new loot id
JSR.w HandleBowTracking
JSR.w ResolveLootID
.have_item
STA.w ItemReceiptID
@@ -617,10 +639,10 @@ ResolveLootID:
TAY
REP #$30
AND.w #$00FF : ASL : TAX
SEP #$30
TYA
JMP.w (ItemReceipts_resolution,X)
.have_item
SEP #$30
PLB : PLX
RTS
@@ -628,14 +650,16 @@ ResolveLootID:
JMP.w .have_item
.bottles
JSR.w CountBottles : CMP.l BottleLimit : !BLT +
SEP #$30
JSR.w CountBottles : CMP.l BottleLimit : BCC +
LDA.l BottleLimitReplacement
JMP.w .get_item
+
LDA.w ItemReceiptID
TYA
JMP.w .have_item
.magic
SEP #$20
LDA.l MagicConsumption : TAX
LDA.w ResolveLootID_magic_ids,X
JMP.w .have_item
@@ -643,6 +667,7 @@ ResolveLootID:
db $4E, $4F, $4F
.prog_sword
SEP #$20
LDA.l HighestSword
CMP.l ProgressiveSwordLimit : BCC +
LDA.l ProgressiveSwordReplacement
@@ -655,6 +680,7 @@ ResolveLootID:
db $49, $50, $02, $03, $03
.shields
SEP #$20
LDA.l HighestShield
CMP.l ProgressiveShieldLimit : BCC +
LDA.l ProgressiveShieldReplacement
@@ -667,6 +693,7 @@ ResolveLootID:
db $04, $05, $06, $06
.armor
SEP #$20
LDA.l HighestMail
CMP.l ProgressiveArmorLimit : BCC +
LDA.l ProgressiveArmorReplacement
@@ -679,6 +706,7 @@ ResolveLootID:
.gloves
SEP #$20
LDA.l GloveEquipment : TAX
LDA.w ResolveLootID_gloves_ids,X
JMP.w .have_item
@@ -686,6 +714,7 @@ ResolveLootID:
db $1B, $1C, $1C
.progressive_bow
SEP #$20
LDA.l BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : BCC +
LDA.l ProgressiveBowReplacement
JMP.w .get_item
@@ -696,6 +725,7 @@ ResolveLootID:
JMP.w .get_item
.progressive_bow_2
SEP #$20
LDA.l BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : BCC +
LDA.l ProgressiveBowReplacement
JMP.w .get_item
@@ -826,7 +856,7 @@ GetRNGItemSingle:
LDX.b #$00
.single_reroll
JSL.l GetRandomInt : AND.b #$7F ; select random value
INX : CPX.b #$7F : !BLT + : LDA.b #$00 : BRA +++ : + ; default to 0 if too many attempts
INX : CPX.b #$7F : BCC + : LDA.b #$00 : BRA +++ : + ; default to 0 if too many attempts
CMP.l RNGSingleTableSize : !BGE .single_reroll
+++
@@ -837,9 +867,9 @@ GetRNGItemSingle:
TYA
JSR.w CheckSingleItem : BEQ .single_unused ; already used
LDA.w ScratchBufferV : INC ; increment index
CMP.l RNGSingleTableSize : !BLT +++ : LDA.b #$00 : +++ ; rollover index if needed
CMP.l RNGSingleTableSize : BCC +++ : LDA.b #$00 : +++ ; rollover index if needed
STA.w ScratchBufferV ; store index
INX : TAY : TXA : CMP.l RNGSingleTableSize : !BLT .recheck
INX : TAY : TXA : CMP.l RNGSingleTableSize : BCC .recheck
LDA.b #$5A ; everything is gone, default to null item - MAKE THIS AN OPTION FOR THIS AND THE OTHER ONE
BRA .single_done
.single_unused
@@ -891,7 +921,7 @@ GetRNGItemMulti:
LDX.b #$00
- ; reroll
JSL.l GetRandomInt : AND.b #$7F ; select random value
INX : CPX.b #$7F : !BLT + : LDA.b 00 : BRA .done : + ; default to 0 if too many attempts
INX : CPX.b #$7F : BCC + : LDA.b 00 : BRA .done : + ; default to 0 if too many attempts
CMP.l RNGMultiTableSize : !BGE -
.done
STA.l RNGLockIn
@@ -930,12 +960,13 @@ AttemptItemSubstitution:
TXA : LSR #2 : TAX
LDA.l ItemLimitCounts, X
PLX
CMP.l ItemSubstitutionRules+1, X : !BLT +
CMP.l ItemSubstitutionRules+1, X : BCC +
LDA.l ItemSubstitutionRules+2, X : STA.b 1,S
+: BEQ .exit
.noMatch
+
BEQ .exit
.noMatch
INX #4
BRA -
BRA -
.exit
PLA : PLX
RTS
@@ -967,101 +998,66 @@ ChestPrep:
LDY.b Scrap0C ; get item value
SEC
RTL
;--------------------------------------------------------------------------------
; Set a flag in SRAM if we pick up a compass in its own dungeon with HUD compass
; counts on
MaybeFlagCompassTotalPickup:
LDA.l CompassMode : AND.b #$0F : BEQ .done
LDA.w DungeonID : CMP.b #$FF : BEQ .done
LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag "index"
CPY.b #$25 : BEQ .setFlag ; Set flag if it's a compass for this dungeon
STA.b Scrap04
TYA : AND.b #$0F : CMP.b Scrap04 : BNE .done ; Check if compass is for this dungeon
.setFlag
CMP.b #$08 : !BGE ++
%ValueShift()
ORA.l CompassCountDisplay : STA.l CompassCountDisplay
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA.l CompassCountDisplay+1 : STA.l CompassCountDisplay+1
LDA.w DungeonID : BMI .done
LDA.w ItemReceiptID : CMP.b #$25 : BEQ .set_flag
REP #$20
AND.w #$000F : ASL : TAX
LDA.w DungeonItemIDMap,X : CMP.w DungeonID : BNE .done
.set_flag
REP #$20
TYA : ORA.l CompassCountDisplay : STA.l CompassCountDisplay
.done
RTL
MaybeFlagMapTotalPickup:
LDA.l MapHUDMode : AND.b #$0F : BEQ .done
LDA.w DungeonID : BMI .done
LDA.w ItemReceiptID : CMP.b #$33 : BEQ .set_flag
REP #$20
AND.w #$000F : ASL : TAX
LDA.w DungeonItemIDMap,X : CMP.w DungeonID : BNE .done
.set_flag
REP #$20
TYA : ORA.l MapCountDisplay : STA.l MapCountDisplay
.done
RTL
;--------------------------------------------------------------------------------
; Set the dungeon item count display flags if we're entering a dungeon and have the
; corresponding dungeon item
MaybeFlagDungeonTotalsEntrance:
LDX.w DungeonID : CPX.b #$FF : BEQ .done ; Skip if we're not entering dungeon
LDA.l CompassMode : AND.w #$000F : BEQ .maps ; Skip if we're not showing compass counts
JSR.w FlagCompassCount
.maps
LDA.l MapHUDMode : AND.w #$000F : BEQ .done
LDX.w DungeonID
JSR.w FlagMapCount
LDX.w DungeonID : BMI .done ; Skip if we're not entering dungeon
REP #$10
LDA.l DungeonItemMasks,X : TAY
LDA.l CompassMode : AND.w #$000F : BEQ .maps ; Skip if we're not showing compass counts
JSR.w FlagCompassCount
.maps
LDA.l MapHUDMode : AND.w #$000F : BEQ .done
LDX.w DungeonID
JSR.w FlagMapCount
.done
RTL
;--------------------------------------------------------------------------------
FlagCompassCount:
CMP.w #$0002 : BEQ .compassShown
CMP.w #$0002 : BEQ .compass_shown
LDA.l CompassField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have compass
.compassShown
SEP #$20
TXA : LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag index
CMP.b #$08 : !BGE ++
%ValueShift()
ORA.l CompassCountDisplay : STA.l CompassCountDisplay
REP #$20
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA.l CompassCountDisplay+1 : STA.l CompassCountDisplay+1
REP #$20
.compass_shown
TYA : ORA.l CompassCountDisplay : STA.l CompassCountDisplay
.done
RTS
;--------------------------------------------------------------------------------
FlagMapCount:
CMP.w #$0002 : BEQ .mapShown
LDA.l MapField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have map
.mapShown
SEP #$20
TXA : LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag index
CMP.b #$08 : !BGE ++
%ValueShift()
ORA.l MapCountDisplay : STA.l MapCountDisplay
REP #$20
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA.l MapCountDisplay+1 : STA.l MapCountDisplay+1
REP #$20
.mapShown
TYA : ORA.l MapCountDisplay : STA.l MapCountDisplay
.done
RTS
;--------------------------------------------------------------------------------
MaybeFlagMapTotalPickup:
LDA.l MapHUDMode : AND.b #$0F : BEQ .done
LDA.w DungeonID : CMP.b #$FF : BEQ .done
LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag "index"
CPY.b #$33 : BEQ .setFlag ; Set flag if it's a compass for this dungeon
STA.b Scrap04
TYA : AND.b #$0F : CMP.b Scrap04 : BNE .done ; Check if map is for this dungeon
.setFlag
CMP.b #$08 : !BGE ++
%ValueShift()
ORA.l MapCountDisplay : STA.l MapCountDisplay
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA.l MapCountDisplay+1 : STA.l MapCountDisplay+1
.done
RTL
;--------------------------------------------------------------------------------
DungeonItemIDMap: ; Maps lower four bits of our new dungeon items to DungeonID
dw $FFFF

View File

@@ -47,11 +47,11 @@ ItemCheck_SickKid:
RTL
ItemCheck_TreeKid:
LDA.l NpcFlags : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment
LDA.l NpcFlags : AND.b #$08
RTL
ItemCheck_TreeKid2:
LDA.l NpcFlags : AND.b #$08 : CMP.b #$08 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03
LDA.l NpcFlags : AND.b #$08 : CMP.b #$08
TDC ; ?? TODO
RTL

143
overworldmap.asm Normal file
View File

@@ -0,0 +1,143 @@
pushpc
org $0AC02B
DrawPrizesOverride:
LDX.b #$FF
.loopStart
INX : PHX
JSR OverworldMap_CheckForPrize
BCC + : JMP .skip_draw : +
TXA : ASL A : TAX
LDA.l MapCompassFlag
AND #$01 : BNE +
LDA.l WorldMapIcon_posx_vanilla+1, X : STA.l $7EC10B
LDA.l WorldMapIcon_posx_vanilla, X : STA.l $7EC10A
LDA.l WorldMapIcon_posy_vanilla+1, X : STA.l $7EC109
LDA.l WorldMapIcon_posy_vanilla, X : STA.l $7EC108
BRA .adjustment
+ LDA.l WorldMapIcon_posx_located+1, X : STA.l $7EC10B
LDA.l WorldMapIcon_posx_located, X : STA.l $7EC10A
LDA.l WorldMapIcon_posy_located+1, X : STA.l $7EC109
LDA.l WorldMapIcon_posy_located, X : STA.l $7EC108
.adjustment
LDA.l WorldMapIcon_tile, X : CMP #$FF : BEQ .skip_draw
LDA.l WorldMapIcon_tile+1, X : BEQ .dont_adjust
CMP.b #$64 : BEQ .is_crystal
LDA.b $1A : AND.b #$10 : BNE .skip_draw
.is_crystal
JSR.w WorldMapIcon_AdjustCoordinate
.dont_adjust
JSR.w WorldMap_CalculateOAMCoordinates
BCC .skip_draw
PLX : PHX : TXA : ASL A : TAX
LDA.l WorldMapIcon_tile+1, X : BEQ .is_red_x
LDA.l MapCompassFlag : CMP.b #$01 : BEQ .is_red_x
LDA.l WorldMapIcon_tile+1, X : STA.b $0D
LDA.l WorldMapIcon_tile, X : STA.b $0C
LDA.b #$02 : BRA .continue
.is_red_x
LDA.b $1A : LSR #3 : AND.b #$03 : TAX
LDA.l WorldMap_RedXChars,X : STA.b $0D
LDA.b #$32 : STA.b $0C : LDA.b #$00
.continue
STA.b $0B
PLX : PHX
INX : JSR.w WorldMap_HandleSpriteBlink
.skip_draw
; end of loop
PLX : CPX #12 : BCS + : JMP .loopStart : +
PLA : STA.l $7EC10B
PLA : STA.l $7EC10A
PLA : STA.l $7EC109
PLA : STA.l $7EC108
RTS
; X - the index of the prize marker
OverworldMap_CheckForPrize:
PHX
LDA #$00 : STA.l MapCompassFlag
JSR OverworldMap_CheckForCompass
BCC +
LDA.l MapCompassFlag : ORA #$01 : STA.l MapCompassFlag
LDA CurrentWorld : AND #$40 : BNE ++ ; is the compass position on LW or DW?
LDA.l WorldCompassMask, X : BEQ + : JMP .fail
++ LDA.l WorldCompassMask, X : BNE + : JMP .fail
+ JSR OverworldMap_CheckForMap
BCC +
LDA.l MapCompassFlag : ORA #$02 : STA.l MapCompassFlag
+
LDA.l MapCompassFlag : BEQ .fail
CMP #$02 : BNE .checkIfObtained
LDA CurrentWorld : AND #$40 : BNE +
CPX #3 : BCS .fail : BRA .checkIfObtained
+ CPX #10 : BCS .fail
CPX #3 : BCC .fail
.checkIfObtained
LDA.l MC_DungeonIdsForPrize, X
BPL +++ : CLC : BRA .done : +++ ; non-prize flags
CMP.b #$03 : BCC .hyrule_castle
ASL : TAX
REP #$20
LDA.l DungeonsCompleted : AND.l DungeonItemMasks,X : BNE .fail
CLC : BRA .done
; see if hyrule castle has been completely cleared
.hyrule_castle
LDA.l CompassTotalsWRAM, X : SEC : SBC DungeonLocationsChecked, X : BEQ .fail
CLC : BRA .done
.fail
SEC
.done
SEP #$20
PLX
RTS
; X - which compass in question
; CLC - should not move indicator
; SEC - yep indicator can move
OverworldMap_CheckForCompass:
LDA.l CompassMode : AND #$80 : BEQ .unset ; should I check for compass logic
LDA.l CompassMode : AND #$40 : BEQ .set ; compasses/maps aren't shuffled
LDA.l CompassMode : AND #$20 : BNE +
JSR OverworldMap_CheckForMap : BCC .unset : BRA .set
+ LDA.l CompassExists, X : BEQ .set ; compass doesn't exist
PHX
LDA.l MC_SRAM_Offsets, X : TAX ; put compass offset into X
LDA CompassField, X : ORA MapOverlay, X
PLX
AND.l MC_Masks, X : BNE .set ; is the compass obtained
.unset
CLC
RTS
.set
SEC
RTS
; map - which map in question
; CLC - should not show exact prize
; SEC - yep should show exact prize
OverworldMap_CheckForMap:
LDA.l MapMode : BEQ .set ; obtaining map doesn't change anything
LDA CurrentWorld : AND #$40 : BNE + ; not really sure on this check
LDA MapField : ORA MapOverlay : AND.b #$01 : BNE .set : BRA .continue
+ LDA MapField : ORA MapOverlay : AND.b #$02 : BNE .set
.continue
PHX
LDA.l MC_SRAM_Offsets, X : TAX ; put map offset into X
LDA MapField, X : ORA MapOverlay, X
PLX
AND.l MC_Masks, X : BNE .set ; is the map obtained?
.unset
CLC
RTS
.set
SEC
RTS
pullpc

View File

@@ -51,70 +51,6 @@ GetCrystalNumber:
PLX
RTL
;================================================================================
OverworldMap_CheckObject:
PHX
;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail
LDA.l CurrentWorld : AND.b #$40 : BNE +
;LW Map
LDA.l MapMode : BEQ +++
LDA.l MapField : ORA.l MapOverlay : AND.b #$01 : BNE +++
PHX
LDA.l .lw_map_offsets, X : TAX ; put map offset into X
LDA.l MapField, X : ORA.l MapOverlay, X
PLX
AND.l .lw_map_masks, X : BNE +++
JMP .fail
+++
LDA.l .lw_offsets, X
BPL +++ : CLC : BRA .done : +++ ; don't display master sword
TAX : BRA ++
+
;DW Map
LDA.l MapMode : BEQ +++
LDA.l MapField : ORA.l MapOverlay : AND.b #$02 : BNE +++
PHX
LDA.l .dw_map_offsets, X : TAX ; put map offset into X
LDA.l MapField, X : ORA.l MapOverlay, X
PLX
AND.l .dw_map_masks, X : BNE +++
JMP .fail
+++
LDA.l .dw_offsets, X
TAX : BRA ++
SEC
PLX
RTL
++
LDA.l CrystalPendantFlags_2, X
AND.b #$40 : BNE .checkCrystal
.checkPendant
LDA.l PendantsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.checkCrystal
LDA.l CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.fail
SEC
.done
PLX
RTL
.lw_offsets
db $02, $0A, $03, $FF
.dw_offsets
db $06, $08, $0C, $0B, $07, $09, $05
.lw_map_offsets
db $01, $00, $01
; pod skull trock thieves mire ice swamp
.dw_map_offsets
db $01, $00, $00, $00, $01, $00, $01
.lw_map_masks
db $20, $20, $10, $00
.dw_map_masks
db $02, $80, $08, $10, $01, $40, $04
;================================================================================
SetLWDWMap:
PHP
SEP #$20 ; set 8-bit accumulator

31
ram.asm
View File

@@ -48,6 +48,8 @@ NMIHUD = $7E0016 ; during NMI.
NMIINCR = $7E0017 ;
NMIUP1100 = $7E0018 ;
UPINCVH = $7E0019 ; Incremental upload VRAM high byte
LinkAbsoluteY = $7E0020 ; Link's absolute coordinates. Word length
LinkAbsoluteX = $7E0022 ;
FrameCounter = $7E001A ; Increments every frame that the game isn't lagging
IndoorsFlag = $7E001B ; $00 = Outdoors | $01 = Indoors
MAINDESQ = $7E001C ; PPU register queues written during NMI
@@ -186,8 +188,12 @@ RaceGameFlag = $7E021B ;
;
MessageJunk = $7E0223 ; Zeroed but never used (?)
;
;CoolScratch = $7E0224 ; 0x5C bytes of free ram
SpriteID = $7E0230 ;
ShopPurchaseFlag = $7E0224 ; $01 = Shop purchase item receipt.
;CoolScratch = $7E0226 ; 0x5A bytes of free ram
SpriteID = $7E0230 ; 0x0A bytes
;
AncillaVelocityZ = $7E0294 ; 0x0A bytes
AncillaZCoord = $7E029E ; 0x0A bytes
;
ItemReceiptID = $7E02D8 ;
ItemReceiptPose = $7E02DA ; $00 = No pose | $01 = One hand up | $02 = Two hands up
@@ -196,7 +202,7 @@ BunnyFlag = $7E02E0 ; $00 = Link | $01 = Bunny
Poofing = $7E02E1 ; Flags cape and bunny poof.
PoofTimer = $7E02E2 ; Countdown timer for poofing.
SwordCooldown = $7E02E3 ; Cooldown for sword after dashing through an enemy.
CutsceneFlag = $7E02E4 ; Flags various cutscenes. All non-zero behave the same.
CutsceneFlag = $7E02E4 ; Flags various cutscenes.
;
ItemReceiptMethod = $7E02E9 ;
;
@@ -233,7 +239,7 @@ FluteTimer = $7E03F0 ; Countdown timer for being able to use the fl
;
YButtonOverride = $7E03FC ; Y override for minigames. $00 = Selected item | $01 = Shovel | $02 = Bow
;
ItemsTaken = $7E0403 ; Items taken in a room: b k u t s e h c
RoomItemsTaken = $7E0403 ; Items taken in a room: b k u t s e h c
; b = boss kill/item | k = key/heart piece (prevents crystals)
; u = 2nd key/heart piece | t = chest 4/rupees/swamp drain/bomb floor/mire wall
; s = chest 3/pod or dp wall | e, h, c = chest 2, 1, 0
@@ -295,6 +301,11 @@ SaveFileIndex = $7E0B9D ;
;
SpriteAncillaInteract = $7E0BA0 ; If nonzero, ancillae do not interact with the sprite. $10 bytes.
;
AncillaCoordYLow = $7E0BFA ;
AncillaCoordXLow = $7E0C04 ;
AncillaCoordYHigh = $7E0C0E ;
AncillaCoordXHigh = $7E0C18 ;
;
AncillaVelocityY = $7E0C22 ; $0A bytes.
AncillaVelocityX = $7E0C2C ; $0A bytes.
;
@@ -302,6 +313,8 @@ AncillaID = $7E0C4A ; $0A bytes.
;
AncillaGet = $7E0C5E ; Used by varius ancilla in various ways. $0F bytes.
;
AncillaLayer = $7E0C7C ;
;
SpriteBump = $7E0CD2 ; See symbols_wram.asm. $10 bytes.
;
TreePullKills = $7E0CFB ; Kills for tree pulls.
@@ -349,6 +362,8 @@ SpriteZCoord = $7E0F70 ;
SpriteVelocityZ = $7E0F80 ;
SpriteSubPixelZ = $7E0F90 ;
;
CurrentSpriteSlot = $7E0FA0 ; Holds the current sprite/ancilla's index
;
FreezeSprites = $7E0FC1 ; "Seems to freeze sprites"
;
PrizePackIndexes = $7E0FC7 ; $07 bytes. One for each prize pack.
@@ -572,7 +587,8 @@ CompassTotalsWRAM: skip $10 ; \ Compass and map dungeon HUD display total
MapTotalsWRAM: skip $10 ; / on boot for tracking.
skip $30 ; Reserved for general dungeon tracking data. May have over
; allocated here. Feel free to reassign.
skip $40 ; Unused
MapCompassFlag: skip 2 ; Used to flag overworld map drawing.
skip $3E ; Unused
skip $260 ; Unused
DialogBuffer: skip $100 ; Dialog Buffer
;
@@ -730,7 +746,7 @@ endmacro
%assertRAM(ForceSwordUp, $7E03EF)
%assertRAM(FluteTimer, $7E03F0)
%assertRAM(YButtonOverride, $7E03FC)
%assertRAM(ItemsTaken, $7E0403)
%assertRAM(RoomItemsTaken, $7E0403)
%assertRAM(DungeonID, $7E040C)
%assertRAM(LayerAdjustment, $7E047A)
%assertRAM(RoomIndexMirror, $7E048E)
@@ -768,6 +784,7 @@ endmacro
%assertRAM(AncillaVelocityX, $7E0C2C)
%assertRAM(AncillaID, $7E0C4A)
%assertRAM(AncillaGet, $7E0C5E)
%assertRAM(AncillaLayer, $7E0C7C)
%assertRAM(SpriteBump, $7E0CD2)
%assertRAM(SpritePosYLow, $7E0D00)
%assertRAM(SpritePosXLow, $7E0D10)
@@ -826,6 +843,7 @@ endmacro
%assertRAM(SpriteZCoord, $7E0F70)
%assertRAM(SpriteVelocityZ, $7E0F80)
%assertRAM(SpriteSubPixelZ, $7E0F90)
%assertRAM(CurrentSpriteSlot, $7E0FA0)
%assertRAM(FreezeSprites, $7E0FC1)
%assertRAM(PrizePackIndexes, $7E0FC7)
%assertRAM(SpriteCoordCacheX, $7E0FD8)
@@ -945,6 +963,7 @@ endmacro
%assertRAM(TxStatus, $7F53FF)
%assertRAM(CompassTotalsWRAM, $7F5410)
%assertRAM(MapTotalsWRAM, $7F5420)
%assertRAM(MapCompassFlag, $7F5460)
%assertRAM(DialogBuffer, $7F5700)
%assertRAM(MiniGameTime, $7FFE00)
%assertRAM(MiniGameTimeFinal, $7FFE04)

View File

@@ -21,7 +21,7 @@ RigChestRNG:
RTL
.forceHeart
LDA.b #$33 : STA.b ScrapBufferBD+$0B ; assure the correct state if player talked to shopkeeper
LDA.w ItemsTaken : AND.b #$40 : BNE .notHeart
LDA.w RoomItemsTaken : AND.b #$40 : BNE .notHeart
LDA.b #$07 ; give prize item
RTL
.notHeart

View File

@@ -350,59 +350,59 @@ Shopkeeper_SetupHitboxes:
RTS
Shopkeeper_BuyItem:
PHX : PHY
TYX
PHX : PHY
TYX
LDA.l ShopInventory, X
CMP.b #$0E : BEQ .refill ; Bee Refill
CMP.b #$2E : BEQ .refill ; Red Potion Refill
CMP.b #$2F : BEQ .refill ; Green Potion Refill
CMP.b #$30 : BEQ .refill ; Blue Potion Refill
BRA +
.refill
JSL.l Sprite_GetEmptyBottleIndex : BMI .full_bottles
+
LDA.l ShopInventory, X
CMP.b #$0E : BEQ .refill ; Bee Refill
CMP.b #$2E : BEQ .refill ; Red Potion Refill
CMP.b #$2F : BEQ .refill ; Green Potion Refill
CMP.b #$30 : BEQ .refill ; Blue Potion Refill
BRA +
.refill
JSL.l Sprite_GetEmptyBottleIndex : BMI .full_bottles
+
LDA.l ShopType : AND.b #$80 : BNE .buy ; don't charge if this is a take-any
REP #$20 : LDA.l CurrentRupees : CMP.l ShopInventory+1, X : SEP #$20 : !BGE .buy
LDA.l ShopType : AND.b #$80 : BNE .buy ; don't charge if this is a take-any
REP #$20 : LDA.l CurrentRupees : CMP.l ShopInventory+1, X : SEP #$20 : !BGE .buy
.cant_afford
LDA.b #$7A
LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional
LDA.b #$3C : STA.w SFX2 ; error sound
JMP .done
.full_bottles
LDA.b #$6B
LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional
LDA.b #$3C : STA.w SFX2 ; error sound
JMP .done
.buy
LDA.l ShopType : AND.b #$80 : BNE ++ ; don't charge if this is a take-any
REP #$20 : LDA.l CurrentRupees : !SUB ShopInventory+1, X : STA.l CurrentRupees : SEP #$20 ; Take price away
++
LDA.l ShopInventory, X : TAY : JSL.l Link_ReceiveItem
LDA.l ShopInventory+3, X : INC : STA.l ShopInventory+3, X
.cant_afford
LDA.b #$7A
LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional
LDA.b #$3C : STA.w SFX2 ; error sound
JMP .done
.full_bottles
LDA.b #$6B : LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional
LDA.b #$3C : STA.w SFX2 ; error sound
JMP .done
.buy
LDA.l ShopType : AND.b #$80 : BNE ++ ; don't charge if this is a take-any
REP #$20 : LDA.l CurrentRupees : !SUB ShopInventory+1, X : STA.l CurrentRupees : SEP #$20 ; Take price away
++
INC.w ShopPurchaseFlag
LDA.l ShopInventory, X : TAY : JSL.l Link_ReceiveItem
LDA.l ShopInventory+3, X : INC : STA.l ShopInventory+3, X
TXA : LSR #2 : TAX
LDA.l ShopType : BIT.b #$80 : BNE +
LDA.l ShopState : ORA.w Shopkeeper_ItemMasks, X : STA.l ShopState
PHX
TXA : !ADD ShopSRAMIndex : TAX
LDA.l PurchaseCounts, X : INC : BEQ +++ : STA.l PurchaseCounts, X : +++
PLX
BRA ++
+ ; Take-any
BIT.b #$20 : BNE .takeAll
.takeAny
LDA.l ShopState : ORA.b #$07 : STA.l ShopState
PHX : LDA.l ShopSRAMIndex : TAX : LDA.b #$01 : STA.l PurchaseCounts, X : PLX
BRA ++
.takeAll
LDA.l ShopState : ORA.w Shopkeeper_ItemMasks, X : STA.l ShopState
PHX : LDA.l ShopSRAMIndex : TAX : LDA.l ShopState : STA.l PurchaseCounts, X : PLX
++
TXA : LSR #2 : TAX
LDA.l ShopType : BIT.b #$80 : BNE +
LDA.l ShopState : ORA.w Shopkeeper_ItemMasks, X : STA.l ShopState
PHX
TXA : !ADD ShopSRAMIndex : TAX
LDA.l PurchaseCounts, X : INC : BEQ +++ : STA.l PurchaseCounts, X : +++
PLX
BRA ++
+ ; Take-any
BIT.b #$20 : BNE .takeAll
.takeAny
LDA.l ShopState : ORA.b #$07 : STA.l ShopState
PHX : LDA.l ShopSRAMIndex : TAX : LDA.b #$01 : STA.l PurchaseCounts, X : PLX
BRA ++
.takeAll
LDA.l ShopState : ORA.w Shopkeeper_ItemMasks, X : STA.l ShopState
PHX : LDA.l ShopSRAMIndex : TAX : LDA.l ShopState : STA.l PurchaseCounts, X : PLX
++
.done
PLY : PLX
RTS

View File

@@ -115,53 +115,56 @@ DecrementSmallKeys:
JSL.l UpdateKeys
RTL
;--------------------------------------------------------------------------------
CountChestKeyLong: ; called from ItemDowngradeFix in itemdowngrade.asm
JSR CountChestKey
CountChestKeyLong:
JSR.w CountChestKey
RTL
;--------------------------------------------------------------------------------
CountChestKey: ; called by neighbor functions
CountChestKey:
PHA : PHX
CPY.b #$24 : BEQ + ; small key for this dungeon - use DungeonID
CPY.b #$A0 : !BLT .end ; Ignore most items
CPY.b #$AE : !BGE .end ; Ignore reserved key and generic key
TYA : AND.B #$0F
TAX : BRA .count ; use Key id instead of DungeonID (Keysanity)
+
LDA.w DungeonID : LSR : TAX
.count
LDA.l DungeonCollectedKeys, X : INC : STA.l DungeonCollectedKeys, X
LDA.l StatsLocked : BNE .done
CPY.b #$24 : BEQ .this_dungeon
TYA
AND.b #$0F : CMP.b #$02 : BCC .hc_sewers
TAX
LDA.l DungeonCollectedKeys,X : INC : STA.l DungeonCollectedKeys
BRA .done
.this_dungeon
LDA.w DungeonID : CMP.b #$03 : BCC .hc_sewers
LSR : TAX
LDA.l DungeonCollectedKeys,X : INC : STA.l DungeonCollectedKeys,X
BRA .done
CPX.b #$00 : BNE +
STA.l HCCollectedKeys ; copy HC to sewers
+
CPX.b #$01 : BNE +
STA.l SewerCollectedKeys ; copy sewers to HC
+
.end
.hc_sewers
LDA.l SewerCollectedKeys : INC
STA.l SewerCollectedKeys : STA.l HCCollectedKeys
.done
PLX : PLA
RTS
;--------------------------------------------------------------------------------
CountBonkItem: ; called from GetBonkItem in bookofmudora.asm
LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP.b #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert : BRA ++
+ : CMP.b #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower : BRA ++
+ LDA.b #$24 ; default to small key
++
CMP.b #$24 : BNE +
PHY
TAY : JSR CountChestKey
PLY
+
LDA.b RoomIndex
CMP.b #115 : BNE +
LDA.l BonkKey_Desert
BRA ++
+
CMP.b #140 : BNE +
LDA.l BonkKey_GTower : BRA ++
+
LDA.b #$24
++
CMP.b #$24 : BNE +
PHY
TAY
JSR CountChestKey
PLY
+
RTL
;--------------------------------------------------------------------------------
IncrementAgahnim2Sword:
PHA
LDA.l StatsLocked : BNE +
JSL.l IncrementBossSword
+
PLA
PHA
JSL.l IncrementBossSword
PLA
RTL
;--------------------------------------------------------------------------------
IncrementDeathCounter:

View File

@@ -129,6 +129,7 @@ MapMode:
db $00 ; #$00 = Always On (default) - #$01 = Require Map Item
CompassMode:
db $00 ; #$00 = Off (default) - #$01 = Display Dungeon Count w/Compass - #$02 = Display Dungeon Count Always
; #$80 = Move prizes to custom postion - #$40 = Compasses are shuffled and must be obtained to show position if bit on
;--------------------------------------------------------------------------------
org $B0803D ; PC 0x18003D
PersistentFloodgate:
@@ -229,7 +230,7 @@ db $01 ; #$00 = Off - #$01 = On (default)
;--------------------------------------------------------------------------------
org $B08050 ; PC 0x180050 - 0x18005C
CrystalPendantFlags_2:
db $00 ; Sewers
db $02 ; Ganons Tower - because 5D is not available right now - sewers doesn't get one
db $00 ; Hyrule Castle
db $00 ; Eastern Palace
db $00 ; Desert Palace
@@ -245,6 +246,9 @@ CrystalPendantFlags_2:
db $40 ; Turtle Rock
;Pendant: $00
;Crystal: $40
;No Icon: $80
;Aga1: $01
;Aga2: $02
;--------------------------------------------------------------------------------
org $B0805E ; PC 0x18005E - Number of crystals required to enter GT
NumberOfCrystalsRequiredForTower:
@@ -275,20 +279,20 @@ dl $000000
;--------------------------------------------------------------------------------
org $B08070 ; PC 0x180070 - 0x18007F
CrystalNumberTable:
db $00 ;
db $69 ; Eastern
db $69 ; Hera
db $69 ; Desert
db $7F ; Darkness
db $6C ; Skull
db $7C ; TRock
db $6D ; Thieves
db $6F ; Mire
db $6E ; Ice
db $79 ; Swamp
db $00 ;
db $6E ; Ice
db $00 ;
db $6F ; Mire
db $00 ;
db $6D ; Thieves
db $69 ; Desert
db $7C ; TRock
db $69 ; Hera
db $6C ; Skull
db $69 ; Eastern
db $7F ; Darkness
db $00 ;
db $00 ;
db $00 ;
@@ -588,7 +592,7 @@ dw $0100 ; #$6234 - Master Sword
org $8ABEF8 ; PC 0x53EF8
MapObject_Eastern:
dw $6038 ; #$6038 - Green Pendant / Courage
dw $6238 ; #$6038 - Green Pendant / Courage
org $8ABF1C ; PC 0x53F1C
MapObject_Desert:
@@ -658,6 +662,7 @@ CrystalPendantFlags:
;Dungeons with no drops should match their respective world's normal vanilla prize ;xxx
;--------------------------------------------------------------------------------
org $81C6FC ; PC 0xC6FC - Bank01.asm:10344 - (db $00, $00, $01, $02, $00, $06, $06, $06, $06, $06, $03, $06, $06)
DungeonPrizeReceiptID:
db $00 ; Sewers
db $00 ; Hyrule Castle
db $01 ; Eastern Palace
@@ -665,8 +670,8 @@ org $81C6FC ; PC 0xC6FC - Bank01.asm:10344 - (db $00, $00, $01, $02, $00, $06, $
db $00 ; Agahnim's Tower
db $06 ; Swamp Palace
db $06 ; Palace of Darkness
db $06 ; Misery Mire
db $06 ; Skull Woods
db $20 ; Misery Mire
db $20 ; Skull Woods
db $06 ; Ice Palace
db $03 ; Tower of Hera
db $06 ; Thieves' Town
@@ -815,7 +820,8 @@ db $01 ; #00 = Never Locked - #$01 = Locked During Escape (default) - #$02 = Loc
org $B0816A ; PC 0x18016A
FreeItemText:
db $00 ; #00 = Off (default)
;---o bmcs
;--po bmcs
;p - enabled for non-prize crystals
;o - enabled for outside dungeon items
;b - enabled for inside big key items
;m - enabled for inside map items
@@ -2575,9 +2581,139 @@ db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $0
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Overworld Map Tables
;--------------------------------------------------------------------------------
org $8ABDF6
WorldMapIcon_posx_vanilla:
dw $0F31 ; prize1
dw $08D0 ; prize2
dw $0108
dw $0F40
dw $0082
dw $0F11
dw $01D0
dw $0100
dw $0CA0
dw $0759
dw $FF00
dw $FF00
dw $FF00
dw $FFFF ; reserved - not used
dw $FFFF
dw $FFFF
org $8ABE16
WorldMapIcon_posy_vanilla:
dw $0620 ; prize1
dw $0080 ; prize2
dw $0D70
dw $0620
dw $00B0
dw $0103
dw $0780
dw $0CA0
dw $0DA0
dw $0ED0
dw $FF00
dw $FF00
dw $FF00
dw $FFFF ; reserved - not used
dw $FFFF
dw $FFFF
org $8ABE36
WorldMapIcon_posx_located:
dw $FF00 ; prize1
dw $FF00 ; prize2
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FFFF ; reserved - not used
dw $FFFF
dw $FFFF
org $8ABE56
WorldMapIcon_posy_located:
dw $FF00 ; prize1
dw $FF00 ; prize2
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FFFF ; reserved - not used
dw $FFFF
dw $FFFF
org $8ABE76
WorldMapIcon_tile:
db $38, $62 ; green pendant
db $32, $60 ; red pendant
db $34, $60 ; blue pendant
db $34, $64 ; crystal
db $34, $64 ; crystal
db $34, $64 ; crystal
db $34, $64 ; crystal
db $32, $64 ; crystal
db $32, $64 ; crystal
db $34, $64 ; crystal
db $32, $66 ; skull looking thing
db $00, $00 ; red x
db $00, $00 ; red x
db $00, $00 ; unused red x's
db $00, $00
db $00, $00
org $8ABE96
CompassExists:
; dw $37FC ; todo: convert to two bytes with masks? so much extra code...
; eastern hera desert pod skull trock thieves mire ice swamp gt at escape
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00
; 0 = light world, 1 = dark world
org $8ABEA6
WorldCompassMask:
; eastern desert hera pod skull trock thieves mire ice swamp gt at escape x1 x2 x3
db $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00
; eastern desert hera pod skull trock thieves mire ice swamp gt at escape
MC_DungeonIdsForPrize:
db $02, $0A, $03, $06, $08, $0C, $0B, $07, $09, $05, $00, $04, $01
MC_SRAM_Offsets:
db $01, $00, $01, $01, $00, $00, $00, $01, $00, $01, $00, $01, $01
MC_Masks:
; EP TH DP PD SK TR TT MM
db $20, $20, $10, $02, $80, $08, $10, $01, $40, $04, $04, $08, $40

View File

@@ -93,7 +93,6 @@ LoadDynamicTileOAMTable:
PLX
PLP
RTS
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; DrawDynamicTile
@@ -334,13 +333,21 @@ RTL
;------------------------------------------------------------------------------
CheckReceivedItemPropertiesBeforeLoad:
LDA.b RoomIndex : BEQ .normalCode
LDA.l RoomFade : BNE .load_palette
LDA.l SpriteProperties_chest_palette,X : BIT #$80 : BNE .load_palette
.normalCode
RTL
.load_palette
JSL.l LoadItemPalette
PHX
LDX.w CurrentSpriteSlot
LDA.w AncillaID,X : CMP.b #$29 : BEQ .falling_sprite
PLX
LDA.b RoomIndex : BEQ .normalCode
LDA.l RoomFade : BNE .load_palette
.normalCode
LDA.l SpriteProperties_chest_palette,X : BIT #$80 : BNE .load_palette
RTL
.load_palette
JSL.l LoadItemPalette
RTL
.falling_sprite
PLX
LDA.l SpriteProperties_standing_palette,X : BIT #$80 : BNE .load_palette
RTL
;------------------------------------------------------------------------------
@@ -380,3 +387,16 @@ TransferVRAMStripes:
JSL.l DoDungeonMapBossIcon
LDA.b NMISTRIPES : CMP.b #$01 ; What we wrote over
RTL
ItemReceiptWidthCheck:
PHX
LDX.w CurrentSpriteSlot
LDA.w AncillaID,X : CMP.b #$29 : BEQ .falling_sprite
PLX
LDA.l SpriteProperties_chest_width, X
RTL
.falling_sprite
PLX
LDA.l SpriteProperties_standing_width, X
RTL

View File

@@ -28,6 +28,7 @@ LoadSelectScreenGfx = $80E529
PrepDungeonExit = $80F945
Mirror_InitHdmaSettings = $80FDEE
Dungeon_LoadRoom = $81873A
Underworld_HandleRoomTags = $81C2FD
Module_PreDungeon = $82821E
Module_PreDungeon_setAmbientSfx = $828296
Dungeon_SaveRoomData = $82A0A8
@@ -36,7 +37,7 @@ Dungeon_SaveRoomQuadrantData = $82B861
LoadGearPalettes_bunny = $82FD8A
LoadGearPalettes_variable = $82FD95
Filter_Majorly_Whiten_Color = $82FEAB
Sprite_SpawnFallingItem = $85A51D
Ancilla_SpawnFallingPrize = $85A51D
Sprite_DrawMultiple = $85DF6C
Sprite_DrawMultiple_quantity_preset = $85DF70
Sprite_DrawMultiple_player_deferred = $85DF75
@@ -44,8 +45,10 @@ Sprite_ShowSolicitedMessageIfPlayerFacing = $85E1A7
Sprite_ShowMessageFromPlayerContact = $85E1F0
Sprite_ShowMessageUnconditional = $85E219
Sprite_ZeldaLong = $85EC96
Sprite_EA_HeartContainer = $85EF3F
Sprite_EB_HeartPiece_handle_flags = $85F0C0
Player_ApplyRumbleToSprites = $8680FA
Sprite_Main = $868328
Utility_CheckIfHitBoxesOverlapLong = $8683E6
Sprite_PrepAndDrawSingleLargeLong = $86DBF8
Sprite_PrepAndDrawSingleSmallLong = $86DC00
@@ -58,13 +61,16 @@ OAM_AllocateDeferToPlayerLong = $86F86A
Player_HaltDashAttackLong = $8791B3
Link_ReceiveItem = $87999D
Sprite_CheckIfPlayerPreoccupied = $87F4AA
Ancilla_Main = $888242
Ancilla_ReceiveItem = $88C3AE
Ancilla_BreakTowerSeal_draw_single_crystal = $88CE93
Ancilla_BreakTowerSeal_stop_spawning_sparkles = $88CEC3
BreakTowerSeal_ExecuteSparkles = $88CF59
Ancilla_SetOam_XY_Long = $88F710
AddReceivedItem = $8985E2
AddPendantOrCrystal = $898BAD
AncillaAdd_ItemReceipt_not_crystal = $898605
AncillaAdd_FallingPrize = $898BAD
AncillaAdd_FallingPrize_not_medallion = $898BD6
AddWeathervaneExplosion = $898CFD
AddDashTremor = $8993DF
AddAncillaLong = $899D04
@@ -114,13 +120,31 @@ Sprite_SpawnDynamically = $9DF65D
Sprite_SpawnDynamically_arbitrary = $9DF65F
DiggingGameGuy_AttemptPrizeSpawn = $9DFD4B
Sprite_GetEmptyBottleIndex = $9EDE28
CrystalCutscene_Initialize_skip_palette = $9ECD39
Sprite_PlayerCantPassThrough = $9EF4E7
;===================================================================================================
; Local routines (use JSR)
;===================================================================================================
RoomTag_PrizeTriggerDoor_open = $81C529
RoomTag_PrizeTriggerDoor_exit = $81C529
RoomTag_GetHeartForPrize = $81C709
RoomTag_GetHeartForPrize_spawn_prize = $81C731
RoomTag_GetHeartForPrize_delete_tag = $81C749
Chicken_SpawnAvengerChicken = $86A7DB
Link_PerformOpenChest_no_replacement = $87B59F
Sprite_EA_HeartContainer_main = $85EF47
Ancilla_ExecuteAll = $88832B
Ancilla_ExecuteOne = $88833C
Ancilla22_ItemReceipt_is_pendant = $88C421
Ancilla22_ItemReceipt_wait_for_music = $88C42B
ItemReceipt_Animate_continue = $88C637
AncillaDraw_ItemReceipt = $88C6B4
Ancilla29_MilestoneItemReceipt = $88CAB0
Ancilla29_MilestoneItemReceipt_skip_crystal_sfx = $88CAE5
Ancilla29_MilestoneItemReceipt_no_sparkle = $88CB2E
Ancilla_SetOAM_XY = $88F6F3
Ancilla_AddAncilla = $899CCE
DrawProgressIcons = $8DE9C8
ItemMenu_DrawEquippedYItem = $8DEB3A
ItemMenu_DrawEquippedYItem_exit = $8DECE6
@@ -130,11 +154,19 @@ DrawEquipment = $8DED29
;===================================================================================================
; Palettes
;===================================================================================================
PalettesVanillaBank = $9B0000
PalettesVanilla_none = $9B0000
PalettesVanilla_red_melon = $9BD218
PalettesVanilla_blue_ice = $9BD236
PalettesVanilla_green_blue_guard = $9BD272
PalettesVanilla_dark_world_melon = $9BD290
PalettesVanilla_blue_dark_ice = $9BD2BC
PalettesVanilla_spraux09 = $9BD47E
PalettesVanillaBank = $9B0000
PalettesVanilla_none = $9B0000
PalettesVanilla_red_melon = $9BD218
PalettesVanilla_blue_ice = $9BD236
PalettesVanilla_green_blue_guard = $9BD272
PalettesVanilla_dark_world_melon = $9BD290
PalettesVanilla_blue_dark_ice = $9BD2BC
PalettesVanilla_spraux09 = $9BD47E
;===================================================================================================
; Misc. Data
;===================================================================================================
WorldMapIcon_AdjustCoordinate = $8AC59B
WorldMap_CalculateOAMCoordinates = $8AC3B1
WorldMap_HandleSpriteBlink = $8AC52E
WorldMap_RedXChars = $8ABF70