195 Commits

Author SHA1 Message Date
Kawe Mazidjatari
9e9614f908 Only reclaim focus where necessary
Only reclaim it when its actually needed to be reclaimed, else other UI components will not work properly.
2023-02-06 00:04:08 +01:00
Kawe Mazidjatari
d93e5f9d97 Fix a few console bugs
* Fix console always reclaiming focus when input field is empty.
* Always clear auto complete vector once item has been selected.
2023-02-05 22:50:11 +01:00
Kawe Mazidjatari
116d2acae8 Don't update every frame
Don't update completion callback every frame, only when the input has changed.
2023-02-05 21:10:39 +01:00
Kawe Mazidjatari
a8ef2b74cd Implement ConCommand completion logic
Implementation of the ConCommand completion logic for the Dear ImGui console panel.
2023-02-05 19:21:39 +01:00
Kawe Mazidjatari
4116edfe4c Server browser UX improvement
Auto focus token input field when private server modal is invoked or a token is submitted without success.
2023-02-04 20:04:23 +01:00
Kawe Mazidjatari
b160f39379 Improve server browser styling
Set minimum window size based on theme, so that if there are more servers than displayable, the last listing wouldn't clip under the panel frame.
2023-02-04 01:03:18 +01:00
Kawe Mazidjatari
0227f1bca3 Adjust the width too 2023-01-30 01:59:25 +01:00
Kawe Mazidjatari
3eae093dc6 Console theme improvements
* Adjust window min size based on theme to always make the log lines line up when the window height is set to its min.
* Pad logger border with 1 for all themes.
2023-01-30 01:52:32 +01:00
Kawe Mazidjatari
a872c9ac7a Server browser theme improvements
* Pad server list tables properly.
* Pad and size private server modal properly for each theme.
* Light code cleanup.
2023-01-30 01:18:51 +01:00
Kawe Mazidjatari
9164856b95 Fix browser display defect
Fix defect causing frames to not animate properly when browser menu is invoked.
2023-01-29 19:30:37 +01:00
Kawe Mazidjatari
682f29e69a Console UX improvements 2023-01-28 14:21:18 +01:00
Kawe Mazidjatari
96e482f814 Server browser UX improvements 2023-01-28 14:20:57 +01:00
Kawe Mazidjatari
1b3223d5cb Sync 'sv_globalBanlist' with global banned list toggle 2023-01-28 13:05:02 +01:00
Kawe Mazidjatari
61684ddf87 Create cvar for global banned list queries
This was planned to be changed a long time ago. This change allows dedicated server users to disable the logic as well.
2023-01-26 21:20:11 +01:00
Kawe Mazidjatari
34fddd52a8 Add cvar/command flag tooltip
Show a more detailed description of all flags set on cvar/command when user hovers its mouse over the flags texture.
2022-12-29 13:30:33 +01:00
Kawe Mazidjatari
604e4a6705 Fix console bug stripping all spaces from paste
Fixed a bug that gets triggered when pasting some text in the input field that containing space characters. All spaces will be lost during the paste.
Issue has been fixed by removing an extraneous check for space characters, the initial space character input already gets blocked in case 'ImGuiInputTextFlags_CallbackEdit'.
2022-12-21 23:46:27 +01:00
Kawe Mazidjatari
81154df155 Improve Server Browser host panel
* Immediately display the "Stop Server" and "Change Level" buttons when hoststate indicated there is an active game, since stopping the server or switching levels is still valid when the server is not simulating.
* Only display the AINetwork/NavMesh rebuild/reload and Settings Reparse buttons when the server is simulating.
2022-11-26 17:04:12 +01:00
Kawe Mazidjatari
6eb31ad881 Only activate server command panel when server is simulating
Only activate the command panel in the host section of the Server Browser when the server is actually simulating. Else we can crash the server by submitting commands when its in an uninitialized state.
Client AI Settings reparse is also only executed when the client is simulating from now on.
2022-11-23 12:30:15 +01:00
Kawe Mazidjatari
9533afc628 Add new 'shortcut' buttons to host panel
* Added "Rebuild AI Network" (rebuilds the AIN file).
* Added "NavMesh Hot Swap" (hot reloads the navmesh files).
* Added "AI Settings Reparse" (reparses ai settings on the server and client).
2022-11-14 01:04:01 +01:00
Kawe Mazidjatari
11fa1c5119 Add case insensitive search for developer console input field
This has been requested by a user. This change will allow for searching convars from partial input regardless of the case.
2022-11-13 23:44:30 +01:00
Kawe Mazidjatari
cf1adef1a2 Add FCVAR_RELEASE unknown and extended flag textures
If FCVAR_RELEASE but not restricted by context, then display this texture in the console suggestion window.
2022-11-11 20:12:20 +01:00
Kawe Mazidjatari
525999be40 Trim value from ConVar among with the delimiter
Trim anything past the space/semicolon character as well, this is required for CCvar::FindVar(...).
2022-11-11 01:19:49 +01:00
Kawe Mazidjatari
b81566604f Fix edge case where user could still enter tilde/space characters as first characters in console
This could be done by entering a character in the console (setting m_nInputTextLen > 0), then selecting and replacing valid 'first' character out for a tilde/space. This fixes the issue.
2022-11-10 22:03:27 +01:00
Kawe Mazidjatari
5dd5f2ad11 Fix issue caused by iData->BufTextLen always being NULL in ImGuiInputTextFlags_CallbackCharFilter
iData->BufTextLen is always 0 in the ImGuiInputTextFlags_CallbackCharFilter event. ImGuiInputTextFlags_CallbackAlways is called before ImGuiInputTextFlags_CallbackCharFilter in the same frame, so we can obtain the lenght from there and perform the test to discard unwanted characters from the input field.
2022-11-10 22:01:34 +01:00
Kawe Mazidjatari
5564c4f29b CConsole: more robust input character filtering
Filter the back quote, tilde and space character properly.
2022-11-10 21:19:17 +01:00
Kawe Mazidjatari
a8fd5a24f5 Add flag textures and logic for 3 or more flags
Only check if FCVAR_DEVELOPMENTONLY or FCVAR_CHEAT is set and return a blue/red colored checkered texture. Return a rainbow checkered if 3 or more flags are encountered which are not indexed. Return half texture if 2 flags are encountered, but the second bit is not indexed.
2022-11-10 01:17:53 +01:00
Kawe Mazidjatari
3b5428051c CConsole cleanup and optimizations
* Add const qualifier to method 'GetHistory'.
* Acquire mutex lock at the start of new method 'RemoveLog'.
2022-10-24 00:50:07 +02:00
Kawe Mazidjatari
b97176a04b CBrowser: light cleanup 2022-10-21 21:28:51 +02:00
Kawe Mazidjatari
4509bc385b CConsole::SuggestPanel inprovements
* Cache m_vSuggest.size().
* Use const reference to m_vSuggest[i].
2022-10-20 15:22:20 +02:00
Kawe Mazidjatari
f6e0fd8d92 Remove extraneous string copy constructor 2022-10-20 15:07:40 +02:00
Kawe Mazidjatari
f887ac509e Use StringRTrim to trim convar string before building console summary 2022-10-20 14:57:45 +02:00
Kawe Mazidjatari
49658c498f Fix private server modal size not being set correctly
ImGui::PopStyleVar() had to be called before ISurface::DrawSurface().
2022-10-20 14:37:21 +02:00
Kawe Mazidjatari
c7d828610d Fix server browser not claiming focus on window apparition
The console draws focus as it does SetKeyboardFocusHere(-1) (on the previous widget, which is the input text field). We don't do this in the server browser, so we must explicitly claim focus by calling SetNextWindowFocus() once before the next frame gets renderer.
2022-10-20 14:23:24 +02:00
Kawe Mazidjatari
5f84803ac6 ImGui and DirectX code improvements
* Fix history duplication by removing trailing white space characters from submitted commands in console.
* Fix out of range exception caused by caching svConVar.size() in CConsole::BuildSummary while we are modifying it.
* Fixed memory leak  caused by extraneous Strdup calls in CConsole.
* Renamed variables and structure members, static vars in id3dx.cpp are not prefixed with s_, IBrowser_Config is now m_BrowserConfig.
* Performed code cleanup in id3dx.cpp.
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
31845425d6 Only enable/disable input system on open/close events
Previously we enabled/disabled the input system each frame, depending on the state of the ImGui windows. This commit changes the behavior into only enabling/disabling when the menu's are closed (either through the keyboard or the close button).

