/*------------------------------------------------------------------------ | | GetSpotlightCount3ds | +--------------------------------------------------------------------*/ ulong3ds GetSpotlightCount3ds(database3ds *db) { chunk3ds *dlite, *spotl; ulong3ds spotcount = 0, i; if (db == NULL) SET_ERROR_RETURNR(ERR_INVALID_ARG, 0); /* Update the index to named objects if the list has changed recently */ UpdateNamedObjectList3ds(db); if (db->objlist == NULL) return 0; /* Scan through the list of named objects looking for lights */ for (i = 0; i < db->objlist->count; i++) { /* Search each object for a light chunk */ FindChunk3ds(db->objlist->list[i].chunk, N_DIRECT_LIGHT, &dlite); /* if one was found, check to see if its a spotlight */ if (dlite != NULL) { FindChunk3ds(dlite, DL_SPOTLIGHT, &spotl); /* if it is a spotlight, then increment the count */ if (spotl != NULL) spotcount++; } } return spotcount; }
/* Scans the database for KFHDR chunk and returnes its release level */ releaselevel3ds GetKfRelease3ds(database3ds *db) { chunk3ds *c = NULL, *kfdata; if (db == NULL) SET_ERROR_RETURNR(ERR_INVALID_ARG, ReleaseNotKnown3ds); if (db->topchunk == NULL) SET_ERROR_RETURNR(ERR_INVALID_DATABASE, ReleaseNotKnown3ds); /* If the database is a 3DS file */ if ((db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) { FindChunk3ds(db->topchunk, KFDATA, &kfdata); if (kfdata != NULL) FindChunk3ds(db->topchunk, KFHDR, &c); if (c != NULL) { KFHdr *d; d = ReadChunkData3ds(c); if (d->revision == 1) return Release13ds; else if (d->revision == 2) return Release23ds; else if (d->revision == 5) return Release33ds; else return ReleaseNotKnown3ds; } else return ReleaseNotKnown3ds; } else return ReleaseNotKnown3ds; }