- changed Sector_SetDamage so that it can explicitly set the damage interval and the leakiness probability, instead of hardcoding it to fixed damage ranges.

- fixed: FCajunMaster::IsDangerous did not check for Heretic's sludge type.
This commit is contained in:
Christoph Oelckers 2016-01-05 15:37:59 +01:00
parent 111479063f
commit d432df55e9
8 changed files with 82 additions and 32 deletions

View File

@ -357,7 +357,7 @@ bool FCajunMaster::IsDangerous (sector_t *sec)
int special; int special;
return return
sec->damage sec->damageamount
|| sec->special & DAMAGE_MASK || sec->special & DAMAGE_MASK
|| (special = sec->special & 0xff, special == dLight_Strobe_Hurt) || (special = sec->special & 0xff, special == dLight_Strobe_Hurt)
|| special == dDamage_Hellslime || special == dDamage_Hellslime
@ -367,6 +367,7 @@ bool FCajunMaster::IsDangerous (sector_t *sec)
|| special == dDamage_LavaWimpy || special == dDamage_LavaWimpy
|| special == dDamage_LavaHefty || special == dDamage_LavaHefty
|| special == dScroll_EastLavaDamage || special == dScroll_EastLavaDamage
|| special == hDamage_Sludge
|| special == sLight_Strobe_Hurt || special == sLight_Strobe_Hurt
|| special == Damage_InstantDeath || special == Damage_InstantDeath
|| special == sDamage_SuperHellslime; || special == sDamage_SuperHellslime;

View File

@ -342,7 +342,7 @@ void P_PlayerOnSpecial3DFloor(player_t* player)
} }
// Apply sector specials // Apply sector specials
if (rover->model->special || rover->model->damage) if (rover->model->special || rover->model->damageamount)
P_PlayerInSpecialSector(player, rover->model); P_PlayerInSpecialSector(player, rover->model);
// Apply flat specials (using the ceiling!) // Apply flat specials (using the ceiling!)

View File

@ -2246,7 +2246,7 @@ FUNC(LS_PointPush_SetForce)
} }
FUNC(LS_Sector_SetDamage) FUNC(LS_Sector_SetDamage)
// Sector_SetDamage (tag, amount, mod) // Sector_SetDamage (tag, amount, mod, interval, leaky)
{ {
// The sector still stores the mod in its old format because // The sector still stores the mod in its old format because
// adding an FName to the sector_t structure might cause // adding an FName to the sector_t structure might cause
@ -2257,8 +2257,28 @@ FUNC(LS_Sector_SetDamage)
int secnum; int secnum;
while ((secnum = itr.Next()) >= 0) while ((secnum = itr.Next()) >= 0)
{ {
sectors[secnum].damage = arg1; if (arg3 <= 0) // emulate old and hacky method to handle leakiness.
sectors[secnum].mod = arg2; {
if (arg1 < 20)
{
arg4 = 0;
arg3 = 32;
}
else if (arg1 < 50)
{
arg4 = 5;
arg3 = 32;
}
else
{
arg4 = 256;
arg3 = 1;
}
}
sectors[secnum].damageamount = (short)arg1;
sectors[secnum].damagemod = (short)arg2;
sectors[secnum].damageinterval = (short)arg3;
sectors[secnum].leakydamage = (short)arg4;
} }
return true; return true;
} }

View File

@ -354,7 +354,7 @@ void P_SerializeWorld (FArchive &arc)
short tag; short tag;
arc << tag; arc << tag;
} }
arc << sec->soundtraversed arc << sec->soundtraversed
<< sec->seqType << sec->seqType
<< sec->friction << sec->friction
<< sec->movefactor << sec->movefactor
@ -369,9 +369,33 @@ void P_SerializeWorld (FArchive &arc)
<< sec->heightsec << sec->heightsec
<< sec->bottommap << sec->midmap << sec->topmap << sec->bottommap << sec->midmap << sec->topmap
<< sec->gravity << sec->gravity
<< sec->damage << sec->damageamount
<< sec->mod << sec->damagemod;
<< sec->SoundTarget if (SaveVersion >= 4528)
{
arc << sec->damageinterval
<< sec->leakydamage;
}
else
{
if (sec->damageamount < 20)
{
sec->leakydamage = 0;
sec->damageinterval = 32;
}
else if (sec->damageamount < 50)
{
sec->leakydamage = 5;
sec->damageinterval = 32;
}
else
{
sec->leakydamage = 256;
sec->damageinterval = 1;
}
}
arc << sec->SoundTarget
<< sec->SecActTarget << sec->SecActTarget
<< sec->sky << sec->sky
<< sec->MoreFlags << sec->MoreFlags

