- add savegame compatibility handling for damage related changes: When loading an old savegame the sector specials must be reinitialized to set the damage properties.

This commit is contained in:
Christoph Oelckers 2016-01-06 12:31:27 +01:00
parent 5474e01de8
commit 1ee441412a
4 changed files with 25 additions and 32 deletions

View file

@ -791,7 +791,7 @@ int DPhased::PhaseHelper (sector_t *sector, int index, int light, sector_t *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;
sector->special &= 0xff00; sector->special = 0;
return numsteps; return numsteps;
} }
@ -820,7 +820,6 @@ DPhased::DPhased (sector_t *sector, int baselevel, int phase)
{ {
m_BaseLevel = baselevel; m_BaseLevel = baselevel;
m_Phase = phase; m_Phase = phase;
sector->special &= 0xff00;
} }
//============================================================================ //============================================================================

View file

@ -410,19 +410,8 @@ void P_SerializeWorld (FArchive &arc)
short secretsector; short secretsector;
arc << secretsector; arc << secretsector;
if (secretsector) sec->Flags |= SECF_WASSECRET; if (secretsector) sec->Flags |= SECF_WASSECRET;
if (sec->special & SECRET_MASK)
{
sec->Flags |= SECF_SECRET;
}
if (sec->special & FRICTION_MASK)
{
sec->Flags |= SECF_FRICTION;
}
if (sec->special & PUSH_MASK)
{
sec->Flags |= SECF_PUSH;
}
sec->special &= ~(SECRET_MASK|FRICTION_MASK|PUSH_MASK); sec->special &= ~(SECRET_MASK|FRICTION_MASK|PUSH_MASK);
P_InitSectorSpecial(sec, sec->special, true);
} }
arc << sec->interpolations[0] arc << sec->interpolations[0]
<< sec->interpolations[1] << sec->interpolations[1]

View file

