Example #1
0
AHalfLifeDecoder::AHalfLifeDecoder(const char *fname) : AMeshDecoder(fname)
{
  init();
  openFile(fname);
  readHeader();
  if(numbones) readBones();
  if(numbonecontrollers) readBoneControllers();
  if(numhitboxes) readHitBoxes();
  if(numseq) readSeqs();
  if(numseqgroups) readSeqGroups();
  if(numtextures) readTextures();
  if(numskinref*numskinfamilies) readSkins();
  if(numbodyparts) readBodyParts();
  if(numattachments) readAttachments();
  if(soundtable) readSounds();
  if(soundgroups) readSoundGroups();
  if(numtransitions) readTransitions();
}
void XMLModelDefinitionSerializer::readActions(ModelDefinitionPtr modelDef, TiXmlElement* mAnimNode)
{
	TiXmlElement* elem;
	const char* tmp = 0;
	bool notfound = true;
	S_LOG_VERBOSE( "Read Actions" );

	for (TiXmlElement* animElem = mAnimNode->FirstChildElement();
            animElem != 0; animElem = animElem->NextSiblingElement())
	{
		notfound=false;

		tmp =  animElem->Attribute("name");
		if (tmp) {
			ActionDefinition* actionDef = modelDef->createActionDefinition(tmp);
			S_LOG_VERBOSE( " Add action  : "<< tmp  );

			tmp =  animElem->Attribute("speed");
			if (tmp) {
				actionDef->setAnimationSpeed(Ogre::StringConverter::parseReal(tmp));
			}


			elem = animElem->FirstChildElement("animations");
			if (elem)
				readAnimations(elem, actionDef);

			elem = animElem->FirstChildElement("sounds");
			if (elem)
				readSounds(elem, actionDef);

			elem = animElem->FirstChildElement("activations");
			if (elem)
				readActivations(elem, actionDef);
		}

	}

	if(notfound)
	{
		S_LOG_VERBOSE( "No actions found." );
	}

}