diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index d7f305e68757bfb287d836b28dab9d398497155b..5430ba709c848c985c8d6c5ffedafe296143c09d 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
for i := 0 to High(gPlayers) do
if gPlayers[i] <> nil then
- if gPlayers[i] is TPlayer then gPlayers[i].Update()
- else TBot(gPlayers[i]).Update();
+ begin
+ if gPlayers[i] is TPlayer then
+ begin
+ gPlayers[i].Update();
+ gPlayers[i].RealizeCurrentWeapon(); // WARNING! DO NOT MOVE THIS INTO `Update()`!
+ end
+ else
+ begin
+ // bot updates weapons in `UpdateCombat()`
+ TBot(gPlayers[i]).Update();
+ end;
+ end;
end;
procedure g_Player_DrawAll();
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));
begin
UpdateMove();
UpdateCombat();
+ end
+ else
+ begin
+ RealizeCurrentWeapon();
end;
end;