- added wrappers, part 2

This commit is contained in:
Christoph Oelckers 2022-10-03 20:53:55 +02:00
parent d4a0972733
commit a3521c0b7e
5 changed files with 16 additions and 19 deletions

View file

@ -1507,7 +1507,6 @@ struct SECTOR_OBJECT
int int_i_ang_tgt() const { return __i_ang_tgt; } int int_i_ang_tgt() const { return __i_ang_tgt; }
int int_i_ang_orig() const { return __i_ang_orig; } int int_i_ang_orig() const { return __i_ang_orig; }
int int_i_last_ang() const { return __i_last_ang; } int int_i_last_ang() const { return __i_last_ang; }
int int_i_old_ang() const { return __i_old_ang; }
int int_i_spin_ang() const { return __i_spin_ang; } int int_i_spin_ang() const { return __i_spin_ang; }
int int_i_spin_speed() const { return __i_spin_speed; } int int_i_spin_speed() const { return __i_spin_speed; }
@ -1518,7 +1517,6 @@ struct SECTOR_OBJECT
__i_ang_tgt, // target angle __i_ang_tgt, // target angle
__i_ang_orig, // original angle __i_ang_orig, // original angle
__i_last_ang, // last angle before started spinning __i_last_ang, // last angle before started spinning
__i_old_ang, // holding variable for the old angle
__i_spin_speed, // spin_speed __i_spin_speed, // spin_speed
__i_spin_ang, // spin angle __i_spin_ang, // spin angle
turn_speed, // shift value determines how fast SO turns to match new angle turn_speed, // shift value determines how fast SO turns to match new angle

View file

@ -250,7 +250,7 @@ short RectClipTurn(PLAYER* pp, DAngle new_angl, DVector2* qpos, DVector2* opos)
DAngle rot_angl; DAngle rot_angl;
int point_num; int point_num;
rot_angl = new_angl + DAngle::fromBuild(sop->__i_spin_ang - sop->int_i_ang_orig()); rot_angl = new_angl + DAngle::fromBuild(sop->int_i_spin_ang() - sop->int_i_ang_orig());
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
xy[i] = rotatepoint(pp->pos.XY(), opos[i], rot_angl); xy[i] = rotatepoint(pp->pos.XY(), opos[i], rot_angl);

View file

@ -665,7 +665,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SECTOR_OBJECT& w,
("ang_tgt", w.__i_ang_tgt, def->__i_ang_tgt) ("ang_tgt", w.__i_ang_tgt, def->__i_ang_tgt)
("ang_orig", w.__i_ang_orig, def->__i_ang_orig) ("ang_orig", w.__i_ang_orig, def->__i_ang_orig)
("last_ang", w.__i_last_ang, def->__i_last_ang) ("last_ang", w.__i_last_ang, def->__i_last_ang)
("old_ang", w.__i_old_ang, def->__i_old_ang)
("spin_speed", w.__i_spin_speed, def->__i_spin_speed) ("spin_speed", w.__i_spin_speed, def->__i_spin_speed)
("spin_ang", w.__i_spin_ang, def->__i_spin_ang) ("spin_ang", w.__i_spin_ang, def->__i_spin_ang)
("turn_speed", w.turn_speed, def->turn_speed) ("turn_speed", w.turn_speed, def->turn_speed)

View file

@ -1663,7 +1663,7 @@ int OperateSprite(DSWActor* actor, short player_is_operating)
sop = &SectorObject[so_num]; sop = &SectorObject[so_num];
sop->__i_ang_tgt = NORM_ANGLE(sop->__i_ang_tgt + 512); sop->__i_ang_tgt = NORM_ANGLE(sop->int_i_ang_tgt() + 512);
PlaySound(DIGI_BIGSWITCH, actor, v3df_none); PlaySound(DIGI_BIGSWITCH, actor, v3df_none);

View file

