- floatified all move_actor calls in SW

This commit is contained in:
Christoph Oelckers 2022-09-03 12:01:37 +02:00
parent 96297c95aa
commit 6eb18eb3f6
11 changed files with 17 additions and 85 deletions

View file

@ -435,13 +435,8 @@ int DoActorDebris(DSWActor* actor)
int DoFireFly(DSWActor* actor)
{
int nx, ny;
nx = 4 * ACTORMOVETICS * bcos(actor->int_ang()) >> 14;
ny = 4 * ACTORMOVETICS * bsin(actor->int_ang()) >> 14;
actor->spr.clipdist = 256>>2;
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * (0.25 * ACTORMOVETICS), 0)))
{
actor->spr.angle += DAngle180;
}
@ -590,7 +585,7 @@ int DoActorSlide(DSWActor* actor)
nx = MulScale(actor->user.slide_vel, bcos(actor->user.slide_ang), 14);
ny = MulScale(actor->user.slide_vel, bsin(actor->user.slide_ang), 14);
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(nx * inttoworld, ny * inttoworld, 0)))
{
actor->user.Flags &= ~(SPR_SLIDING);
return false;
@ -763,8 +758,6 @@ int DoActorStopFall(DSWActor* actor)
int DoActorDeathMove(DSWActor* actor)
{
int nx, ny;
if (actor->user.Flags & (SPR_JUMPING | SPR_FALLING))
{
if (actor->user.Flags & (SPR_JUMPING))
@ -773,11 +766,9 @@ int DoActorDeathMove(DSWActor* actor)
DoActorFall(actor);
}
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
actor->spr.clipdist = (128+64)>>2;
move_actor(actor, nx, ny, 0);
move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0));
// only fall on top of floor sprite or sector
DoFindGroundPoint(actor);

View file

@ -803,13 +803,8 @@ int DoActorCantMoveCloser(DSWActor* actor)
int DoActorMoveCloser(DSWActor* actor)
{
int nx, ny;
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
// if cannot move the sprite
if (!move_actor(actor, nx, ny, 0))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
if (ActorMoveHitReact(actor))
return 0;
@ -1278,14 +1273,7 @@ int DoActorDuck(DSWActor* actor)
int DoActorMoveJump(DSWActor* actor)
{
int nx, ny;
// Move while jumping
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
move_actor(actor, nx, ny, 0L);
move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0));
if (!(actor->user.Flags & (SPR_JUMPING|SPR_FALLING)))
{
@ -1588,13 +1576,8 @@ int InitActorReposition(DSWActor* actor)
int DoActorReposition(DSWActor* actor)
{
int nx, ny;
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
// still might hit something and have to handle it.
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
if (ActorMoveHitReact(actor))
return 0;

View file

@ -863,13 +863,7 @@ int DoBunnyMoveJump(DSWActor* actor)
{
if (actor->user.Flags & (SPR_JUMPING | SPR_FALLING))
{
int nx, ny;
// Move while jumping
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
move_actor(actor, nx, ny, 0L);
move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0));
if (actor->user.Flags & (SPR_JUMPING))
DoActorJump(actor);

View file

@ -702,14 +702,10 @@ int InitCoolgCircle(DSWActor* actor)
int DoCoolgCircle(DSWActor* actor)
{
double bound;
int nx,ny;
actor->set_int_ang(NORM_ANGLE(actor->int_ang() + actor->user.Counter2));
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
InitActorReposition(actor);
return 0;

View file

@ -776,14 +776,8 @@ int DoGirlNinjaMove(DSWActor* actor)
int GirlNinjaJumpActionFunc(DSWActor* actor)
{
int nx, ny;
// Move while jumping
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
// if cannot move the sprite
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
return 0;
}

View file

@ -434,25 +434,19 @@ int InitHornetCircle(DSWActor* actor)
int DoHornetCircle(DSWActor* actor)
{
int nx,ny;
double bound;
actor->set_int_ang(NORM_ANGLE(actor->int_ang() + actor->user.Counter2));
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
//ActorMoveHitReact(actor);
// try moving in the opposite direction
actor->user.Counter2 = -actor->user.Counter2;
actor->spr.angle += DAngle180;
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
if (!move_actor(actor, nx, ny, 0))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
InitActorReposition(actor);
return 0;

View file

@ -2033,14 +2033,8 @@ int DoNinjaMove(DSWActor* actor)
int NinjaJumpActionFunc(DSWActor* actor)
{
int nx, ny;
// Move while jumping
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
// if cannot move the sprite
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
return 0;
}

View file

@ -976,14 +976,8 @@ int DoRipperHang(DSWActor* actor)
int DoRipperMoveHang(DSWActor* actor)
{
int nx, ny;
// Move while jumping
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
// if cannot move the sprite
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
if (actor->user.coll.type == kHitWall)
{

View file

@ -990,14 +990,8 @@ int DoRipper2Hang(DSWActor* actor)
int DoRipper2MoveHang(DSWActor* actor)
{
int nx, ny;
// Move while jumping
nx = MulScale(actor->int_xvel(), bcos(actor->int_ang()), 14);
ny = MulScale(actor->int_xvel(), bsin(actor->int_ang()), 14);
// if cannot move the sprite
if (!move_actor(actor, nx, ny, 0L))
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
{
if (actor->user.coll.type == kHitWall)
{

View file

@ -4566,9 +4566,8 @@ bool DropAhead(DSWActor* actor, double min_height)
*/
int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
int move_actor(DSWActor* actor, const DVector3& change)
{
DVector3 change(xchange * inttoworld, ychange * inttoworld, zchange * zinttoworld);
DSWActor* highActor;
DSWActor* lowActor;
sectortype* lo_sectp,* hi_sectp;
@ -4648,7 +4647,6 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
{
return false;
}
}
int DoStayOnFloor(DSWActor* actor)

View file

@ -39,7 +39,7 @@ inline DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, in
}
void SpriteSetup(void);
int move_actor(DSWActor* actor, int xchange, int ychange, int zchange);
int move_actor(DSWActor* actor, const DVector3& change);
short GetSpriteDir(short sn);
short GetDirToPlayer(short sn);
short PlayerInVision(short sn, short view_deg);