core/MenuStyle_Radio.cpp
changeset 785 bca431afd754
parent 780 570fa34723bf
child 787 52283fe61d42
     1.1 --- a/core/MenuStyle_Radio.cpp	Sun May 13 07:48:36 2007 +0000
     1.2 +++ b/core/MenuStyle_Radio.cpp	Sun May 13 17:12:16 2007 +0000
     1.3 @@ -20,13 +20,20 @@
     1.4  extern const char *g_RadioNumTable[];
     1.5  CRadioStyle g_RadioMenuStyle;
     1.6  int g_ShowMenuId = -1;
     1.7 +bool g_bRadioInit = false;
     1.8  
     1.9  CRadioStyle::CRadioStyle() : m_players(new CBaseMenuPlayer[256+1])
    1.10  {
    1.11  }
    1.12  
    1.13 -void CRadioStyle::OnSourceModAllInitialized()
    1.14 +void CRadioStyle::OnSourceModLevelChange(const char *mapName)
    1.15  {
    1.16 +	if (g_bRadioInit)
    1.17 +	{
    1.18 +		return;
    1.19 +	}
    1.20 +
    1.21 +	g_bRadioInit = true;
    1.22  	const char *msg = g_pGameConf->GetKeyValue("HudRadioMenuMsg");
    1.23  	if (!msg || msg[0] == '\0')
    1.24  	{
    1.25 @@ -66,8 +73,10 @@
    1.26  		{
    1.27  			return false;
    1.28  		}
    1.29 +
    1.30  		int arg = atoi(engine->Cmd_Argv(1));
    1.31  		ClientPressedKey(client, arg);
    1.32 +		return true;
    1.33  	}
    1.34  
    1.35  	return false;
    1.36 @@ -161,6 +170,7 @@
    1.37  	m_BufferText.assign("");
    1.38  	m_Title.assign("");
    1.39  	m_NextPos = 1;
    1.40 +	keys = 0;
    1.41  }
    1.42  
    1.43  bool CRadioDisplay::SendDisplay(int client, IMenuHandler *handler, unsigned int time)
    1.44 @@ -198,25 +208,27 @@
    1.45  	{
    1.46  		if (item.style & ITEMDRAW_SPACER)
    1.47  		{
    1.48 -			m_BufferText.append("\n");
    1.49 +			m_BufferText.append(" \n");
    1.50  		} else {
    1.51  			m_BufferText.append(item.display);
    1.52  			m_BufferText.append("\n");
    1.53  		}
    1.54  		return 0;
    1.55  	} else if (item.style & ITEMDRAW_SPACER) {
    1.56 -		m_BufferText.append("\n");
    1.57 +		m_BufferText.append(" \n");
    1.58 +		return m_NextPos++;
    1.59 +	} else if (item.style & ITEMDRAW_NOTEXT) {
    1.60  		return m_NextPos++;
    1.61  	}
    1.62  
    1.63  	if (item.style & ITEMDRAW_DISABLED)
    1.64  	{
    1.65  		m_BufferText.append(g_RadioNumTable[m_NextPos]);
    1.66 -		m_BufferText.append(". ");
    1.67  		m_BufferText.append(item.display);
    1.68  		m_BufferText.append("\n");
    1.69  	} else {
    1.70 -		m_BufferText.append("->. ");
    1.71 +		m_BufferText.append("->");
    1.72 +		m_BufferText.append(g_RadioNumTable[m_NextPos]);
    1.73  		m_BufferText.append(item.display);
    1.74  		m_BufferText.append("\n");
    1.75  		keys |= (1<<(m_NextPos-1));
    1.76 @@ -232,6 +244,11 @@
    1.77  		return false;
    1.78  	}
    1.79  
    1.80 +	if ((drawFlags & ITEMDRAW_DISABLED) && (drawFlags & ITEMDRAW_CONTROL))
    1.81 +	{
    1.82 +		return false;
    1.83 +	}
    1.84 +
    1.85  	return true;
    1.86  }
    1.87  
    1.88 @@ -301,5 +318,5 @@
    1.89  
    1.90  const char *g_RadioNumTable[11] = 
    1.91  {
    1.92 -	"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"
    1.93 +	"0. ", "1. ", "2. ", "3. ", "4. ", "5. ", "6. ", "7. ", "8. ", "9. ", "0. "
    1.94  };