summaryrefslogtreecommitdiff
path: root/games/moonlander/files
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2003-06-27 08:37:10 +0000
committerKris Kennaway <kris@FreeBSD.org>2003-06-27 08:37:10 +0000
commit8927235a48d341a00b39faf5ea677de3bdc739cc (patch)
tree17f8e8723b1849bf5904a0963bcc1f20b9dfb748 /games/moonlander/files
parentAdd gtk and orbit dependencies too (for mozilla slave port). (diff)
Moon Lander is a 2D game of gravity. Land your ship on the landing pad.
Don't go too fast, or you will crash. Obtained from: OpenBSD
Notes
Notes: svn path=/head/; revision=83735
Diffstat (limited to 'games/moonlander/files')
-rw-r--r--games/moonlander/files/patch-Makefile36
-rw-r--r--games/moonlander/files/patch-moon_lander_c95
2 files changed, 131 insertions, 0 deletions
diff --git a/games/moonlander/files/patch-Makefile b/games/moonlander/files/patch-Makefile
new file mode 100644
index 000000000000..be81ec3162e7
--- /dev/null
+++ b/games/moonlander/files/patch-Makefile
@@ -0,0 +1,36 @@
+--- Makefile.orig Tue Aug 14 16:28:49 2001
++++ Makefile Thu Jun 26 22:07:33 2003
+@@ -1,26 +1,20 @@
+ # Makefile for test program for game_libs - lunar lander
+-CFLAGS=-Wall `sdl-config --libs --cflags`
+-CC=gcc
++CFLAGS+=`sdl11-config --cflags`
++#CC=gcc
+
+-LIBS=SDL_image
++LIBS=`sdl11-config --libs` -lSDL_image -lSDL_mixer
+
+ C_FILES=moon_lander.c game_lib.c DT_drawtext.c
+ OBJ_FILES=moon_lander.o game_lib.o DT_drawtext.o
+-OUT_FILE=moon-lander.bin
++OUT_FILE=moonlander
+
+ all: game_lib
+
+ game_lib: $(OBJ_FILES)
+- $(CC) $(CFLAGS) -o $(OUT_FILE) $(OBJ_FILES) -l$(LIBS) -lSDL_mixer
++ $(CC) $(CFLAGS) -o $(OUT_FILE) $(OBJ_FILES) $(LIBS)
+
+-moon_lander.o: moon_lander.c
+- $(CC) $(CFLAGS) -c -o $@ $^
+-
+-game_lib.o: game_lib.c
+- $(CC) $(CFLAGS) -c -o $@ $^
+-
+-DT_drawtext.o: DT_drawtext.c
+- $(CC) $(CFLAGS) -c -o $@ $^
++.c.o:
++ $(CC) $(CFLAGS) -c $< -o $@
+
+ clean:
+ rm -f *.o core
diff --git a/games/moonlander/files/patch-moon_lander_c b/games/moonlander/files/patch-moon_lander_c
new file mode 100644
index 000000000000..af69159ce31f
--- /dev/null
+++ b/games/moonlander/files/patch-moon_lander_c
@@ -0,0 +1,95 @@
+--- moon_lander.c.orig Wed Aug 22 13:52:28 2001
++++ moon_lander.c Thu Jun 26 22:23:46 2003
+@@ -20,6 +20,7 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <math.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -37,7 +38,7 @@
+ #define YSIZE 480
+ #define TERRAIN_YSIZE (YSIZE / 2)
+ #define FPS (1000 / 35)
+-#define DATAPATH ""
++#define DATAPATH "%%PREFIX%%/share/moonlander/"
+
+ #define FRESHRUN 0
+ #define GAMEOVER 1
+@@ -175,9 +176,10 @@
+
+ char filename[1024];
+ DIR *dir;
+- struct dirent *files[100];
+- int done = 0;
++ char *bg[100];
++ struct dirent *d;
+ int count = 0;
++ int i;
+
+ /* read images/backgrounds dir and choose a random image from there.
+ * put it's filename in image_file
+@@ -185,27 +187,20 @@
+
+
+
+- sprintf(filename, "%simages/backgrounds", DATAPATH);
++ snprintf(filename, sizeof filename, "%simages/backgrounds", DATAPATH);
+
+ if ( !(dir = opendir(filename)) ){
+ /* error */
+ printf("cannot open dir %s\n", filename);
+ exit(0);
+ }
+-
+- while (!done){
+- if ( files[count] = readdir(dir) ){
+-
+- //printf("I see - %d %s\n", count, files[count]->d_name);
+- count++;
+- }
+- else{
+- done = 1;
+- }
+-
+- if (count > 99) {
+- done = 1;
+- }
++
++ while ( (d = readdir(dir)) != NULL){
++ if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
++ continue;
++ bg[count++] = strdup(d->d_name);
++ if (count >= 100)
++ break;
+ }
+
+ closedir(dir);
+@@ -221,12 +216,12 @@
+
+ game->back_no++;
+
+- if (game->back_no < 2){
+- game->back_no = 2;
++ if (game->back_no < 0){
++ game->back_no = 0;
+ }
+
+ if (game->back_no >= count){
+- game->back_no = 2;
++ game->back_no = 0;
+ }
+
+
+@@ -240,7 +235,9 @@
+
+ //printf("about to get new background: %d\n", game->back_no );
+
+- sprintf(filename, "%simages/backgrounds/%s", DATAPATH, files[game->back_no]->d_name);
++ snprintf(filename, sizeof(filename), "%simages/backgrounds/%s", DATAPATH, bg[game->back_no]);
++ for (i = 0; i < count; i++)
++ free(bg[i]);
+
+ // printf("got %s\n", filename);
+