diff --git a/examples/LargeBackground/LargeBackground.nds b/examples/LargeBackground/LargeBackground.nds index 88dc76d..832c1fa 100644 Binary files a/examples/LargeBackground/LargeBackground.nds and b/examples/LargeBackground/LargeBackground.nds differ diff --git a/examples/LargeBackground/source/project.c b/examples/LargeBackground/source/project.c index 4a5088e..144fb71 100644 --- a/examples/LargeBackground/source/project.c +++ b/examples/LargeBackground/source/project.c @@ -185,20 +185,20 @@ void DSGM_SetupRooms(int room) { } void Room_1_handler(void) { - if(DSGM_held.Left/* && DSGM_view[DSGM_BOTTOM].x > 0*/) { - DSGM_view[DSGM_BOTTOM].x--; + if(DSGM_held.Left) { + DSGM_view[DSGM_BOTTOM].x -= 4; } - if(DSGM_held.Right/* && DSGM_view[DSGM_BOTTOM].x < DSGM_LargeBackgroundSizeToPixels(DSGM_Backgrounds[marioMap].size) - 256*/) { - DSGM_view[DSGM_BOTTOM].x++; + if(DSGM_held.Right) { + DSGM_view[DSGM_BOTTOM].x += 4; } if(DSGM_held.Up && DSGM_view[DSGM_BOTTOM].y > 0) { - DSGM_view[DSGM_BOTTOM].y--; + DSGM_view[DSGM_BOTTOM].y -= 4; } if(DSGM_held.Down && DSGM_view[DSGM_BOTTOM].y < 240 - 192) { - DSGM_view[DSGM_BOTTOM].y++; + DSGM_view[DSGM_BOTTOM].y += 4; } DSGM_view[DSGM_TOP].x = DSGM_view[DSGM_BOTTOM].x; diff --git a/source/DSGM_largeBackground.c b/source/DSGM_largeBackground.c index 364d3a5..fe5f90c 100644 --- a/source/DSGM_largeBackground.c +++ b/source/DSGM_largeBackground.c @@ -23,9 +23,7 @@ void DSGM_LargeBackgroundUpdateFull(DSGM_View *view, DSGM_Layer *layer) { int minX = ((layer->x + (layer->attachedToView ? view->x : 0)) / 8) - 1; int minXt = minX; - DSGM_Log(false, "minXt before: %d\n", minXt); while(minXt < 0) minXt += tilesLength; - DSGM_Log(false, "minXt after: %d\n", minXt); int maxX = ((layer->x + (layer->attachedToView ? view->x : 0) + 257) / 8); int maxXt = maxX; @@ -57,7 +55,7 @@ void DSGM_LargeBackgroundUpdateFull(DSGM_View *view, DSGM_Layer *layer) { } int x; - for(x = minX; x < maxX; x++) { + for(x = minX - 1; x < maxX + 1; x++) { int xa = x; while(xa < 0) xa += (512 / 8); while(xa > tilesLength) xa -= (512 / 8); @@ -65,11 +63,11 @@ void DSGM_LargeBackgroundUpdateFull(DSGM_View *view, DSGM_Layer *layer) { int ya = minY; while(ya < 0) ya += (512 / 8); while(ya > tilesLength) ya -= (512 / 8); - DSGM_SetTileForceVRAM(layer, xa, ya, layer->largeBackgroundMap[(minYt % tilesLength) * tilesLength + (x % tilesLength)]); + DSGM_SetTileForceVRAM(layer, xa, ya, layer->largeBackgroundMap[((minYt % tilesLength) + (x % tilesLength < 0)) * tilesLength + (x % tilesLength)]); ya = maxY; while(ya < 0) ya += (512 / 8); while(ya > tilesLength) ya -= (512 / 8); - DSGM_SetTileForceVRAM(layer, xa, ya, layer->largeBackgroundMap[(maxYt % tilesLength) * tilesLength + (x % tilesLength)]); + DSGM_SetTileForceVRAM(layer, xa, ya, layer->largeBackgroundMap[((maxYt % tilesLength) + (x % tilesLength < 0)) * tilesLength + (x % tilesLength)]); } }