mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat(zone): read the zone boundary lines of .luz files
Between the scenes and the terrain file's name a zone file has its boundary lines: a u8 count, then per line a normal, a point, the destination zone, the destination scene ID and a spawn location. The reader took that spot for a u8-length "zone path" string, which is the same bytes only when there are no boundaries; a zone with boundaries would have misread everything after it. The destination is one u32 in the client (LuzReader::ReadZoneBoundaryLines, 0x01018490 in 1.10.64: map ID in bits 0-15, instance ID in bits 16-31, clone 0), read here as two u16s into an LWOZONEID with clone 0. The boundaries are kept on ZoneFile::zoneBoundaries. No zone of the 1.10.64 client (or any other client on disk) has boundary lines, so what is read from them is unchanged. Check in game: every world loads and zone transfers (launch pads, rockets, portals) work as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,8 +31,9 @@ void ZoneFile::ReadHeader(std::istream& file) {
|
||||
ReadScene(file);
|
||||
}
|
||||
|
||||
ReadZoneBoundaries(file);
|
||||
|
||||
//Read generic zone info:
|
||||
BinaryIO::ReadString<uint8_t>(file, zonePath, BinaryIO::ReadType::String);
|
||||
BinaryIO::ReadString<uint8_t>(file, zoneRawPath, BinaryIO::ReadType::String);
|
||||
BinaryIO::ReadString<uint8_t>(file, zoneName, BinaryIO::ReadType::String);
|
||||
BinaryIO::ReadString<uint8_t>(file, zoneDesc, BinaryIO::ReadType::String);
|
||||
@@ -89,6 +90,26 @@ void ZoneFile::ReadScene(std::istream& file) {
|
||||
scenes.push_back(std::move(scene));
|
||||
}
|
||||
|
||||
void ZoneFile::ReadZoneBoundaries(std::istream& file) {
|
||||
uint8_t count = 0;
|
||||
BinaryIO::BinaryRead(file, count);
|
||||
zoneBoundaries.reserve(count);
|
||||
for (uint8_t i = 0; i < count; ++i) {
|
||||
ZoneBoundary boundary;
|
||||
BinaryIO::BinaryRead(file, boundary.normal);
|
||||
BinaryIO::BinaryRead(file, boundary.point);
|
||||
// The client reads one u32 of map ID (low 16 bits) and instance ID (high 16 bits)
|
||||
LWOMAPID mapID = 0;
|
||||
LWOINSTANCEID instanceID = 0;
|
||||
BinaryIO::BinaryRead(file, mapID);
|
||||
BinaryIO::BinaryRead(file, instanceID);
|
||||
boundary.destZoneID = LWOZONEID(mapID, instanceID, 0);
|
||||
BinaryIO::BinaryRead(file, boundary.destSceneID);
|
||||
BinaryIO::BinaryRead(file, boundary.spawnLocation);
|
||||
zoneBoundaries.push_back(boundary);
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneFile::ReadSceneTransition(std::istream& file) {
|
||||
SceneTransition sceneTrans;
|
||||
if (fileFormatVersion < FileFormatVersion::Auramar) {
|
||||
|
||||
Reference in New Issue
Block a user