Merge pull request #50 from mmxbass/crystal-count-required
RFC: still have a few things to fix
This commit is contained in:
@@ -478,6 +478,15 @@ Sprite_CheckIfPlayerPreoccupied:
|
||||
org $08C3AE
|
||||
Ancilla_ReceiveItem:
|
||||
|
||||
org $08CE93
|
||||
Ancilla_BreakTowerSeal_draw_single_crystal:
|
||||
|
||||
org $08CEC3
|
||||
Ancilla_BreakTowerSeal_stop_spawning_sparkles:
|
||||
|
||||
org $08CF59
|
||||
BreakTowerSeal_ExecuteSparkles:
|
||||
|
||||
org $08F710
|
||||
Ancilla_SetOam_XY_Long:
|
||||
|
||||
|
||||
@@ -12,8 +12,11 @@ LockAgahnimDoors:
|
||||
JSR.w LockAgahnimDoorsCore : RTL
|
||||
+ : CMP.w #$0002 : BNE +
|
||||
JSR.w LockAgahnimDoorsCore : BEQ .unlock
|
||||
LDA $7EF37A : AND.w #$007F : CMP.w #$007F : BEQ .crystalOrUnlock
|
||||
LDA #$0001 : RTL
|
||||
SEP #$30
|
||||
JSL.l CheckEnoughCrystals
|
||||
REP #$30
|
||||
BEQ .crystalOrUnlock
|
||||
LDA #$0001 : RTL
|
||||
.crystalOrUnlock
|
||||
LDA InvertedMode : AND.w #$00FF : BEQ .unlock
|
||||
|
||||
|
||||
38
goalitem.asm
38
goalitem.asm
@@ -46,7 +46,43 @@ CheckGanonVulnerability:
|
||||
;#$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 "NumberOfCrystalsRequired" Crystals
|
||||
JSR CheckEnoughCrystals : BCC .fail
|
||||
BRA .success
|
||||
+
|
||||
.fail : CLC : RTL
|
||||
.success : SEC : RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
;--------------------------------------------------------------------------------
|
||||
GetRequriedCrystals:
|
||||
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
|
||||
;--------------------------------------------------------------------------------
|
||||
GetRequriedCrystalsInX:
|
||||
LDA.l NumberOfCrystalsRequired : CMP.b #$00 : BNE +
|
||||
TAX
|
||||
RTL
|
||||
+
|
||||
|
||||
TXA : - : CMP.l NumberOfCrystalsRequired : !BLT + : !SUB.l NumberOfCrystalsRequired : BRA - : +
|
||||
|
||||
INC : CMP.l NumberOfCrystalsRequired : BNE +
|
||||
LDA.b #$08
|
||||
+ : DEC : TAX
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
CheckEnoughCrystals:
|
||||
LDA InvincibleGanon : CMP #$06 : BNE .normal
|
||||
.other
|
||||
PHX : PHY
|
||||
LDA $7EF37A : JSL CountBits ; the comparison is against 1 less
|
||||
PLY : PLX
|
||||
CMP.l NumberOfCrystalsRequired
|
||||
RTL
|
||||
|
||||
.normal
|
||||
LDA $7EF37A : AND.b #$7F : CMP.b #$7F ; thing we wrote over
|
||||
RTL
|
||||
19
hooks.asm
19
hooks.asm
@@ -323,6 +323,25 @@ org $1BBD77 ; <- bank1B.asm : 308 (SEP #$30)
|
||||
PreventEnterOnBonk_BRANCH_IX:
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;================================================================================
|
||||
; Crystals Mode
|
||||
;--------------------------------------------------------------------------------
|
||||
org $099B7B ; <- ancilla_init.asm : 4136 (LDA $7EF37A : AND.b #$7F : CMP.b #$7F)
|
||||
JSL.l CheckEnoughCrystals
|
||||
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
|
||||
NOP #3
|
||||
GetRequriedCrystals_continue:
|
||||
;--------------------------------------------------------------------------------
|
||||
org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX)
|
||||
JSL.l GetRequriedCrystalsInX
|
||||
;--------------------------------------------------------------------------------
|
||||
org $08CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS)
|
||||
db #$6B
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;================================================================================
|
||||
; Hash Key Display
|
||||
|
||||
@@ -153,6 +153,7 @@ db #$00
|
||||
; #$03 = Require Crystals and Aga2
|
||||
; #$04 = Require Crystals
|
||||
; #$05 = Require 100 Goal Items
|
||||
; #$06 = Require "NumberOfCrystalsRequired"
|
||||
;--------------------------------------------------------------------------------
|
||||
org $30803F ; PC 0x18003F
|
||||
HammerableGanon:
|
||||
@@ -255,7 +256,11 @@ CrystalPendantFlags_2:
|
||||
;Pendant: $00
|
||||
;Crystal: $40
|
||||
;--------------------------------------------------------------------------------
|
||||
; 0x18005E - 0x18005F (unused)
|
||||
org $30805E ; PC 0x18005E - Number of crystals required to enter GT
|
||||
NumberOfCrystalsRequired:
|
||||
db #$07 ; #$07 = 7 Crystals
|
||||
;--------------------------------------------------------------------------------
|
||||
; 0x18005F - 0x18005F (unused)
|
||||
;--------------------------------------------------------------------------------
|
||||
org $308060 ; PC 0x180060 - 0x18007E
|
||||
ProgrammableItemLogicJump_1:
|
||||
|
||||
@@ -593,6 +593,29 @@ HexToDec:
|
||||
PLA
|
||||
RTL
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; CountBits
|
||||
; in: A(b) - Byte to count bits in
|
||||
; out: A(b) - sum of bits
|
||||
; caller is responsible for setting 8-bit mode and preserving X and Y
|
||||
;--------------------------------------------------------------------------------
|
||||
CountBits:
|
||||
PHB : PHK : PLB
|
||||
TAX ; Save a copy of value
|
||||
LSR #4 ; Shift down hi nybble, Leave <3> in C
|
||||
TAY ; And save <7:4> in Y
|
||||
TXA ; Recover value
|
||||
AND #$07 ; Put out <2:0> in X
|
||||
TAX ; And save in X
|
||||
LDA NybbleBitCounts, Y ; Fetch count for Y
|
||||
ADC NybbleBitCounts, X ; Add count for X & C
|
||||
PLB
|
||||
RTL
|
||||
|
||||
; Look up table of bit counts in the values $00-$0F
|
||||
NybbleBitCounts:
|
||||
db #00, #01, #01, #02, #01, #02, #02, #03, #01, #02, #02, #03, #02, #03, #03, #04
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user