Add doors

This commit is contained in:
Miloslav Číž 2018-09-14 19:42:02 +02:00
parent f536a7756f
commit d748874c08

View file

@ -66,11 +66,11 @@ const unsigned char level[] =
0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,3,0,2,2,0,0,0,0,0,0,0,0,0,2, // 5
4,0,3,1,3,1,0,2,2,2,3,2,2,2,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 6
0,0,2,0,0,0,0,0,0,5,0,0,0,0,0,0,0,5,0,0,0,0,1,2,0,5,5,0,0,0,0,0, // 7
0,0,1,0,0,0,0,0,0,5,0,0,0,0,0,0,0,2,0,0,0,0,4,0,0,0,5,0,0,2,0,0, // 8
0,0,1,0,0,0,0,0,0,5,0,0,0,0,0,0,0,6,0,0,0,0,4,0,0,0,5,0,0,2,0,0, // 8
0,0,2,0,0,0,0,0,0,2,3,2,4,0,0,0,2,2,4,1,4,0,4,4,4,3,2,0,0,4,2,2, // 9
0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,3,3,4,0,0,0,0,0,1,0,0,0,0,0,0,0,4, // 10
2,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,2,4,0,0,0,0,0,1,0,0,4,0,0,3,0,1, // 11
1,3,1,0,4,4,4,2,2,1,2,0,2,2,3,0,0,1,4,0,0,0,3,3,3,5,2,0,0,0,0,2, // 12
1,3,1,0,4,4,4,2,2,1,2,6,2,2,3,0,0,1,4,0,0,0,3,3,3,5,2,0,0,0,0,2, // 12
0,0,0,0,0,0,0,0,0,4,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1, // 13
0,0,0,3,0,5,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, // 14
0,0,0,0,0,0,0,0,0,4,0,0,0,0,2,0,0,5,0,0,4,0,0,1,0,3,0,3,0,3,0,1 // 15
@ -776,8 +776,23 @@ Unit floorHeightAt(int16_t x, int16_t y)
Unit textureAt(int16_t x, int16_t y)
{
Unit t = 0;
if (x >= 0 && x < LEVEL_X_RES && y >= 0 && y < LEVEL_Y_RES)
return max(level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x] - 1,0);
t = max(level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x] - 1,0);
t = t == 5 ? 1 : t; // square 6 has the same texture as 1
return t;
}
Unit rollAt(int16_t x, int16_t y)
{
Unit square = textureAt(x,y);
if (x >= 0 && x < LEVEL_X_RES && y >= 0 && y < LEVEL_Y_RES &&
level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x] == 6)
return (pokitto.frameCount * 10) % UNITS_PER_SQUARE;
return 0;
}
@ -846,7 +861,7 @@ void draw()
#ifdef RENDER_PRECISE
render(player.mCamera,floorHeightAt,0,textureAt,pixelFunc,c);
#else
renderSimple(player.mCamera,floorHeightAt,textureAt,pixelFunc,c);
renderSimple(player.mCamera,floorHeightAt,textureAt,pixelFunc,rollAt,c);
#endif
player.mCamera.height -= player.mHeadBob;