Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/battle/used_move_text.asm
2019 views
1
DisplayUsedMoveText:
2
ld hl, UsedMoveText
3
jp PrintText
4
5
UsedMoveText:
6
text_far _ActorNameText
7
text_asm
8
9
ldh a, [hWhoseTurn]
10
and a
11
ld a, [wPlayerMoveNum]
12
ld hl, wPlayerUsedMove
13
jr z, .playerTurn
14
15
ld a, [wEnemyMoveNum]
16
ld hl, wEnemyUsedMove
17
18
.playerTurn
19
ld [hl], a
20
ld [wMoveGrammar], a
21
call GetMoveGrammar
22
ld a, [wMonIsDisobedient]
23
and a
24
ld hl, UsedMove2Text
25
ret nz
26
27
; check move grammar
28
ld a, [wMoveGrammar]
29
cp $3
30
ld hl, UsedMove2Text
31
ret c
32
ld hl, UsedMove1Text
33
ret
34
35
UsedMove1Text:
36
text_far _UsedMove1Text
37
text_asm
38
jr UsedMoveText_CheckObedience
39
40
UsedMove2Text:
41
text_far _UsedMove2Text
42
text_asm
43
; fall through
44
45
UsedMoveText_CheckObedience:
46
; check obedience
47
ld a, [wMonIsDisobedient]
48
and a
49
jr z, .GetMoveNameText
50
; print "instead,"
51
ld hl, .UsedInsteadText
52
ret
53
54
.UsedInsteadText:
55
text_far _UsedInsteadText
56
text_asm
57
; fall through
58
59
.GetMoveNameText:
60
ld hl, MoveNameText
61
ret
62
63
MoveNameText:
64
text_far _MoveNameText
65
text_asm
66
ld hl, .endusedmovetexts
67
ld a, [wMoveGrammar]
68
add a
69
push bc
70
ld b, $0
71
ld c, a
72
add hl, bc
73
pop bc
74
ld a, [hli]
75
ld h, [hl]
76
ld l, a
77
ret
78
79
.endusedmovetexts:
80
; entries correspond to MoveGrammar sets
81
dw EndUsedMove1Text
82
dw EndUsedMove2Text
83
dw EndUsedMove3Text
84
dw EndUsedMove4Text
85
dw EndUsedMove5Text
86
87
EndUsedMove1Text:
88
text_far _EndUsedMove1Text
89
text_end
90
91
EndUsedMove2Text:
92
text_far _EndUsedMove2Text
93
text_end
94
95
EndUsedMove3Text:
96
text_far _EndUsedMove3Text
97
text_end
98
99
EndUsedMove4Text:
100
text_far _EndUsedMove4Text
101
text_end
102
103
EndUsedMove5Text:
104
text_far _EndUsedMove5Text
105
text_end
106
107
; This function is redundant in the English localization.
108
; In Japanese, it selects one of 5 distinct sentence structures.
109
; In English, all of these sentences have the exact same structure,
110
; so this serves no purpose.
111
GetMoveGrammar:
112
push bc
113
ld a, [wMoveGrammar] ; move ID
114
ld c, a
115
ld b, $0
116
ld hl, MoveGrammar
117
.loop
118
ld a, [hli]
119
; end of table?
120
cp -1
121
jr z, .end
122
; match?
123
cp c
124
jr z, .end
125
; advance grammar type at 0
126
and a
127
jr nz, .loop
128
; next grammar type
129
inc b
130
jr .loop
131
132
.end
133
; wMoveGrammar now contains move grammar
134
ld a, b
135
ld [wMoveGrammar], a
136
pop bc
137
ret
138
139
INCLUDE "data/moves/grammar.asm"
140
141