diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-04-10 12:41:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-10 12:41:35 -0400 |
commit | f6016838b1b0e2f0cf752b3b44c63e9e9776de4f (patch) | |
tree | c08712b996af85f4fce6156e48eaef86ec2a0fda /src | |
parent | 5e82db8dc3f10229635d6825fbcfc742740043f2 (diff) | |
parent | fe1b757af5ae8e8942d747863d04c4c33e5399d8 (diff) |
Merge pull request #1397 from GriffinRichards/doc-moremisc
Clean up battle scripts
Diffstat (limited to 'src')
-rw-r--r-- | src/battle_ai_switch_items.c | 31 | ||||
-rw-r--r-- | src/battle_controller_link_opponent.c | 6 | ||||
-rw-r--r-- | src/battle_controller_link_partner.c | 6 | ||||
-rw-r--r-- | src/battle_controller_opponent.c | 6 | ||||
-rw-r--r-- | src/battle_controller_player.c | 6 | ||||
-rw-r--r-- | src/battle_controller_player_partner.c | 6 | ||||
-rw-r--r-- | src/battle_controller_recorded_opponent.c | 6 | ||||
-rw-r--r-- | src/battle_controller_recorded_player.c | 6 | ||||
-rw-r--r-- | src/battle_controller_safari.c | 6 | ||||
-rw-r--r-- | src/battle_controller_wally.c | 18 | ||||
-rw-r--r-- | src/battle_controllers.c | 10 | ||||
-rw-r--r-- | src/battle_main.c | 10 | ||||
-rw-r--r-- | src/battle_message.c | 267 | ||||
-rw-r--r-- | src/battle_script_commands.c | 297 | ||||
-rw-r--r-- | src/battle_tv.c | 8 | ||||
-rw-r--r-- | src/battle_util.c | 147 | ||||
-rw-r--r-- | src/battle_util2.c | 7 | ||||
-rw-r--r-- | src/lilycove_lady.c | 19 | ||||
-rw-r--r-- | src/pokemon.c | 2 | ||||
-rw-r--r-- | src/tv.c | 90 |
20 files changed, 535 insertions, 419 deletions
diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 263c1e7cc..04122b17d 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -789,7 +789,7 @@ static u8 GetAI_ItemType(u8 itemId, const u8 *itemEffect) // NOTE: should take u else if (itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0) return AI_ITEM_X_STAT; else if (itemEffect[3] & ITEM3_GUARD_SPEC) - return AI_ITEM_GUARD_SPECS; + return AI_ITEM_GUARD_SPEC; else return AI_ITEM_NOT_RECOGNIZABLE; } @@ -863,32 +863,33 @@ static bool8 ShouldUseItem(void) *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0; if (itemEffects[3] & ITEM3_SLEEP && gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) { - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_HEAL_SLEEP); shouldUse = TRUE; } - if (itemEffects[3] & ITEM3_POISON && (gBattleMons[gActiveBattler].status1 & STATUS1_POISON || gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON)) + if (itemEffects[3] & ITEM3_POISON && (gBattleMons[gActiveBattler].status1 & STATUS1_POISON + || gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON)) { - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x10; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_HEAL_POISON); shouldUse = TRUE; } if (itemEffects[3] & ITEM3_BURN && gBattleMons[gActiveBattler].status1 & STATUS1_BURN) { - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_HEAL_BURN); shouldUse = TRUE; } if (itemEffects[3] & ITEM3_FREEZE && gBattleMons[gActiveBattler].status1 & STATUS1_FREEZE) { - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_HEAL_FREEZE); shouldUse = TRUE; } if (itemEffects[3] & ITEM3_PARALYSIS && gBattleMons[gActiveBattler].status1 & STATUS1_PARALYSIS) { - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_HEAL_PARALYSIS); shouldUse = TRUE; } if (itemEffects[3] & ITEM3_CONFUSION && gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION) { - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_HEAL_CONFUSION); shouldUse = TRUE; } break; @@ -897,20 +898,20 @@ static bool8 ShouldUseItem(void) if (gDisableStructs[gActiveBattler].isFirstTurn == 0) break; if (itemEffects[0] & ITEM0_X_ATTACK) - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_X_ATTACK); if (itemEffects[1] & ITEM1_X_DEFEND) - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_X_DEFEND); if (itemEffects[1] & ITEM1_X_SPEED) - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_X_SPEED); if (itemEffects[2] & ITEM2_X_SPATK) - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_X_SPATK); if (itemEffects[2] & ITEM2_X_ACCURACY) - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_X_ACCURACY); if (itemEffects[0] & ITEM0_DIRE_HIT) - *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x80; + *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_DIRE_HIT); shouldUse = TRUE; break; - case AI_ITEM_GUARD_SPECS: + case AI_ITEM_GUARD_SPEC: battlerSide = GetBattlerSide(gActiveBattler); if (gDisableStructs[gActiveBattler].isFirstTurn != 0 && gSideTimers[battlerSide].mistTimer == 0) shouldUse = TRUE; diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index dd44bc91b..179ae18e8 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -74,7 +74,7 @@ static void LinkOpponentHandleSetUnkVar(void); static void LinkOpponentHandleClearUnkFlag(void); static void LinkOpponentHandleToggleUnkFlag(void); static void LinkOpponentHandleHitAnimation(void); -static void LinkOpponentHandleCmd42(void); +static void LinkOpponentHandleCantSwitch(void); static void LinkOpponentHandlePlaySE(void); static void LinkOpponentHandlePlayFanfareOrBGM(void); static void LinkOpponentHandleFaintingCry(void); @@ -146,7 +146,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_CLEARUNKFLAG] = LinkOpponentHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = LinkOpponentHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = LinkOpponentHandleHitAnimation, - [CONTROLLER_42] = LinkOpponentHandleCmd42, + [CONTROLLER_CANTSWITCH] = LinkOpponentHandleCantSwitch, [CONTROLLER_PLAYSE] = LinkOpponentHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = LinkOpponentHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = LinkOpponentHandleFaintingCry, @@ -1647,7 +1647,7 @@ static void LinkOpponentHandleHitAnimation(void) } } -static void LinkOpponentHandleCmd42(void) +static void LinkOpponentHandleCantSwitch(void) { LinkOpponentBufferExecCompleted(); } diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 3d6cd7c3b..2bb1cd914 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -72,7 +72,7 @@ static void LinkPartnerHandleSetUnkVar(void); static void LinkPartnerHandleClearUnkFlag(void); static void LinkPartnerHandleToggleUnkFlag(void); static void LinkPartnerHandleHitAnimation(void); -static void LinkPartnerHandleCmd42(void); +static void LinkPartnerHandleCantSwitch(void); static void LinkPartnerHandlePlaySE(void); static void LinkPartnerHandlePlayFanfareOrBGM(void); static void LinkPartnerHandleFaintingCry(void); @@ -143,7 +143,7 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_CLEARUNKFLAG] = LinkPartnerHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = LinkPartnerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = LinkPartnerHandleHitAnimation, - [CONTROLLER_42] = LinkPartnerHandleCmd42, + [CONTROLLER_CANTSWITCH] = LinkPartnerHandleCantSwitch, [CONTROLLER_PLAYSE] = LinkPartnerHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = LinkPartnerHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = LinkPartnerHandleFaintingCry, @@ -1477,7 +1477,7 @@ static void LinkPartnerHandleHitAnimation(void) } } -static void LinkPartnerHandleCmd42(void) +static void LinkPartnerHandleCantSwitch(void) { LinkPartnerBufferExecCompleted(); } diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 69f729ee0..2c181c14f 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -79,7 +79,7 @@ static void OpponentHandleSetUnkVar(void); static void OpponentHandleClearUnkFlag(void); static void OpponentHandleToggleUnkFlag(void); static void OpponentHandleHitAnimation(void); -static void OpponentHandleCmd42(void); +static void OpponentHandleCantSwitch(void); static void OpponentHandlePlaySE(void); static void OpponentHandlePlayFanfareOrBGM(void); static void OpponentHandleFaintingCry(void); @@ -151,7 +151,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_CLEARUNKFLAG] = OpponentHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = OpponentHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = OpponentHandleHitAnimation, - [CONTROLLER_42] = OpponentHandleCmd42, + [CONTROLLER_CANTSWITCH] = OpponentHandleCantSwitch, [CONTROLLER_PLAYSE] = OpponentHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = OpponentHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = OpponentHandleFaintingCry, @@ -1813,7 +1813,7 @@ static void OpponentHandleHitAnimation(void) } } -static void OpponentHandleCmd42(void) +static void OpponentHandleCantSwitch(void) { OpponentBufferExecCompleted(); } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 7b5e55adb..e7801d0e4 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -80,7 +80,7 @@ static void PlayerHandleSetUnkVar(void); static void PlayerHandleClearUnkFlag(void); static void PlayerHandleToggleUnkFlag(void); static void PlayerHandleHitAnimation(void); -static void PlayerHandleCmd42(void); +static void PlayerHandleCantSwitch(void); static void PlayerHandlePlaySE(void); static void PlayerHandlePlayFanfareOrBGM(void); static void PlayerHandleFaintingCry(void); @@ -167,7 +167,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_CLEARUNKFLAG] = PlayerHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = PlayerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = PlayerHandleHitAnimation, - [CONTROLLER_42] = PlayerHandleCmd42, + [CONTROLLER_CANTSWITCH] = PlayerHandleCantSwitch, [CONTROLLER_PLAYSE] = PlayerHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = PlayerHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = PlayerHandleFaintingCry, @@ -2890,7 +2890,7 @@ static void PlayerHandleHitAnimation(void) } } -static void PlayerHandleCmd42(void) +static void PlayerHandleCantSwitch(void) { PlayerBufferExecCompleted(); } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 251542a48..cc433a9b2 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -70,7 +70,7 @@ static void PlayerPartnerHandleSetUnkVar(void); static void PlayerPartnerHandleClearUnkFlag(void); static void PlayerPartnerHandleToggleUnkFlag(void); static void PlayerPartnerHandleHitAnimation(void); -static void PlayerPartnerHandleCmd42(void); +static void PlayerPartnerHandleCantSwitch(void); static void PlayerPartnerHandlePlaySE(void); static void PlayerPartnerHandlePlayFanfareOrBGM(void); static void PlayerPartnerHandleFaintingCry(void); @@ -146,7 +146,7 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_CLEARUNKFLAG] = PlayerPartnerHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = PlayerPartnerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = PlayerPartnerHandleHitAnimation, - [CONTROLLER_42] = PlayerPartnerHandleCmd42, + [CONTROLLER_CANTSWITCH] = PlayerPartnerHandleCantSwitch, [CONTROLLER_PLAYSE] = PlayerPartnerHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = PlayerPartnerHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = PlayerPartnerHandleFaintingCry, @@ -1727,7 +1727,7 @@ static void PlayerPartnerHandleHitAnimation(void) } } -static void PlayerPartnerHandleCmd42(void) +static void PlayerPartnerHandleCantSwitch(void) { PlayerPartnerBufferExecCompleted(); } diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 26d93ad28..663d71ec7 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -74,7 +74,7 @@ static void RecordedOpponentHandleSetUnkVar(void); static void RecordedOpponentHandleClearUnkFlag(void); static void RecordedOpponentHandleToggleUnkFlag(void); static void RecordedOpponentHandleHitAnimation(void); -static void RecordedOpponentHandleCmd42(void); +static void RecordedOpponentHandleCantSwitch(void); static void RecordedOpponentHandlePlaySE(void); static void RecordedOpponentHandlePlayFanfareOrBGM(void); static void RecordedOpponentHandleFaintingCry(void); @@ -146,7 +146,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void [CONTROLLER_CLEARUNKFLAG] = RecordedOpponentHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = RecordedOpponentHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = RecordedOpponentHandleHitAnimation, - [CONTROLLER_42] = RecordedOpponentHandleCmd42, + [CONTROLLER_CANTSWITCH] = RecordedOpponentHandleCantSwitch, [CONTROLLER_PLAYSE] = RecordedOpponentHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = RecordedOpponentHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = RecordedOpponentHandleFaintingCry, @@ -1587,7 +1587,7 @@ static void RecordedOpponentHandleHitAnimation(void) } } -static void RecordedOpponentHandleCmd42(void) +static void RecordedOpponentHandleCantSwitch(void) { RecordedOpponentBufferExecCompleted(); } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 63a04ac40..aa4154a3f 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -70,7 +70,7 @@ static void RecordedPlayerHandleSetUnkVar(void); static void RecordedPlayerHandleClearUnkFlag(void); static void RecordedPlayerHandleToggleUnkFlag(void); static void RecordedPlayerHandleHitAnimation(void); -static void RecordedPlayerHandleCmd42(void); +static void RecordedPlayerHandleCantSwitch(void); static void RecordedPlayerHandlePlaySE(void); static void RecordedPlayerHandlePlayFanfareOrBGM(void); static void RecordedPlayerHandleFaintingCry(void); @@ -141,7 +141,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) [CONTROLLER_CLEARUNKFLAG] = RecordedPlayerHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = RecordedPlayerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = RecordedPlayerHandleHitAnimation, - [CONTROLLER_42] = RecordedPlayerHandleCmd42, + [CONTROLLER_CANTSWITCH] = RecordedPlayerHandleCantSwitch, [CONTROLLER_PLAYSE] = RecordedPlayerHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = RecordedPlayerHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = RecordedPlayerHandleFaintingCry, @@ -1610,7 +1610,7 @@ static void RecordedPlayerHandleHitAnimation(void) } } -static void RecordedPlayerHandleCmd42(void) +static void RecordedPlayerHandleCantSwitch(void) { RecordedPlayerBufferExecCompleted(); } diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 22c01586d..0fdf32fb6 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -67,7 +67,7 @@ static void SafariHandleSetUnkVar(void); static void SafariHandleClearUnkFlag(void); static void SafariHandleToggleUnkFlag(void); static void SafariHandleHitAnimation(void); -static void SafariHandleCmd42(void); +static void SafariHandleCantSwitch(void); static void SafariHandlePlaySE(void); static void SafariHandlePlayFanfareOrBGM(void); static void SafariHandleFaintingCry(void); @@ -131,7 +131,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_CLEARUNKFLAG] = SafariHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = SafariHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = SafariHandleHitAnimation, - [CONTROLLER_42] = SafariHandleCmd42, + [CONTROLLER_CANTSWITCH] = SafariHandleCantSwitch, [CONTROLLER_PLAYSE] = SafariHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = SafariHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = SafariHandleFaintingCry, @@ -580,7 +580,7 @@ static void SafariHandleHitAnimation(void) SafariBufferExecCompleted(); } -static void SafariHandleCmd42(void) +static void SafariHandleCantSwitch(void) { SafariBufferExecCompleted(); } diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 8b3863c85..0d1515213 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -75,7 +75,7 @@ static void WallyHandleSetUnkVar(void); static void WallyHandleClearUnkFlag(void); static void WallyHandleToggleUnkFlag(void); static void WallyHandleHitAnimation(void); -static void WallyHandleCmd42(void); +static void WallyHandleCantSwitch(void); static void WallyHandlePlaySE(void); static void WallyHandlePlayFanfareOrBGM(void); static void WallyHandleFaintingCry(void); @@ -144,7 +144,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_CLEARUNKFLAG] = WallyHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = WallyHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = WallyHandleHitAnimation, - [CONTROLLER_42] = WallyHandleCmd42, + [CONTROLLER_CANTSWITCH] = WallyHandleCantSwitch, [CONTROLLER_PLAYSE] = WallyHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = WallyHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = WallyHandleFaintingCry, @@ -190,7 +190,7 @@ static void WallyHandleActions(void) switch (gBattleStruct->wallyBattleState) { case 0: - gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyWaitFrames = B_WAIT_TIME_LONG; gBattleStruct->wallyBattleState++; case 1: if (--gBattleStruct->wallyWaitFrames == 0) @@ -200,7 +200,7 @@ static void WallyHandleActions(void) WallyBufferExecCompleted(); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; - gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyWaitFrames = B_WAIT_TIME_LONG; } break; case 2: @@ -211,17 +211,17 @@ static void WallyHandleActions(void) WallyBufferExecCompleted(); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; - gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyWaitFrames = B_WAIT_TIME_LONG; } break; case 3: if (--gBattleStruct->wallyWaitFrames == 0) { - BtlController_EmitTwoReturnValues(1, 9, 0); + BtlController_EmitTwoReturnValues(1, B_ACTION_WALLY_THROW, 0); WallyBufferExecCompleted(); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; - gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyWaitFrames = B_WAIT_TIME_LONG; } break; case 4: @@ -230,7 +230,7 @@ static void WallyHandleActions(void) PlaySE(SE_SELECT); ActionSelectionDestroyCursorAt(0); ActionSelectionCreateCursorAt(1, 0); - gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyWaitFrames = B_WAIT_TIME_LONG; gBattleStruct->wallyBattleState++; } break; @@ -1385,7 +1385,7 @@ static void WallyHandleHitAnimation(void) } } -static void WallyHandleCmd42(void) +static void WallyHandleCantSwitch(void) { WallyBufferExecCompleted(); } diff --git a/src/battle_controllers.c b/src/battle_controllers.c index a9f3ab610..0f3234579 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -1385,12 +1385,12 @@ void BtlController_EmitHitAnimation(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitCmd42(u8 bufferId) +void BtlController_EmitCantSwitch(u8 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_42; - sBattleBuffersTransferData[1] = CONTROLLER_42; - sBattleBuffersTransferData[2] = CONTROLLER_42; - sBattleBuffersTransferData[3] = CONTROLLER_42; + sBattleBuffersTransferData[0] = CONTROLLER_CANTSWITCH; + sBattleBuffersTransferData[1] = CONTROLLER_CANTSWITCH; + sBattleBuffersTransferData[2] = CONTROLLER_CANTSWITCH; + sBattleBuffersTransferData[3] = CONTROLLER_CANTSWITCH; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } diff --git a/src/battle_main.c b/src/battle_main.c index 9bb2268a6..8a85c27f5 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3959,7 +3959,7 @@ u8 IsRunningFromBattleImpossible(void) { gBattleScripting.battler = i; gLastUsedAbility = gBattleMons[i].ability; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PREVENTS_ESCAPE; return 2; } if (side != GetBattlerSide(i) @@ -3969,7 +3969,7 @@ u8 IsRunningFromBattleImpossible(void) { gBattleScripting.battler = i; gLastUsedAbility = gBattleMons[i].ability; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PREVENTS_ESCAPE; return 2; } } @@ -3978,18 +3978,18 @@ u8 IsRunningFromBattleImpossible(void) { gBattleScripting.battler = i - 1; gLastUsedAbility = gBattleMons[i - 1].ability; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PREVENTS_ESCAPE; return 2; } if ((gBattleMons[gActiveBattler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) || (gStatuses3[gActiveBattler] & STATUS3_ROOTED)) { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_ESCAPE; return 1; } if (gBattleTypeFlags & BATTLE_TYPE_FIRST_BATTLE) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DONT_LEAVE_BIRCH; return 1; } return 0; diff --git a/src/battle_message.c b/src/battle_message.c index 219a33bb9..2e752dcca 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -305,11 +305,11 @@ static const u8 sText_StatSharply[] = _("sharply "); const u8 gText_StatRose[] = _("rose!"); static const u8 sText_StatHarshly[] = _("harshly "); static const u8 sText_StatFell[] = _("fell!"); -static const u8 sText_PkmnsStatChanged[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1}\n{B_BUFF2}"); -const u8 gText_PkmnsStatChanged2[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}\n{B_BUFF2}"); -static const u8 sText_UsingXTheYOfZN[] = _("Using {B_LAST_ITEM}, the {B_BUFF1}\nof {B_SCR_ACTIVE_NAME_WITH_PREFIX} {B_BUFF2}"); -static const u8 sText_PkmnsStatChanged3[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1}\n{B_BUFF2}"); -static const u8 sText_PkmnsStatChanged4[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}\n{B_BUFF2}"); +static const u8 sText_AttackersStatRose[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1}\n{B_BUFF2}"); +const u8 gText_DefendersStatRose[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}\n{B_BUFF2}"); +static const u8 sText_UsingItemTheStatOfPkmnRose[] = _("Using {B_LAST_ITEM}, the {B_BUFF1}\nof {B_SCR_ACTIVE_NAME_WITH_PREFIX} {B_BUFF2}"); +static const u8 sText_AttackersStatFell[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1}\n{B_BUFF2}"); +static const u8 sText_DefendersStatFell[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}\n{B_BUFF2}"); static const u8 sText_StatsWontIncrease2[] = _("{B_ATK_NAME_WITH_PREFIX}'s stats won't\ngo any higher!"); static const u8 sText_StatsWontDecrease2[] = _("{B_DEF_NAME_WITH_PREFIX}'s stats won't\ngo any lower!"); static const u8 sText_CriticalHit[] = _("A critical hit!"); @@ -721,10 +721,10 @@ const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_STATROSE - 12] = gText_StatRose, [STRINGID_STATHARSHLY - 12] = sText_StatHarshly, [STRINGID_STATFELL - 12] = sText_StatFell, - [STRINGID_PKMNSSTATCHANGED - 12] = sText_PkmnsStatChanged, - [STRINGID_PKMNSSTATCHANGED2 - 12] = gText_PkmnsStatChanged2, - [STRINGID_PKMNSSTATCHANGED3 - 12] = sText_PkmnsStatChanged3, - [STRINGID_PKMNSSTATCHANGED4 - 12] = sText_PkmnsStatChanged4, + [STRINGID_ATTACKERSSTATROSE - 12] = sText_AttackersStatRose, + [STRINGID_DEFENDERSSTATROSE - 12] = gText_DefendersStatRose, + [STRINGID_ATTACKERSSTATFELL - 12] = sText_AttackersStatFell, + [STRINGID_DEFENDERSSTATFELL - 12] = sText_DefendersStatFell, [STRINGID_CRITICALHIT - 12] = sText_CriticalHit, [STRINGID_ONEHITKO - 12] = sText_OneHitKO, [STRINGID_123POOF - 12] = sText_123Poof, @@ -833,7 +833,7 @@ const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_SOOTHINGAROMA - 12] = sText_SoothingAroma, [STRINGID_ITEMSCANTBEUSEDNOW - 12] = sText_ItemsCantBeUsedNow, [STRINGID_FORXCOMMAYZ - 12] = sText_ForXCommaYZ, - [STRINGID_USINGXTHEYOFZN - 12] = sText_UsingXTheYOfZN, + [STRINGID_USINGITEMSTATOFPKMNROSE - 12] = sText_UsingItemTheStatOfPkmnRose, [STRINGID_PKMNUSEDXTOGETPUMPED - 12] = sText_PkmnUsedXToGetPumped, [STRINGID_PKMNSXMADEYUSELESS - 12] = sText_PkmnsXMadeYUseless, [STRINGID_PKMNTRAPPEDBYSANDTOMB - 12] = sText_PkmnTrappedBySandTomb, @@ -893,112 +893,149 @@ const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] = const u16 gMissStringIds[] = { - STRINGID_ATTACKMISSED, STRINGID_PKMNPROTECTEDITSELF, - STRINGID_PKMNAVOIDEDATTACK, STRINGID_AVOIDEDDAMAGE, - STRINGID_PKMNMAKESGROUNDMISS + [B_MSG_MISSED] = STRINGID_ATTACKMISSED, + [B_MSG_PROTECTED] = STRINGID_PKMNPROTECTEDITSELF, + [B_MSG_AVOIDED_ATK] = STRINGID_PKMNAVOIDEDATTACK, + [B_MSG_AVOIDED_DMG] = STRINGID_AVOIDEDDAMAGE, + [B_MSG_GROUND_MISS] = STRINGID_PKMNMAKESGROUNDMISS }; const u16 gNoEscapeStringIds[] = { - STRINGID_CANTESCAPE, STRINGID_DONTLEAVEBIRCH, STRINGID_PREVENTSESCAPE, - STRINGID_CANTESCAPE2, STRINGID_ATTACKERCANTESCAPE + [B_MSG_CANT_ESCAPE] = STRINGID_CANTESCAPE, + [B_MSG_DONT_LEAVE_BIRCH] = STRINGID_DONTLEAVEBIRCH, + [B_MSG_PREVENTS_ESCAPE] = STRINGID_PREVENTSESCAPE, + [B_MSG_CANT_ESCAPE_2] = STRINGID_CANTESCAPE2, + [B_MSG_ATTACKER_CANT_ESCAPE] = STRINGID_ATTACKERCANTESCAPE }; const u16 gMoveWeatherChangeStringIds[] = { - STRINGID_STARTEDTORAIN, STRINGID_DOWNPOURSTARTED, STRINGID_BUTITFAILED, - STRINGID_SANDSTORMBREWED, STRINGID_SUNLIGHTGOTBRIGHT, STRINGID_STARTEDHAIL + [B_MSG_STARTED_RAIN] = STRINGID_STARTEDTORAIN, + [B_MSG_STARTED_DOWNPOUR] = STRINGID_DOWNPOURSTARTED, // Unused + [B_MSG_WEATHER_FAILED] = STRINGID_BUTITFAILED, + [B_MSG_STARTED_SANDSTORM] = STRINGID_SANDSTORMBREWED, + [B_MSG_STARTED_SUNLIGHT] = STRINGID_SUNLIGHTGOTBRIGHT, + [B_MSG_STARTED_HAIL] = STRINGID_STARTEDHAIL, }; const u16 gSandStormHailContinuesStringIds[] = { - STRINGID_SANDSTORMRAGES, STRINGID_HAILCONTINUES + [B_MSG_SANDSTORM] = STRINGID_SANDSTORMRAGES, + [B_MSG_HAIL] = STRINGID_HAILCONTINUES }; const u16 gSandStormHailDmgStringIds[] = { - STRINGID_PKMNBUFFETEDBYSANDSTORM, STRINGID_PKMNPELTEDBYHAIL + [B_MSG_SANDSTORM] = STRINGID_PKMNBUFFETEDBYSANDSTORM, + [B_MSG_HAIL] = STRINGID_PKMNPELTEDBYHAIL }; const u16 gSandStormHailEndStringIds[] = { - STRINGID_SANDSTORMSUBSIDED, STRINGID_HAILSTOPPED + [B_MSG_SANDSTORM] = STRINGID_SANDSTORMSUBSIDED, + [B_MSG_HAIL] = STRINGID_HAILSTOPPED }; const u16 gRainContinuesStringIds[] = { - STRINGID_RAINCONTINUES, STRINGID_DOWNPOURCONTINUES, STRINGID_RAINSTOPPED + [B_MSG_RAIN_CONTINUES] = STRINGID_RAINCONTINUES, + [B_MSG_DOWNPOUR_CONTINUES] = STRINGID_DOWNPOURCONTINUES, + [B_MSG_RAIN_STOPPED] = STRINGID_RAINSTOPPED }; const u16 gProtectLikeUsedStringIds[] = { - STRINGID_PKMNPROTECTEDITSELF2, STRINGID_PKMNBRACEDITSELF, STRINGID_BUTITFAILED + [B_MSG_PROTECTED_ITSELF] = STRINGID_PKMNPROTECTEDITSELF2, + [B_MSG_BRACED_ITSELF] = STRINGID_PKMNBRACEDITSELF, + [B_MSG_PROTECT_FAILED] = STRINGID_BUTITFAILED, }; const u16 gReflectLightScreenSafeguardStringIds[] = { - STRINGID_BUTITFAILED, STRINGID_PKMNRAISEDDEF, STRINGID_PKMNRAISEDDEFALITTLE, - STRINGID_PKMNRAISEDSPDEF, STRINGID_PKMNRAISEDSPDEFALITTLE, STRINGID_PKMNCOVEREDBYVEIL + [B_MSG_SIDE_STATUS_FAILED] = STRINGID_BUTITFAILED, + [B_MSG_SET_REFLECT_SINGLE] = STRINGID_PKMNRAISEDDEF, + [B_MSG_SET_REFLECT_DOUBLE] = STRINGID_PKMNRAISEDDEFALITTLE, + [B_MSG_SET_LIGHTSCREEN_SINGLE] = STRINGID_PKMNRAISEDSPDEF, + [B_MSG_SET_LIGHTSCREEN_DOUBLE] = STRINGID_PKMNRAISEDSPDEFALITTLE, + [B_MSG_SET_SAFEGUARD] = STRINGID_PKMNCOVEREDBYVEIL, }; const u16 gLeechSeedStringIds[] = { - STRINGID_PKMNSEEDED, STRINGID_PKMNEVADEDATTACK, - STRINGID_ITDOESNTAFFECT, STRINGID_PKMNSAPPEDBYLEECHSEED, STRINGID_ITSUCKEDLIQUIDOOZE, + [B_MSG_LEECH_SEED_SET] = STRINGID_PKMNSEEDED, + [B_MSG_LEECH_SEED_MISS] = STRINGID_PKMNEVADEDATTACK, + [B_MSG_LEECH_SEED_FAIL] = STRINGID_ITDOESNTAFFECT, + [B_MSG_LEECH_SEED_DRAIN] = STRINGID_PKMNSAPPEDBYLEECHSEED, + [B_MSG_LEECH_SEED_OOZE] = STRINGID_ITSUCKEDLIQUIDOOZE, }; const u16 gRestUsedStringIds[] = { - STRINGID_PKMNWENTTOSLEEP, STRINGID_PKMNSLEPTHEALTHY + [B_MSG_REST] = STRINGID_PKMNWENTTOSLEEP, + [B_MSG_REST_STATUSED] = STRINGID_PKMNSLEPTHEALTHY }; const u16 gUproarOverTurnStringIds[] = { - STRINGID_PKMNMAKINGUPROAR, STRINGID_PKMNCALMEDDOWN + [B_MSG_UPROAR_CONTINUES] = STRINGID_PKMNMAKINGUPROAR, + [B_MSG_UPROAR_ENDS] = STRINGID_PKMNCALMEDDOWN }; const u16 gStockpileUsedStringIds[] = { - STRINGID_PKMNSTOCKPILED, STRINGID_PKMNCANTSTOCKPILE, + [B_MSG_STOCKPILED] = STRINGID_PKMNSTOCKPILED, + [B_MSG_CANT_STOCKPILE] = STRINGID_PKMNCANTSTOCKPILE, }; const u16 gWokeUpStringIds[] = { - STRINGID_PKMNWOKEUP, STRINGID_PKMNWOKEUPINUPROAR + [B_MSG_WOKE_UP] = STRINGID_PKMNWOKEUP, + [B_MSG_WOKE_UP_UPROAR] = STRINGID_PKMNWOKEUPINUPROAR }; const u16 gSwallowFailStringIds[] = { - STRINGID_FAILEDTOSWALLOW, STRINGID_PKMNHPFULL + [B_MSG_SWALLOW_FAILED] = STRINGID_FAILEDTOSWALLOW, + [B_MSG_SWALLOW_FULL_HP] = STRINGID_PKMNHPFULL }; const u16 gUproarAwakeStringIds[] = { - STRINGID_PKMNCANTSLEEPINUPROAR2, STRINGID_UPROARKEPTPKMNAWAKE, STRINGID_PKMNSTAYEDAWAKEUSING + [B_MSG_CANT_SLEEP_UPROAR] = STRINGID_PKMNCANTSLEEPINUPROAR2, + [B_MSG_UPROAR_KEPT_AWAKE] = STRINGID_UPROARKEPTPKMNAWAKE, + [B_MSG_STAYED_AWAKE_USING] = STRINGID_PKMNSTAYEDAWAKEUSING, }; const u16 gStatUpStringIds[] = { - STRINGID_PKMNSSTATCHANGED, STRINGID_PKMNSSTATCHANGED2, STRINGID_STATSWONTINCREASE, - STRINGID_EMPTYSTRING3, STRINGID_USINGXTHEYOFZN, STRINGID_PKMNUSEDXTOGETPUMPED + [B_MSG_ATTACKER_STAT_ROSE] = STRINGID_ATTACKERSSTATROSE, + [B_MSG_DEFENDER_STAT_ROSE] = STRINGID_DEFENDERSSTATROSE, + [B_MSG_STAT_WONT_INCREASE] = STRINGID_STATSWONTINCREASE, + [B_MSG_STAT_ROSE_EMPTY] = STRINGID_EMPTYSTRING3, + [B_MSG_STAT_ROSE_ITEM] = STRINGID_USINGITEMSTATOFPKMNROSE, + [B_MSG_USED_DIRE_HIT] = STRINGID_PKMNUSEDXTOGETPUMPED, }; const u16 gStatDownStringIds[] = { - STRINGID_PKMNSSTATCHANGED3, STRINGID_PKMNSSTATCHANGED4, STRINGID_STATSWONTDECREASE, STRINGID_EMPTYSTRING3 + [B_MSG_ATTACKER_STAT_FELL] = STRINGID_ATTACKERSSTATFELL, + [B_MSG_DEFENDER_STAT_FELL] = STRINGID_DEFENDERSSTATFELL, + [B_MSG_STAT_WONT_DECREASE] = STRINGID_STATSWONTDECREASE, + [B_MSG_STAT_FELL_EMPTY] = STRINGID_EMPTYSTRING3, }; // Index read from sTWOTURN_STRINGID const u16 gFirstTurnOfTwoStringIds[] = { - STRINGID_PKMNWHIPPEDWHIRLWIND, // MOVE_RAZOR_WIND - STRINGID_PKMNTOOKSUNLIGHT, // MOVE_SOLAR_BEAM - STRINGID_PKMNLOWEREDHEAD, // MOVE_SKULL_BASH - STRINGID_PKMNISGLOWING, // MOVE_SKY_ATTACK - STRINGID_PKMNFLEWHIGH, // MOVE_FLY - STRINGID_PKMNDUGHOLE, // MOVE_DIG - STRINGID_PKMNHIDUNDERWATER, // MOVE_DIVE - STRINGID_PKMNSPRANGUP // MOVE_BOUNCE + [B_MSG_TURN1_RAZOR_WIND] = STRINGID_PKMNWHIPPEDWHIRLWIND, + [B_MSG_TURN1_SOLAR_BEAM] = STRINGID_PKMNTOOKSUNLIGHT, + [B_MSG_TURN1_SKULL_BASH] = STRINGID_PKMNLOWEREDHEAD, + [B_MSG_TURN1_SKY_ATTACK] = STRINGID_PKMNISGLOWING, + [B_MSG_TURN1_FLY] = STRINGID_PKMNFLEWHIGH, + [B_MSG_TURN1_DIG] = STRINGID_PKMNDUGHOLE, + [B_MSG_TURN1_DIVE] = STRINGID_PKMNHIDUNDERWATER, + [B_MSG_TURN1_BOUNCE] = STRINGID_PKMNSPRANGUP, }; // Index copied from move's index in gTrappingMoves @@ -1014,89 +1051,109 @@ const u16 gWrappedStringIds[] = const u16 gMistUsedStringIds[] = { - STRINGID_PKMNSHROUDEDINMIST, STRINGID_BUTITFAILED + [B_MSG_SET_MIST] = STRINGID_PKMNSHROUDEDINMIST, + [B_MSG_MIST_FAILED] = STRINGID_BUTITFAILED }; const u16 gFocusEnergyUsedStringIds[] = { - STRINGID_PKMNGETTINGPUMPED, STRINGID_BUTITFAILED + [B_MSG_GETTING_PUMPED] = STRINGID_PKMNGETTINGPUMPED, + [B_MSG_FOCUS_ENERGY_FAILED] = STRINGID_BUTITFAILED }; const u16 gTransformUsedStringIds[] = { - STRINGID_PKMNTRANSFORMEDINTO, STRINGID_BUTITFAILED + [B_MSG_TRANSFORMED] = STRINGID_PKMNTRANSFORMEDINTO, + [B_MSG_TRANSFORM_FAILED] = STRINGID_BUTITFAILED }; const u16 gSubsituteUsedStringIds[] = { - STRINGID_PKMNMADESUBSTITUTE, STRINGID_TOOWEAKFORSUBSTITUTE + [B_MSG_SET_SUBSTITUTE] = STRINGID_PKMNMADESUBSTITUTE, + [B_MSG_SUBSTITUTE_FAILED] = STRINGID_TOOWEAKFORSUBSTITUTE }; const u16 gGotPoisonedStringIds[] = { - STRINGID_PKMNWASPOISONED, STRINGID_PKMNPOISONEDBY + [B_MSG_STATUSED] = STRINGID_PKMNWASPOISONED, + [B_MSG_STATUSED_BY_ABILITY] = STRINGID_PKMNPOISONEDBY }; const u16 gGotParalyzedStringIds[] = { - STRINGID_PKMNWASPARALYZED, STRINGID_PKMNWASPARALYZEDBY + [B_MSG_STATUSED] = STRINGID_PKMNWASPARALYZED, + [B_MSG_STATUSED_BY_ABILITY] = STRINGID_PKMNWASPARALYZEDBY }; const u16 gFellAsleepStringIds[] = { - STRINGID_PKMNFELLASLEEP, STRINGID_PKMNMADESLEEP, + [B_MSG_STATUSED] = STRINGID_PKMNFELLASLEEP, + [B_MSG_STATUSED_BY_ABILITY] = STRINGID_PKMNMADESLEEP, }; const u16 gGotBurnedStringIds[] = { - STRINGID_PKMNWASBURNED, STRINGID_PKMNBURNEDBY + [B_MSG_STATUSED] = STRINGID_PKMNWASBURNED, + [B_MSG_STATUSED_BY_ABILITY] = STRINGID_PKMNBURNEDBY }; const u16 gGotFrozenStringIds[] = { - STRINGID_PKMNWASFROZEN, STRINGID_PKMNFROZENBY + [B_MSG_STATUSED] = STRINGID_PKMNWASFROZEN, + [B_MSG_STATUSED_BY_ABILITY] = STRINGID_PKMNFROZENBY }; const u16 gGotDefrostedStringIds[] = { - STRINGID_PKMNWASDEFROSTED2, STRINGID_PKMNWASDEFROSTEDBY + [B_MSG_DEFROSTED] = STRINGID_PKMNWASDEFROSTED2, + [B_MSG_DEFROSTED_BY_MOVE] = STRINGID_PKMNWASDEFROSTEDBY }; const u16 gKOFailedStringIds[] = { - STRINGID_ATTACKMISSED, STRINGID_PKMNUNAFFECTED + [B_MSG_KO_MISS] = STRINGID_ATTACKMISSED, + [B_MSG_KO_UNAFFECTED] = STRINGID_PKMNUNAFFECTED }; const u16 gAttractUsedStringIds[] = { - STRINGID_PKMNFELLINLOVE, STRINGID_PKMNSXINFATUATEDY + [B_MSG_STATUSED] = STRINGID_PKMNFELLINLOVE, + [B_MSG_STATUSED_BY_ABILITY] = STRINGID_PKMNSXINFATUATEDY }; -const u16 gLeechSeedDrainStringIds[] = +const u16 gAbsorbDrainStringIds[] = { - STRINGID_PKMNENERGYDRAINED, STRINGID_ITSUCKEDLIQUIDOOZE + [B_MSG_ABSORB] = STRINGID_PKMNENERGYDRAINED, + [B_MSG_ABSORB_OOZE] = STRINGID_ITSUCKEDLIQUIDOOZE }; const u16 gSportsUsedStringIds[] = { - STRINGID_ELECTRICITYWEAKENED, STRINGID_FIREWEAKENED + [B_MSG_WEAKEN_ELECTRIC] = STRINGID_ELECTRICITYWEAKENED, + [B_MSG_WEAKEN_FIRE] = STRINGID_FIREWEAKENED }; const u16 gPartyStatusHealStringIds[] = { - STRINGID_BELLCHIMED, STRINGID_BELLCHIMED, STRINGID_BELLCHIMED, STRINGID_BELLCHIMED, - // interesting how there are four instances of the same string - STRINGID_SOOTHINGAROMA + [B_MSG_BELL] = STRINGID_BELLCHIMED, + [B_MSG_BELL_SOUNDPROOF_ATTACKER] = STRINGID_BELLCHIMED, + [B_MSG_BELL_SOUNDPROOF_PARTNER] = STRINGID_BELLCHIMED, + [B_MSG_BELL_BOTH_SOUNDPROOF] = STRINGID_BELLCHIMED, + [B_MSG_SOOTHING_AROMA] = STRINGID_SOOTHINGAROMA }; const u16 gFutureMoveUsedStringIds[] = { - STRINGID_PKMNFORESAWATTACK, STRINGID_PKMNCHOSEXASDESTINY + [B_MSG_FUTURE_SIGHT] = STRINGID_PKMNFORESAWATTACK, + [B_MSG_DOOM_DESIRE] = STRINGID_PKMNCHOSEXASDESTINY }; const u16 gBallEscapeStringIds[] = { - STRINGID_PKMNBROKEFREE, STRINGID_ITAPPEAREDCAUGHT, STRINGID_AARGHALMOSTHADIT, STRINGID_SHOOTSOCLOSE + [BALL_NO_SHAKES] = STRINGID_PKMNBROKEFREE, + [BALL_1_SHAKE] = STRINGID_ITAPPEAREDCAUGHT, + [BALL_2_SHAKES] = STRINGID_AARGHALMOSTHADIT, + [BALL_3_SHAKES_FAIL] = STRINGID_SHOOTSOCLOSE }; // Overworld weathers that don't have an associated battle weather default to "It is raining." @@ -1122,59 +1179,82 @@ const u16 gWeatherStartsStringIds[] = const u16 gInobedientStringIds[] = { - STRINGID_PKMNLOAFING, STRINGID_PKMNWONTOBEY, STRINGID_PKMNTURNEDAWAY, - STRINGID_PKMNPRETENDNOTNOTICE, STRINGID_PKMNINCAPABLEOFPOWER + [B_MSG_LOAFING] = STRINGID_PKMNLOAFING, + [B_MSG_WONT_OBEY] = STRINGID_PKMNWONTOBEY, + [B_MSG_TURNED_AWAY] = STRINGID_PKMNTURNEDAWAY, + [B_MSG_PRETEND_NOT_NOTICE] = STRINGID_PKMNPRETENDNOTNOTICE, + [B_MSG_INCAPABLE_OF_POWER] = STRINGID_PKMNINCAPABLEOFPOWER }; const u16 gSafariGetNearStringIds[] = { - STRINGID_CREPTCLOSER, STRINGID_CANTGETCLOSER + [B_MSG_CREPT_CLOSER] = STRINGID_CREPTCLOSER, + [B_MSG_CANT_GET_CLOSER] = STRINGID_CANTGETCLOSER }; const u16 gSafariPokeblockResultStringIds[] = { - STRINGID_PKMNCURIOUSABOUTX, STRINGID_PKMNENTHRALLEDBYX, STRINGID_PKMNIGNOREDX + [B_MSG_MON_CURIOUS] = STRINGID_PKMNCURIOUSABOUTX, + [B_MSG_MON_ENTHRALLED] = STRINGID_PKMNENTHRALLEDBYX, + [B_MSG_MON_IGNORED] = STRINGID_PKMNIGNOREDX }; const u16 gTrainerItemCuredStatusStringIds[] = { - STRINGID_PKMNSITEMSNAPPEDOUT, STRINGID_PKMNSITEMCUREDPARALYSIS, STRINGID_PKMNSITEMDEFROSTEDIT, - STRINGID_PKMNSITEMHEALEDBURN, STRINGID_PKMNSITEMCUREDPOISON, STRINGID_PKMNSITEMWOKEIT + [AI_HEAL_CONFUSION] = STRINGID_PKMNSITEMSNAPPEDOUT, + [AI_HEAL_PARALYSIS] = STRINGID_PKMNSITEMCUREDPARALYSIS, + [AI_HEAL_FREEZE] = STRINGID_PKMNSITEMDEFROSTEDIT, + [AI_HEAL_BURN] = STRINGID_PKMNSITEMHEALEDBURN, + [AI_HEAL_POISON] = STRINGID_PKMNSITEMCUREDPOISON, + [AI_HEAL_SLEEP] = STRINGID_PKMNSITEMWOKEIT }; const u16 gBerryEffectStringIds[] = { - STRINGID_PKMNSITEMCUREDPROBLEM, STRINGID_PKMNSITEMNORMALIZEDSTATUS + [B_MSG_CURED_PROBLEM] = STRINGID_PKMNSITEMCUREDPROBLEM, + [B_MSG_NORMALIZED_STATUS] = STRINGID_PKMNSITEMNORMALIZEDSTATUS }; const u16 gBRNPreventionStringIds[] = { - STRINGID_PKMNSXPREVENTSBURNS, STRINGID_PKMNSXPREVENTSYSZ, STRINGID_PKMNSXHADNOEFFECTONY + [B_MSG_ABILITY_PREVENTS_MOVE_STATUS] = STRINGID_PKMNSXPREVENTSBURNS, + [B_MSG_ABILITY_PREVENTS_ABILITY_STATUS] = STRINGID_PKMNSXPREVENTSYSZ, + [B_MSG_STATUS_HAD_NO_EFFECT] = STRINGID_PKMNSXHADNOEFFECTONY }; const u16 gPRLZPreventionStringIds[] = { - STRINGID_PKMNPREVENTSPARALYSISWITH, STRINGID_PKMNSXPREVENTSYSZ, STRINGID_PKMNSXHADNOEFFECTONY + [B_MSG_ABILITY_PREVENTS_MOVE_STATUS] = STRINGID_PKMNPREVENTSPARALYSISWITH, + [B_MSG_ABILITY_PREVENTS_ABILITY_STATUS] = STRINGID_PKMNSXPREVENTSYSZ, + [B_MSG_STATUS_HAD_NO_EFFECT] = STRINGID_PKMNSXHADNOEFFECTONY }; const u16 gPSNPreventionStringIds[] = { - STRINGID_PKMNPREVENTSPOISONINGWITH, STRINGID_PKMNSXPREVENTSYSZ, STRINGID_PKMNSXHADNOEFFECTONY + [B_MSG_ABILITY_PREVENTS_MOVE_STATUS] = STRINGID_PKMNPREVENTSPOISONINGWITH, + [B_MSG_ABILITY_PREVENTS_ABILITY_STATUS] = STRINGID_PKMNSXPREVENTSYSZ, + [B_MSG_STATUS_HAD_NO_EFFECT] = STRINGID_PKMNSXHADNOEFFECTONY }; const u16 gItemSwapStringIds[] = { - STRINGID_PKMNOBTAINEDX, STRINGID_PKMNOBTAINEDX2, STRINGID_PKMNOBTAINEDXYOBTAINEDZ + [B_MSG_ITEM_SWAP_TAKEN] = STRINGID_PKMNOBTAINEDX, + [B_MSG_ITEM_SWAP_GIVEN] = STRINGID_PKMNOBTAINEDX2, + [B_MSG_ITEM_SWAP_BOTH] = STRINGID_PKMNOBTAINEDXYOBTAINEDZ }; const u16 gFlashFireStringIds[] = { - STRINGID_PKMNRAISEDFIREPOWERWITH, STRINGID_PKMNSXMADEYINEFFECTIVE + [B_MSG_FLASH_FIRE_BOOST] = STRINGID_PKMNRAISEDFIREPOWERWITH, + [B_MSG_FLASH_FIRE_NO_BOOST] = STRINGID_PKMNSXMADEYINEFFECTIVE }; const u16 gCaughtMonStringIds[] = { - STRINGID_PKMNTRANSFERREDSOMEONESPC, STRINGID_PKMNTRANSFERREDLANETTESPC, STRINGID_PKMNBOXSOMEONESPCFULL, STRINGID_PKMNBOXLANETTESPCFULL, + [B_MSG_SENT_SOMEONES_PC] = STRINGID_PKMNTRANSFERREDSOMEONESPC, + [B_MSG_SENT_LANETTES_PC] = STRINGID_PKMNTRANSFERREDLANETTESPC, + [B_MSG_SOMEONES_BOX_FULL] = STRINGID_PKMNBOXSOMEONESPCFULL, + [B_MSG_LANETTES_BOX_FULL] = STRINGID_PKMNBOXLANETTESPCFULL, }; const u16 gTrappingMoves[] = @@ -1216,7 +1296,8 @@ static const u8 sText_Defense[] = _("DEFENSE"); static const u8 sText_SpAtk[] = _("SP. ATK"); static const u8 sText_SpDef[] = _("SP. DEF"); -const u8 * const gStatNamesTable2[] = +// Unused +static const u8 * const sStatNamesTable2[] = { sText_HP, sText_SpAtk, sText_Attack, sText_SpDef, sText_Defense, sText_Speed @@ -1309,10 +1390,10 @@ static const u8 sText_PkmnEagerForMore[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is const u16 gBattlePalaceFlavorTextTable[] = { - STRINGID_GLINTAPPEARSINEYE, - STRINGID_PKMNGETTINGINTOPOSITION, - STRINGID_PKMNBEGANGROWLINGDEEPLY, - STRINGID_PKMNEAGERFORMORE + [B_MSG_GLINT_IN_EYE] = STRINGID_GLINTAPPEARSINEYE, + [B_MSG_GETTING_IN_POS] = STRINGID_PKMNGETTINGINTOPOSITION, + [B_MSG_GROWL_DEEPLY] = STRINGID_PKMNBEGANGROWLINGDEEPLY, + [B_MSG_EAGER_FOR_MORE] = STRINGID_PKMNEAGERFORMORE, }; static const u8 sText_RefIfNothingIsDecided[] = _("REFEREE: If nothing is decided in\n3 turns, we will go to judging!"); @@ -1320,9 +1401,9 @@ static const u8 sText_RefThatsIt[] = _("REFEREE: That's it! We will now go to\nj static const u8 sText_RefJudgeMind[] = _("REFEREE: Judging category 1, Mind!\nThe POKéMON showing the most guts!\p"); static const u8 sText_RefJudgeSkill[] = _("REFEREE: Judging category 2, Skill!\nThe POKéMON using moves the best!\p"); static const u8 sText_RefJudgeBody[] = _("REFEREE: Judging category 3, Body!\nThe POKéMON with the most vitality!\p"); -static const u8 sText_RefJudgement1[] = _("REFEREE: Judgment: {B_BUFF1} to {B_BUFF2}!\nThe winner is {B_PLAYER_NAME}'s {B_PLAYER_MON1_NAME}!\p"); -static const u8 sText_RefJudgement2[] = _("REFEREE: Judgment: {B_BUFF1} to {B_BUFF2}!\nThe winner is {B_TRAINER1_NAME}'s {B_OPPONENT_MON1_NAME}!\p"); -static const u8 sText_RefJudgement3[] = _("REFEREE: Judgment: 3 to 3!\nWe have a draw!\p"); +static const u8 sText_RefPlayerWon[] = _("REFEREE: Judgment: {B_BUFF1} to {B_BUFF2}!\nThe winner is {B_PLAYER_NAME}'s {B_PLAYER_MON1_NAME}!\p"); +static const u8 sText_RefOpponentWon[] = _("REFEREE: Judgment: {B_BUFF1} to {B_BUFF2}!\nThe winner is {B_TRAINER1_NAME}'s {B_OPPONENT_MON1_NAME}!\p"); +static const u8 sText_RefDraw[] = _("REFEREE: Judgment: 3 to 3!\nWe have a draw!\p"); static const u8 sText_DefeatedOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} defeated the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!"); static const u8 sText_LostToOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} lost to the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!"); static const u8 sText_TiedOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} tied the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!"); @@ -1330,15 +1411,15 @@ static const u8 sText_RefCommenceBattle[] = _("REFEREE: {B_PLAYER_MON1_NAME} VS const u8 * const gRefereeStringsTable[] = { - sText_RefIfNothingIsDecided, - sText_RefThatsIt, - sText_RefJudgeMind, - sText_RefJudgeSkill, - sText_RefJudgeBody, - sText_RefJudgement1, - sText_RefJudgement2, - sText_RefJudgement3, - sText_RefCommenceBattle, + [B_MSG_REF_NOTHING_IS_DECIDED] = sText_RefIfNothingIsDecided, + [B_MSG_REF_THATS_IT] = sText_RefThatsIt, + [B_MSG_REF_JUDGE_MIND] = sText_RefJudgeMind, + [B_MSG_REF_JUDGE_SKILL] = sText_RefJudgeSkill, + [B_MSG_REF_JUDGE_BODY] = sText_RefJudgeBody, + [B_MSG_REF_PLAYER_WON] = sText_RefPlayerWon, + [B_MSG_REF_OPPONENT_WON] = sText_RefOpponentWon, + [B_MSG_REF_DRAW] = sText_RefDraw, + [B_MSG_REF_COMMENCE_BATTLE] = sText_RefCommenceBattle, }; static const u8 sText_QuestionForfeitMatch[] = _("Would you like to forfeit the match\nand quit now?"); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8f89a02b3..33c6ce0e5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -876,34 +876,33 @@ const ALIGNED(4) u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4] = [NATURE_QUIRKY] = PALACE_STYLE(56, 22, 56, 22) // 22%, 22% }; -// Indices into gBattlePalaceFlavorTextTable static const u8 sBattlePalaceNatureToFlavorTextId[NUM_NATURES] = { - [NATURE_HARDY] = 3, - [NATURE_LONELY] = 0, - [NATURE_BRAVE] = 1, - [NATURE_ADAMANT] = 0, - [NATURE_NAUGHTY] = 0, - [NATURE_BOLD] = 1, - [NATURE_DOCILE] = 3, - [NATURE_RELAXED] = 0, - [NATURE_IMPISH] = 1, - [NATURE_LAX] = 2, - [NATURE_TIMID] = 2, - [NATURE_HASTY] = 0, - [NATURE_SERIOUS] = 3, - [NATURE_JOLLY] = 1, - [NATURE_NAIVE] = 3, - [NATURE_MODEST] = 1, - [NATURE_MILD] = 2, - [NATURE_QUIET] = 3, - [NATURE_BASHFUL] = 3, - [NATURE_RASH] = 2, - [NATURE_CALM] = 1, - [NATURE_GENTLE] = 0, - [NATURE_SASSY] = 2, - [NATURE_CAREFUL] = 2, - [NATURE_QUIRKY] = 3, + [NATURE_HARDY] = B_MSG_EAGER_FOR_MORE, + [NATURE_LONELY] = B_MSG_GLINT_IN_EYE, + [NATURE_BRAVE] = B_MSG_GETTING_IN_POS, + [NATURE_ADAMANT] = B_MSG_GLINT_IN_EYE, + [NATURE_NAUGHTY] = B_MSG_GLINT_IN_EYE, + [NATURE_BOLD] = B_MSG_GETTING_IN_POS, + [NATURE_DOCILE] = B_MSG_EAGER_FOR_MORE, + [NATURE_RELAXED] = B_MSG_GLINT_IN_EYE, + [NATURE_IMPISH] = B_MSG_GETTING_IN_POS, + [NATURE_LAX] = B_MSG_GROWL_DEEPLY, + [NATURE_TIMID] = B_MSG_GROWL_DEEPLY, + [NATURE_HASTY] = B_MSG_GLINT_IN_EYE, + [NATURE_SERIOUS] = B_MSG_EAGER_FOR_MORE, + [NATURE_JOLLY] = B_MSG_GETTING_IN_POS, + [NATURE_NAIVE] = B_MSG_EAGER_FOR_MORE, + [NATURE_MODEST] = B_MSG_GETTING_IN_POS, + [NATURE_MILD] = B_MSG_GROWL_DEEPLY, + [NATURE_QUIET] = B_MSG_EAGER_FOR_MORE, + [NATURE_BASHFUL] = B_MSG_EAGER_FOR_MORE, + [NATURE_RASH] = B_MSG_GROWL_DEEPLY, + [NATURE_CALM] = B_MSG_GETTING_IN_POS, + [NATURE_GENTLE] = B_MSG_GLINT_IN_EYE, + [NATURE_SASSY] = B_MSG_GROWL_DEEPLY, + [NATURE_CAREFUL] = B_MSG_GROWL_DEEPLY, + [NATURE_QUIRKY] = B_MSG_EAGER_FOR_MORE, }; static void Cmd_attackcanceler(void) @@ -991,7 +990,7 @@ static void Cmd_attackcanceler(void) gMoveResultFlags |= MOVE_RESULT_MISSED; gLastLandedMoves[gBattlerTarget] = 0; gLastHitByType[gBattlerTarget] = 0; - gBattleCommunication[6] = 1; + gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED; gBattlescriptCurrInstr++; } else @@ -1024,7 +1023,7 @@ static void Cmd_jumpifaffectedbyprotect(void) { gMoveResultFlags |= MOVE_RESULT_MISSED; JumpIfMoveFailed(5, 0); - gBattleCommunication[6] = 1; + gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED; } else { @@ -1039,7 +1038,7 @@ bool8 JumpIfMoveAffectedByProtect(u16 move) { gMoveResultFlags |= MOVE_RESULT_MISSED; JumpIfMoveFailed(7, move); - gBattleCommunication[6] = 1; + gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED; affected = TRUE; } return affected; @@ -1172,9 +1171,9 @@ static void Cmd_accuracycheck(void) gMoveResultFlags |= MOVE_RESULT_MISSED; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && (gBattleMoves[move].target == MOVE_TARGET_BOTH || gBattleMoves[move].target == MOVE_TARGET_FOES_AND_ALLY)) - gBattleCommunication[6] = 2; + gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_ATK; else - gBattleCommunication[6] = 0; + gBattleCommunication[MISS_TYPE] = B_MSG_MISSED; CheckWonderGuardAndLevitate(); } @@ -1370,7 +1369,7 @@ static void Cmd_typecalc(void) gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); gLastLandedMoves[gBattlerTarget] = 0; gLastHitByType[gBattlerTarget] = 0; - gBattleCommunication[6] = moveType; + gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS; RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); } else @@ -1406,7 +1405,7 @@ static void Cmd_typecalc(void) gMoveResultFlags |= MOVE_RESULT_MISSED; gLastLandedMoves[gBattlerTarget] = 0; gLastHitByType[gBattlerTarget] = 0; - gBattleCommunication[6] = 3; + gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG; RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); } if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) @@ -1429,7 +1428,7 @@ static void CheckWonderGuardAndLevitate(void) if (gBattleMons[gBattlerTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) { gLastUsedAbility = ABILITY_LEVITATE; - gBattleCommunication[6] = moveType; + gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS; RecordAbilityBattle(gBattlerTarget, ABILITY_LEVITATE); return; } @@ -1484,7 +1483,7 @@ static void CheckWonderGuardAndLevitate(void) if (((flags & 2) || !(flags & 1)) && gBattleMoves[gCurrentMove].power) { gLastUsedAbility = ABILITY_WONDER_GUARD; - gBattleCommunication[6] = 3; + gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG; RecordAbilityBattle(gBattlerTarget, ABILITY_WONDER_GUARD); } } @@ -2019,9 +2018,9 @@ static void Cmd_resultmessage(void) if (gBattleControllerExecFlags) return; - if (gMoveResultFlags & MOVE_RESULT_MISSED && (!(gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) || gBattleCommunication[6] > 2)) + if (gMoveResultFlags & MOVE_RESULT_MISSED && (!(gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) || gBattleCommunication[MISS_TYPE] > B_MSG_AVOIDED_ATK)) { - stringId = gMissStringIds[gBattleCommunication[6]]; + stringId = gMissStringIds[gBattleCommunication[MISS_TYPE]]; gBattleCommunication[MSG_DISPLAY] = 1; } else @@ -2273,12 +2272,12 @@ void SetMoveEffect(bool8 primary, u8 certain) if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_MOVE_STATUS; } RESET_RETURN } @@ -2289,7 +2288,7 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PSNPrevention; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT; RESET_RETURN } if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON)) @@ -2314,12 +2313,12 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattlescriptCurrInstr = BattleScript_BRNPrevention; if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_MOVE_STATUS; } RESET_RETURN } @@ -2330,7 +2329,7 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_BRNPrevention; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT; RESET_RETURN } if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_FIRE)) @@ -2370,12 +2369,12 @@ void SetMoveEffect(bool8 primary, u8 certain) if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_MOVE_STATUS; } RESET_RETURN } @@ -2398,12 +2397,12 @@ void SetMoveEffect(bool8 primary, u8 certain) if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_MOVE_STATUS; } RESET_RETURN } @@ -2414,7 +2413,7 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PSNPrevention; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT; RESET_RETURN } if (gBattleMons[gEffectBattler].status1) @@ -2453,12 +2452,12 @@ void SetMoveEffect(bool8 primary, u8 certain) if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED_BY_ABILITY; gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED; } // for synchronize @@ -3579,7 +3578,7 @@ static void MoveValuesCleanUp(void) gBattleScripting.dmgMultiplier = 1; gCritMultiplier = 1; gBattleCommunication[MOVE_EFFECT_BYTE] = 0; - gBattleCommunication[6] = 0; + gBattleCommunication[MISS_TYPE] = 0; gHitMarker &= ~(HITMARKER_DESTINYBOND); gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT); } @@ -4459,7 +4458,7 @@ static void Cmd_typecalc2(void) gLastUsedAbility = gBattleMons[gBattlerTarget].ability; gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); gLastLandedMoves[gBattlerTarget] = 0; - gBattleCommunication[6] = moveType; + gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS; RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); } else @@ -4534,7 +4533,7 @@ static void Cmd_typecalc2(void) gLastUsedAbility = ABILITY_WONDER_GUARD; gMoveResultFlags |= MOVE_RESULT_MISSED; gLastLandedMoves[gBattlerTarget] = 0; - gBattleCommunication[6] = 3; + gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG; RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); } if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) @@ -4802,7 +4801,9 @@ static void Cmd_jumpifcantswitch(void) } } -static void sub_804CF10(u8 slotId) +// Opens the party screen to choose a new Pokémon to send out +// slotId is the Pokémon to replace +static void ChooseMonToSendOut(u8 slotId) { *(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; @@ -4823,7 +4824,7 @@ static void Cmd_openpartyscreen(void) flags = 0; jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 2); - if (gBattlescriptCurrInstr[1] == 5) + if (gBattlescriptCurrInstr[1] == BS_UNK_5) { if ((gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_MULTI)) != BATTLE_TYPE_DOUBLE) { @@ -4831,7 +4832,7 @@ static void Cmd_openpartyscreen(void) { if (gHitMarker & HITMARKER_FAINTED(gActiveBattler)) { - if (HasNoMonsToSwitch(gActiveBattler, 6, 6)) + if (HasNoMonsToSwitch(gActiveBattler, PARTY_SIZE, PARTY_SIZE)) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); @@ -4840,7 +4841,7 @@ static void Cmd_openpartyscreen(void) } else if (!gSpecialStatuses[gActiveBattler].flag40) { - sub_804CF10(PARTY_SIZE); + ChooseMonToSendOut(PARTY_SIZE); gSpecialStatuses[gActiveBattler].flag40 = 1; } } @@ -4860,16 +4861,16 @@ static void Cmd_openpartyscreen(void) if (gBitTable[0] & hitmarkerFaintBits) { gActiveBattler = 0; - if (HasNoMonsToSwitch(0, 6, 6)) + if (HasNoMonsToSwitch(0, PARTY_SIZE, PARTY_SIZE)) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - BtlController_EmitCmd42(0); + BtlController_EmitCantSwitch(0); MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { - sub_804CF10(gBattleStruct->monToSwitchIntoId[2]); + ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[2]); gSpecialStatuses[gActiveBattler].flag40 = 1; } else @@ -4882,16 +4883,16 @@ static void Cmd_openpartyscreen(void) if (gBitTable[2] & hitmarkerFaintBits && !(gBitTable[0] & hitmarkerFaintBits)) { gActiveBattler = 2; - if (HasNoMonsToSwitch(2, 6, 6)) + if (HasNoMonsToSwitch(2, PARTY_SIZE, PARTY_SIZE)) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - BtlController_EmitCmd42(0); + BtlController_EmitCantSwitch(0); MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { - sub_804CF10(gBattleStruct->monToSwitchIntoId[0]); + ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[0]); gSpecialStatuses[gActiveBattler].flag40 = 1; } else if (!(flags & 1)) @@ -4903,16 +4904,16 @@ static void Cmd_openpartyscreen(void) if (gBitTable[1] & hitmarkerFaintBits) { gActiveBattler = 1; - if (HasNoMonsToSwitch(1, 6, 6)) + if (HasNoMonsToSwitch(1, PARTY_SIZE, PARTY_SIZE)) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - BtlController_EmitCmd42(0); + BtlController_EmitCantSwitch(0); MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { - sub_804CF10(gBattleStruct->monToSwitchIntoId[3]); + ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[3]); gSpecialStatuses[gActiveBattler].flag40 = 1; } else @@ -4925,16 +4926,16 @@ static void Cmd_openpartyscreen(void) if (gBitTable[3] & hitmarkerFaintBits && !(gBitTable[1] & hitmarkerFaintBits)) { gActiveBattler = 3; - if (HasNoMonsToSwitch(3, 6, 6)) + if (HasNoMonsToSwitch(3, PARTY_SIZE, PARTY_SIZE)) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - BtlController_EmitCmd42(0); + BtlController_EmitCantSwitch(0); MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { - sub_804CF10(gBattleStruct->monToSwitchIntoId[1]); + ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[1]); gSpecialStatuses[gActiveBattler].flag40 = 1; } else if (!(flags & 2)) @@ -4978,7 +4979,7 @@ static void Cmd_openpartyscreen(void) } gBattlescriptCurrInstr += 6; } - else if (gBattlescriptCurrInstr[1] == 6) + else if (gBattlescriptCurrInstr[1] == BS_UNK_6) { if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { @@ -4988,32 +4989,32 @@ static void Cmd_openpartyscreen(void) if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits) { gActiveBattler = 2; - if (HasNoMonsToSwitch(2, gBattleBufferB[0][1], 6)) + if (HasNoMonsToSwitch(2, gBattleBufferB[0][1], PARTY_SIZE)) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - BtlController_EmitCmd42(0); + BtlController_EmitCantSwitch(0); MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { - sub_804CF10(gBattleStruct->monToSwitchIntoId[0]); + ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[0]); gSpecialStatuses[gActiveBattler].flag40 = 1; } } if (gBitTable[3] & hitmarkerFaintBits && hitmarkerFaintBits & gBitTable[1]) { gActiveBattler = 3; - if (HasNoMonsToSwitch(3, gBattleBufferB[1][1], 6)) + if (HasNoMonsToSwitch(3, gBattleBufferB[1][1], PARTY_SIZE)) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - BtlController_EmitCmd42(0); + BtlController_EmitCantSwitch(0); MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { - sub_804CF10(gBattleStruct->monToSwitchIntoId[1]); + ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[1]); gSpecialStatuses[gActiveBattler].flag40 = 1; } } @@ -5041,17 +5042,17 @@ static void Cmd_openpartyscreen(void) } else { - if (gBattlescriptCurrInstr[1] & 0x80) + if (gBattlescriptCurrInstr[1] & PARTY_SCREEN_OPTIONAL) hitmarkerFaintBits = PARTY_ACTION_CHOOSE_MON; // Used here as the caseId for the EmitChoose function. else hitmarkerFaintBits = PARTY_ACTION_SEND_OUT; - battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(0x80)); + battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(PARTY_SCREEN_OPTIONAL)); if (gSpecialStatuses[battlerId].flag40) { gBattlescriptCurrInstr += 6; } - else if (HasNoMonsToSwitch(battlerId, 6, 6)) + else if (HasNoMonsToSwitch(battlerId, PARTY_SIZE, PARTY_SIZE)) { gActiveBattler = battlerId; gAbsentBattlerFlags |= gBitTable[gActiveBattler]; @@ -6373,10 +6374,10 @@ static void Cmd_various(void) break; case VARIOUS_ARENA_JUDGMENT_STRING: BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]); - BattlePutTextOnWindow(gDisplayedStringBattle, 0x16); + BattlePutTextOnWindow(gDisplayedStringBattle, 22); break; case VARIOUS_ARENA_WAIT_STRING: - if (IsTextPrinterActive(0x16)) + if (IsTextPrinterActive(22)) return; break; case VARIOUS_WAIT_CRY: @@ -6446,19 +6447,19 @@ static void Cmd_setprotectlike(void) // protect and endure if (gBattleMoves[gCurrentMove].effect == EFFECT_PROTECT) { gProtectStructs[gBattlerAttacker].protected = 1; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } if (gBattleMoves[gCurrentMove].effect == EFFECT_ENDURE) { gProtectStructs[gBattlerAttacker].endured = 1; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_BRACED_ITSELF; } gDisableStructs[gBattlerAttacker].protectUses++; } else { gDisableStructs[gBattlerAttacker].protectUses = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECT_FAILED; gMoveResultFlags |= MOVE_RESULT_MISSED; } @@ -6611,12 +6612,12 @@ static void Cmd_setrain(void) if (gBattleWeather & WEATHER_RAIN_ANY) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED; } else { gBattleWeather = WEATHER_RAIN_TEMPORARY; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_RAIN; gWishFutureKnock.weatherDuration = 5; } gBattlescriptCurrInstr++; @@ -6627,7 +6628,7 @@ static void Cmd_setreflect(void) if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_REFLECT) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED; } else { @@ -6636,9 +6637,9 @@ static void Cmd_setreflect(void) gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_DOUBLE; else - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_SINGLE; } gBattlescriptCurrInstr++; } @@ -6648,18 +6649,18 @@ static void Cmd_setseeded(void) if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT || gStatuses3[gBattlerTarget] & STATUS3_LEECHSEED) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LEECH_SEED_MISS; } else if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS)) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LEECH_SEED_FAIL; } else { gStatuses3[gBattlerTarget] |= gBattlerAttacker; gStatuses3[gBattlerTarget] |= STATUS3_LEECHSEED; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LEECH_SEED_SET; } gBattlescriptCurrInstr++; @@ -6700,11 +6701,11 @@ static void Cmd_trysetrest(void) else { if (gBattleMons[gBattlerTarget].status1 & ((u8)(~STATUS1_SLEEP))) - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_REST_STATUSED; else - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_REST; - gBattleMons[gBattlerTarget].status1 = 3; + gBattleMons[gBattlerTarget].status1 = STATUS1_SLEEP_TURN(3); BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 5; @@ -6740,9 +6741,9 @@ bool8 UproarWakeUpCheck(u8 battlerId) if (gBattlerTarget == 0xFF) gBattlerTarget = i; else if (gBattlerTarget == i) - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_SLEEP_UPROAR; else - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_KEPT_AWAKE; break; } @@ -6765,7 +6766,7 @@ static void Cmd_jumpifcantmakeasleep(void) || gBattleMons[gBattlerTarget].ability == ABILITY_VITAL_SPIRIT) { gLastUsedAbility = gBattleMons[gBattlerTarget].ability; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAYED_AWAKE_USING; gBattlescriptCurrInstr = jumpPtr; RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); } @@ -6780,7 +6781,7 @@ static void Cmd_stockpile(void) if (gDisableStructs[gBattlerAttacker].stockpileCounter == 3) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_STOCKPILE; } else { @@ -6788,7 +6789,7 @@ static void Cmd_stockpile(void) PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gBattlerAttacker].stockpileCounter) - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STOCKPILED; } gBattlescriptCurrInstr++; } @@ -6802,7 +6803,7 @@ static void Cmd_stockpiletobasedamage(void) } else { - if (gBattleCommunication[6] != 1) + if (gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED) { gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattlerAttacker], &gBattleMons[gBattlerTarget], gCurrentMove, gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)], 0, @@ -6826,14 +6827,14 @@ static void Cmd_stockpiletohpheal(void) if (gDisableStructs[gBattlerAttacker].stockpileCounter == 0) { gBattlescriptCurrInstr = jumpPtr; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWALLOW_FAILED; } else if (gBattleMons[gBattlerAttacker].maxHP == gBattleMons[gBattlerAttacker].hp) { gDisableStructs[gBattlerAttacker].stockpileCounter = 0; gBattlescriptCurrInstr = jumpPtr; gBattlerTarget = gBattlerAttacker; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWALLOW_FULL_HP; } else { @@ -6985,9 +6986,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) gBattleTextBuff2[index] = B_BUFF_EOS; if (gBattleMons[gActiveBattler].statStages[statId] == MIN_STAT_STAGE) - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_WONT_DECREASE; else - gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); + gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL } } @@ -7012,9 +7013,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) gBattleTextBuff2[index] = B_BUFF_EOS; if (gBattleMons[gActiveBattler].statStages[statId] == MAX_STAT_STAGE) - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_WONT_INCREASE; else - gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); + gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_ROSE or B_MSG_DEFENDER_STAT_ROSE } gBattleMons[gActiveBattler].statStages[statId] += statValue; @@ -7023,10 +7024,10 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) if (gBattleMons[gActiveBattler].statStages[statId] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[statId] = MAX_STAT_STAGE; - if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && flags & STAT_BUFF_ALLOW_PTR) + if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && flags & STAT_BUFF_ALLOW_PTR) gMoveResultFlags |= MOVE_RESULT_MISSED; - if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && !(flags & STAT_BUFF_ALLOW_PTR)) + if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && !(flags & STAT_BUFF_ALLOW_PTR)) return STAT_BUFF_DIDNT_WORK; return STAT_BUFF_WORKED; @@ -7314,7 +7315,7 @@ static void Cmd_tryconversiontypechange(void) // randomly changes user's type to do { - while ((moveChecked = Random() & 3) >= validMoves); + while ((moveChecked = Random() & (MAX_MON_MOVES - 1)) >= validMoves); moveType = gBattleMoves[gBattleMons[gBattlerAttacker].moves[moveChecked]].type; @@ -7358,7 +7359,7 @@ static void Cmd_setlightscreen(void) if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_LIGHTSCREEN) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED; } else { @@ -7367,9 +7368,9 @@ static void Cmd_setlightscreen(void) gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) - gBattleCommunication[MULTISTRING_CHOOSER] = 4; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_DOUBLE; else - gBattleCommunication[MULTISTRING_CHOOSER] = 3; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_SINGLE; } gBattlescriptCurrInstr++; @@ -7453,9 +7454,9 @@ static void Cmd_tryKO(void) { gMoveResultFlags |= MOVE_RESULT_MISSED; if (gBattleMons[gBattlerAttacker].level >= gBattleMons[gBattlerTarget].level) - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_KO_MISS; else - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_KO_UNAFFECTED; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } } @@ -7475,12 +7476,12 @@ static void Cmd_setsandstorm(void) if (gBattleWeather & WEATHER_SANDSTORM_ANY) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED; } else { gBattleWeather = WEATHER_SANDSTORM_TEMPORARY; - gBattleCommunication[MULTISTRING_CHOOSER] = 3; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_SANDSTORM; gWishFutureKnock.weatherDuration = 5; } gBattlescriptCurrInstr++; @@ -7621,14 +7622,14 @@ static void Cmd_setmist(void) if (gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer) { gMoveResultFlags |= MOVE_RESULT_FAILED; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MIST_FAILED; } else { gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer = 5; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistBattlerId = gBattlerAttacker; gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_MIST; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_MIST; } gBattlescriptCurrInstr++; } @@ -7638,12 +7639,12 @@ static void Cmd_setfocusenergy(void) if (gBattleMons[gBattlerAttacker].status2 & STATUS2_FOCUS_ENERGY) { gMoveResultFlags |= MOVE_RESULT_FAILED; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FOCUS_ENERGY_FAILED; } else { gBattleMons[gBattlerAttacker].status2 |= STATUS2_FOCUS_ENERGY; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_GETTING_PUMPED; } gBattlescriptCurrInstr++; } @@ -7656,7 +7657,7 @@ static void Cmd_transformdataexecution(void) || gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) { gMoveResultFlags |= MOVE_RESULT_FAILED; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TRANSFORM_FAILED; } else { @@ -7688,7 +7689,7 @@ static void Cmd_transformdataexecution(void) gActiveBattler = gBattlerAttacker; BtlController_EmitResetActionMoveSelection(0, RESET_MOVE_SELECTION); MarkBattlerForControllerExec(gActiveBattler); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TRANSFORMED; } } @@ -7701,7 +7702,7 @@ static void Cmd_setsubstitute(void) if (gBattleMons[gBattlerAttacker].hp <= hp) { gBattleMoveDamage = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SUBSTITUTE_FAILED; } else { @@ -7712,7 +7713,7 @@ static void Cmd_setsubstitute(void) gBattleMons[gBattlerAttacker].status2 |= STATUS2_SUBSTITUTE; gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_WRAPPED); gDisableStructs[gBattlerAttacker].substituteHP = gBattleMoveDamage; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_SUBSTITUTE; gHitMarker |= HITMARKER_IGNORE_SUBSTITUTE; } @@ -8139,7 +8140,7 @@ static void Cmd_trychoosesleeptalkmove(void) do { - movePosition = Random() & 3; + movePosition = Random() & (MAX_MON_MOVES - 1); } while ((gBitTable[movePosition] & unusableMovesBits)); gCalledMove = gBattleMons[gBattlerAttacker].moves[movePosition]; @@ -8250,7 +8251,7 @@ static void Cmd_healpartystatus(void) struct Pokemon *party; s32 i; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_BELL; if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) party = gPlayerParty; @@ -8265,7 +8266,7 @@ static void Cmd_healpartystatus(void) else { RecordAbilityBattle(gBattlerAttacker, gBattleMons[gBattlerAttacker].ability); - gBattleCommunication[MULTISTRING_CHOOSER] |= 1; + gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_ATTACKER; } gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); @@ -8281,10 +8282,12 @@ static void Cmd_healpartystatus(void) else { RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); - gBattleCommunication[MULTISTRING_CHOOSER] |= 2; + gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_PARTNER; } } + // Because the above MULTISTRING_CHOOSER are ORd, if both are set then it will be B_MSG_BELL_BOTH_SOUNDPROOF + for (i = 0; i < PARTY_SIZE; i++) { u16 species = GetMonData(&party[i], MON_DATA_SPECIES2); @@ -8310,7 +8313,7 @@ static void Cmd_healpartystatus(void) } else // Aromatherapy { - gBattleCommunication[MULTISTRING_CHOOSER] = 4; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SOOTHING_AROMA; toHeal = 0x3F; gBattleMons[gBattlerAttacker].status1 = 0; @@ -8514,14 +8517,14 @@ static void Cmd_setsafeguard(void) if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_SAFEGUARD) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED; } else { gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardTimer = 5; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardBattlerId = gBattlerAttacker; - gBattleCommunication[MULTISTRING_CHOOSER] = 5; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_SAFEGUARD; } gBattlescriptCurrInstr++; @@ -8630,12 +8633,12 @@ static void Cmd_setsunny(void) if (gBattleWeather & WEATHER_SUN_ANY) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED; } else { gBattleWeather = WEATHER_SUN_TEMPORARY; - gBattleCommunication[MULTISTRING_CHOOSER] = 4; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_SUNLIGHT; gWishFutureKnock.weatherDuration = 5; } @@ -8806,9 +8809,9 @@ static void Cmd_trysetfutureattack(void) gWishFutureKnock.futureSightDmg[gBattlerTarget] = gWishFutureKnock.futureSightDmg[gBattlerTarget] * 15 / 10; if (gCurrentMove == MOVE_DOOM_DESIRE) - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOOM_DESIRE; else - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FUTURE_SIGHT; gBattlescriptCurrInstr += 5; } @@ -8912,12 +8915,12 @@ static void Cmd_sethail(void) if (gBattleWeather & WEATHER_HAIL_ANY) { gMoveResultFlags |= MOVE_RESULT_MISSED; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED; } else { gBattleWeather = WEATHER_HAIL; - gBattleCommunication[MULTISTRING_CHOOSER] = 5; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_HAIL; gWishFutureKnock.weatherDuration = 5; } @@ -8928,7 +8931,7 @@ static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento { if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == MIN_STAT_STAGE && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE - && gBattleCommunication[6] != 1) + && gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED) { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } @@ -9113,11 +9116,11 @@ static void Cmd_tryswapitems(void) // trick PREPARE_ITEM_BUFFER(gBattleTextBuff2, oldItemAtk) if (oldItemAtk != 0 && *newItemAtk != 0) - gBattleCommunication[MULTISTRING_CHOOSER] = 2; // attacker's item -> <- target's item + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ITEM_SWAP_BOTH; // attacker's item -> <- target's item else if (oldItemAtk == 0 && *newItemAtk != 0) - gBattleCommunication[MULTISTRING_CHOOSER] = 0; // nothing -> <- target's item + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ITEM_SWAP_TAKEN; // nothing -> <- target's item else - gBattleCommunication[MULTISTRING_CHOOSER] = 1; // attacker's item -> <- nothing + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ITEM_SWAP_GIVEN; // attacker's item -> <- nothing } } } @@ -9605,7 +9608,7 @@ static void Cmd_settypebasedhalvers(void) // water and mud sport if (!(gStatuses3[gBattlerAttacker] & STATUS3_MUDSPORT)) { gStatuses3[gBattlerAttacker] |= STATUS3_MUDSPORT; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_ELECTRIC; worked = TRUE; } } @@ -9614,7 +9617,7 @@ static void Cmd_settypebasedhalvers(void) // water and mud sport if (!(gStatuses3[gBattlerAttacker] & STATUS3_WATERSPORT)) { gStatuses3[gBattlerAttacker] |= STATUS3_WATERSPORT; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_FIRE; worked = TRUE; } } @@ -9883,7 +9886,6 @@ static void Cmd_handleballthrow(void) else // not caught { gBattleCommunication[MULTISTRING_CHOOSER] = shakes; - // Maybe inject SpriteCB_TestBallThrow here gBattlescriptCurrInstr = BattleScript_ShakeBallThrow; } } @@ -9896,7 +9898,7 @@ static void Cmd_givecaughtmon(void) { if (!ShouldShowBoxWasFullMessage()) { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SENT_SOMEONES_PC; StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); } @@ -9905,9 +9907,10 @@ static void Cmd_givecaughtmon(void) StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); // box the mon was sent to GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); StringCopy(gStringVar3, GetBoxNamePtr(GetPCBoxToSendMon())); //box the mon was going to be sent to - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SOMEONES_BOX_FULL; } + // Change to B_MSG_SENT_LANETTES_PC or B_MSG_LANETTES_BOX_FULL if (FlagGet(FLAG_SYS_PC_LANETTE)) gBattleCommunication[MULTISTRING_CHOOSER]++; } diff --git a/src/battle_tv.c b/src/battle_tv.c index 8c8ea90ab..a61f5ff29 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -666,7 +666,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) case STRINGID_CRITICALHIT: AddMovePoints(PTS_CRITICAL_HIT, moveSlot, 0, 0); break; - case STRINGID_PKMNSSTATCHANGED: + case STRINGID_ATTACKERSSTATROSE: if (gBattleTextBuff1[2] != 0) { if (*statStringId == STRINGID_STATSHARPLY) @@ -675,7 +675,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) AddMovePoints(PTS_STAT_INCREASE_1, moveSlot, gBattleTextBuff1[2] - 1, 0); } break; - case STRINGID_PKMNSSTATCHANGED2: + case STRINGID_DEFENDERSSTATROSE: if (gBattleTextBuff1[2] != 0) { if (gBattlerAttacker == gBattlerTarget) @@ -691,11 +691,11 @@ void BattleTv_SetDataBasedOnString(u16 stringId) } } break; - case STRINGID_PKMNSSTATCHANGED3: + case STRINGID_ATTACKERSSTATFELL: if (gBattleTextBuff1[2] != 0) AddMovePoints(PTS_STAT_DECREASE_SELF, moveSlot, gBattleTextBuff1[2] - 1, 0); break; - case STRINGID_PKMNSSTATCHANGED4: + case STRINGID_DEFENDERSSTATFELL: if (gBattleTextBuff1[2] != 0) { if (*statStringId == STRINGID_STATHARSHLY) diff --git a/src/battle_util.c b/src/battle_util.c index c0d897707..cbcd445b7 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -49,7 +49,29 @@ extern const u8 *const gBattlescriptsForRunningByItem[]; extern const u8 *const gBattlescriptsForUsingItem[]; extern const u8 *const gBattlescriptsForSafariActions[]; -static const u8 sPkblToEscapeFactor[][3] = {{0, 0, 0}, {3, 5, 0}, {2, 3, 0}, {1, 2, 0}, {1, 1, 0}}; +static const u8 sPkblToEscapeFactor[][3] = { + { + [B_MSG_MON_CURIOUS] = 0, + [B_MSG_MON_ENTHRALLED] = 0, + [B_MSG_MON_IGNORED] = 0 + },{ + [B_MSG_MON_CURIOUS] = 3, + [B_MSG_MON_ENTHRALLED] = 5, + [B_MSG_MON_IGNORED] = 0 + },{ + [B_MSG_MON_CURIOUS] = 2, + [B_MSG_MON_ENTHRALLED] = 3, + [B_MSG_MON_IGNORED] = 0 + },{ + [B_MSG_MON_CURIOUS] = 1, + [B_MSG_MON_ENTHRALLED] = 2, + [B_MSG_MON_IGNORED] = 0 + },{ + [B_MSG_MON_CURIOUS] = 1, + [B_MSG_MON_ENTHRALLED] = 1, + [B_MSG_MON_IGNORED] = 0 + } +}; static const u8 sGoNearCounterToCatchFactor[] = {4, 3, 2, 1}; static const u8 sGoNearCounterToEscapeFactor[] = {4, 4, 4, 4}; @@ -238,10 +260,9 @@ void HandleAction_UseMove(void) } } - // choose battlescript - if (gBattleTypeFlags & BATTLE_TYPE_PALACE - && gProtectStructs[gBattlerAttacker].palaceUnableToUseMove) + if (gBattleTypeFlags & BATTLE_TYPE_PALACE && gProtectStructs[gBattlerAttacker].palaceUnableToUseMove) { + // Battle Palace, select battle script for failure to use move if (gBattleMons[gBattlerAttacker].hp == 0) { gCurrentActionFuncId = B_ACTION_FINISHED; @@ -249,13 +270,13 @@ void HandleAction_UseMove(void) } else if (gPalaceSelectionBattleScripts[gBattlerAttacker] != NULL) { - gBattleCommunication[MULTISTRING_CHOOSER] = 4; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_INCAPABLE_OF_POWER; gBattlescriptCurrInstr = gPalaceSelectionBattleScripts[gBattlerAttacker]; gPalaceSelectionBattleScripts[gBattlerAttacker] = NULL; } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 4; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_INCAPABLE_OF_POWER; gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; } } @@ -318,26 +339,29 @@ void HandleAction_UseItem(void) case AI_ITEM_HEAL_HP: break; case AI_ITEM_CURE_CONDITION: - gBattleCommunication[MULTISTRING_CHOOSER] = 0; - if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 1) + gBattleCommunication[MULTISTRING_CHOOSER] = AI_HEAL_CONFUSION; + if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & (1 << AI_HEAL_CONFUSION)) { if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 0x3E) - gBattleCommunication[MULTISTRING_CHOOSER] = 5; + gBattleCommunication[MULTISTRING_CHOOSER] = AI_HEAL_SLEEP; } else { + // Check for other statuses, stopping at first (shouldn't be more than one) while (!(*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 1)) { *(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) >>= 1; gBattleCommunication[MULTISTRING_CHOOSER]++; + // MULTISTRING_CHOOSER will be either AI_HEAL_PARALYSIS, AI_HEAL_FREEZE, + // AI_HEAL_BURN, AI_HEAL_POISON, or AI_HEAL_SLEEP } } break; case AI_ITEM_X_STAT: - gBattleCommunication[MULTISTRING_CHOOSER] = 4; - if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 0x80) + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_ROSE_ITEM; + if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & (1 << AI_DIRE_HIT)) { - gBattleCommunication[MULTISTRING_CHOOSER] = 5; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_USED_DIRE_HIT; } else { @@ -354,11 +378,20 @@ void HandleAction_UseItem(void) gBattleScripting.animArg2 = 0; } break; - case AI_ITEM_GUARD_SPECS: + case AI_ITEM_GUARD_SPEC: + // It seems probable that at some point there was a special message for + // an AI trainer using Guard Spec in a double battle. + // There isn't now however, and the assignment to 2 below goes out of + // bounds for gMistUsedStringIds and instead prints "{mon} is getting pumped" + // from the next table, gFocusEnergyUsedStringIds. + // In any case this isn't an issue in the retail version, as no trainers + // are ever given any Guard Spec to use. +#ifndef UBFIX if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) gBattleCommunication[MULTISTRING_CHOOSER] = 2; else - gBattleCommunication[MULTISTRING_CHOOSER] = 0; +#endif + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_MIST; break; } @@ -479,7 +512,7 @@ void HandleAction_Run(void) if (!TryRunFromBattle(gBattlerAttacker)) // failed to run away { ClearFuryCutterDestinyBondGrudge(gBattlerAttacker); - gBattleCommunication[MULTISTRING_CHOOSER] = 3; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_ESCAPE_2; gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString; gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } @@ -488,7 +521,7 @@ void HandleAction_Run(void) { if (gBattleMons[gBattlerAttacker].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) { - gBattleCommunication[MULTISTRING_CHOOSER] = 4; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ATTACKER_CANT_ESCAPE; gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString; gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } @@ -567,11 +600,11 @@ void HandleAction_GoNear(void) if (gBattleStruct->safariGoNearCounter < 3) { gBattleStruct->safariGoNearCounter++; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CREPT_CLOSER; } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; // Can't get closer. + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_GET_CLOSER; } gBattlescriptCurrInstr = gBattlescriptsForSafariActions[1]; gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; @@ -1295,20 +1328,20 @@ u8 DoFieldEndTurnEffects(void) { gBattleWeather &= ~WEATHER_RAIN_TEMPORARY; gBattleWeather &= ~WEATHER_RAIN_DOWNPOUR; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_STOPPED; } else if (gBattleWeather & WEATHER_RAIN_DOWNPOUR) - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES; else - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES; } else if (gBattleWeather & WEATHER_RAIN_DOWNPOUR) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES; } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES; } BattleScriptExecute(BattleScript_RainContinuesOrEnds); @@ -1330,7 +1363,7 @@ u8 DoFieldEndTurnEffects(void) } gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SANDSTORM; BattleScriptExecute(gBattlescriptCurrInstr); effect++; } @@ -1368,7 +1401,7 @@ u8 DoFieldEndTurnEffects(void) } gBattleScripting.animArg1 = B_ANIM_HAIL_CONTINUES; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_HAIL; BattleScriptExecute(gBattlescriptCurrInstr); effect++; } @@ -1597,16 +1630,16 @@ u8 DoBattlerEndTurnEffects(void) if (WasUnableToUseMove(gActiveBattler)) { CancelMultiTurnMoves(gActiveBattler); - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_ENDS; } else if (gBattleMons[gActiveBattler].status2 & STATUS2_UPROAR) { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_CONTINUES; gBattleMons[gActiveBattler].status2 |= STATUS2_MULTIPLETURNS; } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_ENDS; CancelMultiTurnMoves(gActiveBattler); } BattleScriptExecute(BattleScript_PrintUproarOverTurns); @@ -1749,9 +1782,9 @@ bool8 HandleWishPerishSongOnTurnEnd(void) && gBattleMons[gActiveBattler].hp != 0) { if (gWishFutureKnock.futureSightMove[gActiveBattler] == MOVE_FUTURE_SIGHT) - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FUTURE_SIGHT; else - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOOM_DESIRE; PREPARE_MOVE_BUFFER(gBattleTextBuff1, gWishFutureKnock.futureSightMove[gActiveBattler]); @@ -1850,7 +1883,7 @@ bool8 HandleFaintedMonActions(void) gBattleStruct->faintedActionsState++; for (i = 0; i < gBattlersCount; i++) { - if (gAbsentBattlerFlags & gBitTable[i] && !HasNoMonsToSwitch(i, 6, 6)) + if (gAbsentBattlerFlags & gBitTable[i] && !HasNoMonsToSwitch(i, PARTY_SIZE, PARTY_SIZE)) gAbsentBattlerFlags &= ~(gBitTable[i]); } // fall through @@ -1962,7 +1995,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_SLEEP); gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP_UPROAR; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; effect = 2; } @@ -1990,7 +2023,7 @@ u8 AtkCanceller_UnableToUseMove(void) { gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; effect = 2; } @@ -2019,7 +2052,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_FREEZE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DEFROSTED; } effect = 2; } @@ -2030,7 +2063,7 @@ u8 AtkCanceller_UnableToUseMove(void) { CancelMultiTurnMoves(gBattlerAttacker); gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LOAFING; gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; gMoveResultFlags |= MOVE_RESULT_MISSED; effect = 1; @@ -2103,12 +2136,14 @@ u8 AtkCanceller_UnableToUseMove(void) { if (Random() & 1) { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + // The MULTISTRING_CHOOSER is used here as a bool to signal + // to BattleScript_MoveUsedIsConfused whether or not damage was taken + gBattleCommunication[MULTISTRING_CHOOSER] = FALSE; BattleScriptPushCursor(); } else // confusion dmg { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = TRUE; gBattlerTarget = gBattlerAttacker; gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattlerAttacker], &gBattleMons[gBattlerAttacker], MOVE_POUND, 0, 40, 0, gBattlerAttacker, gBattlerAttacker); gProtectStructs[gBattlerAttacker].confusionSelfDmg = 1; @@ -2195,7 +2230,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_FREEZE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DEFROSTED_BY_MOVE; } effect = 2; } @@ -2593,7 +2628,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (gBattleMons[battler].statStages[STAT_SPEED] < MAX_STAT_STAGE && gDisableStructs[battler].isFirstTurn != 2) { gBattleMons[battler].statStages[STAT_SPEED]++; - gBattleScripting.animArg1 = 0x11; + gBattleScripting.animArg1 = 14 + STAT_SPEED; gBattleScripting.animArg2 = 0; BattleScriptPushCursorAndCallback(BattleScript_SpeedBoostActivates); gBattleScripting.battler = battler; @@ -2655,7 +2690,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA { if (!(gBattleResources->flags->flags[battler] & RESOURCE_FLAG_FLASH_FIRE)) { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FLASH_FIRE_BOOST; if (gProtectStructs[gBattlerAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_FlashFireBoost; else @@ -2666,7 +2701,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FLASH_FIRE_NO_BOOST; if (gProtectStructs[gBattlerAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_FlashFireBoost; else @@ -3431,7 +3466,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gEffectBattler = battlerId; SET_STATCHANGER(STAT_ATK, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_ATK; + gBattleScripting.animArg1 = 14 + STAT_ATK; gBattleScripting.animArg2 = 0; BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); effect = ITEM_STATS_CHANGE; @@ -3445,7 +3480,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gEffectBattler = battlerId; SET_STATCHANGER(STAT_DEF, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_DEF; + gBattleScripting.animArg1 = 14 + STAT_DEF; gBattleScripting.animArg2 = 0; BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); effect = ITEM_STATS_CHANGE; @@ -3459,7 +3494,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gEffectBattler = battlerId; SET_STATCHANGER(STAT_SPEED, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_SPEED; + gBattleScripting.animArg1 = 14 + STAT_SPEED; gBattleScripting.animArg2 = 0; BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); effect = ITEM_STATS_CHANGE; @@ -3473,7 +3508,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gEffectBattler = battlerId; SET_STATCHANGER(STAT_SPATK, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_SPATK; + gBattleScripting.animArg1 = 14 + STAT_SPATK; gBattleScripting.animArg2 = 0; BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); effect = ITEM_STATS_CHANGE; @@ -3487,7 +3522,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gEffectBattler = battlerId; SET_STATCHANGER(STAT_SPDEF, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_SPDEF; + gBattleScripting.animArg1 = 14 + STAT_SPDEF; gBattleScripting.animArg2 = 0; BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); effect = ITEM_STATS_CHANGE; @@ -3622,9 +3657,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) i++; } if (!(i > 1)) - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; else - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_NORMALIZED_STATUS; gBattleMons[battlerId].status1 = 0; gBattleMons[battlerId].status2 &= ~(STATUS2_CONFUSION); BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2); @@ -3637,7 +3672,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; effect = ITEM_EFFECT_OTHER; } break; @@ -3740,7 +3775,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet; effect = ITEM_EFFECT_OTHER; } @@ -3776,7 +3811,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleMons[battlerId].status1 = 0; gBattleMons[battlerId].status2 &= ~(STATUS2_CONFUSION); BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet; effect = ITEM_STATUS_CHANGE; } @@ -4016,7 +4051,9 @@ u8 IsMonDisobedient(void) calc = CheckMoveLimitations(gBattlerAttacker, gBitTable[gCurrMovePos], 0xFF); if (calc == 0xF) // all moves cannot be used { - gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3; + // Randomly select, then print a disobedient string + // B_MSG_LOAFING, B_MSG_WONT_OBEY, B_MSG_TURNED_AWAY, or B_MSG_PRETEND_NOT_NOTICE + gBattleCommunication[MULTISTRING_CHOOSER] = Random() & (NUM_LOAF_STRINGS - 1); gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; return 1; } @@ -4024,7 +4061,7 @@ u8 IsMonDisobedient(void) { do { - gCurrMovePos = gChosenMovePos = Random() & 3; + gCurrMovePos = gChosenMovePos = Random() & (MAX_MON_MOVES - 1); } while (gBitTable[gCurrMovePos] & calc); gCalledMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos]; @@ -4065,7 +4102,9 @@ u8 IsMonDisobedient(void) } else { - gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3; + // Randomly select, then print a disobedient string + // B_MSG_LOAFING, B_MSG_WONT_OBEY, B_MSG_TURNED_AWAY, or B_MSG_PRETEND_NOT_NOTICE + gBattleCommunication[MULTISTRING_CHOOSER] = Random() & (NUM_LOAF_STRINGS - 1); gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; return 1; } diff --git a/src/battle_util2.c b/src/battle_util2.c index 6d51f51e7..def7302d3 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -10,6 +10,7 @@ #include "constants/abilities.h" #include "random.h" #include "battle_scripts.h" +#include "constants/battle_string_ids.h" void AllocateBattleResources(void) { @@ -136,7 +137,7 @@ u32 sub_805725C(u8 battlerId) gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP); gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP_UPROAR; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; effect = 2; } @@ -163,7 +164,7 @@ u32 sub_805725C(u8 battlerId) { gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; effect = 2; } @@ -183,7 +184,7 @@ u32 sub_805725C(u8 battlerId) gBattleMons[battlerId].status1 &= ~(STATUS1_FREEZE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DEFROSTED; } effect = 2; } diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c index 5bad07420..22155ffd5 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -762,25 +762,16 @@ void BufferContestName(u8 *dest, u8 category) StringCopy(dest, sContestNames[category]); } -// used in tv.c to determine sTVShowState for Contest Lady show -// if return val is 1, sTVShowState is 1 -// if return val is 2, sTVShowState is 3 -// if return val is 0, sTVShowState is 2 -u8 sub_818E880(void) +// Used by the Contest Lady's TV show to determine how well she performed +u8 GetContestLadyPokeblockState(void) { sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest; if (sContestLadyPtr->numGoodPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD) - { - return 1; - } + return CONTEST_LADY_GOOD; else if (sContestLadyPtr->numGoodPokeblocksGiven == 0) - { - return 2; - } + return CONTEST_LADY_BAD; else - { - return 0; - } + return CONTEST_LADY_NORMAL; } diff --git a/src/pokemon.c b/src/pokemon.c index e28fba1b4..9fe008d56 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5366,7 +5366,7 @@ static void BufferStatRoseMessage(s32 arg0) gBattlerTarget = gBattlerInMenuId; StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[arg0]]); StringCopy(gBattleTextBuff2, gText_StatRose); - BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnsStatChanged2); + BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose); } u8 *UseStatIncreaseItem(u16 itemId) @@ -38,6 +38,7 @@ #include "constants/contest.h" #include "constants/items.h" #include "constants/layouts.h" +#include "constants/lilycove_lady.h" #include "constants/maps.h" #include "constants/metatile_behaviors.h" #include "constants/moves.h" @@ -179,7 +180,7 @@ static void DoTVShowPokemonNewsBattleFrontier(void); static void DoTVShowWhatsNo1InHoennToday(void); static void DoTVShowSecretBaseSecrets(void); static void DoTVShowSafariFanClub(void); -static void DoTVShowPokemonContestLiveUpdates2(void); +static void DoTVShowLilycoveContestLady(void); // .rodata @@ -461,11 +462,11 @@ static const u8 *const sTVNameRaterTextGroup[] = { gTVNameRaterText18 }; -static const u8 *const sTVPokemonContestLiveUpdates2TextGroup[] = { - gTVPokemonContestLiveUpdates2Text00, - gTVPokemonContestLiveUpdates2Text01, - gTVPokemonContestLiveUpdates2Text02, - gTVPokemonContestLiveUpdates2Text03 +static const u8 *const sTVLilycoveContestLadyTextGroup[] = { + [CONTESTLADYLIVE_STATE_INTRO] = ContestLadyShow_Text_Intro, + [CONTESTLADYLIVE_STATE_WON] = ContestLadyShow_Text_Won, + [CONTESTLADYLIVE_STATE_LOST] = ContestLadyShow_Text_Lost, + [CONTESTLADYLIVE_STATE_LOST_BADLY] = ContestLadyShow_Text_LostBadly }; static const u8 *const sTVPokemonTodayFailedTextGroup[] = { @@ -1661,13 +1662,13 @@ void PutLilycoveContestLadyShowOnTheAir(void) if (gSpecialVar_Result != TRUE) { show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot]; - BufferContestLadyLanguage(&show->contestLiveUpdates2.language); - show->contestLiveUpdates2.pokemonNameLanguage = GAME_LANGUAGE; - show->contestLiveUpdates2.kind = TVSHOW_CONTEST_LIVE_UPDATES_2; - show->contestLiveUpdates2.active = TRUE; - BufferContestLadyPlayerName(show->contestLiveUpdates2.playerName); - BufferContestLadyMonName(&show->contestLiveUpdates2.contestCategory, show->contestLiveUpdates2.nickname); - show->contestLiveUpdates2.pokeblockState = sub_818E880(); + BufferContestLadyLanguage(&show->contestLady.language); + show->contestLady.pokemonNameLanguage = GAME_LANGUAGE; + show->contestLady.kind = TVSHOW_LILYCOVE_CONTEST_LADY; + show->contestLady.active = TRUE; + BufferContestLadyPlayerName(show->contestLady.playerName); + BufferContestLadyMonName(&show->contestLady.contestCategory, show->contestLady.nickname); + show->contestLady.pokeblockState = GetContestLadyPokeblockState(); tv_store_id_2x(show); } } @@ -3812,9 +3813,8 @@ static void sub_80F0708(void) // FIXME: register allocation shenanigans break; case TVSHOW_FAN_CLUB_SPECIAL: break; - case TVSHOW_CONTEST_LIVE_UPDATES_2: + case TVSHOW_LILYCOVE_CONTEST_LADY: break; - case TVSHOW_OFF_AIR: break; case TVSHOW_FAN_CLUB_LETTER: @@ -4308,11 +4308,10 @@ static void sub_80F12A4(TVShow *shows) curShow->fanClubSpecial.language = TV_GetStringLanguage(curShow->fanClubSpecial.playerName); curShow->fanClubSpecial.idolNameLanguage = TV_GetStringLanguage(curShow->fanClubSpecial.idolName); break; - case TVSHOW_CONTEST_LIVE_UPDATES_2: - curShow->contestLiveUpdates2.language = TV_GetStringLanguage(curShow->contestLiveUpdates2.playerName); - curShow->contestLiveUpdates2.pokemonNameLanguage = TV_GetStringLanguage(curShow->contestLiveUpdates2.nickname); + case TVSHOW_LILYCOVE_CONTEST_LADY: + curShow->contestLady.language = TV_GetStringLanguage(curShow->contestLady.playerName); + curShow->contestLady.pokemonNameLanguage = TV_GetStringLanguage(curShow->contestLady.nickname); break; - case TVSHOW_POKEMON_TODAY_CAUGHT: curShow->pokemonToday.language = TV_GetStringLanguage(curShow->pokemonToday.playerName); curShow->pokemonToday.language2 = TV_GetStringLanguage(curShow->pokemonToday.nickname); @@ -4492,8 +4491,8 @@ void DoTVShow(void) case TVSHOW_SAFARI_FAN_CLUB: DoTVShowSafariFanClub(); break; - case TVSHOW_CONTEST_LIVE_UPDATES_2: - DoTVShowPokemonContestLiveUpdates2(); + case TVSHOW_LILYCOVE_CONTEST_LADY: + DoTVShowLilycoveContestLady(); break; } } @@ -7174,7 +7173,8 @@ static void DoTVShowSafariFanClub(void) ShowFieldMessage(sTVSafariFanClubTextGroup[state]); } -static void DoTVShowPokemonContestLiveUpdates2(void) +// This show is a version of Contest Live Updates for the Lilycove Contest Lady +static void DoTVShowLilycoveContestLady(void) { TVShow *show; u8 state; @@ -7184,30 +7184,30 @@ static void DoTVShowPokemonContestLiveUpdates2(void) state = sTVShowState; switch (state) { - case 0: - BufferContestName(gStringVar1, show->contestLiveUpdates2.contestCategory); - if (show->contestLiveUpdates2.pokeblockState == 1) - { - sTVShowState = 1; - } - else if (show->contestLiveUpdates2.pokeblockState == 0) - { - sTVShowState = 2; - } - else - { - sTVShowState = 3; - } - break; - case 1: - case 2: - TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates2.playerName, show->contestLiveUpdates2.language); - case 3: - TVShowConvertInternationalString(gStringVar2, show->contestLiveUpdates2.nickname, show->contestLiveUpdates2.pokemonNameLanguage); - TVShowDone(); - break; + case CONTESTLADYLIVE_STATE_INTRO: + BufferContestName(gStringVar1, show->contestLady.contestCategory); + if (show->contestLady.pokeblockState == CONTEST_LADY_GOOD) + { + sTVShowState = CONTESTLADYLIVE_STATE_WON; + } + else if (show->contestLady.pokeblockState == CONTEST_LADY_NORMAL) + { + sTVShowState = CONTESTLADYLIVE_STATE_LOST; + } + else // CONTEST_LADY_BAD + { + sTVShowState = CONTESTLADYLIVE_STATE_LOST_BADLY; + } + break; + case CONTESTLADYLIVE_STATE_WON: + case CONTESTLADYLIVE_STATE_LOST: + TVShowConvertInternationalString(gStringVar3, show->contestLady.playerName, show->contestLady.language); + case CONTESTLADYLIVE_STATE_LOST_BADLY: + TVShowConvertInternationalString(gStringVar2, show->contestLady.nickname, show->contestLady.pokemonNameLanguage); + TVShowDone(); + break; } - ShowFieldMessage(sTVPokemonContestLiveUpdates2TextGroup[state]); + ShowFieldMessage(sTVLilycoveContestLadyTextGroup[state]); } void TVShowDone(void) |