[gnome-games/gnibbles-clutter-rebased: 42/129] Commented out all unused code, removed worm.{ch} from the build system +fix
- From: Jason Clinton <jclinton src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-games/gnibbles-clutter-rebased: 42/129] Commented out all unused code, removed worm.{ch} from the build system +fix
- Date: Mon, 12 Oct 2009 21:29:46 +0000 (UTC)
commit 1d15b43d5f0110439fec876e5d1e00a3ce2399b2
Author: Guillaume Beland <guillaubel svn gnome org>
Date: Tue Jul 7 14:34:22 2009 -0400
Commented out all unused code, removed worm.{ch} from the build system +fix
gnibbles/Makefile.am | 2 -
gnibbles/bonus.c | 8 +++---
gnibbles/ggz-network.c | 7 +++--
gnibbles/gnibbles.c | 53 ++++++++++++++++++++--------------------
gnibbles/main.c | 61 ++++++++++++++++++++++++-----------------------
gnibbles/scoreboard.c | 2 +-
gnibbles/scoreboard.h | 7 +++--
gnibbles/warp.c | 4 +-
gnibbles/warpmanager.c | 6 +++-
gnibbles/warpmanager.h | 6 ++--
gnibbles/worm-clutter.c | 4 +-
gnibbles/worm-clutter.h | 4 ++-
12 files changed, 85 insertions(+), 79 deletions(-)
---
diff --git a/gnibbles/Makefile.am b/gnibbles/Makefile.am
index b0693b8..c3fa30a 100644
--- a/gnibbles/Makefile.am
+++ b/gnibbles/Makefile.am
@@ -18,8 +18,6 @@ gnibbles_SOURCES = \
warp.c \
warpmanager.h \
warpmanager.c \
- worm.h \
- worm.c \
gnibbles.h \
gnibbles.c \
properties.h \
diff --git a/gnibbles/bonus.c b/gnibbles/bonus.c
index 7de904a..e593f5a 100644
--- a/gnibbles/bonus.c
+++ b/gnibbles/bonus.c
@@ -51,13 +51,13 @@ gnibbles_bonus_new (gint t_x, gint t_y, gint t_type,
return (tmp);
}
-
+/*
void
gnibbles_bonus_draw (GnibblesBonus * bonus)
{
gnibbles_draw_big_pixmap (bonus->type, bonus->x, bonus->y);
}
-
+*/
void
gnibbles_bonus_draw_clutter (GnibblesBonus *bonus)
{
@@ -69,7 +69,7 @@ gnibbles_bonus_draw_clutter (GnibblesBonus *bonus)
ClutterActor *stage = gnibbles_board_get_stage (clutter_board);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), bonus->actor);
}
-
+/*
void
gnibbles_bonus_erase (GnibblesBonus * bonus)
{
@@ -79,7 +79,7 @@ gnibbles_bonus_erase (GnibblesBonus * bonus)
free (bonus);
}
-
+*/
void
gnibbles_bonus_erase_clutter (GnibblesBonus *bonus)
{
diff --git a/gnibbles/ggz-network.c b/gnibbles/ggz-network.c
index 12818d4..a0fee97 100644
--- a/gnibbles/ggz-network.c
+++ b/gnibbles/ggz-network.c
@@ -45,7 +45,8 @@
#include "gnibbles.h"
#include "properties.h"
#include "ggz-network.h"
-#include "worm.h"
+//#include "worm.h"
+#include "worm-clutter.h"
static void
@@ -114,7 +115,7 @@ get_move (void)
if (ggz_read_int (fd, &player) < 0 || ggz_read_int (fd, &move) < 0)
return -1;
/* show some kind of pregame thing.... */
- worm_set_direction (player, move);
+ cworm_set_direction (player, move);
return 0;
}
@@ -189,7 +190,7 @@ game_handle_io (GGZMod * mod)
case GN_MSG_START:
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), MAIN_PAGE);
- new_game ();
+ new_game_clutter ();
break;
case GN_MSG_SYNC:
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index 6cff38e..64cad97 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -37,7 +37,7 @@
#include "main.h"
#include "gnibbles.h"
-#include "worm.h"
+//#include "worm.h"
#include "boni.h"
#include "bonus.h"
#include "warpmanager.h"
@@ -53,7 +53,7 @@
GnibblesCWorm *cworms[NUMWORMS];
-GnibblesWorm *worms[NUMWORMS];
+//GnibblesWorm *worms[NUMWORMS];
GnibblesBoni *boni = NULL;
GnibblesWarpManager *warpmanager;
@@ -188,7 +188,7 @@ gnibbles_clutter_load_pixmap (gint tilesize)
tilesize, tilesize);
}
}
-
+/*
static void
gnibbles_error (GtkWidget * window, gchar * message)
{
@@ -217,8 +217,8 @@ gnibbles_load_pixmap_file (GtkWidget * window, const gchar * pixmap,
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 */
+ // 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);
}
@@ -281,7 +281,7 @@ 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)
{
@@ -292,7 +292,7 @@ gnibbles_load_logo (void)
clutter_board->width,
clutter_board->height);
}
-
+/*
void
gnibbles_load_pixmap (GtkWidget * window)
{
@@ -448,7 +448,7 @@ gnibbles_load_level (GtkWidget * window, gint level)
board[j][i] = EMPTYCHAR;
break;
}
- /* Warpmanager draws the warp points. Everything else gets drawn here. */
+ // Warpmanager draws the warp points. Everything else gets drawn here.
if (board[j][i] >= 'a')
gnibbles_draw_pixmap_buffer (board[j][i] - 'a', j, i);
}
@@ -462,7 +462,7 @@ gnibbles_load_level (GtkWidget * window, gint level)
fclose (in);
}
-
+*/
void
gnibbles_clutter_init ()
{
@@ -494,6 +494,7 @@ gnibbles_clutter_init ()
gnibbles_scoreboard_update (scoreboard);
}
+/*
void
gnibbles_init (void)
{
@@ -513,7 +514,7 @@ gnibbles_init (void)
gnibbles_scoreboard_update (scoreboard);
}
-
+*/
void
gnibbles_clutter_add_bonus (gint regular)
{
@@ -610,7 +611,7 @@ gnibbles_clutter_add_bonus (gint regular)
}
}
}
-
+/*
void
gnibbles_add_bonus (gint regular)
{
@@ -707,7 +708,7 @@ gnibbles_add_bonus (gint regular)
}
}
}
-
+*/
gint
gnibbles_move_worms_clutter (void)
{
@@ -775,7 +776,7 @@ gnibbles_move_worms_clutter (void)
//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] && worms[i]->lives > 0) {
+ } 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]);
@@ -836,7 +837,7 @@ gnibbles_move_worms_clutter (void)
g_free (dead);
return (CONTINUE);
}
-
+/*
gint
gnibbles_move_worms (void)
{
@@ -887,8 +888,8 @@ gnibbles_move_worms (void)
gnibbles_worm_draw_head (worms[i]);
- /* If one worm has died, me must make sure that an earlier worm was not
- * supposed to die as well. */
+ // If one worm has died, me must make sure that an earlier worm was not
+ // supposed to die as well.
for (i = 0; i < properties->numworms; i++)
for (j = 0; j < properties->numworms; j++) {
@@ -905,14 +906,14 @@ gnibbles_move_worms (void)
if (properties->numworms > 1)
worms[i]->score *= .7;
if (!gnibbles_worm_lose_life (worms[i])) {
- /* One of the worms lost one life, but the round continues. */
+ // One of the worms lost one life, but the round continues.
gnibbles_worm_reset (worms[i]);
gnibbles_worm_set_start (worms[i],
worms[i]->xstart,
worms[i]->ystart,
worms[i]->direction_start);
games_sound_play ("crash");
- /* Don't return here. May need to reset more worms. */
+ // Don't return here. May need to reset more worms.
}
}
@@ -927,19 +928,19 @@ gnibbles_move_worms (void)
nlives += 1;
}
if (nlives == 1 && (properties->ai + properties->human > 1)) {
- /* There is one player left, the other AI players are dead, and that player has won! */
+ // There is one player left, the other AI players are dead, and that player has won!
return (VICTORY);
} else if (nlives == 0) {
- /* There was only one worm, and it died. */
+ // There was only one worm, and it died.
return (GAMEOVER);
}
- /* Noone died, so the round can continue. */
+ // Noone died, so the round can continue.
g_free (dead);
return (CONTINUE);
}
-
+*/
gint
gnibbles_get_winner (void)
@@ -947,7 +948,7 @@ gnibbles_get_winner (void)
int i;
for (i = 0; i < properties->numworms; i++) {
- if (worms[i]->lives > 0) {
+ if (cworms[i]->lives > 0) {
return i;
}
}
@@ -961,7 +962,7 @@ gnibbles_keypress_worms (guint keyval)
gint numworms = ggz_network_mode ? 1 : properties->numworms;
for (i = 0; i < numworms; i++)
- if (gnibbles_worm_handle_keypress (worms[i], keyval)) {
+ if (gnibbles_cworm_handle_keypress (cworms[i], keyval)) {
return TRUE;
}
@@ -1023,10 +1024,10 @@ gnibbles_log_score (GtkWidget * window)
if (properties->startlevel != 1)
return;
- if (!worms[0]->score)
+ if (!cworms[0]->score)
return;
- score.plain = worms[0]->score;
+ score.plain = cworms[0]->score;
pos = games_scores_add_score (highscores, score);
gnibbles_show_scores (window, pos);
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 54e25d8..4654b0c 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -39,7 +39,7 @@
#include "main.h"
#include "properties.h"
#include "gnibbles.h"
-#include "worm.h"
+//#include "worm.h"
#include "bonus.h"
#include "boni.h"
#include "preferences.h"
@@ -114,7 +114,7 @@ static struct _pointers {
NULL};
static gint add_bonus_cb (gpointer data);
-static void render_logo (void);
+//static void render_logo (void);
static void render_logo_clutter (void);
static gint end_game_cb (GtkAction * action, gpointer data);
static void hide_logo (void);
@@ -160,6 +160,7 @@ fullscreen_cb (GtkAction * action)
gtk_window_unfullscreen (GTK_WINDOW (window));
}
}
+
static void
network_gui_update (void)
{
@@ -203,7 +204,7 @@ game_running (void)
{
return (main_id || erase_id || dummy_id || restart_id || paused);
}
-
+/*
static void
zero_board (void)
{
@@ -215,7 +216,7 @@ zero_board (void)
gnibbles_draw_pixmap_buffer (0, i, j);
}
}
-
+*/
static void
on_player_list (void)
{
@@ -295,7 +296,7 @@ key_press_cb (GtkWidget * widget, GdkEventKey * event)
return gnibbles_keypress_worms (event->keyval);
}
-
+/*
static void
draw_board (void)
{
@@ -310,9 +311,9 @@ draw_board (void)
gnibbles_draw_pixmap_buffer (properties->wormprops
[board[i][j] - WORMCHAR]->color, i, j);
} else if (board[i][j] >= 'A' && board[i][j] < 'J') {
- /* bonus */
+ // bonus
} else {
- /* Warp point. */
+ // Warp point.
}
}
}
@@ -330,7 +331,7 @@ draw_board (void)
BOARDHEIGHT * properties->tilesize);
}
-
+*/
static gboolean
configure_clutter_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data)
{
@@ -374,14 +375,14 @@ 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. */
+ // 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)
@@ -398,10 +399,10 @@ configure_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data
gnibbles_cworm_resize (cworms[i], tilesize);
}
- /* But, has the tile size changed? */
+ // But, has the tile size changed?
if (properties->tilesize == tilesize) {
- /* We must always re-load the logo. */
+ // We must always re-load the logo.
//gnibbles_load_logo (window);
return FALSE;
}
@@ -409,18 +410,18 @@ configure_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data
properties->tilesize = tilesize;
gnibbles_properties_set_tile_size (tilesize);
- /* Reload the images pixmap. */
+ // Reload the images pixmap.
//gnibbles_load_logo (window);
gnibbles_load_pixmap (window);
- /* Recreate the buffer pixmap. */
+ // 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. */
+ // Erase the buffer pixmap.
gdk_draw_rectangle (buffer_pixmap,
gtk_widget_get_style (drawing_area)->black_gc,
TRUE, 0, 0,
@@ -435,7 +436,7 @@ configure_event_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data
return FALSE;
}
-
+*/
#ifdef GGZ_CLIENT
static gint
network_loop (gpointer data)
@@ -480,7 +481,7 @@ new_game_clutter_2_cb (GtkWidget * widget, gpointer data)
return (FALSE);
}
-
+/*
static gint
new_game_2_cb (GtkWidget * widget, gpointer data)
{
@@ -514,7 +515,7 @@ new_game_2_cb (GtkWidget * widget, gpointer data)
return (FALSE);
}
-
+*/
gint
new_game_clutter (void)
{
@@ -575,7 +576,7 @@ new_game_clutter (void)
return TRUE;
}
-
+/*
gint
new_game (void)
{
@@ -636,7 +637,7 @@ new_game (void)
return TRUE;
}
-
+*/
static void
new_game_cb (GtkAction * action, gpointer data)
{
@@ -648,7 +649,7 @@ pause_game_cb (GtkAction * action, gpointer data)
{
if (paused) {
paused = 0;
- dummy_id = g_timeout_add (500, (GSourceFunc) new_game_2_cb, NULL);
+ dummy_id = g_timeout_add (500, (GSourceFunc) new_game_clutter_2_cb, NULL);
} else {
if (main_id || erase_id || restart_id || dummy_id) {
paused = 1;
@@ -714,7 +715,7 @@ end_game (gboolean show_splash)
}
if (show_splash) {
- render_logo ();
+ render_logo_clutter ();
gtk_action_set_sensitive (new_network_action, TRUE);
gtk_action_set_sensitive (pause_action, FALSE);
gtk_action_set_sensitive (resume_action, FALSE);
@@ -761,7 +762,7 @@ restart_game_clutter (gpointer data)
return FALSE;
}
-
+/*
static gint
restart_game (gpointer data)
{
@@ -776,7 +777,7 @@ restart_game (gpointer data)
return (FALSE);
}
-
+*/
static gint
erase_worms_cb (gpointer datap)
{
@@ -1102,7 +1103,7 @@ setup_window_clutter ()
scoreboard = gnibbles_scoreboard_new (statusbar);
}
-
+/*
static void
setup_window (void)
{
@@ -1207,7 +1208,7 @@ setup_window (void)
scoreboard = gnibbles_scoreboard_new (statusbar);
}
-
+*/
static void
render_logo_clutter (void)
{
@@ -1259,7 +1260,7 @@ hide_logo (void)
{
clutter_actor_hide (CLUTTER_ACTOR (landing_page));
}
-
+/*
static void
render_logo (void)
{
@@ -1303,7 +1304,7 @@ render_logo (void)
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! */
+ // 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);
@@ -1323,7 +1324,7 @@ render_logo (void)
0, 0, 0, 0, BOARDWIDTH * properties->tilesize,
BOARDHEIGHT * properties->tilesize);
}
-
+*/
int
main (int argc, char **argv)
{
diff --git a/gnibbles/scoreboard.c b/gnibbles/scoreboard.c
index a6d753e..8a3c080 100644
--- a/gnibbles/scoreboard.c
+++ b/gnibbles/scoreboard.c
@@ -62,7 +62,7 @@ gnibbles_scoreboard_new (GtkWidget * t_statusbar)
void
gnibbles_scoreboard_register (GnibblesScoreboard * scoreboard,
- GnibblesWorm * t_worm, gchar * colorname)
+ GnibblesCWorm * t_worm, gchar * colorname)
{
GdkColor color;
diff --git a/gnibbles/scoreboard.h b/gnibbles/scoreboard.h
index ec85179..5d6c269 100644
--- a/gnibbles/scoreboard.h
+++ b/gnibbles/scoreboard.h
@@ -25,10 +25,11 @@
#include <gtk/gtk.h>
#include "gnibbles.h"
-#include "worm.h"
+//#include "worm.h"
+#include "worm-clutter.h"
typedef struct {
- GnibblesWorm *worms[NUMWORMS];
+ GnibblesCWorm *worms[NUMWORMS];
GtkWidget *names[NUMWORMS];
GtkWidget *data[NUMWORMS];
gint count;
@@ -37,7 +38,7 @@ typedef struct {
GnibblesScoreboard *gnibbles_scoreboard_new (GtkWidget * t_statusbar);
void gnibbles_scoreboard_register (GnibblesScoreboard * scoreboard,
- GnibblesWorm * t_worm,
+ GnibblesCWorm * t_worm,
gchar * colorname);
void gnibbles_scoreboard_update (GnibblesScoreboard * scoreboard);
diff --git a/gnibbles/warp.c b/gnibbles/warp.c
index 53380d3..c6295c1 100644
--- a/gnibbles/warp.c
+++ b/gnibbles/warp.c
@@ -47,13 +47,13 @@ gnibbles_warp_new (gint t_x, gint t_y, gint t_wx, gint t_wy)
return (tmp);
}
-
+/*
void
gnibbles_warp_draw_buffer (GnibblesWarp * warp)
{
gnibbles_draw_big_pixmap_buffer (WARP, warp->x, warp->y);
}
-
+*/
void
gnibbles_warp_draw (GnibblesWarp *warp)
{
diff --git a/gnibbles/warpmanager.c b/gnibbles/warpmanager.c
index 12f0581..a424546 100644
--- a/gnibbles/warpmanager.c
+++ b/gnibbles/warpmanager.c
@@ -27,7 +27,7 @@
#include "warp.h"
#include "warpmanager.h"
#include "boni.h"
-#include "worm.h"
+//#include "worm.h"
#include "main.h"
#include "level.h"
@@ -114,6 +114,7 @@ gnibbles_warpmanager_add_warp (GnibblesWarpManager * warpmanager, gint t_x,
}
}
// useless ?
+/*
void
gnibbles_warpmanager_worm_change_pos (GnibblesWarpManager * warpmanager,
GnibblesWorm * worm)
@@ -133,7 +134,7 @@ gnibbles_warpmanager_worm_change_pos (GnibblesWarpManager * warpmanager,
if (warpmanager->warps[i]->wx == -1) {
good = 0;
while (!good) {
- /* In network games, warps should be fair. */
+ // In network games, warps should be fair.
if (ggz_network_mode) {
x = 10 % BOARDWIDTH;
y = 10 % BOARDHEIGHT;
@@ -165,3 +166,4 @@ gnibbles_warpmanager_worm_change_pos (GnibblesWarpManager * warpmanager,
}
}
}
+*/
diff --git a/gnibbles/warpmanager.h b/gnibbles/warpmanager.h
index 3d804a4..6e0b421 100644
--- a/gnibbles/warpmanager.h
+++ b/gnibbles/warpmanager.h
@@ -25,7 +25,7 @@
#include <gtk/gtk.h>
#include "warp.h"
-#include "worm.h"
+//#include "worm.h"
#define MAXWARPS 200
#define WARPLETTER 'W'
@@ -42,7 +42,7 @@ void gnibbles_warpmanager_destroy (GnibblesWarpManager * warpmanager);
void gnibbles_warpmanager_add_warp (GnibblesWarpManager * warpmanager,
gint t_x, gint t_y, gint t_wx, gint t_wy);
-void gnibbles_warpmanager_worm_change_pos (GnibblesWarpManager * warpmanager,
- GnibblesWorm * worm);
+//void gnibbles_warpmanager_worm_change_pos (GnibblesWarpManager * warpmanager,
+// GnibblesWorm * worm);
#endif
diff --git a/gnibbles/worm-clutter.c b/gnibbles/worm-clutter.c
index a4856a4..236ddc3 100644
--- a/gnibbles/worm-clutter.c
+++ b/gnibbles/worm-clutter.c
@@ -82,7 +82,7 @@ gnibbles_worm_queue_keypress (GnibblesCWorm * worm, guint dir)
g_queue_push_tail (key_queue[n], (gpointer) entry);
}
-static void
+void
cworm_set_direction (int worm, int dir)
{
@@ -107,7 +107,7 @@ cworm_set_direction (int worm, int dir)
}
}
-static void
+void
cworm_handle_direction (int worm, int dir)
{
if (ggz_network_mode) {
diff --git a/gnibbles/worm-clutter.h b/gnibbles/worm-clutter.h
index c61892a..a32b941 100644
--- a/gnibbles/worm-clutter.h
+++ b/gnibbles/worm-clutter.h
@@ -35,7 +35,7 @@
#define SLIVES 10
#define ERASESIZE 6
#define ERASETIME 500
-
+#define CAPACITY BOARDWIDTH * BOARDHEIGHT
#define GROWFACTOR 4
typedef struct {
@@ -56,6 +56,8 @@ typedef struct {
gint keypress;
} GnibblesCWorm;
+void cworm_set_direction (int worm, int dir);
+void cworm_handle_direction (int worm, int dir);
GnibblesCWorm* gnibbles_cworm_new (guint number, guint t_xhead,
guint t_yhead, gint t_direction);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]