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
; Makes Link run quicker when holding
; Written by Conn (I think)
@@ -17,7 +17,7 @@
; (Default = 0D)
; db (10) $40 - Pegasus boots speed (Default = 40)
;
; =============================================================================
; =========================================================
UpdateBunnyPalette:
{
@@ -33,7 +33,7 @@ UpdateBunnyPalette:
RTL ; or RTS depending on where you need it
}
; =============================================================================
; =========================================================
bunny_palette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6
@@ -43,7 +43,7 @@ bunny_palette:
print "End of Bunny Hood GFX ", pc
; =============================================================================
; =========================================================
; Bunny Hood Speed Modification
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
}
; =============================================================================
; =========================================================
; Press R to transform into bunny form and run faster.
; =============================================================================
; =========================================================
org $07A494
LinkItem_Ether:
{
%CheckNewR_ButtonPress() : BEQ .return
LDA $6C : BNE .return ; in a doorway
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
LDA #$04
JSL Link_TransformMask
RTS
}

View File

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

View File

@@ -251,8 +251,6 @@ Overworld_CgramAuxToMain:
org $079CD9
JSL LinkItem_CheckForSwordSwing_Masks
; =========================================================
pullpc
LinkItem_CheckForSwordSwing_Masks:
{
@@ -268,6 +266,52 @@ LinkItem_CheckForSwordSwing_Masks:
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
; LinkOAM_AnimationStepDataOffsets
; This is used to change the animation during 0x0A (Using Quake Medallion)

View File

@@ -57,20 +57,18 @@ LinkState_CheckForMinishForm:
RTS
}
; =============================================================================
; =========================================================
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
LDA $0A : TSB $0343
RTS
.blocked
LDA $0A : TSB $0E ; Blocked
RTS
.blocked
LDA $0A : TSB $0E ; Blocked
RTS
}
print "End of Masks/minish_form.asm ", pc

View File

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

View File

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