view LightClone/Source/Environment.h @ 60:b0f642ee22d3

Additional maps
author koryspansel <koryspansel@bendbroadband.com>
date Mon, 03 Oct 2011 08:58:08 -0700
parents 91e927584f92
children 3507bd831c7f
line wrap: on
line source

/*
 * Environment
 */

#ifndef __ENVIRONMENT_H__
#define __ENVIRONMENT_H__

#include "Core.h"
#include "RenderContext.h"
#include "ResourceManager.h"

/*
 * Tower
 */
struct Tower
{
	/*
	 * Type
	 */
	uint32 Type;

	/*
	 * Height
	 */
	uint32 Height;

	/*
	 * State
	 */
	uint32 State;

	/*
	 * User
	 */
	uint32 User;

public:

	/*
	 * Tower
	 */
	Tower() : Type(0), Height(1), State(0), User(0)
	{
	}
};

/*
 * Environment
 */
class Environment
{
	/*
	 * pEffect
	 */
	ID3DXEffect* pEffect;

	/*
	 * pVertexBuffer
	 */
	IDirect3DVertexBuffer9* pVertexBuffer;

	/*
	 * pTexture
	 */
	IDirect3DTexture9* pTexture;

	/*
	 * nWidth
	 */
	uint32 nWidth;

	/*
	 * nHeight
	 */
	uint32 nHeight;

	/*
	 * kScale
	 */
	D3DXVECTOR3 kScale;

	/*
	 * pGrid
	 */
	Tower* pGrid;

public:

	/*
	 * Environment
	 */
	Environment();

	/*
	 * ~Environment
	 */
	~Environment();

	/*
	 * Initialize
	 */
	ErrorCode Initialize(ResourceManager* pResourceManager);

	/*
	 * Terminate
	 */
	void Terminate();

	/*
	 * Setup
	 */
	ErrorCode Setup(uint32 nGridWidth, uint32 nGridHeight);

	/*
	 * Reset
	 */
	void Reset();

	/*
	 * Update
	 */
	void Update(float fElapsed);

	/*
	 * Render
	 */
	void Render(RenderContext& kContext, Camera& kCamera);

	/*
	 * GetWidth
	 */
	uint32 GetWidth() const;

	/*
	 * GetHeight
	 */
	uint32 GetHeight() const;

	/*
	 * GetScale
	 */
	const D3DXVECTOR3& GetScale() const;

	/*
	 * SetType
	 */
	void SetType(uint32 nX, uint32 nY, uint32 nType);

	/*
	 * GetType
	 */
	uint32 GetType(uint32 nX, uint32 nY) const;

	/*
	 * SetAltitude
	 */
	void SetAltitude(uint32 nX, uint32 nY, uint32 nHeight);

	/*
	 * GetAltitude
	 */
	uint32 GetAltitude(uint32 nX, uint32 nY) const;

	/*
	 * GetState
	 */
	uint32 GetState(uint32 nX, uint32 nY) const;

	/*
	 * IsMovementValid
	 */
	bool IsMovementValid(uint32 nAction, int32 nX, int32 nY, uint32 nDirection);

	/*
	 * RequirementsMet
	 *	Used to determine if the requirements for completing a 
	 *  given map have been satisfied.
	 */
	bool RequirementsMet() const;

	/*
	 * NotifyAction
	 *	Used by objects to notify the environment of changes
	 */
	void NotifyAction(uint32 nX, uint32 nY);

private:

	/*
	 * SetupVertexBuffer
	 */
	ErrorCode SetupVertexBuffer();
};

#endif //__ENVIRONMENT_H__