mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-01-31 18:50:33 +00:00
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.
This commit is contained in:
parent
bf629d2590
commit
66c4bc1fee
1 changed files with 9 additions and 11 deletions
|
@ -1294,7 +1294,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
||||||
WORD flip;
|
WORD flip;
|
||||||
FTexture* tex;
|
FTexture* tex;
|
||||||
vissprite_t* vis;
|
vissprite_t* vis;
|
||||||
static vissprite_t avis[NUMPSPRITES];
|
static vissprite_t avis[NUMPSPRITES+1];
|
||||||
bool noaccel;
|
bool noaccel;
|
||||||
|
|
||||||
assert(pspnum >= 0 && pspnum < NUMPSPRITES);
|
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;
|
tx -= tex->GetScaledLeftOffset() << FRACBITS;
|
||||||
x1 = (centerxfrac + FixedMul (tx, pspritexscale)) >>FRACBITS;
|
x1 = (centerxfrac + FixedMul (tx, pspritexscale)) >>FRACBITS;
|
||||||
VisPSpritesX1[pspnum] = x1;
|
|
||||||
|
|
||||||
// off the right side
|
// off the right side
|
||||||
if (x1 > viewwidth)
|
if (x1 > viewwidth)
|
||||||
|
@ -1339,14 +1338,12 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// store information in a vissprite
|
// store information in a vissprite
|
||||||
vis = &avis[pspnum];
|
vis = &avis[NUMPSPRITES];
|
||||||
vis->renderflags = owner->renderflags;
|
vis->renderflags = owner->renderflags;
|
||||||
vis->floorclip = 0;
|
vis->floorclip = 0;
|
||||||
|
|
||||||
|
|
||||||
vis->texturemid = int(((BASEYCENTER<<FRACBITS) - sy) * tex->Scale.Y) + (tex->TopOffset << FRACBITS);
|
vis->texturemid = int(((BASEYCENTER<<FRACBITS) - sy) * tex->Scale.Y) + (tex->TopOffset << FRACBITS);
|
||||||
|
|
||||||
|
|
||||||
if (camera->player && (RenderTarget != screen ||
|
if (camera->player && (RenderTarget != screen ||
|
||||||
viewheight == RenderTarget->GetHeight() ||
|
viewheight == RenderTarget->GetHeight() ||
|
||||||
(RenderTarget->GetWidth() > 320 && !st_scale)))
|
(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);
|
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
||||||
|
|
||||||
noaccel = false;
|
noaccel = false;
|
||||||
|
FDynamicColormap *colormap_to_use = NULL;
|
||||||
if (pspnum <= ps_flash)
|
if (pspnum <= ps_flash)
|
||||||
{
|
{
|
||||||
vis->Style.Alpha = float(owner->Alpha);
|
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;
|
noaccel = true;
|
||||||
}
|
}
|
||||||
VisPSpritesBaseColormap[pspnum] = mybasecolormap;
|
colormap_to_use = mybasecolormap;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VisPSpritesBaseColormap[pspnum] = basecolormap;
|
colormap_to_use = basecolormap;
|
||||||
vis->Style.colormap = basecolormap->Maps;
|
vis->Style.colormap = basecolormap->Maps;
|
||||||
vis->Style.RenderStyle = STYLE_Normal;
|
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();
|
style.CheckFuzz();
|
||||||
if (style.BlendOp != STYLEOP_Fuzz)
|
if (style.BlendOp != STYLEOP_Fuzz)
|
||||||
{
|
{
|
||||||
VisPSprites[pspnum] = vis;
|
VisPSpritesX1[pspnum] = x1;
|
||||||
|
VisPSpritesBaseColormap[pspnum] = colormap_to_use;
|
||||||
|
VisPSprites[pspnum] = &avis[pspnum];
|
||||||
|
avis[pspnum] = *vis;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1685,9 +1686,6 @@ void R_DrawRemainingPlayerSprites()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_SortVisSprites
|
// R_SortVisSprites
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue