- most calls of SetState

This commit is contained in:
Christoph Oelckers 2021-10-30 20:11:31 +02:00
parent 771b4bcf43
commit 8d5243bd64
23 changed files with 142 additions and 121 deletions

View file

@ -111,12 +111,12 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
switch (meansofdeath)
{
case WPN_NM_LAVA:
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
u->RotNum = 0;
break;
case WPN_NM_SECTOR_SQUISH:
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
u->RotNum = 0;
break;
}
@ -134,7 +134,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
// Coolie actually explodes himself
// he is the Sprite AND Weapon
case COOLIE_RUN_R0:
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
u->RotNum = 0;
sp->xvel <<= 1;
u->ActorActionFunc = nullptr;
@ -152,9 +152,9 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
InitPlasmaFountain(wp, sp);
PlaySound(DIGI_NINJAINHALF, sp, v3df_none);
if (sw_ninjahack)
ChangeSpriteState(SpriteNum, &s_NinjaDieSlicedHack[5]);
ChangeState(actor, &s_NinjaDieSlicedHack[5]);
else
ChangeSpriteState(SpriteNum, &s_NinjaDieSliced[0]);
ChangeState(actor, &s_NinjaDieSliced[0]);
}
else
{
@ -163,7 +163,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
InitPlasmaFountain(wp, sp);
}
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
u->RotNum = 0;
u->ActorActionFunc = nullptr;
sp->xvel = 200 + RandomRange(200);
@ -177,7 +177,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
// test for gibable dead bodies
if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP);
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
sp->xvel = 0;
u->jump_speed = 0;
DoActorBeginJump(actor);
@ -198,14 +198,14 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
case EEL_RUN_R0:
case STAR1:
case SUMO_RUN_R0:
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
u->RotNum = 0;
break;
case UZI_SMOKE:
if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP);
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
u->RotNum = 0;
// Rippers still gotta jump or they fall off walls weird
if (u->ID == RIPPER_RUN_R0 || u->ID == RIPPER2_RUN_R0)
@ -228,7 +228,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
case UZI_SMOKE+1: // Shotgun
if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP);
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
u->RotNum = 0;
// Rippers still gotta jump or they fall off walls weird
@ -253,7 +253,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
{
case SKULL_R0:
case BETTY_R0:
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
break;
default:
@ -264,7 +264,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP);
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
u->RotNum = 0;
u->ActorActionFunc = nullptr;
sp->xvel = 300 + RandomRange(400);

View file

@ -749,7 +749,7 @@ SetupBunny(short SpriteNum)
// return(0);
// }
ChangeSpriteState(SpriteNum, s_BunnyRun[0]);
ChangeState(actor, s_BunnyRun[0]);
u->StateEnd = s_BunnyDie;
u->Rot = sg_BunnyRun;
//sp->xrepeat = 64;

View file

@ -530,7 +530,7 @@ int SetupCoolg(DSWActor* actor)
}
u = actor->u();
ChangeSpriteState(SpriteNum, s_CoolgRun[0]);
ChangeState(actor, s_CoolgRun[0]);
u->Attrib = &CoolgAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_CoolgDie;
@ -560,7 +560,7 @@ int NewCoolg(DSWActor* actor)
nu = actorNew->u();
np = &actorNew->s();
ChangeSpriteState(actorNew->GetSpriteIndex(), &s_CoolgBirth[0]);
ChangeState(actorNew, &s_CoolgBirth[0]);
nu->StateEnd = s_CoolgDie;
nu->Rot = sg_CoolgRun;
np->pal = nu->spal = u->spal;
@ -582,18 +582,17 @@ int NewCoolg(DSWActor* actor)
int DoCoolgBirth(DSWActor* actor)
{
USER* u = actor->u();
int New = u->SpriteNum;
ANIMATOR DoActorDecide;
u->Health = HEALTH_COOLIE_GHOST;
u->Attrib = &CoolgAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
ChangeSpriteState(New, s_CoolgRun[0]);
ChangeState(actor, s_CoolgRun[0]);
u->StateEnd = s_CoolgDie;
u->Rot = sg_CoolgRun;
EnemyDefaults(New, &CoolgActionSet, &CoolgPersonality);
EnemyDefaults(actor->GetSpriteIndex(), &CoolgActionSet, &CoolgPersonality);
// special case
TotalKillable--;

View file

@ -542,7 +542,7 @@ SetupCoolie(short SpriteNum)
u->Health = HEALTH_COOLIE;
}
ChangeSpriteState(SpriteNum,s_CoolieRun[0]);
ChangeState(actor,s_CoolieRun[0]);
u->Attrib = &CoolieAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_CoolieDie;
@ -672,7 +672,7 @@ DoCoolieWaitBirth(DSWActor* actor)
if ((u->Counter -= ACTORMOVETICS) <= 0)
{
ChangeSpriteState(SpriteNum,&s_CoolieDie[9]);
ChangeState(actor,&s_CoolieDie[9]);
}
return 0;

