-
Notifications
You must be signed in to change notification settings - Fork 829
Remove the redundant move grammar table
Rangi edited this page Nov 11, 2018
·
9 revisions
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.
Simply delete data/moves/grammar.asm.
Edit data/text/common_2.asm:
_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
Edit engine/battle/used_move_text.asm:
UsedMoveText:
; this is a stream of text and asm from 105db9 to 105ef6
text_far _ActorNameText
start_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
- start_asm
- jr UsedMoveText_CheckObedience
-
-UsedMove2Text:
- text_far _UsedMove2Text
+UsedMoveInsteadText:
+ text_far _UsedMoveText
start_asm
-UsedMoveText_CheckObedience:
; check obedience
ld a, [wAlreadyDisobeyed]
and a
jr z, .GetMoveNameText
; print "instead,"
ld hl, .UsedInsteadText
ret
.UsedInsteadText:
text_far _UsedInsteadText
start_asm
.GetMoveNameText:
ld hl, MoveNameText
ret
MoveNameText:
text_far _MoveNameText
- start_asm
-; get start address
- ld hl, .endusedmovetexts
-
-; get move id
- ld a, [wMoveGrammar]
-
-; 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_far _EndUsedMove1Text
- db "@"
-EndUsedMove2Text:
- text_far _EndUsedMove2Text
- db "@"
-EndUsedMove3Text:
- text_far _EndUsedMove3Text
- db "@"
-EndUsedMove4Text:
- text_far _EndUsedMove4Text
- db "@"
-EndUsedMove5Text:
- text_far _EndUsedMove5Text
db "@"
-
-GetMoveGrammar:
-; store move grammar type in wMoveGrammar
-
- push bc
-; wMoveGrammar contains move id
- ld a, [wMoveGrammar]
- ld c, a ; move id
- ld b, 0 ; grammar index
-
-; 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
-; wMoveGrammar now contains move grammar
- ld a, b
- ld [wMoveGrammar], a
-
-; we're done
- pop bc
- 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.)
Now moves will still print correctly, but without wasting time and space on using certain grammar.