当前位置: 首页>>代码示例>>C++>>正文


C++ CBlock::Write方法代码示例

本文整理汇总了C++中CBlock::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ CBlock::Write方法的具体用法?C++ CBlock::Write怎么用?C++ CBlock::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBlock的用法示例。


在下文中一共展示了CBlock::Write方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetVariable

int CInterpreter::GetVariable( int type )
{
	const char	*varName;
	variable_t	*var;
	CToken		*token;

	//Get the variable's name
	token = m_tokenizer->GetToken( 0, 0 );
	varName = token->GetStringValue();

	//See if we already have a variable by this name
	var = FindVar( varName );

	//Variable names must be unique on creation
	if ( var )
		return Error( "\"%s\" : already exists\n", varName );

	//Add the variable
	AddVar( varName, type );

	//Insert the variable into the stream

	CBlock	block;

	block.Create( TYPE_VARIABLE );
	block.Write( TK_FLOAT, (float) type );
	block.Write( TK_STRING, varName );

	m_blockStream->WriteBlock( &block );

	token->Delete();

	return true;
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:34,代码来源:Interpreter.cpp

示例2: GetLoop

int CInterpreter::GetLoop( void )
{
	CBlock			block;

	block.Create( ID_LOOP );

	if (!Match( TK_OPEN_PARENTHESIS ))
		return Error("syntax error : '(' not found");

	if ( LookAhead( TK_CLOSED_PARENTHESIS ) )
	{
		//-1 denotes an infinite loop
		block.Write( TK_FLOAT, (float) -1);
	}
	else
	{
		if ( GetInteger( &block ) == false )
			return false;
	}

	if (!Match( TK_CLOSED_PARENTHESIS ))
		return Error("GetLoop : too many parameters");

	m_blockStream->WriteBlock( &block );

	return true;
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:27,代码来源:Interpreter.cpp

示例3: GetAffect

int CInterpreter::GetAffect( void )
{
	CBlock			block;
	char			typeName[MAX_STRING_SIZE];
	int				type;

	block.Create( ID_AFFECT );

	if (!Match( TK_OPEN_PARENTHESIS ))
		return Error("syntax error : '(' not found");

	if ( GetString( &block ) == false )	
		return false;

	if (!LookAhead( TK_IDENTIFIER ))
		return Error("syntax error : identifier not found");

	if ( MatchGet() )
		return Error("syntax error : illegal use of \"get\"");

	if ( GetType( (char *) typeName ) == false )
		return false;

	type = FindSymbol( typeName, m_typeKeywords);

	switch ( type )
	{
	case TYPE_INSERT:
	case TYPE_FLUSH:
		
		block.Write( TK_FLOAT, (float) type );
		break;

	default:
		return Error("'%s': unknown affect type", typeName );
		break;

	}

	if (!Match( TK_CLOSED_PARENTHESIS ))
		return Error("affect : too many parameters");

	if (!LookAhead( TK_BLOCK_START ))
		return Error("syntax error : '{' not found");

	m_blockStream->WriteBlock( &block );

	return true;
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:49,代码来源:Interpreter.cpp

示例4: GetDeclare

int CInterpreter::GetDeclare( void )
{
	CBlock	block;
	char	typeName[MAX_STRING_LENGTH];
	int		type;

	block.Create( ID_DECLARE );

	if (!Match( TK_OPEN_PARENTHESIS ))
		return Error("syntax error : '(' not found");

	if ( GetType( (char *) typeName ) == false )
		return false;

	type = FindSymbol( typeName, m_typeKeywords);

	switch ( type )
	{
	case TK_FLOAT:
	case TK_VECTOR:
	case TK_STRING:
		block.Write( TK_FLOAT, (float) type );
		break;

	default:
		return Error("unknown identifier %s", typeName );
		break;
	}

	if ( GetString( &block ) == false )
		return false;

	if (!Match( TK_CLOSED_PARENTHESIS ))
		return Error("declare : too many parameters");

	m_blockStream->WriteBlock( &block );

	return true;
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:39,代码来源:Interpreter.cpp

示例5: GetCamera

int CInterpreter::GetCamera( void )
{
	CBlock	block;
	char	typeName[MAX_STRING_SIZE];
	int		type;

	block.Create( ID_CAMERA );

	if (!Match( TK_OPEN_PARENTHESIS ))
		return Error("syntax error : '(' not found");

	if ( GetType( (char *) typeName ) == false )
		return false;

	type = FindSymbol( typeName, m_typeKeywords);

	switch ( type )
	{
	case TYPE_PAN:		//PAN  ( ANGLES, DURATION )

		block.Write( TK_FLOAT, (float) type );

		if ( GetVector( &block ) == false )
			return false;

		if ( GetVector( &block ) == false )
			return false;

		if ( GetFloat( &block ) == false )
			return false;

		break;

	case TYPE_ZOOM:		//ZOOM ( FOV, DURATION )
		
		block.Write( TK_FLOAT, (float) type );

		if ( GetFloat( &block ) == false )
			return false;
		
		if ( GetFloat( &block ) == false )
			return false;

		break;
	
	case TYPE_MOVE:		//MOVE ( ORIGIN, DURATION )

		block.Write( TK_FLOAT, (float) type );

		if ( GetVector( &block ) == false )
			return false;

		if ( GetFloat( &block ) == false )
			return false;

		break;
	
	case TYPE_FADE:		//FADE ( SOURCE(R,G,B,A), DEST(R,G,B,A), DURATION )
		
		block.Write( TK_FLOAT, (float) type );

		//Source color
		if ( GetVector( &block ) == false )
			return false;
		if ( GetFloat( &block ) == false )
			return false;

		//Dest color
		if ( GetVector( &block ) == false )
			return false;
		if ( GetFloat( &block ) == false )
			return false;

		//Duration
		if ( GetFloat( &block ) == false )
			return false;

		break;

	case TYPE_PATH:		//PATH ( FILENAME )

		block.Write( TK_FLOAT, (float) type );

		//Filename
		if ( GetString( &block ) == false )
			return false;

		break;

	case TYPE_ENABLE:
	case TYPE_DISABLE:

		block.Write( TK_FLOAT, (float) type );
		break;

	case TYPE_SHAKE:	//SHAKE ( INTENSITY, DURATION )

		block.Write( TK_FLOAT, (float) type );

		//Intensity
//.........这里部分代码省略.........
开发者ID:Aura15,项目名称:OpenJK,代码行数:101,代码来源:Interpreter.cpp


注:本文中的CBlock::Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。