From 17972b5d06213f48a1b5bd57c11ebf8831631738 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 3 Apr 2016 19:15:00 -0500 Subject: [PATCH 1/4] Revert "Add "support" for user string variables in DECORATE" - This reverts commit c90a1c0c9627d2cb4d5ad105ae7020582c8b2cab. - DECORATE looks to be very dependant on functions that take strings as parameters receiving those strings as constants and not as expressions, so being able to declare string variables with DECORATE is pretty much useless. --- src/thingdef/thingdef_parse.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index bf929128b..f5359a7d8 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -533,17 +533,12 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cl // Read the type and make sure it's acceptable. sc.MustGetAnyToken(); - switch (sc.TokenType) + if (sc.TokenType != TK_Int && sc.TokenType != TK_Float) { - case TK_Int: type = TypeSInt32; break; - case TK_Float: type = TypeFloat64; break; - case TK_String: type = TypeString; break; - default: - type = TypeError; - sc.ScriptMessage("User variables must be of type 'int' or 'float' or 'string'"); + sc.ScriptMessage("User variables must be of type 'int' or 'float'"); FScriptPosition::ErrorCounter++; - break; } + type = sc.TokenType == TK_Int ? (PType *)TypeSInt32 : (PType *)TypeFloat64; sc.MustGetToken(TK_Identifier); // For now, restrict user variables to those that begin with "user_" to guarantee From 77f9643c8ff167fe738ba4111e985aa664738582 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 3 Apr 2016 20:25:07 -0500 Subject: [PATCH 2/4] How did this end up wrong? --- src/thingdef/thingdef_parse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index f5359a7d8..70f2c050d 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -585,7 +585,7 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cl sc.MustGetToken(';'); PField *sym = cls->AddField(symname, type, 0); - if (cls == NULL) + if (sym == NULL) { sc.ScriptMessage ("'%s' is already defined in '%s'.", symname.GetChars(), cls ? cls->TypeName.GetChars() : "Global"); From 7de8c2b5eb0fc9c62a008f475efa325f67d4cbdb Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 3 Apr 2016 21:35:44 -0500 Subject: [PATCH 3/4] Fixed: || should be && --- src/p_acs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 143683602..2668fd4a1 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4559,7 +4559,7 @@ bool GetVarAddrType(AActor *self, FName varname, int index, void *&addr, PType * addr = baddr; // We don't want Int subclasses like Name or Color to be accessible, // but we do want to support Float subclasses like Fixed. - if (!type->IsA(RUNTIME_CLASS(PInt)) || !type->IsKindOf(RUNTIME_CLASS(PFloat))) + if (!type->IsA(RUNTIME_CLASS(PInt)) && !type->IsKindOf(RUNTIME_CLASS(PFloat))) { // For reading, we also support Name and String types. if (readonly && (type->IsA(RUNTIME_CLASS(PName)) || type->IsA(RUNTIME_CLASS(PString)))) From c346ac6143b73cb32462d4799f3b64e744ed1eff Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Apr 2016 14:16:43 +0200 Subject: [PATCH 4/4] - fixed: P_TeleportMove must clear the spechits array. This was accidentally deleted during one round of portal refactoring but is essential to prevent multiple teleport activations in one move. Fixing this also allowed removing the fudging that was added to work around the issue in P_TryMove. --- src/p_map.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index c6439d966..ac06b3fb2 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -426,6 +426,8 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra tmf.abovemidtex = false; P_GetFloorCeilingZ(tmf, 0); + spechit.Clear(); // this is needed so that no more specials get activated after crossing a teleporter. + bool StompAlwaysFrags = ((thing->flags2 & MF2_TELESTOMP) || (level.flags & LEVEL_MONSTERSTELEFRAG) || telefrag) && !(thing->flags7 & MF7_NOTELESTOMP); // P_LineOpening requires the thing's z to be the destination z in order to work. @@ -2420,12 +2422,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, line_t *ld = spec.line; // see if the line was crossed - // One more case of trying to preserve some side effects from the original: - // If the reference position is the same as the actor's position before checking the spechits, - // we use the thing's actual position, including all the side effects of the original. - // If some portal transition has to be considered here, we cannot do that and use the reference position stored with the spechit. - bool posisoriginal = (spec.refpos.x == lastpos.x && spec.refpos.y == lastpos.y); - side = posisoriginal? P_PointOnLineSide(thing->X(), thing->Y(), ld) : P_PointOnLineSide(spec.refpos.x, spec.refpos.y, ld); + side = P_PointOnLineSide(spec.refpos.x, spec.refpos.y, ld); oldside = P_PointOnLineSide(spec.oldrefpos.x, spec.oldrefpos.y, ld); if (side != oldside && ld->special && !(thing->flags6 & MF6_NOTRIGGER)) {