From: FGSFDSFGS Date: Wed, 6 Apr 2016 12:52:06 +0000 (+0300) Subject: fixed cheats and YN prompts X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=002448a291229b79e2ee941ec6e287f731c56104;p=d2df-sdl.git fixed cheats and YN prompts --- diff --git a/src/engine/e_input.pas b/src/engine/e_input.pas index 818fe8b..618199d 100644 --- a/src/engine/e_input.pas +++ b/src/engine/e_input.pas @@ -54,6 +54,8 @@ const IK_BACKQUOTE = SDL_SCANCODE_GRAVE; IK_GRAVE = SDL_SCANCODE_GRAVE; IK_PAUSE = SDL_SCANCODE_PAUSE; + IK_Y = SDL_SCANCODE_Y; + IK_N = SDL_SCANCODE_N; // TODO: think of something better than this shit IK_LASTKEY = SDL_NUM_SCANCODES-1; diff --git a/src/game/g_main.pas b/src/game/g_main.pas index 8c43ef8..853693c 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -381,7 +381,6 @@ end; procedure KeyPress(K: Word); var Msg: g_gui.TMessage; - a: Integer; begin case K of IK_PAUSE: // : @@ -483,13 +482,6 @@ begin begin g_GUI_ShowWindow('MainMenu'); g_Sound_PlayEx('MENU_OPEN'); - end - else - begin - for a := 0 to 14 do - charbuff[a] := charbuff[a+1]; - charbuff[15] := UpCase(Chr(K)); - Cheat(); end; end; end; @@ -499,6 +491,7 @@ end; procedure CharPress(C: Char); var Msg: g_gui.TMessage; + a: Integer; begin if (not gChatShow) and ((C = '`') or (C = '~') or (C = '¸') or (C = '¨')) then Exit; @@ -511,6 +504,13 @@ begin Msg.Msg := WM_CHAR; Msg.WParam := Ord(C); g_ActiveWindow.OnMessage(Msg); + end + else + begin + for a := 0 to 14 do + charbuff[a] := charbuff[a+1]; + charbuff[15] := UpCase(C); + Cheat(); end; end; diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 21eba04..231737b 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -889,7 +889,7 @@ var snd: TPlayableSound; res: Boolean; begin - if Key = Ord('y') then + if Key = IK_Y then begin g_Game_StopAllSounds(True); case (Random(18)) of @@ -927,7 +927,7 @@ begin g_Game_Quit(); end else - if Key = Ord('n') then + if Key = IK_N then g_GUI_HideWindow(); end;