Skip to content

Commit

Permalink
Update battle messages to Gen 5+ standards (#3240)
Browse files Browse the repository at this point in the history
Co-authored-by: Eduardo Quezada <eduardo602002@gmail.com>
  • Loading branch information
kittenchilly and AsparagusEduardo authored Oct 21, 2024
1 parent 3205f37 commit db24128
Show file tree
Hide file tree
Showing 265 changed files with 2,888 additions and 2,393 deletions.
4 changes: 4 additions & 0 deletions charmap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ B_DEF_TEAM1 = FD 3A
B_DEF_TEAM2 = FD 3B
@ FD 3C - preiously gActiveBattler
@ FD 3D - preiously gActiveBattler without Illusion Check
B_ATK_NAME_WITH_PREFIX2 = FD 3E
B_DEF_NAME_WITH_PREFIX2 = FD 3F
B_EFF_NAME_WITH_PREFIX2 = FD 40
B_SCR_ACTIVE_NAME_WITH_PREFIX2 = FD 41

@ indicates the end of a town/city name (before " TOWN" or " CITY")
NAME_END = FC 00
Expand Down
8 changes: 2 additions & 6 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -3094,7 +3094,7 @@ BattleScript_DreamEaterWorked:
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
jumpifmovehadnoeffect BattleScript_DreamEaterTryFaintEnd
printstring STRINGID_PKMNDREAMEATEN
printstring STRINGID_PKMNENERGYDRAINED
waitmessage B_WAIT_TIME_LONG
BattleScript_DreamEaterTryFaintEnd:
tryfaintmon BS_TARGET
Expand Down Expand Up @@ -5962,7 +5962,7 @@ BattleScript_OverworldWeatherStarts::
end3

BattleScript_OverworldTerrain::
printfromtable gTerrainStringIds
printfromtable gTerrainStartsStringIds
waitmessage B_WAIT_TIME_LONG
playanimation BS_BATTLER_0, B_ANIM_RESTORE_BG
call BattleScript_ActivateTerrainEffects
Expand Down Expand Up @@ -9083,8 +9083,6 @@ BattleScript_BerryConfuseHealEnd2_Anim:
orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_SCRIPTING
datahpupdate BS_SCRIPTING
printstring STRINGID_FORXCOMMAYZ
waitmessage B_WAIT_TIME_LONG
seteffectprimary MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER
removeitem BS_SCRIPTING
end2
Expand All @@ -9101,8 +9099,6 @@ BattleScript_BerryConfuseHealRet_Anim:
orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_SCRIPTING
datahpupdate BS_SCRIPTING
printstring STRINGID_FORXCOMMAYZ
waitmessage B_WAIT_TIME_LONG
seteffectprimary MOVE_EFFECT_CONFUSION | MOVE_EFFECT_CERTAIN
removeitem BS_TARGET
return
Expand Down
16 changes: 8 additions & 8 deletions docs/tutorials/how_to_testing_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SINGLE_BATTLE_TEST("Stun Spore inflicts paralysis")
TURN { MOVE(player, MOVE_STUN_SPORE); } // 3.
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player);
MESSAGE("Foe Wobbuffet is paralyzed! It may be unable to move!"); // 4
MESSAGE("The opposing Wobbuffet is paralyzed, so it may be unable to move!"); // 4
STATUS_ICON(opponent, paralysis: TRUE); // 4.
}
}
Expand Down Expand Up @@ -86,7 +86,7 @@ SINGLE_BATTLE_TEST("Stun Spore does not affect Grass-types")
TURN { MOVE(player, MOVE_STUN_SPORE); } // 3.
} SCENE {
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player); // 4.
MESSAGE("It doesn't affect Foe Oddish…"); // 5.
MESSAGE("It doesn't affect the opposing Oddish…"); // 5.
}
}
```
Expand Down Expand Up @@ -226,7 +226,7 @@ SINGLE_BATTLE_TEST("Paralysis has a 25% chance of skipping the turn")
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
} SCENE {
MESSAGE("Wobbuffet is paralyzed! It can't move!");
MESSAGE("Wobbuffet couldn't move because it's paralyzed!");
}
}
```
Expand Down Expand Up @@ -428,7 +428,7 @@ Spaces in pattern match newlines (\n, \l, and \p) in the message.
Often used to check that a battler took its turn but it failed, e.g.:
```
MESSAGE("Wobbuffet used Dream Eater!");
MESSAGE("Foe Wobbuffet wasn't affected!");
MESSAGE("The opposing Wobbuffet wasn't affected!");
```

