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