• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ READ_SHORT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中READ_SHORT函数的典型用法代码示例。如果您正苦于以下问题:C++ READ_SHORT函数的具体用法?C++ READ_SHORT怎么用?C++ READ_SHORT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: readVectorClock

static VectorClock* readVectorClock(std::istream* inputStream,
                                    int& bytesRead) {
    std::list<std::pair<short, uint64_t> > entries;

    bytesRead = 0;
    uint16_t numEntries;
    READ_SHORT(inputStream, numEntries);
    bytesRead += 2;

    int versionSize = inputStream->get();
    bytesRead += 1;
    
    for (uint32_t i = 0; i < numEntries; i++) {
        short nodeId;

        READ_SHORT(inputStream, nodeId);
        bytesRead += 2;

        uint64_t version = readUINT64(inputStream, versionSize);
        bytesRead += versionSize;
        entries.push_back(std::make_pair(nodeId, version));
    }

    uint64_t timestamp = readUINT64(inputStream, 8);
    bytesRead += 8;
    return new VectorClock(&entries, timestamp);
}
开发者ID:54k,项目名称:voldemort,代码行数:27,代码来源:VoldemortNativeRequestFormat.cpp


示例2: MsgFunc_SetFog

//LRC
void CHud :: MsgFunc_SetFog( const char *pszName, int iSize, void *pbuf )
{
//	CONPRINT("MSG:SetFog");
	BEGIN_READ( pbuf, iSize );

	for ( int i = 0; i < 3; i++ )
		 g_fFogColor[ i ] = READ_BYTE();

	g_fFadeDuration = READ_SHORT();
	g_fStartDist = READ_SHORT();

	if (g_fFadeDuration > 0)
	{
//		// fading in
//		g_fStartDist = READ_SHORT();
		g_iFinalEndDist = READ_SHORT();
//		g_fStartDist = FOG_LIMIT;
		g_fEndDist = FOG_LIMIT;
	}
	else if (g_fFadeDuration < 0)
	{
//		// fading out
//		g_iFinalStartDist =
		g_iFinalEndDist = g_fEndDist = READ_SHORT();
	}
	else
	{
//		g_fStartDist = READ_SHORT();
		g_fEndDist = READ_SHORT();
	}
}
开发者ID:JoelTroch,项目名称:am_src_rebirth,代码行数:32,代码来源:hud_msg.cpp


示例3: BEGIN_READ

//LRC
int CHud::MsgFunc_SetFog( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );

	for ( int i = 0; i < 3; i++ )
		 g_fFogColor[ i ] = READ_BYTE();

	g_fFadeDuration = READ_SHORT();
	g_fStartDist = READ_SHORT();

	if (g_fFadeDuration > 0)
	{
//		// fading in
		g_iFinalEndDist = READ_SHORT();
		g_fEndDist = FOG_LIMIT;
	}
	else if (g_fFadeDuration < 0)
	{
//		// fading out
		g_iFinalEndDist = g_fEndDist = READ_SHORT();
	}
	else
	{
		g_fEndDist = READ_SHORT();
	}
	return 1;
}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:28,代码来源:hud_msg.cpp


示例4: MsgFunc_CamData

	// trigger_viewset message
