diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 4491366..9ef5c46 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -34,7 +34,7 @@ db $20, $19, $08, $31 ; year/month/day ;================================================================================ !ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers) -!ROM_VERSION_HIGH ?= 2 ; +!ROM_VERSION_HIGH ?= 3 ; org $80FFE0 ; Unused hardware vector RomVersion: @@ -71,7 +71,6 @@ incsrc lampmantlecone.asm incsrc floodgatesoftlock.asm incsrc heartpieces.asm incsrc npcitems.asm -incsrc hextodec.asm incsrc flipperkill.asm incsrc pendantcrystalhud.asm incsrc potions.asm @@ -157,7 +156,7 @@ incsrc toast.asm incsrc fastcredits.asm incsrc msu.asm incsrc dungeonmap.asm - +incsrc hextodec.asm if !FEATURE_NEW_TEXT incsrc textrenderer.asm endif @@ -268,7 +267,11 @@ endif org $B28000 Extra_Text_Table: -incsrc itemtext.asm +if !FEATURE_NEW_TEXT + incsrc itemtext_lower.asm +else + incsrc itemtext.asm +endif incsrc externalhooks.asm ;================================================================================ diff --git a/asar b/asar deleted file mode 100755 index 57d6409..0000000 Binary files a/asar and /dev/null differ diff --git a/bin/linux/asar b/bin/linux/asar new file mode 100755 index 0000000..a74f495 Binary files /dev/null and b/bin/linux/asar differ diff --git a/bin/macos/asar b/bin/macos/asar new file mode 100755 index 0000000..a5499b2 Binary files /dev/null and b/bin/macos/asar differ diff --git a/bin/windows/asar.exe b/bin/windows/asar.exe new file mode 100644 index 0000000..32f53cb Binary files /dev/null and b/bin/windows/asar.exe differ diff --git a/bugfixes.asm b/bugfixes.asm index 93c995a..f4c15dc 100644 --- a/bugfixes.asm +++ b/bugfixes.asm @@ -245,3 +245,10 @@ ParadoxCaveGfxFix: LDX.w #$00C0 : STX.w DAS0L BRA .uploadLine ;-------------------------------------------------------------------------------- +SetItemRiseTimer: + LDA.w ItemReceiptMethod : CMP #$01 : BNE .not_from_chest + LDA.b #$38 : STA.w AncillaTimer, X + RTL + .not_from_chest + TYA : STA.w AncillaTimer, X ; What we wrote over +RTL diff --git a/build.bat b/build.bat index 2d960e1..198e21e 100644 --- a/build.bat +++ b/build.bat @@ -1,4 +1,4 @@ del ..\working.sfc copy ..\alttp.sfc ..\working.sfc -xkas.exe LTTP_RND_GeneralBugfixes.asm ..\working.sfc -cmd /k \ No newline at end of file +%~dp0bin\windows\asar.exe LTTP_RND_GeneralBugfixes.asm ..\working.sfc +cmd /k diff --git a/build.sh b/build.sh index b45d9bb..ad48bc9 100755 --- a/build.sh +++ b/build.sh @@ -2,4 +2,4 @@ rm ../working.sfc cp ../alttp.sfc ../working.sfc -./asar LTTP_RND_GeneralBugfixes.asm ../working.sfc +./bin/macos/asar -DFEATURE_NEW_TEXT=1 LTTP_RND_GeneralBugfixes.asm ../working.sfc diff --git a/build_linux.sh b/build_linux.sh index 1b6c338..b8d596b 100755 --- a/build_linux.sh +++ b/build_linux.sh @@ -2,4 +2,4 @@ rm ../working.sfc cp ../alttp.sfc ../working.sfc -asar LTTP_RND_GeneralBugfixes.asm ../working.sfc +./bin/linux/asar -DFEATURE_NEW_TEXT=1 LTTP_RND_GeneralBugfixes.asm ../working.sfc diff --git a/data/99ff1_bombos.gfx b/data/99ff1_bombos.gfx old mode 100755 new mode 100644 diff --git a/data/99ff1_quake.gfx b/data/99ff1_quake.gfx old mode 100755 new mode 100644 diff --git a/data/a6fc4_bombos.gfx b/data/a6fc4_bombos.gfx old mode 100755 new mode 100644 diff --git a/data/a6fc4_ether.gfx b/data/a6fc4_ether.gfx old mode 100755 new mode 100644 diff --git a/data/c2807_v3.gfx b/data/c2807_v3.gfx old mode 100755 new mode 100644 diff --git a/data/newitems.gfx b/data/newitems.gfx old mode 100755 new mode 100644 diff --git a/data/output.txt b/data/output.txt deleted file mode 100644 index 2962db9..0000000 --- a/data/output.txt +++ /dev/null @@ -1,3 +0,0 @@ -llh@tinymagnet.com:~/DBMS/Run$ ./dbms -? -(Lena Hellstrom) bad option...should be "f" or "b" or "a" -llh@tinymagnet.com:~/DBMS/Run$ \ No newline at end of file diff --git a/data/text_unscramble1.bin b/data/text_unscramble1.bin index 532ec83..161009c 100644 Binary files a/data/text_unscramble1.bin and b/data/text_unscramble1.bin differ diff --git a/dungeonmap.asm b/dungeonmap.asm index 275c76a..7c4fff1 100644 --- a/dungeonmap.asm +++ b/dungeonmap.asm @@ -4,7 +4,6 @@ DoDungeonMapBossIcon: BEQ .dungeonmap .cave - CMP.b #$01 RTL .dungeonmap diff --git a/entrances.asm b/entrances.asm index c14a30b..6ae4e76 100644 --- a/entrances.asm +++ b/entrances.asm @@ -155,6 +155,7 @@ JML.l AllowStartFromExitReturn STZ.b SubSubModule STZ.w DeathReloadFlag STZ.w RespawnFlag + INC.w UpdateHUD JSL Equipment_SearchForEquippedItemLong JSL HUD_RebuildLong2 diff --git a/events.asm b/events.asm index 3809a55..d5bfee8 100644 --- a/events.asm +++ b/events.asm @@ -16,7 +16,8 @@ JML.l ReturnFromOnDrawHud ;-------------------------------------------------------------------------------- OnDungeonEntrance: STA.l PegColor ; thing we wrote over - JSL MaybeFlagCompassTotalEntrance + JSL MaybeFlagDungeonTotalsEntrance + INC.w UpdateHUD RTL ;-------------------------------------------------------------------------------- OnPlayerDead: @@ -28,18 +29,19 @@ OnPlayerDead: RTL ;-------------------------------------------------------------------------------- OnDungeonExit: - PHA : PHP - SEP #$20 ; set 8-bit accumulator - JSL.l SQEGFix - PLP : PLA + PHA : PHP + SEP #$20 ; set 8-bit accumulator + JSL.l SQEGFix + PLP : PLA - STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over + STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over - PHA : PHP - JSL.l HUD_RebuildLong - JSL.l FloodGateResetInner - JSL.l SetSilverBowMode - PLP : PLA + PHA : PHP + JSL.l HUD_RebuildLong + INC.w UpdateHUD + JSL.l FloodGateResetInner + JSL.l SetSilverBowMode + PLP : PLA RTL ;-------------------------------------------------------------------------------- OnQuit: @@ -77,6 +79,7 @@ RTL ;-------------------------------------------------------------------------------- OnAga2Defeated: JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first + LDA.b #$FF : STA.w DungeonID LDA.b #$01 : STA.l Aga2Duck JML.l IncrementAgahnim2Sword ;-------------------------------------------------------------------------------- @@ -108,9 +111,6 @@ OnFileCreation: JSL.l WriteSaveChecksumAndBackup_from_sram STZ.b Scrap00 STZ.b Scrap01 - LDX.b Scrap00 - LDY.w #$0000 - TYA JML.l InitializeSaveFile_checksum_done ;-------------------------------------------------------------------------------- @@ -196,12 +196,13 @@ OnLinkDamagedFromPitOutdoors: JML.l OHKOTimer ; make sure this is last ;-------------------------------------------------------------------------------- OnOWTransition: - JSL.l FloodGateReset - JSL.l StatTransitionCounter - PHP - SEP #$20 ; set 8-bit accumulator - LDA.b #$FF : STA.l RNGLockIn ; clear lock-in - PLP + JSL.l FloodGateReset + JSL.l StatTransitionCounter + PHP + SEP #$20 ; set 8-bit accumulator + LDA.b #$FF : STA.l RNGLockIn ; clear lock-in + INC.w UpdateHUD + PLP RTL ;-------------------------------------------------------------------------------- OnLoadDuckMap: @@ -223,19 +224,40 @@ PostItemGet: RTL ;-------------------------------------------------------------------------------- PostItemAnimation: - LDA.b #$00 : STA.l BusyItem ; mark item as finished + 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 + LDA.b #$00 : STA.l TextBoxDefer + + + LDA.w ItemReceiptMethod : CMP.b #$01 : BNE + + LDA.b LinkDirection : BEQ + + JSL.l IncrementChestTurnCounter + + + REP #$20 + LDA.w TransparencyFlag : BNE .SP05 + LDA.l PalettesCustom_off_black+$00 : STA.l PaletteBuffer+$0170 + LDA.l PalettesCustom_off_black+$02 : STA.l PaletteBuffer+$0172 + LDA.l PalettesCustom_off_black+$04 : STA.l PaletteBuffer+$0174 + LDA.l PalettesCustom_off_black+$06 : STA.l PaletteBuffer+$0176 + LDA.l PalettesCustom_off_black+$08 : STA.l PaletteBuffer+$0178 + LDA.l PalettesCustom_off_black+$0A : STA.l PaletteBuffer+$017A + LDA.l PalettesCustom_off_black+$0C : STA.l PaletteBuffer+$017C + LDA.l PalettesCustom_off_black+$0E : STA.l PaletteBuffer+$017E + BRA .done + .SP05 + LDA.l PalettesCustom_off_black+$00 : STA.l PaletteBuffer+$01B0 + LDA.l PalettesCustom_off_black+$02 : STA.l PaletteBuffer+$01B2 + LDA.l PalettesCustom_off_black+$04 : STA.l PaletteBuffer+$01B4 + LDA.l PalettesCustom_off_black+$06 : STA.l PaletteBuffer+$01B6 + LDA.l PalettesCustom_off_black+$08 : STA.l PaletteBuffer+$01B8 + LDA.l PalettesCustom_off_black+$0A : STA.l PaletteBuffer+$01BA + LDA.l PalettesCustom_off_black+$0C : STA.l PaletteBuffer+$01BC + LDA.l PalettesCustom_off_black+$0E : STA.l PaletteBuffer+$01BE + .done + INC.b NMICGRAM + SEP #$20 - LDA.l TextBoxDefer : BEQ + - STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer - JSL.l Main_ShowTextMessage_Alt - LDA.b #$00 : STA.l TextBoxDefer - + - - LDA.w ItemReceiptMethod : CMP.b #$01 : BNE + - LDA.b LinkDirection : BEQ + - JSL.l IncrementChestTurnCounter - + - - STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here + STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here RTL ;-------------------------------------------------------------------------------- diff --git a/fileselect.asm b/fileselect.asm index edca843..592cebb 100644 --- a/fileselect.asm +++ b/fileselect.asm @@ -130,7 +130,7 @@ DrawPlayerFile: STA.w GFXStripes+$0404 STA.w GFXStripes+$040A - LDA.w #$12BF + LDA.w #$0188 ; change back to 12BF to restore the border STA.w GFXStripes+$0406 ORA.w #$4000 STA.w GFXStripes+$040C @@ -156,11 +156,8 @@ DrawPlayerFile: .draw_access_icon STA.w GFXStripes+$0412 - LDA.w #$FFFF STA.w GFXStripes+$0414 - - BRA .done .normal STZ.w SkipOAM ; ensure core animated tile updates are not suppressed @@ -244,7 +241,7 @@ DrawPlayerFileShared: ++ ; Mushroom - LDA.l InventoryTrackingSRAM : AND.w #$0008 : BEQ + + LDA.l InventoryTrackingSRAM : AND.w #$0028 : BEQ + %fs_drawItem(3,18,FileSelectItems_mushroom) BRA ++ + @@ -372,7 +369,7 @@ DrawPlayerFileShared: %fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4) ++ - LDA.l EquipmentSRAM+$0108 : AND.w #$00FF + LDA.l EquipmentSRAM+$0130 : AND.w #$00FF JSL.l HexToDec LDA.l HexToDecDigit4 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02A0 : %fs_draw8x8(11,26) LDA.l HexToDecDigit5 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02A0 : %fs_draw8x8(11,27) diff --git a/goalitem.asm b/goalitem.asm index 50f62cd..799bf41 100644 --- a/goalitem.asm +++ b/goalitem.asm @@ -39,6 +39,8 @@ CheckGanonVulnerability: dw .crystals_and_bosses dw .bosses_only dw .all_dungeons_no_agahnim + dw .all_items + dw .completionist ; 00 = always vulnerable .vulnerable @@ -92,6 +94,21 @@ CheckGanonVulnerability: .bosses_only JMP CheckForCrystalBossesDefeated +; 09 = 100% item collection rate +.all_items + REP #$20 + LDA.l TotalItemCounter : CMP.l TotalItemCount + SEP #$20 + RTS + +; 0A = 100% item collection rate and all dungeons +.completionist + REP #$20 + LDA.l TotalItemCounter : CMP.l TotalItemCount + SEP #$20 + BCC .fail + BRA .all_dungeons + ;-------------------------------------------------------------------------------- GetRequiredCrystalsForTower: BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over diff --git a/hooks.asm b/hooks.asm old mode 100755 new mode 100644 index c81855c..154be0d --- a/hooks.asm +++ b/hooks.asm @@ -280,6 +280,7 @@ db $09 : SKIP 5 : db $09 : SKIP 1 : db $09 : SKIP 1 : db $09 : SKIP 1 : db $09 : db $09 : SKIP 1 : db $09 : SKIP 1 : db $09 : SKIP 1 : db $09 : SKIP 5 : db $05 ;-------------------------------------------------------------------------------- + ;================================================================================ ; Delete file Screen ;-------------------------------------------------------------------------------- @@ -382,7 +383,6 @@ STA.l StalfosBombDamage ;-------------------------------------------------------------------------------- org $8AB76E ; <- 5376E - Bank0A.asm : 30 (JSL OverworldMap_InitGfx) JSL OnLoadDuckMap -;-------------------------------------------------------------------------------- ;================================================================================ ; Infinite Bombs / Arrows / Magic @@ -908,6 +908,9 @@ LDA.w DungeonItemMasks, X org $898769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y) LDA.w ItemReceipts_graphics, Y +org $898811 +JSL.l SetItemRiseTimer + org $89884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y) LDA.w ItemReceipts_offset_y, Y org $89885B ; 4885B - ancilla_init.asm:1139 (LDA .x_offsets, X) - I think the disassembly is wrong here, should have been LDA .x_offsets, Y @@ -1119,8 +1122,15 @@ 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 $88D395 ; <- 45395 - ancilla_bird_travel_intro.asm : 253 -JSL UpgradeFlute : NOP #2 +JSL.l UpgradeFlute : NOP #2 ;-------------------------------------------------------------------------------- org $85E4D7 ; <- 2E4D7 - sprite_witch.asm : 213 JSL RemoveMushroom : NOP #2 @@ -1357,9 +1367,7 @@ JSL DrawMagicHeader BRA + : NOP #15 : + ;-------------------------------------------------------------------------------- org $8DFB29 ; <- headsup_display.asm : 688 (LDA.b #$86 : STA $7EC71E) -JSL DrawHUDArrows : BRA + - NOP #18 -+ +JSL DrawHUDArrows : BRA + : NOP #18 : + ;-------------------------------------------------------------------------------- org $81CF67 ; <- CF67 - Bank01.asm : 11625 (STA $7EF36F) JSL DecrementSmallKeys @@ -1375,6 +1383,23 @@ MVN $A17E ;-------------------------------------------------------------------------------- org $8DFB1F ; 6FB1F - headsup_display.asm : 681 (LDA $7EF340 : BEQ .hastNoBow) JSL CheckHUDSilverArrows +;-------------------------------------------------------------------------------- +org $8DF1AB +JSR.w RebuildHUD_update +org $8DDFC8 +JSR.w RebuildHUD_update +org $8DDB88 ; Don't rebuild HUD twice on icon refresh +NOP #3 ; Not sure why this is here +;-------------------------------------------------------------------------------- +org $87A205 +JSL.l RebuildHUD_update_long +org $8AEF62 +JSL.l RebuildHUD_update_long +;-------------------------------------------------------------------------------- +org $8DFFE1 +RebuildHUD_update_long: +JSR.w RebuildHUD_update : RTL +warnpc $8E8000 ;================================================================================ ; 300 Rupee NPC @@ -2467,12 +2492,17 @@ if !FEATURE_NEW_TEXT JSL RenderCharSetColorExtended_close : NOP endif +;================================================================================ +; VRAM +;-------------------------------------------------------------------------------- +org $008BE5 ; hijack stripes +JSL.l TransferVRAMStripes + ;=================================================================================================== ; Fix fairy palette on file select ;=================================================================================================== org $9BF029+1 : db $10 - ;=================================================================================================== ; Item decompression/loading ;=================================================================================================== diff --git a/init.asm b/init.asm index 8b5f56f..59fadbc 100644 --- a/init.asm +++ b/init.asm @@ -6,55 +6,52 @@ ;-------------------------------------------------------------------------------- Init_Primary: LDA.b #$00 - - LDX.b #$00 ; initalize our ram - - - STA.l $7EC025, X - STA.l $7F5000, X - INX - CPX.b #$10 : !BLT - - - LDX.b #$10 ; initalize more ram - - - STA.l $7F5000, X - INX - CPX.b #$FF : !BLT - - - LDX.b #$00 + LDX.b #$14 - LDA.l RomNameSRAM, X : CMP.w $FFC0, X : BNE .clear - INX - CPX.b #$15 : !BLT - + DEX + BPL - + REP #$30 + LDX.w #$00D9 ; initalize our ram + - + STA.l $7EC025, X + DEX #2 + BPL - + LDA.w #$0000 + LDX.w #$2FFE + - + STA.l $7F5000, X + DEX #2 + BPL - + BRA .done .clear - REP #$30 ; set 16-bit accumulator & index registers + REP #$30 LDA.w #$0000 + LDX.w #$1FFE - - STA.l $700000, X - INX - CPX.w #$2000 : !BLT - - SEP #$30 ; set 8-bit accumulator & index registers - LDX.b #$00 + STA.l CartridgeSRAM, X + STA.l SaveBackupSRAM, X + DEX #2 + BPL - + LDA.w RomVersion+$00 : STA.l RomVersionSRAM+$00 + LDA.w RomVersion+$02 : STA.l RomVersionSRAM+$02 + SEP #$30 + LDX.b #$14 - LDA.w $FFC0, X : STA.l RomNameSRAM, X - INX - CPX #$15 : !BLT - - LDX.b #$00 - - - LDA.w RomVersion, X : STA.l RomVersionSRAM, X - INX - CPX.b #$04 : !BLT - + DEX + BPL - .done REP #$20 LDA.l OneMindTimerInit : STA.l OneMindTimerRAM - SEP #$20 + SEP #$30 LDA.b #$01 : STA.w MEMSEL ; enable fastrom access on upper banks STA.l OneMindId LDA.b #$10 : STA.b PlayerSpriteBank ; set default player sprite bank - LDA.b #$81 : STA.w NMITIMEN ; thing we wrote over, turn on NMI & gamepad JML ReturnFromInit @@ -70,24 +67,35 @@ Init_PostRAMClear: JSL MSUInit JSL InitRNGPointerTable - JSR InitCompassTotalsRAM JSL DecompressAllItemGraphics - + JSR InitDungeonCounts JML $80D463 ; The original target of the jump table that we hijacked -;--------------------------------------------------------------------------------------------------- - -InitCompassTotalsRAM: - LDX.b #$0F - -.next - LDA.l CompassTotalsROM,X - STA.l CompassTotalsWRAM,X - - DEX - BPL .next - - RTS - ;=================================================================================================== +InitDungeonCounts: + PHB + LDX.b #$0F + - + LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X + DEX + BPL - + LDX.b #$0F + - + LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X + DEX + BPL - + + LDA.b #$7E + PHA : PLB + REP #$30 + LDA.l TotalItemCount + JSL.l HUDHex4Digit_Long + SEP #$20 + LDA.b Scrap04 : TAX : STX.w TotalItemCountTiles+$00 + LDA.b Scrap05 : TAX : STX.w TotalItemCountTiles+$02 + LDA.b Scrap06 : TAX : STX.w TotalItemCountTiles+$04 + LDA.b Scrap07 : TAX : STX.w TotalItemCountTiles+$06 + SEP #$10 + PLB +RTS diff --git a/initsramtable.asm b/initsramtable.asm index a507ca4..908ee85 100644 --- a/initsramtable.asm +++ b/initsramtable.asm @@ -131,9 +131,9 @@ InitFollowerDropped: skip 1 ; PC 0x1833D3 org $B0B3D9 ; PC 0x1833D9 - 0x1833F0 StaticFileName: ; The validity value ($55AA) must be written manually on SRAM init at $7003E1 -dw $0181, $0162, $0168, $018C -dw $0166, $014E, $0162, $018C -dw $0165, $0162, $0167, $018C +dw $0181, $0068, $006E, $018C +dw $0166, $0064, $0068, $018C +dw $0165, $0068, $006D, $018C org $B0B401 ; PC 0x183401 InitDeathCounter: diff --git a/inventory.asm b/inventory.asm index 3251e12..7c724d4 100644 --- a/inventory.asm +++ b/inventory.asm @@ -7,7 +7,7 @@ ;-------------------------------------------------------------------------------- ProcessMenuButtons: LDA.b Joy1A_New : BIT.b #$40 : BNE .y_pressed ; check for P1 Y-button - BIT #$20 : BNE .sel_pressed ; check for P1 Select button + BIT.b #$20 : BNE .sel_pressed ; check for P1 Select button LDA.b Joy1A_All : BIT.b #$20 : BNE .sel_held .sel_unheld LDA.l HudFlag : AND.b #$20 : BEQ + @@ -193,20 +193,19 @@ RTS DungeonIncrement: LDA.b IndoorsFlag : BEQ .count LDA.w DungeonID : CMP.b #$FF : BEQ .count - - CMP.l BallNChainDungeon : BNE + - CPY.b #$32 : BEQ .ballchain_bigkey - + - CMP.b #$04 : BCS + - LDA.l SewersLocations : INC : STA.l SewersLocations : STA.l HCLocations - BRA .count - + - LSR : TAX : LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X - CPX.b #$0D : BNE + - LDA.l BigKeyField : BIT.b #$04 : BNE ++ - LDA.l PreGTBKLocations : INC : STA.l PreGTBKLocations - ++ - + + CMP.l BallNChainDungeon : BNE + + CPY.b #$32 : BEQ .ballchain_bigkey + + + CMP.b #$04 : BCS + + LDA.l SewersLocations : INC : STA.l SewersLocations : STA.l HCLocations + BRA .count + + + LSR : TAX : LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X + CPX.b #$0D : BNE + + LDA.l BigKeyField : BIT.b #$04 : BNE ++ + LDA.l PreGTBKLocations : INC : STA.l PreGTBKLocations + ++ + + .count CLC RTS @@ -328,6 +327,7 @@ Link_ReceiveItem_HUDRefresh: + JSL.l HUD_RefreshIconLong ; thing we wrote over + INC.w UpdateHUD JSL.l PostItemGet RTL ;-------------------------------------------------------------------------------- @@ -342,6 +342,7 @@ HandleBombAbsorbtion: 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 + INC.w UpdateHUD + RTL ;-------------------------------------------------------------------------------- @@ -450,12 +451,18 @@ RTL ; SaveKeys: ;-------------------------------------------------------------------------------- SaveKeys: - PHA - LDA.l GenericKeys : BEQ + - PLA : STA.l CurrentGenericKeys - RTL - + - PLA : STA.l DungeonKeys, X + PHA + LDA.l GenericKeys : BEQ + + PLA : STA.l CurrentGenericKeys + RTL + + + PLA : STA.l DungeonKeys, X + CPX.b #$00 : BNE + + STA.l HyruleCastleKeys ; copy HC to sewers + + + CPX.b #$01 : BNE + + STA.l SewerKeys ; copy sewers to HC + + RTL ;-------------------------------------------------------------------------------- diff --git a/invertedmaps.asm b/invertedmaps.asm index 7592f3d..9a8b19b 100644 --- a/invertedmaps.asm +++ b/invertedmaps.asm @@ -760,7 +760,6 @@ dw $0000 ; 7F dw $0034, $28D0 dw $0034, $28D2 - dw !OWW_CustomCommand, .map1B_check_aga dw $046D, $243E diff --git a/itemdatatables.asm b/itemdatatables.asm index 6e917bb..6f5a421 100644 --- a/itemdatatables.asm +++ b/itemdatatables.asm @@ -79,8 +79,8 @@ endmacro %ReceiptProps($35, -2, 4, $24, $F360, $FF, skip, skip) ; 35 - 5 rupees %ReceiptProps($36, -2, 4, $24, $F360, $EC, skip, skip) ; 36 - 20 rupees %ReceiptProps($37, -4, 0, $23, $F374, $FF, skip, skip) ; 37 - Green pendant -%ReceiptProps($38, -4, 0, $23, $F374, $FF, skip, skip) ; 38 - Red pendant -%ReceiptProps($39, -4, 0, $23, $F374, $FF, skip, skip) ; 39 - Blue pendant +%ReceiptProps($38, -4, 0, $39, $F374, $FF, skip, skip) ; 38 - Red pendant +%ReceiptProps($39, -4, 0, $39, $F374, $FF, skip, skip) ; 39 - Blue pendant %ReceiptProps($3A, -4, 0, $29, $F340, $01, bow_and_arrows, skip) ; 3A - Bow And Arrows %ReceiptProps($3B, -4, 0, $2A, $F340, $03, silver_bow, skip) ; 3B - Silver Bow %ReceiptProps($3C, -4, 0, $2C, $F35C, $FF, skip, skip) ; 3C - Full bottle (bee) @@ -305,7 +305,7 @@ endmacro %SpriteProps($00, 2, 2, $02, $02, PalettesVanilla_blue_ice+$0E) ; 00 - Fighter sword & Shield %SpriteProps($01, 0, 2, $05, $05, PalettesCustom_master_sword) ; 01 - Master sword %SpriteProps($02, 0, 2, $05, $01, PalettesCustom_tempered_sword) ; 02 - Tempered sword -%SpriteProps($03, 0, 2, $05, $05, PalettesCustom_golden_sword) ; 03 - Golden sword +%SpriteProps($03, 0, 2, $05, $04, PalettesCustom_golden_sword) ; 03 - Golden sword %SpriteProps($04, 0, 0, $80, $80, PalettesCustom_fighter_shield) ; 04 - Fighter shield %SpriteProps($05, 2, 2, $80, $80, PalettesCustom_red_shield) ; 05 - Fire shield %SpriteProps($06, 2, 2, $80, $80, PalettesCustom_mirror_shield) ; 06 - Mirror shield @@ -890,7 +890,7 @@ ItemReceiptGraphicsOffsets: dw BigDecompressionBuffer+$0800 ; 34 - 1 rupee dw BigDecompressionBuffer+$0800 ; 35 - 5 rupees dw BigDecompressionBuffer+$0800 ; 36 - 20 rupees - dw BigDecompressionBuffer+$0080 ; 37 - Green pendant + dw $0820 ; 37 - Green pendant dw BigDecompressionBuffer+$0080 ; 38 - Blue pendant dw BigDecompressionBuffer+$0080 ; 39 - Red pendant dw BigDecompressionBuffer+$0920 ; 3A - Tossed bow @@ -1161,7 +1161,7 @@ StandingItemGraphicsOffsets: dw BigDecompressionBuffer+$0800 ; 34 - 1 rupee dw BigDecompressionBuffer+$0800 ; 35 - 5 rupees dw BigDecompressionBuffer+$0800 ; 36 - 20 rupees - dw BigDecompressionBuffer+$0080 ; 37 - Green pendant + dw $0820 ; 37 - Green pendant dw BigDecompressionBuffer+$0080 ; 38 - Blue pendant dw BigDecompressionBuffer+$0080 ; 39 - Red pendant dw BigDecompressionBuffer+$0920 ; 3A - Tossed bow diff --git a/itemtext_lower.asm b/itemtext_lower.asm new file mode 100644 index 0000000..ade3255 --- /dev/null +++ b/itemtext_lower.asm @@ -0,0 +1,113 @@ +org $328000 +; You have found +; the map of +Notice_MapOf: + db $74, $00, $C2, $00, $3E, $00, $44, $00, $FF, $00, $37, $00, $30, $00, $45, $00, $34, $00, $FF, $00, $35, $00, $3E, $00, $44, $00, $3D, $00, $33 + db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $3C, $00, $30, $00, $3F, $00, $FF, $00, $3E, $00, $35 + dw #$7F7F + +; You have found +; the compass of +Notice_CompassOf: + db $74, $00, $C2, $00, $3E, $00, $44, $00, $FF, $00, $37, $00, $30, $00, $45, $00, $34, $00, $FF, $00, $35, $00, $3E, $00, $44, $00, $3D, $00, $33 + db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $32, $00, $3E, $00, $3C, $00, $3F, $00, $30, $00, $42, $00, $42, $00, $FF, $00, $3E, $00, $35 + dw #$7F7F + +; Oh look! it's +; the big key of +Notice_BigKeyOf: + db $74, $00, $B8, $00, $37, $00, $FF, $00, $3B, $00, $3E, $00, $3E, $00, $3A, $00, $C7, $00, $FF, $00, $38, $00, $43, $00, $D8, $00, $42 + db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $31, $00, $38, $00, $36, $00, $FF, $00, $3A, $00, $34, $00, $48, $00, $FF, $00, $3E, $00, $35 + dw #$7F7F + +; this is a +; small key to +Notice_SmallKeyOf: + db $74, $00, $BD, $00, $37, $00, $38, $00, $42, $00, $FF, $00, $38, $00, $42, $00, $FF, $00, $30 + db $75, $00, $42, $00, $3C, $00, $30, $00, $3B, $00, $3B, $00, $FF, $00, $3A, $00, $34, $00, $48, $00, $FF, $00, $43, $00, $3e + dw #$7F7F + +; light world +Notice_LightWorld: + db $76, $00, $B5, $00, $38, $00, $36, $00, $37, $00, $43, $00, $FF, $00, $C0, $00, $3E, $00, $41, $00, $3B, $00, $33 + dw #$7F7F + +; dark world +Notice_DarkWorld: + db $76, $00, $AD, $00, $30, $00, $41, $00, $3A, $00, $FF, $00, $C0, $00, $3E, $00, $41, $00, $3B, $00, $33 + dw #$7F7F + +; Ganons Tower +Notice_GTower: + db $76, $00, $B0, $00, $30, $00, $3D, $00, $3E, $00, $3D, $00, $42, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41 + dw #$7F7F + +; Turtle Rock +Notice_TRock: + db $76, $00, $BD, $00, $44, $00, $41, $00, $43, $00, $3B, $00, $34, $00, $FF, $00, $BB, $00, $3E, $00, $32, $00, $3a + dw #$7F7F + +; Thieves Town +Notice_Thieves: + db $76, $00, $BD, $00, $37, $00, $38, $00, $34, $00, $45, $00, $34, $00, $42, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $3d + dw #$7F7F + +; Tower of Hera +Notice_Hera: + db $76, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41, $00, $FF, $00, $3E, $00, $35, $00, $FF, $00, $B1, $00, $34, $00, $41, $00, $30 + dw #$7F7F + +; Ice Palace +Notice_Ice: + db $76, $00, $B2, $00, $32, $00, $34, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34 + dw #$7F7F + +; Skull Woods +Notice_Skull: + db $76, $00, $BC, $00, $3A, $00, $44, $00, $3B, $00, $3B, $00, $FF, $00, $C0, $00, $3E, $00, $3E, $00, $33, $00, $42 + dw #$7F7F + +; Misery Mire +Notice_Mire: + db $76, $00, $B6, $00, $38, $00, $42, $00, $34, $00, $41, $00, $48, $00, $FF, $00, $B6, $00, $38, $00, $41, $00, $34 + dw #$7F7F + +; Dark Palace +Notice_PoD: + db $76, $00, $AD, $00, $30, $00, $41, $00, $3A, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34 + dw #$7F7F + +; Swamp Palace +Notice_Swamp: + db $76, $00, $BC, $00, $46, $00, $30, $00, $3C, $00, $3F, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34 + dw #$7F7F + +; Castle Tower +Notice_AgaTower: + db $76, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41 + dw #$7F7F + +; Desert Palace +Notice_Desert: + db $76, $00, $AD, $00, $34, $00, $42, $00, $34, $00, $41, $00, $43, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34 + dw #$7F7F + +; Eastern Palace +Notice_Eastern: + db $76, $00, $AE, $00, $30, $00, $42, $00, $43, $00, $34, $00, $41, $00, $3D, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34 + dw #$7F7F + +; Hyrule Castle +Notice_Castle: + db $76, $00, $B1, $00, $48, $00, $41, $00, $44, $00, $3B, $00, $34, $00, $FF, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34 + dw #$7F7F + +; Hyrule Castle +Notice_Sewers: + db $76, $00, $B1, $00, $48, $00, $41, $00, $44, $00, $3B, $00, $34, $00, $FF, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34 + dw #$7F7F + +; This Dungeon +Notice_Self: + db $76, $00, $43, $00, $37, $00, $38, $00, $42, $00, $FF, $00, $33, $00, $44, $00, $3D, $00, $36, $00, $34, $00, $3E, $00, $3d + dw #$7F7F \ No newline at end of file diff --git a/newhud.asm b/newhud.asm index fc1b42b..6a5e25a 100644 --- a/newhud.asm +++ b/newhud.asm @@ -1,211 +1,163 @@ -InfiniteTile = $2431 -BlankTile = $207F -SlashTile = $2830 -PTile = $296C -CTile = $295F - -;=================================================================================================== +!InfiniteTile = $2431 +!BlankTile = $207F +!SlashTile = $2830 +!PTile = $296C +!CTile = $295F NewDrawHud: - PHB + PHB - SEP #$30 - REP #$10 + SEP #$30 + REP #$10 - LDA.b #$7E - PHA - PLB - -;=================================================================================================== + LDA.b #$7E + PHA : PLB +;================================================================================ NewHUD_DrawBombs: - LDA.l InfiniteBombs : BEQ .finite + LDA.l InfiniteBombs : BEQ .finite .infinite - LDY.w #InfiniteTile+0 - LDX.w #InfiniteTile+1 - - BRA .draw + LDY.w #!InfiniteTile+0 + LDX.w #!InfiniteTile+1 + BRA .draw .finite - LDA.w BombsEquipment - JSR HUDHex2Digit + LDA.w BombsEquipment + JSR HUDHex2Digit .draw - STY.w HUDBombCount+0 - STX.w HUDBombCount+2 - -;=================================================================================================== + STY.w HUDBombCount+0 + STX.w HUDBombCount+2 +;================================================================================ NewHUD_DrawRupees: - REP #$20 + REP #$20 - LDA.w DisplayRupees - JSR HUDHex4Digit + LDA.w DisplayRupees + JSR HUDHex4Digit - LDA.b Scrap04 : TAX : STX.w HUDRupees+0 ; 1000s - LDA.b Scrap05 : TAX : STX.w HUDRupees+2 ; 100s - LDA.b Scrap06 : TAX : STX.w HUDRupees+4 ; 10s - LDA.b Scrap07 : TAX : STX.w HUDRupees+6 ; 1s - -;=================================================================================================== + LDA.b Scrap04 : TAX : STX.w HUDRupees+0 ; 1000s + LDA.b Scrap05 : TAX : STX.w HUDRupees+2 ; 100s + LDA.b Scrap06 : TAX : STX.w HUDRupees+4 ; 10s + LDA.b Scrap07 : TAX : STX.w HUDRupees+6 ; 1s +;================================================================================ NewHUD_DrawArrows: - SEP #$20 + SEP #$20 - LDA.l ArrowMode - BNE NewHUD_DrawGoal - - LDA.l InfiniteArrows : BEQ .finite + LDA.l ArrowMode : BNE NewHUD_DrawGoal + LDA.l InfiniteArrows : BEQ .finite .infinite - LDY.w #InfiniteTile+0 - LDX.w #InfiniteTile+1 - - BRA .draw + LDY.w #!InfiniteTile+0 + LDX.w #!InfiniteTile+1 + BRA .draw .finite - LDA.w CurrentArrows - JSR HUDHex2Digit + LDA.w CurrentArrows + JSR HUDHex2Digit .draw - STY.w HUDArrowCount+0 - STX.w HUDArrowCount+2 - -;=================================================================================================== + STY.w HUDArrowCount+0 + STX.w HUDArrowCount+2 +;================================================================================ NewHUD_DrawGoal: - REP #$20 + LDA.w UpdateHUD : BEQ .no_goal + + REP #$20 - LDA.l GoalItemRequirement - BEQ .no_goal + LDA.l GoalItemRequirement : BEQ .no_goal - LDA.l GoalItemIcon - STA.w HUDGoalIndicator + LDA.l GoalItemIcon : STA.w HUDGoalIndicator + LDA.w #!SlashTile : STA.w HUDGoalIndicator+8 + LDA.l GoalCounter + JSR HUDHex4Digit - LDA.w #SlashTile - STA.w HUDGoalIndicator+8 + LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+2 ; draw 100's digit + LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+4 ; draw 10's digit + LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+6 ; draw 1's digit - LDA.l GoalCounter - JSR HUDHex4Digit + REP #$20 - LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+2 ; draw 100's digit - LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+4 ; draw 10's digit - LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+6 ; draw 1's digit + LDA.l GoalItemRequirement : CMP.w #$FFFF : BNE .real_goal - - REP #$20 - - LDA.l GoalItemRequirement - CMP.w #$FFFF - BNE .real_goal - - LDX.w #BlankTile - STX.w HUDGoalIndicator+10 - STX.w HUDGoalIndicator+12 - STX.w HUDGoalIndicator+14 + LDX.w #!BlankTile + STX.w HUDGoalIndicator+10 + STX.w HUDGoalIndicator+12 + STX.w HUDGoalIndicator+14 .no_goal - SEP #$20 - BRA NewHUD_DrawKeys + SEP #$20 + BRA NewHUD_DrawKeys .real_goal - JSR HUDHex4Digit + JSR HUDHex4Digit - LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+10 ; draw 100's digit - LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+12 ; draw 10's digit - LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+14 ; draw 1's digit - -;=================================================================================================== + LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+10 ; draw 100's digit + LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+12 ; draw 10's digit + LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+14 ; draw 1's digit +;================================================================================ NewHUD_DrawKeys: - LDA.l CurrentSmallKeys - CMP.b #$FF - BNE .in_dungeon + LDA.l CurrentSmallKeys + CMP.b #$FF + BNE .in_dungeon - LDY.w #BlankTile - STY.w HUDKeyIcon - STY.w HUDKeyDigits+0 - STY.w HUDKeyDigits+2 - BRA NewHUD_DrawCompassCount + LDY.w #!BlankTile + STY.w HUDKeyIcon + STY.w HUDKeyDigits+0 + STY.w HUDKeyDigits+2 + BRA NewHUD_DrawDungeonCounters .in_dungeon - JSR HUDHex2Digit - CPY.w #$2490 - BNE .real_10s + JSR HUDHex2Digit + CPY.w #$2490 + BNE .real_10s - LDY.w #BlankTile + LDY.w #!BlankTile .real_10s - STY.w HUDKeyDigits+0 - STX.w HUDKeyDigits+2 + STY.w HUDKeyDigits+0 + STX.w HUDKeyDigits+2 -;=================================================================================================== +;================================================================================ +NewHUD_DrawDungeonCounters: + LDA.w UpdateHUD : BEQ NewHUD_DrawPrizeIcon + LDA.l CompassMode : ORA.l MapHUDMode : BIT.b #$03 : BEQ NewHUD_DrawPrizeIcon + LDX.b IndoorsFlag : BNE + + JMP.w NewHUD_DrawMagicMeter + + + SEP #$30 + ; extra hard safeties for getting dungeon ID to prevent crashes + LDA.w DungeonID + CMP.b #$1B : BCS NewHUD_DrawPrizeIcon ; Skip if not in a valid dungeon ID + AND.b #$FE : TAX + LSR : TAY + PHX : PHY -NewHUD_DrawCompassCount: - LDA.b IndoorsFlag - BNE .indoors - - JMP NewHUD_DrawMagicMeter - -.indoors - LDA.l CompassMode - BEQ NewHUD_DrawPrizeIcon - - SEP #$30 - ; force dungeon ID to a multiple of 2 - LDA.w DungeonID - CMP.b #$1B : BCS NewHUD_DrawPrizeIcon ; skip if invalid dungeon - AND.b #$FE : TAX - LSR : TAY ; save reduced ID in Y - - ; no compass needed if this bit is set - LDA.l CompassMode - BIT.b #$02 - BNE .draw_compass_count - - LDA.l CompassField - AND.l DungeonItemMasks,X - BEQ NewHUD_DrawPrizeIcon - -.draw_compass_count - TYX - BNE .not_sewers - - INX - -.not_sewers - LDA.l DungeonLocationsChecked, X - PHA - - LDA.l CompassTotalsWRAM,X - - JSR HUDHex2Digit - STY.w HUDTileMapBuffer+$9A - STX.w HUDTileMapBuffer+$9C - - LDX.w #SlashTile - STX.w HUDTileMapBuffer+$98 - - PLA - JSR HUDHex2Digit - STY.w HUDTileMapBuffer+$94 - STX.w HUDTileMapBuffer+$96 - -;=================================================================================================== + JSR.w DrawCompassCounts + SEP #$10 + PLY : PLX + JSR.w DrawMapCounts +;================================================================================ NewHUD_DrawPrizeIcon: + REP #$10 + SEP #$20 LDA.b GameMode - CMP.b #$12 - BEQ .no_prize - - LDA.w DungeonID + CMP.b #$12 : BEQ .no_prize + CMP.b #$0E : BEQ + + LDA.w UpdateHUD : BEQ NewHUD_DrawItemCounter + + + LDA.w DungeonID CMP.b #$1A : BCS .no_prize CMP.b #$04 : BCC .no_prize CMP.b #$08 : BNE .dungeon .no_prize - LDY.w #BlankTile + LDY.w #!BlankTile BRA .draw_prize .dungeon @@ -216,133 +168,209 @@ NewHUD_DrawPrizeIcon: LDA.l MapMode REP #$30 + BEQ .prize LDA.l MapField AND.l DungeonItemMasks,X - - SEP #$20 BEQ .no_prize + .prize TYX LDA.l CrystalPendantFlags_2,X - AND.b #$40 + AND.w #$0040 BNE .crystal - LDY.w #PTile + LDY.w #!PTile BRA .draw_prize .crystal - LDY.w #CTile + LDY.w #!CTile .draw_prize STY.w HUDPrizeIcon -;=================================================================================================== +;================================================================================ +NewHUD_DrawItemCounter: + REP #$20 + LDA.w UpdateHUD : BEQ NewHUD_DrawMagicMeter + LDA.l ItemCounterHUD : AND.w #$00FF : BEQ NewHUD_DrawMagicMeter + LDA.w #!SlashTile : STA.w HUDGoalIndicator+$08 + LDA.l TotalItemCount : CMP.w #1000 : BCS .item_four_digits + LDA.w TotalItemCountTiles+$02 : STA.w HUDGoalIndicator+$0A + LDA.w TotalItemCountTiles+$04 : STA.w HUDGoalIndicator+$0C + 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 + BRA NewHUD_DrawMagicMeter + + .item_four_digits + LDA.w TotalItemCountTiles+$00 : STA.w HUDGoalIndicator+$0A + LDA.w TotalItemCountTiles+$02 : STA.w HUDGoalIndicator+$0C + LDA.w TotalItemCountTiles+$04 : STA.w HUDGoalIndicator+$0E + 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 + + + +;================================================================================ DrawMagicMeter_mp_tilemap = $0DFE0F - NewHUD_DrawMagicMeter: - SEP #$31 - LDA.l CurrentMagic - ADC.b #$06 ; carry set by above for +1 to get +7 - AND.b #$F8 - TAY + SEP #$31 + LDA.l CurrentMagic + ADC.b #$06 ; carry set by above for +1 to get +7 + AND.b #$F8 + TAY - LDA.l InfiniteMagic - BEQ .set_index + LDA.l InfiniteMagic + BEQ .set_index .infinite_magic - LDA.b #$80 - STA.l CurrentMagic - TAY + LDA.b #$80 + STA.w CurrentMagic + TAY - LDA.b FrameCounter + LDA.b FrameCounter REP #$30 - AND.w #$000C - LSR + AND.w #$000C + LSR BRA .recolor .set_index ; this branch is always 0000 when taken REP #$30 TDC .recolor - TAX + TAX + LDA.l MagicMeterColorMasks,X - LDA.l MagicMeterColorMasks,X - - TYX - TAY : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.l HUDTileMapBuffer+$046 - TYA : AND.l DrawMagicMeter_mp_tilemap+2,X : STA.l HUDTileMapBuffer+$086 - TYA : AND.l DrawMagicMeter_mp_tilemap+4,X : STA.l HUDTileMapBuffer+$0C6 - TYA : AND.l DrawMagicMeter_mp_tilemap+6,X : STA.l HUDTileMapBuffer+$106 - -;=================================================================================================== + TYX + TAY : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.w HUDTileMapBuffer+$046 + TYA : AND.l DrawMagicMeter_mp_tilemap+2,X : STA.w HUDTileMapBuffer+$086 + TYA : AND.l DrawMagicMeter_mp_tilemap+4,X : STA.w HUDTileMapBuffer+$0C6 + TYA : AND.l DrawMagicMeter_mp_tilemap+6,X : STA.w HUDTileMapBuffer+$106 +;================================================================================ NewHUD_DoneDrawing: - PLB - RTL - -;=================================================================================================== + STZ.w UpdateHUD + PLB +RTL +;================================================================================ MagicMeterColorMasks: - dw $FFFF ; green - KEEP GREEN FIRST - dw $EFFF ; blue - dw $E7FF ; red - dw $EBFF ; yellow - dw $E3FF ; orange + dw $FFFF ; green - KEEP GREEN FIRST + dw $EFFF ; blue + dw $E7FF ; red + dw $EBFF ; yellow + dw $E3FF ; orange -;=================================================================================================== +;================================================================================ +DrawCompassCounts: + LDA.l CompassMode : BEQ .done + + ; no compass needed if this bit is set + BIT.b #$02 : BNE .draw_compass_count + REP #$20 + LDA.l CompassField : AND.l DungeonItemMasks,X : BEQ .done + +.draw_compass_count + SEP #$20 + TYX : BNE .not_sewers + INX + +.not_sewers + LDA.l DungeonLocationsChecked, X + PHA + + LDA.l CompassTotalsWRAM,X + + JSR HUDHex2Digit + STY.w HUDTileMapBuffer+$9A : STX.w HUDTileMapBuffer+$9C + + LDX.w #!BlankTile : STX.w HUDTileMapBuffer+$92 + LDX.w #!SlashTile : STX.w HUDTileMapBuffer+$98 + + PLA + JSR HUDHex2Digit + STY.w HUDTileMapBuffer+$94 : STX.w HUDTileMapBuffer+$96 + +.done + SEP #$20 +RTS +;================================================================================ +DrawMapCounts: + LDA.l MapHUDMode : BEQ .done + + ; no map needed if this bit is set + BIT.b #$02 : BNE .draw_map_count + REP #$20 + LDA.l MapField : AND.l DungeonItemMasks,X : BEQ .done + +.draw_map_count + SEP #$20 + TYX : BNE .not_sewers + INX + +.not_sewers + LDA.l DungeonCollectedKeys, X + PHA + + LDA.l MapTotalsWRAM,X + + JSR HUDHex2Digit + STX.w HUDTileMapBuffer+$A6 + + LDX.w #!SlashTile : STX.w HUDTileMapBuffer+$A4 + + PLA + JSR HUDHex2Digit + STX.w HUDTileMapBuffer+$A2 + +.done + SEP #$20 +RTS + +;================================================================================ ; Exits with: ; X - ones place tile ; Y - tens place tile ;=================================================================================================== -NOP ; this nop makes HUDHex2Digit be at $B00B HUDHex2Digit: SEP #$30 ; clear high byte of X and Y and make it so they don't get B - ASL - TAX + ASL : TAX - REP #$10 + REP #$10 - LDA.b #$24 ; tile props in high byte - XBA + LDA.b #$24 : XBA ; tile props in high byte - LDA.l FastHexTable,X - LSR - LSR - LSR - LSR - ORA.b #$90 - TAY + LDA.l FastHexTable,X : LSR #4 : ORA.b #$90 + TAY - LDA.l FastHexTable,X - AND.b #$0F - ORA.b #$90 - TAX + LDA.l FastHexTable,X : AND.b #$0F : ORA.b #$90 + TAX - RTS - -;=================================================================================================== + RTS HUDHex4Digit: - JSL HexToDec + JSL HexToDec - REP #$30 + REP #$30 - LDA.l HexToDecDigit2 - ORA.w #$9090 - STA.b Scrap04 + LDA.l HexToDecDigit2 : ORA.w #$9090 : STA.b Scrap04 + LDA.l HexToDecDigit4 : ORA.w #$9090 : STA.b Scrap06 - LDA.l HexToDecDigit4 - ORA.w #$9090 - STA.b Scrap06 + LDA.w #$2400 - LDA.w #$2400 - - SEP #$20 - RTS - -;=================================================================================================== + SEP #$20 + RTS HUDHex2Digit_Long: JSR HUDHex2Digit @@ -354,8 +382,7 @@ HUDHex4Digit_Long: REP #$20 RTL -;=================================================================================================== - +;================================================================================ UpdateHearts: PHB @@ -441,5 +468,3 @@ UpdateHearts: PLB RTL - -;=================================================================================================== diff --git a/newitems.asm b/newitems.asm old mode 100755 new mode 100644 index 018133a..cf63941 --- a/newitems.asm +++ b/newitems.asm @@ -772,26 +772,26 @@ RTS ;-------------------------------------------------------------------------------- ;Return BowEquipment but also draw silver arrows if you have the upgrade even if you don't have the bow CheckHUDSilverArrows: - LDA.l ArrowMode : BEQ .normal - .rupee_arrows - JSL.l DrawHUDArrows - LDA.l BowEquipment - RTL - .normal - LDA.l BowEquipment : BNE + - LDA.l BowTracking : AND.b #$40 : BEQ ++ - JSL.l DrawHUDArrows - ++ - LDA.l BowEquipment - + -RTL + LDA.l ArrowMode : BNE .rupee_bow + LDA.l BowEquipment : TAX : BEQ .nobow + JSL.l DrawHUDArrows_normal + TXA + RTL + .rupee_bow + LDA.l BowEquipment : TAX + JSL.l DrawHUDArrows_rupee_arrows + TXA + RTL + .nobow + JSL.l DrawHUDArrows_silverscheck + TXA + RTL ;-------------------------------------------------------------------------------- DrawHUDArrows: -LDA.l ArrowMode : BEQ .normal .rupee_arrows - LDA.l CurrentArrows : BEQ .none ; assuming silvers will increment this. if we go with something else, reorder these checks - LDA.l BowEquipment : BNE + + TXA : BNE + + .silverscheck LDA.l BowTracking : AND.b #$40 : BNE .silver BRA .wooden + CMP.b #03 : !BGE .silver @@ -801,8 +801,12 @@ LDA.l ArrowMode : BEQ .normal LDA.b #$20 : STA.l HUDTileMapBuffer+$21 LDA.b #$A9 : STA.l HUDTileMapBuffer+$22 LDA.b #$20 : STA.l HUDTileMapBuffer+$23 + .skip RTL - .normal ; in normal arrow mode this function is only ever called for silvers + .normal + TXA + CMP.b #$03 : BCS .silver + BRA .wooden .silver LDA.b #$86 : STA.l HUDTileMapBuffer+$20 ; draw silver arrow marker LDA.b #$24 : STA.l HUDTileMapBuffer+$21 @@ -986,14 +990,23 @@ MaybeFlagCompassTotalPickup: .done RTL ;-------------------------------------------------------------------------------- -; Set the compass count display flag if we're entering a dungeon and alerady have -; that compass -MaybeFlagCompassTotalEntrance: - LDX.w DungeonID : CPX.b #$FF : BEQ .done ; Skip if we're not entering dungeon - LDA.l CompassMode : AND.w #$000F : BEQ .done ; Skip if we're not showing compass counts - CMP.w #$0002 : BEQ .countShown +; Set the dungeon item count display flags if we're entering a dungeon and have the +; corresponding dungeon item +MaybeFlagDungeonTotalsEntrance: + LDX.w DungeonID : CPX.b #$FF : BEQ .done ; Skip if we're not entering dungeon + LDA.l CompassMode : AND.w #$000F : BEQ .maps ; Skip if we're not showing compass counts + JSR.w FlagCompassCount + .maps + LDA.l MapHUDMode : AND.w #$000F : BEQ .done + LDX.w DungeonID + JSR.w FlagMapCount + .done +RTL +;-------------------------------------------------------------------------------- +FlagCompassCount: + CMP.w #$0002 : BEQ .compassShown LDA.l CompassField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have compass - .countShown + .compassShown SEP #$20 TXA : LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag index CMP.b #$08 : !BGE ++ @@ -1008,6 +1021,46 @@ MaybeFlagCompassTotalEntrance: ORA.l CompassCountDisplay+1 : STA.l CompassCountDisplay+1 REP #$20 .done +RTS +;-------------------------------------------------------------------------------- +FlagMapCount: + CMP.w #$0002 : BEQ .mapShown + LDA.l MapField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have map + .mapShown + SEP #$20 + TXA : LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag index + CMP.b #$08 : !BGE ++ + %ValueShift() + ORA.l MapCountDisplay : STA.l MapCountDisplay + REP #$20 + BRA .done + ++ + !SUB #$08 + %ValueShift() + BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both + ORA.l MapCountDisplay+1 : STA.l MapCountDisplay+1 + REP #$20 + .done +RTS +;-------------------------------------------------------------------------------- +MaybeFlagMapTotalPickup: + LDA.l MapHUDMode : AND.b #$0F : BEQ .done + LDA.w DungeonID : CMP.b #$FF : BEQ .done + LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag "index" + CPY.b #$33 : BEQ .setFlag ; Set flag if it's a compass for this dungeon + STA.b Scrap04 + TYA : AND.b #$0F : CMP.b Scrap04 : BNE .done ; Check if map is for this dungeon + .setFlag + CMP.b #$08 : !BGE ++ + %ValueShift() + ORA.l MapCountDisplay : STA.l MapCountDisplay + BRA .done + ++ + !SUB #$08 + %ValueShift() + BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both + ORA.l MapCountDisplay+1 : STA.l MapCountDisplay+1 + .done RTL ;-------------------------------------------------------------------------------- DungeonItemIDMap: ; Maps lower four bits of our new dungeon items to DungeonID diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index e0edb7b..edb6bad 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -17,18 +17,20 @@ RTL ;================================================================================ HUDRebuildIndoorHole: PHA + INC.w UpdateHUD LDA.l GenericKeys : BEQ .normal .generic PLA LDA.l CurrentGenericKeys ; generic key count - JSL.l HUD_RebuildIndoor_Palace + JSL.l HUD_RebuildIndoor_Palace RTL .normal PLA - JSL.l HUD_RebuildIndoor_Palace + JSL.l HUD_RebuildIndoor_Palace RTL ;================================================================================ HUDRebuildIndoor: + INC.w UpdateHUD LDA.l GenericKeys : BEQ .normal .generic LDA.b #$00 : STA.l RoomDarkness @@ -177,6 +179,7 @@ CheckCloseItemMenu: RTL ;================================================================================ ShowDungeonItems: + REP #$30 LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave LDA.l HudFlag : AND.w #$0020 ; check hud flag BEQ + : LDA.w #$0000 : RTL : + ; if set, send the zero onwards @@ -655,3 +658,39 @@ dw $A8FB, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $E8FB ;0x1C - ??? possibly unused. (Were they planning two extra dungeons perhaps?) ;0x1E - ??? possibly unused. ;================================================================================ +HandleEmptyMenu: + LDA.b Joy1A_New : BIT.b #$DF : BNE .close_menu ; Not select, close menu + BIT.b #$20 : BNE .sel_pressed + LDA.b Joy1A_All : BIT.b #$20 : BNE .wait_for_change + LDA.l HudFlag : AND.b #$20 : BEQ .wait_for_change ; HUD flag off, skip drawing work + LDA.l HudFlag : AND.b #$DF : STA.l HudFlag ; Unset without select + LDA.b IndoorsFlag : BEQ ++ ; skip if outdoors + LDA.b #$20 : STA.w SFX3 + ++ + LDA.b #$0C : BRA .done + .sel_pressed + LDA.l HudFlag : ORA.b #$20 : STA.l HudFlag + LDA.b #$20 : STA.w SFX3 + LDA.b #$0C : BRA .done + .wait_for_change + LDA.b #$03 : BRA .done + .close_menu + LDA.b #$06 + .done + STA.w SubModuleInterface +RTL +;------------------------------------------------------------------------------- +MaybeDrawEquippedItem: + LDA.w ItemCursor : BEQ + + JML.l ItemMenu_DrawEquippedYItem+$07 + + +JML.l ItemMenu_DrawEquippedYItem_exit +;------------------------------------------------------------------------------- +RestoreMenu_SetSubModule: + LDA.w ItemCursor : BEQ + + LDA.b #$04 : STA.w SubModuleInterface + RTL + + + LDA.b #$03 : STA.w SubModuleInterface +RTL +;------------------------------------------------------------------------------- diff --git a/playername.asm b/playername.asm index fe4c5be..426d61c 100644 --- a/playername.asm +++ b/playername.asm @@ -57,3 +57,55 @@ HeartCursorPositions: db $70, $78, $80, $88 db $98, $a0, $a8, $b0 db $c0, $c8, $d0, $d8 + + +NumberStripes: +dw $AB66, $1100 ; 0-4 top +dw $1D40, $0188, $1D41, $0188, $1D42, $0188, $1D43, $0188 +dw $1D44 +dw $CB66, $1100 ; 0-4 bottom +dw $1D50, $0188, $1D51, $0188, $1D52, $0188, $1D53, $0188 +dw $1D54 +dw $EB66, $1100 ; 5-9 top +dw $1D45, $0188, $1D46, $0188, $1D47, $0188, $1D48, $0188 +dw $1D49 +dw $0B67, $1100 ; 5-9 bottom +dw $1D55, $0188, $1D56, $0188, $1D57, $0188, $1D58, $0188 +dw $1D59 +db $80 ; termination + +TransferNumericStripes: + REP #$30 + LDA.w GameMode : CMP.w #$0204 : BNE .exit + SEP #$20 + LDA.b #NumberStripes>>0 : STA.b $00 + LDA.b #NumberStripes>>8 : STA.b $01 + LDA.b #NumberStripes>>16 : STA.b $02 : STA.w DMA1ADDRB + STZ.b $06 : LDY.w #$0000 + .check_next + LDA.b [$00],Y : BPL .next_stripe + .exit + SEP #$30 +RTL + .next_stripe + STA.b $04 + INY + LDA.b [$00],Y : STA.b $03 + INY + LDA.b [$00],Y : AND.b #$80 : ASL : ROL : STA.b $07 + LDA.b [$00],Y : AND.b #$40 : STA.b $05 + 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 + 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 + SEP #$20 + LDA.b $07 : ORA.b #$80 : STA.w VMAIN + LDA.b #$02 : STA.w DMAENABLE + JMP.w .check_next diff --git a/ram.asm b/ram.asm index d16c554..e51f53b 100644 --- a/ram.asm +++ b/ram.asm @@ -224,6 +224,8 @@ NoDamage = $7E037B ; Prevents Link from receiving damage. ; AncillaGeneral = $7E039F ; General use buffer for front slot ancillae. $0F bytes. ; +AncillaTimer = $7E03B1 ; Used as a timer for ancilla. + ; AncillaSearch = $7E03C4 ; Used to search through ancilla when every front slot is occupied. ; ForceSwordUp = $7E03EF ; $01 = Force sword up pose. @@ -368,6 +370,8 @@ DelayTimer = $7E1CE9 ; ; TextID = $7E1CF0 ; Message ID and page. Word length. ; +UpdateHUD = $7E1E03 ; Flag used to mark HUD updates and avoid heavy code segments. + ; ToastBuffer = $7E1E0E ; Multiworld buffer. Word length. ; MSUResumeTime = $7E1E6B ; Mirrored MSU block @@ -455,6 +459,7 @@ HUDArrowCount = $7EC760 ; HUDKeyDigits = $7EC764 ; ; BigRAM = $7EC900 ; Big buffer of free ram (0x1F00) +TotalItemCountTiles = $7ECB00 ; Cached total item count tiles for HUD. Four words high to low. ;================================================================================ ; Bank 7F @@ -544,7 +549,7 @@ OHKOFlag: skip 1 ; Any non-zero write sets OHKO mode SpriteSwapper: skip 1 ; Loads new link sprite and glove/armor palette. No gfx or ; code currently in base ROM for this. BootsModifier: skip 1 ; $01 = Give dash ability -skip 1 ; Unused +OHKOCached: skip 1 ; "Old" OHKO flag state. Used to detect changes. ; Crypto Block ($7F50D0 - $7F51FF) KeyBase: skip $10 ; y: skip 4 ; @@ -563,8 +568,9 @@ RxStatus: skip 1 ; TxBuffer: skip $7F ; TxStatus: skip 1 ; skip $10 ; Unused -CompassTotalsWRAM: skip $10 ; skip $10 -skip $40 ; Reserved for general dungeon tracking data. May have over +CompassTotalsWRAM: skip $10 ; \ Compass and map dungeon HUD display totals. Placed in WRAM +MapTotalsWRAM: skip $10 ; / on boot for tracking. +skip $30 ; Reserved for general dungeon tracking data. May have over ; allocated here. Feel free to reassign. skip $40 ; Unused skip $260 ; Unused @@ -938,6 +944,7 @@ endmacro %assertRAM(TxBuffer, $7F5380) %assertRAM(TxStatus, $7F53FF) %assertRAM(CompassTotalsWRAM, $7F5410) +%assertRAM(MapTotalsWRAM, $7F5420) %assertRAM(DialogBuffer, $7F5700) %assertRAM(MiniGameTime, $7FFE00) %assertRAM(MiniGameTimeFinal, $7FFE04) diff --git a/retro.asm b/retro.asm index 806f0b6..5752b98 100644 --- a/retro.asm +++ b/retro.asm @@ -11,6 +11,7 @@ LoadBombCount16: .infinite RTL StoreBombCount: + INC.w UpdateHUD PHA : LDA.l InfiniteBombs : BEQ .finite .infinite PLA : LDA.b #$01 : RTL diff --git a/save.asm b/save.asm index d6ba313..2aa3c4e 100644 --- a/save.asm +++ b/save.asm @@ -99,6 +99,21 @@ ValidateSRAM: SEP #$30 RTL ;-------------------------------------------------------------------------------- +WriteNewFileChecksum: + LDX.w #$0000 : TXA : - ; Checksum first $04FE bytes + CLC : ADC.l CartridgeSRAM, X + INX #2 + CPX.w #$04FE : BNE - + LDX.w #$0000 : - ; Checksum extended save data + CLC : ADC.l ExtendedFileNameSRAM, X + INX #2 + CPX.w #$0FFE : BNE - + STA.b Scrap00 + LDA.w #$5A5A + SEC : SBC.b Scrap00 + STA.l InverseChecksumSRAM +RTL +;-------------------------------------------------------------------------------- ClearExtendedSaveFile: STA.l $700400, X ; what we wrote over STA.l $700500, X diff --git a/sram.asm b/sram.asm index c1e3c10..48c10f4 100644 --- a/sram.asm +++ b/sram.asm @@ -172,7 +172,7 @@ CurrentGenericKeys: skip 1 ; Generic small keys ;================================================================================ ; Tracking & Indicators ($7EF38C - $7EF3F0) ;-------------------------------------------------------------------------------- -InventoryTracking: skip 2 ; b r m p n s k f - - - - - - o q (bitfield) +InventoryTracking: skip 2 ; - - - - - - o q b r m p n s k f (bitfield) ; b = Blue Boomerang | r = Red Boomerang | m = Mushroom Current ; p = Magic Powder | n = Mushroom Past | s = Shovel ; k = Inactive Flute | f = Active Flute | o = Any bomb acquired @@ -317,7 +317,8 @@ HeartPieceCounter: skip 1 ; Total Number of heartpieces collected (integer CrystalCounter: skip 1 ; Total Number of crystals collected (integer) DungeonsCompleted: skip 2 ; Bitfield indicating whether a dungeon's prize has been collected. ; This has the same shape as the dungeon item bitfields. -skip 44 ; Unused +MapCountDisplay: skip 2 ; +skip 42 ; Unused ServiceSequence: ; See servicerequest.asm ServiceSequenceRx: skip 8 ; Service sequence receive ServiceSequenceTx: skip 8 ; Service sequence transmit @@ -604,6 +605,7 @@ endmacro %assertSRAM(HeartPieceCounter, $7EF470) %assertSRAM(CrystalCounter, $7EF471) %assertSRAM(DungeonsCompleted, $7EF472) +%assertSRAM(MapCountDisplay, $7EF474) ;-------------------------------------------------------------------------------- %assertSRAM(ServiceSequence, $7EF4A0) %assertSRAM(ServiceSequenceRx, $7EF4A0) diff --git a/stats.asm b/stats.asm index 62ab9d6..43436cc 100644 --- a/stats.asm +++ b/stats.asm @@ -83,6 +83,7 @@ IncrementSmallKeys: JSL.l UpdateKeys PHY : LDY.b #24 : JSL.l AddInventory : PLY JSL.l HUD_RebuildLong + INC.w UpdateHUD PLX RTL ;-------------------------------------------------------------------------------- @@ -119,21 +120,25 @@ CountChestKeyLong: ; called from ItemDowngradeFix in itemdowngrade.asm RTL ;-------------------------------------------------------------------------------- CountChestKey: ; called by neighbor functions - PHA : PHX - CPY.b #$24 : BEQ + ; small key for this dungeon - use DungeonID - CPY.b #$A0 : !BLT .end ; Ignore most items - CPY.b #$AE : !BGE .end ; Ignore reserved key and generic key - TYA : AND.B #$0F : BNE ++ ; If this is an HC key, instead count it as a sewers key - INC - ++ TAX : BRA .count ; use Key id instead of DungeonID (Keysanity) - + LDA.w DungeonID : LSR - BNE + - INC ; combines HC and Sewer counts - + TAX - .count - LDA.l DungeonCollectedKeys, X : INC : STA.l DungeonCollectedKeys, X - .end - PLX : PLA + PHA : PHX + CPY.b #$24 : BEQ + ; small key for this dungeon - use DungeonID + CPY.b #$A0 : !BLT .end ; Ignore most items + CPY.b #$AE : !BGE .end ; Ignore reserved key and generic key + TYA : AND.B #$0F + TAX : BRA .count ; use Key id instead of DungeonID (Keysanity) + + + LDA.w DungeonID : LSR : TAX + .count + LDA.l DungeonCollectedKeys, X : INC : STA.l DungeonCollectedKeys, X + + CPX.b #$00 : BNE + + STA.l HCCollectedKeys ; copy HC to sewers + + + CPX.b #$01 : BNE + + STA.l SewerCollectedKeys ; copy sewers to HC + + + .end + PLX : PLA RTS ;-------------------------------------------------------------------------------- CountBonkItem: ; called from GetBonkItem in bookofmudora.asm diff --git a/stats/credits.asm b/stats/credits.asm index 3bf95ef..b4016f8 100644 --- a/stats/credits.asm +++ b/stats/credits.asm @@ -443,7 +443,7 @@ CreditsLineBlank: %blankline() -%bigcredits("MIKETRETHEWEY IBAZLY") +%bigcredits("MATRETHEWEY IBAZLY") %blankline() %bigcredits("FISH_WAFFLE64 KRELBEL") diff --git a/stats/font.2bpp b/stats/font.2bpp index c0ce111..8be821f 100644 Binary files a/stats/font.2bpp and b/stats/font.2bpp differ diff --git a/tables.asm b/tables.asm index ed585d7..24ebf8a 100644 --- a/tables.asm +++ b/tables.asm @@ -118,9 +118,13 @@ org $B08038 ; PC 0x180038 LampConeSewers: db $01 ; #$00 = Off - #$01 = On (default) ;-------------------------------------------------------------------------------- -; 0x180039 - 0x18003A (Unused) +org $308039 ; PC 0x180039 +ItemCounterHUD: +db $00 ; $00 = Off | $01 = Display TotalItemCounter / TotalItemCount display on HUD ;-------------------------------------------------------------------------------- -org $B0803B ; PC 0x18003B - PC 0x18003C +org $B0803A ; PC 0x18003A-0x18003C +MapHUDMode: +db #$00 ; #$00 = Off (default) - #$01 = Display Dungeon Count w/Map - #$02 = Display Dungeon Count Always MapMode: db $00 ; #$00 = Always On (default) - #$01 = Require Map Item CompassMode: @@ -142,6 +146,9 @@ db $00 ; #$06 = Light Speed ; #$07 = Require All Crystals and Crystal Bosses ; #$08 = Require All Crystal Bosses only +; #$09 = Require All Dungeons No Agahnim +; #$0A = Require 100% Item Collection +; #$0B = Require 100% Item Collection and All Dungeons ;-------------------------------------------------------------------------------- org $B0803F ; PC 0x18003F HammerableGanon: @@ -926,6 +933,10 @@ org $B08195 ; PC 0x180195 ByrnaCaveSpikeDamage: db $08 ; #$08 = 1 Heart (default) - #$02 = 1/4 Heart ;-------------------------------------------------------------------------------- +org $308196 ; PC 0x180196-0x180197 +TotalItemCount: ; Total item count for HUD. Only counts items that use "item get" animation. +dw $00D8 ; 216 +;-------------------------------------------------------------------------------- ; 0x180196 - 0x1801FF (unused) ;================================================================================ org $B08200 ; PC 0x180200 - 0x18020B @@ -2555,6 +2566,10 @@ org $B0F000 ; PC 0x187000-0x18700F CompassTotalsROM: db $08, $08, $06, $06, $02, $0A, $0E, $08, $08, $08, $06, $08, $0C, $1B, $00, $00 +org $30F010 +ChestKeys: ; PC 0x187010-0x18701F +db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $00 + ;-------------------------------------------------------------------------------- ; 0x187010 - 187FFF (unused) ;-------------------------------------------------------------------------------- diff --git a/tablets.asm b/tablets.asm index 3ce935a..07a45e6 100644 --- a/tablets.asm +++ b/tablets.asm @@ -72,13 +72,13 @@ IsMedallion: CMP.w #$03 : BNE + ; Death Mountain LDA.b LinkPosX : CMP.w #1890 : !BGE ++ SEC - JMP .done + BRA .done ++ BRA .false + CMP.w #$30 : BNE + ; Desert LDA.b LinkPosX : CMP.w #512 : !BLT ++ SEC - JMP .done + BRA .done ++ + .false @@ -100,9 +100,5 @@ CheckTabletItem: LDA.l OverworldEventDataWRAM, X : AND.b #$40 ; What we wrote over RTL .tablet - LDA.b OverworldIndex : CMP.b #$03 : BEQ .ether - LDA.l NpcFlags+1 : AND.b #$02 : BNE .done - .ether - LDA.l NpcFlags+1 : AND.b #$01 - .done + TDC RTL diff --git a/timer.asm b/timer.asm index 3139ca1..7fef763 100644 --- a/timer.asm +++ b/timer.asm @@ -110,19 +110,19 @@ dw #$003C, #$0000 dw #$FFFF, #$7FFF ;-------------------------------------------------------------------------------- DrawChallengeTimer: - LDA.l OHKOFlag : AND.w #$00FF : BEQ + - LDA.w #$2807 : STA.l HUDTileMapBuffer+$90 - LDA.w #$280A : STA.l HUDTileMapBuffer+$92 - LDA.w #$280B : STA.l HUDTileMapBuffer+$94 - LDA.w #$280C : STA.l HUDTileMapBuffer+$96 - RTL - + - LDA.w #$247F : STA.l HUDTileMapBuffer+$90 - STA.l HUDTileMapBuffer+$92 - STA.l HUDTileMapBuffer+$94 - STA.l HUDTileMapBuffer+$96 + JSR.w CheckOHKO : BCC ++ + AND.w #$00FF : BEQ + + LDA.w #$2807 : STA.l HUDTileMapBuffer+$90 + LDA.w #$280A : STA.l HUDTileMapBuffer+$92 + LDA.w #$280B : STA.l HUDTileMapBuffer+$94 + LDA.w #$280C : STA.l HUDTileMapBuffer+$96 + RTL + + + LDA.w #$247F : STA.l HUDTileMapBuffer+$90 + STA.l HUDTileMapBuffer+$92 + STA.l HUDTileMapBuffer+$94 + STA.l HUDTileMapBuffer+$96 ++ - LDA.l TimerStyle : BNE + : RTL : + ; Hud Timer LDA.w #$2807 : STA.l HUDTileMapBuffer+$92 LDA.l ClockStatus : AND.w #$0002 : BEQ + ; DNF / OKHO @@ -171,3 +171,16 @@ OHKOTimer: LDA.l CurrentHealth RTL ;-------------------------------------------------------------------------------- +CheckOHKO: + SEP #$20 + LDA.l OHKOFlag : CMP.l OHKOCached : BNE .change + REP #$20 + CLC + RTS + .change + STA.l OHKOCached + INC.w UpdateHUD + REP #$20 + SEC +RTS +;-------------------------------------------------------------------------------- diff --git a/utilities.asm b/utilities.asm index 367d769..3308cc1 100644 --- a/utilities.asm +++ b/utilities.asm @@ -249,10 +249,6 @@ SkipDrawEOR: .normal LDA.b ($08), Y : EOR.w Scrap04 ; thing we wrote over RTL -;-------------------------------------------------------------------------------- -; Look up table of bit counts in the values $00-$0F -NybbleBitCounts: -db #00, #01, #01, #02, #01, #02, #02, #03, #01, #02, #02, #03, #02, #03, #03, #04 ;-------------------------------------------------------------------------------- ; WriteVRAMStripe @@ -378,3 +374,9 @@ LoadItemPalette: PLB : PLY : PLX INC.b NMICGRAM RTL + +TransferVRAMStripes: + JSL.l TransferNumericStripes + JSL.l DoDungeonMapBossIcon + LDA.b NMISTRIPES : CMP.b #$01 ; What we wrote over +RTL diff --git a/vanillalabels.asm b/vanillalabels.asm index ac5e4bc..0c7151c 100644 --- a/vanillalabels.asm +++ b/vanillalabels.asm @@ -97,6 +97,7 @@ Equipment_SearchForEquippedItemLong = $8DE395 HUD_RebuildLong = $8DFA78 HUD_RebuildIndoor_Palace = $8DFA88 HUD_RebuildLong2 = $8DFA88 +RebuildHUD_update = $8DFAA5 Messaging_Text = $8EEE10 Overworld_TileAttr = $8FFD94 Overworld_DrawPersistentMap16 = $9BC97C @@ -121,6 +122,9 @@ Sprite_PlayerCantPassThrough = $9EF4E7 Chicken_SpawnAvengerChicken = $86A7DB Link_PerformOpenChest_no_replacement = $87B59F DrawProgressIcons = $8DE9C8 +ItemMenu_DrawEquippedYItem = $8DEB3A +ItemMenu_DrawEquippedYItem_exit = $8DECE6 +ItemMenu_DrawEquipment_dungeonitems = $8DEDCC DrawEquipment = $8DED29 ;=================================================================================================== diff --git a/xkas b/xkas deleted file mode 100755 index 6e31af5..0000000 Binary files a/xkas and /dev/null differ diff --git a/xkas.exe b/xkas.exe deleted file mode 100644 index 9b41a42..0000000 Binary files a/xkas.exe and /dev/null differ