From a4000c3744e42fcbb638e742f3b63fa31a0dee15 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 8 May 2009 07:43:08 +0000 Subject: merge trunk@116587 skinning-7@119389 -> viewer-2.0.0-skinning-7 --- indra/newview/llagent.cpp | 232 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 164 insertions(+), 68 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 9785940ff6..263c2b52bf 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -44,6 +44,7 @@ #include "llcriticaldamp.h" #include "llfocusmgr.h" #include "llglheaders.h" +#include "llmenugl.h" #include "llparcel.h" #include "llpermissions.h" #include "llregionhandle.h" @@ -67,6 +68,7 @@ #include "llface.h" #include "llfirstuse.h" #include "llfloater.h" +#include "llfloaterreg.h" #include "llfloateractivespeakers.h" #include "llfloateravatarinfo.h" #include "llfloaterbuildoptions.h" @@ -77,7 +79,6 @@ #include "llfloatergroupinfo.h" #include "llfloatergroups.h" #include "llfloaterland.h" -#include "llfloatermap.h" #include "llfloatermute.h" #include "llfloatersnapshot.h" #include "llfloatertools.h" @@ -92,11 +93,13 @@ #include "llmenugl.h" #include "llmorphview.h" #include "llmoveview.h" +#include "llteleporthistory.h" #include "llnotify.h" #include "llquantize.h" #include "llsdutil.h" #include "llselectmgr.h" #include "llsky.h" +#include "llslurl.h" #include "llrendersphere.h" #include "llstatusbar.h" #include "llstartup.h" @@ -107,9 +110,7 @@ #include "lltoolgrab.h" #include "lltoolmgr.h" #include "lltoolpie.h" -#include "lltoolview.h" #include "llui.h" // for make_ui_sound -#include "llurldispatcher.h" #include "llviewercamera.h" #include "llviewerinventory.h" #include "llviewermenu.h" @@ -134,6 +135,9 @@ #include "llappviewer.h" #include "llviewerjoystick.h" #include "llfollowcam.h" +#include "lltrans.h" + +#include "llnavigationbar.h" //to show/hide navigation bar when changing mouse look state using namespace LLVOAvatarDefines; @@ -240,6 +244,20 @@ void LLAgentFriendObserver::changed(U32 mask) } } +bool handleSlowMotionAnimation(const LLSD& newvalue) +{ + if (newvalue.asBoolean()) + { + gAgent.getAvatarObject()->setAnimTimeFactor(0.2f); + } + else + { + gAgent.getAvatarObject()->setAnimTimeFactor(1.0f); + } + return true; +} + + // ************************************************************ // Enabled this definition to compile a 'hacked' viewer that // locally believes the end user has godlike powers. @@ -398,15 +416,14 @@ LLAgent::LLAgent() : mTextureCacheQueryID(0), mAppearanceSerialNum(0) { - U32 i; - for (i = 0; i < TOTAL_CONTROLS; i++) + for (U32 i = 0; i < TOTAL_CONTROLS; i++) { mControlsTakenCount[i] = 0; mControlsTakenPassedOnCount[i] = 0; } mActiveCacheQueries = new S32[BAKED_NUM_INDICES]; - for (i = 0; i < (U32)BAKED_NUM_INDICES; i++) + for (U32 i = 0; i < (U32)BAKED_NUM_INDICES; i++) { mActiveCacheQueries[i] = 0; } @@ -420,6 +437,9 @@ LLAgent::LLAgent() : //----------------------------------------------------------------------------- void LLAgent::init() { + gSavedSettings.declareBOOL("SlowMotionAnimation", FALSE, "Declared in code", FALSE); + gSavedSettings.getControl("SlowMotionAnimation")->getSignal()->connect(boost::bind(&handleSlowMotionAnimation, _2)); + mDrawDistance = gSavedSettings.getF32("RenderFarClip"); // *Note: this is where LLViewerCamera::getInstance() used to be constructed. @@ -441,9 +461,10 @@ void LLAgent::init() mCameraZoomFraction = 1.f; mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject"); -// LLDebugVarMessageBox::show("Camera Lag", &CAMERA_FOCUS_HALF_LIFE, 0.5f, 0.01f); - - mEffectColor = gSavedSettings.getColor4("EffectColor"); + mEffectColor = gSavedSkinSettings.getColor4("EffectColor"); + + gSavedSettings.getControl("PreferredMaturity")->getValidateSignal()->connect(boost::bind(&LLAgent::validateMaturity, this, _2)); + gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLAgent::handleMaturity, this, _2)); mInitialized = TRUE; } @@ -526,8 +547,8 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera) { LLViewerJoystick::getInstance()->moveAvatar(true); } - - gFloaterTools->close(); + + LLFloaterReg::hideInstance("build"); gViewerWindow->showCursor(); @@ -820,12 +841,24 @@ void LLAgent::setFlying(BOOL fly) //----------------------------------------------------------------------------- // toggleFlying() //----------------------------------------------------------------------------- +// static void LLAgent::toggleFlying() { - BOOL fly = !(mControlFlags & AGENT_CONTROL_FLY); + BOOL fly = !(gAgent.mControlFlags & AGENT_CONTROL_FLY); - setFlying( fly ); - resetView(); + gAgent.setFlying( fly ); + gAgent.resetView(); +} + +// static +bool LLAgent::enableFlying() +{ + BOOL sitting = FALSE; + if (gAgent.getAvatarObject()) + { + sitting = gAgent.getAvatarObject()->mIsSitting; + } + return !sitting; } @@ -940,7 +973,7 @@ std::string LLAgent::getSLURL() const S32 x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) ); S32 y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) ); S32 z = llround( (F32)agentPos.mdV[VZ] ); - slurl = LLURLDispatcher::buildSLURL(regionp->getName(), x, y, z); + slurl = LLSLURL::buildSLURL(regionp->getName(), x, y, z); } return slurl; } @@ -2118,8 +2151,7 @@ void LLAgent::setAFK() gAwayTimer.start(); if (gAFKMenu) { - //*TODO:Translate - gAFKMenu->setLabel(std::string("Set Not Away")); + gAFKMenu->setLabel(LLTrans::getString("AvatarSetNotAway")); } } } @@ -2142,8 +2174,7 @@ void LLAgent::clearAFK() clearControlFlags(AGENT_CONTROL_AWAY); if (gAFKMenu) { - //*TODO:Translate - gAFKMenu->setLabel(std::string("Set Away")); + gAFKMenu->setLabel(LLTrans::getString("AvatarSetAway")); } } } @@ -2165,8 +2196,7 @@ void LLAgent::setBusy() mIsBusy = TRUE; if (gBusyMenu) { - //*TODO:Translate - gBusyMenu->setLabel(std::string("Set Not Busy")); + gBusyMenu->setLabel(LLTrans::getString("AvatarSetNotBusy")); } LLFloaterMute::getInstance()->updateButtons(); } @@ -2180,8 +2210,7 @@ void LLAgent::clearBusy() sendAnimationRequest(ANIM_AGENT_BUSY, ANIM_REQUEST_STOP); if (gBusyMenu) { - //*TODO:Translate - gBusyMenu->setLabel(std::string("Set Busy")); + gBusyMenu->setLabel(LLTrans::getString("AvatarSetBusy")); } LLFloaterMute::getInstance()->updateButtons(); } @@ -2808,13 +2837,6 @@ U8 LLAgent::getRenderState() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -static const LLFloaterView::skip_list_t& get_skip_list() -{ - static LLFloaterView::skip_list_t skip_list; - skip_list.insert(LLFloaterMap::getInstance()); - return skip_list; -} - //----------------------------------------------------------------------------- // endAnimationUpdateUI() //----------------------------------------------------------------------------- @@ -2833,6 +2855,7 @@ void LLAgent::endAnimationUpdateUI() gViewerWindow->showCursor(); // show menus gMenuBarView->setVisible(TRUE); + LLNavigationBar::getInstance()->setVisible(TRUE); gStatusBar->setVisibleForMouselook(true); LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); @@ -2840,10 +2863,17 @@ void LLAgent::endAnimationUpdateUI() // Only pop if we have pushed... if (TRUE == mViewsPushed) { +#if 0 // Use this once all floaters are registered + LLFloaterReg::restoreVisibleInstances(); +#else // Use this for now + LLFloaterView::skip_list_t skip_list; + skip_list.insert(LLFloaterReg::findInstance("mini_map")); + gFloaterView->popVisibleAll(skip_list); +#endif mViewsPushed = FALSE; - gFloaterView->popVisibleAll(get_skip_list()); } - + + gAgent.setLookAt(LOOKAT_TARGET_CLEAR); if( gMorphView ) { @@ -2885,13 +2915,6 @@ void LLAgent::endAnimationUpdateUI() LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - // HACK: If we're quitting, and we were in customize avatar, don't - // let the mini-map go visible again. JC - if (!LLAppViewer::instance()->quitRequested()) - { - LLFloaterMap::getInstance()->popVisible(); - } - if( gMorphView ) { gMorphView->setVisible( FALSE ); @@ -2918,6 +2941,7 @@ void LLAgent::endAnimationUpdateUI() { // hide menus gMenuBarView->setVisible(FALSE); + LLNavigationBar::getInstance()->setVisible(FALSE); gStatusBar->setVisibleForMouselook(false); // clear out camera lag effect @@ -2929,15 +2953,24 @@ void LLAgent::endAnimationUpdateUI() LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); mViewsPushed = TRUE; - - gFloaterView->pushVisibleAll(FALSE, get_skip_list()); + + // hide all floaters except the mini map + +#if 0 // Use this once all floaters are registered + std::set exceptions; + exceptions.insert("mini_map"); + LLFloaterReg::hideVisibleInstances(exceptions); +#else // Use this for now + LLFloaterView::skip_list_t skip_list; + skip_list.insert(LLFloaterReg::findInstance("mini_map")); + gFloaterView->pushVisibleAll(FALSE, skip_list); +#endif if( gMorphView ) { gMorphView->setVisible(FALSE); } - gIMMgr->setFloaterOpen( FALSE ); gConsole->setVisible( TRUE ); if (mAvatarObject.notNull()) @@ -2986,15 +3019,6 @@ void LLAgent::endAnimationUpdateUI() { LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); - LLFloaterMap::getInstance()->pushVisible(FALSE); - /* - LLView *view; - for (view = gFloaterView->getFirstChild(); view; view = gFloaterView->getNextChild()) - { - view->pushVisible(FALSE); - } - */ - if( gMorphView ) { gMorphView->setVisible( TRUE ); @@ -4915,6 +4939,9 @@ int LLAgent::convertTextToMaturity(char text) bool LLAgent::sendMaturityPreferenceToServer(int preferredMaturity) { + if (!getRegion()) + return false; + // Update agent access preference on the server std::string url = getRegion()->getCapability("UpdateAgentInformation"); if (!url.empty()) @@ -4974,6 +5001,17 @@ const LLAgentAccess& LLAgent::getAgentAccess() return mAgentAccess; } +bool LLAgent::validateMaturity(const LLSD& newvalue) +{ + return mAgentAccess.canSetMaturity(newvalue.asInteger()); +} + +void LLAgent::handleMaturity(const LLSD& newvalue) +{ + sendMaturityPreferenceToServer(newvalue.asInteger()); +} + +//---------------------------------------------------------------------------- void LLAgent::buildFullname(std::string& name) const { @@ -5137,8 +5175,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO } // utility to build a location string -void LLAgent::buildLocationString(std::string& str) +BOOL LLAgent::buildLocationString(std::string& str, ELocationFormat fmt) { + LLViewerRegion* region = getRegion(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + + if (!region || !parcel) + return FALSE; + const LLVector3& agent_pos_region = getPositionAgent(); S32 pos_x = S32(agent_pos_region.mV[VX]); S32 pos_y = S32(agent_pos_region.mV[VY]); @@ -5165,23 +5209,57 @@ void LLAgent::buildLocationString(std::string& str) } // create a defult name and description for the landmark + std::string parcel_name = LLViewerParcelMgr::getInstance()->getAgentParcelName(); + std::string region_name = region->getName(); std::string buffer; if( LLViewerParcelMgr::getInstance()->getAgentParcelName().empty() ) { // the parcel doesn't have a name - buffer = llformat("%.32s (%d, %d, %d)", - getRegion()->getName().c_str(), - pos_x, pos_y, pos_z); + switch (fmt) + { + case LOCATION_FORMAT_LANDMARK: + buffer = llformat("%.32s (%d, %d, %d)", + region_name.c_str(), + pos_x, pos_y, pos_z); + break; + case LOCATION_FORMAT_NORMAL: + case LOCATION_FORMAT_FULL: + buffer = llformat("%s (%d, %d, %d)", + region_name.c_str(), + pos_x, pos_y, pos_z); + break; + } } else { // the parcel has a name, so include it in the landmark name - buffer = llformat("%.32s, %.32s (%d, %d, %d)", - LLViewerParcelMgr::getInstance()->getAgentParcelName().c_str(), - getRegion()->getName().c_str(), - pos_x, pos_y, pos_z); + switch (fmt) + { + case LOCATION_FORMAT_LANDMARK: + buffer = llformat("%.32s, %.32s (%d, %d, %d)", + parcel_name.c_str(), + region_name.c_str(), + pos_x, pos_y, pos_z); + break; + case LOCATION_FORMAT_NORMAL: + buffer = llformat("%s/%s (%d, %d, %d)", + region_name.c_str(), + parcel_name.c_str(), + pos_x, pos_y, pos_z); + break; + case LOCATION_FORMAT_FULL: + std::string sim_access_string = region->getSimAccessString(); + buffer = llformat("%s/%s (%d, %d, %d)%s%s", + region_name.c_str(), + parcel_name.c_str(), + pos_x, pos_y, pos_z, + sim_access_string.empty() ? "" : " - ", + sim_access_string.c_str()); + break; + } } str = buffer; + return TRUE; } LLQuaternion LLAgent::getHeadRotation() @@ -5389,7 +5467,7 @@ void update_group_floaters(const LLUUID& group_id) LLFloaterGroupInfo::refreshGroup(group_id); // update avatar info - LLFloaterAvatarInfo* fa = LLFloaterAvatarInfo::getInstance(gAgent.getID()); + LLFloaterAvatarInfo* fa = LLFloaterReg::findTypedInstance("preview_avatar", LLSD(gAgent.getID())); if(fa) { fa->resetGroupList(); @@ -5978,8 +6056,8 @@ bool LLAgent::teleportCore(bool is_local) // process_teleport_location_reply // close the map and find panels so we can see our destination - LLFloaterWorldMap::hide(NULL); - LLFloaterDirectory::hide(NULL); + LLFloaterReg::hideInstance("world_map"); + LLFloaterReg::hideInstance("search"); // hide land floater too - it'll be out of date LLFloaterLand::hideInstance(); @@ -6144,13 +6222,18 @@ void LLAgent::setTeleportState(ETeleportState state) mTeleportState = state; if (mTeleportState > TELEPORT_NONE && gSavedSettings.getBOOL("FreezeTime")) { - LLFloaterSnapshot::hide(0); + LLFloaterReg::hideInstance("snapshot"); } if (mTeleportState == TELEPORT_MOVING) { // We're outa here. Save "back" slurl. mTeleportSourceSLURL = getSLURL(); } + else if(mTeleportState == TELEPORT_ARRIVING) + { + // Let the interested parties know we've teleported. + LLViewerParcelMgr::getInstance()->onTeleportFinished(); + } } void LLAgent::stopCurrentAnimations() @@ -7272,10 +7355,23 @@ void LLAgent::sendAgentSetAppearance() void LLAgent::sendAgentDataUpdateRequest() { + if(getID().isNull()) + return; // not logged in gMessageSystem->newMessageFast(_PREHASH_AgentDataUpdateRequest); gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, getSessionID()); + sendReliableMessage(); +} + +void LLAgent::sendAgentUserInfoRequest() +{ + if(getID().isNull()) + return; // not logged in + gMessageSystem->newMessageFast(_PREHASH_UserInfoRequest); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, getSessionID()); sendReliableMessage(); } @@ -7673,15 +7769,15 @@ void LLAgent::userRemoveAllClothes( void* userdata ) // We have to do this up front to avoid having to deal with the case of multiple wearables being dirty. if( gFloaterCustomize ) { - gFloaterCustomize->askToSaveIfDirty( LLAgent::userRemoveAllClothesStep2, NULL ); + gFloaterCustomize->askToSaveIfDirty( LLAgent::userRemoveAllClothesStep2 ); } else { - LLAgent::userRemoveAllClothesStep2( TRUE, NULL ); + LLAgent::userRemoveAllClothesStep2( TRUE ); } } -void LLAgent::userRemoveAllClothesStep2( BOOL proceed, void* userdata ) +void LLAgent::userRemoveAllClothesStep2( BOOL proceed ) { if( proceed ) { -- cgit v1.2.3 From 3800c0df910c83e987184d541b868168fc2b5bec Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 8 May 2009 21:08:08 +0000 Subject: svn merge -r114679:114681 svn+ssh://svn.lindenlab.com/svn/linden/branches/event-system/event-system-7 svn+ssh://svn.lindenlab.com/svn/linden/branches/event-system/event-system-8 --- indra/newview/llagent.cpp | 209 +++++++++++++++++++++++++--------------------- 1 file changed, 115 insertions(+), 94 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 263c2b52bf..f97f9f607f 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -136,6 +136,8 @@ #include "llviewerjoystick.h" #include "llfollowcam.h" #include "lltrans.h" +#include "stringize.h" +#include "llcapabilitylistener.h" #include "llnavigationbar.h" //to show/hide navigation bar when changing mouse look state @@ -947,7 +949,7 @@ LLViewerRegion *LLAgent::getRegion() const } -const LLHost& LLAgent::getRegionHost() const +LLHost LLAgent::getRegionHost() const { if (mRegionp) { @@ -4699,109 +4701,128 @@ void LLAgent::lookAtLastChat() const F32 SIT_POINT_EXTENTS = 0.2f; +LLSD ll_sdmap_from_vector3(const LLVector3& vec) +{ + LLSD ret; + ret["X"] = vec.mV[VX]; + ret["Y"] = vec.mV[VY]; + ret["Z"] = vec.mV[VZ]; + return ret; +} + +LLVector3 ll_vector3_from_sdmap(const LLSD& sd) +{ + LLVector3 ret; + ret.mV[VX] = F32(sd["X"].asReal()); + ret.mV[VY] = F32(sd["Y"].asReal()); + ret.mV[VZ] = F32(sd["Z"].asReal()); + return ret; +} + void LLAgent::setStartPosition( U32 location_id ) { - LLViewerObject *object; + LLViewerObject *object; - if ( !(gAgentID == LLUUID::null) ) - { + if (gAgentID == LLUUID::null) + { + return; + } // we've got an ID for an agent viewerobject object = gObjectList.findObject(gAgentID); - if (object) + if (! object) { - // we've got the viewer object - // Sometimes the agent can be velocity interpolated off of - // this simulator. Clamp it to the region the agent is - // in, a little bit in on each side. - const F32 INSET = 0.5f; //meters - const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); - - LLVector3 agent_pos = getPositionAgent(); - LLVector3 agent_look_at = mFrameAgent.getAtAxis(); - - if (mAvatarObject.notNull()) - { - // the z height is at the agent's feet - agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ]; - } - - agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET ); - agent_pos.mV[VY] = llclamp( agent_pos.mV[VY], INSET, REGION_WIDTH - INSET ); - - // Don't let them go below ground, or too high. - agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ], - mRegionp->getLandHeightRegion( agent_pos ), - LLWorld::getInstance()->getRegionMaxHeight() ); - // Send the CapReq - - LLSD body; - - std::string url = gAgent.getRegion()->getCapability("HomeLocation"); - std::ostringstream strBuffer; - if( url.empty() ) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_SetStartLocationRequest); - msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, getID()); - msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - msg->nextBlockFast( _PREHASH_StartLocationData); - // corrected by sim - msg->addStringFast(_PREHASH_SimName, ""); - msg->addU32Fast(_PREHASH_LocationID, location_id); - msg->addVector3Fast(_PREHASH_LocationPos, agent_pos); - msg->addVector3Fast(_PREHASH_LocationLookAt,mFrameAgent.getAtAxis()); - - // Reliable only helps when setting home location. Last - // location is sent on quit, and we don't have time to ack - // the packets. - msg->sendReliable(mRegionp->getHost()); - - const U32 HOME_INDEX = 1; - if( HOME_INDEX == location_id ) - { - setHomePosRegion( mRegionp->getHandle(), getPositionAgent() ); - } - } - else - { - strBuffer << location_id; - body["HomeLocation"]["LocationId"] = strBuffer.str(); - - strBuffer.str(""); - strBuffer << agent_pos.mV[VX]; - body["HomeLocation"]["LocationPos"]["X"] = strBuffer.str(); - - strBuffer.str(""); - strBuffer << agent_pos.mV[VY]; - body["HomeLocation"]["LocationPos"]["Y"] = strBuffer.str(); - - strBuffer.str(""); - strBuffer << agent_pos.mV[VZ]; - body["HomeLocation"]["LocationPos"]["Z"] = strBuffer.str(); - - strBuffer.str(""); - strBuffer << agent_look_at.mV[VX]; - body["HomeLocation"]["LocationLookAt"]["X"] = strBuffer.str(); - - strBuffer.str(""); - strBuffer << agent_look_at.mV[VY]; - body["HomeLocation"]["LocationLookAt"]["Y"] = strBuffer.str(); - - strBuffer.str(""); - strBuffer << agent_look_at.mV[VZ]; - body["HomeLocation"]["LocationLookAt"]["Z"] = strBuffer.str(); - - LLHTTPClient::post( url, body, new LLHomeLocationResponder() ); - } + llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl; + return; + } + // we've got the viewer object + // Sometimes the agent can be velocity interpolated off of + // this simulator. Clamp it to the region the agent is + // in, a little bit in on each side. + const F32 INSET = 0.5f; //meters + const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); + + LLVector3 agent_pos = getPositionAgent(); + + if (mAvatarObject.notNull()) + { + // the z height is at the agent's feet + agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ]; } - else + + agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET ); + agent_pos.mV[VY] = llclamp( agent_pos.mV[VY], INSET, REGION_WIDTH - INSET ); + + // Don't let them go below ground, or too high. + agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ], + mRegionp->getLandHeightRegion( agent_pos ), + LLWorld::getInstance()->getRegionMaxHeight() ); + // Send the CapReq + LLSD request; + LLSD body; + LLSD homeLocation; + + homeLocation["LocationId"] = LLSD::Integer(location_id); + homeLocation["LocationPos"] = ll_sdmap_from_vector3(agent_pos); + homeLocation["LocationLookAt"] = ll_sdmap_from_vector3(mFrameAgent.getAtAxis()); + + body["HomeLocation"] = homeLocation; + + // This awkward idiom warrants explanation. + // For starters, LLSDMessage::ResponderAdapter is ONLY for testing the new + // LLSDMessage functionality with a pre-existing LLHTTPClient::Responder. + // In new code, define your reply/error methods on the same class as the + // sending method, bind them to local LLEventPump objects and pass those + // LLEventPump names in the request LLSD object. + // When testing old code, the new LLHomeLocationResponder object + // is referenced by an LLHTTPClient::ResponderPtr, so when the + // ResponderAdapter is deleted, the LLHomeLocationResponder will be too. + // We must trust that the underlying LLHTTPClient code will eventually + // fire either the reply callback or the error callback; either will cause + // the ResponderAdapter to delete itself. + LLSDMessage::ResponderAdapter* + adapter(new LLSDMessage::ResponderAdapter(new LLHomeLocationResponder())); + + request["message"] = "HomeLocation"; + request["payload"] = body; + request["reply"] = adapter->getReplyName(); + request["error"] = adapter->getErrorName(); + + gAgent.getRegion()->getCapAPI().post(request); + + const U32 HOME_INDEX = 1; + if( HOME_INDEX == location_id ) { - llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl; + setHomePosRegion( mRegionp->getHandle(), getPositionAgent() ); } - } } +struct HomeLocationMapper: public LLCapabilityListener::CapabilityMapper +{ + // No reply message expected + HomeLocationMapper(): LLCapabilityListener::CapabilityMapper("HomeLocation") {} + virtual void buildMessage(LLMessageSystem* msg, + const LLUUID& agentID, + const LLUUID& sessionID, + const std::string& capabilityName, + const LLSD& payload) const + { + msg->newMessageFast(_PREHASH_SetStartLocationRequest); + msg->nextBlockFast( _PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, agentID); + msg->addUUIDFast(_PREHASH_SessionID, sessionID); + msg->nextBlockFast( _PREHASH_StartLocationData); + // corrected by sim + msg->addStringFast(_PREHASH_SimName, ""); + msg->addU32Fast(_PREHASH_LocationID, payload["HomeLocation"]["LocationId"].asInteger()); + msg->addVector3Fast(_PREHASH_LocationPos, + ll_vector3_from_sdmap(payload["HomeLocation"]["LocationPos"])); + msg->addVector3Fast(_PREHASH_LocationLookAt, + ll_vector3_from_sdmap(payload["HomeLocation"]["LocationLookAt"])); + } +}; +// Need an instance of this class so it will self-register +static HomeLocationMapper homeLocationMapper; + void LLAgent::requestStopMotion( LLMotion* motion ) { // Notify all avatars that a motion has stopped. @@ -5479,7 +5500,7 @@ void update_group_floaters(const LLUUID& group_id) gIMMgr->refresh(); } - gAgent.fireEvent(new LLEvent(&gAgent, "new group"), ""); + gAgent.fireEvent(new LLOldEvents::LLEvent(&gAgent, "new group"), ""); } // static -- cgit v1.2.3 From 3013aa1c847ac8884ca7b287fd1406b3fc2393ab Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Fri, 10 Jul 2009 13:09:27 -0700 Subject: Added an LLAgentListener implementation for event requests like teleport, sit, stand, etc. --- indra/newview/llagent.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index a8094a5850..13546347b9 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -35,6 +35,7 @@ #include "llagent.h" #include "llagentwearables.h" +#include "llagentlistener.h" #include "llanimationstates.h" #include "llcallingcard.h" #include "llchatbar.h" @@ -254,6 +255,7 @@ LLAgent::LLAgent() : mHUDTargetZoom(1.f), mHUDCurZoom(1.f), mInitialized(FALSE), + mListener(), mForceMouselook(FALSE), mDoubleTapRunTimer(), @@ -381,6 +383,8 @@ LLAgent::LLAgent() : } mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); + + mListener.reset(new LLAgentListener(*this)); } // Requires gSavedSettings to be initialized. -- cgit v1.2.3 From 86787b58edf59997b68dca6a0927d24b2a24a2b5 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 15 Oct 2009 18:42:30 -0700 Subject: Major refactor of LLViewerMediaFocus and LLPanelMediaHUD. LLViewerMediaFocus now tracks two separate objects: the currently focused media object, and the media object that's currently being hovered over. It no longer stores smart pointers to either the LLViewerObject or the LLViewerMediaImpl -- it now looks up both by UUID every time they're needed, and fails gracefully if either goes away. This will prevent it from keeping objects from being deleted. The poorly-understood "mouseOverFlag" has been expunged. LLViewerMediaFocus no longer uses LLSelectMgr at all. The object to focus on is explicitly passed between LLViewerMediaFocus and LLPanelMediaHUD instead of going indirectly through the selection manager. LLViewerMediaFocus also no longer interacts with the pick from LLToolPie -- the data it needs from the pick (the object and normal vector) is passed explicitly. LLViewerMediaFocus::setCameraZoom and LLViewerMediaFocus::getBBoxAspectRatio now have no dependencies on the LLViewerMediaFocus object -- all the data they need is passed in when they're called by the LLPanelMediaHUD. I made them static member functions, but they could be moved to LLPanelMediaHUD or even made into file-scoped static functions. The only reason I didn't do either of those is that it seems like they belong with the LLViewerMediaFocus code as opposed to the HUD. --- indra/newview/llagent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index ab9db303b5..d6fe9a20ed 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -5975,7 +5975,7 @@ bool LLAgent::teleportCore(bool is_local) LLFloaterReg::hideInstance("about_land"); LLViewerParcelMgr::getInstance()->deselectLand(); - LLViewerMediaFocus::getInstance()->setFocusFace(false, NULL, 0, NULL); + LLViewerMediaFocus::getInstance()->clearFocus(); // Close all pie menus, deselect land, etc. // Don't change the camera until we know teleport succeeded. JC -- cgit v1.2.3 From e018754f7e94be57dec9f7f8c341caa39643c277 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Mon, 26 Oct 2009 13:05:08 +0200 Subject: IM: removed unused & empty methods and classes, added TODO marks --HG-- branch : product-engine --- indra/newview/llagent.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f62606cc50..5800db482f 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -5391,12 +5391,6 @@ void update_group_floaters(const LLUUID& group_id) //*TODO Implement group update for Profile View // still actual as of July 31, 2009 (DZ) - if (gIMMgr) - { - // update the talk view - gIMMgr->refresh(); - } - gAgent.fireEvent(new LLOldEvents::LLEvent(&gAgent, "new group"), ""); } -- cgit v1.2.3 From 86921724c438e31957bc803695054bba80645df4 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Wed, 28 Oct 2009 18:31:43 +0200 Subject: IM refactoring: moved speakers management stuff in its own files llspeakers.* from dying llfloateractivespeakers. * Decresed number of llfloateractivespeakers.h includes to a minimum. --HG-- branch : product-engine --- indra/newview/llagent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5800db482f..75a72e5b17 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -42,7 +42,7 @@ #include "lldrawable.h" #include "llfirstuse.h" #include "llfloaterreg.h" -#include "llfloateractivespeakers.h" +#include "llspeakers.h" #include "llfloatercamera.h" #include "llfloatercustomize.h" -- cgit v1.2.3