Initial commit
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
#include <include.h>
|
||||
|
||||
using namespace respawn;
|
||||
|
||||
void* c_entity::get_model()
|
||||
{
|
||||
auto address = DYN_ADDR("fn_get_model");
|
||||
using type = void* (__thiscall*)(void*);
|
||||
|
||||
return reinterpret_cast<type>(address)(this);
|
||||
}
|
||||
|
||||
bool c_entity::set_model(const char* name)
|
||||
{
|
||||
auto address = DYN_ADDR("fn_set_model");
|
||||
using type = bool(__thiscall*)(void*, const char*);
|
||||
|
||||
return reinterpret_cast<type>(address)(this, name);
|
||||
}
|
||||
|
||||
bool c_entity::set_model_index(int index)
|
||||
{
|
||||
auto address = DYN_ADDR("fn_set_model_index");
|
||||
using type = bool(__thiscall*)(void*, int);
|
||||
|
||||
return reinterpret_cast<type>(address)(this, index);
|
||||
}
|
||||
|
||||
void c_entity::set_abs_angles(math::Angle3 angle)
|
||||
{
|
||||
auto address = DYN_ADDR("fn_set_abs_angles");
|
||||
using type = void(__thiscall*)(void*, math::Angle3);
|
||||
|
||||
return reinterpret_cast<type>(address)(this, angle);
|
||||
}
|
||||
|
||||
uint32_t c_entity::get_sequence_activity(int sequence)
|
||||
{
|
||||
auto model = get_model();
|
||||
|
||||
if (model)
|
||||
{
|
||||
auto desc = respawn::seq_desc(model, sequence);
|
||||
|
||||
if (desc)
|
||||
{
|
||||
auto name = desc->pszActivityName();
|
||||
|
||||
if (name && *name)
|
||||
return util::string_hash(name, stl::strlen(name));
|
||||
}
|
||||
}
|
||||
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
||||
uint32_t c_entity::get_activity_sequence(uint32_t activity)
|
||||
{
|
||||
if (activity != UINT32_MAX)
|
||||
{
|
||||
auto model = get_model();
|
||||
|
||||
if (model)
|
||||
{
|
||||
auto seqcount = get_sequence_count(model);
|
||||
|
||||
for (int sequence = 0; sequence < seqcount; sequence++)
|
||||
{
|
||||
auto desc = respawn::seq_desc(model, sequence);
|
||||
|
||||
if (desc)
|
||||
{
|
||||
auto name = desc->pszActivityName();
|
||||
|
||||
if (name && *name && util::string_hash(name, stl::strlen(name)) == activity)
|
||||
return sequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return UINT32_MAX;
|
||||
}
|
||||
Reference in New Issue
Block a user