@ -1098,7 +1098,7 @@ static void P_SetupSectorDamage(sector_t *sector, int damage, int interval, int
// ('fromload' is necessary to allow conversion upon savegame load.) // ('fromload' is necessary to allow conversion upon savegame load.)
// //
void P_InitSectorSpecial(sector_t *sector, int special) void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers)
{ {
// [RH] All secret sectors are marked with a BOOM-ish bitfield // [RH] All secret sectors are marked with a BOOM-ish bitfield
if (sector->special & SECRET_MASK) if (sector->special & SECRET_MASK)
@ -1133,28 +1133,28 @@ void P_InitSectorSpecial(sector_t *sector, int special)
switch (sector->special) switch (sector->special)
{ {
case Light_Phased: case Light_Phased:
new DPhased (sector, 48, 63 - (sector->lightlevel & 63)); if (!nothinkers) new DPhased (sector, 48, 63 - (sector->lightlevel & 63));
break; break;
// [RH] Hexen-like phased lighting // [RH] Hexen-like phased lighting
case LightSequenceStart: case LightSequenceStart:
new DPhased (sector); if (!nothinkers) new DPhased (sector);
break; break;
case dLight_Flicker: case dLight_Flicker:
new DLightFlash (sector); if (!nothinkers) new DLightFlash (sector);
break; break;
case dLight_StrobeFast: case dLight_StrobeFast:
new DStrobe (sector, STROBEBRIGHT, FASTDARK, false); if (!nothinkers) new DStrobe (sector, STROBEBRIGHT, FASTDARK, false);
break; break;
case dLight_StrobeSlow: case dLight_StrobeSlow:
new DStrobe (sector, STROBEBRIGHT, SLOWDARK, false); if (!nothinkers) new DStrobe (sector, STROBEBRIGHT, SLOWDARK, false);
break; break;
case dLight_Strobe_Hurt: case dLight_Strobe_Hurt:
new DStrobe (sector, STROBEBRIGHT, FASTDARK, false); if (!nothinkers) new DStrobe (sector, STROBEBRIGHT, FASTDARK, false);
P_SetupSectorDamage(sector, 20, 32, 5, NAME_Slime, 0); P_SetupSectorDamage(sector, 20, 32, 5, NAME_Slime, 0);
break; break;
@ -1167,7 +1167,7 @@ void P_InitSectorSpecial(sector_t *sector, int special)
break; break;
case dLight_Glow: case dLight_Glow:
new DGlow (sector); if (!nothinkers) new DGlow (sector);
break; break;
case dSector_DoorCloseIn30: case dSector_DoorCloseIn30:
@ -1179,11 +1179,11 @@ void P_InitSectorSpecial(sector_t *sector, int special)
break; break;
case dLight_StrobeSlowSync: case dLight_StrobeSlowSync:
new DStrobe (sector, STROBEBRIGHT, SLOWDARK, true); if (!nothinkers) new DStrobe (sector, STROBEBRIGHT, SLOWDARK, true);
break; break;
case dLight_StrobeFastSync: case dLight_StrobeFastSync:
new DStrobe (sector, STROBEBRIGHT, FASTDARK, true); if (!nothinkers) new DStrobe (sector, STROBEBRIGHT, FASTDARK, true);
break; break;
case dSector_DoorRaiseIn5Mins: case dSector_DoorRaiseIn5Mins:
@ -1201,7 +1201,7 @@ void P_InitSectorSpecial(sector_t *sector, int special)
break; break;
case dLight_FireFlicker: case dLight_FireFlicker:
new DFireFlicker (sector); if (!nothinkers) new DFireFlicker (sector);
break; break;
case dDamage_LavaWimpy: case dDamage_LavaWimpy:
@ -1214,9 +1214,12 @@ void P_InitSectorSpecial(sector_t *sector, int special)
case dScroll_EastLavaDamage: case dScroll_EastLavaDamage:
P_SetupSectorDamage(sector, 5, 32, 256, NAME_Fire, SECF_DMGTERRAINFX); P_SetupSectorDamage(sector, 5, 32, 256, NAME_Fire, SECF_DMGTERRAINFX);
if (!nothinkers)
{
new DStrobe(sector, STROBEBRIGHT, FASTDARK, false); new DStrobe(sector, STROBEBRIGHT, FASTDARK, false);
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);
}
break; break;
case hDamage_Sludge: case hDamage_Sludge:
@ -1225,7 +1228,7 @@ void P_InitSectorSpecial(sector_t *sector, int special)
case sLight_Strobe_Hurt: case sLight_Strobe_Hurt:
P_SetupSectorDamage(sector, 5, 32, 0, NAME_Slime, 0); P_SetupSectorDamage(sector, 5, 32, 0, NAME_Slime, 0);
new DStrobe (sector, STROBEBRIGHT, FASTDARK, false); if (!nothinkers) new DStrobe (sector, STROBEBRIGHT, FASTDARK, false);
break; break;
case sDamage_Hellslime: case sDamage_Hellslime:
@ -1270,16 +1273,17 @@ void P_InitSectorSpecial(sector_t *sector, int special)
{ 1, -1 }, { 2, -2 }, { 4, -4 } { 1, -1 }, { 2, -2 }, { 4, -4 }
}; };
int i = (sector->special & 0xff) - Scroll_North_Slow; int i = (sector->special & 0xff) - 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);
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);
} }
else if (sector->special >= Carry_East5 && else if (sector->special >= Carry_East5 &&
sector->special <= Carry_East35) sector->special <= Carry_East35)
{ // Heretic scroll special { // Heretic scroll special
// Only east scrollers also scroll the texture // Only east scrollers also scroll the texture
new DScroller (DScroller::sc_floor, if (!nothinkers) new DScroller (DScroller::sc_floor,
(-FRACUNIT/2)<<((sector->special & 0xff) - Carry_East5), (-FRACUNIT/2)<<((sector->special & 0xff) - Carry_East5),
0, -1, int(sector-sectors), 0); 0, -1, int(sector-sectors), 0);
} }
@ -1309,7 +1313,7 @@ void P_SpawnSpecials (void)
if (sector->special == 0) if (sector->special == 0)
continue; continue;
P_InitSectorSpecial(sector, sector->special); P_InitSectorSpecial(sector, sector->special, false);
} }
// Init other misc stuff // Init other misc stuff

View file

@ -158,6 +158,7 @@ bool PIT_PushThing (AActor *thing);
bool CheckIfExitIsGood (AActor *self, level_info_t *info); bool CheckIfExitIsGood (AActor *self, level_info_t *info);
// at map load // at map load
void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers);
void P_SpawnSpecials (void); void P_SpawnSpecials (void);
// every tic // every tic