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

Function ScriptCreateEmptyGameScript

editor/ScriptCompilerAPI.cpp:554–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554bool ScriptCreateEmptyGameScript(char *filename) {
555 char fullpath[_MAX_PATH];
556 ddio_MakePath(fullpath, LocalScriptDir, filename, NULL);
557 CurrentFile = cfopen(fullpath, "wt");
558 if (!CurrentFile)
559 return false;
560
561 O(("// %s", filename));
562 O(("// %s", VERSION));
563 O(("#include <stdio.h>"));
564 O(("#include <stdlib.h>"));
565 O(("#include <string.h>"));
566 O(("#include \"osiris_import.h\""));
567 O(("#include \"osiris_common.h\""));
568 O((""));
569
570 O(("#ifdef _MSC_VER //Visual C++ Build"));
571 O(("#define STDCALL __stdcall"));
572 O(("#define STDCALLPTR *STDCALL"));
573 O(("#else //Non-Visual C++ Build"));
574 O(("#define STDCALL __attribute__((stdcall))"));
575 O(("#define STDCALLPTR STDCALL*"));
576 O(("#endif"));
577 O((""));
578
579 O(("#ifdef __cplusplus"));
580 O(("extern \"C\"{"));
581 O(("#endif"));
582 O(("char STDCALL InitializeDLL(tOSIRISModuleInit *func_list);"));
583 O(("void STDCALL ShutdownDLL(void);"));
584 O(("int STDCALL GetGOScriptID(const char *name,uint8_t isdoor);"));
585 O(("void STDCALLPTR CreateInstance(int id);"));
586 O(("void STDCALL DestroyInstance(int id,void *ptr);"));
587 O(("int16_t STDCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data);"));
588 O(("int STDCALL SaveRestoreState( void *file_ptr, uint8_t saving_state );"));
589 O(("#ifdef __cplusplus"));
590 O(("}"));
591 O(("#endif"));
592 O((""));
593
594 O(("int String_table_size = 0;"));
595 O(("char **String_table = NULL;"));
596 O(("static char *_Error_string = \"!!ERROR MISSING STRING!!\";"));
597 O(("static char *_Empty_string = \"\";"));
598 O(("const char *GetStringFromTable(int index)"));
599 O(("{"));
600 O((" if( (index<0) || (index>=String_table_size) )"));
601 O((" return _Error_string;"));
602 O((" if(!String_table[index])"));
603 O((" return _Empty_string;"));
604 O((" return String_table[index];"));
605 O(("}"));
606 O(("#define TXT(x) GetStringFromTable(x)"));
607
608 O(("// InitializeDLL"));
609 O(("// Purpose:"));
610 O(("// This function gets called when the DLL first gets loaded. It will only be called once (until "
611 "the"));

Callers 1

ScriptCreateEmptyScriptFunction · 0.85

Calls 3

cfopenFunction · 0.85
cfcloseFunction · 0.85
ddio_MakePathFunction · 0.50

Tested by

no test coverage detected