]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
added EF_DOUBLESIDED (and internally RENDER_NOCULLFACE)
[xonotic/darkplaces.git] / console.c
index 910038e5f1f514379c61112642b647fe5b13198e..1bfe368558f1698a7b19dbd506dda70a4c277b23 100644 (file)
--- a/console.c
+++ b/console.c
@@ -51,13 +51,6 @@ float con_times[MAX_NOTIFYLINES];
 
 int con_vislines;
 
-#define MAXCMDLINE     256
-extern char key_lines[32][MAXCMDLINE];
-extern int edit_line;
-extern int key_linepos;
-extern int key_insert;
-
-
 qboolean con_initialized;
 
 
@@ -73,7 +66,7 @@ cvar_t log_file = {0, "log_file",""};
 char crt_log_file [MAX_OSPATH] = "";
 qfile_t* logfile = NULL;
 
-qbyte* logqueue = NULL;
+unsigned char* logqueue = NULL;
 size_t logq_ind = 0;
 size_t logq_size = 0;
 
@@ -189,11 +182,11 @@ void Log_ConPrint (const char *msg)
                // If we need to enlarge the log queue
                if (len > remain)
                {
-                       unsigned int factor = ((logq_ind + len) / logq_size) + 1;
-                       qbyte* newqueue;
+                       size_t factor = ((logq_ind + len) / logq_size) + 1;
+                       unsigned char* newqueue;
 
                        logq_size *= factor;
-                       newqueue = Mem_Alloc (tempmempool, logq_size);
+                       newqueue = (unsigned char *)Mem_Alloc (tempmempool, logq_size);
                        memcpy (newqueue, logqueue, logq_ind);
                        Mem_Free (logqueue);
                        logqueue = newqueue;
@@ -375,8 +368,8 @@ void Con_Init (void)
        con_totallines = CON_TEXTSIZE / con_linewidth;
 
        // Allocate a log queue
-       logq_size = 512;
-       logqueue = Mem_Alloc (tempmempool, logq_size);
+       logq_size = MAX_INPUTLINE;
+       logqueue = (unsigned char *)Mem_Alloc (tempmempool, logq_size);
        logq_ind = 0;
 
        Cvar_RegisterVariable (&log_file);
@@ -542,18 +535,19 @@ void Con_Print(const char *msg)
 {
        int mask = 0;
        static int index = 0;
-       static char line[16384];
+       static char line[MAX_INPUTLINE];
 
        for (;*msg;msg++)
        {
                if (index == 0)
                {
                        // if this is the beginning of a new line, print timestamp
-                       char *timestamp = timestamps.integer ? Sys_TimeString(timeformat.string) : "";
-                       // reset the color 
+                       const char *timestamp = timestamps.integer ? Sys_TimeString(timeformat.string) : "";
+                       // reset the color
                        // FIXME: 1. perhaps we should use a terminal system 2. use a constant instead of 7!
-                       line[index++] = '^';
-                       line[index++] = '7';
+                       line[index++] = STRING_COLOR_TAG;
+                       // assert( STRING_COLOR_DEFAULT < 10 )
+                       line[index++] = STRING_COLOR_DEFAULT + '0';
                        // special color codes for chat messages must always come first
                        // for Con_PrintToHistory to work properly
                        if (*msg <= 2)
@@ -563,27 +557,27 @@ void Con_Print(const char *msg)
                                        // play talk wav
                                        S_LocalSound ("sound/misc/talk.wav");
                                }
-                               if (gamemode == GAME_NEXUIZ)
-                               {
-                                       line[index++] = '^';
+                               //if (gamemode == GAME_NEXUIZ)
+                               //{
+                                       line[index++] = STRING_COLOR_TAG;
                                        line[index++] = '3';
-                               }
-                               else
-                               {
-                                       // go to colored text
-                                       mask = 128;
-                               }
+                               //}
+                               //else
+                               //{
+                               //      // go to colored text
+                               //      mask = 128;
+                               //}
                                msg++;
                        }
                        // store timestamp
                        for (;*timestamp;index++, timestamp++)
-                               if (index < sizeof(line) - 2)
+                               if (index < (int)sizeof(line) - 2)
                                        line[index] = *timestamp;
                }
                // append the character
                line[index++] = *msg;
                // if this is a newline character, we have a complete line to print
-               if (*msg == '\n' || index >= 16000)
+               if (*msg == '\n' || index >= (int)sizeof(line) / 2)
                {
                        // terminate the line
                        line[index] = 0;
@@ -607,9 +601,6 @@ void Con_Print(const char *msg)
 }
 
 
-// LordHavoc: increased from 4096 to 16384
-#define        MAXPRINTMSG     16384
-
 /*
 ================
 Con_Printf
@@ -620,7 +611,7 @@ Prints to all appropriate console targets
 void Con_Printf(const char *fmt, ...)
 {
        va_list argptr;
-       char msg[MAXPRINTMSG];
+       char msg[MAX_INPUTLINE];
 
        va_start(argptr,fmt);
        dpvsnprintf(msg,sizeof(msg),fmt,argptr);
@@ -653,7 +644,7 @@ A Con_Printf that only shows up if the "developer" cvar is set
 void Con_DPrintf(const char *fmt, ...)
 {
        va_list argptr;
-       char msg[MAXPRINTMSG];
+       char msg[MAX_INPUTLINE];
 
        if (!developer.integer)
                return;                 // don't confuse non-developers with techie stuff...
@@ -687,7 +678,7 @@ void Con_DrawInput (void)
 {
        int             y;
        int             i;
-       char editlinecopy[257], *text;
+       char editlinecopy[MAX_INPUTLINE+1], *text;
 
        if (!key_consoleactive)
                return;         // don't draw anything
@@ -699,10 +690,10 @@ void Con_DrawInput (void)
        // use strlen of edit_line instead of key_linepos to allow editing
        // of early characters w/o erasing
 
-       y = strlen(text);
+       y = (int)strlen(text);
 
 // fill out remainder with spaces
-       for (i = y; i < 256; i++)
+       for (i = y; i < (int)sizeof(editlinecopy)-1; i++)
                text[i] = ' ';
 
        // add the cursor frame
@@ -736,8 +727,7 @@ void Con_DrawNotify (void)
        char    *text;
        int             i;
        float   time;
-       extern char chat_buffer[];
-       char    temptext[256];
+       char    temptext[MAX_INPUTLINE];
        int colorindex = -1; //-1 for default
 
        if (con_notify.integer < 0)
@@ -769,8 +759,8 @@ void Con_DrawNotify (void)
                } else
                        x = 0;
 
-               DrawQ_ColoredString( x, v, text, con_linewidth, 8, 8, 1.0, 1.0, 1.0, 1.0, 0, &colorindex ); 
-                       
+               DrawQ_ColoredString( x, v, text, con_linewidth, 8, 8, 1.0, 1.0, 1.0, 1.0, 0, &colorindex );
+
                v += 8;
        }
 
@@ -786,7 +776,7 @@ void Con_DrawNotify (void)
                        sprintf(temptext, "say_team:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
                else
                        sprintf(temptext, "say:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
-               while (strlen(temptext) >= (size_t) con_linewidth)
+               while ((int)strlen(temptext) >= con_linewidth)
                {
                        DrawQ_ColoredString( 0, v, temptext, con_linewidth, 8, 8, 1.0, 1.0, 1.0, 1.0, 0, &colorindex );
                        strcpy(temptext, &temptext[con_linewidth]);
@@ -808,7 +798,6 @@ Draws the console with the solid background
 The typing input line at the bottom should only be drawn if typing is allowed
 ================
 */
-extern char engineversion[40];
 void Con_DrawConsole (int lines)
 {
        int i, y, rows, j;
@@ -857,7 +846,7 @@ void Con_DisplayList(const char **list)
        const char **walk = list;
 
        while (*walk) {
-               len = strlen(*walk);
+               len = (int)strlen(*walk);
                if (len > maxlen)
                        maxlen = len;
                walk++;
@@ -865,7 +854,7 @@ void Con_DisplayList(const char **list)
        maxlen += 1;
 
        while (*list) {
-               len = strlen(*list);
+               len = (int)strlen(*list);
                if (pos + maxlen >= width) {
                        Con_Print("\n");
                        pos = 0;
@@ -915,7 +904,7 @@ void Con_CompleteCommandLine (void)
                else
                        list[0] = Cmd_CompleteAliasBuildList(s);
                cmd = *list[0];
-               cmd_len = strlen (cmd);
+               cmd_len = (int)strlen (cmd);
        } else {
                if (c)
                        cmd = *(list[0] = Cmd_CompleteBuildList(s));
@@ -924,7 +913,7 @@ void Con_CompleteCommandLine (void)
                if (a)
                        cmd = *(list[2] = Cmd_CompleteAliasBuildList(s));
 
-               cmd_len = strlen (s);
+               cmd_len = (int)strlen (s);
                do {
                        for (i = 0; i < 3; i++) {
                                char ch = cmd[cmd_len];