diff options
author | B. Watson <yalhcru@gmail.com> | 2014-09-06 00:41:31 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2014-09-06 00:41:31 +0700 |
commit | eee86e8329d10433ccacf7c939bff2cc28f1d3b6 (patch) | |
tree | c24f729f22aa1db7404182aec16d8a4d48e9da14 /games/wolf4sdl/datadir.diff | |
parent | 3de7a6405c23eea27594f3255572fa60efd1234f (diff) | |
download | slackbuilds-eee86e8329d10433ccacf7c939bff2cc28f1d3b6.tar.gz |
games/wolf4sdl: Added (Wolfenstein 3D engine).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'games/wolf4sdl/datadir.diff')
-rw-r--r-- | games/wolf4sdl/datadir.diff | 312 |
1 files changed, 312 insertions, 0 deletions
diff --git a/games/wolf4sdl/datadir.diff b/games/wolf4sdl/datadir.diff new file mode 100644 index 0000000000..b62ea0be08 --- /dev/null +++ b/games/wolf4sdl/datadir.diff @@ -0,0 +1,312 @@ +diff -Naur Wolf4SDL-1.7-src.orig//Makefile Wolf4SDL-1.7-src/Makefile +--- Wolf4SDL-1.7-src.orig//Makefile 2008-02-18 01:54:38.000000000 -0500 ++++ Wolf4SDL-1.7-src/Makefile 2012-01-13 16:43:43.000000000 -0500 +@@ -17,6 +17,7 @@ + LDFLAGS_SDL ?= $(shell $(SDL_CONFIG) --libs) + + ++CFLAGS += -DPREFIX='"$(PREFIX)"' + CFLAGS += $(CFLAGS_SDL) + + #CFLAGS += -Wall +@@ -64,6 +65,7 @@ + SRCS += wl_play.cpp + SRCS += wl_state.cpp + SRCS += wl_text.cpp ++SRCS += datafile.cpp + + DEPS = $(filter %.d, $(SRCS:.c=.d) $(SRCS:.cpp=.d)) + OBJS = $(filter %.o, $(SRCS:.c=.o) $(SRCS:.cpp=.o)) +diff -Naur Wolf4SDL-1.7-src.orig//datafile.cpp Wolf4SDL-1.7-src/datafile.cpp +--- Wolf4SDL-1.7-src.orig//datafile.cpp 1969-12-31 19:00:00.000000000 -0500 ++++ Wolf4SDL-1.7-src/datafile.cpp 2012-01-13 16:41:32.000000000 -0500 +@@ -0,0 +1,60 @@ ++ ++#include <stdlib.h> ++#include <unistd.h> ++#include <limits.h> ++#include <stdio.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <fcntl.h> ++ ++#include "datafile.h" ++ ++static char *datapath = NULL; ++ ++static void set_data_path(void) { ++ if(datapath) return; ++ datapath = getenv("WOLF4PATH"); ++ if(datapath) return; ++ ++ // 20120113 bkw: should this be "C:\\WOLF3D" on Windows? ++ datapath = (char *)PREFIX "/share/games/wolf3d"; ++} ++ ++int datafile_exists(const char *file) { ++ char datafile[PATH_MAX]; ++ struct stat statbuf; ++ ++ set_data_path(); ++ ++ if(stat(file, &statbuf)) ++ return 1; ++ ++ sprintf(datafile, "%s/%s", datapath, file); ++ return stat(datafile, &statbuf); ++} ++ ++int datafile_open(const char *file, int flags) { ++ char datafile[PATH_MAX]; ++ int handle; ++ ++ set_data_path(); ++ ++ if( (handle = open(file, flags)) > 0 ) ++ return handle; ++ ++ sprintf(datafile, "%s/%s", datapath, file); ++ return open(datafile, flags); ++} ++ ++FILE *datafile_fopen(const char *file, const char *mode) { ++ char datafile[PATH_MAX]; ++ FILE *f; ++ ++ set_data_path(); ++ ++ if( (f = fopen(file, mode)) ) ++ return f; ++ ++ sprintf(datafile, "%s/%s", datapath, file); ++ return fopen(datafile, mode); ++} +diff -Naur Wolf4SDL-1.7-src.orig//datafile.h Wolf4SDL-1.7-src/datafile.h +--- Wolf4SDL-1.7-src.orig//datafile.h 1969-12-31 19:00:00.000000000 -0500 ++++ Wolf4SDL-1.7-src/datafile.h 2012-01-13 16:41:41.000000000 -0500 +@@ -0,0 +1,22 @@ ++ ++#include <stdio.h> ++/* ++20120113 bkw: ++Functions for loading game data files. ++ ++All these functions search for files in: ++ ++- The current directory ++- The directory specified by $WOLF4PATH if set ++- If WOLF4PATH not set, fall back to PREFIX/share/games/wolf3d ++ ++*/ ++ ++/* returns true if file exists in the data path, otherwise false */ ++int datafile_exists(const char *file); ++ ++/* returns a filehandle to the file if found, or -1 if not */ ++int datafile_open(const char *file, int flags); ++ ++/* returns a FILE* if found, or NULL if not */ ++FILE *datafile_fopen(const char *file, const char *mode); +diff -Naur Wolf4SDL-1.7-src.orig//id_ca.cpp Wolf4SDL-1.7-src/id_ca.cpp +--- Wolf4SDL-1.7-src.orig//id_ca.cpp 2009-02-24 15:13:22.000000000 -0500 ++++ Wolf4SDL-1.7-src/id_ca.cpp 2012-01-13 16:40:25.000000000 -0500 +@@ -24,6 +24,7 @@ + #include <unistd.h> + #endif + ++#include "datafile.h" + #include "wl_def.h" + #pragma hdrstop + +@@ -185,7 +186,7 @@ + { + int32_t size; + +- const int handle = open(filename, O_RDONLY | O_BINARY); ++ const int handle = datafile_open(filename, O_RDONLY | O_BINARY); + if (handle == -1) + return false; + +@@ -463,7 +464,7 @@ + strcpy(fname,gdictname); + strcat(fname,graphext); + +- handle = open(fname, O_RDONLY | O_BINARY); ++ handle = datafile_open(fname, O_RDONLY | O_BINARY); + if (handle == -1) + CA_CannotOpen(fname); + +@@ -474,7 +475,7 @@ + strcpy(fname,gheadname); + strcat(fname,graphext); + +- handle = open(fname, O_RDONLY | O_BINARY); ++ handle = datafile_open(fname, O_RDONLY | O_BINARY); + if (handle == -1) + CA_CannotOpen(fname); + +@@ -513,7 +514,7 @@ + strcpy(fname,gfilename); + strcat(fname,graphext); + +- grhandle = open(fname, O_RDONLY | O_BINARY); ++ grhandle = datafile_open(fname, O_RDONLY | O_BINARY); + if (grhandle == -1) + CA_CannotOpen(fname); + +@@ -555,7 +556,7 @@ + strcpy(fname,mheadname); + strcat(fname,extension); + +- handle = open(fname, O_RDONLY | O_BINARY); ++ handle = datafile_open(fname, O_RDONLY | O_BINARY); + if (handle == -1) + CA_CannotOpen(fname); + +@@ -574,14 +575,14 @@ + strcpy(fname, "gamemaps."); + strcat(fname, extension); + +- maphandle = open(fname, O_RDONLY | O_BINARY); ++ maphandle = datafile_open(fname, O_RDONLY | O_BINARY); + if (maphandle == -1) + CA_CannotOpen(fname); + #else + strcpy(fname,mfilename); + strcat(fname,extension); + +- maphandle = open(fname, O_RDONLY | O_BINARY); ++ maphandle = datafile_open(fname, O_RDONLY | O_BINARY); + if (maphandle == -1) + CA_CannotOpen(fname); + #endif +@@ -646,7 +647,7 @@ + strcpy(fname,afilename); + strcat(fname,audioext); + +- audiohandle = open(fname, O_RDONLY | O_BINARY); ++ audiohandle = datafile_open(fname, O_RDONLY | O_BINARY); + if (audiohandle == -1) + CA_CannotOpen(fname); + } +diff -Naur Wolf4SDL-1.7-src.orig//id_pm.cpp Wolf4SDL-1.7-src/id_pm.cpp +--- Wolf4SDL-1.7-src.orig//id_pm.cpp 2008-05-25 04:40:50.000000000 -0400 ++++ Wolf4SDL-1.7-src/id_pm.cpp 2012-01-13 16:42:23.000000000 -0500 +@@ -1,3 +1,4 @@ ++#include "datafile.h" + #include "wl_def.h" + + int ChunksInFile; +@@ -19,7 +20,7 @@ + char fname[13] = "vswap."; + strcat(fname,extension); + +- FILE *file = fopen(fname,"rb"); ++ FILE *file = datafile_fopen(fname,"rb"); + if(!file) + CA_CannotOpen(fname); + +diff -Naur Wolf4SDL-1.7-src.orig//wl_menu.cpp Wolf4SDL-1.7-src/wl_menu.cpp +--- Wolf4SDL-1.7-src.orig//wl_menu.cpp 2010-11-01 13:17:58.000000000 -0400 ++++ Wolf4SDL-1.7-src/wl_menu.cpp 2012-01-13 16:55:02.000000000 -0500 +@@ -14,6 +14,7 @@ + #include <unistd.h> + #endif + ++#include "datafile.h" + #include "wl_def.h" + #pragma hdrstop + +@@ -4029,12 +4030,12 @@ + // + #ifdef JAPAN + #ifdef JAPDEMO +- if(!stat("vswap.wj1", &statbuf)) ++ if(datafile_exists("vswap.wj1")) + { + strcpy (extension, "wj1"); + numEpisodesMissing = 5; + #else +- if(!stat("vswap.wj6", &statbuf)) ++ if(datafile_exists("vswap.wj6")) + { + strcpy (extension, "wj6"); + #endif +@@ -4052,7 +4053,7 @@ + // ENGLISH + // + #ifdef UPLOAD +- if(!stat("vswap.wl1", &statbuf)) ++ if(datafile_exists("vswap.wl1")) + { + strcpy (extension, "wl1"); + numEpisodesMissing = 5; +@@ -4061,7 +4062,7 @@ + Quit ("NO WOLFENSTEIN 3-D DATA FILES to be found!"); + #else + #ifndef SPEAR +- if(!stat("vswap.wl6", &statbuf)) ++ if(datafile_exists("vswap.wl6")) + { + strcpy (extension, "wl6"); + NewEmenu[2].active = +@@ -4074,7 +4075,7 @@ + } + else + { +- if(!stat("vswap.wl3", &statbuf)) ++ if(datafile_exists("vswap.wl3")) + { + strcpy (extension, "wl3"); + numEpisodesMissing = 3; +@@ -4082,7 +4083,7 @@ + } + else + { +- if(!stat("vswap.wl1", &statbuf)) ++ if(datafile_exists("vswap.wl1")) + { + strcpy (extension, "wl1"); + numEpisodesMissing = 5; +@@ -4099,28 +4100,28 @@ + #ifndef SPEARDEMO + if(param_mission == 0) + { +- if(!stat("vswap.sod", &statbuf)) ++ if(datafile_exists("vswap.sod")) + strcpy (extension, "sod"); + else + Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!"); + } + else if(param_mission == 1) + { +- if(!stat("vswap.sd1", &statbuf)) ++ if(datafile_exists("vswap.sd1")) + strcpy (extension, "sd1"); + else + Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!"); + } + else if(param_mission == 2) + { +- if(!stat("vswap.sd2", &statbuf)) ++ if(datafile_exists("vswap.sd2")) + strcpy (extension, "sd2"); + else + Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!"); + } + else if(param_mission == 3) + { +- if(!stat("vswap.sd3", &statbuf)) ++ if(datafile_exists("vswap.sd3")) + strcpy (extension, "sd3"); + else + Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!"); +@@ -4130,7 +4131,7 @@ + strcpy (graphext, "sod"); + strcpy (audioext, "sod"); + #else +- if(!stat("vswap.sdm", &statbuf)) ++ if(datafile_exists("vswap.sdm")) + { + strcpy (extension, "sdm"); + } |