Add Link_Transform mask, uses A for mask id and sets carry on successful transformation

This commit is contained in:
scawful
2024-05-04 18:09:22 -04:00
parent 675d442a3f
commit 2128aba55d
6 changed files with 118 additions and 135 deletions

View File

@@ -1,4 +1,4 @@
; ============================================================================= ; =========================================================
; Bunny Hood Item ; Bunny Hood Item
; Makes Link run quicker when holding ; Makes Link run quicker when holding
; Written by Conn (I think) ; Written by Conn (I think)
@@ -17,7 +17,7 @@
; (Default = 0D) ; (Default = 0D)
; db (10) $40 - Pegasus boots speed (Default = 40) ; db (10) $40 - Pegasus boots speed (Default = 40)
; ;
; ============================================================================= ; =========================================================
UpdateBunnyPalette: UpdateBunnyPalette:
{ {
@@ -33,7 +33,7 @@ UpdateBunnyPalette:
RTL ; or RTS depending on where you need it RTL ; or RTS depending on where you need it
} }
; ============================================================================= ; =========================================================
bunny_palette: bunny_palette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6 dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6
@@ -43,7 +43,7 @@ bunny_palette:
print "End of Bunny Hood GFX ", pc print "End of Bunny Hood GFX ", pc
; ============================================================================= ; =========================================================
; Bunny Hood Speed Modification ; Bunny Hood Speed Modification
org $07E330 org $07E330
@@ -81,30 +81,15 @@ BunnySpeedTable:
db $20, $12, $0a, $18, $10, $08, $08, $04, $0c, $10, $09, $19, $14, $0d, $10, $08, $40 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. ; Press R to transform into bunny form and run faster.
; ============================================================================= ; =========================================================
org $07A494 org $07A494
LinkItem_Ether: LinkItem_Ether:
{ {
%CheckNewR_ButtonPress() : BEQ .return LDA #$04
LDA $6C : BNE .return ; in a doorway JSL Link_TransformMask
LDA $0FFC : BNE .return ; can't open menu
%PlayerTransform()
LDA $02B2 : CMP #$04 : BEQ .unequip ; is the hood already on?
JSL UpdateBunnyPalette
LDA #$37 : STA $BC ; change link's sprite
LDA #$04 : STA $02B2
BRA .return
.unequip
%ResetToLinkGraphics()
.return
CLC
RTS RTS
} }

View File

@@ -4,16 +4,16 @@
UpdateDekuPalette: UpdateDekuPalette:
{ {
REP #$30 ; change 16bit mode REP #$30 ; change 16bit mode
LDX #$001E LDX #$001E
.loop .loop
LDA.l deku_palette, X : STA $7EC6E0, X LDA.l deku_palette, X : STA $7EC6E0, X
DEX : DEX : BPL .loop DEX : DEX : BPL .loop
SEP #$30 ; go back to 8 bit mode SEP #$30 ; go back to 8 bit mode
INC $15 ; update the palette INC $15 ; update the palette
RTL ; or RTS depending on where you need it RTL ; or RTS depending on where you need it
} }
deku_palette: deku_palette:
@@ -30,30 +30,17 @@ LinkItem_DekuMask:
RTS RTS
.continue .continue
%CheckNewR_ButtonPress() : BEQ .return LDA #$01
LDA $6C : BNE .return ; in a doorway JSL Link_TransformMask : BCC .return
LDA $0FFC : BNE .return ; can't open menu STA $02F5 ; Somaria platform flag, no dash.
%PlayerTransform() ; .unequip
LDA $02B2 : CMP #$01 : BEQ .unequip ; is the deku mask on? ; STZ $5D
; ; Restore the shield
; LDA $0AAF : STA.l $7EF35A
; STZ $02F5
LDA.l $7EF35A : STA $0AAF ; Store the current shield ; %ResetToLinkGraphics()
LDA.b #$00 : STA $7EF35A ; Clear the shield
LDA #$35 : STA $BC ; put the mask on
JSL UpdateDekuPalette ; set the palette
LDA #$01 : STA $02B2 ; set the deku mask flag
STA $02F5 ; Somaria platform flag, no dash.
BRA .return
.unequip
STZ $5D
; Restore the shield
LDA $0AAF : STA.l $7EF35A
STZ $02F5
%ResetToLinkGraphics()
.return .return
RTS RTS

View File

