#ifndef _NIGHTMARE_H
#define _NIGHTMARE_H

//---------------------------------------------------------------------------
// defines
//---------------------------------------------------------------------------
#define MAX_REAPER_DEATH      10
#define MAX_PENTAGRAM_FRAMES  27

//---------------------------------------------------------------------------
// typedefs
//---------------------------------------------------------------------------
typedef struct {
   weapon_t weapon;                       // weapon_t must be first entry

   short transadd;
   short starttrack;
   short count;                                 // number of ent's to kill
   short deathnum;                              // ent in list to kill
   userEntity_t *deathList[MAX_REAPER_DEATH];   // list of ent's to kill

   think_t old_prethink;
   think_t old_think;
   pain_t old_pain;
   die_t old_die;
   vec3_t old_velocity,old_avelocity;
   int old_movetype;
} nightmare_t;

//---------------------------------------------------------------------------
// globals
//---------------------------------------------------------------------------
extern weaponInfo_t nightmareWeaponInfo;

//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
static userInventory_t *give(userEntity_t *self);
static void select(userEntity_t *self);
static void *command(struct userInventory_s *ptr, char *commandStr, void *data);
static void use(userInventory_s *ptr, userEntity_t *self);
static void touch(userEntity_t *self, userEntity_t *other,cplane_t *plane, csurface_t *surf);
static void tracePentagram(userEntity_t *self);
static void doPentagram(userEntity_t *self);
static void timeToDie(userEntity_t *self);
static void initReaperAttack(userEntity_t *self);
static void death(userEntity_t *self);
static void freezeEntity(userEntity_t *owner,userEntity_t *ent,nightmare_t *nightmare);
static void unfreezeEntity(userEntity_t *ent,nightmare_t *nightmare);

#endif