Transformation mask refactor, CheckForSwordSwing

This commit is contained in:
scawful
2023-08-14 09:06:37 -04:00
parent b5c055cb54
commit 41b2b52750
6 changed files with 244 additions and 238 deletions

View File

@@ -5,28 +5,28 @@
; $7EF349 bunny hood RAM slot
;
; Adjustable speed table at the end
; db (0) $18: - Horizontal and vertical walking speed
; db (0) $18: - Horizontal and vertical walking speed
; (Default = 18)
; db (1) $10 - Diagonal walking speed
; db (1) $10 - Diagonal walking speed
; (Default = 10)
; db (2) $0a - Stairs walking speed
; db (2) $0a - Stairs walking speed
; (Default = 0A)
; db (0c) $14 - walking through heavy grass speed (also shallow water)
; db (0c) $14 - walking through heavy grass speed (also shallow water)
; (Default = 14)
; db (0d) $0d - walking diagonally through heavy grass speed (also shallow water)
; db (0d) $0d - walking diagonally through heavy grass speed (also shallow water)
; (Default = 0D)
; db (10) $40 - Pegasus boots speed (Default = 40)
; db (10) $40 - Pegasus boots speed (Default = 40)
;
; =============================================================================
org $378000
org $378000
incbin gfx/bunny_link.4bpp
; =============================================================================
UpdateBunnyPalette:
{
REP #$30 ; change 16bit mode
REP #$30 ; change 16bit mode
LDX #$001E
.loop
@@ -34,8 +34,8 @@ UpdateBunnyPalette:
DEX : DEX : BPL .loop
SEP #$30 ; go back to 8 bit mode
INC $15 ; update the palette
RTL ; or RTS depending on where you need it
INC $15 ; update the palette
RTL ; or RTS depending on where you need it
}
; =============================================================================
@@ -49,57 +49,59 @@ bunny_palette:
; =============================================================================
; Bunny Hood Speed Modification
org $87E330
org $87E330
JSR $FD66
CLC
org $87FD66
JSL $20AF20
JSL LinkState_BunnyHoodRun
RTS
org $20AF20
CPX.b #$11 : BCS end ; speed value upper bound check
LDA.w $0202 ; check the current item
CMP.b #$16 : BNE end ; is it the bunny hood?
LDA.w $02B2 ; did you put it on?
BEQ end
LDA $20AF70,X ; load new speed values
CLC
RTL
LinkState_BunnyHoodRun:
{
CPX.b #$11 : BCS .end ; speed value upper bound check
LDA.w $0202 ; check the current item
CMP.b #$16 : BNE .end ; is it the bunny hood?
LDA.w !CurrentMask ; did you put it on?
BEQ .end
LDA.l BunnySpeedTable, X ; load new speed values
CLC
RTL
end: {
LDA $87E227,X ; load native speed values
.end
LDA $87E227, X ; load native speed values
CLC
RTL
}
org $20AF70 ; this selects the new speed values
org $20AF70 ; this selects the new speed values
BunnySpeedTable:
{
db $20, $12, $0a, $18, $10, $08, $08, $04, $0c, $10, $09, $19, $14, $0d, $10, $08, $40
}
; =============================================================================
; Press R to transform into bunny form and run faster.
; =============================================================================
org $07A494
LinkItem_Ether:
{
JSR Link_CheckNewY_ButtonPress : BCC .return
LDA $3A : AND.b #$BF : STA $3A ; clear the Y button state
%CheckNewR_ButtonPress() : BEQ .return
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
%PlayerTransform()
LDA $02B2 : CMP #$04 : BEQ .unequip ; is the hood already on?
LDA $02B2 : CMP #$04 : BEQ .unequip ; is the hood already on?
JSL UpdateBunnyPalette
LDA #$37 : STA $BC ; change link's sprite
LDA #$37 : STA $BC ; change link's sprite
LDA #$04 : STA $02B2
BRA .return
.unequip
STZ $02B2
JSL Palette_ArmorAndGloves
LDA #$10 : STA $BC ; take the hood off
%ResetToLinkGraphics()
.return
CLC

View File

@@ -2,81 +2,45 @@
; Deku Mask
; =============================================================================
; =============================================================================
org $358000
org $358000
incbin gfx/deku_link.bin
; =============================================================================
org $07A64B ; formerly Quake
org $07A64B ; formerly Quake
LinkItem_DekuMask:
{
; Check for R button held
LDA $F2 : CMP #$10 : BNE .return
%CheckNewR_ButtonPress() : BEQ .return
JSR Link_CheckNewY_ButtonPress : BCC .return
LDA $3A : AND.b #$BF : STA $3A ; clear the Y button state
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
%PlayerTransform()
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
LDA $02B2 : CMP #$01 : BEQ .unequip ; is the deku mask on?
JSL Palette_ArmorAndGloves ; set the palette
LDA $02B2 : CMP #$01 : BEQ .unequip ; is the deku mask on?
JSL Palette_ArmorAndGloves ; set the palette
LDA.l $7EF359 : STA $0AA5 ; Store the current sword
LDA.l $7EF35A : STA $0AAF ; Store the current shield
LDA.b #$00 : STA $7EF359 : STA $7EF35A ; Clear the sword and shield
LDA #$02 : STA $7E03FC ; Set the override to Bow (pea shooter)
LDA.b #$00 : STA $7EF35A ; Clear the shield
LDA #$35 : STA $BC ; put the mask on
LDA #$01 : STA $02B2
LDA #$35 : STA $BC ; put the mask on
LDA #$01 : STA $02B2 ; set the deku mask flag
BRA .return
.unequip
JSL Palette_ArmorAndGloves
STZ $5D
; Restore the sword and shield
LDA $0AA5 : STA.l $7EF359
; Restore the shield
LDA $0AAF : STA.l $7EF35A
LDA #$00 : STA $7E03FC ; clear the override
LDA #$10 : STA $BC : STZ $02B2 ; take the mask off
%ResetToLinkGraphics()
.return
RTS
}
; =============================================================================
org $079CD9
JSL LinkItem_CheckForSwordSwing_Masks
; =============================================================================
org $318000
LinkItem_CheckForSwordSwing_Masks:
{
LDA $02B2 : CMP #$01 : BNE .return
LDA #$01
RTL
.return
LDA $3B : AND.b #$10
RTL
}
; =============================================================================
; org $07A013
; JSL LinkItem_SlingshotPrepare
@@ -111,62 +75,61 @@ LinkItem_SlingshotPrepare:
; $A309
.gamma
LDA #$01 ; Load the accumulator with hex value 01
STA $7F502E ; Store the accumulator value at memory address 7F502E
LDA #$01 ; Load the accumulator with hex value 01
STA $7F502E ; Store the accumulator value at memory address 7F502E
PHB ; Push data bank register on stack
REP #$30 ; Clear 16-bit accumulator and index registers
LDX #$A500 ; Load X register with source address
LDY #$9800 ; Load Y register with destination address
LDA #$00BF ; Load the accumulator with the number of bytes to be moved
MVN $20, $7E ; Block move negative - moves 00BF bytes from $A500 to $9800
SEP #$30 ; Set 8-bit accumulator and index registers
PLB ; Pull data bank register from stack
PHB ; Push data bank register on stack
REP #$30 ; Clear 16-bit accumulator and index registers
LDX #$A500 ; Load X register with source address
LDY #$9800 ; Load Y register with destination address
LDA #$00BF ; Load the accumulator with the number of bytes to be moved
MVN $20, $7E ; Block move negative - moves 00BF bytes from $A500 to $9800
SEP #$30 ; Set 8-bit accumulator and index registers
PLB ; Pull data bank register from stack
.loop
LDA $4212 : AND #$80 : BNE .loop ; Wait for VBlank start (beginning of vertical blanking period)
LDA $4212 : AND #$80 : BNE .loop ; Wait for VBlank start (beginning of vertical blanking period)
.loop2
LDA $4212 : AND #$80 : BEQ .loop2 ; Wait for VBlank end
LDA $4212 : AND #$80 : BEQ .loop2 ; Wait for VBlank end
REP #$30 ; Clear 16-bit accumulator and index registers
LDA #$A700 : STA $4302 ; Set DMA source address to $A700
LDA #$42A0 : STA $2116 ; Set VRAM (Video RAM) address to $42A0
SEP #$30 ; Set 8-bit accumulator and index registers
REP #$30 ; Clear 16-bit accumulator and index registers
LDA #$A700 : STA $4302 ; Set DMA source address to $A700
LDA #$42A0 : STA $2116 ; Set VRAM (Video RAM) address to $42A0
SEP #$30 ; Set 8-bit accumulator and index registers
LDA #$80 : STA $2115 ; Set VRAM write increment to 2 bytes, and access mode to word access at the specified address
LDA #$18 : STA $4301 ; Set DMA destination address to $2118 (VRAM data write)
LDA #$20 : STA $4304 ; Set DMA transfer size to 32 bytes
LDA #$80 : STA $4305 ; Set DMA transfer size (high byte)
LDA #$01 : STA $4300 ; Set DMA mode to 1 (2 registers write once)
STA $420B ; Start DMA on channel 0
LDA #$80 : STA $2115 ; Set VRAM write increment to 2 bytes, and access mode to word access at the specified address
LDA #$18 : STA $4301 ; Set DMA destination address to $2118 (VRAM data write)
LDA #$20 : STA $4304 ; Set DMA transfer size to 32 bytes
LDA #$80 : STA $4305 ; Set DMA transfer size (high byte)
LDA #$01 : STA $4300 ; Set DMA mode to 1 (2 registers write once)
STA $420B ; Start DMA on channel 0
REP #$30 ; Clear 16-bit accumulator and index registers
LDA #$43A0 : STA $2116 ; Set VRAM address to $43A0
LDA #$A800 : STA $4302 ; Set DMA source address to $A800
SEP #$30 ; Set 8-bit accumulator and index registers
REP #$30 ; Clear 16-bit accumulator and index registers
LDA #$43A0 : STA $2116 ; Set VRAM address to $43A0
LDA #$A800 : STA $4302 ; Set DMA source address to $A800
SEP #$30 ; Set 8-bit accumulator and index registers
LDA #$80 : STA $2115 ; Set VRAM write increment to 2 bytes, and access mode to word access at the specified address
LDA #$18 : STA $4301 ; Set DMA destination address to $2118 (VRAM data write)
LDA #$20 : STA $4304 ; Set DMA transfer size to 32 bytes
LDA #$80 : STA $4305 ; Set DMA transfer size (high byte)
LDA #$01 : STA $4300 ; Set DMA mode to 1 (2 registers write once)
STA $420B ; Start DMA on channel 0
RTL ; Return from subroutine long
LDA #$80 : STA $2115 ; Set VRAM write increment to 2 bytes, and access mode to word access at the specified address
LDA #$18 : STA $4301 ; Set DMA destination address to $2118 (VRAM data write)
LDA #$20 : STA $4304 ; Set DMA transfer size to 32 bytes
LDA #$80 : STA $4305 ; Set DMA transfer size (high byte)
LDA #$01 : STA $4300 ; Set DMA mode to 1 (2 registers write once)
STA $420B ; Start DMA on channel 0
RTL ; Return from subroutine long
}
; =============================================================================
org $07811A
org $07811A
JSR Link_HandleDekuTransformation
; Bank 07 Free Space
; TODO: CHECK IF THIS ACTUALLY EXECUTES CAUSE I'M NOT SURE IT DOES
pullpc
Link_HandleDekuTransformation:
pullpc ; Bank 07 Free Space from minish_form
Link_HandleDekuTransformation: ; Link_HandleBunnyTransformation
{
LDA $5D : CMP.b #$0A : BEQ .continue
; Check if using Quake Medallion
LDA $5D : CMP.b #$0A : BEQ .continue
JSR $82DA
.continue

View File

@@ -1,5 +1,10 @@
; =============================================================================
; Change Link Sprite with $BC
; Oracle of Secrets - Mask Library
; =============================================================================
!CurrentMask = $02B2
!LinkGraphics = $BC
; =============================================================================
org $09912C
@@ -11,24 +16,50 @@ org $07B073
org $078028
Player_DoSfx2:
; =============================================================================
macro PlayerTransform()
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
endmacro
; Link Sprite hook
org $008A01
LDA $BC
macro ResetToLinkGraphics()
STZ !CurrentMask
JSL Palette_ArmorAndGloves
LDA.b #$10 : STA !LinkGraphics
endmacro
macro CheckNewR_ButtonPress()
LDA.b $F6 : BIT.b #$10
endmacro
; =============================================================================
; Change Link's sprite by setting $BC to the bank containing a spritesheet.
; =============================================================================
org $008827
JSL StartupMasks
; Link Sprite hook before game starts
org $008A01
LDA $BC
; =============================================================================
; Change Link's palette based on $02B2 (mask value)
; =============================================================================
org $1BEDF9
JSL Palette_ArmorAndGloves ; 4bytes
RTL ; 1byte
RTL ; 1byte
NOP #$01
org $1BEE1B
JSL Palette_ArmorAndGloves_part_two
RTL
; =============================================================================
; EXPANDED SPACE
; =============================================================================
org $3A8000
StartupMasks:
{
@@ -46,49 +77,50 @@ StartupMasks:
Palette_ArmorAndGloves:
{
LDA $02B2 : CMP #$01 : BEQ .deku_mask
LDA $02B2 : CMP #$01 : BEQ .deku_mask
CMP.b #$02 : BEQ .zora_mask
CMP.b #$03 : BEQ .wolf_mask
CMP.b #$04 : BEQ .bunny_hood
CMP.b #$05 : BEQ .minish_form
JMP .original_sprite
JMP .original_sprite
.deku_mask
LDA.b #$35 : STA $BC ; Load Deku Mask Location
JMP .original_palette
; Load Deku Mask Location
LDA.b #$35 : STA $BC : JMP .original_palette
.zora_mask
LDA.b #$36 : STA $BC ; Load Zora Mask Location
JMP .original_palette
; Load Zora Mask Location
LDA.b #$36 : STA $BC : JMP .original_palette
.wolf_mask
LDA.b #$38 : STA $BC ; Load Wolf Mask Location
JSL $38F000
; Load Wolf Mask Location
LDA.b #$38 : STA $BC : JSL $38F000
RTL
.bunny_hood
LDA.b #$37 : STA $BC ; Load Bunny Hood Location
JSL $37F000
; Load Bunny Hood Location
LDA.b #$37 : STA $BC : JSL $37F000
RTL
.minish_form
LDA.b #$39 : STA $BC ; Load Minish Form Location
JMP .original_palette
RTL
; Load Minish Form Location
LDA.b #$39 : STA $BC : JMP .original_palette
; RTL
.original_sprite
LDA.b #$10 : STA $BC ; Load Original Sprite Location
; Load Original Sprite Location
LDA.b #$10 : STA $BC
.original_palette
REP #$21
LDA $7EF35B ; Link's armor value
JSL $1BEDFF ; Read Original Palette Code
LDA $7EF35B ; Link's armor value
JSL $1BEDFF ; Read Original Palette Code
RTL
.part_two
SEP #$30
REP #$30
LDA.w #$0000 ; Ignore glove color modifier $7EF354
JSL $1BEE21 ; Read Original Palette Code
REP #$30
LDA.w #$0000 ; Ignore glove color modifier $7EF354
JSL $1BEE21 ; Read Original Palette Code
RTL
PHX : PHY : PHA
@@ -131,9 +163,12 @@ Palette_ArmorAndGloves:
; =============================================================================
; Overworld Palette Persist
; =============================================================================
Overworld_CgramAuxToMain_Override:
{
; copies the auxiliary CGRAM buffer to the main one and causes NMI to reupload the palette.
; Copies the auxiliary CGRAM buffer to the main one
; Causes NMI to reupload the palette.
REP #$20
@@ -161,6 +196,7 @@ Overworld_CgramAuxToMain_Override:
RTL
}
pushpc
; =============================================================================
@@ -171,4 +207,27 @@ Overworld_CgramAuxToMain:
RTS
}
; =============================================================================
; =============================================================================
; Change which mask forms have access to the sword.
; =============================================================================
org $079CD9
JSL LinkItem_CheckForSwordSwing_Masks
; =============================================================================
pullpc
LinkItem_CheckForSwordSwing_Masks:
{
LDA $02B2 : BEQ .return
CMP.b #$02 : BEQ .return ; zora mask can use sword
LDA #$01
RTL
.return
LDA $3B : AND.b #$10
RTL
}
; =============================================================================

View File

@@ -4,14 +4,16 @@
; Reacts to Tile ID 64 to transform into Minish Link
; =============================================================================
org $398000
org $398000
incbin gfx/minish_link.4bpp
; =============================================================================
org $07DA2A
org $07DA2A
TileDetection_OverworldAttributeJumpTable:
; org $07DAEB ; Tile ID 61
org $07DAF2
dw LinkState_CheckForMinishForm ; Tile ID 64
dw LinkState_CheckMinishTile ; Tile ID 65
@@ -23,31 +25,25 @@ org $07F89D
LinkState_CheckForMinishForm:
{
SEP #$30
; Check for the R button (like minish cap)
LDA.b $F6 : BIT.b #$10 : BNE .r_button_press
BRA .return
.r_button_press
%CheckNewR_ButtonPress() : BEQ .return
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
LDA !CurrentMask
CMP.b #$05 : BEQ .already_minish ; return to human form
CMP.b #$00 : BNE .return ; don't transform if not human
%PlayerTransform()
LDA $02B2 : CMP.b #$05 : BEQ .already_minish
LDA.l $7EF359 : STA $0AA5 ; Store the current sword
LDA.l $7EF35A : STA $0AAF ; Store the current shield
LDA.b #$00 : STA $7EF359 : STA $7EF35A ; Clear the sword and shield
LDA.b #$00 : STA $7EF35A ; Clear the shield
LDA #$39 : STA $BC ; change link's sprite
LDA #$39 : STA $BC ; Change link's sprite
LDA #$05 : STA $02B2 ; Set the current mask form
BRA .return
.already_minish
STZ $02B2
LDA $0AA5 : STA.l $7EF359
%PlayerTransform()
%ResetToLinkGraphics()
LDA $0AAF : STA.l $7EF35A
LDA #$10 : STA $BC
.return
REP #$30
@@ -58,8 +54,8 @@ LinkState_CheckForMinishForm:
LinkState_CheckMinishTile:
{
LDA $02B2 : BEQ .blocked ; no form
CMP.b #$05 : BNE .blocked ; not minish
LDA $02B2 : BEQ .blocked ; no form
CMP.b #$05 : BNE .blocked ; not minish
LDA $0A : TSB $0343
RTS

View File

@@ -6,14 +6,14 @@
;
; =============================================================================
org $388000
org $388000
incbin gfx/wolf_link.4bpp
; =============================================================================
UpdateWolfPalette:
{
REP #$30 ; change 16bit mode
REP #$30 ; change 16bit mode
LDX #$001E
.loop
@@ -21,8 +21,8 @@ UpdateWolfPalette:
DEX : DEX : BPL .loop
SEP #$30 ; go back to 8 bit mode
INC $15 ; update the palette
RTL ; or RTS depending on where you need it
INC $15 ; update the palette
RTL ; or RTS depending on where you need it
}
; =============================================================================
@@ -58,33 +58,32 @@ LinkItem_ShovelAndFlute:
; Bank 07 Free Space
pullpc
print pc
LinkItem_WolfMask:
{
SEP #$30
LDA $02B2 : CMP #$03 : BNE .equip
JSR LinkItem_Shovel
.equip
; Check for R button press
LDA.b $F6 : BIT.b #$10 : BEQ .return
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
%CheckNewR_ButtonPress() : BEQ .return
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
%PlayerTransform()
LDA $02B2 : CMP #$03 : BEQ .unequip ; is the wolf mask already on?
JSL UpdateWolfPalette
LDA #$38 : STA $BC ; change link's sprite
LDA #$38 : STA $BC ; change link's sprite
LDA #$03 : STA $02B2
BRA .return
.unequip
STZ $02B2
JSL Palette_ArmorAndGloves
LDA #$10 : STA $BC ; take the mask off
%ResetToLinkGraphics()
.return
CLC
REP #$30
RTS
}

View File

@@ -16,22 +16,22 @@
;
; =============================================================================
org $368000
org $368000
incbin gfx/zora_link.4bpp
; =============================================================================
UpdateZoraPalette:
{
REP #$30 ; change 16 bit mode
REP #$30 ; change 16 bit mode
LDX #$001E
.loop
LDA.l zora_palette, X : STA $7EC6E0, X
DEX : DEX : BPL .loop
SEP #$30 ; go back to 8 bit mode
INC $15 ; update the palette
SEP #$30 ; go back to 8 bit mode
INC $15 ; update the palette
RTL
}
@@ -55,26 +55,21 @@ org $07A569
LinkItem_ZoraMask:
{
; Check for R button held
LDA $F2 : CMP #$10 : BNE .return
%CheckNewR_ButtonPress() : BEQ .return
JSR Link_CheckNewY_ButtonPress : BCC .return
LDA $3A : AND.b #$BF : STA $3A ; clear the Y button state
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
%PlayerTransform()
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
LDA $02B2 : CMP #$02 : BEQ .unequip ; is the zora mask on?
JSL UpdateZoraPalette
LDA #$36 : STA $BC
LDA #$02 : STA $02B2
LDA $02B2 : CMP #$02 : BEQ .unequip ; is the zora mask on?
JSL UpdateZoraPalette ; change links palette
LDA #$36 : STA $BC ; change links graphics
LDA #$02 : STA $02B2 ; set the zora mask on
BRA .return
.unequip
JSL Palette_ArmorAndGloves
LDA #$10 : STA $BC : STZ $02B2 ; take the mask off
%ResetToLinkGraphics()
.return
CLC
@@ -102,11 +97,7 @@ org $07C307
; =============================================================================
; Bank07 Free Space
; Predecessor: Wolf Mask I think
; org $07F95D
pullpc
pullpc ; Bank07 Free Space from Deku Mask
LinkState_UsingZoraMask:
{
; Check if the mask is equipped
@@ -133,15 +124,15 @@ LinkState_UsingZoraMask:
{
; Check the Y button and clear state if activated
JSR Link_CheckNewY_ButtonPress : BCC .return
LDA $3A : AND.b #$BF : STA $3A
LDA $3A : AND.b #$BF : STA $3A
; Check if already underwater
LDA $0AAB : BEQ .dive
STZ $55 ; Reset cape flag
STZ $0AAB ; Reset underwater flag
STZ $0351 ; Reset ripple flag
STZ $037B ; Reset invincibility flag
STZ $55 ; Reset cape flag
STZ $0AAB ; Reset underwater flag
STZ $0351 ; Reset ripple flag
STZ $037B ; Reset invincibility flag
LDA #$04 : STA $5D ; Put Link in Swimming State
JMP .return
@@ -156,7 +147,7 @@ LinkState_UsingZoraMask:
; Splash visual effect
LDA.b #$15 : LDY.b #$00
JSL AddTransitionSplash
JSL AddTransitionSplash
; Stay in swimming mode
LDA #$04 : STA $5D
@@ -175,33 +166,33 @@ LinkState_UsingZoraMask:
LDA $5D : CMP #$04 : BNE .return_dungeon : CLC
; Check if already underwater
LDA $0AAB : BNE .return_dungeon : CLC
LDA $0AAB : BNE .return_dungeon : CLC
; Check if we are on a proper tile or not
;
; Check the Y button and clear state if activated
JSR Link_CheckNewY_ButtonPress : BCC .return_dungeon
LDA $3A : AND.b #$BF : STA $3A
LDA $3A : AND.b #$BF : STA $3A
.dive_dungeon
; Splash effect
LDA.b #$15 : LDY.b #$00
JSL AddTransitionSplash
JSL AddTransitionSplash
STZ $5D ; reset player to ground state
STZ $EE ; move link to lower level
STZ $5D ; reset player to ground state
STZ $EE ; move link to lower level
LDA #$72
STA $9A ; Set layer
STA $9A ; Set layer
LDA #$08
STA $5E ; Set the player speed
STA $5E ; Set the player speed
STZ $0345
LDA #$01
STA $0AAB ; Set the player underwater flag
STA $0AAB ; Set the player underwater flag
.return_dungeon
JSR $E8F0 ; HandleIndoorCameraAndDoors
@@ -226,7 +217,7 @@ LinkState_UsingZoraMask:
; Check the Y button and clear state if activated
JSR Link_CheckNewY_ButtonPress : BCC .return_default
LDA $3A : AND.b #$BF : STA $3A
LDA $3A : AND.b #$BF : STA $3A
{
; Restore Swimming Effects
LDA.b #$15 : LDY.b #$00 : JSL AddTransitionSplash
@@ -238,12 +229,12 @@ LinkState_UsingZoraMask:
; Remove Diving Effects
LDA $67 : AND #$01 : STA $2F
STZ $5E ; Reset speed to normal
STZ $0AAB ; Reset underwater flag
STZ $0351 ; Reset ripple flag
STZ $24 ; Reset z coordinate for link
STZ $0372 ; Reset link bounce flag
LDA #$62 : STA $9A ; Reset dungeon layer
STZ $5E ; Reset speed to normal
STZ $0AAB ; Reset underwater flag
STZ $0351 ; Reset ripple flag
STZ $24 ; Reset z coordinate for link
STZ $0372 ; Reset link bounce flag
LDA #$62 : STA $9A ; Reset dungeon layer
JMP .return_default
}
@@ -256,21 +247,18 @@ LinkState_UsingZoraMask:
.dungeon_stairs
{
LDA $02B2 : CMP #$02 : BNE .return_hop
STZ $5E ; Reset speed to normal
STZ $0AAB ; Reset underwater flag
LDA #$62 : STA $9A ; Reset dungeon layer
STZ $5E ; Reset speed to normal
STZ $0AAB ; Reset underwater flag
LDA #$62 : STA $9A ; Reset dungeon layer
.return_hop
LDA #$06 : STA $5D ; Set Link to Recoil State
RTS
}
print "==> LinkState_UsingZoraMask ", pc
; =============================================================================
; TODO: Make this so it does not cancel if $0202 is still the same mask
; corresponding to the form the player is in.
; Also, prevent this from canceling minish form.
; org $07FA55
LinkState_ResetMaskAnimated:
{
LDA $02B2 : BEQ .no_mask
@@ -284,7 +272,7 @@ LinkState_ResetMaskAnimated:
.transform
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
STZ $02B2
@@ -294,5 +282,4 @@ LinkState_ResetMaskAnimated:
RTL
}
print "==> LinkState_ResetMaskAnimated ", pc
pushpc