Merge pull request #834 from GriffinRichards/document-trade

Document trade.c and some Union Room trading board
This commit is contained in:
huderlem 2019-10-12 15:47:17 -05:00 committed by GitHub
commit 0278209376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 5670 additions and 5540 deletions

View File

@ -28,6 +28,7 @@
#include "constants/secret_bases.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/trade.h"
#include "constants/trainer_hill.h"
#include "constants/trainers.h"
#include "constants/vars.h"

View File

@ -5,7 +5,7 @@ BattleFrontier_Lounge6_EventScript_264FED:: @ 8264FED
lock
faceplayer
goto_if_set FLAG_BATTLE_FRONTIER_TRADE_DONE, BattleFrontier_Lounge6_EventScript_265083
setvar VAR_0x8008, 3
setvar VAR_0x8008, INGAME_TRADE_MEOWTH
copyvar VAR_0x8004, VAR_0x8008
specialvar VAR_RESULT, GetInGameTradeSpeciesInfo
copyvar VAR_0x8009, VAR_RESULT

View File

@ -5,7 +5,7 @@ FortreeCity_House1_EventScript_2162BB:: @ 82162BB
lock
faceplayer
goto_if_set FLAG_FORTREE_NPC_TRADE_COMPLETED, FortreeCity_House1_EventScript_216355
setvar VAR_0x8008, 1
setvar VAR_0x8008, INGAME_TRADE_PLUSLE
copyvar VAR_0x8004, VAR_0x8008
specialvar VAR_RESULT, GetInGameTradeSpeciesInfo
copyvar VAR_0x8009, VAR_RESULT

View File

@ -5,7 +5,7 @@ PacifidlogTown_House3_EventScript_203C11:: @ 8203C11
lock
faceplayer
goto_if_set FLAG_PACIFIDLOG_NPC_TRADE_COMPLETED, PacifidlogTown_House3_EventScript_203CAB
setvar VAR_0x8008, 2
setvar VAR_0x8008, INGAME_TRADE_HORSEA
copyvar VAR_0x8004, VAR_0x8008
specialvar VAR_RESULT, GetInGameTradeSpeciesInfo
copyvar VAR_0x8009, VAR_RESULT

View File

@ -5,7 +5,7 @@ RustboroCity_House1_EventScript_21593F:: @ 821593F
lock
faceplayer
goto_if_set FLAG_RUSTBORO_NPC_TRADE_COMPLETED, RustboroCity_House1_EventScript_2159D5
setvar VAR_0x8008, 0
setvar VAR_0x8008, INGAME_TRADE_SEEDOT
copyvar VAR_0x8004, VAR_0x8008
specialvar VAR_RESULT, GetInGameTradeSpeciesInfo
copyvar VAR_0x8009, VAR_RESULT

View File

@ -107,12 +107,19 @@
#define TEXT_COLOR_TRANSPARENT 0x0
#define TEXT_COLOR_WHITE 0x1
#define TEXT_COLOR_DARK_GREY 0x2
// 0x3
#define TEXT_COLOR_LIGHT_GREY 0x3
#define TEXT_COLOR_RED 0x4
// 0x5
#define TEXT_COLOR_LIGHT_RED 0x5
#define TEXT_COLOR_GREEN 0x6
// 0x7
#define TEXT_COLOR_LIGHT_GREEN 0x7
#define TEXT_COLOR_BLUE 0x8
#define TEXT_COLOR_LIGHT_BLUE 0x9
#define TEXT_DYNAMIC_COLOR_1 0xA // Usually white
#define TEXT_DYNAMIC_COLOR_2 0xB // Usually white w/ tinge of green
#define TEXT_DYNAMIC_COLOR_3 0xC // Usually white
#define TEXT_DYNAMIC_COLOR_4 0xD // Usually aquamarine
#define TEXT_DYNAMIC_COLOR_5 0xE // Usually blue-green
#define TEXT_DYNAMIC_COLOR_6 0xF // Usually cerulean
#define PLACEHOLDER_ID_UNKNOWN 0x0
#define PLACEHOLDER_ID_PLAYER 0x1

View File

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

View File

@ -151,7 +151,7 @@ void sub_80A78AC(struct Sprite *sprite);
void sub_80A6BFC(struct BattleAnimBgData *unk, u8 unused);
u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10);
void sub_80A749C(struct Sprite *sprite);
void sub_80A6DEC(struct Sprite *sprite);
void TradeMenuBouncePartySprites(struct Sprite *sprite);
void DestroyAnimVisualTaskAndDisableBlend(u8 taskId);
void DestroySpriteAndFreeResources_(struct Sprite *sprite);
void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId);

116
include/constants/trade.h Normal file
View File

