[gnome-games] Removed old code, renamed function & global variables



commit 2c076e88ff7c89b8c1f745f48950e660134bfe10
Author: Guillaume Beland <guillaume beland gmail com>
Date:   Tue Jul 7 21:51:41 2009 -0400

    Removed old code, renamed function & global variables

 gnibbles/bonus.c        |    4 +-
 gnibbles/ggz-network.c  |    3 +-
 gnibbles/gnibbles.c     |  307 ++++++-----------------------
 gnibbles/gnibbles.h     |   17 +-
 gnibbles/level.c        |   15 +-
 gnibbles/main.c         |  486 ++++-------------------------------------------
 gnibbles/main.h         |    1 -
 gnibbles/warp.c         |    4 +-
 gnibbles/warpmanager.c  |    2 +-
 gnibbles/worm-clutter.c |   28 ++--
 10 files changed, 139 insertions(+), 728 deletions(-)
---
diff --git a/gnibbles/bonus.c b/gnibbles/bonus.c
index e593f5a..656c023 100644
--- a/gnibbles/bonus.c
+++ b/gnibbles/bonus.c
@@ -32,7 +32,7 @@
 
 extern GdkPixbuf *boni_pixmaps[];
 extern GnibblesProperties *properties;
-extern GnibblesBoard *clutter_board;
+extern GnibblesBoard *board;
 
 GnibblesBonus *
 gnibbles_bonus_new (gint t_x, gint t_y, gint t_type,
@@ -66,7 +66,7 @@ gnibbles_bonus_draw_clutter (GnibblesBonus *bonus)
   clutter_actor_set_position (CLUTTER_ACTOR (bonus->actor),
                               bonus->x * properties->tilesize,
                               bonus->y * properties->tilesize);
-  ClutterActor *stage = gnibbles_board_get_stage (clutter_board);
+  ClutterActor *stage = gnibbles_board_get_stage (board);
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), bonus->actor);
 }
 /*
diff --git a/gnibbles/ggz-network.c b/gnibbles/ggz-network.c
index a0fee97..333fe8b 100644
--- a/gnibbles/ggz-network.c
+++ b/gnibbles/ggz-network.c
@@ -45,7 +45,6 @@
 #include "gnibbles.h"
 #include "properties.h"
 #include "ggz-network.h"
-//#include "worm.h"
 #include "worm-clutter.h"
 
 
@@ -190,7 +189,7 @@ game_handle_io (GGZMod * mod)
 
   case GN_MSG_START:
     gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), MAIN_PAGE);
-    new_game_clutter ();
+    new_game ();
     break;
 
   case GN_MSG_SYNC:
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index 64cad97..6e7b767 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -37,7 +37,6 @@
 
 #include "main.h"
 #include "gnibbles.h"
-//#include "worm.h"
 #include "boni.h"
 #include "bonus.h"
 #include "warpmanager.h"
@@ -51,7 +50,7 @@
 #include "ggz-network.h"
 #endif
 
-GnibblesCWorm *cworms[NUMWORMS];
+GnibblesCWorm *worms[NUMWORMS];
 
 //GnibblesWorm *worms[NUMWORMS];
 GnibblesBoni *boni = NULL;
@@ -59,15 +58,6 @@ GnibblesWarpManager *warpmanager;
 
 GdkPixmap *buffer_pixmap = NULL;
 GdkPixbuf *logo_pixmap = NULL;
-//old pixbuf
-GdkPixbuf *bonus_pixmaps[9] = { NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL
-};
-GdkPixbuf *small_pixmaps[19] = { NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL
-};
 
 // clutter-related pixbuf
 GdkPixbuf *wall_pixmaps[11] = { NULL, NULL, NULL, NULL, NULL,
@@ -85,9 +75,9 @@ GdkPixbuf *boni_pixmaps[9] = { NULL, NULL, NULL, NULL, NULL,
 
 extern GtkWidget *drawing_area;
 
-extern gchar board[BOARDWIDTH][BOARDHEIGHT];
+//extern gchar board[BOARDWIDTH][BOARDHEIGHT];
 extern GnibblesLevel *level;
-extern GnibblesBoard *clutter_board;
+extern GnibblesBoard *board;
 
 extern GnibblesProperties *properties;
 
@@ -98,7 +88,7 @@ extern guint properties->tilesize, properties->tilesize;
 */
 
 static GdkPixbuf *
-gnibbles_clutter_load_pixmap_file (const gchar * pixmap, gint xsize, gint ysize)
+gnibbles_load_pixmap_file (const gchar * pixmap, gint xsize, gint ysize)
 {
   GdkPixbuf *image;
   gchar *filename;
@@ -122,7 +112,7 @@ gnibbles_clutter_load_pixmap_file (const gchar * pixmap, gint xsize, gint ysize)
 }
 
 void 
