Applied labels and byte designators

This commit is contained in:
codemann8
2024-04-05 20:50:04 -05:00
committed by aerinon
parent 2e2b493240
commit a70251d2b2
114 changed files with 2786 additions and 2970 deletions

View File

@@ -383,39 +383,3 @@ org $80D25B ; 0x525B - HUD Main L
db GFX_HUD_Main
;================================================================================
org $828AD9
Underworld_SetBossOrSancMusicUponEntry:
org $02C11D
CalculateTransitionLanding:
org $02D9B9
Underworld_LoadSpawnEntrance:
org $08C505
Ancilla_ReceiveItem_objectFinished:
org $08CE2E
GTCutscene_AnimateCrystals_NoRotate:
org $08CEB6
GTCutscene_DrawSingleCrystal_SkipCrystal:
org $08CEC3
GTCutscene_DrawSingleCrystal_SkipSparkle:
org $08CF59
GTCutscene_SparkleALot:
org $098605
AddReceivedItem_notCrystal:
org $098766
AddReceivedItem_gfxHandling:
org $8AE817
DungeonMapBossRooms:

View File

@@ -153,7 +153,7 @@ RestoreBgEther:
INX #2 : CPX.b #$10 : BNE -
BRA ++
++
JML $82FF51 ; Bank0E.asm : 3936 vanilla restore routine after loop which RTLs
JML Palette_RestoreFixedColor-7 ; Bank0E.asm : 3936 vanilla restore routine after loop which RTLs
;================================================================================
DDMConditionalLightning:
LDA.l DisableFlashing
@@ -161,7 +161,7 @@ DDMConditionalLightning:
BNE +
LDA.w Scrap
LDX.b #$02
JML $87FA7F ; Bank0E.asm : 4738 vanilla loop equivalent to below beginning at LDY #$00
JML FlashGanonTowerPalette_next_thunder-2 ; Bank0E.asm : 4738 vanilla loop equivalent to below beginning at LDY #$00
+
LDA.b Scrap00 : LDX.b #$02 : LDY.b #$00
-
@@ -172,7 +172,7 @@ DDMConditionalLightning:
LDA.w $F523, Y : LDA.l PaletteBuffer+$F0, X
INY #2
INX #2 : CPX.b #$10 : BNE -
JML $87FAAC ; Bank0E.asm : 4754 both branches converge here
JML FlashGanonTowerPalette_bright_white ; Bank0E.asm : 4754 both branches converge here
;================================================================================
ConditionalGTFlash:
LDA.l DisableFlashing : REP #$20 : BNE +
@@ -222,17 +222,17 @@ LoadElectroPalette:
LDA.w #$0404 : STA.b Scrap0E
LDA.w #$001B : STA.b Scrap02
SEP #$10
LDX.b Scrap0C : LDA.l $9BEBB4, X : AND.w #$00FF : ADC.w #$D630
LDX.b Scrap0C : LDA.l SwordPaletteOffsets, X : AND.w #$00FF : ADC.w #$D630
REP #$10 : LDX.w #$01B2 : LDY.w #$0002
JSR ConditionalLoadGearPalette
SEP #$10
LDX.b Scrap0D
LDA.l $9BEBC1, X : AND.w #$00FF : ADC.w #$D648
LDA.l ShieldPaletteOffsets, X : AND.w #$00FF : ADC.w #$D648
REP #$10 : LDX.w #$01B8 : LDY.w #$0003
JSR ConditionalLoadGearPalette
SEP #$10
LDX.b Scrap0E
LDA.l $9BEC06, X : AND.w #$00FF : ASL A : ADC.w #$D308
LDA.l LinkMailPalettesOffsets, X : AND.w #$00FF : ASL A : ADC.w #$D308
REP #$10 : LDX.w #$01E2 : LDY.w #$000E
JSR ConditionalLoadGearPalette
SEP #$30

View File

@@ -4,22 +4,22 @@
LoadLibraryItemGFX:
LDA.l LibraryItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
JSL PrepDynamicTile_loot_resolved
RTL
;--------------------------------------------------------------------------------
DrawLibraryItemGFX:
PHA
LDA.w SpriteID, X
JSL.l DrawDynamicTile
JSL DrawDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
SetLibraryItem:
LDY.w SpriteID, X
JSL.l ItemSet_Library ; contains thing we wrote over
JSL ItemSet_Library ; contains thing we wrote over
RTL
;--------------------------------------------------------------------------------
@@ -31,13 +31,13 @@ LoadBonkItemGFX:
LDA.b #$08 : STA.w SpriteOAMProp, X ; thing we wrote over
LoadBonkItemGFX_inner:
LDA.b #$00 : STA.l RedrawFlag
JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteItemType, X
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w $0E80, X
STA.w SpriteID, X
JSL.l PrepDynamicTile
JSL PrepDynamicTile
PHA : PHX
LDA.w SpriteID,X : TAX
LDA.l SpriteProperties_standing_width,X : BNE +
@@ -49,37 +49,37 @@ RTL
DrawBonkItemGFX:
PHA
LDA.l RedrawFlag : BEQ .skipInit
JSL.l LoadBonkItemGFX_inner
JSL LoadBonkItemGFX_inner
BRA .done ; don't draw on the init frame
.skipInit
LDA.w SpriteID,X
JSL.l DrawDynamicTileNoShadow
JSL DrawDynamicTileNoShadow
.done
PLA
RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem
JSR.w AbsorbKeyCheck : BCC .notKey
JSR AbsorbKeyCheck : BCC .notKey
.key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key
PHY : LDY.b #$24 : JSL AddInventory : PLY ; do inventory processing for a small key
LDA.l CurrentSmallKeys : INC A : STA.l CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong
LDA.b #$2F : JSL Sound_SetSfx3PanLong
INC.w UpdateHUDFlag
RTL
.notKey
PHY : TAY : JSL.l Link_ReceiveItem : PLY
PHY : TAY : JSL Link_ReceiveItem : PLY
RTL
;--------------------------------------------------------------------------------
LoadBonkItem:
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
CMP.b #$73 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert
BRA ++
+ : CMP.b #140 : BNE + ; GTower Bonk Key
+ : CMP.b #$8C : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower
BRA ++
+
@@ -88,11 +88,11 @@ LoadBonkItem:
RTS
;--------------------------------------------------------------------------------
LoadBonkItem_Player:
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key
LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP.b #$73 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
+ : CMP.b #$8C : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player
BRA ++
+

View File

@@ -8,7 +8,7 @@ ModifyBoots:
+ : CMP.b #$02 : BNE +
PLA : AND.l AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA.l FakeBoots : CMP.b #$01 : BNE +
LDA.b LinkSlipping : BEQ ++ : LDA.b $59 : BNE + ; hover check
LDA.b LinkSlipping : BEQ ++ : LDA.b PitTileActField : BNE + ; hover check
++ : PLA : AND.l AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
+
PLA
@@ -17,15 +17,15 @@ RTL
;--------------------------------------------------------------------------------
AddBonkTremors:
PHA
LDA.b $46 : BNE + ; Check for incapacitated Link
JSL.l IncrementBonkCounter
LDA.b LinkIncapacitatedTimer : BNE + ; Check for incapacitated Link
JSL IncrementBonkCounter
+
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
PLA : RTL
+
PLA
JSL.l AddDashTremor : JSL.l Player_ApplyRumbleToSprites ; things we wrote over
JSL AddDashTremor : JSL Player_ApplyRumbleToSprites ; things we wrote over
RTL
;--------------------------------------------------------------------------------
BonkBreakableWall:
@@ -36,7 +36,7 @@ BonkBreakableWall:
PLP : PLX : LDA.w #$0000 : RTL
+
PLP : PLX
LDA.w $0372 : AND.w #$00FF ; things we wrote over
LDA.w LinkDashing : AND.w #$00FF ; things we wrote over
RTL
;--------------------------------------------------------------------------------
BonkRockPile:
@@ -51,10 +51,10 @@ GravestoneHook:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BEQ .done ; Check for Boots
+
LDA.w $0372 : BEQ .done ; things we wrote over
JML.l moveGravestone
LDA.w LinkDashing : BEQ .done ; things we wrote over
JML moveGravestone
.done
JML.l GravestoneHook_continue
JML GravestoneHook_continue
;--------------------------------------------------------------------------------
JumpDownLedge:
LDA.l BootsModifier : CMP.b #$01 : BEQ +

View File

@@ -51,7 +51,7 @@ DecideIfBunnyByScreenIndex:
LDA.b OverworldIndex : AND.b #$40 : PHA
LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
PLA : EOR.b #$40
BRA .done
.inverted
PLA
@@ -60,7 +60,7 @@ RTL
;--------------------------------------------------------------------------------
FixBunnyOnExitToLightWorld:
LDA.w BunnyFlag : BEQ +
JSL.l DecideIfBunny : BEQ +
JSL DecideIfBunny : BEQ +
STZ.b LinkState ; set player mode to Normal
STZ.w BunnyFlag : STZ.b BunnyFlagDP ; return player graphics to normal
+
@@ -183,7 +183,7 @@ RTL
;--------------------------------------------------------------------------------
; Fix pedestal pull overlay
PedestalPullOverlayFix:
LDA.b #$09 : STA.w AncillaGeneral, X ; the thing we wrote over
LDA.b #$09 : STA.w AncillaGeneralF, X ; the thing we wrote over
LDA.b IndoorsFlag : BNE +
LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b OverlayID : CMP.b #$97
@@ -235,7 +235,7 @@ ParadoxCaveGfxFix:
CPX.w #$1E00 : BEQ .uploadLine
.uploadLine
LDA.b #$01 : STA.w MDMAEN
LDA.b #$01 : STA.w DMAENABLE
.skipLine
RTL
@@ -246,7 +246,7 @@ ParadoxCaveGfxFix:
BRA .uploadLine
;--------------------------------------------------------------------------------
SetItemRiseTimer:
LDA.w ItemReceiptMethod : CMP #$01 : BNE .not_from_chest
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE .not_from_chest
LDA.b #$38 : STA.w AncillaTimer, X
RTL
.not_from_chest

View File

@@ -19,14 +19,14 @@ InvertDPad:
LDA.b #$80 : STA.w WRIO ; reset this so latch can read it, otherwise RNG breaks
JML.l InvertDPadReturn
JML InvertDPadReturn
.crowd_control
LDA.l ControllerInverter : BNE +
LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H : STA.b Scrap01
JML.l InvertDPadReturn
JML InvertDPadReturn
+ DEC : BEQ .dpadOnly
DEC : BEQ .buttonsOnly
@@ -40,7 +40,7 @@ InvertDPad:
BIT.w #$8400 : BEQ + : EOR.w #$8400 : + ; swap B/down
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
JML InvertDPadReturn
.invertBoth
REP #$20 ; set 16-bit accumulator
LDA.w JOY1L
@@ -50,7 +50,7 @@ JML.l InvertDPadReturn
BIT.w #$0300 : BEQ + : EOR.w #$0300 : + ; swap left/right
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
JML InvertDPadReturn
.buttonsOnly
REP #$20 ; set 16-bit accumulator
LDA.w JOY1L
@@ -58,14 +58,14 @@ JML.l InvertDPadReturn
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
JML InvertDPadReturn
.dpadOnly
LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H
BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA.b Scrap01
JML.l InvertDPadReturn
JML InvertDPadReturn
.onemind_controller_offset
db 0 ; player 0 - JOY1L - joy1d1
@@ -75,8 +75,6 @@ JML.l InvertDPadReturn
db 2 ; player 4 - JOY2L - joy2d1
db 6 ; player 5 - JOY4L - joy2d2
;--------------------------------------------------------------------------------
HandleOneMindController:
@@ -119,5 +117,5 @@ HandleOneMindController:
.no_onemind
STZ.b NMIDoneFlag
JML $808034 ; reset frame loop
JML MainGameLoop ; reset frame loop

View File

@@ -3,8 +3,8 @@
;--------------------------------------------------------------------------------
DarkWorldSaveFix:
LDA.b #$70 : PHA : PLB ; thing we wrote over - data bank change
JSL.l MasterSwordFollowerClear
JML.l StatSaveCounter
JSL MasterSwordFollowerClear
JML StatSaveCounter
;--------------------------------------------------------------------------------
DoWorldFix:
LDA.l InvertedMode : BEQ +
@@ -12,7 +12,7 @@ DoWorldFix:
+
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA.l FollowerIndicator : CMP.b #$04 : BEQ .setLightWorld ; check if old man is following
LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
LDA.l MirrorEquipment : AND.b #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setLightWorld
@@ -48,7 +48,7 @@ RTL
DoWorldFix_Inverted:
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA.l FollowerIndicator : CMP.b #$04 : BEQ .setDarkWorld ; check if old man is following
LDA.l MirrorEquipment : AND #$02 : BEQ .setDarkWorld ; check if we have the mirror
LDA.l MirrorEquipment : AND.b #$02 : BEQ .setDarkWorld ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setDarkWorld

View File

@@ -142,13 +142,13 @@ TransferItemToVRAM:
STA.w $2116
LDX.b #$01
STX.w $420B
STX.w DMAENABLE
ADC.w #$0100
STA.w $2116
INX
STX.w $420B
STX.w DMAENABLE
STZ.w ItemGFXPtr
STZ.w ItemGFXTarget
@@ -248,9 +248,9 @@ endmacro
FastSpriteDecomp:
SEP #$30
LDA.l $80CFC0,X : PHA : PLB ; bank
LDA.l $80D09F,X : XBA ; high
LDA.l $80D17E,X ; low
LDA.l GFXSheetPointers_background_bank,X : PHA : PLB
LDA.l GFXSheetPointers_background_high,X : XBA
LDA.l GFXSheetPointers_background_low,X
REP #$10

View File

@@ -24,14 +24,14 @@ RetrieveValueFromEncryptedTable:
LDY.b Scrap0A : PHY : LDY.b Scrap0C : PHY : LDY.b Scrap0E : PHY
AND.w #$FFF8 : TAY
LDA.b [$00], Y : STA.l CryptoBuffer : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+2 : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+4 : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+6
LDA.b [Scrap00], Y : STA.l CryptoBuffer : INY #2
LDA.b [Scrap00], Y : STA.l CryptoBuffer+2 : INY #2
LDA.b [Scrap00], Y : STA.l CryptoBuffer+4 : INY #2
LDA.b [Scrap00], Y : STA.l CryptoBuffer+6
LDA.w #$0002 : STA.b Scrap04 ;set block size
JSL.l XXTEA_Decode
JSL XXTEA_Decode
PLA : STA.b Scrap0E : PLA : STA.b Scrap0C : PLA : STA.b Scrap0A
PLA : STA.b Scrap08 : PLA : STA.b Scrap06 : PLA : STA.b Scrap04
@@ -53,7 +53,7 @@ ChestDataPayload = $01EABC ; ChestData+$0150
GetChestData:
LDA.l IsEncrypted : BNE .encrypted
INC.b Scrap0E : LDX.w #$FFFD ; what we wrote over
JML.l Dungeon_OpenKeyedObject_nextChest
JML Dungeon_OpenKeyedObject_nextChest
.encrypted
INC.b Scrap0E : LDX.w #$FFFE
@@ -78,10 +78,10 @@ JML.l Dungeon_OpenKeyedObject_nextChest
LDA.l ChestData, X : ASL A : BCC .smallChest
JML.l Dungeon_OpenKeyedObject_bigChest ;(bank01.asm line #13783)
JML Dungeon_OpenKeyedObject_bigChest ;(bank01.asm line #13783)
.smallChest
JML.l Dungeon_OpenKeyedObject_smallChest
JML Dungeon_OpenKeyedObject_smallChest
.couldntFindChest
JML.l Dungeon_OpenKeyedObject_couldntFindChest
JML Dungeon_OpenKeyedObject_couldntFindChest
;--------------------------------------------------------------------------------

View File

@@ -21,7 +21,7 @@ macro LoadDialogAddress(address)
PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers
PEI.b ($00)
PEI.b (Scrap00)
LDA.b Scrap02 : PHA
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag
@@ -44,7 +44,7 @@ endmacro
macro CopyDialogIndirect()
REP #$20 : LDA.l DialogOffsetPointer : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
?loop:
LDA.b [$00], Y ; load the next character from the pointer
LDA.b [Scrap00], Y ; load the next character from the pointer
STA.l DialogBuffer, X ; write to the buffer
INX : INY
CMP.b #$7F : BNE ?loop
@@ -149,7 +149,7 @@ FreeDungeonItemNotice:
.self_notice
SEP #$20
%CopyDialog(Notice_Self)
JMP.w .done
JMP .done
+
SEP #$20
LDA.w ScratchBufferNV+1
@@ -228,7 +228,7 @@ RTL
;--------------------------------------------------------------------------------
DialogResetSelectionIndex:
JSL.l Attract_DecompressStoryGfx ; what we wrote over
JSL Attract_DecompressStoryGfx ; what we wrote over
STZ.w MessageCursor
RTL
;--------------------------------------------------------------------------------
@@ -251,7 +251,7 @@ DialogFairyThrow:
ORA.l BottleContentsTwo : ORA.l BottleContentsThree : ORA.l BottleContentsFour : BNE .normal
.noInventory
LDA.w SpriteActivity, X : !ADD #$08 : STA.w SpriteActivity, X
LDA.w SpriteActivity, X : !ADD.b #$08 : STA.w SpriteActivity, X
LDA.b #$51
LDY.b #$01
RTL
@@ -261,14 +261,14 @@ RTL
RTL
;--------------------------------------------------------------------------------
DialogGanon1:
JSL.l CheckGanonVulnerability
JSL CheckGanonVulnerability
REP #$20
LDA.w #$018C
BCC +
LDA.w #$016D
+ STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
JSL Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
; #$0192 - no bow
@@ -280,7 +280,7 @@ RTL
; s = silver arrow bow
; p = 2nd progressive bow
DialogGanon2:
JSL.l CheckGanonVulnerability
JSL CheckGanonVulnerability
REP #$20
BCS +
@@ -304,7 +304,7 @@ DialogGanon2:
++
STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
JSL Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
DialogEtherTablet:
@@ -366,7 +366,7 @@ DialogBombShopGuy:
+
TYA
LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional
JSL Sprite_ShowMessageUnconditional
RTL
;---------------------------------------------------------------------------------------------------
@@ -382,7 +382,7 @@ AgahnimAsksAboutPed:
STA.w TextID
.vanilla
JML $85FA8E ; Sprite_ShowMessageMinimal
JML Sprite_ShowMessageMinimal
;--------------------------------------------------------------------------------
Main_ShowTextMessage_Alt:
; Are we in text mode? If so then end the routine.
@@ -474,7 +474,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA.l $85E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
LDA.l Sprite_ShowSolicitedMessage_Direction, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PHY
@@ -531,7 +531,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage:
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA.l $85E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
LDA.l Sprite_ShowSolicitedMessage_Direction, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PLA : XBA : PLA

View File

@@ -8,7 +8,7 @@
StoreLastOverworldDoorID:
TXA : INC
STA.l PreviousOverworldDoor
LDA.l $9BBB73, X : STA.w EntranceIndex
LDA.l Overworld_Entrance_ID, X : STA.w EntranceIndex
RTL
;--------------------------------------------------------------------------------
@@ -42,49 +42,49 @@ RTL
; TurnAroundOnUnderworld
;--------------------------------------------------------------------------------
TurnAroundOnUnderworld:
LDA $26 : BEQ .done
LDA.b LinkPushDirection : BEQ .done
; turn around if ($010E == #$43) != ($7F5099 == #$43)
LDX #$00
LDA #$43 : CMP $010E : BEQ +
LDX.b #$00
LDA.b #$43 : CMP.w EntranceIndex : BEQ +
INX
+
CMP $7F5099 : BEQ +
CMP.l PreviousOverworldDoor : BEQ +
DEX
+
CPX #$00 : BEQ .done
LDA $26 : EOR #$0C : STA $26
CPX.b #$00 : BEQ .done
LDA.b LinkPushDirection : EOR.b #$0C : STA.b LinkPushDirection
.done
JML $0FFD65 ; what we overwrote
JML Underworld_LoadCustomTileAttributes ; what we overwrote
;--------------------------------------------------------------------------------
; TurnUpOnOverworld
;--------------------------------------------------------------------------------
TurnUpOnOverworld:
LDA.l EntranceTavernBack : CMP #$43 : BEQ .done
LDA #$08 : STA $26 ; only fix this glitch if exit not vanilla
LDA.l EntranceTavernBack : CMP.b #$43 : BEQ .done
LDA.b #$08 : STA.b LinkPushDirection ; only fix this glitch if exit not vanilla
.done
JML $07E68F ; what we overwrote
JML Link_HandleMovingAnimation_FullLongEntry ; what we overwrote
;--------------------------------------------------------------------------------
; WalkUpOnOverworld
;--------------------------------------------------------------------------------
WalkUpOnOverworld:
LDA $20 : CMP #$091B : BNE .normal ; hardcoded Y coordinate
STZ $2F
LDA.b LinkPosY : CMP.w #$091B : BNE .normal ; hardcoded Y coordinate
STZ.b LinkDirection
RTL
.normal
LDA #$0002 : STA $2F ; what we overwrote
LDA.w #$0002 : STA.b LinkDirection ; what we overwrote
RTL
;--------------------------------------------------------------------------------
; CheckStairsAdjustment
;--------------------------------------------------------------------------------
CheckStairsAdjustment:
LDA.b $A0
LDA.b RoomIndex
CMP.w #$0124 ; vanilla check, rooms $0124 to $0127 have a lower exit position (currently ER ignores the entrance location)
BCC .done
LDA.w #$FFFF-1
CMP.w $0696 ; tavern back ($0696 == #$FFFF) should always have carry cleared
CMP.w TileMapEntranceDoors ; tavern back ($0696 == #$FFFF) should always have carry cleared
.done
RTL
; if carry cleared, shift position up

View File

@@ -13,31 +13,31 @@ pullpc
CheckKholdShellCoordinates:
LDA.w $0D30, X
LDA.w SpritePosXHigh, X
XBA
LDA.w $0D10, X ; full 16 bit X coordinate of sprite
LDA.w SpritePosXLow, X ; full 16 bit X coordinate of sprite
REP #$21 ; carry is guaranteed clear
SBC.w #$0020
CMP.b $22
CMP.b LinkPosX
BCS .not_colliding
ADC.w #$0040 ; carry is guaranteed clear
CMP.b $22
CMP.b LinkPosX
BCC .not_colliding
SEP #$20
LDA.w $0D20, X
LDA.w SpritePosYHigh, X
XBA
LDA.w $0D00, X ; full 16 bit Y coordinate of sprite
LDA.w SpritePosYLow, X ; full 16 bit Y coordinate of sprite
REP #$21 ; carry is guaranteed clear
SBC.w #$001F ; could go to 27 and still let link squeeze in
CMP.b $20
CMP.b LinkPosY
BCS .not_colliding
ADC.w #$0037 ; carry is guaranteed clear
CMP.b $20
CMP.b LinkPosY
BCC .not_colliding
SEP #$20 ; collision detected

View File

@@ -1,9 +1,3 @@
!add = "clc : adc"
!addl = "clc : adc.l"
!sub = "sec : sbc"
!bge = "bcs"
!blt = "bcc"
; Free RAM notes
; Normal doors use $AB-AC for scrolling indicator
; Normal doors use $FE to store the trap door indicator

View File

@@ -1,10 +1,10 @@
CheckDarkWorldSpawn:
STA $A0 : STA $048E ; what we wrote over
LDA.l DRFlags : AND #$0200 : BEQ + ; skip if the flag isn't set
LDA.l MoonPearlEquipment : AND #$00FF : BNE + ; moon pearl?
LDA.l LinksHouseDarkWorld : CMP $A0 : BEQ ++
LDA.l SanctuaryDarkWorld : CMP $A0 : BEQ ++
LDA.l OldManDarkWorld : CMP $A0 : BNE +
++ SEP #$30 : LDA #$17 : STA $5D
INC $02E0 : LDA.b #$40 : STA CurrentWorld : REP #$30
STA.b RoomIndex : STA.w RoomIndexMirror ; what we wrote over
LDA.l DRFlags : AND.w #$0200 : BEQ + ; skip if the flag isn't set
LDA.l MoonPearlEquipment : AND.w #$00FF : BNE + ; moon pearl?
LDA.l LinksHouseDarkWorld : CMP.b RoomIndex : BEQ ++
LDA.l SanctuaryDarkWorld : CMP.b RoomIndex : BEQ ++
LDA.l OldManDarkWorld : CMP.b RoomIndex : BNE +
++ SEP #$30 : LDA.b #$17 : STA.b LinkState
INC.w BunnyFlag : LDA.b #$40 : STA.l CurrentWorld : REP #$30
+ RTL

View File

@@ -67,7 +67,7 @@ jsl QuadrantLoadOrderAfterScroll
org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0)
Splicer:
jsl GfxFixer
lda $b1 : beq .done
lda.b $b1 : beq .done
rts
nop #5
.done
@@ -98,7 +98,7 @@ org $8ffd65 ;(PC: 07fd65)
Dungeon_LoadCustomTileAttr:
org $81feb0
Dungeon_ApproachFixedColor:
;org $01fec1
;org $81fec1
;Dungeon_ApproachFixedColor_variable:
;org $a0f972 ; Rando version
;LoadRoomHook:
@@ -120,7 +120,7 @@ jsl MirrorCheckOverride
org $85ef47
Sprite_HeartContainer_Override: ;sprite_heart_upgrades.asm : 96-100 (LDA $040C : CMP.b #$1A : BNE .not_in_ganons_tower)
jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower
nop : stz $0dd0, X : rts
nop : stz.w SpriteAITable, X : rts
.not_in_ganons_tower
@@ -136,7 +136,7 @@ jsl EGFixOnMirror
org $82b82a
jsl FixShopCode
org $9ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties)
org $9ddeea ; <- Bank1D.asm : 286 (JSL SpritePrep_LoadProperties)
jsl VitreousKeyReset
org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2
@@ -170,7 +170,7 @@ org $8799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D)
JSL StoreTempBunnyState
;
org $88C450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8)
JSL RetrieveBunnyState : JMP.w $88C458 : NOP
JSL RetrieveBunnyState : JMP.w + : NOP : +
org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E)
JSL CheckDarkWorldSpawn : NOP
@@ -188,7 +188,7 @@ Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando
org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL.l Underworld_DoorDown_Entry : CPX #$FF
JSL Underworld_DoorDown_Entry : CPX.b #$FF
BEQ + : db $80, $1C ; BRA $028B04
NOP #6 : +

View File

@@ -2,12 +2,12 @@
; Ram usage
HorzEdge:
cpy #$ff : beq +
jsr DetectWestEdge : ldy #$02 : bra ++
cpy.b #$ff : beq +
jsr DetectWestEdge : ldy.b #$02 : bra ++
+ jsr DetectEastEdge
++ cmp #$ff : beq +
sta $00 : asl : !add $00 : tax
cpy #$ff : beq ++
++ cmp.b #$ff : beq +
sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
cpy.b #$ff : beq ++
jsr LoadWestData : bra .main
++ jsr LoadEastData
.main
@@ -16,12 +16,12 @@ HorzEdge:
+ clc : rts
VertEdge:
cpy #$ff : beq +
cpy.b #$ff : beq +
jsr DetectNorthEdge : bra ++
+ jsr DetectSouthEdge
++ cmp #$ff : beq +
sta $00 : asl : !add $00 : tax
cpy #$ff : beq ++
++ cmp.b #$ff : beq +
sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
cpy.b #$ff : beq ++
jsr LoadNorthData : bra .main
++ jsr LoadSouthData
.main
@@ -30,20 +30,20 @@ VertEdge:
+ clc : rts
LoadEdgeRoomHorz:
lda $03 : sta $a0
sty $06
and.b #$0f : asl a : !sub $23 : !add $06 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda.b Scrap03 : sta.b RoomIndex
sty.b Scrap06
and.b #$0f : asl a : !SUB.b LinkPosX+1 : !ADD.b Scrap06 : sta.b Scrap02
ldy.b #$00 : jsr ShiftVariablesMainDir
lda $04 : and #$80 : bne .edge
lda $04 : sta $01 ; load up flags in $01
lda.b Scrap04 : and.b #$80 : bne .edge
lda.b Scrap04 : sta.b Scrap01 ; load up flags in $01
jsr PrepScrollToNormal
bra .scroll
.edge
lda $04 : and #$10 : beq +
lda #$01
+ sta $ee ; layer stuff
lda.b Scrap04 : and.b #$10 : beq +
lda.b #$01
+ sta.b LinkLayer ; layer stuff
jsr MathHorz
@@ -52,14 +52,14 @@ LoadEdgeRoomHorz:
rts
LoadEdgeRoomVert:
lda $03 : sta $a0
sty $06
and.b #$f0 : lsr #3 : !sub $21 : !add $06 : sta $02
lda.b Scrap03 : sta.b RoomIndex
sty.b Scrap06
and.b #$f0 : lsr #3 : !SUB.b LinkPosY+1 : !ADD.b Scrap06 : sta.b Scrap02
lda $04 : and #$80 : bne .edge
lda $04 : sta $01 ; load up flags in $01
and #$03 : cmp #$03 : beq .inroom
ldy #$01 : jsr ShiftVariablesMainDir
lda.b Scrap04 : and.b #$80 : bne .edge
lda.b Scrap04 : sta.b Scrap01 ; load up flags in $01
and.b #$03 : cmp.b #$03 : beq .inroom
ldy.b #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal
bra .scroll
@@ -68,13 +68,13 @@ LoadEdgeRoomVert:
rts
.edge
ldy #$01 : jsr ShiftVariablesMainDir
lda $04 : and #$10 : beq +
lda #$01
+ sta $ee ; layer stuff
ldy.b #$01 : jsr ShiftVariablesMainDir
lda.b Scrap04 : and.b #$10 : beq +
lda.b #$01
+ sta.b LinkLayer ; layer stuff
jsr MathVert
lda $03
lda.b Scrap03
.scroll
jsr ScrollX
@@ -82,220 +82,220 @@ LoadEdgeRoomVert:
MathHorz:
jsr MathStart : lda $20
jsr MathMid : and #$0040
jsr MathStart : lda.b LinkPosY
jsr MathMid : and.w #$0040
jsr MathEnd
rts
MathVert:
jsr MathStart : lda $22
jsr MathMid : and #$0020
jsr MathStart : lda.b LinkPosX
jsr MathMid : and.w #$0020
jsr MathEnd
rts
MathStart:
rep #$30
lda $08 : and #$00ff : sta $00
lda.b Scrap08 : and.w #$00ff : sta.b Scrap00
rts
MathMid:
and #$01ff : !sub $00 : and #$00ff : sta $00
and.w #$01ff : !SUB.b Scrap00 : and.w #$00ff : sta.b Scrap00
; nothing should be bigger than $a0 at this point
lda $05 : and #$00f0 : lsr #4 : tax
lda MultDivInfo, x : and #$00ff : tay
lda $00 : jsr MultiplyByY : sta $02
lda.b Scrap05 : and.w #$00f0 : lsr #4 : tax
lda.w MultDivInfo, x : and.w #$00ff : tay
lda.b Scrap00 : jsr MultiplyByY : sta.b Scrap02
lda $07 : and #$00ff : jsr MultiplyByY : tax
lda.b Scrap07 : and.w #$00ff : jsr MultiplyByY : tax
lda $05 : and #$000f : tay
lda MultDivInfo, y : and #$00ff : tay
lda $02 : jsr DivideByY : sta $00
lda $0c : and #$00ff : sta $02
lda $04
lda.b Scrap05 : and.w #$000f : tay
lda.w MultDivInfo, y : and.w #$00ff : tay
lda.b Scrap02 : jsr DivideByY : sta.b Scrap00
lda.b Scrap0C : and.w #$00ff : sta.b Scrap02
lda.b Scrap04
rts
MathEnd:
beq +
lda #$0100
+ !add $02 : !add $00
sta $04
lda.w #$0100
+ !ADD.b Scrap02 : !ADD.b Scrap00
sta.b Scrap04
sep #$30
rts
; don't need midpoint of edge Link is leaving (formerly in $06 - used by dir indicator)
; don't need width of edge Link is going to (currently in $0b)
LoadNorthData:
lda NorthOpenEdge, x : sta $03 : inx ; target room
lda NorthEdgeInfo, x : sta $07 ; needed for maths - (divide by 2 anyway)
lda NorthOpenEdge, x : sta $04 : inx ; bit field
lda NorthEdgeInfo, x : sta $08 ; needed for maths
lda NorthOpenEdge, x : sta $05 ; ratio
lda $04 : jsr LoadSouthMidpoint : inx ; needed now, and for nrml transition
lda SouthEdgeInfo, x : sta $0b : inx ; probably not needed todo: remove
lda SouthEdgeInfo, x : sta $0c ; needed for maths
lda.w NorthOpenEdge, x : sta.b Scrap03 : inx ; target room
lda.w NorthEdgeInfo, x : sta.b Scrap07 ; needed for maths - (divide by 2 anyway)
lda.w NorthOpenEdge, x : sta.b Scrap04 : inx ; bit field
lda.w NorthEdgeInfo, x : sta.b Scrap08 ; needed for maths
lda.w NorthOpenEdge, x : sta.b Scrap05 ; ratio
lda.b Scrap04 : jsr LoadSouthMidpoint : inx ; needed now, and for nrml transition
lda.w SouthEdgeInfo, x : sta.b Scrap0B : inx ; probably not needed todo: remove
lda.w SouthEdgeInfo, x : sta.b Scrap0C ; needed for maths
rts
LoadSouthMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda SouthEdgeInfo, x : sta $0a ; needed now, and for nrml transition
and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda.w SouthEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts
LoadSouthData:
lda SouthOpenEdge, x : sta $03 : inx
lda SouthEdgeInfo, x : sta $07
lda SouthOpenEdge, x : sta $04 : inx
lda SouthEdgeInfo, x : sta $08
lda SouthOpenEdge, x : sta $05
lda $04 : jsr LoadNorthMidpoint : inx
lda NorthEdgeInfo, x : sta $0b : inx
lda NorthEdgeInfo, x : sta $0c
lda.w SouthOpenEdge, x : sta.b Scrap03 : inx
lda.w SouthEdgeInfo, x : sta.b Scrap07
lda.w SouthOpenEdge, x : sta.b Scrap04 : inx
lda.w SouthEdgeInfo, x : sta.b Scrap08
lda.w SouthOpenEdge, x : sta.b Scrap05
lda.b Scrap04 : jsr LoadNorthMidpoint : inx
lda.w NorthEdgeInfo, x : sta.b Scrap0B : inx
lda.w NorthEdgeInfo, x : sta.b Scrap0C
rts
LoadNorthMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda NorthEdgeInfo, x : sta $0a ; needed now, and for nrml transition
and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda.w NorthEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts
LoadWestData:
lda WestOpenEdge, x : sta $03 : inx
lda WestEdgeInfo, x : sta $07
lda WestOpenEdge, x : sta $04 : inx
lda WestEdgeInfo, x : sta $08
lda WestOpenEdge, x : sta $05
lda $04 : jsr LoadEastMidpoint : inx
lda EastEdgeInfo, x : sta $0b : inx
lda EastEdgeInfo, x : sta $0c
lda.w WestOpenEdge, x : sta.b Scrap03 : inx
lda.w WestEdgeInfo, x : sta.b Scrap07
lda.w WestOpenEdge, x : sta.b Scrap04 : inx
lda.w WestEdgeInfo, x : sta.b Scrap08
lda.w WestOpenEdge, x : sta.b Scrap05
lda.b Scrap04 : jsr LoadEastMidpoint : inx
lda.w EastEdgeInfo, x : sta.b Scrap0B : inx
lda.w EastEdgeInfo, x : sta.b Scrap0C
rts
LoadEastMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda EastEdgeInfo, x : sta $0a ; needed now, and for nrml transition
and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda.w EastEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts
LoadEastData:
lda EastOpenEdge, x : sta $03 : inx
lda EastEdgeInfo, x : sta $07
lda EastOpenEdge, x : sta $04 : inx
lda EastEdgeInfo, x : sta $08
lda EastOpenEdge, x : sta $05
lda $04 : jsr LoadWestMidpoint : inx
lda WestEdgeInfo, x : sta $0b : inx
lda WestEdgeInfo, x : sta $0c
lda.w EastOpenEdge, x : sta.b Scrap03 : inx
lda.w EastEdgeInfo, x : sta.b Scrap07
lda.w EastOpenEdge, x : sta.b Scrap04 : inx
lda.w EastEdgeInfo, x : sta.b Scrap08
lda.w EastOpenEdge, x : sta.b Scrap05
lda.b Scrap04 : jsr LoadWestMidpoint : inx
lda.w WestEdgeInfo, x : sta.b Scrap0B : inx
lda.w WestEdgeInfo, x : sta.b Scrap0C
LoadWestMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda WestEdgeInfo, x : sta $0a ; needed now, and for nrml transition
and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda.w WestEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts
DetectNorthEdge:
ldx #$ff
lda $a2
cmp #$82 : bne +
lda $22 : cmp #$50 : bcs ++
ldx #$01 : bra .end
++ ldx #$00 : bra .end
+ cmp #$83 : bne +
ldx #$02 : bra .end
+ cmp #$84 : bne +
lda $a9 : beq ++
lda $22 : cmp #$78 : bcs +++
ldx #$04 : bra .end
+++ ldx #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$85 : bne +
ldx #$06 : bra .end
+ cmp #$db : bne +
lda $a9 : beq ++
lda $22 : beq ++
ldx #$08 : bra .end
++ ldx #$07 : bra .end
+ cmp #$dc : bne .end
lda $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++
ldx #$09 : bra .end
++ ldx #$0a
ldx.b #$ff
lda.b PreviousRoom
cmp.b #$82 : bne +
lda.b LinkPosX : cmp.b #$50 : bcs ++
ldx.b #$01 : bra .end
++ ldx.b #$00 : bra .end
+ cmp.b #$83 : bne +
ldx.b #$02 : bra .end
+ cmp.b #$84 : bne +
lda.b $a9 : beq ++
lda.b LinkPosX : cmp.b #$78 : bcs +++
ldx.b #$04 : bra .end
+++ ldx.b #$05 : bra .end
++ lda.b LinkPosX : cmp.b #$78 : bcs ++
ldx.b #$03 : bra .end
++ ldx.b #$04 : bra .end
+ cmp.b #$85 : bne +
ldx.b #$06 : bra .end
+ cmp.b #$db : bne +
lda.b $a9 : beq ++
lda.b LinkPosX : beq ++
ldx.b #$08 : bra .end
++ ldx.b #$07 : bra .end
+ cmp.b #$dc : bne .end
lda.b $a9 : bne ++
lda.b LinkPosX : cmp.b #$b0 : bcs ++
ldx.b #$09 : bra .end
++ ldx.b #$0a
.end txa : rts
DetectSouthEdge:
ldx #$ff
lda $a2
cmp #$72 : bne +
lda $22 : cmp #$50 : bcs ++
ldx #$01 : bra .end
++ ldx #$00 : bra .end
+ cmp #$73 : bne +
ldx #$02 : bra .end
+ cmp #$74 : bne +
lda $a9 : beq ++
lda $22 : cmp #$78 : bcs +++
ldx #$04 : bra .end
+++ ldx #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$75 : bne +
ldx #$06 : bra .end
+ cmp #$cb : bne +
lda $a9 : beq ++
lda $22 : beq ++
ldx #$08 : bra .end
++ ldx #$07 : bra .end
+ cmp #$cc : bne .end
lda $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++
ldx #$09 : bra .end
++ ldx #$0a
ldx.b #$ff
lda.b PreviousRoom
cmp.b #$72 : bne +
lda.b LinkPosX : cmp.b #$50 : bcs ++
ldx.b #$01 : bra .end
++ ldx.b #$00 : bra .end
+ cmp.b #$73 : bne +
ldx.b #$02 : bra .end
+ cmp.b #$74 : bne +
lda.b $a9 : beq ++
lda.b LinkPosX : cmp.b #$78 : bcs +++
ldx.b #$04 : bra .end
+++ ldx.b #$05 : bra .end
++ lda.b LinkPosX : cmp.b #$78 : bcs ++
ldx.b #$03 : bra .end
++ ldx.b #$04 : bra .end
+ cmp.b #$75 : bne +
ldx.b #$06 : bra .end
+ cmp.b #$cb : bne +
lda.b $a9 : beq ++
lda.b LinkPosX : beq ++
ldx.b #$08 : bra .end
++ ldx.b #$07 : bra .end
+ cmp.b #$cc : bne .end
lda.b $a9 : bne ++
lda.b LinkPosX : cmp.b #$b0 : bcs ++
ldx.b #$09 : bra .end
++ ldx.b #$0a
.end txa : rts
DetectWestEdge:
ldx #$ff
lda $a2
cmp #$65 : bne +
ldx #$00 : bra .end
+ cmp #$74 : bne +
ldx #$01 : bra .end
+ cmp #$75 : bne +
ldx #$02 : bra .end
+ cmp #$82 : bne +
lda $aa : beq ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$85 : bne +
ldx #$05 : bra .end
+ cmp #$cc : bne +
lda $aa : beq ++
ldx #$06 : bra .end
++ ldx #$07 : bra .end
+ cmp #$dc : bne .end
ldx #$08
ldx.b #$ff
lda.b PreviousRoom
cmp.b #$65 : bne +
ldx.b #$00 : bra .end
+ cmp.b #$74 : bne +
ldx.b #$01 : bra .end
+ cmp.b #$75 : bne +
ldx.b #$02 : bra .end
+ cmp.b #$82 : bne +
lda.b LinkQuadrantV : beq ++
ldx.b #$03 : bra .end
++ ldx.b #$04 : bra .end
+ cmp.b #$85 : bne +
ldx.b #$05 : bra .end
+ cmp.b #$cc : bne +
lda.b LinkQuadrantV : beq ++
ldx.b #$06 : bra .end
++ ldx.b #$07 : bra .end
+ cmp.b #$dc : bne .end
ldx.b #$08
.end txa : rts
DetectEastEdge:
ldx #$ff
lda $a2
cmp #$64 : bne +
ldx #$00 : bra .end
+ cmp #$73 : bne +
ldx #$01 : bra .end
+ cmp #$74 : bne +
ldx #$02 : bra .end
+ cmp #$81 : bne +
lda $aa : beq ++
ldx #$04 : bra .end
++ ldx #$03 : bra .end
+ cmp #$84 : bne +
ldx #$05 : bra .end
+ cmp #$cb : bne +
lda $aa : beq ++
ldx #$06 : bra .end
++ ldx #$07 : bra .end
+ cmp #$db : bne .end
ldx #$08
ldx.b #$ff
lda.b PreviousRoom
cmp.b #$64 : bne +
ldx.b #$00 : bra .end
+ cmp.b #$73 : bne +
ldx.b #$01 : bra .end
+ cmp.b #$74 : bne +
ldx.b #$02 : bra .end
+ cmp.b #$81 : bne +
lda.b LinkQuadrantV : beq ++
ldx.b #$04 : bra .end
++ ldx.b #$03 : bra .end
+ cmp.b #$84 : bne +
ldx.b #$05 : bra .end
+ cmp.b #$cb : bne +
lda.b LinkQuadrantV : beq ++
ldx.b #$06 : bra .end
++ ldx.b #$07 : bra .end
+ cmp.b #$db : bne .end
ldx.b #$08
.end txa : rts
AlwaysPushThroughFDoors:

View File

@@ -20,10 +20,10 @@
;===================================================================================================
pushpc
org $01B0E6
org $81B0E6
JSL StoreDoorInfo
org $01892F
org $81892F
DoorDrawJankMove:
JML PrepDoorDraw
@@ -33,12 +33,12 @@ DoorDrawJankMove:
; we don't want to overwrite the JMP ($000E) that's already there
; Well, we could, but we don't need to
warnpc $018939
warnpc $818939
org $01BF43
org $81BF43
JSL AdjustEscapeDoorCollision
org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00
org $81C132 ; ADC.w #$0040 : TAX : LDA.b $00
JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2
pullpc
@@ -46,7 +46,7 @@ pullpc
;===================================================================================================
StoreDoorInfo:
STA.w $1980,X
LDA.b $00 : STA.w $19F0,X
LDA.b Scrap00 : STA.w $19F0,X
TXA
RTL
@@ -59,18 +59,18 @@ PrepDoorDraw:
; Much easier to just tell you to look at $01890D in the disassembly
; and you should understand the vanilla program flow we need to reject
PEA.w DoorDrawJankMove_return-1
LDA.b $00
LDA.b Scrap00
STA.w $19EE ; for current routine
; copy vanilla code (but fast rom)
LDA.l $8186F0,X
STA.b $0E
STA.b Scrap0E
LDX.b $02
LDA.b $04
LDX.b Scrap02
LDA.b Scrap04
; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting
JML.l $818939
JML $818939
;===================================================================================================
@@ -106,20 +106,20 @@ AdjustEscapeDoorGraphics:
; row 1
LDA.w #$8838
STA.l $7E2000+$080,X
STA.l TileMapA+$080,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X
STA.l TileMapA+$086,X
; row 2
LDA.w #$8828
STA.l $7E2000+$100,X
STA.l TileMapA+$100,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X
STA.l TileMapA+$106,X
LDA.w #$8829
STA.l $7E2000+$102,X
STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
STA.l TileMapA+$104,X
JSR IdentifySwampEntrance
BCS .fix_swamp_entrance_alternate
@@ -134,26 +134,26 @@ AdjustEscapeDoorGraphics:
; row 0
LDA.w #$14C4
STA.l $7E2000+$000,X ; sanity check = should calculate to 7e3bbc
STA.l TileMapA+$000,X ; sanity check = should calculate to 7e3bbc
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$006,X
STA.l TileMapA+$006,X
LDA.w #$14C5
STA.l $7E2000+$002,X
STA.l TileMapA+$002,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$004,X
STA.l TileMapA+$004,X
; row 1
LDA.w #$14E8
STA.l $7E2000+$082,X
STA.l TileMapA+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
STA.l TileMapA+$084,X
; row 2
LDA.w #$14F8
STA.l $7E2000+$102,X
STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
STA.l TileMapA+$104,X
RTL
.fix_swamp_entrance
@@ -162,56 +162,56 @@ AdjustEscapeDoorGraphics:
; row 1 - outer section
LDA.w #$0908
STA.l $7E2000+$080,X
STA.l TileMapA+$080,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X
STA.l TileMapA+$086,X
; row 2
LDA.w #$0918
STA.l $7E2000+$100,X
STA.l TileMapA+$100,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X
STA.l TileMapA+$106,X
LDA.w #$14F8
STA.l $7E2000+$102,X
STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
STA.l TileMapA+$104,X
.fix_swamp_entrance_alternate
; row 0
LDA.w #$9DFC
STA.l $7E2000+$000,X
STA.l $7E2000+$002,X
STA.l $7E2000+$004,X
STA.l $7E2000+$006,X
STA.l TileMapA+$000,X
STA.l TileMapA+$002,X
STA.l TileMapA+$004,X
STA.l TileMapA+$006,X
; row 1 - mid section
LDA.w #$14E8
STA.l $7E2000+$082,X
STA.l TileMapA+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
STA.l TileMapA+$084,X
; row 3
LDA.w #$A82C
STA.l $7E2000+$180,X
STA.l TileMapA+$180,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$186,X
STA.l TileMapA+$186,X
LDA.w #$A82D
STA.l $7E2000+$182,X
STA.l TileMapA+$182,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$184,X
STA.l TileMapA+$184,X
RTL
IdentifySancEntrance:
LDA.b $A0 : CMP.w #$0012 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE +
LDA.b RoomIndex : CMP.w #$0012 : BNE +
LDA.b Scrap0A : CMP.w #$0010 : BNE +
SEC : RTS
+ CLC : RTS
IdentifySwampEntrance:
LDA.b $A0 : CMP.w #$0036 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE +
LDA.b RoomIndex : CMP.w #$0036 : BNE +
LDA.b Scrap0A : CMP.w #$0010 : BNE +
SEC : RTS
+ CLC : RTS
@@ -250,7 +250,7 @@ AdjustEscapeDoorCollisionShared:
BCS .block_entrance
; vanilla value
LDA.b $00
LDA.b Scrap00
RTL
@@ -274,21 +274,21 @@ IdentifyBlockedEntrance:
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #$0002 : BCS .leave_alone ; only in rain states (0 or 1)
LDA.l ProgressFlags : AND.w #$0004 : BNE .leave_alone ; zelda's been rescued
LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged
LDA.b $A0 : CMP.w #$0012 : BNE +
LDA.b RoomIndex : CMP.w #$0012 : BNE +
; we're in the sanctuary
; this code could be removed because you can't reach sanc without zelda currently
; but that's enforced in the logic, so this is to catch that case in case some mode allows it
LDA.l FollowerIndicator : AND.w #$00FF : CMP.w #$0001 : BEQ .leave_alone ; zelda is following
LDA.b $0A
LDA.b Scrap0A
CMP.w #$000A : BCC .leave_alone
CMP.w #$0014 : BCS .leave_alone
.block_door
SEC : RTS
+ LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone
LDX #$FFFE
LDX.w #$FFFE
- INX #2
LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone
CMP $A0 : BNE -
CMP.b RoomIndex : BNE -
LDA.l RainDoorMatch, X
CMP.w $19EE : BNE .leave_alone
BRA .block_door

View File

@@ -4,60 +4,60 @@ GfxFixer:
jsl LoadRoomHook ;this is the code we overwrote
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx_Alt
inc $b0
inc.b SubSubModule
rtl
+ lda $b1 : bne .stage2
+ lda.b $b1 : bne .stage2
jsl LoadRoomHook ; this is the rando version - let's only call this guy once - may fix star tiles and slower loads
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx
jsl Dungeon_LoadCustomTileAttr
jsl PrepTransAuxGfx
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1
tax : lda $02802e, x : tay
lda.l DRMode : cmp.b #$02 : bne + ; only do this in crossed mode
ldx.b RoomIndex : lda.l TilesetTable, x
cmp.w $0aa1 : beq + ; already eq no need to decomp
sta.w $0aa1
tax : lda.l AnimatedTileSheets, x : tay
jsl DecompDungAnimatedTiles
+
lda #$09 : sta $17 : sta $0710
lda.b #$09 : sta.b NMIINCR : sta.w SkipOAM
jsl Palette_SpriteAux3
jsl Palette_SpriteAux2
jsl Palette_SpriteAux1
jsl Palette_DungBgMain
jsr CgramAuxToMain
inc $b1
inc.b $b1
rtl
.stage2
lda #$0a : sta $17 : sta $0710
stz $b1 : inc $b0
lda.b #$0a : sta.b NMIINCR : sta.w SkipOAM
stz.b $b1 : inc.b SubSubModule
rtl
}
FixAnimatedTiles:
LDA.L DRMode : CMP #$02 : BNE +
LDA $040C : CMP.b #$FF : BEQ +
LDA.l DRMode : CMP.b #$02 : BNE +
LDA.w DungeonID : CMP.b #$FF : BEQ +
PHX
LDX $A0 : LDA.l TilesetTable, x
CMP $0AA1 : beq ++
LDX.b RoomIndex : LDA.l TilesetTable, x
CMP.w $0AA1 : beq ++
TAX : PLA : BRA +
++
PLX
+ LDA $02802E, X ; what we wrote over
+ LDA.l AnimatedTileSheets, X ; what we wrote over
RTL
FixCloseDungeonMap:
LDA.l DRMode : CMP #$02 : BNE .vanilla
LDA $040C : BMI .vanilla
LDA.l DRMode : CMP.b #$02 : BNE .vanilla
LDA.w DungeonID : BMI .vanilla
LSR : TAX
LDA.l DungeonTilesets,x
RTL
.vanilla
LDA $7EC20E
LDA.l $7EC20E
RTL
FixWallmasterLamp:
ORA $0458
STY $1C : STA $1D : RTL ; what we wrote over
ORA.w $0458
STY.b MAINDESQ : STA.b SUBDESQ : RTL ; what we wrote over
CgramAuxToMain: ; ripped this from bank02 because it ended with rts
@@ -66,30 +66,30 @@ CgramAuxToMain: ; ripped this from bank02 because it ended with rts
ldx.b #$00
.loop
lda $7EC300, X : sta $7EC500, x
lda $7EC340, x : sta $7EC540, x
lda $7EC380, x : sta $7EC580, x
lda $7EC3C0, x : sta $7EC5C0, x
lda $7EC400, x : sta $7EC600, x
lda $7EC440, x : sta $7EC640, x
lda $7EC480, x : sta $7EC680, x
lda $7EC4C0, x : sta $7EC6C0, x
lda.l $7EC300, X : sta.l $7EC500, x
lda.l $7EC340, x : sta.l $7EC540, x
lda.l $7EC380, x : sta.l $7EC580, x
lda.l $7EC3C0, x : sta.l $7EC5C0, x
lda.l $7EC400, x : sta.l $7EC600, x
lda.l $7EC440, x : sta.l $7EC640, x
lda.l $7EC480, x : sta.l $7EC680, x
lda.l $7EC4C0, x : sta.l $7EC6C0, x
inx #2 : cpx.b #$40 : bne .loop
sep #$20
; tell NMI to upload new CGRAM data
inc $15
inc.b NMICGRAM
rts
}
OverridePaletteHeader:
lda.l DRMode : cmp #$02 : bne +
lda.l DRFlags : and #$20 : bne +
cpx #$01c2 : !bge +
lda.l DRMode : cmp.b #$02 : bne +
lda.l DRFlags : and.b #$20 : bne +
cpx.w #$01c2 : !BGE +
rep #$20
txa : lsr : tax
lda.l PaletteTable, x
iny : rtl
+ rep #$20 : iny : lda [$0D], Y ; what we wrote over
+ rep #$20 : iny : lda.b [Scrap0D], Y ; what we wrote over
rtl

View File

@@ -6,15 +6,6 @@
!RedSquare = $345E
!BlueSquare = $2C5E
!DungeonMask = $8098C0
!EnemyDropIndicator = $7E072A
!IndicatorAddress = $7EC790 ; used for both boss nearness and enemy drops
!CurrentDungeonIndicator = $7EC702
!KeysObtained = $7EC7A2
!KeysSlash = $7EC7A4
!KeysTotal = $7EC7A6
DrHudOverride:
PHB
SEP #$30
@@ -32,19 +23,19 @@ DRHUD_DrawItemCounter:
SEP #$30
DRHUD_DrawIndicators:
LDA.b $1B : BNE .continue
LDA.b IndoorsFlag : BNE .continue
JMP DRHUD_Finished
.continue
LDA.b $1A : AND.b #$10 : BEQ DRHUD_EnemyDropIndicator
LDA.b FrameCounter : AND.b #$10 : BEQ DRHUD_EnemyDropIndicator
DRHUD_BossIndicator:
LDA.l DRMode : BNE .continue
.early_exit
REP #$10
LDY.w #!BlankTile : STY.w !IndicatorAddress
LDY.w #!BlankTile : STY.w HUDMultiIndicator
JMP DRHUD_Finished
.continue
LDA.w $040C : CMP.b #$1B : BCS .early_exit
LDA.w DungeonID : CMP.b #$1B : BCS .early_exit
SEP #$10 ; clears the high byte of X and prevents it from getting B register
TAX
@@ -54,17 +45,17 @@ DRHUD_BossIndicator:
LDA.w CompassField : AND.l DungeonMask, x
SEP #$20
BEQ .draw_indicator
LDA.l CompassBossIndicator, x : CMP.b $A0 : BNE .draw_indicator
LDA.l CompassBossIndicator, x : CMP.b RoomIndex : BNE .draw_indicator
LDY.w #!RedSquare
.draw_indicator
STY.w !IndicatorAddress
STY.w HUDMultiIndicator
BRA DRHUD_DrawCurrentDungeonIndicator
DRHUD_EnemyDropIndicator:
REP #$30
LDA.w !EnemyDropIndicator : STA.w !IndicatorAddress
LDA.w EnemyDropIndicator : STA.w HUDMultiIndicator
SEP #$20
LDA.w $040C : CMP.b #$1B : BCS DRHUD_Finished
LDA.w DungeonID : CMP.b #$1B : BCS DRHUD_Finished
SEP #$10 : TAX : REP #$10
DRHUD_DrawCurrentDungeonIndicator: ; mX
@@ -75,7 +66,7 @@ DRHUD_DrawCurrentDungeonIndicator: ; mX
REP #$20 : LDA.l DungeonReminderTable,X : TAY
SEP #$20
.draw_indicator
STY.w !CurrentDungeonIndicator
STY.w HUDCurrentDungeonWorld
DRHUD_DrawKeyCounter:
LDA.l DRFlags : AND.b #$04 : BEQ DRHUD_Finished
@@ -83,10 +74,10 @@ DRHUD_DrawKeyCounter:
LDA.w MapField : AND.l DungeonMask, X : BEQ DRHUD_Finished
TXA : LSR : TAX
LDA.l GenericKeys : AND.w #$00FF : BNE .total_only
LDA.l DungeonCollectedKeys, X : JSR ConvertToDisplay : STA.w !KeysObtained
LDA #!SlashTile : STA.w !KeysSlash
LDA.l DungeonCollectedKeys, X : JSR ConvertToDisplay : STA.w HUDKeysObtained
LDA.w #!SlashTile : STA.w HUDKeysSlash
.total_only
LDA.l ChestKeys, x : JSR ConvertToDisplay : STA.w !KeysTotal
LDA.l ChestKeys, x : JSR ConvertToDisplay : STA.w HUDKeysTotal
DRHUD_Finished:
PLB : RTL
@@ -109,94 +100,94 @@ dw $0000, $0000, $0000, $0000, $000a, $000a, $000a, $0014, $000a, $0014, $0000,
DrHudDungeonItemsAdditions:
{
jsl DrawHUDDungeonItems
lda.l HUDDungeonItems : and #$ff : bne + : rtl : +
lda.l DRMode : cmp #$02 : beq + : rtl : +
lda.l HUDDungeonItems : and.b #$ff : bne + : rtl : +
lda.l DRMode : cmp.b #$02 : beq + : rtl : +
phx : phy : php
rep #$30
lda.w #$24f5 : sta $1606 : sta $1610 : sta $161a : sta $1624
sta $1644 : sta $164a : sta $1652 : sta $1662 : sta $1684 : sta $16c4
ldx #$0000
- sta $1704, x : sta $170e, x : sta $1718, x
inx #2 : cpx #$0008 : !blt -
lda.w #$24f5 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
sta.w $1644 : sta.w $164a : sta.w $1652 : sta.w $1662 : sta.w $1684 : sta.w $16c4
ldx.w #$0000
- sta.w $1704, x : sta.w $170e, x : sta.w $1718, x
inx #2 : cpx.w #$0008 : !BLT -
lda HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
lda.l HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda.l HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
; bk symbols
lda.w #$2811 : sta $1606 : sta $1610 : sta $161a : sta $1624
lda.w #$2811 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
; sm symbols
lda.w #$2810 : sta $160a : sta $1614 : sta $161e : sta $16e4
lda.w #$2810 : sta.w $160a : sta.w $1614 : sta.w $161e : sta.w $16e4
; blank out stuff
lda.w #$24f5 : sta $1724
lda.w #$24f5 : sta.w $1724
ldx #$0002
- lda #$0000 : !addl RowOffsets,x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y : iny #2
lda.w #$24f5 : sta $1644, y
lda MapField : and.l $0098c0, x : beq + ; must have map
jsr BkStatus : sta $1644, y : bra .smallKey ; big key status
+ lda BigKeyField : and.l $0098c0, x : beq .smallKey
lda.w #$2826 : sta $1644, y
ldx.w #$0002
- lda.w #$0000 : !ADD.l RowOffsets,x : !ADD.l ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta.w $1644, y : iny #2
lda.w #$24f5 : sta.w $1644, y
lda.l MapField : and.l DungeonMask, x : beq + ; must have map
jsr BkStatus : sta.w $1644, y : bra .smallKey ; big key status
+ lda.l BigKeyField : and.l DungeonMask, x : beq .smallKey
lda.w #$2826 : sta.w $1644, y
.smallKey
+ iny #2
cpx #$001a : bne +
tya : !add #$003c : tay
+ stx $00
cpx.w #$001a : bne +
tya : !ADD.w #$003c : tay
+ stx.b Scrap00
txa : lsr : tax
lda.w #$24f5 : sta $1644, y
lda.l GenericKeys : and #$00FF : bne +
lda.l DungeonKeys, x : and #$00FF : beq +
jsr ConvertToDisplay2 : sta $1644, y
+ iny #2 : lda.w #$24f5 : sta $1644, y
phx : ldx $00
lda MapField : and.l $0098c0, x : beq + ; must have map
plx : sep #$30 : lda.l ChestKeys, x : sta $02
lda.w #$24f5 : sta.w $1644, y
lda.l GenericKeys : and.w #$00FF : bne +
lda.l DungeonKeys, x : and.w #$00FF : beq +
jsr ConvertToDisplay2 : sta.w $1644, y
+ iny #2 : lda.w #$24f5 : sta.w $1644, y
phx : ldx.b Scrap00
lda.l MapField : and.l DungeonMask, x : beq + ; must have map
plx : sep #$30 : lda.l ChestKeys, x : sta.b Scrap02
lda.l GenericKeys : bne +++
lda $02 : !sub DungeonCollectedKeys, x : sta $02
+++ lda $02
lda.b Scrap02 : !SUB.l DungeonCollectedKeys, x : sta.b Scrap02
+++ lda.b Scrap02
rep #$30
jsr ConvertToDisplay2 : sta $1644, y ; small key totals
jsr ConvertToDisplay2 : sta.w $1644, y ; small key totals
bra .skipStack
+ plx
.skipStack iny #2
cpx #$000d : beq +
lda.w #$24f5 : sta $1644, y
cpx.w #$000d : beq +
lda.w #$24f5 : sta.w $1644, y
+
ldx $00
+ inx #2 : cpx #$001b : bcs ++ : JMP -
ldx.b Scrap00
+ inx #2 : cpx.w #$001b : bcs ++ : JMP -
++
lda HudFlag : and.w #$0020 : bne + : JMP ++ : +
lda HUDDungeonItems : and.w #$000c : bne + : JMP ++ : +
lda.l HudFlag : and.w #$0020 : bne + : JMP ++ : +
lda.l HUDDungeonItems : and.w #$000c : bne + : JMP ++ : +
; map symbols (do I want these) ; note compass symbol is 2c20
lda.w #$2821 : sta $1606 : sta $1610 : sta $161a : sta $1624
lda.w #$2821 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
; blank out a couple thing from old hud
lda.w #$24f5 : sta $16e4 : sta $1724
sta $160a : sta $1614 : sta $161e ; blank out sm key indicators
ldx #$0002
- lda #$0000 ; start of hud area
!addl RowOffsets, x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y
lda.w #$24f5 : sta.w $16e4 : sta.w $1724
sta.w $160a : sta.w $1614 : sta.w $161e ; blank out sm key indicators
ldx.w #$0002
- lda.w #$0000 ; start of hud area
!ADD.l RowOffsets, x : !ADD.l ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta.w $1644, y
iny #2
lda.w #$24f5 : sta $1644, y ; blank out map spot
lda MapField : and.l $0098c0, x : beq + ; must have map
JSR MapIndicatorShort : STA $1644, Y
lda.w #$24f5 : sta.w $1644, y ; blank out map spot
lda.l MapField : and.l DungeonMask, x : beq + ; must have map
JSR MapIndicatorShort : STA.w $1644, Y
+ iny #2
cpx #$001a : bne +
tya : !add #$003c : tay
+ lda CompassField : and.l $0098c0, x : beq + ; must have compass
cpx.w #$001a : bne +
tya : !ADD.w #$003c : tay
+ lda.l CompassField : and.l DungeonMask, x : beq + ; must have compass
phx ; total chest counts
LDA.l CompassTotalsWRAM, x : !sub DungeonLocationsChecked, x
LDA.l CompassTotalsWRAM, x : !SUB.l DungeonLocationsChecked, x
SEP #$30 : JSR HudHexToDec2DigitCopy : REP #$30
lda $06 : jsr ConvertToDisplay2 : sta $1644, y : iny #2
lda $07 : jsr ConvertToDisplay2 : sta $1644, y
lda.b Scrap06 : jsr ConvertToDisplay2 : sta.w $1644, y : iny #2
lda.b Scrap07 : jsr ConvertToDisplay2 : sta.w $1644, y
plx
bra .skipBlanks
+ lda.w #$24f5 : sta $1644, y : iny #2 : sta $1644, y
+ lda.w #$24f5 : sta.w $1644, y : iny #2 : sta.w $1644, y
.skipBlanks iny #2
cpx #$001a : beq +
lda.w #$24f5 : sta $1644, y ; blank out spot
+ inx #2 : cpx #$001b : !bge ++ : JMP -
cpx.w #$001a : beq +
lda.w #$24f5 : sta.w $1644, y ; blank out spot
+ inx #2 : cpx.w #$001b : !BGE ++ : JMP -
++
plp : ply : plx : rtl
}
@@ -223,32 +214,32 @@ IndicatorCharacters:
dw $2426, $2817, $2818, $2819, $281A, $281B, $281C, $281D, $2590, $258B, $259B
MapIndicator:
LDA.l CrystalPendantFlags_3, X : AND #$00FF
LDA.l CrystalPendantFlags_3, X : AND.w #$00FF
PHX
ASL : TAX : LDA.l IndicatorCharacters, X
PLX
RTS
BkStatus:
lda BigKeyField : and.l $0098c0, x : bne +++ ; has the bk already
lda.l BigKeyField : and.l DungeonMask, x : bne +++ ; has the bk already
lda.l BigKeyStatus, x : bne ++
lda #$2827 : rts ; 0/O for no BK
++ cmp #$0002 : bne +
lda #$2420 : rts ; symbol for BnC
+ lda #$24f5 : rts ; black otherwise
+++ lda #$2826 : rts ; check mark
lda.w #$2827 : rts ; 0/O for no BK
++ cmp.w #$0002 : bne +
lda.w #$2420 : rts ; symbol for BnC
+ lda.w #$24f5 : rts ; black otherwise
+++ lda.w #$2826 : rts ; check mark
ConvertToDisplay:
and.w #$00ff : cmp #$000a : !blt +
!add #$2553 : rts
+ !add #$2490 : rts
and.w #$00ff : cmp.w #$000a : !BLT +
!ADD.w #$2553 : rts
+ !ADD.w #$2490 : rts
ConvertToDisplay2:
and.w #$00ff : beq ++
cmp #$000a : !blt +
!add #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !add #$2816 : rts
++ lda #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
cmp.w #$000a : !BLT +
!ADD.w #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !ADD.w #$2816 : rts
++ lda.w #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
CountAbsorbedKeys:
JML IncrementSmallKeysNoPrimary
@@ -266,12 +257,12 @@ HudHexToDec2DigitCopy: ; modified
INY
SBC.b #10 : BRA -
+
STY $06 : LDY #$00 ; Store 10s digit and reset Y
STY.b Scrap06 : LDY.b #$00 ; Store 10s digit and reset Y
CMP.b #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
STY.b Scrap07 ; Store 1s digit
PLY
RTS

View File

@@ -13,24 +13,24 @@ CheckIfDoorsOpen: {
jsr TrapDoorFixer ; see normal.asm
; note we are 16bit mode right now
lda.l DRMode : beq +
lda $040c : cmp #$00ff : bne .gtg
+ lda $a0 : dec : tax : and #$000f ; hijacked code
lda.w DungeonID : cmp.w #$00ff : bne .gtg
+ lda.b RoomIndex : dec : tax : and.w #$000f ; hijacked code
sec : rtl ; set carry to indicate normal behavior
.gtg
phb : phk : plb
stx $00 : ldy #$0000
stx.b Scrap00 : ldy.w #$0000
.nextDoor
lda $a0 : asl : tax
lda.b RoomIndex : asl : tax
lda.w KeyDoorOffset, x : beq .skipDoor
asl : sty $05 : !add $05 : tax
asl : sty.b Scrap05 : !ADD.b Scrap05 : tax
lda.w PairedDoorTable, x : beq .skipDoor
sta $02 : and #$00ff : asl a : tax
lda $02 : and #$ff00 : sta $03
lda RoomDataWRAM.l, X : and #$f000 : and $03 : beq .skipDoor
tyx : lda $068c : ora $0098c0,x : sta $068c
sta.b Scrap02 : and.w #$00ff : asl a : tax
lda.b Scrap02 : and.w #$ff00 : sta.b Scrap03
lda.l RoomDataWRAM.l, X : and.w #$f000 : and.b Scrap03 : beq .skipDoor
tyx : lda.w $068c : ora.l DungeonMask,x : sta.w $068c
.skipDoor
iny #2 : cpy $00 : bne .nextDoor
iny #2 : cpy.b Scrap00 : bne .nextDoor
plb : clc : rtl
}

View File

@@ -7,60 +7,60 @@
;00 00 01 01 01 02 02 02 03 03 03 04 04 04 05 05 05 06 06 06 07 07 07 08 08
MultiplyByY:
.loop cpy #$0001 : beq .done
cpy #$0003 : bne ++
.loop cpy.w #$0001 : beq .done
cpy.w #$0003 : bne ++
jsr MultiBy3 : bra .done
++ cpy #$0005 : bne ++
++ cpy.w #$0005 : bne ++
jsr MultiBy5 : bra .done
++ asl : sta $00 : tya : lsr : tay : lda $00 : bra .loop
++ asl : sta.b Scrap00 : tya : lsr : tay : lda.b Scrap00 : bra .loop
.done rts
;Divisor in Y. Width of division is in X for rounding toward middle
DivideByY:
.loop
cpy #$0000 : beq .done
cpy #$0001 : beq .done
cpy #$0003 : bne ++
cpy.w #$0000 : beq .done
cpy.w #$0001 : beq .done
cpy.w #$0003 : bne ++
jsr DivideBy3 : bra .done
++ cpy #$0005 : bne ++
++ cpy.w #$0005 : bne ++
jsr DivideBy5 : bra .done
++ jsr DivideBy2 : sta $00
++ jsr DivideBy2 : sta.b Scrap00
tya : lsr : tay
txa : lsr : tax
lda $00 : bra .loop
lda.b Scrap00 : bra .loop
.done rts
MultiBy3:
sta $00 : asl : !add $00
sta.b Scrap00 : asl : !ADD.b Scrap00
rts
MultiBy5:
sta $00 : asl #2 : !add $00
sta.b Scrap00 : asl #2 : !ADD.b Scrap00
rts
;width of divison in x: rounds toward X/2
DivideBy2:
sta $00
sta.b Scrap00
lsr : bcc .done
sta $02 : txa : lsr : cmp $00 : !blt +
lda $02 : inc : bra .done
+ lda $02
sta.b Scrap02 : txa : lsr : cmp.b Scrap00 : !BLT +
lda.b Scrap02 : inc : bra .done
+ lda.b Scrap02
.done rts
DivideBy3:
sta $00
ldx #$0000
lda #$0002
.loop cmp $00 : !bge .store
inx : !add #$0003 : bra .loop
sta.b Scrap00
ldx.w #$0000
lda.w #$0002
.loop cmp.b Scrap00 : !BGE .store
inx : !ADD.w #$0003 : bra .loop
.store txa
rts
DivideBy5:
sta $00
ldx #$0000
lda #$0003
.loop cmp $00 : !bge .store
inx : !add #$0005 : bra .loop
sta.b Scrap00
ldx.w #$0000
lda.w #$0003
.loop cmp.b Scrap00 : !BGE .store
inx : !ADD.w #$0005 : bra .loop
.store txa
rts

View File

@@ -1,9 +1,9 @@
WarpLeft:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda $20 : ldx $aa
lda.b LinkPosY : ldx.b LinkQuadrantV
jsr CalcIndex
!add #$06 : ldy #$01 ; offsets in A, Y
!ADD.b #$06 : ldy.b #$01 ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
@@ -12,9 +12,9 @@ WarpLeft:
WarpRight:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda $20 : ldx $aa
lda.b LinkPosY : ldx.b LinkQuadrantV
jsr CalcIndex
!add #$12 : ldy #$ff ; offsets in A, Y
!ADD.b #$12 : ldy.b #$ff ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
@@ -23,9 +23,9 @@ WarpRight:
WarpUp:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda $22 : ldx $a9
lda.b LinkPosX : ldx.b LinkQuadrantH
jsr CalcIndex
ldy #$02 ; offsets in A, Y
ldy.b #$02 ; offsets in A, Y
jsr LoadRoomVert
.end
jsr Cleanup
@@ -33,17 +33,17 @@ WarpUp:
; Checks if $a0 is equal to <Room>. If it is, opens its stonewall if it's there
macro StonewallCheck(Room)
lda $a0 : cmp.b #<Room> : bne ?end
lda.l <Room>*2+$7ef000 : ora #$80 : sta.l <Room>*2+$7ef000
lda.b RoomIndex : cmp.b #<Room> : bne ?end
lda.l <Room>*2+$7ef000 : ora.b #$80 : sta.l <Room>*2+$7ef000
?end
endmacro
WarpDown:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda $22 : ldx $a9
lda.b LinkPosX : ldx.b LinkQuadrantH
jsr CalcIndex
!add #$0c : ldy #$ff ; offsets in A, Y
!ADD.b #$0c : ldy.b #$ff ; offsets in A, Y
jsr LoadRoomVert
%StonewallCheck($43)
.end
@@ -54,35 +54,35 @@ WarpDown:
; carry clear = we are in dr mode, never use linking doors
CheckLinkDoorR:
lda.l DRMode : bne +
lda $7ec004 : sta $a0 ; what we wrote over
lda.l $7ec004 : sta.b RoomIndex ; what we wrote over
sec : rtl
+ clc : rtl
CheckLinkDoorL:
lda.l DRMode : bne +
lda $7ec003 : sta $a0 ; what we wrote over
lda.l $7ec003 : sta.b RoomIndex ; what we wrote over
sec : rtl
+ clc : rtl
TrapDoorFixer:
lda $fe : and #$0038 : beq .end
xba : asl #2 : sta $00
stz $0468 : lda $068c : ora $00 : sta $068c
lda.b $fe : and.w #$0038 : beq .end
xba : asl #2 : sta.b Scrap00
stz.w TrapDoorFlag : lda.w $068c : ora.b Scrap00 : sta.w $068c
.end
stz $fe ; clear our fe here because we don't need it anymore
stz.b $fe ; clear our fe here because we don't need it anymore
rts
Cleanup:
lda.l DRFlags : and #$10 : beq +
stz $047a
+ inc $11
lda $ef
lda.l DRFlags : and.b #$10 : beq +
stz.w LayerAdjustment
+ inc.b GameSubMode
lda.b $ef
rts
; carry set if cave, clear otherwise
CheckIfCave:
REP #$30
LDA.b $A2 : CMP.w #$00E1 : BCS .invalid
LDA.b PreviousRoom : CMP.w #$00E1 : BCS .invalid
SEP #$30 : CLC : RTS
.invalid
SEP #$30 : SEC : RTS
@@ -92,11 +92,11 @@ CheckIfCave:
CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic)
cpx.b #00 : bne .largeDoor
cmp.b #$d0 : bcc .smallDoor
lda #$01 : bra .done ; Middle Door
.smallDoor lda #$00 : bra .done
.largeDoor lda #$02
lda.b #$01 : bra .done ; Middle Door
.smallDoor lda.b #$00 : bra .done
.largeDoor lda.b #$02
.done
sta $04
sta.b Scrap04
asl
rts
@@ -105,30 +105,30 @@ CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 ->
LoadRoomHorz:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
sty.b Scrap06 : sta.b Scrap07 : lda.b RoomIndex : pha ; Store normal room on stack
lda.b Scrap07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda.b Scrap00 : cmp.b #$03 : bne .gtg
jsr HorzEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
sta.b RoomIndex : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$0F : asl a : !sub $23 : !add $06 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda.b RoomIndex : and.b #$0F : asl a : !SUB.b LinkPosX+1 : !ADD.b Scrap06 : sta.b Scrap02
ldy.b #$00 : jsr ShiftVariablesMainDir
lda $01 : and #$80 : beq .normal
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadEastMidpoint : bra ++
+ lda $01 : jsr LoadWestMidpoint
lda.b Scrap01 : and.b #$80 : beq .normal
ldy.b Scrap06 : cpy.b #$ff : beq +
lda.b Scrap01 : jsr LoadEastMidpoint : bra ++
+ lda.b Scrap01 : jsr LoadWestMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.normal
jsr PrepScrollToNormal
.scroll
lda $01 : and #$40 : pha
lda.b Scrap01 : and.b #$40 : pha
jsr ScrollY
pla : beq .end
ldy #$06 : jsr ApplyScroll
ldy.b #$06 : jsr ApplyScroll
.end
plb ; restore db register
rts
@@ -139,32 +139,32 @@ LoadRoomHorz:
LoadRoomVert:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
sty.b Scrap06 : sta.b Scrap07 : lda.b RoomIndex : pha ; Store normal room on stack
lda.b Scrap07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda.b Scrap00 : cmp.b #$03 : bne .gtg
jsr VertEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
sta.b RoomIndex : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$F0 : lsr #3 : !sub $21 : !add $06 : sta $02
lda.b RoomIndex : and.b #$F0 : lsr #3 : !SUB.b LinkPosY+1 : !ADD.b Scrap06 : sta.b Scrap02
lda $01 : and #$80 : beq .notEdge
ldy #$01 : jsr ShiftVariablesMainDir
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadSouthMidpoint : bra ++
+ lda $01 : jsr LoadNorthMidpoint
lda.b Scrap01 : and.b #$80 : beq .notEdge
ldy.b #$01 : jsr ShiftVariablesMainDir
ldy.b Scrap06 : cpy.b #$ff : beq +
lda.b Scrap01 : jsr LoadSouthMidpoint : bra ++
+ lda.b Scrap01 : jsr LoadNorthMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal
lda.b Scrap01 : and.b #$03 : cmp.b #$03 : bne .normal
jsr ScrollToInroomStairs
stz $046d
stz.w $046d
bra .end
.normal
ldy #$01 : jsr ShiftVariablesMainDir
ldy.b #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal
.scroll
lda $01 : and #$40 : sta $046d
lda.b Scrap01 : and.b #$40 : sta.w $046d
jsr ScrollX
.end
plb ; restore db register
@@ -173,14 +173,14 @@ LoadRoomVert:
LookupNewRoom: ; expects data offset to be in A
{
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
sta $00 ; offset in 00
lda $a2 : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and #$00FF ;we only want the low byte
asl #3 : sta $02 : !add $02 : !add $02 ;multiply by 24 (data size)
!add $00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta $00
and #$00FF : sta $a0 ; assign new room
rep #$30 : and.w #$00FF ;sanitize A reg (who knows what is in the high byte)
sta.b Scrap00 ; offset in 00
lda.b PreviousRoom : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and.w #$00FF ;we only want the low byte
asl #3 : sta.b Scrap02 : !ADD.b Scrap02 : !ADD.b Scrap02 ;multiply by 24 (data size)
!ADD.b Scrap00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta.b Scrap00
and.w #$00FF : sta.b RoomIndex ; assign new room
sep #$30
rts
}
@@ -190,14 +190,14 @@ LookupNewRoom: ; expects data offset to be in A
ShiftVariablesMainDir:
{
lda.w CoordIndex,y : tax
lda $21,x : !add $02 : sta $21,x ; coordinate update
lda.b LinkPosY+1,x : !ADD.b Scrap02 : sta.b LinkPosY+1,x ; coordinate update
lda.w CameraIndex,y : tax
lda $e3,x : !add $02 : sta $e3,x ; scroll register high byte
lda.b $e3,x : !ADD.b Scrap02 : sta.b $e3,x ; scroll register high byte
lda.w CamQuadIndex,y : tax
lda $0605,x : !add $02 : sta $0605,x ; high bytes of these guys
lda $0607,x : !add $02 : sta $0607,x
lda $0601,x : !add $02 : sta $0601,x
lda $0603,x : !add $02 : sta $0603,x
lda.w $0605,x : !ADD.b Scrap02 : sta.w $0605,x ; high bytes of these guys
lda.w $0607,x : !ADD.b Scrap02 : sta.w $0607,x
lda.w $0601,x : !ADD.b Scrap02 : sta.w $0601,x
lda.w $0603,x : !ADD.b Scrap02 : sta.w $0603,x
rts
}
@@ -205,12 +205,12 @@ ShiftVariablesMainDir:
ScrollToInroomStairs:
{
jsr PrepScrollToInroomStairs
ldy #$01 : jsr ShiftVariablesMainDir
ldy.b #$01 : jsr ShiftVariablesMainDir
jsr ScrollX
ldy #$00 : jsr ApplyScroll
lda $a0 : and #$0f : cmp #$0f : bne +
stz $e0 : stz $e2 ; special case camera fix
lda #$1f : sta $e1 : sta $e3
ldy.b #$00 : jsr ApplyScroll
lda.b RoomIndex : and.b #$0f : cmp.b #$0f : bne +
stz.b BG1H : stz.b BG2H ; special case camera fix
lda.b #$1f : sta.b BG1H+1 : sta.b BG2H+1
+
rts
}
@@ -219,48 +219,48 @@ ScrollToInroomStairs:
; Sets $02, $04, $05, $ee, $045e, $045f and things related to Y coordinate
PrepScrollToInroomStairs:
{
lda $01 : and #$30 : lsr #3 : tay
lda.w InroomStairsX,y : sta $04
lda.w InroomStairsX+1,y : sta $05
lda $06 : cmp #$ff : beq .south
lda.b Scrap01 : and.b #$30 : lsr #3 : tay
lda.w InroomStairsX,y : sta.b Scrap04
lda.w InroomStairsX+1,y : sta.b Scrap05
lda.b Scrap06 : cmp.b #$ff : beq .south
lda.w InroomStairsY+1,y : bne +
inc $045f ; flag indicating special screen transition
dec $02 ; shift variables further
stz $aa
lda $a8 : and #%11111101 : sta $a8
stz $0613 ; North scroll target
inc $0603 : inc $0607
dec $0619 : dec $061b
inc.w $045f ; flag indicating special screen transition
dec.b Scrap02 ; shift variables further
stz.b LinkQuadrantV
lda.b $a8 : and.b #%11111101 : sta.b $a8
stz.w CameraTargetS+1 ; North scroll target
inc.w $0603 : inc.w $0607
dec.w CameraScrollN+1 : dec.w CameraScrollS+1
+
lda.w InroomStairsY,y : !add #$20 : sta $20
!sub #$38 : sta $045e
lda $01 : and #$40 : beq +
lda $20 : !add #$20 : sta $20
stz $045f
lda.w InroomStairsY,y : !ADD.b #$20 : sta.b LinkPosY
!SUB.b #$38 : sta.w $045e
lda.b Scrap01 : and.b #$40 : beq +
lda.b LinkPosY : !ADD.b #$20 : sta.b LinkPosY
stz.w $045f
+
dec $21
dec.b LinkPosY+1
%StonewallCheck($1b)
bra ++
.south
lda.w InroomStairsY+1,y : beq +
inc $045f ; flag indicating special screen transition
inc $02 ; shift variables further
lda #$02 : sta $aa
lda $a8 : ora #%00000010 : sta $a8
inc $0611 ; South scroll target
dec $0603 : dec $0607
inc $0619 : inc $061b
inc.w $045f ; flag indicating special screen transition
inc.b Scrap02 ; shift variables further
lda.b #$02 : sta.b LinkQuadrantV
lda.b $a8 : ora.b #%00000010 : sta.b $a8
inc.w CameraTargetN+1 ; South scroll target
dec.w $0603 : dec.w $0607
inc.w CameraScrollN+1 : inc.w CameraScrollS+1
+
lda.w InroomStairsY,y : !sub #$20 : sta $20
!add #$38 : sta $045e
lda $01 : and #$40 : beq +
lda $20 : !sub #$20 : sta $20
stz $045f
lda.w InroomStairsY,y : !SUB.b #$20 : sta.b LinkPosY
!ADD.b #$38 : sta.w $045e
lda.b Scrap01 : and.b #$40 : beq +
lda.b LinkPosY : !SUB.b #$20 : sta.b LinkPosY
stz.w $045f
+
inc $21
inc.b LinkPosY+1
++
lda $01 : and #$04 : lsr #2 : sta $ee : bne +
stz $0476
lda.b Scrap01 : and.b #$04 : lsr #2 : sta.b LinkLayer : bne +
stz.w $0476
+ rts
}
@@ -268,13 +268,13 @@ PrepScrollToInroomStairs:
; Sets $04 $05 and $ee
PrepScrollToEdge:
{
sta $04 : lda $01 : and #$20 : beq +
lda #01
+ sta $05
lda $01 : and #$10 : beq +
lda #01
+ sta $ee : bne +
stz $0476
sta.b Scrap04 : lda.b Scrap01 : and.b #$20 : beq +
lda.b #01
+ sta.b Scrap05
lda.b Scrap01 : and.b #$10 : beq +
lda.b #01
+ sta.b LinkLayer : bne +
stz.w $0476
+ rts
}
@@ -282,56 +282,56 @@ PrepScrollToEdge:
; Sets $04 $05 and $ee, and $fe
PrepScrollToNormal:
{
lda $01 : sta $fe : and #$04 : lsr #2 : sta $ee ; trap door and layer
lda.b Scrap01 : sta.b $fe : and.b #$04 : lsr #2 : sta.b LinkLayer ; trap door and layer
bne +
stz $0476
+ stz $05 : lda #$78 : sta $04
lda $01 : and #$03 : beq .end
cmp #$02 : !bge +
lda #$f8 : sta $04 : bra .end
+ inc $05
stz.w $0476
+ stz.b Scrap05 : lda.b #$78 : sta.b Scrap04
lda.b Scrap01 : and.b #$03 : beq .end
cmp.b #$02 : !BGE +
lda.b #$f8 : sta.b Scrap04 : bra .end
+ inc.b Scrap05
.end rts
}
StraightStairsAdj:
{
stx $0464 : sty $012e ; what we wrote over
stx.w $0464 : sty.w SFX2 ; what we wrote over
lda.l DRMode : beq +
lda $045e : bne .toInroom
lda $046d : beq .noScroll
sta $22
ldy #$00 : jsr ApplyScroll
stz $046d
lda.w $045e : bne .toInroom
lda.w $046d : beq .noScroll
sta.b LinkPosX
ldy.b #$00 : jsr ApplyScroll
stz.w $046d
.noScroll
jsr GetTileAttribute : tax
lda $11 : cmp #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room
lda.b GameSubMode : cmp.b #$12 : beq .goingNorth
lda.b PreviousRoom : cmp.b #$51 : bne ++
rep #$20 : lda.w #$0018 : !ADD.b LinkPosY : sta.b LinkPosY : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax
++ lda.l StepAdjustmentDown, X : bra .end
; lda $ee : beq .end
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20
; lda.b LinkLayer : beq .end
; rep #$20 : lda.w #$ffe0 : !ADD.b LinkPosY : sta.b LinkPosY : sep #$20
.goingNorth
cpx #$00 : bne ++
lda $a0 : cmp #$51 : bne ++
lda #$36 : bra .end ; special fix for throne room
++ ldy $ee : cpy #$00 : beq ++
cpx.b #$00 : bne ++
lda.b RoomIndex : cmp.b #$51 : bne ++
lda.b #$36 : bra .end ; special fix for throne room
++ ldy.b LinkLayer : cpy.b #$00 : beq ++
inx
++ lda.l StepAdjustmentUp, X
.end
pha : lda $0462 : and #$04 : bne ++
pla : !add #$f6 : pha
++ pla : !add $0464 : sta $0464
pha : lda.w $0462 : and.b #$04 : bne ++
pla : !ADD.b #$f6 : pha
++ pla : !ADD.w $0464 : sta.w $0464
+ rtl
.toInroom
lda #$32 : sta $0464 : stz $045e
lda.b #$32 : sta.w $0464 : stz.w $045e
rtl
}
GetTileAttribute:
{
phk : pea.w .jslrtsreturn-1
pea.w $02802c
pea.w $82802c
jml CalculateTransitionLanding ; mucks with x/y sets a to Tile Attribute, I think
.jslrtsreturn
rts
@@ -352,15 +352,15 @@ StraightStairsFix:
{
pha
lda.l DRMode : bne +
pla : !add $20 : sta $20 : rtl ;what we wrote over
pla : !ADD.b LinkPosY : sta.b LinkPosY : rtl ;what we wrote over
+ pla : rtl
}
StraightStairLayerFix:
{
lda.l DRMode : beq +
lda $ee : rtl
+ lda $01c322, x : rtl ; what we wrote over
lda.b LinkLayer : rtl
+ lda.l LayerOfDestination+3, x : rtl ; what we wrote over
}
DoorToStraight:
@@ -369,61 +369,61 @@ DoorToStraight:
lda.l DRMode : beq .skip
pla : bne .end
pha
lda $a0 : cmp #$51 : bne .skip
lda #$04 : sta $4e
lda.b RoomIndex : cmp.b #$51 : bne .skip
lda.b #$04 : sta.b $4e
.skip pla
.end LDX.w $0418 : CMP.b #$02 ; what we wrote over
.end LDX.w TransitionDirection : CMP.b #$02 ; what we wrote over
rtl
}
DoorToInroom:
{
ldx $045e : bne .end
sta $0020, y ; what we wrote over
ldx.w $045e : bne .end
sta.w $0020, y ; what we wrote over
.end
ldx #$00 ; what we wrote over
ldx.b #$00 ; what we wrote over
rtl
}
DoorToInroomEnd:
{
ldy $045e : beq .vanilla
cmp $045e : bne .return
stz $045e ; clear
ldy.w $045e : beq .vanilla
cmp.w $045e : bne .return
stz.w $045e ; clear
.return
rtl
.vanilla
cmp $02c034, x ; what we wrote over
cmp.l UnderworldTransitionLandingCoordinate, x ; what we wrote over
rtl
}
StraightStairsTrapDoor:
{
lda $0464 : bne +
lda.w $0464 : bne +
; reset function
.reset phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml $028c73 ; $10D71 .reset label of Bank02
pea.w $82802c
jml ResetThenCacheRoomEntryProperties ; $10D71 .reset label of Bank02
.jslrtsreturn
lda $0468 : bne ++
lda $a0 : cmp.b #$ac : bne .animateTraps
lda $0403 : and.b #$20 : bne .animateTraps
lda $0403 : and.b #$10 : beq ++
lda.w TrapDoorFlag : bne ++
lda.b RoomIndex : cmp.b #$ac : bne .animateTraps
lda.w $0403 : and.b #$20 : bne .animateTraps
lda.w $0403 : and.b #$10 : beq ++
.animateTraps
lda #$05 : sta $11
inc $0468 : stz $068e : stz $0690
lda.b #$05 : sta.b GameSubMode
inc.w TrapDoorFlag : stz.w TileMapDoorPos : stz.w DoorTimer
++ JML Underworld_SetBossOrSancMusicUponEntry_long
+ JML Dungeon_ApproachFixedColor ; what we wrote over
}
InroomStairsTrapDoor:
{
lda $0200 : cmp #$05 : beq .reset
lda $b0 : jml $008781 ; what we wrote over (essentially)
lda.w SubModuleInterface : cmp.b #$05 : beq .reset
lda.b SubSubModule : jml JumpTableLocal ; what we wrote over (essentially)
.reset
pla : pla : pla
jsl StraightStairsTrapDoor_reset
jml $028b15 ; just some RTS in bank 02
jml $828b15 ; just some RTS in bank 02
}
HandleSpecialDoorLanding: {
@@ -436,7 +436,7 @@ HandleSpecialDoorLanding: {
PLA : PHA : AND.b #$FA : CMP.b #$80 : bne .noDoor
.setDoorState
LDA.w $0418 : AND.b #$02 : BNE + : INC
LDA.w TransitionDirection : AND.b #$02 : BNE + : INC
+ STA.b $6C
.noDoor

View File

@@ -1,9 +1,9 @@
GtBossHeartCheckOverride:
lda $a0 : cmp #$1c : beq ++
cmp #$6c : beq ++
cmp #$4d : bne +
++ lda.l DRFlags : and #$01 : bne ++ ;skip if flag on
lda $403 : ora #$80 : sta $403
lda.b RoomIndex : cmp.b #$1c : beq ++
cmp.b #$6c : beq ++
cmp.b #$4d : bne +
++ lda.l DRFlags : and.b #$01 : bne ++ ;skip if flag on
lda.w RoomItemsTaken : ora.b #$80 : sta.w RoomItemsTaken
++ clc
rtl
+ sec
@@ -11,92 +11,92 @@ rtl
OnFileLoadOverride:
jsl OnFileLoad ; what I wrote over
+ lda.l DRFlags : and #$02 : beq + ; Mirror Scroll
lda MirrorEquipment : bne +
lda #$01 : sta MirrorEquipment
+ lda.l DRFlags : and.b #$02 : beq + ; Mirror Scroll
lda.l MirrorEquipment : bne +
lda.b #$01 : sta.l MirrorEquipment
+ rtl
MirrorCheckOverride:
lda.l DRFlags : and #$02 : beq ++
lda MirrorEquipment : cmp #$01 : beq +
++ lda $8A : and #$40 ; what I wrote over
lda.l DRFlags : and.b #$02 : beq ++
lda.l MirrorEquipment : cmp.b #$01 : beq +
++ lda.b OverworldIndex : and.b #$40 ; what I wrote over
rtl
+ lda.l DRScroll : rtl
EGFixOnMirror:
lda.l DRFlags : and #$10 : beq +
stz $047a
lda.l DRFlags : and.b #$10 : beq +
stz.w LayerAdjustment
+ jsl Mirror_SaveRoomData
rtl
BlockEraseFix:
lda MirrorEquipment : and #$02 : beq +
stz $05fc : stz $05fd
lda.l MirrorEquipment : and.b #$02 : beq +
stz.w $05fc : stz.w $05fd
+ rtl
FixShopCode:
cpx #$300 : !bge +
sta RoomDataWRAM[$00].l, x
cpx.w #$0300 : !BGE +
sta.l RoomDataWRAM[$00].l, x
+ rtl
VitreousKeyReset:
LDA.l FixPrizeOnTheEyes : BEQ +
STZ.w $0CBA, X
+ JML $0DB818 ;restore old code - SpritePrep_LoadProperties
STZ.w SpriteForceDrop, X
+ JML SpritePrep_LoadProperties ; what we wrote over
GuruguruFix:
lda $a0 : cmp #$df : !bge +
and #$0f : cmp #$0e : !blt +
lda.b RoomIndex : cmp.b #$df : !BGE +
and.b #$0f : cmp.b #$0e : !BLT +
iny #2
+ rtl
BlindAtticFix:
lda.l DRMode : beq +
lda #$01 : rtl
+ lda FollowerIndicator : cmp.b #$06
lda.b #$01 : rtl
+ lda.l FollowerIndicator : cmp.b #$06
rtl
SuctionOverworldFix:
stz $50 : stz $5e
stz.b LinkStrafe : stz.b LinkSpeed
lda.l DRMode : beq +
stz $49
stz.b ForceMove
+ rtl
!CutoffTable = "$A7E000"
CutoffEntranceRug:
PHA : PHX
LDA.l DRMode : BEQ .norm
LDA $04 : cmp #$000A : BEQ + ; only affect A & C objects
cmp #$000C : BNE .norm
+ LDX #$0000 : LDA !CutoffTable, x
- CMP.b $A0 : BEQ .check
INX #2 : LDA !CutoffTable, x : CMP.w #$FFFF : BNE -
.norm PLX : PLA : LDA $9B52, y : STA $7E2000, x ; what we wrote over
RTL
LDA.b Scrap04 : CMP.w #$000A : BEQ + ; only affect A & C objects
CMP.w #$000C : BNE .norm
+ LDX.w #$0000 : LDA.l CutoffRooms, x
- CMP.b RoomIndex : BEQ .check
INX #2 : LDA.l CutoffRooms, x : CMP.w #$FFFF : BNE -
.norm
PLX : PLA : LDA.w $9B52, Y : STA.l TileMapA, X ; what we wrote over
RTL
.check
LDA $0c : CMP #$0004 : !BGE .skip
LDA $0e : CMP #$0008 : !BGE .skip
LDA.b Scrap0C : CMP.w #$0004 : !BGE .skip
LDA.b Scrap0E : CMP.w #$0008 : !BGE .skip
CMP.w #$0004 : !BLT .skip
BRA .norm
.skip PLX : PLA : RTL
.skip
PLX : PLA : RTL
StoreTempBunnyState:
LDA $5D : CMP #$1C : BNE +
STA $5F
+ LDA #$15 : STA $5D ; what we wrote over
LDA.b LinkState : CMP.b #$1C : BNE +
STA.b ManipTileField
+ LDA.b #$15 : STA.b LinkState ; what we wrote over
RTL
RetrieveBunnyState:
STY $5D : STZ $02D8 ; what we wrote over
LDA $5F : BEQ +
STA $5D
STY.b LinkState : STZ.w ItemReceiptID ; what we wrote over
LDA.b ManipTileField : BEQ +
STA.b LinkState
+ JML MaybeKeepLootID
; A should be how much dmg to do to Aga when leaving this function, 0 if prevented
StandardAgaDmg:
LDX.b #$00 ; part of what we wrote over
LDA.l ProgressFlags : AND #$04 : BNE .enableDamage ; zelda's been rescued, no further checks needed
LDA.l ProgressFlags : AND.b #$04 : BNE .enableDamage ; zelda's been rescued, no further checks needed
; zelda's not been rescued
LDA.l AllowAgaDamageBeforeZeldaRescued : BEQ + ; zelda needs to be rescued if not allowed
.enableDamage
@@ -104,8 +104,8 @@ StandardAgaDmg:
+ RTL
StandardSaveAndQuit:
LDA.b #$0F : STA.b $95 ; what we wrote over
LDA.l ProgressFlags : AND #$04 : BNE +
LDA.b #$0F : STA.b MOSAICQ ; what we wrote over
LDA.l ProgressFlags : AND.b #$04 : BNE +
LDA.l DRMode : BEQ +
LDA.l StartingEntrance : CMP.b #$02 : BCC +
LDA.b #$03 : STA.l StartingEntrance ; set spawn to uncle if >=
@@ -115,19 +115,19 @@ StandardSaveAndQuit:
BlindsAtticHint:
REP #$20
CMP.w #$0122 : BNE +
LDA RoomDataWRAM[$65].low : AND.w #$0100 : BEQ +
LDA.l RoomDataWRAM[$65].low : AND.w #$0100 : BEQ +
SEP #$20 : RTL ; skip the dialog box if the hole is already open
+ SEP #$20 : JML Main_ShowTextMessage
BlindZeldaDespawnFix:
CMP.b #06 : BEQ +
LDA.w $0D00,X : BEQ + ; don't despawn follower if maiden isn't "present"
LDA.w SpritePosYLow,X : BEQ + ; don't despawn follower if maiden isn't "present"
PLA : PLA : PEA.w SpritePrep_BlindMaiden_despawn_follower-1 : RTL
+ PLA : PLA : PEA.w SpritePrep_BlindMaiden_kill_the_girl-1 : RTL
BigKeyDoorCheck:
CPY.w #$001E : BNE + ; skip if it isn't a BK door
LDA.l DRFlags : AND #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided
LDA.l DRFlags : AND.w #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided
PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1
+ LDA.w #$0000 : RTL

View File

@@ -1,98 +1,98 @@
AdjustTransition:
{
lda $ab : and #$01ff : beq .reset
phy : ldy #$06 ; operating on vertical registers during horizontal trans
lda.b $ab : and.w #$01ff : beq .reset
phy : ldy.b #$06 ; operating on vertical registers during horizontal trans
cpx.b #$02 : bcs .horizontalScrolling
ldy #$00 ; operate on horizontal regs during vert trans
ldy.b #$00 ; operate on horizontal regs during vert trans
.horizontalScrolling
cmp #$0008 : bcs +
pha : lda $ab : and #$0200 : beq ++
cmp.w #$0008 : bcs +
pha : lda.b $ab : and.w #$0200 : beq ++
pla : bra .add
++ pla : eor #$ffff : inc ; convert to negative
++ pla : eor.w #$ffff : inc ; convert to negative
.add jsr AdjustCamAdd : ply : bra .reset
+ lda $ab : and #$0200 : xba : tax
+ lda.b $ab : and.w #$0200 : xba : tax
lda.l OffsetTable,x : jsr AdjustCamAdd
lda $ab : !sub #$0008 : sta $ab
lda.b $ab : !SUB.w #$0008 : sta.b $ab
ply : bra .done
.reset ; clear the $ab variable so to not disturb intra-tile doors
stz $ab
stz.b $ab
.done
lda $00 : and #$01fc
lda.b Scrap00 : and.w #$01fc
rtl
}
AdjustCamAdd:
!add $00E2,y : pha
and #$01ff : cmp #$0111 : !blt +
cmp #$01f8 : !bge ++
pla : and #$ff10 : pha : bra +
++ pla : and #$ff00 : !add #$0100 : pha
+ pla : sta $00E2,y : sta $00E0,y : rts
!ADD.w $00E2,y : pha
and.w #$01ff : cmp.w #$0111 : !BLT +
cmp.w #$01f8 : !BGE ++
pla : and.w #$ff10 : pha : bra +
++ pla : and.w #$ff00 : !ADD.w #$0100 : pha
+ pla : sta.w $00E2,y : sta.w $00E0,y : rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; $06 is either $ff or $01/02
; uses $00-$03 and $0e for calculation
; also set up $ac
ScrollY: ;change the Y offset variables
lda $a0 : and.b #$f0 : lsr #3 : sta $0603 : inc : sta $0607
lda.b RoomIndex : and.b #$f0 : lsr #3 : sta.w $0603 : inc : sta.w $0607
lda $05 : bne +
lda $603 : sta $00 : stz $01 : bra ++
+ lda $607 : sta $00 : lda #$02 : sta $01
lda.b Scrap05 : bne +
lda.w $0603 : sta.b Scrap00 : stz.b Scrap01 : bra ++
+ lda.w $0607 : sta.b Scrap00 : lda.b #$02 : sta.b Scrap01
++ ; $01 now contains 0 or 2 and $00 contains the correct lat
stz $0e
stz.b Scrap0E
rep #$30
lda $00 : pha
lda.b Scrap00 : pha
lda $e8 : and #$01ff : sta $02
lda $04 : jsr LimitYCamera : sta $00
lda.b BG2V : and.w #$01ff : sta.b Scrap02
lda.b Scrap04 : jsr LimitYCamera : sta.b Scrap00
jsr CheckRoomLayoutY : bcc +
lda $00 : cmp #$0080 : !bge ++
cmp #$0010 : !blt .cmpSrll
lda #$0010 : bra .cmpSrll
++ cmp #$0100 : !bge .cmpSrll
lda #$0100
.cmpSrll sta $00
lda.b Scrap00 : cmp.w #$0080 : !BGE ++
cmp.w #$0010 : !BLT .cmpSrll
lda.w #$0010 : bra .cmpSrll
++ cmp.w #$0100 : !BGE .cmpSrll
lda.w #$0100
.cmpSrll sta.b Scrap00
; figures out scroll amt
+ lda $00 : cmp $02 : bne +
lda #$0000 : bra .next
+ !blt +
!sub $02 : inc $0e : bra .next
+ lda $02 : !sub $00
+ lda.b Scrap00 : cmp.b Scrap02 : bne +
lda.w #$0000 : bra .next
+ !BLT +
!SUB.b Scrap02 : inc.b Scrap0E : bra .next
+ lda.b Scrap02 : !SUB.b Scrap00
.next
sta $ab
sta.b $ab
jsr AdjustCameraBoundsY
pla : sta $00
pla : sta.b Scrap00
sep #$30
lda $04 : sta $20
lda $00 : sta $21 : sta $0601 : sta $0605
lda $01 : sta $aa
lda $0e : asl : ora $ac : sta $ac
lda $e9 : and #$01 : asl #2 : tax : lda $0603, x : sta $e9
lda.b Scrap04 : sta.b $20
lda.b Scrap00 : sta.b $21 : sta.w $0601 : sta.w $0605
lda.b Scrap01 : sta.b $aa
lda.b Scrap0E : asl : ora.b $ac : sta.b $ac
lda.b BG2V+1 : and.b #$01 : asl #2 : tax : lda.w $0603, x : sta.b BG2V+1
rts
LimitYCamera:
cmp #$006c : !bge +
lda #$0000 : bra .end
+ cmp #$017d : !blt +
lda #$0110 : bra .end
+ !sub #$006c
cmp.w #$006c : !BGE +
lda.w #$0000 : bra .end
+ cmp.w #$017d : !BLT +
lda.w #$0110 : bra .end
+ !SUB.w #$006c
.end rts
CheckRoomLayoutY:
jsr LoadRoomLayout ;switches to 8-bit
cmp #$00 : beq .lock
cmp #$07 : beq .free
cmp #$01 : beq .free
cmp #$04 : !bge .lock
cmp #$02 : bne +
lda $06 : cmp #$ff : beq .lock
+ cmp #$03 : bne .free
lda $06 : cmp #$ff : bne .lock
cmp.b #$00 : beq .lock
cmp.b #$07 : beq .free
cmp.b #$01 : beq .free
cmp.b #$04 : !BGE .lock
cmp.b #$02 : bne +
lda.b Scrap06 : cmp.b #$ff : beq .lock
+ cmp.b #$03 : bne .free
lda.b Scrap06 : cmp.b #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
@@ -100,123 +100,123 @@ AdjustCameraBoundsY:
jsr CheckRoomLayoutY : bcc .free
; layouts that are camera locked (quads only)
lda $04 : and #$00ff : cmp #$007d : !blt +
lda #$0088 : bra ++
+ cmp #$006d : !bge +
lda #$0078 : bra ++
+ !add #$000b
lda.b Scrap04 : and.w #$00ff : cmp.w #$007d : !BLT +
lda.w #$0088 : bra ++
+ cmp.w #$006d : !BGE +
lda.w #$0078 : bra ++
+ !ADD.w #$000b
; I think we no longer need the $02 variable
++ sta $02 : lda $04 : and #$0100 : !add $02 : bra .setBounds
++ sta.b Scrap02 : lda.b Scrap04 : and.w #$0100 : !ADD.b Scrap02 : bra .setBounds
; layouts where the camera is free
.free lda $04 : cmp #$006c : !bge +
lda #$0077 : bra .setBounds
+ cmp #$017c : !blt +
lda #$0187 : bra .setBounds
+ !add #$000b
.setBounds sta $0618 : inc #2 : sta $061a
.free lda.b Scrap04 : cmp.w #$006c : !BGE +
lda.w #$0077 : bra .setBounds
+ cmp.w #$017c : !BLT +
lda.w #$0187 : bra .setBounds
+ !ADD.w #$000b
.setBounds sta.w $0618 : inc #2 : sta.w $061a
rts
LoadRoomLayout:
lda $a0 : asl : !add $a0 : tax
lda $1f8001, x : sta $b8
lda $1f8000, x : sta $b7
lda.b RoomIndex : asl : !ADD.b RoomIndex : tax
lda.l RoomData_ObjectDataPointers+1, x : sta.b $b8
lda.l RoomData_ObjectDataPointers, x : sta.b $b7
sep #$30
ldy #$01 : lda [$b7], y : and #$1c : lsr #2
ldy.b #$01 : lda.b [$b7], y : and.b #$1c : lsr #2
rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; uses $00-$03 and $0e for calculation
; also set up $ac
ScrollX: ;change the X offset variables
lda $a0 : and.b #$0f : asl : sta $060b : inc : sta $060f
lda.b RoomIndex : and.b #$0f : asl : sta.w $060b : inc : sta.w $060f
lda $05 : bne +
lda $60b : sta $00 : stz $01 : bra ++
+ lda $60f : sta $00 : lda #$01 : sta $01
lda.b Scrap05 : bne +
lda.w $060b : sta.b Scrap00 : stz.b Scrap01 : bra ++
+ lda.w $060f : sta.b Scrap00 : lda.b #$01 : sta.b Scrap01
++ ; $01 now contains 0 or 1 and $00 contains the correct long
stz $0e ; pos/neg indicator
stz.b Scrap0E ; pos/neg indicator
rep #$30
lda $00 : pha
lda.b Scrap00 : pha
lda $e2 : and #$01ff : sta $02
lda $04 : jsr LimitXCamera : sta $00
lda.b BG2H : and.w #$01ff : sta.b Scrap02
lda.b Scrap04 : jsr LimitXCamera : sta.b Scrap00
jsr CheckRoomLayoutX : bcc +
lda $00 : cmp #$0080 : !bge ++
lda #$0000 : bra .cmpSrll
++ lda #$0100
.cmpSrll sta $00
lda.b Scrap00 : cmp.w #$0080 : !BGE ++
lda.w #$0000 : bra .cmpSrll
++ lda.w #$0100
.cmpSrll sta.b Scrap00
;figures out scroll amt
+ lda $00 : cmp $02 : bne +
lda #$0000 : bra .next
+ !blt +
!sub $02 : inc $0e : bra .next
+ lda $02 : !sub $00
+ lda.b Scrap00 : cmp.b Scrap02 : bne +
lda.w #$0000 : bra .next
+ !BLT +
!SUB.b Scrap02 : inc.b Scrap0E : bra .next
+ lda.b Scrap02 : !SUB.b Scrap00
.next
sta $ab : lda $04
sta.b $ab : lda.b Scrap04
cmp #$0078 : !bge +
lda #$007f : bra ++
+ cmp #$0178 : !blt +
lda #$017f : bra ++
+ !add #$0007
++ sta $061c : inc #2 : sta $061e
cmp.w #$0078 : !BGE +
lda.w #$007f : bra ++
+ cmp.w #$0178 : !BLT +
lda.w #$017f : bra ++
+ !ADD.w #$0007
++ sta.w $061c : inc #2 : sta.w $061e
pla : sta $00
pla : sta.b Scrap00
sep #$30
lda $04 : ldx $046d : bne .straight
sta $22 : bra +
lda.b Scrap04 : ldx.w $046d : bne .straight
sta.b LinkPosX : bra +
.straight
sta $046d ; set X position later
sta.w $046d ; set X position later
+
lda $00 : sta $23 : sta $0609 : sta $060d
lda $01 : sta $a9
lda $0e : asl : ora $ac : sta $ac
lda $e3 : and #$01 : asl #2 : tax : lda $060b, x : sta $e3
lda.b Scrap00 : sta.b LinkPosX+1 : sta.w $0609 : sta.w $060d
lda.b Scrap01 : sta.b LinkQuadrantH
lda.b Scrap0E : asl : ora.b $ac : sta.b $ac
lda.b BG2H+1 : and.b #$01 : asl #2 : tax : lda.w $060b, x : sta.b BG2H+1
rts
LimitXCamera:
cmp #$0079 : !bge +
lda #$0000 : bra .end
+ cmp #$0178 : !blt +
lda #$0178
+ !sub #$0078
cmp.w #$0079 : !BGE +
lda.w #$0000 : bra .end
+ cmp.w #$0178 : !BLT +
lda.w #$0178
+ !SUB.w #$0078
.end rts
CheckRoomLayoutX:
jsr LoadRoomLayout ;switches to 8-bit
cmp #$04 : !blt .lock
cmp #$05 : bne +
lda $06 : cmp #$ff : beq .lock
+ cmp #$06 : bne .free
lda $06 : cmp #$ff : bne .lock
cmp.b #$04 : !BLT .lock
cmp.b #$05 : bne +
lda.b Scrap06 : cmp.b #$ff : beq .lock
+ cmp.b #$06 : bne .free
lda.b Scrap06 : cmp.b #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
ApplyScroll:
rep #$30
lda $ab : and #$01ff : sta $00
lda $ab : and #$0200 : beq +
lda $00e2, y : !add $00 : bra .end
+ lda $00e2, y : !sub $00
lda.b $ab : and.w #$01ff : sta.b Scrap00
lda.b $ab : and.w #$0200 : beq +
lda.w $00e2, y : !ADD.b Scrap00 : bra .end
+ lda.w $00e2, y : !SUB.b Scrap00
.end
sta $00e2, y
sta $00e0, y
stz $ab : sep #$30 : rts
sta.w $00e2, y
sta.w $00e0, y
stz.b $ab : sep #$30 : rts
QuadrantLoadOrderBeforeScroll:
lda $045f : beq .end
lda #$08 : sta $045c ; start with opposite quadrant row
lda.w $045f : beq .end
lda.b #$08 : sta.w $045c ; start with opposite quadrant row
.end
JML $0091c4 ; what we overwrote
JML WaterFlood_BuildOneQuadrantForVRAM ; what we overwrote
QuadrantLoadOrderAfterScroll:
lda $045f : beq .end
stz $045c : stz $045f ; draw other row and clear flag
lda.w $045f : beq .end
stz.w $045c : stz.w $045f ; draw other row and clear flag
.end
JML $0091c4 ; what we overwrote
JML WaterFlood_BuildOneQuadrantForVRAM ; what we overwrote

View File

@@ -1,103 +1,103 @@
RecordStairType: {
pha
lda.l DRMode : beq .norm
REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .norm
CMP #$00DF : BEQ .norm
REP #$30 : LDA.b PreviousRoom : CMP.w #$00E1 : BCS .norm
CMP.w #$00DF : BEQ .norm
SEP #$30
lda $0e
cmp #$25 : bcc ++ ; don't record straight staircases
sta $045e
lda.b Scrap0E
cmp.b #$25 : bcc ++ ; don't record straight staircases
sta.w $045e
++ pla : bra +
.norm SEP #$30 : pla : sta $a0
+ lda $063d, x
.norm SEP #$30 : pla : sta.b RoomIndex
+ lda.w $063d, x
rtl
}
SpiralWarp: {
lda.l DRMode : beq .abort ; abort if not DR
REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .abort
CMP #$00DF : BEQ .abort
REP #$30 : LDA.b PreviousRoom : CMP.w #$00E1 : BCS .abort
CMP.w #$00DF : BEQ .abort
SEP #$30
lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A!
cmp #$5f : beq .gtg
cmp #$26 : beq .inroom
lda.w $045e : cmp.b #$5e : beq .gtg ; abort if not spiral - intended room is in A!
cmp.b #$5f : beq .gtg
cmp.b #$26 : beq .inroom
.abort
SEP #$30 : stz $045e : lda $a2 : and.b #$0f : rtl ; clear,run hijacked code and get out
SEP #$30 : stz.w $045e : lda.b PreviousRoom : and.b #$0f : rtl ; clear,run hijacked code and get out
.inroom
jsr InroomStairsWarp
lda $a2 : and #$0f ; this is the code we are hijacking
lda.b PreviousRoom : and.b #$0f ; this is the code we are hijacking
rtl
.gtg
phb : phk : plb : phx : phy ; push stuff
jsr LookupSpiralOffset
rep #$30 : and #$00FF : asl #2 : tax
lda.w SpiralTable, x : sta $00
lda.w SpiralTable+2, x : sta $02
rep #$30 : and.w #$00FF : asl #2 : tax
lda.w SpiralTable, x : sta.b Scrap00
lda.w SpiralTable+2, x : sta.b Scrap02
sep #$30
lda $00 : sta $a0
lda.b Scrap00 : sta.b RoomIndex
; shift quadrant if necessary
stz $07 ; this is a x quad adjuster for those blasted staircase on the edges
lda $01 : and #$01 : !sub $a9
stz.b Scrap07 ; this is a x quad adjuster for those blasted staircase on the edges
lda.b Scrap01 : and.b #$01 : !SUB.b LinkQuadrantH
bne .xQuad
lda $0462 : and #$04 : bne .xqCont
inc $07
.xqCont lda $22 : bne .skipXQuad ; this is an edge case
dec $23 : bra .skipXQuad ; need to -1 if $22 is 0
.xQuad sta $06 : !add $a9 : sta $a9
lda $0462 : and #$04 : bne .xCont
inc $07 ; up stairs are going to -1 the quad anyway during transition, need to add this back
.xCont ldy #$00 : jsr ShiftQuadSimple
lda.w $0462 : and.b #$04 : bne .xqCont
inc.b Scrap07
.xqCont lda.b LinkPosX : bne .skipXQuad ; this is an edge case
dec.b LinkPosX+1 : bra .skipXQuad ; need to -1 if $22 is 0
.xQuad sta.b Scrap06 : !ADD.b LinkQuadrantH : sta.b LinkQuadrantH
lda.w $0462 : and.b #$04 : bne .xCont
inc.b Scrap07 ; up stairs are going to -1 the quad anyway during transition, need to add this back
.xCont ldy.b #$00 : jsr ShiftQuadSimple
.skipXQuad
lda $aa : lsr : sta $06 : lda $01 : and #$02 : lsr : !sub $06
lda.b LinkQuadrantV : lsr : sta.b Scrap06 : lda.b Scrap01 : and.b #$02 : lsr : !SUB.b Scrap06
beq .skipYQuad
sta $06 : asl : !add $aa : sta $aa
ldy #$01 : jsr ShiftQuadSimple
sta.b Scrap06 : asl : !ADD.b LinkQuadrantV : sta.b LinkQuadrantV
ldy.b #$01 : jsr ShiftQuadSimple
.skipYQuad
lda $01 : and #$04 : lsr : sta $048a ;fix layer calc 0->0 2->1
lda $01 : and #$08 : lsr #2 : sta $0492 ;fix from layer calc 0->0 2->1
lda.b Scrap01 : and.b #$04 : lsr : sta.w $048a ;fix layer calc 0->0 2->1
lda.b Scrap01 : and.b #$08 : lsr #2 : sta.w $0492 ;fix from layer calc 0->0 2->1
; shift lower coordinates
lda $02 : sta $22 : bne .adjY : lda $23 : !add $07 : sta $23
.adjY lda $03 : sta $20 : bne .upDownAdj : inc $21
.upDownAdj ldx #$08
lda $0462 : and #$04 : beq .upStairs
ldx #$fd
lda $01 : and #$80 : bne .set53
lda.b Scrap02 : sta.b LinkPosX : bne .adjY : lda.b LinkPosX+1 : !ADD.b Scrap07 : sta.b LinkPosX+1
.adjY lda.b Scrap03 : sta.b LinkPosY : bne .upDownAdj : inc.b LinkPosY+1
.upDownAdj ldx.b #$08
lda.w $0462 : and.b #$04 : beq .upStairs
ldx.b #$fd
lda.b Scrap01 : and.b #$80 : bne .set53
; if target is also down adjust by (6,-15)
lda #$06 : !add $20 : sta $20 : lda #$eb : !add $22 : sta $22 : bra .set53
lda.b #$06 : !ADD.b LinkPosY : sta.b LinkPosY : lda.b #$eb : !ADD.b LinkPosX : sta.b LinkPosX : bra .set53
.upStairs
lda $01 : and #$80 : beq .set53
lda.b Scrap01 : and.b #$80 : beq .set53
; if target is also up adjust by (-6, 14)
lda #$fa : !add $20 : sta $20 : lda #$14 : !add $22 : sta $22
bne .set53 : inc $23
lda.b #$fa : !ADD.b LinkPosY : sta.b LinkPosY : lda.b #$14 : !ADD.b LinkPosX : sta.b LinkPosX
bne .set53 : inc.b LinkPosX+1
.set53
txa : !add $22 : sta $53
txa : !ADD.b LinkPosX : sta.b $53
lda $01 : and #$10 : sta $07 ; zeroHzCam check
ldy #$00 : jsr SetCamera
lda $01 : and #$20 : sta $07 ; zeroVtCam check
ldy #$01 : jsr SetCamera
lda.b Scrap01 : and.b #$10 : sta.b Scrap07 ; zeroHzCam check
ldy.b #$00 : jsr SetCamera
lda.b Scrap01 : and.b #$20 : sta.b Scrap07 ; zeroVtCam check
ldy.b #$01 : jsr SetCamera
jsr StairCleanup
ply : plx : plb ; pull the stuff we pushed
lda $a2 : and #$0f ; this is the code we are hijacking
lda.b PreviousRoom : and.b #$0f ; this is the code we are hijacking
rtl
}
StairCleanup: {
stz $045e ; clear the staircase flag
stz.w $045e ; clear the staircase flag
; animated tiles fix
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1
tax : lda $02802e, x : tay
lda.l DRMode : cmp.b #$02 : bne + ; only do this in crossed mode
ldx.b RoomIndex : lda.l TilesetTable, x
cmp.w $0aa1 : beq + ; already eq no need to decomp
sta.w $0aa1
tax : lda.l AnimatedTileSheets, x : tay
jsl DecompDungAnimatedTiles
+
stz $047a
stz.w LayerAdjustment
rts
}
@@ -110,58 +110,58 @@ LookupSpiralOffset_long:
LookupSpiralOffset: {
;where link currently is in $a2: quad in a8 & #$03
;count doors
stz $00 : ldx #$00 : stz $01
stz.b Scrap00 : ldx.b #$00 : stz.b Scrap01
.loop
lda $047e, x : cmp $00 : bcc .continue
sta $00
lda.w $047e, x : cmp.b Scrap00 : bcc .continue
sta.b Scrap00
.continue inx #2
cpx #$08 : bcc .loop
cpx.b #$08 : bcc .loop
lda $00 : lsr
cmp #$01 : beq .done
lda.b Scrap00 : lsr
cmp.b #$01 : beq .done
; look up the quad
lda $a9 : ora $aa : and #$03 : beq .quad0
cmp #$01 : beq .quad1
cmp #$02 : beq .quad2
lda.b LinkQuadrantH : ora.b LinkQuadrantV : and.b #$03 : beq .quad0
cmp.b #$01 : beq .quad1
cmp.b #$02 : beq .quad2
bra .quad3
.quad0
inc $01 : lda $a2
cmp #$0c : beq .q0diff ;gt ent
cmp #$70 : bne .done ;hc stairwell
.q0diff lda $22 : cmp #$00 : beq .secondDoor
cmp #$98 : bcc .done ;gt ent and hc stairwell
.secondDoor inc $01 : bra .done
inc.b Scrap01 : lda.b PreviousRoom
cmp.b #$0c : beq .q0diff ;gt ent
cmp.b #$70 : bne .done ;hc stairwell
.q0diff lda.b LinkPosX : cmp.b #$00 : beq .secondDoor
cmp.b #$98 : bcc .done ;gt ent and hc stairwell
.secondDoor inc.b Scrap01 : bra .done
.quad1
lda $a2
cmp #$1a : beq .q1diff ;pod compass
cmp #$26 : beq .q1diff ;swamp elbows
cmp #$6a : beq .q1diff ;pod dark basement
cmp #$76 : bne .done ;swamp drain
.q1diff lda $22 : cmp #$98 : bcc .done
inc $01 : bra .done
lda.b PreviousRoom
cmp.b #$1a : beq .q1diff ;pod compass
cmp.b #$26 : beq .q1diff ;swamp elbows
cmp.b #$6a : beq .q1diff ;pod dark basement
cmp.b #$76 : bne .done ;swamp drain
.q1diff lda.b LinkPosX : cmp.b #$98 : bcc .done
inc.b Scrap01 : bra .done
.quad2
lda #$03 : sta $01 : lda $a2
cmp #$5f : beq .iceu ;ice u room
cmp #$3f : bne .done ;hammer ice exception
stz $01 : bra .done
.iceu lda $22 : cmp #$78 : bcc .done
inc $01 : bra .done
lda.b #$03 : sta.b Scrap01 : lda.b PreviousRoom
cmp.b #$5f : beq .iceu ;ice u room
cmp.b #$3f : bne .done ;hammer ice exception
stz.b Scrap01 : bra .done
.iceu lda.b LinkPosX : cmp.b #$78 : bcc .done
inc.b Scrap01 : bra .done
.quad3
lda $a2 : cmp #$40 : beq .done ; top of aga exception
lda #$02 : sta $01 ; always 2
lda.b PreviousRoom : cmp.b #$40 : beq .done ; top of aga exception
lda.b #$02 : sta.b Scrap01 ; always 2
.done
lda $a2 : tax : lda.w SpiralOffset,x
!add $01 ;add a thing (0 in easy case)
lda.b PreviousRoom : tax : lda.w SpiralOffset,x
!ADD.b Scrap01 ;add a thing (0 in easy case)
rts
}
InroomStairsWarp: {
phb : phk : plb : phx : phy ; push stuff
; find stairs by room and store index in X
lda $a0 : ldx #$07
lda.b RoomIndex : ldx.b #$07
.loop
cmp.w InroomStairsRoom,x
beq .found
@@ -169,94 +169,94 @@ InroomStairsWarp: {
bne .loop
.found
rep #$30
txa : and #$00ff : asl : tay
lda.w InroomStairsTable,y : sta $00
txa : and.w #$00ff : asl : tay
lda.w InroomStairsTable,y : sta.b Scrap00
sep #$30
sta $a0
sta.b RoomIndex
; set position and everything else based on target door type
txa : and #$01 : eor #$01 : sta $07
txa : and.b #$01 : eor.b #$01 : sta.b Scrap07
; should be the same as lda $0462 : and #$04 : lsr #2 : eor #$01 : sta $07
lda $01 : and #$80 : beq .notEdge
lda $07 : sta $03 : beq +
lda $01 : jsr LoadSouthMidpoint : sta $22 : lda #$f4
lda.b Scrap01 : and.b #$80 : beq .notEdge
lda.b Scrap07 : sta.b Scrap03 : beq +
lda.b Scrap01 : jsr LoadSouthMidpoint : sta.b LinkPosX : lda.b #$f4
bra ++
+
lda $01 : jsr LoadNorthMidpoint : sta $22 : dec $21 : lda #$f7
lda.b Scrap01 : jsr LoadNorthMidpoint : sta.b LinkPosX : dec.b LinkPosY+1 : lda.b #$f7
++
sta $20
lda $01 : and #$20 : beq +
lda #$01
sta.b LinkPosY
lda.b Scrap01 : and.b #$20 : beq +
lda.b #$01
+
sta $02
stz $07
lda $01 : and #$10 : lsr #4
sta.b Scrap02
stz.b Scrap07
lda.b Scrap01 : and.b #$10 : lsr #4
JMP .layer
.notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal
txa : and #$06 : sta $07
lda $01 : and #$30 : lsr #3 : tay
lda.w InroomStairsX+1,y : sta $02
lda.w InroomStairsY+1,y : sta $03
cpy $07 : beq .vanillaTransition
lda.w InroomStairsX,y : sta $22
lda.b Scrap01 : and.b #$03 : cmp.b #$03 : bne .normal
txa : and.b #$06 : sta.b Scrap07
lda.b Scrap01 : and.b #$30 : lsr #3 : tay
lda.w InroomStairsX+1,y : sta.b Scrap02
lda.w InroomStairsY+1,y : sta.b Scrap03
cpy.b Scrap07 : beq .vanillaTransition
lda.w InroomStairsX,y : sta.b LinkPosX
lda.w InroomStairsY,y
ldy $07 : beq +
!add #$07
ldy.b Scrap07 : beq +
!ADD #$07
+
sta $20
inc $07
sta.b LinkPosY
inc.b Scrap07
bra ++
.vanillaTransition
lda #$c0 : sta $07 ; leave camera
lda.b #$c0 : sta.b Scrap07 ; leave camera
++
%StonewallCheck($1b)
lda $01 : and #$04 : lsr #2
lda.b Scrap01 : and.b #$04 : lsr #2
bra .layer
.normal
lda $01 : sta $fe ; trap door
lda $07 : sta $03 : beq +
lda $01 : and #$04 : bne .specialFix
lda #$e0 : bra ++
lda.b Scrap01 : sta.b $fe ; trap door
lda.b Scrap07 : sta.b Scrap03 : beq +
lda.b Scrap01 : and.b #$04 : bne .specialFix
lda.b #$e0 : bra ++
.specialFix
lda #$c8 : bra ++
lda.b #$c8 : bra ++
+
%StonewallCheck($43)
lda $01 : and #$04 : bne +
lda #$1b : bra ++
+ lda #$33
++ sta $20
inc $07 : stz $02 : lda #$78 : sta $22
lda $01 : and #$03 : beq ++
cmp #$02 : !bge +
lda #$f8 : sta $22 : stz $07 : bra ++
+ inc $02
lda.b Scrap01 : and.b #$04 : bne +
lda.b #$1b : bra ++
+ lda.b #$33
++ sta.b LinkPosY
inc.b Scrap07 : stz.b Scrap02 : lda.b #$78 : sta.b LinkPosX
lda.b Scrap01 : and.b #$03 : beq ++
cmp.b #$02 : !BGE +
lda.b #$f8 : sta.b LinkPosX : stz.b Scrap07 : bra ++
+ inc.b Scrap02
++
lda $01 : and #$04 : lsr #2
lda.b Scrap01 : and.b #$04 : lsr #2
.layer
sta $ee
sta.b LinkLayer
bne +
stz $0476
stz.w $0476
+
lda $02 : !sub $a9
lda.b Scrap02 : !SUB.b LinkQuadrantH
beq .skipXQuad
sta $06 : !add $a9 : sta $a9
ldy #$00 : jsr ShiftQuadSimple
sta.b Scrap06 : !ADD.b LinkQuadrantH : sta.b LinkQuadrantH
ldy.b #$00 : jsr ShiftQuadSimple
.skipXQuad
lda $aa : lsr : sta $06 : lda $03 : !sub $06
lda.b LinkQuadrantV : lsr : sta.b Scrap06 : lda.b Scrap03 : !SUB.b Scrap06
beq .skipYQuad
sta $06 : asl : !add $aa : sta $aa
ldy #$01 : jsr ShiftQuadSimple
sta.b Scrap06 : asl : !ADD.b LinkQuadrantV : sta.b LinkQuadrantV
ldy.b #$01 : jsr ShiftQuadSimple
.skipYQuad
lda $07 : bmi .skipCamera
ldy #$00 : jsr SetCamera ; horizontal camera
ldy #$01 : sty $07 : jsr SetCamera ; vertical camera
lda $20 : cmp #$e0 : bcc +
lda $e8 : bne +
lda #$10 : sta $e8 ; adjust vertical camera at bottom
lda.b Scrap07 : bmi .skipCamera
ldy.b #$00 : jsr SetCamera ; horizontal camera
ldy.b #$01 : sty.b Scrap07 : jsr SetCamera ; vertical camera
lda.b LinkPosY : cmp.b #$e0 : bcc +
lda.b BG2V : bne +
lda.b #$10 : sta.b BG2V ; adjust vertical camera at bottom
+
.skipCamera
@@ -267,72 +267,72 @@ InroomStairsWarp: {
ShiftQuadSimple: {
lda.w CoordIndex,y : tax
lda $20,x : beq .skip
lda $21,x : !add $06 : sta $21,x ; coordinate update
lda.b LinkPosY,x : beq .skip
lda.b LinkPosY+1,x : !ADD.b Scrap06 : sta.b LinkPosY+1,x ; coordinate update
.skip
lda.w CamQuadIndex,y : tax
lda $0601,x : !add $06 : sta $0601,x
lda $0605,x : !add $06 : sta $0605,x ; high bytes of these guys
lda.w $0601,x : !ADD.b Scrap06 : sta.w $0601,x
lda.w $0605,x : !ADD.b Scrap06 : sta.w $0605,x ; high bytes of these guys
rts
}
SetCamera: {
stz $04
tyx : lda $a9,x : bne .nonZeroHalf
lda.w CamQuadIndex,y : tax : lda $607,x : pha
lda.w CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj
dec $e3,x
stz.b Scrap04
tyx : lda.b LinkQuadrantH,x : bne .nonZeroHalf
lda.w CamQuadIndex,y : tax : lda.w $0607,x : pha
lda.w CameraIndex,y : tax : pla : cmp.b BG2H+1, x : bne .noQuadAdj
dec.b BG2H+1,x
.noQuadAdj
lda $07 : bne .adj0
lda.b Scrap07 : bne .adj0
lda.w CoordIndex,y : tax
lda $20,x : beq .oddQuad
cmp #$79 : bcc .adj0
!sub #$78 : sta $04
tya : asl : !add #$04 : tax : jsr AdjCamBounds : bra .done
lda.b LinkPosY,x : beq .oddQuad
cmp.b #$79 : bcc .adj0
!SUB.b #$78 : sta.b Scrap04
tya : asl : !ADD.b #$04 : tax : jsr AdjCamBounds : bra .done
.oddQuad
lda #$80 : sta $04 : bra .adj1 ; this is such a weird case - quad cross boundary
lda.b #$80 : sta.b Scrap04 : bra .adj1 ; this is such a weird case - quad cross boundary
.adj0
tya : asl : tax : jsr AdjCamBounds : bra .done
.nonZeroHalf ;meaning either right half or bottom half
lda $07 : bne .setQuad
lda.b Scrap07 : bne .setQuad
lda.w CoordIndex,y : tax
lda $20,x : cmp #$78 : bcs .setQuad
!add #$78 : sta $04
lda.w CamQuadIndex,y : tax : lda $0603, x : pha
lda.w CameraIndex,y : tax : pla : sta $e3, x
lda.b LinkPosY,x : cmp.b #$78 : bcs .setQuad
!ADD.b #$78 : sta.b Scrap04
lda.w CamQuadIndex,y : tax : lda.w $0603, x : pha
lda.w CameraIndex,y : tax : pla : sta.b BG2H+1, x
.adj1
tya : asl : !add #$08 : tax : jsr AdjCamBounds : bra .done
tya : asl : !ADD.b #$08 : tax : jsr AdjCamBounds : bra .done
.setQuad
lda.w CamQuadIndex,y : tax : lda $0607, x : pha
lda.w CameraIndex,y : tax : pla : sta $e3, x
tya : asl : !add #$0c : tax : jsr AdjCamBounds : bra .done
lda.w CamQuadIndex,y : tax : lda.w $0607, x : pha
lda.w CameraIndex,y : tax : pla : sta.b BG2H+1, x
tya : asl : !ADD.b #$0c : tax : jsr AdjCamBounds : bra .done
.done
lda.w CameraIndex,y : tax
lda $04 : sta $e2, x
lda.b Scrap04 : sta.b BG2H, x
rts
}
; input, expects X to be an appropriate offset into the CamBoundBaseLine table
; when $04 is 0 no coordinate are added
AdjCamBounds: {
rep #$20 : lda.w CamBoundBaseLine, x : sta $05
lda $04 : and #$00ff : beq .common
rep #$20 : lda.w CamBoundBaseLine, x : sta.b Scrap05
lda.b Scrap04 : and.w #$00ff : beq .common
lda.w CoordIndex,y : tax
lda $20, x : and #$00ff : !add $05 : sta $05
lda.b LinkPosY, x : and.w #$00ff : !ADD.b Scrap05 : sta.b Scrap05
.common
lda.w OppCamBoundIndex,y : tax
lda $05 : sta $0618, x
inc #2 : sta $061A, x : sep #$20
lda.b Scrap05 : sta.w CameraScrollN, x
inc #2 : sta.w CameraScrollS, x : sep #$20
rts
}
SpiralPriorityHack: {
lda.l DRMode : beq +
lda #$01 : rtl ; always skip the priority code - until I figure out how to fix it
+ lda $0462 : and #$04 ; what we wrote over
lda.b #$01 : rtl ; always skip the priority code - until I figure out how to fix it
+ lda.w $0462 : and.b #$04 ; what we wrote over
rtl
}

View File

@@ -3,17 +3,17 @@
;--------------------------------------------------------------------------------
SpawnDungeonPrize:
PHX : PHB
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w ItemReceiptID
TAX
LDA.b #$29 : LDY.b #$06
JSL.l AddAncillaLong
JSL AddAncillaLong
BCS .failed_spawn
LDA.w ItemReceiptID
STA.w AncillaGet,X : STA.w SpriteID,X
JSR.w AddDungeonPrizeAncilla
JSR AddDungeonPrizeAncilla
.failed_spawn
PLB : PLX
RTL
@@ -22,21 +22,21 @@ AddDungeonPrizeAncilla:
LDY.w ItemReceiptID
STZ.w AncillaVelocityY,X
STZ.w AncillaVelocityX,X
STZ.w AncillaGeneral,X
STZ.w $0385,X
STZ.w $0C54,X
STZ.w AncillaGeneralF,X
STZ.w AncillaGeneralA,X
STZ.w AncillaGeneralN,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.b #$00 : STA.w AncillaGeneralD,X
LDA.w AncillaGet,X : STA.w ItemReceiptID
LDA.w DungeonID : CMP.b #$14 : BNE .not_hera
LDA.b LinkAbsoluteY+1 : AND.b #$FE
LDA.b LinkPosY+1 : AND.b #$FE
INC A
STA.b Scrap01
STZ.b Scrap00
LDA.b LinkAbsoluteX+1 : AND.b #$FE
LDA.b LinkPosX+1 : AND.b #$FE
INC A
STA.b Scrap03
STZ.b Scrap02
@@ -62,10 +62,10 @@ RTS
PrepPrizeTile:
PHA : PHX : PHY
LDA.w AncillaGet, X
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w SpriteID,X
JSL.l TransferItemReceiptToBuffer_using_ReceiptID
JSL TransferItemReceiptToBuffer_using_ReceiptID
PLY : PLX : PLA
RTL
@@ -75,12 +75,12 @@ SetItemPose:
LDA.w RoomItemsTaken : BIT.b #$80 : BNE +
.one_handed
PLA
JML $8799F2
JML Link_ReceiveItem_not_cool_pose
+
JSR.w CrystalOrPendantBehavior : BCC .one_handed
JSR CrystalOrPendantBehavior : BCC .one_handed
.two_handed
PLA
JML $8799EE ; cool pose
JML Link_ReceiveItem_cool_pose
SetPrizeCoords:
PHX : PHY
@@ -91,7 +91,7 @@ SetPrizeCoords:
LDY.w AncillaGet,X
RTL
+
JSR.w CrystalOrPendantBehavior : BCC .regular_coords
JSR CrystalOrPendantBehavior : BCC .regular_coords
PLY : PLX
LDY.b #$20 ; Treat as crystal
RTL
@@ -101,7 +101,7 @@ SetCutsceneFlag:
PHX
LDY.b #$01 ; wrote over
LDA.w DungeonID : BMI .no_cutscene
LDA.w RoomItemsTaken : BIT #$80 : BNE .dungeon_prize
LDA.w RoomItemsTaken : BIT.b #$80 : BNE .dungeon_prize
.no_cutscene
SEP #$30
PLX
@@ -109,7 +109,7 @@ SetCutsceneFlag:
RTL
.dungeon_prize
LDA.w ItemReceiptMethod : CMP.b #$03 : BCC .no_cutscene
JSR.w SetDungeonCompleted
JSR SetDungeonCompleted
LDA.w ItemReceiptID
REP #$30
AND.w #$00FF : ASL : TAX
@@ -120,9 +120,9 @@ RTL
AnimatePrizeCutscene:
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE +
JSR.w CrystalOrPendantBehavior : BCC +
JSR CrystalOrPendantBehavior : BCC +
LDA.w DungeonID : BMI +
LDA.w RoomItemsTaken : BIT #$80 : BEQ +
LDA.w RoomItemsTaken : BIT.b #$80 : BEQ +
SEC
RTL
+
@@ -131,7 +131,7 @@ RTL
PrizeDropSparkle:
LDA.w AncillaID,X : CMP.b #$29 : BNE .no_sparkle
JSR.w CrystalOrPendantBehavior : BCC .no_sparkle
JSR CrystalOrPendantBehavior : BCC .no_sparkle
SEC
RTL
.no_sparkle
@@ -139,8 +139,8 @@ PrizeDropSparkle:
RTL
HandleDropSFX:
LDA.w RoomItemsTaken : BIT #$80 : BEQ .no_sound
JSR.w CrystalOrPendantBehavior : BCC .no_sound
LDA.w RoomItemsTaken : BIT.b #$80 : BEQ .no_sound
JSR CrystalOrPendantBehavior : BCC .no_sound
SEC
RTL
.no_sound
@@ -159,7 +159,7 @@ RTL
MaybeKeepLootID:
PHA
LDA.w DungeonID : BMI .no_prize
LDA.w RoomItemsTaken : BIT #$80 : BNE .prize
LDA.w RoomItemsTaken : BIT.b #$80 : BNE .prize
.no_prize
STZ.w ItemReceiptID
STZ.w ItemReceiptPose
@@ -231,15 +231,15 @@ PrepPrizeOAMCoordinates:
STA.b Scrap04
REP #$20
LDA.w $029E,X
LDA.w AncillaZCoord,X
AND.w #$00FF
STA.b $72
STA.b ScrapBuffer72
LDA.b $00
STA.b $06
LDA.b Scrap00
STA.b Scrap06
SEC
SBC.b $72
STA.b $00
SBC.b ScrapBuffer72
STA.b Scrap00
SEP #$20
TXY

View File

@@ -18,14 +18,14 @@ DoDungeonMapBossIcon:
TAX
; get sprite pointer for room
LDA.l $89D62E,X
STA.b $00 ; pointer in $00
LDA.w #$0028 : STA.b $02 ; set the bank to 28 for now
LDA.l UWSpritesPointers,X
STA.b Scrap00 ; pointer in $00
LDA.w #$0028 : STA.b Scrap02 ; set the bank to 28 for now
LDY.w #$0001 ; to skip the "sort"
; get first byte to make sure it isn't an empty room
SEP #$20
LDA.b [$00], Y
LDA.b [Scrap00], Y
CMP.b #$FF
BNE ++
@@ -34,7 +34,7 @@ DoDungeonMapBossIcon:
; check first sprite
++ INY #2
LDA.b [$00], Y
LDA.b [Scrap00], Y
SEP #$10
; match boss id
@@ -99,13 +99,13 @@ DoDungeonMapBossIcon:
STA.w DAS1L
LDX.b #$02
STX.w MDMAEN
STX.w DMAENABLE
STA.w DAS1L
LDA.w #$A260>>1
STA.w VMADDL
STX.w MDMAEN
STX.w DMAENABLE
; done
SEP #$30

View File

@@ -2,7 +2,7 @@ NewElderCode:
{
LDA.b OverworldIndex : CMP.b #$1B : BEQ .newCodeContinue
;Restore Jump we can keep the RTL so JML
JML $85F0CD
JML Sprite_16_Elder
.newCodeContinue
PHB : PHK : PLB
LDA.b #$07 : STA.w SpriteOAMProp, X ; Palette
@@ -12,11 +12,10 @@ JSR Elder_Code
PLB
RTL
}
Elder_Draw:
{
LDA.b #$02 : STA.b Scrap06 : STZ.b Scrap07 ;Number of Tiles
LDA.w SpriteGFXControl, X : ASL #04
@@ -60,7 +59,7 @@ RTL
LDA.l GoalCounter
CMP.l GoalItemRequirement : !BLT +
SEP #$20
JSL.l ActivateGoal
JSL ActivateGoal
+
.dont_show

View File

@@ -17,56 +17,56 @@
macro DMA_VRAM(VRAM_HIGH,VRAM_LOW,SRC_BANK,SRC_HIGH,SRC_LOW,LENGTH_HIGH,LENGTH_LOW)
PHA
; --- preserve DMA registers ----------------------------------------------------
LDA !DMA0_REG : PHA
LDA !DMA0_DEST_REG : PHA
LDA !DMA0_SRC_LOW_REG : PHA
LDA !DMA0_SRC_HIGH_REG : PHA
LDA !DMA0_SRC_BANK_REG : PHA
LDA !DMA0_SIZE_LOW_REG : PHA
LDA !DMA0_SIZE_HIGH_REG : PHA
LDA.w !DMA0_REG : PHA
LDA.w !DMA0_DEST_REG : PHA
LDA.w !DMA0_SRC_LOW_REG : PHA
LDA.w !DMA0_SRC_HIGH_REG : PHA
LDA.w !DMA0_SRC_BANK_REG : PHA
LDA.w !DMA0_SIZE_LOW_REG : PHA
LDA.w !DMA0_SIZE_HIGH_REG : PHA
; -------------------------------------------------------------------------------
;LDA.b #$80 : STA !DISP_REG ; force vblank
LDA #$80 : STA !VMAIN_REG
;LDA.b #$80 : STA.w !DISP_REG ; force vblank
LDA.b #$80 : STA.w !VMAIN_REG
; write to vram at $<VRAM_HIGH><VRAM_LOW>
LDA <VRAM_LOW> : STA !VRAM_LOW_REG ; Set VRAM destination address low byte
LDA <VRAM_HIGH> : STA !VRAM_HIGH_REG ; Set VRAM destination address high byte
LDA.b <VRAM_LOW> : STA.w !VRAM_LOW_REG ; Set VRAM destination address low byte
LDA.b <VRAM_HIGH> : STA.w !VRAM_HIGH_REG ; Set VRAM destination address high byte
; Set DMA0 to write a word at a time.
LDA #$01
STA !DMA0_REG
LDA.b #$01
STA.w !DMA0_REG
; Write to $2118 & $2119 - VRAM Data Write Registers (Low) & VRAM Data Write Registers (High)
; setting word write mode on DMA0_REG causes a write to $2118 and then $2119
; $21xx is assumed
LDA #$18
STA !DMA0_DEST_REG
LDA.b !VRAM_WRITE_REG
STA.w !DMA0_DEST_REG
; Read from $<SRC_BANK>:<SRC_HIGH><SRC_LOW>.
LDA.b <SRC_LOW>
STA !DMA0_SRC_LOW_REG ; set src address low byte
STA.w !DMA0_SRC_LOW_REG ; set src address low byte
LDA.b <SRC_HIGH>
STA !DMA0_SRC_HIGH_REG ; set src address high byte
STA.w !DMA0_SRC_HIGH_REG ; set src address high byte
LDA.b <SRC_BANK>
STA !DMA0_SRC_BANK_REG ; set src address bank byte
STA.w !DMA0_SRC_BANK_REG ; set src address bank byte
; total bytes to copy: #$1000 bytes.
LDA <LENGTH_LOW> : STA $4305 ; length low byte
LDA <LENGTH_HIGH> : STA $4306 ; length high byte
LDA.b <LENGTH_LOW> : STA.w !DMA0_SIZE_LOW_REG ; length low byte
LDA.b <LENGTH_HIGH> : STA.w !DMA0_SIZE_HIGH_REG ; length high byte
; start DMA on channel 0
LDA #$01 ; channel select bitmask
STA !DMA_ENABLE_REG
LDA.b #$01 ; channel select bitmask
STA.w !DMA_ENABLE_REG
; --- restore DMA registers -----------------------------------------------------
PLA : STA !DMA0_SIZE_HIGH_REG
PLA : STA !DMA0_SIZE_LOW_REG
PLA : STA !DMA0_SRC_BANK_REG
PLA : STA !DMA0_SRC_HIGH_REG
PLA : STA !DMA0_SRC_LOW_REG
PLA : STA !DMA0_DEST_REG
PLA : STA !DMA0_REG
PLA : STA.w !DMA0_SIZE_HIGH_REG
PLA : STA.w !DMA0_SIZE_LOW_REG
PLA : STA.w !DMA0_SRC_BANK_REG
PLA : STA.w !DMA0_SRC_HIGH_REG
PLA : STA.w !DMA0_SRC_LOW_REG
PLA : STA.w !DMA0_DEST_REG
PLA : STA.w !DMA0_REG
; -------------------------------------------------------------------------------
PLA
endmacro

View File

@@ -8,21 +8,21 @@ NMIHookActionEnemizer:
SEP #$20 ; get into 8-bit mode
LDA !SHELL_DMA_FLAG : BEQ .return ; check our draw flag
AND #$01 : BNE .loadKholdstare
LDA !SHELL_DMA_FLAG : AND #$02 : BNE .loadTrinexx
LDA.l !SHELL_DMA_FLAG : BEQ .return ; check our draw flag
AND.b #$01 : BNE .loadKholdstare
LDA.l !SHELL_DMA_FLAG : AND.b #$02 : BNE .loadTrinexx
BRA .return ; just in case
;BIT #$01 : BEQ .loadKholdstare
;BIT #$02 : BEQ .loadTrinexx
;BIT.b #$01 : BEQ .loadKholdstare
;BIT.b #$02 : BEQ .loadTrinexx
.loadKholdstare
JSL DMAKholdstare
LDA #$00 : STA !SHELL_DMA_FLAG ; clear our draw flag
LDA.b #$00 : STA.l !SHELL_DMA_FLAG ; clear our draw flag
BRA .return
.loadTrinexx
JSL DMATrinexx
LDA #$00 : STA !SHELL_DMA_FLAG ; clear our draw flag
LDA.b #$00 : STA.l !SHELL_DMA_FLAG ; clear our draw flag
.return
PLP
@@ -33,7 +33,7 @@ NMIHookActionEnemizer:
; Sets DP to $0000
LDA.w #$0000 : TCD
JML.l NMIHookReturnEnemizer
JML NMIHookReturnEnemizer
}
DMAKholdstare:

View File

@@ -14,10 +14,10 @@ Initialize_Blind_Fight:
pullpc
check_blind_boss_room:
LDA $A0 ; load room index (low byte)
CMP #172 : BNE + ; Is is Thieves Town Boss Room
LDA !BLIND_DOOR_FLAG : BNE + ; Blind maiden does not need rescuing
LDA.b RoomIndex ; load room index (low byte)
CMP.b #$AC : BNE + ; Is is Thieves Town Boss Room
LDA.l !BLIND_DOOR_FLAG : BNE + ; Blind maiden does not need rescuing
LDA FollowerIndicator : JML Check_for_Blind_Fight
LDA.l FollowerIndicator : JML Check_for_Blind_Fight
+
JML Initialize_Blind_Fight

View File

@@ -5,15 +5,15 @@ change_heartcontainer_position:
{
PHA
LDA.l !CENTER_BOSS_DROP_FLAG : BEQ .not_moldorm_room
LDA.b #$78 : STA $0D10, X
STA $0D00, X
LDA.b #$78 : STA.w SpritePosXLow, X
STA.w SpritePosYLow, X
LDA $23 : STA $0D30, X
LDA $21 : STA $0D20, X
LDA.b LinkPosX+1 : STA.w SpritePosXHigh, X
LDA.b LinkPosY+1 : STA.w SpritePosYHigh, X
LDA $A0 : CMP #$07 : BNE .not_moldorm_room ; not moldorm room
LDA $22 : STA $0D10, X
LDA $20 : STA $0D00, X
LDA.b RoomIndex : CMP.b #$07 : BNE .not_moldorm_room ; not moldorm room
LDA.b LinkPosX : STA.w SpritePosXLow, X
LDA.b LinkPosY : STA.w SpritePosYLow, X
.not_moldorm_room

View File

@@ -6,99 +6,99 @@ boss_move:
; TODO: should probably double check that we don't need to preserve registers (A,X)...
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
LDA $A0 ; load room index (low byte)
LDX $A1 ; (high byte)
LDA.b RoomIndex ; load room index (low byte)
LDX.b RoomIndex+1 ; (high byte)
CMP #7 : BNE + ; Is is Hera Tower Boss Room
CPX #$00 : BNE +
CMP.b #7 : BNE + ; Is it Hera Tower Boss Room
CPX.b #$00 : BNE +
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_middle
+
CMP #200 : BNE + ; Is is Eastern Palace Boss Room
CMP.b #200 : BNE + ; Is it Eastern Palace Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_right
+
CMP #41 : BNE + ; Is is Skull Woods Boss Room
CMP.b #41 : BNE + ; Is it Skull Woods Boss Room
; TODO: Add moving floor sprite
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
LDA #$07 : STA $0B00;Spawn the moving floor sprite
STZ $0B28
INC $0B08
LDA.b #$07 : STA.w $0B00 ;Spawn the moving floor sprite
STZ.w $0B28
INC.w OverlordXLow
BRL .move_to_bottom_right
+
CMP #51 : BNE + ; Is is Desert Palace Boss Room
CMP.b #51 : BNE + ; Is it Desert Palace Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left
+
CMP #90 : BNE + ; Is is Palace of darkness Boss Room
CMP.b #90 : BNE + ; Is it Palace of darkness Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_right
+
CMP #144 : BNE + ; Is is Misery Mire Boss Room
CMP.b #144 : BNE + ; Is it Misery Mire Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left
+
CMP #172 : BNE + ; Is is Thieve Town Boss Room
CMP.b #172 : BNE + ; Is it Thieve Town Boss Room
; IF MAIDEN IS NOT RESCUED -> DO NOTHING
; IF MAIDEN IS ALREADY RESCUED -> spawn sprites normally
JSL Sprite_ResetAll ; removes sprites in thieve town boss room
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
;Close the door if !BLIND_DOOR_FLAG == 1
LDA !BLIND_DOOR_FLAG : BEQ .no_blind_door
INC $0468 ; $0468[0x02] - Flag that is set when trap doors are down.
STZ $068E ; $068E[0x02] - (Dungeon) ???? related to trap doors and if they are open ; possibly bomb doors too? Update: module 0x07.0x4 probably uses this to know whether it's a key door or big key door to open.
STZ $0690 ; $0690[0x02] - (Overworld) Generally is used as an animation step indicator, only for doors that animate when they open, such as the Santuary and Hyrule Castle doors. This variable is incremented up to a value of 3, at which point a logic check kicks in and stops animating the opening of a door.
INC $0CF3 ; $0CF3[0x01] - free ram
LDA.l !BLIND_DOOR_FLAG : BEQ .no_blind_door
INC.w TrapDoorFlag
STZ.w TileMapDoorPos
STZ.w DoorTimer
INC.w BossSpecialAction
; ;That must be called after the room load!
.no_blind_door
BRL .move_to_bottom_right
+
CMP #6 : BNE + ; Is is Swamp Palace Boss Room
CPX #$00 : BNE +
CMP.b #6 : BNE + ; Is it Swamp Palace Boss Room
CPX.b #$00 : BNE +
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left
+
CMP #222 : BNE + ; Is is Ice Palace Boss Room
CMP.b #222 : BNE + ; Is it Ice Palace Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_top_right
+
CMP #164 : BNE + ; Is is Turtle Rock Boss Room
CMP.b #164 : BNE + ; Is it Turtle Rock Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left
+
CMP #28 : BNE + ; Is is Gtower (Armos2) Boss Room
CPX #$00 : BNE +
CMP.b #28 : BNE + ; Is it Gtower (Armos2) Boss Room
CPX.b #$00 : BNE +
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_right
+
CMP #108 : BNE + ; Is is Gtower (Lanmo2) Boss Room
CMP.b #108 : BNE + ; Is it Gtower (Lanmo2) Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left
+
CMP #77 : BNE + ; Is is Gtower (Moldorm2) Boss Room
CMP.b #77 : BNE + ; Is it Gtower (Moldorm2) Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_middle
@@ -120,106 +120,106 @@ boss_move:
.move_to_middle
;load all sprite of that room and overlord
LDX #$00
LDX.b #$00
.loop_middle ; move sprites
LDA $0E20, X
LDA.w SpriteTypeTable, X
JSR ShouldMoveSprite : BCC .no_change
LDA $0D10, X : !ADD #$68 : STA $0D10, X
LDA $0D00, X : !ADD #$68 : STA $0D00, X
LDA.w SpritePosXLow, X : !ADD.b #$68 : STA.w SpritePosXLow, X
LDA.w SpritePosYLow, X : !ADD.b #$68 : STA.w SpritePosYLow, X
.no_change
INX : CPX #$10 : BNE .loop_middle
LDX #$00
INX : CPX.b #$10 : BNE .loop_middle
LDX.b #$00
.loop_middle2 ; move overlords
LDA $0B00, X
CMP #$E3 : BNE + ;is it moving floor?
LDA.w $0B00, X
CMP.b #$E3 : BNE + ;is it moving floor?
BRA .no_change_ov
+
LDA $0B08, X : !ADD #$68 : STA $0B08, X
LDA $0B18, X : !ADD #$68 : STA $0B18, X
LDA.w OverlordXLow, X : !ADD.b #$68 : STA.w OverlordXLow, X
LDA.w OverlordYLow, X : !ADD.b #$68 : STA.w OverlordYLow, X
.no_change_ov
INX : CPX #$08 : BNE .loop_middle2
INX : CPX.b #$08 : BNE .loop_middle2
BRL .return
.move_to_top_right
LDX #$00
LDX.b #$00
.loop_top_right ; move sprites
LDA $0E20, X
LDA.w SpriteTypeTable, X
JSR ShouldMoveSprite : BCC .no_change2
LDA $0D20, X : !ADD #$00 : STA $0D20, X
LDA $0D30, X : !ADD #$01 : STA $0D30, X
LDA.w SpritePosYHigh, X : !ADD.b #$00 : STA.w SpritePosYHigh, X
LDA.w SpritePosXHigh, X : !ADD.b #$01 : STA.w SpritePosXHigh, X
.no_change2
INX : CPX #$10 : BNE .loop_top_right
LDX #$00
INX : CPX.b #$10 : BNE .loop_top_right
LDX.b #$00
.loop_top_right2 ; move overlords
LDA $0B00, X
CMP #$E3 : BNE + ;is it moving floor?
LDA.w $0B00, X
CMP.b #$E3 : BNE + ;is it moving floor?
BRA .no_change_ov2
+
LDA $0B10, X : !ADD #$01 : STA $0B10, X
LDA $0B20, X : !ADD #$00 : STA $0B20, X
LDA.w OverlordXHigh, X : !ADD.b #$01 : STA.w OverlordXHigh, X
LDA.w OverlordYHigh, X : !ADD.b #$00 : STA.w OverlordYHigh, X
.no_change_ov2
INX : CPX #$08 : BNE .loop_top_right2
INX : CPX.b #$08 : BNE .loop_top_right2
BRL .return
.move_to_bottom_right
LDX #$00
LDX.b #$00
.loop_bottom_right ; move sprites
LDA $0E20, X
LDA.w SpriteTypeTable, X
JSR ShouldMoveSprite : BCC .no_change3
LDA $0D20, X : !ADD #$01 : STA $0D20, X
LDA $0D30, X : !ADD #$01 : STA $0D30, X
LDA.w SpritePosYHigh, X : !ADD.b #$01 : STA.w SpritePosYHigh, X
LDA.w SpritePosXHigh, X : !ADD.b #$01 : STA.w SpritePosXHigh, X
.no_change3
INX : CPX #$10 : BNE .loop_bottom_right
LDX #$00
INX : CPX.b #$10 : BNE .loop_bottom_right
LDX.b #$00
.loop_bottom_right2 ; move overlords
LDA $0B00, X
CMP #$E3 : BNE + ;is it moving floor?
LDA.w $0B00, X
CMP.b #$E3 : BNE + ;is it moving floor?
BRA .no_change_ov3
+
LDA $0B10, X : !ADD #$01 : STA $0B10, X
LDA $0B20, X : !ADD #$01 : STA $0B20, X
LDA.w OverlordXHigh, X : !ADD.b #$01 : STA.w OverlordXHigh, X
LDA.w OverlordYHigh, X : !ADD.b #$01 : STA.w OverlordYHigh, X
.no_change_ov3
INX : CPX #$08 : BNE .loop_bottom_right2
INX : CPX.b #$08 : BNE .loop_bottom_right2
BRL .return
.move_to_bottom_left
LDX #$00
LDX.b #$00
.loop_bottom_left ; move sprites
LDA $0E20, X
LDA.w SpriteTypeTable, X
JSR ShouldMoveSprite : BCC .no_change4
LDA $0D20, X : !ADD #$01 : STA $0D20, X
LDA $0D30, X : !ADD #$00 : STA $0D30, X
LDA.w SpritePosYHigh, X : !ADD.b #$01 : STA.w SpritePosYHigh, X
LDA.w SpritePosXHigh, X : !ADD.b #$00 : STA.w SpritePosXHigh, X
.no_change4
INX : CPX #$10 : BNE .loop_bottom_left
LDX #$00
INX : CPX.b #$10 : BNE .loop_bottom_left
LDX.b #$00
.loop_bottom_left2 ; move overlords
LDA $0B00, X
CMP #$E3 : BNE + ;is it moving floor?
LDA.w $0B00, X
CMP.b #$E3 : BNE + ;is it moving floor?
BRA .no_change_ov4
+
LDA $0B10, X : !ADD #$00 : STA $0B10, X
LDA $0B20, X : !ADD #$01 : STA $0B20, X
LDA.w OverlordXHigh, X : !ADD.b #$00 : STA.w OverlordXHigh, X
LDA.w OverlordYHigh, X : !ADD.b #$01 : STA.w OverlordYHigh, X
.no_change_ov4
INX : CPX #$08 : BNE .loop_bottom_left2
INX : CPX.b #$08 : BNE .loop_bottom_left2
BRL .return
@@ -232,7 +232,7 @@ boss_move:
; sets or clears carry flag, set if sprite should be moved
ShouldMoveSprite:
PHX
LDX #$FF
LDX.b #$FF
- INX : CPX.b #$0F : BCS .done
CMP.l BossIds, X : BNE -
; match found, move it
@@ -248,12 +248,12 @@ db $a2, $a3, $a4, $bd, $cb, $cc, $cd, $ff
; Fix the gibdo key drop in skull woods before the boss room - USELESS CODE
;--------------------------------------------------------------------------------
;gibdo_drop_key:
; LDA $A0 : CMP #$39 : BNE .no_key_drop ; Check if the room id is skullwoods before boss
; LDA $0DD0, X : CMP #$09 : BNE .no_key_drop ; Check if the sprite is alive
; LDA #$01 : STA $0CBA, X;set key
; LDA.b RoomIndex : CMP.b #$39 : BNE .no_key_drop ; Check if the room id is skullwoods before boss
; LDA.w SpriteAITable, X : CMP.b #$09 : BNE .no_key_drop ; Check if the sprite is alive
; LDA.b #$01 : STA.w SpriteForceDrop, X;set key
;
;.no_key_drop
; JSL $06DC5C ;Restore draw shadow
; JSL $86DC5C ;Restore draw shadow
; RTL
;--------------------------------------------------------------------------------
@@ -261,10 +261,10 @@ db $a2, $a3, $a4, $bd, $cb, $cc, $cd, $ff
; Set a flag to draw kholdstare shell on next NMI
;--------------------------------------------------------------------------------
new_kholdstare_code:
LDA $0CBA : BNE .already_iced
LDA #$01 : STA $0CBA
LDA.w SpriteForceDrop : BNE .already_iced
LDA.b #$01 : STA.w SpriteForceDrop
LDA #$01 : STA !SHELL_DMA_FLAG ; tell our NMI to draw the shell
LDA.b #$01 : STA.l !SHELL_DMA_FLAG ; tell our NMI to draw the shell
.already_iced
; restore code
@@ -276,14 +276,14 @@ new_kholdstare_code:
; Set a flag to draw trinexx shell on next NMI
;--------------------------------------------------------------------------------
new_trinexx_code:
LDA $0CBA : BNE .already_rocked
LDA #$01 : STA $0CBA
LDA.w SpriteForceDrop : BNE .already_rocked
LDA.b #$01 : STA.w SpriteForceDrop
LDA #$02 : STA !SHELL_DMA_FLAG ; tell our NMI to draw the shell
LDA.b #$02 : STA.l !SHELL_DMA_FLAG ; tell our NMI to draw the shell
.already_rocked
; restore code
LDA.b #$03 : STA $0DC0, X ; sprite_trinexx.asm (62) : LDA.b #$03 : STA $0DC0, X
LDA.b #$03 : STA.w SpriteGFXControl, X ; sprite_trinexx.asm (62) : LDA.b #$03 : STA $0DC0, X
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,32 +1,13 @@
; this is set inside randomizer application
; org $1AFBBB ;Increases chance of getting enemies under random bush
; db $01, $0F, $0F, $0F, $0F, $0F, $0F, $12
; db $0F, $01, $0F, $0F, $11, $0F, $0F, $03
; sprite_bush_spawn_table:
; {
; ; SPRITE DATA TABLE GENERATED BY ENEMIZER
; .overworld
; ; Skip 0x80(overworld) + 0x128 (dungeons)
; skip #$80
; .dungeons
; skip #$128
; ;Old sprite table - Could be changed as well (for the item id 04)
; .random_sprites ; if item == 04
; db #$00, #$D8, #$E3, #$D8
; }
sprite_bush_spawn:
{
STY $0D ; restored code
LDA !BUSHES_FLAG ; That byte is the flag to activate random enemies under bush
STY.b Scrap0D ; restored code
LDA.l !BUSHES_FLAG ; That byte is the flag to activate random enemies under bush
BNE .continue
CPY.b #$04 : BNE .not_random_old
JSL GetRandomInt : AND.b #$03 : !ADD.b #$13 : TAY
.not_random_old
LDA $81F3, Y;restored code
LDA.w $81F3, Y;restored code
RTL
.continue
@@ -49,13 +30,13 @@ sprite_bush_spawn:
BRA .return
.newSpriteSpawn
LDA $7E040A : TAY ; load the area ID
LDA $7EF3C5 : CMP.b #$03 : !BLT .dontGoPhase2 ; check if agahnim 1 is alive
LDA.l OverworldIndexMirror : TAY ; load the area ID
LDA.l ProgressIndicator : CMP.b #$03 : !BLT .dontGoPhase2 ; check if agahnim 1 is alive
; aga1 is dead
LDA $7E040A : CMP.b #$40 : !BGE .dontGoPhase2 ; check if we are in DW, if so we can skip shifting table index
!ADD #$90 : TAY ; agahnim 1 is dead, so we need to go to the 2nd phase table for LW
LDA.l OverworldIndexMirror : CMP.b #$40 : !BGE .dontGoPhase2 ; check if we are in DW, if so we can skip shifting table index
!ADD.b #$90 : TAY ; agahnim 1 is dead, so we need to go to the 2nd phase table for LW
.dontGoPhase2
LDA sprite_bush_spawn_table_overworld, Y ;LDA 408000 + area id
LDA.w sprite_bush_spawn_table_overworld, Y ;LDA 408000 + area id
.return
PLB ; restore bank to where it was

View File

@@ -2,10 +2,10 @@ CheckIfLinkShouldDie:
; before this we should have:
; LDA $7EF36D - this gets hooked, but we should have LDA at the end of it
CMP $00 : BCC .dead
SEC : SBC $00
CMP.b Scrap00 : BCC .dead
SEC : SBC.b Scrap00
BRA .done
.dead
LDA #$00
LDA.b #$00
.done
RTL

View File

@@ -6,13 +6,11 @@ JSL CheckFallingDeathFlag
org $86FBF8
JSL CheckFallingDeathFlag
Sprite_ManuallySetDeathFlagUW = $89C2F5
pullpc
CheckFallingDeathFlag:
LDA.l !ENEMY_FALLING_STAY_ALIVE
BEQ +
RTL
+ JML.l Sprite_ManuallySetDeathFlagUW ; original code
+ JML Sprite_ManuallySetDeathFlagUW ; original code

View File

@@ -2,8 +2,8 @@
; NMI Hook
;--------------------------------------------------------------------------------
; rando already hooks the Bank00.asm : 164 (PHA : PHX : PHY : PHD : PHB) so we have to hook after that
org $0080D0 ; <- D0 - Bank00.asm : 164-167 (PHB, LDA.w #$0000)
JML.l NMIHookActionEnemizer
org $0080D5 ; <- D5 - Bank00.asm : 164-167 (PHB, LDA.w #$0000)
org $8080D0 ; <- D0 - Bank00.asm : 164-167 (PHB, LDA.w #$0000)
JML NMIHookActionEnemizer
org $8080D5 ; <- D5 - Bank00.asm : 164-167 (PHB, LDA.w #$0000)
NMIHookReturnEnemizer:
;--------------------------------------------------------------------------------

View File

@@ -2,10 +2,10 @@
; Blind door close
;--------------------------------------------------------------------------------
;
org $028849 ; Bank02.asm(1588) - original code : JSL $078000 //Hook on player main when transition are over execute player code
org $828849 ; Bank02.asm(1588) - original code : JSL $078000 //Hook on player main when transition are over execute player code
JSL check_special_action ;using the variable 7E0CF3 if it not 00 then trap the player in that room
;could be changed easily to support more than only 1 function
;--------------------------------------------------------------------------------
org $078000
org $878000
Player_Main:

View File

@@ -1,6 +1,6 @@
;================================================================================
; Change heart container drop location
;--------------------------------------------------------------------------------
org $05EF62
org $85EF62
JSL change_heartcontainer_position
;--------------------------------------------------------------------------------

View File

@@ -1,31 +1,9 @@
; ;================================================================================
; ; insert kholdstare & trinexx shell gfx file
; ;--------------------------------------------------------------------------------
; ; pc file address = 0x123000
; org $24B000
; GFX_Kholdstare_Shell:
; incbin shell.gfx
; warnpc $24C001 ; should have written 0x1000 bytes and apparently we need to go 1 past that or it'll yell at us
; org $24C000
; GFX_Trinexx_Shell:
; incbin rocks.gfx
; warnpc $24C801
; GFX_Trinexx_Shell2:
; incbin rocks2.gfx
; warnpc $24C8C1
; ;--------------------------------------------------------------------------------
; ; *$4C290-$4C2D4 LOCAL
; Dungeon_LoadSprites:
; *$4C114-$4C174 LONG
org $9C114
org $89C114
Dungeon_ResetSprites: ; Bank09.asm(822)
; *$4C44E-$4C498 LONG
org $9C44E
org $89C44E
Sprite_ResetAll: ; Bank09.asm(1344)
;--------------------------------------------------------------------------------
@@ -33,13 +11,13 @@ Sprite_ResetAll: ; Bank09.asm(1344)
;================================================================================
; On Room Transition -> Move Sprite depending on the room loaded
;--------------------------------------------------------------------------------
org $028979 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
org $828979 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
JSL boss_move
org $028C16 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
org $828C16 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
JSL boss_move
org $029338 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
org $829338 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
JSL boss_move
org $028256 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
org $828256 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
JSL boss_move
;--------------------------------------------------------------------------------
@@ -48,10 +26,10 @@ JSL boss_move
;================================================================================
; Draw kholdstare shell
;--------------------------------------------------------------------------------
org $0DD97F ; jump point
org $8DD97F ; jump point
Kholdstare_Draw:
org $1E9518 ; sprite_kholdstare.asm (154) : JSL Kholdstare_Draw
org $9E9518 ; sprite_kholdstare.asm (154) : JSL Kholdstare_Draw
JSL new_kholdstare_code ; Write new gfx in the vram
;--------------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
;================================================================================
; New bush mob randomization
;--------------------------------------------------------------------------------
org $068279
org $868279
NOP #$0A
JSL sprite_bush_spawn
NOP ; we keep the branch

View File

@@ -1,12 +1,12 @@
org $780CA ; Bank07.asm(179)
org $8780CA ; Bank07.asm(179)
JSL CheckIfLinkShouldDie : NOP : NOP : NOP
;SEC : SBC.b $00 : CMP #$00 : BEQ .linkIsDead ; Bank07.asm(179) -
;SEC : SBC.b Scrap00 : CMP.b #$00 : BEQ .linkIsDead ; Bank07.asm(179) -
org $780D1
org $8780D1
BNE linkNotDead : NOP : NOP ; Bank07.asm(183) - CMP.b #$A8 : BCC .linkNotDead
org $780D5
org $8780D5
linkIsDead:
org $780F7
org $8780F7
linkNotDead:

View File

@@ -1,17 +1,17 @@
; adjust oam position after drawing eyes
;ED88E
org $1DD88E
org $9DD88E
{
; original: GiantMoldorm_Draw+5lines (sprite_giant_moldorm.asm)
; lda $90 : add.w #$0008 : sta $90
; INC $92 : INC $92
; lda.b $90 : add.w #$0008 : sta.b $90
; INC.b $92 : INC.b $92
JSL Moldorm_UpdateOamPosition
NOP #08
}
; set number of eyes
;org $1DDBB2 ;$0EDBB2
;org $9DDBB2 ;$0EDBB2
;{
; LDX.b #$01
; number of eyes (-1)

View File

@@ -1,45 +1,45 @@
org $9C50B ; 0x4C50B
org $89C50B ; 0x4C50B
{
; .loadData
; ; $4C50B-
; STA $01 ; 85 01
; STA.b Scrap01 ; 85 01
; ; $4C50D-
; LDY.w #$0000 ; A0 00 00
JSL LoadOverworldSprites
NOP
}
org $9C510 ; 0x4C510
LDA [$00], Y ; replace LDA ($00), Y
org $89C510 ; 0x4C510
LDA.b [Scrap00], Y ; replace LDA ($00), Y
; CMP.b #$FF : BEQ .stopLoading
; INY #2
org $9C518 ; 0x4C518
LDA [$00], Y ; replace LDA ($00), Y
org $89C518 ; 0x4C518
LDA.b [Scrap00], Y ; replace LDA ($00), Y
; DEY #2 : CMP.b #$F4 : BNE .notFallingRocks
; INC $0FFD
; INC.w $0FFD
; INY #3
; BRA .nextSprite
; .notFallingRocks ; Anything other than falling rocks.
org $9C528 ; 0x4C528
LDA [$00], Y ; replace LDA ($00), Y
org $89C528 ; 0x4C528
LDA.b [Scrap00], Y ; replace LDA ($00), Y
; PHA : LSR #4 : ASL #2 :
org $9C531 ; 0x4C531
STA $0A ; STA $02
org $89C531 ; 0x4C531
STA.b Scrap0A ; STA.b $02
; INY
org $9C534 ; 0x4C534
LDA [$00], Y ; replace LDA ($00), Y
org $89C534 ; 0x4C534
LDA.b [Scrap00], Y ; replace LDA ($00), Y
; LSR #4 : CLC
org $9C53B ; 0x4C53B
ADC $0A ; ADC $02
; STA $06
; PLA : ASL #4 : STA $07
org $9C546 ; 0x4C546
LDA [$00], Y ; replace LDA ($00), Y
; AND.b #$0F : ORA $07 : STA $05
org $89C53B ; 0x4C53B
ADC.b Scrap0A ; ADC.b $02
; STA.b $06
; PLA : ASL #4 : STA.b $07
org $89C546 ; 0x4C546
LDA.b [Scrap00], Y ; replace LDA ($00), Y
; AND.b #$0F : ORA.b $07 : STA.b $05
; INY
org $9C54F ; 0x4C54F
LDA [$00], Y ; replace LDA ($00), Y
; LDX $05 : INC A : STA $7FDF80, X
org $89C54F ; 0x4C54F
LDA.b [Scrap00], Y ; replace LDA ($00), Y
; LDX.b Scrap05 : INC A : STA.l $7FDF80, X
; ; $4C558-
; ; Move on to the next sprite / overlord.

View File

@@ -1,66 +1,66 @@
org $09C29A
org $89C29A
JSL LoadUnderworldSprites : NOP
; these hooks change the LDA.b ($00) commands to use LDA.b [$00] commands
; so we can store the sprites in a different bank
; also needs to change the use of $02 to $03 for slot index to make that possible
org $09C2B2
LDA.b [$00]
org $89C2B2
LDA.b [Scrap00]
org $09C2C1
LDA.b [$00],Y
org $89C2C1
LDA.b [Scrap00],Y
org $09C2CA
INC.b $03 ; change slot variable to $03
org $89C2CA
INC.b Scrap03 ; change slot variable to $03
;org $09C329 standing items overwrote this one
;LDA.b [$00],Y
;LDA.b [Scrap00],Y
org $09C332
LDA.b [$00],Y
org $89C332
LDA.b [Scrap00],Y
org $09C345
DEC.b $03 : LDX.b $03
org $89C345
DEC.b Scrap03 : LDX.b Scrap03
org $09C350
LDA.b [$00],Y
org $89C350
LDA.b [Scrap00],Y
org $09C35A
DEC.b $03
org $89C35A
DEC.b Scrap03
org $09C36E
org $89C36E
JSL GetSpriteSlot16Bit ; depended on high bit being zero, which it isn't anymore
org $09C383
LDX.b $03
org $89C383
LDX.b Scrap03
org $09C38C
LDA.b [$00],Y
org $89C38C
LDA.b [Scrap00],Y
org $09C398
LDA.b [$00],Y
org $89C398
LDA.b [Scrap00],Y
org $09C3AA
LDA.b [$00],Y
org $89C3AA
LDA.b [Scrap00],Y
org $09C3BF
LDA.b [$00],Y
org $89C3BF
LDA.b [Scrap00],Y
org $09C3DF
LDA.b $03
org $89C3DF
LDA.b Scrap03
org $09C3F3
LDA.b [$00],Y
org $89C3F3
LDA.b [Scrap00],Y
org $09C3FB
LDA.b [$00],Y
org $89C3FB
LDA.b [Scrap00],Y
org $09C404
LDA.b [$00],Y
org $89C404
LDA.b [Scrap00],Y
org $09C416
LDA.b [$00],Y
org $89C416
LDA.b [Scrap00],Y

View File

@@ -2,7 +2,7 @@ pushpc
org $9EC147
JSL NewKodongoCollision
JMP.w .continue : NOP #2
JMP .continue : NOP #2
.continue
org $9EC152
@@ -11,9 +11,9 @@ Kodongo_SetDirection:
pullpc
NewKodongoCollision:
LDA $0DE0, X : INC A : AND.b #$03 : STA $0DE0, X
LDA.w SpriteMoveDirection, X : INC A : AND.b #$03 : STA.w SpriteMoveDirection, X
;If they collide more than 4 times just set direction
LDA $0DA0, X : INC A : STA $0DA0, X : CMP #$04 : BCC .continue
LDA.w SpriteAuxTable, X : INC A : STA.w SpriteAuxTable, X : CMP.b #$04 : BCC .continue
PLA : PLA : PEA.w Kodongo_SetDirection-1
.continue
RTL

View File

@@ -2,13 +2,6 @@
lorom
;================================================================================
!ADD = "CLC : ADC"
!SUB = "SEC : SBC"
!BLT = "BCC"
!BGE = "BCS"
;=Constants======================================================================
!BUSHES_FLAG = "$368100"
@@ -59,8 +52,8 @@ incsrc falling_death.asm
incsrc shell_gfx.asm
warnpc $B6FFFF ;if we hit this we need to split stuff by bank
org $0684BD
org $8684BD
Sprite_Get16BitCoords_long:
org $1EC6FA ;F46FA
org $9EC6FA ;F46FA
SpritePrep_Eyegore:

View File

@@ -1,36 +1,34 @@
pushpc
org $0691B6
org $8691B6
SpritePrep_Eyegore_bounce:
JSL SpritePrep_EyegoreNew
org $068839 ; 0xEF
dw #$91B6 ; New sprite_prep
dw #$91B6 ; New sprite_prep
org $868839 ; 0xEF
dw SpritePrep_Eyegore_bounce
dw SpritePrep_Eyegore_bounce
;org $069468 ; These need to go else where
;org $869468 ; These need to go else where
;dw #$BFF7 ; SpriteModule_Active_Bank1E_bounce
;dw #$BFF7 ; SpriteModule_Active_Bank1E_bounce
;org $1E8B21
;org $9E8B21
;JSL FixVectorForMimics
;org $1E8BBB ; New vectors for mimics
;org $9E8BBB ; New vectors for mimics
;dw #$C795
;dw #$C795
org $0DB818
SpritePrep_LoadProperties:
org $1EC70D
org $9EC70D
SpritePrep_Eyegore_become_mimic:
;org $06EC08 ; Sprite_AttemptZapDamage
;org $86EC08 ; Sprite_AttemptZapDamage
;JSL resetSprite_Mimic : NOP
org $06ED9E ; Sprite_ApplyCalculatedDamage, skip high sprite id early exit
org $86ED9E ; Sprite_ApplyCalculatedDamage, skip high sprite id early exit
JSL IsItReallyAMimic : NOP
org $06EDA6 ; Sprite_ApplyCalculatedDamage .not_absorbable
org $86EDA6 ; Sprite_ApplyCalculatedDamage .not_absorbable
JSL notItemSprite_Mimic
pullpc
@@ -47,65 +45,65 @@ pullpc
; replace SpritePrep_Eyegore if flag is on
SpritePrep_EyegoreNew:
{
LDA !ENABLE_MIMIC_OVERRIDE : BNE .new
LDA.l !ENABLE_MIMIC_OVERRIDE : BNE .new
; old
JSL SpritePrep_Eyegore
RTL
.new
LDA $0E20, X : CMP.b #$EF : BCS .mimic ;If sprite id >= EF (unused somaria platform)
LDA.w SpriteTypeTable, X : CMP.b #$EF : BCS .mimic ;If sprite id >= EF (unused somaria platform)
; seems unnecessary it's just an rtl?
; JSL $1EC71A ; 0xF471A set eyegore to be only eyegore (.not_goriya?)
; JSL $9EC71A ; 0xF471A set eyegore to be only eyegore (.not_goriya?)
RTL
.mimic
SBC.b #$6C : STA $0E20, X : JSL SpritePrep_LoadProperties ; pretending to be $83 or $84
SBC.b #$6C : STA.w SpriteTypeTable, X : JSL SpritePrep_LoadProperties ; pretending to be $83 or $84
JSL SpritePrep_Eyegore_become_mimic
; LDA.w $0E20, X : ADC #$6C : STA $0E20, X ; set the sprite back to special mimic
; LDA.w SpriteTypeTable, X : ADC.b #$6C : STA.w SpriteTypeTable, X ; set the sprite back to special mimic
; todo? unsure about this code - seems unnecessary
; LDA $0CAA, X : AND #$FB : ORA #$80 : STA $0CAA, X ; STZ $0CAA, X
; LDA.w $0CAA, X : AND.b #$FB : ORA.b #$80 : STA.w $0CAA, X ; STZ.w $0CAA, X
RTL
}
;resetSprite_Mimic:
; LDA !ENABLE_MIMIC_OVERRIDE : BEQ .notMimic ; skip to what it would have done normally
; LDA.l !ENABLE_MIMIC_OVERRIDE : BEQ .notMimic ; skip to what it would have done normally
;
; LDA $0E20, X
; LDA.w SpriteTypeTable, X
; CMP.b #$EF : BCC .notMimic
; LDA $0E20, X : SBC.b #$6C : STA $0E20, X ; overwrite the sprite id with eyegore id
; LDA.w SpriteTypeTable, X : SBC.b #$6C : STA.w SpriteTypeTable, X ; overwrite the sprite id with eyegore id
;
;.notMimic
; restore code
; LDA $0E20, X : CMP.b #$7A
; LDA.w SpriteTypeTable, X : CMP.b #$7A
;RTL
IsItReallyAMimic:
LDA !ENABLE_MIMIC_OVERRIDE : BEQ .continue
LDA.w $0E20,X : CMP.b #$EF : BEQ .is_mimic
LDA.l !ENABLE_MIMIC_OVERRIDE : BEQ .continue
LDA.w SpriteTypeTable,X : CMP.b #$EF : BEQ .is_mimic
CMP.b #$F0 : BNE .continue
.is_mimic
CLC : RTL
.continue ; code we hijacked
LDA.w $0E20,X
LDA.w SpriteTypeTable,X
CMP.b #$D8
RTL
; this is just for killable thieves now
notItemSprite_Mimic:
; if we set killable thief we want to update the sprite id so it can be killed
LDA $0E20, X
LDA.w SpriteTypeTable, X
CMP.l !KILLABLE_THIEVES_ID : BNE .continue ; thief #$C4 (default is B8/dialog tester)
; if we don't have mimic code turned on we want to skip, but we also need to reload the sprite id because we just smoked it with this LDA
; LDA !ENABLE_MIMIC_OVERRIDE : BEQ .reloadSpriteIdAndSkipMimic ; skip to what it would have done normally
; LDA.l !ENABLE_MIMIC_OVERRIDE : BEQ .reloadSpriteIdAndSkipMimic ; skip to what it would have done normally
; LDA $0E20, X ; I hate assembly
; LDA.w SpriteTypeTable, X ; I hate assembly
; CMP.b #$EF : BCC .continue
; SBC.b #$6C : BRA .continue
.changeSpriteId
LDA #$83 ; load green eyegore sprite id so we can kill the thing
LDA.b #$83 ; load green eyegore sprite id so we can kill the thing
.continue
; restore code

View File

@@ -2,10 +2,10 @@ Moldorm_UpdateOamPosition:
{
PHX
LDA !MOLDORM_EYES_FLAG : TAX
LDA.l !MOLDORM_EYES_FLAG : TAX
.more_eyes
LDA $90 : CLC : ADC.w #$0004 : STA $90
LDA $92 : CLC : ADC.w #$0001 : STA $92
LDA.b $90 : CLC : ADC.w #$0004 : STA.b $90
LDA.b $92 : CLC : ADC.w #$0001 : STA.b $92
DEX : BPL .more_eyes ; X >= 0
PLX

View File

@@ -1,8 +1,8 @@
LoadOverworldSprites:
; restore code
STA $01 ; 85 01
STA.b Scrap01 ; 85 01
LDY.w #$0000 ; A0 00 00
; set bank
LDA #$09 : STA $02 ; default is bank 9
LDA.b #$09 : STA.b Scrap02 ; default is bank 9
RTL

View File

@@ -3,9 +3,9 @@
;================================================================================
check_special_action:
{
LDA $7E0CF3 : BEQ .no_special_action
LDA.b #$05 : STA $11 ; $11[0x01] - (Main) Submodule Index (See $B0)
STZ $0CF3 ; $0CF3[0x01] - free ram
LDA.l BossSpecialAction : BEQ .no_special_action
LDA.b #$05 : STA.b GameSubMode
STZ.w BossSpecialAction
.no_special_action
JSL Player_Main
RTL

View File

@@ -1,11 +1,11 @@
LoadUnderworldSprites:
STA.b $00 ; part one of what we replaced
LDA.w #$0028 : STA.b $02 ; set the bank to 28 for now
STA.b Scrap00 ; part one of what we replaced
LDA.w #UWSpritesData>>16 : STA.b Scrap02 ; set the bank to 28 for now
LDA.w $048E
RTL
GetSpriteSlot16Bit:
LDA.b $03 : AND #$00FF
LDA.b Scrap03 : AND.w #$00FF
ASL A
TAY
RTL

View File

@@ -9,12 +9,12 @@ LockAgahnimDoors:
LDA.w #$0000 : RTL
+ : CMP.w #$0001 : BNE +
LDA.l ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
JSR.w LockAgahnimDoorsCore : RTL
JSR LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE +
JSR.w LockAgahnimDoorsCore : BEQ .unlock
JSR LockAgahnimDoorsCore : BEQ .unlock
PHX : PHY
SEP #$30
JSL.l CheckTowerOpen
JSL CheckTowerOpen
REP #$30
PLY : PLX
!BGE .crystalOrUnlock
@@ -29,7 +29,7 @@ LockAgahnimDoors:
LDA.w #$0001 : RTL ;Keep the door locked
++
SEP #$30
JSL $899B6F ;Add tower break seal
JSL AncillaAdd_GTCutscene ;Add tower break seal
REP #$30
LDA.w #$0001 ;Prevent door from opening that frame otherwise it glitchy
RTL
@@ -65,14 +65,14 @@ RTS
SmithDoorCheck:
LDA.l SmithTravelsFreely : AND.w #$00FF : BEQ .orig
;If SmithTravelsFreely is set Frog/Smith can enter multi-entrance overworld doors
JML.l Overworld_Entrance_BRANCH_RHO
JML Overworld_Entrance_BRANCH_RHO
.orig ; The rest is equivlent to what we overwrote
CPX.w #$0076 : !BGE +
JML.l Overworld_Entrance_BRANCH_LAMBDA
JML Overworld_Entrance_BRANCH_LAMBDA
+
JML.l Overworld_Entrance_BRANCH_RHO
JML Overworld_Entrance_BRANCH_RHO
;--------------------------------------------------------------------------------
AllowStartFromSingleEntranceCave:
; 16 Bit A, 16 bit XY
@@ -80,15 +80,14 @@ AllowStartFromSingleEntranceCave:
LDA.l StartingEntrance : AND.w #$00FF ; What we wrote over
PHA
TAX
LDA.l StartingAreaExitOffset, X
AND.w #$00FF
LDA.l StartingAreaExitOffset, X : AND.w #$00FF
BNE +
JMP .done
+
DEC
STA.b Scrap00
ASL #2 : !ADD Scrap00 : ASL #2 ; mult by 20
ASL #2 : !ADD.l Scrap00 : ASL #2 ; mult by 20
TAX
LDA.w #$0016 : STA.l EN_MAINDESQ ; Cache the main screen designation
@@ -126,7 +125,7 @@ AllowStartFromSingleEntranceCave:
LDA.l StartingEntrance : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door
REP #$20 ; reset 16-bit accumulator
JSL.l CacheDoorFrameData
JSL CacheDoorFrameData
.done
PLA
@@ -138,15 +137,15 @@ AllowStartFromExit:
LDA.l ShouldStartatExit, X : BNE .doStart
LDA.l StartingEntrance ; what we wrote over
JML.l AllowStartFromExitReturn
JML AllowStartFromExitReturn
.doStart
LDA.l $828481, X ;Module_LocationMenu_starting_points
LDA.l Module1B_SpawnSelect_spawns, X
ASL : TAX
LDA.l $82D8D2, X : STA.b RoomIndex
LDA.l $82D8D3, X : STA.b RoomIndex+1
LDA.l SpawnPointData_room_id, X : STA.b RoomIndex
LDA.l SpawnPointData_room_id+1, X : STA.b RoomIndex+1
; Go to pre-overworld mode
LDA.b #$08 : STA.b GameMode
@@ -158,7 +157,7 @@ JML.l AllowStartFromExitReturn
INC.w UpdateHUDFlag
JSL Equipment_SearchForEquippedItemLong
JSL HUD_RebuildLong2
JSL HUD_RebuildIndoor_Palace
JSL Equipment_UpdateEquippedItemLong
RTL
@@ -166,9 +165,9 @@ RTL
CheckHole:
LDX.w #$0024
.nextHoleClassic
LDA.b Scrap00 : CMP.l $9BB800, X
LDA.b Scrap00 : CMP.l Overworld_GetPitDestination_map16, X
BNE .wrongMap16Classic
LDA.b OverworldIndex : CMP.l $9BB826, X
LDA.b OverworldIndex : CMP.l Overworld_GetPitDestination_screen, X
BEQ .matchedHoleClassic
.wrongMap16Classic
DEX #2 : BPL .nextHoleClassic
@@ -198,11 +197,11 @@ PreventEnterOnBonk:
LDA.b OverworldIndex : AND.w #$0040 : CMP.b WorldCache : BEQ .done ; Are we bonking, or doing the superbunny glitch?
; If in inverted, are in mirror mode, and are bonking then do not enter
JML.l PreventEnterOnBonk_BRANCH_IX
JML PreventEnterOnBonk_BRANCH_IX
.done
LDX.w #$0102 ; rest of what we wrote over
JML.l PreventEnterOnBonk_return
JML PreventEnterOnBonk_return
;--------------------------------------------------------------------------------
TurtleRockEntranceFix:
LDA.l TurtleRockAutoOpenFix : BEQ .done

View File

@@ -5,20 +5,20 @@ OnPrepFileSelect:
+
PHA : PHX
REP #$10
JSL.l LoadAlphabetTilemap
JSL.l LoadFullItemTiles
JSL LoadAlphabetTilemap
JSL LoadFullItemTiles
SEP #$10
PLX : PLA
RTL
;--------------------------------------------------------------------------------
OnDrawHud:
JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter
JSL.l NewDrawHud
JSL.l DrHudOverride
JSL.l SwapSpriteIfNecessary
JSL.l CuccoStorm
JSL.l PollService
JML.l ReturnFromOnDrawHud
JSL DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter
JSL NewDrawHud
JSL DrHudOverride
JSL SwapSpriteIfNecessary
JSL CuccoStorm
JSL PollService
JML ReturnFromOnDrawHud
;--------------------------------------------------------------------------------
OnDungeonEntrance:
STA.l PegColor ; thing we wrote over
@@ -27,35 +27,35 @@ OnDungeonEntrance:
RTL
;--------------------------------------------------------------------------------
OnDungeonBossExit:
JSL.l StatTransitionCounter
JSL StatTransitionCounter
RTL
;--------------------------------------------------------------------------------
OnPlayerDead:
PHA
JSL.l SetDeathWorldChecked
JSL.l SetSilverBowMode
JSL.l RefreshRainAmmo
JSL SetDeathWorldChecked
JSL SetSilverBowMode
JSL RefreshRainAmmo
PLA
RTL
;--------------------------------------------------------------------------------
OnDungeonExit:
PHA : PHP
SEP #$20 ; set 8-bit accumulator
JSL.l SQEGFix
JSL SQEGFix
PLP : PLA
STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over
PHA : PHP
INC.w UpdateHUDFlag
JSL.l HUD_RebuildLong
JSL.l FloodGateResetInner
JSL.l SetSilverBowMode
JSL HUD_RebuildLong
JSL FloodGateResetInner
JSL SetSilverBowMode
PLP : PLA
RTL
;--------------------------------------------------------------------------------
OnQuit:
JSL.l SQEGFix
JSL SQEGFix
LDA.b #$00 : STA.l AltTextFlag ; bandaid patch bug with mirroring away from text
LDA.b #$10 : STA.b MAINDESQ ; thing we wrote over
RTL
@@ -68,9 +68,9 @@ OnUncleItemGet:
BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
LDA UncleItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l UncleItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLA
JSL.l Link_ReceiveItem
JSL Link_ReceiveItem
LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA.l MagicFiller : + ; refill magic
LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA.l BombsFiller : + ; refill bombs
@@ -104,13 +104,13 @@ OnAga1Defeated:
RTL
;--------------------------------------------------------------------------------
OnAga2Defeated:
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
JSL Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
LDA.b #$01 : STA.l Aga2Duck
LDA.w DungeonID : CMP.b #$1A : BNE +
LDA.l DungeonsCompleted : ORA.b #$04 : STA.l DungeonsCompleted
+
LDA.b #$FF : STA.w DungeonID
JML.l IncrementAgahnim2Sword
JML IncrementAgahnim2Sword
;--------------------------------------------------------------------------------
OnFileCreation:
PHB
@@ -135,37 +135,37 @@ OnFileCreation:
; Set validity value and do some cleanup. Jump to checksum done.
LDA.w #$55AA : STA.l FileValiditySRAM
JSL.l WriteSaveChecksumAndBackup
JSL WriteSaveChecksumAndBackup
STZ.b Scrap00
STZ.b Scrap01
JML.l InitializeSaveFile_checksum_done
JML InitializeSaveFile_checksum_done
;--------------------------------------------------------------------------------
OnFileLoad:
REP #$10 ; set 16 bit index registers
JSL.l EnableForceBlank ; what we wrote over
JSL EnableForceBlank ; what we wrote over
REP #$20 : LDA.l TotalItemCount : STA.l MultiClientFlagsWRAM+1 : SEP #$20
LDA MultiClientFlagsROM : STA.l MultiClientFlagsWRAM
LDA.l MultiClientFlagsROM : STA.l MultiClientFlagsWRAM
LDA.b #$07 : STA.w BG34NBA ; Restore screen 3 to normal tile area
LDA.l FileMarker : BNE +
JSL.l OnNewFile
JSL OnNewFile
LDA.b #$FF : STA.l FileMarker
+
LDA.w DeathReloadFlag : BNE + ; don't adjust the worlds for "continue" or "save-continue"
LDA.l MosaicLevel : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon)
JSL.l DoWorldFix
JSL DoWorldFix
+
JSL.l MasterSwordFollowerClear
JSL MasterSwordFollowerClear
LDA.b #$FF : STA.l RNGLockIn ; reset rng item lock-in
LDA.l GenericKeys : BEQ +
LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter
+
JSL.l SetSilverBowMode
JSL.l RefreshRainAmmo
JSL.l SetEscapeAssist
JSL SetSilverBowMode
JSL RefreshRainAmmo
JSL SetEscapeAssist
LDA.l IsEncrypted : CMP.b #01 : BNE +
JSL LoadStaticDecryptionKey
@@ -196,19 +196,19 @@ RTL
;--------------------------------------------------------------------------------
OnInitFileSelect:
LDA.b #$51 : STA.w $0AA2 ;<-- Line missing from JP1.0, needed to ensure "extra" copy of naming screen graphics are loaded.
JSL.l EnableForceBlank
JSL EnableForceBlank
RTL
;--------------------------------------------------------------------------------
OnLinkDamaged:
JSL.l IncrementDamageTakenCounter_Arb
JML.l OHKOTimer
JSL IncrementDamageTakenCounter_Arb
JML OHKOTimer
;--------------------------------------------------------------------------------
;OnEnterWater:
; JSL.l UnequipCapeQuiet ; what we wrote over
; JSL UnequipCapeQuiet ; what we wrote over
;RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPit:
JSL.l OHKOTimer
JSL OHKOTimer
LDA.l AllowAccidentalMajorGlitch
BEQ ++
@@ -222,11 +222,11 @@ OnLinkDamagedFromPit:
RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPitOutdoors:
JML.l OHKOTimer ; make sure this is last
JML OHKOTimer ; make sure this is last
;--------------------------------------------------------------------------------
OnOWTransition:
JSL.l FloodGateReset
JSL.l StatTransitionCounter
JSL FloodGateReset
JSL StatTransitionCounter
PHP
SEP #$20 ; set 8-bit accumulator
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
@@ -261,25 +261,25 @@ PostItemAnimation:
LDA.b #$00 : STA.l BusyItem ; mark item as finished
LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
JSL.l Main_ShowTextMessage_Alt
JSL Main_ShowTextMessage_Alt
LDA.b #$00 : STA.l TextBoxDefer
+
LDA $1B : BEQ +
REP #$20 : LDA $A0 : STA !MULTIWORLD_ROOMID : SEP #$20
LDA $0403 : STA !MULTIWORLD_ROOMDATA
LDA.b IndoorsFlag : BEQ +
REP #$20 : LDA.b RoomIndex : STA.l !MULTIWORLD_ROOMID : SEP #$20
LDA.w RoomItemsTaken : STA.l !MULTIWORLD_ROOMDATA
+
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
STZ $02E9
LDA #$00 : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
STZ.w ItemReceiptMethod
LDA.b #$00 : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLB
JML.l Ancilla_ReceiveItem_objectFinished
JML Ancilla_ReceiveItem_objectFinished
+
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE +
LDA.b LinkDirection : BEQ +
JSL.l IncrementChestTurnCounter
JSL IncrementChestTurnCounter
+
REP #$20
PEA.w $7E00

View File

@@ -27,7 +27,7 @@ DontUseZSNES:
LDA.b #$00
STA.l NMITIMEN ; disable NMI and IRQ
STA.l HDMAEN ; disable HDMA
STA.l HDMAENABLE ; disable HDMA
ROR ; A = 0x80 from carry
STA.l INIDISP
@@ -48,7 +48,7 @@ DontUseZSNES:
STA.l DAS0L
LDA.w #$0001
STA.l MDMAEN
STA.l DMAENABLE
JSR ConfigurePPUForFailureReport
JSR ConfigureBSODVWF
@@ -93,7 +93,7 @@ Crashed:
LDA.b #$00
STA.l NMITIMEN ; disable NMI and IRQ
STA.l HDMAEN ; disable HDMA
STA.l HDMAENABLE ; disable HDMA
ROR ; A = 0x80 from carry
STA.l INIDISP
@@ -114,7 +114,7 @@ Crashed:
STA.l DAS0L
LDA.w #$0001
STA.l MDMAEN
STA.l DMAENABLE
;===================================================================================================
@@ -312,7 +312,7 @@ DrawVWFMessage:
STZ.w A1B0
LDA.b #$01
STA.w MDMAEN
STA.w DMAENABLE
REP #$20
@@ -376,7 +376,7 @@ DrawFailureVWFChar:
LDY.w #$0000
.next_row
LDA.b ($08),Y
LDA.b (Scrap08),Y
AND.w #$00FF
XBA
LDX.w VWFS
@@ -427,7 +427,7 @@ LoadBSODHexFont:
STA.w A1B0
LDA.b #$01
STA.w MDMAEN
STA.w DMAENABLE
REP #$30
@@ -467,7 +467,7 @@ ConfigureBSODVWF:
PEA.w $0001
LDA.w #15
STA.w $28
STA.w LinkRecoilX
LDA.w #$0042>>1
BRA .start
@@ -475,13 +475,13 @@ ConfigureBSODVWF:
.next_row
PHA
LDA.w $20
LDA.w LinkPosY
CLC
LDA.w $20
LDA.w LinkPosY
ADC.w #32
.start
STA.w $20
STA.w LinkPosY
STA.b VMADDL
PLA
@@ -494,7 +494,7 @@ ConfigureBSODVWF:
DEY
BNE .next_char
DEC.w $28
DEC.w LinkRecoilX
BNE .next_row
LDA.w #$0000

View File

@@ -27,9 +27,9 @@ RTL
FairyPond_Init:
LDA.l Restrict_Ponds : BNE +
LDA.b #$48
JML.l Sprite_ShowMessageFromPlayerContact
JML Sprite_ShowMessageFromPlayerContact
+
PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC +
PHY : JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC +
LDA.l BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++
LDA.l BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++
LDA.l BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++
@@ -38,7 +38,7 @@ FairyPond_Init:
LDA.b #$0A : STA.w SpriteActivity, X
LDA.b #$51
LDY.b #$01
JSL.l Sprite_ShowMessageFromPlayerContact
JSL Sprite_ShowMessageFromPlayerContact
JMP .cleanup
.emptyBottle

View File

@@ -23,7 +23,7 @@ FlagFastCredits:
TSB.b FastCreditsActive
.slow
LDA.b $11
LDA.b GameSubMode
ASL
TAX
@@ -79,10 +79,10 @@ FastCreditsCutsceneScrollY:
FastCreditsCutsceneScroll:
LDA.w $00E2,Y
CMP.l $8EC308,X ; compare to target
CMP.l Credits_ScrollScene_target_y,X ; compare to target
ROL.b Scrap00 ; put carry in here
LDA.l $8EC348,X ; get movement
LDA.l Credits_ScrollScene_movement_y,X ; get movement
BPL ++ ; if positive, leave saved carry alone
INC.b Scrap00 ; otherwise, flip it
++ ROR.b Scrap00 ; recover carry

View File

@@ -12,10 +12,10 @@ TitleCardFix:
BNE .exit
LDA.b #$14
STA.b $10
STA.b GameMode
STZ.b $11
STZ.b $22
STZ.b GameSubMode
STZ.b LinkPosX
.exit
JML $8CC3D2

View File

@@ -23,12 +23,12 @@ macro fs_draw16x8(screenrow,screencol)
endmacro
macro fs_draw8x16(screenrow,screencol)
%fs_draw8x8(<screenrow>,<screencol>)
!ADD #$0010
!ADD.w #$0010
%fs_draw8x8(<screenrow>+1,<screencol>)
endmacro
macro fs_draw16x16(screenrow,screencol)
%fs_draw16x8(<screenrow>,<screencol>)
!ADD #$000F
!ADD.w #$000F
%fs_draw16x8(<screenrow>+1,<screencol>)
endmacro
@@ -385,7 +385,7 @@ DrawPlayerFileShared:
++
LDA.l EquipmentSRAM+$0130 : AND.w #$00FF
JSL.l HexToDec
JSL HexToDec
LDA.l HexToDecDigit4 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02E0 : %fs_draw8x8(11,26)
LDA.l HexToDecDigit5 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02E0 : %fs_draw8x8(11,27)
@@ -608,7 +608,7 @@ FileSelectItems:
FileSelectDrawHudBar:
LDA.w #$02DB|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA.l DisplayRupeesSRAM
JSL.l HUDHex4Digit_Long
JSL HUDHex4Digit_Long
LDA.b Scrap04 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,9)
LDA.b Scrap05 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,10)
LDA.b Scrap06 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,11)
@@ -616,7 +616,7 @@ FileSelectDrawHudBar:
LDA.w #$02CB|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA.l BombsEquipmentSRAM : AND.w #$00FF
JSL.l HUDHex2Digit_Long
JSL HUDHex2Digit_Long
TYA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,14)
TXA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,15)
@@ -627,7 +627,7 @@ FileSelectDrawHudBar:
LDA.w #$02C9|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++
LDA.l CurrentArrowsSRAM : AND.w #$00FF
JSL.l HUDHex2Digit_Long
JSL HUDHex2Digit_Long
TYA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,17)
TXA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,18)
RTS
@@ -771,7 +771,7 @@ LoadFullItemTiles:
LDA.b #FileSelectNewGraphics>>16 : STA.w A1B0
LDX.w #FileSelectNewGraphics : STX.w A1T0L
LDX.w #$0C00 : STX.w DAS0L
LDA.b #$01 : STA.w MDMAEN
LDA.b #$01 : STA.w DMAENABLE
RTL
;--------------------------------------------------------------------------------
; z colon @
@@ -788,7 +788,7 @@ LoadLowerCaseLettersSymbols:
LDX.w #NewFont+$400 : STX.w A1T0L
LDX.w #$0400 : STX.w DAS0L
LDX.w #$2D00 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN
LDA.b #$01 : STA.w DMAENABLE
; : @ #
LDA.b #NewFont>>16 : STA.w A1B0
@@ -798,9 +798,9 @@ LoadLowerCaseLettersSymbols:
LDX.w #$0030 : STX.w DAS0L : STX.w DAS1L
LDX.w #$2E50 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN
LDA.b #$01 : STA.w DMAENABLE
LDX.w #$2ED0 : STX.w VMADDL
LDA.b #$02 : STA.w MDMAEN
LDA.b #$02 : STA.w DMAENABLE
RTL
;--------------------------------------------------------------------------------
LoadFileSelectVanillaItems:
@@ -814,7 +814,7 @@ LoadFileSelectVanillaItems:
LDX.w #DecompBuffer2 : STX.w A1T0L
LDX.w #$0600 : STX.w DAS0L
LDX.w #$2F00 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN
LDA.b #$01 : STA.w DMAENABLE
SEP #$10
RTL
@@ -823,10 +823,10 @@ SetFileSelectPalette:
LDA.b GameMode : CMP.b #$04 : BNE +
; load the vanilla file select screen BG3 palette for naming screen
LDA.b #$01 : STA.w $0AB2
JSL.l Palette_Hud
JSL Palette_Hud
BRA .done
+
JSL.l LoadCustomHudPalette
JSL LoadCustomHudPalette
.done
JML Palette_SelectScreen ; Jump to the subroutine whose call we wrote over
@@ -944,8 +944,8 @@ MaybeForceFileName:
BRA -
.done
SEP #$20
JML.l InitializeSaveFile
JML InitializeSaveFile
+
JML.l NameFile_MakeScreenVisible
JML NameFile_MakeScreenVisible
;--------------------------------------------------------------------------------

View File

@@ -43,7 +43,7 @@ protectff:
BMI .special_overworld
AND.b #$3F
CMP.l $82A4E3,X
CMP.l Overworld_ActualScreenID,X
BEQ ++
.protect

View File

@@ -2,7 +2,7 @@
; Floodgate Softlock Fix
;--------------------------------------------------------------------------------
FloodGateAndMasterSwordFollowerReset:
JSL.l MasterSwordFollowerClear
JSL MasterSwordFollowerClear
FloodGateReset:
LDA.l PersistentFloodgate : BNE +
LDA.l OverworldEventDataWRAM+$3B : AND.b #$DF : STA.l OverworldEventDataWRAM+$3B ; reset water outside floodgate
@@ -15,13 +15,13 @@ FloodGateReset:
FloodGateResetInner:
LDA.l Bugfix_SwampWaterLevel : BEQ .done
LDA DRMode : BEQ .check_room_35; Only do the check for room 37 if on door rando
LDA.l DRMode : BEQ .check_room_35; Only do the check for room 37 if on door rando
LDA.l SwampDrain1HasItem : BEQ .flipper_check
LDA.l $7F666F : AND.b #$80 : BEQ .drain_room_37 ; Check if key in room 37 has been collected.
.flipper_check
LDA FlippersEquipment : AND.b #$01 : BNE .check_room_35 ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
LDA.l FlippersEquipment : AND.b #$01 : BNE .check_room_35 ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
.drain_room_37
LDA RoomDataWRAM[$37].low : AND.b #$7F : STA RoomDataWRAM[$37].low ; clear water room 37 - outer room you shouldn't be able to softlock except in major glitches
LDA.l RoomDataWRAM[$37].low : AND.b #$7F : STA.l RoomDataWRAM[$37].low ; clear water room 37 - outer room you shouldn't be able to softlock except in major glitches
.check_room_35
LDA.l SwampDrain2HasItem : BEQ .done
LDA.l $7F666B : AND.b #$80 : BNE .done ; Check if key in room 35 has been collected.

View File

@@ -6,7 +6,7 @@ SpawnHauntedGroveItem:
LDA.b IndoorsFlag : BEQ + : RTL : + ; Skip if indoors
; todo - how does this work now?
LDA.l HauntedGroveItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l HauntedGroveItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.b #$EB
STA.l MiniGameTime
@@ -54,10 +54,10 @@ RTL
FluteBoy:
LDA.b GameMode : CMP.b #$1A : BEQ +
LDA.b #$01 : STA.w $0FDD
JML.l FluteBoy_Abort
JML FluteBoy_Abort
+
LDA.w SpriteActivity, X : CMP.b #$03 ; thing we wrote over
JML.l FluteBoy_Continue
JML FluteBoy_Continue
;--------------------------------------------------------------------------------
FreeDuckCheck:
LDA.l InvertedMode : BEQ .done

View File

@@ -2,7 +2,7 @@
; Frame Hook
;--------------------------------------------------------------------------------
FrameHookAction:
JSL $8080B5 ; Module_MainRouting
JSL Module_MainRouting
JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA
SEP #$20
@@ -24,16 +24,16 @@ RTL
NMIHookAction:
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA !NMI_MW : BEQ ++
LDA.l !NMI_MW : BEQ ++
PHP
SEP #$30
LDA #$00 : STA !NMI_MW
LDA.b #$00 : STA.l !NMI_MW
; Multiworld text
LDA !NMI_MW+1 : BEQ +
LDA #$00 : STA !NMI_MW+1
JSL.l WriteText
LDA.l !NMI_MW+1 : BEQ +
LDA.b #$00 : STA.l !NMI_MW+1
JSL WriteText
+
PLP
++
@@ -43,7 +43,7 @@ NMIHookAction:
LDA.l NMIFrames+2 : INC : STA.l NMIFrames+2
+
JML.l NMIHookReturn
JML NMIHookReturn
;--------------------------------------------------------------------------------
PostNMIHookAction:
@@ -53,23 +53,23 @@ PostNMIHookAction:
.return
STZ.w NMIAux ; zero bank byte of NMI hook pointer
+
JSR.w TransferItemGFX
JSR TransferItemGFX
LDA.b INIDISPQ : STA.w INIDISP ; thing we wrote over, turn screen back on
JML.l PostNMIHookReturn
JML PostNMIHookReturn
;--------------------------------------------------------------------------------
TransferItemGFX:
; Only used for shops now but could be used for anything. We should look at how door rando does this
; and try to unify one approach.
REP #$30
LDX.w ItemStackPtr : BEQ .done
TXA : BIT #$0040 : BNE .fail ; Crash if we have more than 16 queued (should never happen.)
TXA : BIT.w #$0040 : BNE .fail ; Crash if we have more than 16 queued (should never happen.)
DEX #2
-
LDA.l ItemGFXStack,X : STA.w ItemGFXPtr
LDA.l ItemTargetStack,X : STA.w ItemGFXTarget
PHX
JSL.l TransferItemToVRAM
JSL TransferItemToVRAM
REP #$10
PLX
DEX #2

View File

@@ -11,7 +11,7 @@ GetAgahnimPalette:
RTL
;--------------------------------------------------------------------------------
GetAgahnimDeath:
STA.w $0BA0, X ; thing we wrote over
STA.w SpriteAncillaInteract, X ; thing we wrote over
LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
@@ -51,10 +51,10 @@ GetAgahnimSlot:
LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$01 ; Use Agahnim 2
JML.l GetAgahnimSlotReturn
JML GetAgahnimSlotReturn
+ ; Elsewhere
LDA.b #$00 ; Use Agahnim 1
JML.l GetAgahnimSlotReturn
JML GetAgahnimSlotReturn
;--------------------------------------------------------------------------------
GetAgahnimLightning:
INC.w SpriteAux, X ; thing we wrote over

View File

@@ -1,6 +1,6 @@
GoalItemGanonCheck:
LDA.w SpriteTypeTable, X : CMP.b #$D6 : BNE .success ; skip if not ganon
JSL.l CheckGanonVulnerability
JSL CheckGanonVulnerability
BCS .success
.fail
@@ -128,30 +128,30 @@ GTCutscene_ConditionalAnimateCrystals:
PLX : BCC .skip_crystal
.draw_crystal
LDA.b $11 : BEQ + : JML.l GTCutscene_AnimateCrystals_NoRotate ; what we wrote over
+ JML.l GTCutscene_AnimateCrystals_NextCrystal+4
LDA.b GameSubMode : BEQ + : JML GTCutscene_AnimateCrystals_NoRotate ; what we wrote over
+ JML GTCutscene_AnimateCrystals_NextCrystal+4
.skip_crystal
JML.l GTCutscene_DrawSingleCrystal-3
JML GTCutscene_DrawSingleCrystal-3
;--------------------------------------------------------------------------------
GTCutscene_ConditionalDrawSingleCrystal:
LDA.w $06FA : BEQ .draw_crystal : STZ.w $06FA
LDA.w RandoOverworldTargetEdge : BEQ .draw_crystal : STZ.w RandoOverworldTargetEdge
JSR GTCutscene_NumberOfCrystals : TAX
LDA.l GTCutscene_CrystalMasks,X : AND.b #$80 : BEQ .skip_crystal
.draw_crystal
LDX.w $0FA0 : PHY ; what we wrote over
JML.l GTCutscene_DrawSingleCrystal+4
LDX.w CurrentSpriteSlot : PHY ; what we wrote over
JML GTCutscene_DrawSingleCrystal+4
.skip_crystal
JML.l GTCutscene_DrawSingleCrystal_SkipCrystal
JML GTCutscene_DrawSingleCrystal_SkipCrystal
;--------------------------------------------------------------------------------
GTCutscene_AnimateCrystals_Prep:
BEQ + : JSL.l GTCutscene_SparkleALot : + ; thing we wrote over
BEQ + : JSL GTCutscene_SparkleALot : + ; thing we wrote over
JSR GTCutscene_NumberOfCrystals : BNE +
JML.l GTCutscene_DrawSingleCrystal_SkipSparkle
JML GTCutscene_DrawSingleCrystal_SkipSparkle
+ CMP.b #$01 : BNE +
JML.l GTCutscene_DrawSingleCrystal
+ INC.w $06FA ; some free ram OWR also uses
JML.l GTCutscene_AnimateCrystals_NextCrystal-2
JML GTCutscene_DrawSingleCrystal
+ INC.w RandoOverworldTargetEdge ; some free ram OWR also uses
JML GTCutscene_AnimateCrystals_NextCrystal-2
;--------------------------------------------------------------------------------
GTCutscene_ActivateSparkle_SelectCrystal:
JSR GTCutscene_NumberOfCrystals : BNE +
@@ -189,7 +189,7 @@ RTL
;--------------------------------------------------------------------------------
CheckTowerOpen:
LDA.l GanonsTowerOpenMode : ASL : TAX
JSR.w (.tower_open_modes,X)
JSR (.tower_open_modes,X)
RTL
.tower_open_modes
dw .vanilla
@@ -279,7 +279,7 @@ CheckPedestalPull:
; Out: c - Successful ped pull if set, do nothing if unset.
PHX
LDA.l PedCheckMode : ASL : TAX
JSR.w (.pedestal_modes,X)
JSR (.pedestal_modes,X)
PLX
RTL

View File

@@ -2,13 +2,13 @@
; Randomize Half Magic Bat
;--------------------------------------------------------------------------------
GetMagicBatItem:
JSL.l ItemSet_MagicBat
JSL ItemSet_MagicBat
%GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues)
CMP.b #$FF : BEQ .normalLogic
TAY
PHA : LDA MagicBatItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
PHA : LDA.l MagicBatItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
STZ.b ItemReceiptMethod ; 0 = Receiving item from an NPC or message
JML.l Link_ReceiveItem
JML Link_ReceiveItem
.normalLogic
LDA.l HalfMagic
STA.l MagicConsumption

View File

@@ -81,7 +81,7 @@ GetItemDamageValue:
CPX.b #$3d : BEQ .hookshot
.normal
LDA.l $8DB8F1,x ;what we wrote over
LDA.l DamageSubclassValue,x ;what we wrote over
RTL
.boomerang
LDA.l StunItemAction : AND.b #$01 : BNE .normal
@@ -100,7 +100,7 @@ SearchAncilla:
LDX.b #$00
.loop
LDA.w AncillaID, X
INX : CPX #$0A : BEQ .notFound
INX : CPX.b #$0A : BEQ .notFound
CMP.b Scrap05 : BNE .loop
LDA.b #$01
BRA .return

View File

@@ -78,7 +78,7 @@ DMAAlphabetTilemap:
LDA.b #BigRAM>>16 : STA.w A1B0
LDX.w #BigRAM : STX.w A1T0L
LDX.w #$0080 : STX.w DAS0L
LDA.b #$01 : STA.w MDMAEN
LDA.b #$01 : STA.w DMAENABLE
SEP #$10
PLX : PLA
RTS

View File

@@ -3,39 +3,37 @@
;--------------------------------------------------------------------------------
HeartPieceGet:
PHX : PHY
JSL.l LoadHeartPieceRoomValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
TAY
JSL.l MaybeMarkDigSpotCollected
.skipLoad
JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_ITEM_PLAYER_ID
CPY.b #$26 : BNE .not_heart ; don't add a 1/4 heart if it's not a heart piece
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .not_heart
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter
.not_heart
JSL.l $8791B3 ; Player_HaltDashAttackLong
STZ.w ItemReceiptMethod ; 0 = Receiving item from an NPC or message
JSL.l Link_ReceiveItem
JSL MaybeUnlockTabletAnimation
JSL LoadHeartPieceRoomValue
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
JSL MaybeMarkDigSpotCollected
JSL Player_HaltDashAttackLong
JSL Link_ReceiveItem
PLY : PLX
RTL
;--------------------------------------------------------------------------------
HeartContainerGet:
PHX : PHY
JSL.l IncrementBossSword
LDY.w SpriteID, X : BNE +
JSL.l LoadHeartContainerRoomValue : TAY
+
BRA HeartPieceGet_skipLoad
JSL IncrementBossSword
JSL LoadHeartContainerRoomValue : TAY
;--------------------------------------------------------------------------------
DrawHeartPieceGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC .offscreen
PHA : PHY
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l HeartPieceSpritePrep
JMP .done ; don't draw on the init frame
.skipInit
LDA.w SpriteID, X ; Retrieve stored item type
@@ -46,30 +44,32 @@ DrawHeartPieceGFX:
PLX
LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X
PLA
JSL.l DrawDynamicTile
LDA.b Scrap00
CLC : ADC.b #$04
STA.b Scrap00
JSL.l Sprite_DrawShadowLong
BRA .done
+
PLX
PLA
JSL.l DrawDynamicTile
JSL.l Sprite_DrawShadowLong
.done
PLY : PLA
.offscreen
PLP
JSL Sprite_IsOnscreen : BCC .offscreen
JSL HeartPieceSpritePrep
JSL DrawDynamicTile
JSL Sprite_DrawShadowLong
JSL DrawDynamicTile
JSL Sprite_DrawShadowLong
RTL
;--------------------------------------------------------------------------------
DrawHeartContainerGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen
JSL Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen
PHA : PHY
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l HeartContainerSpritePrep
JSL HeartContainerSpritePrep
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
.skipInit
@@ -80,12 +80,12 @@ DrawHeartContainerGFX:
HeartContainerSound:
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
JSL.l CheckIfBossRoom : BCC + ; Skip if not in a boss room
LDA.b #$2E
SEC
RTL
+
CLC
JSL CheckIfBossRoom : BCC + ; Skip if not in a boss room
RTL
;--------------------------------------------------------------------------------
NormalItemSkipSound:
@@ -117,11 +117,11 @@ HeartPieceSpritePrep:
LDA.b #$00 : STA.l RedrawFlag
JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartPieceRoomValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
JSL LoadHeartPieceRoomValue
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
JSL PrepDynamicTile_loot_resolved
.skip
PLA
@@ -132,11 +132,11 @@ HeartContainerSpritePrep:
LDA.b #$00 : STA.l RedrawFlag
JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartContainerRoomValue ; load item type
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
JSL LoadHeartContainerRoomValue ; load item type
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
JSL PrepDynamicTile_loot_resolved
PLA
RTL
@@ -144,23 +144,23 @@ RTL
LoadHeartPieceRoomValue:
LDA.b IndoorsFlag : BEQ .outdoors ; check if we're indoors or outdoors
.indoors
JSL.l LoadIndoorValue
JMP .done
.outdoors
JSL.l LoadOutdoorValue
.done
JSL LoadIndoorValue
JSL LoadOutdoorValue
RTL
;--------------------------------------------------------------------------------
HPItemReset:
PHA
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip
PLA
JSL $89AD58 ; GiveRupeeGift - thing we wrote over
BRA .done
.skip
PLA
.done
PHA : LDA.b #$01 : STA.l RedrawFlag : PLA
JSL GiveRupeeGift ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
MaybeMarkDigSpotCollected:
@@ -397,68 +397,68 @@ RTL
HeartPieceGetPlayer:
{
PHY
LDA $1B : BNE +
LDA.b IndoorsFlag : BNE +
BRL .outdoors
+
PHP
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #135 : BNE +
LDA StandingKey_Hera_Player
LDA.l StandingKey_Hera_Player
BRL .done
+ CMP.w #200 : BNE +
LDA HeartContainer_ArmosKnights_Player
LDA.l HeartContainer_ArmosKnights_Player
BRL .done
+ CMP.w #51 : BNE +
LDA HeartContainer_Lanmolas_Player
LDA.l HeartContainer_Lanmolas_Player
BRL .done
+ CMP.w #7 : BNE +
LDA HeartContainer_Moldorm_Player
LDA.l HeartContainer_Moldorm_Player
BRL .done
+ CMP.w #90 : BNE +
LDA HeartContainer_HelmasaurKing_Player
LDA.l HeartContainer_HelmasaurKing_Player
BRL .done
+ CMP.w #6 : BNE +
LDA HeartContainer_Arrghus_Player
LDA.l HeartContainer_Arrghus_Player
BRL .done
+ CMP.w #41 : BNE +
LDA HeartContainer_Mothula_Player
LDA.l HeartContainer_Mothula_Player
BRL .done
+ CMP.w #172 : BNE +
LDA HeartContainer_Blind_Player
LDA.l HeartContainer_Blind_Player
BRL .done
+ CMP.w #222 : BNE +
LDA HeartContainer_Kholdstare_Player
LDA.l HeartContainer_Kholdstare_Player
BRL .done
+ CMP.w #144 : BNE +
LDA HeartContainer_Vitreous_Player
LDA.l HeartContainer_Vitreous_Player
BRL .done
+ CMP.w #164 : BNE +
LDA HeartContainer_Trinexx_Player
LDA.l HeartContainer_Trinexx_Player
BRL .done
+ CMP.w #225 : BNE +
LDA HeartPiece_Forest_Thieves_Player
LDA.l HeartPiece_Forest_Thieves_Player
BRL .done
+ CMP.w #226 : BNE +
LDA HeartPiece_Lumberjack_Tree_Player
LDA.l HeartPiece_Lumberjack_Tree_Player
BRL .done
+ CMP.w #234 : BNE +
LDA HeartPiece_Spectacle_Cave_Player
LDA.l HeartPiece_Spectacle_Cave_Player
BRL .done
+ CMP.w #283 : BNE +
LDA $22 : XBA : AND.w #$0001 ; figure out where link is
LDA.b LinkPosX : XBA : AND.w #$0001 ; figure out where link is
BNE ++
LDA HeartPiece_Circle_Bushes_Player
LDA.l HeartPiece_Circle_Bushes_Player
BRL .done
++
LDA HeartPiece_Graveyard_Warp_Player
LDA.l HeartPiece_Graveyard_Warp_Player
BRL .done
+ CMP.w #294 : BNE +
LDA HeartPiece_Mire_Warp_Player
LDA.l HeartPiece_Mire_Warp_Player
BRL .done
+ CMP.w #295 : BNE +
LDA HeartPiece_Smith_Pegs_Player
LDA.l HeartPiece_Smith_Pegs_Player
BRL .done
LDA.w #$0000
BRL .done
@@ -466,50 +466,50 @@ HeartPieceGetPlayer:
.outdoors
PHP
REP #$20 ; set 16-bit accumulator
LDA $8A
LDA.b OverworldIndex
CMP.w #$03 : BNE +
LDA $22 : CMP.w #1890 : !BLT ++
LDA HeartPiece_Spectacle_Player
LDA.b LinkPosX : CMP.w #1890 : !BLT ++
LDA.l HeartPiece_Spectacle_Player
BRL .done
++
LDA EtherItem_Player
LDA.l EtherItem_Player
BRL .done
+ CMP.w #$05 : BNE +
LDA HeartPiece_Mountain_Warp_Player
LDA.l HeartPiece_Mountain_Warp_Player
BRL .done
+ CMP.w #$28 : BNE +
LDA HeartPiece_Maze_Player
LDA.l HeartPiece_Maze_Player
BRL .done
+ CMP.w #$2A : BNE +
LDA HauntedGroveItem_Player
LDA.l HauntedGroveItem_Player
BRL .done
+ CMP.w #$30 : BNE +
LDA $22 : CMP.w #512 : !BGE ++
LDA HeartPiece_Desert_Player
LDA.b LinkPosX : CMP.w #512 : !BGE ++
LDA.l HeartPiece_Desert_Player
BRL .done
++
LDA BombosItem_Player
LDA.l BombosItem_Player
BRL .done
+ CMP.w #$35 : BNE +
LDA HeartPiece_Lake_Player
LDA.l HeartPiece_Lake_Player
BRL .done
+ CMP.w #$3B : BNE +
LDA HeartPiece_Swamp_Player
LDA.l HeartPiece_Swamp_Player
BRL .done
+ CMP.w #$42 : BNE +
LDA HeartPiece_Cliffside_Player
LDA.l HeartPiece_Cliffside_Player
BRL .done
+ CMP.w #$4A : BNE +
LDA HeartPiece_Cliffside_Player
LDA.l HeartPiece_Cliffside_Player
BRL .done
+ CMP.w #$5B : BNE +
LDA HeartPiece_Pyramid_Player
LDA.l HeartPiece_Pyramid_Player
BRL .done
+ CMP.w #$68 : BNE +
LDA HeartPiece_Digging_Player
LDA.l HeartPiece_Digging_Player
BRL .done
+ CMP.w #$81 : BNE +
LDA HeartPiece_Zora_Player
LDA.l HeartPiece_Zora_Player
BRL .done
+
LDA.w #$0000

209
hooks.asm
View File

@@ -66,8 +66,8 @@ org $00FFEA : dw NMIBounce
org $00FFEE : dw IRQBounce
org $8098AB
NMIBounce: JML.l $8080C9
IRQBounce: JML.l $8082D8
NMIBounce: JML Interrupt_NMI
IRQBounce: JML Interrupt_IRQ
warnpc $8098C0
;================================================================================
@@ -221,7 +221,7 @@ LDA.w #$2000 ; Load file select screen graphics to VRAM word addres 0x2000 inste
;--------------------------------------------------------------------------------
org $80E568 : LDX.w #$0EFF ; Load full decompressed character set into VRAM
;--------------------------------------------------------------------------------
org $80E581 : JSL.l LoadFileSelectVanillaItems : BRA + : NOP #13 : +
org $80E581 : JSL LoadFileSelectVanillaItems : BRA + : NOP #13 : +
;--------------------------------------------------------------------------------
org $80833A ; <- 0033A - Bank00.asm : 481 (LDA.w #$007F)
LDA.w #$0180 ; change which character is used as the blank character for the select screen
@@ -245,7 +245,7 @@ db $3D
org $8CD6BD ; <- Y position table for Death Counts
db $51
;--------------------------------------------------------------------------------
org $8CD55F : JSL.l CheckHeartPaletteFileSelect : NOP #2
org $8CD55F : JSL CheckHeartPaletteFileSelect : NOP #2
;================================================================================
; Name Entry Screen
@@ -447,7 +447,7 @@ AllowStartFromExitReturn:
org $9BC2A7 ; <- DC2A7 - Bank1B.asm : 1143 (Overworld_CreatePyramidHole:)
JSL Overworld_CreatePyramidHoleModified : RTL
C9DE_LONG:
JSR.w $1BC9DE : RTL ; surprisingly same address as US
JSR Overworld_AlterTileHardcore : RTL ; surprisingly same address as US
;--------------------------------------------------------------------------------
org $87FF5F ; <- 3ff5f - Bank0E.asm : 5252 (LDA.w #$0E3F : STA $23BC)
JSL Draw_PyramidOverlay : RTS
@@ -469,7 +469,7 @@ org $84E7AE ; <- bank0E.asm : 4230 (LDA $7EF287 : AND.w #$0020)
JSL TurtleRockPegSolved
org $84E7B9 ; <- bank0E.asm : 4237 (LDX $04C8)
JMP.w TurtleRockTrollPegs
JMP TurtleRockTrollPegs
TurtleRockPegCheck:
org $84E7C9
@@ -488,11 +488,11 @@ JSL GetRandomInt
LDA.l PegProbability : BEQ .vanilla : CMP.l $7E0FA1
REP #$20 : !BGE .succeed
.fail
JMP.w TurtleRockPegFail
JMP TurtleRockPegFail
.succeed
JMP.w TurtleRockPegSuccess
JMP TurtleRockPegSuccess
.vanilla
REP #$20 : JMP.w TurtleRockPegCheck
REP #$20 : JMP TurtleRockPegCheck
;--------------------------------------------------------------------------------
org $9BBD05 ; <- bank1B.asm : 261 (TYA : STA $00) ; hook starts at the STA
JML PreventEnterOnBonk : NOP
@@ -504,23 +504,21 @@ PreventEnterOnBonk_BRANCH_IX:
;================================================================================
; Crystals Mode
;--------------------------------------------------------------------------------
org $899B6D
AncillaAdd_GTCutscene_Exit:
org $899B7F ; <- ancilla_init.asm : 4136 (LDA $7EF37A : AND.b #$7F : CMP.b #$7F)
JSL CheckTowerOpen : BCC AncillaAdd_GTCutscene_Exit
JSL CheckTowerOpen : BCC AncillaAdd_GTCutscene-2
;--------------------------------------------------------------------------------
org $88CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR GTCutscene_SparkleALot : LDX.b #$06)
JML.l GTCutscene_AnimateCrystals_Prep : NOP
JML GTCutscene_AnimateCrystals_Prep : NOP
LDX.b #$05
GTCutscene_AnimateCrystals_NextCrystal:
JML.l GTCutscene_ConditionalAnimateCrystals
JML GTCutscene_ConditionalAnimateCrystals
;--------------------------------------------------------------------------------
org $88CE93
GTCutscene_DrawSingleCrystal:
JML.l GTCutscene_ConditionalDrawSingleCrystal
JML GTCutscene_ConditionalDrawSingleCrystal
;--------------------------------------------------------------------------------
org $88CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX)
JSL.l GTCutscene_ActivateSparkle_SelectCrystal
JSL GTCutscene_ActivateSparkle_SelectCrystal
;--------------------------------------------------------------------------------
org $88CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS)
RTL
@@ -561,7 +559,7 @@ org $86F2EA ; <- 372EA - Bank06.asm : 5791 (LDA $0E20, X : CMP.b #$D6 : BCS .no_
JSL CheckGanonHammerDamage : NOP
;--------------------------------------------------------------------------------
org $858922
JSL.l CheckPedestalPull : BCC MasterSword_InPedestal_exit
JSL CheckPedestalPull : BCC MasterSword_InPedestal_exit
;================================================================================
; Stat Hooks
@@ -826,11 +824,6 @@ db $B1, $C6, $F9, $C9, $C6, $F9 ; data insert - 2 chests, fat fairy room
org $81E97E
dw $0116 : db $08
dw $0116 : db $25
;--------------------------------------------------------------------------------
PyramidFairy_BRANCH_IOTA = $86C936
PyramidFairy_BRANCH_GAMMA = $86C948
;--------------------------------------------------------------------------------
org $9EE16E ; <- F616E - sprite_bomb_shop_entity.asm : 73
NOP #8 ; fix bomb shop dialog for dwarfless big bomb
@@ -934,7 +927,7 @@ org $898769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y)
LDA.w ItemReceipts_graphics, Y
org $898811
JSL.l SetItemRiseTimer
JSL SetItemRiseTimer
org $89884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y)
LDA.w ItemReceipts_offset_y, Y
@@ -953,7 +946,7 @@ 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)
JSL.l ItemReceiptWidthCheck
JSL ItemReceiptWidthCheck
org $88C6F9 ; 446F9 - ancilla_receive_item.asm:570 (LDA AddReceiveItem.properties, X)
JSL CheckReceivedItemPropertiesBeforeLoad
@@ -1022,29 +1015,29 @@ Overworld_Entrance_BRANCH_EPSILON: ; go here to lock doors
;--------------------------------------------------------------------------------
; Dungeon Drops
;--------------------------------------------------------------------------------
org $81C50D : JSL.l CheckDungeonWorld
org $81C517 : JSL.l CheckDungeonCompletion
org $81C523 : JSL.l CheckDungeonCompletion
org $81C710 : JSL.l CheckSpawnPrize
org $81C50D : JSL CheckDungeonWorld
org $81C517 : JSL CheckDungeonCompletion
org $81C523 : JSL CheckDungeonCompletion
org $81C710 : JSL 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
org $81C742 : JSL SpawnDungeonPrize
org $8799EA : JML SetItemPose
org $88C415 : JSL PendantMusicCheck
BCS Ancilla22_ItemReceipt_is_pendant : BRA Ancilla22_ItemReceipt_wait_for_music
;org $88C452 : JSL.l MaybeKeepLootID : NOP #2 DR overwrote hook see RetrieveBunnyState
org $88C61D : JSL.l AnimatePrizeCutscene : NOP
;org $88C452 : JSL MaybeKeepLootID : NOP #2 DR overwrote hook see RetrieveBunnyState
org $88C61D : JSL AnimatePrizeCutscene : NOP
org $88C622 : BCC ItemReceipt_Animate_continue
org $88C6BA : JSL.l CheckPoseItemCoordinates
org $88CAD6 : JSL.l HandleDropSFX : NOP #2
org $88C6BA : JSL CheckPoseItemCoordinates
org $88CAD6 : JSL 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
org $88CAE9 : JSL PrepPrizeTile
org $88CB23 : JSL PrizeDropSparkle : BCC Ancilla29_MilestoneItemReceipt_no_sparkle : NOP #2
org $88CB97 : JSL PrepPrizeOAMCoordinates : BRA + : NOP #$12 : +
org $88CBFF : JSL PrepPrizeShadow
org $88CC6C : JSL HandleCrystalsField
org $88CCA6 : JSL PrepPrizeOAMCoordinates : NOP
org $8985FA : JSL SetCutsceneFlag : NOP #3 : BCC AddReceivedItem_notCrystal
org $8988B2 : JSL SetPrizeCoords : NOP
;================================================================================
@@ -1114,9 +1107,9 @@ JSL ItemCheck_Library
org $8DDF38 ; <- 6DF38 - equipment.asm : 480
JSL ProcessMenuButtons
BCC _equipment_497
JMP.w _equipment_544
JMP _equipment_544
ResetEquipment:
JSR.w RestoreNormalMenu ; (short)
JSR RestoreNormalMenu ; (short)
RTL
NOP #3
@@ -1127,9 +1120,9 @@ org $8DDF88 ; <- 6DF88 - equipment.asm : 544
_equipment_544:
;--------------------------------------------------------------------------------
org $8DEB98 ; <- 6EB98 - equipment.asm : 1803
LDA.w #$3C60 : STA $FFBE, Y
ORA.w #$8000 : STA $007E, Y
ORA.w #$4000 : STA $0084, Y
LDA.w #$3C60 : STA.w $FFBE, Y
ORA.w #$8000 : STA.w $007E, Y
ORA.w #$4000 : STA.w $0084, Y
JSL AddYMarker : NOP #2
;--------------------------------------------------------------------------------
org $8DF789+6 ; <- 6F789+6 (not in disassembly) - red bottle hud tile, lower right
@@ -1171,21 +1164,21 @@ JSL CheckCloseItemMenu
org $8DEE70 ; <- 6EE70 - equipment.asm : 2137
JSL PrepItemScreenBigKey : NOP
;--------------------------------------------------------------------------------
org $0DDEA5 ; LDA.b Joy1A_New : BEQ .wait_for_button
JSL.l HandleEmptyMenu : RTS
org $0DEB3C ; LDA.w ItemCursor : AND.w #$00FF
JML.l MaybeDrawEquippedItem : NOP #2
org $0DE363 ; LDA.b #$04 : STA.w SubModuleInterface
JSL.l RestoreMenu_SetSubModule : NOP
org $8DDEA5 ; LDA.b Joy1A_New : BEQ .wait_for_button
JSL HandleEmptyMenu : RTS
org $8DEB3C ; LDA.w ItemCursor : AND.w #$00FF
JML MaybeDrawEquippedItem : NOP #2
org $8DE363 ; LDA.b #$04 : STA.w SubModuleInterface
JSL RestoreMenu_SetSubModule : NOP
;--------------------------------------------------------------------------------
org $88D395 ; <- 45395 - ancilla_bird_travel_intro.asm : 253
JSL.l UpgradeFlute : NOP #2
JSL UpgradeFlute : NOP #2
;--------------------------------------------------------------------------------
org $87A408 ; LDA.l $7EF34C
JSL.l FluteCallForDuck
JSL FluteCallForDuck
;--------------------------------------------------------------------------------
org $85E4D7 ; <- 2E4D7 - sprite_witch.asm : 213
JSL.l RemoveMushroom : NOP #2
JSL RemoveMushroom : NOP #2
;--------------------------------------------------------------------------------
org $85F55F ; <- 2F55F - sprite_potion_shop.asm : 59
JSL LoadPowder
@@ -1206,33 +1199,20 @@ JSL DrawMushroom
org $85EE97 ; <- 2EE97 - sprite_mushroom.asm : 81
NOP #14
;--------------------------------------------------------------------------------
org $86C09C ; <- - bank06.asm : 1885 (JSL SpritePrep_PotionShopLong)
org $86C09C ; <- - bank06.asm : 1885 (JSL SpritePrep_MagicShopAssistant)
JSL SpritePrep_ShopKeeper_PotionShop
org $85F521
SpritePrep_PotionShopLong:
org $85F539
SpawnMagicPowder:
;--------------------------------------------------------------------------------
org $85F568 ; <- 2F568 - sprite_potion_shop.asm
LDA #$b0 : STA $0D00, Y : LDA #$90 : STA $0D10, Y ; manually set position of powder item
LDA #$21 : STA $0D20, Y : LDA #$12 : STA $0D30, Y
JMP $F61D
LDA.b #$B0 : STA.w SpritePosYLow, Y : LDA.b #$90 : STA.w SpritePosXLow, Y ; manually set position of powder item
LDA.b #$21 : STA.w SpritePosYHigh, Y : LDA.b #$12 : STA.w SpritePosXHigh, Y
JMP MagicShopAssistant_SpawnObject
;--------------------------------------------------------------------------------
org $85F633 ; <- 2F633 - sprite_potion_shop.asm
JSL Sprite_ShopKeeperPotion : RTS : NOP ;; TODO: i don't remember prices being set on top of the player
PotionShopkeeperJumpTable:
org $85F893 ; <- witch behavior here
Sprite_WitchAssistant:
org $85F644 ; <- powder behavior here
Sprite_MagicPowderItem:
;--------------------------------------------------------------------------------
org $85EB1D ; <- 2EB1D - sprite_bottle_vendor.asm : 158
JSL.l Multiworld_BottleVendor_GiveBottle
JSL Multiworld_BottleVendor_GiveBottle
;--------------------------------------------------------------------------------
org $87A36F ; <- 3A36F - Bank07.asm : 5679
NOP #5
@@ -1435,7 +1415,7 @@ JSL RNG_Enemy_Drops
org $8DFDCB
JSL UpdateHearts
RTS
org $8DF191 : JSL.l ColorAnimatedHearts : BRA + : NOP #7 : +
org $8DF191 : JSL ColorAnimatedHearts : BRA + : NOP #7 : +
org $8DFC4C ; <- 6FC4C - headsup_display.asm : 836 (LDA $7EF36E : AND.w #$00FF : ADD.w #$0007 : AND.w #$FFF8 : TAX)
JML OnDrawHud : NOP #197 ; why? it's not hurting anyone lol
@@ -1462,30 +1442,30 @@ MVN $A17E
org $8DFB1F : JSL CheckHUDSilverArrows
org $8DFB29 : BRA UpdateHUDBuffer_update_item_check_arrows
;--------------------------------------------------------------------------------
org $8DF1AB : JSR.w RebuildHUD_update
org $8DDFC8 : JSR.w RebuildHUD_update
org $8DDB85 : JSR.w RefreshIcon_UpdateHUD : BRA + : NOP : +
org $8DF1AB : JSR RebuildHUD_update
org $8DDFC8 : JSR RebuildHUD_update
org $8DDB85 : JSR RefreshIcon_UpdateHUD : BRA + : NOP : +
;--------------------------------------------------------------------------------
org $87A205 : JSL.l RebuildHUD_update_long
org $87A1A4 : JSL.l RebuildHUD_update_long
org $87A1CF : JSL.l RebuildHUD_update_long
org $87A21D : JSL.l RebuildHUD_update_long
org $87A235 : JSL.l RebuildHUD_update_long
org $8AEF62 : JSL.l RebuildHUD_update_long
org $87A205 : JSL RebuildHUD_update_long
org $87A1A4 : JSL RebuildHUD_update_long
org $87A1CF : JSL RebuildHUD_update_long
org $87A21D : JSL RebuildHUD_update_long
org $87A235 : JSL RebuildHUD_update_long
org $8AEF62 : JSL RebuildHUD_update_long
;--------------------------------------------------------------------------------
org $8DFFE1
RebuildHUD_update_long:
JSR.w RebuildHUD_update : RTL
JSR RebuildHUD_update : RTL
RefreshIcon_UpdateHUD:
INC.w UpdateHUDFlag
JSR.w RebuildHUD
JSR.w UpdateEquippedItem
JSR RebuildHUD
JSR UpdateEquippedItem
RTS
warnpc $8E8000
;--------------------------------------------------------------------------------
org $8DEDE8
JSL.l DrawHeartPiecesMenu : BRA DrawEquipment_in_a_dungeon
JSL DrawHeartPiecesMenu : BRA DrawEquipment_in_a_dungeon
;--------------------------------------------------------------------------------
;================================================================================
@@ -1655,14 +1635,11 @@ JSL HUDRebuildIndoorHole
;================================================================================
; Skull Woods back entrance fire fix
;--------------------------------------------------------------------------------
org $099C42 ; ancilla_init.asm:4264 - (LDA $8A : AND.b #$40 : BEQ AddDoorDebris.spawn_failed)
JML.l Multiworld_ConsumingFire_TransmuteToSkullWoodsFire
org $899C42 ; ancilla_init.asm:4264 - (LDA $8A : AND.b #$40 : BEQ AddDoorDebris.spawn_failed)
JML Multiworld_ConsumingFire_TransmuteToSkullWoodsFire
NOP #2
ConsumingFire_TransmuteToSkullWoodsFire_continue:
org $099C39
AddDoorDebris_spawn_failed:
;================================================================================
; Pendant / Crystal Fixes
;--------------------------------------------------------------------------------
@@ -1894,7 +1871,7 @@ Ancilla_ReceiveItem_optimus:
JML PostItemAnimation : NOP #2
org $88C548 ; <- 44548 - ancilla_recieve_item.asm:297 (CMP.b #$28 : BNE .dontGiveRupees)
JML.l Multiworld_Ancilla_ReceiveItem_stillInMotion
JML Multiworld_Ancilla_ReceiveItem_stillInMotion
Ancilla_ReceiveItem_stillInMotion_moveon:
org $88C560 ; <- 44548 - ancilla_recieve_item.asm:307
@@ -1913,7 +1890,7 @@ org $868F16 ; <- 30F16
JSL ItemCheck_ZoraKing
;--------------------------------------------------------------------------------
org $859ACA ; <- 29ACA
JSL $9DE1AA ; Sprite_SpawnFlippersItem
JSL Zora_RegurgitateFlippers
;--------------------------------------------------------------------------------
org $9DE1E4 ; <- EE1E4 - sprite_great_catfish.asm : 489
JSL LoadZoraKingItemGFX : NOP #2
@@ -1937,7 +1914,7 @@ org $8690BD ; <- 310BD - SpritePrep_FluteBoy : 2202
JSL ItemCheck_TreeKid2
org $86AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute
LDA HasGroveItem : AND.b #$01
LDA.l HasGroveItem : AND.b #$01
db $D0 ; BNE
org $86B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05
@@ -2070,7 +2047,7 @@ dw FakeFlipperProtection
org $82FFC7
FakeFlipperProtection:
JSR.w $029485
JSR RecoverPositionAfterDrowning
JSL protectff
RTS
;--------------------------------------------------------------------------------
@@ -2130,7 +2107,7 @@ JSL BeepLogic : NOP #6
; Item Downgrade Fix
;--------------------------------------------------------------------------------
org $89865E ; <- 4865E
JSL $9BEE1B ; fix something i wrote over i shouldn't have
JSL Palettes_Load_LinkGloves ; fix something i wrote over i shouldn't have
;--------------------------------------------------------------------------------
org $898638 ; <- 48638 - ancilla_init.asm:737 - LDA .item_values, Y : BMI .dontWrite (BMI)
JSL ItemDowngradeFix
@@ -2146,7 +2123,7 @@ org $9AFC55 ; <- D7C55 - sprite_movable_mantle.asm:34 (LDA $7EF34A : BEQ .return
NOP #6 ; remove check
;--------------------------------------------------------------------------------
org $868841 ; <- 30841 - sprite_prep.asm:269 (LDA $0D00, X : ADD.b #$03 : STA $0D00, X)
JSL.l Mantle_CorrectPosition : NOP #2
JSL Mantle_CorrectPosition : NOP #2
;--------------------------------------------------------------------------------
org $8297FD ; <- bank02 : Module07_19_MirrorFade (STZ.b $11 : STZ.b $14)
JSL MirrorScrollSpawnZelda
@@ -2312,7 +2289,7 @@ Overworld_Entrance_BRANCH_RHO: ; branch here to continue into door
;================================================================================
; Paradox Cave Shopkeeper Fixes
;--------------------------------------------------------------------------------
org $808C19 ; Bank00.asm 1633 (LDA.b #$01 : STA MDMAEN)
org $808C19 ; Bank00.asm 1633 (LDA.b #$01 : STA DMAENABLE)
JSL ParadoxCaveGfxFix : NOP
;================================================================================
@@ -2347,7 +2324,7 @@ JSL LoadActualGearPalettesWithGloves : RTL
;--------------------------------------------------------------------------------
; Bunny Palette/Overworld Map Bugfix
;--------------------------------------------------------------------------------
org $82FDF0 ; <- 017df0 - bank0E (LDA [$00] : STA $7EC300, X : STA $7EC500, X)
org $82FDF0 ; <- 017df0 - bank0E (LDA [Scrap00] : STA $7EC300, X : STA $7EC500, X)
JSL LoadGearPalette_safe_for_bunny : RTS
;================================================================================
@@ -2458,18 +2435,18 @@ dw 37, 11 : db $FB, $40, $00, $00
;--------------------------------------------------------------------------------
org $87839E ; bunny BAGE check
BunnyRead:
JSR.w $07B5A9 ; check A button
JSR Link_CheckNewAPress
BCC .noA
JSR.w CheckIfReading
JSR CheckIfReading
BNE .noread
JSR.w $07B4DB
JSR Link_PerformRead
NOP
.noread
.noA
org $87FFF4
CheckIfReading:
JSR.w $07D36C ; check action
JSR Link_HandleLiftables
LDA.b #$80 : TRB.b $3B
CPX.b #$04
RTS
@@ -2502,13 +2479,13 @@ org $8EE828 : JSL PreparePointer : LDA.b [CreditsPtr],Y : NOP
org $8EE83F : LDA.b [CreditsPtr],Y : NOP
org $8EE853
LDA.b [CreditsPtr],Y : NOP : AND.w #$00FF : ASL A : JSL CheckFontTable
org $8EE86D : JSL RenderCreditsStatCounter : JMP.w AfterDeathCounterOutput
org $8EE86D : JSL RenderCreditsStatCounter : JMP AfterDeathCounterOutput
org $82857D : JSL LoadOverworldCreditsTiles
;================================================================================
; Fast credits
org $8EC2B1 : JSL FlagFastCredits
org $82A096 : JSL DumbFlagForMSU
org $8EC3AF : JSL FastCreditsScrollOW : JMP.w $0EC3C7
org $8EC3AF : JSL FastCreditsScrollOW : JMP Credits_ScrollScene_Overworld_no_scroll
org $8EC41F : JSL FastCreditsCutsceneUnderworldY
org $8EC42C : JSL FastCreditsCutsceneUnderworldX
org $8EC488 : JSL FastCreditsCutsceneTimer
@@ -2573,8 +2550,8 @@ org $8EF285 : JSL RenderCharSetColorExtended_close : NOP
;================================================================================
; VRAM
;--------------------------------------------------------------------------------
org $008BE5 ; hijack stripes
JSL.l TransferVRAMStripes
org $808BE5 ; hijack stripes
JSL TransferVRAMStripes
;===================================================================================================
; Fix fairy palette on file select
@@ -2617,14 +2594,14 @@ org $899BBE : JSL TransferItemReceiptToBuffer_using_GraphicsID
;===================================================================================================
org $1D8E75 : RTS
org $1DB5D8 : JML.l $9DB5DF
org $1DB605 : JML.l $9DB60C
org $1DBBF1 : JML.l $9DBBF8
org $1DBC19 : JML.l $9DBC20
org $1DB5D8 : JML $9DB5DF
org $1DB605 : JML $9DB60C
org $1DBBF1 : JML $9DBBF8
org $1DBC19 : JML $9DBC20
org $1DC072 : JMP.w $9DC079
org $1DC0A5 : JMP.w $9DC0AC
org $1DED3B : JML.l $9DED42
org $1DED7A : JML.l $9DED81
org $1DED3B : JML $9DED42
org $1DED7A : JML $9DED81
org $05B55E : JMP ++ : ++
org $05B580 : JMP ++ : ++

View File

@@ -17,7 +17,7 @@ PHP
LDX.b #$7E : STX.w A1B4
LDA.w #$0040 : STA.w DAS4L
LDA.w #$1801 : STA.w DMAP4
LDX.b #$10 : STX.w MDMAEN
LDX.b #$10 : STX.w DMAENABLE
LDX.b #$0F : STX.w INIDISP
PLP
@@ -36,7 +36,7 @@ PHP
LDA.w #$0040 : STA.w DAS4L
LDA.w #$1801 : STA.w DMAP4
LDX.b #$10 : STX.w MDMAEN
LDX.b #$10 : STX.w DMAENABLE
LDX.b #$0F : STX.w INIDISP
PLP

View File

@@ -1,6 +1,6 @@
ShouldOverrideFileLoad:
; Y = Graphics file being loaded
CPY #$0A ; 0A = Ice/Mire floor file
CPY.b #$0A ; 0A = Ice/Mire floor file
BNE .no
LDA.w DungeonID ; Dungeon number
@@ -33,14 +33,14 @@ BgGraphicsLoading:
LDX.b #64*2 ; Tiles to load * 2
-
; Unrolled loop to upload half a tile
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
DEX
BNE -

View File

@@ -71,7 +71,7 @@ Init_PostRAMClear:
JSL DecompressAllItemGraphics
JSR InitDungeonCounts
JML $80D463 ; The original target of the jump table that we hijacked
JML Tagalong_LoadGfx ; The original target of the jump table that we hijacked
;===================================================================================================
InitDungeonCounts:
@@ -93,7 +93,7 @@ InitDungeonCounts:
PHA : PLB
REP #$30
LDA.l TotalItemCount
JSL.l HUDHex4Digit_Long
JSL HUDHex4Digit_Long
SEP #$20
LDA.b Scrap04 : TAX : STX.w TotalItemCountTiles+$00
LDA.b Scrap05 : TAX : STX.w TotalItemCountTiles+$02

View File

@@ -12,9 +12,9 @@ ProcessMenuButtons:
.sel_unheld
LDA.l HudFlag : AND.b #$60 : BEQ +
LDA.b #$00 : STA.l HudFlag
JSL.l MaybePlaySelectSFX
JSL MaybePlaySelectSFX
+
JSL.l ResetEquipment
JSL ResetEquipment
+
.sel_held
CLC ; no buttons
@@ -27,8 +27,8 @@ RTL
LDA.b #$60
.store_flag
STA.l HudFlag
JSL.l MaybePlaySelectSFX
JSL.l ResetEquipment
JSL MaybePlaySelectSFX
JSL ResetEquipment
RTL
.y_pressed ; Note: used as entry point by quickswap code. Must preserve X.
LDA.b #$10 : STA.w MenuBlink
@@ -49,10 +49,10 @@ RTL
PLX
LDA.l SilverArrowsUseRestriction : BEQ ++
LDA.b RoomIndex : ORA.b RoomIndex+1 : BEQ ++ ; not in ganon's room in restricted mode
LDA.l BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA.l BowEquipment
LDA.l BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB.b #$02 : STA.l BowEquipment
BRA .errorJump2
++
LDA.l BowEquipment : !SUB #$01 : EOR.b #$02 : !ADD #$01 : STA.l BowEquipment ; swap bows
LDA.l BowEquipment : !SUB.b #$01 : EOR.b #$02 : !ADD.b #$01 : STA.l BowEquipment ; swap bows
LDA.b #$20 : STA.w SFX3 ; menu select sound
JMP .captured
+ BRA +
@@ -85,7 +85,7 @@ RTL
LDA.b #$20 : STA.w SFX3 ; menu select sound
BRA .captured
+
CMP.b #$10 : BNE .error : JSL.l ProcessBottleMenu : BRA .captured : +
CMP.b #$10 : BNE .error : JSL ProcessBottleMenu : BRA .captured : +
CLC
RTL
.midShovel
@@ -153,14 +153,14 @@ AddInventory:
TYA : AND.w #$00FF : ASL : TAX
SEP #$20
LDA.w InventoryTable_properties,X : BIT.b #$01 : BEQ .done
JSR.w ShopCheck : BCS .done
JSR ShopCheck : BCS .done
.countDungeonChecks
JSR.w DungeonIncrement : BCS .done
JSR DungeonIncrement : BCS .done
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .totalCount
JSR.w IncrementByOne
JSR.w StampItem
JSR IncrementByOne
JSR StampItem
SEP #$20
JSR.w IncrementYAItems
JSR IncrementYAItems
.totalCount
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
REP #$30
@@ -197,11 +197,11 @@ ShopCheck:
CMP.w #284 : BEQ .nocount ; bomb shop
CMP.w #265 : BEQ .nocount ; potion shop - powder is flagged as "ShopEnableCount" in CollectPowder
; these room contain pots so you must check the quadrant as well for pottery lottery
CMP.w #287 : BNE + : LDA.b $A9 : CMP.w #$0201 : BEQ .nocount ; kakariko shop
CMP.w #287 : BNE + : LDA.b LinkQuadrantH : CMP.w #$0201 : BEQ .nocount ; kakariko shop
LDA.b RoomIndex
+ CMP.w #255 : BNE + : LDA.b $A9 : BEQ .nocount ; light world death mountain shop
+ CMP.w #255 : BNE + : LDA.b LinkQuadrantH : BEQ .nocount ; light world death mountain shop
LDA.b RoomIndex
+ CMP.w #276 : BNE + : LDA.b $A9 : CMP.w #$0200 : BEQ .nocount ; waterfall fairy
+ CMP.w #276 : BNE + : LDA.b LinkQuadrantH : CMP.w #$0200 : BEQ .nocount ; waterfall fairy
LDA.b RoomIndex
+ CMP.w #277 : BEQ .nocount ; upgrade fairy (shop)
CMP.w #278 : BEQ .nocount ; pyramid fairy
@@ -220,7 +220,7 @@ DungeonIncrement:
REP #$10
PHX
LDA.w InventoryTable_properties,X : BIT.b #$40 : BEQ +
JSL.l CountChestKeyLong
JSL CountChestKeyLong
+
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
SEP #$10
@@ -269,7 +269,7 @@ IncrementYAItems:
BIT.b #$20 : BNE .bow_check
BIT.b #$04 : BEQ .not_y
.y_item
LDA.l YAItemCounter : !ADD #$08 : STA.l YAItemCounter
LDA.l YAItemCounter : !ADD.b #$08 : STA.l YAItemCounter
BRA .done
.not_y
BIT.b #$08 : BEQ .done
@@ -310,7 +310,7 @@ IncrementBossSword:
BRA .none
+
ASL : TAX
JMP.w (.vectors,X)
JMP (.vectors,X)
.vectors
dw .none
@@ -359,7 +359,7 @@ IncrementFinalSword:
BRA IncrementBossSword_none
+
ASL : TAX
JMP.w (IncrementBossSword_vectors,X)
JMP (IncrementBossSword_vectors,X)
.done
SEP #$20
PLX
@@ -373,9 +373,9 @@ Link_ReceiveItem_HUDRefresh:
LDA.b #$01 : STA.l BombsEquipment ; increase actual bomb count
+
JSL.l HUD_RefreshIconLong ; thing we wrote over
JSL HUD_RefreshIconLong ; thing we wrote over
INC.w UpdateHUDFlag
JSL.l PostItemGet
JSL PostItemGet
RTL
;--------------------------------------------------------------------------------
@@ -388,7 +388,7 @@ HandleBombAbsorbtion:
LDA.l BombCapacity : BEQ + ; skip if we can't have bombs
LDA.b #$04 : STA.w ItemCursor ; set selected item to bombs
LDA.b #$01 : STA.w CurrentYItem ; set selected item to bombs
JSL.l HUD_RebuildLong
JSL HUD_RebuildLong
INC.w UpdateHUDFlag
+
RTL
@@ -462,6 +462,8 @@ UpgradeFlute:
LDA.l InventoryTracking : AND.b #$FC : ORA.b #$01 : STA.l InventoryTracking ; switch to the working flute
LDA.b #$03 : STA.l FluteEquipment ; upgrade primary inventory
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; FluteCallForDuck:
;--------------------------------------------------------------------------------
@@ -533,9 +535,9 @@ RTL
ClearOWKeys:
PHA
JSL.l TurtleRockEntranceFix
JSL.l FakeWorldFix
JSL.l FixBunnyOnExitToLightWorld
JSL TurtleRockEntranceFix
JSL FakeWorldFix
JSL FixBunnyOnExitToLightWorld
LDA.l GenericKeys : BEQ +
PLA : LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys
RTL
@@ -559,15 +561,15 @@ RTL
;--------------------------------------------------------------------------------
LoadPowder:
PHX
JSL.l Sprite_SpawnDynamically ; thing we wrote over
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL Sprite_SpawnDynamically ; thing we wrote over
LDA.l WitchItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues)
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w SpriteID, Y
STA.l PowderFlag
TYX
JSL.l PrepDynamicTile_loot_resolved
JSL PrepDynamicTile_loot_resolved
PLX
RTL
;--------------------------------------------------------------------------------
@@ -591,16 +593,16 @@ RTL
DrawPowder:
LDA.w ItemReceiptPose : BNE .defer ; defer if link is buying a potion
LDA.l RedrawFlag : BEQ +
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA $0DA0, X ; Retrieve stored item type
JSL.l PrepDynamicTile_loot_resolved
LDA.l WitchItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.w $0DA0, X ; Retrieve stored item type
JSL PrepDynamicTile_loot_resolved
LDA.b #$00 : STA.l RedrawFlag ; reset redraw flag
BRA .defer
+
; this fights with the shopkeep code, so had to move the powder draw there when potion shop is custom
LDA.l ShopType : CMP.b #$FF : BNE .defer
LDA.w SpriteID, X ; Retrieve stored item type
JSL.l DrawDynamicTile
JSL DrawDynamicTile
.defer
RTL
;--------------------------------------------------------------------------------
@@ -618,12 +620,12 @@ LoadMushroom:
LDA.b LinkState : CMP.b #$14 : BEQ .skip ; skip if we're mid-mirror
LDA.b #$00 : STA.l RedrawFlag
LDA.l MushroomItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l MushroomItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues)
JSL.l AttemptItemSubstitution
JSR.w ResolveLootID
JSL AttemptItemSubstitution
JSR ResolveLootID
STA.w SpriteID,X
JSL.l PrepDynamicTile
JSL PrepDynamicTile
.skip
PLA
@@ -636,12 +638,12 @@ RTL
DrawMushroom:
PHA : PHY
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l LoadMushroom_justGFX
JSL LoadMushroom_justGFX
BRA .done ; don't draw on the init frame
.skipInit
LDA.w SpriteID, X ; Retrieve stored item type
JSL.l DrawDynamicTile
JSL DrawDynamicTile
.done
PLY : PLA
@@ -657,13 +659,13 @@ CollectPowder:
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) : TAY
+ PHA
LDA WitchItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l WitchItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
LDA.b #$01 : STA.l ShopEnableCount
PLA
STZ.w ItemReceiptMethod ; item from NPC
JSL.l Link_ReceiveItem
JSL Link_ReceiveItem
PHA : LDA.b #$00 : STA.l ShopEnableCount : STA.l PowderFlag : PLA
JSL.l ItemSet_Powder
JSL ItemSet_Powder
RTL
;--------------------------------------------------------------------------------
@@ -810,18 +812,18 @@ RTL
; A = item id being collected
ItemGetAlternateSFX:
PEA.w $C567 ; SNES to RTS to in bank 08
LDA.w $0C5E,X : CMP.b #$4A : BNE +
LDA.w AncillaGet,X : CMP.b #$4A : BNE +
; collecting pre-activated flute
LDA.b #$13 : JML $088007
LDA.b #$13 : JML Ancilla_SFX2_Near
+ ; normal itemget sfx
LDA.b #$0F : JML $08800E ; what we wrote over
LDA.b #$0F : JML Ancilla_SFX3_Near ; what we wrote over
; A = item id being collected
ItemGetOverworldAlternateSFX:
CMP.b #$4A : BNE +
JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$13 : STA.w $012E
JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$13 : STA.w SFX2
RTL
+ ; normal itemget sfx
JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$0F : STA.w $012F ; what we wrote over
JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$0F : STA.w SFX3 ; what we wrote over
RTL
;--------------------------------------------------------------------------------

View File

@@ -223,7 +223,6 @@ MirrorBonk:
PLB : PLP : PLX
BRA .forceBonk
++
TXA : !ADD #$0008 : CMP.w #.tableEnd-.bonkRectanglesTable : BEQ .endLoop
TAX
BRA .loop
.endbonkRectanglesTable
@@ -233,9 +232,10 @@ MirrorBonk:
.normal
;Not forcing a bonk, so the vanilla bonk detection run.
LDA.b Scrap0C : ORA.b Scrap0E
JML.l MirrorBonk_NormalReturn
TXA : !ADD.w #$0008 : CMP.w #.tableEnd-.bonkRectanglesTable : BEQ .endLoop
JML MirrorBonk_NormalReturn
.forceBonk
JML.l MirrorBonk_BranchGamma
JML MirrorBonk_BranchGamma
.bonkRectanglesTable
;X1 X2 Y1 Y2

View File

@@ -162,7 +162,7 @@ Overworld_LoadNewTiles:
INY
INY
JMP.w ($0000,X)
JMP ($0000,X)
;---------------------------------------------------------------------------------------------------

View File

@@ -3,7 +3,7 @@ InvertedTileAttributeLookup:
SEP #$20
LDA.b OverworldIndex : CMP.b #$47 : BEQ .turtleRock
LDA.l Overworld_TileAttr, X
JML.l Overworld_GetTileAttrAtLocation_continue
JML Overworld_GetTileAttrAtLocation_continue
.turtleRock
LDA.l Inverted_TR_TileAttributes, X
JML.l Overworld_GetTileAttrAtLocation_continue
JML Overworld_GetTileAttrAtLocation_continue

View File

@@ -2,7 +2,7 @@
; Item Downgrade Fix
;--------------------------------------------------------------------------------
ItemDowngradeFix:
JSL.l AddInventory
JSL AddInventory
BMI .dontWrite ; thing we wrote over part 1
CPY.b #$1B : BEQ .isPowerGloves ; Power Gloves
@@ -36,8 +36,8 @@ RTL
.isBlueBoomerang
.isBow
.isBowAndArrows
CMP.b [$00] : !BGE .done ; finished if we're upgrading
LDA.b [$00] ; reload old value
CMP.b [Scrap00] : !BGE .done ; finished if we're upgrading
LDA.b [Scrap00] ; reload old value
RTL
.isSilverArrowBow
.isRedBoomerang

View File

@@ -57,8 +57,8 @@ FreeUWGraphics:
DrawPotItem:
PHX
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
TAX
LDA.l BeeTrapDisguise : BEQ +
TAX
@@ -66,18 +66,18 @@ DrawPotItem:
.full
PLX
LDA.b #$01 : STA $06
LDA #$0C : JSL.l OAM_AllocateFromRegionC
LDA #$02 : PHA
LDA.b #$01 : STA.b Scrap06
LDA.b #$0C : JSL OAM_AllocateFromRegionC
LDA.b #$02 : PHA
REP #$20
LDA.w #DynamicOAMTile_full
BRA .draw
.narrow
PLX
LDA.b #$02 : STA $06
LDA #$10 : JSL.l OAM_AllocateFromRegionC
LDA #$03 : PHA
LDA.b #$02 : STA.b Scrap06
LDA.b #$10 : JSL OAM_AllocateFromRegionC
LDA.b #$03 : PHA
REP #$20
LDA.w #DynamicOAMTile_thin
.draw

View File

@@ -43,13 +43,11 @@ org $86d180
org $86d18d ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F)
JSL KeyGet
org $86f9f3 ; bank06.asm : 6732 (JSL Sprite_LoadProperties)
org $86f9f3 ; bank06.asm : 6732 (JSL SpritePrep_LoadProperties)
JSL LoadProperties_PreserveCertainProps
;org $808BAA ; NMI hook
; JSL TransferPotGFX
org $86828A
Sprite_SpawnSecret_SpriteSpawnDynamically:
JSL CheckSprite_Spawn
org $87B169
@@ -76,28 +74,20 @@ org $8681F4
Sprite_SpawnSecret_pool_ID:
org $868283
Sprite_SpawnSecret_NotRandomBush:
org $86828A
Sprite_SpawnSecret_SpriteSpawnDynamically:
org $86d23a
Sprite_DrawAbsorbable:
org $9eff81
Sprite_DrawRippleIfInWater:
org $8db818
Sprite_LoadProperties:
org $86D038
KeyRoomFlagMasks:
org $80FDEE
InitializeMirrorHDMA:
org $80E3C4
LoadCommonSprites_long:
org $09D62E
org $89D62E
UWSpritesPointers: ; 0x250 bytes for 0x128 rooms' 16-bit pointers
org $09D87E
org $89D87E
UWPotsPointers: ; 0x250 bytes for 0x128 rooms' 16-bit pointers
org $09DACE
org $89DACE
UWPotsData: ; variable number of bytes (max 0x11D1) for all pots data
org $A88000
@@ -184,48 +174,48 @@ UWSpecialFlag:
org $A8B128
RevealPotItem:
STA.b $04 ; save tilemap coordinates
STA.b Scrap04 ; save tilemap coordinates
STZ.w SpawnedItemFlag
STZ.w SpawnedItemMWPlayer
LDA.w $0B9C : AND.w #$FF00 : STA.w $0B9C
LDA.b $A0 : ASL : TAX
LDA.b RoomIndex : ASL : TAX
LDA.l UWPotsPointers,X : STA.b $00 ; we may move this
LDA.w #UWPotsPointers>>16 : STA.b $02
LDA.l UWPotsPointers,X : STA.b Scrap00 ; we may move this
LDA.w #UWPotsPointers>>16 : STA.b Scrap02
LDY.w #$FFFD : LDX.w #$FFFF
.next_pot
INY : INY : INY
LDA.b [$00],Y
LDA.b [Scrap00],Y
CMP.w #$FFFF : BEQ .exit
INX
STA.w $08 ; remember the exact value
STA.w Scrap08 ; remember the exact value
AND.w #$3FFF
CMP.b $04 : BNE .next_pot ; not the correct value
CMP.b Scrap04 : BNE .next_pot ; not the correct value
STZ.w SpawnedItemIsMultiWorld
BIT.b $08
BIT.b Scrap08
BVS LoadMultiWorldPotItem
BMI LoadMajorPotItem
.normal_secret
STA $08
STA.b Scrap08
PHX : PHY
; set bit and count if first time lifting this pot
TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A
LDA.b $A0 : ASL : TAX
TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA.b Scrap0A
LDA.b RoomIndex : ASL : TAX
JSR ShouldCountNormalPot : BCC .obtained
LDA.l RoomPotData, X : BIT $0A : BNE .obtained
ORA $0A : STA RoomPotData, X
LDA.l RoomPotData, X : BIT.b Scrap0A : BNE .obtained
ORA.b Scrap0A : STA.l RoomPotData, X
; increment dungeon counts
SEP #$10
LDX.w $040C : CPX.b #$FF : BEQ +
LDX.w DungeonID : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
@@ -237,14 +227,14 @@ RevealPotItem:
PLY : PLX
PLA ; remove the JSL return lower 16 bits
LDA $08
PEA.w $01E6E2-1 ; change return address to go back to the vanilla routine
LDA.b Scrap08
PEA.w RevealPotItem_found_match-1 ; return to vanilla routine
.exit
RTL
LoadMultiWorldPotItem:
INY : INY
LDA.b [$00],Y : AND.w #$00FF
LDA.b [Scrap00],Y : AND.w #$00FF
INC.w SpawnedItemIsMultiWorld
PHX
@@ -263,7 +253,7 @@ RTL
LoadMajorPotItem:
INY : INY
LDA.b [$00],Y : AND.w #$00FF
LDA.b [Scrap00],Y : AND.w #$00FF
SaveMajorItemDrop:
; A currently holds the item receipt ID
@@ -286,24 +276,24 @@ SaveMajorItemDrop:
RTL
.substitute
PHA
TXA : ASL : STA.b $00
LDA.w #$001F : SBC $00
TAX : LDA.l BitFieldMasks, X : STA $00
LDA.b $A0 : ASL : TAX
TXA : ASL : STA.b Scrap00
LDA.w #$001F : SBC.b Scrap00
TAX : LDA.l BitFieldMasks, X : STA.b Scrap00
LDA.b RoomIndex : ASL : TAX
LDA.l $7EF580, X
AND.b $00
AND.b Scrap00
BNE .exit
LDA.l $7EF580, X : ORA $00 : STA.l $7EF580, X
PLA : STA $0B9C
LDA.l $7EF580, X : ORA.b Scrap00 : STA.l $7EF580, X
PLA : STA.w $0B9C
RTL
.exit
PLA : STZ.w $0B9C
RTL
ShouldCountNormalPot:
INY : INY : LDA [$00], Y : AND #$00FF : CMP #$0080 : BCS .clear
INY : INY : LDA.b [Scrap00], Y : AND.w #$00FF : CMP.w #$0080 : BCS .clear
LDA.l PotCountMode : BEQ .clear
LDA.l PotCollectionRateTable, X : BIT $0A : BEQ .clear ; don't count if clear
LDA.l PotCollectionRateTable, X : BIT.b Scrap0A : BEQ .clear ; don't count if clear
.set
SEC
RTS
@@ -313,12 +303,12 @@ RTS
IncrementCountsForSubstitute:
PHX : REP #$30
LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A
LDA.b $A0 : ASL : TAX
LDA.l RoomPotData, X : BIT $0A : BNE .obtained
ORA $0A : STA RoomPotData, X
LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA.b Scrap0A
LDA.b RoomIndex : ASL : TAX
LDA.l RoomPotData, X : BIT.b Scrap0A : BNE .obtained
ORA.b Scrap0A : STA.l RoomPotData, X
SEP #$10
LDX.w $040C : CPX.b #$FF : BEQ +
LDX.w DungeonID : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
@@ -331,15 +321,15 @@ IncrementCountsForSubstitute:
RTS
ClearSpriteData:
STZ.b $03 ; what we overrode # we no longer need STZ $02 see underworld_sprite_hooks
STZ.b Scrap03 ; what we overrode # we no longer need STZ $02 see underworld_sprite_hooks
.shared:
PHX
LDA #$00 : LDX #$00
LDA.b #$00 : LDX.b #$00
.loop
STA SprDropsItem, X : STA SprItemReceipt, X : STA SprItemIndex, X
STA SprItemMWPlayer, X : STA SprItemFlags, X
INX : CPX #$10 : BCC .loop
STA.l SprDropsItem, X : STA.l SprItemReceipt, X : STA.l SprItemIndex, X
STA.l SprItemMWPlayer, X : STA.l SprItemFlags, X
INX : CPX.b #$10 : BCC .loop
JSR SetupEnemyDropIndicator
PLX
RTL
@@ -354,40 +344,40 @@ ClearSpriteData2:
; uses X register, assumes flags are (MX) but (mX) is fine
SetupEnemyDropIndicator:
REP #$20
LDA.w #!BlankTile : STA.w !EnemyDropIndicator
LDX.b $1B : BEQ .done
LDA.l DRFlags : BIT #$0800 : BEQ .done
LDA.w #!BlankTile : STA.w EnemyDropIndicator
LDX.b IndoorsFlag : BEQ .done
LDA.l DRFlags : BIT.w #$0800 : BEQ .done
; Skipping the compass checks, could make this a toggle later?
; do we have a flag for enemy drops on? could check it here
; LDA.w $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .skipCompassChecks
; LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF : BEQ .skipCompassChecks
; compass checks
; does compass for dungeon exist?
; LSR : TAX : LDA.l ExistsTransfer, X : TAX : LDA.l CompassExists, X : BEQ .skipCompassChecks
; do we have the compass
; sewers? outstanding?
; LDA.l CompassField : LDX.w $040C : AND.l DungeonMask, X : BEQ .done
; LDA.l CompassField : LDX.w DungeonID : AND.l DungeonMask, X : BEQ .done
;.skipCompassChecks
; either we're in a cave ($040C: $FF), compass doesn't exist, or we have the compass
; check if there are enemy drops
LDA.b $02 : PHA : REP #$10 ; store 02/03 for later
LDX.b $A0 : LDA.l UWSpecialFlagIndex, X : AND.w #$00FF ; determine if special case or not
LDA.b Scrap02 : PHA : REP #$10 ; store 02/03 for later
LDX.b RoomIndex : LDA.l UWSpecialFlagIndex, X : AND.w #$00FF ; determine if special case or not
CMP.w #$00FF : BEQ .loadNormalFlags
JSR FetchBitmaskForSpecialCase
PHA : LDA $A0 : ASL : TAX : PLA
PHA : LDA.b RoomIndex : ASL : TAX : PLA
BRA .testAgainstMask
.loadNormalFlags
TXA : ASL : TAX : LDA.l UWEnemyItemFlags, X
.testAgainstMask
STA.b $02 : LDA.l SpriteDropData, X : AND.b $02 : EOR.b $02
STA.b Scrap02 : LDA.l SpriteDropData, X : AND.b Scrap02 : EOR.b Scrap02
BEQ .cleanup
LDA.w #!BlueSquare : STA.w !EnemyDropIndicator
LDA.w #!BlueSquare : STA.w EnemyDropIndicator
.cleanup
SEP #$10 : PLA : STA.b $02
SEP #$10 : PLA : STA.b Scrap02
.done
SEP #$20
@@ -397,20 +387,20 @@ RTS
; Runs during sprite load of the room
LoadSpriteData:
INY : INY
LDA.b [$00], Y
CMP #$F3 : BCC .normal
LDA.b [Scrap00], Y
CMP.b #$F3 : BCC .normal
PHA
DEC.b $03 ; standing items shouldn't consume a sprite slot
LDX.b $03 ; these were changed to $03, for moved sprites
CMP #$F9 : BNE .not_multiworld
DEY : LDA.b [$00], Y : STA.l SprItemMWPlayer, X
DEC.b Scrap03 ; standing items shouldn't consume a sprite slot
LDX.b Scrap03 ; these were changed to $03, for moved sprites
CMP.b #$F9 : BNE .not_multiworld
DEY : LDA.b [Scrap00], Y : STA.l SprItemMWPlayer, X
LDA.b #$02 : STA.l SprDropsItem, X : BRA .common
.not_multiworld
LDA.b #$00 : STA.l SprItemMWPlayer, X
LDA.b #$01 : STA.l SprDropsItem, X
DEY
.common
DEY : LDA.b [$00], Y : STA.l SprItemReceipt, X
DEY : LDA.b [Scrap00], Y : STA.l SprItemReceipt, X
STA.b Scrap0E
LDA.l SprItemMWPlayer, X : BNE + ; skip if multiworld
PHX
@@ -425,7 +415,7 @@ LoadSpriteData:
INY : INY
PLA
PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $09C344-1 ; change return address to exit from Underworld_LoadSingleSprite
PEA.w $89C344-1 ; change return address to exit from Underworld_LoadSingleSprite
RTL
.normal
RTL
@@ -440,10 +430,10 @@ CheckIfDropValid:
;This section sets up the drop
LDA.b #$02 : STA.l SpawnedItemFlag
STX.w SpawnedItemIndex
LDA.l SprItemReceipt, X : STA SpawnedItemID
LDA.l SprItemMWPlayer, X : STA SpawnedItemMWPlayer
LDA.l SprItemReceipt, X : STA.l SpawnedItemID
LDA.l SprItemMWPlayer, X : STA.l SpawnedItemMWPlayer
LDY.b #$01 ; trigger the small key routines
LDA.w SpawnedItemID : STA.b $00 : CMP #$32 : BNE +
LDA.w SpawnedItemID : STA.b Scrap00 : CMP.b #$32 : BNE +
LDA.l StandingItemsOn : BNE +
INY ; big key routine
+
@@ -452,33 +442,33 @@ CheckIfDropValid:
LDX.b #$00 ; see if the item should be replaced by an absorbable
- CPX.b #$1A : BCS .done
LDA.l MinorForcedDrops, X
CMP.b $00 : BNE +
INX : LDA.l MinorForcedDrops, X : STA.b $00
CMP.b Scrap00 : BNE +
INX : LDA.l MinorForcedDrops, X : STA.b Scrap00
PLX : PLA : PLA : PEA.w PrepareEnemyDrop-1 ; change call stack for PrepareEnemyDrop
JSR IncrementCountForMinor
LDA.b $00 : RTL
LDA.b Scrap00 : RTL
+ INX #2 : BRA -
.done PLX
RTL ; unstun if stunned
DoNormalDrop:
SEP #$30
LDY.w $0CBA, X : BEQ .no_forced_drop
LDY.w SpriteForceDrop, X : BEQ .no_forced_drop
RTL
.no_forced_drop
PLA : PLA ; remove the JSL reswamturn lower 16 bits
PEA.w $06F996-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $86F996-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
RTL
RevealSpriteDrop2:
LDY.w SprDropsItem, X : BEQ .normal
BRA .no_forced_drop
.normal
LDY.w $0CBA, X : BEQ .no_forced_drop
LDY.w SpriteForceDrop, X : BEQ .no_forced_drop
RTL
.no_forced_drop
PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $06E3CE-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
PEA.w $86E3CE-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
RTL
PikitOverride:
@@ -497,17 +487,17 @@ RTL
; output - carry clear if the enemy doesn't drop, set if it does
CheckIfDropsInThisLocation:
REP #$30 : PHX ; save it for later
TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA.b $00 ; stores the bitmask for the specific drop
TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA.b Scrap00 ; stores the bitmask for the specific drop
; check sram, if gotten, run normal
LDA.b $A0 : ASL : TAX : LDA.l SpriteDropData, X : PLX ; restore X in case we're done
BIT.b $00 : BNE .normal_drop ; zero indicates the item has not been obtained
LDA.b RoomIndex : ASL : TAX : LDA.l SpriteDropData, X : PLX ; restore X in case we're done
BIT.b Scrap00 : BNE .normal_drop ; zero indicates the item has not been obtained
PHX ; save it for later
LDX.b $A0 : LDA.l UWSpecialFlagIndex, X : AND.w #$00FF
LDX.b RoomIndex : LDA.l UWSpecialFlagIndex, X : AND.w #$00FF
CMP.w #$00FF : BEQ + ; $FF indicates the EnemyItemFlags are sufficient
JSR FetchBitmaskForSpecialCase
BRA .test
+ TXA : ASL : TAX : LDA.l UWEnemyItemFlags, X
.test PLX : BIT.b $00 : BEQ .normal_drop ; zero indicates the enemy doesn't drop
.test PLX : BIT.b Scrap00 : BEQ .normal_drop ; zero indicates the enemy doesn't drop
.valid
SEP #$30 : SEC
RTS
@@ -520,15 +510,15 @@ RTS
; output - A the correct bitmask
FetchBitmaskForSpecialCase:
ASL : TAX
LDA.w $040C : BNE + ; here and branch to different function?
LDA.w DungeonID : BNE + ; here and branch to different function?
INC #2 ; move sewers to HC
+ CMP.w #$00FF : BNE + ; check if we are in a cave
LDA.l PreviousOverworldDoor : AND.w #$00FF ; use this instead of dungeon id
+ STA.b $02
+ STA.b Scrap02
- LDA.l UWSpecialFlag, X : AND.w #$00FF
CMP.w #$00FF : BNE + ; if the value is FF we are done, use 0 as bitmask
LDA.w #$0000 : RTS
+ CMP.b $02 : BNE + ; if the value matches the dungeon, use next 2 bytes as bitmask
+ CMP.b Scrap02 : BNE + ; if the value matches the dungeon, use next 2 bytes as bitmask
INX : LDA.l UWSpecialFlag, X : RTS
+ INX #3 : BRA - ; else move to the next row
@@ -551,14 +541,14 @@ db $D5, $E1 ; ARROW REFILL 5 (x$D5)
IncrementCountForMinor:
PHX : REP #$30
LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A
LDA.b $A0 : ASL : TAX
LDA.l SpriteDropData, X : BIT $0A : BNE .obtained
ORA $0A : STA SpriteDropData, X
LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA.b Scrap0A
LDA.b RoomIndex : ASL : TAX
LDA.l SpriteDropData, X : BIT.b Scrap0A : BNE .obtained
ORA.b Scrap0A : STA.l SpriteDropData, X
SEP #$10
JSR SetupEnemyDropIndicator
REP #$20
LDX.w $040C : CPX.b #$FF : BEQ +
LDX.w DungeonID : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
@@ -574,73 +564,73 @@ BitFieldMasks:
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004, $0002, $0001
; Runs during Sprite_E4_SmallKey and duning Sprite_E5_BigKey spawns
; Runs during Sprite_E4_SmallKey and during Sprite_E5_BigKey spawns
ShouldSpawnItem:
LDA $048E : CMP.b #$87 : BNE + ; check for hera basement cage
CPX #$0A : BNE + ; the hera basement key is always sprite 0x0A
LDA $A8 : AND.b #$03 : CMP.b #$02 : BNE + ; we're not in that quadrant
LDA.w $0403 : AND.w KeyRoomFlagMasks,Y : RTL
LDA.w RoomIndexMirror : CMP.b #$87 : BNE + ; check for hera basement cage
CPX.b #$0A : BNE + ; the hera basement key is always sprite 0x0A
LDA.b $A8 : AND.b #$03 : CMP.b #$02 : BNE + ; we're not in that quadrant
LDA.w RoomItemsTaken : AND.w KeyRoomFlagMasks,Y : RTL
+
; checking our sram table
PHX : PHY
REP #$30
LDA.b $A0 : ASL : TAY
LDA.w SprItemIndex, X : AND #$00FF : ASL
LDA.b RoomIndex : ASL : TAY
LDA.w SprItemIndex, X : AND.w #$00FF : ASL
PHX
TAX : LDA.l BitFieldMasks, X : STA $00
TAX : LDA.l BitFieldMasks, X : STA.b Scrap00
PLX ; restore X again
LDA.w SprItemFlags, X : BIT.w #$0001 : BNE +
TYX : LDA.l SpriteDropData, X : BIT $00 : BEQ .notObtained
TYX : LDA.l SpriteDropData, X : BIT.b Scrap00 : BEQ .notObtained
BRA .obtained
+ TYX : LDA.l RoomPotData, X : BIT $00 : BEQ .notObtained
+ TYX : LDA.l RoomPotData, X : BIT.b Scrap00 : BEQ .notObtained
.obtained
SEP #$30 : PLY : PLX : LDA #$01 : RTL ; already obtained
SEP #$30 : PLY : PLX : LDA.b #$01 : RTL ; already obtained
.notObtained
SEP #$30 : PLY : PLX
LDA #$00
LDA.b #$00
RTL
MarkSRAMForItem:
LDA.b RoomIndex : CMP.b #$87 : BNE + ; check for hera basement cage
CPX #$0A : BNE + ; the hera basement key is always sprite 0x0A
LDA $A8 : AND.b #$03 : CMP.b #$02 : BNE +
LDA.w $0403 : ORA.w KeyRoomFlagMasks, Y : RTL
CPX.b #$0A : BNE + ; the hera basement key is always sprite 0x0A
LDA.b $A8 : AND.b #$03 : CMP.b #$02 : BNE +
LDA.w RoomItemsTaken : ORA.w KeyRoomFlagMasks, Y : RTL
+ PHX : PHY : REP #$30
LDA.b $A0 : ASL : TAY
LDA.b RoomIndex : ASL : TAY
LDA.l SpawnedItemIndex : ASL
TAX : LDA.l BitFieldMasks, X : STA $00
TAX : LDA.l BitFieldMasks, X : STA.b Scrap00
TYX
LDA.w SpawnedItemFlag : CMP #$0001 : BEQ +
LDA SpriteDropData, X : ORA $00 : STA SpriteDropData, X
LDA.w SpawnedItemFlag : CMP.w #$0001 : BEQ +
LDA.l SpriteDropData, X : ORA.b Scrap00 : STA.l SpriteDropData, X
SEP #$10 : JSR SetupEnemyDropIndicator
BRA .end
+ LDA RoomPotData, X : ORA $00 : STA RoomPotData, X
+ LDA.l RoomPotData, X : ORA.b Scrap00 : STA.l RoomPotData, X
.end
SEP #$30 : PLY : PLX
LDA.w $0403
LDA.w RoomItemsTaken
RTL
SpriteKeyPrep:
LDA.w $0B9B : STA.w $0CBA, X ; what we wrote over
LDA.w $0B9B : STA.w SpriteForceDrop, X ; what we wrote over
PHA
LDA $A0 : CMP #$87 : BNE .continue
CPX #$0A : BNE .continue ; the hera basement key is always sprite 0x0A
LDA $A9 : ORA $AA : AND #$03 : CMP #$02 : BNE .continue
LDA #$00 : STA.w SpawnedItemFlag : STA SprItemFlags, X
LDA #$24 : STA $0E80, X
LDA.b RoomIndex : CMP.b #$87 : BNE .continue
CPX.b #$0A : BNE .continue ; the hera basement key is always sprite 0x0A
LDA.b LinkQuadrantH : ORA.b LinkQuadrantV : AND.b #$03 : CMP.b #$02 : BNE .continue
LDA.b #$00 : STA.w SpawnedItemFlag : STA.l SprItemFlags, X
LDA.b #$24 : STA.w $0E80, X
BRA +
.continue
LDA.w SpawnedItemIndex : STA SprItemIndex, X
LDA.w SpawnedItemMWPlayer : STA SprItemMWPlayer, X : STA.w !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.w SpawnedItemFlag : STA SprItemFlags, X : BEQ +
LDA.l SpawnedItemID : STA $0E80, X
LDA.w SpawnedItemIndex : STA.l SprItemIndex, X
LDA.w SpawnedItemMWPlayer : STA.l SprItemMWPlayer, X : STA.w !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.w SpawnedItemFlag : STA.l SprItemFlags, X : BEQ +
LDA.l SpawnedItemID : STA.w $0E80, X
PHA : PHY : PHX
JSL.l GetSpritePalette : PLX : STA $0F50, X ; setup the palette
JSL GetSpritePalette : PLX : STA.w SpriteOAMProp, X ; setup the palette
PLY : PLA
CMP #$24 : BNE ++ ;
LDA $A0 : CMP.b #$80 : BNE +
LDA SpawnedItemFlag : BNE +
LDA #$24 ; it's the big key drop?
CMP.b #$24 : BNE ++ ;
LDA.b RoomIndex : CMP.b #$80 : BNE +
LDA.l SpawnedItemFlag : BNE +
LDA.b #$24 ; it's the big key drop?
++ JSL RequestStandingItemVRAMSlot
+ PLA
RTL
@@ -651,55 +641,55 @@ SpriteKeyDrawGFX:
LDA.l SprItemMWPlayer, X : STA.w !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.w $0E80, X
CMP.b #$24 : BNE +
LDA $A0 : CMP #$80 : BNE ++
LDA SpawnedItemFlag : BNE ++
LDA #$24 : BRA +
LDA.b RoomIndex : CMP.b #$80 : BNE ++
LDA.l SpawnedItemFlag : BNE ++
LDA.b #$24 : BRA +
++ PLA
PHK : PEA.w .jslrtsreturn-1
PEA.w $068014 ; an rtl address - 1 in Bank06
PEA.w $868014 ; an rtl address - 1 in Bank06
JML Sprite_DrawAbsorbable
.jslrtsreturn
RTL
+ JSL DrawPotItem
CMP #$03 : BNE +
PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA
+ JSL.l Sprite_DrawShadowLong
CMP.b #$03 : BNE +
PHA : LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X : PLA
+ JSL Sprite_DrawShadowLong
PLA : RTL
KeyGet:
LDA CurrentSmallKeys ; what we wrote over
LDA.l CurrentSmallKeys ; what we wrote over
PHA
LDA.l StandingItemsOn : BNE +
PLA : RTL
+ LDY $0E80, X
LDA SprItemIndex, X : STA SpawnedItemIndex
LDA SprItemFlags, X : STA SpawnedItemFlag
LDA $A0 : CMP #$87 : BNE + ;check for hera cage
LDA SpawnedItemFlag : BNE + ; if it came from a pot, it's fine
+ LDY.w $0E80, X
LDA.l SprItemIndex, X : STA.l SpawnedItemIndex
LDA.l SprItemFlags, X : STA.l SpawnedItemFlag
LDA.b RoomIndex : CMP.b #$87 : BNE + ;check for hera cage
LDA.l SpawnedItemFlag : BNE + ; if it came from a pot, it's fine
JSR ShouldKeyBeCountedForDungeon : BCC ++
JSL CountChestKeyLong
++ PLA : RTL
+ STY $00
LDA SprItemMWPlayer, X : STA !MULTIWORLD_ITEM_PLAYER_ID
STA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .receive
+ STY.b Scrap00
LDA.l SprItemMWPlayer, X : STA.l !MULTIWORLD_ITEM_PLAYER_ID
STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .receive
PHX
LDA $040C : CMP #$FF : BNE +
LDA $00 : CMP.b #$AF : BNE .skip
LDA CurrentGenericKeys : INC : STA CurrentGenericKeys
LDA $00 : BRA .countIt
LDA.w DungeonID : CMP.b #$FF : BNE +
LDA.b Scrap00 : CMP.b #$AF : BNE .skip
LDA.l CurrentGenericKeys : INC : STA.l CurrentGenericKeys
LDA.b Scrap00 : BRA .countIt
+ LSR : TAX
LDA $00 : CMP.l KeyTable, X : BNE +
LDA.b Scrap00 : CMP.l KeyTable, X : BNE +
.countIt
LDA.l StandingItemCounterMask : AND SpawnedItemFlag : BEQ ++
JSL.l AddInventory
JSL AddInventory
++ PLX : PLA : RTL
+ CMP.b #$AF : beq .countIt ; universal key
CMP.b #$24 : beq .countIt ; small key for this dungeon
.skip PLX
.receive
JSL $0791b3 ; Player_HaltDashAttackLong
TYA : JSL.l AttemptItemSubstitution : JSL.l ResolveLootIDLong : TAY
JSL.l Link_ReceiveItem
JSL Player_HaltDashAttackLong
TYA : JSL AttemptItemSubstitution : JSL ResolveLootIDLong : TAY
JSL Link_ReceiveItem
PLA : DEC : RTL
KeyTable:
@@ -708,32 +698,32 @@ db $A0, $A0, $A2, $A3, $A4, $A5, $A6, $A7, $A8, $A9, $AA, $AB, $AC, $AD
; Input Y - the item type
ShouldKeyBeCountedForDungeon:
PHX
LDA $040C : CMP #$FF : BEQ .done
LDA.w DungeonID : CMP.b #$FF : BEQ .done
LSR : TAX
TYA : cmp KeyTable, X : BNE +
TYA : CMP.w KeyTable, X : BNE +
- PLX : SEC : RTS
+ CMP.B #$24 : BEQ -
+ CMP.b #$24 : BEQ -
.done
PLX : CLC : RTS
BigKeyGet:
LDY $0E80, X
CPY #$32 : BNE +
STZ $02E9 : LDY.b #$32 ; what we wrote over
LDY.w $0E80, X
CPY.b #$32 : BNE +
STZ.w ItemReceiptMethod : LDY.b #$32 ; what we wrote over
PHX : JSL Link_ReceiveItem : PLX ; what we wrote over
CLC : RTL
+ SEC : RTL
LoadProperties_PreserveCertainProps:
LDA $0E20, X : CMP #$E4 : BEQ +
CMP #$E5 : BEQ +
JML Sprite_LoadProperties
+ LDA $0F50, X : PHA
LDA $0E80, X : PHA
JSL Sprite_LoadProperties
PLA : STA $0E80, X
PLA : STA $0F50, X
LDA.w SpriteTypeTable, X : CMP.b #$E4 : BEQ +
CMP.b #$E5 : BEQ +
JML SpritePrep_LoadProperties
+ LDA.w SpriteOAMProp, X : PHA
LDA.w $0E80, X : PHA
JSL SpritePrep_LoadProperties
PLA : STA.w $0E80, X
PLA : STA.w SpriteOAMProp, X
RTL
SubstitionFlow:
@@ -759,7 +749,7 @@ SubstituteSpriteId:
+ LDA.b #$01
CPY.b #$18 : BCC +
LDA.b #$05
+ STA.b $0D
+ STA.b Scrap0D
JSR IncrementCountsForSubstitute
PHB : PHK : PLB
LDA.w SubstitionTable-$16, Y ; Do substitute
@@ -772,35 +762,35 @@ CheckSprite_Spawn:
BMI .check
RTL
.check
LDA $0D : CMP #$08 : BNE +
LDA $0372 : BNE .error
LDX #$0F
LDA.b Scrap0D : CMP.b #$08 : BNE +
LDA.w LinkDashing : BNE .error
LDX.b #$0F
; loop looking for a Sprite with state 0A (carried by the player)
- LDA $0DD0, X : CMP #$0A : BEQ .foundIt
- LDA.w SpriteAITable, X : CMP.b #$0A : BEQ .foundIt
DEX : BMI .error : BRA -
.foundIt
LDA #$00 : STZ $0DD0, X
LDA #$E4 : JSL Sprite_SpawnDynamically
LDA.b #$00 : STZ.w SpriteAITable, X
LDA.b #$E4 : JSL Sprite_SpawnDynamically
BMI .error
LDA #$40 : TSB $0308 : RTL
LDA.b #$40 : TSB.w AButtonAct : RTL
.error
LDA.b #$3C ; SFX2_3C - error beep
STA.w $012E
+ LDA #$FF
STA.w SFX2
+ LDA.b #$FF
RTL
PreventPotSpawn:
LDA #$40 : BIT $0308 : BEQ +
STZ $0308 : RTL
+ LDA.b #$80 : STA.w $0308 ; what we wrote over
LDA.b #$40 : BIT.w AButtonAct : BEQ +
STZ.w AButtonAct : RTL
+ LDA.b #$80 : STA.w AButtonAct ; what we wrote over
RTL
PreventPotSpawn2:
LDA $0308 : BEQ +
LDA.b #$01 : TSB.b $50 ; what we wrote over
LDA.w AButtonAct : BEQ +
LDA.b #$01 : TSB.b LinkStrafe ; what we wrote over
+ RTL
CheckIfPotIsSpecial:
@@ -809,7 +799,7 @@ CheckIfPotIsSpecial:
BEQ .specialpot
; Normal pot, so run the vanilla code
LDA.l $7EF3CA ; check for dark world
LDA.l CurrentWorld ; check for dark world
.specialpot ; zero flag already set, so gtg
RTL

View File

@@ -13,7 +13,7 @@ LampCheck:
RTL
;================================================================================
;--------------------------------------------------------------------------------
; Output: 0 locked, 1 openA
; Output: 0 locked, 1 open
;--------------------------------------------------------------------------------
CheckForZelda:
LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling
@@ -24,7 +24,7 @@ CheckForZelda:
RTL
;================================================================================
SetOverlayIfLamp:
JSL.l LampCheck
JSL LampCheck
STA.b SUBDESQ ; write it directly to the overlay, this isn't a terrible idea at all
RTL
;================================================================================
@@ -46,7 +46,7 @@ MirrorScrollSpawnZelda:
LDA.l MirrorEquipment : CMP.b #$01 : BNE + ;mirror scroll
LDA.l StartingEntrance : CMP.b #$02 : BEQ ++ ; zelda's cell
CMP.b #$04 : BNE +
++ INC $04AA
++ INC.w RespawnFlag
; what we replaced
+ STZ.b $11 : STZ.b $14
+ STZ.b GameSubMode : STZ.b NMISTRIPES
RTL

View File

@@ -14,5 +14,5 @@ MaidenCrystalScript:
LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals
LDA.b #$08 : STA.l MapIcons ; Update the map icon to just be Ganon's Tower
+
JML.l $9ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426
JML CrystalMaiden_KickOutOfDungeon ; <- F4F35 - sprite_crystal_maiden.asm : 426
;--------------------------------------------------------------------------------

View File

@@ -9,7 +9,7 @@ TryOpenMire:
LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .untriggered
; You have to be in the trigger window.
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
LDY.b #$02 : JSL Ancilla_CheckIfEntranceTriggered : BCC .untriggered
; Do the 3rd animation for opening entrances
LDA.b #$03 : STA.w OWEntranceCutscene
@@ -28,7 +28,7 @@ TryOpenTRock:
LDA.l OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .untriggered
; You have to be in the trigger window.
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
LDY.b #$03 : JSL Ancilla_CheckIfEntranceTriggered : BCC .untriggered
; Do the 4rd animation for opening entrances
LDA.b #$04 : STA.w OWEntranceCutscene
@@ -40,14 +40,14 @@ TryOpenTRock:
RTL
;--------------------------------------------------------------------------------
MedallionTrigger_Bombos:
STZ.b Strafe ; stuff we wrote over
STZ.b LinkStrafe ; stuff we wrote over
STZ.w FreezeSprites
PHA
LDA.l MireRequiredMedallion : BNE +
JSL.l TryOpenMire
JSL TryOpenMire
+ LDA.l TRockRequiredMedallion : BNE +
JSL.l TryOpenTRock
JSL TryOpenTRock
+
PLA
RTL
@@ -55,9 +55,9 @@ RTL
MedallionTrigger_Ether:
PHA
LDA.l MireRequiredMedallion : CMP.b #$01 : BNE +
JSL.l TryOpenMire
JSL TryOpenMire
+ LDA.l TRockRequiredMedallion : CMP.b #$01 : BNE +
JSL.l TryOpenTRock
JSL TryOpenTRock
+
PLA
RTL
@@ -65,9 +65,9 @@ RTL
MedallionTrigger_Quake:
PHA
LDA.l MireRequiredMedallion : CMP.b #$02 : BNE +
JSL.l TryOpenMire
JSL TryOpenMire
+ LDA.l TRockRequiredMedallion : CMP.b #$02 : BNE +
JSL.l TryOpenTRock
JSL TryOpenTRock
+
PLA
RTL

View File

@@ -1,8 +1,8 @@
OnMenuLoad:
LDA.b #UploadMenuOnlyIcons>>0 : STA NMIAux
LDA.b #UploadMenuOnlyIcons>>8 : STA NMIAux+1
LDA.b #UploadMenuOnlyIcons>>16 : STA NMIAux+2
LDA.b #$0E : STA.b $10 ; what we overwrote
LDA.b #UploadMenuOnlyIcons>>0 : STA.l NMIAux
LDA.b #UploadMenuOnlyIcons>>8 : STA.l NMIAux+1
LDA.b #UploadMenuOnlyIcons>>16 : STA.l NMIAux+2
LDA.b #$0E : STA.b GameMode ; what we overwrote
RTL
UploadMenuOnlyIcons:
@@ -15,7 +15,7 @@ UploadMenuOnlyIcons:
SEP #$20
LDA.b #MenuOnlyIcons>>16 : STA.w $4344
LDA.b #$80 : STA.w $2118
LDA.b #$10 : STA.w $420B
LDA.b #$10 : STA.w DMAENABLE
RTL

View File

@@ -11,7 +11,7 @@ LDX.b #$FF
TXA : ASL A : TAX
LDA.l MapCompassFlag
AND #$01 : BNE +
AND.b #$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
@@ -22,32 +22,32 @@ LDX.b #$FF
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, X : CMP.b #$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
LDA.b FrameCounter : AND.b #$10 : BNE .skip_draw
.is_crystal
JSR.w WorldMapIcon_AdjustCoordinate
JSR WorldMapIcon_AdjustCoordinate
.dont_adjust
JSR.w WorldMap_CalculateOAMCoordinates
JSR 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.l WorldMapIcon_tile+1, X : STA.b Scrap0D
LDA.l WorldMapIcon_tile, X : STA.b Scrap0C
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
LDA.b FrameCounter : LSR #3 : AND.b #$03 : TAX
LDA.l WorldMap_RedXChars,X : STA.b Scrap0D
LDA.b #$32 : STA.b Scrap0C : LDA.b #$00
.continue
STA.b $0B
STA.b Scrap0B
PLX : PHX
INX : JSR.w WorldMap_HandleSpriteBlink
INX : JSR WorldMap_HandleSpriteBlink
.skip_draw
; end of loop
PLX : CPX #12 : BCS + : JMP .loopStart : +
PLX : CPX.b #12 : BCS + : JMP .loopStart : +
PLA : STA.l $7EC10B
PLA : STA.l $7EC10A
@@ -59,23 +59,23 @@ LDX.b #$FF
; X - the index of the prize marker
OverworldMap_CheckForPrize:
PHX
LDA #$00 : STA.l MapCompassFlag
LDA.b #$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 MapCompassFlag : ORA.b #$01 : STA.l MapCompassFlag
LDA.l CurrentWorld : AND.b #$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 : ORA.b #$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
CMP.b #$02 : BNE .checkIfObtained
LDA.l CurrentWorld : AND.b #$40 : BNE +
CPX.b #3 : BCS .fail : BRA .checkIfObtained
+ CPX.b #10 : BCS .fail
CPX.b #3 : BCC .fail
.checkIfObtained
LDA.l MC_DungeonIdsForPrize, X
@@ -105,14 +105,14 @@ RTS
; 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 +
LDA.l CompassMode : AND.b #$80 : BEQ .unset ; should I check for compass logic
LDA.l CompassMode : AND.b #$40 : BEQ .set ; compasses/maps aren't shuffled
LDA.l CompassMode : AND.b #$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
LDA.l CompassField, X : ORA.l MapOverlay, X
PLX
AND.l MC_Masks, X : BNE .set ; is the compass obtained
.unset
@@ -127,13 +127,13 @@ RTS
; 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
LDA.l CurrentWorld : AND.b #$40 : BNE + ; not really sure on this check
LDA.l MapField : ORA.l MapOverlay : AND.b #$01 : BNE .set : BRA .continue
+ LDA.l MapField : ORA.l 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
LDA.l MapField, X : ORA.l MapOverlay, X
PLX
AND.l MC_Masks, X : BNE .set ; is the map obtained?
.unset

32
msu.asm
View File

@@ -226,7 +226,7 @@ CheckMusicLoadRequest:
PHA
LDA.l CrystalsField : CMP.b #$7F : BEQ -
LDA.l CurrentWorld : BEQ --
LDA.b OverworldIndex : CMP #$40 : BNE --
LDA.b OverworldIndex : CMP.b #$40 : BNE --
PLA
LDA.b #15 : BRA .check_fallback-3
.castle
@@ -248,7 +248,7 @@ CheckMusicLoadRequest:
PLA : LSR #3 : TAX
LDA.w MSUFallbackTable,X : BEQ .secondary_fallback : CMP.b #$FF : BEQ .mute
- : CPY #$00 : BEQ +
- : CPY.b #$00 : BEQ +
LSR : DEY : BRA -
+
@@ -264,8 +264,8 @@ CheckMusicLoadRequest:
TAX : LDA.l MusicShuffleTable-1,X
PLX
CMP.w MusicControlRequest : BEQ .unmute
CPX #35 : !BLT +
CPX #47 : !BLT .dungeon_fallback
CPX.b #35 : !BLT +
CPX.b #47 : !BLT .dungeon_fallback
+
STA.w MusicControlRequest
@@ -377,7 +377,7 @@ SpiralStairsPreCheck:
;--------------------------------------------------------------------------------
SpiralStairsPostCheck:
LDA.l DRMode : BEQ + ; if door rando enabled
LDA.b $A2 : CMP.w #$0007 : BNE .done
LDA.b PreviousRoom : CMP.w #$0007 : BNE .done
LDA.l Music_Hera : TAX : STX.w MusicControlRequest
BRA .done
+ LDA.b RoomIndex
@@ -496,9 +496,9 @@ PHA : XBA : PHA
JSR IsResumableTrack : BCC +
; dont save if we already saved recently
REP #$20
LDA.w MSUResumeTrack : AND #$00FF : BEQ ++
LDA.l NMIFrames : !SUB MSUResumeTime : PHA
LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE +++
LDA.w MSUResumeTrack : AND.w #$00FF : BEQ ++
LDA.l NMIFrames : !SUB.l MSUResumeTime : PHA
LDA.l NMIFrames+2 : SBC.l MSUResumeTime+2 : BNE +++
PLA : CMP.l MSUResumeTimer : !BLT .too_early
BRA ++
+++
@@ -571,7 +571,7 @@ MSUMain:
PLA : LSR #3 : TAX
LDA.w MSUFallbackTable,X : BEQ +++ : CMP.b #$FF : BEQ ++
- : CPY #$00 : BEQ +
- : CPY.b #$00 : BEQ +
LSR : DEY : BRA -
+
@@ -663,8 +663,8 @@ MSUMain:
PLX
TXA : CMP.w MSUResumeTrack : BNE + ; dont resume if too late
REP #$20
LDA.l NMIFrames : !SUB MSUResumeTime : PHA
LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE ++
LDA.l NMIFrames : !SUB.l MSUResumeTime : PHA
LDA.l NMIFrames+2 : SBC.l MSUResumeTime+2 : BNE ++
PLA : CMP.l MSUResumeTimer : !BGE +++
SEP #$20
LDA.b #!FLAG_RESUME_FADEIN : BRA .done_resume
@@ -677,8 +677,8 @@ MSUMain:
STA.w MSUResumeControl
LDA.b #$00 : STA.w MSUResumeTrack
+
CPX #07 : BNE + ; Kakariko Village
LDA.b GameMode : CMP #$07 : BNE +
CPX.b #07 : BNE + ; Kakariko Village
LDA.b GameMode : CMP.b #$07 : BNE +
; we're in link's house -> ignore
LDA.b #$00
BRA ++
@@ -687,7 +687,7 @@ MSUMain:
++
STA.w MSULoadedTrack
STX.w CurrentMSUTrack
LDA.w MSUPackCurrent : CMP #$FE : !BLT +
LDA.w MSUPackCurrent : CMP.b #$FE : !BLT +
LDA.b #$00 : BRA ++
+ : LDA.l MSUTrackList-1,X
++ : STA.w MSUDelayedCommand
@@ -740,7 +740,7 @@ PendantFanfareWait:
LDA.w MSUID+2 : CMP.w #!VAL_MSU_ID_23 : BNE .spc
LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc
SEP #$20
LDA.w MSUPackCurrent : CMP #$FE : !BGE .spc
LDA.w MSUPackCurrent : CMP.b #$FE : !BGE .spc
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE .spc
LDA.w MSUDelayedCommand : BNE .continue
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BEQ .done
@@ -799,7 +799,7 @@ EndingMusicWait:
LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .done
SEP #$20
.wait
LDA.b Strafe : BNE .done
LDA.b LinkStrafe : BNE .done
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BNE .wait
.done
SEP #$20

View File

@@ -3,43 +3,43 @@
macro Print_Text(hdr, hdr_len, player_id)
PHX : PHY : PHP
REP #$30
LDX #$0000
LDX.w #$0000
-
CPX <hdr_len> : !BGE ++
LDA <hdr>, X
STA !MULTIWORLD_HUD_CHARACTER_DATA, X
CPX.w <hdr_len> : !BGE ++
LDA.l <hdr>, X
STA.l !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2
BRA -
++
LDY <hdr_len>
LDY.w <hdr_len>
LDA <player_id>
AND #$00FF
LDA.l <player_id>
AND.w #$00FF
DEC
CMP #$00FF : !BGE .textdone
CMP.w #$00FF : !BGE .textdone
ASL #5
TAX
-
CPY <hdr_len>+$20 : !BGE ++
LDA PlayerNames, X
PHX : TYX : STA !MULTIWORLD_HUD_CHARACTER_DATA, X : PLX
CPY.w <hdr_len>+$20 : !BGE ++
LDA.l PlayerNames, X
PHX : TYX : STA.l !MULTIWORLD_HUD_CHARACTER_DATA, X : PLX
INX #2 : INY #2
BRA -
++
TYX
-
CPX #$0040 : !BGE ++
LDA #$007F
STA !MULTIWORLD_HUD_CHARACTER_DATA, X
CPX.w #$0040 : !BGE ++
LDA.w #$007F
STA.l !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2
BRA -
++
SEP #$20
LDA #$01 : STA !NMI_MW+1 : STA !NMI_MW
LDA !MULTIWORLD_HUD_DELAY
STA !MULTIWORLD_HUD_TIMER
LDA.b #$01 : STA.l !NMI_MW+1 : STA.l !NMI_MW
LDA.b !MULTIWORLD_HUD_DELAY
STA.l !MULTIWORLD_HUD_TIMER
.textdone
PLP : PLY : PLX
endmacro
@@ -48,38 +48,38 @@ WriteText:
{
PHA : PHX : PHP
SEP #$10
LDX $4340 : PHX ; preserve DMA parameters
LDX $4341 : PHX ; preserve DMA parameters
LDX $4342 : PHX ; preserve DMA parameters
LDX $4343 : PHX ; preserve DMA parameters
LDX $4344 : PHX ; preserve DMA parameters
LDX $4345 : PHX ; preserve DMA parameters
LDX $4346 : PHX ; preserve DMA parameters
LDX $2115 : PHX ; preserve DMA parameters
LDX $2116 : PHX ; preserve DMA parameters
LDX $2117 : PHX ; preserve DMA parameters
LDX $2100 : PHX : LDX.b #$80 : STX $2100 ; save screen state & turn screen off
LDX.w $4340 : PHX ; preserve DMA parameters
LDX.w $4341 : PHX ; preserve DMA parameters
LDX.w $4342 : PHX ; preserve DMA parameters
LDX.w $4343 : PHX ; preserve DMA parameters
LDX.w $4344 : PHX ; preserve DMA parameters
LDX.w $4345 : PHX ; preserve DMA parameters
LDX.w $4346 : PHX ; preserve DMA parameters
LDX.w $2115 : PHX ; preserve DMA parameters
LDX.w $2116 : PHX ; preserve DMA parameters
LDX.w $2117 : PHX ; preserve DMA parameters
LDX.w $2100 : PHX : LDX.b #$80 : STX.w $2100 ; save screen state & turn screen off
REP #$20
LDX #$80 : STX $2115
LDA #$6000+$0340 : STA $2116
LDA.w #!MULTIWORLD_HUD_CHARACTER_DATA : STA $4342
LDX.b #!MULTIWORLD_HUD_CHARACTER_DATA>>16 : STX $4344
LDA #$0040 : STA $4345
LDA #$1801 : STA $4340
LDX #$10 : STX $420B
LDX.b #$80 : STX.w $2115
LDA.w #$6000+$0340 : STA.w $2116
LDA.w #!MULTIWORLD_HUD_CHARACTER_DATA : STA.w $4342
LDX.b #!MULTIWORLD_HUD_CHARACTER_DATA>>16 : STX.w $4344
LDA.w #$0040 : STA.w $4345
LDA.w #$1801 : STA.w $4340
LDX.b #$10 : STX.w DMAENABLE
PLX : STX $2100 ; put screen back however it was before
PLX : STX $2117 ; restore DMA parameters
PLX : STX $2116 ; restore DMA parameters
PLX : STX $2115 ; restore DMA parameters
PLX : STX $4346 ; restore DMA parameters
PLX : STX $4345 ; restore DMA parameters
PLX : STX $4344 ; restore DMA parameters
PLX : STX $4343 ; restore DMA parameters
PLX : STX $4342 ; restore DMA parameters
PLX : STX $4341 ; restore DMA parameters
PLX : STX $4340 ; restore DMA parameters
PLX : STX.w $2100 ; put screen back however it was before
PLX : STX.w $2117 ; restore DMA parameters
PLX : STX.w $2116 ; restore DMA parameters
PLX : STX.w $2115 ; restore DMA parameters
PLX : STX.w $4346 ; restore DMA parameters
PLX : STX.w $4345 ; restore DMA parameters
PLX : STX.w $4344 ; restore DMA parameters
PLX : STX.w $4343 ; restore DMA parameters
PLX : STX.w $4342 ; restore DMA parameters
PLX : STX.w $4341 ; restore DMA parameters
PLX : STX.w $4340 ; restore DMA parameters
PLP : PLX : PLA
RTL
}
@@ -87,49 +87,49 @@ RTL
GetMultiworldItem:
{
PHP
LDA !MULTIWORLD_ITEM : BNE +
LDA !MULTIWORLD_HUD_TIMER : BNE +
LDA.l !MULTIWORLD_ITEM : BNE +
LDA.l !MULTIWORLD_HUD_TIMER : BNE +
BRL .return
+
LDA $10
CMP #$07 : BEQ +
CMP #$09 : BEQ +
CMP #$0B : BEQ +
LDA.b GameMode
CMP.b #$07 : BEQ +
CMP.b #$09 : BEQ +
CMP.b #$0B : BEQ +
BRL .return
+
LDA !MULTIWORLD_HUD_TIMER : BEQ .textend
DEC #$01 : STA !MULTIWORLD_HUD_TIMER
CMP #$00 : BNE .textend
LDA.l !MULTIWORLD_HUD_TIMER : BEQ .textend
DEC.b #$01 : STA.l !MULTIWORLD_HUD_TIMER
CMP.b #$00 : BNE .textend
; Clear text
PHP : REP #$30
LDX #$0000
LDX.w #$0000
-
CPX #$0040 : !BGE ++
LDA #$007F
STA !MULTIWORLD_HUD_CHARACTER_DATA, X
CPX.w #$0040 : !BGE ++
LDA.w #$007F
STA.l !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2
BRA -
++
PLP
LDA #$01 : STA !NMI_MW+1 : STA !NMI_MW
LDA.b #$01 : STA.l !NMI_MW+1 : STA.l !NMI_MW
.textend
LDA $5D
CMP #$00 : BEQ +
CMP #$04 : BEQ +
CMP #$17 : BEQ +
LDA.b LinkState
CMP.b #$00 : BEQ +
CMP.b #$04 : BEQ +
CMP.b #$17 : BEQ +
BRL .return
+
LDA !MULTIWORLD_ITEM : BNE +
LDA.l !MULTIWORLD_ITEM : BNE +
BRL .return
+
PHA
LDA #$22
LDY #$04
LDA.b #$22
LDY.b #$04
JSL Ancilla_CheckForAvailableSlot : BPL +
PLA
BRL .return
@@ -137,55 +137,55 @@ GetMultiworldItem:
PLA
; Check if we have a key for the dungeon we are currently in
LDX $040C
LDX.w DungeonID
; Escape
CMP #$A0 : BNE + : CPX #$00 : BEQ ++ : CPX #$02 : BEQ ++ : BRL .keyend : ++ : BRL .thisdungeon : +
CMP.b #$A0 : BNE + : CPX.b #$00 : BEQ ++ : CPX.b #$02 : BEQ ++ : BRL .keyend : ++ : BRL .thisdungeon : +
; Eastern
CMP #$A2 : BNE + : CPX #$04 : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$A2 : BNE + : CPX.b #$04 : BEQ .thisdungeon : BRA .keyend : +
; Desert
CMP #$A3 : BNE + : CPX #$06 : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$A3 : BNE + : CPX.b #$06 : BEQ .thisdungeon : BRA .keyend : +
; Hera
CMP #$AA : BNE + : CPX #$14 : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$AA : BNE + : CPX.b #$14 : BEQ .thisdungeon : BRA .keyend : +
; Aga
CMP #$A4 : BNE + : CPX #$08 : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$A4 : BNE + : CPX.b #$08 : BEQ .thisdungeon : BRA .keyend : +
; PoD
CMP #$A6 : BNE + : CPX #$0C : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$A6 : BNE + : CPX.b #$0C : BEQ .thisdungeon : BRA .keyend : +
; Swamp
CMP #$A5 : BNE + : CPX #$0A : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$A5 : BNE + : CPX.b #$0A : BEQ .thisdungeon : BRA .keyend : +
; SW
CMP #$A8 : BNE + : CPX #$10 : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$A8 : BNE + : CPX.b #$10 : BEQ .thisdungeon : BRA .keyend : +
; TT
CMP #$AB : BNE + : CPX #$16 : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$AB : BNE + : CPX.b #$16 : BEQ .thisdungeon : BRA .keyend : +
; Ice
CMP #$A9 : BNE + : CPX #$12 : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$A9 : BNE + : CPX.b #$12 : BEQ .thisdungeon : BRA .keyend : +
; Mire
CMP #$A7 : BNE + : CPX #$0E : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$A7 : BNE + : CPX.b #$0E : BEQ .thisdungeon : BRA .keyend : +
; TR
CMP #$AC : BNE + : CPX #$18 : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$AC : BNE + : CPX.b #$18 : BEQ .thisdungeon : BRA .keyend : +
; GT
CMP #$AD : BNE + : CPX #$1A : BEQ .thisdungeon : BRA .keyend : +
CMP.b #$AD : BNE + : CPX.b #$1A : BEQ .thisdungeon : BRA .keyend : +
; GT BK
CMP #$92 : BNE .keyend : CPX #$1A : BNE .keyend : LDA #$32 : BRA .keyend
CMP.b #$92 : BNE .keyend : CPX.b #$1A : BNE .keyend : LDA.b #$32 : BRA .keyend
.thisdungeon
LDA #$24
LDA.b #$24
.keyend
STA $02D8 ;Set Item to receive
STA.w ItemReceiptID ;Set Item to receive
TAY
LDA #$01 : STA !MULTIWORLD_RECEIVING_ITEM
LDA #$00 : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.b #$01 : STA.l !MULTIWORLD_RECEIVING_ITEM
LDA.b #$00 : STA.l !MULTIWORLD_ITEM_PLAYER_ID
STZ $02E9
JSL.l $0791B3 ; Player_HaltDashAttackLong
STZ.w ItemReceiptMethod
JSL Player_HaltDashAttackLong
JSL Link_ReceiveItem
LDA #$00 : STA !MULTIWORLD_ITEM : STA !MULTIWORLD_RECEIVING_ITEM
LDA.b #$00 : STA.l !MULTIWORLD_ITEM : STA.l !MULTIWORLD_RECEIVING_ITEM
%Print_Text(HUD_ReceivedFrom, #$001C, !MULTIWORLD_ITEM_FROM)
.return
PLP
LDA $5D : ASL A : TAX
LDA.b LinkState : ASL A : TAX
RTL
}
@@ -193,10 +193,10 @@ Multiworld_OpenKeyedObject:
{
PHP
SEP #$20
LDA ChestData_Player+2, X : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l ChestData_Player+2, X : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP
LDA !Dungeon_ChestData+2, X ; thing we wrote over
LDA.l !Dungeon_ChestData+2, X ; thing we wrote over
RTL
}
@@ -204,7 +204,7 @@ Multiworld_BottleVendor_GiveBottle:
{
PHA : PHP
SEP #$20
LDA BottleMerchant_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l BottleMerchant_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over
@@ -215,7 +215,7 @@ Multiworld_MiddleAgedMan_ReactToSecretKeepingResponse:
{
PHA : PHP
SEP #$20
LDA PurpleChest_Item_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l PurpleChest_Item_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over
@@ -226,7 +226,7 @@ Multiworld_Hobo_GrantBottle:
{
PHA : PHP
SEP #$20
LDA HoboItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l HoboItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over
@@ -237,7 +237,7 @@ Multiworld_MasterSword_GrantToPlayer:
{
PHA : PHP
SEP #$20
LDA PedestalSword_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l PedestalSword_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over
@@ -246,40 +246,40 @@ RTL
Multiworld_AddReceivedItem_notCrystal:
{
TYA : STA $02E4 : PHX ; things we wrote over
TYA : STA.w CutsceneFlag : PHX ; things we wrote over
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PHY : LDY $02D8 : JSL AddInventory : PLY
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PHY : LDY.w ItemReceiptID : JSL AddInventory : PLY
%Print_Text(HUD_SentTo, #$0010, !MULTIWORLD_ITEM_PLAYER_ID)
LDA #$33 : STA $012F
LDA.b #$33 : STA.w SFX3
JML.l AddReceivedItem_gfxHandling
JML AddReceivedItem_gfxHandling
+
JML.l AddReceivedItem_notCrystal+5
JML AddReceivedItem_notCrystal+5
}
Multiworld_Ancilla_ReceiveItem_stillInMotion:
{
CMP.b #$28 : BNE + ; thing we wrote over
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
JML.l Ancilla_ReceiveItem_stillInMotion_moveon
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE +
JML Ancilla_ReceiveItem_stillInMotion_moveon
+
JML.l Ancilla_ReceiveItem_dontGiveRupees
JML Ancilla_ReceiveItem_dontGiveRupees
}
Multiworld_ConsumingFire_TransmuteToSkullWoodsFire:
{
LDA $8A : AND.b #$40 : BEQ .failed ; things we wrote over
LDA $0C4A : CMP #$22 : BEQ .failed
LDA $0C4B : CMP #$22 : BEQ .failed
LDA $0C4C : CMP #$22 : BEQ .failed
LDA $0C4D : CMP #$22 : BEQ .failed
LDA $0C4E : CMP #$22 : BEQ .failed
LDA $0C4F : CMP #$22 : BEQ .failed
LDA.b OverworldIndex : AND.b #$40 : BEQ .failed ; things we wrote over
LDA.w AncillaID : CMP.b #$22 : BEQ .failed
LDA.w AncillaID+1 : CMP.b #$22 : BEQ .failed
LDA.w AncillaID+2 : CMP.b #$22 : BEQ .failed
LDA.w AncillaID+3 : CMP.b #$22 : BEQ .failed
LDA.w AncillaID+4 : CMP.b #$22 : BEQ .failed
LDA.w AncillaID+5 : CMP.b #$22 : BEQ .failed
JML.l ConsumingFire_TransmuteToSkullWoodsFire_continue
JML ConsumingFire_TransmuteToSkullWoodsFire_continue
.failed
JML.l AddDoorDebris_spawn_failed
JML AddDoorDebris_spawn_failed
}

View File

@@ -3,7 +3,7 @@ PreOverworld_LoadProperties_ChooseMusic:
; A: scratch space (value never used)
; Y: set to overworld animated tileset
; X: set to music track/command id
JSL.l FixFrogSmith ; Just a convenient spot to install this hook
JSL FixFrogSmith ; Just a convenient spot to install this hook
LDY.b #$58 ; death mountain animated tileset.
@@ -79,7 +79,7 @@ PreOverworld_LoadProperties_ChooseMusic:
LDX.b #$F3
+
JML.l PreOverworld_LoadProperties_SetSong
JML PreOverworld_LoadProperties_SetSong
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
@@ -103,8 +103,8 @@ Overworld_FinishMirrorWarp:
LDA.w #$0000 : STA.l FadeTimer : STA.l FadeDirection
SEP #$20
JSL $80D7C8
LDA.b #$80 : STA.b HDMAENQ
JSL ReloadPreviouslyLoadedSheets
LDA.b #$80 : STA.b HDMAENABLEQ
LDX.b #$04 ; bunny theme
; if not inverted and light world, or inverted and dark world, skip moon pearl check
@@ -265,24 +265,24 @@ Overworld_MosaicDarkWorldChecks:
;
; On entry, A=16bit XY=8bit, A & X safe to mod, Y unknown
Underworld_DoorDown_Entry:
LDX #$FF ; some junk value to be used later to determine if the below lines will change the track
LDX.b #$FF ; some junk value to be used later to determine if the below lines will change the track
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #2 : !BLT .vanilla
LDA.l DRMode : BNE .done
.vanilla ; thing we wrote over
LDA $A0 : CMP.w #$0012 : BNE +
LDA.b RoomIndex : CMP.w #$0012 : BNE +
LDX.b #$14 ; value for Sanc music
BRA .done
+ LDA $A2 : CMP.w #$0012 : BNE .done
+ LDA.b PreviousRoom : CMP.w #$0012 : BNE .done
LDX.b #$10 ; value for Hyrule Castle music
.done
LDA $A0 : RTL
LDA.b RoomIndex : RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Check if the boss in ToH has been defeated (16-bit accumulator)
CheckHeraBossDefeated:
LDA RoomDataWRAM[$07].high : AND.w #$00FF : BEQ +
LDA.l RoomDataWRAM[$07].high : AND.w #$00FF : BEQ +
SEC : RTL
+ CLC : RTL

View File

@@ -129,7 +129,7 @@ NewHUD_DrawDungeonCounters:
LDA.w UpdateHUDFlag : BEQ NewHUD_DrawPrizeIcon
LDA.l CompassMode : ORA.l MapHUDMode : BIT.b #$03 : BEQ NewHUD_DrawPrizeIcon
LDX.b IndoorsFlag : BNE +
JMP.w NewHUD_DrawMagicMeter
JMP NewHUD_DrawMagicMeter
+
SEP #$30
; extra hard safeties for getting dungeon ID to prevent crashes
@@ -139,10 +139,10 @@ NewHUD_DrawDungeonCounters:
LSR : TAY
PHX : PHY
JSR.w DrawCompassCounts
JSR DrawCompassCounts
SEP #$10
PLY : PLX
JSR.w DrawMapCounts
JSR DrawMapCounts
;================================================================================
NewHUD_DrawPrizeIcon:
@@ -213,10 +213,10 @@ NewHUD_DrawItemCounter:
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$0E
LDA.w TotalItemCounter
JSR.w HUDHex4Digit
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
JSR HUDHex4Digit
LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+$06
REP #$20 : LDA.w TotalItemCounter
LDX.w #!BlankTile
CMP.w #100 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$02
@@ -230,11 +230,11 @@ NewHUD_DrawItemCounter:
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$10
LDA.w TotalItemCounter
JSR.w HUDHex4Digit
LDA.b $04 : TAX : STX.w HUDGoalIndicator+$00
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
JSR HUDHex4Digit
LDA.b Scrap04 : TAX : STX.w HUDGoalIndicator+$00
LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+$06
REP #$20 : LDA.w TotalItemCounter
LDX.w #!BlankTile
CMP.w #1000 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$00
@@ -457,8 +457,8 @@ UpdateHearts:
TAY
LDA.w #HUDTileMapBuffer+$068
STA.b $07
STA.b $09
STA.b Scrap07
STA.b Scrap09
.next_filled_heart
CPX.b #$01
@@ -477,12 +477,12 @@ UpdateHearts:
INC
.add_heart
STA.b ($07)
STA.b (Scrap07)
DEY
DEX
LDA.b $07
LDA.b Scrap07
INC
INC
CMP.w #HUDTileMapBuffer+$07C
@@ -495,12 +495,12 @@ UpdateHearts:
ADC.w #$002B
.fine
STA.b $07
STA.b Scrap07
CPY.b #$00
BNE .next_filled_heart
STA.b $09
STA.b Scrap09
BRA .next_filled_heart
.done_hearts
@@ -513,14 +513,14 @@ UpdateHearts:
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A1
STA.b ($09)
STA.b (Scrap09)
BRA .skip_partial
.more_than_half
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A0
STA.b ($09)
STA.b (Scrap09)
.skip_partial
SEP #$30

View File

@@ -71,7 +71,7 @@ macro ProgrammableItemLogic(index)
LDA.l ProgrammableItemLogicPointer_<index>+2 : BNE ?jump
BRA ?end
?jump:
JSL.l ProgrammableItemLogicJump_<index>
JSL ProgrammableItemLogicJump_<index>
?end:
endmacro
@@ -89,12 +89,12 @@ ProcessEventItems:
CMP.b #$E0 : BNE +
REP #$30 ; set 16-bit accumulator & index registers
LDA.l RNGItem : ASL : TAX
LDA.l EventDataOffsets, X : !ADD #EventDataTable : STA.b Scrap00
LDA.l EventDataOffsets, X : !ADD.l #EventDataTable : STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
LDA.b #$AF : STA.b Scrap02
JSL.l LoadDialogAddressIndirect
JSL LoadDialogAddressIndirect
LDA.l RNGItem : INC : STA.l RNGItem
SEP #$10 ; set 8-bit index registers
@@ -103,7 +103,7 @@ ProcessEventItems:
LDA.l GoalCounter : INC : STA.l GoalCounter
CMP.l GoalItemRequirement : BCC ++
LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++
JSL.l ActivateGoal
JSL ActivateGoal
++
SEP #$20 ; set 8-bit accumulator
LDX.b #$01 : BRA .done
@@ -119,18 +119,18 @@ RTS
;--------------------------------------------------------------------------------
AddReceivedItemExpanded:
PHA : PHX
LDA.l RemoteItems : BEQ + : LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
LDA.l RemoteItems : BEQ + : LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
LDA.w ItemReceiptMethod : BEQ ++ : CMP.b #$03 : BNE +++ : ++
; fromTextOrObject
LDA.w $0345 : BEQ ++ : LDA.b #$04 : ++ : STA.b $5D ; Restore Link to his swimming state
LDA.w $0345 : BEQ ++ : LDA.b #$04 : ++ : STA.b LinkState ; Restore Link to his swimming state
STZ.w ItemReceiptPose : STZ.w NoDamage : STZ.w CutsceneFlag
LDA.b #$0E : STA.w SFX3
+++
STZ.w ItemReceiptID : STZ.w $02D9 : STZ.w ItemReceiptMethod
STZ.w ItemReceiptID : STZ.w ItemReceiptID+1 : STZ.w ItemReceiptMethod
PHY : LDY.b #$00 : JSL AddInventory : PLY
PLX : PLA : RTL
+ PLX : PLA
JSR.w ResolveReceipt
JSR ResolveReceipt
PHB : PHK
JML AddReceivedItem+2
@@ -138,7 +138,7 @@ AddReceivedItemExpandedGetItem:
PHX : PHB
LDA.w ItemReceiptID
JSL.l FreeDungeonItemNotice
JSL FreeDungeonItemNotice
PHA : LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PLA : BRA .done
+ PLA
@@ -151,9 +151,9 @@ RTL
ItemBehavior:
REP #$30
AND #$00FF : ASL : TAX
AND.w #$00FF : ASL : TAX
SEP #$20
JMP.w (ItemReceipts_behavior,X)
JMP (ItemReceipts_behavior,X)
.skip
RTS
@@ -266,7 +266,7 @@ ItemBehavior:
RTS
.bow
BIT #$40 : BNE .silversbow
BIT.b #$40 : BNE .silversbow
LDA.b #$01 : STA.l BowEquipment
RTS
@@ -284,11 +284,11 @@ ItemBehavior:
TAX
LDA.l DungeonItemMasks,X : TAY
ORA.l CompassField : STA.l CompassField
JMP.w .increment_compass
JMP .increment_compass
..hc_sewers
LDA.w #$C000 : TAY
ORA.l CompassField : STA.l CompassField
JMP.w .increment_compass
JMP .increment_compass
.dungeon_bigkey
@@ -296,10 +296,10 @@ ItemBehavior:
LDA.w DungeonID : CMP.w #$0003 : BCC ..hc_sewers
TAX
LDA.l DungeonItemMasks,X : ORA.l BigKeyField : STA.l BigKeyField
JMP.w .increment_bigkey
JMP .increment_bigkey
..hc_sewers
LDA.w #$C000 : ORA.l BigKeyField : STA.l BigKeyField
JMP.w .increment_bigkey
JMP .increment_bigkey
.dungeon_map
REP #$20
@@ -307,11 +307,11 @@ ItemBehavior:
TAX
LDA.l DungeonItemMasks,X : TAY
ORA.l MapField : STA.l MapField
JMP.w .increment_map
JMP .increment_map
..hc_sewers
LDA.w #$C000 : TAY
ORA.l MapField : STA.l MapField
JMP.w .increment_map
JMP .increment_map
.bow_and_arrows
LDA.l BowTracking : BIT.b #$40 : BEQ .no_silvers
@@ -429,7 +429,7 @@ ItemBehavior:
RTS
.rupoor
REP #$20 : LDA.l CurrentRupees : !SUB RupoorDeduction : STA.l CurrentRupees : SEP #$20 ; Take 1 rupee
REP #$20 : LDA.l CurrentRupees : !SUB.l RupoorDeduction : STA.l CurrentRupees : SEP #$20 ; Take 1 rupee
RTS
.null
@@ -457,7 +457,7 @@ ItemBehavior:
RTS
.triforce
JSL.l ActivateGoal
JSL ActivateGoal
RTS
.goal_item
@@ -466,25 +466,25 @@ ItemBehavior:
LDA.l GoalCounter : INC : STA.l GoalCounter
CMP.w GoalItemRequirement : BCC +
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
JSL.l ActivateGoal
JSL ActivateGoal
+
SEP #$20 ; set 8-bit accumulator
RTS
.request_F0
JSL.l ItemGetServiceRequest_F0
JSL ItemGetServiceRequest_F0
RTS
.request_F1
JSL.l ItemGetServiceRequest_F1
JSL ItemGetServiceRequest_F1
RTS
.request_F2
JSL.l ItemGetServiceRequest_F2
JSL ItemGetServiceRequest_F2
RTS
.request_async
; JSL.l ItemGetServiceRequest
; JSL ItemGetServiceRequest
RTS
.free_map
@@ -495,13 +495,13 @@ ItemBehavior:
LDA.l DungeonItemMasks,X : TAY
ORA.l MapField : STA.l MapField
SEP #$20
JMP.w .increment_map
JMP .increment_map
.hc_map
REP #$20
LDA.w #$C000 : TAY
ORA.l MapField : STA.l MapField
JMP.w .increment_map
JMP .increment_map
.free_compass
REP #$20
@@ -511,14 +511,14 @@ ItemBehavior:
LDA.l DungeonItemMasks,X : TAY
ORA.l CompassField : STA.l CompassField
SEP #$20
JMP.w .increment_compass
JMP .increment_compass
.hc_compass
REP #$20
LDA.w #$C000 : TAY
ORA.l CompassField : STA.l CompassField
SEP #$20
JMP.w .increment_compass
JMP .increment_compass
.free_bigkey
REP #$20
@@ -527,11 +527,11 @@ ItemBehavior:
LDA.w DungeonItemIDMap,X : TAX
LDA.l DungeonItemMasks,X : ORA.l BigKeyField : STA.l BigKeyField
SEP #$20
JMP.w .increment_bigkey
JMP .increment_bigkey
.hc_bigkey
LDA.b #$C0 : ORA.l BigKeyField+1 : STA.l BigKeyField+1
JMP.w .increment_bigkey
JMP .increment_bigkey
.free_smallkey
REP #$20
@@ -606,7 +606,7 @@ ItemBehavior:
LDA.l MapsCompasses
CLC : ADC.b #$10
STA.l MapsCompasses
JSL.l MaybeFlagMapTotalPickup
JSL MaybeFlagMapTotalPickup
+
RTS
@@ -661,42 +661,42 @@ ItemBehavior:
.bee_trap
SEP #$30
LDA.b #$79 : JSL Sprite_SpawnDynamically : BMI + ; DashBeeHive_SpawnBee
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8
LDA $20 : STA $0D00, Y : LDA $21 : STA $0D20, Y
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link
LDA.b LinkPosX : CLC : ADC.b #$03 : AND.b #$F8 : STA.w SpritePosXLow,Y
LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh,Y ; round X to nearest 8
LDA.b LinkPosY : STA.w SpritePosYLow, Y : LDA.b LinkPosY+1 : STA.w SpritePosYHigh, Y
LDA.b LinkLayer : STA.w SpriteLayer,Y ; spawns on same layer as link
+ RTS
.fairy
SEP #$30
LDA.b #$E3 : JSL Sprite_SpawnDynamically : BMI +
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8
LDA.b $20 : SEC : SBC.b #$10 : STA.w $0D00,Y
LDA.b $21 : SBC.b #$00 : STA.w $0D20,Y ; move up 16 pixels
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link
LDA.b #$FF : STA.w $0B58,Y ; allows them to expire
LDA.b LinkPosX : CLC : ADC.b #$03 : AND.b #$F8 : STA.w SpritePosXLow,Y
LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh,Y ; round X to nearest 8
LDA.b LinkPosY : SEC : SBC.b #$10 : STA.w SpritePosYLow,Y
LDA.b LinkPosY+1 : SBC.b #$00 : STA.w SpritePosYHigh,Y ; move up 16 pixels
LDA.b LinkLayer : STA.w SpriteLayer,Y ; spawns on same layer as link
LDA.b #$FF : STA.w EnemyStunTimer,Y ; allows them to expire
+ RTS
.chicken
SEP #$30
LDA.b #$0B : JSL Sprite_SpawnDynamically : BMI +
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8
LDA.b $20 : SEC : SBC.b #$08 : STA.w $0D00,Y
LDA.b $21 : SBC.b #$00 : STA.w $0D20,Y ; move up 8 pixels
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link
LDA.b LinkPosX : CLC : ADC.b #$03 : AND.b #$F8 : STA.w SpritePosXLow,Y
LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh,Y ; round X to nearest 8
LDA.b LinkPosY : SEC : SBC.b #$08 : STA.w SpritePosYLow,Y
LDA.b LinkPosY+1 : SBC.b #$00 : STA.w SpritePosYHigh,Y ; move up 8 pixels
LDA.b LinkLayer : STA.w SpriteLayer,Y ; spawns on same layer as link
+ RTS
ResolveReceipt:
PHA : PHX
PHK : PLB
JSL.l PreItemGet
JSL PreItemGet
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.w ItemReceiptID : STA.l !MULTIWORLD_ITEM_ID
JSL.l AttemptItemSubstitution
JSR.w HandleBowTracking
JSR.w ResolveLootID
JSL AttemptItemSubstitution
JSR HandleBowTracking
JSR ResolveLootID
STA.w ItemReceiptID
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA.w ItemReceiptID
@@ -707,7 +707,7 @@ ResolveReceipt:
ResolveLootIDLong:
PHY
JSR.w ResolveLootID
JSR ResolveLootID
PLY
RTL
@@ -723,30 +723,30 @@ ResolveLootID:
REP #$30
AND.w #$00FF : ASL : TAX
TYA
JMP.w (ItemReceipts_resolution,X)
JMP (ItemReceipts_resolution,X)
.have_item
SEP #$30
PLB : PLX
RTS
.skip
JMP.w .have_item
JMP .have_item
.bottles
SEP #$30
JSR.w CountBottles : CMP.l BottleLimit : BCC +
JSR CountBottles : CMP.l BottleLimit : BCC +
LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE +
LDA.l BottleLimitReplacement
JMP.w .get_item
JMP .get_item
+
TYA
JMP.w .have_item
JMP .have_item
.magic
SEP #$20
LDA.l MagicConsumption : TAX
LDA.w .magic_ids,X
JMP.w .have_item
JMP .have_item
..ids
db $4E, $4F, $4F
@@ -756,28 +756,28 @@ ResolveLootID:
LDA.l HighestSword
CMP.l ProgressiveSwordLimit : BCC +
LDA.l ProgressiveSwordReplacement
JMP.w .get_item
JMP .get_item
++ LDA.l SwordEquipment
+
TAX
LDA.w .prog_sword_ids,X
JMP.w .have_item
JMP .have_item
..ids
db $49, $50, $02, $03, $03
.shields
SEP #$20
LDA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE ++
LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE ++
LDA.b #$01 : STA.l ProgressiveFlag
LDA.l HighestShield
CMP.l ProgressiveShieldLimit : BCC +
LDA.l ProgressiveShieldReplacement
JMP.w .get_item
JMP .get_item
++ LDA.l HighestShield
+
TAX
LDA.w .shields_ids,X
JMP.w .have_item
JMP .have_item
..ids
db $04, $05, $06, $06
@@ -787,12 +787,12 @@ ResolveLootID:
LDA.l HighestMail
CMP.l ProgressiveArmorLimit : BCC +
LDA.l ProgressiveArmorReplacement
JMP.w .get_item
JMP .get_item
+
++ LDA.l ArmorEquipment
TAX
LDA.w .armor_ids,X
JMP.w .have_item
JMP .have_item
..ids
db $22, $23, $23
@@ -801,7 +801,7 @@ ResolveLootID:
SEP #$20
LDA.l GloveEquipment : TAX
LDA.w .gloves_ids,X
JMP.w .have_item
JMP .have_item
..ids
db $1B, $1C, $1C
@@ -812,7 +812,7 @@ ResolveLootID:
LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipbowlimit
LDA.l BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : BCC +
LDA.l ProgressiveBowReplacement
JMP.w .get_item
JMP .get_item
+
LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ +
LDX.w CurrentSpriteSlot
@@ -821,14 +821,14 @@ ResolveLootID:
.skipbowlimit
LDA.l BowEquipment : TAX
LDA.w ResolveLootID_bows_ids,X
JMP.w .get_item
JMP .get_item
.progressive_bow_2
SEP #$30
LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipbowlimit_2
LDA.l BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : BCC +
LDA.l ProgressiveBowReplacement
JMP.w .get_item
JMP .get_item
+
LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ +
LDX.w CurrentSpriteSlot
@@ -837,7 +837,7 @@ ResolveLootID:
+
LDA.l BowEquipment : TAX
LDA.w ResolveLootID_bows_ids,X
JMP.w .get_item
JMP .get_item
.bows
..ids
@@ -845,18 +845,18 @@ ResolveLootID:
.null_chest
; JSL ChestItemServiceRequest
JMP.w .have_item
JMP .have_item
.rng_single
JSL.l GetRNGItemSingle : STA.w ScratchBufferV+6
XBA : JSR.w MarkRNGItemSingle
JSL GetRNGItemSingle : STA.w ScratchBufferV+6
XBA : JSR MarkRNGItemSingle
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
LDA.w ScratchBufferV+6 : JMP.w .get_item
LDA.w ScratchBufferV+6 : JMP .get_item
.rng_multi
JSL.l GetRNGItemMulti : STA.w ScratchBufferV+6
JSL GetRNGItemMulti : STA.w ScratchBufferV+6
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
LDA.w ScratchBufferV+6 : JMP.w .get_item
LDA.w ScratchBufferV+6 : JMP .get_item
;--------------------------------------------------------------------------------
DungeonItemMasks:
@@ -925,16 +925,16 @@ RTS
CheckHUDSilverArrows:
LDA.l ArrowMode : BNE .rupee_bow
LDA.l BowEquipment : TAX : BEQ .nobow
JSL.l DrawHUDArrows_normal
JSL DrawHUDArrows_normal
TXA
RTL
.rupee_bow
LDA.l BowEquipment : TAX
JSL.l DrawHUDArrows_rupee_arrows
JSL DrawHUDArrows_rupee_arrows
TXA
RTL
.nobow
JSL.l DrawHUDArrows_silverscheck
JSL DrawHUDArrows_silverscheck
TXA
RTL
;--------------------------------------------------------------------------------
@@ -976,7 +976,7 @@ GetRNGItemSingle:
LDA.l RNGLockIn : CMP.b #$FF : BEQ + : TAX : XBA : LDA.l RNGSingleItemTable, X : RTL : +
LDX.b #$00
.single_reroll
JSL.l GetRandomInt : AND.b #$7F ; select random value
JSL GetRandomInt : AND.b #$7F ; select random value
INX : CPX.b #$7F : BCC + : LDA.b #$00 : BRA +++ : + ; default to 0 if too many attempts
CMP.l RNGSingleTableSize : !BGE .single_reroll
+++
@@ -986,7 +986,7 @@ GetRNGItemSingle:
TAY
.recheck
TYA
JSR.w CheckSingleItem : BEQ .single_unused ; already used
JSR CheckSingleItem : BEQ .single_unused ; already used
LDA.w ScratchBufferV : INC ; increment index
CMP.l RNGSingleTableSize : BCC +++ : LDA.b #$00 : +++ ; rollover index if needed
STA.w ScratchBufferV ; store index
@@ -1041,7 +1041,7 @@ GetRNGItemMulti:
LDA.l RNGLockIn : CMP.b #$FF : BEQ + : TAX : XBA : LDA.l RNGMultiItemTable, X : RTL : +
LDX.b #$00
- ; reroll
JSL.l GetRandomInt : AND.b #$7F ; select random value
JSL GetRandomInt : AND.b #$7F ; select random value
INX : CPX.b #$7F : BCC + : LDA.b 00 : BRA .done : + ; default to 0 if too many attempts
CMP.l RNGMultiTableSize : !BGE -
.done
@@ -1108,13 +1108,13 @@ RTS
ActivateGoal:
STZ.b GameSubMode
STZ.b SubSubModule
JML.l StatsFinalPrep
JML StatsFinalPrep
;--------------------------------------------------------------------------------
ChestPrep:
LDA.b #$01 : STA.w ItemReceiptMethod
JSL.l IncrementChestCounter
JSL IncrementChestCounter
LDA.l ServerRequestMode : BEQ +
JSL.l ChestItemServiceRequest
JSL ChestItemServiceRequest
RTL
+
LDY.b Scrap0C ; get item value
@@ -1156,11 +1156,11 @@ MaybeFlagDungeonTotalsEntrance:
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
JSR FlagCompassCount
.maps
; LDA.l MapHUDMode : AND.w #$000F : BEQ .done
LDX.w DungeonID
JSR.w FlagMapCount
JSR FlagMapCount
.done
RTL
;--------------------------------------------------------------------------------
@@ -1201,5 +1201,3 @@ dw $0000 ; Sewers
PendantMasks:
db $04, 01, 02

View File

@@ -56,7 +56,7 @@ ItemCheck_TreeKid2:
RTL
ItemCheck_TreeKid3:
JSL $8DD030 ; FluteAardvark_Draw - thing we wrote over
JSL SpriteDraw_Stumpy ; thing we wrote over
LDA.l NpcFlags : AND.b #$08
BNE .done
LDA.b #$05
@@ -98,8 +98,8 @@ ItemSet_MagicBat:
RTL
ItemSet_OldMan:
PHA : LDA OldManItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA.l OldManItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$01 : STA.l NpcFlags : PLA
RTL
@@ -108,20 +108,20 @@ ItemSet_ZoraKing:
RTL
ItemSet_SickKid:
PHA : LDA SickKidItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA.l SickKidItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$04 : STA.l NpcFlags : PLA
RTL
ItemSet_TreeKid:
PHA : LDA TreeKidItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA.l TreeKidItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$08 : STA.l NpcFlags : PLA
RTL
ItemSet_Sahasrala:
PHA : LDA SahasralaItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA.l SahasralaItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$10 : STA.l NpcFlags : PLA
RTL
@@ -130,8 +130,8 @@ ItemSet_Catfish:
RTL
ItemSet_Library:
PHA : LDA LibraryItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA.l LibraryItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$80 : STA.l NpcFlags : PLA
RTL
@@ -143,7 +143,7 @@ ItemSet_Mushroom:
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY
+
LDA MushroomItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l MushroomItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLA
STZ.w ItemReceiptMethod ; thing we wrote over - the mushroom is an npc for item purposes apparently
RTL
@@ -165,19 +165,19 @@ Set300RupeeNPCItem:
CMP.w #291 : BNE +
%GetPossiblyEncryptedItem(RupeeNPC_MoldormCave, SpriteItemValues)
TAY ; load moldorm cave value into Y
LDA RupeeNPC_MoldormCave_Player
LDA.l RupeeNPC_MoldormCave_Player
BRA .done
+ CMP.w #286 : BNE +
%GetPossiblyEncryptedItem(RupeeNPC_NortheastDarkSwampCave, SpriteItemValues)
TAY ; load northeast dark swamp cave value into Y
LDA RupeeNPC_NortheastDarkSwampCave_Player
LDA.l RupeeNPC_NortheastDarkSwampCave_Player
BRA .done
+
LDA #$0000
LDA.w #$0000
LDY.b #$46 ; default to a normal 300 rupees
.done
SEP #$20
STA !MULTIWORLD_ITEM_PLAYER_ID
STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
RTL
@@ -185,18 +185,18 @@ RTL
; Randomize Zora King
;--------------------------------------------------------------------------------
LoadZoraKingItemGFX:
LDA.l ZoraItem_Player : : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l ZoraItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $9DE1C3 ; location randomizer writes zora item to
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w SpriteID,Y
TYX
JML.l PrepDynamicTile_loot_resolved
JML PrepDynamicTile_loot_resolved
;--------------------------------------------------------------------------------
JumpToSplashItemTarget:
LDA.w SpriteMovement, X
CMP.b #$FF : BNE + : JML.l SplashItem_SpawnSplash : +
CMP.b #$00 : JML.l SplashItem_SpawnOther
CMP.b #$FF : BNE + : JML SplashItem_SpawnSplash : +
CMP.b #$00 : JML SplashItem_SpawnOther
;================================================================================
; Randomize Catfish
@@ -204,11 +204,11 @@ JumpToSplashItemTarget:
LoadCatfishItemGFX:
LDA.l CatfishItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $9DE185 ; location randomizer writes catfish item to
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w SpriteID, Y
TYX
JML.l PrepDynamicTile_loot_resolved
JML PrepDynamicTile_loot_resolved
;--------------------------------------------------------------------------------
DrawThrownItem:
LDA.b OverworldIndex : CMP.b #$81 : BNE .catfish

View File

@@ -1,7 +1,7 @@
Module_Password:
LDA.b GameSubMode
JSL.l JumpTableLong
JSL JumpTableLong
dl Password_BeginInit ; 0
dl Password_EndInit ; 1
@@ -10,7 +10,7 @@ Module_Password:
dl Password_Return ; 4
Password_BeginInit:
LDA.b #$80 : STA.w $0710 ;skip animated sprite updates in NMI
LDA.b #$80 : STA.w SkipOAM ;skip animated sprite updates in NMI
JSL EnableForceBlank
JSL Vram_EraseTilemaps_triforce
@@ -48,41 +48,41 @@ Password_Main:
JSR PasswordEraseOldCursors
; handle joypad input
LDA.b $F6 : AND.b #$10 : BEQ + ; R Button
LDA.b Joy1B_New : AND.b #$10 : BEQ + ; R Button
JSR PasswordMoveCursorRight
+
LDA.b $F6 : AND.b #$20 : BEQ + ; L Button
LDA.b Joy1B_New : AND.b #$20 : BEQ + ; L Button
JSR PasswordMoveCursorLeft
+
LDA.b $F4 : AND.b #$01 : BEQ + ; right
LDA.b Joy1A_New : AND.b #$01 : BEQ + ; right
LDA.b PasswordSelectPosition : INC A : CMP.b #$24 : !BLT ++
!SUB.b #$24
++
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$02 : BEQ + ; left
LDA.b Joy1A_New : AND.b #$02 : BEQ + ; left
LDA.b PasswordSelectPosition : DEC A : BPL ++
!ADD.b #$24
++
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$04 : BEQ + ; down
LDA.b Joy1A_New : AND.b #$04 : BEQ + ; down
LDA.b PasswordSelectPosition : !ADD.b #$09 : CMP.b #$24 : !BLT ++
!SUB.b #$24
++
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$08 : BEQ + ; up
LDA.b Joy1A_New : AND.b #$08 : BEQ + ; up
LDA.b PasswordSelectPosition : !SUB.b #$09 : BPL ++
!ADD.b #$24
++
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : ORA.b $F6 : AND.b #$C0 : BEQ + ; face button
LDA.b Joy1A_New : ORA.b Joy1B_New : AND.b #$C0 : BEQ + ; face button
LDX.b PasswordSelectPosition
LDA.l .selectionValues, X : BPL ++
CMP.b #$F0 : BNE +++
@@ -111,7 +111,7 @@ Password_Main:
++
LDA.b #$2B : STA.w SFX2
+
LDA.b $F4 : AND.b #$10 : BEQ + ; start
LDA.b Joy1A_New : AND.b #$10 : BEQ + ; start
INC.b GameSubMode
+
.endOfButtonChecks
@@ -129,7 +129,7 @@ db $11, $12, $13, $14, $15, $16, $17, $18, $F2
db $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $F3
Password_Check:
JSL.l ValidatePassword : BNE .correct
JSL ValidatePassword : BNE .correct
LDA.b #$3C : STA.w SFX2 ; error
DEC.b GameSubMode
RTL
@@ -184,9 +184,9 @@ ValidatePassword:
LDA.l KnownEncryptedValue+4 : STA.l CryptoBuffer+4
LDA.l KnownEncryptedValue+6 : STA.l CryptoBuffer+6
LDA.w #$0002 : STA.b $04 ;set block size
LDA.w #$0002 : STA.b Scrap04 ;set block size
JSL.l XXTEA_Decode
JSL XXTEA_Decode
SEP #$20 ; 8 bit accumulator
@@ -219,24 +219,24 @@ PasswordToKey:
; $00 input offset
; $02 output offset
; $04 shift amount
LDA.w #$0000 : STA.b $00 : STA.b $02
LDA.w #$000B : STA.b $04
LDA.w #$0000 : STA.b Scrap00 : STA.b Scrap02
LDA.w #$000B : STA.b Scrap04
-
LDX.b $00
LDX.b Scrap00
LDA.l PasswordSRAM, X : DEC : AND.w #$001F
LDY.b $04
LDY.b Scrap04
-- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y
XBA
LDX.b $02
LDX.b Scrap02
ORA.l KeyBase, X
STA.l KeyBase, X
LDA.b $04 : !SUB.w #$0005 : BPL +
LDA.b Scrap04 : !SUB.w #$0005 : BPL +
!ADD.w #$0008
INC $02
+ : STA.b $04
INC.b Scrap02
+ : STA.b Scrap04
LDA.b $00 : INC : STA.b $00 : CMP.w #$0010 : !BLT -
LDA.b Scrap00 : INC : STA.b Scrap00 : CMP.w #$0010 : !BLT -
RTS
LoadPasswordStripeTemplate:
@@ -260,7 +260,7 @@ LoadPasswordStripeTemplate:
LDA.b #Password_StripeImageTemplate_end-Password_StripeImageTemplate>>8
STA.w DAS0H ; set transfer size
LDA.b #$01 : STA.w MDMAEN ; begin DMA transfer
LDA.b #$01 : STA.w DMAENABLE ; begin DMA transfer
PLA : STA.w DAS0H : PLA : STA.w DAS0L : PLA : STA.w A1B0 ; restore DMA parameters
PLA : STA.w A1T0H : PLA : STA.w A1T0L : PLA : STA.w BBAD0 ; restore DMA parameters
@@ -332,16 +332,16 @@ UpdatePasswordTiles:
LDX.w #$000F
-
LDA.l PasswordSRAM, X : AND.w #$00FF : TXY
ASL #3 : STA.b $00
TYA : ASL #4 : STA.b $03
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank, X
LDX.b $03 : STA.w $1006, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$02, X
LDX.b $03 : STA.w $1008, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$04, X
LDX.b $03 : STA.w $100E, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$06, X
LDX.b $03 : STA.w $1010, X
ASL #3 : STA.b Scrap00
TYA : ASL #4 : STA.b Scrap03
LDX.b Scrap00 : LDA.l HashAlphabetTilesWithBlank, X
LDX.b Scrap03 : STA.w $1006, X
LDX.b Scrap00 : LDA.l HashAlphabetTilesWithBlank+$02, X
LDX.b Scrap03 : STA.w $1008, X
LDX.b Scrap00 : LDA.l HashAlphabetTilesWithBlank+$04, X
LDX.b Scrap03 : STA.w $100E, X
LDX.b Scrap00 : LDA.l HashAlphabetTilesWithBlank+$06, X
LDX.b Scrap03 : STA.w $1010, X
TYX : DEX : BMI + : BRA -
+

View File

@@ -22,11 +22,11 @@ HUDRebuildIndoorHole:
.generic
PLA
LDA.l CurrentGenericKeys ; generic key count
JSL.l HUD_RebuildIndoor_Palace
JSL HUD_RebuildIndoor_Palace
RTL
.normal
PLA
JSL.l HUD_RebuildIndoor_Palace
JSL HUD_RebuildIndoor_Palace
RTL
;================================================================================
HUDRebuildIndoor:
@@ -83,7 +83,7 @@ BringMenuDownEnhanced:
EOR.w #$FFFF : !ADD.w #$0001 ; negate menu speed
!ADD BG3VOFSQL : CMP.w #$FF18 : !BGE .noOvershoot
!ADD.l BG3VOFSQL : CMP.w #$FF18 : !BGE .noOvershoot
LDA.w #$FF18 ; if we went past the limit, go to the limit
.noOvershoot
STA.b BG3VOFSQL : CMP.w #$FF18
@@ -101,7 +101,7 @@ RaiseHudMenu:
LDA.l MenuSpeed : AND.w #$00FF
++
!ADD BG3VOFSQL : BMI .noOvershoot
!ADD.l BG3VOFSQL : BMI .noOvershoot
LDA.w #$0000 ; if we went past the limit, go to the limit
.noOvershoot
STA.b BG3VOFSQL
@@ -139,7 +139,7 @@ UpdateKeys:
.castle_sewers
STA.l HyruleCastleKeys : STA.l SewerKeys
.skip
JSL.l PostItemGet
JSL PostItemGet
PLP : PLX
RTL
;$37C = Sewer Passage
@@ -567,7 +567,7 @@ HandleEmptyMenu:
LDA.b Joy1A_All : BIT.b #$20 : BNE .wait_for_change
LDA.l HudFlag : AND.b #$60 : BEQ .wait_for_change
LDA.l HudFlag : AND.b #$9F : STA.l HudFlag ; Unset without select
JSL.l MaybePlaySelectSFX
JSL MaybePlaySelectSFX
LDA.b #$0C : BRA .done
.sel_pressed
LDA.l HUDDungeonItems : BIT.b #$0C : BNE +
@@ -577,7 +577,7 @@ HandleEmptyMenu:
LDA.b #$60
.store_flag
STA.l HudFlag
JSL.l MaybePlaySelectSFX
JSL MaybePlaySelectSFX
LDA.b #$0C : BRA .done
.wait_for_change
LDA.b #$03 : BRA .done
@@ -589,9 +589,9 @@ RTL
;-------------------------------------------------------------------------------
MaybeDrawEquippedItem:
LDA.w ItemCursor : BEQ +
JML.l ItemMenu_DrawEquippedYItem+$07
JML ItemMenu_DrawEquippedYItem+$07
+
JML.l ItemMenu_DrawEquippedYItem_exit
JML ItemMenu_DrawEquippedYItem_exit
;-------------------------------------------------------------------------------
RestoreMenu_SetSubModule:
LDA.w ItemCursor : BEQ +

View File

@@ -99,34 +99,34 @@ TransferNewNameStripes:
REP #$30
LDA.w GameMode : CMP.w #$0204 : BNE .exit
SEP #$20
LDA.b #NewNameStripes>>0 : STA.b $00
LDA.b #NewNameStripes>>8 : STA.b $01
LDA.b #NewNameStripes>>16 : STA.b $02 : STA.w DMA1ADDRB
STZ.b $06 : LDY.w #$0000
LDA.b #NewNameStripes>>0 : STA.b Scrap00
LDA.b #NewNameStripes>>8 : STA.b Scrap01
LDA.b #NewNameStripes>>16 : STA.b Scrap02 : STA.w DMA1ADDRB
STZ.b Scrap06 : LDY.w #$0000
.check_next
LDA.b [$00],Y : BPL .next_stripe
LDA.b [Scrap00],Y : BPL .next_stripe
.exit
SEP #$30
RTL
.next_stripe
STA.b $04
STA.b Scrap04
INY
LDA.b [$00],Y : STA.b $03
LDA.b [Scrap00],Y : STA.b Scrap03
INY
LDA.b [$00],Y : AND.b #$80 : ASL : ROL : STA.b $07
LDA.b [$00],Y : AND.b #$40 : STA.b $05
LDA.b [Scrap00],Y : AND.b #$80 : ASL : ROL : STA.b Scrap07
LDA.b [Scrap00],Y : AND.b #$40 : STA.b Scrap05
LSR #3 : ORA.b #$01 : STA.w DMA1MODE
LDA.b #VMDATAL : STA.w DMA1PORT
REP #$20
LDA.b $03 : STA.w VMADDR
LDA.b [$00],Y : XBA : AND.w #$3FFF
LDA.b Scrap03 : STA.w VMADDR
LDA.b [Scrap00],Y : XBA : AND.w #$3FFF
TAX : INX : STX.w DMA1SIZE
INY #2 : TYA
CLC : ADC.b $00 : STA.w DMA1ADDRL
LDA.b $05
STX.b $03
TYA : CLC : ADC.b $03 : TAY
CLC : ADC.b Scrap00 : STA.w DMA1ADDRL
LDA.b Scrap05
STX.b Scrap03
TYA : CLC : ADC.b Scrap03 : TAY
SEP #$20
LDA.b $07 : ORA.b #$80 : STA.w VMAIN
LDA.b Scrap07 : ORA.b #$80 : STA.w VMAIN
LDA.b #$02 : STA.w DMAENABLE
JMP.w .check_next
JMP .check_next

View File

@@ -14,7 +14,7 @@ RefillHealth:
LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE .done
LDA.l BusyHealth : BNE ++
LDA.l PotionHealthRefill ; load refill amount
!ADD CurrentHealth ; add to current health
!ADD.l CurrentHealth ; add to current health
CMP.l MaximumHealth : !BLT +++ : LDA.l MaximumHealth : +++
STA.l BusyHealth
++
@@ -60,7 +60,7 @@ RefillMagic:
LDA.l PotionMagicRefill : CMP.b #$80 : !BGE .done
LDA.l BusyMagic : BNE ++
LDA.l PotionMagicRefill ; load refill amount
!ADD CurrentMagic ; add to current magic
!ADD.l CurrentMagic ; add to current magic
CMP.b #$80 : !BLT +++ : LDA.b #$80 : +++
STA.l BusyMagic
++

View File

@@ -19,12 +19,12 @@ QuickSwap:
LDX.w ItemCursor : BRA .special_swap
+
BIT.b #$10 : BEQ + ; Only pressed R
JSR.w RCode
JSR RCode
LDA.b Joy1B_All : BIT.b #$20 : BNE .special_swap ; Still holding L from a previous frame
BRA .store
+
; Only pressed L
JSR.w LCode
JSR LCode
LDA.b Joy1B_All : BIT #$10 : BNE .special_swap ; Still holding R from a previous frame
BRA .store
@@ -61,7 +61,7 @@ RCode:
+ INX
DEY : BEQ +
.nextItem
JSL.l IsItemAvailable : BEQ -
JSL IsItemAvailable : BEQ -
+
RTS
@@ -78,7 +78,7 @@ LCode:
+ DEX
DEY : BEQ +
.nextItem
JSL.l IsItemAvailable : BEQ -
JSL IsItemAvailable : BEQ -
+
RTS

161
ram.asm
View File

@@ -48,8 +48,6 @@ 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
@@ -69,20 +67,25 @@ LinkDirection = $7E002F ; $00 = Up | $02 = Down | $04 = Left | $06 = R
;
OAMOffsetY = $7E0044 ;
OAMOffsetX = $7E0045 ;
LinkIncapacitatedTimer = $7E0046 ; Countdown when Link takes damage, not same as I-frames
;
ForceMove = $7E0049 ; Forces D-Pad inputs when written to
;
CapeTimer = $7E004C ; Countdown for cape sapping magic Countdown for cape sapping magic..
LinkJumping = $7E004D ; $00 = None | $01 = Bonk/damage/water | $02 = Ledge
;
Strafe = $7E0050 ; ???
LinkStrafe = $7E0050 ; ???
;
CapeOn = $7E0055 ; Link invisible and untouchable when set.
BunnyFlagDP = $7E0056 ; $00 = Link | $01 = Bunny
;
PitTileActField = $7E0059 ; Tile action bitfield used by pits
LinkSlipping = $7E005B ; $00 = None | $01 = Near pit
; $02 = Falling | $03 = Falling "more"
FallTimer = $7E005C ; Timer for falling animation
LinkState = $7E005D ; Main Link state handler
LinkSpeed = $7E005E ; Main Link speed handler
ManipTileField = $7E005F ; Bitfield used by manipulable tiles
;
LinkWalkDirection = $7E0067 ; - - - - u d l r
;
@@ -102,7 +105,7 @@ W34SELQ = $7E0097 ;
WOBJSELQ = $7E0098 ;
CGWSELQ = $7E0099 ;
CGADSUBQ = $7E009A ;
HDMAENQ = $7E009B ; HDMA enable flags
HDMAENABLEQ = $7E009B ; HDMA enable flags
;
RoomIndex = $7E00A0 ; Underworld room index. Word length. High byte: $00 = EG1 | $01 = EG2
; Not zeroed on exit to overworld.
@@ -111,6 +114,9 @@ PreviousRoom = $7E00A2 ; Stores previous value of RoomIndex
CameraBoundH = $7E00A6 ; Which set of camera boundaries to use.
CameraBoundV = $7E00A7 ;
;
LinkQuadrantH = $7E00A9 ; Which quadrant Link is in. 0 = left, 1 = right
LinkQuadrantV = $7E00AA ; 0 = top, 2 = bottom
;
RoomTag = $7E00AE ; Room effects; e.g. kill room, shutter switch, etc. Word length.
;
SubSubModule = $7E00B0 ; Often used as a submodule, such as for transitions
@@ -159,6 +165,7 @@ EntranceIndex = $7E010E ; Entrance ID into underworld. Word length.
;
MedallionFlag = $7E0112 ; Medallion cutscene flag. $01 = Cutscene active.
;
VRAMTileMapIndex = $7E0116 ; Index for high bytes for VRAM tile map uploads
VRAMUploadAddress = $7E0118 ; Incremental VRAM upload address. Low byte always 0. Word length.
;
BG1ShakeV = $7E011A ; Applied to BG Scroll. Word Length.
@@ -225,13 +232,18 @@ TileActDig = $7E035B ; Bitfield used by diggable ground. Word lengt
;
LinkZap = $7E0360 ; When set, recoil zaps Link.
;
LinkDashing = $7E0372 ; Flags when Link is dashing, also spinspeed
DamageReceived = $7E0373 ; Damage to deal to Link.
;
UseY2 = $7E037A ; - - b n c h - s
; b = Book | n = Net | c = Canes | h = Hookshot | s = Shovel
NoDamage = $7E037B ; Prevents Link from receiving damage.
;
AncillaGeneral = $7E039F ; General use buffer for front slot ancillae. $0F bytes.
AncillaGeneralA = $7E0385 ; General use buffer for front slot ancillae. $05 bytes.
;
AncillaGeneralD = $7E0394 ; General use buffer for front slot ancillae. $05 bytes.
;
AncillaGeneralF = $7E039F ; General use buffer for front slot ancillae. $0F bytes.
;
AncillaTimer = $7E03B1 ; Used as a timer for ancilla.
;
@@ -246,8 +258,13 @@ 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
OverworldIndexMirror = $7E040A ; Overworld Area Index. Mirrors $8A
DungeonID = $7E040C ; High byte mostly unused but sometimes read. Word length.
;
TransitionDirection = $7E0418 ; OW: 0=N 1=S 2=W 3=E UW: 0=S 1=N 2=E 3=W
;
TrapDoorFlag = $7E0468 ; Flag that is set when trap doors are down. 2 bytes
;
LayerAdjustment = $7E047A ; Flags layer adjustments. Arms EG.
;
RoomIndexMirror = $7E048E ; Mirrors RoomIndex
@@ -259,6 +276,10 @@ OWEntranceCutscene = $7E04C6 ;
;
HeartBeepTimer = $7E04CA ;
;
CameraTargetN = $7E0610 ; Camera scroll target for directions NSEW
CameraTargetS = $7E0612 ;
CameraTargetW = $7E0614 ;
CameraTargetE = $7E0616 ;
CameraScrollN = $7E0618 ; Camera scroll trigger areas for directions NSEW
CameraScrollS = $7E061A ; The higher boundary should always be +2 from the lower in
CameraScrollW = $7E061C ; underworld and -2 in overworld.
@@ -270,9 +291,13 @@ SpriteRoomTag = $7E0642 ; Set high by sprites triggering room tags.
;
SomariaSwitchFlag = $7E0646 ; Set by Somaria when on a switch.
;
TileMapDoorPos = $7E068E ; (Dungeon) ???? related to trap doors and if they are open ; possibly bomb doors too? Update: module 0x07.0x4 probably uses this to know whether it's a key door or big key door to open. Word length.
DoorTimer = $7E0690 ; Timer for animating doors, like Sanc or HC overworld doors
;
TileMapEntranceDoors = $7E0696 ; Tilemap location of entrance doors. Word length.
TileMapTile32 = $7E0698 ; Tilemap location of new tile32 objects, such as from graves/rocks. Word length.
;
RandoOverworldTargetEdge = $7E06FA; Used to store target edge IDs
SkipOAM = $7E0710 ; Set to skip OAM updates. High byte written $FF with exploding walls
OWScreenSize = $7E0712 ; Flags overworld screen size.
@@ -282,6 +307,8 @@ SpawnedItemIsMultiWorld = $7E0724 ; Multiworld World Flag. Word
SpawnedItemFlag = $7E0726 ; 0x02 - one for pot, 2 for sprite drop
; (flag used as a bitmask in conjunction with StandingItemCounterMask)
SpawnedItemMWPlayer = $7E0728 ; Player Id for spawned item if Multiworld item 0x02
;
EnemyDropIndicator = $7E072A ; Used by HUD to indicate enemy drops remaining
SprDropsItem = $7E0730 ; Array for whether a sprite drops an item 0x16
SprItemReceipt = $7E0740 ; Array for item id for each sprite 0x16
@@ -331,12 +358,17 @@ AncillaVelocityX = $7E0C2C ; $0A bytes.
;
AncillaID = $7E0C4A ; $0A bytes.
;
AncillaGeneralN = $7E0C54 ; General use buffer for ancillae. $0A bytes.
;
AncillaGet = $7E0C5E ; Used by varius ancilla in various ways. $0F bytes.
;
AncillaLayer = $7E0C7C ;
;
SpriteForceDrop = $7E0CBA ; Forces drops on sprite death. $10 bytes.
;
SpriteBump = $7E0CD2 ; See symbols_wram.asm. $10 bytes.
;
BossSpecialAction = $7E0CF3 ; Indicates special action required for some bosses
TreePullKills = $7E0CFB ; Kills for tree pulls.
TreePullHits = $7E0CFC ; Hits taken for tree pulls.
;
@@ -365,12 +397,12 @@ SpriteOAMProperties = $7E0E40 ; h m w o o o o o | h = Harmless | m = m
SpriteHitPoints = $7E0E50 ; Set from $0DB173
SpriteControl = $7E0E60 ; n i o s p p p t | n = Death animation? | i = Immune to attack/collion?
; o = Shadow | p = OAM prop palette | t = OAM prop name table
SpriteItemType = $7E0E80 ; Sprite Item Type. Also used for jump table local. $10 bytes.
;
SpriteSpawnStep = $7E0ED0 ; Related to enemies spawning other sprites (eg pikit, zirro)
SpriteJumpIndex = $7E0E80 ; Sprite jump table local. $10 bytes.
;
SpriteDirectionTable = $7E0EB0 ; Sprite direction. $10 bytes.
;
SpriteSpawnStep = $7E0ED0 ; Related to enemies spawning other sprites (eg pikit, zirro)
;
SpriteHalt = $7E0F00 ;
SpriteTimerE = $7E0F10 ; ?
;
@@ -426,6 +458,8 @@ ClockBuffer = $7E1E9C ; Clock Temporary
ScratchBufferNV = $7E1EA0 ; Non-volatile scratch buffer. Must preserve values through return.
ScratchBufferV = $7E1EB0 ; Volatile scratch buffer. Can clobber at will.
TileMapA = $7E2000
TileMapB = $7E4000
;================================================================================
; UNMIRRORED WRAM
; Addresses from here on can only be accessed with long addressing
@@ -447,6 +481,7 @@ MosaicLevel = $7EC011 ; Word length. High byte unused
RoomDarkness = $7EC017 ; Darkness level of a room. High byte unused. Word length.
;
SpriteOAM = $7EC025 ;
SpriteDynamicOAM = $7EC035 ;
;
EN_OWSCR2 = $7EC140 ; $7EC140-$7EC171 Used for caching with entrances.
EN_MAINDESQ = $7EC142 ; Copied from the JP disassembly.
@@ -485,6 +520,7 @@ LastBGSet = $7EC2F8 ; Lists loaded sheets to check for decompressi
PaletteBufferAux = $7EC300 ; Secondary and main palette buffer. See symbols_wram.asm
PaletteBuffer = $7EC500 ; in the disassembly.
HUDTileMapBuffer = $7EC700 ; HUD tile map buffer. $100 bytes (?)
HUDCurrentDungeonWorld = $7EC702 ;
HUDKeyIcon = $7EC726 ;
HUDGoalIndicator = $7EC72A ;
HUDPrizeIcon = $7EC742 ;
@@ -492,6 +528,10 @@ HUDRupees = $7EC750 ;
HUDBombCount = $7EC75A ;
HUDArrowCount = $7EC760 ;
HUDKeyDigits = $7EC764 ;
HUDMultiIndicator = $7EC790 ;
HUDKeysObtained = $7EC7A2 ;
HUDKeysSlash = $7EC7A4 ;
HUDKeysTotal = $7EC7A6 ;
;
BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
ItemGFXStack = $7ECB00 ; Pointers to source of decompressed item tiles deferred to NMI loading.
@@ -675,19 +715,23 @@ endmacro
%assertRAM(LinkRecoilY, $7E0027)
%assertRAM(LinkRecoilX, $7E0028)
%assertRAM(LinkRecoilZ, $7E0029)
%assertRAM(LinkDirection, $7E002F)
%assertRAM(LinkAnimationStep, $7E002E)
%assertRAM(LinkDirection, $7E002F)
%assertRAM(OAMOffsetY, $7E0044)
%assertRAM(OAMOffsetX, $7E0045)
%assertRAM(LinkIncapacitatedTimer, $7E0046)
%assertRAM(ForceMove, $7E0049)
%assertRAM(CapeTimer, $7E004C)
%assertRAM(LinkJumping, $7E004D)
%assertRAM(Strafe, $7E0050)
%assertRAM(LinkStrafe, $7E0050)
%assertRAM(CapeOn, $7E0055)
%assertRAM(BunnyFlagDP, $7E0056)
%assertRAM(PitTileActField, $7E0059)
%assertRAM(LinkSlipping, $7E005B)
%assertRAM(FallTimer, $7E005C)
%assertRAM(LinkState, $7E005D)
%assertRAM(LinkSpeed, $7E005E)
%assertRAM(ManipTileField, $7E005F)
%assertRAM(LinkWalkDirection, $7E0067)
%assertRAM(ScrapBuffer72, $7E0072)
%assertRAM(WorldCache, $7E007B)
@@ -701,17 +745,19 @@ endmacro
%assertRAM(WOBJSELQ, $7E0098)
%assertRAM(CGWSELQ, $7E0099)
%assertRAM(CGADSUBQ, $7E009A)
%assertRAM(HDMAENQ, $7E009B)
%assertRAM(HDMAENABLEQ, $7E009B)
%assertRAM(RoomIndex, $7E00A0)
%assertRAM(PreviousRoom, $7E00A2)
%assertRAM(CameraBoundH, $7E00A6)
%assertRAM(CameraBoundV, $7E00A7)
%assertRAM(LinkQuadrantH, $7E00A9)
%assertRAM(LinkQuadrantV, $7E00AA)
%assertRAM(RoomTag, $7E00AE)
%assertRAM(SubSubModule, $7E00B0)
%assertRAM(ObjPtr, $7E00B7)
%assertRAM(ObjPtrOffset, $7E00BA)
%assertRAM(ScrapBufferBD, $7E00BD)
%assertRAM(PlayerSpriteBank, $7E00BC)
%assertRAM(ScrapBufferBD, $7E00BD)
%assertRAM(FileSelectPosition, $7E00C8)
%assertRAM(PasswordCodePosition, $7E00C8)
%assertRAM(PasswordSelectPosition, $7E00C9)
@@ -728,12 +774,12 @@ endmacro
%assertRAM(GameSubModeCache, $7E010D)
%assertRAM(EntranceIndex, $7E010E)
%assertRAM(MedallionFlag, $7E0112)
%assertRAM(VRAMTileMapIndex, $7E0116)
%assertRAM(VRAMUploadAddress, $7E0118)
%assertRAM(BG1ShakeV, $7E011A)
%assertRAM(BG1ShakeH, $7E011C)
%assertRAM(CurrentVolume, $7E0127)
%assertRAM(TargetVolume, $7E0129)
%assertRAM(CurrentControlRequest, $7E0133)
%assertRAM(MusicControl, $7E012B)
%assertRAM(MusicControlRequest, $7E012C)
%assertRAM(SFX1, $7E012D)
@@ -765,22 +811,32 @@ endmacro
%assertRAM(TileActIce, $7E0348)
%assertRAM(TileActDig, $7E035B)
%assertRAM(LinkZap, $7E0360)
%assertRAM(LinkDashing, $7E0372)
%assertRAM(DamageReceived, $7E0373)
%assertRAM(UseY2, $7E037A)
%assertRAM(NoDamage, $7E037B)
%assertRAM(AncillaGeneral, $7E039F)
%assertRAM(AncillaGeneralA, $7E0385)
%assertRAM(AncillaGeneralD, $7E0394)
%assertRAM(AncillaGeneralF, $7E039F)
%assertRAM(AncillaSearch, $7E03C4)
%assertRAM(ForceSwordUp, $7E03EF)
%assertRAM(FluteTimer, $7E03F0)
%assertRAM(YButtonOverride, $7E03FC)
%assertRAM(RoomItemsTaken, $7E0403)
%assertRAM(OverworldIndexMirror, $7E040A)
%assertRAM(DungeonID, $7E040C)
%assertRAM(TransitionDirection, $7E0418)
%assertRAM(TrapDoorFlag, $7E0468)
%assertRAM(LayerAdjustment, $7E047A)
%assertRAM(RoomIndexMirror, $7E048E)
%assertRAM(RespawnFlag, $7E04AA)
%assertRAM(Map16ChangeIndex, $7E04AC)
%assertRAM(OWEntranceCutscene, $7E04C6)
%assertRAM(HeartBeepTimer, $7E04CA)
%assertRAM(CameraTargetN, $7E0610)
%assertRAM(CameraTargetS, $7E0612)
%assertRAM(CameraTargetW, $7E0614)
%assertRAM(CameraTargetE, $7E0616)
%assertRAM(CameraScrollN, $7E0618)
%assertRAM(CameraScrollS, $7E061A)
%assertRAM(CameraScrollW, $7E061C)
@@ -788,8 +844,11 @@ endmacro
%assertRAM(NMIAux, $7E0632)
%assertRAM(SpriteRoomTag, $7E0642)
%assertRAM(SomariaSwitchFlag, $7E0646)
%assertRAM(TileMapDoorPos, $7E068E)
%assertRAM(DoorTimer, $7E0690)
%assertRAM(TileMapEntranceDoors, $7E0696)
%assertRAM(TileMapTile32, $7E0698)
%assertRAM(RandoOverworldTargetEdge, $7E06FA)
%assertRAM(SkipOAM, $7E0710)
%assertRAM(OWScreenSize, $7E0712)
%assertRAM(SpawnedItemID, $7E0720)
@@ -797,6 +856,7 @@ endmacro
%assertRAM(SpawnedItemIsMultiWorld, $7E0724)
%assertRAM(SpawnedItemFlag, $7E0726)
%assertRAM(SpawnedItemMWPlayer, $7E0728)
%assertRAM(EnemyDropIndicator, $7E072A)
%assertRAM(SprDropsItem, $7E0730)
%assertRAM(SprItemReceipt, $7E0740)
%assertRAM(SprItemIndex, $7E0750)
@@ -808,8 +868,6 @@ endmacro
%assertRAM(OAMBuffer2, $7E0A00)
%assertRAM(TransparencyFlag, $7E0ABD)
%assertRAM(OWTransitionFlag, $7E0ABF)
%assertRAM(TreePullKills, $7E0CFB)
%assertRAM(TreePullHits, $7E0CFC)
%assertRAM(ArcVariable, $7E0B08)
%assertRAM(OverlordXLow, $7E0B08)
%assertRAM(OverlordXHigh, $7E0B10)
@@ -822,9 +880,14 @@ endmacro
%assertRAM(AncillaVelocityY, $7E0C22)
%assertRAM(AncillaVelocityX, $7E0C2C)
%assertRAM(AncillaID, $7E0C4A)
%assertRAM(AncillaGeneralN, $7E0C54)
%assertRAM(AncillaGet, $7E0C5E)
%assertRAM(AncillaLayer, $7E0C7C)
%assertRAM(SpriteForceDrop, $7E0CBA)
%assertRAM(SpriteBump, $7E0CD2)
%assertRAM(BossSpecialAction, $7E0CF3)
%assertRAM(TreePullKills, $7E0CFB)
%assertRAM(TreePullHits, $7E0CFC)
%assertRAM(SpritePosYLow, $7E0D00)
%assertRAM(SpritePosXLow, $7E0D10)
%assertRAM(SpritePosYHigh, $7E0D20)
@@ -845,40 +908,13 @@ endmacro
%assertRAM(SpriteOAMProperties, $7E0E40)
%assertRAM(SpriteHitPoints, $7E0E50)
%assertRAM(SpriteControl, $7E0E60)
%assertRAM(SpriteItemType, $7E0E80)
%assertRAM(SpriteSpawnStep, $7E0ED0)
%assertRAM(SpriteJumpIndex, $7E0E80)
%assertRAM(SpriteDirectionTable, $7E0EB0)
%assertRAM(SpriteSpawnStep, $7E0ED0)
%assertRAM(SpriteHalt, $7E0F00)
%assertRAM(SpriteTimerE, $7E0F10)
%assertRAM(SpriteLayer, $7E0F20)
%assertRAM(SpriteOAMProp, $7E0F50)
%assertRAM(EN_OWSCR2, $7EC140)
%assertRAM(EN_MAINDESQ, $7EC142)
%assertRAM(EN_SUBDESQ, $7EC143)
%assertRAM(EN_BG2VERT, $7EC144)
%assertRAM(EN_BG2HORZ, $7EC146)
%assertRAM(EN_POSY, $7EC148)
%assertRAM(EN_POSX, $7EC14A)
%assertRAM(EN_OWSCR, $7EC14C)
%assertRAM(EN_OWTMAPI, $7EC14E)
%assertRAM(EN_SCROLLATN, $7EC150)
%assertRAM(EN_SCROLLATW, $7EC152)
%assertRAM(EN_SCROLLAN, $7EC154)
%assertRAM(EN_SCROLLBN, $7EC156)
%assertRAM(EN_SCROLLAS, $7EC158)
%assertRAM(EN_SCROLLBS, $7EC15A)
%assertRAM(EN_OWTARGN, $7EC15C)
%assertRAM(EN_OWTARGS, $7EC15E)
%assertRAM(EN_OWTARGW, $7EC160)
%assertRAM(EN_OWTARGE, $7EC162)
%assertRAM(EN_AA0, $7EC164)
%assertRAM(EN_BGSET1, $7EC165)
%assertRAM(EN_BGSET2, $7EC166)
%assertRAM(EN_SPRSET1, $7EC167)
%assertRAM(EN_SCRMODYA, $7EC16A)
%assertRAM(EN_SCRMODYB, $7EC16C)
%assertRAM(EN_SCRMODXA, $7EC16E)
%assertRAM(EN_SCRMODXB, $7EC170)
%assertRAM(SpriteZCoord, $7E0F70)
%assertRAM(SpriteVelocityZ, $7E0F80)
%assertRAM(SpriteSubPixelZ, $7E0F90)
@@ -911,6 +947,8 @@ endmacro
%assertRAM(ClockBuffer, $7E1E9C)
%assertRAM(ScratchBufferNV, $7E1EA0)
%assertRAM(ScratchBufferV, $7E1EB0)
%assertRAM(TileMapA, $7E2000)
%assertRAM(TileMapB, $7E4000)
%assertRAM(TileUploadBuffer, $7EA180)
%assertRAM(RoomFade, $7EC005)
%assertRAM(FadeTimer, $7EC007)
@@ -919,12 +957,41 @@ endmacro
%assertRAM(MosaicLevel, $7EC011)
%assertRAM(RoomDarkness, $7EC017)
%assertRAM(SpriteOAM, $7EC025)
%assertRAM(SpriteDynamicOAM, $7EC035)
%assertRAM(EN_OWSCR2, $7EC140)
%assertRAM(EN_MAINDESQ, $7EC142)
%assertRAM(EN_SUBDESQ, $7EC143)
%assertRAM(EN_BG2VERT, $7EC144)
%assertRAM(EN_BG2HORZ, $7EC146)
%assertRAM(EN_POSY, $7EC148)
%assertRAM(EN_POSX, $7EC14A)
%assertRAM(EN_OWSCR, $7EC14C)
%assertRAM(EN_OWTMAPI, $7EC14E)
%assertRAM(EN_SCROLLATN, $7EC150)
%assertRAM(EN_SCROLLATW, $7EC152)
%assertRAM(EN_SCROLLAN, $7EC154)
%assertRAM(EN_SCROLLBN, $7EC156)
%assertRAM(EN_SCROLLAS, $7EC158)
%assertRAM(EN_SCROLLBS, $7EC15A)
%assertRAM(EN_OWTARGN, $7EC15C)
%assertRAM(EN_OWTARGS, $7EC15E)
%assertRAM(EN_OWTARGW, $7EC160)
%assertRAM(EN_OWTARGE, $7EC162)
%assertRAM(EN_AA0, $7EC164)
%assertRAM(EN_BGSET1, $7EC165)
%assertRAM(EN_BGSET2, $7EC166)
%assertRAM(EN_SPRSET1, $7EC167)
%assertRAM(EN_SCRMODYA, $7EC16A)
%assertRAM(EN_SCRMODYB, $7EC16C)
%assertRAM(EN_SCRMODXA, $7EC16E)
%assertRAM(EN_SCRMODXB, $7EC170)
%assertRAM(PegColor, $7EC172)
%assertRAM(GameOverSongCache, $7EC227)
%assertRAM(LastBGSet, $7EC2F8)
%assertRAM(PaletteBufferAux, $7EC300)
%assertRAM(PaletteBuffer, $7EC500)
%assertRAM(HUDTileMapBuffer, $7EC700)
%assertRAM(HUDCurrentDungeonWorld, $7EC702)
%assertRAM(HUDKeyIcon, $7EC726)
%assertRAM(HUDGoalIndicator, $7EC72A)
%assertRAM(HUDPrizeIcon, $7EC742)
@@ -932,6 +999,10 @@ endmacro
%assertRAM(HUDBombCount, $7EC75A)
%assertRAM(HUDArrowCount, $7EC760)
%assertRAM(HUDKeyDigits, $7EC764)
%assertRAM(HUDMultiIndicator, $7EC790)
%assertRAM(HUDKeysObtained, $7EC7A2)
%assertRAM(HUDKeysSlash, $7EC7A4)
%assertRAM(HUDKeysTotal, $7EC7A6)
%assertRAM(BigRAM, $7EC900)
%assertRAM(DecompressionBuffer, $7F0000)

View File

@@ -628,7 +628,6 @@ VTIMEH = $00420A
; f - DMA channel 5 (0: disabled | 1: enabled)
; g - DMA channel 6 (0: disabled | 1: enabled)
; h - DMA channel 7 (0: disabled | 1: enabled)
MDMAEN = $00420B
DMAENABLE = $00420B
; H-BLANK DIRECT MEMORY ACCESS CHANNEL DESIGNATION
@@ -642,7 +641,6 @@ DMAENABLE = $00420B
; f - HDMA channel 5 (0: disabled | 1: enabled)
; g - HDMA channel 6 (0: disabled | 1: enabled)
; h - HDMA channel 7 (0: disabled | 1: enabled)
HDMAEN = $00420C
HDMAENABLE = $00420C
; ACCESS CYCLE DESIGNATION
@@ -1390,8 +1388,8 @@ endmacro
%assertREG(HTIMEH, $4208)
%assertREG(VTIMEL, $4209)
%assertREG(VTIMEH, $420A)
%assertREG(MDMAEN, $420B)
%assertREG(HDMAEN, $420C)
%assertREG(DMAENABLE, $420B)
%assertREG(HDMAENABLE, $420C)
%assertREG(MEMSEL, $420D)
%assertREG(RDNMI, $4210)
%assertREG(TIMEUP, $4211)

View File

@@ -38,7 +38,7 @@ DecrementArrows:
REP #$20
LDA.b RoomIndex : CMP.w #$0111 : SEP #$20 : BNE .not_archery_game
LDA.b IndoorsFlag : BEQ .not_archery_game ; in overworld
LDA.w $0B9A : BEQ .shoot_arrow ; arrow game active
LDA.w BowDryFire : BEQ .shoot_arrow ; arrow game active
LDA.b #$00 : BRA .done
.not_archery_game

View File

@@ -11,22 +11,22 @@ RigDigRNG:
RTL
;--------------------------------------------------------------------------------
RigChestRNG:
JSL.l DecrementChestCounter
JSL DecrementChestCounter
LDA.w $04C4 : CMP.l ChestGameRNG : BEQ .forceHeart
.normalItem
JSL GetRandomInt
AND.b #$07 ; restrict values to 0-7
CMP.b #$07 : BEQ .notHeart
JSL.l DecrementItemCounter
JSL DecrementItemCounter
RTL
.forceHeart
LDA.b #$33 : STA.b ScrapBufferBD+$0B ; assure the correct state if player talked to shopkeeper
LDA.w RoomItemsTaken : AND.b #$40 : BNE .notHeart
LDA ChestGameItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l ChestGameItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
LDA.b #$07 ; give prize item
RTL
.notHeart
JSL.l DecrementItemCounter
JSL DecrementItemCounter
JSL GetRandomInt ; spam RNG until we stop getting the prize item
AND.b #$07 ; restrict values to 0-7
@@ -37,7 +37,7 @@ RTL
;--------------------------------------------------------------------------------
FixChestCounterForChestGame:
JSL DecrementItemCounter
JML $8DBA71
JML GetRandomInt
;--------------------------------------------------------------------------------
RNG_Lanmolas1:
LDA.b #$00 : BRA _rng_done
@@ -46,7 +46,7 @@ RNG_Moldorm1:
RNG_Agahnim1:
LDA.b RoomIndex : CMP.b #$20 : BNE RNG_Agahnim2 ; Agah 1 and 2 use the same code, check which agah we're fighting and branch
LDA.b #$02
JSL.l GetStaticRNG : PHA
JSL GetStaticRNG : PHA
LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled
PLA
ORA.b #$01 ; guarantee no blue ball
@@ -73,7 +73,7 @@ RNG_Moldorm2:;x
LDA.b #$0A : BRA _rng_done
RNG_Agahnim2:
LDA.b #$0B
JSL.l GetStaticRNG : PHA
JSL GetStaticRNG : PHA
LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled
PLA
ORA.b #$01 ; guarantee no blue ball
@@ -87,7 +87,7 @@ RNG_Ganon:
LDA.b #$0D : BRA _rng_done
RNG_Ganon_Extra_Warp:
LDA.b #$0E
JSL.l GetStaticRNG : PHA
JSL GetStaticRNG : PHA
LDA.l GanonAgahRNG : BEQ + ; check if warps are disabled
PLA
AND.b #$FE ; set least significant bit to 0 to prevent teleport
@@ -101,7 +101,7 @@ RNG_Enemy_Drops:
+
LDA.b #$0F
_rng_done:
JSL.l GetStaticRNG
JSL GetStaticRNG
RTL
;--------------------------------------------------------------------------------
; In: A = RNG Index

Some files were not shown because too many files have changed in this diff Show More