TileAtlasVX: Handle table autotiles properly

This commit is contained in:
Jonas Kulla 2014-08-19 06:08:37 +02:00
parent fb2b2b7260
commit 622845a404
4 changed files with 588 additions and 214 deletions

View File

@ -3,266 +3,612 @@ struct StaticRect { float x, y, w, h; };
extern const StaticRect autotileVXRectsA[] = extern const StaticRect autotileVXRectsA[] =
{ {
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 0, 64.5, 15, 15 }, { 0.5, 64.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 0, 64.5, 15, 15 }, { 0.5, 64.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 0, 64.5, 15, 15 }, { 0.5, 64.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 0, 64.5, 15, 15 }, { 0.5, 64.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 }, { 48.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 }, { 48.5, 64.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 64.5, 15, 15 }, { 48.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 64.5, 15, 15 }, { 48.5, 64.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 80.5, 15, 15 }, { 32.5, 80.5, 15, 15 },
{ 16, 80.5, 15, 15 }, { 16.5, 80.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 32.5, 80.5, 15, 15 }, { 32.5, 80.5, 15, 15 },
{ 16, 80.5, 15, 15 }, { 16.5, 80.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 80.5, 15, 15 }, { 32.5, 80.5, 15, 15 },
{ 16, 80.5, 15, 15 }, { 16.5, 80.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 80.5, 15, 15 }, { 32.5, 80.5, 15, 15 },
{ 16, 80.5, 15, 15 }, { 16.5, 80.5, 15, 15 },
{ 0, 64.5, 15, 15 }, { 0.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 }, { 48.5, 64.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 32.5, 80.5, 15, 15 }, { 32.5, 80.5, 15, 15 },
{ 16, 80.5, 15, 15 }, { 16.5, 80.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 32.5, 64.5, 15, 15 }, { 32.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 }, { 48.5, 64.5, 15, 15 },
{ 32.5, 80.5, 15, 15 }, { 32.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 }, { 48.5, 80.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 64.5, 15, 15 }, { 48.5, 64.5, 15, 15 },
{ 32.5, 80.5, 15, 15 }, { 32.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 }, { 48.5, 80.5, 15, 15 },
{ 0, 64.5, 15, 15 }, { 0.5, 64.5, 15, 15 },
{ 16, 64.5, 15, 15 }, { 16.5, 64.5, 15, 15 },
{ 0, 80.5, 15, 15 }, { 0.5, 80.5, 15, 15 },
{ 16, 80.5, 15, 15 }, { 16.5, 80.5, 15, 15 },
{ 0, 64.5, 15, 15 }, { 0.5, 64.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 0, 80.5, 15, 15 }, { 0.5, 80.5, 15, 15 },
{ 16, 80.5, 15, 15 }, { 16.5, 80.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 0, 80.5, 15, 15 }, { 0.5, 80.5, 15, 15 },
{ 16, 80.5, 15, 15 }, { 16.5, 80.5, 15, 15 },
{ 0, 64.5, 15, 15 }, { 0.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 }, { 48.5, 64.5, 15, 15 },
{ 0, 80.5, 15, 15 }, { 0.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 }, { 48.5, 80.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 32.5, 80.5, 15, 15 }, { 32.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 }, { 48.5, 80.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 0, 80.5, 15, 15 }, { 0.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 }, { 48.5, 80.5, 15, 15 },
{ 0, 0, 15, 15 }, { 0.5, 0.5, 15, 15 },
{ 16, 0, 15, 15 }, { 16.5, 0.5, 15, 15 },
{ 0, 16, 15, 15 }, { 0.5, 16.5, 15, 15 },
{ 16, 16, 15, 15 } { 16.5, 16.5, 15, 15 }
}; };
extern const int autotileVXRectsAN = sizeof(autotileVXRectsA) / sizeof(autotileVXRectsA[0]); extern const int autotileVXRectsAN = sizeof(autotileVXRectsA) / sizeof(autotileVXRectsA[0]);
extern const StaticRect autotileVXRectsA2[] =
{
{ 32.5, 64.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 0.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 64.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 0.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 64.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 0.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 64.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 0.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 64.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 0.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 64.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 0.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 64.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 0.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 64.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 0.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 48.5, 16.5, 15, 15 },
{ 0.5, 64.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 0.5, 64.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 0.5, 64.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 48.5, 16.5, 15, 15 },
{ 0.5, 64.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 32.5, 15, 15 },
{ 16.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 32.5, 15, 15 },
{ 16.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 32.5, 15, 15 },
{ 16.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 32.5, 15, 15 },
{ 16.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 0.5, 15, 15 },
{ 48.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 0.5, 15, 15 },
{ 48.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 64.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 80.5, 15, 15 },
{ 16.5, 80.5, 15, 15 },
{ 32.5, 0.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 80.5, 15, 15 },
{ 16.5, 80.5, 15, 15 },
{ 32.5, 64.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 80.5, 15, 15 },
{ 16.5, 80.5, 15, 15 },
{ 32.5, 0.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 80.5, 15, 15 },
{ 16.5, 80.5, 15, 15 },
{ 0.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 32.5, 15, 15 },
{ 16.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 32.5, 80.5, 15, 15 },
{ 16.5, 80.5, 15, 15 },
{ 0.5, 32.5, 15, 15 },
{ 16.5, 32.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 0.5, 32.5, 15, 15 },
{ 16.5, 32.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 48.5, 16.5, 15, 15 },
{ 32.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 32.5, 16.5, 15, 15 },
{ 16.5, 16.5, 0, 0 },
{ 32.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 32.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 },
{ 32.5, 0.5, 15, 15 },
{ 48.5, 64.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 32.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 },
{ 0.5, 64.5, 15, 15 },
{ 16.5, 64.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 80.5, 15, 15 },
{ 16.5, 80.5, 15, 15 },
{ 0.5, 64.5, 15, 15 },
{ 48.5, 0.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 80.5, 15, 15 },
{ 16.5, 80.5, 15, 15 },
{ 0.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 0.5, 16.5, 0, 0 },
{ 16.5, 16.5, 0, 0 },
{ 0.5, 32.5, 15, 15 },
{ 16.5, 32.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 16.5, 48.5, 15, 15 },
{ 0.5, 80.5, 15, 15 },
{ 16.5, 80.5, 15, 15 },
{ 0.5, 64.5, 15, 15 },
{ 48.5, 64.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 0.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 },
{ 32.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 32.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 },
{ 0.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 0.5, 80.5, 15, 15 },
{ 48.5, 80.5, 15, 15 },
{ 0.5, 0.5, 15, 15 },
{ 16.5, 0.5, 15, 15 },
{ 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 },
{ 0.5, 16.5, 15, 15 },
{ 16.5, 16.5, 15, 15 }
};
extern const int autotileVXRectsA2N = sizeof(autotileVXRectsA2) / sizeof(autotileVXRectsA2[0]);
extern const float autotileVXRectsA2Sizes[] =
{
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
16.0, 16.0, 16.0, 16.0, 16.0, 16.0
};
extern const StaticRect autotileVXRectsB[] = extern const StaticRect autotileVXRectsB[] =
{ {
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 16, 16, 15, 15 }, { 16.5, 16.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 0, 16, 15, 15 }, { 0.5, 16.5, 15, 15 },
{ 16, 16, 15, 15 }, { 16.5, 16.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 16, 0, 15, 15 }, { 16.5, 0.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 16, 16, 15, 15 }, { 16.5, 16.5, 15, 15 },
{ 0, 0, 15, 15 }, { 0.5, 0.5, 15, 15 },
{ 16, 0, 15, 15 }, { 16.5, 0.5, 15, 15 },
{ 0, 16, 15, 15 }, { 0.5, 16.5, 15, 15 },
{ 16, 16, 15, 15 }, { 16.5, 16.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 0, 16, 15, 15 }, { 0.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 16, 15, 15 }, { 32.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 0, 0, 15, 15 }, { 0.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 0, 16, 15, 15 }, { 0.5, 16.5, 15, 15 },
{ 48.5, 16, 15, 15 }, { 48.5, 16.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 16, 32.5, 15, 15 }, { 16.5, 32.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 16, 0, 15, 15 }, { 16.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 0, 0, 15, 15 }, { 0.5, 0.5, 15, 15 },
{ 16, 0, 15, 15 }, { 16.5, 0.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 16, 48.5, 15, 15 }, { 16.5, 48.5, 15, 15 },
{ 32.5, 32.5, 15, 15 }, { 32.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 0, 32.5, 15, 15 }, { 0.5, 32.5, 15, 15 },
{ 48.5, 32.5, 15, 15 }, { 48.5, 32.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 32.5, 0, 15, 15 }, { 32.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 32.5, 48.5, 15, 15 }, { 32.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 }, { 48.5, 48.5, 15, 15 },
{ 0, 0, 15, 15 }, { 0.5, 0.5, 15, 15 },
{ 48.5, 0, 15, 15 }, { 48.5, 0.5, 15, 15 },
{ 0, 48.5, 15, 15 }, { 0.5, 48.5, 15, 15 },
{ 48.5, 48.5, 15, 15 } { 48.5, 48.5, 15, 15 }
}; };

