This commit is contained in:
Miloslav Číž 2018-09-10 17:40:27 +02:00
parent dbdedf48fb
commit f3353d09e2
3 changed files with 16 additions and 9 deletions

View file

@ -812,7 +812,6 @@ int main()
previousTime = timeNow;
int16_t horizontalStep = (dt * PLAYER_SPEED * (player.mRunning ? 2 : 1)) / 1000;
int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000;
Vector2D d = angleToDirection(player.mCamera.direction);
@ -882,7 +881,10 @@ int main()
moveOffset = d;
}
else
{
int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000;
player.mCamera.direction += addition * rotationStep;
}
Unit prevHeight = player.mCamera.height;

View file

@ -852,7 +852,6 @@ int main()
previousTime = timeNow;
int16_t horizontalStep = (dt * PLAYER_SPEED * (pokitto.bBtn() ? 2 : 1)) / 1000;
int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000;
Vector2D d = angleToDirection(player.mCamera.direction);
@ -921,7 +920,10 @@ int main()
moveOffset = d;
}
else
{
int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000;
player.mCamera.direction += addition * rotationStep;
}
Unit prevHeight = player.mCamera.height;

View file

@ -176,8 +176,8 @@ Unit colorAt(int16_t x, int16_t y)
heightProfile[absVal(y) % HEIGHT_PROFILE_LENGTH]) / 10,3);
}
uint16_t previousColumn = 255;
uint16_t backgroundColumn = 0;
uint16_t previousColumn = 255; ///< Helper for precomputing background.
uint16_t backgroundColumn = 0; ///< Precomputed background column.
/**
Function for drawing a single pixel (like fragment shader).
@ -185,7 +185,6 @@ uint16_t backgroundColumn = 0;
inline void pixelFunc(PixelInfo pixel)
{
uint8_t c = 0;
int16_t intensity = 0;
if (pixel.isWall)
@ -263,9 +262,11 @@ int main()
player.setPositionSquare(4,5);
// init changes
for (uint16_t i = 0; i < MAX_CHANGES; ++i)
{
changes[i].mCoords.x = i;
changes[i].mCoords.x = (i + 1) * 1000;
changes[i].mCoords.y = 0;
changes[i].mHeight = floorHeightAt(i,0);
}
@ -284,7 +285,6 @@ int main()
previousTime = timeNow;
int16_t horizontalStep = (dt * PLAYER_SPEED * (player.mRunning ? 2 : 1)) / 1000;
int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000;
Vector2D d = angleToDirection(player.mCamera.direction);
@ -421,8 +421,11 @@ int main()
moveOffset = d;
}
else
{
int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000;
player.mCamera.direction = wrap(player.mCamera.direction + addition * rotationStep,UNITS_PER_SQUARE);
}
}
editCounter = max(0, editCounter - 1);