[gnome-games] Integrated new GnibblesLevel to boni.c



commit af74770e47cb2671d4569743d2f6dd6307ea61ec
Author: Guillaume Beland <guillaume beland gmail com>
Date:   Sat Jun 20 22:06:36 2009 -0400

    Integrated new GnibblesLevel to boni.c

 gnibbles/boni.c  |   38 ++++++++++++++++++++++++++++++++++----
 gnibbles/level.c |    1 +
 2 files changed, 35 insertions(+), 4 deletions(-)
---
diff --git a/gnibbles/boni.c b/gnibbles/boni.c
index 88dd8e0..380361e 100644
--- a/gnibbles/boni.c
+++ b/gnibbles/boni.c
@@ -30,8 +30,10 @@
 #include "bonus.h"
 #include "boni.h"
 #include "ggz-network.h"
+#include "level.h"
 
 extern gchar board[BOARDWIDTH][BOARDHEIGHT];
+extern GnibblesLevel *level;
 
 GnibblesBoni *
 gnibbles_boni_new (void)
@@ -67,12 +69,19 @@ gnibbles_boni_add_bonus (GnibblesBoni * boni, gint t_x, gint t_y,
   if (boni->numbonuses == MAXBONUSES)
     return;
   boni->bonuses[boni->numbonuses] = gnibbles_bonus_new (t_x, t_y,
-							t_type, t_fake,
-							t_countdown);
+							                                          t_type, t_fake,
+							                                          t_countdown);
   board[t_x][t_y] = t_type + 'A';
   board[t_x + 1][t_y] = t_type + 'A';
   board[t_x][t_y + 1] = t_type + 'A';
   board[t_x + 1][t_y + 1] = t_type + 'A';
+
+  //gnibbles-clutter-level
+  level->walls[t_x][t_y] = t_type = 'A';
+  level->walls[t_x + 1][t_y] = t_type + 'A';
+  level->walls[t_x][t_y + 1] = t_type + 'A';
+  level->walls[t_x + 1][t_y + 1] = t_type + 'A';
+
   gnibbles_bonus_draw (boni->bonuses[boni->numbonuses]);
   boni->numbonuses++;
   if (t_type != BONUSREGULAR)
@@ -98,6 +107,13 @@ gnibbles_boni_add_bonus_final (GnibblesBoni * boni, gint t_x, gint t_y,
   board[t_x + 1][t_y] = t_type + 'A';
   board[t_x][t_y + 1] = t_type + 'A';
   board[t_x + 1][t_y + 1] = t_type + 'A';
+
+  //gnibbles-clutter-level
+  level->walls[t_x][t_y] = t_type + 'A';
+  level->walls[t_x + 1][t_y] = t_type + 'A';
+  level->walls[t_x][t_y + 1] = t_type + 'A';
+  level->walls[t_x + 1][t_y + 1] = t_type + 'A';
+
   gnibbles_bonus_draw (boni->bonuses[boni->numbonuses]);
   boni->numbonuses++;
   if (t_type != BONUSREGULAR)
@@ -120,6 +136,7 @@ gnibbles_boni_fake (GnibblesBoni * boni, gint x, gint y)
       return (boni->bonuses[i]->fake);
     }
   }
+
   return 0;
 }
 
@@ -144,8 +161,14 @@ gnibbles_boni_remove_bonus (GnibblesBoni * boni, gint x, gint y)
       board[boni->bonuses[i]->x][boni->bonuses[i]->y] = EMPTYCHAR;
       board[boni->bonuses[i]->x + 1][boni->bonuses[i]->y] = EMPTYCHAR;
       board[boni->bonuses[i]->x][boni->bonuses[i]->y + 1] = EMPTYCHAR;
-      board[boni->bonuses[i]->x + 1][boni->bonuses[i]->y + 1]
-	= EMPTYCHAR;
+      board[boni->bonuses[i]->x + 1][boni->bonuses[i]->y + 1]	= EMPTYCHAR;
+
+      //gnibbles-clutter-level
+      level->walls[boni->bonuses[i]->x][boni->bonuses[i]->y] = EMPTYCHAR;
+      level->walls[boni->bonuses[i]->x + 1][boni->bonuses[i]->y] = EMPTYCHAR;
+      level->walls[boni->bonuses[i]->x][boni->bonuses[i]->y + 1] = EMPTYCHAR;
+      level->walls[boni->bonuses[i]->x + 1][boni->bonuses[i]->y + 1]	= EMPTYCHAR;
+
       gnibbles_bonus_erase (boni->bonuses[i]);
       boni->bonuses[i] = boni->bonuses[--boni->numbonuses];
       return;
@@ -170,6 +193,13 @@ gnibbles_boni_remove_bonus_final (GnibblesBoni * boni, gint x, gint y)
       board[boni->bonuses[i]->x + 1][boni->bonuses[i]->y] = EMPTYCHAR;
       board[boni->bonuses[i]->x][boni->bonuses[i]->y + 1] = EMPTYCHAR;
       board[boni->bonuses[i]->x + 1][boni->bonuses[i]->y + 1] = EMPTYCHAR;
+
+      //gnibbles-clutter-level
+      level->walls[boni->bonuses[i]->x][boni->bonuses[i]->y] = EMPTYCHAR;
+      level->walls[boni->bonuses[i]->x + 1][boni->bonuses[i]->y] = EMPTYCHAR;
+      level->walls[boni->bonuses[i]->x][boni->bonuses[i]->y + 1] = EMPTYCHAR;
+      level->walls[boni->bonuses[i]->x + 1][boni->bonuses[i]->y + 1] = EMPTYCHAR;
+
       gnibbles_bonus_erase (boni->bonuses[i]);
       boni->bonuses[i] = boni->bonuses[--boni->numbonuses];
       return;
diff --git a/gnibbles/level.c b/gnibbles/level.c
index afb2ab7..f5f3d3d 100644
--- a/gnibbles/level.c
+++ b/gnibbles/level.c
@@ -30,6 +30,7 @@
 extern GnibblesCWorm *cworms[];
 extern GnibblesProperties *properties;
 extern GnibblesWarpManager *warpmanager;
+
 GnibblesLevel *
 gnibbles_level_new (gint level)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]