- move_actor

This commit is contained in:
Christoph Oelckers 2021-10-30 23:03:26 +02:00
parent 5062dc6aa8
commit fdcff8002d
11 changed files with 19 additions and 19 deletions

View file

@ -475,7 +475,7 @@ int DoFireFly(DSWActor* actor)
ny = 4 * ACTORMOVETICS * bsin(sp->ang) >> 14; ny = 4 * ACTORMOVETICS * bsin(sp->ang) >> 14;
sp->clipdist = 256>>2; sp->clipdist = 256>>2;
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
sp->ang = NORM_ANGLE(sp->ang + 1024); sp->ang = NORM_ANGLE(sp->ang + 1024);
} }
@ -634,7 +634,7 @@ int DoActorSlide(DSWActor* actor)
nx = MulScale(u->slide_vel, bcos(u->slide_ang), 14); nx = MulScale(u->slide_vel, bcos(u->slide_ang), 14);
ny = MulScale(u->slide_vel, bsin(u->slide_ang), 14); ny = MulScale(u->slide_vel, bsin(u->slide_ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
RESET(u->Flags, SPR_SLIDING); RESET(u->Flags, SPR_SLIDING);
return false; return false;
@ -849,7 +849,7 @@ int DoActorDeathMove(DSWActor* actor)
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
sp->clipdist = (128+64)>>2; sp->clipdist = (128+64)>>2;
move_actor(SpriteNum, nx, ny, 0); move_actor(actor, nx, ny, 0);
// only fall on top of floor sprite or sector // only fall on top of floor sprite or sector
DoFindGroundPoint(SpriteNum); DoFindGroundPoint(SpriteNum);

View file

@ -1020,7 +1020,7 @@ int DoActorMoveCloser(DSWActor* actor)
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite // if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
DebugMoveHit(actor); DebugMoveHit(actor);
@ -1597,7 +1597,7 @@ int DoActorMoveJump(DSWActor* actor)
nx = MulScale(sp->xvel, bcos(sp->ang), 14); nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
move_actor(SpriteNum, nx, ny, 0L); move_actor(actor, nx, ny, 0L);
if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING)) if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
{ {
@ -1932,7 +1932,7 @@ int DoActorReposition(DSWActor* actor)
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// still might hit something and have to handle it. // still might hit something and have to handle it.
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
if (ActorMoveHitReact(actor)) if (ActorMoveHitReact(actor))
return 0; return 0;

View file

@ -900,7 +900,7 @@ DoBunnyMoveJump(DSWActor* actor)
nx = MulScale(sp->xvel, bcos(sp->ang), 14); nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
move_actor(u->SpriteNum, nx, ny, 0L); move_actor(actor, nx, ny, 0L);
if (TEST(u->Flags, SPR_JUMPING)) if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(actor); DoActorJump(actor);

View file

@ -743,7 +743,7 @@ int DoCoolgCircle(DSWActor* actor)
nx = MulScale(sp->xvel, bcos(sp->ang), 14); nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
InitActorReposition(actor); InitActorReposition(actor);
return 0; return 0;

View file

@ -802,7 +802,7 @@ GirlNinjaJumpActionFunc(DSWActor* actor)
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite // if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
return 0; return 0;
} }

View file

@ -468,7 +468,7 @@ int DoHornetCircle(DSWActor* actor)
nx = MulScale(sp->xvel, bcos(sp->ang), 14); nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
//ActorMoveHitReact(actor); //ActorMoveHitReact(actor);
@ -478,7 +478,7 @@ int DoHornetCircle(DSWActor* actor)
nx = MulScale(sp->xvel, bcos(sp->ang), 14); nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
InitActorReposition(actor); InitActorReposition(actor);
return 0; return 0;

View file

@ -2070,7 +2070,7 @@ NinjaJumpActionFunc(DSWActor* actor)
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite // if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
return 0; return 0;
} }

View file

@ -1027,7 +1027,7 @@ DoRipperMoveHang(DSWActor* actor)
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite // if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
switch (TEST(u->ret, HIT_MASK)) switch (TEST(u->ret, HIT_MASK))
{ {

View file

@ -1025,7 +1025,7 @@ DoRipper2MoveHang(DSWActor* actor)
ny = MulScale(sp->xvel, bsin(sp->ang), 14); ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite // if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L)) if (!move_actor(actor, nx, ny, 0L))
{ {
switch (TEST(u->ret, HIT_MASK)) switch (TEST(u->ret, HIT_MASK))
{ {

View file

@ -5093,11 +5093,11 @@ DropAhead(short SpriteNum, short min_height)
*/ */
int int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
move_actor(short SpriteNum, int xchange, int ychange, int zchange)
{ {
USERp u = User[SpriteNum].Data(); USER* u = actor->u();
SPRITEp sp = User[SpriteNum]->SpriteP; int SpriteNum = u->SpriteNum;
SPRITEp sp = &actor->s();
int x, y, z, loz, hiz; int x, y, z, loz, hiz;
SPRITEp lo_sp, hi_sp; SPRITEp lo_sp, hi_sp;

View file

@ -35,7 +35,7 @@ void KillActor(DSWActor* actor);
int16_t SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel); int16_t SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel);
DSWActor* SpawnActor(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel); DSWActor* SpawnActor(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel);
void SpriteSetup(void); void SpriteSetup(void);
int move_actor(short SpriteNum, int xchange, int ychange, int zchange); int move_actor(DSWActor* actor, int xchange, int ychange, int zchange);
short GetSpriteDir(short sn); short GetSpriteDir(short sn);
short GetDirToPlayer(short sn); short GetDirToPlayer(short sn);
short PlayerInVision(short sn, short view_deg); short PlayerInVision(short sn, short view_deg);