| 348 | } |
| 349 | |
| 350 | bool ScriptCreateEmptyLevelScript(char *filename) { |
| 351 | char fullpath[_MAX_PATH]; |
| 352 | ddio_MakePath(fullpath, LocalScriptDir, filename, NULL); |
| 353 | CurrentFile = cfopen(fullpath, "wt"); |
| 354 | if (!CurrentFile) |
| 355 | return false; |
| 356 | |
| 357 | O(("// %s", filename)); |
| 358 | O(("// %s", VERSION)); |
| 359 | O(("#include <stdio.h>")); |
| 360 | O(("#include <stdlib.h>")); |
| 361 | O(("#include <string.h>")); |
| 362 | O(("#include \"osiris_import.h\"")); |
| 363 | O(("#include \"osiris_common.h\"")); |
| 364 | O(("")); |
| 365 | |
| 366 | O(("#ifdef _MSC_VER //Visual C++ Build")); |
| 367 | O(("#define STDCALL __stdcall")); |
| 368 | O(("#define STDCALLPTR *STDCALL")); |
| 369 | O(("#else //Non-Visual C++ Build")); |
| 370 | O(("#define STDCALL __attribute__((stdcall))")); |
| 371 | O(("#define STDCALLPTR STDCALL*")); |
| 372 | O(("#endif")); |
| 373 | O(("")); |
| 374 | |
| 375 | O(("#ifdef __cplusplus")); |
| 376 | O(("extern \"C\"{")); |
| 377 | O(("#endif")); |
| 378 | O(("char STDCALL InitializeDLL(tOSIRISModuleInit *func_list);")); |
| 379 | O(("void STDCALL ShutdownDLL(void);")); |
| 380 | O(("int STDCALL GetGOScriptID(const char *name,uint8_t is_door);")); |
| 381 | O(("void STDCALLPTR CreateInstance(int id);")); |
| 382 | O(("void STDCALL DestroyInstance(int id,void *ptr);")); |
| 383 | O(("int16_t STDCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data);")); |
| 384 | O(("int STDCALL GetTriggerScriptID(int trigger_room, int trigger_face );")); |
| 385 | O(("int STDCALL GetCOScriptList( int **list, int **id_list );")); |
| 386 | O(("int STDCALL SaveRestoreState( void *file_ptr, uint8_t saving_state );")); |
| 387 | O(("#ifdef __cplusplus")); |
| 388 | O(("}")); |
| 389 | O(("#endif")); |
| 390 | O(("")); |
| 391 | |
| 392 | O(("int String_table_size = 0;")); |
| 393 | O(("char **String_table = NULL;")); |
| 394 | O(("static const char *_Error_string = \"!!ERROR MISSING STRING!!\";")); |
| 395 | O(("static const char *_Empty_string = \"\";")); |
| 396 | O(("const char *GetStringFromTable(int index)")); |
| 397 | O(("{")); |
| 398 | O((" if( (index<0) || (index>=String_table_size) )")); |
| 399 | O((" return _Error_string;")); |
| 400 | O((" if(!String_table[index])")); |
| 401 | O((" return _Empty_string;")); |
| 402 | O((" return String_table[index];")); |
| 403 | O(("}")); |
| 404 | O(("#define TXT(x) GetStringFromTable(x)")); |
| 405 | |
| 406 | O(("// InitializeDLL")); |
| 407 | O(("// Purpose:")); |
no test coverage detected