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


C++ bf_read::ReadShort方法代码示例

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


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

示例1: __MsgFunc_HapSetConst

//Might be able to handle this better...
void __MsgFunc_HapSetConst( bf_read &msg )
{
#ifdef WIN32
	Vector constant;
	constant.x = msg.ReadShort();
	constant.y = msg.ReadShort();
	constant.z = msg.ReadShort();

	HapticsHandleMsg_HapSetConst( constant );
#endif // WIN32
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:12,代码来源:haptic_msgs.cpp

示例2: __MsgFunc_Fade

//-----------------------------------------------------------------------------
// 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 );
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:21,代码来源:view_effects.cpp

示例3: MsgFunc_AmmoDenied

//-----------------------------------------------------------------------------
// Purpose: ammo denied message
//-----------------------------------------------------------------------------
void CHudHistoryResource::MsgFunc_AmmoDenied( bf_read &msg )
{
	int iAmmo = msg.ReadShort();

	// see if there are any existing ammo items of that type
	for ( int i = 0; i < m_PickupHistory.Count(); i++ )
	{
		if ( m_PickupHistory[i].type == HISTSLOT_AMMO && m_PickupHistory[i].iId == iAmmo )
		{
			// it's already in the list as a pickup, ignore
			return;
		}
	}

	// see if there are any denied ammo icons, if so refresh their timer
	for ( int i = 0; i < m_PickupHistory.Count(); i++ )
	{
		if ( m_PickupHistory[i].type == HISTSLOT_AMMODENIED && m_PickupHistory[i].iId == iAmmo )
		{
			// it's already in the list, refresh
			m_PickupHistory[i].DisplayTime = gpGlobals->curtime + (hud_drawhistory_time.GetFloat() / 2.0f);
			m_bNeedsDraw = true;
			return;
		}
	}

	// add into the list
	AddToHistory( HISTSLOT_AMMODENIED, iAmmo, 0 );
}
开发者ID:BoXorz,项目名称:MasterSword-Source,代码行数:32,代码来源:history_resource.cpp

示例4: MsgFunc_NotificationIcon

/**
 *
 * short - 
 * long - Duration in seconds to display (-1 means forever)
 */
void CHudNotification::MsgFunc_NotificationIcon( bf_read& data )
{
	short icon = data.ReadShort();
	int duration = data.ReadLong();

	m_IconList.AddToTail( );
}
开发者ID:Snake4life,项目名称:luminousforts-2013,代码行数:12,代码来源:Hud_Notification.cpp

示例5: MsgFunc_Technology

//-----------------------------------------------------------------------------
// 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;
}
开发者ID:TalonBraveInfo,项目名称:InvasionSource,代码行数:67,代码来源:hud_technologytreedoc.cpp

示例6: __MsgFunc_BuildMenuUpdate

//--------------------------------------------------------------
// 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);

}
开发者ID:TotallyMehis,项目名称:ZM-Updated,代码行数:38,代码来源:buildmenu.cpp

示例7: __MsgFunc_ReloadEffect

void __MsgFunc_ReloadEffect( bf_read &msg )
{
	int iPlayer = msg.ReadShort();
	C_SDKPlayer *pPlayer = dynamic_cast< C_SDKPlayer* >( C_BaseEntity::Instance( iPlayer ) );
	if ( pPlayer )
		pPlayer->PlayReloadEffect();

}
开发者ID:iosoccer,项目名称:iosoccer-game,代码行数:8,代码来源:c_sdk_player.cpp

示例8: __MsgFunc_ASWSentryTracer

