h1-mod/src/client/component/ranked.cpp

46 lines
1.2 KiB
C++
Raw Normal View History

2022-03-06 15:17:42 -05:00
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "scheduler.hpp"
#include "dvars.hpp"
#include "game/game.hpp"
#include "game/dvars.hpp"
#include <utils/hook.hpp>
#include <utils/flags.hpp>
namespace ranked
{
class component final : public component_interface
{
public:
void post_unpack() override
{
if (game::environment::is_sp())
{
return;
}
if (game::environment::is_mp())
{
2022-05-31 15:03:58 -04:00
dvars::override::register_bool("xblive_privatematch", false, game::DVAR_FLAG_REPLICATED);
2022-03-06 15:17:42 -05:00
}
2022-05-19 13:09:17 -04:00
if (game::environment::is_dedi())
2022-03-06 15:17:42 -05:00
{
2022-05-31 15:03:58 -04:00
dvars::override::register_bool("xblive_privatematch", false, game::DVAR_FLAG_REPLICATED | game::DVAR_FLAG_WRITE);
2022-05-19 13:09:17 -04:00
dvars::register_bool("force_ranking", true, game::DVAR_FLAG_WRITE, ""); // Skip some check in _menus.gsc
2022-03-06 15:17:42 -05:00
}
// Always run bots, even if xblive_privatematch is 0
2022-05-19 13:09:17 -04:00
utils::hook::set(0x2C10B0_b, 0xC301B0); // BG_BotSystemEnabled
utils::hook::set(0x2C0E60_b, 0xC301B0); // BG_AISystemEnabled
utils::hook::set(0x2C1040_b, 0xC301B0); // BG_BotFastFileEnabled
utils::hook::set(0x2C11B0_b, 0xC301B0); // BG_BotsUsingTeamDifficulty
2022-03-06 15:17:42 -05:00
}
};
}
2022-05-19 13:09:17 -04:00
REGISTER_COMPONENT(ranked::component)