xbubble-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xbubble-users] i18n patch


From: Martin Quinson
Subject: Re: [Xbubble-users] i18n patch
Date: Wed, 9 Apr 2003 18:11:36 +0200
User-agent: Mutt/1.5.4i

On Wed, Apr 09, 2003 at 05:25:49PM +0200, address@hidden wrote:
> Quoting Martin Quinson <address@hidden>:
> 
> > Hello,
> > 
> > I've done an internationalization patch, which you can find in
> > attachement.
> > It is rather big, since there is a lot of NLS infrastucture to set in
> > place.
> > The worst point of this patch is that the path /usr/share/locale is
> > hardcoded in configure.in since I failed to derive that value from the
> > prefix.
> 
> Did you have a look at how this is done in other packages ?

Yup, but not enough. I'll redo that later.
 
> > Please consider applying this, and filling the CVS on savannah, so that
> > I
> > can work on the lastest version.
> > 
> > If you don't like this patch, please say so (and why) so that I can have
> > a
> > chance to improve what you don't like.
> 
> As I said in my previous msg, I'm willing to let you in control ;-)

As long as I'm not alone on the front, why not?

> > Next todo item on my list is changing the collision detection
> > algorithm,
> > which seems broken to me since it stops the ball when it becomes
> > adjacent
> > with an existing one. It should stop the ball when it *collides* with
> > an
> > existing ball (ie, distance<ball_diameter).
> 
> Well, it seems to me that it's is the case in xbubble :-)
> The collision detection algorithm involves simple geometrical computations,
> check xbubble-0.2.4 source code for a better documentation/explanation.
> If you still see a problem pls explain it to me precisely ;-)

I quickly checked, and the code of this part didn't seem to change. So, here
is the feeling I have:

In this situation:

 .   .   .   .   .   .
   .   .   .   .   .
 .   .   .   .   X   .
   .   .   .       .
 .   .   .       .   .
   .   A       B   .

           |

it is possible in fb to shoot at X while in xbubble, it will stick on A or B. 

Here is the code I think offending (cell.c):
int target_cell( CellArray ca, double x, double y, double vx, double vy,
                 double * target_y, Vector path ) {
[...]            
    min_dist = ( yt - y )/vy;
    /* now scan cells and look for a colliding bubble */

    /* row range */
    max_row = clip( (int) floor( y / ROW_HEIGHT ) + 1, 0, ROWS-1 );
    min_row = clip( (int) floor( yt / ROW_HEIGHT ) - 1, 0, ROWS-1 );

    /* scan from bottom to top */
    for ( row = max_row; row >= min_row; row-- ) {
      cell = COLS*row;
      /* column range */
      half_range = sqrt( 1 + vx*vx/vy/vy );
      first_col = row_start( ca, row);
      xc = x + ( row*ROW_HEIGHT + 0.5 - y )*vx/vy - ( 1.0 - first_col )/2;
      min_col = clip( (int) floor( xc - half_range + 1 ), first_col, COLS-1 );
      max_col = clip( (int) floor( xc + half_range ), first_col, COLS-1 );

      for ( col = min_col; col <= max_col; col++ ) {
        if ( ca->cell[ col + cell ] != EMPTY_CELL ) {
          /* compute collision location */
          cell_center( ca, col + cell, &xa, &ya );
          dp = vx*( xa - x ) + vy*( ya - y );
          if ( dp > 0 ) {
            vp = vy*( xa - x ) - vx*( ya - y );
            vp2 = vp*vp;
            if ( vp2 <= v2 ) {
              dist = ( dp - sqrt( v2 - vp2 ))/v2;
              if (( dist >= 0 )&&( dist <= min_dist )) {
                min_dist = dist;
                /* store location */
                xt = x + vx*dist;
                yt = y + vy*dist;
                bouncing = 0;
                /* check next row and finish */
                if ( min_row < row - 1 )
                  min_row = row - 1;
              }
            }
          }
        }
        else
          if ( path != NULL )
            add_element_to_vector( path, col + cell );
      }
    }
[...]
}

I'm completely lost under the quantity of uncommented vars, and ask your
help to find a way to make the colision detection looser.

Decreasing (*.5) min_dist leads to having the new ball taking the place on
the board of the collided ball. Increasing that (*20) don't seem to have any
influence.

The trick may be to lie on the diameter of the balls to decrease it. How to
do that? 

Another explanation would be that the canon movement arent as accurate as in
fb, no idea.


Thanks, Mt.

-- 
Il y a 10 cat├ęgories de personnes : celles qui comprennent le binaire, et
les autres.
          --- Blague d'informaticiens




reply via email to

[Prev in Thread] Current Thread [Next in Thread]