View file

@ -394,7 +394,7 @@ SetupEel(short SpriteNum)
u->Health = 40;
}
ChangeSpriteState(SpriteNum, s_EelRun[0]);
ChangeState(actor, s_EelRun[0]);
u->Attrib = &EelAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_EelDie;

View file

@ -740,7 +740,7 @@ SetupGirlNinja(short SpriteNum)
sp->pal = u->spal = 26;
EnemyDefaults(SpriteNum, &GirlNinjaActionSet, &GirlNinjaPersonality);
ChangeSpriteState(SpriteNum, s_GirlNinjaRun[0]);
ChangeState(actor, s_GirlNinjaRun[0]);
DoActorSetSpeed(actor, NORM_SPEED);
u->Radius = 280;

View file

@ -500,7 +500,7 @@ SetupGoro(short SpriteNum)
u->Health = HEALTH_GORO;
}
ChangeSpriteState(SpriteNum, s_GoroRun[0]);
ChangeState(actor, s_GoroRun[0]);
u->Attrib = &GoroAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_GoroDie;

View file

@ -306,7 +306,7 @@ SetupHornet(short SpriteNum)
u->Health = HEALTH_HORNET;
}
ChangeSpriteState(SpriteNum, s_HornetRun[0]);
ChangeState(actor, s_HornetRun[0]);
u->Attrib = &HornetAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_HornetDie;

View file

@ -470,7 +470,7 @@ SetupLava(short SpriteNum)
u->Health = 100;
}
ChangeSpriteState(SpriteNum, s_LavaRun[0]);
ChangeState(actor, s_LavaRun[0]);
u->Attrib = &LavaAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_LavaDie;

View file

