Use SPRITE_NONE constant

This commit is contained in:
GriffinR 2021-02-20 00:30:37 -05:00
parent a5852d57d1
commit b04f0aaa2b
19 changed files with 129 additions and 119 deletions

View File

@ -33,6 +33,12 @@ struct SpriteCopyRequest
u16 size;
};
struct OamDimensions32
{
s32 width;
s32 height;
};
struct OamDimensions
{
s8 width;
@ -240,25 +246,28 @@ static const AffineAnimCmdFunc sAffineAnimCmdFuncs[] =
AffineAnimCmd_frame,
};
static const s32 sUnknown_082EC6F4[3][4][2] =
static const struct OamDimensions32 sOamDimensions32[3][4] =
{
[ST_OAM_SQUARE] =
{
{8, 8},
{0x10, 0x10},
{0x20, 0x20},
{0x40, 0x40},
[SPRITE_SIZE(8x8)] = { 8, 8 },
[SPRITE_SIZE(16x16)] = { 16, 16 },
[SPRITE_SIZE(32x32)] = { 32, 32 },
[SPRITE_SIZE(64x64)] = { 64, 64 },
},
[ST_OAM_H_RECTANGLE] =
{
{0x10, 8},
{0x20, 8},
{0x20, 0x10},
{0x40, 0x20},
[SPRITE_SIZE(16x8)] = { 16, 8 },
[SPRITE_SIZE(32x8)] = { 32, 8 },
[SPRITE_SIZE(32x16)] = { 32, 16 },
[SPRITE_SIZE(64x32)] = { 64, 32 },
},
[ST_OAM_V_RECTANGLE] =
{
{8, 0x10},
{8, 0x20},
{0x10, 0x20},
{0x20, 0x40},
[SPRITE_SIZE(8x16)] = { 8, 16 },
[SPRITE_SIZE(8x32)] = { 8, 32 },
[SPRITE_SIZE(16x32)] = { 16, 32 },
[SPRITE_SIZE(32x64)] = { 32, 64 },
},
};
@ -1233,14 +1242,14 @@ void obj_update_pos2(struct Sprite *sprite, s32 a1, s32 a2)
u32 matrixNum = sprite->oam.matrixNum;
if (a1 != 0x800)
{
var0 = sUnknown_082EC6F4[sprite->oam.shape][sprite->oam.size][0];
var0 = sOamDimensions32[sprite->oam.shape][sprite->oam.size].width;
var1 = var0 << 8;
var2 = (var0 << 16) / gOamMatrices[matrixNum].a;
sprite->pos2.x = sub_8007E28(var1, var2, a1);
}
if (a2 != 0x800)
{
var0 = sUnknown_082EC6F4[sprite->oam.shape][sprite->oam.size][1];
var0 = sOamDimensions32[sprite->oam.shape][sprite->oam.size].height;
var1 = var0 << 8;
var2 = (var0 << 16) / gOamMatrices[matrixNum].d;
sprite->pos2.y = sub_8007E28(var1, var2, a2);

View File

@ -2,6 +2,7 @@
#define GUARD_SPRITE_H
#define MAX_SPRITES 64
#define SPRITE_NONE 0xFF
#define SPRITE_INVALID_TAG 0xFFFF
struct SpriteSheet

View File

@ -3362,7 +3362,7 @@ static void ScriptCmd_invisible(void)
u8 spriteId;
spriteId = GetAnimBattlerSpriteId(sBattleAnimScriptPtr[1]);
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
gSprites[spriteId].invisible = TRUE;
sBattleAnimScriptPtr += 2;
@ -3373,7 +3373,7 @@ static void ScriptCmd_visible(void)
u8 spriteId;
spriteId = GetAnimBattlerSpriteId(sBattleAnimScriptPtr[1]);
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
gSprites[spriteId].invisible = FALSE;
sBattleAnimScriptPtr += 2;
@ -3400,7 +3400,7 @@ static void ScriptCmd_doublebattle_2D(void)
r4 = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget);
spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
}
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
{
gSprites[spriteId].invisible = FALSE;
if (r4 == 2)
@ -3436,7 +3436,7 @@ static void ScriptCmd_doublebattle_2E(void)
spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
}
if (spriteId != 0xFF && r4 == 2)
if (spriteId != SPRITE_NONE && r4 == 2)
gSprites[spriteId].oam.priority = 2;
}
}

