Skip to content

P3: Fix three editor bugs and an in-game briefing icon bug - #8027

Open
dustinspace217 wants to merge 4 commits into
scp-fs2open:masterfrom
dustinspace217:fix/editor-briefing-icons-async-fred
Open

dustinspace217 wants to merge 4 commits into
scp-fs2open:masterfrom
dustinspace217:fix/editor-briefing-icons-async-fred

Conversation

@dustinspace217

@dustinspace217 dustinspace217 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What?

Three small editor fixes and one in the game's briefing screen. Fixes #7726 and #6521.

  • qtFRED briefing editor: icons that move between two stages no longer disappear after a cut or a jump of more than one stage. Deleting a stage or switching teams now also moves the preview to the stage that took its place.
  • qtFRED campaign editor: the Campaign Flow tab is no longer empty when a campaign is opened from the Campaign Specs tab.
  • FRED and qtFRED: a script that calls async.run with an executor no longer asserts at startup.
  • Game briefing: a stage with a camera time of 0 no longer loses the icons that moved from the stage before it.

Why?

  • qtFred Bug: Briefing Last Stage Issue #7726: after a cut, some icons were missing from the preview until the camera was moved.
  • Campaign flow, reported on Discord: open the campaign editor, open a campaign, switch tabs. No flow is drawn until the campaign is opened a second time.
  • FRED Asserts with scripting and async calls #6521: with scripting enabled in FRED, an async call on the on-frame executor hit the assert in gamesequence.cpp, because the editors have no game state.
  • Game briefing, found while fixing qtFred Bug: Briefing Last Stage Issue #7726: with $camera_time: 0 and no cut flag, an icon that sits at a different position than in the previous stage is never drawn on that stage.

How?

  • Briefing: the engine moves icons over the transition time and divides by it. For an instant change the editor now clears the previous stage first, as the game does before a cut. This is the qtFred Bug: Briefing Last Stage Issue #7726 change from Qtfred briefing map controls #7675, which MjnMixael said was fine to pull. The same reset runs when the stage index did not change, since delete and team switch put a different stage under the same index.
  • Campaign: the graph was fitted to a view on a hidden tab that had no size yet, which shrank the whole flow to a dot. A fit requested while hidden now runs when the view is shown.
  • Async: gameseq_get_state_instance_id returns 0 when there is no state stack, the same way gameseq_get_state returns GS_STATE_INVALID. A context captured without a stack stays valid while there is none. The game starts its state stack before scripting, so this only runs in the editors and the unit tests.
  • Game briefing: with a time of exactly 0 an icon now gets no mover and is drawn at its new position. Every other time, and the fades for icons that appear or leave, work as before. It is its own commit, in case it should be a separate PR.

Testing?

  • Linux, Debug builds of master 8ef44a4 and this branch, MediaVPs 5.0.2, mission SM1-01.
  • Briefing: on stage 2, check "Cut to next stage", press Next. Master: Iota is missing. Branch: drawn. Delete Stage on stage 1 now shows the next stage's camera.
  • Campaign: retail FreeSpace2.fc2 opened from the Specs tab. Master: blank. Branch: drawn, also after resizing the dialog first.
  • Async: a test mod with "$Enable scripting in FRED: yes" and a $GameInit hook calling async.run on async.OnFrameExecutor. Master asserts at gamesequence.cpp:437. Branch starts and the function runs. async.awaitRunOnFrame also completes.
  • Game briefing: a copy of SM1-01 with stage 3 set to $camera_time: 0. Master: Iota is missing on stage 3. Branch: drawn. Same under OpenGL and Vulkan. The unmodified SM1-01 briefing looks the same on both builds under both renderers.
  • No retail FreeSpace 2 briefing has a camera time of 0 (90 missions, 213 stages). FSPort has two such stages, in sm3-09a, and no icon moves between them.
  • New unit tests fail on master and pass here. One of them only fails on master in Debug, since Release has no assert. They rely on no other test starting the state stack. For the briefing fix, one test fails on master in both build types and the other three pin behavior that did not change.
  • In the game, master and this branch behave the same with an async test mod under OpenGL and Vulkan.
  • Not tested: Windows, macOS, FRED (MFC). The two qtFRED changes have no automated test.

Anything Else?

  • In the editors a captured context now stays valid for the whole session, and work queued on the simulation executor never runs there, since only the game runs it.
  • The qtFRED preview still shows an instant stage change without the fades the game plays there.
  • This touches CampaignMissionGraph, as P3: qtFRED campaign editor: fix crash on close and leftover drag trails #8004 does, in different lines.
  • I wrote this with help from Claude Code.

… change

Icons that moved between two stages vanished after a cut or a jump of more than one stage, until the camera was moved. The engine builds icon movers from the previous stage and divides by the transition time, so a zero-time change needs the previous stage cleared first, as the game does before a cut or a jump. The same reset now also runs when the stage index is unchanged, because Delete Stage and a team switch put a different stage under the same index and the preview kept the old camera. The zero-time part is the scp-fs2open#7726 hunk from scp-fs2open#7675. Fixes scp-fs2open#7726.
Opening a campaign from the Campaign Specs tab fitted the graph to a view that had never been laid out, so the whole flow shrank to a speck and the Campaign Flow tab looked empty until the campaign was opened again. A fit asked for while the view is hidden now runs when the view is shown.
FRED and qtFRED never start the game state machine. Capturing a game state context there, which async.run does by default, asserted in gameseq_get_state_instance_id in Debug builds and read before the start of the state array in Release. The instance id is now 0 without a state stack, like gameseq_get_state returns GS_STATE_INVALID, and a context captured without a stack stays valid while there is still none. Fixes scp-fs2open#6521.
…hange

In the game, a briefing stage with a camera time of 0 and no cut flag lost every icon that had moved from the previous stage. The icon mover divides by the transition time, so its speed became infinite and the icon was never drawn. An icon now gets no mover when the time is exactly 0 and is drawn at its new position instead. Other times, and the fades for icons that appear or disappear, are unchanged. No retail FreeSpace 2 briefing has a stage with a camera time of 0.
@dustinspace217 dustinspace217 changed the title P3: Fix three editor bugs: briefing icons, campaign flow, async Lua in FRED P3: Fix three editor bugs and an in-game briefing icon bug Nov 11, 2026
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.

qtFred Bug: Briefing Last Stage Issue

1 participant