From 5e66a3331d770c8ba69dd87245ba638664acae0a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 18 Nov 2021 20:01:33 +0100 Subject: [PATCH] - getanimationgoal. --- source/games/duke/src/actors.cpp | 6 +++--- source/games/duke/src/bowling.cpp | 8 ++++---- source/games/duke/src/funct.h | 2 +- source/games/duke/src/player_r.cpp | 2 +- source/games/duke/src/sectors.cpp | 11 ++++++----- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 2685bd8a0..568801712 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -3503,7 +3503,7 @@ void handle_se08(DDukeActor *actor, bool checkhitag1) } j = 1; } - else j = getanimationgoal(anim_ceilingz, s->sectnum); + else j = getanimationgoal(anim_ceilingz, s->sector()); if (j >= 0) { @@ -3592,7 +3592,7 @@ void handle_se10(DDukeActor* actor, const int* specialtags) { if (specialtags) for (int i = 0; specialtags[i]; i++) { - if (s->sector()->lotag == specialtags[i] && getanimationgoal(anim_ceilingz, s->sectnum) >= 0) + if (s->sector()->lotag == specialtags[i] && getanimationgoal(anim_ceilingz, s->sector()) >= 0) { return; } @@ -4342,7 +4342,7 @@ void handle_se22(DDukeActor* actor) auto sc = actor->getSector(); if (t[1]) { - if (getanimationgoal(anim_ceilingz, t[0]) >= 0) + if (getanimationgoal(anim_ceilingz, §or[t[0]]) >= 0) sc->ceilingz += sc->extra * 9; else t[1] = 0; } diff --git a/source/games/duke/src/bowling.cpp b/source/games/duke/src/bowling.cpp index f1738a1b6..963321cff 100644 --- a/source/games/duke/src/bowling.cpp +++ b/source/games/duke/src/bowling.cpp @@ -59,11 +59,11 @@ void ballreturn(DDukeActor *ball) void pinsectorresetdown(int sect) { - int j = getanimationgoal(anim_ceilingz, sect); + auto sec = §or[sect]; + int j = getanimationgoal(anim_ceilingz, sec); if (j == -1) { - auto sec = §or[sect]; j = sec->floorz; setanimation(sec, anim_ceilingz, sec, j, 64); } @@ -71,11 +71,11 @@ void pinsectorresetdown(int sect) int pinsectorresetup(int sect) { - int j = getanimationgoal(anim_ceilingz, sect); + auto sec = §or[sect]; + int j = getanimationgoal(anim_ceilingz, sec); if (j == -1) { - auto sec = §or[sect]; j = nextsectorneighborzptr(sec, sec->ceilingz, -1, -1)->ceilingz; setanimation(sec, anim_ceilingz, sec, j, 64); return 1; diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index b829295cf..61be4d07e 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -150,7 +150,7 @@ void operateforcefields_common(DDukeActor* s, int low, const std::initializer_li void operatemasterswitches(int lotag); void operatesectors(sectortype* s, DDukeActor* i); void hud_input(int playerNum); -int getanimationgoal(int animtype, int animindex); +int getanimationgoal(int animtype, sectortype* animindex); bool isanearoperator(int lotag); bool isanunderoperator(int lotag); int setanimation(sectortype* animsect, int animtype, walltype* animtarget, int thegoal, int thevel); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 38f0955ee..0f0c590b4 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3569,7 +3569,7 @@ void processinput_r(int snum) if (psectlotag == ST_17_PLATFORM_UP || (isRRRA() && psectlotag == ST_18_ELEVATOR_DOWN)) { int tmp; - tmp = getanimationgoal(anim_floorz, p->cursectnum); + tmp = getanimationgoal(anim_floorz, p->cursector()); if (tmp >= 0) { if (!S_CheckActorSoundPlaying(pact, 432)) diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index fa0e6fb4c..7663fdceb 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -375,11 +375,12 @@ void doanimations(void) // //--------------------------------------------------------------------------- -int getanimationgoal(int animtype, int animtarget) +int getanimationgoal(int animtype, sectortype* animtargetp) { int i, j; j = -1; + int animtarget = sectnum(animtargetp); for (i = animatecnt - 1; i >= 0; i--) if (animtype == animatetype[i] && animtarget == animatetarget[i]) { @@ -620,7 +621,7 @@ static void handle_st15(sectortype* sptr, DDukeActor* actor) static void handle_st16(sectortype* sptr, DDukeActor* actor) { - int i = getanimationgoal(anim_floorz, sectnum(sptr)); + int i = getanimationgoal(anim_floorz, sptr); sectortype* sectp; if (i == -1) @@ -648,7 +649,7 @@ static void handle_st16(sectortype* sptr, DDukeActor* actor) static void handle_st18(sectortype* sptr, DDukeActor* actor) { - int i = getanimationgoal(anim_floorz, sectnum(sptr)); + int i = getanimationgoal(anim_floorz, sptr); if (i == -1) { @@ -751,7 +752,7 @@ REDODOOR: static void handle_st21(sectortype* sptr, DDukeActor* actor) { - int i = getanimationgoal(anim_floorz, sectnum(sptr)); + int i = getanimationgoal(anim_floorz, sptr); int j; if (i >= 0) { @@ -998,7 +999,7 @@ void operatesectors(sectortype* sptr, DDukeActor *actor) break; } case ST_26_SPLITTING_ST_DOOR: //The split doors - i = getanimationgoal(anim_ceilingz, sectnum(sptr)); + i = getanimationgoal(anim_ceilingz, sptr); if (i == -1) //if the door has stopped { haltsoundhack = 1;