From c91c7248fcb3911a8a2b6442d8657167364a911c Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 21:11:32 +0100 Subject: Stucklaunch: fix prop detection and add diagnostics - Client physics props are CPhysicsProp/CPhysBox, not the server class prop_physics; the old case-sensitive class check never matched. Detect MOVETYPE_VPHYSICS first (the reliable signal), then case-insensitive class/model patterns. - Log the first few prop checks with index, movetype, class and model so a failed ground lookup is diagnosable. - Log once when Stucklaunch is active (with run state, bind and ground offset), when it engages, and when the ground is not a prop. - Toast a warning when binding a feature that is not Active yet. --- src/hl2h.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/hl2h.cpp') diff --git a/src/hl2h.cpp b/src/hl2h.cpp index 84de815..defdd27 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -172,8 +172,14 @@ static void apply_autostrafe(CUserCmd *cmd, const float *vel) { // True while the player stands on (or just left) a physics prop. m_hGroundEntity // is latched briefly because it clears during each hop. static bool stucklaunch_prop_ok(void *ent, int tick) { - if (g_net.groundentity < 0) + if (g_net.groundentity < 0) { + static bool logged = false; + if (!logged) { + logged = true; + logf("stucklaunch: m_hGroundEntity unavailable; prop detection off"); + } return true; // no netvar: the bind is the only safeguard + } static int last_prop_tick = -100000; uint32_t h = *(uint32_t *)((uintptr_t)ent + g_net.groundentity); int gi = (h == 0xFFFFFFFFu) ? 0 : (int)(h & 0xFFFF); @@ -182,9 +188,15 @@ static bool stucklaunch_prop_ok(void *ent, int tick) { static int prop_logs = 0; if (prop_logs < 4) { prop_logs++; - logf("stucklaunch: prop idx=%d", gi); + logf("stucklaunch: prop idx=%d engaged", gi); } last_prop_tick = tick; + } else { + static int miss_logs = 0; + if (miss_logs < 4) { + miss_logs++; + logf("stucklaunch: ground h=%#x idx=%d is not a physics prop", h, gi); + } } return tick - last_prop_tick < 32; // ~0.5 s at 66 tick } @@ -194,6 +206,11 @@ static bool stucklaunch_prop_ok(void *ent, int tick) { // gun's +attack) to keep regrabbing the prop, and air-strafes the hops. static void stucklaunch_apply(CUserCmd *cmd, void *local_ent, bool onground, const float *vel) { + static bool engaged_logged = false; + if (!engaged_logged) { + engaged_logged = true; + logf("stucklaunch: applying jump/spam (onground=%d)", (int)onground); + } cmd->buttons |= IN_JUMP; int period = stucklaunch_spam_ticks(); if (period < 1) @@ -629,6 +646,14 @@ static void do_move(int seq, float frametime) { } bool stuck_on = feature_active(FEAT_STUCKLAUNCH); + if (g_stucklaunch.active) { + static bool state_logged = false; + if (!state_logged) { + state_logged = true; + logf("stucklaunch: active=1 run=%d bind=%d groundoff=%d", + (int)stuck_on, g_stucklaunch.bind, g_net.groundentity); + } + } bool stuck_engaged = stuck_on && stucklaunch_prop_ok(ent, cmd->tick_count); if (stuck_engaged) { stucklaunch_apply(cmd, ent, onground, vel); -- cgit v1.2.3