Convert FakeSide to enum class

This commit is contained in:
Magnus Norddahl 2017-01-04 19:03:33 +01:00
parent 5f8075f726
commit 47ca45bf18
8 changed files with 30 additions and 27 deletions

View file

@ -85,7 +85,7 @@ namespace swrenderer
*ceilinglightlevel = sec->GetCeilingLight();
}
FakeSide = FAKED_Center;
FakeSide = WaterFakeSide::Center;
const sector_t *s = sec->GetHeightSec();
if (s != NULL)
@ -125,7 +125,7 @@ namespace swrenderer
*ceilinglightlevel = s->GetCeilingLight();
}
}
FakeSide = FAKED_BelowFloor;
FakeSide = WaterFakeSide::BelowFloor;
return tempsec;
}
return sec;
@ -224,7 +224,7 @@ namespace swrenderer
*ceilinglightlevel = s->GetCeilingLight();
}
}
FakeSide = FAKED_BelowFloor;
FakeSide = WaterFakeSide::BelowFloor;
}
else if (heightsec && heightsec->ceilingplane.PointOnSide(ViewPos) <= 0 &&
orgceilz > refceilz && !(s->MoreFlags & SECF_FAKEFLOORONLY))
@ -261,7 +261,7 @@ namespace swrenderer
*ceilinglightlevel = s->GetCeilingLight();
}
}
FakeSide = FAKED_AboveCeiling;
FakeSide = WaterFakeSide::AboveCeiling;
}
sec = tempsec; // Use other sector
}

View file

@ -28,11 +28,11 @@ namespace swrenderer
// the texture calculations.
#define TOO_CLOSE_Z (3072.0 / (1<<12))
enum
enum class WaterFakeSide
{
FAKED_Center,
FAKED_BelowFloor,
FAKED_AboveCeiling
Center,
BelowFloor,
AboveCeiling
};
class RenderBSP
@ -57,10 +57,10 @@ namespace swrenderer
void AddPolyobjs(subsector_t *sub);
void FakeDrawLoop(subsector_t *sub, visplane_t *floorplane, visplane_t *ceilingplane);
subsector_t *InSubsector;
sector_t *frontsector;
uint8_t FakeSide;
bool r_fakingunderwater;
subsector_t *InSubsector = nullptr;
sector_t *frontsector = nullptr;
WaterFakeSide FakeSide = WaterFakeSide::Center;
bool r_fakingunderwater = false;
SWRenderLine renderline;
};

View file

