From ad1036ff71fbdc05867110c938442a2a1b76fa99 Mon Sep 17 00:00:00 2001 From: B. Watson Date: Sat, 2 May 2020 17:30:53 +0700 Subject: games/nblood: Added (Game Engine for Blood). Signed-off-by: Willy Sudiarto Raharjo --- games/nblood/README | 11 +++ games/nblood/README_game_data.txt | 60 ++++++++++++ games/nblood/desktop/nblood-cryptic.desktop | 8 ++ games/nblood/desktop/nblood.desktop | 8 ++ games/nblood/desktop/pcexhumed.desktop | 8 ++ games/nblood/desktop/rednukem.desktop | 8 ++ games/nblood/doinst.sh | 9 ++ games/nblood/extract-blood-data.sh | 139 ++++++++++++++++++++++++++++ games/nblood/git2tarxz.sh | 80 ++++++++++++++++ games/nblood/icons/128.png | Bin 0 -> 16581 bytes games/nblood/icons/256.png | Bin 0 -> 37567 bytes games/nblood/icons/32.png | Bin 0 -> 2715 bytes games/nblood/icons/48.png | Bin 0 -> 4501 bytes games/nblood/icons/64.png | Bin 0 -> 6831 bytes games/nblood/nblood-cryptic | 3 + games/nblood/nblood.SlackBuild | 120 ++++++++++++++++++++++++ games/nblood/nblood.info | 10 ++ games/nblood/slack-desc | 19 ++++ 18 files changed, 483 insertions(+) create mode 100644 games/nblood/README create mode 100644 games/nblood/README_game_data.txt create mode 100644 games/nblood/desktop/nblood-cryptic.desktop create mode 100644 games/nblood/desktop/nblood.desktop create mode 100644 games/nblood/desktop/pcexhumed.desktop create mode 100644 games/nblood/desktop/rednukem.desktop create mode 100644 games/nblood/doinst.sh create mode 100644 games/nblood/extract-blood-data.sh create mode 100644 games/nblood/git2tarxz.sh create mode 100644 games/nblood/icons/128.png create mode 100644 games/nblood/icons/256.png create mode 100644 games/nblood/icons/32.png create mode 100644 games/nblood/icons/48.png create mode 100644 games/nblood/icons/64.png create mode 100644 games/nblood/nblood-cryptic create mode 100644 games/nblood/nblood.SlackBuild create mode 100644 games/nblood/nblood.info create mode 100644 games/nblood/slack-desc (limited to 'games/nblood') diff --git a/games/nblood/README b/games/nblood/README new file mode 100644 index 0000000000..bed9e75816 --- /dev/null +++ b/games/nblood/README @@ -0,0 +1,11 @@ +nblood (game engine for Blood, Duke Nukem 3D, and Powerslave/Exhumed) + +nblood is a collection of reverse-engineered ports of Build games using +EDuke32 engine technology and development principles. + +This package only includes the game engines. You'll have to provide the +game data to actually play any of the games. See README_game_data.txt +for the list of supported games and the data required for each one. + +Optional dependency: isextract. This is only needed to extract the game +data from the Blood install CD. diff --git a/games/nblood/README_game_data.txt b/games/nblood/README_game_data.txt new file mode 100644 index 0000000000..fc79a8aa69 --- /dev/null +++ b/games/nblood/README_game_data.txt @@ -0,0 +1,60 @@ +Game Data README for nblood +--------------------------- + +nblood actually includes 3 game binaries: nblood itself, rednukem, +and pcexhumed. + + +nblood +====== + +The nblood binary plays only Blood version 1.21, and its add-on, Cryptic +Passage. You'll need the "One Unit Whole Blood" CD-ROM: this is the only +version of the game supported by nblood. + +If you want to include the game data in the nblood package: + +- First, install system/isextract. This is needed to extract the data. + +- Mount the CD-ROM (anywhere) before running the SlackBuild and the + build script will find the data there. + +- If you have an ISO image instead of a disc, just copy or symlink the .iso + file into the SlackBuild directory (no need to mount anything). + +If you have an installed copy of the game rather than a CD or ISO, +you should be able to just copy it to /usr/share/games/nblood. Filename +upper/lower case doesn't matter. + +If you're working from the original CD, you can also rip the audio +tracks and convert them to ogg or flac. Follow the instructions in +/usr/doc/nblood-$VERSION/README.md to hear them in the game. + + +rednukem +======== + +The rednukem binary only plays Duke Nukem 3D: Atomic Edition v1.5 and +possibly (untested) the Plutonium Pak. + +For Atomic Edition, all you need is the DUKE3D.GRP file from the install +CD (mine's in atominst/ on the CD) or an installed copy of the game. It's +44356548 bytes long and has an md5sum of 22b6938fe767e5cc57d1fe13080cd522. +Copy this file to /usr/share/games/eduke32/ (no, that's not a typo, +rednukem uses eduke32's data directory). The filename actually doesn't +matter, rednukem uses the checksum to detect it. + + +pcexhumed +========= + +The pcexhumed binary plays: + +- Powerslave demo version. Install the powerslave_demo_data build to + play this. + +- The PC version of Exhumed. All I have is the demo version, and it fails + to play for me so I didn't make a package for it. + +- Supposedly the full versions of Powerslave and Exhumed are supported, + if you can find copies to try. Untested. diff --git a/games/nblood/desktop/nblood-cryptic.desktop b/games/nblood/desktop/nblood-cryptic.desktop new file mode 100644 index 0000000000..4b0e92fe79 --- /dev/null +++ b/games/nblood/desktop/nblood-cryptic.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=NBlood (Cryptic Passage) +Comment=Blood Game Engine +Icon=nblood +Exec=/usr/games/nblood -ini cryptic.ini %f +Terminal=false +Type=Application +Categories=Game;ActionGame; diff --git a/games/nblood/desktop/nblood.desktop b/games/nblood/desktop/nblood.desktop new file mode 100644 index 0000000000..eff4a1dab9 --- /dev/null +++ b/games/nblood/desktop/nblood.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=NBlood +Comment=Blood Game Engine +Icon=nblood +Exec=/usr/games/nblood %f +Terminal=false +Type=Application +Categories=Game;ActionGame; diff --git a/games/nblood/desktop/pcexhumed.desktop b/games/nblood/desktop/pcexhumed.desktop new file mode 100644 index 0000000000..2386b8a063 --- /dev/null +++ b/games/nblood/desktop/pcexhumed.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=PCExhumed +Comment=Exhumed/Powerslave Game Engine +Icon=nblood +Exec=/usr/games/pcexhumed %f +Terminal=false +Type=Application +Categories=Game;ActionGame; diff --git a/games/nblood/desktop/rednukem.desktop b/games/nblood/desktop/rednukem.desktop new file mode 100644 index 0000000000..6624b1873f --- /dev/null +++ b/games/nblood/desktop/rednukem.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=RedNukem +Comment=Duke 3D Game Engine +Icon=nblood +Exec=/usr/games/rednukem %f +Terminal=false +Type=Application +Categories=Game;ActionGame; diff --git a/games/nblood/doinst.sh b/games/nblood/doinst.sh new file mode 100644 index 0000000000..3e5691a052 --- /dev/null +++ b/games/nblood/doinst.sh @@ -0,0 +1,9 @@ +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi + +if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then + if [ -x /usr/bin/gtk-update-icon-cache ]; then + /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1 + fi +fi diff --git a/games/nblood/extract-blood-data.sh b/games/nblood/extract-blood-data.sh new file mode 100644 index 0000000000..374d2a13e5 --- /dev/null +++ b/games/nblood/extract-blood-data.sh @@ -0,0 +1,139 @@ +#!/bin/bash + +# extract-blood-data.sh - extract the game data from a mounted Blood +# CD-ROM or (not mounted) .iso file in the current directory. + +# By B. Watson , released under the WTPL: Do WTF you +# want with this. + +if [ "$( id -u )" != "0" ]; then + echo "$(basename $0) has to run as root because it needs to mount ISO images" + exit 1 +fi + +# Copy the game data here +DEST=${1:-./blood} +DEST="$( readlink -f "$DEST" )" + +# Deal with filenames case-insensitively +shopt -s nocaseglob + +# Return true if directory $1 is a valid copy of the game. +contents_ok() { + local mntpnt="$1" + + [ -e "$mntpnt/blood.ini"* ] && \ + [ -e "$mntpnt/data.z"* ] && \ + [ -e "$mntpnt/readme.txt"* ] && \ + head -n1 "$mntpnt/readme.txt"* | grep -q '^One Unit: WHOLE BLOOD(TM) v 1.21' + + return $? +} + +# Try to find and mount a Blood ISO image, in the current directory. +find_iso() { + local mntpnt="$1" + local iso + + mkdir -p "$mntpnt" + + for iso in *; do + [ -e "$iso" ] || continue + file -L --mime -b "$iso" | grep -qi 'iso.*9660' || continue + + echo -n "Trying '$iso'... " + if /sbin/mount -o ro,loop -t iso9660 "$iso" "$mntpnt"; then + if contents_ok "$mntpnt"; then + echo "found One Unit Whole Blood ISO." + return 0 + fi + echo "mounted, but not a Blood ISO." + /sbin/umount "$mntpnt" + else + echo "couldn't mount." + fi + done + + /sbin/umount "$mntpnt" &> /dev/null + echo "Couldn't find One Unit Whole Blood ISO in $( pwd )" + return 1 +} + +# Extract the data we need. We might be including a little more +# that necessary here. +extract_data() { + local src="$1" + local dst="$2" + local tmpdir + + echo "Extracting and copying data from $src to $dst" + + mkdir -p "$dst" + tmpdir="$( mktemp -d ${TMP:-/tmp}/bloodtmp.XXXXXX )" + + # most of the stuff we need is in data.z + isextract x "$src/data.z"* "$tmpdir" + cd "$tmpdir" + cp -a *.rff* \ + *.dem* \ + *.art* \ + *.dat* \ + "$dst" + cd - + + # ...but not all of it + cp -a "$src/movie"* "$src/cryptic/"* "$src/blood.ini"* "$src/readme.txt"* "$dst" + + # get rid of unnecessary cruft not used by nblood + rm -rf "$dst"/cryptic.exe* \ + "$dst"/movie/directx* \ + "$dst"/movie/amovie* \ + "$dst"/movie/_* \ + "$dst"/movie/*.exe* \ + "$dst"/movie/*.ins* + + find "$dst" -type f -exec chmod 644 {} \+ + chmod 755 "$dst/movie"* + + rm -rf "$tmpdir" +} + +# main() +if ! which isextract &>/dev/null; then + echo "Can't find isextract on PATH. Please install it and re-run this script." + exit 1 +fi + +# Try to find a mounted CD +CDROM="" +cat /proc/mounts | while read line; do + t="$( echo "$line" | cut -d' ' -f3 )" + m="$( echo "$line" | cut -d' ' -f2 )" + if [ "$t" = "iso9660" ]; then + echo -n "Trying mount point '$m'..." + if contents_ok "$m"; then + echo OK + CDROM="$m" + break + fi + echo "not a Blood CD" + fi +done + +if [ -n "$CDROM" ]; then + echo "Found One Unit Whole Blood CD-ROM mounted on $CDROM" +else + CDROM="$( mktemp -d ${TMP:-/tmp}/bloodcd.XXXXXX )" + RMTMP="$CDROM" + if ! find_iso "$CDROM"; then + echo "Couldn't find any game data" + exit 1 + fi +fi + +extract_data "$CDROM" "$DEST" + +if [ -n "$RMTMP" ]; then + umount "$RMTMP" &>/dev/null + rmdir "$RMTMP" +fi diff --git a/games/nblood/git2tarxz.sh b/games/nblood/git2tarxz.sh new file mode 100644 index 0000000000..2c8c7f8829 --- /dev/null +++ b/games/nblood/git2tarxz.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# Create source tarball from git repo, with generated version number. + +# NOTE: if you're copying this to use in another build, get rid of +# the "rm -rf platform" or you might get surprised! + +# Takes one optional argument, which is the commit or tag to create a +# tarball of. With no arg, HEAD is used. + +# Version number example: 0.0.1+20200227_ad7ec17 + +# Notes: + +# Do not use this if you're packaging a release. + +# This script doesn't need to be run as root. It does need to be able +# to write to the current directory it's run from. + +# Running this script twice for the same commit will NOT give identical +# tarballs, even if the contents are identical. This is because tar +# includes the current time in a newly-created tarball (plus there may +# be other git-related reasons). + +# Once you've generated a tarball, you'll still need a place to host it. +# Ask on the mailing list, if you don't have your own web server to +# play with. + +## Config: +# final tarball and slackbuild PRGNAM: +PRGNAM=nblood + +# Github project and user names: +PROJNAME=NBlood +GITUSER=nukeykt + +# For github projects, you can use this unmodified: +CLONE_URL=https://github.com/$GITUSER/$PROJNAME.git + +# For non-github projects, you might not need GITUSER, in which case +# just omit it from the script. + +## End of config. + +set -e + +GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX ) +rm -rf $GITDIR +git clone $CLONE_URL $GITDIR + +CWD="$( pwd )" +cd $GITDIR + +if [ "$1" != "" ]; then + git reset --hard "$1" || exit 1 +fi + +GIT_SHA=$( git rev-parse --short HEAD ) + +DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 ) + +VERTAG=$( git tag -l | tail -1 ) + +VERSION=${VERTAG}+${DATE}_${GIT_SHA} + +rm -rf .git +find . -name .gitignore -print0 | xargs -0 rm -f + +# NOTE: this line is specific to nblood! +rm -rf platform + +cd "$CWD" +rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz +mv $GITDIR $PRGNAM-$VERSION +tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION + +echo +echo "Created tarball: $PRGNAM-$VERSION.tar.xz" +echo "VERSION=\"$VERSION\"" +echo "MD5SUM=\"$( md5sum $PRGNAM-$VERSION.tar.xz | cut -d' ' -f1 )\"" diff --git a/games/nblood/icons/128.png b/games/nblood/icons/128.png new file mode 100644 index 0000000000..b334bc15e1 Binary files /dev/null and b/games/nblood/icons/128.png differ diff --git a/games/nblood/icons/256.png b/games/nblood/icons/256.png new file mode 100644 index 0000000000..e082493b2a Binary files /dev/null and b/games/nblood/icons/256.png differ diff --git a/games/nblood/icons/32.png b/games/nblood/icons/32.png new file mode 100644 index 0000000000..8cdca71238 Binary files /dev/null and b/games/nblood/icons/32.png differ diff --git a/games/nblood/icons/48.png b/games/nblood/icons/48.png new file mode 100644 index 0000000000..cbf82a152a Binary files /dev/null and b/games/nblood/icons/48.png differ diff --git a/games/nblood/icons/64.png b/games/nblood/icons/64.png new file mode 100644 index 0000000000..66024e842c Binary files /dev/null and b/games/nblood/icons/64.png differ diff --git a/games/nblood/nblood-cryptic b/games/nblood/nblood-cryptic new file mode 100644 index 0000000000..6f0c33d092 --- /dev/null +++ b/games/nblood/nblood-cryptic @@ -0,0 +1,3 @@ +#!/bin/sh + +exec nblood -ini cryptic.ini "$@" diff --git a/games/nblood/nblood.SlackBuild b/games/nblood/nblood.SlackBuild new file mode 100644 index 0000000000..d96b3e63e0 --- /dev/null +++ b/games/nblood/nblood.SlackBuild @@ -0,0 +1,120 @@ +#!/bin/sh + +# Slackware build script for nblood + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# Note: if you go digging into the source, you'll see that there are lots +# of commented-out game variations, including shareware duke nukem, the +# non-atomic full version, even redneck rampage. I tried uncommenting a +# couple of them, but they don't work. So for now, rednukem can't play +# the shareware version from eduke32_shareware_data. I expect upstream +# will finish the support for these at a later date... + +PRGNAM=nblood +VERSION=${VERSION:-1.01+20200428_069c52b26} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +# 20200430 bkw: upstream includes a lot of fancy optimization flags that +# are presumably well-tested, so I'm not using SLKCFLAGS. Also, nothing +# here needs LIBDIRSUFFIX. + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-v$VERSION +tar xvf $CWD/$PRGNAM-v$VERSION.tar.xz +cd $PRGNAM-v$VERSION +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# Where do we find the game data? + +# rednukem already looks in /usr/share/games/eduke32/, though it +# hates the shareware .grp file from eduke32_shareware_data. It'll +# play the atomic edition of the full game. + +# nblood looks in /usr/share/games/nblood/, which is fine. + +# pcexhumed doesn't look in /usr anywhere, so I'll make up a dir name +# for it to use. +sed -i \ + '/^ *addsearchpath(cwd);/aaddsearchpath("/usr/share/games/pcexhumed");' \ + source/exhumed/src/exhumed.cpp + +# The engine wants to write a log file in the current directory where +# it gets run... and segfaults if it can't. The log file is just a copy +# of the process's stderr it looks like, so let's disable it. +sed -i.bak \ + 's|OSD_SetLogFile(APPBASENAME ".log");|OSD_SetLogFile("/dev/null");|' \ + source/blood/src/blood.cpp \ + source/rr/src/game.cpp \ + source/exhumed/src/exhumed.cpp + +make + +mkdir -p $PKG/usr/games $PKG/usr/share/applications +for game in $PRGNAM $PRGNAM-cryptic pcexhumed rednukem; do + [ -e $game ] && install -s -m0755 $game $PKG/usr/games + cat $CWD/desktop/$game.desktop > $PKG/usr/share/applications/$game.desktop +done + +# Wrapper script for Cryptic Passage, since the game doesn't let you +# choose it from the GUI. +install -oroot -groot -m0755 $CWD/$PRGNAM-cryptic $PKG/usr/games + +# The .pk3 file has to be in the game data dir. +GAMEDIR=$PKG/usr/share/games/$PRGNAM +mkdir -p $GAMEDIR +install -oroot -groot -m0644 $PRGNAM.pk3 $GAMEDIR + +# Extract/copy the Blood gamedata. Automated here because a description of +# the process amounts to a shell script anyway. It's a standalone script +# so non-Slackware users might be able to use it. +cd $CWD + WITHDATA="does not include" + TMP="$TMP" \ + sh $CWD/extract-blood-data.sh $GAMEDIR && \ + WITHDATA="includes" +cd - + +# Icons extracted from source/blood/rsrc/game_icon.ico with icotool. +for icon in $CWD/icons/*.png; do + size="$( basename $icon .png )" + idir=$PKG/usr/share/icons/hicolor/${size}x${size}/apps + mkdir -p $idir + cat $icon > $idir/$PRGNAM.png +done + +mkdir -p $PKG/usr/share/pixmaps +cat $CWD/icons/64.png > $PKG/usr/share/pixmaps/$PRGNAM.png + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a *.md source/blood/gpl-2.0.txt $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +sed "s,@WITHDATA@,$WITHDATA," $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/games/nblood/nblood.info b/games/nblood/nblood.info new file mode 100644 index 0000000000..c1db7d9c52 --- /dev/null +++ b/games/nblood/nblood.info @@ -0,0 +1,10 @@ +PRGNAM="nblood" +VERSION="1.01+20200428_069c52b26" +HOMEPAGE="https://github.com/nukeykt/NBlood" +DOWNLOAD="http://urchlay.naptime.net/~urchlay/src/nblood-v1.01+20200428_069c52b26.tar.xz" +MD5SUM="160e9effcc8ee2491453edabbcf8d7f8" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="SDL2" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/games/nblood/slack-desc b/games/nblood/slack-desc new file mode 100644 index 0000000000..c3c450d420 --- /dev/null +++ b/games/nblood/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +nblood: nblood (game engine for Blood, Duke Nukem 3D, and Powerslave/Exhumed) +nblood: +nblood: nblood is a collection of reverse-engineered ports of Build games +nblood: using EDuke32 engine technology and development principles. +nblood: +nblood: This package @WITHDATA@ the Blood game data. +nblood: +nblood: +nblood: +nblood: +nblood: -- cgit v1.2.3