From f137f77826dec39ac2fda57f408d1344de6d48ea Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Wed, 24 Sep 2025 20:32:53 +0200 Subject: [PATCH 01/13] Fixed the tab completion for the subcommands off the /psc command --- mods/personal-starcount-ex.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/personal-starcount-ex.lua b/mods/personal-starcount-ex.lua index 6709a4216..37d8ff4bb 100644 --- a/mods/personal-starcount-ex.lua +++ b/mods/personal-starcount-ex.lua @@ -300,7 +300,7 @@ hook_event(HOOK_ON_INTERACT, star_counter_on_interact) hook_event(HOOK_ON_HUD_RENDER, hud_render_psc) hook_event(HOOK_ON_HUD_RENDER_BEHIND, behind_hud_render_psc) hook_event(HOOK_UPDATE, psc_update) -hook_chat_command('psc', "On|Off - Displays stars you've collected. Default is On.", toggle_psc) +hook_chat_command('psc', "[On|Off] - Displays stars you've collected. Default is On.", toggle_psc) -- Globalize functions for other mods to use -- Created by PeachyPeach From 7990d05ccbd632d1ef9f05254f2fc9074c87bf81 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Wed, 24 Sep 2025 20:41:52 +0200 Subject: [PATCH 02/13] Added reverse tab completion logic --- src/pc/djui/djui_chat_box.c | 42 ++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index bddb52f6d..cd019f2a9 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -140,6 +140,10 @@ static void djui_chat_box_input_enter(struct DjuiInputbox* chatInput) { sent_history_add_message(&sentHistory, chatInput->buffer); if (chatInput->buffer[0] == '/') { if (strcmp(chatInput->buffer, "/help") == 0 || strcmp(chatInput->buffer, "/?") == 0 || strcmp(chatInput->buffer, "/") == 0) { + char tabcompletionHint[MAX_CHAT_MSG_LENGTH]; + snprintf(tabcompletionHint, sizeof(tabcompletionHint), "\\#ff2020\\%s \\#ffa020\\(%s)\\#ff2020\\:\\#000000\\", + DLANG(CHAT, ALL_COMMANDS), DLANG(CHAT, TAB_COMPLETE_INFO)); + djui_chat_message_create(tabcompletionHint); display_chat_commands(); } else if (!exec_chat_command(chatInput->buffer)) { char extendedUnknownCommandMessage[MAX_CHAT_MSG_LENGTH]; @@ -176,7 +180,7 @@ static char* get_main_command_from_input(const char* input) { return command; } -static bool complete_subcommand(const char* mainCommand, const char* subCommandPrefix) { +static bool complete_subcommand(const char* mainCommand, const char* subCommandPrefix, bool reverse) { char** subcommands = smlua_get_chat_subcommands_list(mainCommand); if (!subcommands || !subcommands[0]) { @@ -192,7 +196,13 @@ static bool complete_subcommand(const char* mainCommand, const char* subCommandP bool completionSuccess = false; if (foundSubCommandsCount > 0) { - sCommandsTabCompletionIndex = (sCommandsTabCompletionIndex + 1) % foundSubCommandsCount; + if (reverse) { + sCommandsTabCompletionIndex = (sCommandsTabCompletionIndex <= 0) + ? foundSubCommandsCount - 1 + : (sCommandsTabCompletionIndex - 1) % foundSubCommandsCount; + } else { + sCommandsTabCompletionIndex = (sCommandsTabCompletionIndex + 1) % foundSubCommandsCount; + } s32 currentIndex = 0; for (s32 i = 0; subcommands[i] != NULL; i++) { @@ -273,7 +283,7 @@ void djui_inputbox_replace_current_word(struct DjuiInputbox* inputbox, char* tex djui_inputbox_move_cursor_to_position(inputbox, currentWordStart + strlen(text)); } -static bool complete_player_name(const char* namePrefix) { +static bool complete_player_name(const char* namePrefix, bool reverse) { char** playerNames = smlua_get_chat_player_list(); if (!playerNames || !playerNames[0]) { if (playerNames) { @@ -291,7 +301,13 @@ static bool complete_player_name(const char* namePrefix) { bool completionSuccess = false; if (foundNamesCount > 0) { - sPlayersTabCompletionIndex = (sPlayersTabCompletionIndex + 1) % foundNamesCount; + if (reverse) { + sPlayersTabCompletionIndex = (sPlayersTabCompletionIndex <= 0) + ? foundNamesCount - 1 + : (sPlayersTabCompletionIndex - 1) % foundNamesCount; + } else { + sPlayersTabCompletionIndex = (sPlayersTabCompletionIndex + 1) % foundNamesCount; + } s32 currentIndex = 0; for (s32 i = 0; playerNames[i] != NULL; i++) { @@ -314,14 +330,14 @@ static bool complete_player_name(const char* namePrefix) { return completionSuccess; } -static void handle_tab_completion(void) { +static void handle_tab_completion(bool reverse) { bool alreadyTabCompleted = false; if (gDjuiChatBox->chatInput->buffer[0] == '/') { char* spacePosition = strrchr(sCommandsTabCompletionOriginalText, ' '); if (spacePosition != NULL) { char* mainCommand = get_main_command_from_input(sCommandsTabCompletionOriginalText); if (mainCommand) { - if (!complete_subcommand(mainCommand + 1, spacePosition + 1)) { + if (!complete_subcommand(mainCommand + 1, spacePosition + 1, reverse)) { reset_tab_completion_all(); } else { alreadyTabCompleted = true; @@ -344,7 +360,13 @@ static void handle_tab_completion(void) { } if (foundCommandsCount > 0) { - sCommandsTabCompletionIndex = (sCommandsTabCompletionIndex + 1) % foundCommandsCount; + if (reverse) { + sCommandsTabCompletionIndex = (sCommandsTabCompletionIndex <= 0) + ? foundCommandsCount - 1 + : (sCommandsTabCompletionIndex - 1) % foundCommandsCount; + } else { + sCommandsTabCompletionIndex = (sCommandsTabCompletionIndex + 1) % foundCommandsCount; + } s32 currentIndex = 0; for (s32 i = 0; commands[i] != NULL; i++) { @@ -364,7 +386,7 @@ static void handle_tab_completion(void) { if (spacePositionB != NULL) { char* mainCommandB = get_main_command_from_input(sCommandsTabCompletionOriginalText); if (mainCommandB) { - if (!complete_subcommand(mainCommandB + 1, spacePositionB + 1)) { + if (!complete_subcommand(mainCommandB + 1, spacePositionB + 1, reverse)) { reset_tab_completion_all(); } else { alreadyTabCompleted = true; @@ -404,7 +426,7 @@ static void handle_tab_completion(void) { if (sPlayersTabCompletionIndex == -1) { snprintf(sPlayersTabCompletionOriginalText, MAX_CHAT_MSG_LENGTH, "%s", wordInfo.word); } - if (!complete_player_name(sPlayersTabCompletionOriginalText)) { + if (!complete_player_name(sPlayersTabCompletionOriginalText, reverse)) { reset_tab_completion_players(); } else { alreadyTabCompleted = true; @@ -457,7 +479,7 @@ static bool djui_chat_box_input_on_key_down(UNUSED struct DjuiBase* base, int sc gDjuiChatBox->scrollY -= pageAmount; break; case SCANCODE_TAB: - handle_tab_completion(); + handle_tab_completion(gDjuiInputHeldShift); return true; case SCANCODE_ENTER: reset_tab_completion_all(); From 09d29d8e98aa29d34225a993f1a3fd71e611bfe5 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Wed, 24 Sep 2025 20:45:01 +0200 Subject: [PATCH 03/13] Added translations keys --- lang/Czech.ini | 2 ++ lang/Dutch.ini | 2 ++ lang/English.ini | 2 ++ lang/French.ini | 2 ++ lang/German.ini | 2 ++ lang/Italian.ini | 2 ++ lang/Japanese.ini | 2 ++ lang/Polish.ini | 2 ++ lang/Portuguese.ini | 2 ++ lang/Russian.ini | 2 ++ lang/Spanish.ini | 2 ++ 11 files changed, 22 insertions(+) diff --git a/lang/Czech.ini b/lang/Czech.ini index ddf7ae547..33f515085 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [JMÉNO|ID] - Hráč bude moci používat příkazy jako NAMETAGS_DESC = "/nametags [show-tag|show-health] - Změňte, zda vidíte svůj vlastní štítek a zda vidíte zdraví" UNRECOGNIZED = "Neznámý příkaz." MOD_GRANTED = "\\#fff982\\Jste nyní moderátor." +ALL_COMMANDS = "Všechny příkazy" +TAB_COMPLETE_INFO = "Stiskni TAB pro automatické dokončení příkazů, Shift+TAB naviguje zpět" [MENU] BACK = "Zpět" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index a06530f8b..40cdb3602 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAAM|ID] - Geeft deze spelere de toestemming om commando NAMETAGS_DESC = "/nametags [show-tag|show-health] - Verander of je je eigen naamtag ziet en of je gezondheid ziet" UNRECOGNIZED = "onbekent Chat commando." MOD_GRANTED = "\\#fff982\\Je bent nu een Moderator." +ALL_COMMANDS = "Alle commando's" +TAB_COMPLETE_INFO = "Druk op TAB om opdrachten automatisch aan te vullen, gebruik Shift+TAB om terug te gaan" [MENU] BACK = "Terug" diff --git a/lang/English.ini b/lang/English.ini index 14ec1d462..4a835249b 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAME|ID] - Make this player able to use commands like /k NAMETAGS_DESC = "/nametags [show-tag|show-health] - Change whether or not you see your own nametag and whether or not you see health" UNRECOGNIZED = "Unrecognized chat command." MOD_GRANTED = "\\#fff982\\You are now a Moderator." +ALL_COMMANDS = "All commands" +TAB_COMPLETE_INFO = "Press TAB to autocomplete commands, use Shift+TAB to navigate backwards" [MENU] BACK = "Back" diff --git a/lang/French.ini b/lang/French.ini index b0dfe3be2..404597073 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAME|ID] - Rend ce joueur capable d'utiliser des command NAMETAGS_DESC = "/nametags [show-tag|show-health] - Modifiez si vous voyez votre propre étiquette de nom et si vous voyez la santé" UNRECOGNIZED = "Cette commande n'est pas reconnue." MOD_GRANTED = "\\#fff982\\Vous êtes désormais un modérateur." +ALL_COMMANDS = "Toutes les commandes" +TAB_COMPLETE_INFO = "Appuie sur TAB pour compléter automatiquement les commandes, utilise Shift+TAB pour revenir en arrière" [MENU] BACK = "Retour" diff --git a/lang/German.ini b/lang/German.ini index 46d0bf440..f12fe5ed6 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAME|ID] - Gebe einem Spieler Moderator rechte wie /kick NAMETAGS_DESC = "/nametags [show-tag|show-health] - Sichtbarkeit von Spielernamen sowie der KP/Kraft aktivieren oder deaktivieren " UNRECOGNIZED = "Unbekannter Befehl!" MOD_GRANTED = "\\#fff982\\Du bist jetzt ein Moderator." +ALL_COMMANDS = "Alle Befehle" +TAB_COMPLETE_INFO = "Drücke TAB zum Autovervollständigen der Befehle, mit Shift+TAB navigierst du rückwärts" [MENU] BACK = "Zurück" diff --git a/lang/Italian.ini b/lang/Italian.ini index e0827a2f6..2cdd7f201 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAME|ID] - Dai al giocatore il permesso di eseguire coma NAMETAGS_DESC = "/nametags [show-tag|show-health] - Cambia la visibilità del tuo nome e della salute" UNRECOGNIZED = "Comando non riconosciuto." MOD_GRANTED = "\\#fff982\\Ora sei un moderatore." +ALL_COMMANDS = "Tutti i comandi" +TAB_COMPLETE_INFO = "Premi TAB per completare automaticamente i comandi, usa Shift+TAB per navigare all'indietro" [MENU] BACK = "Indietro" diff --git a/lang/Japanese.ini b/lang/Japanese.ini index 322c449e8..439ded225 100644 --- a/lang/Japanese.ini +++ b/lang/Japanese.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAME|ID] - プレイヤーに/kick、/ban、/permbanの NAMETAGS_DESC = "/nametags [show-tag|show-health] - あなたの体力やネームタグの表示を変更します。" UNRECOGNIZED = "未知のコマンドです。" MOD_GRANTED = "\\#fff982\\あなたはモデレーターになりました。" +ALL_COMMANDS = "すべてのコマンド" +TAB_COMPLETE_INFO = "TABキーでコマンドを自動補完、Shift+TABで逆方向に移動" [MENU] BACK = "戻る" diff --git a/lang/Polish.ini b/lang/Polish.ini index 9781c549e..698550388 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAME|ID] - Umożliwia temu graczowi korzystanie z polece NAMETAGS_DESC = "/nametags [show-tag|show-health] - Zmień, czy widzisz swój identyfikator i czy widzisz zdrowie" UNRECOGNIZED = "Nieznane polecenie czatu." MOD_GRANTED = "\\#fff982\\Jesteś teraz Moderatorem." +ALL_COMMANDS = "Wszystkie komendy" +TAB_COMPLETE_INFO = "Naciśnij TAB, aby autouzupełnić polecenia, użyj Shift+TAB, aby cofnąć się" [MENU] BACK = "Wróć" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index e935499a6..6dba6e874 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NOME|ID] - Permite que um jogador use comandos como /kic NAMETAGS_DESC = "/nametags [show-tag|show-health] - Altera se você vê sua própria etiqueta ou a barra de vida de outros jogadores" UNRECOGNIZED = "Comando de chat desconhecido." MOD_GRANTED = "\\#fff982\\Você é um(a) moderador(a) agora." +ALL_COMMANDS = "Todos os comandos" +TAB_COMPLETE_INFO = "Pressiona TAB para autocompletar comandos, usa Shift+TAB para navegar para trás" [MENU] BACK = "Voltar" diff --git a/lang/Russian.ini b/lang/Russian.ini index c08f39c8a..a4277a0dc 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAME|ID] - Разрешить игроку исполь NAMETAGS_DESC = "/nametags [show-tag|show-health] - Измените, видите ли вы свой собственный тег и видите ли здоровье" UNRECOGNIZED = "Неизвестная команда чата." MOD_GRANTED = "\\#fff982\\Теперь вы модератор." +ALL_COMMANDS = "Все команды" +TAB_COMPLETE_INFO = "Нажми TAB для автодополнения команд, Shift+TAB — переход назад" [MENU] BACK = "Назад" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index 039f31e26..967bd71bc 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -58,6 +58,8 @@ MOD_DESC = "/moderator [NAME|ID] - Permite a un jugador usar comandos como /kick NAMETAGS_DESC = "/nametags [show-tag|show-health] - Cambia si ves tu propia etiqueta y si ves la salud" UNRECOGNIZED = "Comando desconocido." MOD_GRANTED = "\\#fff982\\Ahora eres un moderador." +ALL_COMMANDS = "Todos los comandos" +TAB_COMPLETE_INFO = "Pulsa TAB para autocompletar comandos, usa Shift+TAB para retroceder" [MENU] BACK = "Volver" From 1805004135978240e2429092e8a1b681420368fb Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Thu, 25 Sep 2025 22:56:27 +0200 Subject: [PATCH 04/13] Add keybind to open chat with "/" pre-written --- lang/Czech.ini | 1 + lang/Dutch.ini | 1 + lang/English.ini | 1 + lang/French.ini | 1 + lang/German.ini | 1 + lang/Italian.ini | 1 + lang/Japanese.ini | 1 + lang/Polish.ini | 1 + lang/Portuguese.ini | 1 + lang/Russian.ini | 1 + lang/Spanish.ini | 1 + src/pc/configfile.c | 39 +++++++++++++++++++++++++ src/pc/configfile.h | 1 + src/pc/djui/djui_chat_box.c | 13 +++++++++ src/pc/djui/djui_chat_box.h | 1 + src/pc/djui/djui_interactable.c | 11 +++++-- src/pc/djui/djui_panel_controls_extra.c | 25 ++++++++-------- 17 files changed, 87 insertions(+), 14 deletions(-) diff --git a/lang/Czech.ini b/lang/Czech.ini index 33f515085..98bcb8701 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -107,6 +107,7 @@ DEADZONE = "Deadzone" RUMBLE_STRENGTH = "Síla vibrace" CHAT = "Chat" +CHAT_COMMAND = "Chat (Příkaz)" PLAYERS = "Hráči" D_UP = "D-Pad nahoru" D_DOWN = "D-Pad dolů" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 40cdb3602..825a8feb6 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -107,6 +107,7 @@ DEADZONE = "Doode-zone" RUMBLE_STRENGTH = "Rommel Kracht" CHAT = "Chat" +CHAT_COMMAND = "Chat (Commando)" PLAYERS = "Spelers" D_UP = "D Omhoog" D_DOWN = "D Naar Beneden" diff --git a/lang/English.ini b/lang/English.ini index 4a835249b..9ae85f73b 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -107,6 +107,7 @@ DEADZONE = "Deadzone" RUMBLE_STRENGTH = "Rumble Strength" CHAT = "Chat" +CHAT_COMMAND = "Chat (Command)" PLAYERS = "Players" D_UP = "D-Up" D_DOWN = "D-Down" diff --git a/lang/French.ini b/lang/French.ini index 404597073..b1ae398b6 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -107,6 +107,7 @@ DEADZONE = "Zone Morte" RUMBLE_STRENGTH = "Vibrations" CHAT = "Chat" +CHAT_COMMAND = "Chat (Commande)" PLAYERS = "Joueurs" D_UP = "D Haut" D_DOWN = "D Bas" diff --git a/lang/German.ini b/lang/German.ini index f12fe5ed6..c2a8eb998 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -107,6 +107,7 @@ DEADZONE = "Tote Zone" RUMBLE_STRENGTH = "Vibration-Stärke" CHAT = "Chat" +CHAT_COMMAND = "Chat (Befehl)" PLAYERS = "Spieler" D_UP = "D-Hoch" D_DOWN = "D-Unten" diff --git a/lang/Italian.ini b/lang/Italian.ini index 2cdd7f201..55d7a4d43 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -105,6 +105,7 @@ GAMEPAD = "Controller" DEADZONE = "Zona Morta" RUMBLE_STRENGTH = "Intesità Vibrazione" CHAT = "Chat" +CHAT_COMMAND = "Chat (Comando)" PLAYERS = "Giocatori" D_UP = "D Su" D_DOWN = "D Giù" diff --git a/lang/Japanese.ini b/lang/Japanese.ini index 439ded225..7f06356a9 100644 --- a/lang/Japanese.ini +++ b/lang/Japanese.ini @@ -108,6 +108,7 @@ DEADZONE = "デッドゾーン" RUMBLE_STRENGTH = "振動の強さ" CHAT = "チャット" +CHAT_COMMAND = "チャット(コマンド)" PLAYERS = "プレイヤーリストの表示" D_UP = "十字キー 上" D_DOWN = "十字キー 下" diff --git a/lang/Polish.ini b/lang/Polish.ini index 698550388..8bad911f6 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -107,6 +107,7 @@ DEADZONE = "Martwa Strefa" RUMBLE_STRENGTH = "Siła Wibracji" CHAT = "Czat" +CHAT_COMMAND = "Czat (Komenda)" PLAYERS = "Gracze" D_UP = "Kierunek w Górę" D_DOWN = "Kierunek w Dół" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index 6dba6e874..15db94c24 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -107,6 +107,7 @@ DEADZONE = "Zona morta" RUMBLE_STRENGTH = "Força de vibração" CHAT = "Chat" +CHAT_COMMAND = "Chat (Comando)" PLAYERS = "Jogadores" D_UP = "D-Cima" D_DOWN = "D-Baixo" diff --git a/lang/Russian.ini b/lang/Russian.ini index a4277a0dc..babf6ac03 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -106,6 +106,7 @@ DEADZONE = "Mёртвая зона" RUMBLE_STRENGTH = "Вибрация" CHAT = "Чат" +CHAT_COMMAND = "Чат (Команда)" PLAYERS = "Игроки" D_UP = "Крестовина вверх" D_DOWN = "Крестовина вниз" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index 967bd71bc..5d2ae2d4f 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -107,6 +107,7 @@ DEADZONE = "Zona muerta" RUMBLE_STRENGTH = "Intensidad de vibración" CHAT = "Chat" +CHAT_COMMAND = "Chat (Comando)" PLAYERS = "Jugadores" D_UP = "Cruz Arriba" D_DOWN = "Cruz Abajo" diff --git a/src/pc/configfile.c b/src/pc/configfile.c index f2267a7db..220a7d693 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -4,6 +4,9 @@ #include #include #include +#ifdef _WIN32 +#include +#endif #include #include "platform.h" @@ -114,6 +117,7 @@ unsigned int configKeyStickDown[MAX_BINDS] = { 0x001F, VK_INVALID, VK unsigned int configKeyStickLeft[MAX_BINDS] = { 0x001E, VK_INVALID, VK_INVALID }; unsigned int configKeyStickRight[MAX_BINDS] = { 0x0020, VK_INVALID, VK_INVALID }; unsigned int configKeyChat[MAX_BINDS] = { 0x001C, VK_INVALID, VK_INVALID }; +unsigned int configKeyChatCommand[MAX_BINDS] = { VK_INVALID, VK_INVALID, VK_INVALID }; unsigned int configKeyPlayerList[MAX_BINDS] = { 0x000F, 0x1004, VK_INVALID }; unsigned int configKeyDUp[MAX_BINDS] = { 0x0147, 0x100b, VK_INVALID }; unsigned int configKeyDDown[MAX_BINDS] = { 0x014f, 0x100c, VK_INVALID }; @@ -257,6 +261,7 @@ static const struct ConfigOption options[] = { {.name = "key_stickleft", .type = CONFIG_TYPE_BIND, .uintValue = configKeyStickLeft}, {.name = "key_stickright", .type = CONFIG_TYPE_BIND, .uintValue = configKeyStickRight}, {.name = "key_chat", .type = CONFIG_TYPE_BIND, .uintValue = configKeyChat}, + {.name = "key_chat_command", .type = CONFIG_TYPE_BIND, .uintValue = configKeyChatCommand}, {.name = "key_playerlist", .type = CONFIG_TYPE_BIND, .uintValue = configKeyPlayerList}, {.name = "key_dup", .type = CONFIG_TYPE_BIND, .uintValue = configKeyDUp}, {.name = "key_ddown", .type = CONFIG_TYPE_BIND, .uintValue = configKeyDDown}, @@ -666,6 +671,23 @@ static void configfile_load_internal(const char *filename, bool* error) { if (file == NULL) { // Create a new config file and save defaults printf("Config file '%s' not found. Creating it.\n", filename); + // set sensible default for chat command key depending on keyboard layout + if (configKeyChatCommand[0] == VK_INVALID && configKeyChatCommand[1] == VK_INVALID && configKeyChatCommand[2] == VK_INVALID) { +#ifdef _WIN32 + HKL hkl = GetKeyboardLayout(0); + LANGID lang = LOWORD(hkl); + switch (PRIMARYLANGID(lang)) { + case LANG_GERMAN: + configKeyChatCommand[0] = 0x002B; // '#' on QWERTZ (OEM_5 position) + break; + default: + configKeyChatCommand[0] = 0x0035; // '/' on US QWERTY + break; + } +#else + configKeyChatCommand[0] = 0x0035; // '/' default on non-Windows +#endif + } configfile_save(filename); return; } @@ -777,6 +799,23 @@ NEXT_OPTION: } fs_close(file); + // If user has no chat command bind yet, set a default based on layout + if (configKeyChatCommand[0] == VK_INVALID && configKeyChatCommand[1] == VK_INVALID && configKeyChatCommand[2] == VK_INVALID) { +#ifdef _WIN32 + HKL hkl = GetKeyboardLayout(0); + LANGID lang = LOWORD(hkl); + switch (PRIMARYLANGID(lang)) { + case LANG_GERMAN: + configKeyChatCommand[0] = 0x002B; // '#' + break; + default: + configKeyChatCommand[0] = 0x0035; // '/' + break; + } +#else + configKeyChatCommand[0] = 0x0035; +#endif + } if (configFramerateMode < 0 || configFramerateMode > RRM_MAX) { configFramerateMode = 0; } if (configFrameLimit < 30) { configFrameLimit = 30; } diff --git a/src/pc/configfile.h b/src/pc/configfile.h index d537970e4..755fe6ba9 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -80,6 +80,7 @@ extern unsigned int configKeyStickDown[MAX_BINDS]; extern unsigned int configKeyStickLeft[MAX_BINDS]; extern unsigned int configKeyStickRight[MAX_BINDS]; extern unsigned int configKeyChat[MAX_BINDS]; +extern unsigned int configKeyChatCommand[MAX_BINDS]; extern unsigned int configKeyPlayerList[MAX_BINDS]; extern unsigned int configKeyDUp[MAX_BINDS]; extern unsigned int configKeyDDown[MAX_BINDS]; diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index cd019f2a9..01710083f 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -542,6 +542,19 @@ void djui_chat_box_toggle(void) { gDjuiChatBox->chatFlow->base.y.value = gDjuiChatBox->chatContainer->base.elem.height - gDjuiChatBox->chatFlow->base.height.value; } +void djui_chat_box_open_with_text(const char* text) { + if (gDjuiChatBox == NULL) { return; } + if (!gDjuiChatBoxFocus) { + sDjuiChatBoxClearText = false; + gDjuiChatBoxFocus = true; + djui_chat_box_set_focus_style(); + } + if (gDjuiChatBox->chatInput != NULL && text != NULL) { + djui_inputbox_set_text(gDjuiChatBox->chatInput, (char*)text); + djui_inputbox_move_cursor_to_end(gDjuiChatBox->chatInput); + } +} + struct DjuiChatBox* djui_chat_box_create(void) { if (gDjuiChatBox != NULL) { djui_base_destroy(&gDjuiChatBox->base); diff --git a/src/pc/djui/djui_chat_box.h b/src/pc/djui/djui_chat_box.h index 1c5a7d150..a37005c67 100644 --- a/src/pc/djui/djui_chat_box.h +++ b/src/pc/djui/djui_chat_box.h @@ -14,4 +14,5 @@ extern struct DjuiChatBox* gDjuiChatBox; extern bool gDjuiChatBoxFocus; void djui_chat_box_toggle(void); +void djui_chat_box_open_with_text(const char* text); struct DjuiChatBox* djui_chat_box_create(void); diff --git a/src/pc/djui/djui_interactable.c b/src/pc/djui/djui_interactable.c index 288844e86..79137aeb3 100644 --- a/src/pc/djui/djui_interactable.c +++ b/src/pc/djui/djui_interactable.c @@ -211,16 +211,23 @@ bool djui_interactable_on_key_down(int scancode) { } } - if (gDjuiChatBox != NULL && !gDjuiChatBoxFocus) { + if (gDjuiChatBox != NULL) { bool pressChat = false; + bool pressChatCommand = false; for (int i = 0; i < MAX_BINDS; i++) { if (scancode == (int)configKeyChat[i]) { pressChat = true; } + if (scancode == (int)configKeyChatCommand[i]) { pressChatCommand = true; } } - if (pressChat && !gDjuiConsoleFocus) { + if (pressChat && !gDjuiConsoleFocus && !gDjuiChatBoxFocus) { djui_chat_box_toggle(); return true; } + + if (pressChatCommand && !gDjuiConsoleFocus) { + djui_chat_box_open_with_text("/"); + return true; + } } if ((gDjuiPlayerList != NULL || gDjuiModList != NULL)) { diff --git a/src/pc/djui/djui_panel_controls_extra.c b/src/pc/djui/djui_panel_controls_extra.c index e4727b45f..9669dea17 100644 --- a/src/pc/djui/djui_panel_controls_extra.c +++ b/src/pc/djui/djui_panel_controls_extra.c @@ -15,18 +15,19 @@ void djui_panel_controls_extra_create(struct DjuiBase* caller) { djui_base_set_color(&bindBody->base, 0, 0, 0, 0); djui_flow_layout_set_margin(bindBody, 1); { - djui_bind_create(&bindBody->base, DLANG(CONTROLS, CHAT), configKeyChat); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, PLAYERS), configKeyPlayerList); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_UP), configKeyDUp); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_DOWN), configKeyDDown); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_LEFT), configKeyDLeft); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_RIGHT), configKeyDRight); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, X), configKeyX); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, Y), configKeyY); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, CONSOLE), configKeyConsole); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, PREV), configKeyPrevPage); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, NEXT), configKeyNextPage); - djui_bind_create(&bindBody->base, DLANG(CONTROLS, DISCONNECT), configKeyDisconnect); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, CHAT), configKeyChat); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, CHAT_COMMAND), configKeyChatCommand); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, PLAYERS), configKeyPlayerList); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_UP), configKeyDUp); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_DOWN), configKeyDDown); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_LEFT), configKeyDLeft); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_RIGHT), configKeyDRight); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, X), configKeyX); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, Y), configKeyY); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, CONSOLE), configKeyConsole); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, PREV), configKeyPrevPage); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, NEXT), configKeyNextPage); + djui_bind_create(&bindBody->base, DLANG(CONTROLS, DISCONNECT), configKeyDisconnect); } djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); From 2decea5693f944bdf72da026e53895a87c202d37 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sat, 27 Sep 2025 20:40:24 +0200 Subject: [PATCH 05/13] Prevent duplicate messages in chat history --- src/pc/djui/djui_chat_box.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index 01710083f..393e876bd 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -54,6 +54,11 @@ void sent_history_init(ArrayList *arrayList) { void sent_history_add_message(ArrayList *arrayList, const char *newMessage) { if (!configUseStandardKeyBindingsChat && (!newMessage || newMessage[0] != '/')) { return; } + // Don't add duplicate messages - check if the new message is the same as the last one + if (arrayList->size > 0 && strcmp(arrayList->messages[arrayList->size - 1], newMessage) == 0) { + return; + } + if (arrayList->size == MAX_HISTORY_SIZE) { for (s32 i = 1; i < MAX_HISTORY_SIZE; i++) { snprintf(arrayList->messages[i-1], MAX_CHAT_MSG_LENGTH, "%s", arrayList->messages[i]); From 9138125c8a4f887e6ac17f7206bb72822a87673f Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sat, 27 Sep 2025 20:42:41 +0200 Subject: [PATCH 06/13] Enable classic chatbox controls by default --- src/pc/configfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 220a7d693..a3d495775 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -132,7 +132,7 @@ unsigned int configRumbleStrength = 50; unsigned int configGamepadNumber = 0; bool configBackgroundGamepad = true; bool configDisableGamepads = false; -bool configUseStandardKeyBindingsChat = false; +bool configUseStandardKeyBindingsChat = true; bool configSmoothScrolling = false; // free camera settings bool configEnableFreeCamera = false; From 88a7b246abdc1498cb7458d00382a29df45bc845 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sat, 27 Sep 2025 20:55:04 +0200 Subject: [PATCH 07/13] Improved chat controls setting checkbox text --- lang/Czech.ini | 2 +- lang/Dutch.ini | 2 +- lang/English.ini | 2 +- lang/French.ini | 2 +- lang/German.ini | 2 +- lang/Italian.ini | 2 +- lang/Japanese.ini | 2 +- lang/Polish.ini | 2 +- lang/Portuguese.ini | 2 +- lang/Russian.ini | 2 +- lang/Spanish.ini | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lang/Czech.ini b/lang/Czech.ini index 98bcb8701..0474af3d2 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -322,7 +322,7 @@ DEBUG_ERRORS = "Debug Errors" MISC_TITLE = "JINE" PAUSE_IN_SINGLEPLAYER = "Pauza v hře s jedním hráčem" DISABLE_POPUPS = "Vypnout vyskakovací okna" -USE_STANDARD_KEY_BINDINGS_CHAT = "Klasické ovládání chatu" +USE_STANDARD_KEY_BINDINGS_CHAT = "Použít ovládání chatu Terminal/CMD" MENU_OPTIONS = "Nastavení hlavního menu" INFORMATION = "Informace" DEBUG = "Debug" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 825a8feb6..0238ea1a7 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -322,7 +322,7 @@ DEBUG_ERRORS = "Debug Errors" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Pauzeer in een speler" DISABLE_POPUPS = "Popups uitzetten" -USE_STANDARD_KEY_BINDINGS_CHAT = "Klassieke chatbediening" +USE_STANDARD_KEY_BINDINGS_CHAT = "Terminal/CMD Chatbox besturingen gebruiken" MENU_OPTIONS = "Menu Instellingen" INFORMATION = "Informatie" DEBUG = "Debug" diff --git a/lang/English.ini b/lang/English.ini index 9ae85f73b..b8676aa00 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -322,7 +322,7 @@ DEBUG_ERRORS = "Debug Errors" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Pause In Singleplayer" DISABLE_POPUPS = "Disable Popups" -USE_STANDARD_KEY_BINDINGS_CHAT = "Classic Chatbox Controls" +USE_STANDARD_KEY_BINDINGS_CHAT = "Use Terminal/CMD Chatbox Controls" MENU_OPTIONS = "Menu Options" INFORMATION = "Info" DEBUG = "Debug" diff --git a/lang/French.ini b/lang/French.ini index b1ae398b6..1bd634124 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -322,7 +322,7 @@ DEBUG_ERRORS = "Erreurs de Débogage" MISC_TITLE = "AUTRES" PAUSE_IN_SINGLEPLAYER = "Pause en Solo" DISABLE_POPUPS = "Désactiver les Pop-ups" -USE_STANDARD_KEY_BINDINGS_CHAT = "Commandes de chat classiques" +USE_STANDARD_KEY_BINDINGS_CHAT = "Utiliser les contrôles de chat Terminal/CMD" MENU_OPTIONS = "Options du menu" INFORMATION = "Information" DEBUG = "Débogage" diff --git a/lang/German.ini b/lang/German.ini index c2a8eb998..29dd12abe 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -322,7 +322,7 @@ DEBUG_ERRORS = "Debug Fehler" MISC_TITLE = "SONSTIGES" PAUSE_IN_SINGLEPLAYER = "Pause im Einzelspieler" DISABLE_POPUPS = "Pop-ups deaktivieren" -USE_STANDARD_KEY_BINDINGS_CHAT = "Standard-Tastennavigation im Chat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Terminal/CMD Chatbox-Steuerung verwenden" MENU_OPTIONS = "Menüoptionen" INFORMATION = "Info" DEBUG = "Debug" diff --git a/lang/Italian.ini b/lang/Italian.ini index 55d7a4d43..7a62952a4 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -320,7 +320,7 @@ DEBUG_ERRORS = "Errori di debug" MISC_TITLE = "VARIE" PAUSE_IN_SINGLEPLAYER = "Pausa in Giocatore Singolo" DISABLE_POPUPS = "Disabilita Popup" -USE_STANDARD_KEY_BINDINGS_CHAT = "Controlli della chat classici" +USE_STANDARD_KEY_BINDINGS_CHAT = "Usa controlli chat Terminale/CMD" MENU_OPTIONS = "Opzioni Menù" INFORMATION = "Informazione" DEBUG = "Debug" diff --git a/lang/Japanese.ini b/lang/Japanese.ini index 7f06356a9..b04e8bbf2 100644 --- a/lang/Japanese.ini +++ b/lang/Japanese.ini @@ -323,7 +323,7 @@ DEBUG_ERRORS = "デバッグのエラー" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "ソロプレイでの一時停止" DISABLE_POPUPS = "ポップアップを無効にする" -USE_STANDARD_KEY_BINDINGS_CHAT = "初期のチャット操作" +USE_STANDARD_KEY_BINDINGS_CHAT = "ターミナル/CMDチャットボックスコントロールを使用" MENU_OPTIONS = "メニューの設定" INFORMATION = "情報" DEBUG = "デバッグ" diff --git a/lang/Polish.ini b/lang/Polish.ini index 8bad911f6..d0b196bfe 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -322,7 +322,7 @@ DEBUG_ERRORS = "Błędy z Debugowania" MISC_TITLE = "POZOSTAŁE OPCJE" PAUSE_IN_SINGLEPLAYER = "Pauza w Trybie Pojedynczego Gracza" DISABLE_POPUPS = "Wyłącz Dymki Powiadomień" -USE_STANDARD_KEY_BINDINGS_CHAT = "Klasyczna Historia Czatu" +USE_STANDARD_KEY_BINDINGS_CHAT = "Użyj sterowania czatu Terminal/CMD" MENU_OPTIONS = "Opcje Menu" INFORMATION = "Informacja" DEBUG = "Debugowanie" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index 15db94c24..e014f5add 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -322,7 +322,7 @@ DEBUG_ERRORS = "Erros de debug" MISC_TITLE = "OUTROS" PAUSE_IN_SINGLEPLAYER = "Pausar com apenas um jogador" DISABLE_POPUPS = "Desativar pop-ups" -USE_STANDARD_KEY_BINDINGS_CHAT = "Controles clássicos do chat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles de chat Terminal/CMD" MENU_OPTIONS = "Opções de menu" INFORMATION = "Informações" DEBUG = "Debug" diff --git a/lang/Russian.ini b/lang/Russian.ini index babf6ac03..baa79ef4f 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -321,7 +321,7 @@ DEBUG_ERRORS = "Ошибки отладки" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Пауза в одиночной игре" DISABLE_POPUPS = "Отключить всплывающие окна" -USE_STANDARD_KEY_BINDINGS_CHAT = "Классическое управление чатом" +USE_STANDARD_KEY_BINDINGS_CHAT = "Использовать управление чатом Terminal/CMD" MENU_OPTIONS = "Параметры меню" INFORMATION = "Информация" DEBUG = "Отладка" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index 5d2ae2d4f..15a8a317e 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -322,7 +322,7 @@ DEBUG_ERRORS = "Errores de Depuración" MISC_TITLE = "OTROS" PAUSE_IN_SINGLEPLAYER = "Pausa en modo de un jugador" DISABLE_POPUPS = "Deshabilitar mensajes emergentes" -USE_STANDARD_KEY_BINDINGS_CHAT = "Controles de chat clásicos" +USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles de chat Terminal/CMD" MENU_OPTIONS = "Opciones del menú" INFORMATION = "Información" DEBUG = "Depuración" From 5c939c6dedb0c495d3b183da7dd793ab911fb9e9 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sat, 27 Sep 2025 22:44:13 +0200 Subject: [PATCH 08/13] Add tab completion preview for chat commands & subcommands --- src/pc/djui/djui_chat_box.c | 69 +++++++++++++++++++++++++++++++ src/pc/djui/djui_chat_box.h | 1 + src/pc/djui/djui_inputbox.c | 82 +++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+) diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index 393e876bd..5224f86f1 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -335,6 +335,75 @@ static bool complete_player_name(const char* namePrefix, bool reverse) { return completionSuccess; } +char* get_next_tab_completion_preview(const char* input) { + if (input[0] != '/') { + return NULL; + } + + char* spacePosition = strrchr(input, ' '); + if (spacePosition != NULL) { + // Subcommand completion + char* mainCommand = get_main_command_from_input(input); + if (mainCommand) { + char** subcommands = smlua_get_chat_subcommands_list(mainCommand + 1); + if (subcommands && subcommands[0]) { + s32 foundSubCommandsCount = 0; + + // Count matching subcommands + for (s32 i = 0; subcommands[i] != NULL; i++) { + if (strncmp(subcommands[i], spacePosition + 1, strlen(spacePosition + 1)) == 0) { + foundSubCommandsCount++; + } + } + + if (foundSubCommandsCount > 0) { + // Find the first matching subcommand + for (s32 i = 0; subcommands[i] != NULL; i++) { + if (strncmp(subcommands[i], spacePosition + 1, strlen(spacePosition + 1)) == 0) { + char* preview = malloc(MAX_CHAT_MSG_LENGTH); + // Only show the missing part of the subcommand + char* inputSubcommand = spacePosition + 1; + char* missingPart = subcommands[i] + strlen(inputSubcommand); + snprintf(preview, MAX_CHAT_MSG_LENGTH, "%s", missingPart); + free(mainCommand); + return preview; + } + } + } + } + free(mainCommand); + } + } else { + // Main command completion + char* bufferWithoutSlash = (char*)input + 1; + char** commands = smlua_get_chat_maincommands_list(); + if (commands && commands[0]) { + s32 foundCommandsCount = 0; + + // Count matching commands + for (s32 i = 0; commands[i] != NULL; i++) { + if (strncmp(commands[i], bufferWithoutSlash, strlen(bufferWithoutSlash)) == 0) { + foundCommandsCount++; + } + } + + if (foundCommandsCount > 0) { + // Find the first matching command + for (s32 i = 0; commands[i] != NULL; i++) { + if (strncmp(commands[i], bufferWithoutSlash, strlen(bufferWithoutSlash)) == 0) { + char* preview = malloc(MAX_CHAT_MSG_LENGTH); + // Only show the missing part of the command + snprintf(preview, MAX_CHAT_MSG_LENGTH, "%s", commands[i] + strlen(bufferWithoutSlash)); + return preview; + } + } + } + } + } + + return NULL; +} + static void handle_tab_completion(bool reverse) { bool alreadyTabCompleted = false; if (gDjuiChatBox->chatInput->buffer[0] == '/') { diff --git a/src/pc/djui/djui_chat_box.h b/src/pc/djui/djui_chat_box.h index a37005c67..5bed791c8 100644 --- a/src/pc/djui/djui_chat_box.h +++ b/src/pc/djui/djui_chat_box.h @@ -15,4 +15,5 @@ extern bool gDjuiChatBoxFocus; void djui_chat_box_toggle(void); void djui_chat_box_open_with_text(const char* text); +char* get_next_tab_completion_preview(const char* input); struct DjuiChatBox* djui_chat_box_create(void); diff --git a/src/pc/djui/djui_inputbox.c b/src/pc/djui/djui_inputbox.c index 878a3a94d..917595f5b 100644 --- a/src/pc/djui/djui_inputbox.c +++ b/src/pc/djui/djui_inputbox.c @@ -447,6 +447,60 @@ static void djui_inputbox_render_char(struct DjuiInputbox* inputbox, char* c, f3 *additionalShift += charWidth; } +static void djui_inputbox_render_preview_text(struct DjuiInputbox* inputbox) { + // Always show debug preview when focused (remove all conditions for testing) + if (!djui_interactable_is_input_focus(&inputbox->base)) { + return; + } + + const struct DjuiFont* font = gDjuiFonts[configDjuiThemeFont == 0 ? FONT_NORMAL : FONT_ALIASED]; + struct DjuiBaseRect* comp = &inputbox->base.comp; + + // Calculate current text width + f32 currentTextWidth = 0; + char* c = inputbox->buffer; + while (*c != '\0') { + char* dc = inputbox->passwordChar[0] ? inputbox->passwordChar : c; + currentTextWidth += font->char_width(dc) * font->defaultFontScale; + c = djui_unicode_next_char(c); + } + + // Calculate preview position - use absolute positioning + f32 previewX = comp->x + inputbox->viewX + currentTextWidth + 50; // Add 50px offset + f32 previewY = comp->y + DJUI_INPUTBOX_YOFF + 30; // Move down 30px + + // Apply position translation + djui_gfx_position_translate(&previewX, &previewY); + + // Create translation matrix for the preview text + create_dl_translation_matrix(DJUI_MTX_PUSH, previewX, previewY, 0); + f32 translatedFontSize = font->defaultFontScale; + djui_gfx_size_translate(&translatedFontSize); + create_dl_scale_matrix(DJUI_MTX_NOPUSH, translatedFontSize, translatedFontSize, 1.0f); + + // Set bright red color for debug visibility + gDPSetEnvColor(gDisplayListHead++, 255, 0, 0, 255); + + // Begin font rendering + if (font->textBeginDisplayList != NULL) { + gSPDisplayList(gDisplayListHead++, font->textBeginDisplayList); + } + + // Render debug text + char testText[] = "DEBUG"; + char* testChar = testText; + while (*testChar != '\0') { + font->render_char(testChar); + f32 charWidth = font->char_width(testChar); + previewX += charWidth * font->defaultFontScale; + testChar = djui_unicode_next_char(testChar); + } + + // Clean up matrices + gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); + gSPDisplayList(gDisplayListHead++, dl_ia_text_end); +} + static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) { const struct DjuiFont* font = gDjuiFonts[configDjuiThemeFont == 0 ? FONT_NORMAL : FONT_ALIASED]; @@ -576,6 +630,9 @@ static bool djui_inputbox_render(struct DjuiBase* base) { gSPDisplayList(gDisplayListHead++, font->textBeginDisplayList); } + // render preview text (for tab completion) - after font setup + // djui_inputbox_render_preview_text(inputbox); + // set color gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a); @@ -617,6 +674,31 @@ static bool djui_inputbox_render(struct DjuiBase* base) { djui_inputbox_render_char(inputbox, c, &drawX, &additionalShift); c = djui_unicode_next_char(c); } + + // Tab completion preview - show what would happen if TAB was pressed + if (djui_interactable_is_input_focus(&inputbox->base) && inputbox->buffer[0] == '/') { + // Get preview text from tab completion function + extern char* get_next_tab_completion_preview(const char* input); + char* previewText = get_next_tab_completion_preview(inputbox->buffer); + + if (previewText != NULL && strlen(previewText) > 0) { + // Set gray color for preview text + gDPSetEnvColor(gDisplayListHead++, 128, 128, 128, 128); + + // Render preview text at the current position + char* previewChar = previewText; + while (*previewChar != '\0') { + djui_inputbox_render_char(inputbox, previewChar, &drawX, &additionalShift); + previewChar = djui_unicode_next_char(previewChar); + } + + // Free the preview text + free(previewText); + + // Reset color back to normal + gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a); + } + } gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); From 5812dad90aa7728f59e5238668c530096b3a8824 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sun, 28 Sep 2025 04:25:55 +0200 Subject: [PATCH 09/13] Chat UI redesigned --- src/pc/djui/djui_chat_box.c | 22 +++++++++++------ src/pc/djui/djui_chat_message.c | 8 +++--- src/pc/djui/djui_inputbox.c | 43 +++++++++++++++++++++++++++------ 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index 5224f86f1..9d8cdb558 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -105,7 +105,7 @@ void sent_history_reset_navigation(ArrayList *arrayList) { bool djui_chat_box_render(struct DjuiBase* base) { struct DjuiChatBox* chatBox = (struct DjuiChatBox*)base; struct DjuiBase* ccBase = &chatBox->chatContainer->base; - djui_base_set_size(ccBase, 1.0f, chatBox->base.comp.height - 32 - 8); + djui_base_set_size(ccBase, 1.0f, chatBox->base.comp.height - 32 - 18); if (chatBox->scrolling) { f32 yMax = chatBox->chatContainer->base.elem.height - chatBox->chatFlow->base.height.value; f32 target = chatBox->chatFlow->base.y.value + (chatBox->scrollY - chatBox->chatFlow->base.y.value) * (configSmoothScrolling ? 0.5f : 1.f); @@ -135,7 +135,12 @@ static void djui_chat_box_set_focus_style(void) { djui_interactable_set_input_focus(&gDjuiChatBox->chatInput->base); } - djui_base_set_color(&gDjuiChatBox->chatFlow->base, 0, 0, 0, gDjuiChatBoxFocus ? 128 : 0); + bool hasMessages = (gDjuiChatBox->chatFlow->base.height.value > 2.0f); + u8 alpha = 0; + if (hasMessages) { + alpha = gDjuiChatBoxFocus ? 160 : 0; + } + djui_base_set_color(&gDjuiChatBox->chatFlow->base, 0, 0, 0, alpha); } static void djui_chat_box_input_enter(struct DjuiInputbox* chatInput) { @@ -640,7 +645,7 @@ struct DjuiChatBox* djui_chat_box_create(void) { djui_base_init(&gDjuiRoot->base, base, djui_chat_box_render, djui_chat_box_destroy); djui_base_set_size_type(base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE); - djui_base_set_size(base, 600, 400); + djui_base_set_size(base, 800, 400); djui_base_set_alignment(base, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM); djui_base_set_color(base, 0, 0, 0, 0); djui_base_set_padding(base, 0, 8, 8, 8); @@ -654,12 +659,12 @@ struct DjuiChatBox* djui_chat_box_create(void) { struct DjuiFlowLayout* chatFlow = djui_flow_layout_create(ccBase); struct DjuiBase* cfBase = &chatFlow->base; - djui_base_set_location(cfBase, 0, 0); + djui_base_set_location(cfBase, 0, 8); djui_base_set_size_type(cfBase, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(cfBase, 1.0f, 2); - djui_base_set_color(cfBase, 0, 0, 0, 128); - djui_base_set_padding(cfBase, 2, 2, 2, 2); - djui_flow_layout_set_margin(chatFlow, 2); + djui_base_set_color(cfBase, 0, 0, 0, 64); + djui_base_set_padding(cfBase, 0, 2, 0, 2); + djui_flow_layout_set_margin(chatFlow, 0); djui_flow_layout_set_flow_direction(chatFlow, DJUI_FLOW_DIR_UP); cfBase->addChildrenToHead = true; cfBase->abandonAfterChildRenderFail = true; @@ -670,6 +675,9 @@ struct DjuiChatBox* djui_chat_box_create(void) { djui_base_set_size_type(ciBase, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(ciBase, 1.0f, 32); djui_base_set_alignment(ciBase, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM); + djui_base_set_location(ciBase, 0, 0); + djui_base_set_border_width(ciBase, 0); + djui_interactable_hook_key(&chatInput->base, djui_chat_box_input_on_key_down, djui_inputbox_on_key_up); djui_interactable_hook_text_input(&chatInput->base, djui_chat_box_input_on_text_input); djui_interactable_hook_text_editing(&chatInput->base, djui_chat_box_input_on_text_editing); diff --git a/src/pc/djui/djui_chat_message.c b/src/pc/djui/djui_chat_message.c index 6bb9028a4..397dbaffd 100644 --- a/src/pc/djui/djui_chat_message.c +++ b/src/pc/djui/djui_chat_message.c @@ -24,14 +24,14 @@ static bool djui_chat_message_render(struct DjuiBase* base) { } if (gDjuiChatBoxFocus) { - djui_base_set_color(base, 0, 0, 0, 120); + djui_base_set_color(base, 0, 0, 0, 0); djui_base_set_color(ctBase, 255, 255, 255, 255); djui_base_set_size_type(base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(base, 1.0f, chatMessage->base.height.value); } else if (f <= 0.1f) { return false; } else { - djui_base_set_color(base, 0, 0, 0, 180 * f); + djui_base_set_color(base, 0, 0, 0, 140 * f); djui_base_set_color(ctBase, 255, 255, 255, 255 * f); djui_base_set_size_type(base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE); djui_base_set_size(base, chatMessage->messageWidth, chatMessage->base.height.value); @@ -76,8 +76,8 @@ void djui_chat_message_create(const char* message) { djui_base_init(&gDjuiChatBox->chatFlow->base, base, djui_chat_message_render, djui_chat_message_destroy); djui_base_set_size_type(base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(base, 1.0f, 0); - djui_base_set_color(base, 0, 0, 0, 64); - djui_base_set_padding(base, 2, 4, 2, 4); + djui_base_set_color(base, 0, 0, 0, 0); + djui_base_set_padding(base, 0, 4, 0, 4); djui_base_set_alignment(base, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM); f32 maxTextWidth = gDjuiChatBox->base.width.value - gDjuiChatBox->base.padding.left.value - gDjuiChatBox->base.padding.right.value - base->padding.left.value - base->padding.right.value; diff --git a/src/pc/djui/djui_inputbox.c b/src/pc/djui/djui_inputbox.c index 917595f5b..0a2ca4df5 100644 --- a/src/pc/djui/djui_inputbox.c +++ b/src/pc/djui/djui_inputbox.c @@ -3,12 +3,13 @@ #include "djui.h" #include "djui_unicode.h" #include "djui_hud_utils.h" +#include "djui_chat_box.h" #include "pc/gfx/gfx_window_manager_api.h" #include "pc/pc_main.h" #include "game/segment2.h" #include "pc/controller/controller_keyboard.h" -#define DJUI_INPUTBOX_YOFF (-3) +#define DJUI_INPUTBOX_YOFF (-2) #define DJUI_INPUTBOX_MAX_BLINK 50 #define DJUI_INPUTBOX_MID_BLINK (DJUI_INPUTBOX_MAX_BLINK / 2) #define DJUI_INPUTBOX_CURSOR_WIDTH (2.0f / 32.0f) @@ -20,6 +21,14 @@ static u8 sCursorBlink = 0; static void djui_inputbox_update_style(struct DjuiBase* base) { struct DjuiInputbox* inputbox = (struct DjuiInputbox*)base; + if (gDjuiChatBox != NULL && &gDjuiChatBox->chatInput->base == base) { + djui_base_set_border_width(base, 0); + djui_base_set_border_color(base, 0, 0, 0, 0); + u8 alpha = gDjuiChatBoxFocus ? 200 : 150; + djui_base_set_color(&inputbox->base, 0, 0, 0, alpha); + return; + } + if (!inputbox->base.enabled) { djui_base_set_border_color(base, 90, 90, 90, 255); djui_base_set_color(&inputbox->base, 140, 140, 140, 255); @@ -503,6 +512,7 @@ static void djui_inputbox_render_preview_text(struct DjuiInputbox* inputbox) { static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) { const struct DjuiFont* font = gDjuiFonts[configDjuiThemeFont == 0 ? FONT_NORMAL : FONT_ALIASED]; + bool isChatInput = (gDjuiChatBox != NULL && &gDjuiChatBox->chatInput->base == &inputbox->base); // make selection well formed u16 selection[2] = { 0 }; @@ -540,7 +550,11 @@ static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) { if (sCursorBlink < DJUI_INPUTBOX_MID_BLINK && djui_interactable_is_input_focus(&inputbox->base)) { create_dl_translation_matrix(DJUI_MTX_PUSH, renderX - DJUI_INPUTBOX_CURSOR_WIDTH / 2.0f, -0.1f, 0); create_dl_scale_matrix(DJUI_MTX_NOPUSH, DJUI_INPUTBOX_CURSOR_WIDTH, 0.8f, 1.0f); - gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255); + if (isChatInput) { + gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255); + } else { + gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255); + } gSPDisplayList(gDisplayListHead++, dl_djui_simple_rect); gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); } @@ -604,9 +618,15 @@ static bool djui_inputbox_render(struct DjuiBase* base) { const struct DjuiFont* font = gDjuiFonts[configDjuiThemeFont == 0 ? FONT_NORMAL : FONT_ALIASED]; djui_rect_render(base); - // Shift the text away from the left side a tad - comp->x += 2; - comp->width -= 2; + bool isChatInput = (gDjuiChatBox != NULL && &gDjuiChatBox->chatInput->base == base); + if (isChatInput) { + comp->x += 6; + comp->y -= 1; + comp->width -= 6; + } else { + comp->x += 2; + comp->width -= 2; + } // shift the viewing window to keep the selection in view djui_inputbox_keep_selection_in_view(inputbox); @@ -614,6 +634,12 @@ static bool djui_inputbox_render(struct DjuiBase* base) { // translate position f32 translatedX = comp->x + inputbox->viewX; f32 translatedY = comp->y + DJUI_INPUTBOX_YOFF; + if (isChatInput) { + f32 lineHeight = font->lineHeight * font->defaultFontScale; + f32 innerHeight = comp->height - base->borderWidth.value * 2; + f32 centerOffset = (innerHeight - lineHeight) * 0.5f; + translatedY += fmaxf(centerOffset, 0.0f); + } djui_gfx_position_translate(&translatedX, &translatedY); create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, 0); @@ -633,8 +659,11 @@ static bool djui_inputbox_render(struct DjuiBase* base) { // render preview text (for tab completion) - after font setup // djui_inputbox_render_preview_text(inputbox); - // set color - gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a); + if (isChatInput) { + gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255); + } else { + gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a); + } // make selection well formed u16 selection[2] = { 0 }; From e16e2b4d5c5155fe9c15d690ea2c7aecc6619db4 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sun, 28 Sep 2025 05:10:56 +0200 Subject: [PATCH 10/13] Added char amount display to the chat input box --- src/pc/djui/djui_inputbox.c | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/pc/djui/djui_inputbox.c b/src/pc/djui/djui_inputbox.c index 0a2ca4df5..e1abcfa53 100644 --- a/src/pc/djui/djui_inputbox.c +++ b/src/pc/djui/djui_inputbox.c @@ -731,6 +731,73 @@ static bool djui_inputbox_render(struct DjuiBase* base) { gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); + + if (isChatInput && djui_interactable_is_input_focus(&inputbox->base)) { + char charCountText[32]; + int currentLength = djui_unicode_len(inputbox->buffer); + snprintf(charCountText, sizeof(charCountText), "%d", currentLength); + + f32 originalX = comp->x; + f32 originalY = comp->y; + f32 originalWidth = comp->width; + + if (isChatInput) { + originalX -= 6; + originalY += 1; + originalWidth += 6; + } else { + originalX -= 2; + originalWidth += 2; + } + + f32 counterX = originalX + originalWidth + 10 - 3; + f32 counterY = originalY + (comp->height - font->lineHeight * font->defaultFontScale) * 0.5f - 3; + + djui_gfx_position_translate(&counterX, &counterY); + create_dl_translation_matrix(DJUI_MTX_PUSH, counterX, counterY, 0); + + f32 translatedFontSize = font->defaultFontScale; + djui_gfx_size_translate(&translatedFontSize); + create_dl_scale_matrix(DJUI_MTX_NOPUSH, translatedFontSize, translatedFontSize, 1.0f); + + u8 colR = 255, colG = 255, colB = 255; + if (currentLength >= 499) { + colG = 0; colB = 0; + } else if (currentLength >= 256) { + colG = 128; colB = 64; + } else if (currentLength >= 192) { + colG = 192; colB = 64; + } else if (currentLength >= 128) { + colG = 255; colB = 64; + } + gDPSetEnvColor(gDisplayListHead++, colR, colG, colB, 255); + + if (font->textBeginDisplayList != NULL) { + gSPDisplayList(gDisplayListHead++, font->textBeginDisplayList); + } + + char* c = charCountText; + while (*c != '\0') { + font->render_char(c); + f32 cw = font->char_width(c); + create_dl_translation_matrix(DJUI_MTX_NOPUSH, cw, 0, 0); + c = djui_unicode_next_char(c); + } + + gSPDisplayList(gDisplayListHead++, dl_ia_text_end); + + gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); + } + + if (isChatInput) { + comp->x -= 6; + comp->y += 1; + comp->width += 6; + } else { + comp->x -= 2; + comp->width += 2; + } + return true; } From 6c48a5c1157dbc5c374f07cd368b23506f15465c Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sun, 28 Sep 2025 05:35:18 +0200 Subject: [PATCH 11/13] Fixed black text when selecting text in chat --- src/pc/djui/djui_inputbox.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pc/djui/djui_inputbox.c b/src/pc/djui/djui_inputbox.c index e1abcfa53..ea31c1956 100644 --- a/src/pc/djui/djui_inputbox.c +++ b/src/pc/djui/djui_inputbox.c @@ -694,7 +694,11 @@ static bool djui_inputbox_render(struct DjuiBase* base) { if (insideSelection && !wasInsideSelection) { gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255); } else if (!insideSelection && wasInsideSelection) { - gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a); + if (isChatInput) { + gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255); + } else { + gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a); + } } wasInsideSelection = insideSelection; } From b2f029bea75673f47ded4fae3d7b6931e1b7514d Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sun, 28 Sep 2025 06:03:54 +0200 Subject: [PATCH 12/13] Added Chat Width Config Setting --- lang/Czech.ini | 1 + lang/Dutch.ini | 1 + lang/English.ini | 1 + lang/French.ini | 1 + lang/German.ini | 1 + lang/Italian.ini | 1 + lang/Japanese.ini | 1 + lang/Polish.ini | 1 + lang/Portuguese.ini | 1 + lang/Russian.ini | 1 + lang/Spanish.ini | 1 + src/pc/configfile.c | 2 ++ src/pc/configfile.h | 1 + src/pc/djui/djui_chat_box.c | 2 +- src/pc/djui/djui_panel_controls.c | 22 ++++++++++++++++++++++ 15 files changed, 37 insertions(+), 1 deletion(-) diff --git a/lang/Czech.ini b/lang/Czech.ini index 0474af3d2..9a905997a 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -323,6 +323,7 @@ MISC_TITLE = "JINE" PAUSE_IN_SINGLEPLAYER = "Pauza v hře s jedním hráčem" DISABLE_POPUPS = "Vypnout vyskakovací okna" USE_STANDARD_KEY_BINDINGS_CHAT = "Použít ovládání chatu Terminal/CMD" +CHAT_WIDTH = "Šířka chatu" MENU_OPTIONS = "Nastavení hlavního menu" INFORMATION = "Informace" DEBUG = "Debug" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 0238ea1a7..0d6f4dfcf 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -323,6 +323,7 @@ MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Pauzeer in een speler" DISABLE_POPUPS = "Popups uitzetten" USE_STANDARD_KEY_BINDINGS_CHAT = "Terminal/CMD Chatbox besturingen gebruiken" +CHAT_WIDTH = "Chatbreedte" MENU_OPTIONS = "Menu Instellingen" INFORMATION = "Informatie" DEBUG = "Debug" diff --git a/lang/English.ini b/lang/English.ini index b8676aa00..c57c0db68 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -323,6 +323,7 @@ MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Pause In Singleplayer" DISABLE_POPUPS = "Disable Popups" USE_STANDARD_KEY_BINDINGS_CHAT = "Use Terminal/CMD Chatbox Controls" +CHAT_WIDTH = "Chat Width" MENU_OPTIONS = "Menu Options" INFORMATION = "Info" DEBUG = "Debug" diff --git a/lang/French.ini b/lang/French.ini index 1bd634124..7c371b68a 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -323,6 +323,7 @@ MISC_TITLE = "AUTRES" PAUSE_IN_SINGLEPLAYER = "Pause en Solo" DISABLE_POPUPS = "Désactiver les Pop-ups" USE_STANDARD_KEY_BINDINGS_CHAT = "Utiliser les contrôles de chat Terminal/CMD" +CHAT_WIDTH = "Largeur du chat" MENU_OPTIONS = "Options du menu" INFORMATION = "Information" DEBUG = "Débogage" diff --git a/lang/German.ini b/lang/German.ini index 29dd12abe..dfd581d2e 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -323,6 +323,7 @@ MISC_TITLE = "SONSTIGES" PAUSE_IN_SINGLEPLAYER = "Pause im Einzelspieler" DISABLE_POPUPS = "Pop-ups deaktivieren" USE_STANDARD_KEY_BINDINGS_CHAT = "Terminal/CMD Chatbox-Steuerung verwenden" +CHAT_WIDTH = "Chatbreite" MENU_OPTIONS = "Menüoptionen" INFORMATION = "Info" DEBUG = "Debug" diff --git a/lang/Italian.ini b/lang/Italian.ini index 7a62952a4..6ef6525da 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -321,6 +321,7 @@ MISC_TITLE = "VARIE" PAUSE_IN_SINGLEPLAYER = "Pausa in Giocatore Singolo" DISABLE_POPUPS = "Disabilita Popup" USE_STANDARD_KEY_BINDINGS_CHAT = "Usa controlli chat Terminale/CMD" +CHAT_WIDTH = "Larghezza chat" MENU_OPTIONS = "Opzioni Menù" INFORMATION = "Informazione" DEBUG = "Debug" diff --git a/lang/Japanese.ini b/lang/Japanese.ini index b04e8bbf2..a6984c171 100644 --- a/lang/Japanese.ini +++ b/lang/Japanese.ini @@ -324,6 +324,7 @@ MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "ソロプレイでの一時停止" DISABLE_POPUPS = "ポップアップを無効にする" USE_STANDARD_KEY_BINDINGS_CHAT = "ターミナル/CMDチャットボックスコントロールを使用" +CHAT_WIDTH = "チャット幅" MENU_OPTIONS = "メニューの設定" INFORMATION = "情報" DEBUG = "デバッグ" diff --git a/lang/Polish.ini b/lang/Polish.ini index d0b196bfe..d59b6e678 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -323,6 +323,7 @@ MISC_TITLE = "POZOSTAŁE OPCJE" PAUSE_IN_SINGLEPLAYER = "Pauza w Trybie Pojedynczego Gracza" DISABLE_POPUPS = "Wyłącz Dymki Powiadomień" USE_STANDARD_KEY_BINDINGS_CHAT = "Użyj sterowania czatu Terminal/CMD" +CHAT_WIDTH = "Szerokość czatu" MENU_OPTIONS = "Opcje Menu" INFORMATION = "Informacja" DEBUG = "Debugowanie" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index e014f5add..5471ecba3 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -323,6 +323,7 @@ MISC_TITLE = "OUTROS" PAUSE_IN_SINGLEPLAYER = "Pausar com apenas um jogador" DISABLE_POPUPS = "Desativar pop-ups" USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles de chat Terminal/CMD" +CHAT_WIDTH = "Largura do chat" MENU_OPTIONS = "Opções de menu" INFORMATION = "Informações" DEBUG = "Debug" diff --git a/lang/Russian.ini b/lang/Russian.ini index baa79ef4f..43ee484ff 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -322,6 +322,7 @@ MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Пауза в одиночной игре" DISABLE_POPUPS = "Отключить всплывающие окна" USE_STANDARD_KEY_BINDINGS_CHAT = "Использовать управление чатом Terminal/CMD" +CHAT_WIDTH = "Ширина чата" MENU_OPTIONS = "Параметры меню" INFORMATION = "Информация" DEBUG = "Отладка" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index 15a8a317e..086442076 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -323,6 +323,7 @@ MISC_TITLE = "OTROS" PAUSE_IN_SINGLEPLAYER = "Pausa en modo de un jugador" DISABLE_POPUPS = "Deshabilitar mensajes emergentes" USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles de chat Terminal/CMD" +CHAT_WIDTH = "Ancho del chat" MENU_OPTIONS = "Opciones del menú" INFORMATION = "Información" DEBUG = "Depuración" diff --git a/src/pc/configfile.c b/src/pc/configfile.c index a3d495775..a7627b3b5 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -133,6 +133,7 @@ unsigned int configGamepadNumber = 0; bool configBackgroundGamepad = true; bool configDisableGamepads = false; bool configUseStandardKeyBindingsChat = true; +unsigned int configChatWidth = 800; bool configSmoothScrolling = false; // free camera settings bool configEnableFreeCamera = false; @@ -279,6 +280,7 @@ static const struct ConfigOption options[] = { {.name = "disable_gamepads", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisableGamepads}, #endif {.name = "use_standard_key_bindings_chat", .type = CONFIG_TYPE_BOOL, .boolValue = &configUseStandardKeyBindingsChat}, + {.name = "chat_width", .type = CONFIG_TYPE_UINT, .uintValue = &configChatWidth}, {.name = "smooth_scrolling", .type = CONFIG_TYPE_BOOL, .boolValue = &configSmoothScrolling}, {.name = "stick_rotate_left", .type = CONFIG_TYPE_BOOL, .boolValue = &configStick.rotateLeft}, {.name = "stick_invert_left_x", .type = CONFIG_TYPE_BOOL, .boolValue = &configStick.invertLeftX}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 755fe6ba9..1a4aaec59 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -96,6 +96,7 @@ extern unsigned int configGamepadNumber; extern bool configBackgroundGamepad; extern bool configDisableGamepads; extern bool configUseStandardKeyBindingsChat; +extern unsigned int configChatWidth; extern bool configSmoothScrolling; // free camera settings extern bool configEnableFreeCamera; diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index 9d8cdb558..d02aca227 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -645,7 +645,7 @@ struct DjuiChatBox* djui_chat_box_create(void) { djui_base_init(&gDjuiRoot->base, base, djui_chat_box_render, djui_chat_box_destroy); djui_base_set_size_type(base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE); - djui_base_set_size(base, 800, 400); + djui_base_set_size(base, configChatWidth, 400); djui_base_set_alignment(base, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM); djui_base_set_color(base, 0, 0, 0, 0); djui_base_set_padding(base, 0, 8, 8, 8); diff --git a/src/pc/djui/djui_panel_controls.c b/src/pc/djui/djui_panel_controls.c index 8088580a9..ac6f63827 100644 --- a/src/pc/djui/djui_panel_controls.c +++ b/src/pc/djui/djui_panel_controls.c @@ -42,6 +42,28 @@ void djui_panel_controls_create(struct DjuiBase* caller) { #endif djui_checkbox_create(body, DLANG(MISC, USE_STANDARD_KEY_BINDINGS_CHAT), &configUseStandardKeyBindingsChat, NULL); + static unsigned int sChatWidthIndex = 3; + switch (configChatWidth) { + case 500: sChatWidthIndex = 0; break; + case 600: sChatWidthIndex = 1; break; + case 700: sChatWidthIndex = 2; break; + case 800: sChatWidthIndex = 3; break; + case 900: sChatWidthIndex = 4; break; + case 1000: sChatWidthIndex = 5; break; + default: sChatWidthIndex = 3; break; + } + + char* chatWidthChoices[] = { "500", "600", "700", "800", "900", "1000" }; + void on_chat_width_change(struct DjuiBase* b) { + unsigned int idx = sChatWidthIndex; + unsigned int widths[] = {500,600,700,800,900,1000}; + configChatWidth = widths[idx]; + if (gDjuiChatBox != NULL) { + djui_base_set_size(&gDjuiChatBox->base, configChatWidth, gDjuiChatBox->base.height.value); + } + } + djui_selectionbox_create(body, DLANG(MISC, CHAT_WIDTH), chatWidthChoices, 6, &sChatWidthIndex, on_chat_width_change); + #ifdef HAVE_SDL2 int numJoys = SDL_NumJoysticks(); if (numJoys == 0) { numJoys = 1; } From b0ebaeed6397cd72477c80be905417cd6d16d771 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sun, 28 Sep 2025 07:15:56 +0200 Subject: [PATCH 13/13] Added hide chat setting and clearified chat width setting --- lang/Czech.ini | 9 +++++++++ lang/Dutch.ini | 9 +++++++++ lang/English.ini | 9 +++++++++ lang/French.ini | 9 +++++++++ lang/German.ini | 9 +++++++++ lang/Italian.ini | 9 +++++++++ lang/Japanese.ini | 9 +++++++++ lang/Polish.ini | 9 +++++++++ lang/Portuguese.ini | 9 +++++++++ lang/Russian.ini | 9 +++++++++ lang/Spanish.ini | 9 +++++++++ src/pc/configfile.c | 4 ++++ src/pc/configfile.h | 2 ++ src/pc/djui/djui_chat_message.c | 2 ++ src/pc/djui/djui_inputbox.c | 3 ++- src/pc/djui/djui_panel_controls.c | 12 ++++++++---- 16 files changed, 117 insertions(+), 5 deletions(-) diff --git a/lang/Czech.ini b/lang/Czech.ini index 9a905997a..f712b1930 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -324,6 +324,15 @@ PAUSE_IN_SINGLEPLAYER = "Pauza v hře s jedním hráčem" DISABLE_POPUPS = "Vypnout vyskakovací okna" USE_STANDARD_KEY_BINDINGS_CHAT = "Použít ovládání chatu Terminal/CMD" CHAT_WIDTH = "Šířka chatu" +CHAT_WIDTH_TINY = "Drobná" +CHAT_WIDTH_VERY_SMALL = "Velmi malá" +CHAT_WIDTH_SMALL = "Malá" +CHAT_WIDTH_NORMAL = "Normální" +CHAT_WIDTH_BIG = "Velká" +CHAT_WIDTH_VERY_BIG = "Velmi velká" +CHAT_WIDTH_HUGE = "Obrovská" +CHAT_CHAR_COUNTER = "Zobrazit počitadlo znaků chatu" +DISABLE_CHAT_WHEN_CLOSED = "Skrýt chat, když je zavřený" MENU_OPTIONS = "Nastavení hlavního menu" INFORMATION = "Informace" DEBUG = "Debug" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 0d6f4dfcf..169a26920 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -324,6 +324,15 @@ PAUSE_IN_SINGLEPLAYER = "Pauzeer in een speler" DISABLE_POPUPS = "Popups uitzetten" USE_STANDARD_KEY_BINDINGS_CHAT = "Terminal/CMD Chatbox besturingen gebruiken" CHAT_WIDTH = "Chatbreedte" +CHAT_WIDTH_TINY = "Zeer klein" +CHAT_WIDTH_VERY_SMALL = "Erg klein" +CHAT_WIDTH_SMALL = "Klein" +CHAT_WIDTH_NORMAL = "Normaal" +CHAT_WIDTH_BIG = "Groot" +CHAT_WIDTH_VERY_BIG = "Zeer groot" +CHAT_WIDTH_HUGE = "Enorm" +CHAT_CHAR_COUNTER = "Chat-tekensteller weergeven" +DISABLE_CHAT_WHEN_CLOSED = "Chat verbergen wanneer gesloten" MENU_OPTIONS = "Menu Instellingen" INFORMATION = "Informatie" DEBUG = "Debug" diff --git a/lang/English.ini b/lang/English.ini index c57c0db68..9dc2446d4 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -324,6 +324,15 @@ PAUSE_IN_SINGLEPLAYER = "Pause In Singleplayer" DISABLE_POPUPS = "Disable Popups" USE_STANDARD_KEY_BINDINGS_CHAT = "Use Terminal/CMD Chatbox Controls" CHAT_WIDTH = "Chat Width" +CHAT_WIDTH_TINY = "Tiny" +CHAT_WIDTH_VERY_SMALL = "Very Small" +CHAT_WIDTH_SMALL = "Small" +CHAT_WIDTH_NORMAL = "Normal" +CHAT_WIDTH_BIG = "Big" +CHAT_WIDTH_VERY_BIG = "Very Big" +CHAT_WIDTH_HUGE = "Huge" +CHAT_CHAR_COUNTER = "Show Chat Character Counter" +DISABLE_CHAT_WHEN_CLOSED = "Hide Chat When Closed" MENU_OPTIONS = "Menu Options" INFORMATION = "Info" DEBUG = "Debug" diff --git a/lang/French.ini b/lang/French.ini index 7c371b68a..515483825 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -324,6 +324,15 @@ PAUSE_IN_SINGLEPLAYER = "Pause en Solo" DISABLE_POPUPS = "Désactiver les Pop-ups" USE_STANDARD_KEY_BINDINGS_CHAT = "Utiliser les contrôles de chat Terminal/CMD" CHAT_WIDTH = "Largeur du chat" +CHAT_WIDTH_TINY = "Minuscule" +CHAT_WIDTH_VERY_SMALL = "Très petite" +CHAT_WIDTH_SMALL = "Petite" +CHAT_WIDTH_NORMAL = "Normale" +CHAT_WIDTH_BIG = "Grande" +CHAT_WIDTH_VERY_BIG = "Très grande" +CHAT_WIDTH_HUGE = "Énorme" +CHAT_CHAR_COUNTER = "Afficher le compteur de caractères du chat" +DISABLE_CHAT_WHEN_CLOSED = "Masquer le chat lorsqu'il est fermé" MENU_OPTIONS = "Options du menu" INFORMATION = "Information" DEBUG = "Débogage" diff --git a/lang/German.ini b/lang/German.ini index dfd581d2e..1b7c79807 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -324,6 +324,15 @@ PAUSE_IN_SINGLEPLAYER = "Pause im Einzelspieler" DISABLE_POPUPS = "Pop-ups deaktivieren" USE_STANDARD_KEY_BINDINGS_CHAT = "Terminal/CMD Chatbox-Steuerung verwenden" CHAT_WIDTH = "Chatbreite" +CHAT_WIDTH_TINY = "Winzig" +CHAT_WIDTH_VERY_SMALL = "Sehr klein" +CHAT_WIDTH_SMALL = "Klein" +CHAT_WIDTH_NORMAL = "Normal" +CHAT_WIDTH_BIG = "Groß" +CHAT_WIDTH_VERY_BIG = "Sehr groß" +CHAT_WIDTH_HUGE = "Riesig" +CHAT_CHAR_COUNTER = "Chat-Zeichenzähler anzeigen" +DISABLE_CHAT_WHEN_CLOSED = "Verstecke Chat wenn geschlossen" MENU_OPTIONS = "Menüoptionen" INFORMATION = "Info" DEBUG = "Debug" diff --git a/lang/Italian.ini b/lang/Italian.ini index 6ef6525da..5de5c378d 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -322,6 +322,15 @@ PAUSE_IN_SINGLEPLAYER = "Pausa in Giocatore Singolo" DISABLE_POPUPS = "Disabilita Popup" USE_STANDARD_KEY_BINDINGS_CHAT = "Usa controlli chat Terminale/CMD" CHAT_WIDTH = "Larghezza chat" +CHAT_WIDTH_TINY = "Minuscola" +CHAT_WIDTH_VERY_SMALL = "Molto piccola" +CHAT_WIDTH_SMALL = "Piccola" +CHAT_WIDTH_NORMAL = "Normale" +CHAT_WIDTH_BIG = "Grande" +CHAT_WIDTH_VERY_BIG = "Molto grande" +CHAT_WIDTH_HUGE = "Enorme" +CHAT_CHAR_COUNTER = "Mostra contatore caratteri della chat" +DISABLE_CHAT_WHEN_CLOSED = "Nascondi chat quando è chiusa" MENU_OPTIONS = "Opzioni Menù" INFORMATION = "Informazione" DEBUG = "Debug" diff --git a/lang/Japanese.ini b/lang/Japanese.ini index a6984c171..ff085530c 100644 --- a/lang/Japanese.ini +++ b/lang/Japanese.ini @@ -325,6 +325,15 @@ PAUSE_IN_SINGLEPLAYER = "ソロプレイでの一時停止" DISABLE_POPUPS = "ポップアップを無効にする" USE_STANDARD_KEY_BINDINGS_CHAT = "ターミナル/CMDチャットボックスコントロールを使用" CHAT_WIDTH = "チャット幅" +CHAT_WIDTH_TINY = "とても小さい" +CHAT_WIDTH_VERY_SMALL = "かなり小さい" +CHAT_WIDTH_SMALL = "小さい" +CHAT_WIDTH_NORMAL = "標準" +CHAT_WIDTH_BIG = "大きい" +CHAT_WIDTH_VERY_BIG = "とても大きい" +CHAT_WIDTH_HUGE = "巨大" +CHAT_CHAR_COUNTER = "チャットの文字数カウンターを表示" +DISABLE_CHAT_WHEN_CLOSED = "閉じているときはチャットを隠す" MENU_OPTIONS = "メニューの設定" INFORMATION = "情報" DEBUG = "デバッグ" diff --git a/lang/Polish.ini b/lang/Polish.ini index d59b6e678..3a21bfcec 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -324,6 +324,15 @@ PAUSE_IN_SINGLEPLAYER = "Pauza w Trybie Pojedynczego Gracza" DISABLE_POPUPS = "Wyłącz Dymki Powiadomień" USE_STANDARD_KEY_BINDINGS_CHAT = "Użyj sterowania czatu Terminal/CMD" CHAT_WIDTH = "Szerokość czatu" +CHAT_WIDTH_TINY = "Maleńka" +CHAT_WIDTH_VERY_SMALL = "Bardzo mała" +CHAT_WIDTH_SMALL = "Mała" +CHAT_WIDTH_NORMAL = "Normalna" +CHAT_WIDTH_BIG = "Duża" +CHAT_WIDTH_VERY_BIG = "Bardzo duża" +CHAT_WIDTH_HUGE = "Ogromna" +CHAT_CHAR_COUNTER = "Pokaż licznik znaków czatu" +DISABLE_CHAT_WHEN_CLOSED = "Ukryj czat, gdy jest zamknięty" MENU_OPTIONS = "Opcje Menu" INFORMATION = "Informacja" DEBUG = "Debugowanie" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index 5471ecba3..566d1d2b7 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -324,6 +324,15 @@ PAUSE_IN_SINGLEPLAYER = "Pausar com apenas um jogador" DISABLE_POPUPS = "Desativar pop-ups" USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles de chat Terminal/CMD" CHAT_WIDTH = "Largura do chat" +CHAT_WIDTH_TINY = "Minúsculo" +CHAT_WIDTH_VERY_SMALL = "Muito pequena" +CHAT_WIDTH_SMALL = "Pequena" +CHAT_WIDTH_NORMAL = "Normal" +CHAT_WIDTH_BIG = "Grande" +CHAT_WIDTH_VERY_BIG = "Muito grande" +CHAT_WIDTH_HUGE = "Enorme" +CHAT_CHAR_COUNTER = "Mostrar contador de caracteres do chat" +DISABLE_CHAT_WHEN_CLOSED = "Ocultar chat quando fechado" MENU_OPTIONS = "Opções de menu" INFORMATION = "Informações" DEBUG = "Debug" diff --git a/lang/Russian.ini b/lang/Russian.ini index 43ee484ff..8f474904f 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -323,6 +323,15 @@ PAUSE_IN_SINGLEPLAYER = "Пауза в одиночной игре" DISABLE_POPUPS = "Отключить всплывающие окна" USE_STANDARD_KEY_BINDINGS_CHAT = "Использовать управление чатом Terminal/CMD" CHAT_WIDTH = "Ширина чата" +CHAT_WIDTH_TINY = "Крошечная" +CHAT_WIDTH_VERY_SMALL = "Очень маленькая" +CHAT_WIDTH_SMALL = "Маленькая" +CHAT_WIDTH_NORMAL = "Обычная" +CHAT_WIDTH_BIG = "Большая" +CHAT_WIDTH_VERY_BIG = "Очень большая" +CHAT_WIDTH_HUGE = "Огромная" +CHAT_CHAR_COUNTER = "Показывать счётчик символов чата" +DISABLE_CHAT_WHEN_CLOSED = "Скрывать чат, когда он закрыт" MENU_OPTIONS = "Параметры меню" INFORMATION = "Информация" DEBUG = "Отладка" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index 086442076..7e422eaf6 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -324,6 +324,15 @@ PAUSE_IN_SINGLEPLAYER = "Pausa en modo de un jugador" DISABLE_POPUPS = "Deshabilitar mensajes emergentes" USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles de chat Terminal/CMD" CHAT_WIDTH = "Ancho del chat" +CHAT_WIDTH_TINY = "Minúsculo" +CHAT_WIDTH_VERY_SMALL = "Muy pequeño" +CHAT_WIDTH_SMALL = "Pequeño" +CHAT_WIDTH_NORMAL = "Normal" +CHAT_WIDTH_BIG = "Grande" +CHAT_WIDTH_VERY_BIG = "Muy grande" +CHAT_WIDTH_HUGE = "Enorme" +CHAT_CHAR_COUNTER = "Mostrar contador de caracteres del chat" +DISABLE_CHAT_WHEN_CLOSED = "Ocultar chat cuando esté cerrado" MENU_OPTIONS = "Opciones del menú" INFORMATION = "Información" DEBUG = "Depuración" diff --git a/src/pc/configfile.c b/src/pc/configfile.c index a7627b3b5..76e08e158 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -133,6 +133,8 @@ unsigned int configGamepadNumber = 0; bool configBackgroundGamepad = true; bool configDisableGamepads = false; bool configUseStandardKeyBindingsChat = true; +bool configChatCharCounter = true; +bool configDisableChatWhenClosed = false; unsigned int configChatWidth = 800; bool configSmoothScrolling = false; // free camera settings @@ -281,6 +283,8 @@ static const struct ConfigOption options[] = { #endif {.name = "use_standard_key_bindings_chat", .type = CONFIG_TYPE_BOOL, .boolValue = &configUseStandardKeyBindingsChat}, {.name = "chat_width", .type = CONFIG_TYPE_UINT, .uintValue = &configChatWidth}, + {.name = "chat_char_counter", .type = CONFIG_TYPE_BOOL, .boolValue = &configChatCharCounter}, + {.name = "disable_chat_when_closed", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisableChatWhenClosed}, {.name = "smooth_scrolling", .type = CONFIG_TYPE_BOOL, .boolValue = &configSmoothScrolling}, {.name = "stick_rotate_left", .type = CONFIG_TYPE_BOOL, .boolValue = &configStick.rotateLeft}, {.name = "stick_invert_left_x", .type = CONFIG_TYPE_BOOL, .boolValue = &configStick.invertLeftX}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 1a4aaec59..1048baea1 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -96,6 +96,8 @@ extern unsigned int configGamepadNumber; extern bool configBackgroundGamepad; extern bool configDisableGamepads; extern bool configUseStandardKeyBindingsChat; +extern bool configChatCharCounter; +extern bool configDisableChatWhenClosed; extern unsigned int configChatWidth; extern bool configSmoothScrolling; // free camera settings diff --git a/src/pc/djui/djui_chat_message.c b/src/pc/djui/djui_chat_message.c index 397dbaffd..91afb1797 100644 --- a/src/pc/djui/djui_chat_message.c +++ b/src/pc/djui/djui_chat_message.c @@ -28,6 +28,8 @@ static bool djui_chat_message_render(struct DjuiBase* base) { djui_base_set_color(ctBase, 255, 255, 255, 255); djui_base_set_size_type(base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(base, 1.0f, chatMessage->base.height.value); + } else if (configDisableChatWhenClosed) { + return false; } else if (f <= 0.1f) { return false; } else { diff --git a/src/pc/djui/djui_inputbox.c b/src/pc/djui/djui_inputbox.c index ea31c1956..296b9e5c6 100644 --- a/src/pc/djui/djui_inputbox.c +++ b/src/pc/djui/djui_inputbox.c @@ -8,6 +8,7 @@ #include "pc/pc_main.h" #include "game/segment2.h" #include "pc/controller/controller_keyboard.h" +#include "pc/configfile.h" #define DJUI_INPUTBOX_YOFF (-2) #define DJUI_INPUTBOX_MAX_BLINK 50 @@ -736,7 +737,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) { gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); - if (isChatInput && djui_interactable_is_input_focus(&inputbox->base)) { + if (isChatInput && djui_interactable_is_input_focus(&inputbox->base) && configChatCharCounter) { char charCountText[32]; int currentLength = djui_unicode_len(inputbox->buffer); snprintf(charCountText, sizeof(charCountText), "%d", currentLength); diff --git a/src/pc/djui/djui_panel_controls.c b/src/pc/djui/djui_panel_controls.c index ac6f63827..d86e72b88 100644 --- a/src/pc/djui/djui_panel_controls.c +++ b/src/pc/djui/djui_panel_controls.c @@ -42,6 +42,9 @@ void djui_panel_controls_create(struct DjuiBase* caller) { #endif djui_checkbox_create(body, DLANG(MISC, USE_STANDARD_KEY_BINDINGS_CHAT), &configUseStandardKeyBindingsChat, NULL); + djui_checkbox_create(body, DLANG(MISC, CHAT_CHAR_COUNTER), &configChatCharCounter, NULL); + djui_checkbox_create(body, DLANG(MISC, DISABLE_CHAT_WHEN_CLOSED), &configDisableChatWhenClosed, NULL); + static unsigned int sChatWidthIndex = 3; switch (configChatWidth) { case 500: sChatWidthIndex = 0; break; @@ -50,19 +53,20 @@ void djui_panel_controls_create(struct DjuiBase* caller) { case 800: sChatWidthIndex = 3; break; case 900: sChatWidthIndex = 4; break; case 1000: sChatWidthIndex = 5; break; + case 1100: sChatWidthIndex = 6; break; default: sChatWidthIndex = 3; break; } - char* chatWidthChoices[] = { "500", "600", "700", "800", "900", "1000" }; - void on_chat_width_change(struct DjuiBase* b) { + char* chatWidthChoices[] = { DLANG(MISC, CHAT_WIDTH_TINY), DLANG(MISC, CHAT_WIDTH_VERY_SMALL), DLANG(MISC, CHAT_WIDTH_SMALL), DLANG(MISC, CHAT_WIDTH_NORMAL), DLANG(MISC, CHAT_WIDTH_BIG), DLANG(MISC, CHAT_WIDTH_VERY_BIG), DLANG(MISC, CHAT_WIDTH_HUGE) }; + void on_chat_width_change(UNUSED struct DjuiBase* b) { unsigned int idx = sChatWidthIndex; - unsigned int widths[] = {500,600,700,800,900,1000}; + unsigned int widths[] = {500,600,700,800,900,1000,1100}; configChatWidth = widths[idx]; if (gDjuiChatBox != NULL) { djui_base_set_size(&gDjuiChatBox->base, configChatWidth, gDjuiChatBox->base.height.value); } } - djui_selectionbox_create(body, DLANG(MISC, CHAT_WIDTH), chatWidthChoices, 6, &sChatWidthIndex, on_chat_width_change); + djui_selectionbox_create(body, DLANG(MISC, CHAT_WIDTH), chatWidthChoices, 7, &sChatWidthIndex, on_chat_width_change); #ifdef HAVE_SDL2 int numJoys = SDL_NumJoysticks();