diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index d45980b..c042e09 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -213,6 +213,7 @@ incsrc gk/variable_ganon_vulnerability.asm incsrc gk/pseudoflute.asm incsrc gk/fast_junk.asm incsrc gk/dungeon_maps.asm +incsrc gk/dungeon_indicator.asm incsrc pikit.asm print "End of B9: ", pc diff --git a/bugfixes.asm b/bugfixes.asm index 85f3cbc..e56cfd1 100644 --- a/bugfixes.asm +++ b/bugfixes.asm @@ -246,7 +246,7 @@ FixSwimBump: .normal LDA.b LinkJumping : BNE .continue ; what we wrote over .not_diving - PLA : PLA : PEA.w $87964E ; skip ahead, not diving + PLA : PLA : PEA.w $87964D ; skip ahead, not diving .continue RTL ;-------------------------------------------------------------------------------- diff --git a/controllerjank.asm b/controllerjank.asm index 8099663..bb3a5f9 100644 --- a/controllerjank.asm +++ b/controllerjank.asm @@ -49,14 +49,14 @@ InvertDPad_DPadLROnly: LDA.w JOY1L : STA.b Scrap00 LDA.w JOY1H BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right - STA.b Scrap00 + STA.b Scrap01 JML InvertDPadReturn InvertDPad_DPadUDOnly: LDA.w JOY1L : STA.b Scrap00 LDA.w JOY1H BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down - STA.b Scrap00 + STA.b Scrap01 JML InvertDPadReturn InvertDPad: diff --git a/darkworldspawn.asm b/darkworldspawn.asm index 5bc796f..df48bd3 100644 --- a/darkworldspawn.asm +++ b/darkworldspawn.asm @@ -146,32 +146,57 @@ macro SetMinimum(base,filler,compare) endmacro RefreshRainAmmo: LDA.l ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state - RTL - .rain - LDA.l StartingEntrance - + CMP.b #$03 : BNE + ; Uncle - %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle) - %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle) - LDA.l ArrowMode : BEQ ++ - LDA.l BowEquipment : BEQ +++ - ++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle) - +++ BRA .done - + CMP.b #$02 : BNE + ; Cell - %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Cell) - %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Cell) - LDA.l ArrowMode : BEQ ++ - LDA.l BowEquipment : BEQ .done - ++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell) - BRA .done - + CMP.b #$04 : BNE + ; Mantle - %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Mantle) - %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Mantle) - LDA.l ArrowMode : BEQ ++ - LDA.l BowEquipment : BEQ .done - ++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle) - + - .done RTL +.rain + LDA.l StartingEntrance : BEQ .uncle + CMP.b #$03 : BNE + ; Uncle + .uncle + LDA.l RainDeathRefillMagic_Uncle : JSR .refillMagic + LDA.l RainDeathRefillBombs_Uncle : JSR .refillBombs + LDA.l ArrowMode : BNE .rupeeBow + LDA.l RainDeathRefillArrows_Uncle : JSR .refillArrows + BRA .done + + CMP.b #$02 : BNE + ; Cell + LDA.l RainDeathRefillMagic_Cell : JSR .refillMagic + LDA.l RainDeathRefillBombs_Cell : JSR .refillBombs + LDA.l ArrowMode : BNE .rupeeBow + LDA.l RainDeathRefillArrows_Cell : JSR .refillArrows + BRA .done + + CMP.b #$04 : BNE + ; Mantle + LDA.l RainDeathRefillMagic_Mantle : JSR .refillMagic + LDA.l RainDeathRefillBombs_Mantle : JSR .refillBombs + LDA.l ArrowMode : BNE .rupeeBow + LDA.l RainDeathRefillArrows_Mantle : JSR .refillArrows + BRA .done + + BRA .done + + .rupeeBow + REP #$20 + LDA.l RainDeathRefillRupeeBow : JSR .refillRupees + SEP #$20 + +.done +RTL + +.refillMagic + SEC : SBC.l CurrentMagic : BCC + + STA.l MagicFiller + + RTS + +.refillBombs + SEC : SBC.l BombsEquipment : BCC + + STA.l BombsFiller + + RTS + +.refillArrows + SEC : SBC.l CurrentArrows : BCC + + STA.l ArrowsFiller + + RTS + +.refillRupees + CMP.l CurrentRupees : BCC + + STA.l CurrentRupees + + RTS ;-------------------------------------------------------------------------------- SetEscapeAssist: LDA.l ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state diff --git a/data/creditscharmapsmall_yellow.txt b/data/creditscharmapsmall_yellow.txt index c1c047c..016c4aa 100644 --- a/data/creditscharmapsmall_yellow.txt +++ b/data/creditscharmapsmall_yellow.txt @@ -29,3 +29,4 @@ Z=33 '=35 -=36 .=37 +*=FF diff --git a/dialog.asm b/dialog.asm index 719bd37..8625c85 100644 --- a/dialog.asm +++ b/dialog.asm @@ -61,73 +61,84 @@ LoadDialogAddressIndirect: RTL ;-------------------------------------------------------------------------------- FreeDungeonItemNotice: - STA.l ScratchBufferV + STA.l ScratchBufferV - PHA : PHX : PHY - PHP - PHB : PHK : PLB - SEP #$20 ; set 8-bit accumulator - REP #$10 ; set 16-bit index registers - PEI.b (Scrap00) - LDA.b Scrap02 : PHA - LDA.l ScratchBufferNV : PHA - LDA.l ScratchBufferNV+1 : PHA + PHA : PHX : PHY + PHP + PHB : PHK : PLB + SEP #$20 ; set 8-bit accumulator + REP #$10 ; set 16-bit index registers + PEI.b (Scrap00) + LDA.b Scrap02 : PHA + LDA.l ScratchBufferNV : PHA + LDA.l ScratchBufferNV+1 : PHA ;-------------------------------- - LDA.l FreeItemText : BNE + : JMP .skip : + + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ + + LDA.b #$2F ; if not from our world, show all dungeon item and crystal notices ++ ORA.l FreeItemText : BNE + : JMP .skip : + + STA.b Scrap00 LDA.b #$00 : STA.l ScratchBufferNV ; initialize scratch - LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for general small key + + LDA.b Scrap00 : AND.b #$01 : BEQ + ; show message for general small key LDA.l ScratchBufferV : CMP.b #$24 : BNE + ; general small key %CopyDialog(Notice_SmallKeyOf) LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer %CopyDialog(Notice_Self) JMP .done - + : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for general compass + ++ LDA.b Scrap00 : AND.b #$02 : BEQ + ; show message for general compass LDA.l ScratchBufferV : CMP.b #$25 : BNE + ; general compass %CopyDialog(Notice_CompassOf) LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer %CopyDialog(Notice_Self) JMP .done - + : LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for general map + ++ LDA.b Scrap00 : AND.b #$04 : BEQ + ; show message for general map LDA.l ScratchBufferV : CMP.b #$33 : BNE + ; general map %CopyDialog(Notice_MapOf) LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer %CopyDialog(Notice_Self) JMP .done - + : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for general big key + ++ LDA.b Scrap00 : AND.b #$08 : BEQ + ; show message for general big key LDA.l ScratchBufferV : CMP.b #$32 : BNE + ; general big key %CopyDialog(Notice_BigKeyOf) LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer %CopyDialog(Notice_Self) JMP .done - + - LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for dungeon map + ++ LDA.b Scrap00 : AND.b #$04 : BEQ + ; show message for dungeon map LDA.l ScratchBufferV : AND.b #$F0 ; looking at high bits only CMP.b #$70 : BNE + ; map of... %CopyDialog(Notice_MapOf) JMP .dungeon - + : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass + ++ LDA.b Scrap00 : AND.b #$02 : BEQ + ; show message for dungeon compass LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of... %CopyDialog(Notice_CompassOf) JMP .dungeon - + : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key + ++ LDA.b Scrap00 : AND.b #$08 : BEQ + ; show message for dungeon big key LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of... %CopyDialog(Notice_BigKeyOf) JMP .dungeon - + : LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for dungeon small key + ++ LDA.b Scrap00 : AND.b #$01 : BEQ + ; show message for dungeon small key LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of... LDA.l ScratchBufferV : CMP.b #$AF : BNE ++ : JMP .skip : ++ %CopyDialog(Notice_SmallKeyOf) LDA.b #$01 : STA.l ScratchBufferNV ; set up a flip for small keys BRA .dungeon - + : LDA.l FreeItemText : AND.b #$20 : BEQ + ; show message for crystal + ++ LDA.b Scrap00 : AND.b #$20 : BEQ + ; show message for crystal LDA.l ScratchBufferV : CMP.b #$B0 : !BLT + ; crystal # - CMP.b #$B7 : !BGE + + CMP.b #$B7 : !BGE + %CopyDialog(Notice_Crystal) JMP .crystal - + - JMP .skip ; it's not something we are going to give a notice for + ++ JMP .skip ; it's not something we are going to give a notice for .dungeon LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer @@ -139,23 +150,26 @@ FreeDungeonItemNotice: LDA.b #$0F : !SUB.l ScratchBufferNV+1 : STA.l ScratchBufferNV+1 ; flip the values for small keys + LDA.l ScratchBufferNV+1 - ASL : TAX - REP #$20 - LDA.l DungeonItemIDMap,X : CMP.w #$0003 : BCC .hc_sewers - CMP.w DungeonID : BNE + - BRA .self_notice - .hc_sewers - LDA.w DungeonID : CMP.w #$0003 : BCS + - .self_notice - SEP #$20 - LDA.l FreeItemText : AND.b #$40 : BEQ ++ - LDA.b #$00 : STA.l DialogOffsetPointer : STA.l DialogOffsetPointer+1 - JMP .skip - ++ - %CopyDialog(Notice_Self) - JMP .done - + - SEP #$20 + ASL : TAX + REP #$20 + + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : AND.w #$00FF : BNE + + + LDA.l DungeonItemIDMap, X : CMP.w #$0003 : BCC .hc_sewers + CMP.w DungeonID : BNE + + BRA .self_notice + .hc_sewers + LDA.w DungeonID : CMP.w #$0003 : BCS + + .self_notice + SEP #$20 + LDA.l FreeItemText : AND.b #$40 : BEQ ++ + LDA.b #$00 : STA.l DialogOffsetPointer : STA.l DialogOffsetPointer+1 + JMP .skip + ++ + %CopyDialog(Notice_Self) + JMP .done + + + SEP #$20 LDA.l ScratchBufferNV+1 CMP.b #$00 : BNE + ; ...light world %CopyDialog(Notice_LightWorld) : JMP .done @@ -190,9 +204,9 @@ FreeDungeonItemNotice: + : CMP.b #$0F : BNE + ; ...sewers %CopyDialog(Notice_Sewers) + - JMP .done + JMP .done - .crystal + .crystal LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer LDA.l ScratchBufferV AND.b #$0F ; looking at low bits only @@ -210,7 +224,7 @@ FreeDungeonItemNotice: %CopyDialog(Notice_Four) : JMP .done + : CMP.b #$06 : BNE + %CopyDialog(Notice_Three) : JMP .done - + + + .done @@ -220,14 +234,14 @@ FreeDungeonItemNotice: ;-------------------------------- .skip - PLA : STA.l ScratchBufferNV+1 - PLA : STA.l ScratchBufferNV - PLA : STA.b Scrap02 - REP #$20 - PLA : STA.b Scrap00 - PLB - PLP - PLY : PLX : PLA + PLA : STA.l ScratchBufferNV+1 + PLA : STA.l ScratchBufferNV + PLA : STA.b Scrap02 + REP #$20 + PLA : STA.b Scrap00 + PLB + PLP + PLY : PLX : PLA RTL ;-------------------------------------------------------------------------------- diff --git a/doorrando/doortables.asm b/doorrando/doortables.asm index 63005e9..6144190 100644 --- a/doorrando/doortables.asm +++ b/doorrando/doortables.asm @@ -599,7 +599,7 @@ skip $10 BigKeyStatus: ;27f040 (status 2 indicate BnC guard) dw $0002, $0002, $0001, $0001, $0000, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0000, $0000 DungeonReminderTable: ;27f060 -dw $2D50, $2D50, $2D51, $2D52, $2D54, $2D56, $2D55, $2D5A, $2D57, $2D59, $2D53, $2D58, $2D5B, $2D5C, $0000, $0000 +dw $2DA4, $2DA4, $2DA5, $2DA6, $2DA8, $2DAA, $2DA9, $2DAE, $2DAB, $2DAD, $2DA7, $2DAC, $2DAF, $2DB0, $0000, $0000 TotalLocationsLow: ;27f080 db $08, $08, $06, $06, $02, $00, $04, $08, $08, $08, $06, $08, $02, $07, $00, $00 TotalLocationsHigh: ;27f090 @@ -696,4 +696,4 @@ dw $ffff OldManDarkWorld: dw $ffff OldManRetrievalWorld: -dw $0000 \ No newline at end of file +dw $0000 diff --git a/doorrando/hudadditions.asm b/doorrando/hudadditions.asm index 73cf87f..e10b421 100644 --- a/doorrando/hudadditions.asm +++ b/doorrando/hudadditions.asm @@ -1,10 +1,12 @@ !BlankTile = $207F !SlashTile = $2830 +!PlusTile = $2404 !HyphenTile = $2405 !LTile = $2D68 !DTile = $2D60 -!RedSquare = $345E !BlueSquare = $2C5E +!BossIcon = $253C +!NPCIcon = $253B DrHudOverride: PHB @@ -29,6 +31,13 @@ DRHUD_DrawIndicators: LDA.b FrameCounter : AND.b #$10 : BEQ DRHUD_EnemyDropIndicator DRHUD_BossIndicator: + LDA.w DungeonID : CMP.b #$FF : BNE .in_dungeon + LDA.w NpcItemIndicator : BEQ .early_exit + LDA.l HudItems_enabled : BEQ .early_exit + REP #$10 + LDY.w #!NPCIcon : STY.w HUDMultiIndicator + JMP DRHUD_Finished +.in_dungeon LDA.l DRMode : BNE .continue .early_exit REP #$10 @@ -46,7 +55,7 @@ DRHUD_BossIndicator: SEP #$20 BEQ .draw_indicator LDA.l CompassBossIndicator, x : CMP.b RoomIndex : BNE .draw_indicator - LDY.w #!RedSquare + LDY.w #!BossIcon .draw_indicator STY.w HUDMultiIndicator BRA DRHUD_DrawCurrentDungeonIndicator @@ -71,13 +80,12 @@ DRHUD_DrawCurrentDungeonIndicator: ; mX CMP.b #$06 : BEQ .draw_indicator .get_indicator - REP #$20 : LDA.l DungeonReminderTable,X : TAY - SEP #$20 + LDY.w #$2C28 .draw_indicator STY.w HUDCurrentDungeonWorld DRHUD_DrawKeyCounter: - LDA.l DRFlags : AND.b #$04 : BEQ DRHUD_Finished + LDA.l DRFlags : AND.b #$04 : BEQ .to_finished LDA.l CompassMode : BIT.b #$03 : BEQ DRHUD_Finished REP #$20 BIT.w #$0002 : BNE .skip_map_check @@ -90,8 +98,17 @@ DRHUD_DrawKeyCounter: LDA.l GenericKeys : LSR : BCS .total_only LDA.w DungeonCollectedKeys, X : JSR ConvertToDisplay : STA.w HUDKeysObtained LDA.w #!SlashTile : STA.w HUDKeysSlash + + LDA.l ExtraChestKeys, X : AND.w #$00FF : BEQ .total_only + JSR ConvertToDisplay : STA.w HUDKeysExtraCount + LDA.w #!PlusTile : STA.w HUDKeysExtraPlus + .total_only - LDA.l ChestKeys, x : JSR ConvertToDisplay : STA.w HUDKeysTotal + SEP #$20 + LDA.l ChestKeys, X : SEC : SBC.l ExtraChestKeys, X + REP #$20 + JSR ConvertToDisplay : STA.w HUDKeysTotal +.to_finished JMP DRHUD_Finished OWRHUD_DrawWorldIndicator: @@ -292,17 +309,29 @@ BossStatus: ; default palette 3 - white LDA.l DungeonReminderTable, X : RTS -ConvertToDisplay: - and.w #$00ff : cmp.w #$000a : !BLT + - !ADD.w #$2519 : rts - + !ADD.w #$2490 : rts +ConvertToDisplay: ; transparent background + AND.w #$00FF + CMP.w #$000A : BCC .under10 + CMP.w #$000C : BCC .under12 + .over11 + CLC : ADC.w #$2553 : RTS + .under12 + CLC : ADC.w #$2519 : RTS + .under10 + CLC : ADC.w #$2490 : RTS -ConvertToDisplay2: - and.w #$00ff : beq ++ - cmp.w #$000a : !BLT + - !ADD.w #$2517 : 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 +ConvertToDisplay2: ; solid background + AND.w #$00FF : BEQ .zero + CMP.w #$000A : BCC .under10 + CMP.w #$000C : BCC .under12 + .over11 + CLC : ADC.w #$2580 : RTS + .under12 + CLC : ADC.w #$2517 : RTS + .under10 + CLC : ADC.w #$2816 : RTS + .zero + LDA.w #$2827 : RTS CountAbsorbedKeys: JML IncrementSmallKeysNoPrimary diff --git a/doorrando/spiral.asm b/doorrando/spiral.asm index 7a748f9..4888bea 100644 --- a/doorrando/spiral.asm +++ b/doorrando/spiral.asm @@ -21,14 +21,18 @@ SpiralWarp: { 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.w $045e : lda.b PreviousRoom : and.b #$0f : rtl ; clear,run hijacked code and get out - .inroom +.abort + SEP #$30 + stz.w $045e + lda.b PreviousRoom : and.b #$0f + rtl ; clear,run hijacked code and get out + +.inroom jsr InroomStairsWarp lda.b PreviousRoom : and.b #$0f ; this is the code we are hijacking rtl - .gtg +.gtg phb : phk : plb : phx : phy ; push stuff jsr LookupSpiralOffset rep #$30 : and.w #$00FF : asl #2 : tax @@ -81,6 +85,7 @@ SpiralWarp: { ldy.b #$01 : jsr SetCamera jsr StairCleanup + ply : plx : plb ; pull the stuff we pushed lda.b PreviousRoom : and.b #$0f ; this is the code we are hijacking rtl @@ -261,6 +266,7 @@ InroomStairsWarp: { .skipCamera jsr StairCleanup + ply : plx : plb ; pull the stuff we pushed rts } @@ -335,4 +341,4 @@ SpiralPriorityHack: { 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 -} \ No newline at end of file +} diff --git a/events.asm b/events.asm index f481548..5a7f974 100644 --- a/events.asm +++ b/events.asm @@ -38,7 +38,7 @@ RTL OnPlayerDead: PHA JSL SetDeathWorldChecked - JSL DynamicDropGFXClear + JSL DynamicDropGFXClear JSL SetSilverBowMode JSL RefreshRainAmmo PLA @@ -79,30 +79,20 @@ RTL ;-------------------------------------------------------------------------------- OnUncleItemGet: PHA - - LDA.l EscapeAssist - BIT.b #$04 : BEQ + : STA.l InfiniteMagic : + - BIT.b #$02 : BEQ + : STA.l InfiniteBombs : + - BIT.b #$01 : BEQ + : STA.l InfiniteArrows : + - LDA.l UncleItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID PLA 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 - LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows - LDA.b #70 : STA.l ArrowsFiller + LDA.l ProgressIndicator : BNE + + LDA.b #$01 : STA.l ProgressIndicator ; set rain state + JSL SetEscapeAssist + JSL RefreshRainAmmo + ; grant arrows if we started with a bow in retro mode LDA.l ArrowMode : BEQ + - LDA.l BowTracking : ORA.b #$80 : STA.l BowTracking ; enable bow toggle - REP #$20 ; set 16-bit accumulator - LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start - SEP #$20 ; set 8-bit accumulator + LDA.l RainDeathRefillRupeeBow : ORA.l RainDeathRefillRupeeBow+1 : BEQ + + LDA.b #$01 : STA.l ArrowsFiller + - LDA.l ProgressIndicator : BNE + - LDA.b #$01 : STA.l ProgressIndicator ; handle rain state - + RTL ;-------------------------------------------------------------------------------- OnAga1Defeated: @@ -201,12 +191,12 @@ OnNewFile: STZ.w TreePullKills STZ.w TreePullHits STZ.w PrizePackIndexes - STZ.w PrizePackIndexes+1 - STZ.w PrizePackIndexes+2 - STZ.w PrizePackIndexes+3 - STZ.w PrizePackIndexes+4 - STZ.w PrizePackIndexes+5 - STZ.w PrizePackIndexes+6 + STZ.w PrizePackIndexes+1 + STZ.w PrizePackIndexes+2 + STZ.w PrizePackIndexes+3 + STZ.w PrizePackIndexes+4 + STZ.w PrizePackIndexes+5 + STZ.w PrizePackIndexes+6 LDA.b #$00 : STA.l MosaicLevel JSL InitRNGPointerTable PLP : PLX diff --git a/follower.asm b/follower.asm index b33ada0..ef00935 100644 --- a/follower.asm +++ b/follower.asm @@ -857,6 +857,7 @@ RTL Kiki_DontScareTheMonke: LDA.b LinkJumping : BEQ .return CMP.b #$02 : BEQ .no_spook ; needed for quake usage + LDA.b GameMode : CMP.b #$0F : BEQ .no_spook ; needed for entrance transitions LDA.w NoDamage : BNE .no_spook LDA.w LinkThud : BNE .no_spook .spook diff --git a/framehook.asm b/framehook.asm index 126b2aa..d3b1bfb 100644 --- a/framehook.asm +++ b/framehook.asm @@ -2,21 +2,28 @@ ; Frame Hook ;-------------------------------------------------------------------------------- FrameHookAction: - JSL Module_MainRouting - JSL CheckMusicLoadRequest - PHP : REP #$30 : PHA - SEP #$20 - LDA.l StatsLocked : BNE ++ - REP #$20 ; set 16-bit accumulator - LDA.l LoopFrames : INC : STA.l LoopFrames : BNE + - LDA.l LoopFrames+2 : INC : STA.l LoopFrames+2 - + - LDA.l GameMode : CMP.w #$010E : BNE ++ ; move this to nmi hook? - LDA.l MenuFrames : INC : STA.l MenuFrames : BNE ++ - LDA.l MenuFrames+2 : INC : STA.l MenuFrames+2 - ++ - REP #$30 : PLA : PLP - + JSL Module_MainRouting + JSL CheckMusicLoadRequest + PHP : REP #$30 : PHA + SEP #$20 + LDA.l StatsLocked : BNE ++ + REP #$20 ; set 16-bit accumulator + LDA.l LoopFrames : INC : STA.l LoopFrames : BNE + + LDA.l LoopFrames+2 : INC : STA.l LoopFrames+2 + + + ; move this to nmi hook? + LDA.l GameMode : CMP.w #$010E : BNE + + ; item select menu + LDA.l MenuFrames : INC : STA.l MenuFrames : BNE ++ + LDA.l MenuFrames+2 : INC : STA.l MenuFrames+2 + + + LDA.l GameMode : CMP.w #$030E : BEQ .map ; underworld map + LDA.l GameMode : CMP.w #$070E : BNE ++ ; overworld map + .map + LDA.l MapFrames : INC : STA.l MapFrames : BNE ++ + LDA.l MapFrames+2 : INC : STA.l MapFrames+2 + ++ + REP #$30 : PLA : PLP RTL !NMI_MW = "$7F5047" @@ -47,37 +54,37 @@ JML NMIHookReturn ;-------------------------------------------------------------------------------- PostNMIHookAction: - LDA.w NMIAux : BEQ + - PHK : PEA.w .return-1 ; push stack for RTL return - JMP.w [NMIAux] - .return - STZ.w NMIAux ; zero bank byte of NMI hook pointer - + - JSR TransferItemGFX - LDA.b INIDISPQ : STA.w INIDISP ; thing we wrote over, turn screen back on + LDA.w NMIAux : BEQ + + PHK : PEA.w .return-1 ; push stack for RTL return + JMP.w [NMIAux] + .return + STZ.w NMIAux ; zero bank byte of NMI hook pointer + + + JSR TransferItemGFX + LDA.b INIDISPQ : STA.w INIDISP ; thing we wrote over, turn screen back on 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.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 TransferItemToVRAM - REP #$10 - PLX - DEX #2 - BPL - + REP #$30 + LDX.w ItemStackPtr : BEQ .done + 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 TransferItemToVRAM + REP #$10 + PLX + DEX #2 + BPL - - STZ.w ItemStackPtr - .done - SEP #$30 + STZ.w ItemStackPtr + .done + SEP #$30 RTS - .fail - BRK #$00 + .fail + BRK #$00 diff --git a/gk/check_loot.asm b/gk/check_loot.asm index 54f8d19..9fd3c14 100644 --- a/gk/check_loot.asm +++ b/gk/check_loot.asm @@ -1,42 +1,43 @@ ; A = room_id ; out A = level of loot -CheckLoot: +CheckMapLoot: PHP REP #$30 - PHB : PHX : PHY + PHX STA.b $CA - LDA.b $06 : PHA LDA.b $0E : PHA - STZ.b $02 ; best item class found - - LDA.l ShowItems_default + LDA.l MapItems_default AND.w #$00FF STA.b $0E LDA.b $CA - AND.w #$00FF + AND.w #$01FF ASL A TAX LDA.l SaveDataWRAM, X AND.w #$000F BEQ + - LDA.l ShowItems_visited_tile + LDA.l MapItems_visited_tile AND.w #$00FF CMP.b $0E BCC + STA.b $0E + LDA.w DungeonID + AND.w #$00FF + CMP.w #$00FF + BEQ .skip_dungeon_checks + TAX LDA.l MapField AND.l DungeonMask, X BEQ + - LDA.l ShowItems_have_map + LDA.l MapItems_have_map AND.w #$00FF CMP.b $0E BCC + @@ -45,13 +46,93 @@ CheckLoot: + LDA.l CompassField AND.l DungeonMask, X BEQ + - LDA.l ShowItems_have_compass + LDA.l MapItems_have_compass AND.w #$00FF CMP.b $0E BCC + STA.b $0E + +.skip_dungeon_checks + JMP GetLootLevelAndCleanUp + +; A = room_id +; out A = level of loot +CheckHudLoot: + PHP + REP #$30 + PHX + + STA.b $CA + + LDA.b $0E : PHA + ++ LDA.w DungeonID + AND.w #$00FF + CMP.w #$00FF + BEQ .cave + + TAX + + LDA.l HudItems_default_dungeon + AND.w #$00FF + STA.b $0E + + LDA.l MapField + AND.l DungeonMask, X + BEQ + + LDA.l HudItems_have_map + AND.w #$00FF + CMP.b $0E + BCC + + STA.b $0E + ++ LDA.l CompassField + AND.l DungeonMask, X + BEQ + + LDA.l HudItems_have_compass + AND.w #$00FF + CMP.b $0E + BCC + + STA.b $0E ++ + + BRA GetLootLevelAndCleanUp + +.cave + LDA.l HudItems_cave + AND.w #$00FF + STA.b $0E + ; intentional fall-through + +GetLootLevelAndCleanUp: + STZ.b $02 + + LDA.b $0E + AND.w #$00FF + BEQ + + JSL GetLootLevel ++ + + PLA : STA.b $0E + PLX + PLP + + LDA.b $02 +RTL + +; $CA = room_id +; $0E = level of details to return +; (1 - presence, 2 - compass or presence, 3 - value) +; out $02 = level of loot +GetLootLevel: + PHP + REP #$30 + PHB : PHX : PHY + LDA.b $06 : PHA + + STZ.b $02 ; best item class found + LDA.l ItemSources : BIT.w #$0001 : BEQ + JSR CheckChests + @@ -65,24 +146,25 @@ CheckLoot: + LDA.l ItemSources : BIT.w #$0008 : BEQ + - JSR CheckBoss + JSR CheckMisc + JSR CheckMisc2 + LDA.l ItemSources : BIT.w #$0010 : BEQ + JSR CheckPrize + +JSR CheckNpcs + .done - PLA : STA.b $0E PLA : STA.b $06 PLY : PLX : PLB PLP - LDA.b $02 RTL CheckChests: LDA.b $CA - AND.w #$00FF + AND.w #$01FF STA.b $00 ASL A TAX @@ -127,25 +209,22 @@ CheckChests: .done RTS -CheckBoss: - ; we assume all bosses are in section 1 of split sections - ; mainly to simplify hera cage key and GT torch - ; which use the same flow - ; and bosses are always in their own section anyway +CheckMisc: + ; this includes bosses, bonk torches, and standing items (in caves + hera cage key) + ; all dungeon items in this section are in section 1 of split sections + ; for cave items we'll always know what section we're in + ; but for dungeon items, we won't have a section specified in door rando + ; so if we don't have a section, assume it's 1, and it'll match all the dungeon items anyway LDA.b $CA - AND.w #$F000 - XBA - CMP.w #$0020 - BCC + - RTS - + BIT.w #$F000 + BNE + + ORA.w #$1000 + - LDA.b $CA - AND.w #$00FF + AND.w #$F1FF STA.b $04 LDX.w #$FFFA -.next_boss +.next_misc INX #6 LDA.l MiscLocations, X BPL .check @@ -153,9 +232,10 @@ CheckBoss: .check CMP.b $04 - BNE .next_boss + BNE .next_misc TXY + AND.w #$01FF CMP.b RoomIndex BEQ .current_room @@ -180,7 +260,7 @@ CheckBoss: TYX BIT.b $04 - BNE .next_boss ; continue checking if we already got the item + BNE .next_misc ; continue checking if we already got the item LDA.l MiscLocations+4, X STA.b $05 @@ -192,11 +272,28 @@ CheckBoss: AND.w #$00FF JSR GetLootClass - BRA .next_boss + BRA .next_misc + +CheckMisc2: + ; this currently only includes the library and Uncle + ; so let's just hard-code them for now + LDA.b $CA + CMP.w #$2107 : BNE + + LDA.l NpcFlags : AND.w #$0080 : BNE + + LDA.l LibraryItem : AND.w #$00FF : JSR GetLootClass ++ + + LDA.b $CA + CMP.w #$1055 : BNE + + LDA.l ProgressFlags : AND.w #$0001 : BNE + + LDA.l UncleItem : AND.w #$00FF : JSR GetLootClass ++ + + RTS CheckPrize: LDA.b $CA - AND.w #$00FF + AND.w #$01FF STA.b $04 LDX.w #$FFFD @@ -230,9 +327,44 @@ CheckPrize: BRA .next_prize +CheckNpcs: + LDA.b $CA + + LDX.w #$FFFA +.next_npc + INX #6 + LDA.l NpcItems, X + BMI .nope + + CMP.b $CA + BNE .next_npc + + LDA.l NpcItems+3, X ; get location of data to check + STA.b $05 + + LDA.l NpcItems+2, X + STA.b $04 + + LDA.b [$04] + AND.w #$00FF + AND.l NpcItems+5, X + BNE .next_npc + +.yep + LDA.w NpcItemIndicator + ORA.w #$0001 + STA.w NpcItemIndicator + RTS + +.nope + LDA.w NpcItemIndicator + AND.w #$FF00 + STA.w NpcItemIndicator + RTS + CheckPots: LDA.b $CA - AND.w #$00FF + AND.w #$01FF ASL A TAX @@ -298,7 +430,7 @@ CheckPots: + LDA.b $CA - AND.w #$00FF + AND.w #$01FF ASL A TAX if !FEATURE_FIX_BASEROM @@ -336,7 +468,7 @@ CheckJunkPot: + LDA.b $CA - AND.w #$00FF + AND.w #$01FF ASL A TAX LDA.l PotCollectionRateTable, X @@ -364,7 +496,7 @@ endif CheckEnemies: LDA.b $CA - AND.w #$00FF + AND.w #$01FF ASL A TAX @@ -454,7 +586,7 @@ CheckEnemies: + LDA.b $CA - AND.w #$00FF + AND.w #$01FF ASL A TAX @@ -484,13 +616,19 @@ GetLootClass: CMP.w #$0080 : BNE .not_compass .compass - LDA.l AlwaysShowCompass : BNE .check_value + LDA.b $0E + AND.w #$00FF + CMP.w #$0002 + BEQ .check_value .not_compass LDA.b $0E BEQ .done - CMP.w #$0001 - BEQ .value_set + CMP.w #$0003 + BCS .check_value + + LDA.w #$0001 + BRA .value_set .check_value LDA.l LootTypeMapping, X @@ -513,9 +651,13 @@ GetPotJunkClass: LDA.b $0E BEQ .done - CMP.w #$0001 - BEQ .value_set + CMP.w #$0003 + BCS .check_value + LDA.w #$0001 + BRA .value_set + +.check_value ; hardcode as junk for now LDA.w #$0002 @@ -532,7 +674,7 @@ macro DefineGetFooSection(type, offset) GetSection: PHX LDA.b $CA - AND.w #$00FF + AND.w #$01FF ASL A TAX LDA.l SplitRooms, X @@ -580,13 +722,13 @@ CheckSection: STA.b $CC LDA.b $CB - AND.w #$00FF + AND.w #$00F0 BEQ .yes JSR GetSection LDA.b $CB - AND.w #$00FF + AND.w #$00F0 LSR A : LSR A : LSR A : LSR A DEC A CMP.b $CE diff --git a/gk/data/item_mapping.asm b/gk/data/item_mapping.asm index 329c0d1..3e64912 100644 --- a/gk/data/item_mapping.asm +++ b/gk/data/item_mapping.asm @@ -3,8 +3,8 @@ !TIER_LOW_KEY = $03 !TIER_HEALTH = $05 !TIER_MINOR = $06 -!TIER_MAP = $07 -!TIER_COMPASS = $08 +!TIER_COMPASS = $07 +!TIER_MAP = $08 !TIER_SM_KEY = $09 !TIER_BIG_KEY = $0A !TIER_MAJOR = $0B @@ -49,7 +49,7 @@ db !TIER_CRYSTAL ; 20 - Crystal db !TIER_MINOR ; 21 - Net db !TIER_MINOR ; 22 - Blue Mail db !TIER_MINOR ; 23 - Red Mail -db !TIER_LOW_KEY ; 24 - Small Key +db !TIER_SM_KEY ; 24 - Small Key db !TIER_COMPASS ; 25 - Compass db !TIER_HEALTH ; 26 - Heart Container from 4/4 db !TIER_JUNK ; 27 - Bomb diff --git a/gk/data/split_room.asm b/gk/data/split_room.asm index 06f5f7b..435596b 100644 --- a/gk/data/split_room.asm +++ b/gk/data/split_room.asm @@ -61,7 +61,24 @@ SplitRooms: %d(.no) : %d(.d1) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.d6) : %d(.no) %d(.no) : %d(.no) : %d(.no) : %d(.db) : %d(.no) : %d(.no) : %d(.no) : %d(.no) -%d(.no) +; E0 +%d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) +%d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) + +; F0 +%d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) +%d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.no) + +; 100 +%d(.no) : %d(.101) : %d(.no) : %d(.103) : %d(.no) : %d(.no) : %d(.106) : %d(.107) +%d(.no) : %d(.no) : %d(.no) : %d(.no) : %d(.10c) : %d(.no) : %d(.10e) : %d(.no) + +; 110 +%d(.no) : %d(.no) : %d(.112) : %d(.no) : %d(.114) : %d(.115) : %d(.no) : %d(.no) +%d(.no) : %d(.no) : %d(.no) : %d(.11b) : %d(.11c) : %d(.no) : %d(.11e) : %d(.11f) + +; 120 +%d(.120) : %d(.no) : %d(.122) : %d(.no) : %d(.124) : %d(.125) : %d(.126) : %d(.127) .no db $00 @@ -435,7 +452,7 @@ db $01 %d(..areas) : %d(..doors) : %d(.no_items) : %d(.no_items) : %d(.no_items) : %d(.no_items) ..areas db $02, $00, $80, $00, $FF -db $01, $34, $D4, $B8, $FF +db $01, $34, $44, $B4, $FF db $FF ..doors db $03, $06 @@ -569,3 +586,344 @@ db $FF ..chests db $01 db $FF + +.101 ; East Snitch House (2) // West Snitch House (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(..pots) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..pots +db $00 +db $FF +..enemies +db $00 +db $FF + +.103 ; Man With Beds (3) // Front of Tavern (2) // Back of Tavern (1) +db $02 +%sq($00) +%d(..areas3) : %d(..doors3) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies3) +%sq($00) +%d(..areas2) : %d(..doors2) : %d(.no_items) +%d(.no_items) : %d(..pots2) : %d(..enemies2) +..areas3 +db $03, $80, $FF, $00, $FF +db $FF +..doors3 +db $08 +db $FF +..enemies3 +db $02 +db $FF +..areas2 +db $03, $00, $7F, $50, $FF +db $FF +..doors2 +db $06 +db $FF +..pots2 +db $02 +db $FF +..enemies2 +db $00 +db $01 +db $FF + +.106 ; VoO Chest Game (2) // Brewery (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..enemies +db $00 +db $FF + +.107 ; Library (2) // Bomb Refill Hut (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(.no_items) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF + +.10c ; Mimic Cave (2) // Hookshot Fairy Pot (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(..chests) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..chests +db $00 +db $FF +..enemies +db $04 +db $05 +db $06 +db $07 +db $FF + +.10e ; Storyteller (2) // Storyteller (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..chests +db $FF +..pots +db $FF +..enemies +db $00 +db $FF + +.112 ; Dark Chapel (2) // Store (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..enemies +db $00 +db $FF + +.114 ; Waterfall Fairy (2) // Hint NPC (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(..chests) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..chests +db $00 +db $01 +db $FF +..enemies +db $00 +db $FF + +.115 ; Capacity Fairy (1) // Healing Fairy (2) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $80, $FF, $80, $FF +db $FF +..doors +db $08 +db $FF +..enemies +db $00 +db $FF + +.11b ; Cave 45 (2) // Graveyard Ledge (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(..pots) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..pots +db $00 +db $01 +db $02 +db $03 +db $04 +db $05 +db $FF +..enemies +db $01 +db $FF + +.11c ; Bomb Shop (2) // C-Shaped House (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..enemies +db $00 +db $FF + +.11e ; Long Fairy Cave (2) // Hype Cave (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..enemies +db $00 +db $01 +db $02 +db $03 +db $FF + +.11f ; Lumberjack House (1) // Store (2) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $80, $FF, $00, $FF +db $FF +..doors +db $08 +db $FF +..enemies +db $00 +db $FF + +.120 ; Ice Rod Cave (1) // Cool Bee Cave (2) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $80, $FF, $00, $FF +db $03, $80, $FF, $00, $FF +db $FF +..doors +db $08 +db $FF +..enemies +db $00 +db $01 +db $02 +db $FF + +.122 ; Fortune Teller (2) // Other Fortune Teller (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..enemies +db $00 +db $FF + +.124 ; 50-Rupee Cave (1) // Bonk Rocks (2) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(..chests) : %d(.no_items) : %d(.no_items) +..areas +db $03, $80, $FF, $00, $FF +db $FF +..doors +db $08 +db $FF +..chests +db $00 +db $FF + +.125 ; 20-Rupee Cave (2) // Spiky Hint Cave (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(..pots) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..pots +db $00 +db $01 +db $02 +db $03 +db $FF +..enemies +db $00 +db $FF + +.126 ; Bonk Fairy Pool (2) // Checkerboard Cave (1) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(.no_items) : %d(..enemies) +..areas +db $03, $00, $7F, $00, $FF +db $FF +..doors +db $06 +db $FF +..enemies +db $01 +db $02 +db $03 +db $04 +db $FF + +.127 ; Hammer Pegs Cave (1) // Fake Dark Lake Hylia Spike Hint Cave (2) +db $01 +%sq($00) +%d(..areas) : %d(..doors) : %d(.no_items) +%d(.no_items) : %d(..pots) : %d(.no_items) +..areas +db $03, $80, $FF, $00, $FF +db $FF +..doors +db $08 +db $FF +..pots +db $04 +db $05 +db $06 +db $07 +db $FF diff --git a/gk/doors_dungeon_map.asm b/gk/doors_dungeon_map.asm index aa701b6..aec57fe 100644 --- a/gk/doors_dungeon_map.asm +++ b/gk/doors_dungeon_map.asm @@ -150,7 +150,10 @@ DrawFullRoomTile: RTL DrawSingleRoomLoot: - PHX : PHY + LDA.l MapItems_enabled : AND.w #$00FF : BNE + + RTL + ++ PHX : PHY TYX @@ -172,7 +175,8 @@ DrawSingleRoomLoot: STA.w GFXStripes+$0C, Y LDA.b $CA - JSL CheckLoot + AND.w #$F0FF + JSL CheckMapLoot ASL A : ASL A : ASL A @@ -687,6 +691,13 @@ GetSpecificRoomVisibility: STA.b $0A + + SEP #$20 + LDA.b $0A + CMP.b $0B + BCC + + STA.b $0B ++ + REP #$20 LDA.b $CA AND.w #$00FF @@ -1229,7 +1240,7 @@ DrawDoorsMapBlinker: AND.w #$01E0 ASL A : ASL A : ASL A XBA - CLC : ADC.w #$00A4 + CLC : ADC.w #$00A5 STA.w OAMBuffer, X LDA.b LinkPosY @@ -1707,10 +1718,13 @@ DoorsMapChangeDungeon: BNE + INX + LDA.l DungeonMapData.prev, X + STA.w DungeonID CMP.b $00 BEQ .done - STA.w DungeonID + JSL IsValidDungeonToSwapTo + BCC .next + JSL FindFirstEntrance CPY.b #$FF BEQ .next @@ -2105,6 +2119,13 @@ DrawDoorsStairs: DetectLinksSection: LDA.b RoomIndex + CMP.w #$0128 + BCC + + + LDA.w #$0000 + RTL ++ + ASL A TAX LDA.l SplitRooms, X diff --git a/gk/draw_loot.asm b/gk/draw_loot.asm index c11b06d..bf544af 100644 --- a/gk/draw_loot.asm +++ b/gk/draw_loot.asm @@ -1,4 +1,5 @@ RedrawLoot: + SEP #$20 JSL DrawLoot ; what we wrote over @@ -32,6 +33,9 @@ DrawLoot: LDA.l DRMode BNE .skip + LDA.l MapItems_enabled + BEQ .skip + REP #$30 PHX : PHY @@ -125,7 +129,7 @@ DrawSingleFloorLoot: LDA.w #$0000 BRA + .valid_room - JSL CheckLoot + JSL CheckMapLoot + ASL A : ASL A : ASL A diff --git a/gk/dungeon_indicator.asm b/gk/dungeon_indicator.asm new file mode 100644 index 0000000..625650b --- /dev/null +++ b/gk/dungeon_indicator.asm @@ -0,0 +1,59 @@ +LoadDungeonIndicator: + ; what we wrote over + JSL InitializeTilesets + + LDA.w DungeonID + CMP.b #DungeonIndicatorMap_end-DungeonIndicatorMap : BCS .done + TAX + + ; mark dungeon as entered + REP #$20 + LDA.w DungeonMask, X + ORA.l DungeonVisited + STA.l DungeonVisited + SEP #$20 + + ; load indicator + LDA.l DungeonIndicatorMap, X + TAX + + LDA.b #$80 + STA.w $2115 + + REP #$20 + LDA.w #$7140 + STA.w $2116 + + LDY.b #$10 + +- LDA.l DungeonIndicatorGfx, X + STA.w $2118 + INX #2 + DEY #2 + BNE - + + SEP #$20 +.done + RTL + +DungeonIndicatorMap: +dw $0000 +dw $0000 +dw $0010 +dw $0020 +dw $0040 +dw $0060 +dw $0050 +dw $00A0 +dw $0070 +dw $0090 +dw $0030 +dw $0080 +dw $00B0 +dw $00C0 +.end + +DungeonIndicatorGfx: + incbin "menu/dr_dungeon_indicators.2bpp" +.end + diff --git a/gk/dungeon_maps.asm b/gk/dungeon_maps.asm index 1dba340..54731ac 100644 --- a/gk/dungeon_maps.asm +++ b/gk/dungeon_maps.asm @@ -34,6 +34,7 @@ incsrc map_bg3.asm incsrc dungeon_switch.asm incsrc draw_loot.asm incsrc check_loot.asm +incsrc loot_hud.asm incsrc blink_loot.asm incsrc data/doors_display.asm incsrc data/spiral_stairs.asm diff --git a/gk/dungeon_switch.asm b/gk/dungeon_switch.asm index 717bc4c..c9e12ad 100644 --- a/gk/dungeon_switch.asm +++ b/gk/dungeon_switch.asm @@ -42,6 +42,8 @@ CheckSwitchMap: BRA .doors_done .change_dungeon + LDA.l MapSwapping + BEQ .doors_done JSL DoorsMapChangeDungeon BRA .doors_done @@ -59,10 +61,14 @@ CheckSwitchMap: .not_fancy_door_map SEP #$20 + LDA.l MapSwapping + BEQ .no_swap + LDA.b $F6 AND.b #$30 - BNE + + BNE .do_swap +.no_swap ; what we wrote over REP #$20 LDA.w DungeonMapFloorCountData, X @@ -70,15 +76,20 @@ CheckSwitchMap: CLC : ADC.b $00 RTL -+ PHA +.do_swap TXA +.try_next ASL A TAX - PLA + LDA.b $F6 BIT.b #$20 BNE + INX -+ LDA.l DungeonMapData.prev, X ++ + + LDA.l DungeonMapData.prev, X + JSL IsValidDungeonToSwapTo + BCC .try_next STA.w DungeonID LDA.b #$04 @@ -87,6 +98,58 @@ CheckSwitchMap: LDA.w #$0000 RTL +; in A = dungeon ID to check +; out C - CC = not valid, CS = valid +IsValidDungeonToSwapTo: + CMP.l CachedDungeonID ; dungeon we're in is always valid + BNE + + SEC + RTL ++ + + PHP + REP #$20 + PHX : PHA + TAX + + LDA.l MapSwapping + BIT.w #$0080 + BNE .yes + + BIT.w #$0001 + BEQ + + ; check visited flag + LDA.l SwapMasks, X + AND.l DungeonVisited + BNE .yes ++ + + LDA.l MapSwapping : BIT.w #$0002 + BEQ + + ; check map flag + LDA.l SwapMasks, X + AND.l MapField + BNE .yes ++ + +.no + PLA : PLX + PLP + CLC + RTL + +.yes + PLA : PLX + PLP + SEC + RTL + +SwapMasks: + dw $C000, $C000, $2000, $1000 + dw $0800, $0400, $0200, $0100 + dw $0080, $0040, $0020, $0010 + dw $0008, $0004, $0002, $0001 + DungeonMapSwitch_Submodule: JSL $80893D JSL $80833F @@ -224,39 +287,32 @@ DrawDungeonLabel: CLC : ADC.w #$0008 TAY + LDA.l MapSwapping + BEQ + ; L/R switch indicators - LDA.w #$E310 + LDA.w #$E360 STA.w GFXStripes+$02, Y - LDA.w #$E910 + LDA.w #$E960 STA.w GFXStripes+$0A, Y - LDA.w #$E318 - STA.w GFXStripes+$12, Y - LDA.w #$E918 - STA.w GFXStripes+$1A, Y LDA.w #$0300 STA.w GFXStripes+$04, Y STA.w GFXStripes+$0C, Y - STA.w GFXStripes+$14, Y - STA.w GFXStripes+$1C, Y - LDA.w #$49AF + LDA.w #$65BF STA.w GFXStripes+$06, Y - STA.w GFXStripes+$16, Y - LDA.w #$099E + LDA.w #$25BD STA.w GFXStripes+$08, Y - STA.w GFXStripes+$18, Y - LDA.w #$099F + LDA.w #$25BE STA.w GFXStripes+$0E, Y - STA.w GFXStripes+$1E, Y - LDA.w #$09AF + LDA.w #$25BF STA.w GFXStripes+$10, Y - STA.w GFXStripes+$20, Y TYA - CLC : ADC.w #$0020 + CLC : ADC.w #$0010 TAY ++ LDA.l DRMode BNE .doors diff --git a/gk/loot_hud.asm b/gk/loot_hud.asm new file mode 100644 index 0000000..f61e838 --- /dev/null +++ b/gk/loot_hud.asm @@ -0,0 +1,101 @@ +pushpc +org $828C73 +JSL EnterRoom +NOP + +org $86C0AB +JSL CollectHeartPieceAndUpdate + +org $86D1A8 +JSL SetDeathFlagAndUpdate + +pullpc + +SetDeathFlagAndUpdate: + JSL UpdateLootHUD + JSL Sprite_ManuallySetDeathFlagUW + RTL + +CollectHeartPieceAndUpdate: + JSL $85F018 + JSL UpdateLootHUD + RTL + +ClearLootHUD: + LDA.b GameMode + CMP.b #$07 + BNE UpdateLootHUD +; + PHP + REP #$20 + LDA.w #!BlankTile : STA.w EnemyDropIndicator + PLP + RTL + +EnterRoom: + ; what we wrote over + STZ.w $0200 + STZ.b $B0 + +; fall into UpdateLootHUD + +UpdateLootHUD: + PHP + REP #$30 + PHX : PHY + SEP #$30 + + LDA.l HudItems_enabled : BEQ .setting_off + LDA.b IndoorsFlag : BEQ .done + + REP #$30 + LDA.b $00 : PHA + LDA.b $02 : PHA + LDA.b $04 : PHA + LDA.b $06 : PHA + LDA.b $08 : PHA + LDA.b $0E : PHA + + ; if if door rando, check for section of supertile + LDA.l DRMode + BNE + + + ; if not in door rando, check for section of supertile if we're not in a dungeon + LDA.w DungeonID + AND.w #$00FF + CMP.w #$00FF + BEQ + + + ; just load the room id, we don't care about sections + LDA.b RoomIndex + BRA .check + ++ ; figure out section before checking + JSL DetectLinksSection + INC A + XBA + ASL A : ASL A : ASL A : ASL A + ORA.b RoomIndex +.check + JSL CheckHudLoot + + ASL A : TAX + LDA.l HUDLootTypeIcons, X + STA.w EnemyDropIndicator + + PLA : STA.b $0E + PLA : STA.b $08 + PLA : STA.b $06 + PLA : STA.b $04 + PLA : STA.b $02 + PLA : STA.b $00 + BRA .done + +.setting_off + JSL SetupEnemyDropIndicator + +.done + REP #$30 + PLY : PLX + PLP + RTL diff --git a/gk/settings.asm b/gk/settings.asm index c2eb610..1898718 100644 --- a/gk/settings.asm +++ b/gk/settings.asm @@ -52,10 +52,10 @@ dw $2DCB, $6DCB, $ADCB, $EDCB ; 01 - unknown - dot dw $29EB, $69EB, $29FB, $69FB ; 02 - junk - pot dw $29CA, $69CA, $29DA, $29DB ; 03 - small key dw $29E9, $69E9, $29F9, $69F9 ; 04 - triforce piece -dw $29DD, $69DD, $A9DD, $E9DD ; 05 - safety - plus +dw $29DD, $69DD, $A9DD, $E9DD ; 05 - health - plus dw $29EC, $69EC, $29FC, $69FC ; 06 - less important item - small chest -dw $29CE, $29CF, $29DE, $29DF ; 07 - map -dw $29E8, $69E8, $29F8, $69F8 ; 08 - compass +dw $29E8, $69E8, $29F8, $69F8 ; 07 - compass +dw $29CE, $29CF, $29DE, $29DF ; 08 - map dw $29CA, $69CA, $29DA, $29DB ; 09 - small key dw $29C8, $69C8, $29D8, $29D9 ; 0A - big key dw $29ED, $69ED, $29FD, $69FD ; 0B - important inventory item - big chest @@ -73,29 +73,32 @@ warnpc $B9FA00 org $B9FA00 ; Room ID mappings to bit to check for presence and address of item drop MiscLocations: -dw $00C8 : db $04 : dl HeartContainer_ArmosKnights -dw $0033 : db $04 : dl HeartContainer_Lanmolas -dw $0007 : db $04 : dl HeartContainer_Moldorm +dw $10C8 : db $04 : dl HeartContainer_ArmosKnights +dw $1033 : db $04 : dl HeartContainer_Lanmolas +dw $1007 : db $04 : dl HeartContainer_Moldorm -dw $005A : db $04 : dl HeartContainer_HelmasaurKing -dw $0006 : db $04 : dl HeartContainer_Arrghus -dw $0029 : db $04 : dl HeartContainer_Mothula -dw $00AC : db $04 : dl HeartContainer_Blind -dw $00DE : db $04 : dl HeartContainer_Kholdstare -dw $0090 : db $04 : dl HeartContainer_Vitreous -dw $00A4 : db $04 : dl HeartContainer_Trinexx +dw $105A : db $04 : dl HeartContainer_HelmasaurKing +dw $1006 : db $04 : dl HeartContainer_Arrghus +dw $1029 : db $04 : dl HeartContainer_Mothula +dw $10AC : db $04 : dl HeartContainer_Blind +dw $10DE : db $04 : dl HeartContainer_Kholdstare +dw $1090 : db $04 : dl HeartContainer_Vitreous +dw $10A4 : db $04 : dl HeartContainer_Trinexx -dw $0073 : db $05 : dl BonkKey_Desert ; torch -dw $008C : db $05 : dl BonkKey_GTower ; torch -dw $0087 : db $05 : dl StandingKey_Hera +dw $1073 : db $05 : dl BonkKey_Desert ; torch +dw $108C : db $05 : dl BonkKey_GTower ; torch +dw $1087 : db $05 : dl StandingKey_Hera + +dw $10E1 : db $06 : dl HeartPiece_Forest_Thieves +dw $10E2 : db $06 : dl HeartPiece_Lumberjack_Tree +dw $10EA : db $05 : dl HeartPiece_Spectacle_Cave +dw $111B : db $06 : dl HeartPiece_Graveyard_Warp +dw $211B : db $05 : dl HeartPiece_Circle_Bushes +dw $111E : db $05 : dl RupeeNPC_NortheastDarkSwampCave +dw $1123 : db $05 : dl RupeeNPC_MoldormCave +dw $1126 : db $06 : dl HeartPiece_Mire_Warp +dw $1127 : db $05 : dl HeartPiece_Smith_Pegs -dw $FFFF : db $FF : dl $FFFFFF ; Placeholders -dw $FFFF : db $FF : dl $FFFFFF -dw $FFFF : db $FF : dl $FFFFFF ; Aga 1? ($0020) -dw $FFFF : db $FF : dl $FFFFFF ; Ice Armos? ($001C) -dw $FFFF : db $FF : dl $FFFFFF ; Lanmolas 2? ($0033) -dw $FFFF : db $FF : dl $FFFFFF ; Moldorm 2? ($004D) -dw $FFFF : db $FF : dl $FFFFFF ; Aga 2? ($000D) dw $FFFF warnpc $B9FA9A @@ -128,7 +131,7 @@ pad $B9FB00 ; $B9FB00 DungeonLabels: -dw $2550, $2579 ; Sewers +dw $25A4, $2579 ; Sewers dw $2564, $255F ; Hyrule Castle dw $2561, $256C ; Eastern Palace dw $2560, $256C ; Desert Palace @@ -146,6 +149,44 @@ dw $25A4, $25A4 ; Reserved dw $25A4, $25A4 ; Reserved ; $B9FB40 +HUDLootTypeIcons: +dw $287F ; 00 - nothing +dw $295C ; 01 - unknown - dot +dw $2954 ; 02 - junk - pot +dw $2950 ; 03 - small key +dw $2952 ; 04 - triforce piece +dw $2955 ; 05 - health - plus +dw $2953 ; 06 - less important item - small chest +dw $2D56 ; 07 - compass +dw $2957 ; 08 - map +dw $2950 ; 09 - small key +dw $2951 ; 0A - big key +dw $295A ; 0B - important inventory item - big chest +dw $2D58 ; 0C - pendant +dw $2D59 ; 0D - crystal +dw $2952 ; 0E - triforce piece +dw $295B ; 0F - triforce + +; $B9FB60 +NpcItems: +dw $10E3 : dl $7EF411 : db $80 ; Magic Bat +dw $1102 : dl $7EF410 : db $04 ; Sick Kid +dw $1105 : dl $7EF410 : db $10 ; Sahasrahla +dw $1109 : dl $7EF411 : db $20 ; Potion Shop +dw $1121 : dl $7EF411 : db $04 ; Blacksmith +dw $FFFF + +warnpc $B9FBA0 +padbyte $FF +pad $B9FBA0 + +; $B9FBA0 +; Currently these two are hard-coded checks +; but maybe that will change if more show up someday? +MiscLocations2: +dw $1055 : dw $7EF3C6 : db $01 : dl UncleItem +dw $2107 : dw $7EF410 : db $80 : dl LibraryItem +dw $FFFF warnpc $B9FE00 org $B9FE00 @@ -179,30 +220,53 @@ warnpc $B9FF08 org $B9FF08 ; $00 - do not show anything ; $01 - show presence of unobtained items -; $02 - show category of item -ShowItems: +; $02 - show compass if presence, otherwise presence of unobtained items +; $03 - show category of item +MapItems: .default db $00 .have_map db $00 .have_compass - db $02 + db $03 .visited_tile - db $01 + db $02 .reserved - skip 4 + skip 3 +.enabled + db $01 warnpc $B9FF10 org $B9FF10 -; ---P bepc +HudItems: +.cave + db $00 +.default_dungeon + db $00 +.have_map + db $01 +.have_compass + db $03 +.reserved + skip 3 +.enabled + db $01 +warnpc $B9FF18 + +org $B9FF20 +; ---P sepc ; P - dungeon prizes -; b - bosses (and torches in GT and desert, plus hera basement standing item) +; s - standing items (plus torches in GT and desert and bosses) ; e - enemy drops ; p - pots ; c - chests ItemSources: db $09 -; $B9FF11 -AlwaysShowCompass: - db $01 +; B9FF21 +; a--- --mv +; a - always +; m - have map +; v - have visited dungeon +MapSwapping: + db $01 ; NYI diff --git a/gk_meta.asm b/gk_meta.asm index d76c311..97d1e14 100644 --- a/gk_meta.asm +++ b/gk_meta.asm @@ -13,7 +13,8 @@ GKRomVersion: ; $01 = Dungeon Maps ; .., $01 = Dark rooms don't show on map from visition ; .., $02 = OW Fog and Grid modes -db $01, $02, $00 +; .., $03 = Loot level of current supertile in HUD +db $01, $03, $00 ;-------------------------------------------------------------------------------- ;================================================================================ diff --git a/hooks.asm b/hooks.asm index d191c87..bbf0251 100755 --- a/hooks.asm +++ b/hooks.asm @@ -1122,7 +1122,8 @@ JSL CompareBombsToMax : NOP #11 org $85FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F) JSL GiveBonkItem : NOP #5 org $85FC97 ; <- 2FC97 - sprite_dash_item.asm : 126 (LDA.b #$2F : JSL Sound_SetSfx3PanLong) -NOP #6 +JSL UpdateLootHUD +NOP #2 ;-------------------------------------------------------------------------------- org $868D39 ; <- 30D39 - sprite_prep.asm : 1435 - (LDA.b #$08 : STA $0F50, X) JSL LoadBonkItemGFX @@ -1649,7 +1650,8 @@ JSL FixAga2Bunny : NOP ; Open Mode Fixes ;-------------------------------------------------------------------------------- org $85DF65 ; <- 2DF65 - sprite_uncle_and_priest.asm:994 - (LDA.b #$01 : STA $7EF3C5) -NOP #6 +JSL UpdateLootHUD +NOP #2 ;-------------------------------------------------------------------------------- org $85EDDF ; <- 2EDDF - sprite_zelda.asm:398 - (LDA.b #$02 : STA $7EF3C5) JSL EndRainState : NOP #2 @@ -2777,6 +2779,23 @@ JSL MimicDirection org $828068 JSL AdjustDefaultGraphics +;================================================================================ +;-------------------------------------------------------------------------------- +; Remove Overwriting HUD gfx on game over +;-------------------------------------------------------------------------------- +org $809038 +RTS + +;================================================================================ +;-------------------------------------------------------------------------------- +; Dungeon Indicator VRAM overwrite +;-------------------------------------------------------------------------------- +org $828190 +JSL LoadDungeonIndicator + +org $829AA2 +JSL LoadDungeonIndicator + ;================================================================================ ; Special Weapons Modes ;-------------------------------------------------------------------------------- diff --git a/inventory.asm b/inventory.asm index c863bcb..20e2ec5 100644 --- a/inventory.asm +++ b/inventory.asm @@ -165,6 +165,7 @@ AddInventory: LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done REP #$30 LDA.l TotalItemCounter : INC : TAY + JSL UpdateLootHUD LDA.l BootsEquipment : AND.w #$00FF : BNE + TYA : STA.l PreBootsLocations + diff --git a/itemtext.asm b/itemtext.asm index dfe9530..a4b65b0 100644 --- a/itemtext.asm +++ b/itemtext.asm @@ -46,7 +46,7 @@ dw $7F7F ; Ganons Tower Notice_GTower: -db $76 : dw "Ganons Tower" +db $76 : dw "Ganon's Tower" dw $7F7F ; Turtle Rock @@ -81,7 +81,7 @@ dw $7F7F ; Dark Palace Notice_PoD: -db $76 : dw "Dark Palace" +db $76 : dw "Palace of Darkness" dw $7F7F ; Swamp Palace diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 7a2cbc8..ec3a235 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -221,7 +221,8 @@ RevealPotItem: STZ.w SpawnedItemIsMultiWorld BIT.b Scrap08 BVS LoadMultiWorldPotItem - BMI LoadMajorPotItem + BPL .normal_secret + JMP LoadMajorPotItem .normal_secret STA.b Scrap08 @@ -242,6 +243,7 @@ RevealPotItem: ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now + REP #$10 LDA.l TotalItemCounter : INC : STA.l TotalItemCounter ; Increment Item Total + JSL UpdateLootHUD LDA.w #$0001 : STA.l UpdateHUDFlag .obtained PLY : PLX @@ -341,6 +343,7 @@ IncrementCountsForSubstitute: ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now + LDA.l TotalItemCounter : INC : STA.l TotalItemCounter ; Increment Item Total + JSL UpdateLootHUD LDA.w #$0001 : STA.l UpdateHUDFlag .obtained SEP #$30 : PLX @@ -357,7 +360,7 @@ ClearSpriteData: STZ.w SprSourceItemId, X : STZ.w SprItemReceipt, X : STZ.w SprItemMWPlayer, X STZ.w SprRedrawFlag, X DEX : BPL .loop - JSR SetupEnemyDropIndicator + JSL ClearLootHUD PLX RTL @@ -404,7 +407,7 @@ SetupEnemyDropIndicator: .done SEP #$20 -RTS +RTL ; Runs during sprite load of the room @@ -571,7 +574,7 @@ IncrementCountForMinor: LDA.l SpriteDropData, X : BIT.b Scrap0A : BNE .obtained ORA.b Scrap0A : STA.l SpriteDropData, X SEP #$10 - JSR SetupEnemyDropIndicator + JSL UpdateLootHUD REP #$20 LDX.w DungeonID : CPX.b #$FF : BEQ + CPX.b #$00 : BNE ++ @@ -627,10 +630,10 @@ MarkSRAMForItem: TYX 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.l RoomPotData, X : ORA.b Scrap00 : STA.l RoomPotData, X .end + JSL UpdateLootHUD SEP #$30 : PLY : PLX LDA.w RoomItemsTaken RTL diff --git a/menu/door_connectors.3bpp b/menu/door_connectors.3bpp index fc84b8e..a80982c 100644 Binary files a/menu/door_connectors.3bpp and b/menu/door_connectors.3bpp differ diff --git a/menu/door_connectors.3bppc b/menu/door_connectors.3bppc index 22666d3..7eac99f 100644 Binary files a/menu/door_connectors.3bppc and b/menu/door_connectors.3bppc differ diff --git a/menu/dr_dungeon_indicators.2bpp b/menu/dr_dungeon_indicators.2bpp new file mode 100644 index 0000000..fb049a0 Binary files /dev/null and b/menu/dr_dungeon_indicators.2bpp differ diff --git a/menu/dr_sheet_dc.2bpp b/menu/dr_sheet_dc.2bpp index 3f3e2c3..2fbc08a 100644 Binary files a/menu/dr_sheet_dc.2bpp and b/menu/dr_sheet_dc.2bpp differ diff --git a/menu/dr_sheet_dc.2bppc b/menu/dr_sheet_dc.2bppc index 05907aa..55c9d18 100644 Binary files a/menu/dr_sheet_dc.2bppc and b/menu/dr_sheet_dc.2bppc differ diff --git a/menu/drfont.2bpp b/menu/drfont.2bpp index 4e8e30e..5c209ae 100644 Binary files a/menu/drfont.2bpp and b/menu/drfont.2bpp differ diff --git a/menu/hudalpha.asm b/menu/hudalpha.asm index 22fcfc8..1496ae1 100644 --- a/menu/hudalpha.asm +++ b/menu/hudalpha.asm @@ -9,7 +9,7 @@ UploadMenuOnlyIcons: REP #$20 LDA.w #MenuOnlyIcons : STA.w $4342 LDA.w #$1801 : STA.w $4340 - LDA.w #$0240 : STA.w $4345 + LDA.w #$0400 : STA.w $4345 LDA.w #$0F800>>1 : STA.w $2116 SEP #$20 @@ -20,4 +20,4 @@ UploadMenuOnlyIcons: RTL MenuOnlyIcons: -incbin "drfont.2bpp" \ No newline at end of file +incbin "drfont.2bpp" diff --git a/multiworld.asm b/multiworld.asm index 1367777..c58a4dc 100644 --- a/multiworld.asm +++ b/multiworld.asm @@ -126,6 +126,11 @@ GetMultiworldItem: BRL .return + + LDA.b LinkPushDirection + BEQ + + BRL .return + + + LDA.l ShieldEquipment : BNE + LDA.l PikitItem : CMP.b #$04 : BEQ + diff --git a/newhud.asm b/newhud.asm index 0db99c9..e669ef8 100644 --- a/newhud.asm +++ b/newhud.asm @@ -309,16 +309,16 @@ MagicMeterColorMasks: ;================================================================================ PrizeIconTiles_Transparent: dw $0000 ; no icon -dw $2978 ; crystal 1 -dw $2979 ; crystal 2 -dw $297A ; crystal 3 -dw $297B ; crystal 4 -dw $297C ; crystal 5 -dw $297D ; crystal 6 -dw $297E ; crystal 7 -dw $2963 ; green pendant -dw $295E ; blue pendant -dw $296E ; red pendant +dw $2891 ; crystal 1 +dw $2892 ; crystal 2 +dw $2893 ; crystal 3 +dw $2894 ; crystal 4 +dw $2895 ; crystal 5 +dw $2896 ; crystal 6 +dw $2897 ; crystal 7 +dw $2935 ; green pendant +dw $2936 ; blue pendant +dw $2937 ; red pendant ;================================================================================ DrawCompassCounts: @@ -386,6 +386,7 @@ RTS ;================================================================================ DrawMapCounts: LDA.l MapHUDMode : BEQ .done + LDA.l GenericKeys : BNE .done ; generator don't have an accurrate count of key doors in this case ; no map needed if this bit is set BIT.b #$02 : BNE .draw_map_count diff --git a/newitems.asm b/newitems.asm index 4fa0990..6833ee3 100755 --- a/newitems.asm +++ b/newitems.asm @@ -155,8 +155,8 @@ AddReceivedItemExpandedGetItem: PHA : LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ + PLA : BRA .done + PLA - JSR ItemBehavior - SEP #$30 + JSR ItemBehavior + SEP #$30 .done PLB : PLX LDA.w ItemReceiptMethod : CMP.b #$01 ; thing we wrote over @@ -229,13 +229,13 @@ ItemBehavior: JSR .increment_sword RTS - .fighter_shield + .fighter_shield .red_shield .mirror_shield SEP #$10 LDA.l ProgressiveFlag : BEQ + - LDA.l HighestShield : INC : TAX - JSR .increment_shield + LDA.l HighestShield : INC : TAX + JSR .increment_shield + RTS .blue_mail @@ -269,7 +269,7 @@ ItemBehavior: .prog_shield SEP #$10 LDA.l HighestShield : INC : TAX - JSR .increment_shield + JSR .increment_shield REP #$10 RTS @@ -282,13 +282,13 @@ ItemBehavior: .bow BIT.b #$40 : BNE .silversbow - LDA.b #$01 : STA.l BowEquipment + LDA.b #$01 : STA.l BowEquipment RTS .silversbow LDA.l BowTracking : ORA.b #$40 : STA.l BowTracking LDA.l SilverArrowsUseRestriction : BNE + - LDA.b #03 : STA.l BowEquipment ; set bow to silver + LDA.b #03 : STA.l BowEquipment ; set bow to silver + LDA.b #$01 : STA.l BowEquipment RTS @@ -331,16 +331,16 @@ ItemBehavior: .bow_and_arrows LDA.l BowTracking : BIT.b #$40 : BEQ .no_silvers LDA.l SilverArrowsUseRestriction : BNE .no_silvers - LDA.l CurrentArrows : BEQ + - LDA.b #04 : STA.l BowEquipment - BRA .store_bow - + - LDA.b #$03 + LDA.l CurrentArrows : BEQ + + LDA.b #04 : STA.l BowEquipment BRA .store_bow + + + LDA.b #$03 + BRA .store_bow .no_silvers LDA.l CurrentArrows : BEQ + - LDA.b #02 - BRA .store_bow + LDA.b #02 + BRA .store_bow + LDA.b #$01 .store_bow @@ -350,13 +350,13 @@ ItemBehavior: .silver_bow LDA.b #$40 : ORA.l BowTracking : STA.l BowTracking LDA.l SilverArrowsUseRestriction : BNE .noequip - LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ .noequip - LDA.l CurrentArrows : BNE + ; check arrows - LDA.b #$03 : BRA ++ ; bow without arrow - + - LDA.b #$04 ; bow with arrow - ++ - STA.l BowEquipment + LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ .noequip + LDA.l CurrentArrows : BNE + ; check arrows + LDA.b #$03 : BRA ++ ; bow without arrow + + + LDA.b #$04 ; bow with arrow + ++ + STA.l BowEquipment .noequip RTS @@ -385,7 +385,7 @@ ItemBehavior: .master_sword_safe SEP #$10 LDA.l SwordEquipment : CMP.b #$02 : !BGE + ; skip if we have a better sword - LDA.b #$02 : STA.l SwordEquipment ; set master sword + LDA.b #$02 : STA.l SwordEquipment ; set master sword + LDX.b #$02 JSR .increment_sword @@ -426,20 +426,20 @@ ItemBehavior: .silver_arrows LDA.l BowTracking : ORA.b #$40 : STA.l BowTracking LDA.l SilverArrowsUseRestriction : BNE ++ - LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ ++ - LDA.l BowEquipment : BEQ ++ : CMP.b #$03 : !BGE + - !ADD.b #$02 : STA.l BowEquipment ; switch to silver bow - + - ++ + LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ ++ + LDA.l BowEquipment : BEQ ++ : CMP.b #$03 : !BGE + + !ADD.b #$02 : STA.l BowEquipment ; switch to silver bow + + + ++ LDA.l ArrowMode : BEQ + - LDA.b #$01 : STA.l ArrowsFiller + LDA.b #$01 : STA.l ArrowsFiller + RTS .single_arrow LDA.l ArrowMode : BEQ + - LDA.l CurrentArrows : INC : STA.l CurrentArrows ; Should be sole write to this address - LDA.b #$01 : STA.l UpdateHUDFlag ; in retro/rupee bow mode. + LDA.l CurrentArrows : INC : STA.l CurrentArrows ; Should be sole write to this address + LDA.b #$01 : STA.l UpdateHUDFlag ; in retro/rupee bow mode. + RTS @@ -474,7 +474,7 @@ ItemBehavior: .triforce LDA.b OverworldIndex : CMP.b #$80 : BNE + LDA.b LinkPosX+1 : BNE + - JSL ActivateGoal + JSL ActivateGoal + RTS @@ -484,10 +484,10 @@ ItemBehavior: LDA.l GoalCounter : INC : STA.l GoalCounter CMP.w GoalItemRequirement : BCC + LDA.l TurnInGoalItems : AND.w #$00FF : BNE + - SEP #$20 ; set 8-bit accumulator - LDA.b OverworldIndex : CMP.b #$80 : BNE + - LDA.b LinkPosX+1 : BNE + - JSL ActivateGoal + SEP #$20 ; set 8-bit accumulator + LDA.b OverworldIndex : CMP.b #$80 : BNE + + LDA.b LinkPosX+1 : BNE + + JSL ActivateGoal + SEP #$20 ; set 8-bit accumulator RTS @@ -559,8 +559,8 @@ ItemBehavior: LSR AND.w #$000F : TAX ASL : CMP.w DungeonID : BEQ .same_dungeon - LDA.l DungeonKeys,X : INC : STA.l DungeonKeys,X - RTS + LDA.l DungeonKeys,X : INC : STA.l DungeonKeys,X + RTS .same_dungeon SEP #$20 LDA.l CurrentSmallKeys : INC : STA.l CurrentSmallKeys : STA.l DungeonKeys,X @@ -575,69 +575,69 @@ ItemBehavior: .hc_smallkey LDA.w DungeonID : CMP.b #$03 : BCC .same_dungeon_hc - LDA.l HyruleCastleKeys : INC : STA.l HyruleCastleKeys - LDA.l SewerKeys : INC : STA.l SewerKeys - RTS + LDA.l HyruleCastleKeys : INC : STA.l HyruleCastleKeys + LDA.l SewerKeys : INC : STA.l SewerKeys + RTS .generic_smallkey LDA.l GenericKeys : BEQ .normal - LDA.l CurrentSmallKeys : INC - STA.l CurrentGenericKeys : STA.l CurrentSmallKeys - RTS + LDA.l CurrentSmallKeys : INC + STA.l CurrentGenericKeys : STA.l CurrentSmallKeys + RTS .normal LDA.w DungeonID : BMI + - LDA.l CurrentSmallKeys : INC : STA.l CurrentSmallKeys - RTS + LDA.l CurrentSmallKeys : INC : STA.l CurrentSmallKeys + RTS + RTS .increment_sword LDA.l HighestSword INC : STA.b Scrap04 : CPX.b Scrap04 : BCC + ; don't increment unless we're getting a better sword - TXA : STA.l HighestSword + TXA : STA.l HighestSword + RTS .increment_shield LDA.l HighestShield INC : STA.b Scrap04 : CPX.b Scrap04 : BCC + ; don't increment unless we're getting a better shield - TXA : STA.l HighestShield + TXA : STA.l HighestShield + RTS .increment_mail LDA.l HighestMail INC : STA.b Scrap04 : CPX.b Scrap04 : BCC + ; don't increment unless we're getting a better mail - TXA : STA.l HighestMail + TXA : STA.l HighestMail + RTS .increment_bigkey SEP #$20 LDA.l StatsLocked : BNE + - LDA.l BigKeysBigChests - CLC : ADC.b #$10 - STA.l BigKeysBigChests + LDA.l BigKeysBigChests + CLC : ADC.b #$10 + STA.l BigKeysBigChests + RTS .increment_map SEP #$20 LDA.l StatsLocked : BNE + - LDA.l MapsCompasses - CLC : ADC.b #$10 - STA.l MapsCompasses - JSL MaybeFlagMapTotalPickup + LDA.l MapsCompasses + CLC : ADC.b #$10 + STA.l MapsCompasses + JSL MaybeFlagMapTotalPickup + RTS .increment_compass SEP #$20 LDA.l StatsLocked : BNE + - LDA.l MapsCompasses : INC : AND.b #$0F : TAX - LDA.l MapsCompasses : AND.b #$F0 : STA.l MapsCompasses - TXA : ORA.l MapsCompasses : STA.l MapsCompasses - JSL MaybeFlagCompassTotalPickup + LDA.l MapsCompasses : INC : AND.b #$0F : TAX + LDA.l MapsCompasses : AND.b #$F0 : STA.l MapsCompasses + TXA : ORA.l MapsCompasses : STA.l MapsCompasses + JSL MaybeFlagCompassTotalPickup + RTS @@ -647,7 +647,7 @@ ItemBehavior: SEC : SBC.b #$37 TAX LDA.w PendantMasks,X : AND.l PendantsField : BNE + - LDA.l PendantCounter : INC : STA.l PendantCounter + LDA.l PendantCounter : INC : STA.l PendantCounter + RTS @@ -663,15 +663,15 @@ ItemBehavior: LDA.w #$0000 SEC - - ROL - DEX + ROL + DEX BPL - SEP #$20 TAX AND.l CrystalsField : BNE + - TXA - ORA.l CrystalsField : STA.l CrystalsField - LDA.l CrystalCounter : INC : STA.l CrystalCounter + TXA + ORA.l CrystalsField : STA.l CrystalsField + LDA.l CrystalCounter : INC : STA.l CrystalCounter + .done RTS @@ -682,56 +682,56 @@ ItemBehavior: .bee_trap SEP #$30 LDA.b #$79 : JSL Sprite_SpawnDynamically : BMI + ; DashBeeHive_SpawnBee - 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 + 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 .good_bee SEP #$30 LDA.b #$79 : JSL Sprite_SpawnDynamically : BMI + ; DashBeeHive_SpawnBee - 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 - JSL GoldBee_SpawnSelf_SetProperties + 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 + JSL GoldBee_SpawnSelf_SetProperties + RTS .apples SEP #$30 LDA.b #$AC : JSL Sprite_SpawnDynamically : BMI + - 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 + 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 .fairy SEP #$30 LDA.b #$E3 : JSL Sprite_SpawnDynamically : BMI + - 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 + 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.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 + 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 @@ -804,7 +804,7 @@ ResolveLootID: CMP.l ProgressiveSwordLimit : BCC + LDA.l ProgressiveSwordReplacement JMP .get_item - ++ LDA.l SwordEquipment + ++ LDA.l SwordEquipment + TAX LDA.w .prog_sword_ids,X @@ -820,7 +820,7 @@ ResolveLootID: CMP.l ProgressiveShieldLimit : BCC + LDA.l ProgressiveShieldReplacement JMP .get_item - ++ LDA.l HighestShield + ++ LDA.l HighestShield + TAX LDA.w .shields_ids,X @@ -836,7 +836,7 @@ ResolveLootID: LDA.l ProgressiveArmorReplacement JMP .get_item + - ++ LDA.l ArmorEquipment + ++ LDA.l ArmorEquipment TAX LDA.w .armor_ids,X JMP .have_item diff --git a/npcitems.asm b/npcitems.asm index 791108d..18105a8 100644 --- a/npcitems.asm +++ b/npcitems.asm @@ -90,11 +90,17 @@ ItemSet_FairySword: RTL ItemSet_SmithSword: - PHA : LDA.l NpcFlags+1 : ORA.b #$04 : STA.l NpcFlags+1 : PLA + PHA + LDA.l NpcFlags+1 : ORA.b #$04 : STA.l NpcFlags+1 + JSL UpdateLootHUD + PLA RTL ItemSet_MagicBat: - PHA : LDA.l NpcFlags+1 : ORA.b #$80 : STA.l NpcFlags+1 : PLA + PHA + LDA.l NpcFlags+1 : ORA.b #$80 : STA.l NpcFlags+1 + JSL UpdateLootHUD + PLA RTL ItemSet_OldMan: @@ -125,6 +131,7 @@ ItemSet_SickKid: JSL Link_ReceiveItem ; thing we wrote over PHA LDA.l NpcFlags : ORA.b #$04 : STA.l NpcFlags + JSL UpdateLootHUD .skip PLA RTL @@ -153,6 +160,7 @@ ItemSet_Sahasrala: JSL Link_ReceiveItem ; thing we wrote over PHA LDA.l NpcFlags : ORA.b #$10 : STA.l NpcFlags + JSL UpdateLootHUD .skip PLA RTL @@ -171,6 +179,7 @@ ItemSet_Library: JSL Link_ReceiveItem ; thing we wrote over PHA LDA.l NpcFlags : ORA.b #$80 : STA.l NpcFlags + JSL UpdateLootHUD .skip PLA RTL @@ -197,7 +206,10 @@ ItemSet_Mushroom: RTL ItemSet_Powder: - PHA : LDA.l NpcFlags+1 : ORA.b #$20 : STA.l NpcFlags+1 : PLA + PHA + LDA.l NpcFlags+1 : ORA.b #$20 : STA.l NpcFlags+1 + JSL UpdateLootHUD + PLA RTL ;================================================================================ diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index 2b1cb66..3046606 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -291,10 +291,10 @@ RTL REP #$30 ;------------------------------------------------------------------------------- ; dungeon names - LDA.w #$2D50 + LDA.w #$2DA4 LDY.w #00 - .next_dungeon_name + .next_dungeon_name LDX.w .dungeon_positions,Y STA.w GFXStripes+$0646,X INC @@ -310,10 +310,10 @@ RTL STA.w GFXStripes+$0706,X DEX : DEX - BPL -- + BPL -- LDA.l HudFlag : AND.w #$0020 : BEQ + - JMP .maps_and_compasses + JMP .maps_and_compasses ;------------------------------------------------------------------------------- + LDA.l HUDDungeonItems : AND.w #$0001 : BNE + diff --git a/ram.asm b/ram.asm index ab7b9c4..d47d855 100644 --- a/ram.asm +++ b/ram.asm @@ -338,6 +338,7 @@ SpawnedItemFlag = $7E0726 ; 0x02 - one for pot, 2 for sprite drop SpawnedItemMWPlayer = $7E0728 ; Player Id for spawned item if Multiworld item 0x02 ; EnemyDropIndicator = $7E072A ; Used by HUD to indicate enemy drops remaining +NpcItemIndicator = $7E072C ; Flag used by HUD to indicate NPC item present SkipBeeTrapDisguise = $7E072D ; Flag to skip bee trap disguise during draw routine SprDropsItem = $7E0730 ; Array for whether a sprite drops an item 0x16 @@ -597,6 +598,8 @@ HUDMultiIndicator = $7EC790 ; HUDKeysObtained = $7EC7A2 ; HUDKeysSlash = $7EC7A4 ; HUDKeysTotal = $7EC7A6 ; +HUDKeysExtraPlus = $7EC7E4 ; +HUDKeysExtraCount = $7EC7E6 ; ; BigRAM = $7EC900 ; Big buffer of free ram (0x1F00) ItemGFXStack = $7ECB00 ; Pointers to source of decompressed item tiles deferred to NMI loading. diff --git a/shopkeeper.asm b/shopkeeper.asm index f30d04c..fee3dd4 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -433,9 +433,11 @@ Shopkeeper_BuyItem: CMP.b #$2E : BEQ .refill ; Red Potion Refill CMP.b #$2F : BEQ .refill ; Green Potion Refill CMP.b #$30 : BEQ .refill ; Blue Potion Refill - BRA + + CMP.b #$AF : BEQ .generic_key + BRA + .refill JSL Sprite_GetEmptyBottleIndex : BMI .full_bottles + .generic_key LDA.b #$01 : STA.l ShopkeeperRefill ; If this is on, don't toggle bit to remove from shop + diff --git a/sram.asm b/sram.asm index 802bdcc..ccd861a 100644 --- a/sram.asm +++ b/sram.asm @@ -241,7 +241,9 @@ CompassCountDisplay: skip 2 ; Compass count display flags (bitfield) ; High Byte: x c e d a s p m ; x = Sewers | c = Hyrule Castle | e = Eastern Palace | d = Desert Palace ; a = Castle Tower | s = Swamp Palace | p = PoD | m = Mire -skip 10 ; +DungeonVisited: skip 2 ; Whether each dungeon has been entered (bitfield) + ; same order of bits as CompassCountDisplay above +skip 8 ; Aga2Duck: skip 1 ; Used in lieu of pyramid hole for checking if the duck should come ; 0 = Haven't called post-Aga 2 bird | 1 = Have called post-Aga 2 bird NpcFlags: skip 2 ; l - c s t k z o (bitfield) @@ -307,7 +309,7 @@ HeartContainerCounter: skip 1 ; Total number of heart containers collected (in DeathCounter: skip 1 ; Number of deaths (integer) skip 1 ; Reserved FluteCounter: skip 1 ; Number of times fluted (integer) -skip 4 ; +MapFrames: skip 4 ; Total map time in frames (32-bit integer) RNGItem: skip 2 ; RNG Item SwordlessBossKills: skip 1 ; Number of bosses killed without a sword (integer) FaerieRevivalCounter: skip 1 ; Number of faerie revivals (integer) diff --git a/stats.asm b/stats.asm index fe8bab4..8b0dc3c 100644 --- a/stats.asm +++ b/stats.asm @@ -43,7 +43,7 @@ DungeonHoleWarpTransition: BRA StatTransitionCounter DungeonHoleEntranceTransition: JSL EnableForceBlank - + LDA.l SilverArrowsAutoEquip : AND.b #$02 : BEQ + LDA.w EntranceIndex : CMP.b #$7B : BNE + ; skip unless falling to ganon's room LDA.l BowTracking : AND.b #$40 : BEQ + ; skip if we don't have silvers @@ -51,7 +51,7 @@ DungeonHoleEntranceTransition: CMP.b #$03 : !BGE + ; skip if the bow is already silver !ADD.b #$02 : STA.l BowEquipment ; increase bow to silver + - + BRA StatTransitionCounter DungeonStairsTransition: JSL Dungeon_SaveRoomQuadrantData @@ -95,27 +95,27 @@ IncrementSmallKeys: RTL ;-------------------------------------------------------------------------------- IncrementSmallKeysNoPrimary: - STA.l CurrentSmallKeys ; thing we wrote over, write small key count - PHX - LDA.l StatsLocked : BNE + - LDA.l SmallKeyCounter : INC : STA.l SmallKeyCounter - + - JSL UpdateKeys - LDA.b IndoorsFlag : BEQ + ; skip room check if outdoors - PHP : REP #$20 ; set 16-bit accumulator - LDA.b RoomIndex : CMP.w #$0087 : BNE ++ ; hera basement - LDA.b $A8 : AND.w #$0003 : CMP.w #$0002 : BNE ++ ; must be quadrant 2 - LDA.w SprDropsItem, X : AND.w #$00FF : BNE ++ ; must not be a standing item - PLP : PHY - LDY.b #$24 - JSL AddInventory - PLY : BRA + - ++ - PLP - + - LDA.b #$01 : STA.l UpdateHUDFlag - JSL HUD_RebuildLong - PLX + STA.l CurrentSmallKeys ; thing we wrote over, write small key count + PHX + LDA.l StatsLocked : BNE + + LDA.l SmallKeyCounter : INC : STA.l SmallKeyCounter + + + JSL UpdateKeys + LDA.b IndoorsFlag : BEQ + ; skip room check if outdoors + PHP : REP #$20 ; set 16-bit accumulator + LDA.b RoomIndex : CMP.w #$0087 : BNE ++ ; hera basement + LDA.b $A8 : AND.w #$0003 : CMP.w #$0002 : BNE ++ ; must be quadrant 2 + LDA.w SprDropsItem, X : AND.w #$00FF : BNE ++ ; must not be a standing item + PLP : PHY + LDY.b #$24 + JSL AddInventory + PLY : BRA + + ++ + PLP + + + LDA.b #$01 : STA.l UpdateHUDFlag + JSL HUD_RebuildLong + PLX RTL ;-------------------------------------------------------------------------------- DecrementSmallKeys: @@ -195,9 +195,9 @@ CountAllKey: ;-------------------------------------------------------------------------------- IncrementAgahnim2Sword: - PHA - JSL IncrementBossSword - PLA + PHA + JSL IncrementBossSword + PLA RTL ;-------------------------------------------------------------------------------- IncrementDeathCounter: @@ -246,22 +246,22 @@ RTL DecrementItemCounter: PHA LDA.l StatsLocked : BNE + - REP #$20 + REP #$20 LDA.l TotalItemCounter : DEC : STA.l TotalItemCounter - SEP #$20 + SEP #$20 + PLA RTL ;-------------------------------------------------------------------------------- IncrementBigChestCounter: - JSL Dungeon_SaveRoomQuadrantData ; thing we wrote over - PHA - LDA.l StatsLocked : BNE + - LDA.l BigKeysBigChests : INC : AND.b #$0F : TAX - LDA.l BigKeysBigChests : AND.b #$F0 : STA.l BigKeysBigChests - TXA : ORA.l BigKeysBigChests : STA.l BigKeysBigChests - + - PLA + JSL Dungeon_SaveRoomQuadrantData ; thing we wrote over + PHA + LDA.l StatsLocked : BNE + + LDA.l BigKeysBigChests : INC : AND.b #$0F : TAX + LDA.l BigKeysBigChests : AND.b #$F0 : STA.l BigKeysBigChests + TXA : ORA.l BigKeysBigChests : STA.l BigKeysBigChests + + + PLA RTL ;-------------------------------------------------------------------------------- IncrementDamageTakenCounter_Eight: @@ -345,8 +345,8 @@ IncrementUWMirror: RTL ;-------------------------------------------------------------------------------- IncrementSpentRupees: - DEC A : BPL .subtractRupees - LDA.w #$0000 : STA.l CurrentRupees + DEC A : BPL .subtractRupees + LDA.w #$0000 : STA.l CurrentRupees RTL .subtractRupees PHA : PHP @@ -362,18 +362,18 @@ IndoorTileTransitionCounter: JMP StatTransitionCounter ;-------------------------------------------------------------------------------- IndoorSubtileTransitionCounter: - ;JSL HeartPieceSetRedraw ; set redraw flag for items - STZ.w SomariaSwitchFlag ; stuff we wrote over - STZ.w SpriteRoomTag + ;JSL HeartPieceSetRedraw ; set redraw flag for items + STZ.w SomariaSwitchFlag ; stuff we wrote over + STZ.w SpriteRoomTag JMP StatTransitionCounter ;-------------------------------------------------------------------------------- StatsFinalPrep: PHA : PHX : PHP SEP #$30 ; set 8-bit accumulator and index registers - + LDA.l StatsLocked : BNE .ramPostOnly INC : STA.l StatsLocked - + JSL IncrementFinalSword LDA.l HighestMail : INC : STA.l HighestMail ; add green mail to mail count @@ -392,12 +392,12 @@ StatsFinalPrep: LDA.l RupeesSpent : !ADD.l DisplayRupees : STA.l RupeesCollected LDA.l RupeesSpent+1 : ADC.l DisplayRupees+1 : STA.l RupeesCollected+1 - REP #$20 + REP #$20 LDA.l TotalItemCounter : !SUB.l ChestsOpened : STA.l NonChestCounter .done PLP : PLX : PLA LDA.b #$19 : STA.b GameMode ; thing we wrote over, load triforce room - STZ.b GameSubMode - STZ.b SubSubModule + STZ.b GameSubMode + STZ.b SubSubModule RTL diff --git a/stats/credits.asm b/stats/credits.asm index 9c4120b..ce0430c 100755 --- a/stats/credits.asm +++ b/stats/credits.asm @@ -513,7 +513,7 @@ CreditsLineBlank: %blankline() %blankline() -%smallcredits("SPRITE DEVELOPMENT", "yellow") +%smallcredits("SPRITE DEVELOPMENT", "green") %blankline() @@ -534,7 +534,7 @@ CreditsLineBlank: %blankline() %blankline() -%smallcredits("YOUR SPRITE BY", "green") +%smallcredits("YOUR SPRITE BY", "yellow") %blankline() @@ -544,7 +544,7 @@ CreditsLineBlank: %blankline() %blankline() -%smallcredits("MSU SUPPORT", "yellow") +%smallcredits("MSU SUPPORT", "green") %blankline() @@ -553,7 +553,7 @@ CreditsLineBlank: %blankline() %blankline() -%smallcredits("PALETTE SHUFFLER", "green") +%smallcredits("PALETTE SHUFFLER", "yellow") %blankline() @@ -562,7 +562,7 @@ CreditsLineBlank: %blankline() %blankline() -%smallcredits("WEBSITE LOGO", "yellow") +%smallcredits("WEBSITE LOGO", "green") %blankline() @@ -755,18 +755,16 @@ endif %blankline() +%bigcreditsleft("TOTAL MAP TIME") + +%blankline() + %bigcreditsleft("TOTAL LAG TIME") %blankline() %bigcreditsleft("SHIELDS EATEN") -%blankline() - - -%blankline() -%blankline() - %blankline() %blankline() diff --git a/stats/fonttable.asm b/stats/fonttable.asm index 9c68676..a9c500f 100644 --- a/stats/fonttable.asm +++ b/stats/fonttable.asm @@ -265,4 +265,6 @@ dw $3D99 ; - ; $FB dw $0000 ; ; dw $0000 ; ; dw $0000 ; ; -dw $0000 ; ; + +; yellow dot +dw $2DFA ; ; FF diff --git a/stats/main.asm b/stats/main.asm index a413dbd..28c870f 100755 --- a/stats/main.asm +++ b/stats/main.asm @@ -25,8 +25,8 @@ PreparePointer: LDY.w #$0000 RTL -; Regular stat: XXXX X00L LLLL LLLL BBBB SSSS CCC- ---- ---- ---- AAAA AAAA AAAA AAAA AAAA AAAA -; Time stat: XXXX X01L LLLL LLLL ---- ---- ---- ---- ---- ---- AAAA AAAA AAAA AAAA AAAA AAAA +; Regular stat: XXXX X00L LLLL LLLL BBBB SSSS CCC- ---- ---- ---- AAAA AAAA AAAA AAAA AAAA AAAA +; Time stat: XXXX X01L LLLL LLLL ---- ---- ---- ---- ---- ---- AAAA AAAA AAAA AAAA AAAA AAAA ; End of data: 1111 1111 1111 1111 ; X X offset (measured in 8x8 tiles) @@ -174,7 +174,7 @@ FindLine: !FRAMES_PER_SECOND = 60 !FRAMES_PER_MINUTE = 60*60 !FRAMES_PER_HOUR = 60*60*60 -!MAX_FRAME_COUNT = 59*60+59*60+59*60+99 +!MAX_FRAME_COUNT = (99*60*60*60)+(59*60*60)+(59*60)+59 macro CountUnits(framesPerUnit, unitCounter) STZ.b @@ -196,7 +196,7 @@ endmacro !ColonOffset = $8A !PeriodOffset = $4D -BlankCreditsTile = $883D +BlankCreditsTile = $3D88 RenderCreditsStatCounter: PHB @@ -498,45 +498,45 @@ RenderLineNumber: RTS LoadCreditsTiles: - JSL CopyFontToVRAM ; What we wrote over + JSL CopyFontToVRAM ; What we wrote over - REP #$10 - LDA.b #$80 : STA.w VMAIN - LDA.b #$01 : STA.w DMAP0 - LDA.b #$18 : STA.w BBAD0 + REP #$10 + LDA.b #$80 : STA.w VMAIN + LDA.b #$01 : STA.w DMAP0 + LDA.b #$18 : STA.w BBAD0 - ; Item tiles - LDX.w #$8200 : STX.w VMADDL - LDA.b #FileSelectNewGraphics>>16 : STA.w A1B0 - LDX.w #FileSelectNewGraphics : STX.w A1T0L - LDX.w #$0C00 : STX.w DAS0L - LDA.b #$01 : STA.w DMAENABLE + ; Item tiles + LDX.w #$8200 : STX.w VMADDL + LDA.b #FileSelectNewGraphics>>16 : STA.w A1B0 + LDX.w #FileSelectNewGraphics : STX.w A1T0L + LDX.w #$0C00 : STX.w DAS0L + LDA.b #$01 : STA.w DMAENABLE - ; Small characters A-Z - LDX.w #$7F00 : STX.w VMADDL - LDA.b #SmallCharacters>>16 : STA.w A1B0 - LDX.w #SmallCharacters : STX.w A1T0L - LDX.w #$0200 : STX.w DAS0L - LDA.b #$01 : STA.w DMAENABLE + ; Small characters A-Z + LDX.w #$7F00 : STX.w VMADDL + LDA.b #SmallCharacters>>16 : STA.w A1B0 + LDX.w #SmallCharacters : STX.w A1T0L + LDX.w #$0200 : STX.w DAS0L + LDA.b #$01 : STA.w DMAENABLE - SEP #$10 + SEP #$10 RTL LoadOverworldCreditsTiles: - JSL CopyFontToVRAM ; What we wrote over - REP #$10 + JSL CopyFontToVRAM ; What we wrote over + REP #$10 - ; Small characters A-Z - LDA.b #$80 : STA.w VMAIN - LDA.b #$01 : STA.w DMAP0 - LDA.b #$18 : STA.w BBAD0 - LDA.b #SmallCharacters>>16 : STA.w A1B0 - LDX.w #SmallCharacters : STX.w A1T0L - LDX.w #$0200 : STX.w DAS0L - LDX.w #$7F00 : STX.w VMADDL - LDA.b #$01 : STA.w DMAENABLE + ; Small characters A-Z + LDA.b #$80 : STA.w VMAIN + LDA.b #$01 : STA.w DMAP0 + LDA.b #$18 : STA.w BBAD0 + LDA.b #SmallCharacters>>16 : STA.w A1B0 + LDX.w #SmallCharacters : STX.w A1T0L + LDX.w #$0200 : STX.w DAS0L + LDX.w #$7F00 : STX.w VMADDL + LDA.b #$01 : STA.w DMAENABLE - SEP #$10 + SEP #$10 RTL CheckFontTable: @@ -577,23 +577,23 @@ RTS ; Dialog Pointer Override ;-------------------------------------------------------------------------------- EndingSequenceTableOverride: - PHY - PHX - TYX - LDA.l EndingSequenceText, X - PLX - STA.w $1008, X - PLY + PHY + PHX + TYX + LDA.l EndingSequenceText, X + PLX + STA.w $1008, X + PLY RTL ;-------------------------------------------------------------------------------- EndingSequenceTableLookupOverride: - PHX : PHB - PHK : PLB - TYX - LDA.l EndingSequenceText, X : AND.w #$00FF - ASL - TAY - LDA.w FontTable,Y - PLB : PLX + PHX : PHB + PHK : PLB + TYX + LDA.l EndingSequenceText, X : AND.w #$00FF + ASL A + TAY + LDA.w FontTable,Y + PLB : PLX RTL ;-------------------------------------------------------------------------------- diff --git a/stats/statConfig.asm b/stats/statConfig.asm index 3ccc17a..ff2efe3 100755 --- a/stats/statConfig.asm +++ b/stats/statConfig.asm @@ -30,10 +30,12 @@ !FAERIE_REVIVALS_Y = 361 !TOTAL_MENU_TIME_X = 19 !TOTAL_MENU_TIME_Y = 364 +!TOTAL_MAP_TIME_X = 19 +!TOTAL_MAP_TIME_Y = 367 !TOTAL_LAG_TIME_X = 19 -!TOTAL_LAG_TIME_Y = 367 +!TOTAL_LAG_TIME_Y = 370 !PIKIT_FED_X = 26 -!PIKIT_FED_Y = 370 +!PIKIT_FED_Y = 373 !COLLECTION_RATE_X = 22 !COLLECTION_RATE_Y = 380 !TOTAL_TIME_X = 19 @@ -64,11 +66,11 @@ CreditsStats: %AddStat(SaveQuitCounter, 0, 0, 08, 2, !SAVE_AND_QUITS_X, !SAVE_AND_QUITS_Y) %AddStat(DeathCounter, 0, 0, 08, 2, !DEATHS_X, !DEATHS_Y) %AddStat(FaerieRevivalCounter, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_Y) -%AddStat(MenuFrames, 1, 8, 32, 4, !TOTAL_MENU_TIME_X, !TOTAL_MENU_TIME_Y) +%AddStat(MenuFrames, 1, 0, 32, 4, !TOTAL_MENU_TIME_X, !TOTAL_MENU_TIME_Y) +%AddStat(MapFrames, 1, 0, 32, 4, !TOTAL_MAP_TIME_X, !TOTAL_MAP_TIME_Y) %AddStat(LagTime, 1, 0, 32, 4, !TOTAL_LAG_TIME_X, !TOTAL_LAG_TIME_Y) %AddStat(PikitFed, 0, 0, 8, 3, !PIKIT_FED_X, !PIKIT_FED_Y) print "Collection Rate config: ", pc -; warnpc $A39864 %AddStat(TotalItemCounter, 0, 0, 16, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y) %AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y) diff --git a/tables.asm b/tables.asm index 4692f71..f0c2197 100644 --- a/tables.asm +++ b/tables.asm @@ -237,12 +237,8 @@ db $00 ;a - Infinite Arrows ;-------------------------------------------------------------------------------- org $B0804E ; PC 0x18004E -UncleRefill: +UncleRefill_deprecated: ; no longer used db $00 -;---- -mba -;m - Refill Magic -;b - Refill Bombs -;a - Refill Arrows ;-------------------------------------------------------------------------------- org $B0804F ; PC 0x18004F ByrnaInvulnerability: @@ -890,8 +886,8 @@ SilverArrowsAutoEquip: db $01 ; #$00 = Off - #$01 = Collection Time (Default) - #$02 = Entering Ganon - #$03 = Collection Time & Entering Ganon ;================================================================================ org $B08183 ; PC 0x180183 -FreeUncleItemAmount: -dw $12C ; 300 rupees (Default) +RainDeathRefillRupeeBow: +dw $012C ; 300 rupees (Default) ;-------------------------------------------------------------------------------- org $B08185 ; PC 0x180185 RainDeathRefillTable: @@ -1532,7 +1528,7 @@ db $19,$1A,$1B,$1C,$1D,$1E,$1F,$20 db $21,$22,$11,$11,$10,$16,$16,$16 db $16,$16,$11,$16,$16,$16,$15,$15 db $15,$15,$15,$15,$15,$15,$15,$15 -db $15,$15,$16,$02,$09,$00,$00,$00 +db $15,$15,$2E,$02,$09,$00,$00,$00 MusicShuffleTable: db $01,$02,$03,$04,$05,$06,$07,$08 @@ -2686,9 +2682,9 @@ org $B0EFFF ; PC 0x186FFF BallNChainDungeon: ; Dungeon ID where ball n chain guard is located. Write db $02 ; $FF to count ball and chain item for collection stats. -;-------------------------------------------------------------------------------- -; 0x187000 - 18700F (unused) -;-------------------------------------------------------------------------------- +org $B0F000 +ExtraChestKeys: ; PC 0x187000-0x18700F +db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 org $B0F010 ChestKeys: ; PC 0x187010-0x18701F diff --git a/vanillalabels.asm b/vanillalabels.asm index 63bb60c..b119aaa 100644 --- a/vanillalabels.asm +++ b/vanillalabels.asm @@ -294,6 +294,7 @@ EntranceData_song = $82D592 SpawnPointData_room_id = $82D8D2 Overworld_CheckForSpecialOverworldTrigger_Direction = $84E879 RoomHeaderPointers = $84F1E2 +UncleItem = $85DF45 Sprite_ShowSolicitedMessage_Direction = $85E1A3 FluteMenuNumbers_bits = $8AB7A3 WorldMap_RedXChars = $8ABF70 diff --git a/zelda.asm b/zelda.asm index 1d7c9fd..7e40205 100644 --- a/zelda.asm +++ b/zelda.asm @@ -1,10 +1,14 @@ ;-------------------------------------------------------------------------------- EndRainState: - LDA.l InitProgressIndicator : BIT.b #$80 : BNE + ; check for instant post-aga - LDA.b #$02 : STA.l ProgressIndicator - RTL + LDA.l InitProgressIndicator : BIT.b #$80 : BEQ + ; check for instant post-aga + LDA.l InitLumberjackOW : STA.l OverworldEventDataWRAM+$02 + LDA.b #$03 + BRA ++ + - LDA.b #$03 : STA.l ProgressIndicator - LDA.l InitLumberjackOW : STA.l OverworldEventDataWRAM+$02 + LDA.b #$02 + ++ + STA.l ProgressIndicator + + JSL SetEscapeAssist RTL ;--------------------------------------------------------------------------------