Mail Archives: djgpp/1997/07/28/12:06:59
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; }
}
}
- Raw text -