@ -0,0 +1,116 @@
#ifndef GUARD_CONSTANTS_TRADE_H
#define GUARD_CONSTANTS_TRADE_H
#define TRADE_PLAYER 0
#define TRADE_PARTNER 1
#define LINK_TRADE_TIMEOUT 300
// In-game Trade IDs
#define INGAME_TRADE_SEEDOT 0
#define INGAME_TRADE_PLUSLE 1
#define INGAME_TRADE_HORSEA 2
#define INGAME_TRADE_MEOWTH 3
// Flag IDs for sending link data
#define INITIATE_TRADE 1
#define CANCEL_TRADE 2
#define WANTS_TO_TRADE 1
#define WANTS_TO_CANCEL 2
#define READY_FINISH_TRADE 1
#define FINISH_TRADE 2
// Return values for CanTradeSelectedMon and CanTradeSelectedPartyMenuMon
#define CAN_TRADE_MON 0
#define CANT_TRADE_LAST_MON 1
#define CANT_TRADE_NATIONAL 2
#define CANT_TRADE_EGG 3
#define CANT_TRADE_INVALID_MON 4
#define CANT_TRADE_EGG2 5
// Return values for CheckValidityOfTradeMons
#define PLAYER_MON_INVALID 0
#define BOTH_MONS_VALID 1
#define PARTNER_MON_INVALID 2
// Return values for GetGameProgressForLinkTrade
#define TRADE_BOTH_PLAYERS_READY 0
#define TRADE_PLAYER_NOT_READY 1
#define TRADE_PARTNER_NOT_READY 2
// Indexes for sTradeActionTexts
#define TRADE_TEXT_CANCEL 0
#define TRADE_TEXT_CHOOSE_MON 1
#define TRADE_TEXT_SUMMARY 2
#define TRADE_TEXT_TRADE 3
#define TRADE_TEXT_CANCEL_TRADE 4
#define TRADE_TEXT_JP_QUIT 5
// Checked to confirm DrawTradeMenuParty has reached final state
#define DRAW_PARTY_FINISH 5
// Message indexes for sTradeMessages
#define TRADE_MSG_STANDBY 0
#define TRADE_MSG_CANCELED 1
#define TRADE_MSG_ONLY_MON1 2
#define TRADE_MSG_ONLY_MON2 3
#define TRADE_MSG_WAITING_FOR_FRIEND 4
#define TRADE_MSG_FRIEND_WANTS_TO_TRADE 5
#define TRADE_MSG_MON_CANT_BE_TRADED 6
#define TRADE_MSG_EGG_CANT_BE_TRADED 7
#define TRADE_MSG_FRIENDS_MON_CANT_BE_TRADED 8
// IDs for QueueAction
#define QUEUE_SEND_DATA 0
#define QUEUE_STANDBY 1
#define QUEUE_ONLY_MON1 2
#define QUEUE_ONLY_MON2 3
#define QUEUE_UNUSED1 4
#define QUEUE_UNUSED2 5
#define QUEUE_MON_CANT_BE_TRADED 6
#define QUEUE_EGG_CANT_BE_TRADED 7
#define QUEUE_FRIENDS_MON_CANT_BE_TRADED 8
#define QUEUE_DELAY_MSG 3
#define QUEUE_DELAY_DATA 5
// IDs for CallTradeMenuFunc
#define TRADEMENUFUNC_MAIN_MENU 0
#define TRADEMENUFUNC_SELECTED_MON 1
#define TRADEMENUFUNC_SHOW_MON_SUMMARY 2
#define TRADEMENUFUNC_CONFIRM_OR_CANCEL_TRADE 3
#define TRADEMENUFUNC_CANCEL_TRADE_PROMPT 4
#define TRADEMENUFUNC_UNUSED_5 5
#define TRADEMENUFUNC_BOTH_MONS_SELECTED 6
#define TRADEMENUFUNC_CONFIRM_TRADE_PROMPT 7
#define TRADEMENUFUNC_REDRAW_MAIN_MENU 8
#define TRADEMENUFUNC_LINK_TRADE_FADE_OUT 9
#define TRADEMENUFUNC_LINK_TRADE_WAIT_FADE 10
#define TRADEMENUFUNC_CANCEL_TRADE_1 11
#define TRADEMENUFUNC_CANCEL_TRADE_2 12
#define TRADEMENUFUNC_START_LINK_TRADE 13
#define TRADEMENUFUNC_DELAY_TRADE_CONFIRM 14
#define TRADEMENUFUNC_UNUSED_15 15
#define TRADEMENUFUNC_LINK_TRADE_WAIT_QUEUE 16
#define TRADEMENUFUNC_PARTNER_MON_INVALID 17
#define TRADEMENUFUNC_STANDBY 100
// Message indexes for sUnionRoomTradeMessages
#define UR_TRADE_MSG_NONE 0
#define UR_TRADE_MSG_NOT_MON_PARTNER_WANTS 1
#define UR_TRADE_MSG_NOT_EGG 2
#define UR_TRADE_MSG_MON_CANT_BE_TRADED_1 3
#define UR_TRADE_MSG_MON_CANT_BE_TRADED_2 4
#define UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED 5
#define UR_TRADE_MSG_EGG_CANT_BE_TRADED 6
#define UR_TRADE_MSG_PARTNER_CANT_ACCEPT_MON 7
#define UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_1 8
#define UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_2 9
// Return values for CanRegisterMonForTradingBoard
#define CAN_REGISTER_MON 0
#define CANT_REGISTER_MON 1
#define CANT_REGISTER_EGG 2
#endif //GUARD_CONSTANTS_TRADE_H

View File

@ -4848,13 +4848,13 @@ extern const u32 gCableCarCord_Gfx[];
extern const u16 gCableCar_Pal[];
// Trade
extern const u16 gUnknown_08DDB3E4[];
extern const u8 gUnknown_08DDB464[];
extern const u16 gTradeMenu_Pal[];
extern const u8 gTradeMenu_Gfx[];
extern const u16 gUnknown_08DDCF04[];
extern const u16 gTradeGba2_Pal[];
extern const u8 gTradeGba_Gfx[];
extern const u16 gUnknown_08DDD704[];
extern const u8 gUnknown_08DDC6E4[];
extern const u16 gTradeMenuMonBox_Tilemap[];
extern const u8 gTradeButtons_Gfx[];
extern const u16 gUnknown_08DDB444[];
// Party menu

View File

@ -76,10 +76,10 @@ struct UnkLinkRfuStruct_02022B14Substruct
u16 unk_00_4:1;
u16 unk_00_5:1;
u16 unk_00_6:1;
u16 unk_00_7:1;
u16 unk_01_0:1;
u16 unk_01_1:1;
u16 unk_01_2:4;
u16 isChampion:1;
u16 hasNationalDex:1;
u16 gameClear:1; // never read, redundant with isChampion
u16 unk_01_2:4; // always 3?
u16 unk_01_6:2;
u8 playerTrainerId[2];
};
@ -93,7 +93,7 @@ struct __attribute__((packed, aligned(2))) UnkLinkRfuStruct_02022B14
u8 unk_0a_0:7;
u8 unk_0a_7:1;
u8 playerGender:1;
u8 unk_0b_1:7;
u8 level:7;
u8 unk_0c;
};

View File

