Mail Archives: djgpp/1998/04/09/14:01:45
You don't check to see if the datafile is loaded correctly.
Replace your line
> datafile = load_datafile("game.dat");
with the following
datafile = NULL;
if( (datafile = load_datafile("game.dat"))==NULL ){
//Error failed to load datafile
return -1;
}
If this is the problem then I'd advise you to either ensure game.dat is
in the current directory or pass the full filename and path to
load_datafile().
[Richard.P.Gatehouse]
TackMast wrote:
>
> i got the grabber working, and made a different datafile containing the same
> things, but my program still won't work. It seems to not find the datafile or
> not load it, because the dos screen just sits there with the cursor blinking,
> doing nothing. if i do set_gfx_mode before i load the datafile, it switches to
> the graphics mode and freezes, because (what i think) the datafile won't load
> properly. can someone please help??
>
> #include <stdio.h>
> #include <stdlib.h>
>
> #include "allegro.h"
> #include "game.h"
>
> main()
> {
> DATAFILE *datafile;
>
> allegro_init();
> install_keyboard();
> install_timer();
>
> datafile = load_datafile("game.dat");
>
> set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
>
> blit(datafile[MAIN].dat, screen, 0, 0, 0, 0, 320, 200);
>
> readkey();
>
> return 0;
> }
- Raw text -