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

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