- use the texture wrappers in a few places.

This commit is contained in:
Christoph Oelckers 2022-12-06 11:47:56 +01:00
parent 4ecb4aacb2
commit 483617d3e1
4 changed files with 18 additions and 18 deletions

View file

@ -267,9 +267,9 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cur
pSector->setzfrommap(LittleLong(load.ceilingz), LittleLong(load.floorz)); pSector->setzfrommap(LittleLong(load.ceilingz), LittleLong(load.floorz));
pSector->ceilingstat = ESectorFlags::FromInt(LittleShort(load.ceilingstat)); pSector->ceilingstat = ESectorFlags::FromInt(LittleShort(load.ceilingstat));
pSector->floorstat = ESectorFlags::FromInt(LittleShort(load.floorstat)); pSector->floorstat = ESectorFlags::FromInt(LittleShort(load.floorstat));
pSector->ceilingpicnum = LittleShort(load.ceilingpic); pSector->setceilingtexture(tileGetTextureID(LittleShort(load.ceilingpic)));
pSector->ceilingheinum = LittleShort(load.ceilingheinum); pSector->ceilingheinum = LittleShort(load.ceilingheinum);
pSector->floorpicnum = LittleShort(load.floorpic); pSector->setfloortexture(tileGetTextureID(LittleShort(load.floorpic)));
pSector->floorheinum = LittleShort(load.floorheinum); pSector->floorheinum = LittleShort(load.floorheinum);
pSector->type = LittleShort(load.type); pSector->type = LittleShort(load.type);
pSector->hitag = LittleShort(load.hitag); pSector->hitag = LittleShort(load.hitag);

View file

@ -7189,10 +7189,10 @@ void usePictureChanger(DBloodActor* sourceactor, int objType, sectortype* targSe
switch (objType) { switch (objType) {
case OBJ_SECTOR: case OBJ_SECTOR:
if (valueIsBetween(sourceactor->xspr.data1, -1, 32767)) if (valueIsBetween(sourceactor->xspr.data1, -1, 32767))
targSect->floorpicnum = sourceactor->xspr.data1; targSect->setfloortexture(tileGetTextureID(sourceactor->xspr.data1));
if (valueIsBetween(sourceactor->xspr.data2, -1, 32767)) if (valueIsBetween(sourceactor->xspr.data2, -1, 32767))
targSect->ceilingpicnum = sourceactor->xspr.data2; targSect->setceilingtexture(tileGetTextureID(sourceactor->xspr.data2));
if (valueIsBetween(sourceactor->xspr.data3, -1, 32767)) if (valueIsBetween(sourceactor->xspr.data3, -1, 32767))
targSect->floorpal = uint8_t(sourceactor->xspr.data3); targSect->floorpal = uint8_t(sourceactor->xspr.data3);
@ -7212,10 +7212,10 @@ void usePictureChanger(DBloodActor* sourceactor, int objType, sectortype* targSe
break; break;
case OBJ_WALL: case OBJ_WALL:
if (valueIsBetween(sourceactor->xspr.data1, -1, 32767)) if (valueIsBetween(sourceactor->xspr.data1, -1, 32767))
targWall->wallpicnum = sourceactor->xspr.data1; targWall->setwalltexture(tileGetTextureID(sourceactor->xspr.data1));
if (valueIsBetween(sourceactor->xspr.data2, -1, 32767)) if (valueIsBetween(sourceactor->xspr.data2, -1, 32767))
targWall->overpicnum = sourceactor->xspr.data2; targWall->setovertexture(tileGetTextureID(sourceactor->xspr.data2));
if (valueIsBetween(sourceactor->xspr.data3, -1, 32767)) if (valueIsBetween(sourceactor->xspr.data3, -1, 32767))
targWall->pal = uint8_t(sourceactor->xspr.data3); targWall->pal = uint8_t(sourceactor->xspr.data3);

View file

@ -284,11 +284,11 @@ void DoSectorPanning(void)
if (pXSector->panFloor) // Floor if (pXSector->panFloor) // Floor
{ {
int nTile = pSector->floorpicnum; auto nTex = TexMan.GetGameTexture(pSector->floortexture());
if (pSector->floorstat & CSTAT_SECTOR_ALIGN) if (pSector->floorstat & CSTAT_SECTOR_ALIGN)
angle -= DAngle90; angle -= DAngle90;
int xBits = tileWidth(nTile) >> int((pSector->floorstat & CSTAT_SECTOR_TEXHALF) != 0); int xBits = int(nTex->GetDisplayWidth()) >> int((pSector->floorstat & CSTAT_SECTOR_TEXHALF) != 0);
int yBits = tileHeight(nTile) >> int((pSector->floorstat & CSTAT_SECTOR_TEXHALF) != 0); int yBits = int(nTex->GetDisplayHeight()) >> int((pSector->floorstat & CSTAT_SECTOR_TEXHALF) != 0);
double px = angle.Cos() * (speed << 2) / xBits; double px = angle.Cos() * (speed << 2) / xBits;
double py = angle.Sin() * (speed << 2) / xBits; double py = angle.Sin() * (speed << 2) / xBits;
pSector->addfloorxpan((float)px * (1.f / 256)); pSector->addfloorxpan((float)px * (1.f / 256));
@ -296,11 +296,11 @@ void DoSectorPanning(void)
} }
if (pXSector->panCeiling) // Ceiling if (pXSector->panCeiling) // Ceiling
{ {
int nTile = pSector->ceilingpicnum; auto nTex = TexMan.GetGameTexture(pSector->ceilingtexture());
if (pSector->ceilingstat & CSTAT_SECTOR_ALIGN) if (pSector->ceilingstat & CSTAT_SECTOR_ALIGN)
angle -= DAngle90; angle -= DAngle90;
int xBits = tileWidth(nTile) >> int((pSector->ceilingstat & CSTAT_SECTOR_TEXHALF) != 0); int xBits = int(nTex->GetDisplayWidth()) >> int((pSector->ceilingstat & CSTAT_SECTOR_TEXHALF) != 0);
int yBits = tileHeight(nTile) >> int((pSector->ceilingstat & CSTAT_SECTOR_TEXHALF) != 0); int yBits = int(nTex->GetDisplayHeight()) >> int((pSector->ceilingstat & CSTAT_SECTOR_TEXHALF) != 0);
double px = angle.Cos() * (speed << 2) / xBits; double px = angle.Cos() * (speed << 2) / xBits;
double py = angle.Sin() * (speed << 2) / xBits; double py = angle.Sin() * (speed << 2) / xBits;
pSector->addceilingxpan((float)px * (1.f / 256)); pSector->addceilingxpan((float)px * (1.f / 256));

View file

@ -1074,8 +1074,8 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, sectp->floorstat, sActor, sPlayer); else SetGameVarID(lVar2, sectp->floorstat, sActor, sPlayer);
break; break;
case SECTOR_CEILINGPICNUM: case SECTOR_CEILINGPICNUM:
if (bSet) sectp->ceilingpicnum = lValue; if (bSet) sectp->setceilingtexture(tileGetTextureID(lValue));
else SetGameVarID(lVar2, sectp->legacyTileNum(sectortype::ceiling), sActor, sPlayer); else SetGameVarID(lVar2, legacyTileNum(sectp->ceilingtexture()), sActor, sPlayer);
break; break;
case SECTOR_CEILINGSLOPE: case SECTOR_CEILINGSLOPE:
if (bSet) sectp->setceilingslope(lValue); if (bSet) sectp->setceilingslope(lValue);
@ -1098,8 +1098,8 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, sectp->ceilingypan(), sActor, sPlayer); else SetGameVarID(lVar2, sectp->ceilingypan(), sActor, sPlayer);
break; break;
case SECTOR_FLOORPICNUM: case SECTOR_FLOORPICNUM:
if (bSet) sectp->floorpicnum = lValue; if (bSet) sectp->setfloortexture(tileGetTextureID(lValue));
else SetGameVarID(lVar2, sectp->legacyTileNum(sectortype::ceiling), sActor, sPlayer); else SetGameVarID(lVar2, legacyTileNum(sectp->floortexture()), sActor, sPlayer);
break; break;
case SECTOR_FLOORSLOPE: case SECTOR_FLOORSLOPE:
if (bSet) sectp->setfloorslope(lValue); if (bSet) sectp->setfloorslope(lValue);
@ -3454,7 +3454,7 @@ int ParseState::parse(void)
case concmd_gettexturefloor: case concmd_gettexturefloor:
{ {
insptr++; insptr++;
SetGameVarID(g_iTextureID, g_ac->sector()->legacyTileNum(sectortype::ceiling), g_ac, g_p); SetGameVarID(g_iTextureID, legacyTileNum(g_ac->sector()->floortexture()), g_ac, g_p);
break; break;
} }
@ -3591,7 +3591,7 @@ int ParseState::parse(void)
case concmd_gettextureceiling: case concmd_gettextureceiling:
{ {
insptr++; insptr++;
SetGameVarID(g_iTextureID, g_ac->sector()->legacyTileNum(sectortype::ceiling), g_ac, g_p); SetGameVarID(g_iTextureID, legacyTileNum(g_ac->sector()->ceilingtexture()), g_ac, g_p);
break; break;
} }
case concmd_ifvarvarand: case concmd_ifvarvarand: