Changeset 688
- Timestamp:
- Mar 4, 2013, 3:21:23 PM (12 years ago)
- Location:
- Daodan
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/makefile
r687 r688 8 8 endif 9 9 10 GCCFLAGS = - O0 -Wall -fomit-frame-pointer -fpack-struct10 GCCFLAGS = -std=c99 -O0 -Wall -fomit-frame-pointer -fpack-struct -pedantic -Wextra -Wno-unused-variable 11 11 LINKFLAGS = -O0 -Wall -fomit-frame-pointer -fpack-struct -s -mdll 12 LOCALE = LC_MESSAGES=C 12 13 13 14 #LIBS = -lwinmm -lopengl32 -lgdi32 … … 16 17 OUT = build/binkw32.dll 17 18 18 SRC = src/Daodan.c src/Daodan_BSL.c src/Daodan_Character.c src/Daodan_Cheater.c src/Daodan_Console.c src/daodan_gl.c src/Daodan_Patch.c src/Daodan_Persistence.c src/Daodan_Utility.c src/Daodan_Win32.c src/Daodan_WindowHack.c src/inifile_reader.c src/ Oni_Symbols.c src/_DLLInfo.rc19 SRC = src/Daodan.c src/Daodan_BSL.c src/Daodan_Character.c src/Daodan_Cheater.c src/Daodan_Console.c src/daodan_gl.c src/Daodan_Patch.c src/Daodan_Persistence.c src/Daodan_Utility.c src/Daodan_Win32.c src/Daodan_WindowHack.c src/inifile_reader.c src/_DLLInfo.rc 19 20 DEST = $(patsubst src/%.rc,build/%.o,$(patsubst src/%.c,build/%.o,$(SRC))) 20 21 21 22 ALL: $(DEST) $(OBJS) 22 23 echo "Linking $<" 23 $( GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBS)24 $(LOCALE) $(GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBS) 24 25 25 26 clean: … … 29 30 build/%.o: src/%.c 30 31 echo "Compiling $<" 31 $( GCC) $(GCCFLAGS) -c -o $@ $<32 $(LOCALE) $(GCC) $(GCCFLAGS) -c -o $@ $< 32 33 echo 33 34 … … 35 36 echo "Assembling resource $<" 36 37 $(WINDRES) -i $< -o $@ 38 echo 37 39 -
Daodan/src/BFW_ScriptLang.h
r677 r688 24 24 float value_float; 25 25 bool value_bool; 26 } ;26 } val; 27 27 } sl_arg; 28 28 -
Daodan/src/Daodan_BSL.c
r681 r688 19 19 uint16_t ONICALL bsl_int32mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 20 20 { 21 ret->val ue_int32 = args[0].value_int32 * args[1].value_int32;21 ret->val.value_int32 = args[0].val.value_int32 * args[1].val.value_int32; 22 22 ret->type = sl_int32; 23 23 return 0; … … 30 30 31 31 if (args[0].type == sl_int32) 32 val1 = args[0].val ue_int32;32 val1 = args[0].val.value_int32; 33 33 else 34 val1 = args[0].val ue_float;34 val1 = args[0].val.value_float; 35 35 36 36 if (args[1].type == sl_int32) 37 val2 = args[1].val ue_int32;37 val2 = args[1].val.value_int32; 38 38 else 39 val2 = args[1].val ue_float;40 41 ret->val ue_float = (float)(val1 * val2);39 val2 = args[1].val.value_float; 40 41 ret->val.value_float = (float)(val1 * val2); 42 42 ret->type = sl_float; 43 43 return 0; … … 46 46 uint16_t ONICALL bsl_int32div(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 47 47 { 48 ret->val ue_int32 = args[0].value_int32 / args[1].value_int32;48 ret->val.value_int32 = args[0].val.value_int32 / args[1].val.value_int32; 49 49 ret->type = sl_int32; 50 50 return 0; … … 56 56 57 57 if (args[0].type == sl_int32) 58 val1 = args[0].val ue_int32;58 val1 = args[0].val.value_int32; 59 59 else 60 val1 = args[0].val ue_float;60 val1 = args[0].val.value_float; 61 61 62 62 if (args[1].type == sl_int32) 63 val2 = args[1].val ue_int32;63 val2 = args[1].val.value_int32; 64 64 else 65 val2 = args[1].val ue_float;66 67 ret->val ue_float = (float)(val1 / val2);65 val2 = args[1].val.value_float; 66 67 ret->val.value_float = (float)(val1 / val2); 68 68 ret->type = sl_float; 69 69 return 0; … … 75 75 int32_t end = 0; 76 76 77 if (args[0].val ue_int32 == args[1].value_int32)77 if (args[0].val.value_int32 == args[1].val.value_int32) 78 78 return 1; 79 else if (args[0].val ue_int32 > args[1].value_int32)80 { 81 start = args[1].val ue_int32;82 end = args[0].val ue_int32;79 else if (args[0].val.value_int32 > args[1].val.value_int32) 80 { 81 start = args[1].val.value_int32; 82 end = args[0].val.value_int32; 83 83 } 84 84 else 85 85 { 86 start = args[0].val ue_int32;87 end = args[1].val ue_int32;88 } 89 90 ret->val ue_int32 = start + (rand() % (uint32_t)(end - start + 1));86 start = args[0].val.value_int32; 87 end = args[1].val.value_int32; 88 } 89 90 ret->val.value_int32 = start + (rand() % (uint32_t)(end - start + 1)); 91 91 ret->type = sl_int32; 92 92 return 0; … … 97 97 int index; 98 98 if (numargs == 0) index = 0; 99 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);100 else index = args[0].val ue_int32;99 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 100 else index = args[0].val.value_int32; 101 101 //killcount = ONgGameState->CharacterStorage[index].Kills; 102 102 //ONgGameState + index * 0x16A0 + 0x1260 + 0x1670; 103 ret->val ue_int32 = ONgGameState->CharacterStorage[index].Kills;103 ret->val.value_int32 = ONgGameState->CharacterStorage[index].Kills; 104 104 ret->type = sl_int32; 105 105 return 0; … … 110 110 int index; 111 111 if (numargs == 0) index = 0; 112 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);113 else index = args[0].val ue_int32;114 ret->val ue_int32 = ONgGameState->CharacterStorage[index].Damage;112 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 113 else index = args[0].val.value_int32; 114 ret->val.value_int32 = ONgGameState->CharacterStorage[index].Damage; 115 115 ret->type = sl_int32; 116 116 return 0; … … 127 127 128 128 if (numargs < 2 || args[1].type != sl_str32) return 1; 129 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);130 else index = args[0].val ue_int32;131 132 133 134 if(!strcmp(args[1].val ue_str32,"ammo"))129 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 130 else index = args[0].val.value_int32; 131 132 133 134 if(!strcmp(args[1].val.value_str32,"ammo")) 135 135 { 136 136 returnval = &(Chr[index].Inventory.AmmoUsed); 137 137 } 138 else if(!strcmp(args[1].val ue_str32,"hypo"))138 else if(!strcmp(args[1].val.value_str32,"hypo")) 139 139 { 140 140 returnval = &(Chr[index].Inventory.HypoUsed); 141 141 } 142 else if(!strcmp(args[1].val ue_str32,"cells"))142 else if(!strcmp(args[1].val.value_str32,"cells")) 143 143 { 144 144 returnval = &(Chr[index].Inventory.CellsUsed); 145 145 } 146 else if(!strcmp(args[1].val ue_str32,"invis"))146 else if(!strcmp(args[1].val.value_str32,"invis")) 147 147 { 148 148 returnval = &(Chr[index].Inventory.CloakUsed); 149 149 } 150 else if(!strcmp(args[1].val ue_str32,"shield"))150 else if(!strcmp(args[1].val.value_str32,"shield")) 151 151 { 152 152 returnval = &(Chr[index].Inventory.ShieldUsed); 153 153 } 154 else if(!strcmp(args[1].val ue_str32,"lsi"))154 else if(!strcmp(args[1].val.value_str32,"lsi")) 155 155 { 156 156 returnval = &(Chr[index].Inventory.hasLSI); … … 170 170 //todo, add setting 171 171 172 if(is_lsi) ret->val ue_int32 = (int)*(bool*)returnval;173 else ret->val ue_int32 = *(int*)returnval;172 if(is_lsi) ret->val.value_int32 = (int)*(bool*)returnval; 173 else ret->val.value_int32 = *(int*)returnval; 174 174 ret->type = sl_int32; 175 175 176 176 if (numargs >= 3) 177 177 { 178 if(is_lsi) *(bool*)returnval = args[2].val ue_int32;179 else *(int*)returnval = args[2].val ue_int32;178 if(is_lsi) *(bool*)returnval = args[2].val.value_int32; 179 else *(int*)returnval = args[2].val.value_int32; 180 180 } 181 181 … … 190 190 int* health; 191 191 if (numargs == 0) index = 0; 192 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);193 else index = args[0].val ue_int32;192 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 193 else index = args[0].val.value_int32; 194 194 Chr = ONgGameState->CharacterStorage; 195 195 health = &Chr[index].Health; 196 196 197 ret->val ue_int32 = *health;198 ret->type = sl_int32; 199 200 if (args[1].val ue_int32) {201 *health = args[1].val ue_int32;202 } 203 ret->val ue_int32 = *health;197 ret->val.value_int32 = *health; 198 ret->type = sl_int32; 199 200 if (args[1].val.value_int32) { 201 *health = args[1].val.value_int32; 202 } 203 ret->val.value_int32 = *health; 204 204 ret->type = sl_int32; 205 205 return 0; … … 211 211 Character* Chr; 212 212 if (numargs == 0) index = 0; 213 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);214 else index = args[0].val ue_int32;213 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 214 else index = args[0].val.value_int32; 215 215 Chr = ONgGameState->CharacterStorage ; 216 216 … … 227 227 DDrConsole_PrintF("NoPath %s", Chr[index].ScriptNoPath); 228 228 */ 229 ret->val ue_int32 = Chr[index].RegenHax;229 ret->val.value_int32 = Chr[index].RegenHax; 230 230 ret->type = sl_int32; 231 231 232 232 if (numargs >= 2) { 233 Chr[index].RegenHax = args[1].val ue_int32;233 Chr[index].RegenHax = args[1].val.value_int32; 234 234 } 235 235 return 0; … … 246 246 if (numargs < 2) return 1; 247 247 248 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);249 else index = args[0].val ue_int32;250 if (index == -1) index = args[0].val ue_int32;251 252 if (args[1].type == sl_str32) index2 = DDrGetCharacterIndexFromName(args[1].val ue_str32);253 else index2 = args[1].val ue_int32;254 if (index2 == -1) index2 = args[1].val ue_int32;248 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 249 else index = args[0].val.value_int32; 250 if (index == -1) index = args[0].val.value_int32; 251 252 if (args[1].type == sl_str32) index2 = DDrGetCharacterIndexFromName(args[1].val.value_str32); 253 else index2 = args[1].val.value_int32; 254 if (index2 == -1) index2 = args[1].val.value_int32; 255 255 Char1 = &Chr[index]; 256 256 Char2 = &Chr[index2]; 257 257 258 258 259 ret->val ue_float = sqrt( pow((Char1->Location.X - Char2->Location.X), 2) + pow((Char1->Location.Y - Char2->Location.Y), 2) + pow((Char1->Location.Z - Char2->Location.Z),2));259 ret->val.value_float = sqrt( pow((Char1->Location.X - Char2->Location.X), 2) + pow((Char1->Location.Y - Char2->Location.Y), 2) + pow((Char1->Location.Z - Char2->Location.Z),2)); 260 260 ret->type = sl_float; 261 261 return 0; … … 273 273 274 274 if (numargs < 2) return 1; 275 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);276 else index = args[0].val ue_int32;277 if (index == -1) index = args[0].val ue_int32;275 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 276 else index = args[0].val.value_int32; 277 if (index == -1) index = args[0].val.value_int32; 278 278 Chr = ONgGameState->CharacterStorage; 279 279 if(numargs == 3) 280 280 { 281 if (!strcmp(args[1].val ue_str32,"X") || !strcmp(args[1].value_str32,"x"))281 if (!strcmp(args[1].val.value_str32,"X") || !strcmp(args[1].val.value_str32,"x")) 282 282 loc = &(Chr[index].Position.X); 283 else if (!strcmp(args[1].val ue_str32,"Y") || !strcmp(args[1].value_str32,"y"))283 else if (!strcmp(args[1].val.value_str32,"Y") || !strcmp(args[1].val.value_str32,"y")) 284 284 loc = &(Chr[index].Position.Y); 285 else if (!strcmp(args[1].val ue_str32,"Z") || !strcmp(args[1].value_str32,"z"))285 else if (!strcmp(args[1].val.value_str32,"Z") || !strcmp(args[1].val.value_str32,"z")) 286 286 loc = &(Chr[index].Position.Z); 287 287 } 288 288 else if (numargs == 4) { 289 289 ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 290 Chr[index].Location.X = args[1].val ue_float;291 Chr[index].Location.Y = args[2].val ue_float;292 Chr[index].Location.Z = args[3].val ue_float;290 Chr[index].Location.X = args[1].val.value_float; 291 Chr[index].Location.Y = args[2].val.value_float; 292 Chr[index].Location.Z = args[3].val.value_float; 293 293 if(Active) 294 294 { 295 295 Active->PhyContext->Position = Chr[index].Location; 296 296 } 297 ret->val ue_float = 1;297 ret->val.value_float = 1; 298 298 ret->type = sl_float; 299 299 return 0; … … 301 301 else return 1; 302 302 303 ret->val ue_float = *loc;303 ret->val.value_float = *loc; 304 304 ret->type = sl_float; 305 305 306 306 if(numargs == 3) { 307 307 //currently broken, does nothing. 308 *loc = args[2].val ue_float;308 *loc = args[2].val.value_float; 309 309 } 310 310 return 0; … … 315 315 int index; 316 316 if (numargs == 0) index = 0; 317 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);318 else index = args[0].val ue_int32;317 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 318 else index = args[0].val.value_int32; 319 319 if(1) { 320 320 Character* Chr = ONgGameState->CharacterStorage ; … … 323 323 int oldhealth = Chr->Health; 324 324 if (numargs >= 2) { 325 *maxhealth = args[1].val ue_int32;326 } 327 if (numargs >= 3 && args[2].val ue_bool) {328 Chr->Health = (int)(((float)args[1].val ue_int32 / (float)oldmaxhealth) * (float)oldhealth);329 } 330 ret->val ue_int32 = oldmaxhealth;325 *maxhealth = args[1].val.value_int32; 326 } 327 if (numargs >= 3 && args[2].val.value_bool) { 328 Chr->Health = (int)(((float)args[1].val.value_int32 / (float)oldmaxhealth) * (float)oldhealth); 329 } 330 ret->val.value_int32 = oldmaxhealth; 331 331 ret->type = sl_int32; 332 332 return 0; … … 340 340 int index; 341 341 if (numargs == 0) index = 0; 342 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);343 else index = args[0].val ue_int32;342 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 343 else index = args[0].val.value_int32; 344 344 if(1) { 345 345 Character* Chr = ONgGameState->CharacterStorage; 346 346 ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 347 347 if (!Active) return 1; 348 // ret->val ue_int32 = Active->LastDamageSourceCharacter;348 // ret->val.value_int32 = Active->LastDamageSourceCharacter; 349 349 ret->type = sl_int32; 350 350 return 0; … … 360 360 361 361 if (numargs == 0) index = 0; 362 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);363 else index = args[0].val ue_int32;362 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 363 else index = args[0].val.value_int32; 364 364 if (index == -1) { 365 365 ret->type = sl_str32; 366 ret->val ue_str32 = "NULL";366 ret->val.value_str32 = "NULL"; 367 367 return 0; 368 368 } 369 369 name = &ONgGameState->CharacterStorage[index].Name; 370 370 if (numargs == 2) { 371 strncpy(name, (char*)args[1].val ue_str32, 31);371 strncpy(name, (char*)args[1].val.value_str32, 31); 372 372 } 373 373 374 374 ret->type = sl_str32; 375 ret->val ue_str32 = name;375 ret->val.value_str32 = name; 376 376 377 377 return 0; … … 383 383 //testing numargs... 384 384 ret->type = sl_int32; 385 ret->val ue_int32 = numargs;385 ret->val.value_int32 = numargs; 386 386 return 0; 387 387 } … … 399 399 } 400 400 if(numargs == 0) return 0; 401 if(numargs > 1 ) color.R = (char)args[1].val ue_int32;401 if(numargs > 1 ) color.R = (char)args[1].val.value_int32; 402 402 else color.R = 255; 403 if(numargs > 2 ) color.G = (char)args[2].val ue_int32;403 if(numargs > 2 ) color.G = (char)args[2].val.value_int32; 404 404 else color.G = 255; 405 if(numargs > 3 ) color.B = (char)args[3].val ue_int32;405 if(numargs > 3 ) color.B = (char)args[3].val.value_int32; 406 406 else color.B = 255; 407 407 color.A = 0; 408 if(numargs > 5 ) shade.R = (char)args[5].val ue_int32;408 if(numargs > 5 ) shade.R = (char)args[5].val.value_int32; 409 409 else shade.R = 0x3F; 410 if(numargs > 6 ) shade.G = (char)args[6].val ue_int32;410 if(numargs > 6 ) shade.G = (char)args[6].val.value_int32; 411 411 else shade.G = 0x3F; 412 if(numargs > 7 ) shade.B = (char)args[7].val ue_int32;412 if(numargs > 7 ) shade.B = (char)args[7].val.value_int32; 413 413 else shade.B = 0x3F; 414 414 shade.A = 0; 415 415 416 DDrConsole_PrintColored(args[0].val ue_str32, 1, color, shade);416 DDrConsole_PrintColored(args[0].val.value_str32, 1, color, shade); 417 417 return 0; 418 418 } … … 423 423 424 424 ret->type = sl_int32; 425 ret->val ue_int32 = DDrGetCharacterIndexFromName(args[0].value_str32);425 ret->val.value_int32 = DDrGetCharacterIndexFromName(args[0].val.value_str32); 426 426 427 427 return 0; … … 488 488 Character* Chr; 489 489 ActiveCharacter* Active; 490 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);491 else index = args[0].val ue_int32;490 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 491 else index = args[0].val.value_int32; 492 492 493 493 Chr = &(ONgGameState->CharacterStorage[index]); … … 497 497 for(i = 1; i < numargs - 1; i++) { 498 498 for(j = 0; j < 32; j++) { 499 if(!strcmp(args[i].val ue_str32, Actions1[j].Name)) {499 if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { 500 500 Input1 = Input1 | Actions1[j].Bit; 501 501 } 502 502 } 503 503 for(j = 0; j < 9; j++) { 504 if(!strcmp(args[i].val ue_str32, Actions2[j].Name)) {504 if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) { 505 505 Input2 = Input2 | Actions2[j].Bit; 506 506 } … … 513 513 return 0; 514 514 } 515 if ( args[numargs - 1].val ue_int32 <= 0) {515 if ( args[numargs - 1].val.value_int32 <= 0) { 516 516 return 0; 517 517 } 518 518 else { 519 args[numargs - 1].val ue_int32 -= 1;519 args[numargs - 1].val.value_int32 -= 1; 520 520 *dontuse2 = 1; 521 521 *dontuse1 = 1; … … 528 528 // int index; 529 529 // if (numargs < 4) index = 0; 530 // else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);531 // else index = args[0].val ue_int32;530 // else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 531 // else index = args[0].val.value_int32; 532 532 533 533 // Character* Chr = ONgGameState->CharacterStorage; … … 540 540 for(i = 0; i < numargs; i++) { 541 541 for(j = 0; j < 32; j++) { 542 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val ue_str32, Actions1[j].Name, Actions1[j].Bit);543 if(!strcmp(args[i].val ue_str32, Actions1[j].Name)) {542 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val.value_str32, Actions1[j].Name, Actions1[j].Bit); 543 if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { 544 544 Input1 = Input1 | Actions1[j].Bit; 545 545 //DDrConsole_PrintF("Success!"); … … 548 548 } 549 549 for(j = 0; j < 9; j++) { 550 if(!strcmp(args[i].val ue_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit;550 if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; 551 551 552 552 } 553 553 } 554 554 //DDrConsole_PrintF("Testing: 0x%x Input: 0x%x",Input1, *(int*)(ONgGameState + 0xB8 + 0x10)); 555 ret->val ue_int32 = 0;556 ret->type = sl_int32; 557 if ( (ONgGameState->Input.Current.Actions1 == Input1) && (ONgGameState->Input.Current.Actions2 == Input2)) ret->val ue_int32 = 1;555 ret->val.value_int32 = 0; 556 ret->type = sl_int32; 557 if ( (ONgGameState->Input.Current.Actions1 == Input1) && (ONgGameState->Input.Current.Actions2 == Input2)) ret->val.value_int32 = 1; 558 558 return 0; 559 559 } … … 563 563 // int index; 564 564 // if (numargs < 4) index = 0; 565 // else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val ue_str32);566 // else index = args[0].val ue_int32;565 // else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); 566 // else index = args[0].val.value_int32; 567 567 568 568 // Character* Chr = ONgGameState->CharacterStorage; … … 582 582 583 583 } 584 if(numargs < 1 || args[0].val ue == 0) return;584 if(numargs < 1 || args[0].val.value == 0) return; 585 585 //for(i = 0; i < numargs; i++) { 586 586 */ 587 587 i = 0; 588 588 for(j = 0; j < 32; j++) { 589 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val ue_str32, Actions1[j].Name, Actions1[j].Bit);590 if(!strcmp(args[i].val ue_str32, Actions1[j].Name)) {589 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val.value_str32, Actions1[j].Name, Actions1[j].Bit); 590 if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { 591 591 Input1 = Input1 | Actions1[j].Bit; 592 592 //DDrConsole_PrintF("Success!"); … … 595 595 } 596 596 for(j = 0; j < 9; j++) { 597 if(!strcmp(args[i].val ue_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit;597 if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; 598 598 599 599 } … … 622 622 int i; 623 623 char* placeinoutput = output; 624 char* placeininput = args[0].val ue_str32;624 char* placeininput = args[0].val.value_str32; 625 625 int formatnum = 0; 626 626 //fix the broken bsl numargs... … … 670 670 //sprintf(output, output, args[i].value_str32); 671 671 memcpy(buffer, output, 1024); 672 if(args[i].val ue == 0) break;672 if(args[i].val.value == 0) break; 673 673 switch(args[i].type) 674 674 { 675 675 case sl_bool: 676 676 case sl_int32: 677 sprintf(output, buffer, args[i].val ue_int32);677 sprintf(output, buffer, args[i].val.value_int32); 678 678 break; 679 679 case sl_float: 680 680 //crashes oni, why? 681 // sprintf(output, output, args[i].val ue_float);681 // sprintf(output, output, args[i].val.value_float); 682 682 break; 683 683 case sl_str32: 684 sprintf(output, buffer, args[i].val ue_str32);684 sprintf(output, buffer, args[i].val.value_str32); 685 685 break; 686 686 case sl_void: … … 690 690 } 691 691 //output[32] = 0; 692 ret->val ue_str32 = output;692 ret->val.value_str32 = output; 693 693 ret->type = sl_str32; 694 694 return 0; … … 766 766 uint16_t ONICALL cinematic_start_patch(sl_callinfo* callinfo, unsigned int numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 767 767 { 768 args[1].val ue_int32 = (double)args[1].value_int32 / (double)(gl_eng->DisplayMode.Width) * (4.0 / 3.0 * (double)(gl_eng->DisplayMode.Height));768 args[1].val.value_int32 = (double)args[1].val.value_int32 / (double)(gl_eng->DisplayMode.Width) * (4.0 / 3.0 * (double)(gl_eng->DisplayMode.Height)); 769 769 return ((sl_func)(OniExe + 0x000f3830))(callinfo, numargs, args, dontuse1, dontuse2, ret); 770 770 } -
Daodan/src/Oni_Symbols.h
r677 r688 7 7 #include "Oni_Character.h" 8 8 #include "BFW_ScriptLang.h" 9 9 10 #define DefVar(type, name, address) static type* _##name = (type*)address 10 //variables11 12 //DO THIS INSTEAD!13 11 DefVar( onibool, ai2_deaf, 0x005ec0c1 ); 14 12 … … 66 64 67 65 68 #undef $ 66 typedef uint16_t ( ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); 67 typedef char ( ONICALL *OBJtEnumCallback_Object)(void *inObject, int inUserData); 69 68 70 //functions71 //__fastcall isn't neccessary if you specify the correct calling convention.72 typedef int64_t ( *_UUrMachineTime_High)();73 typedef double ( *_UUrMachineTime_High_Frequency)();74 typedef int64_t ( *_UUrMachineTime_Sixtieths)();75 typedef void ( *_UUrPlatform_Initialize)();76 typedef void ( *_UUrPlatform_Terminate)();77 69 78 typedef FILE* ( __cdecl *_oni_fopen)(const char*, const char*); 79 typedef int ( __cdecl *_oni_fprintf)(FILE*, const char*, ...); 80 typedef int ( __cdecl *_oni_fflush)(FILE*); 70 #undef DefFunc 71 #define DefFunc( type, name, callingconvention, args, address) typedef type ( callingconvention * _##name ) args; static _##name name = (_##name)address 72 DefFunc(int64_t, UUrMachineTime_High, ONICALL, (), 0x04026480); 73 DefFunc(double, UUrMachineTime_High_Frequency, ONICALL, (), 0x040264b0); 74 DefFunc(int64_t, UUrMachineTime_Sixtieths, ONICALL, (), 0x040263e0); 75 DefFunc(void, UUrPlatform_Initialize, ONICALL, (), 0x04026010); 76 DefFunc(void, UUrPlatform_Terminate, ONICALL, (), 0x04026310); 81 77 82 typedef void ( __cdecl *_ONiMain)(int ArgCount, char *ArgList[]); 83 typedef short ( *_ONrPlatform_Initialize)(ONtPlatformData *PlatformData); 84 typedef LRESULT ( CALLBACK *_ONrPlatform_WindowProc)(HWND Window, UINT Message, 85 WPARAM WParam, LPARAM LParam); 86 typedef unsigned int ( *_gl_enumerate_valid_display_modes)(M3tDisplayMode modes[16]); 87 typedef int ( *_gl_platform_set_pixel_format)(HDC hdc); 88 typedef int ( *_gl_platform_initialize)(); 78 DefFunc(FILE*, oni_fopen, __cdecl, (const char*, const char*), 0x0051ea9f); 79 DefFunc(int, oni_fprintf, __cdecl, (FILE*, const char*, ...), 0x0051ebbf); 80 DefFunc(int, oni_fflush, __cdecl, (FILE*), 0x0051eab2); 89 81 90 typedef float ( *_ONrPersist_GetGamma)(); 91 typedef uint8_t ( *_ONrPersist_GetWonGame)(); 82 DefFunc(void, ONiMain, __cdecl, (int ArgCount, char *ArgList[]), 0x004d3280); 83 DefFunc(short, ONrPlatform_Initialize, ONICALL, (ONtPlatformData *PlatformData), 0x0050f670); 84 DefFunc(LRESULT, ONrPlatform_WindowProc, CALLBACK, (HWND Window, UINT Message, WPARAM WParam, LPARAM LParam), 0x0050f7a0); 85 DefFunc(unsigned int, gl_enumerate_valid_display_modes, ONICALL, (M3tDisplayMode modes[16]), 0x004083a0); 86 DefFunc(int, gl_platform_set_pixel_format, ONICALL, (HDC hdc), 0x00407b50); 87 DefFunc(int, gl_platform_initialize, ONICALL, (), 0x00407da0); 92 88 93 typedef void ( __cdecl *_UUrStartupMessage)(const char* fmt, ...); 94 typedef int16_t ( *_ONrGameState_NewCharacter)(void* CHAR, void* AISA, 95 void* flag, uint32_t* list_location); 96 typedef ActiveCharacter* ( *_ONrGetActiveCharacter)(void* CharacterPtr); 97 typedef void ( *_ONrCharacter_NewAnimationHook)(Character *ioCharacter, ActiveCharacter *ioActiveCharacter); 98 typedef void ( *_ONrCharacter_SetAnimationExternal)(Character *ioCharacter, short state, void* animation, int interpolation); 89 DefFunc(float, ONrPersist_GetGamma, ONICALL, (), 0x0050f450); 90 DefFunc(uint8_t, ONrPersist_GetWonGame, ONICALL, (), 0x0050f660); 99 91 100 typedef void ( *_COrTextArea_Print)(uint32_t area, uint32_t priority, 101 uint32_t textshade, uint32_t textshadowshade, 102 const char* text, uint32_t unk_alwaws_0, uint32_t fadetime); 103 typedef uint8_t ONICALL ( *_ONrCheater)(uint32_t cheat); 104 typedef int ( __cdecl *_AUrMessageBox)(int Buttons, char *Message, ...); 105 typedef char* ONICALL ( *_SSrMessage_Find)(char* message_key); //Returns a prompt message from a message key 106 //typedef void ( *_ONiGameState_FindAutoPromptMessage)(char* Note, void* ptr); 92 DefFunc(void, UUrStartupMessage, __cdecl, (const char* fmt, ...), 0x00424860); 93 DefFunc(int16_t, ONrGameState_NewCharacter, ONICALL, (void* CHAR, void* AISA, void* flag, uint32_t* list_location), 0x004dac50); 94 DefFunc(ActiveCharacter*, ONrGetActiveCharacter, ONICALL, (void* CharacterPtr), 0x004f1180); 95 DefFunc(void, ONrCharacter_NewAnimationHook, ONICALL, (Character *ioCharacter, ActiveCharacter *ioActiveCharacter), 0x004E97A0); 96 DefFunc(void, ONrCharacter_SetAnimationExternal, ONICALL, (Character *ioCharacter, short state, void* animation, int interpolation), 0x004EB340); 107 97 108 typedef uint16_t (ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); 109 typedef uint16_t (ONICALL *_SLrScript_Command_Register_ReturnType)(char* name, char* desc, char* argfmt, sl_type type, sl_func callback); 110 typedef uint16_t (ONICALL *_SLrScript_Command_Register_Void)(char* name, char* desc, char* argfmt, sl_func callback); 111 typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_Int32)(char* name, char* desc, int32_t* data); 112 typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_Float)(char* name, char* desc, float* data); 113 typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_String)(char* name, char* desc, char* data); 98 DefFunc(void, COrTextArea_Print, ONICALL, (uint32_t area, uint32_t priority, uint32_t textshade, uint32_t textshadowshade, const char* text, uint32_t unk_alwaws_0, uint32_t fadetime), 0x00431340); 99 DefFunc(uint8_t, ONrCheater, ONICALL, (uint32_t cheat), 0x004f5c30); 100 DefFunc(int, AUrMessageBox, __cdecl, (int Buttons, char *Message, ...), 0x004378c0); 101 DefFunc(char*, SSrMessage_Find, ONICALL, (char* message_key), 0x0047F550); 102 DefFunc(void, ONiGameState_FindAutoPromptMessage, ONICALL, (char* Note, void* ptr), 0x004FDBE0); 114 103 115 typedef int ( *_COrMessage_Print)(char* Message, char* Key, void* noidea); 116 //typedef void ( *_COrConsole_StatusLine_Display)(); 117 typedef int16_t ( *_TMrInstance_GetDataPtr)(int tag, char* name, void* pointer); 118 typedef char* ( *_TMrInstance_GetInstanceName)(void* InstancePointer); 104 DefFunc(uint16_t, SLrScript_Command_Register_ReturnType, ONICALL, (char* name, char* desc, char* argfmt, sl_type type, sl_func callback), 0x00477b20); 105 DefFunc(uint16_t, SLrScript_Command_Register_Void, ONICALL, (char* name, char* desc, char* argfmt, sl_func callback), 0x00477b40); 106 DefFunc(uint16_t, SLrGlobalVariable_Register_Int32, ONICALL, (char* name, char* desc, int32_t* data), 0x00477e30); 107 DefFunc(uint16_t, SLrGlobalVariable_Register_Float, ONICALL, (char* name, char* desc, float* data), 0x00477ec0); 108 DefFunc(uint16_t, SLrGlobalVariable_Register_String, ONICALL, (char* name, char* desc, char* data), 0x00477fe0); 119 109 120 typedef int16_t ( *_TSrContext_DrawText)(uint32_t TSrContext, char* Text, char alpha, uint32_t usuallyzero, void* pRect); 121 //int16_t TSrContext_New ( TSFF*, size 7, ??? 1, ??? 1, ??? 0, TSrContext*); 122 typedef int16_t ( *_TSrContext_New)( void* FontInstance, int size, int hthsik1,int hthsik2,int hthsik3, void* TSrContext); 110 DefFunc(int, COrMessage_Print, ONICALL, (char* Message, char* Key, void* noidea), 0x004304B0); 111 DefFunc(void, COrConsole_StatusLine_Display, ONICALL, (), 0x00431E70); 112 DefFunc(int16_t, TMrInstance_GetDataPtr, ONICALL, (int tag, char* name, void* pointer), 0x004232E0); 113 DefFunc(char*, TMrInstance_GetInstanceName, ONICALL, (void* InstancePointer), 0x00423D90); 123 114 124 typedef int16_t ( *_TSrContext_SetShade)( 125 void *ioTextContext, 126 uint32_t inShade); 127 typedef void (* _ONrGameState_Timer_Start)( char* function, int time ); 128 typedef uint16_t ( *_TRrAnimation_GetDuration)(void* Animation); 129 typedef uint16_t ( *_TRrAnimation_GetTo)(void* Animation); 130 typedef uint16_t ( *_TRrAnimation_GetFrom)(void* Animation); 115 DefFunc(int16_t, TSrContext_DrawText, ONICALL, (uint32_t TSrContext, char* Text, char alpha, uint32_t usuallyzero, void* pRect), 0x0042DF00); 116 DefFunc(int16_t, TSrContext_New, ONICALL, (void* FontInstance, int size, int hthsik1,int hthsik2,int hthsik3, void* TSrContext), 0x0042EA30); 131 117 132 typedef void 133 ( *_ONrCharacter_SetHitPoints)( 134 Character *ioCharacter, 135 uint32_t inHitPoints); 136 typedef void ( *_ONrCorpse_Create)(Character* Character); 137 //yes im cheating so badly. 138 typedef uint16_t ( *_iSetCharacterClass)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); 139 typedef uint16_t ( *_AI2iScript_Spawn)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); 140 typedef void * ( *_OBJrObjectType_GetObject_ByNumber)(int inObjectType, int inIndex); 141 typedef int ( *_OBJiObjectGroup_GetNumObjects)(void *inObjectGroup); 118 DefFunc(int16_t, TSrContext_SetShade, ONICALL, (void *ioTextContext, uint32_t inShade), 0x0042EE50); 119 DefFunc(void, ONrGameState_Timer_Start, ONICALL, (char* function, int time), 0x004FD370); 120 DefFunc(uint16_t, TRrAnimation_GetDuration, ONICALL, (void* Animation), 0x00428740); 121 DefFunc(uint16_t, TRrAnimation_GetTo, ONICALL, (void* Animation), 0x00428730); 122 DefFunc(uint16_t, TRrAnimation_GetFrom, ONICALL, (void* Animation), 0x00428720); 142 123 143 typedef void ( *_ONrGameState_DeleteCharacter)(Character *inCharacter); 124 DefFunc(void, ONrCharacter_SetHitPoints, ONICALL, (Character *ioCharacter, uint32_t inHitPoints), 0x004EB220); 125 DefFunc(void, ONrCorpse_Create, ONICALL, (Character* Character), 0x004EF340); 144 126 145 typedef char (*OBJtEnumCallback_Object)( 146 void *inObject, 147 int inUserData); 127 DefFunc(uint16_t, iSetCharacterClass, ONICALL, (sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret), 0x004D99D0); 128 DefFunc(uint16_t, AI2iScript_Spawn, ONICALL, (sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret), 0x004B4780); 129 //NOT USED: DefFunc(void*, OBJrObjectType_GetObject_ByNumber, ONICALL, (int inObjectType, int inIndex), ); 130 //NOT USED: DefFunc(int, OBJiObjectGroup_GetNumObjects, ONICALL, (void *inObjectGroup), ); 148 131 149 typedef int ( *_OBJrObjectType_EnumerateObjects)( 150 int inObjectType, 151 OBJtEnumCallback_Object inEnumCallback, 152 int inUserData); 132 DefFunc(void, ONrGameState_DeleteCharacter, ONICALL, (Character *inCharacter), 0x004DC480); 153 133 154 typedef void ( *_OBJrDoor_Open)( DoorObject *inObject, Character *inCharacter ); 155 typedef void ( *_OBJrDoor_ForceOpen)(short id); 156 typedef short ( *_OBJrConsole_OnActivate)( void *inObject, Character *inCharacter ); 157 //typedef void* ( *_OBJrConsole_GetByID)( short ID ); 158 #define ExtFunc(name) extern _##name name 159 ExtFunc(SLrScript_Command_Register_ReturnType); 160 ExtFunc(SLrScript_Command_Register_Void); 161 ExtFunc(SLrGlobalVariable_Register_Int32); 162 ExtFunc(SLrGlobalVariable_Register_Float); 163 ExtFunc(SLrGlobalVariable_Register_String); 164 //ExtFunc(COrConsole_StatusLine_Display); 165 ExtFunc(OBJrObjectType_EnumerateObjects); 166 //ExtFunc(OBJiObjectGroup_GetNumObjects); 167 //ExtFunc(OBJrConsole_GetByID); 168 ExtFunc(AI2iScript_Spawn); 134 DefFunc(int, OBJrObjectType_EnumerateObjects, ONICALL, (int inObjectType, OBJtEnumCallback_Object inEnumCallback, int inUserData), 0x004D0080); 169 135 170 ExtFunc(TRrAnimation_GetDuration); 171 ExtFunc(TRrAnimation_GetFrom); 172 ExtFunc(TRrAnimation_GetTo); 173 ExtFunc(ONrGameState_Timer_Start); 174 extern _UUrMachineTime_High UUrMachineTime_High; 175 extern _UUrMachineTime_High_Frequency UUrMachineTime_High_Frequency; 176 extern _UUrMachineTime_Sixtieths UUrMachineTime_Sixtieths; 177 extern _UUrPlatform_Initialize UUrPlatform_Initialize; 178 extern _UUrPlatform_Terminate UUrPlatform_Terminate; 136 DefFunc(void, OBJrDoor_Open, ONICALL, (DoorObject *inObject, Character *inCharacter), 0x004C26C0); 137 DefFunc(void, OBJrDoor_ForceOpen, ONICALL, (short id), 0x004C1EE0); 138 DefFunc(short, OBJrConsole_OnActivate, ONICALL, (void *inObject, Character *inCharacter), 0x004C0880); 139 DefFunc(void*, OBJrConsole_GetByID, ONICALL, (short ID), 0x004C0950); 179 140 180 extern _oni_fopen oni_fopen;181 extern _oni_fprintf oni_fprintf;182 extern _oni_fflush oni_fflush;183 141 184 extern _ONiMain ONiMain; 185 extern _ONrPlatform_Initialize ONrPlatform_Initialize; 186 extern _ONrPlatform_WindowProc ONrPlatform_WindowProc; 142 DefFunc(void, ONrCharacter_SetCharacterClass, ONICALL, (Character* Char, ONCC* Class), 0x004D7C30); 143 DefFunc(short, TMrInstance_GetDataPtr_ByNumber, ONICALL, (int tag, int number, void** out), 0x00423680); 144 DefFunc(uint32_t, TMrInstance_GetTagCount, ONICALL, (int tag), 0x004236F0); 145 DefFunc(uint32_t, ONrCharacter_GetHealthShade, ONICALL, (uint32_t health, uint32_t maxhealth), 0x004EF450); 146 DefFunc(void, ONiDrawWeaponSight, ONICALL, (Character* Char), 0x004E1900); 147 DefFunc(void, AI2rDisplayDebuggingInfo, ONICALL, (Character* Char), 0x0048C5F0); 148 DefFunc(uint32_t, M3rTextureMap_New, ONICALL, (short width, short height, int type, int allocated, int flags, char* name, void** output), 0x041EB00); 149 #undef DefFunc 187 150 188 ExtFunc(COrMessage_Print);189 190 ExtFunc(TMrInstance_GetDataPtr);191 ExtFunc(TMrInstance_GetInstanceName);192 193 ExtFunc(gl_enumerate_valid_display_modes);194 ExtFunc(gl_platform_set_pixel_format);195 ExtFunc(gl_platform_initialize);196 ExtFunc(ONrPersist_GetGamma);197 ExtFunc(ONrPersist_GetWonGame);198 ExtFunc(UUrStartupMessage);199 200 ExtFunc(ONrCharacter_SetAnimationExternal);201 202 ExtFunc(ONrCharacter_NewAnimationHook);203 ExtFunc(ONrCharacter_SetHitPoints);204 ExtFunc(ONrGameState_NewCharacter);205 ExtFunc(ONrGameState_DeleteCharacter);206 ExtFunc(ONrGetActiveCharacter);207 ExtFunc(ONrCorpse_Create);208 ExtFunc(iSetCharacterClass);209 210 ExtFunc(COrTextArea_Print);211 212 ExtFunc(ONrCheater);213 ExtFunc(AUrMessageBox);214 215 ExtFunc(SSrMessage_Find);216 //ExtFunc(ONiGameState_FindAutoPromptMessage);217 218 ExtFunc(TSrContext_DrawText);219 ExtFunc(TSrContext_New);220 ExtFunc(TSrContext_SetShade);221 ExtFunc(OBJrDoor_Open);222 ExtFunc(OBJrDoor_ForceOpen);223 224 ExtFunc(OBJrConsole_OnActivate);225 //static const void* ( *OBJrConsole_GetByID)( short ID ) = (const void*(*)(short))0x004C0950;226 #undef DefFunc227 #define DefFunc( type, name, args, address) static const type ONICALL ( * name ) args = (const type (*) args )address;228 DefFunc( void*, OBJrConsole_GetByID, (short ID), 0x004C0950);229 DefFunc( void, COrConsole_StatusLine_Display, (), 0x00431E70 );230 //typedef void ( *_ONiGameState_FindAutoPromptMessage)(char* Note, void* ptr);231 DefFunc( void, ONiGameState_FindAutoPromptMessage, (char* Note, void* ptr), 0x004FDBE0 );232 DefFunc( void, ONrCharacter_SetCharacterClass, (Character* Char, ONCC* Class), 0x004D7C30 );233 DefFunc( short, TMrInstance_GetDataPtr_ByNumber, (int tag, int number, void** out), 0x00423680 );234 DefFunc( uint32_t, TMrInstance_GetTagCount, (int tag), 0x004236F0);235 //DefFunc( uint32_t, stdcall M3rTextureMap_New, (int tag), 0x041EB00);236 //(short width, short height, int type, int allocated, int flags, char* name, void** output)237 DefFunc( uint32_t, ONrCharacter_GetHealthShade, (uint32_t health, uint32_t maxhealth), 0x004EF450);238 //DefFunc( short, TSrContext_SetShade, (void* context, int shade ), 0x0042EE50);239 DefFunc( void, ONiDrawWeaponSight, (Character* Char), 0x004E1900 );240 DefFunc( void, AI2rDisplayDebuggingInfo, (Character* Char), 0x0048C5F0 );241 static const uint32_t ( * M3rTextureMap_New)(short width, short height, int type, int allocated, int flags, char* name, void** output)242 = (const uint32_t(*)(short width, short height, int type, int allocated, int flags, char* name, void** output))0x041EB00;243 151 #endif
Note:
See TracChangeset
for help on using the changeset viewer.