summaryrefslogtreecommitdiff
path: root/noncore
authorandyq <andyq>2002-12-20 22:57:16 (UTC)
committer andyq <andyq>2002-12-20 22:57:16 (UTC)
commit12a964a2f8837ee981284f3ee902baae0c7b1f77 (patch) (side-by-side diff)
treec89f1e29e40f8aa1d0b1f2940b7227ce6c75bf01 /noncore
parent48efd0d81aad0c3d0a64baabbc46fde593eb086c (diff)
downloadopie-12a964a2f8837ee981284f3ee902baae0c7b1f77.zip
opie-12a964a2f8837ee981284f3ee902baae0c7b1f77.tar.gz
opie-12a964a2f8837ee981284f3ee902baae0c7b1f77.tar.bz2
Fixed small bugette with cursor keys
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave/sfcave.cpp19
1 files changed, 8 insertions, 11 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
@@ -218,40 +218,37 @@ int SFCave :: nextInt( int range )
return val;
}
void SFCave :: setUp()
{
score = 0;
offset = 0;
nrFrames = 0;
dir = 1;
thrust = 0;
- int dist[] = { 100, 60, 40 };
if ( CURRENT_GAME_TYPE == SFCAVE_GAME )
{
thrustUp = UpThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];;
noThrust = DownThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];;
maxUpThrust = MaxUpThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];;
maxDownThrust = MaxDownThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];;
- if ( currentCameDifficulty == DIFICULTY_EASY )
+ if ( currentGameDifficulty == DIFICULTY_EASY )
gateDistance = 100;
- else if ( currentCameDifficulty == DIFICULTY_EASY )
+ else if ( currentGameDifficulty == DIFICULTY_EASY )
gateDistance = 60;
else
gateDistance = 40;
-
- printf( "GD = %d\n", gateDistance );
}
else if ( CURRENT_GAME_TYPE == GATES_GAME )
{
thrustUp = UpThrustVals[GATES_GAME_TYPE][currentGameDifficulty];;
noThrust = DownThrustVals[GATES_GAME_TYPE][currentGameDifficulty];;
maxUpThrust = MaxUpThrustVals[GATES_GAME_TYPE][currentGameDifficulty];;
maxDownThrust = MaxDownThrustVals[GATES_GAME_TYPE][currentGameDifficulty];;
gateDistance = 75;
nextGate = nextInt( 50 ) + gateDistance;
}
else
{
@@ -782,29 +779,31 @@ void SFCave :: handleKeys()
void SFCave :: keyPressEvent( QKeyEvent *e )
{
if ( state == STATE_MENU )
handleMenuKeys( e );
else
{
switch( e->key() )
{
case Qt::Key_Up:
case Qt::Key_F9:
case Qt::Key_Space:
- if ( !replay && !press )
+ if ( state == STATE_RUNNING && !replay && !press )
{
press = true;
replayList.append( new int( nrFrames ) );
}
+ else if ( state == STATE_CRASHED && e->key() == Key_Up )
+ state = STATE_NEWGAME;
break;
case Qt::Key_M:
case Qt::Key_Return:
case Qt::Key_Enter:
if ( state == STATE_CRASHED )
{
state = STATE_MENU;
currentMenuNr = 0;
currentMenuOption[currentMenuNr] = 0;
}
break;
@@ -822,30 +821,28 @@ void SFCave :: keyPressEvent( QKeyEvent *e )
void SFCave :: keyReleaseEvent( QKeyEvent *e )
{
if ( state == STATE_MENU )
{
}
else
{
switch( e->key() )
{
case Qt::Key_F9:
case Qt::Key_Space:
case Qt::Key_Up:
- if ( !replay && press )
- {
- press = false;
-
+ press = false;
+ if ( state == STATE_RUNNING && !replay && press )
replayList.append( new int( nrFrames ) );
- }
+
break;
case Qt::Key_R:
if ( state == STATE_CRASHED )
{
state = STATE_REPLAY;
}
break;
case Qt::Key_Down:
if ( state == STATE_CRASHED )
state = STATE_NEWGAME;