Add rules panel for public lobbies

Co-Authored-By: Cooliokid956 <68075390+cooliokid956@users.noreply.github.com>
Co-Authored-By: Blockyyy <88585273+blockyyy@users.noreply.github.com>
Co-Authored-By: flipflop bell <118061445+flipflopbell@users.noreply.github.com>
Co-Authored-By: PeachyPeach <72323920+peachypeachsm64@users.noreply.github.com>
This commit is contained in:
Agent X 2024-06-21 12:31:47 -04:00
parent 6cb37160f9
commit 7a38540211
17 changed files with 201 additions and 10 deletions

View File

@ -237,6 +237,16 @@ PUBLIC_LOBBIES = "Veřejné hry"
PRIVATE_LOBBIES = "Soukromé hry"
DIRECT = "Přímé spojení"
[RULES]
RULES_TITLE = "PRAVIDLA"
RULE_1 = "1. Musíte být starší 13 let."
RULE_2 = "2. Žádné nenávistné projevy, urážky nebo jakékoli urážlivé výrazy."
RULE_3 = "3. Nepoužívejte žádné upravené sestavy."
RULE_4 = "4. Nepoužívejte nevydané modifikace bez souhlasu původního autora."
RULE_5 = "5. Jakákoli forma NSFW obsahu nebude tolerována."
SUBJECT_TO_CHANGE = "Tato pravidla se mohou v budoucích aktualizacích změnit."
NOTICE = "Připojením k síti CoopNet souhlasíte s dodržováním těchto pravidel při hraní ve veřejných lobby."
[MAIN]
QUIT_TITLE = "OPUSTIT HRU"
QUIT_CONFIRM = "Opravdu chcete opustit hru?"

View File

@ -237,6 +237,16 @@ PUBLIC_LOBBIES = "Openbare Lobbies"
PRIVATE_LOBBIES = "Privé Lobbies"
DIRECT = "Directe Verbinding"
[RULES]
RULES_TITLE = "REGELS"
RULE_1 = "1. Je moet 13 jaar of ouder zijn."
RULE_2 = "2. Geen haatdragende taal, vloeken of andere beledigende taal."
RULE_3 = "3. Gebruik geen aangepaste bouw."
RULE_4 = "4. Host geen niet-uitgebrachte mods zonder toestemming van de oorspronkelijke auteur."
RULE_5 = "5. Elke vorm van NSFW-inhoud wordt niet getolereerd."
SUBJECT_TO_CHANGE = "Deze regels zijn onderhevig aan wijzigingen in toekomstige updates."
NOTICE = "Door verbinding te maken met CoopNet, ga je akkoord met deze regels tijdens het spelen in openbare lobby's."
[MAIN]
QUIT_TITLE = "STOP"
QUIT_CONFIRM = "Weet je zeker dat je wilt stoppen?"

View File

@ -237,6 +237,16 @@ PUBLIC_LOBBIES = "Public Lobbies"
PRIVATE_LOBBIES = "Private Lobbies"
DIRECT = "Direct Connection"
[RULES]
RULES_TITLE = "RULES"
RULE_1 = "1. You must be 13 years or older."
RULE_2 = "2. No hate speech, slurs, or any kind of offensive language."
RULE_3 = "3. Do not use any modified build."
RULE_4 = "4. Do not host unreleased mods without the consent of the original author."
RULE_5 = "5. Any form of NSFW content will not be tolerated."
SUBJECT_TO_CHANGE = "These rules are subject to change in future updates."
NOTICE = "By connecting to CoopNet, you are agreeing to abide by these rules while playing in public lobbies."
[MAIN]
QUIT_TITLE = "QUIT"
QUIT_CONFIRM = "Are you sure you want to quit?"

View File

