From ef7f5fb798ade6de66ab5223e72ad29cde463fa6 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 17 Sep 2023 12:02:58 -0700 Subject: [PATCH] maybe fix spectator team map loading --- src/CommandFormats.hh | 10 ++++++---- src/Episode3/Server.cc | 11 +++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index b7b21faf..b688f76f 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -6219,11 +6219,13 @@ struct G_Unknown_GC_Ep3_6xB3x3A_CAx3A { G_CardServerDataCommandHeader header = {0xB3, sizeof(G_Unknown_GC_Ep3_6xB3x3A_CAx3A) / 4, 0, 0x3A, 0, 0, 0, 0, 0}; } __packed__; -// 6xB4x3B: Unknown -// TODO: Document this from Episode 3 client/server disassembly +// 6xB4x3B: Load current environment +// This command is used to send spectators in a spectator team to the main +// battle. A 6xB4x05 and 6xB6x41 command shouldhave been sent before this, to +// set the map state that should appear for the new spectator. -struct G_Unknown_GC_Ep3_6xB4x3B { - G_CardBattleCommandHeader header = {0xB4, sizeof(G_Unknown_GC_Ep3_6xB4x3B) / 4, 0, 0x3B, 0, 0, 0}; +struct G_LoadCurrentEnvironment_GC_Ep3_6xB4x05 { + G_CardBattleCommandHeader header = {0xB4, sizeof(G_LoadCurrentEnvironment_GC_Ep3_6xB4x05) / 4, 0, 0x3B, 0, 0, 0}; parray unused; } __packed__; diff --git a/src/Episode3/Server.cc b/src/Episode3/Server.cc index dccac493..62be061c 100644 --- a/src/Episode3/Server.cc +++ b/src/Episode3/Server.cc @@ -273,8 +273,15 @@ void Server::send_commands_for_joining_spectator(Channel& c, bool is_trial) cons if (should_send_state) { c.send(0xC9, 0x00, this->prepare_6xB4x07_decks_update()); c.send(0xC9, 0x00, this->prepare_6xB4x1C_names_update()); - G_Unknown_GC_Ep3_6xB4x3B cmd_3B; - c.send(0xC9, 0x00, &cmd_3B, sizeof(cmd_3B)); + { + G_UpdateMap_GC_Ep3_6xB4x05 cmd_05; + cmd_05.state = *this->map_and_rules; + this->send(cmd_05); + } + { + G_LoadCurrentEnvironment_GC_Ep3_6xB4x05 cmd_3B; + c.send(0xC9, 0x00, &cmd_3B, sizeof(cmd_3B)); + } c.send(0xC9, 0x00, this->prepare_6xB4x50_trap_tile_locations()); } }