map2png: Fix conversion bug

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8656 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2009-12-11 21:17:12 +00:00 committed by Git SVN Gateway
parent c6e328bbd3
commit 3b425a0653
1 changed files with 3 additions and 6 deletions

View File

@ -39,23 +39,20 @@ int main(int argc, char **argv)
if (map)
{
int x, y;
char *pixels = malloc(4 * map->width * map->height); // RGBA 32 bits
uint8_t *pixels = malloc(map->width * map->height);
for (x = 0; x < map->width; x++)
{
for (y = 0; y < map->height; y++)
{
MAPTILE *psTile = mapTile(map, x, y);
int pixpos = y * map->width * 4 + x * 4;
int pixpos = y * map->width + x;
pixels[pixpos++] = psTile->height;
pixels[pixpos++] = psTile->height;
pixels[pixpos++] = psTile->height;
pixels[pixpos] = 255; // alpha
}
}
strcat(filename, ".png");
savePng(filename, pixels, map->width, map->height);
savePngI8(filename, pixels, map->width, map->height);
free(pixels);
}
mapFree(map);