Intro Cutscene warp, organize bank07 free space

This commit is contained in:
scawful
2023-05-17 22:36:35 -05:00
parent 2026c0f2e1
commit 2bf1b4dea5
8 changed files with 348 additions and 282 deletions

View File

@@ -42,7 +42,9 @@ LinkItem_NewBottle:
; =============================================================================
org $07FA9F
; Bank 07 Free Space
; Previous Zora Mask
org $07FAAD
LinkItem_BugCatchingNet_Long:
{
PHB : PHK : PLB
@@ -88,7 +90,7 @@ LinkItem_NewBugCatchingNet:
.y_press:
JSR Unknown ; $3AE65 IN ROM
JSR $AE65
LDA $67 : AND.b #$F0 : STA $67
DEC $3D : BPL .bottle_exit
@@ -109,41 +111,12 @@ LinkItem_NewBugCatchingNet:
LDA.b #$80 : STA $44 : STA $45
.bottle_exit:
RTS
}
; *$3AE65-$3AE87 LOCAL
Unknown:
{
LDA $AD : CMP.b #$02 : BNE .BRANCH_ALPHA
LDA $0322 : AND.b #$03 : CMP.b #$03 : BNE .BRANCH_ALPHA
STZ $30
STZ $31
STZ $67
STZ $2A
STZ $2B
STZ $6B
.BRANCH_ALPHA:
; Cane of Somaria transit lines?
LDA $02F5 : BEQ .BRANCH_BETA
STZ $67
.BRANCH_BETA:
NetExit:
RTS
}
print "Next address for jump in bank07: ", pc
; =============================================================================
org $07FB71
LinkItem_Bottles_Long:
{
PHB : PHK : PLB

View File

@@ -19,36 +19,6 @@
;
; =============================================================================
org $07A494
LinkItem_Ether:
{
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 #$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
STZ $02B2
JSL Palette_ArmorAndGloves
LDA #$10 : STA $BC ; take the hood off
.return
CLC
RTS
}
; =============================================================================
org $378000
incbin gfx/bunny_link.4bpp
@@ -68,6 +38,7 @@ UpdateBunnyPalette:
RTL ; or RTS depending on where you need it
}
; =============================================================================
bunny_palette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6
@@ -103,4 +74,34 @@ end: {
}
org $20AF70 ; this selects the new speed values
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
; =============================================================================
org $07A494
LinkItem_Ether:
{
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 #$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
STZ $02B2
JSL Palette_ArmorAndGloves
LDA #$10 : STA $BC ; take the hood off
.return
CLC
RTS
}

View File

@@ -14,80 +14,10 @@ incbin gfx/deku_link.bin
; =============================================================================
org $07F8D1
Link_HandleDekuTransformation:
{
LDA $5D : CMP.b #$0A : BEQ .continue
JSR $82DA
.continue
STZ $03F5
STZ $03F6
; Link can move.
CLC
RTS
}
org $07811A
JSR Link_HandleDekuTransformation
; =============================================================================
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
org $07A013
JSL LinkItem_SlingshotPrepare
; =============================================================================
; =============================================================================
org $318000
LinkItem_CheckForSwordSwing_Masks:
@@ -105,6 +35,8 @@ LinkItem_CheckForSwordSwing_Masks:
; =============================================================================
; org $07A013
; JSL LinkItem_SlingshotPrepare
; Hooked @ [$07A013]
; $A200
@@ -121,8 +53,6 @@ LinkItem_SlingshotPrepare:
; $A214
.void
; $A270
.beta
LDA $7F1060
@@ -181,4 +111,75 @@ LinkItem_SlingshotPrepare:
STA $420B ; Start DMA on channel 0
RTL ; Return from subroutine long
}
}
; =============================================================================
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 $07811A
JSR Link_HandleDekuTransformation
; Bank 07 Free Space
; Previous function LinkState_CheckMinishTile
org $07F903
Link_HandleDekuTransformation:
{
LDA $5D : CMP.b #$0A : BEQ .continue
JSR $82DA
.continue
STZ $03F5
STZ $03F6
; Link can move.
CLC
RTS
}
print "==> Link_HandleDekuTransformation ", pc

View File

