You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

87 lines
2.2 KiB

  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.3 2003/02/09 11:17:40 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. #include <stdlib.h>
  23. #include "common.h"
  24. void draw_status( game *g )
  25. {
  26. static char dots30[] = "------------------------------";
  27. static char dashes30[] = "==============================";
  28. /* Draw life jauge */
  29. gfx_color( GRAY );
  30. gfx_goto( 4, 1 );
  31. gfx_putstr( dots30 );
  32. if( g->p->life > MAX_LIFE * 7 / 10 )
  33. {
  34. gfx_color( GREEN );
  35. }
  36. else if( g->p->life > MAX_LIFE * 3 / 10 )
  37. {
  38. gfx_color( YELLOW );
  39. }
  40. else
  41. {
  42. gfx_color( RED );
  43. }
  44. gfx_goto( 4, 1 );
  45. gfx_putstr( dashes30 + ( MAX_LIFE - g->p->life ) * 30 / MAX_LIFE );
  46. gfx_color( WHITE );
  47. gfx_goto( 1, 1 );
  48. gfx_putstr( "L |" );
  49. gfx_goto( 34, 1 );
  50. gfx_putstr( "|" );
  51. /* Draw weapon jauge */
  52. gfx_color( GRAY );
  53. gfx_goto( 42, 1 );
  54. gfx_putstr( dots30 + 10 );
  55. if( g->p->special > MAX_SPECIAL * 9 / 10 )
  56. {
  57. gfx_color( WHITE );
  58. }
  59. else if( g->p->special > MAX_SPECIAL * 3 / 10 )
  60. {
  61. gfx_color( CYAN );
  62. }
  63. else
  64. {
  65. gfx_color( BLUE );
  66. }
  67. gfx_goto( 42, 1 );
  68. gfx_putstr( dashes30 + 10 + ( MAX_SPECIAL - g->p->special ) * 20 / MAX_SPECIAL );
  69. gfx_color( WHITE );
  70. gfx_goto( 39, 1 );
  71. gfx_putstr( "S |" );
  72. gfx_goto( 62, 1 );
  73. gfx_putstr( "|" );
  74. }