emmo help

This commit is contained in:
Aaron Kimbre 2024-11-23 02:00:55 -06:00
parent 53877a0bc3
commit c146b0eb4e
3 changed files with 41 additions and 23 deletions

View File

@ -75,7 +75,7 @@ if(UNIX)
endif() endif()
if(${DYNAMIC} AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(${DYNAMIC} AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options("-rdynamic") add_link_options("-export-dynamic")
endif() endif()
if(${GGDB}) if(${GGDB})

View File

@ -131,12 +131,17 @@ void Level::ReadChunks(std::istream& file) {
if (initPos == std::streamoff(0)) { //Really old chunk version if (initPos == std::streamoff(0)) { //Really old chunk version
file.seekg(0); file.seekg(0);
Header header; Header header;
header.id = ChunkTypeID::FileInfo; //I guess? header.id = ChunkTypeID::FileInfo;
BinaryIO::BinaryRead(file, header.chunkVersion); BinaryIO::BinaryRead(file, header.chunkVersion);
BinaryIO::BinaryRead(file, header.chunkType); BinaryIO::BinaryRead(file, header.chunkType);
file.ignore(1); uint8_t important = 0;
BinaryIO::BinaryRead(file, header.fileInfo.revision); BinaryIO::BinaryRead(file, important);
// file.ignore(1); //probably used
if (header.chunkVersion > 36) {
LOG("DOING THINGS");
BinaryIO::BinaryRead(file, header.fileInfo.revision);
}
// HARDCODED 3
if (header.chunkVersion >= 45) file.ignore(4); if (header.chunkVersion >= 45) file.ignore(4);
file.ignore(4 * (4 * 3)); file.ignore(4 * (4 * 3));
@ -170,25 +175,31 @@ void Level::ReadChunks(std::istream& file) {
} }
} }
for (uint32_t i = 0; i < 6; ++i) { // skydome info
uint32_t count = 0;
BinaryIO::BinaryRead(file, count);
file.ignore(count);
}
file.ignore(4);
uint32_t count = 0; uint32_t count = 0;
BinaryIO::BinaryRead(file, count); BinaryIO::BinaryRead(file, count);
file.ignore(count * 12); file.ignore(count);
if (header.chunkVersion >= 33) {
for (uint32_t i = 0; i < 5; ++i) {
uint32_t count = 0;
BinaryIO::BinaryRead(file, count);
file.ignore(count);
}
}
// editor settings
if (!important && header.chunkVersion >= 37){
file.ignore(4);
uint32_t count = 0;
BinaryIO::BinaryRead(file, count);
file.ignore(count * 12);
}
header.id = ChunkTypeID::SceneObjectData;
ReadSceneObjectDataChunk(file, header);
m_ChunkHeaders.insert(std::make_pair(header.id, header)); m_ChunkHeaders.insert(std::make_pair(header.id, header));
//Now pretend to be a normal file and read Objects chunk:
Header hdr;
hdr.id = ChunkTypeID::SceneObjectData;
ReadSceneObjectDataChunk(file, hdr);
m_ChunkHeaders.insert(std::make_pair(hdr.id, hdr));
} break; } break;
} }
} }
@ -223,9 +234,15 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) {
SceneObject obj; SceneObject obj;
BinaryIO::BinaryRead(file, obj.id); BinaryIO::BinaryRead(file, obj.id);
BinaryIO::BinaryRead(file, obj.lot); BinaryIO::BinaryRead(file, obj.lot);
LOG("HEADER VERSION: %i", header.chunkVersion );
/*if (header.fileInfo->version >= 0x26)*/ BinaryIO::BinaryRead(file, obj.nodeType); if (header.chunkVersion >= 38) {
/*if (header.fileInfo->version >= 0x20)*/ BinaryIO::BinaryRead(file, obj.glomId); uint32_t tmp = 1;
BinaryIO::BinaryRead(file, tmp);
if (tmp > -1 && tmp < 11) obj.nodeType = tmp;
}
if (header.chunkVersion >= 32) {
BinaryIO::BinaryRead(file, obj.glomId);
}
BinaryIO::BinaryRead(file, obj.position); BinaryIO::BinaryRead(file, obj.position);
BinaryIO::BinaryRead(file, obj.rotation); BinaryIO::BinaryRead(file, obj.rotation);

View File

@ -160,6 +160,7 @@ std::string Zone::GetFilePathForZoneID() {
if (zone != nullptr) { if (zone != nullptr) {
std::string toReturn = "maps/" + zone->zoneName; std::string toReturn = "maps/" + zone->zoneName;
std::transform(toReturn.begin(), toReturn.end(), toReturn.begin(), ::tolower); std::transform(toReturn.begin(), toReturn.end(), toReturn.begin(), ::tolower);
std::ranges::replace(toReturn, '\\', '/');
return toReturn; return toReturn;
} }