Added iw4 assets related to materials, xmodels

This commit is contained in:
Jan 2020-09-07 18:19:20 +02:00
parent 5e8173539b
commit b25fe9a9f7
10 changed files with 922 additions and 186 deletions

View File

@ -5,14 +5,13 @@ ZoneCode.Assets = {
"PhysPreset", "PhysPreset",
"PhysCollmap", "PhysCollmap",
"XAnimParts", "XAnimParts",
-- "XModelSurfs", "XModel",
-- "XModel", "Material",
-- "Material", "MaterialPixelShader",
-- "MaterialPixelShader", "MaterialVertexShader",
-- "MaterialVertexShader", "MaterialVertexDeclaration",
-- "MaterialVertexDeclaration", "MaterialTechniqueSet",
-- "MaterialTechniqueSet", "GfxImage",
-- "GfxImage",
-- "snd_alias_list_t", -- "snd_alias_list_t",
-- "SndCurve", -- "SndCurve",
-- "LoadedSound", -- "LoadedSound",
@ -32,8 +31,8 @@ ZoneCode.Assets = {
-- "SndDriverGlobals", -- "SndDriverGlobals",
-- "FxEffectDef", -- "FxEffectDef",
-- "FxImpactTable", -- "FxImpactTable",
-- "RawFile", "RawFile",
-- "StringTable", "StringTable",
-- "LeaderboardDef", -- "LeaderboardDef",
-- "StructuredDataDefSet", -- "StructuredDataDefSet",
-- "TracerDef", -- "TracerDef",

View File

@ -5,14 +5,13 @@ game IW4;
asset PhysPreset ASSET_TYPE_PHYSPRESET; asset PhysPreset ASSET_TYPE_PHYSPRESET;
asset PhysCollmap ASSET_TYPE_PHYSCOLLMAP; asset PhysCollmap ASSET_TYPE_PHYSCOLLMAP;
asset XAnimParts ASSET_TYPE_XANIMPARTS; asset XAnimParts ASSET_TYPE_XANIMPARTS;
// asset XModelSurfs ASSET_TYPE_XMODEL_SURFS; asset XModel ASSET_TYPE_XMODEL;
// asset XModel ASSET_TYPE_XMODEL; asset Material ASSET_TYPE_MATERIAL;
// asset Material ASSET_TYPE_MATERIAL; asset MaterialPixelShader ASSET_TYPE_PIXELSHADER;
// asset MaterialPixelShader ASSET_TYPE_PIXELSHADER; asset MaterialVertexShader ASSET_TYPE_VERTEXSHADER;
// asset MaterialVertexShader ASSET_TYPE_VERTEXSHADER; asset MaterialVertexDeclaration ASSET_TYPE_VERTEXDECL;
// asset MaterialVertexDeclaration ASSET_TYPE_VERTEXDECL; asset MaterialTechniqueSet ASSET_TYPE_TECHNIQUE_SET;
// asset MaterialTechniqueSet ASSET_TYPE_TECHNIQUE_SET; asset GfxImage ASSET_TYPE_IMAGE;
// asset GfxImage ASSET_TYPE_IMAGE;
// asset snd_alias_list_t ASSET_TYPE_SOUND; // asset snd_alias_list_t ASSET_TYPE_SOUND;
// asset SndCurve ASSET_TYPE_SOUND_CURVE; // asset SndCurve ASSET_TYPE_SOUND_CURVE;
// asset LoadedSound ASSET_TYPE_LOADED_SOUND; // asset LoadedSound ASSET_TYPE_LOADED_SOUND;
@ -32,8 +31,8 @@ asset XAnimParts ASSET_TYPE_XANIMPARTS;
// asset SndDriverGlobals ASSET_TYPE_SNDDRIVER_GLOBALS; // asset SndDriverGlobals ASSET_TYPE_SNDDRIVER_GLOBALS;
// asset FxEffectDef ASSET_TYPE_FX; // asset FxEffectDef ASSET_TYPE_FX;
// asset FxImpactTable ASSET_TYPE_IMPACT_FX; // asset FxImpactTable ASSET_TYPE_IMPACT_FX;
// asset RawFile ASSET_TYPE_RAWFILE; asset RawFile ASSET_TYPE_RAWFILE;
// asset StringTable ASSET_TYPE_STRINGTABLE; asset StringTable ASSET_TYPE_STRINGTABLE;
// asset LeaderboardDef ASSET_TYPE_LEADERBOARD; // asset LeaderboardDef ASSET_TYPE_LEADERBOARD;
// asset StructuredDataDefSet ASSET_TYPE_STRUCTURED_DATA_DEF; // asset StructuredDataDefSet ASSET_TYPE_STRUCTURED_DATA_DEF;
// asset TracerDef ASSET_TYPE_TRACER; // asset TracerDef ASSET_TYPE_TRACER;
@ -168,3 +167,204 @@ set count u::frames::frames size + 1;
reorder XAnimDeltaPartQuatDataFrames: reorder XAnimDeltaPartQuatDataFrames:
indices indices
frames; frames;
// =========================================
// XModel
// =========================================
use XModel;
set string name;
set name name;
set scriptstring boneNames;
set reusable boneNames;
set count boneNames numBones;
set reusable parentList;
set count parentList numBones - numRootBones;
set reusable quats;
set count quats numBones - numRootBones;
set reusable trans;
set count trans numBones - numRootBones;
set reusable partClassification;
set count partClassification numBones;
set reusable baseMat;
set count baseMat numBones;
set count materialHandles numsurfs;
set count collSurfs numCollSurfs;
set count boneInfo numBones;
// XModelLodInfo
use XModelLodInfo;
set block modelSurfs XFILE_BLOCK_TEMP;
set reusable modelSurfs;
set condition surfs never;
// XModelSurfs
use XModelSurfs;
set string name;
set count surfs XModelLodInfo::numsurfs; // No this is not a mistake. This is how the game does it.
// XSurface
use XSurface;
set reusable verts0;
set block verts0 XFILE_BLOCK_VERTEX;
set count verts0 vertCount;
set reusable vertList;
set count vertList vertListCount;
set reusable triIndices;
set block triIndices XFILE_BLOCK_INDEX;
set count triIndices triCount;
reorder:
zoneHandle
vertInfo
verts0
vertList
triIndices;
// XSurfaceVertexInfo
use XSurfaceVertexInfo;
set reusable vertsBlend;
set count vertsBlend vertCount[0]
+ 3 * vertCount[1]
+ 5 * vertCount[2]
+ 7 * vertCount[3];
// XRigidVertList
set reusable XRigidVertList::collisionTree;
// XSurfaceCollisionTree
use XSurfaceCollisionTree;
set count nodes nodeCount;
set count leafs leafCount;
// XModelCollSurf_s
set count XModelCollSurf_s::collTris numCollTris;
// =========================================
// Material
// =========================================
use Material;
set string info::name;
set name info::name;
set reusable textureTable;
set count textureTable textureCount;
set reusable constantTable;
set count constantTable constantCount;
set reusable stateBitsTable;
set count stateBitsTable stateBitsCount;
// MaterialTextureDef
use MaterialTextureDef;
set condition u::water semantic == TS_WATER_MAP;
set reusable u::water;
// water_t
use water_t;
set count H0 N * M;
set count wTerm N * M;
// =========================================
// MaterialTechniqueSet
// =========================================
use MaterialTechniqueSet;
set string name;
set name name;
set condition remappedTechniqueSet never;
set reusable techniques;
// MaterialTechnique
use MaterialTechnique;
set string name;
set arraysize passArray passCount;
reorder:
passArray
name;
// MaterialPass
use MaterialPass;
set count args perPrimArgCount + perObjArgCount + stableArgCount;
// MaterialShaderArgument
use MaterialShaderArgument;
set condition u::literalConst type == MTL_ARG_LITERAL_VERTEX_CONST
|| type == MTL_ARG_LITERAL_PIXEL_CONST;
set reusable u::literalConst;
// =========================================
// MaterialVertexDeclaration
// =========================================
use MaterialVertexDeclaration;
set string name;
set name name;
// MaterialVertexStreamRouting
set condition MaterialVertexStreamRouting::decl never;
// =========================================
// MaterialVertexShader
// =========================================
use MaterialVertexShader;
set string name;
set name name;
// GfxVertexShaderLoadDef
set count GfxVertexShaderLoadDef::program programSize;
// MaterialVertexShaderProgram
set condition MaterialVertexShaderProgram::vs never;
// =========================================
// MaterialPixelShader
// =========================================
use MaterialPixelShader;
set string name;
set name name;
// GfxPixelShaderLoadDef
set count GfxPixelShaderLoadDef::program programSize;
// MaterialPixelShaderProgram
set condition MaterialPixelShaderProgram::ps never;
// =========================================
// GfxImage
// =========================================
use GfxImage;
set action OnImageLoaded(GfxImage);
set string name;
set name name;
reorder:
name
texture;
// GfxTexture
use GfxTexture;
set reusable loadDef;
set block loadDef XFILE_BLOCK_TEMP;
set condition texture never;
// GfxImageLoadDef
use GfxImageLoadDef;
set action LoadImageData(GfxImageLoadDef, GfxImage);
set arraysize data resourceSize;
// =========================================
// RawFile
// =========================================
use RawFile;
set string name;
set name name;
set condition data::compressedBuffer compressedLen > 0;
set count data::compressedBuffer compressedLen;
set count data::buffer len + 1;
// =========================================
// StringTable
// =========================================
use StringTable;
set string name;
set name name;
set count values columnCount * rowCount;
// StringTableCell
set string StringTableCell::string;
// EOF

View File

@ -61,7 +61,6 @@ const std::string GameAssetPoolIW4::ASSET_TYPE_NAMES[]
ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset, m_phys_preset ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset, m_phys_preset
ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap, m_phys_collmap ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap, m_phys_collmap
ASSET_TYPE_XANIMPARTS, XAnimParts, parts, m_xanim_parts ASSET_TYPE_XANIMPARTS, XAnimParts, parts, m_xanim_parts
ASSET_TYPE_XMODEL_SURFS, XModelSurfs, modelSurfs, m_xmodel_surfs
ASSET_TYPE_XMODEL, XModel, model, m_xmodel ASSET_TYPE_XMODEL, XModel, model, m_xmodel
ASSET_TYPE_MATERIAL, Material, material, m_material ASSET_TYPE_MATERIAL, Material, material, m_material
ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader, m_material_pixel_shader ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader, m_material_pixel_shader
@ -107,14 +106,13 @@ GameAssetPoolIW4::GameAssetPoolIW4(const int priority)
m_phys_preset = nullptr; m_phys_preset = nullptr;
m_phys_collmap = nullptr; m_phys_collmap = nullptr;
m_xanim_parts = nullptr; m_xanim_parts = nullptr;
// m_xmodel_surfs = nullptr; m_xmodel = nullptr;
// m_xmodel = nullptr; m_material = nullptr;
// m_material = nullptr; m_material_pixel_shader = nullptr;
// m_material_pixel_shader = nullptr; m_material_vertex_shader = nullptr;
// m_material_vertex_shader = nullptr; m_material_vertex_decl = nullptr;
// m_material_vertex_decl = nullptr; m_technique_set = nullptr;
// m_technique_set = nullptr; m_image = nullptr;
// m_image = nullptr;
// m_sound = nullptr; // m_sound = nullptr;
// m_sound_curve = nullptr; // m_sound_curve = nullptr;
// m_loaded_sound = nullptr; // m_loaded_sound = nullptr;
@ -134,8 +132,8 @@ GameAssetPoolIW4::GameAssetPoolIW4(const int priority)
// m_snd_driver_globals = nullptr; // m_snd_driver_globals = nullptr;
// m_fx = nullptr; // m_fx = nullptr;
// m_fx_impact_table = nullptr; // m_fx_impact_table = nullptr;
// m_raw_file = nullptr; m_raw_file = nullptr;
// m_string_table = nullptr; m_string_table = nullptr;
// m_leaderboard = nullptr; // m_leaderboard = nullptr;
// m_structed_data_def_set = nullptr; // m_structed_data_def_set = nullptr;
// m_tracer = nullptr; // m_tracer = nullptr;
@ -157,17 +155,16 @@ void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capa
switch (type) switch (type)
{ {
CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset);
CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, PhysCollmap); CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, PhysCollmap);
CASE_INIT_POOL_STATIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); CASE_INIT_POOL_STATIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_XMODEL_SURFS, m_xmodel_surfs, XModelSurfs); CASE_INIT_POOL_STATIC(ASSET_TYPE_XMODEL, m_xmodel, XModel);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); CASE_INIT_POOL_STATIC(ASSET_TYPE_MATERIAL, m_material, Material);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_MATERIAL, m_material, Material); CASE_INIT_POOL_STATIC(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, MaterialPixelShader);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, MaterialPixelShader); CASE_INIT_POOL_STATIC(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, MaterialVertexShader);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, MaterialVertexShader); CASE_INIT_POOL_STATIC(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, MaterialVertexDeclaration);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, MaterialVertexDeclaration); CASE_INIT_POOL_STATIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); CASE_INIT_POOL_STATIC(ASSET_TYPE_IMAGE, m_image, GfxImage);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_IMAGE, m_image, GfxImage);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND, m_sound, snd_alias_list_t); // CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND, m_sound, snd_alias_list_t);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND_CURVE, m_sound_curve, SndCurve); // CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND_CURVE, m_sound_curve, SndCurve);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, LoadedSound); // CASE_INIT_POOL_STATIC(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, LoadedSound);
@ -188,8 +185,8 @@ void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capa
// CASE_INIT_POOL_STATIC(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, SndDriverGlobals); // CASE_INIT_POOL_STATIC(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, SndDriverGlobals);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_FX, m_fx, FxEffectDef); // CASE_INIT_POOL_STATIC(ASSET_TYPE_FX, m_fx, FxEffectDef);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); // CASE_INIT_POOL_STATIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); CASE_INIT_POOL_STATIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); // CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet); // CASE_INIT_POOL_STATIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); // CASE_INIT_POOL_STATIC(ASSET_TYPE_TRACER, m_tracer, TracerDef);
@ -218,17 +215,16 @@ void GameAssetPoolIW4::InitPoolDynamic(const asset_type_t type)
switch (type) switch (type)
{ {
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset);
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, PhysCollmap); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, PhysCollmap);
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XMODEL_SURFS, m_xmodel_surfs, XModelSurfs); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XMODEL, m_xmodel, XModel);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MATERIAL, m_material, Material);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MATERIAL, m_material, Material); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, MaterialPixelShader);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, MaterialPixelShader); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, MaterialVertexShader);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, MaterialVertexShader); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, MaterialVertexDeclaration);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, MaterialVertexDeclaration); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMAGE, m_image, GfxImage);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMAGE, m_image, GfxImage);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND, m_sound, snd_alias_list_t); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND, m_sound, snd_alias_list_t);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND_CURVE, m_sound_curve, SndCurve); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND_CURVE, m_sound_curve, SndCurve);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, LoadedSound); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, LoadedSound);
@ -249,8 +245,8 @@ void GameAssetPoolIW4::InitPoolDynamic(const asset_type_t type)
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, SndDriverGlobals); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, SndDriverGlobals);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FX, m_fx, FxEffectDef); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FX, m_fx, FxEffectDef);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TRACER, m_tracer, TracerDef);
@ -288,17 +284,16 @@ XAssetInfoGeneric* GameAssetPoolIW4::AddAsset(asset_type_t type, std::string nam
switch (xAsset.type) switch (xAsset.type)
{ {
CASE_ADD_TO_POOL(ASSET_TYPE_PHYSPRESET, m_phys_preset, physPreset); CASE_ADD_TO_POOL(ASSET_TYPE_PHYSPRESET, m_phys_preset, physPreset);
CASE_ADD_TO_POOL(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, physCollmap); CASE_ADD_TO_POOL(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, physCollmap);
CASE_ADD_TO_POOL(ASSET_TYPE_XANIMPARTS, m_xanim_parts, parts); CASE_ADD_TO_POOL(ASSET_TYPE_XANIMPARTS, m_xanim_parts, parts);
// CASE_ADD_TO_POOL(ASSET_TYPE_XMODEL_SURFS, m_xmodel_surfs, modelSurfs); CASE_ADD_TO_POOL(ASSET_TYPE_XMODEL, m_xmodel, model);
// CASE_ADD_TO_POOL(ASSET_TYPE_XMODEL, m_xmodel, model); CASE_ADD_TO_POOL(ASSET_TYPE_MATERIAL, m_material, material);
// CASE_ADD_TO_POOL(ASSET_TYPE_MATERIAL, m_material, material); CASE_ADD_TO_POOL(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, pixelShader);
// CASE_ADD_TO_POOL(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, pixelShader); CASE_ADD_TO_POOL(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, vertexShader);
// CASE_ADD_TO_POOL(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, vertexShader); CASE_ADD_TO_POOL(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, vertexDecl);
// CASE_ADD_TO_POOL(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, vertexDecl); CASE_ADD_TO_POOL(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, techniqueSet);
// CASE_ADD_TO_POOL(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, techniqueSet); CASE_ADD_TO_POOL(ASSET_TYPE_IMAGE, m_image, image);
// CASE_ADD_TO_POOL(ASSET_TYPE_IMAGE, m_image, image);
// CASE_ADD_TO_POOL(ASSET_TYPE_SOUND, m_sound, sound); // CASE_ADD_TO_POOL(ASSET_TYPE_SOUND, m_sound, sound);
// CASE_ADD_TO_POOL(ASSET_TYPE_SOUND_CURVE, m_sound_curve, sndCurve); // CASE_ADD_TO_POOL(ASSET_TYPE_SOUND_CURVE, m_sound_curve, sndCurve);
// CASE_ADD_TO_POOL(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, loadSnd); // CASE_ADD_TO_POOL(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, loadSnd);
@ -319,8 +314,8 @@ XAssetInfoGeneric* GameAssetPoolIW4::AddAsset(asset_type_t type, std::string nam
// CASE_ADD_TO_POOL(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, sndDriverGlobals); // CASE_ADD_TO_POOL(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, sndDriverGlobals);
// CASE_ADD_TO_POOL(ASSET_TYPE_FX, m_fx, fx); // CASE_ADD_TO_POOL(ASSET_TYPE_FX, m_fx, fx);
// CASE_ADD_TO_POOL(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, impactFx); // CASE_ADD_TO_POOL(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, impactFx);
// CASE_ADD_TO_POOL(ASSET_TYPE_RAWFILE, m_raw_file, rawfile); CASE_ADD_TO_POOL(ASSET_TYPE_RAWFILE, m_raw_file, rawfile);
// CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable); CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable);
// CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef); // CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef);
// CASE_ADD_TO_POOL(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, structuredDataDefSet); // CASE_ADD_TO_POOL(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, structuredDataDefSet);
// CASE_ADD_TO_POOL(ASSET_TYPE_TRACER, m_tracer, tracerDef); // CASE_ADD_TO_POOL(ASSET_TYPE_TRACER, m_tracer, tracerDef);
@ -349,17 +344,16 @@ XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, std::stri
switch (type) switch (type)
{ {
CASE_GET_ASSET(ASSET_TYPE_PHYSPRESET, m_phys_preset); CASE_GET_ASSET(ASSET_TYPE_PHYSPRESET, m_phys_preset);
CASE_GET_ASSET(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap); CASE_GET_ASSET(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap);
CASE_GET_ASSET(ASSET_TYPE_XANIMPARTS, m_xanim_parts); CASE_GET_ASSET(ASSET_TYPE_XANIMPARTS, m_xanim_parts);
// CASE_GET_ASSET(ASSET_TYPE_XMODEL_SURFS, m_xmodel_surfs); CASE_GET_ASSET(ASSET_TYPE_XMODEL, m_xmodel);
// CASE_GET_ASSET(ASSET_TYPE_XMODEL, m_xmodel); CASE_GET_ASSET(ASSET_TYPE_MATERIAL, m_material);
// CASE_GET_ASSET(ASSET_TYPE_MATERIAL, m_material); CASE_GET_ASSET(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader);
// CASE_GET_ASSET(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader); CASE_GET_ASSET(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader);
// CASE_GET_ASSET(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader); CASE_GET_ASSET(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl);
// CASE_GET_ASSET(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl); CASE_GET_ASSET(ASSET_TYPE_TECHNIQUE_SET, m_technique_set);
// CASE_GET_ASSET(ASSET_TYPE_TECHNIQUE_SET, m_technique_set); CASE_GET_ASSET(ASSET_TYPE_IMAGE, m_image);
// CASE_GET_ASSET(ASSET_TYPE_IMAGE, m_image);
// CASE_GET_ASSET(ASSET_TYPE_SOUND, m_sound); // CASE_GET_ASSET(ASSET_TYPE_SOUND, m_sound);
// CASE_GET_ASSET(ASSET_TYPE_SOUND_CURVE, m_sound_curve); // CASE_GET_ASSET(ASSET_TYPE_SOUND_CURVE, m_sound_curve);
// CASE_GET_ASSET(ASSET_TYPE_LOADED_SOUND, m_loaded_sound); // CASE_GET_ASSET(ASSET_TYPE_LOADED_SOUND, m_loaded_sound);
@ -380,8 +374,8 @@ XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, std::stri
// CASE_GET_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals); // CASE_GET_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals);
// CASE_GET_ASSET(ASSET_TYPE_FX, m_fx); // CASE_GET_ASSET(ASSET_TYPE_FX, m_fx);
// CASE_GET_ASSET(ASSET_TYPE_IMPACT_FX, m_fx_impact_table); // CASE_GET_ASSET(ASSET_TYPE_IMPACT_FX, m_fx_impact_table);
// CASE_GET_ASSET(ASSET_TYPE_RAWFILE, m_raw_file); CASE_GET_ASSET(ASSET_TYPE_RAWFILE, m_raw_file);
// CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table); CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table);
// CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard); // CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard);
// CASE_GET_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set); // CASE_GET_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set);
// CASE_GET_ASSET(ASSET_TYPE_TRACER, m_tracer); // CASE_GET_ASSET(ASSET_TYPE_TRACER, m_tracer);

View File

@ -18,14 +18,13 @@ public:
std::unique_ptr<AssetPool<IW4::PhysPreset>> m_phys_preset; std::unique_ptr<AssetPool<IW4::PhysPreset>> m_phys_preset;
std::unique_ptr<AssetPool<IW4::PhysCollmap>> m_phys_collmap; std::unique_ptr<AssetPool<IW4::PhysCollmap>> m_phys_collmap;
std::unique_ptr<AssetPool<IW4::XAnimParts>> m_xanim_parts; std::unique_ptr<AssetPool<IW4::XAnimParts>> m_xanim_parts;
// std::unique_ptr<AssetPool<IW4::XModelSurfs>> m_xmodel_surfs; std::unique_ptr<AssetPool<IW4::XModel>> m_xmodel;
// std::unique_ptr<AssetPool<IW4::XModel>> m_xmodel; std::unique_ptr<AssetPool<IW4::Material>> m_material;
// std::unique_ptr<AssetPool<IW4::Material>> m_material; std::unique_ptr<AssetPool<IW4::MaterialPixelShader>> m_material_pixel_shader;
// std::unique_ptr<AssetPool<IW4::MaterialPixelShader>> m_material_pixel_shader; std::unique_ptr<AssetPool<IW4::MaterialVertexShader>> m_material_vertex_shader;
// std::unique_ptr<AssetPool<IW4::MaterialVertexShader>> m_material_vertex_shader; std::unique_ptr<AssetPool<IW4::MaterialVertexDeclaration>> m_material_vertex_decl;
// std::unique_ptr<AssetPool<IW4::MaterialVertexDeclaration>> m_material_vertex_decl; std::unique_ptr<AssetPool<IW4::MaterialTechniqueSet>> m_technique_set;
// std::unique_ptr<AssetPool<IW4::MaterialTechniqueSet>> m_technique_set; std::unique_ptr<AssetPool<IW4::GfxImage>> m_image;
// std::unique_ptr<AssetPool<IW4::GfxImage>> m_image;
// std::unique_ptr<AssetPool<IW4::snd_alias_list_t>> m_sound; // std::unique_ptr<AssetPool<IW4::snd_alias_list_t>> m_sound;
// std::unique_ptr<AssetPool<IW4::SndCurve>> m_sound_curve; // std::unique_ptr<AssetPool<IW4::SndCurve>> m_sound_curve;
// std::unique_ptr<AssetPool<IW4::LoadedSound>> m_loaded_sound; // std::unique_ptr<AssetPool<IW4::LoadedSound>> m_loaded_sound;
@ -45,8 +44,8 @@ public:
// std::unique_ptr<AssetPool<IW4::SndDriverGlobals>> m_snd_driver_globals; // std::unique_ptr<AssetPool<IW4::SndDriverGlobals>> m_snd_driver_globals;
// std::unique_ptr<AssetPool<IW4::FxEffectDef>> m_fx; // std::unique_ptr<AssetPool<IW4::FxEffectDef>> m_fx;
// std::unique_ptr<AssetPool<IW4::FxImpactTable>> m_fx_impact_table; // std::unique_ptr<AssetPool<IW4::FxImpactTable>> m_fx_impact_table;
// std::unique_ptr<AssetPool<IW4::RawFile>> m_raw_file; std::unique_ptr<AssetPool<IW4::RawFile>> m_raw_file;
// std::unique_ptr<AssetPool<IW4::StringTable>> m_string_table; std::unique_ptr<AssetPool<IW4::StringTable>> m_string_table;
// std::unique_ptr<AssetPool<IW4::LeaderboardDef>> m_leaderboard; // std::unique_ptr<AssetPool<IW4::LeaderboardDef>> m_leaderboard;
// std::unique_ptr<AssetPool<IW4::StructuredDataDefSet>> m_structed_data_def_set; // std::unique_ptr<AssetPool<IW4::StructuredDataDefSet>> m_structed_data_def_set;
// std::unique_ptr<AssetPool<IW4::TracerDef>> m_tracer; // std::unique_ptr<AssetPool<IW4::TracerDef>> m_tracer;
@ -59,7 +58,9 @@ public:
void InitPoolStatic(asset_type_t type, size_t capacity) override; void InitPoolStatic(asset_type_t type, size_t capacity) override;
void InitPoolDynamic(asset_type_t type) override; void InitPoolDynamic(asset_type_t type) override;
XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<std::string>& scriptStrings, std::vector<XAssetInfoGeneric*>& dependencies) override; XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset,
std::vector<std::string>& scriptStrings,
std::vector<XAssetInfoGeneric*>& dependencies) override;
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override; XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
const std::string& GetAssetTypeName(asset_type_t assetType) const override; const std::string& GetAssetTypeName(asset_type_t assetType) const override;

View File

@ -77,7 +77,6 @@ namespace IW4
struct PhysPreset; struct PhysPreset;
struct PhysCollmap; struct PhysCollmap;
struct XAnimParts; struct XAnimParts;
struct XModelSurfs;
struct XModel; struct XModel;
struct Material; struct Material;
struct MaterialPixelShader; struct MaterialPixelShader;
@ -85,39 +84,40 @@ namespace IW4
struct MaterialVertexDeclaration; struct MaterialVertexDeclaration;
struct MaterialTechniqueSet; struct MaterialTechniqueSet;
struct GfxImage; struct GfxImage;
struct snd_alias_list_t; // struct snd_alias_list_t;
struct SndCurve; // struct SndCurve;
struct LoadedSound; // struct LoadedSound;
struct clipMap_t; // struct clipMap_t;
struct ComWorld; // struct ComWorld;
struct GameWorldSp; // struct GameWorldSp;
struct GameWorldMp; // struct GameWorldMp;
struct MapEnts; // struct MapEnts;
struct FxWorld; // struct FxWorld;
struct GfxWorld; // struct GfxWorld;
struct GfxLightDef; // struct GfxLightDef;
struct Font_s; // struct Font_s;
struct MenuList; // struct MenuList;
struct menuDef_t; // struct menuDef_t;
struct LocalizeEntry; // struct LocalizeEntry;
struct WeaponCompleteDef; // struct WeaponCompleteDef;
struct SndDriverGlobals; // struct SndDriverGlobals;
struct FxEffectDef; // struct FxEffectDef;
struct FxImpactTable; // struct FxImpactTable;
struct RawFile; struct RawFile;
struct StringTable; struct StringTable;
struct LeaderboardDef;
struct StructuredDataDefSet; // struct LeaderboardDef;
struct TracerDef; // struct StructuredDataDefSet;
struct VehicleDef; // struct TracerDef;
struct AddonMapEnts; // struct VehicleDef;
// struct AddonMapEnts;
union XAssetHeader union XAssetHeader
{ {
PhysPreset* physPreset; PhysPreset* physPreset;
PhysCollmap* physCollmap; PhysCollmap* physCollmap;
XAnimParts* parts; XAnimParts* parts;
XModelSurfs* modelSurfs; // XModelSurfs* modelSurfs; // NOT AN ASSET
XModel* model; XModel* model;
Material* material; Material* material;
MaterialPixelShader* pixelShader; MaterialPixelShader* pixelShader;
@ -125,32 +125,32 @@ namespace IW4
MaterialVertexDeclaration* vertexDecl; MaterialVertexDeclaration* vertexDecl;
MaterialTechniqueSet* techniqueSet; MaterialTechniqueSet* techniqueSet;
GfxImage* image; GfxImage* image;
snd_alias_list_t* sound; // snd_alias_list_t* sound;
SndCurve* sndCurve; // SndCurve* sndCurve;
LoadedSound* loadSnd; // LoadedSound* loadSnd;
clipMap_t* clipMap; // clipMap_t* clipMap;
ComWorld* comWorld; // ComWorld* comWorld;
GameWorldSp* gameWorldSp; // GameWorldSp* gameWorldSp;
GameWorldMp* gameWorldMp; // GameWorldMp* gameWorldMp;
MapEnts* mapEnts; // MapEnts* mapEnts;
FxWorld* fxWorld; // FxWorld* fxWorld;
GfxWorld* gfxWorld; // GfxWorld* gfxWorld;
GfxLightDef* lightDef; // GfxLightDef* lightDef;
Font_s* font; // Font_s* font;
MenuList* menuList; // MenuList* menuList;
menuDef_t* menu; // menuDef_t* menu;
LocalizeEntry* localize; // LocalizeEntry* localize;
WeaponCompleteDef* weapon; // WeaponCompleteDef* weapon;
SndDriverGlobals* sndDriverGlobals; // SndDriverGlobals* sndDriverGlobals;
FxEffectDef* fx; // FxEffectDef* fx;
FxImpactTable* impactFx; // FxImpactTable* impactFx;
RawFile* rawfile; RawFile* rawfile;
StringTable* stringTable; StringTable* stringTable;
LeaderboardDef* leaderboardDef; // LeaderboardDef* leaderboardDef;
StructuredDataDefSet* structuredDataDefSet; // StructuredDataDefSet* structuredDataDefSet;
TracerDef* tracerDef; // TracerDef* tracerDef;
VehicleDef* vehDef; // VehicleDef* vehDef;
AddonMapEnts* addonMapEnts; // AddonMapEnts* addonMapEnts;
void* data; void* data;
}; };
@ -253,8 +253,8 @@ namespace IW4
union XAnimDynamicFrames union XAnimDynamicFrames
{ {
char(*_1)[3]; char (*_1)[3];
unsigned __int16(*_2)[3]; unsigned __int16 (*_2)[3];
}; };
union XAnimDynamicIndices union XAnimDynamicIndices
@ -274,7 +274,6 @@ namespace IW4
union XAnimPartTransData union XAnimPartTransData
{ {
XAnimPartTransFrames frames; XAnimPartTransFrames frames;
//float frame0[3];
vec3_t frame0; vec3_t frame0;
}; };
@ -287,7 +286,7 @@ namespace IW4
struct __declspec(align(4)) XAnimDeltaPartQuatDataFrames2 struct __declspec(align(4)) XAnimDeltaPartQuatDataFrames2
{ {
__int16(*frames)[2]; __int16 (*frames)[2];
XAnimDynamicIndices indices; XAnimDynamicIndices indices;
}; };
@ -305,7 +304,7 @@ namespace IW4
struct XAnimDeltaPartQuatDataFrames struct XAnimDeltaPartQuatDataFrames
{ {
__int16(*frames)[4]; __int16 (*frames)[4];
XAnimDynamicIndices indices; XAnimDynamicIndices indices;
}; };
@ -358,6 +357,501 @@ namespace IW4
XAnimDeltaPart* deltaPart; XAnimDeltaPart* deltaPart;
}; };
struct XSurfaceVertexInfo
{
__int16 vertCount[4];
unsigned __int16* vertsBlend;
};
union GfxColor
{
unsigned int packed;
char array[4];
};
union PackedTexCoords
{
unsigned int packed;
};
union PackedUnitVec
{
unsigned int packed;
char array[4];
};
struct __declspec(align(16)) GfxPackedVertex
{
float xyz[3];
float binormalSign;
GfxColor color;
PackedTexCoords texCoord;
PackedUnitVec normal;
PackedUnitVec tangent;
};
struct XSurfaceCollisionAabb
{
unsigned __int16 mins[3];
unsigned __int16 maxs[3];
};
struct __declspec(align(16)) XSurfaceCollisionNode
{
XSurfaceCollisionAabb aabb;
unsigned __int16 childBeginIndex;
unsigned __int16 childCount;
};
struct XSurfaceCollisionLeaf
{
unsigned __int16 triangleBeginIndex;
};
struct XSurfaceCollisionTree
{
float trans[3];
float scale[3];
unsigned int nodeCount;
XSurfaceCollisionNode* nodes;
unsigned int leafCount;
XSurfaceCollisionLeaf* leafs;
};
struct XRigidVertList
{
unsigned __int16 boneOffset;
unsigned __int16 vertCount;
unsigned __int16 triOffset;
unsigned __int16 triCount;
XSurfaceCollisionTree* collisionTree;
};
typedef __declspec(align(16)) unsigned __int16 r_index16_t;
struct XSurface
{
char tileMode;
bool deformed;
unsigned __int16 vertCount;
unsigned __int16 triCount;
char zoneHandle;
unsigned __int16 baseTriIndex;
unsigned __int16 baseVertIndex;
r_index16_t (*triIndices)[3];
XSurfaceVertexInfo vertInfo;
GfxPackedVertex* verts0;
unsigned int vertListCount;
XRigidVertList* vertList;
int partBits[6];
};
struct XModelSurfs
{
const char* name;
XSurface* surfs;
unsigned __int16 numsurfs;
int partBits[6];
};
struct XModelLodInfo
{
float dist;
unsigned __int16 numsurfs;
unsigned __int16 surfIndex;
XModelSurfs* modelSurfs;
int partBits[6];
XSurface* surfs;
char lod;
char smcBaseIndexPlusOne;
char smcSubIndexMask;
char smcBucket;
};
struct XModelCollTri_s
{
float plane[4];
float svec[4];
float tvec[4];
};
struct XModelCollSurf_s
{
XModelCollTri_s* collTris;
int numCollTris;
Bounds bounds;
int boneIdx;
int contents;
int surfFlags;
};
struct XBoneInfo
{
Bounds bounds;
float radiusSquared;
};
struct DObjAnimMat
{
float quat[4];
float trans[3];
float transWeight;
};
struct XModel
{
const char* name;
char numBones;
char numRootBones;
char numsurfs;
char lodRampType;
float scale;
unsigned int noScalePartBits[6];
unsigned __int16* boneNames;
char* parentList;
__int16* quats;
float* trans;
char* partClassification;
DObjAnimMat* baseMat;
Material** materialHandles;
XModelLodInfo lodInfo[4];
char maxLoadedLod;
char numLods;
char collLod;
char flags;
XModelCollSurf_s* collSurfs;
int numCollSurfs;
int contents;
XBoneInfo* boneInfo;
float radius;
Bounds bounds;
int memUsage;
bool bad;
PhysPreset* physPreset;
PhysCollmap* physCollmap;
};
struct WaterWritable
{
float floatTime;
};
struct complex_s
{
float real;
float imag;
};
struct water_t
{
WaterWritable writable;
complex_s* H0;
float* wTerm;
int M;
int N;
float Lx;
float Lz;
float gravity;
float windvel;
float winddir[2];
float amplitude;
float codeConstant[4];
GfxImage* image;
};
union MaterialTextureDefInfo
{
GfxImage* image;
water_t* water;
};
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
char samplerState;
char semantic;
MaterialTextureDefInfo u;
};
struct __declspec(align(16)) MaterialConstantDef
{
unsigned int nameHash;
char name[12];
float literal[4];
};
struct GfxStateBits
{
unsigned int loadBits[2];
};
struct GfxDrawSurfFields
{
unsigned __int64 objectId : 16;
unsigned __int64 reflectionProbeIndex : 8;
unsigned __int64 hasGfxEntIndex : 1;
unsigned __int64 customIndex : 5;
unsigned __int64 materialSortedIndex : 12;
unsigned __int64 prepass : 2;
unsigned __int64 useHeroLighting : 1;
unsigned __int64 sceneLightIndex : 8;
unsigned __int64 surfType : 4;
unsigned __int64 primarySortKey : 6;
unsigned __int64 unused : 1;
};
union GfxDrawSurf
{
GfxDrawSurfFields fields;
unsigned __int64 packed;
};
struct MaterialInfo
{
const char* name;
char gameFlags;
char sortKey;
char textureAtlasRowCount;
char textureAtlasColumnCount;
GfxDrawSurf drawSurf;
unsigned int surfaceTypeBits;
unsigned __int16 hashIndex;
};
struct Material
{
MaterialInfo info;
char stateBitsEntry[48];
char textureCount;
char constantCount;
char stateBitsCount;
char stateFlags;
char cameraRegion;
MaterialTechniqueSet* techniqueSet;
MaterialTextureDef* textureTable;
MaterialConstantDef* constantTable;
GfxStateBits* stateBitsTable;
};
struct __declspec(align(4)) GfxImageLoadDef
{
char levelCount;
char pad[3];
int flags;
int format;
int resourceSize;
char data[1];
};
union GfxTexture
{
// IDirect3DBaseTexture9* basemap;
// IDirect3DTexture9* map;
// IDirect3DVolumeTexture9* volmap;
// IDirect3DCubeTexture9* cubemap;
Texture* texture;
GfxImageLoadDef* loadDef;
};
struct Picmip
{
char platform[2];
};
struct CardMemory
{
int platform[2];
};
enum TextureSemantic
{
TS_2D = 0x0,
TS_FUNCTION = 0x1,
TS_COLOR_MAP = 0x2,
TS_DETAIL_MAP = 0x3,
TS_UNUSED_2 = 0x4,
TS_NORMAL_MAP = 0x5,
TS_UNUSED_3 = 0x6,
TS_UNUSED_4 = 0x7,
TS_SPECULAR_MAP = 0x8,
TS_UNUSED_5 = 0x9,
TS_UNUSED_6 = 0xA,
TS_WATER_MAP = 0xB,
};
struct GfxImage
{
GfxTexture texture;
char mapType;
char semantic;
char category;
bool useSrgbReads;
Picmip picmip;
bool noPicmip;
char track;
CardMemory cardMemory;
unsigned __int16 width;
unsigned __int16 height;
unsigned __int16 depth;
bool delayLoadPixels;
const char* name;
};
struct GfxPixelShaderLoadDef
{
unsigned int* program;
unsigned __int16 programSize;
unsigned __int16 loadForRenderer;
};
struct GfxVertexShaderLoadDef
{
unsigned int* program;
unsigned __int16 programSize;
unsigned __int16 loadForRenderer;
};
struct MaterialStreamRouting
{
char source;
char dest;
};
struct MaterialVertexStreamRouting
{
MaterialStreamRouting data[13];
void/*IDirect3DVertexDeclaration9*/* decl[16];
};
struct MaterialVertexDeclaration
{
const char* name;
char streamCount;
bool hasOptionalSource;
MaterialVertexStreamRouting routing;
};
struct MaterialVertexShaderProgram
{
void/*IDirect3DVertexShader9*/* vs;
GfxVertexShaderLoadDef loadDef;
};
struct MaterialVertexShader
{
const char* name;
MaterialVertexShaderProgram prog;
};
struct MaterialPixelShaderProgram
{
void/*IDirect3DPixelShader9*/* ps;
GfxPixelShaderLoadDef loadDef;
};
struct MaterialPixelShader
{
const char* name;
MaterialPixelShaderProgram prog;
};
struct MaterialArgumentCodeConst
{
unsigned __int16 index;
char firstRow;
char rowCount;
};
union MaterialArgumentDef
{
const float (*literalConst)[4];
MaterialArgumentCodeConst codeConst;
unsigned int codeSampler;
unsigned int nameHash;
};
enum MaterialShaderArgumentType
{
MTL_ARG_MATERIAL_VERTEX_CONST = 0x0,
MTL_ARG_LITERAL_VERTEX_CONST = 0x1,
MTL_ARG_MATERIAL_PIXEL_SAMPLER = 0x2,
MTL_ARG_CODE_PRIM_BEGIN = 0x3,
MTL_ARG_CODE_VERTEX_CONST = 0x3,
MTL_ARG_CODE_PIXEL_SAMPLER = 0x4,
MTL_ARG_CODE_PIXEL_CONST = 0x5,
MTL_ARG_CODE_PRIM_END = 0x6,
MTL_ARG_MATERIAL_PIXEL_CONST = 0x6,
MTL_ARG_LITERAL_PIXEL_CONST = 0x7,
MTL_ARG_COUNT = 0x8,
};
struct MaterialShaderArgument
{
unsigned __int16 type;
unsigned __int16 dest;
MaterialArgumentDef u;
};
struct MaterialPass
{
MaterialVertexDeclaration* vertexDecl;
MaterialVertexShader* vertexShader;
MaterialPixelShader* pixelShader;
char perPrimArgCount;
char perObjArgCount;
char stableArgCount;
char customSamplerFlags;
MaterialShaderArgument* args;
};
struct MaterialTechnique
{
const char* name;
unsigned __int16 flags;
unsigned __int16 passCount;
MaterialPass passArray[1];
};
struct MaterialTechniqueSet
{
const char* name;
char worldVertFormat;
bool hasBeenUploaded;
char unused[1];
MaterialTechniqueSet* remappedTechniqueSet;
MaterialTechnique* techniques[48];
};
union RawFileBuffer
{
const char* compressedBuffer;
const char* buffer;
};
struct RawFile
{
const char* name;
int compressedLen;
int len;
RawFileBuffer data;
};
struct StringTableCell
{
const char* string;
int hash;
};
struct StringTable
{
const char* name;
int columnCount;
int rowCount;
StringTableCell* values;
};
#ifndef __zonecodegenerator #ifndef __zonecodegenerator
} }
#endif #endif

