Nothing special

This commit is contained in:
momo5502 2016-06-13 18:09:02 +02:00
parent eb6b20e95c
commit 9c8904d561
6 changed files with 608 additions and 17 deletions

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 17184909820c448d51212599006ab65476a398df Subproject commit a67323fc1216d955b68c4d87a91fee355adbf6bb

View File

@ -2,9 +2,6 @@
namespace Components namespace Components
{ {
void* Maps::WorldMP = 0;
void* Maps::WorldSP = 0;
std::map<std::string, std::string> Maps::DependencyList; std::map<std::string, std::string> Maps::DependencyList;
std::vector<std::string> Maps::CurrentDependencies; std::vector<std::string> Maps::CurrentDependencies;
@ -50,6 +47,26 @@ namespace Components
return FastFiles::LoadLocalizeZones(data.data(), data.size(), sync); return FastFiles::LoadLocalizeZones(data.data(), data.size(), sync);
} }
void Maps::OverrideMapEnts(Game::MapEnts* ents)
{
auto callback = [] (Game::XAssetHeader header, void* ents)
{
Game::MapEnts* mapEnts = reinterpret_cast<Game::MapEnts*>(ents);
Game::clipMap_t* clipMap = header.clipMap;
if (clipMap && mapEnts && !_stricmp(mapEnts->name, clipMap->name))
{
clipMap->mapEnts = mapEnts;
//*Game::marMapEntsPtr = mapEnts;
//Game::G_SpawnEntitiesFromString();
}
};
// Internal doesn't lock the thread, as locking is impossible, due to executing this in the thread that holds the current lock
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_COL_MAP_MP, callback, ents, true);
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_COL_MAP_SP, callback, ents, true);
}
void Maps::LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict) void Maps::LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict)
{ {
if (std::find(Maps::CurrentDependencies.begin(), Maps::CurrentDependencies.end(), FastFiles::Current()) != Maps::CurrentDependencies.end()) if (std::find(Maps::CurrentDependencies.begin(), Maps::CurrentDependencies.end(), FastFiles::Current()) != Maps::CurrentDependencies.end())
@ -77,6 +94,10 @@ namespace Components
asset.mapEnts->entityString = const_cast<char*>(mapEntities.data()); asset.mapEnts->entityString = const_cast<char*>(mapEntities.data());
asset.mapEnts->numEntityChars = mapEntities.size() + 1; asset.mapEnts->numEntityChars = mapEntities.size() + 1;
} }
// Apply new mapEnts
// This doesn't work, entities are spawned before the patch file is loaded
//Maps::OverrideMapEnts(asset.mapEnts);
} }
} }
@ -87,12 +108,12 @@ namespace Components
format = "maps/%s.d3dbsp"; format = "maps/%s.d3dbsp";
// Adjust pointer to GameMap_Data // Adjust pointer to GameMap_Data
Utils::Hook::Set<void*>(0x4D90B7, Maps::WorldSP); Utils::Hook::Set<Game::GameMap_Data**>(0x4D90B7, &(Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_SP].gameMapSP[0].data));
} }
else else
{ {
// Adjust pointer to GameMap_Data // Adjust pointer to GameMap_Data
Utils::Hook::Set<void*>(0x4D90B7, Maps::WorldMP); Utils::Hook::Set<Game::GameMap_Data**>(0x4D90B7, &(Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_MP].gameMapMP[0].data));
} }
AntiCheat::EmptyHash(); AntiCheat::EmptyHash();
@ -170,9 +191,7 @@ namespace Components
// Intercept map zone loading // Intercept map zone loading
Utils::Hook(0x42C2AF, Maps::LoadMapZones, HOOK_CALL).Install()->Quick(); Utils::Hook(0x42C2AF, Maps::LoadMapZones, HOOK_CALL).Install()->Quick();
Maps::WorldSP = static_cast<char*>(Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_GAME_MAP_SP, 1)) + 52; // Skip name and other padding to reach world data Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_GAME_MAP_SP, 1);
Maps::WorldMP = Utils::Hook::Get<char*>(0x4D90B7);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_IMAGE, 7168); Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_IMAGE, 7168);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, 2700); Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, 2700);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_FX, 1200); Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_FX, 1200);

