Merge pull request #1817 from GriffinRichards/sync-wireless

Add cursor kind constants, sync wireless improvements
This commit is contained in:
GriffinR 2022-11-17 15:18:20 -05:00 committed by GitHub
commit df470b75dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 530 additions and 451 deletions

View File

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 167 B

View File

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
115 164 197
255 82 0
131 32 0
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255
255 0 255

View File

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 197 B

View File

@ -1,259 +0,0 @@
JASC-PAL
0100
256
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
74 246 255
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
74 246 255
57 213 230
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
74 246 255
57 213 230
49 180 205
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
90 90 90
90 90 90
90 90 90
74 246 255
57 213 230
49 180 205
41 148 180
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
90 90 90
90 90 90
74 246 255
57 213 230
49 180 205
41 148 180
24 123 164
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
90 90 90
74 246 255
57 213 230
49 180 205
41 148 180
24 123 164
16 90 139
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
74 246 255
57 213 230
49 180 205
41 148 180
24 123 164
16 90 139
8 57 115
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
57 213 230
49 180 205
41 148 180
24 123 164
16 90 139
8 57 115
8 57 115
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
49 180 205
41 148 180
24 123 164
16 90 139
8 57 115
8 57 115
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
41 148 180
24 123 164
16 90 139
8 57 115
8 57 115
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
24 123 164
16 90 139
8 57 115
8 57 115
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
16 90 139
8 57 115
8 57 115
90 90 90
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
8 57 115
8 57 115
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
74 246 255
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
74 246 255
57 213 230
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
74 246 255
57 213 230
49 180 205
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
90 90 90
90 90 90
90 90 90
74 246 255
57 213 230
49 180 205
41 148 180
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
90 90 90
90 90 90
74 246 255
57 213 230
49 180 205
41 148 180
24 123 164
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
90 90 90
74 246 255
57 213 230
49 180 205
41 148 180
24 123 164
16 90 139
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
74 246 255
57 213 230
49 180 205
41 148 180
24 123 164
16 90 139
8 57 115
0 32 98
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
57 213 230
49 180 205
41 148 180
24 123 164
16 90 139
8 57 115
8 57 115
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
49 180 205
41 148 180
24 123 164
16 90 139
8 57 115
8 57 115
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
41 148 180
24 123 164
16 90 139
8 57 115
8 57 115
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
24 123 164
16 90 139
8 57 115
8 57 115
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
16 90 139
8 57 115
8 57 115
90 90 90
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
8 57 115
8 57 115
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
90 90 90
57 57 57
172 123 0
90 90 90
57 57 57
164 164 164
255 180 0
106 106 106
74 74 74

View File

@ -669,7 +669,7 @@ $(WALLPAPERGFXDIR)/whiscash/tiles.4bpp: $(WALLPAPERGFXDIR)/friends_frame2.4bpp $
$(OBJEVENTGFXDIR)/pics/effects/unknown_4F6D38/0.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 11 -Wnum_tiles
$(INTERFACEGFXDIR)/selector_outline.4bpp: %.4bpp: %.png
$(INTERFACEGFXDIR)/outline_cursor.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 8 -Wnum_tiles
$(BATTRANSGFXDIR)/frontier_logo_center.4bpp: %.4bpp: %.png

View File

@ -7,12 +7,20 @@
#define LIST_CANCEL -2
#define LIST_HEADER -3
#define LIST_NO_MULTIPLE_SCROLL 0
#define LIST_MULTIPLE_SCROLL_DPAD 1
#define LIST_MULTIPLE_SCROLL_L_R 2
enum {
LIST_NO_MULTIPLE_SCROLL,
LIST_MULTIPLE_SCROLL_DPAD,
LIST_MULTIPLE_SCROLL_L_R,
};
enum
{
enum {
CURSOR_BLACK_ARROW,
CURSOR_INVISIBLE,
CURSOR_RED_OUTLINE,
CURSOR_RED_ARROW,
};
enum {
SCROLL_ARROW_LEFT,
SCROLL_ARROW_RIGHT,
SCROLL_ARROW_UP,

View File

@ -160,7 +160,7 @@ static const struct ListMenuTemplate sListMenuTemplate =
.itemVerticalPadding = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NARROW,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
enum {

View File

@ -2676,7 +2676,7 @@ static void CB2_EndBlenderGame(void)
switch (Menu_ProcessInputNoWrapClearOnChoose())
{
case 1:
case -1:
case MENU_B_PRESSED:
sBerryBlender->yesNoAnswer = 1;
sBerryBlender->gameEndState++;
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)

View File

@ -95,7 +95,7 @@ static void Task_ClearSaveDataScreenYesNoChoice(u8 taskId)
gTasks[taskId].func = Task_ClearSaveData;
break;
case 1:
case -1:
case MENU_B_PRESSED:
PlaySE(SE_SELECT);
DestroyTask(taskId);
SetMainCallback2(CB2_FadeAndDoReset);

View File

@ -717,9 +717,9 @@ static const struct ListMenuTemplate sListMenuTemplate_PossibleGroupMembers = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.fontId = 1,
.cursorKind = 1
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = CURSOR_INVISIBLE
};
static const struct WindowTemplate sWindowTemplate_GroupList = {
@ -777,9 +777,9 @@ static const struct ListMenuTemplate sListMenuTemplate_UnionRoomGroups = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 1,
.fontId = 1,
.cursorKind = 0
.scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD,
.fontId = FONT_NORMAL,
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct WindowTemplate sWindowTemplate_InviteToActivity = {
@ -815,9 +815,9 @@ static const struct ListMenuTemplate sListMenuTemplate_InviteToActivity = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.fontId = 1,
.cursorKind = 0
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct WindowTemplate sWindowTemplate_RegisterForTrade = {
@ -852,9 +852,9 @@ static const struct ListMenuTemplate sListMenuTemplate_RegisterForTrade = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.fontId = 1,
.cursorKind = 0
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct WindowTemplate sWindowTemplate_TradingBoardRequestType = {
@ -904,9 +904,9 @@ static const struct ListMenuTemplate sMenuTemplate_TradingBoardRequestType = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.fontId = 1,
.cursorKind = 0
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct WindowTemplate sWindowTemplate_TradingBoardHeader = {
@ -930,7 +930,7 @@ static const struct WindowTemplate sWindowTemplate_TradingBoardMain = {
};
static const struct ListMenuItem sTradeBoardListMenuItems[] = {
{ sText_EmptyString, -3 },
{ sText_EmptyString, LIST_HEADER },
{ sText_EmptyString, 0 },
{ sText_EmptyString, 1 },
{ sText_EmptyString, 2 },
@ -958,9 +958,9 @@ static const struct ListMenuTemplate sTradeBoardListMenuTemplate = {
.cursorShadowPal = 13,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.fontId = 1,
.cursorKind = 0
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = CURSOR_BLACK_ARROW
};
// Unused
@ -1010,9 +1010,9 @@ static const struct ListMenuTemplate sEmptyListMenuTemplate = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 1,
.fontId = 1,
.cursorKind = 0
.scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD,
.fontId = FONT_NORMAL,
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct RfuPlayerData sUnionRoomPlayer_DummyRfu = {0};

View File

@ -78,7 +78,7 @@ static const struct ListMenuTemplate sDaycareListMenuLevelTemplate =
.itemVerticalPadding = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
static const u8 *const sCompatibilityMessages[] =

View File

@ -314,8 +314,9 @@ static const struct ListMenuTemplate sDecorationItemsListMenuTemplate =
.cursorShadowPal = 3,
.lettersSpacing = FALSE,
.itemVerticalPadding = 0,
.scrollMultiple = FALSE,
.fontId = FONT_NARROW
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NARROW,
.cursorKind = CURSOR_BLACK_ARROW,
};
#include "data/decoration/icon.h"
@ -890,7 +891,7 @@ static void PrintDecorationItemMenuItems(u8 taskId)
StringCopy(sDecorationItemsMenu->names[i], gText_Cancel);
sDecorationItemsMenu->items[i].name = sDecorationItemsMenu->names[i];
sDecorationItemsMenu->items[i].id = -2;
sDecorationItemsMenu->items[i].id = LIST_CANCEL;
gMultiuseListMenuTemplate = sDecorationItemsListMenuTemplate;
gMultiuseListMenuTemplate.windowId = sDecorMenuWindowIds[WINDOW_DECORATION_CATEGORIES];
gMultiuseListMenuTemplate.totalItems = sDecorationItemsMenu->numMenuItems;

View File

@ -2536,9 +2536,9 @@ static void InitScrollableMultichoice(void)
gScrollableMultichoice_ListMenuTemplate.cursorShadowPal = 3;
gScrollableMultichoice_ListMenuTemplate.lettersSpacing = 0;
gScrollableMultichoice_ListMenuTemplate.itemVerticalPadding = 0;
gScrollableMultichoice_ListMenuTemplate.scrollMultiple = 0;
gScrollableMultichoice_ListMenuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL;
gScrollableMultichoice_ListMenuTemplate.fontId = FONT_NORMAL;
gScrollableMultichoice_ListMenuTemplate.cursorKind = 0;
gScrollableMultichoice_ListMenuTemplate.cursorKind = CURSOR_BLACK_ARROW;
}
static void ScrollableMultichoice_MoveCursor(s32 itemIndex, bool8 onInit, struct ListMenu *list)

View File

@ -259,9 +259,9 @@ static const struct ListMenuTemplate sItemListMenu =
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NARROW,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct MenuAction sItemMenuActions[] = {

View File

@ -2525,9 +2525,8 @@ u8 RfuGetStatus(void)
bool32 RfuHasErrored(void)
{
// RFU_STATUS_OK will underflow here intentionally
u32 var = RfuGetStatus() - 1;
if (var < RFU_STATUS_CONNECTION_ERROR)
u32 status = RfuGetStatus();
if (status == RFU_STATUS_FATAL_ERROR || status == RFU_STATUS_CONNECTION_ERROR)
return TRUE;
else
return FALSE;
@ -2656,7 +2655,7 @@ static u8 GetPartnerIndexByNameAndTrainerID(const u8 *name, u16 id)
for (i = 0; i < RFU_CHILD_MAX; i++)
{
u16 trainerId = ReadU16(gRfuLinkStatus->partner[i].gname + 2);
u16 trainerId = ReadU16(((struct RfuGameData *)gRfuLinkStatus->partner[i].gname)->compatibility.playerTrainerId);
if (IsRfuSerialNumberValid(gRfuLinkStatus->partner[i].serialNo)
&& !StringCompare(name, gRfuLinkStatus->partner[i].uname)
&& id == trainerId)
@ -2682,9 +2681,9 @@ static void RfuReqDisconnectSlot(u32 slot)
void RequestDisconnectSlotByTrainerNameAndId(const u8 *name, u16 id)
{
u8 var = GetPartnerIndexByNameAndTrainerID(name, id);
if (var != 0xFF)
RfuReqDisconnectSlot(1 << var);
u8 index = GetPartnerIndexByNameAndTrainerID(name, id);
if (index != 0xFF)
RfuReqDisconnectSlot(1 << index);
}
void Rfu_DisconnectPlayerById(u32 playerIdx)

View File

@ -13,6 +13,10 @@
#include "sound.h"
#include "constants/songs.h"
// Cursors after this point are created using a sprite with their own task.
// This allows them to have idle animations. Cursors prior to this are simply printed text.
#define CURSOR_OBJECT_START CURSOR_RED_OUTLINE
struct UnkIndicatorsStruct
{
u8 field_0;
@ -70,7 +74,7 @@ static bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAn
static void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count);
static void ListMenuDrawCursor(struct ListMenu *list);
static void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 onInit);
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind);
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorObjId);
static void Task_ScrollIndicatorArrowPair(u8 taskId);
static u8 ListMenuAddRedOutlineCursorObject(struct CursorStruct *cursor);
static u8 ListMenuAddRedArrowCursorObject(struct CursorStruct *cursor);
@ -78,9 +82,9 @@ static void ListMenuUpdateRedOutlineCursorObject(u8 taskId, u16 x, u16 y);
static void ListMenuUpdateRedArrowCursorObject(u8 taskId, u16 x, u16 y);
static void ListMenuRemoveRedOutlineCursorObject(u8 taskId);
static void ListMenuRemoveRedArrowCursorObject(u8 taskId);
static u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorKind);
static void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorKind);
static void ListMenuRemoveCursorObject(u8 taskId, u32 cursorKind);
static u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorObjId);
static void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorObjId);
static void ListMenuRemoveCursorObject(u8 taskId, u32 cursorObjId);
static void SpriteCallback_ScrollIndicatorArrow(struct Sprite *sprite);
static void SpriteCallback_RedArrowCursor(struct Sprite *sprite);
@ -301,10 +305,10 @@ static const struct SpriteTemplate sSpriteTemplate_RedArrowCursor =
.callback = SpriteCallback_RedArrowCursor,
};
static const u16 sRedArrowPal[] = INCBIN_U16("graphics/interface/red_arrow.gbapal");
static const u32 sRedArrowOtherGfx[] = INCBIN_U32("graphics/interface/red_arrow_other.4bpp.lz");
static const u32 sSelectorOutlineGfx[] = INCBIN_U32("graphics/interface/selector_outline.4bpp.lz");
static const u32 sRedArrowGfx[] = INCBIN_U32("graphics/interface/red_arrow.4bpp.lz");
static const u16 sRedInterface_Pal[] = INCBIN_U16("graphics/interface/red.gbapal"); // Shared by all of the below gfx
static const u32 sScrollIndicator_Gfx[] = INCBIN_U32("graphics/interface/scroll_indicator.4bpp.lz");
static const u32 sOutlineCursor_Gfx[] = INCBIN_U32("graphics/interface/outline_cursor.4bpp.lz");
static const u32 sArrowCursor_Gfx[] = INCBIN_U32("graphics/interface/arrow_cursor.4bpp.lz");
// code
static void ListMenuDummyTask(u8 taskId)
@ -477,7 +481,7 @@ void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow)
*selectedRow = list->selectedRow;
if (list->taskId != TASK_NONE)
ListMenuRemoveCursorObject(list->taskId, list->template.cursorKind - 2);
ListMenuRemoveCursorObject(list->taskId, list->template.cursorKind - CURSOR_OBJECT_START);
DestroyTask(listTaskId);
}
@ -650,31 +654,33 @@ static void ListMenuDrawCursor(struct ListMenu *list)
u8 y = list->selectedRow * yMultiplier + list->template.upText_Y;
switch (list->template.cursorKind)
{
case 0:
case CURSOR_BLACK_ARROW:
ListMenuPrint(list, gText_SelectorArrow2, x, y);
break;
case 1:
case CURSOR_INVISIBLE:
break;
case 2:
case CURSOR_RED_OUTLINE:
if (list->taskId == TASK_NONE)
list->taskId = ListMenuAddCursorObject(list, 0);
list->taskId = ListMenuAddCursorObject(list, CURSOR_RED_OUTLINE - CURSOR_OBJECT_START);
ListMenuUpdateCursorObject(list->taskId,
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 - 1,
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y - 1, 0);
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y - 1,
CURSOR_RED_OUTLINE - CURSOR_OBJECT_START);
break;
case 3:
case CURSOR_RED_ARROW:
if (list->taskId == TASK_NONE)
list->taskId = ListMenuAddCursorObject(list, 1);
list->taskId = ListMenuAddCursorObject(list, CURSOR_RED_ARROW - CURSOR_OBJECT_START);
ListMenuUpdateCursorObject(list->taskId,
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 + x,
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y, 1);
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y,
CURSOR_RED_ARROW - CURSOR_OBJECT_START);
break;
}
}
#undef TASK_NONE
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind)
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorObjId)
{
struct CursorStruct cursor;
@ -686,13 +692,13 @@ static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind)
cursor.palTag = TAG_NONE;
cursor.palNum = 15;
return ListMenuAddCursorObjectInternal(&cursor, cursorKind);
return ListMenuAddCursorObjectInternal(&cursor, cursorObjId);
}
static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 selectedRow)
{
u8 cursorKind = list->template.cursorKind;
if (cursorKind == 0)
if (cursorKind == CURSOR_BLACK_ARROW)
{
u8 yMultiplier = GetFontAttribute(list->template.fontId, FONTATTR_MAX_LETTER_HEIGHT) + list->template.itemVerticalPadding;
u8 width = GetMenuCursorDimensionByFont(list->template.fontId, 0);
@ -1071,18 +1077,18 @@ u8 AddScrollIndicatorArrowPair(const struct ScrollArrowsTemplate *arrowInfo, u16
struct ScrollIndicatorPair *data;
u8 taskId;
spriteSheet.data = sRedArrowOtherGfx;
spriteSheet.data = sScrollIndicator_Gfx;
spriteSheet.size = 0x100;
spriteSheet.tag = arrowInfo->tileTag;
LoadCompressedSpriteSheet(&spriteSheet);
if (arrowInfo->palTag == TAG_NONE)
{
LoadPalette(sRedArrowPal, (16 * arrowInfo->palNum) + 0x100, 0x20);
LoadPalette(sRedInterface_Pal, (16 * arrowInfo->palNum) + 0x100, 0x20);
}
else
{
spritePal.data = sRedArrowPal;
spritePal.data = sRedInterface_Pal;
spritePal.tag = arrowInfo->palTag;
LoadSpritePalette(&spritePal);
}
@ -1190,39 +1196,39 @@ void RemoveScrollIndicatorArrowPair(u8 taskId)
DestroyTask(taskId);
}
static u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorKind)
static u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorObjId)
{
switch (cursorKind)
switch (cursorObjId)
{
case 0:
case CURSOR_RED_OUTLINE - CURSOR_OBJECT_START:
default:
return ListMenuAddRedOutlineCursorObject(cursor);
case 1:
case CURSOR_RED_ARROW - CURSOR_OBJECT_START:
return ListMenuAddRedArrowCursorObject(cursor);
}
}
static void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorKind)
static void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorObjId)
{
switch (cursorKind)
switch (cursorObjId)
{
case 0:
case CURSOR_RED_OUTLINE - CURSOR_OBJECT_START:
ListMenuUpdateRedOutlineCursorObject(taskId, x, y);
break;
case 1:
case CURSOR_RED_ARROW - CURSOR_OBJECT_START:
ListMenuUpdateRedArrowCursorObject(taskId, x, y);
break;
}
}
static void ListMenuRemoveCursorObject(u8 taskId, u32 cursorKind)
static void ListMenuRemoveCursorObject(u8 taskId, u32 cursorObjId)
{
switch (cursorKind)
switch (cursorObjId)
{
case 0:
case CURSOR_RED_OUTLINE - CURSOR_OBJECT_START:
ListMenuRemoveRedOutlineCursorObject(taskId);
break;
case 1:
case CURSOR_RED_ARROW - CURSOR_OBJECT_START:
ListMenuRemoveRedArrowCursorObject(taskId);
break;
}
@ -1317,18 +1323,18 @@ static u8 ListMenuAddRedOutlineCursorObject(struct CursorStruct *cursor)
struct SpriteTemplate spriteTemplate;
u8 taskId;
spriteSheet.data = sSelectorOutlineGfx;
spriteSheet.data = sOutlineCursor_Gfx;
spriteSheet.size = 0x100;
spriteSheet.tag = cursor->tileTag;
LoadCompressedSpriteSheet(&spriteSheet);
if (cursor->palTag == TAG_NONE)
{
LoadPalette(sRedArrowPal, (16 * cursor->palNum) + 0x100, 0x20);
LoadPalette(sRedInterface_Pal, (16 * cursor->palNum) + 0x100, 0x20);
}
else
{
spritePal.data = sRedArrowPal;
spritePal.data = sRedInterface_Pal;
spritePal.tag = cursor->palTag;
LoadSpritePalette(&spritePal);
}
@ -1402,18 +1408,18 @@ static u8 ListMenuAddRedArrowCursorObject(struct CursorStruct *cursor)
struct SpriteTemplate spriteTemplate;
u8 taskId;
spriteSheet.data = sRedArrowGfx;
spriteSheet.data = sArrowCursor_Gfx;
spriteSheet.size = 0x80;
spriteSheet.tag = cursor->tileTag;
LoadCompressedSpriteSheet(&spriteSheet);
if (cursor->palTag == TAG_NONE)
{
LoadPalette(sRedArrowPal, (16 * cursor->palNum) + 0x100, 0x20);
LoadPalette(sRedInterface_Pal, (16 * cursor->palNum) + 0x100, 0x20);
}
else
{
spritePal.data = sRedArrowPal;
spritePal.data = sRedInterface_Pal;
spritePal.tag = cursor->palTag;
LoadSpritePalette(&spritePal);
}

View File

@ -1631,7 +1631,7 @@ static void Task_NewGameBirchSpeech_ProcessNameYesNoMenu(u8 taskId)
NewGameBirchSpeech_StartFadePlatformIn(taskId, 1);
gTasks[taskId].func = Task_NewGameBirchSpeech_SlidePlatformAway2;
break;
case -1:
case MENU_B_PRESSED:
case 1:
PlaySE(SE_SELECT);
gTasks[taskId].func = Task_NewGameBirchSpeech_BoyOrGirl;

View File

@ -187,7 +187,7 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate =
.itemVerticalPadding = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
//--------------
@ -284,7 +284,7 @@ u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page)
gMultiuseListMenuTemplate.moveCursorFunc = MailboxMenu_MoveCursorFunc;
gMultiuseListMenuTemplate.itemPrintFunc = MailboxMenu_ItemPrintFunc;
gMultiuseListMenuTemplate.fontId = FONT_NORMAL;
gMultiuseListMenuTemplate.cursorKind = 0;
gMultiuseListMenuTemplate.cursorKind = CURSOR_BLACK_ARROW;
gMultiuseListMenuTemplate.lettersSpacing = 0;
gMultiuseListMenuTemplate.itemVerticalPadding = 0;
gMultiuseListMenuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL;
@ -1538,7 +1538,7 @@ void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bg
0,
15 * i,
color,
-1,
TEXT_SKIP_DRAW,
sLvlUpStatStrings[i]);
StringCopy(text, (statsDiff[i] >= 0) ? gText_Plus : gText_Dash);
@ -1547,7 +1547,7 @@ void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bg
56,
15 * i,
color,
-1,
TEXT_SKIP_DRAW,
text);
if (abs(statsDiff[i]) <= 9)
x = 18;
@ -1560,7 +1560,7 @@ void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bg
56 + x,
15 * i,
color,
-1,
TEXT_SKIP_DRAW,
text);
}
}
@ -1602,7 +1602,7 @@ void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 s
0,
15 * i,
color,
-1,
TEXT_SKIP_DRAW,
sLvlUpStatStrings[i]);
AddTextPrinterParameterized3(windowId,
@ -1610,7 +1610,7 @@ void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 s
56 + x,
15 * i,
color,
-1,
TEXT_SKIP_DRAW,
text);
}
}

View File

@ -553,7 +553,7 @@ static void DoMoveRelearnerMain(void)
gSpecialVar_0x8004 = FALSE;
sMoveRelearnerStruct->state = MENU_STATE_FADE_AND_RETURN;
}
else if (selection == -1 || selection == 1)
else if (selection == MENU_B_PRESSED || selection == 1)
{
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
{
@ -579,14 +579,14 @@ static void DoMoveRelearnerMain(void)
break;
case MENU_STATE_CONFIRM_DELETE_OLD_MOVE:
{
s8 var = Menu_ProcessInputNoWrapClearOnChoose();
s8 selection = Menu_ProcessInputNoWrapClearOnChoose();
if (var == 0)
if (selection == 0)
{
FormatAndPrintText(gText_MoveRelearnerWhichMoveToForget);
sMoveRelearnerStruct->state = MENU_STATE_PRINT_WHICH_MOVE_PROMPT;
}
else if (var == -1 || var == 1)
else if (selection == MENU_B_PRESSED || selection == 1)
{
sMoveRelearnerStruct->state = MENU_STATE_PRINT_STOP_TEACHING;
}
@ -606,13 +606,13 @@ static void DoMoveRelearnerMain(void)
break;
case MENU_STATE_CONFIRM_STOP_TEACHING:
{
s8 var = Menu_ProcessInputNoWrapClearOnChoose();
s8 selection = Menu_ProcessInputNoWrapClearOnChoose();
if (var == 0)
if (selection == 0)
{
sMoveRelearnerStruct->state = MENU_STATE_CHOOSE_SETUP_STATE;
}
else if (var == MENU_B_PRESSED || var == 1)
else if (selection == MENU_B_PRESSED || selection == 1)
{
// What's the point? It gets set to MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT, anyway.
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)

View File

@ -234,9 +234,9 @@ static const struct ListMenuTemplate sListMenuTemplate_ThreeOptions = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct ListMenuItem sListMenuItems_ReceiveSendToss[] = {
@ -279,9 +279,9 @@ static const struct ListMenuTemplate sListMenu_ReceiveSendToss = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct ListMenuTemplate sListMenu_ReceiveToss = {
@ -300,9 +300,9 @@ static const struct ListMenuTemplate sListMenu_ReceiveToss = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct ListMenuTemplate sListMenu_ReceiveSend = {
@ -321,9 +321,9 @@ static const struct ListMenuTemplate sListMenu_ReceiveSend = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct ListMenuTemplate sListMenu_Receive = {
@ -342,9 +342,9 @@ static const struct ListMenuTemplate sListMenu_Receive = {
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
static const u8 *const sUnusedMenuTexts[] = {

View File

@ -290,8 +290,9 @@ static const struct ListMenuTemplate sListMenuTemplate_ItemStorage =
.cursorShadowPal = 3,
.lettersSpacing = FALSE,
.itemVerticalPadding = 0,
.scrollMultiple = FALSE,
.fontId = FONT_NARROW
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NARROW,
.cursorKind = CURSOR_BLACK_ARROW,
};
static const struct WindowTemplate sWindowTemplates_ItemStorage[ITEMPC_WIN_COUNT] =

View File

@ -440,7 +440,7 @@ static const struct ListMenuTemplate sPokeblockListMenuTemplate =
.itemVerticalPadding = 0,
.scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD,
.fontId = FONT_NORMAL,
.cursorKind = 1
.cursorKind = CURSOR_INVISIBLE
};
void OpenPokeblockCase(u8 caseId, void (*callback)(void))

View File

@ -214,7 +214,7 @@ static const struct ListMenuTemplate sRegistryListMenuTemplate =
.itemVerticalPadding = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NORMAL,
.cursorKind = 0,
.cursorKind = CURSOR_BLACK_ARROW,
};
static void ClearSecretBase(struct SecretBase *secretBase)
@ -953,7 +953,7 @@ static void BuildRegistryMenuItems(u8 taskId)
}
sRegistryMenu->items[count].name = gText_Cancel;
sRegistryMenu->items[count].id = -2;
sRegistryMenu->items[count].id = LIST_CANCEL;
tNumBases = count + 1;
if (tNumBases < 8)
tMaxShownItems = tNumBases;

View File

@ -216,7 +216,7 @@ static const struct ListMenuTemplate sShopBuyMenuListTemplate =
.itemVerticalPadding = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = FONT_NARROW,
.cursorKind = 0
.cursorKind = CURSOR_BLACK_ARROW
};
static const struct BgTemplate sShopBuyMenuBgTemplates[] =

View File

@ -996,7 +996,7 @@ static u8 SaveConfirmInputCallback(void)
sSaveDialogCallback = SaveFileExistsCallback;
return SAVE_IN_PROGRESS;
}
case -1: // B Button
case MENU_B_PRESSED:
case 1: // No
HideSaveInfoWindow();
HideSaveMessageWindow();
@ -1042,7 +1042,7 @@ static u8 SaveOverwriteInputCallback(void)
case 0: // Yes
sSaveDialogCallback = SaveSavingMessageCallback;
return SAVE_IN_PROGRESS;
case -1: // B Button
case MENU_B_PRESSED:
case 1: // No
HideSaveInfoWindow();
HideSaveMessageWindow();
@ -1161,7 +1161,7 @@ static u8 BattlePyramidRetireInputCallback(void)
{
case 0: // Yes
return SAVE_CANCELED;
case -1: // B Button
case MENU_B_PRESSED:
case 1: // No
HideSaveMessageWindow();
return SAVE_SUCCESS;

View File

@ -271,7 +271,7 @@ static void GetURoomActivityRejectMsg(u8 *, s32, u32);
static u32 ConvPartnerUnameAndGetWhetherMetAlready(struct RfuPlayer *);
static void GetURoomActivityStartMsg(u8 *, u8);
static void UR_ClearBg0(void);
static s32 IsRequestedTypeOrEggInPlayerParty(u32, u32);
static s32 IsRequestedTradeInPlayerParty(u32, u32);
static bool32 UR_PrintFieldMessage(const u8 *);
static s32 GetChatLeaderActionRequestMessage(u8 *, u32, u16 *, struct WirelessLink_URoom *);
static void Task_InitUnionRoom(u8 taskId);
@ -319,9 +319,9 @@ static void PrintPlayerNameAndIdOnWindow(u8 windowId)
PrintUnionRoomText(windowId, FONT_NORMAL, text, 0, 17, UR_COLOR_DEFAULT);
}
static void GetAwaitingCommunicationText(u8 *dst, u8 caseId)
static void GetAwaitingCommunicationText(u8 *dst, u8 activity)
{
switch (caseId)
switch (activity)
{
case ACTIVITY_BATTLE_SINGLE:
case ACTIVITY_BATTLE_DOUBLE:
@ -343,18 +343,18 @@ static void GetAwaitingCommunicationText(u8 *dst, u8 caseId)
case ACTIVITY_CONTEST_TOUGH:
// BUG: argument *dst isn't used, instead it always prints to gStringVar4
// not an issue in practice since Gamefreak never used any other arguments here besides gStringVar4
#ifndef BUGFIX
#ifndef BUGFIX
StringExpandPlaceholders(gStringVar4, sText_AwaitingCommunication);
#else
#else
StringExpandPlaceholders(dst, sText_AwaitingCommunication);
#endif
#endif
break;
}
}
static bool32 IsActivityWithVariableGroupSize(u32 caseId)
static bool32 IsActivityWithVariableGroupSize(u32 activity)
{
switch (caseId)
switch (activity)
{
case ACTIVITY_POKEMON_JUMP:
case ACTIVITY_BERRY_CRUSH:
@ -507,11 +507,11 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
// BUG: sPlayerActivityGroupSize was meant below, not gPlayerCurrActivity
// This will be false for all but ACTIVITY_BATTLE_DOUBLE and ACTIVITY_DECLINE
// All this changes is which of two texts gets printed
#ifdef BUGFIX
#ifdef BUGFIX
id = (GROUP_MAX(sPlayerActivityGroupSize) == 2) ? 0 : 1;
#else
#else
id = (GROUP_MAX(gPlayerCurrActivity) == 2) ? 1 : 0;
#endif
#endif
if (PrintOnTextbox(&data->textState, sPlayerUnavailableTexts[id]))
{
data->playerCount = LeaderPrunePlayerList(data->playerList);
@ -559,6 +559,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
{
if (data->joinRequestAnswer == RFU_STATUS_JOIN_GROUP_OK)
{
// Sent "OK"
data->playerList->players[data->playerCount].newPlayerCountdown = 0;
RedrawListMenu(data->listTaskId);
data->playerCount++;
@ -596,6 +597,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
}
else if (val == 2)
{
// Disconnect
RfuSetStatus(RFU_STATUS_OK, 0);
data->state = LL_STATE_GET_AWAITING_PLAYERS_TEXT;
}
@ -734,9 +736,9 @@ static void Leader_DestroyResources(struct WirelessLink_Leader *data)
Free(data->incomingPlayerList);
}
static void Leader_GetAcceptNewMemberPrompt(u8 *dst, u8 caseId)
static void Leader_GetAcceptNewMemberPrompt(u8 *dst, u8 activity)
{
switch (caseId)
switch (activity)
{
case ACTIVITY_BATTLE_SINGLE:
case ACTIVITY_BATTLE_DOUBLE:
@ -765,9 +767,9 @@ static void Leader_GetAcceptNewMemberPrompt(u8 *dst, u8 caseId)
}
}
static void GetYouDeclinedTheOfferMessage(u8 *dst, u8 caseId)
static void GetYouDeclinedTheOfferMessage(u8 *dst, u8 activity)
{
switch (caseId)
switch (activity)
{
case ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM:
case ACTIVITY_TRADE | IN_UNION_ROOM:
@ -780,9 +782,9 @@ static void GetYouDeclinedTheOfferMessage(u8 *dst, u8 caseId)
}
}
static void GetYouAskedToJoinGroupPleaseWaitMessage(u8 *dst, u8 caseId)
static void GetYouAskedToJoinGroupPleaseWaitMessage(u8 *dst, u8 activity)
{
switch (caseId)
switch (activity)
{
case ACTIVITY_BATTLE_SINGLE:
case ACTIVITY_BATTLE_DOUBLE:
@ -809,9 +811,9 @@ static void GetYouAskedToJoinGroupPleaseWaitMessage(u8 *dst, u8 caseId)
}
}
static void GetGroupLeaderSentAnOKMessage(u8 *dst, u8 caseId)
static void GetGroupLeaderSentAnOKMessage(u8 *dst, u8 activity)
{
switch (caseId)
switch (activity)
{
case ACTIVITY_BATTLE_SINGLE:
case ACTIVITY_BATTLE_DOUBLE:
@ -1039,7 +1041,7 @@ static void Task_TryJoinLinkGroup(u8 taskId)
break;
case 0:
id = ListMenu_ProcessInput(data->listTaskId);
if (JOY_NEW(A_BUTTON) && id != MENU_B_PRESSED)
if (JOY_NEW(A_BUTTON) && id != LIST_NOTHING_CHOSEN)
{
// this unused variable along with the assignment is needed to match
u32 activity = data->playerList->players[id].rfu.data.activity;
@ -1469,9 +1471,7 @@ static void Task_CreateTradeMenu(u8 taskId)
u8 CreateTask_CreateTradeMenu(void)
{
u8 taskId = CreateTask(Task_CreateTradeMenu, 0);
return taskId;
return CreateTask(Task_CreateTradeMenu, 0);
}
static void Task_StartUnionRoomTrade(u8 taskId)
@ -2147,11 +2147,10 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
break;
case 0:
id = ListMenu_ProcessInput(data->listTaskId);
if (JOY_NEW(A_BUTTON) && id != -1)
if (JOY_NEW(A_BUTTON) && id != LIST_NOTHING_CHOSEN)
{
// this unused variable along with the assignment is needed to match
u32 unusedVar;
unusedVar = data->playerList->players[id].rfu.data.activity;
u32 activity = data->playerList->players[id].rfu.data.activity;
if (data->playerList->players[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->playerList->players[id].rfu.data.startedActivity)
{
@ -2504,7 +2503,7 @@ static void Task_RunUnionRoom(u8 taskId)
break;
case UR_STATE_INIT_OBJECTS:
CreateUnionRoomPlayerSprites(uroom->spriteIds, taskData[0]);
if (++taskData[0] == 8)
if (++taskData[0] == MAX_UNION_ROOM_LEADERS)
uroom->state = UR_STATE_INIT_LINK;
break;
case UR_STATE_INIT_LINK:
@ -2711,7 +2710,7 @@ static void Task_RunUnionRoom(u8 taskId)
&uroom->topListMenuId,
&sWindowTemplate_InviteToActivity,
&sListMenuTemplate_InviteToActivity);
if (input != -1)
if (input != LIST_NOTHING_CHOSEN)
{
if (!gReceivedRemoteLinkPlayers)
{
@ -2721,7 +2720,7 @@ static void Task_RunUnionRoom(u8 taskId)
{
uroom->partnerYesNoResponse = 0;
playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->playerList);
if (input == -2 || input == IN_UNION_ROOM)
if (input == LIST_CANCEL || input == IN_UNION_ROOM)
{
uroom->playerSendBuffer[0] = IN_UNION_ROOM;
Rfu_SendPacket(uroom->playerSendBuffer);
@ -3068,9 +3067,9 @@ static void Task_RunUnionRoom(u8 taskId)
&uroom->tradeBoardHeaderWindowId,
&sWindowTemplate_RegisterForTrade,
&sListMenuTemplate_RegisterForTrade);
if (input != -1)
if (input != LIST_NOTHING_CHOSEN)
{
if (input == -2 || input == 3)
if (input == LIST_CANCEL || input == 3) // Exit
{
uroom->state = UR_STATE_MAIN;
HandleCancelActivity(TRUE);
@ -3090,7 +3089,7 @@ static void Task_RunUnionRoom(u8 taskId)
}
break;
case UR_STATE_REGISTER_SELECT_MON_FADE:
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
uroom->state = UR_STATE_REGISTER_SELECT_MON;
break;
case UR_STATE_REGISTER_SELECT_MON:
@ -3107,11 +3106,11 @@ static void Task_RunUnionRoom(u8 taskId)
&uroom->tradeBoardHeaderWindowId,
&sWindowTemplate_TradingBoardRequestType,
&sMenuTemplate_TradingBoardRequestType);
if (input != -1)
if (input != LIST_NOTHING_CHOSEN)
{
switch (input)
{
case -2:
case LIST_CANCEL:
case NUMBER_OF_MON_TYPES: // Exit
ResetUnionRoomTrade(&sUnionRoomTrade);
SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
@ -3166,18 +3165,18 @@ static void Task_RunUnionRoom(u8 taskId)
&sWindowTemplate_TradingBoardMain,
&sTradeBoardListMenuTemplate,
uroom->playerList);
if (input != -1)
if (input != LIST_NOTHING_CHOSEN)
{
switch (input)
{
case -2:
case LIST_CANCEL:
case 8: // EXIT
HandleCancelActivity(TRUE);
uroom->state = UR_STATE_MAIN;
break;
default:
UR_ClearBg0();
switch (IsRequestedTypeOrEggInPlayerParty(uroom->playerList->players[input].rfu.data.tradeType, uroom->playerList->players[input].rfu.data.tradeSpecies))
switch (IsRequestedTradeInPlayerParty(uroom->playerList->players[input].rfu.data.tradeType, uroom->playerList->players[input].rfu.data.tradeSpecies))
{
case UR_TRADE_MATCH:
CopyAndTranslatePlayerName(gStringVar1, &uroom->playerList->players[input]);
@ -3707,12 +3706,12 @@ static s32 ListMenuHandler_AllItemsAvailable(u8 *state, u8 *windowId, u8 *listMe
ClearStdWindowAndFrame(*windowId, TRUE);
RemoveWindow(*windowId);
*state = 0;
return -2;
return LIST_CANCEL;
}
break;
}
return -1;
return LIST_NOTHING_CHOSEN;
}
static s32 TradeBoardMenuHandler(u8 *state, u8 *mainWindowId, u8 *listMenuId, u8 *headerWindowId,
@ -3742,13 +3741,14 @@ static s32 TradeBoardMenuHandler(u8 *state, u8 *mainWindowId, u8 *listMenuId, u8
input = ListMenu_ProcessInput(*listMenuId);
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
// Exit or B button
if (input == 8 || JOY_NEW(B_BUTTON))
{
DestroyListMenuTask(*listMenuId, NULL, NULL);
RemoveWindow(*mainWindowId);
DeleteTradeBoardWindow(*headerWindowId);
*state = 0;
return -2;
return LIST_CANCEL;
}
else
{
@ -3770,7 +3770,7 @@ static s32 TradeBoardMenuHandler(u8 *state, u8 *mainWindowId, u8 *listMenuId, u8
break;
}
return -1;
return LIST_NOTHING_CHOSEN;
}
static void UR_ClearBg0(void)
@ -4090,7 +4090,7 @@ static s32 UnionRoomGetPlayerInteractionResponse(struct RfuPlayerList *list, boo
}
}
void ItemPrintFunc_EmptyList(u8 windowId, u32 itemId, u8 y)
static void ItemPrintFunc_EmptyList(u8 windowId, u32 itemId, u8 y)
{
}
@ -4120,7 +4120,7 @@ static void TradeBoardListMenuItemPrintFunc(u8 windowId, u32 itemId, u8 y)
struct WirelessLink_Leader *leader = sWirelessLinkMain.leader;
struct RfuGameData *gameData;
s32 i, j;
u8 playerName[11];
u8 playerName[RFU_USER_NAME_LENGTH + 1];
if (itemId == LIST_HEADER && y == sTradeBoardListMenuTemplate.upText_Y)
{
@ -4168,7 +4168,7 @@ static s32 GetUnionRoomPlayerGender(s32 playerIdx, struct RfuPlayerList *list)
return list->players[playerIdx].rfu.data.playerGender;
}
static s32 IsRequestedTypeOrEggInPlayerParty(u32 type, u32 species)
static s32 IsRequestedTradeInPlayerParty(u32 type, u32 species)
{
s32 i;

View File

@ -1171,7 +1171,7 @@ static void Chat_AskQuitChatting(void)
input = ProcessMenuInput();
switch (input)
{
case -1:
case MENU_B_PRESSED:
case 1:
StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
sChat->funcState = 3;
@ -1210,7 +1210,7 @@ static void Chat_AskQuitChatting(void)
input = ProcessMenuInput();
switch (input)
{
case -1:
case MENU_B_PRESSED:
case 1:
StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
sChat->funcState = 3;
@ -1512,7 +1512,7 @@ static void Chat_SaveAndExit(void)
input = ProcessMenuInput();
switch (input)
{
case -1:
case MENU_B_PRESSED:
case 1:
sChat->funcState = 12;
break;
@ -1537,7 +1537,7 @@ static void Chat_SaveAndExit(void)
input = ProcessMenuInput();
switch (input)
{
case -1:
case MENU_B_PRESSED:
case 1:
sChat->funcState = 12;
break;

View File

@ -340,15 +340,10 @@ static void AnimateUnionRoomPlayer(u32 leaderId, struct UnionRoomObject * object
}
break;
case 1:
if (object->schedAnim == UNION_ROOM_SPAWN_OUT)
{
object->state = 3;
object->animState = 0;
}
else
{
if (object->schedAnim != UNION_ROOM_SPAWN_OUT)
break;
}
object->state = 3;
object->animState = 0;
// fallthrough
case 3:
if (AnimateUnionRoomPlayerDespawn(&object->animState, leaderId, object) == 1)

View File

@ -18,6 +18,7 @@
#include "union_room.h"
#include "constants/songs.h"
#include "constants/union_room.h"
#include "constants/rgb.h"
enum {
COLORMODE_NORMAL,
@ -51,9 +52,26 @@ static void Task_WirelessCommunicationScreen(u8);
static void WCSS_AddTextPrinterParameterized(u8, u8, const u8 *, u8, u8, u8);
static bool32 UpdateCommunicationCounts(u32 *, u32 *, u32 *, u8);
static const u16 sBgTiles_Pal[] = INCBIN_U16("graphics/link/wireless_info_screen.gbapal");
static const u32 sBgTiles_Gfx[] = INCBIN_U32("graphics/link/wireless_info_screen.4bpp.lz");
static const u32 sBgTiles_Tilemap[] = INCBIN_U32("graphics/link/wireless_info_screen.bin.lz");
static const u16 sPalettes[][16] = {
INCBIN_U16("graphics/wireless_status_screen/default.gbapal"),
{}, // All black. Never read
INCBIN_U16("graphics/wireless_status_screen/anim_00.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_01.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_02.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_03.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_04.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_05.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_06.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_07.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_08.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_09.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_10.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_11.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_12.gbapal"),
INCBIN_U16("graphics/wireless_status_screen/anim_13.gbapal")
};
static const u32 sBgTiles_Gfx[] = INCBIN_U32("graphics/wireless_status_screen/bg.4bpp.lz");
static const u32 sBgTiles_Tilemap[] = INCBIN_U32("graphics/wireless_status_screen/bg.bin.lz");
static const struct BgTemplate sBgTemplates[] = {
{
@ -193,7 +211,7 @@ static void CB2_InitWirelessCommunicationScreen(void)
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
LoadPalette(sBgTiles_Pal, 0x00, 0x20);
LoadPalette(sPalettes, 0x00, 0x20);
Menu_LoadStdPalAt(0xF0);
DynamicPlaceholderTextUtil_Reset();
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x0F);
@ -218,16 +236,19 @@ static void CB2_ExitWirelessCommunicationStatusScreen(void)
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
static void WCSS_CyclePalette(s16 * counter, s16 * palIdx)
// Cycle through palettes that relocate various shades of blue to create the wave effect at the bottom of the screen.
static void CyclePalette(s16 * counter, s16 * palIdx)
{
s32 idx;
if (++(*counter) > 5)
{
if (++(*palIdx) == 14)
if (++(*palIdx) == (int)ARRAY_COUNT(sPalettes) - 2)
*palIdx = 0;
*counter = 0;
}
LoadPalette(sBgTiles_Pal + 16 * (*palIdx + 2), 0, 0x10);
idx = *palIdx + 2; // +2 skips over default.pal and the empty black palette after it
LoadPalette(sPalettes[idx], 0, 16);
}
static void PrintHeaderTexts(void)
@ -236,12 +257,17 @@ static void PrintHeaderTexts(void)
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0));
// Print title
WCSS_AddTextPrinterParameterized(0, FONT_NORMAL, sHeaderTexts[0], GetStringCenterAlignXOffset(FONT_NORMAL, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN);
for (i = 0; i < (int)ARRAY_COUNT(*sHeaderTexts) - 1; i++)
{
// Print label for each group (excluding total)
for (i = 0; i < NUM_GROUPTYPES - 1; i++)
WCSS_AddTextPrinterParameterized(1, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY);
}
// Print label for total
WCSS_AddTextPrinterParameterized(1, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_RED);
PutWindowTilemap(0);
CopyWindowToVram(0, COPYWIN_GFX);
PutWindowTilemap(1);
@ -260,7 +286,7 @@ static void Task_WirelessCommunicationScreen(u8 taskId)
gTasks[taskId].tState++;
break;
case 1:
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, 0);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
ShowBg(1);
CopyBgTilemapBufferToVram(0);
ShowBg(0);
@ -268,9 +294,7 @@ static void Task_WirelessCommunicationScreen(u8 taskId)
break;
case 2:
if (!gPaletteFade.active)
{
gTasks[taskId].tState++;
}
break;
case 3:
if (UpdateCommunicationCounts(sStatusScreen->groupCounts, sStatusScreen->prevGroupCounts, sStatusScreen->activities, sStatusScreen->rfuTaskId))
@ -293,10 +317,10 @@ static void Task_WirelessCommunicationScreen(u8 taskId)
gTasks[sStatusScreen->rfuTaskId].data[15] = 0xFF;
gTasks[taskId].tState++;
}
WCSS_CyclePalette(&gTasks[taskId].data[7], &gTasks[taskId].data[8]);
CyclePalette(&gTasks[taskId].data[7], &gTasks[taskId].data[8]);
break;
case 4:
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, 0);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
gTasks[taskId].tState++;
break;
case 5: