Allow loading mp maps
This commit is contained in:
parent
5c0c3bf16f
commit
e0e638c382
@ -430,6 +430,12 @@ namespace fastfiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string name_ = name;
|
||||||
|
if (name_.starts_with("mp_"))
|
||||||
|
{
|
||||||
|
add_custom_level_load_zone(load, "common_mp", 0x40000);
|
||||||
|
}
|
||||||
|
|
||||||
if (is_builtin_map)
|
if (is_builtin_map)
|
||||||
{
|
{
|
||||||
const auto name_ = "h2_mod_patch_"s + name;
|
const auto name_ = "h2_mod_patch_"s + name;
|
||||||
@ -450,6 +456,18 @@ namespace fastfiles
|
|||||||
{
|
{
|
||||||
game::DB_LoadXAssets(info, zone_count, game::DB_LOAD_ASYNC);
|
game::DB_LoadXAssets(info, zone_count, game::DB_LOAD_ASYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void db_find_aipaths_stub(game::XAssetType type, const char* name, int allow_create_default)
|
||||||
|
{
|
||||||
|
if (game::DB_XAssetExists(type, name))
|
||||||
|
{
|
||||||
|
game::DB_FindXAssetHeader(type, name, allow_create_default);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console::warn("No aipaths found for this map\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exists(const std::string& zone)
|
bool exists(const std::string& zone)
|
||||||
@ -526,6 +544,11 @@ namespace fastfiles
|
|||||||
// Load assets from 2nd phase (common_specialops, addon map) with DB_LOAD_SYNC
|
// Load assets from 2nd phase (common_specialops, addon map) with DB_LOAD_SYNC
|
||||||
utils::hook::call(0x140414EA1, db_load_xassets_stub);
|
utils::hook::call(0x140414EA1, db_load_xassets_stub);
|
||||||
|
|
||||||
|
// Allow loading mp maps
|
||||||
|
utils::hook::set(0x140609630, 0xC300B0);
|
||||||
|
// Don't sys_error if aipaths are missing
|
||||||
|
utils::hook::call(0x140522299, db_find_aipaths_stub);
|
||||||
|
|
||||||
command::add("loadzone", [](const command::params& params)
|
command::add("loadzone", [](const command::params& params)
|
||||||
{
|
{
|
||||||
if (params.size() < 2)
|
if (params.size() < 2)
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
#include "scripting.hpp"
|
#include "scripting.hpp"
|
||||||
#include "gsc.hpp"
|
#include "gsc.hpp"
|
||||||
|
#include "console.hpp"
|
||||||
|
|
||||||
#include "game/scripting/event.hpp"
|
#include "game/scripting/event.hpp"
|
||||||
#include "game/scripting/functions.hpp"
|
#include "game/scripting/functions.hpp"
|
||||||
@ -274,6 +275,17 @@ namespace scripting
|
|||||||
|
|
||||||
scr_get_dvar_int_hook.invoke<void>();
|
scr_get_dvar_int_hook.invoke<void>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* get_spawn_point_stub()
|
||||||
|
{
|
||||||
|
const auto spawn_point = utils::hook::invoke<void*>(0x1404B1670);
|
||||||
|
if (spawn_point == nullptr)
|
||||||
|
{
|
||||||
|
console::warn("No spawnpoint found for this map, using (0, 0, 0)\n");
|
||||||
|
return &game::g_entities[0];
|
||||||
|
}
|
||||||
|
return spawn_point;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_token_single(unsigned int id)
|
std::string get_token_single(unsigned int id)
|
||||||
@ -324,6 +336,8 @@ namespace scripting
|
|||||||
|
|
||||||
scr_get_dvar_int_hook.create(0x1404F0730, scr_get_dvar_int_stub);
|
scr_get_dvar_int_hook.create(0x1404F0730, scr_get_dvar_int_stub);
|
||||||
|
|
||||||
|
utils::hook::call(0x1404B07D2, get_spawn_point_stub);
|
||||||
|
|
||||||
scheduler::loop([]()
|
scheduler::loop([]()
|
||||||
{
|
{
|
||||||
lua::engine::run_frame();
|
lua::engine::run_frame();
|
||||||
|
Loading…
Reference in New Issue
Block a user