View File

@ -13,34 +13,33 @@
//#include "Game/IW4/XAssets/fxworld/fxworld_load_db.h" //#include "Game/IW4/XAssets/fxworld/fxworld_load_db.h"
//#include "Game/IW4/XAssets/gameworldmp/gameworldmp_load_db.h" //#include "Game/IW4/XAssets/gameworldmp/gameworldmp_load_db.h"
//#include "Game/IW4/XAssets/gameworldsp/gameworldsp_load_db.h" //#include "Game/IW4/XAssets/gameworldsp/gameworldsp_load_db.h"
//#include "Game/IW4/XAssets/gfximage/gfximage_load_db.h" #include "Game/IW4/XAssets/gfximage/gfximage_load_db.h"
//#include "Game/IW4/XAssets/gfxlightdef/gfxlightdef_load_db.h" //#include "Game/IW4/XAssets/gfxlightdef/gfxlightdef_load_db.h"
//#include "Game/IW4/XAssets/gfxworld/gfxworld_load_db.h" //#include "Game/IW4/XAssets/gfxworld/gfxworld_load_db.h"
//#include "Game/IW4/XAssets/leaderboarddef/leaderboarddef_load_db.h" //#include "Game/IW4/XAssets/leaderboarddef/leaderboarddef_load_db.h"
//#include "Game/IW4/XAssets/loadedsound/loadedsound_load_db.h" //#include "Game/IW4/XAssets/loadedsound/loadedsound_load_db.h"
//#include "Game/IW4/XAssets/localizeentry/localizeentry_load_db.h" //#include "Game/IW4/XAssets/localizeentry/localizeentry_load_db.h"
//#include "Game/IW4/XAssets/mapents/mapents_load_db.h" //#include "Game/IW4/XAssets/mapents/mapents_load_db.h"
//#include "Game/IW4/XAssets/material/material_load_db.h" #include "Game/IW4/XAssets/material/material_load_db.h"
//#include "Game/IW4/XAssets/materialpixelshader/materialpixelshader_load_db.h" #include "Game/IW4/XAssets/materialpixelshader/materialpixelshader_load_db.h"
//#include "Game/IW4/XAssets/materialtechniqueset/materialtechniqueset_load_db.h" #include "Game/IW4/XAssets/materialtechniqueset/materialtechniqueset_load_db.h"
//#include "Game/IW4/XAssets/materialvertexdeclaration/materialvertexdeclaration_load_db.h" #include "Game/IW4/XAssets/materialvertexdeclaration/materialvertexdeclaration_load_db.h"
//#include "Game/IW4/XAssets/materialvertexshader/materialvertexshader_load_db.h" #include "Game/IW4/XAssets/materialvertexshader/materialvertexshader_load_db.h"
//#include "Game/IW4/XAssets/menudef_t/menudef_t_load_db.h" //#include "Game/IW4/XAssets/menudef_t/menudef_t_load_db.h"
//#include "Game/IW4/XAssets/menulist/menulist_load_db.h" //#include "Game/IW4/XAssets/menulist/menulist_load_db.h"
#include "Game/IW4/XAssets/physcollmap/physcollmap_load_db.h" #include "Game/IW4/XAssets/physcollmap/physcollmap_load_db.h"
#include "Game/IW4/XAssets/physpreset/physpreset_load_db.h" #include "Game/IW4/XAssets/physpreset/physpreset_load_db.h"
//#include "Game/IW4/XAssets/rawfile/rawfile_load_db.h" #include "Game/IW4/XAssets/rawfile/rawfile_load_db.h"
//#include "Game/IW4/XAssets/snd_alias_list_t/snd_alias_list_t_load_db.h" //#include "Game/IW4/XAssets/snd_alias_list_t/snd_alias_list_t_load_db.h"
//#include "Game/IW4/XAssets/sndcurve/sndcurve_load_db.h" //#include "Game/IW4/XAssets/sndcurve/sndcurve_load_db.h"
//#include "Game/IW4/XAssets/snddriverglobals/snddriverglobals_load_db.h" //#include "Game/IW4/XAssets/snddriverglobals/snddriverglobals_load_db.h"
//#include "Game/IW4/XAssets/stringtable/stringtable_load_db.h" #include "Game/IW4/XAssets/stringtable/stringtable_load_db.h"
//#include "Game/IW4/XAssets/structureddatadefset/structureddatadefset_load_db.h" //#include "Game/IW4/XAssets/structureddatadefset/structureddatadefset_load_db.h"
//#include "Game/IW4/XAssets/tracerdef/tracerdef_load_db.h" //#include "Game/IW4/XAssets/tracerdef/tracerdef_load_db.h"
//#include "Game/IW4/XAssets/vehicledef/vehicledef_load_db.h" //#include "Game/IW4/XAssets/vehicledef/vehicledef_load_db.h"
//#include "Game/IW4/XAssets/weaponcompletedef/weaponcompletedef_load_db.h" //#include "Game/IW4/XAssets/weaponcompletedef/weaponcompletedef_load_db.h"
#include "Game/IW4/XAssets/xanimparts/xanimparts_load_db.h" #include "Game/IW4/XAssets/xanimparts/xanimparts_load_db.h"
//#include "Game/IW4/XAssets/xmodel/xmodel_load_db.h" #include "Game/IW4/XAssets/xmodel/xmodel_load_db.h"
//#include "Game/IW4/XAssets/xmodelsurfs/xmodelsurfs_load_db.h"
using namespace IW4; using namespace IW4;
@ -101,17 +100,16 @@ void ContentLoaderIW4::LoadXAsset(const bool atStreamStart)
switch (varXAsset->type) switch (varXAsset->type)
{ {
LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset); LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset);
LOAD_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap); LOAD_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap);
LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts); LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts);
// LOAD_ASSET(ASSET_TYPE_XMODEL_SURFS, XModelSurfs, modelSurfs); LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model);
// LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model); LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material);
// LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material); LOAD_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader);
// LOAD_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader); LOAD_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader);
// LOAD_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader); LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl);
// LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl); LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet);
// LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet); LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image);
// LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image);
// LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound); // LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound);
// LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve); // LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve);
// LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd); // LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd);
@ -132,8 +130,8 @@ void ContentLoaderIW4::LoadXAsset(const bool atStreamStart)
// LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals); // LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals);
// LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx); // LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx);
// LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx); // LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx);
// LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile); LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile);
// LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable); LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable);
// LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef); // LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef);
// LOAD_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet); // LOAD_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet);
// LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef); // LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef);
@ -141,9 +139,9 @@ void ContentLoaderIW4::LoadXAsset(const bool atStreamStart)
// LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts); // LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts);
default: default:
{ {
throw UnsupportedAssetTypeException(varXAsset->type); throw UnsupportedAssetTypeException(varXAsset->type);
} }
} }
#undef LOAD_ASSET #undef LOAD_ASSET

