Mirror textures in dumped maps and fix multiple dependency maps
This commit is contained in:
parent
aea12a25ef
commit
c2c38539ec
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
std::map<std::string, std::string> Maps::DependencyList;
|
||||
std::vector<std::pair<std::string, std::string>> Maps::DependencyList;
|
||||
std::vector<std::string> Maps::CurrentDependencies;
|
||||
|
||||
std::vector<Game::XAssetEntry> Maps::EntryPool;
|
||||
@ -172,7 +172,7 @@ namespace Components
|
||||
return;
|
||||
}
|
||||
|
||||
Maps::DependencyList[expression] = zone;
|
||||
Maps::DependencyList.push_back({ expression, zone });
|
||||
}
|
||||
|
||||
int Maps::IgnoreEntityStub(const char* entity)
|
||||
@ -197,7 +197,7 @@ namespace Components
|
||||
map.append("# Generated by IW4x\n");
|
||||
map.append("# Credit to SE2Dev for his D3DBSP Tool\n");
|
||||
map.append(fmt::sprintf("o %s\n", world->baseName));
|
||||
map.append(fmt::sprintf("mtllib %s.mtl\n", world->baseName));
|
||||
map.append(fmt::sprintf("mtllib %s.mtl\n\n", world->baseName));
|
||||
|
||||
Logger::Print("Writing vertices...\n");
|
||||
for (unsigned int i = 0; i < world->worldDraw.vertexCount; i++)
|
||||
@ -209,10 +209,12 @@ namespace Components
|
||||
map.append(fmt::sprintf("v %.6f %.6f %.6f\n", x,y, z));
|
||||
}
|
||||
|
||||
map.append("\n");
|
||||
|
||||
Logger::Print("Writing texture coordinates...\n");
|
||||
for (unsigned int i = 0; i < world->worldDraw.vertexCount; i++)
|
||||
{
|
||||
map.append(fmt::sprintf("vt %.6f %.6f\n", world->worldDraw.vd.vertices[i].texCoord[0], world->worldDraw.vd.vertices[i].texCoord[1]));
|
||||
map.append(fmt::sprintf("vt %.6f %.6f\n", world->worldDraw.vd.vertices[i].texCoord[0], -world->worldDraw.vd.vertices[i].texCoord[1]));
|
||||
}
|
||||
|
||||
Logger::Print("Searching materials...\n");
|
||||
@ -252,7 +254,7 @@ namespace Components
|
||||
name = name.substr(pos + 1);
|
||||
}
|
||||
|
||||
map.append(fmt::sprintf("usemtl %s\n", name.data()));
|
||||
map.append(fmt::sprintf("\nusemtl %s\n", name.data()));
|
||||
map.append("s off\n");
|
||||
|
||||
Game::GfxImage* image = materials[m]->textureTable[0].info.image;
|
||||
@ -271,7 +273,7 @@ namespace Components
|
||||
std::string _name = fmt::sprintf("raw/mapdump/%s/textures/%s.png", world->baseName, image->name);
|
||||
D3DXSaveTextureToFile(std::wstring(_name.begin(), _name.end()).data(), D3DXIFF_PNG, image->texture, NULL);
|
||||
|
||||
mtl.append(fmt::sprintf("newmtl %s\n", name.data()));
|
||||
mtl.append(fmt::sprintf("\nnewmtl %s\n", name.data()));
|
||||
mtl.append("Ka 1.0000 1.0000 1.0000\n");
|
||||
mtl.append("Kd 1.0000 1.0000 1.0000\n");
|
||||
mtl.append("illum 1\n");
|
||||
|
@ -15,7 +15,7 @@ namespace Components
|
||||
private:
|
||||
static std::vector<Game::XAssetEntry> EntryPool;
|
||||
|
||||
static std::map<std::string, std::string> DependencyList;
|
||||
static std::vector<std::pair<std::string, std::string>> DependencyList;
|
||||
static std::vector<std::string> CurrentDependencies;
|
||||
|
||||
static void GetBSPName(char* buffer, size_t size, const char* format, const char* mapname);
|
||||
|
@ -1095,20 +1095,6 @@ namespace Components
|
||||
return result;
|
||||
}
|
||||
|
||||
Utils::Hook LoadTextureHook;
|
||||
|
||||
int LoadTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image)
|
||||
{
|
||||
if (Zones::Version() >= 359 && (((image->pad & 1) && !(image->pad & 2))))
|
||||
{
|
||||
image->loaded = 1;
|
||||
image->texture = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return Game::Load_Texture(loadDef, image);
|
||||
}
|
||||
|
||||
bool Zones::LoadXAsset(bool atStreamStart, char* buffer, int size)
|
||||
{
|
||||
size /= 8;
|
||||
@ -1320,8 +1306,6 @@ namespace Components
|
||||
Zones::LoadGfxWorldHook.Install();
|
||||
Zones::Loadsunflare_tHook.Install();
|
||||
|
||||
LoadTextureHook.Install();
|
||||
|
||||
// menu stuff
|
||||
Utils::Hook::Nop(0x41A590, 5);
|
||||
}
|
||||
@ -1333,8 +1317,6 @@ namespace Components
|
||||
Zones::LoadGfxWorldHook.Uninstall();
|
||||
Zones::Loadsunflare_tHook.Uninstall();
|
||||
|
||||
LoadTextureHook.Uninstall();
|
||||
|
||||
Utils::Hook(0x41A590, 0x4AF680, HOOK_CALL).Install()->Quick();
|
||||
}
|
||||
|
||||
@ -1376,26 +1358,14 @@ namespace Components
|
||||
Zones::LoadGfxWorldHook.Uninstall();
|
||||
Zones::Loadsunflare_tHook.Uninstall();
|
||||
|
||||
LoadTextureHook.Uninstall();
|
||||
|
||||
Utils::Hook(0x41A590, 0x4AF680, HOOK_CALL).Install()->Quick();
|
||||
}
|
||||
|
||||
AntiCheat::EmptyHash();
|
||||
}
|
||||
|
||||
int ___test()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Zones::Zones()
|
||||
{
|
||||
// Utils::Hook(0x525A90, ___test, HOOK_JUMP).Install()->Quick();
|
||||
// Utils::Hook(0x50C4F0, ___test, HOOK_JUMP).Install()->Quick();
|
||||
// Utils::Hook(0x514F90, ___test, HOOK_JUMP).Install()->Quick();
|
||||
// Utils::Hook(0x54A2E0, ___test, HOOK_JUMP).Install()->Quick();
|
||||
|
||||
Zones::ZoneVersion = 0;
|
||||
|
||||
// Ignore missing soundaliases for now
|
||||
@ -1437,8 +1407,6 @@ namespace Components
|
||||
{
|
||||
ZeroMemory(*Game::varPathData, sizeof(Game::PathData));
|
||||
}, HOOK_CALL);
|
||||
|
||||
LoadTextureHook.Initialize(0x4D32BC, LoadTexture, HOOK_CALL);
|
||||
}
|
||||
|
||||
Zones::~Zones()
|
||||
|
@ -237,27 +237,6 @@ namespace Game
|
||||
char* name;
|
||||
};
|
||||
|
||||
struct GfxImage_new
|
||||
{
|
||||
GfxImageLoadDef* texture;
|
||||
char mapType;
|
||||
char semantic;
|
||||
char category;
|
||||
char flags;
|
||||
int cardMemory;
|
||||
char pad[8]; // ?
|
||||
int dataLen1;
|
||||
int dataLen2;
|
||||
char pad2[4]; // ?
|
||||
short height;
|
||||
short width;
|
||||
short depth;
|
||||
char loaded;
|
||||
char pad3[5];
|
||||
GfxImageLoadDef* storedTexture;
|
||||
char* name;
|
||||
};
|
||||
|
||||
struct water_t
|
||||
{
|
||||
float floatTime;
|
||||
@ -2531,7 +2510,8 @@ namespace Game
|
||||
unsigned int staticSurfaceCount;
|
||||
unsigned int litSurfsBegin;
|
||||
unsigned int litSurfsEnd;
|
||||
char unknown1[0x24];
|
||||
char unknown1[0x20];
|
||||
int sunShadowCount;
|
||||
char *smodelVisData[3];
|
||||
char *surfaceVisData[3];
|
||||
unsigned __int16 *sortedSurfIndex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user