From 1b663aed5848e0fab5ace604cbd703dc423f3d04 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Tue, 8 Mar 2022 16:45:07 -0800 Subject: [PATCH] add set-ep3-menu-song --- src/ReceiveCommands.cc | 4 ++++ src/ServerShell.cc | 11 ++++++++++- src/ServerState.cc | 3 ++- src/ServerState.hh | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index 30cf62f8..9c775269 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -371,6 +371,10 @@ void process_login_d_e_pc_gc(shared_ptr s, shared_ptr c, c->bb_player_index = 0; } + if ((c->flags & ClientFlag::Episode3Games) && (s->ep3_menu_song >= 0)) { + send_ep3_change_music(c, s->ep3_menu_song); + } + send_update_client_config(c); process_login_complete(s, c); diff --git a/src/ServerShell.cc b/src/ServerShell.cc index 913730a5..db263e30 100644 --- a/src/ServerShell.cc +++ b/src/ServerShell.cc @@ -57,7 +57,13 @@ Commands:\n\ Enable or disable allowing unregistered users on the server. Disabling this\n\ does not disconnect unregistered users who are already connected.\n\ set-event \n\ - Set the event in all lobbies.\n\ + Set the event in all lobbies, and in the main menu before joining a lobby.\n\ + can be none, xmas, val, easter, hallo, sonic, newyear, summer,\n\ + white, wedding, fall, s-spring, s-summer, or spring.\n\ + set-ep3-menu-song \n\ + Set the song that plays in the main menu for Episode III clients. If an\n\ + event is also set, the event's visuals appear but this song still plays.\n\ + Song IDs are 0 through 51; the default song is -1.\n\ announce \n\ Send an announcement message to all players.\n\ "); @@ -176,6 +182,9 @@ Commands:\n\ } send_change_event(this->state, event_id); + } else if (command_name == "set-ep3-menu-song") { + this->state->ep3_menu_song = stoul(command_args, nullptr, 0); + } else if (command_name == "announce") { u16string message16 = decode_sjis(command_args); send_text_message(this->state, message16.c_str()); diff --git a/src/ServerState.cc b/src/ServerState.cc index eef8853d..4e2c9cee 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -18,7 +18,8 @@ ServerState::ServerState() ip_stack_debug(false), allow_unregistered_users(false), run_shell_behavior(RunShellBehavior::Default), next_lobby_id(1), - pre_lobby_event(0) { + pre_lobby_event(0), + ep3_menu_song(-1) { memset(&this->default_key_file, 0, sizeof(this->default_key_file)); this->main_menu.emplace_back(MAIN_MENU_GO_TO_LOBBY, u"Go to lobby", diff --git a/src/ServerState.hh b/src/ServerState.hh index f1c59ed7..879d715d 100644 --- a/src/ServerState.hh +++ b/src/ServerState.hh @@ -56,6 +56,7 @@ struct ServerState { std::map> id_to_lobby; std::atomic next_lobby_id; uint8_t pre_lobby_event; + int32_t ep3_menu_song; std::map all_addresses; uint32_t local_address;