git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/ttyvaders/trunk@80 92316355-f0b4-4df1-b90c-862c8a59935fmaster
@@ -6,6 +6,6 @@ CPPFLAGS_ncurses = -DUSE_NCURSES | |||||
endif | endif | ||||
lib_LIBRARIES = libee.a | lib_LIBRARIES = libee.a | ||||
libee_a_SOURCES = ee.c | |||||
libee_a_CPPFLAGS = -I../src $(CPPFLAGS_slang) $(CPPFLAGS_ncurses) | |||||
libee_a_SOURCES = ee.c ee.h | |||||
libee_a_CPPFLAGS = $(CPPFLAGS_slang) $(CPPFLAGS_ncurses) | |||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* ttyvaders Textmode shoot'em up | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | |||||
* libee ASCII-Art library | |||||
* Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org> | |||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | * $Id$ | ||||
@@ -27,34 +27,44 @@ | |||||
#include <sys/time.h> | #include <sys/time.h> | ||||
#include <time.h> | #include <time.h> | ||||
#include "common.h" | |||||
#include "ee.h" | |||||
int init_graphics( void ) | |||||
int ee_init(void) | |||||
{ | { | ||||
#ifdef USE_SLANG | #ifdef USE_SLANG | ||||
static char * colors[] = { "black", "green", "yellow", "white", | |||||
"red", "gray", "lightgray", "blue", "cyan", "magenta", NULL }; | |||||
int i; | |||||
/* Initialize slang library */ | /* Initialize slang library */ | ||||
SLsig_block_signals(); | SLsig_block_signals(); | ||||
SLtt_get_terminfo(); | SLtt_get_terminfo(); | ||||
if( SLkp_init() == -1 ) | |||||
if(SLkp_init() == -1) | |||||
{ | { | ||||
SLsig_unblock_signals(); | SLsig_unblock_signals(); | ||||
return 1; | |||||
return -1; | |||||
} | } | ||||
SLang_init_tty (-1, 0, 1); | |||||
SLang_init_tty(-1, 0, 1); | |||||
if( SLsmg_init_smg() == -1 ) | |||||
if(SLsmg_init_smg() == -1) | |||||
{ | { | ||||
SLsig_unblock_signals(); | SLsig_unblock_signals(); | ||||
return 1; | |||||
return -1; | |||||
} | } | ||||
SLsig_unblock_signals(); | SLsig_unblock_signals(); | ||||
SLsmg_cls(); | SLsmg_cls(); | ||||
SLtt_set_cursor_visibility( 0 ); | |||||
SLtt_set_cursor_visibility(0); | |||||
SLsmg_refresh(); | SLsmg_refresh(); | ||||
for(i = 0; colors[i]; i++) | |||||
{ | |||||
SLtt_set_color(i + 1, NULL, colors[i], "black"); | |||||
} | |||||
#elif USE_NCURSES | #elif USE_NCURSES | ||||
/* Initialize ncurses library */ | /* Initialize ncurses library */ | ||||
initscr(); | initscr(); | ||||
@@ -63,99 +73,68 @@ int init_graphics( void ) | |||||
cbreak(); | cbreak(); | ||||
noecho(); | noecho(); | ||||
nodelay(stdscr, TRUE); | nodelay(stdscr, TRUE); | ||||
curs_set( 0 ); | |||||
curs_set(0); | |||||
start_color(); | |||||
init_pair(EE_BLACK, COLOR_BLACK, COLOR_BLACK); | |||||
init_pair(EE_GREEN, COLOR_GREEN, COLOR_BLACK); | |||||
init_pair(EE_YELLOW, COLOR_YELLOW, COLOR_BLACK); | |||||
init_pair(EE_WHITE, COLOR_WHITE, COLOR_BLACK); | |||||
init_pair(EE_RED, COLOR_RED, COLOR_BLACK); | |||||
init_pair(EE_GRAY, COLOR_WHITE, COLOR_BLACK); // XXX | |||||
init_pair(EE_LIGHTGRAY, COLOR_WHITE, COLOR_BLACK); // XXX | |||||
init_pair(EE_BLUE, COLOR_BLUE, COLOR_BLACK); | |||||
init_pair(EE_CYAN, COLOR_CYAN, COLOR_BLACK); | |||||
init_pair(EE_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); | |||||
#else | #else | ||||
/* Dummy driver */ | /* Dummy driver */ | ||||
#endif | #endif | ||||
return 0; | return 0; | ||||
} | } | ||||
void init_game( game *g ) | |||||
int ee_get_width(void) | |||||
{ | { | ||||
#ifdef USE_SLANG | #ifdef USE_SLANG | ||||
static char * const colors[] = | |||||
{ | |||||
"black", "green", "yellow", "white", | |||||
"red", "gray", "lightgray", "blue", "cyan", "magenta", NULL | |||||
}; | |||||
int i; | |||||
for( i = 0; colors[i] ; i++ ) | |||||
{ | |||||
SLtt_set_color( i+1, NULL, colors[i], "black" ); | |||||
} | |||||
g->w = SLtt_Screen_Cols; | |||||
g->h = SLtt_Screen_Rows; | |||||
return SLtt_Screen_Cols; | |||||
#elif USE_NCURSES | #elif USE_NCURSES | ||||
start_color(); | |||||
init_pair( BLACK, COLOR_BLACK, COLOR_BLACK ); | |||||
init_pair( GREEN, COLOR_GREEN, COLOR_BLACK ); | |||||
init_pair( YELLOW, COLOR_YELLOW, COLOR_BLACK ); | |||||
init_pair( WHITE, COLOR_WHITE, COLOR_BLACK ); | |||||
init_pair( RED, COLOR_RED, COLOR_BLACK ); | |||||
init_pair( GRAY, COLOR_WHITE, COLOR_BLACK ); // XXX | |||||
init_pair( LIGHTGRAY, COLOR_WHITE, COLOR_BLACK ); // XXX | |||||
init_pair( BLUE, COLOR_BLUE, COLOR_BLACK ); | |||||
init_pair( CYAN, COLOR_CYAN, COLOR_BLACK ); | |||||
init_pair( MAGENTA, COLOR_MAGENTA, COLOR_BLACK ); | |||||
g->w = COLS; | |||||
g->h = LINES; | |||||
return COLS; | |||||
#else | #else | ||||
/* Use dummy driver */ | |||||
g->w = 80; | |||||
g->h = 25; | |||||
return 80; | |||||
#endif | #endif | ||||
} | } | ||||
char get_key( void ) | |||||
int ee_get_height(void) | |||||
{ | { | ||||
#ifdef USE_SLANG | #ifdef USE_SLANG | ||||
if( SLang_input_pending (0) ) | |||||
{ | |||||
return SLang_getkey(); | |||||
} | |||||
return SLtt_Screen_Rows; | |||||
#elif USE_NCURSES | #elif USE_NCURSES | ||||
char key; | |||||
if( ( key = getch() ) != ERR ) | |||||
{ | |||||
return key; | |||||
} | |||||
return LINES; | |||||
#else | #else | ||||
/* Use dummy driver */ | |||||
char key = GET_RAND(0,256); | |||||
if( key != 'q' && key != 'p' && key != '\t' ) | |||||
{ | |||||
return key; | |||||
} | |||||
return 25; | |||||
#endif | #endif | ||||
return 0; | |||||
} | } | ||||
void clear_graphics( game *g ) | |||||
void ee_clear(void) | |||||
{ | { | ||||
#ifdef USE_SLANG | #ifdef USE_SLANG | ||||
//SLsmg_cls(); | //SLsmg_cls(); | ||||
int y; | int y; | ||||
for( y = 0; y < g->h; y++ ) | |||||
for(y = 0; y < ee_get_height(); y++) | |||||
{ | { | ||||
gfx_goto( 0, y ); | |||||
gfx_putstr( " " ); | |||||
ee_goto(0, y); | |||||
ee_putstr(" "); | |||||
} | } | ||||
#elif USE_NCURSES | #elif USE_NCURSES | ||||
//clear(); | //clear(); | ||||
int y; | int y; | ||||
for( y = 0; y < g->h; y++ ) | |||||
for(y = 0; y < ee_get_height(); y++) | |||||
{ | { | ||||
gfx_goto( 0, y ); | |||||
gfx_putstr( " " ); | |||||
ee_goto(0, y); | |||||
ee_putstr(" "); | |||||
} | } | ||||
#else | #else | ||||
/* Use dummy driver */ | /* Use dummy driver */ | ||||
@@ -175,21 +154,20 @@ static int64_t local_time(void) | |||||
} | } | ||||
#define DELAY 40000 | #define DELAY 40000 | ||||
void refresh_graphics( void ) | |||||
void ee_refresh(void) | |||||
{ | { | ||||
static int64_t local_clock = 0; | static int64_t local_clock = 0; | ||||
int64_t now; | int64_t now; | ||||
gfx_goto( 0, 0 ); | |||||
ee_goto(0, 0); | |||||
if( !local_clock ) | |||||
if(!local_clock) | |||||
{ | { | ||||
/* Initialize local_clock */ | /* Initialize local_clock */ | ||||
local_clock = local_time(); | local_clock = local_time(); | ||||
} | } | ||||
if( local_time() > local_clock + 10000 ) | |||||
if(local_time() > local_clock + 10000) | |||||
{ | { | ||||
/* If we are late, we shouldn't display anything */ | /* If we are late, we shouldn't display anything */ | ||||
} | } | ||||
@@ -204,25 +182,47 @@ void refresh_graphics( void ) | |||||
now = local_time(); | now = local_time(); | ||||
if( now < local_clock + DELAY - 10000 ) | |||||
if(now < local_clock + DELAY - 10000) | |||||
{ | { | ||||
usleep( local_clock + DELAY - 10000 - now ); | |||||
usleep(local_clock + DELAY - 10000 - now); | |||||
} | } | ||||
local_clock += DELAY; | local_clock += DELAY; | ||||
} | } | ||||
void end_graphics( void ) | |||||
void ee_end(void) | |||||
{ | { | ||||
#ifdef USE_SLANG | #ifdef USE_SLANG | ||||
SLtt_set_cursor_visibility( 1 ); | |||||
SLtt_set_cursor_visibility(1); | |||||
SLang_reset_tty(); | SLang_reset_tty(); | ||||
SLsmg_reset_smg(); | SLsmg_reset_smg(); | ||||
#elif USE_NCURSES | #elif USE_NCURSES | ||||
curs_set( 1 ); | |||||
curs_set(1); | |||||
endwin(); | endwin(); | ||||
#else | #else | ||||
/* Use dummy driver */ | /* Use dummy driver */ | ||||
#endif | #endif | ||||
} | } | ||||
char ee_get_key(void) | |||||
{ | |||||
#ifdef USE_SLANG | |||||
if(SLang_input_pending(0)) | |||||
{ | |||||
return SLang_getkey(); | |||||
} | |||||
#elif USE_NCURSES | |||||
char key = getch(); | |||||
if(key != ERR) | |||||
{ | |||||
return key; | |||||
} | |||||
#else | |||||
return 0; | |||||
#endif | |||||
return 0; | |||||
} | |||||
@@ -0,0 +1,74 @@ | |||||
/* | |||||
* libee ASCII-Art library | |||||
* Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org> | |||||
* All Rights Reserved | |||||
* | |||||
* $Id$ | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 2 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, write to the Free Software | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||||
*/ | |||||
/* | |||||
* Graphics primitives | |||||
*/ | |||||
#ifdef USE_SLANG | |||||
# include <slang.h> | |||||
# define ee_color(x) SLsmg_set_color(x) | |||||
# define ee_goto(x,y) SLsmg_gotorc(y,x) | |||||
# define ee_putchar(x) SLsmg_write_char(x) | |||||
# define ee_putstr(x) SLsmg_write_string(x) | |||||
#elif USE_NCURSES | |||||
# define box box_divert | |||||
# include <curses.h> | |||||
# undef box | |||||
# define ee_color(x) attrset(COLOR_PAIR(x)) | |||||
# define ee_goto(x,y) move(y,x) | |||||
# define ee_putchar(x) addch(x) | |||||
# define ee_putstr(x) addstr(x) | |||||
#else | |||||
# define ee_color(x) (void)(x) | |||||
# define ee_goto(x,y) do{ (void)(x); (void)(y); } while(0) | |||||
# define ee_putchar(x) (void)(x) | |||||
# define ee_putstr(x) (void)(x) | |||||
#endif | |||||
#define ee_putcharTO(x,y,c) do{ ee_goto(x,y); ee_putchar(c); }while(0) | |||||
/* | |||||
* Colours | |||||
*/ | |||||
#define EE_BLACK 1 | |||||
#define EE_GREEN 2 | |||||
#define EE_YELLOW 3 | |||||
#define EE_WHITE 4 | |||||
#define EE_RED 5 | |||||
#define EE_GRAY 6 | |||||
#define EE_LIGHTGRAY 7 | |||||
#define EE_BLUE 8 | |||||
#define EE_CYAN 9 | |||||
#define EE_MAGENTA 10 | |||||
/* | |||||
* Prototypes | |||||
*/ | |||||
int ee_init(void); | |||||
int ee_get_width(void); | |||||
int ee_get_height(void); | |||||
void ee_clear(void); | |||||
void ee_refresh(void); | |||||
void ee_end(void); | |||||
char ee_get_key(void); | |||||
@@ -35,6 +35,6 @@ ttyvaders_SOURCES = \ | |||||
weapons.c \ | weapons.c \ | ||||
$(NULL) | $(NULL) | ||||
ttyvaders_CPPFLAGS = $(CPPFLAGS_slang) $(CPPFLAGS_ncurses) | |||||
ttyvaders_CPPFLAGS = -I../libee $(CPPFLAGS_slang) $(CPPFLAGS_ncurses) | |||||
ttyvaders_LDADD = ../libee/libee.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) | ttyvaders_LDADD = ../libee/libee.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: aliens.c,v 1.8 2002/12/23 13:46:27 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -133,127 +133,127 @@ static void draw_alien_bar( game *g, int x, int y, int frame ) | |||||
switch( frame ) | switch( frame ) | ||||
{ | { | ||||
case 0: | case 0: | ||||
gfx_color( MAGENTA ); | |||||
gfx_goto( x, y ); | |||||
gfx_putstr( ",---." ); | |||||
gfx_goto( x, y+1 ); | |||||
gfx_putchar( '\\' ); | |||||
gfx_color( WHITE ); | |||||
gfx_putstr( "o O" ); | |||||
gfx_color( MAGENTA ); | |||||
gfx_putchar( '/' ); | |||||
gfx_goto( x, y+2 ); | |||||
gfx_putstr( "^^^^^" ); | |||||
ee_color( EE_MAGENTA ); | |||||
ee_goto( x, y ); | |||||
ee_putstr( ",---." ); | |||||
ee_goto( x, y+1 ); | |||||
ee_putchar( '\\' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_putstr( "o O" ); | |||||
ee_color( EE_MAGENTA ); | |||||
ee_putchar( '/' ); | |||||
ee_goto( x, y+2 ); | |||||
ee_putstr( "^^^^^" ); | |||||
break; | break; | ||||
case 1: | case 1: | ||||
gfx_color( MAGENTA ); | |||||
gfx_goto( x, y ); | |||||
gfx_putstr( ",---." ); | |||||
gfx_goto( x, y+1 ); | |||||
gfx_putchar( '\\' ); | |||||
gfx_color( WHITE ); | |||||
gfx_putstr( "O o" ); | |||||
gfx_color( MAGENTA ); | |||||
gfx_putchar( '/' ); | |||||
gfx_goto( x, y+2 ); | |||||
gfx_putstr( "^^^^^" ); | |||||
ee_color( EE_MAGENTA ); | |||||
ee_goto( x, y ); | |||||
ee_putstr( ",---." ); | |||||
ee_goto( x, y+1 ); | |||||
ee_putchar( '\\' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_putstr( "O o" ); | |||||
ee_color( EE_MAGENTA ); | |||||
ee_putchar( '/' ); | |||||
ee_goto( x, y+2 ); | |||||
ee_putstr( "^^^^^" ); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
static void draw_alien_baz( game *g, int x, int y, int frame ) | static void draw_alien_baz( game *g, int x, int y, int frame ) | ||||
{ | { | ||||
gfx_color( GREEN ); | |||||
gfx_goto( x, y-1 ); | |||||
gfx_putstr( "__" ); | |||||
ee_color( EE_GREEN ); | |||||
ee_goto( x, y-1 ); | |||||
ee_putstr( "__" ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putchar( '/' ); | |||||
gfx_goto( x+2, y ); | |||||
gfx_putchar( '\\' ); | |||||
ee_goto( x-1, y ); | |||||
ee_putchar( '/' ); | |||||
ee_goto( x+2, y ); | |||||
ee_putchar( '\\' ); | |||||
switch( frame ) | switch( frame ) | ||||
{ | { | ||||
case 3: | case 3: | ||||
gfx_goto( x-2, y+1 ); | |||||
gfx_putstr( "//'`\\\\" ); | |||||
ee_goto( x-2, y+1 ); | |||||
ee_putstr( "//'`\\\\" ); | |||||
break; | break; | ||||
case 4: | case 4: | ||||
case 2: | case 2: | ||||
gfx_goto( x-2, y+1 ); | |||||
gfx_putstr( "/(~~)\\" ); | |||||
ee_goto( x-2, y+1 ); | |||||
ee_putstr( "/(~~)\\" ); | |||||
break; | break; | ||||
case 5: | case 5: | ||||
case 1: | case 1: | ||||
gfx_goto( x-2, y+1 ); | |||||
gfx_putstr( "((^^))" ); | |||||
ee_goto( x-2, y+1 ); | |||||
ee_putstr( "((^^))" ); | |||||
break; | break; | ||||
case 0: | case 0: | ||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "\\\\//" ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "\\\\//" ); | |||||
break; | break; | ||||
} | } | ||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y ); | |||||
gfx_putstr( "oo" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y ); | |||||
ee_putstr( "oo" ); | |||||
} | } | ||||
static void draw_alien_foo( game *g, int x, int y, int frame ) | static void draw_alien_foo( game *g, int x, int y, int frame ) | ||||
{ | { | ||||
gfx_color( YELLOW ); | |||||
ee_color( EE_YELLOW ); | |||||
switch( frame ) | switch( frame ) | ||||
{ | { | ||||
case 0: | case 0: | ||||
gfx_goto( x, y ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( x+6, y ); | |||||
gfx_putchar( ',' ); | |||||
gfx_goto( x+1, y+1 ); | |||||
gfx_putstr( "\\ X /" ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( x+6, y ); | |||||
ee_putchar( ',' ); | |||||
ee_goto( x+1, y+1 ); | |||||
ee_putstr( "\\ X /" ); | |||||
break; | break; | ||||
case 7: | case 7: | ||||
case 1: | case 1: | ||||
gfx_goto( x-1, y ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( x+7, y ); | |||||
gfx_putchar( ',' ); | |||||
gfx_goto( x, y+1 ); | |||||
gfx_putstr( "`- X -'" ); | |||||
ee_goto( x-1, y ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( x+7, y ); | |||||
ee_putchar( ',' ); | |||||
ee_goto( x, y+1 ); | |||||
ee_putstr( "`- X -'" ); | |||||
break; | break; | ||||
case 6: | case 6: | ||||
case 2: | case 2: | ||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "`-- X --'" ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "`-- X --'" ); | |||||
break; | break; | ||||
case 5: | case 5: | ||||
case 3: | case 3: | ||||
gfx_goto( x, y+1 ); | |||||
gfx_putstr( ",- X -." ); | |||||
gfx_goto( x-1, y+2 ); | |||||
gfx_putchar( '\'' ); | |||||
gfx_goto( x+7, y+2 ); | |||||
gfx_putchar( '`' ); | |||||
ee_goto( x, y+1 ); | |||||
ee_putstr( ",- X -." ); | |||||
ee_goto( x-1, y+2 ); | |||||
ee_putchar( '\'' ); | |||||
ee_goto( x+7, y+2 ); | |||||
ee_putchar( '`' ); | |||||
break; | break; | ||||
case 4: | case 4: | ||||
gfx_goto( x+1, y+1 ); | |||||
gfx_putstr( ", X ." ); | |||||
gfx_goto( x, y+2 ); | |||||
gfx_putchar( '/' ); | |||||
gfx_goto( x+6, y+2 ); | |||||
gfx_putchar( '\\' ); | |||||
ee_goto( x+1, y+1 ); | |||||
ee_putstr( ", X ." ); | |||||
ee_goto( x, y+2 ); | |||||
ee_putchar( '/' ); | |||||
ee_goto( x+6, y+2 ); | |||||
ee_putchar( '\\' ); | |||||
break; | break; | ||||
} | } | ||||
gfx_goto( x+2, y+2 ); | |||||
gfx_putstr( "`V'" ); | |||||
ee_goto( x+2, y+2 ); | |||||
ee_putstr( "`V'" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x+2, y+1 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_goto( x+4, y+1 ); | |||||
gfx_putchar( 'o' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x+2, y+1 ); | |||||
ee_putchar( 'o' ); | |||||
ee_goto( x+4, y+1 ); | |||||
ee_putchar( 'o' ); | |||||
} | } | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: bonus.c,v 1.3 2002/12/22 18:44:12 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -43,30 +43,30 @@ void draw_bonus( game *g, bonus *bo ) | |||||
switch( bo->type[i] ) | switch( bo->type[i] ) | ||||
{ | { | ||||
case BONUS_GREEN: | case BONUS_GREEN: | ||||
gfx_color( (bo->n[i]/2 % 3) ? GREEN : WHITE ); | |||||
gfx_goto( bo->x[i]+1, bo->y[i]-1 ); | |||||
gfx_putchar( '_' ); | |||||
gfx_goto( bo->x[i], bo->y[i] ); | |||||
gfx_putstr( "/ \\" ); | |||||
gfx_goto( bo->x[i], bo->y[i]+1 ); | |||||
gfx_putstr( "\\_/" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( bo->x[i]+1, bo->y[i] ); | |||||
gfx_putchar( 'g' ); | |||||
ee_color( (bo->n[i]/2 % 3) ? EE_GREEN : EE_WHITE ); | |||||
ee_goto( bo->x[i]+1, bo->y[i]-1 ); | |||||
ee_putchar( '_' ); | |||||
ee_goto( bo->x[i], bo->y[i] ); | |||||
ee_putstr( "/ \\" ); | |||||
ee_goto( bo->x[i], bo->y[i]+1 ); | |||||
ee_putstr( "\\_/" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( bo->x[i]+1, bo->y[i] ); | |||||
ee_putchar( 'g' ); | |||||
break; | break; | ||||
case BONUS_LIFE: | case BONUS_LIFE: | ||||
gfx_color( (bo->n[i] % 3) ? RED : WHITE ); | |||||
gfx_goto( bo->x[i]+1, bo->y[i]-1 ); | |||||
gfx_putchar( '_' ); | |||||
gfx_goto( bo->x[i]+3, bo->y[i]-1 ); | |||||
gfx_putchar( '_' ); | |||||
gfx_goto( bo->x[i], bo->y[i] ); | |||||
gfx_putstr( "( ' )" ); | |||||
gfx_goto( bo->x[i]+1, bo->y[i]+1 ); | |||||
gfx_putstr( "`v'" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( bo->x[i]+3, bo->y[i] ); | |||||
gfx_putchar( '^' ); | |||||
ee_color( (bo->n[i] % 3) ? EE_RED : EE_WHITE ); | |||||
ee_goto( bo->x[i]+1, bo->y[i]-1 ); | |||||
ee_putchar( '_' ); | |||||
ee_goto( bo->x[i]+3, bo->y[i]-1 ); | |||||
ee_putchar( '_' ); | |||||
ee_goto( bo->x[i], bo->y[i] ); | |||||
ee_putstr( "( ' )" ); | |||||
ee_goto( bo->x[i]+1, bo->y[i]+1 ); | |||||
ee_putstr( "`v'" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( bo->x[i]+3, bo->y[i] ); | |||||
ee_putchar( '^' ); | |||||
break; | break; | ||||
case BONUS_NONE: | case BONUS_NONE: | ||||
break; | break; | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002-2003 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002-2003 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: box.c,v 1.1 2003/02/09 11:17:40 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -41,7 +41,7 @@ void draw_box( game *g, box *b ) | |||||
{ | { | ||||
int i, j, frame; | int i, j, frame; | ||||
gfx_color( YELLOW ); | |||||
ee_color( EE_YELLOW ); | |||||
/* Draw the thin horizontal line */ | /* Draw the thin horizontal line */ | ||||
if( b->frame < 8 ) | if( b->frame < 8 ) | ||||
@@ -50,8 +50,8 @@ void draw_box( game *g, box *b ) | |||||
i < b->x + b->w * b->frame / 16 ; | i < b->x + b->w * b->frame / 16 ; | ||||
i++ ) | i++ ) | ||||
{ | { | ||||
gfx_goto( i, b->y ); | |||||
gfx_putchar( 'X' ); | |||||
ee_goto( i, b->y ); | |||||
ee_putchar( 'X' ); | |||||
} | } | ||||
return; | return; | ||||
@@ -64,23 +64,23 @@ void draw_box( game *g, box *b ) | |||||
i < b->x + b->w / 2 ; | i < b->x + b->w / 2 ; | ||||
i++ ) | i++ ) | ||||
{ | { | ||||
gfx_goto( i, b->y - b->h * (frame - 8) / 8 ); | |||||
gfx_putchar( 'X' ); | |||||
gfx_goto( i, b->y + b->h * (frame - 8) / 8 ); | |||||
gfx_putchar( 'X' ); | |||||
ee_goto( i, b->y - b->h * (frame - 8) / 8 ); | |||||
ee_putchar( 'X' ); | |||||
ee_goto( i, b->y + b->h * (frame - 8) / 8 ); | |||||
ee_putchar( 'X' ); | |||||
} | } | ||||
for( j = b->y - b->h * (frame - 8) / 8 ; | for( j = b->y - b->h * (frame - 8) / 8 ; | ||||
j < b->y + b->h * (frame - 8) / 8 ; | j < b->y + b->h * (frame - 8) / 8 ; | ||||
j++ ) | j++ ) | ||||
{ | { | ||||
gfx_goto( b->x - b->w / 2, j ); | |||||
gfx_putchar( 'X' ); | |||||
gfx_goto( b->x + b->w / 2 - 1, j ); | |||||
gfx_putchar( 'X' ); | |||||
ee_goto( b->x - b->w / 2, j ); | |||||
ee_putchar( 'X' ); | |||||
ee_goto( b->x + b->w / 2 - 1, j ); | |||||
ee_putchar( 'X' ); | |||||
} | } | ||||
gfx_color( BLACK ); | |||||
ee_color( EE_BLACK ); | |||||
for( j = b->y - b->h * (frame - 8) / 8 + 1 ; | for( j = b->y - b->h * (frame - 8) / 8 + 1 ; | ||||
j < b->y + b->h * (frame - 8) / 8 ; | j < b->y + b->h * (frame - 8) / 8 ; | ||||
@@ -90,8 +90,8 @@ void draw_box( game *g, box *b ) | |||||
i < b->x + b->w / 2 - 1 ; | i < b->x + b->w / 2 - 1 ; | ||||
i++ ) | i++ ) | ||||
{ | { | ||||
gfx_goto( i, j ); | |||||
gfx_putchar( 'X' ); | |||||
ee_goto( i, j ); | |||||
ee_putchar( 'X' ); | |||||
} | } | ||||
} | } | ||||
@@ -101,19 +101,19 @@ void draw_box( game *g, box *b ) | |||||
} | } | ||||
/* Draw the text inside the frame */ | /* Draw the text inside the frame */ | ||||
gfx_color( YELLOW ); | |||||
ee_color( EE_YELLOW ); | |||||
/* FIXME: use a font */ | /* FIXME: use a font */ | ||||
gfx_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 2 ); | |||||
gfx_putstr( "XXXX. .XXXX X X .XXXX .XXXX XXXX." ); | |||||
gfx_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 3 ); | |||||
gfx_putstr( "X `X X' X X X X' X' X `X" ); | |||||
gfx_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 4 ); | |||||
gfx_putstr( "XXXX' XXXXX X X `XXX XXXX X X" ); | |||||
gfx_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 5 ); | |||||
gfx_putstr( "X' X' `X X. ,X `X X' X ,X" ); | |||||
gfx_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 6 ); | |||||
gfx_putstr( "X X X `XXXX XXXX' `XXXX XXXX'" ); | |||||
ee_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 2 ); | |||||
ee_putstr( "XXXX. .XXXX X X .XXXX .XXXX XXXX." ); | |||||
ee_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 3 ); | |||||
ee_putstr( "X `X X' X X X X' X' X `X" ); | |||||
ee_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 4 ); | |||||
ee_putstr( "XXXX' XXXXX X X `XXX XXXX X X" ); | |||||
ee_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 5 ); | |||||
ee_putstr( "X' X' `X X. ,X `X X' X ,X" ); | |||||
ee_goto( b->x - b->w / 2 + 12, b->y - b->h / 2 + 6 ); | |||||
ee_putstr( "X X X `XXXX XXXX' `XXXX XXXX'" ); | |||||
} | } | ||||
void free_box( box *b ) | void free_box( box *b ) | ||||
@@ -33,16 +33,16 @@ void ceo_alert( game *g ) | |||||
while( !end ) | while( !end ) | ||||
{ | { | ||||
clear_graphics( g ); | |||||
ee_clear(); | |||||
if( get_key() == '\t' ) | |||||
if( ee_get_key() == '\t' ) | |||||
{ | { | ||||
end = 1; | end = 1; | ||||
} | } | ||||
fprintf( stderr, "foo\n" ); | fprintf( stderr, "foo\n" ); | ||||
refresh_graphics(); | |||||
ee_refresh(); | |||||
usleep( 40000 ); | usleep( 40000 ); | ||||
} | } | ||||
@@ -42,28 +42,7 @@ | |||||
/* | /* | ||||
* Graphics primitives | * Graphics primitives | ||||
*/ | */ | ||||
#ifdef USE_SLANG | |||||
# include <slang.h> | |||||
# define gfx_color(x) SLsmg_set_color(x) | |||||
# define gfx_goto(x,y) SLsmg_gotorc(y,x) | |||||
# define gfx_putchar(x) SLsmg_write_char(x) | |||||
# define gfx_putstr(x) SLsmg_write_string(x) | |||||
#elif USE_NCURSES | |||||
#define box box_other | |||||
# include <curses.h> | |||||
#undef box | |||||
# define gfx_color(x) attrset(COLOR_PAIR(x)) | |||||
# define gfx_goto(x,y) move(y,x) | |||||
# define gfx_putchar(x) addch(x) | |||||
# define gfx_putstr(x) addstr(x) | |||||
#else | |||||
# define gfx_color(x) (void)(x) | |||||
# define gfx_goto(x,y) do{ (void)(x); (void)(y); } while(0) | |||||
# define gfx_putchar(x) (void)(x) | |||||
# define gfx_putstr(x) (void)(x) | |||||
#endif | |||||
#define gfx_putcharTO(x,y,c) do{ gfx_goto(x,y); gfx_putchar(c); }while(0) | |||||
#include "ee.h" | |||||
/* | /* | ||||
* Useful macros | * Useful macros | ||||
@@ -164,17 +143,6 @@ typedef struct | |||||
} game; | } game; | ||||
#define BLACK 1 | |||||
#define GREEN 2 | |||||
#define YELLOW 3 | |||||
#define WHITE 4 | |||||
#define RED 5 | |||||
#define GRAY 6 | |||||
#define LIGHTGRAY 7 | |||||
#define BLUE 8 | |||||
#define CYAN 9 | |||||
#define MAGENTA 10 | |||||
/* | /* | ||||
* From aliens.c | * From aliens.c | ||||
*/ | */ | ||||
@@ -218,16 +186,6 @@ void add_explosion( game *g, explosions *ex, int x, int y, int vx, int vy, int t | |||||
void draw_explosions( game *g, explosions *ex ); | void draw_explosions( game *g, explosions *ex ); | ||||
void update_explosions( game *g, explosions *ex ); | void update_explosions( game *g, explosions *ex ); | ||||
/* | |||||
* From graphics.c | |||||
*/ | |||||
int init_graphics( void ); | |||||
void init_game( game *g ); | |||||
char get_key( void ); | |||||
void clear_graphics( game *g ); | |||||
void refresh_graphics( void ); | |||||
void end_graphics( void ); | |||||
/* | /* | ||||
* From math.c | * From math.c | ||||
*/ | */ | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: explosions.c,v 1.4 2002/12/22 18:44:12 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -71,28 +71,28 @@ void draw_explosions( game *g, explosions *ex ) | |||||
for( i = 0; i < EXPLOSIONS; i++ ) | for( i = 0; i < EXPLOSIONS; i++ ) | ||||
{ | { | ||||
#if 0 | #if 0 | ||||
gfx_color( GREEN ); | |||||
gfx_goto( ex->x[i] + 3, ex->y[i] ); | |||||
ee_color( GREEN ); | |||||
ee_goto( ex->x[i] + 3, ex->y[i] ); | |||||
switch( GET_RAND(0,3) ) | switch( GET_RAND(0,3) ) | ||||
{ | { | ||||
case 0: | case 0: | ||||
gfx_putchar( 'p' ); | |||||
gfx_putchar( 'i' ); | |||||
gfx_putchar( 'f' ); | |||||
ee_putchar( 'p' ); | |||||
ee_putchar( 'i' ); | |||||
ee_putchar( 'f' ); | |||||
break; | break; | ||||
case 1: | case 1: | ||||
gfx_putchar( 'p' ); | |||||
gfx_putchar( 'a' ); | |||||
gfx_putchar( 'f' ); | |||||
ee_putchar( 'p' ); | |||||
ee_putchar( 'a' ); | |||||
ee_putchar( 'f' ); | |||||
break; | break; | ||||
case 2: | case 2: | ||||
gfx_putchar( 'p' ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_putchar( 'u' ); | |||||
gfx_putchar( 'f' ); | |||||
ee_putchar( 'p' ); | |||||
ee_putchar( 'o' ); | |||||
ee_putchar( 'u' ); | |||||
ee_putchar( 'f' ); | |||||
break; | break; | ||||
} | } | ||||
gfx_putchar( '!' ); | |||||
ee_putchar( '!' ); | |||||
#endif | #endif | ||||
switch( ex->type[i] ) | switch( ex->type[i] ) | ||||
@@ -138,116 +138,116 @@ static void draw_small_explosion( int x, int y, int frame ) | |||||
switch( frame ) | switch( frame ) | ||||
{ | { | ||||
case 6: | case 6: | ||||
gfx_color( YELLOW ); | |||||
gfx_goto( x, y ); | |||||
gfx_putchar( '+' ); | |||||
ee_color( EE_YELLOW ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '+' ); | |||||
break; | break; | ||||
case 5: | case 5: | ||||
gfx_color( YELLOW ); | |||||
gfx_goto( x, y ); | |||||
gfx_putchar( 'o' ); | |||||
ee_color( EE_YELLOW ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( 'o' ); | |||||
break; | break; | ||||
case 4: | case 4: | ||||
gfx_color( YELLOW ); | |||||
gfx_goto( x, y-1 ); | |||||
gfx_putchar( '_' ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( ")_(" ); | |||||
ee_color( EE_YELLOW ); | |||||
ee_goto( x, y-1 ); | |||||
ee_putchar( '_' ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( ")_(" ); | |||||
break; | break; | ||||
case 3: | case 3: | ||||
gfx_color( YELLOW ); | |||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( "._," ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( ")_(" ); | |||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "\' `" ); | |||||
ee_color( EE_YELLOW ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( "._," ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( ")_(" ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "\' `" ); | |||||
break; | break; | ||||
case 2: | case 2: | ||||
gfx_color( YELLOW ); | |||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( ".v," ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( "> <" ); | |||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "\'^`" ); | |||||
ee_color( EE_YELLOW ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( ".v," ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( "> <" ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "\'^`" ); | |||||
break; | break; | ||||
case 1: | case 1: | ||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( ". ," ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( " " ); | |||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "\' `" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( ". ," ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( " " ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "\' `" ); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
static void draw_medium_explosion( int x, int y, int frame ) | static void draw_medium_explosion( int x, int y, int frame ) | ||||
{ | { | ||||
gfx_color( YELLOW ); | |||||
ee_color( EE_YELLOW ); | |||||
switch( frame ) | switch( frame ) | ||||
{ | { | ||||
case 10: | case 10: | ||||
gfx_goto( x, y ); | |||||
gfx_putchar( '+' ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '+' ); | |||||
break; | break; | ||||
case 9: | case 9: | ||||
gfx_goto( x, y ); | |||||
gfx_putchar( 'o' ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( 'o' ); | |||||
break; | break; | ||||
case 8: | case 8: | ||||
gfx_goto( x, y-1 ); | |||||
gfx_putchar( '_' ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( ")_(" ); | |||||
ee_goto( x, y-1 ); | |||||
ee_putchar( '_' ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( ")_(" ); | |||||
break; | break; | ||||
case 7: | case 7: | ||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( "._," ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( ")_(" ); | |||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "\' `" ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( "._," ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( ")_(" ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "\' `" ); | |||||
break; | break; | ||||
case 6: | case 6: | ||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( ".v," ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( "> <" ); | |||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "\'^`" ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( ".v," ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( "> <" ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "\'^`" ); | |||||
break; | break; | ||||
case 5: | case 5: | ||||
gfx_color( RED ); | |||||
ee_color( EE_RED ); | |||||
case 4: | case 4: | ||||
gfx_goto( x-2, y-1 ); | |||||
gfx_putstr( "_\\~/_" ); | |||||
gfx_goto( x-2, y ); | |||||
gfx_putstr( "> <" ); | |||||
gfx_goto( x-2, y+1 ); | |||||
gfx_putstr( "~/_\\~" ); | |||||
ee_goto( x-2, y-1 ); | |||||
ee_putstr( "_\\~/_" ); | |||||
ee_goto( x-2, y ); | |||||
ee_putstr( "> <" ); | |||||
ee_goto( x-2, y+1 ); | |||||
ee_putstr( "~/_\\~" ); | |||||
break; | break; | ||||
case 3: | case 3: | ||||
gfx_color( RED ); | |||||
ee_color( EE_RED ); | |||||
case 2: | case 2: | ||||
gfx_goto( x-2, y-1 ); | |||||
gfx_putstr( "_\\ /_" ); | |||||
gfx_goto( x-2, y ); | |||||
gfx_putstr( "_ _" ); | |||||
gfx_goto( x-2, y+1 ); | |||||
gfx_putstr( " / \\ " ); | |||||
ee_goto( x-2, y-1 ); | |||||
ee_putstr( "_\\ /_" ); | |||||
ee_goto( x-2, y ); | |||||
ee_putstr( "_ _" ); | |||||
ee_goto( x-2, y+1 ); | |||||
ee_putstr( " / \\ " ); | |||||
break; | break; | ||||
case 1: | case 1: | ||||
gfx_color( WHITE ); | |||||
gfx_goto( x-2, y-1 ); | |||||
gfx_putstr( ". \' ," ); | |||||
gfx_goto( x-2, y ); | |||||
gfx_putstr( " " ); | |||||
gfx_goto( x-2, y+1 ); | |||||
gfx_putstr( "\' . `" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-2, y-1 ); | |||||
ee_putstr( ". \' ," ); | |||||
ee_goto( x-2, y ); | |||||
ee_putstr( " " ); | |||||
ee_goto( x-2, y+1 ); | |||||
ee_putstr( "\' . `" ); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -37,19 +37,20 @@ int main (int argc, char **argv) | |||||
srand(time(NULL)); | srand(time(NULL)); | ||||
if( init_graphics() ) | |||||
if( ee_init() ) | |||||
{ | { | ||||
return 1; | return 1; | ||||
} | } | ||||
/* Initialize our program */ | /* Initialize our program */ | ||||
init_game(g); | |||||
g->w = ee_get_width(); | |||||
g->h = ee_get_height(); | |||||
/* Go ! */ | /* Go ! */ | ||||
start_game(g); | start_game(g); | ||||
/* Clean up */ | /* Clean up */ | ||||
end_graphics(); | |||||
ee_end(); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -83,7 +84,7 @@ static void start_game (game *g) | |||||
{ | { | ||||
char key; | char key; | ||||
while( ( key = get_key() ) ) | |||||
while( ( key = ee_get_key() ) ) | |||||
{ | { | ||||
switch( key ) | switch( key ) | ||||
{ | { | ||||
@@ -214,7 +215,7 @@ static void start_game (game *g) | |||||
} | } | ||||
/* Clear screen */ | /* Clear screen */ | ||||
clear_graphics( g ); | |||||
ee_clear(); | |||||
/* Print starfield, tunnel, aliens, player and explosions */ | /* Print starfield, tunnel, aliens, player and explosions */ | ||||
draw_starfield( g, g->sf ); | draw_starfield( g, g->sf ); | ||||
@@ -234,7 +235,7 @@ static void start_game (game *g) | |||||
} | } | ||||
/* Refresh */ | /* Refresh */ | ||||
refresh_graphics(); | |||||
ee_refresh(); | |||||
purcompteur++; | purcompteur++; | ||||
} | } | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: overlay.c,v 1.3 2003/02/09 11:17:40 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -30,57 +30,57 @@ void draw_status( game *g ) | |||||
static char dashes30[] = "=============================="; | static char dashes30[] = "=============================="; | ||||
/* Draw life jauge */ | /* Draw life jauge */ | ||||
gfx_color( GRAY ); | |||||
gfx_goto( 4, 1 ); | |||||
gfx_putstr( dots30 ); | |||||
ee_color( EE_GRAY ); | |||||
ee_goto( 4, 1 ); | |||||
ee_putstr( dots30 ); | |||||
if( g->p->life > MAX_LIFE * 7 / 10 ) | if( g->p->life > MAX_LIFE * 7 / 10 ) | ||||
{ | { | ||||
gfx_color( GREEN ); | |||||
ee_color( EE_GREEN ); | |||||
} | } | ||||
else if( g->p->life > MAX_LIFE * 3 / 10 ) | else if( g->p->life > MAX_LIFE * 3 / 10 ) | ||||
{ | { | ||||
gfx_color( YELLOW ); | |||||
ee_color( EE_YELLOW ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
gfx_color( RED ); | |||||
ee_color( EE_RED ); | |||||
} | } | ||||
gfx_goto( 4, 1 ); | |||||
gfx_putstr( dashes30 + ( MAX_LIFE - g->p->life ) * 30 / MAX_LIFE ); | |||||
ee_goto( 4, 1 ); | |||||
ee_putstr( dashes30 + ( MAX_LIFE - g->p->life ) * 30 / MAX_LIFE ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( 1, 1 ); | |||||
gfx_putstr( "L |" ); | |||||
gfx_goto( 34, 1 ); | |||||
gfx_putstr( "|" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( 1, 1 ); | |||||
ee_putstr( "L |" ); | |||||
ee_goto( 34, 1 ); | |||||
ee_putstr( "|" ); | |||||
/* Draw weapon jauge */ | /* Draw weapon jauge */ | ||||
gfx_color( GRAY ); | |||||
gfx_goto( 42, 1 ); | |||||
gfx_putstr( dots30 + 10 ); | |||||
ee_color( EE_GRAY ); | |||||
ee_goto( 42, 1 ); | |||||
ee_putstr( dots30 + 10 ); | |||||
if( g->p->special > MAX_SPECIAL * 9 / 10 ) | if( g->p->special > MAX_SPECIAL * 9 / 10 ) | ||||
{ | { | ||||
gfx_color( WHITE ); | |||||
ee_color( EE_WHITE ); | |||||
} | } | ||||
else if( g->p->special > MAX_SPECIAL * 3 / 10 ) | else if( g->p->special > MAX_SPECIAL * 3 / 10 ) | ||||
{ | { | ||||
gfx_color( CYAN ); | |||||
ee_color( EE_CYAN ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
gfx_color( BLUE ); | |||||
ee_color( EE_BLUE ); | |||||
} | } | ||||
gfx_goto( 42, 1 ); | |||||
gfx_putstr( dashes30 + 10 + ( MAX_SPECIAL - g->p->special ) * 20 / MAX_SPECIAL ); | |||||
ee_goto( 42, 1 ); | |||||
ee_putstr( dashes30 + 10 + ( MAX_SPECIAL - g->p->special ) * 20 / MAX_SPECIAL ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( 39, 1 ); | |||||
gfx_putstr( "S |" ); | |||||
gfx_goto( 62, 1 ); | |||||
gfx_putstr( "|" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( 39, 1 ); | |||||
ee_putstr( "S |" ); | |||||
ee_goto( 62, 1 ); | |||||
ee_putstr( "|" ); | |||||
} | } | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: player.c,v 1.8 2002/12/23 16:21:38 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -53,18 +53,18 @@ void draw_player( game *g, player *p ) | |||||
return; | return; | ||||
} | } | ||||
gfx_goto( p->x + 2, p->y - 2 ); | |||||
gfx_color( GREEN ); | |||||
gfx_putstr( "/\\" ); | |||||
gfx_goto( p->x + 1, p->y - 1 ); | |||||
gfx_putchar( '(' ); | |||||
gfx_color( YELLOW ); | |||||
gfx_putstr( "()" ); | |||||
gfx_color( GREEN ); | |||||
gfx_putchar( ')' ); | |||||
gfx_goto( p->x, p->y ); | |||||
gfx_color( GREEN ); | |||||
gfx_putstr( "I<__>I" ); | |||||
ee_goto( p->x + 2, p->y - 2 ); | |||||
ee_color( EE_GREEN ); | |||||
ee_putstr( "/\\" ); | |||||
ee_goto( p->x + 1, p->y - 1 ); | |||||
ee_putchar( '(' ); | |||||
ee_color( EE_YELLOW ); | |||||
ee_putstr( "()" ); | |||||
ee_color( EE_GREEN ); | |||||
ee_putchar( ')' ); | |||||
ee_goto( p->x, p->y ); | |||||
ee_color( EE_GREEN ); | |||||
ee_putstr( "I<__>I" ); | |||||
} | } | ||||
void update_player( game *g, player *p ) | void update_player( game *g, player *p ) | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: starfield.c,v 1.5 2002/12/23 09:28:37 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -51,9 +51,9 @@ void draw_starfield( game *g, starfield *s ) | |||||
{ | { | ||||
if( s[i].x >= 0 ) | if( s[i].x >= 0 ) | ||||
{ | { | ||||
gfx_color( s[i].c ); | |||||
gfx_goto( s[i].x, s[i].y ); | |||||
gfx_putchar( s[i].ch ); | |||||
ee_color( s[i].c ); | |||||
ee_goto( s[i].x, s[i].y ); | |||||
ee_putchar( s[i].ch ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: tunnel.c,v 1.8 2002/12/23 12:47:36 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -71,7 +71,7 @@ void draw_tunnel( game *g, tunnel *t ) | |||||
int i, j; | int i, j; | ||||
char c; | char c; | ||||
gfx_color( GREEN ); | |||||
ee_color( EE_GREEN ); | |||||
/* Left border */ | /* Left border */ | ||||
for( i = 0; i < g->h ; i++ ) | for( i = 0; i < g->h ; i++ ) | ||||
@@ -90,15 +90,15 @@ void draw_tunnel( game *g, tunnel *t ) | |||||
c = ( i == 0 || t->left[i] > t->left[i-1] ) ? '\\' : '<'; | c = ( i == 0 || t->left[i] > t->left[i-1] ) ? '\\' : '<'; | ||||
} | } | ||||
gfx_goto( t->left[i] + 1, i ); | |||||
gfx_putchar( c ); | |||||
ee_goto( t->left[i] + 1, i ); | |||||
ee_putchar( c ); | |||||
if( i + 1 < g->h ) | if( i + 1 < g->h ) | ||||
{ | { | ||||
for( j = 1; j < t->left[i+1] - t->left[i]; j++ ) | for( j = 1; j < t->left[i+1] - t->left[i]; j++ ) | ||||
{ | { | ||||
gfx_goto( t->left[i] + j + 1, i ); | |||||
gfx_putchar( '_' ); | |||||
ee_goto( t->left[i] + j + 1, i ); | |||||
ee_putchar( '_' ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -124,24 +124,24 @@ void draw_tunnel( game *g, tunnel *t ) | |||||
{ | { | ||||
for( j = 1; j < t->right[i] - t->right[i+1]; j++ ) | for( j = 1; j < t->right[i] - t->right[i+1]; j++ ) | ||||
{ | { | ||||
gfx_goto( t->right[i+1] + j - 1, i ); | |||||
gfx_putchar( '_' ); | |||||
ee_goto( t->right[i+1] + j - 1, i ); | |||||
ee_putchar( '_' ); | |||||
} | } | ||||
} | } | ||||
gfx_goto( t->right[i] - 1, i ); | |||||
gfx_putchar( c ); | |||||
ee_goto( t->right[i] - 1, i ); | |||||
ee_putchar( c ); | |||||
} | } | ||||
gfx_color( RED ); | |||||
ee_color( EE_RED ); | |||||
/* Left concrete */ | /* Left concrete */ | ||||
for( i = 0; i < g->h ; i++ ) | for( i = 0; i < g->h ; i++ ) | ||||
{ | { | ||||
for( j = 0 ; j <= t->left[i]; j++ ) | for( j = 0 ; j <= t->left[i]; j++ ) | ||||
{ | { | ||||
gfx_goto( j, i ); | |||||
gfx_putchar( '#' ); | |||||
ee_goto( j, i ); | |||||
ee_putchar( '#' ); | |||||
} | } | ||||
} | } | ||||
@@ -150,8 +150,8 @@ void draw_tunnel( game *g, tunnel *t ) | |||||
{ | { | ||||
for( j = t->right[i] ; j < g->w ; j++ ) | for( j = t->right[i] ; j < g->w ; j++ ) | ||||
{ | { | ||||
gfx_goto( j, i ); | |||||
gfx_putchar( '#' ); | |||||
ee_goto( j, i ); | |||||
ee_putchar( '#' ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -3,7 +3,7 @@ | |||||
* Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2002 Sam Hocevar <sam@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id: weapons.c,v 1.13 2002/12/23 16:44:28 sam Exp $ | |||||
* $Id$ | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
@@ -49,35 +49,35 @@ void draw_weapons( game *g, weapons *wp ) | |||||
switch( wp->type[i] ) | switch( wp->type[i] ) | ||||
{ | { | ||||
case WEAPON_LASER: | case WEAPON_LASER: | ||||
gfx_color( WHITE ); | |||||
gfx_goto( wp->x[i] >> 4, wp->y[i] >> 4 ); | |||||
gfx_putchar( '|' ); | |||||
gfx_color( CYAN ); | |||||
gfx_goto( wp->x[i] >> 4, (wp->y[i] >> 4) + 1 ); | |||||
gfx_putchar( '|' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( wp->x[i] >> 4, wp->y[i] >> 4 ); | |||||
ee_putchar( '|' ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( wp->x[i] >> 4, (wp->y[i] >> 4) + 1 ); | |||||
ee_putchar( '|' ); | |||||
break; | break; | ||||
case WEAPON_SEEKER: | case WEAPON_SEEKER: | ||||
gfx_color( CYAN ); | |||||
gfx_goto( wp->x3[i] >> 4, wp->y3[i] >> 4 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( wp->x2[i] >> 4, wp->y2[i] >> 4 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( wp->x[i] >> 4, wp->y[i] >> 4 ); | |||||
gfx_putchar( '@' ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( wp->x3[i] >> 4, wp->y3[i] >> 4 ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( wp->x2[i] >> 4, wp->y2[i] >> 4 ); | |||||
ee_putchar( 'o' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( wp->x[i] >> 4, wp->y[i] >> 4 ); | |||||
ee_putchar( '@' ); | |||||
break; | break; | ||||
case WEAPON_BOMB: | case WEAPON_BOMB: | ||||
gfx_color( GRAY ); | |||||
gfx_goto( (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( wp->x3[i] >> 4, wp->y3[i] >> 4 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( wp->x2[i] >> 4, wp->y2[i] >> 4 ); | |||||
gfx_putchar( '.' ); | |||||
ee_color( EE_GRAY ); | |||||
ee_goto( (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4 ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4 ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4 ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( wp->x3[i] >> 4, wp->y3[i] >> 4 ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( wp->x2[i] >> 4, wp->y2[i] >> 4 ); | |||||
ee_putchar( '.' ); | |||||
draw_bomb( wp->x[i] >> 4, wp->y[i] >> 4, wp->vx[i], wp->vy[i] ); | draw_bomb( wp->x[i] >> 4, wp->y[i] >> 4, wp->vx[i], wp->vy[i] ); | ||||
break; | break; | ||||
case WEAPON_FRAGBOMB: | case WEAPON_FRAGBOMB: | ||||
@@ -289,7 +289,7 @@ void add_weapon( game *g, weapons *wp, int x, int y, int vx, int vy, int type ) | |||||
static void draw_bomb( int x, int y, int vx, int vy ) | static void draw_bomb( int x, int y, int vx, int vy ) | ||||
{ | { | ||||
vy *= 2; | vy *= 2; | ||||
gfx_color( CYAN ); | |||||
ee_color( EE_CYAN ); | |||||
if( vx > vy ) | if( vx > vy ) | ||||
{ | { | ||||
@@ -298,39 +298,39 @@ static void draw_bomb( int x, int y, int vx, int vy ) | |||||
if( vy > vx/4 ) | if( vy > vx/4 ) | ||||
{ | { | ||||
/* -1pi/6 */ | /* -1pi/6 */ | ||||
gfx_goto( x-4, y-1 ); | |||||
gfx_putstr( "/`-." ); | |||||
gfx_goto( x-4, y ); | |||||
gfx_putstr( "`-._\\" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( "_\\" ); | |||||
gfx_goto( x, y+1 ); | |||||
gfx_putchar( '`' ); | |||||
ee_goto( x-4, y-1 ); | |||||
ee_putstr( "/`-." ); | |||||
ee_goto( x-4, y ); | |||||
ee_putstr( "`-._\\" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( "_\\" ); | |||||
ee_goto( x, y+1 ); | |||||
ee_putchar( '`' ); | |||||
} | } | ||||
else if( vy < -vx/4 ) | else if( vy < -vx/4 ) | ||||
{ | { | ||||
/* 1pi/6 */ | /* 1pi/6 */ | ||||
gfx_goto( x-4, y ); | |||||
gfx_putstr( ",-' " ); | |||||
gfx_goto( x-4, y+1 ); | |||||
gfx_putstr( "\\,-'" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( "_," ); | |||||
gfx_goto( x, y ); | |||||
gfx_putchar( '/' ); | |||||
ee_goto( x-4, y ); | |||||
ee_putstr( ",-' " ); | |||||
ee_goto( x-4, y+1 ); | |||||
ee_putstr( "\\,-'" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( "_," ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '/' ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
/* 0pi/6 */ | /* 0pi/6 */ | ||||
gfx_goto( x-4, y-1 ); | |||||
gfx_putstr( "____" ); | |||||
gfx_goto( x-5, y ); | |||||
gfx_putstr( "|____" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y ); | |||||
gfx_putchar( '>' ); | |||||
ee_goto( x-4, y-1 ); | |||||
ee_putstr( "____" ); | |||||
ee_goto( x-5, y ); | |||||
ee_putstr( "|____" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '>' ); | |||||
} | } | ||||
} | } | ||||
else /* top quarter */ | else /* top quarter */ | ||||
@@ -338,43 +338,43 @@ static void draw_bomb( int x, int y, int vx, int vy ) | |||||
if( vx > -vy/4 ) | if( vx > -vy/4 ) | ||||
{ | { | ||||
/* 2pi/6 */ | /* 2pi/6 */ | ||||
gfx_goto( x-2, y ); | |||||
gfx_putstr( "/ " ); | |||||
gfx_goto( x-3, y+1 ); | |||||
gfx_putstr( "/ /" ); | |||||
gfx_goto( x-3, y+2 ); | |||||
gfx_putstr( "`'" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( "_," ); | |||||
gfx_goto( x, y ); | |||||
gfx_putchar( '|' ); | |||||
ee_goto( x-2, y ); | |||||
ee_putstr( "/ " ); | |||||
ee_goto( x-3, y+1 ); | |||||
ee_putstr( "/ /" ); | |||||
ee_goto( x-3, y+2 ); | |||||
ee_putstr( "`'" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( "_," ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '|' ); | |||||
} | } | ||||
else if( vx < vy/4 ) | else if( vx < vy/4 ) | ||||
{ | { | ||||
/* 4pi/6 */ | /* 4pi/6 */ | ||||
gfx_goto( x+1, y ); | |||||
gfx_putstr( " \\" ); | |||||
gfx_goto( x+1, y+1 ); | |||||
gfx_putstr( "\\ \\" ); | |||||
gfx_goto( x+2, y+2 ); | |||||
gfx_putstr( "`'" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y-1 ); | |||||
gfx_putstr( "._" ); | |||||
gfx_goto( x, y ); | |||||
gfx_putchar( '|' ); | |||||
ee_goto( x+1, y ); | |||||
ee_putstr( " \\" ); | |||||
ee_goto( x+1, y+1 ); | |||||
ee_putstr( "\\ \\" ); | |||||
ee_goto( x+2, y+2 ); | |||||
ee_putstr( "`'" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y-1 ); | |||||
ee_putstr( "._" ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '|' ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
/* 3pi/6 */ | /* 3pi/6 */ | ||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "| |" ); | |||||
gfx_goto( x-1, y+2 ); | |||||
gfx_putstr( "|_|" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( ",^." ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "| |" ); | |||||
ee_goto( x-1, y+2 ); | |||||
ee_putstr( "|_|" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( ",^." ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -385,41 +385,41 @@ static void draw_bomb( int x, int y, int vx, int vy ) | |||||
if( vx > vy/4 ) | if( vx > vy/4 ) | ||||
{ | { | ||||
/* -2pi/6 */ | /* -2pi/6 */ | ||||
gfx_goto( x-2, y-2 ); | |||||
gfx_putstr( ",." ); | |||||
gfx_goto( x-2, y-1 ); | |||||
gfx_putstr( "\\ \\" ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putchar( '\\' ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y ); | |||||
gfx_putstr( "_|" ); | |||||
ee_goto( x-2, y-2 ); | |||||
ee_putstr( ",." ); | |||||
ee_goto( x-2, y-1 ); | |||||
ee_putstr( "\\ \\" ); | |||||
ee_goto( x-1, y ); | |||||
ee_putchar( '\\' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y ); | |||||
ee_putstr( "_|" ); | |||||
} | } | ||||
else if( vx < -vy/4 ) | else if( vx < -vy/4 ) | ||||
{ | { | ||||
/* -4pi/6 */ | /* -4pi/6 */ | ||||
gfx_goto( x+1, y-2 ); | |||||
gfx_putstr( ",." ); | |||||
gfx_goto( x, y-1 ); | |||||
gfx_putstr( "/ /" ); | |||||
gfx_goto( x+1, y ); | |||||
gfx_putchar( '/' ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( "|_/" ); | |||||
ee_goto( x+1, y-2 ); | |||||
ee_putstr( ",." ); | |||||
ee_goto( x, y-1 ); | |||||
ee_putstr( "/ /" ); | |||||
ee_goto( x+1, y ); | |||||
ee_putchar( '/' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( "|_/" ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
/* -3pi/6 */ | /* -3pi/6 */ | ||||
gfx_goto( x, y-3 ); | |||||
gfx_putchar( '_' ); | |||||
gfx_goto( x-1, y-2 ); | |||||
gfx_putstr( "| |" ); | |||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( "| |" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y ); | |||||
gfx_putstr( "`v'" ); | |||||
ee_goto( x, y-3 ); | |||||
ee_putchar( '_' ); | |||||
ee_goto( x-1, y-2 ); | |||||
ee_putstr( "| |" ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( "| |" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y ); | |||||
ee_putstr( "`v'" ); | |||||
} | } | ||||
} | } | ||||
else /* left quarter */ | else /* left quarter */ | ||||
@@ -427,39 +427,39 @@ static void draw_bomb( int x, int y, int vx, int vy ) | |||||
if( vy > -vx/4 ) | if( vy > -vx/4 ) | ||||
{ | { | ||||
/* -5pi/6 */ | /* -5pi/6 */ | ||||
gfx_goto( x+1, y-1 ); | |||||
gfx_putstr( ",-'\\" ); | |||||
gfx_goto( x+2, y ); | |||||
gfx_putstr( ",-'" ); | |||||
gfx_goto( x, y+1 ); | |||||
gfx_putchar( '\'' ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y ); | |||||
gfx_putstr( "/_" ); | |||||
ee_goto( x+1, y-1 ); | |||||
ee_putstr( ",-'\\" ); | |||||
ee_goto( x+2, y ); | |||||
ee_putstr( ",-'" ); | |||||
ee_goto( x, y+1 ); | |||||
ee_putchar( '\'' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y ); | |||||
ee_putstr( "/_" ); | |||||
} | } | ||||
else if( vy < vx/4 ) | else if( vy < vx/4 ) | ||||
{ | { | ||||
/* 5pi/6 */ | /* 5pi/6 */ | ||||
gfx_goto( x+1, y ); | |||||
gfx_putstr( " `-." ); | |||||
gfx_goto( x+1, y+1 ); | |||||
gfx_putstr( "`-./" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y-1 ); | |||||
gfx_putstr( "._" ); | |||||
gfx_goto( x, y ); | |||||
gfx_putchar( '\\' ); | |||||
ee_goto( x+1, y ); | |||||
ee_putstr( " `-." ); | |||||
ee_goto( x+1, y+1 ); | |||||
ee_putstr( "`-./" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y-1 ); | |||||
ee_putstr( "._" ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '\\' ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
/* 6pi/6 */ | /* 6pi/6 */ | ||||
gfx_goto( x+1, y-1 ); | |||||
gfx_putstr( "____" ); | |||||
gfx_goto( x+1, y ); | |||||
gfx_putstr( "____|" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y ); | |||||
gfx_putchar( '<' ); | |||||
ee_goto( x+1, y-1 ); | |||||
ee_putstr( "____" ); | |||||
ee_goto( x+1, y ); | |||||
ee_putstr( "____|" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y ); | |||||
ee_putchar( '<' ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -467,93 +467,93 @@ static void draw_bomb( int x, int y, int vx, int vy ) | |||||
static void draw_fragbomb( int x, int y, int frame ) | static void draw_fragbomb( int x, int y, int frame ) | ||||
{ | { | ||||
gfx_color( WHITE ); | |||||
ee_color( EE_WHITE ); | |||||
gfx_color( frame & 1 ? CYAN : WHITE ); | |||||
gfx_goto( x-2, y ); | |||||
gfx_putstr( "( )" ); | |||||
gfx_goto( x-1, y+1 ); | |||||
gfx_putstr( "`--'" ); | |||||
ee_color( frame & 1 ? EE_CYAN : EE_WHITE ); | |||||
ee_goto( x-2, y ); | |||||
ee_putstr( "( )" ); | |||||
ee_goto( x-1, y+1 ); | |||||
ee_putstr( "`--'" ); | |||||
gfx_color( frame & 1 ? WHITE : CYAN ); | |||||
gfx_goto( x-1, y-1 ); | |||||
gfx_putstr( ",--." ); | |||||
gfx_goto( x, y ); | |||||
gfx_putstr( "'," ); | |||||
ee_color( frame & 1 ? EE_WHITE : EE_CYAN ); | |||||
ee_goto( x-1, y-1 ); | |||||
ee_putstr( ",--." ); | |||||
ee_goto( x, y ); | |||||
ee_putstr( "'," ); | |||||
switch( frame % 4 ) | switch( frame % 4 ) | ||||
{ | { | ||||
case 0: | case 0: | ||||
gfx_color( CYAN ); | |||||
gfx_goto( x, y + 2 ); | |||||
gfx_putchar( 'O' ); | |||||
gfx_goto( x + 2, y + 2 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_goto( x + 1, y + 3 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_color( GRAY ); | |||||
gfx_goto( x - 1, y + 3 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x + 2, y + 4 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x, y + 4 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( x + 1, y + 5 ); | |||||
gfx_putchar( '.' ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( x, y + 2 ); | |||||
ee_putchar( 'O' ); | |||||
ee_goto( x + 2, y + 2 ); | |||||
ee_putchar( 'o' ); | |||||
ee_goto( x + 1, y + 3 ); | |||||
ee_putchar( 'o' ); | |||||
ee_color( EE_GRAY ); | |||||
ee_goto( x - 1, y + 3 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x + 2, y + 4 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x, y + 4 ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( x + 1, y + 5 ); | |||||
ee_putchar( '.' ); | |||||
break; | break; | ||||
case 1: | case 1: | ||||
gfx_color( CYAN ); | |||||
//gfx_goto( x, y + 1 ); | |||||
//gfx_putchar( 'O' ); | |||||
gfx_goto( x + 1, y + 2 ); | |||||
gfx_putchar( 'O' ); | |||||
gfx_goto( x, y + 3 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_color( GRAY ); | |||||
gfx_goto( x + 2, y + 3 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x + 1, y + 4 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x - 1, y + 4 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( x + 2, y + 5 ); | |||||
gfx_putchar( '.' ); | |||||
ee_color( EE_CYAN ); | |||||
//ee_goto( x, y + 1 ); | |||||
//ee_putchar( 'O' ); | |||||
ee_goto( x + 1, y + 2 ); | |||||
ee_putchar( 'O' ); | |||||
ee_goto( x, y + 3 ); | |||||
ee_putchar( 'o' ); | |||||
ee_color( EE_GRAY ); | |||||
ee_goto( x + 2, y + 3 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x + 1, y + 4 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x - 1, y + 4 ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( x + 2, y + 5 ); | |||||
ee_putchar( '.' ); | |||||
break; | break; | ||||
case 2: | case 2: | ||||
gfx_color( CYAN ); | |||||
//gfx_goto( x - 1, y + 1 ); | |||||
//gfx_putchar( 'O' ); | |||||
gfx_goto( x + 2, y + 2 ); | |||||
gfx_putchar( 'O' ); | |||||
gfx_goto( x, y + 2 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_goto( x + 1, y + 3 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_color( GRAY ); | |||||
gfx_goto( x, y + 4 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x + 2, y + 4 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_goto( x + 1, y + 5 ); | |||||
gfx_putchar( '.' ); | |||||
ee_color( EE_CYAN ); | |||||
//ee_goto( x - 1, y + 1 ); | |||||
//ee_putchar( 'O' ); | |||||
ee_goto( x + 2, y + 2 ); | |||||
ee_putchar( 'O' ); | |||||
ee_goto( x, y + 2 ); | |||||
ee_putchar( 'o' ); | |||||
ee_goto( x + 1, y + 3 ); | |||||
ee_putchar( 'o' ); | |||||
ee_color( EE_GRAY ); | |||||
ee_goto( x, y + 4 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x + 2, y + 4 ); | |||||
ee_putchar( '.' ); | |||||
ee_goto( x + 1, y + 5 ); | |||||
ee_putchar( '.' ); | |||||
break; | break; | ||||
case 3: | case 3: | ||||
gfx_color( CYAN ); | |||||
//gfx_goto( x + 2, y + 1 ); | |||||
//gfx_putchar( 'O' ); | |||||
gfx_goto( x + 1, y + 2 ); | |||||
gfx_putchar( 'O' ); | |||||
gfx_goto( x - 1, y + 2 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_goto( x + 2, y + 3 ); | |||||
gfx_putchar( 'o' ); | |||||
gfx_color( GRAY ); | |||||
gfx_goto( x, y + 3 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x + 1, y + 4 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x, y + 5 ); | |||||
gfx_putchar( '.' ); | |||||
ee_color( EE_CYAN ); | |||||
//ee_goto( x + 2, y + 1 ); | |||||
//ee_putchar( 'O' ); | |||||
ee_goto( x + 1, y + 2 ); | |||||
ee_putchar( 'O' ); | |||||
ee_goto( x - 1, y + 2 ); | |||||
ee_putchar( 'o' ); | |||||
ee_goto( x + 2, y + 3 ); | |||||
ee_putchar( 'o' ); | |||||
ee_color( EE_GRAY ); | |||||
ee_goto( x, y + 3 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x + 1, y + 4 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x, y + 5 ); | |||||
ee_putchar( '.' ); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -566,132 +566,132 @@ static void draw_beam( int x, int y, int frame ) | |||||
switch( frame ) | switch( frame ) | ||||
{ | { | ||||
case 24: | case 24: | ||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y-3 ); | |||||
gfx_putstr( "__" ); | |||||
gfx_goto( x-1, y-2 ); | |||||
gfx_putchar( '\'' ); | |||||
gfx_goto( x+2, y-2 ); | |||||
gfx_putchar( '`' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y-3 ); | |||||
ee_putstr( "__" ); | |||||
ee_goto( x-1, y-2 ); | |||||
ee_putchar( '\'' ); | |||||
ee_goto( x+2, y-2 ); | |||||
ee_putchar( '`' ); | |||||
break; | break; | ||||
case 23: | case 23: | ||||
gfx_color( CYAN ); | |||||
gfx_goto( x, y-3 ); | |||||
gfx_putstr( "__" ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-2, y-2 ); | |||||
gfx_putstr( "-'" ); | |||||
gfx_goto( x+2, y-2 ); | |||||
gfx_putstr( "`-" ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( x, y-3 ); | |||||
ee_putstr( "__" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-2, y-2 ); | |||||
ee_putstr( "-'" ); | |||||
ee_goto( x+2, y-2 ); | |||||
ee_putstr( "`-" ); | |||||
break; | break; | ||||
case 22: | case 22: | ||||
gfx_color( CYAN ); | |||||
gfx_goto( x, y-3 ); | |||||
gfx_putstr( "__" ); | |||||
gfx_goto( x-1, y-2 ); | |||||
gfx_putchar( '\'' ); | |||||
gfx_goto( x+2, y-2 ); | |||||
gfx_putchar( '`' ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-3, y-2 ); | |||||
gfx_putstr( ",-" ); | |||||
gfx_goto( x+3, y-2 ); | |||||
gfx_putstr( "-." ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( x, y-3 ); | |||||
ee_putstr( "__" ); | |||||
ee_goto( x-1, y-2 ); | |||||
ee_putchar( '\'' ); | |||||
ee_goto( x+2, y-2 ); | |||||
ee_putchar( '`' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-3, y-2 ); | |||||
ee_putstr( ",-" ); | |||||
ee_goto( x+3, y-2 ); | |||||
ee_putstr( "-." ); | |||||
break; | break; | ||||
case 21: | case 21: | ||||
gfx_color( CYAN ); | |||||
gfx_goto( x-1, y-3 ); | |||||
gfx_putstr( "____" ); | |||||
gfx_goto( x-2, y-2 ); | |||||
gfx_putchar( '\'' ); | |||||
gfx_goto( x+3, y-2 ); | |||||
gfx_putchar( '`' ); | |||||
gfx_color( WHITE ); | |||||
gfx_goto( x-4, y-2 ); | |||||
gfx_putstr( ",-" ); | |||||
gfx_goto( x+4, y-2 ); | |||||
gfx_putstr( "-." ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( x-1, y-3 ); | |||||
ee_putstr( "____" ); | |||||
ee_goto( x-2, y-2 ); | |||||
ee_putchar( '\'' ); | |||||
ee_goto( x+3, y-2 ); | |||||
ee_putchar( '`' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-4, y-2 ); | |||||
ee_putstr( ",-" ); | |||||
ee_goto( x+4, y-2 ); | |||||
ee_putstr( "-." ); | |||||
break; | break; | ||||
case 20: | case 20: | ||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y-3 ); | |||||
gfx_putstr( "%%" ); | |||||
gfx_goto( x-4, y-2 ); | |||||
gfx_putchar( ',' ); | |||||
gfx_goto( x+5, y-2 ); | |||||
gfx_putchar( '.' ); | |||||
gfx_color( CYAN ); | |||||
gfx_goto( x-1, y-3 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x+2, y-3 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x-3, y-2 ); | |||||
gfx_putstr( "-'" ); | |||||
gfx_goto( x+3, y-2 ); | |||||
gfx_putstr( "`-" ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y-3 ); | |||||
ee_putstr( "%%" ); | |||||
ee_goto( x-4, y-2 ); | |||||
ee_putchar( ',' ); | |||||
ee_goto( x+5, y-2 ); | |||||
ee_putchar( '.' ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( x-1, y-3 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x+2, y-3 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x-3, y-2 ); | |||||
ee_putstr( "-'" ); | |||||
ee_goto( x+3, y-2 ); | |||||
ee_putstr( "`-" ); | |||||
break; | break; | ||||
case 19: | case 19: | ||||
gfx_color( WHITE ); | |||||
gfx_goto( x, y-4 ); | |||||
gfx_putstr( "%%" ); | |||||
gfx_goto( x, y-3 ); | |||||
gfx_putstr( "##" ); | |||||
gfx_color( CYAN ); | |||||
gfx_goto( x-1, y-4 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x+2, y-4 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x-1, y-3 ); | |||||
gfx_putchar( '%' ); | |||||
gfx_goto( x+2, y-3 ); | |||||
gfx_putchar( '%' ); | |||||
gfx_goto( x-4, y-2 ); | |||||
gfx_putstr( ",-'" ); | |||||
gfx_goto( x+3, y-2 ); | |||||
gfx_putstr( "`-." ); | |||||
gfx_color( BLUE ); | |||||
gfx_goto( x-2, y-3 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x+3, y-3 ); | |||||
gfx_putchar( ':' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x, y-4 ); | |||||
ee_putstr( "%%" ); | |||||
ee_goto( x, y-3 ); | |||||
ee_putstr( "##" ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( x-1, y-4 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x+2, y-4 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x-1, y-3 ); | |||||
ee_putchar( '%' ); | |||||
ee_goto( x+2, y-3 ); | |||||
ee_putchar( '%' ); | |||||
ee_goto( x-4, y-2 ); | |||||
ee_putstr( ",-'" ); | |||||
ee_goto( x+3, y-2 ); | |||||
ee_putstr( "`-." ); | |||||
ee_color( EE_BLUE ); | |||||
ee_goto( x-2, y-3 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x+3, y-3 ); | |||||
ee_putchar( ':' ); | |||||
break; | break; | ||||
case 18: | case 18: | ||||
default: | default: | ||||
r = (18 - frame) * (18 - frame); | r = (18 - frame) * (18 - frame); | ||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y-5-r ); | |||||
gfx_putstr( ":%%:" ); | |||||
gfx_goto( x-1, y-4-r ); | |||||
gfx_putstr( "%##%" ); | |||||
gfx_color( CYAN ); | |||||
gfx_goto( x-2, y-4-r ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x+3, y-4-r ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x-2, y-2 ); | |||||
gfx_putchar( '\'' ); | |||||
gfx_goto( x+3, y-2 ); | |||||
gfx_putchar( '`' ); | |||||
gfx_color( BLUE ); | |||||
gfx_goto( x-3, y-2 ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x+4, y-2 ); | |||||
gfx_putchar( ':' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y-5-r ); | |||||
ee_putstr( ":%%:" ); | |||||
ee_goto( x-1, y-4-r ); | |||||
ee_putstr( "%##%" ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( x-2, y-4-r ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x+3, y-4-r ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x-2, y-2 ); | |||||
ee_putchar( '\'' ); | |||||
ee_goto( x+3, y-2 ); | |||||
ee_putchar( '`' ); | |||||
ee_color( EE_BLUE ); | |||||
ee_goto( x-3, y-2 ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x+4, y-2 ); | |||||
ee_putchar( ':' ); | |||||
for( i = 0; i <= r; i++ ) | for( i = 0; i <= r; i++ ) | ||||
{ | { | ||||
gfx_color( WHITE ); | |||||
gfx_goto( x-1, y-3-i ); | |||||
gfx_putstr( (i+frame) % 5 ? "####" : "%%%%" ); | |||||
gfx_color( CYAN ); | |||||
gfx_goto( x-2, y-3-i ); | |||||
gfx_putchar( '%' ); | |||||
gfx_goto( x+3, y-3-i ); | |||||
gfx_putchar( '%' ); | |||||
gfx_color( BLUE ); | |||||
gfx_goto( x-3, y-3-i ); | |||||
gfx_putchar( ':' ); | |||||
gfx_goto( x+4, y-3-i ); | |||||
gfx_putchar( ':' ); | |||||
ee_color( EE_WHITE ); | |||||
ee_goto( x-1, y-3-i ); | |||||
ee_putstr( (i+frame) % 5 ? "####" : "%%%%" ); | |||||
ee_color( EE_CYAN ); | |||||
ee_goto( x-2, y-3-i ); | |||||
ee_putchar( '%' ); | |||||
ee_goto( x+3, y-3-i ); | |||||
ee_putchar( '%' ); | |||||
ee_color( EE_BLUE ); | |||||
ee_goto( x-3, y-3-i ); | |||||
ee_putchar( ':' ); | |||||
ee_goto( x+4, y-3-i ); | |||||
ee_putchar( ':' ); | |||||
} | } | ||||
break; | break; | ||||
} | } | ||||
@@ -702,11 +702,11 @@ static void draw_nuke( int x, int y, int frame ) | |||||
int r = (29 - frame) * (29 - frame) / 8; | int r = (29 - frame) * (29 - frame) / 8; | ||||
/* Lots of duplicate pixels, but we don't care */ | /* Lots of duplicate pixels, but we don't care */ | ||||
gfx_color( BLUE ); | |||||
ee_color( EE_BLUE ); | |||||
draw_circle( x, y, r++, ':' ); | draw_circle( x, y, r++, ':' ); | ||||
gfx_color( CYAN ); | |||||
ee_color( EE_CYAN ); | |||||
draw_circle( x, y, r++, '%' ); | draw_circle( x, y, r++, '%' ); | ||||
gfx_color( WHITE ); | |||||
ee_color( EE_WHITE ); | |||||
draw_circle( x, y, r++, '#' ); | draw_circle( x, y, r++, '#' ); | ||||
draw_circle( x, y, r++, '#' ); | draw_circle( x, y, r++, '#' ); | ||||
} | } | ||||
@@ -718,15 +718,15 @@ static void draw_circle( int x, int y, int r, char c ) | |||||
/* Optimized Bresenham. Kick ass. */ | /* Optimized Bresenham. Kick ass. */ | ||||
for( test = 0, dx = 0, dy = r ; dx <= dy ; dx++ ) | for( test = 0, dx = 0, dy = r ; dx <= dy ; dx++ ) | ||||
{ | { | ||||
gfx_putcharTO( x + dx, y + dy / 2, c ); | |||||
gfx_putcharTO( x - dx, y + dy / 2, c ); | |||||
gfx_putcharTO( x + dx, y - dy / 2, c ); | |||||
gfx_putcharTO( x - dx, y - dy / 2, c ); | |||||
gfx_putcharTO( x + dy, y + dx / 2, c ); | |||||
gfx_putcharTO( x - dy, y + dx / 2, c ); | |||||
gfx_putcharTO( x + dy, y - dx / 2, c ); | |||||
gfx_putcharTO( x - dy, y - dx / 2, c ); | |||||
ee_putcharTO( x + dx, y + dy / 2, c ); | |||||
ee_putcharTO( x - dx, y + dy / 2, c ); | |||||
ee_putcharTO( x + dx, y - dy / 2, c ); | |||||
ee_putcharTO( x - dx, y - dy / 2, c ); | |||||
ee_putcharTO( x + dy, y + dx / 2, c ); | |||||
ee_putcharTO( x - dy, y + dx / 2, c ); | |||||
ee_putcharTO( x + dy, y - dx / 2, c ); | |||||
ee_putcharTO( x - dy, y - dx / 2, c ); | |||||
test += test > 0 ? dx - dy-- : dx; | test += test > 0 ? dx - dy-- : dx; | ||||
} | } | ||||