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

Last change on this file since 3423 was 3423, checked in by Sam Hocevar, 11 years ago
  • Toying around with the old ttyvaders version.
  • Property svn:keywords set to Id
File size: 2.0 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 3423 2009-04-28 16:55:01Z 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    caca_set_color_ansi(g->cv, CACA_DARKGRAY, CACA_BLACK);
28    caca_put_str(g->cv, 4, 1, dots30);
29
30    if(g->p->life > MAX_LIFE * 7 / 10)
31    {
32        caca_set_color_ansi(g->cv, CACA_GREEN, CACA_BLACK);
33    }
34    else if(g->p->life > MAX_LIFE * 3 / 10)
35    {
36        caca_set_color_ansi(g->cv, CACA_YELLOW, CACA_BLACK);
37    }
38    else
39    {
40        caca_set_color_ansi(g->cv, CACA_RED, CACA_BLACK);
41    }
42
43    caca_put_str(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE);
44
45    caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK);
46    caca_put_str(g->cv, 1, 1, "L |");
47    caca_put_str(g->cv, 34, 1, "|");
48
49    /* Draw weapon jauge */
50    caca_set_color_ansi(g->cv, CACA_DARKGRAY, CACA_BLACK);
51    caca_put_str(g->cv, 42, 1, dots30 + 10);
52
53    if(g->p->special > MAX_SPECIAL * 9 / 10)
54    {
55        caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK);
56    }
57    else if(g->p->special > MAX_SPECIAL * 3 / 10)
58    {
59        caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK);
60    }
61    else
62    {
63        caca_set_color_ansi(g->cv, CACA_BLUE, CACA_BLACK);
64    }
65
66    caca_put_str(g->cv, 42, 1, dashes30 + 10
67                        + (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL);
68
69    caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK);
70    caca_put_str(g->cv, 39, 1, "S |");
71    caca_put_str(g->cv, 62, 1, "|");
72}
73
Note: See TracBrowser for help on using the repository browser.