Skip to content

Allow fishing while surfing

PerreteCartago edited this page Jun 9, 2024 · 4 revisions

Generation III games introduced the ability to fish while surfing; while Gen I and II games do not allow the player to do this. Thankfully, this is fairly simple to implement.

These tutorial uses the code that the author, The Void, contributed to Rangi's Polished Crystal.

Table of Contents

  1. Add new player surfing sprites
  2. Remove check in fishing event code
  3. Add new fishing sprite tiles
  4. Load unique fishing sprite tiles while surfing
  5. Prevent fishing on top of NPCs

1) Add new player surfing sprites

Sadly, Gens I and II reused pokemon sprites while the player is surfing. We will need to add custom surfing sprites that incorporate the default player sprite so that we can eventually support fishing while surfing.

Instead of rehashing other tutorials, follow the tutorial for adding new overworld sprites here: Add a new overworld sprite.

Add the following two sprites:

CHRIS_SURF

chris_surf

KRIS_SURF

kris_surf

Once you add both sprites, there is one final thing to do. Go to data/sprites/player_sprites.asm:

ChrisStateSprites:
	db PLAYER_NORMAL,    SPRITE_CHRIS
	db PLAYER_BIKE,      SPRITE_CHRIS_BIKE
-	db PLAYER_SURF,      SPRITE_SURF
+	db PLAYER_SURF,      SPRITE_CHRIS_SURF
	db PLAYER_SURF_PIKA, SPRITE_SURFING_PIKACHU
	db PLAYER_RUN,       SPRITE_CHRIS_RUN
	db -1 ; end

KrisStateSprites:
	db PLAYER_NORMAL,    SPRITE_KRIS
	db PLAYER_BIKE,      SPRITE_KRIS_BIKE
-	db PLAYER_SURF,      SPRITE_SURF
+	db PLAYER_SURF,      SPRITE_KRIS_SURF
	db PLAYER_SURF_PIKA, SPRITE_SURFING_PIKACHU
	db PLAYER_RUN,       SPRITE_KRIS_RUN
	db -1 ; end

2) Remove check in fishing event code

Remove the following check from engine/events/overworld.asm:

.FishTable:
	dw .TryFish
	dw .FishNoBite
	dw .FishGotSomething
	dw .FailFish
	dw .FishNoFish
	dw .FishGotItem

.TryFish:
; BUG: You can fish on top of NPCs (see docs/bugs_and_glitches.md)
	ld a, [wPlayerState]
-	cp PLAYER_SURF
-	jr z, .fail
	cp PLAYER_SURF_PIKA
	jr z, .fail
	call GetFacingTileCoord
	call GetTileCollision
	dec a ; cp WATER_TILE
	jr z, .facingwater
.fail
	ld a, $3
	ret

3) Add new fishing sprite tiles

Add the following new fishing sprite tiles to the folder gfx/overworld/:

chris_surf_fish.png

chris_surf_fish

kris_surf_fish.png

kris_surf_fish

4) Load unique fishing sprite tiles while surfing

Add the following to engine/events/fishing_gfx.asm

LoadFishingGFX:
	ldh a, [rVBK]
	push af
	xor a
	ldh [rVBK], a

+	ld a, [wPlayerState]
+	cp PLAYER_SURF
+	jr z, .surfing
+
	ld de, FishingGFX
	ld a, [wPlayerGender]
	bit 0, a
	jr z, .got_gender
	ld de, KrisFishingGFX
+	jr .got_gender
+.surfing
+
+	ld de, SurfFishingGFX
+	ld a, [wPlayerGender]
+	bit 0, a
+	jr z, .got_gender
+	ld de, KrisSurfFishingGFX
.got_gender

	ld hl, vTiles0 tile $02
	call .LoadGFX
	ld hl, vTiles0 tile $06
	call .LoadGFX
	ld hl, vTiles0 tile $0a
	call .LoadGFX
	pop af
	ldh [rVBK], a
	ret
.LoadGFX:
	lb bc, BANK(FishingGFX), 2
	push de
	call Get2bpp
	pop de
	ld hl, 2 tiles
	add hl, de
	ld d, h
	ld e, l
	ret
FishingGFX:
INCBIN "gfx/overworld/chris_fish.2bpp"

KrisFishingGFX:
INCBIN "gfx/overworld/kris_fish.2bpp"
+
+SurfFishingGFX:
+INCBIN "gfx/overworld/chris_surf_fish.2bpp"
+
+KrisSurfFishingGFX:
+INCBIN "gfx/overworld/kris_surf_fish.2bpp"
+

5) Prevent fishing on top of NPCs

And with that, we can now fish while surfing!

As a final extra bit, make sure you fix the bug that allows you to fish on top on NPCs! Check the bug docs.

Clone this wiki locally