Skip to content

Commit

Permalink
Fix linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Aug 31, 2013
1 parent 904932c commit f74a26d
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 86 deletions.
3 changes: 1 addition & 2 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# To create a debug build, run `cmake -D CMAKE_BUILD_TYPE=Debug .` instead

cd src
UNAME_SHORT=`uname -s | cut -c1-5`
if [ "$UNAME_SHORT" = "MINGW" ] ; then
cmake -G"MinGW Makefiles" .
Expand All @@ -14,4 +13,4 @@ if [ "$UNAME_SHORT" = "MINGW" ] ; then
else
make
fi
cd ..

2 changes: 1 addition & 1 deletion src/cdogs/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static color_t GetTileLOSMask(Tile *tile)
{
if (gConfig.Game.Fog)
{
color_t mask = { 96, 96, 96 };
color_t mask = { 96, 96, 96, 255 };
return mask;
}
else
Expand Down
108 changes: 54 additions & 54 deletions src/cdogs/mission.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,94 +81,94 @@ struct ColorRange {

static struct ColorRange cColorRanges[] = {
{"Red 1",
{{33, 0, 0}, {29, 0, 0}, {25, 0, 0}, {21, 0, 0}, {17, 0, 0},
{13, 0, 0}, {9, 0, 0}, {5, 0, 0}}},
{{33, 0, 0, 255}, {29, 0, 0, 255}, {25, 0, 0, 255}, {21, 0, 0, 255}, {17, 0, 0, 255},
{13, 0, 0, 255}, {9, 0, 0, 255}, {5, 0, 0, 255}}},
{"Red 2",
{{28, 0, 0}, {23, 0, 0}, {18, 0, 0}, {14, 0, 0}, {12, 0, 0},
{10, 0, 0}, {8, 0, 0}, {5, 0, 0}}},
{{28, 0, 0, 255}, {23, 0, 0, 255}, {18, 0, 0, 255}, {14, 0, 0, 255}, {12, 0, 0, 255},
{10, 0, 0, 255}, {8, 0, 0, 255}, {5, 0, 0, 255}}},
{"Red 3",
{{18, 0, 0}, {15, 0, 0}, {13, 0, 0}, {10, 0, 0}, {8, 0, 0},
{5, 0, 0}, {3, 0, 0}, {0, 0, 0}}},
{{18, 0, 0, 255}, {15, 0, 0, 255}, {13, 0, 0, 255}, {10, 0, 0, 255}, {8, 0, 0, 255},
{5, 0, 0, 255}, {3, 0, 0, 255}, {0, 0, 0, 255}}},

{"Green 1",
{{0, 33, 0}, {0, 29, 0}, {0, 25, 0}, {0, 21, 0}, {0, 17, 0},
{0, 13, 0}, {0, 9, 0}, {0, 5, 0}}},
{{0, 33, 0, 255}, {0, 29, 0, 255}, {0, 25, 0, 255}, {0, 21, 0, 255}, {0, 17, 0, 255},
{0, 13, 0, 255}, {0, 9, 0, 255}, {0, 5, 0, 255}}},
{"Green 2",
{{0, 28, 0}, {0, 23, 0}, {0, 18, 0}, {0, 14, 0}, {0, 12, 0},
{0, 10, 0}, {0, 8, 0}, {0, 5, 0}}},
{{0, 28, 0, 255}, {0, 23, 0, 255}, {0, 18, 0, 255}, {0, 14, 0, 255}, {0, 12, 0, 255},
{0, 10, 0, 255}, {0, 8, 0, 255}, {0, 5, 0, 255}}},
{"Green 3",
{{0, 18, 0}, {0, 15, 0}, {0, 13, 0}, {0, 10, 0}, {0, 8, 0},
{0, 5, 0}, {0, 3, 0}, {0, 0, 0}}},
{{0, 18, 0, 255}, {0, 15, 0, 255}, {0, 13, 0, 255}, {0, 10, 0, 255}, {0, 8, 0, 255},
{0, 5, 0, 255}, {0, 3, 0, 255}, {0, 0, 0, 255}}},

