mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- use texture IDs in Duke's texture flag checkers.
This commit is contained in:
parent
5147826eeb
commit
6848af9b6c
12 changed files with 33 additions and 31 deletions
|
@ -403,7 +403,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cur
|
|||
pWall->nextsector = LittleShort(load.nextsector);
|
||||
pWall->cstat = EWallFlags::FromInt(LittleShort(load.cstat));
|
||||
pWall->setwalltexture(tileGetTextureID(LittleShort(load.picnum)));
|
||||
pWall->setovertexture(tileGetTextureID(LittleShort(load.overpicnum)));
|
||||
pWall->setovertexture(tileGetTextureID(LittleShort(load.overpic)));
|
||||
pWall->type = LittleShort(load.type);
|
||||
pWall->hitag = LittleShort(load.hitag);
|
||||
pWall->extra = LittleShort(load.extra);
|
||||
|
|
|
@ -44,7 +44,7 @@ struct walltypedisk
|
|||
int32_t x, y;
|
||||
int16_t point2, nextwall, nextsector;
|
||||
uint16_t cstat;
|
||||
int16_t picnum, overpicnum;
|
||||
int16_t picnum, overpic;
|
||||
int8_t shade;
|
||||
uint8_t pal, xrepeat, yrepeat, xpanning, ypanning;
|
||||
int16_t type;
|
||||
|
|
|
@ -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 && (tileflags(g_ac->sector()->floorpicnum) & TFLAG_MUDDY) != 0);
|
||||
parseifelse(abs(g_ac->spr.pos.Z - g_ac->sector()->floorz) < 32 && (tileflags(g_ac->sector()->floortexture()) & TFLAG_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);
|
||||
|
|
|
@ -120,22 +120,22 @@ inline bool inventory(DDukeActor* S)
|
|||
return actorflag(S, SFLAG_INVENTORY);
|
||||
}
|
||||
|
||||
inline const unsigned& tileflags(unsigned int tilenum)
|
||||
inline const unsigned& tileflags(FTextureID texid)
|
||||
{
|
||||
return GetExtInfo(tileGetTextureID(tilenum)).flags;
|
||||
return GetExtInfo(texid).flags;
|
||||
}
|
||||
|
||||
inline bool wallswitchcheck(DDukeActor* s)
|
||||
{
|
||||
return !!(tileflags(s->spr.picnum) & TFLAG_WALLSWITCH);
|
||||
return !!(tileflags(s->spr.spritetexture()) & TFLAG_WALLSWITCH);
|
||||
}
|
||||
|
||||
inline bool isadoorwall(int dapic)
|
||||
inline bool isadoorwall(FTextureID dapic)
|
||||
{
|
||||
return tileflags(dapic) & TFLAG_DOORWALL;
|
||||
}
|
||||
|
||||
inline bool isablockdoor(int dapic)
|
||||
inline bool isablockdoor(FTextureID dapic)
|
||||
{
|
||||
return tileflags(dapic) & TFLAG_BLOCKDOOR;
|
||||
}
|
||||
|
|
|
@ -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 (tileflags(p->cursector->ceilingpicnum) & TFLAG_SLIME) palette = SLIMEPAL;
|
||||
else if (tileflags(p->cursector->ceilingtexture()) & TFLAG_SLIME) palette = SLIMEPAL;
|
||||
else if (p->cursector->lotag == ST_2_UNDERWATER) palette = WATERPAL;
|
||||
else palette = BASEPAL;
|
||||
return palette;
|
||||
|
|
|
@ -459,9 +459,9 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
|
|||
{
|
||||
spawn(spark, DTILE_SMALLSMOKE);
|
||||
|
||||
if (isadoorwall(hit.hitWall->wallpicnum) == 1)
|
||||
if (isadoorwall(hit.hitWall->walltexture()) == 1)
|
||||
goto SKIPBULLETHOLE;
|
||||
if (isablockdoor(hit.hitWall->wallpicnum) == 1)
|
||||
if (isablockdoor(hit.hitWall->walltexture()) == 1)
|
||||
goto SKIPBULLETHOLE;
|
||||
if (p >= 0 && (
|
||||
hit.hitWall->wallpicnum == DTILE_DIPSWITCH ||
|
||||
|
@ -2910,7 +2910,7 @@ void processinput_d(int snum)
|
|||
|
||||
if (p->on_ground && truefdist <= gs.playerheight + 16)
|
||||
{
|
||||
int whichsound = (tileflags(j) & TFLAG_ELECTRIC) ? 0 : j == DTILE_FLOORSLIME ? 1 : j == DTILE_FLOORPLASMA ? 2 : -1;
|
||||
int whichsound = (tileflags(tileGetTextureID(j)) & TFLAG_ELECTRIC) ? 0 : j == DTILE_FLOORSLIME ? 1 : j == DTILE_FLOORPLASMA ? 2 : -1;
|
||||
if (j >= 0) k = makepainsounds(snum, whichsound);
|
||||
}
|
||||
|
||||
|
|
|
@ -353,9 +353,9 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
|
|||
{
|
||||
spawn(spark, RTILE_SMALLSMOKE);
|
||||
|
||||
if (isadoorwall(hit.hitWall->wallpicnum) == 1)
|
||||
if (isadoorwall(hit.hitWall->walltexture()) == 1)
|
||||
goto SKIPBULLETHOLE;
|
||||
if (isablockdoor(hit.hitWall->wallpicnum) == 1)
|
||||
if (isablockdoor(hit.hitWall->walltexture()) == 1)
|
||||
goto SKIPBULLETHOLE;
|
||||
if (p >= 0 && (
|
||||
hit.hitWall->wallpicnum == RTILE_DIPSWITCH ||
|
||||
|
@ -3502,7 +3502,7 @@ void processinput_r(int snum)
|
|||
|
||||
if (p->on_ground && truefdist <= gs.playerheight + 16)
|
||||
{
|
||||
int whichsound = (tileflags(j) & TFLAG_ELECTRIC) ? 0 : j == RTILE_FLOORSLIME ? 1 : j == RTILE_FLOORPLASMA ? 2 :
|
||||
int whichsound = (tileflags(tileGetTextureID(j)) & TFLAG_ELECTRIC) ? 0 : j == RTILE_FLOORSLIME ? 1 : j == RTILE_FLOORPLASMA ? 2 :
|
||||
(isRRRA() && (j == RTILE_RRTILE7768 || j == RTILE_RRTILE7820) ? 3 : -1);
|
||||
if (j >= 0) k = makepainsounds(snum, whichsound);
|
||||
}
|
||||
|
|
|
@ -689,8 +689,6 @@ void prelevel_common(int g)
|
|||
|
||||
if (sectp->ceilingstat & CSTAT_SECTOR_SKY)
|
||||
{
|
||||
//setupbackdrop(sectp->ceilingpicnum);
|
||||
|
||||
if (sectp->ceilingpicnum == TILE_CLOUDYSKIES && numclouds < 127)
|
||||
clouds[numclouds++] = sectp;
|
||||
|
||||
|
@ -1055,7 +1053,7 @@ void enterlevel(MapRecord *mi, int gamemode)
|
|||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
bool clearweapon = !!(currentLevel->flags & LEVEL_CLEARWEAPONS);
|
||||
int pn = ps[i].GetActor()->sector()->floorpicnum;
|
||||
auto pn = ps[i].GetActor()->sector()->floortexture();
|
||||
if (tileflags(pn) & TFLAG_CLEARINVENTORY)
|
||||
{
|
||||
resetinventory(i);
|
||||
|
|
|
@ -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 && (tileflags(sectp->ceilingpicnum) & TFLAG_OUTERSPACE));
|
||||
return (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tileflags(sectp->ceilingtexture()) & TFLAG_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 && (tileflags(sectp->floorpicnum) & TFLAG_OUTERSPACE));
|
||||
return (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tileflags(sectp->floortexture()) & TFLAG_OUTERSPACE));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -165,6 +165,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
|
|||
uint8_t switchpal;
|
||||
int lotag, hitag, picnum, correctdips, numdips;
|
||||
DVector2 spos;
|
||||
FTextureID texid;
|
||||
|
||||
if (wwal == nullptr && act == nullptr) return 0;
|
||||
correctdips = 1;
|
||||
|
@ -188,6 +189,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
|
|||
picnum = wwal->wallpicnum;
|
||||
switchpal = wwal->pal;
|
||||
}
|
||||
texid = tileGetTextureID(picnum);
|
||||
|
||||
switch (picnum)
|
||||
{
|
||||
|
@ -267,7 +269,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
|
|||
if (check_activator_motion(lotag)) return 0;
|
||||
break;
|
||||
default:
|
||||
if (isadoorwall(picnum) == 0) return 0;
|
||||
if (isadoorwall(texid) == 0) return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -403,7 +405,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
|
|||
switch (picnum)
|
||||
{
|
||||
default:
|
||||
if (isadoorwall(picnum) == 0) break;
|
||||
if (isadoorwall(texid) == 0) break;
|
||||
[[fallthrough]];
|
||||
case DTILE_DIPSWITCH:
|
||||
case DTILE_DIPSWITCHON:
|
||||
|
@ -505,7 +507,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
|
|||
picnum == DTILE_ALIENSWITCH || picnum == DTILE_ALIENSWITCHON ||
|
||||
picnum == DTILE_TECHSWITCH || picnum == DTILE_TECHSWITCHON) return 1;
|
||||
|
||||
if (hitag == 0 && isadoorwall(picnum) == 0)
|
||||
if (hitag == 0 && isadoorwall(texid) == 0)
|
||||
{
|
||||
if (act)
|
||||
S_PlaySound3D(SWITCH_ON, act, v);
|
||||
|
@ -907,7 +909,7 @@ void checksectors_d(int snum)
|
|||
|
||||
if (near.hitWall)
|
||||
{
|
||||
if (near.hitWall->lotag > 0 && isadoorwall(near.hitWall->wallpicnum))
|
||||
if (near.hitWall->lotag > 0 && isadoorwall(near.hitWall->walltexture()))
|
||||
{
|
||||
if (hitscanwall == near.hitWall || hitscanwall == nullptr)
|
||||
fi.checkhitswitch(snum, near.hitWall, nullptr);
|
||||
|
|
|
@ -124,6 +124,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
|||
uint8_t switchpal;
|
||||
int lotag, hitag, picnum, correctdips, numdips;
|
||||
DVector2 pos;
|
||||
FTextureID texid;
|
||||
|
||||
if (wwal == nullptr && act == nullptr) return 0;
|
||||
correctdips = 1;
|
||||
|
@ -147,6 +148,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
|||
picnum = wwal->wallpicnum;
|
||||
switchpal = wwal->pal;
|
||||
}
|
||||
texid = tileGetTextureID(picnum);
|
||||
|
||||
switch (picnum)
|
||||
{
|
||||
|
@ -255,7 +257,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
|||
if (check_activator_motion(lotag)) return 0;
|
||||
break;
|
||||
default:
|
||||
if (isadoorwall(picnum) == 0) return 0;
|
||||
if (isadoorwall(texid) == 0) return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -449,7 +451,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
|||
switch (picnum)
|
||||
{
|
||||
default:
|
||||
if (isadoorwall(picnum) == 0) break;
|
||||
if (isadoorwall(texid) == 0) break;
|
||||
[[fallthrough]];
|
||||
case RTILE_DIPSWITCH:
|
||||
case RTILE_DIPSWITCHON:
|
||||
|
@ -641,7 +643,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
|||
picnum == RTILE_ALIENSWITCH || picnum == RTILE_ALIENSWITCHON ||
|
||||
picnum == RTILE_TECHSWITCH || picnum == RTILE_TECHSWITCHON) return 1;
|
||||
|
||||
if (hitag == 0 && isadoorwall(picnum) == 0)
|
||||
if (hitag == 0 && isadoorwall(texid) == 0)
|
||||
{
|
||||
if (act)
|
||||
S_PlaySound3D(SWITCH_ON, act, v);
|
||||
|
@ -1028,7 +1030,7 @@ void checksectors_r(int snum)
|
|||
|
||||
if (near.hitWall)
|
||||
{
|
||||
if (near.hitWall->lotag > 0 && isadoorwall(near.hitWall->wallpicnum))
|
||||
if (near.hitWall->lotag > 0 && isadoorwall(near.hitWall->walltexture()))
|
||||
{
|
||||
if (hitscanwall == near.hitWall || hitscanwall == nullptr)
|
||||
fi.checkhitswitch(snum, near.hitWall, nullptr);
|
||||
|
|
|
@ -1286,7 +1286,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, operateactivators, operateactivators)
|
|||
|
||||
int duke_floorflags(sectortype* sector)
|
||||
{
|
||||
return tileflags(sector->floorpicnum);
|
||||
return tileflags(sector->floortexture());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorflags, duke_floorflags)
|
||||
|
@ -1298,7 +1298,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorflags, duke_floorflags)
|
|||
|
||||
int duke_ceilingflags(sectortype* sector)
|
||||
{
|
||||
return tileflags(sector->floorpicnum);
|
||||
return tileflags(sector->ceilingtexture());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingflags, duke_ceilingflags)
|
||||
|
@ -1310,7 +1310,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingflags, duke_ceilingflags)
|
|||
|
||||
int duke_wallflags(walltype* wal, int which)
|
||||
{
|
||||
return tileflags(which? wal->overpicnum : wal->wallpicnum);
|
||||
return tileflags(which? wal->overtexture() : wal->walltexture());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, wallflags, duke_wallflags)
|
||||
|
|
Loading…
Reference in a new issue