Changeset 1161
- Timestamp:
- Oct 24, 2021, 4:50:22 AM (3 years ago)
- Location:
- Daodan/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Oni/GameState.h
r992 r1161 305 305 Action_PlayRecord = 0x1000, 306 306 Action_F12 = 0x2000, 307 Action_Unknown1 = 0x4000,308 307 Action_LookMode = 0x8000, 309 308 Action_Screenshot = 0x10000, 310 Action_Unknown2 = 0x20000,311 Action_Unknown3 = 0x40000,312 Action_Unknown4 = 0x80000,313 Action_Unknown5 = 0x100000,314 309 Action_Forward = 0x200000, 315 310 Action_Backward = 0x400000, … … 323 318 Action_Kick = 0x40000000, 324 319 Action_Block = 0x80000000, 325 //used in second action field 326 Action2_Walk = 1, 327 Action2_Action = 2, 328 Action2_Hypo = 4, 329 Action2_Reload = 8, 330 Action2_Swap = 0x10, 331 Action2_Drop = 0x20, 332 Action2_Fire1 = 0x40, 333 Action2_Fire2 = 0x80, 334 Action2_Fire3 = 0x100, 320 Action_Walk = 0x100000000ull, 321 Action_Action = 0x200000000ull, 322 Action_Hypo = 0x400000000ull, 323 Action_Reload = 0x800000000ull, 324 Action_Swap = 0x1000000000ull, 325 Action_Drop = 0x2000000000ull, 326 Action_Fire1 = 0x4000000000ull, 327 Action_Fire2 = 0x8000000000ull, 328 Action_Fire3 = 0x10000000000ull, 335 329 }; 336 337 338 typedef struct {339 int32_t Actions1;340 int32_t Actions2;341 } InputAction;342 343 330 344 331 typedef struct { 345 332 float MouseDeltaX; 346 333 float MouseDeltaY; 347 float field_8;348 float field_C;349 InputAction Current;350 InputAction Stopped;351 InputAction Start;352 InputAction Stop;334 float unknown1; 335 int unknown2; 336 uint64_t ActionsDown; 337 uint64_t ActionsUp; 338 uint64_t ActionsPressed; 339 uint64_t ActionsReleased; 353 340 } GameInput; 354 341 -
Daodan/src/Patches/BSL.c
r995 r1161 431 431 typedef struct { 432 432 char Name[16]; 433 int Bit;433 uint64_t Bit; 434 434 } KeyBit; 435 435 436 KeyBit Actions1[32] = {436 static KeyBit Actions[] = { 437 437 {"Escape", Action_Escape}, 438 438 {"Console", Action_Console}, … … 445 445 {"F7", Action_F7 }, 446 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 450 {"F12", Action_F12 }, 451 {"Unknown1", Action_Unknown1 },452 451 {"LookMode", Action_LookMode }, 453 {"Screenshot", Action_Screenshot }, 454 {"Unknown2", Action_Unknown2 }, 455 {"Unknown3", Action_Unknown3 }, 456 {"Unknown4", Action_Unknown4 }, 457 {"Unknown5", Action_Unknown5 }, 452 {"Screenshot", Action_Screenshot }, 458 453 {"Forward", Action_Forward }, 459 454 {"Backward", Action_Backward }, … … 466 461 {"Punch",Action_Punch }, 467 462 {"Kick", Action_Kick }, 468 {"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 } 469 473 }; 470 474 471 KeyBit Actions2[9] = {472 {"Walk", Action2_Walk},473 {"Action", Action2_Action},474 {"Hypo", Action2_Hypo},475 {"Reload", Action2_Reload },476 {"Swap", Action2_Swap },477 {"Drop", Action2_Drop },478 {"Fire1", Action2_Fire1 },479 {"Fire2", Action2_Fire2 },480 {"Fire3", Action2_Fire3 }481 };482 475 uint16_t ONICALL bsl_holdkey(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 483 476 { … … 485 478 uint32_t i = 2; 486 479 uint32_t j = 0; 487 int Input1 = 0; 488 int Input2 = 0; 480 uint64_t Input = 0; 489 481 Character* Chr; 490 482 ActiveCharacter* Active; … … 498 490 for(i = 1; i < numargs - 1; i++) { 499 491 for(j = 0; j < 32; j++) { 500 if(!strcmp(args[i].val.value_str32, Actions 1[j].Name)) {501 Input 1 = Input1 | Actions1[j].Bit;492 if(!strcmp(args[i].val.value_str32, Actions[j].Name)) { 493 Input = Input | Actions[j].Bit; 502 494 } 503 495 } 504 for(j = 0; j < 9; j++) { 505 if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) { 506 Input2 = Input2 | Actions2[j].Bit; 507 } 508 } 509 } 510 Active->Input.Current.Actions1 = Active->Input.Current.Actions1 | Input1; 511 Active->Input.Current.Actions2 = Active->Input.Current.Actions2 | Input2; 512 if( Input1 + Input2 == 0 ) { 496 } 497 Active->Input.ActionsDown = Active->Input.ActionsDown | Input; 498 if( Input == 0 ) { 513 499 DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": No valid keys given.", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name); 514 500 return 0; … … 537 523 uint32_t i = 2; 538 524 uint32_t j = 0; 539 int Input1 = 0; 540 int Input2 = 0; 525 uint64_t Input = 0; 541 526 for(i = 0; i < numargs; i++) { 542 527 for(j = 0; j < 32; j++) { 543 528 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val.value_str32, Actions1[j].Name, Actions1[j].Bit); 544 if(!strcmp(args[i].val.value_str32, Actions 1[j].Name)) {545 Input 1 = Input1 | Actions1[j].Bit;529 if(!strcmp(args[i].val.value_str32, Actions[j].Name)) { 530 Input = Input | Actions[j].Bit; 546 531 //DDrConsole_PrintF("Success!"); 547 532 } 548 549 } 550 for(j = 0; j < 9; j++) { 551 if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; 552 533 553 534 } 554 535 } … … 556 537 ret->val.value_int32 = 0; 557 538 ret->type = sl_int32; 558 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; 559 540 return 0; 560 541 } … … 573 554 int i = 2; 574 555 int j = 0; 575 int Input1 = 0; 576 int Input2 = 0; 556 uint64_t Input = 0; 577 557 /* 578 558 numargs = 0; … … 589 569 for(j = 0; j < 32; j++) { 590 570 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val.value_str32, Actions1[j].Name, Actions1[j].Bit); 591 if(!strcmp(args[i].val.value_str32, Actions 1[j].Name)) {592 Input 1 = Input1 | Actions1[j].Bit;571 if(!strcmp(args[i].val.value_str32, Actions[j].Name)) { 572 Input = Input | Actions[j].Bit; 593 573 //DDrConsole_PrintF("Success!"); 594 574 } 595 596 } 597 for(j = 0; j < 9; j++) { 598 if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; 599 575 600 576 } 601 577 // } 602 578 DDrConsole_PrintF("Waiting..."); 603 if ( 604 (( ONgGameState->Input.Current.Actions1 & Input1) == Input1) && 605 (( ONgGameState->Input.Current.Actions2 & Input2) == Input2) 606 ) 579 if (( ONgGameState->Input.ActionsDown & Input) == Input) 607 580 { 608 581 DDrConsole_PrintF("Found key!"); -
Daodan/src/Patches/Utility.c
r994 r1161 122 122 COtTextArea* cons = *(COtTextArea**)0x00571B74; 123 123 char* clipboardText = 0; 124 if(ONgGameState->Input. Current.Actions1& Action_Console && GetKeyState(0x56) & 0x80 && GetKeyState(VK_CONTROL) & 0x80 )124 if(ONgGameState->Input.ActionsDown & Action_Console && GetKeyState(0x56) & 0x80 && GetKeyState(VK_CONTROL) & 0x80 ) 125 125 { 126 126 if(cons && cons->text_entries && cons->num_text_entries)
Note:
See TracChangeset
for help on using the changeset viewer.