summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2010-04-21 19:08:15 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2010-04-21 19:08:15 -0400
commit6aa3b75224f68fffc640253ced8bf5c162acdf2d (patch)
tree955baea20530cb822b8ce57c7c014175b0299281 /indra/newview
parentd692ed38bda3bf2d229cedb26b3dd7ef859daa42 (diff)
For EXT-6953: improved default animations.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml12
-rw-r--r--indra/newview/llvoavatar.cpp84
-rw-r--r--indra/newview/llvoavatar.h1
3 files changed, 73 insertions, 24 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index c9b5631d54..6f08cd7579 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10183,7 +10183,17 @@
<key>Value</key>
<real>10.0</real>
</map>
-
+ <key>UseNewWalkRun</key>
+ <map>
+ <key>Comment</key>
+ <string>Replace standard walk/run animations with new ones.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>UseStartScreen</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 3f021d1f84..05cb914e90 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1225,7 +1225,11 @@ void LLVOAvatar::initInstance(void)
registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create );
registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create );
registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create );
+ registerMotion( ANIM_AGENT_FEMALE_RUN_NEW, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_FEMALE_WALK_NEW, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_RUN_NEW, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create );
registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create );
registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create );
@@ -1235,6 +1239,7 @@ void LLVOAvatar::initInstance(void)
registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_WALK_NEW, LLKeyframeWalkMotion::create );
// motions without a start/stop bit
registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create );
@@ -4369,34 +4374,74 @@ void LLVOAvatar::resetAnimations()
flushAllMotions();
}
-//-----------------------------------------------------------------------------
-// startMotion()
-// id is the asset if of the animation to start
-// time_offset is the offset into the animation at which to start playing
-//-----------------------------------------------------------------------------
-BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
+// Override selectively based on avatar sex and whether we're using new
+// animations.
+LLUUID LLVOAvatar::remapMotionID(const LLUUID& id)
{
- LLMemType mt(LLMemType::MTYPE_AVATAR);
-
+ BOOL use_new_walk_run = gSavedSettings.getBOOL("UseNewWalkRun");
+ LLUUID result = id;
+
// start special case female walk for female avatars
if (getSex() == SEX_FEMALE)
{
if (id == ANIM_AGENT_WALK)
{
- return LLCharacter::startMotion(ANIM_AGENT_FEMALE_WALK, time_offset);
+ if (use_new_walk_run)
+ result = ANIM_AGENT_FEMALE_WALK_NEW;
+ else
+ result = ANIM_AGENT_FEMALE_WALK;
+ }
+ else if (id == ANIM_AGENT_RUN)
+ {
+ // There is no old female run animation, so only override
+ // in one case.
+ if (use_new_walk_run)
+ result = ANIM_AGENT_FEMALE_RUN_NEW;
}
else if (id == ANIM_AGENT_SIT)
{
- return LLCharacter::startMotion(ANIM_AGENT_SIT_FEMALE, time_offset);
+ result = ANIM_AGENT_SIT_FEMALE;
}
}
+ else
+ {
+ // Male avatar.
+ if (id == ANIM_AGENT_WALK)
+ {
+ if (use_new_walk_run)
+ result = ANIM_AGENT_WALK_NEW;
+ }
+ else if (id == ANIM_AGENT_RUN)
+ {
+ if (use_new_walk_run)
+ result = ANIM_AGENT_RUN_NEW;
+ }
+
+ }
- if (isSelf() && id == ANIM_AGENT_AWAY)
+ return result;
+
+}
+
+//-----------------------------------------------------------------------------
+// startMotion()
+// id is the asset if of the animation to start
+// time_offset is the offset into the animation at which to start playing
+//-----------------------------------------------------------------------------
+BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
+{
+ llinfos << "motion " << id.asString() << llendl;
+
+ LLMemType mt(LLMemType::MTYPE_AVATAR);
+
+ LLUUID remap_id = remapMotionID(id);
+
+ if (isSelf() && remap_id == ANIM_AGENT_AWAY)
{
gAgent.setAFK();
}
- return LLCharacter::startMotion(id, time_offset);
+ return LLCharacter::startMotion(remap_id, time_offset);
}
//-----------------------------------------------------------------------------
@@ -4404,21 +4449,14 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
{
+ LLUUID remap_id = remapMotionID(id);
+
if (isSelf())
{
- gAgent.onAnimStop(id);
- }
-
- if (id == ANIM_AGENT_WALK)
- {
- LLCharacter::stopMotion(ANIM_AGENT_FEMALE_WALK, stop_immediate);
- }
- else if (id == ANIM_AGENT_SIT)
- {
- LLCharacter::stopMotion(ANIM_AGENT_SIT_FEMALE, stop_immediate);
+ gAgent.onAnimStop(remap_id);
}
- return LLCharacter::stopMotion(id, stop_immediate);
+ return LLCharacter::stopMotion(remap_id, stop_immediate);
}
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index c80d59966c..f06bb458c5 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -157,6 +157,7 @@ public:
virtual LLJoint* getCharacterJoint(U32 num);
virtual BOOL allocateCharacterJoints(U32 num);
+ virtual LLUUID remapMotionID(const LLUUID& id);
virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
virtual void stopMotionFromSource(const LLUUID& source_id);