summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: 991b125)
raw | patch | inline | side by side (from parent 1: 991b125)
author | Dmitry Lyashuk <terminalhash@th-mx> | |
Fri, 25 Mar 2022 17:22:39 +0000 (20:22 +0300) | ||
committer | Dmitry Lyashuk <terminalhash@th-mx> | |
Fri, 25 Mar 2022 17:22:39 +0000 (20:22 +0300) |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index a4dddf3342cf16a931003728a6f0abd69121059d..8c0c41e0e22cb6282cb669e07e665a214f03a065 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
uses
g_textures, g_main, e_graphics, e_input, g_game, g_gfx, g_player, g_items,
SysUtils, g_basic, g_options, Math, g_touch, e_res,
uses
g_textures, g_main, e_graphics, e_input, g_game, g_gfx, g_player, g_items,
SysUtils, g_basic, g_options, Math, g_touch, e_res,
- g_menu, g_gui, g_language, g_net, g_netmsg, e_log, conbuf;
+ g_menu, g_gui, g_language, g_net, g_netmsg, e_log, conbuf, g_weapons;
const
autoexecScript = 'autoexec.cfg';
const
autoexecScript = 'autoexec.cfg';
AddCommand('p2_model', PlayerSettingsCVars);
AddCommand('p1_team', PlayerSettingsCVars);
AddCommand('p2_team', PlayerSettingsCVars);
AddCommand('p2_model', PlayerSettingsCVars);
AddCommand('p1_team', PlayerSettingsCVars);
AddCommand('p2_team', PlayerSettingsCVars);
+ AddCommand('p1_autoswitch', PlayerSettingsCVars);
+ AddCommand('p2_autoswitch', PlayerSettingsCVars);
+ AddCommand('p1_priority_kastet', PlayerSettingsCVars);
+ AddCommand('p2_priority_kastet', PlayerSettingsCVars);
+ AddCommand('p1_priority_saw', PlayerSettingsCVars);
+ AddCommand('p2_priority_saw', PlayerSettingsCVars);
+ AddCommand('p1_priority_pistol', PlayerSettingsCVars);
+ AddCommand('p2_priority_pistol', PlayerSettingsCVars);
+ AddCommand('p1_priority_shotgun1', PlayerSettingsCVars);
+ AddCommand('p2_priority_shotgun1', PlayerSettingsCVars);
+ AddCommand('p1_priority_shotgun2', PlayerSettingsCVars);
+ AddCommand('p2_priority_shotgun2', PlayerSettingsCVars);
+ AddCommand('p1_priority_chaingun', PlayerSettingsCVars);
+ AddCommand('p2_priority_chaingun', PlayerSettingsCVars);
+ AddCommand('p1_priority_rocketlauncher', PlayerSettingsCVars);
+ AddCommand('p2_priority_rocketlauncher', PlayerSettingsCVars);
+ AddCommand('p1_priority_plasma', PlayerSettingsCVars);
+ AddCommand('p2_priority_plasma', PlayerSettingsCVars);
+ AddCommand('p1_priority_bfg', PlayerSettingsCVars);
+ AddCommand('p2_priority_bfg', PlayerSettingsCVars);
+ AddCommand('p1_priority_super', PlayerSettingsCVars);
+ AddCommand('p2_priority_super', PlayerSettingsCVars);
+ AddCommand('p1_priority_flamethrower', PlayerSettingsCVars);
+ AddCommand('p2_priority_flamethrower', PlayerSettingsCVars);
+ AddCommand('p1_priority_berserk', PlayerSettingsCVars);
+ AddCommand('p2_priority_berserk', PlayerSettingsCVars);
AddCommand('g_max_particles', GameCVars);
AddCommand('g_max_shells', GameCVars);
AddCommand('g_max_particles', GameCVars);
AddCommand('g_max_shells', GameCVars);
WriteLn(f, 'p1_color ', Color.R, ' ', Color.G, ' ', Color.B);
WriteLn(f, 'p1_model ', QuoteStr(Model));
WriteLn(f, 'p1_team ', FormatTeam(Team));
WriteLn(f, 'p1_color ', Color.R, ' ', Color.G, ' ', Color.B);
WriteLn(f, 'p1_model ', QuoteStr(Model));
WriteLn(f, 'p1_team ', FormatTeam(Team));
+ WriteLn(f, 'p1_autoswitch ', WeaponSwitch);
+ WriteLn(f, 'p1_priority_kastet ', Max(0, WeaponPreferences[WEAPON_KASTET]));
+ WriteLn(f, 'p1_priority_saw ', Max(0, WeaponPreferences[WEAPON_SAW]));
+ WriteLn(f, 'p1_priority_pistol ', Max(0, WeaponPreferences[WEAPON_PISTOL]));
+ WriteLn(f, 'p1_priority_shotgun1 ', Max(0, WeaponPreferences[WEAPON_SHOTGUN1]));
+ WriteLn(f, 'p1_priority_shotgun2 ', Max(0, WeaponPreferences[WEAPON_SHOTGUN2] ));
+ WriteLn(f, 'p1_priority_chaingun ', Max(0, WeaponPreferences[WEAPON_CHAINGUN]));
+ WriteLn(f, 'p1_priority_rocketlauncher ', Max(0, WeaponPreferences[WEAPON_ROCKETLAUNCHER]));
+ WriteLn(f, 'p1_priority_plasma ', Max(0, WeaponPreferences[WEAPON_PLASMA]));
+ WriteLn(f, 'p1_priority_bfg ', Max(0, WeaponPreferences[WEAPON_BFG]));
+ WriteLn(f, 'p1_priority_super ', Max(0, WeaponPreferences[WEAPON_SUPERPULEMET]));
+ WriteLn(f, 'p1_priority_flamethrower ', Max(0, WeaponPreferences[WEAPON_FLAMETHROWER]));
+ WriteLn(f, 'p1_priority_berserk ', Max(0, WeaponPreferences[WP_LAST+1]));
+ //
end;
with gPlayer2Settings do
begin
end;
with gPlayer2Settings do
begin
WriteLn(f, 'p2_color ', Color.R, ' ', Color.G, ' ', Color.B);
WriteLn(f, 'p2_model ', QuoteStr(Model));
WriteLn(f, 'p2_team ', FormatTeam(Team));
WriteLn(f, 'p2_color ', Color.R, ' ', Color.G, ' ', Color.B);
WriteLn(f, 'p2_model ', QuoteStr(Model));
WriteLn(f, 'p2_team ', FormatTeam(Team));
+ WriteLn(f, 'p2_autoswitch ', WeaponSwitch);
+ WriteLn(f, 'p2_priority_kastet ', Max(0, WeaponPreferences[WEAPON_KASTET]));
+ WriteLn(f, 'p2_priority_saw ', Max(0, WeaponPreferences[WEAPON_SAW]));
+ WriteLn(f, 'p2_priority_pistol ', Max(0, WeaponPreferences[WEAPON_PISTOL]));
+ WriteLn(f, 'p2_priority_shotgun1 ', Max(0, WeaponPreferences[WEAPON_SHOTGUN1]));
+ WriteLn(f, 'p2_priority_shotgun2 ', Max(0, WeaponPreferences[WEAPON_SHOTGUN1]));
+ WriteLn(f, 'p2_priority_chaingun ', Max(0, WeaponPreferences[WEAPON_CHAINGUN]));
+ WriteLn(f, 'p2_priority_rocketlauncher ', Max(0, WeaponPreferences[WEAPON_ROCKETLAUNCHER]));
+ WriteLn(f, 'p2_priority_plasma ', Max(0, WeaponPreferences[WEAPON_PLASMA]));
+ WriteLn(f, 'p2_priority_bfg ', Max(0, WeaponPreferences[WEAPON_BFG]));
+ WriteLn(f, 'p2_priority_super ', Max(0, WeaponPreferences[WEAPON_SUPERPULEMET]));
+ WriteLn(f, 'p2_priority_flamethrower ', Max(0, WeaponPreferences[WEAPON_FLAMETHROWER]));
+ WriteLn(f, 'p2_priority_berserk ', Max(0, WeaponPreferences[WP_LAST+1]));
end;
// all cvars
end;
// all cvars
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 653ba539cf7f1fd4138d26dec714ef679f6ecf38..7674db9b76dc9cf841172af8daa03b5ae4b466b2 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
Model: String;
Color: TRGB;
Team: Byte;
Model: String;
Color: TRGB;
Team: Byte;
+ WeaponSwitch: Byte;
+ WeaponPreferences: Array[WP_FIRST..WP_LAST+1] of Byte;
end;
TMegaWADInfo = record
end;
TMegaWADInfo = record
g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end;
end;
g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end;
end;
+ 'p1_autoswitch':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponSwitch := EnsureRange(StrTointDef(P[1], 0), 0, 2);
+ end;
+ 'p2_autoswitch':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponSwitch := EnsureRange(StrTointDef(P[1], 0), 0, 2);
+ end;
+ 'p1_priority_kastet':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_kastet':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_saw':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_SAW] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_saw':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_SAW] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_pistol':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_pistol':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_shotgun1':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_SHOTGUN1] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_shotgun1':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_SHOTGUN1] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_shotgun2':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_SHOTGUN2] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_shotgun2':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_SHOTGUN2] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_chaingun':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_CHAINGUN] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_chaingun':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_CHAINGUN] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_rocketlauncher':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_ROCKETLAUNCHER] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_rocketlauncher':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_ROCKETLAUNCHER] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_plasma':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_PLASMA] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_plasma':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_PLASMA] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_bfg':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_BFG] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_bfg':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_BFG] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_super':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_SUPERPULEMET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_super':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_SUPERPULEMET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_flamethrower':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WEAPON_FLAMETHROWER] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_flamethrower':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WEAPON_FLAMETHROWER] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p1_priority_berserk':
+ begin
+ if (Length(P) = 2) then
+ gPlayer1Settings.WeaponPreferences[WP_LAST+1] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
+ 'p2_priority_berserk':
+ begin
+ if (Length(P) = 2) then
+ gPlayer2Settings.WeaponPreferences[WP_LAST+1] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
end;
end;
end;
end;
index 362da8ded8de5a7d5aad19808c34af38c84c6fa2..8d2060eaa1038d847ecf59f44870f30f3da5f8ce 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
I_GAME_WEAPON8,
I_GAME_WEAPON9,
I_GAME_WEAPON10,
I_GAME_WEAPON8,
I_GAME_WEAPON9,
I_GAME_WEAPON10,
+ I_GAME_WEAPON_BERSERK,
I_MENU_START_GAME,
I_MENU_MAIN_MENU,
I_MENU_START_GAME,
I_MENU_MAIN_MENU,
I_MENU_PLAYER_RED,
I_MENU_PLAYER_GREEN,
I_MENU_PLAYER_BLUE,
I_MENU_PLAYER_RED,
I_MENU_PLAYER_GREEN,
I_MENU_PLAYER_BLUE,
+ I_MENU_WEAPON,
+ I_MENU_WEAPON_SWITCH,
+ I_MENU_WEAPON_SWITCH_LINEAR,
+ I_MENU_WEAPON_SWITCH_PREFERENCE,
+ I_MENU_WEAPON_SWITCH_PRIORITY,
+ I_MENU_WEAPON_PRIORITY_PLAYER_1,
+ I_MENU_WEAPON_PRIORITY_PLAYER_2,
I_MENU_MODEL_INFO,
I_MENU_MODEL_ANIMATION,
I_MENU_MODEL_INFO,
I_MENU_MODEL_ANIMATION,
'Ñóïåðïóëåì¸ò'),
('GAME WEAPON10', 'Flamethrower',
'Îãíåì¸ò'),
'Ñóïåðïóëåì¸ò'),
('GAME WEAPON10', 'Flamethrower',
'Îãíåì¸ò'),
+ ('GAME WEAPON BERSERK', 'Berserk',
+ 'Áåðñåðê'),
('MENU START GAME', 'Start Game',
'ÍÀ×ÀÒÜ ÈÃÐÓ'),
('MENU START GAME', 'Start Game',
'ÍÀ×ÀÒÜ ÈÃÐÓ'),
'Çåë¸íûé:'),
('MENU PLAYER BLUE', 'Blue:',
'Ñèíèé:'),
'Çåë¸íûé:'),
('MENU PLAYER BLUE', 'Blue:',
'Ñèíèé:'),
-
+ ('MENU WEAPON', 'Weapon preferences',
+ 'Íàñòðîèòü îðóæèå'),
+ ('MENU WEAPON SWITCH', 'Weapon autoswitch',
+ 'Àâòîâûáîð îðóæèÿ'),
+ ('MENU WEAPON SWITCH LINEAR', 'On pickup',
+ 'Ïðè ïîäáîðå'),
+ ('MENU WEAPON SWITCH PREFERENCE', 'By priority',
+ 'Ïî ïðèîðèòåòíîñòè'),
+ ('MENU WEAPON SWITCH PRIORITY', 'Weapon priority',
+ 'Ïðèîðèòåòíîñòü îðóæèÿ'),
+ ('MENU WEAPON PRIORITY PLAYER 1', 'Player 1 Priority',
+ 'Ïðèîðèòåò îðóæèÿ (1)'),
+ ('MENU WEAPON PRIORITY PLAYER 2', 'Player 2 Priority',
+ 'Ïðèîðèòåò îðóæèÿ (2)'),
('MENU MODEL INFO', 'Model info',
'Èíôîðìàöèÿ î ìîäåëè'),
('MENU MODEL ANIMATION', 'Change animation',
('MENU MODEL INFO', 'Model info',
'Èíôîðìàöèÿ î ìîäåëè'),
('MENU MODEL ANIMATION', 'Change animation',
('MENU MODEL CHANGE WEAPON', 'Change weapon',
'Ñìåíèòü îðóæèå'),
('MENU MODEL ROTATE', 'Reflect model',
('MENU MODEL CHANGE WEAPON', 'Change weapon',
'Ñìåíèòü îðóæèå'),
('MENU MODEL ROTATE', 'Reflect model',
- 'Ðàçâåðíóòü ìîäåëü'),
+ 'Ðàçâåðíóòü ìîäåëü'),
('MENU MODEL NAME', 'Name:',
'Èìÿ:'),
('MENU MODEL AUTHOR', 'Author:',
('MENU MODEL NAME', 'Name:',
'Èìÿ:'),
('MENU MODEL AUTHOR', 'Author:',
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 9e89ad9df259586e4380fecb228e99c8bb081a5e..2f6ce09122ea1f2daa5bb42d879b57949bd9fe90 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
TempScale := TGUIScroll(menu.GetControl('scScaleFactor')).Value;
g_dbg_scale := TempScale + 1;
end;
TempScale := TGUIScroll(menu.GetControl('scScaleFactor')).Value;
g_dbg_scale := TempScale + 1;
end;
- gWeaponAutoswitch := TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex = 0;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
gPlayer1Settings.Color := Model.Color;
end;
gPlayer1Settings.Color := Model.Color;
end;
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
+
+ gPlayer1Settings.Name := b_Text_Unformat(TGUIEdit(menu.GetControl('edP1Name')).Text);
+ gPlayer1Settings.Team := IfThen(TGUISwitch(menu.GetControl('swP1Team')).ItemIndex = 0,
+ TEAM_RED, TEAM_BLUE);
+
+ with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
+ begin
+ gPlayer1Settings.Model := Model.Name;
+ gPlayer1Settings.Color := Model.Color;
+ end;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
+ gPlayer1Settings.WeaponSwitch := TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
+ with menu do
+ begin
+ for i := WP_FIRST to WP_LAST+1 do
+ begin
+ gPlayer1Settings.WeaponPreferences[i] := TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex;
+ end;
+ end;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
+ gPlayer2Settings.WeaponSwitch := TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
+ with menu do
+ begin
+ for i := WP_FIRST to WP_LAST+1 do
+ begin
+ gPlayer2Settings.WeaponPreferences[i] := TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex;
+ end;
+ end;
+
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
gPlayer2Settings.Name := b_Text_Unformat(TGUIEdit(menu.GetControl('edP2Name')).Text);
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
gPlayer2Settings.Name := b_Text_Unformat(TGUIEdit(menu.GetControl('edP2Name')).Text);
procedure ReadOptions();
var
menu: TGUIMenu;
procedure ReadOptions();
var
menu: TGUIMenu;
- i: Integer;
+ i, a: Integer;
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
TempScale := Round(g_dbg_scale - 1);
TGUIScroll(menu.GetControl('scScaleFactor')).Value := TempScale;
TempScale := Round(g_dbg_scale - 1);
TGUIScroll(menu.GetControl('scScaleFactor')).Value := TempScale;
- with TGUISwitch(menu.GetControl('swWeaponAutoswitch')) do
- if gWeaponAutoswitch then ItemIndex := 0 else ItemIndex := 1;
-
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
TGUIListBox(menu.GetControl('lsP1Model')).SelectItem(gPlayer1Settings.Model);
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
TGUIListBox(menu.GetControl('lsP1Model')).SelectItem(gPlayer1Settings.Model);
TGUIScroll(menu.GetControl('scP1Green')).Value := Round(gPlayer1Settings.Color.G/16);
TGUIScroll(menu.GetControl('scP1Blue')).Value := Round(gPlayer1Settings.Color.B/16);
TGUIScroll(menu.GetControl('scP1Green')).Value := Round(gPlayer1Settings.Color.G/16);
TGUIScroll(menu.GetControl('scP1Blue')).Value := Round(gPlayer1Settings.Color.B/16);
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
+ TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex := gPlayer1Settings.WeaponSwitch;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
+ for i := WP_FIRST to WP_LAST+1 do
+ begin
+ if (gPlayer1Settings.WeaponPreferences[i] > 0) and (gPlayer1Settings.WeaponPreferences[i] <= WP_LAST+1) then TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex := gPlayer1Settings.WeaponPreferences[i]
+ else TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex := 0;
+ end;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
+ TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex := gPlayer2Settings.WeaponSwitch;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
+ for i := WP_FIRST to WP_LAST+1 do
+ begin
+ if (gPlayer2Settings.WeaponPreferences[i] > 0) and (gPlayer2Settings.WeaponPreferences[i] <= WP_LAST+1) then TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex := gPlayer2Settings.WeaponPreferences[i]
+ else TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex := 0;
+ end;
+
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
TGUIListBox(menu.GetControl('lsP2Model')).SelectItem(gPlayer2Settings.Model);
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
TGUIListBox(menu.GetControl('lsP2Model')).SelectItem(gPlayer2Settings.Model);
g_GUI_ShowWindow('OptionsPlayersMIMenu');
end;
g_GUI_ShowWindow('OptionsPlayersMIMenu');
end;
+procedure ProcOptionsPlayerP1WeaponMenu();
+var
+ a: string;
+begin
+ a := TGUIListBox(TGUIMenu(g_ActiveWindow.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem;
+ if a = '' then Exit;
+ g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
+end;
+
+procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
+begin
+ g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
+end;
+
+procedure ProcOptionsPlayerP2WeaponMenu();
+var
+ a: string;
+begin
+ a := TGUIListBox(TGUIMenu(g_ActiveWindow.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem;
+ if a = '' then Exit;
+ g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
+end;
+
+procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
+begin
+ g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
+end;
+
procedure ProcOptionsPlayersAnim();
var
s: String;
procedure ProcOptionsPlayersAnim();
var
s: String;
AddButton(@ProcOptionsPlayersAnim, _lc[I_MENU_MODEL_ANIMATION]);
AddButton(@ProcOptionsPlayersWeap, _lc[I_MENU_MODEL_CHANGE_WEAPON]);
AddButton(@ProcOptionsPlayersRot, _lc[I_MENU_MODEL_ROTATE]);
AddButton(@ProcOptionsPlayersAnim, _lc[I_MENU_MODEL_ANIMATION]);
AddButton(@ProcOptionsPlayersWeap, _lc[I_MENU_MODEL_CHANGE_WEAPON]);
AddButton(@ProcOptionsPlayersRot, _lc[I_MENU_MODEL_ROTATE]);
-
+ if s = 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu, _lc[I_MENU_WEAPON])
+ else AddButton(@ProcOptionsPlayerP2WeaponMenu, _lc[I_MENU_WEAPON]);
with TGUIModelView(Menu.AddChild(TGUIModelView.Create)) do
begin
Name := 'mv'+s+'Model';
with TGUIModelView(Menu.AddChild(TGUIModelView.Create)) do
begin
Name := 'mv'+s+'Model';
var
Menu: TGUIWindow;
//SR: TSearchRec;
var
Menu: TGUIWindow;
//SR: TSearchRec;
- a, cx, _y, i: Integer;
+ a, cx, _y, i, x: Integer;
//list: SSArray;
begin
Menu := TGUIWindow.Create('MainMenu');
//list: SSArray;
begin
Menu := TGUIWindow.Create('MainMenu');
Max := 10;
OnChange := ProcChangeGameSettings;
end;
Max := 10;
OnChange := ProcChangeGameSettings;
end;
- with AddSwitch(_lc[I_MENU_GAME_WEAPON_AUTOSWITCH]) do
- begin
- Name := 'swWeaponAutoswitch';
- AddItem(_lc[I_MENU_YES]);
- AddItem(_lc[I_MENU_NO]);
- end;
ReAlign();
end;
Menu.DefControl := 'mOptionsGameMenu';
ReAlign();
end;
Menu.DefControl := 'mOptionsGameMenu';
Menu.DefControl := 'mOptionsPlayersMIMenu';
g_GUI_AddWindow(Menu);
Menu.DefControl := 'mOptionsPlayersMIMenu';
g_GUI_AddWindow(Menu);
+ Menu := TGUIWindow.Create('OptionsPlayersP1WeaponMenu');
+ with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_WEAPON]))) do
+ begin
+ Name := 'mOptionsPlayersP1WeaponMenu';
+ with AddSwitch(_lc[I_MENU_WEAPON_SWITCH]) do
+ begin
+ Name := 'swWeaponAutoswitch';
+ AddItem(_lc[I_MENU_NO]);
+ AddItem(_lc[I_MENU_WEAPON_SWITCH_LINEAR]);
+ AddItem(_lc[I_MENU_WEAPON_SWITCH_PREFERENCE]);
+ end;
+ AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu, _lc[I_MENU_WEAPON_SWITCH_PRIORITY]);
+ ReAlign();
+ end;
+ Menu.DefControl := 'mOptionsPlayersP1WeaponMenu';
+ g_GUI_AddWindow(Menu);
+
+ Menu := TGUIWindow.Create('OptionsPreferencesP1WeaponMenu');
+ with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_WEAPON_PRIORITY_PLAYER_1]))) do
+ begin
+ Name := 'mOptionsPreferencesP1WeaponMenu';
+ for i := WP_FIRST to WP_LAST do
+ begin
+ with AddSwitch(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]) do
+ begin
+ Name := IntToStr(i);
+ for a := WP_FIRST to WP_LAST+1 do
+ begin
+ AddItem(IntToStr(a));
+ end;
+ ItemIndex := i
+ end;
+ end;
+ with AddSwitch(_lc[I_GAME_WEAPON_BERSERK]) do
+ begin
+ Name := IntToStr(WP_LAST+1);
+ for a := WP_FIRST to WP_LAST+1 do
+ begin
+ AddItem(IntToStr(a));
+ end;
+ ItemIndex := WP_LAST + 1;
+ end;
+ end;
+ Menu.DefControl := 'mOptionsPreferencesP1WeaponMenu';
+ g_GUI_AddWindow(Menu);
+
+
+ Menu := TGUIWindow.Create('OptionsPlayersP2WeaponMenu');
+ with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_WEAPON]))) do
+ begin
+ Name := 'mOptionsPlayersP2WeaponMenu';
+ with AddSwitch(_lc[I_MENU_WEAPON_SWITCH]) do
+ begin
+ Name := 'swWeaponAutoswitch';
+ AddItem(_lc[I_MENU_NO]);
+ AddItem(_lc[I_MENU_WEAPON_SWITCH_LINEAR]);
+ AddItem(_lc[I_MENU_WEAPON_SWITCH_PREFERENCE]);
+ end;
+ AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu, _lc[I_MENU_WEAPON_SWITCH_PRIORITY]);
+ ReAlign();
+ end;
+ Menu.DefControl := 'mOptionsPlayersP2WeaponMenu';
+ g_GUI_AddWindow(Menu);
+
+ Menu := TGUIWindow.Create('OptionsPreferencesP2WeaponMenu');
+ with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_WEAPON_PRIORITY_PLAYER_2]))) do
+ begin
+ Name := 'mOptionsPreferencesP2WeaponMenu';
+ for i := WP_FIRST to WP_LAST do
+ begin
+ with AddSwitch(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]) do
+ begin
+ Name := IntToStr(i);
+ for a := WP_FIRST to WP_LAST+1 do
+ begin
+ AddItem(IntToStr(a));
+ end;
+ ItemIndex := i
+ end;
+ end;
+ with AddSwitch(_lc[I_GAME_WEAPON_BERSERK]) do
+ begin
+ Name := IntToStr(WP_LAST+1);
+ for a := WP_FIRST to WP_LAST+1 do
+ begin
+ AddItem(IntToStr(a));
+ end;
+ ItemIndex := WP_LAST + 1;
+ end;
+ end;
+ Menu.DefControl := 'mOptionsPreferencesP2WeaponMenu';
+ g_GUI_AddWindow(Menu);
+
Menu := TGUIWindow.Create('OptionsLanguageMenu');
with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_LANGUAGE_OPTIONS]))) do
begin
Menu := TGUIWindow.Create('OptionsLanguageMenu');
with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_LANGUAGE_OPTIONS]))) do
begin
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 3701038e76d8f3063378d92364612cdbab798973..b7a0fdd903cc0fa4c4a1e6bae0f2a2ec333fc8f2 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
for I := WP_FIRST to WP_LAST do
begin
checkWeapon := (M.ReadByte() <> 0);
for I := WP_FIRST to WP_LAST do
begin
checkWeapon := (M.ReadByte() <> 0);
- if ( ((PID = gPlayer1.UID) or ( (gPlayer2 <> nil) and (PID = gPlayer2.UID))) and (I <> WEAPON_PISTOL) and (I <> WEAPON_KASTET ) and (gWeaponAutoswitch = True)) then
+ 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
begin
- if ( (checkWeapon = True) and (FWeapon[I] = False) ) then
- begin
- FWeapon[I] := True;
- if (PID = gPlayer1.UID) then gSelectWeapon[0, I] := True
- else gSelectWeapon[1, I] := True;
- end;
+ 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] := checkWeapon;
end;
for I := A_BULLETS to A_HIGH do
FAmmo[I] := M.ReadWord();
end;
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];
FRulez := FRulez + [R_KEY_GREEN];
if (M.ReadByte() <> 0) then
FRulez := FRulez + [R_KEY_BLUE];
- if (M.ReadByte() <> 0) then
+ checkWeapon := M.ReadByte() <> 0;
+ if (checkWeapon) then
+ begin
FRulez := FRulez + [R_BERSERK];
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();
Frags := M.ReadLongInt();
Death := M.ReadLongInt();
NetOut.Write(gPlayer1Settings.Color.G);
NetOut.Write(gPlayer1Settings.Color.B);
NetOut.Write(gPlayer1Settings.Team);
NetOut.Write(gPlayer1Settings.Color.G);
NetOut.Write(gPlayer1Settings.Color.B);
NetOut.Write(gPlayer1Settings.Team);
-
g_Net_Client_Send(True, NET_CHAN_IMPORTANT);
end;
g_Net_Client_Send(True, NET_CHAN_IMPORTANT);
end;
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index 9cd3cbf59e4c1d27723e4b664b0a4c13e11a80ce..853c612964cda47af0fe40d2d824ec27216a77dc 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
gsSDLBufferSize: Integer;
gDefaultMegawadStart: AnsiString;
gBerserkAutoswitch: Boolean;
gsSDLBufferSize: Integer;
gDefaultMegawadStart: AnsiString;
gBerserkAutoswitch: Boolean;
- gWeaponAutoswitch: Boolean;
glNPOTOverride: Boolean = false;
(* Latched game settings *)
glNPOTOverride: Boolean = false;
(* Latched game settings *)
e_FastScreenshots := True;
gDefaultMegawadStart := DF_Default_Megawad_Start;
gBerserkAutoswitch := True;
e_FastScreenshots := True;
gDefaultMegawadStart := DF_Default_Megawad_Start;
gBerserkAutoswitch := True;
- gWeaponAutoswitch := True;
g_dbg_scale := 1.0;
gSaveStats := False;
g_dbg_scale := 1.0;
gSaveStats := False;
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 80ab62efd2f1318a793c5d971f765d08bc91088c..ee0655c223c9c39231669ce7d1f39d75858e0d3f 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
@@ -3877,6 +3877,7 @@ function TPlayer.PickItem(ItemType: Byte; arespawn: Boolean; var remove: Boolean
var
a: Boolean;
var
a: Boolean;
+ switchWeapon: Byte;
hadWeapon: Boolean;
begin
Result := False;
hadWeapon: Boolean;
begin
Result := False;
// a = true - ìåñòî ñïàâíà ïðåäìåòà:
a := LongBool(gGameSettings.Options and GAME_OPTION_WEAPONSTAY) and arespawn;
remove := not a;
// a = true - ìåñòî ñïàâíà ïðåäìåòà:
a := LongBool(gGameSettings.Options and GAME_OPTION_WEAPONSTAY) and arespawn;
remove := not a;
-
case ItemType of
ITEM_MEDKIT_SMALL:
if (FHealth < PLAYER_HP_SOFT) or (FFireTime > 0) then
case ItemType of
ITEM_MEDKIT_SMALL:
if (FHealth < PLAYER_HP_SOFT) or (FFireTime > 0) then
ITEM_WEAPON_SAW:
if (not FWeapon[WEAPON_SAW]) or ((not arespawn) and (gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF])) then
begin
ITEM_WEAPON_SAW:
if (not FWeapon[WEAPON_SAW]) or ((not arespawn) and (gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF])) then
begin
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_SAW];
- FWeapon[WEAPON_SAW] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_SAW;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_SAW);
- end;
- end
- else FWeapon[WEAPON_SAW] := True;
+ hadWeapon := FWeapon[WEAPON_SAW];
+ switchWeapon := WEAPON_SAW;
+ FWeapon[WEAPON_SAW] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
begin
// Íóæíî, ÷òîáû íå âçÿòü âñå ïóëè ñðàçó:
if a and FWeapon[WEAPON_SHOTGUN1] then Exit;
begin
// Íóæíî, ÷òîáû íå âçÿòü âñå ïóëè ñðàçó:
if a and FWeapon[WEAPON_SHOTGUN1] then Exit;
+ hadWeapon := FWeapon[WEAPON_SHOTGUN1];
+ switchWeapon := WEAPON_SHOTGUN1;
IncMax(FAmmo[A_SHELLS], 4, FMaxAmmo[A_SHELLS]);
IncMax(FAmmo[A_SHELLS], 4, FMaxAmmo[A_SHELLS]);
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_SHOTGUN1];
- FWeapon[WEAPON_SHOTGUN1] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_SHOTGUN1;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_SHOTGUN1);
- end;
- end
- else FWeapon[WEAPON_SHOTGUN1] := True;
+ FWeapon[WEAPON_SHOTGUN1] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
if (FAmmo[A_SHELLS] < FMaxAmmo[A_SHELLS]) or not FWeapon[WEAPON_SHOTGUN2] then
begin
if a and FWeapon[WEAPON_SHOTGUN2] then Exit;
if (FAmmo[A_SHELLS] < FMaxAmmo[A_SHELLS]) or not FWeapon[WEAPON_SHOTGUN2] then
begin
if a and FWeapon[WEAPON_SHOTGUN2] then Exit;
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_SHOTGUN2];
- FWeapon[WEAPON_SHOTGUN2] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_SHOTGUN2;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_SHOTGUN2);
- end;
- end
- else FWeapon[WEAPON_SHOTGUN2] := True;
+ hadWeapon := FWeapon[WEAPON_SHOTGUN2];
+ switchWeapon := WEAPON_SHOTGUN2;
IncMax(FAmmo[A_SHELLS], 4, FMaxAmmo[A_SHELLS]);
IncMax(FAmmo[A_SHELLS], 4, FMaxAmmo[A_SHELLS]);
+ FWeapon[WEAPON_SHOTGUN2] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
if (FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS]) or not FWeapon[WEAPON_CHAINGUN] then
begin
if a and FWeapon[WEAPON_CHAINGUN] then Exit;
if (FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS]) or not FWeapon[WEAPON_CHAINGUN] then
begin
if a and FWeapon[WEAPON_CHAINGUN] then Exit;
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_CHAINGUN];
- FWeapon[WEAPON_CHAINGUN] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_CHAINGUN;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_CHAINGUN);
- end;
- end
- else FWeapon[WEAPON_CHAINGUN] := True;
+ hadWeapon := FWeapon[WEAPON_CHAINGUN];
+ switchWeapon := WEAPON_CHAINGUN;
IncMax(FAmmo[A_BULLETS], 50, FMaxAmmo[A_BULLETS]);
IncMax(FAmmo[A_BULLETS], 50, FMaxAmmo[A_BULLETS]);
+ FWeapon[WEAPON_CHAINGUN] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
if (FAmmo[A_ROCKETS] < FMaxAmmo[A_ROCKETS]) or not FWeapon[WEAPON_ROCKETLAUNCHER] then
begin
if a and FWeapon[WEAPON_ROCKETLAUNCHER] then Exit;
if (FAmmo[A_ROCKETS] < FMaxAmmo[A_ROCKETS]) or not FWeapon[WEAPON_ROCKETLAUNCHER] then
begin
if a and FWeapon[WEAPON_ROCKETLAUNCHER] then Exit;
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_ROCKETLAUNCHER];
- FWeapon[WEAPON_ROCKETLAUNCHER] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_ROCKETLAUNCHER;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_ROCKETLAUNCHER);
- end;
- end
- else FWeapon[WEAPON_ROCKETLAUNCHER] := True;
+ switchWeapon := WEAPON_ROCKETLAUNCHER;
+ hadWeapon := FWeapon[WEAPON_ROCKETLAUNCHER];
IncMax(FAmmo[A_ROCKETS], 2, FMaxAmmo[A_ROCKETS]);
IncMax(FAmmo[A_ROCKETS], 2, FMaxAmmo[A_ROCKETS]);
+ FWeapon[WEAPON_ROCKETLAUNCHER] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
if (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) or not FWeapon[WEAPON_PLASMA] then
begin
if a and FWeapon[WEAPON_PLASMA] then Exit;
if (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) or not FWeapon[WEAPON_PLASMA] then
begin
if a and FWeapon[WEAPON_PLASMA] then Exit;
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_PLASMA];
- FWeapon[WEAPON_PLASMA] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_PLASMA;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_PLASMA);
- end;
- end
- else FWeapon[WEAPON_PLASMA] := True;
+ switchWeapon := WEAPON_PLASMA;
+ hadWeapon := FWeapon[WEAPON_PLASMA];
IncMax(FAmmo[A_CELLS], 40, FMaxAmmo[A_CELLS]);
IncMax(FAmmo[A_CELLS], 40, FMaxAmmo[A_CELLS]);
+ FWeapon[WEAPON_PLASMA] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
if (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) or not FWeapon[WEAPON_BFG] then
begin
if a and FWeapon[WEAPON_BFG] then Exit;
if (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) or not FWeapon[WEAPON_BFG] then
begin
if a and FWeapon[WEAPON_BFG] then Exit;
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_BFG];
- FWeapon[WEAPON_BFG] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_BFG;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_BFG);
- end;
- end
- else FWeapon[WEAPON_BFG] := True;
+ switchWeapon := WEAPON_BFG;
+ hadWeapon := FWeapon[WEAPON_BFG];
IncMax(FAmmo[A_CELLS], 40, FMaxAmmo[A_CELLS]);
IncMax(FAmmo[A_CELLS], 40, FMaxAmmo[A_CELLS]);
+ FWeapon[WEAPON_BFG] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
if (FAmmo[A_SHELLS] < FMaxAmmo[A_SHELLS]) or not FWeapon[WEAPON_SUPERPULEMET] then
begin
if a and FWeapon[WEAPON_SUPERPULEMET] then Exit;
if (FAmmo[A_SHELLS] < FMaxAmmo[A_SHELLS]) or not FWeapon[WEAPON_SUPERPULEMET] then
begin
if a and FWeapon[WEAPON_SUPERPULEMET] then Exit;
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_SUPERPULEMET];
- FWeapon[WEAPON_SUPERPULEMET] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_SUPERPULEMET;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_SUPERPULEMET);
- end;
- end
- else FWeapon[WEAPON_SUPERPULEMET] := True;
+ switchWeapon := WEAPON_SUPERPULEMET;
+ hadWeapon := FWeapon[WEAPON_SUPERPULEMET];
IncMax(FAmmo[A_SHELLS], 4, FMaxAmmo[A_SHELLS]);
IncMax(FAmmo[A_SHELLS], 4, FMaxAmmo[A_SHELLS]);
+ FWeapon[WEAPON_SUPERPULEMET] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
if (FAmmo[A_FUEL] < FMaxAmmo[A_FUEL]) or not FWeapon[WEAPON_FLAMETHROWER] then
begin
if a and FWeapon[WEAPON_FLAMETHROWER] then Exit;
if (FAmmo[A_FUEL] < FMaxAmmo[A_FUEL]) or not FWeapon[WEAPON_FLAMETHROWER] then
begin
if a and FWeapon[WEAPON_FLAMETHROWER] then Exit;
- if ( (gWeaponAutoswitch = True) and ((g_Game_IsNet = False or (NetMode = NET_SERVER)) and ((Self = gPlayer1) or (Self = gPlayer2)))) then
- begin
- hadWeapon := FWeapon[WEAPON_FLAMETHROWER];
- FWeapon[WEAPON_FLAMETHROWER] := True;
- if (hadWeapon = False) then
- begin
- FCurrWeap := WEAPON_FLAMETHROWER;
- resetWeaponQueue();
- FModel.SetWeapon(WEAPON_FLAMETHROWER);
- end;
- end
- else FWeapon[WEAPON_FLAMETHROWER] := True;
+ switchWeapon := WEAPON_FLAMETHROWER;
+ hadWeapon := FWeapon[WEAPON_FLAMETHROWER];
IncMax(FAmmo[A_FUEL], 100, FMaxAmmo[A_FUEL]);
IncMax(FAmmo[A_FUEL], 100, FMaxAmmo[A_FUEL]);
+ FWeapon[WEAPON_FLAMETHROWER] := True;
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
Result := True;
if gFlash = 2 then Inc(FPickup, 5);
if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
if not (R_BERSERK in FRulez) then
begin
Include(FRulez, R_BERSERK);
if not (R_BERSERK in FRulez) then
begin
Include(FRulez, R_BERSERK);
+ (*
if allowBerserkSwitching then
begin
FCurrWeap := WEAPON_KASTET;
resetWeaponQueue();
FModel.SetWeapon(WEAPON_KASTET);
if allowBerserkSwitching then
begin
FCurrWeap := WEAPON_KASTET;
resetWeaponQueue();
FModel.SetWeapon(WEAPON_KASTET);
+ end; *)
+ if ( (g_Game_IsNet = False) or (NetMode = NET_SERVER) ) and ( ( (Self = gPlayer1) and (gPlayer1Settings.WeaponSwitch <> 0) ) or ( (gPlayer2 <> nil) and (Self = gPlayer2) and (gPlayer2Settings.WeaponSwitch <> 0) )) then
+ begin
+ if (Self = gPlayer1) then
+ begin
+ if (gPlayer1Settings.WeaponSwitch = 1) or ( (gPlayer1Settings.WeaponSwitch = 2) and (gPlayer1Settings.WeaponPreferences[WP_LAST+1] > gPlayer1Settings.WeaponPreferences[FCurrWeap]) ) then
+ begin
+ FCurrWeap := WEAPON_KASTET;
+ resetWeaponQueue();
+ FModel.SetWeapon(WEAPON_KASTET);
+ end;
+ end
+ else
+ begin
+ if (gPlayer2Settings.WeaponSwitch = 1) or ( (gPlayer2Settings.WeaponSwitch = 2) and (gPlayer2Settings.WeaponPreferences[WP_LAST+1] > gPlayer2Settings.WeaponPreferences[FCurrWeap]) ) then
+ begin
+ FCurrWeap := WEAPON_KASTET;
+ resetWeaponQueue();
+ FModel.SetWeapon(WEAPON_KASTET);
+ end;
+ end;
end;
if gFlash <> 0 then
begin
end;
if gFlash <> 0 then
begin
if gFlash = 2 then Inc(FPickup, 5);
end;
end;
if gFlash = 2 then Inc(FPickup, 5);
end;
end;
+ if ( (g_Game_IsNet = False) or (NetMode = NET_SERVER) ) and ( ( (Self = gPlayer1) and (gPlayer1Settings.WeaponSwitch <> 0) ) or ( (gPlayer2 <> nil) and (Self = gPlayer2) and (gPlayer2Settings.WeaponSwitch <> 0) )) then
+ begin
+ if (hadWeapon = False) then
+ begin
+ if (Self = gPlayer1) and ( (gPlayer1Settings.WeaponSwitch = 1) or ( (gPlayer1Settings.WeaponSwitch = 2)
+ and (gPlayer1Settings.WeaponPreferences[switchWeapon] > gPlayer1Settings.WeaponPreferences[FCurrWeap]) ) ) then
+ begin
+ FCurrWeap := switchWeapon;
+ resetWeaponQueue();
+ FModel.SetWeapon(switchWeapon);
+ end
+ else if (Self = gPlayer2) and ( (gPlayer2Settings.WeaponSwitch = 1) or ( (gPlayer2Settings.WeaponSwitch = 2)
+ and (gPlayer2Settings.WeaponPreferences[switchWeapon] > gPlayer2Settings.WeaponPreferences[FCurrWeap]) ) ) then
+ begin
+ FCurrWeap := switchWeapon;
+ resetWeaponQueue();
+ FModel.SetWeapon(switchWeapon);
+ end;
+ end;
+ end;
end;
procedure TPlayer.Touch();
end;
procedure TPlayer.Touch();
conRegVar('cheat_berserk_autoswitch', @gBerserkAutoswitch, 'autoswitch to fist when berserk pack taken', '', true, true);
conRegVar('player_indicator', @gPlayerIndicator, 'Draw indicator only for current player, also for teammates, or not at all', 'Draw indicator only for current player, also for teammates, or not at all');
conRegVar('player_indicator_style', @gPlayerIndicatorStyle, 'Visual appearance of indicator', 'Visual appearance of indicator');
conRegVar('cheat_berserk_autoswitch', @gBerserkAutoswitch, 'autoswitch to fist when berserk pack taken', '', true, true);
conRegVar('player_indicator', @gPlayerIndicator, 'Draw indicator only for current player, also for teammates, or not at all', 'Draw indicator only for current player, also for teammates, or not at all');
conRegVar('player_indicator_style', @gPlayerIndicatorStyle, 'Visual appearance of indicator', 'Visual appearance of indicator');
- conRegVar('weapon_autoswitch', @gWeaponAutoswitch, 'Automatically switch to a first time picked up weapon', '');
end.
end.