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);
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;
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
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;
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);