summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 81a68b9)
raw | patch | inline | side by side (parent: 81a68b9)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Wed, 23 Aug 2017 13:53:45 +0000 (16:53 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Wed, 23 Aug 2017 18:23:56 +0000 (21:23 +0300) |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index c9568f02005d8f09b7f75481eb2d1cb02f38be1b..d80fb01700e774af6aee4e1a1097c4b5f71437f7 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('los_enabled', ProfilerCommands, 'enable/disable LOS calculations');
AddCommand('mon_think', ProfilerCommands, 'enable/disable monster thinking');
+ AddCommand('dbg_holmes', ProfilerCommands, 'turn Holmes on/off');
AddCommand('p1_name', GameCVars);
AddCommand('p2_name', GameCVars);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 833baf5d45d6cd544cf5f3d86af065869779b715..129370db0db8b867a81199199808fa13d86c8572 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
end;
// draw inspector
- g_Holmes_Draw();
+ if (g_holmes_enabled) then g_Holmes_Draw();
g_Console_Draw();
if (cmd = 'pr_enabled') then begin binaryFlag(gpart_dbg_enabled, 'particles'); exit; end;
if (cmd = 'pr_phys_enabled') then begin binaryFlag(gpart_dbg_phys_enabled, 'particle physics'); exit; end;
if (cmd = 'los_enabled') then begin binaryFlag(gmon_dbg_los_enabled, 'LOS calculations'); exit; end;
+
+ if (not gGameOn) or (not gCheats) or ((gGameSettings.GameType <> GT_SINGLE) and
+ (gGameSettings.GameMode <> GM_COOP) and (not gDebugMode)) or g_Game_IsNet then exit;
+
if (cmd = 'mon_think') then begin binaryFlag(gmon_debug_think, 'monster thinking'); exit; end;
+ if (cmd = 'dbg_holmes') then begin binaryFlag(g_holmes_enabled, 'Holmes'); exit; end;
end;
diff --git a/src/game/g_holmes.inc b/src/game/g_holmes.inc
index 8df305c656df3385b9b738cd9be6f839fe93a1a0..e3dd3804062e387e50ab515390ce367d26031214 100644 (file)
--- a/src/game/g_holmes.inc
+++ b/src/game/g_holmes.inc
begin
result := 0;
if (Length(s) = 0) then exit;
- if (a < 0) then a := 0;
- if (a > 255) then a := 255;
+ if (a < 0) then a := 0 else if (a > 255) then a := 255;
if (r < 0) then r := 0 else if (r > 255) then r := 255;
if (g < 0) then g := 0 else if (g > 255) then g := 255;
if (b < 0) then b := 0 else if (b > 255) then b := 255;
end;
+// ////////////////////////////////////////////////////////////////////////// //
+procedure drawLine (x1, y1, x2, y2: Integer; r, g, b: Integer; a: Integer=255);
+
+ procedure lcor (var x1, y1, x2, y2: Integer);
+ begin
+ if (y2 < y1) then
+ begin
+ x1 := x1 xor x2;
+ x2 := x1 xor x2;
+ x1 := x1 xor x2;
+
+ y1 := y1 xor y2;
+ y2 := y1 xor y2;
+ y1 := y1 xor y2;
+ end;
+
+ if (x1 < x2) then Inc(X2) else Inc(x1);
+ Inc(y2);
+ end;
+
+begin
+ lcor(x1, y1, x2, y2);
+
+ if (a < 0) then a := 0 else if (a > 255) then a := 255;
+ if (r < 0) then r := 0 else if (r > 255) then r := 255;
+ if (g < 0) then g := 0 else if (g > 255) then g := 255;
+ if (b < 0) then b := 0 else if (b > 255) then b := 255;
+
+ if (a < 255) then
+ begin
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ end
+ else
+ begin
+ glDisable(GL_BLEND);
+ end;
+
+ glDisable(GL_TEXTURE_2D);
+ glColor4f(r/255.0, g/255.0, b/255.0, a/255.0);
+ glLineWidth(1);
+
+ glBegin(GL_LINES);
+ glVertex2i(x1, y1);
+ glVertex2i(x2, y2);
+ glEnd();
+
+ glColor4f(1, 1, 1, 1);
+ glDisable(GL_BLEND);
+end;
+
+
// ////////////////////////////////////////////////////////////////////////// //
procedure shadeRect (x, y, w, h: Integer; a: Integer);
begin
diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas
index 6683922d9084abed7d7024a525b69fbce17fc1fb..75e03bb30ec82a3a6509fc830fc790992a384103 100644 (file)
--- a/src/game/g_holmes.pas
+++ b/src/game/g_holmes.pas
procedure g_Holmes_plrLaser (ax0, ay0, ax1, ay1: Integer);
+var
+ g_holmes_enabled: Boolean = {$IF DEFINED(D2F_DEBUG)}true{$ELSE}false{$ENDIF};
+
+
implementation
uses
procedure drawMonsterInfo (mon: TMonster);
var
mx, my, mw, mh: Integer;
+ emx, emy, emw, emh: Integer;
+ enemy: TMonster;
+ eplr: TPlayer;
begin
if (mon = nil) then exit;
mon.getMapBox(mx, my, mw, mh);
drawText6(mx, my, Format('TgtUID:%u', [mon.MonsterTargetUID]), 255, 127, 0); my -= 8;
drawText6(mx, my, Format('TgtTime:%d', [mon.MonsterTargetTime]), 255, 127, 0); my -= 8;
+ mon.getMapBox(mx, my, mw, mh);
+ if (g_GetUIDType(mon.MonsterTargetUID) = UID_PLAYER) then
+ begin
+ eplr := g_Player_Get(mon.MonsterTargetUID);
+ if (eplr <> nil) then
+ begin
+ eplr.getMapBox(emx, emy, emw, emh);
+ drawLine(mx+mw div 2, my+mh div 2, emx+emw div 2, emy+emh div 2, 255, 0, 0, 128);
+ end;
+ end
+ else if (g_GetUIDType(mon.MonsterTargetUID) = UID_MONSTER) then
+ begin
+ enemy := g_Monsters_ByUID(mon.MonsterTargetUID);
+ if (enemy <> nil) then
+ begin
+ enemy.getMapBox(emx, emy, emw, emh);
+ drawLine(mx+mw div 2, my+mh div 2, emx+emw div 2, emy+emh div 2, 255, 0, 0, 128);
+ end;
+ end;
+
{
property MonsterRemoved: Boolean read FRemoved write FRemoved;
property MonsterPain: Integer read FPain write FPain;
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 998c681e91992f8722c847c3546e4a162afc8b78..1ac9c9e097f6300ae7d8b33874e657a05d41f52b 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
curMsButState := curMsButState or msev.but;
msev.bstate := curMsButState;
msev.kstate := curKbState;
- g_Holmes_mouseEvent(msev);
+ if (g_holmes_enabled) then g_Holmes_mouseEvent(msev);
end;
end;
SDL_MOUSEWHEEL:
msev.y := curMsY;
msev.bstate := curMsButState;
msev.kstate := curKbState;
- g_Holmes_mouseEvent(msev);
+ if (g_holmes_enabled) then g_Holmes_mouseEvent(msev);
end;
end;
SDL_MOUSEMOTION:
msev.y := curMsY;
msev.bstate := curMsButState;
msev.kstate := curKbState;
- g_Holmes_mouseEvent(msev);
+ if (g_holmes_enabled) then g_Holmes_mouseEvent(msev);
end;
SDL_TEXTINPUT:
if ParamStr(idx) = '--no-particles-physics' then gpart_dbg_phys_enabled := false;
if ParamStr(idx) = '--no-particle-phys' then gpart_dbg_phys_enabled := false;
if ParamStr(idx) = '--no-particle-physics' then gpart_dbg_phys_enabled := false;
+
+ if ParamStr(idx) = '--holmes' then g_holmes_enabled := false;
end;
//if gdbg_map_use_tree_draw then e_WriteLog('using TREE renderer', MSG_NOTIFY);