38 Commits

Author SHA1 Message Date
Kawe Mazidjatari
59b685b7ee Fix unreachable code warning
This code isn't reachable, removed.
2023-04-23 20:35:08 +02:00
Kawe Mazidjatari
1ef5287b56 /W4: Fixed name shadowing bug
'DrawAllOverlays' gets called with a boolean parameter indicating whether or not the render frame should be ran. This is so the rest of the logic could run in order to decay overlays to avoid memory leak or unnecessary high CPU time in overlay timing code. Parameter name has been renamed from 'bDraw' to 'bRender', and the local variable 'bDraw' which caused the shadow warning, has been renamed to 'bShouldDraw'. The local variable 'bOverlayEnabled' now takes into account the 'bRender' parameter.
2023-04-02 09:27:54 +02:00
Kawe Mazidjatari
2bf86375d7 /W4: Fix unreachable code 2023-04-02 02:17:52 +02:00
Kawe Mazidjatari
a618990937 Detour code refactor
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files.
Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer.

TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
2023-01-25 02:26:52 +01:00
Kawe Mazidjatari
19447f1122 Improve debug draw depth test toggle logic
* Add box depth test cvar from engine for 'CBaseAnimating::DrawServerHitboxes'.
* Use noDepthTest field from OverlayBox_t instead of the cvar.
2023-01-24 12:05:09 +01:00
Kawe Mazidjatari
502a1d2324 Switch box overlay transform type to 'matrix3x4_t'
Actual type turned out to be 'matrix3x4_t' after further reverse engineering.
2023-01-23 02:20:21 +01:00
Kawe Mazidjatari
95a544cdb9 Fix progressively increasing CPU time in PurgeServerOverlays() when enable_debug_overlays is unset
The default engine implementation of DrawAllOverlays will return early when cvar 'enable_debug_overlays' is false. The problem with this is that overlays are still added, which fills memory unnecessarily and also increases CPU time as they never decay, which overloads the function 'PurgeServerOverlays'. This became evident after profiling the application. Numerous people reported the bug.
2022-11-10 02:40:34 +01:00
Kawe Mazidjatari
2a86970f12 Fix Smart Pistol's trajectory trace (laser line)
The smart pistol's laser line overlay did not draw after the debug overlay rebuild. After some small debugging, I found out that there was a function that creates the curved trace, and creates an overlay with index 4 (originally swept_box), however, the structure is different to that of swept_box. This is laser_line. Implemented logic for drawing out laser line, which essentially just calls DrawLine (as is the case in the engine).
2022-10-30 23:38:19 +01:00
Kawe Mazidjatari
69491acb49 Additional NavMesh draw optimizations using SIMD
* Construct min/max for AI Script Network boxes using SIMD (significantly reduced instruction count!).
* Move NavMesh debug draw to dedicated class for future changes.
2022-09-30 01:16:26 +02:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +02:00
Kawe Mazidjatari
5548a74d59 Major cleanup (see description)
* Fix all compiler error for GameSDK on S0 and S1.
* Remove some unused patterns and globals (launch performance gains of 100ms).
* Remove most duplicate patterns.
* Relocate globals from engine to a more appropriate location.
* Renamed some unknown vars to a more appropriate name (most of these where obtained a while back, but as we reversed more parts of the engine, some of these vars become known).
* Renamed some vars to fit the naming convention used in the SDK.
* Fixed pattern debug logging using the wrong pointer, thus displaying the wrong address.
2022-08-18 02:15:23 +02:00
Kawe Mazidjatari
19d264ec11 Implement RCON_PasswordChanged_f and ConVar improvements
* Changing RCON passwords on the server now closes all connections and re-initializes the system.
* Fully mapped out VFTable interface for IConVar* (used for ConVar callbacks, see callback.cpp).
2022-07-25 19:35:08 +02:00
Kawe Mazidjatari
086489a000 AIN/NavMesh debug draw improvements
* Move AIN/NavMesh debug draw to ai_utility_shared.cpp.
* Use shift index + range for AIN debug draw.
* Added cvar for determining max distance between camera and tile (anything outside this range doesn't get draw).
2022-07-25 16:39:07 +02:00
Kawe Mazidjatari
c405c23934 Implement memory allocation singleton wrappers
* Pointer to g_pMemAllocSingleton
* New wrapper for returning the singleton, and creating one if not yet initialized (game shares the same pointer, and is aware of its creation).
2022-07-22 16:34:10 +02:00
Kawe Mazidjatari
8198866f6f Add tile range for NavMesh debug draw
New cvar 'navmesh_debug_tile_range' (tile shift index to this cvar gets drawn).
2022-07-22 12:44:33 +02:00
Kawe Mazidjatari
9758f988ec Add NavMesh poly debug overlay
Can be toggled and shifted through tiles using 'navmesh_draw_polys'.
2022-07-21 14:48:50 +02:00
Kawe Mazidjatari
c850d52d1b Add NavMesh poly bounds debug overlay 2022-07-21 02:21:59 +02:00
Kawe Mazidjatari
e21ae20f4a Add NavMesh tile portal debug overlay
navmesh_draw_portal > -1 enables the overlay, with this cvar you can also shift through tiles.
navmesh_debug_type [0 - 4] selects the NavMesh (small, med_short, medium, large, extra_large).
2022-07-21 01:24:07 +02:00
Kawe Mazidjatari
2998953600 Add NavMesh BVTree debug overlay
navmesh_draw_bvtree > -1 enables the overlay, with this cvar you can also shift through tiles.
navmesh_debug_type [0 - 4] selects the NavMesh (small, med_short, medium, large, extra_large).
2022-07-20 21:23:56 +02:00
rexx
7973034bd0 temp navmesh debug drawing 2022-07-14 18:19:34 +01:00
Kawe Mazidjatari
521cbad760 Proper SSE structure for OverlayBox_t::Transforms 2022-07-12 12:28:23 +02:00
Kawe Mazidjatari
e8a0c5e752 Add cvar for debug overlay z-buffer.
Only OverlayLine_t has a field to determine whether or not to ignore the z-buffer.
Added ConVar 'r_debug_overlay_zbuffer' to allow setting z-buffer for all overlays.
2022-07-11 21:23:26 +02:00
Kawe Mazidjatari
27ff727949 Use Vector3D for capsule and hemisphere radius. 2022-07-11 20:45:14 +02:00
Kawe Mazidjatari
ffa9f12e2b New DebugDraw shapes in SDK
DebugDrawCapsule and DebugDrawHemiSphere.
Hooked up to DrawOverlay (OverlayType_t::OVERLAY_CAPSULE).
2022-07-11 20:35:20 +02:00
Kawe Mazidjatari
28de4a96bf Rename to DrawAIScriptNodes 2022-07-11 12:22:35 +02:00
Kawe Mazidjatari
96abdf619c Rebuild 'ai_script_nodes_draw'
Originally stripped from retail.
2022-07-11 12:00:08 +02:00
Kawe Mazidjatari
cf0ab4aa45 Light cleanup 2022-07-10 17:40:22 +02:00
Kawe Mazidjatari
39094ab11b Change v_RenderBox prototype to take const reference on transforms. 2022-07-10 14:39:03 +02:00
Kawe Mazidjatari
856b386945 Debug overlay improvements and new render utilities.
Fixed internal RenderBox transforms (origin and angles are packed in xmm registers).
Added new render utilities in the SDK similar to the script ones.
2022-07-10 14:30:28 +02:00
Kawe Mazidjatari
d8a45ae563 Overlay improvements
* Move render utils to dedicated file.
* Implement more render/mesh utils.
* Added structure for OverlayTriangle_t, OverlaySweptBox_t and OverlayCapsule_t.
OverlayCapsule_t has been modified to accommodate the size in r5 (2 new vectors).
2022-07-07 21:31:00 +02:00
Kawe Mazidjatari
7d89a42b56 Mathlib implementation
SourceSDK mathlib port with light modifications.
Renamed Vector to Vector3D (to avoid confusion with std::vector (declared as vector) and Vector2D/Vector4D).
2022-07-06 21:11:32 +02:00
Kawe Mazidjatari
2af10efe23 Temporary RenderBox 2022-07-06 14:41:34 +02:00
Kawe Mazidjatari
e45cba48be Box overlay progress 2022-07-06 11:22:37 +02:00
Kawe Mazidjatari
e711c54bf9 DebugOverlay improvements
Use rebuild 'DestroyOverlay()'
Use 'size_t' type for MemAlloc_Internal alloc size.
2022-06-15 01:35:48 +02:00
Kawe Mazidjatari
e70e4d1a8c Add DebugOverlay implementation 2022-06-15 01:24:29 +02:00
Amos
22c0b5c867 Dedicated server improvements 2021-12-30 17:20:47 +01:00
Amos
6d4f7e345f Fix a typo 2021-12-30 02:47:46 +01:00
Amos
39a8a8fd30 Implement patch to enable 'DrawAllOverlays()'. 2021-12-30 02:36:43 +01:00