示例#1
0
void CMenuMgr::EnableMenuBar(bool bEnable/*=true*/, uint32 nMenuFlags/*=MB_ALL*/)
{
	// Determine the state of each control based on the flags passed...

	uint32 MBCtrlFlags[MB_NUM_CTRLS] =
	{
		MB_SYSTEM,
		MB_MISSION,
		MB_INVENTORY,
		MB_KEYS,
		MB_INTEL,
		MB_PLAYER
	};

	if (!IsCoopMultiplayerGameType())
	{
		nMenuFlags &= ~(MB_MISSION & MB_KEYS & MB_INTEL & MB_PLAYER);
	}

	for (int i=0; i < MB_NUM_CTRLS; i++)
	{
		CLTGUICtrl* pCtrl = m_MenuBar.GetControl(i);
		if (pCtrl)
		{
			if (MBCtrlFlags[i] & nMenuFlags)
			{
				pCtrl->Enable(bEnable);
			}
			else
			{
				pCtrl->Enable(!bEnable);
			}

			// Okay this is pretty much a hack since we use the disabled state to
			// really specify a selected control (see CMenuMgr::SwitchToMenu()), but in the
			// case of Enable = true we really want the menu bar to be disabled, we'll handle
			// this here by changing the color of the disabled state...

			if (pCtrl->IsDisabled())
			{
				pCtrl->SetColors(g_nSelectColor,argbBlack,argbGray);
			}
			else
			{
				// Control is enabled, so we'll set it's "disabled" color to white...

				pCtrl->SetColors(g_nSelectColor,argbBlack,argbWhite);

				// We need to disable the current menu control here using the new
				// color (i.e., it will appear white signifying it is actually
				// the current control)...
				
				if (i == m_nMenuIndex)
				{
					pCtrl->Enable(false);
				}
			}
		}
	}
}
示例#2
0
void AmmoBox::Leftovers(ILTMessage_Read *pMsg)
{
    uint8 numAmmoTypes = pMsg->Readuint8();

    int i;
    for (i = 0; i < numAmmoTypes; i++)
	{
        m_nAmmoId[i]    = pMsg->Readuint8();
        m_nAmmoCount[i] = (int) pMsg->Readint32();

		if (m_nAmmoCount[i] <= 0)
			m_nAmmoId[i] = WMGR_INVALID_ID;

	}

	for (i=numAmmoTypes; i < AB_MAX_TYPES; i++)
	{
		m_nAmmoId[i] = WMGR_INVALID_ID;
		m_nAmmoCount[i] = 0;
	}

	PlayPickedupSound();
	
	// If in a deathmatch game we should act like the ammobox was empty and pick it up
	// if anything from the box was taken.
	
	if( !IsCoopMultiplayerGameType() )
	{
		PickedUp( LTNULL );
	}
}
示例#3
0
void CServerMissionMgr::SetServerSettings(ServerMissionSettings& ServerSettings)
{
	if (!g_vtNetFriendlyFire.IsInitted())
	{
		g_vtNetFriendlyFire.Init(g_pLTServer, "NetFriendlyFire", LTNULL, 1.0f);
	}
	if (!g_vtDifficultyFactorPlayerIncrease.IsInitted())
	{
		g_vtDifficultyFactorPlayerIncrease.Init( g_pLTServer, "DifficultyFactorPlayerIncrease", LTNULL, 0.1f );
	}
	if( !g_vtRunSpeed.IsInitted( ))
	{
		g_vtRunSpeed.Init( g_pLTServer, "RunSpeed", NULL, 1.0f );
	}

	m_ServerSettings = ServerSettings;

	g_vtNetFriendlyFire.SetFloat( ( ServerSettings.m_bFriendlyFire ? 1.0f : 0.0f) );

	if (IsDifficultyGameType())
	{
		g_pGameServerShell->SetDifficulty((GameDifficulty)ServerSettings.m_nMPDifficulty);
		g_pLTServer->CPrint("CServerMissionMgr::StartGame() setting difficulty to %d",ServerSettings.m_nMPDifficulty);
	}
	else
		g_pGameServerShell->SetDifficulty(GD_NORMAL);
	

	g_vtDifficultyFactorPlayerIncrease.SetFloat(ServerSettings.m_fPlayerDiffFactor);

	// Only adjust the runspeed if this is a gametype that allows it.
	if( !IsCoopMultiplayerGameType( ))
		g_vtRunSpeed.SetFloat(  (float)ServerSettings.m_nRunSpeed / 100.0f );
}
示例#4
0
void CMenuMgr::EnableMenus()
{
	bool bSPMenus = IsCoopMultiplayerGameType();

	m_MenuMission.Enable(bSPMenus);
	m_MenuKeys.Enable(bSPMenus);
	m_MenuIntel.Enable(bSPMenus);
	m_MenuPlayer.Enable(bSPMenus);

}
示例#5
0
void CLoadingScreen::UpdateMissionInfo()
{
	// No need to update mission info if a different screen is being rendered...
	
	if( m_pRenderScreen )
		return;

	EnterCriticalSection(&m_MissionUpdate);

	if( !g_pMissionMgr->IsCustomLevel( ))
	{
		int nCurMission = g_pMissionMgr->GetCurrentMission( );
		MISSION* pMission = g_pMissionButeMgr->GetMission( nCurMission );

		if( pMission )
		{
			if (pMission->nNameId > 0)
				m_missionname = LoadTempString(pMission->nNameId);
			else
				m_missionname = pMission->sName;

			int nCurLevel = g_pMissionMgr->GetCurrentLevel( );
			
			m_levelname = LoadTempString( pMission->aLevels[nCurLevel].nNameId );

			// Show a briefing for this level if it exists.  Also, only
			// show the briefing if we haven't been to this level before.
			int nBriefingId = pMission->aLevels[nCurLevel].nBriefingId;
			if( nBriefingId >= 0 && !g_pMissionMgr->IsRestoringLevel( ))
				m_briefing = LoadTempString( nBriefingId );
			else
				m_briefing = "";

			// Show help text for this level if it exists.  
			int nHelpId = pMission->aLevels[nCurLevel].nHelpId;
			if( nHelpId >= 0)
				m_help = LoadTempString( nHelpId );
			else
				m_help = "";

			if( !IsCoopMultiplayerGameType( ))
			{
				m_photo = pMission->sPhoto;
			}

		}

	}

	m_pMissionNameStr->SetText(m_missionname.c_str());
	m_pLevelNameStr->SetText(m_levelname.c_str());
	m_pHelpStr->SetText(m_help.c_str());

	if (g_pGameClientShell->IsRunningPerformanceTest())
	{
		m_pBriefingStr->SetText(LoadTempString( IDS_PERFORMANCE_TEST_BRIEF ));
	}
	else
	{
		m_pBriefingStr->SetText(m_briefing.c_str());
	}

	if( !IsCoopMultiplayerGameType() && !m_photo.empty())
	{
		m_hFrame = g_pInterfaceResMgr->GetTexture(m_photo.c_str());
		if (m_hFrame)
		{
			SetupQuadUVs(m_photoPoly, m_hFrame, 0.0f, 0.0f, 1.0f, 0.75f);
			g_pDrawPrim->SetRGBA(&m_photoPoly,argbWhite);

			float fScale = g_pInterfaceResMgr->GetXRatio();
			float fx = (float)m_DefaultPhotoRect.left * fScale;
			float fy = (float)m_DefaultPhotoRect.top * fScale;

			float fw = (float)(m_DefaultPhotoRect.right - m_DefaultPhotoRect.left) * fScale;
			float fh = (float)(m_DefaultPhotoRect.bottom - m_DefaultPhotoRect.top) * fScale;

			g_pDrawPrim->SetXYWH(&m_photoPoly,fx,fy,fw,fh);

		}
	}
	else
	{
		m_hFrame = LTNULL;
	}



	LeaveCriticalSection(&m_MissionUpdate);
}
示例#6
0
LTBOOL CLoadingScreen::Init()
{
	if (m_eCurState != STATE_NONE)
		return LTFALSE;

	if( m_pRenderScreen )
	{
		// Just let the render screen know it is about to be draw and set the state to init...

		m_pRenderScreen->OnFocus( true );
		m_eCurState = STATE_INIT;

		return LTTRUE;
	}
	
	m_photo = "";

	// Check if we have a mission entry.
	bool bGotMission = false;
	
	if( !g_pMissionMgr->IsCustomLevel( ))
	{
		int nCurMission = g_pMissionMgr->GetCurrentMission( );
		MISSION* pMission = g_pMissionButeMgr->GetMission( nCurMission );

		if( pMission )
		{
			if (pMission->nNameId > 0)
				m_missionname = LoadTempString(pMission->nNameId);
			else
				m_missionname = pMission->sName;

			int nCurLevel = g_pMissionMgr->GetCurrentLevel( );
			m_levelname = LoadTempString( pMission->aLevels[nCurLevel].nNameId );
			m_layout = pMission->szLayout;

			//set the post load layout here, so that it matches
			// even when our mission info is updated partway through the load
			CScreenPostload *pPostload = (CScreenPostload *) (g_pInterfaceMgr->GetScreenMgr( )->GetScreenFromID(SCREEN_ID_POSTLOAD));
			if (pPostload)
			{
				pPostload->SetLayout(pMission->szLayout);
			}


			// Show a briefing for this level if it exists.  Also, only
			// show the briefing if we haven't been to this level before.
			int nBriefingId = pMission->aLevels[nCurLevel].nBriefingId;
			if( nBriefingId >= 0 && !g_pMissionMgr->IsRestoringLevel( ))
			{
				m_briefing = LoadTempString( nBriefingId );
				m_layout = pMission->szBriefLayout;
				if (pPostload)
				{
					pPostload->SetLayout(pMission->szBriefLayout);
				}
			}
			else
				m_briefing = "";

			// Show help text for this level if it exists.
			int nHelpId = pMission->aLevels[nCurLevel].nHelpId;
			if( nHelpId >= 0)
			{
				m_help = LoadTempString( nHelpId );
				if (pPostload)
				{
					pPostload->SetLayout(pMission->szBriefLayout);
				}
			}
			else
				m_help = "";

			if( !IsCoopMultiplayerGameType( ))
			{
				m_photo = pMission->sPhoto;
			}


			bGotMission = true;
		}

	}

	// If we were unsuccessful in getting info from the mission, then just
	// use defaults.
	if( !bGotMission )
	{
		// If connecting to a remote server, set our mission descriptor to 
		// the ip we're connecting to.
		if( g_pClientMultiplayerMgr->IsConnectedToRemoteServer( ))
		{
			// Make a loading string using the IP to be joined.
			char szLoadingString[256];

			if (strlen(g_pClientMultiplayerMgr->GetStartGameRequest( ).m_HostInfo.m_sName))
			{
				sprintf( szLoadingString, "%s:  %s", LoadTempString(IDS_CONNECTING_TO_SERVER), 
					g_pClientMultiplayerMgr->GetStartGameRequest( ).m_HostInfo.m_sName );
			}
			else
			{
				sprintf( szLoadingString, "%s", LoadTempString(IDS_CONNECTING_TO_SERVER));
			}
			m_missionname = szLoadingString;

			sprintf( szLoadingString, "    (%s)", g_pClientMultiplayerMgr->GetStartGameRequest( ).m_TCPAddress );

			m_levelname = szLoadingString;
		}
		// Local game, set the mission descriptor to the level name.
		else
		{
			if (g_pGameClientShell->IsRunningPerformanceTest())
			{
				m_missionname = LoadTempString( IDS_TITLE_PERFORMANCE_TEST );
				m_levelname = "";
			}
			else
			{
				m_missionname = LoadTempString( IDS_CUSTOM_LEVEL );
				// Split the worldname up into parts so we can get the load string.
				char const* pszWorldName = g_pMissionMgr->GetCurrentWorldName( );
				char szWorldTitle[MAX_PATH] = "";
				_splitpath( pszWorldName, NULL, NULL, szWorldTitle, NULL );
				m_levelname = szWorldTitle;

			}

		}

		m_layout = "LoadScreenDefault";
		m_briefing = "";
		m_help = "";
	}

	char szTagName[30];
	if (!m_bReadLayout)
	{
		m_bReadLayout = true;

		SAFE_STRCPY(szTagName,"LoadScreenDefault");

		//default layout info title string
		m_DefaultTitlePos = g_pLayoutMgr->GetPoint(szTagName,"TitlePos");
		m_nDefaultTitleFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleFont");
		m_nDefaultTitleFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleSize");

		LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "TitleColor");
		uint8 nR = (uint8)vColor.x;
		uint8 nG = (uint8)vColor.y;
		uint8 nB = (uint8)vColor.z;

		m_nDefaultTitleColor = SET_ARGB(0xFF,nR,nG,nB);

		//default layout info title string
		m_DefaultLevelPos = g_pLayoutMgr->GetPoint(szTagName,"LevelPos");
		m_nDefaultLevelFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelFont");
		m_nDefaultLevelFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelSize");

		vColor = g_pLayoutMgr->GetVector(szTagName, "LevelColor");
		nR = (uint8)vColor.x;
		nG = (uint8)vColor.y;
		nB = (uint8)vColor.z;

		m_nDefaultLevelColor = SET_ARGB(0xFF,nR,nG,nB);

		//default layout info mission briefing string
		LTRect rect = g_pLayoutMgr->GetRect(szTagName,"BriefingRect");
		m_DefaultBriefingPos = LTIntPt(rect.left,rect.top);
		m_nDefaultBriefingWidth = (rect.right - rect.left);

		m_nDefaultBriefingFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingFont");
		m_nDefaultBriefingFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingSize");

		vColor = g_pLayoutMgr->GetVector(szTagName, "BriefingColor");
		nR = (uint8)vColor.x;
		nG = (uint8)vColor.y;
		nB = (uint8)vColor.z;

		m_nDefaultBriefingColor = SET_ARGB(0xFF,nR,nG,nB);

		//default layout info mission help string
		rect = g_pLayoutMgr->GetRect(szTagName,"HelpRect");
		m_DefaultHelpPos = LTIntPt(rect.left,rect.top);
		m_nDefaultHelpWidth = (rect.right - rect.left);

		m_nDefaultHelpFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpFont");
		m_nDefaultHelpFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpSize");

		vColor = g_pLayoutMgr->GetVector(szTagName, "HelpColor");
		nR = (uint8)vColor.x;
		nG = (uint8)vColor.y;
		nB = (uint8)vColor.z;

		m_nDefaultHelpColor = SET_ARGB(0xFF,nR,nG,nB);

		m_DefaultPhotoRect = g_pLayoutMgr->GetRect(szTagName,"PhotoRect");

	}

	//Setup title string
	LTIntPt TitlePos			= m_DefaultTitlePos;
	uint8	TitleFont			= m_nDefaultTitleFont;
	uint8	TitleFontSize		= m_nDefaultTitleFontSize;
	uint32	TitleColor			= m_nDefaultTitleColor;
	LTIntPt LevelPos			= m_DefaultLevelPos;
	uint8	LevelFont			= m_nDefaultLevelFont;
	uint8	LevelFontSize		= m_nDefaultLevelFontSize;
	uint32	LevelColor			= m_nDefaultLevelColor;
	LTIntPt BriefingPos			= m_DefaultBriefingPos;
	uint16	BriefingWidth		= m_nDefaultBriefingWidth;
	uint8	BriefingFont		= m_nDefaultBriefingFont;
	uint8	BriefingFontSize	= m_nDefaultBriefingFontSize;
	uint32	BriefingColor		= m_nDefaultBriefingColor;
	LTIntPt HelpPos				= m_DefaultHelpPos;
	uint16	HelpWidth			= m_nDefaultHelpWidth;
	uint8	HelpFont			= m_nDefaultHelpFont;
	uint8	HelpFontSize		= m_nDefaultHelpFontSize;
	uint32	HelpColor			= m_nDefaultHelpColor;

	//*******************************************************************************
	// Build Mission Name String

	// look for override values
	SAFE_STRCPY(szTagName,m_layout.c_str());
	if (g_pLayoutMgr->Exist(szTagName))
	{
		//override layout info title string
		if (g_pLayoutMgr->HasValue(szTagName,"TitlePos"))
			TitlePos = g_pLayoutMgr->GetPoint(szTagName,"TitlePos");

		if (g_pLayoutMgr->HasValue(szTagName,"TitleFont"))
			TitleFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleFont");

		if (g_pLayoutMgr->HasValue(szTagName,"TitleSize"))
			TitleFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleSize");

		if (g_pLayoutMgr->HasValue(szTagName,"TitleColor"))
		{
			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "TitleColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			TitleColor = SET_ARGB(0xFF,nR,nG,nB);
		}

		//override layout info Level string
		if (g_pLayoutMgr->HasValue(szTagName,"LevelPos"))
			LevelPos = g_pLayoutMgr->GetPoint(szTagName,"LevelPos");

		if (g_pLayoutMgr->HasValue(szTagName,"LevelFont"))
			LevelFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelFont");

		if (g_pLayoutMgr->HasValue(szTagName,"LevelSize"))
			LevelFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelSize");

		if (g_pLayoutMgr->HasValue(szTagName,"LevelColor"))
		{
			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "LevelColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			LevelColor = SET_ARGB(0xFF,nR,nG,nB);
		}

	}

	uint8 nFontSize = (uint8)((float)TitleFontSize * g_pInterfaceResMgr->GetXRatio());
	CUIFont *pFont = g_pInterfaceResMgr->GetFont(TitleFont);

	if (!m_pMissionNameStr)
	{
		m_pMissionNameStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
	}
	m_pMissionNameStr->SetColor(TitleColor);
	m_pMissionNameStr->SetText(m_missionname.c_str());
	m_pMissionNameStr->SetCharScreenHeight(nFontSize);
	float x = (float)TitlePos.x * g_pInterfaceResMgr->GetXRatio();
	float y = (float)TitlePos.y * g_pInterfaceResMgr->GetYRatio();
	m_pMissionNameStr->SetPosition(x,y);

	nFontSize = (uint8)((float)LevelFontSize * g_pInterfaceResMgr->GetXRatio());
	pFont = g_pInterfaceResMgr->GetFont(LevelFont);

	if (!m_pLevelNameStr)
	{
		m_pLevelNameStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
	}
	m_pLevelNameStr->SetColor(LevelColor);
	m_pLevelNameStr->SetText(m_levelname.c_str());
	m_pLevelNameStr->SetCharScreenHeight(nFontSize);
	x = (float)LevelPos.x * g_pInterfaceResMgr->GetXRatio();
	y = (float)LevelPos.y * g_pInterfaceResMgr->GetYRatio();
	m_pLevelNameStr->SetPosition(x,y);


	//*******************************************************************************
	// Build Mission Briefing String

	//look for override values
	if (g_pLayoutMgr->Exist(szTagName))
	{
		//default layout info mission briefing string
		if (g_pLayoutMgr->HasValue(szTagName,"BriefingRect"))
		{
			LTRect rect = g_pLayoutMgr->GetRect(szTagName,"BriefingRect");
			BriefingPos = LTIntPt(rect.left,rect.top);
			BriefingWidth = (rect.right - rect.left);
		}

		if (g_pLayoutMgr->HasValue(szTagName,"BriefingFont"))
			BriefingFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingFont");

		if (g_pLayoutMgr->HasValue(szTagName,"BriefingSize"))
			BriefingFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingSize");

		if (g_pLayoutMgr->HasValue(szTagName,"BriefingColor"))
		{
			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "BriefingColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			BriefingColor = SET_ARGB(0xFF,nR,nG,nB);
		}

	}

	nFontSize = (uint8)((float)BriefingFontSize * g_pInterfaceResMgr->GetXRatio());
	pFont = g_pInterfaceResMgr->GetFont(BriefingFont);
	
	if (!m_pBriefingStr)
	{
		m_pBriefingStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
	}

	
	if (g_pGameClientShell->IsRunningPerformanceTest())
	{
		m_pBriefingStr->SetText(LoadTempString( IDS_PERFORMANCE_TEST_BRIEF ));
	}
	else
	{
		m_pBriefingStr->SetText(m_briefing.c_str());
	}
	m_pBriefingStr->SetColor(BriefingColor);
	m_pBriefingStr->SetCharScreenHeight(nFontSize);
	x = (float)BriefingPos.x * g_pInterfaceResMgr->GetXRatio();
	y = (float)BriefingPos.y * g_pInterfaceResMgr->GetYRatio();
	m_pBriefingStr->SetPosition(x,y);
	m_pBriefingStr->SetWrapWidth((uint16)(g_pInterfaceResMgr->GetXRatio() * (float)BriefingWidth));

	//*******************************************************************************
	// Build Mission Help String

	//look for override values
	if (g_pLayoutMgr->Exist(szTagName))
	{
		//default layout info mission briefing string
		if (g_pLayoutMgr->HasValue(szTagName,"HelpRect"))
		{
			LTRect rect = g_pLayoutMgr->GetRect(szTagName,"HelpRect");
			HelpPos = LTIntPt(rect.left,rect.top);
			HelpWidth = (rect.right - rect.left);
		}

		if (g_pLayoutMgr->HasValue(szTagName,"HelpFont"))
			HelpFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpFont");

		if (g_pLayoutMgr->HasValue(szTagName,"HelpSize"))
			HelpFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpSize");

		if (g_pLayoutMgr->HasValue(szTagName,"HelpColor"))
		{
			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "HelpColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			HelpColor = SET_ARGB(0xFF,nR,nG,nB);
		}

	}

	nFontSize = (uint8)((float)HelpFontSize * g_pInterfaceResMgr->GetXRatio());
	pFont = g_pInterfaceResMgr->GetFont(HelpFont);
	
	if (!m_pHelpStr)
	{
		m_pHelpStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
	}

	CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();
	if (pProfile->m_bLoadScreenTips)
	{
		m_pHelpStr->SetText(m_help.c_str());
		m_pHelpStr->SetColor(HelpColor);
		m_pHelpStr->SetCharScreenHeight(nFontSize);
		x = (float)HelpPos.x * g_pInterfaceResMgr->GetXRatio();
		y = (float)HelpPos.y * g_pInterfaceResMgr->GetYRatio();
		m_pHelpStr->SetPosition(x,y);
		m_pHelpStr->SetWrapWidth((uint16)(g_pInterfaceResMgr->GetXRatio() * (float)HelpWidth));
	}
	else
	{
		m_pHelpStr->SetText("");
	}


	if( !IsCoopMultiplayerGameType() && !m_photo.empty() )
	{
		m_hFrame = g_pInterfaceResMgr->GetTexture(m_photo.c_str());
		if (m_hFrame)
		{
			SetupQuadUVs(m_photoPoly, m_hFrame, 0.0f, 0.0f, 1.0f, 0.75f);
			g_pDrawPrim->SetRGBA(&m_photoPoly,argbWhite);

			float fScale = g_pInterfaceResMgr->GetXRatio();
			float fx = (float)m_DefaultPhotoRect.left * fScale;
			float fy = (float)m_DefaultPhotoRect.top * fScale;

			float fw = (float)(m_DefaultPhotoRect.right - m_DefaultPhotoRect.left) * fScale;
			float fh = (float)(m_DefaultPhotoRect.bottom - m_DefaultPhotoRect.top) * fScale;

			g_pDrawPrim->SetXYWH(&m_photoPoly,fx,fy,fw,fh);

		}
	}
	else
	{
		m_hFrame = LTNULL;
	}


	
	CreateInterfaceSFX();

	// Reset the frame counter
	m_nFrameCounter = 0;
	m_fLastFrameTime = CWinUtil::GetTime();
	m_fCurFrameDelta = 0.0f;
	
	m_eCurState = STATE_INIT;

	return LTTRUE;
}
示例#7
0
LTBOOL PickupItem::ReadProp(ObjectCreateStruct *pInfo)
{
	GenericProp genProp;

    if (!pInfo) return LTFALSE;

    if (g_pLTServer->GetPropGeneric("PickupCommand", &genProp) == LT_OK)
	{
		if(genProp.m_String[0])
		{
            m_hstrPickupCommand = g_pLTServer->CreateString(genProp.m_String);
		}
	}

    if (g_pLTServer->GetPropGeneric("PickupSound", &genProp)  == LT_OK)
	{
		if(genProp.m_String[0])
		{
            m_hstrSoundFile = g_pLTServer->CreateString(genProp.m_String);
		}
	}

    if (g_pLTServer->GetPropGeneric("RespawnSound", &genProp) == LT_OK)
	{
		if(genProp.m_String[0])
		{
            m_hstrRespawnSoundFile = g_pLTServer->CreateString(genProp.m_String);
		}
	}

	// Only get the value of the ModelOverride attribute if we're using
	// it...
    if (g_pLTServer->GetPropGeneric("UseModelOverride", &genProp) == LT_OK)
	{
		if (genProp.m_Bool)
		{
			if (g_pLTServer->GetPropGeneric("ModelOverride", &genProp) == LT_OK)
			{
				if(genProp.m_String[0])
				{
					m_hstrModelOverride = g_pLTServer->CreateString(genProp.m_String);
				}
			}
		}
	}

    if (g_pLTServer->GetPropGeneric("Rotate", &genProp) == LT_OK)
	{
		m_bRotate = genProp.m_Bool;
	}

    if (g_pLTServer->GetPropGeneric("Bounce", &genProp) == LT_OK)
	{
		m_bBounce = genProp.m_Bool;
	}

    if (g_pLTServer->GetPropGeneric("MoveToFloor", &genProp) == LT_OK)
	{
		 m_bMoveToFloor = genProp.m_Bool;
	}

	if( g_pLTServer->GetPropGeneric( "TouchPickup", &genProp ) == LT_OK )
	{
		if( IsCoopMultiplayerGameType() )
		{
			m_bTouchPickup = genProp.m_Bool;
		}
	}

	if( g_pLTServer->GetPropGeneric( "DMTouchPickup", &genProp ) == LT_OK )
	{
		if( !IsCoopMultiplayerGameType() )
		{
			m_bTouchPickup = genProp.m_Bool;
		}
	}


	if( g_pLTServer->GetPropGeneric( "ActivatePickup", &genProp ) == LT_OK )
	{
		m_bActivatePickup = genProp.m_Bool;
	}

	if( !IsMultiplayerGame( ))
	{
		if( g_pLTServer->GetPropGeneric( "SPRespawn", &genProp ) == LT_OK )
		{
			m_bRespawn = genProp.m_Bool;
		}
	}
	else
	{
		if( g_pLTServer->GetPropGeneric( "MPRespawn", &genProp ) == LT_OK )
		{
			m_bRespawn = genProp.m_Bool;
		}
	}

	if (g_pLTServer->GetPropGeneric("RespawnTime", &genProp) == LT_OK)
	{
		m_fRespawnDelay = genProp.m_Float;
	}

    if (g_pLTServer->GetPropGeneric("Scale", &genProp) == LT_OK)
	{
		 m_vScale = genProp.m_Vec;
	}

	if( g_pLTServer->GetPropGeneric( "WorldAnimation", &genProp ) == LT_OK )
	{
		if( genProp.m_String[0] )
		{
			m_sWorldAniName = genProp.m_String;
		}
	}

	// Get the team this object belongs to.
	if( IsTeamGameType() )
	{
		if( g_pLTServer->GetPropGeneric( "Team", &genProp ) == LT_OK )
		{
			m_nTeamId = TeamStringToTeamId( genProp.m_String );
		}
	}
	else
	{
		m_nTeamId = INVALID_TEAM;
	}

	return LTTRUE;
}