@ -48,6 +48,31 @@
#define EXTRACT_LINK_ERRORS(status) \
(((status) & LINK_STAT_ERRORS) >> LINK_STAT_ERRORS_SHIFT)
#define LINKCMD_SEND_LINK_TYPE 0x2222
#define LINKCMD_0x2FFE 0x2FFE
#define LINKCMD_SEND_HELD_KEYS 0x4444
#define LINKCMD_0x5555 0x5555
#define LINKCMD_0x5566 0x5566
#define LINKCMD_0x5FFF 0x5FFF
#define LINKCMD_0x6666 0x6666
#define LINKCMD_0x7777 0x7777
#define LINKCMD_CONT_BLOCK 0x8888
#define LINKCMD_0xAAAA 0xAAAA
#define LINKCMD_0xAAAB 0xAAAB
#define LINKCMD_READY_TO_TRADE 0xAABB
#define LINKCMD_READY_FINISH_TRADE 0xABCD
#define LINKCMD_INIT_BLOCK 0xBBBB
#define LINKCMD_READY_CANCEL_TRADE 0xBBCC
#define LINKCMD_SEND_HELD_KEYS_2 0xCAFE
#define LINKCMD_0xCCCC 0xCCCC
#define LINKCMD_START_TRADE 0xCCDD
#define LINKCMD_CONFIRM_FINISH_TRADE 0xDCBA
#define LINKCMD_SET_MONS_TO_TRADE 0xDDDD
#define LINKCMD_0xDDEE 0xDDEE
#define LINKCMD_REQUEST_CANCEL 0xEEAA
#define LINKCMD_CANCEL_TRADE 0xEEBB
#define LINKCMD_0xEECC 0xEECC
#define LINKTYPE_0x1111 0x1111 // trade
#define LINKTYPE_0x1122 0x1122 // trade
#define LINKTYPE_0x1133 0x1133 // trade
@ -70,21 +95,6 @@
#define LINKTYPE_0x6601 0x6601
#define LINKTYPE_0x6602 0x6602
#define LINKCMD_SEND_LINK_TYPE 0x2222
#define LINKCMD_0x2FFE 0x2FFE
#define LINKCMD_SEND_HELD_KEYS 0x4444
#define LINKCMD_0x5555 0x5555
#define LINKCMD_0x5566 0x5566
#define LINKCMD_0x5FFF 0x5FFF
#define LINKCMD_0x6666 0x6666
#define LINKCMD_0x7777 0x7777
#define LINKCMD_CONT_BLOCK 0x8888
#define LINKCMD_0xAAAA 0xAAAA
#define LINKCMD_0xAAAB 0xAAAB
#define LINKCMD_INIT_BLOCK 0xBBBB
#define LINKCMD_SEND_HELD_KEYS_2 0xCAFE
#define LINKCMD_0xCCCC 0xCCCC
struct LinkStatus
{
u32 localId:2;
@ -117,8 +127,8 @@ enum
EXCHANGE_COMPLETE,
EXCHANGE_TIMED_OUT,
EXCHANGE_IN_PROGRESS,
EXCHANGE_STAT_4,
EXCHANGE_STAT_5,
EXCHANGE_PLAYER_NOT_READY,
EXCHANGE_PARTNER_NOT_READY,
EXCHANGE_STAT_6,
EXCHANGE_STAT_7
};
@ -142,7 +152,10 @@ struct LinkPlayer
/* 0x00 */ u16 version;
/* 0x02 */ u16 lp_field_2;
/* 0x04 */ u32 trainerId;
/* 0x08 */ u8 name[11];
/* 0x08 */ u8 name[PLAYER_NAME_LENGTH + 1];
/* 0x10 */ u8 progressFlags; // (& 0x0F) is hasNationalDex, (& 0xF0) is hasClearedGame
/* 0x11 */ u8 neverRead;
/* 0x12 */ u8 progressFlagsCopy;
/* 0x13 */ u8 gender;
/* 0x14 */ u32 linkType;
/* 0x18 */ u16 id; // battler id in battles

View File

@ -128,7 +128,7 @@ struct UnkRfuStruct_Sub_Unused
struct UnkRfuStruct_2
{
/* 0x000 */ void (*unk_00)(void);
/* 0x000 */ void (*linkRfuCallback)(void);
/* 0x004 */ u16 unk_04;
/* 0x006 */ u8 filler_06[4];
/* 0x00a */ u16 unk_0a;
@ -224,11 +224,11 @@ void sub_800F804(void);
void sub_800F850(void);
u8 sub_800FCD8(void);
bool32 sub_800FE84(const u8 *src, size_t size);
void Rfu_set_zero(void);
void ClearLinkRfuCallback(void);
u8 sub_80104F4(void);
u8 rfu_get_multiplayer_id(void);
bool8 sub_8010100(u8 a0);
bool8 sub_8010500(void);
bool8 IsLinkRfuTaskFinished(void);
bool8 Rfu_IsMaster(void);
void task_add_05_task_del_08FA224_when_no_RfuFunc(void);
void sub_8010434(void);

View File

@ -93,17 +93,17 @@ u8 GetCursorSelectionMonId(void);
u8 sub_81B1360(void);
void sub_81B1370(u8 taskId);
u8* GetMonNickname(struct Pokemon *mon, u8 *dest);
u8 sub_81B1B5C(const u8* str, u8 b);
u8 DisplayPartyMenuMessage(const u8* str, u8 b);
bool8 sub_81B1BD4(void);
void sub_81B1F18(u8 taskId, u8 slot, s8 c, s16 HPDifference, TaskFunc func);
u8 pokemon_ailments_get_primary(u32 status);
u8 GetMonAilment(struct Pokemon *mon);
void display_pokemon_menu_message(u32 stringID);
void DisplayPartyMenuStdMessage(u32 stringID);
void sub_81B47E0(u8 taskId);
bool8 FieldCallback_PrepareFadeInFromMenu(void);
void sub_81B58A8(void);
void LoadHeldItemIcons(void);
void sub_81B5D4C(u8 *a, u8 *b, u8 c);
void DrawHeldItemIconsForTrade(u8 *a, u8 *b, u8 c);
void sub_81B617C(void);
void ItemUseCB_Medicine(u8 taskId, TaskFunc task);
void sub_81B67C8(u8 taskId, TaskFunc task);

View File

@ -25,7 +25,7 @@ extern const struct SpriteTemplate gBallSpriteTemplates[];
u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow);
void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battler, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species);
u8 sub_807671C(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h);
u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h);
void sub_8076918(u8 battler);
void DoHitAnimHealthboxEffect(u8 battler);
void LoadBallGfx(u8 ballId);