{"Blue 1",
{{0, 0, 33}, {0, 0, 29}, {0, 0, 25}, {0, 0, 21}, {0, 0, 17},
{0, 0, 13}, {0, 0, 9}, {0, 0, 5}}},
{{0, 0, 33, 255}, {0, 0, 29, 255}, {0, 0, 25, 255}, {0, 0, 21, 255}, {0, 0, 17, 255},
{0, 0, 13, 255}, {0, 0, 9, 255}, {0, 0, 5, 255}}},
{"Blue 2",
{{0, 0, 28}, {0, 0, 23}, {0, 0, 18}, {0, 0, 14}, {0, 0, 12},
{0, 0, 10}, {0, 0, 8}, {0, 0, 5}}},
{{0, 0, 28, 255}, {0, 0, 23, 255}, {0, 0, 18, 255}, {0, 0, 14, 255}, {0, 0, 12, 255},
{0, 0, 10, 255}, {0, 0, 8, 255}, {0, 0, 5, 255}}},
{"Blue 3",
{{0, 0, 18}, {0, 0, 15}, {0, 0, 13}, {0, 0, 10}, {0, 0, 8},
{0, 0, 5}, {0, 0, 3}, {0, 0, 0}}},
{{0, 0, 18, 255}, {0, 0, 15, 255}, {0, 0, 13, 255}, {0, 0, 10, 255}, {0, 0, 8, 255},
{0, 0, 5, 255}, {0, 0, 3, 255}, {0, 0, 0, 255}}},

{"Purple 1",
{{33, 0, 33}, {29, 0, 29}, {25, 0, 25}, {21, 0, 21}, {17, 0, 17},
{13, 0, 13}, {9, 0, 9}, {5, 0, 5}}},
{{33, 0, 33, 255}, {29, 0, 29, 255}, {25, 0, 25, 255}, {21, 0, 21, 255}, {17, 0, 17, 255},
{13, 0, 13, 255}, {9, 0, 9, 255}, {5, 0, 5, 255}}},
{"Purple 2",
{{28, 0, 28}, {23, 0, 23}, {18, 0, 18}, {14, 0, 14}, {12, 0, 12},
{10, 0, 10}, {8, 0, 8}, {5, 0, 5}}},
{{28, 0, 28, 255}, {23, 0, 23, 255}, {18, 0, 18, 255}, {14, 0, 14, 255}, {12, 0, 12, 255},
{10, 0, 10, 255}, {8, 0, 8, 255}, {5, 0, 5, 255}}},
{"Purple 3",
{{18, 0, 18}, {15, 0, 15}, {13, 0, 13}, {10, 0, 10}, {8, 0, 8},
{5, 0, 5}, {3, 0, 3}, {0, 0, 0}}},
{{18, 0, 18, 255}, {15, 0, 15, 255}, {13, 0, 13, 255}, {10, 0, 10, 255}, {8, 0, 8, 255},
{5, 0, 5, 255}, {3, 0, 3, 255}, {0, 0, 0, 255}}},

{"Gray 1",
{{33, 33, 33}, {28, 28, 28}, {23, 23, 23}, {18, 18, 18},
{15, 15, 15}, {12, 12, 12}, {10, 10, 10}, {8, 8, 8}}},
{{33, 33, 33, 255}, {28, 28, 28, 255}, {23, 23, 23, 255}, {18, 18, 18, 255},
{15, 15, 15, 255}, {12, 12, 12, 255}, {10, 10, 10, 255}, {8, 8, 8, 255}}},
{"Gray 2",
{{28, 28, 28}, {23, 23, 23}, {18, 18, 18}, {14, 14, 14},
{12, 12, 12}, {10, 10, 10}, {8, 8, 8}, {5, 5, 5}}},
{{28, 28, 28, 255}, {23, 23, 23, 255}, {18, 18, 18, 255}, {14, 14, 14, 255},
{12, 12, 12, 255}, {10, 10, 10, 255}, {8, 8, 8, 255}, {5, 5, 5, 255}}},
{"Gray 3",
{{18, 18, 18}, {15, 15, 15}, {13, 13, 13}, {10, 10, 10},
{8, 8, 8}, {5, 5, 5}, {3, 3, 3}, {0, 0, 0}}},
{{18, 18, 18, 255}, {15, 15, 15, 255}, {13, 13, 13, 255}, {10, 10, 10, 255},
{8, 8, 8, 255}, {5, 5, 5, 255}, {3, 3, 3, 255}, {0, 0, 0, 255}}},

