114 Commits

Author SHA1 Message Date
Kawe Mazidjatari
329621c6ad Move all public headers into root of 'public' 2022-08-09 17:18:07 +02:00
Kawe Mazidjatari
e92b5d1300 General cleanup
Use c++ methods, remove unnecessary casts, unnecessary use of auto, etc..
2022-08-09 15:19:12 +02:00
Kawe Mazidjatari
0b4eb06dd2 Use compare method instead of strcmp on std::string 2022-08-09 14:01:29 +02:00
Kawe Mazidjatari
8c6ee8a834 Remove 'm' prefix from dll globals
Large commit.
2022-08-09 03:02:00 +02:00
Kawe Mazidjatari
9d06a02614 General cleanup
* Use Cbuf functions for executing commands in ImGui panels.
* Use const qualifiers for all vftable indexes.
2022-08-09 02:35:00 +02:00
Kawe Mazidjatari
f97b347d88 Fix ConVar's and ConCommand's creation memory leak
Using the 'new' keyword and then assigning *this to *pNewConVar will lead to having 2 copies of the same constructed data, and one being used in the SDK whilst the other one being used by the engine.
We unfortunately cannot write the code exactly like the engine, as we hook the engine and dependent heavily on its global memalloc singleton.
This commit fixes the memory leak and allows the engine to free the memory as well whenever it wants to.
2022-08-08 01:40:28 +02:00
Kawe Mazidjatari
df81a1e277 Update rui_drawEnable help text 2022-08-04 17:56:54 +02:00
Kawe Mazidjatari
0cad187587 Fix client.dll compile errors 2022-08-04 17:52:34 +02:00
Kawe Mazidjatari
8f513a519f Properly implement ConCommand callbacks
COMMAND_COMPLETION_MAXITEMS and COMMAND_COMPLETION_ITEM_LENGTH are confirmed to be 128 (original code is 64).
New register func sets the callback bit fields accordingly (no longer hardcoded).
2022-08-04 17:37:30 +02:00
Kawe Mazidjatari
ea5f17b4ca Light cleanup
* Moved ConVar usage text that where part of the help string to the usage string parameter.
* Flagged ConVar 'bhit_abs_origin' as FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED.
* Flagged ConCommand 'bhit' as FCVAR_DEVELOPMENTONLY | FCVAR_GAMEDLL.
* Check 'bhit_enable' before running the 'bhit' command callback.
* Fixed spelling in a few area's.
2022-08-04 16:34:23 +02:00
Kawe Mazidjatari
68b3185a41 Use ssize_t for size types in CUtlMemory 2022-08-04 11:51:38 +02:00
Kawe Mazidjatari
6d92fdf15f Use game's global malloc singleton for allocating/reallocating memory in CUtlMemory
This ensures anything we create in the SDK will be usable within the game engine (Realloc, Free, GetSize, etc..), as we share the global singleton.
2022-08-04 11:33:40 +02:00
Kawe Mazidjatari
238e145818 Implement ConVar change callbacks
CUtlVector containing callbacks (you can have several callbacks for each ConVar).

also, in 'ConVar::InternalSetValue' Valve and Respawn run V_atod (atof) on function param 'pszValue', but they also check if input param 'pszValue' is a nullptr (which in this case, 'pszNewValue' gets set to an empty string), but yet they deref 'pszValue' (nullptr or not) in 'SetColorFromString' and V_atod, is this correct behavior?

For now I swapped these out with 'pszNewValue' for the very rare event the string happens to be nullptr.
2022-08-04 11:06:56 +02:00
Kawe Mazidjatari
babbcbe6d5 Add CStdMemAlloc::GetSize() to SDK
Returns the size of the buffer allocated with MemAllocSingleton()->Alloc() etc.
2022-08-04 02:02:09 +02:00
Kawe Mazidjatari
20d1fabd0c Implement CUtlMemory, CUtlBlockMemory and CUtlVector
CUtlMemory has been modified to fit the size of the in-engine structure.
The new types seem to be either int64 or unsigned (size_t?).
2022-08-04 01:28:07 +02:00
Kawe Mazidjatari
0fe554b3d1 Fix crash cases when setting ConVar string using SetValue
Added IsMaterialThreadSetAllowed and QueueMaterialThreadSetValue checks.
2022-08-04 00:21:48 +02:00
Kawe Mazidjatari
19d057fc5e Add 'bhit_enable' ConVar and only run bhit callback if set 2022-08-03 18:27:25 +02:00
Kawe Mazidjatari
5795d15c83 Netconsole and ConVar improvements
Implemented StringSplit() (split string with a delimiter, and stop splitting after either the last delimiter has been reached, or nMax, so when nMax is 2, then 'SET mat_sky_color 255 255 0 255' gets split into: "SET" "mat_sky_color" "255 255 0 255").

