shithub: pokecrystal

Download patch

ref: 84a3b335aa119c536be8186a6c1b91a31a7963c1
parent: 6a9e929bf93badc306437104015d78b4bc339d25
author: Colton G. Rushton <colton51919@gmail.com>
date: Fri Jun 17 19:30:53 EDT 2022

Document that `farcall` returns `c` in `a` for some code (#937)


--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -1085,9 +1085,13 @@
 	call GetFacingTileCoord
 	ld [wFacingTileID], a
 	ld c, a
+	; CheckFacingTileForStdScript preserves c, and
+	; farcall copies c back into a.
 	farcall CheckFacingTileForStdScript
 	jr c, .done
 
+	; CheckCutTreeTile expects a == [wFacingTileID], which
+	; it still is after the previous farcall.
 	call CheckCutTreeTile
 	jr nz, .whirlpool
 	farcall TryCutOW