- moved all EV_Light* functions and G_SerializeLevel into FLevelLocals

This commit is contained in:
Christoph Oelckers 2019-01-26 17:55:15 +01:00
parent fe06c49e34
commit e5139cc325
8 changed files with 353 additions and 355 deletions

View File

@ -1658,7 +1658,7 @@ void G_SnapshotLevel ()
if (arc.OpenWriter(save_formatted))
{
SaveVersion = SAVEVER;
G_SerializeLevel(arc, &level, false);
level.Serialize(arc, false);
level.info->Snapshot = arc.GetCompressedOutput();
}
}
@ -1685,7 +1685,7 @@ void G_UnSnapshotLevel (bool hubLoad)
return;
}
G_SerializeLevel (arc, &level, hubLoad);
level.Serialize (arc, hubLoad);
level.FromSnapshot = true;
TThinkerIterator<AActor> it(NAME_PlayerPawn);

View File

@ -216,6 +216,22 @@ public:
bool EV_StartWaggle(int tag, line_t *line, int height, int speed, int offset, int timer, bool ceiling);
bool EV_DoChange(line_t *line, EChange changetype, int tag);
void EV_StartLightFlickering(int tag, int upper, int lower);
void EV_StartLightStrobing(int tag, int upper, int lower, int utics, int ltics);
void EV_StartLightStrobing(int tag, int utics, int ltics);
void EV_TurnTagLightsOff(int tag);
void EV_LightTurnOn(int tag, int bright);
void EV_LightTurnOnPartway(int tag, double frac);
void EV_LightChange(int tag, int value);
void EV_StartLightGlowing(int tag, int upper, int lower, int tics);
void EV_StartLightFading(int tag, int value, int tics);
void EV_StopLightEffect(int tag);
void RecalculateDrawnSubsectors();
FSerializer &SerializeSubsectors(FSerializer &arc, const char *key);
void SpawnExtraPlayers();
void Serialize(FSerializer &arc, bool hubload);
private:
// Work data for CollectConnectedGroups.
FPortalBits processMask;

View File

