[Xbubble-commits] xbubble-sdl/src board.c, 1.2, 1.3 board.h, 1.2, 1.3 bubble.c, 1.2, 1.3 bubble.h, 1.1.1.1, 1.2 cell.c, 1.2, 1.3 cell.h, 1.2, 1.3 frame.c, 1.1.1.1, 1.2 path_init.c, 1.2, 1.3 setting.h, 1.2, 1.3 theme.c, 1.1.1.1, 1.2 xbubble.c, 1.2, 1.3

Martin Quinson mquinson at alioth.debian.org
Mon Sep 11 21:33:21 UTC 2006


Update of /cvsroot/xbubble/xbubble-sdl/src
In directory haydn:/tmp/cvs-serv29452

Modified Files:
	board.c board.h bubble.c bubble.h cell.c cell.h frame.c 
	path_init.c setting.h theme.c xbubble.c 
Log Message:
Getting closer: bubbles seem to work, but canon don't move yet

Index: bubble.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/bubble.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- bubble.h	11 Aug 2006 12:14:40 -0000	1.1.1.1
+++ bubble.h	11 Sep 2006 21:33:19 -0000	1.2
@@ -23,11 +23,7 @@
 		     board_t board );
 void bubble_free( bubble_t bubble );
 void bubble_set_state( bubble_t bubble,enum e_bubble_state state, int layer, int c);
-void bubble_set_pos( bubble_t bubble, board_t board, double x, double y );
-#define bubble_x(bubble,board)         (bubble)->x - (board)->offset.x
-#define bubble_y(bubble,board)         (bubble)->y - (board)->offset.x
-#define bubble_set_x(bubble,board,val) (bubble)->x = (val) + (board)->offset.x
-#define bubble_set_y(bubble,board,val) (bubble)->y = (val) + (board)->offset.x
+void bubble_set_pos( bubble_t bubble, board_t board, double sx, double sy );
 void bubble_update_sprite(bubble_t bubble, board_t board);
 
 