@ -113,7 +113,8 @@ STATE s_ToiletGirlUzi[16] =
int
SetupToiletGirl(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -131,7 +132,7 @@ SetupToiletGirl(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_ToiletGirlStand);
ChangeState(actor,s_ToiletGirlStand);
u->Attrib = &ToiletGirlAttrib;
u->StateEnd = s_ToiletGirlStand;
u->Rot = 0;
@ -187,7 +188,7 @@ int DoToiletGirl(DSWActor* actor)
else
PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_ToiletGirlUzi);
ChangeState(actor,s_ToiletGirlUzi);
u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0;
}
@ -233,7 +234,7 @@ int NullToiletGirl(DSWActor* actor)
else
PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_ToiletGirlUzi);
ChangeState(actor,s_ToiletGirlUzi);
u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0;
}
@ -252,7 +253,7 @@ int ToiletGirlUzi(DSWActor* actor)
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{
u->WaitTics = RandomRange(240)+120;
ChangeSpriteState(SpriteNum,s_ToiletGirlStand);
ChangeState(actor,s_ToiletGirlStand);
u->FlagOwner = 0;
}
@ -267,7 +268,7 @@ int ToiletGirlPain(DSWActor* actor)
NullToiletGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeSpriteState(SpriteNum,s_ToiletGirlStand);
ChangeState(actor,s_ToiletGirlStand);
return 0;
}
@ -357,7 +358,8 @@ STATE s_WashGirlUzi[16] =
int
SetupWashGirl(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -374,7 +376,7 @@ SetupWashGirl(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_WashGirlStand);
ChangeState(actor,s_WashGirlStand);
u->Attrib = &WashGirlAttrib;
u->StateEnd = s_WashGirlStand;
u->Rot = 0;
@ -412,7 +414,7 @@ int DoWashGirl(DSWActor* actor)
PlaySound(DIGI_ANIMESING2, sp, v3df_dontpan, CHAN_AnimeSing);
}
ChangeSpriteState(SpriteNum,s_WashGirlStandScrub);
ChangeState(actor,s_WashGirlStandScrub);
u->ShellNum = RandomRange(2*120)+240;
}
else
@ -421,7 +423,7 @@ int DoWashGirl(DSWActor* actor)
{
if ((u->ShellNum -= ACTORMOVETICS) < 0)
{
ChangeSpriteState(SpriteNum,s_WashGirlStand);
ChangeState(actor,s_WashGirlStand);
u->ShellNum = 0;
}
}
@ -439,7 +441,7 @@ int DoWashGirl(DSWActor* actor)
else
PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_WashGirlUzi);
ChangeState(actor,s_WashGirlUzi);
u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0;
}
@ -482,7 +484,7 @@ int NullWashGirl(DSWActor* actor)
else
PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_WashGirlUzi);
ChangeState(actor,s_WashGirlUzi);
u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0;
}
@ -501,7 +503,7 @@ int WashGirlUzi(DSWActor* actor)
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{
u->WaitTics = RandomRange(240)+120;
ChangeSpriteState(SpriteNum,s_WashGirlStand);
ChangeState(actor,s_WashGirlStand);
u->FlagOwner = 0;
}
@ -515,7 +517,7 @@ int WashGirlPain(DSWActor* actor)
NullWashGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeSpriteState(SpriteNum,s_WashGirlStand);
ChangeState(actor,s_WashGirlStand);
return 0;
}
@ -569,7 +571,8 @@ STATE s_TrashCanPain[7] =
int
SetupTrashCan(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -586,7 +589,7 @@ SetupTrashCan(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_TrashCanStand);
ChangeState(actor,s_TrashCanStand);
u->Attrib = &TrashCanAttrib;
u->StateEnd = s_TrashCanStand;
u->Rot = 0;
@ -638,7 +641,7 @@ int TrashCanPain(DSWActor* actor)
KeepActorOnFloor(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeSpriteState(SpriteNum,s_TrashCanStand);
ChangeState(actor,s_TrashCanStand);
return 0;
}
@ -679,7 +682,8 @@ STATE s_PachinkoLightOperate[] =
int
SetupPachinkoLight(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -696,7 +700,7 @@ SetupPachinkoLight(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_PachinkoLightStand);
ChangeState(actor,s_PachinkoLightStand);
u->Attrib = &PachinkoLightAttrib;
u->StateEnd = s_PachinkoLightStand;
u->Rot = 0;
@ -723,7 +727,7 @@ int PachinkoLightOperate(DSWActor* actor)
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{
sp->shade = -2;
ChangeSpriteState(SpriteNum,s_PachinkoLightStand);
ChangeState(actor,s_PachinkoLightStand);
}
return 0;
}
@ -781,7 +785,8 @@ STATE s_Pachinko1Operate[] =
int
SetupPachinko1(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -798,7 +803,7 @@ SetupPachinko1(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_Pachinko1Stand);
ChangeState(actor,s_Pachinko1Stand);
u->Attrib = &Pachinko1Attrib;
u->StateEnd = s_Pachinko1Stand;
u->Rot = 0;
@ -953,7 +958,8 @@ STATE s_Pachinko2Operate[] =
int
SetupPachinko2(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -970,7 +976,7 @@ SetupPachinko2(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_Pachinko2Stand);
ChangeState(actor,s_Pachinko2Stand);
u->Attrib = &Pachinko2Attrib;
u->StateEnd = s_Pachinko2Stand;
u->Rot = 0;
@ -1037,7 +1043,8 @@ STATE s_Pachinko3Operate[] =
int
SetupPachinko3(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -1054,7 +1061,7 @@ SetupPachinko3(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_Pachinko3Stand);
ChangeState(actor,s_Pachinko3Stand);
u->Attrib = &Pachinko3Attrib;
u->StateEnd = s_Pachinko3Stand;
u->Rot = 0;
@ -1122,7 +1129,8 @@ STATE s_Pachinko4Operate[] =
int
SetupPachinko4(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -1139,7 +1147,7 @@ SetupPachinko4(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_Pachinko4Stand);
ChangeState(actor,s_Pachinko4Stand);
u->Attrib = &Pachinko4Attrib;
u->StateEnd = s_Pachinko4Stand;
u->Rot = 0;
@ -1235,7 +1243,8 @@ STATE s_CarGirlUzi[16] =
int
SetupCarGirl(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -1253,7 +1262,7 @@ SetupCarGirl(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_CarGirlStand);
ChangeState(actor,s_CarGirlStand);
u->Attrib = &CarGirlAttrib;
u->StateEnd = s_CarGirlStand;
u->Rot = 0;
@ -1300,7 +1309,7 @@ int DoCarGirl(DSWActor* actor)
else
PlaySound(DIGI_LANI054, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_CarGirlUzi);
ChangeState(actor,s_CarGirlUzi);
u->WaitTics = SEC(3)+SEC(RandomRange(2<<8)>>8);
u->FlagOwner = 0;
}
@ -1354,7 +1363,7 @@ int NullCarGirl(DSWActor* actor)
else
PlaySound(DIGI_LANI054, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_CarGirlUzi);
ChangeState(actor,s_CarGirlUzi);
u->WaitTics = SEC(3)+SEC(RandomRange(2<<8)>>8);
u->FlagOwner = 0;
}
@ -1373,7 +1382,7 @@ int CarGirlUzi(DSWActor* actor)
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{
u->WaitTics = RandomRange(240)+120;
ChangeSpriteState(SpriteNum,s_CarGirlStand);
ChangeState(actor,s_CarGirlStand);
u->FlagOwner = 0;
}
@ -1387,7 +1396,7 @@ int CarGirlPain(DSWActor* actor)
NullCarGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeSpriteState(SpriteNum,s_CarGirlStand);
ChangeState(actor,s_CarGirlStand);
return 0;
}
@ -1458,7 +1467,8 @@ STATE s_MechanicGirlDrill[2] =
int
SetupMechanicGirl(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -1476,7 +1486,7 @@ SetupMechanicGirl(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_MechanicGirlStand);
ChangeState(actor,s_MechanicGirlStand);
u->Attrib = &MechanicGirlAttrib;
u->StateEnd = s_MechanicGirlStand;
u->Rot = 0;
@ -1522,7 +1532,7 @@ int DoMechanicGirl(DSWActor* actor)
else
PlaySound(DIGI_LANI079, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_MechanicGirlDrill);
ChangeState(actor,s_MechanicGirlDrill);
u->WaitTics = SEC(1)+SEC(RandomRange(2<<8)>>8);
u->FlagOwner = 0;
}
@ -1576,7 +1586,7 @@ int NullMechanicGirl(DSWActor* actor)
else
PlaySound(DIGI_LANI079, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_MechanicGirlDrill);
ChangeState(actor,s_MechanicGirlDrill);
u->WaitTics = SEC(1)+SEC(RandomRange(2<<8)>>8);
u->FlagOwner = 0;
}
@ -1594,7 +1604,7 @@ int MechanicGirlDrill(DSWActor* actor)
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{
u->WaitTics = RandomRange(240)+120;
ChangeSpriteState(SpriteNum,s_MechanicGirlStand);
ChangeState(actor,s_MechanicGirlStand);
u->FlagOwner = 0;
}
@ -1609,7 +1619,7 @@ int MechanicGirlPain(DSWActor* actor)
NullMechanicGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeSpriteState(SpriteNum,s_MechanicGirlStand);
ChangeState(actor,s_MechanicGirlStand);
return 0;
}
@ -1680,7 +1690,8 @@ short alreadythrew;
int
SetupSailorGirl(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -1698,7 +1709,7 @@ SetupSailorGirl(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_SailorGirlStand);
ChangeState(actor,s_SailorGirlStand);
u->Attrib = &SailorGirlAttrib;
u->StateEnd = s_SailorGirlStand;
u->Rot = 0;
@ -1749,7 +1760,7 @@ int DoSailorGirl(DSWActor* actor)
else
PlaySound(DIGI_LANI066, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_SailorGirlThrow);
ChangeState(actor,s_SailorGirlThrow);
u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0;
}
@ -1808,7 +1819,7 @@ int NullSailorGirl(DSWActor* actor)
else
PlaySound(DIGI_LANI066, sp, v3df_dontpan, CHAN_AnimeMad);
}
ChangeSpriteState(SpriteNum,s_SailorGirlThrow);
ChangeState(actor,s_SailorGirlThrow);
u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0;
}
@ -1827,7 +1838,7 @@ int SailorGirlThrow(DSWActor* actor)
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{
u->WaitTics = RandomRange(240)+120;
ChangeSpriteState(SpriteNum,s_SailorGirlStand);
ChangeState(actor,s_SailorGirlStand);
u->FlagOwner = 0;
}
@ -1841,7 +1852,7 @@ int SailorGirlPain(DSWActor* actor)
NullSailorGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeSpriteState(SpriteNum,s_SailorGirlStand);
ChangeState(actor,s_SailorGirlStand);
return 0;
}
@ -1896,7 +1907,8 @@ STATE s_PruneGirlPain[2] =
int
SetupPruneGirl(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
@ -1914,7 +1926,7 @@ SetupPruneGirl(short SpriteNum)
EnemyDefaults(SpriteNum, nullptr, nullptr);
ChangeSpriteState(SpriteNum,s_PruneGirlStand);
ChangeState(actor,s_PruneGirlStand);
u->Attrib = &PruneGirlAttrib;
u->StateEnd = s_PruneGirlStand;
u->Rot = 0;
@ -2048,7 +2060,7 @@ int PruneGirlUzi(DSWActor* actor)
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{
u->WaitTics = RandomRange(240)+120;
ChangeSpriteState(SpriteNum,s_PruneGirlStand);
ChangeState(actor,s_PruneGirlStand);
u->FlagOwner = 0;
}
@ -2063,7 +2075,7 @@ int PruneGirlPain(DSWActor* actor)
NullPruneGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeSpriteState(SpriteNum,s_PruneGirlStand);
ChangeState(actor,s_PruneGirlStand);
return 0;
}

