ZPSMgr::~ZPSMgr()
{
	list<ZPSTable*>::iterator it;
	for( it = m_PSTable.begin() ; it != m_PSTable.end() ; it++ )
	{
		S_REL( (*it)->pDecl );
		S_REL( (*it)->pShader );
	}
	stl_wipe( m_PSTable );
}
示例#2
0
void CRaceMotionData::Destroy()
{
	stl_wipe(m_MotionEventDataVector);
	Initialize();
}
示例#3
0
bool CRaceMotionData::LoadMotionData(const char * c_szFileName)
{
	const float c_fFrameTime = 1.0f / g_fGameFPS;

	CTextFileLoader* pkTextFileLoader=CTextFileLoader::Cache(c_szFileName);
	if (!pkTextFileLoader)
		return false;

	CTextFileLoader& rkTextFileLoader=*pkTextFileLoader;

	if (rkTextFileLoader.IsEmpty())
		return false;

	rkTextFileLoader.SetTop();

	if (!rkTextFileLoader.GetTokenString("motionfilename", &m_strMotionFileName))
		return false;

	if (!rkTextFileLoader.GetTokenFloat("motionduration", &m_fMotionDuration))
		return false;

	CTokenVector * pTokenVector;

	if (rkTextFileLoader.GetTokenVector("accumulation", &pTokenVector))
	{
		if (pTokenVector->size() != 3)
		{
			TraceError("CRaceMotioNData::LoadMotionData : syntax error on accumulation, vector size %d", pTokenVector->size());
			return false;
		}

		TPixelPosition pos(atof(pTokenVector->at(0).c_str()),
						   atof(pTokenVector->at(1).c_str()),
						   atof(pTokenVector->at(2).c_str()));

		SetAccumulationPosition(pos);
	}

	std::string strNodeName;
	for (DWORD i = 0; i < rkTextFileLoader.GetChildNodeCount(); ++i)
	{
		CTextFileLoader::CGotoChild GotoChild(&rkTextFileLoader, i);

		rkTextFileLoader.GetCurrentNodeName(&strNodeName);

		if (0 == strNodeName.compare("comboinputdata"))
		{
			m_isComboMotion = TRUE;

			if (!rkTextFileLoader.GetTokenFloat("preinputtime", &m_ComboInputData.fInputStartTime))
				return false;
			if (!rkTextFileLoader.GetTokenFloat("directinputtime", &m_ComboInputData.fNextComboTime))
				return false;
			if (!rkTextFileLoader.GetTokenFloat("inputlimittime", &m_ComboInputData.fInputEndTime))
				return false;
		}
		else if (0 == strNodeName.compare("attackingdata"))
		{
			m_isAttackingMotion = TRUE;

			if (!NRaceData::LoadMotionAttackData(rkTextFileLoader, &m_MotionAttackData))
				return false;
		}
		else if (0 == strNodeName.compare("loopdata"))
		{
			m_isLoopMotion = TRUE;
			if (!rkTextFileLoader.GetTokenInteger("motionloopcount", &m_iLoopCount))
			{
				m_iLoopCount = -1;
			}
			if (!rkTextFileLoader.GetTokenInteger("loopcancelenable", &m_bCancelEnableSkill))
			{
				m_bCancelEnableSkill = FALSE;
			}
			if (!rkTextFileLoader.GetTokenFloat("loopstarttime", &m_fLoopStartTime))
				return false;
			if (!rkTextFileLoader.GetTokenFloat("loopendtime", &m_fLoopEndTime))
				return false;
		}
		else if (0 == strNodeName.compare("motioneventdata"))
		{
			DWORD dwMotionEventDataCount;

			if (!rkTextFileLoader.GetTokenDoubleWord("motioneventdatacount", &dwMotionEventDataCount))
				continue;

			stl_wipe(m_MotionEventDataVector);

			m_MotionEventDataVector.resize(dwMotionEventDataCount, NULL);

			for (DWORD j = 0; j < m_MotionEventDataVector.size(); ++j)
			{
				if (!rkTextFileLoader.SetChildNode("event", j))
					return false;

				int iType;
				if (!rkTextFileLoader.GetTokenInteger("motioneventtype", &iType))
					return false;

				TMotionEventData * pData = NULL;
				switch(iType)
				{
					case MOTION_EVENT_TYPE_FLY:
						pData = new TMotionFlyEventData;
						break;
					case MOTION_EVENT_TYPE_EFFECT:
						pData = new TMotionEffectEventData;
						break;
					case MOTION_EVENT_TYPE_SCREEN_WAVING:
						pData = new TScreenWavingEventData;
						break;
					case MOTION_EVENT_TYPE_SPECIAL_ATTACKING:
						pData = new TMotionAttackingEventData;
						m_hasSplashEvent = TRUE;
						break;
					case MOTION_EVENT_TYPE_SOUND:
						pData = new TMotionSoundEventData;
						break;
					case MOTION_EVENT_TYPE_CHARACTER_SHOW:
						pData = new TMotionCharacterShowEventData;
						break;
					case MOTION_EVENT_TYPE_CHARACTER_HIDE:
						pData = new TMotionCharacterHideEventData;
						break;
					case MOTION_EVENT_TYPE_WARP:
						pData = new TMotionWarpEventData;
						break;
					case MOTION_EVENT_TYPE_EFFECT_TO_TARGET:
						pData = new TMotionEffectToTargetEventData;
						break;
					default:
						assert(!" CRaceMotionData::LoadMotionData - Strange Event Type");
						return false;
						break;
				}
				m_MotionEventDataVector[j] = pData;
				m_MotionEventDataVector[j]->Load(rkTextFileLoader);
				m_MotionEventDataVector[j]->iType = iType;
				if (!rkTextFileLoader.GetTokenFloat("startingtime", &m_MotionEventDataVector[j]->fStartingTime))
					return false;

				m_MotionEventDataVector[j]->dwFrame = (m_MotionEventDataVector[j]->fStartingTime / c_fFrameTime);

				rkTextFileLoader.SetParentNode();
			}
		}
	}

	std::string strSoundFileNameTemp=c_szFileName;
	strSoundFileNameTemp = CFileNameHelper::NoExtension(strSoundFileNameTemp);
	strSoundFileNameTemp+= ".mss";

	if (strSoundFileNameTemp.length() > 13)
	{
		const char * c_szHeader = &strSoundFileNameTemp[13];

		m_strSoundScriptDataFileName = "sound/";
		m_strSoundScriptDataFileName += c_szHeader;

		LoadSoundScriptData(m_strSoundScriptDataFileName.c_str());
	}

	return true;
}