diff --git a/src/client/chat.qc b/src/client/chat.qc index fb0545cd..7c09dbff 100644 --- a/src/client/chat.qc +++ b/src/client/chat.qc @@ -24,6 +24,7 @@ var float g_chattime; var int g_chatlines = -1; string g_chatbuffer[CHAT_LINES]; font_s g_fntChat; +string g_chatbuffer_final; void Chat_Init(void) @@ -62,7 +63,7 @@ Chat_Draw(void) return; g_chatpos[0] = g_hudmins[0] + 16; - g_chatpos[1] = g_hudmins[1] + g_hudres[1] - 128; + g_chatpos[1] = g_hudmins[1] + (g_hudres[1] / 2) - 80; if (g_chatlines < 0) { return; @@ -82,10 +83,7 @@ Chat_Draw(void) g_chattime = time + CHAT_TIME; } - for (i = 0; i < CHAT_LINES; i++) { - Font_DrawText([g_chatpos[0],g_chatpos[1]], g_chatbuffer[i], g_fntChat); - g_chatpos[1] += 14; - } + Font_DrawField([g_chatpos[0],g_chatpos[1]], [g_hudres[0]/2,g_hudres[1]/2], g_chatbuffer_final, g_fntChat, AF_LEFT | AF_BOTTOM); } /* @@ -112,6 +110,15 @@ Chat_Parse(string msg) localsound("misc/talk.wav"); + g_chatbuffer_final = ""; + + for (int i = 0; i < CHAT_LINES; i++) { + if (i == 0) + g_chatbuffer_final = g_chatbuffer[i]; + else + g_chatbuffer_final = sprintf("%s\n%s", g_chatbuffer_final, g_chatbuffer[i]); + } + /* log to client console */ print(msg); print("\n"); diff --git a/src/client/font.h b/src/client/font.h index 339f7f45..e5493643 100644 --- a/src/client/font.h +++ b/src/client/font.h @@ -22,9 +22,9 @@ enumflags { - AF_RIGHT, - AF_TOP, AF_LEFT, + AF_TOP, + AF_RIGHT, AF_BOTTOM };