diff --git a/src/posix/cocoa/i_main.mm b/src/posix/cocoa/i_main.mm index 1c418b91b..0b49a6d21 100644 --- a/src/posix/cocoa/i_main.mm +++ b/src/posix/cocoa/i_main.mm @@ -156,6 +156,7 @@ static void I_DetectOS() case 10: name = "OS X Yosemite"; break; case 11: name = "OS X El Capitan"; break; case 12: name = "macOS Sierra"; break; + case 13: name = "macOS High Sierra"; break; } char release[16] = "unknown"; diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index d8bff43d4..d8af38b11 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -942,7 +942,9 @@ void R_InitTranslationTables () IcePaletteRemap[i] = ColorMatcher.Pick (IcePalette[i][0], IcePalette[i][1], IcePalette[i][2]); } FRemapTable *remap = translationtables[TRANSLATION_Standard][7]; - for (i = 0; i < 256; ++i) + remap->Remap[0] = 0; + remap->Palette[0] = 0; + for (i = 1; i < 256; ++i) { int r = GPalette.BaseColors[i].r; int g = GPalette.BaseColors[i].g; @@ -955,7 +957,9 @@ void R_InitTranslationTables () // The alphatexture translation. Since alphatextures use the red channel this is just a standard grayscale mapping. PushIdentityTable(TRANSLATION_Standard); remap = translationtables[TRANSLATION_Standard][8]; - for (i = 0; i < 256; i++) + remap->Remap[0] = 0; + remap->Palette[0] = 0; + for (i = 1; i < 256; i++) { remap->Remap[i] = i; remap->Palette[i] = PalEntry(255, i, i, i); diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index f1d30d7c4..4a1cc7d77 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -3071,6 +3071,7 @@ FxExpression *FxMulDiv::Resolve(FCompileContext& ctx) } } ValueType = left->ValueType; + break; } else if (right->IsVector() && left->IsNumeric()) { @@ -3085,8 +3086,9 @@ FxExpression *FxMulDiv::Resolve(FCompileContext& ctx) } } ValueType = right->ValueType; + break; } - break; + // Incompatible operands, intentional fall-through default: // Vector modulus is not permitted diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index bebb9580f..7d6d6b461 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -72,20 +72,6 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); EXTERN_CVAR(Bool, r_drawvoxels); -namespace { double sprite_distance_cull = 1e16; } - -CUSTOM_CVAR(Float, r_sprite_distance_cull, 5000.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) -{ - if (r_sprite_distance_cull > 0.0) - { - sprite_distance_cull = r_sprite_distance_cull * r_sprite_distance_cull; - } - else - { - sprite_distance_cull = 1e16; - } -} - namespace swrenderer { RenderOpaquePass::RenderOpaquePass(RenderThread *thread) : renderline(thread) @@ -950,10 +936,6 @@ namespace swrenderer if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && !!P_PointOnLineSidePrecise(thing->Pos(), renderportal->CurrentPortal->dst)) return false; - double distanceSquared = (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared(); - if (distanceSquared > sprite_distance_cull) - return false; - return true; } diff --git a/src/swrenderer/scene/r_translucent_pass.cpp b/src/swrenderer/scene/r_translucent_pass.cpp index 905974571..b395e0b6d 100644 --- a/src/swrenderer/scene/r_translucent_pass.cpp +++ b/src/swrenderer/scene/r_translucent_pass.cpp @@ -134,13 +134,42 @@ namespace swrenderer void RenderTranslucentPass::DrawMaskedSingle(bool renew) { RenderPortal *renderportal = Thread->Portal.get(); + DrawSegmentList *drawseglist = Thread->DrawSegments.get(); + + int numGroups = drawseglist->SegmentGroups.Size(); + for (int j = 0; j < numGroups; j++) + drawseglist->SegmentGroups[j].GroupDrawn = false; auto &sortedSprites = Thread->SpriteList->SortedSprites; for (int i = sortedSprites.Size(); i > 0; i--) { - if (sortedSprites[i - 1]->IsCurrentPortalUniq(renderportal->CurrentPortalUniq)) + VisibleSprite *sprite = sortedSprites[i - 1]; + + // Draw the draw segments known to be behind us now. + for (int j = numGroups; j > 0; j--) { - sortedSprites[i - 1]->Render(Thread); + auto &group = drawseglist->SegmentGroups[j - 1]; + if (!group.GroupDrawn && group.neardepth > sprite->DrawSegDepth()) + { + for (unsigned int index = group.BeginIndex; index != group.EndIndex; index++) + { + DrawSegment *ds = drawseglist->Segment(index); + + if (ds->CurrentPortalUniq != renderportal->CurrentPortalUniq) continue; + if (ds->fake) continue; + if (ds->maskedtexturecol != nullptr || ds->bFogBoundary) + { + RenderDrawSegment renderer(Thread); + renderer.Render(ds, ds->x1, ds->x2); + } + } + group.GroupDrawn = true; + } + } + + if (sprite->IsCurrentPortalUniq(renderportal->CurrentPortalUniq)) + { + sprite->Render(Thread); } } @@ -151,7 +180,6 @@ namespace swrenderer Thread->Clip3D->fake3D |= FAKE3D_REFRESHCLIP; } - DrawSegmentList *drawseglist = Thread->DrawSegments.get(); for (unsigned int index = 0; index != drawseglist->SegmentsCount(); index++) { DrawSegment *ds = drawseglist->Segment(index); diff --git a/src/swrenderer/segments/r_drawsegment.h b/src/swrenderer/segments/r_drawsegment.h index 5480ac4f2..2c6fcdaa7 100644 --- a/src/swrenderer/segments/r_drawsegment.h +++ b/src/swrenderer/segments/r_drawsegment.h @@ -63,6 +63,7 @@ namespace swrenderer short *sprbottomclip; unsigned int BeginIndex; unsigned int EndIndex; + bool GroupDrawn; }; class DrawSegmentList diff --git a/src/swrenderer/things/r_visiblesprite.cpp b/src/swrenderer/things/r_visiblesprite.cpp index 26a5d76be..f7ae8547b 100644 --- a/src/swrenderer/things/r_visiblesprite.cpp +++ b/src/swrenderer/things/r_visiblesprite.cpp @@ -296,7 +296,7 @@ namespace swrenderer for (unsigned int groupIndex = 0; groupIndex < segmentlist->SegmentGroups.Size(); groupIndex++) { auto &group = segmentlist->SegmentGroups[groupIndex]; - if (group.x1 >= x2 || group.x2 <= x1) + if (group.x1 >= x2 || group.x2 <= x1 || group.neardepth > spr->depth) continue; if (group.fardepth < spr->depth) @@ -335,11 +335,6 @@ namespace swrenderer { DrawSegment *ds = segmentlist->Segment(index); - // [ZZ] portal handling here - //if (ds->CurrentPortalUniq != spr->CurrentPortalUniq) - // continue; - // [ZZ] WARNING: uncommenting the two above lines, totally breaks sprite clipping - // kg3D - no clipping on fake segs if (ds->fake) continue; // determine if the drawseg obscures the sprite @@ -380,8 +375,7 @@ namespace swrenderer RenderPortal *renderportal = thread->Portal.get(); // seg is behind sprite, so draw the mid texture if it has one - if (ds->CurrentPortalUniq == renderportal->CurrentPortalUniq && // [ZZ] instead, portal uniq check is made here - (ds->maskedtexturecol != nullptr || ds->bFogBoundary)) + if (ds->CurrentPortalUniq == renderportal->CurrentPortalUniq && (ds->maskedtexturecol != nullptr || ds->bFogBoundary)) { RenderDrawSegment renderer(thread); renderer.Render(ds, r1, r2); diff --git a/src/swrenderer/things/r_visiblesprite.h b/src/swrenderer/things/r_visiblesprite.h index f9490472c..f31d08b58 100644 --- a/src/swrenderer/things/r_visiblesprite.h +++ b/src/swrenderer/things/r_visiblesprite.h @@ -46,6 +46,8 @@ namespace swrenderer double SortDist2D() const { return DVector2(deltax, deltay).LengthSquared(); } float SortDist() const { return idepth; } + float DrawSegDepth() const { return depth; } + protected: virtual bool IsParticle() const { return false; } virtual bool IsVoxel() const { return false; }