MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / HighlightObject

Function HighlightObject

roomedit/source/objects.cpp:425–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423*/
424
425void HighlightObject(TMapDC &dc, int objtype, SHORT objnum, int color)
426{
427 SHORT n, m;
428 SHORT x, y;
429 SHORT x1, y1;
430 SHORT start, end;
431
432 if ( objnum == -1 )
433 return;
434
435 // use XOR mode : drawing any line twice erases it
436 int OldROP2 = dc.SetROP2 (R2_XORPEN);
437
438 switch ( objtype)
439 {
440 case OBJ_THINGS:
441 assert (objnum >= 0 && objnum < NumThings);
442
443 m = (GetKodObjectRadius (Things[objnum].type) * 3) / 2;
444 x = Things[objnum].xpos;
445 y = Things[objnum].ypos;
446
447 dc.SetPenColor16(color);
448 dc.DrawMapRect (x - m, y - m, x + m, y + m);
449 dc.DrawMapArrow (x, y, Things[objnum].angle * 182, m * 10 / 8);
450 break;
451
452 case OBJ_LINEDEFS:
453 assert (objnum >= 0 && objnum < NumLineDefs);
454
455 start = LineDefs[ objnum].start;
456 end = LineDefs[ objnum].end;
457 assert (start >= 0 && start < NumVertexes);
458 assert (end >= 0 && end < NumVertexes);
459
460 x = Vertexes[start].x;
461 y = Vertexes[start].y;
462 x1 = Vertexes[end].x;
463 y1 = Vertexes[end].y;
464
465 dc.SetPenColor16 (color);
466 n = (x + x1) / 2;
467 m = (y + y1) / 2;
468 dc.DrawMapLine (n, m, n + (y1 - y) / 3, m + (x - x1) / 3);
469
470 // Draw the vector
471 // Set pen width to 3 (screen size, not map size!)
472 dc.SetPenColor16 (color, 3);
473 dc.DrawMapVector(x, y, x1, y1);
474
475 // Draw sector attached (widh same tag number) to this LineDef
476 if (color != LIGHTRED && LineDefs[ objnum].tag > 0)
477 {
478 for (m = 0; m < NumSectors; m++)
479 if (Sectors[ m].tag == LineDefs[ objnum].tag)
480 HighlightObject(dc, OBJ_SECTORS, m, LIGHTRED);
481 }
482 break;

Callers 9

HighlightSelectionFunction · 0.85
PaintMethod · 0.85
EvMouseMoveMethod · 0.85
EvLButtonDownMethod · 0.85
EvLButtonUpMethod · 0.85
EvRButtonDownMethod · 0.85
EvCharMethod · 0.85
CmSearchPrevMethod · 0.85
CmSearchNextMethod · 0.85

Calls 8

GetKodObjectRadiusFunction · 0.85
SetROP2Method · 0.80
SetPenColor16Method · 0.80
DrawMapRectMethod · 0.80
DrawMapArrowMethod · 0.80
DrawMapLineMethod · 0.80
DrawMapVectorMethod · 0.80
dprintfFunction · 0.50

Tested by

no test coverage detected