]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - common.c
detect bogus texture upload attempts and print the info to console
[xonotic/darkplaces.git] / common.c
index af2161f5625474c639fe1d1bdf34e36613cc482e..c6a16ee05e8df11eb81ca0a5741917b6c2481153 100644 (file)
--- a/common.c
+++ b/common.c
@@ -50,6 +50,7 @@ char com_cmdline[CMDLINE_LENGTH];
 int gamemode;
 char *gamename;
 char *gamedirname;
+char com_modname[MAX_OSPATH];
 
 /*
 
@@ -374,7 +375,7 @@ char *MSG_ReadString (void)
                        break;
                string[l] = c;
                l++;
-       } while (l < sizeof(string)-1);
+       } while (l < (int)sizeof(string)-1);
 
        string[l] = 0;
 
@@ -466,14 +467,14 @@ void SZ_Print (sizebuf_t *buf, const char *data)
 }
 
 static char *hexchar = "0123456789ABCDEF";
-void SZ_HexDumpToConsole(const sizebuf_t *buf)
+void Com_HexDumpToConsole(const qbyte *data, int size)
 {
        int i;
        char text[1024];
        char *cur, *flushpointer;
        cur = text;
        flushpointer = text + 512;
-       for (i = 0;i < buf->cursize;i++)
+       for (i = 0;i < size;i++)
        {
                if ((i & 15) == 0)
                {
@@ -490,13 +491,13 @@ void SZ_HexDumpToConsole(const sizebuf_t *buf)
                        *cur++ = ' ';
                if (i & 1)
                {
-                       *cur++ = hexchar[(buf->data[i] >> 4) & 15] | 0x80;
-                       *cur++ = hexchar[(buf->data[i] >> 0) & 15] | 0x80;
+                       *cur++ = hexchar[(data[i] >> 4) & 15] | 0x80;
+                       *cur++ = hexchar[(data[i] >> 0) & 15] | 0x80;
                }
                else
                {
-                       *cur++ = hexchar[(buf->data[i] >> 4) & 15];
-                       *cur++ = hexchar[(buf->data[i] >> 0) & 15];
+                       *cur++ = hexchar[(data[i] >> 4) & 15];
+                       *cur++ = hexchar[(data[i] >> 0) & 15];
                }
                if (cur >= flushpointer)
                {
@@ -514,6 +515,11 @@ void SZ_HexDumpToConsole(const sizebuf_t *buf)
        }
 }
 
+void SZ_HexDumpToConsole(const sizebuf_t *buf)
+{
+       Com_HexDumpToConsole(buf->data, buf->cursize);
+}
+
 
 //============================================================================
 
@@ -794,6 +800,8 @@ void COM_InitGameType (void)
 
        if (strstr(name, "transfusion"))
                gamemode = GAME_TRANSFUSION;
+       else if (strstr(name, "nexiuz"))
+               gamemode = GAME_NEXIUZ;
        else if (strstr(name, "nehahra"))
                gamemode = GAME_NEHAHRA;
        else if (strstr(name, "hipnotic"))
@@ -805,6 +813,8 @@ void COM_InitGameType (void)
 
        if (COM_CheckParm ("-transfusion"))
                gamemode = GAME_TRANSFUSION;
+       else if (COM_CheckParm ("-nexiuz"))
+               gamemode = GAME_NEXIUZ;
        else if (COM_CheckParm ("-nehahra"))
                gamemode = GAME_NEHAHRA;
        else if (COM_CheckParm ("-hipnotic"))
@@ -832,6 +842,10 @@ void COM_InitGameType (void)
                gamename = "DarkPlaces-Nehahra";
                gamedirname = "nehahra";
                break;
+       case GAME_NEXIUZ:
+               gamename = "Nexiuz";
+               gamedirname = "data";
+               break;
        case GAME_TRANSFUSION:
                gamename = "Transfusion";
                gamedirname = "transfusion";
@@ -1082,7 +1096,7 @@ void COM_CopyFile (char *netpath, char *cachepath)
 
        while (remaining)
        {
-               if (remaining < sizeof(buf))
+               if (remaining < (int)sizeof(buf))
                        count = remaining;
                else
                        count = sizeof(buf);
@@ -1425,10 +1439,12 @@ void COM_InitFilesystem (void)
                com_basedir[i-1] = 0;
 
 // start up with GAMENAME by default (id1)
+       strcpy(com_modname, GAMENAME);
        COM_AddGameDirectory (va("%s/"GAMENAME, com_basedir));
        if (gamedirname[0])
        {
                com_modified = true;
+               strcpy(com_modname, gamedirname);
                COM_AddGameDirectory (va("%s/%s", com_basedir, gamedirname));
        }
 
@@ -1438,6 +1454,7 @@ void COM_InitFilesystem (void)
        if (i && i < com_argc-1)
        {
                com_modified = true;
+               strcpy(com_modname, com_argv[i+1]);
                COM_AddGameDirectory (va("%s/%s", com_basedir, com_argv[i+1]));
        }