View file

@ -1862,14 +1862,14 @@ SetupNinja(short SpriteNum)
u->Attrib = &NinjaAttrib;
u->ActorActionSet = &NinjaActionSet;
u->Personality = &NinjaPersonality;
ChangeSpriteState(SpriteNum, s_NinjaCeiling[0]);
ChangeState(actor, s_NinjaCeiling[0]);
}
else
{
u->Attrib = &NinjaAttrib;
u->ActorActionSet = &NinjaSniperActionSet;
u->Personality = &NinjaSniperPersonality;
ChangeSpriteState(SpriteNum, s_NinjaDuck[0]);
ChangeState(actor, s_NinjaDuck[0]);
}
}
}
@ -1887,14 +1887,14 @@ SetupNinja(short SpriteNum)
u->Attrib = &NinjaAttrib;
u->ActorActionSet = &NinjaActionSet;
u->Personality = &NinjaPersonality;
ChangeSpriteState(SpriteNum, s_NinjaCeiling[0]);
ChangeState(actor, s_NinjaCeiling[0]);
}
else
{
u->Attrib = &NinjaAttrib;
u->ActorActionSet = &NinjaSniperActionSet;
u->Personality = &NinjaSniperPersonality;
ChangeSpriteState(SpriteNum, s_NinjaDuck[0]);
ChangeState(actor, s_NinjaDuck[0]);
}
}
}
@ -1926,11 +1926,11 @@ SetupNinja(short SpriteNum)
u->Attrib = &NinjaAttrib;
u->ActorActionSet = &NinjaSniperActionSet;
u->Personality = &NinjaSniperPersonality;
ChangeSpriteState(SpriteNum, s_NinjaDuck[0]);
ChangeState(actor, s_NinjaDuck[0]);
}
}
ChangeSpriteState(SpriteNum, s_NinjaRun[0]);
ChangeState(actor, s_NinjaRun[0]);
DoActorSetSpeed(actor, NORM_SPEED);
u->Radius = 280;
@ -1995,7 +1995,7 @@ DoNinjaGrabThroat(DSWActor* actor)
//SpawnBlood(SpriteNum, SpriteNum, -1, -1, -1, -1);
ChangeSpriteState(SpriteNum, u->StateEnd);
ChangeState(actor, u->StateEnd);
sp->xvel = 0;
//u->jump_speed = -300;
//DoActorBeginJump(actor);
@ -2386,9 +2386,10 @@ extern ACTOR_ACTION_SET PlayerNinjaActionSet;
void
PlayerSpriteLoadLevel(short SpriteNum)
{
USERp u = User[SpriteNum].Data();
auto actor = &swActors[SpriteNum];
USERp u = actor->u();
ChangeSpriteState(SpriteNum, s_NinjaRun[0]);
ChangeState(actor, s_NinjaRun[0]);
u->Rot = sg_NinjaRun;
u->ActorActionSet = &PlayerNinjaActionSet;
}

