Тьомчик
-
Автор темы
- #1
//--------------------------------------------------------------------------------
C++:
void __fastcall hkFrameStageNotify(void* _this, int edx, ClientFrameStage_t stage)
{
static auto ofunc = hlclient_hook.get_original<decltype(&hkFrameStageNotify)>(index::FrameStageNotify);
if (g_EngineClient->IsInGame()) {
//if (stage != ClientFrameStage_t::FRAME_RENDER_START && stage != ClientFrameStage_t::FRAME_RENDER_END)
// return;
if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
skins::on_frame_stage_notify(false);
else if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_END)
skins::on_frame_stage_notify(true);
static int originalIdx = 0;
if (!g_LocalPlayer) {
originalIdx = 0;
return;
}
constexpr auto getModel = [](int team) constexpr noexcept -> const char* {
constexpr std::array models{
"models/player/custom_player/legacy/ctm_fbi_variantb.mdl",
"models/player/custom_player/legacy/ctm_fbi_variantf.mdl",
"models/player/custom_player/legacy/ctm_fbi_variantg.mdl",
"models/player/custom_player/legacy/ctm_fbi_varianth.mdl",
"models/player/custom_player/legacy/ctm_sas_variantf.mdl",
"models/player/custom_player/legacy/ctm_st6_variante.mdl",
"models/player/custom_player/legacy/ctm_st6_variantg.mdl",
"models/player/custom_player/legacy/ctm_st6_varianti.mdl",
"models/player/custom_player/legacy/ctm_st6_variantk.mdl",
"models/player/custom_player/legacy/ctm_st6_variantm.mdl",
"models/player/custom_player/legacy/tm_balkan_variantf.mdl",
"models/player/custom_player/legacy/tm_balkan_variantg.mdl",
"models/player/custom_player/legacy/tm_balkan_varianth.mdl",
"models/player/custom_player/legacy/tm_balkan_varianti.mdl",
"models/player/custom_player/legacy/tm_balkan_variantj.mdl",
"models/player/custom_player/legacy/tm_leet_variantf.mdl",
"models/player/custom_player/legacy/tm_leet_variantg.mdl",
"models/player/custom_player/legacy/tm_leet_varianth.mdl",
"models/player/custom_player/legacy/tm_leet_varianti.mdl",
"models/player/custom_player/legacy/tm_phoenix_variantf.mdl",
"models/player/custom_player/legacy/tm_phoenix_variantg.mdl",
"models/player/custom_player/legacy/tm_phoenix_varianth.mdl"
};
switch (team) {
case 2: return static_cast<std::size_t>(g_Options.playerModelT - 1) < models.size() ? models[g_Options.playerModelT - 1] : nullptr;
case 3: return static_cast<std::size_t>(g_Options.playerModelCT - 1) < models.size() ? models[g_Options.playerModelCT - 1] : nullptr;
default: return nullptr;
}
};
if (const auto model = getModel(g_LocalPlayer->m_iTeamNum())) {
if (stage == FRAME_RENDER_START)
originalIdx = g_LocalPlayer->m_nModelIndex();
const auto idx = stage == FRAME_RENDER_END && originalIdx ? originalIdx : g_MdlInfo->GetModelIndex(model);
g_LocalPlayer->setModelIndex(idx);
if (const auto ragdoll = g_LocalPlayer->get_entity_from_handle(g_LocalPlayer->m_hRagdoll()))
ragdoll->setModelIndex(idx);
}
}
ofunc(g_CHLClient, edx, stage);
}