Shipment patches
This commit is contained in:
parent
7ad37f3da5
commit
c9e26c05af
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 900bbe724ab87c863050a90a5b5b20d69b5c09d9
|
Subproject commit a3e2a41834a6b9d8cdd5b6f993cb31d5ea81694d
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
std::string Maps::CurrentMainZone;
|
||||||
std::vector<std::pair<std::string, std::string>> Maps::DependencyList;
|
std::vector<std::pair<std::string, std::string>> Maps::DependencyList;
|
||||||
std::vector<std::string> Maps::CurrentDependencies;
|
std::vector<std::string> Maps::CurrentDependencies;
|
||||||
|
|
||||||
@ -11,6 +12,8 @@ namespace Components
|
|||||||
{
|
{
|
||||||
if (!zoneInfo) return;
|
if (!zoneInfo) return;
|
||||||
|
|
||||||
|
Maps::CurrentMainZone = zoneInfo->name;
|
||||||
|
|
||||||
Maps::CurrentDependencies.clear();
|
Maps::CurrentDependencies.clear();
|
||||||
for (auto i = Maps::DependencyList.begin(); i != Maps::DependencyList.end(); ++i)
|
for (auto i = Maps::DependencyList.begin(); i != Maps::DependencyList.end(); ++i)
|
||||||
{
|
{
|
||||||
@ -69,7 +72,8 @@ namespace Components
|
|||||||
|
|
||||||
void Maps::LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict)
|
void Maps::LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict)
|
||||||
{
|
{
|
||||||
if (std::find(Maps::CurrentDependencies.begin(), Maps::CurrentDependencies.end(), FastFiles::Current()) != Maps::CurrentDependencies.end())
|
if (std::find(Maps::CurrentDependencies.begin(), Maps::CurrentDependencies.end(), FastFiles::Current()) != Maps::CurrentDependencies.end()
|
||||||
|
&& (FastFiles::Current() != "mp_shipment_long" || Maps::CurrentMainZone != "mp_shipment")) // Shipment is a special case
|
||||||
{
|
{
|
||||||
if (type == Game::XAssetType::ASSET_TYPE_GAME_MAP_MP || type == Game::XAssetType::ASSET_TYPE_COL_MAP_MP || type == Game::XAssetType::ASSET_TYPE_GFX_MAP || type == Game::XAssetType::ASSET_TYPE_MAP_ENTS || type == Game::XAssetType::ASSET_TYPE_COM_MAP || type == Game::XAssetType::ASSET_TYPE_FX_MAP)
|
if (type == Game::XAssetType::ASSET_TYPE_GAME_MAP_MP || type == Game::XAssetType::ASSET_TYPE_COL_MAP_MP || type == Game::XAssetType::ASSET_TYPE_GFX_MAP || type == Game::XAssetType::ASSET_TYPE_MAP_ENTS || type == Game::XAssetType::ASSET_TYPE_COM_MAP || type == Game::XAssetType::ASSET_TYPE_FX_MAP)
|
||||||
{
|
{
|
||||||
@ -137,6 +141,12 @@ namespace Components
|
|||||||
format = "maps/%s.d3dbsp";
|
format = "maps/%s.d3dbsp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Redirect shipment to shipment long
|
||||||
|
if (mapname == "mp_shipment"s)
|
||||||
|
{
|
||||||
|
mapname = "mp_shipment_long";
|
||||||
|
}
|
||||||
|
|
||||||
bool handleAsSp = false;
|
bool handleAsSp = false;
|
||||||
|
|
||||||
for (auto dependency : Maps::DependencyList)
|
for (auto dependency : Maps::DependencyList)
|
||||||
@ -185,35 +195,6 @@ namespace Components
|
|||||||
return (Utils::String::StartsWith(entity, "dyn_") || Utils::String::StartsWith(entity, "node_") || Utils::String::StartsWith(entity, "actor_"));
|
return (Utils::String::StartsWith(entity, "dyn_") || Utils::String::StartsWith(entity, "node_") || Utils::String::StartsWith(entity, "actor_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Maps::PatchMapLoad(const char** mapnamePtr)
|
|
||||||
{
|
|
||||||
if (!strcmp(*mapnamePtr, "mp_shipment"))
|
|
||||||
{
|
|
||||||
*mapnamePtr = "mp_shipment_long";
|
|
||||||
Dvar::Var("sv_shortmap").SetRaw(1);
|
|
||||||
}
|
|
||||||
else if (!strcmp(*mapnamePtr, "mp_shipment_long"))
|
|
||||||
{
|
|
||||||
Dvar::Var("sv_shortmap").SetRaw(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__declspec(naked) void Maps::MapLoadStub()
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
lea eax, [esp + 4h]
|
|
||||||
push eax
|
|
||||||
call Maps::PatchMapLoad
|
|
||||||
add esp, 4h
|
|
||||||
|
|
||||||
sub esp, 84h
|
|
||||||
|
|
||||||
push 6244B6h
|
|
||||||
retn
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
||||||
// Credit to SE2Dev, as we shouldn't share the code, keep that in debug mode!
|
// Credit to SE2Dev, as we shouldn't share the code, keep that in debug mode!
|
||||||
void Maps::ExportMap(Game::GfxWorld* world)
|
void Maps::ExportMap(Game::GfxWorld* world)
|
||||||
@ -392,8 +373,6 @@ namespace Components
|
|||||||
|
|
||||||
Maps::Maps()
|
Maps::Maps()
|
||||||
{
|
{
|
||||||
Dvar::Register<bool>("sv_shortmap", false, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED, "");
|
|
||||||
|
|
||||||
// Restrict asset loading
|
// Restrict asset loading
|
||||||
AssetHandler::OnLoad(Maps::LoadAssetRestrict);
|
AssetHandler::OnLoad(Maps::LoadAssetRestrict);
|
||||||
|
|
||||||
@ -410,9 +389,6 @@ namespace Components
|
|||||||
// Ignore SP entities
|
// Ignore SP entities
|
||||||
Utils::Hook(0x444810, Maps::IgnoreEntityStub, HOOK_JUMP).Install()->Quick();
|
Utils::Hook(0x444810, Maps::IgnoreEntityStub, HOOK_JUMP).Install()->Quick();
|
||||||
|
|
||||||
// Shipment patches
|
|
||||||
Utils::Hook(0x6244B0, Maps::MapLoadStub, HOOK_JUMP).Install()->Quick();
|
|
||||||
|
|
||||||
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_GAME_MAP_SP, 1);
|
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_GAME_MAP_SP, 1);
|
||||||
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_IMAGE, 7168);
|
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_IMAGE, 7168);
|
||||||
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, 2700);
|
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, 2700);
|
||||||
@ -452,6 +428,9 @@ namespace Components
|
|||||||
Maps::AddDependency("mp_rust_long", "iw4x_dependencies_mp");
|
Maps::AddDependency("mp_rust_long", "iw4x_dependencies_mp");
|
||||||
Maps::AddDependency("mp_ambush_sh", "iw4x_dependencies_mp");
|
Maps::AddDependency("mp_ambush_sh", "iw4x_dependencies_mp");
|
||||||
|
|
||||||
|
Maps::AddDependency("mp_shipment", "mp_shipment_long");
|
||||||
|
Maps::AddDependency("mp_shipment", "iw4x_dependencies_mp");
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
||||||
Command::Add("dumpmap", [] (Command::Params)
|
Command::Add("dumpmap", [] (Command::Params)
|
||||||
{
|
{
|
||||||
@ -482,6 +461,10 @@ namespace Components
|
|||||||
|
|
||||||
Maps::~Maps()
|
Maps::~Maps()
|
||||||
{
|
{
|
||||||
|
Maps::DependencyList.clear();
|
||||||
|
Maps::CurrentMainZone.clear();
|
||||||
|
Maps::CurrentDependencies.clear();
|
||||||
|
|
||||||
Maps::EntryPool.clear();
|
Maps::EntryPool.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ namespace Components
|
|||||||
private:
|
private:
|
||||||
static std::vector<Game::XAssetEntry> EntryPool;
|
static std::vector<Game::XAssetEntry> EntryPool;
|
||||||
|
|
||||||
|
static std::string CurrentMainZone;
|
||||||
static std::vector<std::pair<std::string, std::string>> DependencyList;
|
static std::vector<std::pair<std::string, std::string>> DependencyList;
|
||||||
static std::vector<std::string> CurrentDependencies;
|
static std::vector<std::string> CurrentDependencies;
|
||||||
|
|
||||||
@ -26,9 +27,6 @@ namespace Components
|
|||||||
|
|
||||||
static int IgnoreEntityStub(const char* entity);
|
static int IgnoreEntityStub(const char* entity);
|
||||||
|
|
||||||
static void PatchMapLoad(const char** mapnamePtr);
|
|
||||||
static void MapLoadStub();
|
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
||||||
static void ExportMap(Game::GfxWorld* world);
|
static void ExportMap(Game::GfxWorld* world);
|
||||||
#endif
|
#endif
|
||||||
|
@ -325,12 +325,6 @@ namespace Components
|
|||||||
info.Set("mapname", Dvar::Var("ui_mapname").Get<const char*>());
|
info.Set("mapname", Dvar::Var("ui_mapname").Get<const char*>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shipment patches
|
|
||||||
if (info.Get("mapname") == "mp_shipment_long" && Dvar::Var("sv_shortmap").Get<bool>())
|
|
||||||
{
|
|
||||||
info.Set("mapname", "mp_shipment");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set matchtype
|
// Set matchtype
|
||||||
// 0 - No match, connecting not possible
|
// 0 - No match, connecting not possible
|
||||||
// 1 - Party, use Steam_JoinLobby to connect
|
// 1 - Party, use Steam_JoinLobby to connect
|
||||||
|
@ -130,12 +130,6 @@ namespace Components
|
|||||||
info.Set("mapname", Dvar::Var("ui_mapname").Get<const char*>());
|
info.Set("mapname", Dvar::Var("ui_mapname").Get<const char*>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shipment patches
|
|
||||||
if (info.Get("mapname") == "mp_shipment_long" && Dvar::Var("sv_shortmap").Get<bool>())
|
|
||||||
{
|
|
||||||
info.Set("mapname", "mp_shipment");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set matchtype
|
// Set matchtype
|
||||||
// 0 - No match, connecting not possible
|
// 0 - No match, connecting not possible
|
||||||
// 1 - Party, use Steam_JoinLobby to connect
|
// 1 - Party, use Steam_JoinLobby to connect
|
||||||
|
Loading…
Reference in New Issue
Block a user