Fix zm_prototype_sh

This commit is contained in:
momo5502 2016-11-01 20:04:06 +01:00
parent 61b2b0c920
commit 69c454a3fa
5 changed files with 25 additions and 16 deletions

View File

@ -117,7 +117,7 @@ namespace Components
void AssetHandler::ModifyAsset(Game::XAssetType type, Game::XAssetHeader asset, std::string name)
{
if (type == Game::XAssetType::ASSET_TYPE_MATERIAL && (name == "wc/codo_ui_viewer_black_decal3" || name == "wc/codo_ui_viewer_black_decal2" || name == "wc/hint_arrows02"))
if (type == Game::XAssetType::ASSET_TYPE_MATERIAL && (name == "wc/codo_ui_viewer_black_decal3" || name == "wc/codo_ui_viewer_black_decal2" || name == "wc/hint_arrows01" || name == "wc/hint_arrows02"))
{
asset.material->sortKey = 0xE;
}

View File

@ -237,14 +237,7 @@ namespace Components
if (Zones::ZoneVersion >= 359)
{
for (int i = 0, offset = 20; i < 4; ++i, offset += 4)
{
*Game::varXModelPtr = reinterpret_cast<Game::XModel**>(varWeaponCompleteDef + offset);
Game::Load_XModelPtr(false);
}
// 148
for (int offset = 28; offset <= 56; offset += 4)
for (int offset = 20; offset <= 56; offset += 4)
{
*Game::varXModelPtr = reinterpret_cast<Game::XModel**>(varWeaponCompleteDef + offset);
Game::Load_XModelPtr(false);
@ -972,11 +965,13 @@ namespace Components
bool Zones::LoadmenuDef_t(bool atStreamStart, char* buffer, int size)
{
if (Zones::ZoneVersion < 359) size += 4;
if (Zones::ZoneVersion != 359) size += 4;
bool result = Game::Load_Stream(atStreamStart, buffer, size);
std::memmove(buffer + 168, buffer + 172, (Zones::ZoneVersion < 359 ? 232 : 228));
AssetHandler::Relocate(buffer + 172, buffer + 168, (Zones::ZoneVersion < 359 ? 232 : 228));
std::memmove(buffer + 168, buffer + 172, (Zones::ZoneVersion != 359 ? 232 : 228));
AssetHandler::Relocate(buffer + 172, buffer + 168, (Zones::ZoneVersion != 359 ? 232 : 228));
reinterpret_cast<Game::menuDef_t*>(buffer)->expressionData = nullptr;
return result;
}
@ -1283,6 +1278,16 @@ namespace Components
return result;
}
void Zones::LoadWindowImage(bool atStreamStart)
{
Game::Load_MaterialHandle(atStreamStart);
if (Zones::Version() >= 360)
{
Game::Load_GfxImagePtr(atStreamStart);
}
}
void Zones::InstallPatches(int version)
{
AssetHandler::ClearRelocations();
@ -1336,13 +1341,11 @@ namespace Components
// Patch ExpressionSupportingData loading in menus
if (Zones::Version() >= 359)
{
Utils::Hook::Nop(0x41A590, 5);
Utils::Hook::Set<BYTE>(0x459833, 0xC3);
Utils::Hook::Set<BYTE>(0x4AF680, 0xC3);
}
else
{
Utils::Hook(0x41A590, 0x4AF680, HOOK_CALL).Install()->Quick();
Utils::Hook(0x459833, 0x4AF680, HOOK_JUMP).Install()->Quick();
Utils::Hook::Set<BYTE>(0x4AF680, 0xA1);
}
if (patch)
@ -1489,6 +1492,7 @@ namespace Components
}, HOOK_CALL);
Utils::Hook(0x4597DD, Zones::LoadStatement, HOOK_CALL).Install()->Quick();
Utils::Hook(0x471A39, Zones::LoadWindowImage, HOOK_JUMP).Install()->Quick();
#ifdef DEBUG
// Easy dirty disk debugging

View File

@ -74,5 +74,6 @@ namespace Components
static bool LoadGfxWorld(bool atStreamStart, char* buffer, int size);
static void Loadsunflare_t(bool atStreamStart);
static bool LoadStatement(bool atStreamStart, char* buffer, int size);
static void LoadWindowImage(bool atStreamStart);
};
}

View File

@ -111,6 +111,7 @@ namespace Game
Load_XStringCustom_t Load_XStringCustom = (Load_XStringCustom_t)0x4E0DD0;
Load_FxEffectDefHandle_t Load_FxEffectDefHandle = (Load_FxEffectDefHandle_t)0x4D9B90;
Load_FxElemDef_t Load_FxElemDef = (Load_FxElemDef_t)0x45AD90;
Load_GfxImagePtr_t Load_GfxImagePtr = (Load_GfxImagePtr_t)0x4C13D0;
Load_Texture_t Load_Texture = (Load_Texture_t)0x51F4E0;
Load_GfxTextureLoad_t Load_GfxTextureLoad = (Load_GfxTextureLoad_t)0x4D3210;
Load_SndAliasCustom_t Load_SndAliasCustom = (Load_SndAliasCustom_t)0x49B6B0;

View File

@ -266,6 +266,9 @@ namespace Game
typedef void(__cdecl *Load_FxElemDef_t)(bool atStreamStart);
extern Load_FxElemDef_t Load_FxElemDef;
typedef void(__cdecl *Load_GfxImagePtr_t)(bool atStreamStart);
extern Load_GfxImagePtr_t Load_GfxImagePtr;
typedef void(__cdecl *Load_GfxTextureLoad_t)(bool atStreamStart);
extern Load_GfxTextureLoad_t Load_GfxTextureLoad;