Update map command

This commit is contained in:
Joelrau 2021-01-18 10:37:55 +02:00
parent 3c23811590
commit ee3cc816ba

View File

@ -29,11 +29,6 @@ namespace party
void perform_game_initialization() void perform_game_initialization()
{ {
// This fixes several crashes and impure client stuff
command::execute("onlinegame 1", true);
command::execute("exec default_xboxlive.cfg", true);
command::execute("xstartprivateparty", true);
command::execute("xblive_privatematch 1", true);
command::execute("startentitlements", true); command::execute("startentitlements", true);
} }
@ -186,17 +181,17 @@ namespace party
} }
else else
{ {
if (!game::environment::is_dedi())
{
perform_game_initialization();
}
if (!game::SV_MapExists(mapname.data())) if (!game::SV_MapExists(mapname.data()))
{ {
printf("Map '%s' doesn't exist.", mapname.data()); printf("Map '%s' doesn't exist.", mapname.data());
return; return;
} }
if (!game::environment::is_dedi())
{
perform_game_initialization();
}
auto* current_mapname = game::Dvar_FindVar("mapname"); auto* current_mapname = game::Dvar_FindVar("mapname");
if (current_mapname && utils::string::to_lower(current_mapname->current.string) == utils::string::to_lower(mapname) && game::SV_Loaded()) if (current_mapname && utils::string::to_lower(current_mapname->current.string) == utils::string::to_lower(mapname) && game::SV_Loaded())
{ {
@ -207,18 +202,8 @@ namespace party
printf("Starting map: %s\n", mapname.data()); printf("Starting map: %s\n", mapname.data());
auto* gametype = game::Dvar_FindVar("g_gametype"); game::SV_StartMapForParty(0, mapname.data(), false, false);
if (gametype && gametype->current.string) return;
{
command::execute(utils::string::va("ui_gametype %s", gametype->current.string), true);
}
command::execute(utils::string::va("ui_mapname %s", mapname.data()), true);
// StartServer
reinterpret_cast<void(*)(unsigned int)>(0x140492260)(0);
// this dun work.
//game::SV_StartMapForParty(0, mapname.data(), false, false);
} }
} }