mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-31 13:10:39 +00:00
- first batch of routing all write access to sectortype::ceilingz and floorz through a function interface.
We need this for implementing "precise" rendering to flag vertices as dirty.
This commit is contained in:
parent
c24aafd3d6
commit
059412b75e
15 changed files with 158 additions and 99 deletions
|
@ -63,8 +63,8 @@ void Set(int index, int type, double val)
|
|||
int old;
|
||||
switch(type)
|
||||
{
|
||||
case Interp_Sect_Floorz: sector[index].floorz = xs_CRoundToInt(val); break;
|
||||
case Interp_Sect_Ceilingz: sector[index].ceilingz = xs_CRoundToInt(val); break;
|
||||
case Interp_Sect_Floorz: sector[index].setfloorz(xs_CRoundToInt(val)); break;
|
||||
case Interp_Sect_Ceilingz: sector[index].setceilingz(xs_CRoundToInt(val)); break;
|
||||
case Interp_Sect_Floorheinum: sector[index].floorheinum = (short)xs_CRoundToInt(val); break;
|
||||
case Interp_Sect_Ceilingheinum: sector[index].ceilingheinum = (short)xs_CRoundToInt(val); break;
|
||||
case Interp_Sect_FloorPanX: sector[index].floorxpan_ = float(val); break;
|
||||
|
|
|
@ -98,8 +98,8 @@ static void ReadSectorV7(FileReader& fr, sectortype& sect)
|
|||
{
|
||||
sect.wallptr = fr.ReadInt16();
|
||||
sect.wallnum = fr.ReadInt16();
|
||||
sect.ceilingz = fr.ReadInt32();
|
||||
sect.floorz = fr.ReadInt32();
|
||||
sect.setceilingz(fr.ReadInt32());
|
||||
sect.setfloorz(fr.ReadInt32());
|
||||
sect.ceilingstat = ESectorFlags::FromInt(fr.ReadUInt16());
|
||||
sect.floorstat = ESectorFlags::FromInt(fr.ReadUInt16());
|
||||
sect.ceilingpicnum = fr.ReadUInt16();
|
||||
|
@ -129,8 +129,8 @@ static void ReadSectorV6(FileReader& fr, sectortype& sect)
|
|||
sect.floorpicnum = fr.ReadUInt16();
|
||||
sect.ceilingheinum = clamp(fr.ReadInt16() << 5, -32768, 32767);
|
||||
sect.floorheinum = clamp(fr.ReadInt16() << 5, -32768, 32767);
|
||||
sect.ceilingz = fr.ReadInt32();
|
||||
sect.floorz = fr.ReadInt32();
|
||||
sect.setceilingz(fr.ReadInt32());
|
||||
sect.setfloorz(fr.ReadInt32());
|
||||
sect.ceilingshade = fr.ReadInt8();
|
||||
sect.floorshade = fr.ReadInt8();
|
||||
sect.ceilingxpan_ = fr.ReadUInt8();
|
||||
|
@ -156,8 +156,8 @@ static void ReadSectorV5(FileReader& fr, sectortype& sect)
|
|||
sect.floorpicnum = fr.ReadUInt16();
|
||||
sect.ceilingheinum = clamp(fr.ReadInt16() << 5, -32768, 32767);
|
||||
sect.floorheinum = clamp(fr.ReadInt16() << 5, -32768, 32767);
|
||||
sect.ceilingz = fr.ReadInt32();
|
||||
sect.floorz = fr.ReadInt32();
|
||||
sect.setceilingz(fr.ReadInt32());
|
||||
sect.setfloorz(fr.ReadInt32());
|
||||
sect.ceilingshade = fr.ReadInt8();
|
||||
sect.floorshade = fr.ReadInt8();
|
||||
sect.ceilingxpan_ = fr.ReadUInt8();
|
||||
|
|
|
@ -184,6 +184,9 @@ END_BLD_NS
|
|||
class DCoreActor;
|
||||
struct walltype;
|
||||
|
||||
// enable for running a compile-check to ensure that renderer-critical variables are not being written to directly.
|
||||
//#define SECTOR_HACKJOB
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// internal sector struct - no longer identical with on-disk format
|
||||
|
@ -192,12 +195,58 @@ struct walltype;
|
|||
|
||||
struct sectortype
|
||||
{
|
||||
|
||||
// Fields were reordered by size, some also enlarged.
|
||||
DCoreActor* firstEntry, * lastEntry;
|
||||
|
||||
int32_t wallptr;
|
||||
#ifdef SECTOR_HACKJOB
|
||||
// Debug hack job for finding all places where ceilingz and floorz get written to.
|
||||
// If the engine does not compile with this block on, we got a problem.
|
||||
// Since this is only for compile verification there's no need to provide a working implementation.
|
||||
const int32_t ceilingz;
|
||||
const int32_t floorz;
|
||||
sectortype(int a = 0, int b = 0) : ceilingz(a), floorz(b) {}
|
||||
|
||||
void setceilingz(int cc, bool temp = false) {}
|
||||
void setfloorz(int cc, bool temp = false) {}
|
||||
void addceilingz(int cc, bool temp = false) {}
|
||||
void addfloorz(int cc, bool temp = false) {}
|
||||
int32_t* ceilingzptr(bool temp = false) { return nullptr; }
|
||||
int32_t* floorzptr(bool temp = false) { return nullptr; }
|
||||
|
||||
#else
|
||||
// Do not change directly!
|
||||
int32_t ceilingz;
|
||||
int32_t floorz;
|
||||
|
||||
void setceilingz(int cc, bool temp = false)
|
||||
{
|
||||
ceilingz = cc;
|
||||
}
|
||||
void setfloorz(int cc, bool temp = false)
|
||||
{
|
||||
floorz = cc;
|
||||
}
|
||||
void addceilingz(int cc, bool temp = false)
|
||||
{
|
||||
ceilingz += cc;
|
||||
}
|
||||
void addfloorz(int cc, bool temp = false)
|
||||
{
|
||||
floorz += cc;
|
||||
}
|
||||
int32_t* ceilingzptr(bool temp = false)
|
||||
{
|
||||
return &ceilingz;
|
||||
}
|
||||
int32_t* floorzptr(bool temp = false)
|
||||
{
|
||||
return &floorz;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// panning byte fields were promoted to full floats to enable panning interpolation.
|
||||
float ceilingxpan_;
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
HWSkyInfo * sky; // for normal sky
|
||||
//HWHorizonInfo * horizon; // for horizon information
|
||||
PortalDesc * portal; // stacked sector portals
|
||||
int * planemirror; // for plane mirrors
|
||||
const int * planemirror; // for plane mirrors
|
||||
spritetype* teleport; // SW's teleport-views
|
||||
};
|
||||
|
||||
|
|
|
@ -512,8 +512,10 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
|
|||
("lastentry", c.lastEntry)
|
||||
("wallptr", c.wallptr, def->wallptr)
|
||||
("wallnum", c.wallnum, def->wallnum)
|
||||
#ifndef SECTOR_HACKJOB //
|
||||
("ceilingz", c.ceilingz, def->ceilingz)
|
||||
("floorz", c.floorz, def->floorz)
|
||||
#endif
|
||||
("ceilingstat", c.ceilingstat, def->ceilingstat)
|
||||
("floorstat", c.floorstat, def->floorstat)
|
||||
("ceilingpicnum", c.ceilingpicnum, def->ceilingpicnum)
|
||||
|
|
|
@ -379,7 +379,11 @@ bool SectionGeometry::ValidateSection(Section* section, int plane)
|
|||
|
||||
section->dirty &= ~EDirty::CeilingDirty;
|
||||
}
|
||||
#ifdef SECTOR_HACKJOB
|
||||
memcpy(compare, sec, sizeof(*sec));
|
||||
#else
|
||||
*compare = *sec;
|
||||
#endif
|
||||
sdata.poscompare[plane] = sec->firstWall()->pos;
|
||||
sdata.poscompare2[plane] = sec->firstWall()->point2Wall()->pos;
|
||||
return false;
|
||||
|
@ -435,7 +439,8 @@ void SectionGeometry::CreatePlaneMesh(Section* section, int plane, const FVector
|
|||
auto& sdata = data[section->index];
|
||||
auto& entry = sdata.planes[plane];
|
||||
int fz = sectorp->floorz, cz = sectorp->ceilingz;
|
||||
sectorp->floorz = sectorp->ceilingz = 0;
|
||||
sectorp->setfloorz(0, true);
|
||||
sectorp->setceilingz(0, true);
|
||||
|
||||
UVCalculator uvcalc(sectorp, plane, texture, offset);
|
||||
|
||||
|
@ -453,8 +458,8 @@ void SectionGeometry::CreatePlaneMesh(Section* section, int plane, const FVector
|
|||
tc = uvcalc.GetUV(int(pt.X * 16.), int(pt.Y * -16.), pt.Z);
|
||||
}
|
||||
entry.normal = CalcNormal(sectorp, plane);
|
||||
sectorp->floorz = fz;
|
||||
sectorp->ceilingz = cz;
|
||||
sectorp->setfloorz(fz, true);
|
||||
sectorp->setceilingz(cz, true);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -71,14 +71,14 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
|
|||
if (k == tag + 0)
|
||||
{
|
||||
sect->Flag = sect->floorz;
|
||||
sect->floorz += (((z - sect->floorz) / 32768) + 1) * 32768;
|
||||
sect->addfloorz((((z - sect->floorz) / 32768) + 1) * 32768, true);
|
||||
sect->Damage = sect->floorpicnum;
|
||||
sect->floorpicnum = 13;
|
||||
}
|
||||
if (k == tag + 1)
|
||||
{
|
||||
sect->Flag = sect->ceilingz;
|
||||
sect->ceilingz += (((z - sect->ceilingz) / 32768) - 1) * 32768;
|
||||
sect->addceilingz((((z - sect->ceilingz) / 32768) - 1) * 32768, true);
|
||||
sect->Damage = sect->ceilingpicnum;
|
||||
sect->ceilingpicnum = 13;
|
||||
}
|
||||
|
@ -103,12 +103,12 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
|
|||
auto sect = act->spr.sector();
|
||||
if (k == tag + 0)
|
||||
{
|
||||
sect->floorz = sect->Flag;
|
||||
sect->setfloorz(sect->Flag, true);
|
||||
sect->floorpicnum = sect->Damage;
|
||||
}
|
||||
if (k == tag + 1)
|
||||
{
|
||||
sect->ceilingz = sect->Flag;
|
||||
sect->setceilingz(sect->Flag, true);
|
||||
sect->ceilingpicnum = sect->Damage;
|
||||
}
|
||||
}// end if
|
||||
|
|
|
@ -1094,12 +1094,12 @@ void movetouchplate(DDukeActor* actor, int plate)
|
|||
{
|
||||
if (x >= actor->temp_data[2])
|
||||
{
|
||||
sectp->floorz = x;
|
||||
sectp->setfloorz(x);
|
||||
actor->temp_data[1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sectp->floorz += sectp->extra;
|
||||
sectp->addfloorz(sectp->extra);
|
||||
p = checkcursectnums(actor->spr.sector());
|
||||
if (p >= 0) ps[p].pos.Z += sectp->extra;
|
||||
}
|
||||
|
@ -1108,12 +1108,12 @@ void movetouchplate(DDukeActor* actor, int plate)
|
|||
{
|
||||
if (x <= actor->spr.pos.Z)
|
||||
{
|
||||
sectp->floorz = actor->spr.pos.Z;
|
||||
sectp->setfloorz(actor->spr.pos.Z);
|
||||
actor->temp_data[1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sectp->floorz -= sectp->extra;
|
||||
sectp->addfloorz(-sectp->extra);
|
||||
p = checkcursectnums(actor->spr.sector());
|
||||
if (p >= 0)
|
||||
ps[p].pos.Z -= sectp->extra;
|
||||
|
@ -2613,18 +2613,18 @@ void handle_se00(DDukeActor* actor, int LASERLINE)
|
|||
|
||||
if (sect->floorz > actor->spr.pos.Z) //z's are touching
|
||||
{
|
||||
sect->floorz -= 512;
|
||||
sect->addfloorz(-512);
|
||||
zchange = -512;
|
||||
if (sect->floorz < actor->spr.pos.Z)
|
||||
sect->floorz = actor->spr.pos.Z;
|
||||
sect->setfloorz(actor->spr.pos.Z);
|
||||
}
|
||||
|
||||
else if (sect->floorz < actor->spr.pos.Z) //z's are touching
|
||||
{
|
||||
sect->floorz += 512;
|
||||
sect->addfloorz(512);
|
||||
zchange = 512;
|
||||
if (sect->floorz > actor->spr.pos.Z)
|
||||
sect->floorz = actor->spr.pos.Z;
|
||||
sect->setfloorz(actor->spr.pos.Z);
|
||||
}
|
||||
}
|
||||
else if (actor->spr.extra == 3)
|
||||
|
@ -2641,18 +2641,18 @@ void handle_se00(DDukeActor* actor, int LASERLINE)
|
|||
|
||||
if (sect->floorz > actor->temp_data[3]) //z's are touching
|
||||
{
|
||||
sect->floorz -= 512;
|
||||
sect->addfloorz(-512);
|
||||
zchange = -512;
|
||||
if (sect->floorz < actor->temp_data[3])
|
||||
sect->floorz = actor->temp_data[3];
|
||||
sect->setfloorz(actor->temp_data[3]);
|
||||
}
|
||||
|
||||
else if (sect->floorz < actor->temp_data[3]) //z's are touching
|
||||
{
|
||||
sect->floorz += 512;
|
||||
sect->addfloorz(512);
|
||||
zchange = 512;
|
||||
if (sect->floorz > actor->temp_data[3])
|
||||
sect->floorz = actor->temp_data[3];
|
||||
sect->setfloorz(actor->temp_data[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3396,8 +3396,8 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
|
|||
}
|
||||
|
||||
actor->spr.pos.Z += actor->spr.zvel;
|
||||
sc->ceilingz += actor->spr.zvel;
|
||||
actor->temp_sect->ceilingz += actor->spr.zvel;
|
||||
sc->addceilingz(actor->spr.zvel);
|
||||
actor->temp_sect->addceilingz(actor->spr.zvel);
|
||||
ms(actor);
|
||||
SetActor(actor, actor->spr.pos);
|
||||
}
|
||||
|
@ -3682,24 +3682,24 @@ void handle_se13(DDukeActor* actor)
|
|||
if (actor->spriteextra)
|
||||
{
|
||||
if (abs(actor->temp_data[0] - sc->ceilingz) >= j)
|
||||
sc->ceilingz += Sgn(actor->temp_data[0] - sc->ceilingz) * j;
|
||||
else sc->ceilingz = actor->temp_data[0];
|
||||
sc->addceilingz(Sgn(actor->temp_data[0] - sc->ceilingz) * j);
|
||||
else sc->setceilingz(actor->temp_data[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs(actor->temp_data[1] - sc->floorz) >= j)
|
||||
sc->floorz += Sgn(actor->temp_data[1] - sc->floorz) * j;
|
||||
else sc->floorz = actor->temp_data[1];
|
||||
sc->addfloorz(Sgn(actor->temp_data[1] - sc->floorz) * j);
|
||||
else sc->setfloorz(actor->temp_data[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs(actor->temp_data[1] - sc->floorz) >= j)
|
||||
sc->floorz += Sgn(actor->temp_data[1] - sc->floorz) * j;
|
||||
else sc->floorz = actor->temp_data[1];
|
||||
sc->addfloorz(Sgn(actor->temp_data[1] - sc->floorz) * j);
|
||||
else sc->setfloorz(actor->temp_data[1]);
|
||||
if (abs(actor->temp_data[0] - sc->ceilingz) >= j)
|
||||
sc->ceilingz += Sgn(actor->temp_data[0] - sc->ceilingz) * j;
|
||||
sc->ceilingz = actor->temp_data[0];
|
||||
sc->addceilingz(Sgn(actor->temp_data[0] - sc->ceilingz) * j);
|
||||
sc->setceilingz(actor->temp_data[0]);
|
||||
}
|
||||
|
||||
if (actor->temp_data[3] == 1)
|
||||
|
@ -3810,8 +3810,8 @@ void handle_se16(DDukeActor* actor, int REACTOR, int REACTOR2)
|
|||
else actor->spr.shade = 1;
|
||||
}
|
||||
|
||||
if (actor->spr.shade) sc->ceilingz += 1024;
|
||||
else sc->ceilingz -= 512;
|
||||
if (actor->spr.shade) sc->addceilingz(1024);
|
||||
else sc->addceilingz(-512);
|
||||
|
||||
ms(actor);
|
||||
SetActor(actor, actor->spr.pos);
|
||||
|
@ -3830,8 +3830,8 @@ void handle_se17(DDukeActor* actor)
|
|||
|
||||
int q = actor->temp_data[0] * (actor->spr.yvel << 2);
|
||||
|
||||
sc->ceilingz += q;
|
||||
sc->floorz += q;
|
||||
sc->addceilingz(q);
|
||||
sc->addfloorz(q);
|
||||
|
||||
DukeSectIterator it(actor->sector());
|
||||
while (auto act1 = it.Next())
|
||||
|
@ -3944,17 +3944,17 @@ void handle_se18(DDukeActor *actor, bool morecheck)
|
|||
{
|
||||
if (actor->spr.ang == 512)
|
||||
{
|
||||
sc->ceilingz -= sc->extra;
|
||||
sc->addceilingz(-sc->extra);
|
||||
if (sc->ceilingz <= actor->temp_data[1])
|
||||
{
|
||||
sc->ceilingz = actor->temp_data[1];
|
||||
sc->setceilingz(actor->temp_data[1]);
|
||||
deletesprite(actor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc->floorz += sc->extra;
|
||||
sc->addfloorz(sc->extra);
|
||||
if (morecheck)
|
||||
{
|
||||
DukeSectIterator it(actor->sector());
|
||||
|
@ -3971,7 +3971,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
|
|||
}
|
||||
if (sc->floorz >= actor->temp_data[1])
|
||||
{
|
||||
sc->floorz = actor->temp_data[1];
|
||||
sc->setfloorz(actor->temp_data[1]);
|
||||
deletesprite(actor);
|
||||
return;
|
||||
}
|
||||
|
@ -3981,17 +3981,17 @@ void handle_se18(DDukeActor *actor, bool morecheck)
|
|||
{
|
||||
if (actor->spr.ang == 512)
|
||||
{
|
||||
sc->ceilingz += sc->extra;
|
||||
sc->addceilingz(sc->extra);
|
||||
if (sc->ceilingz >= actor->spr.pos.Z)
|
||||
{
|
||||
sc->ceilingz = actor->spr.pos.Z;
|
||||
sc->setceilingz(actor->spr.pos.Z);
|
||||
deletesprite(actor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc->floorz -= sc->extra;
|
||||
sc->addfloorz(-sc->extra);
|
||||
if (morecheck)
|
||||
{
|
||||
DukeSectIterator it(actor->sector());
|
||||
|
@ -4008,7 +4008,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
|
|||
}
|
||||
if (sc->floorz <= actor->spr.pos.Z)
|
||||
{
|
||||
sc->floorz = actor->spr.pos.Z;
|
||||
sc->setfloorz(actor->spr.pos.Z);
|
||||
deletesprite(actor);
|
||||
return;
|
||||
}
|
||||
|
@ -4057,10 +4057,10 @@ void handle_se19(DDukeActor *actor, int BIGFORCE)
|
|||
}
|
||||
|
||||
if (sc->ceilingz < sc->floorz)
|
||||
sc->ceilingz += actor->spr.yvel;
|
||||
sc->addceilingz(actor->spr.yvel);
|
||||
else
|
||||
{
|
||||
sc->ceilingz = sc->floorz;
|
||||
sc->setceilingz(sc->floorz);
|
||||
|
||||
DukeStatIterator it(STAT_EFFECTOR);
|
||||
while (auto a2 = it.Next())
|
||||
|
@ -4204,9 +4204,9 @@ void handle_se21(DDukeActor* actor)
|
|||
if (actor->temp_data[0] == 0) return;
|
||||
|
||||
if (actor->spr.ang == 1536)
|
||||
lp = &sc->ceilingz;
|
||||
lp = sc->ceilingzptr();
|
||||
else
|
||||
lp = &sc->floorz;
|
||||
lp = sc->floorzptr();
|
||||
|
||||
if (actor->temp_data[0] == 1) //Decide if the sector should go up or down
|
||||
{
|
||||
|
@ -4239,7 +4239,7 @@ void handle_se22(DDukeActor* actor)
|
|||
if (actor->temp_data[1])
|
||||
{
|
||||
if (getanimationgoal(anim_ceilingz, actor->temp_sect) >= 0)
|
||||
sc->ceilingz += sc->extra * 9;
|
||||
sc->addceilingz(sc->extra * 9);
|
||||
else actor->temp_data[1] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -4264,11 +4264,11 @@ void handle_se26(DDukeActor* actor)
|
|||
{
|
||||
actor->spr.pos.X = actor->temp_data[3];
|
||||
actor->spr.pos.Y = actor->temp_data[4];
|
||||
sc->floorz -= ((actor->spr.zvel * actor->spr.shade) - actor->spr.zvel);
|
||||
sc->addfloorz(-((actor->spr.zvel * actor->spr.shade) - actor->spr.zvel));
|
||||
actor->spr.shade = 0;
|
||||
}
|
||||
else
|
||||
sc->floorz += actor->spr.zvel;
|
||||
sc->addfloorz(actor->spr.zvel);
|
||||
|
||||
DukeSectIterator it(actor->sector());
|
||||
while (auto a2 = it.Next())
|
||||
|
@ -4447,20 +4447,20 @@ void handle_se25(DDukeActor* actor, int t_index, int snd1, int snd2)
|
|||
|
||||
if (actor->spr.shade)
|
||||
{
|
||||
sec->ceilingz += actor->spr.yvel << 4;
|
||||
sec->addceilingz(actor->spr.yvel << 4);
|
||||
if (sec->ceilingz > sec->floorz)
|
||||
{
|
||||
sec->ceilingz = sec->floorz;
|
||||
sec->setceilingz(sec->floorz);
|
||||
if (pistonsound && snd1 >= 0)
|
||||
S_PlayActorSound(snd1, actor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sec->ceilingz -= actor->spr.yvel << 4;
|
||||
sec->addceilingz(-actor->spr.yvel << 4);
|
||||
if (sec->ceilingz < actor->temp_data[t_index])
|
||||
{
|
||||
sec->ceilingz = actor->temp_data[t_index];
|
||||
sec->setceilingz(actor->temp_data[t_index]);
|
||||
if (pistonsound && snd2 >= 0)
|
||||
S_PlayActorSound(snd2, actor);
|
||||
}
|
||||
|
@ -4487,23 +4487,23 @@ void handle_se32(DDukeActor *actor)
|
|||
{
|
||||
if (abs(sc->ceilingz - actor->spr.pos.Z) < (actor->spr.yvel << 1))
|
||||
{
|
||||
sc->ceilingz = actor->spr.pos.Z;
|
||||
sc->setceilingz(actor->spr.pos.Z);
|
||||
callsound(actor->spr.sector(), actor);
|
||||
actor->temp_data[2] = 0;
|
||||
actor->temp_data[0] = 0;
|
||||
}
|
||||
else sc->ceilingz += Sgn(actor->spr.pos.Z - sc->ceilingz) * actor->spr.yvel;
|
||||
else sc->addceilingz(Sgn(actor->spr.pos.Z - sc->ceilingz) * actor->spr.yvel);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs(sc->ceilingz - actor->temp_data[1]) < (actor->spr.yvel << 1))
|
||||
{
|
||||
sc->ceilingz = actor->temp_data[1];
|
||||
sc->setceilingz(actor->temp_data[1]);
|
||||
callsound(actor->spr.sector(), actor);
|
||||
actor->temp_data[2] = 0;
|
||||
actor->temp_data[0] = 0;
|
||||
}
|
||||
else sc->ceilingz += Sgn(actor->temp_data[1] - sc->ceilingz) * actor->spr.yvel;
|
||||
else sc->addceilingz((actor->temp_data[1] - sc->ceilingz) * actor->spr.yvel);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -4515,9 +4515,9 @@ void handle_se32(DDukeActor *actor)
|
|||
actor->temp_data[0] = 0;
|
||||
actor->temp_data[2] = !actor->temp_data[2];
|
||||
callsound(actor->spr.sector(), actor);
|
||||
sc->ceilingz = actor->spr.pos.Z;
|
||||
sc->setceilingz(actor->spr.pos.Z);
|
||||
}
|
||||
else sc->ceilingz += Sgn(actor->spr.pos.Z - sc->ceilingz) * actor->spr.yvel;
|
||||
else sc->addceilingz(Sgn(actor->spr.pos.Z - sc->ceilingz) * actor->spr.yvel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4527,7 +4527,7 @@ void handle_se32(DDukeActor *actor)
|
|||
actor->temp_data[2] = !actor->temp_data[2];
|
||||
callsound(actor->spr.sector(), actor);
|
||||
}
|
||||
else sc->ceilingz -= Sgn(actor->spr.pos.Z - actor->temp_data[1]) * actor->spr.yvel;
|
||||
else sc->addceilingz(-Sgn(actor->spr.pos.Z - actor->temp_data[1]) * actor->spr.yvel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4561,17 +4561,17 @@ void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2)
|
|||
switch (actor->temp_data[0])
|
||||
{
|
||||
case 0:
|
||||
sc->ceilingz += actor->spr.yvel;
|
||||
sc->addceilingz(actor->spr.yvel);
|
||||
if (sc->ceilingz > sc->floorz)
|
||||
sc->floorz = sc->ceilingz;
|
||||
sc->setfloorz(sc->ceilingz);
|
||||
if (sc->ceilingz > actor->spr.pos.Z + (32 << 8))
|
||||
actor->temp_data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
sc->ceilingz -= (actor->spr.yvel << 2);
|
||||
sc->addceilingz(-(actor->spr.yvel << 2));
|
||||
if (sc->ceilingz < actor->temp_data[4])
|
||||
{
|
||||
sc->ceilingz = actor->temp_data[4];
|
||||
sc->setceilingz(actor->temp_data[4]);
|
||||
actor->temp_data[0] = 0;
|
||||
}
|
||||
break;
|
||||
|
@ -4675,7 +4675,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
|
|||
{
|
||||
if (abs(sec->floorz - actor->spr.pos.Z) < actor->spr.yvel)
|
||||
{
|
||||
sec->floorz = actor->spr.pos.Z;
|
||||
sec->setfloorz(actor->spr.pos.Z);
|
||||
actor->temp_data[2] = 0;
|
||||
actor->temp_data[0] = 0;
|
||||
if (choosedir) actor->temp_data[3] = actor->spr.hitag;
|
||||
|
@ -4684,7 +4684,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
|
|||
else
|
||||
{
|
||||
int l = Sgn(actor->spr.pos.Z - sec->floorz) * actor->spr.yvel;
|
||||
sec->floorz += l;
|
||||
sec->addfloorz(l);
|
||||
|
||||
DukeSectIterator it(actor->sector());
|
||||
while (auto a2 = it.Next())
|
||||
|
@ -4704,7 +4704,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
|
|||
{
|
||||
if (abs(sec->floorz - actor->temp_data[1]) < actor->spr.yvel)
|
||||
{
|
||||
sec->floorz = actor->temp_data[1];
|
||||
sec->setfloorz(actor->temp_data[1]);
|
||||
callsound(actor->spr.sector(), actor);
|
||||
actor->temp_data[2] = 0;
|
||||
actor->temp_data[0] = 0;
|
||||
|
@ -4713,7 +4713,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
|
|||
else
|
||||
{
|
||||
int l = Sgn(actor->temp_data[1] - sec->floorz) * actor->spr.yvel;
|
||||
sec->floorz += l;
|
||||
sec->addfloorz(l);
|
||||
|
||||
DukeSectIterator it(actor->sector());
|
||||
while (auto a2 = it.Next())
|
||||
|
@ -4744,7 +4744,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
|
|||
else
|
||||
{
|
||||
int l = Sgn(actor->spr.pos.Z - sec->floorz) * actor->spr.yvel;
|
||||
sec->floorz += l;
|
||||
sec->addfloorz(l);
|
||||
|
||||
DukeSectIterator it(actor->sector());
|
||||
while (auto a2 = it.Next())
|
||||
|
@ -4772,7 +4772,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
|
|||
else
|
||||
{
|
||||
int l = Sgn(actor->spr.pos.Z - actor->temp_data[1]) * actor->spr.yvel;
|
||||
sec->floorz -= l;
|
||||
sec->addfloorz(-l);
|
||||
|
||||
DukeSectIterator it(actor->sector());
|
||||
while (auto a2 = it.Next())
|
||||
|
|
|
@ -3598,7 +3598,7 @@ void moveeffectors_d(void) //STATNUM 3
|
|||
case SE_29_WAVES:
|
||||
act->spr.hitag += 64;
|
||||
l = MulScale(act->spr.yvel, bsin(act->spr.hitag), 12);
|
||||
sc->floorz = act->spr.pos.Z + l;
|
||||
sc->setfloorz(act->spr.pos.Z + l);
|
||||
break;
|
||||
case SE_31_FLOOR_RISE_FALL: // True Drop Floor
|
||||
handle_se31(act, true);
|
||||
|
|
|
@ -3560,7 +3560,7 @@ void moveeffectors_r(void) //STATNUM 3
|
|||
case SE_29_WAVES:
|
||||
act->spr.hitag += 64;
|
||||
l = MulScale(act->spr.yvel, bsin(act->spr.hitag), 12);
|
||||
sc->floorz = act->spr.pos.Z + l;
|
||||
sc->setfloorz(act->spr.pos.Z + l);
|
||||
break;
|
||||
|
||||
case SE_31_FLOOR_RISE_FALL: // True Drop Floor
|
||||
|
@ -4105,8 +4105,8 @@ void destroyit(DDukeActor *actor)
|
|||
destwal->nextWall()->cstat = 0;
|
||||
}
|
||||
}
|
||||
destsect->floorz = srcsect->floorz;
|
||||
destsect->ceilingz = srcsect->ceilingz;
|
||||
destsect->setfloorz(srcsect->floorz);
|
||||
destsect->setceilingz(srcsect->ceilingz);
|
||||
destsect->ceilingstat = srcsect->ceilingstat;
|
||||
destsect->floorstat = srcsect->floorstat;
|
||||
destsect->ceilingpicnum = srcsect->ceilingpicnum;
|
||||
|
|
|
@ -1069,11 +1069,11 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
if (!bSet) SetGameVarID(lVar2, sectp->wallnum, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGZ:
|
||||
if (bSet) sectp->ceilingz = lValue;
|
||||
if (bSet) sectp->setceilingz(lValue);
|
||||
else SetGameVarID(lVar2, sectp->ceilingz, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORZ:
|
||||
if (bSet) sectp->floorz = lValue;
|
||||
if (bSet) sectp->setfloorz(lValue);
|
||||
else SetGameVarID(lVar2, sectp->floorz, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGSTAT:
|
||||
|
|
|
@ -283,9 +283,9 @@ int* animateptr(int type, int index, bool write)
|
|||
switch (type)
|
||||
{
|
||||
case anim_floorz:
|
||||
return §or[index].floorz;
|
||||
return sector[index].floorzptr(!write);
|
||||
case anim_ceilingz:
|
||||
return §or[index].ceilingz;
|
||||
return sector[index].ceilingzptr(!write);
|
||||
case anim_vertexx:
|
||||
if (write) wall[index].moved();
|
||||
return &wall[index].pos.X;
|
||||
|
@ -1243,8 +1243,8 @@ void allignwarpelevators(void)
|
|||
{
|
||||
if ((act2->spr.lotag) == SE_17_WARP_ELEVATOR && act != act2 && act->spr.hitag == act2->spr.hitag)
|
||||
{
|
||||
act2->sector()->floorz = act->sector()->floorz;
|
||||
act2->sector()->ceilingz = act->sector()->ceilingz;
|
||||
act2->sector()->setfloorz(act->sector()->floorz);
|
||||
act2->sector()->setceilingz(act->sector()->ceilingz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -644,13 +644,13 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
|
|||
{
|
||||
actor->temp_data[1] = sectp->ceilingz;
|
||||
if (actor->spr.pal)
|
||||
sectp->ceilingz = actor->spr.pos.Z;
|
||||
sectp->setceilingz(actor->spr.pos.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->temp_data[1] = sectp->floorz;
|
||||
if (actor->spr.pal)
|
||||
sectp->floorz = actor->spr.pos.Z;
|
||||
sectp->setfloorz(actor->spr.pos.Z);
|
||||
}
|
||||
|
||||
actor->spr.hitag <<= 2;
|
||||
|
@ -668,11 +668,11 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
|
|||
else
|
||||
actor->temp_data[4] = sectp->ceilingz;
|
||||
|
||||
sectp->ceilingz = actor->spr.pos.Z;
|
||||
sectp->setceilingz(actor->spr.pos.Z);
|
||||
StartInterpolation(sectp, Interp_Sect_Ceilingz);
|
||||
break;
|
||||
case SE_35:
|
||||
sectp->ceilingz = actor->spr.pos.Z;
|
||||
sectp->setceilingz(actor->spr.pos.Z);
|
||||
break;
|
||||
case SE_27_DEMO_CAM:
|
||||
if (ud.recstat == 1)
|
||||
|
@ -702,12 +702,15 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
|
|||
if (actor->spr.ang == 512)
|
||||
{
|
||||
if (ceiling)
|
||||
sectp->ceilingz = actor->spr.pos.Z;
|
||||
sectp->setceilingz(actor->spr.pos.Z);
|
||||
else
|
||||
sectp->floorz = actor->spr.pos.Z;
|
||||
sectp->setfloorz(actor->spr.pos.Z);
|
||||
}
|
||||
else
|
||||
sectp->ceilingz = sectp->floorz = actor->spr.pos.Z;
|
||||
{
|
||||
sectp->setceilingz(actor->spr.pos.Z);
|
||||
sectp->setfloorz(actor->spr.pos.Z);
|
||||
}
|
||||
|
||||
if (sectp->ceilingstat & CSTAT_SECTOR_SKY)
|
||||
{
|
||||
|
@ -832,7 +835,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
|
|||
case SE_31_FLOOR_RISE_FALL:
|
||||
actor->temp_data[1] = sectp->floorz;
|
||||
// actor->temp_data[2] = actor->spr.hitag;
|
||||
if (actor->spr.ang != 1536) sectp->floorz = actor->spr.pos.Z;
|
||||
if (actor->spr.ang != 1536) sectp->setfloorz(actor->spr.pos.Z);
|
||||
|
||||
for (auto& wal : wallsofsector(sectp))
|
||||
if (wal.hitag == 0) wal.hitag = 9999;
|
||||
|
@ -843,7 +846,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
|
|||
case SE_32_CEILING_RISE_FALL:
|
||||
actor->temp_data[1] = sectp->ceilingz;
|
||||
actor->temp_data[2] = actor->spr.hitag;
|
||||
if (actor->spr.ang != 1536) sectp->ceilingz = actor->spr.pos.Z;
|
||||
if (actor->spr.ang != 1536) sectp->setceilingz(actor->spr.pos.Z);
|
||||
|
||||
for (auto& wal : wallsofsector(sectp))
|
||||
if (wal.hitag == 0) wal.hitag = 9999;
|
||||
|
|
|
@ -724,7 +724,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
case TOUCHPLATE:
|
||||
act->temp_data[2] = sectp->floorz;
|
||||
if (sectp->lotag != 1 && sectp->lotag != 2)
|
||||
sectp->floorz = act->spr.pos.Z;
|
||||
sectp->setfloorz(act->spr.pos.Z);
|
||||
if (!isWorldTour())
|
||||
{
|
||||
if (act->spr.pal && ud.multimode > 1)
|
||||
|
|
|
@ -717,7 +717,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
case TOUCHPLATE:
|
||||
act->temp_data[2] = sectp->floorz;
|
||||
if (sectp->lotag != 1 && sectp->lotag != 2)
|
||||
sectp->floorz = act->spr.pos.Z;
|
||||
sectp->setfloorz(act->spr.pos.Z);
|
||||
if (act->spr.pal && ud.multimode > 1)
|
||||
{
|
||||
act->spr.xrepeat = act->spr.yrepeat = 0;
|
||||
|
|
Loading…
Reference in a new issue