Load team zones.
This commit is contained in:
parent
0c419b9907
commit
7aba6250f6
@ -68,22 +68,21 @@ namespace Components
|
|||||||
Utils::Hook::Set<Game::newMapArena_t*>(0x630B2E, &ArenaLength::NewArenas[0]);
|
Utils::Hook::Set<Game::newMapArena_t*>(0x630B2E, &ArenaLength::NewArenas[0]);
|
||||||
Utils::Hook::Set<Game::newMapArena_t*>(0x632782, &ArenaLength::NewArenas[0]);
|
Utils::Hook::Set<Game::newMapArena_t*>(0x632782, &ArenaLength::NewArenas[0]);
|
||||||
|
|
||||||
Utils::Hook::Set<char*>(0x4A967A, &ArenaLength::NewArenas[0].other[0]);
|
Utils::Hook::Set<char*>(0x4A967A, ArenaLength::NewArenas[0].description);
|
||||||
|
Utils::Hook::Set<char*>(0x4A96AD, ArenaLength::NewArenas[0].mapimage);
|
||||||
Utils::Hook::Set<char*>(0x4A96AD, &ArenaLength::NewArenas[0].other[0x20]);
|
|
||||||
|
|
||||||
Utils::Hook::Set<char*>(0x42F214, &ArenaLength::NewArenas[0].other[0xA40]);
|
|
||||||
|
|
||||||
Utils::Hook::Set<char*>(0x4A96ED, &ArenaLength::NewArenas[0].other[0xA48]);
|
|
||||||
Utils::Hook::Set<char*>(0x4A9769, &ArenaLength::NewArenas[0].other[0xA48]);
|
|
||||||
Utils::Hook::Set<char*>(0x4A97A5, &ArenaLength::NewArenas[0].other[0xA48]);
|
|
||||||
|
|
||||||
Utils::Hook::Set<char*>(0x631E92, &ArenaLength::NewArenas[0].other[0xACC]);
|
|
||||||
|
|
||||||
Utils::Hook::Set<char*>(0x4A9616, ArenaLength::NewArenas[0].mapName);
|
Utils::Hook::Set<char*>(0x4A9616, ArenaLength::NewArenas[0].mapName);
|
||||||
Utils::Hook::Set<char*>(0x4A9703, ArenaLength::NewArenas[0].mapName);
|
Utils::Hook::Set<char*>(0x4A9703, ArenaLength::NewArenas[0].mapName);
|
||||||
Utils::Hook::Set<char*>(0x4064A8, ArenaLength::NewArenas[0].mapName);
|
Utils::Hook::Set<char*>(0x4064A8, ArenaLength::NewArenas[0].mapName);
|
||||||
|
|
||||||
|
Utils::Hook::Set<char*>(0x42F214, &ArenaLength::NewArenas[0].other[0]);
|
||||||
|
|
||||||
|
Utils::Hook::Set<char*>(0x4A96ED, &ArenaLength::NewArenas[0].other[0x8]);
|
||||||
|
Utils::Hook::Set<char*>(0x4A9769, &ArenaLength::NewArenas[0].other[0x8]);
|
||||||
|
Utils::Hook::Set<char*>(0x4A97A5, &ArenaLength::NewArenas[0].other[0x8]);
|
||||||
|
|
||||||
|
Utils::Hook::Set<char*>(0x631E92, &ArenaLength::NewArenas[0].other[0x8C]);
|
||||||
|
|
||||||
// Resize the array
|
// Resize the array
|
||||||
Utils::Hook::Set<int>(0x4064DE, sizeof(Game::newMapArena_t));
|
Utils::Hook::Set<int>(0x4064DE, sizeof(Game::newMapArena_t));
|
||||||
Utils::Hook::Set<int>(0x417802, sizeof(Game::newMapArena_t));
|
Utils::Hook::Set<int>(0x417802, sizeof(Game::newMapArena_t));
|
||||||
@ -112,6 +111,6 @@ namespace Components
|
|||||||
|
|
||||||
Utils::Hook::Set<BYTE>(0x4A95F8, 32);
|
Utils::Hook::Set<BYTE>(0x4A95F8, 32);
|
||||||
|
|
||||||
Utils::Hook::Set<int>(0x42F22B, offsetof(Game::newMapArena_t, mapName) - offsetof(Game::newMapArena_t, other[0xA40]));
|
Utils::Hook::Set<int>(0x42F22B, offsetof(Game::newMapArena_t, mapName) - offsetof(Game::newMapArena_t, other));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,22 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils::Memory::Allocator allocator;
|
||||||
|
auto teams = Maps::GetTeamsForMap(Maps::CurrentMainZone);
|
||||||
|
|
||||||
std::vector<Game::XZoneInfo> data;
|
std::vector<Game::XZoneInfo> data;
|
||||||
Utils::Merge(&data, zoneInfo, zoneCount);
|
Utils::Merge(&data, zoneInfo, zoneCount);
|
||||||
|
|
||||||
|
Game::XZoneInfo team;
|
||||||
|
team.allocFlags = zoneInfo->allocFlags;
|
||||||
|
team.freeFlags = zoneInfo->freeFlags;
|
||||||
|
|
||||||
|
team.name = allocator.DuplicateString(fmt::sprintf("iw4x_team_%s", teams.first.data()));
|
||||||
|
data.push_back(team);
|
||||||
|
|
||||||
|
team.name = allocator.DuplicateString(fmt::sprintf("iw4x_team_%s", teams.second.data()));
|
||||||
|
data.push_back(team);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < Maps::CurrentDependencies.size(); ++i)
|
for (unsigned int i = 0; i < Maps::CurrentDependencies.size(); ++i)
|
||||||
{
|
{
|
||||||
Game::XZoneInfo info;
|
Game::XZoneInfo info;
|
||||||
@ -198,6 +211,35 @@ 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_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::pair<std::string, std::string> Maps::GetTeamsForMap(std::string map)
|
||||||
|
{
|
||||||
|
std::string team_axis = "opforce_composite";
|
||||||
|
std::string team_allies = "us_army";
|
||||||
|
|
||||||
|
for (int i = 0; i < *Game::arenaCount; ++i)
|
||||||
|
{
|
||||||
|
Game::newMapArena_t* arena = &ArenaLength::NewArenas[i];
|
||||||
|
if (arena->mapName == map)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < ARRAY_SIZE(arena->keys); ++j)
|
||||||
|
{
|
||||||
|
if (arena->keys[j] == "allieschar"s)
|
||||||
|
{
|
||||||
|
team_allies = arena->values[j];
|
||||||
|
}
|
||||||
|
else if (arena->keys[j] == "axischar"s)
|
||||||
|
{
|
||||||
|
team_axis = arena->values[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { team_axis, team_allies };
|
||||||
|
}
|
||||||
|
|
||||||
#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)
|
||||||
|
@ -13,6 +13,8 @@ namespace Components
|
|||||||
static void HandleAsSPMap() { IsSPMap = true; }
|
static void HandleAsSPMap() { IsSPMap = true; }
|
||||||
static void AddDependency(std::string expression, std::string zone);
|
static void AddDependency(std::string expression, std::string zone);
|
||||||
|
|
||||||
|
static std::pair<std::string, std::string> GetTeamsForMap(std::string map);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class DLC
|
class DLC
|
||||||
{
|
{
|
||||||
|
@ -3009,14 +3009,22 @@ namespace Game
|
|||||||
{
|
{
|
||||||
char uiName[32];
|
char uiName[32];
|
||||||
char mapName[16];
|
char mapName[16];
|
||||||
char pad[2768];
|
char description[32];
|
||||||
|
char mapimage[32];
|
||||||
|
char keys[32][16];
|
||||||
|
char values[32][64];
|
||||||
|
char pad[144];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct newMapArena_t
|
struct newMapArena_t
|
||||||
{
|
{
|
||||||
char uiName[32];
|
char uiName[32];
|
||||||
char oldMapName[16];
|
char oldMapName[16];
|
||||||
char other[2768];
|
char description[32];
|
||||||
|
char mapimage[32];
|
||||||
|
char keys[32][16];
|
||||||
|
char values[32][64];
|
||||||
|
char other[144];
|
||||||
char mapName[32];
|
char mapName[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user