From 3dbd0023193625752841c732069a8d2fee23ca96 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 30 Oct 2021 12:09:34 +0200 Subject: [PATCH] - DoActorSetSpeed + ActorFlaming. --- source/games/sw/src/ai.cpp | 48 ++++++++++++++++---------------- source/games/sw/src/ai.h | 4 +-- source/games/sw/src/bunny.cpp | 11 ++++---- source/games/sw/src/coolg.cpp | 8 ++++-- source/games/sw/src/coolie.cpp | 5 ++-- source/games/sw/src/eel.cpp | 3 +- source/games/sw/src/girlninj.cpp | 3 +- source/games/sw/src/goro.cpp | 3 +- source/games/sw/src/hornet.cpp | 5 ++-- source/games/sw/src/lava.cpp | 3 +- source/games/sw/src/ninja.cpp | 3 +- source/games/sw/src/ripper.cpp | 9 +++--- source/games/sw/src/ripper2.cpp | 11 ++++---- source/games/sw/src/serp.cpp | 3 +- source/games/sw/src/skel.cpp | 3 +- source/games/sw/src/skull.cpp | 6 ++-- source/games/sw/src/sumo.cpp | 3 +- source/games/sw/src/track.cpp | 7 +++-- source/games/sw/src/weapon.cpp | 3 +- source/games/sw/src/zilla.cpp | 3 +- source/games/sw/src/zombie.cpp | 3 +- 21 files changed, 83 insertions(+), 64 deletions(-) diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index 142826db5..c6f81fc86 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -138,10 +138,10 @@ bool ActorMoveHitReact(DSWActor* actor) } -bool ActorFlaming(short SpriteNum) +bool ActorFlaming(DSWActor* actor) { - USERp u = User[SpriteNum].Data(); - SPRITEp sp = User[SpriteNum]->SpriteP; + USERp u = actor->u(); + SPRITEp sp = &actor->s(); if (u->flame >= 0) { @@ -151,7 +151,6 @@ bool ActorFlaming(short SpriteNum) size = SPRITEp_SIZE_Z(sp) - DIV4(SPRITEp_SIZE_Z(sp)); //DSPRINTF(ds,"enemy size %d, flame size %d",size>>8,SPRITEp_SIZE_Z(fp)>>8); - MONO_PRINT(ds); if (SPRITEp_SIZE_Z(fp) > size) return true; @@ -160,11 +159,10 @@ bool ActorFlaming(short SpriteNum) return false; } -void -DoActorSetSpeed(short SpriteNum, uint8_t speed) +void DoActorSetSpeed(DSWActor* actor, uint8_t speed) { - USERp u = User[SpriteNum].Data(); - SPRITEp sp = User[SpriteNum]->SpriteP; + USERp u = actor->u(); + SPRITEp sp = &actor->s(); if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) return; @@ -173,7 +171,7 @@ DoActorSetSpeed(short SpriteNum, uint8_t speed) u->speed = speed; - if (ActorFlaming(SpriteNum)) + if (ActorFlaming(actor)) sp->xvel = u->Attrib->Speed[speed] + DIV2(u->Attrib->Speed[speed]); else sp->xvel = u->Attrib->Speed[speed]; @@ -611,8 +609,9 @@ DECISION GenericFlaming[] = ANIMATORp DoActorActionDecide(short SpriteNum) { - USERp u = User[SpriteNum].Data(); - SPRITEp sp = User[SpriteNum]->SpriteP; + auto actor = &swActors[SpriteNum]; + USERp u = actor->u(); + SPRITEp sp = &actor->s(); int dist; ANIMATORp action; USERp pu=nullptr; @@ -639,7 +638,7 @@ DoActorActionDecide(short SpriteNum) } // everybody on fire acts like this - if (ActorFlaming(SpriteNum)) + if (ActorFlaming(actor)) { action = ChooseAction(&GenericFlaming[0]); //CON_Message("On Fire"); @@ -1093,7 +1092,7 @@ DoActorCantMoveCloser(DSWActor* actor) { sp->ang = getangle((Track[u->track].TrackPoint + u->point)->x - sp->x, (Track[u->track].TrackPoint + u->point)->y - sp->y); - DoActorSetSpeed(SpriteNum, MID_SPEED); + DoActorSetSpeed(actor, MID_SPEED); SET(u->Flags, SPR_FIND_PLAYER); u->ActorActionFunc = DoActorDecide; @@ -1372,7 +1371,7 @@ InitActorRunAway(DSWActor* actor) if (u->track >= 0) { sp->ang = NORM_ANGLE(getangle((Track[u->track].TrackPoint + u->point)->x - sp->x, (Track[u->track].TrackPoint + u->point)->y - sp->y)); - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); SET(u->Flags, SPR_RUN_AWAY); //MONO_PRINT("Actor running away on track\n"); } @@ -1399,7 +1398,7 @@ InitActorRunToward(DSWActor* actor) NewStateGroup(SpriteNum, u->ActorActionSet->Run); InitActorReposition(actor); - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); return 0; } @@ -1577,7 +1576,7 @@ InitActorEvade(DSWActor* actor) if (u->track >= 0) { sp->ang = NORM_ANGLE(getangle((Track[u->track].TrackPoint + u->point)->x - sp->x, (Track[u->track].TrackPoint + u->point)->y - sp->y)); - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); // NOT doing a RUN_AWAY RESET(u->Flags, SPR_RUN_AWAY); } @@ -1605,7 +1604,7 @@ InitActorWanderAround(DSWActor* actor) if (u->track >= 0) { sp->ang = getangle((Track[u->track].TrackPoint + u->point)->x - sp->x, (Track[u->track].TrackPoint + u->point)->y - sp->y); - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); } return 0; @@ -1630,7 +1629,7 @@ InitActorFindPlayer(DSWActor* actor) if (u->track >= 0) { sp->ang = getangle((Track[u->track].TrackPoint + u->point)->x - sp->x, (Track[u->track].TrackPoint + u->point)->y - sp->y); - DoActorSetSpeed(SpriteNum, MID_SPEED); + DoActorSetSpeed(actor, MID_SPEED); SET(u->Flags, SPR_FIND_PLAYER); u->ActorActionFunc = DoActorDecide; @@ -1791,8 +1790,9 @@ int move_scan(short SpriteNum, short ang, int dist, int *stopx, int *stopy, int int FindNewAngle(short SpriteNum, signed char dir, int DistToMove) { - USERp u = User[SpriteNum].Data(); - SPRITEp sp = User[SpriteNum]->SpriteP; + auto actor = &swActors[SpriteNum]; + USERp u = actor->u(); + SPRITEp sp = &actor->s(); static short toward_angle_delta[4][9] = { @@ -1824,7 +1824,7 @@ FindNewAngle(short SpriteNum, signed char dir, int DistToMove) int save_dist = 500; // if on fire, run shorter distances - if (ActorFlaming(SpriteNum)) + if (ActorFlaming(actor)) DistToMove = DIV4(DistToMove) + DIV8(DistToMove); // Find angle to from the player @@ -1992,7 +1992,7 @@ InitActorReposition(DSWActor* actor) } sp->ang = ang; - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); RESET(u->Flags, SPR_RUN_AWAY); } else @@ -2016,9 +2016,9 @@ InitActorReposition(DSWActor* actor) { // pick random speed to move toward the player if (RANDOM_P2(1024) < 512) - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); else - DoActorSetSpeed(SpriteNum, MID_SPEED); + DoActorSetSpeed(actor, MID_SPEED); } sp->ang = ang; diff --git a/source/games/sw/src/ai.h b/source/games/sw/src/ai.h index fed5cd10f..8f02815f6 100644 --- a/source/games/sw/src/ai.h +++ b/source/games/sw/src/ai.h @@ -72,8 +72,6 @@ extern ATTRIBUTE DefaultAttrib; // AI.C functions void DebugMoveHit(DSWActor* actor); bool ActorMoveHitReact(DSWActor* actor); -bool ActorFlaming(short SpriteNum); -void DoActorSetSpeed(short SpriteNum,uint8_t speed); short ChooseActionNumber(short decision[]); int DoActorNoise(ANIMATORp Action,short SpriteNum); bool CanSeePlayer(short SpriteNum); @@ -162,7 +160,7 @@ DoActorExtra5Noise, DoActorExtra6Noise; */ -void DoActorSetSpeed(short SpriteNum, uint8_t speed); +void DoActorSetSpeed(DSWActor* actor, uint8_t speed); END_SW_NS diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index cb212184f..d964decd7 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -725,13 +725,14 @@ ACTOR_ACTION_SET BunnyWhiteActionSet = int SetupBunny(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum].Data(); + u = actor->u(); ASSERT(u); } else @@ -792,7 +793,7 @@ SetupBunny(short SpriteNum) //sp->shade = 0; // darker } - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); SET(u->Flags, SPR_XFLIP_TOGGLE); @@ -866,7 +867,7 @@ DoBunnyBeginJumpAttack(DSWActor* actor) else sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6)); - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); //u->jump_speed = -800; PickJumpMaxSpeed(SpriteNum, -400); // was -800 @@ -1233,7 +1234,7 @@ void BunnyHatch(short Weapon) NewStateGroup(New, nu->ActorActionSet->Jump); nu->ActorActionFunc = DoActorMoveJump; - DoActorSetSpeed(New, FAST_SPEED); + DoActorSetSpeed(actorNew, FAST_SPEED); PickJumpMaxSpeed(New, -600); SET(nu->Flags, SPR_JUMPING); @@ -1291,7 +1292,7 @@ int BunnyHatch2(short Weapon) NewStateGroup(New, nu->ActorActionSet->Jump); nu->ActorActionFunc = DoActorMoveJump; - DoActorSetSpeed(New, FAST_SPEED); + DoActorSetSpeed(actorNew, FAST_SPEED); if (TEST_BOOL3(wp)) { PickJumpMaxSpeed(New, -600-RandomRange(600)); diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index c82b218cd..c41cef6c9 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -500,6 +500,7 @@ int DoCoolgMatchPlayerZ(short SpriteNum); void CoolgCommon(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum].Data(); @@ -518,6 +519,7 @@ CoolgCommon(short SpriteNum) int SetupCoolg(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -535,7 +537,7 @@ SetupCoolg(short SpriteNum) ChangeState(SpriteNum, s_CoolgRun[0]); u->Attrib = &CoolgAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_CoolgDie; u->Rot = sg_CoolgRun; @@ -593,7 +595,7 @@ DoCoolgBirth(DSWActor* actor) u->Health = HEALTH_COOLIE_GHOST; u->Attrib = &CoolgAttrib; - DoActorSetSpeed(New, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); ChangeState(New, s_CoolgRun[0]); u->StateEnd = s_CoolgDie; @@ -720,7 +722,7 @@ int InitCoolgCircle(DSWActor* actor) NewStateGroup(SpriteNum, u->ActorActionSet->Run); // set it close - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); // set to really fast sp->xvel = 400; diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index cbb865d10..b9fb3088e 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -525,6 +525,7 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso int SetupCoolie(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -542,7 +543,7 @@ SetupCoolie(short SpriteNum) ChangeState(SpriteNum,s_CoolieRun[0]); u->Attrib = &CoolieAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_CoolieDie; u->Rot = sg_CoolieRun; @@ -652,7 +653,7 @@ int InitCoolieCharge(DSWActor* actor) if (RANDOM_P2(1024) > 950) PlaySound(DIGI_COOLIESCREAM, sp, v3df_follow); - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); InitActorMoveCloser(actor); diff --git a/source/games/sw/src/eel.cpp b/source/games/sw/src/eel.cpp index 54943c2f9..f83e91829 100644 --- a/source/games/sw/src/eel.cpp +++ b/source/games/sw/src/eel.cpp @@ -378,6 +378,7 @@ EelCommon(short SpriteNum) int SetupEel(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -395,7 +396,7 @@ SetupEel(short SpriteNum) ChangeState(SpriteNum, s_EelRun[0]); u->Attrib = &EelAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_EelDie; u->Rot = sg_EelRun; diff --git a/source/games/sw/src/girlninj.cpp b/source/games/sw/src/girlninj.cpp index 4bc049ba7..c7693eae6 100644 --- a/source/games/sw/src/girlninj.cpp +++ b/source/games/sw/src/girlninj.cpp @@ -715,6 +715,7 @@ ACTOR_ACTION_SET GirlNinjaActionSet = int SetupGirlNinja(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -740,7 +741,7 @@ SetupGirlNinja(short SpriteNum) EnemyDefaults(SpriteNum, &GirlNinjaActionSet, &GirlNinjaPersonality); ChangeState(SpriteNum, s_GirlNinjaRun[0]); - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->Radius = 280; RESET(u->Flags, SPR_XFLIP_TOGGLE); diff --git a/source/games/sw/src/goro.cpp b/source/games/sw/src/goro.cpp index 866c92cee..2d5538912 100644 --- a/source/games/sw/src/goro.cpp +++ b/source/games/sw/src/goro.cpp @@ -484,6 +484,7 @@ ACTOR_ACTION_SET GoroActionSet = int SetupGoro(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -501,7 +502,7 @@ SetupGoro(short SpriteNum) ChangeState(SpriteNum, s_GoroRun[0]); u->Attrib = &GoroAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_GoroDie; u->Rot = sg_GoroRun; diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index cca8360ff..5746825f5 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -290,6 +290,7 @@ int DoHornetMatchPlayerZ(short SpriteNum); int SetupHornet(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -307,7 +308,7 @@ SetupHornet(short SpriteNum) ChangeState(SpriteNum, s_HornetRun[0]); u->Attrib = &HornetAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_HornetDie; u->Rot = sg_HornetRun; @@ -433,7 +434,7 @@ int InitHornetCircle(DSWActor* actor) NewStateGroup(SpriteNum, u->ActorActionSet->Run); // set it close - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); // set to really fast sp->xvel = 400; diff --git a/source/games/sw/src/lava.cpp b/source/games/sw/src/lava.cpp index da762f8ff..ae79b5b05 100644 --- a/source/games/sw/src/lava.cpp +++ b/source/games/sw/src/lava.cpp @@ -454,6 +454,7 @@ ACTOR_ACTION_SET LavaActionSet = int SetupLava(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -471,7 +472,7 @@ SetupLava(short SpriteNum) ChangeState(SpriteNum, s_LavaRun[0]); u->Attrib = &LavaAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_LavaDie; u->Rot = sg_LavaRun; diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 9c29311a4..1d3cfbaf6 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -1819,6 +1819,7 @@ ACTOR_ACTION_SET PlayerNinjaActionSet = int SetupNinja(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -1930,7 +1931,7 @@ SetupNinja(short SpriteNum) } ChangeState(SpriteNum, s_NinjaRun[0]); - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->Radius = 280; SET(u->Flags, SPR_XFLIP_TOGGLE); diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index 83757e4ac..c0bdb76bb 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -817,6 +817,7 @@ ACTOR_ACTION_SET RipperBrownActionSet = int SetupRipper(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -834,7 +835,7 @@ SetupRipper(short SpriteNum) ChangeState(SpriteNum, s_RipperRun[0]); u->Attrib = &RipperAttrib; - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); u->StateEnd = s_RipperDie; u->Rot = sg_RipperRun; sp->xrepeat = 64; @@ -982,7 +983,7 @@ InitRipperHang(DSWActor* actor) NewStateGroup(SpriteNum, sg_RipperHangJump); u->StateFallOverride = sg_RipperHangFall; - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); //u->jump_speed = -800; PickJumpMaxSpeed(SpriteNum, -800); @@ -1103,7 +1104,7 @@ DoRipperBeginJumpAttack(DSWActor* actor) else sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6)); - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); //u->jump_speed = -800; PickJumpMaxSpeed(SpriteNum, -400); // was -800 @@ -1274,7 +1275,7 @@ void RipperHatch(short Weapon) NewStateGroup(New, nu->ActorActionSet->Jump); nu->ActorActionFunc = DoActorMoveJump; - DoActorSetSpeed(New, FAST_SPEED); + DoActorSetSpeed(actorNew, FAST_SPEED); PickJumpMaxSpeed(New, -600); SET(nu->Flags, SPR_JUMPING); diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 3f6e30586..b056e558f 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -885,6 +885,7 @@ ACTOR_ACTION_SET Ripper2BrownActionSet = int SetupRipper2(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -902,7 +903,7 @@ SetupRipper2(short SpriteNum) ChangeState(SpriteNum, s_Ripper2Run[0]); u->Attrib = &Ripper2Attrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_Ripper2Die; u->Rot = sg_Ripper2Run; sp->clipdist = 512 >> 2; // This actor is bigger, needs bigger box. @@ -979,7 +980,7 @@ InitRipper2Hang(DSWActor* actor) NewStateGroup(SpriteNum, sg_Ripper2HangJump); u->StateFallOverride = sg_Ripper2HangFall; - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); //u->jump_speed = -800; PickJumpMaxSpeed(SpriteNum, -(RandomRange(400)+100)); @@ -1115,7 +1116,7 @@ DoRipper2BeginJumpAttack(DSWActor* actor) // sp->ang = NORM_ANGLE(tang); - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); //u->jump_speed = -800; PickJumpMaxSpeed(SpriteNum, -(RandomRange(400)+100)); @@ -1288,7 +1289,7 @@ void Ripper2Hatch(short Weapon) NewStateGroup(New, nu->ActorActionSet->Jump); nu->ActorActionFunc = DoActorMoveJump; - DoActorSetSpeed(New, FAST_SPEED); + DoActorSetSpeed(actorNew, FAST_SPEED); PickJumpMaxSpeed(New, -600); SET(nu->Flags, SPR_JUMPING); @@ -1353,7 +1354,7 @@ int InitRipper2Charge(DSWActor* actor) { USER* u = actor->u(); int SpriteNum = u->SpriteNum; - DoActorSetSpeed(SpriteNum, FAST_SPEED); + DoActorSetSpeed(actor, FAST_SPEED); InitActorMoveCloser(actor); diff --git a/source/games/sw/src/serp.cpp b/source/games/sw/src/serp.cpp index 94a6b4f9f..e048e427b 100644 --- a/source/games/sw/src/serp.cpp +++ b/source/games/sw/src/serp.cpp @@ -698,6 +698,7 @@ ACTOR_ACTION_SET SerpActionSet = int SetupSerp(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -718,7 +719,7 @@ SetupSerp(short SpriteNum) ChangeState(SpriteNum, s_SerpRun[0]); u->Attrib = &SerpAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_SerpDie; u->Rot = sg_SerpRun; diff --git a/source/games/sw/src/skel.cpp b/source/games/sw/src/skel.cpp index 02a3c5dd1..57cc1ed17 100644 --- a/source/games/sw/src/skel.cpp +++ b/source/games/sw/src/skel.cpp @@ -503,6 +503,7 @@ ACTOR_ACTION_SET SkelActionSet = int SetupSkel(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -520,7 +521,7 @@ SetupSkel(short SpriteNum) ChangeState(SpriteNum, s_SkelRun[0]); u->Attrib = &SkelAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_SkelDie; u->Rot = sg_SkelRun; diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 1183afd23..b60efb28e 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -212,6 +212,7 @@ STATEp sg_SkullExplode[] = int SetupSkull(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -229,7 +230,7 @@ SetupSkull(short SpriteNum) ChangeState(SpriteNum, s_SkullWait[0]); u->Attrib = &SkullAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_SkullExplode; u->Rot = sg_SkullWait; @@ -636,6 +637,7 @@ STATEp sg_BettyExplode[] = int SetupBetty(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -653,7 +655,7 @@ SetupBetty(short SpriteNum) ChangeState(SpriteNum, s_BettyWait[0]); u->Attrib = &BettyAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_BettyExplode; u->Rot = sg_BettyWait; diff --git a/source/games/sw/src/sumo.cpp b/source/games/sw/src/sumo.cpp index 3c1b08b09..090cf9192 100644 --- a/source/games/sw/src/sumo.cpp +++ b/source/games/sw/src/sumo.cpp @@ -630,6 +630,7 @@ ACTOR_ACTION_SET MiniSumoActionSet = int SetupSumo(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -650,7 +651,7 @@ SetupSumo(short SpriteNum) ChangeState(SpriteNum,s_SumoRun[0]); u->Attrib = &SumoAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_SumoDie; u->Rot = sg_SumoRun; diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 4acba88e3..21078b3f4 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -3014,6 +3014,7 @@ DoAutoTurretObject(SECTOR_OBJECTp sop) void DoActorHitTrackEndPoint(USERp u) { + auto actor = &swActors[u->SpriteNum]; SPRITEp sp = u->SpriteP; RESET(Track[u->track].flags, TF_TRACK_OCCUPIED); @@ -3031,7 +3032,7 @@ DoActorHitTrackEndPoint(USERp u) else { RESET(u->Flags, SPR_RUN_AWAY); - DoActorSetSpeed(short(sp - sprite), NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->track = -1; } } @@ -3047,7 +3048,7 @@ DoActorHitTrackEndPoint(USERp u) else { RESET(u->Flags, SPR_FIND_PLAYER); - DoActorSetSpeed(short(sp - sprite), NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->track = -1; } } @@ -3760,7 +3761,7 @@ ActorFollowTrack(short SpriteNum, short locktics) RESET(sp->cstat, CSTAT_SPRITE_YCENTER); sp->z += u->sy; - DoActorSetSpeed(SpriteNum, SLOW_SPEED); + DoActorSetSpeed(actor, SLOW_SPEED); u->ActorActionFunc = NinjaJumpActionFunc; u->jump_speed = -650; DoActorBeginJump(actor); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 43f4c7732..1a2d2001b 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -13836,6 +13836,7 @@ InitSumoNapalm(short SpriteNum) int InitSumoSkull(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP, np; USERp u = User[SpriteNum].Data(), nu; short New; @@ -13871,7 +13872,7 @@ InitSumoSkull(short SpriteNum) nu->Rot = sg_SkullWait; nu->Attrib = &SkullAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); nu->Counter = RANDOM_P2(2048); nu->sz = np->z; nu->Health = 100; diff --git a/source/games/sw/src/zilla.cpp b/source/games/sw/src/zilla.cpp index 878b20fc1..8c2720728 100644 --- a/source/games/sw/src/zilla.cpp +++ b/source/games/sw/src/zilla.cpp @@ -643,6 +643,7 @@ ACTOR_ACTION_SET ZillaActionSet = int SetupZilla(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u; ANIMATOR DoActorDecide; @@ -663,7 +664,7 @@ SetupZilla(short SpriteNum) ChangeState(SpriteNum,s_ZillaRun[0]); u->Attrib = &ZillaAttrib; - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->StateEnd = s_ZillaDie; u->Rot = sg_ZillaRun; diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 920b67191..774538ab0 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -751,6 +751,7 @@ ACTOR_ACTION_SET ZombieActionSet = int SetupZombie(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum].Data(); ANIMATOR DoActorDecide; @@ -765,7 +766,7 @@ SetupZombie(short SpriteNum) EnemyDefaults(SpriteNum, &ZombieActionSet, &ZombiePersonality); ChangeState(SpriteNum, s_ZombieRun[0]); - DoActorSetSpeed(SpriteNum, NORM_SPEED); + DoActorSetSpeed(actor, NORM_SPEED); u->Radius = 280; SET(u->Flags, SPR_XFLIP_TOGGLE);