@ -237,6 +237,16 @@ PUBLIC_LOBBIES = "Parties Publiques"
PRIVATE_LOBBIES = "Parties Privées"
DIRECT = "Connexion Directe"
[RULES]
RULES_TITLE = "RÈGLES"
RULE_1 = "1. Vous devez avoir 13 ans ou plus."
RULE_2 = "2. Pas de sujets incitant à la haine, d'injures, ou de langage offensant."
RULE_3 = "3. N'utilisez aucune version modifiée du jeu."
RULE_4 = "4. N'utilisez aucun mod non publié sans l'accord de l'auteur."
RULE_5 = "5. Aucune forme de contenu choquant ou à caractère sexuel ne sera tolérée."
SUBJECT_TO_CHANGE = "Ces règles sont susceptibles de changer dans les mises à jour à venir."
NOTICE = "En vous connectant à CoopNet, vous acceptez de respecter ces règles lorsque vous jouez dans des salons publics."
[MAIN]
QUIT_TITLE = "QUITTER"
QUIT_CONFIRM = "Êtes-vous sûr de vouloir quitter ?"

View File

@ -237,6 +237,16 @@ PUBLIC_LOBBIES = "Öffentliche Lobbys"
PRIVATE_LOBBIES = "Private Lobbys"
DIRECT = "Direktverbindung"
[RULES]
RULES_TITLE = "REGELN"
RULE_1 = "1. Sie müssen 13 Jahre oder älter sein."
RULE_2 = "2. Keine Hassreden, Verunglimpfungen oder jegliche Art von beleidigender Sprache."
RULE_3 = "3. Keine modifizierte Bauweise verwenden."
RULE_4 = "4. Keine unveröffentlichten Mods ohne die Zustimmung des ursprünglichen Autors zu hosten."
RULE_5 = "5. Jede Form von NSFW-Inhalten wird nicht toleriert."
SUBJECT_TO_CHANGE = "Diese Regeln können in zukünftigen Updates geändert werden."
NOTICE = "Indem du dich mit CoopNet verbindest, erklärst du dich damit einverstanden, diese Regeln zu befolgen, während du in öffentlichen Lobbys spielst."
[MAIN]
QUIT_TITLE = "BEENDEN"
QUIT_CONFIRM = "Möchtest du das Spiel wirklich beenden?"

View File

@ -235,6 +235,16 @@ PUBLIC_LOBBIES = "Public Lobbies"
PRIVATE_LOBBIES = "Private Lobbies"
DIRECT = "Direct Connection"
[RULES]
RULES_TITLE = "REGOLE"
RULE_1 = "1. Devi avere almeno 13 anni."
RULE_2 = "2. Niente discorsi d'odio, insulti o qualsiasi tipo di linguaggio offensivo."
RULE_3 = "3. Non utilizzare alcuna struttura modificata."
RULE_4 = "4. Non ospitare mod non rilasciate senza il consenso dell'autore originale."
RULE_5 = "5. Qualsiasi forma di contenuto NSFW non sarà tollerata."
SUBJECT_TO_CHANGE = "Queste regole sono soggette a modifiche nei futuri aggiornamenti."
NOTICE = "Connettendosi a CoopNet, si accetta di rispettare queste regole quando si gioca nelle lobby pubbliche".
[MAIN]
QUIT_TITLE = "ABBANDONA"
QUIT_CONFIRM = "Sei sicuro do voler abbandonare?"

View File

@ -237,6 +237,16 @@ PUBLIC_LOBBIES = "Lobby Publiczne"
PRIVATE_LOBBIES = "Lobby Prywatne"
DIRECT = "Połączenie Bezpośrednie"
[RULES]
RULES_TITLE = "RULES"
RULE_1 = "1. Musisz mieć ukończone 13 lat."
RULE_2 = "2. Zakaz używania mowy nienawiści, obelg lub jakiegokolwiek obraźliwego języka."
RULE_3 = "3. Nie używaj żadnych zmodyfikowanych konstrukcji."
RULE_4 = "4. Nie hostuj niewydanych modów bez zgody ich autora."
RULE_5 = "5. Jakakolwiek forma treści NSFW nie będzie tolerowana."
SUBJECT_TO_CHANGE = "Zasady te mogą ulec zmianie w przyszłych aktualizacjach."
NOTICE = "Łącząc się z CoopNet, zgadzasz się przestrzegać tych zasad podczas gry w lobby publicznym."
[MAIN]
QUIT_TITLE = "WYJŚCIE"
QUIT_CONFIRM = "Czy na pewno chcesz wyjść?"

