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

[P3] Fix persisting sleep animation when sprite is already loaded #4562

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

acelynnzhang
Copy link
Contributor

What are the changes the user will see?

Pokémon animation speeds will function normally after reloading a session that was saved when an enemy Pokémon was asleep.

Why am I making these changes?

Fixes #4465

What are the changes from a developer perspective?

Calling PokemonSpeciesForm.loadAssets will reset the framerate when previously nothing would be done if the sprite was already loaded.

Screenshots/Videos

Before:

before.mp4

After:

after.mp4

How to test the changes?

  • Import session using the session data linked here
  • Use Spore
  • Save + quit
  • Load session again

Checklist

  • I'm using beta as my base branch
  • There is no overlap with another PR?
  • The PR is self-contained and cannot be split into smaller PRs?
  • Have I provided a clear explanation of the changes?
  • [ ] Have I considered writing automated tests for the issue?
  • [ ] If I have text, did I make it translatable and add a key in the English locale file(s)?
  • Have I tested the changes (manually)?
    • Are all unit tests still passing? (npm run test)
  • Are the changes visual?
    • Have I provided screenshots/videos of the changes?

Ensure that a Pokémon's animation speed is reset properly after saving
and quitting. Previously, if a Pokémon was put to sleep, which slows
its framerate, saving and quitting would result in the slower framerate
persisting even though the Pokémon was no longer asleep. This fix adds
an else condition to reset the frameRate to 12 if the sprite is already
loaded upon resuming the game.

Fixes pagefaultgames#4465
@Tempo-anon Tempo-anon added the P3 Bug Non gameplay affecting bug. typos, graphical issues, or other minor incorrect interactions. label Oct 3, 2024
@chaosgrimmon
Copy link
Collaborator

Seems like a straightforward response to Quit to menu recycling the scene?
I very much do dislike the fact that framerates are fixed for the entire species though.

Copy link
Collaborator

@pom-eranian pom-eranian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, fps is reset. video

@acelynnzhang
Copy link
Contributor Author

I very much do dislike the fact that framerates are fixed for the entire species though.

Are there any cases where the framerate is not 12? I referenced this code when getting rid of the effects of sleep.

@chaosgrimmon
Copy link
Collaborator

@acelynnzhang

Also, if you happen to know which part of the code causes the framerate reduction, it'd save me a fair bit of time looking for it.

@acelynnzhang
Copy link
Contributor Author

Also, if you happen to know which part of the code causes the framerate reduction, it'd save me a fair bit of time looking for it.
Yep!

@chaosgrimmon
Copy link
Collaborator

Are there any cases where the framerate is not 12?

Great question, and I suppose the easy answer is previously, when it was reduced by a member of the Species being Asleep.

(Since the code is in pokemon-species, it affects every single future instantiation of that Species, provided that the scene was still in use. Because this doesn't affect existing instances, it did not appear to cause problems if, say, you Slept only one enemy Pokemon in a double battle and they were the same Species, but upon Quit+Reload, both would have their assets loaded, causing both to be slower than intended)

PokeRogue.2024-10-03.16-13-55.mp4
PokeRogue.2024-10-03.16-14-19.mp4

Copy link
Collaborator

@chaosgrimmon chaosgrimmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested, lgtm

PokeRogue.2024-10-03.16-03-56.mp4

@chaosgrimmon
Copy link
Collaborator

chaosgrimmon commented Oct 3, 2024

Yep!

That's really interesting given the statement in the Issue, if the actual code should only be setting framerate to a flat 4.

This compounds every time, which may result in ridiculously low animation speeds if repeated enough time.

(the reason I had to ask is in fact because it seemed like it wasn't getting slower upon repeated attempts)

@acelynnzhang
Copy link
Contributor Author

(the reason I had to ask is in fact because it seemed like it wasn't getting slower upon repeated attempts)

I was also unable to see the compounding in my testing. I used DevTools to track the framerate changes.

@Tempo-anon Tempo-anon merged commit 9c56c15 into pagefaultgames:beta Oct 3, 2024
14 checks passed
@acelynnzhang acelynnzhang deleted the fix-framerate-bug branch October 3, 2024 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Bug Non gameplay affecting bug. typos, graphical issues, or other minor incorrect interactions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants