summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcamthesaxman <cameronghall@cox.net>2017-06-10 12:56:59 -0500
committercamthesaxman <cameronghall@cox.net>2017-06-10 12:56:59 -0500
commit16db220259f321860e503282db86837124f3c66a (patch)
treeac49bbf99e9b6603fbc1f381e1d0b55f53e3d485 /src
parenta46403232f325b0c7da93562376fe63887f8e7db (diff)
move some common battle struct definitions to battle.h
Diffstat (limited to 'src')
-rw-r--r--src/battle_2.c19
-rw-r--r--src/battle_7.c45
-rw-r--r--src/battle_811DA74.c33
-rw-r--r--src/battle_ai.c2
-rw-r--r--src/battle_interface.c26
5 files changed, 11 insertions, 114 deletions
diff --git a/src/battle_2.c b/src/battle_2.c
index 79d62ce69..f7051fbfd 100644
--- a/src/battle_2.c
+++ b/src/battle_2.c
@@ -55,23 +55,6 @@ struct UnknownPokemonStruct2
/*0x1D*/ u8 language;
};
-struct UnknownStruct9
-{
- u8 unk0;
- u16 unk2;
-};
-
-struct UnknownStruct10
-{
- u8 unk0_0:1;
- u8 unk0_1:1;
- u8 unk0_2:1;
- u8 filler1[1];
- u8 unk2;
- u8 unk3;
- u8 filler4[8];
-};
-
struct UnknownStruct11
{
u8 unk0;
@@ -172,8 +155,6 @@ extern u8 ewram[];
#define ewram17100 ((u32 *)(ewram + 0x17100))
#define ewram17130 (ewram[0x17130])
#define ewram17160 (ewram[0x17160])
-#define ewram17800 ((struct UnknownStruct9 *)(ewram + 0x17800))
-#define ewram17810 ((struct UnknownStruct10 *)(ewram + 0x17810))
#define ewram1D000 ((struct Pokemon *)(ewram + 0x1D000))
extern struct UnknownPokemonStruct2 gUnknown_02023A00[];
diff --git a/src/battle_7.c b/src/battle_7.c
index 9b73eb573..1acadf7db 100644
--- a/src/battle_7.c
+++ b/src/battle_7.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "asm.h"
-// Include this when my other PR gets merged
-//#include "battle.h"
+#include "battle.h"
#include "battle_interface.h"
#include "battle_anim.h"
#include "blend_palette.h"
@@ -15,48 +14,6 @@
#include "task.h"
#include "gba/m4a_internal.h"
-// Probably the same one from battle_811DA74.c
-struct UnknownStruct2_
-{
- u8 unk0_0:1;
- u8 unk0_1:2;
- u8 unk0_3:1;
- u8 unk0_4:1;
- u8 unk0_5:1;
- u8 unk0_6:1;
- u8 unk0_7:1;
- u8 unk1_0:1;
- u8 filler2[2];
- u8 unk4;
- u8 unk5;
- u8 filler6[2];
- u8 unk8;
- u8 unk9;
- u8 fillerA[2];
-};
-
-struct UnknownStruct4_
-{
- u8 unk0_0:1;
- u8 unk0_1:1;
- u8 unk0_2:1;
- u8 unk0_3:1;
- u16 unk2;
-};
-
-struct UnknownStruct6
-{
- u16 unk0;
- u8 filler2[7];
- u8 unk9;
-};
-
-extern u8 ewram[];
-
-#define ewram17800 ((struct UnknownStruct4_ *)(ewram + 0x17800))
-#define ewram17810 ((struct UnknownStruct2_ *)(ewram + 0x17810))
-#define ewram17840 (*(struct UnknownStruct6 *)(ewram + 0x17840))
-
extern struct MusicPlayerInfo gMPlay_SE1;
extern struct MusicPlayerInfo gMPlay_SE2;
extern u8 gUnknown_02024A60;
diff --git a/src/battle_811DA74.c b/src/battle_811DA74.c
index 56a4bd0c4..f39aa5248 100644
--- a/src/battle_811DA74.c
+++ b/src/battle_811DA74.c
@@ -21,24 +21,6 @@ struct UnknownStruct1
u8 unk2[0x1FE];
};
-struct UnknownStruct2
-{
- u8 unk0_0:1;
- u8 unk0_1:2;
- u8 unk0_3:1;
- u8 unk0_4:1;
- u8 unk0_5:1;
- u8 unk0_6:1;
- u8 unk0_7:1;
- u8 unk1_0:1;
- u8 filler2[2];
- u8 unk4;
- u8 unk5;
- u8 filler6[3];
- u8 unk9;
- u8 fillerA[2];
-};
-
//Possibly PokemonSubstruct1
struct UnknownStruct3
{
@@ -47,24 +29,19 @@ struct UnknownStruct3
u8 ppBonuses;
};
-struct UnknownStruct4
-{
- u8 unk0_0:2;
- u8 unk0_2:1;
- u8 unk0_3:1;
-};
-
struct UnknownStruct5
{
u8 unk0_0:7;
u8 unk0_7:1;
};
+/*
struct UnknownStruct6
{
u8 filler0[9];
u8 unk9;
};
+*/
extern u32 gBitTable[];
extern u16 gBattleTypeFlags;
@@ -100,12 +77,6 @@ extern u8 gAnimScriptActive;
extern void (*gAnimScriptCallback)(void);
extern void (*const gUnknown_083FE4F4[])(void);
-extern u8 ewram[];
-
-#define ewram17800 ((struct UnknownStruct4 *)(ewram + 0x17800))
-#define ewram17810 ((struct UnknownStruct2 *)(ewram + 0x17810))
-#define ewram17840 (*(struct UnknownStruct6 *)(ewram + 0x17840))
-
extern u8 move_anim_start_t3();
extern u8 sub_8078874();
extern void sub_8044CA0(u8);
diff --git a/src/battle_ai.c b/src/battle_ai.c
index dbd926000..4f00cc7cb 100644
--- a/src/battle_ai.c
+++ b/src/battle_ai.c
@@ -1998,7 +1998,7 @@ static void BattleAICmd_get_item(void)
index = gEnemyMonIndex;
// 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 = unk_2000000[0x160CC + (index * 2)];
+ AI_THINKING_STRUCT->funcResult = ewram[0x160CC + (index * 2)];
gAIScriptPtr += 2;
}
diff --git a/src/battle_interface.c b/src/battle_interface.c
index 61a6a5853..c05d66148 100644
--- a/src/battle_interface.c
+++ b/src/battle_interface.c
@@ -1,5 +1,6 @@
#include "global.h"
#include "asm.h"
+#include "battle.h"
#include "sprite.h"
#include "string_util.h"
#include "text.h"
@@ -19,18 +20,6 @@ struct UnknownStruct5
u32 unk10;
};
-struct UnknownStruct6
-{
- u8 bit_0:1;
- u8 bit_1:1;
- u8 bit_2:1;
- u8 bit_3:1;
- u8 bit_4:1;
- u8 bit_5:1;
- u8 bit_6:1;
- u8 bit_7:1;
-};
-
struct UnknownStruct7
{
u8 filler0[0x180];
@@ -40,7 +29,6 @@ extern u8 ewram[];
#define ewram520 ((struct UnknownStruct7 *)(ewram + 0x00520))
#define ewram16088 (*(u8 *) (ewram + 0x16088))
#define ewram16089 (*(u8 *) (ewram + 0x16089))
-#define ewram17800 ((struct UnknownStruct6 *)(ewram + 0x17800))
#define ewram17850 ((struct UnknownStruct5 *)(ewram + 0x17850))
extern u8 gUnknown_020238CC[];
@@ -939,7 +927,7 @@ static void sub_8044210(u8 a, s16 b, u8 c)
// TODO: make this a local variable
memcpy(str, gUnknown_0820A89C, sizeof(str));
r4 = gSprites[a].data6;
- if ((ewram17800[r4].bit_4) == 0)
+ if ((ewram17800[r4].unk0_4) == 0)
return;
ptr = str + 6;
if (c == 0)
@@ -1312,8 +1300,8 @@ void sub_804454C(void)
{
u8 r6;
- ewram17800[i].bit_4 ^= 1;
- r6 = ewram17800[i].bit_4;
+ ewram17800[i].unk0_4 ^= 1;
+ r6 = ewram17800[i].unk0_4;
if (battle_side_get_owner(i) == 0)
{
@@ -2587,7 +2575,7 @@ static void draw_status_ailment_maybe(u8 a)
for (i = 0; i < 3; i++)
CpuCopy32(r6, (void *)(OBJ_VRAM0 + (gSprites[a].oam.tileNum + r8 + i) * 32), 32);
- if (!ewram17800[r7].bit_4)
+ if (!ewram17800[r7].unk0_4)
CpuCopy32(sub_8043CDC(1), (void *)(OBJ_VRAM0 + gSprites[r10].oam.tileNum * 32), 64);
sub_8045458(a, 1);
@@ -2602,7 +2590,7 @@ static void draw_status_ailment_maybe(u8 a)
CpuCopy32(r6, (void *)(OBJ_VRAM0 + (gSprites[a].oam.tileNum + r8) * 32), 96);
if (IsDoubleBattle() == TRUE || battle_side_get_owner(r7) == TRUE)
{
- if (!ewram17800[r7].bit_4)
+ if (!ewram17800[r7].unk0_4)
{
CpuCopy32(sub_8043CDC(0), (void *)(OBJ_VRAM0 + gSprites[r10].oam.tileNum * 32), 32);
CpuCopy32(sub_8043CDC(0x41), (void *)(OBJ_VRAM0 + (gSprites[r10].oam.tileNum + 1) * 32), 32);
@@ -2809,7 +2797,7 @@ s32 sub_8045C78(u8 a, u8 unused1, u8 c, u8 unused2)
r5 = ABS(r8 / r5);
r6 = sub_8045F58(ewram17850[a].unk4, ewram17850[a].unk8, r8, &ewram17850[a].unk10, 8, r5);
}
- if (c == 1 || (c == 0 && (!ewram17800[a].bit_4)))
+ if (c == 1 || (c == 0 && (!ewram17800[a].unk0_4)))
sub_8045D58(a, c);
if (r6 == -1)
ewram17850[a].unk10 = 0;