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) {
if (!djui_panel_host_port_valid()) {
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) {
network_rehost_begin();
} else if (configNetworkSystem == NS_COOPNET || configAmountofPlayers == 1) {
extern void djui_panel_do_host(bool reconnecting);
network_reset_reconnect_and_rehost();
djui_panel_do_host(false);
djui_panel_do_host(false, true);
} else {
djui_panel_host_message_create(caller);
}

View file

@ -3,17 +3,18 @@
#include "djui_panel.h"
#include "djui_panel_menu.h"
#include "djui_panel_modlist.h"
#include "src/pc/network/network.h"
#include "src/pc/utils/misc.h"
#include "src/pc/configfile.h"
#include "pc/network/network.h"
#include "pc/utils/misc.h"
#include "src/game/level_update.h"
#include "src/game/hardcoded.h"
#include "src/engine/math_util.h"
#include "pc/configfile.h"
#include "pc/utils/misc.h"
#include "game/level_update.h"
#include "game/hardcoded.h"
#include "game/area.h"
#include "engine/math_util.h"
#include "audio/external.h"
#include "sounds.h"
void djui_panel_do_host(bool reconnecting) {
void djui_panel_do_host(bool reconnecting, bool playSound) {
stop_demo(NULL);
djui_panel_shutdown();
extern s16 gCurrSaveFileNum;
@ -35,15 +36,14 @@ void djui_panel_do_host(bool reconnecting) {
gChangeLevelTransition = gLevelValues.entryLevel;
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);
extern void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);
play_transition(0x09, 0x14, 0x00, 0x00, 0x00);
play_transition(WARP_TRANSITION_FADE_INTO_STAR, 0x14, 0x00, 0x00, 0x00);
}
void djui_panel_host_message_do_host(UNUSED struct DjuiBase* caller) {
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) {

View file

@ -494,12 +494,12 @@ void network_rehost_begin(void) {
sNetworkRehostTimer = 2;
}
extern void djui_panel_do_host(bool reconnecting, bool playSound);
static void network_rehost_update(void) {
extern void djui_panel_do_host(bool reconnecting);
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) {

View file

@ -330,7 +330,7 @@ void* main_game_init(UNUSED void* arg) {
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[]) {
// Handle terminal arguments
@ -385,7 +385,8 @@ int main(int argc, char *argv[]) {
} else if (gCLIOpts.network == NT_SERVER) {
network_set_system(NS_SOCKET);
configHostPort = gCLIOpts.networkPort;
djui_panel_do_host(NULL);
djui_panel_do_host(NULL, false);
} else {
network_init(NT_NONE, false);
}