ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Patches/BSL.c
(Generate patch)

Comparing Daodan/src/Patches/BSL.c (file contents):
Revision 995 by alloc, Wed Apr 9 00:10:18 2014 UTC vs.
Revision 1161 by rossy, Sun Oct 24 02:50:22 2021 UTC

# Line 430 | Line 430 | uint16_t ONICALL bsl_nametoindex(sl_call
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},
# Line 444 | Line 444 | KeyBit Actions1[32] = {
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                       },
451        {"Unknown1", Action_Unknown1               },  
451          {"LookMode", Action_LookMode           },
452 <        {"Screenshot", Action_Screenshot         },    
454 <        {"Unknown2", Action_Unknown2              },
455 <        {"Unknown3", Action_Unknown3              },  
456 <        {"Unknown4", Action_Unknown4                },
457 <        {"Unknown5", Action_Unknown5                },
452 >        {"Screenshot", Action_Screenshot         },
453          {"Forward", Action_Forward                 },
454          {"Backward", Action_Backward                },
455          {"TurnLeft", Action_TurnLeft                },
# Line 465 | Line 460 | KeyBit Actions1[32] = {
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  
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 };
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;
488 <        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);
# Line 497 | Line 489 | uint16_t ONICALL bsl_holdkey(sl_callinfo
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;
502 <                        }
503 <                }
504 <                for(j = 0; j < 9; j++) {
505 <                        if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) {
506 <                                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;
512 <        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          }
# Line 536 | Line 522 | uint16_t ONICALL bsl_isheld(sl_callinfo*
522   //      if ((int)Active == 0) return 1;
523          uint32_t i = 2;
524          uint32_t j = 0;
525 <        int Input1 = 0;
540 <        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 <                        
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 >
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  
# Line 572 | Line 553 | uint16_t ONICALL bsl_waitforkey(sl_calli
553  
554          int i = 2;
555          int j = 0;
556 <        int Input1 = 0;
576 <        int Input2 = 0;
556 >        uint64_t Input = 0;
557   /*
558          numargs = 0;
559          for(i = 0; args[i].type <= sl_void; i++)
# Line 588 | Line 568 | uint16_t ONICALL bsl_waitforkey(sl_calli
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 <                        
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 >
576                  }
577          //      }
578          DDrConsole_PrintF("Waiting...");
579 <        if (
604 <                (( ONgGameState->Input.Current.Actions1 & Input1) == Input1)  &&
605 <                (( ONgGameState->Input.Current.Actions2 & Input2) == Input2)
606 <        )
579 >        if (( ONgGameState->Input.ActionsDown & Input) == Input)
580          {
581          DDrConsole_PrintF("Found key!");
582          }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)