Merge pull request #726 from PikalaxALT/collapse_gbattlemons

Resolve symbols within gBattleMons
This commit is contained in:
huderlem
2019-03-18 18:23:23 -05:00
committed by GitHub
8 changed files with 437 additions and 2252 deletions
+13 -1
View File
@@ -21,7 +21,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
@@ -691,6 +691,18 @@ struct scriptsStack
u8 size;
};
#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
#define IS_TYPE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type))
#define SET_BATTLER_TYPE(battlerId, type) \
{ \
gBattleMons[battlerId].type1 = type; \
gBattleMons[battlerId].type2 = type; \
}
#define GET_STAT_BUFF_VALUE2(n)((n & 0xF0))
extern u8 gBattleTextBuff1[];
//function declarations of buffer emits
+39
View File
@@ -10,6 +10,43 @@
#define BS_GET_PLAYER2 13
#define BS_GET_OPPONENT2 14
#define MOVE_LIMITATION_ZEROMOVE (1 << 0)
#define MOVE_LIMITATION_PP (1 << 1)
#define MOVE_LIMITATION_DISABLED (1 << 2)
#define MOVE_LIMITATION_TORMENTED (1 << 3)
#define MOVE_LIMITATION_TAUNT (1 << 4)
#define MOVE_LIMITATION_IMPRISON (1 << 5)
#define ABILITYEFFECT_ON_SWITCHIN 0x0
#define ABILITYEFFECT_ENDTURN 0x1
#define ABILITYEFFECT_MOVES_BLOCK 0x2
#define ABILITYEFFECT_ABSORBING 0x3
#define ABILITYEFFECT_MOVE_END 0x4
#define ABILITYEFFECT_IMMUNITY 0x5
#define ABILITYEFFECT_FORECAST 0x6
#define ABILITYEFFECT_SYNCHRONIZE 0x7
#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x8
#define ABILITYEFFECT_INTIMIDATE1 0x9
#define ABILITYEFFECT_INTIMIDATE2 0xA
#define ABILITYEFFECT_TRACE 0xB
#define ABILITYEFFECT_CHECK_OTHER_SIDE 0xC
#define ABILITYEFFECT_CHECK_BATTLER_SIDE 0xD
#define ABILITYEFFECT_FIELD_SPORT 0xE
#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER 0xF
#define ABILITYEFFECT_COUNT_OTHER_SIDE 0x10
#define ABILITYEFFECT_COUNT_BATTLER_SIDE 0x11
#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0))
#define ABILITY_ON_FIELD(abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0))
#define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0))
#define ITEMEFFECT_ON_SWITCH_IN 0x0
#define ITEMEFFECT_MOVE_END 0x3
#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4
void TryClearRageStatuses(void);
void BattleScriptPush(const u8* BS_ptr);
void PressurePPLoseOnUsingImprision(u8 bankAtk);
@@ -25,5 +62,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void);
void BattleScriptExecute(const u8* BS_ptr);
void BattleScriptPushCursorAndCallback(u8* BS_ptr);
u8 IsMonDisobedient(void);
bool8 AreAllMovesUnusable(void);
u8 TrySetCantSelectMoveBattleScript(void);
#endif // GUARD_BATTLE_UTIL_H
+2 -1
View File
@@ -133,6 +133,7 @@ extern u8 gSharedMem[];
#define ewram1608B gSharedMem[0x1608B]
#define ewram1608Carr(battler) (gSharedMem[0x1608C + battler])
#define ewram16094arr(battler) (gSharedMem[0x16094 + battler])
#define EWRAM_1609D (gSharedMem[0x1609D])
#define ewram160A1 (gSharedMem[0x160A1])
#define ewram160A4 (gSharedMem[0x160A4])
@@ -160,7 +161,7 @@ extern u8 gSharedMem[];
#define USED_HELD_ITEMS(battler) (*(u16 *)&gSharedMem[0x160CC + 2 * (battler)])
#define ewram160D4(battler) (gSharedMem[0x160D4 + (battler / 2) * 2])
#define ewram160D8(battler) (gSharedMem[0x160D8 + (battler / 2)])
#define ewram160DA(battler) (gSharedMem[0x160DA + (battler / 2)])
#define ewram160DA(battler) (gSharedMem[0x160DA + (battler >> 1)])
#define ewram160DD (gSharedMem[0x160DD])
#define ewram160E0(i) (gSharedMem[0x160E0 + i])
#define ewram160E6 (gSharedMem[0x160E6])
+10
View File
@@ -17,6 +17,16 @@ enum
PARTY_MENU_TYPE_MOVE_TUTOR,
};
enum
{
PARTY_CHOOSE_MON,
PARTY_MUST_CHOOSE_MON,
PARTY_CANT_SWITCH,
PARTY_USE_ITEM_ON,
PARTY_ABILITY_PREVENTS,
PARTY_GIVE_ITEM,
};
// The party menu screen is presented differently depending on which menu layout is set.
enum
{
+355 -2214
View File
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -3714,7 +3714,7 @@ _0801EA84:\n\
ldrb r1, [r1]\n\
movs r0, 0x58\n\
muls r0, r1\n\
ldr r1, _0801EAEC @ =gUnknown_02024ACC\n\
ldr r1, _0801EAEC @ =gBattleMons+0x4C @ gBattleMons.status1\n\
adds r0, r1\n\
str r0, [sp]\n\
movs r0, 0\n\
@@ -3744,7 +3744,7 @@ _0801EADC: .4byte gBattlescriptCurrInstr\n\
_0801EAE0: .4byte gMoveEffectBS_Ptrs\n\
_0801EAE4: .4byte gBattleCommunication\n\
_0801EAE8: .4byte gActiveBattler\n\
_0801EAEC: .4byte gUnknown_02024ACC\n\
_0801EAEC: .4byte gBattleMons+0x4C @ gBattleMons.status1\n\
_0801EAF0: .4byte gHitMarker\n\
_0801EAF4: .4byte 0xffffdfff\n\
_0801EAF8:\n\
@@ -6523,7 +6523,7 @@ _0802163C:\n\
beq _080216E4\n\
movs r0, 0x1\n\
mov r10, r0\n\
ldr r0, _08021678 @ =gUnknown_02024A98\n\
ldr r0, _08021678 @ =gBattleMons+0x18 @ gBattleMons.statStages\n\
mov r9, r0\n\
lsls r5, r1, 16\n\
_0802164A:\n\
@@ -6548,7 +6548,7 @@ _0802164A:\n\
.align 2, 0\n\
_08021670: .4byte gBattlescriptCurrInstr\n\
_08021674: .4byte gActiveBattler\n\
_08021678: .4byte gUnknown_02024A98\n\
_08021678: .4byte gBattleMons+0x18 @ gBattleMons.statStages\n\
_0802167C:\n\
ldr r6, _08021700 @ =gActiveBattler\n\
ldrb r0, [r6]\n\
@@ -6636,7 +6636,7 @@ _0802171C:\n\
mov r9, r5\n\
cmp r4, 0\n\
beq _08021758\n\
ldr r6, _0802178C @ =gUnknown_02024A98\n\
ldr r6, _0802178C @ =gBattleMons+0x18 @ gBattleMons.statStages\n\
adds r5, r2, 0\n\
lsls r2, r1, 16\n\
_08021728:\n\
@@ -6694,7 +6694,7 @@ _08021772:\n\
mov r1, r9\n\
b _080217E6\n\
.align 2, 0\n\
_0802178C: .4byte gUnknown_02024A98\n\
_0802178C: .4byte gBattleMons+0x18 @ gBattleMons.statStages\n\
_08021790:\n\
cmp r3, 0\n\
beq _080217E0\n\
@@ -7644,7 +7644,7 @@ _08021E3C:\n\
ldr r2, _08021E64 @ =gDisableStructs\n\
ldr r5, _08021E68 @ =0xfeffffff\n\
adds r3, r0, 0\n\
ldr r1, _08021E6C @ =gUnknown_02024AD0\n\
ldr r1, _08021E6C @ =gBattleMons+0x50\n\
_08021E44:\n\
ldrb r0, [r2, 0xA]\n\
cmp r0, 0\n\
@@ -7664,7 +7664,7 @@ _08021E50:\n\
_08021E60: .4byte gBattlersCount\n\
_08021E64: .4byte gDisableStructs\n\
_08021E68: .4byte 0xfeffffff\n\
_08021E6C: .4byte gUnknown_02024AD0\n\
_08021E6C: .4byte gBattleMons+0x50\n\
_08021E70:\n\
ldr r1, _08021F2C @ =gHitMarker\n\
ldr r3, [r1]\n\
+8 -8
View File
@@ -27,7 +27,7 @@ extern u8 gUnknown_02023A14_50;
extern const u8* gBattlescriptCurrInstr;
extern u8 gActiveBattler;
extern u8 gBattleBufferB[4][0x200];
extern u8* gUnknown_02024C1C[4]; //battlescript location when you try to choose a move you're not allowed to
extern u8* gSelectionBattleScripts[4]; //battlescript location when you try to choose a move you're not allowed to
extern u16 gLastUsedMove[4];
extern struct BattlePokemon gBattleMons[4];
extern struct BattleEnigmaBerry gEnigmaBerries[4];
@@ -481,25 +481,25 @@ u8 TrySetCantSelectMoveBattleScript(void) //msg can't select a move
{
gBattleStruct->scriptingActive = gActiveBattler;
gCurrentMove = move;
gUnknown_02024C1C[gActiveBattler] = BattleScript_MoveSelectionDisabledMove;
gSelectionBattleScripts[gActiveBattler] = BattleScript_MoveSelectionDisabledMove;
limitations++;
}
if (move == gLastUsedMove[gActiveBattler] && move != MOVE_STRUGGLE && gBattleMons[gActiveBattler].status2 & STATUS2_TORMENT)
{
CancelMultiTurnMoves(gActiveBattler);
gUnknown_02024C1C[gActiveBattler] = BattleScript_MoveSelectionTormented;
gSelectionBattleScripts[gActiveBattler] = BattleScript_MoveSelectionTormented;
limitations++;
}
if (gDisableStructs[gActiveBattler].tauntTimer1 && gBattleMoves[move].power == 0)
{
gCurrentMove = move;
gUnknown_02024C1C[gActiveBattler] = BattleScript_MoveSelectionTaunted;
gSelectionBattleScripts[gActiveBattler] = BattleScript_MoveSelectionTaunted;
limitations++;
}
if (IsImprisoned(gActiveBattler, move))
{
gCurrentMove = move;
gUnknown_02024C1C[gActiveBattler] = BattleScript_MoveSelectionImprisoned;
gSelectionBattleScripts[gActiveBattler] = BattleScript_MoveSelectionImprisoned;
limitations++;
}
if (gBattleMons[gActiveBattler].item == ITEM_ENIGMA_BERRY)
@@ -511,12 +511,12 @@ u8 TrySetCantSelectMoveBattleScript(void) //msg can't select a move
{
gCurrentMove = *choicedMove;
gLastUsedItem = gBattleMons[gActiveBattler].item;
gUnknown_02024C1C[gActiveBattler] = BattleScript_MoveSelectionChoiceBanded;
gSelectionBattleScripts[gActiveBattler] = BattleScript_MoveSelectionChoiceBanded;
limitations++;
}
if (gBattleMons[gActiveBattler].pp[gBattleBufferB[gActiveBattler][2]] == 0)
{
gUnknown_02024C1C[gActiveBattler] = BattleScript_MoveSelectionNoPP;
gSelectionBattleScripts[gActiveBattler] = BattleScript_MoveSelectionNoPP;
limitations++;
}
return limitations;
@@ -568,7 +568,7 @@ bool8 AreAllMovesUnusable(void)
if (unusable == 0xF) //all moves are unusable
{
gProtectStructs[gActiveBattler].onlyStruggle = 1;
gUnknown_02024C1C[gActiveBattler] = BattleScript_NoMovesLeft;
gSelectionBattleScripts[gActiveBattler] = BattleScript_NoMovesLeft;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
gBattleBufferB[gActiveBattler][3] = GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) ^ 1) | (Random() & 2));
else
+2 -20
View File
@@ -86,25 +86,7 @@ gCurrentActionFuncId = .; /* 2024A7F */
. += 0x1;
gBattleMons = .; /* 2024A80 */
. += 0xC;
gUnknown_02024A8C = .; /* 2024A8C */
. += 0xC;
gUnknown_02024A98 = .; /* 2024A98 */
. += 0xC;
gUnknown_02024AA4 = .; /* 2024AA4 */
. += 0x4;
gUnknown_02024AA8 = .; /* 2024AA8 */
. += 0x24;
gUnknown_02024ACC = .; /* 2024ACC */
. += 0x4;
gUnknown_02024AD0 = .; /* 2024AD0 */
. += 0x110;
. += 0x160;
gBankSpriteIds = .; /* 2024BE0 */
. += 0x4;
@@ -169,7 +151,7 @@ gBattlescriptCurrInstr = .; /* 2024C10 */
gActionForBanks = .; /* 2024C18 */
. += 0x4;
gUnknown_02024C1C = .; /* 2024C1C */
gSelectionBattleScripts = .; /* 2024C1C */
. += 0x10;
gUnknown_02024C2C = .; /* 2024C2C */