From cf8447d19ca132c3fbddf966fa3fc1d98d199487 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 15 Apr 2018 12:12:29 +0200 Subject: [PATCH] -protected critical portal data from getting written to by user code. This data is game critical and may only be altered by code that knows what is allowed and what not. It must never be altered by any user code ever. However, since the SkyViewpoint actors need to set up some relations between themselves and the default sky portals the previously purely internal 'internal' flag has been exported as a new keyword. --- src/sc_man_scanner.re | 1 + src/sc_man_tokens.h | 1 + src/scripting/zscript/zcc-parse.lemon | 1 + src/scripting/zscript/zcc_compile.cpp | 3 ++- src/scripting/zscript/zcc_parser.cpp | 1 + src/scripting/zscript/zcc_parser.h | 1 + src/version.h | 2 +- wadsrc/static/zscript.txt | 2 +- wadsrc/static/zscript/mapdata.txt | 2 +- 9 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/sc_man_scanner.re b/src/sc_man_scanner.re index 0dd74009aa..3ef66b7609 100644 --- a/src/sc_man_scanner.re +++ b/src/sc_man_scanner.re @@ -209,6 +209,7 @@ std2: 'version' { RET(ParseVersion >= MakeVersion(2, 4, 0)? TK_Version : TK_Identifier); } 'action' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_Action : TK_Identifier); } 'readonly' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_ReadOnly : TK_Identifier); } + 'internal' { RET(ParseVersion >= MakeVersion(3, 4, 0)? TK_Internal : TK_Identifier); } 'let' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_Let : TK_Identifier); } /* Actor state options */ diff --git a/src/sc_man_tokens.h b/src/sc_man_tokens.h index 33be1c6ae6..dfe49518ae 100644 --- a/src/sc_man_tokens.h +++ b/src/sc_man_tokens.h @@ -138,6 +138,7 @@ xx(TK_Meta, "'meta'") xx(TK_Deprecated, "'deprecated'") xx(TK_Version, "'version'") xx(TK_ReadOnly, "'readonly'") +xx(TK_Internal, "'internal'") xx(TK_CanRaise, "'canraise'") xx(TK_Fast, "'fast'") diff --git a/src/scripting/zscript/zcc-parse.lemon b/src/scripting/zscript/zcc-parse.lemon index 34ebd9149e..11847217fd 100644 --- a/src/scripting/zscript/zcc-parse.lemon +++ b/src/scripting/zscript/zcc-parse.lemon @@ -1120,6 +1120,7 @@ decl_flag(X) ::= FINAL(T). { X.Int = ZCC_Final; X.SourceLoc = T.SourceLoc; } decl_flag(X) ::= META(T). { X.Int = ZCC_Meta; X.SourceLoc = T.SourceLoc; } decl_flag(X) ::= TRANSIENT(T). { X.Int = ZCC_Transient; X.SourceLoc = T.SourceLoc; } decl_flag(X) ::= READONLY(T). { X.Int = ZCC_ReadOnly; X.SourceLoc = T.SourceLoc; } +decl_flag(X) ::= INTERNAL(T). { X.Int = ZCC_Internal; X.SourceLoc = T.SourceLoc; } decl_flag(X) ::= VIRTUAL(T). { X.Int = ZCC_Virtual; X.SourceLoc = T.SourceLoc; } decl_flag(X) ::= OVERRIDE(T). { X.Int = ZCC_Override; X.SourceLoc = T.SourceLoc; } decl_flag(X) ::= VARARG(T). { X.Int = ZCC_VarArg; X.SourceLoc = T.SourceLoc; } diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 1068501d68..d782383e7f 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -1241,6 +1241,7 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArrayFlags & ZCC_Protected) varflags |= VARF_Protected; if (field->Flags & ZCC_Deprecated) varflags |= VARF_Deprecated; if (field->Flags & ZCC_ReadOnly) varflags |= VARF_ReadOnly; + if (field->Flags & ZCC_Internal) varflags |= VARF_InternalAccess; if (field->Flags & ZCC_Transient) varflags |= VARF_Transient; if (mVersion >= MakeVersion(2, 4, 0)) { @@ -2327,7 +2328,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool } while (t != f->Type); } - int notallowed = ZCC_Latent | ZCC_Meta | ZCC_ReadOnly | ZCC_Abstract; + int notallowed = ZCC_Latent | ZCC_Meta | ZCC_ReadOnly | ZCC_Abstract | ZCC_Internal; if (f->Flags & notallowed) { diff --git a/src/scripting/zscript/zcc_parser.cpp b/src/scripting/zscript/zcc_parser.cpp index 6902753da9..f067311efd 100644 --- a/src/scripting/zscript/zcc_parser.cpp +++ b/src/scripting/zscript/zcc_parser.cpp @@ -149,6 +149,7 @@ static void InitTokenMap() TOKENDEF (TK_Deprecated, ZCC_DEPRECATED); TOKENDEF (TK_Version, ZCC_VERSION); TOKENDEF (TK_ReadOnly, ZCC_READONLY); + TOKENDEF (TK_Internal, ZCC_INTERNAL); TOKENDEF ('{', ZCC_LBRACE); TOKENDEF ('}', ZCC_RBRACE); TOKENDEF (TK_Struct, ZCC_STRUCT); diff --git a/src/scripting/zscript/zcc_parser.h b/src/scripting/zscript/zcc_parser.h index 5f0889fd2e..1089b2ed8b 100644 --- a/src/scripting/zscript/zcc_parser.h +++ b/src/scripting/zscript/zcc_parser.h @@ -63,6 +63,7 @@ enum ZCC_ClearScope = 1 << 19, ZCC_VirtualScope = 1 << 20, ZCC_Version = 1 << 21, + ZCC_Internal = 1 << 22, }; // Function parameter modifiers diff --git a/src/version.h b/src/version.h index afda99a21f..30513f9675 100644 --- a/src/version.h +++ b/src/version.h @@ -57,7 +57,7 @@ const char *GetVersionString(); #define RC_PRODUCTVERSION2 VERSIONSTR // These are for content versioning. The current state is '3.3'. #define VER_MAJOR 3 -#define VER_MINOR 3 +#define VER_MINOR 4 #define VER_REVISION 0 // Version identifier for network games. diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 31531ed281..1daf046283 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -1,4 +1,4 @@ -version "3.3" +version "3.4" #include "zscript/base.txt" #include "zscript/sounddata.txt" #include "zscript/mapdata.txt" diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index fb62faff72..f20a9b2ebf 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -334,7 +334,7 @@ struct Sector native play native SectorAction SecActTarget; - native uint Portals[2]; + native internal uint Portals[2]; native readonly int PortalGroup; native readonly int sectornum;