Changeset 445 for Daodan/src
- Timestamp:
- Jul 19, 2009, 1:03:44 PM (15 years ago)
- Location:
- Daodan/src
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Daodan.c
r439 r445 169 169 } 170 170 171 enum {s_unknown, s_options, s_patch, s_ language} ini_section;171 enum {s_unknown, s_options, s_patch, s_bsl, s_language} ini_section; 172 172 173 173 bool DDrIniCallback(char* section, bool newsection, char* name, char* value) … … 179 179 else if (!stricmp(section, "patch")) 180 180 ini_section = s_patch; 181 else if (!stricmp(section, "bsl")) 182 ini_section = s_bsl; 181 183 else if (!stricmp(section, "language")) 182 184 ini_section = s_language; … … 241 243 else 242 244 DDrStartupMessage("unrecognised patch \"%s\"", name); 245 break; 246 case s_bsl: 247 243 248 break; 244 249 case s_language: -
Daodan/src/Daodan_BSL.c
r444 r445 6 6 #include "Daodan_Utility.h" 7 7 #include "Daodan_Console.h" 8 #include "BFW_Script ingLanguage.h"8 #include "BFW_ScriptLang.h" 9 9 #include "Oni.h" 10 10 #include "Oni_Character.h" … … 13 13 uint16_t ONICALL bsl_int32mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 14 14 { 15 if (numargs < 2)16 return 1;17 15 ret->value_int32 = args[0].value_int32 * args[1].value_int32; 18 16 ret->type = sl_int32; … … 22 20 uint16_t ONICALL bsl_mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 23 21 { 24 if (numargs < 2)25 return 1;26 27 22 double val1; 28 23 double val2; … … 45 40 uint16_t ONICALL bsl_int32div(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 46 41 { 47 if (numargs < 2)48 return 1;49 42 ret->value_int32 = args[0].value_int32 / args[1].value_int32; 50 43 ret->type = sl_int32; … … 54 47 uint16_t ONICALL bsl_div(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 55 48 { 56 if (numargs < 2)57 return 1;58 59 49 double val1; 60 50 double val2; … … 77 67 uint16_t ONICALL bsl_int32rand(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 78 68 { 79 if (numargs < 2)80 return 1;81 82 69 int32_t start = 0; 83 70 int32_t end = 0; … … 127 114 if (numargs < 2) 128 115 return 1; 129 116 130 117 char output[255]; 131 118 int i; … … 141 128 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 142 129 { 130 DDrConsole_PrintF("%d", numargs); 131 132 if (numargs < 1 || args[0].type != sl_str32) 133 { 134 DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": parameter list does not match: format:string arg1 arg2 ...", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name); 135 return 0; 136 } 137 138 if (!args[0].value_str32) 139 args[0].value_str32 = ""; 140 143 141 int ffi_ret; 144 142 char* str = NULL; … … 174 172 175 173 if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, i, &ffi_type_sint32, ffi_args) != FFI_OK) 176 MessageBox(0, "", "", 0);174 return 1; 177 175 ffi_call(&cif, (void*)snprintf, (void*)&ffi_ret, values); 178 176 str = malloc(ffi_ret + 1); … … 198 196 SLrScript_Command_Register_ReturnType("chr_getdamage","Gets the amount of damage a character has caused", "[chrindex:int]", sl_int32, bsl_getdamage); 199 197 200 SLrScript_Command_Register_ReturnType("sprintf", "C-style sprintf.", " str1:format", sl_str32, bsl_sprintf);198 SLrScript_Command_Register_ReturnType("sprintf", "C-style sprintf.", "format:string arg1 arg2 ...", sl_str32, bsl_sprintf); 201 199 }
Note:
See TracChangeset
for help on using the changeset viewer.