fix spectators not seeing each other's names when joining spectator team

This commit is contained in:
Martin Michelsen
2023-10-01 08:36:33 -07:00
parent 507b2fbcac
commit bbe42b765c
4 changed files with 45 additions and 29 deletions
+11 -4
View File
@@ -3124,14 +3124,21 @@ struct S_JoinSpectatorTeam_GC_Ep3_E8 {
/* 1182 */ uint8_t solo_mode = 0;
/* 1183 */ uint8_t unused3 = 0;
struct SpectatorEntry {
// It seems that at some point Sega intended to show each player's rank in
// spectator teams. The unused1 and unused3 fields are intended for the
// player's encrypted rank text and rank color (according to old Sega logs),
// but the client ignores them. It's not clear what unused4 may have been
// for, but the client also completely ignores it.
/* 00 */ le_uint32_t player_tag = 0;
/* 04 */ le_uint32_t guild_card_number = 0;
/* 08 */ ptext<char, 0x20> name;
/* 08 */ ptext<char, 0x10> name;
/* 18 */ ptext<char, 0x10> unused1;
/* 28 */ uint8_t present = 0;
/* 29 */ uint8_t unknown_a3 = 0;
/* 29 */ uint8_t unused2 = 0;
/* 2A */ le_uint16_t level = 0;
/* 2C */ parray<le_uint32_t, 2> unknown_a5;
/* 34 */ parray<le_uint16_t, 2> unknown_a6;
/* 2C */ le_uint32_t unused3 = 0xFFFFFFFF;
/* 30 */ le_uint32_t name_color; // ARGB8888
/* 34 */ parray<le_uint16_t, 2> unused4;
/* 38 */
} __packed__;
// Somewhat misleadingly, this array also includes the players actually in the
+1 -1
View File
@@ -23,7 +23,7 @@ public:
PlayerLobbyDataDCGC lobby_data;
PlayerInventory inventory;
PlayerDispDataDCPCV3 disp;
uint32_t level;
le_uint32_t level;
} __attribute__((packed));
struct Event {
+20 -11
View File
@@ -1439,28 +1439,30 @@ static void send_join_spectator_team(shared_ptr<Client> c, shared_ptr<Lobby> l)
if (!wc) {
continue;
}
auto wc_p = wc->game_data.player();
auto& p = cmd.players[z];
p.lobby_data.player_tag = 0x00010000;
p.lobby_data.guild_card = wc->license->serial_number;
p.lobby_data.client_id = wc->lobby_client_id;
p.lobby_data.name = wc->game_data.player()->disp.name;
p.lobby_data.name = wc_p->disp.name;
remove_language_marker_inplace(p.lobby_data.name);
p.inventory = wc->game_data.player()->inventory;
p.inventory = wc_p->inventory;
for (size_t y = 0; y < 30; y++) {
p.inventory.items[y].data.bswap_data2_if_mag();
}
p.disp = wc->game_data.player()->disp.to_dcpcv3();
p.disp = wc_p->disp.to_dcpcv3();
remove_language_marker_inplace(p.disp.visual.name);
auto& e = cmd.entries[z];
e.player_tag = 0x00010000;
e.guild_card_number = wc->license->serial_number;
e.name = wc->game_data.player()->disp.name;
e.name = wc_p->disp.name;
remove_language_marker_inplace(e.name);
e.present = 1;
e.level = wc->game_data.ep3_config
? (wc->game_data.ep3_config->online_clv_exp / 100)
: wc->game_data.player()->disp.stats.level.load();
: wc_p->disp.stats.level.load();
e.name_color = wc_p->disp.visual.name_color;
player_count++;
}
@@ -1499,7 +1501,8 @@ static void send_join_spectator_team(shared_ptr<Client> c, shared_ptr<Lobby> l)
e.name = entry.disp.visual.name;
remove_language_marker_inplace(e.name);
e.present = 1;
e.level = entry.disp.stats.level.load();
e.level = entry.level.load();
e.name_color = entry.disp.visual.name_color;
player_count++;
}
@@ -1510,22 +1513,28 @@ static void send_join_spectator_team(shared_ptr<Client> c, shared_ptr<Lobby> l)
for (size_t z = 4; z < 12; z++) {
if (l->clients[z]) {
auto& gd = l->clients[z]->game_data;
auto& p = cmd.spectator_players[z - 4];
auto& e = cmd.entries[z];
p.lobby_data.player_tag = 0x00010000;
p.lobby_data.guild_card = l->clients[z]->license->serial_number;
p.lobby_data.client_id = l->clients[z]->lobby_client_id;
p.lobby_data.name = l->clients[z]->game_data.player()->disp.name;
p.lobby_data.name = gd.player()->disp.name;
remove_language_marker_inplace(p.lobby_data.name);
p.inventory = l->clients[z]->game_data.player()->inventory;
p.disp = l->clients[z]->game_data.player()->disp.to_dcpcv3();
p.inventory = gd.player()->inventory;
p.disp = gd.player()->disp.to_dcpcv3();
remove_language_marker_inplace(p.disp.visual.name);
e.player_tag = 0x00010000;
e.guild_card_number = l->clients[z]->license->serial_number;
e.name = l->clients[z]->game_data.player()->disp.name;
e.name = gd.player()->disp.name;
remove_language_marker_inplace(e.name);
e.present = 1;
e.level = l->clients[z]->game_data.player()->disp.stats.level.load();
e.level = gd.ep3_config
? (gd.ep3_config->online_clv_exp / 100)
: gd.player()->disp.stats.level.load();
e.name_color = gd.player()->disp.visual.name_color;
player_count++;
}
}
+13 -13
View File
@@ -9767,45 +9767,45 @@ I 17097 2023-09-19 21:54:07 - [Commands] Sending to C-4 (Tali) (version=GC comma
1180 | 03 01 00 00 00 00 01 00 11 11 11 11 54 61 6C 69 | Tali
1190 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
11A0 | 00 00 00 00 00 00 00 00 00 00 00 00 01 00 03 00 |
11B0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
11B0 | FF FF FF FF 6E F5 DF FF 00 00 00 00 00 00 00 00 | n
11C0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
11D0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
11E0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
11E0 | 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 |
11F0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1200 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1210 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1220 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1220 | FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 |
1230 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1240 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1250 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1260 | 00 00 00 00 00 00 01 00 22 22 22 22 54 61 6C 69 | Tali
1250 | 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 |
1260 | 00 00 00 00 00 00 01 00 22 22 22 22 54 61 6C 69 | """"Tali
1270 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1280 | 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 |
1290 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1290 | FF FF FF FF 6E F5 DF FF 00 00 00 00 00 00 00 00 | n
12A0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
12B0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
12C0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
12C0 | 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 |
12D0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
12E0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
12F0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1300 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1300 | FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 |
1310 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1320 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1330 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1330 | 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 |
1340 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1350 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1360 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1370 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1370 | FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 |
1380 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1390 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
13A0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
13A0 | 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 |
13B0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
13C0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
13D0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
13E0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
13E0 | FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 |
13F0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1400 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1410 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1410 | 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 |
1420 | 00 00 00 00 09 4A 35 36 37 38 00 00 00 00 00 00 | J5678
1430 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
1440 | 00 00 00 00 00 00 01 00 22 22 22 22 7F 00 00 01 |