Fixed some field effect palettes. Removed leftover CacheLightMetatiles.

This commit is contained in:
Ariel A 2022-05-10 22:03:40 -04:00
parent 40d610e29a
commit 28ec60a776
8 changed files with 8 additions and 28 deletions

View file

@ -132,5 +132,7 @@
// Duplicates of event_object_movement tags // Duplicates of event_object_movement tags
#define FLDEFF_PAL_TAG_MAY 0x1110 // OBJ_EVENT_PAL_TAG_MAY #define FLDEFF_PAL_TAG_MAY 0x1110 // OBJ_EVENT_PAL_TAG_MAY
#define FLDEFF_PAL_TAG_BRENDAN 0x1100 // OBJ_EVENT_PAL_TAG_BRENDAN #define FLDEFF_PAL_TAG_BRENDAN 0x1100 // OBJ_EVENT_PAL_TAG_BRENDAN
#define FLDEFF_PAL_TAG_NPC_1 0x1103 // OBJ_EVENT_PAL_TAG_NPC_1
#define FLDEFF_PAL_TAG_NPC_2 0x1104 // OBJ_EVENT_PAL_TAG_NPC_2
#endif // GUARD_FIELD_EFFECT_CONSTANTS_H #endif // GUARD_FIELD_EFFECT_CONSTANTS_H

View file

@ -47,7 +47,6 @@ struct LinkPlayerObjectEvent
// Exported RAM declarations // Exported RAM declarations
extern struct WarpData gLastUsedWarp; extern struct WarpData gLastUsedWarp;
extern struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4]; extern struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4];
extern struct Coords16 gLightMetatiles[32];
extern u16 *gBGTilemapBuffers1; extern u16 *gBGTilemapBuffers1;
extern u16 *gBGTilemapBuffers2; extern u16 *gBGTilemapBuffers2;

View file

