mode_t g_score_mode;
char *
-load_file(char *filename)
+add_path(char *filename)
{
static char r[MAX_PATH_LEN];
snprintf(r, MAX_PATH_LEN, "%s/%s", g_data_dir, filename);
};
for(i=0; i<3; i++) {
+ if(!data_options[i]) continue;
g_data_dir = strdup(data_options[i]);
if(is_dir(g_data_dir)) return true;
}
int
find_score_file(void)
{
- g_score_file = load_file("scores");
+ g_score_file = add_path("scores");
g_score_mode = 0111;
if(is_file(g_score_file)) return true;
extern char *g_score_file;
extern mode_t g_score_mode;
-char *load_file(char *filename);
+char *add_path(char *filename);
int is_dir(char *dirname);
int is_file(char *filename);
int find_data_dir(void);
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;
}
// 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;
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));
}
+/* Variations on RockDodger
+ * Copyright (C) 2004 Joshua Grams <josh@qualdan.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "config.h"
#include "SFont.h"
// High score table
struct highscore g_scores[N_SCORES] = {
- {13000,"Pad"},
- {12500,"Pad"},
- {6500,"Pad"},
- {5000,"Pad"},
- {3000,"Pad"},
- {2500,"Pad"},
- {2000,"Pad"},
- {1500,"Pad"}
+ {1*60*1000,"-"},
+ {45*1000,"-"},
+ {30*1000,"-"},
+ {20*1000,"-"},
+ {10*1000,"-"},
+ {7*1000,"-"},
+ {5*1000,"-"},
+ {3*1000,"-"}
};
extern SFont_Font *g_font;
Uint16 audio_format;
int audio_channels;
-char *load_file(char *);
+char *add_path(char *);
char *wav_file[] = {
"sounds/booom.wav",
"sounds/cboom.wav",
// Preload all the tunes into memory
for (i=0; i<NUM_TUNES; i++) {
- if (!(music[i] = Mix_LoadMUS(load_file(tune_file[i])))) {
- printf ("Failed to load %s\n",load_file(tune_file[i]));
+ if (!(music[i] = Mix_LoadMUS(add_path(tune_file[i])))) {
+ printf ("Failed to load %s\n",add_path(tune_file[i]));
}
}
// Preload all the wav files into memory
for (i=0; i<NUM_SOUNDS; i++) {
- wav[i] = Mix_LoadWAV(load_file(wav_file[i]));
+ wav[i] = Mix_LoadWAV(add_path(wav_file[i]));
}
return 1;