void AddFragFn(int argc, char **argv)
{
	uint32 nID = 0;
	int nFragCount =0;
	if (argc > 0)
	{
		nID =  (uint32)atoi(argv[0]);
		if (argc > 1)
		{
			nFragCount = atoi(argv[1]);
		}
	}

	CClientInfoMgr *pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
	if (pCIMgr)
	{
		CLIENT_INFO *ptr = pCIMgr->GetFirstClient();
		while (ptr)
		{
			if (ptr->nID == nID)
			{
				pCIMgr->AddFrag(nID);
				break;
			}
			ptr = ptr->pNext;
		}
	}

}
Ejemplo n.º 2
0
void CCheatMgr::BootPlayer(CParsedMsgW const& cMsg)
{
	if (!IsMultiplayerGameClient()) return;

	CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
	if (!pCIMgr) return;

	if( cMsg.GetArgCount() < 2 )
		return;

	// The full name of the player might be split between several 
	// arguments of the message so build the name from all arguments
	// except the name of the actual cheat (Arg 1).
	
	wchar_t szPlayerName[MAX_PLAYER_NAME] = {0};
	cMsg.ReCreateMsg( szPlayerName, LTARRAYSIZE( szPlayerName ), 1 );

	CLIENT_INFO* pInfo = pCIMgr->GetFirstClient();
	while (pInfo && LTStrICmp(pInfo->sName.c_str(),szPlayerName) != 0)
		pInfo = pInfo->pNext;

	if (pInfo)
	{

		// Tell the server
		SendCheatMessage( CHEAT_BOOT, pInfo->nID );
	}
}
void ListClientFn(int argc, char **argv)
{
	CClientInfoMgr *pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
	if (pCIMgr)
	{
		CLIENT_INFO *ptr = pCIMgr->GetFirstClient();
		while (ptr)
		{
			g_pLTClient->CPrint("%d %s %d",ptr->nID,g_pLTClient->GetStringData(ptr->hstrName),ptr->nFrags);
			ptr = ptr->pNext;
		}
	}

}
Ejemplo n.º 4
0
void CHUDScoreDiff::Update()
{
	if (!IsMultiplayerGameClient()) return;

	if (GameModeMgr::Instance( ).m_grbEliminationWin)
	{
		CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
		if (!pCIMgr) return;

		CLIENT_INFO* pCI = pCIMgr->GetFirstClient();

		int32 nEnemiesLeft = 0;
		while (pCI)
		{
			if (pCI && pCI != g_pInterfaceMgr->GetClientInfoMgr()->GetLocalClient())
			{
				CCharacterFX* pCharacter = g_pGameClientShell->GetSFXMgr()->GetCharacterFromClientID(pCI->nID);
				if (pCharacter &&  !pCharacter->IsPlayerDead() && !pCharacter->m_cs.bIsSpectating )
				{
					if (GameModeMgr::Instance( ).m_grbUseTeams)
					{
						if (!pCIMgr->IsLocalTeam(pCI->nTeamID)) 
						{
							++nEnemiesLeft;
						}
					}
					else
					{
						++nEnemiesLeft;
					}
				}
			}
			pCI = pCI->pNext;
		}
		wchar_t wsScore[16] = L"";
		FormatString("HUD_Score_Format",wsScore,LTARRAYSIZE(wsScore),nEnemiesLeft);
		m_Text.SetText(wsScore);
		m_Text.SetColor(m_cTextColor);
	}
	else
	{
		int32 nLocalScore = 0;
		int32 nOtherScore = 0;
		if (GameModeMgr::Instance( ).m_grbUseTeams)
		{
			uint8 nTeam = g_pInterfaceMgr->GetClientInfoMgr()->GetLocalTeam();
			CTeam* pTeam = CTeamMgr::Instance().GetTeam(nTeam);
			if (pTeam)
			{
				nLocalScore = pTeam->GetScore();
			}

			nTeam = 1-nTeam;
			pTeam = CTeamMgr::Instance().GetTeam(nTeam);
			if (pTeam)
			{
				nOtherScore = pTeam->GetScore();
			}
		}
		else
		{
			CLIENT_INFO* pCI = g_pInterfaceMgr->GetClientInfoMgr()->GetLocalClient();
			if (pCI)
			{
				nLocalScore = pCI->sScore.GetScore();
			}

			pCI = g_pInterfaceMgr->GetClientInfoMgr()->GetFirstClient();
			if (pCI && pCI == g_pInterfaceMgr->GetClientInfoMgr()->GetLocalClient())
			{
				pCI = pCI->pNext;
			}
			if (pCI)
			{
				nOtherScore = pCI->sScore.GetScore();
			}
		}
		wchar_t wsScore[16] = L"";
		int32 nDiff = (nLocalScore-nOtherScore);

		FormatString("HUD_Score_Format",wsScore,LTARRAYSIZE(wsScore),nDiff);
		if (nDiff > 0)
		{
			m_Text.SetColor(m_cWinningTextColor);
			FormatString("HUD_Score_Format_Advantage",wsScore,LTARRAYSIZE(wsScore),nDiff);
		}
		else if (nDiff == 0)
		{
			m_Text.SetColor(m_cTextColor);
		}
		else
		{
			m_Text.SetColor(m_cLosingTextColor);
		}

		m_Text.SetText(wsScore);

	}

}
Ejemplo n.º 5
0
void CHUDScores::Update()
{
	if (m_nDraw <= 0) return;

	uint32 textCol = (m_bScreen ? m_nScreenTextColor : m_nTextColor);
	uint32 playerTextCol = (m_bScreen ? m_nScreenPlayerTextColor : m_nPlayerTextColor);

	float fScale = g_pInterfaceResMgr->GetXRatio();
	if (fScale != m_fScale)
	{
		m_fScale = fScale;
		m_Server.SetScale(fScale);
		m_SingleFrame.SetScale(fScale);
		for (int team = 0; team < kNumTeams; team++)
		{
			m_Team[team].SetScale(fScale);
			m_Rounds[team].SetScale(fScale);
			m_Header[team].SetScale(fScale);
			m_Frame[team].SetScale(fScale);

			for (int i = 0; i < kMaxPlayers; i++)
			{
				m_Columns[team][i].SetScale(fScale);
			}
		}

	}

	if (IsTeamGameType())
	{
		CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();

		for( uint8 team = 0; team < kNumTeams; ++team )
		{
			CTeam* pTeam = CTeamMgr::Instance().GetTeam(team);
			if (!pTeam) continue;
			
			char szTmp[128];
			sprintf(szTmp,"%s : %d",pTeam->GetName(),pTeam->GetScore());
			m_Team[team].SetString(szTmp);

			sprintf(szTmp,"%s : %d", LoadTempString(IDS_ROUNDS), pTeam->GetRoundScore( ));
			m_Rounds[team].SetString(szTmp);
		
			m_Header[team].Show(LTTRUE);
		}

	}
	else
	{
		m_Team[0].SetString("");
		m_Rounds[0].SetString("");
		m_Header[1].Show(LTFALSE);
	}


	m_Server.SetColors(textCol,textCol,textCol);

	CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
	if (!pCIMgr) return;

	CLIENT_INFO* pCI = pCIMgr->GetFirstClient();
	int nTotal = 0;
	int count[kNumTeams] = {0,0};
	char szTmp[64] = "";
	uint16 nHeight[kNumTeams];
	nHeight[0] = m_Server.GetBaseHeight() + m_Header[0].GetBaseHeight() + m_Team[0].GetBaseHeight() + 24;
	nHeight[1] = m_Team[1].GetBaseHeight() + m_Header[1].GetBaseHeight() + 16;
	uint32 nLocalID = 0;
	g_pLTClient->GetLocalClientID (&nLocalID);


	while (pCI && (nTotal < kMaxPlayers))
	{
		uint8 nTeam = 0;
		
		if (IsTeamGameType())
		{
			nTeam = pCI->nTeamID;
		}


		int ndx = count[nTeam];


		
		if (nTeam < kNumTeams)
		{
			sprintf( szTmp, "%s%s",pCI->sName.c_str( ), pCI->bIsAdmin ? "[*]" : "" );
			m_Columns[nTeam][ndx].GetPolyString(0)->SetText( szTmp );
			sprintf(szTmp,"%d",pCI->sScore.GetScore());
			m_Columns[nTeam][ndx].GetPolyString(1)->SetText(szTmp);

			sprintf(szTmp,"%d",pCI->sScore.GetFrags());
			m_Columns[nTeam][ndx].GetPolyString(2)->SetText(szTmp);

			sprintf(szTmp,"%d",pCI->sScore.GetTags());
			m_Columns[nTeam][ndx].GetPolyString(3)->SetText(szTmp);

			sprintf(szTmp,"%d",pCI->nPing);
			m_Columns[nTeam][ndx].GetPolyString(4)->SetText(szTmp);

			if (nLocalID == pCI->nID)
			{
				m_Columns[nTeam][ndx].SetColors(playerTextCol,playerTextCol,playerTextCol);
			}
			else
			{
				m_Columns[nTeam][ndx].SetColors(textCol,textCol,textCol);
			}
			
			m_Columns[nTeam][ndx].Show(LTTRUE);

			nHeight[nTeam] += m_Columns[nTeam][ndx].GetBaseHeight();
		}

		pCI = pCI->pNext;
		++count[nTeam];
	}


	
	for (int team = 0; team < kNumTeams; team++)
	{

		m_Team[team].SetColors(textCol,textCol,textCol);
		m_Rounds[team].SetColors(textCol,textCol,textCol);
		m_Header[team].SetColors(textCol,textCol,textCol);

		nHeight[team] += 16;
		m_Frame[team].SetSize(m_nFrameWidth,nHeight[team]);

		while (count[team] < kMaxPlayers)
		{
			m_Columns[team][count[team]].Show(LTFALSE);
			++count[team];
		}

		LTIntPt pos = m_BasePos;
		if (IsTeamGameType() && team > 0)
		{
			pos.y += nHeight[team-1] + 8;
			UpdateTeamPos(team,pos);
		}

	}
	m_SingleFrame.SetSize(m_nFrameWidth,nHeight[0]+8);


	
}
Ejemplo n.º 6
0
void CHUDScores::Update()
{
    if( !m_bInitialized )
        return;

    if( !m_bDraw )
        return;

//	uint32 textCol = (m_bScreen ? m_cScreenTextColor : m_cTextColor);
//	uint32 playerTextCol = (m_bScreen ? m_cScreenPlayerTextColor : m_cPlayerTextColor);

    //for the screen mode scoreboard, don't update the text once we've drawn it
    if (m_bScreen && !m_bFirstScreenUpdate)
        return;

    m_bFirstScreenUpdate = false;

    if (GameModeMgr::Instance( ).m_grbUseTeams)
    {
        for( uint8 nTeamNum = 0; nTeamNum < kNumTeams; ++nTeamNum )
        {
            uint8 team;
            if (g_pInterfaceMgr->GetClientInfoMgr()->IsLocalTeam(nTeamNum))
                team = 0;
            else
                team = 1;

            CTeam* pTeam = CTeamMgr::Instance().GetTeam(nTeamNum);
            if (!pTeam) continue;

            wchar_t wszTmp[128];
            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%s : %d",pTeam->GetName(),pTeam->GetScore());
            m_Team[team].SetString(wszTmp);

            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%s : %d", LoadString("IDS_ROUNDS"), pTeam->GetRoundScore( ));
            m_Rounds[team].SetString(wszTmp);

            m_Header[team].Show(true);
        }

    }
    else
    {
        m_Team[0].SetString(L"");
        m_Rounds[0].SetString(L"");
        m_Header[1].Show(false);
    }


    m_Server.SetColor(m_cTextColor);

    if ( !GameModeMgr::Instance( ).m_grwsSessionName.GetValue().empty())
    {
        std::wstring wstr = GameModeMgr::Instance( ).m_grwsSessionName;
        if ( g_pClientConnectionMgr->IsConnectedToRemoteServer( ))
        {
            wstr += L" : ";
            wstr += MPA2W(g_pClientConnectionMgr->GetStartGameRequest( ).m_TCPAddress).c_str();
        }

        m_Server.SetString(wstr.c_str());
    }
    else
    {
        m_Server.SetString(L"");
    }

    // Update the round counter.
    m_RoundInfo.SetColor(m_cTextColor);
    wchar_t wszRound[32];
    uint8 nCurrentRound = g_pClientConnectionMgr ? g_pClientConnectionMgr->GetCurrentRound() : 0;
    uint8 nNumRounds = GameModeMgr::Instance( ).m_grnNumRounds;
    FormatString( "HUD_SCORES_ROUNDINFO", wszRound, LTARRAYSIZE( wszRound ), nCurrentRound + 1, nNumRounds );
    m_RoundInfo.SetString( wszRound );

    CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
    if (!pCIMgr) return;

    CLIENT_INFO* pCI = pCIMgr->GetFirstClient();
    int nTotal = 0;
    int count[kNumTeams] = {0,0};
    wchar_t wszTmp[64] = L"";
    uint32 nHeight[kNumTeams];
    nHeight[0] = m_Server.GetBaseHeight() + m_Header[0].GetBaseHeight() + m_Team[0].GetBaseHeight() + 24;
    nHeight[1] = m_Team[1].GetBaseHeight() + m_Header[1].GetBaseHeight() + 16;
    uint32 nLocalID = 0;
    g_pLTClient->GetLocalClientID (&nLocalID);


    while (pCI && (nTotal < kMaxPlayers))
    {
        uint8 nTeam = 0;
        CCharacterFX* pCharacter = g_pGameClientShell->GetSFXMgr()->GetCharacterFromClientID(pCI->nID);

        if (GameModeMgr::Instance( ).m_grbUseTeams)
        {
            if (g_pInterfaceMgr->GetClientInfoMgr()->IsLocalTeam(pCI->nTeamID))
                nTeam = 0;
            else
                nTeam = 1;
        }


        int ndx = count[nTeam];



        if (nTeam < kNumTeams)
        {
            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%s%s",pCI->sName.c_str( ), pCI->bIsAdmin ? L"[*]" : L"" );
            m_Columns[nTeam][ndx].SetString( eColumnName, wszTmp );

            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%d",pCI->sScore.GetScore());
            m_Columns[nTeam][ndx].SetString( eColumnScore, wszTmp );

            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%d",pCI->sScore.GetEventCount(CPlayerScore::eKill));
            m_Columns[nTeam][ndx].SetString( eColumnKill, wszTmp );

            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%d",pCI->sScore.GetEventCount(CPlayerScore::eDeath));
            m_Columns[nTeam][ndx].SetString( eColumnDeath, wszTmp );

            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%d",pCI->sScore.GetEventCount(CPlayerScore::eObjective));
            m_Columns[nTeam][ndx].SetString( eColumnObjective, wszTmp );

            if (GameModeMgr::Instance( ).m_grbUseTeams)
            {
                LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%d",pCI->sScore.GetEventCount(CPlayerScore::eTeamKill));
                m_Columns[nTeam][ndx].SetString( eColumnTK, wszTmp );
                m_Columns[nTeam][ndx].ShowColumn(eColumnTK, true);
            }
            else
            {
                m_Columns[nTeam][ndx].ShowColumn(eColumnTK, false);
            }


            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%d",pCI->sScore.GetEventCount(CPlayerScore::eSuicide));
            m_Columns[nTeam][ndx].SetString( eColumnSuicide, wszTmp );

            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%d",pCI->nPing);
            m_Columns[nTeam][ndx].SetString( eColumnPing, wszTmp );

            if (nLocalID == pCI->nID)
            {
                if (!pCharacter || pCharacter->IsPlayerDead() || pCharacter->m_cs.bIsSpectating )
                    m_Columns[nTeam][ndx].SetColor(m_cPlayerDeadColor);
                else
                    m_Columns[nTeam][ndx].SetColor(m_cPlayerTextColor);
            }
            else
            {
                if (!pCharacter || pCharacter->IsPlayerDead() || pCharacter->m_cs.bIsSpectating )
                    m_Columns[nTeam][ndx].SetColor(m_cDeadColor);
                else
                    m_Columns[nTeam][ndx].SetColor(m_cTextColor);
            }

            m_Columns[nTeam][ndx].Show(true);

            nHeight[nTeam] += m_Columns[nTeam][ndx].GetBaseHeight();
        }

        pCI = pCI->pNext;
        ++count[nTeam];
    }



    for (uint8 team = 0; team < kNumTeams; team++)
    {

        m_Team[team].SetColor(m_cTextColor);
        m_Rounds[team].SetColor(m_cTextColor);
        m_Header[team].SetColor(m_cTextColor);

        nHeight[team] += 16;
        m_Frame[team].SetSize(LTVector2n(m_nFrameWidth,nHeight[team]));

        while (count[team] < kMaxPlayers)
        {
            m_Columns[team][count[team]].Show(false);
            ++count[team];
        }

        LTVector2n pos = m_vBasePos;
        g_pInterfaceResMgr->ScaleScreenPos(pos);
        if (GameModeMgr::Instance( ).m_grbUseTeams && team > 0)
        {
            pos.y += nHeight[team-1] + 8;
        }
        UpdateTeamPos(team,pos);

    }
    m_SingleFrame.SetSize(LTVector2n(m_nFrameWidth,nHeight[0]+8));
}