-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 19 | ||||
-rw-r--r-- | noncore/games/sfcave/sfcave.h | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index d6d28b2..9b30fe6 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp @@ -123,16 +123,17 @@ int SFCave::flyHardScores[7][3] = { { 0, 20, 5 }, { 40, 100, 1 }, { 100, 150, -2 }, { 150, 300, -5 }, { -1, -1, -1 } }; int SFCave::initialGateGaps[] = { 75, 50, 25 }; +#define FLYSCORES( x, y ) (*(flyScores + ((x)*3) + y)) bool movel; int main( int argc, char *argv[] ) { movel = true; #ifdef QWS QPEApplication a( argc, argv ); @@ -277,21 +278,21 @@ void SFCave :: setUp() else { thrustUp = UpThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; noThrust = DownThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; maxUpThrust = MaxUpThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; maxDownThrust = MaxDownThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; if ( currentGameDifficulty == DIFICULTY_EASY ) - flyScores = flyEasyScores; + flyScores = (int*)flyEasyScores; else if ( currentGameDifficulty == DIFICULTY_NORMAL ) - flyScores = flyNormalScores; + flyScores = (int*)flyNormalScores; else - flyScores = flyHardScores; + flyScores = (int*)flyHardScores; } crashLineLength = 0; lastGateBottomY = 0; user.setRect( 50, sWidth/2, 4, 4 ); blockWidth = 20; @@ -476,21 +477,21 @@ void SFCave :: handleGameFly() } if ( startScoring ) { // Update score // get distance between landscape and ship // the closer the difference is to 0 means more points - for ( int i = 0 ; i < 10 && flyScores[i][0] != -1 ; ++i ) + for ( int i = 0 ; i < 10 && FLYSCORES( i, 0 ) != -1 ; ++i ) { - if ( flyScores[i][0] <= diff && flyScores[i][1] > diff ) + if ( FLYSCORES( i, 0 ) <= diff && FLYSCORES(i, 1 ) > diff ) { - score += flyScores[i][2]; + score += FLYSCORES( i, 2 ); break; } } } } if ( checkFlyGameCollision() ) { @@ -689,22 +690,22 @@ void SFCave :: draw() if ( CURRENT_GAME_TYPE != FLY_GAME ) p.drawLine( (i*segSize) - (offset*speed), mapTop[i], ((i+1)*segSize)-(offset*speed), mapTop[i+1] ); p.drawLine( (i*segSize) - (offset*speed), mapBottom[i], ((i+1)*segSize)-(offset*speed), mapBottom[i+1] ); if ( CURRENT_GAME_TYPE == FLY_GAME && showScoreZones ) { p.setPen( Qt::blue ); - for ( int j = 1 ; j < 10 && flyScores[j][0] != -1 ; ++j ) + for ( int j = 1 ; j < 10 && FLYSCORES( j, 0 ) != -1 ; ++j ) { - if ( flyScores[j][2] < 0 ) + if ( FLYSCORES( j, 2 ) < 0 ) p.setPen( Qt::red ); - p.drawLine( (i*segSize) - (offset*speed), mapBottom[i]-flyScores[j][0], ((i+1)*segSize)-(offset*speed), mapBottom[i+1]-flyScores[j][0] ); + p.drawLine( (i*segSize) - (offset*speed), mapBottom[i]-FLYSCORES( j, 0 ), ((i+1)*segSize)-(offset*speed), mapBottom[i+1]-FLYSCORES( j, 0 ) ); } p.setPen( Qt::white ); } } // Uncomment this to show user segment (usful for checking collision boundary with landscape // p.setPen( Qt::red ); diff --git a/noncore/games/sfcave/sfcave.h b/noncore/games/sfcave/sfcave.h index f95558d..b1fe819 100644 --- a/noncore/games/sfcave/sfcave.h +++ b/noncore/games/sfcave/sfcave.h @@ -45,17 +45,17 @@ public: static double DownThrustVals[3][3]; static double MaxUpThrustVals[3][3]; static double MaxDownThrustVals[3][3]; static int initialGateGaps[]; static int flyEasyScores[7][3]; static int flyNormalScores[7][3]; static int flyHardScores[7][3]; - int flyScores[7][3]; + int *flyScores; double thrustUp; double noThrust; double maxUpThrust; double maxDownThrust; int gateDistance; |