Ejemplo n.º 1
0
void TileRepository::importDatafile(DATAFILE *file)
{
	if (!file) return;

	TileType *tempTileType;
	BITMAP *tempBitmap;

	// Import bitmaps from the datafile
	while (file->type != DAT_END) {
		switch (file->type) {
		case DAT_FILE:
			// Go recursively into nested datafiles
			importDatafile((DATAFILE*)file->dat);
			break;
		case DAT_BITMAP:
			// Create a new tile type and add it to the hash_map
			tempBitmap = create_bitmap(((BITMAP*)file->dat)->w, ((BITMAP*)file->dat)->h);
			blit((BITMAP*)file->dat, tempBitmap, 0, 0, 0, 0, tempBitmap->w, tempBitmap->h);

			tempTileType = new TileType(tempBitmap, get_datafile_property(file, DAT_ID('N','A','M','E')));

			tileTypes.insert(make_pair(tempTileType->getName(), tempTileType));
			break;
		}
		file++;
	}
}
Ejemplo n.º 2
0
/* helper function for inserting a list of builtin properties */
static void insert_builtin_prop(AL_CONST char *prop_types)
{
   int type;

   while (TRUE) {
      ASSERT(strlen(prop_types)>=4 && (!prop_types[4] || prop_types[4]==';'));
      type = DAT_ID(prop_types[0], prop_types[1], prop_types[2], prop_types[3]);
      datedit_insert_property(&builtin_prop, type, "*");
      if (!prop_types[4])
         break;
      prop_types += 5;
   }
}
Ejemplo n.º 3
0
/* loadpng_init:
 *  This is supposed to resemble jpgalleg_init in JPGalleg 2.0.
 */
int loadpng_init(void)
{
    register_png_datafile_object(DAT_ID('P','N','G',' '));
    register_png_file_type();
    return 0;
}