![]() |
|
nested datafiles |
Rick
Member #3,572
June 2003
![]() |
Someone has to know this. I'm trying to get to the bitmaps from my datafile and it's 3 layers nested. for example LION.dat STAND.dat "STAND" WEST.dat "WEST" 001.bmp 002.bmp EAST.dat "EAST" 001.bmp 002.bmp I load LION.dat with load_datafile() and that works. I then build the path to the animation and direction datafile I want. ie. DATAFILE* object = load_datafile("lion.dat"); DATAFILE* m_direction = find_datafile_object( object, "STAND/WEST" ); m_direction seems to come back with the West datafile inside the Stand datafile. I know this because the following does come back with "WEST": finalPath = get_datafile_property(m_direction, DAT_ID('N','A','M','E')); I want to loop through the m_direction datafile to get each bitmap in that direction datafile. Knowing what is above how would I go about doing that? Thanks. ======================================================== |
Jonatan Hedborg
Member #4,886
July 2004
![]() |
Not exactly sure, but acording to the manual, something like this might work: DATAFILE* object = load_datafile("lion.dat"); DATAFILE* m_direction = find_datafile_object( object, "STAND/WEST" ); BITMAP *list[ANIM_COUNT]; //or whatever for(int i=0; i<ANIM_COUNT; i++) list<i> = (BITMAP*) m_direction<i>.dat;
Untested code, naturally
|
Rick
Member #3,572
June 2003
![]() |
If "EAST" is the first datafile within the sit datafile, then should these 2 lines of code be equal? east = find_datafile_object( sit, "EAST" ); east = (DATAFILE*) sit[0].dat; I would say yes, but they are not. If I then take east and try to loop through it while != DAT_END, the 2 ways above give me different results. Why would that be? [EDIT] Quote: Returns a pointer to a single DATAFILE element whose `dat' member points to the object, or NULL if the object could not be found. east->dat points to the datafile object I want. ((DATAFILE*)east->dat)<i>.dat
======================================================== |
|