Beispiel #1
0
void LightBase::Load(ILTMessage_Read *pMsg, uint32 dwLoadFlags)
{
	if (!pMsg) 
		return;

	ILTMessage_Read& cMsg = *pMsg;

	m_vColor				= cMsg.ReadLTVector();
	m_vDirectionalDims		= cMsg.ReadLTVector();
	m_vTranslucentColor		= cMsg.ReadLTVector();
	m_vSpecularColor		= cMsg.ReadLTVector();
	m_fLightRadius			= cMsg.Readfloat();
	m_fIntensityScale		= cMsg.Readfloat();
	m_eLightType			= (EEngineLightType)cMsg.Readuint8();
	m_fSpotFovX				= cMsg.Readfloat();
	m_fSpotFovY				= cMsg.Readfloat();
	m_fSpotNearClip			= cMsg.Readfloat();
	m_eLightLOD				= (EEngineLOD)cMsg.Readuint8();
	m_eWorldShadowsLOD		= (EEngineLOD)cMsg.Readuint8();
	m_eObjectShadowsLOD		= (EEngineLOD)cMsg.Readuint8();

	char pszTextureBuffer[MAX_PATH + 1];

	cMsg.ReadString(pszTextureBuffer, LTARRAYSIZE(pszTextureBuffer));
	m_sLightTexture = pszTextureBuffer;

	cMsg.ReadString(pszTextureBuffer, LTARRAYSIZE(pszTextureBuffer));
	m_sLightAttenuationTexture = pszTextureBuffer;
}
Beispiel #2
0
// Launches the end splash screen.
bool LaunchApplication::LaunchEndSplashScreen( )
{
#if defined(PLATFORM_WIN32)

	if( !g_pLTIStringEdit->DoesIDExist(g_pLTDBStringEdit, "EndSplashURL" ))
		return false;

	char szEndSplashURL[MAX_PATH*2] = "";
	LTStrCpy( szEndSplashURL, MPW2A( LoadString( "EndSplashURL" )).c_str(), LTARRAYSIZE( szEndSplashURL ));
	if( LTStrEmpty( szEndSplashURL ))
		return false;

	char szExe[MAX_PATH] = "";
	uint32 nExeSize = LTARRAYSIZE( szExe );
	AssocQueryString(ASSOCF_NOTRUNCATE,
		ASSOCSTR_EXECUTABLE,
		".htm",
		"open",
		szExe,
		( DWORD* )&nExeSize);

	return LaunchFromString( szExe, szEndSplashURL, true, true );
#else
	return false;
#endif
}
Beispiel #3
0
void CAIGoalStunned::DeactivateGoal()
{
	super::DeactivateGoal();

	// Disable the flashlight of whoever stunned me.

	CAIWMFact factQuery;
	factQuery.SetFactType( kFact_Desire );
	factQuery.SetDesireType( kDesire_Stunned );
	CAIWMFact* pFact = m_pAI->GetAIWorkingMemory()->FindWMFact( factQuery );
	if( pFact )
	{
		// Enable the flashlight after some delay.

		char szName[64];
		HOBJECT hStunner = pFact->GetTargetObject();
		ILTBaseClass* pStunner = g_pLTServer->HandleToObject( hStunner );
		g_pLTServer->GetObjectName( hStunner, szName, LTARRAYSIZE(szName) );

		float fDelay = g_pAIDB->GetMiscFloat( FLASHLIGHT_DISABLE_TIME );

		char szCommand[128];
		LTSNPrintF( szCommand, LTARRAYSIZE( szCommand ), "delay %.2f (msg %s (FLASHLIGHT ENABLE))", fDelay, szName );
		g_pCmdMgr->QueueCommand( szCommand, m_pAI, pStunner );
	}

	// Clear the knowledge of reacting to getting stunned.

	m_pAI->GetAIWorldState()->SetWSProp( kWSK_ReactedToWorldStateEvent, m_pAI->m_hObject, kWST_ENUM_AIWorldStateEvent, kWSE_Invalid );
}
Beispiel #4
0
void ClientVoteMgr::HandleVotePass()
{
	wchar_t wszMsg[256] = L"";

	switch(m_CurrentVote.m_eVoteType)
	{
	case eVote_Kick:
		FormatString("Vote_Pass_Kick",wszMsg,LTARRAYSIZE(wszMsg),m_sTargetName.c_str());
		g_pGameMsgs->AddMessage(wszMsg);
		break;
	case eVote_TeamKick:
		FormatString("Vote_Pass_TeamKick",wszMsg,LTARRAYSIZE(wszMsg),m_sTargetName.c_str());
		g_pGameMsgs->AddMessage(wszMsg);
		break;
	case eVote_Ban:
		FormatString("Vote_Pass_Ban",wszMsg,LTARRAYSIZE(wszMsg),m_sTargetName.c_str());
		g_pGameMsgs->AddMessage(wszMsg);
		break;
	case eVote_NextRound:
		g_pGameMsgs->AddMessage( LoadString("Vote_Pass_NextRound") );
		break;
	case eVote_NextMap:
		g_pGameMsgs->AddMessage( LoadString("Vote_Pass_NextMap") );
		break;
	case eVote_SelectMap:
		FormatString("Vote_Pass_SelectMap",wszMsg,LTARRAYSIZE(wszMsg),m_sTargetName.c_str());
		g_pGameMsgs->AddMessage(wszMsg);
		break;
	}


	ClearVote();
}
Beispiel #5
0
void CLoadingScreen::ClientContentTransferCompletedNotification()
{
	// No need to update content info if a different screen is being rendered...
	if( m_pRenderScreen )
		return;

	EnterCriticalSection(&m_MissionUpdate);

	// rebuild and reinitialize the mission database
	g_pMissionDB->Reset();
	g_pMissionDB->Init(DB_Default_File);
	g_pMissionDB->CreateMPDB();

	char szPath[MAX_PATH*2];
	LTFileOperations::GetUserDirectory(szPath, LTARRAYSIZE(szPath));
	LTStrCat( szPath, MDB_MP_File, LTARRAYSIZE( szPath ));
	g_pMissionDB->Init(szPath);

	m_CurrentFileName.SetString(L"");
	m_CurrentFileTime.SetString(L"");
	m_FilesLeft.SetString(L"");
	m_TotalTime.SetString(L"");

	UpdateCurrentBar(1.0f);
	UpdateTotalBar(1.0f);

	m_bContentTransfer = false;

	LeaveCriticalSection(&m_MissionUpdate);
	Update();
}
uint32 LTProfileUtils::ReadUint32(const char* pszSectionName, 
								const char* pszKeyName,
								uint32 nDefault,
								const char* pszFileName)
{
	char szValue[64];
	LTSNPrintF( szValue, LTARRAYSIZE( szValue ), "%d", nDefault );
	ReadString( pszSectionName, pszKeyName, szValue, szValue, LTARRAYSIZE( szValue ), pszFileName);
	
	return ( uint32 )atoi( szValue );
}
void CScreenHostOptionFile::UpdateName()
{
	CUserProfile* pProfile = g_pProfileMgr->GetCurrentProfile();

	wchar_t wszBuffer[MAX_PATH*2];

	const wchar_t* wszFriendlyName = CHostOptionsMapMgr::Instance().GetFriendlyNameFromFileName( pProfile->m_sServerOptionsFile.c_str() );
	if( wszFriendlyName )
		FormatString( "IDS_CURRENT_OPTIONFILE", wszBuffer, LTARRAYSIZE(wszBuffer), wszFriendlyName);
	else
		FormatString( "IDS_CURRENT_OPTIONFILE", wszBuffer, LTARRAYSIZE(wszBuffer), MPA2W(pProfile->m_sServerOptionsFile.c_str( )).c_str( ));
	m_pCurrent->SetString( wszBuffer );
}
Beispiel #8
0
bool BanIPMgr_Impl::ReadBans( )
{
	// build the file name by prepending the user directory
	char szFilename[MAX_PATH];
	LTFileOperations::GetUserDirectory(szFilename, LTARRAYSIZE(szFilename));
	LTStrCat(szFilename, szBanFile, LTARRAYSIZE(szFilename));

	// Check if there is a file to read.
	if( !LTFileOperations::FileExists( szFilename ))
		return true;

	// read in the current set of bans
	return LTFileOperations::ParseTextFile(szFilename, ReadBansProcessLineFn, this);
}
Beispiel #9
0
// Render the control
void CLTGUIFillFrame::Render()
{
	if( !IsVisible() )
		return;

	// fill with a background color
	LT_POLYG4 polyBackground;
	DrawPrimSetRGBA( polyBackground, m_nBackgroundColor );
	DrawPrimSetXYWH( polyBackground, GetPos().x, GetPos().y, GetWidth(), GetHeight() );
	g_pDrawPrim->SetRenderMode(eLTDrawPrimRenderMode_Modulate_Translucent);
	g_pDrawPrim->DrawPrim( &polyBackground );

	// render the border
	if( m_nFrameWidth )
	{
		// set up the render state	
		g_pDrawPrim->SetRenderMode(eLTDrawPrimRenderMode_Modulate_NoBlend);

		for (int f = 0;f < LTARRAYSIZE(m_Frame); ++f)
			DrawPrimSetRGBA(m_Frame[f],GetCurrentColor());

		// draw our frames
		if( (m_nBorderFlags & eBorder_Left) )
			g_pDrawPrim->DrawPrim( &m_Frame[0], 1 );
		if( (m_nBorderFlags & eBorder_Top) )
			g_pDrawPrim->DrawPrim( &m_Frame[1], 1 );
		if( (m_nBorderFlags & eBorder_Right) )
			g_pDrawPrim->DrawPrim( &m_Frame[2], 1 );
		if( (m_nBorderFlags & eBorder_Bottom) )
			g_pDrawPrim->DrawPrim( &m_Frame[3], 1 );
	}
}
Beispiel #10
0
void AIError(const char* szFormat, ...)
{
#ifndef _FINAL

	// jeffo 03/03/04:
	// Do NOT require DebugLevel to be 1, or LD will never see their errors!!
	//if (GetConsoleInt("DebugLevel",0) < 1 ) return;

	static char szBuffer[4096];
	va_list val;
	va_start(val, szFormat);
	LTVSNPrintF(szBuffer, LTARRAYSIZE(szBuffer), szFormat, val);
	va_end(val);

	// Check that the pointer is valid before use is attempted,
	// as if this is called in a WorldEdit crash, the LTServer pointer
	// is no where near existing.  This is NOT an error condition, just
	// an unfortunate side effect of WorldEdit and the engine using the same
	// GameServer.dll file for different situations.
	if ( g_pLTServer )
	{
		g_pLTServer->CPrint("AI ERROR: %s", szBuffer);
	}
#endif
}
void CClientMeleeCollisionController::DisableCollisions()
{
	for ( int iEachCollider = 0; iEachCollider < LTARRAYSIZE(m_MeleeColliders); ++iEachCollider )
	{
		m_MeleeColliders[iEachCollider].m_bDisableRequest = true;
	}
}
void CClientMeleeCollisionController::ResetCollisionData()
{
	for ( int iEachCollider = 0; iEachCollider < LTARRAYSIZE(m_MeleeColliders); ++iEachCollider )
	{
		ResetCollider( m_MeleeColliders[iEachCollider] );
	}
}
void CClientMeleeCollisionController::Update()
{
	for ( int iEachCollider = 0; iEachCollider < LTARRAYSIZE(m_MeleeColliders); ++iEachCollider )
	{
		UpdateCollider( m_MeleeColliders[iEachCollider] );
	}
}
// Converts the damagewho string in the damage to an enum.
static DamageWho FindDamageWho( HATTRIBUTE hStruct )
{
	// Initialize our search table.
	struct StringToEnum
	{
		CParsedMsg::CToken	m_tokString;
		DamageWho			m_eEnum;
	};
	static StringToEnum table[] = 
	{
		{ "ME", eDamageWho_Me },
		{ "THEM", eDamageWho_Them },
		{ "BOTH", eDamageWho_Both },
	};
	static uint32 nTableCount = LTARRAYSIZE( table );

	// Find the string location and return the enum.
	CParsedMsg::CToken tokValue = DATABASE_CATEGORY( CollisionProperty ).GETSTRUCTATTRIB( Damage, hStruct, 0, DamageWho );
	for( uint32 i = 0; i < nTableCount; i++ )	
	{
		if( table[i].m_tokString == tokValue )
			return table[i].m_eEnum;
	}

	return eDamageWho_Me;
}
Beispiel #15
0
LTRESULT SpecialMovePlugin::PreHook_EditStringList(	const char* szRezPath,
													const char* szPropName,
													char** aszStrings,
													uint32* pcStrings,
													const uint32 cMaxStrings,
													const uint32 cMaxStringLength)
{
	if (LTStrIEquals("Animation", szPropName))
	{
		for (int i = 0; i < AnimPropUtils::Count(); i++)
		{
			const char* pszAnim = AnimPropUtils::String(EnumAnimProp(i));
			if (LTSubStrIEquals(pszAnim, SPECIALMOVE_PREFIX, LTARRAYSIZE(SPECIALMOVE_PREFIX)-1))
			{
				LTStrCpy(aszStrings[(*pcStrings)++], pszAnim, cMaxStringLength);
			}
		}
		return LT_OK;
	}
	else if (LTStrIEquals("ActivationType", szPropName))
	{
		if( CategoryPlugin::Instance().PopulateStringList( DATABASE_CATEGORY( Activate ).GetCategory(), 
			aszStrings, pcStrings, cMaxStrings, cMaxStringLength ))
		{
			return LT_OK;
		}
	}

	return LT_UNSUPPORTED;
}
void CScreenHostOptionFile::Delete(const wchar_t* pwsName)
{
	char szPath[MAX_PATH*2];

	const char* szFileName = CHostOptionsMapMgr::Instance().GetFileNameFromFriendlyName( pwsName );
	if( szFileName )
		GameModeMgr::Instance( ).GetOptionsFilePath( szFileName, szPath, LTARRAYSIZE( szPath ));
	else
		GameModeMgr::Instance( ).GetOptionsFilePath( MPW2A( pwsName ).c_str( ), szPath, LTARRAYSIZE( szPath ));
		
	LTFileOperations::DeleteFile( szPath );

	CHostOptionsMapMgr::Instance().Delete( pwsName );

	CreateFileList();
}
Beispiel #17
0
BaseClass *SpawnObject(char const* pszSpawn, const LTVector& vPos, const LTRotation& rRot)
{
    if (!g_pLTServer || !pszSpawn) return NULL;

    // Make a local copy, since we change it.
    char szSpawn[2048];
    LTStrCpy( szSpawn, pszSpawn, LTARRAYSIZE(szSpawn) );

    // Pull the class name out of the spawn string...
    char* pszClassName = strtok(szSpawn, " ");
    if (!pszClassName) return NULL;

    HCLASS hClass = g_pLTServer->GetClass(pszClassName);
    if (!hClass) return NULL;

    ObjectCreateStruct theStruct;
    theStruct.m_Pos = vPos;
    theStruct.m_Rotation = rRot;

    // Set the string to be the rest of the string...
    char* pszProps = strtok(NULL, "");

    // Allocate an object...
    return (BaseClass *)g_pLTServer->CreateObjectProps(hClass, &theStruct, pszProps);
}
Beispiel #18
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 );
	}
}
Beispiel #19
0
char* GetSound(CCharacter* pCharacter, EnumAISoundType eSound)
{
/*
	if (g_pVersionMgr->IsLowViolence())
	{
		if ( (eSound == kAIS_Death) || (eSound == kAIS_DeathQuiet) || (eSound == kAIS_Pain) )
		{
			return BUILD_NOPAIN_WAV;
		}
	}
*/

	if (!pCharacter || !g_pServerSoundMgr) return NULL;
	if (eSound == kAIS_InvalidType ) return NULL;

	ModelsDB::HMODEL hModel = pCharacter->GetModel();

	HRECORD hSoundTemplate = g_pModelsDB->GetModelSoundTemplate(hModel);
	if( !hSoundTemplate )
		return NULL;

	// Look for sounds in a heirarchical manner: First look for the sound in the sound 
	// template, if it isn't found there look in the parent sound template, and so on...

	char szStr[128] = "";
	g_pAISoundDB->GetRandomSoundFilename(hSoundTemplate, AISoundUtils::String( eSound ), szStr, sizeof(szStr));

	if (!LTStrEmpty(szStr))
	{
		LTStrCpy(s_FileBuffer, szStr, LTARRAYSIZE(s_FileBuffer));
		return s_FileBuffer;
	}

	return NULL;
}
Beispiel #20
0
// --------------------------------------------------------------------------- //
//
//	ROUTINE:	LaunchApplication::LaunchMOTDLink
//
//	PURPOSE:	Launches Browser with a given MOTD Link
//
// --------------------------------------------------------------------------- //
bool LaunchApplication::LaunchMOTDLink( char const* pszUrl )
{
#if defined(PLATFORM_WIN32)

	// Check inputs.
	if( !pszUrl || !pszUrl[0] )
		return false;


	char szExe[MAX_PATH] = "";
	uint32 nExeSize = LTARRAYSIZE( szExe );
	AssocQueryString(ASSOCF_NOTRUNCATE,
		ASSOCSTR_EXECUTABLE,
		".htm",
		"open",
		szExe,
		( DWORD* )&nExeSize);


	if( !LaunchFromString( szExe, pszUrl, false, false ))
		return false;

	return true;

#else
	return false;
#endif
}
//given a font info structure, this will convert it to an actual logical font that can be
//used for rendering and other tasks
static HFONT CreateHFont(const CFontInfo& FontInfo)
{
	//clear out the logical font structure first
	LOGFONTW LogFont;
	memset( &LogFont, 0, sizeof( LogFont ));

	//now fill in each property
	LogFont.lfHeight = FontInfo.m_nHeight;

	//setup the weight to be either normal or bold
	LogFont.lfWeight = FontInfo.IsStyleSet(CFontInfo::kStyle_Bold) ? FW_BOLD : FW_NORMAL;

	//setup any additional styles such as italics, underline, etc.
	LogFont.lfItalic = FontInfo.IsStyleSet(CFontInfo::kStyle_Italic);

	//now just some standard flags for truetype fonts
	LogFont.lfCharSet				= FontInfo.m_lfCharSet;  // default is machines charset
	LogFont.lfOutPrecision		= OUT_TT_PRECIS;
	LogFont.lfClipPrecision		= CLIP_DEFAULT_PRECIS;
	LogFont.lfQuality				= ANTIALIASED_QUALITY;
	LogFont.lfPitchAndFamily	= DEFAULT_PITCH;

	//and finally copy over the typeface name
	LTStrCpy( LogFont.lfFaceName, FontInfo.m_szTypeface, LTARRAYSIZE(LogFont.lfFaceName) );

	return ::CreateFontIndirectW(&LogFont);
}
Beispiel #22
0
void CCheatMgr::GimmeAmmo( CParsedMsgW const& cMsg )
{
	if( !g_pWeaponDB || cMsg.GetArgCount() < 2 )
		return;

	// The full name of the ammo 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 szAmmoName[WMGR_MAX_NAME_LENGTH] = {0};
	cMsg.ReCreateMsg( szAmmoName, LTARRAYSIZE( szAmmoName ), 1 );

	HAMMO hAmmo = g_pWeaponDB->GetAmmoRecord( MPW2A(szAmmoName).c_str() );

	wchar_t wszMessage[256] = L"";

	if( hAmmo )
	{
		SendCheatMessageHRecord( CHEAT_GIMMEAMMO, hAmmo );

		LTSNPrintF( wszMessage, ARRAY_LEN(wszMessage), L"Giving ammo '%s'", szAmmoName );
		g_pGameMsgs->AddMessage( wszMessage, kMsgCheatConfirm );
	}
	else
	{
		LTSNPrintF( wszMessage, ARRAY_LEN(wszMessage), L"Ammo '%s' does not exist!", szAmmoName );
		g_pGameMsgs->AddMessage( wszMessage, kMsgCheatConfirm );
	}
}
Beispiel #23
0
// Remove a character from the end
void CLTGUIEditCtrl::RemoveCharacter()
{

	// Check to see have any chars
	if (m_Text.IsEmpty())
		return;

	LTStrCpy(szString,m_Text.GetText(), LTARRAYSIZE(szString));

	uint32 nEnd=LTStrLen(szString);
	if (nEnd > m_nCaretPos)
	{
		uint32 nIndex = m_nCaretPos;

		while (nIndex < nEnd)
		{
			szString[nIndex] = szString[nIndex+1];
			nIndex++;
		}

		szString[nIndex]=L'\0';
		m_Text.SetText(szString);
	}

}
Beispiel #24
0
//called to recursively search down the attachment tree, looking for the socket provided. This
//will return a handle to the socket, or an invalid handle if no match could be found
bool FindModelSocketRecurse(HOBJECT hObj, const char* pszNodeName, HOBJECT& hFoundModel, HMODELSOCKET& hFoundSocket)
{
	//default the result to an invalid value
	hFoundModel = NULL;
	hFoundSocket = INVALID_MODEL_SOCKET;

	//see if this provided model has the socket we are looking for
	if(g_pLTClient->GetModelLT()->GetSocket(hObj, pszNodeName, hFoundSocket) == LT_OK)
	{
		//we found a match!
		hFoundModel = hObj;
		return true;
	}

	//no match, recurse into the attachments
	HOBJECT hAttachList[MAX_ATTACHMENTS_PER_MODEL];
	uint32 nListSize, nNumAttachments;

	if (g_pLTClient->Common()->GetAttachments(hObj, hAttachList,
		LTARRAYSIZE(hAttachList), nListSize, nNumAttachments) == LT_OK)
	{
		for (uint32 nCurrAttach = 0; nCurrAttach < nListSize; nCurrAttach++)
		{
			if(FindModelSocketRecurse(hAttachList[nCurrAttach], pszNodeName, hFoundModel, hFoundSocket))
				return true;
		}
	}

	//no match
	return false;
}
Beispiel #25
0
void Door::UpdateSector( bool bSectorActive )
{
	for(uint32 nCurrSector = 0; nCurrSector < knNumSectors; nCurrSector++)
	{
		// Do nothing if we don't have a sector
		if( m_sSectorName[nCurrSector].empty() )
			return;

		// Just in case we get in here before we expect to, update the sector ID..
		if( !m_nSectorID[nCurrSector] )
		{
			if( g_pLTServer->GetSectorID( m_sSectorName[nCurrSector].c_str(), &m_nSectorID[nCurrSector] ) != LT_OK )
			{
				// If we can't find the sector, dump a warning and forget...
				char aNameBuff[256];
				g_pLTServer->GetObjectName( m_hObject, aNameBuff, LTARRAYSIZE(aNameBuff) );
				g_pLTServer->CPrint( "Invalid sector specified in door %s: %s", aNameBuff, m_sSectorName[nCurrSector].c_str() );
				m_sSectorName[nCurrSector].clear();
				return;
			}
		}

		m_bSectorsActive = bSectorActive;

		// Send the dynamic sector message to all connected clients...
		// This is temporary until we get the new networking architecture in place.
		// We can't do it with an FX object because activeworldmodels already have an FX object...
		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_DYNAMIC_SECTOR );
		cMsg.Writeuint32( m_nSectorID[nCurrSector] );
		cMsg.Writebool( bSectorActive );

		g_pLTServer->SendToClient( cMsg.Read(), NULL, MESSAGE_GUARANTEED);
	}
}
Beispiel #26
0
void CLoadingScreen::ReadMissionInfo(HRECORD hMission)
{
	uint32 nCurLevel = g_pMissionMgr->GetCurrentLevel( );
	HRECORD hLevel = g_pMissionDB->GetLevel(hMission,nCurLevel);


	if (IsMultiplayerGameClient())
	{
		m_photo = g_pMissionDB->GetString(hLevel,MDB_Photo);
	}
	else
	{
		// Show a briefing for this level if it exists.  Also, only
		// show the briefing if we haven't been to this level before.
		const char* szBriefingId = g_pMissionDB->GetString(hLevel,MDB_Briefing);
		if( (!LTStrIEquals(szBriefingId,"<none>")) && !g_pMissionMgr->IsRestoringLevel( ))
		{
			m_Briefing.SetString(LoadString( szBriefingId ));
			char const* pszLoadScreen = g_pMissionDB->GetString( hMission, MDB_BriefingLayout );
			m_layout = g_pLayoutDB->GetLoadScreenRecord( pszLoadScreen );
		}
		else
		{
			m_Briefing.SetString(L"");
			char const* pszLoadScreen = g_pMissionDB->GetString( hMission, MDB_Layout );
			m_layout = g_pLayoutDB->GetLoadScreenRecord( pszLoadScreen );
		}

		m_ServerMsg.SetString(L"");

		g_CurrentLayout.Read(m_layout);

	}

	if (m_eCurState != STATE_NONE)
	{
		UpdateLayout();
	}


	wchar_t wszMissionDiplayName[MAX_PATH];
	g_pMissionDB->GetMissionDisplayName( hMission, hLevel, wszMissionDiplayName, LTARRAYSIZE( wszMissionDiplayName ));

	m_MissionName.SetFont(g_CurrentLayout.m_sTitleFont);
	m_MissionName.SetString( wszMissionDiplayName );
	m_LevelName.SetString(LoadString( g_pMissionDB->GetString(hLevel,MDB_Name)));

	// Show help text for this level if it exists.
	const char* szHelpId = g_pMissionDB->GetString(hLevel,MDB_Help);
	if( szHelpId[0] != '\0' )
	{
		m_Help.SetString(CreateHelpString( szHelpId ));
	}
	else
	{
		m_Help.SetString(L"");
	}

}
Beispiel #27
0
void CTargetMgr::SetTargetStringID(const char* szID)
{
	m_szStringID = szID;
	if( (szID != NULL) && (szID[0] != '\0') )
		LTStrCpy(m_wszString, LoadString(szID), LTARRAYSIZE(m_wszString) );
	else
		m_wszString[0] = '\0';
}
Beispiel #28
0
void CLoadingScreen::UpdateSessionName( )
{
	// If connecting to a remote server, set our mission descriptor to 
	// the ip we're connecting to.
	if( g_pClientConnectionMgr->IsConnectedToRemoteServer( ))
	{
		// Make a loading string using the IP to be joined.
		wchar_t szLoadingString[256];

//		LTSNPrintF( szSession, LTARRAYSIZE(szSession), L"%s", g_pClientConnectionMgr->GetStartGameRequest().m_pNetSession->m_sName );
		if ( !LTStrEmpty(g_pClientConnectionMgr->GetServerName()))
		{
			LTSNPrintF( szLoadingString, LTARRAYSIZE(szLoadingString), L"%s:  %s", LoadString("IDS_CONNECTING_TO_SERVER"), 
				g_pClientConnectionMgr->GetServerName() );
		}
		else
		{
			LTSNPrintF( szLoadingString, LTARRAYSIZE(szLoadingString), L"%s", LoadString("IDS_CONNECTING_TO_SERVER"));
		}
		m_MissionName.SetFont(g_CurrentLayout.m_sLevelFont);
		m_MissionName.SetString(szLoadingString);

		LTSNPrintF( szLoadingString, LTARRAYSIZE(szLoadingString), L"    (%S)", g_pClientConnectionMgr->GetStartGameRequest( ).m_TCPAddress );

		m_LevelName.SetString(szLoadingString);
	}
	// Local game, set the mission descriptor to the level name.
	else
	{
		m_MissionName.SetFont(g_CurrentLayout.m_sTitleFont);
		if (g_pGameClientShell->IsRunningPerformanceTest())
		{
			m_MissionName.SetString(LoadString( "IDS_TITLE_PERFORMANCE_TEST" ));
			m_LevelName.SetString(L"");
		}
		else
		{
			m_MissionName.SetString(LoadString( "IDS_CUSTOM_LEVEL" ));
			// Split the worldname up into parts so we can get the load string.
			wchar_t szWorldTitle[MAX_PATH] = L"";
			_wsplitpath( MPA2W(g_pMissionMgr->GetCurrentWorldName( )).c_str(), NULL, NULL, szWorldTitle, NULL );
			m_LevelName.SetString(szWorldTitle);
		}
	}
}
bool LTProfileUtils::WriteUint32(const char* pszSectionName, 
								const char* pszKeyName,
								uint32 nValue,
								const char* pszFileName)
{
	char szValue[64];
	LTSNPrintF( szValue, LTARRAYSIZE( szValue ), "%d", nValue );
	return (WriteString(pszSectionName, pszKeyName, szValue, pszFileName) != 0);
}
Beispiel #30
0
LTRESULT GunMountPlugin::PreHook_Dims(const char* szRezPath,
									  const char* szPropName, 
										 const char* szPropValue,
										 char* szModelFilenameBuf,
										 int nModelFilenameBufLen,
										 LTVector & vDims,
										 const char* pszObjName, 
										 ILTPreInterface *pInterface)
{

	if (!szModelFilenameBuf || nModelFilenameBufLen < 1 )
		return LT_UNSUPPORTED;

	szModelFilenameBuf[0] = '\0';

	// Remove the , that is put into some weapon names.
	char szModifiedPropValue[256];
	LTStrCpy( szModifiedPropValue, szPropValue, LTARRAYSIZE(szModifiedPropValue) );
	strtok( szModifiedPropValue, "," );

	HATTRIBUTE hAttrib = NULL;
	HWEAPON hWeapon = g_pWeaponDB->GetWeaponRecord( szModifiedPropValue );
	HWEAPONDATA hWpnData = g_pWeaponDB->GetWeaponData(hWeapon, !USE_AI_DATA);
	HATTRIBUTE hWeaponModelStruct = g_pWeaponDB->GetAttribute( hWpnData, WDB_WEAPON_RightHandWeapon );

	hAttrib = g_pWeaponDB->GetStructAttribute( hWeaponModelStruct, 0, WDB_WEAPON_sHHModel );
	const char *pszHHModel = g_pWeaponDB->GetString( hAttrib );
	if( !pszHHModel[0] )
	{
		// Check the left model...
		hWeaponModelStruct = g_pWeaponDB->GetAttribute( hWpnData, WDB_WEAPON_LeftHandWeapon );

		hAttrib = g_pWeaponDB->GetStructAttribute( hWeaponModelStruct, 0, WDB_WEAPON_sHHModel );
		pszHHModel = g_pWeaponDB->GetString( hAttrib );
		if( !pszHHModel[0] )
		{
			return LT_UNSUPPORTED;
		}
	}

	LTStrCpy( szModelFilenameBuf, pszHHModel, LTARRAYSIZE(szModifiedPropValue) );

	return LT_OK;
}