View File

@ -237,6 +237,16 @@ PUBLIC_LOBBIES = "Partidas públicas"
PRIVATE_LOBBIES = "Partidas privadas"
DIRECT = "Conexão direta"
[RULES]
RULES_TITLE = "REGRAS"
RULE_1 = "1. Você deve ter 13 anos ou mais."
RULE_2 = "2. Sem discurso de ódio, difamações, ou qualquer outro tipo de linguagem ofensiva."
RULE_3 = "3. Não use nenhuma versão modificada."
RULE_4 = "4. Não hosteie mods não lançados sem o consentimento do autor original."
RULE_5 = "5. Qualquer forma de conteúdo NSFW não será tolerado."
SUBJECT_TO_CHANGE = "Essas regras estão sujeitas a mudanças em futuras atualizações."
NOTICE = "Ao conectar-se ao CoopNet, você concorda em respeitar estas regras enquanto joga em salas públicas."
[MAIN]
QUIT_TITLE = "SAIR"
QUIT_CONFIRM = "Você tem certeza que deseja sair?"

View File

@ -236,6 +236,16 @@ PUBLIC_LOBBIES = "Открытая группа"
PRIVATE_LOBBIES = "Закрытая группа"
DIRECT = "По адресу"
[RULES]
RULES_TITLE = "ПРАВИЛА"
RULE_1 = "1. Вам должно быть 13 лет или больше."
RULE_2 = "2. Никакой ненависти, оскорблений или любой другой оскорбительной лексики."
RULE_3 = "3. Не использовать модифицированный билд."
RULE_4 = "4. Не размещайте невыпущенные моды без согласия автора."
RULE_5 = "5. Любые формы NSFW-контента не допускаются."
SUBJECT_TO_CHANGE = "Эти правила могут быть изменены в будущих обновлениях."
NOTICE = "Подключаясь к CoopNet, вы соглашаетесь соблюдать эти правила во время игры в общественных лобби."
[MAIN]
QUIT_TITLE = "QUIT"
QUIT_CONFIRM = "Вы уверены, что хотите выйти?"

View File

@ -237,6 +237,16 @@ PUBLIC_LOBBIES = "Salas Públicas"
PRIVATE_LOBBIES = "Salas Privadas"
DIRECT = "Conexión Directa"
[RULES]
RULES_TITLE = "REGLAS"
RULE_1 = "1. Debes tener 13 años o más."
RULE_2 = "2. No usar expresiones de odio, insultos o cualquier clase de lenguaje ofensivo."
RULE_3 = "3. No uses ninguna versión modificada."
RULE_4 = "4. No alojar mods inéditos sin el permiso del autor original."
RULE_5 = "5. No toleraremos ninguna clase de contenido NSFW."
SUBJECT_TO_CHANGE = "Estas reglas están sujetas a cambios en futuras actualizaciones."
NOTICE = "Al conectarte a CoopNet, aceptas a cumplir estas normas mientras juegas en partidas públicas."
[MAIN]
QUIT_TITLE = "SALIR"
QUIT_CONFIRM = "¿Seguro que quieres salir?"

View File

