Fixing couple of bugs in reader that was checked into different branch

This commit is contained in:
Rohan Kuruvilla 2013-03-18 23:15:36 -07:00
parent aa022b532d
commit 80a268baf6
3 changed files with 7 additions and 8 deletions

View File

@ -575,14 +575,15 @@ CCObject* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* cha
CCArray* keyVal = (CCArray *)keyframe->getValue(); CCArray* keyVal = (CCArray *)keyframe->getValue();
std::string selectorName = ((CCString *)keyVal->objectAtIndex(0))->getCString(); 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) { if(jsControlled) {
stringstream ss;//create a stringstream stringstream ss;//create a stringstream
ss << selectorTarget;//add number to the stream ss << selectorTarget;//add number to the stream
std::string callbackName = ss.str() + ":" + selectorName; 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) { if(callback != NULL) {
actions->addObject(callback); actions->addObject(callback);
@ -822,7 +823,7 @@ void CCBAnimationManager::setAnimationCompletedCallback(CCObject *target, SEL_Ca
mAnimationCompleteCallbackFunc = callbackFunc; 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); mKeyframeCallFuncs->setObject((CCObject*)callFunc, callbackNamed);
} }

View File

@ -110,7 +110,7 @@ public:
void debug(); void debug();
void setCallFunc(CCCallFuncN *callFunc, const std::string &callbackNamed); void setCallFunc(CCCallFunc *callFunc, const std::string &callbackNamed);
CCObject* actionForCallbackChannel(CCBSequenceProperty* channel); CCObject* actionForCallbackChannel(CCBSequenceProperty* channel);
CCObject* actionForSoundChannel(CCBSequenceProperty* channel); CCObject* actionForSoundChannel(CCBSequenceProperty* channel);

View File

@ -885,9 +885,7 @@ bool CCBReader::readSoundKeyframesForSeq(CCBSequence* seq) {
float pitch = readFloat(); float pitch = readFloat();
float pan = readFloat(); float pan = readFloat();
float gain = readFloat(); float gain = readFloat();
int callbackType = readInt(false);
CCArray* value = CCArray::create(); CCArray* value = CCArray::create();
value->addObject(CCString::create(soundFile)); value->addObject(CCString::create(soundFile));
@ -911,7 +909,7 @@ bool CCBReader::readSoundKeyframesForSeq(CCBSequence* seq) {
channel->getKeyframes()->addObject(keyframe); channel->getKeyframes()->addObject(keyframe);
} }
seq->setCallbackChannel(channel); seq->setSoundChannel(channel);
return true; return true;
} }