@@ -16,6 +16,15 @@ org $078028
org $008827
JSL StartupMasks
org $1BEDF9
JSL Palette_ArmorAndGloves ; 4bytes
RTL ; 1byte
NOP #$01
org $1BEE1B
JSL Palette_ArmorAndGloves_part_two
RTL
org $278000
StartupMasks:
{
@@ -31,14 +40,7 @@ StartupMasks:
; =============================================================================
org $1BEDF9
JSL Palette_ArmorAndGloves ; 4bytes
RTL ; 1byte
NOP #$01
org $1BEE1B
JSL Palette_ArmorAndGloves_part_two
RTL
org $398000
Palette_ArmorAndGloves:
@@ -170,50 +172,4 @@ Overworld_CgramAuxToMain:
org $0DEE24
db $80
; =============================================================================
; extra free space in bank07 for longs (no longer used)
org $07F89D
incsrc "minish_form.asm"
print "==> End of Minish Form insert", pc
; 07FB8F
org $07F8A6
org $07F8AE
org $07F8B7
org $07F8C0
org $07F8C9
; =============================================================================
; TODO: Make this so it does not cancel if $0202 is still the same mask
; corresponding to the form the player is in.
; Also, prevent this from canceling minish form.
org $07FA55
LinkState_ResetMaskAnimated:
{
LDA $02B2 : BEQ .no_mask
CMP #$01 : BNE .transform
; Restore the sword, shield, and bow override
LDA $0AA5 : STA.l $7EF359
LDA $0AAF : STA.l $7EF35A
LDA #$00 : STA $7E03FC
.transform
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
STZ $02B2
JSL Palette_ArmorAndGloves
LDA #$10 : STA $BC
.no_mask
RTL
}
print "End of LinkState_ResetMaskAnimated", pc
; =============================================================================

View File

@@ -1,10 +1,26 @@
; =============================================================================
; Minish Form Link
;
; Reacts to Tile ID 64 to transform into Minish Link
; =============================================================================
org $3A8000
incbin gfx/minish_link.4bpp
; =============================================================================
org $07DA2A
TileDetection_OverworldAttributeJumpTable:
; Tile ID 64
org $07DAF2
dw LinkState_CheckForMinishForm
dw LinkState_CheckMinishTile
; =============================================================================
; Start of free space in bank 07
org $07F89D
LinkState_CheckForMinishForm:
{
SEP #$30
@@ -15,24 +31,38 @@ LinkState_CheckForMinishForm:
LDA $02B2 : CMP.b #$05 : BEQ .already_minish
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 #$3A : STA $BC ; change link's sprite
LDA #$05 : STA $02B2 ; Set the current mask form
REP #$30
RTS
.already_minish
LDA #$10 : STA $BC : STZ $02B2
STZ $02B2
LDA $0AA5 : STA.l $7EF359
LDA $0AAF : STA.l $7EF35A
LDA #$10 : STA $BC
REP #$30
RTS
}
org $07DA2A
TileDetection_OverworldAttributeJumpTable:
print "==> LinkState_CheckForMinishForm ", pc
; Tile ID 64
org $07DAF2
dw $F89D
LinkState_CheckMinishTile:
{
LDA $02B2 : BEQ .blocked ; no form
CMP.b #$05 : BNE .blocked ; not minish
LDA $0A : TSB $0343
RTS
org $3A8000
incbin gfx/minish_link.4bpp
.blocked
LDA $0A : TSB $0E ; Blocked
RTS
}
print "==> LinkState_CheckMinishTile ", pc

View File

@@ -6,6 +6,35 @@
;
; =============================================================================
org $388000
incbin gfx/wolf_link.4bpp
; =============================================================================
UpdateWolfPalette:
{
REP #$30 ; change 16bit mode
LDX #$001E
.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
}
; =============================================================================
WolfPalette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$1A3D, #$14B6
dw #$4650, #$362A, #$3F4E, #$162B, #$318A, #$39CC, #$1CE7, #$76D1
dw #$6565, #$7271, #$14B5, #$459B, #$3D95, #$22D0, #$567C, #$1890
dw #$7616, #$0000
; =============================================================================
org $07A3DB
LinkItem_Flute:
@@ -27,7 +56,9 @@ LinkItem_ShovelAndFlute:
; =============================================================================
org $07F8E9
; Bank 07 Free Space
; Previous routine `Link_HandleDekuTransformation`
org $07F914
LinkItem_WolfMask:
{
LDA $02B2 : CMP #$03 : BNE .equip
@@ -59,35 +90,4 @@ LinkItem_WolfMask:
RTS
}
print "End of LinkItem_WolfMask ", pc
; =============================================================================
org $388000
incbin gfx/wolf_link.4bpp
; =============================================================================
UpdateWolfPalette:
{
REP #$30 ; change 16bit mode
LDX #$001E
.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
}
; =============================================================================
WolfPalette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$1A3D, #$14B6
dw #$4650, #$362A, #$3F4E, #$162B, #$318A, #$39CC, #$1CE7, #$76D1
dw #$6565, #$7271, #$14B5, #$459B, #$3D95, #$22D0, #$567C, #$1890
dw #$7616, #$0000
; =============================================================================
print "==> LinkItem_WolfMask ", pc

View File

@@ -6,8 +6,42 @@
; Underwater Flag RAM Position $7F500E
; =============================================================================
; =============================================================================
org $368000
incbin gfx/zora_link.4bpp
; =============================================================================
UpdateZoraPalette:
{
REP #$30 ; change 16 bit mode
LDX #$001E
.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
}
; =============================================================================
; TODO: Change from "bunny palette" to blue zora palette colors
zora_palette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6
dw #$55BB, #$362A, #$3F4E, #$162B, #$22D0, #$2E5A, #$1970, #$7616
dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2
dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357, #$0000
; =============================================================================
org $0998FC
AddTransitionSplash:
; =============================================================================
org $07A569
LinkItem_ZoraMask:
@@ -41,35 +75,29 @@ LinkItem_ZoraMask:
; =============================================================================
org $368000
incbin gfx/zora_link.4bpp
; End of LinkState_Swimming
org $079781
JSR LinkState_UsingZoraMask
RTS
; End of LinkState_Default
org $0782D2
JSR LinkState_UsingZoraMask_dungeon_resurface
JSR $E8F0
CLC
RTS
; C2C3
org $07C307
JSR LinkState_UsingZoraMask_dungeon_stairs
RTS
; =============================================================================
UpdateZoraPalette:
{
REP #$30 ; change 16 bit mode
LDX #$001E
.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
}
; TODO: Change from "bunny palette" to blue zora palette colors
zora_palette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6
dw #$55BB, #$362A, #$3F4E, #$162B, #$22D0, #$2E5A, #$1970, #$7616
dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2
dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357, #$0000
; =============================================================================
org $07F93F
; Bank07 Free Space
; Predecessor: Wolf Mask I think
org $07F95D
LinkState_UsingZoraMask:
{
; Check if the mask is equipped
@@ -226,25 +254,37 @@ LinkState_UsingZoraMask:
LDA #$06 : STA $5D ; Set Link to Recoil State
RTS
}
print "End of Zora Mask Dive Code ", pc
print "==> LinkState_UsingZoraMask ", pc
; =============================================================================
; End of LinkState_Swimming
org $079781
JSR LinkState_UsingZoraMask
RTS
; TODO: Make this so it does not cancel if $0202 is still the same mask
; corresponding to the form the player is in.
; Also, prevent this from canceling minish form.
; org $07FA55
LinkState_ResetMaskAnimated:
{
LDA $02B2 : BEQ .no_mask
CMP #$05 : BEQ .no_mask
CMP #$01 : BNE .transform
; End of LinkState_Default
org $0782D2
JSR LinkState_UsingZoraMask_dungeon_resurface
JSR $E8F0
CLC
RTS
; Restore the sword, shield, and bow override
LDA $0AA5 : STA.l $7EF359
LDA $0AAF : STA.l $7EF35A
LDA #$00 : STA $7E03FC
; C2C3
org $07C307
JSR LinkState_UsingZoraMask_dungeon_stairs
RTS
.transform
LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2
STZ $02B2
JSL Palette_ArmorAndGloves
LDA #$10 : STA $BC
.no_mask
RTL
}
print "==> LinkState_ResetMaskAnimated ", pc

View File

@@ -110,12 +110,6 @@ Sprite_Kydrog_Main:
Kydrog_TurnPlayerToDeku:
{
; LDA.b #$03 : STA.b $B6
; JSL AddTransformationCloud
; LDA.b #$14 : JSR Player_DoSfx2
; JSL Palette_ArmorAndGloves
LDA #$35 : STA $BC
%GotoAction(4)
@@ -124,8 +118,54 @@ Sprite_Kydrog_Main:
Kydrog_WarpPlayerAway:
{
LDA #$29
JSL $02B40F
; Set game state to part 03
LDA.b #$03 : STA $7EF3C5
; Put us in the Dark World.
LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA
JSL $00FC41 ; Sprite_LoadGfxProperties
; JSL $00FC62 ; Sprite_LoadGfxProperties.justLightWorld
STZ $037B : STZ $3C : STZ $3A : STZ $03EF
; Link can't move
LDA.b #$01 : STA $02E4
; The module to return to is #$08 (preoverworld)
LDA.b #$08 : STA $010C
; Set the map I want
LDA.b #$20 : STA $A0 : STZ $A1
; Set us to the warp state
LDA.b #$15 : STA $10
; Clear submodules
STZ $11 : STZ $B0
; Remove Impa
LDA.b #$00 : STA $7EF3CC
; Mirror Warp Timer
; #_00D8D2: INC.w $06BA
; LDA.w $06BA
; CMP.b #$20
; BEQ .continue
; STZ.w $0200
; RTL
; .continue
; Set the module to magic mirror
; $10 - 0x15 - Module for Magic Mirror
; LoadOverworldFromSpecialOverworld
; #_029D5F: LDY.b #$5A
; #_029D61: JSL DecompressAnimatedOverworldTiles
; JSL $00D8D2
RTS
}
@@ -207,5 +247,30 @@ Sprite_Kydrog_Draw:
db $02, $02, $02, $02, $02, $02
}
; I forget what this is lol
org $02ECF8
dw $0029
dw $0029
; ==============================================================================
; 169BC
; org $02E9BC
; LoadOverworldFromSpecialOverworld:
; org $029E65
; JSR LoadOverworldFromSpecialOverworld
; 11E5F
; 029E66
; 00D8A0
; SetTargetOverworldWarpToPyramid:
; #_029D56: LDA.b $10
; #_029D58: CMP.b #$15
; #_029D5A: BNE .exit
; #_029D5C: JSR LoadOverworldFromUnderworld
; #_029D5F: LDY.b #$5A
; #_029D61: JSL DecompressAnimatedOverworldTiles