| 642 | } |
| 643 | |
| 644 | bool InvokeScriptStudio(const char *filename, const char *scrname) { |
| 645 | #if 0 // LGT: D3XReallocProgram undefined |
| 646 | char *source; |
| 647 | CScriptStudio studio; |
| 648 | tD3XProgram *script; |
| 649 | bool ret = false; |
| 650 | |
| 651 | // initialize script studio. |
| 652 | script = D3XReallocProgram(NULL, 0, 0, 0); |
| 653 | if (!script) { |
| 654 | OutrageMessageBox("Failure to compile script! Something is wrong!"); |
| 655 | return false; |
| 656 | } |
| 657 | source = LoadScript(filename); |
| 658 | if (!source) { |
| 659 | OutrageMessageBox("Unable to find script for level. Something is wrong!"); |
| 660 | return false; |
| 661 | } |
| 662 | studio.SelectText(scrname); |
| 663 | studio.SetD3XObject(script); |
| 664 | studio.SetText(CString(source)); |
| 665 | FreeScript(source); |
| 666 | |
| 667 | if (studio.DoModal() == IDOK) { |
| 668 | CString tempstr; |
| 669 | studio.GetText(tempstr); |
| 670 | source = (char *) mem_malloc(tempstr.GetLength()+1); |
| 671 | strcpy(source, tempstr); |
| 672 | SaveScript(filename, source); |
| 673 | mem_free(source); |
| 674 | ret = true; |
| 675 | } |
| 676 | else { |
| 677 | OutrageMessageBox("The level script could not compile and is invalid until corrected."); |
| 678 | ret = false; |
| 679 | } |
| 680 | |
| 681 | D3XFreeProgram(script); |
| 682 | |
| 683 | return ret; |
| 684 | #else |
| 685 | return false; |
| 686 | #endif |
| 687 | } |
| 688 | |
| 689 | void CScriptStudio::OnExit() { |
| 690 | // TODO: Add your command handler code here |
no test coverage detected