Add battle controllers var to src from sym_ewram

This commit is contained in:
DizzyEggg 2018-12-03 16:20:39 +01:00
parent 846b5d79e4
commit dcb1d78fa9
12 changed files with 41 additions and 72 deletions

View File

@ -175,6 +175,7 @@ enum
CONTROLLER_CMDS_COUNT
};
extern struct UnusedControllerStruct gUnknown_02022D0C;
// general functions
void HandleLinkBattleSetup(void);

View File

@ -27,7 +27,6 @@
#include "constants/trainers.h"
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];

View File

@ -26,8 +26,6 @@
#include "constants/songs.h"
#include "constants/trainers.h"
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];

View File

@ -34,7 +34,6 @@
#include "constants/trainers.h"
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];

View File

@ -37,7 +37,6 @@
extern u8 gUnknown_0203CEE8;
extern u8 gUnknown_0203CEE9;
extern u8 gUnknown_0203CF00[];
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];

View File

@ -6,6 +6,7 @@
#include "battle_message.h"
#include "battle_interface.h"
#include "battle_setup.h"
#include "battle_tower.h"
#include "bg.h"
#include "data2.h"
#include "item_use.h"
@ -26,15 +27,11 @@
#include "constants/songs.h"
#include "constants/trainers.h"
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_81358F4(void);
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void SetMultiuseSpriteTemplateToPokemon(u16, u8);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
// this file's functions
static void PlayerPartnerHandleGetMonData(void);

View File

@ -6,6 +6,7 @@
#include "battle_interface.h"
#include "battle_message.h"
#include "battle_setup.h"
#include "battle_tower.h"
#include "battle_tv.h"
#include "bg.h"
#include "data2.h"
@ -29,14 +30,11 @@
#include "constants/trainers.h"
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern u8 gUnknown_0203C7B4;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern u16 sub_8068B48(void);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
// this file's functions
static void RecordedOpponentHandleGetMonData(void);

View File

@ -25,16 +25,12 @@
#include "constants/battle_anim.h"
#include "constants/songs.h"
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
extern u8 gUnknown_0203C7B4;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
// this file's functions
static void RecordedPlayerHandleGetMonData(void);

View File

@ -31,9 +31,6 @@
#include "constants/songs.h"
#include "constants/trainers.h"
extern s32 gUnknown_0203CD70;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);

View File