### `STATUS_ICON`
Expand All @@ -452,7 +452,7 @@ Causes the test to fail if the `SCENE` command succeeds before the following com
```
// Our Wobbuffet does not Celebrate before the foe's.
NOT MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("The opposing Wobbuffet used Celebrate!");
```
**NOTE**: If this condition fails, the viewable ROM freezes at the NOT command.
**WARNING: `NOT` is an alias of `NONE_OF`, so it behaves surprisingly when applied to multiple commands wrapped in braces.**
Expand All @@ -467,7 +467,7 @@ Causes the test to fail unless one of the `SCENE` commands succeeds.
```
ONE_OF {
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet is paralyzed! It can't move!");
MESSAGE("Wobbuffet couldn't move because it's paralyzed!");
}
```

Expand All @@ -482,9 +482,9 @@ Causes the test to fail if one of the `SCENE` commands succeeds before the comma
// Our Wobbuffet does not move before the foe's.
NONE_OF {
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet is paralyzed! It can't move!");
MESSAGE("Wobbuffet couldn't move because it's paralyzed!");
}
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("The opposing Wobbuffet used Celebrate!");
```

### `PLAYER_PARTY`
Expand Down
46 changes: 32 additions & 14 deletions include/battle_message.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#ifndef GUARD_BATTLE_MESSAGE_H
#define GUARD_BATTLE_MESSAGE_H

#include "constants/battle.h"

// This buffer can hold many different things. Some of the things it can hold
// that have explicit sizes are listed below to ensure it can contain them.
#define TEXT_BUFF_ARRAY_COUNT max(16, \
max(MOVE_NAME_LENGTH + 2, /* +2 to hold the "!" and EOS. */ \
max(POKEMON_NAME_LENGTH + 1, \
ABILITY_NAME_LENGTH + 1)))
#define BATTLE_MSG_MAX_WIDTH 208

// for 0xFD
#define B_TXT_BUFF1 0x0
Expand Down Expand Up @@ -71,20 +74,23 @@
#define B_TXT_DEF_TEAM2 0x3B // your/the opposing
// #define B_TXT_SELECTION_NAME 0x3C - removed
// #define B_TXT_SELECTION_NAME2 0x3D no Illusion check - removed
#define B_TXT_ATK_NAME_WITH_PREFIX2 0x3E //lowercase
#define B_TXT_DEF_NAME_WITH_PREFIX2 0x3F //lowercase
#define B_TXT_EFF_NAME_WITH_PREFIX2 0x40 //lowercase
#define B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX2 0x41 //lowercase

// for B_TXT_BUFF1, B_TXT_BUFF2 and B_TXT_BUFF3

#define B_BUFF_STRING 0
#define B_BUFF_NUMBER 1
#define B_BUFF_MOVE 2
#define B_BUFF_TYPE 3
#define B_BUFF_MON_NICK_WITH_PREFIX 4
#define B_BUFF_STAT 5
#define B_BUFF_SPECIES 6
#define B_BUFF_MON_NICK 7
#define B_BUFF_NEGATIVE_FLAVOR 8
#define B_BUFF_ABILITY 9
#define B_BUFF_ITEM 10
#define B_BUFF_STRING 0
#define B_BUFF_NUMBER 1
#define B_BUFF_MOVE 2
#define B_BUFF_TYPE 3
#define B_BUFF_MON_NICK_WITH_PREFIX 4
#define B_BUFF_STAT 5
#define B_BUFF_SPECIES 6
#define B_BUFF_MON_NICK 7
#define B_BUFF_NEGATIVE_FLAVOR 8
#define B_BUFF_ABILITY 9
#define B_BUFF_ITEM 10
#define B_BUFF_MON_NICK_WITH_PREFIX_LOWER 11 // lowercase prefix

#define B_BUFF_PLACEHOLDER_BEGIN 0xFD
#define B_BUFF_EOS 0xFF
Expand Down Expand Up @@ -201,6 +207,15 @@
textVar[4] = B_BUFF_EOS; \
}

#define PREPARE_MON_NICK_WITH_PREFIX_LOWER_BUFFER(textVar, battler, partyId) \
{ \
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
textVar[1] = B_BUFF_MON_NICK_WITH_PREFIX_LOWER; \
textVar[2] = battler; \
textVar[3] = partyId; \
textVar[4] = B_BUFF_EOS; \
}

#define PREPARE_MON_NICK_BUFFER(textVar, battler, partyId) \
{ \
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
Expand Down Expand Up @@ -243,7 +258,7 @@ enum

void BufferStringBattle(u16 stringID, u32 battler);
u32 BattleStringExpandPlaceholdersToDisplayedString(const u8 *src);
u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst);
u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize);
void BattlePutTextOnWindow(const u8 *text, u8 windowId);
void SetPpNumbersPaletteInMoveSelection(u32 battler);
u8 GetCurrentPpToMaxPpState(u8 currentPp, u8 maxPp);
Expand Down Expand Up @@ -302,6 +317,9 @@ extern const u8 gText_Loss[];
extern const u8 gText_Draw[];
extern const u8 gText_StatSharply[];
extern const u8 gText_StatRose[];
extern const u8 sText_StatFell[];
extern const u8 sText_drastically[];
extern const u8 sText_severely[];
extern const u8 gText_DefendersStatRose[];
extern const u8 gText_PkmnGettingPumped[];
extern const u8 gText_PkmnShroudedInMist[];
Expand Down
10 changes: 9 additions & 1 deletion include/constants/battle_string_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,16 @@
#define STRINGID_POKEFLUTECATCHY 714
#define STRINGID_POKEFLUTE 715
#define STRINGID_MONHEARINGFLUTEAWOKE 716
#define STRINGID_SUNLIGHTISHARSH 717
#define STRINGID_ITISHAILING 718
#define STRINGID_ITISSNOWING 719
#define STRINGID_ISCOVEREDWITHGRASS 720
#define STRINGID_MISTSWIRLSAROUND 721
#define STRINGID_ELECTRICCURRENTISRUNNING 722
#define STRINGID_SEEMSWEIRD 723
#define STRINGID_WAGGLINGAFINGER 724

#define BATTLESTRINGS_COUNT 717
#define BATTLESTRINGS_COUNT 725

// This is the string id that gBattleStringsTable starts with.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,
Expand Down
1 change: 1 addition & 0 deletions include/string_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ u8 *StringAppend(u8 *dest, const u8 *src);
u8 *StringCopyN(u8 *dest, const u8 *src, u8 n);
u8 *StringAppendN(u8 *dest, const u8 *src, u8 n);
u16 StringLength(const u8 *str);
u16 StringLineLength(const u8 *str);
s32 StringCompare(const u8 *str1, const u8 *str2);
s32 StringCompareN(const u8 *str1, const u8 *str2, u32 n);
bool8 IsStringLengthAtLeast(const u8 *str, s32 n);
Expand Down
26 changes: 13 additions & 13 deletions include/test/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* TURN { MOVE(player, MOVE_STUN_SPORE); } // 3.
* } SCENE {
* ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player);
* MESSAGE("Foe Wobbuffet is paralyzed! It may be unable to move!"); // 4
* MESSAGE("The opposing Wobbuffet is paralyzed, so it may be unable to move!"); // 4
* STATUS_ICON(opponent, paralysis: TRUE); // 4.
* }
* }
Expand Down Expand Up @@ -95,7 +95,7 @@
* TURN { MOVE(player, MOVE_STUN_SPORE); } // 3.
* } SCENE {
* NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player); // 4.
* MESSAGE("It doesn't affect Foe Oddish…"); // 5.
* MESSAGE("It doesn't affect the opposing Oddish…"); // 5.
* }
* }
*
Expand Down Expand Up @@ -256,7 +256,7 @@
* } WHEN {
* TURN { MOVE(player, MOVE_CELEBRATE); }
* } SCENE {
* MESSAGE("Wobbuffet is paralyzed! It can't move!");
* MESSAGE("Wobbuffet is paralyzed, so it may be unable to move!");
* }
* }
* All BattleRandom calls involving tag will return the same number, so
Expand Down Expand Up @@ -413,7 +413,7 @@
* Spaces in pattern match newlines (\n, \l, and \p) in the message.
* Often used to check that a battler took its turn but it failed, e.g.:
* MESSAGE("Wobbuffet used Dream Eater!");
* MESSAGE("Foe Wobbuffet wasn't affected!");
* MESSAGE("The opposing Wobbuffet wasn't affected!");
*
* STATUS_ICON(battler, status1 | none: | sleep: | poison: | burn: | freeze: | paralysis:, badPoison:)
* Causes the test to fail if the battler's status is not changed to the
Expand All @@ -432,15 +432,15 @@
* following command succeeds.
* // Our Wobbuffet does not Celebrate before the foe's.
* NOT MESSAGE("Wobbuffet used Celebrate!");
* MESSAGE("Foe Wobbuffet used Celebrate!");
* MESSAGE("The opposing Wobbuffet used Celebrate!");
* WARNING: NOT is an alias of NONE_OF, so it behaves surprisingly when
* applied to multiple commands wrapped in braces.
*
* ONE_OF
* Causes the test to fail unless one of the SCENE commands succeeds.
* ONE_OF {
* MESSAGE("Wobbuffet used Celebrate!");
* MESSAGE("Wobbuffet is paralyzed! It can't move!");
* MESSAGE("Wobbuffet is paralyzed, so it may be unable to move!");
* }
*
* NONE_OF
Expand All @@ -449,9 +449,9 @@
* // Our Wobbuffet does not move before the foe's.
* NONE_OF {
* MESSAGE("Wobbuffet used Celebrate!");
* MESSAGE("Wobbuffet is paralyzed! It can't move!");
* MESSAGE("Wobbuffet is paralyzed, so it may be unable to move!");
* }
* MESSAGE("Foe Wobbuffet used Celebrate!");
* MESSAGE("The opposing Wobbuffet used Celebrate!");
*
* PLAYER_PARTY and OPPONENT_PARTY
* Refer to the party members defined in GIVEN, e.g.:
Expand Down Expand Up @@ -1017,11 +1017,11 @@ void SendOut(u32 sourceLine, struct BattlePokemon *, u32 partyIndex);
MESSAGE(name ", good! Come back!"); \
}

#define SEND_IN_MESSAGE(name) ONE_OF { \
MESSAGE("Go! " name "!"); \
MESSAGE("Do it! " name "!"); \
MESSAGE("Go for it, " name "!"); \
MESSAGE("Your foe's weak! Get 'em, " name "!"); \
#define SEND_IN_MESSAGE(name) ONE_OF { \
MESSAGE("Go! " name "!"); \
MESSAGE("You're in charge, " name "!"); \
MESSAGE("Go for it, " name "!"); \
MESSAGE("Your opponent's weak! Get 'em, " name "!"); \
}

enum QueueGroupType
Expand Down
2 changes: 2 additions & 0 deletions include/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ bool32 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter);
bool32 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter);
bool32 TextPrinterWait(struct TextPrinter *textPrinter);
void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool32 drawArrow, u8 *counter, u8 *yCoordIndex);
s32 GetGlyphWidth(u16 glyphId, bool32 isJapanese, u8 fontId);
s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing);
s32 GetStringLineWidth(u8 fontId, const u8 *str, s16 letterSpacing, u32 lineNum, u32 strSize, bool32 printDebug);
u8 RenderTextHandleBold(u8 *pixels, u8 fontId, u8 *str);
u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y);
u8 GetKeypadIconTileOffset(u8 keypadIconId);
Expand Down
Loading

0 comments on commit db24128

Please sign in to comment.