delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/09/14:01:45

From: "Richard.P.Gatehouse" <thedreamscaper AT geocities DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allegro datafiles still won't work
Date: Thu, 09 Apr 1998 14:15:37 +0100
Organization: SCO
Lines: 51
Message-ID: <352CC9F9.2A980CEF@geocities.com>
References: <1998040901241100 DOT VAA03751 AT ladder01 DOT news DOT aol DOT com>
NNTP-Posting-Host: richardg.london.sco.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019