summaryrefslogtreecommitdiff
path: root/src/battle_controller_player.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/battle_controller_player.c')
-rw-r--r--src/battle_controller_player.c97
1 files changed, 49 insertions, 48 deletions
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c
index 9fc0c68ea..26c2cae98 100644
--- a/src/battle_controller_player.c
+++ b/src/battle_controller_player.c
@@ -15,6 +15,7 @@
#include "constants/songs.h"
#include "sound.h"
#include "constants/moves.h"
+#include "constants/trainers.h"
#include "window.h"
#include "m4a.h"
#include "palette.h"
@@ -100,8 +101,8 @@ static void PlayerHandleFaintingCry(void);
static void PlayerHandleIntroSlide(void);
static void PlayerHandleIntroTrainerBallThrow(void);
static void PlayerHandleDrawPartyStatusSummary(void);
-static void PlayerHandleCmd49(void);
-static void PlayerHandleCmd50(void);
+static void PlayerHandleHidePartyStatusSummary(void);
+static void PlayerHandleEndBounceEffect(void);
static void PlayerHandleSpriteInvisibility(void);
static void PlayerHandleBattleAnimation(void);
static void PlayerHandleLinkStandbyMsg(void);
@@ -187,8 +188,8 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
PlayerHandleIntroSlide,
PlayerHandleIntroTrainerBallThrow,
PlayerHandleDrawPartyStatusSummary,
- PlayerHandleCmd49,
- PlayerHandleCmd50,
+ PlayerHandleHidePartyStatusSummary,
+ PlayerHandleEndBounceEffect,
PlayerHandleSpriteInvisibility,
PlayerHandleBattleAnimation,
PlayerHandleLinkStandbyMsg,
@@ -250,10 +251,10 @@ static void HandleInputChooseAction(void)
{
u16 itemId = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
- dp11b_obj_instanciate(gActiveBattler, 1, 7, 1);
- dp11b_obj_instanciate(gActiveBattler, 0, 7, 1);
+ DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
+ DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
- if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2)
+ if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
@@ -347,8 +348,8 @@ static void HandleInputChooseAction(void)
static void sub_80577F0(void) // unused
{
- dp11b_obj_free(gActiveBattler, 1);
- dp11b_obj_free(gActiveBattler, 0);
+ EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX);
+ EndBounceEffect(gActiveBattler, BOUNCE_MON);
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget;
}
@@ -358,7 +359,7 @@ static void HandleInputChooseTarget(void)
u8 identities[4];
memcpy(identities, sTargetIdentities, ARRAY_COUNT(sTargetIdentities));
- dp11b_obj_instanciate(gMultiUsePlayerCursor, 1, 0xF, 1);
+ DoBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX, 15, 1);
// what a weird loop
i = 0;
@@ -367,7 +368,7 @@ static void HandleInputChooseTarget(void)
do
{
if (i != gMultiUsePlayerCursor)
- dp11b_obj_free(i, 1);
+ EndBounceEffect(i, BOUNCE_HEALTHBOX);
i++;
} while (i < gBattlersCount);
}
@@ -382,7 +383,7 @@ static void HandleInputChooseTarget(void)
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
- dp11b_obj_free(gMultiUsePlayerCursor, 1);
+ EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
PlayerBufferExecCompleted();
}
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
@@ -390,9 +391,9 @@ static void HandleInputChooseTarget(void)
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove;
- dp11b_obj_instanciate(gActiveBattler, 1, 7, 1);
- dp11b_obj_instanciate(gActiveBattler, 0, 7, 1);
- dp11b_obj_free(gMultiUsePlayerCursor, 1);
+ DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
+ DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
+ EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
}
else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP))
{
@@ -485,7 +486,7 @@ static void HandleInputChooseMove(void)
bool32 canSelectTarget = FALSE;
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
- if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2)
+ if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
@@ -620,7 +621,7 @@ static void HandleInputChooseMove(void)
gMultiUsePlayerCursor = gMoveSelectionCursor[gActiveBattler] + 1;
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
- BattleHandleAddTextPrinter(gText_BattleSwitchWhich, 0xB);
+ BattlePutTextOnWindow(gText_BattleSwitchWhich, 0xB);
gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitchting;
}
}
@@ -1120,7 +1121,7 @@ void c3_0802FDF4(u8 taskId)
static void CompleteOnHealthbarDone(void)
{
- s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
+ s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
@@ -1224,7 +1225,7 @@ static void sub_8059400(u8 taskId)
u8 battlerId = gTasks[taskId].tExpTask_bank;
s16 r4;
- r4 = sub_8074AA0(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
+ r4 = MoveBattleBar(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]);
if (r4 == -1)
{
@@ -1458,7 +1459,7 @@ static void MoveSelectionDisplayMoveNames(void)
{
MoveSelectionDestroyCursorAt(i);
StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]);
- BattleHandleAddTextPrinter(gDisplayedStringBattle, i + 3);
+ BattlePutTextOnWindow(gDisplayedStringBattle, i + 3);
if (moveInfo->moves[i] != MOVE_NONE)
gNumberOfMovesToChoose++;
}
@@ -1467,7 +1468,7 @@ static void MoveSelectionDisplayMoveNames(void)
static void MoveSelectionDisplayPpString(void)
{
StringCopy(gDisplayedStringBattle, gText_MoveInterfacePP);
- BattleHandleAddTextPrinter(gDisplayedStringBattle, 7);
+ BattlePutTextOnWindow(gDisplayedStringBattle, 7);
}
static void MoveSelectionDisplayPpNumber(void)
@@ -1485,7 +1486,7 @@ static void MoveSelectionDisplayPpNumber(void)
txtPtr++;
ConvertIntToDecimalStringN(txtPtr, moveInfo->maxPp[gMoveSelectionCursor[gActiveBattler]], STR_CONV_MODE_RIGHT_ALIGN, 2);
- BattleHandleAddTextPrinter(gDisplayedStringBattle, 9);
+ BattlePutTextOnWindow(gDisplayedStringBattle, 9);
}
static void MoveSelectionDisplayMoveType(void)
@@ -1502,7 +1503,7 @@ static void MoveSelectionDisplayMoveType(void)
txtPtr++;
StringCopy(txtPtr, gTypeNames[gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]].type]);
- BattleHandleAddTextPrinter(gDisplayedStringBattle, 10);
+ BattlePutTextOnWindow(gDisplayedStringBattle, 10);
}
static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1)
@@ -1573,7 +1574,7 @@ static void PrintLinkStandbyMsg(void)
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
- BattleHandleAddTextPrinter(gText_LinkStandby, 0);
+ BattlePutTextOnWindow(gText_LinkStandby, 0);
}
}
@@ -2259,9 +2260,9 @@ static void DoSwitchOutAnimation(void)
}
}
-// some explanation here
-// in emerald it's possible to have a tag battle in the battle frontier facilities with AI
-// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it
+// In emerald it's possible to have a tag battle in the battle frontier facilities with AI
+// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven)
+// that use an animated back pic.
static void PlayerHandleDrawTrainerPic(void)
{
s16 xPos, yPos;
@@ -2272,12 +2273,12 @@ static void PlayerHandleDrawTrainerPic(void)
if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN)
{
- trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RED;
+ trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RED;
}
else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE)
{
- trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RS_BRENDAN;
+ trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN;
}
else
{
@@ -2296,7 +2297,7 @@ static void PlayerHandleDrawTrainerPic(void)
else // first mon
xPos = 32;
- if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID)
+ if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
{
xPos = 90;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
@@ -2314,7 +2315,7 @@ static void PlayerHandleDrawTrainerPic(void)
}
// Use front pic table for any tag battles unless your partner is Steven.
- if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID)
+ if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
{
trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender);
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
@@ -2354,12 +2355,12 @@ static void PlayerHandleTrainerSlide(void)
if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN)
{
- trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RED;
+ trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RED;
}
else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE)
{
- trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RS_BRENDAN;
+ trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN;
}
else
{
@@ -2536,7 +2537,7 @@ static void PlayerHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
- BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
+ BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2;
BattleTv_SetDataBasedOnString(*stringId);
sub_81A57E4(gActiveBattler, *stringId);
@@ -2566,14 +2567,14 @@ static void PlayerHandleChooseAction(void)
gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
BattleTv_ClearExplosionFaintCause();
- BattleHandleAddTextPrinter(gText_BattleMenu, 2);
+ BattlePutTextOnWindow(gText_BattleMenu, 2);
for (i = 0; i < 4; i++)
ActionSelectionDestroyCursorAt(i);
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo);
- BattleHandleAddTextPrinter(gDisplayedStringBattle, 1);
+ BattlePutTextOnWindow(gDisplayedStringBattle, 1);
}
static void PlayerHandleUnknownYesNoBox(void)
@@ -2581,7 +2582,7 @@ static void PlayerHandleUnknownYesNoBox(void)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
- BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 12);
+ BattlePutTextOnWindow(gText_BattleYesNoChoice, 12);
gMultiUsePlayerCursor = 1;
BattleCreateYesNoCursorAt(1);
gBattlerControllerFuncs[gActiveBattler] = PlayerHandleUnknownYesNoInput;
@@ -2945,8 +2946,8 @@ static void PlayerHandleIntroTrainerBallThrow(void)
taskId = CreateTask(task05_08033660, 5);
gTasks[taskId].data[0] = gActiveBattler;
- if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
- gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
+ if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
+ gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
@@ -3003,7 +3004,7 @@ static void PlayerHandleDrawPartyStatusSummary(void)
}
else
{
- gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
+ gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0;
@@ -3023,17 +3024,17 @@ static void sub_805CE38(void)
}
}
-static void PlayerHandleCmd49(void)
+static void PlayerHandleHidePartyStatusSummary(void)
{
- if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
- gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
+ if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
+ gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
PlayerBufferExecCompleted();
}
-static void PlayerHandleCmd50(void)
+static void PlayerHandleEndBounceEffect(void)
{
- dp11b_obj_free(gActiveBattler, 1);
- dp11b_obj_free(gActiveBattler, 0);
+ EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX);
+ EndBounceEffect(gActiveBattler, BOUNCE_MON);
PlayerBufferExecCompleted();
}
@@ -3072,8 +3073,8 @@ static void PlayerHandleLinkStandbyMsg(void)
PrintLinkStandbyMsg();
// fall through
case 1:
- dp11b_obj_free(gActiveBattler, 1);
- dp11b_obj_free(gActiveBattler, 0);
+ EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX);
+ EndBounceEffect(gActiveBattler, BOUNCE_MON);
break;
case 2:
PrintLinkStandbyMsg();