git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/ttyvaders/trunk@3423 92316355-f0b4-4df1-b90c-862c8a59935fmaster
@@ -24,7 +24,6 @@ caca_canvas_t *baz_sprite; | |||||
void init_aliens(game *g, aliens *al) | void init_aliens(game *g, aliens *al) | ||||
{ | { | ||||
caca_buffer_t *b; | |||||
int i; | int i; | ||||
for(i = 0; i < ALIENS; i++) | for(i = 0; i < ALIENS; i++) | ||||
@@ -32,17 +31,14 @@ void init_aliens(game *g, aliens *al) | |||||
al->type[i] = ALIEN_NONE; | al->type[i] = ALIEN_NONE; | ||||
} | } | ||||
b = caca_load_file("data/foofight.caca"); | |||||
foo_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
foo_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(foo_sprite, "data/foofight.txt", "utf8"); | |||||
b = caca_load_file("data/barfight.caca"); | |||||
bar_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
bar_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(bar_sprite, "data/barfight.txt", "utf8"); | |||||
b = caca_load_file("data/bazfight.caca"); | |||||
baz_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
baz_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(baz_sprite, "data/bazfight.txt", "utf8"); | |||||
} | } | ||||
void draw_aliens(game *g, aliens *al) | void draw_aliens(game *g, aliens *al) | ||||
@@ -54,15 +50,15 @@ void draw_aliens(game *g, aliens *al) | |||||
switch(al->type[i]) | switch(al->type[i]) | ||||
{ | { | ||||
case ALIEN_FOO: | case ALIEN_FOO: | ||||
caca_set_canvas_frame(foo_sprite, al->img[i] % 5); | |||||
caca_set_frame(foo_sprite, al->img[i] % 5); | |||||
caca_blit(g->cv, al->x[i], al->y[i], foo_sprite, NULL); | caca_blit(g->cv, al->x[i], al->y[i], foo_sprite, NULL); | ||||
break; | break; | ||||
case ALIEN_BAR: | case ALIEN_BAR: | ||||
caca_set_canvas_frame(bar_sprite, al->img[i] % 2); | |||||
caca_set_frame(bar_sprite, al->img[i] % 2); | |||||
caca_blit(g->cv, al->x[i], al->y[i], bar_sprite, NULL); | caca_blit(g->cv, al->x[i], al->y[i], bar_sprite, NULL); | ||||
break; | break; | ||||
case ALIEN_BAZ: | case ALIEN_BAZ: | ||||
caca_set_canvas_frame(baz_sprite, al->img[i] % 4); | |||||
caca_set_frame(baz_sprite, al->img[i] % 4); | |||||
caca_blit(g->cv, al->x[i], al->y[i], baz_sprite, NULL); | caca_blit(g->cv, al->x[i], al->y[i], baz_sprite, NULL); | ||||
break; | break; | ||||
case ALIEN_NONE: | case ALIEN_NONE: | ||||
@@ -23,7 +23,6 @@ caca_canvas_t *gem_sprite; | |||||
void init_bonus(game *g, bonus *bo) | void init_bonus(game *g, bonus *bo) | ||||
{ | { | ||||
caca_buffer_t *b; | |||||
int i; | int i; | ||||
for(i = 0; i < BONUS; i++) | for(i = 0; i < BONUS; i++) | ||||
@@ -31,13 +30,11 @@ void init_bonus(game *g, bonus *bo) | |||||
bo->type[i] = BONUS_NONE; | bo->type[i] = BONUS_NONE; | ||||
} | } | ||||
b = caca_load_file("data/bonheart.caca"); | |||||
heart_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
heart_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(heart_sprite, "data/bonheart.txt", "utf8"); | |||||
b = caca_load_file("data/bongem.caca"); | |||||
gem_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
gem_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(gem_sprite, "data/bongem.txt", "utf8"); | |||||
} | } | ||||
void draw_bonus(game *g, bonus *bo) | void draw_bonus(game *g, bonus *bo) | ||||
@@ -49,11 +46,11 @@ void draw_bonus(game *g, bonus *bo) | |||||
switch(bo->type[i]) | switch(bo->type[i]) | ||||
{ | { | ||||
case BONUS_GREEN: | case BONUS_GREEN: | ||||
caca_set_canvas_frame(gem_sprite, (bo->n[i]/2 % 3) ? 0 : 1); | |||||
caca_set_frame(gem_sprite, (bo->n[i]/2 % 3) ? 0 : 1); | |||||
caca_blit(g->cv, bo->x[i], bo->y[i], gem_sprite, NULL); | caca_blit(g->cv, bo->x[i], bo->y[i], gem_sprite, NULL); | ||||
break; | break; | ||||
case BONUS_LIFE: | case BONUS_LIFE: | ||||
caca_set_canvas_frame(heart_sprite, (bo->n[i] % 3) ? 0 : 1); | |||||
caca_set_frame(heart_sprite, (bo->n[i] % 3) ? 0 : 1); | |||||
caca_blit(g->cv, bo->x[i], bo->y[i], heart_sprite, NULL); | caca_blit(g->cv, bo->x[i], bo->y[i], heart_sprite, NULL); | ||||
break; | break; | ||||
case BONUS_NONE: | case BONUS_NONE: | ||||
@@ -37,13 +37,13 @@ void draw_box(game *g, box *b) | |||||
{ | { | ||||
int j, frame; | int j, frame; | ||||
caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_YELLOW, CACA_BLACK); | |||||
/* Draw the thin horizontal line */ | /* Draw the thin horizontal line */ | ||||
if(b->frame < 8) | if(b->frame < 8) | ||||
{ | { | ||||
caca_draw_line(g->cv, b->x - b->w * b->frame / 16, b->y, | caca_draw_line(g->cv, b->x - b->w * b->frame / 16, b->y, | ||||
b->x + b->w * b->frame / 16 - 1, b->y, "X"); | |||||
b->x + b->w * b->frame / 16 - 1, b->y, 'X'); | |||||
return; | return; | ||||
} | } | ||||
@@ -51,23 +51,23 @@ void draw_box(game *g, box *b) | |||||
frame = b->frame < 12 ? b->frame : 12; | frame = b->frame < 12 ? b->frame : 12; | ||||
caca_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8, | caca_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8, | ||||
b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, "X"); | |||||
b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, 'X'); | |||||
caca_draw_line(g->cv, b->x - b->w / 2, b->y + b->h * (frame - 8) / 8, | caca_draw_line(g->cv, b->x - b->w / 2, b->y + b->h * (frame - 8) / 8, | ||||
b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8, "X"); | |||||
b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8, 'X'); | |||||
caca_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8, | caca_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8, | ||||
b->x - b->w / 2, b->y + b->h * (frame - 8) / 8 - 1, "X"); | |||||
b->x - b->w / 2, b->y + b->h * (frame - 8) / 8 - 1, 'X'); | |||||
caca_draw_line(g->cv, b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, | caca_draw_line(g->cv, 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"); | |||||
b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8 - 1, 'X'); | |||||
caca_set_color(g->cv, CACA_COLOR_BLACK, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_BLACK, CACA_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; | ||||
j++) | j++) | ||||
{ | { | ||||
caca_draw_line(g->cv, b->x - b->w / 2 + 1, j, | caca_draw_line(g->cv, b->x - b->w / 2 + 1, j, | ||||
b->x + b->w / 2 - 2, j, "X"); | |||||
b->x + b->w / 2 - 2, j, 'X'); | |||||
} | } | ||||
if(b->frame < 12) | if(b->frame < 12) | ||||
@@ -76,18 +76,18 @@ void draw_box(game *g, box *b) | |||||
} | } | ||||
/* Draw the text inside the frame */ | /* Draw the text inside the frame */ | ||||
caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_YELLOW, CACA_BLACK); | |||||
/* FIXME: use a font */ | /* FIXME: use a font */ | ||||
caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 2, | |||||
caca_put_str(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 2, | |||||
"XXXX. .XXXX X X .XXXX .XXXX XXXX."); | "XXXX. .XXXX X X .XXXX .XXXX XXXX."); | ||||
caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 3, | |||||
caca_put_str(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 3, | |||||
"X `X X' X X X X' X' X `X"); | "X `X X' X X X X' X' X `X"); | ||||
caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 4, | |||||
caca_put_str(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 4, | |||||
"XXXX' XXXXX X X `XXX XXXX X X"); | "XXXX' XXXXX X X `XXX XXXX X X"); | ||||
caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 5, | |||||
caca_put_str(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 5, | |||||
"X' X' `X X. ,X `X X' X ,X"); | "X' X' `X X. ,X `X X' X ,X"); | ||||
caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 6, | |||||
caca_put_str(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 6, | |||||
"X X X `XXXX XXXX' `XXXX XXXX'"); | "X X X `XXXX XXXX' `XXXX XXXX'"); | ||||
} | } | ||||
@@ -15,7 +15,7 @@ | |||||
#include "config.h" | #include "config.h" | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <unistd.h> | |||||
//#include <unistd.h> | |||||
#include "common.h" | #include "common.h" | ||||
@@ -37,8 +37,8 @@ void ceo_alert(game *g) | |||||
fprintf(stderr, "foo\n"); | fprintf(stderr, "foo\n"); | ||||
caca_refresh_display(g->cv); | |||||
caca_refresh_display(g->dp); | |||||
usleep(40000); | |||||
//usleep(40000); | |||||
} | } | ||||
} | } |
@@ -23,7 +23,6 @@ caca_canvas_t *small_sprite; | |||||
void init_explosions(game *g, explosions *ex) | void init_explosions(game *g, explosions *ex) | ||||
{ | { | ||||
caca_buffer_t *b; | |||||
int i; | int i; | ||||
for(i = 0; i < EXPLOSIONS; i++) | for(i = 0; i < EXPLOSIONS; i++) | ||||
@@ -31,13 +30,11 @@ void init_explosions(game *g, explosions *ex) | |||||
ex->type[i] = EXPLOSION_NONE; | ex->type[i] = EXPLOSION_NONE; | ||||
} | } | ||||
b = caca_load_file("data/xplmed.caca"); | |||||
medium_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
medium_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(medium_sprite, "data/xplmed.txt", "utf8"); | |||||
b = caca_load_file("data/xplsmall.caca"); | |||||
small_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
small_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(small_sprite, "data/xplsmall.txt", "utf8"); | |||||
} | } | ||||
void add_explosion(game *g, explosions *ex, int x, int y, int vx, int vy, int type) | void add_explosion(game *g, explosions *ex, int x, int y, int vx, int vy, int type) | ||||
@@ -74,7 +71,7 @@ void draw_explosions(game *g, explosions *ex) | |||||
for(i = 0; i < EXPLOSIONS; i++) | for(i = 0; i < EXPLOSIONS; i++) | ||||
{ | { | ||||
#if 0 | #if 0 | ||||
caca_set_fg_color(g->cv, CACA_COLOR_GREEN); | |||||
caca_set_fg_color(g->cv, CACA_GREEN); | |||||
caca_goto(g->cv, ex->x[i] + 3, ex->y[i]); | caca_goto(g->cv, ex->x[i] + 3, ex->y[i]); | ||||
switch(caca_rand(0,2)) | switch(caca_rand(0,2)) | ||||
{ | { | ||||
@@ -101,11 +98,11 @@ void draw_explosions(game *g, explosions *ex) | |||||
switch(ex->type[i]) | switch(ex->type[i]) | ||||
{ | { | ||||
case EXPLOSION_MEDIUM: | case EXPLOSION_MEDIUM: | ||||
caca_set_canvas_frame(medium_sprite, 10 - ex->n[i]); | |||||
caca_set_frame(medium_sprite, 10 - ex->n[i]); | |||||
caca_blit(g->cv, ex->x[i], ex->y[i], medium_sprite, NULL); | caca_blit(g->cv, ex->x[i], ex->y[i], medium_sprite, NULL); | ||||
break; | break; | ||||
case EXPLOSION_SMALL: | case EXPLOSION_SMALL: | ||||
caca_set_canvas_frame(small_sprite, 6 - ex->n[i]); | |||||
caca_set_frame(small_sprite, 6 - ex->n[i]); | |||||
caca_blit(g->cv, ex->x[i], ex->y[i], small_sprite, NULL); | caca_blit(g->cv, ex->x[i], ex->y[i], small_sprite, NULL); | ||||
break; | break; | ||||
case EXPLOSION_NONE: | case EXPLOSION_NONE: | ||||
@@ -16,7 +16,10 @@ | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <math.h> | #include <math.h> | ||||
#include <unistd.h> | |||||
#ifndef M_PI | |||||
# define M_PI 3.14159265358979323846 | |||||
#endif | |||||
//#include <unistd.h> | |||||
#include "common.h" | #include "common.h" | ||||
@@ -26,20 +29,16 @@ void intro(game *g) | |||||
caca_canvas_t *foo_sprite; | caca_canvas_t *foo_sprite; | ||||
caca_canvas_t *bar_sprite; | caca_canvas_t *bar_sprite; | ||||
caca_canvas_t *baz_sprite; | caca_canvas_t *baz_sprite; | ||||
caca_buffer_t *b; | |||||
int frame = 0; | int frame = 0; | ||||
b = caca_load_file("data/foofight.caca"); | |||||
foo_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
foo_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(foo_sprite, "data/foofight.txt", "utf8"); | |||||
b = caca_load_file("data/barfight.caca"); | |||||
bar_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
bar_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(bar_sprite, "data/barfight.txt", "utf8"); | |||||
b = caca_load_file("data/bazfight.caca"); | |||||
baz_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
baz_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(baz_sprite, "data/bazfight.txt", "utf8"); | |||||
while(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) == 0) | while(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) == 0) | ||||
{ | { | ||||
@@ -52,9 +51,9 @@ void intro(game *g) | |||||
xo = caca_get_canvas_width(g->cv) / 2; | xo = caca_get_canvas_width(g->cv) / 2; | ||||
yo = caca_get_canvas_height(g->cv) / 2; | yo = caca_get_canvas_height(g->cv) / 2; | ||||
caca_set_color(g->cv, CACA_COLOR_RED, CACA_COLOR_BLACK); | |||||
caca_fill_ellipse(g->cv, xo, yo, 16, 8, "#"); | |||||
caca_set_color(g->cv, CACA_COLOR_GREEN, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_RED, CACA_BLACK); | |||||
caca_fill_ellipse(g->cv, xo, yo, 16, 8, '#'); | |||||
caca_set_color_ansi(g->cv, CACA_GREEN, CACA_BLACK); | |||||
caca_draw_thin_ellipse(g->cv, xo, yo, 16, 8); | caca_draw_thin_ellipse(g->cv, xo, yo, 16, 8); | ||||
for(i = 0; i < 4; i ++) | for(i = 0; i < 4; i ++) | ||||
@@ -65,19 +64,19 @@ void intro(game *g) | |||||
x[4] = x[0]; | x[4] = x[0]; | ||||
y[4] = y[0]; | y[4] = y[0]; | ||||
caca_set_color(g->cv, CACA_COLOR_BLACK, CACA_COLOR_BLACK); | |||||
caca_fill_triangle(g->cv, x[0], y[0], x[1], y[1], x[2], y[2], " "); | |||||
caca_fill_triangle(g->cv, x[0], y[0], x[3], y[3], x[2], y[2], " "); | |||||
caca_draw_line(g->cv, x[0], y[0], x[2], y[2], " "); | |||||
caca_set_color(g->cv, CACA_COLOR_GREEN, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_BLACK, CACA_BLACK); | |||||
caca_fill_triangle(g->cv, x[0], y[0], x[1], y[1], x[2], y[2], ' '); | |||||
caca_fill_triangle(g->cv, x[0], y[0], x[3], y[3], x[2], y[2], ' '); | |||||
caca_draw_line(g->cv, x[0], y[0], x[2], y[2], ' '); | |||||
caca_set_color_ansi(g->cv, CACA_GREEN, CACA_BLACK); | |||||
caca_draw_thin_polyline(g->cv, x, y, 4); | caca_draw_thin_polyline(g->cv, x, y, 4); | ||||
caca_set_canvas_frame(foo_sprite, frame % 5); | |||||
caca_set_frame(foo_sprite, frame % 5); | |||||
caca_blit(g->cv, xo, yo, foo_sprite, NULL); | caca_blit(g->cv, xo, yo, foo_sprite, NULL); | ||||
caca_refresh_display(g->dp); | caca_refresh_display(g->dp); | ||||
usleep(40000); | |||||
//usleep(40000); | |||||
} | } | ||||
} | } | ||||
@@ -16,16 +16,14 @@ | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <time.h> | #include <time.h> | ||||
#include "common.h" | #include "common.h" | ||||
static void start_game (game *); | static void start_game (game *); | ||||
int _main (int argc, char **argv) | |||||
int main (int argc, char **argv) | |||||
{ | { | ||||
game *g = malloc(sizeof(game)); | game *g = malloc(sizeof(game)); | ||||
if(g == NULL) | if(g == NULL) | ||||
@@ -33,7 +31,7 @@ int _main (int argc, char **argv) | |||||
srand(time(NULL)); | srand(time(NULL)); | ||||
g->cv = caca_create_canvas(0, 0); | |||||
g->cv = caca_create_canvas(80, 50); | |||||
if(!g->cv) | if(!g->cv) | ||||
return 1; | return 1; | ||||
@@ -24,50 +24,50 @@ void draw_status(game *g) | |||||
static char dashes30[] = "=============================="; | static char dashes30[] = "=============================="; | ||||
/* Draw life jauge */ | /* Draw life jauge */ | ||||
caca_set_color(g->cv, CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, 4, 1, dots30); | |||||
caca_set_color_ansi(g->cv, CACA_DARKGRAY, CACA_BLACK); | |||||
caca_put_str(g->cv, 4, 1, dots30); | |||||
if(g->p->life > MAX_LIFE * 7 / 10) | if(g->p->life > MAX_LIFE * 7 / 10) | ||||
{ | { | ||||
caca_set_color(g->cv, CACA_COLOR_GREEN, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_GREEN, CACA_BLACK); | |||||
} | } | ||||
else if(g->p->life > MAX_LIFE * 3 / 10) | else if(g->p->life > MAX_LIFE * 3 / 10) | ||||
{ | { | ||||
caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_YELLOW, CACA_BLACK); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
caca_set_color(g->cv, CACA_COLOR_RED, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_RED, CACA_BLACK); | |||||
} | } | ||||
caca_putstr(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); | |||||
caca_put_str(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, 1, 1, "L |"); | |||||
caca_putstr(g->cv, 34, 1, "|"); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, 1, 1, "L |"); | |||||
caca_put_str(g->cv, 34, 1, "|"); | |||||
/* Draw weapon jauge */ | /* Draw weapon jauge */ | ||||
caca_set_color(g->cv, CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, 42, 1, dots30 + 10); | |||||
caca_set_color_ansi(g->cv, CACA_DARKGRAY, CACA_BLACK); | |||||
caca_put_str(g->cv, 42, 1, dots30 + 10); | |||||
if(g->p->special > MAX_SPECIAL * 9 / 10) | if(g->p->special > MAX_SPECIAL * 9 / 10) | ||||
{ | { | ||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
} | } | ||||
else if(g->p->special > MAX_SPECIAL * 3 / 10) | else if(g->p->special > MAX_SPECIAL * 3 / 10) | ||||
{ | { | ||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_BLUE, CACA_BLACK); | |||||
} | } | ||||
caca_putstr(g->cv, 42, 1, dashes30 + 10 | |||||
+ (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL); | |||||
caca_put_str(g->cv, 42, 1, dashes30 + 10 | |||||
+ (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, 39, 1, "S |"); | |||||
caca_putstr(g->cv, 62, 1, "|"); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, 39, 1, "S |"); | |||||
caca_put_str(g->cv, 62, 1, "|"); | |||||
} | } | ||||
@@ -23,8 +23,6 @@ caca_canvas_t *ship_sprite; | |||||
/* Init tunnel */ | /* Init tunnel */ | ||||
player * create_player(game *g) | player * create_player(game *g) | ||||
{ | { | ||||
caca_buffer_t *b; | |||||
player *p = malloc(sizeof(player)); | player *p = malloc(sizeof(player)); | ||||
if(p == NULL) | if(p == NULL) | ||||
exit(1); | exit(1); | ||||
@@ -38,9 +36,8 @@ player * create_player(game *g) | |||||
p->life = MAX_LIFE; | p->life = MAX_LIFE; | ||||
p->dead = 0; | p->dead = 0; | ||||
b = caca_load_file("data/ship.caca"); | |||||
ship_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
ship_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(ship_sprite, "data/ship.txt", "utf8"); | |||||
return p; | return p; | ||||
} | } | ||||
@@ -55,7 +52,7 @@ void draw_player(game *g, player *p) | |||||
if(p->dead) | if(p->dead) | ||||
return; | return; | ||||
caca_set_canvas_frame(ship_sprite, 0); | |||||
caca_set_frame(ship_sprite, 0); | |||||
caca_blit(g->cv, p->x, p->y, ship_sprite, NULL); | caca_blit(g->cv, p->x, p->y, ship_sprite, NULL); | ||||
} | } | ||||
@@ -32,7 +32,7 @@ starfield * create_starfield(game *g) | |||||
s[i].x = caca_rand(0, g->w - 1); | s[i].x = caca_rand(0, g->w - 1); | ||||
s[i].y = caca_rand(0, g->h - 1); | s[i].y = caca_rand(0, g->h - 1); | ||||
s[i].z = caca_rand(1, 3); | s[i].z = caca_rand(1, 3); | ||||
s[i].c = caca_rand(0, 1) ? CACA_COLOR_LIGHTGRAY : CACA_COLOR_DARKGRAY; | |||||
s[i].c = caca_rand(0, 1) ? CACA_LIGHTGRAY : CACA_DARKGRAY; | |||||
s[i].ch = caca_rand(0, 1) ? '.' : '\''; | s[i].ch = caca_rand(0, 1) ? '.' : '\''; | ||||
} | } | ||||
@@ -47,8 +47,8 @@ void draw_starfield(game *g, starfield *s) | |||||
{ | { | ||||
if(s[i].x >= 0) | if(s[i].x >= 0) | ||||
{ | { | ||||
caca_set_color(g->cv, s[i].c, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, s[i].x, s[i].y, s[i].ch); | |||||
caca_set_color_ansi(g->cv, s[i].c, CACA_BLACK); | |||||
caca_put_char(g->cv, s[i].x, s[i].y, s[i].ch); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -64,7 +64,7 @@ void update_starfield(game *g, starfield *s) | |||||
s[i].x = caca_rand(0, g->w - 1); | s[i].x = caca_rand(0, g->w - 1); | ||||
s[i].y = 0; | s[i].y = 0; | ||||
s[i].z = caca_rand(1, 2); | s[i].z = caca_rand(1, 2); | ||||
s[i].c = caca_rand(0, 1) ? CACA_COLOR_LIGHTGRAY : CACA_COLOR_DARKGRAY; | |||||
s[i].c = caca_rand(0, 1) ? CACA_LIGHTGRAY : CACA_DARKGRAY; | |||||
s[i].ch = caca_rand(0, 1) ? '.' : '\''; | s[i].ch = caca_rand(0, 1) ? '.' : '\''; | ||||
} | } | ||||
else if(s[i].y < g->h-1) | else if(s[i].y < g->h-1) | ||||
@@ -69,7 +69,7 @@ void draw_tunnel(game *g, tunnel *t) | |||||
int i, j; | int i, j; | ||||
char c; | char c; | ||||
caca_set_color(g->cv, CACA_COLOR_RED, CACA_COLOR_BLACK); | |||||
caca_set_color_ansi(g->cv, CACA_RED, CACA_BLACK); | |||||
/* Left border */ | /* Left border */ | ||||
for(i = 0; i < g->h ; i++) | for(i = 0; i < g->h ; i++) | ||||
@@ -82,11 +82,11 @@ void draw_tunnel(game *g, tunnel *t) | |||||
else | else | ||||
c = (i == 0 || t->left[i] > t->left[i-1]) ? '\\' : '<'; | c = (i == 0 || t->left[i] > t->left[i-1]) ? '\\' : '<'; | ||||
caca_putchar(g->cv, t->left[i] + 1, i, c); | |||||
caca_put_char(g->cv, t->left[i] + 1, i, 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++) | ||||
caca_putchar(g->cv, t->left[i] + j + 1, i, '_'); | |||||
caca_put_char(g->cv, t->left[i] + j + 1, i, '_'); | |||||
} | } | ||||
/* Right border */ | /* Right border */ | ||||
@@ -102,22 +102,22 @@ void draw_tunnel(game *g, tunnel *t) | |||||
if(i + 1 < g->h) | if(i + 1 < g->h) | ||||
for(j = 1; j < t->right[i] - t->right[i+1]; j++) | for(j = 1; j < t->right[i] - t->right[i+1]; j++) | ||||
caca_putchar(g->cv, t->right[i+1] + j - 1, i, '_'); | |||||
caca_put_char(g->cv, t->right[i+1] + j - 1, i, '_'); | |||||
caca_putchar(g->cv, t->right[i] - 1, i, c); | |||||
caca_put_char(g->cv, t->right[i] - 1, i, c); | |||||
} | } | ||||
caca_set_color(g->cv, CACA_COLOR_LIGHTRED, CACA_COLOR_RED); | |||||
caca_set_color_ansi(g->cv, CACA_LIGHTRED, CACA_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++) | ||||
caca_putchar(g->cv, j, i, '#'); | |||||
caca_put_char(g->cv, j, i, '#'); | |||||
/* Right concrete */ | /* Right concrete */ | ||||
for(i = 0; i < g->h ; i++) | for(i = 0; i < g->h ; i++) | ||||
for(j = t->right[i] ; j < g->w ; j++) | for(j = t->right[i] ; j < g->w ; j++) | ||||
caca_putchar(g->cv, j, i, '#'); | |||||
caca_put_char(g->cv, j, i, '#'); | |||||
} | } | ||||
void update_tunnel(game *g, tunnel *t) | void update_tunnel(game *g, tunnel *t) | ||||
@@ -29,7 +29,6 @@ caca_canvas_t *fragbomb_sprite; | |||||
void init_weapons(game *g, weapons *wp) | void init_weapons(game *g, weapons *wp) | ||||
{ | { | ||||
caca_buffer_t *b; | |||||
int i; | int i; | ||||
for(i = 0; i < WEAPONS; i++) | for(i = 0; i < WEAPONS; i++) | ||||
@@ -37,13 +36,11 @@ void init_weapons(game *g, weapons *wp) | |||||
wp->type[i] = WEAPON_NONE; | wp->type[i] = WEAPON_NONE; | ||||
} | } | ||||
b = caca_load_file("data/wpnbomb.caca"); | |||||
bomb_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
bomb_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(bomb_sprite, "data/wpnbomb.txt", "utf8"); | |||||
b = caca_load_file("data/wpnfrag.caca"); | |||||
bomb_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
fragbomb_sprite = caca_create_canvas(0, 0); | |||||
caca_import_file(fragbomb_sprite, "data/wpnfrag.txt", "utf8"); | |||||
} | } | ||||
void draw_weapons(game *g, weapons *wp) | void draw_weapons(game *g, weapons *wp) | ||||
@@ -55,25 +52,25 @@ void draw_weapons(game *g, weapons *wp) | |||||
switch(wp->type[i]) | switch(wp->type[i]) | ||||
{ | { | ||||
case WEAPON_LASER: | case WEAPON_LASER: | ||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '|'); | |||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_char(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '|'); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_char(g->cv, wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|'); | |||||
break; | break; | ||||
case WEAPON_SEEKER: | case WEAPON_SEEKER: | ||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); | |||||
caca_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, 'o'); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '@'); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_char(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); | |||||
caca_put_char(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, 'o'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_char(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '@'); | |||||
break; | break; | ||||
case WEAPON_BOMB: | case WEAPON_BOMB: | ||||
caca_set_color(g->cv, CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.'); | |||||
caca_putchar(g->cv, (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.'); | |||||
caca_putchar(g->cv, (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4, '.'); | |||||
caca_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); | |||||
caca_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, '.'); | |||||
caca_set_color_ansi(g->cv, CACA_DARKGRAY, CACA_BLACK); | |||||
caca_put_char(g->cv, (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.'); | |||||
caca_put_char(g->cv, (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.'); | |||||
caca_put_char(g->cv, (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4, '.'); | |||||
caca_put_char(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); | |||||
caca_put_char(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, '.'); | |||||
draw_bomb(g, wp->x[i] >> 4, wp->y[i] >> 4, wp->vx[i], wp->vy[i]); | draw_bomb(g, wp->x[i] >> 4, wp->y[i] >> 4, wp->vx[i], wp->vy[i]); | ||||
break; | break; | ||||
case WEAPON_FRAGBOMB: | case WEAPON_FRAGBOMB: | ||||
@@ -333,18 +330,18 @@ static void draw_bomb(game *g, int x, int y, int vx, int vy) | |||||
} | } | ||||
} | } | ||||
caca_set_canvas_frame(bomb_sprite, frame); | |||||
caca_set_frame(bomb_sprite, frame); | |||||
caca_blit(g->cv, x, y, bomb_sprite, NULL); | caca_blit(g->cv, x, y, bomb_sprite, NULL); | ||||
} | } | ||||
static void draw_fragbomb(game *g, int x, int y, int frame) | static void draw_fragbomb(game *g, int x, int y, int frame) | ||||
{ | { | ||||
/* Draw the head */ | /* Draw the head */ | ||||
caca_set_canvas_frame(fragbomb_sprite, frame & 1); | |||||
caca_set_frame(fragbomb_sprite, frame & 1); | |||||
caca_blit(g->cv, x, y, fragbomb_sprite, NULL); | caca_blit(g->cv, x, y, fragbomb_sprite, NULL); | ||||
/* Draw the tail */ | /* Draw the tail */ | ||||
caca_set_canvas_frame(fragbomb_sprite, 2 + (frame % 4)); | |||||
caca_set_frame(fragbomb_sprite, 2 + (frame % 4)); | |||||
caca_blit(g->cv, x, y, fragbomb_sprite, NULL); | caca_blit(g->cv, x, y, fragbomb_sprite, NULL); | ||||
} | } | ||||
@@ -356,86 +353,86 @@ static void draw_beam(game *g, int x, int y, int frame) | |||||
switch(frame) | switch(frame) | ||||
{ | { | ||||
case 24: | case 24: | ||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x, y-3, "__"); | |||||
caca_putchar(g->cv, x-1, y-2, '\''); | |||||
caca_putchar(g->cv, x+2, y-2, '`'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, x, y-3, "__"); | |||||
caca_put_char(g->cv, x-1, y-2, '\''); | |||||
caca_put_char(g->cv, x+2, y-2, '`'); | |||||
break; | break; | ||||
case 23: | case 23: | ||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x, y-3, "__"); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x-2, y-2, "-'"); | |||||
caca_putstr(g->cv, x+2, y-2, "`-"); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_str(g->cv, x, y-3, "__"); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, x-2, y-2, "-'"); | |||||
caca_put_str(g->cv, x+2, y-2, "`-"); | |||||
break; | break; | ||||
case 22: | case 22: | ||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x, y-3, "__"); | |||||
caca_putchar(g->cv, x-1, y-2, '\''); | |||||
caca_putchar(g->cv, x+2, y-2, '`'); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x-3, y-2, ",-"); | |||||
caca_putstr(g->cv, x+3, y-2, "-."); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_str(g->cv, x, y-3, "__"); | |||||
caca_put_char(g->cv, x-1, y-2, '\''); | |||||
caca_put_char(g->cv, x+2, y-2, '`'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, x-3, y-2, ",-"); | |||||
caca_put_str(g->cv, x+3, y-2, "-."); | |||||
break; | break; | ||||
case 21: | case 21: | ||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x-1, y-3, "____"); | |||||
caca_putchar(g->cv, x-2, y-2, '\''); | |||||
caca_putchar(g->cv, x+3, y-2, '`'); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x-4, y-2, ",-"); | |||||
caca_putstr(g->cv, x+4, y-2, "-."); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_str(g->cv, x-1, y-3, "____"); | |||||
caca_put_char(g->cv, x-2, y-2, '\''); | |||||
caca_put_char(g->cv, x+3, y-2, '`'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, x-4, y-2, ",-"); | |||||
caca_put_str(g->cv, x+4, y-2, "-."); | |||||
break; | break; | ||||
case 20: | case 20: | ||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x, y-3, "%%"); | |||||
caca_putchar(g->cv, x-4, y-2, ','); | |||||
caca_putchar(g->cv, x+5, y-2, '.'); | |||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, x-1, y-3, ':'); | |||||
caca_putchar(g->cv, x+2, y-3, ':'); | |||||
caca_putstr(g->cv, x-3, y-2, "-'"); | |||||
caca_putstr(g->cv, x+3, y-2, "`-"); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, x, y-3, "%%"); | |||||
caca_put_char(g->cv, x-4, y-2, ','); | |||||
caca_put_char(g->cv, x+5, y-2, '.'); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_char(g->cv, x-1, y-3, ':'); | |||||
caca_put_char(g->cv, x+2, y-3, ':'); | |||||
caca_put_str(g->cv, x-3, y-2, "-'"); | |||||
caca_put_str(g->cv, x+3, y-2, "`-"); | |||||
break; | break; | ||||
case 19: | case 19: | ||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x, y-4, "%%"); | |||||
caca_putstr(g->cv, x, y-3, "##"); | |||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, x-1, y-4, ':'); | |||||
caca_putchar(g->cv, x+2, y-4, ':'); | |||||
caca_putchar(g->cv, x-1, y-3, '%'); | |||||
caca_putchar(g->cv, x+2, y-3, '%'); | |||||
caca_putstr(g->cv, x-4, y-2, ",-'"); | |||||
caca_putstr(g->cv, x+3, y-2, "`-."); | |||||
caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, x-2, y-3, ':'); | |||||
caca_putchar(g->cv, x+3, y-3, ':'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, x, y-4, "%%"); | |||||
caca_put_str(g->cv, x, y-3, "##"); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_char(g->cv, x-1, y-4, ':'); | |||||
caca_put_char(g->cv, x+2, y-4, ':'); | |||||
caca_put_char(g->cv, x-1, y-3, '%'); | |||||
caca_put_char(g->cv, x+2, y-3, '%'); | |||||
caca_put_str(g->cv, x-4, y-2, ",-'"); | |||||
caca_put_str(g->cv, x+3, y-2, "`-."); | |||||
caca_set_color_ansi(g->cv, CACA_BLUE, CACA_BLACK); | |||||
caca_put_char(g->cv, x-2, y-3, ':'); | |||||
caca_put_char(g->cv, x+3, y-3, ':'); | |||||
break; | break; | ||||
case 18: | case 18: | ||||
default: | default: | ||||
r = (18 - frame) * (18 - frame); | r = (18 - frame) * (18 - frame); | ||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x-1, y-5-r, ":%%:"); | |||||
caca_putstr(g->cv, x-1, y-4-r, "%##%"); | |||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, x-2, y-4-r, ':'); | |||||
caca_putchar(g->cv, x+3, y-4-r, ':'); | |||||
caca_putchar(g->cv, x-2, y-2, '\''); | |||||
caca_putchar(g->cv, x+3, y-2, '`'); | |||||
caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, x-3, y-2, ':'); | |||||
caca_putchar(g->cv, x+4, y-2, ':'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, x-1, y-5-r, ":%%:"); | |||||
caca_put_str(g->cv, x-1, y-4-r, "%##%"); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_char(g->cv, x-2, y-4-r, ':'); | |||||
caca_put_char(g->cv, x+3, y-4-r, ':'); | |||||
caca_put_char(g->cv, x-2, y-2, '\''); | |||||
caca_put_char(g->cv, x+3, y-2, '`'); | |||||
caca_set_color_ansi(g->cv, CACA_BLUE, CACA_BLACK); | |||||
caca_put_char(g->cv, x-3, y-2, ':'); | |||||
caca_put_char(g->cv, x+4, y-2, ':'); | |||||
for(i = 0; i <= r; i++) | for(i = 0; i <= r; i++) | ||||
{ | { | ||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%"); | |||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, x-2, y-3-i, '%'); | |||||
caca_putchar(g->cv, x+3, y-3-i, '%'); | |||||
caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, x-3, y-3-i, ':'); | |||||
caca_putchar(g->cv, x+4, y-3-i, ':'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_BLACK); | |||||
caca_put_str(g->cv, x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%"); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_BLACK); | |||||
caca_put_char(g->cv, x-2, y-3-i, '%'); | |||||
caca_put_char(g->cv, x+3, y-3-i, '%'); | |||||
caca_set_color_ansi(g->cv, CACA_BLUE, CACA_BLACK); | |||||
caca_put_char(g->cv, x-3, y-3-i, ':'); | |||||
caca_put_char(g->cv, x+4, y-3-i, ':'); | |||||
} | } | ||||
break; | break; | ||||
} | } | ||||
@@ -446,20 +443,20 @@ static void draw_nuke(game *g, 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 */ | ||||
caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK); | |||||
caca_draw_ellipse(g->cv, x, y, r, r / 2, ":"); | |||||
caca_set_color(g->cv, CACA_COLOR_LIGHTBLUE, CACA_COLOR_BLUE); | |||||
caca_draw_ellipse(g->cv, x, y, r + 1, r / 2, "#"); | |||||
caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_LIGHTBLUE); | |||||
caca_draw_ellipse(g->cv, x, y, r + 2, r / 2, "#"); | |||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_LIGHTBLUE); | |||||
caca_draw_ellipse(g->cv, x, y, r + 2, r / 2 + 1, "#"); | |||||
caca_set_color(g->cv, CACA_COLOR_LIGHTBLUE, CACA_COLOR_CYAN); | |||||
caca_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 1, "#"); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_CYAN); | |||||
caca_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 2, "#"); | |||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_WHITE); | |||||
caca_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 2, "#"); | |||||
caca_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 3, " "); | |||||
caca_set_color_ansi(g->cv, CACA_BLUE, CACA_BLACK); | |||||
caca_draw_ellipse(g->cv, x, y, r, r / 2, ':'); | |||||
caca_set_color_ansi(g->cv, CACA_LIGHTBLUE, CACA_BLUE); | |||||
caca_draw_ellipse(g->cv, x, y, r + 1, r / 2, '#'); | |||||
caca_set_color_ansi(g->cv, CACA_BLUE, CACA_LIGHTBLUE); | |||||
caca_draw_ellipse(g->cv, x, y, r + 2, r / 2, '#'); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_LIGHTBLUE); | |||||
caca_draw_ellipse(g->cv, x, y, r + 2, r / 2 + 1, '#'); | |||||
caca_set_color_ansi(g->cv, CACA_LIGHTBLUE, CACA_CYAN); | |||||
caca_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 1, '#'); | |||||
caca_set_color_ansi(g->cv, CACA_WHITE, CACA_CYAN); | |||||
caca_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 2, '#'); | |||||
caca_set_color_ansi(g->cv, CACA_CYAN, CACA_WHITE); | |||||
caca_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 2, '#'); | |||||
caca_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 3, ' '); | |||||
} | } | ||||
@@ -0,0 +1,20 @@ | |||||
| |||||
Microsoft Visual Studio Solution File, Format Version 10.00 | |||||
# Visual Studio 2008 | |||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ttyvaders", "ttyvaders.vcproj", "{633FC109-58D4-4676-858E-7222DE270E7A}" | |||||
EndProject | |||||
Global | |||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||||
Debug|Win32 = Debug|Win32 | |||||
Release|Win32 = Release|Win32 | |||||
EndGlobalSection | |||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||||
{633FC109-58D4-4676-858E-7222DE270E7A}.Debug|Win32.ActiveCfg = Debug|Win32 | |||||
{633FC109-58D4-4676-858E-7222DE270E7A}.Debug|Win32.Build.0 = Debug|Win32 | |||||
{633FC109-58D4-4676-858E-7222DE270E7A}.Release|Win32.ActiveCfg = Release|Win32 | |||||
{633FC109-58D4-4676-858E-7222DE270E7A}.Release|Win32.Build.0 = Release|Win32 | |||||
EndGlobalSection | |||||
GlobalSection(SolutionProperties) = preSolution | |||||
HideSolutionNode = FALSE | |||||
EndGlobalSection | |||||
EndGlobal |
@@ -0,0 +1,246 @@ | |||||
<?xml version="1.0" encoding="Windows-1252"?> | |||||
<VisualStudioProject | |||||
ProjectType="Visual C++" | |||||
Version="9.00" | |||||
Name="ttyvaders" | |||||
ProjectGUID="{633FC109-58D4-4676-858E-7222DE270E7A}" | |||||
RootNamespace="ttyvaders" | |||||
TargetFrameworkVersion="196613" | |||||
> | |||||
<Platforms> | |||||
<Platform | |||||
Name="Win32" | |||||
/> | |||||
</Platforms> | |||||
<ToolFiles> | |||||
</ToolFiles> | |||||
<Configurations> | |||||
<Configuration | |||||
Name="Debug|Win32" | |||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)" | |||||
IntermediateDirectory="$(ConfigurationName)" | |||||
ConfigurationType="1" | |||||
CharacterSet="2" | |||||
> | |||||
<Tool | |||||
Name="VCPreBuildEventTool" | |||||
/> | |||||
<Tool | |||||
Name="VCCustomBuildTool" | |||||
/> | |||||
<Tool | |||||
Name="VCXMLDataGeneratorTool" | |||||
/> | |||||
<Tool | |||||
Name="VCWebServiceProxyGeneratorTool" | |||||
/> | |||||
<Tool | |||||
Name="VCMIDLTool" | |||||
/> | |||||
<Tool | |||||
Name="VCCLCompilerTool" | |||||
Optimization="0" | |||||
AdditionalIncludeDirectories="win32;..\libcaca\caca;..\libcaca\win32" | |||||
MinimalRebuild="true" | |||||
BasicRuntimeChecks="3" | |||||
RuntimeLibrary="3" | |||||
WarningLevel="3" | |||||
DebugInformationFormat="4" | |||||
/> | |||||
<Tool | |||||
Name="VCManagedResourceCompilerTool" | |||||
/> | |||||
<Tool | |||||
Name="VCResourceCompilerTool" | |||||
/> | |||||
<Tool | |||||
Name="VCPreLinkEventTool" | |||||
/> | |||||
<Tool | |||||
Name="VCLinkerTool" | |||||
AdditionalDependencies="libcaca.lib" | |||||
AdditionalLibraryDirectories="$(SolutionDir)\..\libcaca\$(ConfigurationName)" | |||||
GenerateDebugInformation="true" | |||||
TargetMachine="1" | |||||
/> | |||||
<Tool | |||||
Name="VCALinkTool" | |||||
/> | |||||
<Tool | |||||
Name="VCManifestTool" | |||||
/> | |||||
<Tool | |||||
Name="VCXDCMakeTool" | |||||
/> | |||||
<Tool | |||||
Name="VCBscMakeTool" | |||||
/> | |||||
<Tool | |||||
Name="VCFxCopTool" | |||||
/> | |||||
<Tool | |||||
Name="VCAppVerifierTool" | |||||
/> | |||||
<Tool | |||||
Name="VCPostBuildEventTool" | |||||
/> | |||||
</Configuration> | |||||
<Configuration | |||||
Name="Release|Win32" | |||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)" | |||||
IntermediateDirectory="$(ConfigurationName)" | |||||
ConfigurationType="1" | |||||
CharacterSet="2" | |||||
WholeProgramOptimization="1" | |||||
> | |||||
<Tool | |||||
Name="VCPreBuildEventTool" | |||||
/> | |||||
<Tool | |||||
Name="VCCustomBuildTool" | |||||
/> | |||||
<Tool | |||||
Name="VCXMLDataGeneratorTool" | |||||
/> | |||||
<Tool | |||||
Name="VCWebServiceProxyGeneratorTool" | |||||
/> | |||||
<Tool | |||||
Name="VCMIDLTool" | |||||
/> | |||||
<Tool | |||||
Name="VCCLCompilerTool" | |||||
Optimization="2" | |||||
EnableIntrinsicFunctions="true" | |||||
AdditionalIncludeDirectories="win32;..\libcaca;..\libcaca\caca" | |||||
RuntimeLibrary="2" | |||||
EnableFunctionLevelLinking="true" | |||||
WarningLevel="3" | |||||
DebugInformationFormat="3" | |||||
/> | |||||
<Tool | |||||
Name="VCManagedResourceCompilerTool" | |||||
/> | |||||
<Tool | |||||
Name="VCResourceCompilerTool" | |||||
/> | |||||
<Tool | |||||
Name="VCPreLinkEventTool" | |||||
/> | |||||
<Tool | |||||
Name="VCLinkerTool" | |||||
AdditionalDependencies="libcaca.lib" | |||||
AdditionalLibraryDirectories="$(SolutionDir)\..\libcaca\$(ConfigurationName)" | |||||
GenerateDebugInformation="true" | |||||
OptimizeReferences="2" | |||||
EnableCOMDATFolding="2" | |||||
TargetMachine="1" | |||||
/> | |||||
<Tool | |||||
Name="VCALinkTool" | |||||
/> | |||||
<Tool | |||||
Name="VCManifestTool" | |||||
/> | |||||
<Tool | |||||
Name="VCXDCMakeTool" | |||||
/> | |||||
<Tool | |||||
Name="VCBscMakeTool" | |||||
/> | |||||
<Tool | |||||
Name="VCFxCopTool" | |||||
/> | |||||
<Tool | |||||
Name="VCAppVerifierTool" | |||||
/> | |||||
<Tool | |||||
Name="VCPostBuildEventTool" | |||||
/> | |||||
</Configuration> | |||||
</Configurations> | |||||
<References> | |||||
</References> | |||||
<Files> | |||||
<Filter | |||||
Name="Source Files" | |||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | |||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | |||||
> | |||||
<File | |||||
RelativePath=".\src\aliens.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\bonus.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\box.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\ceo.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\collide.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\explosions.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\intro.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\main.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\overlay.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\player.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\starfield.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\tunnel.c" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\src\weapons.c" | |||||
> | |||||
</File> | |||||
</Filter> | |||||
<Filter | |||||
Name="Header Files" | |||||
Filter="h;hpp;hxx;hm;inl;inc;xsd" | |||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | |||||
> | |||||
<File | |||||
RelativePath=".\src\common.h" | |||||
> | |||||
</File> | |||||
<File | |||||
RelativePath=".\win32\config.h" | |||||
> | |||||
</File> | |||||
</Filter> | |||||
<Filter | |||||
Name="Resource Files" | |||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | |||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | |||||
> | |||||
</Filter> | |||||
</Files> | |||||
<Globals> | |||||
</Globals> | |||||
</VisualStudioProject> |
@@ -0,0 +1,40 @@ | |||||
/* $Id: config.h 2965 2008-10-18 12:42:12Z sam $ */ | |||||
/* #undef HAVE_ENDIAN_H */ | |||||
#define HAVE_ERRNO_H 1 | |||||
#define HAVE_GETENV 1 | |||||
/* #undef HAVE_GETTIMEOFDAY */ | |||||
/* #undef HAVE_INTTYPES_H */ | |||||
#define HAVE_MEMORY_H 1 | |||||
#define HAVE_PUTENV 1 | |||||
/* #undef HAVE_SIGNAL */ | |||||
/* #undef HAVE_SIGNAL_H */ | |||||
#define HAVE_SLEEP 1 | |||||
/* #undef HAVE_STDINT_H */ | |||||
#define HAVE_STDLIB_H 1 | |||||
/* #undef HAVE_STRCASECMP */ | |||||
#define HAVE_STRINGS_H 1 | |||||
#define HAVE_STRING_H 1 | |||||
/* #undef HAVE_SYS_IOCTL_H */ | |||||
#define HAVE_SYS_STAT_H 1 | |||||
/* #undef HAVE_SYS_TIME_H */ | |||||
#define HAVE_SYS_TYPES_H 1 | |||||
/* #undef HAVE_UNISTD_H */ | |||||
/* #undef HAVE_USLEEP */ | |||||
/* #undef HAVE_VSNPRINTF */ | |||||
#define HAVE_SNPRINTF 1 | |||||
/* #undef NO_MINUS_C_MINUS_O */ | |||||
#define PACKAGE_BUGREPORT "" | |||||
#define PACKAGE_NAME "ttyvaders" | |||||
#define PACKAGE_STRING "" | |||||
#define PACKAGE_TARNAME "" | |||||
#define PACKAGE_VERSION "0.0" | |||||
/* #undef RETSIGTYPE */ | |||||
/* #undef SCREENUPDATE_IN_PC_H */ | |||||
#define STDC_HEADERS 1 | |||||
/* #undef const */ | |||||
#ifndef __cplusplus | |||||
#define inline __inline | |||||
#endif | |||||
#define strcasecmp stricmp | |||||
#define snprintf _snprintf |