View File

@ -764,7 +764,7 @@ static void sub_8114374(u8 priority)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
u8 spriteId = GetAnimBattlerSpriteId(i);
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
gSprites[spriteId].oam.priority = priority;
}
}
@ -960,7 +960,7 @@ void AnimTask_SetGreyscaleOrOriginalPal(u8 taskId)
calcSpriteId = TRUE;
break;
default:
spriteId = 0xFF;
spriteId = SPRITE_NONE;
break;
}
@ -970,10 +970,10 @@ void AnimTask_SetGreyscaleOrOriginalPal(u8 taskId)
if (IsBattlerSpriteVisible(battler))
spriteId = gBattlerSpriteIds[battler];
else
spriteId = 0xFF;
spriteId = SPRITE_NONE;
}
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
SetGreyscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, gBattleAnimArgs[1]);
DestroyAnimVisualTask(taskId);

View File

@ -603,7 +603,7 @@ void AnimTask_HorizontalShake(u8 taskId)
break;
default: // Shake specific battler
task->tbattlerSpriteIds(0) = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (task->tbattlerSpriteIds(0) == 0xFF)
if (task->tbattlerSpriteIds(0) == SPRITE_NONE)
{
DestroyAnimVisualTask(taskId);
}

View File

@ -94,7 +94,7 @@ void AnimTask_ShakeMon(u8 taskId)
{
u8 spriteId;
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (spriteId == 0xff)
if (spriteId == SPRITE_NONE)
{
DestroyAnimVisualTask(taskId);
return;
@ -162,7 +162,7 @@ void AnimTask_ShakeMon2(u8 taskId)
if (gBattleAnimArgs[0] < MAX_BATTLERS_COUNT)
{
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (spriteId == 0xff)
if (spriteId == SPRITE_NONE)
{
DestroyAnimVisualTask(taskId);
return;
@ -255,7 +255,7 @@ static void AnimTask_ShakeMon2_Step(u8 taskId)
void AnimTask_ShakeMonInPlace(u8 taskId)
{
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (spriteId == 0xff)
if (spriteId == SPRITE_NONE)
{
DestroyAnimVisualTask(taskId);
return;

View File

@ -1569,7 +1569,7 @@ s16 CloneBattlerSpriteWithBlend(u8 animBattler)
u16 i;
u8 spriteId = GetAnimBattlerSpriteId(animBattler);
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
{
for (i = 0; i < MAX_SPRITES; i++)
{
@ -1655,7 +1655,7 @@ static void AnimTask_AlphaFadeIn_Step(u8 taskId)
void AnimTask_BlendMonInAndOut(u8 task)
{
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (spriteId == 0xff)
if (spriteId == SPRITE_NONE)
{
DestroyAnimVisualTask(task);
return;

View File

@ -3040,7 +3040,7 @@ static void Task_ShowTourneyInfoCard(u8 taskId)
SetVBlankCallback(VblankCb_TourneyInfoCard);
sInfoCard = AllocZeroed(sizeof(*sInfoCard));
for (i = 0; i < NUM_INFOCARD_SPRITES; i++)
sInfoCard->spriteIds[i] = 0xFF;
sInfoCard->spriteIds[i] = SPRITE_NONE;
LoadMonIconPalettes();
i = CreateTask(Task_HandleInfoCardInput, 0);
gTasks[i].data[0] = 0;
@ -3105,7 +3105,7 @@ static void SpriteCb_TrainerIconCardScrollUp(struct Sprite *sprite)
{
if (sprite->pos1.y >= 192)
{
sInfoCard->spriteIds[sprite->data[2]] = 0xFF;
sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE;
FreeAndDestroyTrainerPicSprite(sprite->data[3]);
}
}
@ -3125,7 +3125,7 @@ static void SpriteCb_TrainerIconCardScrollDown(struct Sprite *sprite)
{
if (sprite->pos1.y <= -32)
{
sInfoCard->spriteIds[sprite->data[2]] = 0xFF;
sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE;
FreeAndDestroyTrainerPicSprite(sprite->data[3]);
}
}
@ -3145,7 +3145,7 @@ static void SpriteCb_TrainerIconCardScrollLeft(struct Sprite *sprite)
{
if (sprite->pos1.x >= 272)
{
sInfoCard->spriteIds[sprite->data[2]] = 0xFF;
sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE;
FreeAndDestroyTrainerPicSprite(sprite->data[3]);
}
}
@ -3165,7 +3165,7 @@ static void SpriteCb_TrainerIconCardScrollRight(struct Sprite *sprite)
{
if (sprite->pos1.x <= -32)
{
sInfoCard->spriteIds[sprite->data[2]] = 0xFF;
sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE;
FreeAndDestroyTrainerPicSprite(sprite->data[3]);
}
}
@ -3195,7 +3195,7 @@ static void SpriteCb_MonIconCardScrollUp(struct Sprite *sprite)
{
if (sprite->pos1.y >= 176)
{
sInfoCard->spriteIds[sprite->data[2]] = 0xFF;
sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE;
FreeAndDestroyMonIconSprite(sprite);
}
}
@ -3217,7 +3217,7 @@ static void SpriteCb_MonIconCardScrollDown(struct Sprite *sprite)
{
if (sprite->pos1.y <= -16)
{
sInfoCard->spriteIds[sprite->data[2]] = 0xFF;
sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE;
FreeAndDestroyMonIconSprite(sprite);
}
}
@ -3239,7 +3239,7 @@ static void SpriteCb_MonIconCardScrollLeft(struct Sprite *sprite)
{
if (sprite->pos1.x >= 256)
{
sInfoCard->spriteIds[sprite->data[2]] = 0xFF;
sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE;
FreeAndDestroyMonIconSprite(sprite);
}
}
@ -3261,7 +3261,7 @@ static void SpriteCb_MonIconCardScrollRight(struct Sprite *sprite)
{
if (sprite->pos1.x <= -16)
{
sInfoCard->spriteIds[sprite->data[2]] = 0xFF;
sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE;
FreeAndDestroyMonIconSprite(sprite);
}
}
@ -3500,7 +3500,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 2)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollUp;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3511,7 +3511,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollUp;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3524,7 +3524,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 10)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollUp;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3535,7 +3535,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollUp;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3616,7 +3616,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 2)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollDown;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3627,7 +3627,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollDown;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3640,7 +3640,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 10)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollDown;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3651,7 +3651,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollDown;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3699,7 +3699,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 2)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3710,7 +3710,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3723,7 +3723,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 10)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3734,7 +3734,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3782,7 +3782,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 2)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3793,7 +3793,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3806,7 +3806,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 10)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3817,7 +3817,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3863,7 +3863,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 2)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3874,7 +3874,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3887,7 +3887,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 10)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3898,7 +3898,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3946,7 +3946,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 2)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3957,7 +3957,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1;
@ -3970,7 +3970,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 10)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -3981,7 +3981,7 @@ static void Task_HandleInfoCardInput(u8 taskId)
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
{
gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight;
gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot;
@ -4051,12 +4051,12 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 2)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
FreeAndDestroyTrainerPicSprite(sInfoCard->spriteIds[i]);
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
FreeAndDestroyMonIconSprite(&gSprites[sInfoCard->spriteIds[i]]);
}
}
@ -4064,12 +4064,12 @@ static void Task_HandleInfoCardInput(u8 taskId)
{
if (i < 10)
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
FreeAndDestroyTrainerPicSprite(sInfoCard->spriteIds[i]);
}
else
{
if (sInfoCard->spriteIds[i] != 0xFF)
if (sInfoCard->spriteIds[i] != SPRITE_NONE)
FreeAndDestroyMonIconSprite(&gSprites[sInfoCard->spriteIds[i]]);
}
}

