Ejemplo n.º 1
0
static void parse_SceneCondition(char **s, Game *g) {
	int num;

	getToken_Int(&num);
	assert(g->_sceneConditionsCount < Game::NUM_NEXT_SCENES);
	NextScene *ns = &g->_nextScenesTable[g->_sceneConditionsCount];
	ns->num = num;
	_currentTokenStr = stringNextToken(s);
	strcpy(ns->name, _currentTokenStr);
	stringToUpperCase(ns->name);
	++g->_sceneConditionsCount;
}
Ejemplo n.º 2
0
// -1 if no emotion triggered
int getEmotionIndex( const char *inSpeech ) {
    char *upperSpeech = stringToUpperCase( inSpeech );
    
    for( int i=0; i<emotions.size(); i++ ) {
        
        if( strstr( upperSpeech, emotions.getElement(i)->triggerWord ) ==
            upperSpeech ) {
            
            // starts with trigger
            delete [] upperSpeech;
            return i;
            }
        }
    
    delete [] upperSpeech;
    return -1;
    }
Ejemplo n.º 3
0
	OscillatorDSP::OscillatorType OscillatorDSP::getOscillatorType( const std::string& type ) const
	{
		static std::map< std::string, OscillatorType > oscillatorTypeMap;
		if( oscillatorTypeMap.empty() )
		{
			oscillatorTypeMap[ "SINE" ] = SINE;
			oscillatorTypeMap[ "SQUARE" ] = SQUARE;
			oscillatorTypeMap[ "SAWUP" ] = SAWUP;
			oscillatorTypeMap[ "SAWDOWN" ] = SAWDOWN;
			oscillatorTypeMap[ "TRIANGLE" ] = TRIANGLE;
			oscillatorTypeMap[ "NOISE" ] = NOISE;
		}

		std::string upperStrType = type;
		stringToUpperCase( upperStrType );
		auto iter = oscillatorTypeMap.find( upperStrType );
		if( iter != oscillatorTypeMap.end() )
			return iter->second;
		else
			return SINE;
	}
Ejemplo n.º 4
0
void initEmotion() {
    char *cont = SettingsManager::getSettingContents( "emotionWords", "" );
    
    if( strcmp( cont, "" ) == 0 ) {
        delete [] cont;
        return;    
        }

    int numParts;
    char **parts = split( cont, "\n", &numParts );
    delete [] cont;
    
    for( int i=0; i<numParts; i++ ) {
        if( strcmp( parts[i], "" ) != 0 ) {
            
            Emotion e = { stringToUpperCase( parts[i] ), 0, 0, 0 };

            emotions.push_back( e );
            }
        delete [] parts[i];
        }
    delete [] parts;


    // now read emotion objects

    cont = SettingsManager::getSettingContents( "emotionObjects", "" );
    
    if( strcmp( cont, "" ) == 0 ) {
        delete [] cont;
        return;    
        }

    parts = split( cont, "\n", &numParts );
    delete [] cont;
    
    for( int i=0; i<numParts; i++ ) {
        if( strcmp( parts[i], "" ) != 0 ) {
            
            Emotion *e;
            
            if( i < emotions.size() ) {
                e = emotions.getElement( i );
                }
            else {
                // the list extends beyond emotion words
                // put dummy trigger in place for these
                // * is a character that the end user cannot type
                Emotion eNew = { stringDuplicate( "DUMMY*TRIGGER" ), 0, 0, 0 };

                emotions.push_back( eNew );
                e = emotions.getElement( emotions.size() - 1 );
                }
            e->eyeEmot = 0;
            e->mouthEmot = 0;
            e->otherEmot = 0;
            e->faceEmot = 0;
            e->bodyEmot = 0;
            e->headEmot = 0;
            

            sscanf( parts[i], "%d %d %d %d %d %d", 
                    &( e->eyeEmot ), 
                    &( e->mouthEmot ), 
                    &( e->otherEmot ),
                    &( e->faceEmot ),
                    &( e->bodyEmot ),
                    &( e->headEmot ) );
            }
        delete [] parts[i];
        }
    delete [] parts;
    
    }