View File

@ -10,9 +10,6 @@ namespace Components
static void AddDependency(std::string expression, std::string zone); static void AddDependency(std::string expression, std::string zone);
private: private:
static void* WorldMP;
static void* WorldSP;
static std::vector<Game::XAssetEntry> EntryPool; static std::vector<Game::XAssetEntry> EntryPool;
static std::map<std::string, std::string> DependencyList; static std::map<std::string, std::string> DependencyList;
@ -22,6 +19,8 @@ namespace Components
static void LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict); static void LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict);
static void LoadMapZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync); static void LoadMapZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
static void OverrideMapEnts(Game::MapEnts* ents);
void ReallocateEntryPool(); void ReallocateEntryPool();
}; };
} }

View File

@ -28,10 +28,12 @@ namespace Game
Con_DrawSolidConsole_t Con_DrawSolidConsole = (Con_DrawSolidConsole_t)0x5A5040; Con_DrawSolidConsole_t Con_DrawSolidConsole = (Con_DrawSolidConsole_t)0x5A5040;
DB_EnumXAssets_t DB_EnumXAssets = (DB_EnumXAssets_t)0x4B76D0; DB_EnumXAssets_t DB_EnumXAssets = (DB_EnumXAssets_t)0x4B76D0;
DB_EnumXAssets_Internal_t DB_EnumXAssets_Internal = (DB_EnumXAssets_Internal_t)0x5BB0A0;
DB_FindXAssetHeader_t DB_FindXAssetHeader = (DB_FindXAssetHeader_t)0x407930; DB_FindXAssetHeader_t DB_FindXAssetHeader = (DB_FindXAssetHeader_t)0x407930;
DB_GetXAssetNameHandler_t* DB_GetXAssetNameHandlers = (DB_GetXAssetNameHandler_t*)0x799328; DB_GetXAssetNameHandler_t* DB_GetXAssetNameHandlers = (DB_GetXAssetNameHandler_t*)0x799328;
DB_GetXAssetSizeHandler_t* DB_GetXAssetSizeHandlers = (DB_GetXAssetSizeHandler_t*)0x799488; DB_GetXAssetSizeHandler_t* DB_GetXAssetSizeHandlers = (DB_GetXAssetSizeHandler_t*)0x799488;
DB_GetXAssetTypeName_t DB_GetXAssetTypeName = (DB_GetXAssetTypeName_t)0x4CFCF0; DB_GetXAssetTypeName_t DB_GetXAssetTypeName = (DB_GetXAssetTypeName_t)0x4CFCF0;
DB_IsXAssetDefault_t DB_IsXAssetDefault = (DB_IsXAssetDefault_t)0x48E6A0;
DB_LoadXAssets_t DB_LoadXAssets = (DB_LoadXAssets_t)0x4E5930; DB_LoadXAssets_t DB_LoadXAssets = (DB_LoadXAssets_t)0x4E5930;
Dvar_RegisterBool_t Dvar_RegisterBool = (Dvar_RegisterBool_t)0x4CE1A0; Dvar_RegisterBool_t Dvar_RegisterBool = (Dvar_RegisterBool_t)0x4CE1A0;
@ -72,6 +74,8 @@ namespace Game
FS_Restart_t FS_Restart = (FS_Restart_t)0x461A50; FS_Restart_t FS_Restart = (FS_Restart_t)0x461A50;
FS_BuildPathToFile_t FS_BuildPathToFile = (FS_BuildPathToFile_t)0x4702C0; FS_BuildPathToFile_t FS_BuildPathToFile = (FS_BuildPathToFile_t)0x4702C0;
G_SpawnEntitiesFromString_t G_SpawnEntitiesFromString = (G_SpawnEntitiesFromString_t)0x4D8840;
GScr_LoadGameTypeScript_t GScr_LoadGameTypeScript = (GScr_LoadGameTypeScript_t)0x4ED9A0; GScr_LoadGameTypeScript_t GScr_LoadGameTypeScript = (GScr_LoadGameTypeScript_t)0x4ED9A0;
Image_LoadFromFileWithReader_t Image_LoadFromFileWithReader = (Image_LoadFromFileWithReader_t)0x53ABF0; Image_LoadFromFileWithReader_t Image_LoadFromFileWithReader = (Image_LoadFromFileWithReader_t)0x53ABF0;
@ -174,7 +178,7 @@ namespace Game
Win_GetLanguage_t Win_GetLanguage = (Win_GetLanguage_t)0x45CBA0; Win_GetLanguage_t Win_GetLanguage = (Win_GetLanguage_t)0x45CBA0;
void** DB_XAssetPool = (void**)0x7998A8; XAssetHeader* DB_XAssetPool = (XAssetHeader*)0x7998A8;
unsigned int* g_poolSize = (unsigned int*)0x7995E8; unsigned int* g_poolSize = (unsigned int*)0x7995E8;
DWORD* cmd_id = (DWORD*)0x1AAC5D0; DWORD* cmd_id = (DWORD*)0x1AAC5D0;
@ -221,10 +225,13 @@ namespace Game
SafeArea* safeArea = (SafeArea*)0xA15F48; SafeArea* safeArea = (SafeArea*)0xA15F48;
void* ReallocateAssetPool(XAssetType type, unsigned int newSize) SpawnVar* spawnVars = (SpawnVar*)0x1A83DE8;
MapEnts** marMapEntsPtr = (MapEnts**)0x112AD34;
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
{ {
int elSize = DB_GetXAssetSizeHandlers[type](); int elSize = DB_GetXAssetSizeHandlers[type]();
void* poolEntry = Utils::Memory::Allocate(newSize * elSize); XAssetHeader poolEntry = { Utils::Memory::Allocate(newSize * elSize) };
DB_XAssetPool[type] = poolEntry; DB_XAssetPool[type] = poolEntry;
g_poolSize[type] = newSize; g_poolSize[type] = newSize;
return poolEntry; return poolEntry;

View File

@ -57,6 +57,9 @@ namespace Game
typedef void(__cdecl * DB_EnumXAssets_t)(XAssetType type, void(*)(XAssetHeader, void *), void* userdata, bool overrides); typedef void(__cdecl * DB_EnumXAssets_t)(XAssetType type, void(*)(XAssetHeader, void *), void* userdata, bool overrides);
extern DB_EnumXAssets_t DB_EnumXAssets; extern DB_EnumXAssets_t DB_EnumXAssets;
typedef void(__cdecl * DB_EnumXAssets_Internal_t)(XAssetType type, void(*)(XAssetHeader, void *), void* userdata, bool overrides);
extern DB_EnumXAssets_Internal_t DB_EnumXAssets_Internal;
typedef XAssetHeader (__cdecl * DB_FindXAssetHeader_t)(XAssetType type, const char* name); typedef XAssetHeader (__cdecl * DB_FindXAssetHeader_t)(XAssetType type, const char* name);
extern DB_FindXAssetHeader_t DB_FindXAssetHeader; extern DB_FindXAssetHeader_t DB_FindXAssetHeader;
@ -69,6 +72,9 @@ namespace Game
typedef const char *(__cdecl * DB_GetXAssetTypeName_t)(XAssetType type); typedef const char *(__cdecl * DB_GetXAssetTypeName_t)(XAssetType type);
extern DB_GetXAssetTypeName_t DB_GetXAssetTypeName; extern DB_GetXAssetTypeName_t DB_GetXAssetTypeName;
typedef const char *(__cdecl * DB_IsXAssetDefault_t)(XAssetType type, const char* name);
extern DB_IsXAssetDefault_t DB_IsXAssetDefault;
typedef void(*DB_LoadXAssets_t)(XZoneInfo *zoneInfo, unsigned int zoneCount, int sync); typedef void(*DB_LoadXAssets_t)(XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
extern DB_LoadXAssets_t DB_LoadXAssets; extern DB_LoadXAssets_t DB_LoadXAssets;
@ -169,6 +175,9 @@ namespace Game
typedef int(__cdecl * FS_BuildPathToFile_t)(const char*, const char*, const char*, char**); typedef int(__cdecl * FS_BuildPathToFile_t)(const char*, const char*, const char*, char**);
extern FS_BuildPathToFile_t FS_BuildPathToFile; extern FS_BuildPathToFile_t FS_BuildPathToFile;
typedef void(__cdecl* G_SpawnEntitiesFromString_t)();
extern G_SpawnEntitiesFromString_t G_SpawnEntitiesFromString;
typedef void(__cdecl * GScr_LoadGameTypeScript_t)(); typedef void(__cdecl * GScr_LoadGameTypeScript_t)();
extern GScr_LoadGameTypeScript_t GScr_LoadGameTypeScript; extern GScr_LoadGameTypeScript_t GScr_LoadGameTypeScript;
@ -395,7 +404,7 @@ namespace Game
typedef const char * (__cdecl * Win_GetLanguage_t)(); typedef const char * (__cdecl * Win_GetLanguage_t)();
extern Win_GetLanguage_t Win_GetLanguage; extern Win_GetLanguage_t Win_GetLanguage;
extern void** DB_XAssetPool; extern XAssetHeader* DB_XAssetPool;
extern unsigned int* g_poolSize; extern unsigned int* g_poolSize;
extern DWORD* cmd_id; extern DWORD* cmd_id;
@ -441,7 +450,10 @@ namespace Game
extern SafeArea* safeArea; extern SafeArea* safeArea;
void* ReallocateAssetPool(XAssetType type, unsigned int newSize); extern SpawnVar* spawnVars;
extern MapEnts** marMapEntsPtr;
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
void Menu_FreeItemMemory(Game::itemDef_t* item); void Menu_FreeItemMemory(Game::itemDef_t* item);
const char* TableLookup(StringTable* stringtable, int row, int column); const char* TableLookup(StringTable* stringtable, int row, int column);
const char* UI_LocalizeMapName(const char* mapName); const char* UI_LocalizeMapName(const char* mapName);

View File

@ -1683,6 +1683,545 @@ namespace Game
// 88 - 0x58 // 88 - 0x58
}; };
/* FxEffectDef::flags */
#define FX_ELEM_LOOPING 0x1
#define FX_ELEM_USE_RAND_COLOR 0x2
#define FX_ELEM_USE_RAND_ALPHA 0x4
#define FX_ELEM_USE_RAND_SIZE0 0x8
#define FX_ELEM_USE_RAND_SIZE1 0x10
#define FX_ELEM_USE_RAND_SCALE 0x20
#define FX_ELEM_USE_RAND_ROT_DELTA 0x40
#define FX_ELEM_MOD_COLOR_BY_ALPHA 0x80
#define FX_ELEM_USE_RAND_VEL0 0x100
#define FX_ELEM_USE_RAND_VEL1 0x200
#define FX_ELEM_USE_BACK_COMPAT_VEL 0x400
#define FX_ELEM_ABS_VEL0 0x800
#define FX_ELEM_ABS_VEL1 0x1000
#define FX_ELEM_PLAY_ON_TOUCH 0x2000
#define FX_ELEM_PLAY_ON_DEATH 0x4000
#define FX_ELEM_PLAY_ON_RUN 0x8000
#define FX_ELEM_BOUNDING_SPHERE 0x10000
#define FX_ELEM_USE_ITEM_CLIP 0x20000
#define FX_ELEM_DISABLED 0x80000000
#define FX_ELEM_DECAL_FADE_IN 0x40000
/* FxElemDef::flags */
#define FX_ELEM_SPAWN_RELATIVE_TO_EFFECT 0x2
#define FX_ELEM_SPAWN_FRUSTUM_CULL 0x4
#define FX_ELEM_RUNNER_USES_RAND_ROT 0x8
#define FX_ELEM_SPAWN_OFFSET_NONE 0x0
#define FX_ELEM_SPAWN_OFFSET_SPHERE 0x10
#define FX_ELEM_SPAWN_OFFSET_CYLINDER 0x20
#define FX_ELEM_SPAWN_OFFSET_MASK 0x30
#define FX_ELEM_RUN_RELATIVE_TO_WORLD 0x0
#define FX_ELEM_RUN_RELATIVE_TO_SPAWN 0x40
#define FX_ELEM_RUN_RELATIVE_TO_EFFECT 0x80
#define FX_ELEM_RUN_RELATIVE_TO_OFFSET 0xC0
#define FX_ELEM_RUN_MASK 0xC0
#define FX_ELEM_USE_COLLISION 0x100
#define FX_ELEM_DIE_ON_TOUCH 0x200
#define FX_ELEM_DRAW_PAST_FOG 0x400
#define FX_ELEM_DRAW_WITH_VIEWMODEL 0x800
#define FX_ELEM_BLOCK_SIGHT 0x1000
#define FX_ELEM_HAS_VELOCITY_GRAPH_LOCAL 0x1000000
#define FX_ELEM_HAS_VELOCITY_GRAPH_WORLD 0x2000000
#define FX_ELEM_HAS_GRAVITY 0x4000000
#define FX_ELEM_USE_MODEL_PHYSICS 0x8000000
#define FX_ELEM_NONUNIFORM_SCALE 0x10000000
#define FX_ELEM_CLOUD_SHAPE_CUBE 0x0
#define FX_ELEM_CLOUD_SHAPE_SPHERE_LARGE 0x20000000
#define FX_ELEM_CLOUD_SHAPE_SPHERE_MEDIUM 0x40000000
#define FX_ELEM_CLOUD_SHAPE_SPHERE_SMALL 0x60000000
#define FX_ELEM_CLOUD_MASK 0x60000000
#define FX_ELEM_DISABLE_FOUNTAIN_COLLISION 0x80000000
#define FX_ELEM_DRAW_IN_THERMAL_ONLY 0x2000
#define FX_ELEM_TRAIL_ORIENT_BY_VELOCITY 0x4000
#define FX_ELEM_EMIT_ORIENT_BY_ELEM 0x8000
/* FxElemAtlas::behavior */
#define FX_ATLAS_START_MASK 0x3
#define FX_ATLAS_START_FIXED 0x0
#define FX_ATLAS_START_RANDOM 0x1
#define FX_ATLAS_START_INDEXED 0x2
#define FX_ATLAS_PLAY_OVER_LIFE 0x4
#define FX_ATLAS_LOOP_ONLY_N_TIMES 0x8
enum FxElemType : char
{
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_SPARKCLOUD = 0x5,
FX_ELEM_TYPE_SPARKFOUNTAIN = 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 FxElemVec3Range
{
float base[3];
float amplitude[3];
};
struct FxIntRange
{
int base;
int amplitude;
};
struct FxFloatRange
{
float base;
float amplitude;
};
struct FxSpawnDefLooping
{
int intervalMsec;
int count;
};
struct FxSpawnDefOneShot
{
FxIntRange count;
};
union FxSpawnDef
{
FxSpawnDefLooping looping;
FxSpawnDefOneShot oneShot;
};
struct FxEffectDef;
union FxEffectDefRef
{
FxEffectDef *handle;
const char *name;
};
union FxElemVisuals
{
const void *anonymous;
Material *material;
XModel *xmodel;
FxEffectDefRef *effectDef;
const char *soundName;
};
struct FxElemMarkVisuals
{
Material* data[2];
};
union FxElemDefVisuals
{
FxElemVisuals instance;
//If parent FxElemDef::elemType == 0x7, use xmodel
//If parent FxElemDef::elemType == 0xC, use effectDef
//If parent FxElemDef::elemType == 0xA, use soundName
//If parent FxElemDef::elemType != 0x9 || 0x8, use material
FxElemVisuals *array; //Total count = parent FxElemDef::visualCount
FxElemMarkVisuals *markArray; //Total count = parent FxElemDef::visualCount
};
struct FxTrailVertex
{
float pos[2];
float normal[2];
float texCoord[2];
};
struct FxTrailDef
{
int scrollTimeMsec;
int repeatDist;
float splitArcDist;
int splitDist;
int splitTime;
int vertCount;
FxTrailVertex *verts;
int indCount;
unsigned __int16 *inds;
};
struct FxSparkFountain
{
float sparkFountainGravity;
float sparkFountainBounceFrac;
float sparkFountainBounceRand;
float sparkFountainSparkSpacing;
float sparkFountainSparkLength;
int sparkFountainSparkCount;
float sparkFountainLoopTime;
float sparkFountainVelMin;
float sparkFountainVelMax;
float sparkFountainVelConeAngle;
float sparkFountainRestSpeed;
float sparkFountainBoostTime;
float sparkFountainBoostFactor;
};
union unknownFxUnion
{
char *unknownBytes;
FxSparkFountain *sparkFountain;
FxTrailDef *trailDef;
};
struct FxElemAtlas
{
char behavior;
char index;
char fps;
char loopCount;
char colIndexBits;
char rowIndexBits;
__int16 entryCount;
};
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;
};
struct FxElemDef // 0xFC
{
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; // count = velIntervalCount
FxElemVisStateSample *visSamples; // count = visStateIntervalCount
FxElemDefVisuals visuals;
//If elemType is 0xB, then use markVisuals
//If elemType is not 0xB and visualCount == 1, then use visual
//If elemType is not 0xB and visualCount != 1, then use visualsArray
vec3_t collMins;
vec3_t collMaxs;
FxEffectDefRef *effectOnImpact;
FxEffectDefRef *effectOnDeath;
FxEffectDefRef *effectEmitted;
FxFloatRange emitDist;
FxFloatRange emitDistVariance;
unknownFxUnion *trailDef;
//If elemType == 3, then use trailDef
//If elemType == 6, then use sparkFountain
//If elemType != 3 && elemType != 6 use unknownBytes (size = 1)
char sortOrder;
char lightingFrac;
char unused[2];
};
struct FxEffectDef
{
const char *name;
int flags;
int totalSize;
int msecLoopingLife;
int elemDefCountLooping;
int elemDefCountOneShot;
int elemDefCountEmission;
FxElemDef *elemDefs; //Count = elemDefCountOneShot + elemDefCountEmission + elemDefCountLooping
};
struct cPlane
{
vec3_t a;
float dist;
int type;
};
struct cStaticModel
{
XModel *xmodel;
float origin[3];
float invScaledAxis[3][3];
float absmin[3];
float absmax[3];
};
struct dMaterial
{
char* name;
int unk;
int unk2;
};
struct cNode
{
cPlane* plane;
short children[2];
};
struct cBrushSide
{
cPlane* side;
short texInfo, dispInfo;
};
struct cBrush
{
int count;
cBrushSide * brushSide;
char * brushEdge;
char pad[24];
};
struct cLeaf
{
unsigned __int16 firstCollAabbIndex;
unsigned __int16 collAabbCount;
int brushContents;
int terrainContents;
float mins[3];
float maxs[3];
int leafBrushNode;
};
struct cLeafBrushNodeLeaf
{
unsigned __int16 *brushes;
};
struct cLeafBrushNodeChildren
{
float dist;
float range;
unsigned __int16 childOffset[6];
};
union cLeafBrushNodeData
{
cLeafBrushNodeLeaf leaf;
cLeafBrushNodeChildren children;
};
struct cLeafBrushNode
{
char axis;
__int16 leafBrushCount;
int contents;
cLeafBrushNodeData data;
};
struct cModel
{
float mins[3];
float maxs[3];
float radius;
cLeaf leaf;
};
enum DynEntityType
{
DYNENT_TYPE_INVALID = 0x0,
DYNENT_TYPE_CLUTTER = 0x1,
DYNENT_TYPE_DESTRUCT = 0x2,
DYNENT_TYPE_COUNT = 0x3,
};
struct GfxPlacement
{
float quat[4];
float origin[3];
};
struct DynEntityDef
{
DynEntityType type;
GfxPlacement pose;
XModel *xModel;
unsigned __int16 brushModel;
unsigned __int16 physicsBrushModel;
FxEffectDef *destroyFx;
PhysPreset *physPreset;
int health;
PhysMass mass;
int contents;
};
struct DynEntityPose
{
GfxPlacement pose;
float radius;
};
struct DynEntityClient
{
int physObjId;
unsigned __int16 flags;
unsigned __int16 lightingHandle;
int health;
};
struct DynEntityColl
{
unsigned __int16 sector;
unsigned __int16 nextEntInSector;
float linkMins[2];
float linkMaxs[2];
};
struct CollisionBorder
{
float distEq[3];
float zBase;
float zSlope;
float start;
float length;
};
struct CollisionPartition
{
char triCount;
char borderCount;
int firstTri;
CollisionBorder *borders;
};
union CollisionAabbTreeIndex
{
int firstChildIndex;
int partitionIndex;
};
struct CollisionAabbTree
{
float origin[3];
float halfSize[3];
unsigned __int16 materialIndex;
unsigned __int16 childCount;
CollisionAabbTreeIndex u;
};
struct clipMap_t
{
const char* name;
int unknown1; // +8
int numCPlanes; // +8
cPlane* cPlanes; // sizeof 20, +12
int numStaticModels; // +16
cStaticModel* staticModelList; // sizeof 76, +20
int numMaterials; // +24
dMaterial* materials; // sizeof 12 with a string (possibly name?), +28
int numCBrushSides; // +32
cBrushSide* cBrushSides; // sizeof 8, +36
int numCBrushEdges; // +40
char* cBrushEdges; // +44
int numCNodes; // +48
cNode * cNodes; // sizeof 8, +52
int numCLeaf; // +56
cLeaf* cLeaf; // +60
int numCLeafBrushNodes; // +64
cLeafBrushNode* cLeafBrushNodes; // +68
int numLeafBrushes; // +72
short* leafBrushes; // +76
int numLeafSurfaces; // +80
int* leafSurfaces; // +84
int numVerts; // +88
vec3_t* verts; // +92
int numTriIndices; // +96
short* triIndices; // +100
bool* triEdgeIsWalkable; // +104
int numCollisionBorders; // +108
CollisionBorder* collisionBorders;// sizeof 28, +112
int numCollisionPartitions; // +116
CollisionPartition* collisionPartitions; // sizeof 12, +120
int numCollisionAABBTrees; // +124
CollisionAabbTree* collisionAABBTrees;// sizeof 32, +128
int numCModels; // +132
cModel* cModels; // sizeof 68, +136
short numCBrushes; // +140
short pad2; // +142
cBrush * cBrushes; // sizeof 36, +144
void* unknown2; // same count as cBrushes, +148
int * unknown3; // same count as cBrushes, +152
MapEnts * mapEnts; // +156
int unkCount4; // +160
void* unknown4; // +164
unsigned __int16 dynEntCount[2];
DynEntityDef *dynEntDefList[2];
DynEntityPose *dynEntPoseList[2];
DynEntityClient *dynEntClientList[2];
DynEntityColl *dynEntCollList[2];
unsigned int checksum;
char unknown5[0x30];
}; // +256
struct GameMap_Data
{
void* unk1;
int unkCount1;
int unkCount2;
void* unk2;
char pad[112];
};
struct GameMap_SP
{
const char* name;
char pad[48];
GameMap_Data* data;
};
struct GameMap_MP
{
const char* name;
GameMap_Data* data;
};
union XAssetHeader union XAssetHeader
{ {
void *data; void *data;
@ -1706,6 +2245,10 @@ namespace Game
PhysCollmap* physCollmap; PhysCollmap* physCollmap;
XModelSurfs* surfaces; XModelSurfs* surfaces;
XAnimParts* xanim; XAnimParts* xanim;
clipMap_t* clipMap;
FxEffectDef* fx;
GameMap_MP* gameMapMP;
GameMap_SP* gameMapSP;
}; };
struct XAsset struct XAsset
@ -1864,6 +2407,17 @@ namespace Game
float bottom; float bottom;
}; };
#pragma pack(push, 4)
struct SpawnVar
{
bool spawnVarsValid;
int numSpawnVars;
char *spawnVars[64][2];
int numSpawnVarChars;
char spawnVarChars[2048];
};
#pragma pack(pop)
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif