diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 8ad8931e32ddaff68a1ac89b57e1431003da9464..8f4331079506d89ee91e6c0b00d13701ad8c5153 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
FWeapSwitchMode: Byte;
FWeapPreferences: Array [WP_FIRST .. WP_LAST+1] of Byte;
FSwitchToEmpty: Byte;
+ FSkipFist: Byte;
FColor: TRGB;
FPreferredTeam: Byte;
FSpectator: Boolean;
procedure SetWeaponPref(Weapon, Pref: Byte);
function GetWeaponPref(Weapon: Byte) : Byte;
function GetMorePrefered() : Byte;
+ function MaySwitch(Weapon: Byte) : Boolean;
function Collide(X, Y: Integer; Width, Height: Word): Boolean; overload;
function Collide(Panel: TPanel): Boolean; overload;
function Collide(X, Y: Integer): Boolean; overload;
property CurrWeap: Byte read FCurrWeap write FCurrWeap;
property WeapSwitchMode: Byte read FWeapSwitchMode write FWeapSwitchMode;
property SwitchToEmpty: Byte read FSwitchToEmpty write FSwitchToEmpty;
+ property SkipFist: Byte read FSkipFist write FSkipFist;
property MonsterKills: Integer read FMonsterKills write FMonsterKills;
property Secrets: Integer read FSecrets;
property GodMode: Boolean read FGodMode write FGodMode;
result := testedWeap;
end;
+function TPlayer.maySwitch(Weapon: Byte) : Boolean;
+begin
+ result := true;
+ if (Weapon = WEAPON_KASTET) and (FSkipFist <> 0) then
+ if (FSkipFist = 1) and (not (R_BERSERK in FRulez)) then
+ result := false
+ else if (FSwitchToEmpty = 0) and not hasAmmoForWeapon(Weapon) then
+ result := false
+end;
+
procedure TPlayer.SwitchTeam;
begin
if g_Game_IsClient then
for i := 0 to High(FWeapon) do
begin
cwi := (cwi+length(FWeapon)+dir) mod length(FWeapon);
- if FWeapon[cwi] and ((FSwitchToEmpty = 1) or hasAmmoForWeapon(cwi)) then
+ if FWeapon[cwi] and maySwitch(cwi) then
begin
//e_LogWriteFln(' SWITCH: cur=%d; new=%d %s %s', [FCurrWeap, cwi, FSwitchToEmpty, hasAmmoForWeapon(cwi)], TMsgType.Notify);
result := Byte(cwi);