diff options
Diffstat (limited to 'indra/newview/llmoveview.cpp')
-rw-r--r-- | indra/newview/llmoveview.cpp | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 1853b511be..afca9daa67 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -41,7 +41,8 @@ // Viewer includes #include "llagent.h" -#include "llvoavatarself.h" // to check gAgent.getAvatarObject()->isSitting() +#include "llagentcamera.h" +#include "llvoavatarself.h" // to check gAgentAvatarp->isSitting() #include "llbottomtray.h" #include "llbutton.h" #include "llfloaterreg.h" @@ -90,12 +91,20 @@ BOOL LLFloaterMove::postBuild() LLDockableFloater::postBuild(); + // Code that implements floater buttons toggling when user moves via keyboard is located in LLAgent::propagate() + mForwardButton = getChild<LLJoystickAgentTurn>("forward btn"); mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mBackwardButton = getChild<LLJoystickAgentTurn>("backward btn"); mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); + mSlideLeftButton = getChild<LLJoystickAgentSlide>("move left btn"); + mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); + + mSlideRightButton = getChild<LLJoystickAgentSlide>("move right btn"); + mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); + mTurnLeftButton = getChild<LLButton>("turn left btn"); mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mTurnLeftButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnLeft, this)); @@ -124,8 +133,6 @@ BOOL LLFloaterMove::postBuild() btn = getChild<LLButton>("mode_fly_btn"); btn->setCommitCallback(boost::bind(&LLFloaterMove::onFlyButtonClick, this)); - showFlyControls(false); - initModeTooltips(); initModeButtonMap(); @@ -199,7 +206,12 @@ void LLFloaterMove::setFlyingMode(BOOL fly) if (instance) { instance->setFlyingModeImpl(fly); - instance->showModeButtons(!fly); + LLVOAvatarSelf* avatar_object = gAgentAvatarp; + bool is_sitting = avatar_object + && (avatar_object->getRegion() != NULL) + && (!avatar_object->isDead()) + && avatar_object->isSitting(); + instance->showModeButtons(!fly && !is_sitting); } if (fly) { @@ -331,7 +343,7 @@ void LLFloaterMove::setMovementMode(const EMovementMode mode) updateButtonsWithMovementMode(mode); bool bHideModeButtons = MM_FLY == mode - || (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()); + || (isAgentAvatarValid() && gAgentAvatarp->isSitting()); showModeButtons(!bHideModeButtons); @@ -339,33 +351,38 @@ void LLFloaterMove::setMovementMode(const EMovementMode mode) void LLFloaterMove::updateButtonsWithMovementMode(const EMovementMode newMode) { - showFlyControls(MM_FLY == newMode); setModeTooltip(newMode); setModeButtonToggleState(newMode); setModeTitle(newMode); } -void LLFloaterMove::showFlyControls(bool bShow) -{ - mMoveUpButton->setVisible(bShow); - mMoveDownButton->setVisible(bShow); -} - void LLFloaterMove::initModeTooltips() { control_tooltip_map_t walkTipMap; walkTipMap.insert(std::make_pair(mForwardButton, getString("walk_forward_tooltip"))); walkTipMap.insert(std::make_pair(mBackwardButton, getString("walk_back_tooltip"))); + walkTipMap.insert(std::make_pair(mSlideLeftButton, getString("walk_left_tooltip"))); + walkTipMap.insert(std::make_pair(mSlideRightButton, getString("walk_right_tooltip"))); + walkTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip"))); + walkTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip"))); mModeControlTooltipsMap[MM_WALK] = walkTipMap; control_tooltip_map_t runTipMap; runTipMap.insert(std::make_pair(mForwardButton, getString("run_forward_tooltip"))); runTipMap.insert(std::make_pair(mBackwardButton, getString("run_back_tooltip"))); + runTipMap.insert(std::make_pair(mSlideLeftButton, getString("run_left_tooltip"))); + runTipMap.insert(std::make_pair(mSlideRightButton, getString("run_right_tooltip"))); + runTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip"))); + runTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip"))); mModeControlTooltipsMap[MM_RUN] = runTipMap; control_tooltip_map_t flyTipMap; flyTipMap.insert(std::make_pair(mForwardButton, getString("fly_forward_tooltip"))); flyTipMap.insert(std::make_pair(mBackwardButton, getString("fly_back_tooltip"))); + flyTipMap.insert(std::make_pair(mSlideLeftButton, getString("fly_left_tooltip"))); + flyTipMap.insert(std::make_pair(mSlideRightButton, getString("fly_right_tooltip"))); + flyTipMap.insert(std::make_pair(mMoveUpButton, getString("fly_up_tooltip"))); + flyTipMap.insert(std::make_pair(mMoveDownButton, getString("fly_down_tooltip"))); mModeControlTooltipsMap[MM_FLY] = flyTipMap; setModeTooltip(MM_WALK); @@ -387,9 +404,9 @@ void LLFloaterMove::initMovementMode() } setMovementMode(initMovementMode); - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - setEnabled(!gAgent.getAvatarObject()->isSitting()); + setEnabled(!gAgentAvatarp->isSitting()); } } @@ -490,7 +507,7 @@ void LLFloaterMove::onOpen(const LLSD& key) showModeButtons(FALSE); } - if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) + if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) { setSittingMode(TRUE); showModeButtons(FALSE); @@ -593,7 +610,7 @@ BOOL LLPanelStandStopFlying::postBuild() void LLPanelStandStopFlying::setVisible(BOOL visible) { //we dont need to show the panel if these buttons are not activated - if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false; + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false; if (visible) { @@ -695,6 +712,7 @@ void LLPanelStandStopFlying::onStandButtonClick() gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); setFocus(FALSE); // EXT-482 + mStandButton->setVisible(FALSE); // force visibility changing to avoid seeing Stand & Move buttons at once. } void LLPanelStandStopFlying::onStopFlyingButtonClick() |