From 0aabcc8fe733b3356560146f28af643aad27f7f6 Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 16 Nov 2003 15:31:14 +0000 Subject: [PATCH] * BUGS TODO: + Removed libcaca stuff. * data/bongem.txt: + Fixed sprite syntax. * src/: + Set framerate to 25fps instead of 10fps. + Updated code to latest libcaca changes. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/ttyvaders/trunk@194 92316355-f0b4-4df1-b90c-862c8a59935f --- BUGS | 6 ------ TODO | 16 --------------- data/bongem.txt | 4 ++-- src/aliens.c | 4 ++-- src/box.c | 6 +++--- src/intro.c | 8 ++++---- src/main.c | 2 +- src/overlay.c | 20 +++++++++---------- src/starfield.c | 4 ++-- src/tunnel.c | 4 ++-- src/weapons.c | 52 ++++++++++++++++++++++++------------------------- 11 files changed, 52 insertions(+), 74 deletions(-) diff --git a/BUGS b/BUGS index 87ee502..98cc5ee 100644 --- a/BUGS +++ b/BUGS @@ -1,8 +1,2 @@ $Id$ -Video rendering - - o Slang's and ncurses' hashmap scrolling optimization code cause the - screen to occasionally flicker because it tries to optimize the - vertical scrolling. - diff --git a/TODO b/TODO index 44db6d5..553129e 100644 --- a/TODO +++ b/TODO @@ -1,21 +1,5 @@ $Id$ -TODO for libcaca - - o Sprite library - - o Clip graphics - - o Fix the thin ellipse rendering - - o Write a Linux console output for the drawing library - See also BUGS as to why it's very slow in console mode - - o DONE 12 Nov 2003: Port to conio.h - - -TODO for ttyvaders - o Let the ship pick up bonuses o Alien swarms, programmed behaviour diff --git a/data/bongem.txt b/data/bongem.txt index 2ae69cc..893caf5 100644 --- a/data/bongem.txt +++ b/data/bongem.txt @@ -1,11 +1,11 @@ -3 2 1 1 +3 3 1 1 _ /g\ \_/ c cpc ccc -3 2 1 1 +3 3 1 1 _ /g\ \_/ diff --git a/src/aliens.c b/src/aliens.c index 4df020e..19d57a6 100644 --- a/src/aliens.c +++ b/src/aliens.c @@ -53,13 +53,13 @@ void draw_aliens(game *g, aliens *al) switch(al->type[i]) { case ALIEN_FOO: - caca_draw_sprite(al->x[i], al->y[i], foo_sprite, al->img[i] % 8); + caca_draw_sprite(al->x[i], al->y[i], foo_sprite, al->img[i] % 5); break; case ALIEN_BAR: caca_draw_sprite(al->x[i], al->y[i], bar_sprite, al->img[i] % 2); break; case ALIEN_BAZ: - caca_draw_sprite(al->x[i], al->y[i], baz_sprite, al->img[i] % 6); + caca_draw_sprite(al->x[i], al->y[i], baz_sprite, al->img[i] % 4); break; case ALIEN_NONE: break; diff --git a/src/box.c b/src/box.c index b9cdcaa..7a9a925 100644 --- a/src/box.c +++ b/src/box.c @@ -45,7 +45,7 @@ void draw_box(game *g, box *b) { int j, frame; - caca_set_color(EE_YELLOW); + caca_set_color(CACA_COLOR_YELLOW); /* Draw the thin horizontal line */ if(b->frame < 8) @@ -68,7 +68,7 @@ void draw_box(game *g, box *b) caca_draw_line(b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8 - 1, 'X'); - caca_set_color(EE_BLACK); + caca_set_color(CACA_COLOR_BLACK); for(j = b->y - b->h * (frame - 8) / 8 + 1; j < b->y + b->h * (frame - 8) / 8; @@ -84,7 +84,7 @@ void draw_box(game *g, box *b) } /* Draw the text inside the frame */ - caca_set_color(EE_YELLOW); + caca_set_color(CACA_COLOR_YELLOW); /* FIXME: use a font */ caca_putstr(b->x - b->w / 2 + 12, b->y - b->h / 2 + 2, diff --git a/src/intro.c b/src/intro.c index 8db7998..09f08c3 100644 --- a/src/intro.c +++ b/src/intro.c @@ -47,9 +47,9 @@ void intro(void) xo = caca_get_width() / 2; yo = caca_get_height() / 2; - caca_set_color(EE_RED); + caca_set_color(CACA_COLOR_RED); caca_fill_ellipse(xo, yo, 16, 8, '#'); - caca_set_color(EE_GREEN); + caca_set_color(CACA_COLOR_GREEN); caca_draw_thin_ellipse(xo, yo, 16, 8); for(i = 0; i < 4; i ++) @@ -60,11 +60,11 @@ void intro(void) x[4] = x[0]; y[4] = y[0]; - caca_set_color(EE_BLACK); + caca_set_color(CACA_COLOR_BLACK); caca_fill_triangle(x[0], y[0], x[1], y[1], x[2], y[2], ' '); caca_fill_triangle(x[0], y[0], x[3], y[3], x[2], y[2], ' '); caca_draw_line(x[0], y[0], x[2], y[2], ' '); - caca_set_color(EE_GREEN); + caca_set_color(CACA_COLOR_GREEN); caca_draw_thin_polyline(x, y, 4); caca_draw_sprite(xo, yo, foo_sprite, frame % 5); diff --git a/src/main.c b/src/main.c index 2e1b6e6..f16f5fc 100644 --- a/src/main.c +++ b/src/main.c @@ -46,7 +46,7 @@ int main (int argc, char **argv) return 1; } - caca_set_delay(100000); + caca_set_delay(40000); /* Initialize our program */ g->w = caca_get_width(); diff --git a/src/overlay.c b/src/overlay.c index 6a65950..06fd504 100644 --- a/src/overlay.c +++ b/src/overlay.c @@ -32,49 +32,49 @@ void draw_status(game *g) static char dashes30[] = "=============================="; /* Draw life jauge */ - caca_set_color(EE_DARKGRAY); + caca_set_color(CACA_COLOR_DARKGRAY); caca_putstr(4, 1, dots30); if(g->p->life > MAX_LIFE * 7 / 10) { - caca_set_color(EE_GREEN); + caca_set_color(CACA_COLOR_GREEN); } else if(g->p->life > MAX_LIFE * 3 / 10) { - caca_set_color(EE_YELLOW); + caca_set_color(CACA_COLOR_YELLOW); } else { - caca_set_color(EE_RED); + caca_set_color(CACA_COLOR_RED); } caca_putstr(4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(1, 1, "L |"); caca_putstr(34, 1, "|"); /* Draw weapon jauge */ - caca_set_color(EE_DARKGRAY); + caca_set_color(CACA_COLOR_DARKGRAY); caca_putstr(42, 1, dots30 + 10); if(g->p->special > MAX_SPECIAL * 9 / 10) { - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); } else if(g->p->special > MAX_SPECIAL * 3 / 10) { - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); } else { - caca_set_color(EE_BLUE); + caca_set_color(CACA_COLOR_BLUE); } caca_putstr(42, 1, dashes30 + 10 + (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL); - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(39, 1, "S |"); caca_putstr(62, 1, "|"); } diff --git a/src/starfield.c b/src/starfield.c index f4504ee..59986c0 100644 --- a/src/starfield.c +++ b/src/starfield.c @@ -40,7 +40,7 @@ starfield * create_starfield(game *g) s[i].x = caca_rand(0, g->w - 1); s[i].y = caca_rand(0, g->h - 1); s[i].z = caca_rand(1, 3); - s[i].c = caca_rand(0, 1) ? EE_LIGHTGRAY : EE_DARKGRAY; + s[i].c = caca_rand(0, 1) ? CACA_COLOR_LIGHTGRAY : CACA_COLOR_DARKGRAY; s[i].ch = caca_rand(0, 1) ? '.' : '\''; } @@ -72,7 +72,7 @@ void update_starfield(game *g, starfield *s) s[i].x = caca_rand(0, g->w - 1); s[i].y = 0; s[i].z = caca_rand(1, 2); - s[i].c = caca_rand(0, 1) ? EE_LIGHTGRAY : EE_DARKGRAY; + s[i].c = caca_rand(0, 1) ? CACA_COLOR_LIGHTGRAY : CACA_COLOR_DARKGRAY; s[i].ch = caca_rand(0, 1) ? '.' : '\''; } else if(s[i].y < g->h-1) diff --git a/src/tunnel.c b/src/tunnel.c index 8d84afd..fb1d5fb 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -77,7 +77,7 @@ void draw_tunnel(game *g, tunnel *t) int i, j; char c; - caca_set_color(EE_GREEN); + caca_set_color(CACA_COLOR_GREEN); /* Left border */ for(i = 0; i < g->h ; i++) @@ -115,7 +115,7 @@ void draw_tunnel(game *g, tunnel *t) caca_putchar(t->right[i] - 1, i, c); } - caca_set_color(EE_RED); + caca_set_color(CACA_COLOR_RED); /* Left concrete */ for(i = 0; i < g->h ; i++) diff --git a/src/weapons.c b/src/weapons.c index b95e349..380fc9e 100644 --- a/src/weapons.c +++ b/src/weapons.c @@ -56,20 +56,20 @@ void draw_weapons(game *g, weapons *wp) switch(wp->type[i]) { case WEAPON_LASER: - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putchar(wp->x[i] >> 4, wp->y[i] >> 4, '|'); - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putchar(wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|'); break; case WEAPON_SEEKER: - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putchar(wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); caca_putchar(wp->x2[i] >> 4, wp->y2[i] >> 4, 'o'); - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putchar(wp->x[i] >> 4, wp->y[i] >> 4, '@'); break; case WEAPON_BOMB: - caca_set_color(EE_DARKGRAY); + caca_set_color(CACA_COLOR_DARKGRAY); caca_putchar((wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.'); caca_putchar((wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.'); caca_putchar((wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4, '.'); @@ -354,84 +354,84 @@ static void draw_beam(int x, int y, int frame) switch(frame) { case 24: - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(x, y-3, "__"); caca_putchar(x-1, y-2, '\''); caca_putchar(x+2, y-2, '`'); break; case 23: - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putstr(x, y-3, "__"); - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(x-2, y-2, "-'"); caca_putstr(x+2, y-2, "`-"); break; case 22: - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putstr(x, y-3, "__"); caca_putchar(x-1, y-2, '\''); caca_putchar(x+2, y-2, '`'); - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(x-3, y-2, ",-"); caca_putstr(x+3, y-2, "-."); break; case 21: - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putstr(x-1, y-3, "____"); caca_putchar(x-2, y-2, '\''); caca_putchar(x+3, y-2, '`'); - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(x-4, y-2, ",-"); caca_putstr(x+4, y-2, "-."); break; case 20: - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(x, y-3, "%%"); caca_putchar(x-4, y-2, ','); caca_putchar(x+5, y-2, '.'); - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putchar(x-1, y-3, ':'); caca_putchar(x+2, y-3, ':'); caca_putstr(x-3, y-2, "-'"); caca_putstr(x+3, y-2, "`-"); break; case 19: - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(x, y-4, "%%"); caca_putstr(x, y-3, "##"); - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putchar(x-1, y-4, ':'); caca_putchar(x+2, y-4, ':'); caca_putchar(x-1, y-3, '%'); caca_putchar(x+2, y-3, '%'); caca_putstr(x-4, y-2, ",-'"); caca_putstr(x+3, y-2, "`-."); - caca_set_color(EE_BLUE); + caca_set_color(CACA_COLOR_BLUE); caca_putchar(x-2, y-3, ':'); caca_putchar(x+3, y-3, ':'); break; case 18: default: r = (18 - frame) * (18 - frame); - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(x-1, y-5-r, ":%%:"); caca_putstr(x-1, y-4-r, "%##%"); - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putchar(x-2, y-4-r, ':'); caca_putchar(x+3, y-4-r, ':'); caca_putchar(x-2, y-2, '\''); caca_putchar(x+3, y-2, '`'); - caca_set_color(EE_BLUE); + caca_set_color(CACA_COLOR_BLUE); caca_putchar(x-3, y-2, ':'); caca_putchar(x+4, y-2, ':'); for(i = 0; i <= r; i++) { - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_putstr(x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%"); - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_putchar(x-2, y-3-i, '%'); caca_putchar(x+3, y-3-i, '%'); - caca_set_color(EE_BLUE); + caca_set_color(CACA_COLOR_BLUE); caca_putchar(x-3, y-3-i, ':'); caca_putchar(x+4, y-3-i, ':'); } @@ -444,14 +444,14 @@ static void draw_nuke(int x, int y, int frame) int r = (29 - frame) * (29 - frame) / 8; /* Lots of duplicate pixels, but we don't care */ - caca_set_color(EE_BLUE); + caca_set_color(CACA_COLOR_BLUE); caca_draw_ellipse(x, y, r, r / 2, ':'); caca_draw_ellipse(x, y, r + 1, r / 2, ':'); caca_draw_ellipse(x, y, r + 2, r / 2, ':'); - caca_set_color(EE_CYAN); + caca_set_color(CACA_COLOR_CYAN); caca_draw_ellipse(x, y, r + 2, r / 2 + 1, '%'); caca_draw_ellipse(x, y, r + 3, r / 2 + 1, '%'); - caca_set_color(EE_WHITE); + caca_set_color(CACA_COLOR_WHITE); caca_draw_ellipse(x, y, r + 3, r / 2 + 2, '#'); caca_draw_ellipse(x, y, r + 4, r / 2 + 2, '#'); caca_draw_ellipse(x, y, r + 4, r / 2 + 3, '#');