{"Gray/blue 1",
{{23, 23, 33}, {20, 20, 29}, {18, 18, 26}, {15, 15, 23},
{12, 12, 20}, {10, 10, 17}, {8, 8, 14}, {5, 5, 10}}},
{{23, 23, 33, 255}, {20, 20, 29, 255}, {18, 18, 26, 255}, {15, 15, 23, 255},
{12, 12, 20, 255}, {10, 10, 17, 255}, {8, 8, 14, 255}, {5, 5, 10, 255}}},
{"Gray/blue 2",
{{18, 18, 28}, {16, 16, 25}, {14, 14, 23}, {12, 12, 20},
{10, 10, 17}, {8, 8, 15}, {6, 6, 12}, {4, 4, 9}}},
{{18, 18, 28, 255}, {16, 16, 25, 255}, {14, 14, 23, 255}, {12, 12, 20, 255},
{10, 10, 17, 255}, {8, 8, 15, 255}, {6, 6, 12, 255}, {4, 4, 9, 255}}},
{"Gray/blue 3",
{{13, 13, 23}, {12, 12, 21}, {10, 10, 19}, {9, 9, 17}, {7, 7, 14},
{6, 6, 12}, {4, 4, 10}, {3, 3, 8}}},
{{13, 13, 23, 255}, {12, 12, 21, 255}, {10, 10, 19, 255}, {9, 9, 17, 255}, {7, 7, 14, 255},
{6, 6, 12, 255}, {4, 4, 10, 255}, {3, 3, 8, 255}}},

{"Yellowish 1",
{{37, 32, 11}, {33, 28, 10}, {29, 24, 9}, {25, 21, 8},
{21, 17, 7}, {17, 13, 6}, {14, 9, 4}, {11, 6, 2}}},
{{37, 32, 11, 255}, {33, 28, 10, 255}, {29, 24, 9, 255}, {25, 21, 8, 255},
{21, 17, 7, 255}, {17, 13, 6, 255}, {14, 9, 4, 255}, {11, 6, 2, 255}}},
{"Yellowish 2",
{{33, 28, 9}, {29, 24, 8}, {25, 21, 7}, {21, 17, 6}, {17, 13, 5},
{14, 9, 4}, {11, 6, 2}, {11, 4, 1}}},
{{33, 28, 9, 255}, {29, 24, 8, 255}, {25, 21, 7, 255}, {21, 17, 6, 255}, {17, 13, 5, 255},
{14, 9, 4, 255}, {11, 6, 2, 255}, {11, 4, 1, 255}}},
{"Yellowish 3",
{{29, 24, 7}, {25, 21, 6}, {21, 17, 5}, {17, 13, 4}, {14, 9, 3},
{11, 6, 2}, {9, 4, 1}, {11, 2, 0}}},
{{29, 24, 7, 255}, {25, 21, 6, 255}, {21, 17, 5, 255}, {17, 13, 4, 255}, {14, 9, 3, 255},
{11, 6, 2, 255}, {9, 4, 1, 255}, {11, 2, 0, 255}}},

{"Brown 1",
{{33, 17, 0}, {29, 15, 0}, {25, 13, 0}, {21, 11, 0}, {17, 9, 0},
{13, 7, 0}, {9, 5, 0}, {5, 3, 0}}},
{{33, 17, 0, 255}, {29, 15, 0, 255}, {25, 13, 0, 255}, {21, 11, 0, 255}, {17, 9, 0, 255},
{13, 7, 0, 255}, {9, 5, 0, 255}, {5, 3, 0, 255}}},
{"Brown 2",
{{28, 14, 0}, {23, 12, 0}, {18, 9, 0}, {14, 7, 0}, {12, 6, 0},
{10, 5, 0}, {8, 4, 0}, {5, 3, 0}}},
{{28, 14, 0, 255}, {23, 12, 0, 255}, {18, 9, 0, 255}, {14, 7, 0, 255}, {12, 6, 0, 255},
{10, 5, 0, 255}, {8, 4, 0, 255}, {5, 3, 0, 255}}},
{"Brown 3",
{{18, 9, 0}, {15, 8, 0}, {13, 7, 0}, {10, 5, 0}, {8, 4, 0},
{5, 3, 0}, {3, 2, 0}, {0, 0, 0}}},
{{18, 9, 0, 255}, {15, 8, 0, 255}, {13, 7, 0, 255}, {10, 5, 0, 255}, {8, 4, 0, 255},
{5, 3, 0, 255}, {3, 2, 0, 255}, {0, 0, 0, 255}}},

{"Cyan 1",
{{0, 33, 33}, {0, 29, 29}, {0, 25, 25}, {0, 21, 21}, {0, 17, 17},
{0, 13, 13}, {0, 9, 9}, {0, 5, 5}}},
{{0, 33, 33, 255}, {0, 29, 29, 255}, {0, 25, 25, 255}, {0, 21, 21, 255}, {0, 17, 17, 255},
{0, 13, 13, 255}, {0, 9, 9, 255}, {0, 5, 5, 255}}},
{"Cyan 2",
{{0, 28, 28}, {0, 23, 23}, {0, 18, 18}, {0, 14, 14}, {0, 12, 12},
{0, 10, 10}, {0, 8, 8}, {0, 5, 5}}},
{{0, 28, 28, 255}, {0, 23, 23, 255}, {0, 18, 18, 255}, {0, 14, 14, 255}, {0, 12, 12, 255},
{0, 10, 10, 255}, {0, 8, 8, 255}, {0, 5, 5, 255}}},
{"Cyan 3",
{{0, 18, 18}, {0, 15, 15}, {0, 13, 13}, {0, 10, 10}, {0, 8, 8},
{0, 5, 5}, {0, 3, 3}, {0, 0, 0}}},
{{0, 18, 18, 255}, {0, 15, 15, 255}, {0, 13, 13, 255}, {0, 10, 10, 255}, {0, 8, 8, 255},
{0, 5, 5, 255}, {0, 3, 3, 255}, {0, 0, 0, 255}}},
};
#define COLORRANGE_COUNT (sizeof( cColorRanges)/sizeof( struct ColorRange))

Expand Down
50 changes: 25 additions & 25 deletions src/cdogs/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

#define FIRST_CHAR 0
#define LAST_CHAR 153
#define CHARS_IN_FONT (LAST_CHAR - FIRST_CHAR + 1)
#define CHARS_IN_gFont (LAST_CHAR - FIRST_CHAR + 1)

#define CHAR_INDEX(c) ((int)c - FIRST_CHAR)

Expand All @@ -70,55 +70,55 @@ static int dxCDogsText = 0;
static int xCDogsText = 0;
static int yCDogsText = 0;
static int hCDogsText = 0;
static PicPaletted *font[CHARS_IN_FONT];
static PicPaletted *gFont[CHARS_IN_gFont];


void CDogsTextInit(const char *filename, int offset)
{
int i;

dxCDogsText = offset;
memset(font, 0, sizeof(font));
ReadPics(filename, font, CHARS_IN_FONT, NULL);
memset(gFont, 0, sizeof(gFont));
ReadPics(filename, gFont, CHARS_IN_gFont, NULL);

for (i = 0; i < CHARS_IN_FONT; i++)
for (i = 0; i < CHARS_IN_gFont; i++)
{
if (font[i] != NULL)
if (gFont[i] != NULL)
{
hCDogsText = MAX(hCDogsText, font[i]->h);
hCDogsText = MAX(hCDogsText, gFont[i]->h);
}
}
}