View File

@ -21,8 +21,8 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u
u8 UpdateMonIconFrame(struct Sprite *sprite);
void LoadMonIconPalette(u16 species);
void sub_80D328C(struct Sprite *sprite);
void sub_80D3014(struct Sprite *sprite);
void sub_80D32C8(struct Sprite *sprite, u8 animNum);
void UpdateTradeMonIconFrame(struct Sprite *sprite);
void SetPartyHPBarSprite(struct Sprite *sprite, u8 animNum);
u8 GetMonIconPaletteIndexFromSpecies(u16 species);
#endif // GUARD_POKEMON_ICON_H

View File

@ -25,7 +25,7 @@ struct PokemonStorage
extern struct PokemonStorage *gPokemonStoragePtr;
void sub_80C6D80(const u8 *string, void *dst, u8 arg2, u8 arg3, s32 arg4);
void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 arg2, u8 arg3, s32 bytesToBuffer);
u8 CountMonsInBox(u8 boxId);
s16 GetFirstFreeBoxSpot(u8 boxId);
u8 CountPartyAliveNonEggMonsExcept(u8 slotToIgnore);

View File

@ -2,25 +2,26 @@
#define GUARD_TRADE_H
#include "link_rfu.h"
#include "constants/trade.h"
// Exported type declarations
// Exported RAM declarations
extern struct MailStruct gUnknown_020321C0[PARTY_SIZE];
extern u8 gUnknown_02032298[2];
extern struct MailStruct gTradeMail[PARTY_SIZE];
extern u8 gSelectedTradeMonPositions[2];
// Exported ROM declarations
extern const struct WindowTemplate gUnknown_0833900C;
extern const struct WindowTemplate gTradeEvolutionSceneYesNoWindowTemplate;
s32 sub_807A728(void);
void sub_80773AC(void);
void sub_807AE50(void);
int sub_807A8D0(struct UnkLinkRfuStruct_02022B14Substruct a0, u16, u16, u8);
int sub_807A7E0(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 a2, u16 a3, u8 a4, u16 a5, u8 a6);
int sub_807A918(struct Pokemon*, u16);
void sub_807B140(void);
void sub_807B154(void);
void sub_807F19C(void);
void sub_807F1A8(u8, const u8 *, u8);
s32 GetGameProgressForLinkTrade(void);
void CB2_StartCreateTradeMenu(void);
void CB2_LinkTrade(void);
int CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct a0, u16, u16, u8);
int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 a2, u16 a3, u8 a4, u16 a5, u8 a6);
int CanTradeSelectedPartyMenuMon(struct Pokemon*, u16);
void InitTradeSequenceBgGpuRegs(void);
void LinkTradeDrawWindow(void);
void InitTradeBg(void);
void DrawTextOnTradeWindow(u8, const u8 *, u8);
#endif //GUARD_TRADE_H

View File

