Sync berry crush from Emerald

This commit is contained in:
PikalaxALT
2021-05-05 13:03:39 -04:00
parent 9ed87063f1
commit ee6b3c1acf
46 changed files with 1776 additions and 1456 deletions
+1 -1
View File
@@ -977,7 +977,7 @@ CableClub_EventScript_WirelessBerryCrush:: @ 81BBD35
msgbox CableClub_Text_UseBerryCrush, MSGBOX_YESNO msgbox CableClub_Text_UseBerryCrush, MSGBOX_YESNO
compare VAR_RESULT, NO compare VAR_RESULT, NO
goto_if_eq CableClub_EventScript_AbortLink goto_if_eq CableClub_EventScript_AbortLink
special CheckHasAtLeastOneBerry special HasAtLeastOneBerry
compare VAR_RESULT, FALSE compare VAR_RESULT, FALSE
goto_if_eq CableClub_EventScript_NeedBerryForBerryCrush goto_if_eq CableClub_EventScript_NeedBerryForBerryCrush
setvar VAR_0x8004, LINK_GROUP_BERRY_CRUSH setvar VAR_0x8004, LINK_GROUP_BERRY_CRUSH
+1 -1
View File
@@ -419,7 +419,7 @@ gSpecials:: @ 815FD60
def_special HelpSystem_Disable def_special HelpSystem_Disable
def_special HelpSystem_Enable def_special HelpSystem_Enable
def_special SetPostgameFlags def_special SetPostgameFlags
def_special CheckHasAtLeastOneBerry def_special HasAtLeastOneBerry
def_special DisplayBerryPowderVendorMenu def_special DisplayBerryPowderVendorMenu
def_special RemoveBerryPowderVendorMenu def_special RemoveBerryPowderVendorMenu
def_special Script_HasEnoughBerryPowder def_special Script_HasEnoughBerryPowder

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 639 B

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 295 B

