CSwitchesDialog.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. ** Command & Conquer Generals(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. #include "StdAfx.h"
  19. #include "Resource.h"
  20. #include "CSwitchesDialog.h"
  21. #include "ParticleEditorDialog.h"
  22. CSwitchesDialog::CSwitchesDialog(UINT nIDTemplate, CWnd* pParentWnd) : CDialog(nIDTemplate, pParentWnd)
  23. {
  24. }
  25. void CSwitchesDialog::InitPanel( void )
  26. {
  27. }
  28. // if true, updates the UI from the Particle System.
  29. // if false, updates the Particle System from the UI
  30. void CSwitchesDialog::performUpdate( IN Bool toUI )
  31. {
  32. DebugWindowDialog *parent = GetDWDParent();
  33. if (!parent) {
  34. return;
  35. }
  36. { // update hollowness
  37. CButton *pWnd;
  38. pWnd = (CButton*)GetDlgItem(IDC_PSEd_Hollow);
  39. if (pWnd) {
  40. Bool hollow;
  41. if (toUI) {
  42. parent->getSwitchFromSystem(ST_HOLLOW, hollow);
  43. pWnd->SetCheck(hollow);
  44. } else {
  45. hollow = pWnd->GetCheck();
  46. parent->updateSwitchToSystem(ST_HOLLOW, hollow);
  47. }
  48. }
  49. }
  50. { // update one shot
  51. CButton *pWnd;
  52. pWnd = (CButton*)GetDlgItem(IDC_PSEd_OneShot);
  53. if (pWnd) {
  54. Bool oneShot;
  55. if (toUI) {
  56. parent->getSwitchFromSystem(ST_ONESHOT, oneShot);
  57. pWnd->SetCheck(oneShot);
  58. } else {
  59. oneShot = pWnd->GetCheck();
  60. parent->updateSwitchToSystem(ST_ONESHOT, oneShot);
  61. }
  62. }
  63. }
  64. { // update Ground Aligned
  65. CButton *pWnd;
  66. pWnd = (CButton*)GetDlgItem(IDC_PSEd_GroundAligned);
  67. if (pWnd) {
  68. Bool groundAlign;
  69. if (toUI) {
  70. parent->getSwitchFromSystem(ST_ALIGNXY, groundAlign);
  71. pWnd->SetCheck(groundAlign);
  72. } else {
  73. groundAlign = pWnd->GetCheck();
  74. parent->updateSwitchToSystem(ST_ALIGNXY, groundAlign);
  75. }
  76. }
  77. }
  78. { // update Emit above ground only
  79. CButton *pWnd;
  80. pWnd = (CButton*)GetDlgItem(IDC_PSEd_EmitAboveGroundOnly);
  81. if (pWnd) {
  82. Bool aboveGroundOnly;
  83. if (toUI) {
  84. parent->getSwitchFromSystem(ST_EMITABOVEGROUNDONLY, aboveGroundOnly);
  85. pWnd->SetCheck(aboveGroundOnly);
  86. } else {
  87. aboveGroundOnly = pWnd->GetCheck();
  88. parent->updateSwitchToSystem(ST_EMITABOVEGROUNDONLY, aboveGroundOnly);
  89. }
  90. }
  91. }
  92. { // update Particle Up towards emitter
  93. CButton *pWnd;
  94. pWnd = (CButton*)GetDlgItem(IDC_PSEd_ParticleUpTowardsEmitter);
  95. if (pWnd) {
  96. Bool upTowardsEmitter;
  97. if (toUI) {
  98. parent->getSwitchFromSystem(ST_PARTICLEUPTOWARDSEMITTER, upTowardsEmitter);
  99. pWnd->SetCheck(upTowardsEmitter);
  100. } else {
  101. upTowardsEmitter = pWnd->GetCheck();
  102. parent->updateSwitchToSystem(ST_PARTICLEUPTOWARDSEMITTER, upTowardsEmitter);
  103. }
  104. }
  105. }
  106. }
  107. void CSwitchesDialog::OnParticleSystemEdit()
  108. {
  109. DebugWindowDialog *pParent = GetDWDParent();
  110. if (!pParent) {
  111. return;
  112. }
  113. pParent->signalParticleSystemEdit();
  114. }
  115. BEGIN_MESSAGE_MAP(CSwitchesDialog, CDialog)
  116. ON_BN_CLICKED(IDC_PSEd_OneShot, OnParticleSystemEdit)
  117. ON_BN_CLICKED(IDC_PSEd_Hollow, OnParticleSystemEdit)
  118. ON_BN_CLICKED(IDC_PSEd_GroundAligned, OnParticleSystemEdit)
  119. ON_BN_CLICKED(IDC_PSEd_EmitAboveGroundOnly, OnParticleSystemEdit)
  120. ON_BN_CLICKED(IDC_PSEd_ParticleUpTowardsEmitter, OnParticleSystemEdit)
  121. END_MESSAGE_MAP()