02-05-2014, 03:00 AM
(This post was last modified: 02-05-2014, 06:11 AM by daniel0916.)
When i decode x, y, z and then encode that. The x, y, z aren't the same.
LOG:
Edit: Maybe the encode value from the client is not the same like my encode value. I will try it.
void WritePosition(int x, int y, int z) { long encoded_x = (x & 0x3FFFFFF) << 38; long encoded_y = (y & 0xFFF) << 26; long encoded_z = (z & 0x3FFFFFF); long value = encoded_x | encoded_y | encoded_z; LOGWARN(std::to_string(x).c_str()); LOGWARN(std::to_string(y).c_str()); LOGWARN(std::to_string(z).c_str()); LOGWARN(std::to_string(encoded_x).c_str()); LOGWARN(std::to_string(encoded_y).c_str()); LOGWARN(std::to_string(encoded_z).c_str()); LOGWARN(std::to_string(value).c_str()); long x2 = value >> 38; long y2 = value << 26 >> 52; long z2 = value << 38 >> 38; LOGWARN(std::to_string(x2).c_str()); LOGWARN(std::to_string(y2).c_str()); LOGWARN(std::to_string(z2).c_str()); m_Out.WriteBEInt64(value); }
LOGWARN("Spawn Position"); cPacketizer Pkt(*this, 0x05); // Spawn Position packet Pkt.WritePosition(100, 100, 80);
LOG:
Code:
[2a8c|18:01:09] Spawn Position
[2a8c|18:01:09] 100
[2a8c|18:01:09] 100
[2a8c|18:01:09] 80
[2a8c|18:01:09] 6400
[2a8c|18:01:09] -1879048192
[2a8c|18:01:09] 80
[2a8c|18:01:09] -1879041712
[2a8c|18:01:09] -29360027
[2a8c|18:01:09] 1024
[2a8c|18:01:09] 6480
Edit: Maybe the encode value from the client is not the same like my encode value. I will try it.