Add Fx asset for IW4

This commit is contained in:
Jan
2020-09-09 11:47:29 +02:00
parent 9108add01d
commit 24195be273
6 changed files with 277 additions and 13 deletions

View File

@ -130,7 +130,7 @@ GameAssetPoolIW4::GameAssetPoolIW4(const int priority)
m_localize = nullptr;
// m_weapon = nullptr;
// m_snd_driver_globals = nullptr;
// m_fx = nullptr;
m_fx = nullptr;
// m_fx_impact_table = nullptr;
m_raw_file = nullptr;
m_string_table = nullptr;
@ -183,7 +183,7 @@ void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capa
CASE_INIT_POOL_STATIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry);
// CASE_INIT_POOL_STATIC(ASSET_TYPE_WEAPON, m_weapon, WeaponCompleteDef);
// 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_RAWFILE, m_raw_file, RawFile);
CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable);
@ -243,7 +243,7 @@ void GameAssetPoolIW4::InitPoolDynamic(const asset_type_t type)
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry);
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_WEAPON, m_weapon, WeaponCompleteDef);
// 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_RAWFILE, m_raw_file, RawFile);
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable);
@ -312,7 +312,7 @@ XAssetInfoGeneric* GameAssetPoolIW4::AddAsset(asset_type_t type, std::string nam
CASE_ADD_TO_POOL(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, localize);
// CASE_ADD_TO_POOL(ASSET_TYPE_WEAPON, m_weapon, weapon);
// 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_RAWFILE, m_raw_file, rawfile);
CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable);
@ -372,7 +372,7 @@ XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, std::stri
CASE_GET_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, m_localize);
// CASE_GET_ASSET(ASSET_TYPE_WEAPON, m_weapon);
// 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_RAWFILE, m_raw_file);
CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table);

View File

@ -42,7 +42,7 @@ public:
std::unique_ptr<AssetPool<IW4::LocalizeEntry>> m_localize;
// std::unique_ptr<AssetPool<IW4::WeaponCompleteDef>> m_weapon;
// 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::RawFile>> m_raw_file;
std::unique_ptr<AssetPool<IW4::StringTable>> m_string_table;

View File

