Finish documenting berry blender

This commit is contained in:
GriffinR 2020-08-24 14:52:33 -04:00
parent 0ff767a9b5
commit 22c1bf965a
19 changed files with 1073 additions and 918 deletions

View File

@ -1,6 +1,16 @@
#ifndef GUARD_BERRY_BLENDER_H
#define GUARD_BERRY_BLENDER_H
// Indices into gSendCmd / gRecvCmds
#define BLENDER_COMM_INPUT_STATE 0
#define BLENDER_COMM_RESP 1
#define BLENDER_COMM_SCORE 2
#define BLENDER_COMM_STOP_TYPE 2 // re-used
#define BLENDER_COMM_PLAYER_ID 3
#define BLENDER_COMM_UNUSED 4
#define BLENDER_COMM_PROGRESS_BAR 5
#define BLENDER_COMM_ARROW_POS 6
extern u8 gInGameOpponentsNo;
void DoBerryBlending(void);

View File

@ -102,6 +102,7 @@
#define TEST_BUTTON(field, button) ({(field) & (button);})
#define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button)
#define JOY_HELD(button) TEST_BUTTON(gMain.heldKeys, button)
#define JOY_HELD_RAW(button) TEST_BUTTON(gMain.heldKeysRaw, button)
#define JOY_REPEAT(button) TEST_BUTTON(gMain.newAndRepeatedKeys, button)
#define S16TOPOSFLOAT(val) \

View File