@ -1817,13 +1817,13 @@ void RefreshPoints(SECTOR_OBJECT* sop, const DVector2& move, bool dynamic)
{ {
// same as below - ignore the objects angle // same as below - ignore the objects angle
// last_ang is the last true angle before SO started spinning // last_ang is the last true angle before SO started spinning
delta_ang_from_orig = NORM_ANGLE(sop->__i_last_ang + sop->__i_spin_ang - sop->int_i_ang_orig()); delta_ang_from_orig = NORM_ANGLE(sop->int_i_last_ang() + sop->int_i_spin_ang() - sop->int_i_ang_orig());
} }
else else
{ {
// angle traveling + the new spin angle all offset from the original // angle traveling + the new spin angle all offset from the original
// angle // angle
delta_ang_from_orig = NORM_ANGLE(sop->int_i_ang() + sop->__i_spin_ang - sop->int_i_ang_orig()); delta_ang_from_orig = NORM_ANGLE(sop->int_i_ang() + sop->int_i_spin_ang() - sop->int_i_ang_orig());
} }
// Note that this delta angle is from the original angle // Note that this delta angle is from the original angle
@ -2126,7 +2126,7 @@ void MoveSectorObjects(SECTOR_OBJECT* sop, short locktics)
npos = DoTrack(sop, locktics); npos = DoTrack(sop, locktics);
// get delta to target angle // get delta to target angle
delta_ang = getincangle(sop->int_i_ang(), sop->__i_ang_tgt); delta_ang = getincangle(sop->int_i_ang(), sop->int_i_ang_tgt());
sop->__i_ang = NORM_ANGLE(sop->int_i_ang() + (delta_ang >> sop->turn_speed)); sop->__i_ang = NORM_ANGLE(sop->int_i_ang() + (delta_ang >> sop->turn_speed));
delta_ang = delta_ang >> sop->turn_speed; delta_ang = delta_ang >> sop->turn_speed;
@ -2135,11 +2135,11 @@ void MoveSectorObjects(SECTOR_OBJECT* sop, short locktics)
MoveZ(sop); MoveZ(sop);
// calculate the spin speed // calculate the spin speed
speed = sop->__i_spin_speed * locktics; speed = sop->int_i_spin_speed() * locktics;
// spin_ang is incremented by the spin_speed // spin_ang is incremented by the spin_speed
sop->__i_spin_ang = NORM_ANGLE(sop->__i_spin_ang + speed); sop->__i_spin_ang = NORM_ANGLE(sop->int_i_spin_ang() + speed);
if (sop->__i_spin_speed) if (sop->int_i_spin_speed())
{ {
// ignore delta angle if spinning // ignore delta angle if spinning
GlobSpeedSO = DAngle::fromBuild(speed); GlobSpeedSO = DAngle::fromBuild(speed);
@ -2160,7 +2160,7 @@ void MoveSectorObjects(SECTOR_OBJECT* sop, short locktics)
// Update the points so there will be no warping // Update the points so there will be no warping
if ((sop->flags & (SOBJ_UPDATE|SOBJ_UPDATE_ONCE)) || if ((sop->flags & (SOBJ_UPDATE|SOBJ_UPDATE_ONCE)) ||
sop->vel || sop->vel ||
(sop->int_i_ang() != sop->__i_ang_tgt) || (sop->int_i_ang() != sop->int_i_ang_tgt()) ||
GlobSpeedSO.Degrees()) GlobSpeedSO.Degrees())
{ {
sop->flags &= ~(SOBJ_UPDATE_ONCE); sop->flags &= ~(SOBJ_UPDATE_ONCE);
@ -2493,8 +2493,8 @@ DVector2 DoTrack(SECTOR_OBJECT* sop, short locktics)
if (sop->vel && !(sop->flags & SOBJ_MOVE_VERTICAL)) if (sop->vel && !(sop->flags & SOBJ_MOVE_VERTICAL))
{ {
DVector2 n; DVector2 n;
n.X = (((sop->vel) >> 8) * locktics * bcos(sop->__i_ang_moving) >> 14) * inttoworld; n.X = (((sop->vel) >> 8) * locktics * bcos(sop->int_i_ang_moving()) >> 14) * inttoworld;
n.Y = (((sop->vel) >> 8) * locktics * bsin(sop->__i_ang_moving) >> 14) * inttoworld; n.Y = (((sop->vel) >> 8) * locktics * bsin(sop->int_i_ang_moving()) >> 14) * inttoworld;
sop->target_dist -= n.Length(); sop->target_dist -= n.Length();
return n; return n;
@ -2598,7 +2598,7 @@ void TornadoSpin(SECTOR_OBJECT* sop)
short locktics = synctics; short locktics = synctics;
// get delta to target angle // get delta to target angle
delta_ang = getincangle(sop->int_i_ang(), sop->__i_ang_tgt); delta_ang = getincangle(sop->int_i_ang(), sop->int_i_ang_tgt());
sop->__i_ang = NORM_ANGLE(sop->int_i_ang() + (delta_ang >> sop->turn_speed)); sop->__i_ang = NORM_ANGLE(sop->int_i_ang() + (delta_ang >> sop->turn_speed));
delta_ang = delta_ang >> sop->turn_speed; delta_ang = delta_ang >> sop->turn_speed;
@ -2607,11 +2607,11 @@ void TornadoSpin(SECTOR_OBJECT* sop)
MoveZ(sop); MoveZ(sop);
// calculate the spin speed // calculate the spin speed
speed = sop->__i_spin_speed * locktics; speed = sop->int_i_spin_speed() * locktics;
// spin_ang is incremented by the spin_speed // spin_ang is incremented by the spin_speed
sop->__i_spin_ang = NORM_ANGLE(sop->__i_spin_ang + speed); sop->__i_spin_ang = NORM_ANGLE(sop->int_i_spin_ang() + speed);
if (sop->__i_spin_speed) if (sop->int_i_spin_speed())
{ {
// ignore delta angle if spinning // ignore delta angle if spinning
GlobSpeedSO = DAngle::fromBuild(speed); GlobSpeedSO = DAngle::fromBuild(speed);
@ -2720,7 +2720,7 @@ void DoAutoTurretObject(SECTOR_OBJECT* sop)
sop->__i_ang_tgt = getangle(actor->user.targetActor->spr.pos - sop->pmid); sop->__i_ang_tgt = getangle(actor->user.targetActor->spr.pos - sop->pmid);
// get delta to target angle // get delta to target angle
delta_ang = getincangle(sop->int_i_ang(), sop->__i_ang_tgt); delta_ang = getincangle(sop->int_i_ang(), sop->int_i_ang_tgt());
//sop->__i_ang += delta_ang >> 4; //sop->__i_ang += delta_ang >> 4;
sop->__i_ang = NORM_ANGLE(sop->int_i_ang() + (delta_ang >> 3)); sop->__i_ang = NORM_ANGLE(sop->int_i_ang() + (delta_ang >> 3));