diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-07-18 14:35:05 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-07-18 14:35:05 -0400 |
commit | 01e9c090491470d808aacfada263b59cb009a9d1 (patch) | |
tree | 5d6f3def297088d67cb2fca21a79c296cfd117ca | |
parent | 89ff7c6f310fe71faf42a075c87bdc1865271e73 (diff) |
Remove the redundant move grammar table
-rw-r--r-- | Remove-the-redundant-move-grammar-table.md | 248 | ||||
-rw-r--r-- | Tutorials.md | 1 | ||||
-rw-r--r-- | screenshots/used-move-instead.png | bin | 0 -> 2753 bytes |
3 files changed, 249 insertions, 0 deletions
diff --git a/Remove-the-redundant-move-grammar-table.md b/Remove-the-redundant-move-grammar-table.md new file mode 100644 index 0000000..62097a7 --- /dev/null +++ b/Remove-the-redundant-move-grammar-table.md @@ -0,0 +1,248 @@ +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>@@" + +-_UsedMove1Text:: ++_UsedMoveText:: + text_start + line "used @@" +- +-_UsedMove2Text:: +- text_start +- line "used @@" + +_UsedInsteadText:: + text "instead," + cont "@@" + +_MoveNameText:: + text_from_ram wStringBuffer2 +- db "@@" +- +-_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_jump _ActorNameText + start_asm + ld 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 [wd265], a + + push hl + farcall CheckUserIsCharging + pop hl +- jr nz, .grammar ++ jr nz, .ok + + ; update last move + ld a, [wd265] + ld [hl], a + ld [de], a + +-.grammar +- call GetMoveGrammar +-; wd265 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, [wd265] +- cp $3 +- ld hl, UsedMove2Text +- ret c +- ld hl, UsedMove1Text ++.ok ++ ld hl, UsedMoveInsteadText + ret + +-UsedMove1Text: +- text_jump _UsedMove1Text +- start_asm +- jr UsedMoveText_CheckObedience +- +-UsedMove2Text: +- text_jump _UsedMove2Text ++UsedMoveInsteadText: ++ text_jump _UsedMoveText + start_asm +-UsedMoveText_CheckObedience: + ; check obedience + ld a, [wAlreadyDisobeyed] + and a + jr z, .GetMoveNameText + ; print "instead," + ld hl, .UsedInsteadText + ret + + .UsedInsteadText: + text_jump _UsedInsteadText + start_asm + .GetMoveNameText: + ld hl, MoveNameText + ret + + MoveNameText: + text_jump _MoveNameText +- start_asm +-; get start address +- ld hl, .endusedmovetexts +- +-; get move id +- ld a, [wd265] +- +-; 2-byte pointer +- add a +- +-; seek +- push bc +- ld b, $0 +- ld c, a +- add hl, bc +- pop bc +- +-; get pointer to usedmovetext ender +- ld a, [hli] +- ld h, [hl] +- ld l, a +- ret +- +-.endusedmovetexts +-; entries correspond to MoveGrammar sets +- dw EndUsedMove1Text +- dw EndUsedMove2Text +- dw EndUsedMove3Text +- dw EndUsedMove4Text +- dw EndUsedMove5Text +- +-EndUsedMove1Text: +- text_jump _EndUsedMove1Text +- db "@" +-EndUsedMove2Text: +- text_jump _EndUsedMove2Text +- db "@" +-EndUsedMove3Text: +- text_jump _EndUsedMove3Text +- db "@" +-EndUsedMove4Text: +- text_jump _EndUsedMove4Text +- db "@" +-EndUsedMove5Text: +- text_jump _EndUsedMove5Text + db "@" +- +-GetMoveGrammar: +-; store move grammar type in wd265 +- +- push bc +-; c = move id +- ld a, [wd265] +- ld c, a +- ld b, $0 +- +-; read grammar table +- ld hl, MoveGrammar +-.loop +- ld a, [hli] +-; end of table? +- cp -1 +- jr z, .end +-; match? +- cp c +- jr z, .end +-; advance grammar type at 0 +- and a +- jr nz, .loop +-; next grammar type +- inc b +- jr .loop +- +-.end +-; wd265 now contains move grammar +- ld a, b +- ld [wd265], a +- +-; we're done +- pop bc +- ret +- +-INCLUDE "data/moves/grammar.asm" +``` + +Now moves will still print correctly, but without wasting time and space on using certain grammar. + + diff --git a/Tutorials.md b/Tutorials.md index eb1bb84..17ea718 100644 --- a/Tutorials.md +++ b/Tutorials.md @@ -44,6 +44,7 @@ Tutorials may use diff syntax to show edits: - [Colored trainer card badges](Colored-trainer-card-badges) - [Show the tops of leaders' heads on the trainer card](Show-the-tops-of-leaders-heads-on-the-trainer-card) - [Correct grammar for plural trainers like Twins](Correct-grammar-for-plural-trainers-like-Twins) +- [Remove the redundant move grammar table](Remove-the-redundant-move-grammar-table) **Features from later generations:** diff --git a/screenshots/used-move-instead.png b/screenshots/used-move-instead.png Binary files differnew file mode 100644 index 0000000..57f80db --- /dev/null +++ b/screenshots/used-move-instead.png |