summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave/sfcave.cpp19
-rw-r--r--noncore/games/sfcave/sfcave.h2
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 },
123 { 40, 100, 1 }, 123 { 40, 100, 1 },
124 { 100, 150, -2 }, 124 { 100, 150, -2 },
125 { 150, 300, -5 }, 125 { 150, 300, -5 },
126 { -1, -1, -1 } }; 126 { -1, -1, -1 } };
127 127
128int SFCave::initialGateGaps[] = { 75, 50, 25 }; 128int SFCave::initialGateGaps[] = { 75, 50, 25 };
129 129
130 130
131#define FLYSCORES( x, y ) (*(flyScores + ((x)*3) + y))
131bool movel; 132bool movel;
132 133
133 134
134int main( int argc, char *argv[] ) 135int main( int argc, char *argv[] )
135{ 136{
136 movel = true; 137 movel = true;
137#ifdef QWS 138#ifdef QWS
138 QPEApplication a( argc, argv ); 139 QPEApplication a( argc, argv );
@@ -277,21 +278,21 @@ void SFCave :: setUp()
277 else 278 else
278 { 279 {
279 thrustUp = UpThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; 280 thrustUp = UpThrustVals[FLY_GAME_TYPE][currentGameDifficulty];
280 noThrust = DownThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; 281 noThrust = DownThrustVals[FLY_GAME_TYPE][currentGameDifficulty];
281 maxUpThrust = MaxUpThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; 282 maxUpThrust = MaxUpThrustVals[FLY_GAME_TYPE][currentGameDifficulty];
282 maxDownThrust = MaxDownThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; 283 maxDownThrust = MaxDownThrustVals[FLY_GAME_TYPE][currentGameDifficulty];
283 284
284 if ( currentGameDifficulty == DIFICULTY_EASY ) 285 if ( currentGameDifficulty == DIFICULTY_EASY )
285 flyScores = flyEasyScores; 286 flyScores = (int*)flyEasyScores;
286 else if ( currentGameDifficulty == DIFICULTY_NORMAL ) 287 else if ( currentGameDifficulty == DIFICULTY_NORMAL )
287 flyScores = flyNormalScores; 288 flyScores = (int*)flyNormalScores;
288 else 289 else
289 flyScores = flyHardScores; 290 flyScores = (int*)flyHardScores;
290 } 291 }
291 292
292 crashLineLength = 0; 293 crashLineLength = 0;
293 lastGateBottomY = 0; 294 lastGateBottomY = 0;
294 295
295 user.setRect( 50, sWidth/2, 4, 4 ); 296 user.setRect( 50, sWidth/2, 4, 4 );
296 297
297 blockWidth = 20; 298 blockWidth = 20;
@@ -476,21 +477,21 @@ void SFCave :: handleGameFly()
476 } 477 }
477 478
478 if ( startScoring ) 479 if ( startScoring )
479 { 480 {
480 // Update score 481 // Update score
481 // get distance between landscape and ship 482 // get distance between landscape and ship
482 483
483 // the closer the difference is to 0 means more points 484 // the closer the difference is to 0 means more points
484 for ( int i = 0 ; i < 10 && flyScores[i][0] != -1 ; ++i ) 485 for ( int i = 0 ; i < 10 && FLYSCORES( i, 0 ) != -1 ; ++i )
485 { 486 {
486 if ( flyScores[i][0] <= diff && flyScores[i][1] > diff ) 487 if ( FLYSCORES( i, 0 ) <= diff && FLYSCORES(i, 1 ) > diff )
487 { 488 {
488 score += flyScores[i][2]; 489 score += FLYSCORES( i, 2 );
489 break; 490 break;
490 } 491 }
491 } 492 }
492 } 493 }
493 } 494 }
494 495
495 if ( checkFlyGameCollision() ) 496 if ( checkFlyGameCollision() )
496 { 497 {
@@ -689,22 +690,22 @@ void SFCave :: draw()
689 if ( CURRENT_GAME_TYPE != FLY_GAME ) 690 if ( CURRENT_GAME_TYPE != FLY_GAME )
690 p.drawLine( (i*segSize) - (offset*speed), mapTop[i], ((i+1)*segSize)-(offset*speed), mapTop[i+1] ); 691 p.drawLine( (i*segSize) - (offset*speed), mapTop[i], ((i+1)*segSize)-(offset*speed), mapTop[i+1] );
691 692
692 p.drawLine( (i*segSize) - (offset*speed), mapBottom[i], ((i+1)*segSize)-(offset*speed), mapBottom[i+1] ); 693 p.drawLine( (i*segSize) - (offset*speed), mapBottom[i], ((i+1)*segSize)-(offset*speed), mapBottom[i+1] );
693 694
694 if ( CURRENT_GAME_TYPE == FLY_GAME && showScoreZones ) 695 if ( CURRENT_GAME_TYPE == FLY_GAME && showScoreZones )
695 { 696 {
696 p.setPen( Qt::blue ); 697 p.setPen( Qt::blue );
697 for ( int j = 1 ; j < 10 && flyScores[j][0] != -1 ; ++j ) 698 for ( int j = 1 ; j < 10 && FLYSCORES( j, 0 ) != -1 ; ++j )
698 { 699 {
699 if ( flyScores[j][2] < 0 ) 700 if ( FLYSCORES( j, 2 ) < 0 )
700 p.setPen( Qt::red ); 701 p.setPen( Qt::red );
701 702
702 p.drawLine( (i*segSize) - (offset*speed), mapBottom[i]-flyScores[j][0], ((i+1)*segSize)-(offset*speed), mapBottom[i+1]-flyScores[j][0] ); 703 p.drawLine( (i*segSize) - (offset*speed), mapBottom[i]-FLYSCORES( j, 0 ), ((i+1)*segSize)-(offset*speed), mapBottom[i+1]-FLYSCORES( j, 0 ) );
703 } 704 }
704 705
705 p.setPen( Qt::white ); 706 p.setPen( Qt::white );
706 } 707 }
707 } 708 }
708 709
709 // Uncomment this to show user segment (usful for checking collision boundary with landscape 710 // Uncomment this to show user segment (usful for checking collision boundary with landscape
710// p.setPen( Qt::red ); 711// 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:
45 static double DownThrustVals[3][3]; 45 static double DownThrustVals[3][3];
46 static double MaxUpThrustVals[3][3]; 46 static double MaxUpThrustVals[3][3];
47 static double MaxDownThrustVals[3][3]; 47 static double MaxDownThrustVals[3][3];
48 static int initialGateGaps[]; 48 static int initialGateGaps[];
49 49
50 static int flyEasyScores[7][3]; 50 static int flyEasyScores[7][3];
51 static int flyNormalScores[7][3]; 51 static int flyNormalScores[7][3];
52 static int flyHardScores[7][3]; 52 static int flyHardScores[7][3];
53 int flyScores[7][3]; 53 int *flyScores;
54 54
55 55
56 double thrustUp; 56 double thrustUp;
57 double noThrust; 57 double noThrust;
58 double maxUpThrust; 58 double maxUpThrust;
59 double maxDownThrust; 59 double maxDownThrust;
60 60
61 int gateDistance; 61 int gateDistance;