TileAtlas: Fix broken atlas generation

The stuff committed in 56226c40c6
was actually completely broken.. oops.
This commit is contained in:
Jonas Kulla 2014-07-10 21:48:33 +02:00
parent c0f25548bd
commit 300e61c64b
1 changed files with 6 additions and 6 deletions

View File

@ -37,18 +37,18 @@ struct Column
typedef std::vector<Column> ColumnVec; typedef std::vector<Column> ColumnVec;
/* Buffer between autotile area and tileset */
static const int atBuffer = 32;
/* Autotile area width */ /* Autotile area width */
static const int atAreaW = 96*4; static const int atAreaW = 96*4;
/* Autotile area height */ /* Autotile area height */
static const int atAreaH = 128*7; static const int atAreaH = 128*7 + atBuffer;
/* Autotile area */ /* Autotile area */
static const int atArea = atAreaW * atAreaH; static const int atArea = atAreaW * atAreaH;
static const int tilesetW = 256; static const int tilesetW = 256;
static const int tsLaneW = tilesetW / 2; static const int tsLaneW = tilesetW / 2;
static const int atBuffer = 32;
static int freeArea(int width, int height) static int freeArea(int width, int height)
{ {
return width * height - atArea; return width * height - atArea;
@ -57,7 +57,7 @@ static int freeArea(int width, int height)
Vec2i minSize(int tilesetH, int maxAtlasSize) Vec2i minSize(int tilesetH, int maxAtlasSize)
{ {
int width = atAreaW; int width = atAreaW;
int height = atAreaH + atBuffer; int height = atAreaH;
const int tsArea = tilesetW * tilesetH; const int tsArea = tilesetW * tilesetH;
@ -95,7 +95,7 @@ static ColumnVec calcDstCols(int atlasW, int atlasH)
cols.reserve(3); cols.reserve(3);
/* Columns below the autotile area */ /* Columns below the autotile area */
const int underAt = atlasH - (atAreaH + atBuffer); const int underAt = atlasH - atAreaH;
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
cols.push_back(Column(i*tsLaneW, atAreaH, underAt)); cols.push_back(Column(i*tsLaneW, atAreaH, underAt));
@ -176,7 +176,7 @@ Vec2i tileToAtlasCoor(int tileX, int tileY, int tilesetH, int atlasH)
int laneY = tileY*32; int laneY = tileY*32;
int longlaneH = atlasH; int longlaneH = atlasH;
int shortlaneH = longlaneH - (atAreaH + atBuffer); int shortlaneH = longlaneH - atAreaH;
int longlaneOffset = shortlaneH * 3; int longlaneOffset = shortlaneH * 3;