MFE_DRAWONLYFORPx stuff ported to OpenGL, and MT_DRIFTDUST respects Boo powers

This commit is contained in:
TehRealSalt 2018-06-11 02:15:27 -04:00
parent e415bae2e5
commit 35eb978c69
2 changed files with 136 additions and 33 deletions

View file

@ -59,7 +59,7 @@ struct hwdriver_s hwdriver;
// ==========================================================================
static void HWR_AddSprites(sector_t *sec);
static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer);
static void HWR_ProjectSprite(mobj_t *thing);
#ifdef HWPRECIP
static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
@ -3234,7 +3234,7 @@ static void HWR_AddPolyObjectPlanes(void)
// : Draw one or more line segments.
// Notes : Sets gr_cursectorlight to the light of the parent sector, to modulate wall textures
// -----------------+
static void HWR_Subsector(size_t num)
static void HWR_Subsector(size_t num, UINT8 ssplayer)
{
INT16 count;
seg_t *line;
@ -3602,7 +3602,7 @@ static void HWR_Subsector(size_t num)
{
// draw sprites first, coz they are clipped to the solidsegs of
// subsectors more 'in front'
HWR_AddSprites(gr_frontsector);
HWR_AddSprites(gr_frontsector, ssplayer);
//Hurdler: at this point validcount must be the same, but is not because
// gr_frontsector doesn't point anymore to sub->sector due to
@ -3654,7 +3654,7 @@ static boolean HWR_CheckHackBBox(fixed_t *bb)
// BP: big hack for a test in lighning ref : 1249753487AB
fixed_t *hwbbox;
static void HWR_RenderBSPNode(INT32 bspnum)
static void HWR_RenderBSPNode(INT32 bspnum, UINT8 ssplayer)
{
/*//GZDoom code
if(bspnum == -1)
@ -3694,12 +3694,12 @@ static void HWR_RenderBSPNode(INT32 bspnum)
if (bspnum == -1)
{
//*(gr_drawsubsector_p++) = 0;
HWR_Subsector(0);
HWR_Subsector(0, ssplayer);
}
else
{
//*(gr_drawsubsector_p++) = bspnum&(~NF_SUBSECTOR);
HWR_Subsector(bspnum&(~NF_SUBSECTOR));
HWR_Subsector(bspnum&(~NF_SUBSECTOR), ssplayer);
}
return;
}
@ -3711,14 +3711,14 @@ static void HWR_RenderBSPNode(INT32 bspnum)
hwbbox = bsp->bbox[side];
// Recursively divide front space.
HWR_RenderBSPNode(bsp->children[side]);
HWR_RenderBSPNode(bsp->children[side], ssplayer);
// Possibly divide back space.
if (HWR_CheckBBox(bsp->bbox[side^1]))
{
// BP: big hack for a test in lighning ref : 1249753487AB
hwbbox = bsp->bbox[side^1];
HWR_RenderBSPNode(bsp->children[side^1]);
HWR_RenderBSPNode(bsp->children[side^1], ssplayer);
}
}
@ -5110,7 +5110,7 @@ static void HWR_DrawSprites(void)
// During BSP traversal, this adds sprites by sector.
// --------------------------------------------------------------------------
static UINT8 sectorlight;
static void HWR_AddSprites(sector_t *sec)
static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer)
{
mobj_t *thing;
#ifdef HWPRECIP
@ -5140,6 +5140,25 @@ static void HWR_AddSprites(sector_t *sec)
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
if (splitscreen)
{
if (thing->eflags & MFE_DRAWONLYFORP1)
if (ssplayer != 1)
continue;
if (thing->eflags & MFE_DRAWONLYFORP2)
if (ssplayer != 2)
continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (ssplayer != 3)
continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (ssplayer != 4)
continue;
}
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
if (approx_dist <= limit_dist)
@ -5150,8 +5169,31 @@ static void HWR_AddSprites(sector_t *sec)
{
// Draw everything in sector, no checks
for (thing = sec->thinglist; thing; thing = thing->snext)
if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW))
HWR_ProjectSprite(thing);
{
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
if (splitscreen)
{
if (thing->eflags & MFE_DRAWONLYFORP1)
if (ssplayer != 1)
continue;
if (thing->eflags & MFE_DRAWONLYFORP2)
if (ssplayer != 2)
continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (ssplayer != 3)
continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (ssplayer != 4)
continue;
}
HWR_ProjectSprite(thing);
}
}
#ifdef HWPRECIP
@ -5666,13 +5708,31 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
{
const float fpov = FIXED_TO_FLOAT(cv_grfov.value+player->fovadd);
postimg_t *type;
UINT8 ssplayer = 0;
if (splitscreen && player == &players[secondarydisplayplayer])
type = &postimgtype2;
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
type = &postimgtype3;
else if (splitscreen > 2 && player == &players[fourthdisplayplayer])
type = &postimgtype4;
if (splitscreen)
{
if (player == &players[secondarydisplayplayer])
{
type = &postimgtype2;
ssplayer = 2;
}
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
{
type = &postimgtype3;
ssplayer = 3;
}
else if (splitscreen > 2 && player == &players[fourthdisplayplayer])
{
type = &postimgtype4;
ssplayer = 4;
}
else
{
type = &postimgtype;
ssplayer = 1;
}
}
else
type = &postimgtype;
@ -5789,7 +5849,7 @@ if (0)
validcount++;
HWR_RenderBSPNode((INT32)numnodes-1);
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer);
// Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer])
@ -5806,18 +5866,18 @@ if (0)
{
dup_viewangle += ANGLE_90;
HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1); //left
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //left
dup_viewangle += ANGLE_90;
if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45))
{
HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1); //back
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //back
}
dup_viewangle += ANGLE_90;
HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1); //right
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //right
dup_viewangle += ANGLE_90;
}
@ -5881,17 +5941,35 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
{
const float fpov = FIXED_TO_FLOAT(cv_grfov.value+player->fovadd);
postimg_t *type;
UINT8 ssplayer = 0;
const boolean skybox = (skyboxmo[0] && cv_skybox.value); // True if there's a skybox object and skyboxes are on
FRGBAFloat ClearColor;
if (splitscreen && player == &players[secondarydisplayplayer])
type = &postimgtype2;
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
type = &postimgtype3;
else if (splitscreen > 2 && player == &players[fourthdisplayplayer])
type = &postimgtype4;
if (splitscreen)
{
if (player == &players[secondarydisplayplayer])
{
type = &postimgtype2;
ssplayer = 2;
}
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
{
type = &postimgtype3;
ssplayer = 3;
}
else if (splitscreen > 2 && player == &players[fourthdisplayplayer])
{
type = &postimgtype4;
ssplayer = 4;
}
else
{
type = &postimgtype;
ssplayer = 1;
}
}
else
type = &postimgtype;
@ -6019,7 +6097,7 @@ if (0)
validcount++;
HWR_RenderBSPNode((INT32)numnodes-1);
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer);
// Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer])
@ -6036,18 +6114,18 @@ if (0)
{
dup_viewangle += ANGLE_90;
HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1); //left
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //left
dup_viewangle += ANGLE_90;
if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45))
{
HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1); //back
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //back
}
dup_viewangle += ANGLE_90;
HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1); //right
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //right
dup_viewangle += ANGLE_90;
}

View file

@ -1968,10 +1968,35 @@ void K_DriftDustHandling(mobj_t *spawner)
dust->momz = P_MobjFlip(spawner) * P_RandomRange(1, 4)<<FRACBITS;
dust->scale = spawner->scale/2;
dust->destscale = spawner->scale * 3;
if (leveltime % 6 == 0)
{
S_StartSound(spawner, sfx_screec);
}
// Now time for a bunch of flag shit, groooooaann...
if (spawner->flags2 & MF2_DONTDRAW)
dust->flags2 |= MF2_DONTDRAW;
else
dust->flags2 &= ~MF2_DONTDRAW;
if (spawner->eflags & MFE_DRAWONLYFORP1)
dust->eflags |= MFE_DRAWONLYFORP1;
else
dust->eflags &= ~MFE_DRAWONLYFORP1;
if (spawner->eflags & MFE_DRAWONLYFORP2)
dust->eflags |= MFE_DRAWONLYFORP2;
else
dust->eflags &= ~MFE_DRAWONLYFORP2;
if (spawner->eflags & MFE_DRAWONLYFORP3)
dust->eflags |= MFE_DRAWONLYFORP3;
else
dust->eflags &= ~MFE_DRAWONLYFORP3;
if (spawner->eflags & MFE_DRAWONLYFORP4)
dust->eflags |= MFE_DRAWONLYFORP4;
else
dust->eflags &= ~MFE_DRAWONLYFORP4;
}
}