Fix --server a bit further

This commit is contained in:
Agent X 2024-03-10 22:16:42 -04:00
parent 6d114b3736
commit 7b628334d6
4 changed files with 18 additions and 17 deletions

View File

@ -65,6 +65,7 @@ static void djui_panel_host_password_text_change(UNUSED struct DjuiBase* caller)
} }
} }
extern void djui_panel_do_host(bool reconnecting, bool playSound);
static void djui_panel_host_do_host(struct DjuiBase* caller) { static void djui_panel_host_do_host(struct DjuiBase* caller) {
if (!djui_panel_host_port_valid()) { if (!djui_panel_host_port_valid()) {
djui_interactable_set_input_focus(&sInputboxPort->base); djui_interactable_set_input_focus(&sInputboxPort->base);
@ -82,9 +83,8 @@ static void djui_panel_host_do_host(struct DjuiBase* caller) {
if (gNetworkType == NT_SERVER) { if (gNetworkType == NT_SERVER) {
network_rehost_begin(); network_rehost_begin();
} else if (configNetworkSystem == NS_COOPNET || configAmountofPlayers == 1) { } else if (configNetworkSystem == NS_COOPNET || configAmountofPlayers == 1) {
extern void djui_panel_do_host(bool reconnecting);
network_reset_reconnect_and_rehost(); network_reset_reconnect_and_rehost();
djui_panel_do_host(false); djui_panel_do_host(false, true);
} else { } else {
djui_panel_host_message_create(caller); djui_panel_host_message_create(caller);
} }

View File

@ -3,17 +3,18 @@
#include "djui_panel.h" #include "djui_panel.h"
#include "djui_panel_menu.h" #include "djui_panel_menu.h"
#include "djui_panel_modlist.h" #include "djui_panel_modlist.h"
#include "src/pc/network/network.h" #include "pc/network/network.h"
#include "src/pc/utils/misc.h"
#include "src/pc/configfile.h"
#include "pc/utils/misc.h" #include "pc/utils/misc.h"
#include "src/game/level_update.h" #include "pc/configfile.h"
#include "src/game/hardcoded.h" #include "pc/utils/misc.h"
#include "src/engine/math_util.h" #include "game/level_update.h"
#include "game/hardcoded.h"
#include "game/area.h"
#include "engine/math_util.h"
#include "audio/external.h" #include "audio/external.h"
#include "sounds.h" #include "sounds.h"
void djui_panel_do_host(bool reconnecting) { void djui_panel_do_host(bool reconnecting, bool playSound) {
stop_demo(NULL); stop_demo(NULL);
djui_panel_shutdown(); djui_panel_shutdown();
extern s16 gCurrSaveFileNum; extern s16 gCurrSaveFileNum;
@ -35,15 +36,14 @@ void djui_panel_do_host(bool reconnecting) {
gChangeLevelTransition = gLevelValues.entryLevel; gChangeLevelTransition = gLevelValues.entryLevel;
if (gMarioState->marioObj) vec3f_copy(gMarioState->marioObj->header.gfx.cameraToObject, gGlobalSoundSource); if (gMarioState->marioObj) vec3f_copy(gMarioState->marioObj->header.gfx.cameraToObject, gGlobalSoundSource);
if (playSound) { play_character_sound(gMarioState, CHAR_SOUND_OKEY_DOKEY); }
play_character_sound(gMarioState, CHAR_SOUND_OKEY_DOKEY); play_transition(WARP_TRANSITION_FADE_INTO_STAR, 0x14, 0x00, 0x00, 0x00);
extern void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);
play_transition(0x09, 0x14, 0x00, 0x00, 0x00);
} }
void djui_panel_host_message_do_host(UNUSED struct DjuiBase* caller) { void djui_panel_host_message_do_host(UNUSED struct DjuiBase* caller) {
network_reset_reconnect_and_rehost(); network_reset_reconnect_and_rehost();
djui_panel_do_host(false); djui_panel_do_host(false, true);
} }
void djui_panel_host_message_create(struct DjuiBase* caller) { void djui_panel_host_message_create(struct DjuiBase* caller) {

View File

@ -494,12 +494,12 @@ void network_rehost_begin(void) {
sNetworkRehostTimer = 2; sNetworkRehostTimer = 2;
} }
extern void djui_panel_do_host(bool reconnecting, bool playSound);
static void network_rehost_update(void) { static void network_rehost_update(void) {
extern void djui_panel_do_host(bool reconnecting);
if (sNetworkRehostTimer <= 0) { return; } if (sNetworkRehostTimer <= 0) { return; }
if (--sNetworkRehostTimer != 0) { return; } if (--sNetworkRehostTimer != 0) { return; }
djui_panel_do_host(true); djui_panel_do_host(true, true);
} }
static void network_update_area_timer(void) { static void network_update_area_timer(void) {

View File

@ -330,7 +330,7 @@ void* main_game_init(UNUSED void* arg) {
gGameInited = true; gGameInited = true;
} }
extern void djui_panel_do_host(bool reconnecting); extern void djui_panel_do_host(bool reconnecting, bool playSound);
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
// Handle terminal arguments // Handle terminal arguments
@ -385,7 +385,8 @@ int main(int argc, char *argv[]) {
} else if (gCLIOpts.network == NT_SERVER) { } else if (gCLIOpts.network == NT_SERVER) {
network_set_system(NS_SOCKET); network_set_system(NS_SOCKET);
configHostPort = gCLIOpts.networkPort; configHostPort = gCLIOpts.networkPort;
djui_panel_do_host(NULL);
djui_panel_do_host(NULL, false);
} else { } else {
network_init(NT_NONE, false); network_init(NT_NONE, false);
} }