- floatified some angles.

This commit is contained in:
Christoph Oelckers 2022-09-01 19:28:33 +02:00
parent c443d9ecb7
commit 491b6eb08c
6 changed files with 18 additions and 18 deletions

View file

@ -1054,7 +1054,7 @@ struct USER
int16_t wait_active_check; // for enemy checking of player
int16_t inactive_time; // length of time actor has been unaware of his tgt
int16_t sang;
DAngle sang;
uint8_t spal; // save off default palette number
Collision coll; // same thing broken up into useful components.
@ -1073,7 +1073,7 @@ struct USER
int16_t Vis; // Shading upgrade, for shooting, etc...
bool DidAlert; // Has actor done his alert noise before?
int16_t oangdiff; // Used for interpolating sprite angles
DAngle oangdiff; // Used for interpolating sprite angles
uint8_t filler;
};

View file

@ -60,7 +60,7 @@ static struct so_interp
double bakipos;
double lastipos;
double lastoldipos;
double lastangdiff;
DAngle lastangdiff;
TObjPtr<DSWActor*> actorofang;
} data[SO_MAXINTERPOLATIONS];
@ -209,7 +209,7 @@ static void so_setspriteanginterpolation(so_interp *interp, DSWActor* actor)
data->oldipos =
data->lastipos =
data->lastoldipos = actor->int_ang();
data->lastangdiff = 0;
data->lastangdiff = nullAngle;
data->actorofang = actor;
}
@ -333,9 +333,9 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings
if (actorofang)
{
if (actorofang->hasU())
actorofang->user.oangdiff = 0;
actorofang->user.oangdiff = nullAngle;
if (!interpolating)
data->lastangdiff = 0;
data->lastangdiff = nullAngle;
data->oldipos = actorofang->int_ang();
}
}
@ -390,7 +390,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
auto actorofang = data->actorofang;
if (actorofang)
{
data->lastangdiff = actorofang->hasU() ? actorofang->user.oangdiff : 0;
data->lastangdiff = actorofang->hasU() ? actorofang->user.oangdiff : nullAngle;
}
}
}
@ -443,7 +443,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
{
DSWActor* actor = data->actorofang;
if (!actor) continue;
actor->set_int_ang(NORM_ANGLE(data->lastoldipos + MulScale(data->lastangdiff, ratio, 16)));
actor->set_int_ang(NORM_ANGLE(data->lastoldipos + MulScale(data->lastangdiff.Buildang(), ratio, 16)));
}
else
{
@ -508,7 +508,7 @@ void so_serializeinterpolations(FSerializer& arc)
if (arc.isReading())
{
data->lastipos = data->lastoldipos = data->oldipos;
data->lastangdiff = 0;
data->lastangdiff = nullAngle;
}
}
}

View file

@ -855,7 +855,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def
if (arc.isReading())
{
w.oangdiff = 0;
w.oangdiff = nullAngle;
}
}
return arc;

View file

@ -838,7 +838,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop)
itActor->user.Flags |= (SPR_SO_ATTACHED);
itActor->user.sang = itActor->int_ang();
itActor->user.sang = itActor->spr.angle;
itActor->user.spal = itActor->spr.pal;
// search SO's sectors to make sure that it is not on a
@ -1673,8 +1673,8 @@ PlayerPart:
}
}
int16_t oldang = actor->int_ang();
actor->set_int_ang(actor->user.sang);
auto oldang = actor->spr.angle;
actor->spr.angle = actor->user.sang;
if (actor->user.Flags & (SPR_ON_SO_SECTOR))
{
@ -1714,7 +1714,7 @@ PlayerPart:
SetActorZ(sop->so_actors[i], actor->spr.pos);
}
actor->user.oangdiff += getincangle(oldang, actor->int_ang());
actor->user.oangdiff += ::deltaangle(oldang, actor->spr.angle);
if ((actor->spr.extra & SPRX_BLADE))
{

View file

@ -59,10 +59,10 @@ void SOwallmove(SECTOR_OBJECT* sop, DSWActor* actor, walltype* find_wallp, int d
if (&wal == find_wallp)
{
// move orig x and y in saved angle
int ang = actor->user.sang;
auto ang = actor->user.sang;
*nx = MulScale(dist, bcos(ang), 14);
*ny = MulScale(dist, bsin(ang), 14);
*nx = dist * ang.Cos();
*ny = dist * ang.Sin();
sop->xorig[wallcount] -= *nx;
sop->yorig[wallcount] -= *ny;

View file

@ -10070,7 +10070,7 @@ void AddSpriteToSectorObject(DSWActor* actor, SECTOR_OBJECT* sop)
actor->user.pos.XY() = sop->pmid.XY() - actor->spr.pos.XY();
actor->user.pos.Z = sop->mid_sector->floorz - actor->spr.pos.Z;
actor->user.sang = actor->int_ang();
actor->user.sang = actor->spr.angle;
}
void SpawnBigGunFlames(DSWActor* actor, DSWActor* Operator, SECTOR_OBJECT* sop, bool smallflames)