@@ -251,8 +251,6 @@ Overworld_CgramAuxToMain:
org $079CD9 org $079CD9
JSL LinkItem_CheckForSwordSwing_Masks JSL LinkItem_CheckForSwordSwing_Masks
; =========================================================
pullpc pullpc
LinkItem_CheckForSwordSwing_Masks: LinkItem_CheckForSwordSwing_Masks:
{ {
@@ -268,6 +266,52 @@ LinkItem_CheckForSwordSwing_Masks:
RTL RTL
} }
; =========================================================
; Common Mask Transformation Routine
; A = Mask ID
; Carry clear = no transform press/cant use mask
Link_TransformMask:
{
PHB : PHK : PLB
PHA ; save mask ID
%CheckNewR_ButtonPress() : BEQ .return
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
%PlayerTransform()
PLA ; restore mask ID
TAY
; LDA $02B2
CPY !CurrentMask : BEQ .unequip ; is the deku mask on?
STA $02B2 ; set the mask ID
TAX ; save mask ID in X
LDA .mask_gfx, X : STA $BC ; put the mask on
JSL Palette_ArmorAndGloves ; set the palette
STA $02F5 ; Somaria platform flag, no dash.
PLB
SEC
RTL
.unequip
STZ $5D
STZ $02F5
%ResetToLinkGraphics()
PLB : CLC : RTL
.return
PLA : PLB : CLC : RTL
.mask_gfx
db $00, $35, $36, $38, $37, $39, $3A, $3B
}
; =========================================================
; Modifies the value of the Y register before it indexes the table ; Modifies the value of the Y register before it indexes the table
; LinkOAM_AnimationStepDataOffsets ; LinkOAM_AnimationStepDataOffsets
; This is used to change the animation during 0x0A (Using Quake Medallion) ; This is used to change the animation during 0x0A (Using Quake Medallion)

View File

@@ -57,20 +57,18 @@ LinkState_CheckForMinishForm:
RTS RTS
} }
; ============================================================================= ; =========================================================
LinkState_CheckMinishTile: LinkState_CheckMinishTile:
{ {
LDA $02B2 : BEQ .blocked ; no form LDA $02B2 : BEQ .blocked ; no form
CMP.b #$05 : BNE .blocked ; not minish CMP.b #$05 : BNE .blocked ; not minish
LDA $0A : TSB $0343
RTS
LDA $0A : TSB $0343 .blocked
RTS LDA $0A : TSB $0E ; Blocked
RTS
.blocked
LDA $0A : TSB $0E ; Blocked
RTS
} }
print "End of Masks/minish_form.asm ", pc print "End of Masks/minish_form.asm ", pc

View File

@@ -1,26 +1,26 @@
; ============================================================================= ; =========================================================
; Wolf Mask ; Wolf Mask
; ;
; Talk to animals ; Talk to animals
; Dig for treasure ability (shovel) ; Dig for treasure ability (shovel)
; ;
; ============================================================================= ; =========================================================
UpdateWolfPalette: UpdateWolfPalette:
{ {
REP #$30 ; change 16bit mode REP #$30 ; change 16bit mode
LDX #$001E LDX #$001E
.loop .loop
LDA.l WolfPalette, X : STA $7EC6E0, X LDA.l WolfPalette, X : STA $7EC6E0, X
DEX : DEX : BPL .loop DEX : DEX : BPL .loop
SEP #$30 ; go back to 8 bit mode SEP #$30 ; go back to 8 bit mode
INC $15 ; update the palette INC $15 ; update the palette
RTL ; or RTS depending on where you need it RTL ; or RTS depending on where you need it
} }
; ============================================================================= ; =========================================================
WolfPalette: WolfPalette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$1A3D, #$14B6 dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$1A3D, #$14B6
@@ -28,7 +28,7 @@ WolfPalette:
dw #$6565, #$7271, #$14B5, #$459B, #$3D95, #$22D0, #$567C, #$1890 dw #$6565, #$7271, #$14B5, #$459B, #$3D95, #$22D0, #$567C, #$1890
dw #$7616, #$0000 dw #$7616, #$0000
; ============================================================================= ; =========================================================
org $07A3DB org $07A3DB
LinkItem_Flute: LinkItem_Flute:
@@ -36,7 +36,7 @@ org $07A3DB
org $07A32C org $07A32C
LinkItem_Shovel: LinkItem_Shovel:
; ============================================================================= ; =========================================================
org $07A313 org $07A313
LinkItem_ShovelAndFlute: LinkItem_ShovelAndFlute:
@@ -50,38 +50,22 @@ LinkItem_ShovelAndFlute:
} }
; warnpc $07A31F ; warnpc $07A31F
; ============================================================================= ; =========================================================
; Bank 07 Free Space ; Bank 07 Free Space
pullpc pullpc
LinkItem_WolfMask: LinkItem_WolfMask:
{ {
; SEP #$30 LDA $02B2 : CMP #$03 : BNE .equip
LDA $02B2 : CMP #$03 : BNE .equip JSR LinkItem_Shovel
JSR LinkItem_Shovel
.equip .equip
; Check for R button press LDA.b #$03
%CheckNewR_ButtonPress() : BEQ .return JSL Link_TransformMask
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
%PlayerTransform() .return
RTS
LDA $02B2 : CMP #$03 : BEQ .unequip ; is the wolf mask already on?
JSL UpdateWolfPalette
LDA #$38 : STA $BC ; change link's sprite
LDA #$03 : STA $02B2
BRA .return
.unequip
%ResetToLinkGraphics()
.return
; REP #$30
RTS
} }
print "End of Masks/wolf_mask.asm ", pc print "End of Masks/wolf_mask.asm ", pc

View File

@@ -1,4 +1,4 @@
; ============================================================================= ; =========================================================
; Zora Mask - by scawful ; Zora Mask - by scawful
; Based on the Fairy Flippers item by Conn ; Based on the Fairy Flippers item by Conn
; Special Thanks to Zarby89 for the PaletteArmorAndGloves hook ; Special Thanks to Zarby89 for the PaletteArmorAndGloves hook
@@ -9,20 +9,20 @@
; How To Use: ; How To Use:
; Press R to transform into Zora Link. Press R again to transform back. ; Press R to transform into Zora Link. Press R again to transform back.
; Press Y in deep water to dive. Press Y again to resurface. ; Press Y in deep water to dive. Press Y again to resurface.
; ============================================================================= ; =========================================================
UpdateZoraPalette: UpdateZoraPalette:
{ {
REP #$30 ; change 16 bit mode REP #$30 ; change 16 bit mode
LDX #$001E LDX #$001E
.loop .loop
LDA.l zora_palette, X : STA $7EC6E0, X LDA.l zora_palette, X : STA $7EC6E0, X
DEX : DEX : BPL .loop DEX : DEX : BPL .loop
SEP #$30 ; go back to 8 bit mode SEP #$30 ; go back to 8 bit mode
INC $15 ; update the palette INC $15 ; update the palette
RTL RTL
} }
; ========================================================= ; =========================================================
@@ -51,29 +51,13 @@ org $0998FC
org $07A569 org $07A569
LinkItem_ZoraMask: LinkItem_ZoraMask:
{ {
; No removing the mask whilst diving. ; No removing the mask whilst diving.
LDA !ZoraDiving : BNE .return LDA !ZoraDiving : BNE .return
LDA.b #$02
JSL Link_TransformMask
; Check for R button held .return
%CheckNewR_ButtonPress() : BEQ .return RTS
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
%PlayerTransform()
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
%ResetToLinkGraphics()
.return
CLC
RTS
} }
warnpc $07A5CE warnpc $07A5CE
@@ -248,6 +232,7 @@ pullpc
pushpc pushpc
; C2C3 ; C2C3
; Link_HopInOrOutOfWater_Vertical
org $07C307 org $07C307
JSR LinkState_UsingZoraMask_dungeon_stairs JSR LinkState_UsingZoraMask_dungeon_stairs
RTS RTS
@@ -257,9 +242,9 @@ pullpc
.dungeon_stairs .dungeon_stairs
{ {
LDA $02B2 : CMP #$02 : BNE .return_hop LDA $02B2 : CMP #$02 : BNE .return_hop
STZ $5E ; Reset speed to normal STZ $5E ; Reset speed to normal
STZ !ZoraDiving ; Reset underwater flag STZ !ZoraDiving ; Reset underwater flag
LDA #$62 : STA $9A ; Reset dungeon layer LDA #$62 : STA $9A ; Reset dungeon layer
.return_hop .return_hop
LDA #$06 : STA $5D ; Set Link to Recoil State LDA #$06 : STA $5D ; Set Link to Recoil State
RTS RTS