Fix bone index stub maybe
This commit is contained in:
parent
b45d895e5f
commit
1998940550
@ -45,21 +45,32 @@ namespace weapon
|
|||||||
}
|
}
|
||||||
|
|
||||||
utils::hook::detour xmodel_get_bone_index_hook;
|
utils::hook::detour xmodel_get_bone_index_hook;
|
||||||
__int64 xmodel_get_bone_index_stub(game::XModel* model, game::scr_string_t name, unsigned int offset, char* index)
|
int xmodel_get_bone_index_stub(game::XModel* model, game::scr_string_t name, unsigned int offset, char* index)
|
||||||
{
|
{
|
||||||
auto result = xmodel_get_bone_index_hook.invoke<__int64>(model, name, offset, index);
|
auto result = xmodel_get_bone_index_hook.invoke<int>(model, name, offset, index);
|
||||||
if (!result)
|
if (result)
|
||||||
{
|
{
|
||||||
if (name == game::SL_GetString("tag_weapon_right", 0) ||
|
return result;
|
||||||
name == game::SL_GetString("tag_knife_attach", 0))
|
}
|
||||||
|
|
||||||
|
const auto original_index = *index;
|
||||||
|
const auto original_result = result;
|
||||||
|
|
||||||
|
if (name == game::SL_FindString("tag_weapon_right") ||
|
||||||
|
name == game::SL_FindString("tag_knife_attach"))
|
||||||
|
{
|
||||||
|
const auto tag_weapon = game::SL_FindString("tag_weapon");
|
||||||
|
result = xmodel_get_bone_index_hook.invoke<int>(model, tag_weapon, offset, index);
|
||||||
|
if (result)
|
||||||
{
|
{
|
||||||
result = xmodel_get_bone_index_hook.invoke<__int64>(model, game::SL_GetString("tag_weapon", 0), offset, index);
|
console::debug("using tag_weapon instead of %s (%s, %d, %d)\n", game::SL_ConvertToString(name), model->name, offset, *index);
|
||||||
if (result)
|
return result;
|
||||||
{
|
|
||||||
console::debug("using tag_weapon instead of %s (%s, %d)\n", game::SL_ConvertToString(name), model->name, offset);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*index = original_index;
|
||||||
|
result = original_result;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user