From 40a632a2ae56bfe4508e019dd6077b4cb17170d7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 Apr 2021 18:15:12 +0200 Subject: [PATCH] - rffdefineid --- source/build/src/defs.cpp | 29 ++--------------------------- source/core/parsefuncs.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 167f57552..370f10e6e 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -2303,36 +2303,11 @@ static int32_t defsparser(scriptfile *script) } break; case T_NEWGAMECHOICES: // stub - { - FScanner::SavedPos blockend; - if (scriptfile_getbraces(script,&blockend)) - break; - scriptfile_setposition(script, blockend); + parseNewGameChoices(*script, pos); break; - } case T_RFFDEFINEID: - { - FString resName; - FString resType; - FString rffName; - int resID; - - if (scriptfile_getstring(script, &resName)) - break; - - if (scriptfile_getstring(script, &resType)) - break; - - if (scriptfile_getnumber(script, &resID)) - break; - - if (scriptfile_getstring(script, &rffName)) - break; - - FStringf name("%s.%s", resName.GetChars(), resType.GetChars()); - fileSystem.CreatePathlessCopy(name, resID, 0); - } + parseRffDefineId(*script, pos); break; diff --git a/source/core/parsefuncs.h b/source/core/parsefuncs.h index ce2b1cccb..f95496d0a 100644 --- a/source/core/parsefuncs.h +++ b/source/core/parsefuncs.h @@ -643,3 +643,38 @@ void parseMultiPsky(FScanner& sc, FScriptPosition& pos) auto psky = tileSetupSky(sky.tilenum); *psky = sky; } + +//=========================================================================== +// +// +// +//=========================================================================== + +void parseRffDefineId(FScanner& sc, FScriptPosition& pos) +{ + FString resName; + FString resType; + int resID; + + if (!sc.GetString(resName)) return; + if (!sc.GetString(resType)) return; + if (!sc.GetNumber(resID)) return; + if (!sc.GetString()) return; + resName.AppendFormat(".%s", resType.GetChars()); + fileSystem.CreatePathlessCopy(resName, resID, 0); +} + +//=========================================================================== +// +// empty stub +// +//=========================================================================== + +void parseNewGameChoices(FScanner& sc, FScriptPosition& pos) +{ + FScanner::SavedPos blockend; + + if (sc.StartBraces(&blockend)) return; + while (!sc.FoundEndBrace(blockend)) {} +} +