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 "llchat.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
00086 typedef enum e_camera_position
00087 {
00088 CAMERA_POSITION_SELF,
00089 CAMERA_POSITION_OBJECT
00090 } ECameraPosition;
00091
00092 typedef enum e_anim_request
00093 {
00094 ANIM_REQUEST_START,
00095 ANIM_REQUEST_STOP
00096 } EAnimRequest;
00097
00098 class LLChat;
00099 class LLVOAvatar;
00100 class LLViewerRegion;
00101 class LLMotion;
00102 class LLToolset;
00103 class LLMessageSystem;
00104 class LLPermissions;
00105 class LLHost;
00106 class LLFriendObserver;
00107
00108 struct LLGroupData
00109 {
00110 LLUUID mID;
00111 LLUUID mInsigniaID;
00112 U64 mPowers;
00113 BOOL mAcceptNotices;
00114 BOOL mListInProfile;
00115 S32 mContribution;
00116 std::string mName;
00117 };
00118
00119 inline bool operator==(const LLGroupData &a, const LLGroupData &b)
00120 {
00121 return (a.mID == b.mID);
00122 }
00123
00124
00125
00126
00127
00128 class LLAgent : public LLObservable
00129 {
00130 public:
00131
00132
00133 static const F32 TYPING_TIMEOUT_SECS;
00134
00135 LLAgent();
00136 ~LLAgent();
00137
00138 void init();
00139 void cleanup();
00140
00141
00142
00143
00144
00145
00146
00147
00148 void resetView(BOOL reset_camera = TRUE);
00149
00150
00151
00152 void unlockView();
00153
00154 void sendMessage();
00155 void sendReliableMessage();
00156
00157 LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL);
00158 LLVector3d calcFocusPositionTargetGlobal();
00159 LLVector3d getCameraPositionGlobal() const;
00160 const LLVector3 &getCameraPositionAgent() const;
00161 F32 calcCameraFOVZoomFactor();
00162 F32 getCameraMinOffGround();
00163 void endAnimationUpdateUI();
00164 void setKey(const S32 direction, S32 &key);
00165 void handleScrollWheel(S32 clicks);
00166
00167 void setAvatarObject(LLVOAvatar *avatar);
00168
00169
00170 void startTyping();
00171 void stopTyping();
00172 void setRenderState(U8 newstate);
00173 void clearRenderState(U8 clearstate);
00174 U8 getRenderState();
00175
00176
00177 void setRegion(LLViewerRegion *regionp);
00178 LLViewerRegion *getRegion() const;
00179 const LLHost& getRegionHost() const;
00180
00181 void updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y);
00182 void updateLookAt(const S32 mouse_x, const S32 mouse_y);
00183
00184
00185 void updateCamera();
00186 void resetCamera();
00187 void setupSitCamera();
00188 void setCameraCollidePlane(LLVector4 &plane) { mCameraCollidePlane = plane; }
00189
00190 void changeCameraToDefault();
00191 void changeCameraToMouselook(BOOL animate = TRUE);
00192 void changeCameraToThirdPerson(BOOL animate = TRUE);
00193 void changeCameraToCustomizeAvatar(BOOL animate = TRUE);
00194
00195 void changeCameraToFollow(BOOL animate = TRUE);
00196
00197
00198 void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null);
00199 void setFocusOnAvatar(BOOL focus, BOOL animate);
00200 void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id);
00201 void setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero);
00202 void clearFocusObject();
00203 void setFocusObject(LLViewerObject* object);
00204 void setObjectTracking(BOOL track) { mTrackFocusObject = track; }
00205
00206
00207 void heardChat(const LLUUID& id);
00208 void lookAtLastChat();
00209 void lookAtObject(LLUUID avatar_id, ECameraPosition camera_pos);
00210 LLUUID getLastChatter() { return mLastChatterID; }
00211 F32 getTypingTime() { return mTypingTimer.getElapsedTimeF32(); }
00212
00213 void setAFK();
00214 void clearAFK();
00215 BOOL getAFK() const;
00216
00217 void setAlwaysRun() { mbAlwaysRun = TRUE; }
00218 void clearAlwaysRun() { mbAlwaysRun = FALSE; }
00219 BOOL getAlwaysRun() const { return mbAlwaysRun; }
00220
00221 void setBusy();
00222 void clearBusy();
00223 BOOL getBusy() const;
00224
00225 void setAdminOverride(BOOL b) { mAdminOverride = b; }
00226 void setGodLevel(U8 god_level) { mGodLevel = god_level; }
00227 void setFirstLogin(BOOL b) { mFirstLogin = b; }
00228 void setGenderChosen(BOOL b) { mGenderChosen = b; }
00229
00230 BOOL getAdminOverride() const { return mAdminOverride; }
00231
00232
00233
00234 BOOL setGroupContribution(const LLUUID& group_id, S32 contribution);
00235 BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile);
00236 void setHideGroupTitle(BOOL hide) { mHideGroupTitle = hide; }
00237
00238
00239
00240
00241
00242
00243 const LLUUID& getID() const { return gAgentID; }
00244 const LLUUID& getSessionID() const { return gAgentSessionID; }
00245
00246 const LLUUID& getSecureSessionID() const { return mSecureSessionID; }
00247
00248
00249
00250
00251 BOOL isGodlike() const;
00252 U8 getGodLevel() const;
00253 bool isTeen() const;
00254 void setTeen(bool teen);
00255 BOOL isGroupTitleHidden() const { return mHideGroupTitle; }
00256 BOOL isGroupMember() const { return !mGroupID.isNull(); }
00257 const LLUUID &getGroupID() const { return mGroupID; }
00258 ECameraMode getCameraMode() const { return mCameraMode; }
00259 BOOL getFocusOnAvatar() const { return mFocusOnAvatar; }
00260 LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; }
00261 F32 getFocusObjectDist() const { return mFocusObjectDist; }
00262 BOOL inPrelude();
00263 BOOL canManageEstate() const;
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();
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
00360 void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; }
00361
00362 BOOL getFlying() const { return mControlFlags & AGENT_CONTROL_FLY; }
00363 void setFlying(BOOL fly);
00364 void toggleFlying();
00365
00366
00367 BOOL canFly();
00368
00369
00370 void requestStopMotion( LLMotion* motion );
00371 void onAnimStop(const LLUUID& id);
00372
00373 void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request);
00374 void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
00375
00376 LLVector3d calcFocusOffset(LLViewerObject *object, S32 x, S32 y);
00377 BOOL calcCameraMinDistance(F32 &obj_min_distance);
00378
00379 void startCameraAnimation();
00380 void stopCameraAnimation();
00381
00382 void cameraZoomIn(const F32 factor);
00383 void cameraOrbitAround(const F32 radians);
00384 void cameraOrbitOver(const F32 radians);
00385 void cameraOrbitIn(const F32 meters);
00386
00387 F32 getCameraZoomFraction();
00388 void setCameraZoomFraction(F32 fraction);
00389
00390 void cameraPanIn(const F32 meters);
00391 void cameraPanLeft(const F32 meters);
00392 void cameraPanUp(const F32 meters);
00393
00394 void updateFocusOffset();
00395 void validateFocusObject();
00396
00397 void setUsingFollowCam( bool using_follow_cam);
00398
00399 F32 calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_global );
00400
00401
00402 void setStartPosition(U32 location_id);
00403
00404
00405
00406
00407 void moveAt(S32 direction);
00408 void moveAtNudge(S32 direction);
00409 void moveLeft(S32 direction);
00410 void moveLeftNudge(S32 direction);
00411 void moveUp(S32 direction);
00412 void moveYaw(F32 mag);
00413 void movePitch(S32 direction);
00414
00415 void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; }
00416 void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; }
00417 void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; }
00418 void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; }
00419 void setOrbitInKey(F32 mag) { mOrbitInKey = mag; }
00420 void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; }
00421
00422 void setPanLeftKey(F32 mag) { mPanLeftKey = mag; }
00423 void setPanRightKey(F32 mag) { mPanRightKey = mag; }
00424 void setPanUpKey(F32 mag) { mPanUpKey = mag; }
00425 void setPanDownKey(F32 mag) { mPanDownKey = mag; }
00426 void setPanInKey(F32 mag) { mPanInKey = mag; }
00427 void setPanOutKey(F32 mag) { mPanOutKey = mag; }
00428
00429 U32 getControlFlags();
00430 void setControlFlags(U32 mask);
00431 void clearControlFlags(U32 mask);
00432 BOOL controlFlagsDirty() const;
00433 void enableControlFlagReset();
00434 void resetControlFlags();
00435
00436 void propagate(const F32 dt);
00437
00438 void startAutoPilotGlobal(const LLVector3d &pos_global, const std::string& behavior_name = std::string(), const LLQuaternion *target_rotation = NULL,
00439 void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL, F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f);
00440
00441 void startFollowPilot(const LLUUID &leader_id);
00442 void stopAutoPilot(BOOL user_cancel = FALSE);
00443 void setAutoPilotGlobal(const LLVector3d &pos_global);
00444 void autoPilot(F32 *delta_yaw);
00445 void renderAutoPilotTarget();
00446
00447
00448
00449
00450
00451
00452 void teleportRequest(
00453 const U64& region_handle,
00454 const LLVector3& pos_local);
00455
00456
00457 void teleportViaLandmark(const LLUUID& landmark_id);
00458
00459
00460 void teleportHome() { teleportViaLandmark(LLUUID::null); }
00461
00462
00463 void teleportViaLure(const LLUUID& lure_id, BOOL godlike);
00464
00465
00466
00467 void teleportViaLocation(const LLVector3d& pos_global);
00468
00469
00470 void teleportCancel();
00471
00472 void setTargetVelocity(const LLVector3 &vel);
00473 const LLVector3 &getTargetVelocity() const;
00474
00475 void sendChat(const LLString &text, S32 channel = 0, EChatType type = CHAT_TYPE_NORMAL, bool animate = false);
00476 void sendChat(const LLWString &text, S32 channel = 0, EChatType type = CHAT_TYPE_NORMAL, bool animate = false)
00477 { sendChat(wstring_to_utf8str(text), channel, type, animate); }
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 ETeleportState
00546 {
00547 TELEPORT_NONE = 0,
00548 TELEPORT_START = 1,
00549 TELEPORT_REQUESTED = 2,
00550 TELEPORT_MOVING = 3,
00551 TELEPORT_START_ARRIVAL = 4,
00552 TELEPORT_ARRIVING = 5
00553 };
00554
00555 ETeleportState getTeleportState() const { return mTeleportState; }
00556 void setTeleportState( ETeleportState state );
00557 const LLString& getTeleportMessage() const { return mTeleportMessage; }
00558 void setTeleportMessage(const LLString& message)
00559 {
00560 mTeleportMessage = message;
00561 }
00562
00563
00564 void fidget();
00565
00566 void requestEnterGodMode();
00567 void requestLeaveGodMode();
00568
00569 void sendAgentSetAppearance();
00570
00571 void sendAgentDataUpdateRequest();
00572
00573
00574 LLFollowCam mFollowCam;
00575
00576
00577
00578
00579
00580 BOOL getWearablesLoaded() const { return mWearablesLoaded; }
00581
00582 void setWearable( LLInventoryItem* new_item, LLWearable* wearable );
00583 static void onSetWearableDialog( S32 option, void* userdata );
00584 void setWearableFinal( LLInventoryItem* new_item, LLWearable* new_wearable );
00585 void setWearableOutfit( const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove );
00586 void queryWearableCache();
00587
00588 BOOL isWearableModifiable(EWearableType type);
00589 BOOL isWearableCopyable(EWearableType type);
00590 BOOL needsReplacement(EWearableType wearableType, S32 remove);
00591 U32 getWearablePermMask(EWearableType type);
00592
00593 LLInventoryItem* getWearableInventoryItem(EWearableType type);
00594
00595 LLWearable* getWearable( EWearableType type ) { return (type < WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL; }
00596 BOOL isWearingItem( const LLUUID& item_id );
00597 LLWearable* getWearableFromWearableItem( const LLUUID& item_id );
00598 const LLUUID& getWearableItem( EWearableType type ) { return (type < WT_COUNT) ? mWearableEntry[ type ].mItemID : LLUUID::null; }
00599
00600 static EWearableType getTEWearableType( S32 te );
00601 static LLUUID getDefaultTEImageID( S32 te );
00602
00603 void copyWearableToInventory( EWearableType type );
00604
00605 void makeNewOutfit(
00606 const std::string& new_folder_name,
00607 const LLDynamicArray<S32>& wearables_to_include,
00608 const LLDynamicArray<S32>& attachments_to_include,
00609 BOOL rename_clothing);
00610 void makeNewOutfitDone(S32 index);
00611
00612 void removeWearable( EWearableType type );
00613 static void onRemoveWearableDialog( S32 option, void* userdata );
00614 void removeWearableFinal( EWearableType type );
00615
00616 void sendAgentWearablesUpdate();
00617
00628 void addWearabletoAgentInventoryDone(
00629 S32 index,
00630 const LLUUID& item_id,
00631 LLWearable* wearable);
00632
00633 void saveWearableAs( EWearableType type, const std::string& new_name, BOOL save_in_lost_and_found );
00634 void saveWearable( EWearableType type, BOOL send_update = TRUE );
00635 void saveAllWearables();
00636
00637 void revertWearable( EWearableType type );
00638 void revertAllWearables();
00639
00640 void setWearableName( const LLUUID& item_id, const std::string& new_name );
00641 void createStandardWearables(BOOL female);
00642 void createStandardWearablesDone(S32 index);
00643 void createStandardWearablesAllDone();
00644
00645 BOOL areWearablesLoaded() { return mWearablesLoaded; }
00646
00647 void observeFriends();
00648 void friendsChanged();
00649
00650
00651 static void stopFidget();
00652 static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
00653 static void userRemoveWearable( void* userdata );
00654 static void userRemoveAllClothes( void* userdata );
00655 static void userRemoveAllClothesStep2(BOOL proceed, void* userdata );
00656 static void userRemoveAllAttachments( void* userdata);
00657 static BOOL selfHasWearable( void* userdata );
00658
00659
00660 static void clearVisualParams(void *);
00661
00662 protected:
00663
00664
00665 bool teleportCore(bool is_local = false);
00666
00667
00668 void ageChat();
00669
00670
00671 void sendAgentWearablesRequest();
00672 static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata);
00673 void recoverMissingWearable(EWearableType type);
00674 void recoverMissingWearableDone();
00675 void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
00676 LLWearable* wearable, const LLUUID& category_id = LLUUID::null,
00677 BOOL notify = TRUE);
00678 public:
00679
00680 U32 mViewerPort;
00681 LLUUID mSecureSessionID;
00682
00683 F32 mDrawDistance;
00684
00685 U64 mGroupPowers;
00686 BOOL mHideGroupTitle;
00687 char mGroupTitle[DB_GROUP_TITLE_BUF_SIZE];
00688 char mGroupName[DB_GROUP_NAME_BUF_SIZE];
00689 LLUUID mGroupID;
00690
00691 LLUUID mInventoryRootID;
00692 LLUUID mMapID;
00693 F64 mMapOriginX;
00694 F64 mMapOriginY;
00695 S32 mMapWidth;
00696 S32 mMapHeight;
00697 std::string mMOTD;
00698
00699 LLPointer<LLHUDEffectLookAt> mLookAt;
00700 LLPointer<LLHUDEffectPointAt> mPointAt;
00701
00702 LLDynamicArray<LLGroupData> mGroups;
00703
00704 BOOL mInitialized;
00705
00706 static BOOL sDebugDisplayTarget;
00707 S32 mNumPendingQueries;
00708 S32* mActiveCacheQueries;
00709
00710 BOOL mForceMouselook;
00711
00712 static void parseTeleportMessages(const LLString& xml_filename);
00713
00714
00715
00716 static std::map<LLString, LLString> sTeleportErrorMessages;
00717 static std::map<LLString, LLString> sTeleportProgressMessages;
00718
00719 private:
00720
00721 U8 mAccess;
00722 ETeleportState mTeleportState;
00723 LLString mTeleportMessage;
00724
00725 S32 mControlsTakenCount[TOTAL_CONTROLS];
00726 S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS];
00727
00728 LLViewerRegion *mRegionp;
00729 LLVector3d mAgentOriginGlobal;
00730 mutable LLVector3d mPositionGlobal;
00731
00732 std::set<U64> mRegionsVisited;
00733 F64 mDistanceTraveled;
00734 LLVector3d mLastPositionGlobal;
00735
00736 LLPointer<LLVOAvatar> mAvatarObject;
00737
00738 U8 mRenderState;
00739 LLFrameTimer mTypingTimer;
00740
00741 ECameraMode mCameraMode;
00742 ECameraMode mLastCameraMode;
00743 BOOL mViewsPushed;
00744
00745 BOOL mbAlwaysRun;
00746 BOOL mShowAvatar;
00747 BOOL mCameraAnimating;
00748 LLVector3d mAnimationCameraStartGlobal;
00749 LLVector3d mAnimationFocusStartGlobal;
00750 LLFrameTimer mAnimationTimer;
00751 F32 mAnimationDuration;
00752 F32 mCameraFOVZoomFactor;
00753 F32 mCameraCurrentFOVZoomFactor;
00754 F32 mCameraFOVDefault;
00755 LLVector3d mCameraFocusOffset;
00756 LLVector3d mCameraFocusOffsetTarget;
00757 LLVector3 mCameraOffsetDefault;
00758 LLVector4 mCameraCollidePlane;
00759 F32 mCurrentCameraDistance;
00760 F32 mTargetCameraDistance;
00761 F32 mCameraZoomFraction;
00762 LLVector3 mCameraLag;
00763 LLVector3 mThirdPersonHeadOffset;
00764 LLVector3 mCameraPositionAgent;
00765 LLVector3 mCameraVirtualPositionAgent;
00766 BOOL mSitCameraEnabled;
00767 LLVector3 mSitCameraPos;
00768 LLVector3 mSitCameraFocus;
00769
00770
00771 LLVector3 mCameraUpVector;
00772
00773
00774 LLPointer<LLViewerObject> mSitCameraReferenceObject;
00775
00776 BOOL mFocusOnAvatar;
00777 LLVector3d mFocusGlobal;
00778 LLVector3d mFocusTargetGlobal;
00779 LLPointer<LLViewerObject> mFocusObject;
00780 F32 mFocusObjectDist;
00781 LLVector3 mFocusObjectOffset;
00782 F32 mFocusDotRadius;
00783 BOOL mTrackFocusObject;
00784 F32 mUIOffset;
00785
00786 LLCoordFrame mFrameAgent;
00787
00788 BOOL mCrouching;
00789 BOOL mIsBusy;
00790
00791 S32 mAtKey;
00792 S32 mWalkKey;
00793 S32 mLeftKey;
00794 S32 mUpKey;
00795 F32 mYawKey;
00796 S32 mPitchKey;
00797
00798 F32 mOrbitLeftKey;
00799 F32 mOrbitRightKey;
00800 F32 mOrbitUpKey;
00801 F32 mOrbitDownKey;
00802 F32 mOrbitInKey;
00803 F32 mOrbitOutKey;
00804
00805 F32 mPanUpKey;
00806 F32 mPanDownKey;
00807 F32 mPanLeftKey;
00808 F32 mPanRightKey;
00809 F32 mPanInKey;
00810 F32 mPanOutKey;
00811
00812 U32 mControlFlags;
00813 BOOL mbFlagsDirty;
00814 BOOL mbFlagsNeedReset;
00815
00816 BOOL mbJump;
00817
00818 BOOL mAutoPilot;
00819 BOOL mAutoPilotFlyOnStop;
00820 LLVector3d mAutoPilotTargetGlobal;
00821 F32 mAutoPilotStopDistance;
00822 BOOL mAutoPilotUseRotation;
00823 LLVector3 mAutoPilotTargetFacing;
00824 F32 mAutoPilotTargetDist;
00825 S32 mAutoPilotNoProgressFrameCount;
00826 F32 mAutoPilotRotationThreshold;
00827 std::string mAutoPilotBehaviorName;
00828 void (*mAutoPilotFinishedCallback)(BOOL, void *);
00829 void* mAutoPilotCallbackData;
00830 LLUUID mLeaderID;
00831
00832 std::set<LLUUID> mProxyForAgents;
00833
00834 LLColor4 mEffectColor;
00835
00836 BOOL mHaveHomePosition;
00837 U64 mHomeRegionHandle;
00838 LLVector3 mHomePosRegion;
00839 LLFrameTimer mChatTimer;
00840 LLUUID mLastChatterID;
00841 F32 mNearChatRadius;
00842 BOOL mAdminOverride;
00843
00844
00845 U8 mGodLevel;
00846 LLFrameTimer mFidgetTimer;
00847 LLFrameTimer mFocusObjectFadeTimer;
00848 std::set<LLPointer <LLViewerObject> > mFadeObjects;
00849 F32 mNextFidgetTime;
00850 S32 mCurrentFidget;
00851 BOOL mFirstLogin;
00852 BOOL mGenderChosen;
00853
00854
00855
00856
00857 struct LLWearableEntry
00858 {
00859 LLWearableEntry() : mItemID( LLUUID::null ), mWearable( NULL ) {}
00860
00861 LLUUID mItemID;
00862 LLWearable* mWearable;
00863 };
00864 LLWearableEntry mWearableEntry[ WT_COUNT ];
00865 U32 mAgentWearablesUpdateSerialNum;
00866 BOOL mWearablesLoaded;
00867 S32 mTextureCacheQueryID;
00868 U32 mAppearanceSerialNum;
00869 LLAnimPauseRequest mPauseRequest;
00870
00871 class createStandardWearablesAllDoneCallback : public LLRefCount
00872 {
00873 protected:
00874 ~createStandardWearablesAllDoneCallback();
00875 };
00876 class sendAgentWearablesUpdateCallback : public LLRefCount
00877 {
00878 protected:
00879 ~sendAgentWearablesUpdateCallback();
00880 };
00881
00882 class addWearableToAgentInventoryCallback : public LLInventoryCallback
00883 {
00884 public:
00885 enum {
00886 CALL_NONE = 0,
00887 CALL_UPDATE = 1,
00888 CALL_RECOVERDONE = 2,
00889 CALL_CREATESTANDARDDONE = 4,
00890 CALL_MAKENEWOUTFITDONE = 8
00891 } EType;
00892
00903 addWearableToAgentInventoryCallback(
00904 LLPointer<LLRefCount> cb,
00905 S32 index,
00906 LLWearable* wearable,
00907 U32 todo = CALL_NONE);
00908 virtual void fire(const LLUUID& inv_item);
00909
00910 private:
00911 S32 mIndex;
00912 LLWearable* mWearable;
00913 U32 mTodo;
00914 LLPointer<LLRefCount> mCB;
00915 };
00916
00917
00918 class LLHideGroupTitleListener: public LLSimpleListener
00919 {
00920 public:
00921 bool handleEvent(LLPointer<LLEvent> event, const LLSD &userdata);
00922 };
00923
00924 class LLEffectColorListener: public LLSimpleListener
00925 {
00926 public:
00927 bool handleEvent(LLPointer<LLEvent> event, const LLSD &userdata);
00928 };
00929
00930 LLHideGroupTitleListener mHideGroupTitleListener;
00931 LLEffectColorListener mEffectColorListener;
00932 LLFriendObserver* mFriendObserver;
00933 };
00934
00935 extern LLAgent gAgent;
00936
00937 #endif