From 9d60dd61d82b1b75e22869d0396a8ee487aa9d5a Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sun, 6 Aug 2017 15:31:39 +0300 Subject: [PATCH] fixed bug with weapon cycling direction --- src/game/g_player.pas | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/game/g_player.pas b/src/game/g_player.pas index d7f305e..bfba263 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -1271,8 +1271,11 @@ begin for i := 0 to High(gPlayers) do if gPlayers[i] <> nil then + begin + gPlayers[i].RealizeCurrentWeapon(); if gPlayers[i] is TPlayer then gPlayers[i].Update() else TBot(gPlayers[i]).Update(); + end; end; procedure g_Player_DrawAll(); @@ -3359,13 +3362,11 @@ procedure TPlayer.cycleWeapon (dir: Integer); var i, cwi: Integer; begin - if dir < 0 then dir := 1 else if dir > 0 then dir := 1 else exit; + if dir < 0 then dir := -1 else if dir > 0 then dir := 1 else exit; cwi := FCurrWeap; for i := 0 to High(FWeapon) do begin - cwi := cwi+dir; - if cwi < 0 then cwi += length(FWeapon) - else if cwi > High(FWeapon) then cwi := cwi-length(FWeapon); + cwi := (cwi+length(FWeapon)+dir) mod length(FWeapon); if FWeapon[cwi] then begin QueueWeaponSwitch(Byte(cwi)); -- 2.29.2