- use floats for floor/ceiling conditions.

This commit is contained in:
Christoph Oelckers 2022-09-27 20:30:18 +02:00
parent 3b88f7db3e
commit 23f2e5a7b2

View file

@ -4224,7 +4224,7 @@ bool condCheckSector(DBloodActor* aCond, int cmpOp, bool PUSH)
case 51: return condCmp(pXSect->Depth, arg1, arg2, cmpOp); case 51: return condCmp(pXSect->Depth, arg1, arg2, cmpOp);
case 55: // compare floor height (in %) case 55: // compare floor height (in %)
case 56: { // compare ceil height (in %) case 56: { // compare ceil height (in %)
int h = 0; int curH = 0; double h = 0, curH = 0;
switch (pSect->type) switch (pSect->type)
{ {
case kSectorZMotion: case kSectorZMotion:
@ -4232,15 +4232,15 @@ bool condCheckSector(DBloodActor* aCond, int cmpOp, bool PUSH)
case kSectorSlide: case kSectorSlide:
if (cond == 55)// 60) if (cond == 55)// 60)
{ {
h = ClipLow(abs(pXSect->int_onFloorZ() - pXSect->int_offFloorZ()), 1); h = max(abs(pXSect->onFloorZ - pXSect->offFloorZ), 1 / 256.);
curH = abs(pSect->int_floorz() - pXSect->int_offFloorZ()); curH = abs(pSect->floorz - pXSect->offFloorZ);
} }
else else
{ {
h = ClipLow(abs(pXSect->int_onCeilZ() - pXSect->int_offCeilZ()), 1); h = max(abs(pXSect->onCeilZ - pXSect->offCeilZ), 1 / 256.);
curH = abs(pSect->int_ceilingz() - pXSect->int_offCeilZ()); curH = abs(pSect->ceilingz - pXSect->offCeilZ);
} }
return condCmp((kPercFull * curH) / h, arg1, arg2, cmpOp); return condCmp(int((kPercFull * curH) / h), arg1, arg2, cmpOp);
default: default:
condError(aCond, "Usupported sector type %d", pSect->type); condError(aCond, "Usupported sector type %d", pSect->type);
return false; return false;