View File

@ -1475,13 +1475,13 @@ static void CloseBattlePyramidBagTextWindow(void)
static void sub_81C6E38(u8 itemSpriteArrayId)
{
u8 *spriteId = &gPyramidBagResources->itemsSpriteIds[itemSpriteArrayId];
if (*spriteId != 0xFF)
if (*spriteId != SPRITE_NONE)
{
FreeSpriteTilesByTag(ITEM_IMAGE_TAG + itemSpriteArrayId);
FreeSpritePaletteByTag(ITEM_IMAGE_TAG + itemSpriteArrayId);
FreeSpriteOamMatrix(&gSprites[*spriteId]);
DestroySprite(&gSprites[*spriteId]);
*spriteId = 0xFF;
*spriteId = SPRITE_NONE;
}
}
@ -1526,7 +1526,7 @@ static void ShowItemImage(u16 itemId, u8 itemSpriteArrayId)
{
u8 itemSpriteId;
u8 *spriteId = &gPyramidBagResources->itemsSpriteIds[itemSpriteArrayId + 1];
if (*spriteId == 0xFF)
if (*spriteId == SPRITE_NONE)
{
FreeSpriteTilesByTag(ITEM_IMAGE_TAG + 1 + itemSpriteArrayId);
FreeSpritePaletteByTag(ITEM_IMAGE_TAG + 1 + itemSpriteArrayId);

View File

@ -464,11 +464,11 @@ static void Task_Hof_InitMonData(u8 taskId)
sHofFadePalettes = 0;
gTasks[taskId].tDisplayedMonId = 0;
gTasks[taskId].tPlayerSpriteID = 0xFF;
gTasks[taskId].tPlayerSpriteID = SPRITE_NONE;
for (i = 0; i < PARTY_SIZE; i++)
{
gTasks[taskId].tMonSpriteId(i) = 0xFF;
gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE;
}
if (gTasks[taskId].tDontSaveData)
@ -642,7 +642,7 @@ static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId)
BeginNormalPaletteFade(0xFFFF0000, 0, 0, 0, RGB_BLACK);
for (i = 0; i < PARTY_SIZE; i++)
{
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
if (gTasks[taskId].tMonSpriteId(i) != SPRITE_NONE)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 0;
}
@ -668,7 +668,7 @@ static void Task_Hof_DoConfetti(u8 taskId)
u16 i;
for (i = 0; i < PARTY_SIZE; i++)
{
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
if (gTasks[taskId].tMonSpriteId(i) != SPRITE_NONE)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
}
BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(16, 29, 24));
@ -752,7 +752,7 @@ static void Task_Hof_HandleExit(u8 taskId)
for (i = 0; i < PARTY_SIZE; i++)
{
u8 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
{
FreeOamMatrix(gSprites[spriteId].oam.matrixNum);
FreeAndDestroyMonPicSprite(spriteId);
@ -847,7 +847,7 @@ void CB2_DoHallOfFamePC(void)
for (i = 0; i < PARTY_SIZE; i++)
{
gTasks[taskId].tMonSpriteId(i) = 0xFF;
gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE;
}
sHofMonPtr = AllocZeroed(0x2000);
@ -937,7 +937,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
}
else
{
gTasks[taskId].tMonSpriteId(i) = 0xFF;
gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE;
}
}
@ -967,7 +967,7 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
for (i = 0; i < PARTY_SIZE; i++)
{
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
gSprites[spriteId].oam.priority = 1;
}
@ -999,10 +999,10 @@ static void Task_HofPC_HandleInput(u8 taskId)
for (i = 0; i < PARTY_SIZE; i++)
{
u8 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
{
FreeAndDestroyMonPicSprite(spriteId);
gTasks[taskId].tMonSpriteId(i) = 0xFF;
gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE;
}
}
if (gTasks[taskId].tCurrPageNo != 0)
@ -1060,10 +1060,10 @@ static void Task_HofPC_HandleExit(u8 taskId)
for (i = 0; i < PARTY_SIZE; i++)
{
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
if (spriteId != SPRITE_NONE)
{
FreeAndDestroyMonPicSprite(spriteId);
gTasks[taskId].tMonSpriteId(i) = 0xFF;
gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE;
}
}

