diff --git a/engine/client/console.c b/engine/client/console.c index 0d2bb4fdf..aee58bd4b 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -109,7 +109,7 @@ void Con_ResizeCon (console_t *con); qboolean Con_IsActive (console_t *con) { - return (con == con_current); + return (con == con_current) | (con->unseentext*2); } void Con_Destroy (console_t *con) { @@ -129,8 +129,8 @@ void Con_Destroy (console_t *con) BZ_Free(con); - if (con == con_current) - con = &con_main; + if (con_current == con) + con_current = &con_main; } console_t *Con_FindConsole(char *name) { @@ -1345,6 +1345,28 @@ void Con_DrawConsole (int lines, qboolean noback) y = lines - 30; + if (lines == scr_conlines && con_main.next) + { + console_t *con = con_current; + rows--; + for (x = 0, con = &con_main; con; con = con->next) + { + if (con == &con_main) + txt = "MAIN"; + else + txt = con->name; + + if (x != 0 && x+(strlen(txt)+1)*8 > curcon->linewidth*8) + { + x = 0; + rows--; + } + Draw_FunString(x, 0, va("^&F%i%s", (con==con_current)+con->unseentext*4, txt)); + x+=(strlen(txt)+1)*8; + } + rows--; + } + // draw from the bottom up if (curcon->display != curcon->current) { @@ -1355,7 +1377,6 @@ void Con_DrawConsole (int lines, qboolean noback) y -= 8; rows--; } - row = curcon->display; for (i=0 ; iredirect(con_current, key); return; } + + if ((key == K_MOUSE1 || key == K_MOUSE2) && con_main.next) + { + extern cvar_t vid_conwidth, vid_conheight; + extern int mousecursor_x, mousecursor_y; + int xpos, ypos; + xpos = (int)((mousecursor_x*vid_conwidth.value)/(vid.width*8)); + ypos = (int)((mousecursor_y*vid_conheight.value)/(vid.height*8)); + if (ypos == 0) + { + console_t *con; + for (con = &con_main; con; con = con->next) + { + if (con == &con_main) + xpos -= 5; + else + xpos -= strlen(con->name)+1; + if (xpos == -1) + break; + if (xpos < 0) + { + if (key == K_MOUSE2) + Con_Destroy (con); + else + con_current = con; + break; + } + } + } + return; + } if (key == K_ENTER) { // backslash text are commands, else chat @@ -1067,6 +1098,13 @@ void Key_Init (void) consolekeys['`'] = false; consolekeys['~'] = false; + for (i=K_MOUSE1 ; i= 'A') ext = ((*str - ('A' - 10)) << CON_FGSHIFT) | (ext&~CON_FGMASK); else ext = ((*str - '0') << CON_FGSHIFT) | (ext&~CON_FGMASK); - str++; // background char + str++; // foreground char if (*str == '-') // default (clear) for BG ext &= ~CON_BGMASK & ~CON_NONCLEARBG; else if (*str >= 'A') ext = ((*str - ('A' - 10)) << CON_BGSHIFT) | (ext&~CON_BGMASK) | CON_NONCLEARBG; else ext = ((*str - '0') << CON_BGSHIFT) | (ext&~CON_BGMASK) | CON_NONCLEARBG; + str++; // background char continue; } - str--; // else invalid code + // else invalid code + goto messedup; } else if (*str == 'a') { @@ -199,6 +201,7 @@ void Draw_FunString(int x, int y, unsigned char *str) x += 8; continue; } +messedup: Draw_ColouredCharacter (x, y, (*str++) | ext); x += 8; } diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 4c7cfd64f..42677ed06 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -1699,11 +1699,19 @@ void Plug_Close_f(void) void Plug_CloseAll_f(void) { + plugin_t *p; if (currentplug) Sys_Error("Plug_CloseAll_f called inside a plugin!\n"); while(plugs) { - Plug_Close(plugs); + p = plugs; + while (p->blockcloses) + { + p = p->next; + if (!p) + return; + } + Plug_Close(p); } }