Diffstat (limited to 'noncore/games/sfcave/sfcave.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index 5633a8f..c1e4532 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp | |||
@@ -224,28 +224,25 @@ void SFCave :: setUp() | |||
224 | score = 0; | 224 | score = 0; |
225 | offset = 0; | 225 | offset = 0; |
226 | nrFrames = 0; | 226 | nrFrames = 0; |
227 | dir = 1; | 227 | dir = 1; |
228 | thrust = 0; | 228 | thrust = 0; |
229 | 229 | ||
230 | int dist[] = { 100, 60, 40 }; | ||
231 | if ( CURRENT_GAME_TYPE == SFCAVE_GAME ) | 230 | if ( CURRENT_GAME_TYPE == SFCAVE_GAME ) |
232 | { | 231 | { |
233 | thrustUp = UpThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; | 232 | thrustUp = UpThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; |
234 | noThrust = DownThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; | 233 | noThrust = DownThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; |
235 | maxUpThrust = MaxUpThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; | 234 | maxUpThrust = MaxUpThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; |
236 | maxDownThrust = MaxDownThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; | 235 | maxDownThrust = MaxDownThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; |
237 | 236 | ||
238 | if ( currentCameDifficulty == DIFICULTY_EASY ) | 237 | if ( currentGameDifficulty == DIFICULTY_EASY ) |
239 | gateDistance = 100; | 238 | gateDistance = 100; |
240 | else if ( currentCameDifficulty == DIFICULTY_EASY ) | 239 | else if ( currentGameDifficulty == DIFICULTY_EASY ) |
241 | gateDistance = 60; | 240 | gateDistance = 60; |
242 | else | 241 | else |
243 | gateDistance = 40; | 242 | gateDistance = 40; |
244 | |||
245 | printf( "GD = %d\n", gateDistance ); | ||
246 | } | 243 | } |
247 | else if ( CURRENT_GAME_TYPE == GATES_GAME ) | 244 | else if ( CURRENT_GAME_TYPE == GATES_GAME ) |
248 | { | 245 | { |
249 | thrustUp = UpThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; | 246 | thrustUp = UpThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; |
250 | noThrust = DownThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; | 247 | noThrust = DownThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; |
251 | maxUpThrust = MaxUpThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; | 248 | maxUpThrust = MaxUpThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; |
@@ -788,17 +785,19 @@ void SFCave :: keyPressEvent( QKeyEvent *e ) | |||
788 | { | 785 | { |
789 | switch( e->key() ) | 786 | switch( e->key() ) |
790 | { | 787 | { |
791 | case Qt::Key_Up: | 788 | case Qt::Key_Up: |
792 | case Qt::Key_F9: | 789 | case Qt::Key_F9: |
793 | case Qt::Key_Space: | 790 | case Qt::Key_Space: |
794 | if ( !replay && !press ) | 791 | if ( state == STATE_RUNNING && !replay && !press ) |
795 | { | 792 | { |
796 | press = true; | 793 | press = true; |
797 | replayList.append( new int( nrFrames ) ); | 794 | replayList.append( new int( nrFrames ) ); |
798 | } | 795 | } |
796 | else if ( state == STATE_CRASHED && e->key() == Key_Up ) | ||
797 | state = STATE_NEWGAME; | ||
799 | break; | 798 | break; |
800 | case Qt::Key_M: | 799 | case Qt::Key_M: |
801 | case Qt::Key_Return: | 800 | case Qt::Key_Return: |
802 | case Qt::Key_Enter: | 801 | case Qt::Key_Enter: |
803 | if ( state == STATE_CRASHED ) | 802 | if ( state == STATE_CRASHED ) |
804 | { | 803 | { |
@@ -828,18 +827,16 @@ void SFCave :: keyReleaseEvent( QKeyEvent *e ) | |||
828 | { | 827 | { |
829 | switch( e->key() ) | 828 | switch( e->key() ) |
830 | { | 829 | { |
831 | case Qt::Key_F9: | 830 | case Qt::Key_F9: |
832 | case Qt::Key_Space: | 831 | case Qt::Key_Space: |
833 | case Qt::Key_Up: | 832 | case Qt::Key_Up: |
834 | if ( !replay && press ) | ||
835 | { | ||
836 | press = false; | 833 | press = false; |
837 | 834 | if ( state == STATE_RUNNING && !replay && press ) | |
838 | replayList.append( new int( nrFrames ) ); | 835 | replayList.append( new int( nrFrames ) ); |
839 | } | 836 | |
840 | break; | 837 | break; |
841 | 838 | ||
842 | case Qt::Key_R: | 839 | case Qt::Key_R: |
843 | if ( state == STATE_CRASHED ) | 840 | if ( state == STATE_CRASHED ) |
844 | { | 841 | { |
845 | state = STATE_REPLAY; | 842 | state = STATE_REPLAY; |