- migrated several move_sprite calls

This commit is contained in:
Christoph Oelckers 2022-08-31 00:47:02 +02:00
parent 2838fa3e72
commit 55eb824e7d
7 changed files with 19 additions and 37 deletions

View file

@ -371,9 +371,7 @@ int DoActorSectorDamage(DSWActor* actor)
bool move_debris(DSWActor* actor, const DVector2& change) bool move_debris(DSWActor* actor, const DVector2& change)
{ {
actor->user.coll = move_sprite(actor, change.X * worldtoint, change.Y * worldtoint, 0, actor->user.coll = move_sprite(actor, DVector3(change, 0), actor->user.ceiling_dist, actor->user.floor_dist, 0, ACTORMOVETICS);
actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), 0, ACTORMOVETICS);
return actor->user.coll.type == kHitNone; return actor->user.coll.type == kHitNone;
} }

View file

@ -1298,7 +1298,6 @@ int DoActorMoveJump(DSWActor* actor)
Collision move_scan(DSWActor* actor, int ang, int dist, int *stopx, int *stopy, int *stopz) Collision move_scan(DSWActor* actor, int ang, int dist, int *stopx, int *stopy, int *stopz)
{ {
int nx,ny;
uint32_t cliptype = CLIPMASK_ACTOR; uint32_t cliptype = CLIPMASK_ACTOR;
DSWActor* highActor; DSWActor* highActor;
@ -1321,10 +1320,9 @@ Collision move_scan(DSWActor* actor, int ang, int dist, int *stopx, int *stopy,
// do the move // do the move
actor->set_int_ang(ang); actor->set_int_ang(ang);
nx = MulScale(dist, bcos(actor->int_ang()), 14); auto vec = actor->spr.angle.ToVector() * dist * inttoworld;
ny = MulScale(dist, bsin(actor->int_ang()), 14);
Collision ret = move_sprite(actor, nx, ny, 0, actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), cliptype, 1); Collision ret = move_sprite(actor, DVector3(vec, 0), actor->user.ceiling_dist, actor->user.floor_dist, cliptype, 1);
// move_sprite DOES do a getzrange point? // move_sprite DOES do a getzrange point?
// should I look down with a FAFgetzrange to see where I am? // should I look down with a FAFgetzrange to see where I am?

View file

@ -830,17 +830,16 @@ int PickBunnyJumpSpeed(DSWActor* actor, int pix_height)
int DoBunnyBeginJumpAttack(DSWActor* actor) int DoBunnyBeginJumpAttack(DSWActor* actor)
{ {
DSWActor* target = actor->user.targetActor; DSWActor* target = actor->user.targetActor;
int tang;
tang = getangle(target->spr.pos - actor->spr.pos); DAngle tang = VecToAngle(target->spr.pos - actor->spr.pos);
Collision coll = move_sprite(actor, bcos(tang, -7), bsin(tang, -7), Collision coll = move_sprite(actor, DVector3(tang.ToVector() * 8, 0), actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_ACTOR, ACTORMOVETICS);
0L, actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), CLIPMASK_ACTOR, ACTORMOVETICS);
auto rndang = DAngle::fromBuild(RANDOM_NEG(256, 6) >> 6);
if (coll.type != kHitNone) if (coll.type != kHitNone)
actor->set_int_ang(NORM_ANGLE(actor->int_ang() + 1024) + (RANDOM_NEG(256, 6) >> 6)); actor->spr.angle += DAngle180 + rndang;
else else
actor->set_int_ang(NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6))); actor->spr.angle = tang + rndang;
DoActorSetSpeed(actor, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);

View file

@ -741,8 +741,6 @@ int DoCoolgCircle(DSWActor* actor)
int DoCoolgDeath(DSWActor* actor) int DoCoolgDeath(DSWActor* actor)
{ {
int nx, ny;
actor->spr.cstat &= ~(CSTAT_SPRITE_TRANSLUCENT); actor->spr.cstat &= ~(CSTAT_SPRITE_TRANSLUCENT);
actor->spr.cstat &= ~(CSTAT_SPRITE_INVISIBLE); actor->spr.cstat &= ~(CSTAT_SPRITE_INVISIBLE);
actor->spr.xrepeat = 42; actor->spr.xrepeat = 42;
@ -763,10 +761,9 @@ int DoCoolgDeath(DSWActor* actor)
DoActorSlide(actor); DoActorSlide(actor);
// slide while falling // slide while falling
nx = MulScale(actor->spr.xvel, bcos(actor->int_ang()), 14); auto vec = actor->spr.angle.ToVector() * actor->spr.xvel * inttoworld;
ny = MulScale(actor->spr.xvel, bsin(actor->int_ang()), 14);
actor->user.coll = move_sprite(actor, nx, ny, 0L, actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), CLIPMASK_MISSILE, ACTORMOVETICS); actor->user.coll = move_sprite(actor, DVector3(vec, 0), actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS);
DoFindGroundPoint(actor); DoFindGroundPoint(actor);
// on the ground // on the ground

View file

@ -509,7 +509,6 @@ int DoEelMatchPlayerZ(DSWActor* actor)
int DoEelDeath(DSWActor* actor) int DoEelDeath(DSWActor* actor)
{ {
int nx, ny;
if (actor->user.Flags & (SPR_FALLING)) if (actor->user.Flags & (SPR_FALLING))
{ {
DoFall(actor); DoFall(actor);
@ -525,10 +524,9 @@ int DoEelDeath(DSWActor* actor)
DoActorSlide(actor); DoActorSlide(actor);
// slide while falling // slide while falling
nx = MulScale(actor->spr.xvel, bcos(actor->int_ang()), 14); auto vec = actor->spr.angle.ToVector() * actor->spr.xvel * inttoworld;
ny = MulScale(actor->spr.xvel, bsin(actor->int_ang()), 14);
actor->user.coll = move_sprite(actor, nx, ny, 0L, actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), CLIPMASK_MISSILE, ACTORMOVETICS); actor->user.coll = move_sprite(actor, DVector3(vec, 0), actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS);
DoFindGroundPoint(actor); DoFindGroundPoint(actor);
// on the ground // on the ground

View file

@ -485,8 +485,6 @@ int DoHornetCircle(DSWActor* actor)
int DoHornetDeath(DSWActor* actor) int DoHornetDeath(DSWActor* actor)
{ {
int nx, ny;
if (actor->user.Flags & (SPR_FALLING)) if (actor->user.Flags & (SPR_FALLING))
{ {
actor->user.loz = actor->user.zclip; actor->user.loz = actor->user.zclip;
@ -506,10 +504,9 @@ int DoHornetDeath(DSWActor* actor)
DoActorSlide(actor); DoActorSlide(actor);
// slide while falling // slide while falling
nx = MulScale(actor->spr.xvel, bcos(actor->int_ang()), 14); auto vec = actor->spr.angle.ToVector() * actor->spr.xvel * inttoworld;
ny = MulScale(actor->spr.xvel, bsin(actor->int_ang()), 14);
actor->user.coll = move_sprite(actor, nx, ny, 0L, actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), 1, ACTORMOVETICS); actor->user.coll = move_sprite(actor, DVector3(vec, 0), actor->user.ceiling_dist, actor->user.floor_dist, 1, ACTORMOVETICS);
// on the ground // on the ground
if (actor->spr.pos.Z >= actor->user.loz) if (actor->spr.pos.Z >= actor->user.loz)

View file

@ -3362,7 +3362,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
TRACK_POINT* tpoint; TRACK_POINT* tpoint;
short pnum; short pnum;
int nx = 0, ny = 0, nz = 0; DVector3 vec(0,0,0);
// if not on a track then better not go here // if not on a track then better not go here
if (actor->user.track == -1) if (actor->user.track == -1)
@ -3462,8 +3462,6 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
actor->spr.xvel = (actor->user.track_vel) >> 8; actor->spr.xvel = (actor->user.track_vel) >> 8;
} }
nx = 0;
ny = 0;
if (actor->user.Flags & (SPR_CLIMBING)) if (actor->user.Flags & (SPR_CLIMBING))
{ {
@ -3490,17 +3488,14 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
else else
{ {
// calculate a new x and y // calculate a new x and y
nx = MulScale(actor->spr.xvel, bcos(actor->int_ang()), 14); vec.XY() = actor->spr.angle.ToVector() * actor->spr.xvel * inttoworld;
ny = MulScale(actor->spr.xvel, bsin(actor->int_ang()), 14);
} }
nz = 0;
if (actor->spr.zvel) if (actor->spr.zvel)
nz = actor->spr.zvel * locktics; vec.Z = actor->spr.zvel * locktics * zinttoworld;
} }
actor->user.coll = move_sprite(actor, nx, ny, nz, actor->user.int_ceiling_dist(), actor->user.int_floor_dist(), 0, locktics); actor->user.coll = move_sprite(actor, vec, actor->user.ceiling_dist, actor->user.floor_dist, 0, locktics);
if (actor->user.coll.type != kHitNone) if (actor->user.coll.type != kHitNone)