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

View File

@@ -380,12 +380,12 @@ NOP #4
db #$90 ; BCC db #$90 ; BCC
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR BreakTowerSeal_ExecuteSparkles : LDX.b #$06) 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 NOP #3
GetRequriedCrystalsForTower_continue: GetRequiredCrystalsForTower_continue:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX) 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) org $08CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS)
db #$6B db #$6B

View File

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