/*******************************************************************************
 *	ATI 3D RAGE SDK sample code												   *	
 *																			   *
 *  Knight Demo																   *
 *																			   *
 *  Copyright (c) 1996-1997 ATI Technologies, Inc.  All rights reserved.	   *	
 *																			   *
 * Written by Aaron Orenstein												   *
 *  																		   *
 *	The base sequence and set up for the Knight Demo world. All other modes    *
 *	(movement and death sequences) will require this. Includes initialization, *
 *	drawing and clean-up code for the default demo features and objects and    *		 
 *	movements. Castle, landscape, sky, sun, water and knight are considered    *
 *	defaults. Drawing code also includes shadowing for all default objects.	   *
 *******************************************************************************/
#ifndef NORMALMODE_H
#define NORMALMODE_H
// -----------------------------------------------------------------------------

#include "font.h"
#include "physics.h"

class Clipper;
class Poly;
class Object;

// -----------------------------------------------------------------------------

class NormalMode {
public:
	static void Cleanup(void) throw(Exception);
	static void Initialize(void) throw(Exception);

	static void Paint(IDirectDrawSurface* pSurface, IDirectDrawSurface* pZBuffer) throw(DD_Exception);
	static void Physics(PhysicsType type) throw();

	static void LookAt(const Vector& vector);

	static BOOL		m_drawSky;
	static BOOL		m_drawLand;
	static BOOL		m_drawCastle;
	static BOOL		m_drawKnight;
	static BOOL		m_drawUser;
	static BOOL		m_drawTiming;
	static BOOL		m_depthCue;
	static BOOL		m_lighting;
	static BOOL		m_knightShadow;

	static Vector	m_knightPosition;
	static Matrix	m_knightRotation;
	static Vector	m_cameraPosition;
	static Matrix	m_cameraRotation;

	static void (*m_pDrawSky)(Clipper& rClipper) throw(Exception);
	static void (*m_pDrawCastle)(Clipper& rClipper) throw(Exception);
	static void (*m_pDrawKnight)(Clipper& rClipper) throw(Exception);
	static void (*m_pDrawPedestal)(Clipper& rClipper) throw(Exception);
	static void (*m_pDrawLandscape)(Clipper& rClipper) throw(Exception);
	static void (*m_pUserDraw)(Clipper& rClipper) throw(Exception);

	static void SetMode(void);

	static Ati3dContext* Context(void) { return m_pContext; }

protected:
private:
	static Ati3dContext* m_pContext;

	static void DrawScene(void);

	static void DrawKnight(Clipper& rClipper) throw(Exception);
	static void DrawCastle(Clipper& rClipper) throw(Exception);
	static void DrawLandscape(Clipper& rClipper) throw(Exception);

	static Poly*		m_pSun;
	static void InitSun(void);
	static void DrawSun(Clipper& rClipper) throw(Exception);

	static void DrawKnightShadow(Clipper& rClipper) throw(Exception);
};

// -----------------------------------------------------------------------------

extern Object*				g_pKnight;
extern Ati3dTexture*		g_pKnightTexture;
extern Ati3dTexture*		g_pLandscapeTexture;
extern FontSurface*			g_pSimpleFont;
extern Vector				g_sunPosition;

// -----------------------------------------------------------------------------
#endif
