split GT and Ganon crystal checks

something seems wrong with Inverted, will check later, or have someone else look into it
This commit is contained in:
sporchia
2019-06-15 09:29:44 -04:00
parent d182c3343e
commit cdf345248e
5 changed files with 33 additions and 25 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForTower:
PHX : PHY
LDA $7EF37A : JSL CountBits ; the comparison is against 1 less
PLY : PLX
CMP.l NumberOfCrystalsRequiredForTower
RTL

View File

@@ -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

View File

@@ -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: