- got rid of most remaining references to wallpicnum and overpicnum.

What remains now needs changing the variables to texture IDs first.
This commit is contained in:
Christoph Oelckers 2022-12-10 18:29:53 +01:00
parent 90702ae2f5
commit f5e9e7d981
13 changed files with 60 additions and 63 deletions

View file

@ -465,7 +465,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
goto SKIPBULLETHOLE;
if (hit.hitSector && hit.hitSector->lotag == 0)
if (hit.hitWall->overpicnum != DTILE_BIGFORCE)
if (!(tileflags(hit.hitWall->overtexture()) & TFLAG_FORCEFIELD))
if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag == 0) ||
(!hit.hitWall->twoSided() && hit.hitSector->lotag == 0))
if ((hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0)
@ -1987,7 +1987,7 @@ int operateTripbomb(int snum)
return 0;
if (hit.hitWall != nullptr)
if (hit.hitWall->overpicnum == DTILE_BIGFORCE)
if (tileflags(hit.hitWall->overtexture()) & TFLAG_FORCEFIELD)
return 0;
DDukeActor* act;

View file

@ -358,7 +358,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
goto SKIPBULLETHOLE;
if (hit.hitSector != nullptr && hit.hitSector->lotag == 0)
if (hit.hitWall->overpicnum != RTILE_BIGFORCE)
if (!(tileflags(hit.hitWall->overtexture()) & TFLAG_FORCEFIELD))
if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag == 0) ||
(!hit.hitWall->twoSided() && hit.hitSector->lotag == 0))
if ((hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0)

View file

@ -1248,7 +1248,7 @@ void operateforcefields(DDukeActor *effector, int low)
auto wal = animwall[p].wall;
if (low == wal->lotag || low == -1)
if (tileflags(wal->overtexture()) & TFLAG_FORCEFIELD)
if (tileflags(wal->overtexture()) & (TFLAG_FORCEFIELD | TFLAG_ANIMFORCEFIELD))
{
animwall[p].tag = 0;
@ -1277,7 +1277,7 @@ void checkhitwall(DDukeActor* spr, walltype* wal, const DVector3& pos)
{
lotsofglass(spr, wal, 70);
wal->cstat &= ~CSTAT_WALL_MASKED;
wal->overpicnum = TILE_MIRRORBROKE;
wal->setovertexture(TexMan.CheckForTexture("MIRRORBROKE", ETextureType::Any));
wal->portalflags = 0;
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
return;

View file

@ -130,27 +130,26 @@ void checkplayerhurt_d(player_struct* p, const Collision& coll)
auto wal = coll.hitWall;
if (p->hurt_delay > 0) p->hurt_delay--;
else if (wal->cstat & (CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN)) switch (wal->overpicnum)
else if (wal->cstat & (CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN))
{
case DTILE_W_FORCEFIELD:
case DTILE_W_FORCEFIELD + 1:
case DTILE_W_FORCEFIELD + 2:
p->GetActor()->spr.extra -= 5;
int tf = tileflags(wal->overtexture());
if (tf & TFLAG_ANIMFORCEFIELD)
{
p->GetActor()->spr.extra -= 5;
p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
p->vel.XY() = -p->GetActor()->spr.Angles.Yaw.ToVector() * 16;
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 2);
break;
case DTILE_BIGFORCE:
p->hurt_delay = 26;
checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 2);
break;
p->vel.XY() = -p->GetActor()->spr.Angles.Yaw.ToVector() * 16;
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 2);
}
else if (tf & TFLAG_FORCEFIELD)
{
p->hurt_delay = 26;
checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 2);
}
}
}

View file

@ -141,13 +141,14 @@ void checkplayerhurt_r(player_struct* p, const Collision &coll)
auto wal = coll.hitWall;
if (p->hurt_delay > 0) p->hurt_delay--;
else if (wal->cstat & (CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN)) switch (wal->overpicnum)
else if (wal->cstat & (CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN))
{
case RTILE_BIGFORCE:
p->hurt_delay = 26;
checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 2);
break;
int tf = tileflags(wal->overtexture());
if (tf & TFLAG_FORCEFIELD)
{
p->hurt_delay = 26;
checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 2);
}
}
}
}

View file

