diff --git a/source/core/maptypes.h b/source/core/maptypes.h index 557e03be7..5519d49ec 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -421,6 +421,7 @@ struct sectortype short number; // usually used for matching number bool u_defined; uint8_t flags2; + uint8_t interpolate; // this one is valid even without u_defined. }; }; diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index f367e7bfd..71953737f 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -549,7 +549,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort ("damage", c.damage, def->damage) ("number", c.number, def->number) ("u_defined", c.u_defined, def->u_defined) - ("flags2", c.flags2, def->flags2); + ("flags2", c.flags2, def->flags2) + ("interpolate", c.interpolate, def->interpolate); } arc.EndObject(); diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index 85e539f13..1ff68d8bc 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -159,10 +159,12 @@ static void setvalue(so_interp::interp_data& element, double value) wall[index].moved(); break; case soi_ceil: - sector[index].setceilingz(value); + if (!(sector[index].interpolate & 2)) + sector[index].setceilingz(value); break; case soi_floor: - sector[index].setfloorz(value); + if (!(sector[index].interpolate & 1)) + sector[index].setfloorz(value); break; case soi_sox: SectorObject[index].pmid.X = value; diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index a0117dbe9..a61dc2fd3 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -499,24 +499,30 @@ void SectorSetup(void) // set the first on up swf = &SineWaveFloor[NextSineWave][swf_ndx]; - if (tag != TAG_SINE_WAVE_CEILING) StartInterpolation(sectp, Interp_Sect_Floorz); - if (tag != TAG_SINE_WAVE_FLOOR) StartInterpolation(sectp, Interp_Sect_Ceilingz); swf->flags = 0; switch (num) { case 0: + StartInterpolation(sectp, Interp_Sect_Floorz); + sectp->interpolate |= 1; swf->flags |= (SINE_FLOOR); if ((sectp->floorstat & CSTAT_SECTOR_SLOPE)) { + StartInterpolation(sectp, Interp_Sect_Floorheinum); swf->flags |= (SINE_SLOPED); } break; case 1: + StartInterpolation(sectp, Interp_Sect_Ceilingz); + sectp->interpolate |= 2; swf->flags |= (SINE_CEILING); break; case 2: + StartInterpolation(sectp, Interp_Sect_Floorz); + StartInterpolation(sectp, Interp_Sect_Ceilingz); + sectp->interpolate |= 3; swf->flags |= (SINE_FLOOR | SINE_CEILING); break; } @@ -2550,6 +2556,7 @@ void DoSineWaveFloor(void) int wave; int flags; + Printf("---------------------------\n"); for (wave = 0; wave < MAX_SINE_WAVE; wave++) { for (swf = &SineWaveFloor[wave][0], flags = swf->flags; swf->sectp != nullptr && swf < &SineWaveFloor[wave][SIZ(SineWaveFloor[wave])]; swf++) @@ -2560,6 +2567,7 @@ void DoSineWaveFloor(void) if ((flags & SINE_FLOOR)) { double newz = swf->floorOrigz + swf->Range * BobVal(swf->sintable_ndx); + Printf("sector %d: orig = %2.5f, range = %2.5f, new = %2.5f, index = %d\n", int(swf->sectp - sector.Data()), swf->floorOrigz, swf->Range, newz, swf->sintable_ndx); swf->sectp->setfloorz(newz); }