- Blood: floatified windGenDoVerticalWind

This commit is contained in:
Christoph Oelckers 2022-09-25 14:01:17 +02:00
parent c995777ef7
commit 549f062973

View file

@ -1018,7 +1018,8 @@ DBloodActor* randomSpawnDude(DBloodActor* sourceactor, DBloodActor* origin, int
static void windGenDoVerticalWind(int factor, sectortype* pSector) static void windGenDoVerticalWind(int factor, sectortype* pSector)
{ {
int val, maxZ = 0, zdiff; bool maxZfound = false; double maxZ = 0, zdiff;
bool maxZfound = false;
// find maxz marker first // find maxz marker first
BloodSectIterator it(pSector); BloodSectIterator it(pSector);
@ -1026,7 +1027,7 @@ static void windGenDoVerticalWind(int factor, sectortype* pSector)
{ {
if (actor->spr.type == kMarkerOn && actor->spr.statnum != kStatMarker) if (actor->spr.type == kMarkerOn && actor->spr.statnum != kStatMarker)
{ {
maxZ = actor->int_pos().Z; maxZ = actor->spr.pos.Z;
maxZfound = true; maxZfound = true;
break; break;
} }
@ -1040,7 +1041,7 @@ static void windGenDoVerticalWind(int factor, sectortype* pSector)
case kStatFree: case kStatFree:
continue; continue;
case kStatFX: case kStatFX:
if (actor->int_vel().Z) break; if (actor->vel.Z) break;
continue; continue;
case kStatThing: case kStatThing:
case kStatDude: case kStatDude:
@ -1051,22 +1052,19 @@ static void windGenDoVerticalWind(int factor, sectortype* pSector)
continue; continue;
} }
if (maxZfound && actor->int_pos().Z <= maxZ) if (maxZfound && actor->spr.pos.Z <= maxZ)
{ {
zdiff = actor->int_pos().Z - maxZ; zdiff = actor->spr.pos.Z - maxZ;
if (actor->vel.Z < 0) actor->add_int_bvel_z(MulScale(actor->int_vel().Z >> 4, zdiff, 16)); if (actor->vel.Z < 0) actor->vel.Z += actor->vel.Z * zdiff / 4096;
continue; continue;
} }
val = -MulScale(factor * 64, 0x10000, 16); double val = -factor / 1024.;
if (actor->vel.Z >= 0) actor->add_int_bvel_z(val); if (actor->vel.Z >= 0) actor->vel.Z += val;
else actor->set_int_bvel_z(val); else actor->vel.Z = val;
actor->spr.pos.Z += actor->vel.Z / 16.; actor->spr.pos.Z += actor->vel.Z / 16.;
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------