void __MsgFunc_ASWSentryTracer( bf_read &msg )
{
	int iSentry = msg.ReadShort();		
	C_ASW_Sentry_Top *pSentry = dynamic_cast<C_ASW_Sentry_Top*>( ClientEntityList().GetEnt( iSentry ) );		// turn iMarine ent index into the marine

	Vector vecEnd;
	vecEnd.x = msg.ReadFloat();
	vecEnd.y = msg.ReadFloat();
	vecEnd.z = msg.ReadFloat();

	if ( pSentry )
	{
		pSentry->ASWSentryTracer( vecEnd );
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:15,代码来源:c_asw_sentry_top.cpp

示例9: MsgFunc_ASWOrderStopItemFX

void CASW_Hud_Squad_Hotbar::MsgFunc_ASWOrderStopItemFX( bf_read &msg )
{
	int iMarine = msg.ReadShort();	
	C_ASW_Marine *pMarine = dynamic_cast<C_ASW_Marine*>(ClientEntityList().GetEnt(iMarine));		// turn iMarine ent index into the marine
	if ( !pMarine )
		return;

	bool bShouldDelay = msg.ReadOneBit() ? true : false;
	bool bFailed = msg.ReadOneBit() ? true : false;

	// loops through to see if we already have an order effect for this marine
	if ( bFailed )
		StopItemFX( pMarine, gpGlobals->curtime + 2.0f, true );
	else if ( bShouldDelay )
		StopItemFX( pMarine, gpGlobals->curtime + 2.0f );
	else
		StopItemFX( pMarine );
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:18,代码来源:asw_hud_squad_hotbar.cpp

示例10: MsgFunc_ASWOrderUseItemFX

//-----------------------------------------------------------------------------
// Purpose: Message handler for ASWOrderUseItemFX message
//-----------------------------------------------------------------------------
void CASW_Hud_Squad_Hotbar::MsgFunc_ASWOrderUseItemFX( bf_read &msg )
{
	int iMarine = msg.ReadShort();	
	C_ASW_Marine *pMarine = dynamic_cast<C_ASW_Marine*>(ClientEntityList().GetEnt(iMarine));		// turn iMarine ent index into the marine
	if ( !pMarine )
		return;

	int iOrderType = msg.ReadShort();
	int iInventorySlot = msg.ReadShort();

	Vector vecPosition;
	vecPosition.x = msg.ReadFloat();
	vecPosition.y = msg.ReadFloat();
	vecPosition.z = msg.ReadFloat();

	// loops through to see if we already have an order effect for this marine
	StopItemFX( pMarine );

	const char *pszClassName = NULL;

	switch( iOrderType )
	{
	case ASW_USE_ORDER_WITH_ITEM:
		{
			// check we have an item in that slot
			CASW_Weapon* pWeapon = pMarine->GetASWWeapon( iInventorySlot );
			if ( !pWeapon || !pWeapon->GetWeaponInfo() || !pWeapon->GetWeaponInfo()->m_bOffhandActivate )
				return;

			pszClassName = pWeapon->GetClassname();
		}
		break;

	case ASW_USE_ORDER_HACK:
		{
			pszClassName = "asw_weapon_t75";	// for now, we're using the t75 icon for hacking
		}
		break;

	default:
		{
			Assert( false ); // unspecified order type
			return;
		}
		break;
	}

	//CNewParticleEffect *pEffect = pMarine->ParticleProp()->Create( "order_use_item", PATTACH_CUSTOMORIGIN, -1, vecPosition - pMarine->GetAbsOrigin() );
	CNewParticleEffect *pEffect = pMarine->ParticleProp()->Create( "order_use_item", PATTACH_ABSORIGIN );
	if ( pEffect )
	{
		pMarine->ParticleProp()->AddControlPoint( pEffect, 1, pMarine, PATTACH_CUSTOMORIGIN );
		pEffect->SetControlPoint( 1, vecPosition );//vecPosition - pMarine->GetAbsOrigin()
		for ( int i = 0; i < NUM_USE_ITEM_ORDER_CLASSES; i++ )
		{
			if ( pszUseItemOrderClasses[i] && !Q_strcmp (  pszUseItemOrderClasses[i]  ,  pszClassName )  )
			{
				pEffect->SetControlPoint( 2, Vector( i, 0, 0 ) );
				break;
			}
		}

		HotbarOrderEffectsList_t::IndexLocalType_t iIndex = m_hHotbarOrderEffects.AddToTail();
		m_hHotbarOrderEffects[iIndex].iEffectID = iMarine;
		m_hHotbarOrderEffects[iIndex].pEffect = pEffect;
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:70,代码来源:asw_hud_squad_hotbar.cpp

示例11: MsgFunc_Battery

//-----------------------------------------------------------------------------
// MsgFunc_Battery()
// Obtener la energía actual del traje.
//-----------------------------------------------------------------------------
void CHudBattery::MsgFunc_Battery(bf_read &msg)
{
	m_iNewBat = msg.ReadShort();
}
开发者ID:InfoSmart,项目名称:InSource-Singleplayer,代码行数:8,代码来源:hud_battery.cpp

示例12: HandlePacket_LOOKING_FOR_WORKERS

void HandlePacket_LOOKING_FOR_WORKERS( bf_read &buf, const CIPAddr &ipFrom )
{
	// If we're downloading files for a job request, don't process any more "looking for workers" packets.
	if ( g_Waiting_hProcess )
		return;
	
	// This will be a nonzero-length string if patching.
	char versionString[512];
	buf.ReadString( versionString, sizeof( versionString ) );

	int iPort = buf.ReadShort();
	int iPriority = buf.ReadShort();

	// Make sure we don't run the same job more than once.
	if ( !CheckJobID( buf, g_CurJobID ) )
		return;

	CUtlVector<char*> newArgv;
	GetArgsFromBuffer( buf, newArgv, &g_Waiting_bShowAppWindow );

	bool bForcePatch = false;
	if ( buf.GetNumBytesLeft() >= 1 )
		bForcePatch = (buf.ReadByte() != 0);

	int iDownloaderPort = iPort;
	if  ( buf.GetNumBytesLeft() >= 2 )
		iDownloaderPort = buf.ReadShort();

	// Add these arguments after the executable filename to tell the program
	// that it's an MPI worker and who to connect to. 
	char strDownloaderIP[128], strMainIP[128];
	V_snprintf( strDownloaderIP, sizeof( strDownloaderIP ), "%d.%d.%d.%d:%d", ipFrom.ip[0], ipFrom.ip[1], ipFrom.ip[2], ipFrom.ip[3], iDownloaderPort );
	V_snprintf( strMainIP, sizeof( strMainIP ), "%d.%d.%d.%d:%d", ipFrom.ip[0], ipFrom.ip[1], ipFrom.ip[2], ipFrom.ip[3], iPort );

	// (-mpi is already on the command line of whoever ran the app).
	// AppendArg( commandLine, sizeof( commandLine ), "-mpi" );
	newArgv.InsertAfter( 0, CopyString( "-mpi_worker" ) );
	newArgv.InsertAfter( 1, CopyString( strDownloaderIP ) );


	// If the version string is set, then this is a patch.
	bool bPatching = false;
	if ( versionString[0] != 0 )
	{
		bPatching = true;
		
		// Check that we haven't applied this patch version yet. This case usually happens right after we've applied a patch
		// and we're restarting. The vmpi_transfer master is still pinging us telling us to patch, but we don't want to
		// reapply this patch.
		if ( atof( versionString ) <= atof( g_VersionString ) && !bForcePatch )
		{
			newArgv.PurgeAndDeleteElements();
			return;
		}
		
		// Ok, it's a new version. Get rid of whatever was running before.
		KillRunningProcess( "Starting a patch..", true );
	}
								 
	// If there's already a job running, only interrupt it if this new one has a higher priority.
	if ( WaitForProcessToExit() )
	{
		if ( iPriority > g_CurJobPriority )
		{
			KillRunningProcess( "Interrupted by a higher priority process", true );
		}
		else
		{
			// This means we're already running a job with equal to or greater priority than
			// the one that has been requested. We're going to ignore this request.
			newArgv.PurgeAndDeleteElements();
			return;
		}
	}

	// Responses go here.
	g_CurRespondAddr = ipFrom;
	
	// Also look for -mpi_ShowAppWindow in the args to the service.
	if ( !g_Waiting_bShowAppWindow && FindArg( __argc, __argv, "-mpi_ShowAppWindow" ) )
		g_Waiting_bShowAppWindow = true;

	// Copy all the files from the master and put them in our cache dir to run with.
	char cacheDir[MAX_PATH];
	if ( StartDownloadingAppFiles( newArgv, cacheDir, sizeof( cacheDir ), g_Waiting_bShowAppWindow, &g_Waiting_hProcess, bPatching ) )
	{
		// After it's downloaded, we want it to switch to the main connection port.
		if ( newArgv.Count() >= 3 && V_stricmp( newArgv[2], strDownloaderIP ) == 0 )
		{
			delete newArgv[2];
			newArgv[2] = CopyString( strMainIP );
		}
		
		g_Waiting_StartTime = Plat_FloatTime();
		g_Waiting_Argv.PurgeAndDeleteElements();
		g_Waiting_Argv = newArgv;
		g_Waiting_Priority = iPriority;
		g_Waiting_bPatching = bPatching;
		newArgv.Purge();
	}
//.........这里部分代码省略.........
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:101,代码来源:vmpi_service.cpp

示例13: HandleMessage


//.........这里部分代码省略.........

			senddata.WriteUBitLong(6, 6);
			senddata.WriteByte(state);
			senddata.WriteLong(aservercount);



			NET_SendDatagram(false);

			return true;
		}

		senddata.WriteUBitLong(6, 6);
		senddata.WriteByte(state);
		senddata.WriteLong(aservercount);




		return true;
	}

	if (type == 7) // svc_Print
	{
		char print[2048];
		msg.ReadString(print, sizeof(print));
		//	printf("svc_Print: %s", print);
		printf("%s", print);
		return true;
	}

	if (type == 8)//svc_ServerInfo
	{
		unsigned short protoversion = msg.ReadShort();
		long servercount = msg.ReadLong();

		bool srctv = (bool)(msg.ReadOneBit() == 1);
		bool dedicated = (bool)(msg.ReadOneBit() == 1);
		long crc = msg.ReadLong();
		short maxclasses = msg.ReadWord();
		char mapmd5[16];
		msg.ReadBytes(mapmd5, 16);

		char players = msg.ReadByte();
		char maxplayers = msg.ReadByte();
		float tickinterval = msg.ReadFloat();
		char platform = msg.ReadChar();

		char gamedir[255];
		char levelname[255];
		char skyname[255];
		char hostname[255];
		char loadingurl[255];
		char gamemode[255];

		msg.ReadString(gamedir, sizeof(gamedir));
		msg.ReadString(levelname, sizeof(levelname));
		msg.ReadString(skyname, sizeof(skyname));
		msg.ReadString(hostname, sizeof(hostname));
		msg.ReadString(loadingurl, sizeof(loadingurl));
		msg.ReadString(gamemode, sizeof(gamemode));

		printf("ServerInfo, players: %lu/%lu | map: %s | name: %s | gm: %s | count: %i | left: %i | step: %i\n", players, maxplayers, levelname, hostname, gamemode, servercount, msg.GetNumBitsLeft(), bconnectstep);

		netchan->m_iServerCount = servercount;
		bconnectstep = 4;
开发者ID:Python1320,项目名称:source1_client,代码行数:67,代码来源:leyfakeclient.cpp

示例14: HandleConnectionLessPacket

int HandleConnectionLessPacket(char*ip, short port, int connection_less, bf_read& recvdata)
{
	recvdata.ReadLong();

	int header = 0;
	int id = 0;
	int total = 0;
	int number = 0;
	short splitsize = 0;

	if (connection_less == 1)
	{
		header = recvdata.ReadByte();
	}
	else {
		id = recvdata.ReadLong();
		total = recvdata.ReadByte();
		number = recvdata.ReadByte();
		splitsize = recvdata.ReadByte();
	}

	switch (header)
	{

	case '9':
	{
		recvdata.ReadLong();

		char error[1024];
		recvdata.ReadString(error, 1024);
		printf("Connection refused! [%s]\n", error);

		NET_Reconnect();

		return 0;
	}
	case 'A': // A2A_GETCHALLENGE
	{
		bconnectstep = 2;
		long magicnumber = recvdata.ReadLong();

		serverchallenge = recvdata.ReadLong();
		ourchallenge = recvdata.ReadLong();
		authprotocol = recvdata.ReadLong();

		steamkey_encryptionsize = recvdata.ReadShort(); // gotta be 0

		recvdata.ReadBytes(steamkey_encryptionkey, steamkey_encryptionsize);
		recvdata.ReadBytes(serversteamid, sizeof(serversteamid));
		vacsecured = recvdata.ReadByte();

		printf("Challenge: %lu__%lu|Auth: %x|SKey: %lu|VAC: %x\n", serverchallenge, ourchallenge, authprotocol, steamkey_encryptionsize, vacsecured);

		char connectpkg[700];
		memset(connectpkg, 0, sizeof(connectpkg));

		bf_write writeconnect(connectpkg, sizeof(connectpkg));
		bf_read readsteamid(connectpkg, sizeof(connectpkg));

		writeconnect.WriteLong(-1);
		writeconnect.WriteByte('k');//C2S_CONNECT

		writeconnect.WriteLong(0x18);//protocol ver

		writeconnect.WriteLong(0x03);//auth protocol 0x03 = PROTOCOL_STEAM, 0x02 = PROTOCOL_HASHEDCDKEY, 0x01=PROTOCOL_AUTHCERTIFICATE
		writeconnect.WriteLong(serverchallenge);
		writeconnect.WriteLong(ourchallenge);

		writeconnect.WriteUBitLong(2729496039, 32);

		writeconnect.WriteString(nickname); //nick
		writeconnect.WriteString(password); // pass
		writeconnect.WriteString("2000"); // game version


		unsigned char steamkey[STEAM_KEYSIZE];
		unsigned int keysize = 0;

		steamuser->GetAuthSessionTicket(steamkey, STEAM_KEYSIZE, &keysize);

		CSteamID localsid = steamuser->GetSteamID();

		writeconnect.WriteShort(242);
		unsigned long long steamid64 = localsid.ConvertToUint64();
		writeconnect.WriteLongLong(steamid64);

		if (keysize)
			writeconnect.WriteBytes(steamkey, keysize);

		net.SendTo(ip, port, connectpkg, writeconnect.GetNumBytesWritten());


		return 0;

	}
	case 'B': // S2C_CONNECTION
	{

		if (bconnectstep == 2)
		{
//.........这里部分代码省略.........
开发者ID:Python1320,项目名称:source1_client,代码行数:101,代码来源:leyfakeclient.cpp


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