[Xbubble-commits] xbubble-sdl/src board.c, 1.9, 1.10 board.h, 1.6, 1.7 path_init.c, 1.3, 1.4 setting.h, 1.6, 1.7

Martin Quinson mquinson at alioth.debian.org
Fri Sep 15 10:14:48 UTC 2006


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

Modified Files:
	board.c board.h path_init.c setting.h 
Log Message:
Fix canon position on screen

Index: path_init.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/path_init.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- path_init.c	11 Sep 2006 21:33:19 -0000	1.3
+++ path_init.c	15 Sep 2006 10:14:46 -0000	1.4
@@ -165,7 +165,7 @@
 
 	half_range = sqrt( 1 + vx*vx/vy/vy );
 	bouncing=1;
-	/* Keep the following in sync with the def in board.c */
+	/* Keep the following in sync with the def of ready_[xy] in board.c */
 	xb=BOARD_WIDTH*0.5 ;//CANON_X;
 	yb=ROWS*ROW_HEIGHT + 0.5;//CANON_Y;
 	v2 = vx*vx + vy*vy;

Index: board.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/board.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- board.h	14 Sep 2006 19:53:50 -0000	1.6
+++ board.h	15 Sep 2006 10:14:46 -0000	1.7
@@ -87,8 +87,9 @@
 
   /* sprite locations */
   double new_x,new_y;     /* Ball newly created */
+  double ready_x,ready_y; /* Ball ready to be lauched (loaded in canon) */
   double alert_x,alert_y; /* alert sign */
-  double canon_x,canon_y; /* canon */
+//  double canon_x,canon_y; /* canon */
   double countdown_x,countdown_y;
 
   /* borders locations */

Index: board.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/board.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- board.c	14 Sep 2006 19:53:50 -0000	1.9
+++ board.c	15 Sep 2006 10:14:46 -0000	1.10
@@ -139,9 +139,14 @@
   board->alert_y=board2screen_y( -OFFSET_Y*0.5         ,board);
 
   /* Keep the following in sync with the def in path_init.c */
+  board->ready_x=board2screen_x( BOARD_WIDTH*0.5       ,board);
+  board->ready_y=board2screen_y( ROWS*ROW_HEIGHT + 0.5 ,board);
+
+   /* FIXME
   board->canon_x=board2screen_x( BOARD_WIDTH*0.5       ,board);
   board->canon_y=board2screen_y( ROWS*ROW_HEIGHT + 0.5 ,board);
-
+    */
+   
   board->countdown_x=board2screen_x( 1.3, board);
   board->countdown_y=board->new_y - 1.3*board->scale;
 
@@ -171,7 +176,10 @@
   board->canon_virtual_angle = 0.0;
   board->canon_direction = canon_stopped;
   board->canon_sprite = sprite_new( CANON_LAYER, 30, theme->canon_a, 0, 0);
-  sprite_set_pos( board->canon_sprite, board->canon_x, board->canon_y);
+  frame_t frame= theme->canon_a->element[0];
+  sprite_set_pos( board->canon_sprite, 
+		  board->ready_x - frame->surf->h/2,
+		  board->ready_y - frame->surf->w/4);
   sprite_pool_add( board->sprite_pool, board->canon_sprite );
 
   /* precompute launching vectors */
@@ -396,17 +404,17 @@
       sprite_inc_clock( bubble->sprite, dt );
       if ( board->canon_empty ) {
 	/* compute new position of bubble */
-	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);
+	t = ( ((double)bubble->clock)/((double)CANON_LOAD_TIME) ) *M_PI/2;
+	/* elliptic trajectory */
+       	x = board->ready_x - ( board->ready_x - board->new_x ) * cos(t);
+	y = board->new_y + ( board->ready_y - board->new_y )*sin(t);
 	bubble_set_pos( bubble, board, x, y );
 	bubble->clock += dt;
 	
 	/* if bubble has reached canon then we're ready to fire */
 	if ( bubble->clock > CANON_LOAD_TIME ) {
 	  bubble_set_state( bubble, READY, MEDIUM_LAYER, 0 );
-	  bubble_set_pos( bubble, board, board->canon_x, board->canon_y );
+	  bubble_set_pos( bubble, board, board->ready_x, board->ready_y );
 	  board->canon_empty = 0;
 	  /* add a new bubble */
 	  board->next_color = bubble_next_color( board );

Index: setting.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/setting.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- setting.h	15 Sep 2006 09:50:35 -0000	1.6
+++ setting.h	15 Sep 2006 10:14:46 -0000	1.7
@@ -18,7 +18,7 @@
 
 #define DEAD_ZONE_HEIGHT     2.0
 #define BOARD_WIDTH          COLS
-#define BOARD_HEIGHT         ( ROWS*ROW_HEIGHT + DEAD_ZONE_HEIGHT )
+#define BOARD_HEIGHT         ( (1+ROWS)*ROW_HEIGHT + DEAD_ZONE_HEIGHT )
 #define OFFSET_X             ( 1.0*SIDE_WIDTH/MAX_SCALE )
 #define OFFSET_Y             ( 1.0*FRAME_HEIGHT/MAX_SCALE )
 




More information about the Xbubble-commits mailing list