Bank to battler

This commit is contained in:
DizzyEggg 2018-09-01 18:36:08 +02:00
parent ce949ba705
commit 38c89b9d0f
8 changed files with 128 additions and 128 deletions

View File

@ -27,86 +27,86 @@
.byte \param0 .byte \param0
.endm .endm
.macro if_hp_less_than bank, param1, param2 .macro if_hp_less_than battler, param1, param2
.byte 0x5 .byte 0x5
.byte \bank .byte \battler
.byte \param1 .byte \param1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_hp_more_than bank, param1, param2 .macro if_hp_more_than battler, param1, param2
.byte 0x6 .byte 0x6
.byte \bank .byte \battler
.byte \param1 .byte \param1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_hp_equal bank, param1, param2 .macro if_hp_equal battler, param1, param2
.byte 0x7 .byte 0x7
.byte \bank .byte \battler
.byte \param1 .byte \param1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_hp_not_equal bank, param1, param2 .macro if_hp_not_equal battler, param1, param2
.byte 0x8 .byte 0x8
.byte \bank .byte \battler
.byte \param1 .byte \param1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_status bank, status1, param2 .macro if_status battler, status1, param2
.byte 0x9 .byte 0x9
.byte \bank .byte \battler
.4byte \status1 .4byte \status1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_not_status bank, status1, param2 .macro if_not_status battler, status1, param2
.byte 0xa .byte 0xa
.byte \bank .byte \battler
.4byte \status1 .4byte \status1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_status2 bank, status2, param2 .macro if_status2 battler, status2, param2
.byte 0xb .byte 0xb
.byte \bank .byte \battler
.4byte \status2 .4byte \status2
.4byte \param2 .4byte \param2
.endm .endm
.macro if_not_status2 bank, status2, param2 .macro if_not_status2 battler, status2, param2
.byte 0xc .byte 0xc
.byte \bank .byte \battler
.4byte \status2 .4byte \status2
.4byte \param2 .4byte \param2
.endm .endm
.macro if_status3 bank, status3, param2 .macro if_status3 battler, status3, param2
.byte 0xd .byte 0xd
.byte \bank .byte \battler
.4byte \status3 .4byte \status3
.4byte \param2 .4byte \param2
.endm .endm
.macro if_not_status3 bank, status3, param2 .macro if_not_status3 battler, status3, param2
.byte 0xe .byte 0xe
.byte \bank .byte \battler
.4byte \status3 .4byte \status3
.4byte \param2 .4byte \param2
.endm .endm
.macro if_side_affecting bank, sidestatus, param2 .macro if_side_affecting battler, sidestatus, param2
.byte 0xf .byte 0xf
.byte \bank .byte \battler
.4byte \sidestatus .4byte \sidestatus
.4byte \param2 .4byte \param2
.endm .endm
.macro if_not_side_affecting bank, sidestatus, param2 .macro if_not_side_affecting battler, sidestatus, param2
.byte 0x10 .byte 0x10
.byte \bank .byte \battler
.4byte \sidestatus .4byte \sidestatus
.4byte \param2 .4byte \param2
.endm .endm
@ -222,9 +222,9 @@
.byte 0x24 .byte 0x24
.endm .endm
.macro get_last_used_bank_move bank .macro get_last_used_bank_move battler
.byte 0x25 .byte 0x25
.byte \bank .byte \battler
.endm .endm
.macro if_equal_ param0, param1 .macro if_equal_ param0, param1
@ -259,9 +259,9 @@
.byte 0x2b .byte 0x2b
.endm .endm
.macro count_usable_party_mons bank .macro count_usable_party_mons battler
.byte 0x2c .byte 0x2c
.byte \bank .byte \battler
.endm .endm
.macro get_considered_move .macro get_considered_move
@ -272,9 +272,9 @@
.byte 0x2e .byte 0x2e
.endm .endm
.macro get_ability bank .macro get_ability battler
.byte 0x2f .byte 0x2f
.byte \bank .byte \battler
.endm .endm
.macro get_highest_type_effectiveness .macro get_highest_type_effectiveness
@ -295,16 +295,16 @@
.byte 0x33 .byte 0x33
.endm .endm
.macro if_status_in_party bank, status1, param2 .macro if_status_in_party battler, status1, param2
.byte 0x34 .byte 0x34
.byte \bank .byte \battler
.4byte \status1 .4byte \status1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_status_not_in_party bank, status1, param2 .macro if_status_not_in_party battler, status1, param2
.byte 0x35 .byte 0x35
.byte \bank .byte \battler
.4byte \status1 .4byte \status1
.4byte \param2 .4byte \param2
.endm .endm
@ -325,33 +325,33 @@
.4byte \param1 .4byte \param1
.endm .endm
.macro if_stat_level_less_than bank, stat, param2, param3 .macro if_stat_level_less_than battler, stat, param2, param3
.byte 0x39 .byte 0x39
.byte \bank .byte \battler
.byte \stat .byte \stat
.byte \param2 .byte \param2
.4byte \param3 .4byte \param3
.endm .endm
.macro if_stat_level_more_than bank, stat, param2, param3 .macro if_stat_level_more_than battler, stat, param2, param3
.byte 0x3a .byte 0x3a
.byte \bank .byte \battler
.byte \stat .byte \stat
.byte \param2 .byte \param2
.4byte \param3 .4byte \param3
.endm .endm
.macro if_stat_level_equal bank, stat, param2, param3 .macro if_stat_level_equal battler, stat, param2, param3
.byte 0x3b .byte 0x3b
.byte \bank .byte \battler
.byte \stat .byte \stat
.byte \param2 .byte \param2
.4byte \param3 .4byte \param3
.endm .endm
.macro if_stat_level_not_equal bank, stat, param2, param3 .macro if_stat_level_not_equal battler, stat, param2, param3
.byte 0x3c .byte 0x3c
.byte \bank .byte \battler
.byte \stat .byte \stat
.byte \param2 .byte \param2
.4byte \param3 .4byte \param3
@ -367,37 +367,37 @@
.4byte \param0 .4byte \param0
.endm .endm
.macro if_has_move bank, param1, param2 .macro if_has_move battler, param1, param2
.byte 0x3f .byte 0x3f
.byte \bank .byte \battler
.2byte \param1 .2byte \param1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_doesnt_have_move bank, param1, param2 .macro if_doesnt_have_move battler, param1, param2
.byte 0x40 .byte 0x40
.byte \bank .byte \battler
.2byte \param1 .2byte \param1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_has_move_with_effect bank, param1, param2 .macro if_has_move_with_effect battler, param1, param2
.byte 0x41 .byte 0x41
.byte \bank .byte \battler
.byte \param1 .byte \param1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_doesnt_have_move_with_effect bank, param1, param2 .macro if_doesnt_have_move_with_effect battler, param1, param2
.byte 0x42 .byte 0x42
.byte \bank .byte \battler
.byte \param1 .byte \param1
.4byte \param2 .4byte \param2
.endm .endm
.macro if_any_move_disabled_or_encored bank, param1, param2 .macro if_any_move_disabled_or_encored battler, param1, param2
.byte 0x43 .byte 0x43
.byte \bank .byte \battler
.byte \param1 .byte \param1
.4byte \param2 .4byte \param2
.endm .endm
@ -421,33 +421,33 @@
.byte 0x47 .byte 0x47
.endm .endm
.macro get_hold_effect bank .macro get_hold_effect battler
.byte 0x48 .byte 0x48
.byte \bank .byte \battler
.endm .endm
.macro get_gender bank .macro get_gender battler
.byte 0x49 .byte 0x49
.byte \bank .byte \battler
.endm .endm
.macro is_first_turn_for bank .macro is_first_turn_for battler
.byte 0x4a .byte 0x4a
.byte \bank .byte \battler
.endm .endm
.macro get_stockpile_count bank .macro get_stockpile_count battler
.byte 0x4b .byte 0x4b
.byte \bank .byte \battler
.endm .endm
.macro is_double_battle .macro is_double_battle
.byte 0x4c .byte 0x4c
.endm .endm
.macro get_used_held_item bank .macro get_used_held_item battler
.byte 0x4d .byte 0x4d
.byte \bank .byte \battler
.endm .endm
.macro get_move_type_from_result .macro get_move_type_from_result
@ -462,9 +462,9 @@
.byte 0x50 .byte 0x50
.endm .endm
.macro get_protect_count bank .macro get_protect_count battler
.byte 0x51 .byte 0x51
.byte \bank .byte \battler
.endm .endm
.macro nullsub_52 .macro nullsub_52
@ -526,27 +526,27 @@
.4byte \param0 .4byte \param0
.endm .endm
.macro is_of_type bank, type .macro is_of_type battler, type
.byte 0x5f .byte 0x5f
.byte \bank .byte \battler
.byte \type .byte \type
.endm .endm
.macro check_ability bank, ability .macro check_ability battler, ability
.byte 0x60 .byte 0x60
.byte \bank .byte \battler
.byte \ability .byte \ability
.endm .endm
.macro if_flash_fired bank, param1 .macro if_flash_fired battler, param1
.byte 0x61 .byte 0x61
.byte \bank .byte \battler
.4byte \param1 .4byte \param1
.endm .endm
.macro if_holds_item bank, param1, param2 .macro if_holds_item battler, param1, param2
.byte 0x62 .byte 0x62
.byte \bank .byte \battler
.2byte \param1 .2byte \param1
.4byte \param2 .4byte \param2
.endm .endm
@ -572,23 +572,23 @@
get_type AI_TYPE2_TARGET get_type AI_TYPE2_TARGET
.endm .endm
.macro if_ability bank, ability, ptr .macro if_ability battler, ability, ptr
check_ability \bank, \ability check_ability \battler, \ability
if_equal 1, \ptr if_equal 1, \ptr
.endm .endm
.macro if_no_ability bank, ability, ptr .macro if_no_ability battler, ability, ptr
check_ability \bank, \ability check_ability \battler, \ability
if_equal 0, \ptr if_equal 0, \ptr
.endm .endm
.macro if_type bank, type, ptr .macro if_type battler, type, ptr
is_of_type \bank, \type is_of_type \battler, \type
if_equal 1, \ptr if_equal 1, \ptr
.endm .endm
.macro if_no_type bank, type, ptr .macro if_no_type battler, type, ptr
is_of_type \bank, \type is_of_type \battler, \type
if_equal 0, \ptr if_equal 0, \ptr
.endm .endm
@ -610,10 +610,10 @@
if_equal 0, \ptr if_equal 0, \ptr
.endm .endm
.macro if_any_move_disabled bank, ptr .macro if_any_move_disabled battler, ptr
if_any_move_disabled_or_encored \bank, 0, \ptr if_any_move_disabled_or_encored \battler, 0, \ptr
.endm .endm
.macro if_any_move_encored bank, ptr .macro if_any_move_encored battler, ptr
if_any_move_disabled_or_encored \bank, 1, \ptr if_any_move_disabled_or_encored \battler, 1, \ptr
.endm .endm

