mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 16:10:52 +00:00
- third batch of migrations in track.cpp
This commit is contained in:
parent
6c82f9be22
commit
ddb6ec68a1
1 changed files with 15 additions and 17 deletions
|
@ -2600,45 +2600,39 @@ void VehicleSetSmoke(SECTOR_OBJECT* sop, ANIMATOR* animator)
|
||||||
|
|
||||||
void TornadoSpin(SECTOR_OBJECT* sop)
|
void TornadoSpin(SECTOR_OBJECT* sop)
|
||||||
{
|
{
|
||||||
short delta_ang, speed;
|
DAngle delta_ang, speed;
|
||||||
short locktics = synctics;
|
short locktics = synctics;
|
||||||
|
|
||||||
// get delta to target angle
|
// get delta to target angle
|
||||||
delta_ang = getincangle(sop->int_i_ang(), sop->int_i_ang_tgt());
|
delta_ang = deltaangle(sop->ang, sop->ang_tgt);
|
||||||
|
|
||||||
sop->set_int_i_ang(NORM_ANGLE(sop->int_i_ang() + (delta_ang >> sop->turn_speed)));
|
sop->ang = (sop->ang + (delta_ang / (1 << sop->turn_speed))).Normalized360();
|
||||||
delta_ang = delta_ang >> sop->turn_speed;
|
delta_ang /= 1 << sop->turn_speed;
|
||||||
|
|
||||||
// move z values
|
// move z values
|
||||||
MoveZ(sop);
|
MoveZ(sop);
|
||||||
|
|
||||||
// calculate the spin speed
|
// calculate the spin speed
|
||||||
speed = sop->int_i_spin_speed() * locktics;
|
speed = sop->spin_speed * locktics;
|
||||||
// spin_ang is incremented by the spin_speed
|
// spin_ang is incremented by the spin_speed
|
||||||
sop->set_int_i_spin_ang(NORM_ANGLE(sop->int_i_spin_ang() + speed));
|
sop->spin_ang = sop->spin_ang + speed;
|
||||||
|
|
||||||
if (sop->int_i_spin_speed())
|
if (sop->spin_speed != nullAngle)
|
||||||
{
|
{
|
||||||
// ignore delta angle if spinning
|
// ignore delta angle if spinning
|
||||||
GlobSpeedSO = DAngle::fromBuild(speed);
|
GlobSpeedSO = speed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The actual delta from the last frame
|
// The actual delta from the last frame
|
||||||
GlobSpeedSO = DAngle::fromBuild(speed + delta_ang);
|
GlobSpeedSO = speed + delta_ang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoTornadoObject(SECTOR_OBJECT* sop)
|
void DoTornadoObject(SECTOR_OBJECT* sop)
|
||||||
{
|
{
|
||||||
int xvect,yvect;
|
|
||||||
// this made them move together more or less - cool!
|
|
||||||
//static short ang = 1024;
|
|
||||||
int ret;
|
int ret;
|
||||||
short ang = sop->int_i_ang_moving();
|
DAngle &ang = sop->ang_moving;
|
||||||
|
|
||||||
xvect = sop->vel * bcos(ang);
|
|
||||||
yvect = sop->vel * bcos(ang);
|
|
||||||
|
|
||||||
auto cursect = sop->op_main_sector; // for sop->vel
|
auto cursect = sop->op_main_sector; // for sop->vel
|
||||||
double floor_dist = (abs(cursect->ceilingz - cursect->floorz)) * 0.25;
|
double floor_dist = (abs(cursect->ceilingz - cursect->floorz)) * 0.25;
|
||||||
|
@ -2646,11 +2640,15 @@ void DoTornadoObject(SECTOR_OBJECT* sop)
|
||||||
|
|
||||||
PlaceSectorObject(sop, {MAXSO, MAXSO});
|
PlaceSectorObject(sop, {MAXSO, MAXSO});
|
||||||
Collision coll;
|
Collision coll;
|
||||||
|
|
||||||
|
auto vect = ang.ToVector() * sop->vel; // vel is still in Build coordinates.
|
||||||
|
int xvect = vect.X * 16384;
|
||||||
|
int yvect = vect.Y * 16384;
|
||||||
clipmove(pos, &cursect, xvect, yvect, (int)sop->clipdist, Z(0), int(floor_dist * zworldtoint), CLIPMASK_ACTOR, coll);
|
clipmove(pos, &cursect, xvect, yvect, (int)sop->clipdist, Z(0), int(floor_dist * zworldtoint), CLIPMASK_ACTOR, coll);
|
||||||
|
|
||||||
if (coll.type != kHitNone)
|
if (coll.type != kHitNone)
|
||||||
{
|
{
|
||||||
sop->set_int_i_ang_moving(NORM_ANGLE(ang + 1024 + RANDOM_P2(512) - 256));
|
ang = ang + DAngle180 - DAngle45 + DAngle::fromBuild(RANDOM_P2(512));
|
||||||
}
|
}
|
||||||
|
|
||||||
TornadoSpin(sop);
|
TornadoSpin(sop);
|
||||||
|
|
Loading…
Reference in a new issue