mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-24 10:02:29 +01:00
286 lines
7.8 KiB
Diff
286 lines
7.8 KiB
Diff
diff -Naur keen.orig/src/Makefile.lnx keen/src/Makefile.lnx
|
|
--- keen.orig/src/Makefile.lnx 2005-11-09 22:27:50.000000000 -0500
|
|
+++ keen/src/Makefile.lnx 2010-03-26 03:06:24.000000000 -0400
|
|
@@ -31,6 +31,7 @@
|
|
sdl/keydrv.o sdl/snddrv.o sdl/timedrv.o sdl/viddrv.o \
|
|
scale2x/scalebit.o scale2x/scale2x.o scale2x/scale3x.o \
|
|
scale2x/pixel.o \
|
|
+ unix_fopen_wrapper.o \
|
|
keen.h keenext.h sounds.h funcdefs.h latch.h game.h
|
|
gcc -g3 -o keen \
|
|
main.o fileio.o \
|
|
@@ -51,6 +52,7 @@
|
|
sdl/keydrv.o sdl/snddrv.o sdl/timedrv.o sdl/viddrv.o \
|
|
scale2x/scalebit.o scale2x/scale2x.o scale2x/scale3x.o \
|
|
scale2x/pixel.o \
|
|
+ unix_fopen_wrapper.o \
|
|
`sdl-config --libs`
|
|
|
|
|
|
diff -Naur keen.orig/src/keen.h keen/src/keen.h
|
|
--- keen.orig/src/keen.h 2005-11-07 16:39:12.000000000 -0500
|
|
+++ keen/src/keen.h 2010-03-26 03:06:24.000000000 -0400
|
|
@@ -14,6 +14,10 @@
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
+#ifdef TARGET_LNX
|
|
+ #include "unix_fopen_wrapper.h"
|
|
+#endif
|
|
+
|
|
#include "sounds.h"
|
|
#include "funcdefs.h"
|
|
#include "latch.h"
|
|
diff -Naur keen.orig/src/main.c keen/src/main.c
|
|
--- keen.orig/src/main.c 2005-11-09 23:35:10.000000000 -0500
|
|
+++ keen/src/main.c 2010-03-26 03:11:56.000000000 -0400
|
|
@@ -75,7 +75,7 @@
|
|
|
|
char loadinggame, loadslot;
|
|
|
|
-FILE *log=NULL;
|
|
+/* FILE *log=NULL; */
|
|
|
|
stFade fade;
|
|
stMap map;
|
|
@@ -161,7 +161,7 @@
|
|
SetDefaultOptions();
|
|
setoption(OPT_FULLSCREEN, "SDL Fullscreen Mode", 0);
|
|
setoption(OPT_ZOOM, "Image Zoom", 1);
|
|
- setoption(OPT_FRAMESKIP, "Frameskip", 2);
|
|
+ setoption(OPT_FRAMESKIP, "Frameskip", 1);
|
|
|
|
/* process command line options */
|
|
VidDrv_printf("Processing command-line options.\n");
|
|
@@ -180,6 +180,7 @@
|
|
{
|
|
numplayers = 2;
|
|
}
|
|
+ /*
|
|
else if (strcmp(tempbuf, "-3player")==0)
|
|
{
|
|
numplayers = 3;
|
|
@@ -188,6 +189,7 @@
|
|
{
|
|
numplayers = 4;
|
|
}
|
|
+ */
|
|
else if (strcmp(tempbuf, "-single")==0)
|
|
{
|
|
numplayers = 1;
|
|
@@ -240,6 +242,7 @@
|
|
{
|
|
showfps = 1;
|
|
}
|
|
+ /*
|
|
else if (strcmp(tempbuf, "-host")==0) // start network server
|
|
{
|
|
is_server = 1;
|
|
@@ -250,6 +253,7 @@
|
|
is_client = 1;
|
|
localmp = 0;
|
|
}
|
|
+ */
|
|
else if (i!=1 || atoi(argv[i])==0)
|
|
{
|
|
VidDrv_printf("Wait a minute...what the hell does '%s' mean?\n",tempbuf);
|
|
diff -Naur keen.orig/src/misc.c keen/src/misc.c
|
|
--- keen.orig/src/misc.c 2005-11-16 20:04:28.000000000 -0500
|
|
+++ keen/src/misc.c 2010-03-26 03:15:46.000000000 -0400
|
|
@@ -1103,7 +1103,7 @@
|
|
{
|
|
VidDrv_printf("Usage: keen [lvlnum] [-*player] [-nopk] [-ep*] [-dtm] [-nocheat] [-rec] -[eseq]\n\n");
|
|
VidDrv_printf("lvlnum specify a level number (such as 2) to go directly to that level\n");
|
|
- VidDrv_printf("-*player select number of players (1-4); defaults to 1\n");
|
|
+ VidDrv_printf("-*player select number of players (1-2); defaults to 1\n");
|
|
VidDrv_printf("-nopk do not allow players to kill each other in multiplayer games\n");
|
|
VidDrv_printf("-ep* select episode 1, 2, or 3; defaults to 1\n");
|
|
VidDrv_printf("-dtm go directly to the world map, bypassing intro and title screen\n");
|
|
diff -Naur keen.orig/src/sdl/viddrv.c keen/src/sdl/viddrv.c
|
|
--- keen.orig/src/sdl/viddrv.c 2005-11-16 20:08:30.000000000 -0500
|
|
+++ keen/src/sdl/viddrv.c 2010-03-26 03:06:24.000000000 -0400
|
|
@@ -29,8 +29,10 @@
|
|
|
|
SDL_Rect dstrect;
|
|
|
|
+#ifndef TARGET_LNX
|
|
extern FILE *log;
|
|
#define CKLOGFILENAME "ck.log"
|
|
+#endif
|
|
|
|
#define MAX_CONSOLE_MESSAGES 3
|
|
#define CONSOLE_MESSAGE_X 3
|
|
@@ -222,11 +224,11 @@
|
|
// applies all changes to the palette made with pal_set
|
|
void pal_apply(void)
|
|
{
|
|
- SDL_SetColors(screen, &MyPalette, 0, 256);
|
|
- SDL_SetColors(ScrollSurface, &MyPalette, 0, 256);
|
|
+ SDL_SetColors(screen, MyPalette, 0, 256);
|
|
+ SDL_SetColors(ScrollSurface, MyPalette, 0, 256);
|
|
if (blitsurface_alloc)
|
|
{
|
|
- SDL_SetColors(BlitSurface, &MyPalette, 0, 256);
|
|
+ SDL_SetColors(BlitSurface, MyPalette, 0, 256);
|
|
}
|
|
}
|
|
|
|
@@ -338,9 +340,9 @@
|
|
// shuts down the video driver
|
|
void VidDrv_Stop(void)
|
|
{
|
|
- if(screen) { SDL_FreeSurface(screen); VidDrv_printf("freed screen\n"); }
|
|
- if(ScrollSurface) { SDL_FreeSurface(ScrollSurface); VidDrv_printf("freed scrollsurface\n"); }
|
|
- if(blitsurface_alloc) { blitsurface_alloc = 0; SDL_FreeSurface(BlitSurface); VidDrv_printf("freed blitsurface\n"); }
|
|
+ if(screen) { SDL_FreeSurface(screen); screen = NULL; VidDrv_printf("freed screen\n"); }
|
|
+ if(ScrollSurface) { SDL_FreeSurface(ScrollSurface); ScrollSurface = NULL; VidDrv_printf("freed scrollsurface\n"); }
|
|
+ if(blitsurface_alloc) { blitsurface_alloc = 0; SDL_FreeSurface(BlitSurface); BlitSurface = NULL; VidDrv_printf("freed blitsurface\n"); }
|
|
}
|
|
|
|
// resets graphics to allow changing of resolution or zoom settings
|
|
@@ -365,10 +367,12 @@
|
|
// SDL-specific, not win32-specific)
|
|
void VidDrv_InitConsole(void)
|
|
{
|
|
+#ifndef TARGET_LNX
|
|
FILE *fp;
|
|
// erase contents of log file
|
|
fp = fopen(CKLOGFILENAME, "wb");
|
|
fclose(fp);
|
|
+#endif
|
|
}
|
|
|
|
void VidDrv_printf(const char *str, ...)
|
|
diff -Naur keen.orig/src/unix_fopen_wrapper.c keen/src/unix_fopen_wrapper.c
|
|
--- keen.orig/src/unix_fopen_wrapper.c 1969-12-31 19:00:00.000000000 -0500
|
|
+++ keen/src/unix_fopen_wrapper.c 2010-03-26 03:06:24.000000000 -0400
|
|
@@ -0,0 +1,123 @@
|
|
+
|
|
+/* semi-case-insensitive fopen() replacement.
|
|
+
|
|
+Usage:
|
|
+
|
|
+#include "unix_fopen_wrapper.h"
|
|
+FILE *foo = fopen("bar.baz", "rb");
|
|
+
|
|
+fopen() gets redefined to unix_fopen() in the header file.
|
|
+unix_fopen() attempts to call the real fopen() on:
|
|
+
|
|
+bar.baz
|
|
+BAR.baz
|
|
+Bar.baz
|
|
+bar.BAZ
|
|
+BAR.BAZ
|
|
+Bar.BAZ
|
|
+bar.Baz
|
|
+BAR.Baz
|
|
+Bar.Baz
|
|
+
|
|
+It'll still miss e.g. baR.baz or bAr.baz
|
|
+
|
|
+If there's no . in the filename (e.g. "bar"), just check
|
|
+for bar, BAR, Bar
|
|
+*/
|
|
+
|
|
+#include <stdio.h>
|
|
+#include <ctype.h>
|
|
+#include <string.h>
|
|
+#include <limits.h>
|
|
+
|
|
+void lcase_all(char *c) {
|
|
+ if(!c || !*c) return;
|
|
+ while(*c && *c != '.') {
|
|
+ *c = tolower(*c);
|
|
+ c++;
|
|
+ }
|
|
+}
|
|
+
|
|
+void ucase_all(char *c) {
|
|
+ if(!c || !*c) return;
|
|
+ while(*c && *c != '.') {
|
|
+ *c = toupper(*c);
|
|
+ c++;
|
|
+ }
|
|
+}
|
|
+
|
|
+void ucase_first(char *c) {
|
|
+ if(!c || !*c) return;
|
|
+ lcase_all(c);
|
|
+ c[0] = toupper(c[0]);
|
|
+}
|
|
+
|
|
+FILE *unix_fopen(const char *path, const char *mode) {
|
|
+ FILE *result;
|
|
+ char realpath[PATH_MAX], *name, *ext;
|
|
+
|
|
+/* #define DEBUG_FOPEN */
|
|
+
|
|
+#ifdef DEBUG_FOPEN
|
|
+#define TRY_FOPEN(p, m) { \
|
|
+ result = fopen(p, m); \
|
|
+ fprintf(stderr, "-- %s:%d: (%s,%s): %s\n", \
|
|
+ __FILE__, __LINE__, p, m, (result ? "OK" : "fail")); \
|
|
+ if(result) return result; \
|
|
+}
|
|
+#else
|
|
+#define TRY_FOPEN(p, m) { if( (result = fopen(p, m)) ) return result; }
|
|
+#endif
|
|
+
|
|
+ /* try it as-is first */
|
|
+ TRY_FOPEN(path, mode);
|
|
+
|
|
+ /* parse into name and (possible) extension */
|
|
+ strcpy(realpath, path);
|
|
+ ext = strrchr(realpath, '.');
|
|
+ if(ext) {
|
|
+ ++ext;
|
|
+ if(!ext[0]) ext = NULL;
|
|
+ }
|
|
+
|
|
+ /* skip any directory component(s) */
|
|
+ name = strrchr(realpath, '/');
|
|
+ if(!name) name = realpath;
|
|
+
|
|
+ /* permutations... */
|
|
+ lcase_all(ext);
|
|
+ lcase_all(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+ ucase_all(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+ ucase_first(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+ ucase_all(ext);
|
|
+ lcase_all(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+ ucase_all(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+ ucase_first(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+ ucase_first(ext);
|
|
+ lcase_all(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+ ucase_all(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+ ucase_first(name);
|
|
+ TRY_FOPEN(realpath, mode);
|
|
+
|
|
+#ifdef DEBUG_FOPEN
|
|
+ fprintf(stderr, "%s:%s: TRY_FOPEN(%s,%s): Giving up",
|
|
+ __FILE__, __LINE__, path, mode);
|
|
+#endif
|
|
+ return NULL;
|
|
+}
|
|
diff -Naur keen.orig/src/unix_fopen_wrapper.h keen/src/unix_fopen_wrapper.h
|
|
--- keen.orig/src/unix_fopen_wrapper.h 1969-12-31 19:00:00.000000000 -0500
|
|
+++ keen/src/unix_fopen_wrapper.h 2010-03-26 03:06:24.000000000 -0400
|
|
@@ -0,0 +1,2 @@
|
|
+FILE *unix_fopen(const char *path, const char *mode);
|
|
+#define fopen(x,y) unix_fopen(x,y)
|