コード例 #1
0
bool CAnimateSpecificTexture::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
	char const* pszAnimateOnTexture = pKeyValues->GetString( "onlyAnimateOnTexture" );
	if( !pszAnimateOnTexture )
		return false;

	m_OnlyAnimateOnTexture.Set( pszAnimateOnTexture );

	return CBaseAnimatedTextureProxy::Init( pMaterial, pKeyValues );
}
コード例 #2
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CDmxEditApp::PrintHelp( bool bWiki /* = false */ )
{
	const CDmxEditLua::LuaFunc_s *pLuaFuncs = CDmxEditLua::GetFunctionList();

	if ( bWiki && pLuaFuncs )
	{
		lua_State *pLuaState = lua_open();
		if ( pLuaState )
		{
			luaL_openlibs( pLuaState );

			CUtlString wikiString;

			for ( int i = 0; i < CDmxEditLua::FunctionCount(); ++i )
			{
				if ( i != 0 )
				{
					Msg( "\n" );
				}
				Msg( ";%s( %s );\n", pLuaFuncs[ i ].m_pFuncName, pLuaFuncs[ i ].m_pFuncPrototype );
				Msg( ":%s\n", Wikize( pLuaState, pLuaFuncs[ i ].m_pFuncDesc ) );
			}

			return;
		}
	}

	Msg( "\n" );
	Msg( "NAME\n" );
	Msg( "    dmxedit - Edit dmx files\n" );
	Msg( "\n" );
	Msg( "SYNOPSIS\n" );
	Msg( "    dmxedit [ -h | -help ] [ -game <$game> ] [ -set $var=val ] [ script.lua ]\n" );
	Msg( "\n" );
	Msg( "    -h | -help :           Prints this information\n" );
	Msg( "    -g | -game <$game> :   Sets the VPROJECT environment variable to the specified game.\n" );
	Msg( "    -s | -set <$var=val> : Sets the lua variable var to the specified val before the script is run.\n" );
	Msg( "\n" );
	Msg( "DESCRIPTION\n" );
	Msg( "    Edits dmx files by executing a lua script of dmx editing functions\n" );
	Msg( "\n" );

	if ( !pLuaFuncs )
		return;

	Msg( "FUNCTIONS\n" );

	const char *pWhitespace = " \t";

	for ( int i = 0; i < CDmxEditLua::FunctionCount(); ++i )
	{
		Msg( "    %s( %s );\n", pLuaFuncs[ i ].m_pFuncName, pLuaFuncs[ i ].m_pFuncPrototype );
		Msg( "      * " );
		
		CUtlString tmpStr;

		const char *pWordBegin = pLuaFuncs[ i ].m_pFuncDesc + strspn( pLuaFuncs[ i ].m_pFuncDesc, pWhitespace );
		const char *pWhiteSpaceBegin = pWordBegin;
		const char *pWordEnd = pWordBegin + strcspn( pWordBegin, pWhitespace );

		bool bNewline = false;
		while ( *pWordBegin )
		{
			if ( pWordEnd - pWhiteSpaceBegin + tmpStr.Length() > 70 )
			{
				if ( bNewline )
				{
					Msg( "        " );
				}
				else
				{
					bNewline = true;
				}
				Msg( "%s\n", tmpStr );
				tmpStr.Set( "" );
			}

			if ( tmpStr.Length() )
			{
				tmpStr += CUtlString( pWhiteSpaceBegin, pWordEnd - pWhiteSpaceBegin + 1);
			}
			else
			{
				tmpStr += CUtlString( pWordBegin, pWordEnd - pWordBegin + 1 );
			}

			pWhiteSpaceBegin = pWordEnd;
			pWordBegin = pWhiteSpaceBegin + strspn( pWhiteSpaceBegin, pWhitespace );
			pWordEnd = pWordBegin + strcspn( pWordBegin, pWhitespace );
		}

		if ( tmpStr.Length() )
		{
			if ( bNewline )
			{
				Msg( "        " );
			}
			Msg( "%s\n", tmpStr );
		}
		Msg( "\n" );
	}

	Msg( "CREDITS\n" );
	Msg( "    Lua Copyright © 1994-2006 Lua.org, PUC-Rio.\n ");

	Msg( "\n" );
}