
#ifndef __SCENICS_H__
#define __SCENICS_H__

typedef struct SCENICSTR
{
	struct SCENICSTR *next;

	int			flags;
	int			tag;

//	VECTOR		pos;	// while there is a position inside the actor, we need an initial value in the bff
	PSIMODEL	*pModel;	// In a BFF, this is stored in crc form
	ACTOR		*pActor;

	char		inventory_item_number;
	char		state, oldState;
	char		pickup_index;

	short		ya;
	short		dummy2[1];

	void		*pNoise;

	int sparezeroes[5];
}SCENIC;

#define BFF_SCENIC_ID (('S'<<0) | ('N'<<8) | ('C'<<16) | (0<<24))

#define SCENICFLAG_FROMBFF				(1)
#define SCENICFLAG_ACTIVE				(2)
#define SCENICFLAG_NEEDSACTOR			(4)
#define SCENICFLAG_IS_INVENTORY_ITEM	(8)	// *which* inventory item is determined from the crc of the obename
#define SCENICFLAG_IS_INTERESTING		(16)	// Whether or not Ginger should look at it as she walks by
#define SCENICFLAG_IS_BUTTON			(32)
#define SCENICFLAG_IS_SWITCH			(64)
#define SCENICFLAG_IS_CLINGY_FOR_RATS	(128)
#define SCENICFLAG_IS_SPROUTBOX			(256)

#define SCENICSTATE_SWITCH_OFF			(0)
#define SCENICSTATE_SWITCH_ON			(1)

typedef struct SCENIC_BFF
{
	unsigned long id;	// start with a BFF header, with an eye to the future
	int length;
	unsigned long name_crc;

	int n_scenics;
// Followed by "n_scenics" vectors
// Followed immediately by an array of scenics

}SCENIC_BFF;


SCENIC *scenicCreate(char *psiname,VECTOR *pos);
void scenicLinkBFF(SCENIC_BFF *sb);
void scenicPostBFF();

void scenicFree(SCENIC *pS);

void scenicInit();
void scenicCycle(void);
void scenicDrawAll();
void scenicEnd();

SCENIC *scenicFind(int tag);
void scenicEnable(SCENIC *pS, int enable);
int scenicIsEnabled(SCENIC *pS);

#define SCENIC_LOOP 256
#define SCENIC_QUEUE	512
#define SCENIC_REVERSE	1024

extern SCENIC *scenicList;

// Low byte's of flags is passed to the tweener
// scenicSetAnim can cope with pS = NULL, for simplicity of external coding
void scenicSetAnim(SCENIC *pS, int anim, int flags);

// For using scenics as the pickupable version of inventory objects...
// (1) Call from the character routine when you want to try to pick something up.
//     (Returns a scenic pointer if one's there, and is an inventory item)
SCENIC * scenicAvailableForPickup(VECTOR *characterpos, short characterangle);


// (2) Call from the inventory routine when a scenic inventory item is picked up, or needs re-spotting
#define SCENIC_INVENTORY_RESPOT		0	// You died. Put the object back.
#define SCENIC_INVENTORY_PICKINGUP	1	// You picked the object up & put it in the inventory
#define SCENIC_INVENTORY_REMOVING	2	// You game the object to a work-hut chicken and want to remove it from the world
void scenicInventoryNotification(int inventory_item, int what);

SCENIC *scenicNear(VECTOR *characterpos, short characterangle, short dist);
SCENIC *scenicNearARatClingThing(VECTOR *characterpos, short characterangle);

void scenicFindInteresting(VECTOR *character_pos, int character_dir, VECTOR **best, int *max_range);

#endif
