/* NewDustTbl.c         */
/* R Griffin 1997       */

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

struct dust_object_table *Popcorn_NewDustTable(int max_objects) {
  int c;
  struct dust_object_table *table;

  table = malloc((sizeof(struct dust_object_table)) +
    ((max_objects-1) * sizeof(struct dust_object)));

  table->max_objects = max_objects;
  table->next_slot = 0;
  table->grav_x = table->grav_y = 0;

  for (c=0; c<max_objects; c++) table->object[c].object_id = 0;
  table->header = DUST_HEADER_WORD;
  return table;
}
