feat(Tools/Mapextractor): Implemented liquid object detection (#11402)

* .

* .

* .

* .

* .

* .

* .

* Delete Utils.cpp
This commit is contained in:
IntelligentQuantum
2022-05-09 02:08:22 +04:30
committed by GitHub
parent 5036360c1e
commit a31a30566e
13 changed files with 394 additions and 382 deletions

View File

@@ -327,7 +327,7 @@ namespace VMAP
float pos_x;
float pos_y;
float pos_z;
short type;
short material;
};
#pragma pack(pop)
//=================================================================
@@ -532,19 +532,29 @@ namespace VMAP
delete[] vectorarray;
}
// ----- liquid
liquid = 0;
if (liquidflags & 1)
liquid = nullptr;
if (liquidflags & 3)
{
WMOLiquidHeader hlq;
READ_OR_RETURN(&blockId, 4);
CMP_OR_RETURN(blockId, "LIQU");
READ_OR_RETURN(&blocksize, sizeof(int));
READ_OR_RETURN(&hlq, sizeof(WMOLiquidHeader));
liquid = new WmoLiquid(hlq.xtiles, hlq.ytiles, Vector3(hlq.pos_x, hlq.pos_y, hlq.pos_z), hlq.type);
uint32 size = hlq.xverts * hlq.yverts;
READ_OR_RETURN(liquid->GetHeightStorage(), size * sizeof(float));
size = hlq.xtiles * hlq.ytiles;
READ_OR_RETURN(liquid->GetFlagsStorage(), size);
uint32 liquidType;
READ_OR_RETURN(&liquidType, sizeof(uint32));
if (liquidflags & 1)
{
WMOLiquidHeader hlq;
READ_OR_RETURN(&hlq, sizeof(WMOLiquidHeader));
liquid = new WmoLiquid(hlq.xtiles, hlq.ytiles, Vector3(hlq.pos_x, hlq.pos_y, hlq.pos_z), liquidType);
uint32 size = hlq.xverts * hlq.yverts;
READ_OR_RETURN(liquid->GetHeightStorage(), size * sizeof(float));
size = hlq.xtiles * hlq.ytiles;
READ_OR_RETURN(liquid->GetFlagsStorage(), size);
}
else
{
liquid = new WmoLiquid(0, 0, Vector3::zero(), liquidType);
liquid->GetHeightStorage()[0] = bounds.high().z;
}
}
return true;