View file

@ -833,7 +833,7 @@ SetupRipper(short SpriteNum)
u->Health = HEALTH_RIPPER/2; // Baby rippers are weaker
}
ChangeSpriteState(SpriteNum, s_RipperRun[0]);
ChangeState(actor, s_RipperRun[0]);
u->Attrib = &RipperAttrib;
DoActorSetSpeed(actor, FAST_SPEED);
u->StateEnd = s_RipperDie;

View file

@ -901,7 +901,7 @@ SetupRipper2(short SpriteNum)
u->Health = HEALTH_RIPPER2;
}
ChangeSpriteState(SpriteNum, s_Ripper2Run[0]);
ChangeState(actor, s_Ripper2Run[0]);
u->Attrib = &Ripper2Attrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_Ripper2Die;

View file

@ -1799,7 +1799,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RandomRange(10));
ChangeSpriteState(SpriteNum,s_Pachinko1Operate);
ChangeState(actor,s_Pachinko1Operate);
return true;
@ -1810,7 +1810,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RandomRange(10));
ChangeSpriteState(SpriteNum,s_Pachinko2Operate);
ChangeState(actor,s_Pachinko2Operate);
return true;
@ -1821,7 +1821,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RandomRange(10));
ChangeSpriteState(SpriteNum,s_Pachinko3Operate);
ChangeState(actor,s_Pachinko3Operate);
return true;
@ -1832,7 +1832,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RandomRange(10));
ChangeSpriteState(SpriteNum,s_Pachinko4Operate);
ChangeState(actor,s_Pachinko4Operate);
return true;

