improvements from maintainer Jolan Luff <jolan@cryptonomicon.org>

- de(install) scripts for hiscore file
- patches so we can nuke the no_sound flavor
- installs the README now, changes DESCR to what it was originally
This commit is contained in:
wilfried 2003-04-15 13:17:59 +00:00
parent cd48ec7394
commit 8f167ffd57
9 changed files with 273 additions and 41 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.1.1.1 2003/04/14 09:09:50 wilfried Exp $
# $OpenBSD: Makefile,v 1.2 2003/04/15 13:17:59 wilfried Exp $
COMMENT= "sdl shoot 'em up; stop evil army from getting your oil"
DISTNAME= OilWar-1.2.1
PKGNAME= ${DISTNAME:L}
PKGNAME= ${DISTNAME:L}p0
CATEGORIES= games x11
MASTER_SITES= http://www.2ndpoint.fi/projektit/filut/
@ -22,23 +22,18 @@ MODGCC3_ARCHES= sparc64
MODGCC3_LANGS= C++
USE_X11= Yes
NO_REGRESS= Yes
LIB_DEPENDS= SDL_image::devel/sdl-image
LIB_DEPENDS= SDL_image::devel/sdl-image \
SDL_mixer::devel/sdl-mixer
CONFIGURE_STYLE=gnu
FLAVORS= no_sound
FLAVOR?=
.if ${FLAVOR:L:Mno_sound}
CONFIGURE_ARGS+=--disable-sound
.else
LIB_DEPENDS+= SDL_mixer::devel/sdl-mixer
.endif
do-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/oilwar
${INSTALL_DATA} ${WRKSRC}/*.{png,wav} ${PREFIX}/share/oilwar
${INSTALL_DATA_DIR} ${PREFIX}/bin
${INSTALL_DATA_DIR} ${PREFIX}/share/{doc/oilwar,oilwar}
${INSTALL_PROGRAM} ${WRKSRC}/oilwar ${PREFIX}/bin
${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/oilwar
${INSTALL_DATA} ${WRKSRC}/*.{png,wav} ${PREFIX}/share/oilwar
.include <bsd.port.mk>

View File

@ -0,0 +1,167 @@
$OpenBSD: patch-Main_cpp,v 1.1 2003/04/15 13:17:59 wilfried Exp $
--- Main.cpp.orig Wed Apr 2 10:57:33 2003
+++ Main.cpp Mon Apr 14 11:54:54 2003
@@ -60,6 +60,8 @@ int GunChannel = 1;
Mix_Chunk *pRicochetSound = NULL;
Mix_Chunk *pExplosionSound = NULL;
Mix_Chunk *pDeathSound = NULL;
+bool Sounds = true;
+bool PlaySounds = true;
#endif
list<UnitData> Tanks;
@@ -96,7 +98,7 @@ int main (int argc, char *argv[])
// Check command line
if ( argc > 1 )
{
- for ( int i = 1; i <= argc; i++ )
+ for ( int i = 1; i < argc; i++ )
{
// Version
if ( strcmp (argv[i], "-v") == 0 || strcmp (argv[i], "--version") == 0 )
@@ -111,12 +113,25 @@ int main (int argc, char *argv[])
return 0;
}
+ #ifdef SOUND
+ // Sound
+ if ( strcmp (argv[i], "-s") == 0 || strcmp (argv[i], "--no-sound") == 0 )
+ {
+ cout << "Disabling sounds\n";
+ Sounds = false;
+ continue;
+ }
+ #endif
+
// Help
if ( strcmp (argv[i], "--help") == 0 )
{
cout << "Usage: oilwar [OPTION]\n\n";
cout << "Options\n";
cout << " -v, --version Display version information and exit.\n";
+ #ifdef SOUND
+ cout << " -s, --no-sound Disable sounds\n";
+ #endif
cout << " --help Display this help and exit.\n";
cout << "\nData and score file locations\n";
cout << " Data dir: " << DATA_DIR << '\n';
@@ -150,11 +165,15 @@ int main (int argc, char *argv[])
}
#ifdef SOUND
- // Open audio
- if ( Mix_OpenAudio (22050, AUDIO_S16, 2, 4096) )
+ if ( Sounds )
{
- cerr << "Unable to open audio: " << Mix_GetError () << endl;
- return 1;
+ // Open audio
+ if ( Mix_OpenAudio (22050, AUDIO_S16, 2, 4096) )
+ {
+ cerr << "Unable to open audio: " << Mix_GetError () << endl;
+ cout << "Disabling sound\n";
+ Sounds = false;
+ }
}
#endif
@@ -166,11 +185,14 @@ int main (int argc, char *argv[])
pBitmaps = LoadImage ("bitmaps.png", true);
#ifdef SOUND
- // Load sounds
- pGunSound = LoadSound ("singlegunshot.wav");
- pRicochetSound = LoadSound ("bulletricochet.wav");
- pExplosionSound = LoadSound ("explode.wav");
- pDeathSound = LoadSound ("gasp.wav");
+ if ( Sounds )
+ {
+ // Load sounds
+ pGunSound = LoadSound ("singlegunshot.wav");
+ pRicochetSound = LoadSound ("bulletricochet.wav");
+ pExplosionSound = LoadSound ("explode.wav");
+ pDeathSound = LoadSound ("gasp.wav");
+ }
#endif
// Load highscores
@@ -214,6 +236,12 @@ int main (int argc, char *argv[])
case SDLK_ESCAPE:
Running = false;
break;
+ #ifdef SOUND
+ case SDLK_s:
+ // Toggle sounds
+ PlaySounds = !PlaySounds;
+ break;
+ #endif
case SDLK_F10:
cout << "Saving screenshot to shot.bmp" << endl;
SDL_SaveBMP (pScreen, "shot.bmp");
@@ -317,6 +345,7 @@ int main (int argc, char *argv[])
Explosion (int (grenade->x + 0.5f), int (grenade->y + 0.5f));
#ifdef SOUND
+ if ( Sounds && PlaySounds )
Mix_PlayChannel (-1, pExplosionSound, 0);
#endif
@@ -433,6 +462,7 @@ int main (int argc, char *argv[])
}
#ifdef SOUND
+ if ( Sounds && PlaySounds )
Mix_PlayChannel (-1, pExplosionSound, 0);
#endif
}
@@ -658,8 +688,11 @@ void FireGun (Sint16 x, Sint16 y)
#ifdef SOUND
// Sounds
- Mix_PlayChannel (-1, pDeathSound, 0);
- Mix_PlayChannel (GunChannel, pGunSound, 0);
+ if ( Sounds && PlaySounds )
+ {
+ Mix_PlayChannel (-1, pDeathSound, 0);
+ Mix_PlayChannel (GunChannel, pGunSound, 0);
+ }
#endif
break;
@@ -674,7 +707,8 @@ void FireGun (Sint16 x, Sint16 y)
{
#ifdef SOUND
// Sounds
- Mix_PlayChannel (GunChannel, pGunSound, 0);
+ if ( Sounds && PlaySounds )
+ Mix_PlayChannel (GunChannel, pGunSound, 0);
#endif
tank->hits++;
@@ -692,13 +726,14 @@ void FireGun (Sint16 x, Sint16 y)
#ifdef SOUND
// Sounds
- Mix_PlayChannel (-1, pExplosionSound, 0);
+ if ( Sounds && PlaySounds )
+ Mix_PlayChannel (-1, pExplosionSound, 0);
#endif
break;
}
#ifdef SOUND
- else
+ else if ( Sounds && PlaySounds )
Mix_PlayChannel (-1, pRicochetSound, 0);
#endif
}
@@ -713,7 +748,8 @@ void FireGun (Sint16 x, Sint16 y)
#ifdef SOUND
// Sounds
- Mix_PlayChannel (GunChannel, pGunSound, 0);
+ if ( Sounds && PlaySounds )
+ Mix_PlayChannel (GunChannel, pGunSound, 0);
#endif
}
}

View File

@ -1,12 +1,12 @@
$OpenBSD: patch-Makefile_in,v 1.1.1.1 2003/04/14 09:09:50 wilfried Exp $
--- Makefile.in.orig Mon Mar 31 07:59:46 2003
+++ Makefile.in Mon Mar 31 16:29:16 2003
$OpenBSD: patch-Makefile_in,v 1.2 2003/04/15 13:17:59 wilfried Exp $
--- Makefile.in.orig Wed Apr 2 10:59:19 2003
+++ Makefile.in Mon Apr 14 13:24:49 2003
@@ -84,7 +84,7 @@ singlegunshot.wav bulletricochet.wav exp
scorefiledir = /var/games
scorefile_DATA = oilwar.scores
-AM_CPPFLAGS = $(sound_flag) -DDATA_DIR=\"$(datafiledir)/\" -DSCORE_DIR=\"$(scorefiledir)/\"
+AM_CPPFLAGS = $(sound_flag) -DDATA_DIR=\"$(prefix)/share/oilwar/\" -DSCORE_DIR=\"$(prefix)/share/oilwar/\"
+AM_CPPFLAGS = $(sound_flag) -DDATA_DIR=\"$(prefix)/share/oilwar/\" -DSCORE_DIR=\"$(scorefiledir)/\"
bin_PROGRAMS = oilwar
oilwar_SOURCES = Main.hpp Main.cpp cParticleSystem.hpp cParticleSystem.cpp Config.hpp

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-README,v 1.1 2003/04/15 13:17:59 wilfried Exp $
--- README.orig Wed Apr 2 10:54:38 2003
+++ README Mon Apr 14 11:54:54 2003
@@ -7,13 +7,17 @@ Evil army is attacking your land and tri
Waste the invaders, protect the oil, protect the mother land...
.:Controls:.
- Left mouse button: Shoot rifle
- Right mouse button: Shoot grenade
+ Left mouse button: Rifle
+ Right mouse button: Grenades
F10: Screenshot
F11: Toggle fullscreen
+ s: Toggle sounds
- .:Sounds:.
- Sounds can be disabled with --disable-sound configure flag.
+.:Sounds:.
+Sound support can be disabled with --disable-sound configure flag.
+
+Sounds can be disabled with '--no-sound' or '-s' command line option or by
+hitting 's' during the game.
.:Notes:.
The highscore file is saved (if the game is "make install":ed)

View File

@ -0,0 +1,22 @@
#!/bin/sh
# $OpenBSD: DEINSTALL,v 1.1 2003/04/15 13:17:59 wilfried Exp $
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SCORE_FILE=/var/games/oilwar.scores
if [ -f $SCORE_FILE ]; then
echo
echo "+---------------"
echo "| To completely deinstall the $1 package you need to perform"
echo "| this step as root:"
echo "|"
echo "| rm -f $SCORE_FILE"
echo "|"
echo "| Do not do this if you plan on re-installing $1"
echo "| at some future time."
echo "+---------------"
echo
fi
exit 0

View File

@ -1,15 +1,5 @@
.:Story:.
Evil army is attacking your land and tries to steal your oil.
.:Mission:.
Waste the invaders, protect the oil, protect the mother land...
.:Controls:.
Left mouse button: Shoot rifle
Right mouse button: Shoot grenade
F10: Screenshot
F11: Toggle fullscreen
There is a no_sound flavor, that does not require a soundcard to run.
An evil army is attacking your country and tries to steal your oil.
Your mission is to waste the invaders, protect the oil, and save
your motherland.
WWW: ${HOMEPAGE}

35
games/oilwar/pkg/INSTALL Normal file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# $OpenBSD: INSTALL,v 1.1 2003/04/15 13:17:59 wilfried Exp $
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SCORE_FILE=/var/games/oilwar.scores
do_install()
{
touch $SCORE_FILE
chown root:games $SCORE_FILE
chmod 664 $SCORE_FILE
}
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
case $2 in
PRE-INSTALL)
: nothing to pre-install for this port
;;
POST-INSTALL)
if [ ! -f $SCORE_FILE ]; then
do_install $1
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0

View File

@ -1,5 +0,0 @@
@comment $OpenBSD: PFRAG.no-no_sound,v 1.1.1.1 2003/04/14 09:09:50 wilfried Exp $
share/oilwar/bulletricochet.wav
share/oilwar/explode.wav
share/oilwar/gasp.wav
share/oilwar/singlegunshot.wav

View File

@ -1,12 +1,15 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2003/04/14 09:09:50 wilfried Exp $
@comment $OpenBSD: PLIST,v 1.2 2003/04/15 13:17:59 wilfried Exp $
@group games
@mode 2555
bin/oilwar
@group
@mode
@group
share/doc/oilwar/README
share/oilwar/background.png
share/oilwar/bitmaps.png
!%%no_sound%%
@exec install -m 664 -o root -g games /dev/null %B/oilwar.scores
@unexec rm -f %B/oilwar.scores
share/oilwar/bulletricochet.wav
share/oilwar/explode.wav
share/oilwar/gasp.wav
share/oilwar/singlegunshot.wav
@dirrm share/oilwar
@dirrm share/doc/oilwar