int CHud :: MsgFunc_CamData( const char *pszName, int iSize, void *pbuf ) // rain stuff
{
	BEGIN_READ( pbuf, iSize );
		gHUD.viewEntityIndex = READ_SHORT();
		gHUD.viewFlags = READ_SHORT();
//	gEngfuncs.Con_Printf( "Got view entity with index %i\n", gHUD.viewEntityIndex );
	return 1;
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:9,代码来源:hud_msg.cpp


示例5: MsgFunc_InitHUD

void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
{
	g_iTeleNum = 0;
	g_bLoadedTeles = false;
	int i;

	//Clear all the teleporters
	for ( i = 0; i < MAX_TELES; i++ )
	{
		g_vecTeleMins[ i ].x = 0.0;
		g_vecTeleMins[ i ].y = 0.0;
		g_vecTeleMins[ i ].z = 0.0;

		g_vecTeleMaxs[ i ].x = 0.0;
		g_vecTeleMaxs[ i ].y = 0.0;
		g_vecTeleMaxs[ i ].z = 0.0;
	}

	/***** FOG CLEARING JIBBA JABBA *****/
	for ( i = 0; i < 3; i++ )
		 g_iFogColor[ i ] = 0.0;

	g_iStartDist = 0.0;
	g_iEndDist = 0.0;
	/***** FOG CLEARING JIBBA JABBA *****/

	// prepare all hud data
	HUDLIST *pList = m_pHudList;

	while (pList)
	{
		if ( pList->p )
			pList->p->InitHUDData();
		pList = pList->pNext;
	}

	BEGIN_READ( pbuf, iSize );
	g_iTeleNum = READ_BYTE();

	for ( i = 0; i < g_iTeleNum; i++ )
	{
		g_vecTeleMins[ i ].x = READ_COORD();
		g_vecTeleMins[ i ].y = READ_COORD();
		g_vecTeleMins[ i ].z = READ_COORD();
		g_vecTeleMaxs[ i ].x = READ_COORD();
		g_vecTeleMaxs[ i ].y = READ_COORD();
		g_vecTeleMaxs[ i ].z = READ_COORD();
	}

	for ( i = 0; i < 3; i++ )
		 g_iFogColor[ i ] = READ_SHORT(); // Should just get a byte.

	//If they both are 0, it means no fog for this level.
	g_iStartDist = READ_SHORT(); 
	g_iEndDist = READ_SHORT(); 
}
开发者ID:6779660,项目名称:halflife,代码行数:56,代码来源:hud_msg.cpp


示例6: MsgFunc_ClampView

//LRC 1.8
void CHud :: MsgFunc_ClampView( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );

	g_clampMinYaw = READ_SHORT();
	g_clampMaxYaw = READ_SHORT();
	g_clampMinPitch = READ_BYTE() - 128;
	g_clampMaxPitch = READ_BYTE() - 128;
	*(long*)&g_clampTurnSpeed = READ_LONG();
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:11,代码来源:hud_msg.cpp


示例7: MsgFunc_RainData

int CHud :: MsgFunc_RainData( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );
		Rain.dripsPerSecond =	READ_SHORT();
		Rain.distFromPlayer =	READ_COORD();
		Rain.windX =			READ_COORD();
		Rain.windY =			READ_COORD();
		Rain.randX =			READ_COORD();
		Rain.randY =			READ_COORD();
		Rain.weatherMode =		READ_SHORT();
		Rain.globalHeight =		READ_COORD();
	return 1;
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:13,代码来源:hud_msg.cpp


示例8: MsgFunc_SetFog

int CHud :: MsgFunc_SetFog( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	m_vecFogColor.x = (float)(READ_BYTE() / 255.0f);
	m_vecFogColor.y = (float)(READ_BYTE() / 255.0f);
	m_vecFogColor.z = (float)(READ_BYTE() / 255.0f);

	m_flStartDist = READ_SHORT();
          m_flEndDist = READ_SHORT();

	END_READ();
	
	return 1;
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:15,代码来源:hud_msg.cpp


示例9: MsgFunc_Inventory

int CHud :: MsgFunc_Inventory( const char *pszName, int iSize, void *pbuf ) //AJH inventory system
{
	BEGIN_READ( pbuf, iSize );
		int i = READ_SHORT();

		if (i==0){ //We've died (or got told to lose all items) so remove inventory.
			for (i=0;i<MAX_ITEMS;i++){
				g_iInventory[i]=0;
			}
		}else
		{
			i-=1;	// subtract one so g_iInventory[0] can be used. (lowest ITEM_* is defined as '1')
			g_iInventory[i] = READ_SHORT();
		}
	return 1;
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:16,代码来源:hud_msg.cpp


示例10: BEGIN_READ

/*
====================
MsgCreateSystem

====================
*/
int CParticleEngine::MsgCreateSystem( const char *pszName, int iSize, void *pbuf ) 
{
	BEGIN_READ(pbuf, iSize);

	vec3_t pos;
	pos.x = READ_COORD();
	pos.y = READ_COORD();
	pos.z = READ_COORD();

	vec3_t ang;
	ang.x = READ_COORD();
	ang.y = READ_COORD();
	ang.z = READ_COORD();

	int iType = READ_BYTE();
	char *szPath = READ_STRING();
	int iId = READ_SHORT();

	if(iType == 2)
		RemoveSystem(iId);
	else if(iType == 1)
		CreateCluster(szPath, pos, ang, iId);
	else
		CreateSystem(szPath, pos, ang, iId);

	return 1;
}
开发者ID:RikkaW,项目名称:Trinity-Renderer,代码行数:33,代码来源:particle_engine.cpp


示例11: MsgFunc_ScoreInfo

int CHudScoreboard :: MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf )
{
	m_iFlags |= HUD_ACTIVE;

	BEGIN_READ( pbuf, iSize );
	short cl = READ_BYTE();
	short frags = READ_SHORT();
	short deaths = READ_SHORT();

	if ( cl > 0 && cl <= MAX_PLAYERS )
	{
		m_PlayerExtraInfo[cl].frags = frags;
		m_PlayerExtraInfo[cl].deaths = deaths;
	}

	return 1;
}
开发者ID:HoLyCoWzOrZ,项目名称:sing-engine,代码行数:17,代码来源:scoreboard.cpp


示例12: nv30_parse

static void nv30_parse(struct nvbios *bios, char *rom, unsigned short nv_offset)
{
	unsigned short init_offset = 0;
	unsigned short perf_offset=0;
	unsigned short volt_offset=0;

	int offset = READ_SHORT(rom, nv_offset + 30);
	bios->signon_msg = nv_read(rom, offset);

	init_offset = READ_SHORT(rom, nv_offset + 0x4d);

	volt_offset = READ_SHORT(rom, nv_offset + 0x98);
	parse_voltage_table(bios, rom, volt_offset);

	perf_offset = READ_SHORT(rom, nv_offset + 0x94);
	parse_nv30_performance_table(bios, rom, perf_offset);
}
开发者ID:Beshuta,项目名称:HWSensors,代码行数:17,代码来源:bios.cpp


示例13: MsgFunc_SetFog

//LRC
void CHud :: MsgFunc_SetFog( const char *pszName, int iSize, void *pbuf )
{
//	CONPRINT("MSG:SetFog");
	BEGIN_READ( pbuf, iSize );

	for ( int i = 0; i < 3; i++ )
	{
		g_fogPostFade.fogColor[i] = READ_BYTE();

		if ( g_fog.fogColor[i] >= 0 )
			g_fogPreFade.fogColor[i] = g_fog.fogColor[i];
		else
			g_fogPreFade.fogColor[i] = g_fogPostFade.fogColor[i];
	}

	g_fFogFadeDuration = READ_SHORT();

	g_fogPostFade.startDist = READ_SHORT();
	if ( g_fog.startDist >= 0 )
		g_fogPreFade.startDist = g_fog.startDist;
	else
		g_fogPreFade.startDist = g_fogPostFade.startDist;

	g_fogPostFade.endDist = READ_SHORT();
	if ( g_fog.endDist >= 0 )
		g_fogPreFade.endDist = g_fog.endDist;
	else
		g_fogPreFade.endDist = g_fogPostFade.endDist;

	if ( g_fFogFadeDuration < 0 )
	{
		g_fFogFadeDuration *= -1;
		g_fogPostFade.startDist = FOG_LIMIT;
		g_fogPostFade.endDist = FOG_LIMIT;
	}
	else if ( g_fFogFadeDuration == 0 )
	{
		g_fog.endDist = g_fogPostFade.endDist;
		for ( int i = 0; i < 3; i++ )
		{
			g_fogPreFade.fogColor[i] = g_fog.fogColor[i];
		}
	}
	g_fFogFadeFraction = 0;
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:46,代码来源:hud_msg.cpp


示例14: checkException

static void checkException(std::istream* inputStream) {
    uint16_t retCode;
    READ_SHORT(inputStream, retCode);
    if (retCode != 0) {
        retCode = ntohs(retCode);
        std::auto_ptr<std::string> error(readUTF(inputStream));
        throw VoldemortException(error->c_str());
    }
}
开发者ID:54k,项目名称:voldemort,代码行数:9,代码来源:VoldemortNativeRequestFormat.cpp


示例15: MsgFunc_ShowMenu

// 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.
int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
{
	char *temp = NULL;

	BEGIN_READ( pszName, pbuf, iSize );

	m_bitsValidSlots = READ_SHORT();
	int DisplayTime = READ_CHAR();
	int NeedMore = READ_BYTE();

	if( DisplayTime > 0 )
		m_flShutoffTime = DisplayTime + gHUD.m_flTime;
	else
		m_flShutoffTime = -1;

	if( m_bitsValidSlots )
	{
		if( !m_fWaitingForMore )
		{
			// this is the start of a new menu
			Q_strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING );
		}
		else
		{
			// append to the current menu string
			Q_strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - Q_strlen( g_szPrelocalisedMenuString ));
		}
		g_szPrelocalisedMenuString[MAX_MENU_STRING-1] = 0;  // ensure null termination (strncat/strncpy does not)

		if( !NeedMore )
		{
			// we have the whole string, so we can localise it now
			Q_strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ));

			// Swap in characters
			if( KB_ConvertString( g_szMenuString, &temp ))
			{
				Q_strcpy( g_szMenuString, temp );
				free( temp );
			}
		}

		m_fMenuDisplayed = 1;
		m_iFlags |= HUD_ACTIVE;
	}
	else
	{
		m_fMenuDisplayed = 0; // no valid slots means that the menu should be turned off
		m_iFlags &= ~HUD_ACTIVE;
	}

	m_fWaitingForMore = NeedMore;

	END_READ();

	return 1;
}
开发者ID:emileb,项目名称:XashXT,代码行数:64,代码来源:menu.cpp


