// Author : Chris Tolley
// Date   : 7/25/2004
// WaterPool.h contains the class declaration for a water pool derived from
// Object to use in the survival game

#if !defined(AFX_WATERPOOL_H__03C16646_29C3_4D23_83E9_EC184629FFB3__INCLUDED_)
#define AFX_WATERPOOL_H__03C16646_29C3_4D23_83E9_EC184629FFB3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>
using std::string;

#include "texture.h"
#include "Object.h"

// Forward class declarations
class quadTreeTerrain;

// Declare some contants to help
const float MAX_LEVEL  = 255;
// The amount of water this pool returns upon being drunk from
const int   WATER_UNIT = 8;
// The time it takes for a waterpool to raise to a decent level
const float RAISE_TIME = 16;

class WaterPool : public Object  
{
public:
	// Constructor.  x and z are the pool's position on the map
	WaterPool( int x, int z, int radius );

	// Destructor
	virtual ~WaterPool();

	// Initializes the static water pool data
	static void Initialize( quadTreeTerrain* qtTerrain, 
							const char* waterTexture );

	// Updates the object.  Must be implemented at a derived level
	void Update( float elapsedSec );

	// Renders the object to the screen. Must be implemented at a derived level
	void Render();

	// Returns true if this Object is inside the sphere.  Derived from Object
	bool InSphere( float x, float z, float radius );

	// Overloaded from Object.  WaterPools never die
	bool TimeToDie() { return false; };

	// Returns the amount of water available from this WaterPool
	int GetWaterUnits();

	// Returns true if there is any water left in this pool
	inline bool HasWater() const { return m_bHasWater; };

	// Returns a value indicating the type of object this object is
	inline string GetType() { return "waterpool"; };

	// Resets the state of the waterpool
	inline void Reset() { m_fLevel = MAX_LEVEL; m_bHasWater = true; };
private:
	// The y offset for the pool, ie the water level
	float m_fLevel;

	// The radius of the water level
	int m_iRadius;

	// True if this waterpool has water in it
	bool m_bHasWater;

	// The terrain that all the water pools are on
	static quadTreeTerrain* m_sqtTerrain;

	// The display list that is used to draw the terrain
	static unsigned int m_suiList;

	// The texture used to draw this water pool
	static texture m_Texture;
};

#endif // !defined(AFX_WATERPOOL_H__03C16646_29C3_4D23_83E9_EC184629FFB3__INCLUDED_)