@ -135,7 +135,7 @@ union UnkUnion_Main
struct UnkStruct_URoom *uRoom;
};
struct TradeUnkStruct
struct UnionRoomTrade
{
u16 field_0;
u16 type;
@ -156,8 +156,8 @@ extern u8 gUnknown_02022C2C;
extern union UnkUnion_Main gUnknown_02022C30;
extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38;
extern u16 gUnknown_02022C3C;
extern u8 gUnknown_02022C3E;
extern u16 gUnionRoomOfferedSpecies;
extern u8 gUnionRoomRequestedMonType;
// Exported ROM declarations

View File

@ -988,7 +988,7 @@ void sub_80A6DAC(bool8 arg0)
}
}
void sub_80A6DEC(struct Sprite *sprite)
void TradeMenuBouncePartySprites(struct Sprite *sprite)
{
sprite->data[1] = sprite->pos1.x;
sprite->data[3] = sprite->pos1.y;

View File

@ -1491,7 +1491,7 @@ static void CB2_PreInitMultiBattle(void)
case 3:
if (gWirelessCommType)
{
if (sub_8010500())
if (IsLinkRfuTaskFinished())
{
gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback;

View File

@ -125,9 +125,9 @@ static u32 sub_80B2478(u8 lower, u8 upper)
return 1;
case EXCHANGE_IN_PROGRESS:
return 3;
case EXCHANGE_STAT_4:
case EXCHANGE_PLAYER_NOT_READY:
return 7;
case EXCHANGE_STAT_5:
case EXCHANGE_PARTNER_NOT_READY:
return 9;
case EXCHANGE_STAT_6:
ConvertIntToDecimalStringN(gStringVar1, GetLinkPlayerCount_2(), STR_CONV_MODE_LEFT_ALIGN, 1);
@ -1086,8 +1086,8 @@ static void sub_80B37FC(u8 taskId)
task->data[0]++;
break;
case 2:
gUnknown_02032298[0] = 0;
gUnknown_02032298[1] = 0;
gSelectedTradeMonPositions[TRADE_PLAYER] = 0;
gSelectedTradeMonPositions[TRADE_PARTNER] = 0;
m4aMPlayAllStop();
sub_800AC34();
task->data[0]++;
@ -1095,7 +1095,7 @@ static void sub_80B37FC(u8 taskId)
case 3:
if (!gReceivedRemoteLinkPlayers)
{
SetMainCallback2(sub_80773AC);
SetMainCallback2(CB2_StartCreateTradeMenu);
DestroyTask(taskId);
}
break;
@ -1111,7 +1111,7 @@ static void sub_80B3894(u8 taskId)
case 0:
ScriptContext2_Enable();
FadeScreen(1, 0);
Rfu_set_zero();
ClearLinkRfuCallback();
data[0]++;
break;
case 1:
@ -1119,8 +1119,8 @@ static void sub_80B3894(u8 taskId)
data[0]++;
break;
case 2:
gUnknown_02032298[0] = 0;
gUnknown_02032298[1] = 0;
gSelectedTradeMonPositions[TRADE_PLAYER] = 0;
gSelectedTradeMonPositions[TRADE_PARTNER] = 0;
m4aMPlayAllStop();
sub_800ADF8();
data[0]++;

1197
src/data/trade.h Normal file

File diff suppressed because it is too large Load Diff

1044
src/data/union_room.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -406,7 +406,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
gMain.state++;
break;
case 2:
sub_807F19C();
InitTradeBg();
gMain.state++;
break;
case 3:
@ -438,7 +438,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
gMain.state++;
sub_807B154();
LinkTradeDrawWindow();
}
break;
case 6:
@ -452,7 +452,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
break;
case 7:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
sub_807B140();
InitTradeSequenceBgGpuRegs();
ShowBg(0);
ShowBg(1);
SetMainCallback2(CB2_TradeEvolutionSceneUpdate);
@ -985,7 +985,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
{
case 0:
StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving);
sub_807F1A8(0, gStringVar4, 1);
DrawTextOnTradeWindow(0, gStringVar4, 1);
gTasks[taskID].tState++;
break;
case 1:
@ -1075,7 +1075,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (IsCryFinished())
{
StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved);
sub_807F1A8(0, gStringVar4, 1);
DrawTextOnTradeWindow(0, gStringVar4, 1);
PlayFanfare(MUS_FANFA5);
gTasks[taskID].tState++;
SetMonData(mon, MON_DATA_SPECIES, (&gTasks[taskID].tPostEvoSpecies));
@ -1110,7 +1110,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
else
{
PlayBGM(MUS_SHINKA);
sub_807F1A8(0, gText_CommunicationStandby5, 1);
DrawTextOnTradeWindow(0, gText_CommunicationStandby5, 1);
gTasks[taskID].tState++;
}
}
@ -1144,7 +1144,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID))
{
StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark);
sub_807F1A8(0, gStringVar4, 1);
DrawTextOnTradeWindow(0, gStringVar4, 1);
gTasks[taskID].tEvoWasStopped = 1;
gTasks[taskID].tState = 13;
}
@ -1155,7 +1155,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
BufferMoveToLearnIntoBattleTextBuff2();
PlayFanfare(MUS_FANFA1);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter
gTasks[taskID].tState++;
}
@ -1172,7 +1172,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
{
BufferMoveToLearnIntoBattleTextBuff2();
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState++;
}
break;
@ -1180,7 +1180,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState++;
}
break;
@ -1188,7 +1188,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tData7 = 5;
gTasks[taskID].tData8 = 9;
gTasks[taskID].tLearnMoveState++;
@ -1197,7 +1197,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
LoadUserWindowBorderGfx(0, 0xA8, 0xE0);
CreateYesNoMenu(&gUnknown_0833900C, 0xA8, 0xE, 0);
CreateYesNoMenu(&gTradeEvolutionSceneYesNoWindowTemplate, 0xA8, 0xE, 0);
sEvoCursorPos = 0;
gTasks[taskID].tLearnMoveState++;
sEvoCursorPos = 0;
@ -1209,7 +1209,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
case 0:
sEvoCursorPos = 0;
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7;
if (gTasks[taskID].tLearnMoveState == 5)
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
@ -1218,7 +1218,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
case -1:
sEvoCursorPos = 1;
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8;
break;
}
@ -1254,7 +1254,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (IsHMMove2(move))
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState = 11;
}
else
@ -1264,7 +1264,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
RemoveMonPPBonus(mon, var);
SetMonMoveSlot(mon, gMoveToLearn, var);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState++;
}
}
@ -1274,7 +1274,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState++;
}
break;
@ -1282,20 +1282,20 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tState = 18;
}
break;
case 9:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tData7 = 10;
gTasks[taskID].tData8 = 0;
gTasks[taskID].tLearnMoveState = 3;
break;
case 10:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskID].tState = 13;
break;
case 11:

View File

@ -34,7 +34,7 @@ void sub_8161560(u8 taskId)
gUnknown_0203CEC8.unkB = 0xA;
gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.slotId;
sub_81B0FCC(GetCursorSelectionMonId(), 0x1);
display_pokemon_menu_message(0x5);
DisplayPartyMenuStdMessage(5);
gTasks[taskId].func = sub_81B1370;
}
@ -47,7 +47,7 @@ void sub_81615A8(u8 taskId)
if(pokemonIndex > 6)
{
gUnknown_0203CEC8.unkB = 0;
display_pokemon_menu_message(0x0);
DisplayPartyMenuStdMessage(0);
gTasks[taskId].func = sub_81B1370;
return;
}
@ -73,7 +73,7 @@ static void sub_81616C0(u8 taskId)
{
GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
sub_81B1B5C(gStringVar4, 0);
DisplayPartyMenuMessage(gStringVar4, 0);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_8161724;
}
@ -88,7 +88,7 @@ static void sub_8161724(u8 taskId)
sub_81B0FCC(gUnknown_0203CEC8.unkA, 1);
ClearStdWindowAndFrameToTransparent(0x6, FALSE);
ClearWindowTilemap(0x6);
display_pokemon_menu_message(0);
DisplayPartyMenuStdMessage(0);
gTasks[taskId].func = sub_81B1370;
}
@ -96,14 +96,14 @@ static void sub_8161784(u8 taskId)
{
if(sub_81B1BD4() == 1)
return;
display_pokemon_menu_message(0x5);
DisplayPartyMenuStdMessage(5);
gTasks[taskId].func = sub_81B1370;
}
static void sub_81617B8(u8 taskId)
{
PlaySE(SE_SELECT);
sub_81B1B5C(gText_CantBeUsedOnPkmn, 0);
DisplayPartyMenuMessage(gText_CantBeUsedOnPkmn, 0);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_8161784;
}

View File

