From e1cd441c106c6b791a29f38697d4353bbfc98afb Mon Sep 17 00:00:00 2001 From: Garux Date: Fri, 28 Mar 2025 03:19:25 +0500 Subject: [PATCH] minor tweaks --- radiant/patch.cpp | 6 +--- tools/quake3/q3map2/bspfile_ibsp.cpp | 42 ++++++++++++++-------------- tools/quake3/q3map2/convert_bsp.cpp | 6 ++-- tools/quake3/q3map2/q3map2.h | 12 ++++---- tools/quake3/q3map2/surface.cpp | 2 +- 5 files changed, 31 insertions(+), 37 deletions(-) diff --git a/radiant/patch.cpp b/radiant/patch.cpp index 486ea441..b0f1c78e 100644 --- a/radiant/patch.cpp +++ b/radiant/patch.cpp @@ -315,11 +315,7 @@ void Patch::TransposeMatrix(){ } } - { - std::size_t tmp = m_width; - m_width = m_height; - m_height = tmp; - } + std::swap( m_width, m_height ); controlPointsChanged(); } diff --git a/tools/quake3/q3map2/bspfile_ibsp.cpp b/tools/quake3/q3map2/bspfile_ibsp.cpp index 96c3ec96..83ba112b 100644 --- a/tools/quake3/q3map2/bspfile_ibsp.cpp +++ b/tools/quake3/q3map2/bspfile_ibsp.cpp @@ -82,7 +82,7 @@ struct ibspBrushSide_t int planeNum; int shaderNum; ibspBrushSide_t( const bspBrushSide_t& other ) : - planeNum( other.planeNum ), + planeNum ( other.planeNum ), shaderNum( other.shaderNum ){} operator bspBrushSide_t() const { return { planeNum, shaderNum, -1 }; @@ -114,22 +114,22 @@ struct ibspDrawSurface_t int patchWidth; int patchHeight; ibspDrawSurface_t( const bspDrawSurface_t& other ) : - shaderNum( other.shaderNum ), - fogNum( other.fogNum ), - surfaceType( other.surfaceType ), - firstVert( other.firstVert ), - numVerts( other.numVerts ), - firstIndex( other.firstIndex ), - numIndexes( other.numIndexes ), - lightmapNum( other.lightmapNum[0] ), - lightmapX( other.lightmapX[0] ), - lightmapY( other.lightmapY[0] ), - lightmapWidth( other.lightmapWidth ), + shaderNum ( other.shaderNum ), + fogNum ( other.fogNum ), + surfaceType ( other.surfaceType ), + firstVert ( other.firstVert ), + numVerts ( other.numVerts ), + firstIndex ( other.firstIndex ), + numIndexes ( other.numIndexes ), + lightmapNum ( other.lightmapNum[0] ), + lightmapX ( other.lightmapX[0] ), + lightmapY ( other.lightmapY[0] ), + lightmapWidth ( other.lightmapWidth ), lightmapHeight( other.lightmapHeight ), lightmapOrigin( other.lightmapOrigin ), - lightmapVecs{ other.lightmapVecs[0], other.lightmapVecs[1], other.lightmapVecs[2] }, - patchWidth( other.patchWidth ), - patchHeight( other.patchHeight ) {} + lightmapVecs { other.lightmapVecs[0], other.lightmapVecs[1], other.lightmapVecs[2] }, + patchWidth ( other.patchWidth ), + patchHeight ( other.patchHeight ) {} operator bspDrawSurface_t() const { static_assert( MAX_LIGHTMAPS == 4 ); return{ @@ -166,11 +166,11 @@ struct ibspDrawVert_t Vector3 normal; Color4b color; ibspDrawVert_t( const bspDrawVert_t& other ) : - xyz( other.xyz ), - st( other.st ), + xyz ( other.xyz ), + st ( other.st ), lightmap( other.lightmap[0] ), - normal( other.normal ), - color( other.color[0] ) {} + normal ( other.normal ), + color ( other.color[0] ) {} operator bspDrawVert_t() const { static_assert( MAX_LIGHTMAPS == 4 ); return { @@ -192,9 +192,9 @@ struct ibspGridPoint_t Vector3b directed; byte latLong[ 2 ]; ibspGridPoint_t( const bspGridPoint_t& other ) : - ambient( other.ambient[0] ), + ambient ( other.ambient[0] ), directed( other.directed[0] ), - latLong{ other.latLong[0], other.latLong[1] } {} + latLong { other.latLong[0], other.latLong[1] } {} operator bspGridPoint_t() const { static_assert( MAX_LIGHTMAPS == 4 ); return { diff --git a/tools/quake3/q3map2/convert_bsp.cpp b/tools/quake3/q3map2/convert_bsp.cpp index b97d50ff..f9125cb2 100644 --- a/tools/quake3/q3map2/convert_bsp.cpp +++ b/tools/quake3/q3map2/convert_bsp.cpp @@ -350,7 +350,7 @@ int ScaleBSPMain( Args& args ){ Vector3 scale; Vector3 vec; char str[ 1024 ]; - int uniform, axis; + int axis; bool texscale; std::vector old_xyzst; float spawn_ref = 0; @@ -383,8 +383,6 @@ int ScaleBSPMain( Args& args ){ scale[0] = atof( args.takeBack() ); } - uniform = ( ( scale[0] == scale[1] ) && ( scale[1] == scale[2] ) ); - if ( scale == g_vector3_identity ) { Sys_Printf( "Usage: q3map2 [-v] -scale [-tex] [-spawn_ref ] \n" ); Sys_Printf( "Non-zero scale value required.\n" ); @@ -523,7 +521,7 @@ int ScaleBSPMain( Args& args ){ } /* scale planes */ - if ( uniform ) { + if ( ( scale[0] == scale[1] ) && ( scale[1] == scale[2] ) ) { // uniform scale for ( bspPlane_t& plane : bspPlanes ) { plane.dist() *= scale[0]; diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 2db22c9f..531578b5 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1848,17 +1848,17 @@ inline int numSurfaceModels; inline const Vector3b debugColors[ 12 ] = { - { 255, 0, 0 }, + { 255, 0, 0 }, { 192, 128, 128 }, - { 255, 255, 0 }, + { 255, 255, 0 }, { 192, 192, 128 }, - { 0, 255, 255 }, + { 0, 255, 255 }, { 128, 192, 192 }, - { 0, 0, 255 }, + { 0, 0, 255 }, { 128, 128, 192 }, - { 255, 0, 255 }, + { 255, 0, 255 }, { 192, 128, 192 }, - { 0, 255, 0 }, + { 0, 255, 0 }, { 128, 192, 128 } }; diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index 3256fe67..f0f9149d 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -2574,7 +2574,7 @@ static void EmitTriangleSurface( mapDrawSurface_t *ds ){ out.lightmapStyles[ 0 ] = LS_NORMAL; out.vertexStyles[ 0 ] = LS_NORMAL; - /* lightmap vectors (lod bounds for patches */ + /* lightmap vectors (lod bounds for patches) */ out.lightmapOrigin = ds->lightmapOrigin; out.lightmapVecs[ 0 ] = ds->lightmapVecs[ 0 ]; out.lightmapVecs[ 1 ] = ds->lightmapVecs[ 1 ];