home *** CD-ROM | disk | FTP | other *** search
- /*
- * This code is copyright ADE Muffett, September 1991, and is distributed as
- * part of the ASP .plan description language compiler. This code is freely
- * redistributable as long as this copyright notice remains intact. No
- * responsibility is assumed by the author for any situation which arises
- * from the use of this code, including insanity, late nights, or disk
- * storage problems.
- */
-
- #include "asp.h"
-
- void
- AddObject (string)
- char *string;
- {
- register int i;
- int start;
- int finish;
- char buff[SCREENWIDTH];
- char *obj;
-
- sscanf (string, "%*s %s %d %d", buff, &start, &finish);
-
- obj = CopyString (buff);
-
- for (i = 0; aobjects[i].object && (i < MAX_ANIM_OBJS - 1); i++);
-
- aobjects[i].object = obj;
- aobjects[i].location = start;
- aobjects[i].destination = finish;
- aobjects[++i].object = NULL;
- }
-
- void
- ResetAnim ()
- {
- aobjects[0].object = NULL;
- NullSet (anim_buffer, sizeof (anim_buffer));
- }
-
- void
- Animate ()
- {
- register int i;
- struct anim_object *ap;
- int changed;
-
- for (changed = 1; changed; /* nothing */ )
- {
- changed = 0;
- NullSet (anim_buffer, sizeof (anim_buffer));
- SpaceFlood (anim_buffer, SCREENWIDTH);
-
- for (i = 0; aobjects[i].object && (i < MAX_ANIM_OBJS - 1); i++)
- {
- ap = &aobjects[i];
-
- LimCopy (anim_buffer, ap -> object, ap -> location);
- if (ap -> location > ap -> destination)
- {
- ap -> location--;
- changed++;
- } else if (ap -> location < ap -> destination)
- {
- ap -> location++;
- changed++;
- }
- }
- /* anim_buffer is dealt with in Update() for masking reasons */
- UpdateCR ();
- }
- }
-