+ Added missing #include "config.h". + Fixed a nasty bug in ee_rand() calls. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/ttyvaders/trunk@110 92316355-f0b4-4df1-b90c-862c8a59935fmaster
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||
@@ -72,7 +74,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], ee_rand(0,5) ? BONUS_GREEN : BONUS_LIFE); | |||||
add_bonus(g, g->bo, al->x[i], al->y[i], ee_rand(0,4) ? BONUS_GREEN : BONUS_LIFE); | |||||
} | } | ||||
/* Update coordinates */ | /* Update coordinates */ | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||
@@ -125,12 +127,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] -= ee_rand(0,3); | |||||
t->left[y-j] -= ee_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] += ee_rand(0,3); | |||||
t->right[y-j] += ee_rand(0,2); | |||||
} | } | ||||
} | } | ||||
break; | break; | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||
@@ -73,7 +75,7 @@ void draw_explosions(game *g, explosions *ex) | |||||
#if 0 | #if 0 | ||||
ee_color(GREEN); | ee_color(GREEN); | ||||
ee_goto(ex->x[i] + 3, ex->y[i]); | ee_goto(ex->x[i] + 3, ex->y[i]); | ||||
switch(ee_rand(0,3)) | |||||
switch(ee_rand(0,2)) | |||||
{ | { | ||||
case 0: | case 0: | ||||
ee_putchar('p'); | ee_putchar('p'); | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
@@ -182,11 +184,11 @@ static void start_game (game *g) | |||||
skip = 0; | skip = 0; | ||||
/* XXX: to be removed */ | /* XXX: to be removed */ | ||||
if(ee_rand(0,10) == 0) | |||||
if(ee_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[ee_rand(0,3)]); | |||||
add_alien(g, g->al, 0, rand() % g->h / 2, list[ee_rand(0,2)]); | |||||
} | } | ||||
/* Update game rules */ | /* Update game rules */ | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||
@@ -33,11 +35,11 @@ starfield * create_starfield(game *g) | |||||
for(i = 0; i < STARS; i++) | for(i = 0; i < STARS; i++) | ||||
{ | { | ||||
s[i].x = ee_rand(0, g->w); | |||||
s[i].y = ee_rand(0, g->h); | |||||
s[i].z = ee_rand(1, 4); | |||||
s[i].c = ee_rand(6, 8); | |||||
s[i].ch = ee_rand(0, 2) ? '.' : '\''; | |||||
s[i].x = ee_rand(0, g->w - 1); | |||||
s[i].y = ee_rand(0, g->h - 1); | |||||
s[i].z = ee_rand(1, 3); | |||||
s[i].c = ee_rand(6, 7); | |||||
s[i].ch = ee_rand(0, 1) ? '.' : '\''; | |||||
} | } | ||||
return s; | return s; | ||||
@@ -66,11 +68,11 @@ void update_starfield(game *g, starfield *s) | |||||
{ | { | ||||
if(s[i].x < 0) | if(s[i].x < 0) | ||||
{ | { | ||||
s[i].x = ee_rand(0, g->w); | |||||
s[i].x = ee_rand(0, g->w - 1); | |||||
s[i].y = 0; | s[i].y = 0; | ||||
s[i].z = ee_rand(1, 3); | |||||
s[i].c = ee_rand(6, 8); | |||||
s[i].ch = ee_rand(0, 2) ? '.' : '\''; | |||||
s[i].z = ee_rand(1, 2); | |||||
s[i].c = ee_rand(6, 7); | |||||
s[i].ch = ee_rand(0, 1) ? '.' : '\''; | |||||
} | } | ||||
else if(s[i].y < g->h-1) | else if(s[i].y < g->h-1) | ||||
{ | { | ||||
@@ -169,8 +169,8 @@ void update_tunnel(game *g, tunnel *t) | |||||
} | } | ||||
/* Generate new values */ | /* Generate new values */ | ||||
i = delta[ee_rand(0,6)]; | |||||
j = delta[ee_rand(0,6)]; | |||||
i = delta[ee_rand(0,5)]; | |||||
j = delta[ee_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) | ||||
@@ -20,6 +20,8 @@ | |||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | #include "common.h" | ||||