| 490 | } |
| 491 | |
| 492 | void CProceduralDialog::OnImportPalette() { |
| 493 | CFILE *infile; |
| 494 | char filename[255]; |
| 495 | uint8_t r[256], g[256], b[256]; |
| 496 | int n = D3EditState.texdlg_texture; |
| 497 | |
| 498 | CString filter = "PCX files (*.pcx)|*.pcx||"; |
| 499 | |
| 500 | if (!OpenFileDialog(this, (LPCSTR)filter, filename, Current_bitmap_dir, sizeof(Current_bitmap_dir))) |
| 501 | return; |
| 502 | |
| 503 | if ((infile = cfopen(filename, "rb")) == NULL) { |
| 504 | OutrageMessageBox("Couldn't open that PCX file!"); |
| 505 | return; |
| 506 | } |
| 507 | |
| 508 | cfseek(infile, -768, SEEK_END); |
| 509 | for (int i = 0; i < 256; i++) { |
| 510 | r[i] = cf_ReadByte(infile); |
| 511 | g[i] = cf_ReadByte(infile); |
| 512 | b[i] = cf_ReadByte(infile); |
| 513 | } |
| 514 | |
| 515 | cfclose(infile); |
| 516 | |
| 517 | GeneratePaletteForProcedural(r, g, b, GameTextures[n].procedural->palette); |
| 518 | |
| 519 | UpdateDialog(); |
| 520 | } |
| 521 | |
| 522 | void CProceduralDialog::OnDefaultPalette() { |
| 523 | int n = D3EditState.texdlg_texture; |
nothing calls this directly
no test coverage detected