- DoActorSetSpeed + ActorFlaming.

This commit is contained in:
Christoph Oelckers 2021-10-30 12:09:34 +02:00
parent ec9ab56ece
commit 3dbd002319
21 changed files with 83 additions and 64 deletions

View file

@ -138,10 +138,10 @@ bool ActorMoveHitReact(DSWActor* actor)
} }
bool ActorFlaming(short SpriteNum) bool ActorFlaming(DSWActor* actor)
{ {
USERp u = User[SpriteNum].Data(); USERp u = actor->u();
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = &actor->s();
if (u->flame >= 0) if (u->flame >= 0)
{ {
@ -151,7 +151,6 @@ bool ActorFlaming(short SpriteNum)
size = SPRITEp_SIZE_Z(sp) - DIV4(SPRITEp_SIZE_Z(sp)); 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); //DSPRINTF(ds,"enemy size %d, flame size %d",size>>8,SPRITEp_SIZE_Z(fp)>>8);
MONO_PRINT(ds);
if (SPRITEp_SIZE_Z(fp) > size) if (SPRITEp_SIZE_Z(fp) > size)
return true; return true;
@ -160,11 +159,10 @@ bool ActorFlaming(short SpriteNum)
return false; return false;
} }
void void DoActorSetSpeed(DSWActor* actor, uint8_t speed)
DoActorSetSpeed(short SpriteNum, uint8_t speed)
{ {
USERp u = User[SpriteNum].Data(); USERp u = actor->u();
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = &actor->s();
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
return; return;
@ -173,7 +171,7 @@ DoActorSetSpeed(short SpriteNum, uint8_t speed)
u->speed = speed; u->speed = speed;
if (ActorFlaming(SpriteNum)) if (ActorFlaming(actor))
sp->xvel = u->Attrib->Speed[speed] + DIV2(u->Attrib->Speed[speed]); sp->xvel = u->Attrib->Speed[speed] + DIV2(u->Attrib->Speed[speed]);
else else
sp->xvel = u->Attrib->Speed[speed]; sp->xvel = u->Attrib->Speed[speed];
@ -611,8 +609,9 @@ DECISION GenericFlaming[] =
ANIMATORp ANIMATORp
DoActorActionDecide(short SpriteNum) DoActorActionDecide(short SpriteNum)
{ {
USERp u = User[SpriteNum].Data(); auto actor = &swActors[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; USERp u = actor->u();
SPRITEp sp = &actor->s();
int dist; int dist;
ANIMATORp action; ANIMATORp action;
USERp pu=nullptr; USERp pu=nullptr;
@ -639,7 +638,7 @@ DoActorActionDecide(short SpriteNum)
} }
// everybody on fire acts like this // everybody on fire acts like this
if (ActorFlaming(SpriteNum)) if (ActorFlaming(actor))
{ {
action = ChooseAction(&GenericFlaming[0]); action = ChooseAction(&GenericFlaming[0]);
//CON_Message("On Fire"); //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); 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); SET(u->Flags, SPR_FIND_PLAYER);
u->ActorActionFunc = DoActorDecide; u->ActorActionFunc = DoActorDecide;
@ -1372,7 +1371,7 @@ InitActorRunAway(DSWActor* actor)
if (u->track >= 0) 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)); 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); SET(u->Flags, SPR_RUN_AWAY);
//MONO_PRINT("Actor running away on track\n"); //MONO_PRINT("Actor running away on track\n");
} }
@ -1399,7 +1398,7 @@ InitActorRunToward(DSWActor* actor)
NewStateGroup(SpriteNum, u->ActorActionSet->Run); NewStateGroup(SpriteNum, u->ActorActionSet->Run);
InitActorReposition(actor); InitActorReposition(actor);
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
return 0; return 0;
} }
@ -1577,7 +1576,7 @@ InitActorEvade(DSWActor* actor)
if (u->track >= 0) 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)); 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 // NOT doing a RUN_AWAY
RESET(u->Flags, SPR_RUN_AWAY); RESET(u->Flags, SPR_RUN_AWAY);
} }
@ -1605,7 +1604,7 @@ InitActorWanderAround(DSWActor* actor)
if (u->track >= 0) 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); 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; return 0;
@ -1630,7 +1629,7 @@ InitActorFindPlayer(DSWActor* actor)
if (u->track >= 0) 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); 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); SET(u->Flags, SPR_FIND_PLAYER);
u->ActorActionFunc = DoActorDecide; u->ActorActionFunc = DoActorDecide;
@ -1791,8 +1790,9 @@ int move_scan(short SpriteNum, short ang, int dist, int *stopx, int *stopy, int
int int
FindNewAngle(short SpriteNum, signed char dir, int DistToMove) FindNewAngle(short SpriteNum, signed char dir, int DistToMove)
{ {
USERp u = User[SpriteNum].Data(); auto actor = &swActors[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; USERp u = actor->u();
SPRITEp sp = &actor->s();
static short toward_angle_delta[4][9] = static short toward_angle_delta[4][9] =
{ {
@ -1824,7 +1824,7 @@ FindNewAngle(short SpriteNum, signed char dir, int DistToMove)
int save_dist = 500; int save_dist = 500;
// if on fire, run shorter distances // if on fire, run shorter distances
if (ActorFlaming(SpriteNum)) if (ActorFlaming(actor))
DistToMove = DIV4(DistToMove) + DIV8(DistToMove); DistToMove = DIV4(DistToMove) + DIV8(DistToMove);
// Find angle to from the player // Find angle to from the player
@ -1992,7 +1992,7 @@ InitActorReposition(DSWActor* actor)
} }
sp->ang = ang; sp->ang = ang;
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
RESET(u->Flags, SPR_RUN_AWAY); RESET(u->Flags, SPR_RUN_AWAY);
} }
else else
@ -2016,9 +2016,9 @@ InitActorReposition(DSWActor* actor)
{ {
// pick random speed to move toward the player // pick random speed to move toward the player
if (RANDOM_P2(1024) < 512) if (RANDOM_P2(1024) < 512)
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
else else
DoActorSetSpeed(SpriteNum, MID_SPEED); DoActorSetSpeed(actor, MID_SPEED);
} }
sp->ang = ang; sp->ang = ang;

View file

@ -72,8 +72,6 @@ extern ATTRIBUTE DefaultAttrib;
// AI.C functions // AI.C functions
void DebugMoveHit(DSWActor* actor); void DebugMoveHit(DSWActor* actor);
bool ActorMoveHitReact(DSWActor* actor); bool ActorMoveHitReact(DSWActor* actor);
bool ActorFlaming(short SpriteNum);
void DoActorSetSpeed(short SpriteNum,uint8_t speed);
short ChooseActionNumber(short decision[]); short ChooseActionNumber(short decision[]);
int DoActorNoise(ANIMATORp Action,short SpriteNum); int DoActorNoise(ANIMATORp Action,short SpriteNum);
bool CanSeePlayer(short SpriteNum); bool CanSeePlayer(short SpriteNum);
@ -162,7 +160,7 @@ DoActorExtra5Noise,
DoActorExtra6Noise; DoActorExtra6Noise;
*/ */
void DoActorSetSpeed(short SpriteNum, uint8_t speed); void DoActorSetSpeed(DSWActor* actor, uint8_t speed);
END_SW_NS END_SW_NS

View file

@ -725,13 +725,14 @@ ACTOR_ACTION_SET BunnyWhiteActionSet =
int int
SetupBunny(short SpriteNum) SetupBunny(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; 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
@ -792,7 +793,7 @@ SetupBunny(short SpriteNum)
//sp->shade = 0; // darker //sp->shade = 0; // darker
} }
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
SET(u->Flags, SPR_XFLIP_TOGGLE); SET(u->Flags, SPR_XFLIP_TOGGLE);
@ -866,7 +867,7 @@ DoBunnyBeginJumpAttack(DSWActor* actor)
else else
sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6)); sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6));
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
//u->jump_speed = -800; //u->jump_speed = -800;
PickJumpMaxSpeed(SpriteNum, -400); // was -800 PickJumpMaxSpeed(SpriteNum, -400); // was -800
@ -1233,7 +1234,7 @@ void BunnyHatch(short Weapon)
NewStateGroup(New, nu->ActorActionSet->Jump); NewStateGroup(New, nu->ActorActionSet->Jump);
nu->ActorActionFunc = DoActorMoveJump; nu->ActorActionFunc = DoActorMoveJump;
DoActorSetSpeed(New, FAST_SPEED); DoActorSetSpeed(actorNew, FAST_SPEED);
PickJumpMaxSpeed(New, -600); PickJumpMaxSpeed(New, -600);
SET(nu->Flags, SPR_JUMPING); SET(nu->Flags, SPR_JUMPING);
@ -1291,7 +1292,7 @@ int BunnyHatch2(short Weapon)
NewStateGroup(New, nu->ActorActionSet->Jump); NewStateGroup(New, nu->ActorActionSet->Jump);
nu->ActorActionFunc = DoActorMoveJump; nu->ActorActionFunc = DoActorMoveJump;
DoActorSetSpeed(New, FAST_SPEED); DoActorSetSpeed(actorNew, FAST_SPEED);
if (TEST_BOOL3(wp)) if (TEST_BOOL3(wp))
{ {
PickJumpMaxSpeed(New, -600-RandomRange(600)); PickJumpMaxSpeed(New, -600-RandomRange(600));

View file

@ -500,6 +500,7 @@ int DoCoolgMatchPlayerZ(short SpriteNum);
void void
CoolgCommon(short SpriteNum) CoolgCommon(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum].Data(); USERp u = User[SpriteNum].Data();
@ -518,6 +519,7 @@ CoolgCommon(short SpriteNum)
int int
SetupCoolg(short SpriteNum) SetupCoolg(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -535,7 +537,7 @@ SetupCoolg(short SpriteNum)
ChangeState(SpriteNum, s_CoolgRun[0]); ChangeState(SpriteNum, s_CoolgRun[0]);
u->Attrib = &CoolgAttrib; u->Attrib = &CoolgAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_CoolgDie; u->StateEnd = s_CoolgDie;
u->Rot = sg_CoolgRun; u->Rot = sg_CoolgRun;
@ -593,7 +595,7 @@ DoCoolgBirth(DSWActor* actor)
u->Health = HEALTH_COOLIE_GHOST; u->Health = HEALTH_COOLIE_GHOST;
u->Attrib = &CoolgAttrib; u->Attrib = &CoolgAttrib;
DoActorSetSpeed(New, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
ChangeState(New, s_CoolgRun[0]); ChangeState(New, s_CoolgRun[0]);
u->StateEnd = s_CoolgDie; u->StateEnd = s_CoolgDie;
@ -720,7 +722,7 @@ int InitCoolgCircle(DSWActor* actor)
NewStateGroup(SpriteNum, u->ActorActionSet->Run); NewStateGroup(SpriteNum, u->ActorActionSet->Run);
// set it close // set it close
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
// set to really fast // set to really fast
sp->xvel = 400; sp->xvel = 400;

View file

@ -525,6 +525,7 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso
int int
SetupCoolie(short SpriteNum) SetupCoolie(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -542,7 +543,7 @@ SetupCoolie(short SpriteNum)
ChangeState(SpriteNum,s_CoolieRun[0]); ChangeState(SpriteNum,s_CoolieRun[0]);
u->Attrib = &CoolieAttrib; u->Attrib = &CoolieAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_CoolieDie; u->StateEnd = s_CoolieDie;
u->Rot = sg_CoolieRun; u->Rot = sg_CoolieRun;
@ -652,7 +653,7 @@ int InitCoolieCharge(DSWActor* actor)
if (RANDOM_P2(1024) > 950) if (RANDOM_P2(1024) > 950)
PlaySound(DIGI_COOLIESCREAM, sp, v3df_follow); PlaySound(DIGI_COOLIESCREAM, sp, v3df_follow);
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
InitActorMoveCloser(actor); InitActorMoveCloser(actor);

View file

@ -378,6 +378,7 @@ EelCommon(short SpriteNum)
int int
SetupEel(short SpriteNum) SetupEel(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -395,7 +396,7 @@ SetupEel(short SpriteNum)
ChangeState(SpriteNum, s_EelRun[0]); ChangeState(SpriteNum, s_EelRun[0]);
u->Attrib = &EelAttrib; u->Attrib = &EelAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_EelDie; u->StateEnd = s_EelDie;
u->Rot = sg_EelRun; u->Rot = sg_EelRun;

View file

@ -715,6 +715,7 @@ ACTOR_ACTION_SET GirlNinjaActionSet =
int int
SetupGirlNinja(short SpriteNum) SetupGirlNinja(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -740,7 +741,7 @@ SetupGirlNinja(short SpriteNum)
EnemyDefaults(SpriteNum, &GirlNinjaActionSet, &GirlNinjaPersonality); EnemyDefaults(SpriteNum, &GirlNinjaActionSet, &GirlNinjaPersonality);
ChangeState(SpriteNum, s_GirlNinjaRun[0]); ChangeState(SpriteNum, s_GirlNinjaRun[0]);
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->Radius = 280; u->Radius = 280;
RESET(u->Flags, SPR_XFLIP_TOGGLE); RESET(u->Flags, SPR_XFLIP_TOGGLE);

View file

@ -484,6 +484,7 @@ ACTOR_ACTION_SET GoroActionSet =
int int
SetupGoro(short SpriteNum) SetupGoro(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -501,7 +502,7 @@ SetupGoro(short SpriteNum)
ChangeState(SpriteNum, s_GoroRun[0]); ChangeState(SpriteNum, s_GoroRun[0]);
u->Attrib = &GoroAttrib; u->Attrib = &GoroAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_GoroDie; u->StateEnd = s_GoroDie;
u->Rot = sg_GoroRun; u->Rot = sg_GoroRun;

View file

@ -290,6 +290,7 @@ int DoHornetMatchPlayerZ(short SpriteNum);
int int
SetupHornet(short SpriteNum) SetupHornet(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -307,7 +308,7 @@ SetupHornet(short SpriteNum)
ChangeState(SpriteNum, s_HornetRun[0]); ChangeState(SpriteNum, s_HornetRun[0]);
u->Attrib = &HornetAttrib; u->Attrib = &HornetAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_HornetDie; u->StateEnd = s_HornetDie;
u->Rot = sg_HornetRun; u->Rot = sg_HornetRun;
@ -433,7 +434,7 @@ int InitHornetCircle(DSWActor* actor)
NewStateGroup(SpriteNum, u->ActorActionSet->Run); NewStateGroup(SpriteNum, u->ActorActionSet->Run);
// set it close // set it close
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
// set to really fast // set to really fast
sp->xvel = 400; sp->xvel = 400;

View file

@ -454,6 +454,7 @@ ACTOR_ACTION_SET LavaActionSet =
int int
SetupLava(short SpriteNum) SetupLava(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -471,7 +472,7 @@ SetupLava(short SpriteNum)
ChangeState(SpriteNum, s_LavaRun[0]); ChangeState(SpriteNum, s_LavaRun[0]);
u->Attrib = &LavaAttrib; u->Attrib = &LavaAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_LavaDie; u->StateEnd = s_LavaDie;
u->Rot = sg_LavaRun; u->Rot = sg_LavaRun;

View file

@ -1819,6 +1819,7 @@ ACTOR_ACTION_SET PlayerNinjaActionSet =
int int
SetupNinja(short SpriteNum) SetupNinja(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -1930,7 +1931,7 @@ SetupNinja(short SpriteNum)
} }
ChangeState(SpriteNum, s_NinjaRun[0]); ChangeState(SpriteNum, s_NinjaRun[0]);
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->Radius = 280; u->Radius = 280;
SET(u->Flags, SPR_XFLIP_TOGGLE); SET(u->Flags, SPR_XFLIP_TOGGLE);

View file

@ -817,6 +817,7 @@ ACTOR_ACTION_SET RipperBrownActionSet =
int int
SetupRipper(short SpriteNum) SetupRipper(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -834,7 +835,7 @@ SetupRipper(short SpriteNum)
ChangeState(SpriteNum, s_RipperRun[0]); ChangeState(SpriteNum, s_RipperRun[0]);
u->Attrib = &RipperAttrib; u->Attrib = &RipperAttrib;
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
u->StateEnd = s_RipperDie; u->StateEnd = s_RipperDie;
u->Rot = sg_RipperRun; u->Rot = sg_RipperRun;
sp->xrepeat = 64; sp->xrepeat = 64;
@ -982,7 +983,7 @@ InitRipperHang(DSWActor* actor)
NewStateGroup(SpriteNum, sg_RipperHangJump); NewStateGroup(SpriteNum, sg_RipperHangJump);
u->StateFallOverride = sg_RipperHangFall; u->StateFallOverride = sg_RipperHangFall;
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
//u->jump_speed = -800; //u->jump_speed = -800;
PickJumpMaxSpeed(SpriteNum, -800); PickJumpMaxSpeed(SpriteNum, -800);
@ -1103,7 +1104,7 @@ DoRipperBeginJumpAttack(DSWActor* actor)
else else
sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6)); sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6));
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
//u->jump_speed = -800; //u->jump_speed = -800;
PickJumpMaxSpeed(SpriteNum, -400); // was -800 PickJumpMaxSpeed(SpriteNum, -400); // was -800
@ -1274,7 +1275,7 @@ void RipperHatch(short Weapon)
NewStateGroup(New, nu->ActorActionSet->Jump); NewStateGroup(New, nu->ActorActionSet->Jump);
nu->ActorActionFunc = DoActorMoveJump; nu->ActorActionFunc = DoActorMoveJump;
DoActorSetSpeed(New, FAST_SPEED); DoActorSetSpeed(actorNew, FAST_SPEED);
PickJumpMaxSpeed(New, -600); PickJumpMaxSpeed(New, -600);
SET(nu->Flags, SPR_JUMPING); SET(nu->Flags, SPR_JUMPING);

View file

@ -885,6 +885,7 @@ ACTOR_ACTION_SET Ripper2BrownActionSet =
int int
SetupRipper2(short SpriteNum) SetupRipper2(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -902,7 +903,7 @@ SetupRipper2(short SpriteNum)
ChangeState(SpriteNum, s_Ripper2Run[0]); ChangeState(SpriteNum, s_Ripper2Run[0]);
u->Attrib = &Ripper2Attrib; u->Attrib = &Ripper2Attrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_Ripper2Die; u->StateEnd = s_Ripper2Die;
u->Rot = sg_Ripper2Run; u->Rot = sg_Ripper2Run;
sp->clipdist = 512 >> 2; // This actor is bigger, needs bigger box. sp->clipdist = 512 >> 2; // This actor is bigger, needs bigger box.
@ -979,7 +980,7 @@ InitRipper2Hang(DSWActor* actor)
NewStateGroup(SpriteNum, sg_Ripper2HangJump); NewStateGroup(SpriteNum, sg_Ripper2HangJump);
u->StateFallOverride = sg_Ripper2HangFall; u->StateFallOverride = sg_Ripper2HangFall;
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
//u->jump_speed = -800; //u->jump_speed = -800;
PickJumpMaxSpeed(SpriteNum, -(RandomRange(400)+100)); PickJumpMaxSpeed(SpriteNum, -(RandomRange(400)+100));
@ -1115,7 +1116,7 @@ DoRipper2BeginJumpAttack(DSWActor* actor)
// sp->ang = NORM_ANGLE(tang); // sp->ang = NORM_ANGLE(tang);
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
//u->jump_speed = -800; //u->jump_speed = -800;
PickJumpMaxSpeed(SpriteNum, -(RandomRange(400)+100)); PickJumpMaxSpeed(SpriteNum, -(RandomRange(400)+100));
@ -1288,7 +1289,7 @@ void Ripper2Hatch(short Weapon)
NewStateGroup(New, nu->ActorActionSet->Jump); NewStateGroup(New, nu->ActorActionSet->Jump);
nu->ActorActionFunc = DoActorMoveJump; nu->ActorActionFunc = DoActorMoveJump;
DoActorSetSpeed(New, FAST_SPEED); DoActorSetSpeed(actorNew, FAST_SPEED);
PickJumpMaxSpeed(New, -600); PickJumpMaxSpeed(New, -600);
SET(nu->Flags, SPR_JUMPING); SET(nu->Flags, SPR_JUMPING);
@ -1353,7 +1354,7 @@ int InitRipper2Charge(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int SpriteNum = u->SpriteNum; int SpriteNum = u->SpriteNum;
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(actor, FAST_SPEED);
InitActorMoveCloser(actor); InitActorMoveCloser(actor);

View file

@ -698,6 +698,7 @@ ACTOR_ACTION_SET SerpActionSet =
int int
SetupSerp(short SpriteNum) SetupSerp(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -718,7 +719,7 @@ SetupSerp(short SpriteNum)
ChangeState(SpriteNum, s_SerpRun[0]); ChangeState(SpriteNum, s_SerpRun[0]);
u->Attrib = &SerpAttrib; u->Attrib = &SerpAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_SerpDie; u->StateEnd = s_SerpDie;
u->Rot = sg_SerpRun; u->Rot = sg_SerpRun;

View file

@ -503,6 +503,7 @@ ACTOR_ACTION_SET SkelActionSet =
int int
SetupSkel(short SpriteNum) SetupSkel(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -520,7 +521,7 @@ SetupSkel(short SpriteNum)
ChangeState(SpriteNum, s_SkelRun[0]); ChangeState(SpriteNum, s_SkelRun[0]);
u->Attrib = &SkelAttrib; u->Attrib = &SkelAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_SkelDie; u->StateEnd = s_SkelDie;
u->Rot = sg_SkelRun; u->Rot = sg_SkelRun;

View file

@ -212,6 +212,7 @@ STATEp sg_SkullExplode[] =
int int
SetupSkull(short SpriteNum) SetupSkull(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -229,7 +230,7 @@ SetupSkull(short SpriteNum)
ChangeState(SpriteNum, s_SkullWait[0]); ChangeState(SpriteNum, s_SkullWait[0]);
u->Attrib = &SkullAttrib; u->Attrib = &SkullAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_SkullExplode; u->StateEnd = s_SkullExplode;
u->Rot = sg_SkullWait; u->Rot = sg_SkullWait;
@ -636,6 +637,7 @@ STATEp sg_BettyExplode[] =
int int
SetupBetty(short SpriteNum) SetupBetty(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -653,7 +655,7 @@ SetupBetty(short SpriteNum)
ChangeState(SpriteNum, s_BettyWait[0]); ChangeState(SpriteNum, s_BettyWait[0]);
u->Attrib = &BettyAttrib; u->Attrib = &BettyAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_BettyExplode; u->StateEnd = s_BettyExplode;
u->Rot = sg_BettyWait; u->Rot = sg_BettyWait;

View file

@ -630,6 +630,7 @@ ACTOR_ACTION_SET MiniSumoActionSet =
int int
SetupSumo(short SpriteNum) SetupSumo(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -650,7 +651,7 @@ SetupSumo(short SpriteNum)
ChangeState(SpriteNum,s_SumoRun[0]); ChangeState(SpriteNum,s_SumoRun[0]);
u->Attrib = &SumoAttrib; u->Attrib = &SumoAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_SumoDie; u->StateEnd = s_SumoDie;
u->Rot = sg_SumoRun; u->Rot = sg_SumoRun;

View file

@ -3014,6 +3014,7 @@ DoAutoTurretObject(SECTOR_OBJECTp sop)
void void
DoActorHitTrackEndPoint(USERp u) DoActorHitTrackEndPoint(USERp u)
{ {
auto actor = &swActors[u->SpriteNum];
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
RESET(Track[u->track].flags, TF_TRACK_OCCUPIED); RESET(Track[u->track].flags, TF_TRACK_OCCUPIED);
@ -3031,7 +3032,7 @@ DoActorHitTrackEndPoint(USERp u)
else else
{ {
RESET(u->Flags, SPR_RUN_AWAY); RESET(u->Flags, SPR_RUN_AWAY);
DoActorSetSpeed(short(sp - sprite), NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->track = -1; u->track = -1;
} }
} }
@ -3047,7 +3048,7 @@ DoActorHitTrackEndPoint(USERp u)
else else
{ {
RESET(u->Flags, SPR_FIND_PLAYER); RESET(u->Flags, SPR_FIND_PLAYER);
DoActorSetSpeed(short(sp - sprite), NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->track = -1; u->track = -1;
} }
} }
@ -3760,7 +3761,7 @@ ActorFollowTrack(short SpriteNum, short locktics)
RESET(sp->cstat, CSTAT_SPRITE_YCENTER); RESET(sp->cstat, CSTAT_SPRITE_YCENTER);
sp->z += u->sy; sp->z += u->sy;
DoActorSetSpeed(SpriteNum, SLOW_SPEED); DoActorSetSpeed(actor, SLOW_SPEED);
u->ActorActionFunc = NinjaJumpActionFunc; u->ActorActionFunc = NinjaJumpActionFunc;
u->jump_speed = -650; u->jump_speed = -650;
DoActorBeginJump(actor); DoActorBeginJump(actor);

View file

@ -13836,6 +13836,7 @@ InitSumoNapalm(short SpriteNum)
int int
InitSumoSkull(short SpriteNum) InitSumoSkull(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP, np; SPRITEp sp = User[SpriteNum]->SpriteP, np;
USERp u = User[SpriteNum].Data(), nu; USERp u = User[SpriteNum].Data(), nu;
short New; short New;
@ -13871,7 +13872,7 @@ InitSumoSkull(short SpriteNum)
nu->Rot = sg_SkullWait; nu->Rot = sg_SkullWait;
nu->Attrib = &SkullAttrib; nu->Attrib = &SkullAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
nu->Counter = RANDOM_P2(2048); nu->Counter = RANDOM_P2(2048);
nu->sz = np->z; nu->sz = np->z;
nu->Health = 100; nu->Health = 100;

View file

@ -643,6 +643,7 @@ ACTOR_ACTION_SET ZillaActionSet =
int int
SetupZilla(short SpriteNum) SetupZilla(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u; USERp u;
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -663,7 +664,7 @@ SetupZilla(short SpriteNum)
ChangeState(SpriteNum,s_ZillaRun[0]); ChangeState(SpriteNum,s_ZillaRun[0]);
u->Attrib = &ZillaAttrib; u->Attrib = &ZillaAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_ZillaDie; u->StateEnd = s_ZillaDie;
u->Rot = sg_ZillaRun; u->Rot = sg_ZillaRun;

View file

@ -751,6 +751,7 @@ ACTOR_ACTION_SET ZombieActionSet =
int int
SetupZombie(short SpriteNum) SetupZombie(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum].Data(); USERp u = User[SpriteNum].Data();
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
@ -765,7 +766,7 @@ SetupZombie(short SpriteNum)
EnemyDefaults(SpriteNum, &ZombieActionSet, &ZombiePersonality); EnemyDefaults(SpriteNum, &ZombieActionSet, &ZombiePersonality);
ChangeState(SpriteNum, s_ZombieRun[0]); ChangeState(SpriteNum, s_ZombieRun[0]);
DoActorSetSpeed(SpriteNum, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
u->Radius = 280; u->Radius = 280;
SET(u->Flags, SPR_XFLIP_TOGGLE); SET(u->Flags, SPR_XFLIP_TOGGLE);