@ -13,10 +13,10 @@
#include "constants/abilities.h"
#include "constants/species.h"
extern u8 gUnknown_02022D08;
extern u8 gUnknown_02022D09;
extern u8 gUnknown_02022D0A;
static EWRAM_DATA u8 sLinkSendTaskId = 0;
static EWRAM_DATA u8 sLinkReceiveTaskId = 0;
static EWRAM_DATA u8 sUnknown_02022D0A = 0;
EWRAM_DATA struct UnusedControllerStruct gUnknown_02022D0C = {};
static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {};
extern void sub_81B8D64(u8 battlerId, u8 arg1); // party_menu
@ -681,20 +681,20 @@ static void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size)
static void CreateTasksForSendRecvLinkBuffers(void)
{
gUnknown_02022D08 = CreateTask(Task_HandleSendLinkBuffersData, 0);
gTasks[gUnknown_02022D08].data[11] = 0;
gTasks[gUnknown_02022D08].data[12] = 0;
gTasks[gUnknown_02022D08].data[13] = 0;
gTasks[gUnknown_02022D08].data[14] = 0;
gTasks[gUnknown_02022D08].data[15] = 0;
sLinkSendTaskId = CreateTask(Task_HandleSendLinkBuffersData, 0);
gTasks[sLinkSendTaskId].data[11] = 0;
gTasks[sLinkSendTaskId].data[12] = 0;
gTasks[sLinkSendTaskId].data[13] = 0;
gTasks[sLinkSendTaskId].data[14] = 0;
gTasks[sLinkSendTaskId].data[15] = 0;
gUnknown_02022D09 = CreateTask(Task_HandleCopyReceivedLinkBuffersData, 0);
gTasks[gUnknown_02022D09].data[12] = 0;
gTasks[gUnknown_02022D09].data[13] = 0;
gTasks[gUnknown_02022D09].data[14] = 0;
gTasks[gUnknown_02022D09].data[15] = 0;
sLinkReceiveTaskId = CreateTask(Task_HandleCopyReceivedLinkBuffersData, 0);
gTasks[sLinkReceiveTaskId].data[12] = 0;
gTasks[sLinkReceiveTaskId].data[13] = 0;
gTasks[sLinkReceiveTaskId].data[14] = 0;
gTasks[sLinkReceiveTaskId].data[15] = 0;
gUnknown_02022D0A = 0;
sUnknown_02022D0A = 0;
}
enum
@ -716,24 +716,24 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data)
s32 i;
alignedSize = size - size % 4 + 4;
if (gTasks[gUnknown_02022D08].data[14] + alignedSize + LINK_BUFF_DATA + 1 > BATTLE_BUFFER_LINK_SIZE)
if (gTasks[sLinkSendTaskId].data[14] + alignedSize + LINK_BUFF_DATA + 1 > BATTLE_BUFFER_LINK_SIZE)
{
gTasks[gUnknown_02022D08].data[12] = gTasks[gUnknown_02022D08].data[14];
gTasks[gUnknown_02022D08].data[14] = 0;
gTasks[sLinkSendTaskId].data[12] = gTasks[sLinkSendTaskId].data[14];
gTasks[sLinkSendTaskId].data[14] = 0;
}
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_BUFFER_ID] = bufferId;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ACTIVE_BATTLER] = gActiveBattler;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ATTACKER] = gBattlerAttacker;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_TARGET] = gBattlerTarget;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_SIZE_LO] = alignedSize;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_SIZE_HI] = (alignedSize & 0x0000FF00) >> 8;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ABSENT_BATTLER_FLAGS] = gAbsentBattlerFlags;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_EFFECT_BATTLER] = gEffectBattler;
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_BUFFER_ID] = bufferId;
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ACTIVE_BATTLER] = gActiveBattler;
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ATTACKER] = gBattlerAttacker;
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_TARGET] = gBattlerTarget;
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_SIZE_LO] = alignedSize;
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_SIZE_HI] = (alignedSize & 0x0000FF00) >> 8;
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ABSENT_BATTLER_FLAGS] = gAbsentBattlerFlags;
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_EFFECT_BATTLER] = gEffectBattler;
for (i = 0; i < size; i++)
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_DATA + i] = data[i];
gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_DATA + i] = data[i];
gTasks[gUnknown_02022D08].data[14] = gTasks[gUnknown_02022D08].data[14] + alignedSize + LINK_BUFF_DATA;
gTasks[sLinkSendTaskId].data[14] = gTasks[sLinkSendTaskId].data[14] + alignedSize + LINK_BUFF_DATA;
}
static void Task_HandleSendLinkBuffersData(u8 taskId)
@ -845,19 +845,19 @@ void sub_8033648(void)
#endif
r6 = gBlockRecvBuffer[i][2];
if (gTasks[gUnknown_02022D09].data[14] + 9 + r6 > 0x1000)
if (gTasks[sLinkReceiveTaskId].data[14] + 9 + r6 > 0x1000)
{
gTasks[gUnknown_02022D09].data[12] = gTasks[gUnknown_02022D09].data[14];
gTasks[gUnknown_02022D09].data[14] = 0;
gTasks[sLinkReceiveTaskId].data[12] = gTasks[sLinkReceiveTaskId].data[14];
gTasks[sLinkReceiveTaskId].data[14] = 0;
}
dest = &gLinkBattleRecvBuffer[gTasks[gUnknown_02022D09].data[14]];
dest = &gLinkBattleRecvBuffer[gTasks[sLinkReceiveTaskId].data[14]];
src = recvBuffer;
for (j = 0; j < r6 + 8; j++)
dest[j] = src[j];
gTasks[gUnknown_02022D09].data[14] = gTasks[gUnknown_02022D09].data[14] + r6 + 8;
gTasks[sLinkReceiveTaskId].data[14] = gTasks[sLinkReceiveTaskId].data[14] + r6 + 8;
}
}
}

View File

@ -31,8 +31,6 @@ struct UnkStruct1
struct UnkStruct2 *array;
};
extern struct UnkStruct1 *gUnknown_02022E10;
extern const struct SpriteTemplate gUnknown_0831AC88;
// this file's functions
@ -50,6 +48,9 @@ static IWRAM_DATA s32 gUnknown_03000DD4;
static IWRAM_DATA s32 gUnknown_03000DD8;
static IWRAM_DATA s32 gUnknown_03000DDC;
// ewram
static EWRAM_DATA struct UnkStruct1 *gUnknown_02022E10 = {0};
// const rom data
static const u8 gUnknown_082FF1C8[][4] =
{

View File

@ -104,24 +104,8 @@ gUnknown_02022D00: @ 2022D00
.space 0x4
.include "src/main_menu.o"
gUnknown_02022D08: @ 2022D08
.space 0x1
gUnknown_02022D09: @ 2022D09
.space 0x1
gUnknown_02022D0A: @ 2022D0A
.space 0x2
gUnknown_02022D0C: @ 2022D0C
.space 0x4
.include "src/battle_controllers.o"
gUnknown_02022E10: @ 2022E10
.space 0x4
.include "src/rom_8034C54.o"
.include "src/battle_main.o"
.include "src/pokemon.o"
.include "src/random.o"