//-----------------------------------------------------------------------------
//
//  $Logfile:: /game/bouncingbetty.h                                          $
// $Revision:: 2                                                              $
//   $Author:: Burgermac                                                      $
//     $Date:: 12/27/00 7:00 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:
//

#ifndef __BOUNCINGBETTY_H__
#define __BOUNCINGBETTY_H__

#include "g_local.h"
#include "entity.h"
#include "archive.h"

#define BOUNCINGBETTY_RANGE 192

class BettyLauncher : public Entity
{
protected:
	qboolean firing;
	int activator;

public:
	CLASS_PROTOTYPE( BettyLauncher );

	BettyLauncher();
	qboolean        inRange( Entity* ent );
	void            CheckVicinity( Event* ev );
	void            Launch( Event* ev );
	void            AttackFinished( Event* ev );
	void            ReleaseBetty( Event* ev );
	void        Killed( Event* ev );
	virtual void Archive( Archiver& arc );
	virtual void Unarchive( Archiver& arc );
};

inline void BettyLauncher::Archive( Archiver& arc )
{
	Entity::Archive( arc );

	arc.WriteBoolean( firing );
	arc.WriteInteger( activator );
}

inline void BettyLauncher::Unarchive( Archiver& arc )
{
	Entity::Unarchive( arc );

	firing = arc.ReadBoolean();
	activator = arc.ReadInteger();
}

class BouncingBetty : public Entity
{
protected:
	int activator;

public:
	CLASS_PROTOTYPE( BouncingBetty );

	BouncingBetty();
	void        Launch( Vector pos, int activatorEnt );
	void        Detonate( Event* ev );
	void        Explode( Event* ev );
	virtual void Archive( Archiver& arc );
	virtual void Unarchive( Archiver& arc );
};

inline void BouncingBetty::Archive( Archiver& arc )
{
	Entity::Archive( arc );

	arc.WriteInteger( activator );
}

inline void BouncingBetty::Unarchive( Archiver& arc )
{
	Entity::Unarchive( arc );

	activator = arc.ReadInteger();
}

class BettySpike : public Entity
{
protected:
	int activator;

public:
	CLASS_PROTOTYPE( BettySpike );

	void        SpikeTouch( Event* ev );
	void        Setup( Vector pos, Vector dir );
	virtual void Archive( Archiver& arc );
	virtual void Unarchive( Archiver& arc );
};

inline void BettySpike::Archive( Archiver& arc )
{
	Entity::Archive( arc );

	arc.WriteInteger( activator );
}

inline void BettySpike::Unarchive( Archiver& arc )
{
	Entity::Unarchive( arc );

	activator = arc.ReadInteger();
}

#endif /* bouncingbetty.h */
