diff --git a/src/nostalgia/core/userland/gfx_opengl.cpp b/src/nostalgia/core/userland/gfx_opengl.cpp index 00941963..95fbb9d7 100644 --- a/src/nostalgia/core/userland/gfx_opengl.cpp +++ b/src/nostalgia/core/userland/gfx_opengl.cpp @@ -480,11 +480,11 @@ void setSprite(Context *ctx, {4, 8}, // 2, 3 }; const auto dim = dimensions[(spriteShape << 2) | spriteSize]; - const auto uX = static_cast(x) % 255; - const auto uY = static_cast(y) % 127; + const auto uX = static_cast(x) % 255; + const auto uY = static_cast(y + 8) % 255 - 8; auto &id = *ctx->rendererData(); auto i = 0u; - const auto set = [&](unsigned xIt, unsigned yIt) { + const auto set = [&](int xIt, int yIt) { const auto fX = static_cast(uX + xIt * 8) / 8; const auto fY = static_cast(uY + yIt * 8) / 8; const auto cidx = idx + i; @@ -495,15 +495,15 @@ void setSprite(Context *ctx, ++i; }; if (!flipX) { - for (auto yIt = 0u; yIt < dim.y; ++yIt) { + for (auto yIt = 0; yIt < static_cast(dim.y); ++yIt) { for (auto xIt = 0u; xIt < dim.x; ++xIt) { - set(xIt, yIt); + set(static_cast(xIt), static_cast(yIt)); } } } else { for (auto yIt = 0u; yIt < dim.y; ++yIt) { for (auto xIt = dim.x - 1; xIt < ~0u; --xIt) { - set(xIt, yIt); + set(static_cast(xIt), static_cast(yIt)); } } }