From a728555ec72cb361d0d8631d40f470ee1450627c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 2 Nov 2021 21:48:11 +0100 Subject: [PATCH] - skel.cpp --- source/games/sw/src/skel.cpp | 25 ++++++++----------------- source/games/sw/src/sprite.cpp | 4 ++-- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/source/games/sw/src/skel.cpp b/source/games/sw/src/skel.cpp index b1ae1006e..92c54eb2f 100644 --- a/source/games/sw/src/skel.cpp +++ b/source/games/sw/src/skel.cpp @@ -500,22 +500,20 @@ ACTOR_ACTION_SET SkelActionSet = nullptr }; -int -SetupSkel(short SpriteNum) +int SetupSkel(DSWActor* actor) { - auto actor = &swActors[SpriteNum]; - SPRITEp sp = &sprite[SpriteNum]; + SPRITEp sp = &actor->s(); USERp u; ANIMATOR DoActorDecide; if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum].Data(); + u = actor->u(); ASSERT(u); } else { - u = SpawnUser(SpriteNum,SKEL_RUN_R0,s_SkelRun[0]); + u = SpawnUser(actor,SKEL_RUN_R0,s_SkelRun[0]); u->Health = HEALTH_SKEL_PRIEST; } @@ -537,8 +535,7 @@ SetupSkel(short SpriteNum) int DoSkelInitTeleport(DSWActor* actor) { USER* u = actor->u(); - int SpriteNum = u->SpriteNum; - SPRITEp sp = &sprite[SpriteNum]; + SPRITEp sp = &actor->s(); RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); @@ -550,8 +547,7 @@ int DoSkelInitTeleport(DSWActor* actor) int DoSkelTeleport(DSWActor* actor) { USER* u = actor->u(); - int SpriteNum = u->SpriteNum; - SPRITEp sp = &sprite[SpriteNum]; + SPRITEp sp = &actor->s(); int x,y; x = sp->x; @@ -572,8 +568,7 @@ int DoSkelTeleport(DSWActor* actor) else sp->y -= 512 + RANDOM_P2(1024); - setspritez(SpriteNum, &sp->pos); - //updatesector(sp->x, sp->y, &sp->sectnum); + SetActorZ(actor, &sp->pos); if (sp->sectnum != -1) break; @@ -585,8 +580,7 @@ int DoSkelTeleport(DSWActor* actor) int DoSkelTermTeleport(DSWActor* actor) { USER* u = actor->u(); - int SpriteNum = u->SpriteNum; - SPRITEp sp = &sprite[SpriteNum]; + SPRITEp sp = &actor->s(); SET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); @@ -596,7 +590,6 @@ int DoSkelTermTeleport(DSWActor* actor) int NullSkel(DSWActor* actor) { USER* u = actor->u(); - int SpriteNum = u->SpriteNum; if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(actor); @@ -609,7 +602,6 @@ int NullSkel(DSWActor* actor) int DoSkelPain(DSWActor* actor) { USER* u = actor->u(); - int SpriteNum = u->SpriteNum; NullSkel(actor); @@ -622,7 +614,6 @@ int DoSkelPain(DSWActor* actor) int DoSkelMove(DSWActor* actor) { USER* u = actor->u(); - int SpriteNum = u->SpriteNum; if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(actor); diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index bf8b785f3..723ad2a06 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -72,7 +72,7 @@ int SetupRipper(DSWActor*); int SetupRipper2(DSWActor*); int SetupSerp(DSWActor*); int SetupLava(DSWActor* actor); -int SetupSkel(short); +int SetupSkel(DSWActor*); int SetupHornet(DSWActor*); int SetupSkull(short); int SetupBetty(short); @@ -1489,7 +1489,7 @@ ActorSpawn(SPRITEp sp) } PicAnimOff(sp->picnum); - SetupSkel(SpriteNum); + SetupSkel(actor); break; }