TilemapVX: Clean up the horrible map viewport calculation code

Also rename "offset" to "origin" which makes a lot more sense
for ox/oy attributes.
This commit is contained in:
Jonas Kulla 2015-07-16 19:05:15 +02:00
parent 5aaeb0206c
commit dd7545fcf2
3 changed files with 36 additions and 47 deletions

View file

@ -46,6 +46,13 @@ wrap(int value, int range)
return res < 0 ? res + range : res;
}
static inline Vec2i
wrap(const Vec2i &value, int range)
{
return Vec2i(wrap(value.x, range),
wrap(value.y, range));
}
static inline int16_t
tableGetWrapped(const Table &t, int x, int y, int z = 0)
{