示例#1
0
void CSequence::Write(CTxtFile* file, bool bPreQuat)
{
	CComment* curComment = m_comments;
	while(curComment != NULL)
	{
		curComment->Write(file);
		curComment = curComment->GetNext();
	}

	file->Write("$", CAssimilateDoc::GetKeyword(IsGLA()?TK_AS_GRAB_GLA:TK_AS_GRAB, TABLE_QDT), " ");
	CString path = m_path;
	int loc = path.Find("/base");
	if (loc > -1)
	{
		path = path.Right(path.GetLength() - loc - 5);
		loc = path.Find("/");
		path = path.Right(path.GetLength() - loc - 1);
	}
	if (!path.GetLength())	// check that some dopey artist hasn't use the name "base" on the right hand side
	{
		path = m_path;
	}

	Filename_AccountForLOD(path, giLODLevelOverride);
	file->Write(path);	
/*
	if (m_frameCount > -1)
	{
		file->Space();
		file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_FRAMES, TABLE_GRAB), " ");
		file->Write(m_startFrame);
		file->Space();
		file->Write(m_targetFrame);
		file->Space();
		file->Write(m_frameCount);
	}
*/

//	if (strstr(path,"death16"))
//	{
//		int z=1;
//	}

	if (!IsGLA())
	{
		if (m_fill > -1)
		{
			file->Space();
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_FILL, TABLE_GRAB), " ");
	//		file->Space();
			file->Write(m_fill);
		}
		if (m_loopFrame != 0)
		{
			file->Space();
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_LOOP, TABLE_GRAB), " ");
	//		file->Space();
			file->Write(m_loopFrame);
		}
	//	if (m_enum && (strcmp(m_name, m_enum) != 0))
		if (m_enum.GetLength() && (strcmp(m_name, m_enum) != 0))
		{
			file->Space();
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_ENUM, TABLE_GRAB), " ");
	//		file->Space();
			file->Write(m_enum);
		}
		if (m_sound != NULL)
		{
			file->Space();
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_SOUND, TABLE_GRAB), " ");
	//		file->Space();
			file->Write(m_sound);
		}
		if (m_action != NULL)
		{
			file->Space();
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_ACTION, TABLE_GRAB), " ");
	//		file->Space();
			file->Write(m_action);
		}	

		if (m_bGenLoopFrame)
		{
			file->Space();
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_GENLOOPFRAME, TABLE_GRAB), " ");
		}

		if (m_frameSpeed != m_iFrameSpeedFromHeader ||
			GetValidAdditionalSequences() ||
			bPreQuat
			)
		{
			// write out start marker (and stop-marker at bottom) so qdata can skip this more easily...
			//
			file->Space();
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_QDSKIPSTART, TABLE_GRAB));
			
			if (m_frameSpeed != m_iFrameSpeedFromHeader)
			{
				file->Space();
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_FRAMESPEED, TABLE_GRAB), " ");
				file->Write(m_frameSpeed);
			}
			
			for (int i=0; i<MAX_ADDITIONAL_SEQUENCES; i++)
			{
				CSequence* additionalSeq = AdditionalSeqs[i];
				
				if (additionalSeq->AdditionalSequenceIsValid())
				{
					file->Space();
					file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_ADDITIONAL, TABLE_GRAB), " ");
					file->Write(additionalSeq->GetStartFrame());
					file->Space();
					file->Write(additionalSeq->GetFrameCount());
					file->Space();
					file->Write(additionalSeq->GetLoopFrame());
					file->Space();
					file->Write(additionalSeq->GetFrameSpeed());
					file->Space();
					file->Write(additionalSeq->GetEnum());
				}
			}

			// this is an unpleasant abuse, but needed to retro-hack into old versions of carcass...
			//
			if (bPreQuat)
			{
				file->Space();
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_PREQUAT, TABLE_GRAB));
			}

			// any other stuff in future (sound events etc)...
			//
			// ...

			// write end marker (so QData knows to start reading again)...
			//
			file->Space();
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_QDSKIPSTOP, TABLE_GRAB));
		}
	}

	file->Writeln();
}
示例#2
0
文件: Model.cpp 项目: DT85/Assimilate
void CModel::Write(CTxtFile* file)
{
	file->Write("$");
	file->Writeln(CAssimilateDoc::GetKeyword(TK_AS_GRABINIT, TABLE_QDT));

	if (!HasGLA())
	{
		if (GetScale() != 1.0f)
		{
			file->Write("$");
			file->Write(CAssimilateDoc::GetKeyword(TK_AS_SCALE, TABLE_QDT)," ");
			file->Writeln(va("%g",GetScale()));
		}

		if (GetKeepMotion())
		{
			file->Write("$");
			file->Writeln(CAssimilateDoc::GetKeyword(TK_AS_KEEPMOTION, TABLE_QDT));
		}

		if (GetRefGLAPath())
		{
			file->Write("$");
			file->Write(CAssimilateDoc::GetKeyword(TK_AS_REF_GLA, TABLE_QDT), " ");
			file->Writeln(va("%s", GetRefGLAPath()));
		}

		for (int iPCJ=0; iPCJ < PCJList_GetEntries(); iPCJ++)
		{
			file->Write("$");
			file->Write(CAssimilateDoc::GetKeyword(TK_AS_PCJ, TABLE_QDT)," ");
			file->Writeln( PCJList_GetEntry(iPCJ) );
		}
	}

	CComment* curComment = m_comments;
	while(curComment != NULL)
	{
		curComment->Write(file);
		curComment = curComment->GetNext();
	}

	bool bFirstSeqWritten = false;
	CSequence* curSequence = m_sequences;
	while(curSequence != NULL)
	{
		curSequence->Write(file, !bFirstSeqWritten && GetPreQuat());
		curSequence = curSequence->GetNext();

		bFirstSeqWritten = true;
	}

	file->Writeln("$", CAssimilateDoc::GetKeyword(TK_AS_GRABFINALIZE, TABLE_QDT));

	if (m_path != NULL)
	{
		file->Write("$", CAssimilateDoc::GetKeyword(GetConvertType(), TABLE_QDT));
		CString path = m_path;
	
		int loc = path.Find("/base");
		if (loc > -1)
		{
			path = path.Right(path.GetLength() - loc - 5);
			loc = path.Find("/");
			path = path.Right(path.GetLength() - loc - 1);
		}
		if (!path.GetLength())	// check that some dopey artist hasn't use the name "base" on the right hand side
		{
			path = m_path;
		}

		file->Write(" ", path, " ");

		// params stuff...

		if (IsGhoul2())
		{
			if	(GetMakeSkin())
			{
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_MAKESKIN,	TABLE_CONVERT), " ");
			}
			if	(GetSmooth())
			{
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_SMOOTH,	TABLE_CONVERT), " ");
			}
			if (GetLoseDupVerts())
			{
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_LOSEDUPVERTS, TABLE_CONVERT), " ");
			}
			if  (GetIgnoreBaseDeviations())
			{
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_IGNOREBASEDEVIATIONS, TABLE_CONVERT), " ");
			}
			if	(GetSkew90())
			{
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_SKEW90,	TABLE_CONVERT), " ");
			}
			if	(GetNoSkew90())
			{
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_NOSKEW90, TABLE_CONVERT), " ");
			}
			if	(GetMakeSkelPath() && strlen(GetMakeSkelPath()))
			{
				file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_MAKESKEL,	TABLE_CONVERT), " ");
				file->Write(GetMakeSkelPath(), " ");
			}

			// params below not used for ghoul2
		}
		else
		{
			if (giLODLevelOverride)
			{
				file->Write(va("-lod %d ",giLODLevelOverride));
			}

			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_PLAYERPARMS, TABLE_CONVERT), " ");
			file->Write(0);//m_skipStart+1);	// ignore these, but don't want to update parser and have invalid prev files
			file->Space();
			file->Write(0);//m_skipEnd);//max upper frames);
			file->Space();		
		}

		if (m_originx || m_originy || m_originz)
		{
			file->Write("-", CAssimilateDoc::GetKeyword(TK_AS_ORIGIN, TABLE_CONVERT), " ");
			file->Write(m_originx);
			file->Space();
			file->Write(m_originy);
			file->Space();
			file->Write(m_originz);
		}

		file->Writeln();
	}
}