| 767 | } |
| 768 | |
| 769 | static void Classic_ReadAbsoluteLocation(cc_uint8* data, EntityID id, cc_uint8 flags) { |
| 770 | struct LocationUpdate update; |
| 771 | int x, y, z; |
| 772 | cc_uint8 mode; |
| 773 | |
| 774 | if (IsSupported(extEntityPos_Ext)) { |
| 775 | x = (int)Stream_GetU32_BE(&data[0]); |
| 776 | y = (int)Stream_GetU32_BE(&data[4]); |
| 777 | z = (int)Stream_GetU32_BE(&data[8]); |
| 778 | data += 12; |
| 779 | } else { |
| 780 | x = (cc_int16)Stream_GetU16_BE(&data[0]); |
| 781 | y = (cc_int16)Stream_GetU16_BE(&data[2]); |
| 782 | z = (cc_int16)Stream_GetU16_BE(&data[4]); |
| 783 | data += 6; |
| 784 | } |
| 785 | |
| 786 | mode = flags & LU_POS_MODEMASK; |
| 787 | if (mode == LU_POS_ABSOLUTE_SMOOTH || mode == LU_POS_ABSOLUTE_INSTANT) { /* Only perform height shifts on absolute updates */ |
| 788 | y -= 51; /* Convert to feet position */ |
| 789 | /* The original classic client behaves strangely in that */ |
| 790 | /* Y+0 is sent back to the server for next client->server position update */ |
| 791 | /* Y+22 is sent back to the server for all subsequent position updates */ |
| 792 | /* so to simplify things, just always add 22 to Y*/ |
| 793 | if (id == ENTITIES_SELF_ID) y += 22; |
| 794 | } |
| 795 | |
| 796 | update.flags = flags; |
| 797 | update.pos.x = x/32.0f; |
| 798 | update.pos.y = y/32.0f; |
| 799 | update.pos.z = z/32.0f; |
| 800 | update.yaw = Math_Packed2Deg(*data++); |
| 801 | update.pitch = Math_Packed2Deg(*data++); |
| 802 | |
| 803 | if (id == ENTITIES_SELF_ID) classic_receivedFirstPos = true; |
| 804 | UpdateLocation(id, &update); |
| 805 | } |
| 806 | |
| 807 | #define Classic_HandshakeSize() (Game_Version.Protocol > PROTOCOL_0019 ? 131 : 130) |
| 808 | static void Classic_Reset(void) { |
no test coverage detected