delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/08/06:21:41

From: "Chris La Mantia" <lamantia AT gte DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro: Loading sub-datafiles
Date: 8 Apr 1997 06:52:32 GMT
Organization: GTE Intelligent Network Services, GTE INS
Lines: 38
Message-ID: <01bc43e8$e6ddcae0$18f22499@chris>
NNTP-Posting-Host: cust24.max2.st-louis.mo.ms.uu.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I seem to be doing something wrong here.

Allegro 2.2 now has the ability to store datafiles within datafiles.  I
want to use this ability to load only those datafiles that must be in
memory at any given time.  Unfortunately, I'm having trouble accessing data
in the sub-datafile.

For example, say I have a datafile called "data.dat".  This datafile
contains two sub-datafiles, INTRO and GAME. GAME contains a bitmap called
POINTER.

So I should be able to do this:

DATAFILE *gamedata;

void main(void) {
   allegro_init();
   install_mouse();
   install_timer();
   gamedata = load_datafile_object("data.dat","GAME");
   if (gamedata==NULL) {
      allegro_exit();
      printf("Error loading global data file!\n");
      exit(1);
   }
   set_mouse_sprite(gamedata[GAME_POINTER].dat);
}

Unfortunately, it doesn't work; Allegro bombs out on the set_mouse_sprite()
line.

What is it I'm not getting here?

---------------------------------------------------------------------------
Chris La Mantia / lamantia AT gte DOT net
Current Project: Infinite Worlds, an RPG with a dynamic world
http://home1.gte.net/lamantia/infinite
NO UNSOLICITED COMMERCIAL E-MAIL ACCEPTED

- Raw text -


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