mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 23:32:04 +00:00
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="src\win32;src\sound;src;zlib;src\g_shared;src\g_doom;src\g_raven;src\g_heretic;src\g_hexen;src\g_strife;"jpeg-6b";"game-music-emu";gdtoa;bzip2;lzma\C"
|
||||
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,BACKPATCH,HAVE_FLUIDSYNTH,DYN_FLUIDSYNTH,NO_OPENAL"
|
||||
PreprocessorDefinitions="NOASM,WIN32,_DEBUG,_WIN32,_WINDOWS,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,BACKPATCH,HAVE_FLUIDSYNTH,DYN_FLUIDSYNTH,NO_OPENAL"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="1"
|
||||
EnableFunctionLevelLinking="true"
|
||||
|
|
Loading…
Reference in a new issue