Reorganize Bank07 free space with pushpc/pullpc

This commit is contained in:
scawful
2023-05-31 11:20:59 -05:00
parent 4e2fbb41b5
commit cda7295783
6 changed files with 96 additions and 113 deletions

View File

@@ -1,11 +1,7 @@
; =============================================================================
; Deku Mask
; Deku Mask
; =============================================================================
; Link Sprite hook
org $008A01
LDA $BC
; =============================================================================
@@ -14,6 +10,52 @@ incbin gfx/deku_link.bin
; =============================================================================
org $07A64B ; formerly Quake
LinkItem_DekuMask:
{
; Check for R button held
LDA $F2 : CMP #$10 : BNE .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
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.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 #$35 : STA $BC ; put the mask on
LDA #$01 : STA $02B2
BRA .return
.unequip
JSL Palette_ArmorAndGloves
STZ $5D
; Restore the sword and shield
LDA $0AA5 : STA.l $7EF359
LDA $0AAF : STA.l $7EF35A
LDA #$00 : STA $7E03FC ; clear the override
LDA #$10 : STA $BC : STZ $02B2 ; take the mask off
.return
RTS
}
; =============================================================================
org $079CD9
JSL LinkItem_CheckForSwordSwing_Masks
@@ -113,51 +155,6 @@ LinkItem_SlingshotPrepare:
}
; =============================================================================
org $07A64B ; formerly Quake
LinkItem_DekuMask:
{
; Check for R button held
LDA $F2 : CMP #$10 : BNE .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
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.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 #$35 : STA $BC ; put the mask on
LDA #$01 : STA $02B2
BRA .return
.unequip
JSL Palette_ArmorAndGloves
STZ $5D
; Restore the sword and shield
LDA $0AA5 : STA.l $7EF359
LDA $0AAF : STA.l $7EF35A
LDA #$00 : STA $7E03FC ; clear the override
LDA #$10 : STA $BC : STZ $02B2 ; take the mask off
.return
RTS
}
; =============================================================================
@@ -165,8 +162,8 @@ org $07811A
JSR Link_HandleDekuTransformation
; Bank 07 Free Space
; Previous function LinkState_CheckMinishTile
org $07F903
; TODO: CHECK IF THIS ACTUALLY EXECUTES CAUSE I'M NOT SURE IT DOES
pullpc
Link_HandleDekuTransformation:
{
LDA $5D : CMP.b #$0A : BEQ .continue
@@ -181,5 +178,4 @@ Link_HandleDekuTransformation:
RTS
}
print "==> Link_HandleDekuTransformation ", pc
pushpc

View File

@@ -13,6 +13,10 @@ org $078028
; =============================================================================
; Link Sprite hook
org $008A01
LDA $BC
org $008827
JSL StartupMasks
@@ -24,8 +28,8 @@ org $1BEDF9
org $1BEE1B
JSL Palette_ArmorAndGloves_part_two
RTL
org $278000
org $3A8000
StartupMasks:
{
; from vanilla:
@@ -40,9 +44,6 @@ StartupMasks:
; =============================================================================
org $398000
Palette_ArmorAndGloves:
{
LDA $02B2 : CMP #$01 : BEQ .deku_mask
@@ -161,6 +162,8 @@ Overworld_CgramAuxToMain_Override:
RTL
}
; =============================================================================
org $02C769
Overworld_CgramAuxToMain:
{
@@ -168,8 +171,4 @@ Overworld_CgramAuxToMain:
RTS
}
; no glove color (don't think this does anything?)
org $0DEE24
db $80
; =============================================================================

View File

@@ -4,7 +4,7 @@
; Reacts to Tile ID 64 to transform into Minish Link
; =============================================================================
org $3A8000
org $398000
incbin gfx/minish_link.4bpp
; =============================================================================
@@ -12,10 +12,9 @@ incbin gfx/minish_link.4bpp
org $07DA2A
TileDetection_OverworldAttributeJumpTable:
; Tile ID 64
org $07DAF2
dw LinkState_CheckForMinishForm
dw LinkState_CheckMinishTile
dw LinkState_CheckForMinishForm ; Tile ID 64
dw LinkState_CheckMinishTile ; Tile ID 65
; =============================================================================
@@ -49,7 +48,7 @@ LinkState_CheckForMinishForm:
RTS
}
print "==> LinkState_CheckForMinishForm ", pc
; =============================================================================
LinkState_CheckMinishTile:
{
@@ -64,5 +63,6 @@ LinkState_CheckMinishTile:
RTS
}
print "==> LinkState_CheckMinishTile ", pc
pushpc
print "==> LinkState_CheckMinishTile ", pc

View File

@@ -57,8 +57,7 @@ LinkItem_ShovelAndFlute:
; =============================================================================
; Bank 07 Free Space
; Previous routine `Link_HandleDekuTransformation`
org $07F914
pullpc
LinkItem_WolfMask:
{
LDA $02B2 : CMP #$03 : BNE .equip
@@ -88,6 +87,4 @@ LinkItem_WolfMask:
.return
CLC
RTS
}
print "==> LinkItem_WolfMask ", pc
}

View File

@@ -1,11 +1,19 @@
; =============================================================================
; Zora Mask
; Fairy Flippers RAM Position $7EF33C - 01
; Normal Flippers RAM Position $7EF356 - 01
; Zora Mask - by scawful
; Based on the Fairy Flippers item by Conn
; Special Thanks to Zarby89 for the PaletteArmorAndGloves hook
;
; Transforms Link into Zora Link
; Allows Link to dive underwater in the overworld and dungeons as Zora Link.
;
; 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.
;
; Underwater Flag RAM Position $7F500E
; =============================================================================
; RAM Used:
; $02B2 - Current Form
; $0AAB - Diving Flag
;
; =============================================================================
org $368000
@@ -97,7 +105,8 @@ org $07C307
; Bank07 Free Space
; Predecessor: Wolf Mask I think
org $07F95D
; org $07F95D
pullpc
LinkState_UsingZoraMask:
{
; Check if the mask is equipped
@@ -209,7 +218,7 @@ LinkState_UsingZoraMask:
LDA $0114 : CMP #$85 : BEQ .return_default
LDA $0114 : CMP #$09 : BEQ .return_default
LDA $5B : CMP #$02 : BEQ .player_is_falling
LDA $5B : CMP #$02 : BEQ .dungeon_stairs
; Check if the ground level is safe
; Otherwise, eject the player back to the surface
@@ -286,5 +295,4 @@ LinkState_ResetMaskAnimated:
}
print "==> LinkState_ResetMaskAnimated ", pc
pushpc