diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index ea5c6d4fd..876f20213 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -233,7 +233,7 @@ void donewgame(MapRecord* map, int sk); void startnewgame(MapRecord* map, int skill); int playercolor2lookup(int color); void PlayerColorChanged(void); -bool movementBlocked(int snum); +bool movementBlocked(player_struct *p); void loadcons(); void recordoldspritepos(); diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 990076398..d582561c5 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -767,12 +767,11 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I // //--------------------------------------------------------------------------- -static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle) +static void FinalizeInput(player_struct *p, InputPacket& input, bool vehicle) { - auto p = &ps[playerNum]; - bool blocked = movementBlocked(playerNum) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god); + bool blocked = movementBlocked(p) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god); - if (blocked && ps[playerNum].newOwner == nullptr) + if (blocked && p->newOwner == nullptr) { // neutralize all movement when blocked or in automap follow mode loc.fvel = loc.svel = 0; @@ -842,7 +841,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) processMovement(&input, &loc, hidInput, scaleAdjust, p->drink_amt); } - FinalizeInput(myconnectindex, input, rrraVehicle); + FinalizeInput(p, input, rrraVehicle); if (!SyncInput()) { diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index be4dbea6d..c6762cf70 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -944,20 +944,18 @@ void playerAimDown(int snum, ESyncBits actions) // //--------------------------------------------------------------------------- -bool movementBlocked(int snum) +bool movementBlocked(player_struct *p) { - auto p = &ps[snum]; - auto blockingweapon = [=]() { if (isRR()) return false; - if (isWW2GI()) return aplWeaponWorksLike[p->curr_weapon][snum] == TRIPBOMB_WEAPON; + if (isWW2GI()) return aplWeaponWorksLike[p->curr_weapon][p->i] == TRIPBOMB_WEAPON; else return p->curr_weapon == TRIPBOMB_WEAPON; }; auto weapondelay = [=]() { - if (isWW2GI()) return aplWeaponFireDelay[p->curr_weapon][snum]; + if (isWW2GI()) return aplWeaponFireDelay[p->curr_weapon][p->i]; else return 4; }; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 9ba455aae..a1b80ab2a 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2893,7 +2893,7 @@ void processinput_d(int snum) //Do the quick lefts and rights - if (movementBlocked(snum)) + if (movementBlocked(p)) { doubvel = 0; p->posxv = 0; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 2e55f3ab7..86f22b688 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3646,7 +3646,7 @@ void processinput_r(int snum) //Do the quick lefts and rights - if (movementBlocked(snum)) + if (movementBlocked(p)) { doubvel = 0; p->posxv = 0;