Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initial Discord Report (by me)
I was investigating an issue the italian translation team reported, where lipsync didn't work in one particular scene (repeatble)
It turned out to be due to two different layers using the same priority (I think). Even without lipsync, it would cause the second sprite with the same priority to not be drawn at all.
I made the engine print a warning every time this happens, and it happens pretty rarely (about once per chapter).
In your experience, is this a known behavior with the engine? like is this something you take into account when doing the scripts?
Also it looks like the priority just sets the order of the layers when they overlap (like if two characters are drawn in the same spot, higher priority is drawn ontop). Does that seem accurate?
For example, the below code has 3 draw calls. Two calls are on layer 2, which work fine. But the third one does nothing, unless you set a priority other than
10
(priority is the 3rd last argument)This PR
This PR both logs when the priority problems happen and fixes the Z-position when two layers have the same priority (by offsetting the Z-position proportional to the layer (higher layer = lower Z position). Note that a different (better) way to fix it, would be to make sure later layers with the same priority are drawn on-top (with a lower Z position).
However, I think in the end we won't actually fix it this way, and instead will fix it by editing the scripts, since this error does not happen very often.
I've already gone ahead and scanned the script for priority errors and orian is fixing it.
So this PR is mainly to archive/document the fix.