2012-12-30 16:37:54 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Logfile:: /Code/DLLs/game/actor_headwatcher.h $
|
|
|
|
// $Revision:: 10 $
|
|
|
|
// $Author:: Steven $
|
|
|
|
// $Date:: 10/13/03 8:53a $
|
|
|
|
//
|
|
|
|
// Copyright (C) 2001 by Ritual Entertainment, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// This source may not be distributed and/or modified without
|
|
|
|
// expressly written permission by Ritual Entertainment, Inc.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Head Watcher Class
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __ACTOR_HEADWATCHER_H__
|
|
|
|
#define __ACTOR_HEADWATCHER_H__
|
|
|
|
|
|
|
|
//============================
|
|
|
|
// Class HeadWatcher
|
|
|
|
//============================
|
|
|
|
class HeadWatcher
|
|
|
|
{
|
2015-04-29 20:34:44 +00:00
|
|
|
public:
|
|
|
|
HeadWatcher();
|
|
|
|
explicit HeadWatcher(Actor *actor);
|
|
|
|
virtual ~HeadWatcher();
|
|
|
|
|
|
|
|
void SetWatchTarget(Entity *ent);
|
|
|
|
void SetWatchTarget(const str &targetName);
|
|
|
|
void SetWatchSpeed(float speed);
|
|
|
|
void SetMaxHeadYaw(float max);
|
|
|
|
void SetMaxHeadPitch(float max);
|
|
|
|
void SetMaxDistance(float distance);
|
|
|
|
void SetIgnoreWatchTarget(bool ignore);
|
|
|
|
|
|
|
|
Entity* GetWatchTarget();
|
|
|
|
|
|
|
|
void ClearWatchTarget();
|
|
|
|
void HeadWatchTarget();
|
|
|
|
void AdjustHeadAngles(const Vector &tagPos, const Vector &watchPosition);
|
|
|
|
void LerpHeadBySpeed(const Vector &angleDelta, bool useTorsoAngles = true);
|
|
|
|
|
|
|
|
void setHeadTwitch(bool twitchHead);
|
|
|
|
void twitchHead(void);
|
|
|
|
|
|
|
|
// Archiving
|
|
|
|
virtual void Archive(Archiver &arc);
|
|
|
|
void DoArchive(Archiver &arc, Actor *actor);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void _init();
|
|
|
|
|
|
|
|
private:
|
|
|
|
EntityPtr _watchTarget;
|
|
|
|
Vector _currentHeadAngles;
|
|
|
|
float _maxHeadTurnSpeed;
|
|
|
|
float _turnThreshold;
|
|
|
|
qboolean _explicitSet;
|
|
|
|
float _maxHeadYaw;
|
|
|
|
float _maxHeadPitch;
|
|
|
|
|
|
|
|
bool _twitchHead;
|
|
|
|
float _nextTwitchHeadTime;
|
|
|
|
Vector _headTwitchAngles;
|
|
|
|
float _maxDistance;
|
|
|
|
bool _ignoreWatchTarget;
|
|
|
|
|
|
|
|
Actor *act;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
inline void HeadWatcher::SetMaxHeadPitch(float max)
|
|
|
|
{
|
|
|
|
_maxHeadPitch = max;
|
2012-12-30 16:37:54 +00:00
|
|
|
}
|
|
|
|
|
2015-04-29 20:34:44 +00:00
|
|
|
inline void HeadWatcher::SetMaxHeadYaw(float max)
|
2012-12-30 16:37:54 +00:00
|
|
|
{
|
2015-04-29 20:34:44 +00:00
|
|
|
_maxHeadYaw = max;
|
2012-12-30 16:37:54 +00:00
|
|
|
}
|
|
|
|
|
2015-04-29 20:34:44 +00:00
|
|
|
inline void HeadWatcher::SetMaxDistance(float distance)
|
2012-12-30 16:37:54 +00:00
|
|
|
{
|
2015-04-29 20:34:44 +00:00
|
|
|
_maxDistance = distance;
|
2012-12-30 16:37:54 +00:00
|
|
|
}
|
|
|
|
|
2015-04-29 20:34:44 +00:00
|
|
|
inline void HeadWatcher::SetIgnoreWatchTarget(bool ignore)
|
2012-12-30 16:37:54 +00:00
|
|
|
{
|
2015-04-29 20:34:44 +00:00
|
|
|
_ignoreWatchTarget = ignore;
|
2012-12-30 16:37:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __ACTOR_HEADWATCHER_H__ */
|