X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_gui.pas;h=fbab591b37059bcbad512a6615e9f4f88067c78d;hb=a24522eab25d5de62835ae64f6e2782dfac9fc88;hp=9319e45a7b9e29550da578fa07bf4af5ac32dc25;hpb=af3c404e11867c6794975f1d45dd98932d804ede;p=d2df-sdl.git
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 9319e45..fbab591 100644
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
@@ -1,10 +1,25 @@
+(* Copyright (C) DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *)
{$MODE DELPHI}
unit g_gui;
interface
uses
- e_graphics, e_input, g_playermodel, g_basic, MAPSTRUCT, wadreader;
+ e_graphics, e_input, e_log, g_playermodel, g_basic, MAPSTRUCT, wadreader;
const
MAINMENU_HEADER_COLOR: TRGB = (R:255; G:255; B:255);
@@ -1481,7 +1496,7 @@ begin
if FItems[FIndex].Control <> nil then
FItems[FIndex].Control.OnMessage(Msg);
end;
- IK_RETURN, IK_KPRETURN:
+ IK_RETURN, IK_KPRETURN, IK_BACKSPACE:
begin
if FIndex <> -1 then
begin
@@ -2228,6 +2243,15 @@ begin
end;
procedure TGUIKeyRead.OnMessage(var Msg: TMessage);
+ procedure actDefCtl ();
+ begin
+ with FWindow do
+ if FDefControl <> '' then
+ SetActive(GetControl(FDefControl))
+ else
+ SetActive(nil);
+ end;
+
begin
inherited;
@@ -2240,13 +2264,7 @@ begin
case wParam of
IK_ESCAPE:
begin
- if FIsQuery then
- with FWindow do
- if FDefControl <> '' then
- SetActive(GetControl(FDefControl))
- else
- SetActive(nil);
-
+ if FIsQuery then actDefCtl();
FIsQuery := False;
end;
IK_RETURN, IK_KPRETURN:
@@ -2263,28 +2281,34 @@ begin
begin
FKey := IK_ENTER; //
FIsQuery := False;
-
- with FWindow do
- if FDefControl <> '' then
- SetActive(GetControl(FDefControl))
- else
- SetActive(nil);
+ actDefCtl();
end;
end;
+ IK_BACKSPACE: // clear keybinding if we aren't waiting for a key
+ begin
+ if not FIsQuery then
+ begin
+ FKey := 0;
+ actDefCtl();
+ end;
+ end;
end;
MESSAGE_DIKEY:
- if FIsQuery and (wParam <> IK_ENTER) and (wParam <> IK_KPRETURN) then // Not '' then
- FKey := wParam;
- FIsQuery := False;
-
- with FWindow do
- if FDefControl <> '' then
- SetActive(GetControl(FDefControl))
- else
- SetActive(nil);
+ if not FIsQuery and (wParam = IK_BACKSPACE) then
+ begin
+ FKey := 0;
+ actDefCtl();
+ end
+ else if FIsQuery and (wParam <> IK_ENTER) and (wParam <> IK_KPRETURN) then // Not '' then
+ FKey := wParam;
+ FIsQuery := False;
+ actDefCtl();
+ end;
end;
end;
end;
@@ -2484,7 +2508,7 @@ begin
end;
//k8: ignores path again
- if not WAD.GetResource(g_ExtractFileName(Res), Data, Len) then
+ if not WAD.GetMapResource(g_ExtractFileName(Res), Data, Len) then
begin
WAD.Free();
Exit;