- floatified sectortype::ang

This commit is contained in:
Christoph Oelckers 2022-08-31 00:46:45 +02:00
parent ce7533c1c4
commit 2838fa3e72
6 changed files with 13 additions and 13 deletions

View file

@ -329,7 +329,7 @@ struct sectortype
int flags; int flags;
int depth_fixed; int depth_fixed;
short stag; // ST? tag number - for certain things it helps to know it short stag; // ST? tag number - for certain things it helps to know it
short ang; DAngle angle;
short height; short height;
short speed; short speed;
short damage; short damage;

View file

@ -590,7 +590,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
arc("flags", c.flags, def->flags) arc("flags", c.flags, def->flags)
("depth_fixed", c.depth_fixed, def->depth_fixed) ("depth_fixed", c.depth_fixed, def->depth_fixed)
("stag", c.stag, def->stag) ("stag", c.stag, def->stag)
("ang", c.ang, def->ang) ("ang", c.angle, def->angle)
("height", c.height, def->height) ("height", c.height, def->height)
("speed", c.speed, def->speed) ("speed", c.speed, def->speed)
("damage", c.damage, def->damage) ("damage", c.damage, def->damage)

View file

@ -287,21 +287,20 @@ void DoDebrisCurrent(DSWActor* actor)
auto sectp = actor->sector(); auto sectp = actor->sector();
//actor->spr.clipdist = (256+128)>>2; //actor->spr.clipdist = (256+128)>>2;
double spd = sectp->speed / 64.0;
nx = MulScale((sectp->speed >> 2), bcos(sectp->ang), 14); auto vect = sectp->angle.ToVector() * spd;
ny = MulScale((sectp->speed >> 2), bsin(sectp->ang), 14);
Collision ret = move_sprite(actor, nx, ny, 0, actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), 0, ACTORMOVETICS); Collision ret = move_sprite(actor, DVector3(vect, 0), actor->user.ceiling_dist, actor->user.floor_dist, 0, ACTORMOVETICS);
// attempt to move away from wall // attempt to move away from wall
if (ret.type != kHitNone) if (ret.type != kHitNone)
{ {
int rang = RANDOM_P2(2048); DAngle rang = RANDOM_ANGLE();
nx = MulScale((sectp->speed >> 2), bcos(sectp->ang + rang), 14); vect = (sectp->angle + rang).ToVector() * spd;
nx = MulScale((sectp->speed >> 2), bsin(sectp->ang + rang), 14);
move_sprite(actor, nx, ny, 0, actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), 0, ACTORMOVETICS); move_sprite(actor, DVector3(vect, 0), actor->user.ceiling_dist, actor->user.floor_dist, 0, ACTORMOVETICS);
} }
actor->spr.pos.Z = actor->user.loz; actor->spr.pos.Z = actor->user.loz;

View file

@ -197,7 +197,7 @@ void CopySectorMatch(int match)
dsectp->flags = ssectp->flags; dsectp->flags = ssectp->flags;
dsectp->depth_fixed = ssectp->depth_fixed; dsectp->depth_fixed = ssectp->depth_fixed;
dsectp->stag = ssectp->stag; dsectp->stag = ssectp->stag;
dsectp->ang = ssectp->ang; dsectp->angle = ssectp->angle;
dsectp->height = ssectp->height; dsectp->height = ssectp->height;
dsectp->speed = ssectp->speed; dsectp->speed = ssectp->speed;
dsectp->damage = ssectp->damage; dsectp->damage = ssectp->damage;

View file

@ -4492,8 +4492,9 @@ void DoPlayerCurrent(PLAYER* pp)
if (!sectu) if (!sectu)
return; return;
xvect = sectu->speed * synctics * bcos(sectu->ang) >> 4; auto vect = sectu->angle.ToVector() * 1024; // 16384 >> 4 - Beware of clipmove's odd format for vect!
yvect = sectu->speed * synctics * bsin(sectu->ang) >> 4; xvect = sectu->speed * synctics * vect.X;
yvect = sectu->speed * synctics * vect.Y;
push_ret = pushmove(pp->pos, &pp->cursector, ((int)pp->actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER); push_ret = pushmove(pp->pos, &pp->cursector, ((int)pp->actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0) if (push_ret < 0)

View file

@ -1736,7 +1736,7 @@ void SpriteSetup(void)
{ {
sectp->u_defined = true; sectp->u_defined = true;
sectp->speed = actor->spr.lotag; sectp->speed = actor->spr.lotag;
sectp->ang = actor->int_ang(); sectp->angle = actor->spr.angle;
KillActor(actor); KillActor(actor);
} }
else if (bit & (SECTFX_NO_RIDE)) else if (bit & (SECTFX_NO_RIDE))