@ -948,7 +948,7 @@ static const union AnimCmd *const sAnimTable_Sparkle[] =
const struct SpriteTemplate gFieldEffectObjectTemplate_Sparkle = { const struct SpriteTemplate gFieldEffectObjectTemplate_Sparkle = {
.tileTag = TAG_NONE, .tileTag = TAG_NONE,
.paletteTag = TAG_NONE, .paletteTag = FLDEFF_PAL_TAG_NPC_2,
.oam = &gObjectEventBaseOam_16x16, .oam = &gObjectEventBaseOam_16x16,
.anims = sAnimTable_Sparkle, .anims = sAnimTable_Sparkle,
.images = sPicTable_Sparkle, .images = sPicTable_Sparkle,

View file

@ -511,7 +511,7 @@ static const struct SpritePalette sObjectEventSpritePalettes[] = {
{gObjectEventPal_RubySapphireMay, OBJ_EVENT_PAL_TAG_RS_MAY}, {gObjectEventPal_RubySapphireMay, OBJ_EVENT_PAL_TAG_RS_MAY},
{gObjectEventPal_Npc1, OBJ_EVENT_PAL_TAG_DYNAMIC}, {gObjectEventPal_Npc1, OBJ_EVENT_PAL_TAG_DYNAMIC},
{gObjectEventPaletteEmotes, OBJ_EVENT_PAL_TAG_EMOTES}, {gObjectEventPaletteEmotes, OBJ_EVENT_PAL_TAG_EMOTES},
{NULL, 0x0000}, {NULL, OBJ_EVENT_PAL_TAG_NONE},
}; };
static const u16 sReflectionPaletteTags_Brendan[] = { static const u16 sReflectionPaletteTags_Brendan[] = {

View file

@ -1438,7 +1438,7 @@ u32 FldEff_BerryTreeGrowthSparkle(void)
sprite = &gSprites[spriteId]; sprite = &gSprites[spriteId];
sprite->coordOffsetEnabled = TRUE; sprite->coordOffsetEnabled = TRUE;
sprite->oam.priority = gFieldEffectArguments[3]; sprite->oam.priority = gFieldEffectArguments[3];
sprite->oam.paletteNum = 5; // TODO: What paletteTag does this use? UpdateSpritePaletteByTemplate(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SPARKLE], sprite);
sprite->data[0] = FLDEFF_BERRY_TREE_GROWTH_SPARKLE; sprite->data[0] = FLDEFF_BERRY_TREE_GROWTH_SPARKLE;
} }
return 0; return 0;

View file

@ -1024,7 +1024,7 @@ void DoSecretBaseGlitterMatSparkle(void)
{ {
gSprites[spriteId].coordOffsetEnabled = TRUE; gSprites[spriteId].coordOffsetEnabled = TRUE;
gSprites[spriteId].oam.priority = 1; gSprites[spriteId].oam.priority = 1;
gSprites[spriteId].oam.paletteNum = 5; // TODO: What palette should this use? UpdateSpritePaletteByTemplate(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SPARKLE], &gSprites[spriteId]);
gSprites[spriteId].callback = SpriteCB_GlitterMatSparkle; gSprites[spriteId].callback = SpriteCB_GlitterMatSparkle;
gSprites[spriteId].data[0] = 0; gSprites[spriteId].data[0] = 0;
} }

View file

@ -207,7 +207,6 @@ EWRAM_DATA static struct InitialPlayerAvatarState sInitialPlayerAvatarState = {0
EWRAM_DATA static u16 sAmbientCrySpecies = 0; EWRAM_DATA static u16 sAmbientCrySpecies = 0;
EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE; EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE;
EWRAM_DATA struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4] = {0}; EWRAM_DATA struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4] = {0};
EWRAM_DATA struct Coords16 gLightMetatiles[32] = {0};
static const struct WarpData sDummyWarpData = static const struct WarpData sDummyWarpData =
@ -596,23 +595,6 @@ struct MapHeader const *const GetDestinationWarpMapHeader(void)
return Overworld_GetMapHeaderByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum); return Overworld_GetMapHeaderByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
} }
// Caches light metatile coordinates
static void CacheLightMetatiles(void) { // TODO: Better way to dynamically generate lights
u8 i = 0;
s16 x, y;
for (x = 0; x < gBackupMapLayout.width; x++) {
for (y = 0; y < gBackupMapLayout.height; y++) {
if (MapGridGetMetatileBehaviorAt(x, y) == 0x04) {
gLightMetatiles[i].x = x;
gLightMetatiles[i].y = y;
i++;
}
}
}
gLightMetatiles[i].x = -1;
gLightMetatiles[i].y = -1;
}
static void LoadCurrentMapData(void) static void LoadCurrentMapData(void)
{ {
sLastMapSectionId = gMapHeader.regionMapSectionId; sLastMapSectionId = gMapHeader.regionMapSectionId;
@ -833,7 +815,6 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
Overworld_ClearSavedMusic(); Overworld_ClearSavedMusic();
RunOnTransitionMapScript(); RunOnTransitionMapScript();
InitMap(); InitMap();
CacheLightMetatiles();
CopySecondaryTilesetToVramUsingHeap(gMapHeader.mapLayout); CopySecondaryTilesetToVramUsingHeap(gMapHeader.mapLayout);
LoadSecondaryTilesetPalette(gMapHeader.mapLayout); LoadSecondaryTilesetPalette(gMapHeader.mapLayout);
@ -1766,7 +1747,6 @@ void CB2_ContinueSavedGame(void)
} }
else else
{ {
CacheLightMetatiles();
TryPutTodaysRivalTrainerOnAir(); TryPutTodaysRivalTrainerOnAir();
gFieldCallback = FieldCB_FadeTryShowMapPopup; gFieldCallback = FieldCB_FadeTryShowMapPopup;
SetMainCallback1(CB1_Overworld); SetMainCallback1(CB1_Overworld);
@ -1926,7 +1906,6 @@ static bool32 LoadMapInStepsLocal(u8 *state, bool32 a2)
(*state)++; (*state)++;
break; break;
case 3: case 3:
CacheLightMetatiles();
InitObjectEventsLocal(); InitObjectEventsLocal();
SetCameraToTrackPlayer(); SetCameraToTrackPlayer();
(*state)++; (*state)++;

View file

@ -303,7 +303,7 @@ static const struct SpriteTemplate sSpriteTemplate_ExclamationQuestionMark =
static const struct SpriteTemplate sSpriteTemplate_HeartIcon = static const struct SpriteTemplate sSpriteTemplate_HeartIcon =
{ {
.tileTag = TAG_NONE, .tileTag = TAG_NONE,
.paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .paletteTag = FLDEFF_PAL_TAG_NPC_1,
.oam = &sOamData_Icons, .oam = &sOamData_Icons,
.anims = sSpriteAnimTable_Icons, .anims = sSpriteAnimTable_Icons,
.images = sSpriteImageTable_HeartIcon, .images = sSpriteImageTable_HeartIcon,
@ -870,7 +870,7 @@ u8 FldEff_HeartIcon(void)
struct Sprite *sprite = &gSprites[spriteId]; struct Sprite *sprite = &gSprites[spriteId];
SetIconSpriteData(sprite, FLDEFF_HEART_ICON, 0); SetIconSpriteData(sprite, FLDEFF_HEART_ICON, 0);
sprite->oam.paletteNum = 2; // TODO: What palette should this use? UpdateSpritePaletteByTemplate(&sSpriteTemplate_HeartIcon, sprite);
} }
return 0; return 0;