diff options
author | B. Watson <yalhcru@gmail.com> | 2021-10-12 05:39:37 -0400 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2021-10-13 00:52:46 +0700 |
commit | f0f12a5b5487a0b77b500cec38f0a46aab281d01 (patch) | |
tree | 67c993ce3f1db679a3e176a41abb58307258fd93 /games | |
parent | 30bcea97fcf0f7a1857f55ea3c256abf510c390e (diff) | |
download | slackbuilds-f0f12a5b5487a0b77b500cec38f0a46aab281d01.tar.gz |
games/xspacewarp: Fix window close button.
Signed-off-by: B. Watson <yalhcru@gmail.com>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'games')
-rw-r--r-- | games/xspacewarp/README | 8 | ||||
-rw-r--r-- | games/xspacewarp/XSpacewarp | 267 | ||||
-rw-r--r-- | games/xspacewarp/doinst.sh | 6 | ||||
-rw-r--r-- | games/xspacewarp/slack-desc | 2 | ||||
-rw-r--r-- | games/xspacewarp/winclose.diff | 78 | ||||
-rw-r--r-- | games/xspacewarp/xspacewarp.SlackBuild | 72 | ||||
-rw-r--r-- | games/xspacewarp/xspacewarp.desktop | 3 | ||||
-rw-r--r-- | games/xspacewarp/xspacewarp.man | 12 |
8 files changed, 126 insertions, 322 deletions
diff --git a/games/xspacewarp/README b/games/xspacewarp/README index d2dcecc72e..f10ecc74c3 100644 --- a/games/xspacewarp/README +++ b/games/xspacewarp/README @@ -1,5 +1,7 @@ -In xspacewarp the player maneuvers a Federation spaceship, called the Endever, -through 81 sectors of space trying to destroy an Armada of enemy Jovian ships -before they destroy the all the Federation bases. +xspacewarp (Time Trek like game for X Window System) + +In xspacewarp the player maneuvers a Federation spaceship, called the +Endever, through 81 sectors of space trying to destroy an Armada of +enemy Jovian ships before they destroy the all the Federation bases. Ported to X from a game originally written for the TRS-80 in 1977. diff --git a/games/xspacewarp/XSpacewarp b/games/xspacewarp/XSpacewarp deleted file mode 100644 index 15960e6a1e..0000000000 --- a/games/xspacewarp/XSpacewarp +++ /dev/null @@ -1,267 +0,0 @@ -! app-defaults for xspacewarp 1.2 (12/22/95) - -! whether to use mouse pointer inside xspacewarp window -*nomouse: true - -! number rows of 9x15 blocks in a sector of the universe -*rows: 26 - -! number columns of 9x15 blocks in a sector of the universe -*columns: 79 - -! The following resources refer to the number of bases, jovians, -! stars and blackholes in the universe. "min" values correspond -! to the lowest skill level of the game and "max" values -! correspond to the highest skill level. Values for the other -! skill levels are interpolated linearly between the "min" value -! and the "max" value. Populations are chosen randomly in the -! range: (average) +/- (variation). - -! Limits for the average population and the variation in -! population for bases. The actual average and variation used -! is interpolated linearly from these limits as a function of -! the skill level. - -*minAverageBasePop: 18 -*maxAverageBasePop: 18 -*minVariationBasePop: 3 -*maxVariationBasePop: 3 - -! Limits for the average population and the variation in -! population for jovians. - -*minAverageJovianPop: 10 -*maxAverageJovianPop: 73 -*minVariationJovianPop: 3 -*maxVariationJovianPop: 3 - -! Limits for the average population and the variation in -! population for stars. - -*minAverageStarPop: 75 -*maxAverageStarPop: 75 -*minVariationStarPop: 5 -*maxVariationStarPop: 5 - -! Limits for the average population and the variation in -! population for blackholes. - -*minAverageBlackholePop: 5 -*maxAverageBlackholePop: 5 -*minVariationBlackholePop: 4 -*maxVariationBlackholePop: 4 - -! color for text and graphical borders -*foreground: white - -! background color for everything -*background: black - -! visual representation of the endever (icon must have exactly 3 characters) -*endeverColor: white -*endeverIcon: >-0 - -! visual representation of the jovians (icon must have exactly 3 characters) -*jovianColor: white -*jovianIcon: <*> - -! visual representation of the bases (icon must have exactly 3 characters) -*baseColor: white -*baseIcon: +0+ - -! visual representation of the stars (icon must have exactly 1 character) -*starColor: white -*starIcon: . - -! visual representation of the blackholes (icon must have exactly 1 character) -*blackholeColor: black -*blackholeIcon: \040 - -! faser color -*faserColor: white - -! torpedo color -*torpedoColor: white - -! Fasers are drawn as dashed lines. The dash list describes the -! dash pattern of the line. A list such as "3 2 4" (elements of -! the list are separated by \040, the octal code for a space -! character) will make a dash pattern that has the first 3 -! pixels of the line lit, the next 2 pixels dark and the next 4 -! pixels lit. This pattern is repeated through the dashed -! line. The dash offset is the pixel in the dash list at which -! to begin the pattern. Eg, offset=3 in the example above would -! mean starting the dashed line with 2 lit pixels followed by 4 -! unlit pixels and then 3 lit pixels, etc. -*faserDashList: 4\0404 -*faserDashOffset: 0 - -! Thickness of faser in pixels -*faserWidth: 9 - -! millisec time determines speed of ion thrusters -*endeverThrustSpeed: 100 - -! millisec interval for ship (base, jovian, endever) re-energizing -*shipEnergizeSpeed: 3000 - -! millisec interval between jovian actions -*jovianActionSpeed: 100 - -! millisec interval for faser movement -*faserSpeed: 15 - -! millisec interval for torpedo movement -*torpedoSpeed: 30 - -! dimensions of torpedo (in pixels) -*torpedoLength: 6 -*torpedoWidth: 9 - -! millisec interval for rate of explosion growth -*explosionSpeed: 20 - -*explosionColor: white - -! radius to use for most ship explosions -*explosionRadiusSmall: 35 - -! radius to use for endever self-destruct explosion -*explosionRadiusBig: 200 - -! endever self-destruct code -*selfDestructCode: 123 - -! endever default faser/torpedo angle (radians). type float. -*defaultFiringAngle: 0.0 - -! starting number of torpedoes for endever -*maxTorpedoes: 10 - -*maxJoviansPerSector: 3 -*maxStarsPerSector: 5 - -! probability a sector is masked (percent) -*maskProbability: 5 - -! When the Endever leaps into a new sector, it gets placed at a -! random location inside that sector. The euclidean distance -! (in pixels) from this location to the jovians inside the -! sector is at least this value. - -*minJovianDistance: 150 - -! min percent energy needed for endever fasers to work -*endeverMinFaserEnergy: 10 - -! min percent energy for endever warpdrive to work -*endeverMinWarpEnergy: 20 - -! min percent energy for endever ion thrusters to work -*endeverMinThrustEnergy: 10 - -! min percent energy needed for jovian fasers to work -*jovianMinFaserEnergy: 10 - -! min percent energy for jovian warpdrive to work -*jovianMinWarpEnergy: 20 - -! min percent energy for ion thrusters to work -*jovianMinThrustEnergy: 10 - - -! Now some "artificial intelligence" parameters for controlling -! jovian behavior. - -! If the percent energy levels (ie, percent of maximum energy) -! of the thrusters, warpdrive, fasers and shields of a jovian -! drop to levels less than the respective "retreat" energies -! given below, then the jovian will exit the battle scene with -! probability (given as a percent) -! jovianRetreatProbability. jovianRetreatSpeed (type float) is -! the average rate (movements/sec) at which the jovian retreats -! toward the sector edge. Thus if jovianRetreatSpeed is 1.4, -! then a fleeing jovian will make a movement toward the edge of -! the sector, on average, once every 1.4 seconds. And if the -! jovian happens to already be on the edge of the sector, then -! the jovian will leap to a different sector (if its warpdrive -! energy is adequate) after a pause of 1.4 seconds on average. - -*jovianThrustRetreatEnergy: 30 -*jovianWarpRetreatEnergy: 40 -*jovianFaserRetreatEnergy: 30 -*jovianShieldRetreatEnergy: 40 -*jovianRetreatProbability: 50 -*jovianRetreatSpeed: 1.0 - - -! If the endever or a base being raided is in the same sector as -! a jovian, then the jovian moves or shoots (on average) every -! jovianMaxFightFrequency seconds in the highest skill level of -! the game and every jovianMinFightFrequency seconds in lowest -! skill level. Fight frequencies for the other skill levels are -! interpolated linearly between jovianMinFightFrequency and -! jovianMaxFightFrequency. These resources are type "float". - -*jovianMaxFightFrequency: 1.5 -*jovianMinFightFrequency: 3.5 - -! When a sector contains a base and a jovian, but not the -! endever, then there is a possibility of an attack or "raid" on -! the base. These resources are the average time in seconds -! before some jovian somewhere in the universe launches a raid -! on a base. jovianMaxRaidFrequency is for the highest skill -! level, jovianMinRaidFrequency is for the lowest skill -! level. Values for other skill levels are interpolated linearly -! between these extremes. These resources are type "float". - -*jovianMaxRaidFrequency: 40.0 -*jovianMinRaidFrequency: 400.0 - -! If a jovian is in a sector containing neither a base nor the -! endever, then there is a possibility of the jovian leaping to -! a different sector. These resources are the average number of -! seconds until some jovian somewhere in the universe leaps to a -! sector containing a base or the -! endever. jovianMaxLeapFrequency is for the highest skill level -! and jovianMinLeapFrequency is for the lowest skill -! level. Values for the other skill levels are interpolated in -! between these extremes. These resources are type "float". - -*jovianMaxLeapFrequency: 40.0 -*jovianMinLeapFrequency: 400.0 - -! key bindings for the endever - -*widget.translations: #replace \n\ - <Expose>: expose() \n\ - <Key>KP_Up: move(up) \n\ - <Key>KP_Down: move(down) \n\ - <Key>KP_Left: move(left) \n\ - <Key>KP_Right: move(right) \n\ - <Key>Up: move(up) \n\ - <Key>Down: move(down) \n\ - <Key>Left: move(left) \n\ - <Key>Right: move(right) \n\ - <Key>space: mission(start) sector() \n\ - <Key>1: input() scanner() \n\ - <Key>2: input() summary() \n\ - <Key>3: input() leap() \n\ - <Key>4: input() shields() \n\ - <Key>5: input() fasers() \n\ - <Key>6: input() torpedoes() \n\ - <Key>7: input() selfdestruct() \n\ - <Key>8: input() \n\ - <Key>9: input() \n\ - <Key>0: input() \n\ - <Key>-: input() \n\ - <Key>Return: endinput() \n\ - <Key>BackSpace: backspace() \n\ - <Key>n: orientation(next) replay(no) \n\ - <Key>o: mission(orient) \n\ - <Key>p: orientation(prev) pause() \n\ - <Key>q: orientation(quit) \n\ - <Key>y: replay(yes) - -! end app-defaults - diff --git a/games/xspacewarp/doinst.sh b/games/xspacewarp/doinst.sh index 1015d8fd4d..519aaca034 100644 --- a/games/xspacewarp/doinst.sh +++ b/games/xspacewarp/doinst.sh @@ -16,3 +16,9 @@ config etc/X11/app-defaults/XSpacewarp.new 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/xspacewarp/slack-desc b/games/xspacewarp/slack-desc index 25c2651c01..3b0bd7daa5 100644 --- a/games/xspacewarp/slack-desc +++ b/games/xspacewarp/slack-desc @@ -6,7 +6,7 @@ # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| -xspacewarp: xspacewarp (Time Trek - like game for X Window System) +xspacewarp: xspacewarp (Time Trek like game for X Window System) xspacewarp: xspacewarp: In xspacewarp the player maneuvers a Federation spaceship, called the xspacewarp: Endever, through 81 sectors of space trying to destroy an Armada of diff --git a/games/xspacewarp/winclose.diff b/games/xspacewarp/winclose.diff new file mode 100644 index 0000000000..15da48e27d --- /dev/null +++ b/games/xspacewarp/winclose.diff @@ -0,0 +1,78 @@ +diff -Naur xspacewarp-1.2/actions.cc xspacewarp-1.2.patched/actions.cc +--- xspacewarp-1.2/actions.cc 2021-10-12 04:25:30.580232070 -0400 ++++ xspacewarp-1.2.patched/actions.cc 2021-10-12 05:37:05.063841685 -0400 +@@ -287,6 +287,7 @@ + break; + case 'n': // quit xspacewarp + cout << "Live long and prosper!" << endl; ++ XCloseDisplay(XtDisplay(w)); + exit(0); + default: + cerr << "xspacewarp: replay: unknown argument in X defaults." << endl; +@@ -310,6 +311,12 @@ + } + } + ++void quit(Widget w, XEvent *event, String *str, Cardinal *len) { ++ if(event->type == ClientMessage && ((Atom) event->xclient.data.l[0]) == wm_delete_window) { ++ XCloseDisplay(XtDisplay(w)); ++ exit(0); ++ } ++} + + // not an action but invoked by one. + // Initialize Jovian AI data and start AppTimeOuts so jovians +diff -Naur xspacewarp-1.2/globals.hh xspacewarp-1.2.patched/globals.hh +--- xspacewarp-1.2/globals.hh 1995-12-29 02:41:39.000000000 -0500 ++++ xspacewarp-1.2.patched/globals.hh 2021-10-12 05:03:56.900022417 -0400 +@@ -24,6 +24,7 @@ + extern Pixmap pixmap; + extern GC def_GC, defrv_GC, faserGC, faserGC_rv, torpGC, torpGC_rv, explodeGC; + extern GC endeverGC, baseGC, jovianGC, starGC, blackholeGC; ++extern Atom wm_delete_window; + + extern Sector universe[UROWS][UCOLS]; + extern GameState gamestate; +diff -Naur xspacewarp-1.2/xprep.cc xspacewarp-1.2.patched/xprep.cc +--- xspacewarp-1.2/xprep.cc 2021-10-12 04:25:30.587232070 -0400 ++++ xspacewarp-1.2.patched/xprep.cc 2021-10-12 05:23:53.950913600 -0400 +@@ -28,6 +28,7 @@ + static int read_dashes(const char *, char *); + static void check_values(void); + ++Atom wm_delete_window; + + void xprep(int argc, char **argv) + { +@@ -66,6 +67,10 @@ + + XtRealizeWidget(toplevel); + ++ wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", False); ++ XSetWMProtocols(XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); ++ XtOverrideTranslations(toplevel, XtParseTranslationTable("<Message>WM_PROTOCOLS: quit()")); ++ + // if desired, install an invisible mouse cursor + // that does not block view of xspacewarp. + +diff -Naur xspacewarp-1.2/xprep.hh xspacewarp-1.2.patched/xprep.hh +--- xspacewarp-1.2/xprep.hh 2021-10-12 04:25:30.588232069 -0400 ++++ xspacewarp-1.2.patched/xprep.hh 2021-10-12 05:29:26.455883374 -0400 +@@ -39,6 +39,7 @@ + extern void endinput(Widget, XEvent *, String *, Cardinal *); + extern void replay(Widget, XEvent *, String *, Cardinal *); + extern void pause(Widget, XEvent *, String *, Cardinal *); ++extern void quit(Widget, XEvent *, String *, Cardinal *); + + static XtActionsRec actions[] = + { +@@ -58,7 +59,8 @@ + {(char*)"backspace", (XtActionProc)backspace}, + {(char*)"endinput", (XtActionProc)endinput}, + {(char*)"replay", (XtActionProc)replay}, +- {(char*)"pause", (XtActionProc)pause} ++ {(char*)"pause", (XtActionProc)pause}, ++ {(char*)"quit", (XtActionProc)quit}, + }; + + diff --git a/games/xspacewarp/xspacewarp.SlackBuild b/games/xspacewarp/xspacewarp.SlackBuild index f620f0171b..27305a04a2 100644 --- a/games/xspacewarp/xspacewarp.SlackBuild +++ b/games/xspacewarp/xspacewarp.SlackBuild @@ -1,49 +1,35 @@ #!/bin/bash # Slackware build script for xspacewarp -# Time Trek - like game for X Window System -# Written by Niels Horn <niels.horn@gmail.com> +# Written by Niels Horn <email removed>. +# man page by Luis Henrique <email removed>. +# Formerly maintained by Ryan P.C. McQuen. +# Now maintained by B. Watson <yalhcru@gmail.com>. -# man-page and app-defaults files by Luis Henrique <lmello.009@gmail.com> +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. -# Formerly maintained by: -# Ryan P.C. McQuen | Everett, WA | ryanpcmcquen@member.fsf.org - -# Now maintained by B. Watson <yalhcru@gmail.com> - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version, with the following exception: -# the text of the GPL license may be omitted. - -# This program is distributed in the hope that it will be useful, but -# without any warranty; without even the implied warranty of -# merchantability or fitness for a particular purpose. Compiling, -# interpreting, executing or merely reading the text of the program -# may result in lapses of consciousness and/or very being, up to and -# including the end of all existence and the Universe as we know it. -# See the GNU General Public License for more details. - -# You may have received a copy of the GNU General Public License along -# with this program (most likely, a file named COPYING). If not, see -# <http://www.gnu.org/licenses/>. +# 20211012 bkw: BUILD=3 +# - relicense as WTFPL with permissions from Ryan (who was the one +# who originally added the license). +# - new-style icon. +# - use copy of app defaults file shipped with the source, instead +# of including our own. they were identical except for one extra +# blank line. +# - fix man page typos. +# - make the window close button work. # 20170309 bkw: # - take over maintenance # - fix download & homepage URLs # - i486 => i586 # - minor tweaks -# - TODO: re-enable the close button on the window? I don't see a way -# to quit the game (nothing mentioned in the 'Orientation', man page, -# or README). cd $(dirname $0) ; CWD=$(pwd) PRGNAM=xspacewarp VERSION=${VERSION:-1.2b} -BUILD=${BUILD:-2} +BUILD=${BUILD:-3} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -57,9 +43,6 @@ if [ -z "$ARCH" ]; then esac fi -# If the variable PRINT_PACKAGE_NAME is set, then this script will report what -# the name of the created package would be, and then exit. This information -# could be useful to other scripts. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 @@ -92,15 +75,17 @@ rm -rf $PRGNAM-$SRCVER tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz cd $PRGNAM-$SRCVER chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ # Apply patch to version 1.2b (adapt for modern gcc compiler) patch -p1 < $CWD/version12b.patch +# Patch by B. Watson: make the window close button work. This took +# more effort than I wanted it to... and I had to look at the source +# to xbiff to see how this gibberish works. +patch -p1 < $CWD/winclose.diff + xmkmf make Makefile make CDEBUGFLAGS="$SLKCFLAGS -fno-strength-reduce -fno-strict-aliasing" $PRGNAM @@ -108,17 +93,18 @@ make CDEBUGFLAGS="$SLKCFLAGS -fno-strength-reduce -fno-strict-aliasing" $PRGNAM strip $PRGNAM make install BINDIR=/usr/games DESTDIR=$PKG -mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps +mkdir -p $PKG/usr/share/applications \ + $PKG/usr/share/pixmaps \ + $PKG/usr/share/icons/hicolor/32x32/apps cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop -cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png +cat $CWD/$PRGNAM.png > $PKG/usr/share/icons/hicolor/32x32/apps/$PRGNAM.png +ln -s ../icons/hicolor/32x32/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png -# Install X app-defaults mkdir -p $PKG/etc/X11/app-defaults -cat $CWD/XSpacewarp > $PKG/etc/X11/app-defaults/XSpacewarp.new +cat XSpacewarp.app_def > $PKG/etc/X11/app-defaults/XSpacewarp.new -# Put man-page in package mkdir -p $PKG/usr/man/man6 -cat $CWD/xspacewarp.man | gzip -9 > $PKG/usr/man/man6/xspacewarp.6.gz +gzip -9c <$CWD/xspacewarp.man > $PKG/usr/man/man6/xspacewarp.6.gz mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a CHANGES $PKG/usr/doc/$PRGNAM-$VERSION/ diff --git a/games/xspacewarp/xspacewarp.desktop b/games/xspacewarp/xspacewarp.desktop index 0fa4793e08..f431de2f7a 100644 --- a/games/xspacewarp/xspacewarp.desktop +++ b/games/xspacewarp/xspacewarp.desktop @@ -4,7 +4,6 @@ Type=Application Name=XSpaceWarp Comment=Live long and prosper! Categories=Game; -Exec=xspacewarp +Exec=/usr/games/xspacewarp Icon=xspacewarp StartupNotify=false - diff --git a/games/xspacewarp/xspacewarp.man b/games/xspacewarp/xspacewarp.man index f2ed190759..e4b462c682 100644 --- a/games/xspacewarp/xspacewarp.man +++ b/games/xspacewarp/xspacewarp.man @@ -1,4 +1,4 @@ -.TH XSPACEWARP 6 "July 26, 2010" +.TH XSPACEWARP 6 "October 2021" "1.2b" "SlackBuilds.org" .SH NAME xspacewarp -\ Time Trek like game for X Window System .SH SYNOPSIS @@ -10,7 +10,7 @@ xspacewarp -\ Time Trek like game for X Window System In \fBxspacewarp\fP the player maneuvers a Federation spaceship, called the Endever, through 81 sectors of space trying to destroy an Armada of enemy Jovian ships before they destroy the -all the Federation bases. To accompish this task, the Endever +all the Federation bases. To accomplish this task, the Endever has fasers, ion thrust engines, warpdrive for jumping between sectors, a limited number of photon torpedoes, and a finite store of energy which gets depleted during battles and must be @@ -20,13 +20,13 @@ limit and has a choice of 10 skill levels. Ported to X from a game originally written for the TRS-80 in 1977. .SH OPTIONS .B xspacewarp -only takes default \fIX options\fR, see X(7) for more details. +only takes default \fIX options\fR, see \fBX\fR(7) for more details. .SH FILES -You can modify pratically every single variable of the game by -making a copy of \fI/etc/X11/app-defaults/XSpacewarp\fR into your +You can modify practically every single variable of the game by +making a copy of \fI/etc/X11/app-defaults/XSpacewarp\fR in your home directory and tweaking it accordingly. .SH SEE ALSO -X(7) +\fBX\fR(7) .SH CREDITS Joshua Lavinsky - original TRS-80 program (1977) .br |