#include #include #include #include #define USAGE "Store all the bitmap-frames using _.bmp \n\ then invoke: \n\ the output will be a .bmp file named with all the frames \n\ aligned using x. must be a multipel of .\n\ max number of frames () is 999. \n\ DO NOT USE ZEROES AT THE BEGINNING OF !\n\ Frames must be quare" void blit_to_chart(BITMAP *chart, BITMAP *src, int width, \ int columns, int frame){ int x = (frame % columns) * width; int y = (frame / columns) * width; blit(src, chart, 0, 0, x, y, width, width); } int main(int argc, char **argv){ char *basename; char *currentfile; int frames; int width; int columns; int n; BITMAP *chart; BITMAP *tmp; tmp = NULL; allegro_init(); set_color_depth(24); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 50, 50, 0, 0); if(argc != 5){ printf(USAGE); return 0; } frames = atoi(argv[2]); columns = atoi(argv[3]); width = atoi(argv[4]); n = strlen(argv[1]); /* argv[1] = */ if(1 > frames || frames > 999 || columns < 1 || width < 1 || n < 1 || (frames % columns) != 0){ printf(USAGE); return 0; } basename = (char*)malloc(n+1); sprintf(basename, "%s", argv[1]); /* Just make sure all went well...*/ if(strcmp(basename, argv[1]) != 0){ free(basename); return 0; } /* n+9 to compensate for "_XXX.bmp\0" */ currentfile = (char*)malloc(n+20); chart = create_bitmap(width*columns, width*(frames/columns)); for(n=0; n