@ -124,6 +124,7 @@ unsigned int configRumbleStrength = 50;
unsigned int configGamepadNumber = 0;
bool configBackgroundGamepad = true;
bool configDisableGamepads = false;
bool configUseStandardKeyBindingsChat = false;
// free camera settings
bool configEnableCamera = false;
bool configCameraAnalog = false;
@ -169,17 +170,20 @@ bool configMenuRandom = false;
bool configMenuDemos = false;
bool configGlobalPlayerModels = true;
bool configDisablePopups = false;
bool configUseStandardKeyBindingsChat = false;
char configLanguage[MAX_CONFIG_STRING] = "";
// CoopNet settings
char configCoopNetIp[MAX_CONFIG_STRING] = DEFAULT_COOPNET_IP;
unsigned int configCoopNetPort = DEFAULT_COOPNET_PORT;
char configPassword[MAX_CONFIG_STRING] = "";
char configDestId[MAX_CONFIG_STRING] = "0";
// DJUI settings
unsigned int configDjuiTheme = DJUI_THEME_DARK;
bool configDjuiThemeCenter = true;
unsigned int configDjuiThemeFont = FONT_NORMAL;
unsigned int configDjuiScale = 0;
// other
char configLastVersion[MAX_CONFIG_STRING] = "";
unsigned int configRulesVersion = 0;
static const struct ConfigOption options[] = {
// window settings
@ -235,6 +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},
// free camera settings
{.name = "bettercam_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCamera},
{.name = "bettercam_analog", .type = CONFIG_TYPE_BOOL, .boolValue = &configCameraAnalog},
@ -289,7 +294,6 @@ static const struct ConfigOption options[] = {
{.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 = "use_standard_key_bindings_chat", .type = CONFIG_TYPE_BOOL, .boolValue = &configUseStandardKeyBindingsChat},
{.name = "language", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLanguage, .maxStringLength = MAX_CONFIG_STRING},
// CoopNet settings
{.name = "coopnet_ip", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configCoopNetIp, .maxStringLength = MAX_CONFIG_STRING},
@ -302,7 +306,8 @@ static const struct ConfigOption options[] = {
{.name = "djui_theme_font", .type = CONFIG_TYPE_UINT, .uintValue = &configDjuiThemeFont},
{.name = "djui_scale", .type = CONFIG_TYPE_UINT, .uintValue = &configDjuiScale},
// other
{.name = "last_version", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLastVersion, .maxStringLength = MAX_CONFIG_STRING}
{.name = "last_version", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLastVersion, .maxStringLength = MAX_CONFIG_STRING},
{.name = "rules_version", .type = CONFIG_TYPE_UINT, .uintValue = &configRulesVersion}
};
// FunctionConfigOption functions

View File

@ -75,6 +75,7 @@ extern unsigned int configRumbleStrength;
extern unsigned int configGamepadNumber;
extern bool configBackgroundGamepad;
extern bool configDisableGamepads;
extern bool configUseStandardKeyBindingsChat;
// free camera settings
extern bool configEnableCamera;
extern bool configCameraAnalog;
@ -120,17 +121,20 @@ extern bool configMenuRandom;
extern bool configMenuDemos;
extern bool configGlobalPlayerModels;
extern bool configDisablePopups;
extern bool configUseStandardKeyBindingsChat;
extern char configLanguage[MAX_CONFIG_STRING];
// CoopNet settings
extern char configCoopNetIp[MAX_CONFIG_STRING];
extern unsigned int configCoopNetPort;
extern char configPassword[MAX_CONFIG_STRING];
extern char configDestId[MAX_CONFIG_STRING];
// DJUI settings
extern unsigned int configDjuiTheme;
extern bool configDjuiThemeCenter;
extern unsigned int configDjuiThemeFont;
extern unsigned int configDjuiScale;
// other
extern char configLastVersion[MAX_CONFIG_STRING];
extern unsigned int configRulesVersion;
void enable_queued_mods(void);
void enable_queued_dynos_packs(void);

View File

@ -6,6 +6,7 @@
#include "djui_panel_host_settings.h"
#include "djui_panel_host_save.h"
#include "djui_panel_host_message.h"
#include "djui_panel_rules.h"
#include "game/save_file.h"
#include "pc/network/network.h"
#include "pc/utils/misc.h"
@ -83,6 +84,12 @@ static void djui_panel_host_do_host(struct DjuiBase* caller) {
if (gNetworkType == NT_SERVER) {
network_rehost_begin();
} else if (configNetworkSystem == NS_COOPNET || configAmountofPlayers == 1) {
#ifdef COOPNET
if (sInputboxPassword->buffer[0] == '\0' && configRulesVersion != RULES_VERSION && configAmountofPlayers > 1) {
djui_panel_rules_create(caller);
return;
}
#endif
network_reset_reconnect_and_rehost();
djui_panel_do_host(false, true);
} else {

View File

@ -12,12 +12,6 @@
#endif
#ifdef COOPNET
static void djui_panel_compatibility_checkbox_on_value_change(UNUSED struct DjuiBase* caller) {
#ifdef DISCORD_SDK
gDiscordInitialized = false;
#endif
}
static void djui_panel_join_public_lobbies(struct DjuiBase* caller) {
djui_panel_join_lobbies_create(caller, "");
}

View File

@ -4,6 +4,7 @@
#include "djui_panel_menu.h"
#include "djui_panel_join_message.h"
#include "djui_lobby_entry.h"
#include "djui_panel_rules.h"
#include "pc/network/network.h"
#include "pc/network/socket/socket.h"
#include "pc/network/coopnet/coopnet.h"
@ -143,6 +144,10 @@ void djui_panel_join_lobbies_create(struct DjuiBase* caller, const char* passwor
if (sPassword) { free(sPassword); sPassword = NULL; }
sPassword = strdup(password);
bool private = (strlen(password) > 0);
if (!private && configRulesVersion != RULES_VERSION) {
djui_panel_rules_create(caller);
return;
}
djui_panel_join_lobby_description_create();
@ -162,6 +167,8 @@ void djui_panel_join_lobbies_create(struct DjuiBase* caller, const char* passwor
djui_text_set_alignment(text, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
}
djui_button_create(body, DLANG(RULES, RULES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_rules_create);
struct DjuiRect* rect2 = djui_rect_container_create(body, 64);
{
struct DjuiButton* button1 = djui_button_create(&rect2->base, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);

View File

@ -0,0 +1,66 @@
#include <string.h>
#include "djui.h"
#include "djui_panel.h"
#include "djui_panel_menu.h"
#include "djui_panel_rules.h"
#include "djui_panel_join_lobbies.h"
#ifdef COOPNET
static char sRules[512];
static void djui_panel_rules_accept(struct DjuiBase* caller) {
configRulesVersion = RULES_VERSION;
djui_panel_join_lobbies_create(caller, "");
}
void djui_panel_rules_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(RULES, RULES_TITLE));
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
snprintf(sRules, 512, "%s\n\
%s\n\
%s\n\
%s\n\
%s",
DLANG(RULES, RULE_1),
DLANG(RULES, RULE_2),
DLANG(RULES, RULE_3),
DLANG(RULES, RULE_4),
DLANG(RULES, RULE_5));
struct DjuiText* text1 = djui_text_create(body, sRules);
djui_base_set_location(&text1->base, 0, 0);
djui_base_set_size(&text1->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 200);
djui_base_set_color(&text1->base, 220, 220, 220, 255);
djui_text_set_drop_shadow(text1, 64, 64, 64, 100);
djui_text_set_alignment(text1, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
struct DjuiText* text2 = djui_text_create(body, DLANG(RULES, SUBJECT_TO_CHANGE));
djui_base_set_location(&text2->base, 0, 0);
djui_base_set_size(&text2->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 64);
djui_base_set_color(&text2->base, 220, 220, 220, 255);
djui_text_set_drop_shadow(text2, 64, 64, 64, 100);
djui_text_set_alignment(text2, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
if (configRulesVersion != RULES_VERSION) {
struct DjuiText* text3 = djui_text_create(body, DLANG(RULES, NOTICE));
djui_base_set_location(&text3->base, 0, 0);
djui_base_set_size(&text3->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 96);
djui_base_set_color(&text3->base, 220, 220, 220, 255);
djui_text_set_drop_shadow(text3, 64, 64, 64, 100);
djui_text_set_alignment(text3, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
struct DjuiRect* rect = djui_rect_container_create(body, 64);
{
djui_button_left_create(&rect->base, DLANG(MENU, YES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_rules_accept);
djui_button_right_create(&rect->base, DLANG(MENU, NO), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
}
} else {
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
}
}
djui_panel_add(caller, panel, NULL);
}
#endif

View File

@ -0,0 +1,8 @@
#pragma once
#include "djui.h"
#ifdef COOPNET
#define RULES_VERSION 1
void djui_panel_rules_create(struct DjuiBase* caller);
#endif