Fixed some decoration icons being darkened at night in outdoor shops.

This commit is contained in:
Ariel A 2023-03-07 20:39:41 -05:00
parent f83970f2fc
commit 07995f8925
4 changed files with 28 additions and 5 deletions

View File

@ -131,6 +131,7 @@ struct ObjectEvent * GetFollowerObject(void);
u8 GetDirectionToFace(s16, s16, s16, s16);
void UpdateLightSprite(struct Sprite *);
void TrySpawnObjectEvents(s16 cameraX, s16 cameraY);
u8 CreateObjectGraphicsSpriteWithTag(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u16 paletteTag);
u8 CreateObjectGraphicsSprite(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority);
u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup);
u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation);

View File

@ -2110,7 +2110,7 @@ static u8 AddDecorationIconObjectFromObjectEvent(u16 tilesTag, u16 paletteTag, u
}
else
{
spriteId = CreateObjectGraphicsSprite(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1);
spriteId = CreateObjectGraphicsSpriteWithTag(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1, paletteTag);
}
return spriteId;
}

View File

@ -1607,8 +1607,20 @@ static void MakeSpriteTemplateFromObjectEventTemplate(struct ObjectEventTemplate
CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(objectEventTemplate->graphicsId, objectEventTemplate->movementType, spriteTemplate, subspriteTables);
}
// Like LoadObjectEventPalette, but overwrites the palette tag that is loaded
static u8 LoadObjectEventPaletteWithTag(u16 paletteTag, u16 overTag) {
u32 i = FindObjectEventPaletteIndexByTag(paletteTag);
struct SpritePalette spritePalette;
if (i == 0xFF)
return i;
spritePalette = sObjectEventSpritePalettes[i];
if (overTag != TAG_NONE)
spritePalette.tag = overTag; // overwrite palette tag
return LoadSpritePaletteIfTagExists(&spritePalette);
}
// Used to create a sprite using a graphicsId associated with object events.
u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority)
u8 CreateObjectGraphicsSpriteWithTag(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u16 paletteTag)
{
struct SpriteTemplate *spriteTemplate;
const struct SubspriteTable *subspriteTables;
@ -1637,8 +1649,14 @@ u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *),
const struct CompressedSpritePalette *spritePalette = &(shiny ? gMonShinyPaletteTable : gMonPaletteTable)[species];
paletteNum = LoadDynamicFollowerPalette(species, form, shiny);
spriteTemplate->paletteTag = spritePalette->tag;
} else if (spriteTemplate->paletteTag != TAG_NONE)
LoadObjectEventPalette(spriteTemplate->paletteTag);
} else if (spriteTemplate->paletteTag != TAG_NONE) {
if (paletteTag == TAG_NONE)
LoadObjectEventPalette(spriteTemplate->paletteTag);
else {
LoadObjectEventPaletteWithTag(spriteTemplate->paletteTag, paletteTag);
spriteTemplate->paletteTag = paletteTag;
}
}
spriteId = CreateSprite(spriteTemplate, x, y, subpriority);
Free(spriteTemplate);
@ -1652,6 +1670,10 @@ u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *),
return spriteId;
}
u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority) {
return CreateObjectGraphicsSpriteWithTag(graphicsId, callback, x, y, subpriority, TAG_NONE);
}
#define sVirtualObjId data[0]
#define sVirtualObjElev data[1]

View File

@ -41,7 +41,7 @@
#include "constants/songs.h"
#define TAG_SCROLL_ARROW 2100
#define TAG_ITEM_ICON_BASE 2110
#define TAG_ITEM_ICON_BASE 9110 // immune to time blending
#define MAX_ITEMS_SHOWN 8