X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_netmsg.pas;h=01708c297bf82b1d108efa9c427d892e90a29c08;hb=51998d817120cd3833df7bae3d355642fd4abde5;hp=84dbeaa360d7b89dcf8babfa9fb8bdeba02131d2;hpb=0cfeb4de6ac8e97b896748a0fd688d4b06459985;p=d2df-sdl.git diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index 84dbeaa..01708c2 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,11 @@ begin G := M.ReadByte(); B := M.ReadByte(); T := M.ReadByte(); + WeapSwitch := M.ReadByte(); + for I := WP_FIRST to WP_LAST + 1 do + TmpPrefArray[I] := M.ReadByte(); + SwitchEmpty := M.ReadByte(); + SkipF := M.ReadByte(); except Err := True; end; @@ -435,6 +444,13 @@ begin Exit; end; + if (C^.Player <> 0) then + begin + // already received info + g_Net_Penalize(C, 'client info spam'); + Exit; + end; + Color.R := R; Color.B := B; Color.G := G; @@ -443,11 +459,16 @@ begin with g_Player_Get(PID) do begin Name := PName; + WeapSwitchMode := WeapSwitch; + SetWeaponPrefs(TmpPrefArray); + SwitchToEmpty := SwitchEmpty; + SkipFist := SkipF; Reset(True); end; C^.Player := PID; C^.WaitForFirstSpawn := false; + C^.AuthTime := 0; g_Console_Add(Format(_lc[I_PLAYER_JOIN], [PName]), True); e_WriteLog('NET: Client ' + PName + ' [' + IntToStr(C^.ID) + @@ -692,6 +713,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 @@ -703,6 +729,11 @@ begin TmpColor.G := M.ReadByte(); TmpColor.B := M.ReadByte(); TmpTeam := M.ReadByte(); + TmpWeapSwitch := M.ReadByte(); + for I := WP_FIRST to WP_LAST + 1 do + TmpPrefArray[I] := M.ReadByte(); + TmpSwEmpty := M.ReadByte(); + TmpSkipF := M.ReadByte(); except Err := True; end; @@ -726,6 +757,16 @@ begin if TmpModel <> Pl.Model.Name then Pl.SetModel(TmpModel); + if (TmpWeapSwitch <> Pl.WeapSwitchMode) then + Pl.WeapSwitchMode := TmpWeapSwitch; + + 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; @@ -3103,6 +3144,7 @@ end; // CLIENT SEND procedure MC_SEND_Info(Password: string); +var i: Integer; begin NetOut.Clear(); @@ -3115,6 +3157,11 @@ begin NetOut.Write(gPlayer1Settings.Color.G); NetOut.Write(gPlayer1Settings.Color.B); NetOut.Write(gPlayer1Settings.Team); + NetOut.Write(gPlayer1Settings.WeaponSwitch); + 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; @@ -3254,6 +3301,7 @@ begin end; procedure MC_SEND_PlayerSettings(); +var i: Integer; begin NetOut.Write(Byte(NET_MSG_PLRSET)); NetOut.Write(gPlayer1Settings.Name); @@ -3262,6 +3310,11 @@ begin NetOut.Write(gPlayer1Settings.Color.G); NetOut.Write(gPlayer1Settings.Color.B); NetOut.Write(gPlayer1Settings.Team); + NetOut.Write(gPlayer1Settings.WeaponSwitch); + 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;