| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 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 | |
| 19 | // PropertyPhysicsDlg.cpp : implementation file |
| 20 | // |
| 21 | |
| 22 | #include "stdafx.h" |
| 23 | #include "editor.h" |
| 24 | #include "PropertyPhysicsDlg.h" |
| 25 | #include "object.h" |
| 26 | |
| 27 | #ifdef _DEBUG |
| 28 | #define new DEBUG_NEW |
| 29 | #undef THIS_FILE |
| 30 | static char THIS_FILE[] = __FILE__; |
| 31 | #endif |
| 32 | |
| 33 | ///////////////////////////////////////////////////////////////////////////// |
| 34 | // CPropertyPhysicsDlg dialog |
| 35 | |
| 36 | CPropertyPhysicsDlg::CPropertyPhysicsDlg(CWnd *pParent /*=NULL*/) : CKeypadDialog(CPropertyPhysicsDlg::IDD, pParent) { |
| 37 | //{{AFX_DATA_INIT(CPropertyPhysicsDlg) |
| 38 | m_bBounce = FALSE; |
| 39 | m_fDrag = 0.0f; |
| 40 | m_fFullRotThrust = 0.0f; |
| 41 | m_fFullThrust = 0.0f; |
| 42 | m_bGravity = FALSE; |
| 43 | m_bLevelling = FALSE; |
| 44 | m_bMagnetism = FALSE; |
| 45 | m_fMass = 0.0f; |
| 46 | m_fMaxTurnrollrate = 0.0f; |
| 47 | m_iNumBounces = 0; |
| 48 | m_bPersistent = FALSE; |
| 49 | m_fRotDrag = 0.0f; |
| 50 | m_fRotThrustX = 0.0f; |
| 51 | m_fRotThrustY = 0.0f; |
| 52 | m_fRotThrustZ = 0.0f; |
| 53 | m_fRotVelX = 0.0f; |
| 54 | m_fRotVelY = 0.0f; |
| 55 | m_fRotVelZ = 0.0f; |
| 56 | m_bSticks = FALSE; |
| 57 | m_fThrustX = 0.0f; |
| 58 | m_fThrustY = 0.0f; |
| 59 | m_fThrustZ = 0.0f; |
| 60 | m_bTurnroll = FALSE; |
| 61 | m_fTurnrollRatio = 0.0f; |
| 62 | m_sTurnrollAngle = 0; |
| 63 | m_bUsesThrust = FALSE; |
| 64 | m_fVelocityX = 0.0f; |
| 65 | m_fVelocityY = 0.0f; |
| 66 | m_fVelocityZ = 0.0f; |
| 67 | m_bWiggle = FALSE; |
| 68 | m_fWiggleAmplitude = 0.0f; |
| 69 | m_fWigglesPerSecond = 0.0f; |
| 70 | m_bWind = FALSE; |
| 71 | m_bUnlimitedBounce = FALSE; |
| 72 | //}}AFX_DATA_INIT |
| 73 | } |
| 74 | |
| 75 | void CPropertyPhysicsDlg::DoDataExchange(CDataExchange *pDX) { |
| 76 | CDialog::DoDataExchange(pDX); |
| 77 | //{{AFX_DATA_MAP(CPropertyPhysicsDlg) |
| 78 | DDX_Check(pDX, IDC_PBOUNCE, m_bBounce); |
| 79 | DDX_Text(pDX, IDC_PDRAG, m_fDrag); |
| 80 | DDX_Text(pDX, IDC_PFULL_ROTTHRUST, m_fFullRotThrust); |
| 81 | DDX_Text(pDX, IDC_PFULL_THRUST, m_fFullThrust); |
| 82 | DDX_Check(pDX, IDC_PGRAVITY, m_bGravity); |
| 83 | DDX_Check(pDX, IDC_PLEVELLING, m_bLevelling); |
| 84 | DDX_Check(pDX, IDC_PMAGNETISM, m_bMagnetism); |
| 85 | DDX_Text(pDX, IDC_PMASS, m_fMass); |
| 86 | DDX_Text(pDX, IDC_PMAX_TURNROLL_RATE, m_fMaxTurnrollrate); |
| 87 | DDX_Text(pDX, IDC_PNUM_BOUNCES, m_iNumBounces); |
| 88 | DDX_Check(pDX, IDC_PPERSISTENT, m_bPersistent); |
| 89 | DDX_Text(pDX, IDC_PROTDRAG, m_fRotDrag); |
| 90 | DDX_Text(pDX, IDC_PROTTHRUST_X, m_fRotThrustX); |
| 91 | DDX_Text(pDX, IDC_PROTTHRUST_Y, m_fRotThrustY); |
| 92 | DDX_Text(pDX, IDC_PROTTHRUST_Z, m_fRotThrustZ); |
| 93 | DDX_Text(pDX, IDC_PROTVEL_X, m_fRotVelX); |
| 94 | DDX_Text(pDX, IDC_PROTVEL_Y, m_fRotVelY); |
| 95 | DDX_Text(pDX, IDC_PROTVEL_Z, m_fRotVelZ); |
| 96 | DDX_Check(pDX, IDC_PSTICKS, m_bSticks); |
| 97 | DDX_Text(pDX, IDC_PTHRUST_X, m_fThrustX); |
| 98 | DDX_Text(pDX, IDC_PTHRUST_Y, m_fThrustY); |
| 99 | DDX_Text(pDX, IDC_PTHRUST_Z, m_fThrustZ); |
| 100 | DDX_Check(pDX, IDC_PTURNROLL, m_bTurnroll); |
| 101 | DDX_Text(pDX, IDC_PTURNROLL_RATIO, m_fTurnrollRatio); |
| 102 | DDX_Text(pDX, IDC_PTURNROLLANGLE, m_sTurnrollAngle); |
| 103 | DDX_Check(pDX, IDC_PUSESTHRUST, m_bUsesThrust); |
| 104 | DDX_Text(pDX, IDC_PVELOCITY_X, m_fVelocityX); |
| 105 | DDX_Text(pDX, IDC_PVELOCITY_Y, m_fVelocityY); |
| 106 | DDX_Text(pDX, IDC_PVELOCITY_Z, m_fVelocityZ); |
| 107 | DDX_Check(pDX, IDC_PWIGGLE, m_bWiggle); |
| 108 | DDX_Text(pDX, IDC_PWIGGLE_AMPLITUDE, m_fWiggleAmplitude); |
| 109 | DDX_Text(pDX, IDC_PWIGGLES_PER_SECOND, m_fWigglesPerSecond); |
| 110 | DDX_Check(pDX, IDC_PWIND, m_bWind); |
| 111 | DDX_Check(pDX, IDC_PUNLIMBOUNCE, m_bUnlimitedBounce); |
| 112 | //}}AFX_DATA_MAP |
| 113 | } |
| 114 | |
| 115 | BEGIN_MESSAGE_MAP(CPropertyPhysicsDlg, CDialog) |
| 116 | //{{AFX_MSG_MAP(CPropertyPhysicsDlg) |
| 117 | ON_BN_CLICKED(IDC_PTURNROLL, OnPturnroll) |
| 118 | ON_BN_CLICKED(IDC_PLEVELLING, OnPlevelling) |
| 119 | ON_BN_CLICKED(IDC_PBOUNCE, OnPbounce) |
| 120 | ON_BN_CLICKED(IDC_PWIGGLE, OnPwiggle) |
| 121 | ON_BN_CLICKED(IDC_PSTICKS, OnPsticks) |
| 122 | ON_BN_CLICKED(IDC_PPERSISTENT, OnPpersistent) |
| 123 | ON_BN_CLICKED(IDC_PUSESTHRUST, OnPusesthrust) |
| 124 | ON_BN_CLICKED(IDC_PGRAVITY, OnPgravity) |
| 125 | ON_BN_CLICKED(IDC_PMAGNETISM, OnPmagnetism) |
| 126 | ON_BN_CLICKED(IDC_PWIND, OnPwind) |
| 127 | ON_BN_CLICKED(IDC_PUNLIMBOUNCE, OnPunlimbounce) |
| 128 | //}}AFX_MSG_MAP |
| 129 | END_MESSAGE_MAP() |
| 130 | |
| 131 | ///////////////////////////////////////////////////////////////////////////// |
| 132 | // CPropertyPhysicsDlg message handlers |
| 133 | |
| 134 | void CPropertyPhysicsDlg::OnPturnroll() { |
| 135 | // TODO: Add your control notification handler code here |
| 136 | if (m_bTurnroll) { |
| 137 | m_bTurnroll = false; |
| 138 | Disable(IDC_PTURNROLL); |
| 139 | } else { |
| 140 | m_bTurnroll = true; |
| 141 | Enable(IDC_PTURNROLL); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | void CPropertyPhysicsDlg::OnPlevelling() { |
| 146 | // TODO: Add your control notification handler code here |
| 147 | if (m_bLevelling) { |
| 148 | m_bLevelling = false; |
| 149 | Disable(IDC_PLEVELLING); |
| 150 | } else { |
| 151 | m_bLevelling = true; |
| 152 | Enable(IDC_PLEVELLING); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | void CPropertyPhysicsDlg::OnPbounce() { |
| 157 | // TODO: Add your control notification handler code here |
| 158 | if (m_bBounce) { |
| 159 | m_bBounce = false; |
| 160 | Disable(IDC_PBOUNCE); |
| 161 | } else { |
| 162 | m_bBounce = true; |
| 163 | Enable(IDC_PBOUNCE); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | void CPropertyPhysicsDlg::OnPwiggle() { |
| 168 | // TODO: Add your control notification handler code here |
| 169 | if (m_bWiggle) { |
| 170 | m_bWiggle = false; |
| 171 | Disable(IDC_PWIGGLE); |
| 172 | } else { |
| 173 | m_bWiggle = true; |
| 174 | Enable(IDC_PWIGGLE); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | void CPropertyPhysicsDlg::OnPsticks() { |
| 179 | // TODO: Add your control notification handler code here |
| 180 | if (m_bSticks) { |
| 181 | m_bSticks = false; |
| 182 | Disable(IDC_PSTICKS); |
| 183 | } else { |
| 184 | m_bSticks = true; |
| 185 | Enable(IDC_PSTICKS); |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | void CPropertyPhysicsDlg::OnPpersistent() { |
| 190 | // TODO: Add your control notification handler code here |
| 191 | if (m_bPersistent) { |
| 192 | m_bPersistent = false; |
| 193 | Disable(IDC_PPERSISTENT); |
| 194 | } else { |
| 195 | m_bPersistent = true; |
| 196 | Enable(IDC_PPERSISTENT); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | void CPropertyPhysicsDlg::OnPusesthrust() { |
| 201 | // TODO: Add your control notification handler code here |
| 202 | if (m_bUsesThrust) { |
| 203 | m_bUsesThrust = false; |
| 204 | Disable(IDC_PUSESTHRUST); |
| 205 | } else { |
| 206 | m_bUsesThrust = true; |
| 207 | Enable(IDC_PUSESTHRUST); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | void CPropertyPhysicsDlg::OnPgravity() { |
| 212 | // TODO: Add your control notification handler code here |
| 213 | if (m_bGravity) { |
| 214 | m_bGravity = false; |
| 215 | Disable(IDC_PGRAVITY); |
| 216 | } else { |
| 217 | m_bGravity = true; |
| 218 | Enable(IDC_PGRAVITY); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | void CPropertyPhysicsDlg::OnPmagnetism() { |
| 223 | // TODO: Add your control notification handler code here |
| 224 | if (m_bMagnetism) { |
| 225 | m_bMagnetism = false; |
| 226 | Disable(IDC_PMAGNETISM); |
| 227 | } else { |
| 228 | m_bMagnetism = true; |
| 229 | Enable(IDC_PMAGNETISM); |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | void CPropertyPhysicsDlg::OnPwind() { |
| 234 | // TODO: Add your control notification handler code here |
| 235 | if (m_bWind) { |
| 236 | m_bWind = false; |
| 237 | Disable(IDC_PWIND); |
| 238 | } else { |
| 239 | m_bWind = true; |
| 240 | Enable(IDC_PWIND); |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | BOOL CPropertyPhysicsDlg::OnInitDialog() { |
| 245 | |
| 246 | // TODO: Add extra initialization here |
| 247 | object *curobj; |
| 248 | |
| 249 | curobj = &Objects[Cur_object_index]; |
| 250 | |
| 251 | m_fVelocityX = curobj->mtype.phys_info.velocity.x; |
| 252 | m_fVelocityY = curobj->mtype.phys_info.velocity.y; |
| 253 | m_fVelocityZ = curobj->mtype.phys_info.velocity.z; |
| 254 | |
| 255 | m_fThrustX = curobj->mtype.phys_info.thrust.x; |
| 256 | m_fThrustY = curobj->mtype.phys_info.thrust.y; |
| 257 | m_fThrustZ = curobj->mtype.phys_info.thrust.z; |
| 258 | |
| 259 | m_fRotVelX = curobj->mtype.phys_info.rotvel.x; |
| 260 | m_fRotVelY = curobj->mtype.phys_info.rotvel.y; |
| 261 | m_fRotVelZ = curobj->mtype.phys_info.rotvel.z; |
| 262 | |
| 263 | m_fRotThrustX = curobj->mtype.phys_info.rotthrust.x; |
| 264 | m_fRotThrustY = curobj->mtype.phys_info.rotthrust.y; |
| 265 | m_fRotThrustZ = curobj->mtype.phys_info.rotthrust.z; |
| 266 | |
| 267 | m_sTurnrollAngle = curobj->mtype.phys_info.turnroll; |
| 268 | |
| 269 | m_iNumBounces = curobj->mtype.phys_info.num_bounces; |
| 270 | if (m_iNumBounces == -1) |
| 271 | m_bUnlimitedBounce = true; |
| 272 | |
| 273 | m_fMass = curobj->mtype.phys_info.mass; |
| 274 | |
| 275 | m_fDrag = curobj->mtype.phys_info.drag; |
| 276 | |
| 277 | m_fRotDrag = curobj->mtype.phys_info.rotdrag; |
| 278 | |
| 279 | m_fFullThrust = curobj->mtype.phys_info.full_thrust; |
| 280 | |
| 281 | m_fFullRotThrust = curobj->mtype.phys_info.full_rotthrust; |
| 282 | |
| 283 | m_fMaxTurnrollrate = curobj->mtype.phys_info.max_turnroll_rate; |
| 284 | |
| 285 | m_fTurnrollRatio = curobj->mtype.phys_info.turnroll_ratio; |
| 286 | |
| 287 | m_fWiggleAmplitude = curobj->mtype.phys_info.wiggle_amplitude; |
| 288 | |
| 289 | m_fWigglesPerSecond = curobj->mtype.phys_info.wiggles_per_sec; |
| 290 | |
| 291 | if (curobj->mtype.phys_info.flags & PF_TURNROLL) |
| 292 | m_bTurnroll = true; |
| 293 | if (curobj->mtype.phys_info.flags & PF_LEVELING) |
| 294 | m_bLevelling = true; |
| 295 | if (curobj->mtype.phys_info.flags & PF_BOUNCE) |
| 296 | m_bBounce = true; |
| 297 | if (curobj->mtype.phys_info.flags & PF_WIGGLE) |
| 298 | m_bWiggle = true; |
| 299 | if (curobj->mtype.phys_info.flags & PF_STICK) |
| 300 | if (m_bBounce) |
| 301 | m_bSticks = false; |
| 302 | else |
| 303 | m_bSticks = true; |
| 304 | if (curobj->mtype.phys_info.flags & PF_PERSISTENT) |
| 305 | m_bPersistent = true; |
| 306 | if (curobj->mtype.phys_info.flags & PF_USES_THRUST) |
| 307 | m_bUsesThrust = true; |
| 308 | if (curobj->mtype.phys_info.flags & PF_GRAVITY) |
| 309 | m_bGravity = true; |
| 310 | if (curobj->mtype.phys_info.flags & PF_IGNORE_OWN_CONC_FORCES) |
| 311 | m_bMagnetism = true; |
| 312 | if (curobj->mtype.phys_info.flags & PF_WIND) |
| 313 | m_bWind = true; |
| 314 | |
| 315 | CDialog::OnInitDialog(); |
| 316 | UpdateCheckBoxes(); |
| 317 | return TRUE; // return TRUE unless you set the focus to a control |
| 318 | // EXCEPTION: OCX Property Pages should return FALSE |
| 319 | } |
| 320 | |
| 321 | void CPropertyPhysicsDlg::Enable(UINT control) { |
| 322 | CWnd *box; |
| 323 | switch (control) { |
| 324 | case IDC_PTURNROLL: { |
| 325 | box = (CWnd *)GetDlgItem(IDC_PTURNROLLANGLE); |
| 326 | box->EnableWindow(true); |
| 327 | box = (CWnd *)GetDlgItem(IDC_PMAX_TURNROLL_RATE); |
| 328 | box->EnableWindow(true); |
| 329 | box = (CWnd *)GetDlgItem(IDC_PTURNROLL_RATIO); |
| 330 | box->EnableWindow(true); |
| 331 | break; |
| 332 | } |
| 333 | case IDC_PLEVELLING: |
| 334 | break; |
| 335 | case IDC_PBOUNCE: { |
| 336 | box = (CWnd *)GetDlgItem(IDC_PUNLIMBOUNCE); |
| 337 | box->EnableWindow(true); |
| 338 | if (!m_bUnlimitedBounce) { |
| 339 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 340 | box->EnableWindow(true); |
| 341 | } else { |
| 342 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 343 | box->EnableWindow(false); |
| 344 | } |
| 345 | box = (CWnd *)GetDlgItem(IDC_PSTICKS); |
| 346 | box->EnableWindow(false); |
| 347 | break; |
| 348 | } |
| 349 | case IDC_PWIGGLE: { |
| 350 | box = (CWnd *)GetDlgItem(IDC_PWIGGLE_AMPLITUDE); |
| 351 | box->EnableWindow(true); |
| 352 | box = (CWnd *)GetDlgItem(IDC_PWIGGLES_PER_SECOND); |
| 353 | box->EnableWindow(true); |
| 354 | break; |
| 355 | } |
| 356 | case IDC_PSTICKS: { |
| 357 | box = (CWnd *)GetDlgItem(IDC_PSTICKS); |
| 358 | box->EnableWindow(true); |
| 359 | box = (CWnd *)GetDlgItem(IDC_PBOUNCE); |
| 360 | box->EnableWindow(false); |
| 361 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 362 | box->EnableWindow(false); |
| 363 | box = (CWnd *)GetDlgItem(IDC_PUNLIMBOUNCE); |
| 364 | box->EnableWindow(false); |
| 365 | break; |
| 366 | } |
| 367 | case IDC_PPERSISTENT: |
| 368 | break; |
| 369 | case IDC_PUSESTHRUST: { |
| 370 | box = (CWnd *)GetDlgItem(IDC_PTHRUST_X); |
| 371 | box->EnableWindow(true); |
| 372 | box = (CWnd *)GetDlgItem(IDC_PTHRUST_Y); |
| 373 | box->EnableWindow(true); |
| 374 | box = (CWnd *)GetDlgItem(IDC_PTHRUST_Z); |
| 375 | box->EnableWindow(true); |
| 376 | box = (CWnd *)GetDlgItem(IDC_PROTTHRUST_X); |
| 377 | box->EnableWindow(true); |
| 378 | box = (CWnd *)GetDlgItem(IDC_PROTTHRUST_Y); |
| 379 | box->EnableWindow(true); |
| 380 | box = (CWnd *)GetDlgItem(IDC_PROTTHRUST_Z); |
| 381 | box->EnableWindow(true); |
| 382 | box = (CWnd *)GetDlgItem(IDC_PFULL_THRUST); |
| 383 | box->EnableWindow(true); |
| 384 | box = (CWnd *)GetDlgItem(IDC_PFULL_ROTTHRUST); |
| 385 | box->EnableWindow(true); |
| 386 | box = (CWnd *)GetDlgItem(IDC_PTURNROLL); |
| 387 | box->EnableWindow(true); |
| 388 | if (m_bTurnroll) { |
| 389 | box = (CWnd *)GetDlgItem(IDC_PTURNROLLANGLE); |
| 390 | box->EnableWindow(true); |
| 391 | box = (CWnd *)GetDlgItem(IDC_PMAX_TURNROLL_RATE); |
| 392 | box->EnableWindow(true); |
| 393 | box = (CWnd *)GetDlgItem(IDC_PTURNROLL_RATIO); |
| 394 | box->EnableWindow(true); |
| 395 | } |
| 396 | break; |
| 397 | } |
| 398 | case IDC_PGRAVITY: |
| 399 | break; |
| 400 | case IDC_PMAGNETISM: |
| 401 | break; |
| 402 | case IDC_PWIND: |
| 403 | break; |
| 404 | case IDC_PUNLIMBOUNCE: { |
| 405 | if (m_bUnlimitedBounce) { |
| 406 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 407 | box->EnableWindow(false); |
| 408 | } else { |
| 409 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 410 | box->EnableWindow(true); |
| 411 | } |
| 412 | break; |
| 413 | } |
| 414 | } |
| 415 | } |
| 416 | void CPropertyPhysicsDlg::Disable(UINT control) { |
| 417 | CWnd *box; |
| 418 | switch (control) { |
| 419 | case IDC_PTURNROLL: { |
| 420 | box = (CWnd *)GetDlgItem(IDC_PTURNROLLANGLE); |
| 421 | box->EnableWindow(false); |
| 422 | box = (CWnd *)GetDlgItem(IDC_PMAX_TURNROLL_RATE); |
| 423 | box->EnableWindow(false); |
| 424 | box = (CWnd *)GetDlgItem(IDC_PTURNROLL_RATIO); |
| 425 | box->EnableWindow(false); |
| 426 | break; |
| 427 | } |
| 428 | case IDC_PLEVELLING: |
| 429 | break; |
| 430 | case IDC_PBOUNCE: { |
| 431 | box = (CWnd *)GetDlgItem(IDC_PUNLIMBOUNCE); |
| 432 | box->EnableWindow(false); |
| 433 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 434 | box->EnableWindow(false); |
| 435 | box = (CWnd *)GetDlgItem(IDC_PSTICKS); |
| 436 | box->EnableWindow(true); |
| 437 | break; |
| 438 | } |
| 439 | case IDC_PWIGGLE: { |
| 440 | box = (CWnd *)GetDlgItem(IDC_PWIGGLE_AMPLITUDE); |
| 441 | box->EnableWindow(false); |
| 442 | box = (CWnd *)GetDlgItem(IDC_PWIGGLES_PER_SECOND); |
| 443 | box->EnableWindow(false); |
| 444 | break; |
| 445 | } |
| 446 | case IDC_PSTICKS: { |
| 447 | box = (CWnd *)GetDlgItem(IDC_PBOUNCE); |
| 448 | box->EnableWindow(true); |
| 449 | if (m_bBounce) { |
| 450 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 451 | box->EnableWindow(true); |
| 452 | } else { |
| 453 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 454 | box->EnableWindow(false); |
| 455 | } |
| 456 | break; |
| 457 | } |
| 458 | case IDC_PPERSISTENT: |
| 459 | break; |
| 460 | case IDC_PUSESTHRUST: { |
| 461 | box = (CWnd *)GetDlgItem(IDC_PTHRUST_X); |
| 462 | box->EnableWindow(false); |
| 463 | box = (CWnd *)GetDlgItem(IDC_PTHRUST_Y); |
| 464 | box->EnableWindow(false); |
| 465 | box = (CWnd *)GetDlgItem(IDC_PTHRUST_Z); |
| 466 | box->EnableWindow(false); |
| 467 | box = (CWnd *)GetDlgItem(IDC_PROTTHRUST_X); |
| 468 | box->EnableWindow(false); |
| 469 | box = (CWnd *)GetDlgItem(IDC_PROTTHRUST_Y); |
| 470 | box->EnableWindow(false); |
| 471 | box = (CWnd *)GetDlgItem(IDC_PROTTHRUST_Z); |
| 472 | box->EnableWindow(false); |
| 473 | box = (CWnd *)GetDlgItem(IDC_PFULL_THRUST); |
| 474 | box->EnableWindow(false); |
| 475 | box = (CWnd *)GetDlgItem(IDC_PFULL_ROTTHRUST); |
| 476 | box->EnableWindow(false); |
| 477 | box = (CWnd *)GetDlgItem(IDC_PTURNROLL); |
| 478 | box->EnableWindow(false); |
| 479 | box = (CWnd *)GetDlgItem(IDC_PTURNROLLANGLE); |
| 480 | box->EnableWindow(false); |
| 481 | box = (CWnd *)GetDlgItem(IDC_PMAX_TURNROLL_RATE); |
| 482 | box->EnableWindow(false); |
| 483 | box = (CWnd *)GetDlgItem(IDC_PTURNROLL_RATIO); |
| 484 | box->EnableWindow(false); |
| 485 | break; |
| 486 | } |
| 487 | case IDC_PGRAVITY: |
| 488 | break; |
| 489 | case IDC_PMAGNETISM: |
| 490 | break; |
| 491 | case IDC_PWIND: |
| 492 | break; |
| 493 | case IDC_PUNLIMBOUNCE: { |
| 494 | box = (CWnd *)GetDlgItem(IDC_PNUM_BOUNCES); |
| 495 | box->EnableWindow(true); |
| 496 | break; |
| 497 | } |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | void CPropertyPhysicsDlg::UpdateCheckBoxes() { |
| 502 | if (m_bTurnroll) |
| 503 | Enable(IDC_PTURNROLL); |
| 504 | else |
| 505 | Disable(IDC_PTURNROLL); |
| 506 | if (m_bLevelling) |
| 507 | Enable(IDC_PLEVELLING); |
| 508 | else |
| 509 | Disable(IDC_PLEVELLING); |
| 510 | if (m_bBounce) |
| 511 | Enable(IDC_PBOUNCE); |
| 512 | else |
| 513 | Disable(IDC_PBOUNCE); |
| 514 | if (m_bWiggle) |
| 515 | Enable(IDC_PWIGGLE); |
| 516 | else |
| 517 | Disable(IDC_PWIGGLE); |
| 518 | if (m_bSticks) |
| 519 | Enable(IDC_PSTICKS); |
| 520 | else |
| 521 | Disable(IDC_PSTICKS); |
| 522 | if (m_bPersistent) |
| 523 | Enable(IDC_PPERSISTENT); |
| 524 | else |
| 525 | Disable(IDC_PPERSISTENT); |
| 526 | if (m_bUsesThrust) |
| 527 | Enable(IDC_PUSESTHRUST); |
| 528 | else |
| 529 | Disable(IDC_PUSESTHRUST); |
| 530 | if (m_bGravity) |
| 531 | Enable(IDC_PGRAVITY); |
| 532 | else |
| 533 | Disable(IDC_PGRAVITY); |
| 534 | if (m_bMagnetism) |
| 535 | Enable(IDC_PMAGNETISM); |
| 536 | else |
| 537 | Disable(IDC_PMAGNETISM); |
| 538 | if (m_bWind) |
| 539 | Enable(IDC_PWIND); |
| 540 | else |
| 541 | Disable(IDC_PWIND); |
| 542 | if (m_bUnlimitedBounce) |
| 543 | Enable(IDC_PUNLIMBOUNCE); |
| 544 | else |
| 545 | Disable(IDC_PUNLIMBOUNCE); |
| 546 | } |
| 547 | |
| 548 | void CPropertyPhysicsDlg::OnPunlimbounce() { |
| 549 | // TODO: Add your control notification handler code here |
| 550 | if (m_bUnlimitedBounce) { |
| 551 | m_bUnlimitedBounce = false; |
| 552 | Disable(IDC_PUNLIMBOUNCE); |
| 553 | } else { |
| 554 | m_bUnlimitedBounce = true; |
| 555 | Enable(IDC_PUNLIMBOUNCE); |
| 556 | } |
| 557 | } |