| 526 | } |
| 527 | |
| 528 | void CProceduralDialog::OnCopyProcedural() { |
| 529 | // get the name of the texture |
| 530 | CComboBox *combo; |
| 531 | CString str; |
| 532 | int src_id; |
| 533 | |
| 534 | combo = (CComboBox *)GetDlgItem(IDC_PROC_COPY_LIST); |
| 535 | combo->GetLBText(combo->GetCurSel(), str); |
| 536 | src_id = FindTextureName(str.GetBuffer(0)); |
| 537 | ASSERT(src_id != -1); |
| 538 | |
| 539 | bool do_pal = false; |
| 540 | char buffer[512]; |
| 541 | sprintf(buffer, "Are you sure you want to replace the procedural elements of %s with %s?", |
| 542 | GameTextures[D3EditState.texdlg_texture].name, GameTextures[src_id].name); |
| 543 | if (MessageBox(buffer, "Confirm", MB_YESNO) != IDYES) |
| 544 | return; |
| 545 | if (MessageBox("Would you like to replace the palette also?", "Palette", MB_YESNO) == IDYES) |
| 546 | do_pal = true; |
| 547 | |
| 548 | mngs_texture_page src_page, dest_page; |
| 549 | mng_AssignTextureToTexPage(src_id, &src_page); |
| 550 | mng_AssignTextureToTexPage(D3EditState.texdlg_texture, &dest_page); |
| 551 | |
| 552 | ClearAllProceduralsFromTexture(D3EditState.texdlg_texture); |
| 553 | FreeProceduralForTexture(D3EditState.texdlg_texture); |
| 554 | |
| 555 | int i; |
| 556 | if (src_page.tex_struct.flags & TF_WATER_PROCEDURAL) |
| 557 | dest_page.tex_struct.flags |= TF_WATER_PROCEDURAL; |
| 558 | else |
| 559 | dest_page.tex_struct.flags &= ~TF_WATER_PROCEDURAL; |
| 560 | |
| 561 | if (do_pal) { |
| 562 | for (i = 0; i < 255; i++) { |
| 563 | dest_page.proc_palette[i] = src_page.proc_palette[i]; |
| 564 | } |
| 565 | } |
| 566 | dest_page.proc_heat = src_page.proc_heat; |
| 567 | dest_page.proc_light = src_page.proc_light; |
| 568 | dest_page.proc_thickness = src_page.proc_thickness; |
| 569 | dest_page.proc_evaluation_time = src_page.proc_evaluation_time; |
| 570 | dest_page.osc_time = src_page.osc_time; |
| 571 | dest_page.osc_value = src_page.osc_value; |
| 572 | dest_page.num_proc_elements = src_page.num_proc_elements; |
| 573 | |
| 574 | for (i = 0; i < dest_page.num_proc_elements; i++) { |
| 575 | dest_page.proc_type[i] = src_page.proc_type[i]; |
| 576 | dest_page.proc_frequency[i] = src_page.proc_frequency[i]; |
| 577 | dest_page.proc_speed[i] = src_page.proc_speed[i]; |
| 578 | dest_page.proc_size[i] = src_page.proc_size[i]; |
| 579 | dest_page.proc_x1[i] = src_page.proc_x1[i]; |
| 580 | dest_page.proc_y1[i] = src_page.proc_y1[i]; |
| 581 | dest_page.proc_x2[i] = src_page.proc_x2[i]; |
| 582 | dest_page.proc_y2[i] = src_page.proc_y2[i]; |
| 583 | } |
| 584 | |
| 585 | AllocateProceduralForTexture(D3EditState.texdlg_texture); |
nothing calls this directly
no test coverage detected