Index: path_init.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/path_init.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- path_init.c	11 Sep 2006 19:54:09 -0000	1.2
+++ path_init.c	11 Sep 2006 21:33:19 -0000	1.3
@@ -217,7 +217,7 @@
 		 We now check if A will intersect our bubble (let's call it 'M').
 	       
 		 let's compute ( xa, ya ) = location of bubble A */
-	      cell_center( ca, col + cell, &xa, &ya );
+	      cell_screen_coord( ca, col + cell, &xa, &ya );
 	      if (debug>1) fprintf(stderr,"%d (%.1f;%.1f)=>",col+cell,xa,ya);
 	      
 	      /* dot product: used to check if bubble M is approaching

Index: theme.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/theme.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- theme.c	11 Aug 2006 12:14:43 -0000	1.1.1.1
+++ theme.c	11 Sep 2006 21:33:19 -0000	1.2
@@ -15,24 +15,6 @@
 #include "theme.h"
 #define ROW_HEIGHT     0.8660254037844386 /* sqrt(3)/2 */
 
-#if 0
-struct _theme {
-  const char*name; /* path to theme dir under "theme/" */
-
-  /* various animations */
-  Set alert_a;
-  Set canon_a;
-  Set countdown_a;
-  Set cup_a;
-  Set bubble_a[NB_COLORS][NB_BUBBLE_STATES];
-
-  /* Static pixmap: background+borders */
-  SDL_Surface *background;
-
-  short window_title;/* whether the windows have a title */
-};
-#endif
-
 const char *game_fonts[] = FONTS;
 int titlefont_color[3] = TITLEFONT_COLOR;
 int menufont_color[3] = MENUFONT_COLOR;
@@ -117,7 +99,7 @@
   frame = frame_load("canon.png",theme->name,zoom);
   for ( i = -CANON_ANGLE_MAX; i <= CANON_ANGLE_MAX; i++ ) {
     set_add( theme->canon_a, 
-	     frame_new(rotozoomSurface(frame->surf, -i*ANGLE_STEP, 1, 1),
+	     frame_new(rotozoomSurface(frame->surf, -i*ANGLE_STEP, 1, 0),
 		       "canon", 0)
 	     );
   }

Index: bubble.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/bubble.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- bubble.c	11 Sep 2006 19:54:09 -0000	1.2
+++ bubble.c	11 Sep 2006 21:33:19 -0000	1.3
@@ -58,26 +58,12 @@
 }
 
 void bubble_update_sprite(bubble_t bubble,board_t board) {
-  /*
-  DEBUG("bubble_update_sprite %f %f %d %d",
-       scale_x(bubble->x, board->scale),
-       scale_y(bubble->y, board->scale),
-       (int)scale_x(bubble->x, board->scale),
-       (int)scale_y(bubble->y, board->scale) );
-  */   
-  sprite_set_pos( bubble->sprite, board2screen(bubble->x, bubble->y, board));
+  sprite_set_pos( bubble->sprite, bubble->x, bubble->y);
 }
 
-void bubble_set_pos( bubble_t bubble, board_t board, double x, double y ) {
-  bubble->x = x;
-  bubble->y = y;
-  /*
-  DEBUG("bubble %p of board %p (sprite=%p) go to %f %f corrected to %f %f (off=%d %d)",
-	bubble,board,bubble->sprite,
-	x,y,
-	bubble->x, bubble->y,
-	board->offset.x,board->offset.y);
-  */
+void bubble_set_pos( bubble_t bubble, board_t board, double sx, double sy ) {
+  bubble->x = sx;
+  bubble->y = sy;
   bubble_update_sprite(bubble,board);
 }
 

Index: frame.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/frame.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- frame.c	11 Aug 2006 12:14:41 -0000	1.1.1.1
+++ frame.c	11 Sep 2006 21:33:19 -0000	1.2
@@ -36,9 +36,9 @@
     fail (_("Unable to read %s: %s"), file, sdl_error);
 
   /* Zoom it */
-  if (zoom/DEFAULT_SCALE != 1) {
+  if (zoom/MAX_SCALE != 1) {
     zoomed = zoomSurface(raw, 
-			 zoom/DEFAULT_SCALE, zoom/DEFAULT_SCALE, 
+			 zoom/MAX_SCALE, zoom/MAX_SCALE, 
 			 SMOOTHING_ON);
     SDL_FreeSurface(raw);
   } else {

Index: xbubble.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/xbubble.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xbubble.c	11 Sep 2006 19:54:09 -0000	1.2
+++ xbubble.c	11 Sep 2006 21:33:19 -0000	1.3
@@ -10,7 +10,7 @@
 unsigned long frame_duration=20;
 SDL_Surface *screen;
 int main(int argc, char *argv[]) {
-  int zoom = DEFAULT_SCALE;
+  int zoom = MAX_SCALE;
   int MAX_X = game_win_width(zoom);
   int MAX_Y = game_win_height(zoom);
    
@@ -19,7 +19,8 @@
    
   screen = window_make(MAX_X,MAX_Y);
   DEBUG("MAX_X=%d MAX_Y=%d",MAX_X,MAX_Y);
-  theme_t *theme = theme_init("small",zoom);
+
+  theme_t *theme = theme_init("fancy",zoom);
   levels_t levels = levels_load("levels_empty.txt");
   ruleset_t ruleset = DEFAULT_RULE_SET;
   game_t game = game_new(game_mode_single, &ruleset, theme, zoom, 

Index: cell.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/cell.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cell.c	11 Sep 2006 19:54:09 -0000	1.2
+++ cell.c	11 Sep 2006 21:33:19 -0000	1.3
@@ -183,24 +183,17 @@
      ca->neighbor[cell][NORTH_WEST] = cellCL( ca, row-1, column+shift-1 );
      ca->neighbor[cell][SOUTH_WEST] = cellCL( ca, row+1, column+shift-1 );
 
-     ca->sx[cell] = (column + 0.5*(1 - row_start(ca, row))) * ca->scale + ca->offx;
+     ca->sx[cell] = (column + 0.5*shift) * ca->scale + ca->offx;
      ca->sy[cell] = (row*ROW_HEIGHT + 0.5) * ca->scale + ca->offy;
   }
 }
 
 #define neighbor_cell(ca,cell,quadrant) (ca->neighbor[cell][quadrant])
-   
-void cell_center( CellArray ca, int cell, double *x, double *y) {
-  int column, row;
-  row = cell / COLS;
-  column = cell % COLS;
-  *x = (column + 0.5*(1 - row_start(ca, row))) * DEFAULT_SCALE  ;
-  *y = (row*ROW_HEIGHT + 0.5) * DEFAULT_SCALE;
-}
 
-void cell_screen_coord( CellArray ca, int cell, double *x, double *y) {
-  *x = ca->sx[cell];
-  *y = ca->sy[cell];
+/* Return screen coordinates (FIXME: precompute it) */   
+void cell_screen_coord( CellArray ca, int cell, double *sx, double *sy) {
+  *sx = ca->sx[cell];
+  *sy = ca->sy[cell];
 }
 
 int floating_cell( CellArray ca, int cell ) {

Index: board.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/board.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- board.h	11 Sep 2006 19:54:09 -0000	1.2
+++ board.h	11 Sep 2006 21:33:19 -0000	1.3
@@ -13,7 +13,7 @@
   int single;         /* single player? (ie, new bubble color must be already there */
 } ruleset_t;
 
-#define DEFAULT_RULE_SET { 1, 5000, 1, 1 }
+#define DEFAULT_RULE_SET { 1, COUNTDOWN, 1, 1 }
 
 enum e_board_state {
   board_state_waiting_for_canon,
@@ -85,6 +85,9 @@
   double alert_x,alert_y; /* alert sign */
   double canon_x,canon_y; /* canon */
   double countdown_x,countdown_y;
+
+  /* borders locations */
+  double left_border,right_border,top_border,bottom_border;
 };
 
 

Index: setting.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/setting.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- setting.h	11 Sep 2006 19:54:09 -0000	1.2
+++ setting.h	11 Sep 2006 21:33:19 -0000	1.3
@@ -24,8 +24,8 @@
 
 //#define board2screen_x(X,board) (X+OFFSET_X)*(board->scale)+board->offset.x
 //#define board2screen_y(Y,board) (Y+OFFSET_Y)*(board->scale)+board->offset.y
-#define board2screen_x(X,board) (X)*(board->scale)+board->offset.x
-#define board2screen_y(Y,board) (Y)*(board->scale)+board->offset.y
+#define board2screen_x(X,board) ((X)*(board->scale)+board->offset.x)
+#define board2screen_y(Y,board) ((Y)*(board->scale)+board->offset.y)
 #define board2screen(X,Y,board) board2screen_x(X,board), board2screen_y(Y,board)
 
 #define board_win_width(S)   (2 * OFFSET_X + BOARD_WIDTH) * S
@@ -46,14 +46,15 @@
 #define CANON_ROTATING_SPEED ( 1/50.0 )
 
 /* bubble speeds in cells/ms */
-#define LAUNCHING_SPEED      0.02     /* velocity of launched bubbles */
-#define EXPLODING_SPEED      0.0003   /* vertical velocity after explosion */
-#define RISING_SPEED         0.04     /* velocity of incoming bubbles */
-#define GRAVITY              0.00003  /* gravity in cell.ms^-2 */
+#define SPEEDFACTOR  10
+#define LAUNCHING_SPEED      0.02*SPEEDFACTOR     /* velocity of launched bubbles */
+#define EXPLODING_SPEED      0.0003*SPEEDFACTOR   /* vertical velocity after explosion */
+#define RISING_SPEED         0.04*SPEEDFACTOR     /* velocity of incoming bubbles */
+#define GRAVITY              0.00003*SPEEDFACTOR  /* gravity in cell.ms^-2 */
 
 /* times in milliseconds */
 #define PROPAGATION_TIME     15       /* explosion propagation time */
-#define CANON_LOAD_TIME      500
+#define CANON_LOAD_TIME      400
 #define COUNTDOWN            5000
 #define DEFAULT_HANDICAP     7000
 #define SLOW_BLINKING        250      /* blinking light period */

Index: cell.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/cell.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cell.h	11 Sep 2006 19:54:09 -0000	1.2
+++ cell.h	11 Sep 2006 21:33:19 -0000	1.3
@@ -61,8 +61,7 @@
 
 int cellCL( CellArray ca, int row, int col );
 int floating_cell( CellArray ca, int c );
-void cell_center( CellArray ca, int cell, double *x, double *y);
-void cell_screen_coord( CellArray ca, int cell, double *x, double *y);
+void cell_screen_coord( CellArray ca, int cell, double *sx, double *sy);
 int find_target_cell( CellArray ca, 
 		      int angle, 
 		      double * target_y,

Index: board.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/board.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- board.c	11 Sep 2006 19:54:09 -0000	1.2
+++ board.c	11 Sep 2006 21:33:19 -0000	1.3
@@ -100,8 +100,7 @@
   bubble_t bubble;
 
   board_t board = (board_t) xmalloc( sizeof( struct _board ));
-  board->array = cell_array_new( mov_ceiling, board->scale,
-				 board->offset.x, board->offset.y );
+  board->array = cell_array_new( mov_ceiling, scale, offset->x, offset->y );
   board->bubbles = set_new( 2*NB_CELLS );
   board->tmpset = set_new( 2*NB_CELLS );
   board->sprite_pool = sprite_pool_new( TOP_LAYER+1, 2*NB_CELLS, theme );
@@ -118,7 +117,8 @@
   board->offset.x = offset->x;
   board->offset.y = offset->y; 
 
-  board->scale = scale/DEFAULT_SCALE;
+  board->scale = scale;
+  /*  board->zoom = scale/DEFAULT_SCALE; */
   board->period = period;
   board->nb_rising_bubbles = 0;
   board->placed_balls = vector_new( 10 );
@@ -145,6 +145,12 @@
   board->countdown_x=board2screen_x( 1.3, board);
   board->countdown_y=board->new_y - 1.3*board->scale;
 
+  /* border locations */
+  board->left_border = board2screen_x(0.5, board);
+  board->right_border = board2screen_x(COLS-0.5, board);
+  board->top_border = board2screen_y(0.5 + board->array->first_row*ROW_HEIGHT, board);
+  board->bottom_border = board2screen_y(BOARD_HEIGHT - 0.5, board);
+
   /* alert blinking light */
   board->alert = sprite_new( BOTTOM_LAYER, 30, theme->alert_a, 0, 0);
   sprite_set_pos( board->alert, board->alert_x, board->alert_y );
@@ -164,7 +170,8 @@
   board->canon_angle = 0;
   board->canon_virtual_angle = 0.0;
   board->canon_direction = 0;
-  board->canon_sprite = sprite_new( CANON_LAYER, 30, theme->canon_a, 0, 0);
+  board->canon_sprite = sprite_new( CANON_LAYER, 30, theme->canon_a, 
+				    board->canon_x, board->canon_y);
   sprite_pool_add( board->sprite_pool, board->canon_sprite );
   canon_move( board, 0);
 
@@ -342,11 +349,10 @@
 }
 
 void board_stick_bubble( board_t board, bubble_t bubble, int target) {
-  double x, y;
-  cell_center( board->array, target, &x, &y );
+  double sx, sy;
+  cell_screen_coord( board->array, target, &sx, &sy );
   bubble_set_state( bubble, STUCK, BOTTOM_LAYER, 0);
-  DEBUG("stick %f %f",x,y);
-  bubble_set_pos( bubble, board, x, y );
+  bubble_set_pos( bubble, board, sx, sy );
   bubble->cell = target;
   board->array->cell[target] = bubble;
 }
@@ -388,21 +394,25 @@
     switch ( bubble->state ) {
 
     case NEW:
-      DEBUG("New bubble: %p (%s) clock=%d/%d pos=%.2f %.2f speed=%.2f %.2f",bubble,
+      /*
+      DEBUG("New bubble: %p (%s) clock=%d/%d (%f%%) pos=%.2f %.2f",bubble,
 	    ((board->canon_empty)?"canon empty":"canon full"),
 	    bubble->clock,CANON_LOAD_TIME,
-	    bubble->x,bubble->y,bubble->vx,bubble->vy);
+	    ((double)bubble->clock)/((double)CANON_LOAD_TIME),
+	    bubble->x,bubble->y);
+      */
       sprite_inc_clock( bubble->sprite, dt );
       if ( board->canon_empty ) {
 	/* compute new position of bubble */
-	t = bubble->clock/CANON_LOAD_TIME;
-	/* FIXME: elliptic trajectory to fixup
+	t = ((double)bubble->clock)/((double)CANON_LOAD_TIME);
+	/* FIXME: elliptic trajectory to fixup */
        	x = board->canon_x - ( board->canon_x - board->new_x ) * cos(t*M_PI/2);
 	y = board->new_y + ( board->canon_y - board->new_y )*sin(t*M_PI/2);
-	For now, linear trajectory
-	*/
+	/*For now, linear trajectory
+	
 	x = board->canon_x + ( board->canon_x - board->new_x ) * t;
 	y = board->canon_y + ( board->canon_y - board->new_y ) * t;
+	*/
 	bubble_set_pos( bubble, board, x, y );
 	bubble->clock += dt;
 	
@@ -413,7 +423,7 @@
 	  board->canon_empty = 0;
 	  /* add a new bubble */
 	  board->next_color = bubble_next_color( board );
-	  //	  board_new_bubble( board, board->next_color );
+	  board_new_bubble( board, board->next_color );
 	  start_countdown(board);
 	}
       }
@@ -455,21 +465,17 @@
       /* move bubble */
       bubble->x += dt*bubble->vx;
       bubble->y += dt*bubble->vy;
-      if (bubble->vx || bubble->vy) 
+      if ((bubble->vx || bubble->vy) && rnd(10)==1) 
 	DEBUG("bubble->x=%f ; bubble->y=%f <> %f (target=%d->y=%f)", 
 	      bubble->x, bubble->y, 0.5*board->scale + board->offset.y,
-	      bubble->cell,bubble->target_y);
+	      bubble->cell, bubble->target_y);
       /* bounce bubble against walls */
-      if ( bubble_x(bubble,board) < 0.5 ) {
-//	bubble_set_x(bubble,board,
-// 	             1 - bubble_x(bubble,board));
-//That is the other solution to stay inside. If you use it, change also cell.c
-	bubble_set_x(bubble,board,0.5);
+      if ( bubble->x < board->left_border ) {
+	bubble->x = board->left_border;
 	bubble->vx = -bubble->vx;
       }
-      if ( bubble_x( bubble, board) > COLS - 0.5 ) {
-	bubble_set_x(bubble,board, COLS - 0.5);
-//      bubble_set_x(bubble,board, 2*COLS - 1.0 - bubble_x(bubble,board));
+      if ( bubble->x > board->right_border ) {
+	bubble->x = board->right_border;
 	bubble->vx = -bubble->vx;
       }
       /* check if bubble has reached its target cell */
@@ -545,40 +551,37 @@
       bubble->y += dt*bubble->vy + 0.5*GRAVITY*dt*dt;
       bubble->vy += dt*GRAVITY;
       /* bounce bubble against walls */
-      while (    bubble_x(bubble,board) < 0.5 
-	      || bubble_x(bubble,board) > COLS - 0.5001 ) { 
+      while (    bubble->x < board->left_border 
+	      || bubble->x > board->left_border ) { 
 	/* explosions can be quite violente, thus the while */
 	    
-	 if ( bubble_x(bubble,board) < 0.5 ) {
-	    bubble_set_x(bubble,board, 
-			 1.0 - bubble_x(bubble,board));
-	    bubble->vx = -bubble->vx*.8; 
-	    /* Falling balls do not elasticly bounce against walls :) */
-	 }
-	 if ( bubble_x(bubble,board) > COLS - 0.5001 ) {
-	    bubble_set_x(bubble,board, 
-			 2*COLS - 1.0002 - bubble_x(bubble,board));
-	    bubble->vx = -bubble->vx*.8; 
-	 }
+	if ( bubble->x < board->left_border ) {
+	  bubble->x = 2*board->left_border-bubble->x;
+	  bubble->vx = -bubble->vx*.8; 
+	  /* Falling balls do not elasticly bounce against walls :) */
+	}
+	if ( bubble->x > board->right_border ) {
+	  bubble->x = 2*board->right_border - bubble->x;
+	  bubble->vx = -bubble->vx*.8; 
+	}
       }
-      if (bubble_y(bubble,board) < ( 0.5 + board->array->first_row*ROW_HEIGHT )) { /* bounce against the upper wall */
-	 bubble->y -= board->array->first_row*ROW_HEIGHT;
-	 bubble_set_y(bubble,board, 
-		      1.0 - bubble_y(bubble,board));
-	 bubble->y += board->array->first_row*ROW_HEIGHT;
-	 bubble->vy = -bubble->vy*.8; 
+      if (bubble->y < board->top_border ) {
+	bubble->y = 2*(board->top_border)-bubble->y;
+	bubble->vy = -bubble->vy*.8; 
       }
 
-      bubble_update_sprite( bubble, board );
-      sprite_inc_clock( bubble->sprite, dt );
-       
       /* detect runaway bubbles */
-      if ( bubble_y(bubble,board) > BOARD_HEIGHT - 0.5 ) {
+      if ( bubble->y > board->bottom_border) {
 	/* send bubble to opponent */
 	if ( bubble->state == FALLING )
 	  vector_push( board->output, bubble->color );
 	kill_bubble( board, bubble );
       }
+
+      /* display the result */
+      bubble_update_sprite( bubble, board );
+      sprite_inc_clock( bubble->sprite, dt );
+       
       break;
       
     case RISING:
@@ -588,7 +591,7 @@
 		      bubble->y + dt*bubble->vy );
       sprite_inc_clock( bubble->sprite, dt );
       /* check if bubble has reached its target cell */
-      if ( bubble_y(bubble,board) <= cell_y( bubble->cell )) {
+      if ( bubble->y  <= bubble->target_y) {
 	board_stick_bubble( board, bubble, bubble->cell);
 	bubble_set_state( bubble, STUCK, TOP_LAYER, 0 );
 	board->nb_rising_bubbles--;
@@ -644,11 +647,12 @@
       /* create rising bubble */
       bubble = board_new_bubble( board, color);
       bubble_set_state( bubble, RISING, TOP_LAYER, 0);
-      cell_center( board->array, target_cell, &x, &y);
+      cell_screen_coord( board->array, target_cell, &x, &y);
       bubble_set_pos( bubble, board, x, BOARD_HEIGHT - 0.5);
       bubble->vx = 0;
       bubble->vy = -RISING_SPEED;
       bubble->cell = target_cell;
+      bubble->target_y = y;
       board->nb_rising_bubbles++;
       /* lock cell to avoid 2 bubbles having the same target */
       board->array->cell[target_cell] = bubble;
@@ -708,13 +712,13 @@
   for (i=0; i<board->malus_indicators10->size; i++) {
      double x,y;
      bubble=board->malus_indicators10->element[i];
-     cell_center( board->array, cellCL(board->array, -1, i+1), &x, &y);
+     cell_screen_coord( board->array, cellCL(board->array, -1, i+1), &x, &y);
      bubble_set_pos( bubble, board, x, y);
   }
   for (i=0; i<board->malus_indicators->size; i++) {
      double x,y;
      bubble=board->malus_indicators->element[i];
-     cell_center( board->array, cellCL(board->array, -1, i+board->malus_indicators10->size), &x, &y);
+     cell_screen_coord( board->array, cellCL(board->array, -1, i+board->malus_indicators10->size), &x, &y);
      bubble_set_pos( bubble, board, x, y);
   }
    
@@ -773,6 +777,8 @@
   else { /* lower alert light */
     board->alert_y += board->array->first_row*ROW_HEIGHT; /* FIXME: must be wrong */
     sprite_set_pos( board->alert, board->alert_x, board->alert_y);
+    board->top_border = board2screen_y(0.5 + board->array->first_row*ROW_HEIGHT, board);
+
   }
 }
 
@@ -807,10 +813,10 @@
   frame = (board->canon_angle+
 	   CANON_ANGLE_MAX)*board->theme->canon_a->size/NB_ANGLES;
   /* compute canon center coordinates */
-  x = board->canon_x;
-  y = board->canon_y;
+  //  x = board->canon_x;
+  //  y = board->canon_y;
   sprite_set_frame( board->canon_sprite, frame);
-  sprite_set_pos( board->canon_sprite, x, y);
+  sprite_set_pos( board->canon_sprite, board->canon_x, board->canon_y);
 }
 
 static void animate_alert( board_t board ) {




More information about the Xbubble-commits mailing list