summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8cd33b2)
raw | patch | inline | side by side (parent: 8cd33b2)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 6 Apr 2019 22:01:08 +0000 (01:01 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 6 Apr 2019 22:01:08 +0000 (01:01 +0300) |
diff --git a/src/engine/e_input.pas b/src/engine/e_input.pas
index 1f1ba160be591fe9771b9779a295c7b13d140c76..ea34841f13ae707ab926449caaab38640cd8b63f 100644 (file)
--- a/src/engine/e_input.pas
+++ b/src/engine/e_input.pas
// $$$..$$$ - 4*4 Joystick hats (L U R D)
// $$$..$$$ - 48 Virtual buttons/keys
+ KBRD_END = e_MaxKbdKeys;
+ JOYK_BEG = KBRD_END;
+ JOYK_END = JOYK_BEG + e_MaxJoyBtns*e_MaxJoys;
+ JOYA_BEG = JOYK_END;
+ JOYA_END = JOYA_BEG + e_MaxJoyAxes*2*e_MaxJoys;
+ JOYH_BEG = JOYA_END;
+ JOYH_END = JOYH_BEG + e_MaxJoyHats*4*e_MaxJoys;
+ VIRT_BEG = JOYH_END;
+ VIRT_END = VIRT_BEG + e_MaxVirtKeys;
+
// these are apparently used in g_gui and g_game and elsewhere
IK_INVALID = 0;
IK_ESCAPE = SDL_SCANCODE_ESCAPE;
HAT_RIGHT = 2;
HAT_DOWN = 3;
+ JOY0_ATTACK = JOYK_BEG + 0*e_MaxJoyBtns + 0;
+ JOY1_ATTACK = JOYK_BEG + 1*e_MaxJoyBtns + 0;
+ JOY2_ATTACK = JOYK_BEG + 2*e_MaxJoyBtns + 0;
+ JOY3_ATTACK = JOYK_BEG + 3*e_MaxJoyBtns + 0;
+ JOY0_NEXT = JOYK_BEG + 0*e_MaxJoyBtns + 1;
+ JOY1_NEXT = JOYK_BEG + 1*e_MaxJoyBtns + 1;
+ JOY2_NEXT = JOYK_BEG + 2*e_MaxJoyBtns + 1;
+ JOY3_NEXT = JOYK_BEG + 3*e_MaxJoyBtns + 1;
+ JOY0_JUMP = JOYK_BEG + 0*e_MaxJoyBtns + 2;
+ JOY1_JUMP = JOYK_BEG + 1*e_MaxJoyBtns + 2;
+ JOY2_JUMP = JOYK_BEG + 2*e_MaxJoyBtns + 2;
+ JOY3_JUMP = JOYK_BEG + 3*e_MaxJoyBtns + 2;
+ JOY0_ACTIVATE = JOYK_BEG + 0*e_MaxJoyBtns + 3;
+ JOY1_ACTIVATE = JOYK_BEG + 1*e_MaxJoyBtns + 3;
+ JOY2_ACTIVATE = JOYK_BEG + 2*e_MaxJoyBtns + 3;
+ JOY3_ACTIVATE = JOYK_BEG + 3*e_MaxJoyBtns + 3;
+ JOY0_PREV = JOYK_BEG + 0*e_MaxJoyBtns + 4;
+ JOY1_PREV = JOYK_BEG + 1*e_MaxJoyBtns + 4;
+ JOY2_PREV = JOYK_BEG + 2*e_MaxJoyBtns + 4;
+ JOY3_PREV = JOYK_BEG + 3*e_MaxJoyBtns + 4;
+
+ JOY0_LEFT = JOYA_BEG + 0*e_MaxJoyAxes*2 + 0*2 + AX_MINUS;
+ JOY1_LEFT = JOYA_BEG + 1*e_MaxJoyAxes*2 + 0*2 + AX_MINUS;
+ JOY2_LEFT = JOYA_BEG + 2*e_MaxJoyAxes*2 + 0*2 + AX_MINUS;
+ JOY3_LEFT = JOYA_BEG + 3*e_MaxJoyAxes*2 + 0*2 + AX_MINUS;
+ JOY0_RIGHT = JOYA_BEG + 0*e_MaxJoyAxes*2 + 0*2 + AX_PLUS;
+ JOY1_RIGHT = JOYA_BEG + 1*e_MaxJoyAxes*2 + 0*2 + AX_PLUS;
+ JOY2_RIGHT = JOYA_BEG + 2*e_MaxJoyAxes*2 + 0*2 + AX_PLUS;
+ JOY3_RIGHT = JOYA_BEG + 3*e_MaxJoyAxes*2 + 0*2 + AX_PLUS;
+ JOY0_UP = JOYA_BEG + 0*e_MaxJoyAxes*2 + 1*2 + AX_MINUS;
+ JOY1_UP = JOYA_BEG + 1*e_MaxJoyAxes*2 + 1*2 + AX_MINUS;
+ JOY2_UP = JOYA_BEG + 2*e_MaxJoyAxes*2 + 1*2 + AX_MINUS;
+ JOY3_UP = JOYA_BEG + 3*e_MaxJoyAxes*2 + 1*2 + AX_MINUS;
+ JOY0_DOWN = JOYA_BEG + 0*e_MaxJoyAxes*2 + 1*2 + AX_PLUS;
+ JOY1_DOWN = JOYA_BEG + 1*e_MaxJoyAxes*2 + 1*2 + AX_PLUS;
+ JOY2_DOWN = JOYA_BEG + 2*e_MaxJoyAxes*2 + 1*2 + AX_PLUS;
+ JOY3_DOWN = JOYA_BEG + 3*e_MaxJoyAxes*2 + 1*2 + AX_PLUS;
+
function e_InitInput: Boolean;
procedure e_ReleaseInput;
procedure e_UnpressAllKeys;
implementation
-const
- KBRD_END = e_MaxKbdKeys;
- JOYK_BEG = KBRD_END;
- JOYK_END = JOYK_BEG + e_MaxJoyBtns*e_MaxJoys;
- JOYA_BEG = JOYK_END;
- JOYA_END = JOYA_BEG + e_MaxJoyAxes*2*e_MaxJoys;
- JOYH_BEG = JOYA_END;
- JOYH_END = JOYH_BEG + e_MaxJoyHats*4*e_MaxJoys;
- VIRT_BEG = JOYH_END;
- VIRT_END = VIRT_BEG + e_MaxVirtKeys;
-
var
InputBuffer: array [0..e_MaxInputKeys - 1] of Boolean;
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 2de108c09633767360ea3874fd5ff1b57049011d..e3cc3b3efbafbfef3b53aa8c06e8bbcf6cae4e78 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
IK_DELETE:
if (Length(Line) > 0) and (CPos <= Length(Line)) then
Delete(Line, CPos, 1);
- IK_LEFT, IK_KPLEFT, VK_LEFT:
+ IK_LEFT, IK_KPLEFT, VK_LEFT, JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT:
if CPos > 1 then
CPos := CPos - 1;
- IK_RIGHT, IK_KPRIGHT, VK_RIGHT:
+ IK_RIGHT, IK_KPRIGHT, VK_RIGHT, JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT:
if CPos <= Length(Line) then
CPos := CPos + 1;
- IK_RETURN, IK_KPRETURN, VK_OPEN, VK_FIRE:
+ IK_RETURN, IK_KPRETURN, VK_OPEN, VK_FIRE, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
begin
if Cons_Shown then
g_Console_Process(Line)
IK_TAB:
if not gChatShow then
Complete();
- IK_DOWN, IK_KPDOWN, VK_DOWN:
+ IK_DOWN, IK_KPDOWN, VK_DOWN, JOY0_DOWN, JOY1_DOWN, JOY2_DOWN, JOY3_DOWN:
if not gChatShow then
if (CommandHistory <> nil) and
(CmdIndex < Length(CommandHistory)) then
Line := CommandHistory[CmdIndex];
CPos := Length(Line) + 1;
end;
- IK_UP, IK_KPUP, VK_UP:
+ IK_UP, IK_KPUP, VK_UP, JOY0_UP, JOY1_UP, JOY2_UP, JOY3_UP:
if not gChatShow then
if (CommandHistory <> nil) and
(CmdIndex <= Length(CommandHistory)) then
Line := CommandHistory[CmdIndex];
Cpos := Length(Line) + 1;
end;
- IK_PAGEUP, IK_KPPAGEUP, VK_PREV: // PgUp
+ IK_PAGEUP, IK_KPPAGEUP, VK_PREV, JOY0_PREV, JOY1_PREV, JOY2_PREV, JOY3_PREV: // PgUp
if not gChatShow then Inc(conSkipLines);
- IK_PAGEDN, IK_KPPAGEDN, VK_NEXT: // PgDown
+ IK_PAGEDN, IK_KPPAGEDN, VK_NEXT, JOY0_NEXT, JOY1_NEXT, JOY2_NEXT, JOY3_NEXT: // PgDown
if not gChatShow and (conSkipLines > 0) then Dec(conSkipLines);
IK_HOME, IK_KPHOME:
CPos := 1;
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 6ef589569664476b8e65e89dfb06b61e96e3a2ee..7e1249d6aa474c9e7d4e184c53c7a803991a1fee 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
(
(
e_KeyPressed(IK_RETURN) or e_KeyPressed(IK_KPRETURN) or e_KeyPressed(IK_SPACE) or
- e_KeyPressed(VK_FIRE) or e_KeyPressed(VK_OPEN)
+ e_KeyPressed(VK_FIRE) or e_KeyPressed(VK_OPEN) or
+ e_KeyPressed(JOY0_ATTACK) or e_KeyPressed(JOY1_ATTACK) or
+ e_KeyPressed(JOY2_ATTACK) or e_KeyPressed(JOY3_ATTACK)
)
and (not gJustChatted) and (not gConsoleShow) and (not gChatShow)
and (g_ActiveWindow = nil)
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
+ if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) or
+ e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
begin
State := 0;
break;
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index bc33eff23182b207e972b384473ce25778cfdf70..8a599fd7a3a9a0c99c05245216c0f1882937dec6 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
if @FOnKeyDownEx <> nil then FOnKeyDownEx(self, Msg.wParam);
if Msg.Msg = WM_KEYDOWN then
- if (Msg.wParam = IK_ESCAPE) or (Msg.wParam = VK_ESCAPE) then
- begin
- g_GUI_HideWindow;
- Exit;
- end;
+ begin
+ case Msg.wParam of
+ IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
+ begin
+ g_GUI_HideWindow;
+ Exit
+ end
+ end
+ end
end;
procedure TGUIWindow.SetActive(Control: TGUIControl);
case Msg.Msg of
WM_KEYDOWN:
case Msg.wParam of
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN: Click();
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: Click();
end;
end;
end;
case Msg.Msg of
WM_KEYDOWN:
case Msg.wParam of
- IK_UP, IK_KPUP, VK_UP:
+ IK_UP, IK_KPUP, VK_UP, JOY0_UP, JOY1_UP, JOY2_UP, JOY3_UP:
begin
repeat
Dec(FIndex);
g_Sound_PlayEx(MENU_CHANGESOUND);
end;
- IK_DOWN, IK_KPDOWN, VK_DOWN:
+ IK_DOWN, IK_KPDOWN, VK_DOWN, JOY0_DOWN, JOY1_DOWN, JOY2_DOWN, JOY3_DOWN:
begin
repeat
Inc(FIndex);
g_Sound_PlayEx(MENU_CHANGESOUND);
end;
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN: if (FIndex <> -1) and FButtons[FIndex].FEnabled then FButtons[FIndex].Click;
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: if (FIndex <> -1) and FButtons[FIndex].FEnabled then FButtons[FIndex].Click;
end;
end;
end;
case Msg.Msg of
WM_KEYDOWN:
case Msg.wParam of
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN: if @FOnClickEvent <> nil then FOnClickEvent();
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: if @FOnClickEvent <> nil then FOnClickEvent();
end;
end;
end;
WM_KEYDOWN:
begin
case Msg.wParam of
- IK_UP, IK_KPUP, VK_UP:
+ IK_UP, IK_KPUP, VK_UP,JOY0_UP, JOY1_UP, JOY2_UP, JOY3_UP:
begin
c := 0;
repeat
g_Sound_PlayEx(MENU_CHANGESOUND);
end;
- IK_DOWN, IK_KPDOWN, VK_DOWN:
+ IK_DOWN, IK_KPDOWN, VK_DOWN, JOY0_DOWN, JOY1_DOWN, JOY2_DOWN, JOY3_DOWN:
begin
c := 0;
repeat
g_Sound_PlayEx(MENU_CHANGESOUND);
end;
- IK_LEFT, IK_RIGHT, IK_KPLEFT, IK_KPRIGHT, VK_LEFT, VK_RIGHT:
+ IK_LEFT, IK_RIGHT, IK_KPLEFT, IK_KPRIGHT, VK_LEFT, VK_RIGHT,
+ JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT,
+ JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT:
begin
if FIndex <> -1 then
if FItems[FIndex].Control <> nil then
FItems[FIndex].Control.OnMessage(Msg);
end;
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN:
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
begin
if FIndex <> -1 then
begin
WM_KEYDOWN:
begin
case Msg.wParam of
- IK_LEFT, IK_KPLEFT, VK_LEFT:
+ IK_LEFT, IK_KPLEFT, VK_LEFT, JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT:
if FValue > 0 then
begin
Dec(FValue);
g_Sound_PlayEx(SCROLL_SUBSOUND);
if @FOnChangeEvent <> nil then FOnChangeEvent(Self);
end;
- IK_RIGHT, IK_KPRIGHT, VK_RIGHT:
+ IK_RIGHT, IK_KPRIGHT, VK_RIGHT, JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT:
if FValue < FMax then
begin
Inc(FValue);
case Msg.Msg of
WM_KEYDOWN:
case Msg.wParam of
- IK_RETURN, IK_RIGHT, IK_KPRETURN, IK_KPRIGHT, VK_FIRE, VK_OPEN, VK_RIGHT:
+ IK_RETURN, IK_RIGHT, IK_KPRETURN, IK_KPRIGHT, VK_FIRE, VK_OPEN, VK_RIGHT,
+ JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT,
+ JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
begin
if FIndex < High(FItems) then
Inc(FIndex)
FOnChangeEvent(Self);
end;
- IK_LEFT, IK_KPLEFT, VK_LEFT:
+ IK_LEFT, IK_KPLEFT, VK_LEFT,
+ JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT:
begin
if FIndex > 0 then
Dec(FIndex)
IK_DELETE: Delete(FText, FCaretPos + 1, 1);
IK_END, IK_KPEND: FCaretPos := Length(FText);
IK_HOME, IK_KPHOME: FCaretPos := 0;
- IK_LEFT, IK_KPLEFT, VK_LEFT: if FCaretPos > 0 then Dec(FCaretPos);
- IK_RIGHT, IK_KPRIGHT, VK_RIGHT: if FCaretPos < Length(FText) then Inc(FCaretPos);
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN:
+ IK_LEFT, IK_KPLEFT, VK_LEFT, JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT: if FCaretPos > 0 then Dec(FCaretPos);
+ IK_RIGHT, IK_KPRIGHT, VK_RIGHT, JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT: if FCaretPos < Length(FText) then Inc(FCaretPos);
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
with FWindow do
begin
if FActiveControl <> Self then
case Msg of
WM_KEYDOWN:
case wParam of
- IK_ESCAPE, VK_ESCAPE:
+ IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
begin
if FIsQuery then actDefCtl();
FIsQuery := False;
end;
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN:
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
begin
if not FIsQuery then
begin
FKey := 0;
actDefCtl();
end
- else if FIsQuery and (wParam <> IK_ENTER) and (wParam <> IK_KPRETURN) and (wParam <> VK_FIRE) and (wParam <> VK_OPEN) then // Not <Enter
+ else if FIsQuery then
begin
- if e_KeyNames[wParam] <> '' then
- FKey := wParam;
- FIsQuery := False;
- actDefCtl();
+ case wParam of
+ IK_ENTER, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
+ else
+ if e_KeyNames[wParam] <> '' then
+ FKey := wParam;
+ FIsQuery := False;
+ actDefCtl();
+ end
end;
end;
end;
function TGUIKeyRead2.WantActivationKey (key: LongInt): Boolean;
begin
- result :=
- (key = IK_BACKSPACE) or
- (key = IK_LEFT) or (key = IK_RIGHT) or
- (key = IK_KPLEFT) or (key = IK_KPRIGHT) or
- (key = VK_LEFT) or (key = VK_RIGHT) or
- false; // oops
+ case key of
+ IK_BACKSPACE, IK_LEFT, IK_RIGHT, IK_KPLEFT, IK_KPRIGHT, VK_LEFT, VK_RIGHT,
+ JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT,
+ JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT:
+ result := True
+ else
+ result := False
+ end
end;
procedure TGUIKeyRead2.OnMessage(var Msg: TMessage);
case Msg of
WM_KEYDOWN:
case wParam of
- IK_ESCAPE, VK_ESCAPE:
+ IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
begin
if FIsQuery then actDefCtl();
FIsQuery := False;
end;
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN:
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
begin
if not FIsQuery then
begin
actDefCtl();
end;
end;
- IK_LEFT, IK_KPLEFT, VK_LEFT:
+ IK_LEFT, IK_KPLEFT, VK_LEFT, JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT:
if not FIsQuery then
begin
FKeyIdx := 0;
actDefCtl();
end;
- IK_RIGHT, IK_KPRIGHT, VK_RIGHT:
+ IK_RIGHT, IK_KPRIGHT, VK_RIGHT, JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT:
if not FIsQuery then
begin
FKeyIdx := 1;
if (FKeyIdx = 0) then FKey0 := 0 else FKey1 := 0;
actDefCtl();
end
- else if FIsQuery and (wParam <> IK_ENTER) and (wParam <> IK_KPRETURN) and (wParam <> VK_FIRE) and (wParam <> VK_OPEN) then // Not <Enter
+ else if FIsQuery then
begin
- if e_KeyNames[wParam] <> '' then
- begin
- if (FKeyIdx = 0) then FKey0 := wParam else FKey1 := wParam;
- end;
- FIsQuery := False;
- actDefCtl();
+ case wParam of
+ IK_ENTER, IK_KPRETURN, VK_FIRE, VK_OPEN,
+ JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
+ else
+ if e_KeyNames[wParam] <> '' then
+ begin
+ if (FKeyIdx = 0) then FKey0 := wParam else FKey1 := wParam;
+ end;
+ FIsQuery := False;
+ actDefCtl()
+ end
end;
end;
end;
FIndex := High(FItems);
FStartLine := Max(High(FItems)-FHeight+1, 0);
end;
- IK_UP, IK_LEFT, IK_KPUP, IK_KPLEFT, VK_LEFT:
+ IK_UP, IK_LEFT, IK_KPUP, IK_KPLEFT, VK_LEFT, JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT:
if FIndex > 0 then
begin
Dec(FIndex);
if FIndex < FStartLine then Dec(FStartLine);
if @FOnChangeEvent <> nil then FOnChangeEvent(Self);
end;
- IK_DOWN, IK_RIGHT, IK_KPDOWN, IK_KPRIGHT, VK_RIGHT:
+ IK_DOWN, IK_RIGHT, IK_KPDOWN, IK_KPRIGHT, VK_RIGHT, JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT:
if FIndex < High(FItems) then
begin
Inc(FIndex);
if FIndex > FStartLine+FHeight-1 then Inc(FStartLine);
if @FOnChangeEvent <> nil then FOnChangeEvent(Self);
end;
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN:
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
with FWindow do
begin
if FActiveControl <> Self then SetActive(Self)
FStartLine := High(FItems)-FHeight+1;
end;
- IK_UP, IK_LEFT, IK_KPUP, IK_KPLEFT, VK_UP, VK_LEFT:
+ IK_UP, IK_LEFT, IK_KPUP, IK_KPLEFT, VK_UP, VK_LEFT, JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT:
if FIndex > 0 then
begin
Dec(FIndex);
FOnChangeEvent(Self);
end;
- IK_DOWN, IK_RIGHT, IK_KPDOWN, IK_KPRIGHT, VK_DOWN, VK_RIGHT:
+ IK_DOWN, IK_RIGHT, IK_KPDOWN, IK_KPRIGHT, VK_DOWN, VK_RIGHT, JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT:
if FIndex < High(FItems) then
begin
Inc(FIndex);
FOnChangeEvent(Self);
end;
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN:
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
with FWindow do
begin
if FActiveControl <> Self then
case Msg of
WM_KEYDOWN:
case wParam of
- IK_UP, IK_LEFT, IK_KPUP, IK_KPLEFT, VK_UP, VK_LEFT:
+ IK_UP, IK_LEFT, IK_KPUP, IK_KPLEFT, VK_UP, VK_LEFT, JOY0_LEFT, JOY1_LEFT, JOY2_LEFT, JOY3_LEFT:
if FStartLine > 0 then
Dec(FStartLine);
- IK_DOWN, IK_RIGHT, IK_KPDOWN, IK_KPRIGHT, VK_DOWN, VK_RIGHT:
+ IK_DOWN, IK_RIGHT, IK_KPDOWN, IK_KPRIGHT, VK_DOWN, VK_RIGHT, JOY0_RIGHT, JOY1_RIGHT, JOY2_RIGHT, JOY3_RIGHT:
if FStartLine < Length(FLines)-FHeight then
Inc(FStartLine);
- IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN:
+ IK_RETURN, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK:
with FWindow do
begin
if FActiveControl <> Self then
diff --git a/src/game/g_main.pas b/src/game/g_main.pas
index 7f5d5b95c13739b6037e226450e11aa3b618a705..5daed9b341abb7e029f41863d229117e35b1d23b 100644 (file)
--- a/src/game/g_main.pas
+++ b/src/game/g_main.pas
g_Console_Switch()
end;
- IK_ESCAPE, VK_ESCAPE: // <Esc>:
+ IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP: // <Esc>:
begin
if gChatShow then
begin
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 7c21ea5a156bb1ed7fcfff2064b718c7f606e1c2..76a91813e5e6f77444d486bfded34c9e3ea05209 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
+ if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) or
+ e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
OuterLoop := False;
end;
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
+ if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) or
+ e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
break;
end;
Result := msgStream;
index 4137d8b012ef6d22793b06fe1ecf48fd4bf14c8a..4ca51eb6bf6bde69a5e5e2017f6bdbaf0fe220ab 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
qm := g_ProcessMessages(); // this updates kbd
- if qm or e_KeyPressed(IK_ESCAPE) or e_KeyPressed(VK_ESCAPE) then
+ if qm or e_KeyPressed(IK_ESCAPE) or e_KeyPressed(VK_ESCAPE) or
+ e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
begin
SL := nil;
ST := nil;
Exit;
end;
- if e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_JUMP) then
+ if e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_JUMP) or
+ e_KeyPressed(JOY0_ACTIVATE) or e_KeyPressed(JOY1_ACTIVATE) or e_KeyPressed(JOY2_ACTIVATE) or e_KeyPressed(JOY3_ACTIVATE) then
begin
if not slFetched then
begin
if SL = nil then Exit;
- if e_KeyPressed(IK_RETURN) or e_KeyPressed(IK_KPRETURN) or e_KeyPressed(VK_FIRE) or e_KeyPressed(VK_OPEN) then
+ if e_KeyPressed(IK_RETURN) or e_KeyPressed(IK_KPRETURN) or e_KeyPressed(VK_FIRE) or e_KeyPressed(VK_OPEN) or
+ e_KeyPressed(JOY0_ATTACK) or e_KeyPressed(JOY1_ATTACK) or e_KeyPressed(JOY2_ATTACK) or e_KeyPressed(JOY3_ATTACK) then
begin
if not slReturnPressed then
begin
else
slReturnPressed := False;
- if e_KeyPressed(IK_DOWN) or e_KeyPressed(IK_KPDOWN) or e_KeyPressed(VK_DOWN) then
+ if e_KeyPressed(IK_DOWN) or e_KeyPressed(IK_KPDOWN) or e_KeyPressed(VK_DOWN) or
+ e_KeyPressed(JOY0_DOWN) or e_KeyPressed(JOY1_DOWN) or e_KeyPressed(JOY2_DOWN) or e_KeyPressed(JOY3_DOWN) then
begin
if not slDirPressed then
begin
end;
end;
- if e_KeyPressed(IK_UP) or e_KeyPressed(IK_KPUP) or e_KeyPressed(VK_UP) then
+ if e_KeyPressed(IK_UP) or e_KeyPressed(IK_KPUP) or e_KeyPressed(VK_UP) or
+ e_KeyPressed(JOY0_UP) or e_KeyPressed(JOY1_UP) or e_KeyPressed(JOY2_UP) or e_KeyPressed(JOY3_UP) then
begin
if not slDirPressed then
begin
end;
end;
- if e_KeyPressed(IK_RIGHT) or e_KeyPressed(IK_KPRIGHT) or e_KeyPressed(VK_RIGHT) then
+ if e_KeyPressed(IK_RIGHT) or e_KeyPressed(IK_KPRIGHT) or e_KeyPressed(VK_RIGHT) or
+ e_KeyPressed(JOY0_RIGHT) or e_KeyPressed(JOY1_RIGHT) or e_KeyPressed(JOY2_RIGHT) or e_KeyPressed(JOY3_RIGHT) then
begin
if not slDirPressed then
begin
end;
end;
- if e_KeyPressed(IK_LEFT) or e_KeyPressed(IK_KPLEFT) or e_KeyPressed(VK_LEFT) then
+ if e_KeyPressed(IK_LEFT) or e_KeyPressed(IK_KPLEFT) or e_KeyPressed(VK_LEFT) or
+ e_KeyPressed(JOY0_LEFT) or e_KeyPressed(JOY1_LEFT) or e_KeyPressed(JOY2_LEFT) or e_KeyPressed(JOY3_LEFT) then
begin
if not slDirPressed then
begin
(not e_KeyPressed(VK_DOWN)) and
(not e_KeyPressed(VK_UP)) and
(not e_KeyPressed(VK_RIGHT)) and
- (not e_KeyPressed(VK_LEFT)) then
+ (not e_KeyPressed(VK_LEFT)) and
+ (not e_KeyPressed(JOY0_UP)) and (not e_KeyPressed(JOY1_UP)) and (not e_KeyPressed(JOY2_UP)) and (not e_KeyPressed(JOY3_UP)) and
+ (not e_KeyPressed(JOY0_DOWN)) and (not e_KeyPressed(JOY1_DOWN)) and (not e_KeyPressed(JOY2_DOWN)) and (not e_KeyPressed(JOY3_DOWN)) and
+ (not e_KeyPressed(JOY0_LEFT)) and (not e_KeyPressed(JOY1_LEFT)) and (not e_KeyPressed(JOY2_LEFT)) and (not e_KeyPressed(JOY3_LEFT)) and
+ (not e_KeyPressed(JOY0_RIGHT)) and (not e_KeyPressed(JOY1_RIGHT)) and (not e_KeyPressed(JOY2_RIGHT)) and (not e_KeyPressed(JOY3_RIGHT))
+ then
slDirPressed := False;
end;