Browse Source

Fix a speed bug

merge-requests/2/head
Miloslav Číž 1 year ago
parent
commit
6a388227fe
  1. 8
      TODO.txt
  2. 15
      game.h
  3. 6
      main_pokitto.cpp

8
TODO.txt

@ -126,13 +126,9 @@ level ideas: @@ -126,13 +126,9 @@ level ideas:
over a hole, leading to an easter egg
- start of level: a corner blocked by an invisible wall, to indicate entrance DONE
- small pyramid from diffetently elevated floor tiles
- add time slowdown constant
bugs:
- On Pokitto/GB Meta sometimes after turn on the game starts midway loading the
first level.
done:
- add headbob
@ -221,6 +217,10 @@ done: @@ -221,6 +217,10 @@ done:
- Add FOV options. RCL doesn't project sprites with different FOV correctly -
FIX!
- When selecting continue from menu, the player shoots - fix!
- FIX: running diagonally (forward + strafe) player can jump over 3 squares!
- add time slowdown constant
- On Pokitto/GB Meta sometimes after turn on the game starts midway loading the
first level.
scratched:
- option for disabling wall transparency, for performance?

15
game.h

@ -3237,8 +3237,23 @@ void SFG_gameStepPlaying() @@ -3237,8 +3237,23 @@ void SFG_gameStepPlaying()
if (strafe != 0)
{
uint8_t normalize = (moveOffset.x != 0) || (moveOffset.y != 0);
moveOffset.x += strafe * SFG_player.direction.y;
moveOffset.y -= strafe * SFG_player.direction.x;
if (normalize)
{
// This prevents reaching higher speed when moving diagonally.
moveOffset = RCL_normalize(moveOffset);
moveOffset.x = (moveOffset.x * SFG_PLAYER_MOVE_UNITS_PER_FRAME)
/ RCL_UNITS_PER_SQUARE;
moveOffset.y = (moveOffset.y * SFG_PLAYER_MOVE_UNITS_PER_FRAME)
/ RCL_UNITS_PER_SQUARE;
}
}
#if SFG_PREVIEW_MODE

6
main_pokitto.cpp

@ -106,8 +106,6 @@ int8_t SFG_keyPressed(uint8_t key) @@ -106,8 +106,6 @@ int8_t SFG_keyPressed(uint8_t key)
case SFG_KEY_DOWN: return joy.JoyX() > axisThreshold2; break;
case SFG_KEY_RIGHT: return joy.JoyY() > axisThreshold2; break;
case SFG_KEY_LEFT: return joy.JoyY() < axisThreshold1; break;
case SFG_KEY_A: return pokitto.bBtn(); break;
case SFG_KEY_B: return pokitto.aBtn(); break;
case SFG_KEY_JUMP: return pokitto.rightBtn(); break;
case SFG_KEY_STRAFE_RIGHT: return pokitto.downBtn(); break;
case SFG_KEY_STRAFE_LEFT: return pokitto.upBtn(); break;
@ -119,10 +117,10 @@ int8_t SFG_keyPressed(uint8_t key) @@ -119,10 +117,10 @@ int8_t SFG_keyPressed(uint8_t key)
case SFG_KEY_DOWN: return pokitto.downBtn(); break;
case SFG_KEY_RIGHT: return pokitto.rightBtn(); break;
case SFG_KEY_LEFT: return pokitto.leftBtn(); break;
case SFG_KEY_A: return pokitto.aBtn(); break;
case SFG_KEY_B: return pokitto.bBtn(); break;
#endif
case SFG_KEY_A: return pokitto.aBtn(); break;
case SFG_KEY_B: return pokitto.bBtn(); break;
case SFG_KEY_C: return pokitto.cBtn(); break;
default: return 0; break;
}

Loading…
Cancel
Save