Check if zone is loaded.
This commit is contained in:
parent
69bdda10f2
commit
dcd46633ca
@ -60,15 +60,14 @@ namespace Components
|
||||
void ZoneBuilder::Zone::LoadFastFiles()
|
||||
{
|
||||
Logger::Print("Loading required FastFiles...\n");
|
||||
|
||||
for (int i = 0; i < DataMap.GetRows(); ++i)
|
||||
{
|
||||
if (DataMap.GetElementAt(i, 0) == "require")
|
||||
{
|
||||
std::string fastfile = DataMap.GetElementAt(i, 1);
|
||||
|
||||
//Logger::Print("Loading '%s'...\n", fastfile.c_str());
|
||||
|
||||
//if (!DB_IsZoneLoaded(fastfile.c_str()))
|
||||
if (!Game::DB_IsZoneLoaded(fastfile.c_str()))
|
||||
{
|
||||
Game::XZoneInfo info;
|
||||
info.name = fastfile.data();
|
||||
@ -76,13 +75,11 @@ namespace Components
|
||||
info.freeFlags = 0;
|
||||
|
||||
Game::DB_LoadXAssets(&info, 1, true);
|
||||
|
||||
//LoadFastFile(fastfile.c_str(), true);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// Logger::Print("Zone '%s' already loaded\n", fastfile.c_str());
|
||||
// }
|
||||
else
|
||||
{
|
||||
Logger::Print("Zone '%s' already loaded\n", fastfile.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -264,6 +264,25 @@ namespace Game
|
||||
return ASSET_TYPE_INVALID;
|
||||
}
|
||||
|
||||
bool DB_IsZoneLoaded(const char* zone)
|
||||
{
|
||||
int zoneCount = Utils::Hook::Get<int>(0x1261BCC);
|
||||
char* zoneIndices = reinterpret_cast<char*>(0x16B8A34);
|
||||
char* zoneData = reinterpret_cast<char*>(0x14C0F80);
|
||||
|
||||
for (int i = 0; i < zoneCount; i++)
|
||||
{
|
||||
std::string name = zoneData + 4 + 0xA4 * (zoneIndices[i] & 0xFF);
|
||||
|
||||
if (name == zone)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MessageBox(std::string message, std::string title)
|
||||
{
|
||||
SetConsole("com_errorMessage", message.data());
|
||||
|
@ -362,6 +362,7 @@ namespace Game
|
||||
|
||||
const char *DB_GetXAssetName(XAsset *asset);
|
||||
XAssetType DB_GetXAssetNameType(const char* name);
|
||||
bool DB_IsZoneLoaded(const char* zone);
|
||||
|
||||
void MessageBox(std::string message, std::string title);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user