mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Start renaming symbols
I finally figured out what the code is trying to do. I have a foothold; the rest should follow.
This commit is contained in:
parent
6f1d2b870c
commit
3fd878483f
@ -4,5 +4,5 @@ gBGTilemapBuffers3
|
|||||||
gUnknown_03005DA8
|
gUnknown_03005DA8
|
||||||
gFieldCallback
|
gFieldCallback
|
||||||
gFieldCallback2
|
gFieldCallback2
|
||||||
gUnknown_03005DB4
|
gLinkGuestPlayerId
|
||||||
gFieldLinkPlayerCount
|
gFieldLinkPlayerCount
|
||||||
|
@ -914,14 +914,14 @@ RecordCorner_EventScript_277471:: @ 8277471
|
|||||||
releaseall
|
releaseall
|
||||||
end
|
end
|
||||||
|
|
||||||
EventScript_TradeRoom_ReadTrainerCard1:: @ 827747E
|
EventScript_TradeRoom_ReadTrainerCard_NoColor:: @ 827747E
|
||||||
msgbox Text_278452, MSGBOX_DEFAULT
|
msgbox Text_278452, MSGBOX_DEFAULT
|
||||||
fadescreen 1
|
fadescreen 1
|
||||||
special sp02A_crash_sound
|
special sp02A_crash_sound
|
||||||
waitstate
|
waitstate
|
||||||
end
|
end
|
||||||
|
|
||||||
EventScript_TradeRoom_ReadTrainerCard2:: @ 827748D
|
EventScript_TradeRoom_ReadTrainerCard_Normal:: @ 827748D
|
||||||
msgbox Text_27847B, MSGBOX_DEFAULT
|
msgbox Text_27847B, MSGBOX_DEFAULT
|
||||||
fadescreen 1
|
fadescreen 1
|
||||||
special sp02A_crash_sound
|
special sp02A_crash_sound
|
||||||
|
@ -15,6 +15,6 @@ void sub_80B360C(void);
|
|||||||
bool32 sub_80B2AF4(u16 *arg0, u16 *arg1);
|
bool32 sub_80B2AF4(u16 *arg0, u16 *arg1);
|
||||||
void sub_80B3AF8(u8 taskId);
|
void sub_80B3AF8(u8 taskId);
|
||||||
void task00_08081A90(u8 taskId);
|
void task00_08081A90(u8 taskId);
|
||||||
bool32 sub_80B39D4(u8 linkPlayerIndex);
|
bool32 GetLinkTrainerCardColor(u8 linkPlayerIndex);
|
||||||
|
|
||||||
#endif //GUARD_CABLE_CLUB_H
|
#endif //GUARD_CABLE_CLUB_H
|
||||||
|
@ -907,12 +907,12 @@ struct MapPosition
|
|||||||
s8 height;
|
s8 height;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UnkStruct_8054FF8
|
struct TradeRoomTrainer
|
||||||
{
|
{
|
||||||
u8 a;
|
u8 a;
|
||||||
u8 b;
|
u8 b;
|
||||||
u8 c;
|
u8 c;
|
||||||
u8 d;
|
u8 facing;
|
||||||
struct MapPosition sub;
|
struct MapPosition sub;
|
||||||
u16 field_C;
|
u16 field_C;
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,7 @@ extern u16 *gBGTilemapBuffers3;
|
|||||||
extern u16 gUnknown_03005DA8;
|
extern u16 gUnknown_03005DA8;
|
||||||
extern void (*gFieldCallback)(void);
|
extern void (*gFieldCallback)(void);
|
||||||
extern bool8 (*gFieldCallback2)(void);
|
extern bool8 (*gFieldCallback2)(void);
|
||||||
extern u8 gUnknown_03005DB4;
|
extern u8 gLinkGuestPlayerId;
|
||||||
extern u8 gFieldLinkPlayerCount;
|
extern u8 gFieldLinkPlayerCount;
|
||||||
|
|
||||||
// Exported ROM declarations
|
// Exported ROM declarations
|
||||||
|
@ -43,7 +43,7 @@ struct TrainerCard
|
|||||||
extern struct TrainerCard gTrainerCards[4];
|
extern struct TrainerCard gTrainerCards[4];
|
||||||
|
|
||||||
u32 CountPlayerTrainerStars(void);
|
u32 CountPlayerTrainerStars(void);
|
||||||
u8 sub_80C4904(u8 cardId);
|
u8 GetTrainerCardStars(u8 cardId);
|
||||||
void CopyTrainerCardData(struct TrainerCard *dst, u16 *src, u8 gameVersion);
|
void CopyTrainerCardData(struct TrainerCard *dst, u16 *src, u8 gameVersion);
|
||||||
void ShowPlayerTrainerCard(void (*callback)(void));
|
void ShowPlayerTrainerCard(void (*callback)(void));
|
||||||
void ShowTrainerCardInLink(u8 arg0, void (*callback)(void));
|
void ShowTrainerCardInLink(u8 arg0, void (*callback)(void));
|
||||||
|
@ -352,7 +352,7 @@ static void sub_80B2918(u8 taskId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gFieldLinkPlayerCount = GetLinkPlayerCount_2();
|
gFieldLinkPlayerCount = GetLinkPlayerCount_2();
|
||||||
gUnknown_03005DB4 = GetMultiplayerId();
|
gLinkGuestPlayerId = GetMultiplayerId();
|
||||||
sub_800AA04(gFieldLinkPlayerCount);
|
sub_800AA04(gFieldLinkPlayerCount);
|
||||||
card = (struct TrainerCard *)gBlockSendBuffer;
|
card = (struct TrainerCard *)gBlockSendBuffer;
|
||||||
TrainerCard_GenerateCardForPlayer(card);
|
TrainerCard_GenerateCardForPlayer(card);
|
||||||
@ -399,7 +399,7 @@ static void sub_80B2A08(u8 taskId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gFieldLinkPlayerCount = GetLinkPlayerCount_2();
|
gFieldLinkPlayerCount = GetLinkPlayerCount_2();
|
||||||
gUnknown_03005DB4 = GetMultiplayerId();
|
gLinkGuestPlayerId = GetMultiplayerId();
|
||||||
sub_800AA04(gFieldLinkPlayerCount);
|
sub_800AA04(gFieldLinkPlayerCount);
|
||||||
card = (struct TrainerCard *)gBlockSendBuffer;
|
card = (struct TrainerCard *)gBlockSendBuffer;
|
||||||
TrainerCard_GenerateCardForPlayer(card);
|
TrainerCard_GenerateCardForPlayer(card);
|
||||||
@ -972,7 +972,7 @@ void sub_80B360C(void)
|
|||||||
|
|
||||||
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2)
|
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2)
|
||||||
{
|
{
|
||||||
UpdatePlayerLinkBattleRecords(gUnknown_03005DB4 ^ 1);
|
UpdatePlayerLinkBattleRecords(gLinkGuestPlayerId ^ 1);
|
||||||
if (gWirelessCommType)
|
if (gWirelessCommType)
|
||||||
{
|
{
|
||||||
switch (gBattleOutcome)
|
switch (gBattleOutcome)
|
||||||
@ -1177,14 +1177,16 @@ void sp02A_crash_sound(void)
|
|||||||
ShowTrainerCardInLink(gSpecialVar_0x8006, CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
ShowTrainerCardInLink(gSpecialVar_0x8006, CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 sub_80B39D4(u8 linkPlayerIndex)
|
// Returns FALSE if the player has no stars. Returns TRUE otherwise, and puts the name of the
|
||||||
|
// color into gStringVar2.
|
||||||
|
bool32 GetLinkTrainerCardColor(u8 linkPlayerIndex)
|
||||||
{
|
{
|
||||||
u32 trainerCardColorIndex;
|
u32 trainerCardColorIndex;
|
||||||
|
|
||||||
gSpecialVar_0x8006 = linkPlayerIndex;
|
gSpecialVar_0x8006 = linkPlayerIndex;
|
||||||
StringCopy(gStringVar1, gLinkPlayers[linkPlayerIndex].name);
|
StringCopy(gStringVar1, gLinkPlayers[linkPlayerIndex].name);
|
||||||
|
|
||||||
trainerCardColorIndex = sub_80C4904(linkPlayerIndex);
|
trainerCardColorIndex = GetTrainerCardStars(linkPlayerIndex);
|
||||||
if (trainerCardColorIndex == 0)
|
if (trainerCardColorIndex == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
327
src/overworld.c
327
src/overworld.c
@ -66,13 +66,33 @@
|
|||||||
#include "constants/species.h"
|
#include "constants/species.h"
|
||||||
#include "constants/weather.h"
|
#include "constants/weather.h"
|
||||||
|
|
||||||
|
#define LINK_CONSTANT_UNK_1 0x11
|
||||||
|
#define LINK_CONSTANT_DPAD_DOWN 0x12
|
||||||
|
#define LINK_CONSTANT_DPAD_UP 0x13
|
||||||
|
#define LINK_CONSTANT_DPAD_LEFT 0x14
|
||||||
|
#define LINK_CONSTANT_DPAD_RIGHT 0x15
|
||||||
|
#define LINK_CONSTANT_UNK_2 0x16
|
||||||
|
#define LINK_CONSTANT_UNK_3 0x17
|
||||||
|
#define LINK_CONSTANT_START_BUTTON 0x18
|
||||||
|
#define LINK_CONSTANT_A_BUTTON 0x19
|
||||||
|
#define LINK_CONSTANT_UNK_4 0x1A // I'd guess this is the B button?
|
||||||
|
#define LINK_CONSTANT_UNK_5 0x1B
|
||||||
|
#define LINK_CONSTANT_UNK_6 0x1C
|
||||||
|
#define LINK_CONSTANT_UNK_7 0x1D
|
||||||
|
#define LINK_CONSTANT_UNK_8 0x1E
|
||||||
|
|
||||||
|
#define TRAINER_TRADING_STATE_IDLE 0x80
|
||||||
|
#define TRAINER_TRADING_STATE_UNK_1 0x81
|
||||||
|
#define TRAINER_TRADING_STATE_UNK_2 0x82
|
||||||
|
#define TRAINER_TRADING_STATE_UNK_3 0x83
|
||||||
|
|
||||||
// event scripts
|
// event scripts
|
||||||
extern const u8 EventScript_WhiteOut[];
|
extern const u8 EventScript_WhiteOut[];
|
||||||
extern const u8 EventScript_271862[];
|
extern const u8 EventScript_271862[];
|
||||||
extern const u8 EventScript_277513[];
|
extern const u8 EventScript_277513[];
|
||||||
extern const u8 EventScript_TradeRoom_TooBusyToNotice[];
|
extern const u8 EventScript_TradeRoom_TooBusyToNotice[];
|
||||||
extern const u8 EventScript_TradeRoom_ReadTrainerCard1[];
|
extern const u8 EventScript_TradeRoom_ReadTrainerCard_NoColor[];
|
||||||
extern const u8 EventScript_TradeRoom_ReadTrainerCard2[];
|
extern const u8 EventScript_TradeRoom_ReadTrainerCard_Normal[];
|
||||||
extern const u8 gUnknown_08277388[];
|
extern const u8 gUnknown_08277388[];
|
||||||
extern const u8 gUnknown_082773A3[];
|
extern const u8 gUnknown_082773A3[];
|
||||||
extern const u8 gUnknown_082773BE[];
|
extern const u8 gUnknown_082773BE[];
|
||||||
@ -106,21 +126,21 @@ static bool32 load_map_stuff(u8 *state, u32);
|
|||||||
static bool32 map_loading_iteration_2_link(u8 *state);
|
static bool32 map_loading_iteration_2_link(u8 *state);
|
||||||
static void mli4_mapscripts_and_other(void);
|
static void mli4_mapscripts_and_other(void);
|
||||||
static void InitOverworldGraphicsRegisters(void);
|
static void InitOverworldGraphicsRegisters(void);
|
||||||
static u8 sub_8087858(u8);
|
static u8 GetSpriteForLinkedPlayer(u8);
|
||||||
static u16 sub_80871C0(u32 a1);
|
static u16 sub_80871C0(u32 a1);
|
||||||
static void sub_80867C8(void);
|
static void sub_80867C8(void);
|
||||||
static void sub_80867D8(void);
|
static void sub_80867D8(void);
|
||||||
static void sub_8086AE4(void);
|
static void sub_8086AE4(void);
|
||||||
static void sub_80869DC(void);
|
static void sub_80869DC(void);
|
||||||
static void sub_8086B14(void);
|
static void sub_8086B14(void);
|
||||||
static void sub_8086AAC(void);
|
static void SetCameraToTrackGuestPlayer(void);
|
||||||
static void sub_8086988(bool32 arg0);
|
static void sub_8086988(bool32 arg0);
|
||||||
static void sub_8086A80(void);
|
static void sub_8086A80(void);
|
||||||
static void sub_8086A68(void);
|
static void sub_8086A68(void);
|
||||||
static void sub_8086860(void);
|
static void sub_8086860(void);
|
||||||
static void sub_8086AC8(void);
|
static void SetCameraToTrackGuestPlayer_2(void);
|
||||||
static void sub_8086B9C(void);
|
static void sub_8086B9C(void);
|
||||||
static void sub_8086C40(void);
|
static void guess_ResetHeldKeys(void);
|
||||||
static void sub_8086C90(void);
|
static void sub_8086C90(void);
|
||||||
static void sub_8086FA0(u16);
|
static void sub_8086FA0(u16);
|
||||||
static void sub_8086F38(u16*, s32);
|
static void sub_8086F38(u16*, s32);
|
||||||
@ -138,26 +158,26 @@ static void SpawnLinkPlayerEventObject(u8 linkPlayerId, s16 x, s16 y, u8 a4);
|
|||||||
static void InitLinkPlayerEventObjectPos(struct EventObject *eventObj, s16 x, s16 y);
|
static void InitLinkPlayerEventObjectPos(struct EventObject *eventObj, s16 x, s16 y);
|
||||||
static void sub_80877DC(u8 linkPlayerId, u8 a2);
|
static void sub_80877DC(u8 linkPlayerId, u8 a2);
|
||||||
static void sub_808780C(u8 linkPlayerId);
|
static void sub_808780C(u8 linkPlayerId);
|
||||||
static u8 sub_8087858(u8 linkPlayerId);
|
static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId);
|
||||||
static void sub_8087584(void);
|
static void sub_8087584(void);
|
||||||
static u32 sub_8087690(void);
|
static u32 GetLinkEventQueueLength(void);
|
||||||
static void ZeroLinkPlayerEventObject(struct LinkPlayerEventObject *linkPlayerEventObj);
|
static void ZeroLinkPlayerEventObject(struct LinkPlayerEventObject *linkPlayerEventObj);
|
||||||
static const u8 *sub_80873B4(struct UnkStruct_8054FF8 *a1);
|
static const u8 *sub_80873B4(struct TradeRoomTrainer *a1);
|
||||||
static u16 sub_8087480(const u8 *script);
|
static u16 sub_8087480(const u8 *script);
|
||||||
static void sub_8087510(void);
|
static void sub_8087510(void);
|
||||||
static void sub_808751C(void);
|
static void sub_808751C(void);
|
||||||
static void sub_8087530(const u8 *script);
|
static void sub_8087530(const u8 *script);
|
||||||
static void sub_808754C(void);
|
static void sub_808754C(void);
|
||||||
static void sub_8087568(const u8 *script);
|
static void sub_8087568(const u8 *script);
|
||||||
static void sub_80872D8(s32 linkPlayerId, s32 a2, struct UnkStruct_8054FF8 *a3);
|
static void sub_80872D8(s32 linkPlayerId, s32 a2, struct TradeRoomTrainer *a3);
|
||||||
static bool32 sub_8087340(struct UnkStruct_8054FF8 *a1);
|
static bool32 sub_8087340(struct TradeRoomTrainer *a1);
|
||||||
static bool32 sub_8087358(struct UnkStruct_8054FF8 *a1);
|
static bool32 sub_8087358(struct TradeRoomTrainer *a1);
|
||||||
static u8 *sub_8087370(struct UnkStruct_8054FF8 *a1);
|
static u8 *sub_8087370(struct TradeRoomTrainer *a1);
|
||||||
static bool32 sub_8087388(struct UnkStruct_8054FF8 *a1);
|
static bool32 sub_8087388(struct TradeRoomTrainer *a1);
|
||||||
static const u8 *sub_80873B4(struct UnkStruct_8054FF8 *a1);
|
static const u8 *sub_80873B4(struct TradeRoomTrainer *a1);
|
||||||
static u16 sub_808711C(u32);
|
static u16 sub_808711C(u32);
|
||||||
static u16 sub_8087140(u32);
|
static u16 sub_8087140(u32);
|
||||||
static void sub_808709C(u16 *a1);
|
static void guess_ResetLinkKeys(u16 *a1);
|
||||||
static u16 sub_80870B0(u32 a1);
|
static u16 sub_80870B0(u32 a1);
|
||||||
static u16 sub_80870F8(u32 a1);
|
static u16 sub_80870F8(u32 a1);
|
||||||
static u16 sub_8087068(u16 a1);
|
static u16 sub_8087068(u16 a1);
|
||||||
@ -172,8 +192,8 @@ static u16 GetCenterScreenMetatileBehavior(void);
|
|||||||
|
|
||||||
// IWRAM bss vars
|
// IWRAM bss vars
|
||||||
IWRAM_DATA static void *sUnknown_03000E0C;
|
IWRAM_DATA static void *sUnknown_03000E0C;
|
||||||
IWRAM_DATA static u8 sUnknown_03000E10[4];
|
IWRAM_DATA static u8 sTrainerTradingStates[4];
|
||||||
IWRAM_DATA static u16 (*sUnknown_03000E14)(u32);
|
IWRAM_DATA static u16 (*sguess_PlayerKeyCallback)(u32);
|
||||||
IWRAM_DATA static u8 sUnknown_03000E18;
|
IWRAM_DATA static u8 sUnknown_03000E18;
|
||||||
IWRAM_DATA static u8 sUnknown_03000E19;
|
IWRAM_DATA static u8 sUnknown_03000E19;
|
||||||
IWRAM_DATA static u32 sUnusedVar;
|
IWRAM_DATA static u32 sUnusedVar;
|
||||||
@ -185,7 +205,7 @@ u16 *gBGTilemapBuffers3;
|
|||||||
u16 gUnknown_03005DA8;
|
u16 gUnknown_03005DA8;
|
||||||
void (*gFieldCallback)(void);
|
void (*gFieldCallback)(void);
|
||||||
bool8 (*gFieldCallback2)(void);
|
bool8 (*gFieldCallback2)(void);
|
||||||
u8 gUnknown_03005DB4;
|
u8 gLinkGuestPlayerId;
|
||||||
u8 gFieldLinkPlayerCount;
|
u8 gFieldLinkPlayerCount;
|
||||||
|
|
||||||
// EWRAM vars
|
// EWRAM vars
|
||||||
@ -323,7 +343,7 @@ static u8 sub_80879D8(struct LinkPlayerEventObject *, struct EventObject *, u8);
|
|||||||
static u8 sub_80879F8(struct LinkPlayerEventObject *, struct EventObject *, u8);
|
static u8 sub_80879F8(struct LinkPlayerEventObject *, struct EventObject *, u8);
|
||||||
static u8 sub_80879FC(struct LinkPlayerEventObject *, struct EventObject *, u8);
|
static u8 sub_80879FC(struct LinkPlayerEventObject *, struct EventObject *, u8);
|
||||||
|
|
||||||
static u8 (*const gUnknown_08339DC8[])(struct LinkPlayerEventObject *, struct EventObject *, u8) =
|
static u8 (*const gLinkPlayerEventModes[])(struct LinkPlayerEventObject *, struct EventObject *, u8) =
|
||||||
{
|
{
|
||||||
sub_80879D8,
|
sub_80879D8,
|
||||||
sub_80879F8,
|
sub_80879F8,
|
||||||
@ -1100,7 +1120,7 @@ u16 GetCurrLocationDefaultMusic(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gSaveBlock1Ptr->pos.x < 24)
|
if (gSaveBlock1Ptr->pos.x < LINK_CONSTANT_START_BUTTON)
|
||||||
return MUS_DOORO_X1;
|
return MUS_DOORO_X1;
|
||||||
else
|
else
|
||||||
return MUS_GRANROAD;
|
return MUS_GRANROAD;
|
||||||
@ -1243,7 +1263,7 @@ static void PlayAmbientCry(void)
|
|||||||
&& !MetatileBehavior_IsSurfableWaterOrUnderwater(MapGridGetMetatileBehaviorAt(x, y)))
|
&& !MetatileBehavior_IsSurfableWaterOrUnderwater(MapGridGetMetatileBehaviorAt(x, y)))
|
||||||
return;
|
return;
|
||||||
pan = (Random() % 88) + 212;
|
pan = (Random() % 88) + 212;
|
||||||
volume = (Random() % 30) + 50;
|
volume = (Random() % LINK_CONSTANT_UNK_8) + 50;
|
||||||
PlayCry2(sAmbientCrySpecies, pan, volume, 1);
|
PlayCry2(sAmbientCrySpecies, pan, volume, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1810,7 +1830,7 @@ static bool32 map_loading_iteration_3(u8 *state)
|
|||||||
sub_8086AE4();
|
sub_8086AE4();
|
||||||
sub_80869DC();
|
sub_80869DC();
|
||||||
sub_8086B14();
|
sub_8086B14();
|
||||||
sub_8086AAC();
|
SetCameraToTrackGuestPlayer();
|
||||||
(*state)++;
|
(*state)++;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@ -1982,7 +2002,7 @@ static bool32 map_loading_iteration_2_link(u8 *state)
|
|||||||
case 2:
|
case 2:
|
||||||
sub_8086B9C();
|
sub_8086B9C();
|
||||||
sub_8086A68();
|
sub_8086A68();
|
||||||
sub_8086AC8();
|
SetCameraToTrackGuestPlayer_2();
|
||||||
(*state)++;
|
(*state)++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -2169,21 +2189,25 @@ static void sub_8086A80(void)
|
|||||||
InitCameraUpdateCallback(gPlayerAvatar.spriteId);
|
InitCameraUpdateCallback(gPlayerAvatar.spriteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086AAC(void)
|
static void SetCameraToTrackGuestPlayer(void)
|
||||||
{
|
{
|
||||||
InitCameraUpdateCallback(sub_8087858(gUnknown_03005DB4));
|
InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLinkGuestPlayerId));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086AC8(void)
|
// Duplicate function.
|
||||||
|
static void SetCameraToTrackGuestPlayer_2(void)
|
||||||
{
|
{
|
||||||
InitCameraUpdateCallback(sub_8087858(gUnknown_03005DB4));
|
InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLinkGuestPlayerId));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086AE4(void)
|
static void sub_8086AE4(void)
|
||||||
{
|
{
|
||||||
u16 x, y;
|
u16 x, y;
|
||||||
GetCameraFocusCoords(&x, &y);
|
GetCameraFocusCoords(&x, &y);
|
||||||
sub_8088B3C(x + gUnknown_03005DB4, y);
|
|
||||||
|
// This is a hack of some kind; it's undone in sub_8086B14, which is called
|
||||||
|
// soon after this function.
|
||||||
|
sub_8088B3C(x + gLinkGuestPlayerId, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086B14(void)
|
static void sub_8086B14(void)
|
||||||
@ -2192,7 +2216,7 @@ static void sub_8086B14(void)
|
|||||||
u16 x, y;
|
u16 x, y;
|
||||||
|
|
||||||
GetCameraFocusCoords(&x, &y);
|
GetCameraFocusCoords(&x, &y);
|
||||||
x -= gUnknown_03005DB4;
|
x -= gLinkGuestPlayerId;
|
||||||
|
|
||||||
for (i = 0; i < gFieldLinkPlayerCount; i++)
|
for (i = 0; i < gFieldLinkPlayerCount; i++)
|
||||||
{
|
{
|
||||||
@ -2200,7 +2224,7 @@ static void sub_8086B14(void)
|
|||||||
CreateLinkPlayerSprite(i, gLinkPlayers[i].version);
|
CreateLinkPlayerSprite(i, gLinkPlayers[i].version);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_8086C40();
|
guess_ResetHeldKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086B9C(void)
|
static void sub_8086B9C(void)
|
||||||
@ -2214,10 +2238,10 @@ static void c1_link_related(void)
|
|||||||
{
|
{
|
||||||
if (gWirelessCommType == 0 || !sub_800F0B8() || !sub_8009F3C())
|
if (gWirelessCommType == 0 || !sub_800F0B8() || !sub_8009F3C())
|
||||||
{
|
{
|
||||||
u8 var = gUnknown_03005DB4;
|
u8 guestId = gLinkGuestPlayerId;
|
||||||
sub_8086F38(gLinkPartnersHeldKeys, var);
|
sub_8086F38(gLinkPartnersHeldKeys, guestId);
|
||||||
sub_8086FA0(sUnknown_03000E14(var));
|
sub_8086FA0(sguess_PlayerKeyCallback(guestId));
|
||||||
sub_8086C40();
|
guess_ResetHeldKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2227,15 +2251,15 @@ void sub_8086C2C(void)
|
|||||||
c1_link_related_func_set(sub_80870B0);
|
c1_link_related_func_set(sub_80870B0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086C40(void)
|
static void guess_ResetHeldKeys(void)
|
||||||
{
|
{
|
||||||
sub_808709C(gLinkPartnersHeldKeys);
|
guess_ResetLinkKeys(gLinkPartnersHeldKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void c1_link_related_func_set(u16 (*func)(u32))
|
static void c1_link_related_func_set(u16 (*func)(u32))
|
||||||
{
|
{
|
||||||
sUnknown_03000E19 = 0;
|
sUnknown_03000E19 = 0;
|
||||||
sUnknown_03000E14 = func;
|
sguess_PlayerKeyCallback = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086C64(void)
|
static void sub_8086C64(void)
|
||||||
@ -2248,7 +2272,7 @@ static void sub_8086C90(void)
|
|||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
sUnknown_03000E10[i] = 0x80;
|
sTrainerTradingStates[i] = TRAINER_TRADING_STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 sub_8086CA8(u16 a1)
|
static bool32 sub_8086CA8(u16 a1)
|
||||||
@ -2257,7 +2281,7 @@ static bool32 sub_8086CA8(u16 a1)
|
|||||||
s32 count = gFieldLinkPlayerCount;
|
s32 count = gFieldLinkPlayerCount;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
if (sUnknown_03000E10[i] != a1)
|
if (sTrainerTradingStates[i] != a1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2268,23 +2292,23 @@ static bool32 sub_8086CE0(u16 a1)
|
|||||||
s32 count = gFieldLinkPlayerCount;
|
s32 count = gFieldLinkPlayerCount;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
if (sUnknown_03000E10[i] == a1)
|
if (sTrainerTradingStates[i] == a1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086D18(u32 a1, u16 a2, struct UnkStruct_8054FF8 *a3, u16 *a4)
|
static void sub_8086D18(u32 playerId, u16 key, struct TradeRoomTrainer *trainer, u16 *a4)
|
||||||
{
|
{
|
||||||
const u8 *script;
|
const u8 *script;
|
||||||
|
|
||||||
if (sUnknown_03000E10[a1] == 0x80)
|
if (sTrainerTradingStates[playerId] == TRAINER_TRADING_STATE_IDLE)
|
||||||
{
|
{
|
||||||
script = sub_8087370(a3);
|
script = sub_8087370(trainer);
|
||||||
if (script)
|
if (script)
|
||||||
{
|
{
|
||||||
*a4 = sub_8087480(script);
|
*a4 = sub_8087480(script);
|
||||||
sUnknown_03000E10[a1] = 0x81;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_1;
|
||||||
if (a3->b)
|
if (trainer->b)
|
||||||
{
|
{
|
||||||
c1_link_related_func_set(sub_80870F8);
|
c1_link_related_func_set(sub_80870F8);
|
||||||
sub_8087530(script);
|
sub_8087530(script);
|
||||||
@ -2293,66 +2317,67 @@ static void sub_8086D18(u32 a1, u16 a2, struct UnkStruct_8054FF8 *a3, u16 *a4)
|
|||||||
}
|
}
|
||||||
if (sub_8086CE0(0x83) == 1)
|
if (sub_8086CE0(0x83) == 1)
|
||||||
{
|
{
|
||||||
sUnknown_03000E10[a1] = 0x81;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_1;
|
||||||
if (a3->b)
|
if (trainer->b)
|
||||||
{
|
{
|
||||||
c1_link_related_func_set(sub_80870F8);
|
c1_link_related_func_set(sub_80870F8);
|
||||||
sub_8087584();
|
sub_8087584();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (a2)
|
|
||||||
|
switch (key)
|
||||||
{
|
{
|
||||||
case 24:
|
case LINK_CONSTANT_START_BUTTON:
|
||||||
if (sub_8087358(a3))
|
if (sub_8087358(trainer))
|
||||||
{
|
{
|
||||||
sUnknown_03000E10[a1] = 0x81;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_1;
|
||||||
if (a3->b)
|
if (trainer->b)
|
||||||
{
|
{
|
||||||
c1_link_related_func_set(sub_80870F8);
|
c1_link_related_func_set(sub_80870F8);
|
||||||
sub_808751C();
|
sub_808751C();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 18:
|
case LINK_CONSTANT_DPAD_DOWN:
|
||||||
if (sub_8087388(a3) == TRUE)
|
if (sub_8087388(trainer) == TRUE)
|
||||||
{
|
{
|
||||||
sUnknown_03000E10[a1] = 0x81;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_1;
|
||||||
if (a3->b)
|
if (trainer->b)
|
||||||
{
|
{
|
||||||
c1_link_related_func_set(sub_80870F8);
|
c1_link_related_func_set(sub_80870F8);
|
||||||
sub_808754C();
|
sub_808754C();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 25:
|
case LINK_CONSTANT_A_BUTTON:
|
||||||
script = sub_80873B4(a3);
|
script = sub_80873B4(trainer);
|
||||||
if (script)
|
if (script)
|
||||||
{
|
{
|
||||||
sUnknown_03000E10[a1] = 0x81;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_1;
|
||||||
if (a3->b)
|
if (trainer->b)
|
||||||
{
|
{
|
||||||
c1_link_related_func_set(sub_80870F8);
|
c1_link_related_func_set(sub_80870F8);
|
||||||
sub_8087568(script);
|
sub_8087568(script);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 27:
|
case LINK_CONSTANT_UNK_5:
|
||||||
if (sub_8087340(a3))
|
if (sub_8087340(trainer))
|
||||||
{
|
{
|
||||||
sUnknown_03000E10[a1] = 0x81;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_1;
|
||||||
if (a3->b)
|
if (trainer->b)
|
||||||
{
|
{
|
||||||
c1_link_related_func_set(sub_808711C);
|
c1_link_related_func_set(sub_808711C);
|
||||||
sub_8087510();
|
sub_8087510();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 28:
|
case LINK_CONSTANT_UNK_6:
|
||||||
if (sub_8087340(a3))
|
if (sub_8087340(trainer))
|
||||||
{
|
{
|
||||||
sUnknown_03000E10[a1] = 0x81;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_1;
|
||||||
if (a3->b)
|
if (trainer->b)
|
||||||
{
|
{
|
||||||
c1_link_related_func_set(sub_8087140);
|
c1_link_related_func_set(sub_8087140);
|
||||||
sub_8087510();
|
sub_8087510();
|
||||||
@ -2362,64 +2387,64 @@ static void sub_8086D18(u32 a1, u16 a2, struct UnkStruct_8054FF8 *a3, u16 *a4)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (a2)
|
switch (key)
|
||||||
{
|
{
|
||||||
case 23:
|
case LINK_CONSTANT_UNK_3:
|
||||||
sUnknown_03000E10[a1] = 0x83;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_3;
|
||||||
break;
|
break;
|
||||||
case 22:
|
case LINK_CONSTANT_UNK_2:
|
||||||
sUnknown_03000E10[a1] = 0x82;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_2;
|
||||||
break;
|
break;
|
||||||
case 26:
|
case LINK_CONSTANT_UNK_4:
|
||||||
sUnknown_03000E10[a1] = 0x80;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_IDLE;
|
||||||
if (a3->b)
|
if (trainer->b)
|
||||||
c1_link_related_func_set(sub_80870B0);
|
c1_link_related_func_set(sub_80870B0);
|
||||||
break;
|
break;
|
||||||
case 29:
|
case LINK_CONSTANT_UNK_7:
|
||||||
if (sUnknown_03000E10[a1] == 0x82)
|
if (sTrainerTradingStates[playerId] == TRAINER_TRADING_STATE_UNK_2)
|
||||||
sUnknown_03000E10[a1] = 0x81;
|
sTrainerTradingStates[playerId] = TRAINER_TRADING_STATE_UNK_1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086F38(u16 *a1, s32 a2)
|
static void sub_8086F38(u16 *keys, s32 guestId)
|
||||||
{
|
{
|
||||||
struct UnkStruct_8054FF8 st;
|
struct TradeRoomTrainer trainer;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
u8 v5 = a1[i];
|
u8 key = keys[i];
|
||||||
u16 v8 = 0;
|
u16 v8 = 0;
|
||||||
sub_80872D8(i, a2, &st);
|
sub_80872D8(i, guestId, &trainer);
|
||||||
sub_8086D18(i, v5, &st, &v8);
|
sub_8086D18(i, key, &trainer, &v8);
|
||||||
if (sUnknown_03000E10[i] == 0x80)
|
if (sTrainerTradingStates[i] == TRAINER_TRADING_STATE_IDLE)
|
||||||
v8 = sub_8087068(v5);
|
v8 = sub_8087068(key);
|
||||||
sub_808796C(i, v8);
|
sub_808796C(i, v8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086FA0(u16 a1)
|
static void sub_8086FA0(u16 a1)
|
||||||
{
|
{
|
||||||
if (a1 >= 17 && a1 < 30)
|
if (a1 >= LINK_CONSTANT_UNK_1 && a1 < LINK_CONSTANT_UNK_8)
|
||||||
gUnknown_03005DA8 = a1;
|
gUnknown_03005DA8 = a1;
|
||||||
else
|
else
|
||||||
gUnknown_03005DA8 = 17;
|
gUnknown_03005DA8 = LINK_CONSTANT_UNK_1;
|
||||||
|
|
||||||
if (gWirelessCommType != 0
|
if (gWirelessCommType != 0
|
||||||
&& sub_8087690() > 1
|
&& GetLinkEventQueueLength() > 1
|
||||||
&& is_c1_link_related_active() == TRUE
|
&& is_c1_link_related_active() == TRUE
|
||||||
&& sub_8009F3C() == TRUE)
|
&& sub_8009F3C() == TRUE)
|
||||||
{
|
{
|
||||||
switch (a1)
|
switch (a1)
|
||||||
{
|
{
|
||||||
case 17:
|
case LINK_CONSTANT_UNK_1:
|
||||||
case 18:
|
case LINK_CONSTANT_DPAD_DOWN:
|
||||||
case 19:
|
case LINK_CONSTANT_DPAD_UP:
|
||||||
case 20:
|
case LINK_CONSTANT_DPAD_LEFT:
|
||||||
case 21:
|
case LINK_CONSTANT_DPAD_RIGHT:
|
||||||
case 24:
|
case LINK_CONSTANT_START_BUTTON:
|
||||||
case 25:
|
case LINK_CONSTANT_A_BUTTON:
|
||||||
gUnknown_03005DA8 = 0;
|
gUnknown_03005DA8 = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2429,52 +2454,53 @@ static void sub_8086FA0(u16 a1)
|
|||||||
static u16 sub_808700C(u32 a1)
|
static u16 sub_808700C(u32 a1)
|
||||||
{
|
{
|
||||||
if (gMain.heldKeys & DPAD_UP)
|
if (gMain.heldKeys & DPAD_UP)
|
||||||
return 19;
|
return LINK_CONSTANT_DPAD_UP;
|
||||||
else if (gMain.heldKeys & DPAD_DOWN)
|
else if (gMain.heldKeys & DPAD_DOWN)
|
||||||
return 18;
|
return LINK_CONSTANT_DPAD_DOWN;
|
||||||
else if (gMain.heldKeys & DPAD_LEFT)
|
else if (gMain.heldKeys & DPAD_LEFT)
|
||||||
return 20;
|
return LINK_CONSTANT_DPAD_LEFT;
|
||||||
else if (gMain.heldKeys & DPAD_RIGHT)
|
else if (gMain.heldKeys & DPAD_RIGHT)
|
||||||
return 21;
|
return LINK_CONSTANT_DPAD_RIGHT;
|
||||||
else if (gMain.newKeys & START_BUTTON)
|
else if (gMain.newKeys & START_BUTTON)
|
||||||
return 24;
|
return LINK_CONSTANT_START_BUTTON;
|
||||||
else if (gMain.newKeys & A_BUTTON)
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
return 25;
|
return LINK_CONSTANT_A_BUTTON;
|
||||||
else
|
else
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sub_8087068(u16 a1)
|
static u16 sub_8087068(u16 a1)
|
||||||
{
|
{
|
||||||
switch (a1)
|
switch (a1)
|
||||||
{
|
{
|
||||||
case 21:
|
case LINK_CONSTANT_DPAD_RIGHT:
|
||||||
return 4;
|
return 4;
|
||||||
case 20:
|
case LINK_CONSTANT_DPAD_LEFT:
|
||||||
return 3;
|
return 3;
|
||||||
case 19:
|
case LINK_CONSTANT_DPAD_UP:
|
||||||
return 1;
|
return 1;
|
||||||
case 18:
|
case LINK_CONSTANT_DPAD_DOWN:
|
||||||
return 2;
|
return 2;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_808709C(u16 *a1)
|
// Overwrites the keys with 0x11
|
||||||
|
static void guess_ResetLinkKeys(u16 *keys)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
a1[i] = 17;
|
keys[i] = LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sub_80870B0(u32 a1)
|
static u16 sub_80870B0(u32 a1)
|
||||||
{
|
{
|
||||||
if (ScriptContext2_IsEnabled() == 1)
|
if (ScriptContext2_IsEnabled() == 1)
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
if (sub_800B4DC() > 4)
|
if (sub_800B4DC() > 4)
|
||||||
return 27;
|
return 27;
|
||||||
if (sub_8087690() <= 4)
|
if (GetLinkEventQueueLength() <= 4)
|
||||||
return sub_808700C(a1);
|
return sub_808700C(a1);
|
||||||
return 28;
|
return 28;
|
||||||
}
|
}
|
||||||
@ -2482,7 +2508,7 @@ static u16 sub_80870B0(u32 a1)
|
|||||||
static u16 sub_80870EC(u32 a1)
|
static u16 sub_80870EC(u32 a1)
|
||||||
{
|
{
|
||||||
sub_8086C64();
|
sub_8086C64();
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sub_80870F8(u32 a1)
|
static u16 sub_80870F8(u32 a1)
|
||||||
@ -2490,7 +2516,7 @@ static u16 sub_80870F8(u32 a1)
|
|||||||
u16 retVal;
|
u16 retVal;
|
||||||
if (ScriptContext2_IsEnabled() == TRUE)
|
if (ScriptContext2_IsEnabled() == TRUE)
|
||||||
{
|
{
|
||||||
retVal = 17;
|
retVal = LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2505,7 +2531,7 @@ static u16 sub_808711C(u32 a1)
|
|||||||
u16 retVal;
|
u16 retVal;
|
||||||
if (sub_800B4DC() > 2)
|
if (sub_800B4DC() > 2)
|
||||||
{
|
{
|
||||||
retVal = 17;
|
retVal = LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2519,9 +2545,9 @@ static u16 sub_808711C(u32 a1)
|
|||||||
static u16 sub_8087140(u32 a1)
|
static u16 sub_8087140(u32 a1)
|
||||||
{
|
{
|
||||||
u16 retVal;
|
u16 retVal;
|
||||||
if (sub_8087690() > 2)
|
if (GetLinkEventQueueLength() > 2)
|
||||||
{
|
{
|
||||||
retVal = 17;
|
retVal = LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2535,12 +2561,12 @@ static u16 sub_8087140(u32 a1)
|
|||||||
static u16 sub_8087164(u32 a1)
|
static u16 sub_8087164(u32 a1)
|
||||||
{
|
{
|
||||||
sub_8086C64();
|
sub_8086C64();
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sub_8087170(u32 linkPlayerId)
|
static u16 sub_8087170(u32 linkPlayerId)
|
||||||
{
|
{
|
||||||
if (sUnknown_03000E10[linkPlayerId] == 0x82)
|
if (sTrainerTradingStates[linkPlayerId] == TRAINER_TRADING_STATE_UNK_2)
|
||||||
{
|
{
|
||||||
if (gMain.newKeys & B_BUTTON)
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
@ -2549,13 +2575,13 @@ static u16 sub_8087170(u32 linkPlayerId)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sub_8086C64();
|
sub_8086C64();
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2567,19 +2593,19 @@ static u16 sub_80871AC(u32 a1)
|
|||||||
|
|
||||||
static u16 sub_80871C0(u32 a1)
|
static u16 sub_80871C0(u32 a1)
|
||||||
{
|
{
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sub_80871C4(u32 a1)
|
static u16 sub_80871C4(u32 a1)
|
||||||
{
|
{
|
||||||
if (sUnknown_03000E10[a1] != 0x83)
|
if (sTrainerTradingStates[a1] != TRAINER_TRADING_STATE_UNK_3)
|
||||||
sub_8086C64();
|
sub_8086C64();
|
||||||
if (sub_8086CA8(0x83) == TRUE)
|
if (sub_8086CA8(TRAINER_TRADING_STATE_UNK_3) == TRUE)
|
||||||
{
|
{
|
||||||
ScriptContext1_SetupScript(EventScript_277513);
|
ScriptContext1_SetupScript(EventScript_277513);
|
||||||
c1_link_related_func_set(sub_80871C0);
|
c1_link_related_func_set(sub_80871C0);
|
||||||
}
|
}
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sub_80871FC(u32 a1)
|
static u16 sub_80871FC(u32 a1)
|
||||||
@ -2590,16 +2616,16 @@ static u16 sub_80871FC(u32 a1)
|
|||||||
|
|
||||||
static u16 sub_8087210(u32 a1)
|
static u16 sub_8087210(u32 a1)
|
||||||
{
|
{
|
||||||
return 17;
|
return LINK_CONSTANT_UNK_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sub_8087214(void)
|
u32 sub_8087214(void)
|
||||||
{
|
{
|
||||||
if (sub_8086CE0(0x83) == TRUE)
|
if (sub_8086CE0(0x83) == TRUE)
|
||||||
return 2;
|
return 2;
|
||||||
if (sUnknown_03000E14 == sub_8087170 && sUnknown_03000E10[gUnknown_03005DB4] != 0x82)
|
if (sguess_PlayerKeyCallback == sub_8087170 && sTrainerTradingStates[gLinkGuestPlayerId] != TRAINER_TRADING_STATE_UNK_2)
|
||||||
return 0;
|
return 0;
|
||||||
if (sUnknown_03000E14 == sub_8087164 && sUnknown_03000E10[gUnknown_03005DB4] == 0x81)
|
if (sguess_PlayerKeyCallback == sub_8087164 && sTrainerTradingStates[gLinkGuestPlayerId] == TRAINER_TRADING_STATE_UNK_1)
|
||||||
return 2;
|
return 2;
|
||||||
if (sub_8086CA8(0x82) != 0)
|
if (sub_8086CA8(0x82) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
@ -2635,14 +2661,14 @@ u16 sub_80872C4(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80872D8(s32 linkPlayerId, s32 a2, struct UnkStruct_8054FF8 *a3)
|
static void sub_80872D8(s32 linkPlayerId, s32 a2, struct TradeRoomTrainer *a3)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
|
|
||||||
a3->a = linkPlayerId;
|
a3->a = linkPlayerId;
|
||||||
a3->b = (linkPlayerId == a2) ? 1 : 0;
|
a3->b = (linkPlayerId == a2) ? 1 : 0;
|
||||||
a3->c = gLinkPlayerEventObjects[linkPlayerId].mode;
|
a3->c = gLinkPlayerEventObjects[linkPlayerId].mode;
|
||||||
a3->d = sub_80878A0(linkPlayerId);
|
a3->facing = sub_80878A0(linkPlayerId);
|
||||||
sub_8087878(linkPlayerId, &x, &y);
|
sub_8087878(linkPlayerId, &x, &y);
|
||||||
a3->sub.x = x;
|
a3->sub.x = x;
|
||||||
a3->sub.y = y;
|
a3->sub.y = y;
|
||||||
@ -2650,7 +2676,7 @@ static void sub_80872D8(s32 linkPlayerId, s32 a2, struct UnkStruct_8054FF8 *a3)
|
|||||||
a3->field_C = MapGridGetMetatileBehaviorAt(x, y);
|
a3->field_C = MapGridGetMetatileBehaviorAt(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 sub_8087340(struct UnkStruct_8054FF8 *a1)
|
static bool32 sub_8087340(struct TradeRoomTrainer *a1)
|
||||||
{
|
{
|
||||||
u8 v1 = a1->c;
|
u8 v1 = a1->c;
|
||||||
if (v1 == 2 || v1 == 0)
|
if (v1 == 2 || v1 == 0)
|
||||||
@ -2659,7 +2685,7 @@ static bool32 sub_8087340(struct UnkStruct_8054FF8 *a1)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 sub_8087358(struct UnkStruct_8054FF8 *a1)
|
static bool32 sub_8087358(struct TradeRoomTrainer *a1)
|
||||||
{
|
{
|
||||||
u8 v1 = a1->c;
|
u8 v1 = a1->c;
|
||||||
if (v1 == 2 || v1 == 0)
|
if (v1 == 2 || v1 == 0)
|
||||||
@ -2668,26 +2694,26 @@ static bool32 sub_8087358(struct UnkStruct_8054FF8 *a1)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 *sub_8087370(struct UnkStruct_8054FF8 *a1)
|
static u8 *sub_8087370(struct TradeRoomTrainer *a1)
|
||||||
{
|
{
|
||||||
if (a1->c != 2)
|
if (a1->c != 2)
|
||||||
return 0;
|
return 0;
|
||||||
return GetCoordEventScriptAtMapPosition(&a1->sub);
|
return GetCoordEventScriptAtMapPosition(&a1->sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 sub_8087388(struct UnkStruct_8054FF8 *a1)
|
static bool32 sub_8087388(struct TradeRoomTrainer *a1)
|
||||||
{
|
{
|
||||||
if (a1->c != 2 && a1->c != 0)
|
if (a1->c != 2 && a1->c != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (!MetatileBehavior_IsSouthArrowWarp(a1->field_C))
|
else if (!MetatileBehavior_IsSouthArrowWarp(a1->field_C))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (a1->d != 1)
|
else if (a1->facing != 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else
|
else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u8 *sub_80873B4(struct UnkStruct_8054FF8 *a1)
|
static const u8 *sub_80873B4(struct TradeRoomTrainer *a1)
|
||||||
{
|
{
|
||||||
struct MapPosition unkStruct;
|
struct MapPosition unkStruct;
|
||||||
u8 linkPlayerId;
|
u8 linkPlayerId;
|
||||||
@ -2696,8 +2722,8 @@ static const u8 *sub_80873B4(struct UnkStruct_8054FF8 *a1)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unkStruct = a1->sub;
|
unkStruct = a1->sub;
|
||||||
unkStruct.x += gDirectionToVectors[a1->d].x;
|
unkStruct.x += gDirectionToVectors[a1->facing].x;
|
||||||
unkStruct.y += gDirectionToVectors[a1->d].y;
|
unkStruct.y += gDirectionToVectors[a1->facing].y;
|
||||||
unkStruct.height = 0;
|
unkStruct.height = 0;
|
||||||
linkPlayerId = GetLinkPlayerIdAt(unkStruct.x, unkStruct.y);
|
linkPlayerId = GetLinkPlayerIdAt(unkStruct.x, unkStruct.y);
|
||||||
|
|
||||||
@ -2705,15 +2731,15 @@ static const u8 *sub_80873B4(struct UnkStruct_8054FF8 *a1)
|
|||||||
{
|
{
|
||||||
if (!a1->b)
|
if (!a1->b)
|
||||||
return EventScript_TradeRoom_TooBusyToNotice;
|
return EventScript_TradeRoom_TooBusyToNotice;
|
||||||
else if (sUnknown_03000E10[linkPlayerId] != 0x80)
|
else if (sTrainerTradingStates[linkPlayerId] != TRAINER_TRADING_STATE_IDLE)
|
||||||
return EventScript_TradeRoom_TooBusyToNotice;
|
return EventScript_TradeRoom_TooBusyToNotice;
|
||||||
else if (!sub_80B39D4(linkPlayerId))
|
else if (!GetLinkTrainerCardColor(linkPlayerId))
|
||||||
return EventScript_TradeRoom_ReadTrainerCard1;
|
return EventScript_TradeRoom_ReadTrainerCard_NoColor;
|
||||||
else
|
else
|
||||||
return EventScript_TradeRoom_ReadTrainerCard2;
|
return EventScript_TradeRoom_ReadTrainerCard_Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetInteractedLinkPlayerScript(&unkStruct, a1->field_C, a1->d);
|
return GetInteractedLinkPlayerScript(&unkStruct, a1->field_C, a1->facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sub_8087480(const u8 *script)
|
static u16 sub_8087480(const u8 *script)
|
||||||
@ -2806,9 +2832,9 @@ bool32 sub_80875C8(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
else if (sub_8009F3C() != TRUE)
|
else if (sub_8009F3C() != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (sUnknown_03000E14 == sub_808711C)
|
else if (sguess_PlayerKeyCallback == sub_808711C)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else if (sUnknown_03000E14 != sub_80870F8)
|
else if (sguess_PlayerKeyCallback != sub_80870F8)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
temp = sUnknown_03000E18;
|
temp = sUnknown_03000E18;
|
||||||
@ -2824,13 +2850,13 @@ bool32 sub_80875C8(void)
|
|||||||
|
|
||||||
bool32 sub_8087634(void)
|
bool32 sub_8087634(void)
|
||||||
{
|
{
|
||||||
if (sub_8087690() < 2)
|
if (GetLinkEventQueueLength() < 2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (is_c1_link_related_active() != TRUE)
|
else if (is_c1_link_related_active() != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (sub_8009F3C() != TRUE)
|
else if (sub_8009F3C() != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (sUnknown_03000E14 == sub_8087140)
|
else if (sguess_PlayerKeyCallback == sub_8087140)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2846,7 +2872,7 @@ bool32 sub_808766C(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sub_8087690(void)
|
static u32 GetLinkEventQueueLength(void)
|
||||||
{
|
{
|
||||||
if (gWirelessCommType != 0)
|
if (gWirelessCommType != 0)
|
||||||
return gUnknown_03005000.unk_9e8.unk_232;
|
return gUnknown_03005000.unk_9e8.unk_232;
|
||||||
@ -2923,7 +2949,8 @@ static void sub_808780C(u8 linkPlayerId)
|
|||||||
eventObj->active = 0;
|
eventObj->active = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_8087858(u8 linkPlayerId)
|
// Returns the spriteId corresponding to this player.
|
||||||
|
static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId)
|
||||||
{
|
{
|
||||||
u8 eventObjId = gLinkPlayerEventObjects[linkPlayerId].eventObjId;
|
u8 eventObjId = gLinkPlayerEventObjects[linkPlayerId].eventObjId;
|
||||||
struct EventObject *eventObj = &gEventObjects[eventObjId];
|
struct EventObject *eventObj = &gEventObjects[eventObjId];
|
||||||
@ -2986,7 +3013,7 @@ static void sub_808796C(u8 linkPlayerId, u8 a2)
|
|||||||
if (a2 > 10)
|
if (a2 > 10)
|
||||||
eventObj->triggerGroundEffectsOnMove = 1;
|
eventObj->triggerGroundEffectsOnMove = 1;
|
||||||
else
|
else
|
||||||
gUnknown_08339E00[gUnknown_08339DC8[linkPlayerEventObj->mode](linkPlayerEventObj, eventObj, a2)](linkPlayerEventObj, eventObj);
|
gUnknown_08339E00[gLinkPlayerEventModes[linkPlayerEventObj->mode](linkPlayerEventObj, eventObj, a2)](linkPlayerEventObj, eventObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ extern u8 gUnknown_02022C3E;
|
|||||||
extern u16 gUnknown_02022C3C;
|
extern u16 gUnknown_02022C3C;
|
||||||
extern u8 gUnknown_02022C20[];
|
extern u8 gUnknown_02022C20[];
|
||||||
extern u8 gFieldLinkPlayerCount;
|
extern u8 gFieldLinkPlayerCount;
|
||||||
extern u8 gUnknown_03005DB4;
|
extern u8 gLinkGuestPlayerId;
|
||||||
|
|
||||||
// IWRAM vars
|
// IWRAM vars
|
||||||
IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0;
|
IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0;
|
||||||
@ -1641,7 +1641,7 @@ void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
|
|||||||
gSpecialVar_0x8004 = arg4;
|
gSpecialVar_0x8004 = arg4;
|
||||||
VarSet(VAR_0x4087, arg4);
|
VarSet(VAR_0x4087, arg4);
|
||||||
gFieldLinkPlayerCount = GetLinkPlayerCount();
|
gFieldLinkPlayerCount = GetLinkPlayerCount();
|
||||||
gUnknown_03005DB4 = GetMultiplayerId();
|
gLinkGuestPlayerId = GetMultiplayerId();
|
||||||
SetCableClubWarp();
|
SetCableClubWarp();
|
||||||
SetWarpDestination(mapGroup, mapNum, -1, x, y);
|
SetWarpDestination(mapGroup, mapNum, -1, x, y);
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
|
@ -84,7 +84,7 @@ EWRAM_DATA static bool8 sSavingComplete = FALSE;
|
|||||||
EWRAM_DATA static u8 sSaveInfoWindowId = 0;
|
EWRAM_DATA static u8 sSaveInfoWindowId = 0;
|
||||||
|
|
||||||
// Extern variables.
|
// Extern variables.
|
||||||
extern u8 gUnknown_03005DB4;
|
extern u8 gLinkGuestPlayerId;
|
||||||
|
|
||||||
// Extern functions in not decompiled files.
|
// Extern functions in not decompiled files.
|
||||||
extern void sub_80AF688(void);
|
extern void sub_80AF688(void);
|
||||||
@ -734,7 +734,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void)
|
|||||||
{
|
{
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
CleanupOverworldWindowsAndTilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
ShowTrainerCardInLink(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu);
|
ShowTrainerCardInLink(gLinkGuestPlayerId, CB2_ReturnToFieldWithOpenMenu);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1536,7 +1536,7 @@ static void sub_80C48C8(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 sub_80C4904(u8 cardId)
|
u8 GetTrainerCardStars(u8 cardId)
|
||||||
{
|
{
|
||||||
struct TrainerCard* trainerCards = gTrainerCards;
|
struct TrainerCard* trainerCards = gTrainerCards;
|
||||||
return trainerCards[cardId].stars;
|
return trainerCards[cardId].stars;
|
||||||
|
Loading…
Reference in New Issue
Block a user