tacMapTGA.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #define TGAMAPTGA_CPP
  2. /*************************************************************************************************\
  3. TgaMapTGA.cpp : Implementation of the TgaMapTGA component.
  4. //---------------------------------------------------------------------------//
  5. // Copyright (C) Microsoft Corporation. All rights reserved. //
  6. //===========================================================================//
  7. \*************************************************************************************************/
  8. #include "stdafx.h"
  9. #include "TacMapTGA.h"
  10. #include "tacMap.h"
  11. #include "EditorData.h"
  12. BEGIN_MESSAGE_MAP(TacMapTGA, TGAWnd)
  13. //{{AFX_MSG_MAP(TGAWnd)
  14. ON_WM_PAINT()
  15. //}}AFX_MSG_MAP
  16. END_MESSAGE_MAP()
  17. // THIS NEEDS TO BE MOVED TO A DERIVED CLASS!
  18. void TacMapTGA::OnPaint()
  19. {
  20. TGAWnd::OnPaint();
  21. CDC* pDC =GetDC();
  22. CDC& dc = *pDC;
  23. // device context for painting
  24. if ( eye && land && land->realVerticesMapSide )
  25. {
  26. Stuff::Vector2DOf< long > screen;
  27. gos_VERTEX tmp;
  28. Stuff::Vector3D world;
  29. POINT pts[5];
  30. // alrighty need to draw that little rectangle
  31. screen.x = 1;
  32. screen.y = 1;
  33. eye->inverseProject( screen, world );
  34. TacMap::worldToTacMap( world, 0, 0, TACMAP_SIZE, TACMAP_SIZE, tmp );
  35. pts[0].x = tmp.x;
  36. pts[0].y = tmp.y;
  37. screen.y = Environment.screenHeight - 1;
  38. eye->inverseProject( screen, world );
  39. TacMap::worldToTacMap( world, 0, 0, TACMAP_SIZE, TACMAP_SIZE, tmp );
  40. pts[1].x = tmp.x;
  41. pts[1].y = tmp.y;
  42. screen.x = Environment.screenWidth - 1;
  43. eye->inverseProject( screen, world );
  44. TacMap::worldToTacMap( world, 0, 0,TACMAP_SIZE, TACMAP_SIZE, tmp );
  45. pts[2].x = tmp.x;
  46. pts[2].y = tmp.y;
  47. screen.y = 1;
  48. eye->inverseProject( screen, world );
  49. TacMap::worldToTacMap( world, 0, 0, TACMAP_SIZE, TACMAP_SIZE, tmp );
  50. pts[3].x = tmp.x;
  51. pts[3].y = tmp.y;
  52. pts[4] = pts[0];
  53. CPen ourPen( PS_SOLID, 1, 0x00ffffff );
  54. CPen *pReplacedPen = dc.SelectObject(&ourPen);
  55. dc.MoveTo( pts[0].x, pts[0].y );
  56. for ( int i = 1; i < 5; ++i )
  57. {
  58. dc.LineTo( pts[i] );
  59. }
  60. dc.SelectObject(pReplacedPen);
  61. }
  62. ReleaseDC( pDC );
  63. }
  64. void TacMapTGA::refreshBmp()
  65. {
  66. EditorData::instance->drawTacMap( (BYTE*)m_pBits, 128 * 128 * 4, 128 );
  67. RedrawWindow( );
  68. }
  69. //*************************************************************************************************
  70. // end of file ( TgaMapTGA.cpp )