diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index b7a0fdd903cc0fa4c4a1e6bae0f2a2ec333fc8f2..01708c297bf82b1d108efa9c427d892e90a29c08 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
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;
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;
with g_Player_Get(PID) do
begin
Name := PName;
+ WeapSwitchMode := WeapSwitch;
+ SetWeaponPrefs(TmpPrefArray);
+ SwitchToEmpty := SwitchEmpty;
+ SkipFist := SkipF;
Reset(True);
end;
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
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;
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;
PID: Word;
Pl: TPlayer;
I, OldFire: Integer;
- checkWeapon: Boolean;
OldJet, Flam: Boolean;
NewTeam: Byte;
begin
NewTeam := M.ReadByte();
for I := WP_FIRST to WP_LAST do
- 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;
+ FWeapon[I] := (M.ReadByte() <> 0);
+
for I := A_BULLETS to A_HIGH do
FAmmo[I] := M.ReadWord();
FRulez := FRulez + [R_KEY_GREEN];
if (M.ReadByte() <> 0) then
FRulez := FRulez + [R_KEY_BLUE];
- checkWeapon := M.ReadByte() <> 0;
- if (checkWeapon) then
- begin
+ if (M.ReadByte() <> 0) then
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();
// CLIENT SEND
procedure MC_SEND_Info(Password: string);
+var i: Integer;
begin
NetOut.Clear();
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;
end;
procedure MC_SEND_PlayerSettings();
+var i: Integer;
begin
NetOut.Write(Byte(NET_MSG_PLRSET));
NetOut.Write(gPlayer1Settings.Name);
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;