JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
kowtowing to the compiler
[vor.git] / main.c
diff --git a/main.c b/main.c
index e06a010..ab97cbc 100644 (file)
--- a/main.c
+++ b/main.c
@@ -107,12 +107,11 @@ struct spacedot sdot[MAXSPACEDOTS];
 // Other global variables
 char topline[1024];
 char *initerror = "";
-char name[1024], debug1[1024];
 
 float xship,yship = 240.0;     // X position, 0..XSIZE
 float xvel,yvel;       // Change in X position per tick.
 float rockrate,rockspeed;
-float movementrate;
+float movementrate;  // this controls the speed of everything that moves.
 float yscroll;
 float scrollvel;
 
@@ -123,30 +122,24 @@ int maneuver = 0;
 int sound_flag = 1, music_flag = 0;
 int tail_plume = 0; // display big engine at the back?
 int friction = 0;      // should there be friction?
-int scorerank;
-float fadetimer = 0,faderate;
+float fadetimer = 0, faderate;
 
-int pausedown = 0,paused = 0;
+int pausedown = 0, paused = 0;
 
 // bangdot start (bd1) and end (bd2) position:
 int bd1 = 0, bd2 = 0;
 
-int xoffset[NROCKS][MAXROCKHEIGHT];
-
 enum states {
        TITLE_PAGE,
        GAMEPLAY,
        DEAD_PAUSE,
        GAME_OVER,
        HIGH_SCORE_ENTRY,
-       HIGH_SCORE_DISPLAY,
-       DEMO
+       HIGH_SCORE_DISPLAY
 };
 enum states state = TITLE_PAGE;
 float state_timeout = 600.0;
 
-const int fakesin[] = {0,1,0,-1};
-const int fakecos[] = {1,0,-1,0};
 #define NSEQUENCE 2
 char *sequence[] = {
        "Press SPACE to start",
@@ -386,7 +379,7 @@ create_engine_dots2(int newdots, int m) {
 
        // Don't create fresh engine dots when
        // the game is not being played and a demo is not beng shown
-       if(state != GAMEPLAY && state != DEMO) return;
+       if(state != GAMEPLAY) return;
 
        for(i = 0; i<newdots; i++) {
                if(dotptr->active == 0) {
@@ -523,30 +516,30 @@ init(int fullscreen) {
        }
 
        // Load the banners
-       NULLERROR(temp = IMG_Load(load_file("banners/variations.png")));
+       NULLERROR(temp = IMG_Load(add_path("banners/variations.png")));
        NULLERROR(surf_b_variations = SDL_DisplayFormat(temp));
 
-       NULLERROR(temp = IMG_Load(load_file("banners/on.png")));
+       NULLERROR(temp = IMG_Load(add_path("banners/on.png")));
        NULLERROR(surf_b_on = SDL_DisplayFormat(temp));
 
-       NULLERROR(temp = IMG_Load(load_file("banners/rockdodger.png")));
+       NULLERROR(temp = IMG_Load(add_path("banners/rockdodger.png")));
        NULLERROR(surf_b_rockdodger = SDL_DisplayFormat(temp));
 
-       NULLERROR(temp = IMG_Load(load_file("banners/game.png")));
+       NULLERROR(temp = IMG_Load(add_path("banners/game.png")));
        NULLERROR(surf_b_game = SDL_DisplayFormat(temp));
 
-       NULLERROR(temp = IMG_Load(load_file("banners/over.png")));
+       NULLERROR(temp = IMG_Load(add_path("banners/over.png")));
        NULLERROR(surf_b_over = SDL_DisplayFormat(temp));
 
-       surf_font_big = IMG_Load(load_file(BIG_FONT_FILE));
+       surf_font_big = IMG_Load(add_path(BIG_FONT_FILE));
        g_font = SFont_InitFont(surf_font_big);
 
        // Load the spaceship graphic.
-       NULLERROR(temp = IMG_Load(load_file("sprites/ship.png")));
+       NULLERROR(temp = IMG_Load(add_path("sprites/ship.png")));
        NULLERROR(surf_ship = SDL_DisplayFormat(temp));
 
        // Load the life indicator (small ship) graphic.
-       NULLERROR(temp = IMG_Load(load_file("indicators/life.png")));
+       NULLERROR(temp = IMG_Load(add_path("indicators/life.png")));
        NULLERROR(surf_life = SDL_DisplayFormat(temp));
 
        // Create the array of black points;
@@ -571,11 +564,11 @@ init(int fullscreen) {
        for(i = 0; i<NROCKS; i++) {
                char a[100];
 
-               sprintf(a,load_file("sprites/rock%d.png"),i);
+               sprintf(a,add_path("sprites/rock%d.png"),i);
                NULLERROR(temp = IMG_Load(a));
                NULLERROR(surf_rock[i] = SDL_DisplayFormat(temp));
 
-               sprintf(a,load_file("sprites/deadrock%d.png"),i);
+               sprintf(a,add_path("sprites/deadrock%d.png"),i);
                NULLERROR(temp = IMG_Load(a));
                NULLERROR(surf_deadrock[i] = SDL_DisplayFormat(temp));
        }
@@ -612,7 +605,7 @@ draw() {
        drawdots(surf_screen);
 
        // Draw ship
-       if(!gameover && (state == GAMEPLAY || state == DEMO) ) {
+       if(!gameover && state == GAMEPLAY ) {
                src.w = surf_ship->w;
                src.h = surf_ship->h;
                dest.w = src.w;
@@ -732,7 +725,9 @@ draw() {
                case HIGH_SCORE_DISPLAY:
                        // Display de list o high scores mon.
                        display_scores(surf_screen, 150,50);
-
+               case GAMEPLAY:
+               case DEAD_PAUSE:
+                       ; // no action necessary
        }
 
        if(!gameover && state == GAMEPLAY) {
@@ -833,7 +828,9 @@ gameloop() {
                                        case TITLE_PAGE:
                                                state = HIGH_SCORE_DISPLAY;
                                                state_timeout = 200.0;
-                                       break;
+                                               break;
+                                       case GAMEPLAY:
+                                               ; // no action necessary
                                }
                        } else {
                                if(state == DEAD_PAUSE) {
@@ -962,7 +959,7 @@ gameloop() {
                                return 0;
                        }
 
-                       if(keystate[SDLK_SPACE] && (state == HIGH_SCORE_DISPLAY || state == TITLE_PAGE || state == DEMO)) {
+                       if(keystate[SDLK_SPACE] && (state == HIGH_SCORE_DISPLAY || state == TITLE_PAGE)) {
 
                                for(i = 0; i<MAXROCKS; i++ ) {
                                        rock[i].active = 0;