diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 8a98b684e..5d798e588 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1862,8 +1862,8 @@ void destroyit(DDukeActor *actor) auto srcwal = srcsect->walls.Data(); for (unsigned i = 0; i < destsect->walls.Size(); i++, srcwal++, destwal++) { - destwal->wallpicnum = srcwal->wallpicnum; - destwal->overpicnum = srcwal->overpicnum; + destwal->setwalltexture(srcwal->walltexture()); + destwal->setovertexture(srcwal->overtexture()); destwal->shade = srcwal->shade; destwal->xrepeat = srcwal->xrepeat; destwal->yrepeat = srcwal->yrepeat; diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index b8d84dd9e..5ffc6d580 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -422,6 +422,7 @@ enum TFLAG_BLOCKDOOR = 1 << 4, TFLAG_NOBLOODSPLAT = 1 << 5, TFLAG_NOCIRCLEREFLECT = 1 << 6, + TFLAG_INTERPOLATEWALL = 1 << 7, }; enum diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 5b545ca8e..d91066046 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -565,13 +565,13 @@ void CallStandingOn(DDukeActor* actor, player_struct* p) CCMD(changewalltexture) { if (argv.argc() < 2) return; - int tile = tileForName(argv[1]); - if (tile < 0) tile = (int)strtol(argv[1], nullptr, 10); + FTextureID tile = TexMan.CheckForTexture(argv[1], ETextureType::Any); + if (!tile.isValid()) tile = tileGetTextureID((int)strtol(argv[1], nullptr, 10)); HitInfoBase hit; hitscan(ps[0].actor->spr.pos, ps[0].cursector, DVector3(ps[0].actor->spr.Angles.Yaw.ToVector(), 0) * 1024, hit, CLIPMASK1); if (hit.hitWall) { - hit.hitWall->wallpicnum = tile; + hit.hitWall->setwalltexture(tile); } } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 24f73428a..77230886c 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -1090,7 +1090,7 @@ void enterlevel(MapRecord *mi, int gamemode) { for (auto& wal : wall) { - if (wal.wallpicnum == 7873 || wal.wallpicnum == 7870) + if (tileflags(wal.walltexture()) & TFLAG_INTERPOLATEWALL) StartInterpolation(&wal, Interp_Wall_PanX); } } diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index 6dfd8bce8..882c24f13 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -283,7 +283,7 @@ void BuildDrip(DExhumedActor* nSprite); DExhumedActor* BuildEnergyBlock(sectortype* pSector); int BuildElevC(int arg1, int nChannel, sectortype* pSector, DExhumedActor* nWallSprite, int arg5, int arg6, int nCount, ...); int BuildElevF(int nChannel, sectortype* pSector, DExhumedActor* nWallSprite, int arg_4, int arg_5, int nCount, ...); -int BuildWallFace(int nChannel, walltype* pWall, int nCount, ...); +int BuildWallFace(int nChannel, walltype* pWall, FTextureID pic); int BuildSlide(int nChannel, walltype* edx, walltype* ebx, walltype* ecx, walltype* arg1, walltype* arg2, walltype* arg3); // queen diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index 3ec551ce9..782ebd6e0 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -465,7 +465,7 @@ HITSPRITE: else if (pHitWall != nullptr) { HITWALL: - if (pHitWall->wallpicnum == kEnergy1) + if (pHitWall->walltexture() == tileGetTextureID(kEnergy1)) { if (pHitWall->twoSided()) { diff --git a/source/games/exhumed/src/lighting.cpp b/source/games/exhumed/src/lighting.cpp index 3304601c9..b4b2c4f3d 100644 --- a/source/games/exhumed/src/lighting.cpp +++ b/source/games/exhumed/src/lighting.cpp @@ -718,8 +718,6 @@ void AddFlow(walltype* pWall, int nSpeed, int b) // only moves up or down StartInterpolation(pWall, Interp_Wall_PanY); - int nPic = pWall->wallpicnum; - sFlowInfo[nFlow].angcos = 0; sFlowInfo[nFlow].angsin = b == 2 ? 1.f : -1.f; sFlowInfo[nFlow].pWall = pWall; diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index c2a6b3a04..f77aa74c7 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -104,7 +104,7 @@ struct wallFace walltype* pWall; int16_t nChannel; int16_t count; - int16_t piclist[8]; + FTextureID picList[2]; }; struct slideData @@ -136,8 +136,8 @@ struct Trap int16_t nState; int16_t nType; - int16_t nPicnum1; - int16_t nPicnum2; + FTextureID nPicnum1; + FTextureID nPicnum2; int16_t nTrapInterval; }; @@ -269,8 +269,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, wallFace& w, wallF { arc("channel", w.nChannel) ("wall", w.pWall) - ("at4", w.count) - .Array("at6", w.piclist, 8) + ("count", w.count) + .Array("piclist", w.picList, 2) .EndObject(); } return arc; @@ -919,7 +919,7 @@ void InitWallFace() // //--------------------------------------------------------------------------- -int BuildWallFace(int nChannel, walltype* pWall, int nCount, ...) +int BuildWallFace(int nChannel, walltype* pWall, FTextureID pic) { auto WallFaceCount = WallFace.Reserve(1); @@ -927,21 +927,13 @@ int BuildWallFace(int nChannel, walltype* pWall, int nCount, ...) WallFace[WallFaceCount].pWall = pWall; WallFace[WallFaceCount].nChannel = nChannel; - if (nCount > 8) { - nCount = 8; - } - - va_list piclist; - va_start(piclist, nCount); - - while (WallFace[WallFaceCount].count < nCount) + while (WallFace[WallFaceCount].count < 2) { int i = WallFace[WallFaceCount].count; WallFace[WallFaceCount].count++; - WallFace[WallFaceCount].piclist[i] = (int16_t)va_arg(piclist, int); + WallFace[WallFaceCount].picList[i] = pic + i; } - va_end(piclist); return WallFaceCount; } @@ -963,7 +955,7 @@ void AIWallFace::ProcessChannel(RunListEvent* ev) if ((si <= WallFace[nWallFace].count) && (si >= 0)) { - WallFace[nWallFace].pWall->wallpicnum = WallFace[nWallFace].piclist[si]; + WallFace[nWallFace].pWall->setwalltexture(WallFace[nWallFace].picList[si]); } } @@ -1241,8 +1233,8 @@ int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx) sTrap[nTrap].nTrapInterval = 5; } - sTrap[nTrap].nPicnum2 = 0; - sTrap[nTrap].nPicnum1 = 0; + sTrap[nTrap].nPicnum2 = FNullTextureID(); + sTrap[nTrap].nPicnum1 = FNullTextureID(); if (var_18 == -1) { return nTrap; @@ -1257,13 +1249,13 @@ int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx) if (sTrap[nTrap].pWall1 != nullptr) { sTrap[nTrap].pWall2 = &wal; - sTrap[nTrap].nPicnum2 = wal.wallpicnum; + sTrap[nTrap].nPicnum2 = wal.walltexture(); break; } else { sTrap[nTrap].pWall1 = &wal; - sTrap[nTrap].nPicnum1 = wal.wallpicnum; + sTrap[nTrap].nPicnum1 = wal.walltexture(); } } } @@ -1322,13 +1314,13 @@ void AITrap::Tick(RunListEvent* ev) auto pWall = sTrap[nTrap].pWall1; if (pWall) { - pWall->wallpicnum = sTrap[nTrap].nPicnum1; + pWall->setwalltexture(sTrap[nTrap].nPicnum1); } pWall = sTrap[nTrap].pWall1; if (pWall) { - pWall->wallpicnum = sTrap[nTrap].nPicnum2; + pWall->setwalltexture(sTrap[nTrap].nPicnum2); } } } @@ -1354,13 +1346,13 @@ void AITrap::Tick(RunListEvent* ev) auto pWall = sTrap[nTrap].pWall1; if (pWall) { - pWall->wallpicnum = sTrap[nTrap].nPicnum1 + 1; + pWall->setwalltexture(sTrap[nTrap].nPicnum1 + 1); } pWall = sTrap[nTrap].pWall2; if (pWall) { - pWall->wallpicnum = sTrap[nTrap].nPicnum2; + pWall->setwalltexture(sTrap[nTrap].nPicnum2); } D3PlayFX(StaticSound[kSound36], pBullet); @@ -1621,7 +1613,7 @@ DExhumedActor* BuildEnergyBlock(sectortype* pSector) { apos += wal.pos; - wal.wallpicnum = kClockSymbol16; + wal.setwalltexture(TexMan.CheckForTexture("ClockSymbol16", ETextureType::Any)); wal.pal = 0; wal.shade = 50; } @@ -2619,6 +2611,7 @@ void PostProcess() } else // nMap == kMap20) { + auto texid3603 = tileGetTextureID(kTile3603); for(auto& sect: sector) { sect.pSoundSect = § @@ -2626,7 +2619,7 @@ void PostProcess() for(auto& wal : sect.walls) { - if (wal.wallpicnum == kTile3603) + if (wal.walltexture() == texid3603) { wal.pal = 1; auto pActor = insertActor(§, 407); @@ -2638,7 +2631,7 @@ void PostProcess() ExhumedSpriteIterator it; while (auto act = it.Next()) { - if (act->spr.statnum < kMaxStatus && act->spr.picnum == kTile3603) + if (act->spr.statnum < kMaxStatus && act->spr.spritetexture() == texid3603) { ChangeActorStat(act, 407); act->spr.pal = 1; diff --git a/source/games/exhumed/src/runlist.cpp b/source/games/exhumed/src/runlist.cpp index 4c7dba2b5..fed940149 100644 --- a/source/games/exhumed/src/runlist.cpp +++ b/source/games/exhumed/src/runlist.cpp @@ -1625,7 +1625,7 @@ void runlist_ProcessWallTag(walltype* pWall, int nLotag, int nHitag) case 1: { - int nWallFace = BuildWallFace(nChannel, pWall, 2, pWall->wallpicnum, pWall->wallpicnum + 1); + int nWallFace = BuildWallFace(nChannel, pWall, pWall->walltexture()); runlist_AddRunRec(sRunChannels[nChannel].a, nWallFace, 0x70000); auto nSwitch = BuildSwPressWall(nChannel, BuildLink(2, nEffectTag, 0), pWall); @@ -1643,7 +1643,7 @@ void runlist_ProcessWallTag(walltype* pWall, int nLotag, int nHitag) case 7: // Regular switch { - int nWallFace = BuildWallFace(nChannel, pWall, 2, pWall->wallpicnum, pWall->wallpicnum + 1); + int nWallFace = BuildWallFace(nChannel, pWall, pWall->walltexture()); runlist_AddRunRec(sRunChannels[nChannel].a, nWallFace, 0x70000); auto nSwitch = BuildSwPressWall(nChannel, BuildLink(1, 1), pWall); @@ -1653,7 +1653,7 @@ void runlist_ProcessWallTag(walltype* pWall, int nLotag, int nHitag) case 8: // Reverse switch { - int nWallFace = BuildWallFace(nChannel, pWall, 2, pWall->wallpicnum, pWall->wallpicnum + 1); + int nWallFace = BuildWallFace(nChannel, pWall, pWall->walltexture()); runlist_AddRunRec(sRunChannels[nChannel].a, nWallFace, 0x70000); auto nSwitch = BuildSwPressWall(nChannel, BuildLink(2, -1, 0), pWall); diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index af2b9488d..c0b920d0b 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -639,7 +639,7 @@ int AutoBreakWall(walltype* wallp, const DVector3& hit_pos, DAngle ang, int type else { if (break_info->breaknum == -1) - wallp->wallpicnum = 594; // temporary break pic + wallp->setwalltexture(FNullTextureID()); // temporary break pic else { wallp->wallpicnum = break_info->breaknum; @@ -681,7 +681,7 @@ bool UserBreakWall(walltype* wp) return true; } - if (wp->wallpicnum == SP_TAG5(actor)) + if (wp->walltexture() == actor->texparam) return true; // make it BROKEN @@ -692,7 +692,7 @@ bool UserBreakWall(walltype* wp) if (SP_TAG8(actor) == 0) { - wp->wallpicnum = SP_TAG5(actor); + wp->setwalltexture(actor->texparam); // clear tags wp->hitag = wp->lotag = 0; if (wp->twoSided()) @@ -715,7 +715,7 @@ bool UserBreakWall(walltype* wp) else if (SP_TAG8(actor) == 2) { // set to broken pic - wp->wallpicnum = SP_TAG5(actor); + wp->setwalltexture(actor->texparam); // clear flags wp->cstat &= ~(block_flags); @@ -735,7 +735,7 @@ bool UserBreakWall(walltype* wp) else { // increment picnum - wp->wallpicnum++; + wp->setwalltexture(wp->walltexture() + 1); DoSpawnSpotsForDamage(match); } diff --git a/source/games/sw/src/copysect.cpp b/source/games/sw/src/copysect.cpp index 8669b78ea..4319718e6 100644 --- a/source/games/sw/src/copysect.cpp +++ b/source/games/sw/src/copysect.cpp @@ -77,10 +77,10 @@ void CopySectorWalls(sectortype* dest_sect, sectortype* src_sect) { auto const dest_nextwall = dwall->nextWall(); auto const src_nextwall = swall->nextWall(); - dest_nextwall->wallpicnum = src_nextwall->wallpicnum; + dest_nextwall->setwalltexture(src_nextwall->walltexture()); dest_nextwall->xrepeat = src_nextwall->xrepeat; dest_nextwall->yrepeat = src_nextwall->yrepeat; - dest_nextwall->overpicnum = src_nextwall->overpicnum; + dest_nextwall->setovertexture(src_nextwall->overtexture()); dest_nextwall->pal = src_nextwall->pal; dest_nextwall->cstat = src_nextwall->cstat; dest_nextwall->shade = src_nextwall->shade; diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index e6f5fc9f8..6575c6237 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -375,17 +375,6 @@ void JS_InitMirrors(void) wal.overpicnum = legacyTileNum(sec->ceilingtexture); } } - - // Invalidate textures in sector behind mirror - for (i = 0; i < mirrorcnt; i++) - { - for (auto& wal : mirror[i].mirrorSector->walls) - { - wal.wallpicnum = MIRROR; - wal.overpicnum = MIRROR; - } - } - } // InitMirrors ///////////////////////////////////////////////////// diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index c68c6ecb9..8e9ceaac0 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -1086,7 +1086,8 @@ void DSWActor::Serialize(FSerializer& arc) arc("hasuser", hasUser) ("tempwall", tempwall) ("owner", ownerActor) - ("texparam", texparam); + ("texparam", texparam) + ("texparam2", texparam2); if (hasUser) arc("user", user); // only write if defined. } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index a6b7392c4..86074214e 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1879,6 +1879,8 @@ void SpriteSetup(void) case BREAKABLE: // used for wall info + if (SP_TAG5(actor) >= 0 && !actor->texparam.isValid()) actor->texparam = tileGetTextureID(SP_TAG5(actor)); + change_actor_stat(actor, STAT_BREAKABLE); break; @@ -2009,8 +2011,7 @@ 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. + if (SP_TAG2(actor) >= 0 && !actor->texparam.isValid()) actor->texparam = tileGetTextureID(SP_TAG2(actor)); change_actor_stat(actor, STAT_CEILING_FLOOR_PIC_OVERRIDE); break; } @@ -2024,8 +2025,7 @@ 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. + if (SP_TAG4(actor) >= 0 && !actor->texparam.isValid()) actor->texparam = tileGetTextureID(SP_TAG4(actor)); change_actor_stat(actor, STAT_CHANGOR); break; } @@ -2532,6 +2532,8 @@ void SpriteSetup(void) case SECT_WALL_MOVE: + if (SP_TAG5(actor) >= 0 && !actor->texparam.isValid()) actor->texparam = tileGetTextureID(SP_TAG5(actor)); + if (SP_TAG6(actor) >= 0 && !actor->texparam.isValid()) actor->texparam2 = tileGetTextureID(SP_TAG6(actor)); change_actor_stat(actor, STAT_WALL_MOVE); break; case SECT_WALL_MOVE_CANSEE: @@ -6096,7 +6098,7 @@ int StateControl(DSWActor* actor) if ((actor->user.State->Tics & SF_WALL_STATE)) { ASSERT(actor->user.WallP); - actor->user.WallP->wallpicnum = actor->user.State->Pic; + actor->user.WallP->setwalltexture(tileGetTextureID(actor->user.State->Pic)); } else { diff --git a/source/games/sw/src/swactor.h b/source/games/sw/src/swactor.h index a92b9ff17..ac85ae766 100644 --- a/source/games/sw/src/swactor.h +++ b/source/games/sw/src/swactor.h @@ -16,7 +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... + FTextureID texparam, texparam2; // some special variants of ST1 need this... DSWActor() = default; diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index 2d7db9cfa..6150bc2cf 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -88,14 +88,15 @@ void SOwallmove(SECTOR_OBJECT* sop, DSWActor* actor, walltype* find_wallp, doubl int DoWallMove(DSWActor* actor) { - short shade1,shade2,picnum1,picnum2; + short shade1, shade2; + FTextureID texid1, texid2; bool found = false; bool SOsprite = false; double dist = SP_TAG13(actor) * maptoworld; DAngle ang = mapangle(SP_TAG4(actor)); - picnum1 = SP_TAG5(actor); - picnum2 = SP_TAG6(actor); + texid1 = actor->texparam; + texid2 = actor->texparam2; shade1 = SP_TAG7(actor); shade2 = SP_TAG8(actor); int dang = ((int)SP_TAG10(actor)) << 3; @@ -127,15 +128,15 @@ int DoWallMove(DSWActor* actor) if (shade1) wal.shade = int8_t(shade1); - if (picnum1) - wal.wallpicnum = picnum1; + if (texid1.isValid()) + wal.setwalltexture(texid1); // find the previous wall auto prev_wall = PrevWall(&wal); if (shade2) prev_wall->shade = int8_t(shade2); - if (picnum2) - prev_wall->wallpicnum = picnum2; + if (texid2.isValid()) + prev_wall->setwalltexture(texid2); } } diff --git a/wadsrc/static/filter/dukeengine/constants.mi b/wadsrc/static/filter/dukeengine/constants.mi index 77571b5d3..f3ce9f16b 100644 --- a/wadsrc/static/filter/dukeengine/constants.mi +++ b/wadsrc/static/filter/dukeengine/constants.mi @@ -10,6 +10,7 @@ constants TFLAG_BLOCKDOOR = 16 TFLAG_NOBLOODSPLAT = 32 TFLAG_NOCIRCLEREFLECT = 64 + TFLAG_INTERPOLATEWALL = 128 // surface (terrain/environment) types TSURF_NONE = 0 diff --git a/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags b/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags index ee37fc54f..f08c395c6 100644 --- a/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags +++ b/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags @@ -32,6 +32,8 @@ textureflags RRTILE8380, RRTILE8565, RRTILE8605 + + TFLAG_INTERPOLATEWALL = RRTILE7873, RRTILE7870 } surfacetypes