View File

@ -56,14 +56,14 @@
.2byte \param0 .2byte \param0
.endm .endm
.macro monbg bank .macro monbg battler
.byte 0xa .byte 0xa
.byte \bank .byte \battler
.endm .endm
.macro clearmonbg bank .macro clearmonbg battler
.byte 0xb .byte 0xb
.byte \bank .byte \battler
.endm .endm
.macro setalpha param0 .macro setalpha param0
@ -189,14 +189,14 @@
.4byte \param2 .4byte \param2
.endm .endm
.macro monbg_22 bank .macro monbg_22 battler
.byte 0x22 .byte 0x22
.byte \bank .byte \battler
.endm .endm
.macro clearmonbg_23 bank .macro clearmonbg_23 battler
.byte 0x23 .byte 0x23
.byte \bank .byte \battler
.endm .endm
.macro jumpifcontest param0 .macro jumpifcontest param0
@ -229,38 +229,38 @@
.byte \param4 .byte \param4
.endm .endm
.macro monbgprio_28 bank .macro monbgprio_28 battler
.byte 0x28 .byte 0x28
.byte \bank .byte \battler
.endm .endm
.macro monbgprio_29 .macro monbgprio_29
.byte 0x29 .byte 0x29
.endm .endm
.macro monbgprio_2A bank .macro monbgprio_2A battler
.byte 0x2a .byte 0x2a
.byte \bank .byte \battler
.endm .endm
.macro invisible bank .macro invisible battler
.byte 0x2b .byte 0x2b
.byte \bank .byte \battler
.endm .endm
.macro visible bank .macro visible battler
.byte 0x2c .byte 0x2c
.byte \bank .byte \battler
.endm .endm
.macro doublebattle_2D bank .macro doublebattle_2D battler
.byte 0x2d .byte 0x2d
.byte \bank .byte \battler
.endm .endm
.macro doublebattle_2E bank .macro doublebattle_2E battler
.byte 0x2e .byte 0x2e
.byte \bank .byte \battler
.endm .endm
.macro stopsound .macro stopsound

