Compare commits

...

5 Commits

Author SHA1 Message Date
Louvenarde
d0e7ec7787 Merge branch 'develop' into codo_461_dump
# Conflicts:
#	src/Components/Modules/ZoneBuilder.cpp
#	src/Components/Modules/Zones.cpp
2023-12-17 00:30:54 +01:00
Louvenarde
332011cdd1 this is madness! 2023-08-28 23:54:17 +02:00
Louvenarde
b42456e432 Completely messed up FXEffectDef loading, need to look into pointers more 2023-08-28 19:20:45 +02:00
Louvenarde
49e18e58d5 Weapon struct for 461 2023-08-20 14:21:15 +02:00
Louvenarde
fe4ea0156f Quick fixup to allow IW4OF to handle CODO structs (ultimately some of those fixes should be moved to Zones.cpp) 2023-08-19 18:12:41 +02:00
10 changed files with 1667 additions and 1063 deletions

View File

@ -224,6 +224,12 @@ namespace Components
void AssetHandler::ModifyAsset(Game::XAssetType type, Game::XAssetHeader asset, const std::string& name)
{
if (name == "impacts/distant_grain"s)
{
printf("");
}
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;
}
@ -1130,9 +1135,16 @@ namespace Components
};
params.get_from_string_table = [](const unsigned int& id) -> std::string
{
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
{
@ -1258,6 +1270,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())
@ -1271,6 +1288,20 @@ namespace Components
Command::Add("dumpzone", [](const Command::Params* params)
{
Utils::Memory::Allocator assetReallocator{}; // Needed to translate some assets from CODO for instance
// IW4OF only supports gameworldMP for now, fortunately the types are very similar
if (type == Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP && asset.gameWorldSp)
{
type = Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP;
auto* newWorldMp = assetReallocator.allocate<Game::GameWorldMp>();
newWorldMp->name = asset.gameWorldSp->name;
newWorldMp->g_glassData = asset.gameWorldSp->g_glassData;
asset.gameWorldMp = newWorldMp;
}
if (params->size() < 2) return;
std::string zone = params->get(1);
@ -1285,6 +1316,20 @@ namespace Components
Logger::Print("Loading zone '{}'...\n", zone);
{
if (type == Game::XAssetType::ASSET_TYPE_IMAGE)
{
if (asset.image->category == Game::ImageCategory::IMG_CATEGORY_UNKNOWN)
{
asset.image->category = Game::ImageCategory::IMG_CATEGORY_LOAD_FROM_FILE;
}
}
if (type == Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET && asset.techniqueSet)
{
// fix for garbage PTRs hanging out in iw4 memory
asset.techniqueSet->remappedTechniqueSet = nullptr;
}
struct asset_t
{
Game::XAssetType type;

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

@ -2766,6 +2766,23 @@ namespace Game
int max_stream_channels;
};
struct SndStartAliasInfo
{
snd_alias_t* alias0;
snd_alias_t* alias1;
float lerp;
SndEntHandle sndEnt;
float org[3];
float volume;
float pitch;
int timeshift;
float fraction;
int startDelay;
bool master;
float timescaleLerp;
snd_alias_system_t system;
};
struct Poly
{
float(*pts)[3];
@ -3037,7 +3054,7 @@ namespace Game
union FxEffectDefRef
{
FxEffectDef* handle;
const char* name;
char* name;
};
union FxElemVisuals
@ -4919,6 +4936,12 @@ namespace Game
MISSILE_GUIDANCE_COUNT = 0x4,
};
struct StreamPosInfo
{
char* pos;
unsigned int index;
};
struct TracerDef
{
const char* name;
@ -10994,7 +11017,7 @@ namespace Game
volatile int firstFreeSparkFountain;
volatile int firstFreeSparkFountainCluster;
volatile int deferredElemCount;
volatile int activeElemCount;
int activeElemCount;
volatile int activeTrailElemCount;
volatile int activeTrailCount;
volatile int activeBoltCount;

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