- if (cl.protocol == PROTOCOL_DARKPLACES2 || cl.protocol == PROTOCOL_DARKPLACES3 || cl.protocol == PROTOCOL_DARKPLACES4 || cl.protocol == PROTOCOL_DARKPLACES5)
- return (signed short) MSG_ReadLittleShort();
- else if (cl.protocol == PROTOCOL_DARKPLACES1)
- return MSG_ReadLittleFloat();
- else
- return MSG_ReadLittleShort() * (1.0f/8.0f);
+ return MSG_ReadLittleShort() * (1.0/8.0);
+}
+
+float MSG_ReadCoord16i (void)
+{
+ return (signed short) MSG_ReadLittleShort();
+}
+
+float MSG_ReadCoord32f (void)
+{
+ return MSG_ReadLittleFloat();
+}
+
+float MSG_ReadCoord (int protocol)
+{
+ if (protocol == PROTOCOL_QUAKE)
+ return MSG_ReadCoord13i();
+ else if (protocol == PROTOCOL_DARKPLACES1 || protocol == PROTOCOL_DARKPLACES5)
+ return MSG_ReadCoord32f();
+ else if (protocol == PROTOCOL_DARKPLACES2 || protocol == PROTOCOL_DARKPLACES3 || protocol == PROTOCOL_DARKPLACES4)
+ return MSG_ReadCoord16i();
+ Host_Error("MSG_ReadCoord: unknown protocol\n");
+ return 0;
+}
+
+void MSG_ReadVector (float *v, int protocol)
+{
+ v[0] = MSG_ReadCoord(protocol);
+ v[1] = MSG_ReadCoord(protocol);
+ v[2] = MSG_ReadCoord(protocol);
+}
+
+// LordHavoc: round to nearest value, rather than rounding toward zero, fixes crosshair problem
+float MSG_ReadAngle8i (void)
+{
+ return MSG_ReadByte () * (360.0/256.0);
+}
+
+float MSG_ReadAngle16i (void)
+{
+ return MSG_ReadShort () * (360.0/65536.0);
+}
+
+float MSG_ReadAngle32f (void)
+{
+ return MSG_ReadFloat ();