View File

@ -566,24 +566,11 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
} }
// [RH] Apply any customizable damage // [RH] Apply any customizable damage
if (sector->damage) if (sector->damageamount != 0)
{ {
if (sector->damage < 20) if (level.time % sector->damageinterval == 0 && (ironfeet == NULL || pr_playerinspecialsector() < sector->leakydamage))
{ {
if (ironfeet == NULL && !(level.time&0x1f)) P_DamageMobj (player->mo, NULL, NULL, sector->damageamount, MODtoDamageType (sector->damagemod));
P_DamageMobj (player->mo, NULL, NULL, sector->damage, MODtoDamageType (sector->mod));
}
else if (sector->damage < 50)
{
if ((ironfeet == NULL || (pr_playerinspecialsector()<5))
&& !(level.time&0x1f))
{
P_DamageMobj (player->mo, NULL, NULL, sector->damage, MODtoDamageType (sector->mod));
}
}
else
{
P_DamageMobj (player->mo, NULL, NULL, sector->damage, MODtoDamageType (sector->mod));
} }
} }
@ -1450,8 +1437,24 @@ void P_SpawnSpecials (void)
FSectorTagIterator itr(lines[i].args[0]); FSectorTagIterator itr(lines[i].args[0]);
while ((s = itr.Next()) >= 0) while ((s = itr.Next()) >= 0)
{ {
sectors[s].damage = damage; sector_t *sec = &sectors[s];
sectors[s].mod = 0;//MOD_UNKNOWN; sec->damageamount = damage;
sec->damagemod = 0;//MOD_UNKNOWN;
if (sec->damageamount < 20)
{
sec->leakydamage = 0;
sec->damageinterval = 32;
}
else if (sec->damageamount < 50)
{
sec->leakydamage = 5;
sec->damageinterval = 32;
}
else
{
sec->leakydamage = 256;
sec->damageinterval = 1;
}
} }
} }
break; break;

View File

@ -2538,7 +2538,7 @@ void P_PlayerThink (player_t *player)
if (!(player->cheats & CF_PREDICTING)) if (!(player->cheats & CF_PREDICTING))
{ {
P_PlayerOnSpecial3DFloor (player); P_PlayerOnSpecial3DFloor (player);
if (player->mo->Sector->special || player->mo->Sector->damage) if (player->mo->Sector->special || player->mo->Sector->damageamount != 0)
{ {
P_PlayerInSpecialSector (player); P_PlayerInSpecialSector (player);
} }

View File

@ -709,9 +709,11 @@ struct sector_t
// thinglist is a subset of touching_thinglist // thinglist is a subset of touching_thinglist
struct msecnode_t *touching_thinglist; // phares 3/14/98 struct msecnode_t *touching_thinglist; // phares 3/14/98
float gravity; // [RH] Sector gravity (1.0 is normal) float gravity; // [RH] Sector gravity (1.0 is normal)
short damage; // [RH] Damage to do while standing on floor short damageamount; // [RH] Damage to do while standing on floor
short mod; // [RH] Means-of-death for applied damage short damagemod; // [RH] Means-of-death for applied damage
short damageinterval; // Interval for damage application
short leakydamage; // chance of leaking through radiation suit
WORD ZoneNumber; // [RH] Zone this sector belongs to WORD ZoneNumber; // [RH] Zone this sector belongs to
WORD MoreFlags; // [RH] Internal sector flags WORD MoreFlags; // [RH] Internal sector flags

View File

@ -76,7 +76,7 @@ const char *GetVersionString();
// Use 4500 as the base git save version, since it's higher than the // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4527 #define SAVEVER 4528
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)