Added a new value to InstantWeaponEquip

Tweaked the animation sequence when interacting with scenery or using
an item on an object.
This commit is contained in:
NovaRain
2026-05-18 14:03:36 +08:00
parent 675032dddc
commit 8967e95f0f
3 changed files with 38 additions and 13 deletions
+2 -1
View File
@@ -707,7 +707,8 @@ ActiveGeigerMsgs=1
;Set to 1 to fix the bug of being unable to sell used geiger counters or stealth boys ;Set to 1 to fix the bug of being unable to sell used geiger counters or stealth boys
CanSellUsedGeiger=1 CanSellUsedGeiger=1
;Set to 1 to skip weapon equip/unequip animations when performing various actions ;Set to 1 to skip weapon equip/unequip animations during various actions
;Set to 2 to skip these animations only when interacting with objects
InstantWeaponEquip=0 InstantWeaponEquip=0
;To add additional game msg files, uncomment the next line and set a comma-delimited list of filenames without .msg extension ;To add additional game msg files, uncomment the next line and set a comma-delimited list of filenames without .msg extension
+14 -3
View File
@@ -471,6 +471,13 @@ skip:
} }
} }
static __declspec(naked) void action_use_an_item_on_object_hook() {
__asm {
dec ebx; // set delay to -1
jmp fo::funcoffs::register_object_animate_;
}
}
static __declspec(naked) void art_alias_fid_hack() { static __declspec(naked) void art_alias_fid_hack() {
static const DWORD art_alias_fid_Ret = 0x419A6D; static const DWORD art_alias_fid_Ret = 0x419A6D;
using namespace fo; using namespace fo;
@@ -663,12 +670,16 @@ void Animations::init() {
// Fix crash when the critter goes through a door with animation trigger // Fix crash when the critter goes through a door with animation trigger
MakeJump(0x41755E, object_move_hack); MakeJump(0x41755E, object_move_hack);
// Allow playing the "magic hands" animation when using an item on an object
SafeWrite16(0x4120B8, 0x9090); // action_use_an_item_on_object_
// Fix for the player stuck at "climbing" frame after ladder climbing animation // Fix for the player stuck at "climbing" frame after ladder climbing animation
HookCall(0x411E1F, action_climb_ladder_hook); HookCall(0x411E1F, action_climb_ladder_hook);
// Allow playing the "magic hands" animation when using an item on an object
SafeWrite16(0x4120B8, 0x9090); // action_use_an_item_on_object_
// Change the animation sequence to be in line with action_get_an_object_
// ANIM_put_away animation only plays for "stairs" type scenery (SFX only for all other cases)
HookCall(0x41206D, action_use_an_item_on_object_hook);
SafeWrite32(0x4120BB, 0); // delay for "magic hands" animation
// Add ANIM_charred_body/ANIM_charred_body_sf animations to art aliases // Add ANIM_charred_body/ANIM_charred_body_sf animations to art aliases
MakeCall(0x419A17, art_alias_fid_hack); MakeCall(0x419A17, art_alias_fid_hack);
+18 -5
View File
@@ -608,19 +608,32 @@ static void InstantWeaponEquipPatch() {
const DWORD PutAwayWeapon[] = { const DWORD PutAwayWeapon[] = {
0x411EA2, // action_climb_ladder_ 0x411EA2, // action_climb_ladder_
0x412046, // action_use_an_item_on_object_ 0x412046, // action_use_an_item_on_object_
0x41224A, // action_get_an_object_ 0x41224A // action_get_an_object_
};
const DWORD PutAwayWeaponExtra[] = {
0x4606A5, // intface_change_fid_animate_ 0x4606A5, // intface_change_fid_animate_
0x472996, // invenWieldFunc_ 0x472996 // invenWieldFunc_
}; };
if (IniReader::GetConfigInt("Misc", "InstantWeaponEquip", 0)) { int skipAnims = IniReader::GetConfigInt("Misc", "InstantWeaponEquip", 0);
//Skip weapon equip/unequip animations if (skipAnims) {
// Skip weapon equip/unequip animations
dlogr("Applying instant weapon equip patch.", DL_INIT); dlogr("Applying instant weapon equip patch.", DL_INIT);
SafeWriteBatch<BYTE>(CodeType::JumpShort, PutAwayWeapon); // jmps SafeWriteBatch<BYTE>(CodeType::JumpShort, PutAwayWeapon);
if (skipAnims == 1) {
SafeWriteBatch<BYTE>(CodeType::JumpShort, PutAwayWeaponExtra);
BlockCall(0x472AD5); // BlockCall(0x472AD5); //
BlockCall(0x472AE0); // invenUnwieldFunc_ BlockCall(0x472AE0); // invenUnwieldFunc_
BlockCall(0x472AF0); // BlockCall(0x472AF0); //
MakeJump(0x415238, register_object_take_out_hack); MakeJump(0x415238, register_object_take_out_hack);
} else {
const DWORD TakeOutWeapon[] = {
0x411F18, // action_climb_ladder_
0x412102, // action_use_an_item_on_object_
0x4122FA // action_get_an_object_
};
HookCalls(register_object_take_out_hack, TakeOutWeapon);
}
} }
} }