1 | /* |
---|
2 | * ttyvaders Textmode shoot'em up |
---|
3 | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> |
---|
4 | * All Rights Reserved |
---|
5 | * |
---|
6 | * $Id: overlay.c 88 2003-11-09 13:16:19Z sam $ |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or modify |
---|
9 | * it under the terms of the GNU General Public License as published by |
---|
10 | * the Free Software Foundation; either version 2 of the License, or |
---|
11 | * (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
21 | */ |
---|
22 | |
---|
23 | #include <stdlib.h> |
---|
24 | |
---|
25 | #include "common.h" |
---|
26 | |
---|
27 | void draw_status(game *g) |
---|
28 | { |
---|
29 | static char dots30[] = "------------------------------"; |
---|
30 | static char dashes30[] = "=============================="; |
---|
31 | |
---|
32 | /* Draw life jauge */ |
---|
33 | ee_color(EE_GRAY); |
---|
34 | ee_goto(4, 1); |
---|
35 | ee_putstr(dots30); |
---|
36 | |
---|
37 | if(g->p->life > MAX_LIFE * 7 / 10) |
---|
38 | { |
---|
39 | ee_color(EE_GREEN); |
---|
40 | } |
---|
41 | else if(g->p->life > MAX_LIFE * 3 / 10) |
---|
42 | { |
---|
43 | ee_color(EE_YELLOW); |
---|
44 | } |
---|
45 | else |
---|
46 | { |
---|
47 | ee_color(EE_RED); |
---|
48 | } |
---|
49 | |
---|
50 | ee_goto(4, 1); |
---|
51 | ee_putstr(dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); |
---|
52 | |
---|
53 | ee_color(EE_WHITE); |
---|
54 | ee_goto(1, 1); |
---|
55 | ee_putstr("L |"); |
---|
56 | ee_goto(34, 1); |
---|
57 | ee_putstr("|"); |
---|
58 | |
---|
59 | /* Draw weapon jauge */ |
---|
60 | ee_color(EE_GRAY); |
---|
61 | ee_goto(42, 1); |
---|
62 | ee_putstr(dots30 + 10); |
---|
63 | |
---|
64 | if(g->p->special > MAX_SPECIAL * 9 / 10) |
---|
65 | { |
---|
66 | ee_color(EE_WHITE); |
---|
67 | } |
---|
68 | else if(g->p->special > MAX_SPECIAL * 3 / 10) |
---|
69 | { |
---|
70 | ee_color(EE_CYAN); |
---|
71 | } |
---|
72 | else |
---|
73 | { |
---|
74 | ee_color(EE_BLUE); |
---|
75 | } |
---|
76 | |
---|
77 | ee_goto(42, 1); |
---|
78 | ee_putstr(dashes30 + 10 + (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL); |
---|
79 | |
---|
80 | ee_color(EE_WHITE); |
---|
81 | ee_goto(39, 1); |
---|
82 | ee_putstr("S |"); |
---|
83 | ee_goto(62, 1); |
---|
84 | ee_putstr("|"); |
---|
85 | } |
---|
86 | |
---|