//-----------------------------------------------------------------------------
// Purpose: Receive hud update message from server
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
// Output : int
//-----------------------------------------------------------------------------
int CTechnologyTreeDoc::MsgFunc_Technology(bf_read &msg)
{
	int index;
	int available;
	int voters;
	float resourcelevel;
	bool preferred;

	// Which tech
	index		= msg.ReadByte();
	// Available to this team?
	available	= msg.ReadByte();
	// # of players indicating this as their preferred tech for new spending
	voters		= msg.ReadByte();

	preferred = ( voters & 0x80 ) ? true : false;
	voters &= 0x7f;

	resourcelevel = (float)msg.ReadShort();
	
	// Look it up by index
	CBaseTechnology *item = m_pTree->GetTechnology( index );
	if ( item )
	{	
		bool wasactive = item->GetActive();

		bool justactivated = !wasactive && available;

		// Set data elements
		item->SetActive( available ? true : false );
		item->SetVoters( voters );
		item->SetResourceLevel( resourcelevel );

		// If this is the tech I am voting for, clear my vote
		if ( preferred )
		{
			// Sets the flag on the item, too
			m_pTree->SetPreferredTechnology( item );
		}
		else
		{
			// Force deselection in case there is no active preference on the server any more
			item->SetPreferred( false );
		}

		if ( justactivated && item->GetLevel() > 0 && !item->GetHintsGiven( TF_HINT_NEWTECHNOLOGY ) )
		{
			// So we only give this hint once this game, even if we respawn, etc.
			item->SetHintsGiven( TF_HINT_NEWTECHNOLOGY, true );
			// Note, only show a max of three or 4 newtechnology hints at a time
			CreateGlobalHint( TF_HINT_NEWTECHNOLOGY, item->GetPrintName(), index, 3 );
		}

		// hogsy start - this might be temporary, just keep it here for now.
		CCommanderStatusPanel::StatusPanel()->SetTechnology(item);
		// hogsy end
	}
	
	return 1;
}
예제 #2
0
void CBaseHudChat::MsgFunc_VoiceSubtitle( bf_read &msg )
{
	// Got message during connection
	if ( !g_PR )
		return;

	if ( !cl_showtextmsg.GetInt() )
		return;

	char szString[2048];
	char szPrefix[64];	//(Voice)
	wchar_t szBuf[128];

	int client = msg.ReadByte();
	int iMenu = msg.ReadByte();
	int iItem = msg.ReadByte();

	const char *pszSubtitle = "";

	CGameRules *pGameRules = GameRules();

	CMultiplayRules *pMultiRules = dynamic_cast< CMultiplayRules * >( pGameRules );

	Assert( pMultiRules );

	if ( pMultiRules )
	{
		pszSubtitle = pMultiRules->GetVoiceCommandSubtitle( iMenu, iItem );
	}

	SetVoiceSubtitleState( true );

	const wchar_t *pBuf = g_pVGuiLocalize->Find( pszSubtitle );
	if ( pBuf )
	{
		// Copy pBuf into szBuf[i].
		int nMaxChars = sizeof( szBuf ) / sizeof( wchar_t );
		wcsncpy( szBuf, pBuf, nMaxChars );
		szBuf[nMaxChars-1] = 0;
	}
	else
	{
		g_pVGuiLocalize->ConvertANSIToUnicode( pszSubtitle, szBuf, sizeof(szBuf) );
	}

	int len;
	g_pVGuiLocalize->ConvertUnicodeToANSI( szBuf, szString, sizeof(szString) );
	len = strlen( szString );
	if ( len && szString[len-1] != '\n' && szString[len-1] != '\r' )
	{
		Q_strncat( szString, "\n", sizeof(szString), 1 );
	}

	const wchar_t *pVoicePrefix = g_pVGuiLocalize->Find( "#Voice" );
	g_pVGuiLocalize->ConvertUnicodeToANSI( pVoicePrefix, szPrefix, sizeof(szPrefix) );
	
	ChatPrintf( client, CHAT_FILTER_NONE, "%c(%s) %s%c: %s", COLOR_PLAYERNAME, szPrefix, GetDisplayedSubtitlePlayerName( client ), COLOR_NORMAL, ConvertCRtoNL( szString ) );

	SetVoiceSubtitleState( false );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHudHealth::MsgFunc_Damage( bf_read &msg )
{

	int armor = msg.ReadByte();	// armor
	int damageTaken = msg.ReadByte();	// health
	long bitsDamage = msg.ReadLong(); // damage bits
	bitsDamage; // variable still sent but not used

	Vector vecFrom;

	vecFrom.x = msg.ReadBitCoord();
	vecFrom.y = msg.ReadBitCoord();
	vecFrom.z = msg.ReadBitCoord();

	// Actually took damage?
	if ( damageTaken > 0 || armor > 0 )
	{
		if ( damageTaken > 0 )
		{
			// start the animation
			if( m_flHealthSize > 20 )
			{
				g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("C17HealthDamageTaken");
			}
		}
	}
}
예제 #4
0
void MsgFunc_KillCam(bf_read &msg) 
{
	C_DODPlayer *pPlayer = C_DODPlayer::GetLocalDODPlayer();

	if ( !pPlayer )
		return;

	int newMode = msg.ReadByte();

	if ( newMode != g_nKillCamMode )
	{
#if !defined( NO_ENTITY_PREDICTION )
		if ( g_nKillCamMode == OBS_MODE_NONE )
		{
			// kill cam is switch on, turn off prediction
			g_bForceCLPredictOff = true;
		}
		else if ( newMode == OBS_MODE_NONE )
		{
			// kill cam is switched off, restore old prediction setting is we switch back to normal mode
			g_bForceCLPredictOff = false;
		}
#endif
		g_nKillCamMode = newMode;
	}

	g_nKillCamTarget1	= msg.ReadByte();
	g_nKillCamTarget2	= msg.ReadByte();
}
예제 #5
0
//-----------------------------------------------------------------------------
// Purpose: Reads in a player's Chat text from the server
//-----------------------------------------------------------------------------
void CHudChat::MsgFunc_SayText2( bf_read &msg )
{
	int client = msg.ReadByte();
	bool bWantsToChat = msg.ReadByte() ? true : false;

	wchar_t szBuf[6][256];
	char untranslated_msg_text[256];
	wchar_t *msg_text = ReadLocalizedString( msg, szBuf[0], sizeof( szBuf[0] ), false, untranslated_msg_text, sizeof( untranslated_msg_text ) );

	// keep reading strings and using C format strings for subsituting the strings into the localised text string
	ReadChatTextString ( msg, szBuf[1], sizeof( szBuf[1] ) );		// player name
	ReadChatTextString ( msg, szBuf[2], sizeof( szBuf[2] ) );		// chat text
	ReadLocalizedString( msg, szBuf[3], sizeof( szBuf[3] ), true );
	ReadLocalizedString( msg, szBuf[4], sizeof( szBuf[4] ), true );

	g_pVGuiLocalize->ConstructString( szBuf[5], sizeof( szBuf[5] ), msg_text, 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );

	char ansiString[512];
	g_pVGuiLocalize->ConvertUnicodeToANSI( ConvertCRtoNL( szBuf[5] ), ansiString, sizeof( ansiString ) );

	if ( bWantsToChat )
	{
		// print raw chat text
		ChatPrintf( client, CHAT_FILTER_NONE, "%s", ansiString );

		Msg( "%s\n", RemoveColorMarkup(ansiString) );
	}
	else
	{
		// print raw chat text
		ChatPrintf( client, CHAT_FILTER_NONE, "%s", ansiString );
	}
}
예제 #6
0
 // ----------------------------------------------------------
 // ----------------------------------------------------------
 void CHudTaskList::MsgFunc_TaskList( bf_read &msg )
 {
 	char szString[256];
 	int task_index;
 	int task_priority;
 
 	task_index = msg.ReadByte();
 	task_priority = msg.ReadByte();
 	msg.ReadString( szString, sizeof(szString) );
 
 	DevMsg (2, "CHudTaskList::MsgFunc_TaskList - got message for task %d, priority %d, string %s\n", task_index, task_priority, szString );
 
 	// ----------------------------------------------------------
 	// --- Convert it to localize friendly unicode
 	// ----------------------------------------------------------
 	g_pVGuiLocalize->ConvertANSIToUnicode( szString, m_pText[task_index], sizeof(m_pText[task_index]) );
 
 	// ----------------------------------------------------------
 	// --- Setup a time tracker for tasks just added or updated
 	// ----------------------------------------------------------
 	if ( m_iPriority[task_index] != task_priority )
 	{
 		m_flStartTime[task_index] = gpGlobals->curtime;
 		m_flDuration[task_index] = TASKLINE_FLASH_TIME;
 	}
 	m_iPriority[task_index] = task_priority;
 }
예제 #7
0
파일: cfui_menu.cpp 프로젝트: BSVino/Arcon
static void __MsgFunc_CFPanel( bf_read &msg )
{
	CFPanel ePanel = (CFPanel)msg.ReadByte();
	bool bShow = !!msg.ReadByte();
	bool bCloseAfter = !!msg.ReadByte();

	if (ePanel == CF_SCOREBOARD)
	{
		CScoreboard::Get()->OpenScoreboard(bShow);
		return;
	}

	if (ePanel == CF_ROUND_OVER)
	{
		CRoundVictoryPanel::Open();
		return;
	}

	if (ePanel == CF_KILLERINFO)
	{
		CKillerInfo::Open();
		return;
	}

	if (bShow)
		CCFMenu::OpenMenu(ePanel, bCloseAfter);
	else
		CCFMenu::Close();
}
예제 #8
0
void CHintbox::MsgFunc_Hintbox( bf_read &msg )
{
	int hint, time, mode;
	hint = msg.ReadByte();
	time = msg.ReadByte();
	mode = msg.ReadByte();
	DevMsg (2, "CHintbox::MsgFunc_Hintbox - got message hint: %d time: %d mode: %d\n", hint, time, mode);
	
	UseHint(hint, time, mode);
}
void __MsgFunc_ASWSkillSpent( bf_read &msg )
{
	int iRosterIndex = msg.ReadByte();
	int nSkillSlot = msg.ReadByte();
	
	CNB_Spend_Skill_Points *pSpendPanel = dynamic_cast<CNB_Spend_Skill_Points*>( GetClientMode()->GetViewport()->FindChildByName( "Spend_Skill_Points", true ) );
	if ( !pSpendPanel )
	{
		//Msg( "ASWSkillSpent: Couldn't find CNB_Spend_Skill_Points\n" );
		return;
	}
	pSpendPanel->DoSpendPointAnimation( iRosterIndex, nSkillSlot );
}
예제 #10
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
// Output : static int
//-----------------------------------------------------------------------------
void __MsgFunc_Fade( bf_read &msg )
{
	ScreenFade_t fade;

	fade.duration = msg.ReadShort(); // fade lasts this long
	fade.holdTime = msg.ReadShort(); // fade lasts this long
	fade.fadeFlags = msg.ReadShort(); // fade type (in / out)
	fade.r = msg.ReadByte(); // fade red
	fade.g = msg.ReadByte(); // fade green
	fade.b = msg.ReadByte(); // fade blue
	fade.a = msg.ReadByte(); // fade blue

	g_ViewEffects.Fade( fade );
}
예제 #11
0
void CHudStyleBar::MsgFunc_StyleAnnouncement( bf_read &msg )
{
	announcement_t eAnnouncement = (announcement_t)msg.ReadLong();
	style_point_t ePointStyle = (style_point_t)msg.ReadByte();
	float flBar = msg.ReadFloat();
	float flPoints = msg.ReadFloat();

	CAnnouncement oAnnouncement;
	oAnnouncement.m_flStartTime = gpGlobals->curtime;
	oAnnouncement.m_eAnnouncement = eAnnouncement;
	oAnnouncement.m_ePointStyle = ePointStyle;
	oAnnouncement.m_flBarPosition = flBar;

	if (m_aAnnouncements.Count())
	{
		// If a few at a time come in off the wire don't throw them all up at once. Subsequent ones should come in with a delay.

		float flDelay = 0.02f;
		if (gpGlobals->curtime < m_aAnnouncements[m_aAnnouncements.Tail()].m_flStartTime + flDelay)
			oAnnouncement.m_flStartTime = m_aAnnouncements[m_aAnnouncements.Tail()].m_flStartTime + flDelay;
	}

	oAnnouncement.m_flStylePoints = flPoints;

	m_aAnnouncements.AddToTail(oAnnouncement);
}
예제 #12
0
//-----------------------------------------------------------------------------
// Purpose: Receive messages from the server
// Input  : classID - class to receive the message
//			&msg - message in question
//-----------------------------------------------------------------------------
void C_GrenadeHopwire::ReceiveMessage( int classID, bf_read &msg )
{
	if ( classID != GetClientClass()->m_ClassID )
	{
		// Message is for subclass
		BaseClass::ReceiveMessage( classID, msg );
		return;
	}

	int messageType = msg.ReadByte();
	switch( messageType )
	{
	case HOPWIRE_START_EXPLOSION:
		{
			m_ExplosionEffect.SetActive();
			m_ExplosionEffect.SetOwner( this );
			m_ExplosionEffect.StartExplosion();
		}
		break;
	case HOPWIRE_STOP_EXPLOSION:
		{
			m_ExplosionEffect.StopExplosion();
		}
		break;
	default:
		break;
	}
}
예제 #13
0
//--------------------------------------------------------------
// TGB: usermessage for updating the buildmenu
//--------------------------------------------------------------
void __MsgFunc_BuildMenuUpdate( bf_read &msg )
{
	//DevMsg("Received BuildMenuUpdate on client\n");

	if (gBuildMenu == NULL)
	{
		gBuildMenu = dynamic_cast<CBuildMenu *>(gViewPortInterface->FindPanelByName(PANEL_BUILD));
		if(gBuildMenu == NULL)
			return;
	}

	//read spawn entindex
	int spawnidx = msg.ReadShort();

	//read whether this is an opener msg or update msg
	bool force_open = (msg.ReadOneBit() == 1);

	//read queue from usermessage
	int queue[BM_QUEUE_SIZE];
	for (int i=0; i < BM_QUEUE_SIZE; i++)
	{
		//every type was increased by 1 so that type_invalid could be 0 (byte is unsigned)
		queue[i] = (msg.ReadByte() - 1);
	}

	if (force_open)
	{
		//if we weren't visible, this is also an opening message
		gViewPortInterface->ShowPanel(gBuildMenu, true);
	}

	gBuildMenu->SetCurrentSpawn(spawnidx);
	gBuildMenu->UpdateQueue(queue);

}
예제 #14
0
//-----------------------------------------------------------------------------
// Purpose: Reads in a player's Chat text from the server
//-----------------------------------------------------------------------------
void CBaseHudChat::MsgFunc_SayText2( bf_read &msg )
{
	// Got message during connection
	if ( !g_PR )
		return;

	int client = msg.ReadByte();
	bool bWantsToChat = msg.ReadByte();

	wchar_t szBuf[6][256];
	char untranslated_msg_text[256];
	wchar_t *msg_text = ReadLocalizedString( msg, szBuf[0], sizeof( szBuf[0] ), false, untranslated_msg_text, sizeof( untranslated_msg_text ) );

	// keep reading strings and using C format strings for subsituting the strings into the localised text string
	ReadChatTextString ( msg, szBuf[1], sizeof( szBuf[1] ) );		// player name
	ReadChatTextString ( msg, szBuf[2], sizeof( szBuf[2] ) );		// chat text
	ReadLocalizedString( msg, szBuf[3], sizeof( szBuf[3] ), true );
	ReadLocalizedString( msg, szBuf[4], sizeof( szBuf[4] ), true );

	g_pVGuiLocalize->ConstructString( szBuf[5], sizeof( szBuf[5] ), msg_text, 4, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );

	char ansiString[512];
	g_pVGuiLocalize->ConvertUnicodeToANSI( ConvertCRtoNL( szBuf[5] ), ansiString, sizeof( ansiString ) );

	if ( bWantsToChat )
	{
		int iFilter = CHAT_FILTER_NONE;

		if ( client > 0 && (g_PR->GetTeam( client ) != g_PR->GetTeam( GetLocalPlayerIndex() )) )
		{
			iFilter = CHAT_FILTER_PUBLICCHAT;
		}

		// print raw chat text
		ChatPrintf( client, iFilter, "%s", ansiString );

		Msg( "%s\n", RemoveColorMarkup(ansiString) );

		CLocalPlayerFilter filter;
		C_BaseEntity::EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, "HudChat.Message" );
	}
	else
	{
		// print raw chat text
		ChatPrintf( client, GetFilterForString( untranslated_msg_text), "%s", ansiString );
	}
}
예제 #15
0
void __MsgFunc_ASWShowHoldoutWaveEnd( bf_read &msg )
{
	int nWave = msg.ReadByte();
	float flDuration = msg.ReadFloat();

	CASW_Hud_Holdout *pHoldoutHud = GET_HUDELEMENT( CASW_Hud_Holdout );
	pHoldoutHud->ShowWaveScores( nWave, flDuration );
}
//-----------------------------------------------------------------------------
// Purpose: Message handler for Damage message
//-----------------------------------------------------------------------------
void CHudDamageTiles::MsgFunc_Damage( bf_read &msg )
{
						msg.ReadByte();	// armor
						msg.ReadByte();	// health
	long bitsDamage	=	msg.ReadLong();	// damage bits, ignore

	UpdateTiles( bitsDamage );
}
예제 #17
0
void __MsgFunc_ASWNewHoldoutWave( bf_read &msg )
{
	int nWave = msg.ReadByte();
	float flDuration = msg.ReadFloat();

	CASW_Hud_Holdout *pHoldoutHud = GET_HUDELEMENT( CASW_Hud_Holdout );
	pHoldoutHud->AnnounceNewWave( nWave, flDuration );
}
예제 #18
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
//-----------------------------------------------------------------------------
void CHudChat::MsgFunc_SayText( bf_read &msg )
{
	char szString[256];

	msg.ReadByte(); // client ID
	msg.ReadString( szString, sizeof(szString) );
	Printf( CHAT_FILTER_NONE, "%s", szString );
}
예제 #19
0
파일: menu.cpp 프로젝트: Au-heppa/swarm-sdk
//-----------------------------------------------------------------------------
// Purpose: Message handler for ShowMenu message
//   takes four values:
//		short: a bitfield of keys that are valid input
//		char : the duration, in seconds, the menu should stay up. -1 means is stays until something is chosen.
//		byte : a boolean, TRUE if there is more string yet to be received before displaying the menu, false if it's the last string
//		string: menu string to display
//  if this message is never received, then scores will simply be the combined totals of the players.
//-----------------------------------------------------------------------------
void CHudMenu::MsgFunc_ShowMenu( bf_read &msg)
{
	m_bitsValidSlots = (short)msg.ReadWord();
	int DisplayTime = msg.ReadChar();
	int NeedMore = msg.ReadByte();

	if ( DisplayTime > 0 )
	{
		m_flShutoffTime = m_flOpenCloseTime + DisplayTime + gpGlobals->realtime;

	}
	else
	{
		m_flShutoffTime = -1;
	}

	if ( m_bitsValidSlots )
	{
		char szString[2048];
		msg.ReadString( szString, sizeof(szString) );

		if ( !m_fWaitingForMore ) // this is the start of a new menu
		{
			Q_strncpy( g_szPrelocalisedMenuString, szString, sizeof( g_szPrelocalisedMenuString ) );
		}
		else
		{  // append to the current menu string
			Q_strncat( g_szPrelocalisedMenuString, szString, sizeof( g_szPrelocalisedMenuString ), COPY_ALL_CHARACTERS );
		}

		if ( !NeedMore )
		{  
			GetClientMode()->GetViewportAnimationController()->StartAnimationSequence("MenuOpen");
			m_nSelectedItem = -1;
			
			// we have the whole string, so we can localise it now
			char szMenuString[MAX_MENU_STRING];
			Q_strncpy( szMenuString, ConvertCRtoNL( hudtextmessage->BufferedLocaliseTextString( g_szPrelocalisedMenuString ) ), sizeof( szMenuString ) );
			g_pVGuiLocalize->ConvertANSIToUnicode( szMenuString, g_szMenuString, sizeof( g_szMenuString ) );
			
			ProcessText();
		}

		m_bMenuDisplayed = true;
		m_bMenuTakesInput = true;

		m_flSelectionTime = gpGlobals->curtime;
	}
	else
	{
		HideMenu();
	}

	m_fWaitingForMore = NeedMore;
}
예제 #20
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
// Output : static int
//-----------------------------------------------------------------------------
void __MsgFunc_Shake( bf_read &msg )
{
	ScreenShake_t shake;

	shake.command	= msg.ReadByte();
	shake.amplitude = msg.ReadFloat();
	shake.frequency = msg.ReadFloat();
	shake.duration	= msg.ReadFloat();

	g_ViewEffects.Shake( shake );
}
예제 #21
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
//-----------------------------------------------------------------------------
void CForceFeedback::MsgFunc_ForceFeedback( bf_read &msg )
{
	byte msgType = msg.ReadByte();

	switch ( msgType )
	{
	default:
		{
			Warning( "Bad parse in MsgFunc_ForceFeedback!\n" );
		}
		break;
	case FFMSG_STOPALL:
		{
			Internal_StopAllEffects();
		}
		break;
	case FFMSG_START:
		{
			FORCEFEEDBACK_t effectType = (FORCEFEEDBACK_t)msg.ReadByte();

			FFBaseParams_t params;
			params.m_flDirection = 360.0f * ( (byte)msg.ReadByte() / 255.0f );
			params.m_flDuration = (float)msg.ReadLong() / 1000.0f;
			params.m_flGain = ( (byte)msg.ReadByte() / 255.0f );
			params.m_nPriority = msg.ReadByte();
			params.m_bSolo = msg.ReadByte() == 0 ? false : true;

			if ( effectType >= 0 && effectType < NUM_FORCE_FEEDBACK_PRESETS )
			{
				Internal_StartEffect( effectType, params );
			}
			else
			{
				Warning( "Bad parse in MsgFunc_ForceFeedback, FFMSG_START (%i)!\n", effectType );
			}
		}
		break;
	case FFMSG_STOP:
		{
			FORCEFEEDBACK_t effectType = (FORCEFEEDBACK_t)msg.ReadByte();

			Internal_StopEffect( effectType );
		}
		break;
	case FFMSG_PAUSE:
		{
			Internal_PauseAll();
		}
		break;
	case FFMSG_RESUME:
		{
			Internal_ResumeAll();
		}
		break;
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHudHealth::MsgFunc_Damage(bf_read &msg)
{
	msg.ReadByte();	// armor
	msg.ReadByte();	// health
	msg.ReadLong();	// damage bits

	Vector vecFrom;

	vecFrom.x = msg.ReadBitCoord();
	vecFrom.y = msg.ReadBitCoord();
	vecFrom.z = msg.ReadBitCoord();
}
예제 #23
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
//-----------------------------------------------------------------------------
void CHudChat::MsgFunc_SayText( bf_read &msg )
{
	char szString[256];

	int client = msg.ReadByte();
	msg.ReadString( szString, sizeof(szString) );
	bool bWantsToChat = msg.ReadByte();
	
	if ( bWantsToChat )
	{
		// print raw chat text
		 ChatPrintf( client, "%s", szString );
	}
	else
	{
		// try to lookup translated string
		 Printf( "%s", hudtextmessage->LookupString( szString ) );
	}

	Msg( "%s", szString );
}
예제 #24
0
// Message handler for PyNetworkCls
void __MsgFunc_PyNetworkCls( bf_read &msg )
{
	char clientClass[PYNETCLS_BUFSIZE];
	char networkName[PYNETCLS_BUFSIZE];

	int iType = msg.ReadByte();
	msg.ReadString(clientClass, PYNETCLS_BUFSIZE);
	msg.ReadString(networkName, PYNETCLS_BUFSIZE);

	DbgStrPyMsg( "__MsgFunc_PyNetworkCls: Registering Python network class message %d %s %s\n", iType, clientClass, networkName );

	// Get module path
	const char *pch = Q_strrchr( networkName, '.' );
	if( !pch )
	{
		Warning( "Invalid python class name %s\n", networkName );
		return;
	}
	int n = pch - networkName + 1;

	char modulePath[PYNETCLS_BUFSIZE];
	Q_strncpy( modulePath, networkName, n );

	// Make sure the client class is imported
	SrcPySystem()->Import( modulePath );

	// Read which client class we are modifying
	PyClientClassBase *p = FindPyClientClass( clientClass );
	if( !p )
	{
		Warning( "__MsgFunc_PyNetworkCls: Invalid networked class %s\n", clientClass );
		return;
	}
	
	// Set type
	p->SetType( iType );
	SetupClientClassRecv( p, iType );

	// Read network class name
	Q_strncpy( p->m_strPyNetworkedClassName, networkName, PYNETCLS_BUFSIZE );

	// Attach if a network class exists
	unsigned short lookup = m_NetworkClassDatabase.Find( networkName );
	if ( lookup != m_NetworkClassDatabase.InvalidIndex() )
	{
		m_NetworkClassDatabase.Element(lookup)->AttachClientClass( p );
	}
	else
	{
		Warning( "__MsgFunc_PyNetworkCls: Invalid networked class %s\n", networkName );
	}
}
예제 #25
0
//-----------------------------------------------------------------------------
// Purpose: Message handler for Damage message
//-----------------------------------------------------------------------------
void CHudDamageIndicator::MsgFunc_Damage( bf_read &msg )
{
	int damageTaken	= msg.ReadByte();	

	Vector vecFrom;
	msg.ReadBitVec3Coord( vecFrom );

	if ( damageTaken > 0 )
	{
		m_flFadeCompleteTime = gpGlobals->curtime + 1.0;
		CalcDamageDirection( vecFrom );
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHudNotificationPanel::MsgFunc_HudNotify( bf_read &msg )
{
	// Ignore notifications in minmode
	ConVarRef cl_hud_minmode( "cl_hud_minmode", true );
	if ( cl_hud_minmode.IsValid() && cl_hud_minmode.GetBool() )
		return;

	int iType = msg.ReadByte();

	LoadControlSettings( GetNotificationByType( iType ) );

	// set up the fade time
	m_flFadeTime = gpGlobals->curtime + tf_hud_notification_duration.GetFloat();
}
예제 #27
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
//-----------------------------------------------------------------------------
void CBaseHudChat::MsgFunc_SayText( bf_read &msg )
{
	char szString[256];

	int client = msg.ReadByte();
	msg.ReadString( szString, sizeof(szString) );
	bool bWantsToChat = msg.ReadByte();

	if ( bWantsToChat )
	{
		// print raw chat text
		ChatPrintf( client, CHAT_FILTER_NONE, "%s", szString );
	}
	else
	{
		// try to lookup translated string
		Printf( CHAT_FILTER_NONE, "%s", hudtextmessage->LookupString( szString ) );
	}

	CLocalPlayerFilter filter;
	C_BaseEntity::EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, "HudChat.Message" );

	Msg( "%s", szString );
}
예제 #28
0
// Server to client message received
void C_NPC_Advisor::ReceiveMessage( int classID, bf_read &msg )
{
	if ( classID != GetClientClass()->m_ClassID )
	{
		// message is for subclass
		BaseClass::ReceiveMessage( classID, msg );
		return;
	}

	int messageType = msg.ReadByte();
	switch( messageType )
	{
	case ADVISOR_MSG_START_BEAM:
		{
			int eindex = msg.ReadLong();
			StartBeamFX(IndexToEntity(eindex));
		}
		break;

	case ADVISOR_MSG_STOP_BEAM:
		{
			int eindex = msg.ReadLong();
			StopBeamFX(IndexToEntity(eindex));

		}
		break;

	case ADVISOR_MSG_STOP_ALL_BEAMS:
		{
			ParticleProp()->StopEmission();
		}
		break;
	case ADVISOR_MSG_START_ELIGHT:
		{
			StartElight();
		}
		break;
	case ADVISOR_MSG_STOP_ELIGHT:
		{
			StopElight();
		}
		break;

	default:
		AssertMsg1( false, "Received unknown message %d", messageType);
	}
}
//-----------------------------------------------------------------------------
// Purpose: Receive messages from the server
// Input  : classID - class to receive the message
//			&msg - message in question
//-----------------------------------------------------------------------------
void C_GrenadeHopwire::ReceiveMessage( int classID, bf_read &msg )
{
	if ( classID != GetClientClass()->m_ClassID )
	{
		// Message is for subclass
		BaseClass::ReceiveMessage( classID, msg );
		return;
	}

	int messageType = msg.ReadByte();
	switch( messageType )
	{
	case HOPWIRE_START_EXPLOSION:
		{
			m_ExplosionEffect.SetActive();
			m_ExplosionEffect.SetOwner( this );

#ifdef C17
			C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();

			if (pPlayer)
			{
				//pPlayer->EmitSound( "Weapon_AR3.Geiger" );
				pPlayer->EmitSound("Weapon_AR3.BlackHole");
			}
			else
			{
				//No player?
				//Emit from the blackhole instead.
				//EmitSound( "Weapon_AR3.Geiger" );
				EmitSound("Weapon_AR3.BlackHole");
			}
#endif

			m_ExplosionEffect.StartExplosion();
		}
		break;
	case HOPWIRE_STOP_EXPLOSION:
		{
			m_ExplosionEffect.StopExplosion();
		}
		break;
	default:
		break;
	}
}
예제 #30
0
void CVoiceStatus::HandleVoiceMaskMsg(bf_read &msg)
{
	unsigned long dw;
	for(dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++)
	{
		m_AudiblePlayers.SetDWord(dw, (unsigned long)msg.ReadLong());
		m_ServerBannedPlayers.SetDWord(dw, (unsigned long)msg.ReadLong());

		if( voice_clientdebug.GetInt())
		{
			Msg("CVoiceStatus::HandleVoiceMaskMsg\n");
			Msg("    - m_AudiblePlayers[%d] = %lu\n", dw, m_AudiblePlayers.GetDWord(dw));
			Msg("    - m_ServerBannedPlayers[%d] = %lu\n", dw, m_ServerBannedPlayers.GetDWord(dw));
		}
	}

	m_bServerModEnable = msg.ReadByte();
}