/*****************************************************************************
 * $Id: game_base_tracer.hh,v 1.3 2006/08/03 02:17:21 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	Tracer class.
 *//*
 * LEGAL:	COPYRIGHT (C) JIM E. BROOKS 2006
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

#if COMPILING_GAME
#ifndef GAME_BASE_TRACER_HH
#define GAME_BASE_TRACER_HH 1

////////////////////////////////////////////////////////////////////////////////
/// @brief Tracer class is for animating gun tracer rounds.
///
/// How long a tracer is translated is determined by
/// how many frames have passed, not milliseconds,
/// in order to give guns a consistent range in case
/// the program is running too slow relative to the timer.
///
class Tracer : public DynaMesh
{
private:
	PREVENT_COPYING(Tracer)
	typedef DynaMesh Parent;

public:
                        Tracer( Dyna& dyna, const LocalVertex& gunPort );
                        ~Tracer();
	// Object abstract methods:
	void				FinalConstruction( void ) { CalcRadiusAdjustPosition(); }
	void                Draw( void );
	const string		GetName( void ) { return string("Tracer"); }
	// Dyna virtual methods:
	uint				GetVertexCnt( void ) { return 8; }
    LocalVertex*		GetLocalVertexs( void ) { return mLocalVertexs; }
	int                 Animate( void );
	// Dyna abstract methods:
	void                Reset( void ) { }
	void                Rotate( uint axis, fp deg ) { }
	void                Translate( uint axis, fp inc );

	void SetVertexCnt( uint vcnt ) { }				// OBJECT NOP
	void SetWorldVertexs( WorldVertex* wv ) { }		// OBJECT NOP

private:
	bool                DetectHit( void );
	bool                CollisionDetectionCraft( Dlist<Craft>& dlist );
	bool                CollisionDetectionDynaModel( Dlist<DynaModel>& dlist );
	void                Stop( void );

	Dyna&				mGunner;				///< who fired
	short				mFrameCntDown;      	///< to stop animation
	enum {				mFrameCntDownStart = 70 };
	int					mMilsecCnt;
	int					mMilsecCntExplosion;
	Dlink<Tracer>*		mLinkTracer;			///< link in animation list
	static LocalVertex	mLocalVertexs[];
};

#endif // GAME_BASE_TRACER_HH
#endif // COMPILING_GAME
