- Timestamp:
- Jul 17, 2009, 11:44:17 AM (15 years ago)
- Location:
- Daodan
- Files:
-
- 57 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/build.bat
r439 r440 1 gcc -O3 -s -Wall -shared -fomit-frame-pointer - o build\binkw32.dll src\Oni_Symbols.S src\Daodan.c src\Daodan_DLLStubs.c src\Daodan_Patch.c src\Daodan_Utility.c src\Daodan_Win32.c src\Daodan_Cheater.c src\Daodan_Persistence.c src\Daodan_WindowHack.c src\daodan_gl.c src\Daodan_Character.c src\Daodan_Console.c src\Daodan_BSL.c src\inifile_reader.c -lgdi321 gcc -O3 -s -Wall -shared -fomit-frame-pointer -DDSFMT_MEXP=19937 -o build\binkw32.dll src\Oni_Symbols.S src\Daodan.c src\Daodan_DLLStubs.c src\Daodan_Patch.c src\Daodan_Utility.c src\Daodan_Win32.c src\Daodan_Cheater.c src\Daodan_Persistence.c src\Daodan_WindowHack.c src\daodan_gl.c src\Daodan_Character.c src\Daodan_Console.c src\Daodan_BSL.c src\inifile_reader.c src\dSFMT\dSFMT.c -lgdi32 -
Daodan/src/BFW_ScriptingLanguage.h
r439 r440 19 19 sl_type type; 20 20 union { 21 void* 22 uint32_t value_int32;23 char* 24 float 25 bool 21 void* value; 22 int32_t value_int32; 23 char* value_str32; 24 float value_float; 25 bool value_bool; 26 26 }; 27 27 } sl_arg; … … 31 31 uint16_t ONICALL SLrScript_Command_Register_ReturnType(char* name, char* desc, char* argfmt, sl_type type, sl_func callback); 32 32 uint16_t ONICALL SLrScript_Command_Register_Void(char* name, char* desc, char* argfmt, sl_func callback); 33 uint16_t ONICALL SLrGlobalVariable_Register_Int32(char* name, char* desc, uint32_t* data);33 uint16_t ONICALL SLrGlobalVariable_Register_Int32(char* name, char* desc, int32_t* data); 34 34 uint16_t ONICALL SLrGlobalVariable_Register_Float(char* name, char* desc, float* data); 35 35 uint16_t ONICALL SLrGlobalVariable_Register_Bool(char* name, char* desc, uint32_t* data); -
Daodan/src/Daodan_BSL.c
r439 r440 1 #include <time.h> 2 1 3 #include "Daodan_BSL.h" 2 4 #include "BFW_ScriptingLanguage.h" 5 6 #include "dSFMT\dSFMT.h" 3 7 4 8 uint16_t ONICALL bsl_int32mul(void* dontuse0, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) … … 66 70 } 67 71 72 uint16_t ONICALL bsl_int32rand(void* dontuse0, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 73 { 74 if (numargs < 2) 75 return 1; 76 77 int32_t start = 0; 78 int32_t end = 0; 79 80 if (args[0].value_int32 == args[1].value_int32) 81 return 1; 82 else if (args[0].value_int32 > args[1].value_int32) 83 { 84 start = args[1].value_int32; 85 end = args[0].value_int32; 86 } 87 else 88 { 89 start = args[0].value_int32; 90 end = args[1].value_int32; 91 } 92 93 ret->value_int32 = start + (dsfmt_gv_genrand_uint32() % (uint32_t)(end - start + 1)); 94 ret->type = sl_int32; 95 return 0; 96 } 97 68 98 void SLrDaodan_Initalize() 69 99 { … … 73 103 SLrScript_Command_Register_ReturnType("int32div", "Divides two numbers", "n1:int n2:int", sl_int32, bsl_int32div); 74 104 SLrScript_Command_Register_ReturnType("div", "Divides two numbers", "[int1:int|float1:float] [int2:int|float2:float]", sl_float, bsl_div); 105 106 dsfmt_gv_init_gen_rand((uint32_t)time(NULL)); 107 SLrScript_Command_Register_ReturnType("int32rand", "Returns a pseudo-random number between two numbers (inclusive).", "start:int end:int", sl_int32, bsl_int32rand); 75 108 }
Note:
See TracChangeset
for help on using the changeset viewer.