summaryrefslogtreecommitdiff
path: root/src/battle
diff options
context:
space:
mode:
Diffstat (limited to 'src/battle')
-rw-r--r--src/battle/battle_2.c72
-rw-r--r--src/battle/battle_3.c16
-rw-r--r--src/battle/battle_4.c96
-rw-r--r--src/battle/battle_ai.c7
-rw-r--r--src/battle/battle_controller_opponent.c10
-rw-r--r--src/battle/battle_controller_player.c6
-rw-r--r--src/battle/battle_controller_wally.c56
-rw-r--r--src/battle/battle_interface.c4
-rw-r--r--src/battle/battle_message.c2
-rw-r--r--src/battle/battle_transition.c4
10 files changed, 132 insertions, 141 deletions
diff --git a/src/battle/battle_2.c b/src/battle/battle_2.c
index 26433b055..38c60dee1 100644
--- a/src/battle/battle_2.c
+++ b/src/battle/battle_2.c
@@ -522,8 +522,8 @@ void sub_800F104(void)
playerId = GetMultiplayerId();
ewram160CB = playerId;
// Seriously, Game Freak?
- pSavedCallback = (MainCallback *)(ewram + 0x160C4);
- pSavedBattleTypeFlags = (u16 *)(ewram + 0x160C2);
+ pSavedCallback = ewram160C4_Callback;
+ pSavedBattleTypeFlags = ewram160C2_Flags;
RunTasks();
AnimateSprites();
BuildOamBuffer();
@@ -1581,12 +1581,12 @@ void sub_8010874(void)
for (i = 0; i < 8; i++)
{
- ewram[i + 0x160AC] = 0;
- ewram[i + 0x160CC] = 0;
- ewram[i + 0x160E8] = 0;
- ewram[i + 0x160F0] = 0;
- ewram[i + 0x16100] = 0;
- ewram[i + 0x16108] = 0;
+ ewram160ACarr(i) = 0;
+ ewram160CCarr(i) = 0;
+ ewram160E8arr(i) = 0;
+ ewram160F0arr(i) = 0;
+ ewram16100arr(i) = 0;
+ ewram16108arr(i) = 0;
}
ewram160C8 = 6;
@@ -1665,7 +1665,7 @@ void SwitchInClearStructs(void)
{
if (gUnknown_02024AD0[i].unk0 & (gBitTable[gActiveBank] << 16))
gUnknown_02024AD0[i].unk0 &= ~(gBitTable[gActiveBank] << 16);
- if ((gUnknown_02024AD0[i].unk0 & 0xE000) && ewram[0x16020 + i] == gActiveBank)
+ if ((gUnknown_02024AD0[i].unk0 & 0xE000) && ewram16020arr(i) == gActiveBank)
gUnknown_02024AD0[i].unk0 &= ~0xE000;
}
@@ -1690,14 +1690,14 @@ void SwitchInClearStructs(void)
gUnknown_02024C2C[gActiveBank] = 0;
gUnknown_02024C5C[gActiveBank] = 0xFF;
- ewram[0x160AC + gActiveBank * 2 + 0] = 0;
- ewram[0x160AC + gActiveBank * 2 + 1] = 0;
- ewram[0x16100 + gActiveBank * 4 + 0] = 0;
- ewram[0x16100 + gActiveBank * 4 + 1] = 0;
- ewram[0x16100 + gActiveBank * 4 + 2] = 0;
- ewram[0x16100 + gActiveBank * 4 + 3] = 0;
- ewram[0x160E8 + gActiveBank * 2 + 0] = 0;
- ewram[0x160E8 + gActiveBank * 2 + 1] = 0;
+ ewram160ACarr2(0, gActiveBank) = 0;
+ ewram160ACarr2(1, gActiveBank) = 0;
+ ewram16100arr2(0, gActiveBank) = 0;
+ ewram16100arr2(1, gActiveBank) = 0;
+ ewram16100arr2(2, gActiveBank) = 0;
+ ewram16100arr2(3, gActiveBank) = 0;
+ ewram160E8arr2(0, gActiveBank) = 0;
+ ewram160E8arr2(1, gActiveBank) = 0;
ewram17100.arr[gActiveBank] = 0;
@@ -1708,7 +1708,6 @@ void UndoEffectsAfterFainting(void)
{
s32 i;
u8 *ptr;
- u32 *ptr2;
for (i = 0; i < 8; i++)
gBattleMons[gActiveBank].statStages[i] = 6;
@@ -1720,7 +1719,7 @@ void UndoEffectsAfterFainting(void)
gBattleMons[i].status2 &= ~STATUS2_ESCAPE_PREVENTION;
if (gBattleMons[i].status2 & (gBitTable[gActiveBank] << 16))
gBattleMons[i].status2 &= ~(gBitTable[gActiveBank] << 16);
- if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && ewram[0x16020 + i] == gActiveBank)
+ if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && ewram16020arr(i) == gActiveBank)
gBattleMons[i].status2 &= ~STATUS2_WRAPPED;
}
gActionSelectionCursor[gActiveBank] = 0;
@@ -1755,17 +1754,16 @@ void UndoEffectsAfterFainting(void)
gUnknown_02024C2C[gActiveBank] = 0;
gUnknown_02024C5C[gActiveBank] = 0xFF;
- ewram[0x160E8 + gActiveBank * 2 + 0] = 0;
- ewram[0x160E8 + gActiveBank * 2 + 1] = 0;
- ewram[0x160AC + gActiveBank * 2 + 0] = 0;
- ewram[0x160AC + gActiveBank * 2 + 1] = 0;
- ewram[0x16100 + gActiveBank * 4 + 0] = 0;
- ewram[0x16100 + gActiveBank * 4 + 1] = 0;
- ewram[0x16100 + gActiveBank * 4 + 2] = 0;
- ewram[0x16100 + gActiveBank * 4 + 3] = 0;
+ ewram160E8arr2(0, gActiveBank) = 0;
+ ewram160E8arr2(1, gActiveBank) = 0;
+ ewram160ACarr2(0, gActiveBank) = 0;
+ ewram160ACarr2(1, gActiveBank) = 0;
+ ewram16100arr2(0, gActiveBank) = 0;
+ ewram16100arr2(1, gActiveBank) = 0;
+ ewram16100arr2(2, gActiveBank) = 0;
+ ewram16100arr2(3, gActiveBank) = 0;
- ptr2 = (u32 *)(ewram + 0x17100);
- ptr2[gActiveBank] = 0;
+ ewram17100.arr[gActiveBank] = 0;
gBattleMons[gActiveBank].type1 = gBaseStats[gBattleMons[gActiveBank].species].type1;
gBattleMons[gActiveBank].type2 = gBaseStats[gBattleMons[gActiveBank].species].type2;
@@ -2126,7 +2124,7 @@ void BattleBeginFirstTurn(void)
;
for (i = 0; i < 4; i++)
{
- ewram[0x16068 + i] = 6;
+ ewram16068arr(i) = 6;
gActionForBanks[i] = 0xFF;
gChosenMovesByBanks[i] = 0;
}
@@ -2218,7 +2216,7 @@ void BattleTurnPassed(void)
gChosenMovesByBanks[i] = 0;
}
for (i = 0; i < 4; i++)
- ewram[0x16068 + i] = 6;
+ ewram16068arr(i) = 6;
ewram160A6 = gAbsentBankFlags;
gBattleMainFunc = sub_8012324;
gRandomTurnNumber = Random();
@@ -2292,23 +2290,23 @@ void sub_8012258(u8 a)
u8 r1;
for (i = 0; i < 3; i++)
- gUnknown_02038470[i] = ewram[0x1606C + i + a * 3];
+ gUnknown_02038470[i] = ewram1606Carr(i, a, 3);
r4 = pokemon_order_func(gBattlePartyID[a]);
- r1 = pokemon_order_func(ewram[0x16068 + a]);
+ r1 = pokemon_order_func(ewram16068arr(a));
sub_8094C98(r4, r1);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
for (i = 0; i < 3; i++)
{
- ewram[0x1606C + i + a * 3] = gUnknown_02038470[i];
- ewram[0x1606C + i + (a ^ 2) * 3] = gUnknown_02038470[i];
+ ewram1606Carr(i, a, 3) = gUnknown_02038470[i];
+ ewram1606Carr(i, (a ^ 2), 3) = gUnknown_02038470[i];
}
}
else
{
for (i = 0; i < 3; i++)
{
- ewram[0x1606C + i + a * 3] = gUnknown_02038470[i];
+ ewram1606Carr(i, a, 3) = gUnknown_02038470[i];
}
}
}
@@ -2327,7 +2325,7 @@ void sub_8012324(void)
switch (gBattleCommunication[gActiveBank])
{
case 0:
- ewram[0x016068 + gActiveBank] = 6;
+ ewram16068arr(gActiveBank) = 6;
if (!(gBattleTypeFlags & 0x40)
&& (r5 & 2)
&& !(ewram160A6 & gBitTable[GetBankByPlayerAI(r5 ^ 2)])
diff --git a/src/battle/battle_3.c b/src/battle/battle_3.c
index 3f2b8d9e5..1d6784297 100644
--- a/src/battle/battle_3.c
+++ b/src/battle/battle_3.c
@@ -721,12 +721,12 @@ u8 TurnBasedEffects(void)
gBattleMons[gActiveBank].status2 -= 0x2000;
if (gBattleMons[gActiveBank].status2 & STATUS2_WRAPPED) // damaged by wrap
{
- BATTLE_STRUCT->animArg1 = ewram[gActiveBank * 2 + 0x16004];
- BATTLE_STRUCT->animArg2 = ewram[gActiveBank * 2 + 0x16005];
+ BATTLE_STRUCT->animArg1 = ewram16004arr(0, gActiveBank);
+ BATTLE_STRUCT->animArg2 = ewram16004arr(1, gActiveBank);
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
- gBattleTextBuff1[2] = ewram[gActiveBank * 2 + 0x16004];
- gBattleTextBuff1[3] = ewram[gActiveBank * 2 + 0x16005];
+ gBattleTextBuff1[2] = ewram16004arr(0, gActiveBank);
+ gBattleTextBuff1[3] = ewram16004arr(1, gActiveBank);
gBattleTextBuff1[4] = EOS;
gBattlescriptCurrInstr = BattleScript_WrapTurnDmg;
gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 16;
@@ -737,8 +737,8 @@ u8 TurnBasedEffects(void)
{
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
- gBattleTextBuff1[2] = ewram[gActiveBank * 2 + 0x16004];
- gBattleTextBuff1[3] = ewram[gActiveBank * 2 + 0x16005];
+ gBattleTextBuff1[2] = ewram16004arr(0, gActiveBank);
+ gBattleTextBuff1[3] = ewram16004arr(1, gActiveBank);
gBattleTextBuff1[4] = EOS;
gBattlescriptCurrInstr = BattleScript_WrapEnds;
}
@@ -1377,7 +1377,7 @@ bool8 sub_8018018(u8 bank, u8 r1, u8 r2)
r2 = gBattlePartyID[r6];
for (i = 0; i < 6; i++)
{
- if (GetMonData(&party[i], MON_DATA_HP) && GetMonData(&party[i], MON_DATA_SPECIES2) && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG && i != r1 && i != r2 && i != ewram[r7 + 0x16068] && i != ewram[r6 + 0x16068])
+ if (GetMonData(&party[i], MON_DATA_HP) && GetMonData(&party[i], MON_DATA_SPECIES2) && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG && i != r1 && i != r2 && i != ewram16068arr(r7) && i != ewram16068arr(r6))
break;
}
return (i == 6);
@@ -3123,7 +3123,7 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget) //get move target
targetBank = gBankAttacker;
break;
}
- ewram[gBankAttacker + 0x16010] = targetBank;
+ ewram16010arr(gBankAttacker) = targetBank;
return targetBank;
}
diff --git a/src/battle/battle_4.c b/src/battle/battle_4.c
index 5daadd4b5..5c028d86b 100644
--- a/src/battle/battle_4.c
+++ b/src/battle/battle_4.c
@@ -2639,7 +2639,7 @@ void SetMoveEffect(bool8 primary, u8 certainArg)
{gBattlescriptCurrInstr++; return;}
gLastUsedItem = gBattleMons[gBankTarget].item;
- ewram[gBankAttacker * 2 + 0x160cc] = gLastUsedItem;
+ USED_HELD_ITEM(bank) = gLastUsedItem;
gBattleMons[gBankTarget].item = 0;
gActiveBank = gBankAttacker;
@@ -2653,8 +2653,7 @@ void SetMoveEffect(bool8 primary, u8 certainArg)
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_ItemSteal;
- ewram[gBankTarget * 2 + 0x160e8] = 0;
- //STORE_CHOICEMOVE(gBankTarget, 0);
+ CHOICED_MOVE(gBankTarget) = 0;
}
break;
case 32: //escape prevention
@@ -2729,8 +2728,7 @@ void SetMoveEffect(bool8 primary, u8 certainArg)
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_KnockedOff;
- ewram[gEffectBank * 2 + 0x160e8] = 0;
- //STORE_CHOICEMOVE(gEffectBank, 0);
+ CHOICED_MOVE(gEffectBank) = 0;
}
break;
case 59: //overheat
@@ -4998,12 +4996,12 @@ static void atk19_faint_pokemon(void)
if (!(gAbsentBankFlags & gBitTable[gActiveBank])
&& gBattleMons[gActiveBank].hp == 0)
{
- ewram[0x160AC + bank * 2 + 0] = 0;
- ewram[0x160AC + bank * 2 + 1] = 0;
- ewram[0x16100 + bank * 4 + 0] = 0;
- ewram[0x16100 + bank * 4 + 1] = 0;
- ewram[0x16100 + bank * 4 + 2] = 0;
- ewram[0x16100 + bank * 4 + 3] = 0;
+ ewram160ACarr2(0, bank) = 0;
+ ewram160ACarr2(1, bank) = 0;
+ ewram16100arr2(0, bank) = 0;
+ ewram16100arr2(1, bank) = 0;
+ ewram16100arr2(2, bank) = 0;
+ ewram16100arr2(3, bank) = 0;
gHitMarker |= HITMARKER_FAINTED(gActiveBank);
b_movescr_stack_push(gBattlescriptCurrInstr + 7);
@@ -5039,7 +5037,7 @@ static void atk19_faint_pokemon(void)
&& gBattleMons[gBankAttacker].hp != 0
&& gCurrentMove != MOVE_STRUGGLE)
{
- u8 moveIndex = ewram[0x1608C + gBankAttacker];
+ u8 moveIndex = ewram1608Carr(gBankAttacker);
gBattleMons[gBankAttacker].pp[moveIndex] = 0;
b_movescr_stack_push(gBattlescriptCurrInstr);
@@ -5122,7 +5120,7 @@ static void atk1E_jumpifability(void)
gLastUsedAbility = ability;
gBattlescriptCurrInstr = jump_loc;
RecordAbilityBattle(bank -1, gLastUsedAbility);
- ewram[0x160f8] = bank - 1;
+ ewram160F8 = bank - 1;
}
else
gBattlescriptCurrInstr += 7;
@@ -5135,7 +5133,7 @@ static void atk1E_jumpifability(void)
gLastUsedAbility = ability;
gBattlescriptCurrInstr = jump_loc;
RecordAbilityBattle(bank - 1, gLastUsedAbility);
- ewram[0x160f8] = bank - 1;
+ ewram160F8 = bank - 1;
}
else
gBattlescriptCurrInstr += 7;
@@ -5148,7 +5146,7 @@ static void atk1E_jumpifability(void)
gLastUsedAbility = ability;
gBattlescriptCurrInstr = jump_loc;
RecordAbilityBattle(bank, gLastUsedAbility);
- ewram[0x160f8] = bank;
+ ewram160F8 = bank;
}
else
gBattlescriptCurrInstr += 7;
@@ -7326,11 +7324,10 @@ static void atk43_jumpifabilitypresent(void)
static void atk44(void)
{
- ewram[gBankAttacker + 0x16060] = 1;
+ ewram16060(gBankAttacker) = 1;
}
#ifdef NONMATCHING
-
static void atk45_playanimation(void)
{
#define ANIMATION_ID T2_READ_8(gBattlescriptCurrInstr + 2)
@@ -9521,7 +9518,7 @@ static void atk4C_copy_poke_data(void)
gActiveBank = GetBattleBank(T2_READ_8(gBattlescriptCurrInstr + 1));
- gBattlePartyID[gActiveBank] = ewram[0x16068 + gActiveBank];
+ gBattlePartyID[gActiveBank] = ewram16068arr(gActiveBank);
EmitGetAttributes(0, 0, gBitTable[gBattlePartyID[gActiveBank]]);
MarkBufferBankForExecution(gActiveBank);
@@ -9671,8 +9668,7 @@ static void atk4F_jump_if_cannot_switch(void)
void sub_8022A3C(u8 unkown)
{
- //BATTLE_STRUCT->unk16064[gActiveBank] = gBattlePartyID[gActiveBank];
- ewram[gActiveBank + 0x16064] = gBattlePartyID[gActiveBank];
+ BATTLE_PARTY_ID(gActiveBank) = gBattlePartyID[gActiveBank];
EmitChoosePokemon(0, 1, unkown, 0, BATTLE_STRUCT->unk1606C[gActiveBank]);
MarkBufferBankForExecution(gActiveBank);
}
@@ -10760,7 +10756,7 @@ static void atk51_switch_handle_order(void)
for (i = 0; i < gNoOfAllBanks; i++)
{
if (gBattleBufferB[i][0] == 0x22)
- ewram[i + 0x16068] = gBattleBufferB[i][1];
+ ewram16068arr(i) = gBattleBufferB[i][1];
}
break;
case 1:
@@ -10769,17 +10765,15 @@ static void atk51_switch_handle_order(void)
break;
case 2:
gBattleCommunication[0] = gBattleBufferB[gActiveBank][1];
- ewram[gActiveBank + 0x16068] = gBattleBufferB[gActiveBank][1];
+ ewram16068arr(gActiveBank) = gBattleBufferB[gActiveBank][1];
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
-
- ewram[(gActiveBank) * 3 + (0x1606C + 0)] &= 0xF;
- ewram[(gActiveBank) * 3 + (0x1606C + 0)] |= (gBattleBufferB[gActiveBank][2] & 0xF0);
- ewram[(gActiveBank) * 3 + (0x1606C + 1)] = gBattleBufferB[gActiveBank][3];
-
- ewram[(gActiveBank ^ 2) * 3 + (0x1606C + 0)] &= (0xF0);
- ewram[(gActiveBank ^ 2) * 3 + (0x1606C + 0)] |= (gBattleBufferB[gActiveBank][2] & 0xF0) >> 4;
- ewram[(gActiveBank ^ 2) * 3 + (0x1606C + 2)] = gBattleBufferB[gActiveBank][3];
+ ewram1606Carr(0, gActiveBank, 3) &= 0xF;
+ ewram1606Carr(0, gActiveBank, 3) |= (gBattleBufferB[gActiveBank][2] & 0xF0);
+ ewram1606Carr(1, gActiveBank, 3) = gBattleBufferB[gActiveBank][3];
+ ewram1606Carr(0, (gActiveBank ^ 2), 3) &= (0xF0);
+ ewram1606Carr(0, (gActiveBank ^ 2), 3) |= (gBattleBufferB[gActiveBank][2] & 0xF0) >> 4;
+ ewram1606Carr(2, (gActiveBank ^ 2), 3) = gBattleBufferB[gActiveBank][3];
}
else
sub_8012258(gActiveBank);
@@ -12168,7 +12162,7 @@ static void atk74_hp_thresholds2(void)
{
gActiveBank = GetBattleBank(T2_READ_8(gBattlescriptCurrInstr + 1));
opposing_bank = gActiveBank ^ 1;
- hp_switchout = ewram[2 * GetBankSide(opposing_bank) + 0x160bc]; //BATTLE_STRUCT->HP_OnSwitchout[GetBankSide(opposing_bank)];
+ hp_switchout = ewram160BCarr(GetBankSide(opposing_bank)); //BATTLE_STRUCT->HP_OnSwitchout[GetBankSide(opposing_bank)];
result = (hp_switchout - gBattleMons[opposing_bank].hp) * 100 / hp_switchout;
if (gBattleMons[opposing_bank].hp >= hp_switchout)
@@ -12242,7 +12236,7 @@ static void atk76_various(void)
else
gActiveBank = 2;
- choiced_move = (u16*)(&ewram[gActiveBank * 2 + 0x160e8]);
+ choiced_move = CHOICED_MOVE(gActiveBank);
for (i = 0; i < 4; i++)
{
if (gBattleMons[gActiveBank].moves[i] == *choiced_move)
@@ -12382,11 +12376,11 @@ static void atk7B_healhalfHP_if_possible(void)
static void atk7C_8025508(void)
{
- u16 r7 = ewram[gBankAttacker * 2 + 0x160ac] | (ewram[gBankAttacker * 2 + 0x160ad] << 8);
- u16 r6 = ewram[gBankAttacker * 4 + 0x16100] | (ewram[gBankAttacker * 4 + 0x16101] << 8);
- u16 r5 = ewram[gBankAttacker * 4 + 0x16102] | (ewram[gBankAttacker * 4 + 0x16103] << 8);
+ u16 r7 = ewram160ACarr2(0, gBankAttacker) | (ewram160ACarr2(1, gBankAttacker) << 8);
+ u16 r6 = ewram16100arr2(0, gBankAttacker) | (ewram16100arr2(1, gBankAttacker) << 8);
+ u16 r5 = ewram16100arr2(2, gBankAttacker) | (ewram16100arr2(3, gBankAttacker) << 8);
- if (r7 !=0 && r7 != 0xFFFF)
+ if (r7 != 0 && r7 != 0xFFFF)
{
gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED);
gCurrentMove = r7;
@@ -13465,12 +13459,12 @@ static void atk8D_setmultihit_counter(void)
static void atk8E_prepare_multihit(void)
{
- ewram[0x160e0] = 0xFD;
- ewram[0x160e1] = 1;
- ewram[0x160e2] = 1;
- ewram[0x160e3] = 1;
- ewram[0x160e4] = 0;
- ewram[0x160e5] = 0xFF;
+ ewram160E0(0) = 0xFD;
+ ewram160E0(1) = 1;
+ ewram160E0(2) = 1;
+ ewram160E0(3) = 1;
+ ewram160E0(4) = 0;
+ ewram160E0(5) = 0xFF;
gBattlescriptCurrInstr++;
}
@@ -13478,7 +13472,7 @@ static bool8 sub_80264C0(void)
{
if (gBattleMons[gBankAttacker].level >= gBattleMons[gBankTarget].level)
{
- ewram[gBankTarget + 0x16064] = gBattlePartyID[gBankTarget];
+ ewram16064arr(gBankTarget) = gBattlePartyID[gBankTarget];
}
else
{
@@ -13488,7 +13482,7 @@ static bool8 sub_80264C0(void)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
return 0;
}
- ewram[gBankTarget + 0x16064] = gBattlePartyID[gBankTarget];
+ ewram16064arr(gBankTarget) = gBattlePartyID[gBankTarget];
}
gBattlescriptCurrInstr = gUnknown_081D90FC;
return 1;
@@ -13569,7 +13563,7 @@ static void atk8F_forcerandomswitch(void)
} while (i == gBattlePartyID[gBankTarget] || !MON_CAN_BATTLE(&party[i]));
}
}
- ewram[gBankTarget + 0x16068] = i;
+ ewram16068arr(gBankTarget) = i;
if (!IsLinkDoubleBattle())
sub_8012258(gBankTarget);
sub_8094B6C(gBankTarget, i, 0);
@@ -15430,7 +15424,7 @@ static void atkBA_jumpifnopursuitswitchdmg(void)
gBankTarget = GetBankByPlayerAI(2);
}
- if (gActionForBanks[gBankTarget] == 0 && gBankAttacker == ewram[gBankTarget + 0x16010] && !(gBattleMons[gBankTarget].status1 & (STATUS_SLEEP | STATUS_FREEZE))
+ if (gActionForBanks[gBankTarget] == 0 && gBankAttacker == ewram16010arr(gBankTarget) && !(gBattleMons[gBankTarget].status1 & (STATUS_SLEEP | STATUS_FREEZE))
&& gBattleMons[gBankAttacker].hp && !gDisableStructs[gBankTarget].truantCounter && gChosenMovesByBanks[gBankTarget] == MOVE_PURSUIT)
{
int i;
@@ -15499,11 +15493,11 @@ static void atkBE_breakfree(void) //rapid spin
if (gBattleMons[gBankAttacker].status2 & STATUS2_WRAPPED)
{
gBattleMons[gBankAttacker].status2 &= ~(STATUS2_WRAPPED);
- gBankTarget = ewram[gBankAttacker + 0x16020];
+ gBankTarget = ewram16020arr(gBankAttacker);
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
- gBattleTextBuff1[2] = ewram[gBankAttacker * 2 + 0x16004];
- gBattleTextBuff1[3] = ewram[gBankAttacker * 2 + 0x16005];
+ gBattleTextBuff1[2] = ewram16004arr(0, gBankAttacker);
+ gBattleTextBuff1[3] = ewram16004arr(1, gBankAttacker);
gBattleTextBuff1[4] = 0xFF;
b_movescr_stack_push_cursor();
gBattlescriptCurrInstr = BattleScript_WrapFree;
@@ -16983,7 +16977,7 @@ static void atkE1_intimidate_string_loader(void)
{
u8 side;
- BATTLE_STRUCT->scriptingActive = ewram[0x160dd];
+ BATTLE_STRUCT->scriptingActive = ewram160DD;
side = GetBankSide(BATTLE_STRUCT->scriptingActive);
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 9;
@@ -17011,7 +17005,7 @@ static void atkE2_switchout_abilities(void)
{
case ABILITY_NATURAL_CURE:
gBattleMons[gActiveBank].status1 = 0;
- EmitSetAttributes(0, REQUEST_STATUS_BATTLE, gBitTable[ewram[gActiveBank + 0x16064]], 4, &gBattleMons[gActiveBank].status1);
+ EmitSetAttributes(0, REQUEST_STATUS_BATTLE, gBitTable[ewram16064arr(gActiveBank)], 4, &gBattleMons[gActiveBank].status1);
MarkBufferBankForExecution(gActiveBank);
break;
}
diff --git a/src/battle/battle_ai.c b/src/battle/battle_ai.c
index aeac41750..5145d4980 100644
--- a/src/battle/battle_ai.c
+++ b/src/battle/battle_ai.c
@@ -953,8 +953,8 @@ static void BattleAICmd_is_most_powerful_move(void)
&& sDiscouragedPowerfulMoveEffects[i] == 0xFFFF)
{
gDynamicBasePower = 0;
- ewram[0x1601C] = 0; // why is this a manual array?
- ewram[0x1601F] = 1;
+ eDynamicMoveType = 0;
+ eDmgMultiplier = 1;
gBattleMoveFlags = 0;
gCritMultiplier = 1;
@@ -1999,8 +1999,7 @@ static void BattleAICmd_get_used_item(void)
else
index = gBankTarget;
- // this hack and a half matches. whatever. i dont care. someone else fix this mess later. PS: still cant fix this.
- AI_THINKING_STRUCT->funcResult = ewram[MULTI_DIM_ARR(index, B_16, 0x160CC)];
+ AI_THINKING_STRUCT->funcResult = AI_ARRAY_160CC(index);
gAIScriptPtr += 2;
}
diff --git a/src/battle/battle_controller_opponent.c b/src/battle/battle_controller_opponent.c
index 94ae43461..823d6702a 100644
--- a/src/battle/battle_controller_opponent.c
+++ b/src/battle/battle_controller_opponent.c
@@ -1674,7 +1674,7 @@ _0803558A:\n\
void OpponentHandleOpenBag(void)
{
// What is this?
- Emitcmd35(1, ewram[0x160D4 + gActiveBank / 2 * 2]);
+ Emitcmd35(1, ewram160D4(gActiveBank));
OpponentBufferExecCompleted();
}
@@ -1682,7 +1682,7 @@ void OpponentHandlecmd22(void)
{
s32 r4;
- if (ewram[0x160C8 + GetBankIdentity(gActiveBank) / 2] == 6)
+ if (ewram160C8arr(GetBankIdentity(gActiveBank)) == 6)
{
u8 r6;
u8 r5;
@@ -1711,10 +1711,10 @@ void OpponentHandlecmd22(void)
}
else
{
- r4 = ewram[0x160C8 + GetBankIdentity(gActiveBank) / 2];
- ewram[0x160C8 + GetBankIdentity(gActiveBank) / 2] = 6;
+ r4 = ewram160C8arr(GetBankIdentity(gActiveBank));
+ ewram160C8arr(GetBankIdentity(gActiveBank)) = 6;
}
- ewram[0x16068 + gActiveBank] = r4;
+ ewram16068arr(gActiveBank) = r4;
Emitcmd34(1, r4, 0);
OpponentBufferExecCompleted();
}
diff --git a/src/battle/battle_controller_player.c b/src/battle/battle_controller_player.c
index f2fa16593..1aa73e90c 100644
--- a/src/battle/battle_controller_player.c
+++ b/src/battle/battle_controller_player.c
@@ -2645,9 +2645,9 @@ void PlayerHandlecmd22(void)
gUnknown_0300434C[gActiveBank] = CreateTask(TaskDummy, 0xFF);
gTasks[gUnknown_0300434C[gActiveBank]].data[0] = gBattleBufferA[gActiveBank][1] & 0xF;
- ewram[0x16054] = gBattleBufferA[gActiveBank][1] >> 4;
- ewram[0x1609D] = gBattleBufferA[gActiveBank][2];
- ewram[0x160C0] = gBattleBufferA[gActiveBank][3];
+ ewram16054 = gBattleBufferA[gActiveBank][1] >> 4;
+ EWRAM_1609D = gBattleBufferA[gActiveBank][2];
+ ewram160C0 = gBattleBufferA[gActiveBank][3];
for (i = 0; i < 3; i++)
gUnknown_02038470[i] = gBattleBufferA[gActiveBank][4 + i];
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
diff --git a/src/battle/battle_controller_wally.c b/src/battle/battle_controller_wally.c
index be065e071..9392832d7 100644
--- a/src/battle/battle_controller_wally.c
+++ b/src/battle/battle_controller_wally.c
@@ -240,10 +240,10 @@ void unref_sub_8137220(void)
void SetBankFuncToWallyBufferRunCommand(void)
{
gBattleBankFunc[gActiveBank] = WallyBufferRunCommand;
- ewram[0x160A8] = 0;
- ewram[0x160A9] = 0;
- ewram[0x160AA] = 0;
- ewram[0x160AB] = 0;
+ ewram160A8 = 0;
+ ewram160A9 = 0;
+ ewram160AA = 0;
+ ewram160AB = 0;
}
void WallyBufferRunCommand(void)
@@ -261,59 +261,59 @@ void sub_81372BC(void)
{
u8 r4;
- switch (ewram[0x160A8])
+ switch (ewram160A8)
{
case 0:
- ewram[0x160AA] = 64;
- ewram[0x160A8]++;
+ ewram160AA = 64;
+ ewram160A8++;
// fall through
case 1:
- r4 = --ewram[0x160AA];
+ r4 = --ewram160AA;
if (r4 == 0)
{
PlaySE(SE_SELECT);
Emitcmd33(1, 0, 0);
WallyBufferExecCompleted();
- ewram[0x160A8]++;
- ewram[0x160A9] = r4;
- ewram[0x160AA] = 64;
+ ewram160A8++;
+ ewram160A9 = r4;
+ ewram160AA = 64;
}
break;
case 2:
- r4 = --ewram[0x160AA];
+ r4 = --ewram160AA;
if (r4 == 0)
{
PlaySE(SE_SELECT);
Emitcmd33(1, 0, 0);
WallyBufferExecCompleted();
- ewram[0x160A8]++;
- ewram[0x160A9] = r4;
- ewram[0x160AA] = 64;
+ ewram160A8++;
+ ewram160A9 = r4;
+ ewram160AA = 64;
}
break;
case 3:
- r4 = --ewram[0x160AA];
+ r4 = --ewram160AA;
if (r4 == 0)
{
Emitcmd33(1, 9, 0);
WallyBufferExecCompleted();
- ewram[0x160A8]++;
- ewram[0x160A9] = r4;
- ewram[0x160AA] = 64;
+ ewram160A8++;
+ ewram160A9 = r4;
+ ewram160AA = 64;
}
break;
case 4:
- if (--ewram[0x160AA] == 0)
+ if (--ewram160AA == 0)
{
PlaySE(SE_SELECT);
nullsub_8(0);
sub_802E3E4(1, 0);
- ewram[0x160AA] = 64;
- ewram[0x160A8]++;
+ ewram160AA = 64;
+ ewram160A8++;
}
break;
case 5:
- if (--ewram[0x160AA] == 0)
+ if (--ewram160AA == 0)
{
PlaySE(SE_SELECT);
DestroyMenuCursor();
@@ -1291,16 +1291,16 @@ void WallyHandlecmd19(void)
void WallyHandlecmd20(void)
{
- switch (ewram[0x160A9])
+ switch (ewram160A9)
{
case 0:
sub_80304A8();
- ewram[0x160A9]++;
- ewram[0x160AB] = 80;
+ ewram160A9++;
+ ewram160AB = 80;
// fall through
case 1:
- ewram[0x160AB]--;
- if (ewram[0x160AB] == 0)
+ ewram160AB--;
+ if (ewram160AB == 0)
{
DestroyMenuCursor();
PlaySE(SE_SELECT);
diff --git a/src/battle/battle_interface.c b/src/battle/battle_interface.c
index 831839d9b..09837bfee 100644
--- a/src/battle/battle_interface.c
+++ b/src/battle/battle_interface.c
@@ -995,8 +995,8 @@ void sub_8044338(u8 a, struct Pokemon *pkmn)
}
//_08044486
r5 = gSprites[a].data5;
- ConvertIntToDecimalStringN(str + 6, ewram[0x16089], 1, 2);
- ConvertIntToDecimalStringN(str + 9, ewram[0x16088], 1, 2);
+ ConvertIntToDecimalStringN(str + 6, ewram16089, 1, 2);
+ ConvertIntToDecimalStringN(str + 9, ewram16088, 1, 2);
str[5] = 0;
str[8] = 0xBA;
sub_80034D4((u8 *)0x02000000, str);
diff --git a/src/battle/battle_message.c b/src/battle/battle_message.c
index f98c065b0..4e8067a49 100644
--- a/src/battle/battle_message.c
+++ b/src/battle/battle_message.c
@@ -652,7 +652,7 @@ u32 StrCpyDecodeBattle(const u8* src, u8* dst)
if (gTrainerBattleOpponent == 0x400)
{
memset(text, 0xFF, 8);
- memcpy(text, &ewram[0x17002], 7);
+ memcpy(text, ewram17002, 7);
toCpy = text;
}
else if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
diff --git a/src/battle/battle_transition.c b/src/battle/battle_transition.c
index 5562da462..d0a9bfb92 100644
--- a/src/battle/battle_transition.c
+++ b/src/battle/battle_transition.c
@@ -1733,8 +1733,8 @@ static void Mugshots_CreateOpponentPlayerSprites(struct Task* task)
task->tMugshotOpponentID = CreateTrainerSprite(sMugshotsTrainerPicIDsTable[mugshotID],
sMugshotsOpponentCoords[mugshotID][0] - 32,
sMugshotsOpponentCoords[mugshotID][1] + 42,
- 0, &ewram[0xC03C]);
- task->tMugshotPlayerID = CreateTrainerSprite(gSaveBlock2.playerGender, 272, 106, 0, &ewram[0xC03C]);
+ 0, ewramC03C);
+ task->tMugshotPlayerID = CreateTrainerSprite(gSaveBlock2.playerGender, 272, 106, 0, ewramC03C);
opponentSprite = &gSprites[task->tMugshotOpponentID];
playerSprite = &gSprites[task->tMugshotPlayerID];