@ -1516,21 +1516,14 @@ asm(".space 0x20"); //blank palette??
#include "data/graphics/berry_fix.h"
// more trade stuff?
const u16 gUnknown_08DDB3E4[] = INCBIN_U16("graphics/trade/menu.gbapal");
const u16 gUnknown_08DDB444[] = INCBIN_U16("graphics/unknown/unknown_DDB444.gbapal");
const u8 gUnknown_08DDB464[] = INCBIN_U8("graphics/trade/menu.4bpp");
const u8 gUnknown_08DDC6E4[] = INCBIN_U8("graphics/trade/buttons.4bpp");
// Trade
const u16 gTradeMenu_Pal[] = INCBIN_U16("graphics/trade/menu.gbapal");
const u16 gUnknown_08DDB444[] = INCBIN_U16("graphics/trade/unknown_DDB444.gbapal");
const u8 gTradeMenu_Gfx[] = INCBIN_U8("graphics/trade/menu.4bpp");
const u8 gTradeButtons_Gfx[] = INCBIN_U8("graphics/trade/buttons.4bpp");
const u16 gUnused_DDCEE4[] = INCBIN_U16("graphics/unused/unused_DDCEE4.bin");
const u16 gUnknown_08DDCF04[] = INCBIN_U16("graphics/unknown/unknown_DDCF04.bin");
const u16 gUnknown_08DDD704[] = INCBIN_U16("graphics/unknown/unknown_DDD704.bin"); // textbox tilemap??
const u16 gUnknown_08DDCF04[] = INCBIN_U16("graphics/trade/unknown_DDCF04.bin");
const u16 gTradeMenuMonBox_Tilemap[] = INCBIN_U16("graphics/trade/menu_mon_box.bin");
const u16 gMessageBox_Pal[] = INCBIN_U16("graphics/text_window/message_box.gbapal");
const u8 gMessageBox_Gfx[] = INCBIN_U8("graphics/text_window/message_box.4bpp");

View File

