]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - common.c
R_SetSkyBox now takes a const char *
[xonotic/darkplaces.git] / common.c
index e744380c82d4f6fbbdd9c1739c87554389a3a5cf..3dfcf6d51577d324702fcf62083d03de5cf9edee 100644 (file)
--- a/common.c
+++ b/common.c
@@ -434,13 +434,13 @@ void *SZ_GetSpace (sizebuf_t *buf, int length)
        if (buf->cursize + length > buf->maxsize)
        {
                if (!buf->allowoverflow)
-                       Host_Error ("SZ_GetSpace: overflow without allowoverflow set");
+                       Host_Error ("SZ_GetSpace: overflow without allowoverflow set\n");
 
                if (length > buf->maxsize)
-                       Host_Error ("SZ_GetSpace: %i is > full buffer size", length);
+                       Host_Error ("SZ_GetSpace: %i is > full buffer size\n", length);
 
                buf->overflowed = true;
-               Con_Printf ("SZ_GetSpace: overflow");
+               Con_Printf ("SZ_GetSpace: overflow\n");
                SZ_Clear (buf);
        }
 
@@ -458,7 +458,7 @@ void SZ_Write (sizebuf_t *buf, void *data, int length)
 void SZ_Print (sizebuf_t *buf, char *data)
 {
        int             len;
-       
+
        len = strlen(data)+1;
 
 // byte * cast to keep VC++ happy
@@ -468,6 +468,55 @@ void SZ_Print (sizebuf_t *buf, char *data)
                memcpy ((qbyte *)SZ_GetSpace(buf, len-1)-1,data,len); // write over trailing 0
 }
 
+static char *hexchar = "0123456789ABCDEF";
+void SZ_HexDumpToConsole(sizebuf_t *buf)
+{
+       int i;
+       char text[1024];
+       char *cur, *flushpointer;
+       cur = text;
+       flushpointer = text + 512;
+       for (i = 0;i < buf->cursize;i++)
+       {
+               if ((i & 15) == 0)
+               {
+                       *cur++ = hexchar[(i >> 12) & 15];
+                       *cur++ = hexchar[(i >>  8) & 15];
+                       *cur++ = hexchar[(i >>  4) & 15];
+                       *cur++ = hexchar[(i >>  0) & 15];
+                       *cur++ = ':';
+                       *cur++ = ' ';
+               }
+               else if ((i & 15) == 15)
+                       *cur++ = '\n';
+               else
+                       *cur++ = ' ';
+               if (i & 1)
+               {
+                       *cur++ = hexchar[(buf->data[i] >> 4) & 15] | 0x80;
+                       *cur++ = hexchar[(buf->data[i] >> 0) & 15] | 0x80;
+               }
+               else
+               {
+                       *cur++ = hexchar[(buf->data[i] >> 4) & 15];
+                       *cur++ = hexchar[(buf->data[i] >> 0) & 15];
+               }
+               if (cur >= flushpointer)
+               {
+                       *cur++ = 0;
+                       Con_Printf("%s", text);
+                       cur = text;
+               }
+       }
+       if ((i & 15) != 0)
+               *cur++ = '\n';
+       if (cur > text)
+       {
+               *cur++ = 0;
+               Con_Printf("%s", text);
+       }
+}
+
 
 //============================================================================
 
@@ -510,6 +559,8 @@ void COM_StripExtension (char *in, char *out)
        }
        if (last)
                *last = 0;
+       else
+               *out = 0;
 }
 
 /*
@@ -749,16 +800,12 @@ void COM_InitArgv (void)
 
 void COM_InitGameType (void)
 {
-       char name[128];
+       char name[MAX_OSPATH];
        COM_StripExtension(com_argv[0], name);
        COM_ToLowerString(name, name);
 
        if (strstr(name, "transfusion"))
                gamemode = GAME_TRANSFUSION;
-       else if (strstr(name, "zymotic"))
-               gamemode = GAME_ZYMOTIC;
-       else if (strstr(name, "fiendarena"))
-               gamemode = GAME_FIENDARENA;
        else if (strstr(name, "nehahra"))
                gamemode = GAME_NEHAHRA;
        else if (strstr(name, "hipnotic"))
@@ -770,10 +817,6 @@ void COM_InitGameType (void)
 
        if (COM_CheckParm ("-transfusion"))
                gamemode = GAME_TRANSFUSION;
-       else if (COM_CheckParm ("-zymotic"))
-               gamemode = GAME_ZYMOTIC;
-       else if (COM_CheckParm ("-fiendarena"))
-               gamemode = GAME_FIENDARENA;
        else if (COM_CheckParm ("-nehahra"))
                gamemode = GAME_NEHAHRA;
        else if (COM_CheckParm ("-hipnotic"))
@@ -786,10 +829,7 @@ void COM_InitGameType (void)
        switch(gamemode)
        {
        case GAME_NORMAL:
-               if (registered.integer)
-                       gamename = "DarkPlaces-Quake";
-               else
-                       gamename = "DarkPlaces-SharewareQuake";
+               gamename = "DarkPlaces-Quake";
                gamedirname = "";
                break;
        case GAME_HIPNOTIC:
@@ -804,14 +844,6 @@ void COM_InitGameType (void)
                gamename = "DarkPlaces-Nehahra";
                gamedirname = "nehahra";
                break;
-       case GAME_FIENDARENA:
-               gamename = "FiendArena";
-               gamedirname = "fiendarena";
-               break;
-       case GAME_ZYMOTIC:
-               gamename = "Zymotic";
-               gamedirname = "zymotic";
-               break;
        case GAME_TRANSFUSION:
                gamename = "Transfusion";
                gamedirname = "transfusion";