diff --git a/source/games/sw/src/cache.cpp b/source/games/sw/src/cache.cpp index e1340f3d6..4251d7425 100644 --- a/source/games/sw/src/cache.cpp +++ b/source/games/sw/src/cache.cpp @@ -64,9 +64,7 @@ void PreCacheOverride(void) SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE); while (auto actor = it.Next()) { - int j = SP_TAG2(actor); // picnum - if(j >= 0 && j <= MAXTILES) - markTextureForPrecache(tileGetTextureID(j), 0); + markTextureForPrecache(actor->texparam, 0); } } diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 377eadf87..141d401ce 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1171,7 +1171,8 @@ void UpdateWallPortalState() { if (SP_TAG3(actor) == 0) { - // back up ceilingpicnum and ceilingstat + // back up ceilingpic and ceilingstat + // std::swap(actor->sector->ceilingtexture, actor->texparam); SP_TAG5(actor) = actor->sector()->ceilingpicnum; actor->sector()->ceilingpicnum = SP_TAG2(actor); SP_TAG4(actor) = actor->sector()->ceilingstat; @@ -1180,6 +1181,7 @@ void UpdateWallPortalState() } 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); SP_TAG4(actor) = actor->sector()->floorstat; @@ -1203,13 +1205,15 @@ void RestorePortalState() { if (SP_TAG3(actor) == 0) { - // restore ceilingpicnum and ceilingstat + // restore ceilingpic and ceilingstat + // std::swap(actor->sector->ceilingtexture, actor->texparam); actor->sector()->ceilingpicnum = SP_TAG5(actor); 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()->floorstat = ESectorFlags::FromInt(SP_TAG4(actor)); actor->sector()->floorstat &= ~(CSTAT_SECTOR_SKY); diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index 7778e556e..9f1856244 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -279,7 +279,7 @@ void JS_InitMirrors(void) if (mirrorcnt >= MAXMIRRORS) { Printf("MAXMIRRORS reached! Skipping mirror wall\n"); - wal.overpicnum = sec->ceilingpicnum; + wal.overpicnum = legacyTileNum(sec->ceilingtexture()); continue; } @@ -374,7 +374,7 @@ void JS_InitMirrors(void) mirrorcnt++; } else - wal.overpicnum = sec->ceilingpicnum; + wal.overpicnum = legacyTileNum(sec->ceilingtexture()); } } diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index 0ded91698..ca4185a78 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -1085,7 +1085,8 @@ void DSWActor::Serialize(FSerializer& arc) Super::Serialize(arc); arc("hasuser", hasUser) ("tempwall", tempwall) - ("owner", ownerActor); + ("owner", ownerActor) + ("texparam", texparam); if (hasUser) arc("user", user); // only write if defined. } diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index d1ac4ba9c..14a039845 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -1402,7 +1402,7 @@ void DoChangorMatch(short match) if (TEST_BOOL1(actor)) { - sectp->ceilingpicnum = SP_TAG4(actor); + sectp->ceilingpicnum = SP_TAG4(actor); // sectp->ceilingtexture = actor->texparam; sectp->addceilingz(SP_TAG5(actor)); sectp->ceilingheinum += SP_TAG6(actor); diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index ad11cee54..edaed1eed 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -2009,6 +2009,8 @@ void SpriteSetup(void) // copy tag 7 to tag 6 and pre-shift it SP_TAG6(actor) = SP_TAG7(actor); SP_TAG6(actor) <<= 7; + if (SP_TAG2(actor) >= 0) + actor->texparam = tileGetTextureID(SP_TAG2(actor)); // convert and copy to a safe place. A new map format cannot use the lotag to hold a named texture. change_actor_stat(actor, STAT_CEILING_FLOOR_PIC_OVERRIDE); break; } @@ -2022,6 +2024,8 @@ void SpriteSetup(void) case SECT_CHANGOR: { + if (SP_TAG4(actor) >= 0) + actor->texparam = tileGetTextureID(SP_TAG4(actor)); // convert and copy to a safe place. A new map format cannot use the lotag to hold a named texture. change_actor_stat(actor, STAT_CHANGOR); break; } diff --git a/source/games/sw/src/swactor.h b/source/games/sw/src/swactor.h index abe837ef4..a92b9ff17 100644 --- a/source/games/sw/src/swactor.h +++ b/source/games/sw/src/swactor.h @@ -16,6 +16,7 @@ public: USER user; walltype* tempwall; // transient, to replace a hack using a 16 bit sprite field. TObjPtr ownerActor; + FTextureID texparam; // only one special variant of ST1 needs this... DSWActor() = default;