diff options
author | Armin Weatherwax | 2010-07-29 16:13:19 +0200 |
---|---|---|
committer | Jacek Antonelli | 2010-08-01 15:59:32 -0500 |
commit | 08c29aea25645dbfe76a04de9e703f49cf7ada85 (patch) | |
tree | 2fbcee3903b06c4f957eef845ffc9d013253d872 /linden/indra/newview/llhudeffectlookat.cpp | |
parent | revamp a) privatelookattarget + b) privatepointattarget (diff) | |
download | meta-impy-08c29aea25645dbfe76a04de9e703f49cf7ada85.zip meta-impy-08c29aea25645dbfe76a04de9e703f49cf7ada85.tar.gz meta-impy-08c29aea25645dbfe76a04de9e703f49cf7ada85.tar.bz2 meta-impy-08c29aea25645dbfe76a04de9e703f49cf7ada85.tar.xz |
some more HUDEffect revamp
Diffstat (limited to 'linden/indra/newview/llhudeffectlookat.cpp')
-rw-r--r-- | linden/indra/newview/llhudeffectlookat.cpp | 75 |
1 files changed, 46 insertions, 29 deletions
diff --git a/linden/indra/newview/llhudeffectlookat.cpp b/linden/indra/newview/llhudeffectlookat.cpp index 1c24e7d..a997910 100644 --- a/linden/indra/newview/llhudeffectlookat.cpp +++ b/linden/indra/newview/llhudeffectlookat.cpp | |||
@@ -269,48 +269,65 @@ LLHUDEffectLookAt::~LLHUDEffectLookAt() | |||
269 | //----------------------------------------------------------------------------- | 269 | //----------------------------------------------------------------------------- |
270 | void LLHUDEffectLookAt::packData(LLMessageSystem *mesgsys) | 270 | void LLHUDEffectLookAt::packData(LLMessageSystem *mesgsys) |
271 | { | 271 | { |
272 | // Pack the default data | ||
273 | LLHUDEffect::packData(mesgsys); | ||
274 | |||
275 | // Pack the type-specific data. Uses a fun packed binary format. Whee! | ||
276 | U8 packed_data[PKT_SIZE]; | ||
277 | memset(packed_data, 0, PKT_SIZE); | ||
278 | |||
279 | if (mSourceObject) | ||
280 | { | ||
281 | htonmemcpy(&(packed_data[SOURCE_AVATAR]), mSourceObject->mID.mData, MVT_LLUUID, 16); | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | htonmemcpy(&(packed_data[SOURCE_AVATAR]), LLUUID::null.mData, MVT_LLUUID, 16); | ||
286 | } | ||
287 | |||
288 | // pack both target object and position | 272 | // pack both target object and position |
289 | // position interpreted as offset if target object is non-null | 273 | // position interpreted as offset if target object is non-null |
290 | ELookAtType target_type = mTargetType; | 274 | ELookAtType target_type = mTargetType; |
291 | LLVector3d target_offset_global = mTargetOffsetGlobal; | 275 | LLVector3d target_offset_global = mTargetOffsetGlobal; |
292 | LLViewerObject* target_object = (LLViewerObject*)mTargetObject; | 276 | LLViewerObject* target_object = (LLViewerObject*)mTargetObject; |
293 | 277 | ||
278 | |||
294 | LLViewerObject* source_object = (LLViewerObject*)mSourceObject; | 279 | LLViewerObject* source_object = (LLViewerObject*)mSourceObject; |
295 | LLVOAvatar* source_avatar = NULL; | 280 | LLVOAvatar* source_avatar = NULL; |
296 | 281 | ||
297 | if (source_object && source_object->isAvatar()) //strange enough that non-avatar objects try to send a lookat message | 282 | if (!source_object) |
283 | { | ||
284 | markDead(); | ||
285 | return; | ||
286 | } | ||
287 | if (source_object->isAvatar()) //strange enough that non-objects try | ||
288 | //to send a lookat message ... | ||
298 | { | 289 | { |
299 | source_avatar = (LLVOAvatar*)source_object; | 290 | source_avatar = (LLVOAvatar*)source_object; |
300 | } | 291 | } |
292 | else //... more strange if its an non-avatar object ... | ||
293 | { | ||
294 | LL_DEBUGS("HUDEffect")<<"Non-Avatar HUDEffectLookAt message for ID: " << source_object->getID().asString()<< LL_ENDL; | ||
295 | markDead(); | ||
296 | return; | ||
297 | } | ||
301 | 298 | ||
302 | if (source_avatar) | 299 | |
300 | bool is_self = source_avatar->isSelf(); | ||
301 | bool is_private = gSavedSettings.getBOOL("PrivateLookAtTarget"); | ||
302 | if (!is_self) //... very strange if it is not self. But happens. Also at local opensim. | ||
303 | { | 303 | { |
304 | bool is_self = source_avatar->isSelf(); //more strange if it is not self. | 304 | LL_DEBUGS("HUDEffect")<< "Non-self Avatar HUDEffectLookAt message for ID: " << source_avatar->getID().asString() << LL_ENDL; |
305 | bool is_private = gSavedSettings.getBOOL("PrivateLookAtTarget"); | 305 | markDead(); |
306 | 306 | return; | |
307 | if (is_private && is_self) | 307 | } |
308 | { | 308 | else if (is_private && target_type != LOOKAT_TARGET_AUTO_LISTEN) |
309 | //this mimicks "do nothing" | 309 | { |
310 | target_type = LOOKAT_TARGET_AUTO_LISTEN; | 310 | //this mimicks "do nothing" |
311 | target_offset_global.setVec(2.5, 0.0, 0.0); | 311 | target_type = LOOKAT_TARGET_AUTO_LISTEN; |
312 | target_object = mSourceObject; | 312 | target_offset_global.setVec(2.5, 0.0, 0.0); |
313 | } | 313 | target_object = mSourceObject; |
314 | } | ||
315 | |||
316 | |||
317 | // Pack the default data | ||
318 | LLHUDEffect::packData(mesgsys); | ||
319 | |||
320 | // Pack the type-specific data. Uses a fun packed binary format. Whee! | ||
321 | U8 packed_data[PKT_SIZE]; | ||
322 | memset(packed_data, 0, PKT_SIZE); | ||
323 | |||
324 | if (mSourceObject) | ||
325 | { | ||
326 | htonmemcpy(&(packed_data[SOURCE_AVATAR]), mSourceObject->mID.mData, MVT_LLUUID, 16); | ||
327 | } | ||
328 | else //um ... we already returned ... how's that the case? | ||
329 | { | ||
330 | htonmemcpy(&(packed_data[SOURCE_AVATAR]), LLUUID::null.mData, MVT_LLUUID, 16); | ||
314 | } | 331 | } |
315 | 332 | ||
316 | if (mTargetObject) | 333 | if (mTargetObject) |
@@ -396,7 +413,7 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) | |||
396 | htonmemcpy(&lookAtTypeUnpacked, &(packed_data[LOOKAT_TYPE]), MVT_U8, 1); | 413 | htonmemcpy(&lookAtTypeUnpacked, &(packed_data[LOOKAT_TYPE]), MVT_U8, 1); |
397 | if (lookAtTypeUnpacked > 10) | 414 | if (lookAtTypeUnpacked > 10) |
398 | { | 415 | { |
399 | LL_DEBUGS("LookAt")<< "wrong lookAtTypeUnpacked: " << lookAtTypeUnpacked << LL_ENDL; | 416 | LL_DEBUGS("HUDEffect")<< "wrong lookAtTypeUnpacked: " << lookAtTypeUnpacked << LL_ENDL; |
400 | lookAtTypeUnpacked = 0; | 417 | lookAtTypeUnpacked = 0; |
401 | } | 418 | } |
402 | 419 | ||