swarm.c revision 919
/*
* Copyright (c) 1988-91 by Patrick J. Naughton.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* This file is provided AS IS with no warranties of any kind. The author
* shall have no liability with respect to the infringement of copyrights,
* trade secrets or any patents by this file or any part thereof. In no
* event will the author be liable for any lost revenue or profits or
* other special, indirect and consequential damages.
*/
/*
* Copyright 1994 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*-
* swarm.c - swarm of bees for xlock, the X Window System lockscreen.
*
* Copyright (c) 1991 by Patrick J. Naughton.
*
* Revision History:
* 31-Aug-90: Adapted from xswarm by Jeff Butterworth. (butterwo@ncsc.org)
*/
#include "xlock.h"
/* Macros */
typedef struct {
int pix;
long startTime;
int width;
int height;
int beecount; /* number of bees */
short *x;
short *y; /* bee positions x[time][bee#] */
short *xv;
short *yv; /* bee velocities xv[bee#] */
short wx[3];
short wy[3];
short wxv;
short wyv;
} swarmstruct;
void
{
int b;
/* Clear the background. */
/* Allocate memory. */
}
/* Initialize point positions, velocities, etc. */
/* wasp */
/* bees */
X(1, b) = X(0, b);
Y(1, b) = Y(0, b);
}
}
void
{
int b;
/* <=- Wasp -=> */
/* Age the arrays. */
/* Accelerate */
/* Speed Limit Checks */
/* Move */
/* Bounce Checks */
}
}
/* Don't let things settle down. */
/* <=- Bees -=> */
int distance,
dx,
dy;
/* Age the arrays. */
X(2, b) = X(1, b);
X(1, b) = X(0, b);
Y(2, b) = Y(1, b);
Y(1, b) = Y(0, b);
/* Accelerate */
if (distance == 0)
distance = 1;
/* Speed Limit Checks */
/* Move */
/* Fill the segment lists. */
}
}
}