summaryrefslogtreecommitdiff
path: root/Remove-the-redundant-move-grammar-table.md
blob: 9b5ac0b408eb3b2eb4e6fa904df24485378b4add (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
In Japanese, there are five ways to say "*POKéMON* used *MOVE*!":

- "*POKéMON*の *MOVE* つかった!" ("*POKéMON* used *MOVE*!")
- "*POKéMON*の *MOVE*した!" ("*POKéMON* did *MOVE*!")
- "*POKéMON*の *MOVE* した!" ("*POKéMON* did *MOVE*!" for long move names)
- "*POKéMON*の *MOVE* こうげき!" ("*POKéMON*'s *MOVE* attack!")
- "*POKéMON*の *MOVE*!" ("*POKéMON*'s *MOVE*!")

These are all redundant in the English localization. This tutorial will show you how to remove them, which saves space and simplifies the code.


## Contents

1. [Delete the `MoveGrammar` table](#1-delete-the-movegrammar-table)
2. [Simplify the move text](#2-simplify-the-move-text)
3. [Simplify the text printer](#3-simplify-the-text-printer)


## 1. Delete the `MoveGrammar` table

Simply delete [data/moves/grammar.asm](../blob/master/data/moves/grammar.asm).


## 2. Simplify the move text

Edit [data/text/common_2.asm](../blob/master/data/text/common_2.asm):

```diff
 _ActorNameText::
 	text "<USER>@"
 	text_end

-_UsedMove1Text::
+_UsedMoveText::
 	text_start
 	line "used @"
 	text_end
-
-_UsedMove2Text::
-	text_start
-	line "used @"
-	text_end

_UsedInsteadText::
	text "instead,"
	cont "@"
	text_end

_MoveNameText::
	text_ram wStringBuffer2
-	text_end
-
-	text_end ; unused
-
-_EndUsedMove1Text::
-	text "!"
-	done
-
-_EndUsedMove2Text::
-	text "!"
-	done
-
-_EndUsedMove3Text::
-	text "!"
-	done
-
-_EndUsedMove4Text::
-	text "!"
-	done
-
-_EndUsedMove5Text::
 	text "!"
 	done
```


## 3. Simplify the text printer

Edit [engine/battle/used_move_text.asm](../blob/master/engine/battle/used_move_text.asm):

```diff
 UsedMoveText:
 ; this is a stream of text and asm from 105db9 to 105ef6
 	text_far _ActorNameText
 	text_asm
 	ldh a, [hBattleTurn]
 	and a
 	jr nz, .start
 
 	ld a, [wPlayerMoveStruct + MOVE_ANIM]
 	call UpdateUsedMoves
 
 .start
 	ld a, BATTLE_VARS_LAST_MOVE
 	call GetBattleVarAddr
 	ld d, h
 	ld e, l
 
 	ld a, BATTLE_VARS_LAST_COUNTER_MOVE
 	call GetBattleVarAddr
 
 	ld a, BATTLE_VARS_MOVE_ANIM
 	call GetBattleVar
-	ld [wMoveGrammar], a
+	ld [wTempByteValue], a
 
 	push hl
 	farcall CheckUserIsCharging
 	pop hl
-	jr nz, .grammar
+	jr nz, .ok

 	; update last move
-	ld a, [wMoveGrammar]
+	ld a, [wTempByteValue]
 	ld [hl], a
 	ld [de], a

-.grammar
-	call GetMoveGrammar
-; wMoveGrammar now contains MoveGrammar
-
-; everything except 'instead' made redundant in localization
-
-	; check obedience
-	ld a, [wAlreadyDisobeyed]
-	and a
-	ld hl, UsedMove2Text
-	ret nz
-
-	; check move grammar
-	ld a, [wMoveGrammar]
-	cp $3
-	ld hl, UsedMove2Text
-	ret c
-	ld hl, UsedMove1Text
+.ok
+	ld hl, UsedMoveInsteadText
 	ret

-UsedMove1Text:
-	text_far _UsedMove1Text
-	text_asm
-	jr UsedMoveText_CheckObedience
-
-UsedMove2Text:
-	text_far _UsedMove2Text
+UsedMoveInsteadText:
+	text_far _UsedMoveText
	text_asm
-UsedMoveText_CheckObedience:
 ; check obedience
 	ld a, [wAlreadyDisobeyed]
 	and a
 	jr z, .GetMoveNameText
 ; print "instead,"
 	ld hl, .UsedInsteadText
 	ret
 
 .UsedInsteadText:
 	text_far _UsedInsteadText
 	text_asm
 .GetMoveNameText:
 	ld hl, MoveNameText
 	ret
 
 MoveNameText:
 	text_far _MoveNameText
+	text_end
-	text_asm
-; get start address
-	ld hl, .endusedmovetexts
-
-	...
-
-GetMoveGrammar:
-	...
-	ret
-
-INCLUDE "data/moves/grammar.asm"
```

(If you're using an older version of pokecrystal that has `wd265` instead of `wMoveGrammar`, you don't need to replace `wd265` with `wTempByteValue`, but do need to make the other changes. Older versions also use `db "@"` instead of `text_end`.)

Now moves will still print correctly, but without wasting time and space on using certain grammar.

![Screenshot](screenshots/used-move-instead.png)