View file

@ -717,7 +717,7 @@ SetupSerp(short SpriteNum)
if (Skill == 0) u->Health = 1100;
if (Skill == 1) u->Health = 2200;
ChangeSpriteState(SpriteNum, s_SerpRun[0]);
ChangeState(actor, s_SerpRun[0]);
u->Attrib = &SerpAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_SerpDie;

View file

@ -519,7 +519,7 @@ SetupSkel(short SpriteNum)
u->Health = HEALTH_SKEL_PRIEST;
}
ChangeSpriteState(SpriteNum, s_SkelRun[0]);
ChangeState(actor, s_SkelRun[0]);
u->Attrib = &SkelAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_SkelDie;

View file

@ -228,7 +228,7 @@ SetupSkull(short SpriteNum)
u->Health = HEALTH_SKULL;
}
ChangeSpriteState(SpriteNum, s_SkullWait[0]);
ChangeState(actor, s_SkullWait[0]);
u->Attrib = &SkullAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_SkullExplode;
@ -349,7 +349,7 @@ DoSkullBeginDeath(DSWActor* actor)
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
u->RotNum = 0;
u->Tics = 0;
// ChangeSpriteState(SpriteNum, u->StateEnd);
// ChangeState(actor, u->StateEnd);
//u->State = u->StateStart = u->StateEnd;
//u->State = u->StateEnd;
u->ID = SKULL_R0;
@ -653,7 +653,7 @@ SetupBetty(short SpriteNum)
u->Health = HEALTH_SKULL;
}
ChangeSpriteState(SpriteNum, s_BettyWait[0]);
ChangeState(actor, s_BettyWait[0]);
u->Attrib = &BettyAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_BettyExplode;
@ -769,7 +769,7 @@ DoBettyBeginDeath(DSWActor* actor)
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
u->RotNum = 0;
u->Tics = 0;
// ChangeSpriteState(SpriteNum, u->StateEnd);
// ChangeState(actor, u->StateEnd);
//u->State = u->StateStart = u->StateEnd;
//u->State = u->StateEnd;
u->ID = BETTY_R0;

View file

