Skip to content

Commit

Permalink
A bit more of addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Jan 17, 2025
1 parent ffc8903 commit 6162628
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions include/constants/rgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#define RGB_BLACK RGB(0, 0, 0)
#define RGB_WHITE RGB(31, 31, 31)
#define RGB_GRAY RGB(15, 15, 15)
#define RGB_RED RGB(31, 0, 0)
#define RGB_GREEN RGB(0, 31, 0)
#define RGB_BLUE RGB(0, 0, 31)
Expand Down
4 changes: 2 additions & 2 deletions src/battle_transition.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ static void InitPatternWeaveTransition(struct Task *task)
sTransitionData->WIN0V = DISPLAY_HEIGHT;
sTransitionData->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL;
sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1);
UpdateShadowColor(RGB(15, 15, 15)); // force shadows to gray
UpdateShadowColor(RGB_GRAY);

for (i = 0; i < DISPLAY_HEIGHT; i++)
gScanlineEffectRegBuffers[1][i] = DISPLAY_WIDTH;
Expand Down Expand Up @@ -4252,7 +4252,7 @@ static bool8 FrontierLogoWave_Init(struct Task *task)
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
LoadPalette(sFrontierLogo_Palette, BG_PLTT_ID(15), sizeof(sFrontierLogo_Palette));
sTransitionData->cameraY = 0;
UpdateShadowColor(RGB(15, 15, 15)); // force shadows to gray
UpdateShadowColor(RGB_GRAY);

task->tState++;
return FALSE;
Expand Down
16 changes: 10 additions & 6 deletions src/event_object_movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -2614,6 +2614,8 @@ void GetFollowerAction(struct ScriptContext *ctx) // Essentially a big switch fo
}

#define sLightType data[5]
#define sLightXPos data[6]
#define sLightYPos data[7]

// Sprite callback for light sprites
void UpdateLightSprite(struct Sprite *sprite)
Expand All @@ -2622,8 +2624,8 @@ void UpdateLightSprite(struct Sprite *sprite)
s16 right = gSaveBlock1Ptr->pos.x + 17;
s16 top = gSaveBlock1Ptr->pos.y;
s16 bottom = gSaveBlock1Ptr->pos.y + 15;
s16 x = sprite->data[6];
s16 y = sprite->data[7];
s16 x = sprite->sLightXPos;
s16 y = sprite->sLightYPos;
u16 sheetTileStart;
u32 paletteNum;
if (!(x >= left && x <= right && y >= top && y <= bottom))
Expand Down Expand Up @@ -2683,7 +2685,7 @@ static void SpawnLightSprite(s16 x, s16 y, s16 camX, s16 camY, u32 lightType)
for (i = 0; i < MAX_SPRITES; i++)
{
sprite = &gSprites[i];
if (sprite->inUse && sprite->callback == UpdateLightSprite && sprite->data[6] == x && sprite->data[7] == y)
if (sprite->inUse && sprite->callback == UpdateLightSprite && sprite->sLightXPos == x && sprite->sLightYPos == y)
return;
}
lightType = min(lightType, ARRAY_COUNT(gFieldEffectLightTemplates) - 1); // bounds checking
Expand All @@ -2696,8 +2698,8 @@ static void SpawnLightSprite(s16 x, s16 y, s16 camX, s16 camY, u32 lightType)
UpdateSpritePaletteByTemplate(template, sprite);
GetMapCoordsFromSpritePos(x + camX, y + camY, &sprite->x, &sprite->y);
sprite->sLightType = lightType;
sprite->data[6] = x;
sprite->data[7] = y;
sprite->sLightXPos = x;
sprite->sLightYPos = y;
sprite->affineAnims = gDummySpriteAffineAnimTable;
sprite->affineAnimBeginning = TRUE;
sprite->coordOffsetEnabled = TRUE;
Expand Down Expand Up @@ -2725,6 +2727,8 @@ static void SpawnLightSprite(s16 x, s16 y, s16 camX, s16 camY, u32 lightType)
}

#undef sLightType
#undef sLightXPos
#undef sLightYPos

void TrySpawnLightSprites(s16 camX, s16 camY)
{
Expand Down Expand Up @@ -10205,7 +10209,7 @@ static void GroundEffect_Shadow(struct ObjectEvent *objEvent, struct Sprite *spr

static void DoFlaggedGroundEffects(struct ObjectEvent *objEvent, struct Sprite *sprite, u32 flags)
{
u8 i;
u32 i;
if (ObjectEventIsFarawayIslandMew(objEvent) == TRUE && !ShouldMewShakeGrass(objEvent))
return;

Expand Down
4 changes: 2 additions & 2 deletions src/field_screen_effect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ static void Task_OrbEffect(u8 taskId)
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON);
SetGpuRegBits(REG_OFFSET_BLDCNT, gOrbEffectBackgroundLayerFlags[0]);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 7));
UpdateShadowColor(RGB(9, 8, 8)); // force shadows to gray
UpdateShadowColor(RGB_GRAY);
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ);
SetBgTilemapPalette(0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0xF);
Expand Down Expand Up @@ -1224,7 +1224,7 @@ static void Task_OrbEffect(u8 taskId)
SetGpuReg(REG_OFFSET_DISPCNT, tDispCnt);
SetGpuReg(REG_OFFSET_BLDCNT, tBldCnt);
SetGpuReg(REG_OFFSET_BLDALPHA, tBldAlpha);
UpdateShadowColor(RGB_BLACK); // force shadows to gray
UpdateShadowColor(RGB_GRAY);
SetGpuReg(REG_OFFSET_WININ, tWinIn);
SetGpuReg(REG_OFFSET_WINOUT, tWinOut);
ScriptContext_Enable();
Expand Down
4 changes: 2 additions & 2 deletions src/field_weather_effect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ void FogHorizontal_Main(void)
if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL)
{
Weather_SetTargetBlendCoeffs(12, 8, 3);
UpdateShadowColor(RGB(15, 15, 15)); // Gray
UpdateShadowColor(RGB_GRAY);
}
else
{
Expand Down Expand Up @@ -2005,7 +2005,7 @@ void Sandstorm_Main(void)
break;
case 1:
Weather_SetTargetBlendCoeffs(16, 2, 0);
UpdateShadowColor(RGB(15, 15, 15));
UpdateShadowColor(RGB_GRAY);
gWeatherPtr->initStep++;
break;
case 2:
Expand Down
4 changes: 2 additions & 2 deletions src/palette.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ static u8 UpdateTimeOfDayPaletteFade(void)
u16 selectedPalettes;
u16 timePalettes = 0; // palettes passed to the time-blender
u16 copyPalettes;
u16 * src;
u16 * dst;
u16 *src;
u16 *dst;

if (!gPaletteFade.active)
return PALETTE_FADE_STATUS_DONE;
Expand Down

0 comments on commit 6162628

Please sign in to comment.