- Timestamp:
- Oct 26, 2009, 8:58:02 AM (15 years ago)
- Location:
- Daodan/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Daodan_BSL.c
r451 r470 117 117 return 0; 118 118 } 119 120 uint16_t ONICALL bsl_returnoffset(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 121 { 122 //int offset = 140; 123 //if (== 1) offset = 148; 124 //else index = args[0].value_int32; 125 int* killcount = ONgGameState + args[0].value_int32; 126 ret->value_int32 = *killcount; 127 ret->type = sl_int32; 128 return 0; 129 } 130 119 131 120 132 uint16_t ONICALL bsl_powerup(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) … … 199 211 } 200 212 213 uint16_t ONICALL bsl_regen(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 214 { 215 int index; 216 if (numargs == 0) index = 0; 217 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 218 else index = args[0].value_int32; 219 Character* Chr = ONgGameState + 0x1260 ; 220 int* health = (int*)&Chr[index] + 0x144; 221 222 ret->value_int32 = *health; 223 ret->type = sl_int32; 224 225 if (numargs >= 2) { 226 *health = args[1].value_int32; 227 } 228 ret->value_int32 = *health; 229 ret->type = sl_int32; 230 return 0; 231 } 232 233 201 234 uint16_t ONICALL bsl_maxhealth(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 202 235 { … … 222 255 uint16_t ONICALL bsl_getattacker(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 223 256 { 224 //broken...not only does it sometimes blam, but it returns a string when i want an int so i can study it :< 257 //broken 258 225 259 int index; 226 260 if (numargs == 0) index = 0; … … 309 343 return 0; 310 344 } 345 typedef struct { 346 char Name[16]; 347 int Bit; 348 } KeyBit; 349 350 KeyBit Actions1[32] = { 351 {"Escape", Action_Escape}, 352 {"Console", Action_Console}, 353 {"PauseScreen", Action_PauseScreen}, 354 {"Cutscene1", Action_Cutscene_1 }, 355 {"Cutscene2", Action_Cutscene_2 }, 356 {"F4", Action_F4 }, 357 {"F5", Action_F5 }, 358 {"F6", Action_F6 }, 359 {"F7", Action_F7 }, 360 {"F8", Action_F8 }, 361 {"StartRecorn", Action_StartRecord }, 362 {"StopRecord", Action_StopRecord }, 363 {"PlayRecord", Action_PlayRecord }, 364 {"F12", Action_F12 }, 365 {"Unknown1", Action_Unknown1 }, 366 {"LookMode", Action_LookMode }, 367 {"Screenshot", Action_Screenshot }, 368 {"Unknown2", Action_Unknown2 }, 369 {"Unknown3", Action_Unknown3 }, 370 {"Unknown4", Action_Unknown4 }, 371 {"Unknown5", Action_Unknown5 }, 372 {"Forward", Action_Forward }, 373 {"Backward", Action_Backward }, 374 {"TurnLeft", Action_TurnLeft }, 375 {"TurnRight", Action_TurnRight }, 376 {"StepLeft", Action_StepLeft }, 377 {"StepRight", Action_StepRight }, 378 {"Jump", Action_Jump }, 379 {"Crouch", Action_Crouch }, 380 {"Punch",Action_Punch }, 381 {"Kick", Action_Kick }, 382 {"Block", Action_Block } 383 }; 384 385 KeyBit Actions2[9] = { 386 {"Walk", Action2_Walk}, 387 {"Action", Action2_Action}, 388 {"Hypo", Action2_Hypo}, 389 {"Reload", Action2_Reload }, 390 {"Swap", Action2_Swap }, 391 {"Drop", Action2_Drop }, 392 {"Fire1", Action2_Fire1 }, 393 {"Fire2", Action2_Fire2 }, 394 {"Fire3", Action2_Fire3 } 395 }; 396 uint16_t ONICALL bsl_holdkey(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 397 { 398 int index; 399 if (numargs < 4) index = 0; 400 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 401 else index = args[0].value_int32; 402 403 Character* Chr = ONgGameState + 0x1260; 404 ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 405 if ((int)Active == 0) return 1; 406 int i = 2; 407 int j = 0; 408 int Input1 = 0; 409 int Input2 = 0; 410 for(i = 1; i < numargs; i++) { 411 for(j = 0; j < 32; j++) { 412 if(strcmp(args[i].value_str32, Actions1[j].Name)) Input1 = Input1 | Actions1[j].Bit; 413 DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].value_str32, Actions1[j].Name, Actions1[j].Bit); 414 } 415 for(j = 0; j < 9; j++) { 416 if(!strcmp(args[i].value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; 417 418 } 419 } 420 for(i = 0; i < numargs; i++) { 421 DDrConsole_PrintF("%s", args[i].value_str32); 422 } 423 // if 424 return 0; 425 } 426 427 uint16_t ONICALL bsl_isheld(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 428 { 429 // int index; 430 // if (numargs < 4) index = 0; 431 // else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 432 // else index = args[0].value_int32; 433 434 // Character* Chr = ONgGameState + 0x1260; 435 // ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 436 // if ((int)Active == 0) return 1; 437 int i = 2; 438 int j = 0; 439 int Input1 = 0; 440 int Input2 = 0; 441 for(i = 0; i < numargs; i++) { 442 for(j = 0; j < 32; j++) { 443 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].value_str32, Actions1[j].Name, Actions1[j].Bit); 444 if(!strcmp(args[i].value_str32, Actions1[j].Name)) { 445 Input1 = Input1 | Actions1[j].Bit; 446 //DDrConsole_PrintF("Success!"); 447 } 448 449 } 450 for(j = 0; j < 9; j++) { 451 if(!strcmp(args[i].value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; 452 453 } 454 } 455 //DDrConsole_PrintF("Testing: 0x%x Input: 0x%x",Input1, *(int*)(ONgGameState + 0xB8 + 0x10)); 456 ret->value_int32 = 0; 457 ret->type = sl_int32; 458 if ( ((*(int*)(ONgGameState + 0xB8 + 0x10) & Input1) == Input1) && ((*(int*)(ONgGameState + 0xB8 + 0x14) & Input2) == Input2)) ret->value_int32 = 1; 459 return 0; 460 } 461 462 uint16_t ONICALL bsl_waitforkey(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 463 { 464 // int index; 465 // if (numargs < 4) index = 0; 466 // else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 467 // else index = args[0].value_int32; 468 469 // Character* Chr = ONgGameState + 0x1260; 470 // ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 471 // if ((int)Active == 0) return 1; 472 int i = 2; 473 int j = 0; 474 int Input1 = 0; 475 int Input2 = 0; 476 for(i = 0; i < numargs; i++) { 477 for(j = 0; j < 32; j++) { 478 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].value_str32, Actions1[j].Name, Actions1[j].Bit); 479 if(!strcmp(args[i].value_str32, Actions1[j].Name)) { 480 Input1 = Input1 | Actions1[j].Bit; 481 //DDrConsole_PrintF("Success!"); 482 } 483 484 } 485 for(j = 0; j < 9; j++) { 486 if(!strcmp(args[i].value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; 487 488 } 489 } 490 //DDrConsole_PrintF("Waiting..."); 491 if ( ((*(int*)(ONgGameState + 0xB8 + 0x10) & Input1) == Input1) && ((*(int*)(ONgGameState + 0xB8 + 0x14) & Input2) == Input2)) { 492 } 493 else { 494 //else (int)*ret = 1; 495 *dontuse2 = 1; 496 *dontuse1 = 1; 497 } 498 /* 499 __asm__( 500 "movl 0x10(%esp), %edx\n\t" 501 "movl $1,(%eax)\n\t" 502 ); 503 //ret->type = sl_void 504 */ return 0; 505 } 506 311 507 /* 312 508 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) … … 328 524 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 329 525 { 330 DDrConsole_PrintF("%d", numargs);331 332 526 if (numargs < 1 || args[0].type != sl_str32) 333 527 { … … 481 675 void SLrDaodan_Initalize() 482 676 { 677 678 //const char regen_patch[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; 679 //DDrPatch_Const(OniExe + 0x0011BB6D, regen_patch); 680 681 //This one should work but doesn't. 682 //const char regen_patch[] ={0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x8B, 0x86, 0x44}; 683 //DDrPatch_Const(OniExe + 0x0011BB64, regen_patch); 684 483 685 SLrConfig(); 484 686 687 485 688 SLrScript_Command_Register_ReturnType("int32mul", "Multiplies two numbers", "n1:int n2:int", sl_int32, bsl_int32mul); 486 689 SLrScript_Command_Register_ReturnType("mul", "Multiplies two numbers", "[int1:int|float1:float] [int2:int|float2:float]", sl_float, bsl_mul); … … 497 700 SLrScript_Command_Register_ReturnType("d_getindex","Converts a character's name to its index", "script_id:int", sl_int32, bsl_nametoindex); 498 701 SLrScript_Command_Register_ReturnType("d_health","Gets or sets a character's health", "[ai_name:str | script_id:int] [newhealth:int]", sl_str32, bsl_health); 702 SLrScript_Command_Register_ReturnType("d_regen","Gets or sets a character's health", "[ai_name:str | script_id:int] [newhealth:int]", sl_str32, bsl_regen); 499 703 SLrScript_Command_Register_ReturnType("d_maxhealth","Gets or sets a character's maximum health", "[ai_name:str | script_id:int] [newmaxhealth:int] [scalehealth:bool]", sl_str32, bsl_maxhealth); 500 704 SLrScript_Command_Register_ReturnType("d_powerup","Gets or sets a character's powerups", "ai_name:str|script_id:int powerup:str", sl_int32, bsl_powerup); 705 SLrScript_Command_Register_ReturnType("d_holdkey","Makes an AI hold a key", "[ai_name:string | script_id:int] keys", sl_int32, bsl_holdkey); 706 SLrScript_Command_Register_ReturnType("d_isheld","Checks for a held key", "keys", sl_int32, bsl_isheld); 707 SLrScript_Command_Register_Void("d_waitforkey","Waits for a keypress.", "keys", bsl_waitforkey); 708 501 709 //broken. sometimes crashes, and sometimes returns a string... : / 502 710 SLrScript_Command_Register_ReturnType("d_getattacker","Gets the last person to hurt a character", "[ai_name:string | script_id:int]", sl_int32, bsl_getattacker); … … 505 713 506 714 SLrScript_Command_Register_ReturnType("sprintf", "C-style sprintf.", "format:string arg1 arg2 ...", sl_str32, bsl_sprintf); 507 SLrScript_Command_Register_ReturnType("dprintcolor", "prints to console in color", "text:string [color: r b g] [color: r b g]", sl_void, bsl_dprintcolored);508 715 509 716 SLrScript_Command_Register_ReturnType("d_dprint", "prints to console in color", "text:string [color: r b g] [color: r b g]", sl_void, bsl_dprintcolored); 717 718 //SLrScript_Command_Register_ReturnType("d_offset", "a test", "thing:int", sl_int32, bsl_returnoffset); 510 719 } 511 720 -
Daodan/src/Oni_Character.h
r453 r470 207 207 int16_t field_1C; 208 208 int16_t field_1E; 209 int16_t hasLSI; 209 char hasLSI; 210 char field_1B5; 210 211 int16_t field_1B6; 211 212 int16_t ShieldUsed; //Bullet shield given for the char to use … … 228 229 Vector3 field_B8; 229 230 Vector3 AccelerateWith; 230 int 16_t field_D0;231 int32_t field_D0; 231 232 Vector3 field_D4; 232 233 int32_t field_E0; … … 234 235 int32_t field_E8; 235 236 int32_t field_EC; 236 int32_t field_F0;237 int 32_t field_F4;238 int16_t IsInAir ;237 float SomePhyPosY; 238 int16_t field_F4; 239 int16_t IsInAirTimer; 239 240 Vector3 FallingVelocity; 240 241 Vector3 JumpVelocity; 241 int16_t field_110; 242 char StartJumpPending; 243 char field_111; 242 244 int16_t field_112; 243 int32_tfield_114;244 int32_t field_118;245 Vector3 field_114; 246 int32_t LastDamageSourceCharacter; 245 247 int32_t field_11C; 246 248 int32_t field_120; … … 582 584 //int16_t ONICALL ONrGameState_GetPlayerCharacter(); 583 585 586 //probably need to name these better. 587 #define char_unkillable (1 << 5) 588 #define char_superammo (1 << 6) 589 #define char_unstoppable (1 << 8) 590 #define char_deathlock (1 << 10) 591 #define char_dontaim (1 << 13) 592 #define char_nocollision (1 << 17) 593 #define char_noshadow (1 << 24) 594 #define char_invincible (1 << 25) 595 #define char_bossshield (1 << 30) 596 #define char_weaponimmune (1 << 31) 584 597 585 598 #endif
Note:
See TracChangeset
for help on using the changeset viewer.