69 lines
1.4 KiB
C++
69 lines
1.4 KiB
C++
#include <include.h>
|
|
|
|
using namespace respawn;
|
|
|
|
bool c_player::is_visible() noexcept
|
|
{
|
|
const auto curr_time = *gv::engine_time;
|
|
const auto visible_time = last_visible_time();
|
|
const auto visible_time_cp = visible_time + 1.f;
|
|
|
|
if (visible_time_cp >= curr_time)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool c_player::get_bone_position(size_t index, math::Vector3& result) noexcept
|
|
{
|
|
auto my_origin = origin();
|
|
auto bone_cache_base = *(uintptr_t*)(BASE_OF(this) + 0xF38);
|
|
auto bone_cache_offs = (index * 0x30);
|
|
|
|
if (!bone_cache_base)
|
|
return false;
|
|
|
|
result =
|
|
{
|
|
my_origin.x + *(float*)(bone_cache_base + bone_cache_offs + 0xCC),
|
|
my_origin.y + *(float*)(bone_cache_base + bone_cache_offs + 0xDC),
|
|
my_origin.z + *(float*)(bone_cache_base + bone_cache_offs + 0xEC),
|
|
};
|
|
|
|
return true;
|
|
}
|
|
|
|
c_weapon* c_player::get_active_weapon() noexcept
|
|
{
|
|
int wpn_index{ };
|
|
ulong wpn_handle = latest_primary_weapon();
|
|
|
|
if (!wpn_handle)
|
|
return nullptr;
|
|
|
|
wpn_index = ENTITY_INDEX_BY_HANDLE(wpn_handle);
|
|
|
|
if (!wpn_index)
|
|
return nullptr;
|
|
|
|
return ix::entity_list->get_client_entity<c_weapon>(wpn_index);
|
|
}
|
|
|
|
c_view_model* c_player::get_view_model() noexcept
|
|
{
|
|
int vm_index{ };
|
|
ulong vm_handle = view_model();
|
|
|
|
if (!vm_handle)
|
|
return nullptr;
|
|
|
|
vm_index = ENTITY_INDEX_BY_HANDLE(vm_handle);
|
|
|
|
if (!vm_index)
|
|
return nullptr;
|
|
|
|
return ix::entity_list->get_client_entity<c_view_model>(vm_index);
|
|
}
|