|
|
@ -16,26 +16,45 @@ int
|
|
|
|
chat_findfreeline ()
|
|
|
|
chat_findfreeline ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = chat.lastline;
|
|
|
|
for (i = 0; (i < CHAT_MAX_LINES && chat.lines[i][0] != 0); i++);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (i >= CHAT_MAX_LINES) {
|
|
|
|
if (i >= CHAT_MAX_LINES) {
|
|
|
|
memcpy (chat.lines[1], chat.lines[0], 255);
|
|
|
|
memcpy (chat.lines[1], chat.lines[0], 255);
|
|
|
|
i = 255;
|
|
|
|
i = 255;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
chat.lastline++;
|
|
|
|
chat.changed = 1;
|
|
|
|
chat.changed = 1;
|
|
|
|
|
|
|
|
|
|
|
|
return i;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
|
|
chat_cleanup ()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < CHAT_MAX_LINES; i++) {
|
|
|
|
|
|
|
|
if (chat.linestatus[i] > 0)
|
|
|
|
|
|
|
|
chat.linestatus[i] = -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
chat_addline (char *text)
|
|
|
|
chat_addline (char *text)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int l;
|
|
|
|
int l;
|
|
|
|
|
|
|
|
|
|
|
|
l = chat_findfreeline ();
|
|
|
|
l = chat_findfreeline ();
|
|
|
|
|
|
|
|
chat.linestatus[l] = 0;
|
|
|
|
|
|
|
|
strncpy (chat.lines[l], text, 255);
|
|
|
|
|
|
|
|
chat.lineschanged = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
|
|
chat_addstatusline (char *text)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int l;
|
|
|
|
|
|
|
|
l = chat_findfreeline ();
|
|
|
|
|
|
|
|
chat.linestatus[l] = 1;
|
|
|
|
strncpy (chat.lines[l], text, 255);
|
|
|
|
strncpy (chat.lines[l], text, 255);
|
|
|
|
chat.lineschanged = 1;
|
|
|
|
chat.lineschanged = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -197,6 +216,10 @@ chat_loop (SDL_Event * event)
|
|
|
|
y = chat.window.y + 4;
|
|
|
|
y = chat.window.y + 4;
|
|
|
|
l = chat.startline;
|
|
|
|
l = chat.startline;
|
|
|
|
while (y < (chat.window.y + chat.window.h - 32) && chat.lines[l][0] != 0) {
|
|
|
|
while (y < (chat.window.y + chat.window.h - 32) && chat.lines[l][0] != 0) {
|
|
|
|
|
|
|
|
if (chat.linestatus[l] < 0) {
|
|
|
|
|
|
|
|
l++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
for (p1 = 0; (p1 < maxchar && chat.lines[l][p2] != 0); p1++)
|
|
|
|
for (p1 = 0; (p1 < maxchar && chat.lines[l][p2] != 0); p1++)
|
|
|
|
text[p1] = chat.lines[l][p2++];
|
|
|
|
text[p1] = chat.lines[l][p2++];
|
|
|
|
text[p1] = 0;
|
|
|
|
text[p1] = 0;
|
|
|
@ -207,6 +230,7 @@ chat_loop (SDL_Event * event)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
y = y + font[0].size.y;
|
|
|
|
y = y + font[0].size.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (chat.lines[l][0] != 0) {
|
|
|
|
if (chat.lines[l][0] != 0) {
|
|
|
|
chat.startline++;
|
|
|
|
chat.startline++;
|
|
|
|
chat.changed = 1;
|
|
|
|
chat.changed = 1;
|
|
|
@ -227,6 +251,7 @@ chat_loop (SDL_Event * event)
|
|
|
|
for (p1 = 0; (p1 < maxchar && chat.input.text[p2] != 0); p1++)
|
|
|
|
for (p1 = 0; (p1 < maxchar && chat.input.text[p2] != 0); p1++)
|
|
|
|
text[p1] = chat.input.text[p2++];
|
|
|
|
text[p1] = chat.input.text[p2++];
|
|
|
|
text[p1] = 0;
|
|
|
|
text[p1] = 0;
|
|
|
|
font_draw (chat.window.x + 4, (chat.window.y + chat.window.h) - 4 - font[0].size.y, text,0);
|
|
|
|
font_draw (chat.window.x + 4, (chat.window.y + chat.window.h) - 4 - font[0].size.y,
|
|
|
|
|
|
|
|
text, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|