/* NewDustPro.c         */
/* R Griffin 1997       */

#include <stdio.h>
#include "Popcorn:Popcorn.h"

struct dust_object *Popcorn_NewDustPrototype(struct dust_object_table *table,
  int prototype_id, int x, int y, int i) {
  int c = 0;
  struct dust_object *obj;
  /* Find prototype */
  while (prototype[c]->id != prototype_id && c != prototype_free) c++;

  if (c == prototype_free) {
    fprintf(stderr, "Prototype %08X not found", prototype_id);
    return NULL;
  }
  if ((obj = Popcorn_NewDustObject(table, i)) != NULL) {
    obj->object_id = prototype_id;
    obj->x = x; obj->y = y;
    obj->flags = prototype[c]->flags;
    obj->timer_value = obj->xv = obj->yv = 0;
    obj->colours = NULL;
    obj->colour_num = 0;
  }
  return obj;
}
