diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 69cc9021fc74547423ced6a82f1c626c4155cb93..e72a75689012b6f2e44462e0cfd5e327f0fa2c55 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
e_log, g_map, g_items, g_console, SysUtils, g_gfx, Math,
g_options, g_triggers, g_menu, MAPDEF, g_game, g_grid,
wadreader, g_main, g_monsters, CONFIG, g_language,
- g_net, g_netmsg, g_window, GL;
+ g_net, g_netmsg, g_window, GL, g_holmes;
type
TBotProfile = record
end;
-var
- plrMouseX: Integer = -666;
- plrMouseY: Integer = -666;
- vpx, vpy: Integer;
- //vpw, vph: Integer;
- laserX0, laserY0, laserX1, laserY1: Integer;
- monMarkedUID: Integer = -1;
-
-function pmsCurMapX (): Integer; inline; begin result := plrMouseX+vpx; end;
-function pmsCurMapY (): Integer; inline; begin result := plrMouseY+vpy; end;
-
-procedure plrDebugMouse (msx, msy, but: Integer; bstate: Integer);
-
- function wallToggle (pan: TPanel; tag: Integer): Boolean;
- begin
- result := false; // don't stop
- if pan.Enabled then g_Map_DisableWall(pan.arrIdx) else g_Map_EnableWall(pan.arrIdx);
- end;
-
- function monsAtDump (mon: TMonster; tag: Integer): Boolean;
- begin
- result := false; // don't stop
- e_WriteLog(Format('monster #%d; UID=%d', [mon.arrIdx, mon.UID]), MSG_NOTIFY);
- monMarkedUID := mon.UID;
- //if pan.Enabled then g_Map_DisableWall(pan.arrIdx) else g_Map_EnableWall(pan.arrIdx);
- end;
-
-begin
- plrMouseX := msx;
- plrMouseY := msy;
- //e_WriteLog(Format('mouse: x=%d; y=%d; but=%d; bstate=%d', [msx, msy, but, bstate]), MSG_NOTIFY);
- if (gPlayer1 = nil) then exit;
-
- if (but = MouseLeft) then
- begin
- mapGrid.forEachAtPoint(pmsCurMapX, pmsCurMapY, wallToggle, (GridTagWall or GridTagDoor));
- exit;
- end;
-
- if (but = MouseRight) then
- begin
- monMarkedUID := -1;
- e_WriteLog('===========================', MSG_NOTIFY);
- monsGrid.forEachAtPoint(pmsCurMapX, pmsCurMapY, monsAtDump);
- e_WriteLog('---------------------------', MSG_NOTIFY);
- exit;
- end;
-end;
-
-
-procedure plrDebugDrawMouse ();
-
- function monsCollector (mon: TMonster; tag: Integer): Boolean;
- var
- ex, ey: Integer;
- mx, my, mw, mh: Integer;
- begin
- result := false;
- mon.getMapBox(mx, my, mw, mh);
- e_DrawQuad(mx, my, mx+mw-1, my+mh-1, 255, 255, 0, 96);
- if lineAABBIntersects(laserX0, laserY0, laserX1, laserY1, mx, my, mw, mh, ex, ey) then
- begin
- e_DrawPoint(8, ex, ey, 0, 255, 0);
- end;
- end;
-
-var
- mon: TMonster;
- mx, my, mw, mh: Integer;
-begin
- e_DrawPoint(4, plrMouseX, plrMouseY, 255, 0, 255);
- if (gPlayer1 = nil) then exit;
-
- //e_WriteLog(Format('(%d,%d)-(%d,%d)', [laserX0, laserY0, laserX1, laserY1]), MSG_NOTIFY);
-
- glPushMatrix();
- glTranslatef(-vpx, -vpy, 0);
-
- g_Mons_AlongLine(laserX0, laserY0, laserX1, laserY1, monsCollector, true);
-
- if (monMarkedUID <> -1) then
- begin
- mon := g_Monsters_ByUID(monMarkedUID);
- if (mon <> nil) then
- begin
- mon.getMapBox(mx, my, mw, mh);
- e_DrawQuad(mx, my, mx+mw-1, my+mh-1, 255, 0, 0, 30);
- end;
- end;
-
- //e_DrawPoint(16, laserX0, laserY0, 255, 255, 255);
-
- glPopMatrix();
-end;
-
-
procedure TPlayer.DrawAim();
procedure drawCast (sz: Integer; ax0, ay0, ax1, ay1: Integer);
var
ex, ey: Integer;
- //mon: TMonster;
- //mx, my, mw, mh: Integer;
begin
if isValidViewPort and (self = gPlayer1) then
begin
- vpx := viewPortX;
- vpy := viewPortY;
- //vpw := viewPortW;
- //vpy := viewPortH;
- evMouseCB := plrDebugMouse;
- postdrawMouse := plrDebugDrawMouse;
+ g_Holmes_plrView(viewPortX, viewPortY, viewPortW, viewPortH);
+ g_Holmes_plrLaser(ax0, ay0, ax1, ay1);
end;
- laserX0 := ax0;
- laserY0 := ay0;
- laserX1 := ax1;
- laserY1 := ay1;
-
e_DrawLine(sz, ax0, ay0, ax1, ay1, 255, 0, 0, 96);
if (g_Map_traceToNearestWall(ax0, ay0, ax1, ay1, @ex, @ey) <> nil) then
begin
e_DrawLine(sz, ax0, ay0, ex, ey, 0, 0, 255, 96);
end;
- {
- mon := g_Mons_ByIdx(0);
- mon.getMapBox(mx, my, mw, mh);
- ax1 := mx+mw div 2;
- ay1 := my+mh div 2;
- e_DrawLine(2, ax0, ay0, ax1, ay1, 0, 96, 96, 96);
-
- if lineAABBIntersects(ax0, ay0, ax1, ay1, mx, my, mw, mh, ex, ey) then
- begin
- e_DrawLine(2, ax0, ay0, ex, ey, 255, 255, 0, 96);
- end
- else
- begin
- e_DrawLine(2, ax0, ay0, ex, ey, 255, 127, 0, 96);
- end;
- }
-
drawTileGrid();
end;