- }
-
- // If it's game over, show the game over graphic in the dead centre
- switch (state) {
-
- case GAME_OVER:
-
- if (fadetimer<3.0/faderate)
- fadegame=fadetimer/(3.0/faderate);
- else
- fadegame=1.0;
-
- if (fadetimer<3.0/faderate)
- fadeover=0.0;
- else
- if (fadetimer<6.0/faderate)
- fadeover = ((3.0/faderate)-fadetimer)/(6.0/faderate);
- else
- fadeover = 1.0;
-
- src.w = surf_b_game->w;
- src.h = surf_b_game->h;
- dest.w = src.w;
- dest.h = src.h;
- dest.x = (XSIZE-src.w)/2;
- dest.y = (YSIZE-src.h)/2-40;
- SDL_SetAlpha(surf_b_game, SDL_SRCALPHA, (int)(fadegame*(200+55*cos(fadetimer+=movementrate/1.0))));
- SDL_BlitSurface(surf_b_game,&src,surf_screen,&dest);
-
- src.w = surf_b_over->w;
- src.h = surf_b_over->h;
- dest.w = src.w;
- dest.h = src.h;
- dest.x = (XSIZE-src.w)/2;
- dest.y = (YSIZE-src.h)/2+40;
- SDL_SetAlpha(surf_b_over, SDL_SRCALPHA, (int)(fadeover*(200+55*sin(fadetimer))));
- SDL_BlitSurface(surf_b_over,&src,surf_screen,&dest);
- break;
-
- case TITLE_PAGE:
- src.w = surf_b_rock->w;
- src.h = surf_b_rock->h;
- dest.w = src.w;
- dest.h = src.h;
- dest.x = (XSIZE-src.w)/2 + cos(fadetimer/6.5)*10;
- dest.y = (YSIZE/2-src.h)/2 + sin(fadetimer/5)*10;
- SDL_SetAlpha(surf_b_rock, SDL_SRCALPHA, (int)(200+55*sin(fadetimer+=movementrate/2.0)));
- SDL_BlitSurface(surf_b_rock,&src,surf_screen,&dest);
- src.w = surf_b_dodgers->w;
- src.h = surf_b_dodgers->h;
- dest.w = src.w;
- dest.h = src.h;
- dest.x = (XSIZE-src.w)/2+sin(fadetimer/6.5)*10;
- dest.y = (YSIZE/2-src.h)/2 + surf_b_rock->h + 20 + sin((fadetimer+1)/5)*10;
- SDL_SetAlpha(surf_b_dodgers, SDL_SRCALPHA, (int)(200+55*sin(fadetimer-1.0)));
- SDL_BlitSurface(surf_b_dodgers,&src,surf_screen,&dest);
-
- text = "Version " VERSION;
- x = (XSIZE-SFont_wide(text))/2 + sin(fadetimer/4.5)*10;
- PutString(surf_screen,x,YSIZE-50+sin(fadetimer/2)*5,text);
-
- text = sequence[(int)(fadetimer/40)%NSEQUENCE];
- //text = "Press SPACE to start!";
- x = (XSIZE-SFont_wide(text))/2 + cos(fadetimer/4.5)*10;
- PutString(surf_screen,x,YSIZE-100+cos(fadetimer/3)*5,text);
- break;
-
- case HIGH_SCORE_ENTRY:
-
- if (score >= high[7].score) {
- play_tune(2);
- if (SFont_Input (surf_screen, 330, 50+(scorerank+2)*font_height, 300, name)) {
- // Insert name into high score table
-
- // Lose the lowest name forever (loser!)
- //if (high[7].allocated)
- // free(high[7].name); // THIS WAS CRASHING SO I REMOVED IT
-
- // Insert new high score
- high[scorerank].score = score;
- high[scorerank].name = strdup(name); // MEMORY NEVER FREED!
- high[scorerank].allocated = 1;
-
- // Set the global name string to "", ready for the next winner
- name[0]=0;
-
- // Change state to briefly show high scores page
- state = HIGH_SCORE_DISPLAY;
- state_timeout=200;
-
- // Write the high score table to the file
- write_high_score_table();
-
- // Play the title page tune
- play_tune(0);