Tilemap(VX): Factor out common code into tilemap-common.h

Renamed flashmap.h to tilemap-common.h as it already contained
shared functions.
This commit is contained in:
Jonas Kulla 2014-11-30 17:46:28 +01:00
parent faef0e8503
commit 60f101f2e6
7 changed files with 114 additions and 128 deletions

View file

@ -21,6 +21,7 @@
#include "tileatlasvx.h"
#include "tilemap-common.h"
#include "bitmap.h"
#include "table.h"
#include "etc-internal.h"
@ -65,21 +66,6 @@ static elementsN(autotileVXRectsC);
namespace TileAtlasVX
{
static int
wrap(int value, int range)
{
int res = value % range;
return res < 0 ? res + range : res;
}
static int16_t
tableGetWrapped(const Table &t, int x, int y, int z = 0)
{
return t.at(wrap(x, t.xSize()),
wrap(y, t.ySize()),
z);
}
static int16_t
tableGetSafe(const Table *t, int x)
{
@ -333,35 +319,6 @@ void build(TEXFBO &tf, Bitmap *bitmaps[BM_COUNT])
#define OVER_PLAYER_FLAG (1 << 4)
#define TABLE_FLAG (1 << 7)
static void
atSelectSubPos(FloatRect &pos, int i)
{
switch (i)
{
case 0:
return;
case 1:
pos.x += 16;
return;
case 2:
pos.y += 16;
return;
case 3:
pos.x += 16;
pos.y += 16;
return;
case 4:
pos.y += 24;
return;
case 5:
pos.x += 16;
pos.y += 24;
return;
default:
assert(!"Unreachable");
}
}
/* Reference: http://www.tktkgame.com/tkool/memo/vx/tile_id.html */
static void