

#ifndef __BFF_LOAD_H__
#define __BFF_LOAD_H__


// All the types of object that you stick into a BFF need to start with a standard header
// which allows the BFF routines to seek out specific objects on request.

// "id" is long something like "PSA0" or "COL1" for PSA and collision data,
// for identifying the TYPE of the block it is.

// "len" is the length of the block, including the header.

// "crc" is the CRC of the name of this specific entry, to distinguish it from any
// other blocks of the same type.

typedef struct BFF_HeaderTag
{
	unsigned long id;
	unsigned long len;
	unsigned long crc;
}BFF_Header;


// ===================================================================================
// General BFF functions, not specific to the frogger-map stuff
BFF_Header *BFF_LoadFile(char *filename);
void BFF_ReleaseFile(BFF_Header *header);

// Set CRC to zero if you know there's only one instance of that type in the BFF.
BFF_Header *BFF_FindObject(int id, unsigned long crc);
BFF_Header *BFF_FindNamedObject(int id, char *name);

int BFF_IsInBFF(void *addr);






// ===================================================================================
// And VH Sound files, in compiled form
// there aren't any vh's any more. Just sbh's
//#define BFF_VH_ID (('V'<<0) | ('H'<<8) | (' '<<16) | (0<<24))



// CPW: enemies too
#define BFF_ENEMY_ID (('N'<<0) | ('M'<<8) | ('E'<<16) | (1<<24))



// ===================================================================================
// I tend to stick these in a global header file, but they're not in the AM shell, so
// I've defined them here

#ifndef ADD2POINTER
	#define ADD2POINTER(a,b) ( (void *) ( (int)(a) + (b))  )
	#define SUBPOINTERS(a,b) (((int)((int)(a) - (int)(b))))
#endif
#ifndef CRASH
//	#define CRASH while(0==0)POLLHOST();
	#define CRASH while(0==0);
#endif



// ===================================================================================
// I've moved the PSI-linking functions that used to be in bff_load.h into custom.h, so
// to avoid unwanted warnings, here's an include

#ifndef _CUSTOM_H_
#include "custom.h"
#endif

#endif
