summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a0bb6d)
raw | patch | inline | side by side (parent: 8a0bb6d)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 2 Oct 2018 03:17:54 +0000 (06:17 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 2 Oct 2018 03:18:12 +0000 (06:18 +0300) |
src/game/g_netmsg.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index f235035fbda6d740146eb383d07d4e66e740948f..e9cc68c2ee55ac7fcb0067073ed725ecdedd6e9e 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
writeln('HOST PLRPOS: got: currweap=', CurrWeap, '; curfrm=', gTime, '; netweap=', newweapon, '; oldweap=', CurrWeap);
{$ENDIF}
//NetForceWeap := newweapon;
- SetWeapon(newweapon);
+ SetWeaponHost(newweapon);
end;
//e_WriteLog(Format('R:ws=%d', [WeaponSelect]), MSG_WARNING);
if Direction <> TDirection(Dir) then
if (gTime >= NetForceWeapFIdx) then
begin
//NetForceWeap := newweapon;
- SetWeapon(newweapon);
+ SetWeaponHost(newweapon);
end;
//SetWeapon(M.ReadByte());
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 0565c75b2761056ab75ca321ac9c3d6c556cd480..66f0099063c3027084c4b32418d174acf77ed4e3 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
procedure ReleaseKeysNoWeapon();
procedure SetModel(ModelName: String);
procedure SetColor(Color: TRGB);
- procedure SetWeapon(W: Byte);
+ procedure SetWeaponHost(W: Byte);
function IsKeyPressed(K: Byte): Boolean;
function GetKeys(): Byte;
function PickItem(ItemType: Byte; arespawn: Boolean; var remove: Boolean): Boolean; virtual;
FNextWeap := $4000;
end;
-// used by network layer
-procedure TPlayer.SetWeapon(W: Byte);
+// used exclusively by network layer
+procedure TPlayer.SetWeaponHost(W: Byte);
begin
+ if (W > High(FWeapon)) then exit;
+ if (not FWeapon[W]) then exit; // server is authority!
+
if FCurrWeap <> W then
if (W = WEAPON_SAW) then
FSawSoundSelect.PlayAt(FObj.X, FObj.Y);