From 32c32ea73912ed19c1687e2ab6498eee92af62d0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Apr 2016 12:46:32 +0200 Subject: [PATCH 01/16] - fixed some initialization problems with sound. * a position-less sound did not get the listener's position attached. * an unattached sound mixed up y and z coordinates. --- src/s_sound.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index c7ac7cebc5..d1fee071e5 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -665,6 +665,7 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector, if (listener != NULL) { listenpos = listener->Pos(); + *pos = listener->SoundPos(); pgroup = listener->Sector->PortalGroup; } else @@ -1276,7 +1277,8 @@ void S_Sound (const FPolyObj *poly, int channel, FSoundID sound_id, float volume void S_Sound(const DVector3 &pos, int channel, FSoundID sound_id, float volume, float attenuation) { - FVector3 p((float)pos.X, (float)pos.Y, (float)pos.Z); + // The sound system switches Y and Z around. + FVector3 p((float)pos.X, (float)pos.Z, (float)pos.Y); S_StartSound (NULL, NULL, NULL, &p, channel, sound_id, volume, attenuation); } From c346ac6143b73cb32462d4799f3b64e744ed1eff Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Apr 2016 14:16:43 +0200 Subject: [PATCH 02/16] - 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 c6439d9668..ac06b3fb29 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)) { From 21692359ccb1f89bcfb457e78b936f4bacbfe917 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Apr 2016 15:59:59 +0200 Subject: [PATCH 03/16] - fixed A_Face angle calculation. --- src/p_enemy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 784c70fd54..19b9169569 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2820,7 +2820,7 @@ void A_Face(AActor *self, AActor *other, DAngle max_turn, DAngle max_pitch, DAng self->flags &= ~MF_AMBUSH; DAngle other_angle = self->AngleTo(other); - DAngle delta = deltaangle(self->Angles.Yaw, other_angle); + DAngle delta = -deltaangle(self->Angles.Yaw, other_angle); // 0 means no limit. Also, if we turn in a single step anyways, no need to go through the algorithms. // It also means that there is no need to check for going past the other. From 2dff6a08d1dc9bda8eba3ca29dc85fb8e2536b17 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Apr 2016 16:51:25 +0200 Subject: [PATCH 04/16] - fixed: P_RadiusAttack passed the wrong radius value to the BlockThingsIterator. --- src/p_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 37ba513d79..26c08af260 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -5046,7 +5046,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo double bombdamagefloat = (double)bombdamage; FPortalGroupArray grouplist(FPortalGroupArray::PGA_Full3d); - FMultiBlockThingsIterator it(grouplist, bombspot->X(), bombspot->Y(), bombspot->Z() - bombdistance, bombspot->Height + bombdistance*2, bombdistancefloat, false, bombspot->Sector); + FMultiBlockThingsIterator it(grouplist, bombspot->X(), bombspot->Y(), bombspot->Z() - bombdistance, bombspot->Height + bombdistance*2, bombdistance, false, bombspot->Sector); FMultiBlockThingsIterator::CheckResult cres; if (flags & RADF_SOURCEISSPOT) From 6f60253590427d382430ee1dd21bea1df22fb090 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 4 Apr 2016 14:57:43 -0500 Subject: [PATCH 05/16] Don't waste time looking for variables to (de)init in native classes --- src/dobjtype.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index fbc3ceb730..030016e462 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -3396,16 +3396,20 @@ DObject *PClass::CreateNew() const // // PClass :: InitializeSpecials // -// Initialize special fields of a newly-created instance (e.g. strings). +// Initialize special fields (e.g. strings) of a newly-created instance. // //========================================================================== void PClass::InitializeSpecials(void *addr) const { - if (ParentClass != NULL) + // Once we reach a native class, we can stop going up the family tree, + // since native classes handle initialization natively. + if (!bRuntimeClass) { - ParentClass->InitializeSpecials(addr); + return; } + assert(ParentClass != NULL); + ParentClass->InitializeSpecials(addr); for (auto tao : SpecialInits) { tao.first->InitializeValue((BYTE*)addr + tao.second, Defaults + tao.second); @@ -3416,19 +3420,27 @@ void PClass::InitializeSpecials(void *addr) const // // PClass :: DestroySpecials // +// Destroy special fields (e.g. strings) of an instance that is about to be +// deleted. +// //========================================================================== void PClass::DestroySpecials(void *addr) const { - if (ParentClass != NULL) + // Once we reach a native class, we can stop going up the family tree, + // since native classes handle deinitialization natively. + if (!bRuntimeClass) { - ParentClass->DestroySpecials(addr); + return; } + assert(ParentClass != NULL); + ParentClass->DestroySpecials(addr); for (auto tao : SpecialInits) { tao.first->DestroyValue((BYTE *)addr + tao.second); } } + //========================================================================== // // PClass :: Derive From 57e0c978679f5f6fac43922a5e1b3f3dce0b16ab Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 4 Apr 2016 15:13:36 -0500 Subject: [PATCH 06/16] Fixed: DECORATE property error messages fail to show the file information --- src/thingdef/thingdef_parse.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index 70f2c050dd..0eeddd85c2 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -824,6 +824,7 @@ static bool ParsePropertyParams(FScanner &sc, FPropertyInfo *prop, AActor *defau conv.s = NULL; pref.s = NULL; pref.i = -1; + bag.ScriptPosition = sc; switch ((*p) & 223) { case 'X': // Expression in parentheses or number. From 3c8423d810613cc1d20919379191ad3264457b65 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 4 Apr 2016 15:17:58 -0500 Subject: [PATCH 07/16] Print only one error message when PlayerPawn.Face is not 3 chars long --- src/thingdef/thingdef_properties.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index d84e10493a..489a1ada44 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -2358,14 +2358,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, face, S, PlayerPawn) FString tmp = str; tmp.ToUpper(); - if (tmp.Len() != 3) - { - bag.ScriptPosition.Message(MSG_WARNING, - "Invalid face '%s' for '%s';\nSTF replacement codes must be 3 characters.\n", - tmp.GetChars(), info->TypeName.GetChars ()); - } - - bool valid = ( + bool valid = (tmp.Len() == 3 && (((tmp[0] >= 'A') && (tmp[0] <= 'Z')) || ((tmp[0] >= '0') && (tmp[0] <= '9'))) && (((tmp[1] >= 'A') && (tmp[1] <= 'Z')) || ((tmp[1] >= '0') && (tmp[1] <= '9'))) && (((tmp[2] >= 'A') && (tmp[2] <= 'Z')) || ((tmp[2] >= '0') && (tmp[2] <= '9'))) @@ -2373,7 +2366,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, face, S, PlayerPawn) if (!valid) { bag.ScriptPosition.Message(MSG_WARNING, - "Invalid face '%s' for '%s';\nSTF replacement codes must be alphanumeric.\n", + "Invalid face '%s' for '%s';\nSTF replacement codes must be 3 alphanumeric characters.\n", tmp.GetChars(), info->TypeName.GetChars ()); } From d39694a33d5c43815110bccc3432e8091b904905 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 4 Apr 2016 15:51:03 -0500 Subject: [PATCH 08/16] Fixed: DoTakeInventory() indicated success when passed an invalid item type --- src/thingdef/thingdef_codeptr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index c09615067a..653bac685f 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2112,7 +2112,7 @@ bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS) if (itemtype == NULL) { - return true; + return false; } if (!orresult) { From 55cbeb0253288e7828875b0b6d41891876c18c8b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Apr 2016 23:07:21 +0200 Subject: [PATCH 09/16] - fixed pitch calculation in P_SeekerMissile with SMF_PRECISE. --- src/p_mobj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 0bbda1568c..bacef28e40 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1675,7 +1675,7 @@ bool P_SeekerMissile (AActor *actor, double thresh, double turnMax, bool precise } pitch = DVector2(dist, target->Z() + aimheight - actor->Center()).Angle(); } - actor->Vel3DFromAngle(pitch, speed); + actor->Vel3DFromAngle(-pitch, speed); } return true; From 1d83ea6177a400981856db069f77f378f408b7a7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 5 Apr 2016 10:16:48 +0200 Subject: [PATCH 10/16] - fixed: ACS's SpawnProjectile and Thing_Projectile2 functions were treated as fixed point even though they are not. --- src/p_acs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 2c7f8633d3..40fe650c1e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -9073,14 +9073,14 @@ scriptwait: // projectile a TID. // Thing_Projectile2 (tid, type, angle, speed, vspeed, gravity, newtid); P_Thing_Projectile(STACK(7), activator, STACK(6), NULL, STACK(5) * (360. / 256.), - ACSToDouble(STACK(4)) / 8., ACSToDouble(STACK(3)) / 8., 0, NULL, STACK(2), STACK(1), false); + STACK(4) / 8., STACK(3) / 8., 0, NULL, STACK(2), STACK(1), false); sp -= 7; break; case PCD_SPAWNPROJECTILE: // Same, but takes an actor name instead of a spawn ID. P_Thing_Projectile(STACK(7), activator, 0, FBehavior::StaticLookupString(STACK(6)), STACK(5) * (360. / 256.), - ACSToDouble(STACK(4)) / 8., ACSToDouble(STACK(3)) / 8., 0, NULL, STACK(2), STACK(1), false); + STACK(4) / 8., STACK(3) / 8., 0, NULL, STACK(2), STACK(1), false); sp -= 7; break; From f606ba315f18c4c070395f5b42c1c41a85017ab0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 5 Apr 2016 10:55:13 +0200 Subject: [PATCH 11/16] - fixed: The return value of sector_t::FindHighestFloorPoint lost its '-' sign during the floating point conversion. --- src/p_sectors.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 87c0c45bd6..357b608723 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -624,7 +624,7 @@ double sector_t::FindHighestFloorPoint (vertex_t **v) const if (linecount == 0) *v = &vertexes[0]; else *v = lines[0]->v1; } - return floorplane.fD(); + return -floorplane.fD(); } for (i = 0; i < linecount; i++) From ad13a55f0d40274ecae0930ca21db51ff7bac2a4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 5 Apr 2016 14:03:08 +0200 Subject: [PATCH 12/16] - floatified line_t::dx and dy. --- src/r_defs.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/r_defs.h b/src/r_defs.h index d6c4b62217..2719ff7ee0 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1278,7 +1278,7 @@ struct line_t { vertex_t *v1, *v2; // vertices, from v1 to v2 private: - fixed_t dx, dy; // precalculated v2 - v1 for side checking + DVector2 delta; // precalculated v2 - v1 for side checking public: DWORD flags; DWORD activation; // activation type @@ -1294,19 +1294,12 @@ public: DVector2 Delta() const { - return{ FIXED2DBL(dx), FIXED2DBL(dy) }; - } - - void setDelta(fixed_t x, fixed_t y) - { - dx = x; - dy = y; + return delta; } void setDelta(double x, double y) { - dx = FLOAT2FIXED(x); - dy = FLOAT2FIXED(y); + delta = { x, y }; } void setAlpha(double a) From 04b0a13bd36fee07c057fcd7310291858924f4dd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 5 Apr 2016 16:29:07 +0200 Subject: [PATCH 13/16] - some optimization of FPathTraverse: * we do not really need compatibility PointOnLineSide here. Unlike the movement code it'd only affect some extreme edge cases. * removed the special case for very short traces. This was a result of the original and very imprecise PointOnLine functions. Since those no longer get used here and floating point precision is a lot higher there is no need for this kind of treatment. * PointOnLine checks for the sides of an actor's bounding box don't need a full PointOnLineSide call, a simple coordinate comparison is fully sufficient, and this can easily be done in the existing switch/case block. --- src/p_maputl.cpp | 170 +++++++++++++---------------------------------- 1 file changed, 45 insertions(+), 125 deletions(-) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index f51baac160..97c2af1045 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -65,21 +65,6 @@ int P_AproxDistance (int dx, int dy) return (dx < dy) ? dx+dy-(dx>>1) : dx+dy-(dy>>1); } -//========================================================================== -// -// P_PointOnDivlineSideCompat -// -// Returns the fractional intercept point along the first divline -// with compatibility flag handling -// -//========================================================================== - -inline int P_PointOnDivlineSideCompat(double x, double y, const divline_t *line) -{ - return (i_compatflags2 & COMPATF2_POINTONLINE) - ? P_VanillaPointOnDivlineSide(x, y, line) : P_PointOnDivlineSide(x, y, line); -} - //========================================================================== // // P_InterceptVector @@ -1168,20 +1153,8 @@ void FPathTraverse::AddLineIntercepts(int bx, int by) double frac; divline_t dl; - // avoid precision problems with two routines - if ( trace.dx > 16 - || trace.dy > 16 - || trace.dx < -16 - || trace.dy < -16) - { - s1 = P_PointOnDivlineSideCompat (ld->v1->fX(), ld->v1->fY(), &trace); - s2 = P_PointOnDivlineSideCompat (ld->v2->fX(), ld->v2->fY(), &trace); - } - else - { - s1 = P_PointOnLineSide (trace.x, trace.y, ld); - s2 = P_PointOnLineSide (trace.x+trace.dx, trace.y+trace.dy, ld); - } + s1 = P_PointOnDivlineSide (ld->v1->fX(), ld->v1->fY(), &trace); + s2 = P_PointOnDivlineSide (ld->v2->fX(), ld->v2->fY(), &trace); if (s1 == s2) continue; // line isn't crossed @@ -1232,81 +1205,82 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it switch (i) { case 0: // Top edge - line.x = thing->X() + thing->radius; line.y = thing->Y() + thing->radius; + if (trace.y < line.y) continue; + line.x = thing->X() + thing->radius; line.dx = -thing->radius * 2; line.dy = 0; break; case 1: // Right edge line.x = thing->X() + thing->radius; + if (trace.x < line.x) continue; line.y = thing->Y() - thing->radius; line.dx = 0; line.dy = thing->radius * 2; break; case 2: // Bottom edge - line.x = thing->X() - thing->radius; line.y = thing->Y() - thing->radius; + if (trace.y > line.y) continue; + line.x = thing->X() - thing->radius; line.dx = thing->radius * 2; line.dy = 0; break; case 3: // Left edge line.x = thing->X() - thing->radius; + if (trace.x > line.x) continue; line.y = thing->Y() + thing->radius; line.dx = 0; line.dy = thing->radius * -2; break; } // Check if this side is facing the trace origin - if (P_PointOnDivlineSide (trace.x, trace.y, &line) == 0) + numfronts++; + + // If it is, see if the trace crosses it + if (P_PointOnDivlineSide (line.x, line.y, &trace) != + P_PointOnDivlineSide (line.x + line.dx, line.y + line.dy, &trace)) { - numfronts++; - - // If it is, see if the trace crosses it - if (P_PointOnDivlineSide (line.x, line.y, &trace) != - P_PointOnDivlineSide (line.x + line.dx, line.y + line.dy, &trace)) - { - // It's a hit - double frac = P_InterceptVector (&trace, &line); - if (frac < Startfrac) - { // behind source - if (Startfrac > 0) + // It's a hit + double frac = P_InterceptVector (&trace, &line); + if (frac < Startfrac) + { // behind source + if (Startfrac > 0) + { + // check if the trace starts within this actor + switch (i) { - // check if the trace starts within this actor - switch (i) - { - case 0: - line.y -= 2 * thing->radius; - break; + case 0: + line.y -= 2 * thing->radius; + break; - case 1: - line.x -= 2 * thing->radius; - break; + case 1: + line.x -= 2 * thing->radius; + break; - case 2: - line.y += 2 * thing->radius; - break; + case 2: + line.y += 2 * thing->radius; + break; - case 3: - line.x += 2 * thing->radius; - break; - } - double frac2 = P_InterceptVector(&trace, &line); - if (frac2 >= Startfrac) goto addit; + case 3: + line.x += 2 * thing->radius; + break; } - continue; + double frac2 = P_InterceptVector(&trace, &line); + if (frac2 >= Startfrac) goto addit; } - addit: - intercept_t newintercept; - newintercept.frac = frac; - newintercept.isaline = false; - newintercept.done = false; - newintercept.d.thing = thing; - intercepts.Push (newintercept); continue; } + addit: + intercept_t newintercept; + newintercept.frac = frac; + newintercept.isaline = false; + newintercept.done = false; + newintercept.d.thing = thing; + intercepts.Push (newintercept); + break; } } @@ -1350,8 +1324,8 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it y2 = thing->Y() + thing->radius; } - s1 = P_PointOnDivlineSideCompat (x1, y1, &trace); - s2 = P_PointOnDivlineSideCompat (x2, y2, &trace); + s1 = P_PointOnDivlineSide (x1, y1, &trace); + s2 = P_PointOnDivlineSide (x2, y2, &trace); if (s1 != s2) { @@ -1894,60 +1868,6 @@ int P_VanillaPointOnLineSide(double x, double y, const line_t* line) return 1; // back side } -//=========================================================================== -// -// P_VanillaPointOnDivlineSide -// P_PointOnDivlineSideCompat() from the initial Doom source code release -// -//=========================================================================== - -int P_VanillaPointOnDivlineSide(double x, double y, const divline_t* line) -{ - int dx; - int dy; - int left; - int right; - int ldx; - int ldy; - - if (!line->dx) - { - if (x <= line->x) - return line->dy > 0; - - return line->dy < 0; - } - if (!line->dy) - { - if (y <= line->y) - return line->dx < 0; - - return line->dx > 0; - } - - // This is supposed to be compatible so the rest needs to be done - // with the same broken fixed point checks as the original - dx = FloatToFixed(x - line->x); - dy = FloatToFixed(y - line->y); - ldx = FloatToFixed(line->dx); - ldy = FloatToFixed(line->dy); - - // try to quickly decide by looking at sign bits - if ( (ldy ^ ldx ^ dx ^ dy)&0x80000000 ) - { - if ( (ldy ^ dx) & 0x80000000 ) - return 1; // (left is negative) - return 0; - } - - left = MulScale16( ldy>>8, dx>>8 ); - right = MulScale16( dy>>8 , ldx>>8 ); - - if (right < left) - return 0; // front side - return 1; // back side -} - //========================================================================== // // Use buggy PointOnSide and fix actors that lie on From d4a2e9696ec20701e5fc8d062d0583b99cff80f3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 5 Apr 2016 22:27:11 +0200 Subject: [PATCH 14/16] - removed 'inline' from P_Teleport declaration. --- src/p_spec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.h b/src/p_spec.h index c934d73126..4098319434 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -836,7 +836,7 @@ enum //Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false). void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele = true, bool setTarget = false); -inline bool P_Teleport(AActor *thing, DVector3 pos, DAngle angle, int flags); +bool P_Teleport(AActor *thing, DVector3 pos, DAngle angle, int flags); bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int flags); bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse); bool EV_TeleportOther (int other_tid, int dest_tid, bool fog); From 8cbdbdaf7085ec3f532e15d1a4a4693f78f350a8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 Apr 2016 13:19:09 +0200 Subject: [PATCH 15/16] - fixed: The PathTraverse and sight checking code may not assume that ceiling(x) == floor(x)+1. This will fail when a trace starts directly on a block boundary in which case x is a whole number. It should always use 'floor(x)+1' to ensure that the calculated point is at the right or upper edge of a block. --- src/p_maputl.cpp | 5 ++--- src/p_sight.cpp | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 97c2af1045..1235915c27 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -1452,7 +1452,7 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags, if (mapex > mapx) { mapxstep = 1; - partialx = xs_CeilToInt(xt1) - xt1; + partialx = 1. - xt1 + xs_FloorToInt(xt1); ystep = (y2 - y1) / fabs(x2 - x1); } else if (mapex < mapx) @@ -1469,11 +1469,10 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags, } yintercept = yt1 + partialx * ystep; - if (mapey > mapy) { mapystep = 1; - partialy = xs_CeilToInt(yt1) - yt1; + partialy = 1. - yt1 + xs_FloorToInt(yt1); xstep = (x2 - x1) / fabs(y2 - y1); } else if (mapey < mapy) diff --git a/src/p_sight.cpp b/src/p_sight.cpp index 57106b2cf0..f8d2043fd0 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -651,7 +651,7 @@ bool SightCheck::P_SightPathTraverse () if (mapex > mapx) { mapxstep = 1; - partialx = xs_CeilToInt(xt1) - xt1; + partialx = 1. - xt1 + xs_FloorToInt(xt1); ystep = (y2 - y1) / fabs(x2 - x1); } else if (mapex < mapx) @@ -671,7 +671,7 @@ bool SightCheck::P_SightPathTraverse () if (mapey > mapy) { mapystep = 1; - partialy = xs_CeilToInt(yt1) - yt1; + partialy = 1. - yt1 + xs_FloorToInt(yt1); xstep = (x2 - x1) / fabs(y2 - y1); } else if (mapey < mapy) From 8ad49f5d333f120f1a03cc9f9103ad3b046d1048 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 Apr 2016 13:21:17 +0200 Subject: [PATCH 16/16] - removed a leftover line from before the floating point conversion in p_user.cpp. --- src/p_user.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_user.cpp b/src/p_user.cpp index 63f05ef321..64c4f3a116 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1510,7 +1510,6 @@ void APlayerPawn::TweakSpeeds (double &forward, double &side) } if (fabs(side) < 0x2800) - if ((unsigned int)(side + 0x27ff) < 0x4fff) { side *= SideMove1; }