Improve the fog
This commit is contained in:
parent
0766b115e4
commit
9f7da2542e
1 changed files with 17 additions and 8 deletions
23
game.cpp
23
game.cpp
|
@ -71,7 +71,15 @@ inline void pixelFunc(PixelInfo pixel)
|
||||||
{
|
{
|
||||||
uint8_t c = 3 + (pixel.isWall == 0 ? 12 : (pixel.hit.direction * 3));
|
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)
|
if (d <= 2)
|
||||||
c -= d;
|
c -= d;
|
||||||
|
@ -105,8 +113,8 @@ return;
|
||||||
*/
|
*/
|
||||||
RayConstraints c;
|
RayConstraints c;
|
||||||
|
|
||||||
c.maxHits = 8;
|
c.maxHits = 16;
|
||||||
c.maxSteps = 10;
|
c.maxSteps = 16;
|
||||||
|
|
||||||
render(player.mCamera,heightFunc,pixelFunc,c);
|
render(player.mCamera,heightFunc,pixelFunc,c);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +123,7 @@ int main()
|
||||||
{
|
{
|
||||||
p.begin();
|
p.begin();
|
||||||
|
|
||||||
|
/*
|
||||||
int a,s,r,g,b;
|
int a,s,r,g,b;
|
||||||
for(a=0; a<=63; a++){
|
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);
|
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);
|
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)
|
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);
|
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[14] = p.display.RGBto565(128,128,128);
|
||||||
pal[15] = p.display.RGBto565(192,192,192);
|
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.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);
|
p.display.setFont(fontTiny);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue