From 745cf498a5086bcf9d3bdc0e032984a3c3382e70 Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Sun, 17 Nov 2024 22:58:08 +0100 Subject: [PATCH] Draw mesh shape --- gamedata/cs2kz-core.games.txt | 6 +++++- src/kz/mode/kz_mode_ckz.cpp | 7 ++++--- src/utils/interfaces.h | 7 +++++-- src/utils/utils.cpp | 3 ++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gamedata/cs2kz-core.games.txt b/gamedata/cs2kz-core.games.txt index d03e3575..c2a88974 100644 --- a/gamedata/cs2kz-core.games.txt +++ b/gamedata/cs2kz-core.games.txt @@ -79,7 +79,11 @@ "library" "server" "windows" "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x81\xEC\xA0\x00\x00\x00\x48\x83\x3D\x79\xC6\xDF\x00\x00" } - + "DebugDrawMesh" + { + "library" "server" + "windows" "\x48\x89\x4C\x24\x08\x55\x53\x57\x41\x54\x41\x55\x48\x8D\x6C\x24\x90" + } //*(a2 + 200) = sub_7FFE4786BD30(a1->pawn); <- this function // v23 = a1->pawn; // a1->m_bInStuckTest = 0; diff --git a/src/kz/mode/kz_mode_ckz.cpp b/src/kz/mode/kz_mode_ckz.cpp index 48aea155..845d102e 100644 --- a/src/kz/mode/kz_mode_ckz.cpp +++ b/src/kz/mode/kz_mode_ckz.cpp @@ -807,13 +807,14 @@ void KZClassicModeService::OnTryPlayerMove(Vector *pFirstDest, trace_t *pFirstTr if (ray.ray.m_Mesh.m_nNumVertices == 3) { g_pKZUtils->AddTriangleOverlay(ray.ray.m_Mesh.m_pVertices[0], ray.ray.m_Mesh.m_pVertices[1], - ray.ray.m_Mesh.m_pVertices[2], 255, 0, 0, 200, true, 12.0f); + ray.ray.m_Mesh.m_pVertices[2], 255, 0, 0, 200, true, 20.0); } else { CTransform transform; transform.SetToIdentity(); - g_pKZUtils->DebugDrawRay(&ray.ray, transform, 255, 0, 0, 0, 1, 20.0); + g_pKZUtils->DebugDrawMesh(transform, ray.ray, 255, 0, 0, 128, true, true, 20.0f); + // g_pKZUtils->DebugDrawRay(&ray.ray, transform, 255, 0, 0, 0, 1, 20.0); } META_CONPRINTF("\n"); break; @@ -916,7 +917,7 @@ void KZClassicModeService::OnTryPlayerMove(Vector *pFirstDest, trace_t *pFirstTr } else { - if (pm.m_hShape) + if (pm.m_hShape && false) { RayExtended ray; g_pKZUtils->SetupRayFromTrace(&ray, pm); diff --git a/src/utils/interfaces.h b/src/utils/interfaces.h index 3939ee58..b9a07683 100644 --- a/src/utils/interfaces.h +++ b/src/utils/interfaces.h @@ -40,6 +40,7 @@ typedef void SwitchTeam_t(CCSPlayerController *controller, int team); typedef void SetPawn_t(CBasePlayerController *controller, CCSPlayerPawn *pawn, bool, bool, bool); typedef void SetupRayFromTrace_t(RayExtended *pThis, trace_t &pm); typedef void DebugDrawRay_t(Ray_t *pThis, CTransform &transform, i32 r, i32 g, i32 b, i32 a, bool ignoreZ, f32 duration); +typedef void DebugDrawMesh_t(CTransform &transform, Ray_t &ray, i32 r, i32 g, i32 b, i32 a, bool solid, bool ignoreZ, f32 duration); namespace interfaces { @@ -76,10 +77,11 @@ class KZUtils public: KZUtils(TracePlayerBBox_t *TracePlayerBBox, InitGameTrace_t *InitGameTrace, InitPlayerMovementTraceFilter_t *InitPlayerMovementTraceFilter, GetLegacyGameEventListener_t *GetLegacyGameEventListener, SnapViewAngles_t *SnapViewAngles, EmitSoundFunc_t *EmitSound, - SwitchTeam_t *SwitchTeam, SetPawn_t *SetPawn, SetupRayFromTrace_t *SetupRayFromTrace, DebugDrawRay_t *DebugDrawRay) + SwitchTeam_t *SwitchTeam, SetPawn_t *SetPawn, SetupRayFromTrace_t *SetupRayFromTrace, DebugDrawRay_t *DebugDrawRay, + DebugDrawMesh_t *DebugDrawMesh) : TracePlayerBBox(TracePlayerBBox), InitGameTrace(InitGameTrace), InitPlayerMovementTraceFilter(InitPlayerMovementTraceFilter), GetLegacyGameEventListener(GetLegacyGameEventListener), SnapViewAngles(SnapViewAngles), EmitSound(EmitSound), SwitchTeam(SwitchTeam), - SetPawn(SetPawn), SetupRayFromTrace(SetupRayFromTrace), DebugDrawRay(DebugDrawRay) + SetPawn(SetPawn), SetupRayFromTrace(SetupRayFromTrace), DebugDrawRay(DebugDrawRay), DebugDrawMesh(DebugDrawMesh) { } @@ -93,6 +95,7 @@ class KZUtils SetPawn_t *const SetPawn; SetupRayFromTrace_t *const SetupRayFromTrace; DebugDrawRay_t *const DebugDrawRay; + DebugDrawMesh_t *const DebugDrawMesh; virtual CGameConfig *GetGameConfig(); virtual const CGlobalVars *GetServerGlobals(); diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 9c016ef3..9f2ab457 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -78,9 +78,10 @@ bool utils::Initialize(ISmmAPI *ismm, char *error, size_t maxlen) RESOLVE_SIG(g_pGameConfig, "CBasePlayerController_SetPawn", SetPawn_t, SetPawn); RESOLVE_SIG(g_pGameConfig, "SetupRayFromTrace", SetupRayFromTrace_t, SetupRayFromTrace); RESOLVE_SIG(g_pGameConfig, "DebugDrawRay", DebugDrawRay_t, DebugDrawRay); + RESOLVE_SIG(g_pGameConfig, "DebugDrawMesh", DebugDrawMesh_t, DebugDrawMesh); g_pKZUtils = new KZUtils(TracePlayerBBox, InitGameTrace, InitPlayerMovementTraceFilter, GetLegacyGameEventListener, SnapViewAngles, EmitSound, - SwitchTeam, SetPawn, SetupRayFromTrace, DebugDrawRay); + SwitchTeam, SetPawn, SetupRayFromTrace, DebugDrawRay, DebugDrawMesh); utils::UnlockConVars(); utils::UnlockConCommands();