X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_player.pas;h=8f4331079506d89ee91e6c0b00d13701ad8c5153;hp=8ad8931e32ddaff68a1ac89b57e1431003da9464;hb=3bc93c7ecd534237343aaa3b83dca053c53b9bc5;hpb=a7ab3742313f79cefd688def25534d692dc7346c diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 8ad8931..8f43310 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -261,6 +261,7 @@ type FWeapSwitchMode: Byte; FWeapPreferences: Array [WP_FIRST .. WP_LAST+1] of Byte; FSwitchToEmpty: Byte; + FSkipFist: Byte; FColor: TRGB; FPreferredTeam: Byte; FSpectator: Boolean; @@ -304,6 +305,7 @@ type 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; @@ -385,6 +387,7 @@ type 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; @@ -2036,6 +2039,16 @@ begin 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 @@ -3809,7 +3822,7 @@ begin 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);