summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4204edd)
raw | patch | inline | side by side (parent: 4204edd)
author | travi$ <aidenkovbk@mail.ru> | |
Sat, 26 Mar 2022 16:46:38 +0000 (19:46 +0300) | ||
committer | Dmitry Lyashuk <terminalhash@th-mx> | |
Sat, 26 Mar 2022 17:50:39 +0000 (20:50 +0300) |
src/game/g_console.pas | patch | blob | history | |
src/game/g_game.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index b4b67ffb01bb729f2cea7b3cdba867684e8d6d62..35778ef797dc9fbfa9897493209f7d2a00d2d4e8 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('p1_weapnext', GameCommands);
AddCommand('p1_weapprev', GameCommands);
AddCommand('p1_weapon', GameCommands);
+ AddCommand('p1_weapbest', GameCommands);
AddCommand('p1_dropflag', GameCommands);
AddCommand('p2_weapnext', GameCommands);
AddCommand('p2_weapprev', GameCommands);
AddCommand('p2_weapon', GameCommands);
+ AddCommand('p2_weapbest', GameCommands);
AddCommand('p2_dropflag', GameCommands);
AddCommand('god', GameCheats);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index f85024b31b0c05a68e9947476e3180b36d12469f..5f7674fad60b3b38dd537cdfe88b24c5e92ede81 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
gSelectWeapon[b, a] := True
end
end
+ else if (cmd = 'p1_weapbest') or (cmd = 'p2_weapbest') then
+ begin
+ b := ord(cmd[2]) - ord('1');
+ if b = 0 then
+ gSelectWeapon[b, gPlayer1.GetMorePrefered()] := True
+ else
+ gSelectWeapon[b, gPlayer2.GetMorePrefered()] := True;
+ end
else if (cmd = 'dropflag') then
begin
if g_Game_IsServer then
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index fbbd09af8b270a58deee364d75df247bf984a3bf..8ad8931e32ddaff68a1ac89b57e1431003da9464 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
procedure SetWeaponPrefs(Prefs: Array of Byte);
procedure SetWeaponPref(Weapon, Pref: Byte);
function GetWeaponPref(Weapon: Byte) : Byte;
+ function GetMorePrefered() : Byte;
function Collide(X, Y: Integer; Width, Height: Word): Boolean; overload;
function Collide(Panel: TPanel): Boolean; overload;
function Collide(X, Y: Integer): Boolean; overload;
result := FWeapPreferences[Weapon];
end;
+function TPlayer.GetMorePrefered() : Byte;
+var testedWeap, i: Byte;
+begin
+ testedWeap := FCurrWeap;
+ for i := WP_FIRST to WP_LAST do
+ if FWeapon[i] and (FWeapPreferences[i] > FWeapPreferences[testedWeap]) then
+ testedWeap := i;
+ if (R_BERSERK in FRulez) and (FWeapPreferences[WP_LAST + 1] > FWeapPreferences[testedWeap]) then
+ testedWeap := WEAPON_KASTET;
+ result := testedWeap;
+end;
+
procedure TPlayer.SwitchTeam;
begin
if g_Game_IsClient then