Repository navigation
Play non-looping effects of a PFX controller once per trigger - #1084
Open
pieterdeschepper wants to merge 1 commit into
Open
pieterdeschepper wants to merge 1 commit into
pieterdeschepper wants to merge 1 commit into
Conversation
PfxController always looped its effect, so one-shot effects such as MFX_SPAWN_CAST (the flare when the Gothic 1 temple spawns demons and orc priests) kept emitting forever after the first trigger. Effects with emission keys and no ppsIsLooping now play once: each trigger restarts them from the first key, and they are not reactivated when a save is loaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In the Gothic 1 Sleeper temple, each spawn of demons and undead orc priests triggers a
zCPFXControlerwithMFX_SPAWN_CAST.PFX(EVT_TPL_07_PFX_01,EVT_TPL_08_PFX_01,EVT_TPL_16_PFX_01,EVT_TPL_XARDASSPAWN_PFXCONTR_01). That effect has one emission key at 1 FPS and noppsIsLooping, so it should flash for about a second.PfxControlleralways calledsetLooped(true), so after the first trigger the flare kept emitting forever. The state is also saved and restored on load.Change
PfxController::isOneShot()is true when the effect has emission keys (prefferedTime>0) and noppsIsLooping. For such effects:onTriggercreates a fresh emitter, so each trigger plays the effect from its first key. Before, an emitter that had already played stayed "active" but emitted nothing.loaddoesn't reactivate it. Existing saves with the stuck flare load without it.Controllers with looping or key-less effects behave as before.
Testing
Gothic 1 on macOS (Apple M3 Pro):
I tested in a local build.
🤖 Generated with Claude Code