]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
physics: fix and refactor unsticking
[xonotic/darkplaces.git] / console.c
index eefcb25e975b8c0a8f4de738ba07199c59dc6cde..21782f7f439e1edbb6db6a99fd9bf821cd492db0 100644 (file)
--- a/console.c
+++ b/console.c
@@ -333,7 +333,7 @@ ConBuffer_AddLine
 Appends a given string as a new line to the console.
 ================
 */
-void ConBuffer_AddLine(conbuffer_t *buf, const char *line, int len, int mask)
+void ConBuffer_AddLine(conbuffer_t *buf, const char *line, int len, unsigned mask)
 {
        char *putpos;
        con_lineinfo_t *p;
@@ -367,7 +367,7 @@ void ConBuffer_AddLine(conbuffer_t *buf, const char *line, int len, int mask)
        p->height = -1; // calculate when needed
 }
 
-int ConBuffer_FindPrevLine(conbuffer_t *buf, int mask_must, int mask_mustnot, int start)
+int ConBuffer_FindPrevLine(conbuffer_t *buf, unsigned mask_must, unsigned mask_mustnot, int start)
 {
        int i;
        if(start == -1)
@@ -719,8 +719,9 @@ static void Con_MsgCmdMode(cmd_state_t *cmd, signed char mode)
        chat_mode = mode;
        if(Cmd_Argc(cmd) > 1)
        {
-               dpsnprintf(chat_buffer, sizeof(chat_buffer), "%s ", Cmd_Args(cmd));
-               chat_bufferpos = (unsigned int)strlen(chat_buffer);
+               chat_bufferpos = dpsnprintf(chat_buffer, sizeof(chat_buffer), "%s ", Cmd_Args(cmd));
+               if (chat_bufferpos < 0)
+                       chat_bufferpos = 0;
        }
 }
 
@@ -1150,10 +1151,10 @@ Con_MaskPrint
 */
 extern cvar_t timestamps;
 extern cvar_t timeformat;
-void Con_MaskPrint(int additionalmask, const char *msg)
+void Con_MaskPrint(unsigned additionalmask, const char *msg)
 {
-       static int mask = 0;
-       static int index = 0;
+       static unsigned mask = 0;
+       static unsigned index = 0;
        static char line[MAX_INPUTLINE];
 
        if (con_mutex)
@@ -1355,12 +1356,12 @@ void Con_MaskPrint(int additionalmask, const char *msg)
                                                *out++ = '[';
                                                *out++ = 'm';
                                        }
-                                       *out++ = 0;
-                                       Sys_Print(printline);
+                                       *out = '\0';
+                                       Sys_Print(printline, out - printline);
                                }
                                else if(sys_colortranslation.integer == 2) // Quake
                                {
-                                       Sys_Print(line);
+                                       Sys_Print(line, index);
                                }
                                else // strip
                                {
@@ -1410,8 +1411,8 @@ void Con_MaskPrint(int additionalmask, const char *msg)
                                                                break;
                                                }
                                        }
-                                       *out++ = 0;
-                                       Sys_Print(printline);
+                                       *out = '\0';
+                                       Sys_Print(printline, out - printline);
                                }
                        }
                        // empty the line buffer
@@ -1429,7 +1430,7 @@ void Con_MaskPrint(int additionalmask, const char *msg)
 Con_MaskPrintf
 ================
 */
-void Con_MaskPrintf(int mask, const char *fmt, ...)
+void Con_MaskPrintf(unsigned mask, const char *fmt, ...)
 {
        va_list argptr;
        char msg[MAX_INPUTLINE];
@@ -1699,7 +1700,7 @@ static int Con_DisplayLineFunc(void *passthrough, const char *line, size_t lengt
        return 1;
 }
 
-static int Con_DrawNotifyRect(int mask_must, int mask_mustnot, float maxage, float x, float y, float width, float height, float fontsize, float alignment_x, float alignment_y, const char *continuationString)
+static int Con_DrawNotifyRect(unsigned mask_must, unsigned mask_mustnot, float maxage, float x, float y, float width, float height, float fontsize, float alignment_x, float alignment_y, const char *continuationString)
 {
        int i;
        int lines = 0;
@@ -1900,7 +1901,7 @@ If alpha is 0, the line is not drawn, but still wrapped and its height
 returned.
 ================
 */
-static int Con_DrawConsoleLine(int mask_must, int mask_mustnot, float y, int lineno, float ymin, float ymax)
+static int Con_DrawConsoleLine(unsigned mask_must, unsigned mask_mustnot, float y, int lineno, float ymin, float ymax)
 {
        float width = vid_conwidth.value;
        con_text_info_t ti;
@@ -1932,7 +1933,7 @@ Calculates the last visible line index and how much to show of it based on
 con_backscroll.
 ================
 */
-static void Con_LastVisibleLine(int mask_must, int mask_mustnot, int *last, int *limitlast)
+static void Con_LastVisibleLine(unsigned mask_must, unsigned mask_mustnot, int *last, int *limitlast)
 {
        int lines_seen = 0;
        int i;
@@ -2160,7 +2161,7 @@ qbool GetMapList (const char *s, char *completedname, int completednamebufferlen
                        if (!memcmp(buf, "IBSP", 4))
                        {
                                p = LittleLong(((int *)buf)[1]);
-                               if (p == Q3BSPVERSION)
+                               if (p == Q3BSPVERSION || p == Q3BSPVERSION_LIVE || p == Q3BSPVERSION_IG)
                                {
                                        q3dheader_t *header = (q3dheader_t *)buf;
                                        lumpofs = LittleLong(header->lumps[Q3LUMP_ENTITIES].fileofs);