pause anywhere server setting (#11)

This commit is contained in:
Isaac0-dev 2024-03-29 08:52:27 +10:00 committed by GitHub
parent 1a3dd25c10
commit 64cc05e219
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 23 additions and 5 deletions

View file

@ -203,6 +203,7 @@ BOUNCY_BOUNDS_ON = "Zapnuto"
BOUNCY_BOUNDS_OFF = "Vypnuto" BOUNCY_BOUNDS_OFF = "Vypnuto"
BOUNCY_LEVEL_BOUNDS = "Omezení odražejícího úrovně" BOUNCY_LEVEL_BOUNDS = "Omezení odražejícího úrovně"
AMOUNT_OF_PLAYERS = "Počet hráčů" AMOUNT_OF_PLAYERS = "Počet hráčů"
PAUSE_ANYWHERE = "Pozastavit kdekoli"
[HOST] [HOST]
SERVER_TITLE = "SERVER" SERVER_TITLE = "SERVER"

View file

@ -203,6 +203,7 @@ BOUNCY_BOUNDS_ON = "Aan"
BOUNCY_BOUNDS_OFF = "Uit" BOUNCY_BOUNDS_OFF = "Uit"
BOUNCY_LEVEL_BOUNDS = "Springende Niveau Grenzen" BOUNCY_LEVEL_BOUNDS = "Springende Niveau Grenzen"
AMOUNT_OF_PLAYERS = "Hoeveelheid spelers" AMOUNT_OF_PLAYERS = "Hoeveelheid spelers"
PAUSE_ANYWHERE = "Pauzeer waar dan ook"
[HOST] [HOST]
SERVER_TITLE = "SERVER" SERVER_TITLE = "SERVER"

View file

@ -203,6 +203,7 @@ BOUNCY_BOUNDS_ON = "ON"
BOUNCY_BOUNDS_OFF = "OFF" BOUNCY_BOUNDS_OFF = "OFF"
BOUNCY_LEVEL_BOUNDS = "Bouncy Level Bounds" BOUNCY_LEVEL_BOUNDS = "Bouncy Level Bounds"
AMOUNT_OF_PLAYERS = "Amount of players" AMOUNT_OF_PLAYERS = "Amount of players"
PAUSE_ANYWHERE = "Pause anywhere"
[HOST] [HOST]
SERVER_TITLE = "SERVER" SERVER_TITLE = "SERVER"

View file

@ -203,6 +203,7 @@ BOUNCY_BOUNDS_ON = "Allumé"
BOUNCY_BOUNDS_OFF = "Éteint" BOUNCY_BOUNDS_OFF = "Éteint"
BOUNCY_LEVEL_BOUNDS = "Limites de Niveau Rebondissant" BOUNCY_LEVEL_BOUNDS = "Limites de Niveau Rebondissant"
AMOUNT_OF_PLAYERS = "Nombre de joueurs" AMOUNT_OF_PLAYERS = "Nombre de joueurs"
PAUSE_ANYWHERE = "Faites une pause n'importe où"
[HOST] [HOST]
SERVER_TITLE = "SERVEUR" SERVER_TITLE = "SERVEUR"

View file

@ -203,6 +203,7 @@ BOUNCY_BOUNDS_ON = "An"
BOUNCY_BOUNDS_OFF = "Aus" BOUNCY_BOUNDS_OFF = "Aus"
BOUNCY_LEVEL_BOUNDS = "Elastische Levelgrenzen" BOUNCY_LEVEL_BOUNDS = "Elastische Levelgrenzen"
AMOUNT_OF_PLAYERS = "Spieleranzahl" AMOUNT_OF_PLAYERS = "Spieleranzahl"
PAUSE_ANYWHERE = "Machen Sie irgendwo eine Pause"
[HOST] [HOST]
SERVER_TITLE = "SERVER" SERVER_TITLE = "SERVER"

View file

@ -201,6 +201,7 @@ BOUNCY_BOUNDS_ON = "Acceso"
BOUNCY_BOUNDS_OFF = "Spento" BOUNCY_BOUNDS_OFF = "Spento"
BOUNCY_LEVEL_BOUNDS = "Limiti Livello Rimbalzante" BOUNCY_LEVEL_BOUNDS = "Limiti Livello Rimbalzante"
AMOUNT_OF_PLAYERS = "Numero di giocatori" AMOUNT_OF_PLAYERS = "Numero di giocatori"
PAUSE_ANYWHERE = "Pausa ovunque"
[HOST] [HOST]
SERVER_TITLE = "SERVER" SERVER_TITLE = "SERVER"

View file

@ -203,6 +203,7 @@ BOUNCY_BOUNDS_ON = "Na"
BOUNCY_BOUNDS_OFF = "Wył" BOUNCY_BOUNDS_OFF = "Wył"
BOUNCY_LEVEL_BOUNDS = "Odbijane Granice Poziomów" BOUNCY_LEVEL_BOUNDS = "Odbijane Granice Poziomów"
AMOUNT_OF_PLAYERS = "Liczba Graczy" AMOUNT_OF_PLAYERS = "Liczba Graczy"
PAUSE_ANYWHERE = "Zatrzymaj się w dowolnym miejscu"
[HOST] [HOST]
SERVER_TITLE = "SERWER" SERVER_TITLE = "SERWER"

View file

@ -203,6 +203,7 @@ BOUNCY_BOUNDS_ON = "Ligado"
BOUNCY_BOUNDS_OFF = "Desligado" BOUNCY_BOUNDS_OFF = "Desligado"
BOUNCY_LEVEL_BOUNDS = "Limites de fase saltitante" BOUNCY_LEVEL_BOUNDS = "Limites de fase saltitante"
AMOUNT_OF_PLAYERS = "Quantidade de jogadores" AMOUNT_OF_PLAYERS = "Quantidade de jogadores"
PAUSE_ANYWHERE = "Faça uma pausa em qualquer lugar"
[HOST] [HOST]
SERVER_TITLE = "SERVIDOR" SERVER_TITLE = "SERVIDOR"

View file

@ -202,6 +202,7 @@ BOUNCY_BOUNDS_ON = "Вкл"
BOUNCY_BOUNDS_OFF = "Выкл" BOUNCY_BOUNDS_OFF = "Выкл"
BOUNCY_LEVEL_BOUNDS = "Пределы упругого уровня" BOUNCY_LEVEL_BOUNDS = "Пределы упругого уровня"
AMOUNT_OF_PLAYERS = "Количество игроков" AMOUNT_OF_PLAYERS = "Количество игроков"
PAUSE_ANYWHERE = "Пауза в любом месте"
[HOST] [HOST]
SERVER_TITLE = "SERVER" SERVER_TITLE = "SERVER"

View file

@ -203,6 +203,7 @@ BOUNCY_BOUNDS_ON = "Encendido"
BOUNCY_BOUNDS_OFF = "Apagado" BOUNCY_BOUNDS_OFF = "Apagado"
BOUNCY_LEVEL_BOUNDS = "Límites de Nivel Rebote" BOUNCY_LEVEL_BOUNDS = "Límites de Nivel Rebote"
AMOUNT_OF_PLAYERS = "Número de jugadores" AMOUNT_OF_PLAYERS = "Número de jugadores"
PAUSE_ANYWHERE = "Pausa en cualquier lugar"
[HOST] [HOST]
SERVER_TITLE = "PARTIDA" SERVER_TITLE = "PARTIDA"

View file

@ -257,10 +257,9 @@ u32 pressed_pause(void) {
return TRUE; return TRUE;
} }
// I don't agree with this official change, mods use ACT_FLAG_INTANGIBLE to prevent the player from pausing in things like cutscenes if (gServerSettings.pauseAnywhere && get_dialog_id() < 0) {
// if (get_dialog_id() < 0) { return gPlayer1Controller->buttonPressed & START_BUTTON;
// return gPlayer1Controller->buttonPressed & START_BUTTON; }
// }
return FALSE; return FALSE;
} }