@ -101,11 +101,10 @@ namespace IW4
struct LocalizeEntry;
// struct WeaponCompleteDef;
// struct SndDriverGlobals;
// struct FxEffectDef;
struct FxEffectDef;
// struct FxImpactTable;
struct RawFile;
struct StringTable;
// struct LeaderboardDef;
// struct StructuredDataDefSet;
// struct TracerDef;
@ -142,7 +141,7 @@ namespace IW4
LocalizeEntry* localize;
// WeaponCompleteDef* weapon;
// SndDriverGlobals* sndDriverGlobals;
// FxEffectDef* fx;
FxEffectDef* fx;
// FxImpactTable* impactFx;
RawFile* rawfile;
StringTable* stringTable;
@ -1399,6 +1398,221 @@ namespace IW4
menuDef_t** menus;
};
enum FxElemType
{
FX_ELEM_TYPE_SPRITE_BILLBOARD = 0x0,
FX_ELEM_TYPE_SPRITE_ORIENTED = 0x1,
FX_ELEM_TYPE_TAIL = 0x2,
FX_ELEM_TYPE_TRAIL = 0x3,
FX_ELEM_TYPE_CLOUD = 0x4,
FX_ELEM_TYPE_SPARK_CLOUD = 0x5,
FX_ELEM_TYPE_SPARK_FOUNTAIN = 0x6,
FX_ELEM_TYPE_MODEL = 0x7,
FX_ELEM_TYPE_OMNI_LIGHT = 0x8,
FX_ELEM_TYPE_SPOT_LIGHT = 0x9,
FX_ELEM_TYPE_SOUND = 0xA,
FX_ELEM_TYPE_DECAL = 0xB,
FX_ELEM_TYPE_RUNNER = 0xC,
FX_ELEM_TYPE_COUNT = 0xD,
FX_ELEM_TYPE_LAST_SPRITE = 0x3,
FX_ELEM_TYPE_LAST_DRAWN = 0x9,
};
struct FxIntRange
{
int base;
int amplitude;
};
struct FxSpawnDefOneShot
{
FxIntRange count;
};
struct FxSpawnDefLooping
{
int intervalMsec;
int count;
};
union FxSpawnDef
{
FxSpawnDefLooping looping;
FxSpawnDefOneShot oneShot;
};
struct FxFloatRange
{
float base;
float amplitude;
};
struct FxElemAtlas
{
char behavior;
char index;
char fps;
char loopCount;
char colIndexBits;
char rowIndexBits;
__int16 entryCount;
};
struct FxElemVec3Range
{
float base[3];
float amplitude[3];
};
struct FxElemVelStateInFrame
{
FxElemVec3Range velocity;
FxElemVec3Range totalDelta;
};
struct FxElemVelStateSample
{
FxElemVelStateInFrame local;
FxElemVelStateInFrame world;
};
struct FxElemVisualState
{
char color[4];
float rotationDelta;
float rotationTotal;
float size[2];
float scale;
};
struct FxElemVisStateSample
{
FxElemVisualState base;
FxElemVisualState amplitude;
};
union FxEffectDefRef
{
FxEffectDef* handle;
const char* name;
};
union FxElemVisuals
{
const void* anonymous;
Material* material;
XModel* model;
FxEffectDefRef effectDef;
const char* soundName;
};
struct FxElemMarkVisuals
{
Material* materials[2];
};
union FxElemDefVisuals
{
FxElemMarkVisuals* markArray;
FxElemVisuals* array;
FxElemVisuals instance;
};
struct FxTrailVertex
{
float pos[2];
float normal[2];
float texCoord;
};
struct FxTrailDef
{
int scrollTimeMsec;
int repeatDist;
float invSplitDist;
float invSplitArcDist;
float invSplitTime;
int vertCount;
FxTrailVertex* verts;
int indCount;
unsigned __int16* inds;
};
struct FxSparkFountainDef
{
float gravity;
float bounceFrac;
float bounceRand;
float sparkSpacing;
float sparkLength;
int sparkCount;
float loopTime;
float velMin;
float velMax;
float velConeFrac;
float restSpeed;
float boostTime;
float boostFactor;
};
union FxElemExtendedDefPtr
{
FxTrailDef* trailDef;
FxSparkFountainDef* sparkFountainDef;
char* unknownDef;
};
struct FxElemDef
{
int flags;
FxSpawnDef spawn;
FxFloatRange spawnRange;
FxFloatRange fadeInRange;
FxFloatRange fadeOutRange;
float spawnFrustumCullRadius;
FxIntRange spawnDelayMsec;
FxIntRange lifeSpanMsec;
FxFloatRange spawnOrigin[3];
FxFloatRange spawnOffsetRadius;
FxFloatRange spawnOffsetHeight;
FxFloatRange spawnAngles[3];
FxFloatRange angularVelocity[3];
FxFloatRange initialRotation;
FxFloatRange gravity;
FxFloatRange reflectionFactor;
FxElemAtlas atlas;
char elemType;
char visualCount;
char velIntervalCount;
char visStateIntervalCount;
FxElemVelStateSample* velSamples;
FxElemVisStateSample* visSamples;
FxElemDefVisuals visuals;
Bounds collBounds;
FxEffectDefRef effectOnImpact;
FxEffectDefRef effectOnDeath;
FxEffectDefRef effectEmitted;
FxFloatRange emitDist;
FxFloatRange emitDistVariance;
FxElemExtendedDefPtr extended;
char sortOrder;
char lightingFrac;
char useItemClip;
char fadeInfo;
};
struct FxEffectDef
{
const char* name;
int flags;
int totalSize;
int msecLoopingLife;
int elemDefCountLooping;
int elemDefCountOneShot;
int elemDefCountEmission;
FxElemDef* elemDefs;
};
#ifndef __zonecodegenerator
}
#endif