From ab31c3f82d1e5dece3f9a66f6ad51244cf04fffb Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Tue, 6 Aug 2013 11:59:58 -0700 Subject: [PATCH] Rave glove: Fix initialization issues and activate mode switch. Note that this change will have no effect until the Avatar Mixer gets it, because the mixer will continue to send "glove mode 0" until it receives this update. --- interface/src/avatar/Hand.cpp | 6 +++++- libraries/avatars/src/HandData.cpp | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index e445f89472..43b7bfc2e3 100755 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -54,7 +54,7 @@ void Hand::reset() { void Hand::simulate(float deltaTime, bool isMine) { if (_isRaveGloveActive) { - if (_raveGloveEffectsModeChanged) { + if (_raveGloveEffectsModeChanged && _raveGloveInitialized) { activateNewRaveGloveMode(); _raveGloveEffectsModeChanged = false; } @@ -363,6 +363,10 @@ void Hand::updateRaveGloveParticles(float deltaTime) { // The rave glove mode has changed, so activate the effects. void Hand::activateNewRaveGloveMode() { + if (!_raveGloveInitialized) { + return; + } + int mode = _raveGloveEffectsMode; _raveGloveParticleSystem.killAllParticles(); diff --git a/libraries/avatars/src/HandData.cpp b/libraries/avatars/src/HandData.cpp index b60b423627..2f6e8aa560 100644 --- a/libraries/avatars/src/HandData.cpp +++ b/libraries/avatars/src/HandData.cpp @@ -161,8 +161,9 @@ int HandData::decodeRemoteData(unsigned char* sourceBuffer) { } setRaveGloveActive((gloveFlags & GLOVE_FLAG_RAVE) != 0); -// Jeffrey: uncomment this to test locally, before unrolling it to the team. -// setRaveGloveMode(effectsMode); + if (numHands > 0) { + setRaveGloveMode(effectsMode); + } // One byte for error checking safety. unsigned char requiredLength = (unsigned char)(sourceBuffer - startPosition);