This commit is contained in:
Christoph Oelckers 2016-01-12 21:36:48 +01:00
commit 7c925e39fe
8 changed files with 27 additions and 68 deletions

View file

@ -517,8 +517,8 @@ size_t DObject::StaticPointerSubstitution (DObject *old, DObject *notOld)
#define SECTOR_CHECK(f,t) \
if (sectors[i].f.p == static_cast<t *>(old)) { sectors[i].f = static_cast<t *>(notOld); changed++; }
SECTOR_CHECK( SoundTarget, AActor );
SECTOR_CHECK( CeilingSkyBox, ASkyViewpoint );
SECTOR_CHECK( FloorSkyBox, ASkyViewpoint );
SECTOR_CHECK( SkyBoxes[sector_t::ceiling], ASkyViewpoint );
SECTOR_CHECK( SkyBoxes[sector_t::floor], ASkyViewpoint );
SECTOR_CHECK( SecActTarget, ASectorAction );
SECTOR_CHECK( floordata, DSectorEffect );
SECTOR_CHECK( ceilingdata, DSectorEffect );

View file

@ -640,8 +640,8 @@ size_t DSectorMarker::PropagateMark()
{
sector_t *sec = &sectors[SecNum + i];
GC::Mark(sec->SoundTarget);
GC::Mark(sec->CeilingSkyBox);
GC::Mark(sec->FloorSkyBox);
GC::Mark(sec->SkyBoxes[sector_t::ceiling]);
GC::Mark(sec->SkyBoxes[sector_t::floor]);
GC::Mark(sec->SecActTarget);
GC::Mark(sec->floordata);
GC::Mark(sec->ceilingdata);

View file

@ -67,13 +67,13 @@ void ASkyViewpoint::Destroy ()
// remove all sector references to ourselves.
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)
@ -129,12 +129,12 @@ void ASkyPicker::PostBeginPlay ()
{
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 (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
}
}

View file

@ -418,7 +418,7 @@ void P_SerializeWorld (FArchive &arc)
<< sec->sky
<< sec->MoreFlags
<< sec->Flags
<< sec->FloorSkyBox << sec->CeilingSkyBox
<< sec->SkyBoxes[sector_t::floor] << sec->SkyBoxes[sector_t::ceiling]
<< sec->ZoneNumber;
if (SaveVersion < 4529)
{

View file

@ -805,16 +805,8 @@ int sector_t::GetCeilingLight () const
ASkyViewpoint *sector_t::GetSkyBox(int which)
{
if (which == floor)
{
if (FloorSkyBox != NULL) return FloorSkyBox;
if (MoreFlags & SECF_NOFLOORSKYBOX) return NULL;
}
else
{
if (CeilingSkyBox != NULL) return CeilingSkyBox;
if (MoreFlags & SECF_NOCEILINGSKYBOX) return NULL;
}
if (SkyBoxes[which] != NULL) return SkyBoxes[which];
if (MoreFlags & (SECF_NOFLOORSKYBOX << which)) return NULL;
return level.DefaultSkybox;
}

View file

@ -912,10 +912,10 @@ static void SetupFloorPortal (AStackPoint *point)
{
NActorIterator it (NAME_LowerStackLookOnly, point->tid);
sector_t *Sector = point->Sector;
Sector->FloorSkyBox = static_cast<ASkyViewpoint*>(it.Next());
if (Sector->FloorSkyBox != NULL && Sector->FloorSkyBox->bAlways)
Sector->SkyBoxes[sector_t::floor] = static_cast<ASkyViewpoint*>(it.Next());
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)
Sector->SetAlpha(sector_t::floor, Scale (point->args[0], OPAQUE, 255));
}
@ -925,48 +925,15 @@ static void SetupCeilingPortal (AStackPoint *point)
{
NActorIterator it (NAME_UpperStackLookOnly, point->tid);
sector_t *Sector = point->Sector;
Sector->CeilingSkyBox = static_cast<ASkyViewpoint*>(it.Next());
if (Sector->CeilingSkyBox != NULL && Sector->CeilingSkyBox->bAlways)
Sector->SkyBoxes[sector_t::ceiling] = static_cast<ASkyViewpoint*>(it.Next());
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)
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()
{
TThinkerIterator<AStackPoint> it;
@ -994,9 +961,9 @@ static void SetPortal(sector_t *sector, int plane, ASkyViewpoint *portal, fixed_
// plane: 0=floor, 1=ceiling, 2=both
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)
sector->SetAlpha(sector_t::ceiling, alpha);
@ -1005,9 +972,9 @@ static void SetPortal(sector_t *sector, int plane, ASkyViewpoint *portal, fixed_
}
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)
sector->SetAlpha(sector_t::floor, alpha);

View file

@ -389,7 +389,7 @@ enum
SECF_DRAWN = 128, // sector has been drawn at least once
SECF_HIDDEN = 256, // Do not draw on textured automap
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
@ -849,7 +849,7 @@ struct sector_t
// [RH] The sky box to render for this sector. NULL means use a
// regular sky.
TObjPtr<ASkyViewpoint> FloorSkyBox, CeilingSkyBox;
TObjPtr<ASkyViewpoint> SkyBoxes[2];
int sectornum; // for comparing sector copies

View file

@ -1417,7 +1417,7 @@ get_sample_data(struct _patch *sample_patch, unsigned long int freq) {
void _WM_AdjustNoteVolumes(struct _mdi *mdi, unsigned char ch, struct _note *nte) {
double premix_dBm;
double premix_lin;
unsigned char pan_ofs;
int pan_ofs;
double premix_dBm_left;
double premix_dBm_right;
double premix_left;
@ -2893,7 +2893,7 @@ void WildMidi_Renderer::LongEvent(const unsigned char *data, int len)
{
sysex_ch -= 1;
}
_event_data ev = { sysex_ch, static_cast<unsigned long>(data[8]) };
_event_data ev = { sysex_ch, data[8] };
do_sysex_roland_drum_track((_mdi *)handle, &ev);
}
else if (data[6] == 0x00 && data[7] == 0x7F && data[8] == 0x00)