|
|
|
@ -19,7 +19,7 @@ chat_findfreeline ()
|
|
|
|
|
i = chat.lastline;
|
|
|
|
|
|
|
|
|
|
if (i >= CHAT_MAX_LINES) {
|
|
|
|
|
memcpy (chat.lines[1], chat.lines[0], 255 * (CHAT_MAX_LINES - 1));
|
|
|
|
|
memcpy (&chat.lines[1], &chat.lines[0], sizeof (chat.lines[1]) * (CHAT_MAX_LINES - 1));
|
|
|
|
|
i = CHAT_MAX_LINES - 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -34,8 +34,8 @@ chat_cleanup ()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < CHAT_MAX_LINES; i++) {
|
|
|
|
|
if (chat.linestatus[i] > 0)
|
|
|
|
|
chat.linestatus[i] = -1;
|
|
|
|
|
if (chat.lines[i].status > 0)
|
|
|
|
|
chat.lines[i].status = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -45,8 +45,8 @@ chat_addline (char *text)
|
|
|
|
|
int l;
|
|
|
|
|
|
|
|
|
|
l = chat_findfreeline ();
|
|
|
|
|
chat.linestatus[l] = 0;
|
|
|
|
|
strncpy (chat.lines[l], text, 255);
|
|
|
|
|
chat.lines[l].status = 0;
|
|
|
|
|
strncpy (chat.lines[l].text, text, 255);
|
|
|
|
|
chat.lineschanged = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -55,8 +55,8 @@ chat_addstatusline (char *text)
|
|
|
|
|
{
|
|
|
|
|
int l;
|
|
|
|
|
l = chat_findfreeline ();
|
|
|
|
|
chat.linestatus[l] = 1;
|
|
|
|
|
strncpy (chat.lines[l], text, 255);
|
|
|
|
|
chat.lines[l].status = 1;
|
|
|
|
|
strncpy (chat.lines[l].text, text, 255);
|
|
|
|
|
chat.lineschanged = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -216,23 +216,23 @@ chat_loop (SDL_Event * event)
|
|
|
|
|
font_setcolor (255, 255, 255, 0);
|
|
|
|
|
y = chat.window.y + 4;
|
|
|
|
|
l = chat.startline;
|
|
|
|
|
while (y < (chat.window.y + chat.window.h - 32) && chat.lines[l][0] != 0) {
|
|
|
|
|
if (chat.linestatus[l] < 0) {
|
|
|
|
|
while (y < (chat.window.y + chat.window.h - 32) && chat.lines[l].text[0] != 0) {
|
|
|
|
|
if (chat.lines[l].status < 0) {
|
|
|
|
|
l++;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (p1 = 0; (p1 < maxchar && chat.lines[l][p2] != 0); p1++)
|
|
|
|
|
text[p1] = chat.lines[l][p2++];
|
|
|
|
|
for (p1 = 0; (p1 < maxchar && chat.lines[l].text[p2] != 0); p1++)
|
|
|
|
|
text[p1] = chat.lines[l].text[p2++];
|
|
|
|
|
text[p1] = 0;
|
|
|
|
|
font_draw (chat.window.x + 4, y, text, 0);
|
|
|
|
|
if (chat.lines[l][p2] == 0) { // the end of the line
|
|
|
|
|
if (chat.lines[l].text[p2] == 0) { // the end of the line
|
|
|
|
|
l++;
|
|
|
|
|
p2 = 0;
|
|
|
|
|
}
|
|
|
|
|
y = y + font[0].size.y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (chat.lines[l][0] != 0) {
|
|
|
|
|
if (chat.lines[l].text[0] != 0) {
|
|
|
|
|
chat.startline++;
|
|
|
|
|
chat.changed = 1;
|
|
|
|
|
chat.lineschanged = 1;
|
|
|
|
|