Exemple #1
0
void CPlayerR2CL::updateVisualPropertyVpc(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &prop)
{
	if(skeleton())
	{
		// Get the property.
		SPropVisualC visualC = *(SPropVisualC *)(&prop);

		// EYES
		_EyesColor = visualC.PropertySubData.EyesColor;
		UInstance inst;

		// must recreate the face asynchronously (because of color change / makeup change)
		inst= _Face.createLoadingFromCurrent();

		// if exist
		if (!inst.empty())
		{
			// change eyes color only
			applyColorSlot(_Face, _Face.ACSkin, _Face.ACUser, _Face.ACHair, visualC.PropertySubData.EyesColor);

			// Tattoo
			makeUp(inst, visualC.PropertySubData.Tattoo);

			// Morph
			static const char *baseName = "visage_00";
			float MTmin, MTmax;

			CGenderInfo *pGI = getGenderInfo();
			if (pGI == NULL)
				return;

			MTmin = pGI->BlendShapeMin[0];
			MTmax = pGI->BlendShapeMax[0];
			if (!ClientCfg.BlendShapePatched) { MTmin = 0.0f; MTmax = 100.0f; }
			inst.setBlendShapeFactor(baseName + toString(0), (float)(visualC.PropertySubData.MorphTarget1) / 7.f * (MTmax-MTmin) + MTmin, true);

			MTmin = pGI->BlendShapeMin[1];
			MTmax = pGI->BlendShapeMax[1];
			if (!ClientCfg.BlendShapePatched) { MTmin = 0.0f; MTmax = 100.0f; }
			inst.setBlendShapeFactor(baseName + toString(1), (float)(visualC.PropertySubData.MorphTarget2) / 7.f * (MTmax-MTmin) + MTmin, true);

			MTmin = pGI->BlendShapeMin[2];
			MTmax = pGI->BlendShapeMax[2];
			if (!ClientCfg.BlendShapePatched) { MTmin = 0.0f; MTmax = 100.0f; }
			inst.setBlendShapeFactor(baseName + toString(2), (float)(visualC.PropertySubData.MorphTarget3) / 7.f * (MTmax-MTmin) + MTmin, true);

			MTmin = pGI->BlendShapeMin[3];
			MTmax = pGI->BlendShapeMax[3];
			if (!ClientCfg.BlendShapePatched) { MTmin = 0.0f; MTmax = 100.0f; }
			inst.setBlendShapeFactor(baseName + toString(3), (float)(visualC.PropertySubData.MorphTarget4) / 7.f * (MTmax-MTmin) + MTmin, true);

			MTmin = pGI->BlendShapeMin[4];
			MTmax = pGI->BlendShapeMax[4];
			if (!ClientCfg.BlendShapePatched) { MTmin = 0.0f; MTmax = 100.0f; }
			inst.setBlendShapeFactor(baseName + toString(4), (float)(visualC.PropertySubData.MorphTarget5) / 7.f * (MTmax-MTmin) + MTmin, true);

			MTmin = pGI->BlendShapeMin[5];
			MTmax = pGI->BlendShapeMax[5];
			if (!ClientCfg.BlendShapePatched) { MTmin = 0.0f; MTmax = 100.0f; }
			inst.setBlendShapeFactor(baseName + toString(5), (float)(visualC.PropertySubData.MorphTarget6) / 7.f * (MTmax-MTmin) + MTmin, true);

			MTmin = pGI->BlendShapeMin[6];
			MTmax = pGI->BlendShapeMax[6];
			if (!ClientCfg.BlendShapePatched) { MTmin = 0.0f; MTmax = 100.0f; }
			inst.setBlendShapeFactor(baseName + toString(6), (float)(visualC.PropertySubData.MorphTarget7) / 7.f * (MTmax-MTmin) + MTmin, true);

			MTmin = pGI->BlendShapeMin[7];
			MTmax = pGI->BlendShapeMax[7];
			if (!ClientCfg.BlendShapePatched) { MTmin = 0.0f; MTmax = 100.0f; }
			inst.setBlendShapeFactor(baseName + toString(7), (float)(visualC.PropertySubData.MorphTarget8) / 7.f * (MTmax-MTmin) + MTmin, true);
		}

		// Set the Gabarit
		float characterHeight	= (float)((sint8)(visualC.PropertySubData.CharacterHeight)-7)/7.f;
		float torsoWidth		= (float)((sint8)(visualC.PropertySubData.TorsoWidth)-7)/7.f;
		float armsWidth			= (float)((sint8)(visualC.PropertySubData.ArmsWidth)-7)/7.f;
		float legsWidth			= (float)((sint8)(visualC.PropertySubData.LegsWidth)-7)/7.f;
		float breastSize		= (float)((sint8)(visualC.PropertySubData.BreastSize)-7)/7.f;
		float heightScale, baseHeightScale;
		//	TODO : manage breast size
		GabaritSet.applyGabarit(*skeleton(), _Gender, people(), characterHeight, torsoWidth, armsWidth, legsWidth, breastSize, &heightScale);
		baseHeightScale = GabaritSet.getRefHeightScale(_Gender, people());

		if(baseHeightScale != 0.f)
			_CustomScalePos = heightScale/baseHeightScale;
		else
		{
			_CustomScalePos = 1.f;
			nlwarning("PL::updateVPVpc:'%d': baseHeight == 0.", _Slot);
		}
	}
	else
		nlinfo("PL:updateVPVpc:'%d': Prop Vpc received before prop Vpa.", _Slot);
}// updateVisualPropertyVpc //