4395 Commits

Author SHA1 Message Date
Kawe Mazidjatari
0d5a5df1a4 CMake: move spdlog and detours under 'Debugging' filter 2024-09-25 20:16:33 +02:00
Kawe Mazidjatari
ba5801cce6 Server: implement script utility to set class variables on connected players
Allows setting class var changes on all connected players (SetClassVarSynced(key, val)), or on individual players (player.SetClassVar(key, val)).
2024-09-25 20:12:14 +02:00
Kawe Mazidjatari
b11d7e3c9b Engine: add new netmsg 'SVC_SetClassVar'
Netmessage SVC_SetClassVar allows the server to change class settings securely on the client. This was implemented due to popular demand, and previous approaches using a combination of ClientCommands (Cbuf and NET_StringCmd) were deemed insecure and unreliable.
2024-09-25 20:08:28 +02:00
Kawe Mazidjatari
3b1622af95 Common: fix crash on dedicated server
First change callback of cvar 'mp_gamemode' must be removed as its client only, calling this on the server causes a crash as we never initialize client specific systems, therefore, the globals used in the change callback are null.
2024-09-25 20:01:10 +02:00
Kawe Mazidjatari
9a68b15412 VScript: run initial registration code class callbacks first
Must be ran within the hook as otherwise engine code class functions won't be registered.
2024-09-25 15:39:01 +02:00
Kawe Mazidjatari
8abbed283e Engine: add implementation for registering new netmessages 2024-09-25 15:04:45 +02:00
Kawe Mazidjatari
3b3127c2cf VScript: add code class script globals and registraction callbacks
Will be used to register custom script class functions.
2024-09-25 14:36:20 +02:00
Kawe Mazidjatari
97fb6c91d3 VScript: add code class descriptor class
Used for script class functions, e.g. player.GetOrigin().
2024-09-25 14:34:56 +02:00
Kawe Mazidjatari
8c2400bab5 VScript: add 'sq_getentity' to SDK 2024-09-25 14:21:43 +02:00
Kawe Mazidjatari
27c085482f Tier0: double sigscan mask buffer
Some common (future) function signatures exceed this, which don't have other means of accessing it.
2024-09-25 14:21:17 +02:00
Kawe Mazidjatari
56f8a69114 Tier1: fix flag testing bug in ConVar::Create
The archive + playerprofile flags check was done on the uninitialized member variable 'm_nFlags', but it should've been performed on the function's input parameter 'flags' as m_nFlags is only initialized past this check in BaseClass::Create (its part of ConCommandBase). This caused statically initialized ConVar's flagged 'FCVAR_ARCHIVE | FCVAR_ARCHIVE_PLAYERPROFILE' to go undetected, and dynamically initialized ones (e.g. through mod settings) to have random memory and intermittently fail this check. The latter is how this bug was found and ultimately fixed in this patch.
2024-09-23 16:23:34 +02:00
Kawe Mazidjatari
3fc1bcd2b7 Tier1: properly fix V_SplitString2
Patch in commit 057a2c801a40c2f280193da9963b009adb9f75f6 was done incorrectly, causing intermittent string truncation as subtracting pFirstSeparator from pCurPos will leave with a window in the buffer of exactly that split string, but the previous patch subtracted another char from it whilst adding one in AllocString just for it to be nulled.
2024-09-23 16:19:53 +02:00
Kawe Mazidjatari
8c9d873fbe Tier1: use CUtlStringList for ConVar flag string parser
The previous implementation contained a bug causing it to add other flags intermittently. Utilize CUtlStringList instead as it was designed for this purpose.
2024-09-23 15:46:25 +02:00
Kawe Mazidjatari
057a2c801a Tier1: exclude delimiter from split string
A string "test3,test4" using the delimiter ',' would be split into "test3," and "test4", but should be "test3" and "test4". The delimiter should not be included. This patch fixes the issue.
2024-09-23 15:44:44 +02:00
Kawe Mazidjatari
7e1e4e902a Recast: remove extraneous comments
Should not be flipped.
2024-09-23 12:34:00 +02:00
Kawe Mazidjatari
d21565d00f Recast: use rdSwap for rdVectorBase::swap
Headers were reorganized a while back, clean this code up.
2024-09-23 12:31:31 +02:00
Kawe Mazidjatari
da37f898cf Recast: deduplicate XX_VERTS_PER_POLYGON constant
Must be synced between Recast & Detour.
2024-09-23 12:25:25 +02:00
Kawe Mazidjatari
0298591068 Recast: rename shape volume methods
Reflect new changes, which supports more than only convex shapes.
2024-09-23 12:19:49 +02:00
Kawe Mazidjatari
fa1db8f995 Recast: clamp the off-mesh connection positions as well
Allows for parsing zipline positions from BSP entity partitions and placing them whilst also having it clamp the positions correctly to the polygon the zipliner will end up or start from.
2024-09-23 12:11:44 +02:00
Kawe Mazidjatari
5cb0e93766 Recast: better slider limits and layout for primitive shape editor 2024-09-23 12:09:54 +02:00
Kawe Mazidjatari
1bd47494bf Recast: pre-select primitive volume on creation
Pre-select it so it can be modified directly afterwards.
2024-09-22 15:33:49 +02:00
Kawe Mazidjatari
29e57e1605 Recast: allow modifying brush types of existing primitive volumes 2024-09-22 15:26:50 +02:00
Kawe Mazidjatari
feaca14e8a Recast: left panel UX improvements
Make it slightly larger (20 units) and make the sliders wider as well.
2024-09-22 14:28:34 +02:00
Kawe Mazidjatari
5f3abdb656 Recast: select primitive volume by volume hit index
As of commit 2a2b05c42ada643eb3a535b497d0da7e16ebef41, the primitive volume index is sent to the click handler. Use this instead of relying on a point being inside a shape which is unreliable.
2024-09-22 14:13:39 +02:00
Kawe Mazidjatari
2a2b05c42a Recast: sent intersected primitive volume index to click handler
Click handler should be notified about the primitive volume that the ray collided with, which will make selecting objects in the world a lot more reliable and easier.
2024-09-22 14:11:44 +02:00
Kawe Mazidjatari
9e46c8be75 Recast: implement primitive shape volume editor
Allows for selecting already created volumes and modifying or deleting them.
2024-09-22 12:27:45 +02:00
Kawe Mazidjatari
da66a7b9c1 Recast: implement shape volume highlighting in renderer
Highlight shape volume by index, will be used by the shape volume tool for editing.
2024-09-22 01:23:37 +02:00
Kawe Mazidjatari
e9e1a96310 Recast: make sure shape editor and shape instance max vert count is always the same
Use the same constant for class ShapeVolumeTool and struct ShapeVolume, since we do plan on increasing this in the future. Having multiple constants can cause hard to find problems when tweaking this.
2024-09-22 00:40:12 +02:00
Kawe Mazidjatari
be27f75442 Recast: rename shape volume tool source files
Source files were named after the convex polygon volume shape, but the tool can now handle more primitive shapes. Renamed to avoid future confusion.
2024-09-22 00:33:48 +02:00
Kawe Mazidjatari
3eb505e169 Recast: update default render offsets
Render recast geometry at its original location, render detour geometry 4 units from its original z-axis to avoid clipping. The previous values were too extreme and caused the cursor to visibly clip in recast geometry.
2024-09-21 22:32:13 +02:00
Kawe Mazidjatari
01f1361e26 Recast: implement masking in raycast algorithm
Allow caller to filter out what to collide with. For the editor cursor, we want to test on everything (including triggers). For the traverse link algorithm, we only want to test on clip brushes or world geometry as traversing through a trigger volume is valid.
2024-09-21 22:09:32 +02:00
Kawe Mazidjatari
f82c3fcc35 Recast: rework raycast algorithm and fix several bugs
* Only run rcGetChunksOverlappingSegment when we do intersection queries on world geometry (major optimization).
* Always find the closest intersection if caller provided tmin, and skip out if caller didn't while our ray intersected with something (major optimization for larger levels with a high number of primitive volumes).
* Reduce max overlapping chunk indices to 512, this was increased to 4096 during the initial coordinate system conversion but this was not necessary and ultimately bloated the stack.
2024-09-21 21:43:12 +02:00
Kawe Mazidjatari
b37a77d547 Recast: enforce consistency in intersection code
Some code uses different timing bounds. Enforce consistency between all code utilizing this.
2024-09-21 12:26:34 +02:00
Kawe Mazidjatari
eb6a3b37d2 Recast: implement intersection test for convex hulls
Similar to the intersection test for cylindric volumes. The old convex hull intersection test in the raycast algorithm is inaccurate and also doesn't calculate the hit time, which prevents the editor from placing the cursor at the intersection. Raycast algorithm is pending a refactor and its convex hull isect test will be replaced with this.
2024-09-21 12:22:02 +02:00
Kawe Mazidjatari
3a51c4f8c9 Recast: take cylinder caps into account during intersection test
Cylinder caps were not accounted for and thus tmin/tmax were never set causing incorrect ray tracing results when intersecting with a cylinder cap.
2024-09-20 21:54:24 +02:00
Kawe Mazidjatari
c952f59920 Recast: add ability to delete cylinder and AABB volumes as well 2024-09-20 16:01:39 +02:00
Kawe Mazidjatari
32f470f2ed Recast: add functions for checking if point is in cylinder and AABB 2024-09-20 16:00:23 +02:00
Kawe Mazidjatari
162f5fb3c7 Recast: fix convex volume deletion (XZY -> XYZ)
Missed coordinate system conversion change.
2024-09-20 15:07:44 +02:00
Kawe Mazidjatari
290f78f8c8 Recast: fully implement cylindric and AABB shape volumes
Cylindric and AABB volumes can now also be used to mark out area's on the NavMesh. The raycast tests now also take the new shapes into account. User can now also add shapes through the ShapeVolumeTool (previously ConvexVolumeTool). The geomset format has changed slightly:
- identifier 'o' now maps to off-mesh links (previously 'c').
- identifier 'p' now maps to convex polygon volumes (previously 'v').
- identifier 'c' maps to cylinder volumes.
- identifier 'b' maps to box volumes.
2024-09-20 15:03:30 +02:00
Kawe Mazidjatari
0722def4d8 Recast: deduplicate AABB intersection test in CrowdTool 2024-09-20 14:58:22 +02:00
Kawe Mazidjatari
4640a81d09 Recast: add cylindric and AABB intersection functions
'rdIntersectSegmentCylinder' is a new function that will be used for intersection tests on cylindric clip volumes.
'rdIntersectSegmentAABB' was already present in the library, but used and reimplemented across multiple source files (pending deduplication).
2024-09-20 14:55:45 +02:00
Kawe Mazidjatari
f98b3b9bff Recast: fix order of cylinder vertex drawing (XZY -> XYZ)
Face normals were flipped after the coordinate system change. This patch solves the issue.
2024-09-20 11:43:55 +02:00
Kawe Mazidjatari
98756f1a0b Recast: reorder function
Was in between area markers, move it above.
2024-09-20 00:30:52 +02:00
Kawe Mazidjatari
11e83769b5 Recast: also assign flags to compact height field in rcMarkCylinderArea
This function is currently not in use, but will be used.
2024-09-20 00:18:23 +02:00
Kawe Mazidjatari
d0c4c0497d Recast: allow ability to mark AABB box area on NavMesh
Very useful utility when automating the creation of geometry bounding boxes to be used to mark and flag certain polygons on the navmesh (e.g. a door or hazard area through bounding boxes from a mesh or box-shaped trigger).
2024-09-20 00:10:03 +02:00
Kawe Mazidjatari
4083318f83 Recast: separate box creation code from renderer
Allow usage in external code.
2024-09-20 00:07:00 +02:00
Kawe Mazidjatari
8758550602 Recast: make tile size correct for larger navmeshes
Should be 60, which results in 960x960 tile dimensions for _large and _extra_large navmeshes (identical to r2 _large navmeshes).
2024-09-19 16:59:56 +02:00
Kawe Mazidjatari
4a9bfbe79a Recast: vastly improve reliability of land-side off-mesh link tile query
Instead of a box query, just take the position in the tile grid the land-side off-mesh vert is on. This vastly improves the query reliability for off-mesh links with a larger radius to the point it never fails if it is in a valid location. The box query isn't needed here as the off-mesh vert has to be on a tile, else the polygon box query will fail (unless its bounding box does happen to overlap with the point, but in this case the off-mesh connection is placed improperly causing the only factor to have its link established being luck).
2024-09-19 15:44:23 +02:00
Kawe Mazidjatari
2ed18dc6e0 Recast: clean up editor class
Reorder and remove non-existent method declarations.
2024-09-19 13:52:10 +02:00
Kawe Mazidjatari
ee59793118 Recast: default to layered partitioner
Watershed results in bad geometry around stairs or slopes near complex geometry. Layered partitioning results in much better results in these cases.
2024-09-19 13:51:28 +02:00