本文整理汇总了C++中bf_read::ReadChar方法的典型用法代码示例。如果您正苦于以下问题:C++ bf_read::ReadChar方法的具体用法?C++ bf_read::ReadChar怎么用?C++ bf_read::ReadChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bf_read
的用法示例。
在下文中一共展示了bf_read::ReadChar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MsgFunc_ShowMenu
//-----------------------------------------------------------------------------
// 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;
}
示例2: HandleMessage
//.........这里部分代码省略.........
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;
return true;
}
if (type == 10)//svc_ClassInfo
{
int classes = msg.ReadShort();
int useclientclasses = msg.ReadOneBit();
unsigned int size = (int)(log2(classes) + 1);
if (useclientclasses == 0)