Ejemplo n.º 1
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 );
	}
}
Ejemplo n.º 2
0
LTRESULT dsi_SetupMessage(char *pMsg, int maxMsgLen, LTRESULT dResult, va_list marker) {
    int i;
    unsigned long resultCode, stringID;
    LTBOOL bFound;
    uint32 args[4], nBytes;
    char tempBuffer[500];

    pMsg[0] = 0;

    if (!g_hResourceModule) {
        LTSNPrintF(pMsg, maxMsgLen, "<missing resource DLL>");
        return LT_ERROR;
    }

    // Try to find the error code.
    bFound = LTFALSE;
    resultCode = ERROR_CODE(dResult);
    for (i=0; i < STRINGMAP_SIZE; i++) {
        if (g_StringMap[i].dResult == resultCode) {
            bFound = LTTRUE;
            stringID = g_StringMap[i].string_id;
            break;
        }
    }

    if (bFound) {
        nBytes = LoadString(g_hResourceModule, stringID, tempBuffer, sizeof(tempBuffer)-1);
        if (nBytes > 0) {
            // Format it.
            nBytes = FormatMessage(FORMAT_MESSAGE_FROM_STRING, tempBuffer, 0, 0, pMsg, maxMsgLen, &marker);

            if (nBytes > 0)
                return LT_OK;
        }
    }

    // Ok, format the default message.
    args[0] = resultCode;
    nBytes = FormatMessage(FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_ARGUMENT_ARRAY,
        g_hResourceModule, IDS_GENERIC_ERROR, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        pMsg, maxMsgLen, (va_list*)args);

    if (nBytes > 0) {
        return LT_OK;
    }
    else {
        LTSNPrintF(pMsg, maxMsgLen, "<invalid resource DLL>");
        return LT_ERROR;
    }
}
Ejemplo n.º 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 );
}
Ejemplo n.º 4
0
void DecisionObject::ReadProp(const GenericPropList *pProps)
{
	char szPropName[128] = {0};

	for( uint32 nDecision = 1; nDecision <= MAX_DECISION_CHOICES; ++nDecision )
	{
		LTSNPrintF( szPropName, ARRAY_LEN(szPropName), "Choice%dStringID", nDecision );
		m_ChoiceData[nDecision-1].nStringID = IndexFromStringID( pProps->GetStringID(szPropName, "") );
		
		LTSNPrintF( szPropName, ARRAY_LEN(szPropName), "Choice%dCmd", nDecision );
		m_ChoiceData[nDecision-1].sCmd = pProps->GetCommand( szPropName, "" );
	}
	
	m_sAbortCmd = pProps->GetCommand( "AbortCmd", "" );
	m_bRemoveAfterChoice = pProps->GetBool( "RemoveAfterChoice", m_bRemoveAfterChoice );
}
Ejemplo n.º 5
0
void TeamPopulateEditStringList( 
								char** aszStrings,
								uint32* pcStrings,
								const uint32 cMaxStrings,
								const uint32 cMaxStringLength
								)
{
	char szTeam[32] = {0};

	LTASSERT(cMaxStrings > (*pcStrings) + 1, "Too many teams for stringlist.");
	if( *pcStrings < cMaxStrings )
	{
		LTStrCpy( aszStrings[(*pcStrings)++], "NoTeam", cMaxStringLength );

		for( int i = 0; i < MAX_TEAMS; ++i )
		{
			LTASSERT(cMaxStrings > (*pcStrings) + 1, "Too many teams for stringlist.");
			// exit out early if we can't hold any more strings
			if( *pcStrings >= cMaxStrings )
				return;

			LTSNPrintF( szTeam, ARRAY_LEN(szTeam), "Team%i", i );
			if( (LTStrLen( szTeam ) < cMaxStringLength) && ((*pcStrings) + 1 < cMaxStrings) )
			{
				LTStrCpy( aszStrings[(*pcStrings)++], szTeam, cMaxStringLength );
			}
		}
	}

	// Sort the list so turret types are easier to find.  Skip the first item
	// since it's the none selection.
	qsort( aszStrings + 1, *pcStrings - 1, sizeof(char *), CaseInsensitiveCompare );
}
Ejemplo n.º 6
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);
		}
	}
}
Ejemplo n.º 7
0
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);
}
Ejemplo n.º 8
0
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 );
}
Ejemplo n.º 9
0
bool CHUDDebugInput::Init()
{

	UpdateLayout();
	ScaleChanged();

	wchar_t szTemp[64];
	LTSNPrintF(szTemp,LTARRAYSIZE(szTemp),L"%s: ",LoadString("IDS_DEBUGMSG"));
	m_Text.SetText(szTemp);

	return true;
}
Ejemplo n.º 10
0
void BuildFindFileResult(const char* pszDirectory, const char* pszFullFileName, LTFINDFILEINFO* pFindFileInfo)
{
	char pszFullFileNameWithPath[_MAX_DIR + _MAX_FNAME + _MAX_EXT + 1];
	::memset(pszFullFileNameWithPath, 0, LTARRAYSIZE(pszFullFileNameWithPath));
	if (pszDirectory[0] != (char)NULL)
	{
		LTSNPrintF(pszFullFileNameWithPath, LTARRAYSIZE(pszFullFileNameWithPath), "%s/%s", pszDirectory, pszFullFileName);
	}
	else
	{
		LTSNPrintF(pszFullFileNameWithPath, LTARRAYSIZE(pszFullFileNameWithPath), "%s", pszFullFileName);
	}
	
	struct stat statInfo;
	::stat(pszFullFileNameWithPath, &statInfo);
	
	pFindFileInfo->bIsSubdir   = S_ISDIR(statInfo.st_mode) ? true : false;
	pFindFileInfo->time_access = statInfo.st_atime;
	pFindFileInfo->time_write  = statInfo.st_mtime;
	pFindFileInfo->size        = (uint64)statInfo.st_size;
	LTStrCpy(pFindFileInfo->name, pszFullFileName, LTARRAYSIZE(pFindFileInfo->name));	
}
Ejemplo n.º 11
0
void CNamedObjectList::ReadProp(const GenericPropList *pProps, const char* pszObjectType)
{
	// Read list of objects. This list may start at either 0 or 1, so ignore a
	// blank first string.

	uint32 iObject = 0;
	char szBuffer[128];
	LTSNPrintF( szBuffer, LTARRAYSIZE( szBuffer ), "%s%d", pszObjectType, iObject );

	const char* pszPropString = pProps->GetString( szBuffer, "" );
	while( pszPropString[0] || iObject == 0 )
	{
		if ( !LTStrEmpty(pszPropString) )
		{
			std::string sTmp;
			sTmp = pszPropString;
			m_lstObjectNames.push_back( sTmp );
		}

		++iObject;
		LTSNPrintF( szBuffer, LTARRAYSIZE( szBuffer ), "%s%d", pszObjectType, iObject );
		pszPropString = pProps->GetString( szBuffer, "" );
	}
}
Ejemplo n.º 12
0
void CHUDControlPointBar::CHUDControlPoint::SetIndex(uint16 nIndex)
{
	if (nIndex >= MAX_CONTROLPOINT_OBJECTS)
	{
		m_Text.SetText(L"");
		m_nIndex = 0;
	}
	else
	{
		wchar_t wsText[8] = L"";
		LTSNPrintF(wsText,LTARRAYSIZE(wsText),L"%d",nIndex);
		m_Text.SetText(wsText);
		m_nIndex = nIndex;
	}
}
Ejemplo n.º 13
0
void GameBase::HandleModelString( ArgList* pArgList )
{
	static CParsedMsg::CToken s_cTok_KEY_COMMAND( "CMD" );

	if( !pArgList || !pArgList->argv || pArgList->argc == 0 )
		return;

	char* pKey = pArgList->argv[0];
	if( !pKey )
		return;

	CParsedMsg::CToken tok( pKey );

	if( tok == s_cTok_KEY_COMMAND )
	{
		
		char szBuffer[256] = {0};
		bool bAddParen = false;

		// Rebuild the command string and queue it up...

		LTSNPrintF( szBuffer, LTARRAYSIZE( szBuffer ), "%s", pArgList->argv[1] );
		for( int nArg = 2; nArg < pArgList->argc; ++nArg )
		{
			bAddParen = false;
			strcat(szBuffer, " ");
			if( strstr( pArgList->argv[nArg], " " ))
			{
				// Enclose the argument in parens if it's broken up into multiple arguments...
				strcat( szBuffer, "(" );
				bAddParen = true;
			}

			strcat( szBuffer, pArgList->argv[nArg] );

			if( bAddParen )
			{
				// Tailing paren if needed...
				strcat( szBuffer, ")" );
			}
		}

		g_pCmdMgr->QueueCommand( szBuffer, m_hObject, m_hObject );
	}
}
Ejemplo n.º 14
0
void CAIGoalStunned::ActivateGoal()
{
	super::ActivateGoal();

	// Kick stunner into slo-mo.

	CAIWMFact factQuery;
	factQuery.SetFactType( kFact_Desire );
	factQuery.SetDesireType( kDesire_Stunned );
	CAIWMFact* pFact = m_pAI->GetAIWorkingMemory()->FindWMFact( factQuery );
	if( !pFact )
	{
		return;
	}

	// Only do slow-mo if stunner is a player.

	HOBJECT hStunner = pFact->GetTargetObject();
	if( !IsPlayer( hStunner ) )
	{
		return;
	}
	CPlayerObj* pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject( hStunner );

	// Enter slow-mo.

	HRECORD hSlowMoRecord = g_pAIDB->GetMiscRecordLink( SLOWMO_RECORD );
	if( hSlowMoRecord )
	{
		g_pGameServerShell->EnterSlowMo( hSlowMoRecord, -1.0f, NULL, CPlayerObj::kTransition | CPlayerObj::kUsePlayerTimeScale );
	}

	// Disable the flashlight immediately after some flickering.

	ILTBaseClass* pStunner = g_pLTServer->HandleToObject( hStunner );
	float fFlickerTime = g_pAIDB->GetMiscFloat( FLASHLIGHT_FLICKER_TIME );

	char szCommand[128];
	LTSNPrintF( szCommand, LTARRAYSIZE( szCommand ), "FLASHLIGHT DISABLE %f", fFlickerTime );
	g_pCmdMgr->QueueMessage( m_pAI, pStunner, szCommand );
}
Ejemplo n.º 15
0
bool LTFileOperations::GetTempFileName(const char* pszTempFilePath, const char* pszTempFileNamePrefix, char* pszTempFileNameBuffer, uint32 nTempFileNameBufferSize)
{
	// build the template for mktemp
	char szTemplate[MAX_PATH+1];
	LTSNPrintF(szTemplate, LTARRAYSIZE(szTemplate), "%s%stmp.XXXXXX", pszTempFilePath, FILE_PATH_SEPARATOR, pszTempFileNamePrefix);
	
	// call mkstemp
	int fd = ::mkstemp(szTemplate);
	if (fd == -1)
	{
		return false;
	}
	
	// close the file
	::close(fd);
	
	// copy the result
	LTStrCpy(pszTempFileNameBuffer, szTemplate, nTempFileNameBufferSize);

	return true;
}
Ejemplo n.º 16
0
void CScreenHostOptionFile::New(const wchar_t* pwsName )
{
	if( !LTFileOperations::DirectoryExists( GameModeMgr::Instance( ).GetOptionsFolder( )))
	{
		if( !LTFileOperations::CreateNewDirectory( GameModeMgr::Instance( ).GetOptionsFolder( )))
		{
			//TODO: error message
			return;
		}
	}

	// check if this name exists in the map file
	if( CHostOptionsMapMgr::Instance().IsFriendlyNameMapped(pwsName) )
	{
		MBCreate mb;
		mb.eType = LTMB_OK;
		g_pInterfaceMgr->ShowMessageBox("IDS_OPTIONFILE_EXISTS",&mb);
		return;
	}

	// create a new file name that is in ANSI
	char szFileTitle[64];
	char szPath[MAX_PATH*2];
	for(uint32 nFile=0;;++nFile)
	{
		LTSNPrintF( szFileTitle, LTARRAYSIZE(szFileTitle), "ServerOptions%.4d", nFile );
		GameModeMgr::Instance( ).GetOptionsFilePath( szFileTitle, szPath, LTARRAYSIZE( szPath ));
		if( !LTFileOperations::FileExists(szPath) && 
			!CHostOptionsMapMgr::Instance().IsFileNameMapped(szPath) )
			break;
	}

	// add this combination
	CHostOptionsMapMgr::Instance().Add( szFileTitle, pwsName );

	g_pProfileMgr->GetCurrentProfile()->m_sServerOptionsFile = szFileTitle;

	CreateFileList();
	Escape( );
}
Ejemplo n.º 17
0
bool GameBase::ReadProp( ObjectCreateStruct* pStruct )
{
	if( !pStruct )
		return false;

	// Check for a template object
	if( pStruct->m_cProperties.GetBool("Template", false))
	{
		// Save the template
		g_pGameServerShell->GetObjectTemplates()->AddTemplate( pStruct );

		// Don't actually create the object
		return false;
	}
	if ( !( pStruct->m_Name[0] ))
	{
		LTSNPrintF( pStruct->m_Name, ARRAY_LEN(pStruct->m_Name), "noname%d", g_pGameServerShell->GetUniqueObjectID() );
		g_pGameServerShell->IncrementUniqueObjectID();
	}

	// After the auto save has been created dynamically created objects that should not exist in the level 
	// should just never be created...
	if( g_pGameServerShell->GetSwitchingWorldsState( ) == eSwitchingWorldsStateFinished )
	{
		uint32 nUserFlags = 0;
		if( pStruct->m_cProperties.GetBool( "IsGore", false ))
		{
			nUserFlags |= USRFLG_GORE;
		}

		EEngineLOD eObjectLOD = CEngineLODPropUtil::StringToLOD( pStruct->m_cProperties.GetString( "ObjectLOD", "Low" ), eEngineLOD_Low );
		nUserFlags |= ObjectLODToUserFlag( eObjectLOD );

		// Don't bother creating the object if the client settings won't allow it...
		if( g_pGameServerShell->ShouldRemoveBasedOnClientSettings( nUserFlags ))
			return false;
	}

	return true;
}
Ejemplo n.º 18
0
bool Group::ReadProp(const GenericPropList *pProps)
{
	char szObject[128] = {0};

	m_saObjectNames.reserve( MAX_GROUP_TARGETS );

	for( uint32 nTarget = 0; nTarget < MAX_GROUP_TARGETS; ++nTarget )
	{
		LTSNPrintF( szObject, ARRAY_LEN(szObject), "Object%d", nTarget + 1 );
		
		const char *pszTargetName = pProps->GetString( szObject, "" );	
		if( pszTargetName && pszTargetName[0] )
		{
			m_saObjectNames.push_back( pszTargetName );
		}
	}

	// Shrink-to-fit...
	StringArray( m_saObjectNames ).swap( m_saObjectNames );

	return true;
}
Ejemplo n.º 19
0
void Group::HandleAllMsgs( HOBJECT hSender, const CParsedMsg &crParsedMsg )
{
	char szMsgArgs[256];
	crParsedMsg.ReCreateMsg( szMsgArgs, ARRAY_LEN(szMsgArgs), 0 );

	if( !szMsgArgs[0] )
		return;
		
	for( StringArray::iterator iter = m_saObjectNames.begin(); iter != m_saObjectNames.end(); ++iter )
	{
		if( !(*iter).empty() )
		{
			const char* pszObjectName = iter->c_str();

			// This needs to be format string characters +
			// LTARRAYSIZE(szMsgArgs) + MaxObjectName characters long.
			char szMsg[10 + LTARRAYSIZE(szMsgArgs) + MAX_CS_FILENAME_LEN]; 
			LTSNPrintF(szMsg, LTARRAYSIZE(szMsg), "msg %s (%s);", pszObjectName, szMsgArgs );
			g_pCmdMgr->QueueCommand( szMsg, hSender, NULL );
		}
	}
}
Ejemplo n.º 20
0
bool BanIPMgr::ConvertClientIPToString( ClientIP const& bannedIP, char* pszClientIP, uint32 nSize )
{
	// Check inputs.
	if( !pszClientIP )
		return false;

	std::string sClientIP = "";

	for( int i = 0; i < 4; i++ )
	{
		// Check if this part is using a wildcard.
		if( bannedIP.m_nPart[i] == ( uint8 )-1 )
		{
			sClientIP += "*";
			break;
		}
		// A real number.
		else
		{
			char szNum[16] = "";
			LTSNPrintF( szNum, LTARRAYSIZE( szNum ), "%d", bannedIP.m_nPart[i] );
			sClientIP += szNum;
		}

		// If not the last part, put in a separator.
		if( i < 3 )
		{
			sClientIP += ".";
		}
	}

	// If there isn't room, then return failure.
	if( sClientIP.length( ) > nSize - 1 )
		return false;

	LTStrCpy( pszClientIP, sClientIP.c_str( ), nSize );

	return true;
}
Ejemplo n.º 21
0
const wchar_t* HUDSliderTextCallback(int nPos, void* pUserData)
{
	if (nPos == kMinFade)
		return LoadString("IDS_HUD_FADE_DISABLED");
	else if (nPos == int(kfFadeDefault))
	{
		return LoadString("IDS_SPEED_NORMAL");
	}

	static wchar_t wszBuffer[128];
	wchar_t wszTmp[16];
	float fHUDFadeSpeed = float(nPos) / kfFadeDefault;
	LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"x%0.1f",fHUDFadeSpeed);
	if (nPos > int(kfFadeDefault))
	{
		FormatString( "IDS_SPEED_FAST", wszBuffer, LTARRAYSIZE(wszBuffer), wszTmp );
		return wszBuffer;
	}

	FormatString( "IDS_SPEED_SLOW", wszBuffer, LTARRAYSIZE(wszBuffer), wszTmp );
	return wszBuffer;
}
Ejemplo n.º 22
0
Ani CAnimator::AddAni(const char* szAni)
{
	// Look for override first. Override is "+" + szAni;

	char szOverrideAni[128];
	LTSNPrintF( szOverrideAni, LTARRAYSIZE( szOverrideAni ), "+%s", szAni);

    HMODELANIM hAni = g_pLTBase->GetAnimIndex(m_hObject, (char*)szOverrideAni);

	if ( hAni == INVALID_MODEL_ANIM )
	{
		// Override could not be found. Just use the normal ani.

        hAni = g_pLTBase->GetAnimIndex(m_hObject, (char*)szAni);

		if ( hAni == INVALID_MODEL_ANIM )
		{
			// We couldn't even find the normal ani.

			//LTERROR( "Normal animation not found");
			return eAniInvalid;
		}
		else
		{
			// We found the normal ani.

			m_ahAnis[m_cAnis] = hAni;
			return (Ani)m_cAnis++;
		}
	}
	else
	{
		// We found the override ani.

		m_ahAnis[m_cAnis] = hAni;
		return (Ani)m_cAnis++;
	}
}
Ejemplo n.º 23
0
void DynamicSectorVolume::ReadProps( const GenericPropList *pProps )
{
	ASSERT( pProps != NULL );	

	char szPropName[32] = {0};
	const char *pszSector = NULL;

	for( uint32 nSector = 1; nSector < kMaxSectors; ++nSector )
	{
		LTSNPrintF( szPropName, ARRAY_LEN(szPropName), "SectorName%i", nSector );
		pszSector = pProps->GetString( szPropName, "" );

		if( pszSector && pszSector[0] )
		{
			uint32 nId = 0;
			if( LT_OK == g_pLTServer->GetSectorID( pszSector, &nId ))
			{
				m_nSectorIds[m_nNumSectors] = nId;
				m_nNumSectors++;
			}
		}
	}
}
void CClientMeleeCollisionController::EnableCollisions(HOBJECT hObj, ANIMTRACKERID nTrackerId, const char* pszColliderRecord, float flDurationS, bool bBlocking)
{
	// Find an unused collider.  If there isn't one, assert.  We are currently
	// assuming we only need two max (one of each of an AIs dual weapons). If
	// we validly need more, we may want to either increase the count or 
	// make these dynamic.

	MeleeCollider* pCollider = NULL;
	for ( int iEachCollider = 0; iEachCollider < LTARRAYSIZE(m_MeleeColliders); ++iEachCollider )
	{
		if ( INVALID_PHYSICS_COLLISION_NOTIFIER == m_MeleeColliders[iEachCollider].m_hCollisionNotifier )
		{
			pCollider = &m_MeleeColliders[iEachCollider];
			break;
		}
	}
	if ( NULL == pCollider )
	{
		char szError[256];
		LTSNPrintF(szError, LTARRAYSIZE(szError), "CClientMeleeCollisionController::EnableCollisions: Too many attacks and blocks at once.  '%s' will be ignored.", pszColliderRecord );
		LTERROR(szError);
		return;
	}

	// Clear out the collider, just in case any state remained.

	ResetCollider( *pCollider );

	bool bLocallyControlled = (hObj == g_pPlayerMgr->GetMoveMgr()->GetObject());

	// Grab the desired collision specifications from the database.
	HRECORD hMeleeCollider = g_pWeaponDB->GetMeleeColliderRecord(pszColliderRecord);
	if (!hMeleeCollider)
	{
		char szError[256];
		LTSNPrintF(szError, LTARRAYSIZE(szError), "ColliderRecord not found! '%s'", pszColliderRecord);
		LTERROR(szError);
		return;
	}

	// Keep track of our current animation so we know when it changes (see Update).
	pCollider->m_hAnimObject = hObj;
	pCollider->m_nTrackerID = nTrackerId;
	g_pModelLT->GetCurAnim(pCollider->m_hAnimObject, pCollider->m_nTrackerID, pCollider->m_hAnim);

	// Keep track of an optional end time (see Update).
	pCollider->m_fEndTime = (flDurationS > 0.0f) ? g_pLTClient->GetTime() + flDurationS : 0.0f;

	// Find the specified socket.
	pCollider->m_hSocketParent = NULL;
	pCollider->m_hSocket = INVALID_MODEL_SOCKET;
	const char* pszNodeName = g_pWeaponDB->GetString(hMeleeCollider, "NodeName");

	// Check attachments first...
	HOBJECT hParent = NULL;
	if (FindAttachmentSocket(hObj, pszNodeName, &hParent, &pCollider->m_hSocket))
	{
		pCollider->m_hSocketParent = hParent;
	}

	// Then check the model...
	else if (g_pModelLT->GetSocket(hObj, pszNodeName, pCollider->m_hSocket) == LT_OK)
	{
		pCollider->m_hSocketParent = hObj;
	}

	if (pCollider->m_hSocket == INVALID_MODEL_SOCKET)
	{
		char szError[256];
		LTSNPrintF(szError, LTARRAYSIZE(szError), "Socket not found! '%s'", pszNodeName);
		LTERROR(szError);
		return;
	}
	LTASSERT(pCollider->m_hSocketParent, "Socket assigned with no Parent!");

	LTTransform tSocket;
	if (LT_OK != g_pModelLT->GetSocketTransform(pCollider->m_hSocketParent, pCollider->m_hSocket, tSocket, true))
		return;

	ILTPhysicsSim* pILTPhysicsSim = g_pLTBase->PhysicsSim();

	// Create shape dynamically
	float fLengthUp		= g_pWeaponDB->GetFloat(hMeleeCollider, "LengthUp");
	float fLengthDown	= g_pWeaponDB->GetFloat(hMeleeCollider, "LengthDown");
	float fRadius		= g_pWeaponDB->GetFloat(hMeleeCollider, "Radius");

	HPHYSICSSHAPE hShape = pILTPhysicsSim->CreateCapsuleShape(
		LTVector(0.0f, -fLengthDown, 0.0f),
		LTVector(0.0f, fLengthUp, 0.0f),
		fRadius, 1.0f, 1000.0f);

	if (hShape == INVALID_PHYSICS_SHAPE)
	{
		LTERROR("Failed to create shape!");
		return;
	}

	EPhysicsGroup ePhysicsGroup =
		bBlocking ?
			PhysicsUtilities::ePhysicsGroup_UserBlockMelee :
		bLocallyControlled ?
			PhysicsUtilities::ePhysicsGroup_UserLocalMelee :
			PhysicsUtilities::ePhysicsGroup_UserRemoteMelee;

	pCollider->m_hRigidBody = pILTPhysicsSim->CreateRigidBody(hShape, LTRigidTransform(tSocket.m_vPos, tSocket.m_rRot), true, ePhysicsGroup, 0, 0.5f, 0.0f);

	pILTPhysicsSim->ReleaseShape(hShape);

	if (pCollider->m_hRigidBody == INVALID_PHYSICS_RIGID_BODY)
	{
		LTERROR("Failed to create RigidBody!");
		return;
	}

	// Calculate the scaled radius...
	pCollider->m_fScaledRadius = fRadius * g_pWeaponDB->GetFloat(hMeleeCollider, "CollisionRadiusScale");

	// Create collision notifier
	LTASSERT((pCollider->m_hCollisionNotifier == INVALID_PHYSICS_COLLISION_NOTIFIER), "CollisionNotifier leak!");

	if (!bBlocking)	// blocking will be handled by the attacker, and therefore will not require a collider.
	{
		pCollider->m_hCollisionNotifier =
			pILTPhysicsSim->RegisterCollisionNotifier(pCollider->m_hRigidBody, CollisionNotifier, pCollider);
		pILTPhysicsSim->EnableRigidBodyPinnedCollisions(pCollider->m_hRigidBody, true);
	}
}
Ejemplo n.º 25
0
uint32 CScreenProfile::OnCommand(uint32 dwCommand, uint32 dwParam1, uint32 dwParam2)
{
	switch (dwCommand)
	{
	case CMD_OK:
		{
			m_pDlg->Show(false);
			SetCapture(NULL);
			HandleDlgCommand(nCommand,(uint16)dwParam1);
			SetSelection(1);
		}
		break;
	case CMD_CANCEL:
		{
			m_pDlg->Show(false);
			SetCapture(NULL);
			SetSelection(1);
		}
		break;

	case CMD_LOAD:
		{
			m_pDlg->Show(true);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_CONFIRM:
		{
			uint16 nIndex = (uint16)dwParam1;
			if (dwParam2 == CMD_DELETE)
			{
				if (nIndex < m_pListCtrl->GetNumControls()) 
				{
					ProfileArray::iterator iter = m_ProfileList.begin();
					for (int i = 0; i < nIndex && iter != m_ProfileList.end(); ++i, ++iter);

					if (iter != m_ProfileList.end())
					{
						g_pProfileMgr->DeleteProfile(iter->m_sFileName.c_str());

					}
					m_pProfile = g_pProfileMgr->GetCurrentProfile();
					LTStrCpy(m_szProfile, m_pProfile->m_sFriendlyName.c_str(), LTARRAYSIZE(m_szProfile));
					UpdateProfileName();

				}
			}
			else if (dwParam2 == CMD_LOAD)
			{
				if (nIndex < m_pListCtrl->GetNumControls()) 
				{
					ProfileArray::iterator iter = m_ProfileList.begin();
					for (int i = 0; i < nIndex && iter != m_ProfileList.end(); ++i, ++iter);

					if (iter != m_ProfileList.end())
					{
						g_pProfileMgr->NewProfile((*iter).m_sFileName.c_str(),L"",true);
						m_pProfile = g_pProfileMgr->GetCurrentProfile();

						LTStrCpy(m_szProfile, (*iter).m_sFriendlyName.c_str(), LTARRAYSIZE(m_szProfile));
						UpdateProfileName();
					}
				}
			}
			else if (dwParam2 == CMD_CREATE)
			{
				LTStrCpy(m_szOldProfile,m_szProfile, LTARRAYSIZE(m_szOldProfile));
				bCreate = true;

				//show edit box here	
				MBCreate mb;
				mb.eType = LTMB_EDIT;
				mb.pFn = EditCallBack;
				mb.pUserData = this;
				mb.pString = g_pProfileMgr->GetCurrentProfile()->m_sFriendlyName.c_str();
				mb.nMaxChars = MAX_PROFILE_NAME;
//				mb.eInput = kInputFileFriendly;
				g_pInterfaceMgr->ShowMessageBox("IDS_ENTER_PROFILE_NAME",&mb);
			}
		}
		break;
	case CMD_DELETE:
		{
			m_pDlg->Show(true);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_CREATE:
		{
			if (g_pLTClient->IsConnected())
			{
				MBCreate mb;
				mb.eType = LTMB_YESNO;
				mb.pFn = CreateCallBack;
				mb.pUserData = this;
				g_pInterfaceMgr->ShowMessageBox("IDS_CONFIRM_NEWPROFILE",&mb);
			}
			else
				SendCommand(CMD_CONFIRM,0,CMD_CREATE);
		}
		break;
	case CMD_RENAME:
		{
			m_pDlg->Show(true);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_EDIT:
		{
			std::wstring profileName = (wchar_t *)dwParam1;
			
			ProfileArray::iterator iter = m_ProfileList.begin();
			while (iter != m_ProfileList.end() && !LTStrIEquals( (*iter).m_sFriendlyName.c_str(), profileName.c_str() ) )
			{
				iter++;
			}

			if (iter != m_ProfileList.end())
			{
				//don't proceed renaming or creating a new one if we already have a profile of that
				//name
				MBCreate mb;
				mb.eType = LTMB_OK;
				mb.pFn = NULL,
				g_pInterfaceMgr->ShowMessageBox("IDS_PROFILE_ALREADY_EXISTS",&mb);
			}
			else
			{
				if (bCreate)
				{
					char szName[32] = "";
					uint32 n = 0;
					do 
					{
						LTSNPrintF(szName,LTARRAYSIZE(szName),"Profile%03d",n);
						n++;
					} while (CWinUtil::FileExist(GetAbsoluteProfileFile( g_pLTClient, szName)));
					g_pProfileMgr->NewProfile(szName, profileName.c_str(), false);
				}
				else
				{
					g_pProfileMgr->RenameProfile(szOldFN,profileName.c_str());
				}
				m_pProfile = g_pProfileMgr->GetCurrentProfile();
				LTStrCpy(m_szProfile,m_pProfile->m_sFriendlyName.c_str(), LTARRAYSIZE(m_szProfile));
				UpdateProfileName();
			}
		}
		break;
	default:
		return CBaseScreen::OnCommand(dwCommand,dwParam1,dwParam2);
	}

	return 1;
};
Ejemplo n.º 26
0
void cc_HandleCommand3(ConsoleState *pState, const char *pCommand, uint32 flags, uint32 varFlags)
{
	int bNew, bChanged, bFound;
	LTCommandVar *pVar;
	LTLink *pCur;
	LTExtraCommandStruct *pExtraCommand;
	char tempNumString[50];
	int tempNum;
	char *pVarName, *pString;
	LTBOOL bForceNoSave;
	uint32 newFlags;
	ConParse parse;


	parse.Init(pCommand);
	while(parse.Parse())
	{
		if(parse.m_nArgs > 0)
		{
			// Forward the command to command structs.
			bFound = 0;

			if(!(flags & CC_NOCOMMANDS))
			{
				if(!bFound)
				{
					pCur = pState->m_ExtraCommands.m_pNext;
					while(pCur != &pState->m_ExtraCommands)
					{
						pExtraCommand = (LTExtraCommandStruct*)pCur->m_pData;

						if(cc_UpperStrcmp(pExtraCommand->pCmdName, parse.m_Args[0]))
						{
							pExtraCommand->fn(parse.m_nArgs-1, &parse.m_Args[1]);
							bFound = 1;
							break;
						}

						pCur = pCur->m_pNext;
					}
				}
			}

			// Check if it was a command...
			if( bFound )
				continue;

			// Treat it like a variable.
			if(parse.m_nArgs == 2 && !(flags & CC_NOVARS))
			{
				bChanged = 0;
				bNew = 0;

				newFlags = varFlags;
				pVarName = parse.m_Args[0];
				bForceNoSave = LTFALSE;
				if(pVarName[0] == '+')
				{
					newFlags |= VARFLAG_SAVE;
					++pVarName;
				}
				else if(pVarName[0] == '-')
				{
					bForceNoSave = LTTRUE;
					++pVarName;
				}


				// Add the variable if not already there.
				pVar = cc_FindConsoleVar(pState, pVarName);
				if(!pVar)
				{
					bNew = bChanged = 1;
					pVar = cc_AddConsoleVar(pState, pVarName);
				}

				pVar->m_VarFlags |= newFlags;
				if(bForceNoSave)
					pVar->m_VarFlags &= ~VARFLAG_SAVE;

				// Check the negation syntax.
				if(parse.m_Args[1][0] == '!' && parse.m_Args[1][1] == 0)
				{
					if(pVar->pStringVal)
					{
						if(isdigit(pVar->pStringVal[0]) || pVar->pStringVal[0] == '-')
						{
							tempNum = !((int)pVar->floatVal);
							LTSNPrintF(tempNumString, sizeof(tempNumString), "%d", tempNum);
							parse.m_Args[1] = tempNumString;
						}
					}
					else
					{
						parse.m_Args[1] = "1";
					}
				}

				// Check if it changed..
				if(pVar->pStringVal && strcmp(pVar->pStringVal, parse.m_Args[1])==0)
				{
				}
				else
				{
					if(strlen(parse.m_Args[1]) < VARBUF_LEN)
					{
						// Put it in its own buffer so we don't have to allocate or search.
						LTStrCpy(pVar->m_Buffer, parse.m_Args[1], sizeof(pVar->m_Buffer));
						pString = pVar->m_Buffer;
					}
					else
					{
						pString = cc_AddString(pState, parse.m_Args[1]);
					}

					pVar->pStringVal = pString;
					pVar->floatVal = (float)atof(parse.m_Args[1]);
					bChanged = 1;
				}

				cc_SetEngineVar(pState, pVar);

				// Call the appropriate callback.
				if(bChanged)
				{
					if(bNew)
					{
						if(pState->NewVar)
							pState->NewVar(pState, pVar);
					}
					else
					{
						if(pState->VarChange)
							pState->VarChange(pState, pVar);
					}
				}
			}
			else if(parse.m_nArgs == 1)
			{
				pVar = cc_FindConsoleVar(pState, parse.m_Args[0]);
				if(pVar)
					cc_PrintVarDescription(pState, pVar);
			}
		}
	}
}
Ejemplo n.º 27
0
LTRESULT r_InitRender(RMode *pMode)
{
	RenderStructInit init;
	int initStatus;
	HWND hWnd;

	// Don't get in here recursively.
	if(g_ClientGlob.m_bInitializingRenderer)
		return LT_OK;


	VarSetter<BOOL> setter(&g_ClientGlob.m_bInitializingRenderer, LTTRUE, LTFALSE);

	r_TermRender(0, false);


	hWnd = (HWND)dsi_GetMainWindow();
	ShowWindow(hWnd, SW_RESTORE);

	if (g_bFirstTimeInit) 
		r_InitSysCache(&g_SysCache);
	
	// Setup the init request.
	memset(&init, 0, sizeof(init));
	init.m_hWnd = (void*)hWnd;
	memcpy(&init.m_Mode, pMode, sizeof(RMode));


	// Set up the RenderStruct.
	rdll_RenderDLLSetup(&g_Render);

	// Store these.. the renderer may change them for pixel doubling.
	g_Render.m_Width = pMode->m_Width;
	g_Render.m_Height = pMode->m_Height;

	// Try to initialize the renderer for the requested mode.
	initStatus = g_Render.Init(&init);
	if(initStatus != RENDER_OK || init.m_RendererVersion != LTRENDER_VERSION)
	{
		g_pClientMgr->SetupError(LT_ERRORLOADINGRENDERDLL, "Init Failed");
		RETURN_ERROR_PARAM(1, r_InitRender, LT_ERRORLOADINGRENDERDLL, "Init Failed");
	}

	// Init the console.
	g_pClientMgr->InitConsole();

	// Restore interface surfaces that were backed up.
	if(!cis_RendererIsHere(r_GetRenderStruct()))
	{
		g_pClientMgr->SetupError(LT_UNABLETORESTOREVIDEO);
		RETURN_ERROR(1, r_InitRender, LT_UNABLETORESTOREVIDEO);
	}

	g_Render.m_bInitted = true;
	g_Render.m_bLoaded = true;

    // Let the game do a loading screen or something.
    if (i_client_shell != NULL) {
        i_client_shell->OnEvent(LTEVENT_RENDERALMOSTINITTED, 0);
    }

	// Bind any open worlds.
	if(!g_pClientMgr->BindClientShellWorlds())
	{
		g_Render.m_bInitted = false;
		g_Render.m_bLoaded = false;
		RETURN_ERROR(1, r_InitRender, LT_ERRORBINDINGWORLD);
	}

	// Set focus and capture the mouse.  We leave things like resizing the window to the render DLL.
	SetFocus(hWnd);

	// Bind any open textures.
	g_pClientMgr->BindSharedTextures();

	// Store this config..
	memcpy(&g_RMode, &init.m_Mode, sizeof(RMode));

	char cmd[200];
	// Set the console variables.
	LTSNPrintF(cmd, sizeof(cmd), "CardDesc %s", init.m_Mode.m_InternalName);
	c_CommandHandler(cmd);

	LTSNPrintF(cmd, sizeof(cmd), "ScreenWidth %d", init.m_Mode.m_Width);
	c_CommandHandler(cmd);

	LTSNPrintF(cmd, sizeof(cmd), "ScreenHeight %d", init.m_Mode.m_Height);
	c_CommandHandler(cmd);

	LTSNPrintF(cmd, sizeof(cmd), "BitDepth %d", init.m_Mode.m_BitDepth);
	c_CommandHandler(cmd);

	// The console can load its background now that we're initialized.
	con_LoadBackground();

    // Tell the game the renderer has initialized.
    if (i_client_shell != NULL) 
	{
        i_client_shell->OnEvent(LTEVENT_RENDERINIT, 0);
    }
    
	g_bFirstTimeInit = false;
	return LT_OK;
}
Ejemplo n.º 28
0
	void RemoveSystem( const void * pOwner, const char* name )
	{
		char buffer[256];
		LTSNPrintF(buffer, LTARRAYSIZE(buffer), "%d%s", reinterpret_cast<long>(pOwner), name);
		RemoveSystem(buffer);
	}
Ejemplo n.º 29
0
	DebugLineSystem & GetSystem(const void * pOwner, const char* name)
	{
		char buffer[256];
		LTSNPrintF(buffer, LTARRAYSIZE(buffer), "%d%s", reinterpret_cast<long>(pOwner), name);
		return GetSystem(buffer);
	}
Ejemplo n.º 30
0
void CHUDDebugInput::Send()
{
	char szPath[MAX_PATH*2];
	char szTemp[MAX_PATH];
	char szShotname[MAX_PATH + 1];

	LTFileOperations::GetUserDirectory(szPath, LTARRAYSIZE(szPath));
	LTStrCat(szPath,"DebugLog",LTARRAYSIZE(szPath));
	LTStrCat(szPath,FILE_PATH_SEPARATOR,LTARRAYSIZE(szPath));

	LTStrCpy(szTemp,g_pMissionMgr->GetCurrentWorldName(),LTARRAYSIZE(szTemp));

	char* szWorld = strrchr(szTemp,FILE_PATH_SEPARATOR[0]);
	if (szWorld)
	{
		szWorld++;
	}
	else
	{
		szWorld = szTemp;
	}

	LTStrCat(szPath,szWorld,LTARRAYSIZE(szPath));

	if (!CWinUtil::DirExist(szPath))
	{
		CWinUtil::CreateDir(szPath);
	}

	LTStrCat(szPath,FILE_PATH_SEPARATOR,LTARRAYSIZE(szPath));


	//determine a filename for this. This should start with the screenshot console variable and be
	//numbered sequentially

	//an upper cap to make sure that we don't attempt to create screenshots indefinitely, which could
	//potentially be caused by some file access issues
	static const uint32 knMaxScreenshotAttempts = 1000;

	for(uint32 nCurrScreenshotIndex = 0; nCurrScreenshotIndex < knMaxScreenshotAttempts; nCurrScreenshotIndex++)
	{
		//build up the filename to use for this screenshot
		
		LTSNPrintF(szShotname, LTARRAYSIZE(szShotname), "Screenshot%03d.jpg", nCurrScreenshotIndex);

		char pszFilename[MAX_PATH];
		LTSNPrintF(pszFilename, LTARRAYSIZE(pszFilename), "DebugLog%s%s%s%s",  FILE_PATH_SEPARATOR,szWorld,FILE_PATH_SEPARATOR,szShotname);

		// get the user path to the screenshot file, as we need this to check if the file exists.
		char pszUserFilename[MAX_PATH];
		g_pLTClient->FileMgr()->GetAbsoluteUserFileName( pszFilename, pszUserFilename, LTARRAYSIZE( pszUserFilename ) );

		//see if this file already exists - if it does, continue searching for an unused file
		if ( !LTFileOperations::FileExists( pszUserFilename ) )
		{
			//the filename doesn't exist, so go ahead and try to make the screenshot
			if(g_pLTClient->GetRenderer()->MakeScreenShot(pszUserFilename) == LT_OK)
			{
				g_pLTClient->CPrint("Successfully created screenshot %s", pszUserFilename);
			}
			else
			{
				g_pLTClient->CPrint("Failed to create screenshot %s", pszUserFilename);
			}
			break;
		}
	}

	//report overflow
	if(nCurrScreenshotIndex >= knMaxScreenshotAttempts)
	{
		g_pLTClient->CPrint("Unable to create screenshot. Please make sure that the directory is readable and that there are less than %d screenshots", knMaxScreenshotAttempts);
	}


	Show(false);

	// Ignore empty messages.
	if( !m_szDebugStr[0] )
		return;

	char szMsg[256];

	static bool bUseTime = false;

	if (bUseTime)
	{
		time_t tmSys;
		time( &tmSys );

		struct tm* pTimeDate = NULL;
		pTimeDate = localtime (&tmSys);
		if (pTimeDate)
		{
			LTSNPrintF(szMsg, LTARRAYSIZE( szMsg ), "<tr><td>%02d/%02d/%02d %02d:%02d:%02d</td>", pTimeDate->tm_mon + 1, pTimeDate->tm_mday, (pTimeDate->tm_year + 1900) % 100, pTimeDate->tm_hour, pTimeDate->tm_min, pTimeDate->tm_sec);
		}
	}
	else
	{
		LTSNPrintF(szMsg, LTARRAYSIZE( szMsg ), "<tr>");
	}


	//determine the offset we should use on the positions
	LTVector vOffset(0, 0, 0);
	g_pLTClient->GetSourceWorldOffset(vOffset);
	HLOCALOBJ hPlayerObj = g_pLTClient->GetClientObject();
	if (hPlayerObj)
	{
		char buf[256];
		LTVector vPos;
		g_pLTClient->GetObjectPos(hPlayerObj, &vPos);

		//handle the shift from the current world to the source world
		vPos += vOffset;

		LTSNPrintF(buf, LTARRAYSIZE(buf), "<td>(pos %0.0f %0.0f %0.0f)</td>", vPos.x, vPos.y, vPos.z);
		LTStrCat(szMsg,buf,LTARRAYSIZE(szMsg));

	}

	LTSNPrintF(szTemp,LTARRAYSIZE(szTemp),"<td><a href=\"%s\">%s</a></td>",szShotname,MPW2A(m_szDebugStr).c_str());

	LTStrCat(szMsg,szTemp,LTARRAYSIZE(szMsg));

	LTStrCat(szMsg,"</tr>\r\n",LTARRAYSIZE(szMsg));


	CLTFileWrite cFileWrite;

	LTStrCat( szPath, "debuglog.htm", LTARRAYSIZE( szPath ));

	bool bNewFile = !CWinUtil::FileExist(szPath);

	if (cFileWrite.Open(szPath,true))
	{
		if (bNewFile)
		{
			char szTmp[128] = "<HTML><BODY>\r\n<table>\r\n";
			cFileWrite.Write(szTmp,LTStrLen(szTmp));
		}
		
		cFileWrite.Write(szMsg,LTStrLen(szMsg));
		cFileWrite.Close();
	}

}