138 Commits

Author SHA1 Message Date
Kawe Mazidjatari
745024d198 LiveAPI: always set POD stack var if loop has ran, don't check it
No point checking on this, removes an extra instruction.
2024-11-18 01:36:32 +01:00
Kawe Mazidjatari
9b2034d897 LiveAPI: make code compatible with coroutines
The script engine supports running coroutines, which means we cannot use statics for each message as 2 coroutines could fight for a event mesage

I.e. we have 2 coroutines handling a player damaged event, the message could be populated with a mix of data between the 2 coroutines.

Therefore, we cannot optimize this by statically allocating it and must allocate it for each coroutine separately. The extra memory and cpu overhead caused by this is still very low.
2024-11-18 01:32:32 +01:00
Kawe Mazidjatari
c0a451f90d LiveAPI: remove newline character from error message
SQVM::RaiseError() does not need a newline character, remove it to keep consistency with the rest of the file.
2024-11-14 01:19:23 +01:00
Kawe Mazidjatari
2813c0e24f Server: improve ConVar help string
Improved the helpstring for ConVar navmesh_always_reachable.
2024-11-13 14:18:05 +01:00
Kawe Mazidjatari
a809b1f262 Server: remove exraneous client pointer check
CServer::GetClient() will never return NULL as it returns address of client in array. Removed extraneous checks as its misleading, and added const where possible.
2024-11-11 17:47:36 +01:00
Kawe Mazidjatari
5ed734a4ff Client: fix controller curve look
The rebuild was wrong, the reported issue was that during auto-aim, the rotation speed is higher than original with a weaker magnet. Since the dissasembly and decompile of this function wasn't correct, along with not being able to reproduce the issue locally, it was hard to debug the problem (the difference between the rebuild and the original implementation was very small, where only experienced players noticed it). Since I have concluded that we don't need this function rebuilt as nothing else in the function needed adjustments, we can therefore just hook it and add the multiplication scalars on the computed joy angles. This now seems to yield correct behavior based on new tests that were performed with these changes.
2024-11-11 17:39:53 +01:00
Kawe Mazidjatari
427860e6e9 InputSystem: add option to run the old CurveLook implementation
The rebuild should be correct, but to rule out any problems we might have after releasing this build, we should have a simple option to force the old implementation.
2024-11-10 14:02:49 +01:00
Kawe Mazidjatari
c72e34606b Server: only run the loop if we have an attached NavMesh 2024-11-10 12:27:14 +01:00
Kawe Mazidjatari
652b5d7018 Game: make navmesh render plane culling optional
Plane culling is too aggressive on larger tiles, make it optional.
2024-11-06 14:12:12 +01:00
Kawe Mazidjatari
8d5bc23cf6 Game: improve in-game navmesh rendering
Draw inner and outer poly boundaries, and only draw detail meshes if this was specified by the user. Most of the time we don't want to draw detail as this has a huge performance cost.
2024-11-01 13:37:32 +01:00
Kawe Mazidjatari
ac6da44a18 Recast: properly implement navmesh destructor
Reverse engineered the last types that were mostly unused and unneeded by the navmesh. But to properly implement the destructor it had to go in. Cells and hints now get freed as well and we can now rely on our own destructor for the navmesh data allocated by the game.
2024-10-22 11:56:26 +02:00
Kawe Mazidjatari
9f430a455e Recast: traverse over every tile in the array
dtNavMesh::getTileCount returns the total number of added tiles, the issue with this is that if the navmesh gets pruned, that means disabling unlinked polygons and removing dead tiles, then some tile instances in the m_tiles array may become empty. Less tiles will be installed and since there are null tiles in between, we won't be traversing each tile.
2024-10-13 21:36:46 +02:00
Kawe Mazidjatari
b91fd983f9 Server: light LiveAPI improvements
Increase nesting limit to 128, this should make sure it will always be enough while also making sure no infinite recursions occur. Also improved error print formatting.
2024-10-04 13:00:09 +02:00
Kawe Mazidjatari
ed62ebec9f Server: map IServerGameClients interface out
Not everything has been reversed yet.
2024-10-04 12:53:05 +02:00
Kawe Mazidjatari
cf7031866f Server: make inline method const 2024-10-04 12:50:31 +02:00
Kawe Mazidjatari
d312597c91 Engine: rework class var command and netmsg design
New command '_setClassVarClient' only sets the class var on the client, similar to how '_setClassVarServer' only sets it on the server. Command 'set' still has its old behavior, setting it on the server and client. The netmsg SVC_SetClassVar now only runs the _setClassVarClient handler, and if the netmsg was successfully sent, the code runs the _setClassVarServer handler directly instead of relying on the client to NET_StringMsg it in. This is a lot more reliable, secure and performant than the previous approach and drops the requirement of setting sv_cheats to function.
2024-09-28 12:43:11 +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
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
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
3259b03fdd Server: name unknown field in CAI_TraverseNode
Confirmed to be the traverse type.
2024-09-18 01:50:19 +02:00
Kawe Mazidjatari
0eb0d73ae1 Game: make AI utility class instance static
Static allocation instead of dynamic.
2024-09-16 14:15:15 +02:00
Kawe Mazidjatari
d5abb89d9b Client: remove version from convar string
In case more anti-lag versions get released, since this is the highest level cvar controlling the system.
2024-09-15 12:16:09 +02:00
Kawe Mazidjatari
b182a8eca8 Client: add AMD Anti-Lag 2 settings convar
Used to hook it up to scripts.
2024-09-14 12:51:45 +02:00
Kawe Mazidjatari
e019de8dcd Recast: make detail triangle flags enum shared
The same constants are used between Recast and Detour, but Recast had to declare and match the constant locally as it couldn't access the one from the Detour library. This patch avoids duplicate definitions and potential issues during refactors.
2024-09-04 16:19:19 +02:00
Kawe Mazidjatari
9113b36bfd Core: fix typo's in function comment headers
Small typo's, fixed to retain consistency.
2024-09-04 01:09:09 +02:00
Kawe Mazidjatari
f5c0b428cb Recast: add hook bodies for NavMesh functions
Used for debugging the Detour implementation of the engine.
2024-09-04 00:57:26 +02:00
Kawe Mazidjatari
c64f28be25 Server: fix rare NavMesh hotswap crash
Detour_LevelInit resets the global NavMesh query, but if code is going to utilize the global Detour query for an existing query on a subsequent frame without attaching a NavMesh in the mean time, the code will crash. The previously attached NavMesh type has to be reattached after the hotswap.
2024-09-04 00:48:54 +02:00
Kawe Mazidjatari
05b6e23a75 Recast: fix naming consistency of helper function
Should be upper case to match the rest.
2024-08-29 22:43:15 +02:00
Kawe Mazidjatari
8fce111502 Recast: fix BVTree calculations and rendering (XZY -> XYZ)
Should've been converted to the source engine coordinate system as well, but we missed this as then rendering thereof was 'fixed' incorrectly causing incorrect bounding volumes to appear correctly. Fixed the renderer and the calculation; the AI now never gets stuck in-game regardless whether 256 or 512 sized tiles are used.
2024-08-21 14:40:33 +02:00
R5 Mkos
5705aba459
Update vscript_client.cpp 2024-08-16 23:07:13 -04:00
Kawe Mazidjatari
06b673dc84 Recast: rename constant
A more descriptive and correct name.
2024-08-14 11:34:07 +02:00
Kawe Mazidjatari
b63cb1d52c Recast: improve naming consistency for the traverse system
Traversal and traverse were mixed in variable/function naming. Forced consistency. No logic was changed this patch.
2024-08-09 14:35:47 +02:00
Kawe Mazidjatari
c4ac63ed69 Server: disable view punch by default
View punch on player in Hip is also disabled in retail apparently. Reflect behavior in SDK.
2024-08-08 14:32:21 +02:00
Kawe Mazidjatari
deb59074c1 Server: only disable view punch during aim by default 2024-08-07 17:35:29 +02:00
Kawe Mazidjatari
ffb8c5992d Server: add cvar that allows enabling/disabling view punch when taking damage 2024-08-07 13:01:50 +02:00
Kawe Mazidjatari
8cfce5ea9a Client: cleanup and optimize C_Player::CurveLook
Don't call C_BaseCombatCharacter::GetActiveWeapon twice.
2024-08-06 20:30:07 +02:00
Kawe Mazidjatari
2348a2dc61 Client: make C_WeaponX::HasTargetZoomFOV() const 2024-08-06 20:29:16 +02:00
Kawe Mazidjatari
07fd1cef8e Client: add method to check if weapon is melee 2024-08-06 20:28:52 +02:00
Kawe Mazidjatari
2914027574 Client: fix aim magnet bug and several other issues with CurveLook
The decompile of this function was still incorrect, after looking at the raw disassembly, bool v36 and bool v35 are now set correctly. Also, a float was never set and the decompiler assigned a local to an incorrect one for some math that was supposed to set the inputSampleFrametime, causing it to work as a counter magnet when target compensation was activated. This now also has been set correctly according to the assembly of the function itself, and now works as intended. So far, all bugs appear to be fixed in this function, its pending tests by users.
2024-08-06 00:59:59 +02:00
Kawe Mazidjatari
886f1c6a53 Client: fix numerous issues with CurveLook rebuild
Fix incorrect type for g_aimCurveConfig, its a static array, so it needs to be a single pointer not a double. Also fixed several blocks inside CurveLook that did not match the assembly code of the game. The aim-assist code is still broken however, pending research.
2024-08-05 20:06:26 +02:00
Kawe Mazidjatari
08a69db020 Client: fix nullptr deref crash when auto aim is enabled 2024-08-05 02:09:03 +02:00
Kawe Mazidjatari
f8331d7ac7 Client: only run ADS per-optic when zoomed in
Should only fire this code when zoomed in.
2024-08-05 01:42:24 +02:00
Kawe Mazidjatari
2fd2873536 Client: properly clamp gamepad ads scalars 2024-08-05 00:39:40 +02:00
Kawe Mazidjatari
704498aecb Client: add per-optic sensitivity scalars to CurveLook
Implemented by popular demand. Allows setting different sensitivity values per optic zoom level on a weapon. The mouse input handler already had this, but the controller one didn't so it had to be implemented here.
2024-08-04 17:28:33 +02:00
Kawe Mazidjatari
f9eb989b3b Game: add method for calculating zoom FOV interp 2024-08-04 17:25:38 +02:00
Kawe Mazidjatari
bfdf601d0d Client: add note, cleanup curve look code and enable it
So far tested, works correctly. Pending test by community.
2024-08-04 14:59:57 +02:00
Kawe Mazidjatari
d298ad0c22 Client: initial rebuild of the curve look function
This function didn't decompile properly, so a bunch of manual assembly work had to be used to reconstruct the truncated bits. The code does work correct for the most part. The call to the subroutine 'sub_1405AD760' has been commented as the parameter appears incorrect; passes in the address of a bool but indexes 4 bytes outside the size of a bool. Most likely incorrect decompile/disasm. Currently being investigated.
2024-08-04 14:12:15 +02:00
Kawe Mazidjatari
06ea5773d7 Game: rename header file for consistency
C_Player is not a base class.
2024-08-03 15:18:44 +02:00
Kawe Mazidjatari
6715c25b37 Client: add reversed C_WeaponX class
Partially reversed.
2024-08-03 14:21:11 +02:00
Kawe Mazidjatari
5223ac8631 RTech: refactor playlists reloading/caching
Mutex is technically no longer needed as imgui now draws in main and gets buffer swapped / rendered in the render thread just like the rest of the game. But the mutex was still in because of the shared script function 'Script_GetAvailablePlaylists' that can be used on the server. Both the 'playlist_reload' and 'downloadPlaylists' commands will now join the active server job if ran to prevent crashing in the engine or sdk when ran during the game.

There was also a performance difference between 'playlist_reload' and 'downloadPlaylists' while the commands are identical. There was a bug where the 'playlist_reload' one called 'Playlists_SDKInit' twice. This has also been fixed in this commit.
2024-08-03 12:06:42 +02:00