summaryrefslogtreecommitdiffstats
path: root/src/esp_internal.h
blob: 1ffdd7a72618f605354bbf70f45de64d0b31b4b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef HL2H_ESP_INTERNAL_H
#define HL2H_ESP_INTERNAL_H

// Helpers shared between the ESP translation units (esp.cpp, items.cpp,
// projectiles.cpp). Everything here has internal linkage semantics but is
// exported across those TUs, so it lives in the shared header instead of being
// repeated.

#include "hl2h.h"
#include <cstdint>

extern int g_scr_w, g_scr_h;

enum { LIFE_ALIVE = 0 };
enum NpcDamageClass {
  NPC_DMG_NORMAL = 0,
  NPC_DMG_ARMORED,    // only blast damage (RPG) hurts it
  NPC_DMG_VULNERABLE, // gravity gun / physics damage works well
  NPC_DMG_IMMUNE      // m_takedamage says no damage at all
};

bool is_npc_class(const char *name);
bool npc_is_friendly(int idx, const char *model, int local_idx, bool &neutral);
bool npc_can_be_damaged(int idx, const char *model);
int npc_damage_class(int idx, const char *model);
QAngle angle_to(const Vector &from, const Vector &to);
bool punch_angles(float &px, float &py);
int entptr_lookup(void *ent);
void entptr_store(void *ent, int idx);
void weapon_short_name(int idx, char *out, size_t outn);
void short_name(const char *model, char *out, size_t outn);

// Listen-server sanity latch, shared with esp_collect().
extern bool g_srv_checked;
extern bool g_srv_trusted;

double esp_now();
bool esp_update_screen();

// entity helpers
void *entity_networkable(int idx);
const char *entity_class_name(void *net, void **out_cc);
const char *entity_model_name(void *ent);
const char *model_name_from_index(int modelindex);
bool entity_origin(void *ent, Vector &out);
bool entity_is_dormant(void *net);
bool active_weapon_contains(void *local_ent, const char *needle);
bool item_weapon_is_owned(void *ent);

// drawing primitives
void surf_rect(int filled, int x0, int y0, int x1, int y1);
void surf_color(int r, int g, int b, int a);
void surf_line(int x0, int y0, int x1, int y1);
QAngle engine_view_angles();
bool project_segment(const Vector &a, const Vector &b, int &x0, int &y0,
                     int &x1, int &y1);

#endif