initial commit

* the cut scene for 1 and 0 crystals is wrong, it always shows minimum
of 2 right now
* pretty sure the AGA door check will blow up
This commit is contained in:
sporchia
2018-09-25 22:13:35 -04:00
parent 7a204a0fb4
commit 1a6478aa27
6 changed files with 70 additions and 3 deletions

View File

@@ -476,6 +476,9 @@ Sprite_CheckIfPlayerPreoccupied:
org $08C3AE
Ancilla_ReceiveItem:
org $08CF59
BreakTowerSeal_ExecuteSparkles:
org $08F710
Ancilla_SetOam_XY_Long:

View File

@@ -12,7 +12,7 @@ LockAgahnimDoors:
JSR.w LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE +
JSR.w LockAgahnimDoorsCore : BEQ .unlock
LDA $7EF37A : AND.w #$007F : CMP.w #$007F : BEQ .crystalOrUnlock
JSL.l CheckEnoughCrystals : BEQ .crystalOrUnlock ; I think the registers might be wrong for this
LDA #$0001 : RTL
.crystalOrUnlock
LDA InvertedMode : AND.w #$00FF : BEQ .unlock

View File

@@ -46,7 +46,28 @@ 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 : BNE .fail
BRA .success
+
.fail : CLC : RTL
.success : SEC : RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
GetRequriedCrystals:
BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over
LDA.l NumberOfCrystalsRequired : DEC #2 : 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

View File

@@ -284,6 +284,21 @@ 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)
JSL.l GetRequriedCrystals
NOP #3
;--------------------------------------------------------------------------------
org $08CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS)
db #$6B
;--------------------------------------------------------------------------------
;================================================================================
; Hash Key Display

View File

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

View File

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