From 02aa579297ce5b8e70659aacf1b9ab505edc7aaa Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sat, 27 May 2017 23:05:23 +0300 Subject: [PATCH] added 2nd set of control keys (sore i kent inta bindengz iet) --- src/game/g_game.pas | 95 +++++++++++++++++++++------------------- src/game/g_language.pas | 6 +++ src/game/g_menu.pas | 96 +++++++++++++++++++++++++++++++++++++++-- src/game/g_options.pas | 70 ++++++++++++++++++++++++++++++ 4 files changed, 219 insertions(+), 48 deletions(-) diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 1be9d11..cc40728 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -1219,6 +1219,13 @@ begin Result := ids[(Length(ids) - 1 + idx) mod Length(ids)]; end; +function isKeyPressed (key1: Word; key2: Word): Boolean; +begin + if (key1 <> 0) and e_KeyPressed(key1) then begin result := true; exit; end; + if (key2 <> 0) and e_KeyPressed(key2) then begin result := true; exit; end; + result := false; +end; + procedure g_Game_Update(); var Msg: g_gui.TMessage; @@ -1462,13 +1469,13 @@ begin if gPlayer1 <> nil then with gGameControls.P1Control do begin - if e_KeyPressed(KeyLeft) and (not e_KeyPressed(KeyRight)) then + if isKeyPressed(KeyLeft, KeyLeft2) and (not isKeyPressed(KeyRight, KeyRight2)) then P1MoveButton := 1 // Íàæàòà òîëüêî "Âëåâî" else - if (not e_KeyPressed(KeyLeft)) and e_KeyPressed(KeyRight) then + if (not isKeyPressed(KeyLeft, KeyLeft2)) and isKeyPressed(KeyRight, KeyRight2) then P1MoveButton := 2 // Íàæàòà òîëüêî "Âïðàâî" else - if (not e_KeyPressed(KeyLeft)) and (not e_KeyPressed(KeyRight)) then + if (not isKeyPressed(KeyLeft, KeyLeft2)) and (not isKeyPressed(KeyRight, KeyRight2)) then P1MoveButton := 0; // Íå íàæàòû íè "Âëåâî", íè "Âïðàâî" // Ñåé÷àñ èëè ðàíüøå áûëè íàæàòû "Âëåâî"/"Âïðàâî" => ïåðåäàåì èãðîêó: @@ -1479,11 +1486,11 @@ begin gPlayer1.PressKey(KEY_RIGHT); // Ðàíüøå áûëà íàæàòà "Âïðàâî", à ñåé÷àñ "Âëåâî" => áåæèì âïðàâî, ñìîòðèì âëåâî: - if (P1MoveButton = 2) and e_KeyPressed(KeyLeft) then + if (P1MoveButton = 2) and isKeyPressed(KeyLeft, KeyLeft2) then gPlayer1.SetDirection(D_LEFT) else // Ðàíüøå áûëà íàæàòà "Âëåâî", à ñåé÷àñ "Âïðàâî" => áåæèì âëåâî, ñìîòðèì âïðàâî: - if (P1MoveButton = 1) and e_KeyPressed(KeyRight) then + if (P1MoveButton = 1) and isKeyPressed(KeyRight, KeyRight2) then gPlayer1.SetDirection(D_RIGHT) else // ×òî-òî áûëî íàæàòî è íå èçìåíèëîñü => êóäà áåæèì, òóäà è ñìîòðèì: @@ -1491,25 +1498,25 @@ begin gPlayer1.SetDirection(TDirection(P1MoveButton-1)); // Îñòàëüíûå êëàâèøè: - if e_KeyPressed(KeyJump) then gPlayer1.PressKey(KEY_JUMP); - if e_KeyPressed(KeyUp) then gPlayer1.PressKey(KEY_UP); - if e_KeyPressed(KeyDown) then gPlayer1.PressKey(KEY_DOWN); - if e_KeyPressed(KeyFire) then gPlayer1.PressKey(KEY_FIRE); - if e_KeyPressed(KeyNextWeapon) then gPlayer1.PressKey(KEY_NEXTWEAPON); - if e_KeyPressed(KeyPrevWeapon) then gPlayer1.PressKey(KEY_PREVWEAPON); - if e_KeyPressed(KeyOpen) then gPlayer1.PressKey(KEY_OPEN); + if isKeyPressed(KeyJump, KeyJump2) then gPlayer1.PressKey(KEY_JUMP); + if isKeyPressed(KeyUp, KeyUp2) then gPlayer1.PressKey(KEY_UP); + if isKeyPressed(KeyDown, KeyDown2) then gPlayer1.PressKey(KEY_DOWN); + if isKeyPressed(KeyFire, KeyFire2) then gPlayer1.PressKey(KEY_FIRE); + if isKeyPressed(KeyNextWeapon, KeyNextWeapon2) then gPlayer1.PressKey(KEY_NEXTWEAPON); + if isKeyPressed(KeyPrevWeapon, KeyPrevWeapon2) then gPlayer1.PressKey(KEY_PREVWEAPON); + if isKeyPressed(KeyOpen, KeyOpen2) then gPlayer1.PressKey(KEY_OPEN); end; // Âòîðîé èãðîê: if gPlayer2 <> nil then with gGameControls.P2Control do begin - if e_KeyPressed(KeyLeft) and (not e_KeyPressed(KeyRight)) then + if isKeyPressed(KeyLeft, KeyLeft2) and (not isKeyPressed(KeyRight, KeyRight2)) then P2MoveButton := 1 // Íàæàòà òîëüêî "Âëåâî" else - if (not e_KeyPressed(KeyLeft)) and e_KeyPressed(KeyRight) then + if (not isKeyPressed(KeyLeft, KeyLeft2)) and isKeyPressed(KeyRight, KeyRight2) then P2MoveButton := 2 // Íàæàòà òîëüêî "Âïðàâî" else - if (not e_KeyPressed(KeyLeft)) and (not e_KeyPressed(KeyRight)) then + if (not isKeyPressed(KeyLeft, KeyLeft2)) and (not isKeyPressed(KeyRight, KeyRight2)) then P2MoveButton := 0; // Íå íàæàòû íè "Âëåâî", íè "Âïðàâî" // Ñåé÷àñ èëè ðàíüøå áûëè íàæàòû "Âëåâî"/"Âïðàâî" => ïåðåäàåì èãðîêó: @@ -1520,11 +1527,11 @@ begin gPlayer2.PressKey(KEY_RIGHT, 1000); // Ðàíüøå áûëà íàæàòà "Âïðàâî", à ñåé÷àñ "Âëåâî" => áåæèì âïðàâî, ñìîòðèì âëåâî: - if (P2MoveButton = 2) and e_KeyPressed(KeyLeft) then + if (P2MoveButton = 2) and isKeyPressed(KeyLeft, KeyLeft2) then gPlayer2.SetDirection(D_LEFT) else // Ðàíüøå áûëà íàæàòà "Âëåâî", à ñåé÷àñ "Âïðàâî" => áåæèì âëåâî, ñìîòðèì âïðàâî: - if (P2MoveButton = 1) and e_KeyPressed(KeyRight) then + if (P2MoveButton = 1) and isKeyPressed(KeyRight, KeyRight2) then gPlayer2.SetDirection(D_RIGHT) else // ×òî-òî áûëî íàæàòî è íå èçìåíèëîñü => êóäà áåæèì, òóäà è ñìîòðèì: @@ -1532,13 +1539,13 @@ begin gPlayer2.SetDirection(TDirection(P2MoveButton-1)); // Îñòàëüíûå êëàâèøè: - if e_KeyPressed(KeyJump) then gPlayer2.PressKey(KEY_JUMP, 1000); - if e_KeyPressed(KeyUp) then gPlayer2.PressKey(KEY_UP, 1000); - if e_KeyPressed(KeyDown) then gPlayer2.PressKey(KEY_DOWN, 1000); - if e_KeyPressed(KeyFire) then gPlayer2.PressKey(KEY_FIRE); - if e_KeyPressed(KeyNextWeapon) then gPlayer2.PressKey(KEY_NEXTWEAPON); - if e_KeyPressed(KeyPrevWeapon) then gPlayer2.PressKey(KEY_PREVWEAPON); - if e_KeyPressed(KeyOpen) then gPlayer2.PressKey(KEY_OPEN); + if isKeyPressed(KeyJump, KeyJump2) then gPlayer2.PressKey(KEY_JUMP, 1000); + if isKeyPressed(KeyUp, KeyUp2) then gPlayer2.PressKey(KEY_UP, 1000); + if isKeyPressed(KeyDown, KeyDown2) then gPlayer2.PressKey(KEY_DOWN, 1000); + if isKeyPressed(KeyFire, KeyFire2) then gPlayer2.PressKey(KEY_FIRE); + if isKeyPressed(KeyNextWeapon, KeyNextWeapon2) then gPlayer2.PressKey(KEY_NEXTWEAPON); + if isKeyPressed(KeyPrevWeapon, KeyPrevWeapon2) then gPlayer2.PressKey(KEY_PREVWEAPON); + if isKeyPressed(KeyOpen, KeyOpen2) then gPlayer2.PressKey(KEY_OPEN); end; end // if not console else @@ -1553,7 +1560,7 @@ begin begin if not gSpectKeyPress then begin - if e_KeyPressed(gGameControls.P1Control.KeyJump) then + if isKeyPressed(gGameControls.P1Control.KeyJump, gGameControls.P1Control.KeyJump2) then begin // switch spect mode case gSpectMode of @@ -1566,21 +1573,21 @@ begin end; if gSpectMode = SPECT_MAPVIEW then begin - if e_KeyPressed(gGameControls.P1Control.KeyLeft) then + if isKeyPressed(gGameControls.P1Control.KeyLeft, gGameControls.P1Control.KeyLeft2) then gSpectX := Max(gSpectX - gSpectStep, 0); - if e_KeyPressed(gGameControls.P1Control.KeyRight) then + if isKeyPressed(gGameControls.P1Control.KeyRight, gGameControls.P1Control.KeyRight2) then gSpectX := Min(gSpectX + gSpectStep, gMapInfo.Width - gScreenWidth); - if e_KeyPressed(gGameControls.P1Control.KeyUp) then + if isKeyPressed(gGameControls.P1Control.KeyUp, gGameControls.P1Control.KeyUp2) then gSpectY := Max(gSpectY - gSpectStep, 0); - if e_KeyPressed(gGameControls.P1Control.KeyDown) then + if isKeyPressed(gGameControls.P1Control.KeyDown, gGameControls.P1Control.KeyDown2) then gSpectY := Min(gSpectY + gSpectStep, gMapInfo.Height - gScreenHeight); - if e_KeyPressed(gGameControls.P1Control.KeyPrevWeapon) then + if isKeyPressed(gGameControls.P1Control.KeyPrevWeapon, gGameControls.P1Control.KeyPrevWeapon2) then begin // decrease step if gSpectStep > 4 then gSpectStep := gSpectStep shr 1; gSpectKeyPress := True; end; - if e_KeyPressed(gGameControls.P1Control.KeyNextWeapon) then + if isKeyPressed(gGameControls.P1Control.KeyNextWeapon, gGameControls.P1Control.KeyNextWeapon2) then begin // increase step if gSpectStep < 64 then gSpectStep := gSpectStep shl 1; @@ -1589,37 +1596,37 @@ begin end; if gSpectMode = SPECT_PLAYERS then begin - if e_KeyPressed(gGameControls.P1Control.KeyUp) then + if isKeyPressed(gGameControls.P1Control.KeyUp, gGameControls.P1Control.KeyUp2) then begin // add second view gSpectViewTwo := True; gSpectKeyPress := True; end; - if e_KeyPressed(gGameControls.P1Control.KeyDown) then + if isKeyPressed(gGameControls.P1Control.KeyDown, gGameControls.P1Control.KeyDown2) then begin // remove second view gSpectViewTwo := False; gSpectKeyPress := True; end; - if e_KeyPressed(gGameControls.P1Control.KeyLeft) then + if isKeyPressed(gGameControls.P1Control.KeyLeft, gGameControls.P1Control.KeyLeft2) then begin // prev player (view 1) gSpectPID1 := GetActivePlayerID_Prev(gSpectPID1); gSpectKeyPress := True; end; - if e_KeyPressed(gGameControls.P1Control.KeyRight) then + if isKeyPressed(gGameControls.P1Control.KeyRight, gGameControls.P1Control.KeyRight2) then begin // next player (view 1) gSpectPID1 := GetActivePlayerID_Next(gSpectPID1); gSpectKeyPress := True; end; - if e_KeyPressed(gGameControls.P1Control.KeyPrevWeapon) then + if isKeyPressed(gGameControls.P1Control.KeyPrevWeapon, gGameControls.P1Control.KeyPrevWeapon2) then begin // prev player (view 2) gSpectPID2 := GetActivePlayerID_Prev(gSpectPID2); gSpectKeyPress := True; end; - if e_KeyPressed(gGameControls.P1Control.KeyNextWeapon) then + if isKeyPressed(gGameControls.P1Control.KeyNextWeapon, gGameControls.P1Control.KeyNextWeapon2) then begin // next player (view 2) gSpectPID2 := GetActivePlayerID_Next(gSpectPID2); @@ -1628,13 +1635,13 @@ begin end; end else - if (not e_KeyPressed(gGameControls.P1Control.KeyJump)) and - (not e_KeyPressed(gGameControls.P1Control.KeyLeft)) and - (not e_KeyPressed(gGameControls.P1Control.KeyRight)) and - (not e_KeyPressed(gGameControls.P1Control.KeyUp)) and - (not e_KeyPressed(gGameControls.P1Control.KeyDown)) and - (not e_KeyPressed(gGameControls.P1Control.KeyPrevWeapon)) and - (not e_KeyPressed(gGameControls.P1Control.KeyNextWeapon)) then + if (not isKeyPressed(gGameControls.P1Control.KeyJump, gGameControls.P1Control.KeyJump2)) and + (not isKeyPressed(gGameControls.P1Control.KeyLeft, gGameControls.P1Control.KeyLeft2)) and + (not isKeyPressed(gGameControls.P1Control.KeyRight, gGameControls.P1Control.KeyRight2)) and + (not isKeyPressed(gGameControls.P1Control.KeyUp, gGameControls.P1Control.KeyUp2)) and + (not isKeyPressed(gGameControls.P1Control.KeyDown, gGameControls.P1Control.KeyDown2)) and + (not isKeyPressed(gGameControls.P1Control.KeyPrevWeapon, gGameControls.P1Control.KeyPrevWeapon2)) and + (not isKeyPressed(gGameControls.P1Control.KeyNextWeapon, gGameControls.P1Control.KeyNextWeapon2)) then gSpectKeyPress := False; end; diff --git a/src/game/g_language.pas b/src/game/g_language.pas index 7a9d559..1d90b69 100644 --- a/src/game/g_language.pas +++ b/src/game/g_language.pas @@ -183,6 +183,8 @@ type I_MENU_LOADING, I_MENU_PLAYER_1, I_MENU_PLAYER_2, + I_MENU_PLAYER_1_ALT, + I_MENU_PLAYER_2_ALT, I_MENU_CONTROL_JOYSTICKS, I_MENU_CONTROL_DEADZONE, @@ -913,6 +915,10 @@ const 'Ïåðâûé èãðîê'), ('MENU PLAYER 2', 'Player 2', 'Âòîðîé èãðîê'), + ('MENU PLAYER 1 ALT', 'Player 1 ALT', + 'Ïåðâûé èãðîê ALT'), + ('MENU PLAYER 2 ALT', 'Player 2 ALT', + 'Âòîðîé èãðîê ALT'), ('MENU CONTROL JOYSTICKS', 'Joystick Settings', 'Íàñòðîéêè äæîéñòèêîâ'), diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 16c2d01..bdf925b 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -164,7 +164,6 @@ begin end; menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu')); - with menu, gGameControls.P1Control do begin KeyRight := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key; @@ -178,8 +177,21 @@ begin KeyOpen := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key; end; - menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu')); + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuAlt').GetControl('mOptionsControlsP1MenuAlt')); + with menu, gGameControls.P1Control do + begin + KeyRight2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key; + KeyLeft2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key; + KeyUp2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key; + KeyDown2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key; + KeyFire2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key; + KeyJump2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key; + KeyNextWeapon2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key; + KeyPrevWeapon2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key; + KeyOpen2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key; + end; + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu')); with menu, gGameControls.P2Control do begin KeyRight := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key; @@ -193,6 +205,20 @@ begin KeyOpen := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key; end; + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt')); + with menu, gGameControls.P2Control do + begin + KeyRight2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key; + KeyLeft2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key; + KeyUp2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key; + KeyDown2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key; + KeyFire2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key; + KeyJump2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key; + KeyNextWeapon2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key; + KeyPrevWeapon2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key; + KeyOpen2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key; + end; + if e_JoysticksAvailable > 0 then begin menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu')); @@ -304,7 +330,6 @@ begin ItemIndex := 0; menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu')); - with menu, gGameControls.P1Control do begin TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight; @@ -318,8 +343,21 @@ begin TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen; end; - menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu')); + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuAlt').GetControl('mOptionsControlsP1MenuAlt')); + with menu, gGameControls.P1Control do + begin + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key := KeyLeft2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key := KeyUp2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key := KeyDown2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key := KeyFire2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key := KeyJump2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key := KeyNextWeapon2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key := KeyPrevWeapon2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen2; + end; + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu')); with menu, gGameControls.P2Control do begin TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight; @@ -333,6 +371,20 @@ begin TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen; end; + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt')); + with menu, gGameControls.P2Control do + begin + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key := KeyLeft2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key := KeyUp2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key := KeyDown2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key := KeyFire2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key := KeyJump2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key := KeyNextWeapon2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key := KeyPrevWeapon2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen2; + end; + if e_JoysticksAvailable > 0 then begin menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu')); @@ -2545,7 +2597,9 @@ begin AddKeyRead(_lc[I_MENU_CONTROL_TEAMCHAT]).Name := _lc[I_MENU_CONTROL_TEAMCHAT]; AddSpace(); AddButton(nil, _lc[I_MENU_PLAYER_1], 'OptionsControlsP1Menu'); + AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt'); AddButton(nil, _lc[I_MENU_PLAYER_2], 'OptionsControlsP2Menu'); + AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt'); AddSpace(); if e_JoysticksAvailable <> 0 then AddButton(nil, _lc[I_MENU_CONTROL_JOYSTICKS], 'OptionsControlsJoystickMenu'); @@ -2570,6 +2624,23 @@ begin Menu.DefControl := 'mOptionsControlsP1Menu'; g_GUI_AddWindow(Menu); + Menu := TGUIWindow.Create('OptionsControlsP1MenuAlt'); + with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1]))) do + begin + Name := 'mOptionsControlsP1MenuAlt'; + AddKeyRead(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT]; + AddKeyRead(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT]; + AddKeyRead(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP]; + AddKeyRead(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN]; + AddKeyRead(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP]; + AddKeyRead(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE]; + AddKeyRead(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE]; + AddKeyRead(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON]; + AddKeyRead(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON]; + end; + Menu.DefControl := 'mOptionsControlsP1MenuAlt'; + g_GUI_AddWindow(Menu); + Menu := TGUIWindow.Create('OptionsControlsP2Menu'); with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2]))) do begin @@ -2587,6 +2658,23 @@ begin Menu.DefControl := 'mOptionsControlsP2Menu'; g_GUI_AddWindow(Menu); + Menu := TGUIWindow.Create('OptionsControlsP2MenuAlt'); + with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2]))) do + begin + Name := 'mOptionsControlsP2MenuAlt'; + AddKeyRead(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT]; + AddKeyRead(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT]; + AddKeyRead(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP]; + AddKeyRead(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN]; + AddKeyRead(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP]; + AddKeyRead(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE]; + AddKeyRead(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE]; + AddKeyRead(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON]; + AddKeyRead(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON]; + end; + Menu.DefControl := 'mOptionsControlsP2MenuAlt'; + g_GUI_AddWindow(Menu); + Menu := TGUIWindow.Create('OptionsControlsJoystickMenu'); with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_JOYSTICKS]))) do begin diff --git a/src/game/g_options.pas b/src/game/g_options.pas index fd68a7a..65e6f21 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -32,6 +32,16 @@ type KeyNextWeapon: Word; KeyPrevWeapon: Word; KeyOpen: Word; + + KeyRight2: Word; + KeyLeft2: Word; + KeyUp2: Word; + KeyDown2: Word; + KeyFire2: Word; + KeyJump2: Word; + KeyNextWeapon2: Word; + KeyPrevWeapon2: Word; + KeyOpen2: Word; end; TGameControls = record @@ -165,6 +175,16 @@ begin KeyNextWeapon := 73; KeyPrevWeapon := 71; KeyOpen := 54; + + KeyRight2 := 0; + KeyLeft2 := 0; + KeyUp2 := 0; + KeyDown2 := 0; + KeyFire2 := 0; + KeyJump2 := 0; + KeyNextWeapon2 := 0; + KeyPrevWeapon2 := 0; + KeyOpen2 := 0; end; with gGameControls.P2Control do @@ -178,6 +198,16 @@ begin KeyNextWeapon := 19; KeyPrevWeapon := 17; KeyOpen := 58; + + KeyRight2 := 0; + KeyLeft2 := 0; + KeyUp2 := 0; + KeyDown2 := 0; + KeyFire2 := 0; + KeyJump2 := 0; + KeyNextWeapon2 := 0; + KeyPrevWeapon2 := 0; + KeyOpen2 := 0; end; with gPlayer1Settings do @@ -284,6 +314,16 @@ begin KeyNextWeapon := ReadInt('Player1', 'KeyNextWeapon', 19); KeyPrevWeapon := ReadInt('Player1', 'KeyPrevWeapon', 17); KeyOpen := ReadInt('Player1', 'KeyOpen', 58); + + KeyRight2 := ReadInt('Player1', 'KeyRight2', 0); + KeyLeft2 := ReadInt('Player1', 'KeyLeft2', 0); + KeyUp2 := ReadInt('Player1', 'KeyUp2', 0); + KeyDown2 := ReadInt('Player1', 'KeyDown2', 0); + KeyFire2 := ReadInt('Player1', 'KeyFire2', 0); + KeyJump2 := ReadInt('Player1', 'KeyJump2', 0); + KeyNextWeapon2 := ReadInt('Player1', 'KeyNextWeapon2', 0); + KeyPrevWeapon2 := ReadInt('Player1', 'KeyPrevWeapon2', 0); + KeyOpen2 := ReadInt('Player1', 'KeyOpen2', 0); end; with gPlayer1Settings, config do @@ -309,6 +349,16 @@ begin KeyNextWeapon := ReadInt('Player2', 'KeyNextWeapon', 73); KeyPrevWeapon := ReadInt('Player2', 'KeyPrevWeapon', 71); KeyOpen := ReadInt('Player2', 'KeyOpen', 54); + + KeyRight2 := ReadInt('Player2', 'KeyRight2', 0); + KeyLeft2 := ReadInt('Player2', 'KeyLeft2', 0); + KeyUp2 := ReadInt('Player2', 'KeyUp2', 0); + KeyDown2 := ReadInt('Player2', 'KeyDown2', 0); + KeyFire2 := ReadInt('Player2', 'KeyFire2', 0); + KeyJump2 := ReadInt('Player2', 'KeyJump2', 0); + KeyNextWeapon2 := ReadInt('Player2', 'KeyNextWeapon2', 0); + KeyPrevWeapon2 := ReadInt('Player2', 'KeyPrevWeapon2', 0); + KeyOpen2 := ReadInt('Player2', 'KeyOpen2', 0); end; with gPlayer2Settings, config do @@ -501,6 +551,16 @@ begin WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon); WriteInt('Player1', 'KeyOpen', KeyOpen); + WriteInt('Player1', 'KeyRight2', KeyRight2); + WriteInt('Player1', 'KeyLeft2', KeyLeft2); + WriteInt('Player1', 'KeyUp2', KeyUp2); + WriteInt('Player1', 'KeyDown2', KeyDown2); + WriteInt('Player1', 'KeyFire2', KeyFire2); + WriteInt('Player1', 'KeyJump2', KeyJump2); + WriteInt('Player1', 'KeyNextWeapon2', KeyNextWeapon2); + WriteInt('Player1', 'KeyPrevWeapon2', KeyPrevWeapon2); + WriteInt('Player1', 'KeyOpen2', KeyOpen2); + WriteStr('Player1', 'Name', Name); WriteStr('Player1', 'model', Model); WriteInt('Player1', 'red', Color.R); @@ -521,6 +581,16 @@ begin WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon); WriteInt('Player2', 'KeyOpen', KeyOpen); + WriteInt('Player2', 'KeyRight2', KeyRight2); + WriteInt('Player2', 'KeyLeft2', KeyLeft2); + WriteInt('Player2', 'KeyUp2', KeyUp2); + WriteInt('Player2', 'KeyDown2', KeyDown2); + WriteInt('Player2', 'KeyFire2', KeyFire2); + WriteInt('Player2', 'KeyJump2', KeyJump2); + WriteInt('Player2', 'KeyNextWeapon2', KeyNextWeapon2); + WriteInt('Player2', 'KeyPrevWeapon2', KeyPrevWeapon2); + WriteInt('Player2', 'KeyOpen2', KeyOpen2); + WriteStr('Player2', 'Name', Name); WriteStr('Player2', 'model', Model); WriteInt('Player2', 'red', Color.R); -- 2.29.2