View File

@ -38,6 +38,11 @@
extern const StaticRect autotileVXRectsA[]; extern const StaticRect autotileVXRectsA[];
extern const int autotileVXRectsAN; extern const int autotileVXRectsAN;
/* Table (A2) autotile patterns */
extern const StaticRect autotileVXRectsA2[];
extern const int autotileVXRectsA2N;
extern const float autotileVXRectsA2Sizes[];
/* Wall (B) autotile patterns */ /* Wall (B) autotile patterns */
extern const StaticRect autotileVXRectsB[]; extern const StaticRect autotileVXRectsB[];
extern const int autotileVXRectsBN; extern const int autotileVXRectsBN;
@ -314,6 +319,7 @@ void build(TEXFBO &tf, Bitmap *bitmaps[BM_COUNT])
} }
#define OVER_PLAYER_FLAG (1 << 4) #define OVER_PLAYER_FLAG (1 << 4)
#define TABLE_FLAG (1 << 7)
static void static void
atSelectSubPos(FloatRect &pos, int i) atSelectSubPos(FloatRect &pos, int i)
@ -332,6 +338,13 @@ atSelectSubPos(FloatRect &pos, int i)
pos.x += 16; pos.x += 16;
pos.y += 16; pos.y += 16;
return; return;
case 4:
pos.y += 24;
return;
case 5:
pos.x += 16;
pos.y += 24;
return;
default: default:
assert(!"Unreachable"); assert(!"Unreachable");
} }
@ -358,7 +371,7 @@ readAutotile(Reader &reader, int patternID,
atSelectSubPos(pos[i], i); atSelectSubPos(pos[i], i);
} }
reader.onQuads4(tex, pos); reader.onQuads(tex, pos, 4, false);
} }
static void static void
@ -369,6 +382,29 @@ readAutotileA(Reader &reader, int patternID,
autotileVXRectsA, autotileVXRectsAN); autotileVXRectsA, autotileVXRectsAN);
} }
static void
readAutotileA2(Reader &reader, int patternID,
const Vec2i &orig, int x, int y)
{
FloatRect tex[6], pos[6];
for (int i = 0; i < 6; ++i)
{
assert((patternID*6 + i) < autotileVXRectsA2N);
tex[i] = FloatRect(autotileVXRectsA2[patternID*6 + i]);
tex[i].x += orig.x*32;
tex[i].y += orig.y*32;
float size = autotileVXRectsA2Sizes[patternID*6 + i];
pos[i] = FloatRect(x*32, y*32, size, size);
atSelectSubPos(pos[i], i);
}
reader.onQuads(tex, pos, 6, false);
}
static void static void
readAutotileB(Reader &reader, int patternID, readAutotileB(Reader &reader, int patternID,
const Vec2i &orig, int x, int y) const Vec2i &orig, int x, int y)
@ -399,7 +435,7 @@ readAutotileC(Reader &reader, int patternID,
pos[i].x += i*16; pos[i].x += i*16;
} }
reader.onQuads2(tex, pos); reader.onQuads(tex, pos, 2, false);
} }
static void static void
@ -449,7 +485,7 @@ onTileA1(Reader &reader, int16_t tileID,
static void static void
onTileA2(Reader &reader, int16_t tileID, onTileA2(Reader &reader, int16_t tileID,
int x, int y) int x, int y, bool isTable)
{ {
Vec2i orig = blitsA2[0].dst; Vec2i orig = blitsA2[0].dst;
tileID -= 0x0B00; tileID -= 0x0B00;
@ -460,6 +496,14 @@ onTileA2(Reader &reader, int16_t tileID,
orig.x += (autotileID % 8) * 2; orig.x += (autotileID % 8) * 2;
orig.y += (autotileID / 8) * 3; orig.y += (autotileID / 8) * 3;
/* The table autotile handling isn't 100% accurate;
* for that, we'd need to prerender layer 1 into a separate
* temp texture with blending turned off and render that
* to the screen. But in 99% of cases it shouldn't matter */
if (isTable)
readAutotileA2(reader, patternID, orig, x, y);
else
readAutotileA(reader, patternID, orig, x, y); readAutotileA(reader, patternID, orig, x, y);
} }
@ -514,7 +558,7 @@ onTileA5(Reader &reader, int16_t tileID,
FloatRect tex((orig.x+ox)*32+0.5, (orig.y+oy)*32+0.5, 31, 31); FloatRect tex((orig.x+ox)*32+0.5, (orig.y+oy)*32+0.5, 31, 31);
FloatRect pos(x*32, y*32, 32, 32); FloatRect pos(x*32, y*32, 32, 32);
reader.onQuads1(tex, pos, overPlayer); reader.onQuads(&tex, &pos, 1, overPlayer);
} }
static void static void
@ -531,13 +575,22 @@ onTileBCDE(Reader &reader, int16_t tileID,
FloatRect tex((CDEArea.x+ox)*32+0.5, (CDEArea.y+oy)*32+0.5, 31, 31); FloatRect tex((CDEArea.x+ox)*32+0.5, (CDEArea.y+oy)*32+0.5, 31, 31);
FloatRect pos(x*32, y*32, 32, 32); FloatRect pos(x*32, y*32, 32, 32);
reader.onQuads1(tex, pos, overPlayer); reader.onQuads(&tex, &pos, 1, overPlayer);
} }
static void static void
onTile(Reader &reader, int16_t tileID, onTile(Reader &reader, int16_t tileID,
int x, int y, bool overPlayer) int x, int y, const Table *flags)
{ {
int16_t flag = tableGetSafe(flags, tileID);
bool overPlayer = flag & OVER_PLAYER_FLAG;
#if RGSS_VER == 3
bool isTable = flag & TABLE_FLAG;
#elif RGSS_VER == 2
bool isTable = (tileID - 0x0B00) % (8 * 0x30) >= (7 * 0x30);
#endif
/* B ~ E */ /* B ~ E */
if (tileID < 0x0400) if (tileID < 0x0400)
{ {
@ -561,7 +614,7 @@ onTile(Reader &reader, int16_t tileID,
/* A2 */ /* A2 */
if (tileID >= 0x0B00 && tileID < 0x1100) if (tileID >= 0x0B00 && tileID < 0x1100)
{ {
onTileA2(reader, tileID, x, y); onTileA2(reader, tileID, x, y, isTable);
return; return;
} }
@ -588,12 +641,11 @@ readLayer(Reader &reader, const Table &data,
for (int x = 0; x < w; ++x) for (int x = 0; x < w; ++x)
{ {
int16_t tileID = tableGetWrapped(data, x+ox, y+oy, z); int16_t tileID = tableGetWrapped(data, x+ox, y+oy, z);
bool overPlayer = tableGetSafe(flags, tileID) & OVER_PLAYER_FLAG;
if (tileID <= 0) if (tileID <= 0)
continue; continue;
onTile(reader, tileID, x, y, overPlayer); onTile(reader, tileID, x, y, flags);
} }
} }
@ -609,7 +661,7 @@ onShadowTile(Reader &reader, int8_t value,
FloatRect tex((shadowArea.x)*32+0.5, (shadowArea.y+oy)*32+0.5, 31, 31); FloatRect tex((shadowArea.x)*32+0.5, (shadowArea.y+oy)*32+0.5, 31, 31);
FloatRect pos(x*32, y*32, 32, 32); FloatRect pos(x*32, y*32, 32, 32);
reader.onQuads1(tex, pos, false); reader.onQuads(&tex, &pos, 1, false);
} }
static void static void

View File

@ -52,10 +52,8 @@ namespace TileAtlasVX
{ {
struct Reader struct Reader
{ {
virtual void onQuads1(const FloatRect &t, const FloatRect &p, virtual void onQuads(const FloatRect *t, const FloatRect *p,
bool overPlayer) = 0; size_t n, bool overPlayer) = 0;
virtual void onQuads2(const FloatRect t[2], const FloatRect p[2]) = 0;
virtual void onQuads4(const FloatRect t[4], const FloatRect p[4]) = 0;
}; };
void build(TEXFBO &tf, Bitmap *bitmaps[BM_COUNT]); void build(TEXFBO &tf, Bitmap *bitmaps[BM_COUNT]);

View File

@ -343,35 +343,13 @@ struct TilemapVXPrivate : public ViewportElement, TileAtlasVX::Reader
} }
/* TileAtlasVX::Reader */ /* TileAtlasVX::Reader */
void onQuads1(const FloatRect &t1, const FloatRect &p1, void onQuads(const FloatRect *t, const FloatRect *p,
bool overPlayer) size_t n, bool overPlayer)
{ {
SVertex *vert; SVertex *vert = allocVert(overPlayer ? aboveVert : groundVert, n*4);
if (overPlayer) for (size_t i = 0; i < n; ++i)
vert = allocVert(aboveVert, 4); Quad::setTexPosRect(&vert[i*4], t[i], p[i]);
else
vert = allocVert(groundVert, 4);
Quad::setTexPosRect(vert, t1, p1);
}
void onQuads2(const FloatRect t[2], const FloatRect p[2])
{
SVertex *vert = allocVert(groundVert, 8);
Quad::setTexPosRect(&vert[0], t[0], p[0]);
Quad::setTexPosRect(&vert[4], t[1], p[1]);
}
void onQuads4(const FloatRect t[4], const FloatRect p[4])
{
SVertex *vert = allocVert(groundVert, 16);
Quad::setTexPosRect(&vert[ 0], t[0], p[0]);
Quad::setTexPosRect(&vert[ 4], t[1], p[1]);
Quad::setTexPosRect(&vert[ 8], t[2], p[2]);
Quad::setTexPosRect(&vert[12], t[3], p[3]);
} }
}; };