/****************************************************************************
*
* CONTROL.H
*
* PROGRAMMER : Chris
*    VERSION : 00.00
*    CREATED : 01/06/98
*   MODIFIED : 01/06/98
*       TABS : 5
*
* DESCRIPTION
*	Header file for CONTROL.C
*
*****************************************************************************/

#ifndef _CONTROL_H
#define _CONTROL_H

#ifdef __cplusplus
extern "C" {
#endif

/*---------------------------------------------------------------------------
 *	Import Headers
\*--------------------------------------------------------------------------*/

#ifdef PSX_VERSION
#include "../spec_psx/typedefs.h"
#else
#include "..\specific\stypes.h"
#endif

#include "items.h"
#include "anim.h"
#include "room.h"
#include "collide.h"

/*---------------------------------------------------------------------------
 *	Prototypes
\*--------------------------------------------------------------------------*/

extern uchar CurrentAtmosphere;
extern uchar IsAtmospherePlaying;
extern int compy_scared_timer;
extern int compys_attack_lara;
extern sint16 CarcassItem;

/* -------- outside room stuff */
extern char *OutsideRoomTable;
extern short OutsideRoomOffsets[27*27];	// -1 = no rooms
extern short IsRoomOutsideNo;
extern sint32 IsRoomOutside(sint32 x, sint32 y, sint32 z);

extern sint16 FXType;

extern	int	OnObject;
extern ITEM_INFO *CeilingObject;

extern sint16 *trigger_index;		// global set by GetHeight()
extern int chunky_flag;

extern int flip_status;
extern int flipmap[];
extern int flipeffect;
extern int fliptimer;

extern char cd_flags[];
extern sint16 cdtrack;

extern int noinput_count;
extern int reset_flag;

extern sint32 ControlPhase(sint32 nframes, int demo_mode);
//extern void DummyControl(sint16 item_number);

#if 0
extern int ClipTarget(GAME_VECTOR *start, GAME_VECTOR *target, FLOOR_INFO *floor);
#else
extern int ClipTarget(GAME_VECTOR *start, GAME_VECTOR *target);
#endif
extern void AnimateItem(ITEM_INFO *item);
extern int GetChange(ITEM_INFO *item, ANIM_STRUCT *anim);
extern void TranslateItem(ITEM_INFO *item, sint32 x, sint32 y, sint32 z);

extern FLOOR_INFO *GetFloor(sint32 x, sint32 y, sint32 z, sint16 *room_number);
extern sint16 GetDoor(FLOOR_INFO *floor);
extern long CheckNoColFloorTriangle(FLOOR_INFO *floor, long x, long z);
extern long CheckNoColCeilingTriangle(FLOOR_INFO *floor, long x, long z);
extern sint32 GetHeight(FLOOR_INFO *floor, sint32 x, sint32 y, sint32 z);
extern sint32 GetWaterHeight(sint32 x, sint32 y, sint32 z, sint16 room_number);
extern sint32 GetCeiling(FLOOR_INFO *floor, sint32 x, sint32 y, sint32 z);


extern void TestTriggers(sint16 *data, int heavy);
extern int TriggerActive(ITEM_INFO *item);

extern void TriggerCDTrack(sint16 value, sint16 flags, sint16 type);
extern void TriggerNormalCDTrack(sint16 value, sint16 flags, sint16 type);

extern int LOS(GAME_VECTOR *start, GAME_VECTOR *target);
extern int xLOS(GAME_VECTOR *start, GAME_VECTOR *target);
extern int zLOS(GAME_VECTOR *start, GAME_VECTOR *target);
extern int ObjectOnLOS(GAME_VECTOR *start, GAME_VECTOR *target);

extern void FlipMap();
extern void RemoveRoomFlipItems(ROOM_INFO *r);
extern void AddRoomFlipItems(ROOM_INFO *r);

extern sint32 GetRandomControl();
extern sint32 GetRandomDraw();
extern void SeedRandomControl(sint32 seed);
extern void SeedRandomDraw(sint32 seed);


#ifdef __cplusplus
}
#endif

#endif

