Fixed potential divide by 0 when drawing voxels
- Since voxels can have their origin behind the viewer and still have a
portion visible in front of the viewer, they aren't clipped to MINZ like
face sprites are. The 3D floor handling in R_DrawSprite() neglected to
clamp it when recalculating the diminished light colormap.
- Aside, but R_DrawSprite() probably shouldn't be messing with these
properties at all. Why isn't this done in R_ProjectSprite() before it
ever gets to the drawing part?
This commit is contained in:
parent
1d0a3d19c8
commit
0b9aeb33e1
2 changed files with 4 additions and 3 deletions
|
|
@ -673,7 +673,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
fixedvec3 pos = thing->InterpolatedPosition(r_TicFrac);
|
||||
fx = pos.x;
|
||||
fy = pos.y;
|
||||
fz = pos.z +thing->GetBobOffset(r_TicFrac);
|
||||
fz = pos.z + thing->GetBobOffset(r_TicFrac);
|
||||
|
||||
tex = NULL;
|
||||
voxel = NULL;
|
||||
|
|
@ -960,6 +960,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
vis->fakeceiling = fakeceiling;
|
||||
vis->ColormapNum = 0;
|
||||
vis->bInMirror = MirrorFlags & RF_XFLIP;
|
||||
vis->bSplitSprite = false;
|
||||
|
||||
if (voxel != NULL)
|
||||
{
|
||||
|
|
@ -1895,7 +1896,7 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
{ // diminished light
|
||||
spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight);
|
||||
spr->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP (
|
||||
(fixed_t)DivScale12 (r_SpriteVisibility, spr->depth), spriteshade) << COLORMAPSHIFT);
|
||||
(fixed_t)DivScale12 (r_SpriteVisibility, MAX(MINZ, spr->depth)), spriteshade) << COLORMAPSHIFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue