diff options
Diffstat (limited to 'src/battle')
-rw-r--r-- | src/battle/battle_2.c | 43 | ||||
-rw-r--r-- | src/battle/battle_3.c | 9 | ||||
-rw-r--r-- | src/battle/battle_4.c | 15 | ||||
-rw-r--r-- | src/battle/battle_7.c | 3 | ||||
-rw-r--r-- | src/battle/battle_anim.c | 1 | ||||
-rw-r--r-- | src/battle/battle_interface.c | 7 | ||||
-rw-r--r-- | src/battle/battle_party_menu.c | 4 | ||||
-rw-r--r-- | src/battle/battle_transition.c | 3 | ||||
-rw-r--r-- | src/battle/reshow_battle_screen.c | 4 |
9 files changed, 15 insertions, 74 deletions
diff --git a/src/battle/battle_2.c b/src/battle/battle_2.c index 1aec075db..5a37a6169 100644 --- a/src/battle/battle_2.c +++ b/src/battle/battle_2.c @@ -29,6 +29,7 @@ #include "items.h" #include "hold_effects.h" #include "battle_move_effects.h" +#include "ewram.h" struct UnknownStruct6 { @@ -62,48 +63,6 @@ struct UnknownStruct12 extern const u16 gUnknown_08D004E0[]; extern const struct MonCoords gCastformFrontSpriteCoords[]; -extern u8 ewram[]; -#define ewram0 (*(struct UnknownStruct7 *)(ewram + 0x0)) -#define ewram4 (*(struct UnknownStruct8 *)(ewram + 0x4)) -#define ewram16000 (ewram[0x16000]) -#define ewram16001 (ewram[0x16001]) -#define ewram16002 (ewram[0x16002]) -#define ewram16003 (ewram[0x16003]) -#define ewram1600C (ewram[0x1600C]) -#define ewram1600E (ewram[0x1600E]) -#define ewram1601B (ewram[0x1601B]) -#define ewram16020 ((u8 *)(ewram + 0x16020)) -#define ewram16056 (ewram[0x16056]) -#define ewram16058 (ewram[0x16058]) -#define ewram16059 (ewram[0x16059]) -#define ewram16078 (ewram[0x16078]) -#define ewram16084 (ewram[0x16084]) -#define ewram16086 (ewram[0x16086]) -#define ewram16087 (ewram[0x16087]) -#define ewram16088 (ewram[0x16088]) -#define ewram16089 (ewram[0x16089]) -#define ewram160A1 (ewram[0x160A1]) -#define ewram160A6 (ewram[0x160A6]) -#define ewram160AC ((u8 *)(ewram + 0x160AC)) -#define ewram160BC ((u16 *)(ewram + 0x160BC)) // hp -#define ewram160C8 (ewram[0x160C8]) -#define ewram160C9 (ewram[0x160C9]) -#define ewram160CB (ewram[0x160CB]) -#define ewram160CC ((u8 *)(ewram + 0x160CC)) -#define ewram160E6 (ewram[0x160E6]) -#define ewram160E8 ((u8 *)(ewram + 0x160E8)) -#define ewram160F0 ((u8 *)(ewram + 0x160F0)) -#define ewram160F9 (ewram[0x160F9]) -#define ewram16100 ((u8 *)(ewram + 0x16100)) -#define ewram16108 ((u8 *)(ewram + 0x16108)) -#define ewram16110 (ewram[0x16110]) -#define ewram16111 (ewram[0x16111]) -#define ewram16113 (ewram[0x16113]) -#define ewram17100 ((u32 *)(ewram + 0x17100)) -#define ewram17130 (ewram[0x17130]) -#define ewram17160 (ewram[0x17160]) -#define ewram1D000 ((struct Pokemon *)(ewram + 0x1D000)) - extern struct UnknownPokemonStruct2 gUnknown_02023A00[]; extern u8 gBattleBufferB[][0x200]; extern u8 gActiveBank; diff --git a/src/battle/battle_3.c b/src/battle/battle_3.c index 346ca6d79..e8819781d 100644 --- a/src/battle/battle_3.c +++ b/src/battle/battle_3.c @@ -13,6 +13,7 @@ #include "battle_move_effects.h" #include "string_util.h" #include "flags.h" +#include "ewram.h" extern u8* gBattlescriptCurrInstr; extern u8 gActiveBank; @@ -198,8 +199,6 @@ extern u8 gUnknown_081D996F[]; //disobedient, uses a random move extern u8 gUnknown_081D9989[]; //disobedient, went to sleep extern u8 gUnknown_081D99A0[]; //disobedient, hits itself -#define CHOICED_MOVE(bank)(((u16*)(&ewram[bank * 2 + 0x160e8]))) - //array entries for battle communication #define MOVE_EFFECT_BYTE 0x3 #define MULTISTRING_CHOOSER 0x5 @@ -1439,8 +1438,6 @@ struct Struct2017100 u32 arr[4]; }; -#define ewram17100 (*(struct Struct2017100 *)(ewram + 0x17100)) - u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) { u8 effect = 0; @@ -1726,14 +1723,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) case ABILITY_FLASH_FIRE: if (moveType == TYPE_FIRE && !(gBattleMons[bank].status1 & STATUS_FREEZE)) { - if (!(ewram17100.arr[bank] & 1)) + if (!(ewram17100_2.arr[bank] & 1)) { gBattleCommunication[MULTISTRING_CHOOSER] = 0; if (gProtectStructs[gBankAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_FlashFireBoost; else gBattlescriptCurrInstr = BattleScript_FlashFireBoost_PPLoss; - ewram17100.arr[bank] |= 1; + ewram17100_2.arr[bank] |= 1; effect = 2; } else diff --git a/src/battle/battle_4.c b/src/battle/battle_4.c index 65e0458a2..3fee71a5f 100644 --- a/src/battle/battle_4.c +++ b/src/battle/battle_4.c @@ -259,8 +259,6 @@ extern u8 gUnknown_081D9468[]; #define sBYTE2_32(value)(( (u8) (((s32)(value) & (0x00FF0000)) >> 0x10))) #define sBYTE3_32(value)(( (u8) (((s32)(value) & (0xFF000000)) >> 0x18))) -#define USED_HELD_ITEM(bank)((((u16*)(&unk_2000000[bank * 2 + 0x160cc])))) - #define RecordAbilitySetField6(ability, fieldValue) \ (gLastUsedAbility = ability, gBattleCommunication[6] = fieldValue, RecordAbilityBattle(gBankTarget, ability)) @@ -2640,7 +2638,7 @@ void SetMoveEffect(bool8 primary, u8 certainArg) {gBattlescriptCurrInstr++; return;} gLastUsedItem = gBattleMons[gBankTarget].item; - unk_2000000[gBankAttacker * 2 + 0x160cc] = gLastUsedItem; + ewram[gBankAttacker * 2 + 0x160cc] = gLastUsedItem; gBattleMons[gBankTarget].item = 0; gActiveBank = gBankAttacker; @@ -5123,7 +5121,7 @@ static void atk1E_jumpifability(void) gLastUsedAbility = ability; gBattlescriptCurrInstr = jump_loc; RecordAbilityBattle(bank -1, gLastUsedAbility); - unk_2000000[0x160f8] = bank - 1; + ewram[0x160f8] = bank - 1; } else gBattlescriptCurrInstr += 7; @@ -5136,7 +5134,7 @@ static void atk1E_jumpifability(void) gLastUsedAbility = ability; gBattlescriptCurrInstr = jump_loc; RecordAbilityBattle(bank - 1, gLastUsedAbility); - unk_2000000[0x160f8] = bank - 1; + ewram[0x160f8] = bank - 1; } else gBattlescriptCurrInstr += 7; @@ -5149,7 +5147,7 @@ static void atk1E_jumpifability(void) gLastUsedAbility = ability; gBattlescriptCurrInstr = jump_loc; RecordAbilityBattle(bank, gLastUsedAbility); - unk_2000000[0x160f8] = bank; + ewram[0x160f8] = bank; } else gBattlescriptCurrInstr += 7; @@ -7327,7 +7325,7 @@ static void atk43_jumpifabilitypresent(void) static void atk44(void) { - unk_2000000[gBankAttacker + 0x16060] = 1; + ewram[gBankAttacker + 0x16060] = 1; } #ifdef NONMATCHING @@ -9522,7 +9520,7 @@ static void atk4C_copy_poke_data(void) gActiveBank = GetBattleBank(T2_READ_8(gBattlescriptCurrInstr + 1)); - gBattlePartyID[gActiveBank] = unk_2000000[0x16068 + gActiveBank]; + gBattlePartyID[gActiveBank] = ewram[0x16068 + gActiveBank]; EmitGetAttributes(0, 0, gBitTable[gBattlePartyID[gActiveBank]]); MarkBufferBankForExecution(gActiveBank); @@ -11640,7 +11638,6 @@ static void atk69_dmg_adjustment2(void) //literally a copy of atk07 except there void atk6A_removeitem(void) { gActiveBank = GetBattleBank(T2_READ_8(gBattlescriptCurrInstr + 1)); - #define USED_HELD_ITEMS(bank) (*(u16 *)&ewram[0x160CC + 2 * (bank)]) USED_HELD_ITEMS(gActiveBank) = gBattleMons[gActiveBank].item; gBattleMons[gActiveBank].item = 0; diff --git a/src/battle/battle_7.c b/src/battle/battle_7.c index 1d68386aa..6c0a4489c 100644 --- a/src/battle/battle_7.c +++ b/src/battle/battle_7.c @@ -18,6 +18,7 @@ #include "task.h" #include "text.h" #include "gba/m4a_internal.h" +#include "ewram.h" struct Struct2019348 { @@ -71,8 +72,6 @@ extern const struct CompressedSpriteSheet gUnknown_0820A4B4[]; extern const struct SpritePalette gUnknown_0820A4D4[]; extern const u8 gUnknown_08D09C48[]; -#define ewram19348 (*(struct Struct2019348 *)(ewram + 0x19348)) - extern void c3_0802FDF4(u8); extern void sub_80440EC(); extern void sub_804777C(); diff --git a/src/battle/battle_anim.c b/src/battle/battle_anim.c index eac16ee18..0c04ff9b8 100644 --- a/src/battle/battle_anim.c +++ b/src/battle/battle_anim.c @@ -16,7 +16,6 @@ // sprites start at 10000 and thus must be subtracted of 10000 to account for the true index. #define GET_TRUE_SPRITE_INDEX(i) (i - 10000) -extern u8 unk_2000000[]; extern u16 gBattlePartyID[4]; extern u8 gObjectBankIDs[]; extern u8 gBankAttacker; diff --git a/src/battle/battle_interface.c b/src/battle/battle_interface.c index 10962c025..831839d9b 100644 --- a/src/battle/battle_interface.c +++ b/src/battle/battle_interface.c @@ -13,6 +13,7 @@ #include "string_util.h" #include "task.h" #include "text.h" +#include "ewram.h" struct UnknownStruct5 { @@ -28,12 +29,6 @@ struct UnknownStruct7 u8 filler0[0x180]; }; -extern u8 ewram[]; -#define ewram520 ((struct UnknownStruct7 *)(ewram + 0x00520)) -#define ewram16088 (*(u8 *) (ewram + 0x16088)) -#define ewram16089 (*(u8 *) (ewram + 0x16089)) -#define ewram17850 ((struct UnknownStruct5 *)(ewram + 0x17850)) - extern u8 gDisplayedStringBattle[]; extern u8 gNoOfAllBanks; extern u16 gBattlePartyID[]; diff --git a/src/battle/battle_party_menu.c b/src/battle/battle_party_menu.c index 2f6dc6816..ab8b7a694 100644 --- a/src/battle/battle_party_menu.c +++ b/src/battle/battle_party_menu.c @@ -18,9 +18,7 @@ #include "strings.h" #include "task.h" #include "text.h" - -extern u8 ewram[]; -#define UNK_201606C_ARRAY (ewram + 0x1606C) // lazy define but whatever. +#include "ewram.h" extern u8 sub_806BD58(u8, u8); extern void PartyMenuPrintMonsLevelOrStatus(void); diff --git a/src/battle/battle_transition.c b/src/battle/battle_transition.c index 53d32d03a..5562da462 100644 --- a/src/battle/battle_transition.c +++ b/src/battle/battle_transition.c @@ -12,11 +12,11 @@ #include "songs.h" #include "trainer.h" #include "field_camera.h" +#include "ewram.h" void sub_807DE10(void); void dp12_8087EA4(void); -extern u8 ewram[]; extern u16 gUnknown_03005560[]; extern u16 gUnknown_03004DE0[][0x3C0]; @@ -45,7 +45,6 @@ struct TransitionData s16 data[11]; }; -#define TRANSITION_STRUCT (*(struct TransitionData *) (ewram + 0xC000)) typedef bool8 (*TransitionState)(struct Task* task); typedef bool8 (*TransitionSpriteCallback)(struct Sprite* sprite); diff --git a/src/battle/reshow_battle_screen.c b/src/battle/reshow_battle_screen.c index 343c8f183..396c4435e 100644 --- a/src/battle/reshow_battle_screen.c +++ b/src/battle/reshow_battle_screen.c @@ -7,6 +7,7 @@ #include "text.h" #include "rom_8077ABC.h" #include "data2.h" +#include "ewram.h" extern struct SpriteTemplate gUnknown_02024E8C; extern struct Window gUnknown_03004210; @@ -55,9 +56,6 @@ static void sub_807B184(u8 bank); static void sub_807B508(u8 bank); static void sub_807B06C(void); -#define gReshowState ewram[0x1FFFF] -#define gHelperState ewram[0x1FFFE] - void nullsub_14(void) { |