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 "common.h" |
---|
14 | |
---|
15 | #include "chat.h" |
---|
16 | #include "dev.h" |
---|
17 | |
---|
18 | chat_console *chat = NULL; |
---|
19 | |
---|
20 | chat_console::chat_console(JCFont *font, int width, int height) : |
---|
21 | console(font,width,height<4 ? 4 : height,symbol_str("CHAT")) |
---|
22 | { |
---|
23 | hide(); |
---|
24 | clear(); |
---|
25 | cx = 0; |
---|
26 | cy = h - 1; |
---|
27 | lastx = xres / 2 - screen_w() / 2; |
---|
28 | lasty = yres - h; |
---|
29 | } |
---|
30 | |
---|
31 | void chat_console::clear() |
---|
32 | { |
---|
33 | memset(screen,' ',w*h); |
---|
34 | memset(screen+w*(h-2),'-',w); |
---|
35 | redraw(); |
---|
36 | } |
---|
37 | |
---|
38 | void chat_console::put_all(char *st) |
---|
39 | { |
---|
40 | memmove(screen,screen+w,w*(h-3)); |
---|
41 | memset(screen+w*(h-3),' ',w); |
---|
42 | memcpy(screen+w*(h-3),st,strlen(st)); |
---|
43 | redraw(); |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | void chat_console::draw_user(char *st) |
---|
48 | { |
---|
49 | memset(screen+w*(h-1),' ',w); |
---|
50 | memcpy(screen+w*(h-1),st,strlen(st)); |
---|
51 | cx=strlen(st); |
---|
52 | cy=h-1; |
---|
53 | redraw(); |
---|
54 | } |
---|
55 | |
---|