void CAnimationMgr::Term()
{
	if ( m_aAnimations )
	{
		debug_deletea(m_aAnimations);
		m_aAnimations = LTNULL;
	}

	if ( m_aTransitions )
	{
		debug_deletea(m_aTransitions);
		m_aTransitions = LTNULL;
	}
}
// Sort the render resolution based on screen width and height
void CFolderDisplay::SortRenderModes(int nRendererIndex)
{
	// Build a temporary array of render modes
	int nResolutions=m_rendererArray[nRendererIndex].m_resolutionArray.GetSize();
	if ( nResolutions < 1 )
	{
		return;
	}

	FolderDisplayResolution *pResolutions = debug_newa(FolderDisplayResolution, nResolutions);

	int i;
	for (i=0; i < nResolutions; i++)
	{
		pResolutions[i]=m_rendererArray[nRendererIndex].m_resolutionArray[i];
	}

	// Sort the array
	qsort(pResolutions, nResolutions, sizeof(FolderDisplayResolution), FolderDisplayCompare);

	// Clear the current renderer resolutions array
	m_rendererArray[nRendererIndex].m_resolutionArray.SetSize(0);

	// Copy the sorted array back to the resolutions array
	for (i=0; i < nResolutions; i++)
	{
		m_rendererArray[nRendererIndex].m_resolutionArray.Add(pResolutions[i]);
	}

	debug_deletea(pResolutions);
}
Example #3
0
void CClientFXDB::Term()
{
	//empty out our types
	debug_deletea(m_pEffectTypes);
	m_pEffectTypes		= NULL;
	m_nNumEffectTypes	= 0;

	// Delete all the FX groups
	CLinkListNode<FX_GROUP *> *pGroupNode = m_collGroupFX.GetHead();

	while (pGroupNode)
	{
		//delete all the key property lists
		for(uint32 nCurrKey = 0; nCurrKey < pGroupNode->m_Data->m_nNumKeys; nCurrKey++)
		{
			if(m_pfnFreePropList)
			{
				m_pfnFreePropList(pGroupNode->m_Data->m_pKeys[nCurrKey].m_pProps);
				pGroupNode->m_Data->m_pKeys[nCurrKey].m_pProps = NULL;
			}
		}

		debug_delete( pGroupNode->m_Data );		
		pGroupNode = pGroupNode->m_pNext;
	}
	m_collGroupFX.RemoveAll();

	UnloadFxDll();
}
void CAIButeMgr::Term()
{
	if ( m_aTemplates )
	{
		debug_deletea(m_aTemplates);
        m_aTemplates = LTNULL;
	}

	if ( m_aBrains )
	{
		debug_deletea(m_aBrains);
        m_aBrains = LTNULL;
	}

    g_pAIButeMgr = LTNULL;
}
Example #5
0
CScatterFXSubVolume::~CScatterFXSubVolume()
{
	Deactivate();

	debug_deletea( m_Particles );

	if( m_Effect )
		m_Parent->m_pClientDE->RemoveObject( m_Effect );
}
Example #6
0
void CAIVolumeMgr::Term()
{
	m_cVolumes = 0;
	m_bInitialized = LTFALSE;
	if ( m_aVolumes )
	{
		debug_deletea(m_aVolumes);
		m_aVolumes = LTNULL;
	}
}
void CAnimationContext::Term()
{
	if ( m_aAnimationInstances )
	{
		debug_deletea(m_aAnimationInstances);
		m_aAnimationInstances = LTNULL;
	}

	if ( m_aTransitionInstances )
	{
		debug_deletea(m_aTransitionInstances);
		m_aTransitionInstances = LTNULL;
	}

	if ( LTNULL != m_hObject )
	{
		g_pModelLT->RemoveTracker(m_hObject, &m_trkPitchDown);
		g_pModelLT->RemoveTracker(m_hObject, &m_trkPitchUp);
	}
}
Example #8
0
bool CClientFXDB::ReadFXGroups( bool bText, ILTStream* pFxFile, CLinkList<FX_GROUP *> &collGroupFx )
{
	// Read in the number of FX groups in this file
	uint32 dwNumGroups;

	if( bText )
	{
		ReadTextFile( pFxFile, "%s %lu", &dwNumGroups );
	}
	else
	{
		pFxFile->Read(&dwNumGroups, sizeof(uint32));
	}

	//allocate a working buffer that keys can read properties into
	static const uint32		knMaxKeyProps = 512;
	FX_PROP*				pPropBuffer = debug_newa(FX_PROP, knMaxKeyProps);

	if(!pPropBuffer)
		return false;

	for( uint32 i = 0; i < dwNumGroups; i ++ )
	{
		// Create a new group.
		FX_GROUP *pFxGroup = debug_new( FX_GROUP );

		if( !ReadFXGroup( bText, pFxFile, pFxGroup, pPropBuffer, knMaxKeyProps ))
		{
			debug_deletea(pPropBuffer);
			return false;
		}

		collGroupFx.AddTail(pFxGroup);
	}

	//free our working buffer
	debug_deletea(pPropBuffer);

	return true;
}
Example #9
0
CLineSystemFX::~CLineSystemFX()
{
	if (m_pLines)
	{
		for (int i=0; i < m_nTotalNumLines; i++)
		{
			RemoveLine(i);
		}

		debug_deletea(m_pLines);
        m_pLines = LTNULL;
	}
}
Example #10
0
CSpecialFXList::~CSpecialFXList()
{
	if (m_pArray)
	{

		for (unsigned int i=0; i < m_nArraySize; i++)
		{
			if (m_pArray[i])
			{
				CSFXMgr::DeleteSFX(m_pArray[i]);
			}
		}

		debug_deletea(m_pArray);
		m_pArray = LTNULL;
	}

	if (m_pAgeArray)
	{
		debug_deletea(m_pAgeArray);
		m_pAgeArray = LTNULL;
	}
}
Example #11
0
CAIClassFactory::~CAIClassFactory()
{
	// Delete classes from the allocated list.
	AICLASS_LIST::iterator it;
	for(it = m_lstAllocatedAIClasses.begin(); it != m_lstAllocatedAIClasses.end(); ++it)
	{
		uint8* pClass = (uint8*)*it;
		debug_deletea(pClass);
	}

	// Destroy singleton.
	AIASSERT(g_pAIClassFactory != NULL, LTNULL, "CAIClassFactory: Class factory does not exists.");
	g_pAIClassFactory = LTNULL;
}
Example #12
0
void CAIGoalButeMgr::Term()
{
	AIGOAL_SET_LIST::iterator it;
	for(it = m_lstGoalSets.begin(); it != m_lstGoalSets.end(); ++it)
	{
		debug_delete(*it);
	}

	if ( m_aTemplates )
	{
		for(uint32 iTemplate=0; iTemplate < kGoal_Count; ++iTemplate)
		{
			debug_deletea(m_aTemplates[iTemplate].aAttractors);			
		}
		debug_deletea(m_aTemplates);
        m_aTemplates = LTNULL;
	}

	AIGBM_SmartObjectTemplate* pSmartObject;
	SMART_OBJECT_LIST::iterator sit;
	SMART_OBJECT_CMD_MAP::iterator cit;
	for(sit = m_lstSmartObjects.begin(); sit != m_lstSmartObjects.end(); ++sit)
	{
		pSmartObject = *sit;
		for(cit = pSmartObject->mapCmds.begin(); cit != pSmartObject->mapCmds.end(); ++cit)
		{
			FREE_HSTRING(cit->second);
		}

		debug_delete(pSmartObject);
	}

	m_lstSmartObjects.clear( );

    g_pAIButeMgr = LTNULL;
}
Example #13
0
CWeapons::~CWeapons()
{
	DeleteWeapons();

	if (m_pAmmo)
	{
		debug_deletea(m_pAmmo);
		m_pAmmo = LTNULL;
	}

	if ( m_pVecProjectile )
	{
		debug_delete( m_pVecProjectile );
		m_pVecProjectile = 0;
	}
}
CAIVolume::~CAIVolume()
{
	FREE_HSTRING(m_hstrName);

	if ( m_aNeighbors )
	{
		debug_deletea(m_aNeighbors);
	}

	g_pAIVolumeMgr->Unlink(m_hLift);

	for ( int iDoor = 0 ; iDoor < cm_nMaxDoors ; iDoor++ )
	{
		g_pAIVolumeMgr->Unlink(m_ahDoors[iDoor]);
	}
}
Example #15
0
CScatterFX::~CScatterFX()
{
	if( m_hstrTextureName && m_pClientDE )
	{
		m_pClientDE->FreeString( m_hstrTextureName );
	}

	debug_deletea( m_pSubVolumes );

	for( std::list<HOBJECT>::iterator objIt = freeEffects.begin(); objIt != freeEffects.end(); objIt++ )
	{
		ASSERT( *objIt );
		m_pClientDE->RemoveObject( *objIt );
	}

	freeEffects.clear();
}
Example #16
0
void CTrackedNodeContext::Term()
{
    HTRACKEDNODE hTrackedNode;

    for( uint32 iGroup=0; iGroup < kTrack_Count; ++iGroup )
    {
        for( uint32 iNode=0; iNode < m_cTrackedNodesPerGroup[iGroup]; ++iNode )
        {
            hTrackedNode = m_aTrackedNodeGroups[iGroup][iNode];
            if( hTrackedNode != INVALID_TRACKEDNODE )
            {
                m_pTrackedNodeMgr->DestroyTrackingNode( hTrackedNode );
            }
        }

        debug_deletea( m_aTrackedNodeGroups[iGroup] );
        m_aTrackedNodeGroups[iGroup] = LTNULL;
        m_cTrackedNodesPerGroup[iGroup] = 0;
    }
}
Example #17
0
    void RecordData(int16 * pSixteenData, int8 * pEightData, uint32 dwNumElements, uint32 dwCurElement)
	{
		const int points_to_display = 500;
		const int interval = 10;

		if( !data )
		{
			debug_deletea(data);
			maxPoints = points_to_display;
			data = new GraphFXPoint[points_to_display];
			ASSERT(data);
			if( !data ) return;
		}

		numPoints = 0;

		if( pEightData )
		{
			for( int8 * iter = pEightData + dwCurElement - points_to_display*interval/2, j = 0;
			     iter < pEightData + dwCurElement + points_to_display*interval/2 && iter < pEightData + dwNumElements;
				 iter += interval, ++j)
			{

                data[j] = GraphFXPoint( LTFLOAT(abs(*iter))/LTFLOAT(256/2) );

				++numPoints;
			}
		}
		else if( pSixteenData )
		{
			for( int16 * iter = pSixteenData + dwCurElement - points_to_display*interval/2, j = 0;
			     iter < pSixteenData + dwCurElement + points_to_display*interval/2 && iter < pSixteenData + dwNumElements;
				 iter += interval, ++j)
			{

                data[j] = GraphFXPoint( LTFLOAT(abs(*iter))/LTFLOAT(65536/2) );

				++numPoints;
			}
		}
	}
