jetpack.diff 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Anarch mod that adds jetpack: instead of jumping the player will simply fly.
  2. diff --git a/game.h b/game.h
  3. index 1efd83d..f8228e4 100755
  4. --- a/game.h
  5. +++ b/game.h
  6. @@ -3291,15 +3291,13 @@ void SFG_gameStepPlaying(void)
  7. else
  8. SFG_player.verticalSpeed = 0;
  9. #else
  10. +
  11. + if (SFG_keyIsDown(SFG_KEY_JUMP))
  12. + SFG_player.verticalSpeed = RCL_min(SFG_player.verticalSpeed +
  13. + SFG_GRAVITY_SPEED_INCREASE_PER_FRAME * 2,
  14. + SFG_GRAVITY_SPEED_INCREASE_PER_FRAME * SFG_JETPACK_MAX_VERTICAL_SPEED);
  15. +
  16. RCL_Unit verticalOffset =
  17. - (
  18. - (
  19. - SFG_keyIsDown(SFG_KEY_JUMP) ||
  20. - (SFG_keyIsDown(SFG_KEY_UP) && SFG_keyIsDown(SFG_KEY_C))
  21. - ) &&
  22. - (SFG_player.verticalSpeed == 0) &&
  23. - (SFG_player.previousVerticalSpeed == 0)) ?
  24. - SFG_PLAYER_JUMP_OFFSET_PER_FRAME : // jump
  25. (SFG_player.verticalSpeed - SFG_GRAVITY_SPEED_INCREASE_PER_FRAME);
  26. #endif
  27. diff --git a/settings.h b/settings.h
  28. index a0d8c1f..080a983 100644
  29. --- a/settings.h
  30. +++ b/settings.h
  31. @@ -189,6 +189,13 @@
  32. #define SFG_RAYCASTING_MAX_HITS 10
  33. #endif
  34. +/**
  35. + Maximum jetpack vertical speed.
  36. +*/
  37. +#ifndef SFG_JETPACK_MAX_VERTICAL_SPEED
  38. + #define SFG_JETPACK_MAX_VERTICAL_SPEED 20
  39. +#endif
  40. +
  41. /**
  42. Same as SFG_RAYCASTING_MAX_STEPS but for visibility rays that are used to
  43. check whether sprites are visible etc.