diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index 735ef0439..182b818b3 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -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) { // 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 = §ors[secnum]; if (s->floorplane.a==0 && s->floorplane.b==0) s->reflect[sector_t::floor] = arg1/255.f; diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index ae1c31a86..7ca03d261 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -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) { - int s,i; + int s, i; int flags; - int tag=line->args[0]; - sector_t * sec = line->frontsector, * ss; + int tag = line->args[0]; + sector_t * sec = line->frontsector, *ss; - for (s=-1; (s = P_FindSectorFromTag(tag,s)) >= 0;) + FSectorTagIterator itr(tag); + while ((s = itr.Next()) >= 0) { - ss=§ors[s]; + ss = §ors[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; - for (i=0;ilinecount;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(l->args[1], 0, 100); + alpha = clamp(l->args[1], 0, 100); if (l->args[2] & 1) flags &= ~FF_SOLID; if (l->args[2] & 2) flags |= FF_SEETHROUGH; if (l->args[2] & 4) flags |= FF_SHOOTTHROUGH; if (l->args[2] & 8) flags |= FF_ADDITIVETRANS; - if (alpha!=100) flags|=FF_TRANSLUCENT;//|FF_BOTHPLANES|FF_ALLSIDES; - if (l->args[0]) + if (alpha != 100) flags |= FF_TRANSLUCENT;//|FF_BOTHPLANES|FF_ALLSIDES; + if (l->args[0]) { // Yes, Vavoom's 3D-floor definitions suck! // The content list changed in r1783 of Vavoom to be unified // among all its supported games, so it has now ten different // 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_BLOOD, VC_SLUDGE, VC_HAZARD, VC_BOOMWATER}; - flags|=FF_SWIMMABLE|FF_BOTHPLANES|FF_ALLSIDES|FF_FLOOD; + VC_BLOOD, VC_SLUDGE, VC_HAZARD, VC_BOOMWATER }; + flags |= FF_SWIMMABLE | FF_BOTHPLANES | FF_ALLSIDES | FF_FLOOD; - l->frontsector->ColorMap = - GetSpecialLights (l->frontsector->ColorMap->Color, - vavoomcolors[l->args[0]], - l->frontsector->ColorMap->Desaturate); + l->frontsector->ColorMap = + GetSpecialLights(l->frontsector->ColorMap->Color, + vavoomcolors[l->args[0]], + l->frontsector->ColorMap->Desaturate); } - alpha=(alpha*255)/100; + alpha = (alpha * 255) / 100; 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 - alpha=255; + alpha = 255; } - else + else { - static const int defflags[]= {0, - FF_SOLID, - FF_SWIMMABLE|FF_BOTHPLANES|FF_ALLSIDES|FF_SHOOTTHROUGH|FF_SEETHROUGH, - FF_SHOOTTHROUGH|FF_SEETHROUGH, + static const int defflags[] = { 0, + FF_SOLID, + FF_SWIMMABLE | FF_BOTHPLANES | FF_ALLSIDES | 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&16) flags ^= FF_SEETHROUGH; - if (param&32) flags ^= FF_SHOOTTHROUGH; + if (param & 4) flags |= FF_ALLSIDES | FF_BOTHPLANES; + if (param & 16) flags ^= FF_SEETHROUGH; + if (param & 32) flags ^= FF_SHOOTTHROUGH; - if (param2&1) flags |= FF_NOSHADE; - if (param2&2) flags |= FF_DOUBLESHADOW; - if (param2&4) flags |= FF_FOG; - if (param2&8) flags |= FF_THINFLOOR; - if (param2&16) flags |= FF_UPPERTEXTURE; - if (param2&32) flags |= FF_LOWERTEXTURE; - if (param2&64) flags |= FF_ADDITIVETRANS|FF_TRANSLUCENT; + if (param2 & 1) flags |= FF_NOSHADE; + if (param2 & 2) flags |= FF_DOUBLESHADOW; + if (param2 & 4) flags |= FF_FOG; + if (param2 & 8) flags |= FF_THINFLOOR; + if (param2 & 16) flags |= FF_UPPERTEXTURE; + if (param2 & 32) flags |= FF_LOWERTEXTURE; + 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 ((param2&128) && !(flags & FF_SOLID)) flags |= FF_FLOOD|FF_SEETHROUGH|FF_SHOOTTHROUGH; - if (param2&512) flags |= FF_FADEWALLS; + if ((param2 & 128) && !(flags & FF_SOLID)) flags |= FF_FLOOD | FF_SEETHROUGH | FF_SHOOTTHROUGH; + if (param2 & 512) flags |= FF_FADEWALLS; FTextureID tex = line->sidedef[0]->GetTexture(side_t::top); - if (!tex.Exists() && alpha<255) + if (!tex.Exists() && alpha < 255) { alpha = -tex.GetIndex(); } alpha = clamp(alpha, 0, 255); - if (alpha==0) flags&=~(FF_RENDERALL|FF_BOTHPLANES|FF_ALLSIDES); - else if (alpha!=255) flags|=FF_TRANSLUCENT; - + if (alpha == 0) flags &= ~(FF_RENDERALL | FF_BOTHPLANES | FF_ALLSIDES); + else if (alpha != 255) flags |= FF_TRANSLUCENT; + } 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. - 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()); return 1; }