示例16: BEGIN_READ

int CHud::MsgFunc_ScreenShake( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	ShakeCommand_t eCommand = (ShakeCommand_t)READ_SHORT();
	float amplitude = (float)(unsigned short)READ_SHORT() * (1.0f / (float)(1<<12));
	float duration = (float)(unsigned short)READ_SHORT() * (1.0f / (float)(1<<12));
	float frequency = (float)(unsigned short)READ_SHORT() * (1.0f / (float)(1<<8));

	if( eCommand == SHAKE_STOP )
	{
		m_Shake.amplitude = 0;
		m_Shake.frequency = 0;
		m_Shake.duration = 0;
	}
	else
	{
		if(( eCommand == SHAKE_START) || ( eCommand == SHAKE_FREQUENCY )) 
		{
			m_Shake.frequency = frequency;
		}

		if(( eCommand == SHAKE_START) || ( eCommand == SHAKE_AMPLITUDE ))
		{
			// don't overwrite larger existing shake unless we are told to.
			if(( amplitude > m_Shake.amplitude ) || ( eCommand == SHAKE_AMPLITUDE ))
			{
				m_Shake.amplitude = amplitude;
			}
		}

		// only reset the timer for a new shake.
		if( eCommand == SHAKE_START )
		{
			m_Shake.duration = duration;
			m_Shake.nextShake = 0;
			m_Shake.time = m_flTime + duration;
		}
	}

	END_READ();

	return 1;
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:44,代码来源:hud_msg.cpp


示例17: BEGIN_READ

int CHudMenu::MsgFunc_VGUIMenu( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ(pbuf, iSize);

	int menuType = READ_BYTE();
	m_bitsValidSlots = READ_SHORT(); // is ignored

	ShowVGUIMenu(menuType);
	return 1;
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:10,代码来源:menu.cpp


示例18: __MsgFunc_TerrainMod

void __MsgFunc_TerrainMod( const char *pszName, int iSize, void *pbuf )
{
	CTerrainModParams params;

	BEGIN_READ( pbuf, iSize );

	unsigned char type = READ_BYTE();

	params.m_vCenter.x = READ_FLOAT();
	params.m_vCenter.y = READ_FLOAT();
	params.m_vCenter.z = READ_FLOAT();

	params.m_flRadius   = RemapVal( READ_SHORT(), 0, 65535, MIN_TMOD_RADIUS, MAX_TMOD_RADIUS );

	params.m_vecMin.x = READ_FLOAT();
	params.m_vecMin.y = READ_FLOAT();
	params.m_vecMin.z = READ_FLOAT();

	params.m_vecMax.x = READ_FLOAT();
	params.m_vecMax.y = READ_FLOAT();
	params.m_vecMax.z = READ_FLOAT();

	params.m_flStrength = READ_FLOAT();

	params.m_Flags = READ_BYTE();

	if( type == TMod_Suck && (params.m_Flags & CTerrainModParams::TMOD_SUCKTONORMAL) )
	{
		params.m_vNormal.x = READ_FLOAT();
		params.m_vNormal.y = READ_FLOAT();
		params.m_vNormal.z = READ_FLOAT();
	}	

	// Apply the decal first because the place where we're applying the decal 
	// may not be there if we blow it out first!
	Vector vPosition(0,0,0);
	QAngle vAngles(0,0,0);
	int iModel = 0;
	C_BaseEntity *ent = cl_entitylist->GetEnt( iModel );
	if( ent && type == TMod_Sphere )
	{
		effects->DecalShoot( 
			effects->Draw_DecalIndexFromName( "decals/tscorch" ), 
			iModel, 
			ent->GetModel(), 
			vPosition, 
			vAngles, 
			params.m_vCenter, 
			NULL, 
			0 );
	}

	engine->ApplyTerrainMod( (TerrainModType)type, params );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:54,代码来源:c_terrainmodmgr.cpp


示例19: MsgFunc_CamData

int CHud :: MsgFunc_CamData( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	gHUD.viewEntityIndex = READ_SHORT();
	gHUD.viewFlags = READ_SHORT();

	if( gHUD.viewFlags )
		m_iCameraMode = 1;
	else m_iCameraMode = m_iLastCameraMode;

	// update pparams->viewentity too for right hearing
	if( gHUD.viewEntityIndex )
		gpViewParams->viewentity = gHUD.viewEntityIndex;
	else gpViewParams->viewentity = GetLocalPlayer()->serialnumber;

	END_READ();
	
	return 1;
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:20,代码来源:hud_msg.cpp


示例20: BEGIN_READ

int CHudRadio::MsgFunc_SendAudio(const char *pszName, int iSize, void *pbuf)
{
	BEGIN_READ( pbuf, iSize );

	m_bFirst = READ_BYTE( );
	strcpy( m_sentence, READ_STRING( ));
	m_sThird = READ_SHORT( );
	m_enableRadio = true;

	return 1;
}
开发者ID:RomkaZVO,项目名称:cs16-client,代码行数:11,代码来源:radio.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ READ_STRING函数代码示例发布时间:2022-05-30
下一篇:
C++ READ_REG32函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap