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

Function InvokeScriptStudio

editor/ScriptStudio.cpp:644–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642}
643
644bool 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
689void CScriptStudio::OnExit() {
690 // TODO: Add your command handler code here

Callers 1

EditScriptMethod · 0.85

Calls 10

OutrageMessageBoxFunction · 0.85
LoadScriptFunction · 0.85
FreeScriptFunction · 0.85
SaveScriptFunction · 0.85
SelectTextMethod · 0.80
SetD3XObjectMethod · 0.80
GetLengthMethod · 0.80
SetTextMethod · 0.45
DoModalMethod · 0.45
GetTextMethod · 0.45

Tested by

no test coverage detected