diff --git a/.travis.yml b/.travis.yml index 6962cbaff..39b3ee086 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,16 +93,15 @@ matrix: - os: linux compiler: clang env: - - CLANG_VERSION=6.0 + - CLANG_VERSION=7 - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=MinSizeRel -DDYN_OPENAL=NO -DDYN_SNDFILE=NO -DDYN_MPG123=NO -DDYN_FLUIDSYNTH=NO" addons: apt: sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-6.0 + - llvm-toolchain-trusty-7 packages: - - clang-6.0 - - libstdc++-5-dev + - clang-7 - libsdl2-dev - libgme-dev - libopenal-dev diff --git a/src/hwrenderer/data/hw_viewpointbuffer.h b/src/hwrenderer/data/hw_viewpointbuffer.h index 2e1f1e620..3a770ec91 100644 --- a/src/hwrenderer/data/hw_viewpointbuffer.h +++ b/src/hwrenderer/data/hw_viewpointbuffer.h @@ -16,7 +16,7 @@ class GLViewpointBuffer unsigned int mByteSize; TArray mClipPlaneInfo; - unsigned int m2DWidth = ~0u, m2DHeight = ~0u; + int m2DWidth = -1, m2DHeight = -1; unsigned int mBlockSize; diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 5eb8157f5..0f37e3379 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -428,7 +428,7 @@ bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int t switch (change & 3) { case 1: // type is zeroed - ceiling->m_NewSpecial.Clear(); + ceiling->m_NewSpecial = {}; ceiling->m_Type = DCeiling::genCeilingChg0; break; case 2: // type is copied @@ -447,7 +447,7 @@ bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int t switch (change & 3) { case 1: // type is zeroed - ceiling->m_NewSpecial.Clear(); + ceiling->m_NewSpecial = {}; ceiling->m_Type = DCeiling::genCeilingChg0; break; case 2: // type is copied diff --git a/src/p_floor.cpp b/src/p_floor.cpp index d0b6cb077..7141a842e 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -229,7 +229,7 @@ void DFloor::SetFloorChangeType (sector_t *sec, int change) switch (change & 3) { case 1: - m_NewSpecial.Clear(); + m_NewSpecial = {}; m_Type = DFloor::genFloorChg0; break; case 2: @@ -828,7 +828,7 @@ bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed) floor->m_Speed = slimespeed; floor->m_Instant = false; floor->m_Texture = s3->GetTexture(sector_t::floor); - floor->m_NewSpecial.Clear(); + floor->m_NewSpecial = {}; height = s3->FindHighestFloorPoint (&spot); floor->m_FloorDestDist = s2->floorplane.PointToDist (spot, height); floor->StartFloorSound (); diff --git a/src/p_spec.h b/src/p_spec.h index 6dc118658..61cc7b2f0 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -439,7 +439,7 @@ protected: // [RH] Need these for BOOM-ish transferring ceilings FTextureID m_Texture; - secspecial_t m_NewSpecial; + secspecial_t m_NewSpecial{}; // ID int m_Tag; @@ -536,7 +536,7 @@ public: bool m_Hexencrush; bool m_Instant; int m_Direction; - secspecial_t m_NewSpecial; + secspecial_t m_NewSpecial{}; FTextureID m_Texture; double m_FloorDestDist; double m_Speed; diff --git a/src/polyrenderer/scene/poly_cull.cpp b/src/polyrenderer/scene/poly_cull.cpp index 4bda49b7c..6668e2f2b 100644 --- a/src/polyrenderer/scene/poly_cull.cpp +++ b/src/polyrenderer/scene/poly_cull.cpp @@ -164,7 +164,7 @@ void PolyCull::CullSubsector(subsector_t *sub) angle_t angle2 = PointToPseudoAngle(line->v1->fX(), line->v1->fY()); angle_t angle1 = PointToPseudoAngle(line->v2->fX(), line->v2->fY()); bool lineVisible = !IsSegmentCulled(angle1, angle2); - if (lineVisible && line->backsector == nullptr) + if (lineVisible && IsSolidLine(line)) { MarkSegmentCulled(angle1, angle2); } @@ -182,6 +182,52 @@ void PolyCull::CullSubsector(subsector_t *sub) SubsectorDepths[sub->Index()] = subsectorDepth; } +bool PolyCull::IsSolidLine(seg_t *line) +{ + // One-sided + if (!line->backsector) return true; + + // Portal + if (line->linedef && line->linedef->isVisualPortal() && line->sidedef == line->linedef->sidedef[0]) return true; + + double frontCeilingZ1 = line->frontsector->ceilingplane.ZatPoint(line->v1); + double frontFloorZ1 = line->frontsector->floorplane.ZatPoint(line->v1); + double frontCeilingZ2 = line->frontsector->ceilingplane.ZatPoint(line->v2); + double frontFloorZ2 = line->frontsector->floorplane.ZatPoint(line->v2); + + double backCeilingZ1 = line->backsector->ceilingplane.ZatPoint(line->v1); + double backFloorZ1 = line->backsector->floorplane.ZatPoint(line->v1); + double backCeilingZ2 = line->backsector->ceilingplane.ZatPoint(line->v2); + double backFloorZ2 = line->backsector->floorplane.ZatPoint(line->v2); + + // Closed door. + if (backCeilingZ1 <= frontFloorZ1 && backCeilingZ2 <= frontFloorZ2) return true; + if (backFloorZ1 >= frontCeilingZ1 && backFloorZ2 >= frontCeilingZ2) return true; + + // properly render skies (consider door "open" if both ceilings are sky) + if (line->backsector->GetTexture(sector_t::ceiling) == skyflatnum && line->frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false; + + // if door is closed because back is shut: + if (!(backCeilingZ1 <= backFloorZ1 && backCeilingZ2 <= backFloorZ2)) return false; + + // preserve a kind of transparent door/lift special effect: + if (((backCeilingZ1 >= frontCeilingZ1 && backCeilingZ2 >= frontCeilingZ2) || line->sidedef->GetTexture(side_t::top).isValid()) + && ((backFloorZ1 <= frontFloorZ1 && backFloorZ2 <= frontFloorZ2) || line->sidedef->GetTexture(side_t::bottom).isValid())) + { + // killough 1/18/98 -- This function is used to fix the automap bug which + // showed lines behind closed doors simply because the door had a dropoff. + // + // It assumes that Doom has already ruled out a door being closed because + // of front-back closure (e.g. front floor is taller than back ceiling). + + // This fixes the automap floor height bug -- killough 1/18/98: + // killough 4/7/98: optimize: save result in doorclosed for use in r_segs.c + return true; + } + + return false; +} + bool PolyCull::IsSegmentCulled(angle_t startAngle, angle_t endAngle) const { if (startAngle > endAngle) diff --git a/src/polyrenderer/scene/poly_cull.h b/src/polyrenderer/scene/poly_cull.h index 53b14c9cc..81fa19387 100644 --- a/src/polyrenderer/scene/poly_cull.h +++ b/src/polyrenderer/scene/poly_cull.h @@ -56,6 +56,8 @@ private: void MarkViewFrustum(); void InvertSegments(); + static bool IsSolidLine(seg_t *line); + bool IsSegmentCulled(angle_t angle1, angle_t angle2) const; void CullNode(void *node); diff --git a/src/polyrenderer/scene/poly_model.cpp b/src/polyrenderer/scene/poly_model.cpp index 28288504e..39695c016 100644 --- a/src/polyrenderer/scene/poly_model.cpp +++ b/src/polyrenderer/scene/poly_model.cpp @@ -39,6 +39,7 @@ void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_ renderer.AddLights(actor); renderer.RenderModel(x, y, z, smf, actor, r_viewpoint.TicFrac); PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f); + PolyTriangleDrawer::SetTransform(thread->DrawQueue, thread->FrameMemory->NewObject(worldToClip), nullptr); } void PolyRenderHUDModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, DPSprite *psp, float ofsx, float ofsy) diff --git a/src/r_defs.h b/src/r_defs.h index 6c1d0da67..ffd504ea4 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -588,16 +588,6 @@ struct secspecial_t short damageinterval; // Interval for damage application short leakydamage; // chance of leaking through radiation suit int Flags; - - secspecial_t() - { - Clear(); - } - - void Clear() - { - memset(this, 0, sizeof(*this)); - } }; FSerializer &Serialize(FSerializer &arc, const char *key, secspecial_t &spec, secspecial_t *def); diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 30e6f918e..be12d3693 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -2737,8 +2737,8 @@ DEFINE_ACTION_FUNCTION(DObject, S_ChangeMusic) PARAM_PROLOGUE; PARAM_STRING(music); PARAM_INT_DEF(order); - PARAM_BOOL(looping); - PARAM_BOOL(force); + PARAM_BOOL_DEF(looping); + PARAM_BOOL_DEF(force); ACTION_RETURN_BOOL(S_ChangeMusic(music, order, looping, force)); }