This bit of code is to help you grab individual sprite frames from a sprite sheet. It's actually in a book called 'Game Programming All In One 2nd Edition by Jonathan S. Harbour' which concentrates on developing games using 'C' and Allegro.
An example is of a sprite sheet containing 32 images of a rotating ball, 8 columns wide by 4 rows deep. Each sprite image is 64x64 pixels.
What you need to do to make it work is to include this code (say in main()) for ease of showing it is as follows:
//load 32-frame tiled sprite image
temp=load_bitmap("sphere.bmp",NULL); // this is the sprite sheet
Before main() you need to include:
a quick re-cap of the grabframe function arguments:
temp = spritesheet (in this case sphere.bmp)
64 = pixel width of frame on sprite sheet
64 = pixel height of frame on sprite sheet
0 = x start position of 1st frame on sprite sheet
0 = y start position of 1st frame on sprite sheet
8 = columns of frames (in this case 8 cols x 4 rows)
n = frame number (get this from for loop statement)
You can have more then 1 set of sprites in a sheet and thats why you can alter the sizes of the width/height of the frames and where in the sprite sheet x,y to start grabbing them from.
Hope this helps, but if you need a demo i'll supply a complete code listing and graphics for you to play with