Pārlūkot izejas kodu

* data/weapon_bomb:

+ New bomb sprite.
  * src/weapons.c:
    + Switched the bomb drawing to use ee_draw_sprite().


git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/ttyvaders/trunk@142 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam pirms 21 gadiem
vecāks
revīzija
af31e246d6
3 mainītis faili ar 109 papildinājumiem un 143 dzēšanām
  1. +1
    -0
      data/Makefile.am
  2. +86
    -0
      data/weapon_bomb
  3. +22
    -143
      src/weapons.c

+ 1
- 0
data/Makefile.am Parādīt failu

@@ -7,4 +7,5 @@ EXTRA_DIST = \
explosion_small \
item_gem \
item_heart \
weapon_bomb \
$(NULL)

+ 86
- 0
data/weapon_bomb Parādīt failu

@@ -0,0 +1,86 @@
5 3 3 1
/`-.
`-._\
`
jjjj
jjjee
e
5 3 3 1
_,
,-' /
\,-'
ee
jjjje
jjjj
6 2 5 1
____
|____>
jjjj
jjjjje
4 4 2 1
_,
/ |
/ /
`'
ee
jje
jjj
jj
4 4 1 1
._
| \
\ \
`'
ee
ejj
jjj
jj
3 3 1 0
,^.
| |
|_|
eee
jjj
jjj
4 3 2 2
,.
\ \
\_|
jj
jjj
jee
4 3 1 2
,.
/ /
|_/
jj
jjj
eej
3 4 1 3
_
| |
| |
`v'
j
jjj
jjj
eee
5 3 1 1
,-'\
/_,-'
'
jjjj
eejjj
e
5 3 1 1
._
\ `-.
`-./
ee
ejjjj
jjjj
6 2 0 1
____
<____|
jjjj
ejjjjj

+ 22
- 143
src/weapons.c Parādīt failu

@@ -31,6 +31,8 @@ static void draw_nuke(int x, int y, int frame);
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;

void init_weapons(game *g, weapons *wp)
{
int i;
@@ -39,6 +41,8 @@ void init_weapons(game *g, weapons *wp)
{
wp->type[i] = WEAPON_NONE;
}

bomb_sprite = ee_load_sprite("data/weapon_bomb");
}

void draw_weapons(game *g, weapons *wp)
@@ -289,94 +293,30 @@ 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)
{
int frame;

/* We have 1x2 pixels */
vy *= 2;
ee_color(EE_CYAN);

if(vx > vy)
{
if(vx > -vy) /* right quarter */
{
if(vy > vx/4)
{
/* -1pi/6 */
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('`');
}
frame = 0; /* -pi/6 */
else if(vy < -vx/4)
{
/* 1pi/6 */
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('/');
}
frame = 1; /* pi/6 */
else
{
/* 0pi/6 */
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('>');
}
frame = 2; /* 0pi/6 */
}
else /* top quarter */
{
if(vx > -vy/4)
{
/* 2pi/6 */
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('|');
}
frame = 3; /* 2pi/6 */
else if(vx < vy/4)
{
/* 4pi/6 */
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('|');
}
frame = 4; /* 4pi/6 */
else
{
/* 3pi/6 */
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(",^.");
}
frame = 5; /* 3pi/6 */
}
}
else
@@ -384,86 +324,25 @@ static void draw_bomb(int x, int y, int vx, int vy)
if(vx > -vy) /* bottom quarter */
{
if(vx > vy/4)
{
/* -2pi/6 */
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("_|");
}
frame = 6; /* -2pi/6 */
else if(vx < -vy/4)
{
/* -4pi/6 */
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("|_/");
}
frame = 7; /* -4pi/6 */
else
{
/* -3pi/6 */
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'");
}
frame = 8; /* -3pi/6 */
}
else /* left quarter */
{
if(vy > -vx/4)
{
/* -5pi/6 */
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("/_");
}
frame = 9; /* -5pi/6 */
else if(vy < vx/4)
{
/* 5pi/6 */
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('\\');
}
frame = 10; /* 5pi/6 */
else
{
/* 6pi/6 */
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('<');
}
frame = 11; /* 6pi/6 */
}
}

ee_set_sprite_frame(bomb_sprite, frame);
ee_draw_sprite(x, y, bomb_sprite);
}

static void draw_fragbomb(int x, int y, int frame)


Notiek ielāde…
Atcelt
Saglabāt