Initial commit

This commit is contained in:
drof
2026-11-05 02:19:09 +01:00
commit 13f8503697
125 changed files with 17029 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
#pragma once
namespace respawn
{
class c_base_client
{
public:
client_class* get_all_classes()
{
return vfunc::call<12, client_class*>(this);
}
private:
};
}
+178
View File
@@ -0,0 +1,178 @@
#ifndef IN_BUTTONS_H
#define IN_BUTTONS_H
#ifdef _WIN32
#pragma once
#endif
#define IN_ATTACK (1 << 0)
#define IN_JUMP (1 << 1)
#define IN_DUCK (1 << 2)
#define IN_FORWARD (1 << 3)
#define IN_BACK (1 << 4)
#define IN_USE (1 << 5)
#define IN_CANCEL (1 << 6)
#define IN_LEFT (1 << 7)
#define IN_RIGHT (1 << 8)
#define IN_MOVELEFT (1 << 9)
#define IN_MOVERIGHT (1 << 10)
#define IN_ATTACK2 (1 << 11)
#define IN_RUN (1 << 12)
#define IN_RELOAD (1 << 13)
#define IN_ALT1 (1 << 14)
#define IN_ALT2 (1 << 15)
#define IN_SCORE (1 << 16) // Used by client.dll for when scoreboard is held down
#define IN_SPEED (1 << 17) // Player is holding the speed key
#define IN_WALK (1 << 18) // Player holding walk key
#define IN_ZOOM (1 << 19) // Zoom key for HUD zoom
#define IN_WEAPON1 (1 << 20) // weapon defines these bits
#define IN_WEAPON2 (1 << 21) // weapon defines these bits
#define IN_BULLRUSH (1 << 22)
#define IN_GRENADE1 (1 << 23) // grenade 1
#define IN_GRENADE2 (1 << 24) // grenade 2
#define IN_ATTACK3 (1 << 25)
#endif // IN_BUTTONS_H
enum button_code_t
{
BUTTON_CODE_INVALID = -1,
BUTTON_CODE_NONE = 0,
KEY_FIRST = 0,
KEY_NONE = KEY_FIRST,
KEY_0,
KEY_1,
KEY_2,
KEY_3,
KEY_4,
KEY_5,
KEY_6,
KEY_7,
KEY_8,
KEY_9,
KEY_A,
KEY_B,
KEY_C,
KEY_D,
KEY_E,
KEY_F,
KEY_G,
KEY_H,
KEY_I,
KEY_J,
KEY_K,
KEY_L,
KEY_M,
KEY_N,
KEY_O,
KEY_P,
KEY_Q,
KEY_R,
KEY_S,
KEY_T,
KEY_U,
KEY_V,
KEY_W,
KEY_X,
KEY_Y,
KEY_Z,
KEY_PAD_0,
KEY_PAD_1,
KEY_PAD_2,
KEY_PAD_3,
KEY_PAD_4,
KEY_PAD_5,
KEY_PAD_6,
KEY_PAD_7,
KEY_PAD_8,
KEY_PAD_9,
KEY_PAD_DIVIDE,
KEY_PAD_MULTIPLY,
KEY_PAD_MINUS,
KEY_PAD_PLUS,
KEY_PAD_ENTER,
KEY_PAD_DECIMAL,
KEY_LBRACKET,
KEY_RBRACKET,
KEY_SEMICOLON,
KEY_APOSTROPHE,
KEY_BACKQUOTE,
KEY_COMMA,
KEY_PERIOD,
KEY_SLASH,
KEY_BACKSLASH,
KEY_MINUS,
KEY_EQUAL,
KEY_ENTER,
KEY_SPACE,
KEY_BACKSPACE,
KEY_TAB,
KEY_CAPSLOCK,
KEY_NUMLOCK,
KEY_ESCAPE,
KEY_SCROLLLOCK,
KEY_INSERT,
KEY_DELETE,
KEY_HOME,
KEY_END,
KEY_PAGEUP,
KEY_PAGEDOWN,
KEY_BREAK,
KEY_LSHIFT,
KEY_RSHIFT,
KEY_LALT,
KEY_RALT,
KEY_LCONTROL,
KEY_RCONTROL,
KEY_LWIN,
KEY_RWIN,
KEY_APP,
KEY_UP,
KEY_LEFT,
KEY_DOWN,
KEY_RIGHT,
KEY_F1,
KEY_F2,
KEY_F3,
KEY_F4,
KEY_F5,
KEY_F6,
KEY_F7,
KEY_F8,
KEY_F9,
KEY_F10,
KEY_F11,
KEY_F12,
KEY_CAPSLOCKTOGGLE,
KEY_NUMLOCKTOGGLE,
KEY_SCROLLLOCKTOGGLE,
KEY_LAST = KEY_SCROLLLOCKTOGGLE,
KEY_COUNT = KEY_LAST - KEY_FIRST + 1,
// Mouse
MOUSE_FIRST = KEY_LAST + 1,
MOUSE_LEFT = MOUSE_FIRST,
MOUSE_RIGHT,
MOUSE_MIDDLE,
MOUSE_4,
MOUSE_5,
MOUSE_WHEEL_UP, // A fake button which is 'pressed' and 'released' when the wheel is moved up
MOUSE_WHEEL_DOWN, // A fake button which is 'pressed' and 'released' when the wheel is moved down
MOUSE_LAST = MOUSE_WHEEL_DOWN,
MOUSE_COUNT = MOUSE_LAST - MOUSE_FIRST + 1,
BUTTON_CODE_LAST,
BUTTON_CODE_COUNT = BUTTON_CODE_LAST - KEY_FIRST + 1,
KEY_XBUTTON_LTRIGGER, // ZAXIS POSITIVE
KEY_XBUTTON_RTRIGGER, // ZAXIS NEGATIVE
KEY_XSTICK2_RIGHT, // UAXIS POSITIVE
KEY_XSTICK2_LEFT, // UAXIS NEGATIVE
KEY_XSTICK2_DOWN, // VAXIS POSITIVE
KEY_XSTICK2_UP, // VAXIS NEGATIVE
};
+26
View File
@@ -0,0 +1,26 @@
#pragma once
namespace respawn
{
class c_convar
{
public:
char pad_0000[24]; //0x0000
char* m_name; //0x0018
char* m_description; //0x0020
char pad_0028[64]; //0x0028
float m_value_float; //0x0068
int32_t m_value_numeric; //0x006C
}; //Size: 0x0154
class c_convar_mgr
{
public:
c_convar* find(const char* name)
{
return vfunc::call<14, c_convar*>(this, name);
}
private:
};
}
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#define LIFE_ALIVE 0 // alive
#define LIFE_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define LIFE_DEAD 2 // dead. lying still.
#define LIFE_RESPAWNABLE 3
#define LIFE_DISCARDBODY 4
#define ENTITY_INDEX_BY_HANDLE(X) ( X & 0xFFFF )
namespace respawn
{
enum client_frame_stages
{
frame_undefined = -1,
frame_start,
frame_net_update_start,
frame_net_update_post_data_update_start,
frame_net_update_post_data_update_end,
frame_net_update_end,
frame_render_start,
frame_render_end,
frame_stage_count,
};
}
+48
View File
@@ -0,0 +1,48 @@
#pragma once
namespace respawn
{
class recv_prop
{
public:
int32_t type; //0x0000
int32_t offset; //0x0004
char pad_0008[24]; //0x0008
class recv_table* data_table; //0x0020
char* name; //0x0028
bool is_inside_array; //0x0030
char pad_0031[7]; //0x0031
class recv_prop* array_prop; //0x0038
void* proxy_fn; //0x0040
char pad_0048[12]; //0x0048
int32_t flags; //0x0054
char pad_0058[4]; //0x0058
int32_t num_elements; //0x005C
}; //Size: 0x0060
class recv_table
{
public:
char pad_0000[8]; //0x0000
recv_prop** props; //0x0008
int32_t num_props; //0x0010
char pad_0014[1196]; //0x0014
void* decoder; //0x04C0
char* name; //0x04C8
bool initialized; //0x04D0
bool in_main_list; //0x04D1
}; //Size: 0x04D2
class client_class
{
public:
void* create_fn; //0x0000
void* create_event_fn; //0x0008
char* network_name; //0x0010
recv_table* table; //0x0018
client_class* next; //0x0020
int32_t id; //0x0028
char pad_002C[4]; //0x002C
char* name; //0x0030
}; //Size: 0x0038
}
+25
View File
@@ -0,0 +1,25 @@
#pragma once
namespace respawn
{
struct player_info_t
{
char pad[512];
};
class c_engine_client
{
public:
VIRTUAL_FUNC(get_local_player, int, 40, (), this);
VIRTUAL_FUNC(is_in_game, bool, 48, (), this);
VIRTUAL_FUNC(get_screen_size, void, 19, (int& w, int& h), this, &w, &h);
VIRTUAL_FUNC(get_player_info, bool, 24, (int idx, player_info_t* buf), this, idx, buf);
VIRTUAL_FUNC(get_view_angles, void, 61, (math::Angle3& out), this, &out);
VIRTUAL_FUNC(set_view_angles, void, 62, (math::Angle3& in), this, &in);
VIRTUAL_FUNC(client_command, int64_t, 22, (const char* cmd), this, cmd);
private:
};
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
namespace respawn
{
class c_engine_trace
{
public:
private:
};
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
namespace respawn
{
class c_engine_vgui
{
public:
private:
};
}
+78
View File
@@ -0,0 +1,78 @@
#pragma once
namespace respawn
{
class c_collision_property
{
public:
NETVAR_FIELD(vec_mins, this, math::Vector3, "DT_CollisionProperty", "m_vecMins");
NETVAR_FIELD(vec_maxs, this, math::Vector3, "DT_CollisionProperty", "m_vecMaxs");
private:
};
class c_client_renderable
{
public:
bool setup_bones(math::matrix3x4* buffer, int count, int mask, float time)
{
return vfunc::call<16, bool>(this, buffer, count, mask, time);
}
private:
};
class c_client_networkable
{
public:
client_class* get_client_class()
{
return vfunc::call<3, client_class*>(this);
}
private:
};
class c_entity
{
public:
DATA_FIELD_NR(renderable, this, c_client_renderable, 0x10);
DATA_FIELD_NR(networkable, this, c_client_networkable, 0x18);
NETVAR_FIELD(identifier, this, PCHAR, "DT_BaseEntity", "m_iSignifierName");
NETVAR_FIELD(script_name_index, this, int, "DT_BaseEntity", "m_scriptNameIndex");
NETVAR_FIELD(model_index, this, int, "DT_BaseEntity", "m_nModelIndex");
NETVAR_FIELD_NR(collision, this, c_collision_property, "DT_BaseEntity", "m_Collision");
DATA_FIELD(anim_sequence, this, int, 0xF80);
DATA_FIELD(model_name, this, char*, 0x30);
DATA_FIELD(origin, this, math::Vector3, 0x14C);
void* get_model();
bool set_model(const char* name);
bool set_model_index(int index);
void set_abs_angles(math::Angle3 angle);
uint32_t get_sequence_activity(int sequence);
uint32_t get_activity_sequence(uint32_t activity);
private:
};
class c_prop_survival : public c_entity
{
public:
NETVAR_FIELD(custom_script_int, this, int, "DT_PropSurvival", "m_customScriptInt");
private:
};
class c_npc : public c_entity
{
public:
NETVAR_FIELD(life_state, this, uint8_t, "DT_AI_BaseNPC", "m_lifeState");
NETVAR_FIELD(health, this, int, "DT_AI_BaseNPC", "m_iHealth");
NETVAR_FIELD(health_max, this, int, "DT_AI_BaseNPC", "m_iMaxHealth");
private:
};
}
+20
View File
@@ -0,0 +1,20 @@
#pragma once
namespace respawn
{
class c_entity_list
{
public:
template < typename T >
auto* get_client_entity(int index)
{
return (T*)vfunc::call<4, T*>(this, index);
}
auto get_highest_entity_index()
{
return vfunc::call<8, int>(this);
}
private:
};
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
namespace respawn
{
class c_file_system
{
public:
private:
};
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
namespace respawn
{
class c_game_movement
{
public:
private:
};
}
+6
View File
@@ -0,0 +1,6 @@
#pragma once
namespace g::p
{
inline c_netvar_manager netvar_mgr{};
}
+20
View File
@@ -0,0 +1,20 @@
#pragma once
namespace respawn
{
class c_global_vars
{
public:
char pad_0000[16]; //0x0000
float Curtime; //0x0010
char pad_0014[12]; //0x0014
float Frametime; //0x0020
char pad_0024[12]; //0x0024
float IntervalPerTick; //0x0030
int32_t MaxClients; //0x0034
char pad_0038[8]; //0x0038
int32_t TickCount; //0x0040
char pad_0044[1052]; //0x0044
}; //Size: 0x0460
static_assert(sizeof(c_global_vars) == 0x460);
}
+28
View File
@@ -0,0 +1,28 @@
#pragma once
namespace respawn
{
class c_input
{
public:
auto* get_user_cmd(int seq_nr)
{
user_cmd_t* result = nullptr;
const auto list_base =
mem::addr(this).Add(0xF8)
.Retrieve_as<uintptr_t>();
constexpr size_t multiplayer_backup = 750;
constexpr size_t list_entry_length = user_cmd_t::size();
result =
mem::addr(list_base)
.Add(list_entry_length * (seq_nr % multiplayer_backup))
.As<decltype(result)>();
return result;
}
private:
};
}
+12
View File
@@ -0,0 +1,12 @@
#pragma once
namespace respawn
{
class c_input_system
{
public:
VIRTUAL_FUNC(is_button_down, bool, 13, (int kc), this, kc);
VIRTUAL_FUNC(get_cursor_pos, void, 36, (int* x, int* y), this, x, y);
private:
};
}
+44
View File
@@ -0,0 +1,44 @@
#pragma once
namespace respawn
{
class c_mat_system_surface
{
public:
void draw_set_color(int r, int g, int b, int a)
{
return vfunc::call<14, void>(this, r, g, b, a);
}
void draw_filled_rect(int x1, int y1, int x2, int y2)
{
return vfunc::call<16, void>(this, x1, y1, x2, y2);
}
void draw_outlined_rect(int x1, int y1, int x2, int y2)
{
return vfunc::call<19, void>(this, x1, y1, x2, y2);
}
void draw_line(int x1, int y1, int x2, int y2)
{
return vfunc::call<20, void>(this, x1, y1, x2, y2);
}
void draw_text(unsigned long font, int size, int x, int y, int r, int g, int b, int a, unsigned int a10, const char* str)
{
return vfunc::call<200, void>(this, font, size, x, y, r, g, b, a, a10, str);
}
void draw_outlined_circle(int x, int y, int radius, int segments)
{
return vfunc::call<125, void>(this, x, y, radius, segments);
}
void get_screen_size(int& wide, int& tall)
{
return vfunc::call<53, void>(this, &wide, &tall);
}
private:
};
}
+404
View File
@@ -0,0 +1,404 @@
#pragma once
namespace math
{
class Vector3
{
public:
Vector3 operator-(const Vector3& other) const
{
return Vector3{ this->x - other.x, this->y - other.y, this->z - other.z };
}
Vector3 operator+(const Vector3& other) const
{
return Vector3{ this->x + other.x, this->y + other.y, this->z + other.z };
}
Vector3& operator*=(const float multiplier)
{
x *= multiplier;
y *= multiplier;
z *= multiplier;
return *this;
}
Vector3 operator*(const Vector3& other) const
{
return { x * other.x, y * other.y, z * other.z };
}
Vector3 operator*(const float& other) const
{
return { x * other, y * other, z * other };
}
[[nodiscard]] FLOAT Length() CONST {
return (x + y + z);
}
[[nodiscard]] FLOAT Length2d() CONST {
return math::sqrtf(x * x + y * y + z * z);
}
[[nodiscard]] FLOAT LengthSquare() CONST {
return (x * x + y * y + z * z);
}
[[nodiscard]] BOOL Empty() CONST {
return (Length() <= 0.0f);
}
[[nodiscard]] FLOAT DistanceTo(Vector3& vOther) CONST
{
CONST AUTO delta = (vOther - *this);
return math::fabsf(delta.LengthSquare());
}
[[nodiscard]] FLOAT DistanceTo(CONST Vector3& vOther) CONST
{
CONST AUTO delta = (vOther - *this);
return math::fabsf(delta.LengthSquare());
}
[[nodiscard]] floating_point_holder3_t<FLOAT> Data() {
return { x, y, z };
}
Vector3 Normalized();
public:
float x, y, z;
protected:
private:
};
class Angle3 {
public:
Angle3 operator-(const Angle3& other) const
{
return Angle3{ this->x - other.x, this->y - other.y, this->z - other.z };
}
Angle3 operator+(const Angle3& other) const
{
return Angle3{ this->x + other.x, this->y + other.y, this->z + other.z };
}
Angle3& operator*=(const float multiplier)
{
x *= multiplier;
y *= multiplier;
z *= multiplier;
return *this;
}
Angle3 operator*(const Angle3& other) const
{
return { x * other.x, y * other.y, z * other.z };
}
Angle3 operator*(const float& other) const
{
return { x * other, y * other, z * other };
}
[[nodiscard]] floating_point_holder3_t<FLOAT> Data() {
return { x, y, z };
}
[[nodiscard]] FLOAT Length() CONST {
return (x + y + z);
}
[[nodiscard]] FLOAT Length2d() CONST {
return math::sqrtf(x * x + y * y + z * z);
}
[[nodiscard]] FLOAT LengthSquare() CONST {
return (x * x + y * y + z * z);
}
[[nodiscard]] BOOL Empty() CONST {
return (Length() <= 0.0f);
}
public:
float x, y, z;
protected:
private:
};
class Vector4 : public Vector3
{
public:
public:
float w;
protected:
private:
};
struct matrix3x4
{
float* operator[](int i)
{
return m_value[i];
}
const float* operator[](int i) const
{
return m_value[i];
}
float* Base()
{
return &m_value[0][0];
}
const float* Base() const
{
return &m_value[0][0];
}
float m_value[3][4];
};
struct matrix4x4
{
float* operator[](int i)
{
return m_value[i];
}
const float* operator[](int i) const
{
return m_value[i];
}
float* Base()
{
return &m_value[0][0];
}
const float* Base() const
{
return &m_value[0][0];
}
float m_value[4][4];
};
struct __declspec(align(16)) matrix3x4a : matrix3x4
{
};
inline constexpr float deg2rad(const float v)
{
return (v * static_cast<float>(M_PI)) / 180.0f;
}
inline constexpr float rad2deg(const float v)
{
return (v * 180.0f) / static_cast<float>(M_PI);
}
inline void sin_cos(float radians, float* sine, float* cosine)
{
*sine = sinf(radians);
*cosine = cosf(radians);
}
inline void VectorAngles(const math::Vector3& forward, math::Angle3& angles)
{
float temp, yaw, pitch;
if (forward.y == 0.0f && forward.x == 0.0f)
{
yaw = 0.0f;
if (forward.z > 0.0f)
{
pitch = 270.0f;
}
else
{
pitch = 90.0f;
}
}
else
{
yaw = math::atan2f(forward.y, forward.x) * 180.0f / static_cast<float>(M_PI);
if (yaw < 0.0f)
{
yaw += 360.0f;
}
temp = math::sqrtf(forward.x * forward.x + forward.y * forward.y);
pitch = math::atan2f(-forward.z, temp) * 180.0f / static_cast<float>(M_PI);
if (pitch < 0.0f)
{
pitch += 360.0f;
}
angles.x = pitch;
angles.y = yaw;
angles.z = 0.0f;
}
}
inline void AngleVectors(const math::Angle3& in, math::Vector3& out)
{
float sp, sy, cp, cy;
sin_cos(deg2rad(in.y), &sy, &cy);
sin_cos(deg2rad(in.x), &sp, &cp);
out.x = cp * cy;
out.y = cp * sy;
out.z = -sp;
}
inline void ClampAngle(Vector3& angle)
{
angle.x = stl::clamp(angle.x, -89.0f, +89.0f);
angle.y = stl::clamp(angle.y, -180.0f, +180.0f);
angle.z = stl::clamp(angle.z, 0.0f, 0.0f);
}
inline void ClampAngle(Angle3& angle)
{
angle.x = stl::clamp(angle.x, -89.0f, +89.0f);
angle.y = stl::clamp(angle.y, -180.0f, +180.0f);
angle.z = stl::clamp(angle.z, 0.0f, 0.0f);
}
inline void NormalizeVector(math::Vector3& in)
{
if (in.x > 89.0f)
{
in.x -= 360.0f;
}
if (in.x < -89.0f)
{
in.x += 360.0f;
}
while (in.y > 180.0f)
{
in.y -= 360.0f;
}
while (in.y < -180.0f)
{
in.y += 360.0f;
}
}
inline void NormalizeAngle(math::Angle3& angle)
{
if (angle.x > 89.0f)
{
angle.x -= 360.0f;
}
if (angle.x < -89.0f)
{
angle.x += 360.0f;
}
while (angle.y > 180.0f)
{
angle.y -= 360.0f;
}
while (angle.y < -180.0f)
{
angle.y += 360.0f;
}
}
constexpr float DotProduct(const math::Vector3& first, const math::Vector3& second)
{
return ((first.x * second.x) + (first.y * second.y) + (first.z * second.z));
}
inline Vector3 Vector3::Normalized()
{
auto temp = *this;
NormalizeVector(temp);
return temp;
}
namespace SE {
FORCEINLINE FLOAT VectorNormalize(Vector3& vec) {
FLOAT radius = math::sqrtf(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z);
FLOAT iradius = 1.f / (radius + FLT_EPSILON);
vec.x *= iradius;
vec.y *= iradius;
vec.z *= iradius;
return radius;
}
FORCEINLINE FLOAT AngleNormalize(FLOAT angle)
{
angle = std::fmodf(angle, 360.0f);
if (angle > 180)
angle -= 360;
if (angle < -180)
angle += 360;
return angle;
}
FORCEINLINE FLOAT AngleNormalizePositive(FLOAT angle)
{
angle = std::fmodf(angle, 360.0f);
if (angle < 0.0f)
angle += 360.0f;
return angle;
}
FORCEINLINE VOID AngleNormalize(Angle3& vec) {
vec.x = stl::clamp(vec.x, -89.f, +89.f);
vec.y = remainderf(vec.y, 360.f);
vec.z = 0.f;
}
__forceinline auto get_fov_difference(Angle3 angle, Vector3 start, Vector3 end)
{
Angle3 aim_angle{};
Vector3 view_position{}, aim_position{};
const Vector3 delta = end - start;
VectorAngles(delta, aim_angle);
AngleVectors(angle, view_position);
AngleVectors(aim_angle, aim_position);
const float aimplsq = aim_position.Length2d();
const auto dotp = static_cast<float>(DotProduct(aim_position, view_position) / aimplsq);
const float vcos = math::acos(dotp);
const float drad = math::rad2deg(vcos);
if (!math::isnan(vcos))
return drad;
return 0.0f;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
#pragma once
namespace respawn
{
class c_model : public c_entity
{
public:
private:
};
class c_model_info
{
public:
int get_model_index(const char* nm)
{
return vfunc::call<2, int>(this, nm);
}
const char* get_model_name(c_model* mdl)
{
return vfunc::call<4, const char*>(this, mdl);
}
private:
};
}
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#define FL_ONGROUND (1<<0) // At rest / on the ground
#define FL_DUCKING (1<<1) // Player flag -- Player is fully crouched
#define FL_WATERJUMP (1<<2) // player jumping out of water
#define FL_ONTRAIN (1<<3) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_INRAIN (1<<4) // Indicates the entity is standing in rain
#define FL_FROZEN (1<<5) // Player is frozen for 3rd person camera
#define FL_ATCONTROLS (1<<6) // Player can't move, but keeps key inputs for controlling another entity
#define FL_CLIENT (1<<7) // Is a player
#define FL_FAKECLIENT (1<<8) // Fake client, simulated server side; don't send network messages to them
// NON-PLAYER SPECIFIC (i.e., not used by GameMovement or the client .dll ) -- Can still be applied to players, though
#define FL_INWATER (1<<9) // In water
+13
View File
@@ -0,0 +1,13 @@
#pragma once
namespace respawn
{
class c_net_chan
{
public:
DATA_FIELD(out_sequence_nr, this, int, 0x4);
DATA_FIELD(num_choked_packets, this, int, 0x10);
DATA_FIELD(stop_sending, this, uint8_t, 0x1A0);
private:
};
}
+63
View File
@@ -0,0 +1,63 @@
#pragma once
struct netvar_t
{
char name[128];
ulong offset;
};
struct netvar_table_t
{
char name[128];
stl::c_linked_list<netvar_t> props;
};
class c_netvar_manager
{
public:
bool initialize();
bool is_prop_garbage(const char* name);
void process_table(respawn::recv_table* table);
void process_prop(respawn::recv_table* table, respawn::recv_prop* prop, stl::c_linked_list<netvar_t>& list);
ulong get(const char* table_name, const char* prop_name) noexcept
{
stl::c_linked_list<netvar_t>* props_head = nullptr;
for (auto i = 0ull; i < m_list.count(); i++)
{
auto* const table = m_list[i];
if (table == nullptr)
continue;
if (stl::strcmp(table_name, table->name))
continue;
props_head = &table->props;
}
if (props_head == nullptr)
return 0;
ulong result{};
for (auto i = 0ull; i < props_head->count(); i++)
{
auto* const prop = (*props_head)[i];
if (!stl::strcmp(prop_name, prop->name))
{
result = prop->offset;
break;
}
}
return result;
}
private:
stl::c_linked_list<netvar_table_t> m_list;
};
#define NETVAR(TABLE, NAME) g::p::netvar_mgr.get(_XS(TABLE), _XS(NAME))
+57
View File
@@ -0,0 +1,57 @@
#pragma once
namespace respawn
{
struct glow_config_t
{
uint8_t general_mode;
uint8_t border_mode;
uint8_t border_len;
uint8_t transp_lvl;
};
class c_player : public c_entity
{
public:
NETVAR_FIELD(flags, this, int, "DT_Player", "m_fFlags");
NETVAR_FIELD(life_state, this, uint8_t, "DT_Player", "m_lifeState");
NETVAR_FIELD(health, this, int, "DT_Player", "m_iHealth");
NETVAR_FIELD(health_max, this, int, "DT_Player", "m_iMaxHealth");
NETVAR_FIELD(view_model, this, int, "DT_Player", "m_hViewModels");
NETVAR_FIELD(armor, this, int, "DT_BaseEntity", "m_shieldHealth");
NETVAR_FIELD(armor_max, this, int, "DT_BaseEntity", "m_shieldHealthMax");
NETVAR_FIELD(team_number, this, int, "DT_BaseEntity", "m_iTeamNum");
NETVAR_FIELD(observer_mode, this, int, "DT_LocalPlayerExclusive", "m_iObserverMode");
NETVAR_FIELD(bleed_out_state, this, int, "DT_Player", "m_bleedoutState");
NETVAR_FIELD(bleed_out_start_time, this, float, "DT_Player", "m_bleedoutStartTime");
NETVAR_FIELD(is_zooming, this, bool, "DT_Player", "m_bZooming");
NETVAR_FIELD(latest_primary_weapon, this, DWORD_PTR, "DT_BaseCombatCharacter", "m_latestPrimaryWeapons");
DATA_FIELD(server_time, this, float, 0x20D8);
DATA_FIELD(last_visible_time, this, float, dyn_offs::_::player::last_visible_time);
DATA_FIELD(glow_enabled, this, int, 0x3C8);
DATA_FIELD(glow_type, this, int, 0x3D0);
DATA_FIELD(glow_config, this, glow_config_t, 0x2C4);
DATA_FIELD(glow_color, this, color_t, 0x1D0);
DATA_FIELD(glow_distance, this, float, 0x3B4);
DATA_FIELD(velocity, this, math::Vector3, 0x140);
DATA_FIELD(view_offset, this, math::Vector3, dyn_offs::_::player::view_offset); // "48 83 EC 38 8B 05 ? ? ? ? 0F 29 74 24 20 83 F8 FF 74 22 0F B7 D0 48 8D 05 ? ? ? ? 48 C1 E2 05 48 03 D0 0F B7 05 ? ? ? ? 39 42 08"
DATA_FIELD(eye_angles, this, math::Angle3, dyn_offs::_::player::eye_angles); // "48 83 EC 58 80 3D ? ? ? ? ? 48 8B 05 ? ? ? ?"
DATA_FIELD(dyn_angles, this, math::Angle3, dyn_offs::_::player::eye_angles - 0x10);
bool is_visible() noexcept;
bool get_bone_position(size_t index, math::Vector3& result) noexcept;
c_weapon* get_active_weapon() noexcept;
c_view_model* get_view_model() noexcept;
private:
};
}
+239
View File
@@ -0,0 +1,239 @@
#pragma once
namespace respawn
{
class c_entity;
struct color_t
{
float r{}, g{}, b{};
};
using create_interface_fn = void* (__fastcall*)(const char*, int*);
namespace type_hash
{
constexpr ulong player = 0x98197a65;
constexpr ulong dummie = 0xf50db101;
}
namespace colors
{
constexpr color_t black = { 0.f, 0.f, 0.f };
constexpr color_t red = { 255.f, 65.f, 65.f };
constexpr color_t green = { 65.f, 255.f, 65.f };
constexpr color_t yellow = { 255.f, 255.f, 65.f };
constexpr color_t blue = { 65.f, 65.f, 255.f };
constexpr color_t white = { 255.f, 255.f, 255.f };
constexpr color_t cyan = { 0.f, 255.f, 221.f };
constexpr color_t purple = { 202.f, 3.f, 252.f };
}
namespace glow_colors
{
constexpr float opacity = 5.f;
constexpr color_t red = { opacity, 1.f, 1.f };
constexpr color_t blue = { 1.f, 1.f, opacity };
constexpr color_t green = { 1.f, opacity, 1.f };
constexpr color_t yellow = { opacity, opacity, 1.f };
constexpr color_t white = { opacity, opacity, opacity };
}
}
#include "defs.h"
#include "math.h"
#include "buttons.h"
#include "move_flags.h"
#include "dt_recv.h"
#include "user_cmd.h"
#include "netvar.h"
#include "global.h"
#include "base_client.h"
#include "shared_client.h"
#include "engine_client.h"
#include "engine_vgui.h"
#include "engine_trace.h"
#include "entity.h"
#include "weapon.h"
#include "view_model.h"
#include "player.h"
#include "entity_list.h"
#include "input.h"
#include "input_system.h"
#include "studio.h"
#include "view_render.h"
#include "model_info.h"
#include "global_vars.h"
#include "game_movement.h"
#include "net_chan.h"
#include "mat_system_surface.h"
#include "cvar.h"
#include "file_system.h"
namespace respawn
{
struct cached_data_t
{
struct
{
int index;
int team_number;
bool zooming;
uintptr_t address;
math::Vector3 origin;
math::Vector3 shoot_pos;
math::Angle3 eye_angle;
} local_player;
struct
{
uintptr_t address;
bool reloading;
bool can_fire;
float next_primary_attack;
float next_ready_time;
} local_weapon;
struct
{
int out_sequence_nr;
int num_choked_packets;
} net_chan;
};
enum crosshair_states
{
CROSSHAIR_STATE_SHOW_ALL = 0,
CROSSHAIR_STATE_HIDE_ALL,
CROSSHAIR_STATE_HIT_INDICATORS_ONLY,
CROSSHAIR_STATE_COUNT,
};
enum class entity_types
{
UNKNOWN,
NONE,
PLAYER,
DUMMIE,
PROWLER,
PROP_SURVIVAL,
PROP_SCRIPT,
PROP_DEATH_BOX,
PROP_DYNAMIC,
};
enum class loot_ids
{
SHIELD_WHITE = 175,
SHIELD_BLUE = 176,
SHIELD_PURP = 177,
SHIELD_RED = 178,
SHIELD_GOLD = 173,
HELMET_WHITE = 166,
HELMET_BLUE = 167,
HELMET_PURP = 168,
HELMET_GOLD = 169,
BACKPACK_WHITE = 184,
BACKPACK_BLUE = 185,
BACKPACK_PURP = 186,
BACKPACK_GOLD = 187,
WEAPON_KRABER = 1,
WEAPON_G7_SCOUT = 37,
WEAPON_ALTERNATOR = 42,
WEAPON_SPITFIRE = 68,
WEAPON_CHARGE_RIFLE = 63,
AMMO_ENERGY = 121,
AMMO_SHOTGUN = 122,
AMMO_ARROW = 125,
AMMO_HEAVY = 123,
AMMO_LIGHT = 120,
AMMO_SNIPER = 124,
ATTACHMENT_BARREL_STABILIZER_BLUE = 202,
ATTACHMENT_BARREL_STABILIZER_PURP = 203,
ATTACHMENT_MAGAZINE_LIGHT_PURP = 207,
ATTACHMENT_MAGAZINE_LIGHT_GOLD = 208,
};
enum class game_modes
{
invalid = 0,
survival,
arenas,
control,
};
inline stl::c_linked_list<std::pair<uint64_t, entity_types>> _ident_table;
inline stl::c_string_table _heirloom_table;
extern bool initialize();
extern respawn::c_player* get_local_player();
extern respawn::color_t get_player_color(respawn::c_player* player);
extern void* create_interface(const char* name);
extern int get_sequence_count(void* model);
extern mstudioseqdesc_t* seq_desc(void* model, int sequence);
extern entity_types get_entity_type(c_entity* entity);
extern uint64_t get_entity_identifier(c_entity* entity);
extern bool is_player(respawn::c_entity* entity, bool player = true, bool dummy = true);
extern bool is_survival_prop(respawn::c_entity* entity);
extern bool is_script_prop(respawn::c_entity* entity);
extern bool is_of_type(respawn::c_entity* entity, const char* name);
extern bool is_alive(respawn::c_player* player);
extern bool is_knocked(respawn::c_player* player);
extern game_modes get_game_mode();
extern void start_drawing(respawn::c_mat_system_surface* mssf);
extern void finish_drawing();
extern bool world_to_screen(math::Vector3& vIn, math::Vector3& vOut);
extern void on_update_cache(respawn::c_player* me, respawn::c_weapon* my_wpn, respawn::c_net_chan* nc);
extern bool is_teammate(c_player* player);
extern bool get_entity_center_pos(respawn::c_entity* entity, math::Vector3& result);
enum class bone_id
{
head = 8,
neck = 7,
torso_upper = 5,
torso_center = 3,
torso_lower = 2,
spine = 1,
};
constexpr size_t bone_count = 13;
__forceinline auto is_dummy(respawn::c_entity* entity) noexcept
{
return is_player(entity, false, true);
}
__forceinline auto is_playing() noexcept
{
return (g::is_in_game && g::is_playing);
}
namespace script
{
extern void dump_to_disk(const char* name, char* buffer, size_t length);
extern void override_from_disk(const char* name, char* buffer, size_t* length);
}
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
namespace respawn
{
class c_shared_client
{
public:
private:
};
}
+21
View File
@@ -0,0 +1,21 @@
#pragma once
namespace respawn
{
#pragma pack( push, 1 )
struct mstudioseqdesc_t
{
int baseptr;
int szlabelindex;
inline char* const pszLabel(void) const
{
return ((char*)this) + szlabelindex;
}
int szactivitynameindex;
inline char* const pszActivityName(void) const
{
return ((char*)this) + szactivitynameindex;
}
};
#pragma pack( pop )
}
+21
View File
@@ -0,0 +1,21 @@
#pragma once
namespace respawn
{
struct user_cmd_t
{
inline static constexpr size_t size() { return 0x218; }
int command_number;
int tick_count;
float command_time;
math::Angle3 viewangles;
BYTE _pad0[0x14];
float forwardmove;
float sidemove;
float upmove;
int buttons;
BYTE impulse;
BYTE _pad1[472];
};
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
namespace respawn
{
class c_view_model : public c_entity
{
public:
private:
};
}
+14
View File
@@ -0,0 +1,14 @@
#pragma once
namespace respawn
{
class c_view_render
{
public:
d3d::D3DMATRIX* get_view_matrix()
{
return *reinterpret_cast<d3d::D3DMATRIX**>(mem::addr(this).Base() + 0x10E8D0);
}
private:
};
}
+27
View File
@@ -0,0 +1,27 @@
#pragma once
namespace respawn
{
FORWARD_DECLARE(c_player);
enum class weapon_name_indexes : int
{
hands = 18,
};
class c_weapon : public c_entity
{
public:
NETVAR_FIELD(is_reloading, this, bool, "DT_WeaponX_LocalWeaponData", "m_bInReload");
NETVAR_FIELD(next_primary_attack, this, float, "DT_WeaponX_LocalWeaponData", "m_nextPrimaryAttackTime");
NETVAR_FIELD(next_ready_time, this, float, "DT_WeaponX_LocalWeaponData", "m_nextReadyTime");
NETVAR_FIELD(name_index, this, weapon_name_indexes, "DT_WeaponX", "m_weaponNameIndex");
DATA_FIELD(projectile_speed, this, float, 0x1F18);
DATA_FIELD(projectile_gravity, this, float, 0x1F20);
bool can_fire(c_player* owner) noexcept;
void set_legendary_view_model_index(int64_t idx) noexcept;
private:
};
}