//-----------------------------------------------------------------------------
//
//  $Logfile:: /game/mover.h                                                  $
// $Revision:: 2                                                              $
//   $Author:: Burgermac                                                      $
//     $Date:: 12/27/00 7:52 PM                                               $
//
// Copyright (C) 1997 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// DESCRIPTION:
// Base class for any object that needs to move to specific locations over a
// period of time.  This class is kept separate from most entities to keep
// class size down for objects that don't need such behavior.
//

#ifndef __MOVER_H__
#define __MOVER_H__

#include "g_local.h"
#include "entity.h"
#include "trigger.h"

class Mover : public Trigger
{
private:
	Vector finaldest;
	Vector angledest;
	Event endevent;
	int moveflags;

public:
	CLASS_PROTOTYPE( Mover );

	void                    MoveDone( Event* ev );
	void                    MoveTo( Vector tdest, Vector angdest, float tspeed, Event& event );
	void                    LinearInterpolate( Vector tdest, Vector angdest, float time, Event& event );
	virtual void      Archive( Archiver& arc );
	virtual void      Unarchive( Archiver& arc );
};

inline void Mover::Archive( Archiver& arc )
{
	Trigger::Archive( arc );

	arc.WriteVector( finaldest );
	arc.WriteVector( angledest );
	arc.WriteEvent( endevent );
	arc.WriteInteger( moveflags );
}

inline void Mover::Unarchive( Archiver& arc )
{
	Trigger::Unarchive( arc );

	arc.ReadVector( &finaldest );
	arc.ReadVector( &angledest );
	arc.ReadEvent( &endevent );
	moveflags = arc.ReadInteger();
}

#endif
