DEADSOFTWARE

add direct weapon switching
[d2df-sdl.git] / src / game / g_menu.pas
index 5cd389bf42ff5b970267fe35e77ca35e9cb9cac5..2f216ff47182e46907e4e15adde1e95ab30e66c5 100644 (file)
@@ -192,6 +192,13 @@ begin
     KeyStrafe2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key;
   end;
 
+  menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
+  with menu, gGameControls.P1Control do
+  begin
+    for i := 0 to 9 do
+      KeyWeapon[i] := TGUIKeyRead(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key;
+  end;
+
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
   with menu, gGameControls.P2Control do
   begin
@@ -221,6 +228,13 @@ begin
     KeyStrafe2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key;
   end;
 
+  menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
+  with menu, gGameControls.P2Control do
+  begin
+    for i := 0 to 9 do
+      KeyWeapon[i] := TGUIKeyRead(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key;
+  end;
+
   if e_JoysticksAvailable > 0 then
   begin
     menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
@@ -2602,8 +2616,10 @@ begin
     AddSpace();
     AddButton(nil, _lc[I_MENU_PLAYER_1], 'OptionsControlsP1Menu');
     AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');
+    AddButton(nil, _lc[I_MENU_PLAYER_1_WEAPONS], 'OptionsControlsP1MenuWeapons');
     AddButton(nil, _lc[I_MENU_PLAYER_2], 'OptionsControlsP2Menu');
     AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');
+    AddButton(nil, _lc[I_MENU_PLAYER_2_WEAPONS], 'OptionsControlsP2MenuWeapons');
     AddSpace();
     if e_JoysticksAvailable <> 0 then
       AddButton(nil, _lc[I_MENU_CONTROL_JOYSTICKS], 'OptionsControlsJoystickMenu');
@@ -2629,7 +2645,7 @@ begin
   g_GUI_AddWindow(Menu);
 
   Menu := TGUIWindow.Create('OptionsControlsP1MenuAlt');
-  with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1]))) do
+  with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_ALT]))) do
   begin
     Name := 'mOptionsControlsP1MenuAlt';
     AddKeyRead(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
@@ -2646,6 +2662,17 @@ begin
   Menu.DefControl := 'mOptionsControlsP1MenuAlt';
   g_GUI_AddWindow(Menu);
 
+  Menu := TGUIWindow.Create('OptionsControlsP1MenuWeapons');
+  with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_WEAPONS]))) do
+  begin
+    Name := 'mOptionsControlsP1MenuWeapons';
+    for i := 0 to 9 do
+      AddKeyRead(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
+        _lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
+  end;
+  Menu.DefControl := 'mOptionsControlsP1MenuWeapons';
+  g_GUI_AddWindow(Menu);
+
   Menu := TGUIWindow.Create('OptionsControlsP2Menu');
   with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2]))) do
   begin
@@ -2664,7 +2691,7 @@ begin
   g_GUI_AddWindow(Menu);
 
   Menu := TGUIWindow.Create('OptionsControlsP2MenuAlt');
-  with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2]))) do
+  with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_ALT]))) do
   begin
     Name := 'mOptionsControlsP2MenuAlt';
     AddKeyRead(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
@@ -2681,6 +2708,18 @@ begin
   Menu.DefControl := 'mOptionsControlsP2MenuAlt';
   g_GUI_AddWindow(Menu);
 
+
+  Menu := TGUIWindow.Create('OptionsControlsP2MenuWeapons');
+  with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_WEAPONS]))) do
+  begin
+    Name := 'mOptionsControlsP2MenuWeapons';
+    for i := 0 to 9 do
+      AddKeyRead(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
+        _lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
+  end;
+  Menu.DefControl := 'mOptionsControlsP2MenuWeapons';
+  g_GUI_AddWindow(Menu);
+
   Menu := TGUIWindow.Create('OptionsControlsJoystickMenu');
   with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_JOYSTICKS]))) do
   begin