From 5ecf06b127ad1099bb75897cca87f0cdbe13f440 Mon Sep 17 00:00:00 2001 From: cawtds <> Date: Fri, 14 Jun 2024 15:34:48 +0200 Subject: [PATCH] fixed compiler warnings --- src/fieldmap.c | 7 ----- src/main_menu.c | 5 ---- src/menu2.c | 69 ----------------------------------------------- src/overworld.c | 54 +++---------------------------------- src/pokeball.c | 2 -- src/scrcmd.c | 71 +++++++------------------------------------------ 6 files changed, 12 insertions(+), 196 deletions(-) diff --git a/src/fieldmap.c b/src/fieldmap.c index bd69c0533..a3121ca8f 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -803,13 +803,6 @@ void GetCameraFocusCoords(u16 *x, u16 *y) *y = gSaveBlock1Ptr->pos.y + MAP_OFFSET; } -// Unused -static void SetCameraCoords(u16 x, u16 y) -{ - gSaveBlock1Ptr->pos.x = x; - gSaveBlock1Ptr->pos.y = y; -} - void GetCameraCoords(u16 *x, u16 *y) { *x = gSaveBlock1Ptr->pos.x; diff --git a/src/main_menu.c b/src/main_menu.c index b8f14bf8b..6a9ebd60c 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -161,11 +161,6 @@ void CB2_InitMainMenu(void) MainMenuGpuInit(1); } -static void CB2_InitMainMenu_2(void) -{ - MainMenuGpuInit(1); -} - static bool32 MainMenuGpuInit(u8 a0) { u8 taskId; diff --git a/src/menu2.c b/src/menu2.c index 110bbacee..11b93d738 100644 --- a/src/menu2.c +++ b/src/menu2.c @@ -88,75 +88,6 @@ void Menu_PrintFormatIntlPlayerName(u8 windowId, const u8 * src, u16 x, u16 y) } } -static void UnusedBlitBitmapRect(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height) -{ - s32 loopSrcY, loopDstY, loopSrcX, loopDstX, xEnd, yEnd, multiplierSrcY, multiplierDstY; - u16 toOrr; - u8 *pixelsSrc; - u8 *pixelsDst; - - if (dst->width - dstX < width) - xEnd = dst->width - dstX + srcX; - else - xEnd = width + srcX; - - if (dst->height - dstY < height) - yEnd = srcY + dst->height - dstY; - else - yEnd = srcY + height; - multiplierSrcY = (src->width + (src->width & 7)) >> 3; - multiplierDstY = (dst->width + (dst->width & 7)) >> 3; - for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++) - { - for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++) - { - pixelsSrc = (u8 *)(src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B)); - pixelsDst = (u8 *)(dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + ((( loopDstY >> 3) * multiplierDstY) << 5) + ((u32)( loopDstY << 0x1d) >> 0x1B)); - - if ((u32)pixelsDst & 0x1) - { - pixelsDst--; - if (loopDstX & 0x1) - { - toOrr = *(vu16 *)pixelsDst & 0x0fff; - if (loopSrcX & 0x1) - toOrr |= ((*pixelsSrc & 0xf0) << 8); - else - toOrr |= ((*pixelsSrc & 0x0f) << 12); - } - else - { - toOrr = *(vu16 *)pixelsDst & 0xf0ff; - if (loopSrcX & 0x1) - toOrr |= ((*pixelsSrc & 0xf0) << 4); - else - toOrr |= ((*pixelsSrc & 0x0f) << 8); - } - } - else - { - if (loopDstX & 1) - { - toOrr = *(vu16 *)pixelsDst & 0xff0f; - if (loopSrcX & 1) - toOrr |= ((*pixelsSrc & 0xf0) << 0); - else - toOrr |= ((*pixelsSrc & 0x0f) << 4); - } - else - { - toOrr = *(vu16 *)pixelsDst & 0xfff0; - if (loopSrcX & 1) - toOrr |= ((*pixelsSrc & 0xf0) >> 4); - else - toOrr |= ((*pixelsSrc & 0x0f) >> 0); - } - } - *(vu16 *)pixelsDst = toOrr; - } - } -} - #define tEvA data[0] #define tEvB data[1] #define tEvAEnd data[2] diff --git a/src/overworld.c b/src/overworld.c index 746e1ff5d..6f1d58bd1 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -198,7 +198,7 @@ static void RunTerminateLinkScript(void); static void SpawnLinkPlayerObjectEvent(u8 i, s16 x, s16 y, u8 gender); static void InitLinkPlayerObjectEventPos(struct ObjectEvent *objEvent, s16 x, s16 y); static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId); -static void GetLinkPlayerCoords(u8 linkPlayerId, u16 *x, u16 *y); +static void GetLinkPlayerCoords(u8 linkPlayerId, s16 *x, s16 *y); static u8 GetLinkPlayerFacingDirection(u8 linkPlayerId); static u8 GetLinkPlayerElevation(u8 linkPlayerId); static u8 GetLinkPlayerIdAt(s16 x, s16 y); @@ -682,11 +682,6 @@ static void SetWarpDestinationToContinueGameWarp(void) sWarpDestination = gSaveBlock1Ptr->continueGameWarp; } -static void SetContinueGameWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y) -{ - SetWarpData(&gSaveBlock1Ptr->continueGameWarp, mapGroup, mapNum, warpId, x, y); -} - void SetContinueGameWarpToHealLocation(u8 healLocationId) { const struct HealLocation *warp = GetHealLocation(healLocationId); @@ -812,11 +807,8 @@ static void LoadMapFromWarp(bool32 unused) static void QL_LoadMapNormal(void) { - bool8 isOutdoors; - LoadCurrentMapData(); LoadObjEventTemplatesFromHeader(); - isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType); TrySetMapSaveWarpStatus(); DoTimeBasedEvents(); SetSavedWeatherFromCurrMapHeader(); @@ -1153,8 +1145,6 @@ static void PlayAmbientCry(void) void UpdateAmbientCry(s16 *state, u16 *delayCounter) { - u8 i, monsCount, divBy; - switch (*state) { case 0: @@ -1256,11 +1246,6 @@ bool8 IsMapTypeIndoors(u8 mapType) return FALSE; } -static u8 GetSavedWarpRegionMapSectionId(void) -{ - return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->dynamicWarp.mapGroup, gSaveBlock1Ptr->dynamicWarp.mapNum)->regionMapSectionId; -} - u8 GetCurrentRegionMapSectionId(void) { return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum)->regionMapSectionId; @@ -2126,7 +2111,7 @@ static void InitObjectEventsLink(void) static void InitObjectEventsLocal(void) { - s16 x, y; + u16 x, y; struct InitialPlayerAvatarState *player; gTotalCameraPixelOffsetX = 0; @@ -2996,11 +2981,6 @@ u32 GetCableClubPartnersReady(void) return CABLE_SEAT_WAITING; } -static bool32 IsAnyPlayerExitingCableClub(void) -{ - return IsAnyPlayerInLinkState(PLAYER_LINK_STATE_EXITING_ROOM); -} - u16 SetInCableClubSeat(void) { SetKeyInterceptCallback(KeyInterCB_SetReady); @@ -3304,27 +3284,6 @@ static void InitLinkPlayerObjectEventPos(struct ObjectEvent *objEvent, s16 x, s1 ObjectEventUpdateElevation(objEvent); } -static void SetLinkPlayerObjectRange(u8 linkPlayerId, u8 dir) -{ - if (gLinkPlayerObjectEvents[linkPlayerId].active) - { - u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId; - struct ObjectEvent *objEvent = &gObjectEvents[objEventId]; - linkDirection(objEvent) = dir; - } -} - -static void DestroyLinkPlayerObject(u8 linkPlayerId) -{ - struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId]; - u8 objEventId = linkPlayerObjEvent->objEventId; - struct ObjectEvent *objEvent = &gObjectEvents[objEventId]; - if (objEvent->spriteId != MAX_SPRITES) - DestroySprite(&gSprites[objEvent->spriteId]); - linkPlayerObjEvent->active = FALSE; - objEvent->active = FALSE; -} - // Returns the spriteId corresponding to this player. static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId) { @@ -3333,7 +3292,7 @@ static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId) return objEvent->spriteId; } -static void GetLinkPlayerCoords(u8 linkPlayerId, u16 *x, u16 *y) +static void GetLinkPlayerCoords(u8 linkPlayerId, s16 *x, s16 *y) { u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId; struct ObjectEvent *objEvent = &gObjectEvents[objEventId]; @@ -3355,13 +3314,6 @@ static u8 GetLinkPlayerElevation(u8 linkPlayerId) return objEvent->currentElevation; } -static s32 GetLinkPlayerObjectStepTimer(u8 linkPlayerId) -{ - u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId; - struct ObjectEvent *objEvent = &gObjectEvents[objEventId]; - return 16 - (s8)objEvent->directionSequenceIndex; -} - static u8 GetLinkPlayerIdAt(s16 x, s16 y) { u8 i; diff --git a/src/pokeball.c b/src/pokeball.c index 726c3b229..98ba4953d 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -973,7 +973,6 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) if (gMain.inBattle) { struct Pokemon *mon, *illusionMon; - u16 species; s8 pan; u16 wantedCryCase; u8 taskId; @@ -989,7 +988,6 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) pan = -25; } - species = GetMonData(mon, MON_DATA_SPECIES); if ((battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) && IsDoubleBattle() && gBattleSpritesDataPtr->animationData->introAnimActive) { diff --git a/src/scrcmd.c b/src/scrcmd.c index e42238ade..671da7659 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -67,13 +67,13 @@ void *const gNullScriptPtr = NULL; static const u8 sScriptConditionTable[6][3] = { -// < = > - 1, 0, 0, // < - 0, 1, 0, // = - 0, 0, 1, // > - 1, 1, 0, // <= - 0, 1, 1, // >= - 1, 0, 1, // != +// < = > + {1, 0, 0}, // < + {0, 1, 0}, // = + {0, 0, 1}, // > + {1, 1, 0}, // <= + {0, 1, 1}, // >= + {1, 0, 1}, // != }; bool8 ScrCmd_nop(struct ScriptContext * ctx) @@ -529,33 +529,21 @@ bool8 ScrCmd_checkpcitem(struct ScriptContext * ctx) bool8 ScrCmd_adddecoration(struct ScriptContext * ctx) { - u32 decorId = VarGet(ScriptReadHalfword(ctx)); - -// gSpecialVar_Result = DecorationAdd(decorId); return FALSE; } bool8 ScrCmd_removedecoration(struct ScriptContext * ctx) { - u32 decorId = VarGet(ScriptReadHalfword(ctx)); - -// gSpecialVar_Result = DecorationRemove(decorId); return FALSE; } bool8 ScrCmd_checkdecorspace(struct ScriptContext * ctx) { - u32 decorId = VarGet(ScriptReadHalfword(ctx)); - -// gSpecialVar_Result = DecorationCheckSpace(decorId); return FALSE; } bool8 ScrCmd_checkdecor(struct ScriptContext * ctx) { - u32 decorId = VarGet(ScriptReadHalfword(ctx)); - -// gSpecialVar_Result = CheckHasDecoration(decorId); return FALSE; } @@ -763,8 +751,8 @@ bool8 ScrCmd_warphole(struct ScriptContext * ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); - u16 x; - u16 y; + s16 x; + s16 y; PlayerGetDestCoords(&x, &y); if (mapGroup == MAP_GROUP(UNDEFINED) && mapNum == MAP_NUM(UNDEFINED)) @@ -1494,27 +1482,11 @@ bool8 ScrCmd_multichoicegrid(struct ScriptContext * ctx) bool8 ScrCmd_erasebox(struct ScriptContext * ctx) { - u8 left = ScriptReadByte(ctx); - u8 top = ScriptReadByte(ctx); - u8 right = ScriptReadByte(ctx); - u8 bottom = ScriptReadByte(ctx); - - // Menu_EraseWindowRect(left, top, right, bottom); return FALSE; } bool8 ScrCmd_drawboxtext(struct ScriptContext * ctx) { -// u8 left = ScriptReadByte(ctx); -// u8 top = ScriptReadByte(ctx); -// u8 multichoiceId = ScriptReadByte(ctx); -// bool8 ignoreBPress = ScriptReadByte(ctx); - - /*if (Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE) - { - ScriptContext_Stop(); - return TRUE; - }*/ return FALSE; } @@ -1543,16 +1515,6 @@ bool8 ScrCmd_hidemonpic(struct ScriptContext * ctx) bool8 ScrCmd_showcontestpainting(struct ScriptContext * ctx) { - u8 contestWinnerId = ScriptReadByte(ctx); - /* - // Artist's painting is temporary and already has its data loaded - if (contestWinnerId != CONTEST_WINNER_ARTIST) - SetContestWinnerForPainting(contestWinnerId); - - ShowContestPainting(); - ScriptContext_Stop() - return TRUE; - */ return FALSE; } @@ -1660,10 +1622,6 @@ bool8 ScrCmd_bufferitemnameplural(struct ScriptContext * ctx) bool8 ScrCmd_bufferdecorationname(struct ScriptContext * ctx) { - u8 stringVarIndex = ScriptReadByte(ctx); - u16 decorId = VarGet(ScriptReadHalfword(ctx)); - -// StringCopy(sScriptStringVars[stringVarIndex], gDecorations[decorId].name); return FALSE; } @@ -1814,17 +1772,12 @@ bool8 ScrCmd_showmoneybox(struct ScriptContext * ctx) bool8 ScrCmd_hidemoneybox(struct ScriptContext * ctx) { - /*u8 x = ScriptReadByte(ctx); - u8 y = ScriptReadByte(ctx);*/ - HideMoneyBox(); return FALSE; } bool8 ScrCmd_updatemoneybox(struct ScriptContext * ctx) { - u8 x = ScriptReadByte(ctx); - u8 y = ScriptReadByte(ctx); u8 ignore = ScriptReadByte(ctx); if (!ignore) @@ -1844,18 +1797,12 @@ bool8 ScrCmd_showcoinsbox(struct ScriptContext * ctx) bool8 ScrCmd_hidecoinsbox(struct ScriptContext * ctx) { - u8 x = ScriptReadByte(ctx); - u8 y = ScriptReadByte(ctx); - HideCoinsWindow(); return FALSE; } bool8 ScrCmd_updatecoinsbox(struct ScriptContext * ctx) { - u8 x = ScriptReadByte(ctx); - u8 y = ScriptReadByte(ctx); - PrintCoinsString(GetCoins()); return FALSE; }