X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_netmsg.pas;h=910a480a78d25b4073593853012ef1a7d8e6a5b4;hb=3bc93c7ecd534237343aaa3b83dca053c53b9bc5;hp=5b92f2fc1e6d2d48db394bbf9881d1b60c73b8c4;hpb=ee582ed196b2c56776d407e22bdaaffc5b1ac6ff;p=d2df-sdl.git diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index 5b92f2f..910a480 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -380,6 +380,10 @@ procedure MH_RECV_Info(C: pTNetClient; var M: TMsg); var Ver, PName, Model, Pw: string; R, G, B, T: Byte; + WeapSwitch: Byte; + TmpPrefArray: Array [WP_FIRST .. WP_LAST + 1] of Byte; + SwitchEmpty: Byte; + SkipF: Byte; PID: Word; Color: TRGB; I: Integer; @@ -395,6 +399,12 @@ begin G := M.ReadByte(); B := M.ReadByte(); T := M.ReadByte(); + WeapSwitch := M.ReadByte(); + if (WeapSwitch = 2) then + for I := WP_FIRST to WP_LAST + 1 do + TmpPrefArray[I] := M.ReadByte(); + SwitchEmpty := M.ReadByte(); + SkipF := M.ReadByte(); except Err := True; end; @@ -450,6 +460,11 @@ begin with g_Player_Get(PID) do begin Name := PName; + WeapSwitchMode := WeapSwitch; + if (WeapSwitch = 2) then + SetWeaponPrefs(TmpPrefArray); + SwitchToEmpty := SwitchEmpty; + SkipFist := SkipF; Reset(True); end; @@ -700,6 +715,11 @@ var TmpModel: string; TmpColor: TRGB; TmpTeam: Byte; + TmpWeapSwitch: Byte; + TmpPrefArray: Array [WP_FIRST .. WP_LAST + 1] of Byte; + TmpSwEmpty: Byte; + TmpSkipF: Byte; + I: Integer; Pl: TPlayer; Err: Boolean; begin @@ -711,6 +731,12 @@ begin TmpColor.G := M.ReadByte(); TmpColor.B := M.ReadByte(); TmpTeam := M.ReadByte(); + TmpWeapSwitch := M.ReadByte(); + if (TmpWeapSwitch = 2) then + for I := WP_FIRST to WP_LAST + 1 do + TmpPrefArray[I] := M.ReadByte(); + TmpSwEmpty := M.ReadByte(); + TmpSkipF := M.ReadByte(); except Err := True; end; @@ -734,6 +760,18 @@ begin if TmpModel <> Pl.Model.Name then Pl.SetModel(TmpModel); + if (TmpWeapSwitch <> Pl.WeapSwitchMode) then + Pl.WeapSwitchMode := TmpWeapSwitch; + + if (TmpWeapSwitch = 2) then + Pl.SetWeaponPrefs(TmpPrefArray); + + if (TmpSwEmpty <> Pl.SwitchToEmpty) then + Pl.SwitchToEmpty := TmpSwEmpty; + + if (TmpSkipF <> Pl.SkipFist) then + Pl.SkipFist := TmpSkipF; + MH_SEND_PlayerSettings(Pl.UID, TmpModel); end; @@ -2647,6 +2685,7 @@ var TmpModel: string; TmpColor: TRGB; TmpTeam: Byte; + i: Integer; Pl: TPlayer; PID: Word; begin @@ -3111,6 +3150,7 @@ end; // CLIENT SEND procedure MC_SEND_Info(Password: string); +var i: Integer; begin NetOut.Clear(); @@ -3123,6 +3163,12 @@ begin NetOut.Write(gPlayer1Settings.Color.G); NetOut.Write(gPlayer1Settings.Color.B); NetOut.Write(gPlayer1Settings.Team); + NetOut.Write(gPlayer1Settings.WeaponSwitch); + if (gPlayer1Settings.WeaponSwitch = 2) then + for i := WP_FIRST to WP_LAST + 1 do + NetOut.Write(gPlayer1Settings.WeaponPreferences[i]); + NetOut.Write(gPlayer1Settings.SwitchToEmpty); + NetOut.Write(gPlayer1Settings.SkipFist); g_Net_Client_Send(True, NET_CHAN_SERVICE); end; @@ -3262,6 +3308,7 @@ begin end; procedure MC_SEND_PlayerSettings(); +var i: Integer; begin NetOut.Write(Byte(NET_MSG_PLRSET)); NetOut.Write(gPlayer1Settings.Name); @@ -3270,6 +3317,12 @@ begin NetOut.Write(gPlayer1Settings.Color.G); NetOut.Write(gPlayer1Settings.Color.B); NetOut.Write(gPlayer1Settings.Team); + NetOut.Write(gPlayer1Settings.WeaponSwitch); + if (gPlayer1Settings.WeaponSwitch = 2) then + for i := WP_FIRST to WP_LAST + 1 do + NetOut.Write(gPlayer1Settings.WeaponPreferences[i]); + NetOut.Write(gPlayer1Settings.SwitchToEmpty); + NetOut.Write(gPlayer1Settings.SkipFist); g_Net_Client_Send(True, NET_CHAN_IMPORTANT); end;