mirror of
https://github.com/UberGames/EF2GameSource.git
synced 2025-02-20 18:42:21 +00:00
Various actor related updates
This commit is contained in:
parent
c2ef12ee0e
commit
1c2859a59d
23 changed files with 2203 additions and 2374 deletions
|
@ -310,8 +310,8 @@ void DefaultStrategos::_CheckForInTheWay()
|
|||
|
||||
if ( (relativeYaw <= _checkYawMax) && (relativeYaw >= _checkYawMin ) )
|
||||
{
|
||||
act->AddStateFlag( STATE_FLAG_TOUCHED_BY_PLAYER );
|
||||
act->AddStateFlag( STATE_FLAG_IN_THE_WAY );
|
||||
act->AddStateFlag( StateFlagTouchedByPlayer );
|
||||
act->AddStateFlag( StateFlagInTheWay );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -74,7 +74,7 @@ void CombatSubsystem::UseActorWeapon(const str& weaponName, weaponhand_t hand)
|
|||
act->DeactivateWeapon(WEAPON_LEFT);
|
||||
act->DeactivateWeapon(WEAPON_RIGHT);
|
||||
act->DeactivateWeapon(WEAPON_DUAL);
|
||||
act->AddStateFlag(STATE_FLAG_CHANGED_WEAPON);
|
||||
act->AddStateFlag(StateFlagChangedWeapon);
|
||||
act->ClearTorsoAnim();
|
||||
_activeWeapon.weapon = nullptr;
|
||||
|
||||
|
@ -97,7 +97,7 @@ void CombatSubsystem::UseActorWeapon(const str& weaponName, weaponhand_t hand)
|
|||
_activeWeapon.hand = hand;
|
||||
_activeWeapon.weapon->SetOwner(act);
|
||||
act->ActivateWeapon(weapon, hand);
|
||||
act->AddStateFlag(STATE_FLAG_CHANGED_WEAPON);
|
||||
act->AddStateFlag(StateFlagChangedWeapon);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ void CombatSubsystem::UseActorWeapon(const str& weaponName, weaponhand_t hand)
|
|||
_activeWeapon.hand = hand;
|
||||
_activeWeapon.weapon->SetOwner(act);
|
||||
act->ActivateWeapon(weapon, hand);
|
||||
act->AddStateFlag(STATE_FLAG_CHANGED_WEAPON);
|
||||
act->AddStateFlag(StateFlagChangedWeapon);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -628,7 +628,7 @@ void EnemyManager::Update()
|
|||
act->sensoryPerception->SenseEnemies();
|
||||
|
||||
|
||||
if (GetCurrentEnemy() || act->GetActorFlag(ACTOR_FLAG_INVESTIGATING) || act->mode == ACTOR_MODE_SCRIPT || act->mode == ACTOR_MODE_TALK)
|
||||
if (GetCurrentEnemy() || act->GetActorFlag(ACTOR_FLAG_INVESTIGATING) || act->mode == ActorModeScript || act->mode == ActorModeTalk)
|
||||
act->last_time_active = level.time;
|
||||
|
||||
// Take care of enemies
|
||||
|
@ -912,7 +912,7 @@ void EnemyManager::TrySleep(void)
|
|||
if (player)
|
||||
{
|
||||
//We should NOT fall asleep if:
|
||||
// our mode is ACTOR_MODE_IDLE _AND_ player flags are not equal to FlagNotarget
|
||||
// our mode is ActorModeIdle _AND_ player flags are not equal to FlagNotarget
|
||||
// OR
|
||||
// Player is within our vision distance
|
||||
// OR
|
||||
|
@ -920,19 +920,19 @@ void EnemyManager::TrySleep(void)
|
|||
|
||||
//
|
||||
// 7/15/02 -- SK
|
||||
// Added via && the "gi.inPVS( player->centroid, act->centroid )" to the ACTOR_MODE_IDLE
|
||||
// Added via && the "gi.inPVS( player->centroid, act->centroid )" to the ActorModeIdle
|
||||
// checks because, without it, all AI_OFF'd actors would still be considered "active"
|
||||
// and this was ruining the framerate... I do not believe this is going to have any
|
||||
// detrimental side effects.
|
||||
//
|
||||
if (act->mode == ACTOR_MODE_IDLE && !(player->flags & FlagNotarget) && gi.inPVS(player->centroid, act->centroid) || act->sensoryPerception->WithinVisionDistance(player) || gi.inPVS(player->centroid, act->centroid))
|
||||
if (act->mode == ActorModeIdle && !(player->flags & FlagNotarget) && gi.inPVS(player->centroid, act->centroid) || act->sensoryPerception->WithinVisionDistance(player) || gi.inPVS(player->centroid, act->centroid))
|
||||
{
|
||||
act->last_time_active = level.time;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (act->mode == ACTOR_MODE_AI)
|
||||
if (act->mode == ActorModeAi)
|
||||
{
|
||||
act->EndMode();
|
||||
|
||||
|
|
|
@ -13,317 +13,285 @@
|
|||
//
|
||||
//
|
||||
|
||||
#include "_pch_cpp.h"
|
||||
#include "actor_enemymanager.h"
|
||||
#include "player.h"
|
||||
#include "object.h"
|
||||
#include "_pch_cpp.h"
|
||||
|
||||
HeadWatcher::HeadWatcher()
|
||||
{
|
||||
// Should always use other constructor
|
||||
gi.Error( ERR_FATAL, "HeadWatcher::HeadWatcher -- Default Constructor Called" );
|
||||
|
||||
|
||||
// Should always use other constructor
|
||||
gi.Error(ERR_FATAL, "HeadWatcher::HeadWatcher -- Default Constructor Called");
|
||||
|
||||
|
||||
}
|
||||
|
||||
HeadWatcher::HeadWatcher( Actor *actor )
|
||||
HeadWatcher::HeadWatcher(Actor *actor)
|
||||
{
|
||||
//Initialize our Actor
|
||||
if ( actor )
|
||||
act = actor;
|
||||
else
|
||||
gi.Error( ERR_DROP, "HeadWatcher::HeadWatcher -- actor is NULL" );
|
||||
|
||||
_init();
|
||||
|
||||
//Initialize our Actor
|
||||
if (actor)
|
||||
act = actor;
|
||||
else
|
||||
gi.Error(ERR_DROP, "HeadWatcher::HeadWatcher -- actor is NULL");
|
||||
|
||||
_init();
|
||||
|
||||
}
|
||||
|
||||
HeadWatcher::~HeadWatcher()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void HeadWatcher::_init()
|
||||
{
|
||||
act->SetControllerTag( ACTOR_HEAD_TAG, gi.Tag_NumForName( act->edict->s.modelindex, "Bip01 Head" ) );
|
||||
|
||||
_currentHeadAngles = act->GetControllerAngles( ACTOR_HEAD_TAG );
|
||||
_watchTarget = NULL;
|
||||
|
||||
// Numbers here for testing, should come from events so they can be set via tiki or script
|
||||
_maxHeadTurnSpeed = 30.0f;
|
||||
_turnThreshold = 0.0f;
|
||||
_maxHeadYaw = 60.0f;
|
||||
_maxHeadPitch = 45.0f;
|
||||
|
||||
_twitchHead = false;
|
||||
_nextTwitchHeadTime = 0.0f;
|
||||
_maxDistance = -1.0;
|
||||
act->SetControllerTag(ActorHeadTag, gi.Tag_NumForName(act->edict->s.modelindex, "Bip01 Head"));
|
||||
|
||||
_explicitSet = false;
|
||||
_ignoreWatchTarget = false;
|
||||
_currentHeadAngles = act->GetControllerAngles(ActorHeadTag);
|
||||
_watchTarget = nullptr;
|
||||
|
||||
// Numbers here for testing, should come from events so they can be set via tiki or script
|
||||
_maxHeadTurnSpeed = 30.0f;
|
||||
_turnThreshold = 0.0f;
|
||||
_maxHeadYaw = 60.0f;
|
||||
_maxHeadPitch = 45.0f;
|
||||
|
||||
_twitchHead = false;
|
||||
_nextTwitchHeadTime = 0.0f;
|
||||
_maxDistance = -1.0;
|
||||
|
||||
_explicitSet = false;
|
||||
_ignoreWatchTarget = false;
|
||||
}
|
||||
|
||||
void HeadWatcher::SetWatchTarget( Entity *ent )
|
||||
void HeadWatcher::SetWatchTarget(Entity *ent)
|
||||
{
|
||||
_watchTarget = ent;
|
||||
_explicitSet = true;
|
||||
_watchTarget = ent;
|
||||
_explicitSet = true;
|
||||
}
|
||||
|
||||
void HeadWatcher::SetWatchTarget( const str &targetName )
|
||||
void HeadWatcher::SetWatchTarget(const str &targetName)
|
||||
{
|
||||
TargetList *tlist;
|
||||
int numObjects;
|
||||
|
||||
|
||||
tlist = world->GetTargetList( targetName );
|
||||
numObjects = tlist->list.NumObjects();
|
||||
|
||||
if ( numObjects == 0 )
|
||||
{
|
||||
//Hey, No targets with that name
|
||||
gi.WDPrintf( "No target with target name %s specified\n", targetName.c_str() );
|
||||
return;
|
||||
}
|
||||
else if ( numObjects > 1 )
|
||||
{
|
||||
//Uh Oh... We have more than one target... Let's throw up an error
|
||||
gi.WDPrintf( "More than one target with target name %s specified, grabbing first one\n", targetName.c_str() );
|
||||
}
|
||||
|
||||
_watchTarget = tlist->list.ObjectAt( 1 );
|
||||
_explicitSet = true;
|
||||
auto tlist = world->GetTargetList(targetName);
|
||||
auto numObjects = tlist->list.NumObjects();
|
||||
|
||||
if (numObjects == 0)
|
||||
{
|
||||
//Hey, No targets with that name
|
||||
gi.WDPrintf("No target with target name %s specified\n", targetName.c_str());
|
||||
return;
|
||||
}
|
||||
if (numObjects > 1)
|
||||
{
|
||||
//Uh Oh... We have more than one target... Let's throw up an error
|
||||
gi.WDPrintf("More than one target with target name %s specified, grabbing first one\n", targetName.c_str());
|
||||
}
|
||||
|
||||
_watchTarget = tlist->list.ObjectAt(1);
|
||||
_explicitSet = true;
|
||||
}
|
||||
|
||||
void HeadWatcher::SetWatchSpeed( float speed )
|
||||
void HeadWatcher::SetWatchSpeed(float speed)
|
||||
{
|
||||
_maxHeadTurnSpeed = speed;
|
||||
_maxHeadTurnSpeed = speed;
|
||||
}
|
||||
|
||||
void HeadWatcher::ClearWatchTarget()
|
||||
{
|
||||
_watchTarget = NULL;
|
||||
_explicitSet = false;
|
||||
_watchTarget = nullptr;
|
||||
_explicitSet = false;
|
||||
}
|
||||
|
||||
Entity *HeadWatcher::GetWatchTarget()
|
||||
{
|
||||
return _watchTarget;
|
||||
return _watchTarget;
|
||||
}
|
||||
|
||||
void HeadWatcher::HeadWatchTarget()
|
||||
{
|
||||
int tagNum;
|
||||
Vector tagPos;
|
||||
Vector watchPosition;
|
||||
Actor *actTarget;
|
||||
actTarget = NULL;
|
||||
|
||||
|
||||
tagNum = gi.Tag_NumForName( act->edict->s.modelindex, "Bip01 Head" );
|
||||
|
||||
if ( tagNum < 0 )
|
||||
return;
|
||||
|
||||
//Check if we even have an animation set yet
|
||||
if ( act->animate->CurrentAnim(legs) < 0 )
|
||||
return;
|
||||
auto tagNum = gi.Tag_NumForName(act->edict->s.modelindex, "Bip01 Head");
|
||||
|
||||
act->GetTag( "Bip01 Head", &tagPos );
|
||||
|
||||
if ( !_watchTarget || _ignoreWatchTarget )
|
||||
{
|
||||
if ( _twitchHead )
|
||||
{
|
||||
twitchHead();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
LerpHeadBySpeed( vec_zero , false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (tagNum < 0)
|
||||
return;
|
||||
|
||||
if (act->GetActorFlag( ACTOR_FLAG_DIALOG_PLAYING ) && act->GetActorFlag(ACTOR_FLAG_USING_HUD) )
|
||||
{
|
||||
LerpHeadBySpeed( vec_zero , false );
|
||||
return;
|
||||
}
|
||||
//Check if we even have an animation set yet
|
||||
if (act->animate->CurrentAnim(legs) < 0)
|
||||
return;
|
||||
|
||||
// Check if our _watchTarget is within distance )
|
||||
if ( _maxDistance > 0 )
|
||||
{
|
||||
Vector selfToTarget = _watchTarget->origin - act->origin;
|
||||
float dist = selfToTarget.length();
|
||||
Vector tagPos;
|
||||
act->GetTag("Bip01 Head", &tagPos);
|
||||
|
||||
if ( dist > _maxDistance )
|
||||
{
|
||||
LerpHeadBySpeed( vec_zero , false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!_watchTarget || _ignoreWatchTarget)
|
||||
{
|
||||
if (_twitchHead)
|
||||
{
|
||||
twitchHead();
|
||||
return;
|
||||
}
|
||||
LerpHeadBySpeed(vec_zero, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (act->GetActorFlag(ACTOR_FLAG_DIALOG_PLAYING) && act->GetActorFlag(ACTOR_FLAG_USING_HUD))
|
||||
{
|
||||
LerpHeadBySpeed(vec_zero, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if our _watchTarget is within distance )
|
||||
if (_maxDistance > 0)
|
||||
{
|
||||
auto selfToTarget = _watchTarget->origin - act->origin;
|
||||
auto dist = selfToTarget.length();
|
||||
|
||||
if (dist > _maxDistance)
|
||||
{
|
||||
LerpHeadBySpeed(vec_zero, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Actor* actTarget = nullptr;
|
||||
if (_watchTarget->isSubclassOf(Actor))
|
||||
{
|
||||
actTarget = dynamic_cast<Actor *>(static_cast<Entity *>(_watchTarget));
|
||||
|
||||
// Don't watch if the target is dead.
|
||||
if (!actTarget->isThinkOn())
|
||||
{
|
||||
_watchTarget = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Vector watchPosition;
|
||||
if (actTarget && actTarget->watch_offset != vec_zero)
|
||||
{
|
||||
MatrixTransformVector(actTarget->watch_offset, _watchTarget->orientation, watchPosition);
|
||||
watchPosition += _watchTarget->origin;
|
||||
} else
|
||||
{
|
||||
tagNum = gi.Tag_NumForName(_watchTarget->edict->s.modelindex, "Bip01 Head");
|
||||
|
||||
if (tagNum < 0)
|
||||
watchPosition = _watchTarget->centroid;
|
||||
else
|
||||
{
|
||||
_watchTarget->GetTag("Bip01 Head", &watchPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AdjustHeadAngles(tagPos, watchPosition);
|
||||
|
||||
if ( _watchTarget->isSubclassOf( Actor ) )
|
||||
{
|
||||
actTarget = (Actor *)(Entity *)_watchTarget;
|
||||
|
||||
// Don't watch if the target is dead.
|
||||
if ( !actTarget->isThinkOn() )
|
||||
{
|
||||
_watchTarget = NULL;
|
||||
actTarget = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( actTarget && ( actTarget->watch_offset != vec_zero ) )
|
||||
{
|
||||
MatrixTransformVector( actTarget->watch_offset, _watchTarget->orientation, watchPosition );
|
||||
watchPosition += _watchTarget->origin;
|
||||
}
|
||||
else
|
||||
{
|
||||
tagNum = gi.Tag_NumForName( _watchTarget->edict->s.modelindex, "Bip01 Head" );
|
||||
|
||||
if ( tagNum < 0 )
|
||||
watchPosition = _watchTarget->centroid;
|
||||
else
|
||||
{
|
||||
_watchTarget->GetTag( "Bip01 Head", &watchPosition );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AdjustHeadAngles( tagPos , watchPosition );
|
||||
|
||||
}
|
||||
|
||||
void HeadWatcher::AdjustHeadAngles( const Vector &tagPos , const Vector &watchPosition )
|
||||
void HeadWatcher::AdjustHeadAngles(const Vector &tagPos, const Vector &watchPosition)
|
||||
{
|
||||
Vector dir;
|
||||
Vector angles;
|
||||
Vector anglesDiff;
|
||||
float yawChange;
|
||||
float pitchChange;
|
||||
|
||||
|
||||
dir = watchPosition - tagPos;
|
||||
angles = dir.toAngles();
|
||||
|
||||
anglesDiff = angles - act->angles;
|
||||
|
||||
|
||||
anglesDiff[YAW] = AngleNormalize180( anglesDiff[YAW] );
|
||||
anglesDiff[PITCH] = AngleNormalize180( anglesDiff[PITCH] );
|
||||
|
||||
yawChange = anglesDiff[YAW];
|
||||
pitchChange = anglesDiff[PITCH];
|
||||
|
||||
if ( _turnThreshold && ( yawChange < _turnThreshold ) && ( yawChange > -_turnThreshold ) && ( pitchChange < _turnThreshold ) && ( pitchChange > -_turnThreshold ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Make sure we don't turn neck too far
|
||||
if ( anglesDiff[YAW] < -_maxHeadYaw )
|
||||
anglesDiff[YAW] = -_maxHeadYaw;
|
||||
else if ( anglesDiff[YAW] > _maxHeadYaw )
|
||||
anglesDiff[YAW] = _maxHeadYaw;
|
||||
|
||||
if ( anglesDiff[PITCH] < -_maxHeadPitch )
|
||||
anglesDiff[PITCH] = -_maxHeadPitch;
|
||||
else if ( anglesDiff[PITCH] > _maxHeadPitch )
|
||||
anglesDiff[PITCH] = _maxHeadPitch;
|
||||
|
||||
anglesDiff[ROLL] = 0.0f;
|
||||
|
||||
|
||||
LerpHeadBySpeed( anglesDiff );
|
||||
|
||||
auto dir = watchPosition - tagPos;
|
||||
auto angles = dir.toAngles();
|
||||
auto anglesDiff = angles - act->angles;
|
||||
|
||||
|
||||
anglesDiff[YAW] = AngleNormalize180(anglesDiff[YAW]);
|
||||
anglesDiff[PITCH] = AngleNormalize180(anglesDiff[PITCH]);
|
||||
|
||||
auto yawChange = anglesDiff[YAW];
|
||||
auto pitchChange = anglesDiff[PITCH];
|
||||
|
||||
if (_turnThreshold && yawChange < _turnThreshold && yawChange > -_turnThreshold && pitchChange < _turnThreshold && pitchChange > -_turnThreshold)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Make sure we don't turn neck too far
|
||||
if (anglesDiff[YAW] < -_maxHeadYaw)
|
||||
anglesDiff[YAW] = -_maxHeadYaw;
|
||||
else if (anglesDiff[YAW] > _maxHeadYaw)
|
||||
anglesDiff[YAW] = _maxHeadYaw;
|
||||
|
||||
if (anglesDiff[PITCH] < -_maxHeadPitch)
|
||||
anglesDiff[PITCH] = -_maxHeadPitch;
|
||||
else if (anglesDiff[PITCH] > _maxHeadPitch)
|
||||
anglesDiff[PITCH] = _maxHeadPitch;
|
||||
|
||||
anglesDiff[ROLL] = 0.0f;
|
||||
|
||||
|
||||
LerpHeadBySpeed(anglesDiff);
|
||||
|
||||
}
|
||||
|
||||
void HeadWatcher::LerpHeadBySpeed( const Vector &angleDelta , bool useTorsoAngles )
|
||||
void HeadWatcher::LerpHeadBySpeed(const Vector &angleDelta, bool useTorsoAngles)
|
||||
{
|
||||
Vector anglesDiff;
|
||||
Vector change;
|
||||
Vector finalAngles;
|
||||
Vector currentTorsoAngles;
|
||||
|
||||
anglesDiff = angleDelta;
|
||||
|
||||
// Get our Torso Angles
|
||||
act->SetControllerTag( ACTOR_TORSO_TAG , gi.Tag_NumForName( act->edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
currentTorsoAngles = act->GetControllerAngles( ACTOR_TORSO_TAG );
|
||||
|
||||
//Reset our Controller Tag
|
||||
act->SetControllerTag( ACTOR_HEAD_TAG, gi.Tag_NumForName( act->edict->s.modelindex, "Bip01 Head" ) );
|
||||
|
||||
|
||||
// Make sure we don't change our head angles too much at once
|
||||
change = anglesDiff - _currentHeadAngles;
|
||||
|
||||
if ( change[YAW] > _maxHeadTurnSpeed )
|
||||
anglesDiff[YAW] = _currentHeadAngles[YAW] + _maxHeadTurnSpeed;
|
||||
else if ( change[YAW] < -_maxHeadTurnSpeed )
|
||||
anglesDiff[YAW] = _currentHeadAngles[YAW] - _maxHeadTurnSpeed;
|
||||
|
||||
if ( change[PITCH] > _maxHeadTurnSpeed )
|
||||
anglesDiff[PITCH] = _currentHeadAngles[PITCH] + _maxHeadTurnSpeed;
|
||||
else if ( change[PITCH] < -_maxHeadTurnSpeed )
|
||||
anglesDiff[PITCH] = _currentHeadAngles[PITCH] - _maxHeadTurnSpeed;
|
||||
|
||||
if ( change[ROLL] > _maxHeadTurnSpeed )
|
||||
anglesDiff[ROLL] = _currentHeadAngles[ROLL] + _maxHeadTurnSpeed;
|
||||
else if ( change[ROLL] < -_maxHeadTurnSpeed )
|
||||
anglesDiff[ROLL] = _currentHeadAngles[ROLL] - _maxHeadTurnSpeed;
|
||||
|
||||
|
||||
finalAngles = anglesDiff;
|
||||
|
||||
if ( useTorsoAngles )
|
||||
finalAngles[YAW] = anglesDiff[YAW] - currentTorsoAngles[YAW];
|
||||
else
|
||||
finalAngles[YAW] = anglesDiff[YAW];
|
||||
|
||||
act->SetControllerAngles( ACTOR_HEAD_TAG, finalAngles );
|
||||
act->real_head_pitch = anglesDiff[PITCH];
|
||||
|
||||
_currentHeadAngles = anglesDiff;
|
||||
|
||||
auto anglesDiff = angleDelta;
|
||||
|
||||
// Get our Torso Angles
|
||||
act->SetControllerTag(ActorTorsoTag, gi.Tag_NumForName(act->edict->s.modelindex, "Bip01 Spine1"));
|
||||
auto currentTorsoAngles = act->GetControllerAngles(ActorTorsoTag);
|
||||
|
||||
//Reset our Controller Tag
|
||||
act->SetControllerTag(ActorHeadTag, gi.Tag_NumForName(act->edict->s.modelindex, "Bip01 Head"));
|
||||
|
||||
|
||||
// Make sure we don't change our head angles too much at once
|
||||
auto change = anglesDiff - _currentHeadAngles;
|
||||
|
||||
if (change[YAW] > _maxHeadTurnSpeed)
|
||||
anglesDiff[YAW] = _currentHeadAngles[YAW] + _maxHeadTurnSpeed;
|
||||
else if (change[YAW] < -_maxHeadTurnSpeed)
|
||||
anglesDiff[YAW] = _currentHeadAngles[YAW] - _maxHeadTurnSpeed;
|
||||
|
||||
if (change[PITCH] > _maxHeadTurnSpeed)
|
||||
anglesDiff[PITCH] = _currentHeadAngles[PITCH] + _maxHeadTurnSpeed;
|
||||
else if (change[PITCH] < -_maxHeadTurnSpeed)
|
||||
anglesDiff[PITCH] = _currentHeadAngles[PITCH] - _maxHeadTurnSpeed;
|
||||
|
||||
if (change[ROLL] > _maxHeadTurnSpeed)
|
||||
anglesDiff[ROLL] = _currentHeadAngles[ROLL] + _maxHeadTurnSpeed;
|
||||
else if (change[ROLL] < -_maxHeadTurnSpeed)
|
||||
anglesDiff[ROLL] = _currentHeadAngles[ROLL] - _maxHeadTurnSpeed;
|
||||
|
||||
|
||||
auto finalAngles = anglesDiff;
|
||||
|
||||
if (useTorsoAngles)
|
||||
finalAngles[YAW] = anglesDiff[YAW] - currentTorsoAngles[YAW];
|
||||
else
|
||||
finalAngles[YAW] = anglesDiff[YAW];
|
||||
|
||||
act->SetControllerAngles(ActorHeadTag, finalAngles);
|
||||
act->real_head_pitch = anglesDiff[PITCH];
|
||||
|
||||
_currentHeadAngles = anglesDiff;
|
||||
|
||||
}
|
||||
|
||||
void HeadWatcher::setHeadTwitch( bool twitchHead )
|
||||
void HeadWatcher::setHeadTwitch(bool twitchHead)
|
||||
{
|
||||
_twitchHead = twitchHead;
|
||||
_twitchHead = twitchHead;
|
||||
|
||||
if ( _twitchHead )
|
||||
{
|
||||
_nextTwitchHeadTime = 0.0f;
|
||||
}
|
||||
if (_twitchHead)
|
||||
{
|
||||
_nextTwitchHeadTime = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void HeadWatcher::twitchHead( void )
|
||||
void HeadWatcher::twitchHead(void)
|
||||
{
|
||||
Vector headAngles;
|
||||
float oldMaxHeadTurnSpeed;
|
||||
if (level.time > _nextTwitchHeadTime)
|
||||
{
|
||||
_headTwitchAngles = Vector(G_CRandom(4.0f), G_CRandom(4.0f), G_CRandom(4.0f));
|
||||
|
||||
_nextTwitchHeadTime = level.time + 1.0f + G_CRandom(0.5f);
|
||||
}
|
||||
|
||||
if ( level.time > _nextTwitchHeadTime )
|
||||
{
|
||||
_headTwitchAngles = Vector( G_CRandom( 4.0f ), G_CRandom( 4.0f ), G_CRandom( 4.0f ) );
|
||||
auto oldMaxHeadTurnSpeed = _maxHeadTurnSpeed;
|
||||
|
||||
_nextTwitchHeadTime = level.time + 1.0f + G_CRandom( 0.5f );
|
||||
}
|
||||
_maxHeadTurnSpeed = 0.25f;
|
||||
|
||||
oldMaxHeadTurnSpeed = _maxHeadTurnSpeed;
|
||||
LerpHeadBySpeed(_headTwitchAngles, false);
|
||||
|
||||
_maxHeadTurnSpeed = 0.25f;
|
||||
|
||||
LerpHeadBySpeed( _headTwitchAngles, false );
|
||||
|
||||
_maxHeadTurnSpeed = oldMaxHeadTurnSpeed;
|
||||
_maxHeadTurnSpeed = oldMaxHeadTurnSpeed;
|
||||
}
|
||||
|
||||
|
||||
|
@ -333,14 +301,14 @@ void HeadWatcher::twitchHead( void )
|
|||
// Actor *actor
|
||||
// Description: Sets the Actor Pointer and Calls Archive()
|
||||
//
|
||||
void HeadWatcher::DoArchive( Archiver &arc , Actor *actor )
|
||||
void HeadWatcher::DoArchive(Archiver &arc, Actor *actor)
|
||||
{
|
||||
Archive( arc );
|
||||
if ( actor )
|
||||
act = actor;
|
||||
else
|
||||
gi.Error( ERR_FATAL, "HeadWatcher::DoArchive -- actor is NULL" );
|
||||
|
||||
Archive(arc);
|
||||
if (actor)
|
||||
act = actor;
|
||||
else
|
||||
gi.Error(ERR_FATAL, "HeadWatcher::DoArchive -- actor is NULL");
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -348,18 +316,18 @@ void HeadWatcher::DoArchive( Archiver &arc , Actor *actor )
|
|||
// Parameters: Archiver &arc
|
||||
// Description: Archives Class Data
|
||||
//
|
||||
void HeadWatcher::Archive( Archiver &arc )
|
||||
void HeadWatcher::Archive(Archiver &arc)
|
||||
{
|
||||
arc.ArchiveSafePointer( &_watchTarget );
|
||||
arc.ArchiveVector( &_currentHeadAngles );
|
||||
arc.ArchiveFloat( &_maxHeadTurnSpeed );
|
||||
arc.ArchiveFloat( &_turnThreshold );
|
||||
arc.ArchiveBoolean( &_explicitSet );
|
||||
arc.ArchiveFloat( &_maxHeadYaw );
|
||||
arc.ArchiveFloat( &_maxHeadPitch );
|
||||
arc.ArchiveBool( &_twitchHead );
|
||||
arc.ArchiveFloat( &_nextTwitchHeadTime );
|
||||
arc.ArchiveVector( &_headTwitchAngles );
|
||||
arc.ArchiveFloat( &_maxDistance );
|
||||
arc.ArchiveBool( &_ignoreWatchTarget );
|
||||
arc.ArchiveSafePointer(&_watchTarget);
|
||||
arc.ArchiveVector(&_currentHeadAngles);
|
||||
arc.ArchiveFloat(&_maxHeadTurnSpeed);
|
||||
arc.ArchiveFloat(&_turnThreshold);
|
||||
arc.ArchiveBoolean(&_explicitSet);
|
||||
arc.ArchiveFloat(&_maxHeadYaw);
|
||||
arc.ArchiveFloat(&_maxHeadPitch);
|
||||
arc.ArchiveBool(&_twitchHead);
|
||||
arc.ArchiveFloat(&_nextTwitchHeadTime);
|
||||
arc.ArchiveVector(&_headTwitchAngles);
|
||||
arc.ArchiveFloat(&_maxDistance);
|
||||
arc.ArchiveBool(&_ignoreWatchTarget);
|
||||
}
|
||||
|
|
|
@ -20,82 +20,78 @@
|
|||
#ifndef __ACTOR_HEADWATCHER_H__
|
||||
#define __ACTOR_HEADWATCHER_H__
|
||||
|
||||
#include "actor.h"
|
||||
#include "actorincludes.h"
|
||||
#include "weapon.h"
|
||||
|
||||
//============================
|
||||
// Class HeadWatcher
|
||||
//============================
|
||||
class HeadWatcher
|
||||
{
|
||||
public:
|
||||
HeadWatcher();
|
||||
HeadWatcher( Actor *actor );
|
||||
~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;
|
||||
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;
|
||||
}
|
||||
|
||||
inline void HeadWatcher::SetMaxHeadYaw( float max )
|
||||
inline void HeadWatcher::SetMaxHeadYaw(float max)
|
||||
{
|
||||
_maxHeadYaw = max;
|
||||
_maxHeadYaw = max;
|
||||
}
|
||||
|
||||
inline void HeadWatcher::SetMaxDistance( float distance )
|
||||
inline void HeadWatcher::SetMaxDistance(float distance)
|
||||
{
|
||||
_maxDistance = distance;
|
||||
_maxDistance = distance;
|
||||
}
|
||||
|
||||
inline void HeadWatcher::SetIgnoreWatchTarget( bool ignore )
|
||||
inline void HeadWatcher::SetIgnoreWatchTarget(bool ignore)
|
||||
{
|
||||
_ignoreWatchTarget = ignore;
|
||||
_ignoreWatchTarget = ignore;
|
||||
}
|
||||
|
||||
#endif /* __ACTOR_HEADWATCHER_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -22,40 +22,48 @@ class LocomotionController;
|
|||
#ifndef __ACTOR_LOCOMOTION_H__
|
||||
#define __ACTOR_LOCOMOTION_H__
|
||||
|
||||
#include "actor.h"
|
||||
#include "actorincludes.h"
|
||||
#include "weapon.h"
|
||||
#include "path.h"
|
||||
#include "steering.h"
|
||||
|
||||
class LocomotionController
|
||||
{
|
||||
public:
|
||||
LocomotionController();
|
||||
LocomotionController( Actor *actor );
|
||||
~LocomotionController();
|
||||
{
|
||||
public:
|
||||
LocomotionController();
|
||||
|
||||
void Begin();
|
||||
void Evaluate();
|
||||
void End();
|
||||
|
||||
// Accessors & Mutators
|
||||
void SetMovementStyle( MovementStyle style );
|
||||
MovementStyle GetMovementStyle();
|
||||
|
||||
// Archiving
|
||||
virtual void Archive( Archiver &arc );
|
||||
void DoArchive( Archiver &arc , Actor *actor );
|
||||
explicit LocomotionController(Actor *actor)
|
||||
{
|
||||
//Initialize our Actor
|
||||
if (actor)
|
||||
act = actor;
|
||||
else
|
||||
gi.Error(ERR_DROP, "LocomotionController::LocomotionController -- actor is NULL");
|
||||
|
||||
protected:
|
||||
void _init();
|
||||
_init();
|
||||
}
|
||||
|
||||
private:
|
||||
Actor *act;
|
||||
MovementStyle _movementStyle;
|
||||
FollowPath _chase;
|
||||
virtual ~LocomotionController();
|
||||
|
||||
};
|
||||
void Begin();
|
||||
void Evaluate();
|
||||
void End();
|
||||
|
||||
// Accessors & Mutators
|
||||
void SetMovementStyle(MovementStyle style);
|
||||
MovementStyle GetMovementStyle();
|
||||
|
||||
// Archiving
|
||||
virtual void Archive(Archiver &arc);
|
||||
void DoArchive(Archiver &arc, Actor *actor);
|
||||
|
||||
protected:
|
||||
void _init();
|
||||
|
||||
private:
|
||||
Actor *act;
|
||||
MovementStyle _movementStyle;
|
||||
FollowPath _chase;
|
||||
|
||||
};
|
||||
|
||||
//============================
|
||||
// Class MovementSubsystem
|
||||
|
@ -63,155 +71,155 @@ class LocomotionController
|
|||
//
|
||||
// Encapsulates movement related data and functionality for the actor
|
||||
//
|
||||
class MovementSubsystem
|
||||
{
|
||||
public:
|
||||
MovementSubsystem();
|
||||
MovementSubsystem( Actor *actor );
|
||||
~MovementSubsystem();
|
||||
|
||||
qboolean CanMoveTo( const Vector &pos );
|
||||
bool CanWalkTowardsPoint( const Vector &goalPoint, const int mask = -1);
|
||||
qboolean CanWalkTo( const Vector &pos, float bounding_box_extra = 0, int entnum = ENTITYNUM_NONE, const int mask = -1 );
|
||||
qboolean CanWalkToFrom( const Vector &origin, const Vector &pos, float bounding_box_extra = 0, int entnum = ENTITYNUM_NONE, const int mask = -1 );
|
||||
void Accelerate( const Vector &steering );
|
||||
void CalcMove( void );
|
||||
stepmoveresult_t WaterMove( void );
|
||||
stepmoveresult_t AirMove( void );
|
||||
stepmoveresult_t IsMoveValid( trace_t &horizontalTrace, trace_t &verticalTrace, const Vector &moveBegin, const Vector &moveEnd );
|
||||
stepmoveresult_t TryMove( void );
|
||||
stepmoveresult_t SimpleMove( const bool stickToGround );
|
||||
|
||||
qboolean Push( const Vector &dir );
|
||||
void CheckWater( void );
|
||||
float JumpTo( PathNode * goal, const Angle angle = 45.0f );
|
||||
float JumpTo( Entity * goal, const Angle angle = 45.0f );
|
||||
float JumpTo( const Vector &targ, const Angle angle = 45.0f );
|
||||
const Vector SteerTowardsPoint(const Vector &targetPosition, const Vector &targetVelocity, const Vector &moveDirection, const float maxSpeed=1.0f, const bool adjustSpeed = false);
|
||||
|
||||
|
||||
// Archiving
|
||||
virtual void Archive( Archiver &arc );
|
||||
void DoArchive( Archiver &arc , Actor *actor );
|
||||
|
||||
// Accessors and Mutators
|
||||
void setStep( const Vector &step );
|
||||
const Vector & getStep() const;
|
||||
|
||||
void setLastMove( stepmoveresult_t lastMove );
|
||||
stepmoveresult_t getLastMove();
|
||||
|
||||
void setMove( const Vector &move );
|
||||
Vector getMove();
|
||||
|
||||
void setMoveDir( const Vector &moveDir );
|
||||
Vector getMoveDir();
|
||||
|
||||
void setMoveVelocity( const Vector &moveVelocity );
|
||||
Vector getMoveVelocity();
|
||||
|
||||
void setAnimDir( const Vector &animDir );
|
||||
Vector getAnimDir();
|
||||
|
||||
void setDiveDir( const Vector &diveDir );
|
||||
Vector getDiveDir();
|
||||
|
||||
void setStartPos( const Vector &startPos );
|
||||
Vector getStartPos();
|
||||
|
||||
void setTotalLen( float totalLen );
|
||||
float getTotalLen();
|
||||
|
||||
void setTurnSpeed( float turnSpeed );
|
||||
float getTurnSpeed();
|
||||
|
||||
void setForwardSpeed( float forwardSpeed );
|
||||
float getForwardSpeed();
|
||||
|
||||
void setMoveSpeed( float moveSpeed );
|
||||
float getMoveSpeed();
|
||||
|
||||
void setPath( Path* path );
|
||||
Path* getPath();
|
||||
|
||||
void setFlipLegs( qboolean flip );
|
||||
qboolean getFlipLegs();
|
||||
void flipLegs();
|
||||
|
||||
void setMovingBackwards( qboolean backwards );
|
||||
qboolean getMovingBackwards();
|
||||
|
||||
void setFaceEnemy ( bool faceEnemy );
|
||||
bool getFaceEnemy ();
|
||||
|
||||
void setAdjustAnimDir( bool adjustAnimDir );
|
||||
bool getAdjustAnimDir();
|
||||
|
||||
|
||||
void setMovementType( MovementType_t mType );
|
||||
MovementType_t getMovementType();
|
||||
|
||||
void SetStickToGround( const bool stick );
|
||||
const bool GetStickToGround( void ) const;
|
||||
|
||||
void setUseCodeDrivenSpeed( bool useCode );
|
||||
bool getUseCodeDrivenSpeed();
|
||||
|
||||
Entity* getBlockingEntity();
|
||||
void clearBlockingEntity();
|
||||
|
||||
|
||||
protected: // Functions
|
||||
|
||||
Vector _getRealDestinationPosition( const Vector &pos ) const;
|
||||
stepmoveresult_t _noGravityTryMove( const Vector &oldorg, trace_t &verticalTrace ) const;
|
||||
trace_t _feetWidthTrace( const Vector ¤tLoc , const Vector &bottom , const Vector &endPos, const int mask ) const;
|
||||
float _getTraceStep() const;
|
||||
void _saveGroundInformation(trace_t &trace);
|
||||
qboolean _isBlockedByDoor(trace_t &trace ) const;
|
||||
qboolean _canMoveSimplePath(const Vector &mins, const Vector &maxs, const Vector &pos ) const;
|
||||
qboolean _isBlockedByFall(trace_t &trace ) const;
|
||||
qboolean _allowFall() const;
|
||||
qboolean _shouldTryMove() const;
|
||||
qboolean _checkHaveGroundEachStep( const Vector &start, const Vector &end, const Vector &test_mins , const Vector &test_maxs, const int mask = -1 ) const;
|
||||
void _init();
|
||||
|
||||
private: // Member Variables
|
||||
static Vector _step;
|
||||
|
||||
stepmoveresult_t _lastmove;
|
||||
float _forwardspeed;
|
||||
PathPtr _path;
|
||||
Vector _move;
|
||||
Vector _movedir;
|
||||
float _movespeed;
|
||||
Vector _movevelocity;
|
||||
float _totallen;
|
||||
float _turnspeed;
|
||||
Vector _animdir;
|
||||
Vector _divedir;
|
||||
Vector _startpos;
|
||||
qboolean _fliplegs;
|
||||
qboolean _movingBackwards;
|
||||
bool _faceEnemy;
|
||||
bool _adjustAnimDir;
|
||||
MovementType_t _movementType;
|
||||
bool _stickToGround;
|
||||
bool _useCodeDrivenSpeed;
|
||||
|
||||
Actor *act;
|
||||
EntityPtr _blockingEntity;
|
||||
|
||||
};
|
||||
|
||||
inline void MovementSubsystem::setUseCodeDrivenSpeed( bool useCode )
|
||||
class MovementSubsystem
|
||||
{
|
||||
_useCodeDrivenSpeed = useCode;
|
||||
public:
|
||||
MovementSubsystem();
|
||||
explicit MovementSubsystem(Actor *actor);
|
||||
virtual ~MovementSubsystem();
|
||||
|
||||
qboolean CanMoveTo(const Vector &pos);
|
||||
bool CanWalkTowardsPoint(const Vector &goalPoint, const int mask = -1);
|
||||
qboolean CanWalkTo(const Vector &pos, float bounding_box_extra = 0, int entnum = ENTITYNUM_NONE, const int mask = -1);
|
||||
qboolean CanWalkToFrom(const Vector &origin, const Vector &pos, float bounding_box_extra = 0, int entnum = ENTITYNUM_NONE, const int mask = -1);
|
||||
void Accelerate(const Vector &steering);
|
||||
void CalcMove(void);
|
||||
stepmoveresult_t WaterMove(void);
|
||||
stepmoveresult_t AirMove(void);
|
||||
stepmoveresult_t IsMoveValid(trace_t &horizontalTrace, trace_t &verticalTrace, const Vector &moveBegin, const Vector &moveEnd);
|
||||
stepmoveresult_t TryMove(void);
|
||||
stepmoveresult_t SimpleMove(const bool stickToGround);
|
||||
|
||||
qboolean Push(const Vector &dir);
|
||||
void CheckWater(void);
|
||||
float JumpTo(PathNode * goal, const Angle angle = 45.0f);
|
||||
float JumpTo(Entity * goal, const Angle angle = 45.0f);
|
||||
float JumpTo(const Vector &targ, const Angle angle = 45.0f);
|
||||
Vector SteerTowardsPoint(const Vector &targetPosition, const Vector &targetVelocity, const Vector &moveDirection, const float maxSpeed = 1.0f, const bool adjustSpeed = false);
|
||||
|
||||
|
||||
// Archiving
|
||||
virtual void Archive(Archiver &arc);
|
||||
void DoArchive(Archiver &arc, Actor *actor);
|
||||
|
||||
// Accessors and Mutators
|
||||
void setStep(const Vector &step);
|
||||
const Vector & getStep() const;
|
||||
|
||||
void setLastMove(stepmoveresult_t lastMove);
|
||||
stepmoveresult_t getLastMove();
|
||||
|
||||
void setMove(const Vector &move);
|
||||
Vector getMove();
|
||||
|
||||
void setMoveDir(const Vector &moveDir);
|
||||
Vector getMoveDir();
|
||||
|
||||
void setMoveVelocity(const Vector &moveVelocity);
|
||||
Vector getMoveVelocity();
|
||||
|
||||
void setAnimDir(const Vector &animDir);
|
||||
Vector getAnimDir();
|
||||
|
||||
void setDiveDir(const Vector &diveDir);
|
||||
Vector getDiveDir();
|
||||
|
||||
void setStartPos(const Vector &startPos);
|
||||
Vector getStartPos();
|
||||
|
||||
void setTotalLen(float totalLen);
|
||||
float getTotalLen();
|
||||
|
||||
void setTurnSpeed(float turnSpeed);
|
||||
float getTurnSpeed();
|
||||
|
||||
void setForwardSpeed(float forwardSpeed);
|
||||
float getForwardSpeed();
|
||||
|
||||
void setMoveSpeed(float moveSpeed);
|
||||
float getMoveSpeed();
|
||||
|
||||
void setPath(Path* path);
|
||||
Path* getPath();
|
||||
|
||||
void setFlipLegs(qboolean flip);
|
||||
qboolean getFlipLegs();
|
||||
void flipLegs();
|
||||
|
||||
void setMovingBackwards(qboolean backwards);
|
||||
qboolean getMovingBackwards();
|
||||
|
||||
void setFaceEnemy(bool faceEnemy);
|
||||
bool getFaceEnemy();
|
||||
|
||||
void setAdjustAnimDir(bool adjustAnimDir);
|
||||
bool getAdjustAnimDir();
|
||||
|
||||
|
||||
void setMovementType(MovementType_t mType);
|
||||
MovementType_t getMovementType();
|
||||
|
||||
void SetStickToGround(const bool stick);
|
||||
bool GetStickToGround(void) const;
|
||||
|
||||
void setUseCodeDrivenSpeed(bool useCode);
|
||||
bool getUseCodeDrivenSpeed();
|
||||
|
||||
Entity* getBlockingEntity();
|
||||
void clearBlockingEntity();
|
||||
|
||||
|
||||
protected: // Functions
|
||||
|
||||
Vector _getRealDestinationPosition(const Vector &pos) const;
|
||||
stepmoveresult_t _noGravityTryMove(const Vector &oldorg, trace_t &verticalTrace) const;
|
||||
trace_t _feetWidthTrace(const Vector ¤tLoc, const Vector &bottom, const Vector &endPos, const int mask) const;
|
||||
float _getTraceStep() const;
|
||||
void _saveGroundInformation(trace_t &trace);
|
||||
qboolean _isBlockedByDoor(trace_t &trace) const;
|
||||
qboolean _canMoveSimplePath(const Vector &mins, const Vector &maxs, const Vector &pos) const;
|
||||
qboolean _isBlockedByFall(trace_t &trace) const;
|
||||
qboolean _allowFall() const;
|
||||
qboolean _shouldTryMove() const;
|
||||
qboolean _checkHaveGroundEachStep(const Vector &start, const Vector &end, const Vector &test_mins, const Vector &test_maxs, const int mask = -1) const;
|
||||
void _init();
|
||||
|
||||
private: // Member Variables
|
||||
static Vector _step;
|
||||
|
||||
stepmoveresult_t _lastmove;
|
||||
float _forwardspeed;
|
||||
PathPtr _path;
|
||||
Vector _move;
|
||||
Vector _movedir;
|
||||
float _movespeed;
|
||||
Vector _movevelocity;
|
||||
float _totallen;
|
||||
float _turnspeed;
|
||||
Vector _animdir;
|
||||
Vector _divedir;
|
||||
Vector _startpos;
|
||||
qboolean _fliplegs;
|
||||
qboolean _movingBackwards;
|
||||
bool _faceEnemy;
|
||||
bool _adjustAnimDir;
|
||||
MovementType_t _movementType;
|
||||
bool _stickToGround;
|
||||
bool _useCodeDrivenSpeed;
|
||||
|
||||
Actor *act;
|
||||
EntityPtr _blockingEntity;
|
||||
|
||||
};
|
||||
|
||||
inline void MovementSubsystem::setUseCodeDrivenSpeed(bool useCode)
|
||||
{
|
||||
_useCodeDrivenSpeed = useCode;
|
||||
}
|
||||
|
||||
inline bool MovementSubsystem::getUseCodeDrivenSpeed()
|
||||
{
|
||||
return _useCodeDrivenSpeed;
|
||||
return _useCodeDrivenSpeed;
|
||||
}
|
||||
|
||||
#endif /* __ACTOR_LOCOMOTION_H__ */
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "_pch_cpp.h"
|
||||
#include "actor_posturecontroller.hpp"
|
||||
|
||||
extern Event EV_Actor_SetPostureStateMap;
|
||||
|
||||
|
@ -138,16 +137,16 @@ void PostureController::Archive( Archiver &arc )
|
|||
//--------------------------------------------------------------
|
||||
void PostureController::init()
|
||||
{
|
||||
_postureStateMap = NULL;
|
||||
_postureStateMap = nullptr;
|
||||
_postureStateMap_Name = "";
|
||||
|
||||
_currentPostureState = NULL;
|
||||
_currentPostureState = nullptr;
|
||||
_currentPostureState_Name = "";
|
||||
|
||||
_requestedPostureState = NULL;
|
||||
_requestedPostureState = nullptr;
|
||||
_requestedPostureState_Name = "";
|
||||
|
||||
_requestor = NULL;
|
||||
_requestor = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,12 +162,11 @@ void PostureController::init()
|
|||
//--------------------------------------------------------------
|
||||
void PostureController::evaluate()
|
||||
{
|
||||
int count;
|
||||
State *laststate = NULL;
|
||||
int32_t count;
|
||||
State *laststate;
|
||||
str currentanim;
|
||||
str stateLegAnim;
|
||||
|
||||
stateLegAnim = act->animname;
|
||||
auto stateLegAnim = act->animname;
|
||||
count = 0;
|
||||
|
||||
if ( !_postureStateMap )
|
||||
|
@ -218,7 +216,7 @@ void PostureController::evaluate()
|
|||
// Change the animation if it has changed
|
||||
currentanim = _currentPostureState->getLegAnim( *act, &_postureConditionals );
|
||||
|
||||
if ( currentanim.length() && ( stricmp( stateLegAnim , currentanim.c_str() ) != 0 ) )
|
||||
if ( currentanim.length() && stricmp( stateLegAnim , currentanim.c_str() ) != 0 )
|
||||
{
|
||||
act->SetAnim( currentanim, EV_Posture_Anim_Done, legs );
|
||||
stateLegAnim = currentanim;
|
||||
|
@ -263,14 +261,12 @@ bool PostureController::requestPosture( const str &postureState , Listener *requ
|
|||
|
||||
void PostureController::setPostureStateMap( const str &stateMap , bool loading )
|
||||
{
|
||||
str animName;
|
||||
|
||||
// Load the new state map
|
||||
_postureStateMap_Name = stateMap;
|
||||
|
||||
//_postureConditionals.FreeObjectList();
|
||||
act->freeConditionals( _postureConditionals );
|
||||
_postureStateMap = GetStatemap( _postureStateMap_Name, ( Condition<Class> * )act->Conditions, &_postureConditionals, false );
|
||||
_postureStateMap = GetStatemap( _postureStateMap_Name, reinterpret_cast<Condition<Class> * >(act->Conditions), &_postureConditionals, false );
|
||||
|
||||
// Set the first state
|
||||
_currentPostureState_Name = "START";
|
||||
|
|
|
@ -18,9 +18,6 @@ class PostureController;
|
|||
#ifndef __ACTOR_POSTURECONTROLLER_HPP__
|
||||
#define __ACTOR_POSTURECONTROLLER_HPP__
|
||||
|
||||
#include "actor.h"
|
||||
#include "actorincludes.h"
|
||||
|
||||
extern Event EV_Posture_Anim_Done;
|
||||
extern Event EV_PostureChanged_Completed;
|
||||
|
||||
|
@ -39,54 +36,54 @@ extern Event EV_PostureChanged_Completed;
|
|||
//--------------------------------------------------------------
|
||||
class PostureController
|
||||
{
|
||||
public:
|
||||
PostureController();
|
||||
PostureController( Actor *actor );
|
||||
~PostureController();
|
||||
public:
|
||||
PostureController();
|
||||
explicit PostureController(Actor *actor);
|
||||
virtual ~PostureController();
|
||||
|
||||
virtual void Archive( Archiver &arc );
|
||||
void DoArchive( Archiver &arc , Actor *actor );
|
||||
|
||||
void evaluate();
|
||||
virtual void Archive(Archiver &arc);
|
||||
void DoArchive(Archiver &arc, Actor *actor);
|
||||
|
||||
bool requestPosture( const str &postureState , Listener *requestor );
|
||||
|
||||
const str& getRequestedPostureName();
|
||||
const str& getCurrentPostureName();
|
||||
void evaluate();
|
||||
|
||||
void setPostureStateMap( const str &stateMap , bool loading );
|
||||
void setPostureState( const str &postureState );
|
||||
void setPostureState( const str &postureState , const str &requestedState );
|
||||
bool requestPosture(const str &postureState, Listener *requestor);
|
||||
|
||||
protected:
|
||||
void init();
|
||||
const str& getRequestedPostureName();
|
||||
const str& getCurrentPostureName();
|
||||
|
||||
private:
|
||||
StateMap *_postureStateMap;
|
||||
str _postureStateMap_Name;
|
||||
void setPostureStateMap(const str &stateMap, bool loading);
|
||||
void setPostureState(const str &postureState);
|
||||
void setPostureState(const str &postureState, const str &requestedState);
|
||||
|
||||
State *_currentPostureState;
|
||||
str _currentPostureState_Name;
|
||||
protected:
|
||||
void init();
|
||||
|
||||
State *_requestedPostureState;
|
||||
str _requestedPostureState_Name;
|
||||
private:
|
||||
StateMap *_postureStateMap;
|
||||
str _postureStateMap_Name;
|
||||
|
||||
SafePtr<Listener> _requestor;
|
||||
Container<Conditional*> _postureConditionals;
|
||||
State *_currentPostureState;
|
||||
str _currentPostureState_Name;
|
||||
|
||||
State *_requestedPostureState;
|
||||
str _requestedPostureState_Name;
|
||||
|
||||
SafePtr<Listener> _requestor;
|
||||
Container<Conditional*> _postureConditionals;
|
||||
|
||||
|
||||
|
||||
Actor *act;
|
||||
|
||||
Actor *act;
|
||||
};
|
||||
|
||||
inline const str& PostureController::getRequestedPostureName()
|
||||
{
|
||||
return _requestedPostureState_Name;
|
||||
return _requestedPostureState_Name;
|
||||
}
|
||||
|
||||
inline const str& PostureController::getCurrentPostureName()
|
||||
{
|
||||
return _currentPostureState_Name;
|
||||
return _currentPostureState_Name;
|
||||
}
|
||||
|
||||
#endif /* __ACTOR_POSTURECONTROLLER_HPP__ */
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
//
|
||||
|
||||
#include "_pch_cpp.h"
|
||||
#include "actor_sensoryperception.h"
|
||||
#include "player.h"
|
||||
#include "object.h"
|
||||
|
||||
//======================================
|
||||
// SensoryPerception Implementation
|
||||
|
@ -62,16 +59,10 @@ SensoryPerception::~SensoryPerception()
|
|||
|
||||
qboolean SensoryPerception::isInLineOfSight( const Vector &position , const int entNum )
|
||||
{
|
||||
trace_t trace;
|
||||
Vector startPos;
|
||||
Vector endPos;
|
||||
Entity *traceEnt;
|
||||
|
||||
|
||||
startPos = act->origin;
|
||||
auto startPos = act->origin;
|
||||
startPos.z += 15;
|
||||
|
||||
endPos = position;
|
||||
auto endPos = position;
|
||||
endPos.z += 15;
|
||||
|
||||
Vector modMins;
|
||||
|
@ -83,7 +74,7 @@ qboolean SensoryPerception::isInLineOfSight( const Vector &position , const int
|
|||
modMaxs = act->maxs;
|
||||
modMaxs *= 1.5;
|
||||
|
||||
trace = G_Trace( startPos, modMins, modMaxs, endPos, act, act->edict->clipmask, false, "isInLineOfSight" );
|
||||
auto trace = G_Trace( startPos, modMins, modMaxs, endPos, act, act->edict->clipmask, false, "isInLineOfSight" );
|
||||
//G_DebugLine( startPos , trace.endpos, 1.0f, 0.0f, 1.0f, 1.0f );
|
||||
|
||||
_lineOfSight.entNum = entNum;
|
||||
|
@ -95,13 +86,13 @@ qboolean SensoryPerception::isInLineOfSight( const Vector &position , const int
|
|||
}
|
||||
else
|
||||
{
|
||||
traceEnt = G_GetEntity( trace.entityNum );
|
||||
auto traceEnt = G_GetEntity( trace.entityNum );
|
||||
_lineOfSight.inLineOfSight = false;
|
||||
|
||||
if ( traceEnt && traceEnt->isSubclassOf( Actor) )
|
||||
{
|
||||
Actor *traceActor;
|
||||
traceActor = (Actor*)traceEnt;
|
||||
traceActor = dynamic_cast<Actor*>(traceEnt);
|
||||
|
||||
_lineOfSight.inLineOfSight = traceActor->sensoryPerception->checkInLineOfSight( position , entNum );
|
||||
}
|
||||
|
@ -117,24 +108,23 @@ qboolean SensoryPerception::checkInLineOfSight( const Vector &position , const i
|
|||
timeDelta = level.time - _lineOfSight.time;
|
||||
|
||||
if ( timeDelta > .5 || entNum != _lineOfSight.entNum )
|
||||
return isInLineOfSight( position , entNum );
|
||||
else
|
||||
return _lineOfSight.inLineOfSight;
|
||||
|
||||
return isInLineOfSight( position , entNum );
|
||||
|
||||
return _lineOfSight.inLineOfSight;
|
||||
}
|
||||
|
||||
void SensoryPerception::_init()
|
||||
{
|
||||
|
||||
// Set up Stimuli
|
||||
_stimuli = STIMULI_ALL;
|
||||
_permanent_stimuli = STIMULI_ALL;
|
||||
_stimuli = StimuliAll;
|
||||
_permanent_stimuli = StimuliAll;
|
||||
|
||||
//Member Vars
|
||||
_noise_position = vec_zero;
|
||||
_noise_time = 0;
|
||||
_fov = DEFAULT_FOV;
|
||||
_fovdot = (float)cos( (double)_fov * 0.5 * M_PI / 180.0 );
|
||||
_fovdot = float(cos( double(_fov) * 0.5 * M_PI / 180.0 ));
|
||||
_vision_distance = DEFAULT_VISION_DISTANCE;
|
||||
_last_soundType = SOUNDTYPE_NONE;
|
||||
_nextSenseTime = 0.0f;
|
||||
|
@ -151,9 +141,7 @@ void SensoryPerception::_init()
|
|||
// needs to wake up
|
||||
//
|
||||
void SensoryPerception::SenseEnemies()
|
||||
{
|
||||
int i;
|
||||
|
||||
{
|
||||
if ( _nextSenseTime > level.time )
|
||||
return;
|
||||
|
||||
|
@ -161,13 +149,13 @@ void SensoryPerception::SenseEnemies()
|
|||
//_nextSenseTime = 0;
|
||||
|
||||
//Well, who your enemies are depends on what side your on
|
||||
if ( ( act->actortype == IS_ENEMY ) || ( act->actortype == IS_MONSTER ) )
|
||||
if ( act->actortype == IS_ENEMY || act->actortype == IS_MONSTER )
|
||||
{
|
||||
//
|
||||
//If we an ENEMY or a MONSTER than teammates are our enemies
|
||||
//
|
||||
Sentient *teammate;
|
||||
for ( i = 1 ; i <= TeamMateList.NumObjects() ; i++ )
|
||||
for ( auto i = 1 ; i <= TeamMateList.NumObjects() ; i++ )
|
||||
{
|
||||
teammate = TeamMateList.ObjectAt( i );
|
||||
|
||||
|
@ -179,14 +167,11 @@ void SensoryPerception::SenseEnemies()
|
|||
else
|
||||
{
|
||||
//
|
||||
//If we an CIVILIAN, FRIEND, or TEAMMATE our potiential enemies are active monsters
|
||||
//If we an CIVILIAN, FRIEND, or TEAMMATE our potential enemies are active monsters
|
||||
//
|
||||
Entity *ent;
|
||||
|
||||
for ( i = 1 ; i <= ActiveList.NumObjects() ; i++ )
|
||||
for (auto i = 1 ; i <= ActiveList.NumObjects() ; i++ )
|
||||
{
|
||||
ent = ActiveList.ObjectAt( i );
|
||||
_SenseEntity(ent);
|
||||
_SenseEntity(ActiveList.ObjectAt(i));
|
||||
}
|
||||
|
||||
//In case we didn't find an enemy, but if the players nearby, we want to wake up anyway
|
||||
|
@ -197,7 +182,7 @@ void SensoryPerception::SenseEnemies()
|
|||
|
||||
qboolean SensoryPerception::_SenseEntity( Entity *ent )
|
||||
{
|
||||
// Dont want to target the enemy if he's not a valid target
|
||||
// Don't want to target the enemy if he's not a valid target
|
||||
|
||||
if (!ent)
|
||||
return false;
|
||||
|
@ -205,7 +190,7 @@ qboolean SensoryPerception::_SenseEntity( Entity *ent )
|
|||
if ( !EntityIsValidTarget(ent) )
|
||||
return false;
|
||||
|
||||
// Dont wake ourselves up
|
||||
// Don't wake ourselves up
|
||||
if ( ent->entnum == act->entnum )
|
||||
return false;
|
||||
|
||||
|
@ -215,49 +200,19 @@ qboolean SensoryPerception::_SenseEntity( Entity *ent )
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Check if we're in the PVS
|
||||
if ( gi.inPVS( ent->centroid, act->centroid ) )
|
||||
{
|
||||
// Check if we can see the enemy
|
||||
if ( CanSeeEntity ( act , ent , true , true ) )
|
||||
Stimuli( STIMULI_SIGHT , ent );
|
||||
else
|
||||
{
|
||||
// Lets not idle for teammates, just players
|
||||
if ( ent->isSubclassOf( Player ) )
|
||||
{
|
||||
// We couldn't see the enemy, but we're in the PVS, so we need to wake up and idle a bit.
|
||||
if ( ( world->farplane_distance == 0 ) || ( Distance( ent->centroid, act->centroid ) < world->farplane_distance ) )
|
||||
{
|
||||
act->Wakeup();
|
||||
//act->ActivateAI();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
if ( gi.inPVS( ent->centroid, act->centroid ) )
|
||||
{
|
||||
Vector enemyToSelf;
|
||||
enemyToSelf = act->origin - ent->origin;
|
||||
|
||||
float visionDistance = GetVisionDistance();
|
||||
auto enemyToSelf = act->origin - ent->origin;
|
||||
auto visionDistance = GetVisionDistance();
|
||||
|
||||
if ( enemyToSelf.length() < visionDistance )
|
||||
{
|
||||
if ( CanSeeEntity( act, ent, true, true ) )
|
||||
Stimuli( STIMULI_SIGHT , ent );
|
||||
Stimuli( StimuliSight , ent );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -363,17 +318,17 @@ void SensoryPerception::Stimuli( int new_stimuli, const Vector &pos, int sound_T
|
|||
void SensoryPerception::RespondTo(const str &stimuli_name , qboolean respond )
|
||||
{
|
||||
if ( !Q_stricmp( stimuli_name.c_str() , "sight" ) )
|
||||
RespondTo(STIMULI_SIGHT , respond );
|
||||
RespondTo(StimuliSight , respond );
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "sound" ) )
|
||||
RespondTo(STIMULI_SOUND , respond );
|
||||
RespondTo(StimuliSound , respond );
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "pain" ) )
|
||||
RespondTo(STIMULI_PAIN , respond );
|
||||
RespondTo(StimuliPain , respond );
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "script" ) )
|
||||
RespondTo(STIMULI_SCRIPT , respond );
|
||||
RespondTo(StimuliScript , respond );
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "all" ) )
|
||||
RespondTo(STIMULI_ALL , respond );
|
||||
RespondTo(StimuliAll , respond );
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "none" ) )
|
||||
RespondTo(STIMULI_NONE , respond );
|
||||
RespondTo(StimuliNone , respond );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -384,23 +339,15 @@ void SensoryPerception::RespondTo(const str &stimuli_name , qboolean respond )
|
|||
//
|
||||
void SensoryPerception::RespondTo( int stimuli , qboolean respond )
|
||||
{
|
||||
if ( stimuli == STIMULI_ALL )
|
||||
if ( stimuli == StimuliAll )
|
||||
{
|
||||
if ( respond )
|
||||
_stimuli = STIMULI_ALL;
|
||||
else
|
||||
_stimuli = STIMULI_NONE;
|
||||
|
||||
_stimuli = respond ? StimuliAll : StimuliNone;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( stimuli == STIMULI_NONE )
|
||||
if ( stimuli == StimuliNone )
|
||||
{
|
||||
if ( respond )
|
||||
_stimuli = STIMULI_NONE;
|
||||
else
|
||||
_stimuli = STIMULI_ALL;
|
||||
|
||||
_stimuli = respond ? StimuliNone : StimuliAll;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -422,47 +369,47 @@ void SensoryPerception::PermanentlyRespondTo(const str &stimuli_name , qboolean
|
|||
if ( !Q_stricmp( stimuli_name.c_str() , "sight" ) )
|
||||
{
|
||||
if ( respond )
|
||||
_permanent_stimuli |= STIMULI_SIGHT;
|
||||
_permanent_stimuli |= StimuliSight;
|
||||
else
|
||||
_permanent_stimuli &= ~STIMULI_SIGHT;
|
||||
_permanent_stimuli &= ~StimuliSight;
|
||||
}
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "sound" ) )
|
||||
{
|
||||
if ( respond )
|
||||
_permanent_stimuli |= STIMULI_SOUND;
|
||||
_permanent_stimuli |= StimuliSound;
|
||||
else
|
||||
_permanent_stimuli &= ~STIMULI_SOUND;
|
||||
_permanent_stimuli &= ~StimuliSound;
|
||||
}
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "pain" ) )
|
||||
{
|
||||
if ( respond )
|
||||
_permanent_stimuli |= STIMULI_PAIN;
|
||||
_permanent_stimuli |= StimuliPain;
|
||||
else
|
||||
_permanent_stimuli &= ~STIMULI_PAIN;
|
||||
_permanent_stimuli &= ~StimuliPain;
|
||||
|
||||
}
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "script" ) )
|
||||
{
|
||||
if ( respond )
|
||||
_permanent_stimuli |= STIMULI_SCRIPT;
|
||||
_permanent_stimuli |= StimuliScript;
|
||||
else
|
||||
_permanent_stimuli &= ~STIMULI_SCRIPT;
|
||||
_permanent_stimuli &= ~StimuliScript;
|
||||
|
||||
}
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "all" ) )
|
||||
{
|
||||
if ( respond )
|
||||
_permanent_stimuli = STIMULI_ALL;
|
||||
_permanent_stimuli = StimuliAll;
|
||||
else
|
||||
_permanent_stimuli = STIMULI_NONE;
|
||||
_permanent_stimuli = StimuliNone;
|
||||
|
||||
}
|
||||
else if ( !Q_stricmp( stimuli_name.c_str() , "none" ) )
|
||||
{
|
||||
if ( respond )
|
||||
_permanent_stimuli = STIMULI_NONE;
|
||||
_permanent_stimuli = StimuliNone;
|
||||
else
|
||||
_permanent_stimuli = STIMULI_ALL;
|
||||
_permanent_stimuli = StimuliAll;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,47 +420,47 @@ void SensoryPerception::PermanentlyRespondTo(const str &stimuli_name , qboolean
|
|||
//
|
||||
qboolean SensoryPerception::ShouldRespondToStimuli( int new_stimuli )
|
||||
{
|
||||
if( ( act->targetType == ATTACK_SCRIPTED_ONLY ) && ( new_stimuli != STIMULI_SCRIPT ) ) return false;
|
||||
if( act->targetType == ATTACK_SCRIPTED_ONLY && new_stimuli != StimuliScript ) return false;
|
||||
|
||||
if ( _stimuli == STIMULI_ALL )
|
||||
if ( _stimuli == StimuliAll )
|
||||
return true;
|
||||
|
||||
if ( _stimuli == STIMULI_NONE )
|
||||
if ( _stimuli == StimuliNone )
|
||||
return false;
|
||||
|
||||
return ( (( new_stimuli & _stimuli ) && ( new_stimuli & _permanent_stimuli )) || ( new_stimuli == STIMULI_SCRIPT ) );
|
||||
return new_stimuli & _stimuli && new_stimuli & _permanent_stimuli || new_stimuli == StimuliScript;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Name: ShowInfo()
|
||||
// Parameters: None
|
||||
// Description: Prints sensoryinformation to the console
|
||||
// Description: Prints sensory information to the console
|
||||
//
|
||||
void SensoryPerception::ShowInfo()
|
||||
{
|
||||
if ( ShouldRespondToStimuli( STIMULI_ALL ) )
|
||||
if ( ShouldRespondToStimuli( StimuliAll ) )
|
||||
{
|
||||
gi.Printf( "Actor is Responding To: ALL" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ShouldRespondToStimuli( STIMULI_NONE ) )
|
||||
if ( ShouldRespondToStimuli( StimuliNone ) )
|
||||
{
|
||||
gi.Printf( "Actor is Responding To: NONE" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ShouldRespondToStimuli( STIMULI_SIGHT ) )
|
||||
if ( ShouldRespondToStimuli( StimuliSight ) )
|
||||
gi.Printf( "Actor is Responding To: SIGHT" );
|
||||
|
||||
if ( ShouldRespondToStimuli( STIMULI_SOUND ) )
|
||||
if ( ShouldRespondToStimuli( StimuliSound ) )
|
||||
gi.Printf( "Actor is Responding To: SOUND" );
|
||||
|
||||
if ( ShouldRespondToStimuli( STIMULI_PAIN ) )
|
||||
if ( ShouldRespondToStimuli( StimuliPain ) )
|
||||
gi.Printf( "Actor is Responding To: PAIN" );
|
||||
|
||||
if ( ShouldRespondToStimuli( STIMULI_SCRIPT ) )
|
||||
if ( ShouldRespondToStimuli( StimuliScript ) )
|
||||
gi.Printf( "Actor is Responding To: SCRIPT" );
|
||||
|
||||
}
|
||||
|
@ -537,8 +484,8 @@ qboolean SensoryPerception::WithinVisionDistance( const Entity *ent )
|
|||
gi.Error( ERR_DROP, "SensoryPerception::WithinVisionDistance -- actor is NULL" );
|
||||
|
||||
|
||||
// Use whichever is less : the actor's vision distance or the distance of the farplane (fog)
|
||||
if ( ( world->farplane_distance != 0.0f ) && ( world->farplane_distance < _vision_distance ) )
|
||||
// Use whichever is less : the actor's vision distance or the distance of the far plane (fog)
|
||||
if ( world->farplane_distance != 0.0f && world->farplane_distance < _vision_distance )
|
||||
distance = world->farplane_distance;
|
||||
else
|
||||
distance = _vision_distance;
|
||||
|
@ -553,8 +500,8 @@ qboolean SensoryPerception::WithinVisionDistance( const Vector &pos )
|
|||
if ( !act )
|
||||
gi.Error( ERR_DROP, "SensoryPerception::WithinVisionDistance -- actor is NULL" );
|
||||
|
||||
// Use whichever is less : the actor's vision distance or the distance of the farplane (fog)
|
||||
if ( ( world->farplane_distance != 0.0f ) && ( world->farplane_distance < _vision_distance ) )
|
||||
// Use whichever is less : the actor's vision distance or the distance of the far plane (fog)
|
||||
if ( world->farplane_distance != 0.0f && world->farplane_distance < _vision_distance )
|
||||
distance = world->farplane_distance;
|
||||
else
|
||||
distance = _vision_distance;
|
||||
|
@ -571,19 +518,13 @@ qboolean SensoryPerception::WithinVisionDistance( const Vector &pos )
|
|||
//
|
||||
qboolean SensoryPerception::InFOV( const Vector &pos, float check_fov, float check_fovdot )
|
||||
{
|
||||
Vector delta;
|
||||
float dot;
|
||||
Vector temp;
|
||||
int tagNum;
|
||||
|
||||
|
||||
if ( !act )
|
||||
gi.Error( ERR_DROP, "SensoryPerception::InFOV -- actor is NULL" );
|
||||
|
||||
if ( check_fov == 360.0f )
|
||||
return true;
|
||||
temp = act->EyePosition();
|
||||
delta = pos - act->EyePosition();
|
||||
|
||||
auto delta = pos - act->EyePosition();
|
||||
|
||||
if ( !delta.x && !delta.y )
|
||||
{
|
||||
|
@ -596,8 +537,9 @@ qboolean SensoryPerception::InFOV( const Vector &pos, float check_fov, float che
|
|||
|
||||
delta.normalize();
|
||||
|
||||
tagNum = gi.Tag_NumForName( act->edict->s.modelindex, "tag_eyes" );
|
||||
auto tagNum = gi.Tag_NumForName( act->edict->s.modelindex, "tag_eyes" );
|
||||
|
||||
float dot;
|
||||
if ( tagNum >= 0 )
|
||||
{
|
||||
Vector tag_pos;
|
||||
|
@ -611,7 +553,7 @@ qboolean SensoryPerception::InFOV( const Vector &pos, float check_fov, float che
|
|||
dot = DotProduct( act->orientation[ 0 ], delta );
|
||||
}
|
||||
|
||||
return ( dot > check_fovdot );
|
||||
return dot > check_fovdot;
|
||||
|
||||
}
|
||||
|
||||
|
@ -653,7 +595,7 @@ qboolean SensoryPerception::CanSeeEntity( Entity *start, const Entity *target, q
|
|||
return false;
|
||||
|
||||
// Check if This Actor can even see at all
|
||||
if ( !ShouldRespondToStimuli( STIMULI_SIGHT ) )
|
||||
if ( !ShouldRespondToStimuli( StimuliSight ) )
|
||||
return false;
|
||||
|
||||
// Check for FOV
|
||||
|
@ -671,18 +613,14 @@ qboolean SensoryPerception::CanSeeEntity( Entity *start, const Entity *target, q
|
|||
}
|
||||
|
||||
// Do Trace
|
||||
trace_t trace;
|
||||
Vector p;
|
||||
Vector eyePos;
|
||||
|
||||
p = target->centroid;
|
||||
eyePos = vec_zero;
|
||||
auto p = target->centroid;
|
||||
auto eyePos = vec_zero;
|
||||
|
||||
// If the start entity is an actor, then we want to add in the eyeposition
|
||||
if ( start->isSubclassOf ( Actor ) )
|
||||
{
|
||||
Actor *a;
|
||||
a = (Actor*)start;
|
||||
a = dynamic_cast<Actor*>(start);
|
||||
|
||||
if ( !a )
|
||||
return false;
|
||||
|
@ -692,15 +630,9 @@ qboolean SensoryPerception::CanSeeEntity( Entity *start, const Entity *target, q
|
|||
}
|
||||
|
||||
// Check if he's visible
|
||||
trace = G_Trace( eyePos, vec_zero, vec_zero, p, target, MASK_OPAQUE, false, "SensoryPerception::CanSeeEntity" );
|
||||
|
||||
//if ( act->actortype == IS_TEAMMATE )
|
||||
// {
|
||||
// G_DebugLine( eyePos , target->centroid, 0.0f, 0.0f, 1.0f, 1.0f );
|
||||
// G_DebugLine( eyePos , trace.endpos , 1.0f, 0.0f, 1.0f, 1.0f );
|
||||
// }
|
||||
auto trace = G_Trace( eyePos, vec_zero, vec_zero, p, target, MASK_OPAQUE, false, "SensoryPerception::CanSeeEntity" );
|
||||
|
||||
if ( ( trace.fraction == 1.0f ) || ( trace.ent == target->edict ) )
|
||||
if ( trace.fraction == 1.0f || trace.ent == target->edict )
|
||||
return true;
|
||||
|
||||
// Check if his head is visible
|
||||
|
@ -724,14 +656,12 @@ qboolean SensoryPerception::CanSeeEntity( Entity *start, const Entity *target, q
|
|||
//
|
||||
qboolean SensoryPerception::CanSeeEntity( const Vector &start , const Entity *target, qboolean useFOV , qboolean useVisionDistance )
|
||||
{
|
||||
Vector realStart;
|
||||
|
||||
// Check for NULL
|
||||
if ( !target )
|
||||
return false;
|
||||
|
||||
// Check if This Actor can even see at all
|
||||
if ( !ShouldRespondToStimuli( STIMULI_SIGHT ) )
|
||||
if ( !ShouldRespondToStimuli( StimuliSight ) )
|
||||
return false;
|
||||
|
||||
|
||||
|
@ -750,21 +680,16 @@ qboolean SensoryPerception::CanSeeEntity( const Vector &start , const Entity *ta
|
|||
}
|
||||
|
||||
// Do Trace
|
||||
trace_t trace;
|
||||
Vector p;
|
||||
Vector eyePos;
|
||||
|
||||
realStart = start;
|
||||
|
||||
p = target->centroid;
|
||||
auto realStart = start;
|
||||
auto p = target->centroid;
|
||||
|
||||
// Add in the eye offset
|
||||
|
||||
eyePos = act->EyePosition() - act->origin;
|
||||
auto eyePos = act->EyePosition() - act->origin;
|
||||
realStart += eyePos;
|
||||
|
||||
// Check if he's visible
|
||||
trace = G_Trace( realStart, vec_zero, vec_zero, p, act, MASK_OPAQUE, false, "SensoryPerception::CanSeeEntity" );
|
||||
auto trace = G_Trace( realStart, vec_zero, vec_zero, p, act, MASK_OPAQUE, false, "SensoryPerception::CanSeeEntity" );
|
||||
if ( trace.fraction == 1.0f || trace.ent == target->edict )
|
||||
return true;
|
||||
|
||||
|
@ -795,7 +720,7 @@ qboolean SensoryPerception::CanSeeEntityComplex(Entity *start, Entity *target, q
|
|||
return false;
|
||||
|
||||
// Check if This Actor can even see at all
|
||||
if ( !ShouldRespondToStimuli( STIMULI_SIGHT ) )
|
||||
if ( !ShouldRespondToStimuli( StimuliSight ) )
|
||||
return false;
|
||||
|
||||
if ( !act )
|
||||
|
@ -826,7 +751,7 @@ qboolean SensoryPerception::CanSeeEntityComplex( Vector &start, Entity *target,
|
|||
return false;
|
||||
|
||||
// Check if This Actor can even see at all
|
||||
if ( !ShouldRespondToStimuli( STIMULI_SIGHT ) )
|
||||
if ( !ShouldRespondToStimuli( StimuliSight ) )
|
||||
return false;
|
||||
|
||||
if ( !act )
|
||||
|
@ -845,7 +770,7 @@ qboolean SensoryPerception::CanSeePosition( const Vector &start, const Vector &p
|
|||
{
|
||||
|
||||
// Check if This Actor can even see at all
|
||||
if ( !ShouldRespondToStimuli( STIMULI_SIGHT ) )
|
||||
if ( !ShouldRespondToStimuli( StimuliSight ) )
|
||||
return false;
|
||||
|
||||
// Check for FOV
|
||||
|
@ -863,13 +788,8 @@ qboolean SensoryPerception::CanSeePosition( const Vector &start, const Vector &p
|
|||
}
|
||||
|
||||
// Do Trace
|
||||
trace_t trace;
|
||||
Vector eyePos;
|
||||
|
||||
eyePos = vec_zero;
|
||||
|
||||
// Check if he's visible
|
||||
trace = G_Trace( start, vec_zero, vec_zero, position, act, MASK_OPAQUE, false, "SensoryPerception::CanSeeEntity" );
|
||||
auto trace = G_Trace( start, vec_zero, vec_zero, position, act, MASK_OPAQUE, false, "SensoryPerception::CanSeeEntity" );
|
||||
if ( trace.fraction == 1.0f )
|
||||
return true;
|
||||
|
||||
|
@ -886,17 +806,15 @@ qboolean SensoryPerception::CanSeePosition( const Vector &start, const Vector &p
|
|||
//
|
||||
qboolean SensoryPerception::_CanSeeComplex( Vector &start, Entity *target , qboolean useFOV, qboolean useVisionDistance )
|
||||
{
|
||||
Vector d;
|
||||
Vector p1;
|
||||
Vector p2;
|
||||
|
||||
if ( !target )
|
||||
return false;
|
||||
|
||||
d = target->centroid - start;
|
||||
auto d = target->centroid - start;
|
||||
d.z = 0;
|
||||
d.normalize();
|
||||
|
||||
Vector p1;
|
||||
Vector p2;
|
||||
p1.x = -d.y;
|
||||
p1.y = d.x;
|
||||
p1 *= max( act->size.x, act->size.y ) * 1.44f * 0.5f;
|
||||
|
|
|
@ -20,9 +20,7 @@ class SensoryPerception;
|
|||
#ifndef __ACTOR_SENSORYPERCEPTION_H__
|
||||
#define __ACTOR_SENSORYPERCEPTION_H__
|
||||
|
||||
#include "actor.h"
|
||||
#include "actorincludes.h"
|
||||
#include "weapon.h"
|
||||
|
||||
//============================
|
||||
// Class SensoryPerception
|
||||
|
@ -30,102 +28,101 @@ class SensoryPerception;
|
|||
//
|
||||
// Class used to handle all sensory perception by actors.
|
||||
//
|
||||
class SensoryPerception
|
||||
{
|
||||
public:
|
||||
SensoryPerception();
|
||||
SensoryPerception(Actor *actor );
|
||||
~SensoryPerception();
|
||||
|
||||
// Sense functions
|
||||
void SenseEnemies();
|
||||
void SearchForEnemies();
|
||||
class SensoryPerception
|
||||
{
|
||||
public:
|
||||
SensoryPerception();
|
||||
explicit SensoryPerception(Actor *actor);
|
||||
virtual ~SensoryPerception();
|
||||
|
||||
// Sense functions
|
||||
void SenseEnemies();
|
||||
|
||||
|
||||
// Stimuli functions
|
||||
void Stimuli( int stimuli );
|
||||
void Stimuli( int stimuli, Entity *ent );
|
||||
void Stimuli( int stimuli, const Vector &pos );
|
||||
void Stimuli( int stimuli, const Vector &pos, int sound_Type );
|
||||
void RespondTo( const str &stimuli_name , qboolean respond );
|
||||
void RespondTo( int stimuli, qboolean respond );
|
||||
void PermanentlyRespondTo( const str &stimuli_name , qboolean respond );
|
||||
qboolean ShouldRespondToStimuli( int new_stimuli );
|
||||
|
||||
// Stimuli functions
|
||||
void Stimuli(int stimuli);
|
||||
void Stimuli(int stimuli, Entity *ent);
|
||||
void Stimuli(int stimuli, const Vector &pos);
|
||||
void Stimuli(int stimuli, const Vector &pos, int sound_Type);
|
||||
void RespondTo(const str &stimuli_name, qboolean respond);
|
||||
void RespondTo(int stimuli, qboolean respond);
|
||||
void PermanentlyRespondTo(const str &stimuli_name, qboolean respond);
|
||||
qboolean ShouldRespondToStimuli(int new_stimuli);
|
||||
|
||||
// Vision functions
|
||||
qboolean WithinVisionDistance( const Entity *ent );
|
||||
qboolean WithinVisionDistance( const Vector &pos );
|
||||
qboolean InFOV( const Vector &pos, float check_fov, float check_fovdot );
|
||||
qboolean InFOV( const Vector &pos );
|
||||
qboolean InFOV( const Entity *ent );
|
||||
|
||||
// New Vision Functions -- Simplified Vision
|
||||
qboolean CanSeeEntity( Entity *start , const Entity *target, qboolean useFOV, qboolean useVisionDistance );
|
||||
qboolean CanSeeEntity( const Vector &start , const Entity *target, qboolean useFOV, qboolean useVisionDistance );
|
||||
|
||||
// New Vision Functions -- More Sophisticated Vision
|
||||
qboolean CanSeeEntityComplex( Entity *start , Entity *target, qboolean useFOV, qboolean useVisionDistance );
|
||||
qboolean CanSeeEntityComplex( Vector &start , Entity *target, qboolean useFOV, qboolean useVisionDistance );
|
||||
|
||||
qboolean CanSeePosition( const Vector &start, const Vector &position, qboolean useFOV, qboolean useVisionDistance );
|
||||
// Vision functions
|
||||
qboolean WithinVisionDistance(const Entity *ent);
|
||||
qboolean WithinVisionDistance(const Vector &pos);
|
||||
qboolean InFOV(const Vector &pos, float check_fov, float check_fovdot);
|
||||
qboolean InFOV(const Vector &pos);
|
||||
qboolean InFOV(const Entity *ent);
|
||||
|
||||
qboolean isInLineOfSight( const Vector &position , const int entNum );
|
||||
qboolean checkInLineOfSight( const Vector &position , const int entNum );
|
||||
// New Vision Functions -- Simplified Vision
|
||||
qboolean CanSeeEntity(Entity *start, const Entity *target, qboolean useFOV, qboolean useVisionDistance);
|
||||
qboolean CanSeeEntity(const Vector &start, const Entity *target, qboolean useFOV, qboolean useVisionDistance);
|
||||
|
||||
// Debugging Functions
|
||||
void ShowInfo();
|
||||
// New Vision Functions -- More Sophisticated Vision
|
||||
qboolean CanSeeEntityComplex(Entity *start, Entity *target, qboolean useFOV, qboolean useVisionDistance);
|
||||
qboolean CanSeeEntityComplex(Vector &start, Entity *target, qboolean useFOV, qboolean useVisionDistance);
|
||||
|
||||
// Accessors and Mutators
|
||||
void SetNoisePosition( const Vector &pos );
|
||||
Vector GetNoisePosition();
|
||||
qboolean CanSeePosition(const Vector &start, const Vector &position, qboolean useFOV, qboolean useVisionDistance);
|
||||
|
||||
void SetLastSoundType( int soundtype );
|
||||
int GetLastSoundType();
|
||||
qboolean isInLineOfSight(const Vector &position, const int entNum);
|
||||
qboolean checkInLineOfSight(const Vector &position, const int entNum);
|
||||
|
||||
void SetNoiseTime( float noisetime );
|
||||
float GetNoiseTime();
|
||||
// Debugging Functions
|
||||
void ShowInfo();
|
||||
|
||||
void SetFOV( float fov );
|
||||
float GetFOV();
|
||||
// Accessors and Mutators
|
||||
void SetNoisePosition(const Vector &pos);
|
||||
Vector GetNoisePosition();
|
||||
|
||||
void SetFOVdot( float fov_dot );
|
||||
float GetFOVdot();
|
||||
void SetLastSoundType(int soundtype);
|
||||
int GetLastSoundType();
|
||||
|
||||
void SetVisionDistance( float vision_distance );
|
||||
float GetVisionDistance();
|
||||
|
||||
// Archiving
|
||||
virtual void Archive( Archiver &arc );
|
||||
void DoArchive( Archiver &arc , Actor *actor );
|
||||
|
||||
private: //Functions
|
||||
qboolean _CanSeeComplex( Vector &start , Entity *target , qboolean useFOV , qboolean useVisionDistance );
|
||||
qboolean _SenseEntity( Entity *ent );
|
||||
void _init();
|
||||
void SetNoiseTime(float noisetime);
|
||||
float GetNoiseTime();
|
||||
|
||||
private: //Member Variables
|
||||
|
||||
// Stimuli Variables
|
||||
int _stimuli;
|
||||
int _permanent_stimuli;
|
||||
void SetFOV(float fov);
|
||||
float GetFOV();
|
||||
|
||||
// Hearing Variables
|
||||
Vector _noise_position;
|
||||
int _last_soundType;
|
||||
float _noise_time;
|
||||
|
||||
// Vision Stuff for "seeing"
|
||||
float _fov;
|
||||
float _fovdot;
|
||||
float _vision_distance;
|
||||
void SetFOVdot(float fov_dot);
|
||||
float GetFOVdot();
|
||||
|
||||
float _nextSenseTime;
|
||||
void SetVisionDistance(float vision_distance);
|
||||
float GetVisionDistance();
|
||||
|
||||
LineOfSight_t _lineOfSight;
|
||||
// Archiving
|
||||
virtual void Archive(Archiver &arc);
|
||||
void DoArchive(Archiver &arc, Actor *actor);
|
||||
|
||||
Actor *act;
|
||||
|
||||
};
|
||||
private: //Functions
|
||||
qboolean _CanSeeComplex(Vector &start, Entity *target, qboolean useFOV, qboolean useVisionDistance);
|
||||
qboolean _SenseEntity(Entity *ent);
|
||||
void _init();
|
||||
|
||||
//Member Variables
|
||||
|
||||
// Stimuli Variables
|
||||
int _stimuli;
|
||||
int _permanent_stimuli;
|
||||
|
||||
// Hearing Variables
|
||||
Vector _noise_position;
|
||||
int _last_soundType;
|
||||
float _noise_time;
|
||||
|
||||
// Vision Stuff for "seeing"
|
||||
float _fov;
|
||||
float _fovdot;
|
||||
float _vision_distance;
|
||||
|
||||
float _nextSenseTime;
|
||||
|
||||
LineOfSight_t _lineOfSight;
|
||||
|
||||
Actor *act;
|
||||
|
||||
};
|
||||
|
||||
#endif /* __ACTOR_SENSORYPERCEPTION_H__ */
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
//
|
||||
|
||||
#include "_pch_cpp.h"
|
||||
#include "actorgamecomponents.h"
|
||||
#include "player.h"
|
||||
|
||||
|
||||
//
|
||||
|
@ -74,7 +72,7 @@ EFGameComponent::EFGameComponent()
|
|||
EFGameComponent::EFGameComponent( const Actor *actor )
|
||||
{
|
||||
if ( actor )
|
||||
act = (Actor *)actor;
|
||||
act = const_cast<Actor*>(actor);
|
||||
}
|
||||
|
||||
void EFGameComponent::DoArchive( Archiver &arc , const Actor *actor )
|
||||
|
@ -82,7 +80,7 @@ void EFGameComponent::DoArchive( Archiver &arc , const Actor *actor )
|
|||
Q_UNUSED(arc);
|
||||
|
||||
if ( actor )
|
||||
act = (Actor *)actor;
|
||||
act = const_cast<Actor *>(actor);
|
||||
else
|
||||
gi.Error( ERR_FATAL, "EFGameComponnet::DoArchive -- actor is NULL" );
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ class RedemptionGameComponent;
|
|||
#ifndef __ACTORGAMECOMPONENTS_H__
|
||||
#define __ACTORGAMECOMPONENTS_H__
|
||||
|
||||
#include "actor.h"
|
||||
|
||||
//============================
|
||||
// Class ActorGameComponent
|
||||
//============================
|
||||
|
@ -35,20 +33,20 @@ class RedemptionGameComponent;
|
|||
// Base class from which all Actor Game Components are derived.
|
||||
//
|
||||
class ActorGameComponent : public Listener
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE( ActorGameComponent );
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE(ActorGameComponent);
|
||||
|
||||
ActorGameComponent() {}
|
||||
virtual void HandleEvent( Event * ) {}
|
||||
virtual void HandleArmorDamage( Event * ) {}
|
||||
virtual void HandleDeath( const Entity * ) {}
|
||||
virtual void HandleThink() {}
|
||||
|
||||
virtual qboolean DoCheck( const Conditional & ) { return false; }
|
||||
virtual void DoArchive( Archiver &, const Actor * ) {}
|
||||
ActorGameComponent() { }
|
||||
virtual void HandleEvent(Event *) { }
|
||||
virtual void HandleArmorDamage(Event *) { }
|
||||
virtual void HandleDeath(const Entity *) { }
|
||||
virtual void HandleThink() { }
|
||||
|
||||
};
|
||||
virtual qboolean DoCheck(const Conditional &) { return false; }
|
||||
virtual void DoArchive(Archiver &, const Actor *) { }
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
EF Specific Stuff
|
||||
|
@ -57,23 +55,23 @@ EF Specific Stuff
|
|||
// Class EFGameComponent
|
||||
//============================
|
||||
class EFGameComponent : public ActorGameComponent
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE( EFGameComponent );
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE(EFGameComponent);
|
||||
|
||||
EFGameComponent();
|
||||
EFGameComponent( const Actor *actor );
|
||||
EFGameComponent();
|
||||
EFGameComponent(const Actor *actor);
|
||||
|
||||
void HandleEvent( Event *ev );
|
||||
void HandleArmorDamage( Event *ev );
|
||||
void HandleDeath( const Entity *ent);
|
||||
void HandleThink();
|
||||
void HandleEvent(Event *ev);
|
||||
void HandleArmorDamage(Event *ev);
|
||||
void HandleDeath(const Entity *ent);
|
||||
void HandleThink();
|
||||
|
||||
qboolean DoCheck( const Conditional &condition );
|
||||
void DoArchive( Archiver &arc , const Actor *act );
|
||||
qboolean DoCheck(const Conditional &condition);
|
||||
void DoArchive(Archiver &arc, const Actor *act);
|
||||
|
||||
private:
|
||||
Actor *act;
|
||||
};
|
||||
private:
|
||||
Actor *act;
|
||||
};
|
||||
|
||||
#endif /*__ACTORGAMECOMPONENTS_H__*/
|
||||
|
|
|
@ -28,8 +28,8 @@ extern Event EV_Actor_Start;
|
|||
extern Event EV_Actor_Dead;
|
||||
extern Event EV_Actor_LookAt;
|
||||
extern Event EV_Actor_TurnTo;
|
||||
extern Event EV_Actor_BehaviorFinished ;
|
||||
extern Event EV_Actor_ControlLost ;
|
||||
extern Event EV_Actor_BehaviorFinished;
|
||||
extern Event EV_Actor_ControlLost;
|
||||
extern Event EV_Actor_EndBehavior;
|
||||
extern Event EV_Actor_EndHeadBehavior;
|
||||
extern Event EV_Actor_EndEyeBehavior;
|
||||
|
@ -61,112 +61,126 @@ extern Event EV_Actor_Statemap;
|
|||
extern Event EV_Actor_SetTargetable;
|
||||
extern Event EV_Sentient_StopFire;
|
||||
extern Event EV_Sentient_Attack;
|
||||
extern Event EV_Actor_SetUseGravity ;
|
||||
extern Event EV_Actor_SetSimplifiedThink ;
|
||||
extern Event EV_Actor_SetStickToGround ;
|
||||
extern Event EV_Actor_SetMovementMode ;
|
||||
extern Event EV_Actor_SetUseGravity;
|
||||
extern Event EV_Actor_SetSimplifiedThink;
|
||||
extern Event EV_Actor_SetStickToGround;
|
||||
extern Event EV_Actor_SetMovementMode;
|
||||
|
||||
//========================================
|
||||
// General Defines
|
||||
//========================================
|
||||
#define MAX_ALIAS_NAME_LENGTH 32
|
||||
#define MAX_INACTIVE_TIME 30.0
|
||||
#define DEFAULT_FOV 150
|
||||
#define DEFAULT_VISION_DISTANCE 1536
|
||||
#define MIN_SIGHT_DELAY 2
|
||||
#define RANDOM_SIGHT_DELAY 1.5
|
||||
#define DEFAULT_INITIAL_HATE 100
|
||||
#define TURN_SPEED 60 //Used to be 25
|
||||
#define HELPER_NODE_MAX_DISTANCE 96.0
|
||||
#define HELPER_NODE_ARRIVAL_DISTANCE 24.0
|
||||
static const uint8_t MAX_ALIAS_NAME_LENGTH = 32;
|
||||
static const float MAX_INACTIVE_TIME = 30.0f;
|
||||
static const uint8_t DEFAULT_FOV = 150;
|
||||
static const uint16_t DEFAULT_VISION_DISTANCE = 1536;
|
||||
static const uint8_t MIN_SIGHT_DELAY = 2;
|
||||
static const float RANDOM_SIGHT_DELAY = 1.5f;
|
||||
static const uint8_t DEFAULT_INITIAL_HATE = 100;
|
||||
static const float TURN_SPEED = 60.0f; //Used to be 25
|
||||
static const float HELPER_NODE_MAX_DISTANCE = 96.0f;
|
||||
static const float HELPER_NODE_ARRIVAL_DISTANCE = 24.0f;
|
||||
|
||||
#define HACK_PATH_CHECK 1.0
|
||||
static const float HACK_PATH_CHECK = 1.0f;
|
||||
|
||||
|
||||
|
||||
//========================================
|
||||
// Stimuli types
|
||||
//========================================
|
||||
#define STIMULI_ALL -1
|
||||
#define STIMULI_NONE 0
|
||||
#define STIMULI_SIGHT (1<<0)
|
||||
#define STIMULI_SOUND (1<<1)
|
||||
#define STIMULI_PAIN (1<<2)
|
||||
#define STIMULI_SCRIPT (1<<3)
|
||||
enum EStimuli
|
||||
{
|
||||
StimuliAll = -1,
|
||||
StimuliNone,
|
||||
StimuliSight = 1 << 0,
|
||||
StimuliSound = 1 << 1,
|
||||
StimuliPain = 1 << 2,
|
||||
StimuliScript = 1 << 3
|
||||
};
|
||||
|
||||
//========================================
|
||||
// Bones used by actor
|
||||
//========================================
|
||||
#define ACTOR_MOUTH_TAG 0
|
||||
#define ACTOR_HEAD_TAG 1
|
||||
#define ACTOR_TORSO_TAG 2
|
||||
#define ACTOR_LEYE_TAG 3
|
||||
#define ACTOR_REYE_TAG 4
|
||||
enum EActorBoneTag
|
||||
{
|
||||
ActorMouthTag = 0,
|
||||
ActorHeadTag = 1,
|
||||
ActorTorsoTag = 2,
|
||||
ActorLeyeTag = 3,
|
||||
ActorReyeTag = 4
|
||||
};
|
||||
|
||||
|
||||
//========================================
|
||||
// Dialog stuff
|
||||
//========================================
|
||||
#define MAX_DIALOG_PARAMETERS_LENGTH 100
|
||||
#define MAX_DIALOG_PARM_LENGTH 64
|
||||
#define MAX_DIALOG_PARMS 10
|
||||
#define DIALOG_PARM_TYPE_NONE 0
|
||||
#define DIALOG_PARM_TYPE_PLAYERHAS 1
|
||||
#define DIALOG_PARM_TYPE_PLAYERHASNOT 2
|
||||
#define DIALOG_PARM_TYPE_HAS 3
|
||||
#define DIALOG_PARM_TYPE_HASNOT 4
|
||||
#define DIALOG_PARM_TYPE_DEPENDS 5
|
||||
#define DIALOG_PARM_TYPE_DEPENDSNOT 6
|
||||
#define DIALOG_PARM_TYPE_DEPENDSINT 7
|
||||
#define DIALOG_PARM_TYPE_CONTEXT_INITIATOR 8
|
||||
#define DIALOG_PARM_TYPE_CONTEXT_RESPONSE 9
|
||||
static const uint8_t MAX_DIALOG_PARAMETERS_LENGTH = 100;
|
||||
static const uint8_t MAX_DIALOG_PARM_LENGTH = 64;
|
||||
static const uint8_t MAX_DIALOG_PARMS = 10;
|
||||
static const uint8_t DIALOG_PARM_TYPE_NONE = 0;
|
||||
static const uint8_t DIALOG_PARM_TYPE_PLAYERHAS = 1;
|
||||
static const uint8_t DIALOG_PARM_TYPE_PLAYERHASNOT = 2;
|
||||
static const uint8_t DIALOG_PARM_TYPE_HAS = 3;
|
||||
static const uint8_t DIALOG_PARM_TYPE_HASNOT = 4;
|
||||
static const uint8_t DIALOG_PARM_TYPE_DEPENDS = 5;
|
||||
static const uint8_t DIALOG_PARM_TYPE_DEPENDSNOT = 6;
|
||||
static const uint8_t DIALOG_PARM_TYPE_DEPENDSINT = 7;
|
||||
static const uint8_t DIALOG_PARM_TYPE_CONTEXT_INITIATOR = 8;
|
||||
static const uint8_t DIALOG_PARM_TYPE_CONTEXT_RESPONSE = 9;
|
||||
|
||||
//========================================
|
||||
// State flags
|
||||
//========================================
|
||||
#define STATE_FLAG_IN_PAIN ( 1<<0 )
|
||||
#define STATE_FLAG_MELEE_HIT ( 1<<1 )
|
||||
#define STATE_FLAG_TOUCHED ( 1<<2 )
|
||||
#define STATE_FLAG_ACTIVATED ( 1<<3 )
|
||||
#define STATE_FLAG_USED ( 1<<4 )
|
||||
#define STATE_FLAG_TWITCH ( 1<<5 )
|
||||
#define STATE_FLAG_BLOCKED_HIT ( 1<<6 )
|
||||
#define STATE_FLAG_SMALL_PAIN ( 1<<7 )
|
||||
#define STATE_FLAG_OTHER_DIED ( 1<<8 )
|
||||
#define STATE_FLAG_STUCK ( 1<<9 )
|
||||
#define STATE_FLAG_NO_PATH ( 1<<10 )
|
||||
#define STATE_FLAG_TOUCHED_BY_PLAYER ( 1<<11 )
|
||||
#define STATE_FLAG_CHANGED_WEAPON ( 1<<12 )
|
||||
#define STATE_FLAG_DAMAGE_THRESHOLD_EXCEEDED ( 1<<13 )
|
||||
#define STATE_FLAG_ATTACKED ( 1<<14 )
|
||||
#define STATE_FLAG_ATTACKED_BY_PLAYER ( 1<<15 )
|
||||
#define STATE_FLAG_SHOW_PAIN ( 1<<16 )
|
||||
#define STATE_FLAG_IN_THE_WAY ( 1<<17 )
|
||||
#define STATE_FLAG_STEERING_FAILED ( 1<<18 )
|
||||
#define STATE_FLAG_BLOCKED_BY_ENTITY ( 1<<19 )
|
||||
#define STATE_FLAG_ENEMY_PROJECTILE_CLOSE ( 1<<20 )
|
||||
enum EStateFlag
|
||||
{
|
||||
StateFlagInPain = 1 << 0,
|
||||
StateFlagMeleeHit = 1 << 1,
|
||||
StateFlagTouched = 1 << 2,
|
||||
StateFlagActivated = 1 << 3,
|
||||
StateFlagUsed = 1 << 4,
|
||||
StateFlagTwitch = 1 << 5,
|
||||
StateFlagBlockedHit = 1 << 6,
|
||||
StateFlagSmallPain = 1 << 7,
|
||||
StateFlagOtherDied = 1 << 8,
|
||||
StateFlagStuck = 1 << 9,
|
||||
StateFlagNoPath = 1 << 10,
|
||||
StateFlagTouchedByPlayer = 1 << 11,
|
||||
StateFlagChangedWeapon = 1 << 12,
|
||||
StateFlagDamageThresholdExceeded = 1 << 13,
|
||||
StateFlagAttacked = 1 << 14,
|
||||
StateFlagAttackedByPlayer = 1 << 15,
|
||||
StateFlagShowPain = 1 << 16,
|
||||
StateFlagInTheWay = 1 << 17,
|
||||
StateFlagSteeringFailed = 1 << 18,
|
||||
StateFlagBlockedByEntity = 1 << 19,
|
||||
StateFlagEnemyProjectileClose = 1 << 20
|
||||
};
|
||||
|
||||
//========================================
|
||||
// Combat Subsystem Defines
|
||||
//========================================
|
||||
#define DEFAULT_TRACE_INTERVAL .05f
|
||||
|
||||
#define DEFAULT_PATH_TO_ENEMY_INTERVAL .05f
|
||||
static const float DEFAULT_TRACE_INTERVAL = .05f;
|
||||
static const float DEFAULT_PATH_TO_ENEMY_INTERVAL = .05f;
|
||||
|
||||
//========================================
|
||||
// Actor modes
|
||||
//========================================
|
||||
#define ACTOR_MODE_NONE 0
|
||||
#define ACTOR_MODE_IDLE 1
|
||||
#define ACTOR_MODE_AI 2
|
||||
#define ACTOR_MODE_SCRIPT 3
|
||||
#define ACTOR_MODE_TALK 4
|
||||
enum EActorMode
|
||||
{
|
||||
ActorModeNone,
|
||||
ActorModeIdle,
|
||||
ActorModeAi,
|
||||
ActorModeScript,
|
||||
ActorModeTalk
|
||||
};
|
||||
|
||||
//=======================================
|
||||
// Pain types
|
||||
//=======================================
|
||||
#define PAIN_SMALL 0
|
||||
#define PAIN_BIG 1
|
||||
enum EPainType
|
||||
{
|
||||
PainSmall,
|
||||
PainBig
|
||||
};
|
||||
|
||||
//========================================
|
||||
// Save Flags
|
||||
|
@ -208,39 +222,39 @@ extern Event EV_Actor_SetMovementMode ;
|
|||
//DialogParm_t -- Structure for Dialog Parameters
|
||||
typedef struct
|
||||
{
|
||||
byte type;
|
||||
char parm[ MAX_DIALOG_PARM_LENGTH ];
|
||||
char parm2[ MAX_DIALOG_PARM_LENGTH ];
|
||||
byte type;
|
||||
char parm[MAX_DIALOG_PARM_LENGTH];
|
||||
char parm2[MAX_DIALOG_PARM_LENGTH];
|
||||
} DialogParm_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DIALOG_TYPE_NORMAL,
|
||||
DIALOG_TYPE_RADIUS,
|
||||
DIALOG_TYPE_GREETING,
|
||||
DIALOG_TYPE_COMBAT,
|
||||
DIALOG_TYPE_CONTEXT_INITIATOR,
|
||||
DIALOG_TYPE_CONTEXT_RESPONSE
|
||||
DIALOG_TYPE_NORMAL,
|
||||
DIALOG_TYPE_RADIUS,
|
||||
DIALOG_TYPE_GREETING,
|
||||
DIALOG_TYPE_COMBAT,
|
||||
DIALOG_TYPE_CONTEXT_INITIATOR,
|
||||
DIALOG_TYPE_CONTEXT_RESPONSE
|
||||
} DialogType_t;
|
||||
|
||||
//DialogNode_t -- Structure for Dialog Nodes
|
||||
typedef struct DialogNode_s
|
||||
{
|
||||
char alias_name[ MAX_ALIAS_NAME_LENGTH ];
|
||||
int random_flag;
|
||||
int number_of_parms;
|
||||
float random_percent;
|
||||
DialogType_t dType;
|
||||
DialogParm_t parms[ MAX_DIALOG_PARMS ];
|
||||
struct DialogNode_s *next;
|
||||
} DialogNode_t;
|
||||
{
|
||||
char alias_name[MAX_ALIAS_NAME_LENGTH];
|
||||
int random_flag;
|
||||
int number_of_parms;
|
||||
float random_percent;
|
||||
DialogType_t dType;
|
||||
DialogParm_t parms[MAX_DIALOG_PARMS];
|
||||
struct DialogNode_s *next;
|
||||
} DialogNode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int entNum;
|
||||
float time;
|
||||
qboolean inLineOfSight;
|
||||
} LineOfSight_t;
|
||||
{
|
||||
int entNum;
|
||||
float time;
|
||||
qboolean inLineOfSight;
|
||||
} LineOfSight_t;
|
||||
|
||||
//HateListEntry_t -- Structure for the hate list
|
||||
typedef struct
|
||||
|
@ -268,34 +282,34 @@ typedef struct
|
|||
// Helper Node Data
|
||||
typedef struct
|
||||
{
|
||||
HelperNodePtr node;
|
||||
int mask;
|
||||
int nodeID;
|
||||
HelperNodePtr node;
|
||||
int mask;
|
||||
int nodeID;
|
||||
} CurrentHelperNodeData_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HelperNodePtr node;
|
||||
int mask;
|
||||
int nodeID;
|
||||
HelperNodePtr node;
|
||||
int mask;
|
||||
int nodeID;
|
||||
} IgnoreHelperNodeData_t;
|
||||
|
||||
// Follow Target Data
|
||||
typedef struct
|
||||
{
|
||||
EntityPtr currentFollowTarget;
|
||||
EntityPtr specifiedFollowTarget;
|
||||
float maxRangeIdle;
|
||||
float minRangeIdle;
|
||||
float maxRangeCombat;
|
||||
float minRangeCombat;
|
||||
EntityPtr currentFollowTarget;
|
||||
EntityPtr specifiedFollowTarget;
|
||||
float maxRangeIdle;
|
||||
float minRangeIdle;
|
||||
float maxRangeCombat;
|
||||
float minRangeCombat;
|
||||
} FollowTargetData_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int packageIndex;
|
||||
float currentScore;
|
||||
float lastScore;
|
||||
float lastScore;
|
||||
float lastTimeExecuted;
|
||||
float priority;
|
||||
|
||||
|
@ -320,210 +334,215 @@ typedef struct
|
|||
// StateVar -- Structure for holding StateVars
|
||||
typedef struct
|
||||
{
|
||||
str varName;
|
||||
str varValue;
|
||||
float varTime;
|
||||
str varName;
|
||||
str varValue;
|
||||
float varTime;
|
||||
} StateVar;
|
||||
|
||||
// part_t -- Part stuff
|
||||
typedef struct
|
||||
{
|
||||
EntityPtr ent;
|
||||
unsigned int state_flags;
|
||||
EntityPtr ent;
|
||||
unsigned int state_flags;
|
||||
} part_t;
|
||||
|
||||
// threadlist_t -- A Key/Value pair for all the custom threading stuff we're doing
|
||||
// we will eventually need to convert all those errant actor threads into this.
|
||||
typedef struct
|
||||
{
|
||||
str threadType;
|
||||
str threadName;
|
||||
str threadType;
|
||||
str threadName;
|
||||
} threadlist_t;
|
||||
|
||||
//===========================================
|
||||
// Enumerations
|
||||
//===========================================
|
||||
|
||||
typedef enum{
|
||||
MOVEMENT_TYPE_NORMAL,
|
||||
typedef enum
|
||||
{
|
||||
MOVEMENT_TYPE_NORMAL,
|
||||
MOVEMENT_TYPE_ANIM
|
||||
} MovementType_t;
|
||||
|
||||
//DialogMode_t -- Enumeration of Dialog Modes
|
||||
typedef enum{
|
||||
DIALOG_MODE_ANXIOUS,
|
||||
DIALOG_MODE_NORMAL,
|
||||
DIALOG_MODE_IGNORE
|
||||
} DialogMode_t;
|
||||
typedef enum
|
||||
{
|
||||
DIALOG_MODE_ANXIOUS,
|
||||
DIALOG_MODE_NORMAL,
|
||||
DIALOG_MODE_IGNORE
|
||||
} DialogMode_t;
|
||||
|
||||
|
||||
// actortype_t -- Enumeration of possible actor types
|
||||
typedef enum
|
||||
{
|
||||
IS_INANIMATE,
|
||||
IS_MONSTER,
|
||||
IS_ENEMY,
|
||||
IS_CIVILIAN,
|
||||
IS_FRIEND,
|
||||
IS_ANIMAL,
|
||||
IS_TEAMMATE,
|
||||
NUM_ACTORTYPES
|
||||
} actortype_t;
|
||||
{
|
||||
IS_INANIMATE,
|
||||
IS_MONSTER,
|
||||
IS_ENEMY,
|
||||
IS_CIVILIAN,
|
||||
IS_FRIEND,
|
||||
IS_ANIMAL,
|
||||
IS_TEAMMATE,
|
||||
NUM_ACTORTYPES
|
||||
} actortype_t;
|
||||
|
||||
|
||||
|
||||
// targetType_t -- Enumeration of possible target types
|
||||
typedef enum
|
||||
{
|
||||
ATTACK_ANY,
|
||||
ATTACK_PLAYER_ONLY,
|
||||
ATTACK_ACTORS_ONLY,
|
||||
ATTACK_SCRIPTED_ONLY,
|
||||
ATTACK_LEVEL_INTERACTION
|
||||
} targetType_t;
|
||||
{
|
||||
ATTACK_ANY,
|
||||
ATTACK_PLAYER_ONLY,
|
||||
ATTACK_ACTORS_ONLY,
|
||||
ATTACK_SCRIPTED_ONLY,
|
||||
ATTACK_LEVEL_INTERACTION
|
||||
} targetType_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DEBUG_NONE,
|
||||
DEBUG_STATES_ONLY,
|
||||
DEBUG_STATES_BEHAVIORS,
|
||||
DEBUG_ALL,
|
||||
MAX_DEBUG_TYPES
|
||||
} stateDebugType_t;
|
||||
{
|
||||
DEBUG_NONE,
|
||||
DEBUG_STATES_ONLY,
|
||||
DEBUG_STATES_BEHAVIORS,
|
||||
DEBUG_ALL,
|
||||
MAX_DEBUG_TYPES
|
||||
} stateDebugType_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TALK_TURNTO,
|
||||
TALK_HEADWATCH,
|
||||
TALK_IGNORE
|
||||
} talkModeStates_t;
|
||||
{
|
||||
TALK_TURNTO,
|
||||
TALK_HEADWATCH,
|
||||
TALK_IGNORE
|
||||
} talkModeStates_t;
|
||||
|
||||
// actorflags -- Enumeration of Actor flags
|
||||
typedef enum{
|
||||
ACTOR_FLAG_NOISE_HEARD,
|
||||
ACTOR_FLAG_INVESTIGATING,
|
||||
ACTOR_FLAG_DEATHGIB,
|
||||
ACTOR_FLAG_DEATHFADE,
|
||||
ACTOR_FLAG_NOCHATTER,
|
||||
ACTOR_FLAG_INACTIVE,
|
||||
ACTOR_FLAG_ANIM_DONE,
|
||||
ACTOR_FLAG_STATE_DONE_TIME_VALID,
|
||||
ACTOR_FLAG_MASTER_STATE_DONE_TIME_VALID,
|
||||
ACTOR_FLAG_AI_ON,
|
||||
ACTOR_FLAG_LAST_CANSEEENEMY,
|
||||
ACTOR_FLAG_LAST_CANSEEENEMY_NOFOV,
|
||||
ACTOR_FLAG_DIALOG_PLAYING,
|
||||
ACTOR_FLAG_RADIUS_DIALOG_PLAYING,
|
||||
ACTOR_FLAG_ALLOW_TALK,
|
||||
ACTOR_FLAG_DAMAGE_ONCE_ON,
|
||||
ACTOR_FLAG_DAMAGE_ONCE_DAMAGED,
|
||||
ACTOR_FLAG_BOUNCE_OFF,
|
||||
ACTOR_FLAG_NOTIFY_OTHERS_AT_DEATH,
|
||||
ACTOR_FLAG_HAS_THING1,
|
||||
ACTOR_FLAG_HAS_THING2,
|
||||
ACTOR_FLAG_HAS_THING3,
|
||||
ACTOR_FLAG_HAS_THING4,
|
||||
ACTOR_FLAG_LAST_ATTACK_HIT,
|
||||
ACTOR_FLAG_STARTED,
|
||||
ACTOR_FLAG_ALLOW_HANGBACK,
|
||||
ACTOR_FLAG_USE_GRAVITY,
|
||||
ACTOR_FLAG_SPAWN_FAILED,
|
||||
ACTOR_FLAG_FADING_OUT,
|
||||
ACTOR_FLAG_DEATHSHRINK,
|
||||
ACTOR_FLAG_DEATHSINK,
|
||||
ACTOR_FLAG_STAYSOLID,
|
||||
ACTOR_FLAG_STUNNED,
|
||||
ACTOR_FLAG_ALLOW_FALL,
|
||||
ACTOR_FLAG_FINISHED,
|
||||
ACTOR_FLAG_IN_LIMBO,
|
||||
ACTOR_FLAG_CAN_WALK_ON_OTHERS,
|
||||
ACTOR_FLAG_PUSHABLE,
|
||||
ACTOR_FLAG_LAST_TRY_TALK,
|
||||
ACTOR_FLAG_TARGETABLE,
|
||||
ACTOR_FLAG_IMMORTAL,
|
||||
ACTOR_FLAG_TURNING_HEAD,
|
||||
ACTOR_FLAG_MOVING_EYES,
|
||||
ACTOR_FLAG_DIE_COMPLETELY,
|
||||
ACTOR_FLAG_BLEED_AFTER_DEATH,
|
||||
ACTOR_FLAG_IGNORE_STUCK_WARNING,
|
||||
ACTOR_FLAG_IGNORE_OFF_GROUND_WARNING,
|
||||
ACTOR_FLAG_ALLOWED_TO_KILL,
|
||||
ACTOR_FLAG_TOUCH_TRIGGERS,
|
||||
ACTOR_FLAG_IGNORE_WATER,
|
||||
ACTOR_FLAG_NEVER_IGNORE_SOUNDS,
|
||||
ACTOR_FLAG_SIMPLE_PATHFINDING,
|
||||
ACTOR_FLAG_HAVE_MOVED,
|
||||
ACTOR_FLAG_NO_PAIN_SOUNDS,
|
||||
ACTOR_FLAG_UPDATE_BOSS_HEALTH,
|
||||
ACTOR_FLAG_IGNORE_PAIN_FROM_ACTORS,
|
||||
ACTOR_FLAG_DAMAGE_ALLOWED,
|
||||
ACTOR_FLAG_AT_COVER_NODE,
|
||||
ACTOR_FLAG_WAIT_FOR_NEW_ENEMY,
|
||||
ACTOR_FLAG_TAKE_DAMAGE,
|
||||
ACTOR_FLAG_USE_DAMAGESKINS,
|
||||
ACTOR_FLAG_CAPTURED,
|
||||
ACTOR_FLAG_TURRET_MODE,
|
||||
ACTOR_FLAG_INCOMING_HITSCAN,
|
||||
ACTOR_FLAG_RESPONDING_TO_HITSCAN,
|
||||
ACTOR_FLAG_MELEE_HIT_WORLD,
|
||||
ACTOR_FLAG_TORSO_ANIM_DONE,
|
||||
ACTOR_FLAG_WEAPON_READY,
|
||||
ACTOR_FLAG_DISABLED,
|
||||
ACTOR_FLAG_IN_ALCOVE,
|
||||
ACTOR_FLAG_IN_CONE_OF_FIRE,
|
||||
ACTOR_FLAG_IN_PLAYER_CONE_OF_FIRE,
|
||||
ACTOR_FLAG_PLAYER_IN_CALL_VOLUME,
|
||||
ACTOR_FLAG_IN_CALL_VOLUME,
|
||||
ACTOR_FLAG_OUT_OF_TORSO_RANGE,
|
||||
ACTOR_FLAG_DUCKED,
|
||||
ACTOR_FLAG_PRONE,
|
||||
ACTOR_FLAG_SHOULD_BLINK,
|
||||
ACTOR_FLAG_CRIPPLED,
|
||||
ACTOR_FLAG_RETREATING,
|
||||
ACTOR_FLAG_HIDDEN,
|
||||
ACTOR_FLAG_FOLLOWING_IN_FORMATION,
|
||||
ACTOR_FLAG_DISPLAYING_FAILURE_FX,
|
||||
ACTOR_FLAG_GROUPMEMBER_INJURED,
|
||||
ACTOR_FLAG_CAN_HEAL_OTHER,
|
||||
ACTOR_FLAG_STRICTLY_FOLLOW_PATHS,
|
||||
ACTOR_FLAG_POSTURE_ANIM_DONE,
|
||||
ACTOR_FLAG_ATTACKING_ENEMY,
|
||||
ACTOR_FLAG_UPDATE_HATE_WITH_ATTACKERS,
|
||||
ACTOR_FLAG_LAST_CANSEEPLAYER,
|
||||
ACTOR_FLAG_LAST_CANSEEPLAYER_NOFOV,
|
||||
ACTOR_FLAG_MELEE_ALLOWED,
|
||||
ACTOR_FLAG_PLAYING_DIALOG_ANIM,
|
||||
ACTOR_FLAG_USING_HUD,
|
||||
ACTOR_FLAG_FORCE_LIFEBAR,
|
||||
ACTOR_FLAG_UPDATE_ACTION_LEVEL,
|
||||
ACTOR_FLAG_CAN_CHANGE_ANIM,
|
||||
ACTOR_FLAG_USE_FOLLOWRANGE_FOR_NODES,
|
||||
ACTOR_FLAG_IMMEDIATE_ACTIVATE,
|
||||
ACTOR_FLAG_CANNOT_DISINTEGRATE,
|
||||
ACTOR_FLAG_CANNOT_USE,
|
||||
ACTOR_FLAG_CANNOT_FREEZE,
|
||||
typedef enum
|
||||
{
|
||||
ACTOR_FLAG_NOISE_HEARD,
|
||||
ACTOR_FLAG_INVESTIGATING,
|
||||
ACTOR_FLAG_DEATHGIB,
|
||||
ACTOR_FLAG_DEATHFADE,
|
||||
ACTOR_FLAG_NOCHATTER,
|
||||
ACTOR_FLAG_INACTIVE,
|
||||
ACTOR_FLAG_ANIM_DONE,
|
||||
ACTOR_FLAG_STATE_DONE_TIME_VALID,
|
||||
ACTOR_FLAG_MASTER_STATE_DONE_TIME_VALID,
|
||||
ACTOR_FLAG_AI_ON,
|
||||
ACTOR_FLAG_LAST_CANSEEENEMY,
|
||||
ACTOR_FLAG_LAST_CANSEEENEMY_NOFOV,
|
||||
ACTOR_FLAG_DIALOG_PLAYING,
|
||||
ACTOR_FLAG_RADIUS_DIALOG_PLAYING,
|
||||
ACTOR_FLAG_ALLOW_TALK,
|
||||
ACTOR_FLAG_DAMAGE_ONCE_ON,
|
||||
ACTOR_FLAG_DAMAGE_ONCE_DAMAGED,
|
||||
ACTOR_FLAG_BOUNCE_OFF,
|
||||
ACTOR_FLAG_NOTIFY_OTHERS_AT_DEATH,
|
||||
ACTOR_FLAG_HAS_THING1,
|
||||
ACTOR_FLAG_HAS_THING2,
|
||||
ACTOR_FLAG_HAS_THING3,
|
||||
ACTOR_FLAG_HAS_THING4,
|
||||
ACTOR_FLAG_LAST_ATTACK_HIT,
|
||||
ACTOR_FLAG_STARTED,
|
||||
ACTOR_FLAG_ALLOW_HANGBACK,
|
||||
ACTOR_FLAG_USE_GRAVITY,
|
||||
ACTOR_FLAG_SPAWN_FAILED,
|
||||
ACTOR_FLAG_FADING_OUT,
|
||||
ACTOR_FLAG_DEATHSHRINK,
|
||||
ACTOR_FLAG_DEATHSINK,
|
||||
ACTOR_FLAG_STAYSOLID,
|
||||
ACTOR_FLAG_STUNNED,
|
||||
ACTOR_FLAG_ALLOW_FALL,
|
||||
ACTOR_FLAG_FINISHED,
|
||||
ACTOR_FLAG_IN_LIMBO,
|
||||
ACTOR_FLAG_CAN_WALK_ON_OTHERS,
|
||||
ACTOR_FLAG_PUSHABLE,
|
||||
ACTOR_FLAG_LAST_TRY_TALK,
|
||||
ACTOR_FLAG_TARGETABLE,
|
||||
ACTOR_FLAG_IMMORTAL,
|
||||
ACTOR_FLAG_TURNING_HEAD,
|
||||
ACTOR_FLAG_MOVING_EYES,
|
||||
ACTOR_FLAG_DIE_COMPLETELY,
|
||||
ACTOR_FLAG_BLEED_AFTER_DEATH,
|
||||
ACTOR_FLAG_IGNORE_STUCK_WARNING,
|
||||
ACTOR_FLAG_IGNORE_OFF_GROUND_WARNING,
|
||||
ACTOR_FLAG_ALLOWED_TO_KILL,
|
||||
ACTOR_FLAG_TOUCH_TRIGGERS,
|
||||
ACTOR_FLAG_IGNORE_WATER,
|
||||
ACTOR_FLAG_NEVER_IGNORE_SOUNDS,
|
||||
ACTOR_FLAG_SIMPLE_PATHFINDING,
|
||||
ACTOR_FLAG_HAVE_MOVED,
|
||||
ACTOR_FLAG_NO_PAIN_SOUNDS,
|
||||
ACTOR_FLAG_UPDATE_BOSS_HEALTH,
|
||||
ACTOR_FLAG_IGNORE_PAIN_FROM_ACTORS,
|
||||
ACTOR_FLAG_DAMAGE_ALLOWED,
|
||||
ACTOR_FLAG_AT_COVER_NODE,
|
||||
ACTOR_FLAG_WAIT_FOR_NEW_ENEMY,
|
||||
ACTOR_FLAG_TAKE_DAMAGE,
|
||||
ACTOR_FLAG_USE_DAMAGESKINS,
|
||||
ACTOR_FLAG_CAPTURED,
|
||||
ACTOR_FLAG_TURRET_MODE,
|
||||
ACTOR_FLAG_INCOMING_HITSCAN,
|
||||
ACTOR_FLAG_RESPONDING_TO_HITSCAN,
|
||||
ACTOR_FLAG_MELEE_HIT_WORLD,
|
||||
ACTOR_FLAG_TORSO_ANIM_DONE,
|
||||
ACTOR_FLAG_WEAPON_READY,
|
||||
ACTOR_FLAG_DISABLED,
|
||||
ACTOR_FLAG_IN_ALCOVE,
|
||||
ACTOR_FLAG_IN_CONE_OF_FIRE,
|
||||
ACTOR_FLAG_IN_PLAYER_CONE_OF_FIRE,
|
||||
ACTOR_FLAG_PLAYER_IN_CALL_VOLUME,
|
||||
ACTOR_FLAG_IN_CALL_VOLUME,
|
||||
ACTOR_FLAG_OUT_OF_TORSO_RANGE,
|
||||
ACTOR_FLAG_DUCKED,
|
||||
ACTOR_FLAG_PRONE,
|
||||
ACTOR_FLAG_SHOULD_BLINK,
|
||||
ACTOR_FLAG_CRIPPLED,
|
||||
ACTOR_FLAG_RETREATING,
|
||||
ACTOR_FLAG_HIDDEN,
|
||||
ACTOR_FLAG_FOLLOWING_IN_FORMATION,
|
||||
ACTOR_FLAG_DISPLAYING_FAILURE_FX,
|
||||
ACTOR_FLAG_GROUPMEMBER_INJURED,
|
||||
ACTOR_FLAG_CAN_HEAL_OTHER,
|
||||
ACTOR_FLAG_STRICTLY_FOLLOW_PATHS,
|
||||
ACTOR_FLAG_POSTURE_ANIM_DONE,
|
||||
ACTOR_FLAG_ATTACKING_ENEMY,
|
||||
ACTOR_FLAG_UPDATE_HATE_WITH_ATTACKERS,
|
||||
ACTOR_FLAG_LAST_CANSEEPLAYER,
|
||||
ACTOR_FLAG_LAST_CANSEEPLAYER_NOFOV,
|
||||
ACTOR_FLAG_MELEE_ALLOWED,
|
||||
ACTOR_FLAG_PLAYING_DIALOG_ANIM,
|
||||
ACTOR_FLAG_USING_HUD,
|
||||
ACTOR_FLAG_FORCE_LIFEBAR,
|
||||
ACTOR_FLAG_UPDATE_ACTION_LEVEL,
|
||||
ACTOR_FLAG_CAN_CHANGE_ANIM,
|
||||
ACTOR_FLAG_USE_FOLLOWRANGE_FOR_NODES,
|
||||
ACTOR_FLAG_IMMEDIATE_ACTIVATE,
|
||||
ACTOR_FLAG_CANNOT_DISINTEGRATE,
|
||||
ACTOR_FLAG_CANNOT_USE,
|
||||
ACTOR_FLAG_CANNOT_FREEZE,
|
||||
|
||||
ACTOR_FLAG_MAX
|
||||
|
||||
} ActorFlags;
|
||||
ACTOR_FLAG_MAX
|
||||
|
||||
} ActorFlags;
|
||||
|
||||
|
||||
typedef enum {
|
||||
NOTIFY_FLAG_DAMAGED,
|
||||
NOTIFY_FLAG_KILLED,
|
||||
NOTIFY_FLAG_SPOTTED_ENEMY,
|
||||
typedef enum
|
||||
{
|
||||
NOTIFY_FLAG_DAMAGED,
|
||||
NOTIFY_FLAG_KILLED,
|
||||
NOTIFY_FLAG_SPOTTED_ENEMY,
|
||||
|
||||
NOTIFY_FLAG_MAX
|
||||
} NotifyFlags;
|
||||
NOTIFY_FLAG_MAX
|
||||
} NotifyFlags;
|
||||
|
||||
|
||||
typedef enum {
|
||||
MOVEMENT_STYLE_NONE,
|
||||
MOVEMENT_STYLE_WALK,
|
||||
MOVEMENT_STYLE_RUN,
|
||||
typedef enum
|
||||
{
|
||||
MOVEMENT_STYLE_NONE,
|
||||
MOVEMENT_STYLE_WALK,
|
||||
MOVEMENT_STYLE_RUN,
|
||||
|
||||
MOVEMENT_STYLE_MAX
|
||||
} MovementStyle;
|
||||
MOVEMENT_STYLE_MAX
|
||||
} MovementStyle;
|
||||
|
||||
|
||||
//========================================
|
||||
|
|
|
@ -460,7 +460,7 @@ void DefaultThink::Think( Actor &actor )
|
|||
if ( actor.flags & FlagImmobile )
|
||||
{
|
||||
// Update boss health if necessary
|
||||
if ( (actor.GetActorFlag( ACTOR_FLAG_UPDATE_BOSS_HEALTH ) && actor.max_boss_health && ( actor.mode == ACTOR_MODE_AI )) || actor.GetActorFlag(ACTOR_FLAG_FORCE_LIFEBAR) )
|
||||
if ( (actor.GetActorFlag( ACTOR_FLAG_UPDATE_BOSS_HEALTH ) && actor.max_boss_health && ( actor.mode == ActorModeAi )) || actor.GetActorFlag(ACTOR_FLAG_FORCE_LIFEBAR) )
|
||||
UpdateBossHealth( actor );
|
||||
|
||||
if ( actor.statemap )
|
||||
|
@ -471,7 +471,7 @@ void DefaultThink::Think( Actor &actor )
|
|||
}
|
||||
|
||||
// Update boss health if necessary
|
||||
if ( (actor.GetActorFlag( ACTOR_FLAG_UPDATE_BOSS_HEALTH ) && actor.max_boss_health && ( actor.mode == ACTOR_MODE_AI )) || actor.GetActorFlag(ACTOR_FLAG_FORCE_LIFEBAR) )
|
||||
if ( (actor.GetActorFlag( ACTOR_FLAG_UPDATE_BOSS_HEALTH ) && actor.max_boss_health && ( actor.mode == ActorModeAi )) || actor.GetActorFlag(ACTOR_FLAG_FORCE_LIFEBAR) )
|
||||
UpdateBossHealth( actor );
|
||||
|
||||
if ( actor.postureController )
|
||||
|
|
|
@ -170,7 +170,7 @@ BehaviorReturnCode_t Idle::Evaluate
|
|||
if ( nexttwitch < level.time )
|
||||
{
|
||||
self.chattime += 10.0f;
|
||||
self.AddStateFlag( STATE_FLAG_TWITCH );
|
||||
self.AddStateFlag( StateFlagTwitch );
|
||||
return BEHAVIOR_EVALUATING;
|
||||
}
|
||||
else
|
||||
|
@ -214,7 +214,7 @@ void Pain::SetPainAnim
|
|||
|
||||
// Determine which pain type to play
|
||||
|
||||
if ( new_pain_type == PAIN_SMALL )
|
||||
if ( new_pain_type == PainSmall )
|
||||
anim_name = "pain_small";
|
||||
else
|
||||
anim_name = "pain";
|
||||
|
@ -225,7 +225,7 @@ void Pain::SetPainAnim
|
|||
|
||||
if ( !self.animate->HasAnim( anim_name.c_str() ) )
|
||||
{
|
||||
if ( new_pain_type == PAIN_SMALL )
|
||||
if ( new_pain_type == PainSmall )
|
||||
anim_name = "pain_small1";
|
||||
else
|
||||
anim_name = "pain1";
|
||||
|
@ -257,7 +257,7 @@ int Pain::GetNumberOfPainAnims
|
|||
|
||||
// Determine base animation name
|
||||
|
||||
if ( new_pain_type == PAIN_SMALL )
|
||||
if ( new_pain_type == PainSmall )
|
||||
anim_name = "pain_small";
|
||||
else
|
||||
anim_name = "pain";
|
||||
|
@ -290,18 +290,18 @@ void Pain::Begin
|
|||
|
||||
// Figure out which type of pain to do
|
||||
|
||||
if ( self.pain_type == PAIN_SMALL )
|
||||
SetPainAnim( self, PAIN_SMALL, pain_anim_number );
|
||||
if ( self.pain_type == PainSmall )
|
||||
SetPainAnim( self, PainSmall, pain_anim_number );
|
||||
else
|
||||
SetPainAnim( self, PAIN_BIG, pain_anim_number );
|
||||
SetPainAnim( self, PainBig, pain_anim_number );
|
||||
|
||||
current_pain_type = self.pain_type;
|
||||
number_of_pains = 1;
|
||||
|
||||
// Make sure we don't have pain any more
|
||||
|
||||
self.state_flags &= ~STATE_FLAG_SMALL_PAIN;
|
||||
self.state_flags &= ~STATE_FLAG_IN_PAIN;
|
||||
self.state_flags &= ~StateFlagSmallPain;
|
||||
self.state_flags &= ~StateFlagInPain;
|
||||
|
||||
max_pains = (int)G_Random( 4 ) + 4;
|
||||
}
|
||||
|
@ -322,34 +322,34 @@ BehaviorReturnCode_t Pain::Evaluate
|
|||
{
|
||||
str anim_name;
|
||||
|
||||
if ( self.state_flags & STATE_FLAG_SMALL_PAIN )
|
||||
if ( self.state_flags & StateFlagSmallPain )
|
||||
{
|
||||
// See if we should play another pain animation
|
||||
|
||||
if ( ( self.means_of_death != MOD_FIRE ) && ( self.means_of_death != MOD_ON_FIRE ) && ( self.means_of_death != MOD_FIRE_BLOCKABLE ) )
|
||||
{
|
||||
if ( ( self.pain_type == PAIN_SMALL ) && ( current_pain_type == PAIN_SMALL ) && ( number_of_pains < max_pains ) )
|
||||
if ( ( self.pain_type == PainSmall ) && ( current_pain_type == PainSmall ) && ( number_of_pains < max_pains ) )
|
||||
{
|
||||
pain_anim_number++;
|
||||
|
||||
number_of_pains++;
|
||||
|
||||
SetPainAnim( self, PAIN_SMALL, pain_anim_number );
|
||||
SetPainAnim( self, PainSmall, pain_anim_number );
|
||||
}
|
||||
else if ( self.pain_type == PAIN_BIG )
|
||||
else if ( self.pain_type == PainBig )
|
||||
{
|
||||
pain_anim_number++;
|
||||
|
||||
current_pain_type = PAIN_BIG;
|
||||
current_pain_type = PainBig;
|
||||
|
||||
SetPainAnim( self, PAIN_BIG, pain_anim_number );
|
||||
SetPainAnim( self, PainBig, pain_anim_number );
|
||||
}
|
||||
}
|
||||
|
||||
// Reset pain stuff
|
||||
|
||||
self.state_flags &= ~STATE_FLAG_SMALL_PAIN;
|
||||
self.state_flags &= ~STATE_FLAG_IN_PAIN;
|
||||
self.state_flags &= ~StateFlagSmallPain;
|
||||
self.state_flags &= ~StateFlagInPain;
|
||||
}
|
||||
|
||||
// If the pain animation has finished, then we are done
|
||||
|
@ -949,9 +949,9 @@ void HeadWatch::Begin
|
|||
)
|
||||
|
||||
{
|
||||
self.SetControllerTag( ACTOR_HEAD_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Head" ) );
|
||||
self.SetControllerTag( ActorHeadTag, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Head" ) );
|
||||
|
||||
current_head_angles = self.GetControllerAngles( ACTOR_HEAD_TAG );
|
||||
current_head_angles = self.GetControllerAngles( ActorHeadTag );
|
||||
|
||||
self.SetActorFlag( ACTOR_FLAG_TURNING_HEAD, true );
|
||||
}
|
||||
|
@ -1048,7 +1048,7 @@ BehaviorReturnCode_t HeadWatch::Evaluate
|
|||
{
|
||||
if( forever )
|
||||
{
|
||||
self.SetControllerAngles( ACTOR_HEAD_TAG, current_head_angles );
|
||||
self.SetControllerAngles( ActorHeadTag, current_head_angles );
|
||||
return BEHAVIOR_EVALUATING;
|
||||
}
|
||||
else
|
||||
|
@ -1105,7 +1105,7 @@ BehaviorReturnCode_t HeadWatch::Evaluate
|
|||
else if ( change[PITCH] < -max_speed )
|
||||
angles_diff[PITCH] = current_head_angles[PITCH] - max_speed;
|
||||
*/
|
||||
self.SetControllerAngles( ACTOR_HEAD_TAG, angles_diff );
|
||||
self.SetControllerAngles( ActorHeadTag, angles_diff );
|
||||
self.real_head_pitch = angles_diff[PITCH];
|
||||
|
||||
current_head_angles = angles_diff;
|
||||
|
@ -1137,7 +1137,7 @@ void HeadWatch::End
|
|||
{
|
||||
// Snap head back into position if we have lost our target or we are doing a resethead
|
||||
|
||||
self.SetControllerAngles( ACTOR_HEAD_TAG, vec_zero );
|
||||
self.SetControllerAngles( ActorHeadTag, vec_zero );
|
||||
self.real_head_pitch = 0;
|
||||
|
||||
self.SetActorFlag( ACTOR_FLAG_TURNING_HEAD, false );
|
||||
|
@ -1196,9 +1196,9 @@ void HeadWatchEnemy::Begin
|
|||
)
|
||||
|
||||
{
|
||||
self.SetControllerTag( ACTOR_HEAD_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Head" ) );
|
||||
self.SetControllerTag( ActorHeadTag, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Head" ) );
|
||||
|
||||
current_head_angles = self.GetControllerAngles( ACTOR_HEAD_TAG );
|
||||
current_head_angles = self.GetControllerAngles( ActorHeadTag );
|
||||
|
||||
self.SetActorFlag( ACTOR_FLAG_TURNING_HEAD, true );
|
||||
|
||||
|
@ -1223,11 +1223,11 @@ BehaviorReturnCode_t HeadWatchEnemy::Evaluate
|
|||
|
||||
|
||||
// Get our Torso Angles
|
||||
self.SetControllerTag( ACTOR_TORSO_TAG , gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
current_torso_angles = self.GetControllerAngles( ACTOR_TORSO_TAG );
|
||||
self.SetControllerTag( ActorTorsoTag , gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
current_torso_angles = self.GetControllerAngles( ActorTorsoTag );
|
||||
|
||||
//Reset our Controller Tag
|
||||
self.SetControllerTag( ACTOR_HEAD_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Head" ) );
|
||||
self.SetControllerTag( ActorHeadTag, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Head" ) );
|
||||
|
||||
|
||||
if ( !ent_to_watch )
|
||||
|
@ -1330,8 +1330,8 @@ BehaviorReturnCode_t HeadWatchEnemy::Evaluate
|
|||
FinalAngles = angles_diff;
|
||||
FinalAngles[YAW] = angles_diff[YAW] - current_torso_angles[YAW];
|
||||
|
||||
//self.SetControllerAngles( ACTOR_HEAD_TAG, angles_diff );
|
||||
self.SetControllerAngles( ACTOR_HEAD_TAG, FinalAngles );
|
||||
//self.SetControllerAngles( ActorHeadTag, angles_diff );
|
||||
self.SetControllerAngles( ActorHeadTag, FinalAngles );
|
||||
self.real_head_pitch = angles_diff[PITCH];
|
||||
|
||||
current_head_angles = angles_diff;
|
||||
|
@ -1367,7 +1367,7 @@ void HeadWatchEnemy::End
|
|||
{
|
||||
// Snap head back into position if we have lost our target or we are doing a resethead
|
||||
|
||||
self.SetControllerAngles( ACTOR_HEAD_TAG, vec_zero );
|
||||
self.SetControllerAngles( ActorHeadTag, vec_zero );
|
||||
self.real_head_pitch = 0;
|
||||
|
||||
self.SetActorFlag( ACTOR_FLAG_TURNING_HEAD, false );
|
||||
|
@ -1429,12 +1429,12 @@ void EyeWatch::Begin
|
|||
)
|
||||
|
||||
{
|
||||
self.SetControllerTag( ACTOR_LEYE_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Face eyeballL" ) );
|
||||
self.SetControllerTag( ACTOR_REYE_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Face eyeballR" ) );
|
||||
self.SetControllerTag( ActorLeyeTag, gi.Tag_NumForName( self.edict->s.modelindex, "Face eyeballL" ) );
|
||||
self.SetControllerTag( ActorReyeTag, gi.Tag_NumForName( self.edict->s.modelindex, "Face eyeballR" ) );
|
||||
|
||||
|
||||
current_left_eye_angles = self.GetControllerAngles( ACTOR_LEYE_TAG );
|
||||
current_right_eye_angles = self.GetControllerAngles( ACTOR_REYE_TAG );
|
||||
current_left_eye_angles = self.GetControllerAngles( ActorLeyeTag );
|
||||
current_right_eye_angles = self.GetControllerAngles( ActorReyeTag );
|
||||
|
||||
self.SetActorFlag( ACTOR_FLAG_MOVING_EYES, true );
|
||||
}
|
||||
|
@ -1535,8 +1535,8 @@ BehaviorReturnCode_t EyeWatch::Evaluate
|
|||
else if ( change[PITCH] < -max_speed )
|
||||
angles_diff[PITCH] = current_left_eye_angles[PITCH] - max_speed;
|
||||
|
||||
self.SetControllerAngles( ACTOR_LEYE_TAG, angles_diff );
|
||||
self.SetControllerAngles( ACTOR_REYE_TAG, angles_diff );
|
||||
self.SetControllerAngles( ActorLeyeTag, angles_diff );
|
||||
self.SetControllerAngles( ActorReyeTag, angles_diff );
|
||||
|
||||
current_left_eye_angles = angles_diff;
|
||||
current_right_eye_angles = angles_diff;
|
||||
|
@ -1561,8 +1561,8 @@ void EyeWatch::End
|
|||
{
|
||||
// Snap head back into position if we have lost our target or we are doing a resethead
|
||||
|
||||
self.SetControllerAngles( ACTOR_LEYE_TAG, vec_zero );
|
||||
self.SetControllerAngles( ACTOR_REYE_TAG, vec_zero );
|
||||
self.SetControllerAngles( ActorLeyeTag, vec_zero );
|
||||
self.SetControllerAngles( ActorReyeTag, vec_zero );
|
||||
|
||||
self.SetActorFlag( ACTOR_FLAG_MOVING_EYES, false );
|
||||
}
|
||||
|
@ -1622,12 +1622,12 @@ void EyeWatchEnemy::Begin
|
|||
)
|
||||
|
||||
{
|
||||
self.SetControllerTag( ACTOR_LEYE_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Face eyeballL" ) );
|
||||
self.SetControllerTag( ACTOR_REYE_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Face eyeballR" ) );
|
||||
self.SetControllerTag( ActorLeyeTag, gi.Tag_NumForName( self.edict->s.modelindex, "Face eyeballL" ) );
|
||||
self.SetControllerTag( ActorReyeTag, gi.Tag_NumForName( self.edict->s.modelindex, "Face eyeballR" ) );
|
||||
|
||||
|
||||
current_left_eye_angles = self.GetControllerAngles( ACTOR_LEYE_TAG );
|
||||
current_right_eye_angles = self.GetControllerAngles( ACTOR_REYE_TAG );
|
||||
current_left_eye_angles = self.GetControllerAngles( ActorLeyeTag );
|
||||
current_right_eye_angles = self.GetControllerAngles( ActorReyeTag );
|
||||
|
||||
self.SetActorFlag( ACTOR_FLAG_MOVING_EYES, true );
|
||||
}
|
||||
|
@ -1735,8 +1735,8 @@ BehaviorReturnCode_t EyeWatchEnemy::Evaluate
|
|||
else if ( change[PITCH] < -max_speed )
|
||||
angles_diff[PITCH] = current_left_eye_angles[PITCH] - max_speed;
|
||||
|
||||
self.SetControllerAngles( ACTOR_LEYE_TAG, angles_diff );
|
||||
self.SetControllerAngles( ACTOR_REYE_TAG, angles_diff );
|
||||
self.SetControllerAngles( ActorLeyeTag, angles_diff );
|
||||
self.SetControllerAngles( ActorReyeTag, angles_diff );
|
||||
//self.real_head_pitch = angles_diff[PITCH];
|
||||
|
||||
current_left_eye_angles = angles_diff;
|
||||
|
@ -1763,8 +1763,8 @@ void EyeWatchEnemy::End
|
|||
|
||||
//if ( !ent_to_watch )
|
||||
// {
|
||||
self.SetControllerAngles( ACTOR_LEYE_TAG, vec_zero );
|
||||
self.SetControllerAngles( ACTOR_REYE_TAG, vec_zero );
|
||||
self.SetControllerAngles( ActorLeyeTag, vec_zero );
|
||||
self.SetControllerAngles( ActorReyeTag, vec_zero );
|
||||
|
||||
//self.real_head_pitch = 0;
|
||||
// }
|
||||
|
@ -1911,9 +1911,9 @@ void TorsoTurn::Begin
|
|||
{
|
||||
Vector controller_angles;
|
||||
|
||||
self.SetControllerTag( ACTOR_TORSO_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
self.SetControllerTag( ActorTorsoTag, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
|
||||
controller_angles = self.GetControllerAngles( ACTOR_TORSO_TAG );
|
||||
controller_angles = self.GetControllerAngles( ActorTorsoTag );
|
||||
|
||||
current_yaw = controller_angles[YAW];
|
||||
current_pitch = controller_angles[PITCH];
|
||||
|
@ -2048,7 +2048,7 @@ BehaviorReturnCode_t TorsoTurn::Evaluate
|
|||
|
||||
// Set our new angles
|
||||
|
||||
self.SetControllerAngles( ACTOR_TORSO_TAG, new_angles );
|
||||
self.SetControllerAngles( ActorTorsoTag, new_angles );
|
||||
|
||||
current_yaw = yaw_diff;
|
||||
current_pitch = pitch_diff;
|
||||
|
@ -2067,7 +2067,7 @@ void TorsoTurn::End
|
|||
)
|
||||
|
||||
{
|
||||
self.SetControllerAngles( ACTOR_TORSO_TAG, vec_zero );
|
||||
self.SetControllerAngles( ActorTorsoTag, vec_zero );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2141,9 +2141,9 @@ void TorsoWatchEnemy::Begin
|
|||
{
|
||||
Vector controller_angles;
|
||||
|
||||
self.SetControllerTag( ACTOR_TORSO_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
self.SetControllerTag( ActorTorsoTag, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
|
||||
controller_angles = self.GetControllerAngles( ACTOR_TORSO_TAG );
|
||||
controller_angles = self.GetControllerAngles( ActorTorsoTag );
|
||||
|
||||
current_yaw = controller_angles[YAW];
|
||||
current_pitch = controller_angles[PITCH];
|
||||
|
@ -2205,7 +2205,7 @@ BehaviorReturnCode_t TorsoWatchEnemy::Evaluate
|
|||
|
||||
/*
|
||||
Vector controller_angles;
|
||||
controller_angles = self.GetControllerAngles( ACTOR_TORSO_TAG );
|
||||
controller_angles = self.GetControllerAngles( ActorTorsoTag );
|
||||
|
||||
current_yaw = controller_angles[YAW];
|
||||
current_pitch = controller_angles[PITCH];
|
||||
|
@ -2292,7 +2292,7 @@ BehaviorReturnCode_t TorsoWatchEnemy::Evaluate
|
|||
|
||||
// Set our new angles
|
||||
|
||||
self.SetControllerAngles( ACTOR_TORSO_TAG, new_angles );
|
||||
self.SetControllerAngles( ActorTorsoTag, new_angles );
|
||||
|
||||
current_yaw = yaw_diff;
|
||||
current_pitch = pitch_diff;
|
||||
|
@ -2318,7 +2318,7 @@ void TorsoWatchEnemy::End
|
|||
|
||||
self.movementSubsystem->setMovingBackwards( false );
|
||||
if ( reset )
|
||||
self.SetControllerAngles( ACTOR_TORSO_TAG, vec_zero );
|
||||
self.SetControllerAngles( ActorTorsoTag, vec_zero );
|
||||
}
|
||||
/****************************************************************************
|
||||
|
||||
|
@ -6165,7 +6165,7 @@ BehaviorReturnCode_t FlyDive::Evaluate
|
|||
//hit_entity->Damage( &self, &self, damage, Vector (0, 0, 0), Vector (0, 0, 0), Vector (0, 0, 0), 0, 0, MOD_CRUSH );
|
||||
dir.normalize();
|
||||
hit_entity->Damage( &self, &self, damage, self.centroid, dir, vec_zero, 0, 0, MOD_CRUSH );
|
||||
self.AddStateFlag( STATE_FLAG_MELEE_HIT );
|
||||
self.AddStateFlag( StateFlagMeleeHit );
|
||||
stuck = false;
|
||||
}
|
||||
}
|
||||
|
@ -6179,7 +6179,7 @@ BehaviorReturnCode_t FlyDive::Evaluate
|
|||
self.setAngles( self.angles );
|
||||
|
||||
if ( stuck )
|
||||
self.AddStateFlag( STATE_FLAG_STUCK );
|
||||
self.AddStateFlag( StateFlagStuck );
|
||||
|
||||
return BEHAVIOR_SUCCESS;
|
||||
}
|
||||
|
@ -6322,7 +6322,7 @@ BehaviorReturnCode_t FlyCharge::Evaluate
|
|||
//hit_entity->Damage( &self, &self, damage, Vector (0, 0, 0), Vector (0, 0, 0), Vector (0, 0, 0), 0, 0, MOD_CRUSH );
|
||||
dir.normalize();
|
||||
hit_entity->Damage( &self, &self, damage, self.centroid, dir, vec_zero, 0, 0, MOD_CRUSH );
|
||||
self.AddStateFlag( STATE_FLAG_MELEE_HIT );
|
||||
self.AddStateFlag( StateFlagMeleeHit );
|
||||
stuck = false;
|
||||
}
|
||||
}
|
||||
|
@ -6336,7 +6336,7 @@ BehaviorReturnCode_t FlyCharge::Evaluate
|
|||
self.setAngles( self.angles );
|
||||
|
||||
if ( stuck )
|
||||
self.AddStateFlag( STATE_FLAG_STUCK );
|
||||
self.AddStateFlag( StateFlagStuck );
|
||||
|
||||
return BEHAVIOR_SUCCESS;
|
||||
}
|
||||
|
@ -9033,7 +9033,7 @@ BehaviorReturnCode_t ShockWater::Evaluate
|
|||
else
|
||||
{
|
||||
// Shock head
|
||||
center_actor->AddStateFlag( STATE_FLAG_IN_PAIN );
|
||||
center_actor->AddStateFlag( StateFlagInPain );
|
||||
|
||||
center_actor->SpawnEffect( "fx_elecstrike.tik", center_actor->origin, vec_zero, 2.0f );
|
||||
center_actor->Sound( "sound/weapons/sword/electric/hitmix2.wav", 0, 1.0f, 500.0f );
|
||||
|
@ -10897,7 +10897,7 @@ BehaviorReturnCode_t GhostAttack::Evaluate
|
|||
if ( real_attack )
|
||||
{
|
||||
success = MeleeAttack( start, end, 7.5f, &self, MOD_LIFEDRAIN, 32.0f, 0.0f, 64.0f, 0.0f );
|
||||
self.AddStateFlag( STATE_FLAG_MELEE_HIT );
|
||||
self.AddStateFlag( StateFlagMeleeHit );
|
||||
}
|
||||
else
|
||||
success = false;
|
||||
|
|
|
@ -574,62 +574,62 @@ BehaviorReturnCode_t GotoEntity::Evaluate( Actor &self )
|
|||
case Steering::FAILED:
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned FAILED" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_BLOCKED_BY_ENEMY:
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned BLOCKED_BY_ENEMY" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED_STEERING_BLOCKED_BY_ENEMY;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_BLOCKED_BY_CIVILIAN:
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned BLOCKED_BY_CIVILIAN" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED_STEERING_BLOCKED_BY_CIVILIAN;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_BLOCKED_BY_FRIEND:
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned BLOCKED_BY_FRIEND" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED_STEERING_BLOCKED_BY_FRIEND;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_BLOCKED_BY_TEAMMATE:
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned BLOCKED_BY_TEAMMATE" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED_STEERING_BLOCKED_BY_TEAMMATE;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_BLOCKED_BY_WORLD:
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned BLOCKED_BY_WORLD" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED_STEERING_BLOCKED_BY_WORLD;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_BLOCKED_BY_DOOR:
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned BLOCKED_BY_DOOR" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED_STEERING_BLOCKED_BY_DOOR;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_CANNOT_GET_TO_PATH:
|
||||
self.AddStateFlag( STATE_FLAG_NO_PATH );
|
||||
self.AddStateFlag( StateFlagNoPath );
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned CANNOT_GET_TO_PATH" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED_STEERING_CANNOT_GET_TO_PATH;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_NO_PATH:
|
||||
self.AddStateFlag( STATE_FLAG_NO_PATH );
|
||||
self.AddStateFlag( StateFlagNoPath );
|
||||
/*
|
||||
if ( !self.GetActorFlag(ACTOR_FLAG_DISPLAYING_FAILURE_FX) )
|
||||
{
|
||||
|
@ -643,7 +643,7 @@ BehaviorReturnCode_t GotoEntity::Evaluate( Actor &self )
|
|||
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "Steering returned NO_PATH" );
|
||||
self.AddStateFlag( STATE_FLAG_STEERING_FAILED );
|
||||
self.AddStateFlag( StateFlagSteeringFailed );
|
||||
return BEHAVIOR_FAILED_STEERING_NO_PATH;
|
||||
break;
|
||||
|
||||
|
@ -777,7 +777,7 @@ BehaviorReturnCode_t GotoPoint::Evaluate( Actor &self )
|
|||
unsigned int chaseResult;
|
||||
|
||||
//E3 2002 HACK LOVIN'
|
||||
if ( self.state_flags & STATE_FLAG_STUCK )
|
||||
if ( self.state_flags & StateFlagStuck )
|
||||
{
|
||||
self.SetAnim( "idle" );
|
||||
SetFailureReason( "I'm stuck!!!!!!" );
|
||||
|
@ -840,13 +840,13 @@ BehaviorReturnCode_t GotoPoint::Evaluate( Actor &self )
|
|||
break;
|
||||
|
||||
case Steering::FAILED_CANNOT_GET_TO_PATH:
|
||||
self.AddStateFlag( STATE_FLAG_NO_PATH );
|
||||
self.AddStateFlag( StateFlagNoPath );
|
||||
self.SetAnim( "idle" );
|
||||
return BEHAVIOR_FAILED_STEERING_CANNOT_GET_TO_PATH;
|
||||
break;
|
||||
|
||||
case Steering::FAILED_NO_PATH:
|
||||
self.AddStateFlag( STATE_FLAG_NO_PATH );
|
||||
self.AddStateFlag( StateFlagNoPath );
|
||||
self.SetAnim( "idle" );
|
||||
return BEHAVIOR_FAILED_STEERING_NO_PATH;
|
||||
break;
|
||||
|
|
|
@ -4570,13 +4570,13 @@ void Player::showObjectInfo()
|
|||
sprintf(addstr, "Think is OFF\n" );
|
||||
desc += addstr;
|
||||
|
||||
if ( act->mode == ACTOR_MODE_IDLE )
|
||||
if ( act->mode == ActorModeIdle )
|
||||
sprintf(addstr, "Mode: IDLE\n" );
|
||||
else if ( act->mode == ACTOR_MODE_AI )
|
||||
else if ( act->mode == ActorModeAi )
|
||||
sprintf(addstr, "Mode: AI\n" );
|
||||
else if ( act->mode == ACTOR_MODE_SCRIPT )
|
||||
else if ( act->mode == ActorModeScript )
|
||||
sprintf(addstr, "Mode: SCRIPT\n" );
|
||||
else if ( act->mode == ACTOR_MODE_TALK )
|
||||
else if ( act->mode == ActorModeTalk )
|
||||
sprintf(addstr, "Mode: TALK\n" );
|
||||
desc += addstr;
|
||||
|
||||
|
|
|
@ -2164,7 +2164,7 @@ void Sentient::ArmorDamage( float damage, Entity *inflictor, Entity *attacker, c
|
|||
{
|
||||
Actor *act = (Actor *)this;
|
||||
|
||||
if ( ( act->state_flags & STATE_FLAG_SMALL_PAIN ) && ( meansofdeath == MOD_ON_FIRE || Immune( meansofdeath ) ) )
|
||||
if ( ( act->state_flags & StateFlagSmallPain ) && ( meansofdeath == MOD_ON_FIRE || Immune( meansofdeath ) ) )
|
||||
set_means_of_death = false;
|
||||
}
|
||||
|
||||
|
@ -2423,7 +2423,7 @@ void Sentient::ArmorDamage( float damage, Entity *inflictor, Entity *attacker, c
|
|||
if ( this->isSubclassOf( Actor ) )
|
||||
{
|
||||
Actor *act = ( Actor * )this;
|
||||
act->AddStateFlag( STATE_FLAG_BLOCKED_HIT );
|
||||
act->AddStateFlag( StateFlagBlockedHit );
|
||||
}
|
||||
|
||||
WeaponEffectsAndSound( weapon, "Blocked", position );
|
||||
|
@ -4798,7 +4798,7 @@ void Sentient::CheckDamageThreshold( float damageValue )
|
|||
{
|
||||
Actor *actor;
|
||||
actor = (Actor*)this;
|
||||
actor->AddStateFlag(STATE_FLAG_DAMAGE_THRESHOLD_EXCEEDED);
|
||||
actor->AddStateFlag(StateFlagDamageThresholdExceeded);
|
||||
}
|
||||
|
||||
//Clear out our structure
|
||||
|
|
|
@ -226,7 +226,7 @@ BehaviorReturnCode_t SnipeEnemy::Evaluate( Actor & )
|
|||
//---------------------------------------------------------------------
|
||||
case SNIPE_AIM_AND_FIRE_SUCCESS:
|
||||
//---------------------------------------------------------------------
|
||||
_self->SetControllerAngles( ACTOR_TORSO_TAG, vec_zero );
|
||||
_self->SetControllerAngles( ActorTorsoTag, vec_zero );
|
||||
return BEHAVIOR_SUCCESS;
|
||||
|
||||
break;
|
||||
|
@ -267,7 +267,7 @@ void SnipeEnemy::End(Actor &)
|
|||
|
||||
_fireWeapon.End(*_self);
|
||||
//gi.Printf( "TorsoAimAndFireWeapon::End()\n");
|
||||
_self->SetControllerAngles( ACTOR_TORSO_TAG, vec_zero );
|
||||
_self->SetControllerAngles( ActorTorsoTag, vec_zero );
|
||||
_self->ClearTorsoAnim();
|
||||
_self->SetEnemyTargeted( false );
|
||||
//_self->SetAnim( _aimAnim , NULL , torso );
|
||||
|
@ -353,8 +353,8 @@ void SnipeEnemy::init( Actor &self )
|
|||
_self = &self;
|
||||
|
||||
//Set Our Controller Tag and set up our angles
|
||||
self.SetControllerTag( ACTOR_TORSO_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
_currentTorsoAngles = self.GetControllerAngles( ACTOR_TORSO_TAG );
|
||||
self.SetControllerTag( ActorTorsoTag, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
_currentTorsoAngles = self.GetControllerAngles( ActorTorsoTag );
|
||||
|
||||
_animDone = false;
|
||||
_canAttack = true;
|
||||
|
@ -522,7 +522,7 @@ void SnipeEnemy::LerpTorsoBySpeed( const Vector &angleDelta )
|
|||
anglesDiff = angleDelta;
|
||||
|
||||
//Reset our Controller Tag
|
||||
_self->SetControllerTag( ACTOR_TORSO_TAG, gi.Tag_NumForName( _self->edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
_self->SetControllerTag( ActorTorsoTag, gi.Tag_NumForName( _self->edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
|
||||
|
||||
// Make sure we don't change our head angles too much at once
|
||||
|
@ -541,7 +541,7 @@ void SnipeEnemy::LerpTorsoBySpeed( const Vector &angleDelta )
|
|||
|
||||
finalAngles = anglesDiff;
|
||||
|
||||
_self->SetControllerAngles( ACTOR_TORSO_TAG, finalAngles );
|
||||
_self->SetControllerAngles( ActorTorsoTag, finalAngles );
|
||||
|
||||
|
||||
_currentTorsoAngles = anglesDiff;
|
||||
|
|
|
@ -319,7 +319,7 @@ BehaviorReturnCode_t Talk::Evaluate
|
|||
if ( !self.GetActorFlag( ACTOR_FLAG_DIALOG_PLAYING ) )
|
||||
{
|
||||
mode = TALK_MODE_WAIT;
|
||||
self.state_flags &= ~STATE_FLAG_USED;
|
||||
self.state_flags &= ~StateFlagUsed;
|
||||
|
||||
// Tell player to stop watching us
|
||||
|
||||
|
@ -372,7 +372,7 @@ BehaviorReturnCode_t Talk::Evaluate
|
|||
if ( !self.WithinDistance( ent_listening, 100.0f ) )
|
||||
mode = TALK_MODE_TURN_BACK;
|
||||
|
||||
if ( self.state_flags & STATE_FLAG_USED )
|
||||
if ( self.state_flags & StateFlagUsed )
|
||||
{
|
||||
mode = TALK_MODE_TURN_TO;
|
||||
self.SetActorFlag(ACTOR_FLAG_PLAYING_DIALOG_ANIM, false );
|
||||
|
@ -381,7 +381,7 @@ BehaviorReturnCode_t Talk::Evaluate
|
|||
angles = dir.toAngles();
|
||||
yaw = angles[YAW];
|
||||
|
||||
self.state_flags &= ~STATE_FLAG_USED;
|
||||
self.state_flags &= ~StateFlagUsed;
|
||||
|
||||
/* event = new Event( EV_Player_WatchActor );
|
||||
event->AddEntity( &self );
|
||||
|
|
|
@ -239,7 +239,7 @@ BehaviorReturnCode_t TorsoAimAndFireWeapon::Evaluate( Actor &self )
|
|||
//---------------------------------------------------------------------
|
||||
case TORSO_AIM_AND_FIRE_SUCCESS:
|
||||
//---------------------------------------------------------------------
|
||||
_self->SetControllerAngles( ACTOR_TORSO_TAG, vec_zero );
|
||||
_self->SetControllerAngles( ActorTorsoTag, vec_zero );
|
||||
|
||||
if ( _repeat )
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ void TorsoAimAndFireWeapon::End(Actor &)
|
|||
|
||||
_fireWeapon.End(*_self);
|
||||
//gi.Printf( "TorsoAimAndFireWeapon::End()\n");
|
||||
_self->SetControllerAngles( ACTOR_TORSO_TAG, vec_zero );
|
||||
_self->SetControllerAngles( ActorTorsoTag, vec_zero );
|
||||
_self->ClearTorsoAnim();
|
||||
//_self->SetAnim( _aimAnim , NULL , torso );
|
||||
}
|
||||
|
@ -377,8 +377,8 @@ void TorsoAimAndFireWeapon::init( Actor &self )
|
|||
_self = &self;
|
||||
|
||||
//Set Our Controller Tag and set up our angles
|
||||
self.SetControllerTag( ACTOR_TORSO_TAG, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
_currentTorsoAngles = self.GetControllerAngles( ACTOR_TORSO_TAG );
|
||||
self.SetControllerTag( ActorTorsoTag, gi.Tag_NumForName( self.edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
_currentTorsoAngles = self.GetControllerAngles( ActorTorsoTag );
|
||||
|
||||
_animDone = false;
|
||||
_canAttack = true;
|
||||
|
@ -570,7 +570,7 @@ void TorsoAimAndFireWeapon::updateEnemy()
|
|||
}
|
||||
|
||||
_currentEnemy = currentEnemy;
|
||||
//_self->SetControllerAngles( ACTOR_TORSO_TAG, vec_zero );
|
||||
//_self->SetControllerAngles( ActorTorsoTag, vec_zero );
|
||||
//gi.Printf( "TorsoAimAndFireWeapon::_turnTowardsEntity()\n");
|
||||
//_self->turnTowardsEntity( _currentEnemy, 0.0f );
|
||||
|
||||
|
@ -596,7 +596,7 @@ void TorsoAimAndFireWeapon::LerpTorsoBySpeed( const Vector &angleDelta )
|
|||
anglesDiff = angleDelta;
|
||||
|
||||
//Reset our Controller Tag
|
||||
_self->SetControllerTag( ACTOR_TORSO_TAG, gi.Tag_NumForName( _self->edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
_self->SetControllerTag( ActorTorsoTag, gi.Tag_NumForName( _self->edict->s.modelindex, "Bip01 Spine1" ) );
|
||||
|
||||
|
||||
// Make sure we don't change our head angles too much at once
|
||||
|
@ -615,7 +615,7 @@ void TorsoAimAndFireWeapon::LerpTorsoBySpeed( const Vector &angleDelta )
|
|||
|
||||
finalAngles = anglesDiff;
|
||||
|
||||
_self->SetControllerAngles( ACTOR_TORSO_TAG, finalAngles );
|
||||
_self->SetControllerAngles( ActorTorsoTag, finalAngles );
|
||||
|
||||
|
||||
_currentTorsoAngles = anglesDiff;
|
||||
|
|
Loading…
Reference in a new issue