Beispiel #1
0
static bool ArchetypeSetDrawableDict(char* archetype, uint32_t* hash, int txd)
{
	*(uint8_t*)(archetype + 96) = 0;
	*(uint16_t*)(archetype + 98) = -1;

	uint16_t archetypeIdx = *(uint16_t*)(archetype + 102);
	g_drawableIndices[archetypeIdx] = -1;

	if (*hash != HashRageString("null"))
	{
		auto dwdStore = (AssetStore*)g_dwdStore;
		int idx = dwdStore->store.GetIndex(*hash);

		if (idx != -1)
		{
			auto ptr = dwdStore->pool.GetAt<char>(idx);

			if (ptr)
			{
				*(uint8_t*)(archetype + 96) = 3;
				*(uint16_t*)(archetype + 98) = idx;
				g_drawableIndices[archetypeIdx] = idx;

				if (txd != -1)
				{
					*(uint16_t*)(ptr + 16) = txd;
				}

				return true;
			}
		}
	}

	return true;
}
CBaseModelInfo* GetModelInfo(uint32_t nameHash, int* mIdx)
{
	auto it = g_modelInfos.find(nameHash);

	if (it == g_modelInfos.end())
	{
		CBaseModelInfo* info = ((CBaseModelInfo*(*)(uint32_t, int*))0x98AAE0)(nameHash, mIdx);

		if (nameHash == HashRageString("parkgates_mh06"))
		{
//			__asm int 3
		}

		return info;
	}

	*mIdx = nameHash | 0xF0000000;

	auto indIt = g_modelInfoIdxTable.find(*mIdx);

	if (indIt == g_modelInfoIdxTable.end())
	{
		m_dependencyDrawableDicts.insert(std::make_pair(it->second->GetDrawblDict(), it->second.get()));
		g_modelInfoIdxTable.insert(std::make_pair(*mIdx, it->second));
	}

	return it->second.get();
}
Beispiel #3
0
static bool ArchetypeSetDrawable(char* archetype, uint32_t* hash, int txd, char type)
{
	if (type != 0)
	{
		return g_origSetDrawable(archetype, hash, txd, type);
	}

	*(uint8_t*)(archetype + 96) = 0;
	*(uint16_t*)(archetype + 98) = -1;

	uint16_t archetypeIdx = *(uint16_t*)(archetype + 102);
	g_drawableIndices[archetypeIdx] = -1;

	if (*hash != HashRageString("null"))
	{
		auto drbStore = (AssetStore*)g_drawableStore;
		int idx = drbStore->store.GetIndex(*hash);

		if (idx != -1)
		{
			auto ptr = drbStore->pool.GetAt<char>(idx);

			if (ptr)
			{
				*(uint8_t*)(archetype + 96) = 2;
				*(uint16_t*)(archetype + 98) = idx;
				g_drawableIndices[archetypeIdx] = idx;

				if (txd != -1)
				{
					*(uint16_t*)(ptr + 24) = txd;
				}

				return true;
			}
		}
	}

	return g_origSetDrawable(archetype, hash, txd, true);
}