View file

@ -118,6 +118,7 @@ bool configCameraMouse = false;
// coop-specific // coop-specific
bool configSkipIntro = 0; bool configSkipIntro = 0;
bool configBubbleDeath = true; bool configBubbleDeath = true;
bool configPauseAnywhere = false;
unsigned int configAmountofPlayers = 16; unsigned int configAmountofPlayers = 16;
char configJoinIp[MAX_CONFIG_STRING] = ""; char configJoinIp[MAX_CONFIG_STRING] = "";
unsigned int configJoinPort = DEFAULT_PORT; unsigned int configJoinPort = DEFAULT_PORT;
@ -220,6 +221,7 @@ static const struct ConfigOption options[] = {
{.name = "bettercam_pan_level", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraPan}, {.name = "bettercam_pan_level", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraPan},
{.name = "bettercam_degrade", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraDegrade}, {.name = "bettercam_degrade", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraDegrade},
{.name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro}, {.name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro},
{.name = "pause_anywhere", .type = CONFIG_TYPE_BOOL, .boolValue = &configPauseAnywhere},
// debug // debug
{.name = "debug_offset", .type = CONFIG_TYPE_U64 , .u64Value = &gPcDebug.bhvOffset}, {.name = "debug_offset", .type = CONFIG_TYPE_U64 , .u64Value = &gPcDebug.bhvOffset},
{.name = "debug_tags", .type = CONFIG_TYPE_U64 , .u64Value = gPcDebug.tags}, {.name = "debug_tags", .type = CONFIG_TYPE_U64 , .u64Value = gPcDebug.tags},

View file

@ -77,6 +77,7 @@ extern bool configCameraMouse;
extern bool configCameraAnalog; extern bool configCameraAnalog;
extern bool configSkipIntro; extern bool configSkipIntro;
extern bool configBubbleDeath; extern bool configBubbleDeath;
extern bool configPauseAnywhere;
extern unsigned int configAmountofPlayers; extern unsigned int configAmountofPlayers;
extern char configJoinIp[]; extern char configJoinIp[];
extern unsigned int configJoinPort; extern unsigned int configJoinPort;

View file

@ -59,6 +59,7 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) {
djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &configStayInLevelAfterStar, NULL); djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &configStayInLevelAfterStar, NULL);
djui_checkbox_create(body, DLANG(HOST_SETTINGS, SKIP_INTRO_CUTSCENE), &configSkipIntro, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, SKIP_INTRO_CUTSCENE), &configSkipIntro, NULL);
djui_checkbox_create(body, DLANG(HOST_SETTINGS, PAUSE_ANYWHERE), &configPauseAnywhere, NULL);
djui_checkbox_create(body, DLANG(HOST_SETTINGS, BUBBLE_ON_DEATH), &configBubbleDeath, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, BUBBLE_ON_DEATH), &configBubbleDeath, NULL);
djui_checkbox_create(body, DLANG(HOST_SETTINGS, NAMETAGS), &configNametags, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, NAMETAGS), &configNametags, NULL);
@ -84,7 +85,7 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) {
djui_interactable_hook_value_change(&inputbox1->base, djui_panel_host_player_text_change); djui_interactable_hook_value_change(&inputbox1->base, djui_panel_host_player_text_change);
sPlayerAmount = inputbox1; sPlayerAmount = inputbox1;
} }
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -79,6 +79,7 @@ struct ServerSettings gServerSettings = {
.headlessServer = FALSE, .headlessServer = FALSE,
.nametags = TRUE, .nametags = TRUE,
.maxPlayers = MAX_PLAYERS, .maxPlayers = MAX_PLAYERS,
.pauseAnywhere = FALSE,
}; };
struct NametagsSettings gNametagsSettings = { struct NametagsSettings gNametagsSettings = {
@ -125,6 +126,7 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) {
gServerSettings.enablePlayerList = TRUE; gServerSettings.enablePlayerList = TRUE;
gServerSettings.nametags = configNametags; gServerSettings.nametags = configNametags;
gServerSettings.maxPlayers = configAmountofPlayers; gServerSettings.maxPlayers = configAmountofPlayers;
gServerSettings.pauseAnywhere = configPauseAnywhere;
#if defined(RAPI_DUMMY) || defined(WAPI_DUMMY) #if defined(RAPI_DUMMY) || defined(WAPI_DUMMY)
gServerSettings.headlessServer = (inNetworkType == NT_SERVER); gServerSettings.headlessServer = (inNetworkType == NT_SERVER);
#else #else

View file

@ -82,6 +82,7 @@ struct ServerSettings {
u8 headlessServer; u8 headlessServer;
u8 nametags; u8 nametags;
u8 maxPlayers; u8 maxPlayers;
u8 pauseAnywhere;
}; };
struct NametagsSettings { struct NametagsSettings {

View file

@ -120,6 +120,7 @@ void network_send_join(struct Packet* joinRequestPacket) {
packet_write(&p, &gServerSettings.headlessServer, sizeof(u8)); packet_write(&p, &gServerSettings.headlessServer, sizeof(u8));
packet_write(&p, &gServerSettings.nametags, sizeof(u8)); packet_write(&p, &gServerSettings.nametags, sizeof(u8));
packet_write(&p, &gServerSettings.maxPlayers, sizeof(u8)); packet_write(&p, &gServerSettings.maxPlayers, sizeof(u8));
packet_write(&p, &gServerSettings.pauseAnywhere, sizeof(u8));
packet_write(&p, eeprom, sizeof(u8) * 512); packet_write(&p, eeprom, sizeof(u8) * 512);
network_send_to(globalIndex, &p); network_send_to(globalIndex, &p);
@ -172,6 +173,7 @@ void network_receive_join(struct Packet* p) {
packet_read(p, &gServerSettings.headlessServer, sizeof(u8)); packet_read(p, &gServerSettings.headlessServer, sizeof(u8));
packet_read(p, &gServerSettings.nametags, sizeof(u8)); packet_read(p, &gServerSettings.nametags, sizeof(u8));
packet_read(p, &gServerSettings.maxPlayers, sizeof(u8)); packet_read(p, &gServerSettings.maxPlayers, sizeof(u8));
packet_read(p, &gServerSettings.pauseAnywhere, sizeof(u8));
packet_read(p, eeprom, sizeof(u8) * 512); packet_read(p, eeprom, sizeof(u8) * 512);
network_player_connected(NPT_SERVER, 0, 0, &DEFAULT_MARIO_PALETTE, "Player"); network_player_connected(NPT_SERVER, 0, 0, &DEFAULT_MARIO_PALETTE, "Player");