From 7f678ccb6d789d35b562f0d51ed39607ff65d040 Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sun, 27 Aug 2017 17:55:00 +0300 Subject: [PATCH] Holmes UI is more important than console! ;-) --- src/game/g_game.pas | 2 ++ src/game/g_holmes.pas | 13 ++++++++++--- src/game/g_holmes_ui.inc | 30 ++++++++++++++++++++++++++---- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/game/g_game.pas b/src/game/g_game.pas index f5b1903..844e9a4 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -3337,6 +3337,8 @@ begin drawTime(gScreenWidth-72, gScreenHeight-16); if gGameOn then drawProfilers(); + + g_Holmes_DrawUI(); end; procedure g_Game_Quit(); diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas index 7f2ddb0..98c458c 100644 --- a/src/game/g_holmes.pas +++ b/src/game/g_holmes.pas @@ -76,6 +76,7 @@ procedure g_Holmes_WindowFocused (); procedure g_Holmes_WindowBlured (); procedure g_Holmes_Draw (); +procedure g_Holmes_DrawUI (); function g_Holmes_MouseEvent (var ev: THMouseEvent): Boolean; // returns `true` if event was eaten function g_Holmes_KeyEvent (var ev: THKeyEvent): Boolean; // returns `true` if event was eaten @@ -116,6 +117,7 @@ var // ////////////////////////////////////////////////////////////////////////// // var + g_ol_nice: Boolean = false; g_ol_rlayer_back: Boolean = false; g_ol_rlayer_step: Boolean = false; g_ol_rlayer_wall: Boolean = false; @@ -181,6 +183,8 @@ begin llb.appendItem('acid2', @g_ol_rlayer_acid2); llb.appendItem('water', @g_ol_rlayer_water); llb.appendItem('foreground', @g_ol_rlayer_fore); + llb.appendItem('', nil); + llb.appendItem('slow''n''nice', @g_ol_nice); winOutlines := THTopWindow.Create('outlines', 100, 10); winOutlines.escClose := true; winOutlines.appendChild(llb); @@ -686,11 +690,14 @@ begin plrDebugDraw(); end; - uiDraw(); + laserSet := false; +end; - drawCursor(); - laserSet := false; +procedure g_Holmes_DrawUI (); +begin + uiDraw(); + drawCursor(); end; diff --git a/src/game/g_holmes_ui.inc b/src/game/g_holmes_ui.inc index 3f26b36..cc5fe2f 100644 --- a/src/game/g_holmes_ui.inc +++ b/src/game/g_holmes_ui.inc @@ -898,14 +898,36 @@ begin SDL_SCANCODE_UP: begin result := true; - if (mCurIndex < 0) then mCurIndex := Length(mItems) - else if (mCurIndex > 0) then Dec(mCurIndex); + if (Length(mItems) > 0) then + begin + if (mCurIndex < 0) then mCurIndex := Length(mItems); + while (mCurIndex > 0) do + begin + Dec(mCurIndex); + if (mChecks[mCurIndex] <> nil) then break; + end; + end + else + begin + mCurIndex := -1; + end; end; SDL_SCANCODE_DOWN: begin result := true; - if (mCurIndex < 0) then mCurIndex := 0 - else if (mCurIndex < High(mItems)) then Inc(mCurIndex); + if (Length(mItems) > 0) then + begin + if (mCurIndex < 0) then mCurIndex := -1; + while (mCurIndex < High(mItems)) do + begin + Inc(mCurIndex); + if (mChecks[mCurIndex] <> nil) then break; + end; + end + else + begin + mCurIndex := -1; + end; end; SDL_SCANCODE_SPACE, SDL_SCANCODE_RETURN: -- 2.29.2