ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.21.tar.gz
[xscreensaver] / hacks / pyro.c
index e46e93fa97be4cb7247726d7eaafcc07c1c0b09c..3741106840494b0e5689fb2ecbb34bf4b77aec17 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992, 1994, 1996, 1998, 2001
+/* xscreensaver, Copyright (c) 1992, 1994, 1996, 1998, 2001, 2005
  *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
@@ -105,6 +105,13 @@ launch (int xlim, int ylim, int g,
   p->fuse = ((((random () % 500) + 500) * abs (p->dy / g)) / 1000);
   p->primary = True;
 
+  /* cope with small windows -- those constants assume big windows. */
+  {
+    int div = 1000000 / ylim;
+    if (div > 1)
+      p->fuse /= div;
+  }
+
   if (! mono_p)
     {
       hsv_to_rgb (random () % 360, 1.0, 1.0,
@@ -128,7 +135,7 @@ shrapnel (struct projectile *parent, Display *dpy, Colormap cmap)
   p->y = parent->y;
   v=random () % PI_2000;
   p->dx =(sin_cache[v]) + parent->dx;
-  p->dy =(cos_cache[v]) + parent->dx;
+  p->dy =(cos_cache[v]) + parent->dy;
   p->decay = (random () % 50) - 60;
   p->size = (parent->size * 2) / 3;
   p->fuse = 0;