@ -36,6 +36,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "weapon.h"
#include "break.h"
#include "buildtiles.h"
BEGIN_SW_NS
@ -435,8 +437,9 @@ int CompareSearchBreakInfo(int* picnum, BREAK_INFO* break_info)
return(*picnum - break_info->picnum);
}
BREAK_INFO* FindWallBreakInfo(int picnum)
BREAK_INFO* FindWallBreakInfo(FTextureID texid)
{
int picnum = legacyTileNum(texid);
return(BREAK_INFO*)(bsearch(&picnum, &WallBreakInfo, SIZ(WallBreakInfo), sizeof(BREAK_INFO), (int(*)(const void*, const void*))CompareSearchBreakInfo));
}
@ -465,7 +468,7 @@ BREAK_INFO* SetupWallForBreak(walltype* wallp)
{
BREAK_INFO* break_info;
break_info = FindWallBreakInfo(wallp->wallpicnum);
break_info = FindWallBreakInfo(wallp->walltexture());
if (break_info)
{
wallp->lotag = TAG_WALL_BREAK;
@ -474,7 +477,7 @@ BREAK_INFO* SetupWallForBreak(walltype* wallp)
if (wallp->overtexture().isValid() && (wallp->cstat & CSTAT_WALL_MASKED))
{
break_info = FindWallBreakInfo(wallp->overpicnum);
break_info = FindWallBreakInfo(wallp->overtexture());
if (break_info)
{
wallp->lotag = TAG_WALL_BREAK;
@ -565,7 +568,7 @@ int AutoBreakWall(walltype* wallp, const DVector3& hit_pos, DAngle ang, int type
// only break ONE of the walls
if (nwp->lotag == TAG_WALL_BREAK &&
nwp->overpicnum > 0 &&
nwp->overtexture().isValid() &&
(nwp->cstat & CSTAT_WALL_MASKED))
{
nwp->lotag = 0;
@ -573,9 +576,9 @@ int AutoBreakWall(walltype* wallp, const DVector3& hit_pos, DAngle ang, int type
}
if (wallp->overtexture().isValid() && (wallp->cstat & CSTAT_WALL_MASKED))
break_info = FindWallBreakInfo(wallp->overpicnum);
break_info = FindWallBreakInfo(wallp->overtexture());
else
break_info = FindWallBreakInfo(wallp->wallpicnum);
break_info = FindWallBreakInfo(wallp->walltexture());
if (!break_info)
{
@ -616,12 +619,12 @@ int AutoBreakWall(walltype* wallp, const DVector3& hit_pos, DAngle ang, int type
else
{
wallp->cstat &= ~(CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK);
wallp->overpicnum = break_info->breaknum;
wallp->setovertexture(tileGetTextureID(break_info->breaknum));
if (wallp->twoSided())
{
nwp = wallp->nextWall();
nwp->cstat &= ~(CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK);
nwp->overpicnum = break_info->breaknum;
nwp->setovertexture(tileGetTextureID(break_info->breaknum));
}
}
}
@ -631,7 +634,7 @@ int AutoBreakWall(walltype* wallp, const DVector3& hit_pos, DAngle ang, int type
wallp->setwalltexture(FNullTextureID()); // temporary break pic
else
{
wallp->wallpicnum = break_info->breaknum;
wallp->setwalltexture(tileGetTextureID(break_info->breaknum));
if (wallp->hitag < 0)
DoWallBreakSpriteMatch(wallp->hitag);
}

View file

@ -45,7 +45,6 @@ struct BREAK_INFO
int16_t flags, shrap_amt;
};
BREAK_INFO* FindWallBreakInfo(int picnum);
BREAK_INFO* FindSpriteBreakInfo(int picnum);
void SortBreakInfo(void);
BREAK_INFO* SetupWallForBreak(walltype* wallp);

View file

@ -1142,7 +1142,7 @@ void UpdateWallPortalState()
continue;
}
walltype* wal = mirror[i].mirrorWall;
if (wal->wallpicnum != MIRRORLABEL)
if (wal->walltexture() != tileGetTextureID(MIRRORLABEL))
{
wal->portalflags = 0;
continue;

View file

@ -891,6 +891,7 @@ enum ESurfType
{
TSURF_WATER = 1,
TSURF_LAVA = 2,
TSURF_SHALLOWWATER = 3,
};
// User->Flags flags

View file

@ -218,25 +218,9 @@ void JS_SpriteSetup(void)
// Check for certain walls to make sounds
for(auto& wal : wall)
{
int picnum = wal.wallpicnum;
// Set the don't stick bit for liquid tiles
switch (picnum)
{
case 175:
case 179:
case 300:
case 320:
case 330:
case 352:
case 780:
case 890:
case 2608:
case 2616:
//case 3834:
int surf = tilesurface(wal.walltexture());
if (surf == TSURF_WATER || surf == TSURF_LAVA || surf == TSURF_SHALLOWWATER)
wal.extra |= WALLFX_DONT_STICK;
break;
}
}
}
@ -269,9 +253,10 @@ void JS_InitMirrors(void)
mirror[i].ismagic = false;
}
auto mi = tileGetTextureID(MIRROR);
for(auto& wal : wall)
{
if (wal.twoSided() && (wal.overpicnum == MIRROR) && (wal.cstat & CSTAT_WALL_1WAY))
if (wal.twoSided() && (wal.overtexture() == mi) && (wal.cstat & CSTAT_WALL_1WAY))
{
auto sec = wal.nextSector();
if ((sec->floorstat & CSTAT_SECTOR_SKY) == 0)
@ -282,9 +267,9 @@ void JS_InitMirrors(void)
wal.setovertexture(sec->ceilingtexture);
continue;
}
wal.overpicnum = MIRRORLABEL;
wal.wallpicnum = MIRRORLABEL;
auto ml = tileGetTextureID(MIRRORLABEL);
wal.setovertexture(ml);
wal.setwalltexture(ml);
sec->floorstat |= CSTAT_SECTOR_SKY;
mirror[mirrorcnt].mirrorWall = &wal;
mirror[mirrorcnt].mirrorSector = sec;

View file

@ -459,3 +459,8 @@ x(DANGERSIGNBROKE, 4973)
x(LITEDISP22BROKE, 4980)
x(TITSUBISHIBROKE, 4918)
x(ZILLACARSIDEBROKE, 4903)
x(SHALLOWWATER, 352)
x(AWATER, 780)
x(FLSLUDGE, 2608)
x(SLUDGE, 2616)

View file

@ -6,7 +6,8 @@ constants
TFLAG_BUNNYFRIENDLY = 1
// surface types
TSURF_WATER = 1
TSURF_LAVA = 2
TSURF_WATER = 1
TSURF_LAVA = 2
TSURF_SHALLOWWATER = 3
}

View file

@ -53,5 +53,8 @@ surfacetypes
LAVA6,
LAVA7,
LAVA8
TSURF_SHALLOWWATER =
SHALLOWWATER, AWATER, FLSLUDGE, SLUDGE
}