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

Properly unescape escaped characters in save file when loading #185

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

ITdevkc
Copy link
Contributor

@ITdevkc ITdevkc commented Jun 11, 2024

Modified PRVM_ED_ParseEdict to determine whether it is loading a save or not, and unescape variables if loading a save. Fixes #81

@bones-was-here
Copy link
Contributor

I changed this patch slightly because the exact cause of #81 is an incorrect special-case: all entity field values were unescaped when loading, consistent with what's done when saving, unless the name of the field was wad which has no equivalent special-case when saving.

That also caused a second bug: if a mapper set a field named anything other than wad to a value containing \ it was always treated as an escape when loading the BSP, even though map compilers don't support escapes (and thus fail to compile if " occurs in a field value). I had to work around this in Xonotic to support maps using entity sounds whose VFS path included \n.

I left the escape parsing in COM_ParseToken_Simple() (as already added in this PR) and disabled it entirely in PRVM_ED_ParseEpair() (where it was previously done for all fields except wad) thus fixing the second bug (and preventing double escape parsing). COM_ParseToken_Simple() already handles values containing } and escaped " whereas PRVM_ED_ParseEpair() doesn't.


Compatibility notes: I tested some other engines and found they're too buggy for us to provide full save file compatibility: they don't escape when saving (meaning they can't support field values containing " even though those are valid in QC) but they do unescape when loading, which breaks field values containing \ such as that of world.wad on wickedstart.bsp.

@bones-was-here bones-was-here merged commit 312123e into DarkPlacesEngine:master Jul 22, 2024
1 check passed
bones-was-here added a commit that referenced this pull request Aug 5, 2024
In 312123e a bug was introduced where
newlines were no longer supported in string fields.
This patch supports them again, which requires exceptions be
reintroduced to fully support some buggy maps, but this time there's a
cvar for documentation and adjustment.  The other notes and fixes in
#185 still apply.

Signed-off-by: bones_was_here <[email protected]>
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.

DarkPlaces Sometimes Crashes on Linux While Trying to Save
2 participants