summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/gates_game.cpp
Unidiff
Diffstat (limited to 'noncore/games/sfcave-sdl/gates_game.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/gates_game.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/noncore/games/sfcave-sdl/gates_game.cpp b/noncore/games/sfcave-sdl/gates_game.cpp
index 1a9bc89..762801d 100644
--- a/noncore/games/sfcave-sdl/gates_game.cpp
+++ b/noncore/games/sfcave-sdl/gates_game.cpp
@@ -15,12 +15,13 @@ GatesGame :: GatesGame( SFCave *p, int w, int h, int diff )
15 player = new Player( w, h ); 15 player = new Player( w, h );
16 highScore = 0; 16 highScore = 0;
17} 17}
18 18
19GatesGame :: ~GatesGame() 19GatesGame :: ~GatesGame()
20{ 20{
21 // terrain and player get deleted by parent class
21} 22}
22 23
23void GatesGame :: init() 24void GatesGame :: init()
24{ 25{
25 Game :: init(); 26 Game :: init();
26 27
@@ -43,12 +44,25 @@ void GatesGame :: init()
43 player->setMovementInfo( 0.4, 0.6, 4, 5 ); 44 player->setMovementInfo( 0.4, 0.6, 4, 5 );
44 break; 45 break;
45 case MENU_DIFFICULTY_HARD: 46 case MENU_DIFFICULTY_HARD:
46 gapHeight = 25; 47 gapHeight = 25;
47 player->setMovementInfo( 0.6, 0.8, 6, 7 ); 48 player->setMovementInfo( 0.6, 0.8, 6, 7 );
48 break; 49 break;
50 case MENU_DIFFICULTY_CUSTOM:
51 {
52 // Read custom difficulty settings for this game
53 gapHeight = parent->loadIntSetting( "Gates_custom_gapHeight", 75 );
54
55 double thrust = parent->loadDoubleSetting( "Gates_custom_player_thrust", 0.4 );
56 double gravity = parent->loadDoubleSetting( "Gates_custom_player_gravity", 0.6 );
57 double maxUp = parent->loadDoubleSetting( "Gates_custom_player_maxupspeed", 4.0 );
58 double maxDown = parent->loadDoubleSetting( "Gates_custom_player_maxdownspeed", 5.0 );
59 player->setMovementInfo( thrust, gravity, maxUp, maxDown );
60
61 break;
62 }
49 } 63 }
50 64
51 for ( int i = 0 ; i < BLOCKSIZE ; ++i ) 65 for ( int i = 0 ; i < BLOCKSIZE ; ++i )
52 blocks[i].y( -1 ); 66 blocks[i].y( -1 );
53} 67}
54 68
@@ -74,13 +88,12 @@ void GatesGame :: update( int state )
74 nextGate = nrFrames + nextInt( 50 ) + gateDistance; 88 nextGate = nrFrames + nextInt( 50 ) + gateDistance;
75 addGate(); 89 addGate();
76 } 90 }
77 91
78 if ( checkCollisions() ) 92 if ( checkCollisions() )
79 { 93 {
80 // printf( "Crashed!\n" );
81 parent->changeState( STATE_CRASHING ); 94 parent->changeState( STATE_CRASHING );
82 return; 95 return;
83 } 96 }
84 97
85 terrain->moveTerrain( 5 ); 98 terrain->moveTerrain( 5 );
86 moveBlocks( 5 ); 99 moveBlocks( 5 );