| 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 | // GenericLightDialog.cpp : implementation file |
| 20 | // |
| 21 | |
| 22 | #include "stdafx.h" |
| 23 | #include "editor.h" |
| 24 | #include "GenericLightDialog.h" |
| 25 | #include "objinfo.h" |
| 26 | #include "object.h" |
| 27 | |
| 28 | #ifdef _DEBUG |
| 29 | #define new DEBUG_NEW |
| 30 | #undef THIS_FILE |
| 31 | static char THIS_FILE[] = __FILE__; |
| 32 | #endif |
| 33 | |
| 34 | ///////////////////////////////////////////////////////////////////////////// |
| 35 | // CGenericLightDialog dialog |
| 36 | |
| 37 | CGenericLightDialog::CGenericLightDialog(light_info *current, CWnd *pParent) |
| 38 | : CDialog(CGenericLightDialog::IDD, pParent) { |
| 39 | //{{AFX_DATA_INIT(CGenericLightDialog) |
| 40 | // NOTE: the ClassWizard will add member initialization here |
| 41 | //}}AFX_DATA_INIT |
| 42 | m_lightinfo = current; |
| 43 | } |
| 44 | |
| 45 | void CGenericLightDialog::DoDataExchange(CDataExchange *pDX) { |
| 46 | CDialog::DoDataExchange(pDX); |
| 47 | //{{AFX_DATA_MAP(CGenericLightDialog) |
| 48 | // NOTE: the ClassWizard will add DDX and DDV calls here |
| 49 | //}}AFX_DATA_MAP |
| 50 | } |
| 51 | |
| 52 | BEGIN_MESSAGE_MAP(CGenericLightDialog, CDialog) |
| 53 | //{{AFX_MSG_MAP(CGenericLightDialog) |
| 54 | ON_EN_KILLFOCUS(IDC_GENERIC_LIGHT_DISTANCE, OnKillfocusGenericLightDistance) |
| 55 | ON_EN_KILLFOCUS(IDC_GENERIC_BLUE_LIGHT, OnKillfocusGenericBlueLight) |
| 56 | ON_EN_KILLFOCUS(IDC_GENERIC_GREEN_LIGHT, OnKillfocusGenericGreenLight) |
| 57 | ON_EN_KILLFOCUS(IDC_GENERIC_RED_LIGHT, OnKillfocusGenericRedLight) |
| 58 | ON_EN_KILLFOCUS(IDC_GENERIC_PULSE_TIME, OnKillfocusGenericPulseTime) |
| 59 | ON_BN_CLICKED(IDC_FLICKER_RADIO, OnFlickerRadio) |
| 60 | ON_BN_CLICKED(IDC_USE_TIMEBITS_RADIO, OnUseTimebitsRadio) |
| 61 | ON_BN_CLICKED(IDC_PULSE, OnPulse) |
| 62 | ON_BN_CLICKED(IDC_ALWAYS_ON_RADIO, OnAlwaysOnRadio) |
| 63 | ON_BN_CLICKED(IDC_TIME_CHECK1, OnTimeCheck1) |
| 64 | ON_BN_CLICKED(IDC_TIME_CHECK2, OnTimeCheck2) |
| 65 | ON_BN_CLICKED(IDC_TIME_CHECK3, OnTimeCheck3) |
| 66 | ON_BN_CLICKED(IDC_TIME_CHECK4, OnTimeCheck4) |
| 67 | ON_BN_CLICKED(IDC_TIME_CHECK5, OnTimeCheck5) |
| 68 | ON_BN_CLICKED(IDC_TIME_CHECK6, OnTimeCheck6) |
| 69 | ON_BN_CLICKED(IDC_TIME_CHECK7, OnTimeCheck7) |
| 70 | ON_BN_CLICKED(IDC_TIME_CHECK8, OnTimeCheck8) |
| 71 | ON_BN_CLICKED(IDC_RENDER_STATIC, OnRenderStatic) |
| 72 | ON_BN_CLICKED(IDC_RENDER_GOURAUD, OnRenderGouraud) |
| 73 | ON_BN_CLICKED(IDC_RENDER_LIGHTMAPS, OnRenderLightmaps) |
| 74 | ON_BN_CLICKED(IDC_PULSE_TO_SECOND, OnPulseToSecond) |
| 75 | ON_EN_KILLFOCUS(IDC_GENERIC_RED_LIGHT2, OnKillfocusGenericRedLight2) |
| 76 | ON_EN_KILLFOCUS(IDC_GENERIC_GREEN_LIGHT2, OnKillfocusGenericGreenLight2) |
| 77 | ON_EN_KILLFOCUS(IDC_GENERIC_BLUE_LIGHT2, OnKillfocusGenericBlueLight2) |
| 78 | ON_BN_CLICKED(IDC_FLICKER_SLIGHTLY_CHECK, OnFlickerSlightlyCheck) |
| 79 | ON_EN_KILLFOCUS(IDC_FLICKER_SLIGHTLY_EDIT, OnKillfocusFlickerSlightlyEdit) |
| 80 | ON_BN_CLICKED(IDC_DIRECTIONAL, OnDirectional) |
| 81 | ON_EN_KILLFOCUS(IDC_FOV_EDIT, OnKillfocusFovEdit) |
| 82 | ON_BN_CLICKED(IDC_NO_SPECULAR_CHECK, OnNoSpecularCheck) |
| 83 | //}}AFX_MSG_MAP |
| 84 | END_MESSAGE_MAP() |
| 85 | |
| 86 | ///////////////////////////////////////////////////////////////////////////// |
| 87 | // CGenericLightDialog message handlers |
| 88 | |
| 89 | void CGenericLightDialog::OnKillfocusGenericLightDistance() { |
| 90 | char str[20]; |
| 91 | float val; |
| 92 | |
| 93 | ((CEdit *)GetDlgItem(IDC_GENERIC_LIGHT_DISTANCE))->GetWindowText(str, 20); |
| 94 | val = atof(str); |
| 95 | if (val < 0) |
| 96 | val = 0.0f; |
| 97 | if (val > 300) |
| 98 | val = 300.0f; |
| 99 | m_lightinfo->light_distance = val; |
| 100 | |
| 101 | UpdateDialog(); |
| 102 | } |
| 103 | |
| 104 | void CGenericLightDialog::OnKillfocusGenericBlueLight() { |
| 105 | char str[20]; |
| 106 | float val; |
| 107 | |
| 108 | ((CEdit *)GetDlgItem(IDC_GENERIC_BLUE_LIGHT))->GetWindowText(str, 20); |
| 109 | |
| 110 | val = atof(str); |
| 111 | if (val < 0) |
| 112 | val = 0.0f; |
| 113 | if (val > 1) |
| 114 | val = 1.0f; |
| 115 | m_lightinfo->blue_light1 = val; |
| 116 | UpdateDialog(); |
| 117 | } |
| 118 | |
| 119 | void CGenericLightDialog::OnKillfocusGenericGreenLight() { |
| 120 | char str[20]; |
| 121 | float val; |
| 122 | |
| 123 | ((CEdit *)GetDlgItem(IDC_GENERIC_GREEN_LIGHT))->GetWindowText(str, 20); |
| 124 | |
| 125 | val = atof(str); |
| 126 | if (val < 0) |
| 127 | val = 0.0f; |
| 128 | if (val > 1) |
| 129 | val = 1.0f; |
| 130 | m_lightinfo->green_light1 = val; |
| 131 | UpdateDialog(); |
| 132 | } |
| 133 | |
| 134 | void CGenericLightDialog::OnKillfocusGenericRedLight() { |
| 135 | char str[20]; |
| 136 | float val; |
| 137 | |
| 138 | ((CEdit *)GetDlgItem(IDC_GENERIC_RED_LIGHT))->GetWindowText(str, 20); |
| 139 | |
| 140 | val = atof(str); |
| 141 | if (val < 0) |
| 142 | val = 0.0f; |
| 143 | if (val > 1) |
| 144 | val = 1.0f; |
| 145 | m_lightinfo->red_light1 = val; |
| 146 | UpdateDialog(); |
| 147 | } |
| 148 | |
| 149 | void CGenericLightDialog::OnKillfocusGenericPulseTime() { |
| 150 | char str[20]; |
| 151 | float val; |
| 152 | |
| 153 | ((CEdit *)GetDlgItem(IDC_GENERIC_PULSE_TIME))->GetWindowText(str, 20); |
| 154 | |
| 155 | val = atof(str); |
| 156 | if (val < 0) |
| 157 | val = 0.0f; |
| 158 | if (val > 300) |
| 159 | val = 300.0f; |
| 160 | m_lightinfo->time_interval = val; |
| 161 | UpdateDialog(); |
| 162 | } |
| 163 | |
| 164 | void CGenericLightDialog::OnFlickerRadio() { |
| 165 | int c1 = IsDlgButtonChecked(IDC_FLICKER_RADIO); |
| 166 | if (c1) { |
| 167 | m_lightinfo->flags |= OLF_FLICKERING; |
| 168 | m_lightinfo->flags &= ~OLF_TIMEBITS; |
| 169 | } |
| 170 | UpdateDialog(); |
| 171 | } |
| 172 | |
| 173 | void CGenericLightDialog::OnUseTimebitsRadio() { |
| 174 | // TODO: Add your control notification handler code here |
| 175 | int c1 = IsDlgButtonChecked(IDC_USE_TIMEBITS_RADIO); |
| 176 | if (c1) { |
| 177 | m_lightinfo->flags |= OLF_TIMEBITS; |
| 178 | m_lightinfo->flags &= ~OLF_FLICKERING; |
| 179 | } |
| 180 | UpdateDialog(); |
| 181 | } |
| 182 | |
| 183 | void CGenericLightDialog::OnPulse() { |
| 184 | int c1 = IsDlgButtonChecked(IDC_PULSE); |
| 185 | if (c1) |
| 186 | m_lightinfo->flags |= OLF_PULSE; |
| 187 | else |
| 188 | m_lightinfo->flags &= ~OLF_PULSE; |
| 189 | |
| 190 | UpdateDialog(); |
| 191 | } |
| 192 | |
| 193 | void CGenericLightDialog::UpdateDialog() { |
| 194 | char txt[255]; |
| 195 | CButton *bbox; |
| 196 | |
| 197 | // Update light stuff |
| 198 | sprintf(txt, "%.2f", m_lightinfo->light_distance); |
| 199 | ((CEdit *)GetDlgItem(IDC_GENERIC_LIGHT_DISTANCE))->SetWindowText(txt); |
| 200 | |
| 201 | sprintf(txt, "%.2f", m_lightinfo->red_light1); |
| 202 | ((CEdit *)GetDlgItem(IDC_GENERIC_RED_LIGHT))->SetWindowText(txt); |
| 203 | |
| 204 | sprintf(txt, "%.2f", m_lightinfo->green_light1); |
| 205 | ((CEdit *)GetDlgItem(IDC_GENERIC_GREEN_LIGHT))->SetWindowText(txt); |
| 206 | |
| 207 | sprintf(txt, "%.2f", m_lightinfo->blue_light1); |
| 208 | ((CEdit *)GetDlgItem(IDC_GENERIC_BLUE_LIGHT))->SetWindowText(txt); |
| 209 | |
| 210 | sprintf(txt, "%.2f", m_lightinfo->red_light2); |
| 211 | ((CEdit *)GetDlgItem(IDC_GENERIC_RED_LIGHT2))->SetWindowText(txt); |
| 212 | |
| 213 | sprintf(txt, "%.2f", m_lightinfo->green_light2); |
| 214 | ((CEdit *)GetDlgItem(IDC_GENERIC_GREEN_LIGHT2))->SetWindowText(txt); |
| 215 | |
| 216 | sprintf(txt, "%.2f", m_lightinfo->blue_light2); |
| 217 | ((CEdit *)GetDlgItem(IDC_GENERIC_BLUE_LIGHT2))->SetWindowText(txt); |
| 218 | |
| 219 | sprintf(txt, "%.2f", m_lightinfo->flicker_distance); |
| 220 | ((CEdit *)GetDlgItem(IDC_FLICKER_SLIGHTLY_EDIT))->SetWindowText(txt); |
| 221 | |
| 222 | sprintf(txt, "%.3f", m_lightinfo->directional_dot); |
| 223 | ((CEdit *)GetDlgItem(IDC_FOV_EDIT))->SetWindowText(txt); |
| 224 | |
| 225 | bbox = (CButton *)GetDlgItem(IDC_FLICKER_RADIO); |
| 226 | bbox->SetCheck(m_lightinfo->flags & OLF_FLICKERING); |
| 227 | |
| 228 | bbox = (CButton *)GetDlgItem(IDC_DIRECTIONAL); |
| 229 | bbox->SetCheck(m_lightinfo->flags & OLF_DIRECTIONAL); |
| 230 | |
| 231 | bbox = (CButton *)GetDlgItem(IDC_NO_SPECULAR_CHECK); |
| 232 | bbox->SetCheck(m_lightinfo->flags & OLF_NO_SPECULARITY); |
| 233 | |
| 234 | bbox = (CButton *)GetDlgItem(IDC_USE_TIMEBITS_RADIO); |
| 235 | bbox->SetCheck(m_lightinfo->flags & OLF_TIMEBITS); |
| 236 | |
| 237 | bbox = (CButton *)GetDlgItem(IDC_ALWAYS_ON_RADIO); |
| 238 | if (!(m_lightinfo->flags & OLF_FLICKERING) && !(m_lightinfo->flags & OLF_TIMEBITS)) { |
| 239 | bbox->SetCheck(1); |
| 240 | } else { |
| 241 | bbox->SetCheck(0); |
| 242 | } |
| 243 | |
| 244 | bbox = (CButton *)GetDlgItem(IDC_PULSE); |
| 245 | bbox->SetCheck(m_lightinfo->flags & OLF_PULSE); |
| 246 | |
| 247 | bbox = (CButton *)GetDlgItem(IDC_PULSE_TO_SECOND); |
| 248 | bbox->SetCheck(m_lightinfo->flags & OLF_PULSE_TO_SECOND); |
| 249 | |
| 250 | bbox = (CButton *)GetDlgItem(IDC_FLICKER_SLIGHTLY_CHECK); |
| 251 | bbox->SetCheck(m_lightinfo->flags & OLF_FLICKER_SLIGHTLY); |
| 252 | |
| 253 | sprintf(txt, "%.2f", m_lightinfo->time_interval); |
| 254 | ((CEdit *)GetDlgItem(IDC_GENERIC_PULSE_TIME))->SetWindowText(txt); |
| 255 | |
| 256 | CheckDlgButton(IDC_TIME_CHECK1, (m_lightinfo->timebits & (1 << 0)) ? 1 : 0); |
| 257 | CheckDlgButton(IDC_TIME_CHECK2, (m_lightinfo->timebits & (1 << 1)) ? 1 : 0); |
| 258 | CheckDlgButton(IDC_TIME_CHECK3, (m_lightinfo->timebits & (1 << 2)) ? 1 : 0); |
| 259 | CheckDlgButton(IDC_TIME_CHECK4, (m_lightinfo->timebits & (1 << 3)) ? 1 : 0); |
| 260 | CheckDlgButton(IDC_TIME_CHECK5, (m_lightinfo->timebits & (1 << 4)) ? 1 : 0); |
| 261 | CheckDlgButton(IDC_TIME_CHECK6, (m_lightinfo->timebits & (1 << 5)) ? 1 : 0); |
| 262 | CheckDlgButton(IDC_TIME_CHECK7, (m_lightinfo->timebits & (1 << 6)) ? 1 : 0); |
| 263 | CheckDlgButton(IDC_TIME_CHECK8, (m_lightinfo->timebits & (1 << 7)) ? 1 : 0); |
| 264 | |
| 265 | CheckDlgButton(IDC_RENDER_STATIC, m_lightinfo->lighting_render_type == LRT_STATIC); |
| 266 | CheckDlgButton(IDC_RENDER_GOURAUD, m_lightinfo->lighting_render_type == LRT_GOURAUD); |
| 267 | CheckDlgButton(IDC_RENDER_LIGHTMAPS, m_lightinfo->lighting_render_type == LRT_LIGHTMAPS); |
| 268 | } |
| 269 | |
| 270 | void CGenericLightDialog::OnAlwaysOnRadio() { |
| 271 | // TODO: Add your control notification handler code here |
| 272 | int c1 = IsDlgButtonChecked(IDC_ALWAYS_ON_RADIO); |
| 273 | if (c1) { |
| 274 | m_lightinfo->flags &= ~OLF_FLICKERING; |
| 275 | m_lightinfo->flags &= ~OLF_TIMEBITS; |
| 276 | } |
| 277 | UpdateDialog(); |
| 278 | } |
| 279 | |
| 280 | BOOL CGenericLightDialog::OnInitDialog() { |
| 281 | CDialog::OnInitDialog(); |
| 282 | |
| 283 | UpdateDialog(); |
| 284 | |
| 285 | return TRUE; // return TRUE unless you set the focus to a control |
| 286 | // EXCEPTION: OCX Property Pages should return FALSE |
| 287 | } |
| 288 | |
| 289 | void CGenericLightDialog::OnTimeCheck1() { |
| 290 | int c1 = IsDlgButtonChecked(IDC_TIME_CHECK1); |
| 291 | if (c1) |
| 292 | m_lightinfo->timebits |= (1 << 0); |
| 293 | else |
| 294 | m_lightinfo->timebits &= ~(1 << 0); |
| 295 | |
| 296 | UpdateDialog(); |
| 297 | } |
| 298 | |
| 299 | void CGenericLightDialog::OnTimeCheck2() { |
| 300 | int c1 = IsDlgButtonChecked(IDC_TIME_CHECK2); |
| 301 | if (c1) |
| 302 | m_lightinfo->timebits |= (1 << 1); |
| 303 | else |
| 304 | m_lightinfo->timebits &= ~(1 << 1); |
| 305 | |
| 306 | UpdateDialog(); |
| 307 | } |
| 308 | |
| 309 | void CGenericLightDialog::OnTimeCheck3() { |
| 310 | int c1 = IsDlgButtonChecked(IDC_TIME_CHECK3); |
| 311 | if (c1) |
| 312 | m_lightinfo->timebits |= (1 << 2); |
| 313 | else |
| 314 | m_lightinfo->timebits &= ~(1 << 2); |
| 315 | |
| 316 | UpdateDialog(); |
| 317 | } |
| 318 | |
| 319 | void CGenericLightDialog::OnTimeCheck4() { |
| 320 | int c1 = IsDlgButtonChecked(IDC_TIME_CHECK4); |
| 321 | if (c1) |
| 322 | m_lightinfo->timebits |= (1 << 3); |
| 323 | else |
| 324 | m_lightinfo->timebits &= ~(1 << 3); |
| 325 | |
| 326 | UpdateDialog(); |
| 327 | } |
| 328 | |
| 329 | void CGenericLightDialog::OnTimeCheck5() { |
| 330 | int c1 = IsDlgButtonChecked(IDC_TIME_CHECK5); |
| 331 | if (c1) |
| 332 | m_lightinfo->timebits |= (1 << 4); |
| 333 | else |
| 334 | m_lightinfo->timebits &= ~(1 << 4); |
| 335 | |
| 336 | UpdateDialog(); |
| 337 | } |
| 338 | |
| 339 | void CGenericLightDialog::OnTimeCheck6() { |
| 340 | int c1 = IsDlgButtonChecked(IDC_TIME_CHECK6); |
| 341 | if (c1) |
| 342 | m_lightinfo->timebits |= (1 << 5); |
| 343 | else |
| 344 | m_lightinfo->timebits &= ~(1 << 5); |
| 345 | |
| 346 | UpdateDialog(); |
| 347 | } |
| 348 | |
| 349 | void CGenericLightDialog::OnTimeCheck7() { |
| 350 | int c1 = IsDlgButtonChecked(IDC_TIME_CHECK7); |
| 351 | if (c1) |
| 352 | m_lightinfo->timebits |= (1 << 6); |
| 353 | else |
| 354 | m_lightinfo->timebits &= ~(1 << 6); |
| 355 | |
| 356 | UpdateDialog(); |
| 357 | } |
| 358 | |
| 359 | void CGenericLightDialog::OnTimeCheck8() { |
| 360 | int c1 = IsDlgButtonChecked(IDC_TIME_CHECK8); |
| 361 | if (c1) |
| 362 | m_lightinfo->timebits |= (1 << 7); |
| 363 | else |
| 364 | m_lightinfo->timebits &= ~(1 << 7); |
| 365 | |
| 366 | UpdateDialog(); |
| 367 | } |
| 368 | |
| 369 | void CGenericLightDialog::OnRenderStatic() { |
| 370 | m_lightinfo->lighting_render_type = LRT_STATIC; |
| 371 | UpdateDialog(); |
| 372 | } |
| 373 | |
| 374 | void CGenericLightDialog::OnRenderGouraud() { |
| 375 | |
| 376 | m_lightinfo->lighting_render_type = LRT_GOURAUD; |
| 377 | UpdateDialog(); |
| 378 | } |
| 379 | |
| 380 | void CGenericLightDialog::OnRenderLightmaps() { |
| 381 | m_lightinfo->lighting_render_type = LRT_LIGHTMAPS; |
| 382 | UpdateDialog(); |
| 383 | } |
| 384 | |
| 385 | void CGenericLightDialog::OnPulseToSecond() { |
| 386 | int c1 = IsDlgButtonChecked(IDC_PULSE_TO_SECOND); |
| 387 | if (c1) |
| 388 | m_lightinfo->flags |= OLF_PULSE_TO_SECOND; |
| 389 | else |
| 390 | m_lightinfo->flags &= ~OLF_PULSE_TO_SECOND; |
| 391 | } |
| 392 | |
| 393 | void CGenericLightDialog::OnKillfocusGenericRedLight2() { |
| 394 | char str[20]; |
| 395 | float val; |
| 396 | |
| 397 | ((CEdit *)GetDlgItem(IDC_GENERIC_RED_LIGHT2))->GetWindowText(str, 20); |
| 398 | |
| 399 | val = atof(str); |
| 400 | if (val < 0) |
| 401 | val = 0.0f; |
| 402 | if (val > 1) |
| 403 | val = 1.0f; |
| 404 | m_lightinfo->red_light2 = val; |
| 405 | UpdateDialog(); |
| 406 | } |
| 407 | |
| 408 | void CGenericLightDialog::OnKillfocusGenericGreenLight2() { |
| 409 | char str[20]; |
| 410 | float val; |
| 411 | |
| 412 | ((CEdit *)GetDlgItem(IDC_GENERIC_GREEN_LIGHT2))->GetWindowText(str, 20); |
| 413 | |
| 414 | val = atof(str); |
| 415 | if (val < 0) |
| 416 | val = 0.0f; |
| 417 | if (val > 1) |
| 418 | val = 1.0f; |
| 419 | m_lightinfo->green_light2 = val; |
| 420 | UpdateDialog(); |
| 421 | } |
| 422 | |
| 423 | void CGenericLightDialog::OnKillfocusGenericBlueLight2() { |
| 424 | char str[20]; |
| 425 | float val; |
| 426 | |
| 427 | ((CEdit *)GetDlgItem(IDC_GENERIC_BLUE_LIGHT2))->GetWindowText(str, 20); |
| 428 | |
| 429 | val = atof(str); |
| 430 | if (val < 0) |
| 431 | val = 0.0f; |
| 432 | if (val > 1) |
| 433 | val = 1.0f; |
| 434 | m_lightinfo->blue_light2 = val; |
| 435 | UpdateDialog(); |
| 436 | } |
| 437 | |
| 438 | void CGenericLightDialog::OnFlickerSlightlyCheck() { |
| 439 | // TODO: Add your control notification handler code here |
| 440 | int c1 = IsDlgButtonChecked(IDC_FLICKER_SLIGHTLY_CHECK); |
| 441 | if (c1) |
| 442 | m_lightinfo->flags |= OLF_FLICKER_SLIGHTLY; |
| 443 | else |
| 444 | m_lightinfo->flags &= ~OLF_FLICKER_SLIGHTLY; |
| 445 | |
| 446 | UpdateDialog(); |
| 447 | } |
| 448 | |
| 449 | void CGenericLightDialog::OnKillfocusFlickerSlightlyEdit() { |
| 450 | char str[20]; |
| 451 | float val; |
| 452 | |
| 453 | ((CEdit *)GetDlgItem(IDC_FLICKER_SLIGHTLY_EDIT))->GetWindowText(str, 20); |
| 454 | |
| 455 | val = atof(str); |
| 456 | if (val < 0) |
| 457 | val = 0.0f; |
| 458 | if (val > 100) |
| 459 | val = 100.0f; |
| 460 | m_lightinfo->flicker_distance = val; |
| 461 | UpdateDialog(); |
| 462 | } |
| 463 | |
| 464 | void CGenericLightDialog::OnDirectional() { |
| 465 | int c1 = IsDlgButtonChecked(IDC_DIRECTIONAL); |
| 466 | if (c1) |
| 467 | m_lightinfo->flags |= OLF_DIRECTIONAL; |
| 468 | else |
| 469 | m_lightinfo->flags &= ~OLF_DIRECTIONAL; |
| 470 | |
| 471 | UpdateDialog(); |
| 472 | } |
| 473 | |
| 474 | void CGenericLightDialog::OnKillfocusFovEdit() { |
| 475 | char str[20]; |
| 476 | float val; |
| 477 | |
| 478 | ((CEdit *)GetDlgItem(IDC_FOV_EDIT))->GetWindowText(str, 20); |
| 479 | |
| 480 | val = atof(str); |
| 481 | if (val < 0) |
| 482 | val = 0.0f; |
| 483 | if (val > 1.0) |
| 484 | val = 1.0; |
| 485 | m_lightinfo->directional_dot = val; |
| 486 | UpdateDialog(); |
| 487 | } |
| 488 | |
| 489 | void CGenericLightDialog::OnNoSpecularCheck() { |
| 490 | int c1 = IsDlgButtonChecked(IDC_NO_SPECULAR_CHECK); |
| 491 | if (c1) |
| 492 | m_lightinfo->flags |= OLF_NO_SPECULARITY; |
| 493 | else |
| 494 | m_lightinfo->flags &= ~OLF_NO_SPECULARITY; |
| 495 | |
| 496 | UpdateDialog(); |
| 497 | } |