View File

@ -0,0 +1,29 @@
#include "gfximage_actions.h"
#include <cassert>
using namespace IW4;
Actions_GfxImage::Actions_GfxImage(Zone* zone)
: AssetLoadingActions(zone)
{
}
void Actions_GfxImage::OnImageLoaded(GfxImage* image) const
{
image->cardMemory.platform[0] = 0;
}
void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const
{
if (loadDef->resourceSize > 0)
{
const size_t loadDefSize = offsetof(IW4::GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->Alloc(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize);
}
else
{
image->texture.loadDef = nullptr;
}
}

View File

@ -0,0 +1,16 @@
#pragma once
#include "Loading/AssetLoadingActions.h"
#include "Game/IW4/IW4.h"
namespace IW4
{
class Actions_GfxImage final : public AssetLoadingActions
{
public:
explicit Actions_GfxImage(Zone* zone);
void OnImageLoaded(GfxImage* image) const;
void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const;
};
}

View File

@ -1,23 +1,25 @@
#include "gfximage_actions.h" #include "gfximage_actions.h"
#include <cassert> #include <cassert>
using namespace T6;
Actions_GfxImage::Actions_GfxImage(Zone* zone) Actions_GfxImage::Actions_GfxImage(Zone* zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
void Actions_GfxImage::OnImageLoaded(T6::GfxImage* image) const void Actions_GfxImage::OnImageLoaded(GfxImage* image) const
{ {
image->loadedSize = 0; image->loadedSize = 0;
} }
void Actions_GfxImage::LoadImageData(T6::GfxImageLoadDef* loadDef, T6::GfxImage* image) const void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const
{ {
if(loadDef->resourceSize > 0) if(loadDef->resourceSize > 0)
{ {
const size_t loadDefSize = offsetof(T6::GfxImageLoadDef, data) + loadDef->resourceSize; const size_t loadDefSize = offsetof(T6::GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<T6::GfxImageLoadDef*>(m_zone->GetMemory()->Alloc(loadDefSize)); image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->Alloc(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize); memcpy(image->texture.loadDef, loadDef, loadDefSize);
} }
else else

View File

@ -3,11 +3,14 @@
#include "Loading/AssetLoadingActions.h" #include "Loading/AssetLoadingActions.h"
#include "Game/T6/T6.h" #include "Game/T6/T6.h"
class Actions_GfxImage final : public AssetLoadingActions namespace T6
{ {
public: class Actions_GfxImage final : public AssetLoadingActions
explicit Actions_GfxImage(Zone* zone); {
public:
explicit Actions_GfxImage(Zone* zone);
void OnImageLoaded(T6::GfxImage* image) const; void OnImageLoaded(GfxImage* image) const;
void LoadImageData(T6::GfxImageLoadDef* loadDef, T6::GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const;
}; };
}