From cdf345248e8e993606e9a41b53565f21b8c3a577 Mon Sep 17 00:00:00 2001 From: sporchia Date: Sat, 15 Jun 2019 09:29:44 -0400 Subject: [PATCH] split GT and Ganon crystal checks something seems wrong with Inverted, will check later, or have someone else look into it --- LTTP_RND_GeneralBugfixes.asm | 1 + entrances.asm | 2 +- goalitem.asm | 40 +++++++++++++++++++++--------------- hooks.asm | 6 +++--- tables.asm | 9 ++++---- 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index dec162e..cd08f1e 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -191,6 +191,7 @@ incsrc stats/main.asm org $308000 ; bank #$30 incsrc tables.asm +; uncomment for inverted adjustments ;incsrc sandbox.asm org $318000 ; bank #$31 diff --git a/entrances.asm b/entrances.asm index 96149b0..b09f5b1 100644 --- a/entrances.asm +++ b/entrances.asm @@ -13,7 +13,7 @@ LockAgahnimDoors: + : CMP.w #$0002 : BNE + JSR.w LockAgahnimDoorsCore : BEQ .unlock SEP #$30 - JSL.l CheckEnoughCrystals + JSL.l CheckEnoughCrystalsForTower REP #$30 BEQ .crystalOrUnlock LDA #$0001 : RTL diff --git a/goalitem.asm b/goalitem.asm index 152c9cb..1386ce7 100644 --- a/goalitem.asm +++ b/goalitem.asm @@ -10,7 +10,7 @@ GoalItemGanonCheck: LDA $0E20, X : CMP.b #$D6 : BNE .success ; skip if not ganon JSL.l CheckGanonVulnerability BCS .success - + .fail LDA $0D80, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal LDA.b #$00 @@ -47,42 +47,48 @@ CheckGanonVulnerability: LDA.l !GOAL_COUNTER : CMP.b #100 : !BLT .fail ; require 100 goal items BRA .success + : CMP #$06 : BNE + - ;#$06 = Require "NumberOfCrystalsRequired" Crystals - JSL CheckEnoughCrystals : BCC .fail + ;#$06 = Require "NumberOfCrystalsRequiredForGanon" Crystals + JSL CheckEnoughCrystalsForGanon : BCC .fail BRA .success + .fail : CLC : RTL .success : SEC : RTL ;-------------------------------------------------------------------------------- -GetRequriedCrystals: +GetRequriedCrystalsForTower: BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over - LDA.l NumberOfCrystalsRequired : CMP.b #$00 : BNE + : JML.l Ancilla_BreakTowerSeal_stop_spawning_sparkles : + - LDA.l NumberOfCrystalsRequired : CMP.b #$01 : BNE + : JML.l Ancilla_BreakTowerSeal_draw_single_crystal : + - LDA.l NumberOfCrystalsRequired : DEC #2 : TAX -JML.l GetRequriedCrystals_continue + LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE + : JML.l Ancilla_BreakTowerSeal_stop_spawning_sparkles : + + LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$01 : BNE + : JML.l Ancilla_BreakTowerSeal_draw_single_crystal : + + LDA.l NumberOfCrystalsRequiredForTower : DEC #2 : TAX +JML.l GetRequriedCrystalsForTower_continue ;-------------------------------------------------------------------------------- GetRequriedCrystalsInX: - LDA.l NumberOfCrystalsRequired : CMP.b #$00 : BNE + + LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE + TAX RTL + - - TXA : - : CMP.l NumberOfCrystalsRequired : !BLT + : !SUB.l NumberOfCrystalsRequired : BRA - : + - - INC : CMP.l NumberOfCrystalsRequired : BNE + + + TXA : - : CMP.l NumberOfCrystalsRequiredForTower : !BLT + : !SUB.l NumberOfCrystalsRequiredForTower : BRA - : + + + INC : CMP.l NumberOfCrystalsRequiredForTower : BNE + LDA.b #$08 + : DEC : TAX RTL ;-------------------------------------------------------------------------------- -CheckEnoughCrystals: +CheckEnoughCrystalsForGanon: LDA InvincibleGanon : CMP #$06 : BNE .normal - .other PHX : PHY LDA $7EF37A : JSL CountBits ; the comparison is against 1 less PLY : PLX - CMP.l NumberOfCrystalsRequired + CMP.l NumberOfCrystalsRequiredForGanon RTL .normal LDA $7EF37A : AND.b #$7F : CMP.b #$7F ; thing we wrote over -RTL \ No newline at end of file +RTL +;-------------------------------------------------------------------------------- +CheckEnoughCrystalsForTower: + PHX : PHY + LDA $7EF37A : JSL CountBits ; the comparison is against 1 less + PLY : PLX + CMP.l NumberOfCrystalsRequiredForTower +RTL diff --git a/hooks.asm b/hooks.asm index f0b6838..96b6796 100755 --- a/hooks.asm +++ b/hooks.asm @@ -327,14 +327,14 @@ PreventEnterOnBonk_BRANCH_IX: ; Crystals Mode ;-------------------------------------------------------------------------------- org $099B7B ; <- ancilla_init.asm : 4136 (LDA $7EF37A : AND.b #$7F : CMP.b #$7F) -JSL.l CheckEnoughCrystals +JSL.l CheckEnoughCrystalsForTower NOP #4 db #$90 ; BCC ;-------------------------------------------------------------------------------- org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR BreakTowerSeal_ExecuteSparkles : LDX.b #$06) -JML.l GetRequriedCrystals +JML.l GetRequriedCrystalsForTower NOP #3 -GetRequriedCrystals_continue: +GetRequriedCrystalsForTower_continue: ;-------------------------------------------------------------------------------- org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX) JSL.l GetRequriedCrystalsInX diff --git a/tables.asm b/tables.asm index b22fe20..59afdd4 100644 --- a/tables.asm +++ b/tables.asm @@ -153,7 +153,7 @@ db #$00 ; #$03 = Require Crystals and Aga2 ; #$04 = Require Crystals ; #$05 = Require 100 Goal Items -; #$06 = Require "NumberOfCrystalsRequired" +; #$06 = Require "NumberOfCrystalsRequiredForGanon" ;-------------------------------------------------------------------------------- org $30803F ; PC 0x18003F HammerableGanon: @@ -257,10 +257,11 @@ CrystalPendantFlags_2: ;Crystal: $40 ;-------------------------------------------------------------------------------- org $30805E ; PC 0x18005E - Number of crystals required to enter GT -NumberOfCrystalsRequired: +NumberOfCrystalsRequiredForTower: +db #$07 ; #$07 = 7 Crystals +org $30805F ; PC 0x18005F - Number of crystals required to kill GT +NumberOfCrystalsRequiredForGanon: db #$07 ; #$07 = 7 Crystals -;-------------------------------------------------------------------------------- -; 0x18005F - 0x18005F (unused) ;-------------------------------------------------------------------------------- org $308060 ; PC 0x180060 - 0x18007E ProgrammableItemLogicJump_1: