This commit is contained in:
Walter Julius Hennecke 2014-03-10 00:23:53 +01:00
parent e6ea22ee1a
commit 61be76cf60

View file

@ -31,67 +31,66 @@ class CombatSubsystem;
// //
// Encapsulates combat related data and functionality for the actor // Encapsulates combat related data and functionality for the actor
// //
class CombatSubsystem class CombatSubsystem {
{
public: public:
CombatSubsystem(); CombatSubsystem();
CombatSubsystem( Actor *actor ); CombatSubsystem(Actor* actor);
~CombatSubsystem(); ~CombatSubsystem();
bool CanAttackTarget ( Entity *target ); bool CanAttackTarget(Entity* target);
bool CanAttackTargetFrom ( Entity *target , const Vector &startPos ); bool CanAttackTargetFrom(Entity* target, const Vector& startPos);
bool IsTargetInWeaponRange ( Entity *target ); bool IsTargetInWeaponRange(Entity* target);
bool UsingWeaponNamed ( const str &weaponName ); bool UsingWeaponNamed(const str& weaponName);
bool WeaponIsFireType ( firetype_t fire_type ); bool WeaponIsFireType(firetype_t fire_type);
bool HaveWeapon (); bool HaveWeapon();
bool CanAttackEnemy (); bool CanAttackEnemy();
void UseActorWeapon (const str &weaponName , weaponhand_t hand ); void UseActorWeapon(const str& weaponName, weaponhand_t hand);
void SetTraceInterval ( float interval ); void SetTraceInterval(float interval);
void FireWeapon (); void FireWeapon();
void StopFireWeapon (); void StopFireWeapon();
void AimWeaponTag (Entity *target); void AimWeaponTag(Entity* target);
void AimWeaponTag (const Vector &targetPos); void AimWeaponTag(const Vector& targetPos);
void ClearAim (); void ClearAim();
void GetGunPositionData ( Vector *pos , Vector *forward = NULL, Vector *right = NULL, Vector *up = NULL ); void GetGunPositionData(Vector* pos, Vector* forward = NULL, Vector* right = NULL, Vector* up = NULL);
float GetAimGunYaw ( const Vector &target ); float GetAimGunYaw(const Vector& target);
float GetAimGunPitch ( const Vector &target ); float GetAimGunPitch(const Vector& target);
WeaponPtr GetBestAvailableWeapon ( Entity *target ); WeaponPtr GetBestAvailableWeapon(Entity* target);
float GetActiveWeaponPowerRating ( Entity *target ); float GetActiveWeaponPowerRating(Entity* target);
str GetActiveWeaponName (); str GetActiveWeaponName();
str GetActiveWeaponArchetype(); str GetActiveWeaponArchetype();
bool GetProjectileLaunchAngles( Vector &launchAngles, const Vector &launchPoint, const float initialSpeed, const float gravity , const bool useHighTrajectory = false ) const; bool GetProjectileLaunchAngles(Vector& launchAngles, const Vector& launchPoint, const float initialSpeed, const float gravity, const bool useHighTrajectory = false) const;
bool shouldArcProjectile(); bool shouldArcProjectile();
float GetLowArcRange(); float GetLowArcRange();
void OverrideSpread ( float spreadX , float spreadY ); void OverrideSpread(float spreadX, float spreadY);
const str GetAnimForMyWeapon( const str& property ); const str GetAnimForMyWeapon(const str& property);
float GetDataForMyWeapon( const str& property ); float GetDataForMyWeapon(const str& property);
Vector GetLeadingTargetPos( float projSpeed , Vector originalTargetPos , Entity *target ); Vector GetLeadingTargetPos(float projSpeed, Vector originalTargetPos, Entity* target);
// Archiving // Archiving
void DoArchive ( Archiver &arc , Actor *actor ); void DoArchive(Archiver& arc, Actor* actor);
virtual void Archive ( Archiver &arc ); virtual void Archive(Archiver& arc);
protected: protected:
void _init(); void _init();
bool _traceHitTarget ( Entity *target , const Vector &startPos ); bool _traceHitTarget(Entity* target, const Vector& startPos);
float getModifiedPowerRating ( Entity *target , Weapon *weapon ); float getModifiedPowerRating(Entity* target, Weapon* weapon);
private: private:
ActiveWeapon _activeWeapon; ActiveWeapon _activeWeapon;
float _nextTimeTracedToTarget; float _nextTimeTracedToTarget;
float _traceInterval; float _traceInterval;
bool _canShootTarget; bool _canShootTarget;
float _yawDiff; float _yawDiff;
Actor *act; Actor* act;
}; };
#endif /* __ACTOR_COMBAT_SUBSYSTEM_H__ */ #endif /* __ACTOR_COMBAT_SUBSYSTEM_H__ */