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,v 1.1 2002/12/23 15:06:13 sam Exp $ |
---|
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_overlay( game *g ) |
---|
28 | { |
---|
29 | static char dots30[] = "------------------------------"; |
---|
30 | static char dashes30[] = "=============================="; |
---|
31 | |
---|
32 | /* Draw life jauge */ |
---|
33 | gfx_color( GRAY ); |
---|
34 | gfx_goto( 2, 1 ); |
---|
35 | gfx_putstr( dots30 ); |
---|
36 | |
---|
37 | if( g->p->life > MAX_LIFE * 7 / 10 ) |
---|
38 | { |
---|
39 | gfx_color( GREEN ); |
---|
40 | } |
---|
41 | else if( g->p->life > MAX_LIFE * 3 / 10 ) |
---|
42 | { |
---|
43 | gfx_color( YELLOW ); |
---|
44 | } |
---|
45 | else |
---|
46 | { |
---|
47 | gfx_color( RED ); |
---|
48 | } |
---|
49 | |
---|
50 | gfx_goto( 2, 1 ); |
---|
51 | gfx_putstr( dashes30 + ( MAX_LIFE - g->p->life ) * 30 / MAX_LIFE ); |
---|
52 | |
---|
53 | gfx_color( WHITE ); |
---|
54 | gfx_goto( 1, 1 ); |
---|
55 | gfx_putstr( "|" ); |
---|
56 | gfx_goto( 32, 1 ); |
---|
57 | gfx_putstr( "| L" ); |
---|
58 | |
---|
59 | /* Draw weapon jauge */ |
---|
60 | gfx_color( GRAY ); |
---|
61 | gfx_goto( 38, 1 ); |
---|
62 | gfx_putstr( dots30 + 10 ); |
---|
63 | |
---|
64 | if( g->p->special > MAX_SPECIAL * 9 / 10 ) |
---|
65 | { |
---|
66 | gfx_color( WHITE ); |
---|
67 | } |
---|
68 | else if( g->p->special > MAX_SPECIAL * 3 / 10 ) |
---|
69 | { |
---|
70 | gfx_color( CYAN ); |
---|
71 | } |
---|
72 | else |
---|
73 | { |
---|
74 | gfx_color( BLUE ); |
---|
75 | } |
---|
76 | |
---|
77 | gfx_goto( 38, 1 ); |
---|
78 | gfx_putstr( dashes30 + 10 + ( MAX_SPECIAL - g->p->special ) * 20 / MAX_SPECIAL ); |
---|
79 | |
---|
80 | gfx_color( WHITE ); |
---|
81 | gfx_goto( 37, 1 ); |
---|
82 | gfx_putstr( "|" ); |
---|
83 | gfx_goto( 58, 1 ); |
---|
84 | gfx_putstr( "| S" ); |
---|
85 | } |
---|
86 | |
---|