fixed more warnings

This commit is contained in:
cawtds
2024-06-14 21:26:11 +02:00
parent 82099d26f4
commit 9f945f58e2
5 changed files with 10 additions and 270 deletions

View File

@@ -1,7 +1,6 @@
#ifndef GUARD_CONFIG_H
#define GUARD_CONFIG_H
#define BUGFIX
// In the Generation 3 games, Asserts were used in various debug builds.
// Ruby/Sapphire and Emerald do not have these asserts while Fire Red
// still has them in the ROM. This is because the developers forgot
@@ -52,14 +51,12 @@
// Crashes may occur due to section reordering in the modern build,
// so we force BUGFIX here.
#if MODERN
#ifndef BUGFIX
#define BUGFIX
#endif // BUGFIX
#ifndef UBFIX
#define UBFIX
#endif // UBFIX
#endif // MODERN
// Generation constants used in configs to define behavior
#define GEN_1 0

View File

@@ -247,52 +247,6 @@ void RedrawListMenu(u8 listTaskId)
CopyWindowToVram(list->template.windowId, COPYWIN_GFX);
}
static void ChangeListMenuPals(u8 listTaskId, u8 cursorPal, u8 fillValue, u8 cursorShadowPal)
{
struct ListMenu *list = (struct ListMenu *)gTasks[listTaskId].data;
list->template.cursorPal = cursorPal;
list->template.fillValue = fillValue;
list->template.cursorShadowPal = cursorShadowPal;
}
static void ChangeListMenuCoords(u8 listTaskId, u8 x, u8 y)
{
struct ListMenu *list = (struct ListMenu *)gTasks[listTaskId].data;
SetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT, x);
SetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP, y);
}
static s32 ListMenuTestInput(struct ListMenuTemplate *template, u32 cursorPos, u32 itemsAbove, u16 keys, u16 *newCursorPos, u16 *newItemsAbove)
{
struct ListMenu list;
list.template = *template;
list.cursorPos = cursorPos;
list.itemsAbove = itemsAbove;
list.unk_1C = 0;
list.unk_1D = 0;
if (keys == DPAD_UP)
ListMenuChangeSelection(&list, FALSE, 1, FALSE);
if (keys == DPAD_DOWN)
ListMenuChangeSelection(&list, FALSE, 1, TRUE);
if (newCursorPos != NULL)
*newCursorPos = list.cursorPos;
if (newItemsAbove != NULL)
*newItemsAbove = list.itemsAbove;
return LIST_NOTHING_CHOSEN;
}
static void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId)
{
struct ListMenu *list = (struct ListMenu *)gTasks[listTaskId].data;
if (arrayId != NULL)
*arrayId = list->cursorPos + list->itemsAbove;
}
void ListMenuGetScrollAndRow(u8 listTaskId, u16 *cursorPos, u16 *itemsAbove)
{
struct ListMenu *list = (struct ListMenu *)gTasks[listTaskId].data;
@@ -624,50 +578,6 @@ void ListMenuDefaultCursorMoveFunc(s32 itemIndex, bool8 onInit, struct ListMenu
PlaySE(SE_SELECT);
}
static s32 ListMenuGetTemplateField(u8 taskId, u8 field)
{
struct ListMenu *data = (struct ListMenu *)gTasks[taskId].data;
switch (field)
{
case LISTFIELD_MOVECURSORFUNC:
case LISTFIELD_MOVECURSORFUNC2:
return (s32)(data->template.moveCursorFunc);
case LISTFIELD_TOTALITEMS:
return data->template.totalItems;
case LISTFIELD_MAXSHOWED:
return data->template.maxShowed;
case LISTFIELD_WINDOWID:
return data->template.windowId;
case LISTFIELD_HEADERX:
return data->template.header_X;
case LISTFIELD_ITEMX:
return data->template.item_X;
case LISTFIELD_CURSORX:
return data->template.cursor_X;
case LISTFIELD_UPTEXTY:
return data->template.upText_Y;
case LISTFIELD_CURSORPAL:
return data->template.cursorPal;
case LISTFIELD_FILLVALUE:
return data->template.fillValue;
case LISTFIELD_CURSORSHADOWPAL:
return data->template.cursorShadowPal;
case LISTFIELD_LETTERSPACING:
return data->template.lettersSpacing;
case LISTFIELD_ITEMVERTICALPADDING:
return data->template.itemVerticalPadding;
case LISTFIELD_SCROLLMULTIPLE:
return data->template.scrollMultiple;
case LISTFIELD_FONTID:
return data->template.fontId;
case LISTFIELD_CURSORKIND:
return data->template.cursorKind;
default:
return -1;
}
}
void ListMenuSetTemplateField(u8 taskId, u8 field, s32 value)
{
struct ListMenu *data = (struct ListMenu *)gTasks[taskId].data;

View File

@@ -41,9 +41,6 @@ struct PaletteStruct
u8 countdown2;
};
static void PaletteStruct_Copy(struct PaletteStruct *, u32 *);
static void PaletteStruct_Blend(struct PaletteStruct *, u32 *);
static void PaletteStruct_TryEnd(struct PaletteStruct *);
static void PaletteStruct_Reset(u8 paletteNum);
static u8 PaletteStruct_GetPalNum(u16);
static u8 UpdateNormalPaletteFade(void);
@@ -189,144 +186,6 @@ bool8 BeginNormalPaletteFade(u32 selectedPalettes, s8 delay, u8 startY, u8 targe
}
}
// Unused
static bool8 BeginPlttFade(u32 selectedPalettes, u8 delay, u8 startY, u8 targetY, u16 blendColor)
{
ReadPlttIntoBuffers();
return BeginNormalPaletteFade(selectedPalettes, delay, startY, targetY, blendColor);
}
// Unused
static void PaletteStruct_Run(u8 a1, u32 *unkFlags)
{
u8 i;
for (i = 0; i < NUM_PALETTE_STRUCTS; ++i)
{
struct PaletteStruct *palstruct = &sPaletteStructs[i];
if (palstruct->active)
{
if (palstruct->template->pst_field_8_0 == a1)
{
u8 srcIndex = palstruct->srcIndex;
u8 srcCount = palstruct->template->srcCount;
if (srcIndex == srcCount)
{
PaletteStruct_TryEnd(palstruct);
if (!palstruct->active)
continue;
}
if (palstruct->countdown1 == 0)
PaletteStruct_Copy(palstruct, unkFlags);
else
palstruct->countdown1--;
PaletteStruct_Blend(palstruct, unkFlags);
}
}
}
}
static void PaletteStruct_Copy(struct PaletteStruct *palStruct, u32 *unkFlags)
{
s32 srcIndex;
s32 srcCount;
u8 i = 0;
u16 srcOffset = palStruct->srcIndex * palStruct->template->size;
if (!palStruct->template->pst_field_8_0)
{
while (i < palStruct->template->size)
{
gPlttBufferUnfaded[palStruct->destOffset] = palStruct->template->src[srcOffset];
gPlttBufferFaded[palStruct->destOffset] = palStruct->template->src[srcOffset];
i++;
palStruct->destOffset++;
srcOffset++;
}
}
else
{
while (i < palStruct->template->size)
{
gPlttBufferFaded[palStruct->destOffset] = palStruct->template->src[srcOffset];
i++;
palStruct->destOffset++;
srcOffset++;
}
}
palStruct->destOffset = palStruct->baseDestOffset;
palStruct->countdown1 = palStruct->template->time1;
palStruct->srcIndex++;
srcIndex = palStruct->srcIndex;
srcCount = palStruct->template->srcCount;
if (srcIndex >= srcCount)
{
if (palStruct->countdown2)
palStruct->countdown2--;
palStruct->srcIndex = 0;
}
*unkFlags |= 1 << (palStruct->baseDestOffset >> 4);
}
static void PaletteStruct_Blend(struct PaletteStruct *palStruct, u32 *unkFlags)
{
if (gPaletteFade.active && ((1 << (palStruct->baseDestOffset >> 4)) & gPaletteFade_selectedPalettes))
{
if (!palStruct->template->pst_field_8_0)
{
if (gPaletteFade.delayCounter != gPaletteFade_delay)
BlendPalette(palStruct->baseDestOffset,
palStruct->template->size,
gPaletteFade.y,
gPaletteFade.blendColor);
}
else
{
if (!gPaletteFade.delayCounter)
{
if (palStruct->countdown1 != palStruct->template->time1)
{
u32 srcOffset = palStruct->srcIndex * palStruct->template->size;
u8 i;
for (i = 0; i < palStruct->template->size; i++)
gPlttBufferFaded[palStruct->baseDestOffset + i] = palStruct->template->src[srcOffset + i];
}
}
}
}
}
static void PaletteStruct_TryEnd(struct PaletteStruct *palStruct)
{
if (!palStruct->countdown2)
{
s32 state = palStruct->template->state;
if (state == 0)
{
palStruct->srcIndex = 0;
palStruct->countdown1 = palStruct->template->time1;
palStruct->countdown2 = palStruct->template->time2;
palStruct->destOffset = palStruct->baseDestOffset;
}
else
{
if (state < 0)
return;
if (state > 2)
return;
PaletteStruct_ResetById(palStruct->template->id);
}
}
else
{
palStruct->countdown2--;
}
}
void PaletteStruct_ResetById(u16 id)
{
u8 paletteNum = PaletteStruct_GetPalNum(id);
@@ -366,20 +225,6 @@ void ResetPaletteFadeControl(void)
gPaletteFade.deltaY = 2;
}
static void PaletteStruct_SetUnusedFlag(u16 id)
{
u8 paletteNum = PaletteStruct_GetPalNum(id);
if (paletteNum != NUM_PALETTE_STRUCTS)
sPaletteStructs[paletteNum].flag = TRUE;
}
static void PaletteStruct_ClearUnusedFlag(u16 id)
{
u8 paletteNum = PaletteStruct_GetPalNum(id);
if (paletteNum != NUM_PALETTE_STRUCTS)
sPaletteStructs[paletteNum].flag = FALSE;
}
static u8 PaletteStruct_GetPalNum(u16 id)
{
u8 i;

View File

@@ -40,17 +40,6 @@ u8 RouletteFlash_Add(struct RouletteFlashUtil *flash, u8 id, const struct Roulet
return id;
}
static u8 RouletteFlash_Remove(struct RouletteFlashUtil *flash, u8 id)
{
if (id >= ARRAY_COUNT(flash->palettes))
return 0xFF;
if (!flash->palettes[id].available)
return 0xFF;
memset(&flash->palettes[id], 0, sizeof(flash->palettes[id]));
return id;
}
static u8 RouletteFlash_FadePalette(struct RouletteFlashPalette *pal)
{
u8 i;

View File

@@ -83,18 +83,18 @@ static const u8 *const sItemStorageActionDescriptionPtrs[] = {
};
static const struct MenuAction sMenuActions_TopMenu[] = {
{gText_ItemStorage, Task_PlayerPcItemStorage},
{gText_Mailbox, Task_PlayerPcMailbox},
{gText_TurnOff, Task_PlayerPcTurnOff}
{gText_ItemStorage, {Task_PlayerPcItemStorage}},
{gText_Mailbox, {Task_PlayerPcMailbox}},
{gText_TurnOff, {Task_PlayerPcTurnOff}}
};
static const u8 sItemOrder_BedroomPC[] = { 0, 1, 2 };
static const u8 sItemOrder_PlayerPC[] = { 0, 1, 2 };
static const struct MenuAction sMenuActions_ItemPc[] = {
{gText_WithdrawItem2, Task_PlayerPcWithdrawItem},
{gText_DepositItem2, Task_PlayerPcDepositItem},
{gFameCheckerText_Cancel, Task_PlayerPcCancel}
{gText_WithdrawItem2, {Task_PlayerPcWithdrawItem}},
{gText_DepositItem2, {Task_PlayerPcDepositItem}},
{gFameCheckerText_Cancel, {Task_PlayerPcCancel}}
};
static const struct ItemSlot gNewGamePCItems[] = {
@@ -103,10 +103,10 @@ static const struct ItemSlot gNewGamePCItems[] = {
};
static const struct MenuAction sMenuActions_MailSubmenu[] = {
{gOtherText_Read, Task_PlayerPcReadMail},
{gOtherText_MoveToBag, Task_PlayerPcMoveMailToBag},
{gOtherText_Give2, Task_PlayerPcGiveMailToMon},
{gOtherText_Exit, Task_PlayerPcExitMailSubmenu}
{gOtherText_Read, {Task_PlayerPcReadMail}},
{gOtherText_MoveToBag, {Task_PlayerPcMoveMailToBag}},
{gOtherText_Give2, {Task_PlayerPcGiveMailToMon}},
{gOtherText_Exit, {Task_PlayerPcExitMailSubmenu}}
};
static const struct WindowTemplate sWindowTemplate_TopMenu_3Items = {
@@ -494,7 +494,6 @@ static void Task_MailboxPcHandleInput(u8 taskId)
static void Task_PrintWhatToDoWithSelectedMail(u8 taskId)
{
s32 length;
s32 i;
u8 *ptr;
StringCopy(gStringVar1, SELECTED_MAIL.playerName);
length = StringLength(gStringVar1);