View File

@ -410,13 +410,13 @@ static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate =
void RemoveBagSprite(u8 id)
{
u8 *spriteId = &gBagMenu->spriteId[id];
if (*spriteId != 0xFF)
if (*spriteId != SPRITE_NONE)
{
FreeSpriteTilesByTag(id + 100);
FreeSpritePaletteByTag(id + 100);
FreeSpriteOamMatrix(&gSprites[*spriteId]);
DestroySprite(&gSprites[*spriteId]);
*spriteId = 0xFF;
*spriteId = SPRITE_NONE;
}
}
@ -516,7 +516,7 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite)
void AddBagItemIconSprite(u16 itemId, u8 id)
{
u8 *spriteId = &gBagMenu->spriteId[id + 2];
if (*spriteId == 0xFF)
if (*spriteId == SPRITE_NONE)
{
u8 iconSpriteId;

View File

@ -792,7 +792,7 @@ void LoadWirelessStatusIndicatorSpriteGfx(void)
LoadCompressedSpriteSheet(&sWirelessStatusIndicatorSpriteSheet);
}
LoadSpritePalette(&sWirelessStatusIndicatorSpritePalette);
gWirelessStatusIndicatorSpriteId = 0xFF;
gWirelessStatusIndicatorSpriteId = SPRITE_NONE;
}
static u8 GetParentSignalStrength(void)
@ -822,7 +822,7 @@ static void SetWirelessStatusIndicatorAnim(struct Sprite *sprite, s32 animNum)
void UpdateWirelessStatusIndicatorSprite(void)
{
if (gWirelessStatusIndicatorSpriteId != 0xFF && gSprites[gWirelessStatusIndicatorSpriteId].sValidator == STATUS_INDICATOR_ACTIVE)
if (gWirelessStatusIndicatorSpriteId != SPRITE_NONE && gSprites[gWirelessStatusIndicatorSpriteId].sValidator == STATUS_INDICATOR_ACTIVE)
{
struct Sprite *sprite = &gSprites[gWirelessStatusIndicatorSpriteId];
u8 signalStrength = RFU_LINK_ICON_LEVEL4_MAX;

View File

@ -1287,7 +1287,7 @@ static void Task_NewGameBirchSpeech_Init(u8 taskId)
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
gTasks[taskId].tBG1HOFS = 0;
gTasks[taskId].func = Task_NewGameBirchSpeech_WaitToShowBirch;
gTasks[taskId].tPlayerSpriteId = 0xFF;
gTasks[taskId].tPlayerSpriteId = SPRITE_NONE;
gTasks[taskId].data[3] = 0xFF;
gTasks[taskId].tTimer = 0xD8;
PlayBGM(MUS_ROUTE122);

View File

@ -731,10 +731,10 @@ static void InitPartyMenuBoxes(u8 layout)
sPartyMenuBoxes[i].infoRects = &sPartyBoxInfoRects[PARTY_BOX_RIGHT_COLUMN];
sPartyMenuBoxes[i].spriteCoords = sPartyMenuSpriteCoords[layout][i];
sPartyMenuBoxes[i].windowId = i;
sPartyMenuBoxes[i].monSpriteId = 0xFF;
sPartyMenuBoxes[i].itemSpriteId = 0xFF;
sPartyMenuBoxes[i].pokeballSpriteId = 0xFF;
sPartyMenuBoxes[i].statusSpriteId = 0xFF;
sPartyMenuBoxes[i].monSpriteId = SPRITE_NONE;
sPartyMenuBoxes[i].itemSpriteId = SPRITE_NONE;
sPartyMenuBoxes[i].pokeballSpriteId = SPRITE_NONE;
sPartyMenuBoxes[i].statusSpriteId = SPRITE_NONE;
}
// The first party mon goes in the left column
sPartyMenuBoxes[0].infoRects = &sPartyBoxInfoRects[PARTY_BOX_LEFT_COLUMN];

View File

@ -874,7 +874,7 @@ static void sub_816BC14(void)
gUnknown_0203BCC4 = AllocZeroed(sizeof(struct Struct203BCC4));
memset(gUnknown_0203BCC4->windowIds, 0xFF, 0x6);
gUnknown_0203BCC4->unk666 = 0xFF;
gUnknown_0203BCC4->spriteId = 0xFF;
gUnknown_0203BCC4->spriteId = SPRITE_NONE;
}
static void sub_816BC58(void)
@ -1015,7 +1015,7 @@ static void sub_816C060(u16 itemId)
u8 spriteId;
u8* spriteIdLoc = &(gUnknown_0203BCC4->spriteId);
if (*spriteIdLoc == 0xFF)
if (*spriteIdLoc == SPRITE_NONE)
{
FreeSpriteTilesByTag(0x13F6);
FreeSpritePaletteByTag(0x13F6);
@ -1033,12 +1033,12 @@ static void sub_816C060(u16 itemId)
static void sub_816C0C8(void)
{
u8* spriteIdLoc = &(gUnknown_0203BCC4->spriteId);
if (*spriteIdLoc != 0xFF)
if (*spriteIdLoc != SPRITE_NONE)
{
FreeSpriteTilesByTag(0x13F6);
FreeSpritePaletteByTag(0x13F6);
DestroySprite(&(gSprites[*spriteIdLoc]));
*spriteIdLoc = 0xFF;
*spriteIdLoc = SPRITE_NONE;
}
}

View File

@ -1216,7 +1216,7 @@ static bool8 LoadGraphics(void)
break;
case 17:
sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] = LoadMonGfxAndSprite(&sMonSummaryScreen->currentMon, &sMonSummaryScreen->switchCounter);
if (sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] != 0xFF)
if (sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] != SPRITE_NONE)
{
sMonSummaryScreen->switchCounter = 0;
gMain.state++;
@ -1626,7 +1626,7 @@ static void Task_ChangeSummaryMon(u8 taskId)
break;
case 8:
sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] = LoadMonGfxAndSprite(&sMonSummaryScreen->currentMon, &data[1]);
if (sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] == 0xFF)
if (sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] == SPRITE_NONE)
return;
gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].data[2] = 1;
TryDrawExperienceProgressBar();
@ -3692,15 +3692,15 @@ static void ResetSpriteIds(void)
u8 i;
for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->spriteIds); i++)
sMonSummaryScreen->spriteIds[i] = 0xFF;
sMonSummaryScreen->spriteIds[i] = SPRITE_NONE;
}
static void DestroySpriteInArray(u8 spriteArrayId)
{
if (sMonSummaryScreen->spriteIds[spriteArrayId] != 0xFF)
if (sMonSummaryScreen->spriteIds[spriteArrayId] != SPRITE_NONE)
{
DestroySprite(&gSprites[sMonSummaryScreen->spriteIds[spriteArrayId]]);
sMonSummaryScreen->spriteIds[spriteArrayId] = 0xFF;
sMonSummaryScreen->spriteIds[spriteArrayId] = SPRITE_NONE;
}
}
@ -3716,7 +3716,7 @@ static void HidePageSpecificSprites(void)
for (i = SPRITE_ARR_ID_TYPE; i < ARRAY_COUNT(sMonSummaryScreen->spriteIds); i++)
{
if (sMonSummaryScreen->spriteIds[i] != 0xFF)
if (sMonSummaryScreen->spriteIds[i] != SPRITE_NONE)
SetSpriteInvisibility(i, TRUE);
}
}
@ -3745,7 +3745,7 @@ static void CreateMoveTypeIcons(void)
for (i = SPRITE_ARR_ID_TYPE; i < SPRITE_ARR_ID_TYPE + 5; i++)
{
if (sMonSummaryScreen->spriteIds[i] == 0xFF)
if (sMonSummaryScreen->spriteIds[i] == SPRITE_NONE)
sMonSummaryScreen->spriteIds[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 0, 0, 2);
SetSpriteInvisibility(i, TRUE);
@ -4010,7 +4010,7 @@ static void CreateSetStatusSprite(void)
u8 *spriteId = &sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_STATUS];
u8 statusAnim;
if (*spriteId == 0xFF)
if (*spriteId == SPRITE_NONE)
*spriteId = CreateSprite(&sSpriteTemplate_StatusCondition, 64, 152, 0);
statusAnim = GetMonAilment(&sMonSummaryScreen->currentMon);

