116 Commits

Author SHA1 Message Date
Kawe Mazidjatari
f120354e96 Initial port to CMake
* All libraries have been isolated from each other, and build into separate artifacts.
* Project has been restructured to support isolating libraries.
* CCrashHandler now calls a callback on crash (setup from core/dllmain.cpp, this can be setup in any way for any project. This callback is getting called when the apllication crashes. Useful for flushing buffers before closing handles to logging files for example).
* Tier0 'CoreMsgV' function now calls a callback sink, which could be set by the user (currently setup to the SDK's internal logger in core/dllmain.cpp).

TODO:
* Add a batch file to autogenerate all projects.
* Add support for dedicated server.
* Add support for client dll.

Bugs:
* Game crashes on the title screen after the UI script compiler has finished (root cause unknown).
* Curl error messages are getting logged twice for the dedicated server due to the removal of all "DEDICATED" preprocessor directives to support isolating projects. This has to be fixed properly!
2023-05-10 00:05:38 +02:00
Kawe Mazidjatari
359820615f Move low level code to tier0/tier1
Moved to tier0/tier1 so it could be compiled into a static library in the future.
2023-05-06 22:59:01 +02:00
Kawe Mazidjatari
016e6c35fe Light formatting improvements in 'CAI_NetworkBuilder' 2023-05-01 22:51:31 +02:00
Kawe Mazidjatari
f319fc0846 Use server global variables for client loops
Use server global variables for determining the num clients to loop over. This is cheaper and better than always looping over MAX_PLAYERS.
2023-04-30 01:50:38 +02:00
Kawe Mazidjatari
4079956356 Fix non-portable include paths
Portable include paths are case sensitive.
2023-04-08 18:52:33 +02:00
Kawe Mazidjatari
7727f13efa /W4: Fix return value truncation warning
Fix value truncation warning caused by returning 'CServerNetworkProperty::m_edict' in 'CServerNetworkProperty::GetEdict'. type has been demoted to actual type 'edict_t'.
2023-04-02 17:21:21 +02:00
Kawe Mazidjatari
4357c9dbf3 Fix many compiler warnings
Fix many compiler warnings indicating potentially unwanted implicit conversions/truncations.
2023-04-02 00:59:24 +02:00
Kawe Mazidjatari
cae5037324 Initial fix for older game builds
SDK compiles and works for the S1 game now, still needs to be debugged further.
2023-03-01 00:09:38 +01:00
Kawe Mazidjatari
ad66236a90 Fix compile error
Var was renamed.
2023-02-23 23:47:58 +01:00
Kawe Mazidjatari
68ae16d93a Fix bug in 'Detour_LevelShutdown'
Pointer in array never got nulled after getting freed, causing undefined behavior. Also made a dedicated function for clearing a NavMesh slot by hull.
2023-02-18 13:21:31 +01:00
Kawe Mazidjatari
d52bbfec08 Fix invalid alignment for 'MatchMetrics' 2023-02-12 18:03:12 +01:00
Kawe Mazidjatari
b1f2f47058 Update names across codebase 2023-02-12 15:06:08 +01:00
Kawe Mazidjatari
649e6cb63c CBaseAnimating: move trailing padding
Move trailing padding from 'CBaseAnimating' to start of 'CBaseAnimatingOverlay' (VFTable).
2023-02-04 01:01:32 +01:00
Kawe Mazidjatari
918535ff0f Fix crash during bots simulation
Wrong ptr to 'CUserCmd::Reset'.
2023-01-31 00:03:40 +01:00
Kawe Mazidjatari
9ea06aa65d Use 'Assert' instead 2023-01-25 19:21:06 +01: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
888989d2b3 Fully working implementation of 'sv_showhitboxes'
Setting 'sv_showhitboxes' to 0 will enable it on everything deriving from CBaseAnimating, and having a valid studiohdr/hitbox. -1 means off, value > 0 will select entity by index (value of 'sv_showhitbox').
2023-01-24 00:53:45 +01:00
Kawe Mazidjatari
6e5ad71855 Remove hitbox drawing test code
Was only hooked up to lag compensation code for testing.
2023-01-24 00:39:41 +01:00
Kawe Mazidjatari
2c7636ec0d Initial 'EntityByIndex' implementation 2023-01-23 23:40:40 +01:00
Kawe Mazidjatari
66ef9fb6a0 Fix crash in hitbox drawing code and light restructure
* Fix null pointer dereference crash in server hitbox drawing code; implemented a proper getter for CStudioHdr.
* Moved 'baseentity.h/cpp' to 'game/server/' instead.
* Overall light cleanup.
2023-01-23 23:21:29 +01:00
Kawe Mazidjatari
094a6e4fa5 Initial hitbox drawing implementation
Currently only hooked up to lag compensation code. Will be hooked up to 'sv_showhitboxes' in the future (drawing hitboxes of all animating).
2023-01-23 02:22:51 +01:00
Kawe Mazidjatari
08746bcedd player.h cleanup 2023-01-21 16:17:28 +01:00
Kawe Mazidjatari
6811642734 Remove copyright notice from player.h
Structure uses next to no Valve material, and is heavily modified/custom. Removed copyright notice.
2023-01-20 22:17:04 +01:00
Kawe Mazidjatari
1d8e61ebff Fixup 'CMoveHelperServer' and 'CMoveHelperClient'
Uncomment field.
2023-01-20 17:21:34 +01:00
Kawe Mazidjatari
9720d8b0f1 Fix 'g_pGlobals' and 'UTIL_PlayerByIndex()'
'UTIL_PlayerByIndex' now returns the player from the edict array properly, 'g_pGlobals' had to be dereferenced twice.
2023-01-20 14:07:25 +01:00
Kawe Mazidjatari
4710b51fa3 Experimental bot simulation implementation
Simulate bot user commands on the server. The simulation system is experimental and only runs if cvar 'sv_simulateBots' is set, and bots are created on the server.
2023-01-20 01:23:08 +01:00
Kawe Mazidjatari
82c914c2fd Detour 'Physics_RunThinkFunctions'
Hook will be used to run simulation for bots.
2023-01-19 22:53:45 +01:00
Kawe Mazidjatari
e7522ce0d6 Fix compile error
IMoveHelper compile error in player.h.
2023-01-19 21:51:43 +01:00
Kawe Mazidjatari
934d18809a Finish 'CPlayer::RunNullCommand' 2023-01-19 21:45:15 +01:00
Kawe Mazidjatari
1853f3d643 CPlayer: Finish user command executor
Command executor finished. Also improved the structure slightly to use CUserCmd instead of padded characters for 'm_LastCmd'.
2023-01-19 20:48:41 +01:00
Kawe Mazidjatari
9231861f87 Light cleanup in movehelper_server.h 2023-01-19 19:39:36 +01:00
Kawe Mazidjatari
754c986e3d Add server movehelper to SDK
Initial implementation of server movehelper. IMoveHelper interface class is fully reversed and aligns with implementation in engine. CMoveHelperServer is also reversed, excect for CGameTrace, though this isn't necessary for now.
2023-01-19 18:52:46 +01:00
Kawe Mazidjatari
b2ffab07c3 Fix mistake
Should be 'm_lastUCmdSimulationRemainderTime' instead of 'm_totalExtraClientCmdTimeAttempted'.
2023-01-19 15:29:53 +01:00
Kawe Mazidjatari
54f08bd887 Work-in-progress user command executor
* Added some getters in 'CBaseEntity' and 'CServerNetworkProperty'.
* Implemented 'CPlayer::SetTimeBase'.
* WIP implementation of 'CPlayer::RunNullCommand'.
2023-01-19 15:25:45 +01:00
Kawe Mazidjatari
d4b576bd49 Light structures cleanup 2023-01-19 15:06:08 +01:00
Kawe Mazidjatari
1cf03355a5 Light cleanup and work for future
Moved some structures around and added ehandle headers.
2023-01-19 02:03:36 +01:00
Kawe Mazidjatari
b21fa6b665 Fix CBaseAnimating and CPlayer structure alignment
This change creates correct assembly output.
2023-01-19 02:02:42 +01:00
Amos
b63765e1dc Finished CPlayer inheritance 2023-01-18 12:39:18 +01:00
Kawe Mazidjatari
3ed423543e Add more entity structures to the SDK
Stuff will be separated properly very soon.
2023-01-18 01:34:40 +01:00
Kawe Mazidjatari
217bbc8ea1 Add new work-in-progress entity structures to SDK
Thanks to rexx for the structures.
2023-01-18 00:46:17 +01:00
Kawe Mazidjatari
94bf515ba7 Add gpGlobals to SDK 2023-01-17 11:21:10 +01:00
Kawe Mazidjatari
21f4d0fa07 Initial working bots implementation
* Changed 'CClient' handle time to 'edict_t' which is an alias of 'uint16_t'.
* Changed 'g_pServerGameDLL' and 'g_pServerGameClients' init (obtain from factory instead).
* Use interface version macro's for obtaining factory pointers instead.
* Added 'g_pServerGameEntities'.
2023-01-16 21:09:21 +01:00
Amos
11648d4932 Additional bot stuff 2023-01-16 16:54:01 +01:00
Kawe Mazidjatari
1021a95068 Merge branch 'SignatureMap' into indev 2022-12-04 14:21:14 +01:00
Marvin D
9fb7667075 Info regarding CServerGameDLL::GameShutdown 2022-12-03 02:58:05 +01:00
Marvin D
c0c06a14b8 client networkable vars init. 2022-12-03 02:57:11 +01:00
Kawe Mazidjatari
2501c37044 Globally convert all byte patterns to strings
These get reconverted to masked byte patterns at runtime. With the signature map cache system, this will only happen when building the cache.
2022-12-01 22:44:55 +01:00
Kawe Mazidjatari
3b5d6ec910 Use more consistent types
* Use more consistent types in the AI network manager.
* Use the server global to obtain level name.
2022-11-14 01:01:28 +01:00
Marvin D
4af22ede90 fix compilation. 2022-11-09 23:37:33 +01:00