Diffstat (limited to 'noncore/games/sfcave-sdl/game.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/sfcave-sdl/game.cpp | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/noncore/games/sfcave-sdl/game.cpp b/noncore/games/sfcave-sdl/game.cpp index a644696..e41e510 100644 --- a/noncore/games/sfcave-sdl/game.cpp +++ b/noncore/games/sfcave-sdl/game.cpp @@ -77,7 +77,4 @@ void Game :: handleKeys( SDL_KeyboardEvent &key ) replayList.push_back( nrFrames ); press = true; - -// if ( thrustChannel == -1 && parent->getState() == STATE_PLAYING ) -// thrustChannel = SoundHandler :: playSound( SND_THRUST, -1, -1, false ); } else @@ -87,9 +84,4 @@ void Game :: handleKeys( SDL_KeyboardEvent &key ) press = false; - if ( thrustChannel != -1 ) - { -// SoundHandler :: stopSound( thrustChannel, true, 300 ); -// thrustChannel = -1; - } } } @@ -98,7 +90,7 @@ void Game :: handleKeys( SDL_KeyboardEvent &key ) -QString Game :: getGameDifficultyText() +string Game :: getGameDifficultyText() { - QString ret; + string ret; if ( difficulty == MENU_DIFFICULTY_EASY ) @@ -108,4 +100,6 @@ QString Game :: getGameDifficultyText() else if ( difficulty == MENU_DIFFICULTY_HARD ) ret = "Hard"; + else if ( difficulty == MENU_DIFFICULTY_CUSTOM ) + ret = "Custom"; return ret; @@ -120,4 +114,14 @@ void Game :: setDifficulty( string diff ) else if ( diff == "Hard" ) difficulty = MENU_DIFFICULTY_HARD; + else if ( diff == "Custom" ) + difficulty = MENU_DIFFICULTY_CUSTOM; + + init(); +} + +void Game :: setDifficulty( int diff ) +{ + difficulty = diff; + init(); } @@ -167,12 +171,11 @@ void Game :: draw( SDL_Surface *screen ) { char tmp[100]; - QString scoreText; + string scoreText; sprintf( tmp, "Score: %06ld High Score: %06ld", score, highScore ); -// printf( "%s\n", (const char *)scoreText ); FontHandler::draw( screen, FONT_WHITE_TEXT, tmp, 3, 10 ); if ( parent->getState() == STATE_CRASHED ) { - QString crashText; + string crashText; crashText = "Game Over"; int x = (240 - FontHandler::TextWidth( FONT_WHITE_TEXT, (const char *)crashText.c_str() )) / 2; @@ -224,5 +227,5 @@ void Game :: setSeed( int seed ) } -void Game :: saveReplay( QString file ) +void Game :: saveReplay( string file ) { FILE *out; @@ -237,5 +240,5 @@ void Game :: saveReplay( QString file ) // Build up string of values // Format is:: <landscape seed> <game type> <difficulty> <framenr> <framenr>....... - QString val; + string val; char tmp[20]; sprintf( tmp, "%d %d ", currentSeed, difficulty ); @@ -252,5 +255,5 @@ void Game :: saveReplay( QString file ) val += "\n"; - QString line; + string line; sprintf( tmp, "%d\n", val.length() ); line = tmp; @@ -260,10 +263,7 @@ void Game :: saveReplay( QString file ) fclose( out ); - - printf( "Replay saved to %s\n", (const char *)file.c_str() ); - } -void Game :: loadReplay( QString file ) +void Game :: loadReplay( string file ) { @@ -286,7 +286,6 @@ void Game :: loadReplay( QString file ) fread( data, 1, length, in ); -// printf( "data - %s", data ); - QString sep = " "; + string sep = " "; StringTokenizer st( data, sep ); @@ -309,7 +308,4 @@ void Game :: loadReplay( QString file ) fclose( in ); - - printf( "Replay loaded from %s\n", (const char *)file.c_str() ); - } |