aboutsummaryrefslogtreecommitdiffstats
path: root/engine/events/hidden_events/bench_guys.asm
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2026-01-07 22:05:37 -0500
committerGitHub <noreply@github.com>2026-01-07 22:05:37 -0500
commit0e49aef88ef94b9d3e80d89e4eb718e9425045df (patch)
treec63433287b9e2aceda14ff977cc06875cd0735d3 /engine/events/hidden_events/bench_guys.asm
parentUse macros to enforce "missable/hide/show object" constraints, and rename the... (diff)
downloadpokeyellow-0e49aef88ef94b9d3e80d89e4eb718e9425045df.tar.gz
pokeyellow-0e49aef88ef94b9d3e80d89e4eb718e9425045df.tar.xz
pokeyellow-0e49aef88ef94b9d3e80d89e4eb718e9425045df.zip
Use macros to enforce "hidden object" constraints, and rename them to "hidden events" (#559)
Diffstat (limited to 'engine/events/hidden_events/bench_guys.asm')
-rw-r--r--engine/events/hidden_events/bench_guys.asm107
1 files changed, 107 insertions, 0 deletions
diff --git a/engine/events/hidden_events/bench_guys.asm b/engine/events/hidden_events/bench_guys.asm
new file mode 100644
index 00000000..e5a2a724
--- /dev/null
+++ b/engine/events/hidden_events/bench_guys.asm
@@ -0,0 +1,107 @@
+PrintBenchGuyText:
+ call EnableAutoTextBoxDrawing
+ ld hl, BenchGuyTextPointers
+ ld a, [wCurMap]
+ ld b, a
+.loop
+ ld a, [hli]
+ cp -1
+ ret z
+ cp b
+ jr z, .match
+ inc hl
+ inc hl
+ jr .loop
+.match
+ ld a, [hli]
+ ld b, a
+ ld a, [wSpritePlayerStateData1FacingDirection]
+ cp b
+
+ ; bug: an 'inc hl' instruction is needed before looping back. When trying to
+ ; talk to a bench guy from above, this Sprite Facing test will fail, and the
+ ; next loop iteration will be misaligned within BenchGuyTextPointers table.
+ ; As a result, the routine will miss the terminator byte, and continue to
+ ; process data beyond the table boundary.
+ ; It seems that it will only return after starting to read data from VRAM
+ ; (According to Pan Docs, during PPU mode 3, reads return garbage value,
+ ; usually $FF).
+ jr nz, .loop ; player isn't facing the bench guy
+ ld a, [hl]
+ jp PrintPredefTextID
+
+INCLUDE "data/events/bench_guys.asm"
+
+ViridianCityPokecenterBenchGuyText::
+ text_far _ViridianCityPokecenterGuyText
+ text_end
+
+PewterCityPokecenterBenchGuyText::
+ text_far _PewterCityPokecenterGuyText
+ text_end
+
+CeruleanCityPokecenterBenchGuyText::
+ text_far _CeruleanPokecenterGuyText
+ text_end
+
+LavenderCityPokecenterBenchGuyText::
+ text_far _LavenderPokecenterGuyText
+ text_end
+
+MtMoonPokecenterBenchGuyText::
+ text_far _MtMoonPokecenterBenchGuyText
+ text_end
+
+RockTunnelPokecenterBenchGuyText::
+ text_far _RockTunnelPokecenterGuyText
+ text_end
+
+UnusedBenchGuyText1::
+ text_far _UnusedBenchGuyText1
+ text_end
+
+UnusedBenchGuyText2::
+ text_far _UnusedBenchGuyText2
+ text_end
+
+UnusedBenchGuyText3::
+ text_far _UnusedBenchGuyText3
+ text_end
+
+VermilionCityPokecenterBenchGuyText::
+ text_far _VermilionPokecenterGuyText
+ text_end
+
+CeladonCityPokecenterBenchGuyText::
+ text_far _CeladonCityPokecenterGuyText
+ text_end
+
+FuchsiaCityPokecenterBenchGuyText::
+ text_far _FuchsiaCityPokecenterGuyText
+ text_end
+
+CinnabarIslandPokecenterBenchGuyText::
+ text_far _CinnabarPokecenterGuyText
+ text_end
+
+SaffronCityPokecenterBenchGuyText::
+ text_asm
+ CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
+ ld hl, SaffronCityPokecenterBenchGuyText2
+ jr nz, .printText
+ ld hl, SaffronCityPokecenterBenchGuyText1
+.printText
+ call PrintText
+ jp TextScriptEnd
+
+SaffronCityPokecenterBenchGuyText1:
+ text_far _SaffronCityPokecenterGuyText1
+ text_end
+
+SaffronCityPokecenterBenchGuyText2:
+ text_far _SaffronCityPokecenterGuyText2
+ text_end
+
+CeladonCityHotelText::
+ text_far _CeladonCityHotelText
+ text_end