Change EasyRPG's "SetInterpreterFlag" to make patch overrides temporary #3379
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.
This PR refactors the EasyRPG feature "SetInterpreterFlag" (#3123), similar to the way @Ghabry suggested there, by making use of some new state flags that have been merged into liblcf.
See liblcf PRs:
Rather than setting the global config options directly as before, a new field "easyrpg_runtime_flags" in the SaveEventExecState" struct is used, to make these overrides persist across save/load boundaries.
This makes these config overrides apply only to the Interpreter instance where they have been set, and when the end of the base frame is reached, all of the flags are reset automatically. To make this possible, a new global field "active_interpreter_flags" has been introduced, so the Player functions responsible for restricting use to these custom features can access & consider the state of the active interpreter flags for its check.
Test Project
RuntimeFlags.zip
Set "EasyRPG.ini" accordingly, whether you want to test the explicit enabling or disabling of certain patches.
Note:
Some extra test code has been introduced via a commit, to make it possible to easily test DynRPG & Destiny support using a simple log command. (@easyrpg_output would always be possible, even without DynRPG enabled)