From 1c290ed27104f6392367ca97f3857a168d6432a4 Mon Sep 17 00:00:00 2001
From: Vince Weaver <vince@deater.net>
Date: Wed, 12 Jun 2024 19:35:39 -0400
Subject: [PATCH] fish: more work on catching

---
 games/sb/fish/TODO   | 12 +++++-------
 games/sb/fish/fish.s | 39 ++++++++++++++++++++++++++-------------
 2 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/games/sb/fish/TODO b/games/sb/fish/TODO
index 734501cb..e862be0c 100644
--- a/games/sb/fish/TODO
+++ b/games/sb/fish/TODO
@@ -1,13 +1,11 @@
-+ make spacebar message blink
-+ do the ripple marks on either side of the boat
-+ do we bother animating the fish?
-
++ Do we bother having multiple frames for the fish (animate them slightly)
 + Try to make sprites color clash look better
 
 + Add lure animation
-+ Add moving fishes
-+
-+ Add score to game
 
 + Compress sprites?
 
++ speed up and rebalance
+
++ fix odd/even for sprites
+
diff --git a/games/sb/fish/fish.s b/games/sb/fish/fish.s
index 922a0453..bab04c07 100644
--- a/games/sb/fish/fish.s
+++ b/games/sb/fish/fish.s
@@ -403,11 +403,12 @@ handle_fish:
 
 handle_red_fish:
 	lda	RED_FISH_STATE_PTR
-	bpl	handle_grey_fish	; positive means fish is active
+	cmp	#$ff
+	bne	handle_grey_fish	; #$ff means fish is not active
 
 	; create new red/big fish
-;	lda	#0
-;	sta	RED_FISH_STATE_PTR
+	lda	#0
+	sta	RED_FISH_STATE_PTR
 
 	lda	#FISH_SPRITE_LONG
 	sta	RED_FISH_SPRITE
@@ -419,11 +420,12 @@ handle_red_fish:
 
 handle_grey_fish:
 	lda	GREY_FISH_STATE_PTR
-	bpl	handle_green_fish	; positive means fish is active
+	cmp	#$ff
+	bne	handle_green_fish	; $FF means fish is not active
 
 	; create new grey/left fish
-	lda	#0
-	sta	GREY_FISH_STATE_PTR
+;	lda	#0
+;	sta	GREY_FISH_STATE_PTR
 
 	lda	#FISH_SPRITE_LEFT
 	sta	GREY_FISH_SPRITE
@@ -435,7 +437,8 @@ handle_grey_fish:
 
 handle_green_fish:
 	lda	GREEN_FISH_STATE_PTR
-	bpl	done_handle_fish	; positive means fish is active
+	cmp	#$FF
+	bne	done_handle_fish	; $FF means fish is not active
 
 	; create new green/right fish
 ;	lda	#0
@@ -457,7 +460,8 @@ done_handle_fish:
 draw_red_fish:
 
 	ldx	RED_FISH_STATE_PTR
-	bmi	draw_grey_fish		; negative means no fish
+	cpx	#$FF
+	beq	draw_grey_fish		; $FF means no fish
 
 	ldy	red_fish_behavior,X
 
@@ -468,7 +472,8 @@ draw_red_fish:
 draw_grey_fish:
 
 	ldx	GREY_FISH_STATE_PTR	; negative means no fish
-	bmi	draw_green_fish
+	cpx	#$FF
+	beq	draw_green_fish
 
 	ldy	grey_fish_behavior,X
 
@@ -479,7 +484,8 @@ draw_grey_fish:
 draw_green_fish:
 
 	ldx	GREEN_FISH_STATE_PTR	; negative means no fish
-	bmi	done_draw_fish
+	cmp	#$ff
+	beq	done_draw_fish
 
 	ldy	green_fish_behavior,X
 
@@ -598,8 +604,14 @@ do_jig:
 
 	; FIXME: make fish visible
 
+	ldx	#FISH_SPRITE_RED
+	stx	RED_FISH_SPRITE
+
 	; FIXME: start fish on catch path
 
+	lda	#<(catch_fish_behavior-red_fish_behavior)
+	sta	RED_FISH_STATE_PTR
+
 	; FIXME: update proper score
 
 	ldx	#0
@@ -844,6 +856,7 @@ move_fish_bubble:
 	sta	BUBBLE_STATE_PTR
 	lda	RED_FISH_X,X
 	sta	BUBBLE_X
+	inc	BUBBLE_X	; more likely to be from head
 	lda	RED_FISH_Y,X
 	sta	BUBBLE_Y
 	jmp	done_update_fish
@@ -1045,9 +1058,9 @@ green_fish_behavior:
 catch_fish_behavior:
 	; up+to right 20 times?
 	; then down+right 5 times?
-	.byte FISH_CATCH_UP,FISH_CATCH_UP,FISH_CATCH_UP,FISH_CATCH_UP
-	.byte FISH_CATCH_UP,FISH_CATCH_UP,FISH_CATCH_UP,FISH_CATCH_UP
-	.byte FISH_CATCH_UP,FISH_CATCH_UP,FISH_CATCH_UP,FISH_CATCH_UP
+	.byte FISH_UP,FISH_UP,FISH_UP,FISH_CATCH_UP
+	.byte FISH_UP,FISH_UP,FISH_UP,FISH_CATCH_UP
+	.byte FISH_UP,FISH_UP,FISH_UP,FISH_CATCH_UP
 
 	.byte FISH_CATCH_DOWN,FISH_CATCH_DOWN,FISH_CATCH_DOWN,FISH_CATCH_DOWN
 	.byte FISH_CATCH_DOWN,FISH_CATCH_DOWN,FISH_CATCH_DOWN,FISH_CATCH_DOWN