From 8525a9a2ee778f090b5df46dd9d6ef93502bbb5d Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Wed, 26 Jun 2024 18:50:38 -0400 Subject: [PATCH] DynOS fixes --- data/dynos.cpp.h | 2 +- data/dynos_mgr_actor.cpp | 2 +- data/dynos_mgr_tex.cpp | 11 ----------- lang/Czech.ini | 4 ++-- lang/Dutch.ini | 4 ++-- lang/English.ini | 4 ++-- lang/French.ini | 4 ++-- lang/German.ini | 4 ++-- lang/Italian.ini | 4 ++-- lang/Polish.ini | 4 ++-- lang/Portuguese.ini | 4 ++-- lang/Russian.ini | 4 ++-- lang/Spanish.ini | 4 ++-- src/pc/configfile.c | 10 +++++----- src/pc/configfile.h | 2 +- src/pc/djui/djui_hud_utils.c | 11 ++++++++++- src/pc/djui/djui_panel_controls.c | 2 +- src/pc/djui/djui_panel_dynos.c | 4 ++-- 18 files changed, 41 insertions(+), 43 deletions(-) diff --git a/data/dynos.cpp.h b/data/dynos.cpp.h index 46695e27..9e398bf9 100644 --- a/data/dynos.cpp.h +++ b/data/dynos.cpp.h @@ -745,7 +745,7 @@ void PrintError(const char *aFmt, Args... aArgs) { printf(aFmt, aArgs...); printf("\r\n"); fflush(stdout); - // PrintConsole(aFmt, CONSOLE_MESSAGE_ERROR, aArgs...); + PrintConsole(CONSOLE_MESSAGE_ERROR, aFmt, aArgs...); } #define PrintDataError(...) { \ if (aGfxData->mErrorCount == 0) Print(" ERROR!"); \ diff --git a/data/dynos_mgr_actor.cpp b/data/dynos_mgr_actor.cpp index 82678e2d..1a514030 100644 --- a/data/dynos_mgr_actor.cpp +++ b/data/dynos_mgr_actor.cpp @@ -165,7 +165,7 @@ void DynOS_Actor_Override(struct Object* obj, void** aSharedChild) { obj->behavior == smlua_override_behavior(bhvMetalCap) || obj->behavior == smlua_override_behavior(bhvVanishCap))) { struct NetworkPlayer* np = network_player_from_global_index(obj->globalPlayerIndex); - if (np && np->localIndex > 0 && !configGlobalPlayerModels) { + if (np && np->localIndex > 0 && configDynosLocalPlayerModelOnly) { return; } } diff --git a/data/dynos_mgr_tex.cpp b/data/dynos_mgr_tex.cpp index ca591f74..96e36f92 100644 --- a/data/dynos_mgr_tex.cpp +++ b/data/dynos_mgr_tex.cpp @@ -451,10 +451,6 @@ void DynOS_Tex_AddCustom(const SysPath &aFilename, const char *aTexName) { } } -static inline bool IsPowerOfTwo(s32 n) { - return (n > 0) && ((n & (n - 1)) == 0); -} - bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) { #define CONVERT_TEXINFO() { \ /* translate bit size */ \ @@ -483,13 +479,6 @@ bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) { // texture data is corrupted if (_RawData == NULL) { PrintError("Attempted to load corrupted tex file: %s", aTexName); - PrintConsole(CONSOLE_MESSAGE_ERROR, "Attempted to load corrupted tex file: %s", aTexName); - return false; - } - // texture width or height is NPOT - if (!IsPowerOfTwo(_Data->mRawWidth) || !IsPowerOfTwo(_Data->mRawHeight)) { - PrintError("Tex file '%s' has non power of two width or height", aTexName); - PrintConsole(CONSOLE_MESSAGE_WARNING, "Tex file '%s' has non power of two width or height", aTexName); return false; } _Data->mRawFormat = G_IM_FMT_RGBA; diff --git a/lang/Czech.ini b/lang/Czech.ini index 43823b5e..37fa14a1 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -161,7 +161,7 @@ FILE_SELECT_THEME = "Výběr souboru" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Pouze lokální model hráče" +LOCAL_PLAYER_MODEL_ONLY = "Pouze lokální model hráče" [HOST_MESSAGE] INFO_TITLE = "INFO" @@ -275,7 +275,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 = "Použij standardní ovládání klávesnice pro chat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Klasické ovládání chatu" MENU_OPTIONS = "Nastavení hlavního menu" INFORMATION = "Informace" DEBUG = "Debug" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 57f0e064..b909ee8c 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -161,7 +161,7 @@ FILE_SELECT_THEME = "Bestand selecteren" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Alleen lokaal spelermodel" +LOCAL_PLAYER_MODEL_ONLY = "Alleen lokaal spelermodel" [HOST_MESSAGE] INFO_TITLE = "INFORMATIE" @@ -275,7 +275,7 @@ DEBUG_ERRORS = "Debug Errors" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Pauzeer in een speler" DISABLE_POPUPS = "Popups uitzetten" -USE_STANDARD_KEY_BINDINGS_CHAT = "Gebruik standaard toetsenbordbediening voor chat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Klassieke chatbediening" MENU_OPTIONS = "Menu Instellingen" INFORMATION = "Informatie" DEBUG = "Debug" diff --git a/lang/English.ini b/lang/English.ini index 476de773..2033c326 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -161,7 +161,7 @@ FILE_SELECT_THEME = "File Select" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Local Player Model Only" +LOCAL_PLAYER_MODEL_ONLY = "Local Player Model Only" [HOST_MESSAGE] INFO_TITLE = "INFO" @@ -275,7 +275,7 @@ DEBUG_ERRORS = "Debug Errors" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Pause In Singleplayer" DISABLE_POPUPS = "Disable Popups" -USE_STANDARD_KEY_BINDINGS_CHAT = "Use Standard Keyboard Controls For Chat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Classic Chatbox Controls" MENU_OPTIONS = "Menu Options" INFORMATION = "Info" DEBUG = "Debug" diff --git a/lang/French.ini b/lang/French.ini index 18849df5..6cade066 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -161,7 +161,7 @@ FILE_SELECT_THEME = "Sélection de fichier" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Modèle de joueur local seulement" +LOCAL_PLAYER_MODEL_ONLY = "Modèle de joueur local seulement" [HOST_MESSAGE] INFO_TITLE = "INFORMATIONS" @@ -275,7 +275,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 = "Activer les contrôles clavier standards pour le tchat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Commandes de chat classiques" MENU_OPTIONS = "Options du menu" INFORMATION = "Information" DEBUG = "Débogage" diff --git a/lang/German.ini b/lang/German.ini index ea88be39..76086d2c 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -161,7 +161,7 @@ FILE_SELECT_THEME = "Dateiauswahl" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Nur lokales Spielermodell" +LOCAL_PLAYER_MODEL_ONLY = "Nur lokales Spielermodell" [HOST_MESSAGE] INFO_TITLE = "INFO" @@ -275,7 +275,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-Tastatursteuerungen für Chat verwenden" +USE_STANDARD_KEY_BINDINGS_CHAT = "Klassische Chat-Steuerung" MENU_OPTIONS = "Menüoptionen" INFORMATION = "Information" DEBUG = "Debug" diff --git a/lang/Italian.ini b/lang/Italian.ini index eb593b43..9d831324 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -159,7 +159,7 @@ FILE_SELECT_THEME = "Selezione file" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Solo modello giocatore locale" +LOCAL_PLAYER_MODEL_ONLY = "Solo modello giocatore locale" [HOST_MESSAGE] INFO_TITLE = "INFO" @@ -273,7 +273,7 @@ DEBUG_ERRORS = "Errori di debug" MISC_TITLE = "VARIE" PAUSE_IN_SINGLEPLAYER = "Metti in pausa in giocatore singolo" DISABLE_POPUPS = "Disabilita Popups" -USE_STANDARD_KEY_BINDINGS_CHAT = "Usa i controlli standard della tastiera per la chat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Controlli della chat classica" MENU_OPTIONS = "Opzioni Menù" INFORMATION = "Informazione" DEBUG = "Debug" diff --git a/lang/Polish.ini b/lang/Polish.ini index 47ddaa5a..2223833d 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -161,7 +161,7 @@ FILE_SELECT_THEME = "Wybór Pliku" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Tylko lokalny model gracza" +LOCAL_PLAYER_MODEL_ONLY = "Tylko lokalny model gracza" [HOST_MESSAGE] INFO_TITLE = "INFORMACJE" @@ -275,7 +275,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 = "Użyj Standardowych Ustawień Klawiatury dla Czatu" +USE_STANDARD_KEY_BINDINGS_CHAT = "Klasyczne sterowanie czatem" MENU_OPTIONS = "Opcje Menu" INFORMATION = "Informacje" DEBUG = "Debugowanie" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index 927c3668..6d0ab449 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -161,7 +161,7 @@ FILE_SELECT_THEME = "Escolha de arquivo" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Apenas modelo de jogador local" +LOCAL_PLAYER_MODEL_ONLY = "Apenas modelo de jogador local" [HOST_MESSAGE] INFO_TITLE = "INFO" @@ -275,7 +275,7 @@ DEBUG_ERRORS = "Erros debug" MISC_TITLE = "MAIS" PAUSE_IN_SINGLEPLAYER = "Pausa com jogador único" DISABLE_POPUPS = "Desativar popups" -USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles padrão do teclado para chat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Controles clássicos de chat" MENU_OPTIONS = "Opções de menu" INFORMATION = "Informação" DEBUG = "Debug" diff --git a/lang/Russian.ini b/lang/Russian.ini index 66886911..5d20ade5 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -160,7 +160,7 @@ FILE_SELECT_THEME = "Выбор файла" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Только локальная модель игрока" +LOCAL_PLAYER_MODEL_ONLY = "Только локальная модель игрока" [HOST_MESSAGE] INFO_TITLE = "INFO" @@ -274,7 +274,7 @@ DEBUG_ERRORS = "Ошибки отладки" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Пауза в одиночной игре" DISABLE_POPUPS = "Отключить всплывающие окна" -USE_STANDARD_KEY_BINDINGS_CHAT = "Использовать стандартные управления клавиатурой для чата" +USE_STANDARD_KEY_BINDINGS_CHAT = "Классическое управление чатом" MENU_OPTIONS = "Параметры меню" INFORMATION = "Информация" DEBUG = "Отладка" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index a2ab021e..8c274e07 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -161,7 +161,7 @@ FILE_SELECT_THEME = "Selección de archivo" [DYNOS] DYNOS = "DYNOS" -GLOBAL_PLAYER_MODELS = "Solo modelo de jugador local" +LOCAL_PLAYER_MODEL_ONLY = "Solo modelo de jugador local" [HOST_MESSAGE] INFO_TITLE = "INFO" @@ -275,7 +275,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 = "Usar controles estándar del teclado para chat" +USE_STANDARD_KEY_BINDINGS_CHAT = "Controles de chat clásicos" MENU_OPTIONS = "Opciones del menú" INFORMATION = "Información" DEBUG = "Depuración" diff --git a/src/pc/configfile.c b/src/pc/configfile.c index b48dddd2..8d5f7279 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -149,7 +149,7 @@ char configPlayerName[MAX_CONFIG_STRING] = ""; unsigned int configPlayerModel = 0; struct PlayerPalette configPlayerPalette = { { { 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }, { 0xff, 0x00, 0x00 } } }; // coop settings -unsigned int configAmountofPlayers = 16; +unsigned int configAmountofPlayers = MAX_PLAYERS; bool configBubbleDeath = true; unsigned int configHostPort = DEFAULT_PORT; unsigned int configHostSaveSlot = 1; @@ -163,12 +163,12 @@ bool configNametags = true; unsigned int configBouncyLevelBounds = 0; bool configSkipIntro = 0; bool configPauseAnywhere = false; -bool configMenuStaffRoll = true; +bool configMenuStaffRoll = false; unsigned int configMenuLevel = 0; bool configMenuSound = false; bool configMenuRandom = false; bool configMenuDemos = false; -bool configGlobalPlayerModels = true; +bool configDynosLocalPlayerModelOnly = false; bool configDisablePopups = false; char configLanguage[MAX_CONFIG_STRING] = ""; // CoopNet settings @@ -239,7 +239,7 @@ static const struct ConfigOption options[] = { {.name = "gamepad_number", .type = CONFIG_TYPE_UINT, .uintValue = &configGamepadNumber}, {.name = "background_gamepad", .type = CONFIG_TYPE_UINT, .boolValue = &configBackgroundGamepad}, {.name = "disable_gamepads", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisableGamepads}, - {.name = "use_standard_key_bindings_chat", .type = CONFIG_TYPE_BOOL, .boolValue = &configUseStandardKeyBindingsChat}, + {.name = "use_standard_key_bindings_chat", .type = CONFIG_TYPE_BOOL, .boolValue = &configUseStandardKeyBindingsChat}, // free camera settings {.name = "bettercam_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCamera}, {.name = "bettercam_analog", .type = CONFIG_TYPE_BOOL, .boolValue = &configCameraAnalog}, @@ -292,9 +292,9 @@ static const struct ConfigOption options[] = { {.name = "coop_menu_sound", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuSound}, {.name = "coop_menu_random", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuRandom}, {.name = "coop_menu_demos", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuDemos}, - {.name = "coop_global_player_models", .type = CONFIG_TYPE_BOOL, .boolValue = &configGlobalPlayerModels}, {.name = "disable_popups", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisablePopups}, {.name = "language", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLanguage, .maxStringLength = MAX_CONFIG_STRING}, + {.name = "dynos_local_player_model_only", .type = CONFIG_TYPE_BOOL, .boolValue = &configDynosLocalPlayerModelOnly}, // CoopNet settings {.name = "coopnet_ip", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configCoopNetIp, .maxStringLength = MAX_CONFIG_STRING}, {.name = "coopnet_port", .type = CONFIG_TYPE_UINT, .uintValue = &configCoopNetPort}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 82d099cd..4a328bcd 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -119,9 +119,9 @@ extern unsigned int configMenuLevel; extern bool configMenuSound; extern bool configMenuRandom; extern bool configMenuDemos; -extern bool configGlobalPlayerModels; extern bool configDisablePopups; extern char configLanguage[MAX_CONFIG_STRING]; +extern bool configDynosLocalPlayerModelOnly; // CoopNet settings extern char configCoopNetIp[MAX_CONFIG_STRING]; extern unsigned int configCoopNetPort; diff --git a/src/pc/djui/djui_hud_utils.c b/src/pc/djui/djui_hud_utils.c index 09760edf..a2aba017 100644 --- a/src/pc/djui/djui_hud_utils.c +++ b/src/pc/djui/djui_hud_utils.c @@ -20,10 +20,10 @@ #include "game/camera.h" #include "game/hud.h" #include "game/rendering_graph_node.h" +#include "pc/lua/smlua.h" #include "engine/math_util.h" - static enum HudUtilsResolution sResolution = RESOLUTION_DJUI; static enum HudUtilsFilter sFilter = FILTER_NEAREST; static enum DjuiFontType sFont = FONT_NORMAL; @@ -392,7 +392,16 @@ void djui_hud_print_text_interpolated(const char* message, f32 prevX, f32 prevY, interp->resolution = sResolution; } +static inline bool is_power_of_two(u32 n) { + return (n > 0) && ((n & (n - 1)) == 0); +} + void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH) { + if (!is_power_of_two(width) || !is_power_of_two(height)) { + LOG_LUA_LINE("Tried to render DJUI HUD texture with NPOT width or height"); + return; + } + gDjuiHudUtilsZ += 0.01f; // translate position diff --git a/src/pc/djui/djui_panel_controls.c b/src/pc/djui/djui_panel_controls.c index 51317c5e..4c946b3b 100644 --- a/src/pc/djui/djui_panel_controls.c +++ b/src/pc/djui/djui_panel_controls.c @@ -18,9 +18,9 @@ void djui_panel_controls_create(struct DjuiBase* caller) { { djui_button_create(body, DLANG(CONTROLS, N64_BINDS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_n64_create); djui_button_create(body, DLANG(CONTROLS, EXTRA_BINDS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_extra_create); - djui_checkbox_create(body, DLANG(MISC, USE_STANDARD_KEY_BINDINGS_CHAT), &configUseStandardKeyBindingsChat, NULL); djui_checkbox_create(body, DLANG(CONTROLS, BACKGROUND_GAMEPAD), &configBackgroundGamepad, NULL); djui_checkbox_create(body, DLANG(CONTROLS, DISABLE_GAMEPADS), &configDisableGamepads, NULL); + djui_checkbox_create(body, DLANG(MISC, USE_STANDARD_KEY_BINDINGS_CHAT), &configUseStandardKeyBindingsChat, NULL); #ifdef HAVE_SDL2 int numJoys = SDL_NumJoysticks(); diff --git a/src/pc/djui/djui_panel_dynos.c b/src/pc/djui/djui_panel_dynos.c index d6e55bd5..0ff6fe9c 100644 --- a/src/pc/djui/djui_panel_dynos.c +++ b/src/pc/djui/djui_panel_dynos.c @@ -15,7 +15,7 @@ static void djui_panel_dynos_apply(struct DjuiBase* caller) { dynos_pack_set_enabled(caller->tag, caller->bTag); } -static void djui_panel_dynos_global_player_models(UNUSED struct DjuiBase* caller) { +static void djui_panel_dynos_local_player_model_only(UNUSED struct DjuiBase* caller) { for (s32 i = 0; i < MAX_PLAYERS; i++) { network_player_update_model(i); } @@ -62,7 +62,7 @@ void djui_panel_dynos_create(struct DjuiBase* caller) { djui_base_set_size(&space->base, 0, 32); djui_base_set_color(&space->base, 0, 0, 0, 0); - djui_checkbox_create(body, DLANG(DYNOS, GLOBAL_PLAYER_MODELS), &configGlobalPlayerModels, djui_panel_dynos_global_player_models); + djui_checkbox_create(body, DLANG(DYNOS, LOCAL_PLAYER_MODEL_ONLY), &configDynosLocalPlayerModelOnly, djui_panel_dynos_local_player_model_only); if (gNetworkType == NT_NONE) { struct DjuiRect* rect1 = djui_rect_container_create(body, 64); {