author | andyq <andyq> | 2003-01-21 20:37:00 (UTC) |
---|---|---|
committer | andyq <andyq> | 2003-01-21 20:37:00 (UTC) |
commit | 0a6563fcc2f49857c581d9def24407a3a4ef526c (patch) (side-by-side diff) | |
tree | f1b82a4bd7582ef2cb722cffb87eecff1e1f96e6 /noncore/games/sfcave-sdl/gates_game.cpp | |
parent | 50b5915b48fc5cbacf23e4d2b75d7a266f141a4a (diff) | |
download | opie-0a6563fcc2f49857c581d9def24407a3a4ef526c.zip opie-0a6563fcc2f49857c581d9def24407a3a4ef526c.tar.gz opie-0a6563fcc2f49857c581d9def24407a3a4ef526c.tar.bz2 |
Clean up of code - fixed memory leaks (most of them) and added new custom config menu
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.cpp | 15 |
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 ) player = new Player( w, h ); highScore = 0; } GatesGame :: ~GatesGame() { + // terrain and player get deleted by parent class } void GatesGame :: init() { Game :: init(); @@ -43,12 +44,25 @@ void GatesGame :: init() player->setMovementInfo( 0.4, 0.6, 4, 5 ); break; case MENU_DIFFICULTY_HARD: gapHeight = 25; player->setMovementInfo( 0.6, 0.8, 6, 7 ); break; + case MENU_DIFFICULTY_CUSTOM: + { + // Read custom difficulty settings for this game + gapHeight = parent->loadIntSetting( "Gates_custom_gapHeight", 75 ); + + double thrust = parent->loadDoubleSetting( "Gates_custom_player_thrust", 0.4 ); + double gravity = parent->loadDoubleSetting( "Gates_custom_player_gravity", 0.6 ); + double maxUp = parent->loadDoubleSetting( "Gates_custom_player_maxupspeed", 4.0 ); + double maxDown = parent->loadDoubleSetting( "Gates_custom_player_maxdownspeed", 5.0 ); + player->setMovementInfo( thrust, gravity, maxUp, maxDown ); + + break; + } } for ( int i = 0 ; i < BLOCKSIZE ; ++i ) blocks[i].y( -1 ); } @@ -74,13 +88,12 @@ void GatesGame :: update( int state ) nextGate = nrFrames + nextInt( 50 ) + gateDistance; addGate(); } if ( checkCollisions() ) { -// printf( "Crashed!\n" ); parent->changeState( STATE_CRASHING ); return; } terrain->moveTerrain( 5 ); moveBlocks( 5 ); |