From 701cfb98215b6acc8224eb5f3215822dce6dace6 Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Thu, 9 Aug 2007 03:49:34 +0000 Subject: [PATCH] use real time instead of frame time for position updates, make sure sign is extended to 32 bits --- direct/src/distributed/cDistributedSmoothNodeBase.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/direct/src/distributed/cDistributedSmoothNodeBase.cxx b/direct/src/distributed/cDistributedSmoothNodeBase.cxx index d6f1529d51..90976ed0b3 100644 --- a/direct/src/distributed/cDistributedSmoothNodeBase.cxx +++ b/direct/src/distributed/cDistributedSmoothNodeBase.cxx @@ -319,9 +319,12 @@ finish_send_update(DCPacker &packer) { static const double delta = 0.0f; #endif // HAVE_PYTHON - double local_time = ClockObject::get_global_clock()->get_frame_time(); + double local_time = ClockObject::get_global_clock()->get_real_time(); - short network_time = (short)(int)cfloor(((local_time - delta) * network_time_precision) + 0.5); + int network_time = (int)cfloor(((local_time - delta) * network_time_precision) + 0.5); + // Preserves the lower NetworkTimeBits of the networkTime value, + // and extends the sign bit all the way up. + network_time = ((network_time + 0x8000) & 0xFFFF) - 0x8000; packer.pack_int(network_time); packer.pop();