From 0a6563fcc2f49857c581d9def24407a3a4ef526c Mon Sep 17 00:00:00 2001 From: andyq Date: Tue, 21 Jan 2003 20:37:00 +0000 Subject: Clean up of code - fixed memory leaks (most of them) and added new custom config menu --- (limited to 'noncore/games/sfcave-sdl/fly_game.cpp') diff --git a/noncore/games/sfcave-sdl/fly_game.cpp b/noncore/games/sfcave-sdl/fly_game.cpp index f5ab401..7605c3f 100644 --- a/noncore/games/sfcave-sdl/fly_game.cpp +++ b/noncore/games/sfcave-sdl/fly_game.cpp @@ -17,6 +17,7 @@ FlyGame :: FlyGame( SFCave *p, int w, int h, int diff ) FlyGame :: ~FlyGame() { + // terrain and player get deleted by parent class } void FlyGame :: init() @@ -34,6 +35,15 @@ void FlyGame :: init() case MENU_DIFFICULTY_HARD: player->setMovementInfo( 0.4, 0.6, 4, 5 ); break; + case MENU_DIFFICULTY_CUSTOM: + { + double thrust = parent->loadDoubleSetting( "Fly_custom_player_thrust", 0.3 ); + double gravity = parent->loadDoubleSetting( "Fly_custom_player_gravity", 0.2 ); + double maxUp = parent->loadDoubleSetting( "Fly_custom_player_maxupspeed", 1.5 ); + double maxDown = parent->loadDoubleSetting( "Fly_custom_player_maxdownspeed", 1.5 ); + player->setMovementInfo( thrust, gravity, maxUp, maxDown ); + break; + } } startScoring = false; @@ -50,7 +60,7 @@ void FlyGame :: update( int state ) { int diff = terrain->getMapBottom( 10 ) - player->getY(); int tmpScore = ((FlyTerrain *)terrain)->getScore( 1, diff ); -// printf( "diff - %d score - %d\n", diff, tmpScore ); + if ( !startScoring ) { if ( tmpScore > 0 ) @@ -69,7 +79,6 @@ void FlyGame :: update( int state ) if ( checkCollisions() ) { -// printf( "Crashed!\n" ); parent->changeState( STATE_CRASHING ); return; } -- cgit v0.9.0.2