[Structs] Update with correct cbrushside_t structure

This commit is contained in:
TheApadayo 2016-12-29 22:14:50 -05:00
parent d9eb9a273b
commit 307e67b056
4 changed files with 68 additions and 62 deletions

View File

@ -30,19 +30,19 @@ namespace Assets
Game::cbrushside_t* destSide = &destBrushSide[i]; Game::cbrushside_t* destSide = &destBrushSide[i];
Game::cbrushside_t* side = &brush->brush.brushSide[i]; Game::cbrushside_t* side = &brush->brush.brushSide[i];
if (side->side) if (side->plane)
{ {
if (builder->hasPointer(side->side)) if (builder->hasPointer(side->plane))
{ {
destSide->side = builder->getPointer(side->side); destSide->plane = builder->getPointer(side->plane);
} }
else else
{ {
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
builder->storePointer(side->side); builder->storePointer(side->plane);
buffer->save(side->side, sizeof(Game::cplane_t)); buffer->save(side->plane, sizeof(Game::cplane_t));
Utils::Stream::ClearPointer(&destSide->side); Utils::Stream::ClearPointer(&destSide->plane);
} }
} }
} }

View File

@ -105,21 +105,21 @@ namespace Assets
for (int i = 0; i < asset->numCBrushSides; ++i) for (int i = 0; i < asset->numCBrushSides; ++i)
{ {
if (sides[i].side) if (sides[i].plane)
{ {
AssertSize(Game::cplane_t, 20); AssertSize(Game::cplane_t, 20);
if (builder->hasPointer(sides[i].side)) if (builder->hasPointer(sides[i].plane))
{ {
sides[i].side = builder->getPointer(sides[i].side); sides[i].plane = builder->getPointer(sides[i].plane);
} }
else else
{ {
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
builder->storePointer(sides[i].side); builder->storePointer(sides[i].plane);
buffer->save(sides[i].side); buffer->save(sides[i].plane);
Utils::Stream::ClearPointer(&sides[i].side); Utils::Stream::ClearPointer(&sides[i].plane);
} }
} }
} }
@ -377,18 +377,18 @@ namespace Assets
Game::cbrushside_t* side = buffer->dest<Game::cbrushside_t>(); Game::cbrushside_t* side = buffer->dest<Game::cbrushside_t>();
buffer->save(brush->sides); buffer->save(brush->sides);
if (brush->sides->side) if (brush->sides->plane)
{ {
if (builder->hasPointer(brush->sides->side)) if (builder->hasPointer(brush->sides->plane))
{ {
side->side = builder->getPointer(brush->sides->side); side->plane = builder->getPointer(brush->sides->plane);
} }
else else
{ {
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
builder->storePointer(brush->sides->side); builder->storePointer(brush->sides->plane);
buffer->save(brush->sides->side); buffer->save(brush->sides->plane);
Utils::Stream::ClearPointer(&side->side); Utils::Stream::ClearPointer(&side->plane);
} }
} }
@ -661,12 +661,10 @@ namespace Assets
Components::Logger::Error("invalid plane index"); Components::Logger::Error("invalid plane index");
return; return;
} }
clipMap->cBrushSides[i].side = &clipMap->cPlanes[planeIndex]; clipMap->cBrushSides[i].plane = &clipMap->cPlanes[planeIndex];
reader.read<int>(); // materialNum clipMap->cBrushSides[i].materialNum = static_cast<unsigned short>(reader.read<int>()); // materialNum
reader.read<short>(); // firstAdjacentSide clipMap->cBrushSides[i].firstAdjacentSideOffset = static_cast<char>(reader.read<short>()); // firstAdjacentSide
reader.read<char>(); // edgeCount clipMap->cBrushSides[i].edgeCount = reader.read<char>(); // edgeCount
// not sure how to fill out texInfo and dispInfo
// just leave zero for now
} }
} }

View File

@ -182,19 +182,7 @@ namespace Components
void QuickPatch::testFunc() void QuickPatch::testFunc()
{ {
Game::DB_EnumXAssets(Game::XAssetType::ASSET_TYPE_CLIPMAP_PVS, [](Game::XAssetHeader header, void* /*unused*/)
{
Game::clipMap_t* map = header.clipMap;
for (int i = 0; i < map->numCBrushSides; ++i)
{
if (map->cBrushSides[i].texInfo > map->numMaterials)
{
__debugbreak();
}
}
}, nullptr, false);
} }
QuickPatch::QuickPatch() QuickPatch::QuickPatch()

View File

@ -1624,9 +1624,10 @@ namespace Game
struct cbrushside_t struct cbrushside_t
{ {
cplane_t* side; cplane_t *plane;
short texInfo; unsigned __int16 materialNum;
short dispInfo; char firstAdjacentSideOffset;
char edgeCount;
}; };
struct cbrushWrapper_t struct cbrushWrapper_t
@ -2986,8 +2987,27 @@ namespace Game
//char flags; //char flags;
}; };
struct GfxPackedPlacement
{
float origin[3];
vec3_t/*PackedUnitVec*/ axis[3];
float scale;
};
struct GfxStaticModelDrawInst
{
GfxPackedPlacement placement;
XModel *model;
unsigned __int16 cullDist;
unsigned __int16 lightingHandle;
char reflectionProbeIndex;
char primaryLightIndex;
char flags;
char firstMtlSkinIndex;
GfxColor groundLighting;
unsigned __int16 cacheId[4];
};
struct GfxStaticModelDrawInst;
struct GfxWorldDpvsStatic struct GfxWorldDpvsStatic
{ {
unsigned int smodelCount; unsigned int smodelCount;
@ -3017,28 +3037,6 @@ namespace Game
#pragma pack(push, 4) #pragma pack(push, 4)
struct GfxPackedPlacement
{
float origin[3];
vec3_t/*PackedUnitVec*/ axis[3];
float scale;
};
struct GfxStaticModelDrawInst
{
GfxPackedPlacement placement;
//char pad[24];
XModel *model; // 52
float cullDist;
char reflectionProbeIndex;
char primaryLightIndex;
unsigned __int16 lightingHandle;
char flags;
char pad2[8];
};
struct GfxPortalWritable struct GfxPortalWritable
{ {
@ -3732,6 +3730,28 @@ namespace Game
typedef char mapname_t[40]; typedef char mapname_t[40];
struct traceWork_t
{
/*TraceExtents*/int extents;
float delta[3];
float deltaLen;
float deltaLenSq;
float delta2DLen;
float delta2DLenSq;
float size[3];
Bounds bounds;
int contents;
bool isPoint;
bool axialCullOnly;
float radius;
float offset[3];
float radiusOffset[3];
float boundingRadius;
/*TraceThreadInfo*/ int threadInfo;
/*CM_WorldTraceCallbacks*/ void *callbacks;
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif