- adjustments for recent ZDoom changes.

This commit is contained in:
Christoph Oelckers 2015-04-16 22:50:26 +02:00
parent a602e47261
commit df6ffe6418
2 changed files with 51 additions and 49 deletions

View file

@ -150,9 +150,10 @@ static int LS_Sector_SetPlaneReflection (line_t *ln, AActor *it, bool backSide,
int arg0, int arg1, int arg2, int arg3, int arg4) int arg0, int arg1, int arg2, int arg3, int arg4)
{ {
// Sector_SetPlaneReflection (tag, floor, ceiling) // Sector_SetPlaneReflection (tag, floor, ceiling)
int secnum = -1; int secnum;
FSectorTagIterator itr(arg0);
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) while ((secnum = itr.Next()) >= 0)
{ {
sector_t * s = &sectors[secnum]; sector_t * s = &sectors[secnum];
if (s->floorplane.a==0 && s->floorplane.b==0) s->reflect[sector_t::floor] = arg1/255.f; if (s->floorplane.a==0 && s->floorplane.b==0) s->reflect[sector_t::floor] = arg1/255.f;

View file

@ -216,96 +216,97 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
//========================================================================== //==========================================================================
static int P_Set3DFloor(line_t * line, int param, int param2, int alpha) static int P_Set3DFloor(line_t * line, int param, int param2, int alpha)
{ {
int s,i; int s, i;
int flags; int flags;
int tag=line->args[0]; int tag = line->args[0];
sector_t * sec = line->frontsector, * ss; sector_t * sec = line->frontsector, *ss;
for (s=-1; (s = P_FindSectorFromTag(tag,s)) >= 0;) FSectorTagIterator itr(tag);
while ((s = itr.Next()) >= 0)
{ {
ss=&sectors[s]; ss = &sectors[s];
if (param==0) if (param == 0)
{ {
flags=FF_EXISTS|FF_RENDERALL|FF_SOLID|FF_INVERTSECTOR; flags = FF_EXISTS | FF_RENDERALL | FF_SOLID | FF_INVERTSECTOR;
alpha = 255; alpha = 255;
for (i=0;i<sec->linecount;i++) for (i = 0; i < sec->linecount; i++)
{ {
line_t * l=sec->lines[i]; line_t * l = sec->lines[i];
if (l->special==Sector_SetContents && l->frontsector==sec) if (l->special == Sector_SetContents && l->frontsector == sec)
{ {
alpha=clamp<int>(l->args[1], 0, 100); alpha = clamp<int>(l->args[1], 0, 100);
if (l->args[2] & 1) flags &= ~FF_SOLID; if (l->args[2] & 1) flags &= ~FF_SOLID;
if (l->args[2] & 2) flags |= FF_SEETHROUGH; if (l->args[2] & 2) flags |= FF_SEETHROUGH;
if (l->args[2] & 4) flags |= FF_SHOOTTHROUGH; if (l->args[2] & 4) flags |= FF_SHOOTTHROUGH;
if (l->args[2] & 8) flags |= FF_ADDITIVETRANS; if (l->args[2] & 8) flags |= FF_ADDITIVETRANS;
if (alpha!=100) flags|=FF_TRANSLUCENT;//|FF_BOTHPLANES|FF_ALLSIDES; if (alpha != 100) flags |= FF_TRANSLUCENT;//|FF_BOTHPLANES|FF_ALLSIDES;
if (l->args[0]) if (l->args[0])
{ {
// Yes, Vavoom's 3D-floor definitions suck! // Yes, Vavoom's 3D-floor definitions suck!
// The content list changed in r1783 of Vavoom to be unified // The content list changed in r1783 of Vavoom to be unified
// among all its supported games, so it has now ten different // among all its supported games, so it has now ten different
// values instead of just five. // values instead of just five.
static DWORD vavoomcolors[]={VC_EMPTY, static DWORD vavoomcolors[] = { VC_EMPTY,
VC_WATER, VC_LAVA, VC_NUKAGE, VC_SLIME, VC_HELLSLIME, VC_WATER, VC_LAVA, VC_NUKAGE, VC_SLIME, VC_HELLSLIME,
VC_BLOOD, VC_SLUDGE, VC_HAZARD, VC_BOOMWATER}; VC_BLOOD, VC_SLUDGE, VC_HAZARD, VC_BOOMWATER };
flags|=FF_SWIMMABLE|FF_BOTHPLANES|FF_ALLSIDES|FF_FLOOD; flags |= FF_SWIMMABLE | FF_BOTHPLANES | FF_ALLSIDES | FF_FLOOD;
l->frontsector->ColorMap = l->frontsector->ColorMap =
GetSpecialLights (l->frontsector->ColorMap->Color, GetSpecialLights(l->frontsector->ColorMap->Color,
vavoomcolors[l->args[0]], vavoomcolors[l->args[0]],
l->frontsector->ColorMap->Desaturate); l->frontsector->ColorMap->Desaturate);
} }
alpha=(alpha*255)/100; alpha = (alpha * 255) / 100;
break; break;
} }
} }
} }
else if (param==4) else if (param == 4)
{ {
flags=FF_EXISTS|FF_RENDERPLANES|FF_INVERTPLANES|FF_NOSHADE|FF_FIX; flags = FF_EXISTS | FF_RENDERPLANES | FF_INVERTPLANES | FF_NOSHADE | FF_FIX;
if (param2 & 1) flags |= FF_SEETHROUGH; // marker for allowing missing texture checks if (param2 & 1) flags |= FF_SEETHROUGH; // marker for allowing missing texture checks
alpha=255; alpha = 255;
} }
else else
{ {
static const int defflags[]= {0, static const int defflags[] = { 0,
FF_SOLID, FF_SOLID,
FF_SWIMMABLE|FF_BOTHPLANES|FF_ALLSIDES|FF_SHOOTTHROUGH|FF_SEETHROUGH, FF_SWIMMABLE | FF_BOTHPLANES | FF_ALLSIDES | FF_SHOOTTHROUGH | FF_SEETHROUGH,
FF_SHOOTTHROUGH|FF_SEETHROUGH, FF_SHOOTTHROUGH | FF_SEETHROUGH,
}; };
flags = defflags[param&3] | FF_EXISTS|FF_RENDERALL; flags = defflags[param & 3] | FF_EXISTS | FF_RENDERALL;
if (param&4) flags |= FF_ALLSIDES|FF_BOTHPLANES; if (param & 4) flags |= FF_ALLSIDES | FF_BOTHPLANES;
if (param&16) flags ^= FF_SEETHROUGH; if (param & 16) flags ^= FF_SEETHROUGH;
if (param&32) flags ^= FF_SHOOTTHROUGH; if (param & 32) flags ^= FF_SHOOTTHROUGH;
if (param2&1) flags |= FF_NOSHADE; if (param2 & 1) flags |= FF_NOSHADE;
if (param2&2) flags |= FF_DOUBLESHADOW; if (param2 & 2) flags |= FF_DOUBLESHADOW;
if (param2&4) flags |= FF_FOG; if (param2 & 4) flags |= FF_FOG;
if (param2&8) flags |= FF_THINFLOOR; if (param2 & 8) flags |= FF_THINFLOOR;
if (param2&16) flags |= FF_UPPERTEXTURE; if (param2 & 16) flags |= FF_UPPERTEXTURE;
if (param2&32) flags |= FF_LOWERTEXTURE; if (param2 & 32) flags |= FF_LOWERTEXTURE;
if (param2&64) flags |= FF_ADDITIVETRANS|FF_TRANSLUCENT; if (param2 & 64) flags |= FF_ADDITIVETRANS | FF_TRANSLUCENT;
// if flooding is used the floor must be non-solid and is automatically made shootthrough and seethrough // if flooding is used the floor must be non-solid and is automatically made shootthrough and seethrough
if ((param2&128) && !(flags & FF_SOLID)) flags |= FF_FLOOD|FF_SEETHROUGH|FF_SHOOTTHROUGH; if ((param2 & 128) && !(flags & FF_SOLID)) flags |= FF_FLOOD | FF_SEETHROUGH | FF_SHOOTTHROUGH;
if (param2&512) flags |= FF_FADEWALLS; if (param2 & 512) flags |= FF_FADEWALLS;
FTextureID tex = line->sidedef[0]->GetTexture(side_t::top); FTextureID tex = line->sidedef[0]->GetTexture(side_t::top);
if (!tex.Exists() && alpha<255) if (!tex.Exists() && alpha < 255)
{ {
alpha = -tex.GetIndex(); alpha = -tex.GetIndex();
} }
alpha = clamp(alpha, 0, 255); alpha = clamp(alpha, 0, 255);
if (alpha==0) flags&=~(FF_RENDERALL|FF_BOTHPLANES|FF_ALLSIDES); if (alpha == 0) flags &= ~(FF_RENDERALL | FF_BOTHPLANES | FF_ALLSIDES);
else if (alpha!=255) flags|=FF_TRANSLUCENT; else if (alpha != 255) flags |= FF_TRANSLUCENT;
} }
P_Add3DFloor(ss, sec, line, flags, alpha); P_Add3DFloor(ss, sec, line, flags, alpha);
} }
// To be 100% safe this should be done even if the alpha by texture value isn't used. // To be 100% safe this should be done even if the alpha by texture value isn't used.
if (!line->sidedef[0]->GetTexture(side_t::top).isValid()) if (!line->sidedef[0]->GetTexture(side_t::top).isValid())
line->sidedef[0]->SetTexture(side_t::top, FNullTextureID()); line->sidedef[0]->SetTexture(side_t::top, FNullTextureID());
return 1; return 1;
} }