mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Parse SMSG_GAMETIME_SET/UPDATE/GAMESPEED_SET for sky clock accuracy
Server sends periodic game time corrections via SMSG_GAMETIME_SET and SMSG_GAMETIME_UPDATE (uint32 gameTimePacked). SMSG_GAMESPEED_SET also sends an updated timeSpeed float. Applying these keeps gameTime_/timeSpeed_ in sync with the server, preventing day/night drift in the sky renderer over long play sessions.
This commit is contained in:
parent
6583ce9c57
commit
4ac32a1206
1 changed files with 20 additions and 2 deletions
|
|
@ -2044,9 +2044,27 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
}
|
||||
case Opcode::SMSG_GAMETIME_SET:
|
||||
case Opcode::SMSG_GAMETIME_UPDATE:
|
||||
case Opcode::SMSG_GAMETIMEBIAS_SET:
|
||||
// Server time correction: uint32 gameTimePacked (seconds since epoch)
|
||||
if (packet.getSize() - packet.getReadPos() >= 4) {
|
||||
uint32_t gameTimePacked = packet.readUInt32();
|
||||
gameTime_ = static_cast<float>(gameTimePacked);
|
||||
LOG_DEBUG("Server game time update: ", gameTime_, "s");
|
||||
}
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
case Opcode::SMSG_GAMESPEED_SET:
|
||||
// Server-side time/speed synchronization — consume without processing
|
||||
// Server speed correction: uint32 gameTimePacked + float timeSpeed
|
||||
if (packet.getSize() - packet.getReadPos() >= 8) {
|
||||
uint32_t gameTimePacked = packet.readUInt32();
|
||||
float timeSpeed = packet.readFloat();
|
||||
gameTime_ = static_cast<float>(gameTimePacked);
|
||||
timeSpeed_ = timeSpeed;
|
||||
LOG_DEBUG("Server game speed update: time=", gameTime_, " speed=", timeSpeed_);
|
||||
}
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
case Opcode::SMSG_GAMETIMEBIAS_SET:
|
||||
// Time bias — consume without processing
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
case Opcode::SMSG_ACHIEVEMENT_DELETED:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue