240 lines
5.1 KiB
C++
240 lines
5.1 KiB
C++
#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);
|
|
}
|
|
}
|