@@ -2444,9 +2444,9 @@ static void R_CreateFogImage()
24442444R_CreateDefaultImage
24452445==================
24462446*/
2447- static const int DEFAULT_SIZE = 128 ;
24482447static void R_CreateDefaultImage ()
24492448{
2449+ constexpr int DEFAULT_SIZE = 128 ;
24502450 int x;
24512451 byte data[ DEFAULT_SIZE ][ DEFAULT_SIZE ][ 4 ];
24522452 byte *dataPtr = &data[0 ][0 ][0 ];
@@ -2710,9 +2710,10 @@ R_CreateBuiltinImages
27102710*/
27112711void R_CreateBuiltinImages ()
27122712{
2713+ constexpr int DIMENSION = 8 ;
27132714 int x;
2714- byte data[ DEFAULT_SIZE ][ DEFAULT_SIZE ][ 4 ];
2715- byte *dataPtr = & data[ 0 ][ 0 ][ 0 ] ;
2715+ byte data[ DIMENSION * DIMENSION * 4 ];
2716+ byte *dataPtr = data;
27162717 byte *out;
27172718
27182719 R_CreateDefaultImage ();
@@ -2725,41 +2726,41 @@ void R_CreateBuiltinImages()
27252726 imageParams.filterType = filterType_t::FT_LINEAR;
27262727 imageParams.wrapType = wrapTypeEnum_t::WT_REPEAT;
27272728
2728- tr.whiteImage = R_CreateImage ( " _white" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2729+ tr.whiteImage = R_CreateImage ( " _white" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
27292730
27302731 // we use a solid black image instead of disabling texturing
27312732 memset ( data, 0 , sizeof ( data ) );
2732- tr.blackImage = R_CreateImage ( " _black" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2733+ tr.blackImage = R_CreateImage ( " _black" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
27332734
27342735 // red
2735- for ( x = DEFAULT_SIZE * DEFAULT_SIZE , out = & data[ 0 ][ 0 ][ 0 ] ; x; --x, out += 4 )
2736+ for ( x = DIMENSION * DIMENSION , out = data; x; --x, out += 4 )
27362737 {
27372738 out[ 1 ] = out[ 2 ] = 0 ;
27382739 out[ 0 ] = out[ 3 ] = 255 ;
27392740 }
27402741
2741- tr.redImage = R_CreateImage ( " _red" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2742+ tr.redImage = R_CreateImage ( " _red" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
27422743
27432744 // green
2744- for ( x = DEFAULT_SIZE * DEFAULT_SIZE , out = & data[ 0 ][ 0 ][ 0 ] ; x; --x, out += 4 )
2745+ for ( x = DIMENSION * DIMENSION , out = data; x; --x, out += 4 )
27452746 {
27462747 out[ 0 ] = out[ 2 ] = 0 ;
27472748 out[ 1 ] = out[ 3 ] = 255 ;
27482749 }
27492750
2750- tr.greenImage = R_CreateImage ( " _green" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2751+ tr.greenImage = R_CreateImage ( " _green" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
27512752
27522753 // blue
2753- for ( x = DEFAULT_SIZE * DEFAULT_SIZE , out = & data[ 0 ][ 0 ][ 0 ] ; x; --x, out += 4 )
2754+ for ( x = DIMENSION * DIMENSION , out = data; x; --x, out += 4 )
27542755 {
27552756 out[ 0 ] = out[ 1 ] = 0 ;
27562757 out[ 2 ] = out[ 3 ] = 255 ;
27572758 }
27582759
2759- tr.blueImage = R_CreateImage ( " _blue" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2760+ tr.blueImage = R_CreateImage ( " _blue" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
27602761
27612762 // generate a default normalmap with a fully opaque heightmap (no displacement)
2762- for ( x = DEFAULT_SIZE * DEFAULT_SIZE , out = & data[ 0 ][ 0 ][ 0 ] ; x; --x, out += 4 )
2763+ for ( x = DIMENSION * DIMENSION , out = data; x; --x, out += 4 )
27632764 {
27642765 out[ 0 ] = out[ 1 ] = 128 ;
27652766 out[ 2 ] = 255 ;
@@ -2768,7 +2769,7 @@ void R_CreateBuiltinImages()
27682769
27692770 imageParams.bits = IF_NOPICMIP | IF_NORMALMAP;
27702771
2771- tr.flatImage = R_CreateImage ( " _flat" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2772+ tr.flatImage = R_CreateImage ( " _flat" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
27722773
27732774 imageParams.bits = IF_NOPICMIP;
27742775 imageParams.wrapType = wrapTypeEnum_t::WT_CLAMP;
0 commit comments