source: ttyvaders/trunk/src/overlay.c @ 1460

Last change on this file since 1460 was 1460, checked in by Sam Hocevar, 13 years ago
  • Bwarf, typo in the no warranty clause.
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
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 1460 2006-12-12 01:49:48Z sam $
7 *
8 *  This program is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15#include "config.h"
16
17#include <stdlib.h>
18
19#include "common.h"
20
21void draw_status(game *g)
22{
23    static char dots30[] = "------------------------------";
24    static char dashes30[] = "==============================";
25
26    /* Draw life jauge */
27    cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK);
28    cucul_putstr(g->cv, 4, 1, dots30);
29
30    if(g->p->life > MAX_LIFE * 7 / 10)
31    {
32        cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK);
33    }
34    else if(g->p->life > MAX_LIFE * 3 / 10)
35    {
36        cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
37    }
38    else
39    {
40        cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK);
41    }
42
43    cucul_putstr(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE);
44
45    cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
46    cucul_putstr(g->cv, 1, 1, "L |");
47    cucul_putstr(g->cv, 34, 1, "|");
48
49    /* Draw weapon jauge */
50    cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK);
51    cucul_putstr(g->cv, 42, 1, dots30 + 10);
52
53    if(g->p->special > MAX_SPECIAL * 9 / 10)
54    {
55        cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
56    }
57    else if(g->p->special > MAX_SPECIAL * 3 / 10)
58    {
59        cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
60    }
61    else
62    {
63        cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK);
64    }
65
66    cucul_putstr(g->cv, 42, 1, dashes30 + 10
67                       + (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL);
68
69    cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
70    cucul_putstr(g->cv, 39, 1, "S |");
71    cucul_putstr(g->cv, 62, 1, "|");
72}
73
Note: See TracBrowser for help on using the repository browser.