예제 #1
0
void SrSaveLvlListInfo (CSrLvlListInfoArray& InfoArray, CSrLvspRecord& Record)
{
	CSrSubrecord* pSubrecord;

	Record.DeleteSubrecords(SR_NAME_LLCT);
	Record.DeleteSubrecords(SR_NAME_LVLO);
	Record.DeleteSubrecords(SR_NAME_COED);

	Record.AddInitNewSubrecord(SR_NAME_LLCT);

	for (dword i = 0; i < InfoArray.GetSize(); ++i)
	{
		srlvllistinfo_t& Info = *InfoArray[i];
		if (Info.pLvlo == NULL) continue;

		pSubrecord = Record.AddInitNewSubrecord(SR_NAME_LVLO);
		pSubrecord->Copy(Info.pLvlo);

		if (Info.pCoed != NULL)
		{
			pSubrecord = Record.AddInitNewSubrecord(SR_NAME_COED);
			pSubrecord->Copy(Info.pCoed);
		}
	}

	Record.UpdateListCount();
}
예제 #2
0
void CSrScrlView::GetControlData (void)
{
	CSrSubrecord* pNewEffect;
	CSrSubrecord* pNewEffectData;
	CSrSubrecord* pNewCondition;
	
	CSrRecordDialog::GetControlData();
	GetCurrentEffect();

	CSrScrlRecord* pScroll = SrCastClassNull(CSrScrlRecord, GetOutputRecord());
	if (pScroll == NULL) return;

	pScroll->DeleteSubrecords(SR_NAME_EFID);
	pScroll->DeleteSubrecords(SR_NAME_EFIT);
	pScroll->DeleteSubrecords(SR_NAME_CTDA);	
	pScroll->DeleteSubrecords(SR_NAME_CIS1);
	pScroll->DeleteSubrecords(SR_NAME_CIS2);

	for (dword i = 0; i < m_Effects.GetSize(); ++i)
	{
		srscrl_effectdata_t* pEffect = m_Effects[i];
		if (pEffect == NULL || pEffect->pEffect == NULL || pEffect->pEffectData == NULL) continue;
				
		pNewEffect = pScroll->AddNewSubrecord(SR_NAME_EFID);
		if (pNewEffect) pNewEffect->Copy(pEffect->pEffect);

		pNewEffectData = pScroll->AddNewSubrecord(SR_NAME_EFIT);
		if (pNewEffectData) pNewEffectData->Copy(pEffect->pEffectData);

		for (dword j = 0; j < pEffect->Conditions.GetSize(); ++j)
		{
			srconditioninfo_t* pCondInfo = pEffect->Conditions[j];
			CSrCtdaSubrecord* pCondition = &pCondInfo->Condition;
			if (pCondition == NULL) continue;

			pNewCondition = pScroll->AddNewSubrecord(SR_NAME_CTDA);
			if (pNewCondition) pNewCondition->Copy(pCondition);

			if (pCondInfo->pParam1)
			{
				CSrSubrecord* pNewParam = pScroll->AddNewSubrecord(SR_NAME_CIS1);
				if (pNewParam) pNewParam->Copy(pCondInfo->pParam1);
			}

			if (pCondInfo->pParam2)
			{
				CSrSubrecord* pNewParam = pScroll->AddNewSubrecord(SR_NAME_CIS2);
				if (pNewParam) pNewParam->Copy(pCondInfo->pParam2);
			}
		}

	}
}
예제 #3
0
CSrLvloSubrecord* CSrLvliRecord::GetNextItem (int& Position)
{
	++Position;

	for (; Position < (int)m_Subrecords.GetSize(); ++Position)
	{
		CSrSubrecord* pSubrecord = m_Subrecords[Position];
		if (pSubrecord == NULL) continue;
		if (pSubrecord->GetRecordType() != SR_NAME_LVLO) continue;
		CSrLvloSubrecord* pLvlo = SrCastClass(CSrLvloSubrecord, pSubrecord);
		if (pLvlo != NULL) return pLvlo;
	}

	return NULL;
}
bool CSrArraySubrecord::Copy (CSrSubrecord* pSource) 
{
	Destroy();

	CSrArraySubrecord* pSrcArray = SrCastClassNull(CSrArraySubrecord, pSource);
	if (pSrcArray == NULL) return false;

	m_RecordType = pSrcArray->m_RecordType;
	m_RecordSize = pSrcArray->m_RecordSize;;

	for (dword i = 0; i < pSrcArray->m_Subrecords.GetSize(); ++i)
	{
		CSrSubrecord* pSrc = pSrcArray->m_Subrecords[i];
		if (pSrc == NULL) continue;

		CSrSubrecord* pNew = pSrc->CreateCopy();
		m_Subrecords.Add(pNew);		
	}

	return true;
}
예제 #5
0
void CSrEspFile::UpdateStringMap (CSrRecord* pRecord)
{
	if (pRecord == NULL) return;

		//TODO: Make sure the following outputs the strings to the correct file
	if (pRecord->GetRecordType() == SR_NAME_QUST)
	{
		for (dword i = 0; i < pRecord->GetNumSubrecords(); ++i)
		{
			CSrSubrecord* pSubrecord = pRecord->GetSubrecord(i);

			if (pSubrecord->GetRecordType() == SR_NAME_CNAM)
				pSubrecord->UpdateLocalStrings(m_DLStringFile, m_NextStringID);
			else
				pSubrecord->UpdateLocalStrings(m_LStringFile, m_NextStringID);
		}
	}
	else if (pRecord->GetRecordType() == SR_NAME_BOOK)
	{
		for (dword i = 0; i < pRecord->GetNumSubrecords(); ++i)
		{
			CSrSubrecord* pSubrecord = pRecord->GetSubrecord(i);

			if (pSubrecord->GetRecordType() == SR_NAME_DESC)
				pSubrecord->UpdateLocalStrings(m_DLStringFile, m_NextStringID);
			else
				pSubrecord->UpdateLocalStrings(m_LStringFile, m_NextStringID);
		}
	}
	else if (pRecord->GetRecordType() == SR_NAME_INFO)
	{
		for (dword i = 0; i < pRecord->GetNumSubrecords(); ++i)
		{
			CSrSubrecord* pSubrecord = pRecord->GetSubrecord(i);

				//TODO: Figure out what lstring to save to ILSTRING file
			pSubrecord->UpdateLocalStrings(m_LStringFile, m_NextStringID);
		}
	}
	else
	{
		for (dword i = 0; i < pRecord->GetNumSubrecords(); ++i)
		{
			CSrSubrecord* pSubrecord = pRecord->GetSubrecord(i);
			pSubrecord->UpdateLocalStrings(m_LStringFile, m_NextStringID);
		}
	}
}
예제 #6
0
void CSrScrlView::CreateEffectArray (void)
{
	CSrScrlRecord*			pScroll;
	CSrSubrecord*			pSubrecord;
	CSrSubrecord*			pNewSubrecord;
	CSrFormidSubrecord*		pEffectID;
	srscrl_effectdata_t*	pEffectData;
	int Position;
	int EfitCount;

	m_Effects.Empty();
	pScroll = SrCastClassNull(CSrScrlRecord, GetInputRecord());
	if (pScroll == NULL) return;

	pSubrecord = pScroll->FindFirstSubrecord(SR_NAME_EFID, Position);

	while (pSubrecord)
	{
		pEffectID = SrCastClass(CSrFormidSubrecord, pSubrecord);
		if (pEffectID == NULL) goto CreateEffectArray_EndLoop;

		pEffectData = new srscrl_effectdata_t;
		m_Effects.Add(pEffectData);

		pSubrecord = GetInputRecord()->CreateSubrecord(SR_NAME_EFID);
		pEffectData->pEffect = SrCastClassNull(CSrFormidSubrecord, pSubrecord);
		if (pEffectData->pEffect == NULL) goto CreateEffectArray_EndLoop;
		pEffectData->pEffect->InitializeNew();
		pEffectData->pEffect->Copy(pEffectID);
		EfitCount = 0;

		for (int i = Position + 1; i < (int) pScroll->GetNumSubrecords(); ++i)
		{
			pSubrecord = pScroll->GetSubrecord(i);
			if (pSubrecord == NULL) continue;
			if (pSubrecord->GetRecordType() == SR_NAME_EFID) break;

			if (pSubrecord->GetRecordType() == SR_NAME_CTDA)
			{
				srconditioninfo_t* pNewCond = new srconditioninfo_t;
				pNewCond->Condition.Copy(pSubrecord);
				pEffectData->Conditions.Add(pNewCond);

				pSubrecord = pScroll->GetSubrecord(i+1);
				if (pSubrecord == NULL) continue;

				if (pSubrecord->GetRecordType() == SR_NAME_CIS1)
					pNewCond->CopyParam1(pSubrecord);
				else if (pSubrecord->GetRecordType() == SR_NAME_CIS2)
					pNewCond->CopyParam2(pSubrecord);

				pSubrecord = pScroll->GetSubrecord(i+2);
				if (pSubrecord == NULL) continue;

				if (pSubrecord->GetRecordType() == SR_NAME_CIS2 && pNewCond->pParam2 == NULL)
					pNewCond->CopyParam2(pSubrecord);
			}
			else if (pSubrecord->GetRecordType() == SR_NAME_EFIT)
			{
				++EfitCount;
				if (EfitCount > 1) SystemLog.Printf("WARNING: More than one EFIT per EFID found in SCRL 0x%08X!", pScroll->GetFormID());

				pNewSubrecord = GetInputRecord()->CreateSubrecord(SR_NAME_EFIT);
				pEffectData->pEffectData = SrCastClassNull(CSrEfitSubrecord, pNewSubrecord);
				if (pEffectData->pEffectData == NULL) continue;
				pEffectData->pEffectData->InitializeNew();
				pEffectData->pEffectData->Copy(pSubrecord);
			}
			else
			{
				SystemLog.Printf("WARNING: Unknown subrecord type %4.4s found in SCRL effects!", pSubrecord->GetRecordType().Name);
			}
		}		

CreateEffectArray_EndLoop:
		pSubrecord = pScroll->FindNextSubrecord(SR_NAME_EFID, Position);
	}
	
}
예제 #7
0
void CSrAvifRecord::CreateSectionInfo (CSrAvifSectionArray& InfoArray)
{ 
	int				 Position;
	CSrSubrecord*	 pSubrecord = FindFirstSubrecord(SR_NAME_PNAM, Position);
	sravifsection_t* pCurrentSection = NULL;

	InfoArray.Destroy();
	if (pSubrecord == NULL) return;

	for (dword i = Position; i < m_Subrecords.GetSize(); ++i)
	{
		pSubrecord = m_Subrecords[i];

		if (pSubrecord->GetRecordType() == SR_NAME_PNAM)
		{
			pCurrentSection = InfoArray.AddNew();
			pCurrentSection->PName.CopyFull(pSubrecord);
		}

		if (pCurrentSection == NULL)
		{
			SystemLog.Printf("Warning: Invalid AVIF section format at subrecord[%d] %4.4s!", i+1, pSubrecord->GetRecordType().Name);
			continue;
		}

		if (pSubrecord->GetRecordType() == SR_NAME_FNAM)
		{
			pCurrentSection->FName.CopyFull(pSubrecord);
		}
		else if (pSubrecord->GetRecordType() == SR_NAME_XNAM)
		{
			pCurrentSection->XName.CopyFull(pSubrecord);
		}
		else if (pSubrecord->GetRecordType() == SR_NAME_YNAM)
		{
			pCurrentSection->YName.CopyFull(pSubrecord);
		}
		else if (pSubrecord->GetRecordType() == SR_NAME_HNAM)
		{
			pCurrentSection->HName.CopyFull(pSubrecord);
		}
		else if (pSubrecord->GetRecordType() == SR_NAME_VNAM)
		{
			pCurrentSection->VName.CopyFull(pSubrecord);
		}
		else if (pSubrecord->GetRecordType() == SR_NAME_SNAM)
		{
			pCurrentSection->SName.CopyFull(pSubrecord);
		}
		else if (pSubrecord->GetRecordType() == SR_NAME_CNAM)
		{
			pCurrentSection->CNames.AddNew()->CopyFull(pSubrecord);
		}
		else if (pSubrecord->GetRecordType() == SR_NAME_INAM)
		{
			pCurrentSection->IName.CopyFull(pSubrecord);
			pCurrentSection->CheckNew();
			pCurrentSection = NULL;
		}
	}

}