From 15ef0fb2d44e381afb8d0ea07cdb31fd3903ba7b Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sun, 3 Sep 2017 18:26:24 +0300 Subject: [PATCH] Holmes: option to highlight panel cells in grid --- src/game/g_holmes.pas | 29 +++++++++++++++++++++++++++-- src/game/g_map.pas | 4 ++++ src/game/g_panel.pas | 7 ++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas index 9f98ca3..a534e7a 100644 --- a/src/game/g_holmes.pas +++ b/src/game/g_holmes.pas @@ -114,7 +114,7 @@ var msY: Integer = -666; msB: Word = 0; // button state kbS: Word = 0; // keyboard modifiers state - showGrid: Boolean = false; + showGrid: Boolean = {$IF DEFINED(D2F_DEBUG)}true{$ELSE}false{$ENDIF}; showMonsInfo: Boolean = false; showMonsLOS2Plr: Boolean = false; showAllMonsCells: Boolean = false; @@ -123,6 +123,7 @@ var showOutlineWindow: Boolean = false; showTriggers: Boolean = {$IF DEFINED(D2F_DEBUG)}false{$ELSE}false{$ENDIF}; + // ////////////////////////////////////////////////////////////////////////// // {$INCLUDE g_holmes.inc} {$INCLUDE g_holmes_ui.inc} @@ -651,6 +652,7 @@ var laserSet: Boolean = false; laserX0, laserY0, laserX1, laserY1: Integer; monMarkedUID: Integer = -1; + platMarkedGUID: Integer = -1; procedure g_Holmes_plrView (viewPortX, viewPortY, viewPortW, viewPortH: Integer); @@ -1040,6 +1042,17 @@ procedure plrDebugDraw (); monsGrid.forEachBodyCell(mon.proxyId, hilightCell); end; + procedure drawSelectedPlatformCells (); + var + pan: TPanel; + begin + if not showGrid then exit; + pan := g_Map_PanelByGUID(platMarkedGUID); + if (pan = nil) then exit; + mapGrid.forEachBodyCell(pan.proxyId, hilightCell); + drawRect(pan.x, pan.y, pan.width, pan.height, 0, 200, 0, 200); + end; + procedure drawTrigger (var trig: TTrigger); procedure drawPanelDest (pguid: Integer); @@ -1150,8 +1163,9 @@ begin end; end; - if showAllMonsCells then g_Mons_ForEach(highlightAllMonsterCells); + if showAllMonsCells and showGrid then g_Mons_ForEach(highlightAllMonsterCells); if showTriggers then drawTriggers(); + if showGrid then drawSelectedPlatformCells(); glPopMatrix(); @@ -1279,6 +1293,9 @@ end; // ////////////////////////////////////////////////////////////////////////// // procedure bcOneMonsterThinkStep (); begin gmon_debug_think := false; gmon_debug_one_think_step := true; end; +procedure bcOneMPlatThinkStep (); begin g_dbgpan_mplat_active := false; g_dbgpan_mplat_step := true; end; +procedure bcMPlatToggle (); begin g_dbgpan_mplat_active := not g_dbgpan_mplat_active; end; + procedure bcToggleMonsterInfo (arg: Integer=-1); begin if (arg < 0) then showMonsInfo := not showMonsInfo else showMonsInfo := (arg > 0); end; procedure bcToggleMonsterLOSPlr (arg: Integer=-1); begin if (arg < 0) then showMonsLOS2Plr := not showMonsLOS2Plr else showMonsLOS2Plr := (arg > 0); end; procedure bcToggleMonsterCells (arg: Integer=-1); begin if (arg < 0) then showAllMonsCells := not showAllMonsCells else showAllMonsCells := (arg > 0); end; @@ -1356,6 +1373,7 @@ procedure cbAtcurDumpWalls (); function wallToggle (pan: TPanel; tag: Integer): Boolean; begin result := false; // don't stop + if (platMarkedGUID = -1) then platMarkedGUID := pan.guid; e_LogWritefln('wall #%d(%d); enabled=%d (%d); (%d,%d)-(%d,%d)', [pan.arrIdx, pan.proxyId, Integer(pan.Enabled), Integer(mapGrid.proxyEnabled[pan.proxyId]), pan.X, pan.Y, pan.Width, pan.Height]); dumpPublishedProperties(pan); end; @@ -1364,6 +1382,7 @@ var f: Integer; trig: PTrigger; begin + platMarkedGUID := -1; e_WriteLog('=== TOGGLE WALL ===', MSG_NOTIFY); mapGrid.forEachAtPoint(pmsCurMapX, pmsCurMapY, wallToggle, (GridTagWall or GridTagDoor)); e_WriteLog('--- toggle wall ---', MSG_NOTIFY); @@ -1411,6 +1430,9 @@ begin cmdAdd('mon_cells', bcToggleMonsterCells, 'toggle "show all cells occupied by monsters" (SLOW!)', 'monster control'); cmdAdd('mon_wakeup', bcMonsterWakeup, 'toggle "show all cells occupied by monsters" (SLOW!)', 'monster control'); + cmdAdd('mplat_step', bcOneMPlatThinkStep, 'one mplat think step', 'mplat control'); + cmdAdd('mplat_toggle', bcMPlatToggle, 'activate/deactivate moving platforms', 'mplat control'); + cmdAdd('plr_teleport', bcPlayerTeleport, 'teleport player', 'player control'); cmdAdd('dbg_curpos', bcToggleCurPos, 'toggle "show cursor position on the map"', 'various'); @@ -1447,6 +1469,9 @@ begin keybindAdd('M-G', 'mon_cells'); keybindAdd('M-A', 'mon_wakeup'); + keybindAdd('M-P', 'mplat_step'); + keybindAdd('M-O', 'mplat_toggle'); + keybindAdd('C-T', 'plr_teleport'); keybindAdd('C-P', 'dbg_curpos'); diff --git a/src/game/g_map.pas b/src/game/g_map.pas index ae8ee10..4b197e3 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -2430,6 +2430,8 @@ var end; begin + if g_dbgpan_mplat_step then g_dbgpan_mplat_active := true; + UpdatePanelArray(gWalls); UpdatePanelArray(gRenderBackgrounds); UpdatePanelArray(gRenderForegrounds); @@ -2438,6 +2440,8 @@ begin UpdatePanelArray(gAcid2); UpdatePanelArray(gSteps); + if g_dbgpan_mplat_step then begin g_dbgpan_mplat_step := false; g_dbgpan_mplat_active := false; end; + if gGameSettings.GameMode = GM_CTF then begin for a := FLAG_RED to FLAG_BLUE do diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas index 041a142..ffd7c50 100644 --- a/src/game/g_panel.pas +++ b/src/game/g_panel.pas @@ -167,6 +167,11 @@ type TPanelArray = Array of TPanel; +var + g_dbgpan_mplat_active: Boolean = {$IF DEFINED(D2F_DEBUG)}false{$ELSE}true{$ENDIF}; + g_dbgpan_mplat_step: Boolean = false; // one step, and stop + + implementation uses @@ -606,7 +611,7 @@ begin FCurFrameCount := FTextureIDs[FCurTexture].AnTex.CurrentCounter; end; - if mMovingActive and (not mMovingSpeed.isZero) then + if mMovingActive and (not mMovingSpeed.isZero) and g_dbgpan_mplat_active then begin monMoveListUsed := 0; nx := X+mMovingSpeed.X; -- 2.29.2