@ -818,6 +818,10 @@ void ChangeSpriteState(short SpriteNum, STATEp statep)
PicAnimOff(u->State->Pic);
}
void ChangeState(DSWActor* actor, STATEp statep)
{
ChangeSpriteState(actor->GetSpriteIndex(), statep);
}
void
change_sprite_stat(short SpriteNum, short stat)
{
@ -3187,7 +3191,7 @@ KeyMain:
//SET(sp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL);
ChangeSpriteState(SpriteNum, s_Key[num]);
ChangeState(actor, s_Key[num]);
RESET(picanm[sp->picnum].sf, PICANM_ANIMTYPE_MASK);
RESET(picanm[sp->picnum + 1].sf, PICANM_ANIMTYPE_MASK);
@ -3222,7 +3226,7 @@ KeyStatueMain:
sprite[SpriteNum].picnum = u->ID = sprite[SpriteNum].picnum;
u->spal = sp->pal;
ChangeSpriteState(SpriteNum, s_KeyStatue[num]);
ChangeState(actor, s_KeyStatue[num]);
RESET(picanm[sp->picnum].sf, PICANM_ANIMTYPE_MASK);
RESET(picanm[sp->picnum + 1].sf, PICANM_ANIMTYPE_MASK);
@ -4644,7 +4648,8 @@ int SpawnItemsMatch(short match)
if (!ItemSpotClear(sip, STAT_ITEM, s_Key[num]->Pic))
break;
SpriteNum = SpawnSprite(STAT_ITEM, s_Key[num]->Pic, s_Key[num], sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0);
auto actor = SpawnActor(STAT_ITEM, s_Key[num]->Pic, s_Key[num], sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0);
SpriteNum = actor->GetSpriteIndex();
u = User[SpriteNum].Data();
sp = &sprite[SpriteNum];
@ -4658,7 +4663,7 @@ int SpawnItemsMatch(short match)
//SET(sp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL);
ChangeSpriteState(SpriteNum, s_Key[num]);
ChangeState(actor, s_Key[num]);
RESET(picanm[sp->picnum].sf, PICANM_ANIMTYPE_MASK);
RESET(picanm[sp->picnum + 1].sf, PICANM_ANIMTYPE_MASK);
@ -5299,7 +5304,7 @@ DoCoin(DSWActor* actor)
if (u->StateStart != s_GreenCoin)
{
offset = int(u->State - u->StateStart);
ChangeSpriteState(SpriteNum, s_GreenCoin);
ChangeState(actor, s_GreenCoin);
u->State = u->StateStart + offset;
}
}
@ -5308,7 +5313,7 @@ DoCoin(DSWActor* actor)
if (u->StateStart != s_YellowCoin)
{
offset = int(u->State - u->StateStart);
ChangeSpriteState(SpriteNum, s_YellowCoin);
ChangeState(actor, s_YellowCoin);
u->State = u->StateStart + offset;
}
}

View file

@ -649,7 +649,7 @@ SetupSumo(short SpriteNum)
if (Skill == 0) u->Health = 2000;
if (Skill == 1) u->Health = 4000;
ChangeSpriteState(SpriteNum,s_SumoRun[0]);
ChangeState(actor,s_SumoRun[0]);
u->Attrib = &SumoAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_SumoDie;

View file

