let mfe_drawonlyfor flags stack

This commit is contained in:
Latapostrophe 2019-09-09 20:20:40 +02:00
parent eb8cb12b8f
commit e3393d6323
2 changed files with 81 additions and 36 deletions

View file

@ -5436,6 +5436,9 @@ static void HWR_AddSprites(sector_t *sec)
#endif
fixed_t approx_dist, limit_dist;
INT32 splitflags;
boolean split_drawsprite; // drawing with splitscreen flags
// BSP is traversed by subsector.
// A sector might have been split into several
// subsectors during BSP building.
@ -5455,27 +5458,37 @@ static void HWR_AddSprites(sector_t *sec)
{
for (thing = sec->thinglist; thing; thing = thing->snext)
{
split_drawsprite = false;
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
if (splitscreen)
splitflags = thing->eflags & (MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4);
if (splitscreen && splitflags)
{
if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewssnum != 0)
continue;
if (viewssnum == 0)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP2)
if (viewssnum != 1)
continue;
if (viewssnum == 1)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (viewssnum != 2)
continue;
if (viewssnum == 2)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (viewssnum != 3)
continue;
if (viewssnum == 3)
split_drawsprite = true;
}
else
split_drawsprite = true;
if (!split_drawsprite)
continue;
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
@ -5490,27 +5503,37 @@ static void HWR_AddSprites(sector_t *sec)
// Draw everything in sector, no checks
for (thing = sec->thinglist; thing; thing = thing->snext)
{
split_drawsprite = false;
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
if (splitscreen)
splitflags = thing->eflags & (MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4);
if (splitscreen && splitflags)
{
if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewssnum != 0)
continue;
if (viewssnum == 0)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP2)
if (viewssnum != 1)
continue;
if (viewssnum == 1)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (viewssnum != 2)
continue;
if (viewssnum == 2)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (viewssnum != 3)
continue;
if (viewssnum == 3)
split_drawsprite = true;
}
else
split_drawsprite = true;
if (!split_drawsprite)
continue;
HWR_ProjectSprite(thing);
}

View file

@ -1711,6 +1711,9 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
INT32 lightnum;
fixed_t approx_dist, limit_dist;
INT32 splitflags; // check if a mobj has spliscreen flags
boolean split_drawsprite; // used for splitscreen flags
if (rendermode != render_soft)
return;
@ -1744,27 +1747,36 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
{
for (thing = sec->thinglist; thing; thing = thing->snext)
{
split_drawsprite = false;
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
if (splitscreen)
splitflags = thing->eflags & (MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4);
if (splitscreen && splitflags)
{
if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewssnum != 0)
continue;
if (viewssnum == 0)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP2)
if (viewssnum != 1)
continue;
if (viewssnum == 1)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (viewssnum != 2)
continue;
if (viewssnum == 2)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (viewssnum != 3)
continue;
if (viewssnum == 3)
split_drawsprite = true;
}
else
split_drawsprite = true;
if (!split_drawsprite)
continue;
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
@ -1779,27 +1791,37 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
// Draw everything in sector, no checks
for (thing = sec->thinglist; thing; thing = thing->snext)
{
split_drawsprite = false;
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
if (splitscreen)
splitflags = thing->eflags & (MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4);
if (splitscreen && splitflags)
{
if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewssnum != 0)
continue;
if (viewssnum == 0)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP2)
if (viewssnum != 1)
continue;
if (viewssnum == 1)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (viewssnum != 2)
continue;
if (viewssnum == 2)
split_drawsprite = true;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (viewssnum != 3)
continue;
if (viewssnum == 3)
split_drawsprite = true;
}
else
split_drawsprite = true;
if (!split_drawsprite)
continue;
R_ProjectSprite(thing);
}