@ -132,7 +132,7 @@ void DDoor::Tick ()
// killough 10/98: implement gradual lighting effects
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
{
EV_LightTurnOnPartway (m_LightTag,
level.EV_LightTurnOnPartway (m_LightTag,
(m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
}
@ -178,7 +178,7 @@ void DDoor::Tick ()
// killough 10/98: implement gradual lighting effects
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
{
EV_LightTurnOnPartway (m_LightTag,
level.EV_LightTurnOnPartway (m_LightTag,
(m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
}

View File

@ -181,23 +181,6 @@ DFlicker::DFlicker (sector_t *sector, int upper, int lower)
m_Count = (pr_flicker()&64)+1;
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
void EV_StartLightFlickering (int tag, int upper, int lower)
{
int secnum;
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
Create<DFlicker> (&level.sectors[secnum], upper, lower);
}
}
//-----------------------------------------------------------------------------
//
// BROKEN LIGHT FLASHING
@ -349,178 +332,7 @@ DStrobe::DStrobe (sector_t *sector, int utics, int ltics, bool inSync)
//-----------------------------------------------------------------------------
//
// Start strobing lights (usually from a trigger)
// [RH] Made it more configurable.
//
//-----------------------------------------------------------------------------
void EV_StartLightStrobing (int tag, int upper, int lower, int utics, int ltics)
{
int secnum;
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sec = &level.sectors[secnum];
if (sec->lightingdata)
continue;
Create<DStrobe> (sec, upper, lower, utics, ltics);
}
}
void EV_StartLightStrobing (int tag, int utics, int ltics)
{
int secnum;
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sec = &level.sectors[secnum];
if (sec->lightingdata)
continue;
Create<DStrobe> (sec, utics, ltics, false);
}
}
//-----------------------------------------------------------------------------
//
// TURN LINE'S TAG LIGHTS OFF
// [RH] Takes a tag instead of a line
//
//-----------------------------------------------------------------------------
void EV_TurnTagLightsOff (int tag)
{
int secnum;
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sector = &level.sectors[secnum];
int min = sector->lightlevel;
for (auto ln : sector->Lines)
{
sector_t *tsec = getNextSector (ln, sector);
if (!tsec)
continue;
if (tsec->lightlevel < min)
min = tsec->lightlevel;
}
sector->SetLightLevel(min);
}
}
//-----------------------------------------------------------------------------
//
// TURN LINE'S TAG LIGHTS ON
// [RH] Takes a tag instead of a line
//
//-----------------------------------------------------------------------------
void EV_LightTurnOn (int tag, int bright)
{
int secnum;
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sector = &level.sectors[secnum];
int tbright = bright; //jff 5/17/98 search for maximum PER sector
// bright = -1 means to search ([RH] Not 0)
// for highest light level
// surrounding sector
if (bright < 0)
{
for (auto ln : sector->Lines)
{
sector_t *temp = getNextSector(ln, sector);
if (!temp)
continue;
if (temp->lightlevel > tbright)
tbright = temp->lightlevel;
}
}
sector->SetLightLevel(tbright);
//jff 5/17/98 unless compatibility optioned
//then maximum near ANY tagged sector
if (i_compatflags & COMPATF_LIGHT)
{
bright = tbright;
}
}
}
//-----------------------------------------------------------------------------
//
// killough 10/98
//
// EV_LightTurnOnPartway
//
// Turn sectors tagged to line lights on to specified or max neighbor level
//
// Passed the tag of sector(s) to light and a light level fraction between 0 and 1.
// Sets the light to min on 0, max on 1, and interpolates in-between.
// Used for doors with gradual lighting effects.
//
//-----------------------------------------------------------------------------
void EV_LightTurnOnPartway (int tag, double frac)
{
frac = clamp(frac, 0., 1.);
// Search all sectors for ones with same tag as activating line
int secnum;
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *temp, *sector = &level.sectors[secnum];
int bright = 0, min = sector->lightlevel;
for (auto ln : sector->Lines)
{
if ((temp = getNextSector (ln, sector)) != nullptr)
{
if (temp->lightlevel > bright)
{
bright = temp->lightlevel;
}
if (temp->lightlevel < min)
{
min = temp->lightlevel;
}
}
}
sector->SetLightLevel(int(frac * bright + (1 - frac) * min));
}
}
//-----------------------------------------------------------------------------
//
// [RH] New function to adjust tagged sectors' light levels
// by a relative amount. Light levels are clipped to
// be within range for sector_t::lightlevel.
//
//-----------------------------------------------------------------------------
void EV_LightChange (int tag, int value)
{
int secnum;
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
level.sectors[secnum].SetLightLevel(level.sectors[secnum].lightlevel + value);
}
}
//-----------------------------------------------------------------------------
//
// Spawn glowing light
@ -649,72 +461,6 @@ DGlow2::DGlow2 (sector_t *sector, int start, int end, int tics, bool oneshot)
m_OneShot = oneshot;
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
void EV_StartLightGlowing (int tag, int upper, int lower, int tics)
{
int secnum;
// If tics is non-positive, then we can't really do anything.
if (tics <= 0)
{
return;
}
if (upper < lower)
{
int temp = upper;
upper = lower;
lower = temp;
}
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sec = &level.sectors[secnum];
if (sec->lightingdata)
continue;
Create<DGlow2> (sec, upper, lower, tics, false);
}
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
void EV_StartLightFading (int tag, int value, int tics)
{
int secnum;
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sec = &level.sectors[secnum];
if (sec->lightingdata)
continue;
if (tics <= 0)
{
sec->SetLightLevel(value);
}
else
{
// No need to fade if lightlevel is already at desired value.
if (sec->lightlevel == value)
continue;
Create<DGlow2> (sec, sec->lightlevel, value, tics, true);
}
}
}
//-----------------------------------------------------------------------------
//
// [RH] Phased lighting ala Hexen, but implemented without the help of the Hexen source
@ -819,6 +565,260 @@ DPhased::DPhased (sector_t *sector, int baselevel, int phase)
m_Phase = phase;
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
void FLevelLocals::EV_StartLightFlickering(int tag, int upper, int lower)
{
int secnum;
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
Create<DFlicker>(&sectors[secnum], upper, lower);
}
}
//-----------------------------------------------------------------------------
//
// Start strobing lights (usually from a trigger)
// [RH] Made it more configurable.
//
//-----------------------------------------------------------------------------
void FLevelLocals::EV_StartLightStrobing(int tag, int upper, int lower, int utics, int ltics)
{
int secnum;
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sec = &sectors[secnum];
if (sec->lightingdata)
continue;
Create<DStrobe>(sec, upper, lower, utics, ltics);
}
}
void FLevelLocals::EV_StartLightStrobing(int tag, int utics, int ltics)
{
int secnum;
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sec = &sectors[secnum];
if (sec->lightingdata)
continue;
Create<DStrobe>(sec, utics, ltics, false);
}
}
//-----------------------------------------------------------------------------
//
// TURN LINE'S TAG LIGHTS OFF
// [RH] Takes a tag instead of a line
//
//-----------------------------------------------------------------------------
void FLevelLocals::EV_TurnTagLightsOff(int tag)
{
int secnum;
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sector = &sectors[secnum];
int min = sector->lightlevel;
for (auto ln : sector->Lines)
{
sector_t *tsec = getNextSector(ln, sector);
if (!tsec)
continue;
if (tsec->lightlevel < min)
min = tsec->lightlevel;
}
sector->SetLightLevel(min);
}
}
//-----------------------------------------------------------------------------
//
// TURN LINE'S TAG LIGHTS ON
// [RH] Takes a tag instead of a line
//
//-----------------------------------------------------------------------------
void FLevelLocals::EV_LightTurnOn(int tag, int bright)
{
int secnum;
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sector = &sectors[secnum];
int tbright = bright; //jff 5/17/98 search for maximum PER sector
// bright = -1 means to search ([RH] Not 0)
// for highest light level
// surrounding sector
if (bright < 0)
{
for (auto ln : sector->Lines)
{
sector_t *temp = getNextSector(ln, sector);
if (!temp)
continue;
if (temp->lightlevel > tbright)
tbright = temp->lightlevel;
}
}
sector->SetLightLevel(tbright);
//jff 5/17/98 unless compatibility optioned
//then maximum near ANY tagged sector
if (i_compatflags & COMPATF_LIGHT)
{
bright = tbright;
}
}
}
//-----------------------------------------------------------------------------
//
// killough 10/98
//
// EV_LightTurnOnPartway
//
// Turn sectors tagged to line lights on to specified or max neighbor level
//
// Passed the tag of sector(s) to light and a light level fraction between 0 and 1.
// Sets the light to min on 0, max on 1, and interpolates in-between.
// Used for doors with gradual lighting effects.
//
//-----------------------------------------------------------------------------
void FLevelLocals::EV_LightTurnOnPartway(int tag, double frac)
{
frac = clamp(frac, 0., 1.);
// Search all sectors for ones with same tag as activating line
int secnum;
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *temp, *sector = &sectors[secnum];
int bright = 0, min = sector->lightlevel;
for (auto ln : sector->Lines)
{
if ((temp = getNextSector(ln, sector)) != nullptr)
{
if (temp->lightlevel > bright)
{
bright = temp->lightlevel;
}
if (temp->lightlevel < min)
{
min = temp->lightlevel;
}
}
}
sector->SetLightLevel(int(frac * bright + (1 - frac) * min));
}
}
//-----------------------------------------------------------------------------
//
// [RH] New function to adjust tagged sectors' light levels
// by a relative amount. Light levels are clipped to
// be within range for sector_t::light
//
//-----------------------------------------------------------------------------
void FLevelLocals::EV_LightChange(int tag, int value)
{
int secnum;
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sectors[secnum].SetLightLevel(sectors[secnum].lightlevel + value);
}
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
void FLevelLocals::EV_StartLightGlowing(int tag, int upper, int lower, int tics)
{
int secnum;
// If tics is non-positive, then we can't really do anything.
if (tics <= 0)
{
return;
}
if (upper < lower)
{
int temp = upper;
upper = lower;
lower = temp;
}
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sec = &sectors[secnum];
if (sec->lightingdata)
continue;
Create<DGlow2>(sec, upper, lower, tics, false);
}
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
void FLevelLocals::EV_StartLightFading(int tag, int value, int tics)
{
int secnum;
auto it = GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
sector_t *sec = &sectors[secnum];
if (sec->lightingdata)
continue;
if (tics <= 0)
{
sec->SetLightLevel(value);
}
else
{
// No need to fade if lightlevel is already at desired value.
if (sec->lightlevel == value)
continue;
Create<DGlow2>(sec, sec->lightlevel, value, tics, true);
}
}
}
//============================================================================
//
// EV_StopLightEffect
@ -827,14 +827,14 @@ DPhased::DPhased (sector_t *sector, int baselevel, int phase)
//
//============================================================================
void EV_StopLightEffect (int tag)
void FLevelLocals::EV_StopLightEffect (int tag)
{
TThinkerIterator<DLighting> iterator;
DLighting *effect;
while ((effect = iterator.Next()) != NULL)
{
if (level.SectorHasTag(effect->GetSector(), tag))
if (SectorHasTag(effect->GetSector(), tag))
{
effect->Destroy();
}

View File

@ -2076,77 +2076,77 @@ FUNC(LS_Light_ForceLightning)
FUNC(LS_Light_RaiseByValue)
// Light_RaiseByValue (tag, value)
{
EV_LightChange (arg0, arg1);
Level->EV_LightChange (arg0, arg1);
return true;
}
FUNC(LS_Light_LowerByValue)
// Light_LowerByValue (tag, value)
{
EV_LightChange (arg0, -arg1);
Level->EV_LightChange (arg0, -arg1);
return true;
}
FUNC(LS_Light_ChangeToValue)
// Light_ChangeToValue (tag, value)
{
EV_LightTurnOn (arg0, arg1);
Level->EV_LightTurnOn (arg0, arg1);
return true;
}
FUNC(LS_Light_Fade)
// Light_Fade (tag, value, tics);
{
EV_StartLightFading (arg0, arg1, TICS(arg2));
Level->EV_StartLightFading (arg0, arg1, TICS(arg2));
return true;
}
FUNC(LS_Light_Glow)
// Light_Glow (tag, upper, lower, tics)
{
EV_StartLightGlowing (arg0, arg1, arg2, TICS(arg3));
Level->EV_StartLightGlowing (arg0, arg1, arg2, TICS(arg3));
return true;
}
FUNC(LS_Light_Flicker)
// Light_Flicker (tag, upper, lower)
{
EV_StartLightFlickering (arg0, arg1, arg2);
Level->EV_StartLightFlickering (arg0, arg1, arg2);
return true;
}
FUNC(LS_Light_Strobe)
// Light_Strobe (tag, upper, lower, u-tics, l-tics)
{
EV_StartLightStrobing (arg0, arg1, arg2, TICS(arg3), TICS(arg4));
Level->EV_StartLightStrobing (arg0, arg1, arg2, TICS(arg3), TICS(arg4));
return true;
}
FUNC(LS_Light_StrobeDoom)
// Light_StrobeDoom (tag, u-tics, l-tics)
{
EV_StartLightStrobing (arg0, TICS(arg1), TICS(arg2));
Level->EV_StartLightStrobing (arg0, TICS(arg1), TICS(arg2));
return true;
}
FUNC(LS_Light_MinNeighbor)
// Light_MinNeighbor (tag)
{
EV_TurnTagLightsOff (arg0);
Level->EV_TurnTagLightsOff (arg0);
return true;
}
FUNC(LS_Light_MaxNeighbor)
// Light_MaxNeighbor (tag)
{
EV_LightTurnOn (arg0, -1);
Level->EV_LightTurnOn (arg0, -1);
return true;
}
FUNC(LS_Light_Stop)
// Light_Stop (tag)
{
EV_StopLightEffect (arg0);
Level->EV_StopLightEffect (arg0);
return true;
}

View File

@ -314,9 +314,9 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
//
//==========================================================================
void RecalculateDrawnSubsectors()
void FLevelLocals::RecalculateDrawnSubsectors()
{
for (auto &sub : level.subsectors)
for (auto &sub : subsectors)
{
for (unsigned int j = 0; j<sub.numlines; j++)
{
@ -335,12 +335,12 @@ void RecalculateDrawnSubsectors()
//
//==========================================================================
FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
FSerializer &FLevelLocals::SerializeSubsectors(FSerializer &arc, const char *key)
{
uint8_t by;
const char *str;
auto numsubsectors = level.subsectors.Size();
auto numsubsectors = subsectors.Size();
if (arc.isWriting())
{
TArray<char> encoded(1 + (numsubsectors + 5) / 6);
@ -350,7 +350,7 @@ FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
by = 0;
for (unsigned j = 0; j < 6; j++)
{
if (i + j < numsubsectors && (level.subsectors[i + j].flags & SSECMF_DRAWN))
if (i + j < numsubsectors && (subsectors[i + j].flags & SSECMF_DRAWN))
{
by |= (1 << j);
}
@ -366,7 +366,7 @@ FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
str = &encoded[0];
if (arc.BeginArray(key))
{
auto numvertexes = level.vertexes.Size();
auto numvertexes = vertexes.Size();
arc(nullptr, numvertexes)
(nullptr, numsubsectors)
.StringPtr(nullptr, str)
@ -384,7 +384,7 @@ FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
.StringPtr(nullptr, str)
.EndArray();
if (num_verts == (int)level.vertexes.Size() && num_subs == (int)numsubsectors)
if (num_verts == (int)vertexes.Size() && num_subs == (int)numsubsectors)
{
success = true;
int sub = 0;
@ -405,7 +405,7 @@ FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
{
if (sub + s < (int)numsubsectors && (by & (1 << s)))
{
level.subsectors[sub + s].flags |= SSECMF_DRAWN;
subsectors[sub + s].flags |= SSECMF_DRAWN;
}
}
sub += 6;
@ -559,7 +559,6 @@ void P_SerializeSounds(FSerializer &arc)
void CopyPlayer(player_t *dst, player_t *src, const char *name);
static void ReadOnePlayer(FSerializer &arc, bool skipload);
static void ReadMultiplePlayers(FSerializer &arc, int numPlayers, int numPlayersNow, bool skipload);
static void SpawnExtraPlayers(FLevelLocals *Level);
//==========================================================================
//
@ -624,7 +623,7 @@ void P_SerializePlayers(FLevelLocals *Level, FSerializer &arc, bool skipload)
}
if (!skipload && numPlayersNow > numPlayers)
{
SpawnExtraPlayers(Level);
Level->SpawnExtraPlayers();
}
// Redo pitch limits, since the spawned player has them at 0.
players[consoleplayer].SendPitchLimits();
@ -875,7 +874,7 @@ void CopyPlayer(player_t *dst, player_t *src, const char *name)
//
//==========================================================================
static void SpawnExtraPlayers(FLevelLocals *Level)
void FLevelLocals::SpawnExtraPlayers()
{
// If there are more players now than there were in the savegame,
// be sure to spawn the extra players.
@ -891,7 +890,7 @@ static void SpawnExtraPlayers(FLevelLocals *Level)
if (playeringame[i] && players[i].mo == NULL)
{
players[i].playerstate = PST_ENTER;
P_SpawnPlayer(&Level->playerstarts[i], i, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);
P_SpawnPlayer(&playerstarts[i], i, (flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);
}
}
}
@ -902,13 +901,13 @@ static void SpawnExtraPlayers(FLevelLocals *Level)
//
//============================================================================
void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
void FLevelLocals::Serialize(FSerializer &arc, bool hubload)
{
int i = Level->totaltime;
int i = totaltime;
if (arc.isWriting())
{
arc.Array("checksum", Level->md5, 16);
arc.Array("checksum", md5, 16);
}
else
{
@ -917,11 +916,11 @@ void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
// deep down in the deserializer or just a crash if the few insufficient safeguards were not triggered.
uint8_t chk[16] = { 0 };
arc.Array("checksum", chk, 16);
if (arc.GetSize("linedefs") != Level->lines.Size() ||
arc.GetSize("sidedefs") != Level->sides.Size() ||
arc.GetSize("sectors") != Level->sectors.Size() ||
arc.GetSize("polyobjs") != Level->Polyobjects.Size() ||
memcmp(chk, Level->md5, 16))
if (arc.GetSize("linedefs") != lines.Size() ||
arc.GetSize("sidedefs") != sides.Size() ||
arc.GetSize("sectors") != sectors.Size() ||
arc.GetSize("polyobjs") != Polyobjects.Size() ||
memcmp(chk, md5, 16))
{
I_Error("Savegame is from a different level");
}
@ -937,61 +936,61 @@ void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
arc("multiplayer", multiplayer);
arc("flags", Level->flags)
("flags2", Level->flags2)
("fadeto", Level->fadeto)
("found_secrets", Level->found_secrets)
("found_items", Level->found_items)
("killed_monsters", Level->killed_monsters)
("total_secrets", Level->total_secrets)
("total_items", Level->total_items)
("total_monsters", Level->total_monsters)
("gravity", Level->gravity)
("aircontrol", Level->aircontrol)
("teamdamage", Level->teamdamage)
("maptime", Level->maptime)
arc("flags", flags)
("flags2", flags2)
("fadeto", fadeto)
("found_secrets", found_secrets)
("found_items", found_items)
("killed_monsters", killed_monsters)
("total_secrets", total_secrets)
("total_items", total_items)
("total_monsters", total_monsters)
("gravity", gravity)
("aircontrol", aircontrol)
("teamdamage", teamdamage)
("maptime", maptime)
("totaltime", i)
("skytexture1", Level->skytexture1)
("skytexture2", Level->skytexture2)
("fogdensity", Level->fogdensity)
("outsidefogdensity", Level->outsidefogdensity)
("skyfog", Level->skyfog)
("deathsequence", Level->deathsequence)
("bodyqueslot", Level->bodyqueslot)
("spawnindex", Level->spawnindex)
.Array("bodyque", Level->bodyque, Level->BODYQUESIZE)
("corpsequeue", Level->CorpseQueue)
("spotstate", Level->SpotState)
("fragglethinker", Level->FraggleScriptThinker)
("acsthinker", Level->ACSThinker)
("impactdecalcount", Level->ImpactDecalCount)
("scrolls", Level->Scrolls)
("automap", Level->automap);
("skytexture1", skytexture1)
("skytexture2", skytexture2)
("fogdensity", fogdensity)
("outsidefogdensity", outsidefogdensity)
("skyfog", skyfog)
("deathsequence", deathsequence)
("bodyqueslot", bodyqueslot)
("spawnindex", spawnindex)
.Array("bodyque", bodyque, BODYQUESIZE)
("corpsequeue", CorpseQueue)
("spotstate", SpotState)
("fragglethinker", FraggleScriptThinker)
("acsthinker", ACSThinker)
("impactdecalcount", ImpactDecalCount)
("scrolls", Scrolls)
("automap", automap);
// Hub transitions must keep the current total time
if (!hubload)
Level->totaltime = i;
totaltime = i;
if (arc.isReading())
{
sky1texture = Level->skytexture1;
sky2texture = Level->skytexture2;
sky1texture = skytexture1;
sky2texture = skytexture2;
R_InitSkyMap();
G_AirControlChanged();
}
Level->Behaviors.SerializeModuleStates(arc);
Behaviors.SerializeModuleStates(arc);
// The order here is important: First world state, then portal state, then thinkers, and last polyobjects.
arc("linedefs", Level->lines, Level->loadlines);
arc("sidedefs", Level->sides, Level->loadsides);
arc("sectors", Level->sectors, Level->loadsectors);
arc("zones", Level->Zones);
arc("lineportals", Level->linePortals);
arc("sectorportals", Level->sectorPortals);
arc("linedefs", lines, loadlines);
arc("sidedefs", sides, loadsides);
arc("sectors", sectors, loadsectors);
arc("zones", Zones);
arc("lineportals", linePortals);
arc("sectorportals", sectorPortals);
if (arc.isReading())
{
Level->FinalizePortals();
FinalizePortals();
}
// [ZZ] serialize health groups
@ -999,18 +998,18 @@ void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
// [ZZ] serialize events
E_SerializeEvents(arc);
DThinker::SerializeThinkers(arc, hubload);
arc("polyobjs", Level->Polyobjects);
arc("polyobjs", Polyobjects);
SerializeSubsectors(arc, "subsectors");
StatusBar->SerializeMessages(arc);
FRemapTable::StaticSerializeTranslations(arc);
Level->canvasTextureInfo.Serialize(arc);
P_SerializePlayers(Level, arc, hubload);
canvasTextureInfo.Serialize(arc);
P_SerializePlayers(this, arc, hubload);
P_SerializeSounds(arc);
// Regenerate some data that wasn't saved
if (arc.isReading())
{
for (auto &sec : Level->sectors)
for (auto &sec : sectors)
{
P_Recalculate3DFloors(&sec);
}
@ -1022,10 +1021,10 @@ void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
}
}
AActor::RecreateAllAttachedLights();
InitPortalGroups(Level);
InitPortalGroups(this);
Level->automap->Level = Level; // Temporary workaround. At the moment this cannot be deserialized yet.
Level->automap->UpdateShowAllLines();
automap->Level = this; // Temporary workaround. At the moment this cannot be deserialized yet.
automap->UpdateShowAllLines();
}

View File

@ -44,6 +44,4 @@ void P_DestroyThinkers(bool hubLoad);
void P_ReadACSDefereds (FSerializer &);
void P_WriteACSDefereds (FSerializer &);
void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubLoad);
#endif // __P_SAVEG_H__

View File

@ -130,21 +130,6 @@ protected:
DLighting() = default;
};
void EV_StartLightFlickering (int tag, int upper, int lower);
void EV_StartLightStrobing (int tag, int upper, int lower, int utics, int ltics);
void EV_StartLightStrobing (int tag, int utics, int ltics);
void EV_TurnTagLightsOff (int tag);
void EV_LightTurnOn (int tag, int bright);
void EV_LightTurnOnPartway (int tag, double frac); // killough 10/98
void EV_LightChange (int tag, int value);
void EV_StopLightEffect (int tag);
void P_SpawnGlowingLight (sector_t *sector);
void EV_StartLightGlowing (int tag, int upper, int lower, int tics);
void EV_StartLightFading (int tag, int value, int tics);
//
// P_SWITCH
//