Ejemplo n.º 1
0
// private
void LLViewerGesture::doTrigger( BOOL send_chat )
{
	if (mSoundItemID != LLUUID::null)
	{
		LLViewerInventoryItem *item;
		item = gInventory.getItem(mSoundItemID);
		if (item)
		{
			send_sound_trigger(item->getAssetUUID(), SOUND_VOLUME);
		}
	}

	if (!mAnimation.empty())
	{
		// AFK animations trigger the special "away" state, which
		// includes agent control settings. JC
		if (mAnimation == "enter_away_from_keyboard_state" || mAnimation == "away")
		{
			gAgent.setAFK();
		}
		else
		{
			LLUUID anim_id = gAnimLibrary.stringToAnimState(mAnimation);
			gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_START);
		}
	}

	if ( send_chat && !mOutputString.empty())
	{
		// Don't play nodding animation, since that might not blend
		// with the gesture animation.
		gChatBar->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
	}
}
// static
void LLPreviewSound::playSound( void *userdata )
{
	LLPreviewSound* self = (LLPreviewSound*) userdata;
	const LLInventoryItem *item = self->getItem();

	if(item && gAudiop)
	{
		send_sound_trigger(item->getAssetUUID(), SOUND_GAIN);
	}
}
Ejemplo n.º 3
0
void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
{
	switch(step->getType())
	{
	case STEP_ANIMATION:
		{
			LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
			if (anim_step->mAnimAssetID.isNull())
			{
				gesture->mCurrentStep++;
			}

			if (anim_step->mFlags & ANIM_FLAG_STOP)
			{
				if (gesture->mLocal)
				{
					gAgentAvatarp->stopMotion(anim_step->mAnimAssetID);
				}
				else
				{
					gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_STOP);
					// remove it from our request set in case we just requested it
					std::set<LLUUID>::iterator set_it = gesture->mRequestedAnimIDs.find(anim_step->mAnimAssetID);
					if (set_it != gesture->mRequestedAnimIDs.end())
					{
						gesture->mRequestedAnimIDs.erase(set_it);
					}
				}
			}
			else
			{
				if (gesture->mLocal)
				{
					gAgentAvatarp->startMotion(anim_step->mAnimAssetID);
					// Indicate we're playing this animation now.
					gesture->mPlayingAnimIDs.insert(anim_step->mAnimAssetID);
				}
				else
				{
					gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_START);
					// Indicate that we've requested this animation to play as
					// part of this gesture (but it won't start playing for at
					// least one round-trip to simulator).
					gesture->mRequestedAnimIDs.insert(anim_step->mAnimAssetID);
				}
			}
			gesture->mCurrentStep++;
			break;
		}
	case STEP_SOUND:
		{
			LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
			const LLUUID& sound_id = sound_step->mSoundAssetID;
			const F32 volume = 1.f;
			if (gesture->mLocal)
				gAudiop->triggerSound(sound_id, gAgentID, volume, LLAudioEngine::AUDIO_TYPE_UI, gAgent.getPositionGlobal());
			else
				send_sound_trigger(sound_id, volume);
			gesture->mCurrentStep++;
			break;
		}
	case STEP_CHAT:
		{
			LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
			std::string chat_text = chat_step->mChatText;
			// Don't animate the nodding, as this might not blend with
			// other playing animations.
			const BOOL animate = FALSE;

			if ( cmd_line_chat(chat_text, CHAT_TYPE_NORMAL))
			{
#if SHY_MOD //Command handler
				if(!SHCommandHandler::handleCommand(true, chat_text, gAgentID, gAgentAvatarp))//returns true if handled
#endif //shy_mod
				gesture->mLocal ? fake_local_chat(chat_text) : gChatBar->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
			}
			gesture->mCurrentStep++;
			break;
		}
	case STEP_WAIT:
		{
			LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
			if (wait_step->mFlags & WAIT_FLAG_TIME)
			{
				gesture->mWaitingTimer = TRUE;
				gesture->mWaitTimer.reset();
			}
			else if (wait_step->mFlags & WAIT_FLAG_ALL_ANIM)
			{
				gesture->mWaitingAnimations = TRUE;
				// Use the wait timer as a deadlock breaker for animation
				// waits.
				gesture->mWaitTimer.reset();
			}
			else
			{
				gesture->mCurrentStep++;
			}
			// Don't increment instruction pointer until wait is complete.
			break;
		}
	default:
		{
			break;
		}
	}
}
Ejemplo n.º 4
0
void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step)
{
	switch(step->getType())
	{
	case STEP_ANIMATION:
		{
			LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
			if (anim_step->mAnimAssetID.isNull())
			{
				gesture->mCurrentStep++;
			}

			if (anim_step->mFlags & ANIM_FLAG_STOP)
			{
				gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_STOP);
				// remove it from our request set in case we just requested it
				std::set<LLUUID>::iterator set_it = gesture->mRequestedAnimIDs.find(anim_step->mAnimAssetID);
				if (set_it != gesture->mRequestedAnimIDs.end())
				{
					gesture->mRequestedAnimIDs.erase(set_it);
				}
			}
			else
			{
				gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_START);
				// Indicate that we've requested this animation to play as
				// part of this gesture (but it won't start playing for at
				// least one round-trip to simulator).
				gesture->mRequestedAnimIDs.insert(anim_step->mAnimAssetID);
			}
			gesture->mCurrentStep++;
			break;
		}
	case STEP_SOUND:
		{
			LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
			const LLUUID& sound_id = sound_step->mSoundAssetID;
			const F32 volume = 1.f;
			send_sound_trigger(sound_id, volume);
			gesture->mCurrentStep++;
			break;
		}
	case STEP_CHAT:
		{
			LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
			std::string chat_text = chat_step->mChatText;
			// Don't animate the nodding, as this might not blend with
			// other playing animations.
			const BOOL animate = FALSE;

			gChatBar->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
			gesture->mCurrentStep++;
			break;
		}
	case STEP_WAIT:
		{
			LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
			if (wait_step->mFlags & WAIT_FLAG_TIME)
			{
				gesture->mWaitingTimer = TRUE;
				gesture->mWaitTimer.reset();
			}
			else if (wait_step->mFlags & WAIT_FLAG_ALL_ANIM)
			{
				gesture->mWaitingAnimations = TRUE;
				// Use the wait timer as a deadlock breaker for animation
				// waits.
				gesture->mWaitTimer.reset();
			}
			else
			{
				gesture->mCurrentStep++;
			}
			// Don't increment instruction pointer until wait is complete.
			break;
		}
	default:
		{
			break;
		}
	}
}