From caf2ca0df7adba708f47ce231d2bd3aad8788c42 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 4 Mar 2016 15:11:20 +0100 Subject: [PATCH 1/5] - fixed: CallStateChain must never allow a jumping function to set the chain's overall result to successful. --- src/thingdef/thingdef_codeptr.cpp | 1 + src/thingdef/thingdef_expression.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 98dd60f2de..db1f722f1d 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -146,6 +146,7 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state) if (proto->ReturnTypes[0] == TypeState) { // Function returns a state wantret = &ret[0]; + retval = false; // this is a jump function which never affects the success state. } else if (proto->ReturnTypes[0] == TypeSInt32 || proto->ReturnTypes[0] == TypeBool) { // Function returns an int or bool diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 8239f0e475..7ecc3c3c47 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -3220,7 +3220,7 @@ FxExpression *FxActionSpecialCall::Resolve(FCompileContext& ctx) int DecoCallLineSpecial(VMFrameStack *stack, VMValue *param, int numparam, VMReturn *ret, int numret) { - assert(numparam > 2 && numparam < 7); + assert(numparam > 2 && numparam < 8); assert(numret == 1); assert(param[0].Type == REGT_INT); assert(param[1].Type == REGT_POINTER); From e290bc6fd073bba60b0b8e9b1428d75166f05790 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 4 Mar 2016 15:24:13 +0100 Subject: [PATCH 2/5] - fixed: In Hexen, ThrustThing can not be triggered from the backside of a line. This gets only activated when the HEXENHACK flag is set. For ZDoom maps there is a specific line flag to handle this condition explicitly. --- src/p_lnspec.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 5c1693ac9e..857c8ef876 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1115,6 +1115,10 @@ FUNC(LS_ThrustThing) } else if (it) { + if (level.flags2 & LEVEL2_HEXENHACK && backSide) + { + return false; + } ThrustThingHelper (it, BYTEANGLE(arg0), arg1, arg2); return true; } From d1f17e0b4692d7ea3446e42a69a74ff9570410d1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 4 Mar 2016 16:23:40 +0100 Subject: [PATCH 3/5] - fixed: The checks in P_IsThingSpecial was broken. --- src/p_udmf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 54a2a1a8dc..2c388e1782 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -103,7 +103,7 @@ static char HexenSectorSpecialOk[256]={ static inline bool P_IsThingSpecial(int specnum) { return (specnum >= Thing_Projectile && specnum <= Thing_SpawnNoFog) || - specnum == Thing_SpawnFacing || Thing_ProjectileIntercept || Thing_ProjectileAimed; + specnum == Thing_SpawnFacing || specnum == Thing_ProjectileIntercept || specnum == Thing_ProjectileAimed; } enum From b9c72e372b72e17a7675f785c222c18c60ffc921 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 4 Mar 2016 16:25:23 +0100 Subject: [PATCH 4/5] - fixed bad loop handling in FWeaponSlots::SetFromGameInfo(). --- src/g_shared/a_weapons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index 27f7b088e5..93036b031a 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -1297,7 +1297,7 @@ void FWeaponSlots::SetFromGameInfo() // Append extra weapons to the slots. for (i = 0; i < NUM_WEAPON_SLOTS; ++i) { - for (unsigned j = 0; j < gameinfo.DefaultWeaponSlots[i].Size(); i++) + for (unsigned j = 0; j < gameinfo.DefaultWeaponSlots[i].Size(); j++) { PClassWeapon *cls = dyn_cast(PClass::FindClass(gameinfo.DefaultWeaponSlots[i][j])); if (cls == NULL) From c455c60480691ef3bd970cb48a6335b12a3b840a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 5 Mar 2016 01:23:27 +0100 Subject: [PATCH 5/5] - fixed: calculating open.range requires signed math. - fixed: FMultiBlockLinesIterator initialized continueup twice but forgot continuedown. - fixed: One of the debug messages in P_AimLineAttack was missing an if (aimdebug). --- src/p_map.cpp | 3 ++- src/p_maputl.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 09a209496a..7894e73829 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3991,7 +3991,8 @@ struct aim_t if (sv_smartaim < 2) { // friends don't aim at friends (except players), at least not first - Printf("Hit friend %s at %f,%f,%f\n", th->GetClass()->TypeName.GetChars(), th->X() / 65536., th->Y() / 65536., th->Z() / 65536.); + if (aimdebug) + Printf("Hit friend %s at %f,%f,%f\n", th->GetClass()->TypeName.GetChars(), th->X() / 65536., th->Y() / 65536., th->Z() / 65536.); SetResult(thing_friend, in->frac, th, thingpitch); } } diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index c6453285eb..ffaa2b4e43 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -265,7 +265,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, } // avoid overflows in the opening. - open.range = (fixed_t)MIN((QWORD)open.top - open.bottom, FIXED_MAX); + open.range = (fixed_t)MIN((SQWORD)open.top - open.bottom, FIXED_MAX); } @@ -874,7 +874,7 @@ void FMultiBlockLinesIterator::startIteratorForGroup(int group) void FMultiBlockLinesIterator::Reset() { - continueup = continueup = true; + continueup = continuedown = true; index = -1; portalflags = 0; startIteratorForGroup(basegroup);