for(i=0;i<3;i++) { fscanf(fh, " %d %d ", &width, &height); tilearray_init(&map->layers[i]); tilearray_expand_width(&map->layers[i], width); tilearray_expand_height(&map->layers[i], height); for(j=0;jlayers[i].height;j++) { for(k=0;klayers[i].width;k++) { int a = fgetc(fh); int b = fgetc(fh); int c = fgetc(fh); int d = fgetc(fh); int tile = a | (b<<8) | (c<<16) | (d<<24); map->layers[i].buffer[j][k] = tile; } } }