mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- turned sector_t::FloorSkyBox and CeilingSkyBox into an array.
- removed unused SpreadCeilingPortal function.
This commit is contained in:
parent
61e48013dc
commit
37f18055af
7 changed files with 25 additions and 66 deletions
|
@ -517,8 +517,8 @@ size_t DObject::StaticPointerSubstitution (DObject *old, DObject *notOld)
|
||||||
#define SECTOR_CHECK(f,t) \
|
#define SECTOR_CHECK(f,t) \
|
||||||
if (sectors[i].f.p == static_cast<t *>(old)) { sectors[i].f = static_cast<t *>(notOld); changed++; }
|
if (sectors[i].f.p == static_cast<t *>(old)) { sectors[i].f = static_cast<t *>(notOld); changed++; }
|
||||||
SECTOR_CHECK( SoundTarget, AActor );
|
SECTOR_CHECK( SoundTarget, AActor );
|
||||||
SECTOR_CHECK( CeilingSkyBox, ASkyViewpoint );
|
SECTOR_CHECK( SkyBoxes[sector_t::ceiling], ASkyViewpoint );
|
||||||
SECTOR_CHECK( FloorSkyBox, ASkyViewpoint );
|
SECTOR_CHECK( SkyBoxes[sector_t::floor], ASkyViewpoint );
|
||||||
SECTOR_CHECK( SecActTarget, ASectorAction );
|
SECTOR_CHECK( SecActTarget, ASectorAction );
|
||||||
SECTOR_CHECK( floordata, DSectorEffect );
|
SECTOR_CHECK( floordata, DSectorEffect );
|
||||||
SECTOR_CHECK( ceilingdata, DSectorEffect );
|
SECTOR_CHECK( ceilingdata, DSectorEffect );
|
||||||
|
|
|
@ -640,8 +640,8 @@ size_t DSectorMarker::PropagateMark()
|
||||||
{
|
{
|
||||||
sector_t *sec = §ors[SecNum + i];
|
sector_t *sec = §ors[SecNum + i];
|
||||||
GC::Mark(sec->SoundTarget);
|
GC::Mark(sec->SoundTarget);
|
||||||
GC::Mark(sec->CeilingSkyBox);
|
GC::Mark(sec->SkyBoxes[sector_t::ceiling]);
|
||||||
GC::Mark(sec->FloorSkyBox);
|
GC::Mark(sec->SkyBoxes[sector_t::floor]);
|
||||||
GC::Mark(sec->SecActTarget);
|
GC::Mark(sec->SecActTarget);
|
||||||
GC::Mark(sec->floordata);
|
GC::Mark(sec->floordata);
|
||||||
GC::Mark(sec->ceilingdata);
|
GC::Mark(sec->ceilingdata);
|
||||||
|
|
|
@ -67,13 +67,13 @@ void ASkyViewpoint::Destroy ()
|
||||||
// remove all sector references to ourselves.
|
// remove all sector references to ourselves.
|
||||||
for (int i = 0; i <numsectors; i++)
|
for (int i = 0; i <numsectors; i++)
|
||||||
{
|
{
|
||||||
if (sectors[i].FloorSkyBox == this)
|
if (sectors[i].SkyBoxes[sector_t::floor] == this)
|
||||||
{
|
{
|
||||||
sectors[i].FloorSkyBox = NULL;
|
sectors[i].SkyBoxes[sector_t::floor] = NULL;
|
||||||
}
|
}
|
||||||
if (sectors[i].CeilingSkyBox == this)
|
if (sectors[i].SkyBoxes[sector_t::ceiling] == this)
|
||||||
{
|
{
|
||||||
sectors[i].CeilingSkyBox = NULL;
|
sectors[i].SkyBoxes[sector_t::ceiling] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (level.DefaultSkybox == this)
|
if (level.DefaultSkybox == this)
|
||||||
|
@ -129,12 +129,12 @@ void ASkyPicker::PostBeginPlay ()
|
||||||
{
|
{
|
||||||
if (0 == (args[1] & 2))
|
if (0 == (args[1] & 2))
|
||||||
{
|
{
|
||||||
Sector->CeilingSkyBox = box;
|
Sector->SkyBoxes[sector_t::ceiling] = box;
|
||||||
if (box == NULL) Sector->MoreFlags |= SECF_NOCEILINGSKYBOX; // sector should ignore the level's default skybox
|
if (box == NULL) Sector->MoreFlags |= SECF_NOCEILINGSKYBOX; // sector should ignore the level's default skybox
|
||||||
}
|
}
|
||||||
if (0 == (args[1] & 1))
|
if (0 == (args[1] & 1))
|
||||||
{
|
{
|
||||||
Sector->FloorSkyBox = box;
|
Sector->SkyBoxes[sector_t::floor] = box;
|
||||||
if (box == NULL) Sector->MoreFlags |= SECF_NOFLOORSKYBOX; // sector should ignore the level's default skybox
|
if (box == NULL) Sector->MoreFlags |= SECF_NOFLOORSKYBOX; // sector should ignore the level's default skybox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,7 @@ void P_SerializeWorld (FArchive &arc)
|
||||||
<< sec->sky
|
<< sec->sky
|
||||||
<< sec->MoreFlags
|
<< sec->MoreFlags
|
||||||
<< sec->Flags
|
<< sec->Flags
|
||||||
<< sec->FloorSkyBox << sec->CeilingSkyBox
|
<< sec->SkyBoxes[sector_t::floor] << sec->SkyBoxes[sector_t::ceiling]
|
||||||
<< sec->ZoneNumber;
|
<< sec->ZoneNumber;
|
||||||
if (SaveVersion < 4529)
|
if (SaveVersion < 4529)
|
||||||
{
|
{
|
||||||
|
|
|
@ -805,16 +805,8 @@ int sector_t::GetCeilingLight () const
|
||||||
|
|
||||||
ASkyViewpoint *sector_t::GetSkyBox(int which)
|
ASkyViewpoint *sector_t::GetSkyBox(int which)
|
||||||
{
|
{
|
||||||
if (which == floor)
|
if (SkyBoxes[which] != NULL) return SkyBoxes[which];
|
||||||
{
|
if (MoreFlags & (SECF_NOFLOORSKYBOX << which)) return NULL;
|
||||||
if (FloorSkyBox != NULL) return FloorSkyBox;
|
|
||||||
if (MoreFlags & SECF_NOFLOORSKYBOX) return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (CeilingSkyBox != NULL) return CeilingSkyBox;
|
|
||||||
if (MoreFlags & SECF_NOCEILINGSKYBOX) return NULL;
|
|
||||||
}
|
|
||||||
return level.DefaultSkybox;
|
return level.DefaultSkybox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -909,10 +909,10 @@ static void SetupFloorPortal (AStackPoint *point)
|
||||||
{
|
{
|
||||||
NActorIterator it (NAME_LowerStackLookOnly, point->tid);
|
NActorIterator it (NAME_LowerStackLookOnly, point->tid);
|
||||||
sector_t *Sector = point->Sector;
|
sector_t *Sector = point->Sector;
|
||||||
Sector->FloorSkyBox = static_cast<ASkyViewpoint*>(it.Next());
|
Sector->SkyBoxes[sector_t::floor] = static_cast<ASkyViewpoint*>(it.Next());
|
||||||
if (Sector->FloorSkyBox != NULL && Sector->FloorSkyBox->bAlways)
|
if (Sector->SkyBoxes[sector_t::floor] != NULL && Sector->SkyBoxes[sector_t::floor]->bAlways)
|
||||||
{
|
{
|
||||||
Sector->FloorSkyBox->Mate = point;
|
Sector->SkyBoxes[sector_t::floor]->Mate = point;
|
||||||
if (Sector->GetAlpha(sector_t::floor) == OPAQUE)
|
if (Sector->GetAlpha(sector_t::floor) == OPAQUE)
|
||||||
Sector->SetAlpha(sector_t::floor, Scale (point->args[0], OPAQUE, 255));
|
Sector->SetAlpha(sector_t::floor, Scale (point->args[0], OPAQUE, 255));
|
||||||
}
|
}
|
||||||
|
@ -922,48 +922,15 @@ static void SetupCeilingPortal (AStackPoint *point)
|
||||||
{
|
{
|
||||||
NActorIterator it (NAME_UpperStackLookOnly, point->tid);
|
NActorIterator it (NAME_UpperStackLookOnly, point->tid);
|
||||||
sector_t *Sector = point->Sector;
|
sector_t *Sector = point->Sector;
|
||||||
Sector->CeilingSkyBox = static_cast<ASkyViewpoint*>(it.Next());
|
Sector->SkyBoxes[sector_t::ceiling] = static_cast<ASkyViewpoint*>(it.Next());
|
||||||
if (Sector->CeilingSkyBox != NULL && Sector->CeilingSkyBox->bAlways)
|
if (Sector->SkyBoxes[sector_t::ceiling] != NULL && Sector->SkyBoxes[sector_t::ceiling]->bAlways)
|
||||||
{
|
{
|
||||||
Sector->CeilingSkyBox->Mate = point;
|
Sector->SkyBoxes[sector_t::ceiling]->Mate = point;
|
||||||
if (Sector->GetAlpha(sector_t::ceiling) == OPAQUE)
|
if (Sector->GetAlpha(sector_t::ceiling) == OPAQUE)
|
||||||
Sector->SetAlpha(sector_t::ceiling, Scale (point->args[0], OPAQUE, 255));
|
Sector->SetAlpha(sector_t::ceiling, Scale (point->args[0], OPAQUE, 255));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool SpreadCeilingPortal(AStackPoint *pt, fixed_t alpha, sector_t *sector)
|
|
||||||
{
|
|
||||||
bool fail = false;
|
|
||||||
sector->validcount = validcount;
|
|
||||||
for(int i=0; i<sector->linecount; i++)
|
|
||||||
{
|
|
||||||
line_t *line = sector->lines[i];
|
|
||||||
sector_t *backsector = sector == line->frontsector? line->backsector : line->frontsector;
|
|
||||||
if (line->backsector == line->frontsector) continue;
|
|
||||||
if (backsector == NULL) { fail = true; continue; }
|
|
||||||
if (backsector->validcount == validcount) continue;
|
|
||||||
if (backsector->CeilingSkyBox == pt) continue;
|
|
||||||
|
|
||||||
// Check if the backside would map to the same visplane
|
|
||||||
if (backsector->CeilingSkyBox != NULL) { fail = true; continue; }
|
|
||||||
if (backsector->ceilingplane != sector->ceilingplane) { fail = true; continue; }
|
|
||||||
if (backsector->lightlevel != sector->lightlevel) { fail = true; continue; }
|
|
||||||
if (backsector->GetTexture(sector_t::ceiling) != sector->GetTexture(sector_t::ceiling)) { fail = true; continue; }
|
|
||||||
if (backsector->GetXOffset(sector_t::ceiling) != sector->GetXOffset(sector_t::ceiling)) { fail = true; continue; }
|
|
||||||
if (backsector->GetYOffset(sector_t::ceiling) != sector->GetYOffset(sector_t::ceiling)) { fail = true; continue; }
|
|
||||||
if (backsector->GetXScale(sector_t::ceiling) != sector->GetXScale(sector_t::ceiling)) { fail = true; continue; }
|
|
||||||
if (backsector->GetYScale(sector_t::ceiling) != sector->GetYScale(sector_t::ceiling)) { fail = true; continue; }
|
|
||||||
if (backsector->GetAngle(sector_t::ceiling) != sector->GetAngle(sector_t::ceiling)) { fail = true; continue; }
|
|
||||||
if (SpreadCeilingPortal(pt, alpha, backsector)) { fail = true; continue; }
|
|
||||||
}
|
|
||||||
if (!fail)
|
|
||||||
{
|
|
||||||
sector->CeilingSkyBox = pt;
|
|
||||||
sector->SetAlpha(sector_t::ceiling, alpha);
|
|
||||||
}
|
|
||||||
return fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
void P_SetupPortals()
|
void P_SetupPortals()
|
||||||
{
|
{
|
||||||
TThinkerIterator<AStackPoint> it;
|
TThinkerIterator<AStackPoint> it;
|
||||||
|
@ -991,9 +958,9 @@ static void SetPortal(sector_t *sector, int plane, ASkyViewpoint *portal, fixed_
|
||||||
// plane: 0=floor, 1=ceiling, 2=both
|
// plane: 0=floor, 1=ceiling, 2=both
|
||||||
if (plane > 0)
|
if (plane > 0)
|
||||||
{
|
{
|
||||||
if (sector->CeilingSkyBox == NULL || !sector->CeilingSkyBox->bAlways)
|
if (sector->SkyBoxes[sector_t::ceiling] == NULL || !sector->SkyBoxes[sector_t::ceiling]->bAlways)
|
||||||
{
|
{
|
||||||
sector->CeilingSkyBox = portal;
|
sector->SkyBoxes[sector_t::ceiling] = portal;
|
||||||
if (sector->GetAlpha(sector_t::ceiling) == OPAQUE)
|
if (sector->GetAlpha(sector_t::ceiling) == OPAQUE)
|
||||||
sector->SetAlpha(sector_t::ceiling, alpha);
|
sector->SetAlpha(sector_t::ceiling, alpha);
|
||||||
|
|
||||||
|
@ -1002,9 +969,9 @@ static void SetPortal(sector_t *sector, int plane, ASkyViewpoint *portal, fixed_
|
||||||
}
|
}
|
||||||
if (plane == 2 || plane == 0)
|
if (plane == 2 || plane == 0)
|
||||||
{
|
{
|
||||||
if (sector->FloorSkyBox == NULL || !sector->FloorSkyBox->bAlways)
|
if (sector->SkyBoxes[sector_t::floor] == NULL || !sector->SkyBoxes[sector_t::floor]->bAlways)
|
||||||
{
|
{
|
||||||
sector->FloorSkyBox = portal;
|
sector->SkyBoxes[sector_t::floor] = portal;
|
||||||
}
|
}
|
||||||
if (sector->GetAlpha(sector_t::floor) == OPAQUE)
|
if (sector->GetAlpha(sector_t::floor) == OPAQUE)
|
||||||
sector->SetAlpha(sector_t::floor, alpha);
|
sector->SetAlpha(sector_t::floor, alpha);
|
||||||
|
|
|
@ -346,7 +346,7 @@ enum
|
||||||
SECF_DRAWN = 128, // sector has been drawn at least once
|
SECF_DRAWN = 128, // sector has been drawn at least once
|
||||||
SECF_HIDDEN = 256, // Do not draw on textured automap
|
SECF_HIDDEN = 256, // Do not draw on textured automap
|
||||||
SECF_NOFLOORSKYBOX = 512, // force use of regular sky
|
SECF_NOFLOORSKYBOX = 512, // force use of regular sky
|
||||||
SECF_NOCEILINGSKYBOX = 1024, // force use of regular sky
|
SECF_NOCEILINGSKYBOX = 1024, // force use of regular sky (do not separate from NOFLOORSKYBOX!!!)
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -790,7 +790,7 @@ struct sector_t
|
||||||
|
|
||||||
// [RH] The sky box to render for this sector. NULL means use a
|
// [RH] The sky box to render for this sector. NULL means use a
|
||||||
// regular sky.
|
// regular sky.
|
||||||
TObjPtr<ASkyViewpoint> FloorSkyBox, CeilingSkyBox;
|
TObjPtr<ASkyViewpoint> SkyBoxes[2];
|
||||||
|
|
||||||
int sectornum; // for comparing sector copies
|
int sectornum; // for comparing sector copies
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue