git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/ttyvaders/trunk@2990 92316355-f0b4-4df1-b90c-862c8a59935fmaster
@@ -1,11 +1,14 @@ | |||||
#! /bin/sh | #! /bin/sh | ||||
# $Id$ | |||||
# bootstrap: the ultimate bootstrap/autogen.sh script for autotools projects | |||||
# Copyright (c) 2002, 2003, 2004, 2005, 2006 Sam Hocevar <sam@zoy.org> | |||||
# bootstrap: generic bootstrap/autogen.sh script for autotools projects | |||||
# | # | ||||
# This program is free software; you can redistribute it and/or | |||||
# modify it under the terms of the Do What The Fuck You Want To | |||||
# Public License, Version 2, as published by Sam Hocevar. See | |||||
# Copyright (c) 2002-2007 Sam Hocevar <sam@zoy.org> | |||||
# | |||||
# This program is free software. It comes without any warranty, to | |||||
# the extent permitted by applicable law. You can redistribute it | |||||
# and/or modify it under the terms of the Do What The Fuck You Want | |||||
# To Public License, Version 2, as published by Sam Hocevar. See | |||||
# http://sam.zoy.org/wtfpl/COPYING for more details. | # http://sam.zoy.org/wtfpl/COPYING for more details. | ||||
# | # | ||||
# The latest version of this script can be found at the following place: | # The latest version of this script can be found at the following place: | ||||
@@ -25,16 +28,20 @@ else | |||||
fi | fi | ||||
# Check for needed features | # Check for needed features | ||||
auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *( *\([^ )]*\).*/\1/p' $conffile`" | |||||
auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`" | |||||
libtool="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`" | libtool="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`" | ||||
pkgconfig="`grep -q '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile && echo yes || echo no`" | |||||
header="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`" | header="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`" | ||||
aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am`" | aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am`" | ||||
# Check for automake | # Check for automake | ||||
amvers="no" | amvers="no" | ||||
for v in "-1.9" "19" "-1.8" "18" "-1.7" "17" "-1.6" "16" "-1.5" "15"; do | |||||
if automake${v} --version >/dev/null 2>&1; then | |||||
amvers="${v}" | |||||
for v in 10 9 8 7 6 5; do | |||||
if automake-1.${v} --version >/dev/null 2>&1; then | |||||
amvers="-1.${v}" | |||||
break | |||||
elif automake1.${v} --version >/dev/null 2>&1; then | |||||
amvers="1.${v}" | |||||
break | break | ||||
fi | fi | ||||
done | done | ||||
@@ -87,10 +94,23 @@ if test "$libtool" = "yes"; then | |||||
fi | fi | ||||
fi | fi | ||||
# Check for pkg-config | |||||
if test "$pkgconfig" = "yes"; then | |||||
if ! pkg-config --version >/dev/null 2>&1; then | |||||
echo "$0: you need pkg-config" | |||||
exit 1 | |||||
fi | |||||
fi | |||||
# Remove old cruft | # Remove old cruft | ||||
for x in aclocal.m4 configure config.guess config.log config.sub config.cache config.h.in config.h compile libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh; do rm -f $x autotools/$x; if test -n "$auxdir"; then rm -f "$auxdir/$x"; fi; done | for x in aclocal.m4 configure config.guess config.log config.sub config.cache config.h.in config.h compile libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh; do rm -f $x autotools/$x; if test -n "$auxdir"; then rm -f "$auxdir/$x"; fi; done | ||||
rm -Rf autom4te.cache | rm -Rf autom4te.cache | ||||
if test -n "$auxdir" -a ! -d "$auxdir"; then mkdir "$auxdir"; fi | |||||
if test -n "$auxdir"; then | |||||
if test ! -d "$auxdir"; then | |||||
mkdir "$auxdir" | |||||
fi | |||||
aclocalflags="${aclocalflags} -I $auxdir -I ." | |||||
fi | |||||
# Explain what we are doing from now | # Explain what we are doing from now | ||||
set -x | set -x | ||||
@@ -98,17 +118,13 @@ set -x | |||||
# Bootstrap package | # Bootstrap package | ||||
if test "$libtool" = "yes"; then | if test "$libtool" = "yes"; then | ||||
${libtoolize} --copy --force | ${libtoolize} --copy --force | ||||
if test -n "$auxdir" -a -f "ltmain.sh"; then | |||||
if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then | |||||
echo "$0: working around a minor libtool issue" | echo "$0: working around a minor libtool issue" | ||||
mv ltmain.sh "$auxdir/" | mv ltmain.sh "$auxdir/" | ||||
fi | fi | ||||
fi | fi | ||||
if test -n "$auxdir"; then | |||||
aclocal${amvers} -I autotools ${aclocalflags} | |||||
else | |||||
aclocal${amvers} ${aclocalflags} | |||||
fi | |||||
aclocal${amvers} ${aclocalflags} | |||||
autoconf${acvers} | autoconf${acvers} | ||||
if test "$header" = "yes"; then | if test "$header" = "yes"; then | ||||
autoheader${acvers} | autoheader${acvers} | ||||
@@ -26,10 +26,10 @@ if test "$build" != "$host" -a "${PKG_CONFIG_LIBDIR}" = ""; then | |||||
fi | fi | ||||
CACA="no" | CACA="no" | ||||
PKG_CHECK_MODULES(CACA, caca >= 0.99.beta9, | |||||
PKG_CHECK_MODULES(CACA, caca >= 0.99.beta15, | |||||
[CACA="yes"], | [CACA="yes"], | ||||
[AC_MSG_RESULT(no) | [AC_MSG_RESULT(no) | ||||
AC_MSG_ERROR([you need libcaca version 0.99.beta9 or later])]) | |||||
AC_MSG_ERROR([you need libcaca version 0.99.beta15 or later])]) | |||||
# Optimizations | # Optimizations | ||||
CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" | CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" | ||||
@@ -18,13 +18,13 @@ | |||||
#include "common.h" | #include "common.h" | ||||
cucul_canvas_t *foo_sprite; | |||||
cucul_canvas_t *bar_sprite; | |||||
cucul_canvas_t *baz_sprite; | |||||
caca_canvas_t *foo_sprite; | |||||
caca_canvas_t *bar_sprite; | |||||
caca_canvas_t *baz_sprite; | |||||
void init_aliens(game *g, aliens *al) | void init_aliens(game *g, aliens *al) | ||||
{ | { | ||||
cucul_buffer_t *b; | |||||
caca_buffer_t *b; | |||||
int i; | int i; | ||||
for(i = 0; i < ALIENS; i++) | for(i = 0; i < ALIENS; i++) | ||||
@@ -32,17 +32,17 @@ void init_aliens(game *g, aliens *al) | |||||
al->type[i] = ALIEN_NONE; | al->type[i] = ALIEN_NONE; | ||||
} | } | ||||
b = cucul_load_file("data/foofight.caca"); | |||||
foo_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/foofight.caca"); | |||||
foo_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
b = cucul_load_file("data/barfight.caca"); | |||||
bar_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/barfight.caca"); | |||||
bar_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
b = cucul_load_file("data/bazfight.caca"); | |||||
baz_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/bazfight.caca"); | |||||
baz_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
} | } | ||||
void draw_aliens(game *g, aliens *al) | void draw_aliens(game *g, aliens *al) | ||||
@@ -54,16 +54,16 @@ void draw_aliens(game *g, aliens *al) | |||||
switch(al->type[i]) | switch(al->type[i]) | ||||
{ | { | ||||
case ALIEN_FOO: | case ALIEN_FOO: | ||||
cucul_set_canvas_frame(foo_sprite, al->img[i] % 5); | |||||
cucul_blit(g->cv, al->x[i], al->y[i], foo_sprite, NULL); | |||||
caca_set_canvas_frame(foo_sprite, al->img[i] % 5); | |||||
caca_blit(g->cv, al->x[i], al->y[i], foo_sprite, NULL); | |||||
break; | break; | ||||
case ALIEN_BAR: | case ALIEN_BAR: | ||||
cucul_set_canvas_frame(bar_sprite, al->img[i] % 2); | |||||
cucul_blit(g->cv, al->x[i], al->y[i], bar_sprite, NULL); | |||||
caca_set_canvas_frame(bar_sprite, al->img[i] % 2); | |||||
caca_blit(g->cv, al->x[i], al->y[i], bar_sprite, NULL); | |||||
break; | break; | ||||
case ALIEN_BAZ: | case ALIEN_BAZ: | ||||
cucul_set_canvas_frame(baz_sprite, al->img[i] % 4); | |||||
cucul_blit(g->cv, al->x[i], al->y[i], baz_sprite, NULL); | |||||
caca_set_canvas_frame(baz_sprite, al->img[i] % 4); | |||||
caca_blit(g->cv, al->x[i], al->y[i], baz_sprite, NULL); | |||||
break; | break; | ||||
case ALIEN_NONE: | case ALIEN_NONE: | ||||
break; | break; | ||||
@@ -82,7 +82,7 @@ void update_aliens(game *g, aliens *al) | |||||
{ | { | ||||
add_explosion(g, g->ex, al->x[i], al->y[i], 0, 0, EXPLOSION_MEDIUM); | add_explosion(g, g->ex, al->x[i], al->y[i], 0, 0, EXPLOSION_MEDIUM); | ||||
al->type[i] = ALIEN_NONE; | al->type[i] = ALIEN_NONE; | ||||
add_bonus(g, g->bo, al->x[i], al->y[i], cucul_rand(0,4) ? BONUS_GREEN : BONUS_LIFE); | |||||
add_bonus(g, g->bo, al->x[i], al->y[i], caca_rand(0,4) ? BONUS_GREEN : BONUS_LIFE); | |||||
} | } | ||||
/* Update coordinates */ | /* Update coordinates */ | ||||
@@ -18,12 +18,12 @@ | |||||
#include "common.h" | #include "common.h" | ||||
cucul_canvas_t *heart_sprite; | |||||
cucul_canvas_t *gem_sprite; | |||||
caca_canvas_t *heart_sprite; | |||||
caca_canvas_t *gem_sprite; | |||||
void init_bonus(game *g, bonus *bo) | void init_bonus(game *g, bonus *bo) | ||||
{ | { | ||||
cucul_buffer_t *b; | |||||
caca_buffer_t *b; | |||||
int i; | int i; | ||||
for(i = 0; i < BONUS; i++) | for(i = 0; i < BONUS; i++) | ||||
@@ -31,13 +31,13 @@ void init_bonus(game *g, bonus *bo) | |||||
bo->type[i] = BONUS_NONE; | bo->type[i] = BONUS_NONE; | ||||
} | } | ||||
b = cucul_load_file("data/bonheart.caca"); | |||||
heart_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/bonheart.caca"); | |||||
heart_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
b = cucul_load_file("data/bongem.caca"); | |||||
gem_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/bongem.caca"); | |||||
gem_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
} | } | ||||
void draw_bonus(game *g, bonus *bo) | void draw_bonus(game *g, bonus *bo) | ||||
@@ -49,12 +49,12 @@ void draw_bonus(game *g, bonus *bo) | |||||
switch(bo->type[i]) | switch(bo->type[i]) | ||||
{ | { | ||||
case BONUS_GREEN: | case BONUS_GREEN: | ||||
cucul_set_canvas_frame(gem_sprite, (bo->n[i]/2 % 3) ? 0 : 1); | |||||
cucul_blit(g->cv, bo->x[i], bo->y[i], gem_sprite, NULL); | |||||
caca_set_canvas_frame(gem_sprite, (bo->n[i]/2 % 3) ? 0 : 1); | |||||
caca_blit(g->cv, bo->x[i], bo->y[i], gem_sprite, NULL); | |||||
break; | break; | ||||
case BONUS_LIFE: | case BONUS_LIFE: | ||||
cucul_set_canvas_frame(heart_sprite, (bo->n[i] % 3) ? 0 : 1); | |||||
cucul_blit(g->cv, bo->x[i], bo->y[i], heart_sprite, NULL); | |||||
caca_set_canvas_frame(heart_sprite, (bo->n[i] % 3) ? 0 : 1); | |||||
caca_blit(g->cv, bo->x[i], bo->y[i], heart_sprite, NULL); | |||||
break; | break; | ||||
case BONUS_NONE: | case BONUS_NONE: | ||||
break; | break; | ||||
@@ -37,12 +37,12 @@ void draw_box(game *g, box *b) | |||||
{ | { | ||||
int j, frame; | int j, frame; | ||||
cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK); | |||||
/* Draw the thin horizontal line */ | /* Draw the thin horizontal line */ | ||||
if(b->frame < 8) | if(b->frame < 8) | ||||
{ | { | ||||
cucul_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; | ||||
} | } | ||||
@@ -50,23 +50,23 @@ void draw_box(game *g, box *b) | |||||
/* Draw the frame */ | /* Draw the frame */ | ||||
frame = b->frame < 12 ? b->frame : 12; | frame = b->frame < 12 ? b->frame : 12; | ||||
cucul_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"); | ||||
cucul_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"); | ||||
cucul_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"); | ||||
cucul_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"); | ||||
cucul_set_color(g->cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_BLACK, CACA_COLOR_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++) | ||||
{ | { | ||||
cucul_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"); | ||||
} | } | ||||
@@ -76,18 +76,18 @@ void draw_box(game *g, box *b) | |||||
} | } | ||||
/* Draw the text inside the frame */ | /* Draw the text inside the frame */ | ||||
cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK); | |||||
/* FIXME: use a font */ | /* FIXME: use a font */ | ||||
cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 2, | |||||
caca_putstr(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."); | ||||
cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 3, | |||||
caca_putstr(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"); | ||||
cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 4, | |||||
caca_putstr(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"); | ||||
cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 5, | |||||
caca_putstr(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"); | ||||
cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 6, | |||||
caca_putstr(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'"); | ||||
} | } | ||||
@@ -27,7 +27,7 @@ void ceo_alert(game *g) | |||||
{ | { | ||||
caca_event_t ev; | caca_event_t ev; | ||||
cucul_clear_canvas(g->cv); | |||||
caca_clear_canvas(g->cv); | |||||
if(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) | if(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) | ||||
&& ev.data.key.ch == '\t') | && ev.data.key.ch == '\t') | ||||
@@ -119,12 +119,12 @@ void collide_weapons_tunnel(game *g, weapons *wp, tunnel *t, explosions *ex) | |||||
if(x - 2 <= t->left[y-j]) | if(x - 2 <= t->left[y-j]) | ||||
{ | { | ||||
add_explosion(g, ex, GET_MIN(t->left[y-j], x+3), y-j, 0, 1, EXPLOSION_SMALL); | add_explosion(g, ex, GET_MIN(t->left[y-j], x+3), y-j, 0, 1, EXPLOSION_SMALL); | ||||
t->left[y-j] -= cucul_rand(0,2); | |||||
t->left[y-j] -= caca_rand(0,2); | |||||
} | } | ||||
else if(x + 3 >= t->right[y-j]) | else if(x + 3 >= t->right[y-j]) | ||||
{ | { | ||||
add_explosion(g, ex, GET_MAX(t->right[y-j], x-2), y-j, 0, 1, EXPLOSION_SMALL); | add_explosion(g, ex, GET_MAX(t->right[y-j], x-2), y-j, 0, 1, EXPLOSION_SMALL); | ||||
t->right[y-j] += cucul_rand(0,2); | |||||
t->right[y-j] += caca_rand(0,2); | |||||
} | } | ||||
} | } | ||||
break; | break; | ||||
@@ -124,7 +124,7 @@ typedef struct | |||||
{ | { | ||||
int w, h; | int w, h; | ||||
cucul_canvas_t *cv; | |||||
caca_canvas_t *cv; | |||||
caca_display_t *dp; | caca_display_t *dp; | ||||
starfield *sf; | starfield *sf; | ||||
@@ -18,12 +18,12 @@ | |||||
#include "common.h" | #include "common.h" | ||||
cucul_canvas_t *medium_sprite; | |||||
cucul_canvas_t *small_sprite; | |||||
caca_canvas_t *medium_sprite; | |||||
caca_canvas_t *small_sprite; | |||||
void init_explosions(game *g, explosions *ex) | void init_explosions(game *g, explosions *ex) | ||||
{ | { | ||||
cucul_buffer_t *b; | |||||
caca_buffer_t *b; | |||||
int i; | int i; | ||||
for(i = 0; i < EXPLOSIONS; i++) | for(i = 0; i < EXPLOSIONS; i++) | ||||
@@ -31,13 +31,13 @@ void init_explosions(game *g, explosions *ex) | |||||
ex->type[i] = EXPLOSION_NONE; | ex->type[i] = EXPLOSION_NONE; | ||||
} | } | ||||
b = cucul_load_file("data/xplmed.caca"); | |||||
medium_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/xplmed.caca"); | |||||
medium_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
b = cucul_load_file("data/xplsmall.caca"); | |||||
small_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/xplsmall.caca"); | |||||
small_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
} | } | ||||
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,39 +74,39 @@ void draw_explosions(game *g, explosions *ex) | |||||
for(i = 0; i < EXPLOSIONS; i++) | for(i = 0; i < EXPLOSIONS; i++) | ||||
{ | { | ||||
#if 0 | #if 0 | ||||
cucul_set_fg_color(g->cv, CACA_COLOR_GREEN); | |||||
cucul_goto(g->cv, ex->x[i] + 3, ex->y[i]); | |||||
switch(cucul_rand(0,2)) | |||||
caca_set_fg_color(g->cv, CACA_COLOR_GREEN); | |||||
caca_goto(g->cv, ex->x[i] + 3, ex->y[i]); | |||||
switch(caca_rand(0,2)) | |||||
{ | { | ||||
case 0: | case 0: | ||||
cucul_putchar(g->cv, 'p'); | |||||
cucul_putchar(g->cv, 'i'); | |||||
cucul_putchar(g->cv, 'f'); | |||||
caca_putchar(g->cv, 'p'); | |||||
caca_putchar(g->cv, 'i'); | |||||
caca_putchar(g->cv, 'f'); | |||||
break; | break; | ||||
case 1: | case 1: | ||||
cucul_putchar(g->cv, 'p'); | |||||
cucul_putchar(g->cv, 'a'); | |||||
cucul_putchar(g->cv, 'f'); | |||||
caca_putchar(g->cv, 'p'); | |||||
caca_putchar(g->cv, 'a'); | |||||
caca_putchar(g->cv, 'f'); | |||||
break; | break; | ||||
case 2: | case 2: | ||||
cucul_putchar(g->cv, 'p'); | |||||
cucul_putchar(g->cv, 'o'); | |||||
cucul_putchar(g->cv, 'u'); | |||||
cucul_putchar(g->cv, 'f'); | |||||
caca_putchar(g->cv, 'p'); | |||||
caca_putchar(g->cv, 'o'); | |||||
caca_putchar(g->cv, 'u'); | |||||
caca_putchar(g->cv, 'f'); | |||||
break; | break; | ||||
} | } | ||||
cucul_putchar(g->cv, '!'); | |||||
caca_putchar(g->cv, '!'); | |||||
#endif | #endif | ||||
switch(ex->type[i]) | switch(ex->type[i]) | ||||
{ | { | ||||
case EXPLOSION_MEDIUM: | case EXPLOSION_MEDIUM: | ||||
cucul_set_canvas_frame(medium_sprite, 10 - ex->n[i]); | |||||
cucul_blit(g->cv, ex->x[i], ex->y[i], medium_sprite, NULL); | |||||
caca_set_canvas_frame(medium_sprite, 10 - ex->n[i]); | |||||
caca_blit(g->cv, ex->x[i], ex->y[i], medium_sprite, NULL); | |||||
break; | break; | ||||
case EXPLOSION_SMALL: | case EXPLOSION_SMALL: | ||||
cucul_set_canvas_frame(small_sprite, 6 - ex->n[i]); | |||||
cucul_blit(g->cv, ex->x[i], ex->y[i], small_sprite, NULL); | |||||
caca_set_canvas_frame(small_sprite, 6 - ex->n[i]); | |||||
caca_blit(g->cv, ex->x[i], ex->y[i], small_sprite, NULL); | |||||
break; | break; | ||||
case EXPLOSION_NONE: | case EXPLOSION_NONE: | ||||
break; | break; | ||||
@@ -23,23 +23,23 @@ | |||||
void intro(game *g) | void intro(game *g) | ||||
{ | { | ||||
caca_event_t ev; | caca_event_t ev; | ||||
cucul_canvas_t *foo_sprite; | |||||
cucul_canvas_t *bar_sprite; | |||||
cucul_canvas_t *baz_sprite; | |||||
cucul_buffer_t *b; | |||||
caca_canvas_t *foo_sprite; | |||||
caca_canvas_t *bar_sprite; | |||||
caca_canvas_t *baz_sprite; | |||||
caca_buffer_t *b; | |||||
int frame = 0; | int frame = 0; | ||||
b = cucul_load_file("data/foofight.caca"); | |||||
foo_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/foofight.caca"); | |||||
foo_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
b = cucul_load_file("data/barfight.caca"); | |||||
bar_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/barfight.caca"); | |||||
bar_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
b = cucul_load_file("data/bazfight.caca"); | |||||
baz_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/bazfight.caca"); | |||||
baz_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
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) | ||||
{ | { | ||||
@@ -47,15 +47,15 @@ void intro(game *g) | |||||
frame++; | frame++; | ||||
cucul_clear_canvas(g->cv); | |||||
caca_clear_canvas(g->cv); | |||||
xo = cucul_get_canvas_width(g->cv) / 2; | |||||
yo = cucul_get_canvas_height(g->cv) / 2; | |||||
xo = caca_get_canvas_width(g->cv) / 2; | |||||
yo = caca_get_canvas_height(g->cv) / 2; | |||||
cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); | |||||
cucul_fill_ellipse(g->cv, xo, yo, 16, 8, "#"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); | |||||
cucul_draw_thin_ellipse(g->cv, xo, yo, 16, 8); | |||||
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_draw_thin_ellipse(g->cv, xo, yo, 16, 8); | |||||
for(i = 0; i < 4; i ++) | for(i = 0; i < 4; i ++) | ||||
{ | { | ||||
@@ -65,15 +65,15 @@ void intro(game *g) | |||||
x[4] = x[0]; | x[4] = x[0]; | ||||
y[4] = y[0]; | y[4] = y[0]; | ||||
cucul_set_color(g->cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); | |||||
cucul_fill_triangle(g->cv, x[0], y[0], x[1], y[1], x[2], y[2], " "); | |||||
cucul_fill_triangle(g->cv, x[0], y[0], x[3], y[3], x[2], y[2], " "); | |||||
cucul_draw_line(g->cv, x[0], y[0], x[2], y[2], " "); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); | |||||
cucul_draw_thin_polyline(g->cv, x, y, 4); | |||||
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_draw_thin_polyline(g->cv, x, y, 4); | |||||
cucul_set_canvas_frame(foo_sprite, frame % 5); | |||||
cucul_blit(g->cv, xo, yo, foo_sprite, NULL); | |||||
caca_set_canvas_frame(foo_sprite, frame % 5); | |||||
caca_blit(g->cv, xo, yo, foo_sprite, NULL); | |||||
caca_refresh_display(g->dp); | caca_refresh_display(g->dp); | ||||
@@ -33,7 +33,7 @@ int _main (int argc, char **argv) | |||||
srand(time(NULL)); | srand(time(NULL)); | ||||
g->cv = cucul_create_canvas(0, 0); | |||||
g->cv = caca_create_canvas(0, 0); | |||||
if(!g->cv) | if(!g->cv) | ||||
return 1; | return 1; | ||||
@@ -44,8 +44,8 @@ int _main (int argc, char **argv) | |||||
caca_set_display_time(g->dp, 40000); | caca_set_display_time(g->dp, 40000); | ||||
/* Initialize our program */ | /* Initialize our program */ | ||||
g->w = cucul_get_canvas_width(g->cv); | |||||
g->h = cucul_get_canvas_height(g->cv); | |||||
g->w = caca_get_canvas_width(g->cv); | |||||
g->h = caca_get_canvas_height(g->cv); | |||||
intro(g); | intro(g); | ||||
@@ -54,7 +54,7 @@ intro(g); | |||||
/* Clean up */ | /* Clean up */ | ||||
caca_free_display(g->dp); | caca_free_display(g->dp); | ||||
cucul_free_canvas(g->cv); | |||||
caca_free_canvas(g->cv); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -194,11 +194,11 @@ static void start_game (game *g) | |||||
skip = 0; | skip = 0; | ||||
/* XXX: to be removed */ | /* XXX: to be removed */ | ||||
if(cucul_rand(0, 9) == 0) | |||||
if(caca_rand(0, 9) == 0) | |||||
{ | { | ||||
int list[3] = { ALIEN_FOO, ALIEN_BAR, ALIEN_BAZ }; | int list[3] = { ALIEN_FOO, ALIEN_BAR, ALIEN_BAZ }; | ||||
add_alien(g, g->al, 0, rand() % g->h / 2, list[cucul_rand(0,2)]); | |||||
add_alien(g, g->al, 0, rand() % g->h / 2, list[caca_rand(0,2)]); | |||||
} | } | ||||
/* Update game rules */ | /* Update game rules */ | ||||
@@ -227,7 +227,7 @@ static void start_game (game *g) | |||||
} | } | ||||
/* Clear screen */ | /* Clear screen */ | ||||
cucul_clear_canvas(g->cv); | |||||
caca_clear_canvas(g->cv); | |||||
/* Print starfield, tunnel, aliens, player and explosions */ | /* Print starfield, tunnel, aliens, player and explosions */ | ||||
draw_starfield(g, g->sf); | draw_starfield(g, g->sf); | ||||
@@ -24,50 +24,50 @@ void draw_status(game *g) | |||||
static char dashes30[] = "=============================="; | static char dashes30[] = "=============================="; | ||||
/* Draw life jauge */ | /* Draw life jauge */ | ||||
cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, 4, 1, dots30); | |||||
caca_set_color(g->cv, CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, 4, 1, dots30); | |||||
if(g->p->life > MAX_LIFE * 7 / 10) | if(g->p->life > MAX_LIFE * 7 / 10) | ||||
{ | { | ||||
cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_GREEN, CACA_COLOR_BLACK); | |||||
} | } | ||||
else if(g->p->life > MAX_LIFE * 3 / 10) | else if(g->p->life > MAX_LIFE * 3 / 10) | ||||
{ | { | ||||
cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_RED, CACA_COLOR_BLACK); | |||||
} | } | ||||
cucul_putstr(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); | |||||
caca_putstr(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, 1, 1, "L |"); | |||||
cucul_putstr(g->cv, 34, 1, "|"); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, 1, 1, "L |"); | |||||
caca_putstr(g->cv, 34, 1, "|"); | |||||
/* Draw weapon jauge */ | /* Draw weapon jauge */ | ||||
cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, 42, 1, dots30 + 10); | |||||
caca_set_color(g->cv, CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, 42, 1, dots30 + 10); | |||||
if(g->p->special > MAX_SPECIAL * 9 / 10) | if(g->p->special > MAX_SPECIAL * 9 / 10) | ||||
{ | { | ||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
} | } | ||||
else if(g->p->special > MAX_SPECIAL * 3 / 10) | else if(g->p->special > MAX_SPECIAL * 3 / 10) | ||||
{ | { | ||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK); | |||||
} | } | ||||
cucul_putstr(g->cv, 42, 1, dashes30 + 10 | |||||
caca_putstr(g->cv, 42, 1, dashes30 + 10 | |||||
+ (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL); | + (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL); | ||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, 39, 1, "S |"); | |||||
cucul_putstr(g->cv, 62, 1, "|"); | |||||
caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK); | |||||
caca_putstr(g->cv, 39, 1, "S |"); | |||||
caca_putstr(g->cv, 62, 1, "|"); | |||||
} | } | ||||
@@ -18,12 +18,12 @@ | |||||
#include "common.h" | #include "common.h" | ||||
cucul_canvas_t *ship_sprite; | |||||
caca_canvas_t *ship_sprite; | |||||
/* Init tunnel */ | /* Init tunnel */ | ||||
player * create_player(game *g) | player * create_player(game *g) | ||||
{ | { | ||||
cucul_buffer_t *b; | |||||
caca_buffer_t *b; | |||||
player *p = malloc(sizeof(player)); | player *p = malloc(sizeof(player)); | ||||
if(p == NULL) | if(p == NULL) | ||||
@@ -38,9 +38,9 @@ player * create_player(game *g) | |||||
p->life = MAX_LIFE; | p->life = MAX_LIFE; | ||||
p->dead = 0; | p->dead = 0; | ||||
b = cucul_load_file("data/ship.caca"); | |||||
ship_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/ship.caca"); | |||||
ship_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
return p; | return p; | ||||
} | } | ||||
@@ -55,8 +55,8 @@ void draw_player(game *g, player *p) | |||||
if(p->dead) | if(p->dead) | ||||
return; | return; | ||||
cucul_set_canvas_frame(ship_sprite, 0); | |||||
cucul_blit(g->cv, p->x, p->y, ship_sprite, NULL); | |||||
caca_set_canvas_frame(ship_sprite, 0); | |||||
caca_blit(g->cv, p->x, p->y, ship_sprite, NULL); | |||||
} | } | ||||
void update_player(game *g, player *p) | void update_player(game *g, player *p) | ||||
@@ -29,11 +29,11 @@ starfield * create_starfield(game *g) | |||||
for(i = 0; i < STARS; i++) | for(i = 0; i < STARS; i++) | ||||
{ | { | ||||
s[i].x = cucul_rand(0, g->w - 1); | |||||
s[i].y = cucul_rand(0, g->h - 1); | |||||
s[i].z = cucul_rand(1, 3); | |||||
s[i].c = cucul_rand(0, 1) ? CUCUL_COLOR_LIGHTGRAY : CUCUL_COLOR_DARKGRAY; | |||||
s[i].ch = cucul_rand(0, 1) ? '.' : '\''; | |||||
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) ? CACA_COLOR_LIGHTGRAY : CACA_COLOR_DARKGRAY; | |||||
s[i].ch = caca_rand(0, 1) ? '.' : '\''; | |||||
} | } | ||||
return s; | return s; | ||||
@@ -47,8 +47,8 @@ void draw_starfield(game *g, starfield *s) | |||||
{ | { | ||||
if(s[i].x >= 0) | if(s[i].x >= 0) | ||||
{ | { | ||||
cucul_set_color(g->cv, s[i].c, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, s[i].x, s[i].y, s[i].ch); | |||||
caca_set_color(g->cv, s[i].c, CACA_COLOR_BLACK); | |||||
caca_putchar(g->cv, s[i].x, s[i].y, s[i].ch); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -61,11 +61,11 @@ void update_starfield(game *g, starfield *s) | |||||
{ | { | ||||
if(s[i].x < 0) | if(s[i].x < 0) | ||||
{ | { | ||||
s[i].x = cucul_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 = cucul_rand(1, 2); | |||||
s[i].c = cucul_rand(0, 1) ? CUCUL_COLOR_LIGHTGRAY : CUCUL_COLOR_DARKGRAY; | |||||
s[i].ch = cucul_rand(0, 1) ? '.' : '\''; | |||||
s[i].z = caca_rand(1, 2); | |||||
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) | else if(s[i].y < g->h-1) | ||||
{ | { | ||||
@@ -18,23 +18,21 @@ | |||||
#include <caca.h> | #include <caca.h> | ||||
cucul_canvas_t *cv; | |||||
caca_canvas_t *cv; | |||||
caca_display_t *dp; | caca_display_t *dp; | ||||
cucul_canvas_t *ship, *alien; | |||||
caca_canvas_t *ship, *alien; | |||||
unsigned int shipx, shipy; | unsigned int shipx, shipy; | ||||
unsigned int frame, w, h; | unsigned int frame, w, h; | ||||
int ground[80]; | |||||
int ground[81]; | |||||
static void run_game(void); | static void run_game(void); | ||||
int main(int argc, char **argv) | int main(int argc, char **argv) | ||||
{ | { | ||||
cucul_buffer_t *b; | |||||
cv = cucul_create_canvas(80, 24); | |||||
cv = caca_create_canvas(80, 24); | |||||
if(!cv) | if(!cv) | ||||
return 1; | return 1; | ||||
@@ -45,23 +43,21 @@ int main(int argc, char **argv) | |||||
caca_set_display_time(dp, 80000); | caca_set_display_time(dp, 80000); | ||||
/* Initialize our program */ | /* Initialize our program */ | ||||
w = cucul_get_canvas_width(cv); | |||||
h = cucul_get_canvas_height(cv); | |||||
w = caca_get_canvas_width(cv); | |||||
h = caca_get_canvas_height(cv); | |||||
/* Load data */ | /* Load data */ | ||||
b = cucul_load_file("data/ship.ans"); | |||||
ship = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = cucul_load_file("data/alien.ans"); | |||||
alien = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
ship = caca_create_canvas(0, 0); | |||||
caca_import_file(ship, "data/ship.ans", ""); | |||||
alien = caca_create_canvas(0, 0); | |||||
caca_import_file(alien, "data/alien.ans", ""); | |||||
/* Go ! */ | /* Go ! */ | ||||
run_game(); | run_game(); | ||||
/* Clean up */ | /* Clean up */ | ||||
caca_free_display(dp); | caca_free_display(dp); | ||||
cucul_free_canvas(cv); | |||||
caca_free_canvas(cv); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -78,7 +74,7 @@ static void update_ground(void) | |||||
if(frame % 3) | if(frame % 3) | ||||
return; | return; | ||||
ground[80] += cucul_rand(-1, 2); | |||||
ground[80] += caca_rand(-1, 2); | |||||
if(ground[80] < 2) | if(ground[80] < 2) | ||||
ground[80] = 3; | ground[80] = 3; | ||||
else if(ground[80] > 7) | else if(ground[80] > 7) | ||||
@@ -101,59 +97,59 @@ static void display_ground(void) | |||||
for(i = 0; i < 80; i++) | for(i = 0; i < 80; i++) | ||||
{ | { | ||||
/* Draw the sky */ | /* Draw the sky */ | ||||
cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE, CUCUL_LIGHTCYAN); | |||||
caca_set_color_ansi(cv, CACA_LIGHTBLUE, CACA_LIGHTCYAN); | |||||
for(j = h - 24; j < h - 18 + ((40 - i) * (40 - i) / (40 * 40 / 10)) + (i & 1); j++) | for(j = h - 24; j < h - 18 + ((40 - i) * (40 - i) / (40 * 40 / 10)) + (i & 1); j++) | ||||
cucul_putchar(cv, i, j, ' '); | |||||
cucul_putchar(cv, i, j++, 0x2591); | |||||
cucul_putchar(cv, i, j++, 0x2591); | |||||
cucul_putchar(cv, i, j++, 0x2591); | |||||
cucul_putchar(cv, i, j++, 0x2592); | |||||
cucul_putchar(cv, i, j++, 0x2592); | |||||
cucul_putchar(cv, i, j++, 0x2592); | |||||
cucul_putchar(cv, i, j++, 0x2593); | |||||
cucul_putchar(cv, i, j++, 0x2593); | |||||
cucul_putchar(cv, i, j++, 0x2593); | |||||
cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE, CUCUL_LIGHTBLUE); | |||||
caca_put_char(cv, i, j, ' '); | |||||
caca_put_char(cv, i, j++, 0x2591); | |||||
caca_put_char(cv, i, j++, 0x2591); | |||||
caca_put_char(cv, i, j++, 0x2591); | |||||
caca_put_char(cv, i, j++, 0x2592); | |||||
caca_put_char(cv, i, j++, 0x2592); | |||||
caca_put_char(cv, i, j++, 0x2592); | |||||
caca_put_char(cv, i, j++, 0x2593); | |||||
caca_put_char(cv, i, j++, 0x2593); | |||||
caca_put_char(cv, i, j++, 0x2593); | |||||
caca_set_color_ansi(cv, CACA_LIGHTBLUE, CACA_LIGHTBLUE); | |||||
for( ; j < h; j++) | for( ; j < h; j++) | ||||
cucul_putchar(cv, i, j, ' '); | |||||
caca_put_char(cv, i, j, ' '); | |||||
/* TODO: Draw the mountains */ | /* TODO: Draw the mountains */ | ||||
/* Draw the ground */ | /* Draw the ground */ | ||||
j = h - ground[i]; | j = h - ground[i]; | ||||
cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_LIGHTBLUE); | |||||
if(i >= 4 && ground[i] == ground[i - 6] | |||||
caca_set_color_ansi(cv, CACA_BLACK, CACA_LIGHTBLUE); | |||||
/* if(i >= 4 && ground[i] == ground[i - 6] | |||||
&& ground[i] != ground[i - 7]) | && ground[i] != ground[i - 7]) | ||||
{ | { | ||||
cucul_putstr(cv, i - 3, j - 2, "Omm"); | |||||
cucul_putstr(cv, i - 6, j - 1, "(/)-(/)"); | |||||
} | |||||
cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_GREEN); | |||||
caca_putstr(cv, i - 3, j - 2, "Omm"); | |||||
caca_putstr(cv, i - 6, j - 1, "(/)-(/)"); | |||||
}*/ | |||||
caca_set_color_ansi(cv, CACA_RED, CACA_GREEN); | |||||
if(ground[i + 1] > ground[i]) | if(ground[i + 1] > ground[i]) | ||||
cucul_putchar(cv, i, j++, 0x2588); // UTF-8: 0x259f | |||||
caca_put_char(cv, i, j++, 0x2588); // UTF-8: 0x259f | |||||
else if(ground[i + 1] < ground[i]) | else if(ground[i + 1] < ground[i]) | ||||
{ | { | ||||
j++; | j++; | ||||
cucul_putchar(cv, i, j++, 0x2588); // UTF-8: 0x2599 | |||||
caca_put_char(cv, i, j++, 0x2588); // UTF-8: 0x2599 | |||||
} | } | ||||
else | else | ||||
cucul_putchar(cv, i, j++, 0x2584); | |||||
cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BROWN); | |||||
cucul_putchar(cv, i, j++, 0x2593); | |||||
cucul_putchar(cv, i, j++, 0x2592); | |||||
cucul_putchar(cv, i, j++, 0x2591); | |||||
caca_put_char(cv, i, j++, 0x2584); | |||||
caca_set_color_ansi(cv, CACA_RED, CACA_BROWN); | |||||
caca_put_char(cv, i, j++, 0x2593); | |||||
caca_put_char(cv, i, j++, 0x2592); | |||||
caca_put_char(cv, i, j++, 0x2591); | |||||
for( ; j < h; j++) | for( ; j < h; j++) | ||||
cucul_putchar(cv, i, j, ' '); | |||||
caca_put_char(cv, i, j, ' '); | |||||
} | } | ||||
} | } | ||||
static void display_stuff(void) | static void display_stuff(void) | ||||
{ | { | ||||
cucul_blit(cv, shipx, shipy, ship, NULL); | |||||
cucul_blit(cv, 68, h - 22, alien, NULL); | |||||
cucul_blit(cv, 52, h - 16, alien, NULL); | |||||
cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||||
cucul_printf(cv, 2, h - 2, " %i fps ", 1000000 / (1 + caca_get_display_time(dp))); | |||||
caca_blit(cv, shipx, shipy, ship, NULL); | |||||
caca_blit(cv, 68, h - 22, alien, NULL); | |||||
caca_blit(cv, 52, h - 16, alien, NULL); | |||||
caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||||
caca_printf(cv, 2, h - 2, " %i fps ", 1000000 / (1 + caca_get_display_time(dp))); | |||||
} | } | ||||
static void run_game(void) | static void run_game(void) | ||||
@@ -69,7 +69,7 @@ void draw_tunnel(game *g, tunnel *t) | |||||
int i, j; | int i, j; | ||||
char c; | char c; | ||||
cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); | |||||
caca_set_color(g->cv, CACA_COLOR_RED, CACA_COLOR_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]) ? '\\' : '<'; | ||||
cucul_putchar(g->cv, t->left[i] + 1, i, c); | |||||
caca_putchar(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++) | ||||
cucul_putchar(g->cv, t->left[i] + j + 1, i, '_'); | |||||
caca_putchar(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++) | ||||
cucul_putchar(g->cv, t->right[i+1] + j - 1, i, '_'); | |||||
caca_putchar(g->cv, t->right[i+1] + j - 1, i, '_'); | |||||
cucul_putchar(g->cv, t->right[i] - 1, i, c); | |||||
caca_putchar(g->cv, t->right[i] - 1, i, c); | |||||
} | } | ||||
cucul_set_color(g->cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_RED); | |||||
caca_set_color(g->cv, CACA_COLOR_LIGHTRED, CACA_COLOR_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++) | ||||
cucul_putchar(g->cv, j, i, '#'); | |||||
caca_putchar(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++) | ||||
cucul_putchar(g->cv, j, i, '#'); | |||||
caca_putchar(g->cv, j, i, '#'); | |||||
} | } | ||||
void update_tunnel(game *g, tunnel *t) | void update_tunnel(game *g, tunnel *t) | ||||
@@ -133,8 +133,8 @@ void update_tunnel(game *g, tunnel *t) | |||||
} | } | ||||
/* Generate new values */ | /* Generate new values */ | ||||
i = delta[cucul_rand(0,5)]; | |||||
j = delta[cucul_rand(0,5)]; | |||||
i = delta[caca_rand(0,5)]; | |||||
j = delta[caca_rand(0,5)]; | |||||
/* Check in which direction we need to alter tunnel */ | /* Check in which direction we need to alter tunnel */ | ||||
if(t->right[1] - t->left[1] < t->w) | if(t->right[1] - t->left[1] < t->w) | ||||
@@ -24,12 +24,12 @@ static void draw_nuke(game *g, int x, int y, int frame); | |||||
static void draw_beam(game *g, int x, int y, int frame); | static void draw_beam(game *g, int x, int y, int frame); | ||||
static void draw_fragbomb(game *g, int x, int y, int frame); | static void draw_fragbomb(game *g, int x, int y, int frame); | ||||
cucul_canvas_t *bomb_sprite; | |||||
cucul_canvas_t *fragbomb_sprite; | |||||
caca_canvas_t *bomb_sprite; | |||||
caca_canvas_t *fragbomb_sprite; | |||||
void init_weapons(game *g, weapons *wp) | void init_weapons(game *g, weapons *wp) | ||||
{ | { | ||||
cucul_buffer_t *b; | |||||
caca_buffer_t *b; | |||||
int i; | int i; | ||||
for(i = 0; i < WEAPONS; i++) | for(i = 0; i < WEAPONS; i++) | ||||
@@ -37,13 +37,13 @@ void init_weapons(game *g, weapons *wp) | |||||
wp->type[i] = WEAPON_NONE; | wp->type[i] = WEAPON_NONE; | ||||
} | } | ||||
b = cucul_load_file("data/wpnbomb.caca"); | |||||
bomb_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/wpnbomb.caca"); | |||||
bomb_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
b = cucul_load_file("data/wpnfrag.caca"); | |||||
bomb_sprite = cucul_import_canvas(b, ""); | |||||
cucul_free_buffer(b); | |||||
b = caca_load_file("data/wpnfrag.caca"); | |||||
bomb_sprite = caca_import_canvas(b, ""); | |||||
caca_free_buffer(b); | |||||
} | } | ||||
void draw_weapons(game *g, weapons *wp) | void draw_weapons(game *g, weapons *wp) | ||||
@@ -55,25 +55,25 @@ void draw_weapons(game *g, weapons *wp) | |||||
switch(wp->type[i]) | switch(wp->type[i]) | ||||
{ | { | ||||
case WEAPON_LASER: | case WEAPON_LASER: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '|'); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|'); | |||||
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, '|'); | |||||
break; | break; | ||||
case WEAPON_SEEKER: | case WEAPON_SEEKER: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); | |||||
cucul_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, 'o'); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_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->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, '@'); | |||||
break; | break; | ||||
case WEAPON_BOMB: | case WEAPON_BOMB: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.'); | |||||
cucul_putchar(g->cv, (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.'); | |||||
cucul_putchar(g->cv, (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4, '.'); | |||||
cucul_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); | |||||
cucul_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, '.'); | |||||
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, '.'); | |||||
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,19 +333,19 @@ static void draw_bomb(game *g, int x, int y, int vx, int vy) | |||||
} | } | ||||
} | } | ||||
cucul_set_canvas_frame(bomb_sprite, frame); | |||||
cucul_blit(g->cv, x, y, bomb_sprite, NULL); | |||||
caca_set_canvas_frame(bomb_sprite, frame); | |||||
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 */ | ||||
cucul_set_canvas_frame(fragbomb_sprite, frame & 1); | |||||
cucul_blit(g->cv, x, y, fragbomb_sprite, NULL); | |||||
caca_set_canvas_frame(fragbomb_sprite, frame & 1); | |||||
caca_blit(g->cv, x, y, fragbomb_sprite, NULL); | |||||
/* Draw the tail */ | /* Draw the tail */ | ||||
cucul_set_canvas_frame(fragbomb_sprite, 2 + (frame % 4)); | |||||
cucul_blit(g->cv, x, y, fragbomb_sprite, NULL); | |||||
caca_set_canvas_frame(fragbomb_sprite, 2 + (frame % 4)); | |||||
caca_blit(g->cv, x, y, fragbomb_sprite, NULL); | |||||
} | } | ||||
static void draw_beam(game *g, int x, int y, int frame) | static void draw_beam(game *g, int x, int y, int frame) | ||||
@@ -356,86 +356,86 @@ static void draw_beam(game *g, int x, int y, int frame) | |||||
switch(frame) | switch(frame) | ||||
{ | { | ||||
case 24: | case 24: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x, y-3, "__"); | |||||
cucul_putchar(g->cv, x-1, y-2, '\''); | |||||
cucul_putchar(g->cv, x+2, y-2, '`'); | |||||
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, '`'); | |||||
break; | break; | ||||
case 23: | case 23: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x, y-3, "__"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x-2, y-2, "-'"); | |||||
cucul_putstr(g->cv, x+2, y-2, "`-"); | |||||
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, "`-"); | |||||
break; | break; | ||||
case 22: | case 22: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x, y-3, "__"); | |||||
cucul_putchar(g->cv, x-1, y-2, '\''); | |||||
cucul_putchar(g->cv, x+2, y-2, '`'); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x-3, y-2, ",-"); | |||||
cucul_putstr(g->cv, x+3, y-2, "-."); | |||||
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, "-."); | |||||
break; | break; | ||||
case 21: | case 21: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x-1, y-3, "____"); | |||||
cucul_putchar(g->cv, x-2, y-2, '\''); | |||||
cucul_putchar(g->cv, x+3, y-2, '`'); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x-4, y-2, ",-"); | |||||
cucul_putstr(g->cv, x+4, y-2, "-."); | |||||
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, "-."); | |||||
break; | break; | ||||
case 20: | case 20: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x, y-3, "%%"); | |||||
cucul_putchar(g->cv, x-4, y-2, ','); | |||||
cucul_putchar(g->cv, x+5, y-2, '.'); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, x-1, y-3, ':'); | |||||
cucul_putchar(g->cv, x+2, y-3, ':'); | |||||
cucul_putstr(g->cv, x-3, y-2, "-'"); | |||||
cucul_putstr(g->cv, x+3, y-2, "`-"); | |||||
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, "`-"); | |||||
break; | break; | ||||
case 19: | case 19: | ||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x, y-4, "%%"); | |||||
cucul_putstr(g->cv, x, y-3, "##"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, x-1, y-4, ':'); | |||||
cucul_putchar(g->cv, x+2, y-4, ':'); | |||||
cucul_putchar(g->cv, x-1, y-3, '%'); | |||||
cucul_putchar(g->cv, x+2, y-3, '%'); | |||||
cucul_putstr(g->cv, x-4, y-2, ",-'"); | |||||
cucul_putstr(g->cv, x+3, y-2, "`-."); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, x-2, y-3, ':'); | |||||
cucul_putchar(g->cv, x+3, y-3, ':'); | |||||
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, ':'); | |||||
break; | break; | ||||
case 18: | case 18: | ||||
default: | default: | ||||
r = (18 - frame) * (18 - frame); | r = (18 - frame) * (18 - frame); | ||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x-1, y-5-r, ":%%:"); | |||||
cucul_putstr(g->cv, x-1, y-4-r, "%##%"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, x-2, y-4-r, ':'); | |||||
cucul_putchar(g->cv, x+3, y-4-r, ':'); | |||||
cucul_putchar(g->cv, x-2, y-2, '\''); | |||||
cucul_putchar(g->cv, x+3, y-2, '`'); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, x-3, y-2, ':'); | |||||
cucul_putchar(g->cv, x+4, y-2, ':'); | |||||
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, ':'); | |||||
for(i = 0; i <= r; i++) | for(i = 0; i <= r; i++) | ||||
{ | { | ||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||||
cucul_putstr(g->cv, x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, x-2, y-3-i, '%'); | |||||
cucul_putchar(g->cv, x+3, y-3-i, '%'); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); | |||||
cucul_putchar(g->cv, x-3, y-3-i, ':'); | |||||
cucul_putchar(g->cv, x+4, y-3-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, ':'); | |||||
} | } | ||||
break; | break; | ||||
} | } | ||||
@@ -446,20 +446,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 */ | ||||
cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); | |||||
cucul_draw_ellipse(g->cv, x, y, r, r / 2, ":"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLUE); | |||||
cucul_draw_ellipse(g->cv, x, y, r + 1, r / 2, "#"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_LIGHTBLUE); | |||||
cucul_draw_ellipse(g->cv, x, y, r + 2, r / 2, "#"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_LIGHTBLUE); | |||||
cucul_draw_ellipse(g->cv, x, y, r + 2, r / 2 + 1, "#"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_CYAN); | |||||
cucul_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 1, "#"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_CYAN); | |||||
cucul_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 2, "#"); | |||||
cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_WHITE); | |||||
cucul_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 2, "#"); | |||||
cucul_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 3, " "); | |||||
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, " "); | |||||
} | } | ||||