Exemple #1
0
void CObjectList::Draw(UINT id)
{
	CObject* pObject = NULL;

	pObject = FindObjectByID(id);
	if(pObject)
	{
		pObject->Draw();
	}
}
/*
========================
idSnapShot::ApplyToExistingState
Take uncompressed state in msg and add it to existing state
========================
*/
void idSnapShot::ApplyToExistingState( int objId, idBitMsg& msg )
{
	objectState_t* 	objectState = FindObjectByID( objId );
	if( !verify( objectState != NULL ) )
	{
		return;
	}
	
	if( !objectState->createdFromTemplate )
	{
		// We were created this from a template, so we shouldn't be applying it again
		if( net_ssTemplateDebug.GetBool() )
		{
			idLib::Printf( "NOT ApplyToExistingState[%d] because object was created from existing base state. %d\n", objId, objectState->expectedSequence );
			objectState->Print( "SS STATE" );
		}
		return;
	}
	
	// Debug print the template (spawn) and delta state
	if( net_ssTemplateDebug.GetBool() )
	{
		idLib::Printf( "\nApplyToExistingState[%d]. buffer size: %d msg size: %d\n", objId, objectState->buffer.Size(), msg.GetSize() );
		objectState->Print( "DELTA STATE" );
		
		PrintAlign( "SPAWN STATE" );
		for( int i = 0; i < msg.GetSize(); i++ )
		{
			if( InDebugRange( i ) )
			{
				idLib::Printf( "%02X", msg.GetReadData()[i] );
			}
		}
		idLib::Printf( "\n" );
	}
	
	// Actually apply it
	for( objectSize_t i = 0; i < Min( objectState->buffer.Size(), msg.GetSize() ); i++ )
	{
		objectState->buffer[i] += msg.GetReadData()[i];
	}
	
	// Debug print the final state
	if( net_ssTemplateDebug.GetBool() )
	{
		objectState->Print( "NEW STATE" );
		idLib::Printf( "\n" );
	}
}