void CDogsTextChar(char c)
{
int i = CHAR_INDEX(c);
if (i >= 0 && i <= CHARS_IN_FONT && font[i])
if (i >= 0 && i <= CHARS_IN_gFont && gFont[i])
{
DrawTPic(xCDogsText, yCDogsText, font[i]);
xCDogsText += 1 + font[i]->w + dxCDogsText;
DrawTPic(xCDogsText, yCDogsText, gFont[i]);
xCDogsText += 1 + gFont[i]->w + dxCDogsText;
}
else
{
i = CHAR_INDEX('.');
DrawTPic(xCDogsText, yCDogsText, font[i]);
xCDogsText += 1 + font[i]->w + dxCDogsText;
DrawTPic(xCDogsText, yCDogsText, gFont[i]);
xCDogsText += 1 + gFont[i]->w + dxCDogsText;
}
}

void CDogsTextCharWithTable(char c, TranslationTable * table)
{
int i = CHAR_INDEX(c);
if (i >= 0 && i <= CHARS_IN_FONT && font[i])
if (i >= 0 && i <= CHARS_IN_gFont && gFont[i])
{
DrawTTPic(xCDogsText, yCDogsText, font[i], table);
xCDogsText += 1 + font[i]->w + dxCDogsText;
DrawTTPic(xCDogsText, yCDogsText, gFont[i], table);
xCDogsText += 1 + gFont[i]->w + dxCDogsText;
}
else
{
i = CHAR_INDEX('.');
DrawTTPic(xCDogsText, yCDogsText, font[i], table);
xCDogsText += 1 + font[i]->w + dxCDogsText;
DrawTTPic(xCDogsText, yCDogsText, gFont[i], table);
xCDogsText += 1 + gFont[i]->w + dxCDogsText;
}
}

Expand All @@ -134,21 +134,21 @@ void CDogsTextStringWithTable(const char *s, TranslationTable * table)
CDogsTextCharWithTable(*s++, table);
}

static PicPaletted *GetFontPic(char c)
static PicPaletted *GetgFontPic(char c)
{
int i = CHAR_INDEX(c);
if (i < 0 || i > CHARS_IN_FONT || !font[i])
if (i < 0 || i > CHARS_IN_gFont || !gFont[i])
{
i = CHAR_INDEX('.');
}
assert(font[i]);
return font[i];
assert(gFont[i]);
return gFont[i];
}

Vec2i DrawTextCharMasked(
char c, GraphicsDevice *device, Vec2i pos, color_t mask)
{
PicPaletted *font = GetFontPic(c);
PicPaletted *font = GetgFontPic(c);
Pic pic;
PicFromPicPaletted(&pic, font);
BlitMasked(device, &pic, pos, mask, 1);
Expand Down Expand Up @@ -214,13 +214,13 @@ void CDogsTextStringWithTableAt(int x, int y, const char *s,

int CDogsTextCharWidth(int c)
{
if (c >= FIRST_CHAR && c <= LAST_CHAR && font[CHAR_INDEX(c)])
if (c >= FIRST_CHAR && c <= LAST_CHAR && gFont[CHAR_INDEX(c)])
{
return 1 + font[CHAR_INDEX(c)]->w + dxCDogsText;
return 1 + gFont[CHAR_INDEX(c)]->w + dxCDogsText;
}
else
{
return 1 + font[CHAR_INDEX('.')]->w + dxCDogsText;
return 1 + gFont[CHAR_INDEX('.')]->w + dxCDogsText;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/cdogs/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int debug_level = D_NORMAL;

int MemIsZero(const void *buf, size_t len)
{
char *bytes = (char *)buf;
const char *bytes = (const char *)buf;
size_t i;
for (i = 0; i < len; i++)
{
Expand Down
6 changes: 3 additions & 3 deletions src/cdogsed.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,9 +1407,9 @@ static void Save(int asCode)
c != ':' && c != '<' && c != '>' && c != '?' &&
c != '\\' && c != '|')
{
size_t i = strlen(filename);
filename[i + 1] = 0;
filename[i] = (char)c;
size_t si = strlen(filename);
filename[si + 1] = 0;
filename[si] = (char)c;
}
}
SDL_Delay(10);
Expand Down

0 comments on commit f74a26d

Please sign in to comment.