Netconsole now sends ConVar's/ConCommands and values separately with use of StringSplit.

ConVar now uses internal ChangeStringValue (this runs the callback).
2022-07-31 17:07:35 +02:00
Kawe Mazidjatari
7730d72416 Use proper flags for 'bhit' 2022-07-30 00:57:32 +02:00
Kawe Mazidjatari
068e50ea40 'bhit' command implementation
The command is only implemented on the dedicated server or debug servers, so i cannot tell for sure what exactly 'bhit' does. But its either some form of telemetry or debug.
The command sends the player index that got hit on the prediction engine, the bullet fire origin and the angles relative to the target that got hit.
For now the command draws the bullet trajectory if it hits a player.
This commit also fixes the 'Unknown command: bhit' message.
2022-07-30 00:54:33 +02:00
Kawe Mazidjatari
55c5048951 Fix compile error 2022-07-30 00:43:40 +02:00
Kawe Mazidjatari
9556b05209 CCommand improvements
Add constructor and work-in-progress tokenizer.
2022-07-29 17:30:05 +02:00
Kawe Mazidjatari
25e2581f2b Implement fully mapped out ConCommandBase VFTable interface class 2022-07-25 20:06:06 +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
65cbdb5465 Use ConVar::ChangeStringValue() instead for purging hostnames
Now possible without crashing with the new memalloc singleton.
2022-07-22 17:18:54 +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
rexx
2e3b4205c0 remove streamoverlay hook 2022-07-21 17:05:19 +01:00
Kawe Mazidjatari
b3ed5d4052 Fix client.dll compile errors
Stripped more server only stuff from client.dll.
2022-07-21 15:13:48 +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
rexx
cb4e422724 reimplement stream overlay drawing 2022-07-20 22:50:55 +01: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
Kawe Mazidjatari
0ec03a62b1 Working AI reachability tables
* Set reachability table count to 1.
* Don't divide reachability write size by 4.
* Trim off all unused bytes after building reachability table.
* Default cvar 'navmesh_always_reachable' to 0.

AI behavior seems to have improved a bit, they attempt to pathfind better, and if they find a certain route they attempt another route where originally they would become stuck in such situation.

If you build the SDK after this commit, you need to rebuild all navmeshes, else the game would segfault in dtNavMesh::isPolyReachable().
2022-07-19 02:38:01 +02:00
Kawe Mazidjatari
bd3fe5b445 Public IVDebugOverlay VFTable interface.
New public interface to add debug overlays on the go (memory is managed by the game module).
3 new commands:
* line.
* sphere.
* capsule.
2022-07-12 17:46:47 +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
96abdf619c Rebuild 'ai_script_nodes_draw'
Originally stripped from retail.
2022-07-11 12:00:08 +02:00
Kawe Mazidjatari
cf232be7bf Switch hostname out for default 2022-07-10 17:22:48 +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
becf8eb6a5 Use size_t for SDK_ARRAYSIZE instead
sizeof() returns a size_t.
2022-07-03 19:18:23 +02:00
Kawe Mazidjatari
e05c9c787d Draw the actual simulation tick on overlay 2022-07-03 11:03:25 +02:00
rexx
bd79e805b5
material debug info overlay (#70)
* material debug info overlay

* add x/y offset convars

* change flags to signature

flags is static?

* Update vgui_debugpanel.cpp

Co-authored-by: PixieCore <41352111+IcePixelx@users.noreply.github.com>
2022-07-01 23:33:48 +02:00
Kawe Mazidjatari
cdcc87b54b Renamed master server related stuff 2022-07-01 10:29:27 +02:00
Kawe Mazidjatari
d417b60e69 Near finished master server improvements
* Added working players/maxplayers fields for master server.
* Fixed popstylevar assert in CBrowser (SetStyleVar and the corresponding PopStyleVar where not within the same scope).
2022-07-01 02:20:47 +02:00
Kawe Mazidjatari
e17d72571d Merge branch 'indev' into pylon_new 2022-06-30 20:19:13 +02:00
PixieCore
a2cb0b62c8 Macro for ArraySizes and CFactory Methods are virtual now for later usage. 2022-06-29 18:25:44 +02:00
PixieCore
c614d75a4f Removed ConVar string deletion.
* This will crash due to the string not being allocated with alloc.
Even if the source engine would allocate it, it would use CStdMemAlloc and it would crash anyway.
But it doesn't so we can just leave that out!
2022-06-29 17:07:06 +02:00
Kawe Mazidjatari
a20d6a163e Work-in-progress pylon master server implementation
Still in development.
Implemented new fields provided by pylon-ms.
2022-06-28 00:47:01 +02:00