From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) Newsgroups: comp.os.msdos.djgpp Subject: Re: datafile question Date: 24 Jul 1997 19:25:16 GMT Organization: Oxford University, England Lines: 26 Message-ID: <5r8a6s$sm3@news.ox.ac.uk> References: <33D4F401 DOT 48E8 AT cam DOT org> NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Vic (tudor AT cam DOT org) wrote: : I want to add textures but I don't know how. Considering these textures : will be in a DAT file (allegro), is there any way to load something : from a datafile not using the index number? Like, if I add textures, I : will write something like ground_texture or ground.pcx etc. How can I : load the picture knowing this name and not the index number? : (I thought about using the defines in the header of the datafile but : this name is read of the disk at runtime so that doesn't help) You could use the load_datafile_object function (q.v. in the info or text documentation for Allegro) - this might be a WIP function though, I'm not entirely sure. Its prototype is: DATAFILE *load_datafile_object(char *filename, char *objectname); It loads a single object from the datafile, provided you did not strip the object names. See the docs for full information. Other than this, you could read in the header file as a text file and get the indices from there, or you could store an object reference at the start of each texture. But since the WIP provides this function, which is ideal for what you want, I would download the WIP and use it. -- George Foot Merton College, Oxford -------