//-----------------------------------------------------------------------------
//
//  $Logfile:: /game/gibs.h                                                   $
// $Revision:: 2                                                              $
//   $Author:: Burgermac                                                      $
//     $Date:: 12/27/00 6:50 PM                                               $
//
// Copyright (C) 1998 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:
// Gibs - nuff said

#ifndef __GIBS_H__
#define __GIBS_H__

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

class Gib : public Entity
{
private:
	qboolean sprayed;
public:
	CLASS_PROTOTYPE( Gib );

	qboolean fadesplat;
	Gib();
	Gib( const char* name, qboolean blood_trail = true );
	void     SetVelocity( float health );
	void     SprayBlood( Vector start, Vector end, int damage );
	void     Throw( Event* ev );
	void     Splat( Event* ev );
	void     ClipGibVelocity( void );
	virtual void Archive( Archiver& arc );
	virtual void Unarchive( Archiver& arc );
};

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

	arc.WriteBoolean( sprayed );
	arc.WriteBoolean( fadesplat );
}

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

	sprayed = arc.ReadBoolean();
	fadesplat = arc.ReadBoolean();
}

void CreateGibs( Entity* ent, float damage = -50, float scale = 1.0f, int num = 1, const char* modelname = NULL );

extern Event EV_ThrowGib;

#endif // gibs.h
