/* Copyright Steve Rabin, 2005. 
 * All rights reserved worldwide.
 *
 * This software is provided "as is" without express or implied
 * warranties. You may freely copy and compile this source into
 * applications you distribute provided that the copyright text
 * below is included in the resulting source code, for example:
 * "Portions Copyright Steve Rabin, 2005"
 */

#pragma once

#include "singleton.h"
#include "debugdrawing.h"

#define TERRAIN_WIDTH 20

class Terrain : public Singleton <Terrain>
{
public:

	Terrain( void );
	~Terrain( void ) {}


	void Create( void );
	void NextMap( void );
	int GetMapIndex( void )					{ return( m_nextMap ); }

	D3DXVECTOR3 GetCoordinates( int r, int c );
	bool GetRowColumn( D3DXVECTOR3* pos, int* r, int* c );
	inline bool IsWall( int r, int c )		{ return( m_terrain[r][c] < 0 ); }

	void SetColor( int r, int c, DebugDrawingColor color );
	void ResetColors( void );

	void DrawDebugVisualization( IDirect3DDevice9* pd3dDevice );

protected:

	int m_nextMap;
	float m_terrain[TERRAIN_WIDTH][TERRAIN_WIDTH];
	DebugDrawingColor m_terrainColor[TERRAIN_WIDTH][TERRAIN_WIDTH];

};
