| 12 |
|
|
| 13 |
|
#include "Character.h" |
| 14 |
|
|
| 15 |
+ |
bool ONICALL argumentEmpty(sl_arg* arg) { |
| 16 |
+ |
if ((arg->type == sl_str32) && (strlen(arg->val.value_str32) == 0)) |
| 17 |
+ |
return true; |
| 18 |
+ |
return false; |
| 19 |
+ |
} |
| 20 |
|
|
| 21 |
|
uint16_t ONICALL bsl_int32mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 22 |
|
{ |
| 97 |
|
uint16_t ONICALL bsl_getkills(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 98 |
|
{ |
| 99 |
|
int index; |
| 100 |
< |
if (numargs == 0) index = 0; |
| 100 |
> |
if (argumentEmpty(&args[0])) index = 0; |
| 101 |
|
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 102 |
|
else index = args[0].val.value_int32; |
| 103 |
|
//killcount = ONgGameState->CharacterStorage[index].Kills; |
| 110 |
|
uint16_t ONICALL bsl_getdamage(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 111 |
|
{ |
| 112 |
|
int index; |
| 113 |
< |
if (numargs == 0) index = 0; |
| 113 |
> |
if (argumentEmpty(&args[0])) index = 0; |
| 114 |
|
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 115 |
|
else index = args[0].val.value_int32; |
| 116 |
|
ret->val.value_int32 = ONgGameState->CharacterStorage[index].Damage; |
| 190 |
|
int index; |
| 191 |
|
Character* Chr; |
| 192 |
|
int* health; |
| 193 |
< |
if (numargs == 0) index = 0; |
| 193 |
> |
if (argumentEmpty(&args[0])) index = 0; |
| 194 |
|
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 195 |
|
else index = args[0].val.value_int32; |
| 196 |
|
Chr = ONgGameState->CharacterStorage; |
| 211 |
|
{ |
| 212 |
|
int index; |
| 213 |
|
Character* Chr; |
| 214 |
< |
if (numargs == 0) index = 0; |
| 214 |
> |
if (argumentEmpty(&args[0])) index = 0; |
| 215 |
|
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 216 |
|
else index = args[0].val.value_int32; |
| 217 |
|
Chr = ONgGameState->CharacterStorage ; |
| 218 |
|
|
| 214 |
– |
|
| 219 |
|
/* |
| 220 |
|
DDrConsole_PrintF("Character %s", Chr[index].Name); |
| 221 |
|
DDrConsole_PrintF("Spawn %s", Chr[index].ScriptSpawn); |
| 314 |
|
uint16_t ONICALL bsl_maxhealth(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 315 |
|
{ |
| 316 |
|
int index; |
| 317 |
< |
if (numargs == 0) index = 0; |
| 317 |
> |
if (argumentEmpty(&args[0])) index = 0; |
| 318 |
|
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 319 |
|
else index = args[0].val.value_int32; |
| 320 |
|
if(1) { |
| 339 |
|
//broken |
| 340 |
|
|
| 341 |
|
int index; |
| 342 |
< |
if (numargs == 0) index = 0; |
| 342 |
> |
if (argumentEmpty(&args[0])) index = 0; |
| 343 |
|
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 344 |
|
else index = args[0].val.value_int32; |
| 345 |
|
if(1) { |
| 359 |
|
int index; |
| 360 |
|
char* name; |
| 361 |
|
|
| 362 |
< |
if (numargs == 0) index = 0; |
| 362 |
> |
if (argumentEmpty(&args[0])) index = 0; |
| 363 |
|
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 364 |
|
else index = args[0].val.value_int32; |
| 365 |
|
if (index == -1) { |
| 398 |
|
{ |
| 399 |
|
numargs++; |
| 400 |
|
} |
| 401 |
< |
if(numargs == 0) return 0; |
| 401 |
> |
if(argumentEmpty(&args[0])) return 0; |
| 402 |
|
if(numargs > 1 ) color.R = (char)args[1].val.value_int32; |
| 403 |
|
else color.R = 255; |
| 404 |
|
if(numargs > 2 ) color.G = (char)args[2].val.value_int32; |
| 430 |
|
|
| 431 |
|
typedef struct { |
| 432 |
|
char Name[16]; |
| 433 |
< |
int Bit; |
| 433 |
> |
uint64_t Bit; |
| 434 |
|
} KeyBit; |
| 435 |
|
|
| 436 |
< |
KeyBit Actions1[32] = { |
| 436 |
> |
static KeyBit Actions[] = { |
| 437 |
|
{"Escape", Action_Escape}, |
| 438 |
|
{"Console", Action_Console}, |
| 439 |
|
{"PauseScreen", Action_PauseScreen}, |
| 444 |
|
{"F6", Action_F6 }, |
| 445 |
|
{"F7", Action_F7 }, |
| 446 |
|
{"F8", Action_F8 }, |
| 447 |
< |
{"StartRecord", Action_StartRecord }, |
| 448 |
< |
{"StopRecord", Action_StopRecord }, |
| 449 |
< |
{"PlayRecord", Action_PlayRecord }, |
| 447 |
> |
{"StartRecord", Action_StartRecord }, |
| 448 |
> |
{"StopRecord", Action_StopRecord }, |
| 449 |
> |
{"PlayRecord", Action_PlayRecord }, |
| 450 |
|
{"F12", Action_F12 }, |
| 447 |
– |
{"Unknown1", Action_Unknown1 }, |
| 451 |
|
{"LookMode", Action_LookMode }, |
| 452 |
< |
{"Screenshot", Action_Screenshot }, |
| 450 |
< |
{"Unknown2", Action_Unknown2 }, |
| 451 |
< |
{"Unknown3", Action_Unknown3 }, |
| 452 |
< |
{"Unknown4", Action_Unknown4 }, |
| 453 |
< |
{"Unknown5", Action_Unknown5 }, |
| 452 |
> |
{"Screenshot", Action_Screenshot }, |
| 453 |
|
{"Forward", Action_Forward }, |
| 454 |
|
{"Backward", Action_Backward }, |
| 455 |
|
{"TurnLeft", Action_TurnLeft }, |
| 460 |
|
{"Crouch", Action_Crouch }, |
| 461 |
|
{"Punch",Action_Punch }, |
| 462 |
|
{"Kick", Action_Kick }, |
| 463 |
< |
{"Block", Action_Block } |
| 463 |
> |
{"Block", Action_Block }, |
| 464 |
> |
{"Walk", Action_Walk}, |
| 465 |
> |
{"Action", Action_Action}, |
| 466 |
> |
{"Hypo", Action_Hypo}, |
| 467 |
> |
{"Reload", Action_Reload }, |
| 468 |
> |
{"Swap", Action_Swap }, |
| 469 |
> |
{"Drop", Action_Drop }, |
| 470 |
> |
{"Fire1", Action_Fire1 }, |
| 471 |
> |
{"Fire2", Action_Fire2 }, |
| 472 |
> |
{"Fire3", Action_Fire3 } |
| 473 |
|
}; |
| 474 |
|
|
| 467 |
– |
KeyBit Actions2[9] = { |
| 468 |
– |
{"Walk", Action2_Walk}, |
| 469 |
– |
{"Action", Action2_Action}, |
| 470 |
– |
{"Hypo", Action2_Hypo}, |
| 471 |
– |
{"Reload", Action2_Reload }, |
| 472 |
– |
{"Swap", Action2_Swap }, |
| 473 |
– |
{"Drop", Action2_Drop }, |
| 474 |
– |
{"Fire1", Action2_Fire1 }, |
| 475 |
– |
{"Fire2", Action2_Fire2 }, |
| 476 |
– |
{"Fire3", Action2_Fire3 } |
| 477 |
– |
}; |
| 475 |
|
uint16_t ONICALL bsl_holdkey(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 476 |
|
{ |
| 477 |
|
uint32_t index; |
| 478 |
|
uint32_t i = 2; |
| 479 |
|
uint32_t j = 0; |
| 480 |
< |
int Input1 = 0; |
| 484 |
< |
int Input2 = 0; |
| 480 |
> |
uint64_t Input = 0; |
| 481 |
|
Character* Chr; |
| 482 |
|
ActiveCharacter* Active; |
| 483 |
|
if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 489 |
|
|
| 490 |
|
for(i = 1; i < numargs - 1; i++) { |
| 491 |
|
for(j = 0; j < 32; j++) { |
| 492 |
< |
if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { |
| 493 |
< |
Input1 = Input1 | Actions1[j].Bit; |
| 498 |
< |
} |
| 499 |
< |
} |
| 500 |
< |
for(j = 0; j < 9; j++) { |
| 501 |
< |
if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) { |
| 502 |
< |
Input2 = Input2 | Actions2[j].Bit; |
| 492 |
> |
if(!strcmp(args[i].val.value_str32, Actions[j].Name)) { |
| 493 |
> |
Input = Input | Actions[j].Bit; |
| 494 |
|
} |
| 495 |
|
} |
| 496 |
|
} |
| 497 |
< |
Active->Input.Current.Actions1 = Active->Input.Current.Actions1 | Input1; |
| 498 |
< |
Active->Input.Current.Actions2 = Active->Input.Current.Actions2 | Input2; |
| 508 |
< |
if( Input1 + Input2 == 0 ) { |
| 497 |
> |
Active->Input.ActionsDown = Active->Input.ActionsDown | Input; |
| 498 |
> |
if( Input == 0 ) { |
| 499 |
|
DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": No valid keys given.", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name); |
| 500 |
|
return 0; |
| 501 |
|
} |
| 522 |
|
// if ((int)Active == 0) return 1; |
| 523 |
|
uint32_t i = 2; |
| 524 |
|
uint32_t j = 0; |
| 525 |
< |
int Input1 = 0; |
| 536 |
< |
int Input2 = 0; |
| 525 |
> |
uint64_t Input = 0; |
| 526 |
|
for(i = 0; i < numargs; i++) { |
| 527 |
|
for(j = 0; j < 32; j++) { |
| 528 |
|
//DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val.value_str32, Actions1[j].Name, Actions1[j].Bit); |
| 529 |
< |
if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { |
| 530 |
< |
Input1 = Input1 | Actions1[j].Bit; |
| 529 |
> |
if(!strcmp(args[i].val.value_str32, Actions[j].Name)) { |
| 530 |
> |
Input = Input | Actions[j].Bit; |
| 531 |
|
//DDrConsole_PrintF("Success!"); |
| 532 |
|
} |
| 533 |
< |
|
| 545 |
< |
} |
| 546 |
< |
for(j = 0; j < 9; j++) { |
| 547 |
< |
if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; |
| 548 |
< |
|
| 533 |
> |
|
| 534 |
|
} |
| 535 |
|
} |
| 536 |
|
//DDrConsole_PrintF("Testing: 0x%x Input: 0x%x",Input1, *(int*)(ONgGameState + 0xB8 + 0x10)); |
| 537 |
|
ret->val.value_int32 = 0; |
| 538 |
|
ret->type = sl_int32; |
| 539 |
< |
if ( (ONgGameState->Input.Current.Actions1 == Input1) && (ONgGameState->Input.Current.Actions2 == Input2)) ret->val.value_int32 = 1; |
| 539 |
> |
if (ONgGameState->Input.ActionsDown == Input) ret->val.value_int32 = 1; |
| 540 |
|
return 0; |
| 541 |
|
} |
| 542 |
|
|
| 553 |
|
|
| 554 |
|
int i = 2; |
| 555 |
|
int j = 0; |
| 556 |
< |
int Input1 = 0; |
| 572 |
< |
int Input2 = 0; |
| 556 |
> |
uint64_t Input = 0; |
| 557 |
|
/* |
| 558 |
|
numargs = 0; |
| 559 |
|
for(i = 0; args[i].type <= sl_void; i++) |
| 568 |
|
i = 0; |
| 569 |
|
for(j = 0; j < 32; j++) { |
| 570 |
|
//DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val.value_str32, Actions1[j].Name, Actions1[j].Bit); |
| 571 |
< |
if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { |
| 572 |
< |
Input1 = Input1 | Actions1[j].Bit; |
| 571 |
> |
if(!strcmp(args[i].val.value_str32, Actions[j].Name)) { |
| 572 |
> |
Input = Input | Actions[j].Bit; |
| 573 |
|
//DDrConsole_PrintF("Success!"); |
| 574 |
|
} |
| 575 |
< |
|
| 592 |
< |
} |
| 593 |
< |
for(j = 0; j < 9; j++) { |
| 594 |
< |
if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; |
| 595 |
< |
|
| 575 |
> |
|
| 576 |
|
} |
| 577 |
|
// } |
| 578 |
|
DDrConsole_PrintF("Waiting..."); |
| 579 |
< |
if ( |
| 600 |
< |
(( ONgGameState->Input.Current.Actions1 & Input1) == Input1) && |
| 601 |
< |
(( ONgGameState->Input.Current.Actions2 & Input2) == Input2) |
| 602 |
< |
) |
| 579 |
> |
if (( ONgGameState->Input.ActionsDown & Input) == Input) |
| 580 |
|
{ |
| 581 |
|
DDrConsole_PrintF("Found key!"); |
| 582 |
|
} |
| 669 |
|
uint16_t ONICALL cinematic_start_patch(sl_callinfo* callinfo, unsigned int numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 670 |
|
{ |
| 671 |
|
args[1].val.value_int32 = (double)args[1].val.value_int32 / (double)(gl->DisplayMode.Width) * (4.0 / 3.0 * (double)(gl->DisplayMode.Height)); |
| 672 |
+ |
// Call orig OCiCinematic_ScriptStart |
| 673 |
|
return ((sl_func)(OniExe + 0x000f3830))(callinfo, numargs, args, dontuse1, dontuse2, ret); |
| 674 |
|
} |
| 675 |
|
|
| 746 |
|
// Patch for cinematic_start to work on widescreen resolutions |
| 747 |
|
void SLrDaodan_Patch() |
| 748 |
|
{ |
| 749 |
+ |
// PUSH OCiCinematic_ScriptStart -> PUSH cinematic_start_patch |
| 750 |
|
DDrPatch_Int32((int*)(OniExe + 0x000f3755), (int)cinematic_start_patch); |
| 751 |
|
} |