games/clonekeen: Updated for version 8.4.

Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
This commit is contained in:
B. Watson 2010-12-26 21:09:09 -02:00 committed by Niels Horn
parent 1ec5fa4322
commit e67673320e
7 changed files with 39 additions and 403 deletions

View file

@ -1,5 +1,3 @@
clonekeen (open source engine for id Software's Commander Keen game)
CloneKeen is an open-source clone of ID's classic DOS game Commander
Keen. CloneKeen runs under many platforms including Linux & win32. There
are some improvements over the original such as 2-player support. Original
@ -10,12 +8,9 @@ clonekeen is able to run Commander Keen episodes 1, 2, and 3. Episodes
files from the game installation directory to /usr/share/games/clonekeen
Optionally, the package can include the shareware (episode 1) game data
files. To do this, download 1keen.zip:
files.
ftp://ftp.3drealms.com/share/1keen.zip
...and place it in the directory where the SlackBuild script is. Also
you must install libdynamite (available from SBo), since it's required
You must install libdynamite (available from SBo), since it's required
to extract the game data. After running the SlackBuild script, the
resulting package can be installed on a system without libdynamite
(it's only required at build time). The extractor may also be useful

View file

@ -4,8 +4,6 @@ clonekeen \- Clone of id Software's "Commander Keen" game
.br
.SH SYNOPSIS
.B clonekeen
[\fIwarplevel\fR]
[\fIOPTIONS\fR]
.SH DESCRIPTION
CloneKeen is an almost almost complete open\-source clone of
the old classic DOS game, \fICommander Keen: Invasion of the
@ -19,47 +17,11 @@ including smoother scrolling, better graphic effects
in some parts of the game, and 2\-player support.
.PP
See story.txt for a description of the game's plot.
.SH OPTIONS
.TP
\fBwarplevel\fR
specify a level number (such as 2) to go directly to that level. This option
must be given first. Example: \fBclonekeen 1 \-fs\fR to start the game on
level 1 in fullscreen mode.
.TP
\fB\-1player\fR, \fB\-2player\fR
select number of players (1\-2); defaults to 1. This is local multiplayer,
with 2 players using the same keyboard (there is no network play).
.TP
\fB\-nopk\fR
do not allow players to kill each other in multiplayer games
.TP
\fB\-ep1\fR, \fB\-ep2\fR, \fB\-ep3\fR
select episode 1, 2, or 3; defaults to 1
.TP
\fB\-dtm\fR
go directly to the world map, bypassing intro and title screen
.TP
\fB\-mean\fR
increase game difficulty
.TP
\fB\-cheat\fR
enable function key cheat/debug codes
.TP
\fB\-rec\fR
record player actions to demo.dat for making a demo
.TP
\fB\-eseq\fR
for the impatient\-\-cut directly to the ending sequence
.TP
\fB\-fs\fR
use fullscreen mode
.TP
\fB\-dbl\fR
zoom image 2x
.TP
\fB\-showfps\fR
show frames/second in upper\-right of screen
.PP
There are no command\-line options.
.SH CONTROLS
These are the default controls, which may be changed via the
in\-game menus.
.TP
\fBArrows\fR
Movement
@ -80,12 +42,10 @@ Fire Raygun (if it has charges)
Save the game
.TP
\fBEscape\fR
At the intro or title screen, quits the game. During gameplay, brings up
the quit menu (press Escape again to return to the game).
Brings up the main menu
.TP
\fBF10\fR
Switch to fullscreen and enable scale2x mode. Only active during the
intro screen (blue text on starfield).
Toggles fullscreen display
.PP
In 2\-player games, player 2's controls are:
.TP
@ -107,8 +67,9 @@ Down
\fBD\fR
Right
.SH CHEAT CODES
There are a full assortment of cheat codes available. Some cheats must first
be enabled with -cheat or through the options menu. C+T+SPACE and G+O+D will
There are a full assortment of cheat codes available. Most cheats
can only be used after enabling cheats in the options menu.
C+T+SPACE and G+O+D will
always work.
.TP
\fBG+O+D\fR
@ -175,13 +136,6 @@ You get an extra Keen every 20,000 points.
Per\-user savegames and config data. This directory is created the first
time you run \fBclonekeen\fR.
.TP
\fB~/.clonekeen/defaultargs\fR
Default arguments to pass to the game. Good candidates are \-fs, \-dbl,
and/or -cheat. Put the arguments in the file on the same line,
separated by spaces, e.g.:
.PP
\fBecho "-dbl -fs -cheat" > ~/.clonekeen/defaultargs\fR
.TP
\fB/usr/share/games/clonekeen/\fR
System\-wide game data files (including the ones that come with
the original game). Data files may be named in all\-uppercase or
@ -196,29 +150,14 @@ current dir. Use the \fBclonekeen\fR wrapper script instead.
\fB/usr/games/clonekeen\fR
Wrapper script. Creates ~/.clonekeen, populates it with symlinks to the
game data files, runs the main binary.
.SH BUGS
Actually not bugs, these are features that were in the original DOS version
of the game that are not (yet?) implemented in clonekeen:
.PP
No way to customize keyboard controls
.PP
No support for joystick controls
.PP
No support for in\-game help (probably just as well, the help talks about
joysticks, and customizing keyboard controls...)
.PP
Also, the DOS build of clonekeen appears to support up to 4 (or maybe
only 3) player
games, but the Linux build only defines enough control keys
for 2 players.
.SH AUTHOR
clonekeen was written by Caitlin Shaw.
.PP
This manual page and the wrapper script were written by B. Watson for the SlackBuilds.org project.
.SH SEE ALSO
\fB/usr/doc/clonekeen-8.3/readme.txt\fR
\fB/usr/doc/clonekeen-8.4/readme.txt\fR
.br
\fB/usr/doc/clonekeen-8.3/story.txt\fR
\fB/usr/doc/clonekeen-8.4/story.txt\fR
.br
\fBhttp://clonekeen.sourceforge.net/\fR
.br

View file

@ -1,20 +1,18 @@
#!/bin/sh
#!/bin/bash
# Slackware build script for clonekeen
# Written by B. Watson (yalhcru@gmail.com)
PRGNAM=clonekeen
VERSION=${VERSION:-8.3}
VERSION=${VERSION:-8.4}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
@ -26,29 +24,23 @@ OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
SRCVER=$( echo $VERSION | sed 's/\.//g' )
SRCDIR=keen
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCDIR
unzip $CWD/CKBeta${SRCVER}_Bin_W32.zip
unzip -o $CWD/CKBeta${SRCVER}_Src.zip
tar xvf $CWD/$PRGNAM-src-${VERSION/./}.tar.gz
cd $SRCDIR
chown -R root:root .
find . \
@ -57,24 +49,26 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# See patch.txt for details on what this patch does and why.
patch -p1 < $CWD/slackbuild.diff
# Makefile doesn't use CFLAGS, ugh
sed -i "/gcc/s/-O2/$SLKCFLAGS/" src/Makefile
# Ugh. The src tarball ships with compiled .o files!
make -f Makefile.lnx -C src clean all CFLAGS="$SLKCFLAGS"
rm -f platform/*.o
make -C src
# Manual install
mkdir -p $PKG/usr/games $PKG/usr/share/games/$PRGNAM/data
mkdir -p $PKG/usr/games $PKG/usr/share/games/$PRGNAM
install -m0755 -s src/keen $PKG/usr/games/$PRGNAM-bin
install -m0755 -oroot -groot $CWD/$PRGNAM.sh $PKG/usr/games/$PRGNAM
ln -sf $PRGNAM $PKG/usr/games/keen
install -m0644 bin/*.{DAT,dat} $PKG/usr/share/games/$PRGNAM
install -m0644 bin/data/* $PKG/usr/share/games/$PRGNAM/data
mv bin/keen.conf bin/keen.conf.default
cp -r bin/* $PKG/usr/share/games/$PRGNAM
# story.txt is an ASCII-only version of storytxt.ck1 from the
# shareware release
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp $CWD/story.txt readme.txt $PKG/usr/doc/$PRGNAM-$VERSION
cp $CWD/story.txt README src/*.txt $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
# Optional shareware data. It's compressed in an oddball format,
@ -91,6 +85,9 @@ if [ -e $CWD/1keen.zip ]; then
cd -
fi
# Fix line endings of doc files
sed -i 's/\r//' $PKG/usr/doc/$PRGNAM-$VERSION/*
mkdir -p $PKG/usr/man/man6
gzip -9c < $CWD/$PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz
ln -sf $PRGNAM.6.gz $PKG/usr/man/man6/keen.6.gz

View file

@ -1,14 +1,14 @@
PRGNAM="clonekeen"
VERSION="8.3"
VERSION="8.4"
HOMEPAGE="http://clonekeen.sourceforge.net/"
DOWNLOAD="http://downloads.sourceforge.net/project/clonekeen/clonekeen/Beta%208.3/CKBeta83_Src.zip \
http://downloads.sourceforge.net/project/clonekeen/clonekeen/Beta%208.3/CKBeta83_Bin_W32.zip \
DOWNLOAD="http://downloads.sourceforge.net/clonekeen/clonekeen-src-84.tar.gz \
http://downloads.sourceforge.net/clonekeen/CKBeta83_Bin_W32.zip \
ftp://ftp.3drealms.com/share/1keen.zip"
MD5SUM="9aa11b4793bad38bde2eb45597adb54e \
MD5SUM="0179c34727d044f07a1c00df340134bd \
a0dfcd00f3d039ef544f344b605f83bd \
7375d0452276388d52c35d0b3ad6ab82"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"
APPROVED="dsomero"
APPROVED="Niels Horn"

View file

@ -6,8 +6,11 @@ GAME=clonekeen
HOMEDIR=~/.$GAME
mkdir -p $HOMEDIR
cd $HOMEDIR
if [ -e defaultargs ]; then
ARGS="`cat defaultargs`"
fi
ln -s /usr/share/games/$GAME/* . &>/dev/null || true
if [ ! -e keen.conf ]; then
cat keen.conf.default > keen.conf
fi
exec $GAME-bin "$@" $ARGS

View file

@ -1,12 +0,0 @@
slackbuild.diff does the following things:
- Allows data filenames to be upper/lower/mixed case
- Stops creating an empty "ck.log" file in the cwd
- Stops segfaulting on exit due to double-free bug
- Gets rid of non-functional -3player, -4player,
-host, and -join options
- Sets the default frameskip to 1. This is because there is no
way to DECREASE the frameskip from the in-game Options menu,
and the original default was 2. Anyone who has an old/slow
enough machine to need frameskip 2 can still set it (increasing
the frameskip works fine, you just can't decrease it...)

View file

@ -1,286 +0,0 @@
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)