- Updated to ZDoom r3124 (software 3D floors).

- Adapted GZDoom code to changes.


git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1184 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2011-01-29 13:14:31 +00:00
parent ced25f823f
commit 3764a7484d
32 changed files with 1800 additions and 426 deletions

View file

@ -55,6 +55,7 @@
#include "r_bsp.h"
#include "r_plane.h"
#include "r_segs.h"
#include "r_3dfloors.h"
#include "v_palette.h"
#ifdef _MSC_VER
@ -173,6 +174,7 @@ void R_InitPlanes ()
void R_DeinitPlanes ()
{
fakeActive = 0;
R_ClearPlanes(false);
for (visplane_t *pl = freetail; pl != NULL; )
{
@ -467,6 +469,9 @@ void R_ClearPlanes (bool fullclear)
{
int i, max;
// kg3D - we can't just clear planes if there are fake planes
if(!fullclear && fakeActive) return;
max = fullclear ? MAXVISPLANES : MAXVISPLANES-1;
for (i = 0; i <= max; i++) // new code -- killough
for (*freehead = visplanes[i], visplanes[i] = NULL; *freehead; )
@ -560,7 +565,11 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
{
plane = height;
isskybox = false;
sky = 0; // not skyflatnum so it can't be a sky
// kg3D - hack, store alpha in sky
// i know there is ->alpha, but this also allows to identify fake plane
// and ->alpha is for stacked sectors
if (fake3D & (FAKE3D_FAKEFLOOR|FAKE3D_FAKECEILING)) sky = 0x80000000 | fakeAlpha;
else sky = 0; // not skyflatnum so it can't be a sky
skybox = NULL;
alpha = FRACUNIT;
}
@ -623,7 +632,10 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
xscale == check->xscale &&
yscale == check->yscale &&
angle == check->angle &&
sky == check->sky
sky == check->sky &&
CurrentMirror == check->CurrentMirror &&
MirrorFlags == check->MirrorFlags &&
CurrentSkybox == check->CurrentSkybox
)
{
return check;
@ -652,6 +664,9 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
check->viewz = stacked_viewz;
check->viewangle = stacked_angle;
check->alpha = alpha;
check->CurrentMirror = CurrentMirror;
check->MirrorFlags = MirrorFlags;
check->CurrentSkybox = CurrentSkybox;
clearbufshort (check->top, viewwidth, 0x7fff);
@ -737,6 +752,9 @@ visplane_t *R_CheckPlane (visplane_t *pl, int start, int stop)
new_pl->viewangle = pl->viewangle;
new_pl->sky = pl->sky;
new_pl->alpha = pl->alpha;
new_pl->CurrentMirror = pl->CurrentMirror;
new_pl->MirrorFlags = pl->MirrorFlags;
new_pl->CurrentSkybox = pl->CurrentSkybox;
pl = new_pl;
pl->minx = start;
pl->maxx = stop;
@ -969,12 +987,45 @@ void R_DrawPlanes ()
{
for (pl = visplanes[i]; pl; pl = pl->next)
{
vpcount++;
R_DrawSinglePlane (pl, OPAQUE, false);
// kg3D - draw only correct planes
if(pl->CurrentMirror != CurrentMirror || pl->CurrentSkybox != CurrentSkybox)
continue;
// kg3D - draw only real planes now
if(pl->sky >= 0) {
vpcount++;
R_DrawSinglePlane (pl, OPAQUE, false);
}
}
}
}
// kg3D - draw all visplanes with "height"
void R_DrawHeightPlanes(fixed_t height)
{
visplane_t *pl;
int i;
ds_color = 3;
for (i = 0; i < MAXVISPLANES; i++)
{
for (pl = visplanes[i]; pl; pl = pl->next)
{
// kg3D - draw only correct planes
if(pl->CurrentSkybox != CurrentSkybox)
continue;
if(pl->sky < 0 && pl->height.Zat0() == height) {
viewx = pl->viewx;
viewy = pl->viewy;
viewangle = pl->viewangle;
MirrorFlags = pl->MirrorFlags;
R_DrawSinglePlane (pl, pl->sky & 0x7FFFFFFF, true);
}
}
}
}
//==========================================================================
//
// R_DrawSinglePlane
@ -1072,6 +1123,8 @@ void R_DrawSkyBoxes ()
if (visplanes[MAXVISPLANES] == NULL)
return;
R_3D_EnterSkybox();
int savedextralight = extralight;
fixed_t savedx = viewx;
fixed_t savedy = viewy;
@ -1160,7 +1213,6 @@ void R_DrawSkyBoxes ()
// Create a drawseg to clip sprites to the sky plane
R_CheckDrawSegs ();
R_CheckOpenings ((pl->maxx - pl->minx + 1)*2);
ds_p->siz1 = INT_MAX;
ds_p->siz2 = INT_MAX;
ds_p->sz1 = 0;
@ -1190,6 +1242,7 @@ void R_DrawSkyBoxes ()
visplaneStack.Push (pl);
R_RenderBSPNode (nodes + numnodes - 1);
R_3D_ResetClip(); // reset clips (floor/ceiling)
R_DrawPlanes ();
sky->bInSkybox = false;
@ -1243,8 +1296,13 @@ void R_DrawSkyBoxes ()
viewangle = savedangle;
R_SetViewAngle ();
R_3D_LeaveSkybox();
if(fakeActive) return;
for (*freehead = visplanes[MAXVISPLANES], visplanes[MAXVISPLANES] = NULL; *freehead; )
freehead = &(*freehead)->next;
}
ADD_STAT(skyboxes)