From e1b9f3152515b95fdf4ce63b6d262915eea66e96 Mon Sep 17 00:00:00 2001 From: ZZYZX <zzyzx@virtual> Date: Sun, 2 Dec 2018 17:51:54 +0200 Subject: [PATCH] Updated ZDoom ACS definitions; Updated ZScript parser for compatibility with latest GZDoom --- Build/Compilers/ZDoom/zdefs.acs | 4 ++ Build/Compilers/ZDoom/zspecial.acs | 4 ++ Source/Core/ZDoom/ZScriptActorStructure.cs | 60 ++++++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/Build/Compilers/ZDoom/zdefs.acs b/Build/Compilers/ZDoom/zdefs.acs index 1bed23223..48214fc70 100755 --- a/Build/Compilers/ZDoom/zdefs.acs +++ b/Build/Compilers/ZDoom/zdefs.acs @@ -1122,3 +1122,7 @@ #define CPXF_CLOSEST (1 << 10) #define CPXF_SETONPTR (1 << 11) #define CPXF_CHECKSIGHT (1 << 12) + +#define SECPART_Floor 0 +#define SECPART_Ceiling 1 +#define SECPART_3D 2 \ No newline at end of file diff --git a/Build/Compilers/ZDoom/zspecial.acs b/Build/Compilers/ZDoom/zspecial.acs index c05b41153..a1182afeb 100755 --- a/Build/Compilers/ZDoom/zspecial.acs +++ b/Build/Compilers/ZDoom/zspecial.acs @@ -147,6 +147,8 @@ special 143:Player_RemoveItem(2), // Skulltag Functions 144:Player_GiveItem(2), // Skulltag Functions 145:Player_SetTeam(1), // Skulltag Functions + 150:Line_SetHealth(2), + 151:Sector_SetHealth(3), 152:Team_Score(2), // Skulltag Functions 153:Team_GivePoints(3), // Skulltag Functions 154:Teleport_NoStop(2, 3), @@ -424,6 +426,8 @@ special -209:Ceil(1), -210:ScriptCall(2, 100), // ACS does not know varargs so use something large as maximum. -211:StartSlideshow(1), + -212:GetSectorHealth(2), + -213:GetLineHealth(1), // Eternity's diff --git a/Source/Core/ZDoom/ZScriptActorStructure.cs b/Source/Core/ZDoom/ZScriptActorStructure.cs index ed68f51b9..96b3814a2 100755 --- a/Source/Core/ZDoom/ZScriptActorStructure.cs +++ b/Source/Core/ZDoom/ZScriptActorStructure.cs @@ -319,6 +319,60 @@ namespace CodeImp.DoomBuilder.ZDoom } } + private bool ParseFlagdef() + { + // flagdef identifier: variable, bitnum; + tokenizer.SkipWhitespace(); + ZScriptToken token = tokenizer.ExpectToken(ZScriptTokenType.Identifier); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected flag name, got " + ((Object)token ?? "<null>").ToString()); + return false; + } + + tokenizer.SkipWhitespace(); + token = tokenizer.ExpectToken(ZScriptTokenType.Colon); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected :, got " + ((Object)token ?? "<null>").ToString()); + return false; + } + + tokenizer.SkipWhitespace(); + token = tokenizer.ExpectToken(ZScriptTokenType.Identifier); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected flag base variable, got " + ((Object)token ?? "<null>").ToString()); + return false; + } + + tokenizer.SkipWhitespace(); + token = tokenizer.ExpectToken(ZScriptTokenType.Comma); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected comma, got " + ((Object)token ?? "<null>").ToString()); + return false; + } + + tokenizer.SkipWhitespace(); + token = tokenizer.ExpectToken(ZScriptTokenType.Integer); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected flag bit index, got " + ((Object)token ?? "<null>").ToString()); + return false; + } + + tokenizer.SkipWhitespace(); + token = tokenizer.ExpectToken(ZScriptTokenType.Semicolon); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected semicolon, got " + ((Object)token ?? "<null>").ToString()); + return false; + } + + return true; + } + private bool ParseProperty() { // property identifier: identifier, identifier, identifier, ...; @@ -487,6 +541,12 @@ namespace CodeImp.DoomBuilder.ZDoom return; continue; + // new flags syntax + case "flagdef": + if (!ParseFlagdef()) + return; + continue; + default: stream.Position = ocpos; break; -- GitLab