- migrated all uses of floorpicnum.

This necessitated a few more surface type definitions.
This commit is contained in:
Christoph Oelckers 2022-12-09 08:28:55 +01:00
parent 4a306a21dc
commit 622710ede4
12 changed files with 62 additions and 45 deletions

View file

@ -111,7 +111,7 @@ static void ReadSectorV7(FileReader& fr, sectortype& sect)
sect.ceilingpal = fr.ReadUInt8();
sect.ceilingxpan_ = fr.ReadUInt8();
sect.ceilingypan_ = fr.ReadUInt8();
sect.floorpicnum = fr.ReadUInt16();
sect.setfloortexture(tileGetTextureID(fr.ReadUInt16()));
sect.floorheinum = fr.ReadInt16();
sect.floorshade = fr.ReadInt8();
sect.floorpal = fr.ReadUInt8();
@ -130,7 +130,7 @@ static void ReadSectorV6(FileReader& fr, sectortype& sect)
int wallnum = fr.ReadInt16();
sect.walls.Set(&wall[wallptr], wallnum);
sect.setceilingtexture(tileGetTextureID(fr.ReadUInt16()));
sect.floorpicnum = fr.ReadUInt16();
sect.setfloortexture(tileGetTextureID(fr.ReadUInt16()));
sect.ceilingheinum = clamp(fr.ReadInt16() << 5, -32768, 32767);
sect.floorheinum = clamp(fr.ReadInt16() << 5, -32768, 32767);
int c = fr.ReadInt32();
@ -159,7 +159,7 @@ static void ReadSectorV5(FileReader& fr, sectortype& sect)
int wallnum = fr.ReadInt16();
sect.walls.Set(&wall[wallptr], wallnum);
sect.setceilingtexture(tileGetTextureID(fr.ReadUInt16()));
sect.floorpicnum = fr.ReadUInt16();
sect.setfloortexture(tileGetTextureID(fr.ReadUInt16()));
sect.ceilingheinum = clamp(fr.ReadInt16() << 5, -32768, 32767);
sect.floorheinum = clamp(fr.ReadInt16() << 5, -32768, 32767);
int c = fr.ReadInt32();

View file

@ -366,7 +366,7 @@ bool SectionGeometry::ValidateSection(Section* section, int plane)
if (plane == 0)
{
if (sec->floorheinum == compare->floorheinum &&
sec->floorpicnum == compare->floorpicnum &&
sec->floortexture() == compare->floortexture &&
((sec->floorstat ^ compare->floorstat) & (CSTAT_SECTOR_ALIGN | CSTAT_SECTOR_YFLIP | CSTAT_SECTOR_XFLIP | CSTAT_SECTOR_TEXHALF | CSTAT_SECTOR_SWAPXY)) == 0 &&
sec->floorxpan_ == compare->floorxpan_ &&
sec->floorypan_ == compare->floorypan_ &&

View file

@ -33,8 +33,8 @@ struct sectortypelight
ESectorFlags ceilingstat;
ESectorFlags floorstat;
FTextureID ceilingtexture;
FTextureID floortexture;
int16_t ceilingheinum;
int16_t floorpicnum;
int16_t floorheinum;
void copy(sectortype* sec)
@ -48,7 +48,7 @@ struct sectortypelight
ceilingheinum = sec->ceilingheinum;
floorheinum = sec->floorheinum;
ceilingtexture = sec->ceilingtexture();
floorpicnum = sec->floorpicnum;
floortexture = sec->floortexture();
}
};

View file

@ -436,6 +436,10 @@ enum
TSURF_THUNDERSKY = 7,
TSURF_PLASMA = 8,
TSURF_MAGMA = 9,
TSURF_METALDUCTS = 10,
TSURF_OIL = 11,
TSURF_DEEPMUD = 12, // also affects motorcycle
TSURF_SPECIALWATER = 13,
};
enum

View file

@ -192,7 +192,7 @@ x(KEGHOLDER, 295) // that's what the text on the sprite says. It doesn't seem to
x(RRTELEPORT, 296)
x(RRTELEPORTDEST, 297)
x(CDPLAYER, 370)
y(RRTILE380, 380)
y(WATERSURFACE, 380)
x(BONUSPIC01, 403)
x(BONUSPIC02, 404)
x(BONUSPIC03, 405)
@ -1260,7 +1260,7 @@ y(RRTILE7705, 7705)
y(HOTELSIGN, 7711)
y(HOTELSIGNBROKE, 7712)
y(RRTILE7716, 7716)
y(RRTILE7756, 7756)
y(OIL1, 7756)
y(MAGMA1, 7768)
y(RRTILE7806, 7806)
y(MAGMA2, 7820)
@ -1280,8 +1280,8 @@ y(RADIATIONSIGNBROKE, 7884)
y(RRTILE7885, 7885)
y(RRTILE7886, 7886)
y(RRTILE7887, 7887)
y(RRTILE7888, 7888)
y(RRTILE7889, 7889)
y(OIL2, 7888)
y(DEEPMUD, 7889)
y(RRTILE7890, 7890)
y(RRTILE7900, 7900)
y(RRTILE7901, 7901)

View file

@ -2916,26 +2916,23 @@ void processinput_d(int snum)
{
if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
{
int j;
FTextureID j;
switch (psectlotag)
{
case 0:
if (clz.type == kHitSprite)
j = clz.actor()->spr.picnum;
j = clz.actor()->spr.spritetexture();
else
j = psectp->floorpicnum;
j = psectp->floortexture();
switch (j)
if (tilesurface(j) == TSURF_METALDUCTS)
{
case DTILE_PANNEL1:
case DTILE_PANNEL2:
S_PlayActorSound(DUKE_WALKINDUCTS, pact);
p->walking_snd_toggle = 1;
break;
}
break;
case 1:
case ST_1_ABOVE_WATER:
if ((krand() & 1) == 0)
S_PlayActorSound(DUKE_ONWATER, pact);
p->walking_snd_toggle = 1;

View file

@ -2007,7 +2007,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
p->footprintpal = 8;
p->footprintshade = 0;
}
else if (isRRRA() && (p->cursector->floorpicnum == RTILE_RRTILE7756 || p->cursector->floorpicnum == RTILE_RRTILE7888))
else if (tilesurface(p->cursector->floortexture()) == TSURF_OIL)
{
p->footprintpal = 0;
p->footprintshade = 40;
@ -3250,16 +3250,16 @@ void processinput_r(int snum)
DukeSectIterator it(psectp);
while (auto act2 = it.Next())
{
if (act2->spr.picnum == RTILE_RRTILE380)
if (act2->spr.picnum == RTILE_WATERSURFACE)
if (act2->spr.pos.Z - 8 < p->GetActor()->getOffsetZ())
psectlotag = 2;
psectlotag = ST_2_UNDERWATER;
}
}
else if (psectlotag == 7777 && (currentLevel->gameflags & LEVEL_RR_HULKSPAWN))
lastlevel = 1;
if (psectlotag == 848 && psectp->floorpicnum == RTILE_WATERTILE2)
psectlotag = 1;
if (psectlotag == 848 && tilesurface(psectp->floortexture()) == TSURF_SPECIALWATER)
psectlotag = ST_1_ABOVE_WATER;
if (psectlotag == 857)
pact->clipdist = 0.25;
@ -3542,14 +3542,20 @@ void processinput_r(int snum)
{
if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
{
int j;
FTextureID j;
switch (psectlotag)
{
case 0:
if (clz.type == kHitSprite)
j = clz.actor()->spr.picnum;
else j = psectp->floorpicnum;
j = clz.actor()->spr.spritetexture();
else
j = psectp->floortexture();
if (tilesurface(j) == TSURF_METALDUCTS)
{
S_PlayActorSound(S_FindSound("PLAYER_WALKINDUCTS"), pact); // Duke's sound slot is not available here.
p->walking_snd_toggle = 1;
}
break;
case 1:
if ((krand() & 1) == 0)
@ -3585,13 +3591,13 @@ void processinput_r(int snum)
}
}
if (isRRRA() && psectp->floorpicnum == RTILE_RRTILE7888)
if (tilesurface(psectp->floortexture()) == TSURF_OIL)
{
if (p->OnMotorcycle)
if (p->on_ground)
p->moto_on_oil = 1;
}
else if (isRRRA() && psectp->floorpicnum == RTILE_RRTILE7889)
else if (tilesurface(psectp->floortexture()) == TSURF_DEEPMUD)
{
if (p->OnMotorcycle)
{
@ -3605,25 +3611,23 @@ void processinput_r(int snum)
p->vel.XY() *= gs.playerfriction;
}
}
else
if (psectp->floorpicnum == RTILE_MUDDY || psectp->floorpicnum == RTILE_MUDDYPATH)
else if (tilesurface(psectp->floortexture()) == TSURF_MUDDY)
{
if (p->OnMotorcycle)
{
if (p->OnMotorcycle)
if (p->on_ground)
{
if (p->on_ground)
{
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
}
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
}
else
if (p->boot_amount > 0)
p->boot_amount--;
else
{
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
}
}
else
if (p->boot_amount > 0)
p->boot_amount--;
else
{
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
}
}
if (abs(p->vel.X) < 1 / 128. && abs(p->vel.Y) < 1 / 128.)
p->vel.X = p->vel.Y = 0;

View file

@ -22,5 +22,9 @@ constants
TSURF_THUNDERSKY = 7
TSURF_PLASMA = 8
TSURF_MAGMA = 9
TSURF_METALDUCTS = 10
TSURF_OIL = 11
TSURF_DEEPMUD = 12 // also affects motorcycle
TSURF_SPECIALWATER = 13
}

View file

@ -137,4 +137,5 @@ surfacetypes
TSURF_PURPLELAVA = PURPLELAVA
TSURF_PLASMA = FLOORPLASMA
TSURF_SCROLLSKY = CLOUDYSKIES
TSURF_METALDUCTS = PANNEL1, PANNEL2
}

View file

@ -37,4 +37,6 @@ textureflags
surfacetypes
{
TSURF_MAGMA = MAGMA1, MAGMA2
TSURF_OIL = OIL1, OIL2
TSURF_DEEPMUD = DEEPMUD
}

View file

@ -169,7 +169,8 @@ surfacetypes
TSURF_SLIME = FLOORSLIME, FLOORSLIME1, FLOORSLIME2
TSURF_OUTERSPACE = MOONSKY1, BIGORBIT1
TSURF_PLASMA = FLOORPLASMA
TSURF_MUDDY = MUDDY
TSURF_MUDDY = MUDDY, MUDDYPATH
TSURF_THUNDERSKY = RRTHUNDERSKY
TSURF_SPECIALWATER = WATERTILE2
}

View file

@ -91,6 +91,10 @@ struct Duke native
TSURF_THUNDERSKY = 7,
TSURF_PLASMA = 8,
TSURF_MAGMA = 9,
TSURF_METALDUCTS = 10,
TSURF_OIL = 11,
TSURF_DEEPMUD = 12, // also affects motorcycle
TSURF_SPECIALWATER = 13,
};
enum ESoundFlags