Skip to content

Commit

Permalink
speed up linux compile
Browse files Browse the repository at this point in the history
gcc really does not like the color array. It was taking about a minute to compile.
  • Loading branch information
wootguy committed Dec 9, 2024
1 parent 16fd371 commit d15a8fa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dlls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ set(ALL_SRC
${PLAYER_SRC} ${PLAYER_HDR}
${HOOKS_SRC} ${HOOKS_HDR}
${MISC_HDR}
env/fog_colors.cpp
env/fog_colors.c
)

# don't compile individual entity files
Expand Down
6 changes: 3 additions & 3 deletions dlls/env/CEnvWeather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

#define SF_WEATHER_START_OFF 1

extern RGB g_fog_palette[61][256];
extern int g_fog_skins;
extern "C" uint32_t g_fog_palette[61][256];
extern "C" int g_fog_skins;

bool g_fog_enabled;
int g_fog_start_dist;
Expand Down Expand Up @@ -821,7 +821,7 @@ void CEnvWeather::SetFogColor(RGB color) {

for (int i = 0; i < g_fog_skins && bestDist; i++) {
for (int k = 0; k < 256; k++) {
RGB& p = g_fog_palette[i][k];
RGB p = RGB(g_fog_palette[i][k]);
int dist = abs(p.r - color.r) + abs(p.g - color.g) + abs(p.b - color.b);

if (dist < bestDist) {
Expand Down
5 changes: 1 addition & 4 deletions dlls/env/fog_colors.cpp → dlls/env/fog_colors.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include "extdll.h"
#include "util.h"

int g_fog_skins = 61;

RGB g_fog_palette[61][256] = {
unsigned int g_fog_palette[61][256] = {
{0x000000,0x010101,0x020202,0x030303,0x040404,0x050505,0x060606,0x070707,0x080808,0x090909,0x0A0A0A,0x0B0B0B,0x0C0C0C,0x0D0D0D,0x0E0E0E,0x0F0F0F,0x101010,0x111111,0x121212,0x131313,0x141414,0x151515,0x161616,0x171717,0x181818,0x191919,0x1A1A1A,0x1B1B1B,0x1C1C1C,0x1D1D1D,0x1E1E1E,0x1F1F1F,0x202020,0x212121,0x222222,0x232323,0x242424,0x252525,0x262626,0x272727,0x282828,0x292929,0x2A2A2A,0x2B2B2B,0x2C2C2C,0x2D2D2D,0x2E2E2E,0x2F2F2F,0x303030,0x313131,0x323232,0x333333,0x343434,0x353535,0x363636,0x373737,0x383838,0x393939,0x3A3A3A,0x3B3B3B,0x3C3C3C,0x3D3D3D,0x3E3E3E,0x3F3F3F,0x404040,0x414141,0x424242,0x434343,0x444444,0x454545,0x464646,0x474747,0x484848,0x494949,0x4A4A4A,0x4B4B4B,0x4C4C4C,0x4D4D4D,0x4E4E4E,0x4F4F4F,0x505050,0x515151,0x525252,0x535353,0x545454,0x555555,0x565656,0x575757,0x585858,0x595959,0x5A5A5A,0x5B5B5B,0x5C5C5C,0x5D5D5D,0x5E5E5E,0x5F5F5F,0x606060,0x616161,0x626262,0x636363,0x646464,0x656565,0x666666,0x676767,0x686868,0x696969,0x6A6A6A,0x6B6B6B,0x6C6C6C,0x6D6D6D,0x6E6E6E,0x6F6F6F,0x707070,0x717171,0x727272,0x737373,0x747474,0x757575,0x767676,0x777777,0x787878,0x797979,0x7A7A7A,0x7B7B7B,0x7C7C7C,0x7D7D7D,0x7E7E7E,0x7F7F7F,0x808080,0x818181,0x828282,0x838383,0x848484,0x858585,0x868686,0x878787,0x888888,0x898989,0x8A8A8A,0x8B8B8B,0x8C8C8C,0x8D8D8D,0x8E8E8E,0x8F8F8F,0x909090,0x919191,0x929292,0x939393,0x949494,0x959595,0x969696,0x979797,0x989898,0x999999,0x9A9A9A,0x9B9B9B,0x9C9C9C,0x9D9D9D,0x9E9E9E,0x9F9F9F,0xA0A0A0,0xA1A1A1,0xA2A2A2,0xA3A3A3,0xA4A4A4,0xA5A5A5,0xA6A6A6,0xA7A7A7,0xA8A8A8,0xA9A9A9,0xAAAAAA,0xABABAB,0xACACAC,0xADADAD,0xAEAEAE,0xAFAFAF,0xB0B0B0,0xB1B1B1,0xB2B2B2,0xB3B3B3,0xB4B4B4,0xB5B5B5,0xB6B6B6,0xB7B7B7,0xB8B8B8,0xB9B9B9,0xBABABA,0xBBBBBB,0xBCBCBC,0xBDBDBD,0xBEBEBE,0xBFBFBF,0xC0C0C0,0xC1C1C1,0xC2C2C2,0xC3C3C3,0xC4C4C4,0xC5C5C5,0xC6C6C6,0xC7C7C7,0xC8C8C8,0xC9C9C9,0xCACACA,0xCBCBCB,0xCCCCCC,0xCDCDCD,0xCECECE,0xCFCFCF,0xD0D0D0,0xD1D1D1,0xD2D2D2,0xD3D3D3,0xD4D4D4,0xD5D5D5,0xD6D6D6,0xD7D7D7,0xD8D8D8,0xD9D9D9,0xDADADA,0xDBDBDB,0xDCDCDC,0xDDDDDD,0xDEDEDE,0xDFDFDF,0xE0E0E0,0xE1E1E1,0xE2E2E2,0xE3E3E3,0xE4E4E4,0xE5E5E5,0xE6E6E6,0xE7E7E7,0xE8E8E8,0xE9E9E9,0xEAEAEA,0xEBEBEB,0xECECEC,0xEDEDED,0xEEEEEE,0xEFEFEF,0xF0F0F0,0xF1F1F1,0xF2F2F2,0xF3F3F3,0xF4F4F4,0xF5F5F5,0xF6F6F6,0xF7F7F7,0xF8F8F8,0xF9F9F9,0xFAFAFA,0xFBFBFB,0xFCFCFC,0xFDFDFD,0xFEFEFE,0xFFFFFF},
{0x191616,0x282424,0x383232,0x474040,0x564E4E,0x665B5B,0x756969,0x847777,0x938585,0xA39292,0xB2A0A0,0xC1AEAE,0xD1BCBC,0xE0C9C9,0xEFD7D7,0xFFE5E5,0x191515,0x282222,0x382F2F,0x473B3B,0x564848,0x665555,0x756262,0x846F6F,0x937C7C,0xA38989,0xB29595,0xC1A2A2,0xD1AFAF,0xE0BCBC,0xEFC9C9,0xFFD6D6,0x191313,0x281F1F,0x382B2B,0x473737,0x564343,0x664F4F,0x755B5B,0x846767,0x937373,0xA37F7F,0xB28B8B,0xC19797,0xD1A3A3,0xE0AFAF,0xEFBABA,0xFFC6C6,0x191212,0x281D1D,0x382828,0x473333,0x563E3E,0x664949,0x755454,0x845F5F,0x936A6A,0xA37575,0xB28080,0xC18B8B,0xD19696,0xE0A1A1,0xEFACAC,0xFFB7B7,0x191010,0x281A1A,0x382525,0x472F2F,0x563939,0x664343,0x754D4D,0x845757,0x936161,0xA36B6B,0xB27575,0xC17F7F,0xD18A8A,0xE09494,0xEF9E9E,0xFFA8A8,0x190F0F,0x281818,0x382121,0x472A2A,0x563434,0x663D3D,0x754646,0x844F4F,0x935858,0xA36161,0xB26B6B,0xC17474,0xD17D7D,0xE08686,0xEF8F8F,0xFF9999,0x190D0D,0x281616,0x381E1E,0x472626,0x562E2E,0x663737,0x753F3F,0x844747,0x934F4F,0xA35858,0xB26060,0xC16868,0xD17070,0xE07979,0xEF8181,0xFF8989,0x190C0C,0x281313,0x381A1A,0x472222,0x562929,0x663030,0x753838,0x843F3F,0x934646,0xA34E4E,0xB25555,0xC15D5D,0xD16464,0xE06B6B,0xEF7373,0xFF7A7A,0x190A0A,0x281111,0x381717,0x471D1D,0x562424,0x662A2A,0x753131,0x843737,0x933E3E,0xA34444,0xB24A4A,0xC15151,0xD15757,0xE05E5E,0xEF6464,0xFF6B6B,0x190909,0x280E0E,0x381414,0x471919,0x561F1F,0x662424,0x752A2A,0x842F2F,0x933535,0xA33A3A,0xB24040,0xC14545,0xD14B4B,0xE05050,0xEF5656,0xFF5B5B,0x190707,0x280C0C,0x381010,0x471515,0x561A1A,0x661E1E,0x752323,0x842727,0x932C2C,0xA33030,0xB23535,0xC13A3A,0xD13E3E,0xE04343,0xEF4747,0xFF4C4C,0x190606,0x280909,0x380D0D,0x471111,0x561414,0x661818,0x751C1C,0x841F1F,0x932323,0xA32727,0xB22A2A,0xC12E2E,0xD13232,0xE03535,0xEF3939,0xFF3D3D,0x190404,0x280707,0x380A0A,0x470C0C,0x560F0F,0x661212,0x751515,0x841717,0x931A1A,0xA31D1D,0xB22020,0xC12222,0xD12525,0xE02828,0xEF2B2B,0xFF2D2D,0x190303,0x280404,0x380606,0x470808,0x560A0A,0x660C0C,0x750E0E,0x840F0F,0x931111,0xA31313,0xB21515,0xC11717,0xD11919,0xE01A1A,0xEF1C1C,0xFF1E1E,0x190101,0x280202,0x380303,0x470404,0x560505,0x660606,0x750707,0x840707,0x930808,0xA30909,0xB20A0A,0xC10B0B,0xD10C0C,0xE00D0D,0xEF0E0E,0xFF0F0F,0x190000,0x280000,0x380000,0x470000,0x560000,0x660000,0x750000,0x840000,0x930000,0xA30000,0xB20000,0xC10000,0xD10000,0xE00000,0xEF0000,0xFF0000},
{0x191716,0x282524,0x383332,0x474040,0x564E4E,0x665C5B,0x756A69,0x847877,0x938685,0xA39492,0xB2A2A0,0xC1B0AE,0xD1BEBC,0xE0CCC9,0xEFDAD7,0xFFE8E5,0x191515,0x282222,0x38302F,0x473D3B,0x564A48,0x665755,0x756462,0x84716F,0x937E7C,0xA38B89,0xB29895,0xC1A5A2,0xD1B2AF,0xE0C0BC,0xEFCDC9,0xFFDAD6,0x191413,0x28201F,0x382C2B,0x473937,0x564543,0x66514F,0x755E5B,0x846A67,0x937673,0xA3827F,0xB28F8B,0xC19B97,0xD1A7A3,0xE0B3AF,0xEFC0BA,0xFFCCC6,0x191312,0x281E1D,0x382928,0x473533,0x56403E,0x664C49,0x755754,0x84635F,0x936E6A,0xA37A75,0xB28580,0xC1908B,0xD19C96,0xE0A7A1,0xEFB3AC,0xFFBEB7,0x191110,0x281C1A,0x382625,0x47312F,0x563C39,0x664643,0x75514D,0x845C57,0x936661,0xA3716B,0xB27B75,0xC1867F,0xD1918A,0xE09B94,0xEFA69E,0xFFB0A8,0x19100F,0x281A18,0x382321,0x472D2A,0x563734,0x66413D,0x754B46,0x84544F,0x935E58,0xA36861,0xB2726B,0xC17C74,0xD1857D,0xE08F86,0xEF998F,0xFFA399,0x190E0D,0x281716,0x38201E,0x472926,0x56322E,0x663B37,0x75443F,0x844D47,0x93564F,0xA35F58,0xB26860,0xC17168,0xD17A70,0xE08379,0xEF8C81,0xFF9589,0x190D0C,0x281513,0x381D1A,0x472522,0x562E29,0x663630,0x753E38,0x84463F,0x934E46,0xA3564E,0xB25E55,0xC1675D,0xD16F64,0xE0776B,0xEF7F73,0xFF877A,0x190C0A,0x281311,0x381A17,0x47221D,0x562924,0x66302A,0x753831,0x843F37,0x93463E,0xA34E44,0xB2554A,0xC15C51,0xD16357,0xE06B5E,0xEF7264,0xFF796B,0x190A09,0x28110E,0x381714,0x471E19,0x56241F,0x662B24,0x75312A,0x84382F,0x933E35,0xA3453A,0xB24B40,0xC15245,0xD1584B,0xE05F50,0xEF6556,0xFF6C5B,0x190907,0x280F0C,0x381410,0x471A15,0x56201A,0x66251E,0x752B23,0x843127,0x93362C,0xA33C30,0xB24235,0xC1473A,0xD14D3E,0xE05343,0xEF5847,0xFF5E4C,0x190806,0x280C09,0x38110D,0x471611,0x561B14,0x662018,0x75251C,0x84291F,0x932E23,0xA33327,0xB2382A,0xC13D2E,0xD14232,0xE04635,0xEF4B39,0xFF503D,0x190604,0x280A07,0x380E0A,0x47120C,0x56160F,0x661A12,0x751E15,0x842217,0x93261A,0xA32A1D,0xB22E20,0xC13222,0xD13625,0xE03A28,0xEF3E2B,0xFF422D,0x190503,0x280804,0x380B06,0x470E08,0x56120A,0x66150C,0x75180E,0x841B0F,0x931E11,0xA32113,0xB22515,0xC12817,0xD12B19,0xE02E1A,0xEF311C,0xFF351E,0x190301,0x280602,0x380803,0x470A04,0x560D05,0x660F06,0x751207,0x841407,0x931608,0xA31909,0xB21B0A,0xC11D0B,0xD1200C,0xE0220D,0xEF240E,0xFF270F,0x190200,0x280400,0x380500,0x470700,0x560800,0x660A00,0x750B00,0x840D00,0x930E00,0xA31000,0xB21100,0xC11300,0xD11400,0xE01600,0xEF1700,0xFF1900},
Expand Down
2 changes: 1 addition & 1 deletion sevenkewp

0 comments on commit d15a8fa

Please sign in to comment.