Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Sprite Palettes Not Updating to Match Weather Shading, or Updating to Not Match Weather Shading #5395

Open
sixtycardpickup opened this issue Sep 17, 2024 · 1 comment
Labels
bug Bug status: unconfirmed This bug has not been reproduced yet

Comments

@sixtycardpickup
Copy link

sixtycardpickup commented Sep 17, 2024

Description

Problem appears to be: certain sprite palettes do not update to match the weather as expected in certain scenarios - this seems to be the best way to describe the issue, based on the names of functions UpdateSpritePalette and UpdateSpritePaletteWithWeather

Currently object event palettes adjust perfectly in some situations, and incorrectly in others. The palette changes from WEATHER_SHADE [and other shaded Over-World Weathers, like WEATHER_RAIN] appear to be the primary issue.
[At least] in shaded OW weathers, sprites do not update consistently to match the weather palette, and when they do properly update, will revert to the non-shaded palette under certain conditions, while the map weather, player sprite, and follower remain properly shaded.

Attaching images and corresponding image descriptions below to illustrate the pattern I've observed as well as I can, followed by what I believe is the relevant code. Happy to provide more information here or via discord if needed 🫡

Image Descriptions:
Image 1 shows only the follower and the player with palettes properly adjusted to the weather. Seems to occur when the weather is meant to shade the palette darker, when walking either between adjacent maps, or simply too far away from the NPC; this does not appear to be solved by force-loading off-screen object events with a flag.
Image 2 shows all NPCs currently on screen the correct palette for the weather. The follower is not shown in this image, but when I stepped forward it was correct - this (proper functionality) seems to occur when exiting a building, or when exiting the bag/party/etc. menu.
Image 3 shows one NPC [the "twin," in this case] with a palette that did not update for the weather. Most often, when only one NPC palette fails to update, it seems to be an NPC that has its location "set" in the script at some point {like the "twin" or the footprints guy in Oldale.}
————————————————————————
IMAGE 1 palette issue in shade weather (image 1) 3 characters not shaded right Capture
IMAGE 2 palette issue in shade weather (image 2) all characters shaded right Capture
IMAGE 3 palette issue in shade weather (image 2) one of 5 characters shaded wrong Capture
————————————————————————
[the boxes I made with the snipping tool highlighter on images 1 and 3 are used to surround the object events that do have properly updated palettes (which match the weather)]
There seems to be no issue with this unexpected palette behavior during the day, when weather is WEATHER_SUNNY or WEATHER_DROUGHT and maybe also not during WEATHER_THUNDERSTORM

The following is what I believe constitutes the relevant edited code {all in the littleroot scripts.pory/scripts.inc (I have essentially the same code and issue on Oldale and the nearby routes)}:
————————————————————————

    map_script MAP_SCRIPT_ON_TRANSITION, LittlerootTown_OnTransition
    map_script MAP_SCRIPT_ON_FRAME_TABLE, LittlerootTown_OnFrame
    map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, LittlerootTown_OnWarp
    map_script MAP_SCRIPT_ON_LOAD, LittlerootTown_OnLoad
    .byte 0
@ Littleroot Town Weather
@ goto_if_ge intro_state, 4, in OnLoad, before going to weather works to avoid palette mismatch at New Game Start when unset RTC's midnight WEATHER_SHADE causes player palette to update when exiting truck, but fails to update "Mom" NPC's palette to match.
LittlerootTown_OnLoad::
    goto_if_ge VAR_LITTLEROOT_INTRO_STATE, 4, LittlerootTown_OnLoad_Weather
    end
LittlerootTown_OnLoad_Weather::
    special GetDayOrNight
    goto_if_eq VAR_RESULT, 3, LittlerootTown_OnLoad_Night
    goto_if_eq VAR_RESULT, 2, LittlerootTown_OnLoad_Evening
    goto_if_eq VAR_RESULT, 1, LittlerootTown_OnLoad_Day
    goto_if_eq VAR_RESULT, 0, LittlerootTown_OnLoad_Morning
    end
LittlerootTown_OnLoad_Morning::
    setvar VAR_DAYNIGHT, 0
    random 3
    switch VAR_RESULT
    case 0, LittlerootTown_MorningSunny
    case 1, LittlerootTown_MorningRain
    case 2, LittlerootTown_MorningSunny
    end
LittlerootTown_MorningRain::
    setweather WEATHER_RAIN
    end
LittlerootTown_MorningSunny::
    setweather WEATHER_SUNNY
    end
LittlerootTown_OnLoad_Day::
    setvar VAR_DAYNIGHT, 1
    random 3
    switch VAR_RESULT
    case 0, LittlerootTown_DayDrought
    case 1, LittlerootTown_DaySunny
    case 2, LittlerootTown_DaySunny
    end
LittlerootTown_DayDrought::
    setweather WEATHER_DROUGHT
    end
LittlerootTown_DaySunny::
    setweather WEATHER_SUNNY
    end
LittlerootTown_OnLoad_Evening::
    setvar VAR_DAYNIGHT, 2
    setweather WEATHER_SHADE
    end
LittlerootTown_OnLoad_Night::
    setvar VAR_DAYNIGHT, 3
    setweather WEATHER_SHADE
    End

Potentially relevant:
I arrived at running setweather as a MAP_SCRIPT_ON_LOAD after finding that MAP_SCRIPT_ON_LOAD seems to lead to palette-update failure less often than MAP_SCRIPT_ON_TRANSITION and/or MAP_SCRIPT_ON_RESUME

Thank you for reading!

Original Help Request Discord Thread

Version

1.9.2 (Latest release)

Upcoming/master Version

Master

Discord contact info

sixty_card_pickup is my server nickname, if that's not the correct tag, I linked original Discord post in bug description :)

@sixtycardpickup sixtycardpickup added bug Bug status: unconfirmed This bug has not been reproduced yet labels Sep 17, 2024
@ShinyDragonHunter
Copy link

The initial dynamic palettes implementation didn't really update palette color maps correctly so in some instances, palettes are tinted incorrectly in some cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug status: unconfirmed This bug has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants