- made sector_t::damageamount an int so that it can hold TELEFRAG_DAMAGE.

- marked all places where sector_t::special needs to be addressed for the damage overhaul.

NOTE: This commit will not compile!
This commit is contained in:
Christoph Oelckers 2016-01-06 12:56:35 +01:00
parent 1ee441412a
commit bd8513c063
13 changed files with 44 additions and 36 deletions

View file

@ -139,7 +139,7 @@ void DLightningThinker::LightningFlash ()
for (i = numsectors, j = 0; i > 0; --i, ++j, ++tempSec) for (i = numsectors, j = 0; i > 0; --i, ++j, ++tempSec)
{ {
// allow combination of the lightning sector specials with bit masks // allow combination of the lightning sector specials with bit masks
int special = tempSec->special & 0xff; int special = tempSec->special;
if (tempSec->GetTexture(sector_t::ceiling) == skyflatnum if (tempSec->GetTexture(sector_t::ceiling) == skyflatnum
|| special == Light_IndoorLightning1 || special == Light_IndoorLightning1
|| special == Light_IndoorLightning2 || special == Light_IndoorLightning2

View file

@ -630,11 +630,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
if (self->z == sec->floorplane.ZatPoint (self->x, self->y)) if (self->z == sec->floorplane.ZatPoint (self->x, self->y))
{ {
if ((sec->special & 0xFF) == Damage_InstantDeath) if (sec->special == Damage_InstantDeath)
{ {
P_DamageMobj (self, NULL, NULL, 999, NAME_InstantDeath); P_DamageMobj (self, NULL, NULL, 999, NAME_InstantDeath);
} }
else if ((sec->special & 0xFF) == Scroll_StrifeCurrent) else if (sec->special == Scroll_StrifeCurrent)
{ {
int anglespeed = tagManager.GetFirstSectorTag(sec) - 100; int anglespeed = tagManager.GetFirstSectorTag(sec) - 100;
fixed_t speed = (anglespeed % 10) << (FRACBITS - 4); fixed_t speed = (anglespeed % 10) << (FRACBITS - 4);

View file

@ -143,7 +143,7 @@ void DCeiling::Tick ()
// movers with texture change, change the texture then get removed // movers with texture change, change the texture then get removed
case genCeilingChgT: case genCeilingChgT:
case genCeilingChg0: case genCeilingChg0:
m_Sector->special = m_NewSpecial; m_Sector->xspecial = m_NewSpecial;
// fall through // fall through
case genCeilingChg: case genCeilingChg:
m_Sector->SetTexture(sector_t::ceiling, m_Texture); m_Sector->SetTexture(sector_t::ceiling, m_Texture);
@ -176,7 +176,7 @@ void DCeiling::Tick ()
// then remove the active ceiling // then remove the active ceiling
case genCeilingChgT: case genCeilingChgT:
case genCeilingChg0: case genCeilingChg0:
m_Sector->special = m_NewSpecial; m_Sector->xspecial = m_NewSpecial;
// fall through // fall through
case genCeilingChg: case genCeilingChg:
m_Sector->SetTexture(sector_t::ceiling, m_Texture); m_Sector->SetTexture(sector_t::ceiling, m_Texture);
@ -440,7 +440,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
ceiling->m_Type = genCeilingChg0; ceiling->m_Type = genCeilingChg0;
break; break;
case 2: // type is copied case 2: // type is copied
ceiling->m_NewSpecial = sec->special; ceiling->m_NewSpecial = sec->xspecial;
ceiling->m_Type = genCeilingChgT; ceiling->m_Type = genCeilingChgT;
break; break;
case 3: // type is left alone case 3: // type is left alone
@ -459,7 +459,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
ceiling->m_Type = genCeilingChg0; ceiling->m_Type = genCeilingChg0;
break; break;
case 2: // type is copied case 2: // type is copied
ceiling->m_NewSpecial = line->frontsector->special; ceiling->m_NewSpecial = line->frontsector->xspecial;
ceiling->m_Type = genCeilingChgT; ceiling->m_Type = genCeilingChgT;
break; break;
case 3: // type is left alone case 3: // type is left alone

View file

@ -161,7 +161,7 @@ void DFloor::Tick ()
case donutRaise: case donutRaise:
case genFloorChgT: case genFloorChgT:
case genFloorChg0: case genFloorChg0:
m_Sector->special = m_Sector->special | m_NewSpecial; m_Sector->xspecial = m_Sector->xspecial | m_NewSpecial;
//fall thru //fall thru
case genFloorChg: case genFloorChg:
m_Sector->SetTexture(sector_t::floor, m_Texture); m_Sector->SetTexture(sector_t::floor, m_Texture);
@ -177,7 +177,7 @@ void DFloor::Tick ()
case floorLowerAndChange: case floorLowerAndChange:
case genFloorChgT: case genFloorChgT:
case genFloorChg0: case genFloorChg0:
m_Sector->special = m_Sector->special | m_NewSpecial; m_Sector->xspecial = m_Sector->xspecial | m_NewSpecial;
//fall thru //fall thru
case genFloorChg: case genFloorChg:
m_Sector->SetTexture(sector_t::floor, m_Texture); m_Sector->SetTexture(sector_t::floor, m_Texture);
@ -242,7 +242,7 @@ void DFloor::SetFloorChangeType (sector_t *sec, int change)
m_Type = DFloor::genFloorChg; m_Type = DFloor::genFloorChg;
break; break;
case 3: case 3:
m_NewSpecial = sec->special; m_NewSpecial = sec->xspecial;
m_Type = DFloor::genFloorChgT; m_Type = DFloor::genFloorChgT;
break; break;
} }
@ -440,11 +440,11 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
{ {
FTextureID oldpic = sec->GetTexture(sector_t::floor); FTextureID oldpic = sec->GetTexture(sector_t::floor);
sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor)); sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor));
sec->special = line->frontsector->special; sec->xspecial = line->frontsector->xspecial;
} }
else else
{ {
sec->special = 0; sec->xspecial = 0;
} }
break; break;
@ -456,7 +456,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
// jff 1/24/98 make sure floor->m_NewSpecial gets initialized // jff 1/24/98 make sure floor->m_NewSpecial gets initialized
// in case no surrounding sector is at floordestheight // in case no surrounding sector is at floordestheight
// --> should not affect compatibility <-- // --> should not affect compatibility <--
floor->m_NewSpecial = sec->special; floor->m_NewSpecial = sec->xspecial;
//jff 5/23/98 use model subroutine to unify fixes and handling //jff 5/23/98 use model subroutine to unify fixes and handling
sector_t *modelsec; sector_t *modelsec;
@ -464,7 +464,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
if (modelsec != NULL) if (modelsec != NULL)
{ {
floor->m_Texture = modelsec->GetTexture(sector_t::floor); floor->m_Texture = modelsec->GetTexture(sector_t::floor);
floor->m_NewSpecial = modelsec->special; floor->m_NewSpecial = modelsec->xspecial;
} }
break; break;
@ -637,7 +637,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
{ {
// [RH] Find the next sector by scanning for Stairs_Special? // [RH] Find the next sector by scanning for Stairs_Special?
tsec = sec->NextSpecialSector ( tsec = sec->NextSpecialSector (
(sec->special & 0xff) == Stairs_Special1 ? sec->special == Stairs_Special1 ?
Stairs_Special2 : Stairs_Special1, prev); Stairs_Special2 : Stairs_Special1, prev);
if ( (ok = (tsec != NULL)) ) if ( (ok = (tsec != NULL)) )
@ -1093,7 +1093,7 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag)
if (line) if (line)
{ // [RH] if no line, no change { // [RH] if no line, no change
sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor)); sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor));
sec->special = line->frontsector->special; sec->xspecial = line->frontsector->xspecial;
} }
break; break;
case numChangeOnly: case numChangeOnly:
@ -1101,7 +1101,7 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag)
if (secm) if (secm)
{ // if no model, no change { // if no model, no change
sec->SetTexture(sector_t::floor, secm->GetTexture(sector_t::floor)); sec->SetTexture(sector_t::floor, secm->GetTexture(sector_t::floor));
sec->special = secm->special; sec->xspecial = secm->xspecial;
} }
break; break;
default: default:

View file

@ -786,7 +786,7 @@ int DPhased::PhaseHelper (sector_t *sector, int index, int light, sector_t *prev
l = new DPhased (sector, baselevel); l = new DPhased (sector, baselevel);
int numsteps = PhaseHelper (sector->NextSpecialSector ( int numsteps = PhaseHelper (sector->NextSpecialSector (
(sector->special & 0x00ff) == LightSequenceSpecial1 ? sector->special == LightSequenceSpecial1 ?
LightSequenceSpecial2 : LightSequenceSpecial1, prev), LightSequenceSpecial2 : LightSequenceSpecial1, prev),
index + 1, l->m_BaseLevel, sector); index + 1, l->m_BaseLevel, sector);
l->m_Phase = ((numsteps - index - 1) * 64) / numsteps; l->m_Phase = ((numsteps - index - 1) * 64) / numsteps;

View file

@ -3452,7 +3452,7 @@ void AActor::Tick ()
if (player != NULL) if (player != NULL)
{ {
int scrolltype = sec->special & 0xff; int scrolltype = sec->special;
if (scrolltype >= Scroll_North_Slow && if (scrolltype >= Scroll_North_Slow &&
scrolltype <= Scroll_SouthWest_Fast) scrolltype <= Scroll_SouthWest_Fast)
@ -4424,7 +4424,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
( gameaction != ga_worlddone ) && ( gameaction != ga_worlddone ) &&
( p->mo != NULL ) && ( p->mo != NULL ) &&
( !(p->mo->Sector->Flags & SECF_NORESPAWN) ) && ( !(p->mo->Sector->Flags & SECF_NORESPAWN) ) &&
( (p->mo->Sector->special & 255) != Damage_InstantDeath )) ( p->mo->Sector->damageamount < TELEFRAG_DAMAGE ))
{ {
spawn_x = p->mo->x; spawn_x = p->mo->x;
spawn_y = p->mo->y; spawn_y = p->mo->y;

View file

@ -283,7 +283,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
if (line) if (line)
sec->SetTexture(sector_t::floor, line->sidedef[0]->sector->GetTexture(sector_t::floor)); sec->SetTexture(sector_t::floor, line->sidedef[0]->sector->GetTexture(sector_t::floor));
if (change == 1) if (change == 1)
sec->special = 0; // Stop damage and other stuff, if any sec->xspecial = 0; // Stop damage and other stuff, if any
} }
switch (type) switch (type)
@ -295,7 +295,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
plat->m_Low = sec->floorplane.d; plat->m_Low = sec->floorplane.d;
plat->m_Status = DPlat::up; plat->m_Status = DPlat::up;
plat->PlayPlatSound ("Floor"); plat->PlayPlatSound ("Floor");
sec->special = 0; // NO MORE DAMAGE, IF APPLICABLE sec->xspecial = 0; // NO MORE DAMAGE, IF APPLICABLE
break; break;
case DPlat::platUpByValue: case DPlat::platUpByValue:

View file

@ -368,8 +368,17 @@ void P_SerializeWorld (FArchive &arc)
<< sec->planes[sector_t::ceiling] << sec->planes[sector_t::ceiling]
<< sec->heightsec << sec->heightsec
<< sec->bottommap << sec->midmap << sec->topmap << sec->bottommap << sec->midmap << sec->topmap
<< sec->gravity << sec->gravity;
<< sec->damageamount; if (SaveVersion >= 4529)
{
arc << sec->damageamount;
}
else
{
short dmg;
arc << dmg;
sec->damageamount = dmg;
}
if (SaveVersion >= 4528) if (SaveVersion >= 4528)
{ {
arc << sec->damageinterval arc << sec->damageinterval

View file

@ -49,7 +49,7 @@ sector_t *sector_t::NextSpecialSector (int type, sector_t *nogood) const
if (NULL != (tsec = getNextSector (ln, this)) && if (NULL != (tsec = getNextSector (ln, this)) &&
tsec != nogood && tsec != nogood &&
(tsec->special & 0x00ff) == type) tsec->special == type)
{ {
return tsec; return tsec;
} }

View file

@ -4048,7 +4048,7 @@ void P_SetupLevel (const char *lumpname, int position)
{ {
if (mo->flags & MF_COUNTKILL) if (mo->flags & MF_COUNTKILL)
{ {
if (mo->Sector->special == dDamage_End) if (mo->Sector->damageamount > 0 && (mo->Sector->Flags & (SECF_ENDGODMODE|SECF_ENDLEVEL)) == (SECF_ENDGODMODE|SECF_ENDLEVEL))
{ {
mo->ClearCounters(); mo->ClearCounters();
} }

View file

@ -437,8 +437,6 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
} }
} }
int special = sector->special;
// Has hit ground. // Has hit ground.
AInventory *ironfeet; AInventory *ironfeet;
@ -1220,6 +1218,7 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers)
new DScroller(DScroller::sc_floor, (-FRACUNIT / 2) << 3, new DScroller(DScroller::sc_floor, (-FRACUNIT / 2) << 3,
0, -1, int(sector - sectors), 0); 0, -1, int(sector - sectors), 0);
} }
keepspecial = true;
break; break;
case hDamage_Sludge: case hDamage_Sludge:
@ -1274,7 +1273,7 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers)
}; };
int i = (sector->special & 0xff) - Scroll_North_Slow; int i = sector->special - Scroll_North_Slow;
fixed_t dx = hexenScrollies[i][0] * (FRACUNIT/2); fixed_t dx = hexenScrollies[i][0] * (FRACUNIT/2);
fixed_t dy = hexenScrollies[i][1] * (FRACUNIT/2); fixed_t dy = hexenScrollies[i][1] * (FRACUNIT/2);
if (!nothinkers) new DScroller (DScroller::sc_floor, dx, dy, -1, int(sector-sectors), 0); if (!nothinkers) new DScroller (DScroller::sc_floor, dx, dy, -1, int(sector-sectors), 0);
@ -1284,10 +1283,10 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers)
{ // Heretic scroll special { // Heretic scroll special
// Only east scrollers also scroll the texture // Only east scrollers also scroll the texture
if (!nothinkers) new DScroller (DScroller::sc_floor, if (!nothinkers) new DScroller (DScroller::sc_floor,
(-FRACUNIT/2)<<((sector->special & 0xff) - Carry_East5), (-FRACUNIT/2)<<(sector->special - Carry_East5),
0, -1, int(sector-sectors), 0); 0, -1, int(sector-sectors), 0);
} }
else keepspecial = true; keepspecial = true;
break; break;
} }
if (!keepspecial) sector->special = 0; if (!keepspecial) sector->special = 0;

View file

@ -1628,10 +1628,10 @@ public:
{ {
// [RH] Sectors default to white light with the default fade. // [RH] Sectors default to white light with the default fade.
// If they are outside (have a sky ceiling), they use the outside fog. // If they are outside (have a sky ceiling), they use the outside fog.
if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside)) if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
{ {
if (fogMap == NULL) if (fogMap == NULL)
fogMap = GetSpecialLights (PalEntry (255,255,255), level.outsidefog, 0); fogMap = GetSpecialLights(PalEntry(255, 255, 255), level.outsidefog, 0);
sec->ColorMap = fogMap; sec->ColorMap = fogMap;
} }
else else
@ -1646,7 +1646,7 @@ public:
if (lightcolor == -1) lightcolor = PalEntry(255,255,255); if (lightcolor == -1) lightcolor = PalEntry(255,255,255);
if (fadecolor == -1) if (fadecolor == -1)
{ {
if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside)) if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
fadecolor = level.outsidefog; fadecolor = level.outsidefog;
else else
fadecolor = level.fadeto; fadecolor = level.fadeto;

View file

@ -738,7 +738,7 @@ struct sector_t
float gravity; // [RH] Sector gravity (1.0 is normal) float gravity; // [RH] Sector gravity (1.0 is normal)
FNameNoInit damagetype; // [RH] Means-of-death for applied damage FNameNoInit damagetype; // [RH] Means-of-death for applied damage
short damageamount; // [RH] Damage to do while standing on floor int damageamount; // [RH] Damage to do while standing on floor
short damageinterval; // Interval for damage application short damageinterval; // Interval for damage application
short leakydamage; // chance of leaking through radiation suit short leakydamage; // chance of leaking through radiation suit