rename coords to size in struct MonCoords

This commit is contained in:
Philipp AUER 2019-01-04 18:17:55 +01:00 committed by huderlem
parent cba2f81bf8
commit 55202eac24
16 changed files with 1012 additions and 1012 deletions

View File

@ -5,7 +5,7 @@ struct MonCoords
{
// This would use a bitfield, but some function
// uses it as a u8 and casting won't match.
u8 coords; // u8 x:4, y:4;
u8 size; // u8 width:4, height:4;
u8 y_offset;
};

View File

@ -72,10 +72,10 @@ static const struct UCoords8 sBattlerCoords[][4] =
// One entry for each of the four Castform forms.
const struct MonCoords gCastformFrontSpriteCoords[] =
{
{ 0x44, 17 }, // NORMAL
{ 0x66, 9 }, // SUN
{ 0x46, 9 }, // RAIN
{ 0x86, 8 }, // HAIL
{ .size = 0x44, .y_offset = 17 }, // NORMAL
{ .size = 0x66, .y_offset = 9 }, // SUN
{ .size = 0x46, .y_offset = 9 }, // RAIN
{ .size = 0x86, .y_offset = 8 }, // HAIL
};
static const u8 sCastformElevations[] =
@ -2216,17 +2216,17 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr)
switch (attr)
{
case BATTLER_COORD_ATTR_HEIGHT:
return (coords->coords & 0xf) * 8;
return (coords->size & 0xf) * 8;
case BATTLER_COORD_ATTR_WIDTH:
return (coords->coords >> 4) * 8;
return (coords->size >> 4) * 8;
case BATTLER_COORD_ATTR_LEFT:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - ((coords->coords >> 4) * 4);
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - ((coords->size >> 4) * 4);
case BATTLER_COORD_ATTR_RIGHT:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + ((coords->coords >> 4) * 4);
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + ((coords->size >> 4) * 4);
case BATTLER_COORD_ATTR_TOP:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - ((coords->coords & 0xf) * 4);
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - ((coords->size & 0xf) * 4);
case BATTLER_COORD_ATTR_BOTTOM:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + ((coords->coords & 0xf) * 4);
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + ((coords->size & 0xf) * 4);
case BATTLER_COORD_ATTR_RAW_BOTTOM:
ret = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 31;
return ret - coords->y_offset;

View File

@ -1301,7 +1301,7 @@ static void LinkOpponentHandleDrawTrainerPic(void)
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
(8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40,
GetBattlerSpriteSubpriority(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240;
@ -1324,7 +1324,7 @@ static void LinkOpponentHandleTrainerSlide(void)
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, 0x1E);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32;

View File

@ -1143,7 +1143,7 @@ static void LinkPartnerHandleDrawTrainerPic(void)
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, GetBattlerSpriteSubpriority(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, GetBattlerSpriteSubpriority(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;

View File

@ -1292,7 +1292,7 @@ static void OpponentHandleDrawTrainerPic(void)
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
(8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40,
GetBattlerSpriteSubpriority(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240;
@ -1362,7 +1362,7 @@ static void OpponentHandleTrainerSlide(void)
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, 0x1E);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32;

View File

@ -2291,18 +2291,18 @@ static void PlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
{
xPos = 90;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80;
}
else
{
yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
}
else
{
xPos = 80;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
// Use front pic table for any tag battles unless your partner is Steven.
@ -2365,7 +2365,7 @@ static void PlayerHandleTrainerSlide(void)
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30);
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 80, (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, 30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96;

View File

@ -1308,13 +1308,13 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
{
trainerPicId = TRAINER_BACK_PIC_STEVEN;
xPos = 90;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
else
{
trainerPicId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId);
xPos = 32;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80;
}
// Use back pic only if the partner is Steven

View File

@ -1248,7 +1248,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
(8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40,
GetBattlerSpriteSubpriority(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240;

View File

@ -1217,18 +1217,18 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{
xPos = 90;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80;
}
else
{
yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
}
else
{
xPos = 80;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)

View File

@ -359,7 +359,7 @@ static void SafariHandleDrawTrainerPic(void)
gBattlerSpriteIds[gActiveBattler] = CreateSprite(
&gMultiuseSpriteTemplate,
80,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].size) * 4 + 80,
30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;

View File

@ -1036,7 +1036,7 @@ static void WallyHandleDrawTrainerPic(void)
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
80,
80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords),
80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size),
30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1051,7 +1051,7 @@ static void WallyHandleTrainerSlide(void)
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
80,
80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords),
80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size),
30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
const struct MonCoords gTrainerBackPicCoords[] =
{
{8, 4},
{8, 4},
{8, 5},
{8, 5},
{8, 4},
{8, 4},
{8, 4},
{8, 4},
{.size = 8, .y_offset = 4},
{.size = 8, .y_offset = 4},
{.size = 8, .y_offset = 5},
{.size = 8, .y_offset = 5},
{.size = 8, .y_offset = 4},
{.size = 8, .y_offset = 4},
{.size = 8, .y_offset = 4},
{.size = 8, .y_offset = 4},
};
// this table goes functionally unused, since none of these pics are compressed

View File

@ -1,98 +1,98 @@
const struct MonCoords gTrainerFrontPicCoords[] =
{
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 2},
{8, 2},
{8, 1},
{8, 1},
{8, 2},
{8, 1},
{8, 2},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 2},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 2},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{8, 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 2},
{.size = 8, .y_offset = 2},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 2},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 2},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 2},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 2},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
{.size = 8, .y_offset = 1},
};
const struct CompressedSpriteSheet gTrainerFrontPicTable[] =

View File

@ -240,7 +240,7 @@ static void CreateBattlerSprite(u8 battler)
{
SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].size) * 4 + 80,
GetBattlerSpriteSubpriority(0));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
@ -250,7 +250,7 @@ static void CreateBattlerSprite(u8 battler)
{
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(0));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50,
(8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords) * 4 + 80,
(8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size) * 4 + 80,
GetBattlerSpriteSubpriority(0));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;