예제 #1
0
    ChatListItem(ChatInfo* pchatInfo, const WinPoint& ptLineSize) :
        m_lData((long)pchatInfo),
        m_pchatInfo(pchatInfo),
        m_ptLineSize(ptLineSize)
    {
        ZString strMsg = CensorBadWords (m_pchatInfo->GetMessage());
		IEngineFont* pfont = pchatInfo->IsFromLeader() ? TrekResources::SmallBoldFont() : TrekResources::SmallFont();
        int nStrLenLeft = strMsg.GetLength();
        int nStrLenLine;
        while ((nStrLenLine = pfont->GetMaxTextLength(strMsg, ptLineSize.X(), true))
                < nStrLenLeft)
        {
            int nStrLenWordBreak = nStrLenLine;
            while (nStrLenWordBreak > 2 && strMsg[nStrLenWordBreak] != ' ' && strMsg[nStrLenWordBreak-1] != ' ')
                nStrLenWordBreak--;
            if (nStrLenWordBreak != 2)
                nStrLenLine = nStrLenWordBreak;
            
            if (nStrLenLine <= 2)
            {
                // put a blank line without the character
                nStrLenLine = 3;
                m_vMsgLines.PushEnd("");
            }
            else
            {
                m_vMsgLines.PushEnd(strMsg.Left(nStrLenLine));
            }
            strMsg = "  " + strMsg.RightOf(nStrLenLine);
            nStrLenLeft -= nStrLenLine - 2;
            ZAssert(strMsg.GetLength() == nStrLenLeft);
        }
        m_vMsgLines.PushEnd(strMsg);
    }
    BOOL EnumObjectsCallback(
        LPCDIDEVICEOBJECTINSTANCE pddoi
    ) {
        if (
               pddoi->dwType & DIDFT_AXIS
            || pddoi->dwType & DIDFT_POV
        ) {
            int index;

                   if (pddoi->guidType == GUID_XAxis ) {
                index = 0;                           
            } else if (pddoi->guidType == GUID_YAxis ) {
                index = 1;
            } else if (pddoi->guidType == GUID_Slider) {
                index = 2;
            } else if (pddoi->guidType == GUID_RzAxis) {
                index = 3;
            } else if (pddoi->guidType == GUID_POV   ) {
                index = 4;
            } else {
                index = -1;
            }

            ValueDDInputObject* pobject =
                new ValueDDInputObject(
                    pddoi->tszName,
                    pddoi->dwType,
                    pddoi->guidType
                );

            if (index == -1) {
                m_vvalueObject.PushEnd(pobject);
            } else {
                m_vvalueObject.Set(index, pobject);
            }
        } else if (pddoi->dwType & DIDFT_PSHBUTTON) {
            ButtonDDInputObject* pobject =
                new ButtonDDInputObject(
                    pddoi->tszName,
                    pddoi->dwType,
                    pddoi->guidType
                );

            m_vbuttonObject.PushEnd(pobject);
        } 

        return DIENUM_CONTINUE;
    }
예제 #3
0
    //////////////////////////////////////////////////////////////////////////////
	// EnumerateDisplayModes()
	// Using the D3D9 interface, grab all available display modes and add
	// to the vector of available modes.
	// For now, we'll just interrogate the primary device, although this should
	// be extended to all devices, so the user could select which monitor the game
	// is displayed on. We are also sticking with 16 bit format for now too,
	// although we really want to move to 32 bit.
    //////////////////////////////////////////////////////////////////////////////
	HRESULT EnumerateDisplayModes( )
	{
		DWORD i;
		D3DFORMAT			desiredFormat = D3DFMT_R5G6B5;
		DWORD				dwModeCount = m_pd3d->GetAdapterModeCount( D3DADAPTER_DEFAULT, desiredFormat );
		D3DDISPLAYMODE		dispMode;
		WinPoint			winSize;

		for( i=0; i<dwModeCount; i++ )
		{
			if( m_pd3d->EnumAdapterModes(	D3DADAPTER_DEFAULT,
											desiredFormat,
											i,
											&dispMode ) != D3D_OK )
			{
				OutputDebugString( "Failed to enumerate adapter modes.\n");
				_ASSERT( false );
				return E_FAIL;
			}
			
			for( int iIndex=0; iIndex<g_countValidModes; iIndex++ )
			{
				if( ( dispMode.Width == g_validModes[iIndex].X() ) &&
					( dispMode.Height == g_validModes[iIndex].Y() ) )
				{
					winSize.SetX( dispMode.Width );
					winSize.SetY( dispMode.Height );
					m_modes.PushEnd( winSize );
					break;
				}
			}
		}

		return S_OK;
	}
예제 #4
0
    void AddKey(float frame, const Quaternion& quat)
    {
        int count = m_keys.GetCount();

        ZAssert(count == 0 || frame > m_keys.GetEnd().m_frame);

        m_keys.PushEnd();
        m_keys.GetEnd().m_frame = frame;
        m_keys.GetEnd().m_quat  = quat;
    }
예제 #5
0
    void AddKey(float frame, const Vector& vec)
    {
        int count = m_keys.GetCount();

        ZAssert(count == 0 || frame > m_keys.GetEnd().m_frame);

        m_keys.PushEnd();
        m_keys.GetEnd().m_frame = frame;
        m_keys.GetEnd().m_vec   = vec;
    }
예제 #6
0
	IDirect3DTextureX* GetTextureX(PixelFormat*	ppf, const WinPoint& size, int&	id)
	{
		id = m_data.m_id;

		// Return the fullsize surface if that's what's	wanted.
		if (size ==	m_size)	
		{
			if (ppf	== m_data.m_ppf) 
			{
				SetSurfaceMode(SurfaceModeDD);
				return m_data.m_pd3dtexture;
			}

			UpdateConvertedSurface(ppf,	m_size,	m_dataConverted, m_data);
			return m_dataConverted.m_pd3dtexture;
		}

		// Need	to return a	lower level	of detail
		int	index =	0;
		WinPoint sizeSource	= m_size;

		while (true) {
			sizeSource.SetX(sizeSource.X() / 2);
			sizeSource.SetY(sizeSource.Y() / 2);

			//
			// Do we need to allocate a	new	lower level	of detail?
			//

			if (index == m_datas.GetCount()) {
				m_datas.PushEnd();
				m_datasConverted.PushEnd();
				ConstructSurfaceData(m_datas.Get(index), m_data.m_ppf, sizeSource);
			}

			// Do we need to update	this level?
			if (m_datas[index].m_id	!= m_data.m_id)	
			{
				_ASSERT( false );
/*				DownSample(
					sizeSource,
					m_datas[index].m_pdds,
					index == 0 ?
						  m_data.m_pdds
						: m_datas[index	- 1].m_pdds
				);

				m_datas.Get(index).m_id	= m_data.m_id;*/
			}

			// Did we find the right size?
			if (sizeSource == size)	
			{
				// Does	the	format need	to be converted?
				if (ppf	== m_data.m_ppf) 
				{
					return m_datas[index].m_pd3dtexture;
				} 
				else 
				{
					UpdateConvertedSurface(ppf,	size, m_datasConverted.Get(index), m_datas[index]);
					return m_datasConverted[index].m_pd3dtexture;
				}
			}

			index++;
		}
	}