- generalize Duke's purple lava check.

This commit is contained in:
Christoph Oelckers 2022-12-08 21:58:05 +01:00
parent 6848af9b6c
commit 0ffeb2378a
8 changed files with 43 additions and 20 deletions

View file

@ -424,6 +424,7 @@ enum
TFLAG_NOBLOODSPLAT = 1 << 8,
TFLAG_NOCIRCLEREFLECT = 1 << 9,
TFLAG_MUDDY = 1 << 10,
TFLAG_PURPLELAVA = 1 << 11, // very special kind of terrain type.
};
enum

View file

@ -115,6 +115,7 @@ void quickkill(player_struct* p);
int setpal(player_struct* p);
int madenoise(int playerNum);
int haskey(sectortype* sect, int snum);
void purplelavacheck(player_struct* p);
bool checkhitceiling(sectortype* sectp);
void checkhitwall(DDukeActor* spr, walltype* wal, const DVector3& pos);

View file

@ -990,5 +990,37 @@ int haskey(sectortype* sectp, int snum)
return 0;
}
//---------------------------------------------------------------------------
//
// taken out of Duke, now that it is no longer hard coded.
//
//---------------------------------------------------------------------------
void purplelavacheck(player_struct* p)
{
auto pact = p->actor;
if (p->spritebridge == 0 && pact->insector())
{
auto sect = pact->sector();
// one texflag for a single texture again, just to avoid one hard coded check...
if ((tileflags(sect->floortexture()) & TFLAG_PURPLELAVA) || (tileflags(sect->ceilingtexture()) & TFLAG_PURPLELAVA))
{
if (p->boot_amount > 0)
{
p->boot_amount--;
p->inven_icon = 7;
if (p->boot_amount <= 0)
checkavailinven(p);
}
else
{
if (!S_CheckActorSoundPlaying(pact, DUKE_LONGTERM_PAIN))
S_PlayActorSound(DUKE_LONGTERM_PAIN, pact);
SetPlayerPal(p, PalEntry(32, 0, 8, 0));
pact->spr.extra--;
}
}
}
}
END_DUKE_NS

View file

@ -2883,33 +2883,17 @@ void processinput_d(int snum)
}
p->Angles.doYawKeys(&actions);
purplelavacheck(p);
if (p->spritebridge == 0 && pact->insector())
{
int j = pact->sector()->floorpicnum;
if (j == DTILE_PURPLELAVA || pact->sector()->ceilingpicnum == DTILE_PURPLELAVA)
{
if (p->boot_amount > 0)
{
p->boot_amount--;
p->inven_icon = 7;
if (p->boot_amount <= 0)
checkavailinven(p);
}
else
{
if (!S_CheckActorSoundPlaying(pact, DUKE_LONGTERM_PAIN))
S_PlayActorSound(DUKE_LONGTERM_PAIN, pact);
SetPlayerPal(p, PalEntry(32, 0, 8, 0));
pact->spr.extra--;
}
}
auto sect = pact->sector();
k = 0;
if (p->on_ground && truefdist <= gs.playerheight + 16)
{
int j = sect->floorpicnum;
int whichsound = (tileflags(tileGetTextureID(j)) & TFLAG_ELECTRIC) ? 0 : j == DTILE_FLOORSLIME ? 1 : j == DTILE_FLOORPLASMA ? 2 : -1;
if (j >= 0) k = makepainsounds(snum, whichsound);
}

View file

@ -3494,6 +3494,7 @@ void processinput_r(int snum)
}
p->Angles.doYawKeys(&actions);
purplelavacheck(p);
if (p->spritebridge == 0 && pact->insector())
{
@ -3524,7 +3525,7 @@ void processinput_r(int snum)
if (isRRRA() && p->spritebridge == 0 && p->on_ground)
{
if (psectlotag == 1)
if (psectlotag == ST_1_ABOVE_WATER)
p->NotOnWater = 0;
else if (p->OnBoat)
{

View file

@ -14,4 +14,6 @@ constants
TFLAG_NOBLOODSPLAT = 256
TFLAG_NOCIRCLEREFLECT = 512
TFLAG_MUDDY = 1024
TFLAG_PURPLELAVA = 2048
}

View file

@ -131,4 +131,5 @@ textureflags
TFLAG_ELECTRIC = HURTRAIL
TFLAG_SLIME = FLOORSLIME, FLOORSLIME1, FLOORSLIME2
TFLAG_OUTERSPACE = MOONSKY1, BIGORBIT1
TFLAG_PURPLELAVA = PURPLELAVA
}

View file

@ -81,6 +81,7 @@ struct Duke native
TFLAG_NOBLOODSPLAT = 1 << 8,
TFLAG_NOCIRCLEREFLECT = 1 << 9,
TFLAG_MUDDY = 1 << 10,
TFLAG_PURPLELAVA = 1 << 11, // very special kind of terrain type.
};
enum ESoundFlags