@ -2866,9 +2866,10 @@ STATEp UserStateSetup(short base_tile, short num_tiles)
int
SpawnShrap(short ParentNum, short Secondary)
{
SPRITEp parent = &sprite[ParentNum];
auto parentActor = &swActors[ParentNum];
SPRITEp parent = &parentActor->s();
SPRITEp sp;
USERp u, pu = User[ParentNum].Data();
USERp u, pu = parentActor->u();
short SpriteNum;
short i;
@ -3529,35 +3530,35 @@ AutoShrap:
p = WoodShrap;
shrap_xsize = shrap_ysize = 24;
shrap_bounce = true;
ChangeSpriteState(short(parent - sprite), s_BreakBarrel);
ChangeState(parentActor, s_BreakBarrel);
break;
case BREAK_LIGHT:
PlaySound(DIGI_BREAKGLASS,parent,v3df_dontpan|v3df_doppler);
p = GlassShrap;
shrap_xsize = shrap_ysize = 24;
shrap_bounce = true;
ChangeSpriteState(short(parent - sprite), s_BreakLight);
ChangeState(parentActor, s_BreakLight);
break;
case BREAK_PEDISTAL:
PlaySound(DIGI_BREAKSTONES,parent,v3df_dontpan|v3df_doppler);
p = StoneShrap;
shrap_xsize = shrap_ysize = 24;
shrap_bounce = true;
ChangeSpriteState(short(parent - sprite), s_BreakPedistal);
ChangeState(parentActor, s_BreakPedistal);
break;
case BREAK_BOTTLE1:
PlaySound(DIGI_BREAKGLASS,parent,v3df_dontpan|v3df_doppler);
p = GlassShrap;
shrap_xsize = shrap_ysize = 8;
shrap_bounce = true;
ChangeSpriteState(short(parent - sprite), s_BreakBottle1);
ChangeState(parentActor, s_BreakBottle1);
break;
case BREAK_BOTTLE2:
PlaySound(DIGI_BREAKGLASS,parent,v3df_dontpan|v3df_doppler);
p = GlassShrap;
shrap_xsize = shrap_ysize = 8;
shrap_bounce = true;
ChangeSpriteState(short(parent - sprite), s_BreakBottle2);
ChangeState(parentActor, s_BreakBottle2);
break;
case BREAK_MUSHROOM:
PlaySound(DIGI_BREAKDEBRIS,parent,v3df_dontpan|v3df_doppler);
@ -3907,7 +3908,7 @@ DoVomit(DSWActor* actor)
}
else
{
ChangeSpriteState(SpriteNum, s_VomitSplash);
ChangeState(actor, s_VomitSplash);
DoFindGroundPoint(SpriteNum);
MissileWaterAdjust(SpriteNum);
sp->z = u->loz;
@ -4012,7 +4013,7 @@ DoShrapJumpFall(DSWActor* actor)
}
if (u->ID == GORE_Drip)
ChangeSpriteState(SpriteNum, s_GoreFloorSplash);
ChangeState(actor, s_GoreFloorSplash);
else
ShrapKillSprite(SpriteNum);
}
@ -4897,14 +4898,15 @@ DoBreakFlames(DSWActor* actor)
int
SetSuicide(short SpriteNum)
{
USERp u = User[SpriteNum].Data();
auto actor = &swActors[SpriteNum];
USERp u = actor->u();
if (u != nullptr)
{
SET(u->Flags, SPR_SUICIDE);
u->RotNum = 0;
}
ChangeSpriteState(SpriteNum, s_Suicide);
ChangeState(actor, s_Suicide);
return 0;
}
@ -16798,7 +16800,7 @@ int DoCoolgDrip(DSWActor* actor)
{
sp->z = u->loz - u->floor_dist;
sp->yrepeat = sp->xrepeat = 32;
ChangeSpriteState(SpriteNum, s_GoreFloorSplash);
ChangeState(actor, s_GoreFloorSplash);
if (u->spal == PALETTE_BLUE_LIGHTING)
PlaySound(DIGI_DRIP, sp, v3df_none);
}
@ -20861,8 +20863,9 @@ SpawnShell(short SpriteNum, short ShellNum)
int
DoShrapVelocity(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum].Data();
auto actor = &swActors[SpriteNum];
USERp u = actor->u();
SPRITEp sp = &actor->s();
if (TEST(u->Flags, SPR_UNDERWATER) || SpriteInUnderwaterArea(sp))
{
@ -20955,7 +20958,7 @@ DoShrapVelocity(int16_t SpriteNum)
else
{
if (u->ID == GORE_Drip)
ChangeSpriteState(SpriteNum, s_GoreFloorSplash);
ChangeState(actor, s_GoreFloorSplash);
else
ShrapKillSprite(SpriteNum);
return true;
@ -21000,7 +21003,7 @@ DoShrapVelocity(int16_t SpriteNum)
else
{
if (u->ID == GORE_Drip)
ChangeSpriteState(SpriteNum, s_GoreFloorSplash);
ChangeState(actor, s_GoreFloorSplash);
else
ShrapKillSprite(SpriteNum);
return true;

View file

@ -65,6 +65,7 @@ extern short LoWangsQueueHead;
extern short LoWangsQueue[MAX_LOWANGS_QUEUE];
void ChangeSpriteState(short SpriteNum, STATEp statep);
void ChangeState(DSWActor* actor, STATEp statep);
void DoPlayerBeginRecoil(PLAYERp pp, short pix_amt);
SECTOR_OBJECTp DetectSectorObject(SECTORp);
SECTOR_OBJECTp DetectSectorObjectByWall(WALLp);

View file

@ -662,7 +662,7 @@ SetupZilla(short SpriteNum)
if (Skill == 0) u->Health = 2000;
if (Skill == 1) u->Health = 4000;
ChangeSpriteState(SpriteNum,s_ZillaRun[0]);
ChangeState(actor,s_ZillaRun[0]);
u->Attrib = &ZillaAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_ZillaDie;

View file

@ -765,7 +765,7 @@ SetupZombie(short SpriteNum)
u->Attrib = &ZombieAttrib;
EnemyDefaults(SpriteNum, &ZombieActionSet, &ZombiePersonality);
ChangeSpriteState(SpriteNum, s_ZombieRun[0]);
ChangeState(actor, s_ZombieRun[0]);
DoActorSetSpeed(actor, NORM_SPEED);
u->Radius = 280;