refactor: code review for expansion

This commit is contained in:
Ariel A 2024-05-17 21:37:18 -04:00
parent d3849f2fc6
commit d785fad8cf
3 changed files with 7 additions and 12 deletions

View file

@ -223,9 +223,9 @@ struct Sprite
// is (offset + 1) << sheetSpan;
// (This allows using frame-based anim tables for sheet sprites)
u16 sheetSpan:3;
// u16 flags_4:1; //0x10
// u16 flags_5:1; //0x20
// u16 flags_6:1; //0x40
// u16 flags_4:1; //0x10
// u16 flags_5:1; //0x20
// u16 flags_6:1; //0x40
u16 flags_7:1; //0x80
/*0x3F*/ u16 hFlip:1; //1
u16 vFlip:1; //2

View file

@ -195,6 +195,7 @@ struct ObjectEvent
u32 fixedPriority:1;
u32 hideReflection:1;
u32 shiny:1; // OW mon shininess
u32 padding:3;
/*0x04*/ u16 graphicsId; // 11 bits for species; high 5 bits for form
/*0x06*/ u8 movementType;
/*0x07*/ u8 trainerType;

View file

@ -1671,10 +1671,8 @@ static u8 TrySetupObjectEventSprite(const struct ObjectEventTemplate *objectEven
if (spriteTemplate->paletteTag == OBJ_EVENT_PAL_TAG_DYNAMIC) {
sprite->oam.paletteNum = LoadDynamicFollowerPalette(OW_SPECIES(objectEvent), OW_FORM(objectEvent), objectEvent->shiny);
}
#if OW_GFX_COMPRESS
if (sprite->usingSheet)
if (OW_GFX_COMPRESS && sprite->usingSheet)
sprite->sheetSpan = GetSpanPerImage(sprite->oam.shape, sprite->oam.size);
#endif
GetMapCoordsFromSpritePos(objectEvent->currentCoords.x + cameraX, objectEvent->currentCoords.y + cameraY, &sprite->x, &sprite->y);
sprite->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);
@ -1848,10 +1846,8 @@ u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *),
if (spriteId != MAX_SPRITES && subspriteTables != NULL)
{
sprite = &gSprites[spriteId];
#if OW_GFX_COMPRESS
if (graphicsInfo->compressed)
if (OW_GFX_COMPRESS && graphicsInfo->compressed)
sprite->sheetSpan = GetSpanPerImage(sprite->oam.shape, sprite->oam.size);
#endif
SetSubspriteTables(sprite, subspriteTables);
sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY;
}
@ -2555,10 +2551,8 @@ static void SpawnObjectEventOnReturnToField(u8 objectEventId, s16 x, s16 y)
// Use palette from species palette table
if (spriteTemplate.paletteTag == OBJ_EVENT_PAL_TAG_DYNAMIC)
sprite->oam.paletteNum = LoadDynamicFollowerPalette(OW_SPECIES(objectEvent), OW_FORM(objectEvent), objectEvent->shiny);
#if OW_GFX_COMPRESS
if (sprite->usingSheet)
if (OW_GFX_COMPRESS && sprite->usingSheet)
sprite->sheetSpan = GetSpanPerImage(sprite->oam.shape, sprite->oam.size);
#endif
GetMapCoordsFromSpritePos(x + objectEvent->currentCoords.x, y + objectEvent->currentCoords.y, &sprite->x, &sprite->y);
sprite->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);