Changed fog to be compatible with transparent shadows.

This commit is contained in:
Ariel Antonitis 2021-04-24 17:23:35 -04:00
parent 65e616342b
commit 7b59eabbcf
7 changed files with 24 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -10,7 +10,7 @@ JASC-PAL
213 213 213
222 222 222
164 164 164
255 0 255
0 0 0
255 0 255
255 0 255
180 180 180

View File

@ -32,13 +32,13 @@ const struct SpriteFrameImage gFieldEffectObjectPicTable_BallLight[] = {
obj_frame_tiles(gFieldEffectObjectPic_BallLight),
};
const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowSmall = {0xFFFF, OBJ_EVENT_PAL_TAG_MAY, &gObjectEventBaseOam_8x8, sAnimTable_Shadow, sPicTable_ShadowSmall, gDummySpriteAffineAnimTable, UpdateShadowFieldEffect};
const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowSmall = {0xFFFF, TAG_WEATHER_START, &gObjectEventBaseOam_8x8, sAnimTable_Shadow, sPicTable_ShadowSmall, gDummySpriteAffineAnimTable, UpdateShadowFieldEffect};
const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowMedium = {0xFFFF, OBJ_EVENT_PAL_TAG_MAY, &gObjectEventBaseOam_16x8, sAnimTable_Shadow, sPicTable_ShadowMedium, gDummySpriteAffineAnimTable, UpdateShadowFieldEffect};
const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowMedium = {0xFFFF, TAG_WEATHER_START, &gObjectEventBaseOam_16x8, sAnimTable_Shadow, sPicTable_ShadowMedium, gDummySpriteAffineAnimTable, UpdateShadowFieldEffect};
const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowLarge = {0xFFFF, OBJ_EVENT_PAL_TAG_MAY, &gObjectEventBaseOam_32x8, sAnimTable_Shadow, sPicTable_ShadowLarge, gDummySpriteAffineAnimTable, UpdateShadowFieldEffect};
const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowLarge = {0xFFFF, TAG_WEATHER_START, &gObjectEventBaseOam_32x8, sAnimTable_Shadow, sPicTable_ShadowLarge, gDummySpriteAffineAnimTable, UpdateShadowFieldEffect};
const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowExtraLarge = {0xFFFF, OBJ_EVENT_PAL_TAG_MAY, &gObjectEventBaseOam_64x32, sAnimTable_Shadow, sPicTable_ShadowExtraLarge, gDummySpriteAffineAnimTable, UpdateShadowFieldEffect};
const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowExtraLarge = {0xFFFF, TAG_WEATHER_START, &gObjectEventBaseOam_64x32, sAnimTable_Shadow, sPicTable_ShadowExtraLarge, gDummySpriteAffineAnimTable, UpdateShadowFieldEffect};
const struct SpriteTemplate gFieldEffectObjectTemplate_BallLight = {0xFFFF, OBJ_EVENT_PAL_TAG_LIGHT, &gObjectEventBaseOam_32x32, sAnimTable_Inanimate, gFieldEffectObjectPicTable_BallLight, gDummySpriteAffineAnimTable, UpdateLightSprite};

View File

@ -7,11 +7,13 @@
#include "script.h"
#include "constants/weather.h"
#include "constants/songs.h"
#include "constants/rgb.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
#include "trig.h"
#include "gpu_regs.h"
#include "palette.h"
// EWRAM
EWRAM_DATA static u8 gCurrentAbnormalWeather = 0;
@ -1372,6 +1374,9 @@ void FogHorizontal_Main(void);
static void CreateFogHorizontalSprites(void);
static void DestroyFogHorizontalSprites(void);
// Within the weather palette, shadow sprites' color index
#define SHADOW_COLOR_INDEX 9
void FogHorizontal_InitVars(void)
{
gWeatherPtr->initStep = 0;
@ -1385,7 +1390,7 @@ void FogHorizontal_InitVars(void)
gWeatherPtr->fogHScrollPosX = 0;
Weather_SetBlendCoeffs(0, 16);
}
gWeatherPtr->noShadows = TRUE; // TODO: Can fog be made compatible with shadows?
gWeatherPtr->noShadows = FALSE;
}
void FogHorizontal_InitAll(void)
@ -1407,9 +1412,14 @@ void FogHorizontal_Main(void)
{
case 0:
CreateFogHorizontalSprites();
if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL)
Weather_SetTargetBlendCoeffs(12, 8, 3);
else
if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL) {
u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START);
Weather_SetTargetBlendCoeffs(12, 8, 3);
if (paletteNum != 0xFF) { // Lighten shadow color to match
u16 index = (paletteNum+16)*16+SHADOW_COLOR_INDEX; // Shadow color index
gPlttBufferUnfaded[index] = gPlttBufferFaded[index] = 0x3DEF; // Gray
}
} else
Weather_SetTargetBlendCoeffs(4, 16, 0);
gWeatherPtr->initStep++;
break;
@ -1425,6 +1435,7 @@ void FogHorizontal_Main(void)
bool8 FogHorizontal_Finish(void)
{
u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START);
gWeatherPtr->fogHScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fogHScrollOffset) & 0xFF;
if (++gWeatherPtr->fogHScrollCounter > 3)
{
@ -1447,6 +1458,10 @@ bool8 FogHorizontal_Finish(void)
gWeatherPtr->finishStep++;
break;
default:
if (paletteNum != 0xFF) { // Change shadow color back to black
u16 index = (paletteNum+16)*16+SHADOW_COLOR_INDEX;
gPlttBufferUnfaded[index] = gPlttBufferFaded[index] = RGB_BLACK;
}
return FALSE;
}
return TRUE;