Client: Chat now uses a text-field for handling word wrap. Also fix the alignflags in font.h
This commit is contained in:
parent
9c61d2528f
commit
e6bb5a6bc3
2 changed files with 14 additions and 7 deletions
|
@ -24,6 +24,7 @@ var float g_chattime;
|
||||||
var int g_chatlines = -1;
|
var int g_chatlines = -1;
|
||||||
string g_chatbuffer[CHAT_LINES];
|
string g_chatbuffer[CHAT_LINES];
|
||||||
font_s g_fntChat;
|
font_s g_fntChat;
|
||||||
|
string g_chatbuffer_final;
|
||||||
|
|
||||||
void
|
void
|
||||||
Chat_Init(void)
|
Chat_Init(void)
|
||||||
|
@ -62,7 +63,7 @@ Chat_Draw(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_chatpos[0] = g_hudmins[0] + 16;
|
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) {
|
if (g_chatlines < 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -82,10 +83,7 @@ Chat_Draw(void)
|
||||||
g_chattime = time + CHAT_TIME;
|
g_chattime = time + CHAT_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < CHAT_LINES; i++) {
|
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);
|
||||||
Font_DrawText([g_chatpos[0],g_chatpos[1]], g_chatbuffer[i], g_fntChat);
|
|
||||||
g_chatpos[1] += 14;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -112,6 +110,15 @@ Chat_Parse(string msg)
|
||||||
|
|
||||||
localsound("misc/talk.wav");
|
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 */
|
/* log to client console */
|
||||||
print(msg);
|
print(msg);
|
||||||
print("\n");
|
print("\n");
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
enumflags
|
enumflags
|
||||||
{
|
{
|
||||||
AF_RIGHT,
|
|
||||||
AF_TOP,
|
|
||||||
AF_LEFT,
|
AF_LEFT,
|
||||||
|
AF_TOP,
|
||||||
|
AF_RIGHT,
|
||||||
AF_BOTTOM
|
AF_BOTTOM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue