diff --git a/game.cpp b/game.cpp index 5fe5846..ad6968c 100644 --- a/game.cpp +++ b/game.cpp @@ -71,10 +71,18 @@ inline void pixelFunc(PixelInfo pixel) { uint8_t c = 3 + (pixel.isWall == 0 ? 12 : (pixel.hit.direction * 3)); - uint8_t d = pixel.depth / (UNITS_PER_SQUARE * 3); + Unit depth = pixel.depth - UNITS_PER_SQUARE; + + if (depth < 0) + depth = 0; + + int16_t d = depth / (UNITS_PER_SQUARE * 4); + + if (d < 0) + d = 0; if (d <= 2) - c-= d; + c -= d; else c = 0; @@ -105,8 +113,8 @@ return; */ RayConstraints c; - c.maxHits = 8; - c.maxSteps = 10; + c.maxHits = 16; + c.maxSteps = 16; render(player.mCamera,heightFunc,pixelFunc,c); } @@ -115,7 +123,7 @@ int main() { p.begin(); - +/* int a,s,r,g,b; for(a=0; a<=63; a++){ s = 0; r = a; g = 63-a; b = 0; pal[a+s] = p.display.RGBto565(r*4,g*4,b*4); @@ -124,9 +132,9 @@ int main() s = 192; r = 0; g = a; b = 0; pal[a+s] = p.display.RGBto565(r*4,g*4,b*4); } -/* + for (int i = 0; i < 16; ++i) -pal[i] = p.display.RGBto565(i*16,i*16,i*16); +pal[i] = p.display.RGBto565(255-i,255-i,255-i); */ pal[0] = p.display.RGBto565(0,0,0); @@ -146,9 +154,10 @@ pal[13] = p.display.RGBto565(64,64,64); pal[14] = p.display.RGBto565(128,128,128); pal[15] = p.display.RGBto565(192,192,192); + p.display.load565Palette(&pal[0]); // load a palette the same way as any other palette in any other screen mode - p.setFrameRate(30); + p.setFrameRate(60); p.display.setFont(fontTiny);