Use front sprite palettes for event objects.

This commit is contained in:
Ariel Antonitis 2020-06-17 23:13:18 -04:00
parent e9711b7cd5
commit 4bd6642033
8 changed files with 28 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -6,13 +6,13 @@ JASC-PAL
205 205 205
172 172 189
131 131 148
90 90 115
160 176 216
16 16 16
255 0 255
255 0 255
255 0 255
96 168 224
232 232 248
40 48 88
139 0 0
222 115 115
216 80 88
180 0 0
106 131 222
0 41 197

View file

@ -241,7 +241,7 @@
#define OBJ_EVENT_GFX_LUGIA 237
#define OBJ_EVENT_GFX_HOOH 238
#define OBJ_EVENT_GFX_ANIMATED_BALL 239
#define OBJ_EVENT_GFX_FOLLOWER 240
#define OBJ_EVENT_GFX_OW_MON 240
#define NUM_OBJ_EVENT_GFX 241

View file

@ -243,9 +243,9 @@ const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_RubySapphireBrenda
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_RubySapphireMay = {0xFFFF, OBJ_EVENT_PAL_TAG_RS_MAY, OBJ_EVENT_PAL_TAG_NONE, 256, 16, 32, 10, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_16x32, gObjectEventSpriteOamTables_16x32, gObjectEventImageAnimTable_Standard, gObjectEventPicTable_RubySapphireMay, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Lugia = {0xFFFF, OBJ_EVENT_PAL_TAG_LUGIA, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 10, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Standard, gObjectEventPicTable_Lugia, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_HoOh = {0xFFFF, OBJ_EVENT_PAL_TAG_HO_OH, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 10, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_HoOh, gObjectEventPicTable_HoOh, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_AnimatedBall = {0xFFFF, OBJ_EVENT_PAL_TAG_NPC_2, OBJ_EVENT_PAL_TAG_NONE, 256, 16, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_16x32, gObjectEventSpriteOamTables_16x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_AnimatedBall, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Marshtomp = {0xFFFF, OBJ_EVENT_PAL_TAG_MARSHTOMP, OBJ_EVENT_PAL_TAG_NONE, 256, 16, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_16x32, gObjectEventSpriteOamTables_16x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Marshtomp, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_AnimatedBall = {0xFFFF, OBJ_EVENT_PAL_TAG_3, OBJ_EVENT_PAL_TAG_NONE, 256, 16, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_16x32, gObjectEventSpriteOamTables_16x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_AnimatedBall, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Marshtomp = {0xFFFF, OBJ_EVENT_PAL_TAG_DYNAMIC, OBJ_EVENT_PAL_TAG_NONE, 256, 16, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_16x32, gObjectEventSpriteOamTables_16x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Marshtomp, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Altaria = {0xFFFF, OBJ_EVENT_PAL_TAG_ALTARIA, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Standard, gObjectEventPicTable_Altaria, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Togetic = {0xFFFF, OBJ_EVENT_PAL_TAG_TOGETIC, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_NONE, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Togetic, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Togetic = {0xFFFF, OBJ_EVENT_PAL_TAG_DYNAMIC, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_NONE, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Togetic, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Charizard = {0xFFFF, OBJ_EVENT_PAL_TAG_CHARIZARD, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Charizard, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Follower = {0xFFFF, OBJ_EVENT_PAL_TAG_CHARIZARD, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Togetic, gDummySpriteAffineAnimTable};

View file

@ -495,7 +495,7 @@ const struct ObjectEventGraphicsInfo *const gObjectEventGraphicsInfoPointers[NUM
[OBJ_EVENT_GFX_LUGIA] = &gObjectEventGraphicsInfo_Lugia,
[OBJ_EVENT_GFX_HOOH] = &gObjectEventGraphicsInfo_HoOh,
[OBJ_EVENT_GFX_ANIMATED_BALL] = &gObjectEventGraphicsInfo_AnimatedBall,
[OBJ_EVENT_GFX_FOLLOWER] = &gObjectEventGraphicsInfo_Follower,
[OBJ_EVENT_GFX_OW_MON] = &gObjectEventGraphicsInfo_Follower,
};
const struct ObjectEventGraphicsInfo *const gMauvilleOldManGraphicsInfoPointers[] = {

View file

@ -3,6 +3,7 @@
#include "battle_pyramid.h"
#include "berry.h"
#include "decoration.h"
#include "decompress.h"
#include "event_data.h"
#include "event_object_movement.h"
#include "event_scripts.h"
@ -17,6 +18,7 @@
#include "metatile_behavior.h"
#include "overworld.h"
#include "palette.h"
#include "data.h"
#include "pokemon.h"
#include "random.h"
#include "script.h"
@ -450,6 +452,7 @@ const u8 gInitialMovementTypeFacingDirections[] = {
#define OBJ_EVENT_PAL_TAG_TOGETIC 0x1126
#define OBJ_EVENT_PAL_TAG_CHARIZARD 0x1127
#define OBJ_EVENT_PAL_TAG_NONE 0x11FF
#define OBJ_EVENT_PAL_TAG_DYNAMIC 0x1124
#include "data/object_events/object_event_graphics_info_pointers.h"
#include "data/field_effects/field_effect_object_template_pointers.h"
@ -1599,7 +1602,7 @@ u8 SpawnFollowingPokemon(void) { // Spawn a following pokemon TODO: Avoid this o
template.localId = OBJ_EVENT_ID_FOLLOWER;
if (GetFirstLiveMon() == NULL) // fainted party, don't spawn a follower
return 0xFF;
template.graphicsId = OBJ_EVENT_GFX_FOLLOWER;
template.graphicsId = OBJ_EVENT_GFX_OW_MON;
template.x = gSaveBlock1Ptr->pos.x;
template.y = gSaveBlock1Ptr->pos.y;
template.elevation = 3;
@ -1641,11 +1644,22 @@ static const struct ObjectEventGraphicsInfo * SpeciesToGraphicsInfo(u16 species)
}
}
// Set graphics & sprite for a follower object event by species TODO: Refactoring
// Set graphics & sprite for a follower object event by species
static void FollowerSetGraphics(struct ObjectEvent *objectEvent, u16 species) {
objectEvent->graphicsId = OBJ_EVENT_GFX_FOLLOWER;
const struct ObjectEventGraphicsInfo *graphicsInfo = SpeciesToGraphicsInfo(species);
objectEvent->graphicsId = OBJ_EVENT_GFX_OW_MON;
ObjectEventSetGraphics(objectEvent, SpeciesToGraphicsInfo(species));
objectEvent->graphicsId = OBJ_EVENT_GFX_FOLLOWER;
objectEvent->graphicsId = OBJ_EVENT_GFX_OW_MON;
if (graphicsInfo->paletteTag1 == OBJ_EVENT_PAL_TAG_DYNAMIC) { // Use palette from species palette table
struct Sprite *sprite = &gSprites[objectEvent->spriteId];
const struct CompressedSpritePalette *spritePalette = &gMonPaletteTable[species];
// Free palette if otherwise unused
sprite->inUse = FALSE;
FieldEffectFreePaletteIfUnused(sprite->oam.paletteNum);
sprite->inUse = TRUE;
LoadCompressedSpritePalette(spritePalette);
sprite->oam.paletteNum = IndexOfSpritePaletteTag(spritePalette->tag); // Tag is always present
}
}
void UpdateFollowingPokemon(void) { // Update following pokemon if any