- Duke: fixed SE02's handling of sloping sectors.

This commit is contained in:
Christoph Oelckers 2022-01-09 13:38:10 +01:00
parent a0e6ee0e2e
commit a50430bf68
3 changed files with 4 additions and 3 deletions

View file

@ -333,6 +333,7 @@ struct sectortype
void addceilingypan(float add) { ceilingypan_ = fmodf(ceilingypan_ + add + 512, 256); } // +512 is for handling negative offsets
void setceilingslope(int heinum) { ceilingheinum = heinum; if (heinum) ceilingstat |= CSTAT_SECTOR_SLOPE; else ceilingstat &= ~CSTAT_SECTOR_SLOPE; }
void setfloorslope(int heinum) { floorheinum = heinum; if (heinum) floorstat |= CSTAT_SECTOR_SLOPE; else floorstat &= ~CSTAT_SECTOR_SLOPE; }
int getfloorslope() const { return floorstat & CSTAT_SECTOR_SLOPE ? floorheinum : 0; }
walltype* firstWall() const;
walltype* lastWall() const;

View file

@ -3163,8 +3163,8 @@ void handle_se02(DDukeActor* actor)
}
if (abs(sc->floorheinum - actor->temp_data[5]) < 8)
sc->floorheinum = actor->temp_data[5];
else sc->floorheinum += (Sgn(actor->temp_data[5] - sc->floorheinum) << 4);
sc->setfloorslope(actor->temp_data[5]);
else sc->setfloorslope(sc->getfloorslope() + (Sgn(actor->temp_data[5] - sc->getfloorslope()) << 4));
}
int m = MulScale(actor->spr.xvel, bcos(actor->spr.ang), 14);

View file

@ -1014,7 +1014,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
}
else if (actor->spr.lotag == SE_2_EARTHQUAKE)
{
actor->temp_data[5] = actor->sector()->floorheinum;
actor->temp_data[5] = actor->sector()->getfloorslope();
actor->sector()->setfloorslope(0);
}
}