diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index e7c598d3e..33d51c02d 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -139,7 +139,7 @@ void DLightningThinker::LightningFlash () for (i = numsectors, j = 0; i > 0; --i, ++j, ++tempSec) { // 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 || special == Light_IndoorLightning1 || special == Light_IndoorLightning2 diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 7e9330990..05f6367dc 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -630,11 +630,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain) 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); } - else if ((sec->special & 0xFF) == Scroll_StrifeCurrent) + else if (sec->special == Scroll_StrifeCurrent) { int anglespeed = tagManager.GetFirstSectorTag(sec) - 100; fixed_t speed = (anglespeed % 10) << (FRACBITS - 4); diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 37cf91b47..b8a3ead7b 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -143,7 +143,7 @@ void DCeiling::Tick () // movers with texture change, change the texture then get removed case genCeilingChgT: case genCeilingChg0: - m_Sector->special = m_NewSpecial; + m_Sector->xspecial = m_NewSpecial; // fall through case genCeilingChg: m_Sector->SetTexture(sector_t::ceiling, m_Texture); @@ -176,7 +176,7 @@ void DCeiling::Tick () // then remove the active ceiling case genCeilingChgT: case genCeilingChg0: - m_Sector->special = m_NewSpecial; + m_Sector->xspecial = m_NewSpecial; // fall through case genCeilingChg: 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; break; case 2: // type is copied - ceiling->m_NewSpecial = sec->special; + ceiling->m_NewSpecial = sec->xspecial; ceiling->m_Type = genCeilingChgT; break; 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; break; case 2: // type is copied - ceiling->m_NewSpecial = line->frontsector->special; + ceiling->m_NewSpecial = line->frontsector->xspecial; ceiling->m_Type = genCeilingChgT; break; case 3: // type is left alone diff --git a/src/p_floor.cpp b/src/p_floor.cpp index e9febae66..c570bff4a 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -161,7 +161,7 @@ void DFloor::Tick () case donutRaise: case genFloorChgT: case genFloorChg0: - m_Sector->special = m_Sector->special | m_NewSpecial; + m_Sector->xspecial = m_Sector->xspecial | m_NewSpecial; //fall thru case genFloorChg: m_Sector->SetTexture(sector_t::floor, m_Texture); @@ -177,7 +177,7 @@ void DFloor::Tick () case floorLowerAndChange: case genFloorChgT: case genFloorChg0: - m_Sector->special = m_Sector->special | m_NewSpecial; + m_Sector->xspecial = m_Sector->xspecial | m_NewSpecial; //fall thru case genFloorChg: m_Sector->SetTexture(sector_t::floor, m_Texture); @@ -242,7 +242,7 @@ void DFloor::SetFloorChangeType (sector_t *sec, int change) m_Type = DFloor::genFloorChg; break; case 3: - m_NewSpecial = sec->special; + m_NewSpecial = sec->xspecial; m_Type = DFloor::genFloorChgT; break; } @@ -440,11 +440,11 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, { FTextureID oldpic = sec->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 { - sec->special = 0; + sec->xspecial = 0; } 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 // in case no surrounding sector is at floordestheight // --> 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 sector_t *modelsec; @@ -464,7 +464,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, if (modelsec != NULL) { floor->m_Texture = modelsec->GetTexture(sector_t::floor); - floor->m_NewSpecial = modelsec->special; + floor->m_NewSpecial = modelsec->xspecial; } 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? tsec = sec->NextSpecialSector ( - (sec->special & 0xff) == Stairs_Special1 ? + sec->special == Stairs_Special1 ? Stairs_Special2 : Stairs_Special1, prev); if ( (ok = (tsec != NULL)) ) @@ -1093,7 +1093,7 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag) if (line) { // [RH] if no line, no change sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor)); - sec->special = line->frontsector->special; + sec->xspecial = line->frontsector->xspecial; } break; case numChangeOnly: @@ -1101,7 +1101,7 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag) if (secm) { // if no model, no change sec->SetTexture(sector_t::floor, secm->GetTexture(sector_t::floor)); - sec->special = secm->special; + sec->xspecial = secm->xspecial; } break; default: diff --git a/src/p_lights.cpp b/src/p_lights.cpp index 7d56bce95..656b86112 100644 --- a/src/p_lights.cpp +++ b/src/p_lights.cpp @@ -786,7 +786,7 @@ int DPhased::PhaseHelper (sector_t *sector, int index, int light, sector_t *prev l = new DPhased (sector, baselevel); int numsteps = PhaseHelper (sector->NextSpecialSector ( - (sector->special & 0x00ff) == LightSequenceSpecial1 ? + sector->special == LightSequenceSpecial1 ? LightSequenceSpecial2 : LightSequenceSpecial1, prev), index + 1, l->m_BaseLevel, sector); l->m_Phase = ((numsteps - index - 1) * 64) / numsteps; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index bc314dc0e..2ded3daf2 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3452,7 +3452,7 @@ void AActor::Tick () if (player != NULL) { - int scrolltype = sec->special & 0xff; + int scrolltype = sec->special; if (scrolltype >= Scroll_North_Slow && scrolltype <= Scroll_SouthWest_Fast) @@ -4424,7 +4424,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) ( gameaction != ga_worlddone ) && ( p->mo != NULL ) && ( !(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_y = p->mo->y; diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 280eb415c..467559e63 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -283,7 +283,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height, if (line) sec->SetTexture(sector_t::floor, line->sidedef[0]->sector->GetTexture(sector_t::floor)); 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) @@ -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_Status = DPlat::up; plat->PlayPlatSound ("Floor"); - sec->special = 0; // NO MORE DAMAGE, IF APPLICABLE + sec->xspecial = 0; // NO MORE DAMAGE, IF APPLICABLE break; case DPlat::platUpByValue: diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 21e6605b9..8e2f7e9d9 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -368,8 +368,17 @@ void P_SerializeWorld (FArchive &arc) << sec->planes[sector_t::ceiling] << sec->heightsec << sec->bottommap << sec->midmap << sec->topmap - << sec->gravity - << sec->damageamount; + << sec->gravity; + if (SaveVersion >= 4529) + { + arc << sec->damageamount; + } + else + { + short dmg; + arc << dmg; + sec->damageamount = dmg; + } if (SaveVersion >= 4528) { arc << sec->damageinterval diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 361b220a7..0b6f032e5 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -49,7 +49,7 @@ sector_t *sector_t::NextSpecialSector (int type, sector_t *nogood) const if (NULL != (tsec = getNextSector (ln, this)) && tsec != nogood && - (tsec->special & 0x00ff) == type) + tsec->special == type) { return tsec; } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index dbd0954cc..772679269 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -4048,7 +4048,7 @@ void P_SetupLevel (const char *lumpname, int position) { 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(); } diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 789e44a27..58679e3e6 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -437,8 +437,6 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector) } } - int special = sector->special; - // Has hit ground. AInventory *ironfeet; @@ -1220,6 +1218,7 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers) new DScroller(DScroller::sc_floor, (-FRACUNIT / 2) << 3, 0, -1, int(sector - sectors), 0); } + keepspecial = true; break; 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 dy = hexenScrollies[i][1] * (FRACUNIT/2); 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 // Only east scrollers also scroll the texture 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); } - else keepspecial = true; + keepspecial = true; break; } if (!keepspecial) sector->special = 0; diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 64536fff4..e95193860 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1628,10 +1628,10 @@ public: { // [RH] Sectors default to white light with the default fade. // 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) - fogMap = GetSpecialLights (PalEntry (255,255,255), level.outsidefog, 0); + fogMap = GetSpecialLights(PalEntry(255, 255, 255), level.outsidefog, 0); sec->ColorMap = fogMap; } else @@ -1644,9 +1644,9 @@ public: else { 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; else fadecolor = level.fadeto; diff --git a/src/r_defs.h b/src/r_defs.h index e4b404687..92b95699f 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -738,7 +738,7 @@ struct sector_t float gravity; // [RH] Sector gravity (1.0 is normal) 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 leakydamage; // chance of leaking through radiation suit