Roll sky by camera

This commit is contained in:
Miloslav Ciz 2023-09-17 15:42:46 +02:00
parent e21d5b7825
commit 84163d0d3c
4 changed files with 60 additions and 36 deletions

21
game.h
View file

@ -132,9 +132,18 @@ uint8_t LCR_gameStep(uint32_t time)
if (time >= LCR_nextRenderFrameTime)
{
LCR_drawBackground(0);
LCR_drawSkyStrip(0,0); // TODO: do this AFTER 3D rendering
int skyOffsetV = LCR_EFFECTIVE_RESOLUTION_Y / 2 +
((LCR_EFFECTIVE_RESOLUTION_Y / 2) *
LCR_rendererGetCameraPitch()) /
(LCR_SQUARE_SIDE_LEN / LCR_SETTING_SKY_ROLL_MULTIPLIER_V);
int skyOffsetH = LCR_SKY_IMAGE_SIZE - 1 -
(LCR_rendererGetCameraYaw() * LCR_SKY_IMAGE_SIZE) /
(LCR_SQUARE_SIDE_LEN / LCR_SETTING_SKY_ROLL_MULTIPLIER_H);
LCR_drawBackground(skyOffsetV);
LCR_rendererDraw();
LCR_drawSkyStrip(skyOffsetV,skyOffsetH);
LCR_nextRenderFrameTime += 1000 / LCR_SETTING_FPS;
@ -146,14 +155,14 @@ uint8_t LCR_gameStep(uint32_t time)
if (_LCR_keyStates[LCR_KEY_A])
{
if (_LCR_keyStates[LCR_KEY_UP])
offsets[4] = 4;
offsets[4] = LCR_FREE_CAMERA_TURN_STEP;
else if (_LCR_keyStates[LCR_KEY_DOWN])
offsets[4] -= 4;
offsets[4] -= LCR_FREE_CAMERA_TURN_STEP;
if (_LCR_keyStates[LCR_KEY_RIGHT])
offsets[3] -= 4;
offsets[3] -= LCR_FREE_CAMERA_TURN_STEP;
else if (_LCR_keyStates[LCR_KEY_LEFT])
offsets[3] = 4;
offsets[3] = LCR_FREE_CAMERA_TURN_STEP;
}
else
{