cleanup follower code

This commit is contained in:
scawful
2024-07-09 15:50:33 -04:00
parent 8ebe8c5ca9
commit 346249e670

View File

@@ -1,6 +1,5 @@
; =========================================================
; Old Man Follower Sprite
;
; Followers
POSY = $7E0020
POSYH = $7E0021
@@ -48,20 +47,20 @@ LoadFollowerGraphics = $00D423
; org $099F99
; #Follower_AIVectors:
; #_099F99: dw Follower_BasicMover ; 0x01 - Zelda (Impa)
; #_099F9B: dw Follower_OldMan ; 0x02 - Old man that stops following you
; #_099F9D: dw Follower_OldManUnused ; 0x03 - Unused old man
; #_099F9F: dw Follower_OldMan ; 0x04 - Normal old man
; #_099FA1: dw Follower_Telepathy ; 0x05 - Zelda rescue telepathy
; #_099FA3: dw Follower_BasicMover ; 0x06 - Blind maiden
; #_099FA5: dw Follower_BasicMover ; 0x07 - Frogsmith
; #_099FA7: dw Follower_BasicMover ; 0x08 - Smithy
; #_099FA9: dw Follower_BasicMover ; 0x09 - Locksmith (Zora Baby)
; #_099FAB: dw Follower_BasicMover ; 0x0A - Kiki
; #_099FAD: dw Follower_OldManUnused ; 0x0B - Minecart Follower
; #_099FAF: dw Follower_BasicMover ; 0x0C - Purple chest
; #_099FB1: dw Follower_BasicMover ; 0x0D - Super bomb
; #_099FB3: dw Follower_Telepathy ; 0x0E - Master Sword telepathy
; dw Follower_BasicMover ; 0x01 - Zelda (Impa)
; dw Follower_OldMan ; 0x02 - Old man that stops following you
; dw Follower_OldManUnused ; 0x03 - Unused old man
; dw Follower_OldMan ; 0x04 - Normal old man
; dw Follower_Telepathy ; 0x05 - Zelda rescue telepathy
; dw Follower_BasicMover ; 0x06 - Blind maiden
; dw Follower_BasicMover ; 0x07 - Frogsmith
; dw Follower_BasicMover ; 0x08 - Smithy
; dw Follower_BasicMover ; 0x09 - Locksmith (Zora Baby)
; dw Follower_BasicMover ; 0x0A - Kiki
; dw Follower_OldManUnused ; 0x0B - Minecart Follower
; dw Follower_BasicMover ; 0x0C - Purple chest
; dw Follower_BasicMover ; 0x0D - Super bomb
; dw Follower_Telepathy ; 0x0E - Master Sword telepathy
; =========================================================
; Zora Baby Follower Sprite
@@ -107,6 +106,69 @@ CheckForZoraBabyTransitionToSprite:
RTL
}
CheckForZoraBabyFollower:
{
LDA.l $7EF3CC : CMP.b #$09 : BNE .not_zora
LDA.b #$00
RTL
.not_zora
LDA.b $05
AND.b #$20
RTL
}
pushpc
; Make Zora sway like a girl
org $09AA5E
JSL CheckForZoraBabyFollower
org $09A19C
JSL CheckForZoraBabyTransitionToSprite
; Make Zora follower blue palette
org $09A902
db $02
org $09A8CF
org $0180
org $068D59
SpritePrep_Locksmith:
{
#_068D59: INC.w $0BA0,X
#_068D5C: LDA.l $7EF3CC
#_068D60: CMP.b #$09 ; FOLLOWER 09
#_068D62: BNE .not_already_following
#_068D64: STZ.w $0DD0,X
#_068D67: RTS
.not_already_following
#_068D68: CMP.b #$0C ; FOLLOWER 0C
#_068D6A: BNE .no_purple_chest
#_068D6C: LDA.b #$02
#_068D6E: STA.w $0D80,X
.no_purple_chest
#_068D71: LDA.l $7EF3C9
#_068D75: AND.b #$10
#_068D77: BEQ .exit
#_068D79: LDA.b #$04
#_068D7B: STA.w $0D80,X
.exit
#_068D7E: RTS
}
pullpc
; =================================================
; Old Man Follower Sprite
; Old man sprite wont spawn in his home room
; if you have the follower
@@ -122,29 +184,8 @@ OldMan_ExpandedPrep:
RTL
}
CheckForZoraBabyFollower:
{
LDA.l $7EF3CC : CMP.b #$09 : BNE .not_zora
LDA.b #$00
.not_zora
#_09AA5E: LDA.b $05
#_09AA60: AND.b #$20
RTL
}
pushpc
; Make Zora sway like a girl
org $09AA5E
JSL CheckForZoraBabyFollower
; Make Zora follower blue palette
org $09A902
db $02
org $09A8CF
org $0180
; Old man gives link the "shovel"
; Now the goldstar hookshot upgrade
org $1EE9FF
@@ -212,62 +253,64 @@ org $09A4C8
Follower_HandleTriggerData:
{
.room_id
#_09A4C8: dw $00D1 ; ROOM 00D1 - old man cave
#_09A4CA: dw $00FE ; ROOM 0061 - castle lobby
#_09A4CC: dw $00FD ; ROOM 0051 - castle throne room
#_09A4CE: dw $00FD ; ROOM 0002 - pre-sanc
#_09A4D0: dw $00DB ; ROOM 00DB - TT entrance
#_09A4D2: dw $00AB ; ROOM 00AB - to TT attic
#_09A4D4: dw $0022 ; ROOM 0022 - sewer rats
dw $00D1 ; ROOM 00D1 - old man cave
dw $00FE ; ROOM 0061 - castle lobby
dw $00FD ; ROOM 0051 - castle throne room
dw $00FD ; ROOM 0002 - pre-sanc
dw $00DB ; ROOM 00DB - TT entrance
dw $00AB ; ROOM 00AB - to TT attic
dw $0022 ; ROOM 0022 - sewer rats
.coordinates_uw
#_09A4D6: dw $1A78, $0233, $0001, $0099, $0004 ; Old man - MESSAGE 0099
#_09A4E0: dw $1BC0, $0378, $0002, $009A, $0004 ; Old man - MESSAGE 009A
#_09A4EA: dw $1A78, $0378, $0004, $009B, $0004 ; Old man - MESSAGE 009B
dw $1A78, $0233, $0001, $0099, $0004 ; Old man - MESSAGE 0099
dw $1BC0, $0378, $0002, $009A, $0004 ; Old man - MESSAGE 009A
dw $1A78, $0378, $0004, $009B, $0004 ; Old man - MESSAGE 009B
#_09A4F4: dw $1FF8, $039D, $0001, $0021, $0001 ; Zelda - MESSAGE 0021
#_09A4FE: dw $1FF8, $039D, $0002, $0021, $0001 ; Zelda - MESSAGE 0021
#_09A508: dw $1FF8, $0238, $0004, $0021, $0001 ; Zelda - MESSAGE 0021
dw $1FF8, $039D, $0001, $0021, $0001 ; Zelda - MESSAGE 0021
dw $1FF8, $039D, $0002, $0021, $0001 ; Zelda - MESSAGE 0021
dw $1FF8, $0238, $0004, $0021, $0001 ; Zelda - MESSAGE 0021
#_09A512: dw $1D78, $1F7F, $0001, $0022, $0001 ; Zelda - MESSAGE 0022
dw $1D78, $1F7F, $0001, $0022, $0001 ; Zelda - MESSAGE 0022
#_09A51C: dw $1D78, $1F7F, $0001, $0023, $0001 ; Zelda - MESSAGE 0023
#_09A526: dw $1D78, $1F7F, $0002, $002A, $0001 ; Zelda - MESSAGE 002A
dw $1D78, $1F7F, $0001, $0023, $0001 ; Zelda - MESSAGE 0023
dw $1D78, $1F7F, $0002, $002A, $0001 ; Zelda - MESSAGE 002A
#_09A530: dw $1BD8, $16FC, $0001, $0124, $0006 ; Blind maiden - MESSAGE 0124
dw $1BD8, $16FC, $0001, $0124, $0006 ; Blind maiden - MESSAGE 0124
#_09A53A: dw $1520, $167C, $0001, $0124, $0006 ; Blind maiden - MESSAGE 0124
dw $1520, $167C, $0001, $0124, $0006 ; Blind maiden - MESSAGE 0124
#_09A544: dw $05AC, $04FC, $0001, $0029, $0001 ; Zelda - MESSAGE 0029
dw $05AC, $04FC, $0001, $0029, $0001 ; Zelda - MESSAGE 0029
; ---------------------------------------------------------
.overworld_id
#_09A54E: dw $0005 ; OW 05 - West DM (Updated)
#_09A550: dw $002F ; OW 2F - Tail Palace
#_09A552: dw $0000 ; OW 00 - Lost woods
dw $0005 ; OW 05 - West DM (Updated)
dw $002F ; OW 2F - Tail Palace
dw $0000 ; OW 00 - Lost woods
.coordinates_ow
#_09A554: dw $0178, $0A63, $0001, $009D, $0004 ; Old man - MESSAGE 009D
dw $0178, $0A63, $0001, $009D, $0004 ; Old man - MESSAGE 009D
; Y X
#_09A55E: dw $0A88, $0F41, $0000, $FFFF, $000A ; Kiki
#_09A568: dw $0B37, $0F40, $0001, $FFFF, $000A ; Kiki
#_09A572: dw $0A62, $0E5B, $0002, $FFFF, $000A ; Kiki
dw $0A88, $0F41, $0000, $FFFF, $000A ; Kiki
dw $0B37, $0F40, $0001, $FFFF, $000A ; Kiki
dw $0A62, $0E5B, $0002, $FFFF, $000A ; Kiki
#_09A57C: dw $00E8, $0090, $0000, $0028, $000E ; MS telepathy - MESSAGE 0028
dw $00E8, $0090, $0000, $0028, $000E ; MS telepathy - MESSAGE 0028
; ---------------------------------------------------------
.room_boundaries_check
#_09A586: dw $0000, $001E, $003C, $0046
#_09A58E: dw $005A, $0064, $006E, $0078
dw $0000, $001E, $003C, $0046
dw $005A, $0064, $006E, $0078
.ow_boundaries_check
#_09A596: dw $0000, $000A, $0028, $0032
dw $0000, $000A, $0028, $0032
}
pullpc
; =========================================================
; Minecart Follower Sprite
FollowerDraw_CalculateOAMCoords:
{
@@ -501,16 +544,16 @@ FollowerDraw_CachePosition:
LDA.w $1A64, X : STA.b $05
; -------------------------
#_09A95B: AND.b #$20
#_09A95D: LSR A
#_09A95E: LSR A
#_09A95F: TAY
AND.b #$20
LSR A
LSR A
TAY
#_09A960: LDA.b $05
#_09A962: AND.b #$03
#_09A964: STA.b $04
LDA.b $05
AND.b #$03
STA.b $04
#_09A966: STZ.b $72
STZ.b $72
; Vanilla game would check some priority and collision
; variables based on the follower here and manipulate $72
; if the player was immobile.
@@ -544,15 +587,15 @@ FollowerDraw_CachePosition:
SEP #$20
#_09AA85: LDA.w $02D7
#_09AA88: INC A
#_09AA89: CMP.b #$03
#_09AA8B: BNE .set_repri
LDA.w $02D7
INC A
CMP.b #$03
BNE .set_repri
#_09AA8D: LDA.b #$00
LDA.b #$00
.set_repri
#_09AA8F: STA.w $02D7
STA.w $02D7
LDA $02D7 : ASL #2 : STA $05
TXA : CLC : ADC $05 : TAX
@@ -584,8 +627,7 @@ CheckForMinecartFollowerDraw:
JSR DrawMinecartFollower
.not_minecart
; LDA.b #$10
; STA.b $5E
; LDA.b #$10 : STA.b $5E
PLB
RTL
}