1 (* Copyright (C) DooM 2D:Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *)
16 {$INCLUDE ../shared/a_modes.inc}
19 interface
21 uses
22 e_log,
25 xprofiler;
28 type
30 public
31 const
32 // both for but and for bstate
39 // event types
44 public
54 public
55 const
56 // modifiers
61 // event types
65 public
80 function g_Holmes_mouseEvent (var ev: THMouseEvent): Boolean; // returns `true` if event was eaten
83 // hooks for player
88 var
92 implementation
94 uses
99 var
100 //globalInited: Boolean = false;
112 // ////////////////////////////////////////////////////////////////////////// //
113 {$INCLUDE g_holmes.inc}
116 // ////////////////////////////////////////////////////////////////////////// //
118 begin
119 e_WriteLog(Format('Inspector: videomode changed: %dx%d', [gScreenWidth, gScreenHeight]), MSG_NOTIFY);
120 // texture space is possibly lost here, idc
126 //createCursorTexture();
130 begin
136 begin
140 // ////////////////////////////////////////////////////////////////////////// //
141 var
151 begin
160 begin
177 begin
179 e_WriteLog(Format('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]), MSG_NOTIFY);
181 begin
187 begin
191 //if pan.Enabled then g_Map_DisableWall(pan.arrIdx) else g_Map_EnableWall(pan.arrIdx);
195 begin
197 e_WriteLog(Format('monster #%d (UID:%u) (proxyid:%d)', [mon.arrIdx, mon.UID, mon.proxyId]), MSG_NOTIFY);
200 begin
201 //e_WriteLog(Format('mouse: x=%d; y=%d; but=%d; bstate=%d', [msx, msy, but, bstate]), MSG_NOTIFY);
208 begin
210 begin
211 // dump monsters in cell
215 end
216 else
217 begin
218 // toggle wall
223 exit;
227 begin
232 exit;
240 var
242 begin
245 begin
248 begin
251 begin
252 //e_DrawQuad(x, y, x+mapGrid.tileSize-1, y+mapGrid.tileSize-1, 96, 96, 96, 96);
262 begin
267 begin
268 //e_WriteLog(Format('h1: (%d,%d)', [cx, cy]), MSG_NOTIFY);
273 begin
276 //e_WriteLog(Format('h1: (%d,%d)', [cx, cy]), MSG_NOTIFY);
281 var
284 begin
289 begin
295 var
299 var
304 begin
306 begin
309 end
311 begin
314 end
315 else
316 begin
317 exit;
321 if (g_Map_traceToNearestWall(mx+mw div 2, my+mh div 2, emx+emw div 2, emy+emh div 2, @ex, @ey) <> nil) then
322 begin
328 var
332 begin
338 {$IF DEFINED(D2F_DEBUG)}
339 //mapGrid.dbgRayTraceTileHitCB := hilightCell1;
340 {$ENDIF}
341 if (g_Map_traceToNearestWall(mx+mw div 2, my+mh div 2, emx+emw div 2, emy+emh div 2, @ex, @ey) <> nil) then
342 //if (mapGrid.traceRay(ex, ey, mx+mw div 2, my+mh div 2, emx+emw div 2, emy+emh div 2, hilightWallTrc, (GridTagWall or GridTagDoor)) <> nil) then
343 begin
346 {$IF DEFINED(D2F_DEBUG)}
347 //mapGrid.dbgRayTraceTileHitCB := nil;
348 {$ENDIF}
351 begin
354 //mx += mw div 2;
359 begin
360 //fillRect(mx-4, my-7*8-6, 110, 7*8+6, 0, 0, 94, 250);
365 // type
366 drawText6(mx, my, Format('%s(U:%u)', [monsTypeToString(mon.MonsterType), mon.UID]), 255, 127, 0); my -= 8;
367 // beh
368 drawText6(mx, my, Format('Beh: %s', [monsBehToString(mon.MonsterBehaviour)]), 255, 127, 0); my -= 8;
369 // state
370 drawText6(mx, my, Format('State:%s (%d)', [monsStateToString(mon.MonsterState), mon.MonsterSleep]), 255, 127, 0); my -= 8;
371 // health
373 // ammo
375 // target
382 {
383 property MonsterRemoved: Boolean read FRemoved write FRemoved;
384 property MonsterPain: Integer read FPain write FPain;
385 property MonsterAnim: Byte read FCurAnim write FCurAnim;
386 }
390 begin
395 var
398 begin
399 //e_DrawPoint(4, plrMouseX, plrMouseY, 255, 0, 255);
402 //e_WriteLog(Format('(%d,%d)-(%d,%d)', [laserX0, laserY0, laserX1, laserY1]), MSG_NOTIFY);
412 begin
415 begin
426 if showMapCurPos then drawText8(4, gWinSizeY-10, Format('mappos:(%d,%d)', [pmsCurMapX, pmsCurMapY]), 255, 255, 0);
430 // ////////////////////////////////////////////////////////////////////////// //
432 begin
444 var
452 begin
455 begin
465 // press
467 begin
468 // M-M: one monster think step
470 begin
474 exit;
476 // M-I: toggle monster info
478 begin
481 exit;
483 // M-L: toggle monster LOS to player
485 begin
488 exit;
490 // M-G: toggle "show all cells occupied by monsters"
492 begin
495 exit;
497 // M-A: wake up monster
499 begin
502 begin
506 exit;
508 // C-T: teleport player
510 begin
512 //e_WriteLog(Format('TELEPORT: (%d,%d)', [pmsCurMapX, pmsCurMapY]), MSG_NOTIFY);
514 begin
516 gPlayers[0].TeleportTo(pmsCurMapX-w div 2, pmsCurMapY-h div 2, true, 69); // 69: don't change dir
518 exit;
520 // C-P: show cursor position on the map
522 begin
525 exit;
527 // C-G: toggle grid
529 begin
532 exit;
534 // C-UP, C-DOWN, C-LEFT, C-RIGHT: trace 10 pixels from cursor in the respective direction
535 if ((ev.scan = SDL_SCANCODE_UP) or (ev.scan = SDL_SCANCODE_DOWN) or (ev.scan = SDL_SCANCODE_LEFT) or (ev.scan = SDL_SCANCODE_RIGHT)) and
537 begin
547 {$IF DEFINED(D2F_DEBUG)}
548 //mapGrid.dbgRayTraceTileHitCB := dummyWallTrc;
550 {$ENDIF}
551 pan := g_Map_traceToNearest(pmsCurMapX, pmsCurMapY, dx, dy, (GridTagWall or GridTagDoor or GridTagStep or GridTagAcid1 or GridTagAcid2 or GridTagWater), @ex, @ey);
552 {$IF DEFINED(D2F_DEBUG)}
553 //mapGrid.dbgRayTraceTileHitCB := nil;
555 {$ENDIF}
556 e_LogWritefln('v-trace: (%d,%d)-(%d,%d); end=(%d,%d); hit=%d', [pmsCurMapX, pmsCurMapY, dx, dy, ex, ey, (pan <> nil)]);
557 exit;
563 // ////////////////////////////////////////////////////////////////////////// //
565 begin
573 begin
577 //drawText6Prop(10, 10, 'Hi there, I''m Holmes!', 255, 255, 0);
578 //drawText8Prop(10, 20, 'Hi there, I''m Holmes!', 255, 255, 0);