// this is the exact same code as in VImageStates::Build
bool VTextStates::Build(VWindowBase *pOwner, TiXmlElement *pNode, const char *szPath, 
                        bool bWrite, const VTextStates *pDefaults)
{
  if (!pNode)
    return false;

  // if defaults are defined, init the states with it
  if (pDefaults)
    (*this) = (*pDefaults);

  // first, get the normal state from this node
  m_States[VWindowBase::NORMAL].Build(pOwner,pNode,szPath,bWrite);

  // assign defaults from normal state
  if (!pDefaults)
  {
    for (int i=0;i<VWindowBase::STATE_COUNT;i++)
      if (i!=VWindowBase::NORMAL)
        m_States[i] = m_States[VWindowBase::NORMAL];
  }

  // then assign the values in the "statemodifier" subnodes
  for (TiXmlElement *pStateNode=pNode->FirstChildElement("statemodifier"); pStateNode; 
    pStateNode=pStateNode->NextSiblingElement("statemodifier") )
  {
    const char *szState = XMLHelper::Exchange_String(pStateNode,"state",NULL,bWrite);
    VWindowBase::ControlState_e eState = VWindowBase::GetState(szState);
    m_States[eState].Build(pOwner,pStateNode,szPath,bWrite);
  }

  // any empty strings left? then use the normal state
  FinishSetup();
  return true;
}
示例#2
0
/*
=====================
idActor::Spawn
=====================
*/
void idActor::Spawn( void ) {
	idEntity		*ent;
	idStr			jointName;
	float			fovDegrees;
	copyJoints_t	copyJoint;

	animPrefix	= "";


	spawnArgs.GetInt( "rank", "0", rank );
	spawnArgs.GetInt( "team", "0", team );
	spawnArgs.GetVector( "offsetModel", "0 0 0", modelOffset );

	spawnArgs.GetBool( "use_combat_bbox", "0", use_combat_bbox );	

	viewAxis = GetPhysics()->GetAxis();

	spawnArgs.GetFloat( "fov", "90", fovDegrees );
	SetFOV( fovDegrees );


	pain_debounce_time	= 0;

	pain_delay		= SEC2MS( spawnArgs.GetFloat( "pain_delay" ) );
	pain_threshold	= spawnArgs.GetInt( "pain_threshold" );

	LoadAF();

	walkIK.Init( this, IK_ANIM, modelOffset );
	reachIK.Init( this, IK_ANIM, modelOffset );

	// the animation used to be set to the IK_ANIM at this point, but that was fixed, resulting in
	// attachments not binding correctly, so we're stuck setting the IK_ANIM before attaching things.
	animator.ClearAllAnims( gameLocal.time, 0 );
	animator.SetFrame( ANIMCHANNEL_ALL, animator.GetAnim( IK_ANIM ), 0, 0, 0 );

	// spawn any attachments we might have
	//const idKeyValue *kv = spawnArgs.MatchPrefix( "def_attach", NULL );
	//while ( kv ) {
	//	idDict args;

	//	args.Set( "classname", kv->GetValue().c_str() );

	//	// make items non-touchable so the player can't take them out of the character's hands
	//	args.Set( "no_touch", "1" );

	//	// don't let them drop to the floor
	//	args.Set( "dropToFloor", "0" );

	//	//gameLocal.SpawnEntityDef( args, &ent );
	//	if ( !ent ) {
	//		gameLocal.Error( "Couldn't spawn '%s' to attach to entity '%s'", kv->GetValue().c_str(), name.c_str() );
	//	} else {
	//		Attach( ent );
	//	}
	//	kv = spawnArgs.MatchPrefix( "def_attach", kv );
	//}

	SetupDamageGroups();
	//SetupHead();

	// clear the bind anim
	animator.ClearAllAnims( gameLocal.time, 0 );

	finalBoss = spawnArgs.GetBool( "finalBoss" );

	FinishSetup();

	idRenderModelMD5* pModel = (idRenderModelMD5*)renderEntity.hModel;
	idMD5Mesh* mesh;
	int i;
	for( mesh = pModel->meshes.Ptr(), i = 0; i < pModel->meshes.Num(); i++, mesh++ ) {
		const idMaterial *shader = mesh->shader;

		/*shader = R_RemapShaderBySkin( shader, renderEntity.customSkin, renderEntity.customShader );		
		if ( !shader || ( !shader->IsDrawn() && !shader->SurfaceCastsShadow() ) ) {
			continue;
		}*/
	}

	// Test
	BecomeActive( TH_THINK | TH_PHYSICS );
}