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

F priority workaround #123

Draft
wants to merge 2 commits into
base: mod
Choose a base branch
from
Draft

F priority workaround #123

wants to merge 2 commits into from

Conversation

drojf
Copy link
Contributor

@drojf drojf commented Mar 17, 2024

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)

FadeOutBGM( 1, 1000, TRUE );
DrawScene("background/gk1", 500 );

// Draw Layer 2 with Priority 10: me1a_def_a1_
ModDrawCharacter(2, 3, "sprite/me1a_def_a1_", "0", -160, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, 10, 200, TRUE );

OutputLine(NULL, "試験で振り落とさなきゃならないほど、人もいないし。」",
   NULL, "1 - Layer 2: me1a_def_a1_", GetGlobalFlag(GLinemodeSp));

// Draw Layer 2 with Priority 10: me1b_wink_a1_
ModDrawCharacter(2, 3, "sprite/me1b_wink_a1_", "2", -160, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, 10, 200, TRUE );

OutputLine(NULL, "「誰でも進学できるならさ、そんなにガリガリとやることもないんじゃない?」",
   NULL, "2 - Layer 2: me1b_wink_a1_", GetGlobalFlag(GLinemodeSp));

// Draw Layer 1 with Priority 10: re1a_def_a1_ (Nothing is shown during this call unless priority changed to a value other than 10)
ModDrawCharacter(1, 3, "sprite/re1a_def_a1_", "1", -160, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, 10, 600, TRUE );

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.

drojf added 2 commits March 14, 2024 10:47
 - Adjust Z-position so that layers don't overlap, even if drawn with same priority
 - The layer number is used as a secondary priority - higher layer numbers with the same priority will be drawn ontop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant