Fix connecting to zombie dedicated servers

This commit is contained in:
BrentVL-1952840 2023-02-21 20:49:35 +01:00
parent 373fe1655a
commit d35c2a99cf

View File

@ -228,14 +228,22 @@ namespace party
return *reinterpret_cast<game::netadr_t*>(address); return *reinterpret_cast<game::netadr_t*>(address);
} }
bool is_mp()
{
return game::Com_SessionMode_GetMode() == game::MODE_MULTIPLAYER;
}
int should_transfer_stub(uint8_t* storage_file_info) int should_transfer_stub(uint8_t* storage_file_info)
{ {
auto should_transfer = game::ShouldTransfer(storage_file_info); auto should_transfer = game::ShouldTransfer(storage_file_info);
const auto offset = storage_file_info - reinterpret_cast<uint8_t*>(0x14343CDF0_g); const auto offset = storage_file_info - reinterpret_cast<uint8_t*>(0x14343CDF0_g);
const auto index = offset / 120; const auto index = offset / 120;
if (index >= 12 && index <= 15 && is_connecting_to_dedi && get_connected_server() == connect_host) // Choose between multiplayer or zombies indices
const auto stats_index = is_mp() ? 12 : 15;
const auto loadout_index = is_mp() ? 17 : 20;
if (index >= stats_index && index <= loadout_index && is_connecting_to_dedi && get_connected_server() == connect_host)
{ {
should_transfer = !should_transfer; should_transfer = !should_transfer;
} }