Use TaskFunc wherever posible (#2188)

This commit is contained in:
Estellar
2025-10-18 13:53:50 -03:00
committed by GitHub
parent f2cf20ce9b
commit 0965dffe70
9 changed files with 13 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
#include "list_menu.h"
#include "main.h"
#include "task.h"
enum {
PYRAMIDBAG_LOC_FIELD,
@@ -69,6 +70,6 @@ void Task_CloseBattlePyramidBagMessage(u8 taskId);
void TryStoreHeldItemsInPyramidBag(void);
void ChooseItemsToTossFromPyramidBag(void);
void CloseBattlePyramidBag(u8 taskId);
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback)(u8 taskId));
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, TaskFunc callback);
#endif // GUARD_BATTLE_PYRAMID_BAG_H

View File

@@ -105,7 +105,7 @@ void CB2_ChooseBerry(void);
void Task_FadeAndCloseBagMenu(u8 taskId);
void BagMenu_YesNo(u8 taskId, u8 windowType, const struct YesNoFuncTable *funcTable);
void UpdatePocketItemList(u8 pocketId);
void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void (*callback)(u8 taskId));
void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, TaskFunc callback);
void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback);
void CloseItemMessage(u8 taskId);

View File

@@ -125,7 +125,7 @@ struct FactorySelectScreen
struct SwapScreenAction
{
u8 id;
void (*func)(u8 taskId);
TaskFunc func;
};
struct FactorySwapScreen
@@ -253,7 +253,7 @@ static EWRAM_DATA u8 *sSwapMenuTilemapBuffer = NULL;
static EWRAM_DATA u8 *sSwapMonPicBgTilemapBuffer = NULL;
static struct FactorySelectScreen *sFactorySelectScreen;
static void (*sSwap_CurrentOptionFunc)(u8 taskId);
static TaskFunc sSwap_CurrentOptionFunc;
static struct FactorySwapScreen *sFactorySwapScreen;
COMMON_DATA u8 (*gFactorySelect_CurrentOptionFunc)(void) = NULL;
@@ -886,7 +886,7 @@ static const struct SpriteTemplate sSpriteTemplate_Swap_MonPicBgAnim =
.callback = SpriteCallbackDummy
};
void static (*const sSwap_MenuOptionFuncs[])(u8 taskId) =
static const TaskFunc sSwap_MenuOptionFuncs[] =
{
Swap_OptionSummary,
Swap_OptionSwap,

View File

@@ -1502,7 +1502,7 @@ static void CreatePyramidBagYesNo(u8 taskId, const struct YesNoFuncTable *yesNoT
CreateYesNoMenuWithCallbacks(taskId, &sWindowTemplates_MenuActions[MENU_WIN_YESNO], 1, 0, 2, 1, 0xE, yesNoTable);
}
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback)(u8 taskId))
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, TaskFunc callback)
{
FillWindowPixelBuffer(WIN_MSG, PIXEL_FILL(1));
DisplayMessageAndContinueTask(taskId, WIN_MSG, 0xA, 0xD, FONT_NORMAL, GetPlayerTextSpeedDelay(), str, callback);

View File

@@ -339,9 +339,9 @@ bool8 IsComputerScreenCloseEffectActive(void)
#define tBlendCnt data[7]
#define tBlendY data[8]
static void CreateComputerScreenEffectTask(void (*taskfunc) (u8), u16 increment, u16 unused, u8 priority)
static void CreateComputerScreenEffectTask(TaskFunc func, u16 increment, u16 unused, u8 priority)
{
u8 taskId = CreateTask(taskfunc, priority);
u8 taskId = CreateTask(func, priority);
gTasks[taskId].tState = 0;
gTasks[taskId].tHorzIncrement = increment == 0 ? 16 : increment;

View File

@@ -1159,7 +1159,7 @@ u8 GetItemListPosition(u8 pocketId)
return gBagPosition.scrollPosition[pocketId] + gBagPosition.cursorPosition[pocketId];
}
void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void (*callback)(u8 taskId))
void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, TaskFunc callback)
{
s16 *data = gTasks[taskId].data;

View File

@@ -72,7 +72,7 @@ static void SetDistanceOfClosestHiddenItem(u8, s16, s16);
static void CB2_OpenPokeblockFromBag(void);
// EWRAM variables
EWRAM_DATA static void(*sItemUseOnFieldCB)(u8 taskId) = NULL;
EWRAM_DATA static TaskFunc sItemUseOnFieldCB = NULL;
// Below is set TRUE by UseRegisteredKeyItemOnField
#define tUsingRegisteredKeyItem data[3]

View File

@@ -956,7 +956,7 @@ void BlendPalettesGradually(u32 selectedPalettes, s8 delay, u8 coeff, u8 coeffTa
{
u8 taskId;
taskId = CreateTask((void *)Task_BlendPalettesGradually, priority);
taskId = CreateTask(Task_BlendPalettesGradually, priority);
gTasks[taskId].tCoeff = coeff;
gTasks[taskId].tCoeffTarget = coeffTarget;

View File

@@ -715,7 +715,7 @@ static void (*const sTextPrinterFunctions[])(void) =
[PSS_PAGE_CONTEST_MOVES] = PrintContestMoves
};
static void (*const sTextPrinterTasks[])(u8 taskId) =
static const TaskFunc sTextPrinterTasks[] =
{
[PSS_PAGE_INFO] = Task_PrintInfoPage,
[PSS_PAGE_SKILLS] = Task_PrintSkillsPage,