/****************************************************************************
*
* ROOM.H
*
* PROGRAMMER : Chris
*    VERSION : 00.00
*    CREATED : 01/06/98
*   MODIFIED : 01/06/98
*       TABS : 5
*
* DESCRIPTION
*	Header file containing room related structures and defintions
*
*****************************************************************************/

#ifndef _ROOM_H
#define _ROOM_H

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

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

#include "items.h"

/*---------------------------------------------------------------------------
 *	Constants
\*--------------------------------------------------------------------------*/

#ifdef __cplusplus
extern "C" {
#endif


#define MAX_ROOMS		1024		// should this be this high ?
#define MAX_FLIPMAPS 	10

/* -------- ROOM_INFO flags */

#define UNDERWATER	1
#define SFX_ALWAYS	2	// NOTE: this is used by ambient SFX not room->flags
#define PITCH_SHIFT	4
#define OUTSIDE	8
#define DYNAMIC_LIT 16
#define NOT_INSIDE	32	// OUTSIDE means sky room, NOT_INSIDE just means in the wind/mist etc
#define INSIDE		64	// INSIDE means room *not adjacent* to an OUTSIDE room!!
#define SWAMP		128

#define END_BIT     0x8000
#define VALUE_BITS  0x3ff
#define  DATA_TYPE	0x1f

#define WALL_L		1024
#define WALL_SHIFT	10
#define STEP_L		(WALL_L/4)

#define NO_ROOM 	0xff
#define NO_HEIGHT	(-0x7f00)

/*---------------------------------------------------------------------------
 *	Type Definitions
\*--------------------------------------------------------------------------*/

typedef struct {
	uint16 index;
	uint16 fx:4;
	uint16 box:11;
	uint16 stopper:1;	// Used for pushable blocks in conjunction with the electric cleaner.
	unsigned char pit_room;
	signed char floor;
	unsigned char sky_room;
	signed char ceiling;
}FLOOR_INFO;

typedef struct {
	sint16 nx, ny, nz;
	sint16 pad;
}SUNLIGHT;

typedef struct {
	sint32 intensity;
	sint32 falloff;
}SPOTLIGHT;

typedef struct {
	sint32 x;
	sint32 y;
	sint32 z;
	unsigned char r, g, b, type;
	union {
		SUNLIGHT sun;
		SPOTLIGHT spot;
	}l;
}LIGHT_INFO;

typedef struct {
	sint32 x;
	sint32 y;
	sint32 z;
	PHD_ANGLE	y_rot;
	sint16 shade, shadeB;
	sint16 static_number; // STATIC_INFO structure that contains bounding info
}MESH_INFO;

typedef struct room_info {
	sint16 *data;
	sint16 *door;
	FLOOR_INFO *floor;
	LIGHT_INFO *light;
	MESH_INFO	*mesh;
	sint32 x, y, z;
	sint32 minfloor, maxceiling;
	sint16 x_size, y_size;
	sint16 ambient, lighting;
	sint16 num_lights;
	sint16 num_meshes;
	sint16 ReverbType;
	char MeshEffect;
	char	bound_active;
	sint16 left;
	sint16 right;
	sint16 top;
	sint16 bottom;
	sint16 test_left, test_right, test_top, test_bottom; // 14/8/97: better bounds testing?
	sint16 item_number;
	sint16 fx_number;
	sint16 flipped_room;	// -1 normally, unless alternative room available
	uint16 flags;
}ROOM_INFO;

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

extern ROOM_INFO *room;
extern sint16 number_rooms;

extern sint16 *floor_data;


#ifdef __cplusplus
}
#endif



#endif