View File

@ -60,21 +60,21 @@ enum
HEALTHBOX_SAFARI_BALLS_TEXT HEALTHBOX_SAFARI_BALLS_TEXT
}; };
u8 CreateBattlerHealthboxSprites(u8 bank); u8 CreateBattlerHealthboxSprites(u8 battler);
u8 CreateSafariPlayerHealthboxSprites(void); u8 CreateSafariPlayerHealthboxSprites(void);
void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue); void SetBattleBarStruct(u8 battler, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue);
void SetHealthboxSpriteInvisible(u8 healthboxSpriteId); void SetHealthboxSpriteInvisible(u8 healthboxSpriteId);
void SetHealthboxSpriteVisible(u8 healthboxSpriteId); void SetHealthboxSpriteVisible(u8 healthboxSpriteId);
void DestoryHealthboxSprite(u8 healthboxSpriteId); void DestoryHealthboxSprite(u8 healthboxSpriteId);
void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBankOnly); void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBankOnly);
void UpdateOamPriorityInAllHealthboxes(u8 priority); void UpdateOamPriorityInAllHealthboxes(u8 priority);
void InitBattlerHealthboxCoords(u8 bank); void InitBattlerHealthboxCoords(u8 battler);
void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent); void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent);
void SwapHpBarsWithHpText(void); void SwapHpBarsWithHpText(void);
u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart); u8 CreatePartyStatusSummarySprites(u8 battler, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart);
void Task_HidePartyStatusSummary(u8 taskId); void Task_HidePartyStatusSummary(u8 taskId);
void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId); void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId);
s32 MoveBattleBar(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3); s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 arg3);
u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale); u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale);
u8 GetHPBarLevel(s16 hp, s16 maxhp); u8 GetHPBarLevel(s16 hp, s16 maxhp);

