@@ -577,19 +577,31 @@ static void InstantWeaponEquipPatch() {
577577 const DWORD PutAwayWeapon[] = {
578578 0x411EA2 , // action_climb_ladder_
579579 0x412046 , // action_use_an_item_on_object_
580- 0x41224A , // action_get_an_object_
580+ 0x41224A // action_get_an_object_
581+ };
582+ const DWORD PutAwayWeaponExtra[] = {
581583 0x4606A5 , // intface_change_fid_animate_
582- 0x472996 , // invenWieldFunc_
584+ 0x472996 // invenWieldFunc_
583585 };
584586
585- if (IniReader::GetConfigInt (" Misc" , " InstantWeaponEquip" , 0 )) {
586- // Skip weapon equip/unequip animations
587+ int skipAnims = IniReader::GetConfigInt (" Misc" , " InstantWeaponEquip" , 0 );
588+ if (skipAnims) {
589+ // Skip weapon equip/unequip animations
587590 dlogr (" Applying instant weapon equip patch." , DL_INIT );
588- SafeWriteBatch<BYTE >(CodeType::JumpShort, PutAwayWeapon); // jmps
589- BlockCall (0x472AD5 ); //
590- BlockCall (0x472AE0 ); // invenUnwieldFunc_
591- BlockCall (0x472AF0 ); //
592- MakeJump (0x415238 , register_object_take_out_hack);
591+ SafeWriteBatch<BYTE >(CodeType::JumpShort, PutAwayWeapon);
592+ if (skipAnims == 1 ) {
593+ SafeWriteBatch<BYTE >(CodeType::JumpShort, PutAwayWeaponExtra);
594+ BlockCall (0x472AD5 ); //
595+ BlockCall (0x472AE0 ); // invenUnwieldFunc_
596+ BlockCall (0x472AF0 ); //
597+ MakeJump (0x415238 , register_object_take_out_hack);
598+ } else {
599+ HookCalls (register_object_take_out_hack, {
600+ 0x411F18 , // action_climb_ladder_
601+ 0x412102 , // action_use_an_item_on_object_
602+ 0x4122FA // action_get_an_object_
603+ });
604+ }
593605 }
594606}
595607
0 commit comments