From ad0ed0c37716d25ba0b5f1282066a3830c66444e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 29 Oct 2021 22:34:54 +0200 Subject: [PATCH] - KeepActorOnFloor --- source/games/sw/src/actor.cpp | 8 +++---- source/games/sw/src/bunny.cpp | 8 +++---- source/games/sw/src/coolie.cpp | 8 +++---- source/games/sw/src/girlninj.cpp | 4 ++-- source/games/sw/src/goro.cpp | 4 ++-- source/games/sw/src/lava.cpp | 4 ++-- source/games/sw/src/misc.h | 2 +- source/games/sw/src/miscactr.cpp | 40 ++++++++++++++++---------------- source/games/sw/src/ninja.cpp | 4 ++-- source/games/sw/src/ripper.cpp | 2 +- source/games/sw/src/ripper2.cpp | 2 +- source/games/sw/src/serp.cpp | 4 ++-- source/games/sw/src/skel.cpp | 4 ++-- source/games/sw/src/sumo.cpp | 4 ++-- source/games/sw/src/zilla.cpp | 6 ++--- source/games/sw/src/zombie.cpp | 4 ++-- 16 files changed, 54 insertions(+), 54 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index e86d33a36..97e53d18d 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -520,11 +520,11 @@ int DoGenerateSewerDebris(DSWActor* actor) // !AIC - Tries to keep actors correctly on the floor. More that a bit messy. -void -KeepActorOnFloor(short SpriteNum) +void KeepActorOnFloor(DSWActor* actor) { - USERp u = User[SpriteNum].Data(); - SPRITEp sp = User[SpriteNum]->SpriteP; + USERp u = actor->u(); + SPRITEp sp = &actor->s(); + int SpriteNum = actor->GetSpriteIndex(); SECTORp sectp; int depth; diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index d00e0b2cc..e1eef1c2f 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -1114,7 +1114,7 @@ NullBunny(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(actor); @@ -1364,7 +1364,7 @@ DoBunnyMove(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); @@ -1433,7 +1433,7 @@ DoBunnyEat(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); @@ -1479,7 +1479,7 @@ DoBunnyScrew(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index dcd0a2745..cbb865d10 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -468,7 +468,7 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso DoActorZrange(SpriteNum); - //KeepActorOnFloor(SpriteNum); // for swimming actors + //KeepActorOnFloor(actor); // for swimming actors // make sure we start in the water if thats where we are if (u->lo_sectp) // && SectUser[u->lo_sectp - sector]) @@ -585,7 +585,7 @@ int CooliePain(DSWActor* actor) DoActorSlide(actor); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); @@ -604,7 +604,7 @@ int NullCoolie(DSWActor* actor) DoActorSlide(actor); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); @@ -625,7 +625,7 @@ int DoCoolieMove(DSWActor* actor) else (*u->ActorActionFunc)(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (DoActorSectorDamage(actor)) { diff --git a/source/games/sw/src/girlninj.cpp b/source/games/sw/src/girlninj.cpp index 402d09460..4bc049ba7 100644 --- a/source/games/sw/src/girlninj.cpp +++ b/source/games/sw/src/girlninj.cpp @@ -779,7 +779,7 @@ DoGirlNinjaMove(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -826,7 +826,7 @@ NullGirlNinja(DSWActor* actor) DoActorSlide(actor); if (!TEST(u->Flags, SPR_CLIMBING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); diff --git a/source/games/sw/src/goro.cpp b/source/games/sw/src/goro.cpp index 61a4f4d31..866c92cee 100644 --- a/source/games/sw/src/goro.cpp +++ b/source/games/sw/src/goro.cpp @@ -521,7 +521,7 @@ int NullGoro(DSWActor* actor) if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); return 0; @@ -553,7 +553,7 @@ int DoGoroMove(DSWActor* actor) ASSERT(User[SpriteNum].Data()); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); return 0; diff --git a/source/games/sw/src/lava.cpp b/source/games/sw/src/lava.cpp index d6651a87a..da762f8ff 100644 --- a/source/games/sw/src/lava.cpp +++ b/source/games/sw/src/lava.cpp @@ -493,7 +493,7 @@ int NullLava(DSWActor* actor) if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); return 0; @@ -512,7 +512,7 @@ int DoLavaMove(DSWActor* actor) else (*u->ActorActionFunc)(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); return 0; diff --git a/source/games/sw/src/misc.h b/source/games/sw/src/misc.h index 298f6ae69..6a07c5948 100644 --- a/source/games/sw/src/misc.h +++ b/source/games/sw/src/misc.h @@ -84,7 +84,7 @@ int DoBeginJump(short SpriteNum); int DoJump(short SpriteNum); int DoBeginFall(short SpriteNum); int DoFall(short SpriteNum); -void KeepActorOnFloor(short SpriteNum); +void KeepActorOnFloor(DSWActor* actor); int DoActorSlide(DSWActor* actor); int DoActorSectorDamage(DSWActor* actor); int DoScaleSprite(DSWActor* actor); diff --git a/source/games/sw/src/miscactr.cpp b/source/games/sw/src/miscactr.cpp index 8d694f070..8835bcec4 100644 --- a/source/games/sw/src/miscactr.cpp +++ b/source/games/sw/src/miscactr.cpp @@ -198,7 +198,7 @@ int DoToiletGirl(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -219,7 +219,7 @@ int NullToiletGirl(DSWActor* actor) ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (u->FlagOwner != 1) { @@ -247,7 +247,7 @@ int ToiletGirlUzi(DSWActor* actor) int SpriteNum = u->SpriteNum; if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if ((u->WaitTics -= ACTORMOVETICS) <= 0) { @@ -447,7 +447,7 @@ int DoWashGirl(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -468,7 +468,7 @@ int NullWashGirl(DSWActor* actor) ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (u->FlagOwner != 1) { @@ -496,7 +496,7 @@ int WashGirlUzi(DSWActor* actor) int SpriteNum = u->SpriteNum; if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if ((u->WaitTics -= ACTORMOVETICS) <= 0) { @@ -618,7 +618,7 @@ int DoTrashCan(DSWActor* actor) if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } sp->xvel = sp->yvel = sp->zvel = 0; @@ -635,7 +635,7 @@ int TrashCanPain(DSWActor* actor) DoActorSlide(actor); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if ((u->WaitTics -= ACTORMOVETICS) <= 0) ChangeState(SpriteNum,s_TrashCanStand); @@ -1312,7 +1312,7 @@ int DoCarGirl(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -1333,7 +1333,7 @@ int NullCarGirl(DSWActor* actor) ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (u->FlagOwner != 1) { @@ -1368,7 +1368,7 @@ int CarGirlUzi(DSWActor* actor) int SpriteNum = u->SpriteNum; if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if ((u->WaitTics -= ACTORMOVETICS) <= 0) { @@ -1534,7 +1534,7 @@ int DoMechanicGirl(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -1555,7 +1555,7 @@ int NullMechanicGirl(DSWActor* actor) ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (u->FlagOwner != 1) { @@ -1589,7 +1589,7 @@ int MechanicGirlDrill(DSWActor* actor) USER* u = actor->u(); int SpriteNum = u->SpriteNum; if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if ((u->WaitTics -= ACTORMOVETICS) <= 0) { @@ -1761,7 +1761,7 @@ int DoSailorGirl(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -1783,7 +1783,7 @@ int NullSailorGirl(DSWActor* actor) ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (u->FlagOwner != 1) { @@ -1822,7 +1822,7 @@ int SailorGirlThrow(DSWActor* actor) int SpriteNum = u->SpriteNum; if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if ((u->WaitTics -= ACTORMOVETICS) <= 0) { @@ -1988,7 +1988,7 @@ int DoPruneGirl(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -2009,7 +2009,7 @@ int NullPruneGirl(DSWActor* actor) ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (u->FlagOwner != 1) { @@ -2043,7 +2043,7 @@ int PruneGirlUzi(DSWActor* actor) int SpriteNum = u->SpriteNum; if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if ((u->WaitTics -= ACTORMOVETICS) <= 0) { diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 4e6ce93ed..9c29311a4 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -2049,7 +2049,7 @@ DoNinjaMove(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -2103,7 +2103,7 @@ NullNinja(DSWActor* actor) DoActorSlide(actor); if (!TEST(u->Flags, SPR_CLIMBING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index 684eacb4a..ed67d3228 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -1313,7 +1313,7 @@ DoRipperMove(DSWActor* actor) if (DoRipperQuickJump(actor)) return 0; - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } if (TEST(u->Flags, SPR_SLIDING)) diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 25740829d..5cfea64b3 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -1331,7 +1331,7 @@ DoRipper2Move(DSWActor* actor) if (DoRipper2QuickJump(actor)) return 0; - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } if (TEST(u->Flags, SPR_SLIDING)) diff --git a/source/games/sw/src/serp.cpp b/source/games/sw/src/serp.cpp index 017fbe382..94a6b4f9f 100644 --- a/source/games/sw/src/serp.cpp +++ b/source/games/sw/src/serp.cpp @@ -761,7 +761,7 @@ int NullSerp(DSWActor* actor) if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); //DoActorSectorDamage(actor); return 0; @@ -804,7 +804,7 @@ int DoSerpMove(DSWActor* actor) } } - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); //DoActorSectorDamage(actor); return 0; diff --git a/source/games/sw/src/skel.cpp b/source/games/sw/src/skel.cpp index 283df6d72..02a3c5dd1 100644 --- a/source/games/sw/src/skel.cpp +++ b/source/games/sw/src/skel.cpp @@ -599,7 +599,7 @@ int NullSkel(DSWActor* actor) if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); return 0; @@ -631,7 +631,7 @@ int DoSkelMove(DSWActor* actor) else (*u->ActorActionFunc)(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); diff --git a/source/games/sw/src/sumo.cpp b/source/games/sw/src/sumo.cpp index da5e20cd4..3c1b08b09 100644 --- a/source/games/sw/src/sumo.cpp +++ b/source/games/sw/src/sumo.cpp @@ -685,7 +685,7 @@ int NullSumo(DSWActor* actor) //DoActorSlide(actor); if (!TEST(u->Flags,SPR_CLIMBING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor); @@ -705,7 +705,7 @@ int DoSumoMove(DSWActor* actor) else (*u->ActorActionFunc)(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (DoActorSectorDamage(actor)) { diff --git a/source/games/sw/src/zilla.cpp b/source/games/sw/src/zilla.cpp index 0d5b39ec2..878b20fc1 100644 --- a/source/games/sw/src/zilla.cpp +++ b/source/games/sw/src/zilla.cpp @@ -698,7 +698,7 @@ int NullZilla(DSWActor* actor) #endif //if (!TEST(u->Flags,SPR_CLIMBING)) - // KeepActorOnFloor(SpriteNum); + // KeepActorOnFloor(actor); getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz); u->lo_sectp = §or[sp->sectnum]; u->hi_sectp = §or[sp->sectnum]; @@ -741,7 +741,7 @@ int DoZillaMove(DSWActor* actor) else (*u->ActorActionFunc)(actor); - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); if (DoActorSectorDamage(actor)) { @@ -783,7 +783,7 @@ int DoZillaDeathMelt(DSWActor* actor) PlaySong(currentLevel->music, currentLevel->cdSongId); } - //KeepActorOnFloor(SpriteNum); + //KeepActorOnFloor(actor); getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz); u->lo_sectp = §or[sp->sectnum]; u->hi_sectp = §or[sp->sectnum]; diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 5e6382a41..920b67191 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -921,7 +921,7 @@ DoZombieMove(DSWActor* actor) // stay on floor unless doing certain things if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); } // take damage from environment @@ -955,7 +955,7 @@ NullZombie(DSWActor* actor) DoActorSlide(actor); if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING)) - KeepActorOnFloor(SpriteNum); + KeepActorOnFloor(actor); DoActorSectorDamage(actor);