@ -602,7 +602,7 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
// R_ProjectSprite
// Generates a vissprite for a thing if it might be visible.
//
void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector)
void R_ProjectSprite (AActor *thing, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector)
{
double tr_x;
double tr_y;
@ -817,12 +817,12 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
if (heightsec != NULL) // only clip things which are in special sectors
{
if (fakeside == FAKED_AboveCeiling)
if (fakeside == WaterFakeSide::AboveCeiling)
{
if (gzt < heightsec->ceilingplane.ZatPoint(pos))
return;
}
else if (fakeside == FAKED_BelowFloor)
else if (fakeside == WaterFakeSide::BelowFloor)
{
if (gzb >= heightsec->floorplane.ZatPoint(pos))
return;
@ -1035,7 +1035,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
//
// killough 9/18/98: add lightlevel as parameter, fixing underwater lighting
// [RH] Save which side of heightsec sprite is on here.
void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
void R_AddSprites (sector_t *sec, int lightlevel, WaterFakeSide fakeside)
{
F3DFloor *fakeceiling = NULL;
F3DFloor *fakefloor = NULL;
@ -1447,12 +1447,12 @@ void R_DrawSprite (vissprite_t *spr)
if (spr->heightsec && !(spr->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC))
{ // only things in specially marked sectors
if (spr->FakeFlatStat != FAKED_AboveCeiling)
if (spr->FakeFlatStat != WaterFakeSide::AboveCeiling)
{
double hz = spr->heightsec->floorplane.ZatPoint(spr->gpos);
int h = xs_RoundToInt(CenterY - (hz - ViewPos.Z) * scale);
if (spr->FakeFlatStat == FAKED_BelowFloor)
if (spr->FakeFlatStat == WaterFakeSide::BelowFloor)
{ // seen below floor: clip top
if (!spr->bIsVoxel && h > topclip)
{
@ -1469,12 +1469,12 @@ void R_DrawSprite (vissprite_t *spr)
hzb = MAX(hzb, hz);
}
}
if (spr->FakeFlatStat != FAKED_BelowFloor && !(spr->heightsec->MoreFlags & SECF_FAKEFLOORONLY))
if (spr->FakeFlatStat != WaterFakeSide::BelowFloor && !(spr->heightsec->MoreFlags & SECF_FAKEFLOORONLY))
{
double hz = spr->heightsec->ceilingplane.ZatPoint(spr->gpos);
int h = xs_RoundToInt(CenterY - (hz - ViewPos.Z) * scale);
if (spr->FakeFlatStat == FAKED_AboveCeiling)
if (spr->FakeFlatStat == WaterFakeSide::AboveCeiling)
{ // seen above ceiling: clip bottom
if (!spr->bIsVoxel && h < botclip)
{

View file

@ -24,6 +24,7 @@
#define __R_THINGS__
#include "swrenderer/things/r_visiblesprite.h"
#include "swrenderer/scene/r_bsp.h"
struct particle_t;
struct FVoxel;
@ -63,7 +64,7 @@ void R_DrawMaskedColumn (FTexture *texture, fixed_t column, bool unmasked = fals
void R_CacheSprite (spritedef_t *sprite);
void R_SortVisSprites (int (*compare)(const void *, const void *), size_t first);
void R_AddSprites (sector_t *sec, int lightlevel, int fakeside);
void R_AddSprites (sector_t *sec, int lightlevel, WaterFakeSide fakeside);
void R_DrawSprites ();
void R_ClearSprites ();
void R_DrawMasked ();

View file

@ -56,7 +56,7 @@
namespace swrenderer
{
void R_ProjectParticle(particle_t *particle, const sector_t *sector, int shade, int fakeside)
void R_ProjectParticle(particle_t *particle, const sector_t *sector, int shade, WaterFakeSide fakeside)
{
double tr_x, tr_y;
double tx, ty;
@ -134,7 +134,7 @@ namespace swrenderer
if (heightsec) // only clip things which are in special sectors
{
if (fakeside == FAKED_AboveCeiling)
if (fakeside == WaterFakeSide::AboveCeiling)
{
topplane = &sector->ceilingplane;
botplane = &heightsec->ceilingplane;
@ -142,7 +142,7 @@ namespace swrenderer
botpic = heightsec->GetTexture(sector_t::ceiling);
map = heightsec->ColorMap;
}
else if (fakeside == FAKED_BelowFloor)
else if (fakeside == WaterFakeSide::BelowFloor)
{
topplane = &heightsec->floorplane;
botplane = &sector->floorplane;

View file

@ -14,10 +14,11 @@
#pragma once
#include "r_visiblesprite.h"
#include "swrenderer/scene/r_bsp.h"
namespace swrenderer
{
void R_ProjectParticle(particle_t *, const sector_t *sector, int shade, int fakeside);
void R_ProjectParticle(particle_t *, const sector_t *sector, int shade, WaterFakeSide fakeside);
void R_DrawParticle(vissprite_t *);
void R_DrawMaskedSegsBehindParticle(const vissprite_t *vis);
}

View file

@ -14,6 +14,7 @@
#pragma once
#include "swrenderer/line/r_line.h"
#include "swrenderer/scene/r_bsp.h"
struct particle_t;
struct FVoxel;
@ -76,7 +77,7 @@ namespace swrenderer
uint8_t bWallSprite : 1; // [RH] This is a wall sprite
uint8_t bSplitSprite : 1; // [RH] Sprite was split by a drawseg
uint8_t bInMirror : 1; // [RH] Sprite is "inside" a mirror
uint8_t FakeFlatStat; // [RH] which side of fake/floor ceiling sprite is on
WaterFakeSide FakeFlatStat; // [RH] which side of fake/floor ceiling sprite is on
short renderflags;
uint32_t Translation; // [RH] for color translation
visstyle_t Style;

View file

@ -118,7 +118,7 @@ namespace swrenderer
vis->Style.RenderStyle = thing->RenderStyle;
vis->FillColor = thing->fillcolor;
vis->Translation = thing->Translation;
vis->FakeFlatStat = 0;
vis->FakeFlatStat = WaterFakeSide::Center;
vis->Style.Alpha = float(thing->Alpha);
vis->fakefloor = NULL;
vis->fakeceiling = NULL;