#ifndef _ZEUS_H
#define _ZEUS_H

//---------------------------------------------------------------------------
// defines
//---------------------------------------------------------------------------
#define ZEUS_MAX_FINGERS   5           // uh, one bolt per finger
#define ZEUS_MAX_BOLTLEN   20          // max ents used to create bolt
#define ZEUS_BOLT_LEN      36          // approximate length of the bolt model
#define ZEUS_MAX_CHAINS    3           //
#define ZEUS_MAX_BOLTS     ZEUS_MAX_FINGERS*ZEUS_MAX_CHAINS // max entities that can be hit at once
#define ZEUS_ADD_CHAIN     1
#define ZEUS_UPDATE_CHAIN  0

//---------------------------------------------------------------------------
// typedefs
//---------------------------------------------------------------------------
typedef struct {
   userEntity_t *ent;
   userEntity_t *bolt;           //[ZEUS_MAX_BOLTLEN];
   short chain;
   float killTime;
   userEntity_t *owner;                   // who shot this bolt
} zeusZap_t;

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

   zeusZap_t zap[ZEUS_MAX_BOLTS];
   userEntity_t *owner;                   // who used hand of zeus
   short numBolts;
} zeus_t;

//---------------------------------------------------------------------------
// globals
//---------------------------------------------------------------------------
extern weaponInfo_t zeusWeaponInfo;

//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
DllExport	void	weapon_zeus (userEntity_t *self);

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 th_spawnBolts(userEntity_t *self);
static void th_shock(userEntity_t *self);

static zeusZap_t *findTargets(zeus_t *zeus,userEntity_t *src,short num);
static void assignFingers(userEntity_t *src,zeus_t *zeus);
static void buildBolt(userEntity_t *src,zeusZap_t *zap,short chain,short slot);
static userEntity_t *spawnBoltSection(zeusZap_t *zap,Vector &pos,Vector &dir);
static void placeBoltSection(userEntity_t *ent,Vector &pos,Vector &dir);
static void killAllBolts(userEntity_t *self);

#endif