00001
00032 #ifndef LL_LLAGENT_H
00033 #define LL_LLAGENT_H
00034
00035 #include <set>
00036
00037 #include "indra_constants.h"
00038 #include "llmath.h"
00039 #include "llcontrol.h"
00040 #include "llcoordframe.h"
00041 #include "llevent.h"
00042 #include "llagentconstants.h"
00043 #include "llanimationstates.h"
00044 #include "lldbstrings.h"
00045 #include "llhudeffectlookat.h"
00046 #include "llhudeffectpointat.h"
00047 #include "llmemory.h"
00048 #include "llstring.h"
00049 #include "lluuid.h"
00050 #include "m3math.h"
00051 #include "m4math.h"
00052 #include "llquaternion.h"
00053 #include "lltimer.h"
00054 #include "v3dmath.h"
00055 #include "v3math.h"
00056 #include "v4color.h"
00057 #include "v4math.h"
00058
00059 #include "stdenums.h"
00060 #include "llwearable.h"
00061 #include "llcharacter.h"
00062 #include "llinventory.h"
00063 #include "llviewerinventory.h"
00064 #include "llagentdata.h"
00065
00066
00067 #include "llfollowcam.h"
00068
00069
00070 const U8 AGENT_STATE_TYPING = 0x04;
00071 const U8 AGENT_STATE_EDITING = 0x10;
00072
00073 const BOOL ANIMATE = TRUE;
00074
00075 typedef enum e_camera_modes
00076 {
00077 CAMERA_MODE_THIRD_PERSON,
00078 CAMERA_MODE_MOUSELOOK,
00079 CAMERA_MODE_CUSTOMIZE_AVATAR,
00080 CAMERA_MODE_FOLLOW
00081 } ECameraMode;
00082
00083 typedef enum e_anim_request
00084 {
00085 ANIM_REQUEST_START,
00086 ANIM_REQUEST_STOP
00087 } EAnimRequest;
00088
00089 class LLChat;
00090 class LLVOAvatar;
00091 class LLViewerRegion;
00092 class LLMotion;
00093 class LLToolset;
00094 class LLMessageSystem;
00095 class LLPermissions;
00096 class LLHost;
00097 class LLFriendObserver;
00098
00099 struct LLGroupData
00100 {
00101 LLUUID mID;
00102 LLUUID mInsigniaID;
00103 U64 mPowers;
00104 BOOL mAcceptNotices;
00105 BOOL mListInProfile;
00106 S32 mContribution;
00107 std::string mName;
00108 };
00109
00110 inline bool operator==(const LLGroupData &a, const LLGroupData &b)
00111 {
00112 return (a.mID == b.mID);
00113 }
00114
00115
00116
00117
00118
00119 class LLAgent : public LLObservable
00120 {
00121 LOG_CLASS(LLAgent);
00122
00123 public:
00124
00125
00126 static const F32 TYPING_TIMEOUT_SECS;
00127
00128 LLAgent();
00129 ~LLAgent();
00130
00131 void init();
00132 void cleanup();
00133
00134
00135
00136
00137
00138
00139
00140
00141 void resetView(BOOL reset_camera = TRUE);
00142
00143
00144
00145 void unlockView();
00146
00147 void onAppFocusGained();
00148
00149 void sendMessage();
00150 void sendReliableMessage();
00151
00152 LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL);
00153 LLVector3d calcFocusPositionTargetGlobal();
00154 LLVector3d getCameraPositionGlobal() const;
00155 const LLVector3 &getCameraPositionAgent() const;
00156 F32 calcCameraFOVZoomFactor();
00157 F32 getCameraMinOffGround();
00158 void endAnimationUpdateUI();
00159 void setKey(const S32 direction, S32 &key);
00160 void handleScrollWheel(S32 clicks);
00161
00162 void setAvatarObject(LLVOAvatar *avatar);
00163
00164
00165 void startTyping();
00166 void stopTyping();
00167 void setRenderState(U8 newstate);
00168 void clearRenderState(U8 clearstate);
00169 U8 getRenderState();
00170
00171
00172 void setRegion(LLViewerRegion *regionp);
00173 LLViewerRegion *getRegion() const;
00174 const LLHost& getRegionHost() const;
00175 std::string getSLURL() const;
00176
00177 void updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y);
00178 void updateLookAt(const S32 mouse_x, const S32 mouse_y);
00179
00180
00181 void updateCamera();
00182 void resetCamera();
00183 void setupSitCamera();
00184 void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; }
00185
00186 void changeCameraToDefault();
00187 void changeCameraToMouselook(BOOL animate = TRUE);
00188 void changeCameraToThirdPerson(BOOL animate = TRUE);
00189 void changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE);
00190
00191 void changeCameraToFollow(BOOL animate = TRUE);
00192
00193
00194 void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null);
00195 void setFocusOnAvatar(BOOL focus, BOOL animate);
00196 void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id);
00197 void setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero);
00198 void clearFocusObject();
00199 void setFocusObject(LLViewerObject* object);
00200 void setObjectTracking(BOOL track) { mTrackFocusObject = track; }
00201
00202
00203 void heardChat(const LLUUID& id);
00204 void lookAtLastChat();
00205 F32 getTypingTime() { return mTypingTimer.getElapsedTimeF32(); }
00206
00207 void setAFK();
00208 void clearAFK();
00209 BOOL getAFK() const;
00210
00211 void setAlwaysRun() { mbAlwaysRun = true; }
00212 void clearAlwaysRun() { mbAlwaysRun = false; }
00213
00214 void setRunning() { mbRunning = true; }
00215 void clearRunning() { mbRunning = false; }
00216
00217 void setBusy();
00218 void clearBusy();
00219 BOOL getBusy() const;
00220
00221 void setAdminOverride(BOOL b) { mAdminOverride = b; }
00222 void setGodLevel(U8 god_level) { mGodLevel = god_level; }
00223 void setFirstLogin(BOOL b) { mFirstLogin = b; }
00224 void setGenderChosen(BOOL b) { mGenderChosen = b; }
00225
00226
00227
00228
00229 BOOL setGroupContribution(const LLUUID& group_id, S32 contribution);
00230 BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile);
00231 void setHideGroupTitle(BOOL hide) { mHideGroupTitle = hide; }
00232
00233
00234
00235
00236
00237
00238 const LLUUID& getID() const { return gAgentID; }
00239 const LLUUID& getSessionID() const { return gAgentSessionID; }
00240
00241 const LLUUID& getSecureSessionID() const { return mSecureSessionID; }
00242
00243
00244
00245
00246 BOOL isGodlike() const;
00247 U8 getGodLevel() const;
00248 bool isTeen() const;
00249 void setTeen(bool teen);
00250 BOOL isGroupTitleHidden() const { return mHideGroupTitle; }
00251 BOOL isGroupMember() const { return !mGroupID.isNull(); }
00252 const LLUUID &getGroupID() const { return mGroupID; }
00253 ECameraMode getCameraMode() const { return mCameraMode; }
00254 BOOL getFocusOnAvatar() const { return mFocusOnAvatar; }
00255 LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; }
00256 F32 getFocusObjectDist() const { return mFocusObjectDist; }
00257 BOOL inPrelude();
00258 BOOL canManageEstate() const;
00259 BOOL getAdminOverride() const { return mAdminOverride; }
00260
00261 LLUUID getLastChatter() const { return mLastChatterID; }
00262 bool getAlwaysRun() const { return mbAlwaysRun; }
00263 bool getRunning() const { return mbRunning; }
00264
00265 const LLUUID& getInventoryRootID() const { return mInventoryRootID; }
00266
00267 void buildFullname(std::string &name) const;
00268 void buildFullnameAndTitle(std::string &name) const;
00269
00270
00271 BOOL isInGroup(const LLUUID& group_id) const;
00272 BOOL hasPowerInGroup(const LLUUID& group_id, U64 power) const;
00273
00274 BOOL hasPowerInActiveGroup(const U64 power) const;
00275 U64 getPowerInGroup(const LLUUID& group_id) const;
00276
00277
00278
00279
00280 BOOL getGroupData(const LLUUID& group_id, LLGroupData& data) const;
00281
00282 S32 getGroupContribution(const LLUUID& group_id) const;
00283
00284
00285
00286 BOOL isFirstLogin() const { return mFirstLogin; }
00287
00288
00289
00290 BOOL isGenderChosen() const { return mGenderChosen; }
00291
00292
00293 void buildLocationString(std::string& str);
00294
00295 LLQuaternion getHeadRotation();
00296 LLVOAvatar *getAvatarObject() const { return mAvatarObject; }
00297
00298 BOOL needsRenderAvatar();
00299
00300 BOOL needsRenderHead();
00301 BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); }
00302 BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); }
00303 BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR ); }
00304 BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); }
00305
00306 LLVector3 getPosAgentFromGlobal(const LLVector3d &pos_global) const;
00307 LLVector3d getPosGlobalFromAgent(const LLVector3 &pos_agent) const;
00308
00309
00310 const LLVector3& getAtAxis() const { return mFrameAgent.getAtAxis(); }
00311 const LLVector3& getUpAxis() const { return mFrameAgent.getUpAxis(); }
00312 const LLVector3& getLeftAxis() const { return mFrameAgent.getLeftAxis(); }
00313
00314 LLCoordFrame getFrameAgent() const { return mFrameAgent; }
00315 LLVector3 getVelocity() const;
00316 F32 getVelocityZ() const { return getVelocity().mV[VZ]; }
00317
00318 const LLVector3d &getPositionGlobal() const;
00319 const LLVector3 &getPositionAgent();
00320 S32 getRegionsVisited() const;
00321 F64 getDistanceTraveled() const;
00322
00323 const LLVector3d &getFocusGlobal() const { return mFocusGlobal; }
00324 const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; }
00325
00326 BOOL getJump() const { return mbJump; }
00327 BOOL getAutoPilot() const { return mAutoPilot; }
00328 LLVector3d getAutoPilotTargetGlobal() const { return mAutoPilotTargetGlobal; }
00329
00330 LLQuaternion getQuat() const;
00331
00332
00333
00334 void getName(LLString& name);
00335
00336 const LLColor4 &getEffectColor();
00337 void setEffectColor(const LLColor4 &color);
00338
00339
00340
00341
00342
00343 void slamLookAt(const LLVector3 &look_at);
00344
00345 void setPositionAgent(const LLVector3 ¢er);
00346
00347 void resetAxes();
00348 void resetAxes(const LLVector3 &look_at);
00349
00350
00351 void rotate(F32 angle, const LLVector3 &axis);
00352 void rotate(F32 angle, F32 x, F32 y, F32 z);
00353 void rotate(const LLMatrix3 &matrix);
00354 void rotate(const LLQuaternion &quaternion);
00355 void pitch(F32 angle);
00356 void roll(F32 angle);
00357 void yaw(F32 angle);
00358 LLVector3 getReferenceUpVector();
00359 F32 clampPitchToLimits(F32 angle);
00360
00361 void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; }
00362
00363 BOOL getFlying() const { return mControlFlags & AGENT_CONTROL_FLY; }
00364 void setFlying(BOOL fly);
00365 void toggleFlying();
00366
00367
00368 BOOL canFly();
00369
00370
00371 void requestStopMotion( LLMotion* motion );
00372 void onAnimStop(const LLUUID& id);
00373
00374 void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request);
00375 void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
00376
00377 LLVector3d calcFocusOffset(LLViewerObject *object, S32 x, S32 y);
00378 BOOL calcCameraMinDistance(F32 &obj_min_distance);
00379
00380 void startCameraAnimation();
00381 void stopCameraAnimation();
00382
00383 void cameraZoomIn(const F32 factor);
00384 void cameraOrbitAround(const F32 radians);
00385 void cameraOrbitOver(const F32 radians);
00386 void cameraOrbitIn(const F32 meters);
00387
00388 F32 getCameraZoomFraction();
00389 void setCameraZoomFraction(F32 fraction);
00390
00391 void cameraPanIn(const F32 meters);
00392 void cameraPanLeft(const F32 meters);
00393 void cameraPanUp(const F32 meters);
00394
00395 void updateFocusOffset();
00396 void validateFocusObject();
00397
00398 void setUsingFollowCam( bool using_follow_cam);
00399
00400 F32 calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_global );
00401
00402
00403 void setStartPosition(U32 location_id);
00404
00405
00406
00407
00408 void moveAt(S32 direction, bool reset_view = true);
00409 void moveAtNudge(S32 direction);
00410 void moveLeft(S32 direction);
00411 void moveLeftNudge(S32 direction);
00412 void moveUp(S32 direction);
00413 void moveYaw(F32 mag, bool reset_view = true);
00414 void movePitch(S32 direction);
00415
00416 void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; }
00417 void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; }
00418 void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; }
00419 void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; }
00420 void setOrbitInKey(F32 mag) { mOrbitInKey = mag; }
00421 void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; }
00422
00423 void setPanLeftKey(F32 mag) { mPanLeftKey = mag; }
00424 void setPanRightKey(F32 mag) { mPanRightKey = mag; }
00425 void setPanUpKey(F32 mag) { mPanUpKey = mag; }
00426 void setPanDownKey(F32 mag) { mPanDownKey = mag; }
00427 void setPanInKey(F32 mag) { mPanInKey = mag; }
00428 void setPanOutKey(F32 mag) { mPanOutKey = mag; }
00429
00430 U32 getControlFlags();
00431 void setControlFlags(U32 mask);
00432 void clearControlFlags(U32 mask);
00433 BOOL controlFlagsDirty() const;
00434 void enableControlFlagReset();
00435 void resetControlFlags();
00436
00437 void propagate(const F32 dt);
00438
00439 void startAutoPilotGlobal(const LLVector3d &pos_global, const std::string& behavior_name = std::string(), const LLQuaternion *target_rotation = NULL,
00440 void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL, F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f);
00441
00442 void startFollowPilot(const LLUUID &leader_id);
00443 void stopAutoPilot(BOOL user_cancel = FALSE);
00444 void setAutoPilotGlobal(const LLVector3d &pos_global);
00445 void autoPilot(F32 *delta_yaw);
00446 void renderAutoPilotTarget();
00447
00448
00449
00450
00451
00452
00453 void teleportRequest(
00454 const U64& region_handle,
00455 const LLVector3& pos_local);
00456
00457
00458 void teleportViaLandmark(const LLUUID& landmark_id);
00459
00460
00461 void teleportHome() { teleportViaLandmark(LLUUID::null); }
00462
00463
00464 void teleportViaLure(const LLUUID& lure_id, BOOL godlike);
00465
00466
00467
00468 void teleportViaLocation(const LLVector3d& pos_global);
00469
00470
00471 void teleportCancel();
00472
00473 void setTargetVelocity(const LLVector3 &vel);
00474 const LLVector3 &getTargetVelocity() const;
00475
00476 const std::string getTeleportSourceSLURL() const { return mTeleportSourceSLURL; }
00477
00478
00479
00480
00481
00482
00483
00484
00485 static void processAgentDataUpdate(LLMessageSystem *msg, void **);
00486 static void processAgentGroupDataUpdate(LLMessageSystem *msg, void **);
00487 static void processAgentDropGroup(LLMessageSystem *msg, void **);
00488 static void processScriptControlChange(LLMessageSystem *msg, void **);
00489 static void processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void **user_data);
00490
00491
00492
00493
00494
00495 BOOL isGrantedProxy(const LLPermissions& perm);
00496
00497 BOOL allowOperation(PermissionBit op,
00498 const LLPermissions& perm,
00499 U64 group_proxy_power = 0,
00500 U8 god_minimum = GOD_MAINTENANCE);
00501
00502 friend std::ostream& operator<<(std::ostream &s, const LLAgent &sphere);
00503
00504 void initOriginGlobal(const LLVector3d &origin_global);
00505
00506 BOOL leftButtonGrabbed() const { return ( (!cameraMouselook() && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
00507 ||(cameraMouselook() && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0)
00508 ||(!cameraMouselook() && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
00509 ||(cameraMouselook() && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0)); }
00510 BOOL rotateGrabbed() const { return ( (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0)
00511 ||(mControlsTakenCount[CONTROL_YAW_NEG_INDEX] > 0)); }
00512 BOOL forwardGrabbed() const { return ( (mControlsTakenCount[CONTROL_AT_POS_INDEX] > 0)); }
00513 BOOL backwardGrabbed() const { return ( (mControlsTakenCount[CONTROL_AT_NEG_INDEX] > 0)); }
00514 BOOL upGrabbed() const { return ( (mControlsTakenCount[CONTROL_UP_POS_INDEX] > 0)); }
00515 BOOL downGrabbed() const { return ( (mControlsTakenCount[CONTROL_UP_NEG_INDEX] > 0)); }
00516
00517
00518 BOOL anyControlGrabbed() const;
00519
00520 BOOL isControlGrabbed(S32 control_index) const;
00521
00522
00523
00524 void forceReleaseControls();
00525
00526 BOOL sitCameraEnabled() { return mSitCameraEnabled; }
00527
00528 F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.magVec(); }
00529
00530
00531 BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero);
00532 ELookAtType getLookAtType();
00533
00534
00535 BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero);
00536 EPointAtType getPointAtType();
00537
00538 void setHomePosRegion( const U64& region_handle, const LLVector3& pos_region );
00539 BOOL getHomePosGlobal( LLVector3d* pos_global );
00540 void setCameraAnimating( BOOL b ) { mCameraAnimating = b; }
00541 void setAnimationDuration( F32 seconds ) { mAnimationDuration = seconds; }
00542
00543 F32 getNearChatRadius() { return mNearChatRadius; }
00544
00545 enum EDoubleTapRunMode
00546 {
00547 DOUBLETAP_NONE,
00548 DOUBLETAP_FORWARD,
00549 DOUBLETAP_BACKWARD,
00550 DOUBLETAP_SLIDELEFT,
00551 DOUBLETAP_SLIDERIGHT
00552 };
00553
00554 enum ETeleportState
00555 {
00556 TELEPORT_NONE = 0,
00557 TELEPORT_START = 1,
00558 TELEPORT_REQUESTED = 2,
00559 TELEPORT_MOVING = 3,
00560 TELEPORT_START_ARRIVAL = 4,
00561 TELEPORT_ARRIVING = 5
00562 };
00563
00564 ETeleportState getTeleportState() const { return mTeleportState; }
00565 void setTeleportState( ETeleportState state );
00566 const LLString& getTeleportMessage() const { return mTeleportMessage; }
00567 void setTeleportMessage(const LLString& message)
00568 {
00569 mTeleportMessage = message;
00570 }
00571
00572
00573 void fidget();
00574
00575 void requestEnterGodMode();
00576 void requestLeaveGodMode();
00577
00578 void sendAgentSetAppearance();
00579
00580 void sendAgentDataUpdateRequest();
00581
00582
00583 LLFollowCam mFollowCam;
00584
00585
00586
00587
00588
00589 BOOL getWearablesLoaded() const { return mWearablesLoaded; }
00590
00591 void setWearable( LLInventoryItem* new_item, LLWearable* wearable );
00592 static void onSetWearableDialog( S32 option, void* userdata );
00593 void setWearableFinal( LLInventoryItem* new_item, LLWearable* new_wearable );
00594 void setWearableOutfit( const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove );
00595 void queryWearableCache();
00596
00597 BOOL isWearableModifiable(EWearableType type);
00598 BOOL isWearableCopyable(EWearableType type);
00599 BOOL needsReplacement(EWearableType wearableType, S32 remove);
00600 U32 getWearablePermMask(EWearableType type);
00601
00602 LLInventoryItem* getWearableInventoryItem(EWearableType type);
00603
00604 LLWearable* getWearable( EWearableType type ) { return (type < WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL; }
00605 BOOL isWearingItem( const LLUUID& item_id );
00606 LLWearable* getWearableFromWearableItem( const LLUUID& item_id );
00607 const LLUUID& getWearableItem( EWearableType type ) { return (type < WT_COUNT) ? mWearableEntry[ type ].mItemID : LLUUID::null; }
00608
00609 static EWearableType getTEWearableType( S32 te );
00610 static LLUUID getDefaultTEImageID( S32 te );
00611
00612 void copyWearableToInventory( EWearableType type );
00613
00614 void makeNewOutfit(
00615 const std::string& new_folder_name,
00616 const LLDynamicArray<S32>& wearables_to_include,
00617 const LLDynamicArray<S32>& attachments_to_include,
00618 BOOL rename_clothing);
00619 void makeNewOutfitDone(S32 index);
00620
00621 void removeWearable( EWearableType type );
00622 static void onRemoveWearableDialog( S32 option, void* userdata );
00623 void removeWearableFinal( EWearableType type );
00624
00625 void sendAgentWearablesUpdate();
00626
00637 void addWearabletoAgentInventoryDone(
00638 S32 index,
00639 const LLUUID& item_id,
00640 LLWearable* wearable);
00641
00642 void saveWearableAs( EWearableType type, const std::string& new_name, BOOL save_in_lost_and_found );
00643 void saveWearable( EWearableType type, BOOL send_update = TRUE );
00644 void saveAllWearables();
00645
00646 void revertWearable( EWearableType type );
00647 void revertAllWearables();
00648
00649 void setWearableName( const LLUUID& item_id, const std::string& new_name );
00650 void createStandardWearables(BOOL female);
00651 void createStandardWearablesDone(S32 index);
00652 void createStandardWearablesAllDone();
00653
00654 BOOL areWearablesLoaded() { return mWearablesLoaded; }
00655
00656 void sendWalkRun(bool running);
00657
00658 void observeFriends();
00659 void friendsChanged();
00660
00661
00662 static void stopFidget();
00663 static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
00664 static void userRemoveWearable( void* userdata );
00665 static void userRemoveAllClothes( void* userdata );
00666 static void userRemoveAllClothesStep2(BOOL proceed, void* userdata );
00667 static void userRemoveAllAttachments( void* userdata);
00668 static BOOL selfHasWearable( void* userdata );
00669
00670
00671 static void clearVisualParams(void *);
00672
00673 protected:
00674
00675
00676 bool teleportCore(bool is_local = false);
00677
00678
00679 void ageChat();
00680
00681
00682 void sendAgentWearablesRequest();
00683 static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata);
00684 void recoverMissingWearable(EWearableType type);
00685 void recoverMissingWearableDone();
00686 void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
00687 LLWearable* wearable, const LLUUID& category_id = LLUUID::null,
00688 BOOL notify = TRUE);
00689 public:
00690
00691 LLUUID mSecureSessionID;
00692
00693 F32 mDrawDistance;
00694
00695 U64 mGroupPowers;
00696 BOOL mHideGroupTitle;
00697 char mGroupTitle[DB_GROUP_TITLE_BUF_SIZE];
00698 char mGroupName[DB_GROUP_NAME_BUF_SIZE];
00699 LLUUID mGroupID;
00700
00701 LLUUID mInventoryRootID;
00702 LLUUID mMapID;
00703 F64 mMapOriginX;
00704 F64 mMapOriginY;
00705 S32 mMapWidth;
00706 S32 mMapHeight;
00707 std::string mMOTD;
00708
00709 LLPointer<LLHUDEffectLookAt> mLookAt;
00710 LLPointer<LLHUDEffectPointAt> mPointAt;
00711
00712 LLDynamicArray<LLGroupData> mGroups;
00713
00714 BOOL mInitialized;
00715
00716 static BOOL sDebugDisplayTarget;
00717 S32 mNumPendingQueries;
00718 S32* mActiveCacheQueries;
00719
00720 BOOL mForceMouselook;
00721
00722 static void parseTeleportMessages(const LLString& xml_filename);
00723
00724
00725
00726 static std::map<LLString, LLString> sTeleportErrorMessages;
00727 static std::map<LLString, LLString> sTeleportProgressMessages;
00728
00729 LLFrameTimer mDoubleTapRunTimer;
00730 EDoubleTapRunMode mDoubleTapRunMode;
00731
00732 private:
00733 bool mbAlwaysRun;
00734 bool mbRunning;
00735
00736
00737 U8 mAccess;
00738 ETeleportState mTeleportState;
00739 LLString mTeleportMessage;
00740
00741 S32 mControlsTakenCount[TOTAL_CONTROLS];
00742 S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS];
00743
00744 LLViewerRegion *mRegionp;
00745 LLVector3d mAgentOriginGlobal;
00746 mutable LLVector3d mPositionGlobal;
00747
00748 std::string mTeleportSourceSLURL;
00749
00750 std::set<U64> mRegionsVisited;
00751 F64 mDistanceTraveled;
00752 LLVector3d mLastPositionGlobal;
00753
00754 LLPointer<LLVOAvatar> mAvatarObject;
00755
00756 U8 mRenderState;
00757 LLFrameTimer mTypingTimer;
00758
00759 ECameraMode mCameraMode;
00760 ECameraMode mLastCameraMode;
00761 BOOL mViewsPushed;
00762
00763 BOOL mCustomAnim ;
00764 BOOL mShowAvatar;
00765 BOOL mCameraAnimating;
00766 LLVector3d mAnimationCameraStartGlobal;
00767 LLVector3d mAnimationFocusStartGlobal;
00768 LLFrameTimer mAnimationTimer;
00769 F32 mAnimationDuration;
00770 F32 mCameraFOVZoomFactor;
00771 F32 mCameraCurrentFOVZoomFactor;
00772 F32 mCameraFOVDefault;
00773 LLVector3d mCameraFocusOffset;
00774 LLVector3d mCameraFocusOffsetTarget;
00775 LLVector3 mCameraOffsetDefault;
00776 LLVector4 mCameraCollidePlane;
00777 F32 mCurrentCameraDistance;
00778 F32 mTargetCameraDistance;
00779 F32 mCameraZoomFraction;
00780 LLVector3 mCameraLag;
00781 LLVector3 mThirdPersonHeadOffset;
00782 LLVector3 mCameraPositionAgent;
00783 LLVector3 mCameraVirtualPositionAgent;
00784 BOOL mSitCameraEnabled;
00785 LLVector3 mSitCameraPos;
00786 LLVector3 mSitCameraFocus;
00787 LLVector3d mCameraSmoothingLastPositionGlobal;
00788 LLVector3d mCameraSmoothingLastPositionAgent;
00789
00790
00791 LLVector3 mCameraUpVector;
00792
00793
00794 LLPointer<LLViewerObject> mSitCameraReferenceObject;
00795
00796 BOOL mFocusOnAvatar;
00797 LLVector3d mFocusGlobal;
00798 LLVector3d mFocusTargetGlobal;
00799 LLPointer<LLViewerObject> mFocusObject;
00800 F32 mFocusObjectDist;
00801 LLVector3 mFocusObjectOffset;
00802 F32 mFocusDotRadius;
00803 BOOL mTrackFocusObject;
00804 F32 mUIOffset;
00805
00806 LLCoordFrame mFrameAgent;
00807
00808 BOOL mCrouching;
00809 BOOL mIsBusy;
00810
00811 S32 mAtKey;
00812 S32 mWalkKey;
00813 S32 mLeftKey;
00814 S32 mUpKey;
00815 F32 mYawKey;
00816 S32 mPitchKey;
00817
00818 F32 mOrbitLeftKey;
00819 F32 mOrbitRightKey;
00820 F32 mOrbitUpKey;
00821 F32 mOrbitDownKey;
00822 F32 mOrbitInKey;
00823 F32 mOrbitOutKey;
00824
00825 F32 mPanUpKey;
00826 F32 mPanDownKey;
00827 F32 mPanLeftKey;
00828 F32 mPanRightKey;
00829 F32 mPanInKey;
00830 F32 mPanOutKey;
00831
00832 U32 mControlFlags;
00833 BOOL mbFlagsDirty;
00834 BOOL mbFlagsNeedReset;
00835
00836 BOOL mbJump;
00837
00838 BOOL mAutoPilot;
00839 BOOL mAutoPilotFlyOnStop;
00840 LLVector3d mAutoPilotTargetGlobal;
00841 F32 mAutoPilotStopDistance;
00842 BOOL mAutoPilotUseRotation;
00843 LLVector3 mAutoPilotTargetFacing;
00844 F32 mAutoPilotTargetDist;
00845 S32 mAutoPilotNoProgressFrameCount;
00846 F32 mAutoPilotRotationThreshold;
00847 std::string mAutoPilotBehaviorName;
00848 void (*mAutoPilotFinishedCallback)(BOOL, void *);
00849 void* mAutoPilotCallbackData;
00850 LLUUID mLeaderID;
00851
00852 std::set<LLUUID> mProxyForAgents;
00853
00854 LLColor4 mEffectColor;
00855
00856 BOOL mHaveHomePosition;
00857 U64 mHomeRegionHandle;
00858 LLVector3 mHomePosRegion;
00859 LLFrameTimer mChatTimer;
00860 LLUUID mLastChatterID;
00861 F32 mNearChatRadius;
00862 BOOL mAdminOverride;
00863
00864
00865 U8 mGodLevel;
00866 LLFrameTimer mFidgetTimer;
00867 LLFrameTimer mFocusObjectFadeTimer;
00868 F32 mNextFidgetTime;
00869 S32 mCurrentFidget;
00870 BOOL mFirstLogin;
00871 BOOL mGenderChosen;
00872
00873
00874
00875
00876 struct LLWearableEntry
00877 {
00878 LLWearableEntry() : mItemID( LLUUID::null ), mWearable( NULL ) {}
00879
00880 LLUUID mItemID;
00881 LLWearable* mWearable;
00882 };
00883 LLWearableEntry mWearableEntry[ WT_COUNT ];
00884 U32 mAgentWearablesUpdateSerialNum;
00885 BOOL mWearablesLoaded;
00886 S32 mTextureCacheQueryID;
00887 U32 mAppearanceSerialNum;
00888 LLAnimPauseRequest mPauseRequest;
00889
00890 class createStandardWearablesAllDoneCallback : public LLRefCount
00891 {
00892 protected:
00893 ~createStandardWearablesAllDoneCallback();
00894 };
00895 class sendAgentWearablesUpdateCallback : public LLRefCount
00896 {
00897 protected:
00898 ~sendAgentWearablesUpdateCallback();
00899 };
00900
00901 class addWearableToAgentInventoryCallback : public LLInventoryCallback
00902 {
00903 public:
00904 enum {
00905 CALL_NONE = 0,
00906 CALL_UPDATE = 1,
00907 CALL_RECOVERDONE = 2,
00908 CALL_CREATESTANDARDDONE = 4,
00909 CALL_MAKENEWOUTFITDONE = 8
00910 } EType;
00911
00922 addWearableToAgentInventoryCallback(
00923 LLPointer<LLRefCount> cb,
00924 S32 index,
00925 LLWearable* wearable,
00926 U32 todo = CALL_NONE);
00927 virtual void fire(const LLUUID& inv_item);
00928
00929 private:
00930 S32 mIndex;
00931 LLWearable* mWearable;
00932 U32 mTodo;
00933 LLPointer<LLRefCount> mCB;
00934 };
00935
00936 LLFriendObserver* mFriendObserver;
00937 };
00938
00939 extern LLAgent gAgent;
00940
00941 #endif