consolidate ganon defeat logic

This commit is contained in:
Kevin Cathcart
2019-08-03 11:55:40 -04:00
parent a4846a65d1
commit 1c0c82a510
3 changed files with 13 additions and 23 deletions

View File

@@ -34,34 +34,30 @@ CheckGanonVulnerability:
LDA $7EF2DB : AND.b #$20 : CMP #$20 : BNE .fail ; require aga2 defeated (pyramid hole open)
BRA .success
+ : CMP #$04 : BNE +
;#$04 = Require All Crystals
LDA $7EF37A : AND.b #$7F : CMP #$7F : BNE .fail ; require all crystals
;#$04 = Require Crystals
JSL CheckEnoughCrystalsForGanon : !BLT .fail ; require specified number of crystals
BRA .success
+ : CMP #$03 : BNE +
;#$03 = Require All Crystals and Aga 2
LDA $7EF37A : AND.b #$7F : CMP #$7F : BNE .fail ; require all crystals
;#$03 = Require Crystals and Aga 2
JSL CheckEnoughCrystalsForGanon : !BLT .fail ; require specified number of crystals
LDA $7EF2DB : AND.b #$20 : CMP #$20 : BNE .fail ; require aga2 defeated (pyramid hole open)
BRA .success
+ : CMP #$05 : BNE +
;#$05 = Require 100 Goal Items
LDA.l !GOAL_COUNTER : CMP.b #100 : !BLT .fail ; require 100 goal items
BRA .success
+ : CMP #$06 : BNE +
;#$06 = Require "NumberOfCrystalsRequiredForGanon" Crystals
JSL CheckEnoughCrystalsForGanon : BCC .fail
BRA .success
+
.fail : CLC : RTL
.success : SEC : RTL
;--------------------------------------------------------------------------------
GetRequriedCrystalsForTower:
GetRequiredCrystalsForTower:
BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over
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
JML.l GetRequiredCrystalsForTower_continue
;--------------------------------------------------------------------------------
GetRequriedCrystalsInX:
GetRequiredCrystalsInX:
LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE +
TAX
RTL
@@ -75,16 +71,11 @@ GetRequriedCrystalsInX:
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForGanon:
LDA InvincibleGanon : CMP #$06 : BNE .normal
PHX : PHY
LDA $7EF37A : JSL CountBits ; the comparison is against 1 less
PLY : PLX
CMP.l NumberOfCrystalsRequiredForGanon
RTL
.normal
LDA $7EF37A : AND.b #$7F : CMP.b #$7F ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForTower:
PHX : PHY

View File

@@ -380,12 +380,12 @@ NOP #4
db #$90 ; BCC
;--------------------------------------------------------------------------------
org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR BreakTowerSeal_ExecuteSparkles : LDX.b #$06)
JML.l GetRequriedCrystalsForTower
JML.l GetRequiredCrystalsForTower
NOP #3
GetRequriedCrystalsForTower_continue:
GetRequiredCrystalsForTower_continue:
;--------------------------------------------------------------------------------
org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX)
JSL.l GetRequriedCrystalsInX
JSL.l GetRequiredCrystalsInX
;--------------------------------------------------------------------------------
org $08CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS)
db #$6B

View File

@@ -150,10 +150,9 @@ db #$00
; #$00 = Off (default)
; #$01 = On
; #$02 = Require All Dungeons
; #$03 = Require Crystals and Aga2
; #$04 = Require Crystals
; #$03 = Require "NumberOfCrystalsRequiredForGanon" Crystals and Aga2
; #$04 = Require "NumberOfCrystalsRequiredForGanon" Crystals
; #$05 = Require 100 Goal Items
; #$06 = Require "NumberOfCrystalsRequiredForGanon"
;--------------------------------------------------------------------------------
org $30803F ; PC 0x18003F
HammerableGanon: