Some 332 zone stuff (concerning)
This commit is contained in:
parent
c6716537f9
commit
ed2286009d
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
||||
Subproject commit 2e748fdbf129de08255ae07671d235efc466b58c
|
||||
Subproject commit 3b3ca1c1b39b5566c1a8b81ca30b55da2550372f
|
@ -116,6 +116,13 @@ namespace Components
|
||||
bool AssetHandler::IsAssetEligible(Game::XAssetType type, Game::XAssetHeader *asset)
|
||||
{
|
||||
const char* name = Game::DB_GetXAssetNameHandlers[type](asset);
|
||||
|
||||
// Should we perform the null check before or after this?
|
||||
if (Flags::HasFlag("entries"))
|
||||
{
|
||||
OutputDebugStringA(Utils::String::VA("%s: %d: %s\n", FastFiles::Current().data(), type, name));
|
||||
}
|
||||
|
||||
if (!name) return false;
|
||||
|
||||
bool restrict = false;
|
||||
@ -183,6 +190,8 @@ namespace Components
|
||||
}
|
||||
|
||||
offset->pointer = *reinterpret_cast<void**>(pointer);
|
||||
|
||||
//Game::XAssetHeader zob{ offset->pointer };
|
||||
}
|
||||
|
||||
void AssetHandler::ZoneSave(Game::XAsset asset, ZoneBuilder::Zone* builder)
|
||||
|
@ -126,7 +126,7 @@ namespace Components
|
||||
format = "maps/%s.d3dbsp";
|
||||
}
|
||||
|
||||
if (_strnicmp("mp_", mapname, 3) || mapname == "mp_nuked"s || mapname == "mp_bloc"s || mapname == "mp_cargoship"s || mapname == "mp_cross_fire"s || mapname == "mp_bog_sh"s || mapname == "mp_killhouse"s)
|
||||
if (_strnicmp("mp_", mapname, 3) || mapname == "mp_nuked"s || mapname == "mp_bloc"s || mapname == "mp_cargoship"s || mapname == "mp_cross_fire"s || mapname == "mp_bog_sh"s || mapname == "mp_killhouse"s || mapname == "mp_bloc_sh"s || mapname == "mp_cargoship_sh"s)
|
||||
{
|
||||
// Adjust pointer to GameMap_Data
|
||||
Utils::Hook::Set<Game::GameMap_Data**>(0x4D90B7, &(Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_SP].gameMapSP[0].data));
|
||||
@ -254,6 +254,9 @@ namespace Components
|
||||
Maps::AddDependency("mp_bog_sh", "iw4x_dependencies_mp");
|
||||
Maps::AddDependency("mp_killhouse", "iw4x_dependencies_mp");
|
||||
Maps::AddDependency("^(?!mp_).*", "iw4x_dependencies_mp"); // All maps not starting with "mp_"
|
||||
|
||||
Maps::AddDependency("mp_bloc_sh", "iw4x_dependencies_mp");
|
||||
Maps::AddDependency("mp_cargoship_sh", "iw4x_dependencies_mp");
|
||||
}
|
||||
|
||||
Maps::~Maps()
|
||||
|
@ -24,6 +24,7 @@ namespace Components
|
||||
Utils::Hook Zones::LoadPathDataTailHook;
|
||||
Utils::Hook Zones::LoadWeaponAttachHook;
|
||||
Utils::Hook Zones::LoadWeaponCompleteDefHook;
|
||||
Utils::Hook Zones::LoadGfxImageHook;
|
||||
|
||||
bool Zones::LoadFxEffectDef(bool atStreamStart, char* buffer, int size)
|
||||
{
|
||||
@ -45,7 +46,7 @@ namespace Components
|
||||
Zones::FxEffectStrings[i] = *reinterpret_cast<char**>(buffer + (260 * i) + 256);
|
||||
}
|
||||
|
||||
std::memcpy(buffer, elems,sizeof(Game::FxElemDef) * count);
|
||||
std::memcpy(buffer, elems, sizeof(Game::FxElemDef) * count);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -146,6 +147,35 @@ namespace Components
|
||||
std::memcpy(&tempSurfaces[i].indexBuffer, source + 16, 20);
|
||||
std::memcpy(&tempSurfaces[i].numCT, source + 40, 8);
|
||||
std::memcpy(&tempSurfaces[i].something, source + 52, 24);
|
||||
|
||||
if (Zones::ZoneVersion >= 332)
|
||||
{
|
||||
struct
|
||||
{
|
||||
short pad; // +0
|
||||
char flag; // +2
|
||||
unsigned char streamHandle; // +3
|
||||
unsigned short numVertices; // +4
|
||||
unsigned short numPrimitives; // +6
|
||||
// [...]
|
||||
} surface332;
|
||||
|
||||
// Copy the data to our new structure
|
||||
std::memcpy(&surface332, &tempSurfaces[i], sizeof(surface332));
|
||||
|
||||
// Check if that special flag is set
|
||||
if (!(surface332.flag & 0x20))
|
||||
{
|
||||
Logger::Error("We're not able to handle XSurface buffer allocation yet!");
|
||||
}
|
||||
|
||||
// Copy the correct data back to our surface
|
||||
tempSurfaces[i].streamHandle = surface332.streamHandle;
|
||||
tempSurfaces[i].numVertices = surface332.numVertices;
|
||||
tempSurfaces[i].numPrimitives = surface332.numPrimitives;
|
||||
|
||||
//std::memmove(&tempSurfaces[i].numVertices, &tempSurfaces[i].numPrimitives, 6);
|
||||
}
|
||||
}
|
||||
|
||||
std::memcpy(buffer, tempSurfaces, sizeof(Game::XSurface) * count);
|
||||
@ -634,6 +664,16 @@ namespace Components
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Zones::LoadGfxImage(bool atStreamStart, char* buffer, int size)
|
||||
{
|
||||
bool result = Game::Load_Stream(atStreamStart, buffer, size + 4);
|
||||
|
||||
memcpy(buffer + 28, buffer + 32, 4);
|
||||
AssetHandler::Relocate(buffer + 32, buffer + 28, 4);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Zones::InstallPatches(int version)
|
||||
{
|
||||
@ -643,7 +683,7 @@ namespace Components
|
||||
Zones::ZoneVersion = version;
|
||||
|
||||
bool patch = (version >= VERSION_ALPHA2);
|
||||
if (Zones::ZoneVersion == VERSION_ALPHA2 || Zones::ZoneVersion == VERSION_ALPHA3 || Zones::ZoneVersion == VERSION_ALPHA3_DEC || Zones::ZoneVersion == XFILE_VERSION)
|
||||
if (Zones::ZoneVersion == VERSION_ALPHA2 || Zones::ZoneVersion == VERSION_ALPHA3 || Zones::ZoneVersion == VERSION_ALPHA3_DEC || Zones::ZoneVersion == XFILE_VERSION || Zones::ZoneVersion == 332)
|
||||
{
|
||||
Utils::Hook::Set<DWORD>(0x4158F4, version);
|
||||
Utils::Hook::Set<DWORD>(0x4158FB, version);
|
||||
@ -677,6 +717,9 @@ namespace Components
|
||||
// addon_map_ents asset type (we reuse it for weaponattach)
|
||||
Utils::Hook::Set<BYTE>(0x418B30, (patch) ? 43 : Game::ASSET_TYPE_ADDON_MAP_ENTS);
|
||||
|
||||
// Change block for images
|
||||
//Utils::Hook::Set<BYTE>(0x4C13E4, ((Zones::ZoneVersion >= 332) ? 3 : 0));
|
||||
|
||||
if (patch)
|
||||
{
|
||||
Zones::LoadFxElemDefArrayHook.Install();
|
||||
@ -703,6 +746,19 @@ namespace Components
|
||||
{
|
||||
Zones::LoadPathDataHook.Install();
|
||||
}
|
||||
else
|
||||
{
|
||||
Zones::LoadPathDataHook.Uninstall();
|
||||
}
|
||||
|
||||
if (Zones::ZoneVersion >= 332)
|
||||
{
|
||||
Zones::LoadGfxImageHook.Install();
|
||||
}
|
||||
else
|
||||
{
|
||||
Zones::LoadGfxImageHook.Uninstall();
|
||||
}
|
||||
|
||||
Zones::LoadMaterialShaderArgumentArrayHook.Install();
|
||||
Zones::LoadStructuredDataStructPropertyArrayHook.Install();
|
||||
@ -733,6 +789,8 @@ namespace Components
|
||||
|
||||
Zones::LoadMaterialShaderArgumentArrayHook.Uninstall();
|
||||
Zones::LoadStructuredDataStructPropertyArrayHook.Uninstall();
|
||||
|
||||
Zones::LoadGfxImageHook.Uninstall();
|
||||
}
|
||||
|
||||
AntiCheat::EmptyHash();
|
||||
@ -765,6 +823,8 @@ namespace Components
|
||||
Zones::LoadMaterialShaderArgumentArrayHook.Initialize(0x428F0A, Zones::LoadMaterialShaderArgumentArray, HOOK_CALL);
|
||||
Zones::LoadStructuredDataStructPropertyArrayHook.Initialize(0x4B1EB8, Zones::LoadStructuredDataStructPropertyArray, HOOK_CALL);
|
||||
|
||||
Zones::LoadGfxImageHook.Initialize(0x4471AD, Zones::LoadGfxImage, HOOK_CALL);
|
||||
|
||||
Zones::LoadPathDataTailHook.Initialize(0x427A1B, Zones::LoadPathDataTail, HOOK_JUMP);
|
||||
Zones::LoadPathDataHook.Initialize(0x4F4D3B, [] ()
|
||||
{
|
||||
|
@ -41,6 +41,7 @@ namespace Components
|
||||
static Utils::Hook LoadPathDataTailHook;
|
||||
static Utils::Hook LoadWeaponAttachHook;
|
||||
static Utils::Hook LoadWeaponCompleteDefHook;
|
||||
static Utils::Hook LoadGfxImageHook;
|
||||
|
||||
static void LoadFxElemDefArrayStub(bool atStreamStart);
|
||||
static bool LoadFxElemDefStub(bool atStreamStart, Game::FxElemDef* fxElem, int size);
|
||||
@ -61,5 +62,6 @@ namespace Components
|
||||
static void LoadWeaponAttach();
|
||||
static void LoadWeaponAttachStuff(DWORD* varWeaponAttachStuff, int count);
|
||||
static void LoadWeaponCompleteDef();
|
||||
static bool LoadGfxImage(bool atStreamStart, char* buffer, int size);
|
||||
};
|
||||
}
|
||||
|
@ -2315,6 +2315,10 @@ namespace Game
|
||||
union XAssetHeader
|
||||
{
|
||||
void *data;
|
||||
|
||||
// This is only for debugging
|
||||
const char* string;
|
||||
|
||||
MenuList *menuList;
|
||||
menuDef_t *menu;
|
||||
Material *material;
|
||||
|
Loading…
Reference in New Issue
Block a user