@ -32,7 +32,7 @@ typedef union // size = 0x24
/*0x01*/ bool8 active;
/*0x02*/ u16 species;
/*0x04*/ u16 words[6];
/*0x10*/ u8 playerName[8];
/*0x10*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x18*/ u8 language;
} fanclubLetter;
@ -42,7 +42,7 @@ typedef union // size = 0x24
/*0x01*/ bool8 active;
/*0x02*/ u16 var02;
/*0x04*/ u16 words[6];
/*0x10*/ u8 playerName[8];
/*0x10*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x18*/ u8 language;
} recentHappenings;
@ -53,11 +53,11 @@ typedef union // size = 0x24
/*0x02*/ u16 species;
/*0x04*/ u8 friendshipHighNybble:4;
/*0x04*/ u8 questionAsked:4;
/*0x05*/ u8 playerName[8];
/*0x05*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x0D*/ u8 language;
/*0x0E*/ u8 pokemonNameLanguage;
/*0x0F*/ u8 filler_0F[1];
/*0x10*/ u8 nickname[8];
/*0x10*/ u8 nickname[PLAYER_NAME_LENGTH + 1];
/*0x18*/ u16 words18[2];
/*0x1C*/ u16 words[4];
} fanclubOpinions;
@ -78,7 +78,7 @@ typedef union // size = 0x24
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u16 species;
/*0x04*/ u8 pokemonName[11];
/*0x04*/ u8 pokemonName[POKEMON_NAME_LENGTH + 1];
/*0x0F*/ u8 trainerName[11];
/*0x1A*/ u8 random;
/*0x1B*/ u8 random2;
@ -93,12 +93,12 @@ typedef union // size = 0x24
/*0x01*/ bool8 active;
/*0x02*/ u16 species;
/*0x04*/ u16 words[2];
/*0x08*/ u8 pokemonNickname[11];
/*0x08*/ u8 pokemonNickname[POKEMON_NAME_LENGTH + 1];
/*0x13*/ u8 contestCategory:3;
/*0x13*/ u8 contestRank:2;
/*0x13*/ u8 contestResult:2;
/*0x14*/ u16 move;
/*0x16*/ u8 playerName[8];
/*0x16*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x1E*/ u8 language;
/*0x1F*/ u8 pokemonNameLanguage;
} bravoTrainer;
@ -107,7 +107,7 @@ typedef union // size = 0x24
struct {
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u8 trainerName[8];
/*0x02*/ u8 trainerName[PLAYER_NAME_LENGTH + 1];
/*0x0A*/ u16 species;
/*0x0C*/ u8 pokemonName[8];
/*0x14*/ u16 defeatedSpecies;
@ -125,14 +125,14 @@ typedef union // size = 0x24
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u16 losingSpecies;
/*0x04*/ u8 losingTrainerName[8];
/*0x04*/ u8 losingTrainerName[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 loserAppealFlag;
/*0x0D*/ u8 round1Placing;
/*0x0e*/ u8 round2Placing;
/*0x0f*/ u8 winnerAppealFlag;
/*0x10*/ u16 move;
/*0x12*/ u16 winningSpecies;
/*0x14*/ u8 winningTrainerName[8];
/*0x14*/ u8 winningTrainerName[PLAYER_NAME_LENGTH + 1];
/*0x1C*/ u8 category;
/*0x1D*/ u8 winningTrainerLanguage;
/*0x1E*/ u8 losingTrainerLanguage;
@ -144,9 +144,9 @@ typedef union // size = 0x24
/*0x01*/ bool8 active;
/*0x02*/ u8 sheen;
/*0x03*/ u8 flavor:3;
/*0x03*/ u8 unk_03_3:2;
/*0x04*/ u8 worstBlenderName[8];
/*0x0C*/ u8 playerName[8];
/*0x03*/ u8 color:2;
/*0x04*/ u8 worstBlenderName[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x14*/ u8 language;
/*0x15*/ u8 worstBlenderLanguage;
} threeCheers;
@ -156,8 +156,8 @@ typedef union // size = 0x24
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u16 speciesOpponent;
/*0x04*/ u8 playerName[8];
/*0x0C*/ u8 linkOpponentName[8];
/*0x04*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 linkOpponentName[PLAYER_NAME_LENGTH + 1];
/*0x14*/ u16 move;
/*0x16*/ u16 speciesPlayer;
/*0x18*/ u8 battleType;
@ -169,10 +169,10 @@ typedef union // size = 0x24
struct {
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u8 playerName[8];
/*0x02*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x0a*/ u8 idLo;
/*0x0b*/ u8 idHi;
/*0x0c*/ u8 idolName[8];
/*0x0c*/ u8 idolName[PLAYER_NAME_LENGTH + 1];
/*0x14*/ u16 words[1];
/*0x16*/ u8 score;
/*0x17*/ u8 language;
@ -183,9 +183,9 @@ typedef union // size = 0x24
struct {
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u8 playerName[8];
/*0x02*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x0a*/ u8 contestCategory;
/*0x0b*/ u8 nickname[11];
/*0x0b*/ u8 nickname[POKEMON_NAME_LENGTH + 1];
/*0x16*/ u8 pokeblockState;
/*0x17*/ u8 language;
/*0x18*/ u8 pokemonNameLanguage;
@ -198,11 +198,11 @@ typedef union // size = 0x24
/*0x01*/ bool8 active;
/*0x02*/ u8 language;
/*0x03*/ u8 language2;
/*0x04*/ u8 nickname[11];
/*0x04*/ u8 nickname[POKEMON_NAME_LENGTH + 1];
/*0x0F*/ u8 ball;
/*0x10*/ u16 species;
/*0x12*/ u8 nBallsUsed;
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} pokemonToday;
// TVSHOW_SMART_SHOPPER
@ -215,7 +215,7 @@ typedef union // size = 0x24
/*0x06*/ u16 itemIds[3];
/*0x0C*/ u16 itemAmounts[3];
/*0x12*/ u8 shopLocation;
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} smartshopperShow;
// TVSHOW_POKEMON_TODAY_FAILED
@ -229,7 +229,7 @@ typedef union // size = 0x24
/*0x10*/ u8 nBallsUsed;
/*0x11*/ u8 outcome;
/*0x12*/ u8 location;
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} pokemonTodayFailed;
// TVSHOW_FISHING_ADVICE
@ -241,7 +241,7 @@ typedef union // size = 0x24
/*0x04*/ u16 species;
/*0x06*/ u8 language;
/*0x07*/ u8 pad07[12];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} pokemonAngler;
// TVSHOW_WORLD_OF_MASTERS
@ -255,7 +255,7 @@ typedef union // size = 0x24
/*0x0a*/ u8 location;
/*0x0b*/ u8 language;
/*0x0c*/ u8 pad0c[7];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} worldOfMasters;
// TVSHOW_TODAYS_RIVAL_TRAINER
@ -271,7 +271,7 @@ typedef union // size = 0x24
/*0x0a*/ u16 mapLayoutId;
/*0x0c*/ u8 language;
/*0x0d*/ u8 filler_0d[6];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} rivalTrainer;
// TVSHOW_TREND_WATCHER
@ -283,7 +283,7 @@ typedef union // size = 0x24
/*0x08*/ u8 gender;
/*0x09*/ u8 language;
/*0x0a*/ u8 filler_0a[9];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} trendWatcher;
// TVSHOW_TREASURE_INVESTIGATORS
@ -295,7 +295,7 @@ typedef union // size = 0x24
/*0x05*/ u8 language;
/*0x06*/ u16 mapLayoutId;
/*0x08*/ u8 filler_08[11];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} treasureInvestigators;
// TVSHOW_FIND_THAT_GAMER
@ -308,7 +308,7 @@ typedef union // size = 0x24
/*0x06*/ u8 filler_06[2];
/*0x08*/ u8 language;
/*0x09*/ u8 filler_09[10];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} findThatGamer;
// TVSHOW_BREAKING_NEWS
@ -324,7 +324,7 @@ typedef union // size = 0x24
/*0x0c*/ u16 lastUsedMove;
/*0x0e*/ u8 language;
/*0x0f*/ u8 filler_0f[4];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} breakingNews;
// TVSHOW_SECRET_BASE_VISIT
@ -338,7 +338,7 @@ typedef union // size = 0x24
/*0x0a*/ u16 move;
/*0x0c*/ u8 language;
/*0x0d*/ u8 filler_0d[6];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} secretBaseVisit;
// TVSHOW_LOTTO_WINNER
@ -349,7 +349,7 @@ typedef union // size = 0x24
/*0x04*/ u8 whichPrize;
/*0x05*/ u8 language;
/*0x06*/ u8 filler_06[13];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} lottoWinner;
// TVSHOW_BATTLE_SEMINAR
@ -364,7 +364,7 @@ typedef union // size = 0x24
/*0x10*/ u8 nOtherMoves;
/*0x11*/ u8 language;
/*0x12*/ u8 filler_12[1];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} battleSeminar;
// TVSHOW_TRAINER_FAN_CLUB
@ -375,7 +375,7 @@ typedef union // size = 0x24
/*0x04*/ u16 words[2];
/*0x08*/ u8 language;
/*0x09*/ u8 filler_09[10];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} trainerFanClub;
// TVSHOW_CUTIES
@ -384,11 +384,11 @@ typedef union // size = 0x24
/*0x01*/ bool8 active;
/*0x02*/ u8 nRibbons;
/*0x03*/ u8 selectedRibbon;
/*0x04*/ u8 nickname[11];
/*0x04*/ u8 nickname[POKEMON_NAME_LENGTH + 1];
/*0x0f*/ u8 language;
/*0x10*/ u8 pokemonNameLanguage;
/*0x11*/ u8 filler_12[2];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} cuties;
// TVSHOW_FRONTIER
@ -403,7 +403,7 @@ typedef union // size = 0x24
/*0x0c*/ u8 language;
/*0x0d*/ u8 facility;
/*0x0e*/ u8 filler_0e[5];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} frontier;
// TVSHOW_NUMBER_ONE
@ -414,7 +414,7 @@ typedef union // size = 0x24
/*0x04*/ u8 actionIdx;
/*0x05*/ u8 language;
/*0x06*/ u8 filler_06[13];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} numberOne;
// TVSHOW_SECRET_BASE_SECRETS
@ -422,11 +422,11 @@ typedef union // size = 0x24
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u16 stepsInBase;
/*0x04*/ u8 baseOwnersName[8];
/*0x04*/ u8 baseOwnersName[PLAYER_NAME_LENGTH + 1];
/*0x0c*/ u32 flags;
/*0x10*/ u16 item;
/*0x12*/ u8 savedState;
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x1b*/ u8 language;
/*0x1c*/ u8 baseOwnersNameLanguage;
} secretBaseSecrets;
@ -439,7 +439,7 @@ typedef union // size = 0x24
/*0x03*/ u8 nPkblkUsed;
/*0x04*/ u8 language;
/*0x05*/ u8 filler_05[14];
/*0x13*/ u8 playerName[8];
/*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
} safariFanClub;
// Mass Outbreak

View File

@ -48,14 +48,12 @@
#define EXTRACT_LINK_ERRORS(status) \
(((status) & LINK_STAT_ERRORS) >> LINK_STAT_ERRORS_SHIFT)
#define LINKCMD_0x1111 0x1111
#define LINKCMD_BLENDER_STOP 0x1111
#define LINKCMD_SEND_LINK_TYPE 0x2222
#define LINKCMD_BLENDER_SCORE_MISS 0x2345
#define LINKCMD_0x2F00 0x2F00
#define LINKCMD_READY_EXIT_STANDBY 0x2FFE
#define LINKCMD_0x2FFF 0x2FFF
#define LINKCMD_0x4400 0x4400
#define LINKCMD_SEND_HELD_KEYS 0x4444
#define LINKCMD_SEND_PACKET 0x2FFF
#define LINKCMD_BLENDER_SEND_KEYS 0x4444
#define LINKCMD_BLENDER_SCORE_BEST 0x4523
#define LINKCMD_BLENDER_SCORE_GOOD 0x5432
#define LINKCMD_0x5555 0x5555
@ -63,16 +61,17 @@
#define LINKCMD_READY_CLOSE_LINK 0x5FFF
#define LINKCMD_0x6666 0x6666
#define LINKCMD_0x7777 0x7777
#define LINKCMD_0x7779 0x7779
#define LINKCMD_BLENDER_PLAY_AGAIN 0x7779
#define LINKCMD_0x7FFF 0x7FFF
#define LINKCMD_CONT_BLOCK 0x8888
#define LINKCMD_0x9999 0x9999
#define LINKCMD_0xAAAA 0xAAAA
#define LINKCMD_BLENDER_NO_BERRIES 0x9999
#define LINKCMD_BLENDER_NO_PBLOCK_SPACE 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_SEND_HELD_KEYS 0xCAFE
#define LINKCMD_SEND_BLOCK_REQ 0xCCCC
#define LINKCMD_START_TRADE 0xCCDD
#define LINKCMD_CONFIRM_FINISH_TRADE 0xDCBA
@ -239,7 +238,7 @@ extern u16 gSendCmd[CMD_LENGTH];
extern struct LinkPlayer gLinkPlayers[5];
extern u16 word_3002910[];
extern bool8 gReceivedRemoteLinkPlayers;
extern u32 gUnknown_020223C0;
extern u32 gBerryBlenderKeySendAttempts;
extern bool8 gLinkVSyncDisabled;
extern u32 gLinkStatus;
@ -289,7 +288,7 @@ u8 IsLinkMaster(void);
void SetCloseLinkCallback(void);
bool8 HandleLinkConnection(void);
void SetLinkDebugValues(u32 seed, u32 flags);
void sub_800A418(void);
void SetBerryBlenderLinkCallback(void);
void SetSuppressLinkErrorMessage(bool8 flag);
void sub_800B524(struct LinkPlayer *linkPlayer);
u8 GetSioMultiSI(void);

View File

@ -5,18 +5,18 @@
#include "link.h"
#include "AgbRfu_LinkManager.h"
#define RFU_COMMAND_0x4400 0x4400
#define RFU_COMMAND_0x8800 0x8800
#define RFU_COMMAND_0x8900 0x8900
#define RFU_COMMAND_SEND_BLOCK_REQ 0xA100
#define RFU_COMMAND_0x7700 0x7700
#define RFU_COMMAND_0x7800 0x7800
#define RFU_COMMAND_READY_EXIT_STANDBY 0x6600
#define RFU_COMMAND_READY_CLOSE_LINK 0x5F00
#define RFU_COMMAND_0x2F00 0x2F00
#define RFU_COMMAND_0xBE00 0xBE00
#define RFU_COMMAND_0xEE00 0xEE00
#define RFU_COMMAND_0xED00 0xED00
#define RFUCMD_SEND_PACKET 0x2F00
#define RFUCMD_BLENDER_SEND_KEYS 0x4400
#define RFUCMD_READY_CLOSE_LINK 0x5F00
#define RFUCMD_READY_EXIT_STANDBY 0x6600
#define RFUCMD_0x7700 0x7700
#define RFUCMD_0x7800 0x7800
#define RFUCMD_0x8800 0x8800
#define RFUCMD_0x8900 0x8900
#define RFUCMD_SEND_BLOCK_REQ 0xA100
#define RFUCMD_SEND_HELD_KEYS 0xBE00
#define RFUCMD_0xED00 0xED00
#define RFUCMD_0xEE00 0xEE00
#define RFU_SERIAL_7F7D 0x7F7D
@ -29,6 +29,8 @@
#define BACKUP_QUEUE_NUM_SLOTS 2
#define BACKUP_QUEUE_SLOT_LENGTH 14
#define RFU_PACKET_SIZE 6
#define RFU_STATUS_OK 0
#define RFU_STATUS_FATAL_ERROR 1
#define RFU_STATUS_CONNECTION_ERROR 2
@ -140,7 +142,7 @@ struct GFRfuManager
/* 0x0ef */ bool8 isShuttingDown;
/* 0x0f0 */ u8 linkLossRecoveryState;
/* 0x0f1 */ u8 status;
/* 0x0f2 */ u16 unk_f2[6];
/* 0x0f2 */ u16 packet[RFU_PACKET_SIZE];
/* 0x0fe */ u16 resendExitStandbyTimer;
/* 0x100 */ u16 unk_100;
/* 0x102 */ u8 unk_102;
@ -197,7 +199,7 @@ void Rfu_SetBlockReceivedFlag(u8 who);
void Rfu_ResetBlockReceivedFlag(u8 who);
bool32 IsSendingKeysToRfu(void);
void StartSendingKeysToRfu(void);
void sub_800F850(void);
void Rfu_SetBerryBlenderLinkCallback(void);
u8 Rfu_GetBlockReceivedStatus(void);
bool32 Rfu_InitBlockSend(const u8 *src, size_t size);
void ClearLinkRfuCallback(void);
@ -250,7 +252,7 @@ void SetTradeBoardRegisteredMonInfo(u32 type, u32 species, u32 level);
void InitializeRfuLinkManager_EnterUnionRoom(void);
void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 a2);
bool32 IsUnionRoomListenTaskActive(void);
void sub_800FE50(void *a0);
void Rfu_SendPacket(void *data);
bool32 PlayerHasMetTrainerBefore(u16 id, u8 *name);
void sub_8011DE0(u32 arg0);
u8 sub_801100C(s32 a0);

View File

@ -9,12 +9,21 @@
enum
{
PBLOCK_CLR_BLACK,
PBLOCK_CLR_NONE,
PBLOCK_CLR_RED,
PBLOCK_CLR_BLUE,
PBLOCK_CLR_PINK,
PBLOCK_CLR_GREEN,
PBLOCK_CLR_YELLOW
PBLOCK_CLR_YELLOW,
PBLOCK_CLR_PURPLE,
PBLOCK_CLR_INDIGO,
PBLOCK_CLR_BROWN,
PBLOCK_CLR_LITE_BLUE,
PBLOCK_CLR_OLIVE,
PBLOCK_CLR_GRAY,
PBLOCK_CLR_BLACK,
PBLOCK_CLR_WHITE,
PBLOCK_CLR_GOLD,
};
enum

View File

@ -2983,4 +2983,9 @@ extern const u8 gText_Smartness[];
extern const u8 gText_Cuteness[];
extern const u8 gText_Beauty3[];
// Berry Blender
extern const u8 gText_SavingDontTurnOff2[];
extern const u8 gText_BlenderMaxSpeedRecord[];
extern const u8 gText_234Players[];
#endif // GUARD_STRINGS_H

File diff suppressed because it is too large Load Diff

View File

@ -2357,7 +2357,7 @@ void sub_802339C(struct BerryCrushGame *r4)
for (r7 = 0; r7 < r4->unk9; ++r7)
{
r2 = gRecvCmds[r7];
if ((r2[0] & 0xFF00) == 0x2F00
if ((r2[0] & 0xFF00) == RFUCMD_SEND_PACKET
&& r2[1] == 2)
{
if ((u8)r2[2] & 4)
@ -2559,7 +2559,7 @@ void sub_80236B8(struct BerryCrushGame *r5)
r5->unk5C.unk02_1 = r5->unk25_4;
r5->unk5C.unk0A = r5->unk25_5;
memcpy(r5->unk40.unk2, &r5->unk5C, sizeof(r5->unk40.unk2));
sub_800FE50(r5->unk40.unk2);
Rfu_SendPacket(r5->unk40.unk2);
}
void sub_802385C(struct BerryCrushGame *r5)
@ -2580,7 +2580,7 @@ void sub_802385C(struct BerryCrushGame *r5)
for (r4 = 0; r4 < r5->unk9; ++r4)
r5->unk68.as_four_players.others[r4].unk4.as_2d_bytes[1][5] = 0;
#endif
if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET
|| gRecvCmds[0][1] != 2)
{
r5->unk25_2 = 0;

View File

@ -2748,14 +2748,14 @@ static void sub_8027DD0(u32 arg0)
struct UnkPacket1 packet;
packet.id = 1;
packet.unk4 = arg0;
sub_800FE50(&packet);
Rfu_SendPacket(&packet);
}
static u32 sub_8027DFC(u32 arg0)
{
struct UnkPacket1 *packet;
if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
return 0;
packet = (void *)&gRecvCmds[arg0][1];
@ -2857,7 +2857,7 @@ static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruc
packet.unkA_3 = arg6;
packet.unkB_1 = arg7;
packet.unkB_0 = arg8;
sub_800FE50(&packet);
Rfu_SendPacket(&packet);
}
static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8)
@ -2865,7 +2865,7 @@ static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct Dod
struct UnkPacket2 *packet;
struct DodrioSubstruct_31A0_14 *ptr = &arg0->unk14;
if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
return 0;
packet = (void *)&gRecvCmds[0][1];
@ -2935,14 +2935,14 @@ static void sub_80282EC(u8 arg0)
struct UnkPacket3 packet;
packet.id = 3;
packet.unk4 = arg0;
sub_800FE50(&packet);
Rfu_SendPacket(&packet);
}
static u32 sub_8028318(u32 arg0, u8 *arg1)
{
struct UnkPacket3 *packet;
if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
return 0;
packet = (void *)&gRecvCmds[arg0][1];
@ -2966,14 +2966,14 @@ static void sub_8028350(u32 arg0)
struct UnkPacket4 packet;
packet.id = 4;
packet.unk4 = arg0;
sub_800FE50(&packet);
Rfu_SendPacket(&packet);
}
static u32 sub_8028374(u32 arg0)
{
struct UnkPacket4 *packet;
if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
return 0;
packet = (void *)&gRecvCmds[arg0][1];

View File

@ -99,7 +99,7 @@ u16 gLinkSavedIme;
EWRAM_DATA u8 gLinkTestDebugValuesEnabled = 0;
EWRAM_DATA u8 gUnknown_020223BD = 0;
EWRAM_DATA u32 gUnknown_020223C0 = 0;
EWRAM_DATA u32 gBerryBlenderKeySendAttempts = 0;
EWRAM_DATA u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2] = {};
EWRAM_DATA u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE] = {};
EWRAM_DATA bool8 gLinkOpen = FALSE;
@ -552,7 +552,7 @@ static void ProcessRecvCmds(u8 unused)
InitBlockSend(block, sizeof(*block));
break;
}
case LINKCMD_SEND_HELD_KEYS:
case LINKCMD_BLENDER_SEND_KEYS:
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
break;
case LINKCMD_0x5555:
@ -636,13 +636,13 @@ static void ProcessRecvCmds(u8 unused)
case LINKCMD_READY_EXIT_STANDBY:
gReadyToExitStandby[i] = TRUE;
break;
case LINKCMD_0xAAAA:
sub_800A418();
case LINKCMD_BLENDER_NO_PBLOCK_SPACE:
SetBerryBlenderLinkCallback();
break;
case LINKCMD_SEND_BLOCK_REQ:
SendBlock(0, sBlockRequests[gRecvCmds[i][1]].address, sBlockRequests[gRecvCmds[i][1]].size);
break;
case LINKCMD_SEND_HELD_KEYS_2:
case LINKCMD_SEND_HELD_KEYS:
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
break;
}
@ -660,8 +660,8 @@ static void BuildSendCmd(u16 command)
case LINKCMD_READY_EXIT_STANDBY:
gSendCmd[0] = LINKCMD_READY_EXIT_STANDBY;
break;
case LINKCMD_SEND_HELD_KEYS:
gSendCmd[0] = LINKCMD_SEND_HELD_KEYS;
case LINKCMD_BLENDER_SEND_KEYS:
gSendCmd[0] = LINKCMD_BLENDER_SEND_KEYS;
gSendCmd[1] = gMain.heldKeys;
break;
case LINKCMD_0x5555:
@ -687,8 +687,8 @@ static void BuildSendCmd(u16 command)
gSendCmd[1] = sBlockSend.size;
gSendCmd[2] = sBlockSend.multiplayerId + 0x80;
break;
case LINKCMD_0xAAAA:
gSendCmd[0] = LINKCMD_0xAAAA;
case LINKCMD_BLENDER_NO_PBLOCK_SPACE:
gSendCmd[0] = LINKCMD_BLENDER_NO_PBLOCK_SPACE;
break;
case LINKCMD_0xAAAB:
gSendCmd[0] = LINKCMD_0xAAAB;
@ -705,12 +705,12 @@ static void BuildSendCmd(u16 command)
case LINKCMD_0x5566:
gSendCmd[0] = LINKCMD_0x5566;
break;
case LINKCMD_SEND_HELD_KEYS_2:
case LINKCMD_SEND_HELD_KEYS:
if (gHeldKeyCodeToSend == 0 || gLinkTransferringData)
{
break;
}
gSendCmd[0] = LINKCMD_SEND_HELD_KEYS_2;
gSendCmd[0] = LINKCMD_SEND_HELD_KEYS;
gSendCmd[1] = gHeldKeyCodeToSend;
break;
}
@ -738,7 +738,7 @@ bool32 IsSendingKeysToLink(void)
static void LinkCB_SendHeldKeys(void)
{
if (gReceivedRemoteLinkPlayers == TRUE)
BuildSendCmd(LINKCMD_SEND_HELD_KEYS_2);
BuildSendCmd(LINKCMD_SEND_HELD_KEYS);
}
void ClearLinkCallback(void)
@ -1009,34 +1009,36 @@ static void LinkCB_BlockSendEnd(void)
gLinkCallback = NULL;
}
static void sub_800A3F8(void)
static void LinkCB_BerryBlenderSendHeldKeys(void)
{
GetMultiplayerId();
BuildSendCmd(LINKCMD_SEND_HELD_KEYS);
gUnknown_020223C0++;
BuildSendCmd(LINKCMD_BLENDER_SEND_KEYS);
gBerryBlenderKeySendAttempts++;
}
void sub_800A418(void)
void SetBerryBlenderLinkCallback(void)
{
gUnknown_020223C0 = 0;
gBerryBlenderKeySendAttempts = 0;
if (gWirelessCommType)
{
sub_800F850();
Rfu_SetBerryBlenderLinkCallback();
}
else
{
gLinkCallback = sub_800A3F8;
gLinkCallback = LinkCB_BerryBlenderSendHeldKeys;
}
}
u32 sub_800A44C(void)
// Unused
static u32 GetBerryBlenderKeySendAttempts(void)
{
return gUnknown_020223C0;
return gBerryBlenderKeySendAttempts;
}
void sub_800A458(void)
// Unused
static void SendBerryBlenderNoSpaceForPokeblocks(void)
{
BuildSendCmd(LINKCMD_0xAAAA);
BuildSendCmd(LINKCMD_BLENDER_NO_PBLOCK_SPACE);
}
u8 GetMultiplayerId(void)

View File

@ -930,7 +930,7 @@ static void HandleSendFailure(u8 unused, u32 flags)
{
if (!(flags & 1))
{
sResendBlock16[0] = RFU_COMMAND_0x8900 | i;
sResendBlock16[0] = RFUCMD_0x8900 | i;
for (j = 0; j < 7; j++)
{
sResendBlock16[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0];
@ -984,7 +984,7 @@ static void RfuFunc_SendKeysToRfu(void)
{
sHeldKeyCount++;
gHeldKeyCodeToSend |= (sHeldKeyCount << 8);
RfuPrepareSendBuffer(RFU_COMMAND_0xBE00);
RfuPrepareSendBuffer(RFUCMD_SEND_HELD_KEYS);
}
}
@ -1008,18 +1008,18 @@ void ClearLinkRfuCallback(void)
Rfu.callback = NULL;
}
void sub_800F820(void)
static void Rfu_BerryBlenderSendHeldKeys(void)
{
RfuPrepareSendBuffer(RFU_COMMAND_0x4400);
RfuPrepareSendBuffer(RFUCMD_BLENDER_SEND_KEYS);
if (GetMultiplayerId() == 0)
gSendCmd[6] = GetBlenderArrowPosition();
gUnknown_020223C0++;
gSendCmd[BLENDER_COMM_ARROW_POS] = GetBlenderArrowPosition();
gBerryBlenderKeySendAttempts++;
}
void sub_800F850(void)
void Rfu_SetBerryBlenderLinkCallback(void)
{
if (Rfu.callback == NULL)
Rfu.callback = sub_800F820;
Rfu.callback = Rfu_BerryBlenderSendHeldKeys;
}
static void RfuHandleReceiveCommand(u8 unused)
@ -1031,18 +1031,18 @@ static void RfuHandleReceiveCommand(u8 unused)
{
switch (gRecvCmds[i][0] & 0xff00)
{
case RFU_COMMAND_0x7800:
case RFUCMD_0x7800:
if (Rfu.parentChild == MODE_CHILD && gReceivedRemoteLinkPlayers)
return;
// fallthrough
case RFU_COMMAND_0x7700:
case RFUCMD_0x7700:
if (gRfuLinkStatus->parentChild == MODE_CHILD)
{
Rfu.playerCount = gRecvCmds[i][1];
Rfu.multiplayerId = sub_800F74C((u8 *)(gRecvCmds[i] + 2));
}
break;
case RFU_COMMAND_0x8800:
case RFUCMD_0x8800:
if (Rfu.recvBlock[i].receiving == 0)
{
Rfu.recvBlock[i].next = 0;
@ -1053,7 +1053,7 @@ static void RfuHandleReceiveCommand(u8 unused)
Rfu.blockReceived[i] = FALSE;
}
break;
case RFU_COMMAND_0x8900:
case RFUCMD_0x8900:
if (Rfu.recvBlock[i].receiving == 1)
{
Rfu.recvBlock[i].next = gRecvCmds[i][0] & 0xff;
@ -1069,17 +1069,17 @@ static void RfuHandleReceiveCommand(u8 unused)
}
}
break;
case RFU_COMMAND_SEND_BLOCK_REQ:
case RFUCMD_SEND_BLOCK_REQ:
Rfu_InitBlockSend(sBlockRequests[gRecvCmds[i][1]].address, (u16)sBlockRequests[gRecvCmds[i][1]].size);
break;
case RFU_COMMAND_READY_CLOSE_LINK:
case RFUCMD_READY_CLOSE_LINK:
Rfu.readyCloseLink[i] = TRUE;
break;
case RFU_COMMAND_READY_EXIT_STANDBY:
case RFUCMD_READY_EXIT_STANDBY:
if (Rfu.unk_100 == gRecvCmds[i][1])
Rfu.readyExitStandby[i] = TRUE;
break;
case RFU_COMMAND_0xED00:
case RFUCMD_0xED00:
if (Rfu.parentChild == MODE_CHILD)
{
if (gReceivedRemoteLinkPlayers)
@ -1096,13 +1096,13 @@ static void RfuHandleReceiveCommand(u8 unused)
}
else
{
RfuPrepareSendBuffer(RFU_COMMAND_0xEE00);
RfuPrepareSendBuffer(RFUCMD_0xEE00);
gSendCmd[1] = gRecvCmds[i][1];
gSendCmd[2] = gRecvCmds[i][2];
gSendCmd[3] = gRecvCmds[i][3];
}
break;
case RFU_COMMAND_0xEE00:
case RFUCMD_0xEE00:
if (Rfu.parentChild == MODE_PARENT)
{
Rfu.unk_ce3 |= gRecvCmds[i][1];
@ -1110,8 +1110,8 @@ static void RfuHandleReceiveCommand(u8 unused)
ClearSelectedLinkPlayerIds(gRecvCmds[i][1]);
}
break;
case RFU_COMMAND_0x4400:
case RFU_COMMAND_0xBE00:
case RFUCMD_BLENDER_SEND_KEYS:
case RFUCMD_SEND_HELD_KEYS:
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
break;
}
@ -1187,16 +1187,16 @@ static void RfuPrepareSendBuffer(u16 command)
gSendCmd[0] = command;
switch (command)
{
case RFU_COMMAND_0x8800:
case RFUCMD_0x8800:
gSendCmd[1] = Rfu.sendBlock.count;
gSendCmd[2] = Rfu.sendBlock.owner + 0x80;
break;
case RFU_COMMAND_SEND_BLOCK_REQ:
case RFUCMD_SEND_BLOCK_REQ:
if (AreNoPlayersReceiving())
gSendCmd[1] = Rfu.blockRequestType;
break;
case RFU_COMMAND_0x7700:
case RFU_COMMAND_0x7800:
case RFUCMD_0x7700:
case RFUCMD_0x7800:
tmp = Rfu.unk_ce2 ^ Rfu.unk_ce3;
Rfu.playerCount = sUnknown_082ED695[tmp] + 1;
gSendCmd[1] = Rfu.playerCount;
@ -1204,34 +1204,34 @@ static void RfuPrepareSendBuffer(u16 command)
for (i = 0; i < RFU_CHILD_MAX; i++)
buff[i] = Rfu.linkPlayerIdx[i];
break;
case RFU_COMMAND_READY_EXIT_STANDBY:
case RFU_COMMAND_READY_CLOSE_LINK:
case RFUCMD_READY_EXIT_STANDBY:
case RFUCMD_READY_CLOSE_LINK:
gSendCmd[1] = Rfu.unk_100;
break;
case RFU_COMMAND_0x4400:
case RFUCMD_BLENDER_SEND_KEYS:
gSendCmd[0] = command;
gSendCmd[1] = gMain.heldKeys;
break;
case RFU_COMMAND_0x2F00:
for (i = 0; i < 6; i++)
gSendCmd[1 + i] = Rfu.unk_f2[i];
case RFUCMD_SEND_PACKET:
for (i = 0; i < RFU_PACKET_SIZE; i++)
gSendCmd[1 + i] = Rfu.packet[i];
break;
case RFU_COMMAND_0xBE00:
case RFUCMD_SEND_HELD_KEYS:
gSendCmd[1] = gHeldKeyCodeToSend;
break;
case RFU_COMMAND_0xEE00:
case RFUCMD_0xEE00:
break;
case RFU_COMMAND_0xED00:
case RFUCMD_0xED00:
break;
}
}
void sub_800FE50(void *a0)
void Rfu_SendPacket(void *data)
{
if (gSendCmd[0] == 0 && !RfuHasErrored())
{
memcpy(Rfu.unk_f2, a0, sizeof(Rfu.unk_f2));
RfuPrepareSendBuffer(RFU_COMMAND_0x2F00);
memcpy(Rfu.packet, data, sizeof(Rfu.packet));
RfuPrepareSendBuffer(RFUCMD_SEND_PACKET);
}
}
@ -1260,7 +1260,7 @@ bool32 Rfu_InitBlockSend(const u8 *src, size_t size)
memcpy(gBlockSendBuffer, src, size);
Rfu.sendBlock.payload = gBlockSendBuffer;
}
RfuPrepareSendBuffer(RFU_COMMAND_0x8800);
RfuPrepareSendBuffer(RFUCMD_0x8800);
Rfu.callback = HandleBlockSend;
Rfu.unk_5b = 0;
return TRUE;
@ -1270,7 +1270,7 @@ static void HandleBlockSend(void)
{
if (gSendCmd[0] == 0)
{
RfuPrepareSendBuffer(RFU_COMMAND_0x8800);
RfuPrepareSendBuffer(RFUCMD_0x8800);
if (Rfu.parentChild == MODE_PARENT)
{
if (++Rfu.unk_5b > 2)
@ -1278,7 +1278,7 @@ static void HandleBlockSend(void)
}
else
{
if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == RFU_COMMAND_0x8800)
if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == RFUCMD_0x8800)
Rfu.callback = SendNextBlock;
}
}
@ -1288,7 +1288,7 @@ static void SendNextBlock(void)
{
s32 i;
const u8 *src = Rfu.sendBlock.payload;
gSendCmd[0] = RFU_COMMAND_0x8900 | Rfu.sendBlock.next;
gSendCmd[0] = RFUCMD_0x8900 | Rfu.sendBlock.next;
for (i = 0; i < CMD_LENGTH - 1; i++)
gSendCmd[i + 1] = (src[(i << 1) + Rfu.sendBlock.next * 12 + 1] << 8) | src[(i << 1) + Rfu.sendBlock.next * 12 + 0];
Rfu.sendBlock.next++;
@ -1306,7 +1306,7 @@ static void SendLastBlock(void)
s32 i;
if (Rfu.parentChild == MODE_CHILD)
{
gSendCmd[0] = RFU_COMMAND_0x8900 | (Rfu.sendBlock.count - 1);
gSendCmd[0] = RFUCMD_0x8900 | (Rfu.sendBlock.count - 1);
for (i = 0; i < CMD_LENGTH - 1; i++)
gSendCmd[i + 1] = (src[(i << 1) + (Rfu.sendBlock.count - 1) * 12 + 1] << 8) | src[(i << 1) + (Rfu.sendBlock.count - 1) * 12 + 0];
if ((u8)gRecvCmds[mpId][0] == Rfu.sendBlock.count - 1)
@ -1327,7 +1327,7 @@ static void SendLastBlock(void)
bool8 Rfu_SendBlockRequest(u8 type)
{
Rfu.blockRequestType = type;
RfuPrepareSendBuffer(RFU_COMMAND_SEND_BLOCK_REQ);
RfuPrepareSendBuffer(RFUCMD_SEND_BLOCK_REQ);
return TRUE;
}
@ -1396,7 +1396,7 @@ static void SendReadyCloseLink(void)
{
if (gSendCmd[0] == 0 && Rfu.unk_ce8 == 0)
{
RfuPrepareSendBuffer(RFU_COMMAND_READY_CLOSE_LINK);
RfuPrepareSendBuffer(RFUCMD_READY_CLOSE_LINK);
Rfu.callback = WaitAllReadyToCloseLink;
}
}
@ -1426,7 +1426,7 @@ static void SendReadyExitStandbyUntilAllReady(void)
{
if (Rfu.recvQueue.count == 0 && Rfu.resendExitStandbyTimer > 60)
{
RfuPrepareSendBuffer(RFU_COMMAND_READY_EXIT_STANDBY);
RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
Rfu.resendExitStandbyTimer = 0;
}
}
@ -1450,7 +1450,7 @@ static void LinkLeaderReadyToExitStandby(void)
{
if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
{
RfuPrepareSendBuffer(RFU_COMMAND_READY_EXIT_STANDBY);
RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
Rfu.callback = SendReadyExitStandbyUntilAllReady;
}
}
@ -1466,7 +1466,7 @@ static void Rfu_LinkStandby(void)
// Not link leader, send exit standby when ready
if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
{
RfuPrepareSendBuffer(RFU_COMMAND_READY_EXIT_STANDBY);
RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
Rfu.callback = SendReadyExitStandbyUntilAllReady;
}
}
@ -1483,7 +1483,7 @@ static void Rfu_LinkStandby(void)
{
if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
{
RfuPrepareSendBuffer(RFU_COMMAND_READY_EXIT_STANDBY);
RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
Rfu.callback = LinkLeaderReadyToExitStandby;
}
}
@ -1706,9 +1706,9 @@ static void sub_801084C(u8 taskId)
if (Rfu.parentChild == MODE_PARENT)
{
if (gReceivedRemoteLinkPlayers)
RfuPrepareSendBuffer(RFU_COMMAND_0x7800);
RfuPrepareSendBuffer(RFUCMD_0x7800);
else
RfuPrepareSendBuffer(RFU_COMMAND_0x7700);
RfuPrepareSendBuffer(RFUCMD_0x7700);
gTasks[taskId].data[0] = 101;
}
else
@ -1728,7 +1728,7 @@ static void sub_801084C(u8 taskId)
if (AreNoPlayersReceiving())
{
Rfu.blockRequestType = 0;
RfuPrepareSendBuffer(RFU_COMMAND_SEND_BLOCK_REQ);
RfuPrepareSendBuffer(RFUCMD_SEND_BLOCK_REQ);
gTasks[taskId].data[0]++;
}
}
@ -1818,7 +1818,7 @@ static void Task_ExchangeLinkPlayers(u8 taskId)
if (gSendCmd[0] == 0)
{
ResetBlockReceivedFlag(r4);
RfuPrepareSendBuffer(RFU_COMMAND_0x7800);
RfuPrepareSendBuffer(RFUCMD_0x7800);
gTasks[taskId].data[0]++;
}
break;
@ -2632,7 +2632,7 @@ static void sub_8011E2C(u8 taskId)
{
if (gSendCmd[0] == 0 && Rfu.unk_ce8 == 0)
{
RfuPrepareSendBuffer(RFU_COMMAND_0xED00);
RfuPrepareSendBuffer(RFUCMD_0xED00);
gSendCmd[1] = gTasks[taskId].data[0];
gSendCmd[2] = gTasks[taskId].data[1];
Rfu.playerCount -= sUnknown_082ED695[gTasks[taskId].data[0]];

View File

@ -262,15 +262,15 @@ static void sub_802EAB0(u8 taskId)
if (gReceivedRemoteLinkPlayers != 0)
{
if (gRecvCmds[0][1] == 0x7FFF)
if (gRecvCmds[0][1] == LINKCMD_0x7FFF)
data[11] = gRecvCmds[0][2];
if (GetMultiplayerId() == 0)
{
data[12]++;
memset(packet, 0, sizeof(packet));
packet[0] = 0x7FFF;
packet[0] = LINKCMD_0x7FFF;
packet[1] = data[12];
sub_800FE50(packet);
Rfu_SendPacket(packet);
}
}
else

View File

@ -180,21 +180,21 @@ static const struct BgTemplate sBgTemplatesForPokeblockMenu[] =
const u8 *const gPokeblockNames[] =
{
NULL,
gText_RedPokeblock,
gText_BluePokeblock,
gText_PinkPokeblock,
gText_GreenPokeblock,
gText_YellowPokeblock,
gText_PurplePokeblock,
gText_IndigoPokeblock,
gText_BrownPokeblock,
gText_LiteBluePokeblock,
gText_OlivePokeblock,
gText_GrayPokeblock,
gText_BlackPokeblock,
gText_WhitePokeblock,
gText_GoldPokeblock
[PBLOCK_CLR_NONE] = NULL,
[PBLOCK_CLR_RED] = gText_RedPokeblock,
[PBLOCK_CLR_BLUE] = gText_BluePokeblock,
[PBLOCK_CLR_PINK] = gText_PinkPokeblock,
[PBLOCK_CLR_GREEN] = gText_GreenPokeblock,
[PBLOCK_CLR_YELLOW] = gText_YellowPokeblock,
[PBLOCK_CLR_PURPLE] = gText_PurplePokeblock,
[PBLOCK_CLR_INDIGO] = gText_IndigoPokeblock,
[PBLOCK_CLR_BROWN] = gText_BrownPokeblock,
[PBLOCK_CLR_LITE_BLUE] = gText_LiteBluePokeblock,
[PBLOCK_CLR_OLIVE] = gText_OlivePokeblock,
[PBLOCK_CLR_GRAY] = gText_GrayPokeblock,
[PBLOCK_CLR_BLACK] = gText_BlackPokeblock,
[PBLOCK_CLR_WHITE] = gText_WhitePokeblock,
[PBLOCK_CLR_GOLD] = gText_GoldPokeblock
};
static const struct MenuAction sPokeblockMenuActions[] =
@ -726,7 +726,7 @@ static void PutPokeblockListMenuString(u8 *dst, u16 pkblId)
*(txtPtr++) = EXT_CTRL_CODE_BEGIN;
*(txtPtr++) = EXT_CTRL_CODE_SKIP;
*(txtPtr++) = 87;
*(txtPtr++) = CHAR_BLOCK_1;
ConvertIntToDecimalStringN(gStringVar1, GetHighestPokeblocksFlavorLevel(pkblock), STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(txtPtr, gText_LvVar1);
@ -804,7 +804,7 @@ static void CompactPokeblockSlots(void)
{
for (j = i + 1; j < POKEBLOCKS_COUNT; j++)
{
if (gSaveBlock1Ptr->pokeblocks[i].color == 0)
if (gSaveBlock1Ptr->pokeblocks[i].color == PBLOCK_CLR_NONE)
{
struct Pokeblock temp = gSaveBlock1Ptr->pokeblocks[i];
gSaveBlock1Ptr->pokeblocks[i] = gSaveBlock1Ptr->pokeblocks[j];
@ -856,7 +856,7 @@ static void SetMenuItemsCountAndMaxShowed(void)
for (sPokeblockMenu->itemsNo = 0, i = 0; i < POKEBLOCKS_COUNT; i++)
{
if (gSaveBlock1Ptr->pokeblocks[i].color != 0)
if (gSaveBlock1Ptr->pokeblocks[i].color != PBLOCK_CLR_NONE)
sPokeblockMenu->itemsNo++;
}
@ -1322,7 +1322,7 @@ s8 GetFirstFreePokeblockSlot(void)
for (i = 0; i < POKEBLOCKS_COUNT; i++)
{
if (gSaveBlock1Ptr->pokeblocks[i].color == 0)
if (gSaveBlock1Ptr->pokeblocks[i].color == PBLOCK_CLR_NONE)
return i;
}
@ -1346,7 +1346,7 @@ bool32 AddPokeblock(const struct Pokeblock *pokeblock)
bool32 TryClearPokeblock(u8 pkblId)
{
if (gSaveBlock1Ptr->pokeblocks[pkblId].color == 0)
if (gSaveBlock1Ptr->pokeblocks[pkblId].color == PBLOCK_CLR_NONE)
{
return FALSE;
}

View File

@ -382,22 +382,23 @@ static const struct WindowTemplate sWindowTemplates[] =
DUMMY_WIN_TEMPLATE
};
// - 1 excludes PBLOCK_CLR_NONE
static const u32* const sPokeblocksPals[] =
{
gPokeblockRed_Pal,
gPokeblockBlue_Pal,
gPokeblockPink_Pal,
gPokeblockGreen_Pal,
gPokeblockYellow_Pal,
gPokeblockPurple_Pal,
gPokeblockIndigo_Pal,
gPokeblockBrown_Pal,
gPokeblockLiteBlue_Pal,
gPokeblockOlive_Pal,
gPokeblockGray_Pal,
gPokeblockBlack_Pal,
gPokeblockWhite_Pal,
gPokeblockGold_Pal
[PBLOCK_CLR_RED - 1] = gPokeblockRed_Pal,
[PBLOCK_CLR_BLUE - 1] = gPokeblockBlue_Pal,
[PBLOCK_CLR_PINK - 1] = gPokeblockPink_Pal,
[PBLOCK_CLR_GREEN - 1] = gPokeblockGreen_Pal,
[PBLOCK_CLR_YELLOW - 1] = gPokeblockYellow_Pal,
[PBLOCK_CLR_PURPLE - 1] = gPokeblockPurple_Pal,
[PBLOCK_CLR_INDIGO - 1] = gPokeblockIndigo_Pal,
[PBLOCK_CLR_BROWN - 1] = gPokeblockBrown_Pal,
[PBLOCK_CLR_LITE_BLUE - 1] = gPokeblockLiteBlue_Pal,
[PBLOCK_CLR_OLIVE - 1] = gPokeblockOlive_Pal,
[PBLOCK_CLR_GRAY - 1] = gPokeblockGray_Pal,
[PBLOCK_CLR_BLACK - 1] = gPokeblockBlack_Pal,
[PBLOCK_CLR_WHITE - 1] = gPokeblockWhite_Pal,
[PBLOCK_CLR_GOLD - 1] = gPokeblockGold_Pal
};
static const union AffineAnimCmd sSpriteAffineAnim_84120DC[] =

View File

@ -3684,14 +3684,14 @@ static void sub_802E0AC(struct PokemonJump1_MonInfo *arg0)
packet.species = arg0->species,
packet.otId = arg0->otId,
packet.personality = arg0->personality,
sub_800FE50(&packet);
Rfu_SendPacket(&packet);
}
static bool32 sub_802E0D0(int multiplayerId, struct PokemonJump1_MonInfo *arg0)
{
struct MonInfoPacket packet;
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != 0x2F00)
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != RFUCMD_SEND_PACKET)
return FALSE;
memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));
@ -3718,7 +3718,7 @@ static void sub_802E120(u32 arg0)
struct UnkPacket2 packet;
packet.id = 2;
packet.unk4 = arg0;
sub_800FE50(&packet);
Rfu_SendPacket(&packet);
}
struct UnkPacket3
@ -3746,14 +3746,14 @@ static void sub_802E138(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *
packet.unk2 = arg0->unk10;
packet.unk3_1 = arg0->unk14;
packet.unk4 = arg0->unkE;
sub_800FE50(&packet);
Rfu_SendPacket(&packet);
}
static bool32 sub_802E1BC(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1)
{
struct UnkPacket3 packet;
if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
return FALSE;
memcpy(&packet, &gRecvCmds[0][1], sizeof(packet));
@ -3792,14 +3792,14 @@ static void sub_802E234(struct PokemonJump1_82E4 *arg0, u8 arg1, u16 arg2)
packet.unk4 = arg0->unkE;
packet.unk6 = arg1;
packet.unk8 = arg2;
sub_800FE50(&packet);
Rfu_SendPacket(&packet);
}
static bool32 sub_802E264(struct PokemonJump1_82E4 *arg0, int multiplayerId, u8 *arg2, u16 *arg3)
{
struct UnkPacket4 packet;
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != 0x2F00)
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != RFUCMD_SEND_PACKET)
return FALSE;
memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));
@ -3819,7 +3819,7 @@ static bool32 sub_802E2D0(struct PokemonJump1_82E4 *arg0, int multiplayerId)
{
struct UnkPacket4 packet;
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != 0x2F00)
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != RFUCMD_SEND_PACKET)
return FALSE;
memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));

View File

@ -1332,7 +1332,7 @@ void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlaye
}
}
bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language)
bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 color, u8 sheen, u8 language)
{
TVShow *show;
u8 name[32];
@ -1355,7 +1355,7 @@ bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unus
StripExtCtrlCodes(name);
StringCopy(show->threeCheers.worstBlenderName, name);
show->threeCheers.flavor = flavor;
show->threeCheers.unk_03_3 = unused;
show->threeCheers.color = color;
show->threeCheers.sheen = sheen;
tv_store_id_2x(show);
show->threeCheers.language = gGameLanguage;

View File

@ -2677,7 +2677,7 @@ static void Task_RunUnionRoom(u8 taskId)
if (input == -2 || input == IN_UNION_ROOM)
{
uroom->playerSendBuffer[0] = IN_UNION_ROOM;
sub_800FE50(uroom->playerSendBuffer);
Rfu_SendPacket(uroom->playerSendBuffer);
StringCopy(gStringVar4, sIfYouWantToDoSomethingTexts[gLinkPlayers[0].gender]);
uroom->state = UR_STATE_REQUEST_DECLINED;
}
@ -2692,7 +2692,7 @@ static void Task_RunUnionRoom(u8 taskId)
else
{
uroom->playerSendBuffer[0] = gPlayerCurrActivity | IN_UNION_ROOM;
sub_800FE50(uroom->playerSendBuffer);
Rfu_SendPacket(uroom->playerSendBuffer);
uroom->state = UR_STATE_SEND_ACTIVITY_REQUEST;
}
}
@ -2721,7 +2721,7 @@ static void Task_RunUnionRoom(u8 taskId)
uroom->playerSendBuffer[0] = ACTIVITY_TRADE | IN_UNION_ROOM;
uroom->playerSendBuffer[1] = sUnionRoomTrade.species;
uroom->playerSendBuffer[2] = sUnionRoomTrade.level;
sub_800FE50(uroom->playerSendBuffer);
Rfu_SendPacket(uroom->playerSendBuffer);
uroom->state = UR_STATE_WAIT_FOR_RESPONSE_TO_REQUEST;
break;
case UR_STATE_WAIT_FOR_RESPONSE_TO_REQUEST:
@ -2908,32 +2908,32 @@ static void Task_RunUnionRoom(u8 taskId)
if (!HasAtLeastTwoMonsOfLevel30OrLower())
{
uroom->playerSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM;
sub_800FE50(uroom->playerSendBuffer);
Rfu_SendPacket(uroom->playerSendBuffer);
uroom->state = UR_STATE_DECLINE_ACTIVITY_REQUEST;
StringCopy(gStringVar4, sText_NeedTwoMonsOfLevel30OrLower2);
}
else
{
sub_800FE50(uroom->playerSendBuffer);
Rfu_SendPacket(uroom->playerSendBuffer);
uroom->state = UR_STATE_PRINT_START_ACTIVITY_MSG;
}
}
else if (gPlayerCurrActivity == (ACTIVITY_CARD | IN_UNION_ROOM))
{
sub_800FE50(uroom->playerSendBuffer);
Rfu_SendPacket(uroom->playerSendBuffer);
ViewURoomPartnerTrainerCard(gStringVar4, uroom, TRUE);
uroom->state = UR_STATE_PRINT_CARD_INFO;
}
else
{
sub_800FE50(uroom->playerSendBuffer);
Rfu_SendPacket(uroom->playerSendBuffer);
uroom->state = UR_STATE_PRINT_START_ACTIVITY_MSG;
}
break;
case 1: // DECLINE
case -1:
uroom->playerSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM;
sub_800FE50(uroom->playerSendBuffer);
Rfu_SendPacket(uroom->playerSendBuffer);
uroom->state = UR_STATE_DECLINE_ACTIVITY_REQUEST;
GetYouDeclinedTheOfferMessage(gStringVar4, gPlayerCurrActivity);
break;