From 73ffdf6e98da78cdc2fcc516384baba3b2cbdd89 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:00:29 -0400 Subject: [PATCH] Disable lobby entry buttons with mismatching versions --- src/game/first_person_cam.h | 3 ++- src/pc/djui/djui_lobby_entry.c | 3 ++- src/pc/djui/djui_lobby_entry.h | 2 +- src/pc/djui/djui_panel_join_lobbies.c | 5 +++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/game/first_person_cam.h b/src/game/first_person_cam.h index 285b6a34..d63a03c5 100644 --- a/src/game/first_person_cam.h +++ b/src/game/first_person_cam.h @@ -10,8 +10,9 @@ struct FirstPersonCamera { bool enabled; - bool forceRoll; bool forcePitch; + bool forceYaw; + bool forceRoll; bool centerL; s16 pitch; s16 yaw; diff --git a/src/pc/djui/djui_lobby_entry.c b/src/pc/djui/djui_lobby_entry.c index f991eefc..96abda0f 100644 --- a/src/pc/djui/djui_lobby_entry.c +++ b/src/pc/djui/djui_lobby_entry.c @@ -46,7 +46,7 @@ static void djui_lobby_entry_destroy(struct DjuiBase* base) { free(lobbyEntry); } -struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*)) { +struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, bool disabled, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*)) { struct DjuiLobbyEntry* lobbyEntry = calloc(1, sizeof(struct DjuiLobbyEntry)); struct DjuiBase* base = &lobbyEntry->base; @@ -59,6 +59,7 @@ struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* ho djui_base_set_border_color(&lobbyEntry->base, 128, 128, 128, 255); djui_base_set_border_width(&lobbyEntry->base, 2); djui_base_set_border_width_type(&lobbyEntry->base, DJUI_SVT_ABSOLUTE); + djui_base_set_enabled(&lobbyEntry->base, !disabled); djui_interactable_create(base, djui_lobby_entry_update_style); djui_interactable_hook_click(base, on_click); djui_interactable_hook_hover(base, on_hover, on_hover_end); diff --git a/src/pc/djui/djui_lobby_entry.h b/src/pc/djui/djui_lobby_entry.h index 02c946e2..eef8b937 100644 --- a/src/pc/djui/djui_lobby_entry.h +++ b/src/pc/djui/djui_lobby_entry.h @@ -6,4 +6,4 @@ struct DjuiLobbyEntry { const char* description; }; -struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*)); +struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, bool disabled, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*)); diff --git a/src/pc/djui/djui_panel_join_lobbies.c b/src/pc/djui/djui_panel_join_lobbies.c index 652b1d5f..ec5f7fb4 100644 --- a/src/pc/djui/djui_panel_join_lobbies.c +++ b/src/pc/djui/djui_panel_join_lobbies.c @@ -89,12 +89,13 @@ void djui_panel_join_query(uint64_t aLobbyId, UNUSED uint64_t aOwnerId, uint16_t char version[MAX_VERSION_LENGTH] = { 0 }; snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); - if (strcmp(version, aVersion) != 0) { + bool disabled = strcmp(version, aVersion) != 0; + if (disabled) { snprintf(mode, 64, "\\#ff0000\\[%s]", aVersion); } struct DjuiBase* layoutBase = &sLobbyLayout->base; - struct DjuiLobbyEntry* entry = djui_lobby_entry_create(layoutBase, (char*)aHostName, (char*)mode, playerText, (char*)aDescription, djui_panel_join_lobby, djui_lobby_on_hover, djui_lobby_on_hover_end); + struct DjuiLobbyEntry* entry = djui_lobby_entry_create(layoutBase, (char*)aHostName, (char*)mode, playerText, (char*)aDescription, disabled, djui_panel_join_lobby, djui_lobby_on_hover, djui_lobby_on_hover_end); entry->base.tag = (s64)aLobbyId; djui_paginated_update_page_buttons(sLobbyPaginated); }