Explorar el Código

* src/*.c:

+ 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-862c8a59935f
master
sam hace 21 años
padre
commit
3e62735047
Se han modificado 11 ficheros con 37 adiciones y 17 borrados
  1. +3
    -1
      src/aliens.c
  2. +2
    -0
      src/bonus.c
  3. +2
    -0
      src/box.c
  4. +4
    -2
      src/collide.c
  5. +3
    -1
      src/explosions.c
  6. +4
    -2
      src/main.c
  7. +2
    -0
      src/overlay.c
  8. +2
    -0
      src/player.c
  9. +11
    -9
      src/starfield.c
  10. +2
    -2
      src/tunnel.c
  11. +2
    -0
      src/weapons.c

+ 3
- 1
src/aliens.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.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);
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 */


+ 2
- 0
src/bonus.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.h>

#include "common.h"


+ 2
- 0
src/box.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.h>

#include "common.h"


+ 4
- 2
src/collide.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.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])
{
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])
{
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;


+ 3
- 1
src/explosions.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.h>

#include "common.h"
@@ -73,7 +75,7 @@ void draw_explosions(game *g, explosions *ex)
#if 0
ee_color(GREEN);
ee_goto(ex->x[i] + 3, ex->y[i]);
switch(ee_rand(0,3))
switch(ee_rand(0,2))
{
case 0:
ee_putchar('p');


+ 4
- 2
src/main.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdio.h>
#include <stdlib.h>

@@ -182,11 +184,11 @@ static void start_game (game *g)
skip = 0;

/* 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 };

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 */


+ 2
- 0
src/overlay.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.h>

#include "common.h"


+ 2
- 0
src/player.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.h>

#include "common.h"


+ 11
- 9
src/starfield.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.h>

#include "common.h"
@@ -33,11 +35,11 @@ starfield * create_starfield(game *g)

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;
@@ -66,11 +68,11 @@ void update_starfield(game *g, starfield *s)
{
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].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)
{


+ 2
- 2
src/tunnel.c Ver fichero

@@ -169,8 +169,8 @@ void update_tunnel(game *g, tunnel *t)
}

/* 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 */
if(t->right[1] - t->left[1] < t->w)


+ 2
- 0
src/weapons.c Ver fichero

@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "config.h"

#include <stdlib.h>

#include "common.h"


Cargando…
Cancelar
Guardar