-/* xscreensaver, Copyright (c) 1992 Jamie Zawinski <jwz@lucid.com>
+/* xscreensaver, Copyright (c) 1992, 1994, 1996
+ * Jamie Zawinski <jwz@netscape.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
static struct projectile *projectiles, *free_projectiles;
static struct projectile *
-get_projectile ()
+get_projectile (void)
{
struct projectile *p;
if (free_projectiles)
}
static void
-free_projectile (p)
- struct projectile *p;
+free_projectile (struct projectile *p)
{
p->next_free = free_projectiles;
free_projectiles = p;
}
static void
-launch (xlim, ylim, g, dpy, cmap)
- int xlim, ylim, g;
- Display *dpy;
- Colormap cmap;
+launch (int xlim, int ylim, int g,
+ Display *dpy, Colormap cmap)
{
struct projectile *p = get_projectile ();
int x, dx, xxx;
if (!XAllocColor (dpy, cmap, &p->color))
{
p->color.pixel = WhitePixel (dpy, DefaultScreen (dpy));
- p->color.red = p->color.green = p->color.blue = 0;
+ p->color.red = p->color.green = p->color.blue = 0xFFFF;
}
}
}
static struct projectile *
-shrapnel (parent, dpy, cmap)
- struct projectile *parent;
- Display *dpy;
- Colormap cmap;
+shrapnel (struct projectile *parent, Display *dpy, Colormap cmap)
{
struct projectile *p = get_projectile ();
if (! p) return 0;
p->dx = (random () % 5000) - 2500 + parent->dx;
p->dy = (random () % 5000) - 2500 + parent->dy;
p->decay = (random () % 50) - 60;
- p->size = 6000;
+ p->size = (parent->size * 2) / 3;
p->fuse = 0;
p->primary = False;
static int how_many, frequency, scatter;
static Colormap
-init_pyro (dpy, window)
- Display *dpy;
- Window window;
+init_pyro (Display *dpy, Window window)
{
int i;
Colormap cmap;
}
static void
-pyro (dpy, window, cmap)
- Display *dpy;
- Window window;
- Colormap cmap;
+pyro (Display *dpy, Window window, Colormap cmap)
{
XWindowAttributes xgwa;
static int xlim, ylim, real_xlim, real_ylim;
else
XSetForeground (dpy, draw_gc, p->color.pixel);
- if (p->primary)
+ if /*(p->primary)*/ (size > 2)
XFillArc (dpy, window, draw_gc, x, y, size, size, 0, 360*64);
else
XFillRectangle (dpy, window, draw_gc, x, y, size, size);
else
{
free_projectile (p);
- if (! mono_p) XFreeColors (dpy, cmap, &p->color.pixel, 1, 0);
+ if (! mono_p)
+ if (p->color.pixel != WhitePixel (dpy, DefaultScreen (dpy)))
+ XFreeColors (dpy, cmap, &p->color.pixel, 1, 0);
}
if (p->primary && p->fuse <= 0)
{
- int i = (random () % scatter) + (scatter/2);
- while (i--)
+ int j = (random () % scatter) + (scatter/2);
+ while (j--)
shrapnel (p, dpy, cmap);
}
}
char *progclass = "Pyro";
char *defaults [] = {
- "*background: black",
- "*foreground: white",
+ ".background: black",
+ ".foreground: white",
"*count: 100",
"*frequency: 30",
"*scatter: 20",
XrmOptionDescRec options [] = {
{ "-count", ".count", XrmoptionSepArg, 0 },
{ "-frequency", ".frequency", XrmoptionSepArg, 0 },
- { "-scatter", ".scatter", XrmoptionSepArg, 0 }
+ { "-scatter", ".scatter", XrmoptionSepArg, 0 },
+ { 0, 0, 0, 0 }
};
-int options_size = (sizeof (options) / sizeof (options[0]));
void
-screenhack (dpy, window)
- Display *dpy;
- Window window;
+screenhack (Display *dpy, Window window)
{
Colormap cmap = init_pyro (dpy, window);
while (1)