View File

@ -177,20 +177,20 @@
textVar[4] = B_BUFF_EOS; \ textVar[4] = B_BUFF_EOS; \
} }
#define PREPARE_MON_NICK_WITH_PREFIX_BUFFER(textVar, bank, partyId) \ #define PREPARE_MON_NICK_WITH_PREFIX_BUFFER(textVar, battler, partyId) \
{ \ { \
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
textVar[1] = B_BUFF_MON_NICK_WITH_PREFIX; \ textVar[1] = B_BUFF_MON_NICK_WITH_PREFIX; \
textVar[2] = bank; \ textVar[2] = battler; \
textVar[3] = partyId; \ textVar[3] = partyId; \
textVar[4] = B_BUFF_EOS; \ textVar[4] = B_BUFF_EOS; \
} }
#define PREPARE_MON_NICK_BUFFER(textVar, bank, partyId) \ #define PREPARE_MON_NICK_BUFFER(textVar, battler, partyId) \
{ \ { \
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
textVar[1] = B_BUFF_MON_NICK; \ textVar[1] = B_BUFF_MON_NICK; \
textVar[2] = bank; \ textVar[2] = battler; \
textVar[3] = partyId; \ textVar[3] = partyId; \
textVar[4] = B_BUFF_EOS; \ textVar[4] = B_BUFF_EOS; \
} }

View File

@ -3,8 +3,8 @@
void AllocateBattleResources(void); void AllocateBattleResources(void);
void FreeBattleResources(void); void FreeBattleResources(void);
void AdjustFriendshipOnBattleFaint(u8 bank); void AdjustFriendshipOnBattleFaint(u8 battler);
void sub_80571DC(u8 bank, u8 arg1); void sub_80571DC(u8 battler, u8 arg1);
u32 sub_805725C(u8 bank); u32 sub_805725C(u8 battler);
#endif // GUARD_BATTLE_UTIL_H #endif // GUARD_BATTLE_UTIL_H

View File

