X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame%2Fg_netmsg.pas;h=b7a0fdd903cc0fa4c4a1e6bae0f2a2ec333fc8f2;hb=88999196d89648a7ba4f6367e2a882e0d56bc5b5;hp=84dbeaa360d7b89dcf8babfa9fb8bdeba02131d2;hpb=0cfeb4de6ac8e97b896748a0fd688d4b06459985;p=d2df-sdl.git diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index 84dbeaa..b7a0fdd 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -435,6 +435,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; @@ -448,6 +455,7 @@ begin 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) + @@ -2439,6 +2447,7 @@ var PID: Word; Pl: TPlayer; I, OldFire: Integer; + checkWeapon: Boolean; OldJet, Flam: Boolean; NewTeam: Byte; begin @@ -2460,8 +2469,28 @@ begin NewTeam := M.ReadByte(); for I := WP_FIRST to WP_LAST do - FWeapon[I] := (M.ReadByte() <> 0); - + begin + checkWeapon := (M.ReadByte() <> 0); + if ( (gPlayer1Settings.WeaponSwitch = 0) and (gPlayer2Settings.WeaponSwitch = 0) ) or ( (I = WEAPON_KASTET) or (I = WEAPON_PISTOL) or (checkWeapon = False) or (FWeapon[I] = True) ) then + FWeapon[I] := checkWeapon + else + begin + if ((PID = gPlayer1.UID) and (gPlayer1Settings.WeaponSwitch <> 0)) or ( (gPlayer2 <> nil) and (PID = gPlayer2.UID) and (gPlayer2Settings.WeaponSwitch <> 0) ) then + begin + FWeapon[I] := True; + if (PID = gPlayer1.UID) then + if (gPlayer1Settings.WeaponSwitch = 1) or ( (gPlayer1Settings.WeaponSwitch = 2) and (gPlayer1Settings.WeaponPreferences[I] > gPlayer1Settings.WeaponPreferences[CurrWeap]) ) then + begin + gSelectWeapon[0, I] := True; + end + else + if (gPlayer2Settings.WeaponSwitch = 1) or ( (gPlayer2Settings.WeaponSwitch = 2) and (gPlayer2Settings.WeaponPreferences[I] > gPlayer2Settings.WeaponPreferences[CurrWeap]) ) then + gSelectWeapon[1, I] := True; + end + else + FWeapon[I] := checkWeapon; + end; + end; for I := A_BULLETS to A_HIGH do FAmmo[I] := M.ReadWord(); @@ -2480,8 +2509,28 @@ begin FRulez := FRulez + [R_KEY_GREEN]; if (M.ReadByte() <> 0) then FRulez := FRulez + [R_KEY_BLUE]; - if (M.ReadByte() <> 0) then + checkWeapon := M.ReadByte() <> 0; + if (checkWeapon) then + begin FRulez := FRulez + [R_BERSERK]; + if ((gPlayer2Settings.WeaponSwitch <> 0) and (gPlayer2Settings.WeaponSwitch <> 0)) and ((PID = gPlayer1.UID) or ( (gPlayer2 <> nil) and (PID = gPlayer2.UID) )) then + begin + if (PID = gPlayer1.UID) then + begin + if (gPlayer1Settings.WeaponSwitch = 1) or ( (gPlayer1Settings.WeaponSwitch = 2) and (gPlayer1Settings.WeaponPreferences[WP_LAST+1] > gPlayer1Settings.WeaponPreferences[CurrWeap]) ) then + begin + gSelectWeapon[0, WEAPON_KASTET] := True; + end; + end + else + begin + if (gPlayer2Settings.WeaponSwitch = 1) or ( (gPlayer2Settings.WeaponSwitch = 2) and (gPlayer2Settings.WeaponPreferences[WP_LAST+1] > gPlayer2Settings.WeaponPreferences[CurrWeap]) ) then + begin + gSelectWeapon[0, WEAPON_KASTET] := True; + end; + end; + end; + end; Frags := M.ReadLongInt(); Death := M.ReadLongInt(); @@ -3262,7 +3311,6 @@ begin NetOut.Write(gPlayer1Settings.Color.G); NetOut.Write(gPlayer1Settings.Color.B); NetOut.Write(gPlayer1Settings.Team); - g_Net_Client_Send(True, NET_CHAN_IMPORTANT); end;