| 1372 | } |
| 1373 | |
| 1374 | void CWorldWeaponsDialog::OnLoadWeaponDischarge() { |
| 1375 | char filename[255]; |
| 1376 | int bm_handle; |
| 1377 | int model = 0; |
| 1378 | int anim = 0; |
| 1379 | |
| 1380 | CString filter = |
| 1381 | "Descent III files " |
| 1382 | "(*.oaf,*.ifl,*.tga,*.bbm,*.lbm,*.ogf,*.pcx,*.pof,*.oof)|*.pcx;*.tga;*.bbm;*.lbm;*.ogf;*.pof;*.oof;*.oaf;*.ifl||"; |
| 1383 | |
| 1384 | if (!OpenFileDialog(this, (LPCSTR)filter, filename, Current_weapon_dir, sizeof(Current_weapon_dir))) |
| 1385 | return; |
| 1386 | |
| 1387 | // Okay, we selected a file. Lets do what needs to be done here. |
| 1388 | bm_handle = LoadWeaponFireImage(filename, &model, &anim, 0); |
| 1389 | |
| 1390 | if (bm_handle < 0) { |
| 1391 | OutrageMessageBox("Could not load that image...restoring previous image."); |
| 1392 | return; |
| 1393 | } |
| 1394 | int n = D3EditState.current_weapon; |
| 1395 | |
| 1396 | Weapons[n].fire_image_handle = bm_handle; |
| 1397 | |
| 1398 | if (!model) { |
| 1399 | if (anim) { |
| 1400 | Weapons[n].flags |= WF_IMAGE_VCLIP; |
| 1401 | Weapons[n].flags &= ~WF_IMAGE_BITMAP; |
| 1402 | } else { |
| 1403 | Weapons[n].flags |= WF_IMAGE_BITMAP; |
| 1404 | Weapons[n].flags &= ~WF_IMAGE_VCLIP; |
| 1405 | } |
| 1406 | } else { |
| 1407 | Weapons[n].flags &= ~WF_IMAGE_BITMAP; |
| 1408 | Weapons[n].flags &= ~WF_IMAGE_VCLIP; |
| 1409 | Weapons[n].flags &= ~WF_ELECTRICAL; |
| 1410 | } |
| 1411 | |
| 1412 | mprintf(0, "Making a copy of this bitmap/model locally...\n"); |
| 1413 | |
| 1414 | if (!model) { |
| 1415 | if (!anim) { |
| 1416 | sprintf(filename, "%s\\%s", LocalManageGraphicsDir.u8string().c_str(), |
| 1417 | GameBitmaps[Weapons[n].fire_image_handle].name); |
| 1418 | bm_SaveFileBitmap(filename, Weapons[n].fire_image_handle); |
| 1419 | } else { |
| 1420 | sprintf(filename, "%s\\%s", LocalManageGraphicsDir.u8string().c_str(), |
| 1421 | GameVClips[Weapons[n].fire_image_handle].name); |
| 1422 | SaveVClip(filename, Weapons[n].fire_image_handle); |
| 1423 | } |
| 1424 | } else { |
| 1425 | std::filesystem::path destname = LocalModelsDir / Poly_models[Weapons[n].fire_image_handle].name; |
| 1426 | cf_CopyFile(destname, filename); |
| 1427 | } |
| 1428 | |
| 1429 | UpdateDialog(); |
| 1430 | } |
| 1431 |
nothing calls this directly
no test coverage detected