cleanup fishing rod, update labels

This commit is contained in:
scawful
2024-07-06 13:02:14 -04:00
parent 49a08548a8
commit 5bea1cc446

View File

@@ -10,11 +10,6 @@
; $7F5BA3 RAM Index for the fishing floater ; $7F5BA3 RAM Index for the fishing floater
; Modify the code of the sprite "RunningBoy" 0x74 ; Modify the code of the sprite "RunningBoy" 0x74
; ========================================================= ; =========================================================
; Values
;#$400 ; to show fishing hud
;#$14A ; only the hud
; ================= USED FOR THE FLOATER ==================
; Sprite_2D_NecklessMan_bounce ; Sprite_2D_NecklessMan_bounce
org $06C0B2 org $06C0B2
@@ -67,22 +62,14 @@ LinkItem_FishingRod:
{ {
PHB : PHK : PLB PHB : PHK : PLB
BIT.b $3A BIT.b $3A : BVS .holding_y
BVS .holding_y LDA.b $6C : BNE FishingRodExit
JSR CheckYButtonPress : BCC FishingRodExit
LDA.b $6C LDA.b $67 : AND.b #$F0 : STA.b $67
BNE FishingRodExit
JSR CheckYButtonPress
BCC FishingRodExit
LDA.b $67
AND.b #$F0
STA.b $67
JSL FishingSwapCaneBlockHammerGfx JSL FishingSwapCaneBlockHammerGfx
STZ.b $69 STZ.b $69
STZ.b $68 STZ.b $68
LDA.b #$08 LDA.b #$08
@@ -91,21 +78,17 @@ LinkItem_FishingRod:
STZ.w $0300 STZ.w $0300
STZ.w $0301 STZ.w $0301
LDA.w RodAndCaneAnimationTimer LDA.w RodAndCaneAnimationTimer : STA.b $3D
STA.b $3D
.holding_y .holding_y
JSR HaltLinkWhenUsingItems JSR HaltLinkWhenUsingItems
LDA.b #$26 : STA.w $0107 ; Sword DMA to Floater Hammer LDA.b #$26 : STA.w $0107 ; Sword DMA to Floater Hammer
LDA.w $0300 : CMP #$02 : BEQ + LDA.w $0300 : CMP #$02 : BEQ +
DEC.b $3D ; decrease timer DEC.b $3D ; decrease timer
BPL FishingRodExit BPL FishingRodExit
+ +
LDA.l $7F5BA2 : CMP #$02 : BNE + LDA.l $7F5BA2 : CMP #$02 : BNE +
JMP EndFishing JMP EndFishing
+ +
@@ -117,29 +100,26 @@ LinkItem_FishingRod:
TAX TAX
LDA.w RodAndCaneAnimationTimer, X ; load timer for current frame animation state ; load timer for current frame animation state
STA.b $3D ; timer LDA.w RodAndCaneAnimationTimer, X : STA.b $3D ; timer
CPX.b #$01 : BNE + CPX.b #$01 : BNE +
; spawn floater ; spawn floaters
PHX PHX
LDA.b #$2D LDA.b #$2D
JSL $1DF65D ; Sprite_SpawnDynamically because whatever JSL Sprite_SpawnDynamically
LDA.b $22 : STA.w SprX, Y LDA.b $22 : STA.w SprX, Y
LDA.b $23 : STA.w SprXH, Y LDA.b $23 : STA.w SprXH, Y
LDA.b $20 : STA.w SprY, Y LDA.b $20 : STA.w SprY, Y
LDA.b $21 : STA.w SprYH, Y LDA.b $21 : STA.w SprYH, Y
LDA.b #$01 : STA.w $0E70, Y ; is floater LDA.b #$01 : STA.w SprCollision, Y ; is floater
TYA : STA.l $7F5BA3 ; keep the index of the sprite TYA : STA.l $7F5BA3 ; keep the index of the sprite
TYX TYX
JSL SpritePrep_Floater ; just call it there JSL SpritePrep_Floater ; just call it there
PLX PLX
+ +
CPX.b #$02 CPX.b #$02 : BCC .exit
BCC .exit LDA #$01 : STA.l $7F5BA2 ; set fishing rod state to rod is out
LDA #$01
STA.l $7F5BA2 ; set fishing rod state to rod is out
LDA.b #$FE : STA $3D ;set timer to 8 frames LDA.b #$FE : STA $3D ;set timer to 8 frames
; wait for Y press ; wait for Y press
.waitforend .waitforend
@@ -156,14 +136,12 @@ LinkItem_FishingRod:
LDA.b #$10 : STA.w $0F80, X ; Gravity LDA.b #$10 : STA.w $0F80, X ; Gravity
;=========================================================== ; =======================================================
; We got something spawn it and pull it at us ; We got something spawn it and pull it at us
LDA.w $0DB0, X : BEQ .noPrize LDA.w $0DB0, X : BEQ .noPrize
JSL $0DBA71 : AND #$0F ; get random int JSL GetRandomInt : AND #$0F : TAY : LDA Prizes, Y : BEQ .noPrize
TAY : LDA Prizes, Y : BEQ .noPrize JSL Sprite_SpawnDynamically
JSL Sprite_SetSpawnedCoordinates
JSL $1DF65D ; Sprite_SpawnDynamically because whatever
JSL $09AE64 ; Sprite_SetSpawnedCoords
LDA.w $0E20, Y : CMP.b #$D2 : BNE .notafish LDA.w $0E20, Y : CMP.b #$D2 : BNE .notafish
LDA #$04 : STA.w $0F70, Y LDA #$04 : STA.w $0F70, Y
@@ -253,24 +231,17 @@ CheckYButtonPress:
HaltLinkWhenUsingItems: HaltLinkWhenUsingItems:
{ {
LDA.b $AD : CMP.b #$02 : BNE .skip LDA.b $AD : CMP.b #$02 : BNE .skip
LDA.w $0322 : AND.b #$03 : CMP.b #$03 : BNE .skip LDA.w $0322 : AND.b #$03 : CMP.b #$03 : BNE .skip
STZ.b $30 STZ.b $30
STZ.b $31 STZ.b $31
STZ.b $67 STZ.b $67
STZ.b $2A STZ.b $2A
STZ.b $2B STZ.b $2B
STZ.b $6B STZ.b $6B
.skip .skip
LDA.w $02F5 : BEQ .return LDA.w $02F5 : BEQ .return
STZ.b $67 STZ.b $67
.return .return
RTS RTS
} }
@@ -347,8 +318,9 @@ Sprite_CheckIfActive:
RTS RTS
} }
;====================================================================== ; =========================================================
; Floater sprite code ; Floater sprite code
SpritePrep_Floater: SpritePrep_Floater:
{ {
LDA.b $66 : CMP.b #$03 : BNE .notRight LDA.b $66 : CMP.b #$03 : BNE .notRight
@@ -368,12 +340,11 @@ SpritePrep_Floater:
BRA .DoInitFloater BRA .DoInitFloater
.notUp .notUp
.DoInitFloater .DoInitFloater
LDA.b #$08 : STA.w $0F70, X ; Height LDA.b #$08 : STA.w $0F70, X ; Height
LDA.b #$10 : STA.w $0F80, X ; Gravity LDA.b #$10 : STA.w $0F80, X ; Gravity
LDA.b #$00 : STA.w $0ED0, X ; is it in water? LDA.b #$00 : STA.w SprMiscG, X ; is it in water?
LDA.b #$00 : STA.w $0EB0, X ; Wiggling Velocity index LDA.b #$00 : STA.w $0EB0, X ; Wiggling Velocity index
LDA.b #$00 : STA.w $0E90, X ; just for a check LDA.b #$00 : STA.w $0E90, X ; just for a check
LDA.b #$00 : STA.w $0DB0, X ; if we have a fish on line LDA.b #$00 : STA.w $0DB0, X ; if we have a fish on line
@@ -383,47 +354,44 @@ SpritePrep_Floater:
RTL RTL
} }
;--------------------------------------------------------------------- ; ---------------------------------------------------------
Sprite_Floater: Sprite_Floater:
{ {
; Floater Draw, allocate 4 tiles to use for the hud ; Floater Draw, allocate 4 tiles to use for the hud
LDA $0ED0, X : BEQ + LDA SprMiscG, X : BEQ +
JSL $059FFA ; draw water ripple JSL SpriteDraw_WaterRipple
+ +
JSR Sprite_Floater_Draw JSR Sprite_Floater_Draw
LDA $0ED0, X : BNE + LDA SprMiscG, X : BNE +
JSL $06DC54 ; shadow JSL Sprite_DrawShadow
+ +
JSR Sprite_CheckIfActive JSR Sprite_CheckIfActive
LDA.w $0ED0, X : BEQ .noFishOnLine ; is the floater in water? LDA.w SprMiscG, X : BEQ .noFishOnLine ; is the floater in water?
LDA.w $0EE0, X : BNE .noWigglingYet ; timerD wait until fish is on line LDA.w $0EE0, X : BNE .noWigglingYet ; timerD wait until fish is on line
LDA.w $0DB0, X : BNE .fishOnlineWait LDA.w $0DB0, X : BNE .fishOnlineWait
; start another random timer for the time it'll last ; start another random timer for the time it'll last
JSL $0DBA71 : AND #$3F ; GetRandomInt JSL GetRandomInt : AND #$3F
CLC : ADC.b #$0F : STA.w $0DF0, X ; wiggling timer CLC : ADC.b #$0F : STA.w $0DF0, X ; wiggling timer
INC.w $0DB0, X ; we have a fish on line INC.w $0DB0, X ; we have a fish on line
.noWigglingYet .noWigglingYet
LDA.w $0DB0, X : BEQ .noFishOnLine ; do we already have a fish on line? LDA.w $0DB0, X : BEQ .noFishOnLine ; do we already have a fish on line?
.fishOnlineWait .fishOnlineWait
LDA.w $0DF0, X : BNE .stillwiggling LDA.w $0DF0, X : BNE .still_wiggling
STZ.w $0DB0, X ; no more fish on line took too much time STZ.w $0DB0, X ; no more fish on line took too much time
JSL $0DBA71 : AND.b #$7F ; GetRandomInt JSL GetRandomInt : AND.b #$7F
CLC : ADC.b #$7F : STA.w $0EE0, X ; reset timer wait until fish is on line CLC : ADC.b #$7F : STA.w $0EE0, X ; reset timer wait until fish is on line
STZ.w $0D50, X STZ.w $0D50, X
STZ.w $0D40, X STZ.w $0D40, X
BRA .noFishOnLine BRA .noFishOnLine
.stillwiggling .still_wiggling
LDY.w $0E10, X LDY.w $0E10, X
@@ -434,60 +402,41 @@ Sprite_Floater:
LDA.b #$0F : STA.w $0E10, X ; wiggling timer LDA.b #$0F : STA.w $0E10, X ; wiggling timer
+ +
.noFishOnLine .noFishOnLine
JSL Sprite_MoveLong
JSL $1D808C ; Sprite_Move_XY
JSL Sprite_MoveAltitude JSL Sprite_MoveAltitude
LDA.w $0F80,X LDA.w $0F80, X : SEC : SBC.b #$01 : STA.w $0F80, X
SEC
SBC.b #$01
STA.w $0F80,X
LDA.w $0F70,X LDA.w $0F70, X : BPL .aloft
BPL .aloft
STZ.w $0F70, X STZ.w $0F70, X
LDA.w $0D50,X LDA.w $0D50, X : ASL A : ROR.w $0D50, X
ASL A
ROR.w $0D50,X
LDA.w $0D40,X LDA.w $0D40, X : ASL A : ROR.w $0D40, X
ASL A
ROR.w $0D40,X
LDA.w $0F80,X LDA.w $0F80, X : EOR.b #$FF : INC A
EOR.b #$FF
INC A
LSR A LSR A
CMP.b #$09 CMP.b #$09
BCS .no_bounce BCS .no_bounce
LDA.w $0E90, X : BNE .not_water_tile_last
LDA.w $0E90, X : BNE .not_water_tileLast
INC.w $0E90, X INC.w $0E90, X
JSL $06E496 ; Sprite_CheckTileCollision JSL Sprite_CheckTileCollision
LDA.w $0FA5 LDA.w $0FA5
CMP.b #$08 ; TILETYPE 08 CMP.b #$08 : BEQ .water_tile_last
BEQ .water_tileLast CMP.b #$09 : BNE .not_water_tile_last
CMP.b #$09 ; TILETYPE 09 .water_tile_last
BNE .not_water_tileLast INC.w SprMiscG, X ; Set that so we know floater is in water!
.water_tileLast JSL Sprite_SpawnSmallSplash
INC.w $0ED0, X ; Set that so we know floater is in water!
JSL $1EA820 ; Sprite_SpawnSmallSplash
JSL $0DBA71 : AND #$3F ; GetRandomInt JSL GetRandomInt : AND #$3F
CLC : ADC #$3F : STA.w $0EE0, X CLC : ADC #$3F : STA.w $0EE0, X
.not_water_tileLast .not_water_tile_last
STZ.w $0F80, X STZ.w $0F80, X
STZ.w $0D50, X STZ.w $0D50, X
STZ.w $0D40, X STZ.w $0D40, X
@@ -497,23 +446,20 @@ Sprite_Floater:
.no_bounce .no_bounce
STA.w $0F80, X STA.w $0F80, X
JSL $06E496 ; Sprite_CheckTileCollision JSL Sprite_CheckTileCollision
LDA.w $0FA5 LDA.w $0FA5
CMP.b #$08 ; TILETYPE 08 CMP.b #$08 : BEQ .water_tile
BEQ .water_tile CMP.b #$09 : BNE .not_water_tile
CMP.b #$09 ; TILETYPE 09
BNE .not_water_tile
.water_tile .water_tile
;STZ.w $0F80, X ;STZ.w $0F80, X
JSL $1EA820 ; Sprite_SpawnSmallSplash JSL Sprite_SpawnSmallSplash
.not_water_tile .not_water_tile
.aloft .aloft
LDA.b #$01 : STA.w $0E70, X ; restore floater sprite seems to be overwriten LDA.b #$01 : STA.w SprCollision, X ; restore floater sprite seems to be overwriten
RTS RTS
} }
@@ -548,7 +494,10 @@ Sprite_Floater_Draw:
WigglingTable: WigglingTable:
db 08, -10, 06, -8, 12, -14, 18, -20, 10, -12, 04, -6, 08,-10, 14,-16, 08, -10, 06, -8, 12, -14, 18, -20, 10, -12, 04, -6, 08,-10, 14,-16 db 08, -10, 06, -8, 12, -14, 18, -20
db 10, -12, 04, -6, 08,-10, 14,-16, 08
db -10, 06, -8, 12, -14, 18, -20, 10
db -12, 04, -6, 08,-10, 14,-16
DismissRodFromMenu: DismissRodFromMenu:
{ {