Skip to content

Commit

Permalink
Draw mesh shape
Browse files Browse the repository at this point in the history
  • Loading branch information
zer0k-z committed Nov 17, 2024
1 parent 978a1c6 commit 745cf49
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
6 changes: 5 additions & 1 deletion gamedata/cs2kz-core.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/kz/mode/kz_mode_ckz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions src/utils/interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
{
}

Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 745cf49

Please sign in to comment.