@ -24,10 +24,10 @@ extern const struct SpriteTemplate gBallSpriteTemplates[];
#define POKEBALL_OPPONENT_SENDOUT 0xFE #define POKEBALL_OPPONENT_SENDOUT 0xFE
u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow); u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow);
void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 bank, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species); void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battler, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species);
u8 sub_807671C(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h); u8 sub_807671C(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h);
void sub_8076918(u8 bank); void sub_8076918(u8 battler);
void DoHitAnimHealthboxEffect(u8 bank); void DoHitAnimHealthboxEffect(u8 battler);
void LoadBallGfx(u8 ballId); void LoadBallGfx(u8 ballId);
void FreeBallGfx(u8 ballId); void FreeBallGfx(u8 ballId);

View File

@ -188,7 +188,7 @@ static bool8 sub_8083380(void);
static void sub_808074C(void); static void sub_808074C(void);
static void Blender_PrintPlayerNames(void); static void Blender_PrintPlayerNames(void);
static void sub_8080588(void); static void sub_8080588(void);
static void Blender_SetBankBerryData(u8 bank, u16 itemId); static void Blender_SetParticipantBerryData(u8 participantId, u16 itemId);
static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s32 speed, s32 caseId); static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s32 speed, s32 caseId);
static void sub_8080DF8(void); static void sub_8080DF8(void);
static void sub_8082E84(void); static void sub_8082E84(void);
@ -1391,7 +1391,7 @@ static void Blender_SetOpponentsBerryData(u16 playerBerryItemId, u8 playersNum,
if (var <= 4) if (var <= 4)
opponentBerryId -= 5; opponentBerryId -= 5;
} }
Blender_SetBankBerryData(i + 1, opponentBerryId + FIRST_BERRY_INDEX); Blender_SetParticipantBerryData(i + 1, opponentBerryId + FIRST_BERRY_INDEX);
} }
} }
@ -1454,7 +1454,7 @@ static void sub_80808D4(void)
case 0: case 0:
sub_800B4C0(); sub_800B4C0();
sub_8080588(); sub_8080588();
Blender_SetBankBerryData(0, gSpecialVar_ItemId); Blender_SetParticipantBerryData(0, gSpecialVar_ItemId);
Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[0], gSpecialVar_ItemId); Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[0], gSpecialVar_ItemId);
Blender_SetOpponentsBerryData(gSpecialVar_ItemId, sBerryBlenderData->playersNo, &sBerryBlenderData->blendedBerries[0]); Blender_SetOpponentsBerryData(gSpecialVar_ItemId, sBerryBlenderData->playersNo, &sBerryBlenderData->blendedBerries[0]);
@ -2956,10 +2956,10 @@ static void sub_8082F9C(struct Sprite* sprite)
DestroySprite(sprite); DestroySprite(sprite);
} }
static void Blender_SetBankBerryData(u8 bank, u16 itemId) static void Blender_SetParticipantBerryData(u8 participantId, u16 itemId)
{ {
sBerryBlenderData->chosenItemId[bank] = itemId; sBerryBlenderData->chosenItemId[participantId] = itemId;
Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[bank], itemId); Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[participantId], itemId);
} }
static void sub_8083010(struct Sprite* sprite) static void sub_8083010(struct Sprite* sprite)

View File

@ -938,14 +938,14 @@ void StartMonSummaryAnimation(struct Sprite *sprite, u8 frontAnimId)
void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet) void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet)
{ {
u8 nature, taskId, animId, bank; u8 nature, taskId, animId, battlerId;
taskId = CreateTask(Task_HandleMonAnimation, 128); taskId = CreateTask(Task_HandleMonAnimation, 128);
gTasks[taskId].tPtrLO = (u32)(sprite) >> 0x10; gTasks[taskId].tPtrLO = (u32)(sprite) >> 0x10;
gTasks[taskId].tPtrHI = (u32)(sprite); gTasks[taskId].tPtrHI = (u32)(sprite);
bank = sprite->data[0]; battlerId = sprite->data[0];
nature = GetNature(&gPlayerParty[gBattlerPartyIndexes[bank]]); nature = GetNature(&gPlayerParty[gBattlerPartyIndexes[battlerId]]);
animId = 3 * backAnimSet + sBackAnimNatureModTable[nature]; animId = 3 * backAnimSet + sBackAnimNatureModTable[nature];
gTasks[taskId].tAnimId = sBackAnimationIds[animId]; gTasks[taskId].tAnimId = sBackAnimationIds[animId];