示例#1
0
EERIE_3DOBJ * loadObject(const res::path & file, bool pbox) {
	return TheoToEerie_Fast("graph/obj3d/textures", file, pbox);
}
示例#2
0
EERIE_3DOBJ * LoadTheObj(const res::path & file, const res::path & texpath) {
	return TheoToEerie_Fast(file.parent() / texpath, file, true);
}
示例#3
0
void EERIE_MESH_TWEAK_Do(INTERACTIVE_OBJ * io, long tw, char * _path)
{
	if (!ALLOW_MESH_TWEAKING) return;

	char file2[256];
	char filet[256];
	char path[256];
	File_Standardize(_path, path);

	strcpy(filet, "GAME\\");
	strcat(filet, path);

	SetExt(filet, ".FTL");
	File_Standardize(filet, file2);

	if ((!PAK_FileExist(file2)) && (!PAK_FileExist(path))) return;

	if (tw == TWEAK_ERROR) return;

	if (io == NULL) return;

	if (io->obj == NULL) return;

	EERIE_MESH_ReleaseTransPolys(io->obj);

	if ((path == NULL) && (tw == TWEAK_REMOVE))
	{
		if (io->tweaky)
		{
			ReleaseEERIE3DObj(io->obj);
			io->obj = io->tweaky;
			EERIE_Object_Precompute_Fast_Access(io->obj);
			io->tweaky = NULL;
		}

		return;
	}

	EERIE_3DOBJ * tobj = NULL;
	EERIE_3DOBJ * result = NULL;
	EERIE_3DOBJ * result2 = NULL;

	if ((PAK_FileExist(file2)) || (PAK_FileExist(path)))
	{
		
		const char DIR_TEXTURES[] = "Graph\\Obj3D\\Textures\\";
		
		if (io->ioflags & IO_NPC)
			tobj = TheoToEerie_Fast(DIR_TEXTURES, path, TTE_NPC);
		else
			tobj = TheoToEerie_Fast(DIR_TEXTURES, path, 0);

		if (!tobj) return;

		switch (tw)
		{
			case TWEAK_ALL:

				if (io->tweaky == NULL) io->tweaky = io->obj;
				else ReleaseEERIE3DObj(io->obj);

				long i;
				TextureContainer * tc;
				tc = NULL;

				for (i = 0; i < tobj->nbfaces; i++)
				{
					if ((tobj->facelist[i].texid >= 0)
					        &&	(tobj->texturecontainer[tobj->facelist[i].texid]))
					{
						tc = tobj->texturecontainer[tobj->facelist[i].texid];

						if (!tc->m_pddsSurface)
							tc->Restore(GDevice);
					}
				}

				io->obj = tobj;
				return;
				break;
			case TWEAK_UPPER:
				result2 = CreateIntermediaryMesh(io->obj, tobj, TWEAK_HEAD);
				result = CreateIntermediaryMesh(result2, tobj, TWEAK_TORSO);
				ReleaseEERIE3DObj(result2);
				break;
			case TWEAK_LOWER:
				result2 = CreateIntermediaryMesh(io->obj, tobj, TWEAK_TORSO);
				result = CreateIntermediaryMesh(result2, tobj, TWEAK_LEGS);
				ReleaseEERIE3DObj(result2);
				break;
			case TWEAK_UP_LO:
				result = CreateIntermediaryMesh(tobj, io->obj, TWEAK_TORSO);
				break;
			default:
				result = CreateIntermediaryMesh(io->obj, tobj, tw);
				break;
		}

		if (result == NULL)
		{
			ReleaseEERIE3DObj(tobj);
			return;
		}

		result->pdata = NULL;
		result->cdata = NULL;

		if (io->tweaky == NULL) io->tweaky = io->obj;
		else if (io->tweaky != io->obj)
			ReleaseEERIE3DObj(io->obj);

		io->obj = result;
		EERIE_Object_Precompute_Fast_Access(io->obj);
	}

	EERIE_CreateCedricData(io->obj);

	if (io)
	{
		io->lastanimtime = 0;
		io->nb_lastanimvertex = 0;
	}

	ReleaseEERIE3DObj(tobj);
}