コード例 #1
0
//
// IF YOU ADD COLORS HERE, REMEMBER TO UPDATE THE RANGES
// FOR GEUTIL_IsValidColorHint() OR ELSE THEY WON'T BE APPLIED!
//
void insertDefaultColors()
{
	if (g_mColorList.Count() != 0)
		return;

	g_mColorList.Insert(L'a', Color(0xFF00FFFF)); //aqua
	g_mColorList.Insert(L'b', Color(0xFF000000)); //black
	g_mColorList.Insert(L'c', Color(0xFF0000FF)); //blue
	g_mColorList.Insert(L'd', Color(0xFFFF4500)); //OrangeRed
	g_mColorList.Insert(L'e', Color(0xFF808080)); //gray
	g_mColorList.Insert(L'f', Color(0xFFFF00FF)); //fuchsia
	g_mColorList.Insert(L'g', Color(0xFF008000)); //green
	g_mColorList.Insert(L'h', Color(0xFF00FF7F)); //SpringGreen
	g_mColorList.Insert(L'i', Color(0xFF87CEEB)); //SkyBlue
	g_mColorList.Insert(L'j', Color(0xFF696969)); //DimGray
	g_mColorList.Insert(L'k', Color(0xFF808000)); //olive
	g_mColorList.Insert(L'l', Color(0xFF00FF00)); //lime
	g_mColorList.Insert(L'm', Color(0xFF800000)); //maroon
	g_mColorList.Insert(L'n', Color(0xFF000080)); //navy
	g_mColorList.Insert(L'o', Color(0xFFFFA500)); //Orange
	g_mColorList.Insert(L'p', Color(0xFF800080)); //purple
	g_mColorList.Insert(L'q', Color(0xFF8B4513)); //SaddleBrown
	g_mColorList.Insert(L'r', Color(0xFFFF0000)); //red
	g_mColorList.Insert(L's', Color(0xFFC0C0C0)); //silver
	g_mColorList.Insert(L't', Color(0xFF008080)); //teal
	g_mColorList.Insert(L'u', Color(0xFF00FA9A)); //MediumSpringGreen
	g_mColorList.Insert(L'v', Color(0xFFD3D3D3)); //LightGrey
	g_mColorList.Insert(L'w', Color(0xFFFFFFFF)); //white
	g_mColorList.Insert(L'x', Color(0xFFFFFFE0)); //LightYellow
	g_mColorList.Insert(L'y', Color(0xFFFFFF00)); //yellow
	g_mColorList.Insert(L'z', Color(0xFFFF1493)); //DeepPink
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: this function will attempt to remap a key's value
// Input  : pszKey - the name of the key
//			pszInvalue - the original value
//			AllowNameRemapping - only do name remapping if this parameter is true.  
//				this is generally only false on the instance level.
// Output : returns true if the value changed
//			pszOutValue - the new value if changed
//-----------------------------------------------------------------------------
bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *pszOutValue, TNameFixup NameFixup )
{
	if ( RemapOperation.Count() == 0 )
	{
		RemapOperation.SetLessFunc( &CUtlType_LessThan );
		RemapOperation.Insert( ivAngle, REMAP_ANGLE );
		RemapOperation.Insert( ivTargetDest, REMAP_NAME );
		RemapOperation.Insert( ivTargetSrc, REMAP_NAME );
		RemapOperation.Insert( ivOrigin, REMAP_POSITION );
		RemapOperation.Insert( ivAxis, REMAP_ANGLE );
		RemapOperation.Insert( ivAngleNegativePitch, REMAP_ANGLE_NEGATIVE_PITCH );
	}

	if ( !m_InstanceClass )
	{
		return false;
	}

	GDinputvariable *KVVar = m_InstanceClass->VarForName( pszKey );
	if ( !KVVar )
	{
		return false;
	}

	GDIV_TYPE	KVType = KVVar->GetType();
	int			KVRemapIndex = RemapOperation.Find( KVType );
	if ( KVRemapIndex == RemapOperation.InvalidIndex() )
	{
		return false;
	}

	strcpy( pszOutValue, pszInValue );

	switch( RemapOperation[ KVRemapIndex ] )
	{
		case REMAP_NAME:
			if ( KVType != ivInstanceVariable )
			{
				RemapNameField( pszInValue, pszOutValue, NameFixup );
			}
			break;

		case REMAP_POSITION:
			{
				Vector	inPoint( 0.0f, 0.0f, 0.0f ), outPoint;

				sscanf ( pszInValue, "%f %f %f", &inPoint.x, &inPoint.y, &inPoint.z );
				VectorTransform( inPoint, m_InstanceMat, outPoint );
				sprintf( pszOutValue, "%g %g %g", outPoint.x, outPoint.y, outPoint.z );
			}
			break;
			
		case REMAP_ANGLE:
			if ( m_InstanceAngle.x != 0.0f || m_InstanceAngle.y != 0.0f || m_InstanceAngle.z != 0.0f )
			{
				QAngle		inAngles( 0.0f, 0.0f, 0.0f ), outAngles;
				matrix3x4_t angToWorld, localMatrix;

				sscanf ( pszInValue, "%f %f %f", &inAngles.x, &inAngles.y, &inAngles.z );

				AngleMatrix( inAngles, angToWorld );
				MatrixMultiply( m_InstanceMat, angToWorld, localMatrix );
				MatrixAngles( localMatrix, outAngles );

				sprintf( pszOutValue, "%g %g %g", outAngles.x, outAngles.y, outAngles.z );
			}
			break;

		case REMAP_ANGLE_NEGATIVE_PITCH:
			if ( m_InstanceAngle.x != 0.0f || m_InstanceAngle.y != 0.0f || m_InstanceAngle.z != 0.0f )
			{
				QAngle		inAngles( 0.0f, 0.0f, 0.0f ), outAngles;
				matrix3x4_t angToWorld, localMatrix;

				sscanf ( pszInValue, "%f", &inAngles.x );	// just the pitch
				inAngles.x = -inAngles.x;

				AngleMatrix( inAngles, angToWorld );
				MatrixMultiply( m_InstanceMat, angToWorld, localMatrix );
				MatrixAngles( localMatrix, outAngles );

				sprintf( pszOutValue, "%g", -outAngles.x );	// just the pitch
			}
			break;
	}

	return ( strcmpi( pszInValue, pszOutValue ) != 0 );
}