1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
5 | * |
---|
6 | * This software was released into the Public Domain. As with most public |
---|
7 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
8 | * Jonathan Clark. |
---|
9 | */ |
---|
10 | |
---|
11 | #include "config.h" |
---|
12 | |
---|
13 | #include "chat.h" |
---|
14 | #include "dev.h" |
---|
15 | |
---|
16 | chat_console *chat = NULL; |
---|
17 | |
---|
18 | chat_console::chat_console(JCFont *font, int width, int height) : |
---|
19 | console(font,width,height<4 ? 4 : height,symbol_str("CHAT")) |
---|
20 | { |
---|
21 | hide(); |
---|
22 | clear(); |
---|
23 | cx = 0; |
---|
24 | cy = h - 1; |
---|
25 | lastx = xres / 2 - screen_w() / 2; |
---|
26 | lasty = yres - h; |
---|
27 | } |
---|
28 | |
---|
29 | void chat_console::clear() |
---|
30 | { |
---|
31 | memset(screen,' ',w*h); |
---|
32 | memset(screen+w*(h-2),'-',w); |
---|
33 | redraw(); |
---|
34 | } |
---|
35 | |
---|
36 | void chat_console::put_all(char *st) |
---|
37 | { |
---|
38 | memmove(screen,screen+w,w*(h-3)); |
---|
39 | memset(screen+w*(h-3),' ',w); |
---|
40 | memcpy(screen+w*(h-3),st,strlen(st)); |
---|
41 | redraw(); |
---|
42 | } |
---|
43 | |
---|
44 | |
---|
45 | void chat_console::draw_user(char *st) |
---|
46 | { |
---|
47 | memset(screen+w*(h-1),' ',w); |
---|
48 | memcpy(screen+w*(h-1),st,strlen(st)); |
---|
49 | cx=strlen(st); |
---|
50 | cy=h-1; |
---|
51 | redraw(); |
---|
52 | } |
---|
53 | |
---|