diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llhudeffectlookat.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llhudeffectlookat.cpp')
-rw-r--r-- | linden/indra/newview/llhudeffectlookat.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/linden/indra/newview/llhudeffectlookat.cpp b/linden/indra/newview/llhudeffectlookat.cpp index 4cd69bb..abe2a66 100644 --- a/linden/indra/newview/llhudeffectlookat.cpp +++ b/linden/indra/newview/llhudeffectlookat.cpp | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "llvoavatar.h" | 40 | #include "llvoavatar.h" |
41 | #include "lldrawable.h" | 41 | #include "lldrawable.h" |
42 | #include "llviewerobjectlist.h" | 42 | #include "llviewerobjectlist.h" |
43 | #include "llsphere.h" | 43 | #include "llrendersphere.h" |
44 | #include "llselectmgr.h" | 44 | #include "llselectmgr.h" |
45 | #include "llglheaders.h" | 45 | #include "llglheaders.h" |
46 | 46 | ||
@@ -400,7 +400,11 @@ BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec | |||
400 | return FALSE; | 400 | return FALSE; |
401 | } | 401 | } |
402 | 402 | ||
403 | llassert(target_type < LOOKAT_NUM_TARGETS); | 403 | if (target_type >= LOOKAT_NUM_TARGETS) |
404 | { | ||
405 | llwarns << "Bad target_type " << (int)target_type << " - ignoring." << llendl; | ||
406 | return FALSE; | ||
407 | } | ||
404 | 408 | ||
405 | // must be same or higher priority than existing effect | 409 | // must be same or higher priority than existing effect |
406 | if ((*mAttentions)[target_type].mPriority < (*mAttentions)[mTargetType].mPriority) | 410 | if ((*mAttentions)[target_type].mPriority < (*mAttentions)[mTargetType].mPriority) |
@@ -557,12 +561,13 @@ void LLHUDEffectLookAt::update() | |||
557 | 561 | ||
558 | if (mTargetType != LOOKAT_TARGET_NONE) | 562 | if (mTargetType != LOOKAT_TARGET_NONE) |
559 | { | 563 | { |
560 | calcTargetPosition(); | 564 | if (calcTargetPosition()) |
561 | |||
562 | LLMotion* head_motion = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->findMotion(ANIM_AGENT_HEAD_ROT); | ||
563 | if (!head_motion || head_motion->isStopped()) | ||
564 | { | 565 | { |
565 | ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_HEAD_ROT); | 566 | LLMotion* head_motion = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->findMotion(ANIM_AGENT_HEAD_ROT); |
567 | if (!head_motion || head_motion->isStopped()) | ||
568 | { | ||
569 | ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_HEAD_ROT); | ||
570 | } | ||
566 | } | 571 | } |
567 | } | 572 | } |
568 | 573 | ||
@@ -579,12 +584,14 @@ void LLHUDEffectLookAt::update() | |||
579 | * | 584 | * |
580 | * Has the side-effect of also calling setAnimationData("LookAtPoint") with the new | 585 | * Has the side-effect of also calling setAnimationData("LookAtPoint") with the new |
581 | * mTargetPos on the source object which is assumed to be an avatar. | 586 | * mTargetPos on the source object which is assumed to be an avatar. |
587 | * | ||
588 | * Returns whether we successfully calculated a finite target position. | ||
582 | */ | 589 | */ |
583 | void LLHUDEffectLookAt::calcTargetPosition() | 590 | bool LLHUDEffectLookAt::calcTargetPosition() |
584 | { | 591 | { |
585 | if (gNoRender) | 592 | if (gNoRender) |
586 | { | 593 | { |
587 | return; | 594 | return false; |
588 | } | 595 | } |
589 | 596 | ||
590 | LLViewerObject *target_obj = (LLViewerObject *)mTargetObject; | 597 | LLViewerObject *target_obj = (LLViewerObject *)mTargetObject; |
@@ -659,5 +666,11 @@ void LLHUDEffectLookAt::calcTargetPosition() | |||
659 | } | 666 | } |
660 | 667 | ||
661 | mTargetPos -= source_avatar->mHeadp->getWorldPosition(); | 668 | mTargetPos -= source_avatar->mHeadp->getWorldPosition(); |
669 | |||
670 | if (!mTargetPos.isFinite()) | ||
671 | return false; | ||
672 | |||
662 | source_avatar->setAnimationData("LookAtPoint", (void *)&mTargetPos); | 673 | source_avatar->setAnimationData("LookAtPoint", (void *)&mTargetPos); |
674 | |||
675 | return true; | ||
663 | } | 676 | } |