mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-11 23:33:50 +00:00
fix(wire): PlaceModelResponse writes the model's rotation
The client's PlaceModelResponse::Deserialize (0x00dc0170) reads the rotation as an optional w, x, y, z quaternion, but DLU wrote the 4-byte response after the rotation flag. With any rotation other than identity the client ran out of data. A live capture of a model turned 90 degrees shows the server echoing the rotation the client placed it with. Bytes only change when the rotation is not identity; a golden test pins the new layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -298,9 +298,7 @@ namespace GameMessages {
|
||||
BitStreamUtils::WriteOptional(bitStream, position, NiPoint3Constant::ZERO);
|
||||
BitStreamUtils::WriteOptional(bitStream, propertyPlaqueID, LWOOBJID_EMPTY);
|
||||
BitStreamUtils::WriteOptional(bitStream, response, 0);
|
||||
// WIRE BUG (kept, see the struct): the value written after rotation's flag is response, not rotation.
|
||||
bitStream.Write(rotation != QuatUtils::IDENTITY);
|
||||
if (rotation != QuatUtils::IDENTITY) bitStream.Write(response);
|
||||
BitStreamUtils::WriteOptional(bitStream, rotation, QuatUtils::IDENTITY);
|
||||
}
|
||||
|
||||
bool PlaceModelResponse::Deserialize(RakNet::BitStream& bitStream) {
|
||||
|
||||
@@ -134,10 +134,9 @@ namespace GameMessages {
|
||||
std::vector<std::pair<LWOOBJID, LWOOBJID>> models{}; // u32 count, then both IDs of each pair
|
||||
};
|
||||
|
||||
// Server -> client.
|
||||
// WIRE BUG (kept): DLU writes rotation's flag, but then writes response (4 bytes) instead of the quaternion
|
||||
// (16 bytes) that the client's PlaceModelResponse::Deserialize (0x00dc0170) reads. Deserialize reads the
|
||||
// client's layout, so a message with a non-identity rotation does not round trip.
|
||||
// Server -> client. Laid out as the client's PlaceModelResponse::Deserialize (0x00dc0170) reads it: every field is
|
||||
// optional and the rotation is a w, x, y, z quaternion. response is 14 when a model was placed and 16 when one was
|
||||
// taken off the property (picked up or put away).
|
||||
struct PlaceModelResponse : public NetGameMsg {
|
||||
PlaceModelResponse() : NetGameMsg(MessageType::Game::PLACE_MODEL_RESPONSE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
|
||||
Reference in New Issue
Block a user