mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
document bounce effect
This commit is contained in:
parent
94752d4207
commit
ab36efdaf4
106
include/battle.h
106
include/battle.h
@ -33,7 +33,7 @@
|
||||
#define B_ACTION_SAFARI_GO_NEAR 7
|
||||
#define B_ACTION_SAFARI_RUN 8
|
||||
// The exact purposes of these are unclear
|
||||
#define B_ACTION_UNKNOWN9 9
|
||||
#define B_ACTION_WALLY_THROW 9
|
||||
#define B_ACTION_EXEC_SCRIPT 10 // when executing an action
|
||||
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
|
||||
#define B_ACTION_FINISHED 12 // when executing an action
|
||||
@ -150,29 +150,29 @@ struct DisableStruct
|
||||
/*0x08*/ u8 protectUses;
|
||||
/*0x09*/ u8 stockpileCounter;
|
||||
/*0x0A*/ u8 substituteHP;
|
||||
/*0x0B*/ u8 disableTimer1 : 4;
|
||||
/*0x0B*/ u8 disableTimer2 : 4;
|
||||
/*0x0B*/ u8 disableTimer1:4;
|
||||
/*0x0B*/ u8 disableTimer2:4;
|
||||
/*0x0C*/ u8 encoredMovePos;
|
||||
/*0x0D*/ u8 unkD;
|
||||
/*0x0E*/ u8 encoreTimer1 : 4;
|
||||
/*0x0E*/ u8 encoreTimer2 : 4;
|
||||
/*0x0F*/ u8 perishSongTimer1 : 4;
|
||||
/*0x0F*/ u8 perishSongTimer2 : 4;
|
||||
/*0x0E*/ u8 encoreTimer1:4;
|
||||
/*0x0E*/ u8 encoreTimer2:4;
|
||||
/*0x0F*/ u8 perishSongTimer1:4;
|
||||
/*0x0F*/ u8 perishSongTimer2:4;
|
||||
/*0x10*/ u8 furyCutterCounter;
|
||||
/*0x11*/ u8 rolloutCounter1 : 4;
|
||||
/*0x11*/ u8 rolloutCounter2 : 4;
|
||||
/*0x12*/ u8 chargeTimer1 : 4;
|
||||
/*0x12*/ u8 chargeTimer2 : 4;
|
||||
/*0x11*/ u8 rolloutCounter1:4;
|
||||
/*0x11*/ u8 rolloutCounter2:4;
|
||||
/*0x12*/ u8 chargeTimer1:4;
|
||||
/*0x12*/ u8 chargeTimer2:4;
|
||||
/*0x13*/ u8 tauntTimer1:4;
|
||||
/*0x13*/ u8 tauntTimer2:4;
|
||||
/*0x14*/ u8 battlerPreventingEscape;
|
||||
/*0x15*/ u8 battlerWithSureHit;
|
||||
/*0x16*/ u8 isFirstTurn;
|
||||
/*0x17*/ u8 unk17;
|
||||
/*0x18*/ u8 truantCounter : 1;
|
||||
/*0x18*/ u8 truantUnknownBit : 1;
|
||||
/*0x18*/ u8 unk18_a_2 : 2;
|
||||
/*0x18*/ u8 unk18_b : 4;
|
||||
/*0x18*/ u8 truantCounter:1;
|
||||
/*0x18*/ u8 truantUnknownBit:1;
|
||||
/*0x18*/ u8 unk18_a_2:2;
|
||||
/*0x18*/ u8 unk18_b:4;
|
||||
/*0x19*/ u8 rechargeCounter;
|
||||
/*0x1A*/ u8 unk1A[2];
|
||||
};
|
||||
@ -201,12 +201,12 @@ struct ProtectStruct
|
||||
u32 flag2Unknown:1; // 0x2
|
||||
u32 flinchImmobility:1; // 0x4
|
||||
u32 notFirstStrike:1; // 0x8
|
||||
u32 flag_x10 : 1; // 0x10
|
||||
u32 flag_x20 : 1; // 0x20
|
||||
u32 flag_x40 : 1; // 0x40
|
||||
u32 flag_x80 : 1; // 0x80
|
||||
u32 flag_x10:1; // 0x10
|
||||
u32 flag_x20:1; // 0x20
|
||||
u32 flag_x40:1; // 0x40
|
||||
u32 flag_x80:1; // 0x80
|
||||
/* field_3 */
|
||||
u32 field3 : 8;
|
||||
u32 field3:8;
|
||||
|
||||
/* field_4 */ u32 physicalDmg;
|
||||
/* field_8 */ u32 specialDmg;
|
||||
@ -217,14 +217,14 @@ struct ProtectStruct
|
||||
|
||||
struct SpecialStatus
|
||||
{
|
||||
u8 statLowered : 1; // 0x1
|
||||
u8 lightningRodRedirected : 1; // 0x2
|
||||
u8 statLowered:1; // 0x1
|
||||
u8 lightningRodRedirected:1; // 0x2
|
||||
u8 restoredBankSprite: 1; // 0x4
|
||||
u8 intimidatedPoke : 1; // 0x8
|
||||
u8 traced : 1; // 0x10
|
||||
u8 flag20 : 1;
|
||||
u8 flag40 : 1;
|
||||
u8 focusBanded : 1;
|
||||
u8 intimidatedPoke:1; // 0x8
|
||||
u8 traced:1; // 0x10
|
||||
u8 flag20:1;
|
||||
u8 flag40:1;
|
||||
u8 focusBanded:1;
|
||||
u8 field1[3];
|
||||
s32 dmg;
|
||||
s32 physicalDmg;
|
||||
@ -629,11 +629,11 @@ u8 GetBattlerAtPosition(u8 bank);
|
||||
|
||||
struct BattleSpriteInfo
|
||||
{
|
||||
u16 invisible : 1; // 0x1
|
||||
u16 lowHpSong : 1; // 0x2
|
||||
u16 behindSubstitute : 1; // 0x4
|
||||
u16 flag_x8 : 1; // 0x8
|
||||
u16 hpNumbersNoBars : 1; // 0x10
|
||||
u16 invisible:1; // 0x1
|
||||
u16 lowHpSong:1; // 0x2
|
||||
u16 behindSubstitute:1; // 0x4
|
||||
u16 flag_x8:1; // 0x8
|
||||
u16 hpNumbersNoBars:1; // 0x10
|
||||
u16 transformSpecies;
|
||||
};
|
||||
|
||||
@ -647,12 +647,12 @@ struct BattleAnimationInfo
|
||||
u8 field_6;
|
||||
u8 field_7;
|
||||
u8 ballThrowCaseId;
|
||||
u8 field_9_x1 : 1;
|
||||
u8 field_9_x2 : 1;
|
||||
u8 field_9_x1C : 3;
|
||||
u8 field_9_x20 : 1;
|
||||
u8 field_9_x40 : 1;
|
||||
u8 field_9_x80 : 1;
|
||||
u8 field_9_x1:1;
|
||||
u8 field_9_x2:1;
|
||||
u8 field_9_x1C:3;
|
||||
u8 field_9_x20:1;
|
||||
u8 field_9_x40:1;
|
||||
u8 field_9_x80:1;
|
||||
u8 field_A;
|
||||
u8 field_B;
|
||||
u8 field_C;
|
||||
@ -663,21 +663,21 @@ struct BattleAnimationInfo
|
||||
|
||||
struct BattleHealthboxInfo
|
||||
{
|
||||
u8 flag_x1 : 1;
|
||||
u8 flag_x2 : 1;
|
||||
u8 flag_x4 : 1;
|
||||
u8 ballAnimActive : 1; // 0x8
|
||||
u8 statusAnimActive : 1; // x10
|
||||
u8 animFromTableActive : 1; // x20
|
||||
u8 specialAnimActive : 1; //x40
|
||||
u8 flag_x80 : 1;
|
||||
u8 field_1_x1 : 1;
|
||||
u8 field_1_x1E : 4;
|
||||
u8 field_1_x20 : 1;
|
||||
u8 field_1_x40 : 1;
|
||||
u8 field_1_x80 : 1;
|
||||
u8 field_2;
|
||||
u8 field_3;
|
||||
u8 flag_x1:1;
|
||||
u8 healthboxIsBouncing:1;
|
||||
u8 battlerIsBouncing:1;
|
||||
u8 ballAnimActive:1; // 0x8
|
||||
u8 statusAnimActive:1; // x10
|
||||
u8 animFromTableActive:1; // x20
|
||||
u8 specialAnimActive:1; //x40
|
||||
u8 flag_x80:1;
|
||||
u8 field_1_x1:1;
|
||||
u8 field_1_x1E:4;
|
||||
u8 field_1_x20:1;
|
||||
u8 field_1_x40:1;
|
||||
u8 field_1_x80:1;
|
||||
u8 healthboxBounceSpriteId;
|
||||
u8 battlerBounceSpriteId;
|
||||
u8 animationState;
|
||||
u8 field_5;
|
||||
u8 field_6;
|
||||
|
@ -82,8 +82,8 @@ enum
|
||||
|
||||
struct UnusedControllerStruct
|
||||
{
|
||||
u8 field_0 : 7;
|
||||
u8 flag_x80 : 1;
|
||||
u8 field_0:7;
|
||||
u8 flag_x80:1;
|
||||
};
|
||||
|
||||
struct HpAndStatus
|
||||
@ -161,7 +161,7 @@ enum
|
||||
CONTROLLER_INTROTRAINERBALLTHROW,
|
||||
CONTROLLER_DRAWPARTYSTATUSSUMMARY,
|
||||
CONTROLLER_49,
|
||||
CONTROLLER_50,
|
||||
CONTROLLER_ENDBOUNCE,
|
||||
CONTROLLER_SPRITEINVISIBILITY,
|
||||
CONTROLLER_BATTLEANIMATION,
|
||||
CONTROLLER_LINKSTANDBYMSG,
|
||||
@ -231,7 +231,7 @@ void BtlController_EmitIntroSlide(u8 bufferId, u8 terrainId);
|
||||
void BtlController_EmitIntroTrainerBallThrow(u8 bufferId);
|
||||
void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2);
|
||||
void BtlController_EmitCmd49(u8 bufferId);
|
||||
void BtlController_EmitCmd50(u8 bufferId);
|
||||
void BtlController_EmitEndBounceEffect(u8 bufferId);
|
||||
void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
|
||||
void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
|
||||
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
|
||||
|
@ -25,6 +25,10 @@ struct TrainerMoney
|
||||
#define TYPE_FORESIGHT 0xFE
|
||||
#define TYPE_ENDTABLE 0xFF
|
||||
|
||||
// defines for the 'DoBounceEffect' function
|
||||
#define BOUNCE_MON 0x0
|
||||
#define BOUNCE_HEALTHBOX 0x1
|
||||
|
||||
void CB2_InitBattle(void);
|
||||
void BattleMainCB2(void);
|
||||
void CB2_QuitRecordedBattle(void);
|
||||
@ -38,15 +42,15 @@ u32 sub_80391E0(u8 arrayId, u8 caseId);
|
||||
u32 sub_80397C4(u32 setId, u32 tableId);
|
||||
void oac_poke_opponent(struct Sprite *sprite);
|
||||
void SpriteCallbackDummy_2(struct Sprite *sprite);
|
||||
void sub_8039934(struct Sprite *sprite);
|
||||
void SpriteCB_FaintOpponentMon(struct Sprite *sprite);
|
||||
void sub_8039AD8(struct Sprite *sprite);
|
||||
void sub_8039B2C(struct Sprite *sprite);
|
||||
void sub_8039B58(struct Sprite *sprite);
|
||||
void sub_8039BB4(struct Sprite *sprite);
|
||||
void sub_80105DC(struct Sprite *sprite);
|
||||
void sub_8039C00(struct Sprite *sprite);
|
||||
void dp11b_obj_instanciate(u8 battlerId, u8 b, s8 c, s8 d);
|
||||
void dp11b_obj_free(u8 battlerId, bool8 b);
|
||||
void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d);
|
||||
void EndBounceEffect(u8 battlerId, bool8 b);
|
||||
void sub_8039E44(struct Sprite *sprite);
|
||||
void sub_8039E60(struct Sprite *sprite);
|
||||
void sub_8039E84(struct Sprite *sprite);
|
||||
@ -80,6 +84,6 @@ extern const u8 gStatusConditionString_IceJpn[8];
|
||||
extern const u8 gStatusConditionString_ConfusionJpn[8];
|
||||
extern const u8 gStatusConditionString_LoveJpn[8];
|
||||
|
||||
extern const u8 * const gStatusConditionStringsTable[7][2];
|
||||
extern const u8 *const gStatusConditionStringsTable[7][2];
|
||||
|
||||
#endif // GUARD_BATTLE_MAIN_H
|
||||
|
@ -35,12 +35,18 @@
|
||||
// Converts a number to Q4.12 fixed-point format
|
||||
#define Q_4_12(n) ((s16)((n) * 4096))
|
||||
|
||||
// Converts a number to Q24.8 fixed-point format
|
||||
#define Q_24_8(n) ((s32)((n) * 256))
|
||||
|
||||
// Converts a Q8.8 fixed-point format number to a regular integer
|
||||
#define Q_8_8_TO_INT(n) ((int)((n) / 256))
|
||||
|
||||
// Converts a Q4.12 fixed-point format number to a regular integer
|
||||
#define Q_4_12_TO_INT(n) ((int)((n) / 4096))
|
||||
|
||||
// Converts a Q24.8 fixed-point format number to a regular integer
|
||||
#define Q_24_8_TO_INT(n) ((int)((n) >> 8))
|
||||
|
||||
#define PARTY_SIZE 6
|
||||
|
||||
#define POKEMON_SLOTS_NUMBER 412
|
||||
|
@ -90,7 +90,7 @@ static void LinkOpponentHandleIntroSlide(void);
|
||||
static void LinkOpponentHandleIntroTrainerBallThrow(void);
|
||||
static void LinkOpponentHandleDrawPartyStatusSummary(void);
|
||||
static void LinkOpponentHandleCmd49(void);
|
||||
static void LinkOpponentHandleCmd50(void);
|
||||
static void LinkOpponentHandleEndBounceEffect(void);
|
||||
static void LinkOpponentHandleSpriteInvisibility(void);
|
||||
static void LinkOpponentHandleBattleAnimation(void);
|
||||
static void LinkOpponentHandleLinkStandbyMsg(void);
|
||||
@ -162,7 +162,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
LinkOpponentHandleIntroTrainerBallThrow,
|
||||
LinkOpponentHandleDrawPartyStatusSummary,
|
||||
LinkOpponentHandleCmd49,
|
||||
LinkOpponentHandleCmd50,
|
||||
LinkOpponentHandleEndBounceEffect,
|
||||
LinkOpponentHandleSpriteInvisibility,
|
||||
LinkOpponentHandleBattleAnimation,
|
||||
LinkOpponentHandleLinkStandbyMsg,
|
||||
@ -1366,7 +1366,7 @@ static void LinkOpponentHandleFaintAnimation(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_8064C14;
|
||||
}
|
||||
}
|
||||
@ -1803,7 +1803,7 @@ static void LinkOpponentHandleCmd49(void)
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleCmd50(void)
|
||||
static void LinkOpponentHandleEndBounceEffect(void)
|
||||
{
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ static void LinkPartnerHandleIntroSlide(void);
|
||||
static void LinkPartnerHandleIntroTrainerBallThrow(void);
|
||||
static void LinkPartnerHandleDrawPartyStatusSummary(void);
|
||||
static void LinkPartnerHandleCmd49(void);
|
||||
static void LinkPartnerHandleCmd50(void);
|
||||
static void LinkPartnerHandleEndBounceEffect(void);
|
||||
static void LinkPartnerHandleSpriteInvisibility(void);
|
||||
static void LinkPartnerHandleBattleAnimation(void);
|
||||
static void LinkPartnerHandleLinkStandbyMsg(void);
|
||||
@ -159,7 +159,7 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
LinkPartnerHandleIntroTrainerBallThrow,
|
||||
LinkPartnerHandleDrawPartyStatusSummary,
|
||||
LinkPartnerHandleCmd49,
|
||||
LinkPartnerHandleCmd50,
|
||||
LinkPartnerHandleEndBounceEffect,
|
||||
LinkPartnerHandleSpriteInvisibility,
|
||||
LinkPartnerHandleBattleAnimation,
|
||||
LinkPartnerHandleLinkStandbyMsg,
|
||||
@ -1638,7 +1638,7 @@ static void LinkPartnerHandleCmd49(void)
|
||||
LinkPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleCmd50(void)
|
||||
static void LinkPartnerHandleEndBounceEffect(void)
|
||||
{
|
||||
LinkPartnerBufferExecCompleted();
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ static void OpponentHandleIntroSlide(void);
|
||||
static void OpponentHandleIntroTrainerBallThrow(void);
|
||||
static void OpponentHandleDrawPartyStatusSummary(void);
|
||||
static void OpponentHandleCmd49(void);
|
||||
static void OpponentHandleCmd50(void);
|
||||
static void OpponentHandleEndBounceEffect(void);
|
||||
static void OpponentHandleSpriteInvisibility(void);
|
||||
static void OpponentHandleBattleAnimation(void);
|
||||
static void OpponentHandleLinkStandbyMsg(void);
|
||||
@ -167,7 +167,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
OpponentHandleIntroTrainerBallThrow,
|
||||
OpponentHandleDrawPartyStatusSummary,
|
||||
OpponentHandleCmd49,
|
||||
OpponentHandleCmd50,
|
||||
OpponentHandleEndBounceEffect,
|
||||
OpponentHandleSpriteInvisibility,
|
||||
OpponentHandleBattleAnimation,
|
||||
OpponentHandleLinkStandbyMsg,
|
||||
@ -1403,7 +1403,7 @@ static void OpponentHandleFaintAnimation(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_805FAC4;
|
||||
}
|
||||
}
|
||||
@ -1957,7 +1957,7 @@ static void OpponentHandleCmd49(void)
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void OpponentHandleCmd50(void)
|
||||
static void OpponentHandleEndBounceEffect(void)
|
||||
{
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ static void PlayerHandleIntroSlide(void);
|
||||
static void PlayerHandleIntroTrainerBallThrow(void);
|
||||
static void PlayerHandleDrawPartyStatusSummary(void);
|
||||
static void PlayerHandleCmd49(void);
|
||||
static void PlayerHandleCmd50(void);
|
||||
static void PlayerHandleEndBounceEffect(void);
|
||||
static void PlayerHandleSpriteInvisibility(void);
|
||||
static void PlayerHandleBattleAnimation(void);
|
||||
static void PlayerHandleLinkStandbyMsg(void);
|
||||
@ -188,7 +188,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
PlayerHandleIntroTrainerBallThrow,
|
||||
PlayerHandleDrawPartyStatusSummary,
|
||||
PlayerHandleCmd49,
|
||||
PlayerHandleCmd50,
|
||||
PlayerHandleEndBounceEffect,
|
||||
PlayerHandleSpriteInvisibility,
|
||||
PlayerHandleBattleAnimation,
|
||||
PlayerHandleLinkStandbyMsg,
|
||||
@ -250,8 +250,8 @@ 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)
|
||||
gPlayerDpadHoldFrames++;
|
||||
@ -347,8 +347,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 +358,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 +367,7 @@ static void HandleInputChooseTarget(void)
|
||||
do
|
||||
{
|
||||
if (i != gMultiUsePlayerCursor)
|
||||
dp11b_obj_free(i, 1);
|
||||
EndBounceEffect(i, BOUNCE_HEALTHBOX);
|
||||
i++;
|
||||
} while (i < gBattlersCount);
|
||||
}
|
||||
@ -382,7 +382,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 +390,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))
|
||||
{
|
||||
@ -3030,10 +3030,10 @@ static void PlayerHandleCmd49(void)
|
||||
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 +3072,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();
|
||||
|
@ -88,7 +88,7 @@ static void PlayerPartnerHandleIntroSlide(void);
|
||||
static void PlayerPartnerHandleIntroTrainerBallThrow(void);
|
||||
static void PlayerPartnerHandleDrawPartyStatusSummary(void);
|
||||
static void PlayerPartnerHandleCmd49(void);
|
||||
static void PlayerPartnerHandleCmd50(void);
|
||||
static void PlayerPartnerHandleEndBounceEffect(void);
|
||||
static void PlayerPartnerHandleSpriteInvisibility(void);
|
||||
static void PlayerPartnerHandleBattleAnimation(void);
|
||||
static void PlayerPartnerHandleLinkStandbyMsg(void);
|
||||
@ -165,7 +165,7 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
PlayerPartnerHandleIntroTrainerBallThrow,
|
||||
PlayerPartnerHandleDrawPartyStatusSummary,
|
||||
PlayerPartnerHandleCmd49,
|
||||
PlayerPartnerHandleCmd50,
|
||||
PlayerPartnerHandleEndBounceEffect,
|
||||
PlayerPartnerHandleSpriteInvisibility,
|
||||
PlayerPartnerHandleBattleAnimation,
|
||||
PlayerPartnerHandleLinkStandbyMsg,
|
||||
@ -1884,7 +1884,7 @@ static void PlayerPartnerHandleCmd49(void)
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleCmd50(void)
|
||||
static void PlayerPartnerHandleEndBounceEffect(void)
|
||||
{
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ static void RecordedOpponentHandleIntroSlide(void);
|
||||
static void RecordedOpponentHandleIntroTrainerBallThrow(void);
|
||||
static void RecordedOpponentHandleDrawPartyStatusSummary(void);
|
||||
static void RecordedOpponentHandleCmd49(void);
|
||||
static void RecordedOpponentHandleCmd50(void);
|
||||
static void RecordedOpponentHandleEndBounceEffect(void);
|
||||
static void RecordedOpponentHandleSpriteInvisibility(void);
|
||||
static void RecordedOpponentHandleBattleAnimation(void);
|
||||
static void RecordedOpponentHandleLinkStandbyMsg(void);
|
||||
@ -163,7 +163,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void
|
||||
RecordedOpponentHandleIntroTrainerBallThrow,
|
||||
RecordedOpponentHandleDrawPartyStatusSummary,
|
||||
RecordedOpponentHandleCmd49,
|
||||
RecordedOpponentHandleCmd50,
|
||||
RecordedOpponentHandleEndBounceEffect,
|
||||
RecordedOpponentHandleSpriteInvisibility,
|
||||
RecordedOpponentHandleBattleAnimation,
|
||||
RecordedOpponentHandleLinkStandbyMsg,
|
||||
@ -1296,7 +1296,7 @@ static void RecordedOpponentHandleFaintAnimation(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_8186D58;
|
||||
}
|
||||
}
|
||||
@ -1745,7 +1745,7 @@ static void RecordedOpponentHandleCmd49(void)
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleCmd50(void)
|
||||
static void RecordedOpponentHandleEndBounceEffect(void)
|
||||
{
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ static void RecordedPlayerHandleIntroSlide(void);
|
||||
static void RecordedPlayerHandleIntroTrainerBallThrow(void);
|
||||
static void RecordedPlayerHandleDrawPartyStatusSummary(void);
|
||||
static void RecordedPlayerHandleCmd49(void);
|
||||
static void RecordedPlayerHandleCmd50(void);
|
||||
static void RecordedPlayerHandleEndBounceEffect(void);
|
||||
static void RecordedPlayerHandleSpriteInvisibility(void);
|
||||
static void RecordedPlayerHandleBattleAnimation(void);
|
||||
static void RecordedPlayerHandleLinkStandbyMsg(void);
|
||||
@ -161,7 +161,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void)
|
||||
RecordedPlayerHandleIntroTrainerBallThrow,
|
||||
RecordedPlayerHandleDrawPartyStatusSummary,
|
||||
RecordedPlayerHandleCmd49,
|
||||
RecordedPlayerHandleCmd50,
|
||||
RecordedPlayerHandleEndBounceEffect,
|
||||
RecordedPlayerHandleSpriteInvisibility,
|
||||
RecordedPlayerHandleBattleAnimation,
|
||||
RecordedPlayerHandleLinkStandbyMsg,
|
||||
@ -1767,7 +1767,7 @@ static void RecordedPlayerHandleCmd49(void)
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleCmd50(void)
|
||||
static void RecordedPlayerHandleEndBounceEffect(void)
|
||||
{
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ static void SafariHandleIntroSlide(void);
|
||||
static void SafariHandleIntroTrainerBallThrow(void);
|
||||
static void SafariHandleDrawPartyStatusSummary(void);
|
||||
static void SafariHandleCmd49(void);
|
||||
static void SafariHandleCmd50(void);
|
||||
static void SafariHandleEndBounceEffect(void);
|
||||
static void SafariHandleSpriteInvisibility(void);
|
||||
static void SafariHandleBattleAnimation(void);
|
||||
static void SafariHandleLinkStandbyMsg(void);
|
||||
@ -145,7 +145,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
SafariHandleIntroTrainerBallThrow,
|
||||
SafariHandleDrawPartyStatusSummary,
|
||||
SafariHandleCmd49,
|
||||
SafariHandleCmd50,
|
||||
SafariHandleEndBounceEffect,
|
||||
SafariHandleSpriteInvisibility,
|
||||
SafariHandleBattleAnimation,
|
||||
SafariHandleLinkStandbyMsg,
|
||||
@ -650,7 +650,7 @@ static void SafariHandleCmd49(void)
|
||||
SafariBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SafariHandleCmd50(void)
|
||||
static void SafariHandleEndBounceEffect(void)
|
||||
{
|
||||
SafariBufferExecCompleted();
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ static void WallyHandleIntroSlide(void);
|
||||
static void WallyHandleIntroTrainerBallThrow(void);
|
||||
static void WallyHandleDrawPartyStatusSummary(void);
|
||||
static void WallyHandleCmd49(void);
|
||||
static void WallyHandleCmd50(void);
|
||||
static void WallyHandleEndBounceEffect(void);
|
||||
static void WallyHandleSpriteInvisibility(void);
|
||||
static void WallyHandleBattleAnimation(void);
|
||||
static void WallyHandleLinkStandbyMsg(void);
|
||||
@ -160,7 +160,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
WallyHandleIntroTrainerBallThrow,
|
||||
WallyHandleDrawPartyStatusSummary,
|
||||
WallyHandleCmd49,
|
||||
WallyHandleCmd50,
|
||||
WallyHandleEndBounceEffect,
|
||||
WallyHandleSpriteInvisibility,
|
||||
WallyHandleBattleAnimation,
|
||||
WallyHandleLinkStandbyMsg,
|
||||
@ -1522,7 +1522,7 @@ static void WallyHandleCmd49(void)
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void WallyHandleCmd50(void)
|
||||
static void WallyHandleEndBounceEffect(void)
|
||||
{
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
|
@ -1463,12 +1463,12 @@ void BtlController_EmitCmd49(u8 bufferId)
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
void BtlController_EmitCmd50(u8 bufferId)
|
||||
void BtlController_EmitEndBounceEffect(u8 bufferId)
|
||||
{
|
||||
sBattleBuffersTransferData[0] = CONTROLLER_50;
|
||||
sBattleBuffersTransferData[1] = CONTROLLER_50;
|
||||
sBattleBuffersTransferData[2] = CONTROLLER_50;
|
||||
sBattleBuffersTransferData[3] = CONTROLLER_50;
|
||||
sBattleBuffersTransferData[0] = CONTROLLER_ENDBOUNCE;
|
||||
sBattleBuffersTransferData[1] = CONTROLLER_ENDBOUNCE;
|
||||
sBattleBuffersTransferData[2] = CONTROLLER_ENDBOUNCE;
|
||||
sBattleBuffersTransferData[3] = CONTROLLER_ENDBOUNCE;
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
|
@ -1483,12 +1483,18 @@ void SwapHpBarsWithHpText(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define tBattler data[0]
|
||||
#define tSummaryBarSpriteId data[1]
|
||||
#define tBallIconSpriteId(n) data[3 + n]
|
||||
#define tIsBattleStart data[10]
|
||||
#define tData15 data[15]
|
||||
|
||||
u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart)
|
||||
{
|
||||
bool8 isOpponent;
|
||||
s16 bar_X, bar_Y, bar_pos2_X, bar_data0;
|
||||
s32 i, j, var;
|
||||
u8 barSpriteId;
|
||||
u8 summaryBarSpriteId;
|
||||
u8 ballIconSpritesIds[PARTY_SIZE];
|
||||
u8 taskId;
|
||||
|
||||
@ -1527,19 +1533,19 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
|
||||
LoadSpritePalette(&sStatusSummaryBarSpritePal);
|
||||
LoadSpritePalette(&sStatusSummaryBallsSpritePal);
|
||||
|
||||
barSpriteId = CreateSprite(&sStatusSummaryBarSpriteTemplates[isOpponent], bar_X, bar_Y, 10);
|
||||
SetSubspriteTables(&gSprites[barSpriteId], sStatusSummaryBar_SubspriteTable);
|
||||
gSprites[barSpriteId].pos2.x = bar_pos2_X;
|
||||
gSprites[barSpriteId].data[0] = bar_data0;
|
||||
summaryBarSpriteId = CreateSprite(&sStatusSummaryBarSpriteTemplates[isOpponent], bar_X, bar_Y, 10);
|
||||
SetSubspriteTables(&gSprites[summaryBarSpriteId], sStatusSummaryBar_SubspriteTable);
|
||||
gSprites[summaryBarSpriteId].pos2.x = bar_pos2_X;
|
||||
gSprites[summaryBarSpriteId].data[0] = bar_data0;
|
||||
|
||||
if (isOpponent)
|
||||
{
|
||||
gSprites[barSpriteId].pos1.x -= 96;
|
||||
gSprites[barSpriteId].oam.matrixNum = 8;
|
||||
gSprites[summaryBarSpriteId].pos1.x -= 96;
|
||||
gSprites[summaryBarSpriteId].oam.matrixNum = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSprites[barSpriteId].pos1.x += 96;
|
||||
gSprites[summaryBarSpriteId].pos1.x += 96;
|
||||
}
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
@ -1555,7 +1561,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
|
||||
gSprites[ballIconSpritesIds[i]].pos2.y = 0;
|
||||
}
|
||||
|
||||
gSprites[ballIconSpritesIds[i]].data[0] = barSpriteId;
|
||||
gSprites[ballIconSpritesIds[i]].data[0] = summaryBarSpriteId;
|
||||
|
||||
if (!isOpponent)
|
||||
{
|
||||
@ -1672,13 +1678,13 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
|
||||
}
|
||||
|
||||
taskId = CreateTask(TaskDummy, 5);
|
||||
gTasks[taskId].data[0] = battlerId;
|
||||
gTasks[taskId].data[1] = barSpriteId;
|
||||
gTasks[taskId].tBattler = battlerId;
|
||||
gTasks[taskId].tSummaryBarSpriteId = summaryBarSpriteId;
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
gTasks[taskId].data[3 + i] = ballIconSpritesIds[i];
|
||||
gTasks[taskId].tBallIconSpriteId(i) = ballIconSpritesIds[i];
|
||||
|
||||
gTasks[taskId].data[10] = isBattleStart;
|
||||
gTasks[taskId].tIsBattleStart = isBattleStart;
|
||||
|
||||
if (isBattleStart)
|
||||
{
|
||||
@ -1691,46 +1697,46 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
|
||||
|
||||
void sub_8073C30(u8 taskId)
|
||||
{
|
||||
u8 sp[6];
|
||||
u8 r7;
|
||||
u8 ballIconSpriteIds[PARTY_SIZE];
|
||||
bool8 isBattleStart;
|
||||
u8 summaryBarSpriteId;
|
||||
u8 battlerId;
|
||||
s32 i;
|
||||
|
||||
r7 = gTasks[taskId].data[10];
|
||||
summaryBarSpriteId = gTasks[taskId].data[1];
|
||||
battlerId = gTasks[taskId].data[0];
|
||||
isBattleStart = gTasks[taskId].tIsBattleStart;
|
||||
summaryBarSpriteId = gTasks[taskId].tSummaryBarSpriteId;
|
||||
battlerId = gTasks[taskId].tBattler;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
sp[i] = gTasks[taskId].data[3 + i];
|
||||
ballIconSpriteIds[i] = gTasks[taskId].tBallIconSpriteId(i);
|
||||
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0x10);
|
||||
|
||||
gTasks[taskId].data[15] = 16;
|
||||
gTasks[taskId].tData15 = 16;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
gSprites[sp[i]].oam.objMode = 1;
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
gSprites[ballIconSpriteIds[i]].oam.objMode = 1;
|
||||
|
||||
gSprites[summaryBarSpriteId].oam.objMode = 1;
|
||||
|
||||
if (r7 != 0)
|
||||
if (isBattleStart)
|
||||
{
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||
{
|
||||
gSprites[sp[5 - i]].data[1] = 7 * i;
|
||||
gSprites[sp[5 - i]].data[3] = 0;
|
||||
gSprites[sp[5 - i]].data[4] = 0;
|
||||
gSprites[sp[5 - i]].callback = sub_8074158;
|
||||
gSprites[ballIconSpriteIds[5 - i]].data[1] = 7 * i;
|
||||
gSprites[ballIconSpriteIds[5 - i]].data[3] = 0;
|
||||
gSprites[ballIconSpriteIds[5 - i]].data[4] = 0;
|
||||
gSprites[ballIconSpriteIds[5 - i]].callback = sub_8074158;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSprites[sp[i]].data[1] = 7 * i;
|
||||
gSprites[sp[i]].data[3] = 0;
|
||||
gSprites[sp[i]].data[4] = 0;
|
||||
gSprites[sp[i]].callback = sub_8074158;
|
||||
gSprites[ballIconSpriteIds[i]].data[1] = 7 * i;
|
||||
gSprites[ballIconSpriteIds[i]].data[3] = 0;
|
||||
gSprites[ballIconSpriteIds[i]].data[4] = 0;
|
||||
gSprites[ballIconSpriteIds[i]].callback = sub_8074158;
|
||||
}
|
||||
}
|
||||
gSprites[summaryBarSpriteId].data[0] /= 2;
|
||||
@ -1747,12 +1753,9 @@ void sub_8073C30(u8 taskId)
|
||||
|
||||
static void sub_8073E08(u8 taskId)
|
||||
{
|
||||
u16 temp = gTasks[taskId].data[11]++;
|
||||
|
||||
if (!(temp & 1))
|
||||
if ((gTasks[taskId].data[11]++ % 2) == 0)
|
||||
{
|
||||
gTasks[taskId].data[15]--;
|
||||
if (gTasks[taskId].data[15] < 0)
|
||||
if (--gTasks[taskId].data[15] < 0)
|
||||
return;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, (gTasks[taskId].data[15]) | ((16 - gTasks[taskId].data[15]) << 8));
|
||||
@ -1763,36 +1766,35 @@ static void sub_8073E08(u8 taskId)
|
||||
|
||||
static void sub_8073E64(u8 taskId)
|
||||
{
|
||||
u8 sp[6];
|
||||
u8 ballIconSpriteIds[PARTY_SIZE];
|
||||
s32 i;
|
||||
|
||||
u8 battlerId = gTasks[taskId].data[0];
|
||||
gTasks[taskId].data[15]--;
|
||||
if (gTasks[taskId].data[15] == -1)
|
||||
u8 battlerId = gTasks[taskId].tBattler;
|
||||
if (--gTasks[taskId].tData15 == -1)
|
||||
{
|
||||
u8 summaryBarSpriteId = gTasks[taskId].data[1];
|
||||
u8 summaryBarSpriteId = gTasks[taskId].tSummaryBarSpriteId;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
sp[i] = gTasks[taskId].data[3 + i];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
ballIconSpriteIds[i] = gTasks[taskId].tBallIconSpriteId(i);
|
||||
|
||||
gBattleSpritesDataPtr->animationData->field_9_x1C--;
|
||||
if (!gBattleSpritesDataPtr->animationData->field_9_x1C)
|
||||
if (gBattleSpritesDataPtr->animationData->field_9_x1C == 0)
|
||||
{
|
||||
DestroySpriteAndFreeResources(&gSprites[summaryBarSpriteId]);
|
||||
DestroySpriteAndFreeResources(&gSprites[sp[0]]);
|
||||
DestroySpriteAndFreeResources(&gSprites[ballIconSpriteIds[0]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[summaryBarSpriteId]);
|
||||
DestroySprite(&gSprites[summaryBarSpriteId]);
|
||||
FreeSpriteOamMatrix(&gSprites[sp[0]]);
|
||||
DestroySprite(&gSprites[sp[0]]);
|
||||
FreeSpriteOamMatrix(&gSprites[ballIconSpriteIds[0]]);
|
||||
DestroySprite(&gSprites[ballIconSpriteIds[0]]);
|
||||
}
|
||||
|
||||
for (i = 1; i < 6; i++)
|
||||
DestroySprite(&gSprites[sp[i]]);
|
||||
for (i = 1; i < PARTY_SIZE; i++)
|
||||
DestroySprite(&gSprites[ballIconSpriteIds[i]]);
|
||||
}
|
||||
else if (gTasks[taskId].data[15] == -3)
|
||||
else if (gTasks[taskId].tData15 == -3)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].flag_x1 = 0;
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||
@ -1803,29 +1805,28 @@ static void sub_8073E64(u8 taskId)
|
||||
|
||||
static void sub_8073F98(u8 taskId)
|
||||
{
|
||||
u8 sp[6];
|
||||
u8 ballIconSpriteIds[PARTY_SIZE];
|
||||
s32 i;
|
||||
u8 battlerId = gTasks[taskId].tBattler;
|
||||
|
||||
u8 battlerId = gTasks[taskId].data[0];
|
||||
gTasks[taskId].data[15]--;
|
||||
if (gTasks[taskId].data[15] >= 0)
|
||||
if (--gTasks[taskId].tData15 >= 0)
|
||||
{
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, (gTasks[taskId].data[15]) | ((16 - gTasks[taskId].data[15]) << 8));
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, (gTasks[taskId].tData15) | ((16 - gTasks[taskId].tData15) << 8));
|
||||
}
|
||||
else if (gTasks[taskId].data[15] == -1)
|
||||
else if (gTasks[taskId].tData15 == -1)
|
||||
{
|
||||
u8 summaryBarSpriteId = gTasks[taskId].data[1];
|
||||
u8 summaryBarSpriteId = gTasks[taskId].tSummaryBarSpriteId;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
sp[i] = gTasks[taskId].data[3 + i];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
ballIconSpriteIds[i] = gTasks[taskId].tBallIconSpriteId(i);
|
||||
|
||||
DestroySpriteAndFreeResources(&gSprites[summaryBarSpriteId]);
|
||||
DestroySpriteAndFreeResources(&gSprites[sp[0]]);
|
||||
DestroySpriteAndFreeResources(&gSprites[ballIconSpriteIds[0]]);
|
||||
|
||||
for (i = 1; i < 6; i++)
|
||||
DestroySprite(&gSprites[sp[i]]);
|
||||
for (i = 1; i < PARTY_SIZE; i++)
|
||||
DestroySprite(&gSprites[ballIconSpriteIds[i]]);
|
||||
}
|
||||
else if (gTasks[taskId].data[15] == -3)
|
||||
else if (gTasks[taskId].tData15 == -3)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].flag_x1 = 0;
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||
@ -1834,6 +1835,12 @@ static void sub_8073F98(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
#undef tBattler
|
||||
#undef tSummaryBarSpriteId
|
||||
#undef tBallIconSpriteId
|
||||
#undef tIsBattleStart
|
||||
#undef tData15
|
||||
|
||||
static void SpriteCB_StatusSummaryBar(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->pos2.x != 0)
|
||||
@ -2253,8 +2260,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
||||
}
|
||||
}
|
||||
|
||||
#define EXPBAR_PIXELS 64
|
||||
#define HEALTHBAR_PIXELS 48
|
||||
#define B_EXPBAR_PIXELS 64
|
||||
#define B_HEALTHBAR_PIXELS 48
|
||||
|
||||
s32 MoveBattleBar(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 unused)
|
||||
{
|
||||
@ -2266,7 +2273,7 @@ s32 MoveBattleBar(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 unused)
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].oldValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].currValue,
|
||||
HEALTHBAR_PIXELS / 8, 1);
|
||||
B_HEALTHBAR_PIXELS / 8, 1);
|
||||
}
|
||||
else // exp bar
|
||||
{
|
||||
@ -2281,7 +2288,7 @@ s32 MoveBattleBar(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 unused)
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].oldValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].currValue,
|
||||
EXPBAR_PIXELS / 8, expFraction);
|
||||
B_EXPBAR_PIXELS / 8, expFraction);
|
||||
}
|
||||
|
||||
if (whichBar == EXP_BAR || (whichBar == HEALTH_BAR && !gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars))
|
||||
@ -2307,11 +2314,11 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar)
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].oldValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].currValue,
|
||||
array, HEALTHBAR_PIXELS / 8);
|
||||
array, B_HEALTHBAR_PIXELS / 8);
|
||||
|
||||
if (filledPixelsCount > (HEALTHBAR_PIXELS * 50 / 100)) // more than 50 % hp
|
||||
if (filledPixelsCount > (B_HEALTHBAR_PIXELS * 50 / 100)) // more than 50 % hp
|
||||
barElementId = HEALTHBOX_GFX_HP_BAR_GREEN;
|
||||
else if (filledPixelsCount > (HEALTHBAR_PIXELS * 20 / 100)) // more than 20% hp
|
||||
else if (filledPixelsCount > (B_HEALTHBAR_PIXELS * 20 / 100)) // more than 20% hp
|
||||
barElementId = HEALTHBOX_GFX_HP_BAR_YELLOW;
|
||||
else
|
||||
barElementId = HEALTHBOX_GFX_HP_BAR_RED; // 20 % or less
|
||||
@ -2332,7 +2339,7 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar)
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].oldValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].currValue,
|
||||
array, EXPBAR_PIXELS / 8);
|
||||
array, B_EXPBAR_PIXELS / 8);
|
||||
level = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_LEVEL);
|
||||
if (level == MAX_MON_LEVEL)
|
||||
{
|
||||
@ -2360,7 +2367,7 @@ static s32 CalcNewBarValue(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *c
|
||||
if (*currValue == -32768) // first function call
|
||||
{
|
||||
if (maxValue < scale)
|
||||
*currValue = oldValue << 8;
|
||||
*currValue = Q_24_8(oldValue);
|
||||
else
|
||||
*currValue = oldValue;
|
||||
}
|
||||
@ -2373,9 +2380,7 @@ static s32 CalcNewBarValue(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *c
|
||||
|
||||
if (maxValue < scale)
|
||||
{
|
||||
s32 var = *currValue >> 8;
|
||||
|
||||
if (newValue == var && (*currValue & 0xFF) == 0)
|
||||
if (newValue == Q_24_8_TO_INT(*currValue) && (*currValue & 0xFF) == 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@ -2386,27 +2391,28 @@ static s32 CalcNewBarValue(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *c
|
||||
|
||||
if (maxValue < scale) // handle cases of max var having less pixels than the whole bar
|
||||
{
|
||||
s32 var = (maxValue << 8) / scale;
|
||||
s32 toAdd = Q_24_8(maxValue) / scale;
|
||||
|
||||
if (receivedValue < 0) // fill bar right
|
||||
{
|
||||
*currValue += var;
|
||||
ret = *currValue >> 8;
|
||||
*currValue += toAdd;
|
||||
ret = Q_24_8_TO_INT(*currValue);
|
||||
if (ret >= newValue)
|
||||
{
|
||||
*currValue = newValue << 8;
|
||||
*currValue = Q_24_8(newValue);
|
||||
ret = newValue;
|
||||
}
|
||||
}
|
||||
else // move bar left
|
||||
{
|
||||
*currValue -= var;
|
||||
ret = *currValue >> 8;
|
||||
*currValue -= toAdd;
|
||||
ret = Q_24_8_TO_INT(*currValue);
|
||||
// try round up
|
||||
if ((*currValue & 0xFF) > 0)
|
||||
ret++;
|
||||
if (ret <= newValue)
|
||||
{
|
||||
*currValue = newValue << 8;
|
||||
*currValue = Q_24_8(newValue);
|
||||
ret = newValue;
|
||||
}
|
||||
}
|
||||
@ -2480,34 +2486,35 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32
|
||||
return filledPixels;
|
||||
}
|
||||
|
||||
static s16 sub_8074F28(struct TestingBar *barInfo, s32 *arg1, u16 *arg2, s32 arg3)
|
||||
// These two functions seem as if they were made for testing the health bar.
|
||||
static s16 sub_8074F28(struct TestingBar *barInfo, s32 *currValue, u16 *arg2, s32 arg3)
|
||||
{
|
||||
s16 ret, var;
|
||||
|
||||
ret = CalcNewBarValue(barInfo->maxValue,
|
||||
barInfo->oldValue,
|
||||
barInfo->receivedValue,
|
||||
arg1, 6, 1);
|
||||
sub_8074F88(barInfo, arg1, arg2);
|
||||
currValue, B_HEALTHBAR_PIXELS / 8, 1);
|
||||
sub_8074F88(barInfo, currValue, arg2);
|
||||
|
||||
if (barInfo->maxValue < HEALTHBAR_PIXELS)
|
||||
var = *arg1 >> 8;
|
||||
if (barInfo->maxValue < B_HEALTHBAR_PIXELS)
|
||||
var = *currValue >> 8;
|
||||
else
|
||||
var = *arg1;
|
||||
var = *currValue;
|
||||
|
||||
DummiedOutFunction(barInfo->maxValue, var, arg3);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2)
|
||||
static void sub_8074F88(struct TestingBar *barInfo, s32 *currValue, u16 *arg2)
|
||||
{
|
||||
u8 sp8[6];
|
||||
u16 sp10[6];
|
||||
u8 i;
|
||||
|
||||
CalcBarFilledPixels(barInfo->maxValue, barInfo->oldValue,
|
||||
barInfo->receivedValue, arg1, sp8, 6);
|
||||
barInfo->receivedValue, currValue, sp8, B_HEALTHBAR_PIXELS / 8);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
sp10[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + sp8[i]);
|
||||
@ -2547,7 +2554,7 @@ u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale)
|
||||
|
||||
u8 GetHPBarLevel(s16 hp, s16 maxhp)
|
||||
{
|
||||
s32 result;
|
||||
u8 result;
|
||||
|
||||
if (hp == maxhp)
|
||||
{
|
||||
@ -2555,10 +2562,10 @@ u8 GetHPBarLevel(s16 hp, s16 maxhp)
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 fraction = GetScaledHPFraction(hp, maxhp, 48);
|
||||
if (fraction > 24)
|
||||
u8 fraction = GetScaledHPFraction(hp, maxhp, B_HEALTHBAR_PIXELS);
|
||||
if (fraction > (B_HEALTHBAR_PIXELS * 50 / 100)) // more than 50 % hp
|
||||
result = HP_BAR_GREEN;
|
||||
else if (fraction > 9)
|
||||
else if (fraction > (B_HEALTHBAR_PIXELS * 20 / 100)) // more than 20% hp
|
||||
result = HP_BAR_YELLOW;
|
||||
else if (fraction > 0)
|
||||
result = HP_BAR_RED;
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "pokedex.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "evolution_scene.h"
|
||||
#include "roamer.h"
|
||||
#include "tv.h"
|
||||
@ -137,13 +138,13 @@ static void sub_803980C(struct Sprite *sprite);
|
||||
static void sub_8039838(struct Sprite *sprite);
|
||||
static void sub_8039894(struct Sprite *sprite);
|
||||
static void sub_80398D0(struct Sprite *sprite);
|
||||
static void sub_8039A48(struct Sprite *sprite);
|
||||
static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite);
|
||||
static void sub_8039AF4(struct Sprite *sprite);
|
||||
static void SpriteCallbackDummy_3(struct Sprite *sprite);
|
||||
static void oac_poke_ally_(struct Sprite *sprite);
|
||||
static void SpecialStatusesClear(void);
|
||||
static void TurnValuesCleanUp(bool8 var0);
|
||||
static void SpriteCB_HealthBoxBounce(struct Sprite *sprite);
|
||||
static void SpriteCB_BounceEffect(struct Sprite *sprite);
|
||||
static void BattleStartClearSetData(void);
|
||||
static void BattleIntroGetMonsData(void);
|
||||
static void BattleIntroPrepareBackgroundSlide(void);
|
||||
@ -183,7 +184,7 @@ static void HandleAction_SafariZoneBallThrow(void);
|
||||
static void HandleAction_ThrowPokeblock(void);
|
||||
static void HandleAction_GoNear(void);
|
||||
static void HandleAction_SafriZoneRun(void);
|
||||
static void HandleAction_Action9(void);
|
||||
static void HandleAction_WallyBallThrow(void);
|
||||
static void HandleAction_Action11(void);
|
||||
static void HandleAction_NothingIsFainted(void);
|
||||
static void HandleAction_ActionFinished(void);
|
||||
@ -515,7 +516,7 @@ static void (* const sTurnActionsFuncsTable[])(void) =
|
||||
HandleAction_ThrowPokeblock, // B_ACTION_SAFARI_POKEBLOCK
|
||||
HandleAction_GoNear, // B_ACTION_SAFARI_GO_NEAR
|
||||
HandleAction_SafriZoneRun, // B_ACTION_SAFARI_RUN
|
||||
HandleAction_Action9, // B_ACTION_UNKNOWN9
|
||||
HandleAction_WallyBallThrow, // B_ACTION_WALLY_THROW
|
||||
HandleAction_RunBattleScript, // B_ACTION_EXEC_SCRIPT
|
||||
HandleAction_Action11, // not sure about this one
|
||||
HandleAction_ActionFinished, // B_ACTION_FINISHED
|
||||
@ -532,7 +533,7 @@ static void (* const sEndTurnFuncsTable[])(void) =
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_PLAYER_TELEPORTED
|
||||
HandleEndTurn_MonFled, // B_OUTCOME_MON_FLED
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_CAUGHT
|
||||
HandleEndTurn_FinishBattle, // battle outcome 8
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_NO_SAFARI_BALLS
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_FORFEITED
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_MON_TELEPORTED
|
||||
};
|
||||
@ -678,7 +679,7 @@ static void CB2_InitBattleInternal(void)
|
||||
gMain.inBattle = TRUE;
|
||||
gSaveBlock2Ptr->field_CA9_b = 0;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
AdjustFriendship(&gPlayerParty[i], 3);
|
||||
|
||||
gBattleCommunication[MULTIUSE_STATE] = 0;
|
||||
@ -739,7 +740,7 @@ static void SetPlayerBerryDataInBattleStruct(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
const struct Berry* berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY));
|
||||
const struct Berry *berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY));
|
||||
|
||||
for (i = 0; i < BERRY_NAME_COUNT - 1; i++)
|
||||
battleBerry->name[i] = berryData->name[i];
|
||||
@ -783,7 +784,7 @@ static void SetAllPlayersBerryData(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
const struct Berry* berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY));
|
||||
const struct Berry *berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY));
|
||||
|
||||
for (i = 0; i < BERRY_NAME_COUNT - 1; i++)
|
||||
{
|
||||
@ -809,7 +810,7 @@ static void SetAllPlayersBerryData(void)
|
||||
{
|
||||
s32 numPlayers;
|
||||
struct BattleEnigmaBerry *src;
|
||||
u8 r4;
|
||||
u8 battlerId;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
{
|
||||
@ -821,17 +822,17 @@ static void SetAllPlayersBerryData(void)
|
||||
for (i = 0; i < numPlayers; i++)
|
||||
{
|
||||
src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2);
|
||||
r4 = gLinkPlayers[i].lp_field_18;
|
||||
battlerId = gLinkPlayers[i].lp_field_18;
|
||||
|
||||
for (j = 0; j < BERRY_NAME_COUNT - 1; j++)
|
||||
gEnigmaBerries[r4].name[j] = src->name[j];
|
||||
gEnigmaBerries[r4].name[j] = EOS;
|
||||
gEnigmaBerries[battlerId].name[j] = src->name[j];
|
||||
gEnigmaBerries[battlerId].name[j] = EOS;
|
||||
|
||||
for (j = 0; j < BERRY_ITEM_EFFECT_COUNT; j++)
|
||||
gEnigmaBerries[r4].itemEffect[j] = src->itemEffect[j];
|
||||
gEnigmaBerries[battlerId].itemEffect[j] = src->itemEffect[j];
|
||||
|
||||
gEnigmaBerries[r4].holdEffect = src->holdEffect;
|
||||
gEnigmaBerries[r4].holdEffectParam = src->holdEffectParam;
|
||||
gEnigmaBerries[battlerId].holdEffect = src->holdEffect;
|
||||
gEnigmaBerries[battlerId].holdEffectParam = src->holdEffectParam;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1382,7 +1383,7 @@ static void CB2_PreInitMultiBattle(void)
|
||||
u8 playerMultiplierId;
|
||||
s32 numPlayers = 4;
|
||||
u8 r4 = 0xF;
|
||||
u32* savedBattleTypeFlags;
|
||||
u32 *savedBattleTypeFlags;
|
||||
void (**savedCallback)(void);
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
|
||||
@ -1476,7 +1477,7 @@ static void CB2_PreInitMultiBattle(void)
|
||||
|
||||
static void CB2_PreInitIngamePlayerPartnerBattle(void)
|
||||
{
|
||||
u32* savedBattleTypeFlags;
|
||||
u32 *savedBattleTypeFlags;
|
||||
void (**savedCallback)(void);
|
||||
|
||||
savedCallback = &gBattleStruct->savedCallback;
|
||||
@ -1819,7 +1820,7 @@ void BattleMainCB2(void)
|
||||
{
|
||||
gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED;
|
||||
ResetPaletteFadeControl();
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, RGB_BLACK);
|
||||
SetMainCallback2(CB2_QuitRecordedBattle);
|
||||
}
|
||||
}
|
||||
@ -2026,7 +2027,7 @@ void sub_8038A04(void) // unused
|
||||
|
||||
void VBlankCB_Battle(void)
|
||||
{
|
||||
// change gRngSeed every vblank unless the battle could be recorded
|
||||
// Change gRngSeed every vblank unless the battle could be recorded.
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_RECORDED)))
|
||||
Random();
|
||||
|
||||
@ -2192,7 +2193,7 @@ void sub_8038D64(void)
|
||||
}
|
||||
for (i = 80; i < 160; i++)
|
||||
{
|
||||
asm(""::"r"(i)); // Needed to stop the compiler from optimizing out the loop counter
|
||||
asm(""::"r"(i)); // Needed to stop the compiler from optimizing out the loop counter.
|
||||
gScanlineEffectRegBuffers[0][i] = 0xFF10;
|
||||
gScanlineEffectRegBuffers[1][i] = 0xFF10;
|
||||
}
|
||||
@ -2255,7 +2256,7 @@ static void sub_8038F34(void)
|
||||
case 1:
|
||||
if (--gBattleCommunication[1] == 0)
|
||||
{
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, RGB_BLACK);
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
}
|
||||
break;
|
||||
@ -2312,7 +2313,7 @@ static void sub_8038F34(void)
|
||||
for (i = 0; i < 2; i++)
|
||||
LoadChosenBattleElement(i);
|
||||
|
||||
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
|
||||
BeginNormalPaletteFade(-1, 0, 0x10, 0, RGB_BLACK);
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
break;
|
||||
case 4:
|
||||
@ -2417,7 +2418,7 @@ static void sub_80392A8(void)
|
||||
gReservedSpritePaletteCount = 4;
|
||||
SetVBlankCallback(VBlankCB_Battle);
|
||||
SetMainCallback2(sub_803937C);
|
||||
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
|
||||
BeginNormalPaletteFade(-1, 0, 0x10, 0, RGB_BLACK);
|
||||
gBattleCommunication[MULTIUSE_STATE] = 0;
|
||||
}
|
||||
|
||||
@ -2577,7 +2578,7 @@ static void sub_803939C(void)
|
||||
{
|
||||
if (sub_800A520() == TRUE)
|
||||
{
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, RGB_BLACK);
|
||||
gBattleCommunication[1] = 0x20;
|
||||
gBattleCommunication[MULTIUSE_STATE] = 8;
|
||||
}
|
||||
@ -2585,7 +2586,7 @@ static void sub_803939C(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, RGB_BLACK);
|
||||
gBattleCommunication[1] = 0x20;
|
||||
gBattleCommunication[MULTIUSE_STATE] = 8;
|
||||
}
|
||||
@ -2620,7 +2621,7 @@ void oac_poke_opponent(struct Sprite *sprite)
|
||||
{
|
||||
sprite->callback = sub_803980C;
|
||||
StartSpriteAnimIfDifferent(sprite, 0);
|
||||
BeginNormalPaletteFade(0x20000, 0, 10, 10, 0x2108);
|
||||
BeginNormalPaletteFade(0x20000, 0, 10, 10, RGB(8, 8, 8));
|
||||
}
|
||||
|
||||
static void sub_803980C(struct Sprite *sprite)
|
||||
@ -2643,7 +2644,7 @@ static void sub_8039838(struct Sprite *sprite)
|
||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[sprite->sBattler]);
|
||||
sprite->callback = sub_8039894;
|
||||
StartSpriteAnimIfDifferent(sprite, 0);
|
||||
BeginNormalPaletteFade(0x20000, 0, 10, 0, 0x2108);
|
||||
BeginNormalPaletteFade(0x20000, 0, 10, 0, RGB(8, 8, 8));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2687,7 +2688,7 @@ static void sub_80398D0(struct Sprite *sprite)
|
||||
extern const struct MonCoords gMonFrontPicCoords[];
|
||||
extern const struct MonCoords gCastformFrontSpriteCoords[];
|
||||
|
||||
void sub_8039934(struct Sprite *sprite)
|
||||
void SpriteCB_FaintOpponentMon(struct Sprite *sprite)
|
||||
{
|
||||
u8 battler = sprite->sBattler;
|
||||
u16 species;
|
||||
@ -2698,7 +2699,7 @@ void sub_8039934(struct Sprite *sprite)
|
||||
else
|
||||
species = sprite->sSpeciesId;
|
||||
|
||||
GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); // Unused return value
|
||||
GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); // Unused return value.
|
||||
|
||||
if (species == SPECIES_UNOWN)
|
||||
{
|
||||
@ -2707,9 +2708,9 @@ void sub_8039934(struct Sprite *sprite)
|
||||
u16 unownSpecies;
|
||||
|
||||
if (unownForm == 0)
|
||||
unownSpecies = SPECIES_UNOWN; // Use the A Unown form
|
||||
unownSpecies = SPECIES_UNOWN; // Use the A Unown form.
|
||||
else
|
||||
unownSpecies = NUM_SPECIES + unownForm; // Use one of the other Unown letters
|
||||
unownSpecies = NUM_SPECIES + unownForm; // Use one of the other Unown letters.
|
||||
|
||||
yOffset = gMonFrontPicCoords[unownSpecies].y_offset;
|
||||
}
|
||||
@ -2728,25 +2729,23 @@ void sub_8039934(struct Sprite *sprite)
|
||||
|
||||
sprite->data[3] = 8 - yOffset / 8;
|
||||
sprite->data[4] = 1;
|
||||
sprite->callback = sub_8039A48;
|
||||
sprite->callback = SpriteCB_AnimFaintOpponent;
|
||||
}
|
||||
|
||||
static void sub_8039A48(struct Sprite *sprite)
|
||||
static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
sprite->data[4]--;
|
||||
if (sprite->data[4] == 0)
|
||||
if (--sprite->data[4] == 0)
|
||||
{
|
||||
sprite->data[4] = 2;
|
||||
sprite->pos2.y += 8;
|
||||
sprite->data[3]--;
|
||||
if (sprite->data[3] < 0)
|
||||
sprite->pos2.y += 8; // Move the sprite down.
|
||||
if (--sprite->data[3] < 0)
|
||||
{
|
||||
FreeSpriteOamMatrix(sprite);
|
||||
DestroySprite(sprite);
|
||||
}
|
||||
else
|
||||
else // Erase bottom part of the sprite to create a smooth illusion of mon falling down.
|
||||
{
|
||||
u8 *dst = (u8 *)gMonSpritesGfxPtr->sprites[GetBattlerPosition(sprite->sBattler)] + (gBattleMonForms[sprite->sBattler] << 11) + (sprite->data[3] << 8);
|
||||
|
||||
@ -2831,85 +2830,100 @@ void sub_8039C00(struct Sprite *sprite)
|
||||
}
|
||||
}
|
||||
|
||||
void dp11b_obj_instanciate(u8 battler, u8 b, s8 c, s8 d)
|
||||
#define sSinIndex data[0]
|
||||
#define sDelta data[1]
|
||||
#define sAmplitude data[2]
|
||||
#define sBouncerSpriteId data[3]
|
||||
#define sWhich data[4]
|
||||
|
||||
void DoBounceEffect(u8 battler, u8 which, s8 delta, s8 amplitude)
|
||||
{
|
||||
u8 bounceHealthBoxSpriteId;
|
||||
u8 spriteId2;
|
||||
u8 invisibleSpriteId;
|
||||
u8 bouncerSpriteId;
|
||||
|
||||
if (b)
|
||||
switch (which)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[battler].flag_x2)
|
||||
case BOUNCE_HEALTHBOX:
|
||||
default:
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[battler].healthboxIsBouncing)
|
||||
return;
|
||||
break;
|
||||
case BOUNCE_MON:
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[battler].battlerIsBouncing)
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
invisibleSpriteId = CreateInvisibleSpriteWithCallback(SpriteCB_BounceEffect);
|
||||
if (which == BOUNCE_HEALTHBOX)
|
||||
{
|
||||
bouncerSpriteId = gHealthboxSpriteIds[battler];
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].healthboxBounceSpriteId = invisibleSpriteId;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].healthboxIsBouncing = 1;
|
||||
gSprites[invisibleSpriteId].sSinIndex = 128; // 0
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[battler].flag_x4)
|
||||
return;
|
||||
bouncerSpriteId = gBattlerSpriteIds[battler];
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].battlerBounceSpriteId = invisibleSpriteId;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].battlerIsBouncing = 1;
|
||||
gSprites[invisibleSpriteId].sSinIndex = 192; // -1
|
||||
}
|
||||
|
||||
bounceHealthBoxSpriteId = CreateInvisibleSpriteWithCallback(SpriteCB_HealthBoxBounce);
|
||||
if (b == TRUE)
|
||||
{
|
||||
spriteId2 = gHealthboxSpriteIds[battler];
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].field_2 = bounceHealthBoxSpriteId;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].flag_x2 = 1;
|
||||
gSprites[bounceHealthBoxSpriteId].data[0] = 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteId2 = gBattlerSpriteIds[battler];
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].field_3 = bounceHealthBoxSpriteId;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].flag_x4 = 1;
|
||||
gSprites[bounceHealthBoxSpriteId].data[0] = 0xC0;
|
||||
}
|
||||
gSprites[bounceHealthBoxSpriteId].data[1] = c;
|
||||
gSprites[bounceHealthBoxSpriteId].data[2] = d;
|
||||
gSprites[bounceHealthBoxSpriteId].data[3] = spriteId2;
|
||||
gSprites[bounceHealthBoxSpriteId].data[4] = b;
|
||||
gSprites[spriteId2].pos2.x = 0;
|
||||
gSprites[spriteId2].pos2.y = 0;
|
||||
gSprites[invisibleSpriteId].sDelta = delta;
|
||||
gSprites[invisibleSpriteId].sAmplitude = amplitude;
|
||||
gSprites[invisibleSpriteId].sBouncerSpriteId = bouncerSpriteId;
|
||||
gSprites[invisibleSpriteId].sWhich = which;
|
||||
gSprites[bouncerSpriteId].pos2.x = 0;
|
||||
gSprites[bouncerSpriteId].pos2.y = 0;
|
||||
}
|
||||
|
||||
void dp11b_obj_free(u8 battler, bool8 b)
|
||||
void EndBounceEffect(u8 battler, u8 which)
|
||||
{
|
||||
u8 r4;
|
||||
u8 bouncerSpriteId;
|
||||
|
||||
if (b == TRUE)
|
||||
if (which == BOUNCE_HEALTHBOX)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[battler].flag_x2)
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[battler].healthboxIsBouncing)
|
||||
return;
|
||||
|
||||
r4 = gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].field_2].data[3];
|
||||
DestroySprite(&gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].field_2]);
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].flag_x2 = 0;
|
||||
bouncerSpriteId = gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].healthboxBounceSpriteId].sBouncerSpriteId;
|
||||
DestroySprite(&gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].healthboxBounceSpriteId]);
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].healthboxIsBouncing = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[battler].flag_x4)
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[battler].battlerIsBouncing)
|
||||
return;
|
||||
|
||||
r4 = gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].field_3].data[3];
|
||||
DestroySprite(&gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].field_3]);
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].flag_x4 = 0;
|
||||
bouncerSpriteId = gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].battlerBounceSpriteId].sBouncerSpriteId;
|
||||
DestroySprite(&gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].battlerBounceSpriteId]);
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].battlerIsBouncing = 0;
|
||||
}
|
||||
gSprites[r4].pos2.x = 0;
|
||||
gSprites[r4].pos2.y = 0;
|
||||
|
||||
gSprites[bouncerSpriteId].pos2.x = 0;
|
||||
gSprites[bouncerSpriteId].pos2.y = 0;
|
||||
}
|
||||
|
||||
static void SpriteCB_HealthBoxBounce(struct Sprite *sprite)
|
||||
static void SpriteCB_BounceEffect(struct Sprite *sprite)
|
||||
{
|
||||
u8 spriteId = sprite->data[3];
|
||||
s32 var;
|
||||
u8 bouncerSpriteId = sprite->sBouncerSpriteId;
|
||||
s32 index;
|
||||
|
||||
if (sprite->data[4] == 1)
|
||||
var = sprite->data[0];
|
||||
if (sprite->sWhich == BOUNCE_HEALTHBOX)
|
||||
index = sprite->sSinIndex;
|
||||
else
|
||||
var = sprite->data[0];
|
||||
index = sprite->sSinIndex;
|
||||
|
||||
gSprites[spriteId].pos2.y = Sin(var, sprite->data[2]) + sprite->data[2];
|
||||
sprite->data[0] = (sprite->data[0] + sprite->data[1]) & 0xFF;
|
||||
gSprites[bouncerSpriteId].pos2.y = Sin(index, sprite->sAmplitude) + sprite->sAmplitude;
|
||||
sprite->sSinIndex = (sprite->sSinIndex + sprite->sDelta) & 0xFF;
|
||||
}
|
||||
|
||||
#undef sSinIndex
|
||||
#undef sDelta
|
||||
#undef sAmplitude
|
||||
#undef sBouncerSpriteId
|
||||
#undef sWhich
|
||||
|
||||
void sub_8039E44(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->affineAnimEnded)
|
||||
@ -4272,7 +4286,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
if (gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].status2 & STATUS2_MULTIPLETURNS
|
||||
|| gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].status2 & STATUS2_RECHARGE)
|
||||
{
|
||||
BtlController_EmitCmd50(0);
|
||||
BtlController_EmitEndBounceEffect(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
return;
|
||||
}
|
||||
@ -4300,7 +4314,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
{
|
||||
RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 3);
|
||||
}
|
||||
BtlController_EmitCmd50(0);
|
||||
BtlController_EmitEndBounceEffect(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
return;
|
||||
}
|
||||
@ -4439,7 +4453,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
gHitMarker |= HITMARKER_RUN;
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
break;
|
||||
case B_ACTION_UNKNOWN9:
|
||||
case B_ACTION_WALLY_THROW:
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
break;
|
||||
}
|
||||
@ -5776,7 +5790,7 @@ static void HandleAction_SafriZoneRun(void)
|
||||
gBattleOutcome = B_OUTCOME_RAN;
|
||||
}
|
||||
|
||||
static void HandleAction_Action9(void)
|
||||
static void HandleAction_WallyBallThrow(void)
|
||||
{
|
||||
gBattlerAttacker = gBattleTurnOrder[gCurrentTurnActionNumber];
|
||||
gBattle_BG0_X = 0;
|
||||
|
@ -38,7 +38,7 @@ struct HallofFameMon
|
||||
|
||||
struct HallofFameTeam
|
||||
{
|
||||
struct HallofFameMon mon[6];
|
||||
struct HallofFameMon mon[PARTY_SIZE];
|
||||
};
|
||||
|
||||
struct HofGfx
|
||||
|
Loading…
Reference in New Issue
Block a user