Example #18
0
bool CSnowFXAirspace::Deactivate( void )
{
	if( !m_Active )
		return true;

	g_pCommonLT->SetObjectFlags( m_Effect, OFT_Flags, 0, FLAG_VISIBLE );
	m_Parent->freeEffects.push_front( m_Effect );
	m_Effect = NULL;

	m_Parent->m_ParticleMgr.FreeParticles( m_Particles );
	m_Particles = NULL;

	debug_deletea( m_MinY );
	m_MinY = NULL;

	m_Active = false;

	m_Parent->activeAirspaces.erase( this );

	return true;
}
Example #19
0
void CAIVolumeMgr::Load(HMESSAGEREAD hRead)
{
	LOAD_BOOL(m_bInitialized);
	LOAD_INT(m_cVolumes);

	if ( 0 == m_cVolumes ) 
	{
		if ( m_aVolumes )
		{
			debug_deletea(m_aVolumes); 
			m_aVolumes = LTNULL;
		}

		return;
	}

	m_aVolumes = debug_newa(CAIVolume, m_cVolumes);
	for ( int32 iVolume = 0 ; iVolume < m_cVolumes ; iVolume++ )
	{
		m_aVolumes[iVolume].Load(hRead);
	}
}
Example #20
0
void CClientWeaponMgr::Term()
{
	if ( 0 != m_apClientWeapon )
	{
		// destroy all the array entries
		for ( int i = 0; i < m_nMaxWeapons; ++i )
		{
			if ( 0 != m_apClientWeapon[ i ] )
			{
				m_apClientWeapon[ i ]->Term();
				debug_delete( m_apClientWeapon[ i ] );
				m_apClientWeapon[ i ] = 0;
			}
		}

		// destroy the array
		debug_deletea( m_apClientWeapon );
		m_apClientWeapon = 0;
	}

	m_pCurrentWeapon		= NULL;
	m_nCurClientWeaponIndex	= CWM_NO_WEAPON;
	m_hLastWeapon			= NULL;
}
Example #21
0
void CModelButeMgr::Term()
{
	if (m_aModels)
	{
		debug_deletea(m_aModels);
        m_aModels = LTNULL;
	}

	if (m_aStyles)
	{
		debug_deletea(m_aStyles);
        m_aStyles = LTNULL;
	}

	if (m_aSkeletons)
	{
		for ( int iSkeleton = 0 ; iSkeleton < m_cSkeletons ; iSkeleton++ )
		{
			debug_deletea(m_aSkeletons[iSkeleton].m_aNodes);
		}

		debug_deletea(m_aSkeletons);
        m_aSkeletons = LTNULL;
	}

	if (m_aNScripts)
	{
		for ( int iNScript = 0 ; iNScript < m_cNScripts ; iNScript++ )
		{
			debug_deletea(m_aNScripts[iNScript].m_aNScriptPts);
		}

		debug_deletea(m_aNScripts);
        m_aNScripts = LTNULL;
	}

    g_pModelButeMgr = LTNULL;
}
Example #22
0
// Build the list of Custom Levels
void CScreenSingle::BuildCustomLevelsList(int nWidth)
{
	m_Filenames.clear();
	m_pCustom->RemoveAll();

	// Get a list of world names and sort them alphabetically

    uint8 nNumPaths = g_pClientButeMgr->GetNumSingleWorldPaths();

    char pathBuf[128];
	FileEntry** pFilesArray = debug_newa(FileEntry*, nNumPaths);

	if (pFilesArray)
	{
		for (int i=0; i < nNumPaths; ++i)
		{
			pathBuf[0] = '\0';
			g_pClientButeMgr->GetWorldPath(i, pathBuf, ARRAY_LEN(pathBuf));

			if (pathBuf[0])
			{
                pFilesArray[i] = g_pLTClient->GetFileList(pathBuf);
			}
			else
			{
                pFilesArray[i] = LTNULL;
			}
		}
	}



	char Buf[255];

	for (int i=0; i < nNumPaths; ++i)
	{
		pathBuf[0] = '\0';
		g_pClientButeMgr->GetWorldPath(i, pathBuf, ARRAY_LEN(pathBuf));

		if (pathBuf[0] && pFilesArray[i])
		{
			sprintf(Buf, "%s\\", pathBuf);
			AddFilesToFilenames(pFilesArray[i], Buf);
            g_pLTClient->FreeFileList(pFilesArray[i]);
		}
	}

	debug_deletea(pFilesArray);

	CLTGUITextCtrl* pItem;

	uint8 nListFontSize = (uint8)g_pLayoutMgr->GetScreenCustomInt((eScreenID)m_nScreenID,"ListFontSize");
	int index = 0;
	StringSet::iterator iter = m_Filenames.begin();
	while (iter != m_Filenames.end())
	{
		pItem = CreateTextItem((char *)iter->c_str(), CMD_CUSTOM+index, IDS_HELP_CUSTOMLEVEL);
		pItem->SetFont(LTNULL, nListFontSize);
		pItem->SetFixedWidth(nWidth,LTTRUE);

		m_pCustom->AddControl(pItem);
		++index;
		iter++;
	}

}
Example #23
0
void CScreenMulti::CreateDMMissionFile()
{
	char path[256];
	std::string sFN = _getcwd(path,sizeof(path));
	sFN += "\\";
	sFN += MISSION_DM_FILE;

	if (CWinUtil::FileExist(sFN.c_str()))
	{
		remove(MISSION_DM_FILE);
	}

	// Get a list of world names and sort them alphabetically

	uint8 nNumPaths = g_pClientButeMgr->GetNumMultiWorldPaths();

	char pathBuf[128];
	FileEntry** pFilesArray = debug_newa(FileEntry*, nNumPaths);

	if (pFilesArray)
	{
		for (int i=0; i < nNumPaths; ++i)
		{
			pathBuf[0] = '\0';
			g_pClientButeMgr->GetWorldPath(i, pathBuf, ARRAY_LEN(pathBuf),LTFALSE);

			if (pathBuf[0])
			{
				pFilesArray[i] = g_pLTClient->GetFileList(pathBuf);
			}
			else
			{
				pFilesArray[i] = LTNULL;
			}
		}
	}

	
	char strBaseName[256];
	char* pBaseName = NULL;
	char* pBaseExt = NULL;
	StringSet filenames;

	for (int i=0; i < nNumPaths; ++i)
	{
		pathBuf[0] = '\0';
		g_pClientButeMgr->GetWorldPath(i, pathBuf, ARRAY_LEN(pathBuf),LTFALSE);

		if (pathBuf[0] && pFilesArray[i])
		{
			sprintf(path, "%s\\", pathBuf);
			FileEntry* ptr = pFilesArray[i];

			while (ptr)
			{
				if (ptr->m_Type == TYPE_FILE)
				{
					if (strnicmp(ptr->m_pBaseFilename,"DM_",3) == 0 || strnicmp(ptr->m_pBaseFilename,"DD_",3) == 0)
					{
						SAFE_STRCPY(strBaseName, ptr->m_pBaseFilename);
						pBaseName = strtok (strBaseName, ".");
						pBaseExt = strtok (NULL, "\0");
						if (pBaseExt && stricmp (pBaseExt, "dat") == 0)
						{
							char szString[512];
							sprintf(szString, "%s%s", path, pBaseName);

							// add this to the array
							filenames.insert(szString);
						}
					}
				}

				ptr = ptr->m_pNext;
			}

			g_pLTClient->FreeFileList(pFilesArray[i]);
		}
	}

	debug_deletea(pFilesArray);


	int index = 0;
	char szLabel[256];
	StringSet::iterator iter = filenames.begin();

	CDMButeMgr buteMgr;
	char szTmp[16];
	char szString[512];

	while (iter != filenames.end())
	{
		bool bDefaultWeapons = false;

		sprintf(szLabel,"Mission%d",index);
							
		sprintf(szString, "\"%s\"", (*iter).c_str());
		CWinUtil::WinWritePrivateProfileString( szLabel, "Level0", szString, sFN.c_str());

		std::string sCfg = (*iter);
		sCfg += ".cfg";

		if (buteMgr.Init(sCfg.c_str()))
		{
			MISSION mission;
			mission.Init(*buteMgr.GetButeMgr(),"Mission");

			if (mission.nNameId > 0)
			{
				sprintf(szTmp,"%d",mission.nNameId);
				CWinUtil::WinWritePrivateProfileString( szLabel, "NameId", szTmp, sFN.c_str());
			}

			if (!mission.sName.empty())
			{
				sprintf(szString, "\"%s\"", mission.sName.c_str());
				CWinUtil::WinWritePrivateProfileString( szLabel, "NameStr", szString, sFN.c_str());
			}

			if (!mission.sPhoto.empty())
			{
				sprintf(szString, "\"%s\"", mission.sPhoto.c_str());
				CWinUtil::WinWritePrivateProfileString( szLabel, "Photo", szString, sFN.c_str());
			}

			if (mission.nNumDefaultWeapons)
			{
				bDefaultWeapons = true;
				std::string sDef = "\"";
				for (int w = 0; w < mission.nNumDefaultWeapons; w++)
				{
					if (w > 0)
						sDef += ",";
					sDef += g_pWeaponMgr->GetWeapon(mission.aDefaultWeapons[w])->szName;
				}
				sDef += "\"";
				CWinUtil::WinWritePrivateProfileString( szLabel, "DefaultWeapons", sDef.c_str(), sFN.c_str());
			}

			buteMgr.Term();
		}

		if (!bDefaultWeapons)
		{
			sprintf(szString, "\"%s\"", g_pWeaponMgr->GetMPDefaultWeapons());
			CWinUtil::WinWritePrivateProfileString( szLabel, "DefaultWeapons", szString, sFN.c_str());
		}

		++index;
		iter++;
	}

	
	// Flush the file. (if anything was added)
	if (index > 0)
	{
		CWinUtil::WinWritePrivateProfileString( NULL, NULL, NULL, sFN.c_str());
	}

	filenames.clear();
}
Example #24
0
//this will take a list of properties and convert it to internal values
bool CBaseFXProps::ParseProperties(FX_PROP* pProps, uint32 nNumProps)
{
	//counts of how many of each key
	uint32 nNumColorKeys = 0;
	uint32 nNumScaleKeys = 0;

	//go through the property list and parse in all the known variables and
	//count up how many of each key type we have
	uint32 nCurrProp = 0;

	for(nCurrProp = 0; nCurrProp < nNumProps; nCurrProp++)
	{
		FX_PROP& fxProp = pProps[nCurrProp];

		if( !_stricmp( fxProp.m_sName, FXPROP_UPDATEPOS ))
		{
			m_nFollowType = (uint32)fxProp.GetComboVal();
		}
		else if( !_stricmp( fxProp.m_sName, FXPROP_ATTACHNAME ))
		{
			fxProp.GetStringVal( m_szAttach );
		}
		else if( !_stricmp( fxProp.m_sName, FXPROP_OFFSET ))
		{
			m_vOffset = fxProp.GetVector();
		}
		else if( !_stricmp( fxProp.m_sName, FXPROP_ROTATEADD ))
		{
			m_vRotAdd = fxProp.GetVector();
		}
		else if( !_stricmp( fxProp.m_sName, FXPROP_MENULAYER ))
		{
			m_nMenuLayer = fxProp.GetIntegerVal();
		}
		else if( !_stricmp( fxProp.m_sName, "Ck" ))
		{
			nNumColorKeys++;
		}
		else if( !_stricmp( fxProp.m_sName, "Sk" ))
		{
			nNumScaleKeys++;
		}
	}

	//allocate our arrays of key types
	debug_deletea( m_pColorKeys );
	m_pColorKeys = debug_newa( FX_COLOURKEY, nNumColorKeys );
	m_nNumColorKeys = 0;

	debug_deletea( m_pScaleKeys );
	m_pScaleKeys = debug_newa( FX_SCALEKEY, nNumScaleKeys );
	m_nNumScaleKeys = 0;

	//now actually read in each key type
	for(nCurrProp = 0; nCurrProp < nNumProps; nCurrProp++)
	{
		FX_PROP& fxProp = pProps[nCurrProp];

		if( !_stricmp( fxProp.m_sName, "Ck" ))
		{
			// Add this key to the list of keys

			FX_COLOURKEY fxClrKey;

			fxClrKey.m_tmKey = fxProp.m_data.m_clrKey.m_tmKey;
			fxClrKey.m_red   = (float) (fxProp.m_data.m_clrKey.m_dwCol & 0x000000FF);
			fxClrKey.m_green = (float)((fxProp.m_data.m_clrKey.m_dwCol & 0x0000FF00) >> 8);
			fxClrKey.m_blue  = (float)((fxProp.m_data.m_clrKey.m_dwCol & 0x00FF0000) >> 16);
			fxClrKey.m_alpha = (float)((fxProp.m_data.m_clrKey.m_dwCol & 0xFF000000) >> 24);

			if(m_pColorKeys)
				m_pColorKeys[m_nNumColorKeys++] = fxClrKey;
		}
		else if( !_stricmp( fxProp.m_sName, "Sk" ))
Example #25
0
CBaseFXProps::~CBaseFXProps()
{
	debug_deletea( m_pColorKeys );
	debug_deletea( m_pScaleKeys );
}
Example #26
0
LTBOOL CGameButeMgr::Parse(const char* sButeFile)
{
	// Sanity checks...

    if (!sButeFile)	return(LTFALSE);


	BOOL bRet = TRUE;


	//if there is no g_pLTBase, then we can't read from the stream
	if (!g_pLTBase || !m_bInRezFile)
	{

		// Append the GAME directory onto the filename if this file is normally
		// stored in the .rez file...

		if (m_bInRezFile)
		{
			m_strAttributeFile.Format("Game\\%s", sButeFile);
		}
		else
		{
			m_strAttributeFile.Format("%s", sButeFile);
		}


		if (m_pCryptKey)
		{
			bRet = m_buteMgr.Parse(m_strAttributeFile, m_pCryptKey);
		}
		else
		{
			bRet = m_buteMgr.Parse(m_strAttributeFile);
		}

		return bRet;
	}


	// Open the file...

	m_strAttributeFile = sButeFile;

    ILTStream* pDStream = LTNULL;

    LTRESULT dr = g_pLTBase->OpenFile(m_strAttributeFile, &pDStream);

    if (dr != LT_OK || !pDStream)
	{
		char sError[512];
		sprintf(sError,"ERROR CGameButeMgr couldn't open file %s!",m_strAttributeFile);
		GBM_DisplayError(sError);

#ifdef _CLIENTBUILD
        g_pLTClient->ShutdownWithMessage(sError);
#endif
		return(FALSE);
	}


	// Read the file...

	unsigned long uLen = pDStream->GetLen();

	char* pData = debug_newa(char, uLen);
	if (!pData)
	{
		pDStream->Release();
		GBM_DisplayError("ERROR CGameButeMgr couldn't allocate data for stream.");
		return(FALSE);
	}

	pDStream->Read(pData, uLen);


	// Setup the save file name.  This is for saving the attribute file from
	// the game and is ONLY used during development...

	CString strSaveFilename = "";

#ifndef _FINAL

	strSaveFilename = sButeFile;

	if (m_bInRezFile)
	{
		strSaveFilename.Format("Game\\%s", sButeFile);
	}

#endif // _FINAL


	// Parse the file...

	if (m_pCryptKey)
	{
		bRet = m_buteMgr.Parse(pData, uLen, m_pCryptKey, strSaveFilename);
	}
	else
	{
		bRet = m_buteMgr.Parse(pData, uLen, 0, strSaveFilename);
	}


	// Clean up...

	pDStream->Release();
	debug_deletea(pData);


	// Check for an error...

	if (!bRet)
	{
		TRACE("ERROR CGameButeMgr::Parse() (%s)!\n", sButeFile);
		return(FALSE);
	}


	// All done...

	return(TRUE);
}
Example #27
0
RADARTYPE::~RADARTYPE()
{	
	debug_deletea( szName );
	debug_deletea( szIcon );
}
LTBOOL CGameButeMgr::Parse(ILTCSBase *pInterface, const char* sButeFile)
{
	// Sanity checks...

    if (!sButeFile)	return(LTFALSE);


	BOOL bRet = TRUE;

	// NOTE!!! When _REZFILE is defined, this code will need to be 
	// updated to support being called from DEdit!!!!
	// (from a IObjectPlugin::PreHook_EditStringList() call)...

#if !defined(_REZFILE)

	// If we're going to allow the bute file to be saved by the game, it must
	// be read in from a file (not a .rez file)...

	// Append the NOLF directory onto the filename if this file is normally
	// stored in the .rez file...

	if (m_bInRezFile)
	{
		m_strAttributeFile.Format("NOLF\\%s", sButeFile);
	}
	else
	{
		m_strAttributeFile.Format("%s", sButeFile);
	}


	if (m_pCryptKey)
	{
		bRet = m_buteMgr.Parse(m_strAttributeFile, m_pCryptKey);
	}
	else
	{
		bRet = m_buteMgr.Parse(m_strAttributeFile);
	}

	return bRet;

#endif  // !_REZFILE

	m_strAttributeFile = sButeFile;

	// Open the file...

	char sConstFile[256];
	strncpy(sConstFile, sButeFile, 255);

    ILTStream* pDStream;

    LTRESULT dr = pInterface->OpenFile(sConstFile, &pDStream);

    if (dr != LT_OK)
	{
		char sError[512];
		sprintf(sError,"ERROR CGameButeMgr couldn't open file %s!",sButeFile);
		GBM_DisplayError(sError);

#ifdef _CLIENTBUILD
        g_pLTClient->ShutdownWithMessage(sError);
#endif
		return(FALSE);
	}


	// Read the file...

	unsigned long uLen = pDStream->GetLen();

	char* pData = debug_newa(char, uLen);
	if (!pData)
	{
		pDStream->Release();
		GBM_DisplayError("CGameButeMgr couldn't allocate data for stream.");
		return(FALSE);
	}

	pDStream->Read(pData, uLen);


	// Parse the file...

	if (m_pCryptKey)
	{
		bRet = m_buteMgr.Parse(pData, uLen, m_pCryptKey);
	}
	else
	{
		bRet = m_buteMgr.Parse(pData, uLen);
	}


	// Clean up...

	pDStream->Release();
	debug_deletea(pData);


	// Check for an error...

	if (!bRet)
	{
		TRACE("CGameButeMgr::Parse() ERROR!\n");
		return(FALSE);
	}


	// All done...

	return(TRUE);
}
Example #29
0
CSnowFXParticleMgr::~CSnowFXParticleMgr()
{
	debug_deletea( m_Particles );
}