@ -28,6 +28,7 @@
#include "link.h"
#include "link_rfu.h"
#include "constants/rgb.h"
#include "constants/trade.h"
extern u16 gHeldKeyCodeToSend;
@ -316,10 +317,10 @@ static void InitLocalLinkPlayer(void)
gLocalLinkPlayer.language = gGameLanguage;
gLocalLinkPlayer.version = gGameVersion + 0x4000;
gLocalLinkPlayer.lp_field_2 = 0x8000;
gLocalLinkPlayer.name[8] = IsNationalPokedexEnabled();
gLocalLinkPlayer.progressFlags = IsNationalPokedexEnabled();
if (FlagGet(FLAG_IS_CHAMPION))
{
gLocalLinkPlayer.name[8] |= 0x10;
gLocalLinkPlayer.progressFlags |= 0x10;
}
}
@ -597,9 +598,9 @@ static void ProcessRecvCmds(u8 unused)
*linkPlayer = block->linkPlayer;
if ((linkPlayer->version & 0xFF) == VERSION_RUBY || (linkPlayer->version & 0xFF) == VERSION_SAPPHIRE)
{
linkPlayer->name[10] = 0;
linkPlayer->name[9] = 0;
linkPlayer->name[8] = 0;
linkPlayer->progressFlagsCopy = 0;
linkPlayer->neverRead = 0;
linkPlayer->progressFlags = 0;
}
sub_800B524(linkPlayer);
if (strcmp(block->magic1, gASCIIGameFreakInc) != 0
@ -739,7 +740,7 @@ void ClearLinkCallback(void)
{
if (gWirelessCommType)
{
Rfu_set_zero();
ClearLinkRfuCallback();
}
else
{
@ -751,7 +752,7 @@ void ClearLinkCallback_2(void)
{
if (gWirelessCommType)
{
Rfu_set_zero();
ClearLinkRfuCallback();
}
else
{
@ -862,15 +863,15 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper)
{
if (gLinkPlayers[0].linkType == 0x1133)
{
switch (sub_807A728())
switch (GetGameProgressForLinkTrade())
{
case 1:
sPlayerDataExchangeStatus = EXCHANGE_STAT_4;
case TRADE_PLAYER_NOT_READY:
sPlayerDataExchangeStatus = EXCHANGE_PLAYER_NOT_READY;
break;
case 2:
sPlayerDataExchangeStatus = EXCHANGE_STAT_5;
case TRADE_PARTNER_NOT_READY:
sPlayerDataExchangeStatus = EXCHANGE_PARTNER_NOT_READY;
break;
case 0:
case TRADE_BOTH_PLAYERS_READY:
sPlayerDataExchangeStatus = EXCHANGE_COMPLETE;
break;
}
@ -1084,7 +1085,7 @@ bool8 IsLinkTaskFinished(void)
{
if (gWirelessCommType == TRUE)
{
return sub_8010500();
return IsLinkRfuTaskFinished();
}
return gLinkCallback == NULL;
}
@ -1909,7 +1910,7 @@ u8 sub_800B518(void)
void sub_800B524(struct LinkPlayer *player)
{
player->name[10] = player->name[8];
player->progressFlagsCopy = player->progressFlags;
ConvertInternationalString(player->name, player->language);
}

View File

@ -2165,9 +2165,9 @@ void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, s32 r
data->unk_00.unk_00_4 = 0;
data->unk_00.unk_00_5 = 0;
data->unk_00.unk_00_6 = 0;
data->unk_00.unk_00_7 = FlagGet(FLAG_IS_CHAMPION);
data->unk_00.unk_01_0 = IsNationalPokedexEnabled();
data->unk_00.unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR);
data->unk_00.isChampion = FlagGet(FLAG_IS_CHAMPION);
data->unk_00.hasNationalDex = IsNationalPokedexEnabled();
data->unk_00.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
}
bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx)
@ -3169,7 +3169,7 @@ bool32 sub_800F4F0(void)
sub_8011A64(2, 0x9000);
rfu_clearAllSlot();
gReceivedRemoteLinkPlayers = FALSE;
gUnknown_03005000.unk_00 = 0;
gUnknown_03005000.linkRfuCallback = NULL;
if (gUnknown_03005000.unk_ce4 == 1)
{
sub_8011A64(2, 0x9000);
@ -3264,17 +3264,17 @@ struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void)
bool32 IsSendingKeysToRfu(void)
{
return gUnknown_03005000.unk_00 == rfu_func_080F97B8;
return gUnknown_03005000.linkRfuCallback == rfu_func_080F97B8;
}
void sub_800F804(void)
{
gUnknown_03005000.unk_00 = rfu_func_080F97B8;
gUnknown_03005000.linkRfuCallback = rfu_func_080F97B8;
}
void Rfu_set_zero(void)
void ClearLinkRfuCallback(void)
{
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
void sub_800F820(void)
@ -3287,8 +3287,8 @@ void sub_800F820(void)
void sub_800F850(void)
{
if (gUnknown_03005000.unk_00 == NULL)
gUnknown_03005000.unk_00 = sub_800F820;
if (gUnknown_03005000.linkRfuCallback == NULL)
gUnknown_03005000.linkRfuCallback = sub_800F820;
}
static void sub_800F86C(u8 unused)
@ -3507,7 +3507,7 @@ void sub_800FE50(void *a0)
bool32 sub_800FE84(const u8 *src, size_t size)
{
bool8 r4;
if (gUnknown_03005000.unk_00 != NULL)
if (gUnknown_03005000.linkRfuCallback != NULL)
return FALSE;
if (gSendCmd[0] != 0)
return FALSE;
@ -3530,7 +3530,7 @@ bool32 sub_800FE84(const u8 *src, size_t size)
gUnknown_03005000.unk_6c.unk_04 = gBlockSendBuffer;
}
sub_800FD14(0x8800);
gUnknown_03005000.unk_00 = rfufunc_80F9F44;
gUnknown_03005000.linkRfuCallback = rfufunc_80F9F44;
gUnknown_03005000.unk_5b = 0;
return TRUE;
}
@ -3543,12 +3543,12 @@ static void rfufunc_80F9F44(void)
if (gUnknown_03005000.unk_0c == 1)
{
if (++gUnknown_03005000.unk_5b > 2)
gUnknown_03005000.unk_00 = sub_800FFB0;
gUnknown_03005000.linkRfuCallback = sub_800FFB0;
}
else
{
if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == 0x8800)
gUnknown_03005000.unk_00 = sub_800FFB0;
gUnknown_03005000.linkRfuCallback = sub_800FFB0;
}
}
}
@ -3564,7 +3564,7 @@ static void sub_800FFB0(void)
if (gUnknown_03005000.unk_6c.unk_02 <= gUnknown_03005000.unk_6c.unk_00)
{
gUnknown_03005000.unk_6c.unk_10 = 0;
gUnknown_03005000.unk_00 = rfufunc_80FA020;
gUnknown_03005000.linkRfuCallback = rfufunc_80FA020;
}
}
@ -3586,11 +3586,11 @@ static void rfufunc_80FA020(void)
gUnknown_02022B44.unk_64++;
}
else
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
}
else
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
bool8 sub_8010100(u8 a0)
@ -3606,7 +3606,7 @@ void sub_801011C(void)
sub_800C048();
gReceivedRemoteLinkPlayers = 0;
gUnknown_03005000.unk_ef = 1;
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
void sub_8010148(void)
@ -3624,7 +3624,7 @@ void sub_8010168(void)
gUnknown_03005000.unk_ce4 = 2;
}
else
gUnknown_03005000.unk_00 = sub_8010148;
gUnknown_03005000.linkRfuCallback = sub_8010148;
}
void LinkRfu_FatalError(void)
@ -3654,7 +3654,7 @@ void sub_80101CC(void)
sub_8010168();
}
else
gUnknown_03005000.unk_00 = sub_8010168;
gUnknown_03005000.linkRfuCallback = sub_8010168;
}
}
@ -3663,16 +3663,16 @@ void sub_801022C(void)
if (gSendCmd[0] == 0 && gUnknown_03005000.unk_ce8 == 0)
{
sub_800FD14(0x5f00);
gUnknown_03005000.unk_00 = sub_80101CC;
gUnknown_03005000.linkRfuCallback = sub_80101CC;
}
}
void sub_8010264(u8 taskId)
{
if (gUnknown_03005000.unk_00 == NULL)
if (gUnknown_03005000.linkRfuCallback == NULL)
{
gUnknown_03005000.unk_cd9 = 1;
gUnknown_03005000.unk_00 = sub_801022C;
gUnknown_03005000.linkRfuCallback = sub_801022C;
DestroyTask(taskId);
}
}
@ -3708,7 +3708,7 @@ void sub_80102B8(void)
for (i = 0; i < MAX_RFU_PLAYERS; i++)
gUnknown_03005000.unk_e9[i] = 0;
gUnknown_03005000.unk_100++;
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
gUnknown_03005000.unk_fe++;
}
@ -3718,7 +3718,7 @@ void sub_8010358(void)
if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
{
sub_800FD14(0x6600);
gUnknown_03005000.unk_00 = sub_80102B8;
gUnknown_03005000.linkRfuCallback = sub_80102B8;
}
}
@ -3732,7 +3732,7 @@ void sub_8010390(void)
if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
{
sub_800FD14(0x6600);
gUnknown_03005000.unk_00 = sub_80102B8;
gUnknown_03005000.linkRfuCallback = sub_80102B8;
}
}
else
@ -3748,7 +3748,7 @@ void sub_8010390(void)
if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
{
sub_800FD14(0x6600);
gUnknown_03005000.unk_00 = sub_8010358;
gUnknown_03005000.linkRfuCallback = sub_8010358;
}
}
}
@ -3756,9 +3756,9 @@ void sub_8010390(void)
void sub_8010434(void)
{
if (gUnknown_03005000.unk_00 == NULL)
if (gUnknown_03005000.linkRfuCallback == NULL)
{
gUnknown_03005000.unk_00 = sub_8010390;
gUnknown_03005000.linkRfuCallback = sub_8010390;
gUnknown_03005000.unk_fe = 0;
}
}
@ -3800,17 +3800,17 @@ u8 sub_80104F4(void)
return gUnknown_03005000.playerCount;
}
bool8 sub_8010500(void)
bool8 IsLinkRfuTaskFinished(void)
{
if (gUnknown_03005000.unk_f1 == 2)
return FALSE;
return gUnknown_03005000.unk_00 ? FALSE : TRUE;
return gUnknown_03005000.linkRfuCallback ? FALSE : TRUE;
}
static void sub_8010528(void)
{
if (gUnknown_03005000.unk_00)
gUnknown_03005000.unk_00();
if (gUnknown_03005000.linkRfuCallback)
gUnknown_03005000.linkRfuCallback();
}
bool8 sub_8010540(void)
@ -4255,11 +4255,11 @@ void sub_8010FA0(bool32 a0, bool32 a1)
gUnknown_02022B14.unk_00.unk_00_5 = a1;
}
void sub_8010FCC(u32 a0, u32 a1, u32 a2)
void sub_8010FCC(u32 type, u32 species, u32 level)
{
gUnknown_02022B14.type = a0;
gUnknown_02022B14.species = a1;
gUnknown_02022B14.unk_0b_1 = a2;
gUnknown_02022B14.type = type;
gUnknown_02022B14.species = species;
gUnknown_02022B14.level = level;
}
u8 sub_801100C(s32 a0)
@ -4345,12 +4345,12 @@ void sub_80111B0(bool32 a0)
void sub_80111DC(void)
{
sub_8011E94(gUnknown_03004140.unk_00, 1);
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
void sub_80111FC(void)
{
gUnknown_03005000.unk_00 = sub_80111DC;
gUnknown_03005000.linkRfuCallback = sub_80111DC;
}
void sub_801120C(u8 a0, u8 unused1)
@ -4979,7 +4979,7 @@ bool32 sub_801200C(s16 a1, struct UnkLinkRfuStruct_02022B14 *structPtr)
return TRUE;
}
else if (structPtr->species != structPtr2->species
|| structPtr->unk_0b_1 != structPtr2->unk_0b_1
|| structPtr->level != structPtr2->level
|| structPtr->type != structPtr2->type)
{
return TRUE;

File diff suppressed because it is too large Load Diff

View File

@ -1097,7 +1097,7 @@ static void sub_80765E0(struct Sprite *sprite)
}
}
u8 sub_807671C(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h)
u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h)
{
u8 spriteId;

View File

@ -1184,7 +1184,7 @@ void FreeMonIconPalette(u16 species)
FreeSpritePaletteByTag(gMonIconPaletteTable[palIndex].tag);
}
void sub_80D3014(struct Sprite *sprite)
void UpdateTradeMonIconFrame(struct Sprite *sprite)
{
UpdateMonIconFrame(sprite);
}
@ -1302,7 +1302,7 @@ void sub_80D328C(struct Sprite *sprite)
DestroySprite(sprite);
}
void sub_80D32C8(struct Sprite *sprite, u8 animNum)
void SetPartyHPBarSprite(struct Sprite *sprite, u8 animNum)
{
sprite->animNum = animNum;
sprite->animDelayCounter = 0;

View File

@ -1540,9 +1540,9 @@ static const u8 gHandCursorTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cu
static const u8 gHandCursorShadowTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor_shadow.4bpp");
// code
void sub_80C6D80(const u8 *string, void *dst, u8 arg2, u8 arg3, s32 arg4)
void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 zero1, u8 zero2, s32 bytesToBuffer)
{
s32 i, val, val2;
s32 i, tileBytesToBuffer, remainingBytes;
u16 windowId;
u8 txtColor[3];
u8 *tileData1, *tileData2;
@ -1551,25 +1551,25 @@ void sub_80C6D80(const u8 *string, void *dst, u8 arg2, u8 arg3, s32 arg4)
winTemplate.width = 24;
winTemplate.height = 2;
windowId = AddWindow(&winTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(arg3));
FillWindowPixelBuffer(windowId, PIXEL_FILL(zero2));
tileData1 = (u8*) GetWindowAttribute(windowId, WINDOW_TILE_DATA);
tileData2 = (winTemplate.width * 32) + tileData1;
if (!arg2)
txtColor[0] = 0;
if (!zero1)
txtColor[0] = TEXT_COLOR_TRANSPARENT;
else
txtColor[0] = arg3;
txtColor[1] = 0xF;
txtColor[2] = 0xE;
txtColor[0] = zero2;
txtColor[1] = TEXT_DYNAMIC_COLOR_6;
txtColor[2] = TEXT_DYNAMIC_COLOR_5;
AddTextPrinterParameterized4(windowId, 1, 0, 1, 0, 0, txtColor, -1, string);
val = arg4;
if (val > 6u)
val = 6;
val2 = arg4 - 6;
if (val > 0)
tileBytesToBuffer = bytesToBuffer;
if (tileBytesToBuffer > 6u)
tileBytesToBuffer = 6;
remainingBytes = bytesToBuffer - 6;
if (tileBytesToBuffer > 0)
{
for (i = val; i != 0; i--)
for (i = tileBytesToBuffer; i != 0; i--)
{
CpuCopy16(tileData1, dst, 0x80);
CpuCopy16(tileData2, dst + 0x80, 0x80);
@ -1579,8 +1579,9 @@ void sub_80C6D80(const u8 *string, void *dst, u8 arg2, u8 arg3, s32 arg4)
}
}
if (val2 > 0)
CpuFill16((arg3 << 4) | arg3, dst, (u32)(val2) * 0x100);
// Never used. bytesToBuffer is always passed <= 6, so remainingBytes is always <= 0 here
if (remainingBytes > 0)
CpuFill16((zero2 << 4) | zero2, dst, (u32)(remainingBytes) * 0x100);
RemoveWindow(windowId);
}
@ -5518,7 +5519,7 @@ static void sub_80CCB50(u8 boxId)
sPSSData->field_738 |= 0x10000 << tagIndex;
StringCopyPadded(sPSSData->field_21B8, GetBoxNamePtr(boxId), 0, 8);
sub_80C6D80(sPSSData->field_21B8, sPSSData->field_2F8, 0, 0, 2);
DrawTextWindowAndBufferTiles(sPSSData->field_21B8, sPSSData->field_2F8, 0, 0, 2);
LoadSpriteSheet(&spriteSheet);
r6 = sub_80CD00C(GetBoxNamePtr(boxId));
@ -5554,7 +5555,7 @@ static void sub_80CCCFC(u8 boxId, s8 direction)
}
StringCopyPadded(sPSSData->field_21B8, GetBoxNamePtr(boxId), 0, 8);
sub_80C6D80(sPSSData->field_21B8, sPSSData->field_2F8, 0, 0, 2);
DrawTextWindowAndBufferTiles(sPSSData->field_21B8, sPSSData->field_2F8, 0, 0, 2);
LoadSpriteSheet(&spriteSheet);
LoadPalette(gUnknown_08577574[GetBoxWallpaper(boxId)], r8, 4);
x = sub_80CD00C(GetBoxNamePtr(boxId));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff