From 2661a94fe93138e161fb3c99545785ab5cdc7fd3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 18 Apr 2016 01:35:37 +0200 Subject: [PATCH 1/4] - call UpdateSectorRenderList from LinkToWorld as well, because this can be called from outside the actor's Tick function. --- src/p_map.cpp | 2 +- src/p_maputl.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 33f69f201..13e31fed2 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -6246,7 +6246,7 @@ void P_CreateSecNodeList(AActor *thing) void AActor::UpdateRenderSectorList() { static const double SPRITE_SPACE = 64.; - if (Pos() != OldRenderPos) + if (Pos() != OldRenderPos && !(flags & MF_NOSECTOR)) { sector_t *sec = Sector; double lasth = -FLT_MAX; diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 759ab5d6c..f3dda49a9 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -499,6 +499,7 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) } } } + UpdateRenderSectorList(); } void AActor::SetOrigin(double x, double y, double z, bool moving) From bf629d259088e3f862a3d4238bdd49787150f78f Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 17 Apr 2016 20:14:25 -0500 Subject: [PATCH 2/4] Use a range instead of strict equality when deciding head sounds - See http://forum.zdoom.org/viewtopic.php?f=7&t=51583 --- src/sound/fmodsound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index d1a4efd17..a62998d3d 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -2090,7 +2090,7 @@ FMOD_MODE FMODSoundRenderer::SetChanHeadSettings(SoundListener *listener, FMOD:: } return oldmode; } - else if (cpos == pos) + else if ((cpos - pos).LengthSquared() < (0.0004 * 0.0004)) { // Head relative return (oldmode & ~FMOD_3D) | FMOD_2D; } From 66c4bc1fee720ed5aaf2b2135449404c5f94e55d Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 17 Apr 2016 20:55:07 -0500 Subject: [PATCH 3/4] Fixed various problems when drawing psprites in a camera texture - When the camera texture for a player view was rendered, its psprites would overwrite the ones stored for hardware acceleration. * Use a temporary vissprite in R_DrawPSprite() until it's known that it will be accelerated. * Do not write to any of the VisPSprites*[] arrays until it's known that the sprite will be accelerated. --- src/r_things.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/r_things.cpp b/src/r_things.cpp index 95b40916e..dafd32fd2 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1294,7 +1294,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ WORD flip; FTexture* tex; vissprite_t* vis; - static vissprite_t avis[NUMPSPRITES]; + static vissprite_t avis[NUMPSPRITES+1]; bool noaccel; assert(pspnum >= 0 && pspnum < NUMPSPRITES); @@ -1325,7 +1325,6 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ tx -= tex->GetScaledLeftOffset() << FRACBITS; x1 = (centerxfrac + FixedMul (tx, pspritexscale)) >>FRACBITS; - VisPSpritesX1[pspnum] = x1; // off the right side if (x1 > viewwidth) @@ -1339,14 +1338,12 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ return; // store information in a vissprite - vis = &avis[pspnum]; + vis = &avis[NUMPSPRITES]; vis->renderflags = owner->renderflags; vis->floorclip = 0; - vis->texturemid = int(((BASEYCENTER<Scale.Y) + (tex->TopOffset << FRACBITS); - if (camera->player && (RenderTarget != screen || viewheight == RenderTarget->GetHeight() || (RenderTarget->GetWidth() > 320 && !st_scale))) @@ -1395,6 +1392,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ vis->startfrac += vis->xiscale*(vis->x1-x1); noaccel = false; + FDynamicColormap *colormap_to_use = NULL; if (pspnum <= ps_flash) { vis->Style.Alpha = float(owner->Alpha); @@ -1491,11 +1489,11 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ { noaccel = true; } - VisPSpritesBaseColormap[pspnum] = mybasecolormap; + colormap_to_use = mybasecolormap; } else { - VisPSpritesBaseColormap[pspnum] = basecolormap; + colormap_to_use = basecolormap; vis->Style.colormap = basecolormap->Maps; vis->Style.RenderStyle = STYLE_Normal; } @@ -1508,7 +1506,10 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ style.CheckFuzz(); if (style.BlendOp != STYLEOP_Fuzz) { - VisPSprites[pspnum] = vis; + VisPSpritesX1[pspnum] = x1; + VisPSpritesBaseColormap[pspnum] = colormap_to_use; + VisPSprites[pspnum] = &avis[pspnum]; + avis[pspnum] = *vis; return; } } @@ -1685,9 +1686,6 @@ void R_DrawRemainingPlayerSprites() } } - - - // // R_SortVisSprites // From c5c032911c4a00b0d2225d6f0d94c91ff6406de1 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 17 Apr 2016 20:59:08 -0500 Subject: [PATCH 4/4] Let the temporary vissprite be stack local --- src/r_things.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/r_things.cpp b/src/r_things.cpp index dafd32fd2..740440273 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1294,7 +1294,8 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ WORD flip; FTexture* tex; vissprite_t* vis; - static vissprite_t avis[NUMPSPRITES+1]; + static vissprite_t avis[NUMPSPRITES]; + vissprite_t tempvis; bool noaccel; assert(pspnum >= 0 && pspnum < NUMPSPRITES); @@ -1338,7 +1339,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ return; // store information in a vissprite - vis = &avis[NUMPSPRITES]; + vis = &tempvis; vis->renderflags = owner->renderflags; vis->floorclip = 0;