コード例 #1
0
void StaticMap::SendPosition(Player *player)
{
    switch (PosType())
    {
    case POSITION_SIMPLE :
        player->SendSimplePositionalUpdate(
                            GameID(),
                            PosInfo());
        break;

    case POSITION_PLANET :
        player->SendPlanetPositionalUpdate(
                            GameID(),
                            PosInfo());
        break;

    case POSITION_CONSTANT :
        player->SendConstantPositionalUpdate(
                            GameID(),
                            PosX(),
                            PosY(),
                            PosZ(),
                            Orientation());
        break;
    }
}
コード例 #2
0
ファイル: Box.cpp プロジェクト: marvelman610/tmntactis
void CBox::Render()
{
	m_pTM->DrawWithZSort(CurrImage(), PosX(), PosY(), PosZ(), m_fScaleX, m_fScaleY, NULL, 0.0f, 0.0f, 0.0f, D3DCOLOR_ARGB(m_nAlpha, 255, 255, 255));
	
	for (int i = 0; i < m_nNumItems; ++i)
	{
// 		if(m_Timer.GetElapsed() > 0.0475f && (i == m_nCurrSelectedIndex || i == m_nCurrInputIndex))
// 			continue;
		if (i == m_nCurrSelectedIndex || i == m_nCurrInputIndex)	// color the currently selected item
			m_dwColor = D3DCOLOR_ARGB(m_nAlpha, 255,50,50/*r, g, b*/);
		else
			m_dwColor = D3DCOLOR_ARGB(m_nAlpha, 255,255,255/*r, g, b*/);
		if (!m_bHasTitle || i > 0)
		{
			if (!m_bCenterText)
				m_pBM->DrawString(m_sItems[i].c_str(), m_nStartTextX, m_nStartTextY+(int)((float)i*((float)m_nSpacing*1.5f)), m_fTextZ, m_fTextScale, m_dwColor);
			else
				m_pBM->DrawStringAutoCenterBox(m_sItems[i].c_str(), m_nBoxWidth, m_nPosX, m_nStartTextY+(int)((float)i*((float)m_nSpacing*1.5f)), m_fTextZ, m_fTextScale, m_dwColor);
		}
		else // drawing the Title text, centered, and underlined
		{
			int centerBox = m_nBoxRight - (m_nBoxWidth >> 1);
			int centerStr = (m_nTitleWidth >> 1);
			m_pBM->DrawString(m_sItems[i].c_str(), centerBox-centerStr, m_nStartTextY+(int)((float)i*((float)m_nSpacing*1.5f)), m_fTextZ, m_fTextScale, m_dwColor);
			m_pD3D->DrawLine(centerBox-centerStr+5, m_nStartTextY + (int)((float)m_nSpacing*1.2f), centerBox-centerStr + m_nTitleWidth, m_nStartTextY + (int)((float)m_nSpacing*1.2f),
								0, 0, 0);
		}
	}
// 	else
// 	{
// 		m_dwColor = D3DCOLOR_ARGB(m_nAlpha, 255,50,50/*r, g, b*/);
// 		int centerBox = m_nBoxRight - (m_nBoxWidth >> 1);
// 		int centerStr = (m_nTitleWidth >> 1);
// 		m_pBM->DrawString(m_sInput.c_str(), centerBox-centerStr, m_nStartTextY, m_fTextZ, m_fTextScale, m_dwColor);
// 
// 	}
	if (m_nBackType == BOX_WITH_BACK)
	{
		if (m_nCurrSelectedIndex == BTN_BACK)
			m_dwColor = D3DCOLOR_ARGB(m_nAlpha, 255,50,50/*r, g, b*/);
		else
			m_dwColor = D3DCOLOR_ARGB(m_nAlpha, 255,255,255/*r, g, b*/);
		if (!m_bIsMsgBox)
			m_pBM->DrawString("BACK-ESC", (m_nBoxRight-(25+(int)(300.0f*m_fTextScale*0.8f))), m_nBoxBottom-(int)(40.0f*m_fTextScale), m_fTextZ, m_fTextScale * 0.7f, m_dwColor);
		else
			m_pBM->DrawString("OK", (m_nBoxRight-(25+(int)(300.0f*m_fTextScale*0.8f))), m_nBoxBottom-(int)(40.0f*m_fTextScale), m_fTextZ, m_fTextScale * 0.7f, m_dwColor);
	}
	if (m_bAcceptInput)
	{
	    if (m_nCurrSelectedIndex == BTN_ENTER || m_nCurrInputIndex == BTN_ENTER)
			m_dwColor = D3DCOLOR_ARGB(m_nAlpha, 255,50,50/*r, g, b*/);
		else
			m_dwColor = D3DCOLOR_ARGB(m_nAlpha, 255,255,255/*r, g, b*/);
		if (m_bAcceptInput)
			m_pBM->DrawString("ENTER", m_nPosX+25, m_nBoxBottom-(int)(40.0f*m_fTextScale), m_fTextZ, m_fTextScale * 0.7f, m_dwColor );
	}
}
コード例 #3
0
bool Player::FireEnergyCannon(ItemInstance *item)
{
    float pos[3];
    float *_heading = Heading();
    float range = (float)item->WeaponRange;
    
    if (GetEnergyValue() < item->EnergyUse)
    {
        SendVaMessage("Not enough energy! Need: %f", item->EnergyUse);
        return false;
    }
   
    /* Use the energy */
    RemoveEnergy(item->EnergyUse);
       
    pos[0] = PosX() + ( range * _heading[0] );
    pos[1] = PosY() + ( range * _heading[1] );
    pos[2] = PosZ() + ( range * _heading[2] );
   
    RangeListVec::iterator itrRList;
    Player *p = (0);
    
	while (g_PlayerMgr->GetNextPlayerOnList(p, m_RangeList))
	{        
        p->PointEffect(pos, 1017, 3.0f);
        //see if this player is in range of explosion.
        float range_to_blast = p->RangeFrom(pos, true);
        if (p != this)
        {
            SendVaMessage("Range to blast: %.2f", range_to_blast);
        }
        if (range_to_blast < 1000.0f)
        {
            float damage = p->CaughtInEnergyBlast(GameID(), range_to_blast);
            if (damage > 0)
            {
                SendVaMessage("Blast Damage: %.2f", damage);
                SendClientDamage(p->GameID(), GameID(), damage, 0, 0);
            }
        }
    }

    return true;
}