MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnImportPalette

Method OnImportPalette

editor/ProceduralDialog.cpp:492–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490}
491
492void 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
522void CProceduralDialog::OnDefaultPalette() {
523 int n = D3EditState.texdlg_texture;

Callers

nothing calls this directly

Calls 7

OpenFileDialogFunction · 0.85
cfopenFunction · 0.85
OutrageMessageBoxFunction · 0.85
cfseekFunction · 0.85
cf_ReadByteFunction · 0.85
cfcloseFunction · 0.85

Tested by

no test coverage detected