- skel.cpp

This commit is contained in:
Christoph Oelckers 2021-11-02 21:48:11 +01:00
parent 07f61e061e
commit a728555ec7
2 changed files with 10 additions and 19 deletions

View file

@ -500,22 +500,20 @@ ACTOR_ACTION_SET SkelActionSet =
nullptr nullptr
}; };
int int SetupSkel(DSWActor* actor)
SetupSkel(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum]; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{ {
u = User[SpriteNum].Data(); u = actor->u();
ASSERT(u); ASSERT(u);
} }
else else
{ {
u = SpawnUser(SpriteNum,SKEL_RUN_R0,s_SkelRun[0]); u = SpawnUser(actor,SKEL_RUN_R0,s_SkelRun[0]);
u->Health = HEALTH_SKEL_PRIEST; u->Health = HEALTH_SKEL_PRIEST;
} }
@ -537,8 +535,7 @@ SetupSkel(short SpriteNum)
int DoSkelInitTeleport(DSWActor* actor) int DoSkelInitTeleport(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int SpriteNum = u->SpriteNum; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[SpriteNum];
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -550,8 +547,7 @@ int DoSkelInitTeleport(DSWActor* actor)
int DoSkelTeleport(DSWActor* actor) int DoSkelTeleport(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int SpriteNum = u->SpriteNum; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[SpriteNum];
int x,y; int x,y;
x = sp->x; x = sp->x;
@ -572,8 +568,7 @@ int DoSkelTeleport(DSWActor* actor)
else else
sp->y -= 512 + RANDOM_P2(1024); sp->y -= 512 + RANDOM_P2(1024);
setspritez(SpriteNum, &sp->pos); SetActorZ(actor, &sp->pos);
//updatesector(sp->x, sp->y, &sp->sectnum);
if (sp->sectnum != -1) if (sp->sectnum != -1)
break; break;
@ -585,8 +580,7 @@ int DoSkelTeleport(DSWActor* actor)
int DoSkelTermTeleport(DSWActor* actor) int DoSkelTermTeleport(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int SpriteNum = u->SpriteNum; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[SpriteNum];
SET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); SET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -596,7 +590,6 @@ int DoSkelTermTeleport(DSWActor* actor)
int NullSkel(DSWActor* actor) int NullSkel(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING)) if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(actor); DoActorSlide(actor);
@ -609,7 +602,6 @@ int NullSkel(DSWActor* actor)
int DoSkelPain(DSWActor* actor) int DoSkelPain(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullSkel(actor); NullSkel(actor);
@ -622,7 +614,6 @@ int DoSkelPain(DSWActor* actor)
int DoSkelMove(DSWActor* actor) int DoSkelMove(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING)) if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(actor); DoActorSlide(actor);

View file

@ -72,7 +72,7 @@ int SetupRipper(DSWActor*);
int SetupRipper2(DSWActor*); int SetupRipper2(DSWActor*);
int SetupSerp(DSWActor*); int SetupSerp(DSWActor*);
int SetupLava(DSWActor* actor); int SetupLava(DSWActor* actor);
int SetupSkel(short); int SetupSkel(DSWActor*);
int SetupHornet(DSWActor*); int SetupHornet(DSWActor*);
int SetupSkull(short); int SetupSkull(short);
int SetupBetty(short); int SetupBetty(short);
@ -1489,7 +1489,7 @@ ActorSpawn(SPRITEp sp)
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
SetupSkel(SpriteNum); SetupSkel(actor);
break; break;
} }