Issue #154, #156: Screen Text Preview Errors

Merged
#36 · Created  · Last updated

Merged pull request

Merged in _Enthalpy_/aao-game-creation-engine/issue-154 (pull request #36)

9ce6ec8·Author: ·Closed by: ·2016-09-25

Description

Fixes to the twin bugs of 154 and 156. So, what happened? Unas put a "load the frame" command inside the command to build the character row in the character selector. This is exactly as intended when the character row needs to be refreshed, due to choosing a different sprite or a different character. But the character row is also built when loading the entire screen editor. Given that the screen editor also had to load the preview, the preview was being loaded twice. And since the initialization is synchronous but the text typing is asynchronous, this created some very strange interference!

Both bugs start by running the initialization from the first load text command from generating the screen editor and then the initialization from the second load text command form generating the character row. The first load text command then runs with the intended behavior of instantly displaying the text. It also resets the initialization state and marks the frame as merged if it is merged.

Now the second loadFrameText command runs. Since the initialization was reset, it redoes initialization. It's at this point that the two bugs diverge. If the frame is merged, then the last loadFrameText call means previous_frame_merged is true, and the previous text is not wiped out. If the frame is not, then the previous text is wiped out. Regardless, skip_remaining_text is set to false, and without a screenDisplay.clearScreen() call, it stays false, making the text type out a second time.

The solution is to prevent the interference in the first place - only load the text once. As such, I've moved the preview.loadScreen command to when there's a change in char_select, which exactly leaves out the cases where the bug happens!

I also added a comment explaining why initialization needs to occur before text loading anyways. I spent a good while puzzling that one out.

0 attachments

0 comments

Loading commits...