diff --git a/include/battle.h b/include/battle.h index c32c03fc550c..f84f13fe86a8 100644 --- a/include/battle.h +++ b/include/battle.h @@ -973,15 +973,10 @@ struct BattleSpriteData struct MonSpritesGfx { void *firstDecompressed; // ptr to the decompressed sprite of the first Pokémon - union { - void *ptr[MAX_BATTLERS_COUNT]; - u8 *byte[MAX_BATTLERS_COUNT]; - } sprites; + u8 *spritesGfx[MAX_BATTLERS_COUNT]; struct SpriteTemplate templates[MAX_BATTLERS_COUNT]; struct SpriteFrameImage frameImages[MAX_BATTLERS_COUNT][MAX_MON_PIC_FRAMES]; - u8 unusedArr[0x80]; u8 *barFontGfx; - void *unusedPtr; u16 *buffer; }; diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index d8fd768f6325..ffba3429eb4b 100644 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2368,7 +2368,7 @@ void AnimTask_TransformMon(u8 taskId) else position = GetBattlerPosition(gBattleAnimAttacker); - src = gMonSpritesGfxPtr->sprites.ptr[position]; + src = gMonSpritesGfxPtr->spritesGfx[position]; dest = animBg.bgTiles; CpuCopy32(src, dest, MON_PIC_SIZE); LoadBgTiles(1, animBg.bgTiles, 0x800, animBg.tilesOffset); diff --git a/src/battle_dynamax.c b/src/battle_dynamax.c index b703676b7371..0357e27d1e77 100644 --- a/src/battle_dynamax.c +++ b/src/battle_dynamax.c @@ -637,7 +637,7 @@ void BS_SetMaxMoveEffect(void) case MAX_EFFECT_SANDSTORM: case MAX_EFFECT_HAIL: { - u8 weather, msg; + u8 weather = 0, msg = 0; switch (maxEffect) { case MAX_EFFECT_SUN: diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 4aaf1b6e8356..31e4dcae2fb1 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -606,13 +606,13 @@ void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battler) if (GetBattlerSide(battler) == B_SIDE_OPPONENT) { HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[position], + gMonSpritesGfxPtr->spritesGfx[position], species, currentPersonality); } else { HandleLoadSpecialPokePic(FALSE, - gMonSpritesGfxPtr->sprites.ptr[position], + gMonSpritesGfxPtr->spritesGfx[position], species, currentPersonality); } @@ -654,7 +654,7 @@ void DecompressTrainerFrontPic(u16 frontPicId, u8 battler) { u8 position = GetBattlerPosition(battler); DecompressPicFromTable(&gTrainerSprites[frontPicId].frontPic, - gMonSpritesGfxPtr->sprites.ptr[position]); + gMonSpritesGfxPtr->spritesGfx[position]); LoadCompressedSpritePalette(&gTrainerSprites[frontPicId].palette); } @@ -662,7 +662,7 @@ void DecompressTrainerBackPic(u16 backPicId, u8 battler) { u8 position = GetBattlerPosition(battler); DecompressPicFromTable(&gTrainerBacksprites[backPicId].backPic, - gMonSpritesGfxPtr->sprites.ptr[position]); + gMonSpritesGfxPtr->spritesGfx[position]); LoadCompressedPalette(gTrainerBacksprites[backPicId].palette.data, OBJ_PLTT_ID(battler), PLTT_SIZE_4BPP); } @@ -883,7 +883,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo isShiny = gContestResources->moveAnim->isShiny; HandleLoadSpecialPokePic(FALSE, - gMonSpritesGfxPtr->sprites.ptr[position], + gMonSpritesGfxPtr->spritesGfx[position], targetSpecies, gContestResources->moveAnim->targetPersonality); } @@ -910,7 +910,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo } HandleLoadSpecialPokePic(FALSE, - gMonSpritesGfxPtr->sprites.ptr[position], + gMonSpritesGfxPtr->spritesGfx[position], targetSpecies, gTransformedPersonalities[battlerAtk]); } @@ -928,12 +928,12 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo } HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[position], + gMonSpritesGfxPtr->spritesGfx[position], targetSpecies, gTransformedPersonalities[battlerAtk]); } } - src = gMonSpritesGfxPtr->sprites.ptr[position]; + src = gMonSpritesGfxPtr->spritesGfx[position]; dst = (void *)(OBJ_VRAM0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); DmaCopy32(3, src, dst, MON_PIC_SIZE); paletteOffset = OBJ_PLTT_ID(battlerAtk); @@ -961,22 +961,21 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battler, bool8 loadMonSprite) if (!loadMonSprite) { - if (IsContest()) position = B_POSITION_PLAYER_LEFT; else position = GetBattlerPosition(battler); if (IsContest()) - LZDecompressVram(gBattleAnimSpriteGfx_SubstituteBack, gMonSpritesGfxPtr->sprites.ptr[position]); + LZDecompressVram(gBattleAnimSpriteGfx_SubstituteBack, gMonSpritesGfxPtr->spritesGfx[position]); else if (GetBattlerSide(battler) != B_SIDE_PLAYER) - LZDecompressVram(gBattleAnimSpriteGfx_Substitute, gMonSpritesGfxPtr->sprites.ptr[position]); + LZDecompressVram(gBattleAnimSpriteGfx_Substitute, gMonSpritesGfxPtr->spritesGfx[position]); else - LZDecompressVram(gBattleAnimSpriteGfx_SubstituteBack, gMonSpritesGfxPtr->sprites.ptr[position]); + LZDecompressVram(gBattleAnimSpriteGfx_SubstituteBack, gMonSpritesGfxPtr->spritesGfx[position]); for (i = 1; i < 4; i++) { - Dma3CopyLarge32_(gMonSpritesGfxPtr->sprites.ptr[position], &gMonSpritesGfxPtr->sprites.byte[position][MON_PIC_SIZE * i], MON_PIC_SIZE); + Dma3CopyLarge32_(gMonSpritesGfxPtr->spritesGfx[position], &gMonSpritesGfxPtr->spritesGfx[position][MON_PIC_SIZE * i], MON_PIC_SIZE); } palOffset = OBJ_PLTT_ID(battler); @@ -1217,14 +1216,14 @@ void AllocateMonSpritesGfx(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - gMonSpritesGfxPtr->sprites.ptr[i] = gMonSpritesGfxPtr->firstDecompressed + (i * MON_PIC_SIZE * 4); - *(gMonSpritesGfxPtr->templates + i) = gBattlerSpriteTemplates[i]; + gMonSpritesGfxPtr->spritesGfx[i] = gMonSpritesGfxPtr->firstDecompressed + (i * MON_PIC_SIZE * 4); + gMonSpritesGfxPtr->templates[i] = gBattlerSpriteTemplates[i]; - for (j = 0; j < 4; j++) + for (j = 0; j < MAX_MON_PIC_FRAMES; j++) { - if (gMonSpritesGfxPtr->sprites.ptr[i]) + if (gMonSpritesGfxPtr->spritesGfx[i]) { - gMonSpritesGfxPtr->frameImages[i][j].data = gMonSpritesGfxPtr->sprites.ptr[i] + (j * MON_PIC_SIZE); + gMonSpritesGfxPtr->frameImages[i][j].data = gMonSpritesGfxPtr->spritesGfx[i] + (j * MON_PIC_SIZE); gMonSpritesGfxPtr->frameImages[i][j].size = MON_PIC_SIZE; } } @@ -1241,13 +1240,12 @@ void FreeMonSpritesGfx(void) return; TRY_FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer); - TRY_FREE_AND_SET_NULL(gMonSpritesGfxPtr->unusedPtr); FREE_AND_SET_NULL(gMonSpritesGfxPtr->barFontGfx); FREE_AND_SET_NULL(gMonSpritesGfxPtr->firstDecompressed); - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT] = NULL; - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT] = NULL; - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_RIGHT] = NULL; - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT] = NULL; + gMonSpritesGfxPtr->spritesGfx[B_POSITION_PLAYER_LEFT] = NULL; + gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT] = NULL; + gMonSpritesGfxPtr->spritesGfx[B_POSITION_PLAYER_RIGHT] = NULL; + gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_RIGHT] = NULL; FREE_AND_SET_NULL(gMonSpritesGfxPtr); } diff --git a/src/battle_intro.c b/src/battle_intro.c index 858a32b13bc7..c28ed90ffc22 100644 --- a/src/battle_intro.c +++ b/src/battle_intro.c @@ -586,7 +586,7 @@ void DrawBattlerOnBg(int bgId, u8 x, u8 y, u8 battlerPosition, u8 paletteId, u8 { int i, j; int offset = tilesOffset; - CpuCopy16(gMonSpritesGfxPtr->sprites.ptr[battlerPosition], tiles, BG_SCREEN_SIZE); + CpuCopy16(gMonSpritesGfxPtr->spritesGfx[battlerPosition], tiles, BG_SCREEN_SIZE); LoadBgTiles(bgId, tiles, 0x1000, tilesOffset); for (i = y; i < y + 8; i++) { @@ -603,7 +603,7 @@ static void UNUSED DrawBattlerOnBgDMA(u8 x, u8 y, u8 battlerPosition, u8 arg3, u { int i, j, offset; - DmaCopy16(3, gMonSpritesGfxPtr->sprites.ptr[battlerPosition] + BG_SCREEN_SIZE * arg3, (void *)BG_SCREEN_ADDR(0) + arg5, BG_SCREEN_SIZE); + DmaCopy16(3, gMonSpritesGfxPtr->spritesGfx[battlerPosition] + BG_SCREEN_SIZE * arg3, (void *)BG_SCREEN_ADDR(0) + arg5, BG_SCREEN_SIZE); offset = (arg5 >> 5) - (arg7 << 9); for (i = y; i < y + 8; i++) { diff --git a/src/battle_main.c b/src/battle_main.c index c592eb66883d..f0075340eaba 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -2739,7 +2739,7 @@ static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite) } else // Erase bottom part of the sprite to create a smooth illusion of mon falling down. { - u8 *dst = gMonSpritesGfxPtr->sprites.byte[GetBattlerPosition(sprite->sBattler)] + (sprite->data[3] << 8); + u8 *dst = &gMonSpritesGfxPtr->spritesGfx[GetBattlerPosition(sprite->sBattler)][(sprite->data[3] << 8)]; for (i = 0; i < 0x100; i++) *(dst++) = 0; diff --git a/src/battle_util.c b/src/battle_util.c index 143ebc5144f6..41b10b5d1eef 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4123,7 +4123,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 } break; } - + if (effect == 1) BattleScriptPushCursorAndCallback(BattleScript_OverworldStatusStarts); else if (effect == 2) @@ -4989,7 +4989,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 case ABILITYEFFECT_ABSORBING: // 3 if (move != MOVE_NONE) { - u8 statId; + u8 statId = 0; u8 statAmount = 1; switch (gLastUsedAbility) { diff --git a/src/contest.c b/src/contest.c index ba63b8073af9..f0d0d527ed37 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3211,7 +3211,7 @@ static u8 CreateContestantSprite(u16 species, bool8 isShiny, u32 personality, u3 u8 spriteId; species = SanitizeSpecies(species); - HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT], species, personality); + HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->spritesGfx[B_POSITION_PLAYER_LEFT], species, personality); LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, isShiny, personality), OBJ_PLTT_ID(2), PLTT_SIZE_4BPP); SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_PLAYER_LEFT); diff --git a/src/contest_painting.c b/src/contest_painting.c index 529330a5228f..922b8785314f 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -368,18 +368,18 @@ static void InitContestMonPixels(u16 species, bool8 backPic) if (!backPic) { HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], + gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], species, gContestPaintingWinner->personality); - _InitContestMonPixels(gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], gContestPaintingMonPalette, (void *)gContestMonPixels); + _InitContestMonPixels(gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], gContestPaintingMonPalette, (void *)gContestMonPixels); } else { HandleLoadSpecialPokePic(FALSE, - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT], + gMonSpritesGfxPtr->spritesGfx[B_POSITION_PLAYER_LEFT], species, gContestPaintingWinner->personality); - _InitContestMonPixels(gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT], gContestPaintingMonPalette, (void *)gContestMonPixels); + _InitContestMonPixels(gMonSpritesGfxPtr->spritesGfx[B_POSITION_PLAYER_LEFT], gContestPaintingMonPalette, (void *)gContestMonPixels); } } diff --git a/src/contest_util.c b/src/contest_util.c index 7de492303722..7977f373c165 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -893,7 +893,7 @@ static void Task_ShowWinnerMonBanner(u8 taskId) personality = gContestMons[i].personality; isShiny = gContestMons[i].isShiny; HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], + gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], species, personality); @@ -2570,7 +2570,7 @@ void ShowContestEntryMonPic(void) taskId = CreateTask(Task_ShowContestEntryMonPic, 0x50); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = species; - HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], species, personality); + HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], species, personality); LoadCompressedSpritePaletteWithTag(GetMonSpritePalFromSpeciesAndPersonality(species, isShiny, personality), species); SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_OPPONENT_LEFT); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index abb7ca4e15cb..588563d5d200 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -442,7 +442,7 @@ static u8 EggHatchCreateMonSprite(u8 useAlt, u8 state, u8 partyId, u16 *speciesL { u32 pid = GetMonData(mon, MON_DATA_PERSONALITY); HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[(useAlt * 2) + B_POSITION_OPPONENT_LEFT], + gMonSpritesGfxPtr->spritesGfx[(useAlt * 2) + B_POSITION_OPPONENT_LEFT], species, pid); LoadCompressedSpritePaletteWithTag(GetMonFrontSpritePal(mon), species); *speciesLoc = species; diff --git a/src/evolution_scene.c b/src/evolution_scene.c index b254dab42ac7..c5d7e56f0bf6 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -258,7 +258,7 @@ void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u currSpecies = GetMonData(mon, MON_DATA_SPECIES); isShiny = GetMonData(mon, MON_DATA_IS_SHINY); personality = GetMonData(mon, MON_DATA_PERSONALITY); - LoadSpecialPokePic(gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], + LoadSpecialPokePic(gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], currSpecies, personality, TRUE); @@ -273,7 +273,7 @@ void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u gSprites[id].invisible = TRUE; // postEvo sprite - LoadSpecialPokePic(gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT], + LoadSpecialPokePic(gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_RIGHT], postEvoSpecies, personality, TRUE); @@ -350,7 +350,7 @@ static void CB2_EvolutionSceneLoadGraphics(void) FreeAllSpritePalettes(); gReservedSpritePaletteCount = 4; - LoadSpecialPokePic(gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT], + LoadSpecialPokePic(gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_RIGHT], postEvoSpecies, personality, TRUE); @@ -420,7 +420,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) { bool8 isShiny = GetMonData(mon, MON_DATA_IS_SHINY); u32 personality = GetMonData(mon, MON_DATA_PERSONALITY); - LoadSpecialPokePic(gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT], + LoadSpecialPokePic(gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_RIGHT], postEvoSpecies, personality, TRUE); @@ -484,7 +484,7 @@ void TradeEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, u8 preEvoSprit sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); sEvoStructPtr->preEvoSpriteId = preEvoSpriteId; - LoadSpecialPokePic(gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], + LoadSpecialPokePic(gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], postEvoSpecies, personality, TRUE); diff --git a/src/librfu_sio32id.c b/src/librfu_sio32id.c index 1c02840e85d1..4f49fbd1b4c3 100644 --- a/src/librfu_sio32id.c +++ b/src/librfu_sio32id.c @@ -24,7 +24,7 @@ s32 AgbRFU_checkID(u8 maxTries) { u16 ieBak; vu16 *regTMCNTL; - s32 id; + s32 id = 0; // Interrupts must be enabled if (REG_IME == 0) diff --git a/src/option_menu.c b/src/option_menu.c index af10b75a20ef..273353c22b99 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -545,7 +545,7 @@ static u8 FrameType_ProcessInput(u8 selection) static void FrameType_DrawChoices(u8 selection) { - u8 text[16]; + u8 text[16] = {EOS}; u8 n = selection + 1; u16 i; diff --git a/src/palette_util.c b/src/palette_util.c old mode 100755 new mode 100644 diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index 61e1b7a6b366..59aed379d8aa 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -727,7 +727,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon) // Load mon gfx species = GetMonData(mon, MON_DATA_SPECIES_OR_EGG); personality = GetMonData(mon, MON_DATA_PERSONALITY); - HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], species, personality); + HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], species, personality); sPokeblockFeed->loadGfxState++; break; case 1: diff --git a/src/pokemon.c b/src/pokemon.c index 4268515b6586..9bb8772af27a 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1643,7 +1643,7 @@ static void SetMonMoveSlot_KeepPP(struct Pokemon *mon, u16 move, u8 slot) u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); u8 currPP = GetMonData(mon, MON_DATA_PP1 + slot, NULL); u8 newPP = CalculatePPWithBonus(move, ppBonuses, slot); - u8 finalPP = min(currPP, newPP); + u16 finalPP = min(currPP, newPP); SetMonData(mon, MON_DATA_MOVE1 + slot, &move); SetMonData(mon, MON_DATA_PP1 + slot, &finalPP); @@ -5607,7 +5607,7 @@ static inline bool32 CanFirstMonBoostHeldItemRarity(void) u32 ability; if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) return FALSE; - + ability = GetMonAbility(&gPlayerParty[0]); if ((OW_COMPOUND_EYES < GEN_9) && ability == ABILITY_COMPOUND_EYES) return TRUE; diff --git a/src/pokemon_debug.c b/src/pokemon_debug.c index f34afe278dc5..3f2291141744 100644 --- a/src/pokemon_debug.c +++ b/src/pokemon_debug.c @@ -1114,7 +1114,7 @@ void CB2_Debug_Pokemon(void) palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny); LoadCompressedSpritePaletteWithTag(palette, species); //Front - HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[1], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); + HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->spritesGfx[1], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); data->isShiny = FALSE; data->isFemale = FALSE; BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1); @@ -1129,7 +1129,7 @@ void CB2_Debug_Pokemon(void) LoadAndCreateEnemyShadowSpriteCustom(data, species); //Back - HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->sprites.ptr[2], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); + HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->spritesGfx[2], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 4); SetMultiuseSpriteTemplateToPokemon(species, 2); offset_y = gSpeciesInfo[species].backPicYOffset; @@ -1666,7 +1666,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data) palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny); LoadCompressedSpritePaletteWithTag(palette, species); //Front - HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[1], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); + HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->spritesGfx[1], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1); SetMultiuseSpriteTemplateToPokemon(species, 1); gMultiuseSpriteTemplate.paletteTag = species; @@ -1679,7 +1679,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data) LoadAndCreateEnemyShadowSpriteCustom(data, species); //Back - HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->sprites.ptr[2], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); + HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->spritesGfx[2], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 5); SetMultiuseSpriteTemplateToPokemon(species, 2); offset_y = gSpeciesInfo[species].backPicYOffset; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 2fa88b4db59c..8f981ed8545b 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -5987,7 +5987,7 @@ static bool8 UpdateCursorPos(void) static void InitNewCursorPos(u8 newCursorArea, u8 newCursorPosition) { - u16 x, y; + u16 x = 0, y = 0; GetCursorCoordsByPos(newCursorArea, newCursorPosition, &x, &y); sStorage->newCursorArea = newCursorArea; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index ca84d5b390c7..e3850e6b4e55 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -4026,7 +4026,7 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state) if (gMain.inBattle) { HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], + gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], summary->species2, summary->pid); } @@ -4035,7 +4035,7 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state) if (gMonSpritesGfxPtr != NULL) { HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], + gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_LEFT], summary->species2, summary->pid); } diff --git a/src/secret_base.c b/src/secret_base.c index a662acb36ef8..264cd9435a5a 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -470,7 +470,7 @@ static void EnterNewlyCreatedSecretBase_WaitFadeIn(u8 taskId) static void EnterNewlyCreatedSecretBase_StartFadeIn(void) { - s16 x, y; + s16 x = 0, y = 0; LockPlayerFieldControls(); HideMapNamePopUpWindow(); @@ -519,7 +519,7 @@ bool8 CurMapIsSecretBase(void) void InitSecretBaseAppearance(bool8 hidePC) { u16 secretBaseIdx; - s16 x, y; + s16 x, y = 0; u8 *decorations; u8 *decorPos; diff --git a/src/trade.c b/src/trade.c index d3345cb06e93..04b1977c17b0 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2788,7 +2788,7 @@ static void LoadTradeMonPic(u8 whichParty, u8 state) case 0: personality = GetMonData(mon, MON_DATA_PERSONALITY); - HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[whichParty * 2 + B_POSITION_OPPONENT_LEFT], species, personality); + HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->spritesGfx[whichParty * 2 + B_POSITION_OPPONENT_LEFT], species, personality); LoadCompressedSpritePaletteWithTag(GetMonFrontSpritePal(mon), species); sTradeAnim->monSpecies[whichParty] = species; @@ -3784,7 +3784,7 @@ static bool8 DoTradeAnim_Cable(void) if (gSprites[sTradeAnim->bouncingPokeballSpriteId].callback == SpriteCallbackDummy) { HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT], + gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_RIGHT], sTradeAnim->monSpecies[TRADE_PARTNER], sTradeAnim->monPersonalities[TRADE_PARTNER]); sTradeAnim->state++; @@ -4281,7 +4281,7 @@ static bool8 DoTradeAnim_Wireless(void) if (gSprites[sTradeAnim->bouncingPokeballSpriteId].callback == SpriteCallbackDummy) { HandleLoadSpecialPokePic(TRUE, - gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT], + gMonSpritesGfxPtr->spritesGfx[B_POSITION_OPPONENT_RIGHT], sTradeAnim->monSpecies[TRADE_PARTNER], sTradeAnim->monPersonalities[TRADE_PARTNER]); sTradeAnim->state++;