+2 -2
View File
@@ -68,10 +68,10 @@ const struct Berry * GetBerryInfo(u8 berryIdx);
extern const struct Berry gBerries[]; extern const struct Berry gBerries[];
struct BerryCrushStats { struct BerryCrushStats {
u8 unk0; u8 difficulty;
u16 powder; u16 powder;
}; };
extern const struct BerryCrushStats gBerryCrushStats[]; extern const struct BerryCrushStats gBerryCrush_BerryData[];
#endif // GUARD_BERRY_H #endif // GUARD_BERRY_H
+1
View File
@@ -4,5 +4,6 @@
#include "main.h" #include "main.h"
void StartBerryCrush(MainCallback callback); void StartBerryCrush(MainCallback callback);
void ShowBerryCrushRankings(void);
#endif // GUARD_BERRY_CRUSH_H #endif // GUARD_BERRY_CRUSH_H
+1 -1
View File
@@ -24,7 +24,7 @@ extern const u32 gUnknown_8479688[];
extern const u32 gUnknown_8479748[]; extern const u32 gUnknown_8479748[];
bool32 DigitObjUtil_Init(u32 count); bool32 DigitObjUtil_Init(u32 count);
void DigitObjUtil_Teardown(void); void DigitObjUtil_Free(void);
bool32 DigitObjUtil_CreatePrinter(u32 id, s32 num, const struct DigitObjUtilTemplate *template); bool32 DigitObjUtil_CreatePrinter(u32 id, s32 num, const struct DigitObjUtilTemplate *template);
void DigitObjUtil_PrintNumOn(u32 id, s32 num); void DigitObjUtil_PrintNumOn(u32 id, s32 num);
void DigitObjUtil_DeletePrinter(u32 id); void DigitObjUtil_DeletePrinter(u32 id);
+18
View File
@@ -45,9 +45,27 @@
// Converts a number to Q8.8 fixed-point format // Converts a number to Q8.8 fixed-point format
#define Q_8_8(n) ((s16)((n) * 256)) #define Q_8_8(n) ((s16)((n) * 256))
// Converts a number from Q8.8 fixed-point format
#define Q_8_8_TO_INT(n) ((s16)((n) >> 8))
// Converts a number to Q4.12 fixed-point format // Converts a number to Q4.12 fixed-point format
#define Q_4_12(n) ((s16)((n) * 4096)) #define Q_4_12(n) ((s16)((n) * 4096))
// Converts a number from Q4.12 fixed-point format
#define Q_4_12_TO_INT(n) ((s16)((n) >> 12))
// Converts a number to QN.S fixed-point format (16-bits)
#define Q_N_S(s, n) ((s16)((n) * (1 << (s))))
// converts a number from QN.S fixed-point format (16-bits)
#define Q_N_S_TO_INT(s, n) ((s16)((n) >> (s)))
// Converts a number to Q24.8 fixed-point format
#define Q_24_8(n) ((s32)((n) << 8))
// Converts a number from Q24.8 fixed-point format
#define Q_24_8_TO_INT(n) ((s32)((n) >> 8))
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b)) #define max(a, b) ((a) >= (b) ? (a) : (b))
+3 -3
View File
@@ -4888,9 +4888,9 @@ extern const u32 gFile_graphics_battle_transitions_vs_frame_palette[];
extern const u32 gFile_graphics_battle_transitions_vs_frame_tilemap[]; extern const u32 gFile_graphics_battle_transitions_vs_frame_tilemap[];
// berry_crush // berry_crush
extern const u16 gUnknown_8EAFEA0[]; extern const u16 gBerryCrush_Crusher_Pal[];
extern const u32 gUnknown_8EAFFC0[]; extern const u32 gBerryCrush_Crusher_Gfx[];
extern const u32 gUnknown_8EB0ADC[]; extern const u32 gBerryCrush_Crusher_Tilemap[];
// easy_chat_3 // easy_chat_3
extern const u32 gEasyChatWindow_Gfx[]; extern const u32 gEasyChatWindow_Gfx[];
+1 -1
View File
@@ -79,6 +79,6 @@ void RemovePCItem(u16 itemId, u16 quantity);
void SortAndCompactBagPocket(struct BagPocket * pocket); void SortAndCompactBagPocket(struct BagPocket * pocket);
u8 CountItemsInPC(void); u8 CountItemsInPC(void);
void ApplyNewEncryptionKeyToBagItems_(u32 newKey); void ApplyNewEncryptionKeyToBagItems_(u32 newKey);
bool8 CheckHasAtLeastOneBerry(void); bool8 HasAtLeastOneBerry(void);
#endif // GUARD_ITEM_H #endif // GUARD_ITEM_H
+1 -1
View File
@@ -274,7 +274,7 @@ void LoadWirelessStatusIndicatorSpriteGfx(void);
void CreateWirelessStatusIndicatorSprite(u8, u8); void CreateWirelessStatusIndicatorSprite(u8, u8);
void sub_8009FE8(void); void sub_8009FE8(void);
void ClearLinkCallback_2(void); void ClearLinkCallback_2(void);
void LinkRfu_SetRfuFuncToSend6600(void); void Rfu_SetLinkStandbyCallback(void);
void IntlConvertLinkPlayerName(struct LinkPlayer * linkPlayer); void IntlConvertLinkPlayerName(struct LinkPlayer * linkPlayer);
bool8 IsWirelessAdapterConnected(void); bool8 IsWirelessAdapterConnected(void);
bool8 Link_PrepareCmd0xCCCC_Rfu0xA100(u8 blockRequestType); bool8 Link_PrepareCmd0xCCCC_Rfu0xA100(u8 blockRequestType);
+13 -13
View File
@@ -5,17 +5,17 @@
#include "librfu.h" #include "librfu.h"
#include "AgbRfu_LinkManager.h" #include "AgbRfu_LinkManager.h"
#define RFU_COMMAND_0x8800 0x8800 #define RFUCMD_SEND_PACKET 0x2F00
#define RFU_COMMAND_0x8900 0x8900 #define RFUCMD_READY_CLOSE_LINK 0x5f00
#define RFU_COMMAND_0xa100 0xa100 #define RFUCMD_READY_EXIT_STANDBY 0x6600
#define RFU_COMMAND_0x7700 0x7700 #define RFUCMD_0x7700 0x7700
#define RFU_COMMAND_0x7800 0x7800 #define RFUCMD_0x7800 0x7800
#define RFU_COMMAND_0x6600 0x6600 #define RFUCMD_0x8800 0x8800
#define RFU_COMMAND_0x5f00 0x5f00 #define RFUCMD_0x8900 0x8900
#define RFU_COMMAND_0x2f00 0x2f00 #define RFUCMD_SEND_BLOCK_REQ 0xa100
#define RFU_COMMAND_0xbe00 0xbe00 #define RFUCMD_SEND_HELD_KEYS 0xbe00
#define RFU_COMMAND_0xee00 0xee00 #define RFUCMD_0xED00 0xee00
#define RFU_COMMAND_0xed00 0xed00 #define RFUCMD_0xEE00 0xed00
// RfuTgtData.gname is read as these structs. // RfuTgtData.gname is read as these structs.
struct GFtgtGnameSub struct GFtgtGnameSub
@@ -196,7 +196,7 @@ void DestroyWirelessStatusIndicatorSprite(void);
void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0); void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0);
void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0); void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0);
void MEvent_CreateTask_Leader(u32 arg0); void MEvent_CreateTask_Leader(u32 arg0);
void RfuPrepareSend0x2f00(void * data); void Rfu_SendPacket(void * data);
u8 CreateTask_ListenToWireless(void); u8 CreateTask_ListenToWireless(void);
void LinkRfu_DestroyIdleTask(void); void LinkRfu_DestroyIdleTask(void);
void sub_80F86F4(void); void sub_80F86F4(void);
@@ -275,7 +275,7 @@ bool32 GetRfuUnkCE8(void);
void sub_80FA4A8(void); void sub_80FA4A8(void);
void sub_80FB9D0(void); void sub_80FB9D0(void);
void sub_80FB030(u32 a0); void sub_80FB030(u32 a0);
void sub_80FBA44(void); void ClearRecvCommands(void);
#include "mevent_server.h" #include "mevent_server.h"
extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[]; extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[];
+6 -6
View File
@@ -1,11 +1,11 @@
#ifndef GUARD_MATH_UTIL_H #ifndef GUARD_MATH_UTIL_H
#define GUARD_MATH_UTIL_H #define GUARD_MATH_UTIL_H
s16 MathUtil_Inv16(s16 y); s16 invfx16(s16 y);
s16 MathUtil_Mul16(s16 x, s16 y); s16 mulfx16(s16 x, s16 y);
s32 MathUtil_Div32(s32 x, s32 y); s32 divfx32(s32 x, s32 y);
s32 MathUtil_Mul32(s32 x, s32 y); s32 mulfx32(s32 x, s32 y);
s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y); s16 divfxn16(u8 s, s16 x, s16 y);
s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y); s16 mulfxn16(u8 s, s16 x, s16 y);
#endif //GUARD_MATH_UTIL_H #endif //GUARD_MATH_UTIL_H
+1 -1
View File
@@ -20,7 +20,7 @@ void CopyToBufferFromBgTilemap(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8
void ResetBgPositions(void); void ResetBgPositions(void);
void InitStandardTextBoxWindows(void); void InitStandardTextBoxWindows(void);
void FreeAllOverworldWindowBuffers(void); void FreeAllOverworldWindowBuffers(void);
void ResetBg0(void); void InitTextBoxGfxAndPrinters(void);
u16 RunTextPrinters_CheckPrinter0Active(void); u16 RunTextPrinters_CheckPrinter0Active(void);
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor); u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor);
void AddTextPrinterDiffStyle(bool8 allowSkippingDelayWithButtonPress); void AddTextPrinterDiffStyle(bool8 allowSkippingDelayWithButtonPress);
+4
View File
@@ -16,6 +16,10 @@
#define PALETTE_FADE_STATUS_DONE 0 #define PALETTE_FADE_STATUS_DONE 0
#define PALETTE_FADE_STATUS_LOADING 0xFF #define PALETTE_FADE_STATUS_LOADING 0xFF
#define PALETTES_BG 0x0000FFFF
#define PALETTES_OBJECTS 0xFFFF0000
#define PALETTES_ALL (PALETTES_BG | PALETTES_OBJECTS)
enum enum
{ {
FAST_FADE_IN_FROM_WHITE, FAST_FADE_IN_FROM_WHITE,
+1 -1
View File
@@ -114,6 +114,6 @@ bool8 sub_80DA4A0(void);
u8 Save_LoadGameData(u8 saveType); u8 Save_LoadGameData(u8 saveType);
u32 TryCopySpecialSaveSection(u8 sector, u8* dst); u32 TryCopySpecialSaveSection(u8 sector, u8* dst);
u32 TryWriteSpecialSaveSection(u8 sector, u8* src); u32 TryWriteSpecialSaveSection(u8 sector, u8* src);
void Task_SaveGame_UpdatedLinkRecords(u8 taskId); void Task_LinkSave(u8 taskId);
#endif // GUARD_SAVE_H #endif // GUARD_SAVE_H
+7 -7
View File
@@ -1532,7 +1532,7 @@ void AnimAirWaveProjectile(struct Sprite *sprite)
{ {
sprite->data[0] = 8; sprite->data[0] = 8;
task->data[5] = 4; task->data[5] = 4;
a = MathUtil_Inv16(0x1000); a = invfx16(0x1000);
sprite->pos1.x += sprite->pos2.x; sprite->pos1.x += sprite->pos2.x;
sprite->pos1.y += sprite->pos2.y; sprite->pos1.y += sprite->pos2.y;
sprite->pos2.y = 0; sprite->pos2.y = 0;
@@ -1551,8 +1551,8 @@ void AnimAirWaveProjectile(struct Sprite *sprite)
sprite->data[1] = 0; sprite->data[1] = 0;
sprite->data[6] = 0; sprite->data[6] = 0;
sprite->data[5] = 0; sprite->data[5] = 0;
sprite->data[3] = MathUtil_Mul16(MathUtil_Mul16(b, a), MathUtil_Inv16(0x1C0)); sprite->data[3] = mulfx16(mulfx16(b, a), invfx16(0x1C0));
sprite->data[4] = MathUtil_Mul16(MathUtil_Mul16(c, a), MathUtil_Inv16(0x1C0)); sprite->data[4] = mulfx16(mulfx16(c, a), invfx16(0x1C0));
sprite->callback = AnimAirWaveProjectile_Step1; sprite->callback = AnimAirWaveProjectile_Step1;
} }
} }
@@ -1643,18 +1643,18 @@ void AnimTask_AirCutterProjectile(u8 taskId)
else else
xDiff = attackerX - targetX; xDiff = attackerX - targetX;
gTasks[taskId].data[5] = MathUtil_Mul16(xDiff, MathUtil_Inv16(gBattleAnimArgs[2] & ~1)); gTasks[taskId].data[5] = mulfx16(xDiff, invfx16(gBattleAnimArgs[2] & ~1));
gTasks[taskId].data[6] = MathUtil_Mul16(gTasks[taskId].data[5], 0x80); gTasks[taskId].data[6] = mulfx16(gTasks[taskId].data[5], 0x80);
gTasks[taskId].data[7] = gBattleAnimArgs[2]; gTasks[taskId].data[7] = gBattleAnimArgs[2];
if (targetY >= attackerY) if (targetY >= attackerY)
{ {
yDiff = targetY - attackerY; yDiff = targetY - attackerY;
gTasks[taskId].data[8] = MathUtil_Mul16(yDiff, MathUtil_Inv16(gTasks[taskId].data[5])) & ~1; gTasks[taskId].data[8] = mulfx16(yDiff, invfx16(gTasks[taskId].data[5])) & ~1;
} }
else else
{ {
yDiff = attackerY - targetY; yDiff = attackerY - targetY;
gTasks[taskId].data[8] = MathUtil_Mul16(yDiff, MathUtil_Inv16(gTasks[taskId].data[5])) | 1; gTasks[taskId].data[8] = mulfx16(yDiff, invfx16(gTasks[taskId].data[5])) | 1;
} }
gTasks[taskId].data[3] = gBattleAnimArgs[3]; gTasks[taskId].data[3] = gBattleAnimArgs[3];
-3
View File
@@ -19,9 +19,6 @@
#undef abs #undef abs
#define abs(a) ((a) < 0 ? -(a) : (a)) #define abs(a) ((a) < 0 ? -(a) : (a))
#define Q_24_8(n) ((s32)((n) * 256))
#define Q_24_8_TO_INT(n) ((int)((n) >> 8))
struct TestingBar struct TestingBar
{ {
s32 maxValue; s32 maxValue;
+44 -44
View File
@@ -867,50 +867,50 @@ const struct Berry gBerries[] = {
}; };
const struct BerryCrushStats gBerryCrushStats[] = { const struct BerryCrushStats gBerryCrush_BerryData[] = {
{ 50, 20}, [ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = { 50, 20},
{ 50, 20}, [ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = { 50, 20},
{ 50, 20}, [ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = { 50, 20},
{ 50, 20}, [ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = { 50, 20},
{ 50, 20}, [ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = { 50, 20},
{ 50, 30}, [ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = { 50, 30},
{ 50, 30}, [ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = { 50, 30},
{ 50, 30}, [ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = { 50, 30},
{ 50, 30}, [ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = { 50, 30},
{ 50, 30}, [ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = { 50, 30},
{ 60, 50}, [ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = { 60, 50},
{ 60, 50}, [ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = { 60, 50},
{ 60, 50}, [ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = { 60, 50},
{ 60, 50}, [ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = { 60, 50},
{ 60, 50}, [ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = { 60, 50},
{ 80, 70}, [ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = { 80, 70},
{ 80, 70}, [ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = { 80, 70},
{ 80, 70}, [ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = { 80, 70},
{ 80, 70}, [ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = { 80, 70},
{ 80, 70}, [ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = { 80, 70},
{100, 100}, [ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = {100, 100},
{100, 100}, [ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = {100, 100},
{100, 100}, [ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = {100, 100},
{100, 100}, [ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = {100, 100},
{100, 100}, [ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = {100, 100},
{130, 150}, [ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = {130, 150},
{130, 150}, [ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = {130, 150},
{130, 150}, [ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = {130, 150},
{130, 150}, [ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = {130, 150},
{130, 150}, [ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = {130, 150},
{160, 250}, [ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = {160, 250},
{160, 250}, [ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = {160, 250},
{160, 250}, [ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = {160, 250},
{160, 250}, [ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = {160, 250},
{160, 250}, [ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = {160, 250},
{180, 500}, [ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = {180, 500},
{180, 500}, [ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = {180, 500},
{180, 500}, [ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = {180, 500},
{180, 500}, [ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = {180, 500},
{180, 500}, [ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = {180, 500},
{200, 750}, [ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = {200, 750},
{200, 750}, [ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = {200, 750},
{150, 200} [ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = {150, 200}
}; };
// Leftover from R/S // Leftover from R/S
+1569 -1269
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -74,7 +74,7 @@ bool32 DigitObjUtil_Init(u32 count)
u32 i; u32 i;
if (sOamWork != NULL) if (sOamWork != NULL)
DigitObjUtil_Teardown(); DigitObjUtil_Free();
sOamWork = Alloc(sizeof(*sOamWork)); sOamWork = Alloc(sizeof(*sOamWork));
if (sOamWork == NULL) if (sOamWork == NULL)
@@ -97,7 +97,7 @@ bool32 DigitObjUtil_Init(u32 count)
return TRUE; return TRUE;
} }
void DigitObjUtil_Teardown(void) void DigitObjUtil_Free(void)
{ {
if (sOamWork != NULL) if (sOamWork != NULL)
{ {
+7 -7
View File
@@ -299,7 +299,7 @@ static void sub_8150A84(u8 taskId)
case 2: case 2:
if (!sub_8155E68()) if (!sub_8155E68())
{ {
LinkRfu_SetRfuFuncToSend6600(); Rfu_SetLinkStandbyCallback();
gUnknown_203F3E0->unk0C++; gUnknown_203F3E0->unk0C++;
} }
break; break;
@@ -412,7 +412,7 @@ static void sub_8150CF4(void)
gUnknown_203F3E0->unk10++; gUnknown_203F3E0->unk10++;
break; break;
case 1: case 1:
LinkRfu_SetRfuFuncToSend6600(); Rfu_SetLinkStandbyCallback();
gUnknown_203F3E0->unk10++; gUnknown_203F3E0->unk10++;
break; break;
case 2: case 2:
@@ -424,7 +424,7 @@ static void sub_8150CF4(void)
case 3: case 3:
if (!IsMinigameCountdownRunning()) if (!IsMinigameCountdownRunning())
{ {
LinkRfu_SetRfuFuncToSend6600(); Rfu_SetLinkStandbyCallback();
gUnknown_203F3E0->unk10++; gUnknown_203F3E0->unk10++;
} }
break; break;
@@ -1023,12 +1023,12 @@ static void sub_815184C(void)
{ {
if (gUnknown_203F3E0->unk128 != 0) if (gUnknown_203F3E0->unk128 != 0)
{ {
sub_80FBA44(); ClearRecvCommands();
gUnknown_203F3E0->unk124 = 0; gUnknown_203F3E0->unk124 = 0;
} }
else if (gUnknown_203F3E0->unk124 > 70) else if (gUnknown_203F3E0->unk124 > 70)
{ {
sub_80FBA44(); ClearRecvCommands();
gUnknown_203F3E0->unk124 = 0; gUnknown_203F3E0->unk124 = 0;
} }
} }
@@ -1089,12 +1089,12 @@ static void sub_8151A5C(void)
{ {
if (gUnknown_203F3E0->unk128 != 0) if (gUnknown_203F3E0->unk128 != 0)
{ {
sub_80FBA44(); ClearRecvCommands();
gUnknown_203F3E0->unk124 = 0; gUnknown_203F3E0->unk124 = 0;
} }
else if (gUnknown_203F3E0->unk124 > 70) else if (gUnknown_203F3E0->unk124 > 70)
{ {
sub_80FBA44(); ClearRecvCommands();
gUnknown_203F3E0->unk124 = 0; gUnknown_203F3E0->unk124 = 0;
} }
} }
+3 -3
View File
@@ -1431,12 +1431,12 @@ static void sub_8155A78(void)
case 2: case 2:
if (!IsDma3ManagerBusyWithBgCopy()) if (!IsDma3ManagerBusyWithBgCopy())
{ {
CreateTask(Task_SaveGame_UpdatedLinkRecords, 0); CreateTask(Task_LinkSave, 0);
gUnknown_203F440->state++; gUnknown_203F440->state++;
} }
break; break;
case 3: case 3:
if (!FuncIsActiveTask(Task_SaveGame_UpdatedLinkRecords)) if (!FuncIsActiveTask(Task_LinkSave))
gUnknown_203F440->state++; gUnknown_203F440->state++;
break; break;
default: default:
@@ -1577,7 +1577,7 @@ static void sub_8155EA0(void)
ChangeBgX(3, 0, 0); ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0); ChangeBgY(3, 0, 0);
InitStandardTextBoxWindows(); InitStandardTextBoxWindows();
ResetBg0(); InitTextBoxGfxAndPrinters();
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
SetBgTilemapBuffer(3, gUnknown_203F440->tilemapBuffers[0]); SetBgTilemapBuffer(3, gUnknown_203F440->tilemapBuffers[0]);
SetBgTilemapBuffer(1, gUnknown_203F440->tilemapBuffers[1]); SetBgTilemapBuffer(1, gUnknown_203F440->tilemapBuffers[1]);
+4 -4
View File
@@ -8,7 +8,7 @@ void sub_815A5BC(s32 a0)
struct Padded_U8 data[2]; struct Padded_U8 data[2];
data[0].value = 1; data[0].value = 1;
data[1].value = a0; data[1].value = a0;
RfuPrepareSend0x2f00(data); Rfu_SendPacket(data);
} }
u8 sub_815A5E8(s32 a0) u8 sub_815A5E8(s32 a0)
@@ -114,7 +114,7 @@ void sub_815A61C(struct DodrioSubstruct_31A0 * arg0, struct DodrioSubstruct_31A0
packet.unkA_3 = arg6; packet.unkA_3 = arg6;
packet.unkB_1 = arg7; packet.unkB_1 = arg7;
packet.unkB_0 = arg8; packet.unkB_0 = arg8;
RfuPrepareSend0x2f00(&packet); Rfu_SendPacket(&packet);
} }
u32 sub_815A950(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) u32 sub_815A950(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)
@@ -192,7 +192,7 @@ void sub_815AAD8(u8 arg0)
struct UnkPacket3 packet; struct UnkPacket3 packet;
packet.id = 3; packet.id = 3;
packet.unk4 = arg0; packet.unk4 = arg0;
RfuPrepareSend0x2f00(&packet); Rfu_SendPacket(&packet);
} }
u32 sub_815AB04(u32 arg0, u8 *arg1) u32 sub_815AB04(u32 arg0, u8 *arg1)
@@ -223,7 +223,7 @@ void sub_815AB3C(u32 arg0)
struct UnkPacket4 packet; struct UnkPacket4 packet;
packet.id = 4; packet.id = 4;
packet.unk4 = arg0; packet.unk4 = arg0;
RfuPrepareSend0x2f00(&packet); Rfu_SendPacket(&packet);
} }
u32 sub_815AB60(u32 arg0) u32 sub_815AB60(u32 arg0)
+3 -3
View File
@@ -1414,7 +1414,7 @@ const u32 gTradeGba_Gfx[] = INCBIN_U32("graphics/link/gba.4bpp");
const u16 gUnknown_8EAFE80[] = INCBIN_U16("graphics/interface/blank2.gbapal"); const u16 gUnknown_8EAFE80[] = INCBIN_U16("graphics/interface/blank2.gbapal");
const u16 gUnknown_8EAFEA0[] = INCBIN_U16("graphics/berry_crush/berry_crush.gbapal"); const u16 gBerryCrush_Crusher_Pal[] = INCBIN_U16("graphics/berry_crush/berry_crush.gbapal");
const u16 gUnknown_8EAFF60[] = INCBIN_U16("graphics/unknown/unknown_EAFF60.gbapal"); const u16 gUnknown_8EAFF60[] = INCBIN_U16("graphics/unknown/unknown_EAFF60.gbapal");
const u32 gUnknown_8EAFFC0[] = INCBIN_U32("graphics/berry_crush/berry_crush.4bpp.lz"); const u32 gBerryCrush_Crusher_Gfx[] = INCBIN_U32("graphics/berry_crush/berry_crush.4bpp.lz");
const u32 gUnknown_8EB0ADC[] = INCBIN_U32("graphics/berry_crush/data_EB0ADC.bin.lz"); const u32 gBerryCrush_Crusher_Tilemap[] = INCBIN_U32("graphics/berry_crush/data_EB0ADC.bin.lz");
+1 -1
View File
@@ -1198,7 +1198,7 @@ static bool8 DrawHofBackground(void)
break; break;
case 3: case 3:
InitStandardTextBoxWindows(); InitStandardTextBoxWindows();
ResetBg0(); InitTextBoxGfxAndPrinters();
break; break;
case 4: case 4:
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
+1 -1
View File
@@ -139,7 +139,7 @@ bool8 CheckBagHasItem(u16 itemId, u16 count)
return FALSE; return FALSE;
} }
bool8 CheckHasAtLeastOneBerry(void) bool8 HasAtLeastOneBerry(void)
{ {
u8 itemId; u8 itemId;
bool8 exists; bool8 exists;
+1 -1
View File
@@ -1381,7 +1381,7 @@ void SetLinkStandbyCallback(void)
{ {
if (gWirelessCommType == 1) if (gWirelessCommType == 1)
{ {
LinkRfu_SetRfuFuncToSend6600(); Rfu_SetLinkStandbyCallback();
} }
else else
{ {
+43 -43
View File
@@ -894,7 +894,7 @@ static void HandleSendFailure(u8 unused, u32 flags)
{ {
if (!(flags & 1)) if (!(flags & 1))
{ {
sResendBlock16[0] = RFU_COMMAND_0x8900 | i; sResendBlock16[0] = RFUCMD_0x8900 | i;
for (j = 0; j < 7; j++) for (j = 0; j < 7; j++)
{ {
sResendBlock16[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0]; sResendBlock16[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0];
@@ -949,7 +949,7 @@ static void RfuFunc_SendKeysToRfu(void)
{ {
gUnknown_3001188++; gUnknown_3001188++;
gHeldKeyCodeToSend |= (gUnknown_3001188 << 8); gHeldKeyCodeToSend |= (gUnknown_3001188 << 8);
RfuPrepareSendBuffer(RFU_COMMAND_0xbe00); RfuPrepareSendBuffer(RFUCMD_SEND_HELD_KEYS);
} }
} }
@@ -983,18 +983,18 @@ static void RfuHandleReceiveCommand(u8 unused)
{ {
switch (gRecvCmds[i][0] & 0xff00) switch (gRecvCmds[i][0] & 0xff00)
{ {
case RFU_COMMAND_0x7800: case RFUCMD_0x7800:
if (Rfu.parent_child == MODE_CHILD && gReceivedRemoteLinkPlayers) if (Rfu.parent_child == MODE_CHILD && gReceivedRemoteLinkPlayers)
return; return;
// fallthrough // fallthrough
case RFU_COMMAND_0x7700: case RFUCMD_0x7700:
if (gRfuLinkStatus->parentChild == MODE_CHILD) if (gRfuLinkStatus->parentChild == MODE_CHILD)
{ {
Rfu.playerCount = gRecvCmds[i][1]; Rfu.playerCount = gRecvCmds[i][1];
Rfu.unk_cce = sub_80F9770((u8 *)(gRecvCmds[i] + 2)); Rfu.unk_cce = sub_80F9770((u8 *)(gRecvCmds[i] + 2));
} }
break; break;
case RFU_COMMAND_0x8800: case RFUCMD_0x8800:
if (Rfu.cmd_8800_recvbuf[i].receiving == 0) if (Rfu.cmd_8800_recvbuf[i].receiving == 0)
{ {
Rfu.cmd_8800_recvbuf[i].next = 0; Rfu.cmd_8800_recvbuf[i].next = 0;
@@ -1005,7 +1005,7 @@ static void RfuHandleReceiveCommand(u8 unused)
Rfu.unk_5c[i] = 0; Rfu.unk_5c[i] = 0;
} }
break; break;
case RFU_COMMAND_0x8900: case RFUCMD_0x8900:
if (Rfu.cmd_8800_recvbuf[i].receiving == 1) if (Rfu.cmd_8800_recvbuf[i].receiving == 1)
{ {
Rfu.cmd_8800_recvbuf[i].next = gRecvCmds[i][0] & 0xff; Rfu.cmd_8800_recvbuf[i].next = gRecvCmds[i][0] & 0xff;
@@ -1021,17 +1021,17 @@ static void RfuHandleReceiveCommand(u8 unused)
} }
} }
break; break;
case RFU_COMMAND_0xa100: case RFUCMD_SEND_BLOCK_REQ:
Rfu_InitBlockSend(gUnknown_843EC64[gRecvCmds[i][1]].buffer, (u16)gUnknown_843EC64[gRecvCmds[i][1]].size); Rfu_InitBlockSend(gUnknown_843EC64[gRecvCmds[i][1]].buffer, (u16)gUnknown_843EC64[gRecvCmds[i][1]].size);
break; break;
case RFU_COMMAND_0x5f00: case RFUCMD_READY_CLOSE_LINK:
Rfu.cmd5f00Ack[i] = 1; Rfu.cmd5f00Ack[i] = 1;
break; break;
case RFU_COMMAND_0x6600: case RFUCMD_READY_EXIT_STANDBY:
if (Rfu.cmd_6600_count == gRecvCmds[i][1]) if (Rfu.cmd_6600_count == gRecvCmds[i][1])
Rfu.cmd_6600_recvd[i] = 1; Rfu.cmd_6600_recvd[i] = 1;
break; break;
case RFU_COMMAND_0xed00: case RFUCMD_0xEE00:
if (Rfu.parent_child == MODE_CHILD) if (Rfu.parent_child == MODE_CHILD)
{ {
if (gReceivedRemoteLinkPlayers) if (gReceivedRemoteLinkPlayers)
@@ -1048,13 +1048,13 @@ static void RfuHandleReceiveCommand(u8 unused)
} }
else else
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0xee00); RfuPrepareSendBuffer(RFUCMD_0xED00);
gSendCmd[1] = gRecvCmds[i][1]; gSendCmd[1] = gRecvCmds[i][1];
gSendCmd[2] = gRecvCmds[i][2]; gSendCmd[2] = gRecvCmds[i][2];
gSendCmd[3] = gRecvCmds[i][3]; gSendCmd[3] = gRecvCmds[i][3];
} }
break; break;
case RFU_COMMAND_0xee00: case RFUCMD_0xED00:
if (Rfu.parent_child == MODE_PARENT) if (Rfu.parent_child == MODE_PARENT)
{ {
Rfu.bm_DisconnectSlot |= gRecvCmds[i][1]; Rfu.bm_DisconnectSlot |= gRecvCmds[i][1];
@@ -1062,7 +1062,7 @@ static void RfuHandleReceiveCommand(u8 unused)
sub_80FA9D0(gRecvCmds[i][1]); sub_80FA9D0(gRecvCmds[i][1]);
} }
break; break;
case RFU_COMMAND_0xbe00: case RFUCMD_SEND_HELD_KEYS:
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1]; gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
break; break;
} }
@@ -1138,16 +1138,16 @@ static void RfuPrepareSendBuffer(u16 command)
gSendCmd[0] = command; gSendCmd[0] = command;
switch (command) switch (command)
{ {
case RFU_COMMAND_0x8800: case RFUCMD_0x8800:
gSendCmd[1] = Rfu.cmd_8800_sendbuf.count; gSendCmd[1] = Rfu.cmd_8800_sendbuf.count;
gSendCmd[2] = Rfu.cmd_8800_sendbuf.owner + 0x80; gSendCmd[2] = Rfu.cmd_8800_sendbuf.owner + 0x80;
break; break;
case RFU_COMMAND_0xa100: case RFUCMD_SEND_BLOCK_REQ:
if (Cmd8000recvIsFinished()) if (Cmd8000recvIsFinished())
gSendCmd[1] = Rfu.cmdA100_blockRequestType; gSendCmd[1] = Rfu.cmdA100_blockRequestType;
break; break;
case RFU_COMMAND_0x7700: case RFUCMD_0x7700:
case RFU_COMMAND_0x7800: case RFUCMD_0x7800:
tmp = Rfu.bm_PartnerFlags ^ Rfu.bm_DisconnectSlot; tmp = Rfu.bm_PartnerFlags ^ Rfu.bm_DisconnectSlot;
Rfu.playerCount = gUnknown_843EC41[tmp] + 1; Rfu.playerCount = gUnknown_843EC41[tmp] + 1;
gSendCmd[1] = Rfu.playerCount; gSendCmd[1] = Rfu.playerCount;
@@ -1155,30 +1155,30 @@ static void RfuPrepareSendBuffer(u16 command)
for (i = 0; i < RFU_CHILD_MAX; i++) for (i = 0; i < RFU_CHILD_MAX; i++)
buff[i] = Rfu.linkPlayerIdx[i]; buff[i] = Rfu.linkPlayerIdx[i];
break; break;
case RFU_COMMAND_0x6600: case RFUCMD_READY_EXIT_STANDBY:
case RFU_COMMAND_0x5f00: case RFUCMD_READY_CLOSE_LINK:
gSendCmd[1] = Rfu.cmd_6600_count; gSendCmd[1] = Rfu.cmd_6600_count;
break; break;
case RFU_COMMAND_0x2f00: case RFUCMD_SEND_PACKET:
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
gSendCmd[1 + i] = Rfu.unk_f2[i]; gSendCmd[1 + i] = Rfu.unk_f2[i];
break; break;
case RFU_COMMAND_0xbe00: case RFUCMD_SEND_HELD_KEYS:
gSendCmd[1] = gHeldKeyCodeToSend; gSendCmd[1] = gHeldKeyCodeToSend;
break; break;
case RFU_COMMAND_0xee00: case RFUCMD_0xED00:
break; break;
case RFU_COMMAND_0xed00: case RFUCMD_0xEE00:
break; break;
} }
} }
void RfuPrepareSend0x2f00(void * data) void Rfu_SendPacket(void * data)
{ {
if (gSendCmd[0] == 0 && !RfuIsErrorStatus1or2()) if (gSendCmd[0] == 0 && !RfuIsErrorStatus1or2())
{ {
memcpy(Rfu.unk_f2, data, sizeof(Rfu.unk_f2)); memcpy(Rfu.unk_f2, data, sizeof(Rfu.unk_f2));
RfuPrepareSendBuffer(RFU_COMMAND_0x2f00); RfuPrepareSendBuffer(RFUCMD_SEND_PACKET);
} }
} }
@@ -1208,7 +1208,7 @@ bool32 Rfu_InitBlockSend(const u8 *src, size_t size)
memcpy(gBlockSendBuffer, src, size); memcpy(gBlockSendBuffer, src, size);
Rfu.cmd_8800_sendbuf.payload = gBlockSendBuffer; Rfu.cmd_8800_sendbuf.payload = gBlockSendBuffer;
} }
RfuPrepareSendBuffer(RFU_COMMAND_0x8800); RfuPrepareSendBuffer(RFUCMD_0x8800);
Rfu.RfuFunc = RfuFunc_HandleBlockSend; Rfu.RfuFunc = RfuFunc_HandleBlockSend;
Rfu.unk_5b = 0; Rfu.unk_5b = 0;
return TRUE; return TRUE;
@@ -1218,7 +1218,7 @@ static void RfuFunc_HandleBlockSend(void)
{ {
if (gSendCmd[0] == 0) if (gSendCmd[0] == 0)
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0x8800); RfuPrepareSendBuffer(RFUCMD_0x8800);
if (Rfu.parent_child == MODE_PARENT) if (Rfu.parent_child == MODE_PARENT)
{ {
if (++Rfu.unk_5b > 2) if (++Rfu.unk_5b > 2)
@@ -1226,7 +1226,7 @@ static void RfuFunc_HandleBlockSend(void)
} }
else else
{ {
if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == RFU_COMMAND_0x8800) if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == RFUCMD_0x8800)
Rfu.RfuFunc = RfuFunc_SendNextBlock; Rfu.RfuFunc = RfuFunc_SendNextBlock;
} }
} }
@@ -1235,7 +1235,7 @@ static void RfuFunc_SendNextBlock(void)
{ {
s32 i; s32 i;
const u8 *src = Rfu.cmd_8800_sendbuf.payload; const u8 *src = Rfu.cmd_8800_sendbuf.payload;
gSendCmd[0] = RFU_COMMAND_0x8900 | Rfu.cmd_8800_sendbuf.next; gSendCmd[0] = RFUCMD_0x8900 | Rfu.cmd_8800_sendbuf.next;
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
gSendCmd[i + 1] = (src[(i << 1) + Rfu.cmd_8800_sendbuf.next * 12 + 1] << 8) | src[(i << 1) + Rfu.cmd_8800_sendbuf.next * 12 + 0]; gSendCmd[i + 1] = (src[(i << 1) + Rfu.cmd_8800_sendbuf.next * 12 + 1] << 8) | src[(i << 1) + Rfu.cmd_8800_sendbuf.next * 12 + 0];
Rfu.cmd_8800_sendbuf.next++; Rfu.cmd_8800_sendbuf.next++;
@@ -1253,7 +1253,7 @@ static void RfuFunc_SendLastBlock(void)
s32 i; s32 i;
if (Rfu.parent_child == MODE_CHILD) if (Rfu.parent_child == MODE_CHILD)
{ {
gSendCmd[0] = RFU_COMMAND_0x8900 | (Rfu.cmd_8800_sendbuf.count - 1); gSendCmd[0] = RFUCMD_0x8900 | (Rfu.cmd_8800_sendbuf.count - 1);
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
gSendCmd[i + 1] = (src[(i << 1) + (Rfu.cmd_8800_sendbuf.count - 1) * 12 + 1] << 8) | src[(i << 1) + (Rfu.cmd_8800_sendbuf.count - 1) * 12 + 0]; gSendCmd[i + 1] = (src[(i << 1) + (Rfu.cmd_8800_sendbuf.count - 1) * 12 + 1] << 8) | src[(i << 1) + (Rfu.cmd_8800_sendbuf.count - 1) * 12 + 0];
if ((u8)gRecvCmds[mpId][0] == Rfu.cmd_8800_sendbuf.count - 1) if ((u8)gRecvCmds[mpId][0] == Rfu.cmd_8800_sendbuf.count - 1)
@@ -1274,7 +1274,7 @@ static void RfuFunc_SendLastBlock(void)
bool8 LinkRfu_PrepareCmd0xA100(u8 blockRequestType) bool8 LinkRfu_PrepareCmd0xA100(u8 blockRequestType)
{ {
Rfu.cmdA100_blockRequestType = blockRequestType; Rfu.cmdA100_blockRequestType = blockRequestType;
RfuPrepareSendBuffer(RFU_COMMAND_0xa100); RfuPrepareSendBuffer(RFUCMD_SEND_BLOCK_REQ);
return TRUE; return TRUE;
} }
@@ -1340,7 +1340,7 @@ static void RfuFunc_BuildCommand5F00(void)
{ {
if (gSendCmd[0] == 0 && !Rfu.unk_ce8) if (gSendCmd[0] == 0 && !Rfu.unk_ce8)
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0x5f00); RfuPrepareSendBuffer(RFUCMD_READY_CLOSE_LINK);
Rfu.RfuFunc = RfuFunc_WaitAck5F00; Rfu.RfuFunc = RfuFunc_WaitAck5F00;
} }
} }
@@ -1370,7 +1370,7 @@ static void RfuFunc_Send6600_3(void)
{ {
if (Rfu.unk_124.count == 0 && Rfu.cmd_6600_timer > 60) if (Rfu.unk_124.count == 0 && Rfu.cmd_6600_timer > 60)
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0x6600); RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
Rfu.cmd_6600_timer = 0; Rfu.cmd_6600_timer = 0;
} }
} }
@@ -1394,7 +1394,7 @@ static void RfuFunc_Send6600_2(void)
{ {
if (Rfu.unk_124.count == 0 && gSendCmd[0] == 0) if (Rfu.unk_124.count == 0 && gSendCmd[0] == 0)
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0x6600); RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
Rfu.RfuFunc = RfuFunc_Send6600_3; Rfu.RfuFunc = RfuFunc_Send6600_3;
} }
} }
@@ -1408,7 +1408,7 @@ static void RfuFunc_Send6600_1(void)
{ {
if (Rfu.unk_124.count == 0 && gSendCmd[0] == 0) if (Rfu.unk_124.count == 0 && gSendCmd[0] == 0)
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0x6600); RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
Rfu.RfuFunc = RfuFunc_Send6600_3; Rfu.RfuFunc = RfuFunc_Send6600_3;
} }
} }
@@ -1424,14 +1424,14 @@ static void RfuFunc_Send6600_1(void)
{ {
if (Rfu.unk_124.count == 0 && gSendCmd[0] == 0) if (Rfu.unk_124.count == 0 && gSendCmd[0] == 0)
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0x6600); RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
Rfu.RfuFunc = RfuFunc_Send6600_2; Rfu.RfuFunc = RfuFunc_Send6600_2;
} }
} }
} }
} }
void LinkRfu_SetRfuFuncToSend6600(void) void Rfu_SetLinkStandbyCallback(void)
{ {
if (Rfu.RfuFunc == NULL) if (Rfu.RfuFunc == NULL)
{ {
@@ -1638,9 +1638,9 @@ static void sub_80FA834(u8 taskId)
if (Rfu.parent_child == MODE_PARENT) if (Rfu.parent_child == MODE_PARENT)
{ {
if (gReceivedRemoteLinkPlayers) if (gReceivedRemoteLinkPlayers)
RfuPrepareSendBuffer(RFU_COMMAND_0x7800); RfuPrepareSendBuffer(RFUCMD_0x7800);
else else
RfuPrepareSendBuffer(RFU_COMMAND_0x7700); RfuPrepareSendBuffer(RFUCMD_0x7700);
gTasks[taskId].data[0] = 101; gTasks[taskId].data[0] = 101;
} }
else else
@@ -1660,7 +1660,7 @@ static void sub_80FA834(u8 taskId)
if (Cmd8000recvIsFinished()) if (Cmd8000recvIsFinished())
{ {
Rfu.cmdA100_blockRequestType = 0; Rfu.cmdA100_blockRequestType = 0;
RfuPrepareSendBuffer(RFU_COMMAND_0xa100); RfuPrepareSendBuffer(RFUCMD_SEND_BLOCK_REQ);
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
} }
@@ -1750,7 +1750,7 @@ static void Task_ExchangeLinkPlayers(u8 taskId)
if (gSendCmd[0] == 0) if (gSendCmd[0] == 0)
{ {
ResetBlockReceivedFlag(r4); ResetBlockReceivedFlag(r4);
RfuPrepareSendBuffer(RFU_COMMAND_0x7800); RfuPrepareSendBuffer(RFUCMD_0x7800);
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
break; break;
@@ -2393,7 +2393,7 @@ void RFUVSync(void)
rfu_LMAN_syncVBlank(); rfu_LMAN_syncVBlank();
} }
void sub_80FBA44(void) void ClearRecvCommands(void)
{ {
CpuFill32(0, gRecvCmds, sizeof(gRecvCmds)); CpuFill32(0, gRecvCmds, sizeof(gRecvCmds));
} }
@@ -2561,7 +2561,7 @@ static void sub_80FBDB8(u8 taskId)
{ {
if (gSendCmd[0] == 0 && !Rfu.unk_ce8) if (gSendCmd[0] == 0 && !Rfu.unk_ce8)
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0xed00); RfuPrepareSendBuffer(RFUCMD_0xEE00);
gSendCmd[1] = gTasks[taskId].data[0]; gSendCmd[1] = gTasks[taskId].data[0];
gSendCmd[2] = gTasks[taskId].data[1]; gSendCmd[2] = gTasks[taskId].data[1];
Rfu.playerCount -= gUnknown_843EC41[gTasks[taskId].data[0]]; Rfu.playerCount -= gUnknown_843EC41[gTasks[taskId].data[0]];
+9 -9
View File
@@ -1,6 +1,6 @@
#include "global.h" #include "global.h"
s16 MathUtil_Mul16(s16 x, s16 y) s16 mulfx16(s16 x, s16 y)
{ {
s32 result; s32 result;
@@ -10,7 +10,7 @@ s16 MathUtil_Mul16(s16 x, s16 y)
return result; return result;
} }
s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y) s16 mulfxn16(u8 s, s16 x, s16 y)
{ {
s32 result; s32 result;
@@ -20,7 +20,7 @@ s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y)
return result; return result;
} }
s32 MathUtil_Mul32(s32 x, s32 y) s32 mulfx32(s32 x, s32 y)
{ {
s64 result; s64 result;
@@ -30,7 +30,7 @@ s32 MathUtil_Mul32(s32 x, s32 y)
return result; return result;
} }
s16 MathUtil_Div16(s16 x, s16 y) s16 divfx16(s16 x, s16 y)
{ {
if (y == 0) if (y == 0)
{ {
@@ -39,7 +39,7 @@ s16 MathUtil_Div16(s16 x, s16 y)
return (x << 8) / y; return (x << 8) / y;
} }
s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y) s16 divfxn16(u8 s, s16 x, s16 y)
{ {
if (y == 0) if (y == 0)
{ {
@@ -48,7 +48,7 @@ s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y)
return (x << s) / y; return (x << s) / y;
} }
s32 MathUtil_Div32(s32 x, s32 y) s32 divfx32(s32 x, s32 y)
{ {
s64 _x; s64 _x;
@@ -61,7 +61,7 @@ s32 MathUtil_Div32(s32 x, s32 y)
return _x / y; return _x / y;
} }
s16 MathUtil_Inv16(s16 y) s16 invfx16(s16 y)
{ {
s32 x; s32 x;
@@ -69,7 +69,7 @@ s16 MathUtil_Inv16(s16 y)
return x / y; return x / y;
} }
s16 MathUtil_Inv16Shift(u8 s, s16 y) s16 invfxn16(u8 s, s16 y)
{ {
s32 x; s32 x;
@@ -77,7 +77,7 @@ s16 MathUtil_Inv16Shift(u8 s, s16 y)
return x / y; return x / y;
} }
s32 MathUtil_Inv32(s32 y) s32 invfx32(s32 y)
{ {
s64 x; s64 x;
+1 -1
View File
@@ -496,7 +496,7 @@ static void NamingScreen_InitBGs(void)
ChangeBgY(3, 0, 0); ChangeBgY(3, 0, 0);
InitStandardTextBoxWindows(); InitStandardTextBoxWindows();
ResetBg0(); InitTextBoxGfxAndPrinters();
for (i = 0; i < NELEMS(gUnknown_83E22A0) - 1; i++) for (i = 0; i < NELEMS(gUnknown_83E22A0) - 1; i++)
sNamingScreenData->windows[i] = AddWindow(&gUnknown_83E22A0[i]); sNamingScreenData->windows[i] = AddWindow(&gUnknown_83E22A0[i]);
+1 -1
View File
@@ -388,7 +388,7 @@ void FreeAllOverworldWindowBuffers(void)
FreeAllWindowBuffers(); FreeAllWindowBuffers();
} }
void ResetBg0(void) void InitTextBoxGfxAndPrinters(void)
{ {
ChangeBgX(0, 0, 0); ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0); ChangeBgY(0, 0, 0);
+4 -4
View File
@@ -534,7 +534,7 @@ static void Task_OaksSpeech1(u8 taskId)
case 4: case 4:
gPaletteFade.bufferTransferDisabled = TRUE; gPaletteFade.bufferTransferDisabled = TRUE;
InitStandardTextBoxWindows(); InitStandardTextBoxWindows();
ResetBg0(); InitTextBoxGfxAndPrinters();
Menu_LoadStdPalAt(0xD0); Menu_LoadStdPalAt(0xD0);
LoadPalette(sHelpDocsPalette, 0x000, 0x080); LoadPalette(sHelpDocsPalette, 0x000, 0x080);
LoadPalette(stdpal_get(2) + 15, 0x000, 0x002); LoadPalette(stdpal_get(2) + 15, 0x000, 0x002);
@@ -1418,8 +1418,8 @@ static void Task_OakSpeech39(u8 taskId)
PlaySE(SE_WARP_IN); PlaySE(SE_WARP_IN);
r0 = data[2]; r0 = data[2];
data[2] -= 32; data[2] -= 32;
x = MathUtil_Inv16(r0 - 8); x = invfx16(r0 - 8);
y = MathUtil_Inv16(data[2] - 16); y = invfx16(data[2] - 16);
SetBgAffine(2, 0x7800, 0x5400, 0x78, 0x54, x, y, 0); SetBgAffine(2, 0x7800, 0x5400, 0x78, 0x54, x, y, 0);
if (data[2] <= 96) if (data[2] <= 96)
{ {
@@ -1566,7 +1566,7 @@ static void CB2_ReturnFromNamingScreen(void)
case 3: case 3:
FreeAllWindowBuffers(); FreeAllWindowBuffers();
InitStandardTextBoxWindows(); InitStandardTextBoxWindows();
ResetBg0(); InitTextBoxGfxAndPrinters();
LoadPalette(sHelpDocsPalette, 0, 0xe0); LoadPalette(sHelpDocsPalette, 0, 0xe0);
break; break;
case 4: case 4:
+2 -2
View File
@@ -1345,7 +1345,7 @@ static void InitOverworldBgs(void)
SetBgTilemapBuffer(2, gBGTilemapBuffers1); SetBgTilemapBuffer(2, gBGTilemapBuffers1);
SetBgTilemapBuffer(3, gBGTilemapBuffers3); SetBgTilemapBuffer(3, gBGTilemapBuffers3);
InitStandardTextBoxWindows(); InitStandardTextBoxWindows();
ResetBg0(); InitTextBoxGfxAndPrinters();
sub_8069348(); sub_8069348();
} }
@@ -1363,7 +1363,7 @@ static void InitOverworldBgs_NoResetHeap(void)
SetBgTilemapBuffer(2, gBGTilemapBuffers1); SetBgTilemapBuffer(2, gBGTilemapBuffers1);
SetBgTilemapBuffer(3, gBGTilemapBuffers3); SetBgTilemapBuffer(3, gBGTilemapBuffers3);
InitStandardTextBoxWindows(); InitStandardTextBoxWindows();
ResetBg0(); InitTextBoxGfxAndPrinters();
sub_8069348(); sub_8069348();
} }
+1 -1
View File
@@ -244,7 +244,7 @@ static void sub_8147A34(u8 taskId)
memset(packet, 0, sizeof(packet)); memset(packet, 0, sizeof(packet));
packet[0] = 0x7FFF; packet[0] = 0x7FFF;
packet[1] = data[12]; packet[1] = data[12];
RfuPrepareSend0x2f00(packet); Rfu_SendPacket(packet);
} }
} }
else else
+2 -2
View File
@@ -1002,12 +1002,12 @@ static bool32 sub_814881C(void)
case 2: case 2:
if (sub_8149804()) if (sub_8149804())
{ {
CreateTask(Task_SaveGame_UpdatedLinkRecords, 6); CreateTask(Task_LinkSave, 6);
gUnknown_203F3D4->unk8++; gUnknown_203F3D4->unk8++;
} }
break; break;
case 3: case 3:
if (!FuncIsActiveTask(Task_SaveGame_UpdatedLinkRecords)) if (!FuncIsActiveTask(Task_LinkSave))
{ {
sub_814A6CC(); sub_814A6CC();
gUnknown_203F3D4->unk8++; gUnknown_203F3D4->unk8++;
+4 -4
View File
@@ -17,7 +17,7 @@ void sub_8149A6C(struct PokemonJump1_MonInfo *arg0)
packet.species = arg0->species; packet.species = arg0->species;
packet.otId = arg0->otId; packet.otId = arg0->otId;
packet.personality = arg0->personality; packet.personality = arg0->personality;
RfuPrepareSend0x2f00(&packet); Rfu_SendPacket(&packet);
} }
bool32 sub_8149A90(int multiplayerId, struct PokemonJump1_MonInfo *arg0) bool32 sub_8149A90(int multiplayerId, struct PokemonJump1_MonInfo *arg0)
@@ -51,7 +51,7 @@ void sub_8149AE0(u32 arg0)
struct UnkPacket2 packet; struct UnkPacket2 packet;
packet.id = 2; packet.id = 2;
packet.unk4 = arg0; packet.unk4 = arg0;
RfuPrepareSend0x2f00(&packet); Rfu_SendPacket(&packet);
} }
struct UnkPacket3 struct UnkPacket3
@@ -79,7 +79,7 @@ void sub_8149AF8(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1)
packet.unk2 = arg0->unk10; packet.unk2 = arg0->unk10;
packet.unk3_1 = arg0->unk14; packet.unk3_1 = arg0->unk14;
packet.unk4 = arg0->unkE; packet.unk4 = arg0->unkE;
RfuPrepareSend0x2f00(&packet); Rfu_SendPacket(&packet);
} }
bool32 sub_8149B7C(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1) bool32 sub_8149B7C(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1)
@@ -125,7 +125,7 @@ void sub_8149BF4(struct PokemonJump1_82E4 *arg0, u8 arg1, u16 arg2)
packet.unk4 = arg0->unkE; packet.unk4 = arg0->unkE;
packet.unk6 = arg1; packet.unk6 = arg1;
packet.unk8 = arg2; packet.unk8 = arg2;
RfuPrepareSend0x2f00(&packet); Rfu_SendPacket(&packet);
} }
bool32 sub_8149C24(struct PokemonJump1_82E4 *arg0, int multiplayerId, u8 *arg2, u16 *arg3) bool32 sub_8149C24(struct PokemonJump1_82E4 *arg0, int multiplayerId, u8 *arg2, u16 *arg3)
+1 -1
View File
@@ -55,7 +55,7 @@ void sub_8149CEC(struct PokemonJump2 *arg0)
void sub_8149D24(void) void sub_8149D24(void)
{ {
FreeAllWindowBuffers(); FreeAllWindowBuffers();
DigitObjUtil_Teardown(); DigitObjUtil_Free();
} }
static void sub_8149D34(struct PokemonJump2 *arg0) static void sub_8149D34(struct PokemonJump2 *arg0)
+1 -1
View File
@@ -844,7 +844,7 @@ u32 TryWriteSpecialSaveSection(u8 sector, u8* src)
return 1; return 1;
} }
void Task_SaveGame_UpdatedLinkRecords(u8 taskId) void Task_LinkSave(u8 taskId)
{ {
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].data[0])
{ {
+2 -2
View File
@@ -941,11 +941,11 @@ static void task50_after_link_battle_save(u8 taskId)
DestroyTask(taskId); DestroyTask(taskId);
break; break;
case 5: case 5:
CreateTask(Task_SaveGame_UpdatedLinkRecords, 5); CreateTask(Task_LinkSave, 5);
data[0] = 6; data[0] = 6;
break; break;
case 6: case 6:
if (!FuncIsActiveTask(Task_SaveGame_UpdatedLinkRecords)) if (!FuncIsActiveTask(Task_LinkSave))
data[0] = 3; data[0] = 3;
break; break;
} }
+9 -9
View File
@@ -2898,7 +2898,7 @@ static void Task_RunUnionRoom(u8 taskId)
if (var5 == -2 || var5 == IN_UNION_ROOM) if (var5 == -2 || var5 == IN_UNION_ROOM)
{ {
data->playerSendBuffer[0] = IN_UNION_ROOM; data->playerSendBuffer[0] = IN_UNION_ROOM;
RfuPrepareSend0x2f00(data->playerSendBuffer); Rfu_SendPacket(data->playerSendBuffer);
StringCopy(gStringVar4, gUnknown_845842C[gLinkPlayers[0].gender]); StringCopy(gStringVar4, gUnknown_845842C[gLinkPlayers[0].gender]);
data->state = 32; data->state = 32;
} }
@@ -2913,7 +2913,7 @@ static void Task_RunUnionRoom(u8 taskId)
else else
{ {
data->playerSendBuffer[0] = sPlayerCurrActivity | IN_UNION_ROOM; data->playerSendBuffer[0] = sPlayerCurrActivity | IN_UNION_ROOM;
RfuPrepareSend0x2f00(data->playerSendBuffer); Rfu_SendPacket(data->playerSendBuffer);
data->state = 27; data->state = 27;
} }
} }
@@ -2942,7 +2942,7 @@ static void Task_RunUnionRoom(u8 taskId)
data->playerSendBuffer[0] = ACTIVITY_TRADE | IN_UNION_ROOM; data->playerSendBuffer[0] = ACTIVITY_TRADE | IN_UNION_ROOM;
data->playerSendBuffer[1] = sUnionRoomTrade.species; data->playerSendBuffer[1] = sUnionRoomTrade.species;
data->playerSendBuffer[2] = sUnionRoomTrade.level; data->playerSendBuffer[2] = sUnionRoomTrade.level;
RfuPrepareSend0x2f00(data->playerSendBuffer); Rfu_SendPacket(data->playerSendBuffer);
data->state = 29; data->state = 29;
break; break;
case 29: case 29:
@@ -3130,32 +3130,32 @@ static void Task_RunUnionRoom(u8 taskId)
if (!HasAtLeastTwoMonsOfLevel30OrLower()) if (!HasAtLeastTwoMonsOfLevel30OrLower())
{ {
data->playerSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM; data->playerSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM;
RfuPrepareSend0x2f00(data->playerSendBuffer); Rfu_SendPacket(data->playerSendBuffer);
data->state = 10; data->state = 10;
StringCopy(gStringVar4, gUnknown_84584C0); StringCopy(gStringVar4, gUnknown_84584C0);
} }
else else
{ {
RfuPrepareSend0x2f00(data->playerSendBuffer); Rfu_SendPacket(data->playerSendBuffer);
data->state = 13; data->state = 13;
} }
} }
else if (sPlayerCurrActivity == (ACTIVITY_CARD | IN_UNION_ROOM)) else if (sPlayerCurrActivity == (ACTIVITY_CARD | IN_UNION_ROOM))
{ {
RfuPrepareSend0x2f00(data->playerSendBuffer); Rfu_SendPacket(data->playerSendBuffer);
ViewURoomPartnerTrainerCard(gStringVar4, data, MODE_PARENT); ViewURoomPartnerTrainerCard(gStringVar4, data, MODE_PARENT);
data->state = 40; data->state = 40;
} }
else else
{ {
RfuPrepareSend0x2f00(data->playerSendBuffer); Rfu_SendPacket(data->playerSendBuffer);
data->state = 13; data->state = 13;
} }
break; break;
case 1: case 1:
case -1: case -1:
data->playerSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM; data->playerSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM;
RfuPrepareSend0x2f00(data->playerSendBuffer); Rfu_SendPacket(data->playerSendBuffer);
data->state = 10; data->state = 10;
GetYouDeclinedTheOfferMessage(gStringVar4, sPlayerCurrActivity); GetYouDeclinedTheOfferMessage(gStringVar4, sPlayerCurrActivity);
break; break;
@@ -3418,7 +3418,7 @@ void var_800D_set_xB(void)
static void ReceiveUnionRoomActivityPacket(struct UnkStruct_URoom * uroom) static void ReceiveUnionRoomActivityPacket(struct UnkStruct_URoom * uroom)
{ {
if (gRecvCmds[1][1] != 0 && (gRecvCmds[1][0] & 0xFF00) == RFU_COMMAND_0x2f00) if (gRecvCmds[1][1] != 0 && (gRecvCmds[1][0] & 0xFF00) == RFUCMD_SEND_PACKET)
{ {
uroom->recvActivityRequest[0] = gRecvCmds[1][1]; uroom->recvActivityRequest[0] = gRecvCmds[1][1];
if (gRecvCmds[1][1] == (ACTIVITY_TRADE | IN_UNION_ROOM)) if (gRecvCmds[1][1] == (ACTIVITY_TRADE | IN_UNION_ROOM))