Пример #1
0
void CEntityClassRegistry::LoadClasses( const char *sRootPath,bool bOnlyNewClasses )
{
	ICryPak *pCryPak = gEnv->pCryPak;
	_finddata_t fd;
	char filename[_MAX_PATH];

	string sPath = sRootPath;
	sPath.TrimRight("/\\");
	string sSearch = sPath + "/*.ent";
	intptr_t handle = pCryPak->FindFirst( sSearch, &fd, 0);
	if (handle != -1)
	{
		int res = 0;
		do
		{
			// Animation file found, load it.
			cry_strcpy(filename,sPath);
			cry_strcat(filename,"/");
			cry_strcat(filename,fd.name);

			// Load xml file.
			XmlNodeRef root = m_pSystem->LoadXmlFromFile(filename);
			if (root)
			{
				LoadClassDescription(root,bOnlyNewClasses);
			}

			res = pCryPak->FindNext( handle,&fd );
		} while (res >= 0);
		pCryPak->FindClose(handle);
	}
}
Пример #2
0
	virtual void GetConfiguration( SFlowNodeConfig &config )
	{
#ifndef _RELEASE
		static char pPresetsHelp[1024] = "";

		if (pPresetsHelp[0] == 0)
		{
			cry_strcpy(pPresetsHelp, "Preset input values. When this is used, all parameter inputs are ignored.\n" );
			for (int i = 0; i < NUM_PRESETS; i++)
			{
				char buf[300];
				cry_sprintf(buf, "-- %s : Angle: (%4.3f,%4.3f,%4.3f)  Shift: (%4.3f,%4.3f,%4.3f )  Freq: %3.1f  Random: %3.1f  Distance: %3.1f  RangeMin: %3.1f RangeMax: %3.1f sustainDuration: %3.1f FadeInDur: %3.1f  FadeOutDur: %3.1f \n",
				            m_Presets[i].pName, m_Presets[i].angle.x, m_Presets[i].angle.y, m_Presets[i].angle.z, m_Presets[i].shift.x, m_Presets[i].shift.y, m_Presets[i].shift.z, m_Presets[i].frequency,
				            m_Presets[i].randomness, m_Presets[i].distance, m_Presets[i].rangeMin, m_Presets[i].rangeMax, m_Presets[i].sustainDuration, m_Presets[i].fadeInDuration, m_Presets[i].fadeOutDuration );

				cry_strcat(pPresetsHelp, buf);
			}
		}

		static char pPresetsEnumDef[100] = "";
		if (pPresetsEnumDef[0] == 0)
		{
			cry_strcpy(pPresetsEnumDef, "enum_int:NoPreset=0," );
			for (int i = 0; i < NUM_PRESETS; i++)
			{
				char buf[100];
				cry_sprintf(buf, "%s=%1d,", m_Presets[i].pName, i + 1 );
				cry_strcat(pPresetsEnumDef, buf);
			}
		}
#endif

		static const SInputPortConfig in_config[] = {
			InputPortConfig_Void  ( "Trigger", _HELP("Trigger to start shaking")),
			InputPortConfig<int>  ( "Restrict", ER_None, _HELP("Restriction"), 0, _UICONFIG("enum_int:None=0,NoVehicle=1,InVehicle=2")),
			InputPortConfig<int>  ( "View", VT_FirstPerson, _HELP("Which view to use. FirstPerson or Current (might be Trackview)."), 0, _UICONFIG("enum_int:FirstPerson=0,Current=1")),
			InputPortConfig<bool> ( "GroundOnly", false, _HELP("Apply shake only when the player is standing on the ground")),
			InputPortConfig<bool> ( "Smooth", false, _HELP("Smooth shakes avoid sudden direction changes.")),
			InputPortConfig<Vec3> ( "Angle", Vec3(0.7f, 0.7f, 0.7f), _HELP("Shake Angles")),
			InputPortConfig<Vec3> ( "Shift", Vec3(0.01f, 0.01f, 0.01f), _HELP("Shake shifting")),
			InputPortConfig<float>( "Frequency", 12.0f, _HELP("Frequency. Can be changed dynamically."), 0, _UICONFIG("v_min=0,v_max=100")),
			InputPortConfig<float>( "Randomness", 1.f, _HELP("Randomness")),
			InputPortConfig<float>( "Distance", 0.0f, _HELP("Distance to effect source. If an entity is asociated to the node, distance from that entity to the current camera will be used instead")),
			InputPortConfig<float>( "RangeMin", 0.0f, _HELP("Maximum strength effect range")),
			InputPortConfig<float>( "RangeMax", 30.0f, _HELP("Effect range")),
			InputPortConfig<float>( "SustainDuration", 0.f, _HELP("duration of the non fading part of the shake. (total duration is fadein + this + fadeout ). -1 = permanent")),
			InputPortConfig<float>( "FadeInDuration", 0.f, _HELP("Fade in time (seconds)")),
			InputPortConfig<float>( "FadeOutDuration", 3.f, _HELP("Fade out time (seconds)")),
			InputPortConfig_Void  ( "Stop", _HELP("Stop the shaking (will fade out)")),
#ifdef _RELEASE
			InputPortConfig<int>  ( "Preset", 0, _HELP("Preset input values. When this is used, all parameter inputs are ignored.")),
#else
			InputPortConfig<int>  ( "Preset", 0, pPresetsHelp, 0, _UICONFIG(pPresetsEnumDef)),
#endif
			{0}
		};
		config.nFlags      |= EFLN_TARGET_ENTITY;
		config.sDescription = _HELP("Camera View Shake node. If an entity is provided, its position will be used for the distance calculations instead of the raw 'distance' input.");
		config.pInputPorts  = in_config;
		config.pOutputPorts = 0;
		config.SetCategory(EFLN_APPROVED);
	}