From bbb089ccf5f4e9b96a4c6183d2f99ac4d3b488e6 Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 10 Nov 2003 22:43:30 +0000 Subject: [PATCH] * src/weapons.c data/weapon_fragbomb: + Drew the fragbomb sprite. + Use the fragbomb in src/weapons.c. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/ttyvaders/trunk@144 92316355-f0b4-4df1-b90c-862c8a59935f --- data/Makefile.am | 1 + data/weapon_fragbomb | 50 +++++++++++++++++++++++ src/weapons.c | 96 ++++---------------------------------------- 3 files changed, 59 insertions(+), 88 deletions(-) create mode 100644 data/weapon_fragbomb diff --git a/data/Makefile.am b/data/Makefile.am index 3eae2db..45f2f4a 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -8,4 +8,5 @@ EXTRA_DIST = \ item_gem \ item_heart \ weapon_bomb \ + weapon_fragbomb \ $(NULL) diff --git a/data/weapon_fragbomb b/data/weapon_fragbomb new file mode 100644 index 0000000..522af73 --- /dev/null +++ b/data/weapon_fragbomb @@ -0,0 +1,50 @@ +6 3 2 1 + ,--. +( ', ) + `--' + jjjj +eejjee + eeee +6 3 2 1 + ,--. +( ', ) + `--' + eeee +jjeejj + jjjj +4 4 1 -2 + O o +: o + . : + . + j j +h j + h h + h +4 4 1 -2 + O + o : +. : + . + j + j h +h h + h +4 4 1 -2 + o O + o + : . + . + j j + j + h h + h +4 4 1 -2 +o O + : o + : + . +j j + h j + h + h diff --git a/src/weapons.c b/src/weapons.c index b01d041..7d08756 100644 --- a/src/weapons.c +++ b/src/weapons.c @@ -32,6 +32,7 @@ static void draw_beam(int x, int y, int frame); static void draw_fragbomb(int x, int y, int frame); struct ee_sprite *bomb_sprite; +struct ee_sprite *fragbomb_sprite; void init_weapons(game *g, weapons *wp) { @@ -43,6 +44,7 @@ void init_weapons(game *g, weapons *wp) } bomb_sprite = ee_load_sprite("data/weapon_bomb"); + fragbomb_sprite = ee_load_sprite("data/weapon_fragbomb"); } void draw_weapons(game *g, weapons *wp) @@ -347,95 +349,13 @@ static void draw_bomb(int x, int y, int vx, int vy) static void draw_fragbomb(int x, int y, int frame) { - ee_color(EE_WHITE); - - ee_color(frame & 1 ? EE_CYAN : EE_WHITE); - ee_goto(x-2, y); - ee_putstr("( )"); - ee_goto(x-1, y+1); - ee_putstr("`--'"); - - ee_color(frame & 1 ? EE_WHITE : EE_CYAN); - ee_goto(x-1, y-1); - ee_putstr(",--."); - ee_goto(x, y); - ee_putstr("',"); + /* Draw the head */ + ee_set_sprite_frame(fragbomb_sprite, frame & 1); + ee_draw_sprite(x, y, fragbomb_sprite); - switch(frame % 4) - { - case 0: - 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; - case 1: - 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; - case 2: - 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; - case 3: - 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; - } + /* Draw the tail */ + ee_set_sprite_frame(fragbomb_sprite, 2 + (frame % 4)); + ee_draw_sprite(x, y, fragbomb_sprite); } static void draw_beam(int x, int y, int frame)