X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_holmes.pas;h=a1248f00155a5218285e177273ba6ad5d6795595;hb=51bbf0eef2641d7766e22e188d6c349d9b836023;hp=570a1d99565d7d6e547b6418880d14011c80b86b;hpb=d25ad51560a2159ff524fa9ef4ca37a81dcb528f;p=d2df-sdl.git diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas index 570a1d9..a1248f0 100644 --- a/src/game/g_holmes.pas +++ b/src/game/g_holmes.pas @@ -96,6 +96,7 @@ operator = (const s: AnsiString; constref ev: THMouseEvent): Boolean; var g_holmes_enabled: Boolean = {$IF DEFINED(D2F_DEBUG)}true{$ELSE}false{$ENDIF}; + g_holmes_ui_scale: Single = 1.0; implementation @@ -113,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)}false{$ELSE}false{$ENDIF}; showMonsInfo: Boolean = false; showMonsLOS2Plr: Boolean = false; showAllMonsCells: Boolean = false; @@ -122,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} @@ -650,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); @@ -1039,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); @@ -1120,6 +1134,23 @@ procedure plrDebugDraw (); for f := 0 to High(gTriggers) do drawTrigger(gTriggers[f]); end; + procedure drawGibsBoxes (); + var + f: Integer; + px, py, pw, ph: Integer; + gib: PGib; + begin + for f := 0 to High(gGibs) do + begin + gib := @gGibs[f]; + if gib.alive then + begin + gib.getMapBox(px, py, pw, ph); + drawRect(px, py, pw, ph, 255, 0, 255); + end; + end; + end; + var mon: TMonster; mx, my, mw, mh: Integer; @@ -1149,8 +1180,11 @@ 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(); + + //drawGibsBoxes(); glPopMatrix(); @@ -1162,16 +1196,21 @@ end; // ////////////////////////////////////////////////////////////////////////// // function g_Holmes_MouseEvent (var ev: THMouseEvent): Boolean; +var + he: THMouseEvent; begin holmesInitCommands(); holmesInitBinds(); result := true; - msX := ev.x; - msY := ev.y; + msX := trunc(ev.x/g_holmes_ui_scale); + msY := trunc(ev.y/g_holmes_ui_scale); msB := ev.bstate; kbS := ev.kstate; msB := msB; - if not uiMouseEvent(ev) then plrDebugMouse(ev); + he := ev; + he.x := trunc(he.x/g_holmes_ui_scale); + he.y := trunc(he.y/g_holmes_ui_scale); + if not uiMouseEvent(he) then plrDebugMouse(he); end; @@ -1262,14 +1301,20 @@ end; procedure g_Holmes_DrawUI (); begin {$IF not DEFINED(HEADLESS)} + glPushMatrix(); + glScalef(g_holmes_ui_scale, g_holmes_ui_scale, 1.0); uiDraw(); drawCursor(); + glPopMatrix(); {$ENDIF} 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; @@ -1347,6 +1392,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; @@ -1355,6 +1401,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); @@ -1402,6 +1449,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'); @@ -1438,6 +1488,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'); @@ -1490,4 +1543,6 @@ begin end; +begin + conRegVar('hlm_ui_scale', @g_holmes_ui_scale, 0.01, 5.0, 'Holmes UI scale', '', false); end.