-gnibbles_clutter_load_pixmap (gint tilesize)
+gnibbles_load_pixmap (gint tilesize)
 {
   gchar *bonus_files[] = {
     "blank.svg",
@@ -166,7 +156,7 @@ gnibbles_clutter_load_pixmap (gint tilesize)
     if (boni_pixmaps[i])
       g_object_unref (boni_pixmaps[i]);
 
-    boni_pixmaps[i] = gnibbles_clutter_load_pixmap_file (bonus_files[i],
+    boni_pixmaps[i] = gnibbles_load_pixmap_file (bonus_files[i],
   					                                             4 * tilesize,
                           						                   4 * tilesize);
   }
@@ -175,7 +165,7 @@ gnibbles_clutter_load_pixmap (gint tilesize)
     if (wall_pixmaps[i])
       g_object_unref (wall_pixmaps[i]);
       
-    wall_pixmaps[i] = gnibbles_clutter_load_pixmap_file (small_files[i],
+    wall_pixmaps[i] = gnibbles_load_pixmap_file (small_files[i],
   	 	  		                                             2 * tilesize,
                            						                   2 * tilesize);
   }
@@ -184,171 +174,23 @@ gnibbles_clutter_load_pixmap (gint tilesize)
     if (worm_pixmaps[i])
       g_object_unref (worm_pixmaps[i]);
 
-    worm_pixmaps[i] = gnibbles_clutter_load_pixmap_file (worm_files[i], 
+    worm_pixmaps[i] = gnibbles_load_pixmap_file (worm_files[i], 
                                                         tilesize, tilesize);
   }
 }
-/*
-static void
-gnibbles_error (GtkWidget * window, gchar * message)
-{
-  GtkWidget *w =
-    gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL,
-			    GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
-			    "%s", message);
-  gtk_dialog_run (GTK_DIALOG (w));
-  gtk_widget_destroy (GTK_WIDGET (w));
-  exit (1);
-}
-
-static GdkPixbuf *
-gnibbles_load_pixmap_file (GtkWidget * window, const gchar * pixmap,
-			   gint xsize, gint ysize)
-{
-  GdkPixbuf *image;
-  gchar *filename;
-  const char *dirname;
-
-  dirname = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
-  filename = g_build_filename (dirname, pixmap, NULL);
-
-  if (!filename) {
-    char *message =
-      g_strdup_printf (_("Nibbles couldn't find pixmap file:\n%s\n\n"
-			 "Please check your Nibbles installation"), pixmap);
-    gnibbles_error (window, message);
-    // We should never get here since the app exits in gnibbles_error. But let's
-    // free it anyway in case someone comes along and changes gnibbles_error 
-    g_free(message);
-  }
-
-  image = gdk_pixbuf_new_from_file_at_size (filename, xsize, ysize, NULL);
-  g_free (filename);
-
-  return image;
-}
-
-static void
-gnibbles_copy_pixmap (GdkDrawable * drawable, gint which, gint x, gint y,
-		      gboolean big)
-{
-  gint size = properties->tilesize * (big == TRUE ? 2 : 1);
-  GdkPixbuf *copy_buf;
-
-  if (big == TRUE) {
-    if (which < 0 || which > 8) {
-      g_warning ("Invalid bonus image %d\n", which);
-      return;
-    }
-    copy_buf = bonus_pixmaps[which];
-  } else {
-    if (which < 0 || which > 19) {
-      g_warning ("Invalid tile image %d\n", which);
-      return;
-    }
-    copy_buf = small_pixmaps[which];
-  }
-
-  gdk_draw_pixbuf (GDK_DRAWABLE (drawable),
-		   gtk_widget_get_style (drawing_area)->
-		   fg_gc[gtk_widget_get_state (drawing_area)], copy_buf, 0, 0,
-		   x * properties->tilesize, y * properties->tilesize, size,
-		   size, GDK_RGB_DITHER_NORMAL, 0, 0);
-}
-
-void
-gnibbles_draw_pixmap (gint which, gint x, gint y)
-{
-  gnibbles_copy_pixmap (gtk_widget_get_window (drawing_area), which, x, y, FALSE);
-  gnibbles_copy_pixmap (buffer_pixmap, which, x, y, FALSE);
-}
 
 void
-gnibbles_draw_big_pixmap (gint which, gint x, gint y)
-{
-  gnibbles_copy_pixmap (gtk_widget_get_window (drawing_area), which, x, y, TRUE);
-  gnibbles_copy_pixmap (buffer_pixmap, which, x, y, TRUE);
-}
-
-void
-gnibbles_draw_pixmap_buffer (gint which, gint x, gint y)
-{
-  gnibbles_copy_pixmap (buffer_pixmap, which, x, y, FALSE);
-}
-
-void
-gnibbles_draw_big_pixmap_buffer (gint which, gint x, gint y)
-{
-  gnibbles_copy_pixmap (buffer_pixmap, which, x, y, TRUE);
-}
-*/
-void
 gnibbles_load_logo (void)
 {
   if (logo_pixmap)
     g_object_unref (logo_pixmap);
 
-  logo_pixmap = gnibbles_clutter_load_pixmap_file ("gnibbles-logo.svg",
-                               			            clutter_board->width, 
-                                                clutter_board->height);
+  logo_pixmap = gnibbles_load_pixmap_file ("gnibbles-logo.svg",
+                               			            board->width, 
+                                                board->height);
 }
 /*
 void
-gnibbles_load_pixmap (GtkWidget * window)
-{
-  gchar *bonus_files[] = {
-    "blank.svg",
-    "diamond.svg",
-    "bonus1.svg",
-    "bonus2.svg",
-    "life.svg",
-    "bonus3.svg",
-    "bonus4.svg",
-    "bonus5.svg",
-    "questionmark.svg"
-  };
-
-  gchar *small_files[] = {
-    "wall-empty.svg",
-    "wall-straight-up.svg",
-    "wall-straight-side.svg",
-    "wall-corner-bottom-left.svg",
-    "wall-corner-bottom-right.svg",
-    "wall-corner-top-left.svg",
-    "wall-corner-top-right.svg",
-    "wall-tee-up.svg",
-    "wall-tee-right.svg",
-    "wall-tee-left.svg",
-    "wall-tee-down.svg",
-    "wall-cross.svg",
-    "snake-red.svg",
-    "snake-green.svg",
-    "snake-blue.svg",
-    "snake-yellow.svg",
-    "snake-cyan.svg",
-    "snake-magenta.svg",
-    "snake-grey.svg"
-  };
-  int i;
-
-  for (i = 0; i < 9; i++) {
-    if (bonus_pixmaps[i])
-      g_object_unref (bonus_pixmaps[i]);
-    bonus_pixmaps[i] = gnibbles_load_pixmap_file (window, bonus_files[i],
-						  2 * properties->tilesize,
-						  2 * properties->tilesize);
-  }
-
-  for (i = 0; i < 19; i++) {
-    if (small_pixmaps[i])
-      g_object_unref (small_pixmaps[i]);
-    small_pixmaps[i] = gnibbles_load_pixmap_file (window, small_files[i],
-						  properties->tilesize,
-						  properties->tilesize);
-  }
-}
-
-void
 gnibbles_load_level (GtkWidget * window, gint level)
 {
   gchar *tmp = NULL;
@@ -464,9 +306,9 @@ gnibbles_load_level (GtkWidget * window, gint level)
 }
 */
 void
-gnibbles_clutter_init ()
+gnibbles_init ()
 {
-  if (clutter_board == NULL)
+  if (board == NULL)
     return;
 
   gint i;
@@ -478,45 +320,24 @@ gnibbles_clutter_init ()
   gnibbles_scoreboard_clear (scoreboard);
 
   for (i = 0; i < properties->numworms; i++) {
-    //gnibbles_scoreboard_register (scoreboard, cworms[i], 
-	  //               colorval_name (properties->wormprops[i]->color));
+    gnibbles_scoreboard_register (scoreboard, worms[i], 
+	                 colorval_name (properties->wormprops[i]->color));
   }
 
-  ClutterActor *stage = gnibbles_board_get_stage (clutter_board);
+  ClutterActor *stage = gnibbles_board_get_stage (board);
 
   for (i = 0; i < properties->numworms; i++) {
-    if (cworms[i]) {
-      clutter_container_add_actor (CLUTTER_CONTAINER (stage), cworms[i]->actors);
-      clutter_actor_raise_top (cworms[i]->actors);
+    if (worms[i]) {
+      clutter_container_add_actor (CLUTTER_CONTAINER (stage), worms[i]->actors);
+      clutter_actor_raise_top (worms[i]->actors);
     }
   }
 
   gnibbles_scoreboard_update (scoreboard);
 }
 
-/*
-void
-gnibbles_init (void)
-{
-  gint i;
-
-  for (i = 0; i < properties->numworms; i++)
-    if (worms[i])
-      gnibbles_worm_destroy (worms[i]);
-
-  gnibbles_scoreboard_clear (scoreboard);
-
-  for (i = 0; i < properties->numworms; i++) {
-    worms[i] = gnibbles_worm_new (i);
-    gnibbles_scoreboard_register (scoreboard, worms[i], 
-	                 colorval_name (properties->wormprops[i]->color));
-  }
-
-  gnibbles_scoreboard_update (scoreboard);
-}
-*/
 void
-gnibbles_clutter_add_bonus (gint regular)
+gnibbles_add_bonus (gint regular)
 {
   gint x, y, good;
 
@@ -710,7 +531,7 @@ gnibbles_add_bonus (gint regular)
 }
 */
 gint
-gnibbles_move_worms_clutter (void)
+gnibbles_move_worms (void)
 {
   gint i, j, olddir, length, nbr_actor;
   gint status = 1, nlives = 1;
@@ -719,17 +540,17 @@ gnibbles_move_worms_clutter (void)
   dead = g_new (gint, properties->numworms);
 
   for (i = 0; i < properties->ai; i++) {
-    olddir = cworms[i]->direction;
-    gnibbles_cworm_ai_move (cworms[properties->human + i]);
+    olddir = worms[i]->direction;
+    gnibbles_cworm_ai_move (worms[properties->human + i]);
 
-    if (olddir != cworms[i]->direction)
-      gnibbles_cworm_add_actor (cworms[i]);
+    if (olddir != worms[i]->direction)
+      gnibbles_cworm_add_actor (worms[i]);
   }
 
  if (boni->missed > MAXMISSED)
    for (i = 0; i < properties->numworms; i++)
-     if (cworms[i]->score)
-       cworms[i]->score--;
+     if (worms[i]->score)
+       worms[i]->score--;
 
   for (i = 0; i < boni->numbonuses; i++) {
     if (!(boni->bonuses[i]->countdown--)) {
@@ -738,7 +559,7 @@ gnibbles_move_worms_clutter (void)
                                     boni->bonuses[i]->x, 
                                     boni->bonuses[i]->y);
 	      boni->missed++;
-	      gnibbles_clutter_add_bonus (1);
+	      gnibbles_add_bonus (1);
       } else {
 	      gnibbles_boni_remove_bonus (boni, 
                                     boni->bonuses[i]->x, 
@@ -748,40 +569,40 @@ gnibbles_move_worms_clutter (void)
   }
 
   for (i = 0; i < properties->numworms; i++) {
-    dead[i] = !gnibbles_cworm_test_move_head (cworms[i]);
+    dead[i] = !gnibbles_cworm_test_move_head (worms[i]);
     status &= !dead[i];
   }
 
   for (i = 0; i < properties->numworms; i++) {
 
-    nbr_actor = g_list_length (cworms[i]->list);
-    length = gnibbles_cworm_get_length (cworms[i]);
+    nbr_actor = g_list_length (worms[i]->list);
+    length = gnibbles_cworm_get_length (worms[i]);
     printf ("\nWorm ID: %d, Actors: %d, Length: %d,  xhead: %d, yhead:%d",
-            i, nbr_actor, length, cworms[i]->xhead, cworms[i]->yhead);
-
-    if (cworms[i]->xhead >= BOARDWIDTH) {
-      cworms[i]->xhead = 0;
-      gnibbles_cworm_add_actor(cworms[i]);
-    } else if (cworms[i]->xhead < 0) {
-      cworms[i]->xhead = BOARDWIDTH;
-      gnibbles_cworm_add_actor (cworms[i]);
-    } else if (cworms[i]->yhead >= BOARDHEIGHT) {
-      cworms[i]->yhead = 0;
-      gnibbles_cworm_add_actor (cworms[i]);
-    } else if (cworms[i]->xhead < 0) {
-      cworms[i]->yhead = BOARDHEIGHT;
-      gnibbles_cworm_add_actor (cworms[i]);
+            i, nbr_actor, length, worms[i]->xhead, worms[i]->yhead);
+
+    if (worms[i]->xhead >= BOARDWIDTH) {
+      worms[i]->xhead = 0;
+      gnibbles_cworm_add_actor(worms[i]);
+    } else if (worms[i]->xhead < 0) {
+      worms[i]->xhead = BOARDWIDTH;
+      gnibbles_cworm_add_actor (worms[i]);
+    } else if (worms[i]->yhead >= BOARDHEIGHT) {
+      worms[i]->yhead = 0;
+      gnibbles_cworm_add_actor (worms[i]);
+    } else if (worms[i]->xhead < 0) {
+      worms[i]->yhead = BOARDHEIGHT;
+      gnibbles_cworm_add_actor (worms[i]);
     }
 
     //if there's only one actor in the list, just move the actor
-    if (nbr_actor == 1 && !dead[i] && cworms[i]->lives > 0) {
-      gnibbles_cworm_move_straight_worm (cworms[i]);
-    } else if (nbr_actor >= 2 && !dead[i] && cworms[i]->lives > 0) {
-      gnibbles_cworm_move_tail (cworms[i]);
-      if (g_list_length (cworms[i]->list) == 1)
-        gnibbles_cworm_move_straight_worm (cworms[i]);
+    if (nbr_actor == 1 && !dead[i] && worms[i]->lives > 0) {
+      gnibbles_cworm_move_straight_worm (worms[i]);
+    } else if (nbr_actor >= 2 && !dead[i] && worms[i]->lives > 0) {
+      gnibbles_cworm_move_tail (worms[i]);
+      if (g_list_length (worms[i]->list) == 1)
+        gnibbles_cworm_move_straight_worm (worms[i]);
       else 
-        gnibbles_cworm_move_head (cworms[i]);
+        gnibbles_cworm_move_head (worms[i]);
     } else if (dead[i]) {
       //worm's dead, do something clever about it...
     }
@@ -789,10 +610,10 @@ gnibbles_move_worms_clutter (void)
 
   for (i = 0; i < properties->numworms; i++) {
     for (j = 0; j < properties->numworms; j++) {
-      if (i != j && cworms[i]->xhead == cworms[j]->xhead
-	        && cworms[i]->yhead == cworms[j]->yhead
-	        && cworms[i]->lives > 0
-	        && cworms[j]->lives > 0)
+      if (i != j && worms[i]->xhead == worms[j]->xhead
+	        && worms[i]->yhead == worms[j]->yhead
+	        && worms[i]->lives > 0
+	        && worms[j]->lives > 0)
 	        dead[i] = TRUE;
     }
   }
@@ -800,8 +621,8 @@ gnibbles_move_worms_clutter (void)
   for (i = 0; i < properties->numworms; i++) {
     if (dead[i]) {
       if (properties->numworms > 1)
-	      cworms[i]->score *= .7;
-      if (!gnibbles_cworm_lose_life (cworms[i])) {
+	      worms[i]->score *= .7;
+      if (!gnibbles_cworm_lose_life (worms[i])) {
         /* One of the worms lost one life, but the round continues. */
         // TODO: reset worm state
         //gnibbles_worm_reset (cworms[i]);
@@ -821,7 +642,7 @@ gnibbles_move_worms_clutter (void)
   }
 
   for (i = 0; i < properties->numworms; i++) {
-    if (cworms[i]->lives > 0)
+    if (worms[i]->lives > 0)
       nlives += 1;
   }
   if (nlives == 1 && (properties->ai + properties->human > 1)) {
@@ -948,7 +769,7 @@ gnibbles_get_winner (void)
   int i;
 
   for (i = 0; i < properties->numworms; i++) {
-    if (cworms[i]->lives > 0) {
+    if (worms[i]->lives > 0) {
       return i;
     }
   }
@@ -962,7 +783,7 @@ gnibbles_keypress_worms (guint keyval)
   gint numworms = ggz_network_mode ? 1 : properties->numworms;
 
   for (i = 0; i < numworms; i++)
-    if (gnibbles_cworm_handle_keypress (cworms[i], keyval)) {
+    if (gnibbles_cworm_handle_keypress (worms[i], keyval)) {
       return TRUE;
     }
 
@@ -975,7 +796,7 @@ gnibbles_undraw_worms (gint data)
   gint i;
 
   for (i = 0; i < properties->numworms; i++)
-    gnibbles_cworm_shrink (cworms[i], data);
+    gnibbles_cworm_shrink (worms[i], data);
     //gnibbles_worm_undraw_nth (worms[i], data);
 }
 
@@ -1024,10 +845,10 @@ gnibbles_log_score (GtkWidget * window)
   if (properties->startlevel != 1)
     return;
 
-  if (!cworms[0]->score)
+  if (!worms[0]->score)
     return;
 
-  score.plain = cworms[0]->score;
+  score.plain = worms[0]->score;
   pos = games_scores_add_score (highscores, score);
 
   gnibbles_show_scores (window, pos);
diff --git a/gnibbles/gnibbles.h b/gnibbles/gnibbles.h
index 67a13f5..7b53796 100644
--- a/gnibbles/gnibbles.h
+++ b/gnibbles/gnibbles.h
@@ -57,19 +57,16 @@
 
 extern GnibblesWarpManager *warpmanager;
 
-void gnibbles_draw_pixmap (gint which, gint x, gint y);
-void gnibbles_draw_big_pixmap (gint which, gint x, gint y);
-void gnibbles_draw_pixmap_buffer (gint which, gint x, gint y);
-void gnibbles_draw_big_pixmap_buffer (gint which, gint x, gint y);
-void gnibbles_clutter_load_pixmap (gint tilesize);
-void gnibbles_load_pixmap (GtkWidget * window);
+//void gnibbles_draw_pixmap (gint which, gint x, gint y);
+//void gnibbles_draw_big_pixmap (gint which, gint x, gint y);
+//void gnibbles_draw_pixmap_buffer (gint which, gint x, gint y);
+//void gnibbles_draw_big_pixmap_buffer (gint which, gint x, gint y);
+void gnibbles_load_pixmap (gint tilesize);
+//void gnibbles_load_pixmap (GtkWidget * window);
 void gnibbles_load_logo (void);
-void gnibbles_load_level (GtkWidget * window, gint level);
-void gnibbles_clutter_init (void);
+//void gnibbles_load_level (GtkWidget * window, gint level);
 void gnibbles_init (void);
-void gnibbles_clutter_add_bonus (gint regular);
 void gnibbles_add_bonus (gint regular);
-gint gnibbles_move_worms_clutter (void);
 gint gnibbles_move_worms (void);
 gint gnibbles_get_winner (void);
 gint gnibbles_keypress_worms (guint keyval);
diff --git a/gnibbles/level.c b/gnibbles/level.c
index 5c3a336..79c84a1 100644
--- a/gnibbles/level.c
+++ b/gnibbles/level.c
@@ -29,10 +29,11 @@
 #include "properties.h"
 #include "boni.h"
 
-extern GnibblesCWorm *cworms[];
+extern GnibblesCWorm *worms[];
 extern GnibblesProperties *properties;
 extern GnibblesWarpManager *warpmanager;
 extern GnibblesBoni *boni;
+
 GnibblesLevel *
 gnibbles_level_new (gint level)
 {
@@ -68,8 +69,8 @@ gnibbles_level_new (gint level)
   boni = gnibbles_boni_new ();
 
   for (i = 0; i < properties->numworms; i++)
-    if (cworms[i])
-      gnibbles_cworm_destroy (cworms[i]);
+    if (worms[i])
+      gnibbles_cworm_destroy (worms[i]);
 
   for (i = 0; i < BOARDHEIGHT; i++) {
     if (!fgets (tmpboard, sizeof (tmpboard), in)) {
@@ -88,28 +89,28 @@ gnibbles_level_new (gint level)
         case 'm':
           lvl->walls[j][i] = EMPTYCHAR;
           if (count < properties->numworms) {
-            cworms[count] = gnibbles_cworm_new (count, j, i, WORMUP);
+            worms[count] = gnibbles_cworm_new (count, j, i, WORMUP);
             count++;
           }
           break;
         case 'n':
           lvl->walls[j][i] = EMPTYCHAR;
           if (count < properties->numworms) {
-            cworms[count] = gnibbles_cworm_new (count, j, i, WORMLEFT);
+            worms[count] = gnibbles_cworm_new (count, j, i, WORMLEFT);
             count++;
           }
           break;
         case 'o':
           lvl->walls[j][i] = EMPTYCHAR;
           if (count < properties->numworms) {
-            cworms[count] = gnibbles_cworm_new (count, j, i, WORMDOWN);
+            worms[count] = gnibbles_cworm_new (count, j, i, WORMDOWN);
             count++;
           }
           break;
         case 'p':
           lvl->walls[j][i] = EMPTYCHAR;
           if (count < properties->numworms) {
-            cworms[count] = gnibbles_cworm_new (count, j, i, WORMRIGHT);
+            worms[count] = gnibbles_cworm_new (count, j, i, WORMRIGHT);
             count++;
           }
           break;
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 4654b0c..9bae270 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -39,7 +39,6 @@
 #include "main.h"
 #include "properties.h"
 #include "gnibbles.h"
-//#include "worm.h"
 #include "bonus.h"
 #include "boni.h"
 #include "preferences.h"
@@ -63,7 +62,6 @@
 #define DEFAULT_HEIGHT 520
 
 GtkWidget *window;
-GtkWidget *drawing_area;
 GtkWidget *statusbar;
 GtkWidget *notebook;
 GtkWidget *chat = NULL;
@@ -86,16 +84,14 @@ extern GdkPixbuf *logo_pixmap;
 
 GnibblesProperties *properties;
 
-GnibblesBoard *clutter_board; 
+GnibblesBoard *board; 
 GnibblesLevel *level;
 
 GnibblesScoreboard *scoreboard;
 
-extern GnibblesCWorm *cworms[];
+extern GnibblesCWorm *worms[];
 extern GnibblesBoni *boni;
 
-gchar board[BOARDWIDTH][BOARDHEIGHT];
-
 gint main_id = 0;
 gint dummy_id = 0;
 gint keyboard_id = 0;
@@ -114,8 +110,8 @@ static struct _pointers {
 NULL};
 
 static gint add_bonus_cb (gpointer data);
-//static void render_logo (void);
-static void render_logo_clutter (void);
+
+static void render_logo (void);
 static gint end_game_cb (GtkAction * action, gpointer data);
 static void hide_logo (void);
 
@@ -136,7 +132,7 @@ static void
 hide_cursor (void)
 {
   if (pointers.current != pointers.invisible) {
-    gdk_window_set_cursor (gtk_widget_get_window (drawing_area), pointers.invisible);
+    gdk_window_set_cursor (board->clutter_widget->window, pointers.invisible);
     pointers.current = pointers.invisible;
   }
 }
@@ -194,7 +190,7 @@ static void
 show_cursor (void)
 {
   if (pointers.current != NULL) {
-    gdk_window_set_cursor (gtk_widget_get_window (drawing_area), NULL);
+    gdk_window_set_cursor (board->clutter_widget->window, NULL);
     pointers.current = NULL;
   }
 }
@@ -204,19 +200,7 @@ game_running (void)
 {
   return (main_id || erase_id || dummy_id || restart_id || paused);
 }
-/*
-static void
-zero_board (void)
-{
-  gint i, j;
 
-  for (i = 0; i < BOARDWIDTH; i++)
-    for (j = 0; j < BOARDHEIGHT; j++) {
-      board[i][j] = EMPTYCHAR;
-      gnibbles_draw_pixmap_buffer (0, i, j);
-    }
-}
-*/
 static void
 on_player_list (void)
 {
@@ -278,62 +262,15 @@ about_cb (GtkAction * action, gpointer data)
 }
 
 static gint
-expose_event_cb (GtkWidget * widget, GdkEventExpose * event)
-{
-  gdk_draw_drawable (GDK_DRAWABLE (gtk_widget_get_window (widget)),
-		     gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)],
-		     buffer_pixmap, event->area.x, event->area.y,
-		     event->area.x, event->area.y, event->area.width,
-		     event->area.height);
-
-  return (FALSE);
-}
-
-static gint
 key_press_cb (GtkWidget * widget, GdkEventKey * event)
 {
   hide_cursor ();
 
   return gnibbles_keypress_worms (event->keyval);
 }
-/*
-static void
-draw_board (void)
-{
-  int i, j;
-
-  for (i = 0; i < BOARDWIDTH; i++) {
-    for (j = 0; j < BOARDHEIGHT; j++) {
-      gnibbles_draw_pixmap_buffer (0, i, j);
-      if (board[i][j] >= EMPTYCHAR && board[i][j] < EMPTYCHAR + 19) {
-	gnibbles_draw_pixmap_buffer (board[i][j] - EMPTYCHAR, i, j);
-      } else if (board[i][j] >= WORMCHAR && board[i][j] < WORMCHAR + NUMWORMS) {
-	gnibbles_draw_pixmap_buffer (properties->wormprops
-				     [board[i][j] - WORMCHAR]->color, i, j);
-      } else if (board[i][j] >= 'A' && board[i][j] < 'J') {
-	// bonus
-      } else {
-	// Warp point. 
-      }
-    }
-  }
-
-  for (i = 0; i < boni->numbonuses; i++)
-    gnibbles_bonus_draw (boni->bonuses[i]);
-
-  for (i = 0; i < warpmanager->numwarps; i++)
-    gnibbles_warp_draw_buffer (warpmanager->warps[i]);
 
-  gdk_draw_drawable (GDK_DRAWABLE (gtk_widget_get_window (drawing_area)),
-		     gtk_widget_get_style (drawing_area)->
-		     fg_gc[gtk_widget_get_state (drawing_area)], buffer_pixmap, 0,
-		     0, 0, 0, BOARDWIDTH * properties->tilesize,
-		     BOARDHEIGHT * properties->tilesize);
-
-}
-*/
 static gboolean
-configure_clutter_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data)
+configure_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data)
 {
   int tilesize, ts_x, ts_y;
 
@@ -350,13 +287,13 @@ configure_clutter_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpoin
   int i;
 
   if (game_running ()) {
-    if (clutter_board) {
-      gnibbles_board_resize (clutter_board, tilesize);
+    if (board) {
+      gnibbles_board_resize (board, tilesize);
       for (i=0; i<properties->numworms; i++)
-        gnibbles_cworm_resize (cworms[i], tilesize);
+        gnibbles_cworm_resize (worms[i], tilesize);
     }
   } else {
-    render_logo_clutter ();
+    render_logo ();
   }
 
   /* But, has the tile size changed? */
@@ -366,7 +303,7 @@ configure_clutter_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpoin
     return FALSE;
   }
 
-  gnibbles_clutter_load_pixmap (tilesize);
+  gnibbles_load_pixmap (tilesize);
 
   properties->tilesize = tilesize;
   gnibbles_properties_set_tile_size (tilesize);
@@ -375,68 +312,7 @@ configure_clutter_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpoin
   
   return FALSE;
 }
-/*
-static gboolean
-configure_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data)
-{
-  int tilesize, ts_x, ts_y;
-
-  // Compute the new tile size based on the size of the
-  // drawing area, rounded down. 
-  ts_x = event->width / BOARDWIDTH;
-  ts_y = event->height / BOARDHEIGHT;
-  if (ts_x * BOARDWIDTH > event->width)
-    ts_x--;
-  if (ts_y * BOARDHEIGHT > event->height)
-    ts_y--;
-  tilesize = MIN (ts_x, ts_y);
-
-  int i;
-  if (data) {
-    GnibblesBoard *clutter_board = (GnibblesBoard *)data;
-    gnibbles_board_resize (clutter_board, tilesize);
-    for (i=0; i<properties->numworms; i++)
-      gnibbles_cworm_resize (cworms[i], tilesize);
-  }
-
-  // But, has the tile size changed? 
-  if (properties->tilesize == tilesize) {
-
-    // We must always re-load the logo. 
-    //gnibbles_load_logo (window);
-    return FALSE;
-  }
-
-  properties->tilesize = tilesize;
-  gnibbles_properties_set_tile_size (tilesize);
 
-  // Reload the images pixmap. 
-  //gnibbles_load_logo (window);
-  gnibbles_load_pixmap (window);
-
-  // Recreate the buffer pixmap. 
-  if (buffer_pixmap)
-    g_object_unref (G_OBJECT (buffer_pixmap));
-  buffer_pixmap = gdk_pixmap_new (gtk_widget_get_window (drawing_area),
-				  BOARDWIDTH * properties->tilesize,
-				  BOARDHEIGHT * properties->tilesize, -1);
-
-  // Erase the buffer pixmap. 
-  gdk_draw_rectangle (buffer_pixmap,
-		      gtk_widget_get_style (drawing_area)->black_gc,
-		      TRUE, 0, 0,
-		      BOARDWIDTH * properties->tilesize,
-		      BOARDHEIGHT * properties->tilesize);
-
-  if (game_running ())
-    draw_board ();
-  else {
-    render_logo ();
-  }
-  
-  return FALSE;
-}
-*/
 #ifdef GGZ_CLIENT
 static gint
 network_loop (gpointer data)
@@ -449,40 +325,6 @@ network_loop (gpointer data)
 #endif
 
 static gint
-new_game_clutter_2_cb (GtkWidget * widget, gpointer data)
-{
-  if (!paused) {
-    if (!keyboard_id)
-      keyboard_id = g_signal_connect (G_OBJECT (window),
-				      "key_press_event",
-				      G_CALLBACK (key_press_cb), NULL);
-#ifdef GGZ_CLIENT
-    if (!main_id && ggz_network_mode && network_is_host ()) {
-      main_id = g_timeout_add (GAMEDELAY * (properties->gamespeed + NETDELAY),
-			       (GSourceFunc) network_loop, NULL);
-    } else
-#endif
-    if (!main_id && !ggz_network_mode) {
-      main_id = g_timeout_add (GAMEDELAY * properties->gamespeed,
-			       (GSourceFunc) main_loop, NULL);
-    }
-#ifdef GGZ_CLIENT
-    if (!add_bonus_id && network_is_host ()) {
-#else
-    if (!add_bonus_id) {
-#endif
-      add_bonus_id = g_timeout_add (BONUSDELAY *
-				    properties->gamespeed,
-				    (GSourceFunc) add_bonus_cb, NULL);
-    }
-  }
-
-  dummy_id = 0;
-
-  return (FALSE);
-}
-/*
-static gint
 new_game_2_cb (GtkWidget * widget, gpointer data)
 {
   if (!paused) {
@@ -515,68 +357,7 @@ new_game_2_cb (GtkWidget * widget, gpointer data)
 
   return (FALSE);
 }
-*/
-gint
-new_game_clutter (void)
-{
-  gtk_action_set_sensitive (new_network_action, FALSE);
-
-  if (ggz_network_mode) {
-    gtk_action_set_sensitive (pause_action, FALSE);
-  } else {
-    gtk_action_set_sensitive (pause_action, TRUE);
-  }
-  gtk_action_set_sensitive (end_game_action, TRUE);
-  gtk_action_set_sensitive (preferences_action, !ggz_network_mode);
-
-  if (game_running ()) {
-    end_game (FALSE);
-    main_id = 0;
-  }
-
-
-  if (ggz_network_mode || !properties->random) {
-    current_level = properties->startlevel;
-  } else {
-    current_level = rand () % MAXLEVEL + 1;
-  }
-
-  hide_logo ();
-  level = gnibbles_level_new (current_level);
-  gnibbles_board_load_level (clutter_board, level);
-  gnibbles_clutter_add_bonus (1);
-  gnibbles_clutter_init ();
 
-  paused = 0;
-  gtk_action_set_visible (pause_action, !paused);
-  gtk_action_set_visible (resume_action, paused);
-  gtk_action_set_visible (player_list_action, ggz_network_mode);
-
-  if (erase_id) {
-    g_source_remove (erase_id);
-    erase_id = 0;
-  }
-
-  if (restart_id) {
-    g_source_remove (restart_id);
-    restart_id = 0;
-  }
-
-  if (add_bonus_id) {
-    g_source_remove (add_bonus_id);
-    add_bonus_id = 0;
-  }
-
-  if (dummy_id)
-    g_source_remove (dummy_id);
-
-  dummy_id = g_timeout_add_seconds (1, (GSourceFunc) new_game_clutter_2_cb, NULL);
-
-  network_gui_update ();
-
-  return TRUE;
-}
-/*
 gint
 new_game (void)
 {
@@ -595,7 +376,6 @@ new_game (void)
     main_id = 0;
   }
 
-  gnibbles_init ();
 
   if (ggz_network_mode || !properties->random) {
     current_level = properties->startlevel;
@@ -603,10 +383,11 @@ new_game (void)
     current_level = rand () % MAXLEVEL + 1;
   }
 
-  zero_board ();
-  gnibbles_load_level (GTK_WIDGET (window), current_level);
-
+  hide_logo ();
+  level = gnibbles_level_new (current_level);
+  gnibbles_board_load_level (board, level);
   gnibbles_add_bonus (1);
+  gnibbles_init ();
 
   paused = 0;
   gtk_action_set_visible (pause_action, !paused);
@@ -637,11 +418,11 @@ new_game (void)
 
   return TRUE;
 }
-*/
+
 static void
 new_game_cb (GtkAction * action, gpointer data)
 {
-  new_game_clutter ();
+  new_game ();
 }
 
 gint
@@ -649,7 +430,7 @@ pause_game_cb (GtkAction * action, gpointer data)
 {
   if (paused) {
     paused = 0;
-    dummy_id = g_timeout_add (500, (GSourceFunc) new_game_clutter_2_cb, NULL);
+    dummy_id = g_timeout_add (500, (GSourceFunc) new_game_2_cb, NULL);
   } else {
     if (main_id || erase_id || restart_id || dummy_id) {
       paused = 1;
@@ -667,6 +448,7 @@ pause_game_cb (GtkAction * action, gpointer data)
       }
     }
   }
+
   gtk_action_set_sensitive (pause_action, !paused);
   gtk_action_set_sensitive (resume_action, paused);
   gtk_action_set_visible (pause_action, !paused);
@@ -715,7 +497,7 @@ end_game (gboolean show_splash)
   }
 
   if (show_splash) {
-    render_logo_clutter ();
+    render_logo ();
     gtk_action_set_sensitive (new_network_action, TRUE);
     gtk_action_set_sensitive (pause_action, FALSE);
     gtk_action_set_sensitive (resume_action, FALSE);
@@ -746,38 +528,22 @@ end_game_cb (GtkAction * action, gpointer data)
 static gint
 add_bonus_cb (gpointer data)
 {
-  //gnibbles_add_bonus (0);
-  gnibbles_clutter_add_bonus (0);
+  gnibbles_add_bonus (0);
   return (TRUE);
 }
 
 static gint
-restart_game_clutter (gpointer data)
+restart_game (gpointer data)
 {
   level = gnibbles_level_new (current_level);
-  gnibbles_board_load_level (clutter_board, level);
-  gnibbles_clutter_add_bonus (1);
-  dummy_id = g_timeout_add_seconds (1, (GSourceFunc) new_game_clutter_2_cb, NULL);
+  gnibbles_board_load_level (board, level);
+  gnibbles_add_bonus (1);
+  dummy_id = g_timeout_add_seconds (1, (GSourceFunc) new_game_2_cb, NULL);
   restart_id = 0;
   
   return FALSE;
 }
-/*
-static gint
-restart_game (gpointer data)
-{
-  zero_board ();
-  gnibbles_load_level (GTK_WIDGET (window), current_level);
-
-  gnibbles_add_bonus (1);
-
-  dummy_id = g_timeout_add_seconds (1, (GSourceFunc) new_game_2_cb, NULL);
-
-  restart_id = 0;
 
-  return (FALSE);
-}
-*/
 static gint
 erase_worms_cb (gpointer datap)
 {
@@ -804,8 +570,7 @@ main_loop (gpointer data)
   gint tmp, winner;
   gchar *str = NULL;
 
-  //status = gnibbles_move_worms ();
-  status = gnibbles_move_worms_clutter ();
+  status = gnibbles_move_worms ();
   gnibbles_scoreboard_update (scoreboard);
 
   if (status == VICTORY) {
@@ -883,7 +648,7 @@ main_loop (gpointer data)
     erase_id = g_timeout_add (ERASETIME / ERASESIZE,
 			      (GSourceFunc) erase_worms_cb,
 			      (gpointer) ERASESIZE);
-    restart_id = g_timeout_add_seconds (1, (GSourceFunc) restart_game_clutter, NULL);
+    restart_id = g_timeout_add_seconds (1, (GSourceFunc) restart_game, NULL);
     return (FALSE);
   }
 
@@ -912,7 +677,7 @@ main_loop (gpointer data)
 	      tmp = rand () % MAXLEVEL + 1;
       current_level = tmp;
     }
-    restart_id = g_timeout_add_seconds (1, (GSourceFunc) restart_game_clutter, NULL);
+    restart_id = g_timeout_add_seconds (1, (GSourceFunc) restart_game, NULL);
     return (FALSE);
   }
 
@@ -1029,7 +794,7 @@ create_menus (GtkUIManager * ui_manager)
 }
 
 static void
-setup_window_clutter ()
+setup_window ()
 {
   GtkWidget *vbox;
   GtkWidget *main_vbox;
@@ -1074,120 +839,18 @@ setup_window_clutter ()
   gtk_widget_show (packing);
 
 
-  gtk_container_add (GTK_CONTAINER (packing), clutter_board->clutter_widget);
+  gtk_container_add (GTK_CONTAINER (packing), board->clutter_widget);
 #ifdef GGZ_CLIENT
   chat = create_chat_widget ();
   gtk_box_pack_start (GTK_BOX (vbox), chat, FALSE, TRUE, 0);
 #endif
 
-  g_signal_connect (G_OBJECT (clutter_board->clutter_widget), "configure_event",
-		    G_CALLBACK (configure_clutter_event_cb), NULL);
-
-  //g_signal_connect (G_OBJECT (window), "focus_out_event",
-	//	    G_CALLBACK (show_cursor_cb), NULL);
-
-  main_vbox = gtk_vbox_new (FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);
-  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, NULL);
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), MAIN_PAGE);
-
-  statusbar = gtk_statusbar_new ();
-  gtk_box_pack_start (GTK_BOX (main_vbox), statusbar, FALSE, FALSE, 0);
-
-  gtk_container_add (GTK_CONTAINER (window), main_vbox);
-
-  gtk_widget_show_all (window);
-#ifdef GGZ_CLIENT
-  gtk_widget_hide (chat);
-#endif
-
-  scoreboard = gnibbles_scoreboard_new (statusbar);
-}
-/*
-static void
-setup_window (void)
-{
-  GdkPixmap *cursor_dot_pm;
-  GtkWidget *vbox;
-  GtkWidget *main_vbox;
-  GtkWidget *packing;
-  GtkWidget *menubar;
-  GtkUIManager *ui_manager;
-  GtkAccelGroup *accel_group;
-
-  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_title (GTK_WINDOW (window), _("Nibbles"));
-
-  gtk_window_set_default_size (GTK_WINDOW (window), DEFAULT_WIDTH, DEFAULT_HEIGHT);
-  games_conf_add_window (GTK_WINDOW (window), KEY_PREFERENCES_GROUP);
-
-  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
-  g_signal_connect (G_OBJECT (window), "delete_event",
-		    G_CALLBACK (delete_cb), NULL);
-  g_signal_connect (G_OBJECT (window), "window_state_event",
-		    G_CALLBACK (window_state_cb), NULL);
-
-  gtk_widget_realize (window);
-
-  vbox = gtk_vbox_new (FALSE, 0);
-
-  games_stock_init ();
-  ui_manager = gtk_ui_manager_new ();
-  create_menus (ui_manager);
-  set_fullscreen_actions (FALSE);
-  notebook = gtk_notebook_new ();
-  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
-  gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
-
-  accel_group = gtk_ui_manager_get_accel_group (ui_manager);
-  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-
-  menubar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
-  gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
-
-  packing = games_grid_frame_new (BOARDWIDTH, BOARDHEIGHT);
-  gtk_box_pack_start (GTK_BOX (vbox), packing, TRUE, TRUE, 0);
-  gtk_widget_show (packing);
-
-  drawing_area = gtk_drawing_area_new ();
-
-  cursor_dot_pm = gdk_pixmap_create_from_data (gtk_widget_get_window (window),
-					       "\0", 1, 1, 1,
-					       &gtk_widget_get_style (drawing_area)->
-					       fg[GTK_STATE_ACTIVE],
-					       &gtk_widget_get_style (drawing_area)->
-					       bg[GTK_STATE_ACTIVE]);
-
-  pointers.invisible =
-    gdk_cursor_new_from_pixmap (cursor_dot_pm, cursor_dot_pm,
-				&gtk_widget_get_style (drawing_area)->fg[GTK_STATE_ACTIVE],
-				&gtk_widget_get_style (drawing_area)->bg[GTK_STATE_ACTIVE],
-				0, 0);
-
-  gtk_container_add (GTK_CONTAINER (packing), drawing_area);
-#ifdef GGZ_CLIENT
-  chat = create_chat_widget ();
-  gtk_box_pack_start (GTK_BOX (vbox), chat, FALSE, TRUE, 0);
-#endif
-
-  g_signal_connect (G_OBJECT (drawing_area), "configure_event",
+  g_signal_connect (G_OBJECT (board->clutter_widget), "configure_event",
 		    G_CALLBACK (configure_event_cb), NULL);
 
-  g_signal_connect (G_OBJECT (drawing_area), "motion_notify_event",
-		    G_CALLBACK (show_cursor_cb), NULL);
-
   g_signal_connect (G_OBJECT (window), "focus_out_event",
 		    G_CALLBACK (show_cursor_cb), NULL);
 
-  gtk_widget_set_size_request (GTK_WIDGET (drawing_area),
-			       BOARDWIDTH * 5, BOARDHEIGHT * 5);
-  g_signal_connect (G_OBJECT (drawing_area), "expose_event",
-		    G_CALLBACK (expose_event_cb), NULL);
-  // We do our own double-buffering. 
-  gtk_widget_set_double_buffered (GTK_WIDGET (drawing_area), FALSE);
-  gtk_widget_set_events (drawing_area, GDK_BUTTON_PRESS_MASK |
-			 GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK);
-
   main_vbox = gtk_vbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);
   gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, NULL);
@@ -1198,19 +861,16 @@ setup_window (void)
 
   gtk_container_add (GTK_CONTAINER (window), main_vbox);
 
-
   gtk_widget_show_all (window);
 #ifdef GGZ_CLIENT
   gtk_widget_hide (chat);
 #endif
-  gtk_widget_show (drawing_area);
 
   scoreboard = gnibbles_scoreboard_new (statusbar);
-
 }
-*/
+
 static void 
-render_logo_clutter (void)
+render_logo (void)
 {
   
   guint width, height;
@@ -1219,7 +879,7 @@ render_logo_clutter (void)
   ClutterActor *desc;
   ClutterColor actor_color = {0xff,0xff,0xff,0xff};
 
-  ClutterActor *stage = gnibbles_board_get_stage (clutter_board);
+  ClutterActor *stage = gnibbles_board_get_stage (board);
   landing_page = clutter_group_new ();
 
   clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
@@ -1260,71 +920,7 @@ hide_logo (void)
 {
   clutter_actor_hide (CLUTTER_ACTOR (landing_page));
 }
-/*
-static void
-render_logo (void)
-{
-  PangoContext *context;
-  PangoLayout *layout;
-  PangoFontDescription * pfd;
-  int size;
-  static int width, height;
-  GtkAllocation allocation;
-
-  gtk_widget_get_allocation (drawing_area, &allocation);
-
-  zero_board ();
-
-  gdk_draw_pixbuf (GDK_DRAWABLE (buffer_pixmap),
-		   gtk_widget_get_style (drawing_area)->
-		   fg_gc[gtk_widget_get_state (drawing_area)], logo_pixmap, 0, 0,
-		   0, 0, BOARDWIDTH * properties->tilesize,
-		   BOARDHEIGHT * properties->tilesize, GDK_RGB_DITHER_NORMAL,
-		   0, 0);
-
-  context = gdk_pango_context_get ();
-  layout = pango_layout_new (context);
-  pfd = pango_context_get_font_description (context);
-  size = pango_font_description_get_size (pfd);
-  pango_font_description_set_size (pfd, (size * allocation.width) / 100);
-  pango_font_description_set_family (pfd, "Sans");
-  pango_font_description_set_weight(pfd, PANGO_WEIGHT_BOLD); 
-  pango_layout_set_font_description (layout, pfd);
-  pango_layout_set_text (layout, _("Nibbles"), -1);
-  pango_layout_get_pixel_size(layout, &width, &height);  
-
-  gdk_draw_layout (GDK_DRAWABLE (buffer_pixmap),
-		   gtk_widget_get_style (drawing_area)->black_gc,
-		   (allocation.width - width) * 0.5 + 3,
-		   (allocation.height * 0.72) + 3, layout);
-  gdk_draw_layout (GDK_DRAWABLE (buffer_pixmap),
-		   gtk_widget_get_style (drawing_area)->white_gc,
-		   (allocation.width - width) * 0.5,
-		   (allocation.height * 0.72), layout);
-
-  pango_font_description_set_size (pfd, (size * allocation.width) / 400);
-  pango_layout_set_font_description (layout, pfd);
-  // Translators: This string will be included in the intro screen, so don't make sure it fits! 
-  pango_layout_set_text (layout, _("A worm game for GNOME."), -1);
-  pango_layout_get_pixel_size(layout, &width, &height);  
-
-  gdk_draw_layout (GDK_DRAWABLE (buffer_pixmap),
-		   gtk_widget_get_style (drawing_area)->black_gc,
-		   (allocation.width - width) * 0.5 + 2,
-                   (allocation.height * 0.94) + 2, layout);
-  gdk_draw_layout (GDK_DRAWABLE (buffer_pixmap),
-		   gtk_widget_get_style (drawing_area)->white_gc,
-		   (allocation.width - width) * 0.5,
-                   (allocation.height * 0.94), layout);
-
-
-  gdk_draw_drawable (GDK_DRAWABLE (gtk_widget_get_window (drawing_area)),
-		     gtk_widget_get_style (drawing_area)->
-		     fg_gc[gtk_widget_get_state (drawing_area)], buffer_pixmap, 
-		     0, 0, 0, 0, BOARDWIDTH * properties->tilesize,
-		     BOARDHEIGHT * properties->tilesize);
-}
-*/
+
 int
 main (int argc, char **argv)
 {
@@ -1371,10 +967,10 @@ main (int argc, char **argv)
   games_conf_initialise ("Gnibbles");
   properties = gnibbles_properties_new (); 
 
-  gnibbles_clutter_load_pixmap (properties->tilesize);
+  gnibbles_load_pixmap (properties->tilesize);
 
-  clutter_board = gnibbles_board_new (BOARDWIDTH, BOARDHEIGHT);
-  setup_window_clutter ();
+  board = gnibbles_board_new (BOARDWIDTH, BOARDHEIGHT);
+  setup_window ();
   gnibbles_load_logo ();
 
 #ifdef GGZ_CLIENT
@@ -1382,7 +978,7 @@ main (int argc, char **argv)
   network_gui_update ();
 #endif
 
-  render_logo_clutter ();
+  render_logo ();
 
   gtk_action_set_sensitive (pause_action, FALSE);
   gtk_action_set_sensitive (resume_action, FALSE);
@@ -1391,10 +987,8 @@ main (int argc, char **argv)
   gtk_action_set_visible (new_game_action, !ggz_network_mode);
   gtk_action_set_visible (player_list_action, ggz_network_mode);
 
-
   gtk_main ();
 
- // g_object_unref (timeline);
   gnibbles_properties_destroy (properties);
   games_conf_shutdown ();
 
diff --git a/gnibbles/main.h b/gnibbles/main.h
index 3156555..5ede05f 100644
--- a/gnibbles/main.h
+++ b/gnibbles/main.h
@@ -39,7 +39,6 @@ gint game_running (void);
 gint pause_game_cb (GtkAction * action, gpointer data);
 void end_game (gboolean);
 
-gint new_game_clutter (void);
 gint new_game (void);
 gint main_loop (gpointer data);
 
diff --git a/gnibbles/warp.c b/gnibbles/warp.c
index c6295c1..0fa523c 100644
--- a/gnibbles/warp.c
+++ b/gnibbles/warp.c
@@ -30,7 +30,7 @@
 
 extern GnibblesProperties *properties;
 extern GdkPixbuf *boni_pixmaps[];
-extern GnibblesBoard *clutter_board;
+extern GnibblesBoard *board;
 
 GnibblesWarp *
 gnibbles_warp_new (gint t_x, gint t_y, gint t_wx, gint t_wy)
@@ -62,7 +62,7 @@ gnibbles_warp_draw (GnibblesWarp *warp)
   clutter_actor_set_position (CLUTTER_ACTOR (warp->actor),
                               properties->tilesize * warp->x,
                               properties->tilesize * warp->y);
-  ClutterActor *stage = gnibbles_board_get_stage (clutter_board);
+  ClutterActor *stage = gnibbles_board_get_stage (board);
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), warp->actor);
 
 }
diff --git a/gnibbles/warpmanager.c b/gnibbles/warpmanager.c
index a424546..74374b1 100644
--- a/gnibbles/warpmanager.c
+++ b/gnibbles/warpmanager.c
@@ -31,7 +31,7 @@
 #include "main.h"
 #include "level.h"
 
-extern gchar board[BOARDWIDTH][BOARDHEIGHT];
+//extern gchar board[BOARDWIDTH][BOARDHEIGHT];
 extern GnibblesLevel *level;
 extern GnibblesBoni *boni;
 
diff --git a/gnibbles/worm-clutter.c b/gnibbles/worm-clutter.c
index 236ddc3..a79da8e 100644
--- a/gnibbles/worm-clutter.c
+++ b/gnibbles/worm-clutter.c
@@ -50,7 +50,7 @@ extern GdkPixbuf *worm_pixmaps[];
 extern GnibblesLevel *level;
 extern GnibblesBoni *boni;
 extern GnibblesWarpManager *warpmanager;
-extern GnibblesCWorm *cworms[NUMWORMS];
+extern GnibblesCWorm *worms[NUMWORMS];
 
 typedef struct _key_queue_entry {
   GnibblesCWorm *worm;
@@ -90,20 +90,20 @@ cworm_set_direction (int worm, int dir)
     return;
   }
 
-  if (cworms[worm]) {
+  if (worms[worm]) {
 
     if (dir > 4)
       dir = 1;
     if (dir < 1)
       dir = 4;
 
-    if (cworms[worm]->keypress) {
-      gnibbles_worm_queue_keypress (cworms[worm], dir);
+    if (worms[worm]->keypress) {
+      gnibbles_worm_queue_keypress (worms[worm], dir);
       return;
     }
 
-    cworms[worm]->direction = dir;
-    cworms[worm]->keypress = 1;
+    worms[worm]->direction = dir;
+    worms[worm]->keypress = 1;
   }
 }
 
@@ -114,8 +114,8 @@ cworm_handle_direction (int worm, int dir)
 #ifdef GGZ_CLIENT
     network_game_move (dir);
 
-    cworms[0]->direction = dir;
-    cworms[0]->keypress = 1;
+    worms[0]->direction = dir;
+    worms[0]->keypress = 1;
 #endif
   } else {
     cworm_set_direction (worm, dir);
@@ -397,7 +397,7 @@ gnibbles_cworm_resize (GnibblesCWorm *worm, gint newtile)
   ClutterActor *tmp;
 
   count = clutter_group_get_n_children (CLUTTER_GROUP (worm->actors));
-  gnibbles_clutter_load_pixmap (newtile);
+  gnibbles_load_pixmap (newtile);
 
   g_value_init (&val, G_TYPE_BOOLEAN);
 
@@ -818,7 +818,7 @@ gnibbles_cworm_is_move_safe (GnibblesCWorm * worm)
 
   for (i = 0; i < properties->numworms; i++) {
     if (i != worm->number) {
-      if (gnibbles_cworm_can_move_to (cworms[i], x, y))
+      if (gnibbles_cworm_can_move_to (worms[i], x, y))
         return (FALSE);
     }
   }
@@ -925,8 +925,8 @@ gnibbles_cworm_ai_deadend_after (gint x, gint y, gint dir, gint length)
 
   i = properties->numworms;
   while(i--) {
-    cx = cworms[i]->xhead;
-    cy = cworms[i]->yhead;
+    cx = worms[i]->xhead;
+    cy = worms[i]->yhead;
     if(cx != x || cy != y) {
       if(cx > 0) deadendboard[cx-1][cy] = deadend_runnumber;
       if(cy > 0) deadendboard[cx][cy-1] = deadend_runnumber;
@@ -980,8 +980,8 @@ gnibbles_cworm_ai_tooclose (GnibblesCWorm * worm)
   gint dx, dy;
   
   while (i--) {
-    dx = worm->xhead - cworms[i]->xhead;
-    dy = worm->yhead - cworms[i]->yhead;
+    dx = worm->xhead - worms[i]->xhead;
+    dy = worm->yhead - worms[i]->yhead;
     switch (worm->direction) {
       case WORMUP:
         if (dy > 0 && dy <= 3 && dx >= -1 && dx <= 1)



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