X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_netmsg.pas;h=01dcc3ce0182044baf67cbcef01a4b57c49e7802;hb=71bc9a3606d5d13ecd76a3e0dca5b35fe1192d7d;hp=f17c0ed40a2c1c4742b0cea5499117a52abc7d1c;hpb=bd64003336a7e3bb6fb8b3fd93d4ed2c7bc13f3b;p=d2df-sdl.git diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index f17c0ed..01dcc3c 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -2759,6 +2759,9 @@ begin 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; @@ -2786,11 +2789,20 @@ begin 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); @@ -2798,6 +2810,8 @@ begin else kByte := NET_KEY_CHAT; + gPlayer1.weaponSwitchKeysShiftNewStates(); + NetOut.Write(Byte(NET_MSG_PLRPOS)); NetOut.Write(gTime); NetOut.Write(kByte); @@ -3014,10 +3028,10 @@ var mapDataMsg: TMapDataMsg; begin e_WriteLog('NET: Received map request from ' + - DecodeIPV4(C.Peer.address.host), TMsgType.Notify); + DecodeIPV4(C^.Peer.address.host), TMsgType.Notify); mapDataMsg := CreateMapDataMsg(MapsDir + gGameSettings.WAD, gExternalResources); - peer := NetClients[C.ID].Peer; + peer := NetClients[C^.ID].Peer; MapDataMsgToBytes(payload, mapDataMsg); g_Net_SendData(payload, peer, True, NET_CHAN_DOWNLOAD); @@ -3036,7 +3050,7 @@ var begin FileName := ExtractFileName(M.ReadString()); e_WriteLog('NET: Received res request: ' + FileName + - ' from ' + DecodeIPV4(C.Peer.address.host), TMsgType.Notify); + ' from ' + DecodeIPV4(C^.Peer.address.host), TMsgType.Notify); if not IsValidFilePath(FileName) then begin @@ -3044,7 +3058,7 @@ begin exit; end; - peer := NetClients[C.ID].Peer; + peer := NetClients[C^.ID].Peer; if gExternalResources.IndexOf(FileName) > -1 then begin