summaryrefslogtreecommitdiff
path: root/Restore-and-localize-the-Japanese-move-grammar-table.md
blob: 5b06d81b013913e8b0287279a9d50ca3ba34210b (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
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*!")

This tutorial will showcase how to localize and restore the grammar table that once held the code responsible for showing these five ways. This tutorial will also fix grammatical issues with some of the move text.


## Contents

1. [Add in new, translated move text and fix other text](#1-add-in-new-translated-move-text-and-fix-other-text)
2. [Make the move text show properly ingame](#2-make-the-move-text-show-properly-ingame)

## 1. Add in new, translated move text and fix other text

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

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

_UsedMove1Text::
-	text_start
+	text " used"
-	line "used @"
+	line "@"
	text_end

_UsedMove2Text::
+_UsedMove3Text::
-	text_start
+	text " did"
-	line "used @"
+	line "@"
	text_end
+
+_UsedMove4Text::
+_UsedMove5Text::
+	text "'s"
+	line "@"
+	text_end
+
_UsedInsteadText::
-	text "instead,"
+	text " instead used"
-	cont "@"
+	line "@"
	text_end

_MoveNameText::
	text_ram wStringBuffer2
	text_end
-
-	text_end ; unused

_EndUsedMove1Text::
+_EndUsedMove2Text::
+_EndUsedMove3Text::
+_EndUsedMove5Text::
	text "!"
	done

-_EndUsedMove2Text::
-	text "!"
-	done
-
-_EndUsedMove3Text::
-	text "!"
-	done
-
_EndUsedMove4Text::
-	text "!"
+	text " attack!"
	done
-
-_EndUsedMove5Text::
-	text "!"
-	done
```

## 2. Make the move text show properly ingame

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

```diff
	push hl
	farcall CheckUserIsCharging
	pop hl
	jr nz, .grammar

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

.grammar
	call GetMoveGrammar ; convert move id to grammar index
-
-; 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
+	and a
-	ld hl, UsedMove2Text
+	ld hl, UsedMove1Text
-	ret c
+	ret z
+	dec a
-	ld hl, UsedMove1Text
+	ld hl, UsedMove2Text
+	ret z
+	dec a
+	ld hl, UsedMove3Text
+	ret z
+	dec a
+	ld hl, UsedMove4Text
+	ret z
+	ld hl, UsedMove5Text
	ret

UsedMove1Text:
	text_far _UsedMove1Text
	text_asm
	jr UsedMoveText_CheckObedience

UsedMove2Text:
	text_far _UsedMove2Text
	text_asm
+	jr UsedMoveText_CheckObedience
+
+UsedMove3Text:
+	text_far _UsedMove3Text
+	text_asm
+	jr UsedMoveText_CheckObedience
+
+UsedMove4Text:
+	text_far _UsedMove4Text
+	text_asm
+	jr UsedMoveText_CheckObedience
+
-UsedMove2Text:
+UsedMove5Text:
-	text_far _UsedMove2Text
+	text_far _UsedMove5Text
	text_asm
UsedMoveText_CheckObedience:
; check obedience
	ld a, [wAlreadyDisobeyed]
	and a
	jr z, .GetMoveNameText
-; print "instead,"
+; print "instead used"
	ld hl, .UsedInsteadText
	ret
```

Older versions of pokecrystal may use `db "@"` in place of `text_end`.