CoverSpotInfoPage.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // CoverSpotInfoPage.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "CoverSpotInfoPage.h"
  22. #include "leveledit.h"
  23. #include "coverspotnode.h"
  24. #include "node.h"
  25. #include "utils.h"
  26. #include "sceneeditor.h"
  27. #include "mousemgr.h"
  28. #include "coverattackpointnode.h"
  29. #ifdef _DEBUG
  30. #define new DEBUG_NEW
  31. #undef THIS_FILE
  32. static char THIS_FILE[] = __FILE__;
  33. #endif
  34. /////////////////////////////////////////////////////////////////////////////
  35. //
  36. // CoverSpotInfoPageClass
  37. //
  38. /////////////////////////////////////////////////////////////////////////////
  39. CoverSpotInfoPageClass::CoverSpotInfoPageClass (void)
  40. : m_CoverSpot (NULL),
  41. DockableFormClass (CoverSpotInfoPageClass::IDD)
  42. {
  43. return ;
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. //
  47. // CoverSpotInfoPageClass
  48. //
  49. /////////////////////////////////////////////////////////////////////////////
  50. CoverSpotInfoPageClass::CoverSpotInfoPageClass (CoverSpotNodeClass *cover_spot)
  51. : m_CoverSpot (cover_spot),
  52. DockableFormClass (CoverSpotInfoPageClass::IDD)
  53. {
  54. //{{AFX_DATA_INIT(CoverSpotInfoPageClass)
  55. // NOTE: the ClassWizard will add member initialization here
  56. //}}AFX_DATA_INIT
  57. return ;
  58. }
  59. /////////////////////////////////////////////////////////////////////////////
  60. //
  61. // ~CoverSpotInfoPageClass
  62. //
  63. /////////////////////////////////////////////////////////////////////////////
  64. CoverSpotInfoPageClass::~CoverSpotInfoPageClass (void)
  65. {
  66. return ;
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. //
  70. // DoDataExchange
  71. //
  72. /////////////////////////////////////////////////////////////////////////////
  73. void
  74. CoverSpotInfoPageClass::DoDataExchange (CDataExchange* pDX)
  75. {
  76. DockableFormClass::DoDataExchange (pDX);
  77. //{{AFX_DATA_MAP(CoverSpotInfoPageClass)
  78. // NOTE: the ClassWizard will add DDX and DDV calls here
  79. //}}AFX_DATA_MAP
  80. return ;
  81. }
  82. BEGIN_MESSAGE_MAP(CoverSpotInfoPageClass, DockableFormClass)
  83. //{{AFX_MSG_MAP(CoverSpotInfoPageClass)
  84. ON_BN_CLICKED(IDC_ADD_ATTACK_LOCATION, OnAddAttackLocation)
  85. //}}AFX_MSG_MAP
  86. END_MESSAGE_MAP()
  87. /////////////////////////////////////////////////////////////////////////////
  88. // CoverSpotInfoPageClass diagnostics
  89. #ifdef _DEBUG
  90. void CoverSpotInfoPageClass::AssertValid() const
  91. {
  92. DockableFormClass::AssertValid();
  93. }
  94. void CoverSpotInfoPageClass::Dump(CDumpContext& dc) const
  95. {
  96. DockableFormClass::Dump(dc);
  97. }
  98. #endif //_DEBUG
  99. /////////////////////////////////////////////////////////////////////////////
  100. //
  101. // HandleInitDialog
  102. //
  103. /////////////////////////////////////////////////////////////////////////////
  104. void
  105. CoverSpotInfoPageClass::HandleInitDialog (void)
  106. {
  107. ASSERT (m_CoverSpot != NULL);
  108. SendDlgItemMessage (IDC_CROUCH_CHECK, BM_SETCHECK, m_CoverSpot->Requires_Crouch ());
  109. return ;
  110. }
  111. /////////////////////////////////////////////////////////////////////////////
  112. //
  113. // Apply_Changes
  114. //
  115. /////////////////////////////////////////////////////////////////////////////
  116. bool
  117. CoverSpotInfoPageClass::Apply_Changes (void)
  118. {
  119. BOOL crouch = SendDlgItemMessage (IDC_CROUCH_CHECK, BM_GETCHECK);
  120. m_CoverSpot->Set_Requires_Crouch (bool(crouch == 1));
  121. // Return true to allow the dialog to close
  122. return true;
  123. }
  124. /////////////////////////////////////////////////////////////////////////////
  125. //
  126. // OnAddAttackLocation
  127. //
  128. /////////////////////////////////////////////////////////////////////////////
  129. void
  130. CoverSpotInfoPageClass::OnAddAttackLocation (void)
  131. {
  132. //
  133. // Add a new attack point to the world
  134. //
  135. CoverAttackPointNodeClass *attack_point = m_CoverSpot->Add_Attack_Point (Matrix3D(1));
  136. if (attack_point != NULL) {
  137. ::Get_Mouse_Mgr ()->Move_Node (attack_point);
  138. }
  139. //
  140. // Simulate pressing the OK button
  141. //
  142. ::PostMessage (::GetParent (m_hWnd), WM_COMMAND, MAKELPARAM(IDC_OK, BN_CLICKED), 0L);
  143. return ;
  144. }