Merge branch 'main' into npc-pathing

This commit is contained in:
Aaron Kimbre 2022-11-05 20:43:35 -05:00
commit 59ddeb095c
4 changed files with 12 additions and 21 deletions

View File

@ -67,6 +67,8 @@ bool AssetManager::HasFile(const char* name) {
auto fixedName = std::string(name); auto fixedName = std::string(name);
std::transform(fixedName.begin(), fixedName.end(), fixedName.begin(), [](uint8_t c) { return std::tolower(c); }); std::transform(fixedName.begin(), fixedName.end(), fixedName.begin(), [](uint8_t c) { return std::tolower(c); });
// Special case for unpacked client have BrickModels in upper case
if (this->m_AssetBundleType == eAssetBundleType::Unpacked) GeneralUtils::ReplaceInString(fixedName, "brickmodels", "BrickModels");
std::replace(fixedName.begin(), fixedName.end(), '\\', '/'); std::replace(fixedName.begin(), fixedName.end(), '\\', '/');
if (std::filesystem::exists(m_ResPath / fixedName)) return true; if (std::filesystem::exists(m_ResPath / fixedName)) return true;
@ -92,17 +94,19 @@ bool AssetManager::GetFile(const char* name, char** data, uint32_t* len) {
auto fixedName = std::string(name); auto fixedName = std::string(name);
std::transform(fixedName.begin(), fixedName.end(), fixedName.begin(), [](uint8_t c) { return std::tolower(c); }); std::transform(fixedName.begin(), fixedName.end(), fixedName.begin(), [](uint8_t c) { return std::tolower(c); });
std::replace(fixedName.begin(), fixedName.end(), '\\', '/'); // On the off chance someone has the wrong slashes, force forward slashes std::replace(fixedName.begin(), fixedName.end(), '\\', '/'); // On the off chance someone has the wrong slashes, force forward slashes
auto realPathName = fixedName;
if (std::filesystem::exists(m_ResPath / realPathName)) { // Special case for unpacked client have BrickModels in upper case
if (this->m_AssetBundleType == eAssetBundleType::Unpacked) GeneralUtils::ReplaceInString(fixedName, "brickmodels", "BrickModels");
if (std::filesystem::exists(m_ResPath / fixedName)) {
FILE* file; FILE* file;
#ifdef _WIN32 #ifdef _WIN32
fopen_s(&file, (m_ResPath / realPathName).string().c_str(), "rb"); fopen_s(&file, (m_ResPath / fixedName).string().c_str(), "rb");
#elif __APPLE__ #elif __APPLE__
// macOS has 64bit file IO by default // macOS has 64bit file IO by default
file = fopen((m_ResPath / realPathName).string().c_str(), "rb"); file = fopen((m_ResPath / fixedName).string().c_str(), "rb");
#else #else
file = fopen64((m_ResPath / realPathName).string().c_str(), "rb"); file = fopen64((m_ResPath / fixedName).string().c_str(), "rb");
#endif #endif
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
*len = ftell(file); *len = ftell(file);

View File

@ -47,6 +47,7 @@ bool CharacterComponent::LandingAnimDisabled(int zoneID) {
case 1202: case 1202:
case 1203: case 1203:
case 1204: case 1204:
case 1261:
case 1301: case 1301:
case 1302: case 1302:
case 1303: case 1303:

View File

@ -194,21 +194,7 @@ void PetComponent::OnUse(Entity* originator) {
return; return;
} }
auto lxfAsset = std::string(result.getStringField(0)); buildFile = std::string(result.getStringField(0));
std::vector<std::string> lxfAssetSplit = GeneralUtils::SplitString(lxfAsset, '\\');
lxfAssetSplit.erase(lxfAssetSplit.begin());
buildFile = "res/BrickModels";
for (auto part : lxfAssetSplit) {
std::transform(part.begin(), part.end(), part.begin(), [](unsigned char c) {
return std::tolower(c);
});
buildFile += "/" + part;
}
PetPuzzleData data; PetPuzzleData data;
data.buildFile = buildFile; data.buildFile = buildFile;

View File

@ -18,7 +18,7 @@ std::vector<Brick>& BrickDatabase::GetBricks(const std::string& lxfmlPath) {
return cached->second; return cached->second;
} }
AssetMemoryBuffer buffer = Game::assetManager->GetFileAsBuffer(("client/" + lxfmlPath).c_str()); AssetMemoryBuffer buffer = Game::assetManager->GetFileAsBuffer((lxfmlPath).c_str());
std::istream file(&buffer); std::istream file(&buffer);
if (!file.good()) { if (!file.good()) {
return emptyCache; return emptyCache;