fix episode field in game list command

This commit is contained in:
Martin Michelsen
2024-04-06 22:58:53 -07:00
parent af4d3a3325
commit e141642dd6
2 changed files with 11 additions and 1 deletions
+6
View File
@@ -552,12 +552,18 @@ struct S_GameMenuEntryT {
// - On BB, 0x40/0x41 mean Episodes 1/2 as on GC, and 0x43 means Episode 4.
uint8_t episode = 0;
// Flags:
// 01 = Send name? (client sends the name field in the 10 command if this
// item is chosen, but it's blank)
// 02 = Locked (lock icon appears in menu; player is prompted for password if
// they choose this game)
// 04 = In battle (Episode 3; a sword icon appears in menu)
// 04 = Disabled (BB; used for solo games)
// 10 = Is battle mode
// 20 = Is challenge mode
// 40 = Is v2 only (DCv2/PC); name renders in orange
// 40 = Is Episode 1 (V3/BB)
// 80 = Is Episode 2 (V3/BB)
// C0 = Is Episode 4 (BB)
uint8_t flags = 0;
} __packed__;
using S_GameMenuEntry_PC_BB_08 = S_GameMenuEntryT<TextEncoding::UTF16>;
+5 -1
View File
@@ -1461,7 +1461,7 @@ void send_game_menu_t(
auto& e = entries.emplace_back();
e.menu_id = MenuID::GAME;
e.game_id = l->lobby_id;
e.difficulty_tag = (l->is_ep3() ? 0x0A : (l->difficulty + 0x22));
e.difficulty_tag = (is_ep3(c->version()) ? 0x0A : (l->difficulty + 0x22));
e.num_players = l->count_clients();
if (is_dc(c->version())) {
e.episode = l->version_is_allowed(Version::DC_V1) ? 1 : 0;
@@ -1490,6 +1490,10 @@ void send_game_menu_t(
default:
throw logic_error("invalid game mode");
}
// On v2, render name in orange if v1 is not allowed
if (is_v2(c->version()) && !l->version_is_allowed(Version::DC_V1)) {
e.flags |= 0x40;
}
// On BB, gray out games that can't be joined
if ((c->version() == Version::BB_V4) && (l->join_error_for_client(c, nullptr) != Lobby::JoinError::ALLOWED)) {
e.flags |= 0x04;