I added a simple callback to ImGui::Begin which will be called when the close button on the ImGui panel is pressed and the callback pointer isn't nullptr, this was required as there was otherwise no way to determine when the close button was clicked.
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
44f2f87460 CConsole: heavy cleanup
* Move all default assignments to constructor.
* Rename cvar 'con_max_size_logvector' to 'con_max_lines'.
* Rename cvar 'con_max_size_history' to 'con_max_history'.
* Use array indexes instead of hardcoding context prefixes.
* Added netcon context prefix to help legend.
* Added public method to obtain history as string vector.
* Added public method to clear history.
* Internal CConsole::AddLog no longer locks the mutex.
* CConsole::LoadFlagIcons accesses resource vector by reference.
* Implemented "HELP", "HISTORY" and "CLEAR" as real console commands: "con_help", "con_history", "con_clearlines".
* Added a new command "con_clearhistory" (clears the dev console submission history).
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
d113774a6d Console improvements and new command
* Commented "ImGui::SetItemDefaultFocus()", this seems to somewhat fix the issue where the input field does not claim focus on console invocation.
* Added command "con_removeline" (removes lines from start to end index).
2022-10-20 12:29:49 +02:00
Kawe Mazidjatari
dac63ee5ef Add FCVAR_REPLICATED console flag icon 2022-10-11 01:22:21 +02:00
Kawe Mazidjatari
10f728081c CConsole::FindFromPartial light cleanup
Improve readability by moving logic out of conditional scopes.
2022-10-07 22:31:16 +02:00
Kawe Mazidjatari
84b4772006 Refresh server list when the browser is activated 2022-09-14 02:39:55 +02:00
Kawe Mazidjatari
577a8760cd CConsole: add more color coded flags
* Added more color coded flags to the console autocomplete window.
* Removed 'hidden' as FCVAR_HIDDEN is now enforced on the autocomplete window.
* force real-time CommandBase flags (previously compile-time).
2022-09-12 01:49:51 +02:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +02:00
Kawe Mazidjatari
8c1d22f560 Console bug fixes
* Fixed bug where in several occasions 'm_bSuggestActive' would be true while we have nothing to suggest.
* Fixed bug where using the submit button in the console would not invoke the logic behind 'm_bModifyInput' in the text edit callback, but instead, being cleared within the scope of the submit button.
* Properly erase the ConVar past the ' ' or ';' character instead of null terminating it.
2022-09-07 01:55:52 +02:00
Kawe Mazidjatari
708e6992e4 Server browser UX improvements
* Removed extraneous text line for hosting, combined error and hosting into 1.
* Removed extraneous 'Force Start' button. The server will now 'Force Start' when the visibility is offline, else require the user to fill out the required fields in order to host the server.
* Only clear the request message when the color is green and we are no longer hosting. All errors will remain until the server is restarted through the browser panel.
2022-09-07 01:12:22 +02:00
Kawe Mazidjatari
2887e79bcb CBroswer: fix 'Stop Server' button not appearing when server script error occurs while client is attempting to connect 2022-09-05 22:32:47 +02:00
Kawe Mazidjatari
28ddf2a380 CConsole: fix bug where history scrolling did not work even when input was empty
* Reset when buffer is empty.
* Show suggestions when only 1 character has been entered.
2022-09-05 01:33:40 +02:00
Kawe Mazidjatari
900cc4dd9a CConsole: remove 'ImGuiInputTextFlags_NoUndoRedo' flag
The buffer desync defect has been fixed as of Dear ImGui v1.88.
You can now undo/redo console input.
2022-09-02 02:24:04 +02:00
Kawe Mazidjatari
54fc85e1d3 CConsole: modify input chars using the callback
Light preparation for when the lib gets updated to 1.88 to enable undo/redo again.
2022-09-02 01:18:36 +02:00
Kawe Mazidjatari
13c91c72fa Add 'Reload Banlist' button 2022-09-01 01:20:27 +02:00
Kawe Mazidjatari
41fda3a8ac Clear message when modal is closed with the 'Close' or 'X' button
This does not happen when you connect, because then you can retrieve the name of the server you connected to the next time you open the modal.
2022-08-31 21:49:28 +02:00