///////////////////////////////////////////////////// TMapDC ------ draw a Thing
| 722 | // ------ |
| 723 | // draw a Thing |
| 724 | void TMapDC::DrawMapThing (int editmode, SHORT tnum) |
| 725 | { |
| 726 | assert_tnum (tnum); |
| 727 | Thing *pThing = &Things[tnum]; |
| 728 | |
| 729 | SHORT xpos = pThing->xpos; |
| 730 | SHORT ypos = pThing->ypos; |
| 731 | SHORT scrRadius; |
| 732 | SHORT mapRadius; |
| 733 | |
| 734 | // Select the radius |
| 735 | if (editmode == OBJ_THINGS) |
| 736 | mapRadius = GetKodObjectRadius(Things[tnum].type); |
| 737 | else |
| 738 | mapRadius = OBJSIZE; |
| 739 | |
| 740 | // Calc. bouding rectangle |
| 741 | SHORT x0 = xpos - mapRadius; |
| 742 | SHORT y0 = ypos + mapRadius; |
| 743 | SHORT x1 = xpos + mapRadius; |
| 744 | SHORT y1 = ypos - mapRadius; |
| 745 | |
| 746 | #ifndef WINDOWS_CLIPPING |
| 747 | if ( ! IS_VISIBLE_MAP_RECT(x0,y0,x1,y1) ) |
| 748 | return; |
| 749 | #endif |
| 750 | |
| 751 | // Convert map coords. to screen coords. |
| 752 | scrRadius = (SHORT)(mapRadius * MUL_SCALE); |
| 753 | |
| 754 | #ifndef WINDOWS_SCALING |
| 755 | xpos = SCREENX(xpos); |
| 756 | ypos = SCREENY(ypos); |
| 757 | x0 = SCREENX(x0); |
| 758 | y0 = SCREENY(y0); |
| 759 | x1 = SCREENX(x1); |
| 760 | y1 = SCREENY(y1); |
| 761 | #endif |
| 762 | |
| 763 | // Draw bouding circle of the thing |
| 764 | if (editmode == OBJ_THINGS) |
| 765 | { |
| 766 | SetPenColor16 (GetKodObjectColor (Things[tnum].type)); |
| 767 | // If radius is small, draw a rectangle instead of an ellipse |
| 768 | if ( scrRadius > 4 ) |
| 769 | { |
| 770 | Ellipse (x0, y0, x1+1, y1+1); |
| 771 | } |
| 772 | else if ( scrRadius > 1 ) |
| 773 | { |
| 774 | TPoint points[5], *pp = points ; |
| 775 | pp->x = xpos; pp->y = y0; pp++; |
| 776 | pp->x = x1; pp->y = ypos; pp++; |
| 777 | pp->x = xpos; pp->y = y1; pp++; |
| 778 | pp->x = x0; pp->y = ypos; pp++; |
| 779 | pp->x = xpos; pp->y = y0; |
| 780 | Polyline (points, 5); |
| 781 | } |
nothing calls this directly
no test coverage detected