- migrated floorpicnum and ceilingpicnum to FTextures.

The sky code still needs some work.
This commit is contained in:
Christoph Oelckers 2022-12-09 10:48:47 +01:00
parent 4ea252c227
commit 8dfbbc8220
43 changed files with 121 additions and 145 deletions

View file

@ -373,7 +373,7 @@ bool ShowRedLine(int j, int i)
if (((wal->cstat | wal->nextWall()->cstat) & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY)) == 0)
if (sector[i].floorz == wal->nextSector()->floorz)
return false;
if (sector[i].floortexture() != wal->nextSector()->floortexture())
if (sector[i].floortexture != wal->nextSector()->floortexture)
return false;
if (sector[i].floorshade != wal->nextSector()->floorshade)
return false;
@ -524,7 +524,7 @@ static void renderDrawMapView(const DVector2& cpos, const DVector2& cangvect, co
if (sect->floorstat & CSTAT_SECTOR_SKY) continue;
auto flortex = sect->floortexture();
auto flortex = sect->floortexture;
if (!flortex.isValid()) continue;
int translation = TRANSLATION(Translation_Remap + curbasepal, sector[i].floorpal);

View file

@ -354,12 +354,12 @@ struct sectortype
float ceilingypan_;
float floorxpan_;
float floorypan_;
FTextureID ceilingtexture;
FTextureID floortexture;
ESectorFlags ceilingstat;
ESectorFlags floorstat;
int16_t ceilingpicnum;
int16_t ceilingheinum;
int16_t floorpicnum;
int16_t floorheinum;
union { int16_t lotag, type; }; // type is for Blood.
int16_t hitag;
@ -444,11 +444,11 @@ struct sectortype
int getfloorslope() const { return floorstat & CSTAT_SECTOR_SLOPE ? floorheinum : 0; }
int getceilingslope() const { return ceilingstat & CSTAT_SECTOR_SLOPE ? ceilingheinum : 0; }
const FTextureID ceilingtexture() const;
const FTextureID floortexture() const;
void setfloortexture(FTextureID tex);
void setceilingtexture(FTextureID tex);
// always go through these to alter the textures to ensure we can keep track of these things if engine improvements need it.
void setfloortexture(FTextureID tex) { floortexture = tex; }
void setceilingtexture(FTextureID tex) { ceilingtexture = tex; }
void swapfloortexture(FTextureID &tex) { std::swap(floortexture, tex); }
void swapceilingtexture(FTextureID &tex) { std::swap(ceilingtexture, tex); }
Blood::XSECTOR& xs() const { return *_xs; }
bool hasX() const { return _xs != nullptr; } // 0 is invalid!

View file

@ -158,8 +158,8 @@ void precacheMap()
{
for (auto& sect : sector)
{
markTextureForPrecache(sect.ceilingtexture(), sect.ceilingpal);
markTextureForPrecache(sect.floortexture(), sect.floorpal);
markTextureForPrecache(sect.ceilingtexture, sect.ceilingpal);
markTextureForPrecache(sect.floortexture, sect.floorpal);
}
for (auto& wal : wall)

View file

@ -353,7 +353,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section
if (alpha != 0.f)
{
auto texid = frontsector->floortexture();
auto texid = frontsector->floortexture;
texture = TexMan.GetGameTexture(texid, true);
if (texture && texture->isValid())
{
@ -395,7 +395,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section
{
//iboindex = frontsector->iboindex[sector_t::ceiling];
auto texid = frontsector->ceilingtexture();
auto texid = frontsector->ceilingtexture;
texture = TexMan.GetGameTexture(texid, true);
if (texture && texture->isValid())
{

View file

@ -45,7 +45,7 @@ FGameTexture* SkyboxReplacement(FTextureID picnum, int palnum);
void initSkyInfo(HWDrawInfo *di, HWSkyInfo* sky, sectortype* sector, int plane)
{
int picnum = plane == plane_ceiling ? sector->ceilingpicnum : sector->floorpicnum;
int picnum = plane == legacyTileNum(plane_ceiling ? sector->ceilingtexture : sector->floortexture);
auto tex = tileGetTexture(picnum);
//tileUpdatePicnum(&picnum); // for now we can make do without this.
int palette = plane == plane_ceiling ? sector->ceilingpal : sector->floorpal;

View file

@ -471,13 +471,13 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
#endif
("ceilingstat", c.ceilingstat, def->ceilingstat)
("floorstat", c.floorstat, def->floorstat)
("ceilingpicnum", c.ceilingpicnum, def->ceilingpicnum)
("ceilingpicnum", c.ceilingtexture, def->ceilingtexture)
("ceilingheinum", c.ceilingheinum, def->ceilingheinum)
("ceilingshade", c.ceilingshade, def->ceilingshade)
("ceilingpal", c.ceilingpal, def->ceilingpal)
("ceilingxpanning", c.ceilingxpan_, def->ceilingxpan_)
("ceilingypanning", c.ceilingypan_, def->ceilingypan_)
("floorpicnum", c.floorpicnum, def->floorpicnum)
("floorpicnum", c.floortexture, def->floortexture)
("floorheinum", c.floorheinum, def->floorheinum)
("floorshade", c.floorshade, def->floorshade)
("floorpal", c.floorpal, def->floorpal)

View file

@ -366,7 +366,7 @@ bool SectionGeometry::ValidateSection(Section* section, int plane)
if (plane == 0)
{
if (sec->floorheinum == compare->floorheinum &&
sec->floortexture() == compare->floortexture &&
sec->floortexture == compare->floortexture &&
((sec->floorstat ^ compare->floorstat) & (CSTAT_SECTOR_ALIGN | CSTAT_SECTOR_YFLIP | CSTAT_SECTOR_XFLIP | CSTAT_SECTOR_TEXHALF | CSTAT_SECTOR_SWAPXY)) == 0 &&
sec->floorxpan_ == compare->floorxpan_ &&
sec->floorypan_ == compare->floorypan_ &&
@ -379,7 +379,7 @@ bool SectionGeometry::ValidateSection(Section* section, int plane)
else
{
if (sec->ceilingheinum == compare->ceilingheinum &&
sec->ceilingtexture() == compare->ceilingtexture &&
sec->ceilingtexture == compare->ceilingtexture &&
((sec->ceilingstat ^ compare->ceilingstat) & (CSTAT_SECTOR_ALIGN | CSTAT_SECTOR_YFLIP | CSTAT_SECTOR_XFLIP | CSTAT_SECTOR_TEXHALF | CSTAT_SECTOR_SWAPXY)) == 0 &&
sec->ceilingxpan_ == compare->ceilingxpan_ &&
sec->ceilingypan_ == compare->ceilingypan_ &&
@ -441,7 +441,7 @@ void SectionGeometry::CreatePlaneMesh(Section* section, int plane, const FVector
{
auto sectorp = &sector[section->sector];
// calculate the rest.
auto texture = TexMan.GetGameTexture(plane ? sectorp->ceilingtexture() : sectorp->floortexture());
auto texture = TexMan.GetGameTexture(plane ? sectorp->ceilingtexture : sectorp->floortexture);
auto& sdata = data[section->index];
auto& entry = sdata.planes[plane];
double fz = sectorp->floorz, cz = sectorp->ceilingz;

View file

@ -47,8 +47,8 @@ struct sectortypelight
floorstat = sec->floorstat;
ceilingheinum = sec->ceilingheinum;
floorheinum = sec->floorheinum;
ceilingtexture = sec->ceilingtexture();
floortexture = sec->floortexture();
ceilingtexture = sec->ceilingtexture;
floortexture = sec->floortexture;
}
};

View file

@ -24,31 +24,11 @@ inline const FTextureID walltype::overtexture() const
return tileGetTextureID(overpicnum);
}
inline const FTextureID sectortype::ceilingtexture() const
{
return tileGetTextureID(ceilingpicnum);
}
inline const FTextureID sectortype::floortexture() const
{
return tileGetTextureID(floorpicnum);
}
inline const FTextureID spritetypebase::spritetexture() const
{
return tileGetTextureID(picnum);
}
inline void sectortype::setfloortexture(FTextureID tex)
{
floorpicnum = legacyTileNum(tex);
}
inline void sectortype::setceilingtexture(FTextureID tex)
{
ceilingpicnum = legacyTileNum(tex);
}
inline void walltype::setwalltexture(FTextureID tex)
{
wallpicnum = legacyTileNum(tex);

View file

@ -482,7 +482,7 @@ int sector_checktexture(sectortype* sec, int place, int intname)
if (!sec) ThrowAbortException(X_READ_NIL, nullptr);
auto tex = TexMan.CheckForTexture(FName(ENamedName(intname)).GetChars(), ETextureType::Any, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnAll);
return tex == (place == 0 ? sec->ceilingtexture() : sec->floortexture());
return tex == (place == 0 ? sec->ceilingtexture : sec->floortexture);
}
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, checktexture, sector_checktexture)

View file

@ -4109,7 +4109,7 @@ static void actTouchFloor(DBloodActor* actor, sectortype* pSector)
actDamageSprite(actor, actor, nDamageType, Scale(4, nDamage, 120) << 4);
}
if (GetExtInfo(pSector->floortexture()).surftype == kSurfLava)
if (GetExtInfo(pSector->floortexture).surftype == kSurfLava)
{
actDamageSprite(actor, actor, kDamageBurn, 16);
sfxPlay3DSound(actor, 352, 5, 2);
@ -6631,7 +6631,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3
if (pSector->ceilingstat & CSTAT_SECTOR_SKY)
nSurf = kSurfNone;
else
nSurf = GetExtInfo(pSector->ceilingtexture()).surftype;
nSurf = GetExtInfo(pSector->ceilingtexture).surftype;
break;
}
case 2:
@ -6639,7 +6639,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3
if (pSector->floorstat & CSTAT_SECTOR_SKY)
nSurf = kSurfNone;
else
nSurf = GetExtInfo(pSector->floortexture()).surftype;
nSurf = GetExtInfo(pSector->floortexture).surftype;
break;
}
case 0:

View file

@ -666,11 +666,11 @@ void viewProcessSprites(tspriteArray& tsprites, const DVector3& cPos, DAngle cA,
if ((pSector->ceilingstat & CSTAT_SECTOR_SKY) && (pSector->floorstat & CSTAT_SECTOR_NO_CEILINGSHADE) == 0)
{
nShade += GetExtInfo(pSector->ceilingtexture()).tileshade + pSector->ceilingshade;
nShade += GetExtInfo(pSector->ceilingtexture).tileshade + pSector->ceilingshade;
}
else
{
nShade += GetExtInfo(pSector->floortexture()).tileshade + pSector->floorshade;
nShade += GetExtInfo(pSector->floortexture).tileshade + pSector->floorshade;
}
nShade += GetExtInfo(pTSprite->spritetexture()).tileshade;
pTSprite->shade = ClipRange(nShade, -128, 127);

View file

@ -105,7 +105,7 @@ void InitMirrors(void)
break;
auto secti = &sector[i];
if (secti->floortexture() == mirrortile)
if (secti->floortexture == mirrortile)
{
auto link = barrier_cast<DBloodActor*>(secti->upperLink);
if (link == nullptr)
@ -116,7 +116,7 @@ void InitMirrors(void)
auto sectj = link2->sector();
int j = sectindex(sectj);
if (sectj->ceilingtexture() != mirrortile)
if (sectj->ceilingtexture != mirrortile)
I_Error("Lower link sector %d doesn't have mirror picnum\n", j);
mirror[mirrorcnt].type = 2;
mirror[mirrorcnt].diff = link2->spr.pos - link->spr.pos;

View file

@ -3994,17 +3994,17 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
case 24:
switch (arg3)
{
default: return (condCmp(GetExtInfo(pObj->floortexture()).surftype, arg1, arg2, cmpOp) || condCmp(GetExtInfo(pObj->ceilingtexture()).surftype, arg1, arg2, cmpOp));
case 1: return condCmp(GetExtInfo(pObj->floortexture()).surftype, arg1, arg2, cmpOp);
case 2: return condCmp(GetExtInfo(pObj->ceilingtexture()).surftype, arg1, arg2, cmpOp);
default: return (condCmp(GetExtInfo(pObj->floortexture).surftype, arg1, arg2, cmpOp) || condCmp(GetExtInfo(pObj->ceilingtexture).surftype, arg1, arg2, cmpOp));
case 1: return condCmp(GetExtInfo(pObj->floortexture).surftype, arg1, arg2, cmpOp);
case 2: return condCmp(GetExtInfo(pObj->ceilingtexture).surftype, arg1, arg2, cmpOp);
}
break;
case 25:
switch (arg3)
{
default: return (condCmp(legacyTileNum(pObj->floortexture()), arg1, arg2, cmpOp) || condCmp(legacyTileNum(pObj->ceilingtexture()), arg1, arg2, cmpOp));
case 1: return condCmp(legacyTileNum(pObj->floortexture()), arg1, arg2, cmpOp);
case 2: return condCmp(legacyTileNum(pObj->ceilingtexture()), arg1, arg2, cmpOp);
default: return (condCmp(legacyTileNum(pObj->floortexture), arg1, arg2, cmpOp) || condCmp(legacyTileNum(pObj->ceilingtexture), arg1, arg2, cmpOp));
case 1: return condCmp(legacyTileNum(pObj->floortexture), arg1, arg2, cmpOp);
case 2: return condCmp(legacyTileNum(pObj->ceilingtexture), arg1, arg2, cmpOp);
}
break;
case 26:

View file

@ -304,7 +304,7 @@ void PreloadCache()
for (auto& sect : sector)
{
if ((sect.ceilingstat & CSTAT_SECTOR_SKY) != 0 && skyTile == -1)
skyTile = sect.ceilingtexture();
skyTile = sect.ceilingtexture;
}
if (skyTile > -1 && skyTile < kMaxTiles)
{

View file

@ -284,7 +284,7 @@ void DoSectorPanning(void)
if (pXSector->panFloor) // Floor
{
auto nTex = TexMan.GetGameTexture(pSector->floortexture());
auto nTex = TexMan.GetGameTexture(pSector->floortexture);
if (pSector->floorstat & CSTAT_SECTOR_ALIGN)
angle -= DAngle90;
int xBits = int(nTex->GetDisplayWidth()) >> int((pSector->floorstat & CSTAT_SECTOR_TEXHALF) != 0);
@ -296,7 +296,7 @@ void DoSectorPanning(void)
}
if (pXSector->panCeiling) // Ceiling
{
auto nTex = TexMan.GetGameTexture(pSector->ceilingtexture());
auto nTex = TexMan.GetGameTexture(pSector->ceilingtexture);
if (pSector->ceilingstat & CSTAT_SECTOR_ALIGN)
angle -= DAngle90;
int xBits = int(nTex->GetDisplayWidth()) >> int((pSector->ceilingstat & CSTAT_SECTOR_TEXHALF) != 0);

View file

@ -360,7 +360,7 @@ void SEQINST::Update()
if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->vel.Z == 0 && actor->vel.X != 0) {
if (actor->sector()->upperLink) break; // don't play surface sound for stacked sectors
int surf = GetExtInfo(actor->sector()->floortexture()).surftype;
int surf = GetExtInfo(actor->sector()->floortexture).surftype;
if (!surf) break;
static int surfSfxMove[15][4] = {
/* {snd1, snd2, gameVolume, myVolume} */

View file

@ -124,7 +124,7 @@ int tileGetSurfType(CollisionBase& hit)
default:
return 0;
case kHitSector:
return GetExtInfo(hit.hitSector->floortexture()).surftype;
return GetExtInfo(hit.hitSector->floortexture).surftype;
case kHitWall:
return GetExtInfo(hit.hitWall->walltexture()).surftype;
case kHitSprite:

View file

@ -1807,7 +1807,7 @@ void handle_se13(DDukeActor* actor)
if (ps[0].one_parallax_sectnum != nullptr)
{
sc->setceilingtexture(ps[0].one_parallax_sectnum->ceilingtexture());
sc->setceilingtexture(ps[0].one_parallax_sectnum->ceilingtexture);
sc->ceilingshade = ps[0].one_parallax_sectnum->ceilingshade;
}
}

View file

@ -1704,7 +1704,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
actor->spr.shade += (actor->sector()->ceilingshade - actor->spr.shade) >> 1;
else actor->spr.shade += (actor->sector()->floorshade - actor->spr.shade) >> 1;
if (actor->sector()->floortexture() == mirrortex)
if (actor->sector()->floortexture == mirrortex)
actor->Destroy();
}
}

View file

@ -1697,7 +1697,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
}
else actor->spr.shade += (actor->sector()->floorshade - actor->spr.shade) >> 1;
if (actor->sector()->floortexture() == mirrortex)
if (actor->sector()->floortexture == mirrortex)
actor->Destroy();
}
}
@ -1787,7 +1787,7 @@ static int fallspecial(DDukeActor *actor, int playernum)
actor->attackertype = RTILE_SHOTSPARK1;
actor->hitextra = 1;
}
else if (tilesurface(actor->sector()->floortexture()) == TSURF_MAGMA)
else if (tilesurface(actor->sector()->floortexture) == TSURF_MAGMA)
{
if (actor->spr.picnum != RTILE_MINION && actor->spr.pal != 19)
{
@ -1879,13 +1879,13 @@ void destroyit(DDukeActor *actor)
destsect->setceilingz(srcsect->ceilingz);
destsect->ceilingstat = srcsect->ceilingstat;
destsect->floorstat = srcsect->floorstat;
destsect->setceilingtexture(srcsect->ceilingtexture());
destsect->setceilingtexture(srcsect->ceilingtexture);
destsect->ceilingheinum = srcsect->ceilingheinum;
destsect->ceilingshade = srcsect->ceilingshade;
destsect->ceilingpal = srcsect->ceilingpal;
destsect->ceilingxpan_ = srcsect->ceilingxpan_;
destsect->ceilingypan_ = srcsect->ceilingypan_;
destsect->setfloortexture(srcsect->floortexture());
destsect->setfloortexture(srcsect->floortexture);
destsect->floorheinum = srcsect->floorheinum;
destsect->floorshade = srcsect->floorshade;
destsect->floorpal = srcsect->floorpal;

View file

@ -276,7 +276,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
case DTILE_WATERBUBBLE:
if (tilesurface(t->sectp->floortexture()) == TSURF_SLIME)
if (tilesurface(t->sectp->floortexture) == TSURF_SLIME)
{
t->pal = 7;
break;
@ -352,7 +352,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
}
h->dispicnum = t->picnum;
if (t->sectp->floortexture() == mirrortex)
if (t->sectp->floortexture == mirrortex)
t->scale = DVector2(0, 0);
}
}

View file

@ -325,7 +325,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
case RTILE_WATERBUBBLE:
if (tilesurface(t->sectp->floortexture()) == TSURF_SLIME)
if (tilesurface(t->sectp->floortexture) == TSURF_SLIME)
{
t->pal = 7;
break;
@ -425,7 +425,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
}
h->dispicnum = t->picnum;
if (t->sectp->floortexture() == mirrortex)
if (t->sectp->floortexture == mirrortex)
t->scale = DVector2(0, 0);
}
}

View file

@ -1075,7 +1075,7 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case SECTOR_CEILINGPICNUM:
if (bSet) sectp->setceilingtexture(tileGetTextureID(lValue));
else SetGameVarID(lVar2, legacyTileNum(sectp->ceilingtexture()), sActor, sPlayer);
else SetGameVarID(lVar2, legacyTileNum(sectp->ceilingtexture), sActor, sPlayer);
break;
case SECTOR_CEILINGSLOPE:
if (bSet) sectp->setceilingslope(lValue);
@ -1099,7 +1099,7 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case SECTOR_FLOORPICNUM:
if (bSet) sectp->setfloortexture(tileGetTextureID(lValue));
else SetGameVarID(lVar2, legacyTileNum(sectp->floortexture()), sActor, sPlayer);
else SetGameVarID(lVar2, legacyTileNum(sectp->floortexture), sActor, sPlayer);
break;
case SECTOR_FLOORSLOPE:
if (bSet) sectp->setfloorslope(lValue);
@ -2296,7 +2296,7 @@ int ParseState::parse(void)
parseifelse(ud.coop || numplayers > 2);
break;
case concmd_ifonmud:
parseifelse(abs(g_ac->spr.pos.Z - g_ac->sector()->floorz) < 32 && (tilesurface(g_ac->sector()->floortexture()) == TSURF_MUDDY) != 0);
parseifelse(abs(g_ac->spr.pos.Z - g_ac->sector()->floorz) < 32 && (tilesurface(g_ac->sector()->floortexture) == TSURF_MUDDY) != 0);
break;
case concmd_ifonwater:
parseifelse( abs(g_ac->spr.pos.Z-g_ac->sector()->floorz) < 32 && g_ac->sector()->lotag == ST_1_ABOVE_WATER);
@ -3455,7 +3455,7 @@ int ParseState::parse(void)
case concmd_gettexturefloor:
{
insptr++;
SetGameVarID(g_iTextureID, legacyTileNum(g_ac->sector()->floortexture()), g_ac, g_p);
SetGameVarID(g_iTextureID, legacyTileNum(g_ac->sector()->floortexture), g_ac, g_p);
break;
}
@ -3592,7 +3592,7 @@ int ParseState::parse(void)
case concmd_gettextureceiling:
{
insptr++;
SetGameVarID(g_iTextureID, legacyTileNum(g_ac->sector()->ceilingtexture()), g_ac, g_p);
SetGameVarID(g_iTextureID, legacyTileNum(g_ac->sector()->ceilingtexture), g_ac, g_p);
break;
}
case concmd_ifvarvarand:

View file

@ -84,7 +84,7 @@ int setpal(player_struct* p)
if (p->DrugMode) palette = DRUGPAL;
else if (p->heat_on) palette = SLIMEPAL;
else if (!p->insector()) palette = BASEPAL; // don't crash if out of range.
else if (tilesurface(p->cursector->ceilingtexture()) == TSURF_SLIME) palette = SLIMEPAL;
else if (tilesurface(p->cursector->ceilingtexture) == TSURF_SLIME) palette = SLIMEPAL;
else if (p->cursector->lotag == ST_2_UNDERWATER) palette = WATERPAL;
else palette = BASEPAL;
return palette;
@ -1003,7 +1003,7 @@ void purplelavacheck(player_struct* p)
{
auto sect = pact->sector();
// one texflag for a single texture again, just to avoid one hard coded check...
if ((tilesurface(sect->floortexture()) & TSURF_PURPLELAVA) || (tilesurface(sect->ceilingtexture()) & TSURF_PURPLELAVA))
if ((tilesurface(sect->floortexture) & TSURF_PURPLELAVA) || (tilesurface(sect->ceilingtexture) & TSURF_PURPLELAVA))
{
if (p->boot_amount > 0)
{

View file

@ -1756,7 +1756,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
p->dummyplayersprite = spawn(pact, DTILE_PLAYERONWATER);
p->footprintcount = 6;
if (tilesurface(p->cursector->floortexture()) == TSURF_SLIME)
if (tilesurface(p->cursector->floortexture) == TSURF_SLIME)
p->footprintpal = 8;
else p->footprintpal = 0;
p->footprintshade = 0;
@ -2844,7 +2844,7 @@ void processinput_d(int snum)
pact->vel.X = clamp((p->GetActor()->spr.pos.XY() - p->bobpos).Length(), 0., 32.);
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floortexture() == mirrortex) || !p->insector()));
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floortexture == mirrortex) || !p->insector()));
// Shrinking code
@ -2892,7 +2892,7 @@ void processinput_d(int snum)
if (p->on_ground && truefdist <= gs.playerheight + 16)
{
int surface = tilesurface(sect->floortexture());
int surface = tilesurface(sect->floortexture);
int whichsound = surface == TSURF_ELECTRIC? 0 : surface == TSURF_SLIME? 1 : surface == TSURF_PLASMA? 2 : -1;
k = makepainsounds(snum, whichsound);
}
@ -2924,7 +2924,7 @@ void processinput_d(int snum)
if (clz.type == kHitSprite)
j = clz.actor()->spr.spritetexture();
else
j = psectp->floortexture();
j = psectp->floortexture;
if (tilesurface(j) == TSURF_METALDUCTS)
{

View file

@ -2002,12 +2002,12 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
p->dummyplayersprite = spawn(pact, RTILE_PLAYERONWATER);
p->footprintcount = 6;
if (tilesurface(p->cursector->floortexture()) == TSURF_SLIME)
if (tilesurface(p->cursector->floortexture) == TSURF_SLIME)
{
p->footprintpal = 8;
p->footprintshade = 0;
}
else if (tilesurface(p->cursector->floortexture()) == TSURF_OIL)
else if (tilesurface(p->cursector->floortexture) == TSURF_OIL)
{
p->footprintpal = 0;
p->footprintshade = 40;
@ -3258,7 +3258,7 @@ void processinput_r(int snum)
else if (psectlotag == 7777 && (currentLevel->gameflags & LEVEL_RR_HULKSPAWN))
lastlevel = 1;
if (psectlotag == 848 && tilesurface(psectp->floortexture()) == TSURF_SPECIALWATER)
if (psectlotag == 848 && tilesurface(psectp->floortexture) == TSURF_SPECIALWATER)
psectlotag = ST_1_ABOVE_WATER;
if (psectlotag == 857)
@ -3441,7 +3441,7 @@ void processinput_r(int snum)
pact->vel.X = clamp((p->GetActor()->spr.pos.XY() - p->bobpos).Length(), 0., 32.);
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floortexture() == mirrortex) || !p->insector()));
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floortexture == mirrortex) || !p->insector()));
// Shrinking code
@ -3503,7 +3503,7 @@ void processinput_r(int snum)
if (p->on_ground && truefdist <= gs.playerheight + 16)
{
int surface = tilesurface(sect->floortexture());
int surface = tilesurface(sect->floortexture);
int whichsound = surface == TSURF_ELECTRIC ? 0 : surface == TSURF_SLIME ? 1 : surface == TSURF_PLASMA ? 2 : surface == TSURF_MAGMA ? 3 : -1;
k = makepainsounds(snum, whichsound);
}
@ -3549,7 +3549,7 @@ void processinput_r(int snum)
if (clz.type == kHitSprite)
j = clz.actor()->spr.spritetexture();
else
j = psectp->floortexture();
j = psectp->floortexture;
if (tilesurface(j) == TSURF_METALDUCTS)
{
@ -3591,13 +3591,13 @@ void processinput_r(int snum)
}
}
if (tilesurface(psectp->floortexture()) == TSURF_OIL)
if (tilesurface(psectp->floortexture) == TSURF_OIL)
{
if (p->OnMotorcycle)
if (p->on_ground)
p->moto_on_oil = 1;
}
else if (tilesurface(psectp->floortexture()) == TSURF_DEEPMUD)
else if (tilesurface(psectp->floortexture) == TSURF_DEEPMUD)
{
if (p->OnMotorcycle)
{
@ -3611,7 +3611,7 @@ void processinput_r(int snum)
p->vel.XY() *= gs.playerfriction;
}
}
else if (tilesurface(psectp->floortexture()) == TSURF_MUDDY)
else if (tilesurface(psectp->floortexture) == TSURF_MUDDY)
{
if (p->OnMotorcycle)
{

View file

@ -689,7 +689,7 @@ void prelevel_common(int g)
if (sectp->ceilingstat & CSTAT_SECTOR_SKY)
{
if (tilesurface(sectp->ceilingtexture()) == TSURF_SCROLLSKY && numclouds < 127)
if (tilesurface(sectp->ceilingtexture) == TSURF_SCROLLSKY && numclouds < 127)
clouds[numclouds++] = sectp;
if (ps[0].one_parallax_sectnum == nullptr)
@ -868,7 +868,7 @@ static void SpawnPortals()
for (unsigned i = 0; i < sector.Size(); i++)
{
auto sectp = &sector[i];
if (sectp->floortexture() == foftex && sectp->portalflags != PORTAL_SECTOR_FLOOR)
if (sectp->floortexture == foftex && sectp->portalflags != PORTAL_SECTOR_FLOOR)
{
for (auto& pt : allPortals)
{
@ -887,7 +887,7 @@ static void SpawnPortals()
}
}
}
else if (sectp->ceilingtexture() == foftex && sectp->portalflags != PORTAL_SECTOR_CEILING)
else if (sectp->ceilingtexture == foftex && sectp->portalflags != PORTAL_SECTOR_CEILING)
{
for (auto& pt : allPortals)
{
@ -981,7 +981,7 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode)
for (auto& sect : sector)
{
if (tilesurface(sect.ceilingtexture()) == TSURF_THUNDERSKY)
if (tilesurface(sect.ceilingtexture) == TSURF_THUNDERSKY)
thunderon = 1;
}
@ -1059,7 +1059,7 @@ void enterlevel(MapRecord *mi, int gamemode)
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
bool clearweapon = !!(currentLevel->flags & LEVEL_CLEARWEAPONS);
auto pn = ps[i].GetActor()->sector()->floortexture();
auto pn = ps[i].GetActor()->sector()->floortexture;
if (tileflags(pn) & TFLAG_CLEARINVENTORY)
{
resetinventory(i);

View file

@ -331,7 +331,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
if (mirrorcnt > 63)
I_Error("Too many mirrors (64 max.)");
if (sectp && sectp->ceilingtexture() != mirrortex)
if (sectp && sectp->ceilingtexture != mirrortex)
{
sectp->setceilingtexture(mirrortex);
sectp->setfloortexture(mirrortex);

View file

@ -640,7 +640,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
if (mirrorcnt > 63)
I_Error("Too many mirrors (64 max.)");
if (sectp && sectp->ceilingtexture() != mirrortex)
if (sectp && sectp->ceilingtexture != mirrortex)
{
sectp->setceilingtexture(mirrortex);
sectp->setfloortexture(mirrortex);

View file

@ -52,7 +52,7 @@ static int interptype[] = { Interp_Sect_Floorz, Interp_Sect_Ceilingz, Interp_Wal
bool ceilingspace(sectortype* sectp)
{
return (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tilesurface(sectp->ceilingtexture()) == TSURF_OUTERSPACE));
return (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tilesurface(sectp->ceilingtexture) == TSURF_OUTERSPACE));
}
@ -65,7 +65,7 @@ bool ceilingspace(sectortype* sectp)
bool floorspace(sectortype* sectp)
{
// Yes, ceilingpal in this check is correct...
return (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tilesurface(sectp->floortexture()) == TSURF_OUTERSPACE));
return (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tilesurface(sectp->floortexture) == TSURF_OUTERSPACE));
}
//---------------------------------------------------------------------------
@ -1323,7 +1323,7 @@ void checkhitwall(DDukeActor* spr, walltype* wal, const DVector3& pos)
bool checkhitceiling(sectortype* sectp)
{
auto data = breakCeilingMap.CheckKey(sectp->ceilingtexture().GetIndex());
auto data = breakCeilingMap.CheckKey(sectp->ceilingtexture.GetIndex());
if (data && !(data->flags & 1))
{
if (!data->handler)

View file

@ -538,7 +538,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
auto nsec = wl.nextSector();
if (!(nsec->ceilingstat & CSTAT_SECTOR_SKY))
{
sectp->setceilingtexture(nsec->ceilingtexture());
sectp->setceilingtexture(nsec->ceilingtexture);
sectp->ceilingshade = nsec->ceilingshade;
break; //Leave early
}

View file

@ -1286,7 +1286,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, operateactivators, operateactivators)
int duke_floorsurface(sectortype* sector)
{
return tilesurface(sector->floortexture());
return tilesurface(sector->floortexture);
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorsurface, duke_floorsurface)
@ -1298,7 +1298,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorsurface, duke_floorsurface)
int duke_floorflags(sectortype* sector)
{
return tileflags(sector->floortexture());
return tileflags(sector->floortexture);
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorflags, duke_floorflags)
@ -1310,7 +1310,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorflags, duke_floorflags)
int duke_ceilingflags(sectortype* sector)
{
return tileflags(sector->ceilingtexture());
return tileflags(sector->ceilingtexture);
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingflags, duke_ceilingflags)
@ -1322,7 +1322,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingflags, duke_ceilingflags)
int duke_ceilingsurface(sectortype* sector)
{
return tilesurface(sector->ceilingtexture());
return tilesurface(sector->ceilingtexture);
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingsurface, duke_ceilingsurface)

View file

@ -1307,7 +1307,7 @@ int DoBunnyMove(DSWActor* actor)
if (RandomRange(1000) > 985 && actor->spr.pal != PALETTE_PLAYER1 && actor->user.track < 0)
{
if (tileflags(actor->sector()->floortexture()) & TFLAG_BUNNYFRIENDLY)
if (tileflags(actor->sector()->floortexture) & TFLAG_BUNNYFRIENDLY)
{
NewStateGroup(actor, sg_BunnyStand);
}
@ -1366,7 +1366,7 @@ int DoBunnyEat(DSWActor* actor)
DoActorSectorDamage(actor);
if (tileflags(actor->sector()->floortexture()) & TFLAG_BUNNYFRIENDLY)
if (tileflags(actor->sector()->floortexture) & TFLAG_BUNNYFRIENDLY)
{
if (RandomRange(1000) > 970)
NewStateGroup(actor, sg_BunnyRun);

View file

@ -227,8 +227,8 @@ void CopySectorMatch(int match)
dsectp->floorshade = ssectp->floorshade;
dsectp->ceilingshade = ssectp->ceilingshade;
dsectp->setfloortexture(ssectp->floortexture());
dsectp->setceilingtexture(ssectp->ceilingtexture());
dsectp->setfloortexture(ssectp->floortexture);
dsectp->setceilingtexture(ssectp->ceilingtexture);
dsectp->floorheinum = ssectp->floorheinum;
dsectp->ceilingheinum = ssectp->ceilingheinum;
@ -248,7 +248,7 @@ void CopySectorMatch(int match)
dsectp->extra = ssectp->extra;
dsectp->visibility = ssectp->visibility;
if (ssectp->floortexture() == FAFMirrorPic[0] || ssectp->ceilingtexture() == FAFMirrorPic[0])
if (ssectp->floortexture == FAFMirrorPic[0] || ssectp->ceilingtexture == FAFMirrorPic[0])
{
CollectPortals(); // unavoidable. Since these portals are not static we have to reinitialize all of them.
}

View file

@ -1169,21 +1169,18 @@ void UpdateWallPortalState()
SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while (auto actor = it.Next())
{
// back up texture and stat
assert(SP_TAG2(actor) == -1 || tileGetTextureID(SP_TAG2(actor)) == actor->texparam); // this should catch items that evaded the property remapping somehow.
if (SP_TAG3(actor) == 0)
{
// back up ceilingpic and ceilingstat
// std::swap(actor->sector->ceilingtexture, actor->texparam);
SP_TAG5(actor) = actor->sector()->ceilingpicnum;
actor->sector()->ceilingpicnum = SP_TAG2(actor);
actor->sector()->swapceilingtexture(actor->texparam);
SP_TAG4(actor) = actor->sector()->ceilingstat;
actor->sector()->ceilingstat |= (ESectorFlags::FromInt(SP_TAG6(actor)));
actor->sector()->ceilingstat &= ~(CSTAT_SECTOR_SKY);
}
else if (SP_TAG3(actor) == 1)
{
// std::swap(actor->sector->floortexture, actor->texparam);
SP_TAG5(actor) = actor->sector()->floorpicnum;
actor->sector()->floorpicnum = SP_TAG2(actor);
actor->sector()->swapfloortexture(actor->texparam);
SP_TAG4(actor) = actor->sector()->floorstat;
actor->sector()->floorstat |= (ESectorFlags::FromInt(SP_TAG6(actor)));
actor->sector()->floorstat &= ~(CSTAT_SECTOR_SKY);
@ -1203,18 +1200,16 @@ void RestorePortalState()
SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while (auto actor = it.Next())
{
// restore texture and stat
if (SP_TAG3(actor) == 0)
{
// restore ceilingpic and ceilingstat
// std::swap(actor->sector->ceilingtexture, actor->texparam);
actor->sector()->ceilingpicnum = SP_TAG5(actor);
actor->sector()->swapceilingtexture(actor->texparam);
actor->sector()->ceilingstat = ESectorFlags::FromInt(SP_TAG4(actor));
actor->sector()->ceilingstat &= ~(CSTAT_SECTOR_SKY);
}
else if (SP_TAG3(actor) == 1)
{
// std::swap(actor->sector->floortexture, actor->texparam);
actor->sector()->floorpicnum = SP_TAG5(actor);
actor->sector()->swapfloortexture(actor->texparam);
actor->sector()->floorstat = ESectorFlags::FromInt(SP_TAG4(actor));
actor->sector()->floorstat &= ~(CSTAT_SECTOR_SKY);
}

View file

@ -1470,12 +1470,12 @@ inline FTextureID FAFMirrorPic[2];
inline bool FAF_ConnectCeiling(sectortype* sect)
{
return (sect && sect->ceilingtexture() == FAFMirrorPic[0]);
return (sect && sect->ceilingtexture == FAFMirrorPic[0]);
}
inline bool FAF_ConnectFloor(sectortype* sect)
{
return (sect && sect->floortexture() == FAFMirrorPic[0]);
return (sect && sect->floortexture == FAFMirrorPic[0]);
}
inline bool FAF_ConnectArea(sectortype* sect)

View file

@ -279,7 +279,7 @@ void JS_InitMirrors(void)
if (mirrorcnt >= MAXMIRRORS)
{
Printf("MAXMIRRORS reached! Skipping mirror wall\n");
wal.overpicnum = legacyTileNum(sec->ceilingtexture());
wal.overpicnum = legacyTileNum(sec->ceilingtexture);
continue;
}
@ -372,7 +372,7 @@ void JS_InitMirrors(void)
mirrorcnt++;
}
else
wal.overpicnum = legacyTileNum(sec->ceilingtexture());
wal.overpicnum = legacyTileNum(sec->ceilingtexture);
}
}

View file

@ -628,22 +628,22 @@ void SetupMirrorTiles(void)
SWStatIterator it(STAT_FAF);
while (auto actor = it.Next())
{
if (actor->sector()->ceilingtexture() == FAFPlaceMirrorPic[0])
if (actor->sector()->ceilingtexture == FAFPlaceMirrorPic[0])
{
actor->sector()->setceilingtexture(FAFMirrorPic[0]);
actor->sector()->ceilingstat |= (CSTAT_SECTOR_SKY);
}
if (actor->sector()->floortexture() == FAFPlaceMirrorPic[0])
if (actor->sector()->floortexture == FAFPlaceMirrorPic[0])
{
actor->sector()->setfloortexture(FAFMirrorPic[0]);
actor->sector()->floorstat |= (CSTAT_SECTOR_SKY);
}
if (actor->sector()->ceilingtexture() == FAFPlaceMirrorPic[1])
if (actor->sector()->ceilingtexture == FAFPlaceMirrorPic[1])
actor->sector()->setceilingtexture(FAFMirrorPic[1]);
if (actor->sector()->floortexture() == FAFPlaceMirrorPic[1])
if (actor->sector()->floortexture == FAFPlaceMirrorPic[1])
actor->sector()->setfloortexture(FAFMirrorPic[1]);
}
}
@ -908,7 +908,7 @@ void CollectPortals()
for (unsigned i = 0; i < sector.Size(); i++)
{
if (sector[i].floortexture() == FAFMirrorPic[0] && !floordone[i])
if (sector[i].floortexture == FAFMirrorPic[0] && !floordone[i])
{
auto& fp = floorportals[floorportals.Reserve(1)];
fp.sectors.Push(i);
@ -920,13 +920,13 @@ void CollectPortals()
if (!wal.twoSided()) continue;
auto nsec = wal.nextSector();
auto ns = sectindex(nsec);
if (floordone[ns] || nsec->floortexture() != FAFMirrorPic[0]) continue;
if (floordone[ns] || nsec->floortexture != FAFMirrorPic[0]) continue;
fp.sectors.Push(ns);
floordone.Set(ns);
}
}
}
if (sector[i].ceilingtexture() == FAFMirrorPic[0] && !ceilingdone[i])
if (sector[i].ceilingtexture == FAFMirrorPic[0] && !ceilingdone[i])
{
auto& fp = ceilingportals[ceilingportals.Reserve(1)];
fp.sectors.Push(i);
@ -938,7 +938,7 @@ void CollectPortals()
if (!wal.twoSided()) continue;
auto nsec = wal.nextSector();
auto ns = sectindex(nsec);
if (ceilingdone[ns] || nsec->ceilingtexture() != FAFMirrorPic[0]) continue;
if (ceilingdone[ns] || nsec->ceilingtexture != FAFMirrorPic[0]) continue;
fp.sectors.Push(ns);
ceilingdone.Set(ns);
}
@ -961,7 +961,7 @@ void CollectPortals()
if (match != -1)
{
FindCeilingView(match, &tpos.X, &tpos.Y, tpos.Z, &tsect);
if (tsect != nullptr &&tsect->floortexture() == FAFMirrorPic[0])
if (tsect != nullptr &&tsect->floortexture == FAFMirrorPic[0])
{
// got something!
fp.othersector = sectindex(tsect);
@ -988,7 +988,7 @@ void CollectPortals()
if (match != -1)
{
FindFloorView(match, &tpos.X, &tpos.Y, tpos.Z, &tsect);
if (tsect != nullptr && tsect->ceilingtexture() == FAFMirrorPic[0])
if (tsect != nullptr && tsect->ceilingtexture == FAFMirrorPic[0])
{
// got something!
fp.othersector = sectindex(tsect);

View file

@ -1159,7 +1159,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
int SavePlayClock = PlayClock;
InitTimingVars();
PlayClock = SavePlayClock;
defineSky(DEFAULTPSKY, pskybits_override, nullptr, 0, parallaxyscale_override / 65536.f);
defineSky(DEFAULTPSKY, pskybits_override, nullptr, 0, parallaxyscale_override / 8192.f);
InitNetVars();
screenpeek = myconnectindex;

View file

@ -357,12 +357,12 @@ void SectorLiquidSet(sectortype* sectp)
//
// ///////////////////////////////////
if (tilesurface(sectp->floortexture()) == TSURF_WATER)
if (tilesurface(sectp->floortexture) == TSURF_WATER)
{
sectp->u_defined = true;
sectp->extra |= (SECTFX_LIQUID_WATER);
}
else if (tilesurface(sectp->floortexture()) == TSURF_LAVA)
else if (tilesurface(sectp->floortexture) == TSURF_LAVA)
{
sectp->u_defined = true;
sectp->extra |= (SECTFX_LIQUID_LAVA);
@ -439,7 +439,7 @@ void SectorSetup(void)
if ((sectp->floorstat & CSTAT_SECTOR_SKY))
{
// don't do a z adjust for FAF area
if (sectp->floortexture() != FAFPlaceMirrorPic[0])
if (sectp->floortexture != FAFPlaceMirrorPic[0])
{
sectp->extra |= (SECTFX_Z_ADJUST);
}
@ -448,7 +448,7 @@ void SectorSetup(void)
if ((sectp->ceilingstat & CSTAT_SECTOR_SKY))
{
// don't do a z adjust for FAF area
if (sectp->ceilingtexture() != FAFPlaceMirrorPic[0])
if (sectp->ceilingtexture != FAFPlaceMirrorPic[0])
{
sectp->extra |= (SECTFX_Z_ADJUST);
}
@ -1385,9 +1385,10 @@ void DoChangorMatch(short match)
if (SP_TAG2(actor) != match)
continue;
assert(SP_TAG4(actor) == -1 || tileGetTextureID(SP_TAG4(actor)) == actor->texparam); // this should catch items that evaded the property remapping somehow.
if (TEST_BOOL1(actor))
{
sectp->ceilingpicnum = SP_TAG4(actor); // sectp->ceilingtexture = actor->texparam;
sectp->setceilingtexture(actor->texparam);
sectp->addceilingz(SP_TAG5(actor));
sectp->ceilingheinum += SP_TAG6(actor);
@ -1401,7 +1402,7 @@ void DoChangorMatch(short match)
}
else
{
sectp->floorpicnum = SP_TAG4(actor);
sectp->setfloortexture(actor->texparam);
sectp->addfloorz(SP_TAG5(actor));
sectp->floorheinum += SP_TAG6(actor);

View file

@ -2059,7 +2059,7 @@ void CallbackSOsink(ANIM* ap, void *data)
ASSERT(destsect != nullptr);
destsect->setfloortexture(srcsect->floortexture());
destsect->setfloortexture(srcsect->floortexture);
destsect->floorshade = srcsect->floorshade;
destsect->floorstat &= ~(CSTAT_SECTOR_ALIGN);

View file

@ -4346,7 +4346,7 @@ bool WeaponMoveHit(DSWActor* actor)
}
}
if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingtexture() != FAFMirrorPic[0])
if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingtexture != FAFMirrorPic[0])
{
if (abs(actor->spr.pos.Z - sectp->ceilingz) < ActorSizeZ(actor))
{