Completely messed up FXEffectDef loading, need to look into pointers more

This commit is contained in:
Louvenarde 2023-08-28 19:20:45 +02:00
parent 49e18e58d5
commit b42456e432
10 changed files with 854 additions and 1187 deletions

View File

@ -224,6 +224,7 @@ namespace Components
void AssetHandler::ModifyAsset(Game::XAssetType type, Game::XAssetHeader asset, const std::string& name)
{
Logger::Print("LOADED {}: {}\n", Game::DB_GetXAssetTypeName(type), name);
if (type == Game::ASSET_TYPE_MATERIAL && (name == "gfx_distortion_knife_trail" || name == "gfx_distortion_heat_far" || name == "gfx_distortion_ring_light" || name == "gfx_distortion_heat") && asset.material->info.sortKey >= 43)
{
if (Zones::Version() >= VERSION_ALPHA2)

View File

@ -203,7 +203,12 @@ namespace Components
}
}
if (!this->loadAssetByName(this->dataMap.getElementAt(i, 0), this->dataMap.getElementAt(i, 1), false))
const auto& type = this->dataMap.getElementAt(i, 0);
const auto& assetName = this->dataMap.getElementAt(i, 1);
Logger::Print("Building asset {} {} (and dependencies)\n", type, assetName);
if (!this->loadAssetByName(type, assetName, false))
{
return false;
}
@ -1128,7 +1133,14 @@ namespace Components
params.get_from_string_table = [](const unsigned int& id) -> std::string
{
return Game::SL_ConvertToString(static_cast<Game::scr_string_t>(id));
if (id == 0)
{
return std::string();
}
else
{
return Game::SL_ConvertToString(static_cast<Game::scr_string_t>(id));
}
};
params.print = [](iw4of::params_t::print_type t, const std::string& message) -> void
@ -1255,6 +1267,11 @@ namespace Components
// don't remap techsets
Utils::Hook::Nop(0x5BC791, 5);
Utils::Hook::Set(0x5B97B6, 0xE9);
auto jmp = 0x5B9841 - 0x5B97B6 + 1 + 0xFD + 0x100 - 515;
Utils::Hook::Set(0x5B97B6 +1, static_cast<short>(jmp));
AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader asset, const std::string& name, bool* /*restrict*/)
{
if (!ZoneBuilder::TraceZone.empty() && ZoneBuilder::TraceZone == FastFiles::Current())

File diff suppressed because it is too large Load Diff

View File

@ -35,8 +35,8 @@ namespace Components
static bool CheckGameMapSp(int type);
static void GameMapSpPatchStub();
static void LoadFxElemDefArrayStub(bool atStreamStart);
static bool LoadFxElemDefStub(bool atStreamStart, Game::FxElemDef* fxElem, int size);
//static void LoadFxElemDefArrayStub(bool atStreamStart);
//static bool LoadFxElemDefStub(bool atStreamStart, Game::FxElemDef* fxElem, int size);
static void LoadXModelLodInfo(int i);
static void LoadXModelLodInfoStub();
@ -47,12 +47,13 @@ namespace Components
static bool Loadsnd_alias_tArray(bool atStreamStart, char* buffer, int len);
static bool LoadLoadedSound(bool atStreamStart, char* buffer, int size);
static bool LoadmenuDef_t(bool atStreamStart, char* buffer, int size);
static bool LoadFxEffectDef(bool atStreamStart, char* buffer, int size);
//static bool LoadFxEffectDef(bool atStreamStart, char* buffer, int size);
static bool LoadMaterialShaderArgumentArray(bool atStreamStart, Game::MaterialShaderArgument* argument, int size);
static bool LoadStructuredDataStructPropertyArray(bool atStreamStart, char* data, int size);
static void LoadPathDataTail();
static void LoadWeaponAttach();
static void LoadWeaponAttachStuff(DWORD* varWeaponAttachStuff, int count);
static void LoadWeaponCompleteDef461();
static void LoadWeaponCompleteDef();
static bool LoadGfxImage(bool atStreamStart, char* buffer, int size);
static bool LoadXAsset(bool atStreamStart, char* buffer, int size);
@ -98,8 +99,7 @@ namespace Components
static void LoadFxWorldAsset(Game::FxWorld** asset);
static void LoadXModelAsset(Game::XModel** asset);
static void LoadMaterialAsset(Game::Material** asset);
static void LoadTracerDef(bool atStreamStart, Game::TracerDef* tracer, int size);
static void LoadTracerDefFxEffect();
static void LoadTracerDef(bool atStreamStart);
static void FixImageCategory(Game::GfxImage* image);
static char* ParseShellShock_Stub(const char** data_p);
};

