Ejemplo n.º 1
0
BOOL CStreamingSA::HaveAnimationsLoaded ( int iAnimationLibraryBlock )
{
	iAnimationLibraryBlock += 25575;
	return HasModelLoaded( iAnimationLibraryBlock );
}
Ejemplo n.º 2
0
void ProcessEntityRequests()
{
	// deferred stuff
	for (auto& defer : g_deferFuncs)
	{
		defer();
	}

	g_deferFuncs.clear();

	// process deletion (this is before the other list as MIs may not have been AddRef'd)
	for (auto& pair : g_modelInfos)
	{
		auto mi = pair.second;

		if (mi->ShouldRelease())
		{
			if (g_primedMIs.find(mi.get()) != g_primedMIs.end())
			{
				//trace("removing reference to drawable dict %s as model info 0x%08x is unused\n", GetStreamName(mi->GetDrawblDict(), *(int*)0xF272E4).c_str(), mi->GetModelHash());
				((void(*)(int))0x907940)(mi->GetDrawblDict());

				g_primedMIs.erase(mi.get());
			}
		}
	}

	// and so on
	for (auto it = m_requestList.begin(); it != m_requestList.end(); )
	{
		auto req = *it;

		bool done = false;

		if (req.txd == -1 || HasModelLoaded(req.txd, *(int*)0xF1CD84))
		{
			if (req.drawblDict == -1 || HasModelLoaded(req.drawblDict, *(int*)0xF272E4))
			{
				done = true;
			}
		}

		if (done)
		{
			void* drawblDict = ((void*(*)(uint32_t))0x422070)(req.drawblDict);
			int inst = ((int(__thiscall*)(void*, uint32_t))0x908F80)(drawblDict, req.modelInfo->GetModelHash());

			// add reference to drawable dict
			((void(*)(int))0x907910)(req.drawblDict);

			g_primedMIs.insert(req.modelInfo);

			if (inst)
			{
				req.modelInfo->InstantiateInst(inst);

				//trace("load 0x%08x (drawable dict %s)\n", req.modelInfo->GetModelHash(), GetStreamName(req.drawblDict, *(int*)0xF272E4).c_str());

				m_requestExistenceSet.erase(req.modelInfo);
				it = m_requestList.erase(it);
			}
			else
			{
				//trace("load 0x%08x failed? (drawable dict %s)\n", req.modelInfo->GetModelHash(), GetStreamName(req.drawblDict, *(int*)0xF272E4).c_str());

				it++;
			}
		}
		else
		{
			if (req.txd != 0xFFFF)
			{
				RequestModel(req.txd, *(int*)0xF1CD84, 0);
			}

			if (req.drawblDict != 0xFFFF)
			{
				RequestModel(req.drawblDict, *(int*)0xF272E4, 0);
			}

			it++;
		}
	}

	BoundStreaming::Process();
}