From 80a268baf68965c72f1c6c3a8ae139c21e8667eb Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Mon, 18 Mar 2013 23:15:36 -0700 Subject: [PATCH] Fixing couple of bugs in reader that was checked into different branch --- extensions/CCBReader/CCBAnimationManager.cpp | 7 ++++--- extensions/CCBReader/CCBAnimationManager.h | 2 +- extensions/CCBReader/CCBReader.cpp | 6 ++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index ea995ea37d..d7e31bfe04 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -575,14 +575,15 @@ CCObject* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* cha CCArray* keyVal = (CCArray *)keyframe->getValue(); std::string selectorName = ((CCString *)keyVal->objectAtIndex(0))->getCString(); - int selectorTarget = atoi(((CCString *)keyVal->objectAtIndex(0))->getCString()); + int selectorTarget = atoi(((CCString *)keyVal->objectAtIndex(1))->getCString()); if(jsControlled) { stringstream ss;//create a stringstream ss << selectorTarget;//add number to the stream std::string callbackName = ss.str() + ":" + selectorName; - CCCallFuncN *callback = (CCCallFuncN*)mKeyframeCallFuncs->objectForKey(callbackName.c_str()); + CCCallFunc *callback = (CCCallFunc*)mKeyframeCallFuncs->objectForKey(callbackName.c_str()); + callback->retain(); if(callback != NULL) { actions->addObject(callback); @@ -822,7 +823,7 @@ void CCBAnimationManager::setAnimationCompletedCallback(CCObject *target, SEL_Ca mAnimationCompleteCallbackFunc = callbackFunc; } -void CCBAnimationManager::setCallFunc(CCCallFuncN* callFunc, const std::string &callbackNamed) { +void CCBAnimationManager::setCallFunc(CCCallFunc* callFunc, const std::string &callbackNamed) { mKeyframeCallFuncs->setObject((CCObject*)callFunc, callbackNamed); } diff --git a/extensions/CCBReader/CCBAnimationManager.h b/extensions/CCBReader/CCBAnimationManager.h index ba7aaadb62..92621d33c7 100644 --- a/extensions/CCBReader/CCBAnimationManager.h +++ b/extensions/CCBReader/CCBAnimationManager.h @@ -110,7 +110,7 @@ public: void debug(); - void setCallFunc(CCCallFuncN *callFunc, const std::string &callbackNamed); + void setCallFunc(CCCallFunc *callFunc, const std::string &callbackNamed); CCObject* actionForCallbackChannel(CCBSequenceProperty* channel); CCObject* actionForSoundChannel(CCBSequenceProperty* channel); diff --git a/extensions/CCBReader/CCBReader.cpp b/extensions/CCBReader/CCBReader.cpp index b447621b2e..52a3e7bc7b 100644 --- a/extensions/CCBReader/CCBReader.cpp +++ b/extensions/CCBReader/CCBReader.cpp @@ -885,9 +885,7 @@ bool CCBReader::readSoundKeyframesForSeq(CCBSequence* seq) { float pitch = readFloat(); float pan = readFloat(); float gain = readFloat(); - - int callbackType = readInt(false); - + CCArray* value = CCArray::create(); value->addObject(CCString::create(soundFile)); @@ -911,7 +909,7 @@ bool CCBReader::readSoundKeyframesForSeq(CCBSequence* seq) { channel->getKeyframes()->addObject(keyframe); } - seq->setCallbackChannel(channel); + seq->setSoundChannel(channel); return true; }