aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r--linden/indra/newview/llvoavatar.cpp258
1 files changed, 255 insertions, 3 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index 7e1c6ca..f1e45e5 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -83,6 +83,8 @@
83#include "llvoiceclient.h" 83#include "llvoiceclient.h"
84#include "llvoicevisualizer.h" // Ventrella 84#include "llvoicevisualizer.h" // Ventrella
85 85
86#include "llsdserialize.h" // client resolver
87
86#if LL_WINDOWS 88#if LL_WINDOWS
87 // Disable warning for unreachable code in boost/lexical_cast.hpp for Boost 1.36 -- McCabe 89 // Disable warning for unreachable code in boost/lexical_cast.hpp for Boost 1.36 -- McCabe
88 #pragma warning(disable : 4702) 90 #pragma warning(disable : 4702)
@@ -678,6 +680,7 @@ S32 LLVOAvatar::sScratchTexBytes = 0;
678F32 LLVOAvatar::sRenderDistance = 256.f; 680F32 LLVOAvatar::sRenderDistance = 256.f;
679S32 LLVOAvatar::sNumVisibleAvatars = 0; 681S32 LLVOAvatar::sNumVisibleAvatars = 0;
680S32 LLVOAvatar::sNumLODChangesThisFrame = 0; 682S32 LLVOAvatar::sNumLODChangesThisFrame = 0;
683LLSD LLVOAvatar::sClientResolutionList;
681 684
682const LLUUID LLVOAvatar::sStepSoundOnLand = LLUUID("e8af4a28-aa83-4310-a7c4-c047e15ea0df"); 685const LLUUID LLVOAvatar::sStepSoundOnLand = LLUUID("e8af4a28-aa83-4310-a7c4-c047e15ea0df");
683const LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] = 686const LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] =
@@ -1402,6 +1405,9 @@ void LLVOAvatar::initClass()
1402 llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; 1405 llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
1403 } 1406 }
1404 1407
1408 {
1409 loadClientTags();
1410 }
1405} 1411}
1406 1412
1407 1413
@@ -2971,6 +2977,235 @@ void LLVOAvatar::idleUpdateWindEffect()
2971 } 2977 }
2972 } 2978 }
2973} 2979}
2980bool LLVOAvatar::updateClientTags()
2981{
2982 std::string client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "client_list.xml");
2983//Imprudence FIXME: provide own ressource
2984 LLSD response = LLHTTPClient::blockingGet("http://www.imprudenceviewer.org/app/client_list/client_list.xml");
2985 if(response.has("body"))
2986 {
2987 const LLSD &client_list = response["body"];
2988
2989 if(client_list.has("isComplete"))
2990 {
2991 llofstream export_file;
2992 export_file.open(client_list_filename);
2993 LLSDSerialize::toPrettyXML(client_list, export_file);
2994 export_file.close();
2995 return true;
2996 }
2997 }
2998 return false;
2999}
3000
3001bool LLVOAvatar::loadClientTags()
3002{
3003 std::string client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "client_list.xml");
3004
3005 if(!LLFile::isfile(client_list_filename))
3006 {
3007 client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "client_list.xml");
3008 }
3009
3010 if(LLFile::isfile(client_list_filename))
3011 {
3012 LLSD client_list;
3013
3014 llifstream importer(client_list_filename);
3015 LLSDSerialize::fromXMLDocument(client_list, importer);
3016 if(client_list.has("isComplete"))
3017 {
3018 sClientResolutionList = client_list;
3019 }else
3020 {
3021 return false;
3022 }
3023 }else
3024 {
3025 return false;
3026 }
3027
3028 for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
3029 iter != LLCharacter::sInstances.end(); ++iter)
3030 {
3031 LLVOAvatar* avatarp = (LLVOAvatar*) *iter;
3032 if(avatarp)
3033 {
3034 LLVector3 root_pos_last = avatarp->mRoot.getWorldPosition();
3035 avatarp->idleUpdateNameTag(root_pos_last);
3036 }
3037 }
3038 return true;
3039}
3040
3041void LLVOAvatar::resolveClient(LLColor4& avatar_name_color, std::string& client, LLVOAvatar* avatar)
3042{
3043 LLUUID idx = avatar->getTE(0)->getID();
3044 if(LLVOAvatar::sClientResolutionList.has("isComplete")
3045 && LLVOAvatar::sClientResolutionList.has(idx.asString()))
3046 {
3047 LLSD cllsd = LLVOAvatar::sClientResolutionList[idx.asString()];
3048 client = cllsd["name"].asString();
3049 LLColor4 colour;
3050 colour.setValue(cllsd["color"]);
3051 avatar_name_color += colour;
3052 avatar_name_color *= 1.0/(cllsd["multiple"].asReal()+1.0f);
3053 }
3054 else
3055 {
3056
3057 if(idx == LLUUID("cc7a030f-282f-c165-44d2-b5ee572e72bf"))
3058 {
3059 avatar_name_color += LLColor4(0.6f,0.8f,1.0f);//Imprudence
3060 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3061 client = "Imprudence";
3062
3063 } else if(idx == LLUUID("2a9a406c-f448-68f2-4e38-878f8c46c190"))
3064 {
3065 avatar_name_color += LLColor4(1.0f,0.9f,0.7f);//Meerkat
3066 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3067 client = "Meerkat";
3068 }else if(idx == LLUUID("ccda2b3b-e72c-a112-e126-fee238b67218"))
3069 {
3070 avatar_name_color += LLColor4::green;//emerald
3071 avatar_name_color += LLColor4::green;
3072 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3073 client = "Emerald";
3074 }else if(idx == LLUUID("c252d89d-6f7c-7d90-f430-d140d2e3fbbe"))
3075 {
3076 avatar_name_color += LLColor4::red;//vlife jcool410
3077 avatar_name_color = avatar_name_color * 0.5;
3078 client = "VLife";
3079 }else if(idx == LLUUID("adcbe893-7643-fd12-f61c-0b39717e2e32"))
3080 {
3081 avatar_name_color += LLColor4::pink;//tyk3n
3082 avatar_name_color = avatar_name_color * 0.5;
3083 client = "tyk3n";
3084 }else if(idx == LLUUID("f3fd74a6-fee7-4b2f-93ae-ddcb5991da04") || idx == LLUUID("77662f23-c77a-9b4d-5558-26b757b2144c"))
3085 {
3086 avatar_name_color += (LLColor4::purple);//psl
3087 avatar_name_color = avatar_name_color * 0.5;
3088 client = "PSL";
3089 }else if(idx == LLUUID("5aa5c70d-d787-571b-0495-4fc1bdef1500"))
3090 {
3091 avatar_name_color += LLColor4::red;//lordgreg
3092 avatar_name_color += LLColor4::red;
3093 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3094 client = "LGG proxy";
3095 }else if(idx == LLUUID("8183e823-c443-2142-6eb6-2ab763d4f81c"))
3096 {
3097 avatar_name_color += LLColor4::blue;//day oh
3098 avatar_name_color = avatar_name_color * 0.5;
3099 client = "Day Oh proxy";
3100 }else if(idx == LLUUID("e52d21f7-3c8b-819f-a3db-65c432295dac") || idx == LLUUID("0f6723d2-5b23-6b58-08ab-308112b33786"))
3101 {
3102 avatar_name_color += LLColor4::cyan;//cryolife
3103 avatar_name_color += LLColor4::cyan;
3104 avatar_name_color = avatar_name_color * 0.5;
3105 client = "CryoLife";
3106 }else if(idx == LLUUID("0bcd5f5d-a4ce-9ea4-f9e8-15132653b3d8"))
3107 {
3108 avatar_name_color += LLColor4::pink;//moy
3109 avatar_name_color += LLColor4::pink;//moy
3110 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3111 client = "MoyMix";
3112 }else if(idx == LLUUID("f5a48821-9a98-d09e-8d6a-50cc08ba9a47"))
3113 {
3114 avatar_name_color += LLColor4::yellow;//neil
3115 avatar_name_color += LLColor4::yellow;//neil
3116 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3117 client = "NeilLife";
3118 }else if(idx == LLUUID("2c9c1e0b-e5d1-263e-16b1-7fc6d169f3d6"))
3119 {
3120 avatar_name_color += LLColor4(0.0f,1.0f,1.0f);
3121 avatar_name_color = avatar_name_color * 0.5;//phox
3122 client = "PhoxSL";
3123 }else if(idx == LLUUID("c5b570ca-bb7e-3c81-afd1-f62646b20014") || idx == LLUUID("7c4d47a3-0c51-04d1-fa47-e4f3ac12f59b"))
3124 {
3125 avatar_name_color += LLColor4::white;
3126 avatar_name_color += LLColor4::white;
3127 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3128 client = "Kung Fu";
3129 }else if(idx == LLUUID("9422e9d7-7b11-83e4-6262-4a8db4716a3b"))
3130 {
3131 avatar_name_color += LLColor4::magenta;
3132 avatar_name_color += LLColor4::magenta;
3133 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3134 client = "BetaLife";
3135 }
3136/*
3137 else if(idx == LLUUID("872c0005-3095-0967-866d-11cd71115c22"))
3138 {
3139 avatar_name_color += LLColor4::green;//SimFed Poland
3140 avatar_name_color += LLColor4::blue;//SimFed Poland
3141 avatar_name_color += LLColor4::blue;//SimFed Poland
3142 avatar_name_color = avatar_name_color * 0.5;
3143 client = "<-- Fag"; //Imprudence FIXME: Cigarette? Homophobic? My lack of humor?
3144 }
3145*/
3146 else if(idx == LLUUID("3ab7e2fa-9572-ef36-1a30-d855dbea4f92") || //wat
3147 idx == LLUUID("11ad2452-ce54-8d65-7c23-05589b59f516") ||//wat.
3148 idx == LLUUID("e734563e-1c31-2a35-3ed5-8552c807439f") ||//wat.
3149 idx == LLUUID("58a8b7ec-1455-7162-5d96-d3c3ead2ed71") ||//wat
3150 idx == LLUUID("841ef25b-3b90-caf9-ea3d-5649e755db65")//wat -.-
3151 )
3152 {
3153 avatar_name_color += LLColor4(0.0f,0.5f,1.0f);
3154 avatar_name_color = avatar_name_color * 0.5;
3155 client = "VerticalLife";
3156
3157
3158 }else if(idx == LLUUID("4e8dcf80-336b-b1d8-ef3e-08dacf015a0f"))
3159 {
3160 avatar_name_color += LLColor4::blue; //Sapphire
3161 avatar_name_color += LLColor4::blue; //Sapphire
3162 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3163 client = "Sapphire";
3164 }else if(idx == LLUUID("ffce04ff-5303-4909-a044-d37af7ab0b0e"))
3165 {
3166 avatar_name_color += LLColor4::orange; //corgiVision
3167 avatar_name_color = avatar_name_color * (F32)0.75;
3168 client = "Corgi";
3169 }else if(idx == LLUUID("ccb509cf-cc69-e569-38f1-5086c687afd1"))
3170 {
3171 avatar_name_color += LLColor4::red; //Ruby
3172 avatar_name_color += LLColor4::purple; //Ruby
3173 avatar_name_color = avatar_name_color * (F32)0.333333333333;
3174 client = "Ruby";
3175 }else if(idx == LLUUID("1c29480c-c608-df87-28bb-964fb64c5366"))
3176 {
3177 avatar_name_color += LLColor4::yellow9;
3178 avatar_name_color += LLColor4::yellow9;
3179 avatar_name_color *= (F32)0.333333333333;
3180 client = "Gemini";
3181 }
3182 }
3183 if(client.empty())
3184 {
3185 LLPointer<LLViewerImage> image_point = gImageList.getImage(idx, MIPMAP_YES, IMMEDIATE_NO);
3186 if(image_point.notNull() && image_point->isMissingAsset())
3187 {
3188 avatar_name_color += LLColor4::grey;//anomalous
3189 avatar_name_color = avatar_name_color * 0.5;
3190 client = "Invalid";
3191 }
3192 }
3193 if(avatar->getTE(5)->getID() != avatar->getTE(6)->getID() && !client.empty())
3194 {
3195 client = "Failure";
3196 avatar_name_color = LLColor4::grey;
3197 }
3198 if(client.empty() && LLVOAvatar::sClientResolutionList.has("default"))
3199 {
3200 LLSD cllsd = LLVOAvatar::sClientResolutionList["default"];
3201 client = cllsd["name"].asString();
3202 LLColor4 colour;
3203 colour.setValue(cllsd["color"]);
3204 avatar_name_color += colour;
3205 avatar_name_color *= 1.0/(cllsd["multiple"].asReal()+1.0f);
3206 }
3207
3208}
2974 3209
2975void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) 3210void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
2976{ 3211{
@@ -3032,7 +3267,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3032 mRenderGroupTitles = sRenderGroupTitles; 3267 mRenderGroupTitles = sRenderGroupTitles;
3033 new_name = TRUE; 3268 new_name = TRUE;
3034 } 3269 }
3035 3270 std::string client;
3036 // First Calculate Alpha 3271 // First Calculate Alpha
3037 // If alpha > 0, create mNameText if necessary, otherwise delete it 3272 // If alpha > 0, create mNameText if necessary, otherwise delete it
3038 { 3273 {
@@ -3073,6 +3308,11 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3073 } 3308 }
3074 3309
3075 LLColor4 avatar_name_color = gColors.getColor( "AvatarNameColor" ); 3310 LLColor4 avatar_name_color = gColors.getColor( "AvatarNameColor" );
3311 if(!mIsSelf) //don't know your own client ?
3312 {
3313 new_name = TRUE; //lol or see the last client used
3314 resolveClient(avatar_name_color,client, this);
3315 }
3076 avatar_name_color.setAlpha(alpha); 3316 avatar_name_color.setAlpha(alpha);
3077 mNameText->setColor(avatar_name_color); 3317 mNameText->setColor(avatar_name_color);
3078 3318
@@ -3129,7 +3369,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3129 (!title && !mTitle.empty()) || 3369 (!title && !mTitle.empty()) ||
3130 (title && mTitle != title->getString()) || 3370 (title && mTitle != title->getString()) ||
3131 (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) 3371 (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute)
3132 || is_appearance != mNameAppearance) 3372 || is_appearance != mNameAppearance || client.length() != 0)
3133 { 3373 {
3134 std::string line; 3374 std::string line;
3135 3375
@@ -3158,7 +3398,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3158 3398
3159 BOOL need_comma = FALSE; 3399 BOOL need_comma = FALSE;
3160 3400
3161 if (is_away || is_muted || is_busy) 3401 bool show_client = client.length() != 0 && gSavedSettings.getBOOL("ShowClientNameTag");
3402 if (is_away || is_muted || is_busy || show_client)
3162 { 3403 {
3163 line += " ("; 3404 line += " (";
3164 if (is_away) 3405 if (is_away)
@@ -3184,6 +3425,15 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3184 line += "Muted"; 3425 line += "Muted";
3185 need_comma = TRUE; 3426 need_comma = TRUE;
3186 } 3427 }
3428 if (show_client)
3429 {
3430 if (need_comma)
3431 {
3432 line += ", ";
3433 }
3434 line += client;
3435 need_comma = TRUE;
3436 }
3187 line += ")"; 3437 line += ")";
3188 } 3438 }
3189 if (is_appearance) 3439 if (is_appearance)
@@ -7438,6 +7688,8 @@ void LLVOAvatar::releaseUnnecessaryTextures()
7438 { 7688 {
7439 const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); 7689 const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
7440 // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID 7690 // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID
7691 if(baked_index == BAKED_HEAD)//for client detection
7692 continue;
7441 if (!isTextureDefined(bakedDicEntry->mTextureIndex) 7693 if (!isTextureDefined(bakedDicEntry->mTextureIndex)
7442 && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) )) 7694 && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ))
7443 { 7695 {