projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http://ftp.x.org/contrib/applications/xscreensaver-2.23.tar.gz
[xscreensaver]
/
hacks
/
pyro.c
diff --git
a/hacks/pyro.c
b/hacks/pyro.c
index 69b0e0609799b2d8b4619ace5d7d48341a56bca0..b62e17ac71c6fb4d2d72b58aa658ae23737b2788 100644
(file)
--- a/
hacks/pyro.c
+++ b/
hacks/pyro.c
@@
-1,4
+1,5
@@
-/* 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
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@
-30,7
+31,7
@@
struct projectile {
static struct projectile *projectiles, *free_projectiles;
static struct projectile *
static struct projectile *projectiles, *free_projectiles;
static struct projectile *
-get_projectile ()
+get_projectile (
void
)
{
struct projectile *p;
if (free_projectiles)
{
struct projectile *p;
if (free_projectiles)
@@
-46,8
+47,7
@@
get_projectile ()
}
static void
}
static void
-free_projectile (p)
- struct projectile *p;
+free_projectile (struct projectile *p)
{
p->next_free = free_projectiles;
free_projectiles = p;
{
p->next_free = free_projectiles;
free_projectiles = p;
@@
-55,10
+55,8
@@
free_projectile (p)
}
static void
}
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;
{
struct projectile *p = get_projectile ();
int x, dx, xxx;
@@
-87,16
+85,13
@@
launch (xlim, ylim, g, dpy, cmap)
if (!XAllocColor (dpy, cmap, &p->color))
{
p->color.pixel = WhitePixel (dpy, DefaultScreen (dpy));
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 = 0
xFFFF
;
}
}
}
static struct projectile *
}
}
}
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;
{
struct projectile *p = get_projectile ();
if (! p) return 0;
@@
-105,7
+100,7
@@
shrapnel (parent, dpy, cmap)
p->dx = (random () % 5000) - 2500 + parent->dx;
p->dy = (random () % 5000) - 2500 + parent->dy;
p->decay = (random () % 50) - 60;
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;
p->fuse = 0;
p->primary = False;
@@
-122,9
+117,7
@@
static unsigned int default_fg_pixel;
static int how_many, frequency, scatter;
static Colormap
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;
{
int i;
Colormap cmap;
@@
-154,10
+147,7
@@
init_pyro (dpy, window)
}
static void
}
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;
{
XWindowAttributes xgwa;
static int xlim, ylim, real_xlim, real_ylim;
@@
-207,7
+197,7
@@
pyro (dpy, window, cmap)
else
XSetForeground (dpy, draw_gc, p->color.pixel);
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);
XFillArc (dpy, window, draw_gc, x, y, size, size, 0, 360*64);
else
XFillRectangle (dpy, window, draw_gc, x, y, size, size);
@@
-215,13
+205,15
@@
pyro (dpy, window, cmap)
else
{
free_projectile (p);
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)
{
}
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);
}
}
shrapnel (p, dpy, cmap);
}
}
@@
-231,8
+223,8
@@
pyro (dpy, window, cmap)
char *progclass = "Pyro";
char *defaults [] = {
char *progclass = "Pyro";
char *defaults [] = {
- "
*
background: black",
- "
*
foreground: white",
+ "
.
background: black",
+ "
.
foreground: white",
"*count: 100",
"*frequency: 30",
"*scatter: 20",
"*count: 100",
"*frequency: 30",
"*scatter: 20",
@@
-243,14
+235,12
@@
char *defaults [] = {
XrmOptionDescRec options [] = {
{ "-count", ".count", XrmoptionSepArg, 0 },
{ "-frequency", ".frequency", XrmoptionSepArg, 0 },
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
void
-screenhack (dpy, window)
- Display *dpy;
- Window window;
+screenhack (Display *dpy, Window window)
{
Colormap cmap = init_pyro (dpy, window);
while (1)
{
Colormap cmap = init_pyro (dpy, window);
while (1)