]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - common.c
334
[xonotic/darkplaces.git] / common.c
index 6f8065a6a48b577ea5b6a1ec023e10d72a899724..1414e31f6f074951812ee66140cbe9e5e0915bad 100644 (file)
--- a/common.c
+++ b/common.c
@@ -273,9 +273,9 @@ void MSG_WriteCoord32f (sizebuf_t *sb, float f)
 
 void MSG_WriteCoord (sizebuf_t *sb, float f, int protocol)
 {
-       if (protocol == PROTOCOL_QUAKE)
+       if (protocol == PROTOCOL_QUAKE || protocol == PROTOCOL_NEHAHRAMOVIE)
                MSG_WriteCoord13i (sb, f);
-       else if (protocol == PROTOCOL_DARKPLACES1 || protocol == PROTOCOL_DARKPLACES5)
+       else if (protocol == PROTOCOL_DARKPLACES1 || protocol == PROTOCOL_DARKPLACES5 || protocol == PROTOCOL_DARKPLACES6)
                MSG_WriteCoord32f (sb, f);
        else if (protocol == PROTOCOL_DARKPLACES2 || protocol == PROTOCOL_DARKPLACES3 || protocol == PROTOCOL_DARKPLACES4)
                MSG_WriteCoord16i (sb, f);
@@ -314,7 +314,7 @@ void MSG_WriteAngle32f (sizebuf_t *sb, float f)
 
 void MSG_WriteAngle (sizebuf_t *sb, float f, int protocol)
 {
-       if (protocol == PROTOCOL_DARKPLACES5)
+       if (protocol == PROTOCOL_DARKPLACES5 || protocol == PROTOCOL_DARKPLACES6)
                MSG_WriteAngle16i (sb, f);
        else
                MSG_WriteAngle8i (sb, f);
@@ -445,9 +445,9 @@ float MSG_ReadCoord32f (void)
 
 float MSG_ReadCoord (int protocol)
 {
-       if (protocol == PROTOCOL_QUAKE || protocol == 250)
+       if (protocol == PROTOCOL_QUAKE || protocol == PROTOCOL_NEHAHRAMOVIE)
                return MSG_ReadCoord13i();
-       else if (protocol == PROTOCOL_DARKPLACES1 || protocol == PROTOCOL_DARKPLACES5)
+       else if (protocol == PROTOCOL_DARKPLACES1 || protocol == PROTOCOL_DARKPLACES5 || protocol == PROTOCOL_DARKPLACES6)
                return MSG_ReadCoord32f();
        else if (protocol == PROTOCOL_DARKPLACES2 || protocol == PROTOCOL_DARKPLACES3 || protocol == PROTOCOL_DARKPLACES4)
                return MSG_ReadCoord16i();
@@ -480,7 +480,7 @@ float MSG_ReadAngle32f (void)
 
 float MSG_ReadAngle (int protocol)
 {
-       if (protocol == PROTOCOL_DARKPLACES5)
+       if (protocol == PROTOCOL_DARKPLACES5 || protocol == PROTOCOL_DARKPLACES6)
                return MSG_ReadAngle16i ();
        else
                return MSG_ReadAngle8i ();
@@ -682,7 +682,26 @@ skipwhite:
                com_token[len] = 0;
                *datapointer = data+1;
                return true;
-       }
+       } 
+       else if (*data == '\'')
+       {
+               // quoted string
+               for (data++;*data != '\'';data++)
+               {
+                       if (*data == '\\' && data[1] == '\'' )
+                               data++;
+                       if (!*data || len >= (int)sizeof(com_token) - 1)
+                       {
+                               com_token[0] = 0;
+                               *datapointer = NULL;
+                               return false;
+                       }
+                       com_token[len++] = *data;
+               }
+               com_token[len] = 0;
+               *datapointer = data+1;
+               return true;
+       }       
        else if (*data == '\n' || *data == '{' || *data == '}' || *data == ')' || *data == '(' || *data == ']' || *data == '[' || *data == '\'' || *data == ':' || *data == ',' || *data == ';')
        {
                // single character
@@ -694,7 +713,7 @@ skipwhite:
        else
        {
                // regular word
-               for (;*data > ' ' && *data != '{' && *data != '}' && *data != ')' && *data != '(' && *data != ']' && *data != '[' && *data != '\'' && *data != ':' && *data != ',' && *data != ';';data++)
+               for (;*data > ' ' && *data != '{' && *data != '}' && *data != ')' && *data != '(' && *data != ']' && *data != '[' && *data != '\'' && *data != ':' && *data != ',' && *data != ';' && *data != '\'' && *data != '"';data++)
                {
                        if (len >= (int)sizeof(com_token) - 1)
                        {
@@ -992,7 +1011,6 @@ void COM_Init (void)
        Mathlib_Init();
 
        FS_Init ();
-       Log_Init ();
        COM_CheckRegistered ();
 }