summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fc965d7)
raw | patch | inline | side by side (parent: fc965d7)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 29 Sep 2018 23:11:06 +0000 (02:11 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 29 Sep 2018 23:13:12 +0000 (02:13 +0300) |
WARNING! all weapon selection logic is done by The Server (including priorities), so
we cannot simply do it on a client and send a new weapon number (at least
not yet).
it means that client and server code should be in sync, and you have to
bump protocol version if weapon priorities changes.
we cannot simply do it on a client and send a new weapon number (at least
not yet).
it means that client and server code should be in sync, and you have to
bump protocol version if weapon priorities changes.
src/game/g_net.pas | patch | blob | history | |
src/game/g_netmsg.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index c15df2bae9406b2cc043fce515bdc11b113b21da..4eeeede0a00a347a32cbff1bec98f0c5321cdb8a 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
e_log, e_msg, ENet, Classes, MAPDEF{$IFDEF USE_MINIUPNPC}, miniupnpc;{$ELSE};{$ENDIF}
const
- NET_PROTOCOL_VER = 174;
+ NET_PROTOCOL_VER = 175;
NET_MAXCLIENTS = 24;
NET_CHANS = 11;
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index a7ff31a9639fe68fdf2efdae7e308b54a1683a5d..01dcc3ce0182044baf67cbcef01a4b57c49e7802 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
end;
gPlayer1.ReleaseKeys;
+ gPlayer1.weaponSwitchKeysStateChange(-1, isKeyPressed(KeyNextWeapon, KeyNextWeapon2));
+ gPlayer1.weaponSwitchKeysStateChange(-2, isKeyPressed(KeyPrevWeapon, KeyPrevWeapon2));
+
if P1MoveButton = 1 then
begin
kByte := kByte or NET_KEY_LEFT;
end;
if isKeyPressed(KeyFire, KeyFire2) then kByte := kByte or NET_KEY_FIRE;
if isKeyPressed(KeyOpen, KeyOpen2) then kByte := kByte or NET_KEY_OPEN;
- if isKeyPressed(KeyNextWeapon, KeyNextWeapon2) then kByte := kByte or NET_KEY_NW;
- if isKeyPressed(KeyPrevWeapon, KeyPrevWeapon2) then kByte := kByte or NET_KEY_PW;
+ if isKeyPressed(KeyNextWeapon, KeyNextWeapon2) and gPlayer1.isWeaponSwitchKeyReleased(-1) then kByte := kByte or NET_KEY_NW;
+ if isKeyPressed(KeyPrevWeapon, KeyPrevWeapon2) and gPlayer1.isWeaponSwitchKeyReleased(-2) then kByte := kByte or NET_KEY_PW;
for I := 0 to High(KeyWeapon) do
+ begin
if isKeyPressed(KeyWeapon[I], KeyWeapon2[I]) then
- WeaponSelect := WeaponSelect or Word(1 shl I);
+ begin
+ gPlayer1.weaponSwitchKeysStateChange(i, true);
+ if gPlayer1.isWeaponSwitchKeyReleased(i) then WeaponSelect := WeaponSelect or Word(1 shl I);
+ end
+ else
+ begin
+ gPlayer1.weaponSwitchKeysStateChange(i, false);
+ end;
+ end;
end;
// fix movebutton state
P1MoveButton := P1MoveButton or (strafeDir shl 4);
else
kByte := NET_KEY_CHAT;
+ gPlayer1.weaponSwitchKeysShiftNewStates();
+
NetOut.Write(Byte(NET_MSG_PLRPOS));
NetOut.Write(gTime);
NetOut.Write(kByte);
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 39aab01deb75a5bac5e5fc59dcbe16f5551e82c4..4604b3c95f5a1f9ed2250ebed552b4e5ffc53f23 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
Result := True;
remove := True;
FFireTime := 0;
+ //k8:do we need it? if g_Game_IsNet and g_Game_IsServer then MH_SEND_PlayerStats(FUID);
end;
if FHealth < PLAYER_HP_SOFT then
begin