Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog81
-rw-r--r--Makefile.am4
-rw-r--r--boards/submarine/big_explosion.pngbin31132 -> 0 bytes
-rw-r--r--boards/submarine/explosion.pngbin7246 -> 0 bytes
-rw-r--r--boards/submarine/whale.png (renamed from boards/submarine/mine.png)bin5762 -> 5762 bytes
-rw-r--r--boards/submarine/whale_hit.pngbin0 -> 6616 bytes
-rw-r--r--gcompris.desktop.in2
-rw-r--r--gcompris.spec.in2
-rw-r--r--src/boards/submarine.c1112
-rw-r--r--src/libassetml/.cvsignore1
-rw-r--r--src/libassetml/assetml.h3
-rwxr-xr-xsrc/libassetml/tools/assetml-query.c4
12 files changed, 673 insertions, 536 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a87ac0..95fc232 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,84 @@
+2003-08-15 Bruno coudoin <bruno.coudoin@free.fr>
+
+ * Makefile.am: changed rule for the translation report to work even if gcompris.pot is not
+ * there
+ * boards/submarine/big_explosion.png: removed explosion and mine in submarine
+ * boards/submarine/explosion.png: removed explosion and mine in submarine
+ * boards/submarine/mine.png: removed explosion and mine in submarine
+ * boards/submarine/whale.png: removed explosion and mine in submarine
+ * boards/submarine/whale_hit.png: removed explosion and mine in submarine
+ * gcompris.desktop.in: updated gcompris name to "educational suite"
+ * gcompris.spec.in: updated gcompris name to "educational suite"
+ * src/boards/submarine.c: (pause_board), (start_board),
+ (end_board), (set_level), (is_our_board), (submarine_next_level),
+ (submarine_destroy_all_items), (submarine_create_item),
+ (update_timeout), (update_timeout_slow),
+ (update_timeout_very_slow), (game_won), (ok),
+ (ballast_av_purge_event), (ballast_ar_purge_event),
+ (regleur_purge_event), (ballast_ar_chasse_event),
+ (ballast_av_chasse_event), (regleur_chasse_event),
+ (barre_av_event), (barre_ar_event), (engine_event),
+ (air_compressor_event), (battery_charger_event), (setSpeed),
+ (setBattery), (setAir), (setRegleur), (setBallastAV),
+ (setBallastAR), (submarine_explosion): removed explotion and mine. Added display of the air
+ * value in the tankers
+ * src/libassetml/assetml.h: fixed comment
+ * src/libassetml/tools/assetml-query.c: removed reference to gcompris in version display
+
+2003-08-15 Bruno coudoin <bruno.coudoin@free.fr>
+
+ reviewed by: <delete if not using a buddy>
+
+ * Makefile.am:
+ * boards/submarine/big_explosion.png:
+ * boards/submarine/explosion.png:
+ * boards/submarine/mine.png:
+ * boards/submarine/whale.png:
+ * boards/submarine/whale_hit.png:
+ * gcompris.desktop.in:
+ * gcompris.spec.in:
+ * po/am.po:
+ * po/ar.po:
+ * po/az.po:
+ * po/ca.po:
+ * po/cs.po:
+ * po/de.po:
+ * po/el.po:
+ * po/es.po:
+ * po/fi.po:
+ * po/fr.po:
+ * po/he.po:
+ * po/hu.po:
+ * po/it.po:
+ * po/lt.po:
+ * po/mk.po:
+ * po/ml.po:
+ * po/ms.po:
+ * po/nl.po:
+ * po/no.po:
+ * po/pt.po:
+ * po/pt_BR.po:
+ * po/ro.po:
+ * po/ru.po:
+ * po/sk.po:
+ * po/sv.po:
+ * po/tr.po:
+ * src/boards/submarine.c: (pause_board), (start_board),
+ (end_board), (set_level), (is_our_board), (submarine_next_level),
+ (submarine_destroy_all_items), (submarine_create_item),
+ (update_timeout), (update_timeout_slow),
+ (update_timeout_very_slow), (game_won), (ok),
+ (ballast_av_purge_event), (ballast_ar_purge_event),
+ (regleur_purge_event), (ballast_ar_chasse_event),
+ (ballast_av_chasse_event), (regleur_chasse_event),
+ (barre_av_event), (barre_ar_event), (engine_event),
+ (air_compressor_event), (battery_charger_event), (setSpeed),
+ (setBattery), (setAir), (setRegleur), (setBallastAV),
+ (setBallastAR), (submarine_explosion):
+ * src/libassetml/.cvsignore:
+ * src/libassetml/assetml.h:
+ * src/libassetml/tools/assetml-query.c:
+
2003-08-12 Bruno coudoin <bruno.coudoin@free.fr>
* src/gcompris/gameutil.c: (gcompris_load_pixmap_asset): changed
diff --git a/Makefile.am b/Makefile.am
index 27bb4e9..697f520 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,8 +59,8 @@ dist-core:
@echo Created $(distcore).tar.gz
# Display stats on translation
-core-translation-report: po/gcompris.pot po-checktrans.py po-checktrans
- -(cd $(srcdir) && ./po-checktrans po/gcompris.pot po/*.po)
+core-translation-report: po-checktrans.py po-checktrans
+ -([ -f po/gcompris.pot ] && cd $(srcdir) && ./po-checktrans po/gcompris.pot po/*.po)
all-local: core-translation-report
diff --git a/boards/submarine/big_explosion.png b/boards/submarine/big_explosion.png
deleted file mode 100644
index bed5623..0000000
--- a/boards/submarine/big_explosion.png
+++ /dev/null
Binary files differ
diff --git a/boards/submarine/explosion.png b/boards/submarine/explosion.png
deleted file mode 100644
index 0ef9e91..0000000
--- a/boards/submarine/explosion.png
+++ /dev/null
Binary files differ
diff --git a/boards/submarine/mine.png b/boards/submarine/whale.png
index de7a2b7..de7a2b7 100644
--- a/boards/submarine/mine.png
+++ b/boards/submarine/whale.png
Binary files differ
diff --git a/boards/submarine/whale_hit.png b/boards/submarine/whale_hit.png
new file mode 100644
index 0000000..795a6cf
--- /dev/null
+++ b/boards/submarine/whale_hit.png
Binary files differ
diff --git a/gcompris.desktop.in b/gcompris.desktop.in
index 831bc32..b6acbe2 100644
--- a/gcompris.desktop.in
+++ b/gcompris.desktop.in
@@ -1,5 +1,5 @@
[Desktop Entry]
-Name=GCompris
+_Name=Educational suite gcompris
_Comment=Educational game starting at 3 years old
Exec=gcompris
Icon=gcompris.png
diff --git a/gcompris.spec.in b/gcompris.spec.in
index e3389fc..3d968e0 100644
--- a/gcompris.spec.in
+++ b/gcompris.spec.in
@@ -5,7 +5,7 @@
%define prefix /usr
%define canvaspackage %(if rpm -q redhat-release &> /dev/null; then echo gdk-pixbuf-gnome; elif rpm -q mandrake-release &> /dev/null; then echo gdk-pixbuf-gnomecanvas; else echo; fi)
-Summary: GCompris / I Have Understood.
+Summary: GCompris : Educational suite for kids 3-10 years old
Name: gcompris
Version: %ver
Release: %rel
diff --git a/src/boards/submarine.c b/src/boards/submarine.c
index fd3602f..42f7d4b 100644
--- a/src/boards/submarine.c
+++ b/src/boards/submarine.c
@@ -52,6 +52,10 @@ static void game_won();
#define BARRE_AR_Y 50
#define BARRE_AV_X 530
#define BARRE_AV_Y 100
+#define BALLAST_AV_AIR_X 440
+#define BALLAST_AV_AIR_Y 50
+#define BALLAST_AR_AIR_X 220
+#define BALLAST_AR_AIR_Y 50
// taken from submarine.png
#define SUBMARINE_WIDTH 122
@@ -102,7 +106,7 @@ static void game_won();
#define DOWN 0
#define FRIGATE_SPEED 5.0
-#define MINE_DETECTION_RADIUS 80.0
+#define WHALE_DETECTION_RADIUS 30.0
#define UPDATE_DELAY 200
#define UPDATE_DELAY_SLOW 300
@@ -115,7 +119,7 @@ static void game_won();
static GnomeCanvasGroup *boardRootItem = NULL;
static GnomeCanvasItem *sub_schema_image_item, *submarine_item,
- *ballast_av_purge_item, *ballast_ar_purge_item, *regleur_purge_item;
+ *ballast_av_purge_item, *ballast_ar_purge_item, *regleur_purge_item;
static GnomeCanvasItem *ballast_av_chasse_item, *ballast_ar_chasse_item, *regleur_chasse_item;
gboolean ballast_av_purge_open, ballast_ar_purge_open, regleur_purge_open;
gboolean ballast_av_chasse_open, ballast_ar_chasse_open, regleur_chasse_open;
@@ -123,21 +127,23 @@ gboolean air_charging, battery_charging;
gboolean submarine_destroyed;
static GnomeCanvasItem *barre_av_item, *barre_ar_item,
- *barre_av_up_item, *barre_av_down_item, *barre_ar_up_item, *barre_ar_down_item,
+ *barre_av_up_item, *barre_av_down_item, *barre_ar_up_item, *barre_ar_down_item,
*engine_up_item, *engine_down_item,
*speed_item_back, *speed_item_front,
- *air_item_back, *air_item_front,
- *regleur_item_back, *regleur_item_front,
+ *air_item_back, *air_item_front,
+ *regleur_item_back, *regleur_item_front,
*battery_item_back, *battery_item_front,
+ *ballast_av_air_item_back, *ballast_av_air_item_front,
+ *ballast_ar_air_item_back, *ballast_ar_air_item_front,
*air_compressor_item, *battery_charger_item, *alert_submarine,
- *bubbling[3], *frigate_item, *explosion[3], *big_explosion, *mine;
+ *bubbling[3], *frigate_item, *big_explosion, *whale;
/* submarine parameters */
static double barre_av_angle, barre_ar_angle, depth, weight, resulting_weight, submarine_x, air, battery, regleur;
static double submarine_horizontal_speed, submarine_vertical_speed, speed_ordered, assiette;
static double ballast_av_air, ballast_ar_air;
-static double mine_x, mine_y;
+static double whale_x, whale_y;
static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent);
static void submarine_destroy_all_items(void);
@@ -205,7 +211,7 @@ static void pause_board (gboolean pause)
return;
if(gamewon == TRUE && pause == FALSE) /* the game is won */
- game_won();
+ game_won();
board_paused = pause;
}
@@ -215,14 +221,14 @@ static void pause_board (gboolean pause)
* =====================================================================*/
static void start_board (GcomprisBoard *agcomprisBoard) {
if(agcomprisBoard!=NULL) {
- gcomprisBoard=agcomprisBoard;
- gcompris_set_background(gnome_canvas_root(gcomprisBoard->canvas), "submarine/sub_bg.jpg");
- gcomprisBoard->level=1;
- gcomprisBoard->sublevel=1;
- submarine_next_level();
- gamewon = FALSE;
- pause_board(FALSE);
- }
+ gcomprisBoard=agcomprisBoard;
+ gcompris_set_background(gnome_canvas_root(gcomprisBoard->canvas), "submarine/sub_bg.jpg");
+ gcomprisBoard->level=1;
+ gcomprisBoard->sublevel=1;
+ submarine_next_level();
+ gamewon = FALSE;
+ pause_board(FALSE);
+ }
}
/* =====================================================================
@@ -230,13 +236,13 @@ static void start_board (GcomprisBoard *agcomprisBoard) {
* =====================================================================*/
static void end_board () {
if(gcomprisBoard!=NULL){
- pause_board(TRUE);
- submarine_destroy_all_items();
- }
+ pause_board(TRUE);
+ submarine_destroy_all_items();
+ }
/* kill pending timers */
g_source_remove(timer_id);
- g_source_remove(timer_slow_id);
- g_source_remove(timer_very_slow_id);
+ g_source_remove(timer_slow_id);
+ g_source_remove(timer_very_slow_id);
gcomprisBoard = NULL;
}
@@ -246,22 +252,22 @@ static void end_board () {
* =====================================================================*/
static void set_level (guint level) {
if(gcomprisBoard!=NULL) {
- gcomprisBoard->level=level;
- gcomprisBoard->sublevel=1;
- submarine_next_level();
- }
+ gcomprisBoard->level=level;
+ gcomprisBoard->sublevel=1;
+ submarine_next_level();
+ }
}
/* =====================================================================
*
* =====================================================================*/
gboolean is_our_board (GcomprisBoard *gcomprisBoard) {
- if (gcomprisBoard) {
- if(g_strcasecmp(gcomprisBoard->type, "submarine")==0) {
- /* Set the plugin entry */
- gcomprisBoard->plugin=&menu_bp;
- return TRUE;
- }
+ if (gcomprisBoard) {
+ if(g_strcasecmp(gcomprisBoard->type, "submarine")==0) {
+ /* Set the plugin entry */
+ gcomprisBoard->plugin=&menu_bp;
+ return TRUE;
+ }
}
return FALSE;
}
@@ -269,10 +275,10 @@ gboolean is_our_board (GcomprisBoard *gcomprisBoard) {
* set initial values for the next level
* =====================================================================*/
static void submarine_next_level() {
- ballast_av_purge_open = ballast_ar_purge_open = regleur_purge_open = FALSE;
- ballast_av_chasse_open = ballast_ar_chasse_open = regleur_chasse_open = FALSE;
+ ballast_av_purge_open = ballast_ar_purge_open = regleur_purge_open = FALSE;
+ ballast_av_chasse_open = ballast_ar_chasse_open = regleur_chasse_open = FALSE;
air_charging = battery_charging = FALSE;
- barre_av_angle = barre_ar_angle = 0.0;
+ barre_av_angle = barre_ar_angle = 0.0;
depth = SUBMARINE_INITIAL_DEPTH;
submarine_horizontal_speed = speed_ordered = 0.0;
submarine_x = SUBMARINE_INITIAL_X;
@@ -280,8 +286,8 @@ static void submarine_next_level() {
regleur = REGLEUR_INITIAL;
air = AIR_INITIAL;
battery = BATTERY_INITIAL;
- ballast_av_air = ballast_ar_air = MAX_BALLAST/10.0;
- submarine_destroyed = FALSE;
+ ballast_av_air = ballast_ar_air = MAX_BALLAST/10.0;
+ submarine_destroyed = FALSE;
submarine_destroy_all_items();
gamewon = FALSE;
@@ -295,7 +301,7 @@ static void submarine_next_level() {
* =====================================================================*/
static void submarine_destroy_all_items() {
if(boardRootItem!=NULL)
- gtk_object_destroy (GTK_OBJECT(boardRootItem));
+ gtk_object_destroy (GTK_OBJECT(boardRootItem));
boardRootItem = NULL;
}
@@ -307,9 +313,9 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
GdkPixbuf *pixmap = NULL;
char *str = NULL;
char s12[12];
- int i, w, h, schema_x, schema_y;
+ int i, w, h, schema_x, schema_y;
- boardRootItem = GNOME_CANVAS_GROUP(
+ boardRootItem = GNOME_CANVAS_GROUP(
gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas),
gnome_canvas_group_get_type (),
"x", (double) 0,
@@ -318,17 +324,17 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "submarine.png");
pixmap = gcompris_load_pixmap(str);
- submarine_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) 0.0,//SUBMARINE_INITIAL_X,
- "y", (double) 0.0,//SUBMARINE_INITIAL_DEPTH + SURFACE_IN_BACKGROUND - SUBMARINE_HEIGHT,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ submarine_item = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) 0.0,//SUBMARINE_INITIAL_X,
+ "y", (double) 0.0,//SUBMARINE_INITIAL_DEPTH + SURFACE_IN_BACKGROUND - SUBMARINE_HEIGHT,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
@@ -342,16 +348,16 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
schema_x = (gcomprisBoard->width - w)/2 ;
schema_y = gcomprisBoard->height - h;
sub_schema_image_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + w/2.0,
- "y", (double) schema_y + h/2.0,
- "width", (double) w,
- "height", (double) h,
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + w/2.0,
+ "y", (double) schema_y + h/2.0,
+ "width", (double) w,
+ "height", (double) h,
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
@@ -361,111 +367,111 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
w = gdk_pixbuf_get_width(pixmap);
h = gdk_pixbuf_get_height(pixmap);
ballast_ar_purge_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) PURGE_AR + schema_x,
- "y", (double) schema_y + h/2.0 -1.0 ,
- "width", (double) w,
- "height", (double) h,
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) PURGE_AR + schema_x,
+ "y", (double) schema_y + h/2.0 -1.0,
+ "width", (double) w,
+ "height", (double) h,
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
gtk_signal_connect(GTK_OBJECT(ballast_ar_purge_item), "event", (GtkSignalFunc) ballast_ar_purge_event, NULL);
ballast_av_purge_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) PURGE_AV + schema_x,
- "y", (double) schema_y + h/2.0 -1.0 ,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) PURGE_AV + schema_x,
+ "y", (double) schema_y + h/2.0 -1.0,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
gtk_signal_connect(GTK_OBJECT(ballast_av_purge_item), "event", (GtkSignalFunc) ballast_av_purge_event, NULL);
regleur_purge_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) REGLEUR + schema_x,
- "y", (double) schema_y + h/2.0 -2.0,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) REGLEUR + schema_x,
+ "y", (double) schema_y + h/2.0 -2.0,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
gtk_signal_connect(GTK_OBJECT(regleur_purge_item), "event", (GtkSignalFunc) regleur_purge_event, NULL);
ballast_av_chasse_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + CHASSE_BALLAST_AV_X,
- "y", (double) schema_y + CHASSE_BALLAST_AV_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + CHASSE_BALLAST_AV_X,
+ "y", (double) schema_y + CHASSE_BALLAST_AV_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
gtk_signal_connect(GTK_OBJECT(ballast_av_chasse_item), "event", (GtkSignalFunc) ballast_av_chasse_event, NULL);
ballast_ar_chasse_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + CHASSE_BALLAST_AR_X,
- "y", (double) schema_y + CHASSE_BALLAST_AR_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + CHASSE_BALLAST_AR_X,
+ "y", (double) schema_y + CHASSE_BALLAST_AR_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
gtk_signal_connect(GTK_OBJECT(ballast_ar_chasse_item), "event", (GtkSignalFunc) ballast_ar_chasse_event, NULL);
regleur_chasse_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + CHASSE_REGLEUR_X,
- "y", (double) schema_y + CHASSE_REGLEUR_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + CHASSE_REGLEUR_X,
+ "y", (double) schema_y + CHASSE_REGLEUR_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
gtk_signal_connect(GTK_OBJECT(regleur_chasse_item), "event", (GtkSignalFunc) regleur_chasse_event, NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
- // DEPTH RUDDERS
+ // DEPTH RUDDERS
str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "rudder.png");
pixmap = gcompris_load_pixmap(str);
barre_av_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + BARRE_AV_X,
- "y", (double) schema_y + BARRE_AV_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + BARRE_AV_X,
+ "y", (double) schema_y + BARRE_AV_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
barre_ar_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + BARRE_AR_X,
- "y", (double) schema_y + BARRE_AR_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + BARRE_AR_X,
+ "y", (double) schema_y + BARRE_AR_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
@@ -473,76 +479,76 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "up.png");
pixmap = gcompris_load_pixmap(str);
barre_av_up_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + BARRE_AV_X + COMMAND_OFFSET,
- "y", (double) schema_y + BARRE_AV_Y - COMMAND_OFFSET,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + BARRE_AV_X + COMMAND_OFFSET,
+ "y", (double) schema_y + BARRE_AV_Y - COMMAND_OFFSET,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
barre_ar_up_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + BARRE_AR_X + COMMAND_OFFSET,
- "y", (double) schema_y + BARRE_AR_Y - COMMAND_OFFSET,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + BARRE_AR_X + COMMAND_OFFSET,
+ "y", (double) schema_y + BARRE_AR_Y - COMMAND_OFFSET,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
engine_up_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + ENGINE_UP_X,
- "y", (double) schema_y + ENGINE_UP_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + ENGINE_UP_X,
+ "y", (double) schema_y + ENGINE_UP_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "down.png");
pixmap = gcompris_load_pixmap(str);
barre_av_down_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + BARRE_AV_X + COMMAND_OFFSET,
- "y", (double) schema_y + BARRE_AV_Y + COMMAND_OFFSET,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + BARRE_AV_X + COMMAND_OFFSET,
+ "y", (double) schema_y + BARRE_AV_Y + COMMAND_OFFSET,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
barre_ar_down_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + BARRE_AR_X + COMMAND_OFFSET,
- "y", (double) schema_y + BARRE_AR_Y + COMMAND_OFFSET,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + BARRE_AR_X + COMMAND_OFFSET,
+ "y", (double) schema_y + BARRE_AR_Y + COMMAND_OFFSET,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
engine_down_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + ENGINE_DOWN_X,
- "y", (double) schema_y + ENGINE_DOWN_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + ENGINE_DOWN_X,
+ "y", (double) schema_y + ENGINE_DOWN_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
@@ -556,101 +562,143 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
// displays the speed on the engine
sprintf(s12,"%d",(int)submarine_horizontal_speed);
speed_item_back = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + (ENGINE_UP_X + ENGINE_DOWN_X)/2 +1,
+ "y", (double) schema_y + ENGINE_UP_Y + 1,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_BACK,
+ NULL);
+ speed_item_front = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", s12,
"font", gcompris_skin_font_board_title_bold,
- "x", (double) schema_x + (ENGINE_UP_X + ENGINE_DOWN_X)/2 +1,
- "y", (double) schema_y + ENGINE_UP_Y + 1,
+ "x", (double) schema_x + (ENGINE_UP_X + ENGINE_DOWN_X)/2,
+ "y", (double) schema_y + ENGINE_UP_Y,
"anchor", GTK_ANCHOR_CENTER,
- "fill_color", TEXT_COLOR_BACK,
+ "fill_color", TEXT_COLOR_FRONT,
NULL);
- speed_item_front = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_text_get_type (),
- "text", s12,
- "font", gcompris_skin_font_board_title_bold,
- "x", (double) schema_x + (ENGINE_UP_X + ENGINE_DOWN_X)/2,
- "y", (double) schema_y + ENGINE_UP_Y,
- "anchor", GTK_ANCHOR_CENTER,
- "fill_color", TEXT_COLOR_FRONT,
- NULL);
+
+ // displays the ballast_av_air value
+ sprintf(s12,"%d",(int)ballast_av_air);
+ ballast_av_air_item_back = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + BALLAST_AV_AIR_X + 1,
+ "y", (double) schema_y + BALLAST_AV_AIR_Y + 1,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_BACK,
+ NULL);
+ ballast_av_air_item_front = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + BALLAST_AV_AIR_X,
+ "y", (double) schema_y + BALLAST_AV_AIR_Y,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_FRONT,
+ NULL);
+
+ // displays the ballast_ar_air value
+ sprintf(s12,"%d",(int)ballast_ar_air);
+ ballast_ar_air_item_back = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + BALLAST_AR_AIR_X + 1,
+ "y", (double) schema_y + BALLAST_AR_AIR_Y + 1,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_BACK,
+ NULL);
+ ballast_ar_air_item_front = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + BALLAST_AR_AIR_X,
+ "y", (double) schema_y + BALLAST_AR_AIR_Y,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_FRONT,
+ NULL);
// displays the remaining air value
sprintf(s12,"%d", (int)air);
air_item_back = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_text_get_type (),
- "text", s12,
- "font", gcompris_skin_font_board_title_bold,
- "x", (double) schema_x + AIR_X +1,
- "y", (double) schema_y + AIR_Y + 1,
- "anchor", GTK_ANCHOR_CENTER,
- "fill_color", TEXT_COLOR_BACK,
- NULL);
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + AIR_X +1,
+ "y", (double) schema_y + AIR_Y + 1,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_BACK,
+ NULL);
air_item_front = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_text_get_type (),
- "text", s12,
- "font", gcompris_skin_font_board_title_bold,
- "x", (double) schema_x + AIR_X,
- "y", (double) schema_y + AIR_Y,
- "anchor", GTK_ANCHOR_CENTER,
- "fill_color", TEXT_COLOR_FRONT,
- NULL);
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + AIR_X,
+ "y", (double) schema_y + AIR_Y,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_FRONT,
+ NULL);
// displays the remaining battery value
sprintf(s12,"%d", (int)battery);
battery_item_back = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_text_get_type (),
- "text", s12,
- "font", gcompris_skin_font_board_title_bold,
- "x", (double) schema_x + BATTERY_X +1,
- "y", (double) schema_y + BATTERY_Y + 1,
- "anchor", GTK_ANCHOR_CENTER,
- "fill_color", TEXT_COLOR_BACK,
- NULL);
- battery_item_front = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", s12,
"font", gcompris_skin_font_board_title_bold,
- "x", (double) schema_x + BATTERY_X,
- "y", (double) schema_y + BATTERY_Y,
+ "x", (double) schema_x + BATTERY_X +1,
+ "y", (double) schema_y + BATTERY_Y + 1,
"anchor", GTK_ANCHOR_CENTER,
- "fill_color", TEXT_COLOR_FRONT,
+ "fill_color", TEXT_COLOR_BACK,
NULL);
-
- // displays the remaining battery value
+ battery_item_front = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + BATTERY_X,
+ "y", (double) schema_y + BATTERY_Y,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_FRONT,
+ NULL);
+
+ // displays the remaining regleur value
sprintf(s12,"%d", (int)regleur);
regleur_item_back = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_text_get_type (),
- "text", s12,
- "font", gcompris_skin_font_board_title_bold,
- "x", (double) schema_x + REGLEUR_X +1,
- "y", (double) schema_y + REGLEUR_Y + 1,
- "anchor", GTK_ANCHOR_CENTER,
- "fill_color", TEXT_COLOR_BACK,
- NULL);
- regleur_item_front = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", s12,
"font", gcompris_skin_font_board_title_bold,
- "x", (double) schema_x + REGLEUR_X,
- "y", (double) schema_y + REGLEUR_Y,
+ "x", (double) schema_x + REGLEUR_X +1,
+ "y", (double) schema_y + REGLEUR_Y + 1,
"anchor", GTK_ANCHOR_CENTER,
- "fill_color", TEXT_COLOR_FRONT,
+ "fill_color", TEXT_COLOR_BACK,
NULL);
-
- // displays an alert when some parameters are bad
+ regleur_item_front = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", s12,
+ "font", gcompris_skin_font_board_title_bold,
+ "x", (double) schema_x + REGLEUR_X,
+ "y", (double) schema_y + REGLEUR_Y,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color", TEXT_COLOR_FRONT,
+ NULL);
+
+ // displays an alert when some parameters are bad
str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "alert_submarine.png");
pixmap = gcompris_load_pixmap(str);
alert_submarine = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) ALERT_SUBMARINE_X,
- "y", (double) ALERT_SUBMARINE_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) ALERT_SUBMARINE_X,
+ "y", (double) ALERT_SUBMARINE_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
gnome_canvas_item_hide(alert_submarine);
@@ -660,75 +708,55 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
pixmap = gcompris_load_pixmap(str);
for (i=0; i<3; i++) {
bubbling[i] = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) 0.0,
- "y", (double) 0.0,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
- gnome_canvas_item_hide(bubbling[i]);
- }
- g_free(str);
- gdk_pixbuf_unref(pixmap);
-
- // explosion items
- str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "explosion.png");
- pixmap = gcompris_load_pixmap(str);
- for (i=0; i<3; i++) {
- explosion[i] = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) 0.0,
- "y", (double) 0.0,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
- gnome_canvas_item_hide(explosion[i]);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) 0.0,
+ "y", (double) 0.0,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
+ gnome_canvas_item_hide(bubbling[i]);
}
g_free(str);
gdk_pixbuf_unref(pixmap);
- // mine item
- str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "mine.png");
+ // whale item
+ str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "whale.png");
pixmap = gcompris_load_pixmap(str);
- mine_x = RAND((int)(gdk_pixbuf_get_width(pixmap)), (int)(gcomprisBoard->width-gdk_pixbuf_get_width(pixmap)));
- mine_y = RAND((int)(SURFACE_IN_BACKGROUND + gdk_pixbuf_get_height(pixmap)),(int)MAX_DEPTH);
- mine = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) mine_x,
- "y", (double) mine_y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ whale_x = RAND((int)(gdk_pixbuf_get_width(pixmap)), (int)(gcomprisBoard->width-gdk_pixbuf_get_width(pixmap)));
+ whale_y = RAND((int)(SURFACE_IN_BACKGROUND + gdk_pixbuf_get_height(pixmap)),(int)MAX_DEPTH);
+ whale = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) whale_x,
+ "y", (double) whale_y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
- // big explosion item (only for the mine)
- str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "big_explosion.png");
+ // big explosion item (only for the whale)
+ str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "whale_hit.png");
pixmap = gcompris_load_pixmap(str);
big_explosion = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) mine_x,
- "y", (double) mine_y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
- gnome_canvas_item_hide(big_explosion);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) whale_x,
+ "y", (double) whale_y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
+ gnome_canvas_item_hide(big_explosion);
g_free(str);
gdk_pixbuf_unref(pixmap);
@@ -737,16 +765,16 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "manette.png");
pixmap = gcompris_load_pixmap(str);
air_compressor_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) schema_x + AIR_TRIGGER_X,
- "y", (double) schema_y + AIR_TRIGGER_Y,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) schema_x + AIR_TRIGGER_X,
+ "y", (double) schema_y + AIR_TRIGGER_Y,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "anchor", GTK_ANCHOR_CENTER,
+ NULL);
battery_charger_item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_pixbuf_get_type (),
"pixbuf", pixmap,
@@ -756,7 +784,7 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
"height", (double) gdk_pixbuf_get_height(pixmap),
"width_set", TRUE,
"height_set", TRUE,
- "anchor", GTK_ANCHOR_CENTER,
+ "anchor", GTK_ANCHOR_CENTER,
NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
@@ -765,16 +793,16 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "asw_frigate.png");
pixmap = gcompris_load_pixmap(str);
frigate_item = gnome_canvas_item_new (boardRootItem,
- gnome_canvas_pixbuf_get_type (),
- "pixbuf", pixmap,
- "x", (double) 700.0,
- "y", (double) 2.0,
- "width", (double) gdk_pixbuf_get_width(pixmap),
- "height", (double) gdk_pixbuf_get_height(pixmap),
- "width_set", TRUE,
- "height_set", TRUE,
- //"anchor", GTK_ANCHOR_CENTER,
- NULL);
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double) 700.0,
+ "y", (double) 2.0,
+ "width", (double) gdk_pixbuf_get_width(pixmap),
+ "height", (double) gdk_pixbuf_get_height(pixmap),
+ "width_set", TRUE,
+ "height_set", TRUE,
+ //"anchor", GTK_ANCHOR_CENTER,
+ NULL);
g_free(str);
gdk_pixbuf_unref(pixmap);
@@ -793,137 +821,141 @@ static GnomeCanvasItem *submarine_create_item(GnomeCanvasGroup *parent) {
static gboolean update_timeout() {
double delta_air;
gboolean regleur_dirty = FALSE;
- gboolean air_dirty = FALSE;
+ gboolean air_dirty = FALSE;
/* air in ballasts */
- if (ballast_av_purge_open) {
- ballast_av_air -= UPDATE_DELAY/1000.0 *500.0; // 500 liters go out per second
+ if (ballast_av_purge_open) {
+ ballast_av_air -= UPDATE_DELAY/1000.0 *500.0; // 500 liters go out per second
if (ballast_av_air < 0.0)
- ballast_av_air = 0.0;
+ ballast_av_air = 0.0;
+ setBallastAV(ballast_av_air);
}
- if (ballast_ar_purge_open) {
- ballast_ar_air -= UPDATE_DELAY/1000.0 *500.0;
+ if (ballast_ar_purge_open) {
+ ballast_ar_air -= UPDATE_DELAY/1000.0 *500.0;
if (ballast_ar_air < 0.0)
- ballast_ar_air = 0.0;
+ ballast_ar_air = 0.0;
+ setBallastAR(ballast_ar_air);
}
- if (ballast_av_chasse_open && air>0.0) {
- delta_air = UPDATE_DELAY/1000.0 *500.0; // 200 liters are injected each second
- ballast_av_air += delta_air;
+ if (ballast_av_chasse_open && air>0.0) {
+ delta_air = UPDATE_DELAY/1000.0 *500.0; // 200 liters are injected each second
+ ballast_av_air += delta_air;
air -= delta_air;
if (air<0.0)
- air = 0.0;
+ air = 0.0;
if (ballast_av_air > MAX_BALLAST)
- ballast_av_air = MAX_BALLAST;
+ ballast_av_air = MAX_BALLAST;
air_dirty = TRUE;
+ setBallastAV(ballast_av_air);
}
- if (ballast_ar_chasse_open && air>0.0) {
- delta_air = UPDATE_DELAY/1000.0 *500.0;
- ballast_ar_air += delta_air;
+ if (ballast_ar_chasse_open && air>0.0) {
+ delta_air = UPDATE_DELAY/1000.0 *500.0;
+ ballast_ar_air += delta_air;
air -= delta_air;
if (air<0.0)
- air = 0.0;
+ air = 0.0;
if (ballast_ar_air > MAX_BALLAST)
- ballast_ar_air = MAX_BALLAST;
+ ballast_ar_air = MAX_BALLAST;
air_dirty = TRUE;
+ setBallastAR(ballast_ar_air);
}
if (air_dirty)
- setAir(air);
+ setAir(air);
/* air in "regleur" (small ballast to finely balance the submarine) */
- if (regleur_purge_open) {
- regleur += UPDATE_DELAY/1000.0 *50.0; // 100 liters enter per second
+ if (regleur_purge_open) {
+ regleur += UPDATE_DELAY/1000.0 *50.0; // 100 liters enter per second
if (regleur > MAX_REGLEUR)
- regleur = MAX_REGLEUR;
- regleur_dirty = TRUE;
+ regleur = MAX_REGLEUR;
+ regleur_dirty = TRUE;
}
- if (regleur_chasse_open && air>0.0 && regleur > 0.0) {
- delta_air = UPDATE_DELAY/1000.0 *50.0; // 50 liters are injected each second
- regleur -= delta_air;
+ if (regleur_chasse_open && air>0.0 && regleur > 0.0) {
+ delta_air = UPDATE_DELAY/1000.0 *50.0; // 50 liters are injected each second
+ regleur -= delta_air;
air -= delta_air;
if (air<0.0)
- air = 0.0;
+ air = 0.0;
if (regleur < 0.0)
- regleur = 0.0;
- regleur_dirty = TRUE;
+ regleur = 0.0;
+ regleur_dirty = TRUE;
setAir(air);
}
- if (regleur_dirty)
- setRegleur(regleur);
+ if (regleur_dirty)
+ setRegleur(regleur);
- return TRUE;
+ return TRUE;
}
/* =====================================================================
* Periodically recalculate some submarine parameters, with a larger delay
* =====================================================================*/
static gboolean update_timeout_slow() {
- double delta_assiette;
+ double delta_assiette;
- /* speed : don't reach instantly the ordered speed */
+ /* speed : don't reach instantly the ordered speed */
if (speed_ordered != submarine_horizontal_speed) {
- submarine_horizontal_speed += (speed_ordered-submarine_horizontal_speed)/10.0;
+ submarine_horizontal_speed += (speed_ordered-submarine_horizontal_speed)/10.0;
if (fabs(speed_ordered - submarine_horizontal_speed) < 0.1)
- submarine_horizontal_speed = speed_ordered;
+ submarine_horizontal_speed = speed_ordered;
}
/* assiette */
delta_assiette = (ballast_ar_air - ballast_av_air)/200.0 +
- (barre_av_angle - barre_ar_angle)/5.0*submarine_horizontal_speed;
+ (barre_av_angle - barre_ar_angle)/5.0*submarine_horizontal_speed;
assiette -= delta_assiette*UPDATE_DELAY/10000.0;
if (assiette < -30.0)
- assiette = -30.0;
+ assiette = -30.0;
if (assiette > 30.0)
- assiette = 30.0;
+ assiette = 30.0;
/* If surfacing, diminish the 'assiette' */
if ( depth <= 5.0 + SURFACE_DEPTH) {
- assiette *= depth/(depth+1.0);
+ assiette *= depth/(depth+1.0);
}
/* update some dynamic parameters */
- /* resulting_weight > 0 ==> the sub goes deeper
+ /* resulting_weight > 0 ==> the sub goes deeper
regleur : this is the qty of water */
- resulting_weight = weight - ballast_av_air - ballast_ar_air + regleur;
+ resulting_weight = weight - ballast_av_air - ballast_ar_air + regleur;
submarine_vertical_speed = resulting_weight/300.0 + submarine_horizontal_speed*sin(DEG_TO_RAD(-assiette));
/* if depth rudders are in the same direction */
if (barre_ar_angle != 0.0 && barre_av_angle != 0.0) {
- if (fabs(barre_ar_angle)/barre_ar_angle == fabs(barre_av_angle)/barre_av_angle) {
- double a = (fabs(barre_ar_angle) > fabs(barre_av_angle)) ? barre_av_angle : barre_ar_angle;
- submarine_vertical_speed += a * submarine_horizontal_speed/30.0;
- }
+ if (fabs(barre_ar_angle)/barre_ar_angle == fabs(barre_av_angle)/barre_av_angle) {
+ double a = (fabs(barre_ar_angle) > fabs(barre_av_angle)) ? barre_av_angle : barre_ar_angle;
+ submarine_vertical_speed += a * submarine_horizontal_speed/30.0;
+ }
}
/* position & depth */
submarine_x += submarine_horizontal_speed * cos(DEG_TO_RAD(assiette)) * UPDATE_DELAY_SLOW/1000.0;
depth += submarine_vertical_speed * UPDATE_DELAY_SLOW/1000.0;
if (depth < SURFACE_DEPTH)
- depth = SURFACE_DEPTH;
+ depth = SURFACE_DEPTH;
if (depth > MAX_DEPTH)
- depth = MAX_DEPTH;
+ depth = MAX_DEPTH;
// show an alert if some parameters reach the limit
if (depth >= MAX_DEPTH-20.0 || assiette == -30.0 || assiette == 30.0 || air == 0.0 || battery == 0.0)
- gnome_canvas_item_show(alert_submarine);
- else
- gnome_canvas_item_hide(alert_submarine);
+ gnome_canvas_item_show(alert_submarine);
+ else
+ gnome_canvas_item_hide(alert_submarine);
/* if the submarine dives, stop charging air tanks and batteries */
if ( depth >= SURFACE_DEPTH+10.0 ) {
- if (air_charging) {
- air_charging = FALSE;
+ if (air_charging) {
+ air_charging = FALSE;
item_rotate_with_center(air_compressor_item, 0 , TRIGGER_CENTER_X, TRIGGER_CENTER_Y );
- }
- if (battery_charging) {
- battery_charging = FALSE;
+ }
+ if (battery_charging) {
+ battery_charging = FALSE;
item_rotate_with_center(battery_charger_item, 0 , TRIGGER_CENTER_X, TRIGGER_CENTER_Y );
}
}
/* if the submarine is too close from right, put it at left */
if ( submarine_x > WRAP_X )
- submarine_x = SUBMARINE_WIDTH/2.0;
+ submarine_x = SUBMARINE_WIDTH/2.0;
{ /* displayes the submarine */
double r[6],t1[6], t2[6];
@@ -938,35 +970,35 @@ static gboolean update_timeout_slow() {
/* the frigate */
{
- double x1, x2, y1, y2, x;
+ double x1, x2, y1, y2, x;
x = - FRIGATE_SPEED * UPDATE_DELAY_SLOW/1000.0;
- gnome_canvas_item_get_bounds(frigate_item, &x1, &y1, &x2, &y2);
+ gnome_canvas_item_get_bounds(frigate_item, &x1, &y1, &x2, &y2);
gnome_canvas_item_move(frigate_item, - FRIGATE_SPEED * UPDATE_DELAY_SLOW/1000.0, 0.0);
- /* detects a collision betwwen the frigate and the submarine */
+ /* detects a collision between the frigate and the submarine */
if (depth <= 30.0 && !submarine_destroyed)
if ( (submarine_x - SUBMARINE_WIDTH <= x1 && submarine_x >= x2) ||
- (submarine_x - SUBMARINE_WIDTH >= x1 && submarine_x - SUBMARINE_WIDTH <= x2) ||
- (submarine_x >= x1 && submarine_x <= x2) ) {
+ (submarine_x - SUBMARINE_WIDTH >= x1 && submarine_x - SUBMARINE_WIDTH <= x2) ||
+ (submarine_x >= x1 && submarine_x <= x2) ) {
submarine_explosion();
}
/* wraps the destroyer if it reached the left side (and disappeared for a long time)*/
if (x2 < -300.0)
- item_absolute_move( frigate_item, gcomprisBoard->width, y1 );
- }
+ item_absolute_move( frigate_item, gcomprisBoard->width, y1 );
+ }
- /* mine detection */
+ /* whale detection */
{
double dist1, dist2, dist3;
- dist1 = hypot( submarine_x -SUBMARINE_WIDTH/2 -mine_x, depth+SURFACE_IN_BACKGROUND-mine_y);
- dist2 = hypot(submarine_x - SUBMARINE_WIDTH - mine_x, depth+SURFACE_IN_BACKGROUND-mine_y);
- dist3 = hypot(submarine_x - mine_x, depth+SURFACE_IN_BACKGROUND-mine_y);
- /* magnetic detection (dist1) or collision with the mine (dist2 & dist3) */
- if ( (dist1 < MINE_DETECTION_RADIUS || dist2 < MINE_DETECTION_RADIUS ||dist3 < MINE_DETECTION_RADIUS)
- && !submarine_destroyed ) {
- gcompris_play_ogg("explos", NULL);
- gnome_canvas_item_hide(mine);
- //item_absolute_move(big_explosion, mine_x, mine_y);
- gnome_canvas_item_show(big_explosion);
+ dist1 = hypot( submarine_x -SUBMARINE_WIDTH/2 -whale_x, depth+SURFACE_IN_BACKGROUND-whale_y);
+ dist2 = hypot(submarine_x - SUBMARINE_WIDTH - whale_x, depth+SURFACE_IN_BACKGROUND-whale_y);
+ dist3 = hypot(submarine_x - whale_x, depth+SURFACE_IN_BACKGROUND-whale_y);
+ /* magnetic detection (dist1) or collision with the whale (dist2 & dist3) */
+ if ( (dist1 < WHALE_DETECTION_RADIUS || dist2 < WHALE_DETECTION_RADIUS ||dist3 < WHALE_DETECTION_RADIUS)
+ && !submarine_destroyed ) {
+ gcompris_play_ogg("explos", NULL);
+ gnome_canvas_item_hide(whale);
+ //item_absolute_move(big_explosion, whale_x, whale_y);
+ gnome_canvas_item_show(big_explosion);
submarine_explosion();
}
}
@@ -979,53 +1011,53 @@ static gboolean update_timeout_slow() {
static gboolean update_timeout_very_slow() {
/* charging */
if (air_charging && depth < SURFACE_DEPTH+5.0) {
- air += 100.0*UPDATE_DELAY_VERY_SLOW/1000.0;
+ air += 100.0*UPDATE_DELAY_VERY_SLOW/1000.0;
setAir(air);
}
if (battery_charging && depth < SURFACE_DEPTH+5.0) {
- if (battery < 0.3*battery)
- battery += 300.0*UPDATE_DELAY_VERY_SLOW/1000.0;
- else
+ if (battery < 0.3*battery)
+ battery += 300.0*UPDATE_DELAY_VERY_SLOW/1000.0;
+ else
if (battery < 0.6*battery)
- battery += 100.0*UPDATE_DELAY_VERY_SLOW/1000.0;
- else
- if (battery < 0.8*battery)
- battery += 50.0*UPDATE_DELAY_VERY_SLOW/1000.0;
+ battery += 100.0*UPDATE_DELAY_VERY_SLOW/1000.0;
else
- battery += 20.0*UPDATE_DELAY_VERY_SLOW/1000.0;
+ if (battery < 0.8*battery)
+ battery += 50.0*UPDATE_DELAY_VERY_SLOW/1000.0;
+ else
+ battery += 20.0*UPDATE_DELAY_VERY_SLOW/1000.0;
}
/* battery */
- battery -= submarine_horizontal_speed*submarine_horizontal_speed/3.0*UPDATE_DELAY_VERY_SLOW/1000.0;
+ battery -= submarine_horizontal_speed*submarine_horizontal_speed/3.0*UPDATE_DELAY_VERY_SLOW/1000.0;
if (battery < 0.0) {
- battery = 0.0;
- speed_ordered = 0;
+ battery = 0.0;
+ speed_ordered = 0;
setSpeed(speed_ordered);
}
setBattery( battery );
/* bubbling */
- if ( (ballast_av_purge_open && ballast_av_air > 0.0) ||
- ( ballast_av_chasse_open && ballast_av_air == MAX_BALLAST ) ) {
- item_absolute_move( bubbling[0], submarine_x-30.0, depth-50.0);
- gnome_canvas_item_show( bubbling[0] );
- } else
- gnome_canvas_item_hide( bubbling[0] );
-
- if ( (ballast_ar_purge_open && ballast_ar_air > 0.0) ||
- ( ballast_ar_chasse_open && ballast_ar_air == MAX_BALLAST ) ) {
- item_absolute_move( bubbling[2], submarine_x - SUBMARINE_WIDTH , depth-30.0);
- gnome_canvas_item_show( bubbling[2] );
- } else
- gnome_canvas_item_hide( bubbling[2] );
+ if ( (ballast_av_purge_open && ballast_av_air > 0.0) ||
+ ( ballast_av_chasse_open && ballast_av_air == MAX_BALLAST ) ) {
+ item_absolute_move( bubbling[0], submarine_x-30.0, depth-50.0);
+ gnome_canvas_item_show( bubbling[0] );
+ } else
+ gnome_canvas_item_hide( bubbling[0] );
+
+ if ( (ballast_ar_purge_open && ballast_ar_air > 0.0) ||
+ ( ballast_ar_chasse_open && ballast_ar_air == MAX_BALLAST ) ) {
+ item_absolute_move( bubbling[2], submarine_x - SUBMARINE_WIDTH , depth-30.0);
+ gnome_canvas_item_show( bubbling[2] );
+ } else
+ gnome_canvas_item_hide( bubbling[2] );
if (regleur_purge_open && regleur < MAX_REGLEUR) {
- item_absolute_move( bubbling[1], submarine_x - SUBMARINE_WIDTH/2 -30.0, depth-30.0);
- gnome_canvas_item_show( bubbling[1] );
- } else
- gnome_canvas_item_hide( bubbling[1] );
+ item_absolute_move( bubbling[1], submarine_x - SUBMARINE_WIDTH/2 -30.0, depth-30.0);
+ gnome_canvas_item_show( bubbling[1] );
+ } else
+ gnome_canvas_item_hide( bubbling[1] );
return TRUE;
}
@@ -1039,9 +1071,9 @@ static void game_won() {
gcomprisBoard->sublevel=1;
gcomprisBoard->level++;
if(gcomprisBoard->level>gcomprisBoard->maxlevel) { // the current board is finished : bail out
- board_finished(BOARD_FINISHED_TUXLOCO);
- return;
- }
+ board_finished(BOARD_FINISHED_TUXLOCO);
+ return;
+ }
}
submarine_next_level();
}
@@ -1060,7 +1092,7 @@ static gboolean ok_timeout() {
}
static void ok() {
- // leave time to display the right answer
+ // leave time to display the right answer
g_timeout_add(TIME_CLICK_TO_BONUS, ok_timeout, NULL);
}
@@ -1068,18 +1100,18 @@ static void ok() {
* ballast_av_purge_event
* =====================================================================*/
static gint ballast_av_purge_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- if(board_paused)
+ if(board_paused)
return FALSE;
switch (event->type)
{
case GDK_BUTTON_PRESS:
- ballast_av_purge_open = !ballast_av_purge_open;
+ ballast_av_purge_open = !ballast_av_purge_open;
if (ballast_av_purge_open)
- item_rotate(item, 90.0);
- else
- item_rotate(item, 0.0);
- break;
+ item_rotate(item, 90.0);
+ else
+ item_rotate(item, 0.0);
+ break;
default:
break;
@@ -1091,18 +1123,18 @@ static gint ballast_av_purge_event(GnomeCanvasItem *item, GdkEvent *event, gpoin
* ballast_ar_purge_event
* =====================================================================*/
static gint ballast_ar_purge_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- if(board_paused)
+ if(board_paused)
return FALSE;
switch (event->type)
{
case GDK_BUTTON_PRESS:
- ballast_ar_purge_open = !ballast_ar_purge_open;
+ ballast_ar_purge_open = !ballast_ar_purge_open;
if (ballast_ar_purge_open)
- item_rotate(item, 90.0);
- else
- item_rotate(item, 0.0);
- break;
+ item_rotate(item, 90.0);
+ else
+ item_rotate(item, 0.0);
+ break;
default:
break;
@@ -1113,18 +1145,18 @@ static gint ballast_ar_purge_event(GnomeCanvasItem *item, GdkEvent *event, gpoin
* regleur_purge_event
* =====================================================================*/
static gint regleur_purge_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- if(board_paused)
+ if(board_paused)
return FALSE;
switch (event->type)
{
case GDK_BUTTON_PRESS:
- regleur_purge_open = !regleur_purge_open;
+ regleur_purge_open = !regleur_purge_open;
if (regleur_purge_open)
- item_rotate(item, 90.0);
- else
- item_rotate(item, 0.0);
- break;
+ item_rotate(item, 90.0);
+ else
+ item_rotate(item, 0.0);
+ break;
default:
break;
@@ -1135,18 +1167,18 @@ static gint regleur_purge_event(GnomeCanvasItem *item, GdkEvent *event, gpointer
* ballast_ar_chasse_event
* =====================================================================*/
static gint ballast_ar_chasse_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- if(board_paused)
+ if(board_paused)
return FALSE;
switch (event->type)
{
case GDK_BUTTON_PRESS:
- ballast_ar_chasse_open = !ballast_ar_chasse_open;
+ ballast_ar_chasse_open = !ballast_ar_chasse_open;
if (ballast_ar_chasse_open)
- item_rotate(item, 90.0);
- else
- item_rotate(item, 0.0);
- break;
+ item_rotate(item, 90.0);
+ else
+ item_rotate(item, 0.0);
+ break;
default:
break;
@@ -1157,18 +1189,18 @@ static gint ballast_ar_chasse_event(GnomeCanvasItem *item, GdkEvent *event, gpoi
* ballast_av_chasse_event
* =====================================================================*/
static gint ballast_av_chasse_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- if(board_paused)
+ if(board_paused)
return FALSE;
switch (event->type)
{
case GDK_BUTTON_PRESS:
- ballast_av_chasse_open = !ballast_av_chasse_open;
+ ballast_av_chasse_open = !ballast_av_chasse_open;
if (ballast_av_chasse_open)
- item_rotate(item, 90.0);
- else
- item_rotate(item, 0.0);
- break;
+ item_rotate(item, 90.0);
+ else
+ item_rotate(item, 0.0);
+ break;
default:
break;
@@ -1179,18 +1211,18 @@ static gint ballast_av_chasse_event(GnomeCanvasItem *item, GdkEvent *event, gpoi
*
* =====================================================================*/
static gint regleur_chasse_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- if(board_paused)
+ if(board_paused)
return FALSE;
switch (event->type)
{
case GDK_BUTTON_PRESS:
- regleur_chasse_open = !regleur_chasse_open;
+ regleur_chasse_open = !regleur_chasse_open;
if (regleur_chasse_open)
- item_rotate(item, 90.0);
- else
- item_rotate(item, 0.0);
- break;
+ item_rotate(item, 90.0);
+ else
+ item_rotate(item, 0.0);
+ break;
default:
break;
@@ -1202,22 +1234,22 @@ static gint regleur_chasse_event(GnomeCanvasItem *item, GdkEvent *event, gpointe
* barre_av_event
* =====================================================================*/
static gint barre_av_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- int d = GPOINTER_TO_INT(data);
- if(board_paused)
+ int d = GPOINTER_TO_INT(data);
+ if(board_paused)
return FALSE;
switch (event->type)
{
case GDK_BUTTON_PRESS:
- if (d == UP && barre_av_angle < RUDDER_MAX) {
+ if (d == UP && barre_av_angle < RUDDER_MAX) {
barre_av_angle += RUDDER_STEP;
item_rotate_with_center( barre_av_item, barre_av_angle,RUDDER_CENTER_X,RUDDER_CENTER_Y);
}
- if (d == DOWN && barre_av_angle > -RUDDER_MAX) {
+ if (d == DOWN && barre_av_angle > -RUDDER_MAX) {
barre_av_angle -= RUDDER_STEP;
item_rotate_with_center( barre_av_item, barre_av_angle,RUDDER_CENTER_X,RUDDER_CENTER_Y);
}
- break;
+ break;
default:
break;
@@ -1228,7 +1260,7 @@ static gint barre_av_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data
* barre_ar_event
* =====================================================================*/
static gint barre_ar_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- int d = GPOINTER_TO_INT(data);
+ int d = GPOINTER_TO_INT(data);
if(board_paused)
return FALSE;
@@ -1236,15 +1268,15 @@ static gint barre_ar_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data
switch (event->type)
{
case GDK_BUTTON_PRESS:
- if (d == UP && barre_ar_angle < RUDDER_MAX) {
+ if (d == UP && barre_ar_angle < RUDDER_MAX) {
barre_ar_angle += RUDDER_STEP;
item_rotate_with_center( barre_ar_item, barre_ar_angle,RUDDER_CENTER_X,RUDDER_CENTER_Y);
}
- if (d == DOWN && barre_ar_angle > -RUDDER_MAX) {
+ if (d == DOWN && barre_ar_angle > -RUDDER_MAX) {
barre_ar_angle -= RUDDER_STEP;
item_rotate_with_center( barre_ar_item, barre_ar_angle,RUDDER_CENTER_X,RUDDER_CENTER_Y);
}
- break;
+ break;
default:
break;
@@ -1255,7 +1287,7 @@ static gint barre_ar_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data
* engine_event
* =====================================================================*/
static gint engine_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) {
- int d = GPOINTER_TO_INT(data);
+ int d = GPOINTER_TO_INT(data);
if(board_paused)
return FALSE;
@@ -1263,18 +1295,18 @@ static gint engine_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
switch (event->type)
{
case GDK_BUTTON_PRESS:
- if (d == UP) {
+ if (d == UP) {
speed_ordered += SPEED_STEP;
}
- if (d == DOWN) {
+ if (d == DOWN) {
speed_ordered -= SPEED_STEP;
}
if (speed_ordered > SPEED_MAX)
- speed_ordered = SPEED_MAX;
- if (speed_ordered < 0)
+ speed_ordered = SPEED_MAX;
+ if (speed_ordered < 0)
speed_ordered = 0;
setSpeed(speed_ordered);
- break;
+ break;
default:
break;
@@ -1290,12 +1322,12 @@ static gint air_compressor_event(GnomeCanvasItem *item, GdkEvent *event, gpointe
switch (event->type)
{
case GDK_BUTTON_PRESS:
- if (air_charging)
+ if (air_charging)
air_charging = FALSE;
- else
- air_charging = TRUE;
+ else
+ air_charging = TRUE;
item_rotate_with_center(item, air_charging ? 180 : 0 , TRIGGER_CENTER_X, TRIGGER_CENTER_Y );
- break;
+ break;
default:
break;
@@ -1311,12 +1343,12 @@ static gint battery_charger_event(GnomeCanvasItem *item, GdkEvent *event, gpoint
switch (event->type)
{
case GDK_BUTTON_PRESS:
- if (battery_charging)
+ if (battery_charging)
battery_charging = FALSE;
- else
- battery_charging = TRUE;
+ else
+ battery_charging = TRUE;
item_rotate_with_center(item, battery_charging ? 180 : 0 , TRIGGER_CENTER_X, TRIGGER_CENTER_Y );
- break;
+ break;
default:
break;
@@ -1327,44 +1359,66 @@ static gint battery_charger_event(GnomeCanvasItem *item, GdkEvent *event, gpoint
* Helper functions to update the graphical display
* =====================================================================*/
static void setSpeed(double value) {
- char s12[12];
+ char s12[12];
sprintf(s12,"%d",(int)value);
- gnome_canvas_item_set(speed_item_back, "text", s12, NULL);
- gnome_canvas_item_set(speed_item_front, "text", s12, NULL);
+ gnome_canvas_item_set(speed_item_back, "text", s12, NULL);
+ gnome_canvas_item_set(speed_item_front, "text", s12, NULL);
}
static void setBattery(double value) {
- char s12[12];
+ char s12[12];
sprintf(s12,"%d",(int)value);
- gnome_canvas_item_set(battery_item_back, "text", s12, NULL);
- gnome_canvas_item_set(battery_item_front, "text", s12, NULL);
+ gnome_canvas_item_set(battery_item_back, "text", s12, NULL);
+ gnome_canvas_item_set(battery_item_front, "text", s12, NULL);
}
static void setAir(double value) {
- char s12[12];
+ char s12[12];
sprintf(s12,"%d",(int)value);
- gnome_canvas_item_set(air_item_back, "text", s12, NULL);
- gnome_canvas_item_set(air_item_front, "text", s12, NULL);
+ gnome_canvas_item_set(air_item_back, "text", s12, NULL);
+ gnome_canvas_item_set(air_item_front, "text", s12, NULL);
}
static void setRegleur(double value) {
- char s12[12];
+ char s12[12];
sprintf(s12,"%d",(int)value);
- gnome_canvas_item_set(regleur_item_back, "text", s12, NULL);
- gnome_canvas_item_set(regleur_item_front, "text", s12, NULL);
+ gnome_canvas_item_set(regleur_item_back, "text", s12, NULL);
+ gnome_canvas_item_set(regleur_item_front, "text", s12, NULL);
+}
+static void setBallastAV(double value) {
+ char s12[12];
+ sprintf(s12,"%d",(int)value);
+ gnome_canvas_item_set(ballast_av_air_item_back, "text", s12, NULL);
+ gnome_canvas_item_set(ballast_av_air_item_front, "text", s12, NULL);
+}
+static void setBallastAR(double value) {
+ char s12[12];
+ sprintf(s12,"%d",(int)value);
+ gnome_canvas_item_set(ballast_ar_air_item_back, "text", s12, NULL);
+ gnome_canvas_item_set(ballast_ar_air_item_front, "text", s12, NULL);
}
/* =====================================================================
* Submarine explosion
* =====================================================================*/
static void submarine_explosion() {
+ GdkPixbuf *pixmap = NULL;
+ char *str = NULL;
+
submarine_destroyed = TRUE;
gamewon = FALSE;
- gcompris_play_ogg("explos", NULL);
+ gcompris_play_ogg("explos", NULL);
/* make the submarine die */
setSpeed(speed_ordered = submarine_horizontal_speed = 0.0);
setBattery(battery = 0.0);
setAir(air = 0.0);
regleur = MAX_REGLEUR;
weight = 2000.0;
- /* display the explosion */
- item_absolute_move( explosion[0], submarine_x - SUBMARINE_WIDTH/2 -30.0, depth-30.0 );
- gnome_canvas_item_show(explosion[0]);
+
+ /* display the boken submarine */
+ str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "submarine-broken.png");
+ pixmap = gcompris_load_pixmap(str);
+ gnome_canvas_item_set(submarine_item,
+ "pixbuf", pixmap,
+ NULL);
+ g_free(str);
+ gdk_pixbuf_unref(pixmap);
+
ok();
}
diff --git a/src/libassetml/.cvsignore b/src/libassetml/.cvsignore
index 2f6c4a6..90d47df 100644
--- a/src/libassetml/.cvsignore
+++ b/src/libassetml/.cvsignore
@@ -1,5 +1,6 @@
*.la
*.lo
+*.pc
.deps
.exrc
.libs
diff --git a/src/libassetml/assetml.h b/src/libassetml/assetml.h
index 5433649..deb538a 100644
--- a/src/libassetml/assetml.h
+++ b/src/libassetml/assetml.h
@@ -24,7 +24,8 @@
/* Returns a list of AssetML struct
dataset: the name of the dataset, NULL for ANY dataset
- categories: a list of categorie columns ';' separated
+ categories: a list of categorie columns ';' separated (NULL for all)
+ mimetype: an official mimetype describing the content (NULL for all)
name: the asset name to get or NULL for any name
*/
diff --git a/src/libassetml/tools/assetml-query.c b/src/libassetml/tools/assetml-query.c
index 739b17f..0355a04 100755
--- a/src/libassetml/tools/assetml-query.c
+++ b/src/libassetml/tools/assetml-query.c
@@ -40,7 +40,7 @@ void dump_asset(AssetML *assetml);
/****************************************************************************/
/* Command line params */
-/*** gcompris-popttable */
+/*** assetml-query-popttable */
static gchar *dataset = NULL;
static gchar *name = NULL;
static gchar *categories = NULL;
@@ -57,7 +57,7 @@ static struct poptOption options[] = {
{"mimetype", 'm', POPT_ARG_STRING, &mimetype, 0,
N_("Specify a mimetype to search in (eg: image/png)"), NULL},
{"version", '\0', POPT_ARG_NONE, &showVersion, 0,
- N_("Prints the version of " PACKAGE), NULL},
+ N_("Prints the version of assetml-query"), NULL},
POPT_AUTOHELP
{
NULL,