diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 86c3c33..dc30754 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -26,7 +26,7 @@ org $3FFFFF ; <- 1FFFFF db #$00 ; expand file to 2mb org $1FFFF8 ; timestamp rom -dl #$20170610 +dl #$20170613 ;================================================================================ diff --git a/events.asm b/events.asm index bc10430..6d9f96e 100644 --- a/events.asm +++ b/events.asm @@ -78,6 +78,7 @@ RTL ;-------------------------------------------------------------------------------- PostItemGet: ;LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished + JSL.l MaybeWriteSRAMTrace RTL ;-------------------------------------------------------------------------------- PostItemAnimation: diff --git a/framehook.asm b/framehook.asm index d4ed981..9567028 100644 --- a/framehook.asm +++ b/framehook.asm @@ -23,9 +23,9 @@ FrameHookAction: JSL $0080B5 ; Module_MainRouting PHA : PHP - LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ + - LDA $1A : BNE ++ : JSL.l WriteStatusPreview : ++ ; write every 256 frames - + + ;LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ + + ; LDA $1A : BNE ++ : JSL.l WriteStatusPreview : ++ ; write every 256 frames + ;+ LDA !LOCK_STATS : BNE ++ REP #$20 ; set 16-bit accumulator diff --git a/hooks.asm b/hooks.asm index 009875c..ec182cb 100644 --- a/hooks.asm +++ b/hooks.asm @@ -61,6 +61,10 @@ JSL.l SpawnZelda : NOP #2 org $06F2C8 ; <- 372C8 - Bank06.asm : 5776 (LDA $44 : CMP.b #$80 : BEQ .no_collision) JSL.l GoalItemGanonCheck ;-------------------------------------------------------------------------------- +;Hammerable Ganon +org $06F2EA ; <- 372EA - Bank06.asm : 5791 (LDA $0E20, X : CMP.b #$D6 : BCS .no_collision) +JSL.l GoalItemGanonCheck : NOP +;-------------------------------------------------------------------------------- ;================================================================================ ; Stat Hooks @@ -726,7 +730,7 @@ JSL.l CheckFullHealth ;-------------------------------------------------------------------------------- ;================================================================================ -; RNG Fix +; RNG Fixes ;-------------------------------------------------------------------------------- org $1DFD9E ; <- EFD9E - sprite_diggin_guy.asm : 307 NOP #8 @@ -749,7 +753,77 @@ JSL RandomGanon ;org $01EDB2 ; <- EDB2 - Bank01.asm : 14038 ;INC $04C4 ;-------------------------------------------------------------------------------- - +org $05A3F4 ; <- 2A3F4 - sprite_lanmola.asm : 112 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Lanmolas1 +org $05A401 ; <- 2A401 - sprite_lanmola.asm : 116 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Lanmolas1 +org $05A4FA ; <- 2A4FA - sprite_lanmola.asm : 241 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Lanmolas1 +org $05A507 ; <- 2A507 - sprite_lanmola.asm : 245 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Lanmolas1 +;-------------------------------------------------------------------------------- +org $1DD817 ; <- ED817 - sprite_giant_moldorm.asm : 187 (JSL GetRandomInt : AND.b #$02 : DEC A : STA $0EB0, X) +JSL.l RNG_Moldorm1 +org $1DD821 ; <- ED821 - sprite_giant_moldorm.asm : 189 (JSL GetRandomInt : AND.b #$1F : ADC.b #$20 : STA !timer_0, X) +JSL.l RNG_Moldorm1 +org $1DD832 ; <- ED832 - sprite_giant_moldorm.asm : 203 (JSL GetRandomInt : AND.b #$0F : ADC.b #$08 : STA !timer_0, X) +JSL.l RNG_Moldorm1 +;-------------------------------------------------------------------------------- +org $1E81A9 ; <- F01A9 - sprite_helmasaur_king.asm : 247 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Helmasaur +org $1E8262 ; <- F0262 - sprite_helmasaur_king.asm : 373 (JSL GetRandomInt : AND.b #$01 : BEQ BRANCH_BETA) +JSL.l RNG_Helmasaur +org $1DEEE1 ; <- EEEE1 - sprite_helmasaur_fireball.asm : 236 (JSL GetRandomInt : STA $0FB6) +JSL.l RNG_Helmasaur +;-------------------------------------------------------------------------------- +org $1EB5F7 ; <- F35F7 - sprite_arrghus.asm : 328 (JSL GetRandomInt : AND.b #$3F : ADC.b #$30 : STA $0DF0, X) +JSL.l RNG_Arrghus +;-------------------------------------------------------------------------------- +org $1EBF4D ; <- F3F4D - sprite_mothula.asm : 180 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Mothula +org $1EBF60 ; <- F3F60 - sprite_mothula.asm : 187 (JSL GetRandomInt : AND.b #$1F : ADC.b #$40 : STA $0DF0, X) +JSL.l RNG_Mothula +org $1EBFBE ; <- F3FBE - sprite_mothula.asm : 261 (JSL GetRandomInt : AND.b #$1F : ORA.b #$40 : STA !beam_timer, X) +JSL.l RNG_Mothula +org $1EC095 ; <- F4095 - sprite_mothula.asm : 373 (JSL GetRandomInt : AND.b #$1F : CMP #$1E : BCC .already_in_range) +JSL.l RNG_Mothula +;-------------------------------------------------------------------------------- +org $1E957A ; <- F157A - sprite_kholdstare.asm : 209 (JSL GetRandomInt : AND.b #$3F : ADC.b #$20 : STA $0DF0, X) +JSL.l RNG_Kholdstare +org $1E95F0 ; <- F15F0 - sprite_kholdstare.asm : 289 (JSL GetRandomInt : AND.b #$3F : ADC.b #$60 : STA $0DF0, X) +JSL.l RNG_Kholdstare +org $1E95FB ; <- F15FB - sprite_kholdstare.asm : 291 (JSL GetRandomInt : PHA : AND.b #$03 : TAY) +JSL.l RNG_Kholdstare +org $1E96C9 ; <- F16C9 - sprite_kholdstare.asm : 453 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Kholdstare +org $1E96E5 ; <- F16E5 - sprite_kholdstare.asm : 458 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Kholdstare +org $1E97D5 ; <- F17D5 - sprite_kholdstare.asm : 605 (JSL GetRandomInt : AND.b #$04 : STA $0D) +JSL.l RNG_Kholdstare +;-------------------------------------------------------------------------------- +org $1DE5B4 ; <- EE5E4 - sprite_vitreous.asm : 207 (JSL GetRandomInt : AND.b #$0F : TAY) +JSL.l RNG_Vitreous +org $1DE626 ; <- EE626 - sprite_vitreous.asm : 255 (JSL GetRandomInt : AND.b #$07 : STA $0D90, Y) +JSL.l RNG_Vitreous +;-------------------------------------------------------------------------------- +org $1DB61C ; <- EB16C - sprite_trinexx.asm : 530 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Trinexx +org $1DB186 ; <- EB186 - sprite_trinexx.asm : 535 (JSL GetRandomInt : AND.b #$07 : TAY) +JSL.l RNG_Trinexx +org $1DB25E ; <- EB25E - sprite_trinexx.asm : 643 (JSL GetRandomInt : AND.b #$03 : TAY : CMP $00 : BEQ BRANCH_ALPHA) +JSL.l RNG_Trinexx +org $1DB28D ; <- EB28D - sprite_trinexx.asm : 661 (JSL GetRandomInt : AND.b #$03 : CMP.b #$01 : TYA : BCS BRANCH_GAMMA) +JSL.l RNG_Trinexx +org $1DB9B0 ; <- EB9B0 - sprite_sidenexx.asm : 165 (JSL GetRandomInt : AND.b #$07 : INC A : CMP.b #$05 : BCS BRANCH_ALPHA) +JSL.l RNG_Trinexx +org $1DB9CC ; <- EB9CC - sprite_sidenexx.asm : 175 (JSL GetRandomInt : LSR A : BCS BRANCH_ALPHA) +JSL.l RNG_Trinexx +org $1DBA5D ; <- EBA5D - sprite_sidenexx.asm : 270 (JSL GetRandomInt : AND.b #$0F : STA $0DF0, X) +JSL.l RNG_Trinexx +org $1DBAB1 ; <- EBAB1 - sprite_sidenexx.asm : 314 (JSL GetRandomInt : AND.b #$0F : LDY.b #$00 : SUB.b #$03) +JSL.l RNG_Trinexx +org $1DBAC3 ; <- EBAC3 - sprite_sidenexx.asm : 323 (JSL GetRandomInt : AND.b #$0F : ADD.b #$0C : STA $02 : STZ $03) +JSL.l RNG_Trinexx ;================================================================================ ; HUD Changes ;-------------------------------------------------------------------------------- @@ -782,10 +856,13 @@ JSL.l DrawMagicHeader NOP #17 ;-------------------------------------------------------------------------------- org $0DFB29 ; <- - headsup_display.asm : 688 (LDA.b #$86 : STA $7EC71E) -LDA.b #$86 : STA $7EC720 ; nudge silver arrow right -LDA.b #$24 : STA $7EC721 -LDA.b #$87 : STA $7EC722 -LDA.b #$24 : STA $7EC723 +;LDA.b #$86 : STA $7EC720 ; nudge silver arrow right - remember to update this in newit +;LDA.b #$24 : STA $7EC721 +;LDA.b #$87 : STA $7EC722 +;LDA.b #$24 : STA $7EC723 +JSL.l DrawHUDSilverArrows : BRA + + NOP #18 ++ ;-------------------------------------------------------------------------------- ; Insert our version of the hud tilemap org $0DFA96 ; <- 6FA96 - headsup_display.asm : 626 (LDX.w #.hud_tilemap) @@ -798,7 +875,7 @@ MVN $207E ;NOP ;-------------------------------------------------------------------------------- org $0DFB1F ; 6FB1F - headsup_display.asm : 681 (LDA $7EF340 : BEQ .hastNoBow) -JSL.l DrawHUDSilverArrows +JSL.l CheckHUDSilverArrows ;-------------------------------------------------------------------------------- ;================================================================================ diff --git a/inventory.asm b/inventory.asm index 52ed2b6..bd17368 100644 --- a/inventory.asm +++ b/inventory.asm @@ -950,7 +950,7 @@ SpawnShovelItem: LSR #2 : TAX ; clobber lower 2 bis - we have 64 slots now - LDA .spawn_table, X ; look up the drop on the table + LDA.l ShovelSpawnTable, X ; look up the drop on the table ;most of this part below is copied from the digging game @@ -995,22 +995,6 @@ RTL .x_offsets db $00 db $13 - -.spawn_table - db $B2 ; Gold Bee - db $D8, $D8, $D8 ; Single Heart - db $D8, $D8, $D8, $D8, $D8 ; Single Heart - db $D9, $D9, $D9, $D9, $D9 ; Green Rupee - db $DA, $DA, $DA, $DA, $DA ; Blue Rupee - db $DB, $DB, $DB, $DB, $DB ; Red Rupee - db $DC, $DC, $DC, $DC, $DC ; 1 Bomb - db $DD, $DD, $DD, $DD, $DD ; 4 Bombs - db $DE, $DE, $DE, $DE, $DE ; 8 Bombs - db $DF, $DF, $DF, $DF, $DF ; Small Magic - db $E0, $E0, $E0, $E0, $E0 ; Large Magic - db $E1, $E1, $E1, $E1, $E1 ; 5 Arrows - db $E2, $E2, $E2, $E2, $E2 ; 10 Arrows - db $E3, $E3, $E3, $E3, $E3 ; Fairy } ;-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/maidencrystals.asm b/maidencrystals.asm index 5cc664e..769e6d3 100644 --- a/maidencrystals.asm +++ b/maidencrystals.asm @@ -21,5 +21,7 @@ MaidenCrystalScript: LDA.b #$08 : STA $7EF3C7 ; Update the map icon to just be Ganon's Tower + + JSL.l MaybeWriteSRAMTrace + JMP $1ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426 ;-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/newitems.asm b/newitems.asm index 3578ad9..3daf9c9 100755 --- a/newitems.asm +++ b/newitems.asm @@ -655,17 +655,23 @@ RTL ; LDA.w #$11CE : STA $00 ; thing we wrote over ;RTL ;-------------------------------------------------------------------------------- -;Return $7EF340 unless no bow and silvers, then return 3 -DrawHUDSilverArrows: +;Return $7EF340 but also draw silver arrows if you have the upgrade even if you don't have the bow +CheckHUDSilverArrows: LDA $7EF340 : BNE + LDA $7EF414 : AND.b #$40 : BEQ ++ - LDA.b #$03 - RTL + JSL.l DrawHUDSilverArrows ++ LDA $7EF340 + RTL ;-------------------------------------------------------------------------------- +DrawHUDSilverArrows: + LDA.b #$86 : STA $7EC720 ; draw silver arrow marker + LDA.b #$24 : STA $7EC721 + LDA.b #$87 : STA $7EC722 + LDA.b #$24 : STA $7EC723 +RTL +;-------------------------------------------------------------------------------- !RNG_ITEM = "$7EF450" !SCRATCH_AREA = "$7F5020" !SINGLE_INDEX_TEMP = "$7F5020" diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index f48938a..1600349 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -117,10 +117,10 @@ CheckHeraObject: LDA CrystalPendantFlags_2_hera : BNE .crystal .pendant - LDA $7EF374 : AND.l CrystalPendantFlags_hera + LDA $7EF374 : AND.l CrystalPendantFlags_hera : AND.w #$00FF RTL .crystal - LDA $7EF37A : AND.l CrystalPendantFlags_hera + LDA $7EF37A : AND.l CrystalPendantFlags_hera : AND.w #$00FF RTL ;================================================================================ ;GetPendantCrystalWorld: diff --git a/previewdatacopy.asm b/previewdatacopy.asm index f2841c4..ca0da9b 100644 --- a/previewdatacopy.asm +++ b/previewdatacopy.asm @@ -1,6 +1,12 @@ ;================================================================================ ; RTPreview SRAM Hook ;-------------------------------------------------------------------------------- +MaybeWriteSRAMTrace: + LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ + + JSL.l WriteStatusPreview + + +RTL +;-------------------------------------------------------------------------------- WriteStatusPreview: PHA LDA $4300 : PHA ; preserve DMA parameters diff --git a/rngfixes.asm b/rngfixes.asm index 23804fc..c99c719 100644 --- a/rngfixes.asm +++ b/rngfixes.asm @@ -39,7 +39,7 @@ RNG_Lanmolas1: LDA.b #$00 : BRA _rng_done RNG_Moldorm1: LDA.b #$01 : BRA _rng_done -RNG_Agahnim1: +RNG_Agahnim1:;x LDA.b #$02 : BRA _rng_done RNG_Helmasaur: LDA.b #$03 : BRA _rng_done @@ -53,15 +53,15 @@ RNG_Vitreous: LDA.b #$07 : BRA _rng_done RNG_Trinexx: LDA.b #$08 : BRA _rng_done -RNG_Lanmolas2: +RNG_Lanmolas2:;x LDA.b #$09 : BRA _rng_done -RNG_Moldorm2: +RNG_Moldorm2:;x LDA.b #$0A : BRA _rng_done -RNG_Agahnim2: +RNG_Agahnim2:;x LDA.b #$0B : BRA _rng_done -RNG_Agahnim2Phantoms: +RNG_Agahnim2Phantoms:;x LDA.b #$0C : BRA _rng_done -RNG_Ganon: +RNG_Ganon:;x LDA.b #$0D _rng_done: JSL.l GetStaticRNG @@ -75,7 +75,7 @@ GetStaticRNG: PHX : PHP REP #$20 ; set 16-bit accumulator and index registers AND.w #$007F - ASL : TAX : LDA !RNG_POINTERS, X : INC : STA !RNG_POINTERS, X : TAX : ASL ; increment pointer and move value to X + ASL : TAX : LDA !RNG_POINTERS, X : INC : AND.w #$03FF : STA !RNG_POINTERS, X : TAX : ASL ; increment pointer and move value to X LDA Static_RNG, X ; load RNG value PLP : PLX RTL diff --git a/swordswap.asm b/swordswap.asm index 416ca79..c4c0611 100644 --- a/swordswap.asm +++ b/swordswap.asm @@ -30,6 +30,14 @@ LoadSwordForDamage: .done RTL ;================================================================================ +CheckGanonHammerDamage: + LDA.l HammerableGanon : BEQ + + LDA $0E20, X : CMP.b #$D8 ; original behavior except ganon +RTL + + + LDA $0E20, X : CMP.b #$D6 ; original behavior +RTL +;================================================================================ GetSmithSword: JSL ItemCheck_SmithSword : BEQ + : JMP.l Smithy_AlreadyGotSword : + LDA.l SmithItemMode : BNE + diff --git a/tables.asm b/tables.asm index b4b4f4b..c32b007 100644 --- a/tables.asm +++ b/tables.asm @@ -181,6 +181,23 @@ org $308086 ; PC 0x180086 GanonAgahRNG: db #$01 ; $00 = vanilla behavior, $01 = no extra blue balls/warps, $02 = use the random table ;-------------------------------------------------------------------------------- +org $308090 ; PC 0x180090 (0x40 bytes) +ShovelSpawnTable: + db $B2 ; Gold Bee + db $D8, $D8, $D8 ; Single Heart + db $D8, $D8, $D8, $D8, $D8 ; Single Heart + db $D9, $D9, $D9, $D9, $D9 ; Green Rupee + db $DA, $DA, $DA, $DA, $DA ; Blue Rupee + db $DB, $DB, $DB, $DB, $DB ; Red Rupee + db $DC, $DC, $DC, $DC, $DC ; 1 Bomb + db $DD, $DD, $DD, $DD, $DD ; 4 Bombs + db $DE, $DE, $DE, $DE, $DE ; 8 Bombs + db $DF, $DF, $DF, $DF, $DF ; Small Magic + db $E0, $E0, $E0, $E0, $E0 ; Large Magic + db $E1, $E1, $E1, $E1, $E1 ; 5 Arrows + db $E2, $E2, $E2, $E2, $E2 ; 10 Arrows + db $E3, $E3, $E3, $E3, $E3 ; Fairy +;-------------------------------------------------------------------------------- org $098B7C ; PC 0x48B7C EtherTablet: db #$10 ; #$10 = Ether