core/HalfLife2.cpp
changeset 1218 a4e82ef4e7ef
parent 1132 e8d4e82e9541
child 1231 17badaf66ce4
     1.1 --- a/core/HalfLife2.cpp	Mon Jul 30 20:26:18 2007 +0000
     1.2 +++ b/core/HalfLife2.cpp	Mon Jul 30 23:16:58 2007 +0000
     1.3 @@ -85,6 +85,8 @@
     1.4  void CHalfLife2::OnSourceModAllInitialized()
     1.5  {
     1.6  	m_MsgTextMsg = g_UserMsgs.GetMessageIndex("TextMsg");
     1.7 +	m_HinTextMsg = g_UserMsgs.GetMessageIndex("HintText");
     1.8 +	m_VGUIMenu = g_UserMsgs.GetMessageIndex("VGUIMenu");
     1.9  	g_ShareSys.AddInterface(NULL, this);
    1.10  }
    1.11  
    1.12 @@ -260,3 +262,57 @@
    1.13  
    1.14  	return true;
    1.15  }
    1.16 +
    1.17 +bool CHalfLife2::HinTextMsg(int client, const char *msg)
    1.18 +{
    1.19 +	bf_write *pBitBuf = NULL;
    1.20 +	cell_t players[] = {client};
    1.21 +
    1.22 +	if ((pBitBuf = g_UserMsgs.StartMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
    1.23 +	{
    1.24 +		return false;
    1.25 +	}
    1.26 +
    1.27 +	pBitBuf->WriteByte(1);
    1.28 +	pBitBuf->WriteString(msg);
    1.29 +	g_UserMsgs.EndMessage();
    1.30 +
    1.31 +	return true;
    1.32 +}
    1.33 +
    1.34 +bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show)
    1.35 +{
    1.36 +	bf_write *pBitBuf = NULL;
    1.37 +	KeyValues *SubKey = NULL;
    1.38 +	int count = 0;
    1.39 +	cell_t players[] = {client};
    1.40 +
    1.41 +	if ((pBitBuf = g_UserMsgs.StartMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
    1.42 +	{
    1.43 +		return false;
    1.44 +	}
    1.45 +
    1.46 +	if (data)
    1.47 +	{
    1.48 +		SubKey = data->GetFirstSubKey();
    1.49 +		while (SubKey)
    1.50 +		{
    1.51 +			count++;
    1.52 +			SubKey = SubKey->GetNextKey();
    1.53 +		}
    1.54 +		SubKey = data->GetFirstSubKey();
    1.55 +	}
    1.56 +
    1.57 +	pBitBuf->WriteString(name);
    1.58 +	pBitBuf->WriteByte((show) ? 1 : 0);
    1.59 +	pBitBuf->WriteByte(count);
    1.60 +	while (SubKey)
    1.61 +	{
    1.62 +		pBitBuf->WriteString(SubKey->GetName());
    1.63 +		pBitBuf->WriteString(SubKey->GetString());
    1.64 +		SubKey = SubKey->GetNextKey();
    1.65 +	}
    1.66 +	g_UserMsgs.EndMessage();
    1.67 +
    1.68 +	return true;
    1.69 +}