summaryrefslogtreecommitdiffstats
path: root/src/hl2h.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hl2h.cpp')
-rw-r--r--src/hl2h.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/hl2h.cpp b/src/hl2h.cpp
index c6c0aeb..01fdb0f 100644
--- a/src/hl2h.cpp
+++ b/src/hl2h.cpp
@@ -32,7 +32,8 @@ void logf(const char *fmt, ...) {
32Module g_client, g_engine; 32Module g_client, g_engine;
33GameInterfaces g_iface; 33GameInterfaces g_iface;
34NetVars g_net; 34NetVars g_net;
35uintptr_t g_input = 0; 35Vector g_cam_eye{0, 0, 0};
36Vector g_cam_view{0, 0, 0};
36 37
37// --------------------------------------------------------------------------- 38// ---------------------------------------------------------------------------
38// vector math 39// vector math
@@ -81,7 +82,7 @@ float getfov(const QAngle &my_view, const QAngle &aim_ang) {
81} 82}
82 83
83// --------------------------------------------------------------------------- 84// ---------------------------------------------------------------------------
84// feature logic (bhop, ABH, climb) 85// feature logic (bhop, ABH)
85// --------------------------------------------------------------------------- 86// ---------------------------------------------------------------------------
86 87
87static int g_modified_logged = 0; 88static int g_modified_logged = 0;
@@ -103,19 +104,16 @@ void note_modified(const CUserCmd *cmd, int flags, const float *vel) {
103 104
104static bool g_logged_local = false; 105static bool g_logged_local = false;
105 106
106static int engine_get_local_player() { 107int engine_get_local_player() {
107 using Fn = int (*)(void *); 108 using Fn = int (*)(void *);
108 return vfunc<Fn>(g_iface.engine, 12)(g_iface.engine); 109 return vfunc<Fn>(g_iface.engine, 12)(g_iface.engine);
109} 110}
110 111
111static void *entitylist_get(int idx) { 112void *entitylist_get(int idx) {
112 using Fn = void *(*)(void *, int); 113 using Fn = void *(*)(void *, int);
113 return vfunc<Fn>(g_iface.entitylist, 3)(g_iface.entitylist, idx); 114 return vfunc<Fn>(g_iface.entitylist, 3)(g_iface.entitylist, idx);
114} 115}
115 116
116
117
118
119static void do_move(int seq) { 117static void do_move(int seq) {
120 static bool g_echo_sent = false; 118 static bool g_echo_sent = false;
121 if (!g_input || !g_net.ok()) 119 if (!g_input || !g_net.ok())
@@ -148,6 +146,9 @@ static void do_move(int seq) {
148 return; 146 return;
149 147
150 uintptr_t e = (uintptr_t)ent; 148 uintptr_t e = (uintptr_t)ent;
149 g_cam_eye = {*(float *)(e + g_net.origin), *(float *)(e + g_net.origin + 4), *(float *)(e + g_net.origin + 8)};
150 g_cam_eye.z += *(float *)(e + g_net.viewoffset);
151 g_cam_view = {cmd->viewangles[0], cmd->viewangles[1], cmd->viewangles[2]};
151 int flags = *(int *)(e + g_net.flags); 152 int flags = *(int *)(e + g_net.flags);
152 bool onground = (flags & FL_ONGROUND) != 0; 153 bool onground = (flags & FL_ONGROUND) != 0;
153 bool inwater = (flags & FL_INWATER) != 0; 154 bool inwater = (flags & FL_INWATER) != 0;