summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a7ab374)
raw | patch | inline | side by side (parent: a7ab374)
author | travi$ <aidenkovbk@mail.ru> | |
Sat, 26 Mar 2022 17:41:05 +0000 (20:41 +0300) | ||
committer | Dmitry Lyashuk <terminalhash@th-mx> | |
Sat, 26 Mar 2022 17:50:50 +0000 (20:50 +0300) |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 35778ef797dc9fbfa9897493209f7d2a00d2d4e8..87a1fba23b9c5120f144dd618f41080078dd80ad 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('p2_autoswitch', PlayerSettingsCVars);
AddCommand('p1_switch_empty', PlayerSettingsCVars);
AddCommand('p2_switch_empty', PlayerSettingsCVars);
+ AddCommand('p1_skip_fist', PlayerSettingsCVars);
+ AddCommand('p2_skip_fist', PlayerSettingsCVars);
AddCommand('p1_priority_kastet', PlayerSettingsCVars);
AddCommand('p2_priority_kastet', PlayerSettingsCVars);
AddCommand('p1_priority_saw', PlayerSettingsCVars);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 5f7674fad60b3b38dd537cdfe88b24c5e92ede81..7e30028766f9080332d9568345b134bb3fa3b812 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
WeaponSwitch: Byte;
WeaponPreferences: Array[WP_FIRST..WP_LAST+1] of Byte;
SwitchToEmpty: Byte;
- SwitchToFist: Byte;
+ SkipFist: Byte;
end;
TMegaWADInfo = record
gPlayer1.WeapSwitchMode := gPlayer1Settings.WeaponSwitch;
gPlayer1.setWeaponPrefs(gPlayer1Settings.WeaponPreferences);
gPlayer1.SwitchToEmpty := gPlayer1Settings.SwitchToEmpty;
+ gPlayer1.SkipFist := gPlayer1Settings.SkipFist;
g_Console_Add(Format(_lc[I_PLAYER_JOIN], [gPlayer1.Name]), True);
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_PlayerCreate(gPlayer1.UID);
gPlayer2.WeapSwitchMode := gPlayer2Settings.WeaponSwitch;
gPlayer2.setWeaponPrefs(gPlayer2Settings.WeaponPreferences);
gPlayer2.SwitchToEmpty := gPlayer2Settings.SwitchToEmpty;
+ gPlayer2.SkipFist := gPlayer2Settings.SkipFist;
g_Console_Add(Format(_lc[I_PLAYER_JOIN], [gPlayer2.Name]), True);
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_PlayerCreate(gPlayer2.UID);
gPlayer1.WeapSwitchMode := gPlayer1Settings.WeaponSwitch;
gPlayer1.setWeaponPrefs(gPlayer1Settings.WeaponPreferences);
gPlayer1.SwitchToEmpty := gPlayer1Settings.SwitchToEmpty;
+ gPlayer1.SkipFist := gPlayer1Settings.SkipFist;
nPl := 1;
// Ñîçäàíèå âòîðîãî èãðîêà, åñëè åñòü:
gPlayer2.WeapSwitchMode := gPlayer2Settings.WeaponSwitch;
gPlayer2.setWeaponPrefs(gPlayer2Settings.WeaponPreferences);
gPlayer2.SwitchToEmpty := gPlayer2Settings.SwitchToEmpty;
+ gPlayer2.SkipFist := gPlayer2Settings.SkipFist;
Inc(nPl);
end;
gPlayer1.WeapSwitchMode := gPlayer1Settings.WeaponSwitch;
gPlayer1.setWeaponPrefs(gPlayer1Settings.WeaponPreferences);
gPlayer1.SwitchToEmpty := gPlayer1Settings.SwitchToEmpty;
+ gPlayer1.SkipFist := gPlayer1Settings.SkipFist;
Inc(nPl);
end;
gPlayer2.WeapSwitchMode := gPlayer2Settings.WeaponSwitch;
gPlayer2.setWeaponPrefs(gPlayer2Settings.WeaponPreferences);
gPlayer2.SwitchToEmpty := gPlayer2Settings.SwitchToEmpty;
+ gPlayer2.SkipFist := gPlayer2Settings.SkipFist;
Inc(nPl);
end;
gPlayer1.WeapSwitchMode := gPlayer1Settings.WeaponSwitch;
gPlayer1.setWeaponPrefs(gPlayer1Settings.WeaponPreferences);
gPlayer1.SwitchToEmpty := gPlayer1Settings.SwitchToEmpty;
+ gPlayer1.SkipFist := gPlayer1Settings.SkipFist;
end;
if nPlayers >= 2 then
gPlayer2.WeapSwitchMode := gPlayer2Settings.WeaponSwitch;
gPlayer2.setWeaponPrefs(gPlayer2Settings.WeaponPreferences);
gPlayer2.SwitchToEmpty := gPlayer2Settings.SwitchToEmpty;
+ gPlayer2.SkipFist := gPlayer2Settings.SkipFist;
end;
g_Game_SetLoadingText(_lc[I_LOAD_HOST], 0, False);
gPlayer1.WeapSwitchMode := gPlayer1Settings.WeaponSwitch;
gPlayer1.setWeaponPrefs(gPlayer1Settings.WeaponPreferences);
gPlayer1.SwitchToEmpty := gPlayer1Settings.SwitchToEmpty;
+ gPlayer1.SkipFist := gPlayer1Settings.SkipFist;
gPlayer1.UID := NetPlrUID1;
gPlayer1.Reset(True);
if (Length(P) = 2) then
gPlayer2Settings.SwitchToEmpty := EnsureRange(StrTointDef(P[1], 0), 0, 1);
end;
+ 'p1_skip_fist':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.SkipFist := EnsureRange(StrTointDef(P[1], 0), 0, 1);
+ end;
+ 'p2_skip_fist':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.SkipFist := EnsureRange(StrTointDef(P[1], 0), 0, 1);
+ end;
'p1_priority_kastet':
begin
if (Length(P) = 2) then
index 131bd61dbe99ad7cc75e9d6f5f729598cfa33e36..c2de375deaf88166be14862fbc51a2726a157e80 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
('MENU KASTET ALLOW', 'Switch to fist',
'Âûáèðàòü êàñòåò'),
('MENU KASTET ALLOW BERSERK', 'Only with berserk',
- 'Åñòü áåðñåðê'),
+ 'Òîëüêî ñ áåðñåðêîì'),
('MENU KASTET ALLOW ALWAYS', 'Always',
'Âñåãäà'),
('MENU WEAPON PRIORITY PLAYER 1', 'Player 1 Priority',
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 69cd445cb09fbb797432559356de6e25b25b7b74..6f351683332b19aa23e217808de3688ff572db48 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
gPlayer1Settings.WeaponSwitch := TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex;
gPlayer1Settings.SwitchToEmpty := TGUISwitch(menu.GetControl('swWeaponAllowEmpty')).ItemIndex;
-
-
+ gPlayer1Settings.SkipFist := TGUISwitch(menu.GetControl('swWeaponAllowFist')).ItemIndex;
+
menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
with menu do
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
gPlayer2Settings.WeaponSwitch := TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex;
gPlayer2Settings.SwitchToEmpty := TGUISwitch(menu.GetControl('swWeaponAllowEmpty')).ItemIndex;
+ gPlayer2Settings.SkipFist := TGUISwitch(menu.GetControl('swWeaponAllowFist')).ItemIndex;
menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
with menu do
begin
if (gPlayer1.WeapSwitchMode = 2) then
gPlayer1.setWeaponPrefs(gPlayer1Settings.WeaponPreferences);
gPlayer1.SwitchToEmpty := gPlayer1Settings.SwitchToEmpty;
+ gPlayer1.SkipFist := gPlayer1Settings.SkipFist;
if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer1.UID);
end;
if (gPlayer2.WeapSwitchMode = 2) then
gPlayer2.setWeaponPrefs(gPlayer2Settings.WeaponPreferences);
gPlayer2.SwitchToEmpty := gPlayer2Settings.SwitchToEmpty;
+ gPlayer2.SkipFist := gPlayer2Settings.SkipFist;
end;
end;
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex := gPlayer1Settings.WeaponSwitch;
TGUISwitch(menu.GetControl('swWeaponAllowEmpty')).ItemIndex := gPlayer1Settings.SwitchToEmpty;
-
+ TGUISwitch(menu.GetControl('swWeaponAllowFist')).ItemIndex := gPlayer1Settings.SkipFist;
menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
for i := WP_FIRST to WP_LAST+1 do
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex := gPlayer2Settings.WeaponSwitch;
TGUISwitch(menu.GetControl('swWeaponAllowEmpty')).ItemIndex := gPlayer2Settings.SwitchToEmpty;
+ TGUISwitch(menu.GetControl('swWeaponAllowFist')).ItemIndex := gPlayer2Settings.SkipFist;
menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
for i := WP_FIRST to WP_LAST+1 do
begin
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
end;
+ with AddSwitch(_lc[I_MENU_KASTET_ALLOW]) do
+ begin
+ Name := 'swWeaponAllowFist';
+ AddItem(_lc[I_MENU_KASTET_ALLOW_ALWAYS]);
+ AddItem(_lc[I_MENU_KASTET_ALLOW_BERSERK]);
+ end;
AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu, _lc[I_MENU_WEAPON_SWITCH_PRIORITY]);
ReAlign();
end;
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
end;
+ with AddSwitch(_lc[I_MENU_KASTET_ALLOW]) do
+ begin
+ Name := 'swWeaponAllowFist';
+ AddItem(_lc[I_MENU_KASTET_ALLOW_ALWAYS]);
+ AddItem(_lc[I_MENU_KASTET_ALLOW_BERSERK]);
+ end;
AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu, _lc[I_MENU_WEAPON_SWITCH_PRIORITY]);
ReAlign();
end;
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 55b99b3705acbc0ddbe05e00b04ba3657ea2c9fd..910a480a78d25b4073593853012ef1a7d8e6a5b4 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
WeapSwitch: Byte;
TmpPrefArray: Array [WP_FIRST .. WP_LAST + 1] of Byte;
SwitchEmpty: Byte;
+ SkipF: Byte;
PID: Word;
Color: TRGB;
I: Integer;
for I := WP_FIRST to WP_LAST + 1 do
TmpPrefArray[I] := M.ReadByte();
SwitchEmpty := M.ReadByte();
+ SkipF := M.ReadByte();
except
Err := True;
end;
if (WeapSwitch = 2) then
SetWeaponPrefs(TmpPrefArray);
SwitchToEmpty := SwitchEmpty;
+ SkipFist := SkipF;
Reset(True);
end;
TmpWeapSwitch: Byte;
TmpPrefArray: Array [WP_FIRST .. WP_LAST + 1] of Byte;
TmpSwEmpty: Byte;
+ TmpSkipF: Byte;
I: Integer;
Pl: TPlayer;
Err: Boolean;
for I := WP_FIRST to WP_LAST + 1 do
TmpPrefArray[I] := M.ReadByte();
TmpSwEmpty := M.ReadByte();
+ TmpSkipF := M.ReadByte();
except
Err := True;
end;
if (TmpSwEmpty <> Pl.SwitchToEmpty) then
Pl.SwitchToEmpty := TmpSwEmpty;
+
+ if (TmpSkipF <> Pl.SkipFist) then
+ Pl.SkipFist := TmpSkipF;
+
MH_SEND_PlayerSettings(Pl.UID, TmpModel);
end;
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;
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;
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);