Ejemplo n.º 1
0
void CServerRemoteAccess::GetPlayerList(CUtlBuffer &value)
{
	for (int i = 0; i < g_psvs.maxclients; ++i)
	{
		client_t* cli = &g_psvs.clients[i];
		if (!cli->active || Q_strlen(cli->name) < 1)
			continue;

		value.Printf("\"%s\" %s %s %d %d %d %d\n", cli->name, SV_GetIDString(&cli->network_userid), NET_AdrToString(cli->netchan.remote_address),
			int(cli->latency * 1000.0), (int)cli->packet_loss, (int)cli->edict->v.frags, int(realtime - cli->netchan.connect_time));

	}

	value.PutChar(0);
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
// Color attribute
//-----------------------------------------------------------------------------
bool Serialize( CUtlBuffer &buf, const Color &src )
{
	if ( buf.IsText() )
	{
		buf.Printf( "%d %d %d %d", src[0], src[1], src[2], src[3] );
	}
	else
	{
		buf.PutUnsignedChar( src[0] );
		buf.PutUnsignedChar( src[1] );
		buf.PutUnsignedChar( src[2] );
		buf.PutUnsignedChar( src[3] );
	}
	return buf.IsValid();
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// Writes out a new actbusy file
//-----------------------------------------------------------------------------
bool CImportActBusy::Serialize( CUtlBuffer &buf, CDmElement *pRoot )
{
	SerializeHeader( buf );
 	buf.Printf( "\"ActBusy.txt\"\n" );
	buf.Printf( "{\n" );

	CDmAttribute *pChildren = pRoot->GetAttribute( "children" );
	if ( !pChildren || pChildren->GetType() != AT_ELEMENT_ARRAY )
		return NULL;

	CDmrElementArray<> children( pChildren );
	int nCount = children.Count();

	buf.PushTab();
	for ( int i = 0; i < nCount; ++i )
	{
		CDmElement *pChild = children[i];
 		buf.Printf( "\"%s\"\n", pChild->GetName() );
		buf.Printf( "{\n" );

		buf.PushTab();
		PrintStringAttribute( pChild, buf, "busy_anim", true );
		PrintStringAttribute( pChild, buf, "entry_anim", true );
		PrintStringAttribute( pChild, buf, "exit_anim", true );
		PrintStringAttribute( pChild, buf, "busy_sequence", true );
		PrintStringAttribute( pChild, buf, "entry_sequence", true );
		PrintStringAttribute( pChild, buf, "exit_sequence", true );
		PrintFloatAttribute( pChild, buf, "min_time" );
		PrintFloatAttribute( pChild, buf, "max_time" );
		PrintStringAttribute( pChild, buf, "interrupts" );
		buf.PopTab();

		buf.Printf( "}\n" );
	}
	buf.PopTab();

	buf.Printf( "}\n" );

	return true;
}
Ejemplo n.º 4
0
void CSentence::SaveToBuffer( CUtlBuffer& buf )
{
#if PHONEME_EDITOR
	Assert( !m_bIsCached );

	int i, j;

	buf.Printf( "VERSION 1.0\n" );

	buf.Printf( "PLAINTEXT\n" );
	buf.Printf( "{\n" );
	buf.Printf( "%s\n", GetText() );
	buf.Printf( "}\n" );
	buf.Printf( "WORDS\n" );
	buf.Printf( "{\n" );
	for ( i = 0; i < m_Words.Size(); i++ )
	{
		CWordTag *word = m_Words[ i ];
		Assert( word );

		buf.Printf( "WORD %s %.3f %.3f\n", 
			word->GetWord(),
			word->m_flStartTime,
			word->m_flEndTime );

		buf.Printf( "{\n" );
		for ( j = 0; j < word->m_Phonemes.Size(); j++ )
		{
			CPhonemeTag *phoneme = word->m_Phonemes[ j ];
			Assert( phoneme );

			buf.Printf( "%i %s %.3f %.3f 1\n", 
				phoneme->GetPhonemeCode(), 
				phoneme->GetTag(),
				phoneme->GetStartTime(),
				phoneme->GetEndTime() );
		}

		buf.Printf( "}\n" );
	}
	buf.Printf( "}\n" );
	buf.Printf( "EMPHASIS\n" );
	buf.Printf( "{\n" );
	int c = m_EmphasisSamples.Count();
	for ( i = 0; i < c; i++ )
	{
		CEmphasisSample *sample = &m_EmphasisSamples[ i ];
		Assert( sample );

		buf.Printf( "%f %f\n", sample->time, sample->value );
	}

	buf.Printf( "}\n" );
	buf.Printf( "OPTIONS\n" );
	buf.Printf( "{\n" );
	buf.Printf( "voice_duck %d\n", GetVoiceDuck() ? 1 : 0 );
	if ( m_bStoreCheckSum )
	{
		buf.Printf( "checksum %d\n", m_uCheckSum );
	}
	buf.Printf( "}\n" );
#else
	Assert( 0 );
#endif
}
Ejemplo n.º 5
0
//-----------------------------------------------------------------------------
// Writes out the actbusy header
//-----------------------------------------------------------------------------
void CImportActBusy::SerializeHeader( CUtlBuffer &buf )
{
	buf.Printf( "// \"act busy name\"\t\tThis is the name that a mapmaker must specify in the hint node.\n" );
	buf.Printf( "// {\n" ); 
	buf.Printf( "// \t\"busy_anim\"\t\t\t\"Activity Name\".\n" );
	buf.Printf( "// \t\"entry_anim\"\t\t\"Activity Name\"\n" );
	buf.Printf( "// \t\"exit_anim\"\t\t\t\"Activity Name\"\n" );
	buf.Printf( "// \t\"busy_sequence\"\t\t\"Sequence Name\". If specified, this is used over the activity name. Specify it in the hint node.\n" );
	buf.Printf( "// \t\"entry_sequence\"\t\"Sequence Name\". If specified, this is used over the entry anim.\n" );
	buf.Printf( "// \t\"exit_sequence\"\t\t\"Sequence Name\". If specified, this is used over the exit anim.\n" );
	buf.Printf( "// \t\"min_time\"\t\t\t\"Minimum time to spend in this busy anim\"\n" );
	buf.Printf( "// \t\"max_time\"\t\t\t\"Maximum time to spend in this busy anim\"	0 = only stop when interrupted by external event\n" );
	buf.Printf( "// \t\"interrupts\"\t\tOne of:\n" );
	buf.Printf( "// \t\t\t\t\t\t\"BA_INT_NONE\"\t\tbreak out only when time runs out. No external influence will break me out.\n" );
	buf.Printf( "// \t\t\t\t\t\t\"BA_INT_DANGER\"\t\tbreak out of this anim only if threatened\n" );
	buf.Printf( "// \t\t\t\t\t\t\"BA_INT_PLAYER\"\t\tbreak out of this anim if I can see the player, or I'm threatened\n" );
	buf.Printf( "// \t\t\t\t\t\t\"BA_INT_AMBUSH\"\t\tsomeone please define this - I have no idea what it does\n" );
	buf.Printf( "// \t\t\t\t\t\t\"BA_INT_COMBAT\"\t\tbreak out of this anim if combat occurs in my line of sight (bullet hits, grenades, etc), -OR- the max time is reached\n" );
	buf.Printf( "// }\n" );
	buf.Printf( "//\n" );
}
Ejemplo n.º 6
0
void CSentence::SaveToBuffer( CUtlBuffer& buf )
{
	int i, j;

	buf.Printf( "VERSION 1.0\n" );
	buf.Printf( "PLAINTEXT\n" );
	buf.Printf( "{\n" );
	buf.Printf( "%s\n", GetText() );
	buf.Printf( "}\n" );
	buf.Printf( "WORDS\n" );
	buf.Printf( "{\n" );
	for ( i = 0; i < m_Words.Size(); i++ )
	{
		CWordTag *word = m_Words[ i ];
		Assert( word );

		buf.Printf( "WORD %s %.3f %.3f\n", 
			word->m_pszWord[ 0 ] ? word->m_pszWord : "???",
			word->m_flStartTime,
			word->m_flEndTime );

		buf.Printf( "{\n" );
		for ( j = 0; j < word->m_Phonemes.Size(); j++ )
		{
			CPhonemeTag *phoneme = word->m_Phonemes[ j ];
			Assert( phoneme );

			buf.Printf( "%i %s %.3f %.3f %.3f\n", 
				phoneme->m_nPhonemeCode, 
				phoneme->m_szPhoneme[ 0 ] ? phoneme->m_szPhoneme : "???",
				phoneme->m_flStartTime,
				phoneme->m_flEndTime,
				phoneme->m_flVolume );
		}

		buf.Printf( "}\n" );
	}
	buf.Printf( "}\n" );
	buf.Printf( "EMPHASIS\n" );
	buf.Printf( "{\n" );
	int c = m_EmphasisSamples.Count();
	for ( i = 0; i < c; i++ )
	{
		CEmphasisSample *sample = &m_EmphasisSamples[ i ];
		Assert( sample );

		buf.Printf( "%f %f\n", sample->time, sample->value );
	}

	buf.Printf( "}\n" );
	buf.Printf( "CLOSECAPTION\n" );
	buf.Printf( "{\n" );

	for ( int l = 0; l < CC_NUM_LANGUAGES; l++ )
	{
		int count = GetCloseCaptionPhraseCount( l );
		if ( count == 0 && l == CC_ENGLISH )
		{
			SetCloseCaptionFromText( l );
			count = GetCloseCaptionPhraseCount( l );
		}

		if ( count <= 0 )
			continue;

		buf.Printf( "%s\n", CCloseCaptionPhrase::NameForLanguage( l ) );
		buf.Printf( "{\n" );

		for ( int j = 0 ; j < count; j++ )
		{
			CCloseCaptionPhrase *phrase = GetCloseCaptionPhrase( l, j );
			Assert( phrase );

			int len = wcslen( phrase->GetStream() );
			len <<= 1; // double because it's a wchar_t

			buf.Printf( "PHRASE unicode %i ", len );
			buf.Put( phrase->GetStream(), len );
			buf.Printf( " %.3f %.3f\n",
				phrase->GetStartTime(),
				phrase->GetEndTime() );
		}

		buf.Printf( "}\n" );
	}
	buf.Printf( "}\n" );

	buf.Printf( "OPTIONS\n" );
	buf.Printf( "{\n" );
	buf.Printf( "voice_duck %d\n", GetVoiceDuck() ? 1 : 0 );
	buf.Printf( "}\n" );
}