118 Commits

Author SHA1 Message Date
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
f015667f88 Light ImGui cleanup
* CTextLogger: Explicit cast return value of size() to int when testing int value against size_t.
* CBrowser: Run think and request thread on client.dll, but for the request, only the refresh.
2022-08-09 12:13:31 +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
6cb44740f1 Use MAX_MAP_NAME constant for setting levelname in ServerBrowser 2022-08-08 00:33:07 +02:00
Kawe Mazidjatari
b496327380 Cleanup 2022-08-04 22:51:21 +02:00
Kawe Mazidjatari
c568995d56 Refresh server browser on startup
User gets to see all available servers directly without having to refresh first.
2022-08-04 22:49:30 +02:00
Kawe Mazidjatari
33b588b42e Private server improvements
* Don't clear the token string each time we get a response from the master server (it gets assigned each time anyways, so if the master server decides to change it the user will get the new one, this operation only happens once a second).
* Clear the token message when no longer hosting.
2022-08-04 22:44:23 +02:00
Kawe Mazidjatari
3f8476db88 Logging system light refactor
* Use responceid from server to determine in which context to log.
* Moved all script loggers from combined enums to minus instead (SERVER = -3, CLIENT = -2, UI = -1 SERVER_CODE = 0, etc), this makes it much easier to align stuff in combined systems such as the RUI logger or NetMsg().
* Color log networked RCON messages properly on the client.
* Added dedicated logger for all received RCON messages (net_console.log).
* Log commands submitted through in-game console (allows for easier debugging when going through log files).
2022-08-03 18:34:44 +02:00
Kawe Mazidjatari
f3555104a2 Improve server browser button alignment 2022-07-28 17:41:13 +02:00
Kawe Mazidjatari
e04c165d17 Return size_t for 'con_suggestion_limit' in 'CConsole::FindFromPartial' 2022-07-06 11:42:12 +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
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
Kawe Mazidjatari
1d7b32b789 Preparation work for pylon master server implementation 2022-06-27 16:54:40 +02:00
Kawe Mazidjatari
838c183b10 Use highlighted tab bars in server browser 2022-06-27 15:01:39 +02:00
Kawe Mazidjatari
3323c3fadb Small ImGui theme adjustments 2022-06-27 14:48:03 +02:00
Kawe Mazidjatari
98c43fd6c1 Rename CConLog to ConLog_t 2022-06-26 17:40:02 +02:00
Kawe Mazidjatari
2da11d2d32 Disable undo/redo in command input
Currently causes undefined behavior, though it rarely crashes (I couldn't reproduce the crash, but do get undefined behavior by having random memory end up in the input field, or similar)
Problem probably is because we don't store any undo/redo buffer.
For now disabled, will revisit in the future.
2022-06-26 17:14:32 +02:00
Kawe Mazidjatari
efe71fbe24 ImGui console UX improvements
* Fixed click-through parent window.
* Keep selection position when lines get cleared.
* Keep cursor position when lines get cleared.
* Ensure cursor visibility when dragging cursor outside rect.
* Falter free scrolling in autocomplete window.
* Falter free scrolling in logging window (window no longer stutters when lines get cleared).
2022-06-26 16:47:00 +02:00
Kawe Mazidjatari
d7a004a0eb Fixed bug where auto-scrolling occasionally gets disabled
Issue happened when scrolling back, most of the time it will work, but there is always jitter in the first frame after the change which could result in ImGui::GetScrollY() <= ImGui::GetScrollMaxY() resulting in auto-scroll disable.
Only scroll back if ImGui::GetScrollY() <= ImGui::GetScrollMaxY() and always reset value of CConsole::m_nScrollBack.
2022-06-24 18:28:26 +02:00
Kawe Mazidjatari
609af5e4b7 Strip tilde/grave/space characters from console properly
If input only contains the '~', '`' or ' ' character, it gets stripped from the input buffer. e.g. '````````' or '~' gets stripped, but 'script_ui printl("test `````")' or 'script_client printl("~CEngineClient()")' does not.
2022-06-24 14:23:12 +02:00
Kawe Mazidjatari
2eda8235b7 Slight theming tweaks
Minor improvements to small detail:
No child border on console on default theme (this is invisible).
Tweaked first use size and min size where by default the text would always perfectly align between ScrollY min and max.
2022-06-24 12:45:47 +02:00
Kawe Mazidjatari
add5c577ff Improve ImGui theme system
-imgui_theme "modern" = Respawn theme.
-imgui_theme "legacy" = Valve theme.
No args = default theme.
2022-06-24 12:22:04 +02:00
Kawe Mazidjatari
978c43250f Console cleanup and optimizations
Proper usage of callbacks, no longer use string comparisons to check if buffer changed.
Improved optimizations with avg 5000 clocks in release and avg 600000 clocks in debug (no filter).
2022-06-22 03:24:46 +02:00
Kawe Mazidjatari
83e855112a Update default ImGui theme 2022-06-22 01:17:10 +02:00
Kawe Mazidjatari
76ec4b8f4a Improve console scrolling
Moved auto scrolling logic to CTextLogger.
Removed redundant code in CTextLogger.
Added bool param to CTextLogger::RemoveLine to determine whether or not to lock the mutex (internal operations should not lock).
Fixed issue where scrolling with cursor is not possible when auto-scroll is set or ScrollY is towards its max.
Fixed copy button (copy all text in console via GUI, ctrl + a - ctrl + v alternative).
2022-06-21 23:25:15 +02:00
Kawe Mazidjatari
a436b70601 CConsole / CTextLogger optimizations
CConsole: cast to proper types.
CTextLogger: only compute line string if filter is active.
2022-06-21 20:20:12 +02:00
Kawe Mazidjatari
98741a9591 Remove redundant 'PrintPercentageEscape' calls 2022-06-21 10:12:15 +02:00
Kawe Mazidjatari
da299a002c Reimplement text filter
Could be better at some point, currently removes anything not matching criteria resulting in gaps.
But on the other side it might be good as the location of all occurrences are known (should make it easier to see when it is logged during the process).

Revisit in the future.
2022-06-20 20:21:52 +02:00
Kawe Mazidjatari
0de09217bc Log process uptime
Log actual process uptime in all (post init) loggers.
The actual process uptime is obtained from the engine (Plat_FloatTime()).
2022-06-20 15:48:33 +02:00
Kawe Mazidjatari
33aebfb89d ImGui theme improvements 2022-06-20 13:05:50 +02:00
Kawe Mazidjatari
44157bdce4 Fix CConsole history navigation bug
Fix bug where a space character gets appended on each navigation event, even if there already is a space character.
2022-06-20 11:21:18 +02:00
Kawe Mazidjatari
43b73dc717 Improve scrollback
Scrollback now scrolls back pixel perfect to the exact line in view before resize.
2022-06-20 11:20:02 +02:00
Kawe Mazidjatari
1764f039cf CConsole improvements: Add selectable logger text
CConsole now uses a dedicated class for logging text (modified CTextEditor class (CTextLogger)). The class uses an ImDraw list with a character vector to draw the text.

Text could be selected by double click (word), triple click (line), a selection by dragging the cursor, or everything with 'ctrl + a'.
2022-06-20 10:31:09 +02:00
Kawe Mazidjatari
2c954da789 Light CConsole class cleanup 2022-06-18 18:11:05 +02:00
Kawe Mazidjatari
26b51681e9 Use proper types 2022-06-15 02:07:27 +02:00
Kawe Mazidjatari
ae1d0516c2 Use proper types 2022-06-15 02:06:30 +02:00
Kawe Mazidjatari
8f3e01795c Use proper types 2022-06-15 02:04:03 +02:00
Kawe Mazidjatari
3de4b4c4ed Fade suggest panel among with base panel 2022-06-14 22:37:43 +02:00
Kawe Mazidjatari
aaf6e46871 ImGui panel improvements
Slight optimizations and cleanup.
Added fade-in effect.
2022-06-09 02:22:01 +02:00
Kawe Mazidjatari
e5e0d528f0 Parse playlists file directly after loading it
No longer need a thread that loops and waits until its loaded into memory before parsing it.
2022-05-28 17:07:30 +02:00
Kawe Mazidjatari
dbec823be6 FileSystem improvements
* Added vftable interface for 'IFileSystem::RemoveSearchPath'.
* Added hook for 'CBaseFileSystem::AddSearchPath'.
* Added hook for 'CBaseFileSystem::RemoveSearchPath'.
* Added method in KeyValues for loading a KV file and parsing it via the game exe (loads from cache, vpk and disk).
* Added method in KeyValues to parse GameInfo.txt when the engine loads this.
2022-05-28 02:05:54 +02:00
Kawe Mazidjatari
83c57fbd99 Fix compiler error 2022-05-27 22:31:12 +02:00
Kawe Mazidjatari
112f0a25b7 Update IConsole.h 2022-05-27 16:29:47 +02:00
Kawe Mazidjatari
bcd75b354a Fix suggest window drawing below server browser window 2022-05-27 16:28:37 +02:00
Kawe Mazidjatari
e6ef3d71f1 Rename variable 'g_pIConsole' to 'g_pConsole' 2022-05-27 02:46:13 +02:00
Kawe Mazidjatari
58d46c0a8c Rename class 'IBrowser' to 'CBrowser'
Renamed 'g_pIBrowser' to 'g_pBrowser' as well
2022-05-27 02:44:36 +02:00
Kawe Mazidjatari
555eb264c1 Server browser cleanup 2022-05-27 02:39:08 +02:00
Kawe Mazidjatari
5aeac9f72a rename 'g_szNetKey' to 'g_svNetKey'
sv = string variable
2022-05-27 02:24:34 +02:00
Kawe Mazidjatari
47d2e4c915 See description
* Added new function 'GetAvailablePlaylists' to all VM's.
* Moved function 'GetAvailableMaps' from UI VM to all VM's.
* Improved logic behind 'GetAvailableMaps'.
* Server browser and SQVM now rely on 'MOD_GetAllInstalledMaps'. This new function populates the global vector 'g_vAllMaps' with all installed maps.
* Improved 'KeyValues' structure to use union for shared members.
2022-05-27 02:08:51 +02:00