本文整理汇总了C++中READ_SHORT函数的典型用法代码示例。如果您正苦于以下问题:C++ READ_SHORT函数的具体用法?C++ READ_SHORT怎么用?C++ READ_SHORT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了READ_SHORT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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());
}
}
示例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;
}