X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fmetaballs.c;h=f867b2906aa0462e7e5946397f42b5d6d98cfc2e;hb=bc7b7a8eb122206d239ec0e693676bcce31be1aa;hp=9efb19e80bec89674ad7de29605a9f2fc0b5a737;hpb=6cee540bdbb571485cd5e519f89f389faebd0495;p=xscreensaver diff --git a/hacks/metaballs.c b/hacks/metaballs.c index 9efb19e8..f867b290 100644 --- a/hacks/metaballs.c +++ b/hacks/metaballs.c @@ -56,7 +56,7 @@ typedef struct short xpos,ypos; } BLOB; -static unsigned char nBlobCount; +static unsigned int nBlobCount; static unsigned char radius; static unsigned char delta; static unsigned char dradius; @@ -65,10 +65,13 @@ static unsigned char **blob; static BLOB *blobs; static unsigned char **blub; +#undef BELLRAND +#define BELLRAND(n) ((frand((n)) + frand((n)) + frand((n))) / 3) + static void init_blob(BLOB *blob) { - blob->xpos = (iWinWidth>> 1) - radius; - blob->ypos = (iWinHeight >> 1) - radius; + blob->xpos = iWinWidth/4 + BELLRAND(iWinWidth/2) - radius; + blob->ypos = iWinHeight/4 + BELLRAND(iWinHeight/2) - radius; } static void Execute( Display *pDisplay, @@ -225,7 +228,7 @@ static void Initialize( Display *pDisplay, Window Win, GC *pGC, XImage **ppImage /* Find the preferred bits-per-pixel. (jwz) */ { - int i, pfvc = 0; + int pfvc = 0; XPixmapFormatValues *pfv = XListPixmapFormats( pDisplay, &pfvc ); for( i=0; i