Merge branch 'lighting' into lighting-expanded-id

This commit is contained in:
Ariel A 2023-03-13 18:22:53 -04:00
commit 582761f56a
11 changed files with 50 additions and 24 deletions

View File

@ -476,6 +476,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_SetUpObjects::
call BattleFrontier_EventScript_SetBrainObjectGfx
setobjectxyperm LOCALID_OPPONENT, 13, 9
removeobject LOCALID_OPPONENT
delay 1
addobject LOCALID_OPPONENT
applymovement LOCALID_OPPONENT, BattleFrontier_BattleDomeBattleRoom_Movement_SetInvisibleFacingUp
BattleFrontier_BattleDomeBattleRoom_EventScript_EndSetUpObjects::

View File

@ -48,6 +48,7 @@ SlateportCity_BattleTentBattleRoom_EventScript_EnterRoom::
factory_setopponentgfx
setobjectxyperm LOCALID_OPPONENT, 5, 1
removeobject LOCALID_OPPONENT
delay 1
addobject LOCALID_OPPONENT
applymovement LOCALID_OPPONENT, SlateportCity_BattleTentBattleRoom_Movement_OpponentEnter
waitmovement 0
@ -102,4 +103,3 @@ SlateportCity_BattleTentBattleRoom_Movement_OpponentEnter:
walk_down
walk_in_place_faster_left
step_end

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
24 41 82
255 255 255
222 230 238
189 205 230
156 180 222
0 197 0
246 197 123
238 156 90
205 115 41
164 90 49
131 131 139
98 98 123
65 74 106
41 49 90
115 189 246
98 172 238
255 189 131
238 148 115
222 106 98
205 65 82
115 197 164
224 226 171
216 200 152
255 255 238
222 222 197
197 197 164
164 172 123
255 255 115

View File

@ -1,7 +1,7 @@
JASC-PAL
0100
16
24 41 82
0 197 0
246 197 123
238 156 90
205 115 41

View File

@ -1,7 +1,7 @@
JASC-PAL
0100
16
115 197 164
0 230 25
139 115 106
115 90 82
90 65 65
@ -16,4 +16,4 @@ JASC-PAL
148 74 41
82 139 197
74 115 172
0 0 0
246 74 65

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(u16 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation);

View File

@ -154,6 +154,8 @@ const struct Tileset gTileset_EverGrande =
.metatiles = gMetatiles_EverGrande,
.metatileAttributes = gMetatileAttributes_EverGrande,
.callback = InitTilesetAnim_EverGrande,
.lightPalettes = LIGHT_PAL(8),
.swapPalettes = SWAP_PAL(8),
};
const struct Tileset gTileset_Pacifidlog =
@ -174,8 +176,8 @@ const struct Tileset gTileset_Sootopolis =
.isCompressed = TRUE,
.swapPalettes = SWAP_PAL(6),
.isSecondary = TRUE,
.lightPalettes = LIGHT_PAL(6),
.customLightColor = LIGHT_PAL(6),
.lightPalettes = LIGHT_PAL(6) | LIGHT_PAL(10),
.customLightColor = LIGHT_PAL(6) | LIGHT_PAL(10),
.tiles = gTilesetTiles_Sootopolis,
.palettes = gTilesetPalettes_Sootopolis,
.metatiles = gMetatiles_Sootopolis,

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

@ -1632,8 +1632,20 @@ static u8 LoadDynamicFollowerPaletteFromGraphicsId(u16 graphicsId, bool8 shiny,
return paletteNum;
}
// 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;
@ -1649,8 +1661,14 @@ u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *),
// Use shininess info from follower object
// in future this should be passed in
paletteNum = LoadDynamicFollowerPaletteFromGraphicsId(graphicsId, obj ? obj->shiny : FALSE, spriteTemplate);
} 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);
@ -1664,6 +1682,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

@ -483,7 +483,7 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex)
palOffset = startPalIndex * 16;
UpdateAltBgPalettes(palettes & PALETTES_BG);
// Thunder gamma-shift looks bad on night-blended palettes, so ignore time blending in some situations
if (!(colorMapIndex > 3 && gWeatherPtr->currWeather == WEATHER_RAIN_THUNDERSTORM) && MapHasNaturalLight(gMapHeader.mapType))
if (!(colorMapIndex > 3) && MapHasNaturalLight(gMapHeader.mapType))
UpdatePalettesWithTime(palettes);
else
CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 32 * numPalettes);

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