Code-style consistency improvement:

Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
erwincoumans
2018-09-23 14:17:31 -07:00
parent b73b05e9fb
commit ab8f16961e
1773 changed files with 1081087 additions and 474249 deletions

View File

@@ -20,60 +20,55 @@ subject to the following restrictions:
#include <stdio.h>
#include <string.h>
void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
void BspConverter::convertBsp(BspLoader& bspLoader, float scaling)
{
{
float playstartf[3] = {0,0,100};
float playstartf[3] = {0, 0, 100};
if (bspLoader.findVectorByName(&playstartf[0],"info_player_start"))
if (bspLoader.findVectorByName(&playstartf[0], "info_player_start"))
{
printf("found playerstart\n");
}
}
else
{
if (bspLoader.findVectorByName(&playstartf[0],"info_player_deathmatch"))
if (bspLoader.findVectorByName(&playstartf[0], "info_player_deathmatch"))
{
printf("found deatchmatch start\n");
}
}
btVector3 playerStart (playstartf[0],playstartf[1],playstartf[2]);
btVector3 playerStart(playstartf[0], playstartf[1], playstartf[2]);
playerStart[2] += 20.f; //start a bit higher
playerStart[2] += 20.f; //start a bit higher
playerStart *= scaling;
//progressBegin("Loading bsp");
for (int i=0;i<bspLoader.m_numleafs;i++)
for (int i = 0; i < bspLoader.m_numleafs; i++)
{
printf("Reading bspLeaf %i from total %i (%f procent)\n",i, bspLoader.m_numleafs,(100.f*(float)i/float(bspLoader.m_numleafs)) );
printf("Reading bspLeaf %i from total %i (%f procent)\n", i, bspLoader.m_numleafs, (100.f * (float)i / float(bspLoader.m_numleafs)));
bool isValidBrush = false;
BSPLeaf& leaf = bspLoader.m_dleafs[i];
for (int b=0;b<leaf.numLeafBrushes;b++)
BSPLeaf& leaf = bspLoader.m_dleafs[i];
for (int b = 0; b < leaf.numLeafBrushes; b++)
{
btAlignedObjectArray<btVector3> planeEquations;
int brushid = bspLoader.m_dleafbrushes[leaf.firstLeafBrush+b];
int brushid = bspLoader.m_dleafbrushes[leaf.firstLeafBrush + b];
BSPBrush& brush = bspLoader.m_dbrushes[brushid];
if (brush.shaderNum!=-1)
if (brush.shaderNum != -1)
{
if (bspLoader.m_dshaders[ brush.shaderNum ].contentFlags & BSPCONTENTS_SOLID)
if (bspLoader.m_dshaders[brush.shaderNum].contentFlags & BSPCONTENTS_SOLID)
{
brush.shaderNum = -1;
for (int p=0;p<brush.numSides;p++)
for (int p = 0; p < brush.numSides; p++)
{
int sideid = brush.firstSide+p;
int sideid = brush.firstSide + p;
BSPBrushSide& brushside = bspLoader.m_dbrushsides[sideid];
int planeid = brushside.planeNum;
BSPPlane& plane = bspLoader.m_dplanes[planeid];
@@ -82,45 +77,44 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
plane.normal[0],
plane.normal[1],
plane.normal[2]);
planeEq[3] = scaling*-plane.dist;
planeEq[3] = scaling * -plane.dist;
planeEquations.push_back(planeEq);
isValidBrush=true;
isValidBrush = true;
}
if (isValidBrush)
{
btAlignedObjectArray<btVector3> vertices;
btGeometryUtil::getVerticesFromPlaneEquations(planeEquations, vertices);
btAlignedObjectArray<btVector3> vertices;
btGeometryUtil::getVerticesFromPlaneEquations(planeEquations,vertices);
bool isEntity = false;
btVector3 entityTarget(0.f,0.f,0.f);
addConvexVerticesCollider(vertices,isEntity,entityTarget);
btVector3 entityTarget(0.f, 0.f, 0.f);
addConvexVerticesCollider(vertices, isEntity, entityTarget);
}
}
}
}
}
}
#define USE_ENTITIES
#ifdef USE_ENTITIES
{
int i;
for (i=0;i<bspLoader.m_num_entities;i++)
for (i = 0; i < bspLoader.m_num_entities; i++)
{
const BSPEntity& entity = bspLoader.m_entities[i];
const char* cl = bspLoader.getValueForKey(&entity, "classname");
if (!strcmp(cl, "trigger_push"))
{
const BSPEntity& entity = bspLoader.m_entities[i];
const char* cl = bspLoader.getValueForKey(&entity,"classname");
if ( !strcmp( cl, "trigger_push" ) ) {
btVector3 targetLocation(0.f,0.f,0.f);
btVector3 targetLocation(0.f, 0.f, 0.f);
cl = bspLoader.getValueForKey(&entity,"target");
if ( strcmp( cl, "" ) ) {
//its not empty so ...
cl = bspLoader.getValueForKey(&entity, "target");
if (strcmp(cl, ""))
{
//its not empty so ...
/*
/*
//lookup the target position for the jumppad:
const BSPEntity* targetentity = bspLoader.getEntityByValue( "targetname" , cl );
if (targetentity)
@@ -132,76 +126,63 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
}
*/
cl = bspLoader.getValueForKey(&entity,"model");
if ( strcmp( cl, "" ) ) {
// add the model as a brush
if (cl[0] == '*')
cl = bspLoader.getValueForKey(&entity, "model");
if (strcmp(cl, ""))
{
// add the model as a brush
if (cl[0] == '*')
{
int modelnr = atoi(&cl[1]);
if ((modelnr >= 0) && (modelnr < bspLoader.m_nummodels))
{
int modelnr = atoi(&cl[1]);
if ((modelnr >=0) && (modelnr < bspLoader.m_nummodels))
const BSPModel& model = bspLoader.m_dmodels[modelnr];
for (int n = 0; n < model.numBrushes; n++)
{
const BSPModel& model = bspLoader.m_dmodels[modelnr];
for (int n=0;n<model.numBrushes;n++)
btAlignedObjectArray<btVector3> planeEquations;
bool isValidBrush = false;
//convert brush
const BSPBrush& brush = bspLoader.m_dbrushes[model.firstBrush + n];
{
btAlignedObjectArray<btVector3> planeEquations;
bool isValidBrush = false;
//convert brush
const BSPBrush& brush = bspLoader.m_dbrushes[model.firstBrush+n];
for (int p = 0; p < brush.numSides; p++)
{
for (int p=0;p<brush.numSides;p++)
{
int sideid = brush.firstSide+p;
BSPBrushSide& brushside = bspLoader.m_dbrushsides[sideid];
int planeid = brushside.planeNum;
BSPPlane& plane = bspLoader.m_dplanes[planeid];
btVector3 planeEq;
planeEq.setValue(
plane.normal[0],
plane.normal[1],
plane.normal[2]);
planeEq[3] = scaling*-plane.dist;
planeEquations.push_back(planeEq);
isValidBrush=true;
}
if (isValidBrush)
{
btAlignedObjectArray<btVector3> vertices;
btGeometryUtil::getVerticesFromPlaneEquations(planeEquations,vertices);
bool isEntity=true;
addConvexVerticesCollider(vertices,isEntity,targetLocation);
}
int sideid = brush.firstSide + p;
BSPBrushSide& brushside = bspLoader.m_dbrushsides[sideid];
int planeid = brushside.planeNum;
BSPPlane& plane = bspLoader.m_dplanes[planeid];
btVector3 planeEq;
planeEq.setValue(
plane.normal[0],
plane.normal[1],
plane.normal[2]);
planeEq[3] = scaling * -plane.dist;
planeEquations.push_back(planeEq);
isValidBrush = true;
}
if (isValidBrush)
{
btAlignedObjectArray<btVector3> vertices;
btGeometryUtil::getVerticesFromPlaneEquations(planeEquations, vertices);
bool isEntity = true;
addConvexVerticesCollider(vertices, isEntity, targetLocation);
}
}
}
}
else
{
printf("unsupported trigger_push model, md3 ?\n");
}
}
else
{
printf("unsupported trigger_push model, md3 ?\n");
}
}
}
}
}
#endif //USE_ENTITIES
}
#endif //USE_ENTITIES
//progressEnd();
}
}
}