コード例 #1
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pobj - 
// Output : CMapClass
//-----------------------------------------------------------------------------
CMapClass *CMapWorld::CopyFrom(CMapClass *pobj, bool bUpdateDependencies)
{
	Assert(pobj->IsMapClass(MAPCLASS_TYPE(CMapWorld)));
	CMapWorld *pFrom = (CMapWorld *)pobj;
	
	CMapClass::CopyFrom(pobj, bUpdateDependencies);

	//
	// Copy our keys. If our targetname changed we must relink all targetname pointers.
	//
	const char *pszOldTargetName = CEditGameClass::GetKeyValue("targetname");
	char szOldTargetName[MAX_IO_NAME_LEN];
	if (pszOldTargetName != NULL)
	{
		strcpy(szOldTargetName, pszOldTargetName);
	}

	CEditGameClass::CopyFrom(pFrom);

	const char *pszNewTargetName = CEditGameClass::GetKeyValue("targetname");
	if ((bUpdateDependencies) && (pszNewTargetName != NULL))
	{
		if (stricmp(szOldTargetName, pszNewTargetName) != 0)
		{
			UpdateAllDependencies(this);
		}
	}

	return this;
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: Notifies that the entity this is attached to has had a key change
// Input  : key - 
//			value - 
//-----------------------------------------------------------------------------
void CMapAnimator::OnParentKeyChanged( LPCSTR key, LPCSTR value )
{
	if ( !stricmp(key, "TimeModifier") )
	{
		m_iTimeModifier = atoi( value );
	}
	else if ( !stricmp(key, "PositionInterpolator") )
	{
		m_iPositionInterpolator = atoi( value );

		// HACK: Force everything in the path to update. Better to follow our path and update only it.
		UpdateAllDependencies(this);
	}
	else if ( !stricmp(key, "RotationInterpolator") )
	{
		m_iRotationInterpolator = atoi( value );
	}

	m_nKeysChanged++;

	CMapKeyFrame::OnParentKeyChanged( key, value );
}