Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need help from DJGPP & Allegro users(Datafile problem)

I wanted to create a program that could read the pictures from a *.dat file and show them as a slideshow, but i came out with only some errors i can't understand. Everything seems to be ok(the "dat_test.dat" and "ALL00.TXT" are all in the same folder).

[CODE]
#include
#include

PALETTE pal;
BITMAP *buf;
DATAFILE *dat;
int pic_start=0;
int pic_end=0;
int pal_start=0;
int pal_end=0;

void load_config(char *fname){
FILE *f1=fopen(fname,"r");
fscanf(f1,"%d %d %d %d",&pic_start,&pic_end,&pal_start,&pal_end);

fclose(f1);}



int initAll(){
allegro_init();
install_keyboard();

if(set_gfx_mode(0,800,600,0,0)!=0){
allegro_message("
%s",allegro_error);
allegro_exit();return -1;}

load_config("config.txt");

set_palette(dat[11].dat);

set_color_conversion(COLORCONV_TOTAL);
}

int main(){
int i; int x=0,y=0;

set_color_conversion(COLORCONV_NONE);

dat=load_datafile("dat_test.dat");

if(!dat){
allegro_message("Error loading dat_test.dat!
");
return -1;}

for(i=pic_start;i<pic_end;i++){
do{

clear(buf);
blit(dat[i].dat,buf,0,0,x,y,SCREEN_W,SCREEN_H);
rest(1);
vsync();
blit(buf,screen,0,0,0,0,SCREEN_W,SCREEN_H);
}while(!key[KEY_SPACE]);
}
readkey();

unload_datafile(dat);
return 0;
}
END_OF_MAIN();
[/CODE]

Could someone please help me what is wrong in here.
Sign In or Register to comment.