From 3f8674bd26a2b2718b16817117a047ac3e9b61c3 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 14 Aug 2011 13:53:39 +0200 Subject: random tile engine is fixed once and for all! --- src/randtiles.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/randtiles.cpp b/src/randtiles.cpp index f4853d4..1508200 100644 --- a/src/randtiles.cpp +++ b/src/randtiles.cpp @@ -146,13 +146,13 @@ extern "C" void TryAndRandomise(RTilemapClass *self, BGRender *bgr) { u16 *top = 0, *left = 0, *right = 0, *bottom = 0; if (type == RandomTileData::CHECK_HORZ || type == RandomTileData::CHECK_BOTH) { - left = self->getPointerToTile(bgr->curX - 1, bgr->curY); - right = self->getPointerToTile(bgr->curX + 1, bgr->curY); + left = self->getPointerToTile((bgr->curX - 1) * 16, bgr->curY * 16); + right = self->getPointerToTile((bgr->curX + 1) * 16, bgr->curY * 16); } if (type == RandomTileData::CHECK_VERT || type == RandomTileData::CHECK_BOTH) { - top = self->getPointerToTile(bgr->curX, bgr->curY - 1); - bottom = self->getPointerToTile(bgr->curX, bgr->curY + 1); + top = self->getPointerToTile(bgr->curX * 16, (bgr->curY - 1) * 16); + bottom = self->getPointerToTile(bgr->curX * 16, (bgr->curY + 1) * 16); } int attempts = 0; @@ -180,7 +180,7 @@ extern "C" void TryAndRandomise(RTilemapClass *self, BGRender *bgr) { if (special == RandomTileData::SP_VDOUBLE_BOTTOM) { if (top == 0) - top = self->getPointerToTile(bgr->curX, bgr->curY - 1); + top = self->getPointerToTile(bgr->curX * 16, (bgr->curY - 1) * 16); *top = (chosen - 0x10); } -- cgit v1.2.3