mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- SW: do not double interpolate sectors that are both part of a sector object but also have a global interpolation attached.
In this case the SO interpolation must be skipped. The only use case for this combination is sine-wave animated water.
This commit is contained in:
parent
179ec32d5f
commit
32ce8a97bf
4 changed files with 17 additions and 5 deletions
|
@ -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.
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue