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

Method OnCopyProcedural

editor/WaterProceduralDialog.cpp:488–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488void CWaterProceduralDialog::OnCopyProcedural() {
489 // get the name of the texture
490 CComboBox *combo;
491 CString str;
492 int src_id;
493
494 combo = (CComboBox *)GetDlgItem(IDC_PROC_COPY_LIST);
495 combo->GetLBText(combo->GetCurSel(), str);
496 src_id = FindTextureName(str.GetBuffer(0));
497 ASSERT(src_id != -1);
498
499 bool do_pal = false;
500 char buffer[512];
501 sprintf(buffer, "Are you sure you want to replace the procedural elements of %s with %s?",
502 GameTextures[D3EditState.texdlg_texture].name, GameTextures[src_id].name);
503 if (MessageBox(buffer, "Confirm", MB_YESNO) != IDYES)
504 return;
505 if (MessageBox("Would you like to replace the palette also?", "Palette", MB_YESNO) == IDYES)
506 do_pal = true;
507
508 mngs_texture_page src_page, dest_page;
509 mng_AssignTextureToTexPage(src_id, &src_page);
510 mng_AssignTextureToTexPage(D3EditState.texdlg_texture, &dest_page);
511
512 ClearAllProceduralsFromTexture(D3EditState.texdlg_texture);
513 FreeProceduralForTexture(D3EditState.texdlg_texture);
514
515 int i;
516 if (src_page.tex_struct.flags & TF_WATER_PROCEDURAL)
517 dest_page.tex_struct.flags |= TF_WATER_PROCEDURAL;
518 else
519 dest_page.tex_struct.flags &= ~TF_WATER_PROCEDURAL;
520
521 if (do_pal) {
522 for (i = 0; i < 255; i++) {
523 dest_page.proc_palette[i] = src_page.proc_palette[i];
524 }
525 }
526 dest_page.proc_heat = src_page.proc_heat;
527 dest_page.proc_light = src_page.proc_light;
528 dest_page.proc_thickness = src_page.proc_thickness;
529 dest_page.proc_evaluation_time = src_page.proc_evaluation_time;
530 dest_page.osc_time = src_page.osc_time;
531 dest_page.osc_value = src_page.osc_value;
532 dest_page.num_proc_elements = src_page.num_proc_elements;
533
534 for (i = 0; i < dest_page.num_proc_elements; i++) {
535 dest_page.proc_type[i] = src_page.proc_type[i];
536 dest_page.proc_frequency[i] = src_page.proc_frequency[i];
537 dest_page.proc_speed[i] = src_page.proc_speed[i];
538 dest_page.proc_size[i] = src_page.proc_size[i];
539 dest_page.proc_x1[i] = src_page.proc_x1[i];
540 dest_page.proc_y1[i] = src_page.proc_y1[i];
541 dest_page.proc_x2[i] = src_page.proc_x2[i];
542 dest_page.proc_y2[i] = src_page.proc_y2[i];
543 }
544
545 AllocateProceduralForTexture(D3EditState.texdlg_texture);

Callers

nothing calls this directly

Calls 7

FindTextureNameFunction · 0.85
FreeProceduralForTextureFunction · 0.85
GetBufferMethod · 0.80

Tested by

no test coverage detected