View File

@ -30,6 +30,7 @@ namespace Game
XBlock** g_streamBlocks = reinterpret_cast<XBlock**>(0x16E554C);
int* g_streamPos = reinterpret_cast<int*>(0x16E5554);
int* g_streamPosIndex = reinterpret_cast<int*>(0x16E5578);
int* g_streamPosStackIndex = reinterpret_cast<int*>(0x16E5548);
FastCriticalSection* db_hashCritSect = reinterpret_cast<FastCriticalSection*>(0x16B8A54);

View File

@ -96,6 +96,7 @@ namespace Game
extern XBlock** g_streamBlocks;
extern int* g_streamPos;
extern int* g_streamPosIndex;
extern int* g_streamPosStackIndex;
extern FastCriticalSection* db_hashCritSect;

View File

@ -303,6 +303,7 @@ namespace Game
char*** varXString = reinterpret_cast<char***>(0x112B340);
TracerDef*** varTracerDefPtr = reinterpret_cast<TracerDef***>(0x112B3BC);
TracerDef** varTracerDef = reinterpret_cast<TracerDef**>(0x112B3C4);
XModel*** varXModelPtr = reinterpret_cast<XModel***>(0x112A934);
XModel** varXModel = reinterpret_cast<XModel**>(0x112AE14);
PathData** varPathData = reinterpret_cast<PathData**>(0x112AD7C);
@ -313,6 +314,7 @@ namespace Game
PhysPreset*** varPhysPresetPtr = reinterpret_cast<PhysPreset***>(0x112B378);
MaterialPass** varMaterialPass = reinterpret_cast<MaterialPass**>(0x112A960);
snd_alias_list_t*** varsnd_alias_list_name = reinterpret_cast<snd_alias_list_t***>(0x112AF38);
snd_alias_list_t*** varsnd_alias_list_ptr = reinterpret_cast<snd_alias_list_t***>(0x112AA60);
MaterialVertexShader** varMaterialVertexShader = reinterpret_cast<MaterialVertexShader**>(0x112B338);
FxElemField* s_elemFields = reinterpret_cast<FxElemField*>(0x73B848);

View File

@ -657,6 +657,7 @@ namespace Game
extern PhysPreset*** varPhysPresetPtr;
extern MaterialPass** varMaterialPass;
extern snd_alias_list_t*** varsnd_alias_list_name;
extern snd_alias_list_t*** varsnd_alias_list_ptr;
extern MaterialVertexShader** varMaterialVertexShader;
extern FxElemField* s_elemFields;

View File

@ -3054,7 +3054,7 @@ namespace Game
union FxEffectDefRef
{
FxEffectDef* handle;
const char* name;
char* name;
};
union FxElemVisuals
@ -4936,6 +4936,12 @@ namespace Game
MISSILE_GUIDANCE_COUNT = 0x4,
};
struct StreamPosInfo
{
char* pos;
unsigned int index;
};
struct TracerDef
{
const char* name;

View File

@ -16,8 +16,8 @@ namespace Utils::Compression
auto* buffer = allocator.allocateArray<char>(length);
#ifdef _DEBUG
constexpr auto compression = Z_NO_COMPRESSION;
#ifdef _DEBUG && false
constexpr auto compression = Z_BEST_COMPRESSION;
#else
constexpr auto compression = Z_BEST_COMPRESSION;
#endif