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

@@ -12,13 +12,14 @@ PlayerItem_ReleaseBee:
; LinkItem_Bottle
org $07A15B
JSL LinkItem_NewBottle
JSR LinkItem_NewBottle
RTS
; *$3A15B-$3A249 FREE SPACE STILL AVAILABLE
; =============================================================================
org $2C8000
; Bank 07 Free Space
org $07FAAD
LinkItem_NewBottle:
{
; Check if we have a bottle or not
@@ -29,29 +30,19 @@ LinkItem_NewBottle:
CMP.b #$03 : BCC .empty_bottle
; If no, prepare and call the LinkItem_Bottles routine
JSL LinkItem_Bottles_Long
JSR LinkItem_Bottles
BRA .exit
.empty_bottle
; Otherwise, prepare and call the LinkItem_BugCatchingNet routine
JSL LinkItem_BugCatchingNet_Long
JSR LinkItem_NewBugCatchingNet
.exit
RTL
RTS
}
; =============================================================================
; Bank 07 Free Space
; Previous Zora Mask
org $07FAAD
LinkItem_BugCatchingNet_Long:
{
PHB : PHK : PLB
JSR LinkItem_NewBugCatchingNet
PLB
RTL
}
pose_id:
db $0B, $06, $07, $08, $01, $02, $03, $04, $05, $06 ; up
db $01, $02, $03, $04, $05, $06, $07, $08, $01, $02 ; down
@@ -65,7 +56,6 @@ pose_offset:
db $1E ; right
; *$3AFF8-$3B072 LOCAL
LinkItem_NewBugCatchingNet:
{
BIT $3A : BVS .y_press
@@ -117,14 +107,6 @@ NetExit:
; =============================================================================
LinkItem_Bottles_Long:
{
PHB : PHK : PLB
JSR LinkItem_Bottles
PLB
RTL
}
LinkItem_Bottles:
{
JSR Link_CheckNewY_ButtonPress : BCC NetExit ; (RTS)
@@ -165,7 +147,6 @@ LinkItem_Bottles:
RTS
.LinkItem_GreenPotion:
JSR $A1A9
LDA $7EF36E : CMP.b #$80 : BNE .can_drink
BRL $07A955 ; LinkGoBeep TODO(scawful): Investigate
@@ -181,7 +162,7 @@ LinkItem_Bottles:
LDA.b #$07 : STA $0208
JSL $0DFA58 ; RebuildHUD_long TODO(scawful)
RTS
BRA .bottle_exit
.LinkItem_BluePotion:
LDA $7EF36C : CMP $7EF36D : BNE .useBluePotion
@@ -200,14 +181,14 @@ LinkItem_Bottles:
LDA.b #$07 : STA.w $0208
JSL $0DFA58 ; RebuildHUD_Long TODO(scawful)
RTS
BRA .bottle_exit
.LinkItem_FairyBottle:
STZ.w $0301
JSL PlayerItem_SpawnFaerie : BPL .BRANCH_NU
JSL PlayerItem_SpawnFaerie : BPL .released
BRL $07A955
.BRANCH_NU:
.released:
LDA.b #$02 : STA.l $7EF35C, X
JSL $0DFA58 ; RebuildHUD_Long TODO(scawful)
BRA .bottle_exit
@@ -225,4 +206,6 @@ LinkItem_Bottles:
RTS
}
print pc
; =============================================================================

View File

@@ -1,11 +1,7 @@
; =============================================================================
; 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
@@ -25,7 +29,7 @@ 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

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
@@ -89,5 +88,3 @@ LinkItem_WolfMask:
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.
;
; RAM Used:
; $02B2 - Current Form
; $0AAB - Diving Flag
;
; Underwater Flag RAM Position $7F500E
; =============================================================================
; =============================================================================
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