From 1e9f9d20ed9d1f269dba849d4ad8b0f9e73bc3bb Mon Sep 17 00:00:00 2001 From: RektInator Date: Sun, 1 Dec 2019 20:03:51 +0100 Subject: [PATCH] AddonMapEnts is now supported on iw4 --- src/IW4/Assets/AddonMapEnts.cpp | 147 +++ src/IW4/Assets/AddonMapEnts.hpp | 35 + src/IW4/Assets/MapEnts.hpp | 2 +- src/IW4/Assets/Techset.cpp | 209 +++- src/IW4/Assets/WeaponDef.cpp | 55 +- src/IW4/IW4.cpp | 1 + src/IW4/Structs.hpp | 1016 +++++++++---------- src/IW4/Zone.cpp | 1 + src/IW4/Zone.hpp | 1 + src/IW5/Assets/ClipMap.cpp | 1 + src/IW5/Assets/MapEnts.cpp | 24 - src/IW5/Assets/Techset.cpp | 77 ++ src/IW5/Assets/Techset.hpp | 1 + src/IW5/Assets/WeaponDef.cpp | 1500 ++--------------------------- src/IW5/Assets/WeaponDef.hpp | 9 - src/IW5/Structs.hpp | 1156 ++++++++++++---------- src/IW5/Zone.cpp | 10 +- src/ZoneTool/ZoneTool.cpp | 2 +- src/ZoneUtils/Zone/ZoneBuffer.hpp | 2 + 19 files changed, 1665 insertions(+), 2584 deletions(-) create mode 100644 src/IW4/Assets/AddonMapEnts.cpp create mode 100644 src/IW4/Assets/AddonMapEnts.hpp diff --git a/src/IW4/Assets/AddonMapEnts.cpp b/src/IW4/Assets/AddonMapEnts.cpp new file mode 100644 index 0000000..2c8a0fc --- /dev/null +++ b/src/IW4/Assets/AddonMapEnts.cpp @@ -0,0 +1,147 @@ +// ======================= ZoneTool ======================= +// zonetool, a fastfile linker for various +// Call of Duty titles. +// +// Project: https://github.com/ZoneTool/zonetool +// Author: RektInator (https://github.com/RektInator) +// License: GNU GPL v3.0 +// ======================================================== +#include "stdafx.hpp" +#include "ZoneUtils/Utils/BinaryDumper.hpp" + +namespace ZoneTool +{ + namespace IW4 + { + AddonMapEnts* IAddonMapEnts::parse(std::string name, ZoneMemory* mem) + { + // check if we can open a filepointer + if (!FileSystem::FileExists(name + ".addon.ents")) + { + return nullptr; + } + + auto file = FileSystem::FileOpen(name + ".addon.ents", "rb"); + + // let them know that we're parsing a custom mapents file + ZONETOOL_INFO("Parsing addon mapents \"%s\"...", name.c_str()); + + // alloc mapents + auto ents = mem->Alloc(); + + ents->name = mem->StrDup(name); + ents->numEntityChars = FileSystem::FileSize(file); + + ents->entityString = mem->Alloc(ents->numEntityChars + 1); + memset((char*)ents->entityString, 0, ents->numEntityChars); + + fread((char*)ents->entityString, ents->numEntityChars, 1, file); + ((char*)ents->entityString)[ents->numEntityChars] = '\0'; + + // convert the mapents! + IMapEnts::ConvertEnts(reinterpret_cast(ents), mem); + + // close filepointer + FileSystem::FileClose(file); + + AssetReader triggerReader(mem); + AssetReader stageReader(mem); + + if (triggerReader.open(name + ".addon.ents.triggers")) + { + ents->trigger.modelCount = triggerReader.read_int(); + ents->trigger.models = triggerReader.read_array(); + + ents->trigger.hullCount = triggerReader.read_int(); + ents->trigger.hulls = triggerReader.read_array(); + + ents->trigger.slabCount = triggerReader.read_int(); + ents->trigger.slabs = triggerReader.read_array(); + } + + triggerReader.close(); + + // return mapents + return ents; + } + + void IAddonMapEnts::init(const std::string& name, ZoneMemory* mem) + { + this->name_ = "maps/mp/" + currentzone + ".d3dbsp"; // name; + this->asset_ = this->parse(name, mem); + + if (!this->asset_) + { + this->asset_ = DB_FindXAssetHeader(this->type(), name.data()).addon_map_ents; + } + } + + void IAddonMapEnts::prepare(ZoneBuffer* buf, ZoneMemory* mem) + { + } + + void IAddonMapEnts::load_depending(IZone* zone) + { + + } + + std::string IAddonMapEnts::name() + { + return this->name_; + } + + std::int32_t IAddonMapEnts::type() + { + return addon_map_ents; + } + + void IAddonMapEnts::write(IZone* zone, ZoneBuffer* buf) + { + auto data = this->asset_; + auto dest = buf->write(data); + + buf->push_stream(3); + START_LOG_STREAM; + + dest->name = buf->write_str(this->name()); + + if (data->entityString) + { + buf->align(0); + buf->write(data->entityString, data->numEntityChars); + ZoneBuffer::ClearPointer(&dest->entityString); + } + + IMapEnts::write_triggers(zone, buf, &dest->trigger); + + END_LOG_STREAM; + buf->pop_stream(); + } + + void IAddonMapEnts::dump(AddonMapEnts* asset) + { + auto file = FileSystem::FileOpen(asset->name + ".addon.ents"s, "wb"); + + if (file) + { + fwrite(asset->entityString, asset->numEntityChars, 1, file); + FileSystem::FileClose(file); + } + + AssetDumper triggerDumper; + if (triggerDumper.open(asset->name + ".addon.ents.triggers"s)) + { + triggerDumper.dump_int(asset->trigger.modelCount); + triggerDumper.dump_array(asset->trigger.models, asset->trigger.modelCount); + + triggerDumper.dump_int(asset->trigger.hullCount); + triggerDumper.dump_array(asset->trigger.hulls, asset->trigger.hullCount); + + triggerDumper.dump_int(asset->trigger.slabCount); + triggerDumper.dump_array(asset->trigger.slabs, asset->trigger.slabCount); + + triggerDumper.close(); + } + } + } +} diff --git a/src/IW4/Assets/AddonMapEnts.hpp b/src/IW4/Assets/AddonMapEnts.hpp new file mode 100644 index 0000000..fb7fbf3 --- /dev/null +++ b/src/IW4/Assets/AddonMapEnts.hpp @@ -0,0 +1,35 @@ +// ======================= ZoneTool ======================= +// zonetool, a fastfile linker for various +// Call of Duty titles. +// +// Project: https://github.com/ZoneTool/zonetool +// Author: RektInator (https://github.com/RektInator) +// License: GNU GPL v3.0 +// ======================================================== +#pragma once + +namespace ZoneTool +{ + namespace IW4 + { + class IAddonMapEnts : public IAsset + { + private: + std::string name_; + AddonMapEnts* asset_; + + public: + AddonMapEnts* parse(std::string name, ZoneMemory* mem); + + void init(const std::string& name, ZoneMemory* mem) override; + void prepare(ZoneBuffer* buf, ZoneMemory* mem) override; + void load_depending(IZone* zone) override; + + std::string name() override; + std::int32_t type() override; + void write(IZone* zone, ZoneBuffer* buffer) override; + + static void dump(AddonMapEnts* asset); + }; + } +} diff --git a/src/IW4/Assets/MapEnts.hpp b/src/IW4/Assets/MapEnts.hpp index 0cc6330..c7054b1 100644 --- a/src/IW4/Assets/MapEnts.hpp +++ b/src/IW4/Assets/MapEnts.hpp @@ -19,7 +19,7 @@ namespace ZoneTool MapEnts* asset_; public: - void ConvertEnts(MapEnts* ents, ZoneMemory* mem); + static void ConvertEnts(MapEnts* ents, ZoneMemory* mem); MapEnts* parse(std::string name, ZoneMemory* mem); IMapEnts(); diff --git a/src/IW4/Assets/Techset.cpp b/src/IW4/Assets/Techset.cpp index 48cff9f..263ca33 100644 --- a/src/IW4/Assets/Techset.cpp +++ b/src/IW4/Assets/Techset.cpp @@ -14,6 +14,152 @@ namespace ZoneTool { namespace IW4 { + std::unordered_map constant_map = + { + { IW5::CONST_SRC_CODE_LIGHT_POSITION, CONST_SRC_CODE_LIGHT_POSITION }, + { IW5::CONST_SRC_CODE_LIGHT_DIFFUSE, CONST_SRC_CODE_LIGHT_DIFFUSE }, + { IW5::CONST_SRC_CODE_LIGHT_SPECULAR, CONST_SRC_CODE_LIGHT_SPECULAR }, + { IW5::CONST_SRC_CODE_LIGHT_SPOTDIR, CONST_SRC_CODE_LIGHT_SPOTDIR }, + { IW5::CONST_SRC_CODE_LIGHT_SPOTFACTORS, CONST_SRC_CODE_LIGHT_SPOTFACTORS }, + { IW5::CONST_SRC_CODE_LIGHT_FALLOFF_PLACEMENT, CONST_SRC_CODE_LIGHT_FALLOFF_PLACEMENT }, + { IW5::CONST_SRC_CODE_PARTICLE_CLOUD_COLOR, CONST_SRC_CODE_PARTICLE_CLOUD_COLOR }, + { IW5::CONST_SRC_CODE_GAMETIME, CONST_SRC_CODE_GAMETIME }, + //{ IW5::CONST_SRC_CODE_EYEOFFSET, CONST_SRC_CODE_EYEOFFSET }, + //{ IW5::CONST_SRC_CODE_COLOR_SATURATION_R, CONST_SRC_CODE_COLOR_SATURATION_R }, + //{ IW5::CONST_SRC_CODE_COLOR_SATURATION_G, CONST_SRC_CODE_COLOR_SATURATION_G }, + //{ IW5::CONST_SRC_CODE_COLOR_SATURATION_B, CONST_SRC_CODE_COLOR_SATURATION_B }, + { IW5::CONST_SRC_CODE_PIXEL_COST_FRACS, CONST_SRC_CODE_PIXEL_COST_FRACS }, + { IW5::CONST_SRC_CODE_PIXEL_COST_DECODE, CONST_SRC_CODE_PIXEL_COST_DECODE }, + { IW5::CONST_SRC_CODE_FILTER_TAP_0, CONST_SRC_CODE_FILTER_TAP_0 }, + { IW5::CONST_SRC_CODE_FILTER_TAP_1, CONST_SRC_CODE_FILTER_TAP_1 }, + { IW5::CONST_SRC_CODE_FILTER_TAP_2, CONST_SRC_CODE_FILTER_TAP_2 }, + { IW5::CONST_SRC_CODE_FILTER_TAP_3, CONST_SRC_CODE_FILTER_TAP_3 }, + { IW5::CONST_SRC_CODE_FILTER_TAP_4, CONST_SRC_CODE_FILTER_TAP_4 }, + { IW5::CONST_SRC_CODE_FILTER_TAP_5, CONST_SRC_CODE_FILTER_TAP_5 }, + { IW5::CONST_SRC_CODE_FILTER_TAP_6, CONST_SRC_CODE_FILTER_TAP_6 }, + { IW5::CONST_SRC_CODE_FILTER_TAP_7, CONST_SRC_CODE_FILTER_TAP_7 }, + { IW5::CONST_SRC_CODE_COLOR_MATRIX_R, CONST_SRC_CODE_COLOR_MATRIX_R }, + { IW5::CONST_SRC_CODE_COLOR_MATRIX_G, CONST_SRC_CODE_COLOR_MATRIX_G }, + { IW5::CONST_SRC_CODE_COLOR_MATRIX_B, CONST_SRC_CODE_COLOR_MATRIX_B }, + { IW5::CONST_SRC_CODE_RENDER_TARGET_SIZE, CONST_SRC_CODE_RENDER_TARGET_SIZE }, + { IW5::CONST_SRC_CODE_SHADOWMAP_POLYGON_OFFSET, CONST_SRC_CODE_SHADOWMAP_POLYGON_OFFSET}, + //{ IW5::CONST_SRC_CODE_RENDER_SOURCE_SIZE, CONST_SRC_CODE_RENDER_SOURCE_SIZE }, + { IW5::CONST_SRC_CODE_DOF_EQUATION_VIEWMODEL_AND_FAR_BLUR, CONST_SRC_CODE_DOF_EQUATION_VIEWMODEL_AND_FAR_BLUR }, + { IW5::CONST_SRC_CODE_DOF_EQUATION_SCENE, CONST_SRC_CODE_DOF_EQUATION_SCENE }, + { IW5::CONST_SRC_CODE_DOF_LERP_SCALE, CONST_SRC_CODE_DOF_LERP_SCALE }, + { IW5::CONST_SRC_CODE_DOF_LERP_BIAS, CONST_SRC_CODE_DOF_LERP_BIAS }, + { IW5::CONST_SRC_CODE_DOF_ROW_DELTA, CONST_SRC_CODE_DOF_ROW_DELTA }, + { IW5::CONST_SRC_CODE_MOTION_MATRIX_X, CONST_SRC_CODE_MOTION_MATRIX_X }, + { IW5::CONST_SRC_CODE_MOTION_MATRIX_Y, CONST_SRC_CODE_MOTION_MATRIX_Y }, + { IW5::CONST_SRC_CODE_MOTION_MATRIX_W, CONST_SRC_CODE_MOTION_MATRIX_W }, + { IW5::CONST_SRC_CODE_SHADOWMAP_SWITCH_PARTITION, CONST_SRC_CODE_SHADOWMAP_SWITCH_PARTITION }, + { IW5::CONST_SRC_CODE_SHADOWMAP_SCALE, CONST_SRC_CODE_SHADOWMAP_SCALE }, + { IW5::CONST_SRC_CODE_ZNEAR, CONST_SRC_CODE_ZNEAR }, + { IW5::CONST_SRC_CODE_LIGHTING_LOOKUP_SCALE, CONST_SRC_CODE_LIGHTING_LOOKUP_SCALE }, + { IW5::CONST_SRC_CODE_DEBUG_BUMPMAP, CONST_SRC_CODE_DEBUG_BUMPMAP }, + { IW5::CONST_SRC_CODE_MATERIAL_COLOR, CONST_SRC_CODE_MATERIAL_COLOR }, + { IW5::CONST_SRC_CODE_FOG, CONST_SRC_CODE_FOG }, + { IW5::CONST_SRC_CODE_FOG_COLOR_LINEAR, CONST_SRC_CODE_FOG_COLOR_LINEAR }, + { IW5::CONST_SRC_CODE_FOG_COLOR_GAMMA, CONST_SRC_CODE_FOG_COLOR_GAMMA }, + { IW5::CONST_SRC_CODE_FOG_SUN_CONSTS, CONST_SRC_CODE_FOG_SUN_CONSTS }, + { IW5::CONST_SRC_CODE_FOG_SUN_COLOR_LINEAR, CONST_SRC_CODE_FOG_SUN_COLOR_LINEAR }, + { IW5::CONST_SRC_CODE_FOG_SUN_COLOR_GAMMA, CONST_SRC_CODE_FOG_SUN_COLOR_GAMMA }, + { IW5::CONST_SRC_CODE_FOG_SUN_DIR, CONST_SRC_CODE_FOG_SUN_DIR }, + { IW5::CONST_SRC_CODE_GLOW_SETUP, CONST_SRC_CODE_GLOW_SETUP }, + { IW5::CONST_SRC_CODE_GLOW_APPLY, CONST_SRC_CODE_GLOW_APPLY }, + { IW5::CONST_SRC_CODE_COLOR_BIAS, CONST_SRC_CODE_COLOR_BIAS }, + { IW5::CONST_SRC_CODE_COLOR_TINT_BASE, CONST_SRC_CODE_COLOR_TINT_BASE }, + { IW5::CONST_SRC_CODE_COLOR_TINT_DELTA, CONST_SRC_CODE_COLOR_TINT_DELTA }, + { IW5::CONST_SRC_CODE_COLOR_TINT_QUADRATIC_DELTA, CONST_SRC_CODE_COLOR_TINT_QUADRATIC_DELTA }, + { IW5::CONST_SRC_CODE_OUTDOOR_FEATHER_PARMS, CONST_SRC_CODE_OUTDOOR_FEATHER_PARMS }, + { IW5::CONST_SRC_CODE_ENVMAP_PARMS, CONST_SRC_CODE_ENVMAP_PARMS }, + { IW5::CONST_SRC_CODE_SUN_SHADOWMAP_PIXEL_ADJUST, CONST_SRC_CODE_SUN_SHADOWMAP_PIXEL_ADJUST }, + { IW5::CONST_SRC_CODE_SPOT_SHADOWMAP_PIXEL_ADJUST, CONST_SRC_CODE_SPOT_SHADOWMAP_PIXEL_ADJUST }, + { IW5::CONST_SRC_CODE_COMPOSITE_FX_DISTORTION, CONST_SRC_CODE_COMPOSITE_FX_DISTORTION }, + { IW5::CONST_SRC_CODE_POSTFX_FADE_EFFECT, CONST_SRC_CODE_POSTFX_FADE_EFFECT }, + { IW5::CONST_SRC_CODE_VIEWPORT_DIMENSIONS, CONST_SRC_CODE_VIEWPORT_DIMENSIONS }, + { IW5::CONST_SRC_CODE_FRAMEBUFFER_READ, CONST_SRC_CODE_FRAMEBUFFER_READ }, + //{ IW5::CONST_SRC_CODE_THERMAL_COLOR_OFFSET, CONST_SRC_CODE_THERMAL_COLOR_OFFSET }, + //{ IW5::CONST_SRC_CODE_PLAYLIST_POPULATION_PARAMS, CONST_SRC_CODE_PLAYLIST_POPULATION_PARAMS }, + { IW5::CONST_SRC_CODE_BASE_LIGHTING_COORDS, CONST_SRC_CODE_BASE_LIGHTING_COORDS }, + { IW5::CONST_SRC_CODE_LIGHT_PROBE_AMBIENT, CONST_SRC_CODE_LIGHT_PROBE_AMBIENT }, + { IW5::CONST_SRC_CODE_NEARPLANE_ORG, CONST_SRC_CODE_NEARPLANE_ORG }, + { IW5::CONST_SRC_CODE_NEARPLANE_DX, CONST_SRC_CODE_NEARPLANE_DX }, + { IW5::CONST_SRC_CODE_NEARPLANE_DY, CONST_SRC_CODE_NEARPLANE_DY }, + { IW5::CONST_SRC_CODE_CLIP_SPACE_LOOKUP_SCALE, CONST_SRC_CODE_CLIP_SPACE_LOOKUP_SCALE }, + { IW5::CONST_SRC_CODE_CLIP_SPACE_LOOKUP_OFFSET, CONST_SRC_CODE_CLIP_SPACE_LOOKUP_OFFSET }, + { IW5::CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX0, CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX0 }, + { IW5::CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX1, CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX1 }, + { IW5::CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX2, CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX2 }, + { IW5::CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR0, CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR0 }, + { IW5::CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR1, CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR1 }, + { IW5::CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR2, CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR2 }, + { IW5::CONST_SRC_CODE_PARTICLE_FOUNTAIN_PARM0, CONST_SRC_CODE_PARTICLE_FOUNTAIN_PARM0 }, + { IW5::CONST_SRC_CODE_PARTICLE_FOUNTAIN_PARM1, CONST_SRC_CODE_PARTICLE_FOUNTAIN_PARM1 }, + { IW5::CONST_SRC_CODE_DEPTH_FROM_CLIP, CONST_SRC_CODE_DEPTH_FROM_CLIP }, + { IW5::CONST_SRC_CODE_CODE_MESH_ARG_0, CONST_SRC_CODE_CODE_MESH_ARG_0 }, + { IW5::CONST_SRC_CODE_CODE_MESH_ARG_1, CONST_SRC_CODE_CODE_MESH_ARG_1 }, + { IW5::CONST_SRC_CODE_VIEW_MATRIX, CONST_SRC_CODE_VIEW_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_VIEW_MATRIX, CONST_SRC_CODE_INVERSE_VIEW_MATRIX }, + { IW5::CONST_SRC_CODE_TRANSPOSE_VIEW_MATRIX, CONST_SRC_CODE_TRANSPOSE_VIEW_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_VIEW_MATRIX, CONST_SRC_CODE_INVERSE_TRANSPOSE_VIEW_MATRIX }, + { IW5::CONST_SRC_CODE_PROJECTION_MATRIX, CONST_SRC_CODE_PROJECTION_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_PROJECTION_MATRIX, CONST_SRC_CODE_INVERSE_PROJECTION_MATRIX }, + { IW5::CONST_SRC_CODE_TRANSPOSE_PROJECTION_MATRIX, CONST_SRC_CODE_TRANSPOSE_PROJECTION_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_PROJECTION_MATRIX, CONST_SRC_CODE_INVERSE_TRANSPOSE_PROJECTION_MATRIX }, + { IW5::CONST_SRC_CODE_VIEW_PROJECTION_MATRIX, CONST_SRC_CODE_VIEW_PROJECTION_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_VIEW_PROJECTION_MATRIX, CONST_SRC_CODE_INVERSE_VIEW_PROJECTION_MATRIX }, + { IW5::CONST_SRC_CODE_TRANSPOSE_VIEW_PROJECTION_MATRIX, CONST_SRC_CODE_TRANSPOSE_VIEW_PROJECTION_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_VIEW_PROJECTION_MATRIX, CONST_SRC_CODE_INVERSE_TRANSPOSE_VIEW_PROJECTION_MATRIX }, + { IW5::CONST_SRC_CODE_SHADOW_LOOKUP_MATRIX, CONST_SRC_CODE_SHADOW_LOOKUP_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_SHADOW_LOOKUP_MATRIX, CONST_SRC_CODE_INVERSE_SHADOW_LOOKUP_MATRIX }, + { IW5::CONST_SRC_CODE_TRANSPOSE_SHADOW_LOOKUP_MATRIX, CONST_SRC_CODE_TRANSPOSE_SHADOW_LOOKUP_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_SHADOW_LOOKUP_MATRIX, CONST_SRC_CODE_INVERSE_TRANSPOSE_SHADOW_LOOKUP_MATRIX }, + { IW5::CONST_SRC_CODE_WORLD_OUTDOOR_LOOKUP_MATRIX, CONST_SRC_CODE_WORLD_OUTDOOR_LOOKUP_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_OUTDOOR_LOOKUP_MATRIX, CONST_SRC_CODE_INVERSE_WORLD_OUTDOOR_LOOKUP_MATRIX }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX, CONST_SRC_CODE_TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX }, + { IW5::CONST_SRC_CODE_WORLD_MATRIX0, CONST_SRC_CODE_WORLD_MATRIX0 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_MATRIX0, CONST_SRC_CODE_INVERSE_WORLD_MATRIX0 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX0, CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX0 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX0, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX0 }, + { IW5::CONST_SRC_CODE_WORLD_VIEW_MATRIX0, CONST_SRC_CODE_WORLD_VIEW_MATRIX0 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX0, CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX0 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX0, CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX0 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX0, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX0 }, + { IW5::CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX0, CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX0 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX0, CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX0 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0, CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0 }, + { IW5::CONST_SRC_CODE_WORLD_MATRIX1, CONST_SRC_CODE_WORLD_MATRIX1 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_MATRIX1, CONST_SRC_CODE_INVERSE_WORLD_MATRIX1 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX1, CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX1 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX1, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX1 }, + { IW5::CONST_SRC_CODE_WORLD_VIEW_MATRIX1, CONST_SRC_CODE_WORLD_VIEW_MATRIX1 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX1, CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX1 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX1, CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX1 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX1, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX1 }, + { IW5::CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX1, CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX1 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX1, CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX1 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1, CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1 }, + { IW5::CONST_SRC_CODE_WORLD_MATRIX2, CONST_SRC_CODE_WORLD_MATRIX2 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_MATRIX2, CONST_SRC_CODE_INVERSE_WORLD_MATRIX2 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX2, CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX2 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX2, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX2 }, + { IW5::CONST_SRC_CODE_WORLD_VIEW_MATRIX2, CONST_SRC_CODE_WORLD_VIEW_MATRIX2 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX2, CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX2 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX2, CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX2 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX2, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX2 }, + { IW5::CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX2, CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX2 }, + { IW5::CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX2, CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX2 }, + { IW5::CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2, CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2 }, + { IW5::CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2, CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2 }, + { IW5::CONST_SRC_TOTAL_COUNT, CONST_SRC_TOTAL_COUNT }, + { IW5::CONST_SRC_NONE, CONST_SRC_NONE }, + }; + std::unordered_map constant_map_reversed; + MaterialTechniqueSet* ITechset::parse(const std::string& name, ZoneMemory* mem) { const auto iw5_techset = IW5::ITechset::parse(name, mem); @@ -77,17 +223,27 @@ namespace ZoneTool if (argDef->type == 3 || argDef->type == 5) { - if (argDef->u.codeConst.index >= 66) - { - argDef->u.codeConst.index -= 8; - } - else if (argDef->u.codeConst.index >= 37) + const auto itr = constant_map.find(argDef->u.codeConst.index); + if (itr != constant_map.end()) { - argDef->u.codeConst.index -= 6; + argDef->u.codeConst.index = itr->second; } - else if (argDef->u.codeConst.index >= 26) + else { - argDef->u.codeConst.index -= 5; + ZONETOOL_WARNING("code constant %u is not mapped for technique %s!", argDef->u.codeConst.index, technique->hdr.name); + + if (argDef->u.codeConst.index >= 66) + { + argDef->u.codeConst.index -= 8; + } + else if (argDef->u.codeConst.index >= 37) + { + argDef->u.codeConst.index -= 6; + } + else if (argDef->u.codeConst.index >= 26) + { + argDef->u.codeConst.index -= 5; + } } } } @@ -309,6 +465,14 @@ namespace ZoneTool void ITechset::dump(MaterialTechniqueSet* asset) { + if (constant_map_reversed.empty()) + { + for (auto& const_map : constant_map) + { + constant_map_reversed[const_map.second] = const_map.first; + } + } + auto iw5_techset = new IW5::MaterialTechniqueSet; memset(iw5_techset, 0, sizeof IW5::MaterialTechniqueSet); @@ -364,20 +528,30 @@ namespace ZoneTool { arg_def->type++; } - + if (arg_def->type == 4 || arg_def->type == 6) { - if (arg_def->u.codeConst.index >= 58) - { - arg_def->u.codeConst.index += 8; - } - else if (arg_def->u.codeConst.index >= 31) + const auto itr = constant_map_reversed.find(arg_def->u.codeConst.index); + if (itr != constant_map_reversed.end()) { - arg_def->u.codeConst.index += 6; + arg_def->u.codeConst.index = itr->second; } - else if (arg_def->u.codeConst.index >= 21) + else { - arg_def->u.codeConst.index += 5; + ZONETOOL_WARNING("code constant %u is not mapped for technique %s!", arg_def->u.codeConst.index, technique->hdr.name); + + if (arg_def->u.codeConst.index >= 58) + { + arg_def->u.codeConst.index += 8; + } + else if (arg_def->u.codeConst.index >= 31) + { + arg_def->u.codeConst.index += 6; + } + else if (arg_def->u.codeConst.index >= 21) + { + arg_def->u.codeConst.index += 5; + } } } } @@ -385,6 +559,7 @@ namespace ZoneTool } } + // IW5::ITechset::dump_technique_data(iw5_techset, false); IW5::ITechset::dump(iw5_techset); for (int i = 0; i < 54; i++) diff --git a/src/IW4/Assets/WeaponDef.cpp b/src/IW4/Assets/WeaponDef.cpp index 0452266..3f29d52 100644 --- a/src/IW4/Assets/WeaponDef.cpp +++ b/src/IW4/Assets/WeaponDef.cpp @@ -12,18 +12,26 @@ namespace ZoneTool { namespace IW4 - { + { void IWeaponDef::dump(WeaponCompleteDef* weapon) { auto iw5_weapon = new IW5::WeaponCompleteDef; memset(iw5_weapon, 0, sizeof IW5::WeaponCompleteDef); // copy weapon data - memcpy(iw5_weapon->_portpad0, weapon->_portpad0, sizeof weapon->_portpad0); - memcpy(iw5_weapon->_portpad1, weapon->_portpad1, sizeof weapon->_portpad1); - memcpy(iw5_weapon->_portpad2, weapon->_portpad2, sizeof weapon->_portpad2); - memcpy(iw5_weapon->_portpad3, weapon->_portpad3, sizeof weapon->_portpad3); - memcpy(iw5_weapon->_portpad4, weapon->_portpad4, sizeof weapon->_portpad4); + memcpy(iw5_weapon, weapon, 16); + memcpy(&iw5_weapon->fAdsZoomFov, &weapon->fAdsZoomFov, 24); + memcpy(&iw5_weapon->dpadIconRatio, &weapon->dpadIconRatio, 28); + memcpy(&iw5_weapon->killIcon, &weapon->killIcon, 12); + iw5_weapon->fireAnimLength = weapon->fireAnimLength; + iw5_weapon->fireAnimLengthAkimbo = iw5_weapon->fireAnimLength; + iw5_weapon->iFirstRaiseTime = weapon->iFirstRaiseTime; + iw5_weapon->iFirstRaiseTimeAkimbo = iw5_weapon->iFirstRaiseTime; + iw5_weapon->iAltRaiseTime = weapon->iAltRaiseTime; + iw5_weapon->iAltRaiseTimeAkimbo = iw5_weapon->iAltRaiseTime; + iw5_weapon->iFireTime = weapon->iFireTime; + iw5_weapon->iFireTimeAkimbo = iw5_weapon->iFireTime; + memcpy(&iw5_weapon->ammoDropStockMax, &weapon->killIcon, 28); // copy over xanims iw5_weapon->szXAnims = new const char*[42]; @@ -31,27 +39,34 @@ namespace ZoneTool memcpy(iw5_weapon->szXAnims, weapon->szXAnims, sizeof(const char*) * 37); // alloc weapondef - iw5_weapon->WeaponDef = new IW5::WeaponDef; - memset(iw5_weapon->WeaponDef, 0, sizeof WeaponDef); + iw5_weapon->weapDef = new IW5::WeaponDef; + memset(iw5_weapon->weapDef, 0, sizeof WeaponDef); // copy weapondef data - memcpy(iw5_weapon->WeaponDef->_portpad0, weapon->weapDef->_portpad0, sizeof weapon->weapDef->_portpad0); - memcpy(iw5_weapon->WeaponDef->_portpad1, weapon->weapDef->_portpad1, sizeof weapon->weapDef->_portpad1); - memcpy(iw5_weapon->WeaponDef->_portpad2, weapon->weapDef->_portpad2, sizeof weapon->weapDef->_portpad2); - memcpy(iw5_weapon->WeaponDef->_portpad3, weapon->weapDef->_portpad3, sizeof weapon->weapDef->_portpad3); - memcpy(iw5_weapon->WeaponDef->_portpad4, weapon->weapDef->_portpad4, sizeof weapon->weapDef->_portpad4); - memcpy(iw5_weapon->WeaponDef->_portpad5, weapon->weapDef->_portpad5, sizeof weapon->weapDef->_portpad5); - memcpy(iw5_weapon->WeaponDef->_portpad6, weapon->weapDef->_portpad6, sizeof weapon->weapDef->_portpad6); - - iw5_weapon->WeaponDef->sndArray1 = reinterpret_cast(weapon->weapDef->bounceSound); - iw5_weapon->WeaponDef->sndArray2 = reinterpret_cast(weapon->weapDef->bounceSound); + //memcpy(iw5_weapon->WeaponDef->_portpad0, weapon->weapDef->_portpad0, sizeof weapon->weapDef->_portpad0); + //memcpy(iw5_weapon->WeaponDef->_portpad1, weapon->weapDef->_portpad1, sizeof weapon->weapDef->_portpad1); + //memcpy(iw5_weapon->WeaponDef->_portpad2, weapon->weapDef->_portpad2, sizeof weapon->weapDef->_portpad2); + //memcpy(iw5_weapon->WeaponDef->_portpad3, weapon->weapDef->_portpad3, sizeof weapon->weapDef->_portpad3); + //memcpy(iw5_weapon->WeaponDef->_portpad4, weapon->weapDef->_portpad4, sizeof weapon->weapDef->_portpad4); + //memcpy(iw5_weapon->WeaponDef->_portpad5, weapon->weapDef->_portpad5, sizeof weapon->weapDef->_portpad5); + //memcpy(iw5_weapon->WeaponDef->_portpad6, weapon->weapDef->_portpad6, sizeof weapon->weapDef->_portpad6); + iw5_weapon->weapDef->bounceSound = reinterpret_cast(weapon->weapDef->bounceSound); + iw5_weapon->weapDef->rollingSound = nullptr; + // fixup weapon name - iw5_weapon->name = _strdup(va("iw5_%s", weapon->szInternalName).data()); - iw5_weapon->WeaponDef->szInternalName = _strdup(va("iw5_%s", weapon->szInternalName).data()); + iw5_weapon->szInternalName = _strdup(va("iw5_%s", weapon->szInternalName).data()); + iw5_weapon->weapDef->szOverlayName = _strdup(va("iw5_%s", weapon->szInternalName).data()); // dump iw5 weapon file IW5::IWeaponDef::dump(iw5_weapon, SL_ConvertToString); + + // free memory + free((void*)iw5_weapon->szInternalName); + free((void*)iw5_weapon->weapDef->szOverlayName); + delete[] iw5_weapon->weapDef; + delete[] iw5_weapon->szXAnims; + delete iw5_weapon; } } } diff --git a/src/IW4/IW4.cpp b/src/IW4/IW4.cpp index c425b63..b6d2918 100644 --- a/src/IW4/IW4.cpp +++ b/src/IW4/IW4.cpp @@ -287,6 +287,7 @@ char**>(0x00799278)[type]); DECLARE_ASSET(fx, IFxEffectDef); DECLARE_ASSET(lightdef, ILightDef); DECLARE_ASSET(weapon, IWeaponDef); + DECLARE_ASSET(addon_map_ents, IAddonMapEnts); } } } diff --git a/src/IW4/Structs.hpp b/src/IW4/Structs.hpp index 88ed6e6..28fdb28 100644 --- a/src/IW4/Structs.hpp +++ b/src/IW4/Structs.hpp @@ -899,572 +899,461 @@ namespace ZoneTool struct WeaponDef { - union - { - struct - { - const char* szOverlayName; - XModel** gunXModel; - XModel* handXModel; - const char** szXAnimsRightHanded; - const char** szXAnimsLeftHanded; - const char* szModeName; - unsigned __int16* notetrackSoundMapKeys; - unsigned __int16* notetrackSoundMapValues; - unsigned __int16* notetrackRumbleMapKeys; - unsigned __int16* notetrackRumbleMapValues; - int playerAnimType; - weapType_t weapType; - weapClass_t weapClass; - PenetrateType penetrateType; - weapInventoryType_t inventoryType; - weapFireType_t fireType; - OffhandClass offhandClass; - weapStance_t stance; - void* viewFlashEffect; // FxEffectDef - void* worldFlashEffect; // FxEffectDef - snd_alias_list_t* pickupSound; - snd_alias_list_t* pickupSoundPlayer; - snd_alias_list_t* ammoPickupSound; - snd_alias_list_t* ammoPickupSoundPlayer; - snd_alias_list_t* projectileSound; - snd_alias_list_t* pullbackSound; - snd_alias_list_t* pullbackSoundPlayer; - snd_alias_list_t* fireSound; - snd_alias_list_t* fireSoundPlayer; - snd_alias_list_t* fireSoundPlayerAkimbo; - snd_alias_list_t* fireLoopSound; - snd_alias_list_t* fireLoopSoundPlayer; - snd_alias_list_t* fireStopSound; - snd_alias_list_t* fireStopSoundPlayer; - snd_alias_list_t* fireLastSound; - snd_alias_list_t* fireLastSoundPlayer; - snd_alias_list_t* emptyFireSound; - snd_alias_list_t* emptyFireSoundPlayer; - snd_alias_list_t* meleeSwipeSound; - snd_alias_list_t* meleeSwipeSoundPlayer; - snd_alias_list_t* meleeHitSound; - snd_alias_list_t* meleeMissSound; - snd_alias_list_t* rechamberSound; - snd_alias_list_t* rechamberSoundPlayer; - snd_alias_list_t* reloadSound; - snd_alias_list_t* reloadSoundPlayer; - snd_alias_list_t* reloadEmptySound; - snd_alias_list_t* reloadEmptySoundPlayer; - snd_alias_list_t* reloadStartSound; - snd_alias_list_t* reloadStartSoundPlayer; - snd_alias_list_t* reloadEndSound; - snd_alias_list_t* reloadEndSoundPlayer; - snd_alias_list_t* detonateSound; - snd_alias_list_t* detonateSoundPlayer; - snd_alias_list_t* nightVisionWearSound; - snd_alias_list_t* nightVisionWearSoundPlayer; - snd_alias_list_t* nightVisionRemoveSound; - snd_alias_list_t* nightVisionRemoveSoundPlayer; - snd_alias_list_t* altSwitchSound; - snd_alias_list_t* altSwitchSoundPlayer; - snd_alias_list_t* raiseSound; - snd_alias_list_t* raiseSoundPlayer; - snd_alias_list_t* firstRaiseSound; - snd_alias_list_t* firstRaiseSoundPlayer; - snd_alias_list_t* putawaySound; - snd_alias_list_t* putawaySoundPlayer; - snd_alias_list_t* scanSound; - }; - - char _portpad0[268]; - }; - + const char* szOverlayName; + XModel** gunXModel; + XModel* handXModel; + const char** szXAnimsRightHanded; + const char** szXAnimsLeftHanded; + const char* szModeName; + unsigned __int16* notetrackSoundMapKeys; + unsigned __int16* notetrackSoundMapValues; + unsigned __int16* notetrackRumbleMapKeys; + unsigned __int16* notetrackRumbleMapValues; + int playerAnimType; + weapType_t weapType; + weapClass_t weapClass; + PenetrateType penetrateType; + weapInventoryType_t inventoryType; + weapFireType_t fireType; + OffhandClass offhandClass; + weapStance_t stance; + void* viewFlashEffect; + void* worldFlashEffect; + snd_alias_list_t* pickupSound; + snd_alias_list_t* pickupSoundPlayer; + snd_alias_list_t* ammoPickupSound; + snd_alias_list_t* ammoPickupSoundPlayer; + snd_alias_list_t* projectileSound; + snd_alias_list_t* pullbackSound; + snd_alias_list_t* pullbackSoundPlayer; + snd_alias_list_t* fireSound; + snd_alias_list_t* fireSoundPlayer; + snd_alias_list_t* fireSoundPlayerAkimbo; + snd_alias_list_t* fireLoopSound; + snd_alias_list_t* fireLoopSoundPlayer; + snd_alias_list_t* fireStopSound; + snd_alias_list_t* fireStopSoundPlayer; + snd_alias_list_t* fireLastSound; + snd_alias_list_t* fireLastSoundPlayer; + snd_alias_list_t* emptyFireSound; + snd_alias_list_t* emptyFireSoundPlayer; + snd_alias_list_t* meleeSwipeSound; + snd_alias_list_t* meleeSwipeSoundPlayer; + snd_alias_list_t* meleeHitSound; + snd_alias_list_t* meleeMissSound; + snd_alias_list_t* rechamberSound; + snd_alias_list_t* rechamberSoundPlayer; + snd_alias_list_t* reloadSound; + snd_alias_list_t* reloadSoundPlayer; + snd_alias_list_t* reloadEmptySound; + snd_alias_list_t* reloadEmptySoundPlayer; + snd_alias_list_t* reloadStartSound; + snd_alias_list_t* reloadStartSoundPlayer; + snd_alias_list_t* reloadEndSound; + snd_alias_list_t* reloadEndSoundPlayer; + snd_alias_list_t* detonateSound; + snd_alias_list_t* detonateSoundPlayer; + snd_alias_list_t* nightVisionWearSound; + snd_alias_list_t* nightVisionWearSoundPlayer; + snd_alias_list_t* nightVisionRemoveSound; + snd_alias_list_t* nightVisionRemoveSoundPlayer; + snd_alias_list_t* altSwitchSound; + snd_alias_list_t* altSwitchSoundPlayer; + snd_alias_list_t* raiseSound; + snd_alias_list_t* raiseSoundPlayer; + snd_alias_list_t* firstRaiseSound; + snd_alias_list_t* firstRaiseSoundPlayer; + snd_alias_list_t* putawaySound; + snd_alias_list_t* putawaySoundPlayer; + snd_alias_list_t* scanSound; snd_alias_list_t** bounceSound; - - union - { - struct - { - void* viewShellEjectEffect; - void* worldShellEjectEffect; - void* viewLastShotEjectEffect; - void* worldLastShotEjectEffect; - Material* reticleCenter; - Material* reticleSide; - int iReticleCenterSize; - int iReticleSideSize; - int iReticleMinOfs; - activeReticleType_t activeReticleType; - float vStandMove[3]; - float vStandRot[3]; - float strafeMove[3]; - float strafeRot[3]; - float vDuckedOfs[3]; - float vDuckedMove[3]; - float vDuckedRot[3]; - float vProneOfs[3]; - float vProneMove[3]; - float vProneRot[3]; - float fPosMoveRate; - float fPosProneMoveRate; - float fStandMoveMinSpeed; - float fDuckedMoveMinSpeed; - float fProneMoveMinSpeed; - float fPosRotRate; - float fPosProneRotRate; - float fStandRotMinSpeed; - float fDuckedRotMinSpeed; - float fProneRotMinSpeed; - XModel** worldModel; - XModel* worldClipModel; - XModel* rocketModel; - XModel* knifeModel; - XModel* worldKnifeModel; - Material* hudIcon; - weaponIconRatioType_t hudIconRatio; - Material* pickupIcon; - weaponIconRatioType_t pickupIconRatio; - Material* ammoCounterIcon; - weaponIconRatioType_t ammoCounterIconRatio; - ammoCounterClipType_t ammoCounterClip; - int iStartAmmo; - const char* szAmmoName; - int iAmmoIndex; - const char* szClipName; - int iClipIndex; - int iMaxAmmo; - int shotCount; - const char* szSharedAmmoCapName; - int iSharedAmmoCapIndex; - int iSharedAmmoCap; - int damage; - int playerDamage; - int iMeleeDamage; - int iDamageType; - int iFireDelay; - int iMeleeDelay; - int meleeChargeDelay; - int iDetonateDelay; - int iRechamberTime; - int rechamberTimeOneHanded; - int iRechamberBoltTime; - int iHoldFireTime; - int iDetonateTime; - int iMeleeTime; - int meleeChargeTime; - int iReloadTime; - int reloadShowRocketTime; - int iReloadEmptyTime; - int iReloadAddTime; - int iReloadStartTime; - int iReloadStartAddTime; - int iReloadEndTime; - int iDropTime; - int iRaiseTime; - int iAltDropTime; - int quickDropTime; - int quickRaiseTime; - int iBreachRaiseTime; - int iEmptyRaiseTime; - int iEmptyDropTime; - int sprintInTime; - int sprintLoopTime; - int sprintOutTime; - int stunnedTimeBegin; - int stunnedTimeLoop; - int stunnedTimeEnd; - int nightVisionWearTime; - int nightVisionWearTimeFadeOutEnd; - int nightVisionWearTimePowerUp; - int nightVisionRemoveTime; - int nightVisionRemoveTimePowerDown; - int nightVisionRemoveTimeFadeInStart; - int fuseTime; - int aiFuseTime; - }; - - char _portpad1[464]; - }; - - union - { - struct - { - float autoAimRange; - float aimAssistRange; - float aimAssistRangeAds; - float aimPadding; - float enemyCrosshairRange; - float moveSpeedScale; - float adsMoveSpeedScale; - float sprintDurationScale; - float fAdsZoomInFrac; - float fAdsZoomOutFrac; - Material* overlayMaterial; - Material* overlayMaterialLowRes; - Material* overlayMaterialEMP; - Material* overlayMaterialEMPLowRes; - weapOverlayReticle_t overlayReticle; - int overlayInterface; - float overlayWidth; - float overlayHeight; - float overlayWidthSplitscreen; - float overlayHeightSplitscreen; - float fAdsBobFactor; - float fAdsViewBobMult; - float fHipSpreadStandMin; - float fHipSpreadDuckedMin; - float fHipSpreadProneMin; - float hipSpreadStandMax; - float hipSpreadDuckedMax; - float hipSpreadProneMax; - float fHipSpreadDecayRate; - float fHipSpreadFireAdd; - float fHipSpreadTurnAdd; - float fHipSpreadMoveAdd; - float fHipSpreadDuckedDecay; - float fHipSpreadProneDecay; - float fHipReticleSidePos; - float fAdsIdleAmount; - float fHipIdleAmount; - }; - - char _portpad6[148]; - }; - - union - { - struct - { - float adsIdleSpeed; - float hipIdleSpeed; - float fIdleCrouchFactor; - float fIdleProneFactor; - float fGunMaxPitch; - float fGunMaxYaw; - float swayMaxAngle; - float swayLerpSpeed; - float swayPitchScale; - float swayYawScale; - float swayHorizScale; - float swayVertScale; - float swayShellShockScale; - float adsSwayMaxAngle; - float adsSwayLerpSpeed; - float adsSwayPitchScale; - float adsSwayYawScale; - float adsSwayHorizScale; - float adsSwayVertScale; - float adsViewErrorMin; - float adsViewErrorMax; - }; - - char _portpad2[84]; - }; - - union - { - struct - { - PhysCollmap* physCollmap; - float dualWieldViewModelOffset; - weaponIconRatioType_t killIconRatio; - int iReloadAmmoAdd; - int iReloadStartAdd; - int ammoDropStockMin; - int ammoDropClipPercentMin; - int ammoDropClipPercentMax; - int iExplosionRadius; - int iExplosionRadiusMin; - int iExplosionInnerDamage; - int iExplosionOuterDamage; - float damageConeAngle; - float bulletExplDmgMult; - float bulletExplRadiusMult; - int iProjectileSpeed; - int iProjectileSpeedUp; - int iProjectileSpeedForward; - int iProjectileActivateDist; - float projLifetime; - float timeToAccelerate; - float projectileCurvature; - XModel* projectileModel; - int projExplosion; - void* projExplosionEffect; - void* projDudEffect; - snd_alias_list_t* projExplosionSound; - snd_alias_list_t* projDudSound; - WeapStickinessType stickiness; - float lowAmmoWarningThreshold; - float ricochetChance; - float* parallelBounce; - float* perpendicularBounce; - }; - - char _portpad3[132]; - }; - - union - { - struct - { - void* projTrailEffect; - void* projBeaconEffect; - float vProjectileColor[3]; - guidedMissileType_t guidedMissileType; - float maxSteeringAccel; - int projIgnitionDelay; - void* projIgnitionEffect; - snd_alias_list_t* projIgnitionSound; - float fAdsAimPitch; - float fAdsCrosshairInFrac; - float fAdsCrosshairOutFrac; - int adsGunKickReducedKickBullets; - float adsGunKickReducedKickPercent; - float fAdsGunKickPitchMin; - float fAdsGunKickPitchMax; - float fAdsGunKickYawMin; - float fAdsGunKickYawMax; - float fAdsGunKickAccel; - float fAdsGunKickSpeedMax; - float fAdsGunKickSpeedDecay; - float fAdsGunKickStaticDecay; - float fAdsViewKickPitchMin; - float fAdsViewKickPitchMax; - float fAdsViewKickYawMin; - float fAdsViewKickYawMax; - float fAdsViewScatterMin; - float fAdsViewScatterMax; - float fAdsSpread; - int hipGunKickReducedKickBullets; - float hipGunKickReducedKickPercent; - float fHipGunKickPitchMin; - float fHipGunKickPitchMax; - float fHipGunKickYawMin; - float fHipGunKickYawMax; - float fHipGunKickAccel; - float fHipGunKickSpeedMax; - float fHipGunKickSpeedDecay; - float fHipGunKickStaticDecay; - float fHipViewKickPitchMin; - float fHipViewKickPitchMax; - float fHipViewKickYawMin; - float fHipViewKickYawMax; - float fHipViewScatterMin; - float fHipViewScatterMax; - float fightDist; - float maxDist; - const char* accuracyGraphName[2]; - float (*originalAccuracyGraphKnots[2])[2]; - unsigned __int16 originalAccuracyGraphKnotCount[2]; - int iPositionReloadTransTime; - float leftArc; - float rightArc; - float topArc; - float bottomArc; - float accuracy; - float aiSpread; - float playerSpread; - float minTurnSpeed[2]; - float maxTurnSpeed[2]; - float pitchConvergenceTime; - float yawConvergenceTime; - float suppressTime; - float maxRange; - float fAnimHorRotateInc; - float fPlayerPositionDist; - const char* szUseHintString; - const char* dropHintString; - int iUseHintStringIndex; - int dropHintStringIndex; - float horizViewJitter; - float vertViewJitter; - float scanSpeed; - float scanAccel; - int scanPauseTime; - const char* szScript; - float fOOPosAnimLength[2]; - int minDamage; - int minPlayerDamage; - float fMaxDamageRange; - float fMinDamageRange; - float destabilizationRateTime; - float destabilizationCurvatureMax; - int destabilizeDistance; - float* locationDamageMultipliers; - const char* fireRumble; - const char* meleeImpactRumble; - TracerDef* tracerType; - float turretScopeZoomRate; - float turretScopeZoomMin; - float turretScopeZoomMax; - float turretOverheatUpRate; - float turretOverheatDownRate; - float turretOverheatPenalty; - }; - - char _portpad4[400]; - }; - - union - { - struct - { - snd_alias_list_t* turretOverheatSound; - void* turretOverheatEffect; - const char* turretBarrelSpinRumble; - float turretBarrelSpinSpeed; - float turretBarrelSpinUpTime; - float turretBarrelSpinDownTime; - snd_alias_list_t* turretBarrelSpinMaxSnd; - snd_alias_list_t* turretBarrelSpinUpSnd[4]; - snd_alias_list_t* turretBarrelSpinDownSnd[4]; - snd_alias_list_t* missileConeSoundAlias; - snd_alias_list_t* missileConeSoundAliasAtBase; - float missileConeSoundRadiusAtTop; - float missileConeSoundRadiusAtBase; - float missileConeSoundHeight; - float missileConeSoundOriginOffset; - float missileConeSoundVolumescaleAtCore; - float missileConeSoundVolumescaleAtEdge; - float missileConeSoundVolumescaleCoreSize; - float missileConeSoundPitchAtTop; - float missileConeSoundPitchAtBottom; - float missileConeSoundPitchTopSize; - float missileConeSoundPitchBottomSize; - float missileConeSoundCrossfadeTopSize; - float missileConeSoundCrossfadeBottomSize; - bool sharedAmmo; - bool lockonSupported; - bool requireLockonToFire; - bool bigExplosion; - bool noAdsWhenMagEmpty; - bool avoidDropCleanup; - bool inheritsPerks; - bool crosshairColorChange; - bool bRifleBullet; - bool armorPiercing; - bool bBoltAction; - bool aimDownSight; - bool bRechamberWhileAds; - bool bBulletExplosiveDamage; - bool bCookOffHold; - bool bClipOnly; - bool noAmmoPickup; - bool adsFireOnly; - bool cancelAutoHolsterWhenEmpty; - bool disableSwitchToWhenEmpty; - bool suppressAmmoReserveDisplay; - bool laserSightDuringNightvision; - bool markableViewmodel; - bool noDualWield; - bool flipKillIcon; - bool bNoPartialReload; - bool bSegmentedReload; - bool blocksProne; - bool silenced; - bool isRollingGrenade; - bool projExplosionEffectForceNormalUp; - bool bProjImpactExplode; - bool stickToPlayers; - bool hasDetonator; - bool disableFiring; - bool timedDetonation; - bool rotate; - bool holdButtonToThrow; - bool freezeMovementWhenFiring; - bool thermalScope; - bool altModeSameWeapon; - bool turretBarrelSpinEnabled; - bool missileConeSoundEnabled; - bool missileConeSoundPitchshiftEnabled; - bool missileConeSoundCrossfadeEnabled; - bool offhandHoldIsCancelable; - - void test() - { - sizeof(*this); - } - }; - - char _portpad5[168]; - }; + void* viewShellEjectEffect; + void* worldShellEjectEffect; + void* viewLastShotEjectEffect; + void* worldLastShotEjectEffect; + Material* reticleCenter; + Material* reticleSide; + int iReticleCenterSize; + int iReticleSideSize; + int iReticleMinOfs; + activeReticleType_t activeReticleType; + float vStandMove[3]; + float vStandRot[3]; + float strafeMove[3]; + float strafeRot[3]; + float vDuckedOfs[3]; + float vDuckedMove[3]; + float vDuckedRot[3]; + float vProneOfs[3]; + float vProneMove[3]; + float vProneRot[3]; + float fPosMoveRate; + float fPosProneMoveRate; + float fStandMoveMinSpeed; + float fDuckedMoveMinSpeed; + float fProneMoveMinSpeed; + float fPosRotRate; + float fPosProneRotRate; + float fStandRotMinSpeed; + float fDuckedRotMinSpeed; + float fProneRotMinSpeed; + XModel** worldModel; + XModel* worldClipModel; + XModel* rocketModel; + XModel* knifeModel; + XModel* worldKnifeModel; + Material* hudIcon; + weaponIconRatioType_t hudIconRatio; + Material* pickupIcon; + weaponIconRatioType_t pickupIconRatio; + Material* ammoCounterIcon; + weaponIconRatioType_t ammoCounterIconRatio; + ammoCounterClipType_t ammoCounterClip; + int iStartAmmo; + const char* szAmmoName; + int iAmmoIndex; + const char* szClipName; + int iClipIndex; + int iMaxAmmo; + int shotCount; + const char* szSharedAmmoCapName; + int iSharedAmmoCapIndex; + int iSharedAmmoCap; + int damage; + int playerDamage; + int iMeleeDamage; + int iDamageType; + int iFireDelay; + int iMeleeDelay; + int meleeChargeDelay; + int iDetonateDelay; + int iRechamberTime; + int rechamberTimeOneHanded; + int iRechamberBoltTime; + int iHoldFireTime; + int iDetonateTime; + int iMeleeTime; + int meleeChargeTime; + int iReloadTime; + int reloadShowRocketTime; + int iReloadEmptyTime; + int iReloadAddTime; + int iReloadStartTime; + int iReloadStartAddTime; + int iReloadEndTime; + int iDropTime; + int iRaiseTime; + int iAltDropTime; + int quickDropTime; + int quickRaiseTime; + int iBreachRaiseTime; + int iEmptyRaiseTime; + int iEmptyDropTime; + int sprintInTime; + int sprintLoopTime; + int sprintOutTime; + int stunnedTimeBegin; + int stunnedTimeLoop; + int stunnedTimeEnd; + int nightVisionWearTime; + int nightVisionWearTimeFadeOutEnd; + int nightVisionWearTimePowerUp; + int nightVisionRemoveTime; + int nightVisionRemoveTimePowerDown; + int nightVisionRemoveTimeFadeInStart; + int fuseTime; + int aiFuseTime; + float autoAimRange; + float aimAssistRange; + float aimAssistRangeAds; + float aimPadding; + float enemyCrosshairRange; + float moveSpeedScale; + float adsMoveSpeedScale; + float sprintDurationScale; + float fAdsZoomInFrac; + float fAdsZoomOutFrac; + Material* overlayMaterial; + Material* overlayMaterialLowRes; + Material* overlayMaterialEMP; + Material* overlayMaterialEMPLowRes; + weapOverlayReticle_t overlayReticle; + int overlayInterface; + float overlayWidth; + float overlayHeight; + float overlayWidthSplitscreen; + float overlayHeightSplitscreen; + float fAdsBobFactor; + float fAdsViewBobMult; + float fHipSpreadStandMin; + float fHipSpreadDuckedMin; + float fHipSpreadProneMin; + float hipSpreadStandMax; + float hipSpreadDuckedMax; + float hipSpreadProneMax; + float fHipSpreadDecayRate; + float fHipSpreadFireAdd; + float fHipSpreadTurnAdd; + float fHipSpreadMoveAdd; + float fHipSpreadDuckedDecay; + float fHipSpreadProneDecay; + float fHipReticleSidePos; + float fAdsIdleAmount; + float fHipIdleAmount; + float adsIdleSpeed; + float hipIdleSpeed; + float fIdleCrouchFactor; + float fIdleProneFactor; + float fGunMaxPitch; + float fGunMaxYaw; + float swayMaxAngle; + float swayLerpSpeed; + float swayPitchScale; + float swayYawScale; + float swayHorizScale; + float swayVertScale; + float swayShellShockScale; + float adsSwayMaxAngle; + float adsSwayLerpSpeed; + float adsSwayPitchScale; + float adsSwayYawScale; + float adsSwayHorizScale; + float adsSwayVertScale; + float adsViewErrorMin; + float adsViewErrorMax; + PhysCollmap* physCollmap; + float dualWieldViewModelOffset; + weaponIconRatioType_t killIconRatio; + int iReloadAmmoAdd; + int iReloadStartAdd; + int ammoDropStockMin; + int ammoDropClipPercentMin; + int ammoDropClipPercentMax; + int iExplosionRadius; + int iExplosionRadiusMin; + int iExplosionInnerDamage; + int iExplosionOuterDamage; + float damageConeAngle; + float bulletExplDmgMult; + float bulletExplRadiusMult; + int iProjectileSpeed; + int iProjectileSpeedUp; + int iProjectileSpeedForward; + int iProjectileActivateDist; + float projLifetime; + float timeToAccelerate; + float projectileCurvature; + XModel* projectileModel; + int projExplosion; + void* projExplosionEffect; + void* projDudEffect; + snd_alias_list_t* projExplosionSound; + snd_alias_list_t* projDudSound; + WeapStickinessType stickiness; + float lowAmmoWarningThreshold; + float ricochetChance; + float* parallelBounce; + float* perpendicularBounce; + void* projTrailEffect; + void* projBeaconEffect; + float vProjectileColor[3]; + guidedMissileType_t guidedMissileType; + float maxSteeringAccel; + int projIgnitionDelay; + void* projIgnitionEffect; + snd_alias_list_t* projIgnitionSound; + float fAdsAimPitch; + float fAdsCrosshairInFrac; + float fAdsCrosshairOutFrac; + int adsGunKickReducedKickBullets; + float adsGunKickReducedKickPercent; + float fAdsGunKickPitchMin; + float fAdsGunKickPitchMax; + float fAdsGunKickYawMin; + float fAdsGunKickYawMax; + float fAdsGunKickAccel; + float fAdsGunKickSpeedMax; + float fAdsGunKickSpeedDecay; + float fAdsGunKickStaticDecay; + float fAdsViewKickPitchMin; + float fAdsViewKickPitchMax; + float fAdsViewKickYawMin; + float fAdsViewKickYawMax; + float fAdsViewScatterMin; + float fAdsViewScatterMax; + float fAdsSpread; + int hipGunKickReducedKickBullets; + float hipGunKickReducedKickPercent; + float fHipGunKickPitchMin; + float fHipGunKickPitchMax; + float fHipGunKickYawMin; + float fHipGunKickYawMax; + float fHipGunKickAccel; + float fHipGunKickSpeedMax; + float fHipGunKickSpeedDecay; + float fHipGunKickStaticDecay; + float fHipViewKickPitchMin; + float fHipViewKickPitchMax; + float fHipViewKickYawMin; + float fHipViewKickYawMax; + float fHipViewScatterMin; + float fHipViewScatterMax; + float fightDist; + float maxDist; + const char* accuracyGraphName[2]; + float(*originalAccuracyGraphKnots[2])[2]; + unsigned __int16 originalAccuracyGraphKnotCount[2]; + int iPositionReloadTransTime; + float leftArc; + float rightArc; + float topArc; + float bottomArc; + float accuracy; + float aiSpread; + float playerSpread; + float minTurnSpeed[2]; + float maxTurnSpeed[2]; + float pitchConvergenceTime; + float yawConvergenceTime; + float suppressTime; + float maxRange; + float fAnimHorRotateInc; + float fPlayerPositionDist; + const char* szUseHintString; + const char* dropHintString; + int iUseHintStringIndex; + int dropHintStringIndex; + float horizViewJitter; + float vertViewJitter; + float scanSpeed; + float scanAccel; + int scanPauseTime; + const char* szScript; + float fOOPosAnimLength[2]; + int minDamage; + int minPlayerDamage; + float fMaxDamageRange; + float fMinDamageRange; + float destabilizationRateTime; + float destabilizationCurvatureMax; + int destabilizeDistance; + float* locationDamageMultipliers; + const char* fireRumble; + const char* meleeImpactRumble; + TracerDef* tracerType; + float turretScopeZoomRate; + float turretScopeZoomMin; + float turretScopeZoomMax; + float turretOverheatUpRate; + float turretOverheatDownRate; + float turretOverheatPenalty; + snd_alias_list_t* turretOverheatSound; + void* turretOverheatEffect; + const char* turretBarrelSpinRumble; + float turretBarrelSpinSpeed; + float turretBarrelSpinUpTime; + float turretBarrelSpinDownTime; + snd_alias_list_t* turretBarrelSpinMaxSnd; + snd_alias_list_t* turretBarrelSpinUpSnd[4]; + snd_alias_list_t* turretBarrelSpinDownSnd[4]; + snd_alias_list_t* missileConeSoundAlias; + snd_alias_list_t* missileConeSoundAliasAtBase; + float missileConeSoundRadiusAtTop; + float missileConeSoundRadiusAtBase; + float missileConeSoundHeight; + float missileConeSoundOriginOffset; + float missileConeSoundVolumescaleAtCore; + float missileConeSoundVolumescaleAtEdge; + float missileConeSoundVolumescaleCoreSize; + float missileConeSoundPitchAtTop; + float missileConeSoundPitchAtBottom; + float missileConeSoundPitchTopSize; + float missileConeSoundPitchBottomSize; + float missileConeSoundCrossfadeTopSize; + float missileConeSoundCrossfadeBottomSize; + bool sharedAmmo; + bool lockonSupported; + bool requireLockonToFire; + bool bigExplosion; + bool noAdsWhenMagEmpty; + bool avoidDropCleanup; + bool inheritsPerks; + bool crosshairColorChange; + bool bRifleBullet; + bool armorPiercing; + bool bBoltAction; + bool aimDownSight; + bool bRechamberWhileAds; + bool bBulletExplosiveDamage; + bool bCookOffHold; + bool bClipOnly; + bool noAmmoPickup; + bool adsFireOnly; + bool cancelAutoHolsterWhenEmpty; + bool disableSwitchToWhenEmpty; + bool suppressAmmoReserveDisplay; + bool laserSightDuringNightvision; + bool markableViewmodel; + bool noDualWield; + bool flipKillIcon; + bool bNoPartialReload; + bool bSegmentedReload; + bool blocksProne; + bool silenced; + bool isRollingGrenade; + bool projExplosionEffectForceNormalUp; + bool bProjImpactExplode; + bool stickToPlayers; + bool hasDetonator; + bool disableFiring; + bool timedDetonation; + bool rotate; + bool holdButtonToThrow; + bool freezeMovementWhenFiring; + bool thermalScope; + bool altModeSameWeapon; + bool turretBarrelSpinEnabled; + bool missileConeSoundEnabled; + bool missileConeSoundPitchshiftEnabled; + bool missileConeSoundCrossfadeEnabled; + bool offhandHoldIsCancelable; }; +#pragma pack(push, 4) struct WeaponCompleteDef { - union - { - struct - { - const char* szInternalName; - WeaponDef* weapDef; - const char* szDisplayName; - unsigned __int16* hideTags; - }; - - char _portpad0[16]; - }; - + const char* szInternalName; + WeaponDef* weapDef; + const char* szDisplayName; + unsigned __int16* hideTags; const char** szXAnims; - - union - { - struct - { - float fAdsZoomFov; - int iAdsTransInTime; - int iAdsTransOutTime; - int iClipSize; - ImpactType impactType; - int iFireTime; - }; - - char _portpad1[24]; - }; - - union - { - struct - { - weaponIconRatioType_t dpadIconRatio; - float penetrateMultiplier; - float fAdsViewKickCenterSpeed; - float fHipViewKickCenterSpeed; - const char* szAltWeaponName; - unsigned int altWeaponIndex; - int iAltRaiseTime; - }; - - char _portpad2[28]; - }; - - union - { - struct - { - Material* killIcon; - Material* dpadIcon; - int fireAnimLength; - int iFirstRaiseTime; - }; - - char _portpad3[16]; - }; - - union - { - struct - { - int ammoDropStockMax; - float adsDofStart; - float adsDofEnd; - unsigned __int16 accuracyGraphKnotCount[2]; - float (*accuracyGraphKnots[2])[2]; - bool motionTracker; - bool enhanced; - bool dpadIconShowsAmmo; - }; - - char _portpad4[28]; - }; + float fAdsZoomFov; + int iAdsTransInTime; + int iAdsTransOutTime; + int iClipSize; + ImpactType impactType; + int iFireTime; + weaponIconRatioType_t dpadIconRatio; + float penetrateMultiplier; + float fAdsViewKickCenterSpeed; + float fHipViewKickCenterSpeed; + const char* szAltWeaponName; + unsigned int altWeaponIndex; + int iAltRaiseTime; + Material* killIcon; + Material* dpadIcon; + int fireAnimLength; + int iFirstRaiseTime; + int ammoDropStockMax; + float adsDofStart; + float adsDofEnd; + unsigned __int16 accuracyGraphKnotCount[2]; + float(*accuracyGraphKnots[2])[2]; + bool motionTracker; + bool enhanced; + bool dpadIconShowsAmmo; }; +#pragma pack(pop) struct Glyph { @@ -3147,6 +3036,14 @@ namespace ZoneTool StructuredDataDef* defs; }; + struct AddonMapEnts + { + const char* name; + char* entityString; + int numEntityChars; + MapTriggers trigger; + }; + union XAssetHeader { RawFile* rawfile; @@ -3192,6 +3089,7 @@ namespace ZoneTool LoadedSound* loaded_sound; StructuredDataDefSet* structureddatadef; GfxLightDef* lightdef; + AddonMapEnts* addon_map_ents; void* data; }; diff --git a/src/IW4/Zone.cpp b/src/IW4/Zone.cpp index e7a9841..6519905 100644 --- a/src/IW4/Zone.cpp +++ b/src/IW4/Zone.cpp @@ -125,6 +125,7 @@ namespace ZoneTool DECLARE_ASSET(fx, IFxEffectDef); DECLARE_ASSET(lightdef, ILightDef); DECLARE_ASSET(structureddatadef, IStructuredDataDef); + DECLARE_ASSET(addon_map_ents, IAddonMapEnts); #ifdef USE_VMPROTECT VMProtectEnd(); diff --git a/src/IW4/Zone.hpp b/src/IW4/Zone.hpp index 24fe9f4..f85962f 100644 --- a/src/IW4/Zone.hpp +++ b/src/IW4/Zone.hpp @@ -40,6 +40,7 @@ extern std::string currentzone; #include "Assets/FxEffectDef.hpp" #include "Assets/LightDef.hpp" #include "Assets/StructuredDataDef.hpp" +#include "Assets/AddonMapEnts.hpp" namespace ZoneTool { diff --git a/src/IW5/Assets/ClipMap.cpp b/src/IW5/Assets/ClipMap.cpp index 00d1954..8743824 100644 --- a/src/IW5/Assets/ClipMap.cpp +++ b/src/IW5/Assets/ClipMap.cpp @@ -278,6 +278,7 @@ colmap->dynEntDefList[_num1][_num2]._item = newEntDef[_num2]._item; // copy info into pInfo colmap->pInfo = &colmap->info; + /*colmap->pInfo = mem->Alloc(); memcpy(colmap->pInfo, &colmap->info, sizeof ClipInfo);*/ diff --git a/src/IW5/Assets/MapEnts.cpp b/src/IW5/Assets/MapEnts.cpp index 6609ddf..4264b5e 100644 --- a/src/IW5/Assets/MapEnts.cpp +++ b/src/IW5/Assets/MapEnts.cpp @@ -64,30 +64,6 @@ namespace ZoneTool triggerReader.close(); } - //file = FileSystem::FileOpen(name + ".ents.triggers", "rb"); - - //ents->trigger.hullCount = freadint(file); - //ents->trigger.modelCount = freadint(file); - //ents->trigger.slabCount = freadint(file); - - //// parse trigger data - //if (ents->trigger.hullCount) - //{ - // ents->trigger.hulls = mem->Alloc(ents->trigger.hullCount); - // fread(ents->trigger.hulls, sizeof(TriggerHull), ents->trigger.hullCount, file); - //} - //if (ents->trigger.modelCount) - //{ - // ents->trigger.models = mem->Alloc(ents->trigger.modelCount); - // fread(ents->trigger.models, sizeof(TriggerModel), ents->trigger.modelCount, file); - //} - //if (ents->trigger.slabCount) - //{ - // ents->trigger.slabs = mem->Alloc(ents->trigger.slabCount); - // fread(ents->trigger.slabs, sizeof(TriggerSlab), ents->trigger.slabCount, file); - //} - //FileSystem::FileClose(file); - // return mapents return ents; } diff --git a/src/IW5/Assets/Techset.cpp b/src/IW5/Assets/Techset.cpp index 45f2dde..62e235a 100644 --- a/src/IW5/Assets/Techset.cpp +++ b/src/IW5/Assets/Techset.cpp @@ -353,9 +353,86 @@ namespace ZoneTool FileSystem::FileClose(fp); } } + + void ITechset::dump_technique_data(MaterialTechniqueSet* asset, bool is_iw5) + { + std::filesystem::create_directories("techsets/techniques"); + + for (int i = 0; i < 54; i++) + { + if (!asset->techniques[i]) + { + continue; + } + + auto technique = asset->techniques[i]; + + std::vector pass_array; + for (int p = 0; p < technique->hdr.numPasses; p++) + { + auto current_pass = &technique->pass[p]; + nlohmann::json pass; + + std::vector arg_array; + + for (int a = 0; a < current_pass->perObjArgCount + current_pass->perPrimArgCount + current_pass->stableArgCount; a++) + { + auto current_arg = ¤t_pass->argumentDef[a]; + nlohmann::json arg; + + arg["type"] = current_arg->type; + + if (current_arg->type == 1 || current_arg->type == 8) + { + arg["value"][0] = current_arg->u.literalConst[0]; + arg["value"][1] = current_arg->u.literalConst[0]; + arg["value"][2] = current_arg->u.literalConst[0]; + arg["value"][3] = current_arg->u.literalConst[0]; + } + else if (current_arg->type == 4 || current_arg->type == 6) + { + arg["firstRow"] = current_arg->u.codeConst.firstRow; + arg["rowCount"] = current_arg->u.codeConst.rowCount; + arg["index"] = current_arg->u.codeConst.index; + } + else + { + arg["value"] = current_arg->u.codeSampler; + } + + arg_array.push_back(arg); + } + + pass["perObjArgCount"] = current_pass->perObjArgCount; + pass["perPrimArgCount"] = current_pass->perPrimArgCount; + pass["stableArgCount"] = current_pass->stableArgCount; + pass["pixelShader"] = current_pass->pixelShader ? current_pass->pixelShader->name : ""; + pass["vertexShader"] = current_pass->vertexShader ? current_pass->vertexShader->name : ""; + pass["vertexDecl"] = current_pass->vertexDecl ? current_pass->vertexDecl->name : ""; + pass["args"] = arg_array; + + pass_array.push_back(pass); + } + + nlohmann::json json; + json["name"] = technique->hdr.name; + json["index"] = i; + json["flags"] = technique->hdr.unk; + json["numPasses"] = technique->hdr.numPasses; + json["pass"] = pass_array; + + auto meme = json.dump(); + + auto fp = fopen(va("techsets/techniques/%s.%s.json", technique->hdr.name, is_iw5 ? "iw5" : "iw4").data(), "wb"); + fwrite(meme.data(), meme.size(), 1, fp); + fclose(fp); + } + } void ITechset::dump(MaterialTechniqueSet* asset) { + // dump_technique_data(asset); + auto path = "techsets\\"s + asset->name + ".techset"; AssetDumper dumper; diff --git a/src/IW5/Assets/Techset.hpp b/src/IW5/Assets/Techset.hpp index 461f72e..1e6bd51 100644 --- a/src/IW5/Assets/Techset.hpp +++ b/src/IW5/Assets/Techset.hpp @@ -33,6 +33,7 @@ namespace ZoneTool std::int32_t type() override; void write(IZone* zone, ZoneBuffer* buffer) override; + static void dump_technique_data(MaterialTechniqueSet* asset, bool is_iw5 = true); static void dump_statebits(const std::string& techset, char* statebits); static void dump(MaterialTechniqueSet* asset); static void dump_technique(MaterialTechnique* asset); diff --git a/src/IW5/Assets/WeaponDef.cpp b/src/IW5/Assets/WeaponDef.cpp index 590bb7c..8dcebe9 100644 --- a/src/IW5/Assets/WeaponDef.cpp +++ b/src/IW5/Assets/WeaponDef.cpp @@ -12,683 +12,9 @@ namespace ZoneTool { namespace IW5 { - IWeaponDef::IWeaponDef() - { - } - - IWeaponDef::~IWeaponDef() - { - } - -#define WEAPON_READ_FIELD(__type__, __field__) \ - if (!data[#__field__].is_null()) weapon->__field__ = data[#__field__].get<__type__>() - -#define WEAPON_READ_STRING(__field__) \ - if (!data[#__field__].is_null()) weapon->__field__ = mem->StrDup(data[#__field__].get()) - -#define WEAPON_READ_ASSET(__type__, __datafield__, __field__) \ - if (!data[#__field__].is_null() && data[#__field__].is_string()) \ - { \ - auto asset##__field__ = data[#__field__].get(); \ - if (asset##__field__.empty()) \ - { \ - weapon->__field__ = nullptr; \ - } \ - else \ - { \ - weapon->__field__ = DB_FindXAssetHeader(XAssetType::__type__, asset##__field__.data(), 1).__datafield__; \ - } \ - } - - WeaponDef* IWeaponDef::parse_weapondef(Json& data, WeaponCompleteDef* baseAsset, - ZoneMemory* mem) - { - auto weapon = mem->Alloc(); - - if (baseAsset) - { - memcpy(weapon, baseAsset->WeaponDef, sizeof WeaponDef); - } - - WEAPON_READ_STRING(szInternalName); - - weapon->gunXModel = mem->Alloc(16); - weapon->worldModel = mem->Alloc(16); - - for (int i = 0; i < 16; i++) - { - auto gunmodel = data["gunXModel"][i].get(); - - if (!gunmodel.empty()) - { - weapon->gunXModel[i] = DB_FindXAssetHeader(xmodel, gunmodel.data(), 1).xmodel; - } - } - for (int i = 0; i < 16; i++) - { - auto gunmodel = data["worldXModel"][i].get(); - - if (!gunmodel.empty()) - { - weapon->worldModel[i] = DB_FindXAssetHeader(xmodel, gunmodel.data(), 1).xmodel; - } - } - - WEAPON_READ_ASSET(xmodel, xmodel, handXModel); - - weapon->notetrackSoundMapKeys = mem->Alloc(24); - weapon->notetrackSoundMapValues = mem->Alloc(24); - for (int i = 0; i < 24; i++) - { - auto notetrack = data["notetrackSoundMapKeys"][i].get(); - weapon->notetrackSoundMapKeys[i] = SL_AllocString(notetrack); - ZONETOOL_INFO("notetrack %s %i", notetrack.data(), weapon->notetrackSoundMapKeys[i]); - } - for (int i = 0; i < 24; i++) - { - auto notetrack = data["notetrackSoundMapValues"][i].get(); - weapon->notetrackSoundMapValues[i] = SL_AllocString(notetrack); - ZONETOOL_INFO("notetrack %s %i", notetrack.data(), weapon->notetrackSoundMapValues[i]); - } - - weapon->notetrackRumbleMapKeys = mem->Alloc(16); - weapon->notetrackRumbleMapValues = mem->Alloc(16); - for (int i = 0; i < 16; i++) - { - auto notetrack = data["notetrackRumbleMapKeys"][i].get(); - weapon->notetrackRumbleMapKeys[i] = SL_AllocString(notetrack); - ZONETOOL_INFO("notetrack %s %i", notetrack.data(), weapon->notetrackRumbleMapKeys[i]); - } - for (int i = 0; i < 16; i++) - { - auto notetrack = data["notetrackRumbleMapValues"][i].get(); - weapon->notetrackRumbleMapValues[i] = SL_AllocString(notetrack); - ZONETOOL_INFO("notetrack %s %i", notetrack.data(), weapon->notetrackRumbleMapValues[i]); - } - - WEAPON_READ_FIELD(int, playerAnimType); - WEAPON_READ_FIELD(int, weaponType); - WEAPON_READ_FIELD(int, weaponClass); - WEAPON_READ_FIELD(int, penetrateType); - WEAPON_READ_FIELD(int, inventoryType); - WEAPON_READ_FIELD(int, fireType); - WEAPON_READ_FIELD(int, offhandClass); - WEAPON_READ_FIELD(int, stance); - WEAPON_READ_ASSET(fx, fx, viewFlashEffect); - WEAPON_READ_ASSET(fx, fx, worldFlashEffect); - WEAPON_READ_ASSET(fx, fx, viewShellEjectEffect); - WEAPON_READ_ASSET(fx, fx, worldShellEjectEffect); - WEAPON_READ_ASSET(fx, fx, viewLastShotEjectEffect); - WEAPON_READ_ASSET(fx, fx, worldLastShotEjectEffect); - WEAPON_READ_ASSET(material, material, reticleCenter); - WEAPON_READ_ASSET(material, material, reticleSide); - - for (int i = 0; i < 48; i++) - { - auto sound = data["sounds"][i].get(); - - if (!sound.empty()) - { - weapon->sounds[i] = DB_FindXAssetHeader(XAssetType::sound, sound.data(), 1).sound; - } - } - - WEAPON_READ_FIELD(int, iReticleCenterSize); - WEAPON_READ_FIELD(int, iReticleSideSize); - WEAPON_READ_FIELD(int, iReticleMinOfs); - // WEAPON_READ_FIELD(activeReticleType_t, activeReticleType); - /*WEAPON_READ_FIELD(float, vStandMove[3]); - WEAPON_READ_FIELD(float, vStandRot[3]); - WEAPON_READ_FIELD(float, vStrafeMove[3]); - WEAPON_READ_FIELD(float, vStrafeRot[3]); - WEAPON_READ_FIELD(float, vDuckedOfs[3]); - WEAPON_READ_FIELD(float, vDuckedMove[3]); - WEAPON_READ_FIELD(float, vDuckedRot[3]); - WEAPON_READ_FIELD(float, vProneOfs[3]); - WEAPON_READ_FIELD(float, vProneMove[3]); - WEAPON_READ_FIELD(float, vProneRot[3]);*/ - WEAPON_READ_FIELD(float, fPosMoveRate); - WEAPON_READ_FIELD(float, fPosProneMoveRate); - WEAPON_READ_FIELD(float, fStandMoveMinSpeed); - WEAPON_READ_FIELD(float, fDuckedMoveMinSpeed); - WEAPON_READ_FIELD(float, fProneMoveMinSpeed); - WEAPON_READ_FIELD(float, fPosRotRate); - WEAPON_READ_FIELD(float, fPosProneRotRate); - WEAPON_READ_FIELD(float, fStandRotMinSpeed); - WEAPON_READ_FIELD(float, fDuckedRotMinSpeed); - WEAPON_READ_FIELD(float, fProneRotMinSpeed); - WEAPON_READ_ASSET(xmodel, xmodel, worldClipModel); - WEAPON_READ_ASSET(xmodel, xmodel, rocketModel); - WEAPON_READ_ASSET(xmodel, xmodel, knifeModel); - WEAPON_READ_ASSET(xmodel, xmodel, worldKnifeModel); - WEAPON_READ_ASSET(material, material, hudIcon); - WEAPON_READ_ASSET(material, material, pickupIcon); - WEAPON_READ_ASSET(material, material, ammoCounterIcon); - // WEAPON_READ_FIELD(weaponIconRatioType_t, hudIconRatio); - // WEAPON_READ_FIELD(weaponIconRatioType_t, pickupIconRatio); - // WEAPON_READ_FIELD(weaponIconRatioType_t, ammoCounterIconRatio); - // WEAPON_READ_FIELD(ammoCounterClipType_t, ammoCounterClip); - WEAPON_READ_FIELD(int, iStartAmmo); - WEAPON_READ_STRING(szAmmoName); - WEAPON_READ_FIELD(int, iAmmoIndex); - WEAPON_READ_STRING(szClipName); - WEAPON_READ_FIELD(int, iClipIndex); - WEAPON_READ_FIELD(int, iMaxAmmo); - WEAPON_READ_FIELD(int, shotCount); - WEAPON_READ_STRING(szSharedAmmoCapName); - WEAPON_READ_FIELD(int, iSharedAmmoCapIndex); - WEAPON_READ_FIELD(int, iSharedAmmoCap); - WEAPON_READ_FIELD(int, damage); - WEAPON_READ_FIELD(int, playerDamage); - WEAPON_READ_FIELD(int, iMeleeDamage); - WEAPON_READ_FIELD(int, iDamageType); - WEAPON_READ_FIELD(int, iFireDelay); - WEAPON_READ_FIELD(int, iMeleeDelay); - WEAPON_READ_FIELD(int, meleeChargeDelay); - WEAPON_READ_FIELD(int, iDetonateDelay); - WEAPON_READ_FIELD(int, iRechamberTime); - WEAPON_READ_FIELD(int, iRechamberOneHanded); - WEAPON_READ_FIELD(int, iRechamberBoltTime); - WEAPON_READ_FIELD(int, iHoldFireTime); - WEAPON_READ_FIELD(int, iDetonateTime); - WEAPON_READ_FIELD(int, iMeleeTime); - WEAPON_READ_FIELD(int, meleeChargeTime); - WEAPON_READ_FIELD(int, iReloadTime); - WEAPON_READ_FIELD(int, reloadShowRocketTime); - WEAPON_READ_FIELD(int, iReloadEmptyTime); - WEAPON_READ_FIELD(int, iReloadAddTime); - WEAPON_READ_FIELD(int, iReloadStartTime); - WEAPON_READ_FIELD(int, iReloadStartAddTime); - WEAPON_READ_FIELD(int, iReloadEndTime); - WEAPON_READ_FIELD(int, iDropTime); - WEAPON_READ_FIELD(int, iRaiseTime); - WEAPON_READ_FIELD(int, iAltDropTime); - WEAPON_READ_FIELD(int, quickDropTime); - WEAPON_READ_FIELD(int, quickRaiseTime); - WEAPON_READ_FIELD(int, iFirstRaiseTime); - WEAPON_READ_FIELD(int, iEmptyRaiseTime); - WEAPON_READ_FIELD(int, iEmptyDropTime); - WEAPON_READ_FIELD(int, sprintInTime); - WEAPON_READ_FIELD(int, sprintLoopTime); - WEAPON_READ_FIELD(int, sprintOutTime); - WEAPON_READ_FIELD(int, stunnedTimeBegin); - WEAPON_READ_FIELD(int, stunnedTimeLoop); - WEAPON_READ_FIELD(int, stunnedTimeEnd); - WEAPON_READ_FIELD(int, nightVisionWearTime); - WEAPON_READ_FIELD(int, nightVisionWearTimeFadeOutEnd); - WEAPON_READ_FIELD(int, nightVisionWearTimePowerUp); - WEAPON_READ_FIELD(int, nightVisionRemoveTime); - WEAPON_READ_FIELD(int, nightVisionRemoveTimePowerDown); - WEAPON_READ_FIELD(int, nightVisionRemoveTimeFadeInStart); - WEAPON_READ_FIELD(int, fuseTime); - WEAPON_READ_FIELD(int, aifuseTime); - WEAPON_READ_FIELD(float, autoAimRange); - WEAPON_READ_FIELD(float, aimAssistRange); - WEAPON_READ_FIELD(float, aimAssistRangeAds); - WEAPON_READ_FIELD(float, aimPadding); - WEAPON_READ_FIELD(float, enemyCrosshairRange); - WEAPON_READ_FIELD(float, moveSpeedScale); - WEAPON_READ_FIELD(float, adsMoveSpeedScale); - WEAPON_READ_FIELD(float, sprintDurationScale); - WEAPON_READ_FIELD(float, adsZoomInFrac); - WEAPON_READ_FIELD(float, adsZoomOutFrac); - WEAPON_READ_ASSET(material, material, AdsOverlayShader); - WEAPON_READ_ASSET(material, material, AdsOverlayShaderLowRes); - WEAPON_READ_ASSET(material, material, AdsOverlayShaderEMP); - WEAPON_READ_ASSET(material, material, AdsOverlayShaderEMPLowRes); - // WEAPON_READ_FIELD(weapOverlayReticle_t, adsOverlayReticle); - // WEAPON_READ_FIELD(weapOverlayInterface_t, adsOverlayInterface); - WEAPON_READ_FIELD(float, adsOverlayWidth); - WEAPON_READ_FIELD(float, adsOverlayHeight); - WEAPON_READ_FIELD(float, adsOverlayWidthSplitscreen); - WEAPON_READ_FIELD(float, adsOverlayHeightSplitscreen); - WEAPON_READ_FIELD(float, fAdsBobFactor); - WEAPON_READ_FIELD(float, fAdsViewBobMult); - WEAPON_READ_FIELD(float, fHipSpreadStandMin); - WEAPON_READ_FIELD(float, fHipSpreadDuckedMin); - WEAPON_READ_FIELD(float, fHipSpreadProneMin); - WEAPON_READ_FIELD(float, hipSpreadStandMax); - WEAPON_READ_FIELD(float, hipSpreadDuckedMax); - WEAPON_READ_FIELD(float, hipSpreadProneMax); - WEAPON_READ_FIELD(float, fHipSpreadDecayRate); - WEAPON_READ_FIELD(float, fHipSpreadFireAdd); - WEAPON_READ_FIELD(float, fHipSpreadTurnAdd); - WEAPON_READ_FIELD(float, fHipSpreadMoveAdd); - WEAPON_READ_FIELD(float, fHipSpreadDuckedDecay); - WEAPON_READ_FIELD(float, fHipSpreadProneDecay); - WEAPON_READ_FIELD(float, fHipReticleSidePos); - WEAPON_READ_FIELD(float, fAdsIdleAmount); - WEAPON_READ_FIELD(float, fHipIdleAmount); - WEAPON_READ_FIELD(float, adsIdleSpeed); - WEAPON_READ_FIELD(float, hipIdleSpeed); - WEAPON_READ_FIELD(float, fIdleCrouchFactor); - WEAPON_READ_FIELD(float, fIdleProneFactor); - WEAPON_READ_FIELD(float, fGunMaxPitch); - WEAPON_READ_FIELD(float, fGunMaxYaw); - WEAPON_READ_FIELD(float, swayMaxAngle); - WEAPON_READ_FIELD(float, swayLerpSpeed); - WEAPON_READ_FIELD(float, swayPitchScale); - WEAPON_READ_FIELD(float, swayYawScale); - WEAPON_READ_FIELD(float, swayHorizScale); - WEAPON_READ_FIELD(float, swayVertScale); - WEAPON_READ_FIELD(float, swayShellShockScale); - WEAPON_READ_FIELD(float, adsSwayMaxAngle); - WEAPON_READ_FIELD(float, adsSwayLerpSpeed); - WEAPON_READ_FIELD(float, adsSwayPitchScale); - WEAPON_READ_FIELD(float, adsSwayYawScale); - WEAPON_READ_FIELD(float, adsSwayHorizScale); - WEAPON_READ_FIELD(float, adsSwayVertScale); - WEAPON_READ_FIELD(float, adsViewErrorMin); - WEAPON_READ_FIELD(float, adsViewErrorMax); - // _BYTE idk[8]); - // PhysCollmap* collisions); - WEAPON_READ_ASSET(phys_collmap, physcollmap, collisions); - WEAPON_READ_FIELD(float, dualWieldViewModelOffset); - // WEAPON_READ_FIELD(weaponIconRatioType_t, killIconRatio); - WEAPON_READ_FIELD(int, iReloadAmmoAdd); - WEAPON_READ_FIELD(int, iReloadStartAdd); - WEAPON_READ_FIELD(int, iDropAmmoMin); - WEAPON_READ_FIELD(int, ammoDropClipPercentMin); - WEAPON_READ_FIELD(int, ammoDropClipPercentMax); - WEAPON_READ_FIELD(int, iExplosionRadius); - WEAPON_READ_FIELD(int, iExplosionRadiusMin); - WEAPON_READ_FIELD(int, iExplosionInnerDamage); - WEAPON_READ_FIELD(int, iExplosionOuterDamage); - WEAPON_READ_FIELD(float, damageConeAngle); - WEAPON_READ_FIELD(float, bulletExplDmgMult); - WEAPON_READ_FIELD(float, bulletExplRadiusMult); - WEAPON_READ_FIELD(int, iProjectileSpeed); - WEAPON_READ_FIELD(int, iProjectileSpeedUp); - WEAPON_READ_FIELD(int, iProjectileSpeedForward); - WEAPON_READ_FIELD(int, iProjectileActivateDist); - WEAPON_READ_FIELD(float, projLifetime); - WEAPON_READ_FIELD(float, timeToAccelerate); - WEAPON_READ_FIELD(float, projectileCurvature); - WEAPON_READ_ASSET(xmodel, xmodel, projectileModel); - WEAPON_READ_ASSET(fx, fx, projExplosionEffect); - WEAPON_READ_ASSET(fx, fx, projDudEffect); - WEAPON_READ_ASSET(sound, sound, projExplosionSound); - WEAPON_READ_ASSET(sound, sound, projDudSound); - // WEAPON_READ_FIELD(weapProjExplosion_t, projExplosiveType); - // WEAPON_READ_FIELD(WeapStickinessType, stickiness); - WEAPON_READ_FIELD(float, lowAmmoWarningThreshold); - WEAPON_READ_FIELD(float, ricochetChance); - // WEAPON_READ_FIELD(float, * parallelBounce); //Refer to surfaceNames_t - // WEAPON_READ_FIELD(float, * perpendicularBounce); //Refer to surfaceNames_t - // _BYTE gap52D[4]); - // WEAPON_READ_STRING(unkStruct124_1); - // WEAPON_READ_STRING(unkStruct124_2); - WEAPON_READ_ASSET(fx, fx, projTrailEffect); - WEAPON_READ_ASSET(fx, fx, projBeaconEffect); - // WEAPON_READ_FIELD(float, vProjectileColor[3]); - // WEAPON_READ_FIELD(guidedMissileType_t, guidedMissileType); - WEAPON_READ_FIELD(float, maxSteeringAccel); - WEAPON_READ_FIELD(float, projIgnitionDelay); - WEAPON_READ_ASSET(fx, fx, projIgnitionEffect); - WEAPON_READ_ASSET(sound, sound, projIgnitionSound); - WEAPON_READ_FIELD(float, fAdsAimPitch); - WEAPON_READ_FIELD(float, fAdsCrosshairInFrac); - WEAPON_READ_FIELD(float, fAdsCrosshairOutFrac); - WEAPON_READ_FIELD(int, adsGunKickReducedKickBullets); - WEAPON_READ_FIELD(float, adsGunKickReducedKickPercent); - WEAPON_READ_FIELD(float, fAdsGunKickPitchMin); - WEAPON_READ_FIELD(float, fAdsGunKickPitchMax); - WEAPON_READ_FIELD(float, fAdsGunKickYawMin); - WEAPON_READ_FIELD(float, fAdsGunKickYawMax); - WEAPON_READ_FIELD(float, fAdsGunKickAccel); - WEAPON_READ_FIELD(float, fAdsGunKickSpeedMax); - WEAPON_READ_FIELD(float, fAdsGunKickSpeedDecay); - WEAPON_READ_FIELD(float, fAdsGunKickStaticDecay); - WEAPON_READ_FIELD(float, fAdsViewKickPitchMin); - WEAPON_READ_FIELD(float, fAdsViewKickPitchMax); - WEAPON_READ_FIELD(float, fAdsViewKickYawMin); - WEAPON_READ_FIELD(float, fAdsViewKickYawMax); - WEAPON_READ_FIELD(float, fAdsViewScatterMin); - WEAPON_READ_FIELD(float, fAdsViewScatterMax); - WEAPON_READ_FIELD(float, fAdsSpread); - WEAPON_READ_FIELD(int, hipGunKickReducedKickBullets); - WEAPON_READ_FIELD(float, hipGunKickReducedKickPercent); - WEAPON_READ_FIELD(float, fHipGunKickPitchMin); - WEAPON_READ_FIELD(float, fHipGunKickPitchMax); - WEAPON_READ_FIELD(float, fHipGunKickYawMin); - WEAPON_READ_FIELD(float, fHipGunKickYawMax); - WEAPON_READ_FIELD(float, fHipGunKickAccel); - WEAPON_READ_FIELD(float, fHipGunKickSpeedMax); - WEAPON_READ_FIELD(float, fHipGunKickSpeedDecay); - WEAPON_READ_FIELD(float, fHipGunKickStaticDecay); - WEAPON_READ_FIELD(float, fHipViewKickPitchMin); - WEAPON_READ_FIELD(float, fHipViewKickPitchMax); - WEAPON_READ_FIELD(float, fHipViewKickYawMin); - WEAPON_READ_FIELD(float, fHipViewKickYawMax); - WEAPON_READ_FIELD(float, fHipViewScatterMin); - WEAPON_READ_FIELD(float, fHipViewScatterMax); - WEAPON_READ_FIELD(float, fightDist); - WEAPON_READ_FIELD(float, maxDist); - WEAPON_READ_FIELD(int, iPositionReloadTransTime); - WEAPON_READ_FIELD(float, leftArc); - WEAPON_READ_FIELD(float, rightArc); - WEAPON_READ_FIELD(float, topArc); - WEAPON_READ_FIELD(float, bottomArc); - WEAPON_READ_FIELD(float, accuracy); - WEAPON_READ_FIELD(float, aiSpread); - WEAPON_READ_FIELD(float, playerSpread); - WEAPON_READ_FIELD(float, minVertTurnSpeed); - WEAPON_READ_FIELD(float, minHorTurnSpeed); - WEAPON_READ_FIELD(float, maxVertTurnSpeed); - WEAPON_READ_FIELD(float, maxHorTurnSpeed); - WEAPON_READ_FIELD(float, pitchConvergenceTime); - WEAPON_READ_FIELD(float, yawConvergenceTime); - WEAPON_READ_FIELD(float, suppressTime); - WEAPON_READ_FIELD(float, maxRange); - WEAPON_READ_FIELD(float, fAnimHorRotateInc); - WEAPON_READ_FIELD(float, fPlayerPositionDist); - WEAPON_READ_STRING(szUseHintString); - WEAPON_READ_STRING(dropHintString); - WEAPON_READ_FIELD(int, iUseHintStringIndex); - WEAPON_READ_FIELD(int, dropHintStringIndex); - WEAPON_READ_FIELD(float, horizViewJitter); - WEAPON_READ_FIELD(float, vertViewJitter); - WEAPON_READ_FIELD(float, scanSpeed); - WEAPON_READ_FIELD(float, scanAccel); - WEAPON_READ_FIELD(int, scanPauseTime); - WEAPON_READ_STRING(szScript); - // WEAPON_READ_FIELD(float, fOOPosAnimLength[2]); - WEAPON_READ_FIELD(int, minDamage); - WEAPON_READ_FIELD(int, minPlayerDamage); - WEAPON_READ_FIELD(float, maxDamageRange); - WEAPON_READ_FIELD(float, minDamageRange); - WEAPON_READ_FIELD(float, destabilizationRateTime); - WEAPON_READ_FIELD(float, destabilizationCurvatureMax); - WEAPON_READ_FIELD(int, destabilizeDistance); - // float* locationDamageMultipliers); - WEAPON_READ_STRING(fireRumble); - WEAPON_READ_STRING(meleeImpactRumble); - WEAPON_READ_ASSET(tracer, tracer, tracer); - WEAPON_READ_ASSET(fx, fx, turretOverheatEffect); - WEAPON_READ_ASSET(sound, sound, turretOverheatSound); - WEAPON_READ_STRING(turretBarrelSpinRumble); - WEAPON_READ_FIELD(int, turretBarrelSpinUpTime); - WEAPON_READ_FIELD(int, turretBarrelSpinDownTime); - WEAPON_READ_FIELD(int, turretBarrelSpinSpeed); - WEAPON_READ_ASSET(sound, sound, turretBarrelSpinMaxSnd); - WEAPON_READ_ASSET(sound, sound, missileConeSoundAlias); - WEAPON_READ_ASSET(sound, sound, missileConeSoundAliasAtBase); - // snd_alias_list_t* turretBarrelSpinUpSnds[4]); - // snd_alias_list_t* turretBarrelSpinDownSnds[4]); - WEAPON_READ_FIELD(float, missileConeSoundRadiusAtTop); - WEAPON_READ_FIELD(float, missileConeSoundRadiusAtBase); - WEAPON_READ_FIELD(float, missileConeSoundHeight); - WEAPON_READ_FIELD(float, missileConeSoundOriginOffset); - WEAPON_READ_FIELD(float, missileConeSoundVolumescaleAtCore); - WEAPON_READ_FIELD(float, missileConeSoundVolumescaleAtEdge); - WEAPON_READ_FIELD(float, missileConeSoundVolumescaleCoreSize); - WEAPON_READ_FIELD(float, missileConeSoundPitchAtTop); - WEAPON_READ_FIELD(float, missileConeSoundPitchAtBottom); - WEAPON_READ_FIELD(float, missileConeSoundPitchTopSize); - WEAPON_READ_FIELD(float, missileConeSoundPitchBottomSize); - WEAPON_READ_FIELD(float, missileConeSoundCrossfadeTopSize); - WEAPON_READ_FIELD(float, missileConeSoundCrossfadeBottomSize); - WEAPON_READ_FIELD(bool, shareAmmo); - WEAPON_READ_FIELD(bool, lockonSupported); - WEAPON_READ_FIELD(bool, requireLockonToFire); - WEAPON_READ_FIELD(bool, bigExplosion); - WEAPON_READ_FIELD(bool, noAdsWhenMagEmpty); - WEAPON_READ_FIELD(bool, avoidDropCleanup); - WEAPON_READ_FIELD(bool, inheritsPerks); - WEAPON_READ_FIELD(bool, crosshairColorChange); - WEAPON_READ_FIELD(bool, rifleBullet); - WEAPON_READ_FIELD(bool, armorPiercing); - WEAPON_READ_FIELD(bool, boltAction); - WEAPON_READ_FIELD(bool, aimDownSight); - WEAPON_READ_FIELD(bool, rechamberWhileAds); - WEAPON_READ_FIELD(bool, bBulletExplosiveDamage); - WEAPON_READ_FIELD(bool, cookOffHold); - WEAPON_READ_FIELD(bool, clipOnly); - WEAPON_READ_FIELD(bool, noAmmoPickup); - WEAPON_READ_FIELD(bool, adsFire); - WEAPON_READ_FIELD(bool, cancelAutoHolsterWhenEmpty); - WEAPON_READ_FIELD(bool, disableSwitchToWhenEmpty); - WEAPON_READ_FIELD(bool, suppressAmmoReserveDisplay); - WEAPON_READ_FIELD(bool, laserSightDuringNightvision); - WEAPON_READ_FIELD(bool, markableViewmodel); - WEAPON_READ_FIELD(bool, noDualWield); - WEAPON_READ_FIELD(bool, flipKillIcon); - WEAPON_READ_FIELD(bool, noPartialReload); - WEAPON_READ_FIELD(bool, segmentedReload); - WEAPON_READ_FIELD(bool, blocksProne); - WEAPON_READ_FIELD(bool, silenced); - WEAPON_READ_FIELD(bool, isRollingGrenade); - WEAPON_READ_FIELD(bool, projExplosionEffectForceNormalUp); - WEAPON_READ_FIELD(bool, projImpactExplode); - WEAPON_READ_FIELD(bool, stickToPlayers); - WEAPON_READ_FIELD(bool, hasDetonator); - WEAPON_READ_FIELD(bool, disableFiring); - WEAPON_READ_FIELD(bool, timedDetonation); - WEAPON_READ_FIELD(bool, rotate); - WEAPON_READ_FIELD(bool, holdButtonToThrow); - WEAPON_READ_FIELD(bool, freezeMovementWhenFiring); - WEAPON_READ_FIELD(bool, thermalScope); - WEAPON_READ_FIELD(bool, altModeSameWeapon); - WEAPON_READ_FIELD(bool, turretBarrelSpinEnabled); - WEAPON_READ_FIELD(bool, missileConeSoundEnabled); - WEAPON_READ_FIELD(bool, missileConeSoundPitchshiftEnabled); - WEAPON_READ_FIELD(bool, missileConeSoundCrossfadeEnabled); - WEAPON_READ_FIELD(bool, offhandHoldIsCancelable); - - return weapon; - } - WeaponCompleteDef* IWeaponDef::parse(const std::string& name, ZoneMemory* mem) { - sizeof WeaponCompleteDef; - - auto path = "weapons/mp/" + name; - - if (!FileSystem::FileExists(path)) - { - return nullptr; - } - - ZONETOOL_INFO("Parsing weapon \"%s\"...", name.data()); - - auto weapon = mem->Alloc(); - - // parse json file - auto file = FileSystem::FileOpen(path, "rb"); - auto size = FileSystem::FileSize(file); - auto bytes = FileSystem::ReadBytes(file, size); - FileSystem::FileClose(file); - nlohmann::json data = nlohmann::json::parse(bytes); - - // base asset - auto base = data["baseAsset"].get(); - WeaponCompleteDef* baseAsset = nullptr; - - if (!base.empty()) - { - baseAsset = DB_FindXAssetHeader(XAssetType::weapon, base.data(), 1).weapon; - memcpy(weapon, baseAsset, sizeof WeaponCompleteDef); - } - else - { - ZONETOOL_WARNING("No base asset is defined for weapon %s, stuff might go wrong!", name.data()); - } - - // parse weapondef - weapon->WeaponDef = this->parse_weapondef(data["WeaponDef"], baseAsset, mem); - - WEAPON_READ_STRING(name); - WEAPON_READ_STRING(displayName); - - weapon->hideTags = mem->Alloc(32); - for (int i = 0; i < 32; i++) - { - weapon->hideTags[i] = SL_AllocString(data["hideTags"][i].get()); - } - - weapon->attachment1 = mem->Alloc(6); - for (int i = 0; i < 6; i++) - { - auto attachment = data["attachment1"][i].get(); - - if (!attachment.empty()) - { - weapon->attachment1[i] = DB_FindXAssetHeader(XAssetType::attachment, attachment.data(), 1). - attachment; - } - } - weapon->attachment2 = mem->Alloc(3); - for (int i = 0; i < 3; i++) - { - auto attachment = data["attachment2"][i].get(); - - if (!attachment.empty()) - { - weapon->attachment2[i] = DB_FindXAssetHeader(XAssetType::attachment, attachment.data(), 1). - attachment; - } - } - weapon->attachment3 = mem->Alloc(4); - for (int i = 0; i < 4; i++) - { - auto attachment = data["attachment3"][i].get(); - - if (!attachment.empty()) - { - weapon->attachment3[i] = DB_FindXAssetHeader(XAssetType::attachment, attachment.data(), 1). - attachment; - } - } - - weapon->szXAnims = mem->Alloc(42); - for (int i = 0; i < 42; i++) - { - weapon->szXAnims[i] = mem->StrDup(data["szXAnims"][i].get()); - } - - WEAPON_READ_FIELD(unsigned int, numAnimOverrides); - WEAPON_READ_FIELD(unsigned int, numSoundOverrides); - WEAPON_READ_FIELD(unsigned int, numFXOverrides); - WEAPON_READ_FIELD(unsigned int, numReloadStateTimerOverrides); - WEAPON_READ_FIELD(unsigned int, numNotetrackOverrides); - - if (weapon->numAnimOverrides) - { - weapon->animOverrides = mem->Alloc(weapon->numAnimOverrides); - for (int i = 0; i < weapon->numAnimOverrides; i++) - { - weapon->animOverrides[i].altmodeAnim = mem->StrDup( - data["animOverrides"][i]["altmodeAnim"].is_string() - ? data["animOverrides"][i]["altmodeAnim"].get() - : ""); - weapon->animOverrides[i].overrideAnim = mem->StrDup( - data["animOverrides"][i]["overrideAnim"].is_string() - ? data["animOverrides"][i]["overrideAnim"].get() - : ""); - weapon->animOverrides[i].attachment1 = data["animOverrides"][i]["attachment1"].get(); - weapon->animOverrides[i].attachment2 = data["animOverrides"][i]["attachment2"].get(); - weapon->animOverrides[i].altTime = data["animOverrides"][i]["altTime"].get(); - weapon->animOverrides[i].animTime = data["animOverrides"][i]["animTime"].get(); - weapon->animOverrides[i].animTreeType = data["animOverrides"][i]["animTreeType"].get(); - } - } - - if (weapon->numSoundOverrides) - { - weapon->soundOverrides = mem->Alloc(weapon->numSoundOverrides); - for (int i = 0; i < weapon->numSoundOverrides; i++) - { - weapon->soundOverrides[i].altmodeSound = (data["soundOverrides"][i]["altmodeSound"].is_string()) - ? DB_FindXAssetHeader( - sound, - data["soundOverrides"][i]["altmodeSound"] - .get().data(), 1).sound - : nullptr; - weapon->soundOverrides[i].overrideSound = (data["soundOverrides"][i]["overrideSound"].is_string()) - ? DB_FindXAssetHeader( - sound, - data["soundOverrides"][i]["overrideSound"] - .get().data(), 1).sound - : nullptr; - weapon->soundOverrides[i].attachment1 = data["soundOverrides"][i]["attachment1"].get(); - weapon->soundOverrides[i].attachment2 = data["soundOverrides"][i]["attachment2"].get(); - weapon->soundOverrides[i].soundType = data["soundOverrides"][i]["soundType"].get(); - } - } - - if (weapon->numFXOverrides) - { - weapon->fxOverrides = mem->Alloc(weapon->numFXOverrides); - for (int i = 0; i < weapon->numFXOverrides; i++) - { - weapon->fxOverrides[i].altmodeFX = (data["fxOverrides"][i]["altmodeFX"].is_string()) - ? DB_FindXAssetHeader( - fx, data["fxOverrides"][i]["altmodeFX"] - .get().data(), 1).fx - : nullptr; - weapon->fxOverrides[i].overrideFX = (data["fxOverrides"][i]["overrideFX"].is_string()) - ? DB_FindXAssetHeader( - fx, data["fxOverrides"][i]["overrideFX"] - .get().data(), 1).fx - : nullptr; - weapon->fxOverrides[i].attachment1 = data["fxOverrides"][i]["attachment1"].get(); - weapon->fxOverrides[i].attachment2 = data["fxOverrides"][i]["attachment2"].get(); - weapon->fxOverrides[i].fxType = data["fxOverrides"][i]["fxType"].get(); - } - } - - if (weapon->numReloadStateTimerOverrides) - { - weapon->reloadOverrides = mem->Alloc(weapon->numReloadStateTimerOverrides); - for (int i = 0; i < weapon->numReloadStateTimerOverrides; i++) - { - weapon->reloadOverrides[i].attachment = data["attachment"].get(); - weapon->reloadOverrides[i].reloadAddTime = data["reloadAddTime"].get(); - weapon->reloadOverrides[i].reloadEmptyAddTime = data["reloadEmptyAddTime"].get(); - } - } - - if (weapon->numNotetrackOverrides) - { - // TODO - weapon->numNotetrackOverrides = 0; - } - - /* - for (int j = 0; j < 24; j++) - { - data["notetrackOverrides"][i]["notetrackSoundMapKeys"][j] = SL_ConvertToString(asset->notetrackOverrides[i].notetrackSoundMapKeys[j]); - data["notetrackOverrides"][i]["notetrackSoundMapValues"][j] = SL_ConvertToString(asset->notetrackOverrides[i].notetrackSoundMapValues[j]); - } - */ - - WEAPON_READ_FIELD(int, iAdsTransInTime); - WEAPON_READ_FIELD(int, iAdsTransOutTime); - WEAPON_READ_FIELD(int, iClipSize); - WEAPON_READ_FIELD(int, impactType); - WEAPON_READ_FIELD(int, iFireTime); - WEAPON_READ_FIELD(int, iFireTimeAkimbo); - WEAPON_READ_FIELD(int, dpadIconRatio); - WEAPON_READ_FIELD(int, iPenetrateMultiplier); - WEAPON_READ_FIELD(float, fAdsViewKickCenterSpeed); - WEAPON_READ_FIELD(float, fHipViewKickCenterSpeed); - WEAPON_READ_STRING(altWeaponName); - WEAPON_READ_FIELD(unsigned int, altWeaponIndex); - WEAPON_READ_FIELD(int, iAltRaiseTime); - WEAPON_READ_FIELD(int, iAltRaiseTimeAkimbo); - WEAPON_READ_ASSET(material, material, killIcon); - WEAPON_READ_ASSET(material, material, dpadIcon); - WEAPON_READ_FIELD(int, iDropAmmoMax); - WEAPON_READ_FIELD(bool, motionTracker); - WEAPON_READ_FIELD(bool, enhanced); - WEAPON_READ_FIELD(bool, dpadIconShowsAmmo); - - return weapon; + return nullptr; } void IWeaponDef::init(const std::string& name, ZoneMemory* mem) @@ -707,7 +33,7 @@ namespace ZoneTool auto weapon = mem->Alloc(); memcpy(weapon, this->asset_, sizeof WeaponCompleteDef); - weapon->hideTags = mem->Alloc(32); + weapon->hideTags = mem->Alloc(32); memcpy(weapon->hideTags, this->asset_->hideTags, sizeof(short) * 32); if (weapon->hideTags) @@ -765,13 +91,13 @@ namespace ZoneTool // weaponDef shit auto data = mem->Alloc(); // weapon->WeaponDef; - memcpy(data, weapon->WeaponDef, sizeof WeaponDef); + memcpy(data, weapon->weapDef, sizeof WeaponDef); #define WEAPON_SCRIPTSTRING_ARRAY(__field__,__count__) \ if (data->__field__) \ { \ data->__field__ = mem->Alloc(__count__); \ - memcpy(data->__field__, this->asset_->WeaponDef->__field__, sizeof(short) * __count__); \ + memcpy(data->__field__, this->asset_->weapDef->__field__, sizeof(short) * __count__); \ \ for (int nt = 0; nt < __count__; nt++) \ { \ @@ -785,7 +111,7 @@ namespace ZoneTool WEAPON_SCRIPTSTRING_ARRAY(notetrackRumbleMapKeys, 16); WEAPON_SCRIPTSTRING_ARRAY(notetrackRumbleMapValues, 16); - weapon->WeaponDef = data; + weapon->weapDef = data; this->asset_ = weapon; } @@ -817,24 +143,24 @@ namespace ZoneTool WEAPON_SUBASSET(sounds[i], sound, snd_alias_list_t); } - if (data->sndArray1) + if (data->bounceSound) { for (auto i = 0u; i < 31; i++) { - if (data->sndArray1[i]) + if (data->bounceSound[i]) { - zone->add_asset_of_type(sound, data->sndArray1[i]->name); + zone->add_asset_of_type(sound, data->bounceSound[i]->name); } } } - if (data->sndArray2) + if (data->rollingSound) { for (auto i = 0u; i < 31; i++) { - if (data->sndArray2[i]) + if (data->rollingSound[i]) { - zone->add_asset_of_type(sound, data->sndArray2[i]->name); + zone->add_asset_of_type(sound, data->rollingSound[i]->name); } } } @@ -855,12 +181,12 @@ namespace ZoneTool WEAPON_SUBASSET(pickupIcon, material, Material); WEAPON_SUBASSET(ammoCounterIcon, material, Material); - WEAPON_SUBASSET(AdsOverlayShader, material, Material); - WEAPON_SUBASSET(AdsOverlayShaderLowRes, material, Material); - WEAPON_SUBASSET(AdsOverlayShaderEMP, material, Material); - WEAPON_SUBASSET(AdsOverlayShaderEMPLowRes, material, Material); + WEAPON_SUBASSET(overlay.shader, material, Material); + WEAPON_SUBASSET(overlay.shaderLowRes, material, Material); + WEAPON_SUBASSET(overlay.shaderEMP, material, Material); + WEAPON_SUBASSET(overlay.shaderEMPLowRes, material, Material); - WEAPON_SUBASSET(collisions, phys_collmap, PhysCollmap); + WEAPON_SUBASSET(physCollmap, phys_collmap, PhysCollmap); WEAPON_SUBASSET(projectileModel, xmodel, XModel); @@ -876,7 +202,7 @@ namespace ZoneTool WEAPON_SUBASSET(projIgnitionSound, sound, snd_alias_list_t); - WEAPON_SUBASSET(tracer, tracer, TracerDef); + WEAPON_SUBASSET(tracerType, tracer, TracerDef); WEAPON_SUBASSET(turretOverheatSound, sound, snd_alias_list_t); WEAPON_SUBASSET(turretOverheatEffect, fx, FxEffectDef); @@ -885,14 +211,12 @@ namespace ZoneTool for (int i = 0; i < 4; i++) { - WEAPON_SUBASSET(turretBarrelSpinUpSnds[i], sound, snd_alias_list_t); - WEAPON_SUBASSET(turretBarrelSpinDownSnds[i], sound, snd_alias_list_t); + WEAPON_SUBASSET(turretBarrelSpinUpSnd[i], sound, snd_alias_list_t); + WEAPON_SUBASSET(turretBarrelSpinDownSnd[i], sound, snd_alias_list_t); } WEAPON_SUBASSET(missileConeSoundAlias, sound, snd_alias_list_t); WEAPON_SUBASSET(missileConeSoundAliasAtBase, sound, snd_alias_list_t); - - // WEAPON_SUBASSET(unknownXModel, xmodel, XModel); } void IWeaponDef::load_depending(IZone* zone) @@ -901,15 +225,15 @@ namespace ZoneTool for (auto i = 0u; i < 6; i++) { - if (data->attachment1 && data->attachment1[i]) + if (data->scopes && data->scopes[i]) { - zone->add_asset_of_type(attachment, this->asset_->attachment1[i]->szInternalName); + zone->add_asset_of_type(attachment, this->asset_->scopes[i]->szInternalName); } if (i >= 3) continue; - if (data->attachment3 && data->attachment3[i]) + if (data->others && data->others[i]) { - zone->add_asset_of_type(attachment, this->asset_->attachment3[i]->szInternalName); + zone->add_asset_of_type(attachment, this->asset_->others[i]->szInternalName); } // Projectile attachments require fixing. @@ -973,7 +297,7 @@ namespace ZoneTool } } - load_depending_WeaponDef(zone, data->WeaponDef); + load_depending_WeaponDef(zone, data->weapDef); } std::string IWeaponDef::name() @@ -991,9 +315,9 @@ namespace ZoneTool { auto dest = buf->write(data); - if (data->szInternalName) + if (data->szOverlayName) { - dest->szInternalName = buf->write_str(data->szInternalName); + dest->szOverlayName = buf->write_str(data->szOverlayName); } if (data->gunXModel) @@ -1021,10 +345,10 @@ namespace ZoneTool ); } - if (data->szXAnimsR) + if (data->szXAnimsRightHanded) { buf->align(3); - auto strings = buf->write(data->szXAnimsR, 42); + auto strings = buf->write(data->szXAnimsRightHanded, 42); for (auto i = 0u; i < 42; i++) { @@ -1034,13 +358,13 @@ namespace ZoneTool } } - ZoneBuffer::ClearPointer(&dest->szXAnimsR); + ZoneBuffer::ClearPointer(&dest->szXAnimsRightHanded); } - if (data->szXAnimsL) + if (data->szXAnimsLeftHanded) { buf->align(3); - auto strings = buf->write(data->szXAnimsL, 42); + auto strings = buf->write(data->szXAnimsLeftHanded, 42); for (auto i = 0u; i < 42; i++) { @@ -1050,7 +374,7 @@ namespace ZoneTool } } - ZoneBuffer::ClearPointer(&dest->szXAnimsL); + ZoneBuffer::ClearPointer(&dest->szXAnimsLeftHanded); } if (data->szModeName) @@ -1092,10 +416,10 @@ namespace ZoneTool ZoneBuffer::ClearPointer(&dest->sounds[i]); } - if (data->sndArray1) + if (data->bounceSound) { buf->align(3); - auto destSounds = buf->write(data->sndArray1, 31); + auto destSounds = buf->write(data->bounceSound, 31); for (auto i = 0u; i < 31; i++) { @@ -1107,13 +431,13 @@ namespace ZoneTool } } - ZoneBuffer::ClearPointer(&dest->sndArray1); + ZoneBuffer::ClearPointer(&dest->bounceSound); } - if (data->sndArray2) + if (data->rollingSound) { buf->align(3); - auto destSounds = buf->write(data->sndArray2, 31); + auto destSounds = buf->write(data->rollingSound, 31); for (auto i = 0u; i < 31; i++) { @@ -1125,7 +449,7 @@ namespace ZoneTool } } - ZoneBuffer::ClearPointer(&dest->sndArray2); + ZoneBuffer::ClearPointer(&dest->rollingSound); } WEAPON_SUBASSET(viewShellEjectEffect, fx, FxEffectDef); @@ -1177,12 +501,12 @@ namespace ZoneTool dest->szSharedAmmoCapName = buf->write_str(data->szSharedAmmoCapName); } - WEAPON_SUBASSET(AdsOverlayShader, material, Material); - WEAPON_SUBASSET(AdsOverlayShaderLowRes, material, Material); - WEAPON_SUBASSET(AdsOverlayShaderEMP, material, Material); - WEAPON_SUBASSET(AdsOverlayShaderEMPLowRes, material, Material); + WEAPON_SUBASSET(overlay.shader, material, Material); + WEAPON_SUBASSET(overlay.shaderLowRes, material, Material); + WEAPON_SUBASSET(overlay.shaderEMP, material, Material); + WEAPON_SUBASSET(overlay.shaderEMPLowRes, material, Material); - WEAPON_SUBASSET(collisions, phys_collmap, PhysCollmap); + WEAPON_SUBASSET(physCollmap, phys_collmap, PhysCollmap); WEAPON_SUBASSET(projectileModel, xmodel, XModel); @@ -1192,18 +516,18 @@ namespace ZoneTool WEAPON_SUBASSET(projExplosionSound, sound, snd_alias_list_t); WEAPON_SUBASSET(projDudSound, sound, snd_alias_list_t); - if (data->unkStruct124_1) + if (data->parallelBounce) { buf->align(3); - buf->write(data->unkStruct124_1, 124); - ZoneBuffer::ClearPointer(&dest->unkStruct124_1); + buf->write(data->parallelBounce, 124); + ZoneBuffer::ClearPointer(&dest->parallelBounce); } - if (data->unkStruct124_2) + if (data->perpendicularBounce) { buf->align(3); - buf->write(data->unkStruct124_2, 124); - ZoneBuffer::ClearPointer(&dest->unkStruct124_2); + buf->write(data->perpendicularBounce, 124); + ZoneBuffer::ClearPointer(&dest->perpendicularBounce); } WEAPON_SUBASSET(projTrailEffect, fx, FxEffectDef); @@ -1220,7 +544,7 @@ namespace ZoneTool if (data->accuracyGraphKnots) { buf->align(3); - buf->write(data->accuracyGraphKnots, complete->accuracyGraphKnotCount); + buf->write(data->accuracyGraphKnots, data->accuracyGraphKnotCount); ZoneBuffer::ClearPointer(&dest->accuracyGraphKnots); } @@ -1232,7 +556,7 @@ namespace ZoneTool if (data->originalAccuracyGraphKnots) { buf->align(3); - buf->write(data->originalAccuracyGraphKnots, complete->originalAccuracyGraphKnotCount); + buf->write(data->originalAccuracyGraphKnots, data->originalAccuracyGraphKnotCount); ZoneBuffer::ClearPointer(&dest->originalAccuracyGraphKnots); } @@ -1268,7 +592,7 @@ namespace ZoneTool dest->meleeImpactRumble = buf->write_str(data->meleeImpactRumble); } - WEAPON_SUBASSET(tracer, tracer, TracerDef); + WEAPON_SUBASSET(tracerType, tracer, TracerDef); WEAPON_SUBASSET(turretOverheatSound, sound, snd_alias_list_t); WEAPON_SUBASSET(turretOverheatEffect, fx, FxEffectDef); @@ -1282,42 +606,37 @@ namespace ZoneTool for (int i = 0; i < 4; i++) { - WEAPON_SUBASSET(turretBarrelSpinUpSnds[i], sound, snd_alias_list_t); - WEAPON_SUBASSET(turretBarrelSpinDownSnds[i], sound, snd_alias_list_t); + WEAPON_SUBASSET(turretBarrelSpinUpSnd[i], sound, snd_alias_list_t); + WEAPON_SUBASSET(turretBarrelSpinDownSnd[i], sound, snd_alias_list_t); } WEAPON_SUBASSET(missileConeSoundAlias, sound, snd_alias_list_t); WEAPON_SUBASSET(missileConeSoundAliasAtBase, sound, snd_alias_list_t); - dest->unknownTag = nullptr; - dest->unknownXModel = nullptr; - // WEAPON_SUBASSET(unknownXModel, xmodel, XModel); - - sizeof WeaponDef; + dest->stowOffsetModel = nullptr; + dest->stowTag = 0; } - + void IWeaponDef::write(IZone* zone, ZoneBuffer* buf) { - sizeof(WeaponCompleteDef); - auto data = this->asset_; auto dest = buf->write(data); buf->push_stream(3); START_LOG_STREAM; - dest->name = buf->write_str(this->name()); + dest->szInternalName = buf->write_str(this->name()); - if (data->WeaponDef) + if (data->weapDef) { buf->align(3); - write_WeaponDef(zone, buf, data, data->WeaponDef); - ZoneBuffer::ClearPointer(&dest->WeaponDef); + write_WeaponDef(zone, buf, data, data->weapDef); + ZoneBuffer::ClearPointer(&dest->weapDef); } - if (data->displayName) + if (data->szDisplayName) { - dest->displayName = buf->write_str(data->displayName); + dest->szDisplayName = buf->write_str(data->szDisplayName); } if (data->hideTags) @@ -1346,9 +665,9 @@ namespace ZoneTool ZoneBuffer::ClearPointer(&dest->__field__); \ } - WEAPON_ATTACHMENT(attachment1, 6); - WEAPON_ATTACHMENT(attachment2, 3); - WEAPON_ATTACHMENT(attachment3, 4); + WEAPON_ATTACHMENT(scopes, 6); + WEAPON_ATTACHMENT(underBarrels, 3); + WEAPON_ATTACHMENT(others, 4); if (data->szXAnims) { @@ -1473,9 +792,9 @@ namespace ZoneTool ZoneBuffer::ClearPointer(&dest->notetrackOverrides); } - if (data->altWeaponName) + if (data->szAltWeaponName) { - dest->altWeaponName = buf->write_str(data->altWeaponName); + dest->szAltWeaponName = buf->write_str(data->szAltWeaponName); } if (data->killIcon) @@ -1492,18 +811,18 @@ namespace ZoneTool ); } - if (data->accuracyGraphKnots) + if (data->accuracyGraphKnots[0]) { buf->align(3); - buf->write(data->accuracyGraphKnots, data->accuracyGraphKnotCount); - ZoneBuffer::ClearPointer(&dest->accuracyGraphKnots); + buf->write(data->accuracyGraphKnots[0], data->accuracyGraphKnotCount[0]); + ZoneBuffer::ClearPointer(&dest->accuracyGraphKnots[0]); } - if (data->originalAccuracyGraphKnots) + if (data->accuracyGraphKnots[1]) { buf->align(3); - buf->write(data->originalAccuracyGraphKnots, data->originalAccuracyGraphKnotCount); - ZoneBuffer::ClearPointer(&dest->originalAccuracyGraphKnots); + buf->write(data->accuracyGraphKnots[1], data->accuracyGraphKnotCount[1]); + ZoneBuffer::ClearPointer(&dest->accuracyGraphKnots[1]); } END_LOG_STREAM; @@ -1512,678 +831,9 @@ namespace ZoneTool encrypt_data(dest, sizeof WeaponCompleteDef); } -#define WEAPON_DUMP_FIELD(__field__) \ - data[#__field__] = asset->__field__ - -#define WEAPON_DUMP_ASSET(__field__) \ - if (asset->__field__) \ - { \ - data[#__field__] = asset->__field__->name; \ - } \ - else \ - { \ - data[#__field__] = ""; \ - } - - Json IWeaponDef::dump_weapondef(WeaponDef* asset, const std::function& convertToString) - { - Json data; - - WEAPON_DUMP_FIELD(szInternalName); - - for (int i = 0; i < 16; i++) - { - if (asset->gunXModel && asset->gunXModel[i]) - { - data["gunXModel"][i] = asset->gunXModel[i]->name; - } - else - { - data["gunXModel"][i] = ""; - } - - if (asset->worldModel && asset->worldModel[i]) - { - data["worldXModel"][i] = asset->worldModel[i]->name; - } - else - { - data["worldXModel"][i] = ""; - } - } - - for (int i = 0; i < 24; i++) - { - if (asset->notetrackSoundMapKeys && asset->notetrackSoundMapKeys[i]) - { - data["notetrackSoundMapKeys"][i] = convertToString(asset->notetrackSoundMapKeys[i]); - } - else - { - data["notetrackSoundMapKeys"][i] = ""; - } - - if (asset->notetrackSoundMapValues && asset->notetrackSoundMapValues[i]) - { - data["notetrackSoundMapValues"][i] = convertToString(asset->notetrackSoundMapValues[i]); - } - else - { - data["notetrackSoundMapValues"][i] = ""; - } - } - - for (int i = 0; i < 16; i++) - { - if (asset->notetrackRumbleMapKeys && asset->notetrackRumbleMapKeys[i]) - { - data["notetrackRumbleMapKeys"][i] = convertToString(asset->notetrackRumbleMapKeys[i]); - } - else - { - data["notetrackRumbleMapKeys"][i] = ""; - } - - if (asset->notetrackRumbleMapValues && asset->notetrackRumbleMapValues[i]) - { - data["notetrackRumbleMapValues"][i] = convertToString(asset->notetrackRumbleMapValues[i]); - } - else - { - data["notetrackRumbleMapValues"][i] = ""; - } - } - - WEAPON_DUMP_ASSET(handXModel); - - /*XModel **gunXModel); - XModel *handXModel); - const WEAPON_DUMP_FIELD(*szXAnimsR); - const WEAPON_DUMP_FIELD(*szXAnimsL); - const WEAPON_DUMP_FIELD(szModeName); - WEAPON_DUMP_FIELD(*notetrackSoundMapKeys); - WEAPON_DUMP_FIELD(*notetrackSoundMapValues); - WEAPON_DUMP_FIELD(*notetrackRumbleMapKeys); - WEAPON_DUMP_FIELD(*notetrackRumbleMapValues);*/ - WEAPON_DUMP_FIELD(playerAnimType); - WEAPON_DUMP_FIELD(weaponType); - WEAPON_DUMP_FIELD(weaponClass); - WEAPON_DUMP_FIELD(penetrateType); - WEAPON_DUMP_FIELD(inventoryType); - WEAPON_DUMP_FIELD(fireType); - WEAPON_DUMP_FIELD(offhandClass); - WEAPON_DUMP_FIELD(stance); - - for (int i = 0; i < 48; i++) - { - if (asset->sounds && asset->sounds[i]) - { - data["sounds"][i] = asset->sounds[i]->name; - } - else - { - data["sounds"][i] = ""; - } - } - - for (int i = 0; i < 31; i++) - { - if (asset->sndArray1 && asset->sndArray1[i]) - { - data["sndArray1"][i] = asset->sndArray1[i]->name; - } - else - { - data["sndArray1"][i] = ""; - } - - if (asset->sndArray2 && asset->sndArray2[i]) - { - data["sndArray2"][i] = asset->sndArray2[i]->name; - } - else - { - data["sndArray2"][i] = ""; - } - } - - WEAPON_DUMP_ASSET(viewFlashEffect); - WEAPON_DUMP_ASSET(worldFlashEffect); - WEAPON_DUMP_ASSET(viewShellEjectEffect); - WEAPON_DUMP_ASSET(worldShellEjectEffect); - WEAPON_DUMP_ASSET(viewLastShotEjectEffect); - WEAPON_DUMP_ASSET(worldLastShotEjectEffect); - WEAPON_DUMP_ASSET(reticleCenter); - WEAPON_DUMP_ASSET(reticleSide); - WEAPON_DUMP_FIELD(iReticleCenterSize); - WEAPON_DUMP_FIELD(iReticleSideSize); - WEAPON_DUMP_FIELD(iReticleMinOfs); - /*activeReticleType_t activeReticleType); - WEAPON_DUMP_FIELD(vStandMove[3]); - WEAPON_DUMP_FIELD(vStandRot[3]); - WEAPON_DUMP_FIELD(vStrafeMove[3]); - WEAPON_DUMP_FIELD(vStrafeRot[3]); - WEAPON_DUMP_FIELD(vDuckedOfs[3]); - WEAPON_DUMP_FIELD(vDuckedMove[3]); - WEAPON_DUMP_FIELD(vDuckedRot[3]); - WEAPON_DUMP_FIELD(vProneOfs[3]); - WEAPON_DUMP_FIELD(vProneMove[3]); - WEAPON_DUMP_FIELD(vProneRot[3]);*/ - WEAPON_DUMP_FIELD(fPosMoveRate); - WEAPON_DUMP_FIELD(fPosProneMoveRate); - WEAPON_DUMP_FIELD(fStandMoveMinSpeed); - WEAPON_DUMP_FIELD(fDuckedMoveMinSpeed); - WEAPON_DUMP_FIELD(fProneMoveMinSpeed); - WEAPON_DUMP_FIELD(fPosRotRate); - WEAPON_DUMP_FIELD(fPosProneRotRate); - WEAPON_DUMP_FIELD(fStandRotMinSpeed); - WEAPON_DUMP_FIELD(fDuckedRotMinSpeed); - WEAPON_DUMP_FIELD(fProneRotMinSpeed); - WEAPON_DUMP_ASSET(worldClipModel); - WEAPON_DUMP_ASSET(rocketModel); - WEAPON_DUMP_ASSET(knifeModel); - WEAPON_DUMP_ASSET(worldKnifeModel); - WEAPON_DUMP_ASSET(hudIcon); - // weaponIconRatioType_t hudIconRatio); - WEAPON_DUMP_ASSET(pickupIcon); - // weaponIconRatioType_t pickupIconRatio); - WEAPON_DUMP_ASSET(ammoCounterIcon); - // weaponIconRatioType_t ammoCounterIconRatio); - // ammoCounterClipType_t ammoCounterClip);*/ - WEAPON_DUMP_FIELD(iStartAmmo); - WEAPON_DUMP_FIELD(szAmmoName); - WEAPON_DUMP_FIELD(iAmmoIndex); - WEAPON_DUMP_FIELD(szClipName); - WEAPON_DUMP_FIELD(iClipIndex); - WEAPON_DUMP_FIELD(iMaxAmmo); - WEAPON_DUMP_FIELD(shotCount); - WEAPON_DUMP_FIELD(szSharedAmmoCapName); - WEAPON_DUMP_FIELD(iSharedAmmoCapIndex); - WEAPON_DUMP_FIELD(iSharedAmmoCap); - WEAPON_DUMP_FIELD(damage); - WEAPON_DUMP_FIELD(playerDamage); - WEAPON_DUMP_FIELD(iMeleeDamage); - WEAPON_DUMP_FIELD(iDamageType); - WEAPON_DUMP_FIELD(iFireDelay); - WEAPON_DUMP_FIELD(iMeleeDelay); - WEAPON_DUMP_FIELD(meleeChargeDelay); - WEAPON_DUMP_FIELD(iDetonateDelay); - WEAPON_DUMP_FIELD(iRechamberTime); - WEAPON_DUMP_FIELD(iRechamberOneHanded); - WEAPON_DUMP_FIELD(iRechamberBoltTime); - WEAPON_DUMP_FIELD(iHoldFireTime); - WEAPON_DUMP_FIELD(iDetonateTime); - WEAPON_DUMP_FIELD(iMeleeTime); - WEAPON_DUMP_FIELD(meleeChargeTime); - WEAPON_DUMP_FIELD(iReloadTime); - WEAPON_DUMP_FIELD(reloadShowRocketTime); - WEAPON_DUMP_FIELD(iReloadEmptyTime); - WEAPON_DUMP_FIELD(iReloadAddTime); - WEAPON_DUMP_FIELD(iReloadStartTime); - WEAPON_DUMP_FIELD(iReloadStartAddTime); - WEAPON_DUMP_FIELD(iReloadEndTime); - WEAPON_DUMP_FIELD(iDropTime); - WEAPON_DUMP_FIELD(iRaiseTime); - WEAPON_DUMP_FIELD(iAltDropTime); - WEAPON_DUMP_FIELD(quickDropTime); - WEAPON_DUMP_FIELD(quickRaiseTime); - WEAPON_DUMP_FIELD(iFirstRaiseTime); - WEAPON_DUMP_FIELD(iEmptyRaiseTime); - WEAPON_DUMP_FIELD(iEmptyDropTime); - WEAPON_DUMP_FIELD(sprintInTime); - WEAPON_DUMP_FIELD(sprintLoopTime); - WEAPON_DUMP_FIELD(sprintOutTime); - WEAPON_DUMP_FIELD(stunnedTimeBegin); - WEAPON_DUMP_FIELD(stunnedTimeLoop); - WEAPON_DUMP_FIELD(stunnedTimeEnd); - WEAPON_DUMP_FIELD(nightVisionWearTime); - WEAPON_DUMP_FIELD(nightVisionWearTimeFadeOutEnd); - WEAPON_DUMP_FIELD(nightVisionWearTimePowerUp); - WEAPON_DUMP_FIELD(nightVisionRemoveTime); - WEAPON_DUMP_FIELD(nightVisionRemoveTimePowerDown); - WEAPON_DUMP_FIELD(nightVisionRemoveTimeFadeInStart); - WEAPON_DUMP_FIELD(fuseTime); - WEAPON_DUMP_FIELD(aifuseTime); - WEAPON_DUMP_FIELD(autoAimRange); - WEAPON_DUMP_FIELD(aimAssistRange); - WEAPON_DUMP_FIELD(aimAssistRangeAds); - WEAPON_DUMP_FIELD(aimPadding); - WEAPON_DUMP_FIELD(enemyCrosshairRange); - WEAPON_DUMP_FIELD(moveSpeedScale); - WEAPON_DUMP_FIELD(adsMoveSpeedScale); - WEAPON_DUMP_FIELD(sprintDurationScale); - WEAPON_DUMP_FIELD(adsZoomInFrac); - WEAPON_DUMP_FIELD(adsZoomOutFrac); - WEAPON_DUMP_ASSET(AdsOverlayShader); - WEAPON_DUMP_ASSET(AdsOverlayShaderLowRes); - WEAPON_DUMP_ASSET(AdsOverlayShaderEMP); - WEAPON_DUMP_ASSET(AdsOverlayShaderEMPLowRes); - // weapOverlayReticle_t adsOverlayReticle); - // weapOverlayInterface_t adsOverlayInterface);*/ - WEAPON_DUMP_FIELD(adsOverlayWidth); - WEAPON_DUMP_FIELD(adsOverlayHeight); - WEAPON_DUMP_FIELD(adsOverlayWidthSplitscreen); - WEAPON_DUMP_FIELD(adsOverlayHeightSplitscreen); - WEAPON_DUMP_FIELD(fAdsBobFactor); - WEAPON_DUMP_FIELD(fAdsViewBobMult); - WEAPON_DUMP_FIELD(fHipSpreadStandMin); - WEAPON_DUMP_FIELD(fHipSpreadDuckedMin); - WEAPON_DUMP_FIELD(fHipSpreadProneMin); - WEAPON_DUMP_FIELD(hipSpreadStandMax); - WEAPON_DUMP_FIELD(hipSpreadDuckedMax); - WEAPON_DUMP_FIELD(hipSpreadProneMax); - WEAPON_DUMP_FIELD(fHipSpreadDecayRate); - WEAPON_DUMP_FIELD(fHipSpreadFireAdd); - WEAPON_DUMP_FIELD(fHipSpreadTurnAdd); - WEAPON_DUMP_FIELD(fHipSpreadMoveAdd); - WEAPON_DUMP_FIELD(fHipSpreadDuckedDecay); - WEAPON_DUMP_FIELD(fHipSpreadProneDecay); - WEAPON_DUMP_FIELD(fHipReticleSidePos); - WEAPON_DUMP_FIELD(fAdsIdleAmount); - WEAPON_DUMP_FIELD(fHipIdleAmount); - WEAPON_DUMP_FIELD(adsIdleSpeed); - WEAPON_DUMP_FIELD(hipIdleSpeed); - WEAPON_DUMP_FIELD(fIdleCrouchFactor); - WEAPON_DUMP_FIELD(fIdleProneFactor); - WEAPON_DUMP_FIELD(fGunMaxPitch); - WEAPON_DUMP_FIELD(fGunMaxYaw); - WEAPON_DUMP_FIELD(swayMaxAngle); - WEAPON_DUMP_FIELD(swayLerpSpeed); - WEAPON_DUMP_FIELD(swayPitchScale); - WEAPON_DUMP_FIELD(swayYawScale); - WEAPON_DUMP_FIELD(swayHorizScale); - WEAPON_DUMP_FIELD(swayVertScale); - WEAPON_DUMP_FIELD(swayShellShockScale); - WEAPON_DUMP_FIELD(adsSwayMaxAngle); - WEAPON_DUMP_FIELD(adsSwayLerpSpeed); - WEAPON_DUMP_FIELD(adsSwayPitchScale); - WEAPON_DUMP_FIELD(adsSwayYawScale); - WEAPON_DUMP_FIELD(adsSwayHorizScale); - WEAPON_DUMP_FIELD(adsSwayVertScale); - WEAPON_DUMP_FIELD(adsViewErrorMin); - WEAPON_DUMP_FIELD(adsViewErrorMax); - // _BYTE idk[8]); - WEAPON_DUMP_ASSET(collisions); - WEAPON_DUMP_FIELD(dualWieldViewModelOffset); - // weaponIconRatioType_t killIconRatio); - WEAPON_DUMP_FIELD(iReloadAmmoAdd); - WEAPON_DUMP_FIELD(iReloadStartAdd); - WEAPON_DUMP_FIELD(iDropAmmoMin); - WEAPON_DUMP_FIELD(ammoDropClipPercentMin); - WEAPON_DUMP_FIELD(ammoDropClipPercentMax); - WEAPON_DUMP_FIELD(iExplosionRadius); - WEAPON_DUMP_FIELD(iExplosionRadiusMin); - WEAPON_DUMP_FIELD(iExplosionInnerDamage); - WEAPON_DUMP_FIELD(iExplosionOuterDamage); - WEAPON_DUMP_FIELD(damageConeAngle); - WEAPON_DUMP_FIELD(bulletExplDmgMult); - WEAPON_DUMP_FIELD(bulletExplRadiusMult); - WEAPON_DUMP_FIELD(iProjectileSpeed); - WEAPON_DUMP_FIELD(iProjectileSpeedUp); - WEAPON_DUMP_FIELD(iProjectileSpeedForward); - WEAPON_DUMP_FIELD(iProjectileActivateDist); - WEAPON_DUMP_FIELD(projLifetime); - WEAPON_DUMP_FIELD(timeToAccelerate); - WEAPON_DUMP_FIELD(projectileCurvature); - WEAPON_DUMP_ASSET(projectileModel); - // weapProjExplosion_t projExplosiveType); - WEAPON_DUMP_ASSET(projExplosionEffect); - WEAPON_DUMP_ASSET(projDudEffect); - WEAPON_DUMP_ASSET(projExplosionSound); - WEAPON_DUMP_ASSET(projDudSound); - // WeapStickinessType stickiness);*/ - WEAPON_DUMP_FIELD(lowAmmoWarningThreshold); - WEAPON_DUMP_FIELD(ricochetChance); - // WEAPON_DUMP_FIELD(* parallelBounce); //Refer to surfaceNames_t - // WEAPON_DUMP_FIELD(* perpendicularBounce); //Refer to surfaceNames_t - // _BYTE gap52D[4]); - // WEAPON_DUMP_FIELD(unkStruct124_1); - // WEAPON_DUMP_FIELD(unkStruct124_2); - WEAPON_DUMP_ASSET(projTrailEffect); - WEAPON_DUMP_ASSET(projBeaconEffect); - // WEAPON_DUMP_FIELD(vProjectileColor[3]); - // guidedMissileType_t guidedMissileType); - WEAPON_DUMP_FIELD(maxSteeringAccel); - WEAPON_DUMP_FIELD(projIgnitionDelay); - WEAPON_DUMP_ASSET(projIgnitionEffect); - WEAPON_DUMP_ASSET(projIgnitionSound); - WEAPON_DUMP_FIELD(fAdsAimPitch); - WEAPON_DUMP_FIELD(fAdsCrosshairInFrac); - WEAPON_DUMP_FIELD(fAdsCrosshairOutFrac); - WEAPON_DUMP_FIELD(adsGunKickReducedKickBullets); - WEAPON_DUMP_FIELD(adsGunKickReducedKickPercent); - WEAPON_DUMP_FIELD(fAdsGunKickPitchMin); - WEAPON_DUMP_FIELD(fAdsGunKickPitchMax); - WEAPON_DUMP_FIELD(fAdsGunKickYawMin); - WEAPON_DUMP_FIELD(fAdsGunKickYawMax); - WEAPON_DUMP_FIELD(fAdsGunKickAccel); - WEAPON_DUMP_FIELD(fAdsGunKickSpeedMax); - WEAPON_DUMP_FIELD(fAdsGunKickSpeedDecay); - WEAPON_DUMP_FIELD(fAdsGunKickStaticDecay); - WEAPON_DUMP_FIELD(fAdsViewKickPitchMin); - WEAPON_DUMP_FIELD(fAdsViewKickPitchMax); - WEAPON_DUMP_FIELD(fAdsViewKickYawMin); - WEAPON_DUMP_FIELD(fAdsViewKickYawMax); - WEAPON_DUMP_FIELD(fAdsViewScatterMin); - WEAPON_DUMP_FIELD(fAdsViewScatterMax); - WEAPON_DUMP_FIELD(fAdsSpread); - WEAPON_DUMP_FIELD(hipGunKickReducedKickBullets); - WEAPON_DUMP_FIELD(hipGunKickReducedKickPercent); - WEAPON_DUMP_FIELD(fHipGunKickPitchMin); - WEAPON_DUMP_FIELD(fHipGunKickPitchMax); - WEAPON_DUMP_FIELD(fHipGunKickYawMin); - WEAPON_DUMP_FIELD(fHipGunKickYawMax); - WEAPON_DUMP_FIELD(fHipGunKickAccel); - WEAPON_DUMP_FIELD(fHipGunKickSpeedMax); - WEAPON_DUMP_FIELD(fHipGunKickSpeedDecay); - WEAPON_DUMP_FIELD(fHipGunKickStaticDecay); - WEAPON_DUMP_FIELD(fHipViewKickPitchMin); - WEAPON_DUMP_FIELD(fHipViewKickPitchMax); - WEAPON_DUMP_FIELD(fHipViewKickYawMin); - WEAPON_DUMP_FIELD(fHipViewKickYawMax); - WEAPON_DUMP_FIELD(fHipViewScatterMin); - WEAPON_DUMP_FIELD(fHipViewScatterMax); - WEAPON_DUMP_FIELD(fightDist); - WEAPON_DUMP_FIELD(maxDist); - WEAPON_DUMP_FIELD(iPositionReloadTransTime); - WEAPON_DUMP_FIELD(leftArc); - WEAPON_DUMP_FIELD(rightArc); - WEAPON_DUMP_FIELD(topArc); - WEAPON_DUMP_FIELD(bottomArc); - WEAPON_DUMP_FIELD(accuracy); - WEAPON_DUMP_FIELD(aiSpread); - WEAPON_DUMP_FIELD(playerSpread); - WEAPON_DUMP_FIELD(minVertTurnSpeed); - WEAPON_DUMP_FIELD(minHorTurnSpeed); - WEAPON_DUMP_FIELD(maxVertTurnSpeed); - WEAPON_DUMP_FIELD(maxHorTurnSpeed); - WEAPON_DUMP_FIELD(pitchConvergenceTime); - WEAPON_DUMP_FIELD(yawConvergenceTime); - WEAPON_DUMP_FIELD(suppressTime); - WEAPON_DUMP_FIELD(maxRange); - WEAPON_DUMP_FIELD(fAnimHorRotateInc); - WEAPON_DUMP_FIELD(fPlayerPositionDist); - WEAPON_DUMP_FIELD(szUseHintString); - WEAPON_DUMP_FIELD(dropHintString); - WEAPON_DUMP_FIELD(iUseHintStringIndex); - WEAPON_DUMP_FIELD(dropHintStringIndex); - WEAPON_DUMP_FIELD(horizViewJitter); - WEAPON_DUMP_FIELD(vertViewJitter); - WEAPON_DUMP_FIELD(scanSpeed); - WEAPON_DUMP_FIELD(scanAccel); - WEAPON_DUMP_FIELD(scanPauseTime); - WEAPON_DUMP_FIELD(szScript); - // WEAPON_DUMP_FIELD(fOOPosAnimLength[2]); - WEAPON_DUMP_FIELD(minDamage); - WEAPON_DUMP_FIELD(minPlayerDamage); - WEAPON_DUMP_FIELD(maxDamageRange); - WEAPON_DUMP_FIELD(minDamageRange); - WEAPON_DUMP_FIELD(destabilizationRateTime); - WEAPON_DUMP_FIELD(destabilizationCurvatureMax); - WEAPON_DUMP_FIELD(destabilizeDistance); - // float* locationDamageMultipliers); - WEAPON_DUMP_FIELD(fireRumble); - WEAPON_DUMP_FIELD(meleeImpactRumble); - WEAPON_DUMP_ASSET(tracer); - WEAPON_DUMP_ASSET(turretOverheatSound); - WEAPON_DUMP_ASSET(turretOverheatEffect); - WEAPON_DUMP_FIELD(turretBarrelSpinRumble); - WEAPON_DUMP_FIELD(turretBarrelSpinUpTime); - WEAPON_DUMP_FIELD(turretBarrelSpinDownTime); - WEAPON_DUMP_FIELD(turretBarrelSpinSpeed); - WEAPON_DUMP_ASSET(turretBarrelSpinMaxSnd); - - for (int i = 0; i < 4; i++) - { - if (asset->turretBarrelSpinUpSnds && asset->turretBarrelSpinUpSnds[i]) - { - data["turretBarrelSpinUpSnds"][i] = asset->turretBarrelSpinUpSnds[i]->name; - } - else - { - data["turretBarrelSpinUpSnds"][i] = ""; - } - - if (asset->turretBarrelSpinDownSnds && asset->turretBarrelSpinDownSnds[i]) - { - data["turretBarrelSpinDownSnds"][i] = asset->turretBarrelSpinDownSnds[i]->name; - } - else - { - data["turretBarrelSpinDownSnds"][i] = ""; - } - } - - WEAPON_DUMP_ASSET(missileConeSoundAlias); - WEAPON_DUMP_ASSET(missileConeSoundAliasAtBase); - WEAPON_DUMP_FIELD(missileConeSoundRadiusAtTop); - WEAPON_DUMP_FIELD(missileConeSoundRadiusAtBase); - WEAPON_DUMP_FIELD(missileConeSoundHeight); - WEAPON_DUMP_FIELD(missileConeSoundOriginOffset); - WEAPON_DUMP_FIELD(missileConeSoundVolumescaleAtCore); - WEAPON_DUMP_FIELD(missileConeSoundVolumescaleAtEdge); - WEAPON_DUMP_FIELD(missileConeSoundVolumescaleCoreSize); - WEAPON_DUMP_FIELD(missileConeSoundPitchAtTop); - WEAPON_DUMP_FIELD(missileConeSoundPitchAtBottom); - WEAPON_DUMP_FIELD(missileConeSoundPitchTopSize); - WEAPON_DUMP_FIELD(missileConeSoundPitchBottomSize); - WEAPON_DUMP_FIELD(missileConeSoundCrossfadeTopSize); - WEAPON_DUMP_FIELD(missileConeSoundCrossfadeBottomSize); - WEAPON_DUMP_FIELD(shareAmmo); - WEAPON_DUMP_FIELD(lockonSupported); - WEAPON_DUMP_FIELD(requireLockonToFire); - WEAPON_DUMP_FIELD(bigExplosion); - WEAPON_DUMP_FIELD(noAdsWhenMagEmpty); - WEAPON_DUMP_FIELD(avoidDropCleanup); - WEAPON_DUMP_FIELD(inheritsPerks); - WEAPON_DUMP_FIELD(crosshairColorChange); - WEAPON_DUMP_FIELD(rifleBullet); - WEAPON_DUMP_FIELD(armorPiercing); - WEAPON_DUMP_FIELD(boltAction); - WEAPON_DUMP_FIELD(aimDownSight); - WEAPON_DUMP_FIELD(rechamberWhileAds); - WEAPON_DUMP_FIELD(bBulletExplosiveDamage); - WEAPON_DUMP_FIELD(cookOffHold); - WEAPON_DUMP_FIELD(clipOnly); - WEAPON_DUMP_FIELD(noAmmoPickup); - WEAPON_DUMP_FIELD(adsFire); - WEAPON_DUMP_FIELD(cancelAutoHolsterWhenEmpty); - WEAPON_DUMP_FIELD(disableSwitchToWhenEmpty); - WEAPON_DUMP_FIELD(suppressAmmoReserveDisplay); - WEAPON_DUMP_FIELD(laserSightDuringNightvision); - WEAPON_DUMP_FIELD(markableViewmodel); - WEAPON_DUMP_FIELD(noDualWield); - WEAPON_DUMP_FIELD(flipKillIcon); - WEAPON_DUMP_FIELD(noPartialReload); - WEAPON_DUMP_FIELD(segmentedReload); - WEAPON_DUMP_FIELD(blocksProne); - WEAPON_DUMP_FIELD(silenced); - WEAPON_DUMP_FIELD(isRollingGrenade); - WEAPON_DUMP_FIELD(projExplosionEffectForceNormalUp); - WEAPON_DUMP_FIELD(projImpactExplode); - WEAPON_DUMP_FIELD(stickToPlayers); - WEAPON_DUMP_FIELD(hasDetonator); - WEAPON_DUMP_FIELD(disableFiring); - WEAPON_DUMP_FIELD(timedDetonation); - WEAPON_DUMP_FIELD(rotate); - WEAPON_DUMP_FIELD(holdButtonToThrow); - WEAPON_DUMP_FIELD(freezeMovementWhenFiring); - WEAPON_DUMP_FIELD(thermalScope); - WEAPON_DUMP_FIELD(altModeSameWeapon); - WEAPON_DUMP_FIELD(turretBarrelSpinEnabled); - WEAPON_DUMP_FIELD(missileConeSoundEnabled); - WEAPON_DUMP_FIELD(missileConeSoundPitchshiftEnabled); - WEAPON_DUMP_FIELD(missileConeSoundCrossfadeEnabled); - WEAPON_DUMP_FIELD(offhandHoldIsCancelable); - - return data; - } - - Json IWeaponDef::dump_complete(WeaponCompleteDef* asset, - const std::function& convertToString) - { - Json data; - data["baseAsset"] = asset->name; - data["WeaponDef"] = dump_weapondef(asset->WeaponDef, convertToString); - - WEAPON_DUMP_FIELD(name); - WEAPON_DUMP_FIELD(displayName); - - for (int i = 0; i < 32; i++) - { - if (asset->hideTags && asset->hideTags[i]) - { - data["hideTags"][i] = convertToString(asset->hideTags[i]); - } - else - { - data["hideTags"][i] = ""; - } - } - - for (int i = 0; i < 6; i++) - { - if (asset->attachment1 && asset->attachment1[i]) - { - data["attachment1"][i] = asset->attachment1[i]->szInternalName; - } - else - { - data["attachment1"][i] = ""; - } - - if (i >= 4) continue; - - if (asset->attachment3 && asset->attachment3[i]) - { - data["attachment3"][i] = asset->attachment3[i]->szInternalName; - } - else - { - data["attachment3"][i] = ""; - } - - if (i >= 3) continue; - - if (asset->attachment2 && asset->attachment2[i]) - { - data["attachment2"][i] = asset->attachment2[i]->szInternalName; - } - else - { - data["attachment2"][i] = ""; - } - } - - for (int i = 0; i < 42; i++) - { - if (asset->szXAnims && asset->szXAnims[i]) - { - data["szXAnims"][i] = asset->szXAnims[i]; - } - else - { - data["szXAnims"][i] = ""; - } - } - - for (int i = 0; i < asset->numAnimOverrides; i++) - { - data["animOverrides"][i]["altmodeAnim"] = (asset->animOverrides[i].altmodeAnim) - ? asset->animOverrides[i].altmodeAnim - : ""; - data["animOverrides"][i]["overrideAnim"] = (asset->animOverrides[i].overrideAnim) - ? asset->animOverrides[i].overrideAnim - : ""; - data["animOverrides"][i]["attachment1"] = asset->animOverrides[i].attachment1; - data["animOverrides"][i]["attachment2"] = asset->animOverrides[i].attachment2; - data["animOverrides"][i]["altTime"] = asset->animOverrides[i].altTime; - data["animOverrides"][i]["animTime"] = asset->animOverrides[i].animTime; - data["animOverrides"][i]["animTreeType"] = asset->animOverrides[i].animTreeType; - } - - for (int i = 0; i < asset->numSoundOverrides; i++) - { - data["soundOverrides"][i]["altmodeSound"] = (asset->soundOverrides[i].altmodeSound) - ? asset->soundOverrides[i].altmodeSound->name - : ""; - data["soundOverrides"][i]["attachment1"] = asset->soundOverrides[i].attachment1; - data["soundOverrides"][i]["attachment2"] = asset->soundOverrides[i].attachment2; - data["soundOverrides"][i]["overrideSound"] = (asset->soundOverrides[i].overrideSound) - ? asset->soundOverrides[i].overrideSound->name - : ""; - data["soundOverrides"][i]["soundType"] = asset->soundOverrides[i].soundType; - } - - for (int i = 0; i < asset->numFXOverrides; i++) - { - data["fxOverrides"][i]["altmodeFX"] = (asset->fxOverrides[i].altmodeFX) - ? asset->fxOverrides[i].altmodeFX->name - : ""; - data["fxOverrides"][i]["attachment1"] = asset->fxOverrides[i].attachment1; - data["fxOverrides"][i]["attachment2"] = asset->fxOverrides[i].attachment2; - data["fxOverrides"][i]["fxType"] = asset->fxOverrides[i].fxType; - data["fxOverrides"][i]["overrideFX"] = (asset->fxOverrides[i].overrideFX) - ? asset->fxOverrides[i].overrideFX->name - : ""; - } - - for (int i = 0; i < asset->numReloadStateTimerOverrides; i++) - { - data["reloadOverrides"][i]["attachment"] = asset->reloadOverrides[i].attachment; - data["reloadOverrides"][i]["reloadAddTime"] = asset->reloadOverrides[i].reloadAddTime; - data["reloadOverrides"][i]["reloadEmptyAddTime"] = asset->reloadOverrides[i].reloadEmptyAddTime; - } - - for (int i = 0; i < asset->numNotetrackOverrides; i++) - { - data["notetrackOverrides"][i]["attachment"] = asset->notetrackOverrides[i].attachment; - - for (int j = 0; j < 24; j++) - { - data["notetrackOverrides"][i]["notetrackSoundMapKeys"][j] = convertToString( - asset->notetrackOverrides[i].notetrackSoundMapKeys[j]); - data["notetrackOverrides"][i]["notetrackSoundMapValues"][j] = convertToString( - asset->notetrackOverrides[i].notetrackSoundMapValues[j]); - } - } - - WEAPON_DUMP_FIELD(numAnimOverrides); - WEAPON_DUMP_FIELD(numSoundOverrides); - WEAPON_DUMP_FIELD(numFXOverrides); - WEAPON_DUMP_FIELD(numReloadStateTimerOverrides); - WEAPON_DUMP_FIELD(numNotetrackOverrides); - WEAPON_DUMP_FIELD(iAdsTransInTime); - WEAPON_DUMP_FIELD(iAdsTransOutTime); - WEAPON_DUMP_FIELD(iClipSize); - WEAPON_DUMP_FIELD(impactType); - WEAPON_DUMP_FIELD(iFireTime); - WEAPON_DUMP_FIELD(dpadIconRatio); - WEAPON_DUMP_FIELD(iPenetrateMultiplier); - WEAPON_DUMP_FIELD(fAdsViewKickCenterSpeed); - WEAPON_DUMP_FIELD(fHipViewKickCenterSpeed); - WEAPON_DUMP_FIELD(altWeaponName); - WEAPON_DUMP_FIELD(altWeaponIndex); - WEAPON_DUMP_FIELD(iAltRaiseTime); - WEAPON_DUMP_FIELD(iAltRaiseTimeAkimbo); - WEAPON_DUMP_ASSET(killIcon); - WEAPON_DUMP_ASSET(dpadIcon); - WEAPON_DUMP_FIELD(iDropAmmoMax); - WEAPON_DUMP_FIELD(motionTracker); - WEAPON_DUMP_FIELD(enhanced); - WEAPON_DUMP_FIELD(dpadIconShowsAmmo); - - return data; - } - void IWeaponDef::dump(WeaponCompleteDef* asset, const std::function& convertToString) { - std::string path = "weapons/mp/"s + asset->name; - std::string json = dump_complete(asset, convertToString).dump(4); - - auto file = FileSystem::FileOpen(path, "w"s); - fwrite(json.data(), json.size(), 1, file); - FileSystem::FileClose(file); + } } } diff --git a/src/IW5/Assets/WeaponDef.hpp b/src/IW5/Assets/WeaponDef.hpp index 976d3ca..f3ae612 100644 --- a/src/IW5/Assets/WeaponDef.hpp +++ b/src/IW5/Assets/WeaponDef.hpp @@ -21,11 +21,6 @@ namespace ZoneTool WeaponCompleteDef* asset_; public: - IWeaponDef(); - ~IWeaponDef(); - - WeaponDef* parse_weapondef(Json& data, WeaponCompleteDef* baseAsset, ZoneMemory* mem); - WeaponCompleteDef* parse(const std::string& name, ZoneMemory* mem); void init(const std::string& name, ZoneMemory* mem) override; @@ -39,10 +34,6 @@ namespace ZoneTool void write(IZone* zone, ZoneBuffer* buffer) override; void write_WeaponDef(IZone* zone, ZoneBuffer* buf, WeaponCompleteDef* complete, WeaponDef* data); - - static Json dump_weapondef(WeaponDef* asset, const std::function& convertToString); - static Json dump_complete(WeaponCompleteDef* asset, - const std::function& convertToString); static void dump(WeaponCompleteDef* asset, const std::function& convertToString = SL_ConvertToString); }; diff --git a/src/IW5/Structs.hpp b/src/IW5/Structs.hpp index bfbeccd..e044bed 100644 --- a/src/IW5/Structs.hpp +++ b/src/IW5/Structs.hpp @@ -2446,6 +2446,11 @@ namespace ZoneTool DynEntityColl* dynEntCollList[2]; char pad3[20]; std::uint32_t isPlutoniumMap; + + void test() + { + + } }; #pragma pack(pop) @@ -3248,454 +3253,461 @@ namespace ZoneTool typedef BYTE _BYTE; + struct StateTimers + { + int iFireDelay; + int iMeleeDelay; + int meleeChargeDelay; + int iDetonateDelay; + int iRechamberTime; + int rechamberTimeOneHanded; + int iRechamberBoltTime; + int iHoldFireTime; + int iDetonateTime; + int iMeleeTime; + int meleeChargeTime; + int iReloadTime; + int reloadShowRocketTime; + int iReloadEmptyTime; + int iReloadAddTime; + int iReloadStartTime; + int iReloadStartAddTime; + int iReloadEndTime; + int iDropTime; + int iRaiseTime; + int iAltDropTime; + int quickDropTime; + int quickRaiseTime; + int iBreachRaiseTime; + int iEmptyRaiseTime; + int iEmptyDropTime; + int sprintInTime; + int sprintLoopTime; + int sprintOutTime; + int stunnedTimeBegin; + int stunnedTimeLoop; + int stunnedTimeEnd; + int nightVisionWearTime; + int nightVisionWearTimeFadeOutEnd; + int nightVisionWearTimePowerUp; + int nightVisionRemoveTime; + int nightVisionRemoveTimePowerDown; + int nightVisionRemoveTimeFadeInStart; + int fuseTime; + int aiFuseTime; + int blastFrontTime; + int blastRightTime; + int blastBackTime; + int blastLeftTime; + int raiseInterruptableTime; + int firstRaiseInterruptableTime; + int reloadInterruptableTime; + int reloadEmptyInterruptableTime; + int fireInterruptableTime; + }; struct WeaponDef { + const char* szOverlayName; + XModel** gunXModel; + XModel* handXModel; + const char** szXAnimsRightHanded; + const char** szXAnimsLeftHanded; + const char* szModeName; + __int16* notetrackSoundMapKeys; + __int16* notetrackSoundMapValues; + __int16* notetrackRumbleMapKeys; + __int16* notetrackRumbleMapValues; + int playerAnimType; + int weapType; + int weapClass; + int penetrateType; + int inventoryType; + int fireType; + int offhandClass; + int stance; + FxEffectDef* viewFlashEffect; + FxEffectDef* worldFlashEffect; union { struct { - char* szInternalName; - XModel** gunXModel; - XModel* handXModel; - const char** szXAnimsR; - const char** szXAnimsL; - const char* szModeName; - short* notetrackSoundMapKeys; - short* notetrackSoundMapValues; - short* notetrackRumbleMapKeys; - short* notetrackRumbleMapValues; - int playerAnimType; - int weaponType; - int weaponClass; - int penetrateType; - int inventoryType; - int fireType; - int offhandClass; - int stance; - FxEffectDef* viewFlashEffect; - FxEffectDef* worldFlashEffect; - snd_alias_list_t* sounds[48]; - }; - - char _portpad0[268]; - }; - - snd_alias_list_t** sndArray1; // 31 - snd_alias_list_t** sndArray2; // 31 - union - { - struct - { - FxEffectDef* viewShellEjectEffect; - FxEffectDef* worldShellEjectEffect; - FxEffectDef* viewLastShotEjectEffect; - FxEffectDef* worldLastShotEjectEffect; - Material* reticleCenter; - Material* reticleSide; - int iReticleCenterSize; - int iReticleSideSize; - int iReticleMinOfs; - activeReticleType_t activeReticleType; - float vStandMove[3]; - float vStandRot[3]; - float vStrafeMove[3]; - float vStrafeRot[3]; - float vDuckedOfs[3]; - float vDuckedMove[3]; - float vDuckedRot[3]; - float vProneOfs[3]; - float vProneMove[3]; - float vProneRot[3]; - float fPosMoveRate; - float fPosProneMoveRate; - float fStandMoveMinSpeed; - float fDuckedMoveMinSpeed; - float fProneMoveMinSpeed; - float fPosRotRate; - float fPosProneRotRate; - float fStandRotMinSpeed; - float fDuckedRotMinSpeed; - float fProneRotMinSpeed; - XModel** worldModel; - XModel* worldClipModel; - XModel* rocketModel; - XModel* knifeModel; - XModel* worldKnifeModel; - Material* hudIcon; - weaponIconRatioType_t hudIconRatio; - Material* pickupIcon; - weaponIconRatioType_t pickupIconRatio; - Material* ammoCounterIcon; - weaponIconRatioType_t ammoCounterIconRatio; - ammoCounterClipType_t ammoCounterClip; - int iStartAmmo; - char* szAmmoName; - int iAmmoIndex; - char* szClipName; - int iClipIndex; - int iMaxAmmo; - int shotCount; - char* szSharedAmmoCapName; - int iSharedAmmoCapIndex; - int iSharedAmmoCap; - int damage; - int playerDamage; - int iMeleeDamage; - int iDamageType; - int iFireDelay; - int iMeleeDelay; - int meleeChargeDelay; - int iDetonateDelay; - int iRechamberTime; - int iRechamberOneHanded; - int iRechamberBoltTime; - int iHoldFireTime; - int iDetonateTime; - int iMeleeTime; - int meleeChargeTime; - int iReloadTime; - int reloadShowRocketTime; - int iReloadEmptyTime; - int iReloadAddTime; - int iReloadStartTime; - int iReloadStartAddTime; - int iReloadEndTime; - int iDropTime; - int iRaiseTime; - int iAltDropTime; - int quickDropTime; - int quickRaiseTime; - int iFirstRaiseTime; - int iEmptyRaiseTime; - int iEmptyDropTime; - int sprintInTime; - int sprintLoopTime; - int sprintOutTime; - int stunnedTimeBegin; - int stunnedTimeLoop; - int stunnedTimeEnd; - int nightVisionWearTime; - int nightVisionWearTimeFadeOutEnd; - int nightVisionWearTimePowerUp; - int nightVisionRemoveTime; - int nightVisionRemoveTimePowerDown; - int nightVisionRemoveTimeFadeInStart; - int fuseTime; - int aifuseTime; - }; - - char _portpad1[464]; - }; - - _BYTE gap22D[232]; - - union - { - struct - { - float autoAimRange; - float aimAssistRange; - float aimAssistRangeAds; - float aimPadding; - float enemyCrosshairRange; - float moveSpeedScale; - float adsMoveSpeedScale; - float sprintDurationScale; - float adsZoomInFrac; - float adsZoomOutFrac; - Material* AdsOverlayShader; - Material* AdsOverlayShaderLowRes; - Material* AdsOverlayShaderEMP; - Material* AdsOverlayShaderEMPLowRes; - weapOverlayReticle_t adsOverlayReticle; - weapOverlayInterface_t adsOverlayInterface; - float adsOverlayWidth; - float adsOverlayHeight; - float adsOverlayWidthSplitscreen; - float adsOverlayHeightSplitscreen; - float fAdsBobFactor; - float fAdsViewBobMult; - float fHipSpreadStandMin; - float fHipSpreadDuckedMin; - float fHipSpreadProneMin; - float hipSpreadStandMax; - float hipSpreadDuckedMax; - float hipSpreadProneMax; - float fHipSpreadDecayRate; - float fHipSpreadFireAdd; - float fHipSpreadTurnAdd; - float fHipSpreadMoveAdd; - float fHipSpreadDuckedDecay; - float fHipSpreadProneDecay; - float fHipReticleSidePos; - float fAdsIdleAmount; - float fHipIdleAmount; - }; - - char _portpad6[148]; - }; - - _BYTE idk[8]; - - union - { - struct - { - float adsIdleSpeed; - float hipIdleSpeed; - float fIdleCrouchFactor; - float fIdleProneFactor; - float fGunMaxPitch; - float fGunMaxYaw; - float swayMaxAngle; - float swayLerpSpeed; - float swayPitchScale; - float swayYawScale; - float swayHorizScale; - float swayVertScale; - float swayShellShockScale; - float adsSwayMaxAngle; - float adsSwayLerpSpeed; - float adsSwayPitchScale; - float adsSwayYawScale; - float adsSwayHorizScale; - float adsSwayVertScale; - float adsViewErrorMin; - float adsViewErrorMax; - }; - - char _portpad2[84]; - }; - - union - { - struct - { - PhysCollmap* collisions; - float dualWieldViewModelOffset; - weaponIconRatioType_t killIconRatio; - int iReloadAmmoAdd; - int iReloadStartAdd; - int iDropAmmoMin; - int ammoDropClipPercentMin; - int ammoDropClipPercentMax; - int iExplosionRadius; - int iExplosionRadiusMin; - int iExplosionInnerDamage; - int iExplosionOuterDamage; - float damageConeAngle; - float bulletExplDmgMult; - float bulletExplRadiusMult; - int iProjectileSpeed; - int iProjectileSpeedUp; - int iProjectileSpeedForward; - int iProjectileActivateDist; - float projLifetime; - float timeToAccelerate; - float projectileCurvature; - XModel* projectileModel; - weapProjExplosion_t projExplosiveType; - FxEffectDef* projExplosionEffect; - FxEffectDef* projDudEffect; - snd_alias_list_t* projExplosionSound; - snd_alias_list_t* projDudSound; - WeapStickinessType stickiness; - float lowAmmoWarningThreshold; - float ricochetChance; - float* parallelBounce; //Refer to surfaceNames_t - float* perpendicularBounce; //Refer to surfaceNames_t - }; - - char _portpad3[132]; - }; - - _BYTE gap52D[4]; - char* unkStruct124_1; - char* unkStruct124_2; - - union - { - struct - { - FxEffectDef* projTrailEffect; - FxEffectDef* projBeaconEffect; - float vProjectileColor[3]; - guidedMissileType_t guidedMissileType; - float maxSteeringAccel; - float projIgnitionDelay; - FxEffectDef* projIgnitionEffect; - snd_alias_list_t* projIgnitionSound; - float fAdsAimPitch; - float fAdsCrosshairInFrac; - float fAdsCrosshairOutFrac; - int adsGunKickReducedKickBullets; - float adsGunKickReducedKickPercent; - float fAdsGunKickPitchMin; - float fAdsGunKickPitchMax; - float fAdsGunKickYawMin; - float fAdsGunKickYawMax; - float fAdsGunKickAccel; - float fAdsGunKickSpeedMax; - float fAdsGunKickSpeedDecay; - float fAdsGunKickStaticDecay; - float fAdsViewKickPitchMin; - float fAdsViewKickPitchMax; - float fAdsViewKickYawMin; - float fAdsViewKickYawMax; - float fAdsViewScatterMin; - float fAdsViewScatterMax; - float fAdsSpread; - int hipGunKickReducedKickBullets; - float hipGunKickReducedKickPercent; - float fHipGunKickPitchMin; - float fHipGunKickPitchMax; - float fHipGunKickYawMin; - float fHipGunKickYawMax; - float fHipGunKickAccel; - float fHipGunKickSpeedMax; - float fHipGunKickSpeedDecay; - float fHipGunKickStaticDecay; - float fHipViewKickPitchMin; - float fHipViewKickPitchMax; - float fHipViewKickYawMin; - float fHipViewKickYawMax; - float fHipViewScatterMin; - float fHipViewScatterMax; - float fightDist; - float maxDist; - const char* accuracyGraphName[2]; - vec2_t* accuracyGraphKnots; - vec2_t* originalAccuracyGraphKnots; - short accuracyGraphKnotCount; - short originalAccuracyGraphKnotCount; - int iPositionReloadTransTime; - float leftArc; - float rightArc; - float topArc; - float bottomArc; - float accuracy; - float aiSpread; - float playerSpread; - float minVertTurnSpeed; - float minHorTurnSpeed; - float maxVertTurnSpeed; - float maxHorTurnSpeed; - float pitchConvergenceTime; - float yawConvergenceTime; - float suppressTime; - float maxRange; - float fAnimHorRotateInc; - float fPlayerPositionDist; - char* szUseHintString; - char* dropHintString; - int iUseHintStringIndex; - int dropHintStringIndex; - float horizViewJitter; - float vertViewJitter; - float scanSpeed; - float scanAccel; - int scanPauseTime; - char* szScript; - float fOOPosAnimLength[2]; - int minDamage; - int minPlayerDamage; - float maxDamageRange; - float minDamageRange; - float destabilizationRateTime; - float destabilizationCurvatureMax; - int destabilizeDistance; - float* locationDamageMultipliers; - char* fireRumble; - char* meleeImpactRumble; - TracerDef* tracer; - _BYTE gap6C5[40]; - }; - - char _portpad4[400]; - }; - - union - { - struct - { - snd_alias_list_t* turretOverheatSound; - FxEffectDef* turretOverheatEffect; - const char* turretBarrelSpinRumble; - int turretBarrelSpinUpTime; - int turretBarrelSpinDownTime; - int turretBarrelSpinSpeed; - snd_alias_list_t* turretBarrelSpinMaxSnd; - snd_alias_list_t* turretBarrelSpinUpSnds[4]; - snd_alias_list_t* turretBarrelSpinDownSnds[4]; - snd_alias_list_t* missileConeSoundAlias; - snd_alias_list_t* missileConeSoundAliasAtBase; - float missileConeSoundRadiusAtTop; - float missileConeSoundRadiusAtBase; - float missileConeSoundHeight; - float missileConeSoundOriginOffset; - float missileConeSoundVolumescaleAtCore; - float missileConeSoundVolumescaleAtEdge; - float missileConeSoundVolumescaleCoreSize; - float missileConeSoundPitchAtTop; - float missileConeSoundPitchAtBottom; - float missileConeSoundPitchTopSize; - float missileConeSoundPitchBottomSize; - float missileConeSoundCrossfadeTopSize; - float missileConeSoundCrossfadeBottomSize; - bool shareAmmo; - bool lockonSupported; - bool requireLockonToFire; - bool bigExplosion; - bool noAdsWhenMagEmpty; - bool avoidDropCleanup; - bool inheritsPerks; - bool crosshairColorChange; - bool rifleBullet; - bool armorPiercing; - bool boltAction; - bool aimDownSight; - bool rechamberWhileAds; - bool bBulletExplosiveDamage; - bool cookOffHold; - bool clipOnly; - bool noAmmoPickup; - bool adsFire; - bool cancelAutoHolsterWhenEmpty; - bool disableSwitchToWhenEmpty; - bool suppressAmmoReserveDisplay; - bool laserSightDuringNightvision; - bool markableViewmodel; - bool noDualWield; - bool flipKillIcon; - bool noPartialReload; - bool segmentedReload; - bool blocksProne; - bool silenced; - bool isRollingGrenade; - bool projExplosionEffectForceNormalUp; - bool projImpactExplode; - bool stickToPlayers; - bool hasDetonator; - bool disableFiring; - bool timedDetonation; - bool rotate; - bool holdButtonToThrow; - bool freezeMovementWhenFiring; - bool thermalScope; - bool altModeSameWeapon; - bool turretBarrelSpinEnabled; - bool missileConeSoundEnabled; - bool missileConeSoundPitchshiftEnabled; - bool missileConeSoundCrossfadeEnabled; - bool offhandHoldIsCancelable; + snd_alias_list_t* pickupSound; + snd_alias_list_t* pickupSoundPlayer; + snd_alias_list_t* ammoPickupSound; + snd_alias_list_t* ammoPickupSoundPlayer; + snd_alias_list_t* projectileSound; + snd_alias_list_t* pullbackSound; + snd_alias_list_t* pullbackSoundPlayer; + snd_alias_list_t* fireSound; + snd_alias_list_t* fireSoundPlayer; + snd_alias_list_t* fireSoundPlayerAkimbo; + snd_alias_list_t* fireLoopSound; + snd_alias_list_t* fireLoopSoundPlayer; + snd_alias_list_t* fireStopSound; + snd_alias_list_t* fireStopSoundPlayer; + snd_alias_list_t* fireLastSound; + snd_alias_list_t* fireLastSoundPlayer; + snd_alias_list_t* emptyFireSound; + snd_alias_list_t* emptyFireSoundPlayer; + snd_alias_list_t* meleeSwipeSound; + snd_alias_list_t* meleeSwipeSoundPlayer; + snd_alias_list_t* meleeHitSound; + snd_alias_list_t* meleeMissSound; + snd_alias_list_t* rechamberSound; + snd_alias_list_t* rechamberSoundPlayer; + snd_alias_list_t* reloadSound; + snd_alias_list_t* reloadSoundPlayer; + snd_alias_list_t* reloadEmptySound; + snd_alias_list_t* reloadEmptySoundPlayer; + snd_alias_list_t* reloadStartSound; + snd_alias_list_t* reloadStartSoundPlayer; + snd_alias_list_t* reloadEndSound; + snd_alias_list_t* reloadEndSoundPlayer; + snd_alias_list_t* detonateSound; + snd_alias_list_t* detonateSoundPlayer; + snd_alias_list_t* nightVisionWearSound; + snd_alias_list_t* nightVisionWearSoundPlayer; + snd_alias_list_t* nightVisionRemoveSound; + snd_alias_list_t* nightVisionRemoveSoundPlayer; + snd_alias_list_t* altSwitchSound; + snd_alias_list_t* altSwitchSoundPlayer; + snd_alias_list_t* raiseSound; + snd_alias_list_t* raiseSoundPlayer; + snd_alias_list_t* firstRaiseSound; + snd_alias_list_t* firstRaiseSoundPlayer; + snd_alias_list_t* putawaySound; + snd_alias_list_t* putawaySoundPlayer; + snd_alias_list_t* scanSound; + snd_alias_list_t* changeVariableZoomSound; }; - - char _portpad5[168]; + snd_alias_list_t* sounds[48]; }; - - _BYTE gap731[4]; - short* unknownTag; - XModel* unknownXModel; + + snd_alias_list_t** bounceSound; + snd_alias_list_t** rollingSound; + FxEffectDef* viewShellEjectEffect; + FxEffectDef* worldShellEjectEffect; + FxEffectDef* viewLastShotEjectEffect; + FxEffectDef* worldLastShotEjectEffect; + Material* reticleCenter; + Material* reticleSide; + int iReticleCenterSize; + int iReticleSideSize; + int iReticleMinOfs; + activeReticleType_t activeReticleType; + float vStandMove[3]; + float vStandRot[3]; + float strafeMove[3]; + float strafeRot[3]; + float vDuckedOfs[3]; + float vDuckedMove[3]; + float vDuckedRot[3]; + float vProneOfs[3]; + float vProneMove[3]; + float vProneRot[3]; + float fPosMoveRate; + float fPosProneMoveRate; + float fStandMoveMinSpeed; + float fDuckedMoveMinSpeed; + float fProneMoveMinSpeed; + float fPosRotRate; + float fPosProneRotRate; + float fStandRotMinSpeed; + float fDuckedRotMinSpeed; + float fProneRotMinSpeed; + XModel** worldModel; + XModel* worldClipModel; + XModel* rocketModel; + XModel* knifeModel; + XModel* worldKnifeModel; + Material* hudIcon; + weaponIconRatioType_t hudIconRatio; + Material* pickupIcon; + weaponIconRatioType_t pickupIconRatio; + Material* ammoCounterIcon; + weaponIconRatioType_t ammoCounterIconRatio; + ammoCounterClipType_t ammoCounterClip; + int iStartAmmo; + const char* szAmmoName; + int iAmmoIndex; + const char* szClipName; + int iClipIndex; + int iMaxAmmo; + int shotCount; + const char* szSharedAmmoCapName; + int iSharedAmmoCapIndex; + int iSharedAmmoCap; + int damage; + int playerDamage; + int iMeleeDamage; + int iDamageType; + StateTimers stateTimers; + StateTimers akimboStateTimers; + float autoAimRange; + float aimAssistRange; + float aimAssistRangeAds; + float aimPadding; + float enemyCrosshairRange; + float moveSpeedScale; + float adsMoveSpeedScale; + float sprintDurationScale; + float fAdsZoomInFrac; + float fAdsZoomOutFrac; + ADSOverlay overlay; + int overlayInterface; + float fAdsBobFactor; + float fAdsViewBobMult; + float fHipSpreadStandMin; + float fHipSpreadDuckedMin; + float fHipSpreadProneMin; + float hipSpreadStandMax; + float hipSpreadDuckedMax; + float hipSpreadProneMax; + float fHipSpreadDecayRate; + float fHipSpreadFireAdd; + float fHipSpreadTurnAdd; + float fHipSpreadMoveAdd; + float fHipSpreadDuckedDecay; + float fHipSpreadProneDecay; + float fHipReticleSidePos; + float fAdsIdleAmount; + float fHipIdleAmount; + float adsIdleSpeed; + float hipIdleSpeed; + float fIdleCrouchFactor; + float fIdleProneFactor; + float fGunMaxPitch; + float fGunMaxYaw; + float adsIdleLerpStartTime; + float adsIdleLerpTime; + float swayMaxAngle; + float swayLerpSpeed; + float swayPitchScale; + float swayYawScale; + float swayHorizScale; + float swayVertScale; + float swayShellShockScale; + float adsSwayMaxAngle; + float adsSwayLerpSpeed; + float adsSwayPitchScale; + float adsSwayYawScale; + float adsSwayHorizScale; + float adsSwayVertScale; + float adsViewErrorMin; + float adsViewErrorMax; + PhysCollmap* physCollmap; + float dualWieldViewModelOffset; + weaponIconRatioType_t killIconRatio; + int iReloadAmmoAdd; + int iReloadStartAdd; + int ammoDropStockMin; + int ammoDropClipPercentMin; + int ammoDropClipPercentMax; + int iExplosionRadius; + int iExplosionRadiusMin; + int iExplosionInnerDamage; + int iExplosionOuterDamage; + float damageConeAngle; + float bulletExplDmgMult; + float bulletExplRadiusMult; + int iProjectileSpeed; + int iProjectileSpeedUp; + int iProjectileSpeedForward; + int iProjectileActivateDist; + float projLifetime; + float timeToAccelerate; + float projectileCurvature; + XModel* projectileModel; + int projExplosion; + FxEffectDef* projExplosionEffect; + FxEffectDef* projDudEffect; + snd_alias_list_t* projExplosionSound; + snd_alias_list_t* projDudSound; + WeapStickinessType stickiness; + float lowAmmoWarningThreshold; + float ricochetChance; + bool riotShieldEnableDamage; + int riotShieldHealth; + float riotShieldDamageMult; + float* parallelBounce; + float* perpendicularBounce; + FxEffectDef* projTrailEffect; + FxEffectDef* projBeaconEffect; + float vProjectileColor[3]; + guidedMissileType_t guidedMissileType; + float maxSteeringAccel; + int projIgnitionDelay; + FxEffectDef* projIgnitionEffect; + snd_alias_list_t* projIgnitionSound; + float fAdsAimPitch; + float fAdsCrosshairInFrac; + float fAdsCrosshairOutFrac; + int adsGunKickReducedKickBullets; + float adsGunKickReducedKickPercent; + float fAdsGunKickPitchMin; + float fAdsGunKickPitchMax; + float fAdsGunKickYawMin; + float fAdsGunKickYawMax; + float fAdsGunKickAccel; + float fAdsGunKickSpeedMax; + float fAdsGunKickSpeedDecay; + float fAdsGunKickStaticDecay; + float fAdsViewKickPitchMin; + float fAdsViewKickPitchMax; + float fAdsViewKickYawMin; + float fAdsViewKickYawMax; + float fAdsViewScatterMin; + float fAdsViewScatterMax; + float fAdsSpread; + int hipGunKickReducedKickBullets; + float hipGunKickReducedKickPercent; + float fHipGunKickPitchMin; + float fHipGunKickPitchMax; + float fHipGunKickYawMin; + float fHipGunKickYawMax; + float fHipGunKickAccel; + float fHipGunKickSpeedMax; + float fHipGunKickSpeedDecay; + float fHipGunKickStaticDecay; + float fHipViewKickPitchMin; + float fHipViewKickPitchMax; + float fHipViewKickYawMin; + float fHipViewKickYawMax; + float fHipViewScatterMin; + float fHipViewScatterMax; + float fightDist; + float maxDist; + const char* accuracyGraphName[2]; + vec2_t* accuracyGraphKnots; + vec2_t* originalAccuracyGraphKnots; + short accuracyGraphKnotCount; + short originalAccuracyGraphKnotCount; + int iPositionReloadTransTime; + float leftArc; + float rightArc; + float topArc; + float bottomArc; + float accuracy; + float aiSpread; + float playerSpread; + float minTurnSpeed[2]; + float maxTurnSpeed[2]; + float pitchConvergenceTime; + float yawConvergenceTime; + float suppressTime; + float maxRange; + float fAnimHorRotateInc; + float fPlayerPositionDist; + const char* szUseHintString; + const char* dropHintString; + int iUseHintStringIndex; + int dropHintStringIndex; + float horizViewJitter; + float vertViewJitter; + float scanSpeed; + float scanAccel; + int scanPauseTime; + const char* szScript; + float fOOPosAnimLength[2]; + int minDamage; + int minPlayerDamage; + float fMaxDamageRange; + float fMinDamageRange; + float destabilizationRateTime; + float destabilizationCurvatureMax; + int destabilizeDistance; + float* locationDamageMultipliers; + const char* fireRumble; + const char* meleeImpactRumble; + TracerDef* tracerType; + bool turretADSEnabled; + float turretADSTime; + float turretFov; + float turretFovADS; + float turretScopeZoomRate; + float turretScopeZoomMin; + float turretScopeZoomMax; + float turretOverheatUpRate; + float turretOverheatDownRate; + float turretOverheatPenalty; + snd_alias_list_t* turretOverheatSound; + FxEffectDef* turretOverheatEffect; + const char* turretBarrelSpinRumble; + float turretBarrelSpinSpeed; + float turretBarrelSpinUpTime; + float turretBarrelSpinDownTime; + snd_alias_list_t* turretBarrelSpinMaxSnd; + snd_alias_list_t* turretBarrelSpinUpSnd[4]; + snd_alias_list_t* turretBarrelSpinDownSnd[4]; + snd_alias_list_t* missileConeSoundAlias; + snd_alias_list_t* missileConeSoundAliasAtBase; + float missileConeSoundRadiusAtTop; + float missileConeSoundRadiusAtBase; + float missileConeSoundHeight; + float missileConeSoundOriginOffset; + float missileConeSoundVolumescaleAtCore; + float missileConeSoundVolumescaleAtEdge; + float missileConeSoundVolumescaleCoreSize; + float missileConeSoundPitchAtTop; + float missileConeSoundPitchAtBottom; + float missileConeSoundPitchTopSize; + float missileConeSoundPitchBottomSize; + float missileConeSoundCrossfadeTopSize; + float missileConeSoundCrossfadeBottomSize; + bool sharedAmmo; + bool lockonSupported; + bool requireLockonToFire; + bool isAirburstWeapon; + bool bigExplosion; + bool noAdsWhenMagEmpty; + bool avoidDropCleanup; + bool inheritsPerks; + bool crosshairColorChange; + bool bRifleBullet; + bool armorPiercing; + bool bBoltAction; + bool aimDownSight; + bool canHoldBreath; + bool canVariableZoom; + bool bRechamberWhileAds; + bool bBulletExplosiveDamage; + bool bCookOffHold; + bool bClipOnly; + bool noAmmoPickup; + bool adsFireOnly; + bool cancelAutoHolsterWhenEmpty; + bool disableSwitchToWhenEmpty; + bool suppressAmmoReserveDisplay; + bool laserSightDuringNightvision; + bool markableViewmodel; + bool noDualWield; + bool flipKillIcon; + bool bNoPartialReload; + bool bSegmentedReload; + bool blocksProne; + bool silenced; + bool isRollingGrenade; + bool projExplosionEffectForceNormalUp; + bool bProjImpactExplode; + bool stickToPlayers; + bool stickToVehicles; + bool stickToTurrets; + bool hasDetonator; + bool disableFiring; + bool timedDetonation; + bool rotate; + bool holdButtonToThrow; + bool freezeMovementWhenFiring; + bool thermalScope; + bool altModeSameWeapon; + bool turretBarrelSpinEnabled; + bool missileConeSoundEnabled; + bool missileConeSoundPitchshiftEnabled; + bool missileConeSoundCrossfadeEnabled; + bool offhandHoldIsCancelable; + bool doNotAllowAttachmentsToOverrideSpread; + unsigned __int16 stowTag; + XModel* stowOffsetModel; }; struct AnimOverrideEntry @@ -4524,25 +4536,17 @@ namespace ZoneTool } }; +#pragma pack(push, 4) struct WeaponCompleteDef { - union - { - struct - { - const char* name; - WeaponDef* WeaponDef; - const char* displayName; - short* hideTags; - }; - - char _portpad0[16]; - }; - - AttachmentDef** attachment1; // loads 6 - AttachmentDef** attachment2; // loads 3 - AttachmentDef** attachment3; // loads 4 - const char** szXAnims; // loads 42 + const char* szInternalName; + WeaponDef* weapDef; + const char* szDisplayName; + unsigned __int16* hideTags; + AttachmentDef** scopes; + AttachmentDef** underBarrels; + AttachmentDef** others; + const char** szXAnims; unsigned int numAnimOverrides; AnimOverrideEntry* animOverrides; unsigned int numSoundOverrides; @@ -4553,77 +4557,37 @@ namespace ZoneTool ReloadStateTimerEntry* reloadOverrides; unsigned int numNotetrackOverrides; NoteTrackToSoundEntry* notetrackOverrides; - - union - { - struct - { - int unknown1; - int iAdsTransInTime; - int iAdsTransOutTime; - int iClipSize; - int impactType; - int iFireTime; - }; - - char _portpad1[24]; - }; - + float fAdsZoomFov; + int iAdsTransInTime; + int iAdsTransOutTime; + int iClipSize; + int impactType; + int iFireTime; int iFireTimeAkimbo; - - union - { - struct - { - int dpadIconRatio; - int iPenetrateMultiplier; - float fAdsViewKickCenterSpeed; - float fHipViewKickCenterSpeed; - const char* altWeaponName; - unsigned int altWeaponIndex; - int iAltRaiseTime; - }; - - char _portpad2[28]; - }; - + weaponIconRatioType_t dpadIconRatio; + float penetrateMultiplier; + float fAdsViewKickCenterSpeed; + float fHipViewKickCenterSpeed; + const char* szAltWeaponName; + int altWeapon; + int iAltRaiseTime; int iAltRaiseTimeAkimbo; - - union - { - struct - { - Material* killIcon; - Material* dpadIcon; - int fireAnimLength; - int iFirstRaiseTime; - }; - - char _portpad3[16]; - }; - + Material* killIcon; + Material* dpadIcon; + int fireAnimLength; int fireAnimLengthAkimbo; + int iFirstRaiseTime; int iFirstRaiseTimeAkimbo; - - union - { - struct - { - int iDropAmmoMax; - float adsDofStart; - float adsDofEnd; - unsigned __int16 accuracyGraphKnotCount; - unsigned __int16 originalAccuracyGraphKnotCount; - vec2_t* accuracyGraphKnots; - vec2_t* originalAccuracyGraphKnots; - bool motionTracker; - bool enhanced; - bool dpadIconShowsAmmo; - }; - - char _portpad4[28]; - }; + int ammoDropStockMax; + float adsDofStart; + float adsDofEnd; + unsigned __int16 accuracyGraphKnotCount[2]; + float(*accuracyGraphKnots[2])[2]; + bool motionTracker; + bool enhanced; + bool dpadIconShowsAmmo; }; +#pragma pack(pop) // FxWorld #pragma pack(push, 4) @@ -4905,5 +4869,151 @@ namespace ZoneTool GfxLightDef* lightdef; void* data; }; + + enum $8C6ECA10AE5C9C0C746CF1CD5CE4FD8D + { + CONST_SRC_CODE_LIGHT_POSITION, + CONST_SRC_CODE_LIGHT_DIFFUSE, + CONST_SRC_CODE_LIGHT_SPECULAR, + CONST_SRC_CODE_LIGHT_SPOTDIR, + CONST_SRC_CODE_LIGHT_SPOTFACTORS, + CONST_SRC_CODE_LIGHT_FALLOFF_PLACEMENT, + CONST_SRC_CODE_PARTICLE_CLOUD_COLOR, + CONST_SRC_CODE_GAMETIME, + CONST_SRC_CODE_EYEOFFSET, + CONST_SRC_CODE_COLOR_SATURATION_R, + CONST_SRC_CODE_COLOR_SATURATION_G, + CONST_SRC_CODE_COLOR_SATURATION_B, + CONST_SRC_CODE_PIXEL_COST_FRACS, + CONST_SRC_CODE_PIXEL_COST_DECODE, + CONST_SRC_CODE_FILTER_TAP_0, + CONST_SRC_CODE_FILTER_TAP_1, + CONST_SRC_CODE_FILTER_TAP_2, + CONST_SRC_CODE_FILTER_TAP_3, + CONST_SRC_CODE_FILTER_TAP_4, + CONST_SRC_CODE_FILTER_TAP_5, + CONST_SRC_CODE_FILTER_TAP_6, + CONST_SRC_CODE_FILTER_TAP_7, + CONST_SRC_CODE_COLOR_MATRIX_R, + CONST_SRC_CODE_COLOR_MATRIX_G, + CONST_SRC_CODE_COLOR_MATRIX_B, + CONST_SRC_CODE_UNK1, + CONST_SRC_CODE_SHADOWMAP_POLYGON_OFFSET, + CONST_SRC_CODE_RENDER_TARGET_SIZE, + CONST_SRC_CODE_RENDER_SOURCE_SIZE, + CONST_SRC_CODE_DOF_EQUATION_VIEWMODEL_AND_FAR_BLUR, + CONST_SRC_CODE_DOF_EQUATION_SCENE, + CONST_SRC_CODE_DOF_LERP_SCALE, + CONST_SRC_CODE_DOF_LERP_BIAS, + CONST_SRC_CODE_DOF_ROW_DELTA, + CONST_SRC_CODE_MOTION_MATRIX_X, + CONST_SRC_CODE_MOTION_MATRIX_Y, + CONST_SRC_CODE_MOTION_MATRIX_W, + CONST_SRC_CODE_SHADOWMAP_SWITCH_PARTITION, + CONST_SRC_CODE_SHADOWMAP_SCALE, + CONST_SRC_CODE_ZNEAR, + CONST_SRC_CODE_LIGHTING_LOOKUP_SCALE, + CONST_SRC_CODE_DEBUG_BUMPMAP, + CONST_SRC_CODE_MATERIAL_COLOR, + CONST_SRC_CODE_FOG, + CONST_SRC_CODE_FOG_COLOR_LINEAR, + CONST_SRC_CODE_FOG_COLOR_GAMMA, + CONST_SRC_CODE_FOG_SUN_CONSTS, + CONST_SRC_CODE_FOG_SUN_COLOR_LINEAR, + CONST_SRC_CODE_FOG_SUN_COLOR_GAMMA, + CONST_SRC_CODE_FOG_SUN_DIR, + CONST_SRC_CODE_GLOW_SETUP, + CONST_SRC_CODE_GLOW_APPLY, + CONST_SRC_CODE_COLOR_BIAS, + CONST_SRC_CODE_COLOR_TINT_BASE, + CONST_SRC_CODE_COLOR_TINT_DELTA, + CONST_SRC_CODE_COLOR_TINT_QUADRATIC_DELTA, + CONST_SRC_CODE_OUTDOOR_FEATHER_PARMS, + CONST_SRC_CODE_ENVMAP_PARMS, + CONST_SRC_CODE_SUN_SHADOWMAP_PIXEL_ADJUST, + CONST_SRC_CODE_SPOT_SHADOWMAP_PIXEL_ADJUST, + CONST_SRC_CODE_COMPOSITE_FX_DISTORTION, + CONST_SRC_CODE_POSTFX_FADE_EFFECT, + CONST_SRC_CODE_VIEWPORT_DIMENSIONS, + CONST_SRC_CODE_FRAMEBUFFER_READ, + CONST_SRC_CODE_THERMAL_COLOR_OFFSET, + CONST_SRC_CODE_PLAYLIST_POPULATION_PARAMS, + CONST_SRC_CODE_BASE_LIGHTING_COORDS, + CONST_SRC_CODE_LIGHT_PROBE_AMBIENT, + CONST_SRC_CODE_NEARPLANE_ORG, + CONST_SRC_CODE_NEARPLANE_DX, + CONST_SRC_CODE_NEARPLANE_DY, + CONST_SRC_CODE_CLIP_SPACE_LOOKUP_SCALE, + CONST_SRC_CODE_CLIP_SPACE_LOOKUP_OFFSET, + CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX0, + CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX1, + CONST_SRC_CODE_PARTICLE_CLOUD_MATRIX2, + CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR0, + CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR1, + CONST_SRC_CODE_PARTICLE_CLOUD_SPARK_COLOR2, + CONST_SRC_CODE_PARTICLE_FOUNTAIN_PARM0, + CONST_SRC_CODE_PARTICLE_FOUNTAIN_PARM1, + CONST_SRC_CODE_DEPTH_FROM_CLIP, + CONST_SRC_CODE_CODE_MESH_ARG_0, + CONST_SRC_CODE_CODE_MESH_ARG_1, + CONST_SRC_CODE_VIEW_MATRIX, + CONST_SRC_CODE_INVERSE_VIEW_MATRIX, + CONST_SRC_CODE_TRANSPOSE_VIEW_MATRIX, + CONST_SRC_CODE_INVERSE_TRANSPOSE_VIEW_MATRIX, + CONST_SRC_CODE_PROJECTION_MATRIX, + CONST_SRC_CODE_INVERSE_PROJECTION_MATRIX, + CONST_SRC_CODE_TRANSPOSE_PROJECTION_MATRIX, + CONST_SRC_CODE_INVERSE_TRANSPOSE_PROJECTION_MATRIX, + CONST_SRC_CODE_VIEW_PROJECTION_MATRIX, + CONST_SRC_CODE_INVERSE_VIEW_PROJECTION_MATRIX, + CONST_SRC_CODE_TRANSPOSE_VIEW_PROJECTION_MATRIX, + CONST_SRC_CODE_INVERSE_TRANSPOSE_VIEW_PROJECTION_MATRIX, + CONST_SRC_CODE_SHADOW_LOOKUP_MATRIX, + CONST_SRC_CODE_INVERSE_SHADOW_LOOKUP_MATRIX, + CONST_SRC_CODE_TRANSPOSE_SHADOW_LOOKUP_MATRIX, + CONST_SRC_CODE_INVERSE_TRANSPOSE_SHADOW_LOOKUP_MATRIX, + CONST_SRC_CODE_WORLD_OUTDOOR_LOOKUP_MATRIX, + CONST_SRC_CODE_INVERSE_WORLD_OUTDOOR_LOOKUP_MATRIX, + CONST_SRC_CODE_TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX, + CONST_SRC_CODE_WORLD_MATRIX0, + CONST_SRC_CODE_INVERSE_WORLD_MATRIX0, + CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX0, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX0, + CONST_SRC_CODE_WORLD_VIEW_MATRIX0, + CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX0, + CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX0, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX0, + CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX0, + CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX0, + CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0, + CONST_SRC_CODE_WORLD_MATRIX1, + CONST_SRC_CODE_INVERSE_WORLD_MATRIX1, + CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX1, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX1, + CONST_SRC_CODE_WORLD_VIEW_MATRIX1, + CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX1, + CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX1, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX1, + CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX1, + CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX1, + CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1, + CONST_SRC_CODE_WORLD_MATRIX2, + CONST_SRC_CODE_INVERSE_WORLD_MATRIX2, + CONST_SRC_CODE_TRANSPOSE_WORLD_MATRIX2, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_MATRIX2, + CONST_SRC_CODE_WORLD_VIEW_MATRIX2, + CONST_SRC_CODE_INVERSE_WORLD_VIEW_MATRIX2, + CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_MATRIX2, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX2, + CONST_SRC_CODE_WORLD_VIEW_PROJECTION_MATRIX2, + CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX2, + CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2, + CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2, + CONST_SRC_TOTAL_COUNT, + CONST_SRC_NONE, + }; } } diff --git a/src/IW5/Zone.cpp b/src/IW5/Zone.cpp index e4f775e..01e6115 100644 --- a/src/IW5/Zone.cpp +++ b/src/IW5/Zone.cpp @@ -245,12 +245,12 @@ namespace ZoneTool // buf->save("debug\\" + this->name_ + ".zone"); // Compress buffer - auto buf_compressed = buf->compress_zstd(); + auto buf_compressed = buf->compress_zlib(); // Generate FF header auto header = this->m_zonemem->Alloc(); strcpy(header->header, "IWffu100"); - header->version = 2000; + header->version = 1; header->allowOnlineUpdate = 0; // Save fastfile @@ -260,9 +260,9 @@ namespace ZoneTool fastfile.write(buf_compressed.data(), buf_compressed.size()); - // plutonium output paths - fastfile.save("zone\\pluto\\common\\" + this->name_ + ".ff"); - fastfile.save("zone\\english\\" + this->name_ + ".ff"); + // oxygen output paths + fastfile.save("oxygen\\zone\\" + this->name_ + ".ff"); + // fastfile.save("zone\\english\\" + this->name_ + ".ff"); ZONETOOL_INFO("Successfully compiled fastfile \"%s\"!", this->name_.data()); ZONETOOL_INFO("Compiling took %u msec.", GetTickCount64() - startTime); diff --git a/src/ZoneTool/ZoneTool.cpp b/src/ZoneTool/ZoneTool.cpp index 7a1342c..44cfb79 100644 --- a/src/ZoneTool/ZoneTool.cpp +++ b/src/ZoneTool/ZoneTool.cpp @@ -209,7 +209,7 @@ namespace ZoneTool { add_assets_using_iterator(fastfile, "fx", "fx", ".fxe", true, zone.get()); add_assets_using_iterator(fastfile, "xanimparts", "XAnim", ".xae2", true, zone.get()); - add_assets_using_iterator(fastfile, "xmodel", "XModel", ".xme5", true, zone.get()); + add_assets_using_iterator(fastfile, "xmodel", "XModel", ".xme6", true, zone.get()); } catch (std::exception& ex) { diff --git a/src/ZoneUtils/Zone/ZoneBuffer.hpp b/src/ZoneUtils/Zone/ZoneBuffer.hpp index de786e8..5bae92c 100644 --- a/src/ZoneUtils/Zone/ZoneBuffer.hpp +++ b/src/ZoneUtils/Zone/ZoneBuffer.hpp @@ -21,6 +21,8 @@ namespace ZoneTool template static void encrypt_data(T* _data, std::size_t _size) { + return; + auto fastfile = FileSystem::GetFastFile(); auto encryptionKey = static_cast(fastfile + ": This fastfile is property of the Plutonium Project."