From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: datafile question Date: Thu, 24 Jul 1997 20:27:15 +0100 Organization: None Distribution: world Message-ID: References: <33D4F401 DOT 48E8 AT cam DOT org> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 24 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Vic writes: >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? You can load specific objects from the datafile by calling: load_datafile_object("filename.dat", "objectname"); If you have already loaded the entire file into memory, it's easy to search through it looking for an object with the required name. Call get_datafile_property(&datafile[index], DAT_ID('N','A','M','E')) for each object until one returns the name that you are interested in. If you encounter an object with a type of DAT_END, you've hit the end of the file and the data isn't there. Obviously this will only work if you include the object names in your saved datafile (ie. you don't use the "Save Stripped" option from the grabber). -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament. } if (key[KEY_LEFT]) { boat_right = 0; if (boat_left == 1) boat_left = 0; else (boat_left = 1);} if (key[KEY_RIGHT]) { boat_left = 0; if (boat_right == 1) boat_right = 0; else (boat_right = 1);} if (boat_diving == 1) { depth--; if (depth <= set_depth) boat_diving = 0; } if (boat_surfacing == 1) { depth++; if (depth >= 0) boat_surfacing = 0;} if (boat_left == 1) { angle--; if (angle == -1) angle = 359; } if (boat_right == 1) { angle++; if (angle == 360) angle = 0; } } }