Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/events/hidden_objects/bench_guys.asm
1271 views
1
PrintBenchGuyText:
2
call EnableAutoTextBoxDrawing
3
ld hl, BenchGuyTextPointers
4
ld a, [wCurMap]
5
ld b, a
6
.loop
7
ld a, [hli]
8
cp -1
9
ret z
10
cp b
11
jr z, .match
12
inc hl
13
inc hl
14
jr .loop
15
.match
16
ld a, [hli]
17
ld b, a
18
ld a, [wSpritePlayerStateData1FacingDirection]
19
cp b
20
21
; bug: an 'inc hl' instruction is needed before looping back. When trying to
22
; talk to a bench guy from above, this Sprite Facing test will fail, and the
23
; next loop iteration will be misaligned within BenchGuyTextPointers table.
24
; As a result, the routine will miss the terminator byte, and continue to
25
; process data beyond the table boundary.
26
; It seems that it will only return after starting to read data from VRAM
27
; (According to Pan Docs, during PPU mode 3, reads return garbage value,
28
; usually $FF).
29
jr nz, .loop ; player isn't facing the bench guy
30
ld a, [hl]
31
jp PrintPredefTextID
32
33
INCLUDE "data/events/bench_guys.asm"
34
35
ViridianCityPokecenterBenchGuyText::
36
text_far _ViridianCityPokecenterGuyText
37
text_end
38
39
PewterCityPokecenterBenchGuyText::
40
text_far _PewterCityPokecenterGuyText
41
text_end
42
43
CeruleanCityPokecenterBenchGuyText::
44
text_far _CeruleanPokecenterGuyText
45
text_end
46
47
LavenderCityPokecenterBenchGuyText::
48
text_far _LavenderPokecenterGuyText
49
text_end
50
51
MtMoonPokecenterBenchGuyText::
52
text_far _MtMoonPokecenterBenchGuyText
53
text_end
54
55
RockTunnelPokecenterBenchGuyText::
56
text_far _RockTunnelPokecenterGuyText
57
text_end
58
59
UnusedBenchGuyText1::
60
text_far _UnusedBenchGuyText1
61
text_end
62
63
UnusedBenchGuyText2::
64
text_far _UnusedBenchGuyText2
65
text_end
66
67
UnusedBenchGuyText3::
68
text_far _UnusedBenchGuyText3
69
text_end
70
71
VermilionCityPokecenterBenchGuyText::
72
text_far _VermilionPokecenterGuyText
73
text_end
74
75
CeladonCityPokecenterBenchGuyText::
76
text_far _CeladonCityPokecenterGuyText
77
text_end
78
79
FuchsiaCityPokecenterBenchGuyText::
80
text_far _FuchsiaCityPokecenterGuyText
81
text_end
82
83
CinnabarIslandPokecenterBenchGuyText::
84
text_far _CinnabarPokecenterGuyText
85
text_end
86
87
SaffronCityPokecenterBenchGuyText::
88
text_asm
89
CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
90
ld hl, SaffronCityPokecenterBenchGuyText2
91
jr nz, .printText
92
ld hl, SaffronCityPokecenterBenchGuyText1
93
.printText
94
call PrintText
95
jp TextScriptEnd
96
97
SaffronCityPokecenterBenchGuyText1:
98
text_far _SaffronCityPokecenterGuyText1
99
text_end
100
101
SaffronCityPokecenterBenchGuyText2:
102
text_far _SaffronCityPokecenterGuyText2
103
text_end
104
105
CeladonCityHotelText::
106
text_far _CeladonCityHotelText
107
text_end
108
109