------------------------------------------------------------------------------- Display the OpenFile dialog and let the user choose a new slybox as bg -------------------------------------------------------------------------------
| 501 | // Display the OpenFile dialog and let the user choose a new slybox as bg |
| 502 | //------------------------------------------------------------------------------- |
| 503 | void LoadSkybox() { |
| 504 | char szFileName[MAX_PATH]; |
| 505 | |
| 506 | DWORD dwTemp = MAX_PATH; |
| 507 | if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"SkyBoxSrc",nullptr,nullptr, |
| 508 | (BYTE*)szFileName,&dwTemp)) |
| 509 | { |
| 510 | // Key was not found. Use C: |
| 511 | strcpy(szFileName,""); |
| 512 | } |
| 513 | else |
| 514 | { |
| 515 | // need to remove the file name |
| 516 | char* sz = strrchr(szFileName,'\\'); |
| 517 | if (!sz) |
| 518 | sz = strrchr(szFileName,'/'); |
| 519 | if (sz) |
| 520 | *sz = 0; |
| 521 | } |
| 522 | OPENFILENAME sFilename1 = { |
| 523 | sizeof(OPENFILENAME), |
| 524 | g_hDlg,GetModuleHandle(nullptr), |
| 525 | "Skyboxes\0*.dds\0*.*\0", nullptr, 0, 1, |
| 526 | szFileName, MAX_PATH, nullptr, 0, nullptr, |
| 527 | "Open skybox as background", |
| 528 | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR, |
| 529 | 0, 1, ".dds", 0, nullptr, nullptr |
| 530 | }; |
| 531 | if(GetOpenFileName(&sFilename1) == 0) return; |
| 532 | |
| 533 | // Now store the file in the registry |
| 534 | RegSetValueExA(g_hRegistry,"SkyBoxSrc",0,REG_SZ,(const BYTE*)szFileName,MAX_PATH); |
| 535 | RegSetValueExA(g_hRegistry,"LastSkyBoxSrc",0,REG_SZ,(const BYTE*)szFileName,MAX_PATH); |
| 536 | RegSetValueExA(g_hRegistry,"LastTextureSrc",0,REG_SZ,(const BYTE*)"",MAX_PATH); |
| 537 | |
| 538 | CBackgroundPainter::Instance().SetCubeMapBG(szFileName); |
| 539 | return; |
| 540 | } |
| 541 | |
| 542 | template<class T> |
| 543 | inline |
no test coverage detected