View File

@ -161,7 +161,7 @@ bool32 OpenPartyConditionMenu(void)
if (structPtr == NULL)
return FALSE;
structPtr->monPicSpriteId = 0xFF;
structPtr->monPicSpriteId = SPRITE_NONE;
structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_OpenPartyConditionGraph, 1);
structPtr->callback = GetPartyConditionLoopedTaskActive;
structPtr->windowModeState = 0;
@ -694,7 +694,7 @@ void CreateMonMarkingsOrPokeballIndicators(void)
}
else
{
structPtr->partyPokeballSpriteIds[i] = 0xFF;
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
}
}
@ -710,7 +710,7 @@ void CreateMonMarkingsOrPokeballIndicators(void)
}
else
{
structPtr->partyPokeballSpriteIds[i] = 0xFF;
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
}
}
@ -725,7 +725,7 @@ void CreateMonMarkingsOrPokeballIndicators(void)
}
else
{
structPtr->partyPokeballSpriteIds[i] = 0xFF;
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
}
}
@ -759,7 +759,7 @@ void sub_81CEBF4(struct Pokenav7Struct *structPtr)
FreeSpritePaletteByTag(0x66);
}
if (structPtr->monPicSpriteId != 0xFF)
if (structPtr->monPicSpriteId != SPRITE_NONE)
{
DestroySprite(&gSprites[structPtr->monPicSpriteId]);
FreeSpriteTilesByTag(0x64);
@ -803,7 +803,7 @@ void CreateConditionMonPic(u8 id)
u8 spriteId;
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
if (structPtr->monPicSpriteId == 0xFF)
if (structPtr->monPicSpriteId == SPRITE_NONE)
{
LoadConditionMonPicTemplate(&sprSheet, &sprTemplate, &sprPal);
sprSheet.data = GetConditionMonPicGfx(id);
@ -816,7 +816,7 @@ void CreateConditionMonPic(u8 id)
{
FreeSpriteTilesByTag(0x64);
FreeSpritePaletteByTag(0x64);
structPtr->monPicSpriteId = 0xFF;
structPtr->monPicSpriteId = SPRITE_NONE;
}
else
{

View File

@ -449,8 +449,8 @@ static void CB2_InitBuyMenu(void)
ClearScheduledBgCopiesToVram();
gShopDataPtr = AllocZeroed(sizeof(struct ShopData));
gShopDataPtr->scrollIndicatorsTaskId = TASK_NONE;
gShopDataPtr->itemSpriteIds[0] = 0xFF;
gShopDataPtr->itemSpriteIds[1] = 0xFF;
gShopDataPtr->itemSpriteIds[0] = SPRITE_NONE;
gShopDataPtr->itemSpriteIds[1] = SPRITE_NONE;
BuyMenuBuildListMenuTemplate();
BuyMenuInitBgs();
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
@ -614,7 +614,7 @@ static void BuyMenuAddItemIcon(u16 item, u8 iconSlot)
{
u8 spriteId;
u8 *spriteIdPtr = &gShopDataPtr->itemSpriteIds[iconSlot];
if (*spriteIdPtr != 0xFF)
if (*spriteIdPtr != SPRITE_NONE)
return;
if (gMartInfo.martType == MART_TYPE_NORMAL || item == 0xFFFF)
@ -638,13 +638,13 @@ static void BuyMenuAddItemIcon(u16 item, u8 iconSlot)
static void BuyMenuRemoveItemIcon(u16 item, u8 iconSlot)
{
u8 *spriteIdPtr = &gShopDataPtr->itemSpriteIds[iconSlot];
if (*spriteIdPtr == 0xFF)
if (*spriteIdPtr == SPRITE_NONE)
return;
FreeSpriteTilesByTag(iconSlot + 2110);
FreeSpritePaletteByTag(iconSlot + 2110);
DestroySprite(&gSprites[*spriteIdPtr]);
*spriteIdPtr = 0xFF;
*spriteIdPtr = SPRITE_NONE;
}
static void BuyMenuInitBgs(void)

View File

@ -486,7 +486,7 @@ static void LoadUsePokeblockMenu(void)
switch (sInfo->mainState)
{
case 0:
sMenu->curMonSpriteId = 0xFF;
sMenu->curMonSpriteId = SPRITE_NONE;
InitConditionGraphData(&sMenu->graph);
sInfo->mainState++;
break;
@ -853,7 +853,7 @@ static void CloseUsePokeblockMenu(void)
for (i = 0; i < ARRAY_COUNT(sMenu->condition); i++)
DestroySprite(sMenu->condition[i]);
if (sMenu->curMonSpriteId != 0xFF)
if (sMenu->curMonSpriteId != SPRITE_NONE)
DestroySprite(&gSprites[sMenu->curMonSpriteId]);
SetVBlankCallback(NULL);
@ -1215,7 +1215,7 @@ static void UpdateMonPic(u8 loadId)
struct SpriteSheet spriteSheet;
struct SpritePalette spritePal;
if (sMenu->curMonSpriteId == 0xFF)
if (sMenu->curMonSpriteId == SPRITE_NONE)
{
LoadConditionMonPicTemplate(&spriteSheet, &spriteTemplate, &spritePal);
spriteSheet.data = sMenu->partySheets[loadId];
@ -1228,7 +1228,7 @@ static void UpdateMonPic(u8 loadId)
{
FreeSpriteTilesByTag(TAG_CONDITION_MON);
FreeSpritePaletteByTag(TAG_CONDITION_MON);
sMenu->curMonSpriteId = 0xFF;
sMenu->curMonSpriteId = SPRITE_NONE;
}
else
{