Now using ~/.vor-scores as our only choice for score file.
(it can get deleted if you put it in with data)
(and locking issues if multiple users on one machine, etc.)
Now passing DATA_PREFIX from Makefile as INSTALL suggests.
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-ldflags := $(shell sdl-config --libs) -lSDL_image -lSDL_mixer
-cflags := $(shell sdl-config --cflags) -Wall -DDEBUG=$(if $(DEBUG),1,0)
-cflags := $(strip $(cflags))
-cflags += $(CFLAGS)
+DATA_PREFIX := /usr/share/vor
+PROGRAM_PREFIX := /usr/games/bin
+
+debug := $(if $(DEBUG),-DDEBUG=1)
+paths := -DDATA_PREFIX=\"$(DATA_PREFIX)\"
+sdl-cflags := $(shell sdl-config --cflags)
+sdl-ldflags := $(shell sdl-config --libs)
+
+ldflags := $(sdl-ldflags) -lSDL_image -lSDL_mixer
+cflags := $(sdl-cflags) $(debug) $(paths) $(CFLAGS)
my_objects := args.o file.o rocks.o score.o shape.o sound.o
my_objects += $(if $(DEBUG),debug.o) main.o
rocks += 20 21 22 23 24 25 26 27 28 29
rocks += 30 31 32 33 34 35 36 37 38 39
rocks += 40 41 42 43 44 45 46 47 48 49
+rocks := $(rocks:%=data/sprites/rock%.png)
+graphics := data/sprites/ship.png data/indicators/life.png $(rocks)
-graphics := data/sprites/ship.png data/indicators/life.png $(rocks:%=data/sprites/rock%.png)
-
-INSTALL = install
-INSTALL_PROGRAM = $(INSTALL) -o games -g games
-INSTALL_DATA = $(INSTALL) -m 644
-
-DATA_PREFIX = /usr/share/vor
-PROGRAM_PREFIX = /usr/games/bin
+INSTALL := install
+INSTALL_PROGRAM := $(INSTALL) -o games -g games
+INSTALL_DATA := $(INSTALL) -m 644
.PHONY: all clean maintainer-clean install uninstall
program: vor
%.o: %.c
- $(CC) $(cflags) -c -o $@ $<
+ @echo compiling $@ from $<
+ @$(CC) $(cflags) -c -o $@ $<
$(my_objects): config.h
main.o file.o: file.h
vor: $(objects)
- $(CC) $(ldflags) -o $@ $^ $(LIBRARIES)
+ @echo linking $@ from $^
+ @$(CC) $(ldflags) -o $@ $^ $(LIBRARIES)
include gfx.mk
#define abs(a) ((a)<=0 ? -(a) : (a))
#endif
+#define CONDERROR(a) if((a)) {initerror = strdup(SDL_GetError());return 1;}
+#define NULLERROR(a) CONDERROR((a) == NULL)
+
+#ifndef DEBUG
+#define DEBUG 0
+#endif
+
+#define debug(x) if(DEBUG) { x; }
+
#endif // VOR_COMMON_H
#ifndef VOR_CONFIG_H
#define VOR_CONFIG_H
-#define debug(x) if(DEBUG) { x; }
-
#define VERSION "0.4pre"
-#define DATA_PREFIX "/usr/share/vor"
// screen size
#define XSIZE 640
#define YSIZE 480
-// number of rock image files.
-#define NROCKS 50
+#define SCREENDXMIN 7.5
+
// image file containing font for score stuff.
#define BIG_FONT_FILE "fonts/score.png"
-#define I_ROCKS 25 // initial/final counts for rocks-on-screen.
+
+
+// -----------------------------------------------------------------------
+// Rocks
+
+// number of rock images
+#define NROCKS 50
+
+// initial/final counts for rocks-on-screen
+#define I_ROCKS 25
#define F_ROCKS 45
-#define SCREENDXMIN 7.5
+// number of rock structs to allocate
+#define MAXROCKS 120
-#define MAXROCKS 120 // MAX Rocks
-#define ROCKRATE 2
#define MAXENGINEDOTS 5000
#define MAXBANGDOTS 50000
#define MAXSPACEDOTS 2000
#define MAXDUSTDEPTH 2
#define W 100
#define M 255
-#define BLAST_RADIUS 300 // radius^2 (pixels) which will be cleared of rocks when you die
+
+// radius^2 (pixels) which will be cleared of rocks when you die
+#define BLAST_RADIUS 300
#define DEAD_PAUSE_LENGTH 40.0
#define MAX_PATH_LEN 1024
-#ifndef true
-#define true 1
-#endif
-
-#ifndef false
-#define false 0
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define CONDERROR(a) if((a)) {initerror = strdup(SDL_GetError());return 1;}
-#define NULLERROR(a) CONDERROR((a) == NULL)
-
#endif // VOR_CONFIG_H
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "config.h"
-#include "file.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
+#include "common.h"
+#include "config.h"
+#include "file.h"
+
char *g_data_dir;
char *g_score_file;
mode_t g_score_mode;
int
find_score_file(void)
{
- g_score_file = add_path("scores");
- g_score_mode = 0111;
- if(is_file(g_score_file)) {
- g_score_file = strdup(g_score_file);
- return true;
- }
-
g_score_file = malloc(MAX_PATH_LEN);
snprintf(g_score_file, MAX_PATH_LEN,
- "%s/.vor-high", getenv("HOME"));
+ "%s/.vor-scores", getenv("HOME"));
g_score_mode = 0177;
if(is_file(g_score_file)) return true;
#include <stdlib.h>
#include <string.h>
+#include "common.h"
#include "config.h"
#include "file.h"
#include "globals.h"
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "config.h"
-
-#include "SFont.h"
-#include "file.h"
-#include "score.h"
-
#include <SDL.h>
#include <SDL_keysym.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include "SFont.h"
+
+#include "common.h"
+#include "config.h"
+#include "file.h"
+#include "score.h"
+
// High score table
struct highscore g_scores[N_SCORES] = {
{1*60*1000,"-"},
+#include <SDL/SDL.h>
+#include <SDL/SDL_mixer.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
#include "args.h"
-#include "sound.h"
+#include "common.h"
#include "config.h"
+#include "sound.h"
#define TUNE_TITLE_PAGE 0
#define TUNE_GAMEPLAY 1
#ifndef VOR_SOUND_H
#define VOR_SOUND_H
-#include <SDL/SDL.h>
-#include <SDL/SDL_mixer.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
int init_sound(void);
void play_sound(int i);
void play_tune(int i);