[Xbubble-commits] xbubble-sdl/src board.c, 1.4, 1.5 setting.h, 1.4,
1.5
Martin Quinson
mquinson at alioth.debian.org
Thu Sep 14 07:47:13 UTC 2006
Update of /cvsroot/xbubble/xbubble-sdl/src
In directory haydn:/tmp/cvs-serv26203
Modified Files:
board.c setting.h
Log Message:
Speeds are in cell per second
Index: board.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/board.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- board.c 12 Sep 2006 08:04:08 -0000 1.4
+++ board.c 14 Sep 2006 07:47:11 -0000 1.5
@@ -177,8 +177,8 @@
/* precompute launching vectors */
for ( i = 0; i < NB_ANGLES; i++ ) {
- board->vx[i] = LAUNCHING_SPEED*sin((i-CANON_ANGLE_MAX)*ANGLE_STEP );
- board->vy[i] =-LAUNCHING_SPEED*cos((i-CANON_ANGLE_MAX)*ANGLE_STEP );
+ board->vx[i] = board->scale*LAUNCHING_SPEED*sin((i-CANON_ANGLE_MAX)*ANGLE_STEP );
+ board->vy[i] =-board->scale*LAUNCHING_SPEED*cos((i-CANON_ANGLE_MAX)*ANGLE_STEP );
}
board->launch_count = 0;
board->last_fire_delay = 1000;
@@ -319,7 +319,7 @@
( bubble->state != STUCK )&&
( bubble->state != EXPLODING )) {
bubble->vx = 0;
- bubble->vy = EXPLODING_SPEED;
+ bubble->vy = board->scale*EXPLODING_SPEED;
bubble_set_state( bubble, EXPLODING, TOP_LAYER, 0 );
}
}
@@ -331,8 +331,8 @@
bubble = board->array->cell[i];
direction = ((float)rand())/((float)RAND_MAX+1.0) * 3.14159;
- bubble->vx = cos(direction)*EXPLODING_SPEED*25;
- bubble->vy = sin(direction)*EXPLODING_SPEED*25;
+ bubble->vx = board->scale*cos(direction)*EXPLODING_SPEED*25;
+ bubble->vy = board->scale*sin(direction)*EXPLODING_SPEED*25;
bubble_set_state( bubble, EXPLODING, TOP_LAYER, clock );
clock -= PROPAGATION_TIME;//*(i%COLS == 0? 20: 0);
@@ -496,8 +496,8 @@
bubble_set_state( tmp, EXPLODING, TOP_LAYER, clock);
direction = ((float)rand())/((float)RAND_MAX+1.0) * -3.14159;
- tmp->vx = cos(direction)*violence*EXPLODING_SPEED;
- tmp->vy = sin(direction)*violence*EXPLODING_SPEED;
+ tmp->vx = board->scale*cos(direction)*violence*EXPLODING_SPEED;
+ tmp->vy = board->scale*sin(direction)*violence*EXPLODING_SPEED;
board->array->cell[tmp->cell] = EMPTY_CELL;
if ( i >= 3 ) /* immediately send extra bubbles to opponent */
vector_push( board->output, tmp->color );
@@ -645,7 +645,7 @@
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->vy = -board->scale*RISING_SPEED;
bubble->cell = target_cell;
bubble->target_y = y;
board->nb_rising_bubbles++;
@@ -736,8 +736,8 @@
bubble_set_state( bubble, FALLING, TOP_LAYER, 0);
/* Which direction this ball goes to */
direction = ((float)rand())/((float)RAND_MAX+1.0) * -3.14159;
- bubble->vx = cos(direction)*violence*EXPLODING_SPEED;
- bubble->vy = sin(direction)*violence*EXPLODING_SPEED;
+ bubble->vx = board->scale*cos(direction)*violence*EXPLODING_SPEED;
+ bubble->vy = board->scale*sin(direction)*violence*EXPLODING_SPEED;
board->array->cell[cell] = EMPTY_CELL;
}
}
@@ -873,6 +873,7 @@
}
void canon_rotate_left( board_t board ) {
+ DEBUG("left %f", board->canon_speed);
if (board->canon_direction == -1)
board->canon_speed += MIN( (5-board->canon_speed)/10, 0.2 );
else
@@ -881,6 +882,7 @@
}
void canon_rotate_right( board_t board ) {
+ DEBUG("right %f", board->canon_speed);
if (board->canon_direction == 1)
board->canon_speed += MIN( (5-board->canon_speed)/10, 0.2 );
else
Index: setting.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble-sdl/src/setting.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- setting.h 13 Sep 2006 22:51:22 -0000 1.4
+++ setting.h 14 Sep 2006 07:47:11 -0000 1.5
@@ -44,11 +44,10 @@
#define CANON_ROTATING_SPEED ( 1/50.0 )
/* bubble speeds in cells/ms */
-#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 */
+#define LAUNCHING_SPEED 0.02 /* velocity of launched bubbles (cell/ms) */
+#define EXPLODING_SPEED 0.0003 /* vertical velocity after explosion (cell/ms) */
+#define RISING_SPEED 0.04 /* velocity of incoming bubbles (cell/ms) */
+#define GRAVITY 0.00003 /* gravity (cell.ms^-2) */
/* times in milliseconds */
#define PROPAGATION_TIME 15 /* explosion propagation time */
More information about the Xbubble-commits
mailing list