From 2bdaa61ce43bde7d6b75f24f66f3d7d5ef54426b Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sun, 27 Aug 2017 19:11:04 +0300 Subject: [PATCH] Holmes cosmetix --- src/game/g_holmes.pas | 54 +++++++++++++++++++++++++++++++++++----- src/game/g_holmes_ui.inc | 14 ++++++++++- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas index 9ab1c77..1f68911 100644 --- a/src/game/g_holmes.pas +++ b/src/game/g_holmes.pas @@ -108,7 +108,10 @@ var showMonsLOS2Plr: Boolean = false; showAllMonsCells: Boolean = false; showMapCurPos: Boolean = false; - + showLayersWindow: Boolean = false; + showOutlineWindow: Boolean = false; + oldShowLayersWindow: Boolean = false; + oldShowOutlineWindow: Boolean = false; // ////////////////////////////////////////////////////////////////////////// // {$INCLUDE g_holmes.inc} @@ -145,6 +148,9 @@ begin llb.appendItem('monster info', @showMonsInfo); llb.appendItem('monster LOS to player', @showMonsLOS2Plr); llb.appendItem('monster cells (SLOW!)', @showAllMonsCells); + llb.appendItem('', nil); + llb.appendItem('layers window', @showLayersWindow); + llb.appendItem('outline window', @showOutlineWindow); winOptions := THTopWindow.Create('Holmes Options', 100, 100); winOptions.escClose := true; winOptions.appendChild(llb); @@ -194,7 +200,7 @@ end; // ////////////////////////////////////////////////////////////////////////// // procedure g_Holmes_VidModeChanged (); begin - e_WriteLog(Format('Inspector: videomode changed: %dx%d', [gScreenWidth, gScreenHeight]), MSG_NOTIFY); + e_WriteLog(Format('Holmes: videomode changed: %dx%d', [gScreenWidth, gScreenHeight]), MSG_NOTIFY); // texture space is possibly lost here, idc curtexid := 0; font6texid := 0; @@ -728,16 +734,14 @@ begin if (ev.scan = SDL_SCANCODE_L) and ((ev.kstate and THKeyEvent.ModCtrl) <> 0) then begin result := true; - if (winLayers = nil) then createLayersWindow(); - if not uiVisibleWindow(winLayers) then uiAddWindow(winLayers) else uiRemoveWindow(winLayers); + showLayersWindow := not showLayersWindow; exit; end; // C-O: toggle outlines window if (ev.scan = SDL_SCANCODE_O) and ((ev.kstate and THKeyEvent.ModCtrl) <> 0) then begin result := true; - if (winOutlines = nil) then createOutlinesWindow(); - if not uiVisibleWindow(winOutlines) then uiAddWindow(winOutlines) else uiRemoveWindow(winOutlines); + showOutlineWindow := not showOutlineWindow; exit; end; // F1: toggle options window @@ -780,6 +784,44 @@ end; // ////////////////////////////////////////////////////////////////////////// // procedure g_Holmes_Draw (); begin + if (oldShowLayersWindow <> showLayersWindow) then + begin + oldShowLayersWindow := showLayersWindow; + if showLayersWindow then + begin + if (winLayers = nil) then createLayersWindow(); + uiAddWindow(winLayers); + end + else + begin + uiRemoveWindow(winLayers); + end; + end + else + begin + showLayersWindow := uiVisibleWindow(winLayers); + oldShowLayersWindow := showLayersWindow; + end; + + if (oldShowOutlineWindow <> showOutlineWindow) then + begin + oldShowOutlineWindow := showOutlineWindow; + if showOutlineWindow then + begin + if (winOutlines = nil) then createOutlinesWindow(); + uiAddWindow(winOutlines); + end + else + begin + uiRemoveWindow(winOutlines); + end; + end + else + begin + showOutlineWindow := uiVisibleWindow(winOutlines); + oldShowOutlineWindow := showOutlineWindow; + end; + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // modify color buffer glDisable(GL_STENCIL_TEST); glDisable(GL_BLEND); diff --git a/src/game/g_holmes_ui.inc b/src/game/g_holmes_ui.inc index 5175e95..4f37284 100644 --- a/src/game/g_holmes_ui.inc +++ b/src/game/g_holmes_ui.inc @@ -176,8 +176,14 @@ end; procedure uiDraw (); var f: Integer; + ctl: THControl; begin - for f := 0 to High(uiTopList) do uiTopList[f].draw(); + for f := 0 to High(uiTopList) do + begin + ctl := uiTopList[f]; + ctl.draw(); + if (f <> High(uiTopList)) then darkenRect(ctl.x0, ctl.y0, ctl.width, ctl.height, 128); + end; end; @@ -740,6 +746,7 @@ procedure THTopWindow.drawControlPost (sx, sy: Integer); var r, g, b: Integer; begin + { if getFocused then begin r := 255; @@ -752,6 +759,10 @@ begin g := 127; b := 127; end; + } + r := 255; + g := 255; + b := 255; drawRect(mX, mY, mWidth, mHeight, r, g, b); if (Length(mTitle) > 0) then begin @@ -834,6 +845,7 @@ begin SetLength(mChecks, Length(mChecks)+1); mChecks[High(mChecks)] := bv; if (Length(mItems)*8+4 > mHeight) then mHeight := Length(mItems)*8+4; + if (mCurIndex < 0) then mCurIndex := 0; end; -- 2.29.2