131 lines
2.9 KiB
C++
131 lines
2.9 KiB
C++
#ifndef __CROSSBOW_H__
|
|
#define __CROSSBOW_H__
|
|
|
|
#include "g_local.h"
|
|
#include "item.h"
|
|
#include "weapon.h"
|
|
#include "misc.h"
|
|
#include "player.h"
|
|
|
|
// time it takes to fully charge plasma bow (in seconds)
|
|
//#define CHARGE_TIME 3.0
|
|
//#define CHARGE_TIME 2.5
|
|
#define CHARGE_TIME 1.6
|
|
// number of times it will cycle through the full charge
|
|
// animation before automatically firing off. Will give
|
|
// warning sound on last cycle. Each cycle is 2 seconds long
|
|
#define MAX_FULL_CYCLES 4
|
|
/*
|
|
class EXPORT_FROM_DLL CBTracer:public Entity
|
|
{
|
|
private:
|
|
float fadetype;
|
|
Vector start;
|
|
Vector end;
|
|
public:
|
|
CLASS_PROTOTYPE(CBTracer);
|
|
|
|
CBTracer();
|
|
virtual void Animate(Event *ev);
|
|
virtual void Setup(Vector pos, Vector dir, int tracerframe, int charge);
|
|
|
|
virtual void Archive(Archiver &arc);
|
|
virtual void Unarchive(Archiver &arc);
|
|
};
|
|
|
|
inline EXPORT_FROM_DLL void CBTracer::Archive (Archiver &arc)
|
|
{
|
|
Entity::Archive( arc );
|
|
|
|
arc.WriteFloat(fadetype);
|
|
arc.WriteVector(start);
|
|
arc.WriteVector(end);
|
|
}
|
|
|
|
inline EXPORT_FROM_DLL void CBTracer::Unarchive (Archiver &arc)
|
|
{
|
|
Entity::Unarchive( arc );
|
|
|
|
arc.ReadFloat(&fadetype);
|
|
arc.ReadVector(&start);
|
|
arc.ReadVector(&end);
|
|
}
|
|
*/
|
|
|
|
class EXPORT_FROM_DLL PBolt : public Projectile
|
|
{
|
|
private:
|
|
float speed;
|
|
// int owner;
|
|
|
|
public:
|
|
CLASS_PROTOTYPE(PBolt);
|
|
|
|
int charge; // stored here as a percentage of full charge
|
|
|
|
void EnergyTrail(Event *ev);
|
|
void BoltTouch(Event *ev);
|
|
void Explode(Event *ev);
|
|
void Setup(Entity *owner, Vector pos, Vector dir, int firecharge);
|
|
|
|
virtual void Archive(Archiver &arc);
|
|
virtual void Unarchive(Archiver &arc);
|
|
};
|
|
|
|
inline EXPORT_FROM_DLL void PBolt::Archive (Archiver &arc)
|
|
{
|
|
Projectile::Archive( arc );
|
|
|
|
arc.WriteFloat(speed);
|
|
// arc.WriteInteger(owner);
|
|
arc.WriteInteger(charge);
|
|
}
|
|
|
|
inline EXPORT_FROM_DLL void PBolt::Unarchive (Archiver &arc)
|
|
{
|
|
Projectile::Unarchive( arc );
|
|
|
|
arc.ReadFloat(&speed);
|
|
// arc.ReadInteger(&owner);
|
|
arc.ReadInteger(&charge);
|
|
}
|
|
|
|
class EXPORT_FROM_DLL PlasmaBow : public Weapon
|
|
{
|
|
public:
|
|
CLASS_PROTOTYPE(PlasmaBow);
|
|
|
|
int fullcycles; // number of cycles for full charge animation
|
|
float chargetime; // starting time of charging
|
|
int drainammo; // amount of ammo to drain at that time;
|
|
|
|
PlasmaBow();
|
|
virtual void SecondaryUse(Event *ev);
|
|
virtual void Fire(void);
|
|
virtual void FullRetain(Event *ev);
|
|
virtual void Shoot(Event *ev);
|
|
virtual void ReleaseCheck(Event *ev);
|
|
|
|
virtual void Archive(Archiver &arc);
|
|
virtual void Unarchive(Archiver &arc);
|
|
};
|
|
|
|
inline EXPORT_FROM_DLL void PlasmaBow::Archive (Archiver &arc)
|
|
{
|
|
Weapon::Archive( arc );
|
|
|
|
arc.WriteInteger(fullcycles);
|
|
arc.WriteFloat(chargetime);
|
|
arc.WriteInteger(drainammo);
|
|
}
|
|
|
|
inline EXPORT_FROM_DLL void PlasmaBow::Unarchive (Archiver &arc)
|
|
{
|
|
Weapon::Unarchive( arc );
|
|
|
|
arc.ReadInteger(&fullcycles);
|
|
arc.ReadFloat(&chargetime);
|
|
arc.ReadInteger(&drainammo);
|
|
}
|
|
|
|
#endif /* crossbow.h */
|