--- gravitywars-1.102.orig/debian/gravitywars.links +++ gravitywars-1.102/debian/gravitywars.links @@ -0,0 +1 @@ +usr/share/games/gravitywars/gravitywars.xpm usr/share/pixmaps/gravitywars.xpm --- gravitywars-1.102.orig/debian/postinst +++ gravitywars-1.102/debian/postinst @@ -0,0 +1,61 @@ +#!/bin/sh -e + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# + +PROG=/usr/games/gravitywars +SCOREFILE=/var/games/gravitywars/hscore.gw + +case "$1" in + configure) + # Cancel my old stupid use of dpkg-statoverride + if [ "$1" = "configure" ] && [ "$2" != "" ] && + dpkg --compare-versions "$2" le "1.102-28" && + [ -x /usr/sbin/dpkg-statoverride ] && + dpkg-statoverride --list "$PROG" >/dev/null + then + dpkg-statoverride --remove "$PROG" + fi + + # Properly use statoverride + if ! [ -x /usr/sbin/dpkg-statoverride ] || \ + ! dpkg-statoverride --list "$PROG" >/dev/null ; then + chown root:games "$PROG" + chmod 2755 "$PROG" + fi + + # Move from old pre-FHS location if present. + if [ -e /var/lib/games/gravitywars/hscore.gw ]; then + mv -f /var/lib/games/gravitywars/hscore.gw $SCOREFILE + rmdir -p /var/lib/games/gravitywars 2>/dev/null || true + fi + + if [ ! -e "$SCOREFILE" ]; then + touch "$SCOREFILE" + fi + + # Make sure the file has the right permissions + chown root:games $SCOREFILE + chmod 664 $SCOREFILE + + ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# --- gravitywars-1.102.orig/debian/gravitywars.xpm +++ gravitywars-1.102/debian/gravitywars.xpm @@ -0,0 +1,59 @@ +/* XPM */ +static char * gravitywars_xpm[] = { +"32 32 24 1", +" c None", +". c #7F0000", +"+ c #999999", +"@ c #4C4C4C", +"# c #FF00FF", +"$ c #00FFFF", +"% c #E5E5E5", +"& c #666667", +"* c #007F00", +"= c #FF0000", +"- c #191919", +"; c #7F7F00", +"> c #00007F", +", c #00FF00", +"' c #7F007F", +") c #FFFFFF", +"! c #B2B2B2", +"~ c #333333", +"{ c #007F7F", +"] c #FFFF00", +"^ c #0000FF", +"/ c #CCCCCC", +"( c #7F7F7F", +"_ c #000000", +" ", +" ", +" >>>>> ", +" >>&^&^>> ", +" >>>^(^(^>^> ", +" >>>>^&^(^(^>^>> ", +" >>>&^(^(^!^!^>^>> ", +" >>>&^(^!^&^!^&^>^>^> ", +" >>&^(^!^!^(^!^&>~^>^>> ", +" >>^(^!^!^!^!^!^~>~~>^>> ", +" >&^+^!^!^!^!^!>~>~~>^>^> ", +" >^!^!^!^!^!^!>~>~~~^>^>> ", +" >+^/^!^!^!^!>~>~~~^>^>> ", +" >!^%^/^!^!^~>~~~~>^>^> ", +" >^%^%^%^/^!~~~~~>^>^>> ", +" &>%^%^%^/^!^+~~~>^>^>> ", +" &(@^%^%^/^!^+^>^>^>^>^> ", +" ==&~@>^%^/^!^+^~^>^>^>^>> ", +"=#%#'~~>^/^!^+^>^>^>^>^>> ", +"=#])#'~>/^!^+^~^~^>^>^>^> ", +" =]])=-~>!^+^~^@^~^>^>^>> ", +" =##= >^>+^~^~^~^~^>^>> ", +" == >^>~^@^@^@^~^>^> ", +" >^>~^>^~^~^>^> ", +" >~>>^>^@^~^>> ", +" &(&>^>^~^>^> ", +" ='(&~~>>^^>> ", +" =%#'&&@ >>> ", +" =#])#&~ ", +" =#]])= ", +" ==##= ", +" == "}; --- gravitywars-1.102.orig/debian/README.Debian +++ gravitywars-1.102/debian/README.Debian @@ -0,0 +1,20 @@ +Notes for Gravity Wars +====================== + +SVGAlib +------- + Gravity Wars no longer uses SVGAlib directly. Instead, it uses the +more portable SDL library. However, on x86 systems, you can still use +the SVGAlib backend of SDL by calling the game accordingly, as root or +with root privileges: + + SDL_VIDEODRIVER=svgalib gravitywars + +Speed +----- + The game is slow on non-8bpp displays because SDL needs to convert its +internal 8bpp display to the screen depth. Little can be done about that +except rewriting huge parts of the game, so please run the game on a 256 +color display if you experience speed issues. + + -- Sam Hocevar Sat, 26 Apr 2003 10:31:06 +0200 --- gravitywars-1.102.orig/debian/copyright +++ gravitywars-1.102/debian/copyright @@ -0,0 +1,20 @@ +This is a Debian prepackaged version of the GravityWars game. + +This package was put together by Joey Hess , using +sources from the web page at: + http://www.kuai.se/~sniemi/gwars.htm +(This web page no longer exists.) + +Upstream Author: Sami Niemi + +Copyright: Copyright (C) 1995, 1996 Sami Niemi + +Edward Betts Fri, 11 Aug 2000 01:00:00 +0100 + +I had an email discussion with the author about licensing. I asked for the +licence to be changed to something freer. He agreed to relicense it, and said +the GPL could be used. The author offered to provide some paper documentation +to say that the licence had changed, but I said that an email was sufficient. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL-2'. --- gravitywars-1.102.orig/debian/menu +++ gravitywars-1.102/debian/menu @@ -0,0 +1,3 @@ +?package(gravitywars):needs="X11" section="Games/Action" \ + title="Gravity Wars" command="/usr/games/gravitywars" \ + icon="/usr/share/games/gravitywars/gravitywars.xpm" --- gravitywars-1.102.orig/debian/gravitywars.6 +++ gravitywars-1.102/debian/gravitywars.6 @@ -0,0 +1,43 @@ +.TH GRAVITYWARS 6 +.SH NAME +gravitywars \- clone of Gravity Force +.SH SYNOPSIS +.B gravitywars +.I "[level-code]" +.SH "DESCRIPTION" +.BR gravitywars +is a clone of Gravity Force, one of the greatest games for the Amiga. This +version is a little different, with a much higher +resolution, and better graphics. It also includes some new features +like water, exploding doors, bonus objects, fans (ie. wind), and some +other special effects like exploding bullets, and splashing water. +.SH KEYS +.TP +.B Left, Right +rotate the ship counterclockwise or clockwise +.TP +.B Up +accelerate the ship +.TP +.B Ctrl +fire the weapon +.TP +.B f +toggle fullscreen mode +.TP +.B Esc +exit the game +.SH OPTIONS +.TP +.B level-code +You'll receive this code after you complete a level, and can use it to warp +directly to that level when the game starts. +.B \-j +Calibrate joystick. Use this option to calibrate the joystick. +.SH AUTHOR +.BR gravitywars +was written by Sami Niemi . +.P +This manual page was written by Joey Hess, +for the Debian GNU/Linux system, with updates +from Sam Hocevar . --- gravitywars-1.102.orig/debian/gravitywars.desktop +++ gravitywars-1.102/debian/gravitywars.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Gravity Wars +GenericName=gravitywars +Comment=Test your skills against gravity +Type=Application +Exec=gravitywars +Icon=gravitywars +Terminal=false +Categories=Game;ArcadeGame; + --- gravitywars-1.102.orig/debian/changelog +++ gravitywars-1.102/debian/changelog @@ -0,0 +1,288 @@ +gravitywars (1.102-32ubuntu1) karmic; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/gravitywars.links: Link icon into pixmaps directory + for .desktop file to find. + + -- Michael Terry Thu, 07 May 2009 16:23:20 -0400 + +gravitywars (1.102-32) unstable; urgency=low + + [ Barry deFreese ] + * Add myself to uploaders. + * Add desktop file (Closes: #452576) + * debian/rules - Remove -s option from install (Closes: #437080) + * Don't ignore make clean errors + * 020_sdl_joystick.diff - Add joystick support. (Closes: #508933). + + Thanks to Titon Barua for the patch. + * Add -j option to manpage for calibrating the joystick. + * 030_ucase_password.diff - Allow upper case password. (Closes: #522861). + + Thanks to Steve Cotton for the patch! + * Version link to GPL license in copyright. + * Add appropriate copyright holder to debian/copyright. + * Remove quilt .pc dir on clean. + * Bump Standards Version to 3.8.1. (No changes needed). + + [ Ansgar Burchardt ] + * debian/control: Change XS-Vcs-* to Vcs-* + + -- Barry deFreese Mon, 06 Apr 2009 14:01:48 -0400 + +gravitywars (1.102-31ubuntu1) hardy; urgency=low + + * Provide a .desktop file (LP: #174906) + * Debian/control: + - Update maintainer field + * Add debian/gravitywars.links + + -- Salvatore Palma Sun, 16 Dec 2007 20:31:35 +0100 + +gravitywars (1.102-31) unstable; urgency=low + + [ Sam Hocevar (Debian packages) ] + * debian/control: + + Fixed the maintainer field. + + Added Vcs fields. + * debian/compat: + + Set level to 5. + + [ Jon Dowland ] + * update menu section to "Games/Action" for menu transition + (thanks Linas Žvirblis) + + -- Jon Dowland Thu, 12 Jul 2007 11:30:07 +0100 + +gravitywars (1.102-30) unstable; urgency=low + + * Moved packaging to the Debian Games Team. + * Use quilt for patch management. + * debian/control: + + Set policy to 3.7.2. + + Build-depend on quilt. + + Enhanced the long description and clarified that Gravity Wars is merely + inspired by, not based on, Gravity Force, and that there is no longer + an upstream website for it (Closes: #348278). + + Removed deprecated suidmanager conflict. + + -- Sam Hocevar (Debian packages) Tue, 16 May 2006 03:57:51 +0200 + +gravitywars (1.102-29) unstable; urgency=low + + * debian/control: + + Set policy to 3.6.2.1. + * debian/postinst: + + Properly use dpkg-statoverride. + + Fix deprecated use of chown. + * Makefile: + + Compile with -g -O2 instead of -O3 -funroll-loops (Closes: #295695). + + -- Sam Hocevar (Debian packages) Sat, 12 Nov 2005 13:07:17 +0100 + +gravitywars (1.102-28) unstable; urgency=low + + * debian/control: + + Set policy to 3.6.1.1. + * moveship.c: + + Fixed build with gcc-3.4, thanks to Andreas Jochens (Closes: #258737). + + Fixed other warnings. + + -- Sam Hocevar (Debian packages) Sun, 11 Jul 2004 11:48:51 +0200 + +gravitywars (1.102-27) unstable; urgency=low + + * debian/control: + + Build-depend on libsdl1.2-dev (>= 1.2.5-8) because 1.2.5-7 had a broken + shlibs file. + + Removed the build-dependency on dpkg-dev since it is in build-essential. + + -- Sam Hocevar (Debian packages) Thu, 12 Jun 2003 13:31:00 +0200 + +gravitywars (1.102-26) unstable; urgency=low + + * debian/control: + + Set policy to 3.5.10. + + Removed the leading "a" in the package description. + + Removed ${misc:Depends} in the Depends field. + + -- Sam Hocevar (Debian packages) Fri, 30 May 2003 18:58:03 +0200 + +gravitywars (1.102-25) unstable; urgency=low + + * Fixed debian/rules so that 'dpkg-buildpackage -B' works and the binary + dependencies are correct (Closes: #191460). + + -- Samuel Hocevar Thu, 1 May 2003 16:21:53 +0200 + +gravitywars (1.102-24) unstable; urgency=low + + * New maintainer (Closes: #149933). + * Updated policy to 3.5.9.0. + * Reduced the huge console splash message to two lines. + * Ported the code to use SDL instead of svgalib (Closes: #159003). Package + is now Arch: any, and binary is no longer setuid root. + * Moved architecture-independant data from /usr/lib to /usr/share. + * We use dpkg-statoverride instead of shipping a setgid binary. + * Added switch to fullscreen using the 'f' key. + * Added a "keys" section to the manpage. + * Drew an icon for gravitywars. + + -- Samuel Hocevar Tue, 22 Apr 2003 19:43:57 +0200 + +gravitywars (1.102-23) unstable; urgency=low + + * Debhelper v4. + * Orphaned the package, as I have no systems left that have working svga, + and so have no way or playing the game. :-( + + -- Joey Hess Thu, 13 Jun 2002 17:56:20 -0400 + +gravitywars (1.102-22) unstable; urgency=low + + * Since only i386 has svgalib now, I'm making this package be Arch: i386 + + -- Joey Hess Tue, 3 Apr 2001 15:04:12 -0700 + +gravitywars (1.102-21) unstable; urgency=low + + * Re-added *.obj files, which were accidentually removed when the package + was put in cvs. They are not object files in the sense cvs-inject + thought.. Closes: #92664 + + -- Joey Hess Tue, 3 Apr 2001 14:27:25 -0700 + +gravitywars (1.102-20) unstable; urgency=low + + * Retry.. + * Modified one refernece to /var/lib/games, Closes: #81988 + Oddly, the other reference that was patched in the bug report + was already using /var/games in my released sources. + + -- Joey Hess Thu, 11 Jan 2001 23:06:51 -0800 + +gravitywars (1.102-18) unstable; urgency=low + + * Transition to statoverride. + + -- Joey Hess Wed, 10 Jan 2001 14:52:38 -0800 + +gravitywars (1.102-17) unstable; urgency=low + + * Modified to use FHS /var/games. + + -- Joey Hess Sun, 5 Nov 2000 16:47:02 -0800 + +gravitywars (1.102-16) unstable; urgency=low + + * It seems that when I imported it into cvs, cvs-inject didn't apply + any of the debian patches. Quite weird, and of course this made it + not understand FHS layout at all. Hand-applied the patches, + Closes: #76069 + + -- Joey Hess Wed, 1 Nov 2000 20:46:17 -0800 + +gravitywars (1.102-15) unstable; urgency=low + + * New, no, make that old maintainer. Edward made it free, now I don't + mind maintaining it again. + + -- Joey Hess Tue, 31 Oct 2000 14:39:40 -0800 + +gravitywars (1.102-14) unstable; urgency=low + + * New maintainer. (Closes: Bug#68641) + * Email conversation with author. + * Changed the authors email address. + * Licence changed from not-for-profit, to GPL. + * Updated to Standard-Version: 3.2.0. + + -- Edward Betts Fri, 11 Aug 2000 01:04:38 +0100 + +gravitywars (1.102-13) unstable; urgency=low + + * Orphaned the package, I don't maintain non-free things anymore. + + -- Joey Hess Thu, 18 Mar 1999 14:56:45 -0800 + +gravitywars (1.102-12) unstable; urgency=low + + * Built with latest debhelper to change how the suid binary is registered. + + -- Joey Hess Tue, 27 Oct 1998 21:41:09 -0800 + +gravitywars (1.102-11) unstable; urgency=low + + * Fixed == bashism. + + -- Joey Hess Thu, 20 Aug 1998 00:47:45 -0700 + +gravitywars (1.102-10) unstable; urgency=low + + * Removed icon=none from menu file. + + -- Joey Hess Wed, 5 Aug 1998 14:27:24 -0700 + +gravitywars (1.102-9) frozen unstable; urgency=low + + * Fixed postrm to call update-menus. + + -- Joey Hess Mon, 13 Apr 1998 23:32:07 -0700 + +gravitywars (1.102-8) unstable; urgency=low + + * Rebuilt with a newer svgalib so it will not depend on the -dummy package + now. + * Made high score file not be a conffile. + + -- Joey Hess Fri, 13 Mar 1998 13:11:00 -0800 + +gravitywars (1.102-7) unstable; urgency=low + + * Wrote a man page. + * Modified gravitywars so it does not drop its sgid games permissions, + (svgalib gives up sgid by default), which lets me fix the permissions + of the score file. + + -- Joey Hess Sun, 22 Feb 1998 18:44:49 -0800 + +gravitywars (1.102-6) unstable; urgency=low + + * Updated standards-version. + + -- Joey Hess Mon, 9 Feb 1998 14:17:34 -0800 + +gravitywars (1.102-5) unstable; urgency=low + + * Reupload. + + -- Joey Hess Tue, 18 Nov 1997 13:36:12 -0500 + +gravitywars (1.102-4) unstable; urgency=low + + * Not DFSG-free, so moved to non-free (#14958). + * Use debhelper. + + -- Joey Hess Sun, 16 Nov 1997 19:08:03 -0500 + +gravitywars (1.102-3) unstable; urgency=low + + * Rebuilt with libc6. + * Routine update of debian/rules: + Fakeroot and sudo fixes. + + -- Joey Hess Sun, 10 Aug 1997 19:05:06 -0400 + +gravitywars (1.102-2) unstable; urgency=low + + * Rebuilt to fix name of upstream changelog. + * Update to menu-1 format, moved entry out of Apps into Games. + * Routine update of debian/rules: + Run dpkg-gencontrol after debstd, and delete substvars during clean. + + -- Joey Hess Fri, 9 May 1997 12:38:01 -0400 + +gravitywars (1.102-1) unstable; urgency=low + + * First release. + + -- Joey Hess Mon, 6 Jan 1997 14:48:08 -0500 + --- gravitywars-1.102.orig/debian/compat +++ gravitywars-1.102/debian/compat @@ -0,0 +1 @@ +5 --- gravitywars-1.102.orig/debian/postrm +++ gravitywars-1.102/debian/postrm @@ -0,0 +1,23 @@ +#!/bin/sh -e + +PROG=/usr/games/gravitywars +VARDIR=/var/games/gravitywars + +case "$1" in + purge|remove) + if dpkg-statoverride --list $PROG >/dev/null; then + dpkg-statoverride --remove $PROG + fi + rm -f $VARDIR/hscore.gw + rmdir -p $VARDIR 2>/dev/null || true + ;; + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + --- gravitywars-1.102.orig/debian/rules +++ gravitywars-1.102/debian/rules @@ -0,0 +1,62 @@ +#!/usr/bin/make -f + +build: build-stamp +build-stamp: + dh_testdir + QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2 + $(MAKE) USE_SDL=1 + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + [ ! -f Makefile ] || $(MAKE) clean + QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2 + + rm -rf .pc + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs usr/games usr/share/games/gravitywars \ + var/games/gravitywars + install -m 755 GravityWars101 \ + `pwd`/debian/gravitywars/usr/games/gravitywars + install -m 644 debian/gravitywars.xpm \ + `pwd`/debian/gravitywars/usr/share/games/gravitywars/ + + # Install desktop file + install -D -m 644 debian/gravitywars.desktop debian/gravitywars/usr/share/applications/gravitywars.desktop + + cp -r data debian/gravitywars/usr/share/games/gravitywars/ + cp -r levels debian/gravitywars/usr/share/games/gravitywars/ + rm -f debian/gravitywars/usr/share/games/gravitywars/data/hscore.gw + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs README + install -m 644 README.announce \ + `pwd`/debian/gravitywars/usr/share/doc/gravitywars/ANNOUNCE + dh_installexamples + dh_installmenu + dh_installman debian/gravitywars.6 + dh_installchangelogs CHANGES + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- gravitywars-1.102.orig/debian/control +++ gravitywars-1.102/debian/control @@ -0,0 +1,27 @@ +Source: gravitywars +Section: games +Priority: optional +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Debian Games Team +Uploaders: Sam Hocevar (Debian packages) , Barry deFreese +Standards-Version: 3.8.1 +Build-Depends: debhelper (>= 5.0), quilt, libsdl1.2-dev (>= 1.2.5-8) +Vcs-Svn: svn://svn.debian.org/pkg-games/packages/trunk/gravitywars +Vcs-Browser: http://svn.debian.org/wsvn/pkg-games/packages/trunk/gravitywars/ + +Package: gravitywars +Architecture: any +Depends: ${shlibs:Depends} +Description: clone of Gravity Force + Gravity Wars is inspired by Gravity Force, one of the greatest games + for the Amiga. This version is a little different, with a much higher + resolution, and better graphics. + . + The aim of the game is to guide a spaceship using only thrust and + orientation to the exit, fighting against gravity and inertia. It + includes some new features like water, exploding doors, bonus objects, + fans (ie. wind), and some other special effects like exploding bullets + and splashing water. + . + Gravity Wars is no longer maintained upstream and this Debian package + should be considered the current upstream version. --- gravitywars-1.102.orig/debian/patches/000_author_contact.diff +++ gravitywars-1.102/debian/patches/000_author_contact.diff @@ -0,0 +1,72 @@ +Index: gravitywars-1.102/GravityWars101.c +=================================================================== +--- gravitywars-1.102.orig/GravityWars101.c 1996-12-21 14:34:40.000000000 +0100 ++++ gravitywars-1.102/GravityWars101.c 2006-05-16 06:34:03.000000000 +0200 +@@ -23,8 +23,8 @@ + + / Sami + +- e96sn@efd.lth.se +- sniemi@kuai.se ++ sami@niemi.com ++ saminiemi@usa.net + http://www.kuai.se/~sniemi + http://www.efd.lth.se/~e96sn + +@@ -106,22 +106,11 @@ + strcpy(firstlevel,nextlevel); + + +- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" +-"\n" +-"-----------------------------------------------------------------------------\n" +-" G R A V I T Y W A R S\n\n" +-" v 1.1\n" +-" (November 1995)\n" +-"\n" +-" A Gravity Force clone for the Linux operating system\n" +- +-"\n\n" +-" Coding by Sami Niemi\n\n" +- +-" Graphics by Pär Johannesson\n" +- +-"-----------------------------------------------------------------------------\n" ++ printf( ++"Gravity Wars v1.1 (November 1995), a Gravity Force clone for Unix\n" ++"Coding by Sami Niemi, graphics by Pär Johannesson, SDL port by Sam Hocevar\n" + ); ++ + initParams(); + loadGfx(); + rotGfx(); +Index: gravitywars-1.102/README +=================================================================== +--- gravitywars-1.102.orig/README 1996-12-21 18:05:12.000000000 +0100 ++++ gravitywars-1.102/README 2006-05-16 06:32:02.000000000 +0200 +@@ -328,8 +328,8 @@ + + Fax: +46-454-84992 + +- email: e96sn@efd.LTH.se +- sniemi@kuai.se ++ email: sami@niemi.com ++ saminiemi@usa.net + + WWW: http://www.kuai.se/~sniemi + http://www.efd.lth.se/~e96sn +Index: gravitywars-1.102/README.announce +=================================================================== +--- gravitywars-1.102.orig/README.announce 1996-12-21 19:31:45.000000000 +0100 ++++ gravitywars-1.102/README.announce 2006-05-16 06:32:02.000000000 +0200 +@@ -47,8 +47,8 @@ + ------- + + Sami Niemi: Coding, Design, Graphics, Levels +- e96sn@efd.LTH.se +- sniemi@kuai.se ++ sami@niemi.com ++ saminiemi@usa.net + http://www.kuai.se/~sniemi + http://www.efd.lth.se/~e96sn + --- gravitywars-1.102.orig/debian/patches/010_data_paths.diff +++ gravitywars-1.102/debian/patches/010_data_paths.diff @@ -0,0 +1,42 @@ +Index: gravitywars-1.102/GravityWars101.c +=================================================================== +--- gravitywars-1.102.orig/GravityWars101.c 2006-05-16 06:32:02.000000000 +0200 ++++ gravitywars-1.102/GravityWars101.c 2006-05-16 06:34:01.000000000 +0200 +@@ -59,27 +59,31 @@ + short baselevel; + char filename[128]; + +- char firstlevel[20]="levels/level01"; ++ char firstlevel[80]="levels/level01"; + char buf[128]; +- ++ + levelnum=1; + + if (readlink(arg[0],buf,128)==-1) + strcpy(buf,arg[0]); +- ++ ++/* + n=strlen(buf); + while(n>=0) + if (buf[n--]=='/') break; + if (n<0) { +- strcpy(gamename,"./"); +- gamenamelen=2; ++ strcpy(gamename,"/"); ++ gamenamelen=1; + } + else { + strcpy(gamename,buf); + gamename[n+2]=0; + gamenamelen=strlen(gamename); + } +- ++*/ ++ ++ strcpy(gamename,"/usr/share/games/gravitywars/"); ++ gamenamelen=strlen(gamename); + + if (n_args>1) { + n=0; --- gravitywars-1.102.orig/debian/patches/010_reduce_verbosity.diff +++ gravitywars-1.102/debian/patches/010_reduce_verbosity.diff @@ -0,0 +1,17 @@ +Index: gravitywars-1.102/init.c +=================================================================== +--- gravitywars-1.102.orig/init.c 2006-05-16 06:33:25.000000000 +0200 ++++ gravitywars-1.102/init.c 2006-05-16 06:33:59.000000000 +0200 +@@ -394,10 +394,12 @@ + + fclose(fileptr); + } ++/* + else { + printf("ERROR!!!!!!!!! CAN'T LOAD THE GFX!\n"); + exit(1); + } ++*/ + + /* Get Ship (also for the unused one)*/ + --- gravitywars-1.102.orig/debian/patches/series +++ gravitywars-1.102/debian/patches/series @@ -0,0 +1,10 @@ +000_author_contact.diff +010_comments.diff +010_c_syntax_fixes.diff +010_data_paths.diff +010_escape_exits_title.diff +010_highscores.diff +010_reduce_verbosity.diff +010_sdl_port.diff +020_sdl_joystick.diff +030_ucase_password.diff --- gravitywars-1.102.orig/debian/patches/010_comments.diff +++ gravitywars-1.102/debian/patches/010_comments.diff @@ -0,0 +1,96 @@ +Index: gravitywars-1.102/control.c +=================================================================== +--- gravitywars-1.102.orig/control.c 1996-08-25 10:55:29.000000000 +0200 ++++ gravitywars-1.102/control.c 2006-05-16 06:33:59.000000000 +0200 +@@ -6,10 +6,10 @@ + + /*------------------------------------------------------------------ control */ + /* The control & moveship routines contain really bad code because +-/* they have been changed too many times since the start of the project... +-/* I wish I had written them from scratch after the n:th change... +-/* As you see some of the routines take the ship # as an argument => +-/* the game was going to be a multiuser game, but lazy as i am.. */ ++ * they have been changed too many times since the start of the project... ++ * I wish I had written them from scratch after the n:th change... ++ * As you see some of the routines take the ship # as an argument => ++ * the game was going to be a multiuser game, but lazy as i am.. */ + + void control(short nr) { + +Index: gravitywars-1.102/hole.c +=================================================================== +--- gravitywars-1.102.orig/hole.c 1996-08-25 10:55:30.000000000 +0200 ++++ gravitywars-1.102/hole.c 2006-05-16 06:33:20.000000000 +0200 +@@ -4,7 +4,7 @@ + + /*-----------------------------------------------------------------setbullet */ + /* I think this one made holes just in the screen. Not in the virtual +-/* BlockMap.. I.e. They dissappear when flown over.. */ ++ * BlockMap.. I.e. They dissappear when flown over.. */ + + void OLDmakehole(int x, int y, int type) { + +Index: gravitywars-1.102/init.c +=================================================================== +--- gravitywars-1.102.orig/init.c 1996-12-21 15:00:57.000000000 +0100 ++++ gravitywars-1.102/init.c 2006-05-16 06:34:01.000000000 +0200 +@@ -110,8 +110,6 @@ + nextlevel[gamenamelen+12]=(levelnum/10)+'0'; + nextlevel[gamenamelen+13]=(levelnum%10)+'0'; + +-/* printf("(Loading: %s)\n",nextlevel); */ +- + strcpy(tmp_nextlevel,nextlevel); + strcpy(fname,tmp_nextlevel); + strcpy(&fname[strlen(fname)],".dat"); +Index: gravitywars-1.102/makepic.c +=================================================================== +--- gravitywars-1.102.orig/makepic.c 1996-08-25 10:55:29.000000000 +0200 ++++ gravitywars-1.102/makepic.c 2006-05-16 06:33:20.000000000 +0200 +@@ -51,7 +51,7 @@ + wipe.active=255; /* Not Active */ + + /* This routine writes the screen to stdout to produce +-/* a screen shot.. */ ++ * a screen shot.. */ + /* SCREEN SHOT + vga_setpage(0); + mask=adr=0; +Index: gravitywars-1.102/memory.h +=================================================================== +--- gravitywars-1.102.orig/memory.h 1996-08-25 10:55:29.000000000 +0200 ++++ gravitywars-1.102/memory.h 2006-05-16 06:34:04.000000000 +0200 +@@ -92,8 +92,8 @@ + extern long delay_len; + + /* If you are running out of memory change the BSD routine +-/* I just didn't like performing 4 divisions by 10, or +-/* figuring out a better way... */ ++ * I just didn't like performing 4 divisions by 10, or ++ * figuring out a better way... */ + extern long Dec2BCD[100000]; + + extern uchar ending,escape; +Index: gravitywars-1.102/moveship.c +=================================================================== +--- gravitywars-1.102.orig/moveship.c 1996-08-25 10:40:29.000000000 +0200 ++++ gravitywars-1.102/moveship.c 2006-05-16 06:34:05.000000000 +0200 +@@ -7,8 +7,8 @@ + + /*----------------------------------------------------------------- moveShip */ + /* Once again... This routine contains a lot of bad "undocumented" non logical +-/* code due to all the changes to the project that was never supposed to +-/* become a real game... */ ++ * code due to all the changes to the project that was never supposed to ++ * become a real game... */ + + int moveShip(short nr, unsigned char flag) { + +@@ -175,6 +175,7 @@ + if ((ship_flag&1)==0) { /* If !ZERO => LAYING STILL */ + + n=0; ++ /* FIXME: this loop sucks! */ + for(yy=y; yy<=y2; yy++) { + for(xx=x; xx<=x2; xx++) { + n++; --- gravitywars-1.102.orig/debian/patches/020_sdl_joystick.diff +++ gravitywars-1.102/debian/patches/020_sdl_joystick.diff @@ -0,0 +1,757 @@ +/* + * Objective: This patch implements simple joystick support + * Program: gravitywars + * Author : Titon Barua (titanix) + * patch_version: 0.2 + * email: titanix88@gmail.com + * source_package_to_apply_patch: 1.102-31ubuntu1 + * Date : 17-12-2008 + * License: This code is released under GNU GPL v2 or higher + */ + + +Index: gw3/GravityWars101.c +=================================================================== +--- gw3.orig/GravityWars101.c 2008-12-16 20:11:30.000000000 +0600 ++++ gw3/GravityWars101.c 2008-12-16 20:11:30.000000000 +0600 +@@ -44,10 +44,76 @@ + #include + #include "includes.h" + #include "memory.h" +- ++ ++#if defined (USE_SDL) && defined (USE_JOYSTICK) ++#include ++#include ++extern SDL_Joystick * joy; ++extern int JOY_INDEX; ++extern int JOY_XAXIS; ++extern int JOY_YAXIS; ++extern int JOY_BUTTON_UP; ++extern int JOY_BUTTON_SHOOT; ++extern int JOY_BUTTON_TOGGLE_FULLSCREEN; ++extern int JOY_BUTTON_ESCAPE; ++extern Sint16 JOY_XAXIS_CENTER; ++extern Sint16 JOY_XAXIS_MINIMUM; ++extern Sint16 JOY_XAXIS_MAXIMUM; ++extern Sint16 JOY_XAXIS_NULLZONE; ++extern Sint16 JOY_YAXIS_CENTER; ++extern Sint16 JOY_YAXIS_MINIMUM; ++extern Sint16 JOY_YAXIS_MAXIMUM; ++extern Sint16 JOY_YAXIS_NULLZONE; ++ ++int get_int_env_var (char * env_name,int * i) ++{ ++ char * env_val = NULL; ++ int tmp = 0; ++ ++ if ((env_val = getenv (env_name)) != NULL) { ++#ifdef DEBUG ++ printf ("env_var : %s=%s\n", env_name, env_val); ++#endif ++ errno = 0; ++ tmp = (int) strtol (env_val, NULL, 10); ++ if (!errno) { ++ *i = tmp; ++ return 0; ++ } else { ++ return (1); ++ } ++ } ++ return (2); ++} ++ ++int get_Sint16_env_var (char * env_name,Sint16 * i) ++{ ++ char * env_val = NULL; ++ Sint16 tmp = 0; ++ ++ if ((env_val = getenv (env_name)) != NULL) { ++#ifdef DEBUG ++ printf ("env_var : %s=%s\n", env_name, env_val); ++#endif ++ errno = 0; ++ tmp = (Sint16) strtol (env_val, NULL, 10); ++ if (!errno) { ++ *i = tmp; ++ return (0); ++ } else { ++ return (1); ++ } ++ } ++ return (2); ++} ++#endif ++ + /*--------------------------------------------------------------------- main */ + int main(int n_args, char *arg[]) { +- ++#if defined (USE_SDL) && defined (USE_JOYSTICK) ++ int c, index, calibrate_joystick = 0; ++ opterr = 0; ++#endif + + int n,ch,x,y; + +@@ -67,6 +133,20 @@ + if (readlink(arg[0],buf,128)==-1) + strcpy(buf,arg[0]); + ++#if defined (USE_SDL) && defined (USE_JOYSTICK) ++ while ((c = getopt (n_args, arg, "j")) != -1) { ++ switch (c) { ++ case 'j': ++ calibrate_joystick = 1; ++ break; ++ case '?': ++ fprintf (stderr, "Unknown option. Use '-j' to configure joystick.\n\n"); ++ break; ++ default: ++ break; ++ } ++ } ++#endif + /* + n=strlen(buf); + while(n>=0) +@@ -85,11 +165,20 @@ + strcpy(gamename,"/usr/share/games/gravitywars/"); + gamenamelen=strlen(gamename); + ++#if defined (USE_SDL) && (USE_JOYSTICK) ++ if (optind < n_args) { ++#else + if (n_args>1) { ++#endif + n=0; + do { + n++; ++#if defined (USE_SDL) && (USE_JOYSTICK) ++ } while ( (strncmp(arg[optind],codes[n],6)) && (n<99)); ++#else + } while ( (strncmp(arg[1],codes[n],6)) && (n<99)); ++#endif ++ + if (n!=99) { + levelnum=n+1; + #ifndef USE_SDL +@@ -98,7 +187,11 @@ + #endif + } else { + #ifdef USE_SDL ++#ifndef USE_JOYSTICK + printf("\nUsage: %s [code-to-a-given-level]\n" ++#else ++ printf("\nUsage: %s [-j] [code-to-a-given-level]\n" ++#endif + "(Sure you've got the right code?)\n\n",arg[0]); + exit(0); + #else +@@ -130,6 +223,38 @@ + initScreen(); + + keyboard_init(); ++ ++#ifdef USE_SDL ++#ifdef USE_JOYSTICK ++ if (calibrate_joystick == 1) ++ set_joystick (); ++ else ++ if (load_joystick_settings () == 0) ++ printf ("Joystick configuration loaded from file.\n"); ++ else ++ printf ("Can not load joystick configuration file. Using defaults.\n"); ++/*Parsing environment variables*/ ++ get_int_env_var ("GW_JOY_INDEX", &JOY_INDEX); ++ get_int_env_var ("GW_JOY_XAXIS", &JOY_XAXIS); ++ get_int_env_var ("GW_JOY_YAXIS", &JOY_YAXIS); ++ get_int_env_var ("GW_JOY_BUTTON_UP", &JOY_BUTTON_UP); ++ get_int_env_var ("GW_JOY_BUTTON_SHOOT", &JOY_BUTTON_SHOOT); ++ get_int_env_var ("GW_JOY_BUTTON_TOGGLE_FULLSCREEN", &JOY_BUTTON_TOGGLE_FULLSCREEN); ++ get_int_env_var ("GW_JOY_BUTTON_ESCAPE", &JOY_BUTTON_ESCAPE); ++ ++ get_Sint16_env_var ("GW_JOY_XAXIS_CENTER", &JOY_XAXIS_CENTER); ++ get_Sint16_env_var ("GW_JOY_XAXIS_MINIMUM", &JOY_XAXIS_MINIMUM); ++ get_Sint16_env_var ("GW_JOY_XAXIS_MAXIMUM", &JOY_XAXIS_MAXIMUM); ++ get_Sint16_env_var ("GW_JOY_XAXIS_NULLZONE", &JOY_XAXIS_NULLZONE); ++ get_Sint16_env_var ("GW_JOY_YAXIS_CENTER", &JOY_YAXIS_CENTER); ++ get_Sint16_env_var ("GW_JOY_YAXIS_MINIMUM", &JOY_YAXIS_MINIMUM); ++ get_Sint16_env_var ("GW_JOY_YAXIS_MAXIMUM", &JOY_YAXIS_MAXIMUM); ++ get_Sint16_env_var ("GW_JOY_YAXIS_NULLZONE", &JOY_YAXIS_NULLZONE); ++ ++ joystick_init (); ++#endif ++#endif ++ + mouse_init("/dev/mouse", MOUSE_MICROSOFT, MOUSE_DEFAULTSAMPLERATE); + scans=keyboard_getstate(); + +@@ -284,6 +409,13 @@ + mouse_close(); + keyboard_close(); + ++#ifdef USE_SDL ++#ifdef USE_JOYSTICK ++ if (joy != NULL) ++ joystick_close (); ++#endif ++#endif ++ + vga_setmode(TEXT); + printf("\n"); + exit(0); +Index: gw3/Makefile +=================================================================== +--- gw3.orig/Makefile 2008-12-16 20:11:30.000000000 +0600 ++++ gw3/Makefile 2008-12-16 20:11:30.000000000 +0600 +@@ -3,11 +3,13 @@ + # + + USE_SDL=1 ++USE_JOYSTICK=1 ++DEBUG=1 + + BINDIR=/usr/local/bin + + ifeq (1,$(USE_SDL)) +-CFLAGS= -g -O2 -Wall -DUSE_SDL `sdl-config --cflags` ++CFLAGS= -g -Wall -DUSE_SDL -DUSE_JOYSTICK `sdl-config --cflags` + LIBS= -lm `sdl-config --libs` + else + CFLAGS= -O2 -Wall +Index: gw3/vgastubs.c +=================================================================== +--- gw3.orig/vgastubs.c 2008-12-16 20:11:30.000000000 +0600 ++++ gw3/vgastubs.c 2008-12-16 20:20:00.000000000 +0600 +@@ -10,7 +10,9 @@ + #ifdef USE_SDL + #include "vgastubs.h" + ++/* + #include ++*/ + + /* VGA */ + +@@ -21,8 +23,319 @@ + SDL_Surface *bg; + SDL_Rect score_rect, level_rect, game_rect; + ++#ifdef USE_JOYSTICK ++SDL_Joystick * joy = NULL; ++ ++int JOY_INDEX = 0; ++int JOY_XAXIS = 0; ++int JOY_YAXIS = 1; ++int JOY_BUTTON_UP = 0; ++int JOY_BUTTON_SHOOT = 1; ++int JOY_BUTTON_TOGGLE_FULLSCREEN = 2; ++int JOY_BUTTON_ESCAPE = 2; ++ ++Sint16 JOY_XAXIS_CENTER = 0; ++Sint16 JOY_XAXIS_MINIMUM = -32767; ++Sint16 JOY_XAXIS_MAXIMUM = 32767; ++Sint16 JOY_XAXIS_NULLZONE = 1024; ++ ++Sint16 JOY_YAXIS_CENTER = 0; ++Sint16 JOY_YAXIS_MINIMUM = -32767; ++Sint16 JOY_YAXIS_MAXIMUM = 32767; ++Sint16 JOY_YAXIS_NULLZONE = 1024; ++ ++int save_joystick_settings (void) { ++ /*Just a dirty hack to save the joystick settings*/ ++ FILE * joyset = NULL; ++ char * home = NULL; ++ char fpath[1000]; ++ ++ if ((home = getenv ("HOME")) == NULL) ++ return (2); ++ strcpy (fpath, home); ++ joyset = fopen (strcat (fpath, "/.gravitywars-joystick-settings"), "w"); ++ ++ if (joyset != NULL) { ++ if (fprintf ( ++ joyset, ++ "%d %d %d %d %d %d %d %hd %hd %hd %hd %hd %hd %hd %hd\n", ++ JOY_INDEX, ++ JOY_XAXIS, ++ JOY_YAXIS, ++ JOY_BUTTON_UP, ++ JOY_BUTTON_SHOOT, ++ JOY_BUTTON_TOGGLE_FULLSCREEN, ++ JOY_BUTTON_ESCAPE, ++ JOY_XAXIS_CENTER, ++ JOY_XAXIS_MINIMUM, ++ JOY_XAXIS_MAXIMUM, ++ JOY_XAXIS_NULLZONE, ++ JOY_YAXIS_CENTER, ++ JOY_YAXIS_MINIMUM, ++ JOY_YAXIS_MAXIMUM, ++ JOY_YAXIS_NULLZONE ++ ) >= 0) { ++ fclose (joyset); ++ return (0); ++ } else { ++ fclose (joyset); ++ return (1); ++ } ++ } else { ++ return (2); ++ } ++} ++ ++int load_joystick_settings (void) { ++ FILE * joyset = NULL; ++ char * lineptr = NULL; ++ size_t n = 0; ++ char * home = NULL; ++ char fpath[1000]; ++ ++ if ((home = getenv ("HOME")) == NULL) ++ return (2); ++ strcpy (fpath, home); ++ joyset = fopen (strcat (fpath, "/.gravitywars-joystick-settings"), "r"); ++ ++ if (joyset != NULL) { ++ if (getline (&lineptr, &n, joyset) == -1) ++ return 1; ++ if ( ++ sscanf ( ++ lineptr, ++ "%d %d %d %d %d %d %d %hd %hd %hd %hd %hd %hd %hd %hd", ++ &JOY_INDEX, ++ &JOY_XAXIS, ++ &JOY_YAXIS, ++ &JOY_BUTTON_UP, ++ &JOY_BUTTON_SHOOT, ++ &JOY_BUTTON_TOGGLE_FULLSCREEN, ++ &JOY_BUTTON_ESCAPE, ++ &JOY_XAXIS_CENTER, ++ &JOY_XAXIS_MINIMUM, ++ &JOY_XAXIS_MAXIMUM, ++ &JOY_XAXIS_NULLZONE, ++ &JOY_YAXIS_CENTER, ++ &JOY_YAXIS_MINIMUM, ++ &JOY_YAXIS_MAXIMUM, ++ &JOY_YAXIS_NULLZONE ++ ) == 15) { ++ fclose (joyset); ++ return 0; ++ } else { ++ fclose (joyset); ++ return 2; ++ } ++ } else { ++ return 3; ++ } ++} ++ ++void set_joystick (void) ++{ ++ SDL_Joystick ** joyar = NULL; ++ SDL_Event e; ++ int i, axis_set, axis_ref, axis_ref_set, axis_max, axis_min, num_of_joystick; ++ ++ SDL_JoystickEventState (SDL_ENABLE); ++ num_of_joystick = SDL_NumJoysticks(); ++ ++ if (num_of_joystick > 0) { ++ printf ("Found %d joystick.\n", num_of_joystick); ++ ++ joyar = (SDL_Joystick **) malloc (sizeof (SDL_Joystick *) * num_of_joystick); ++ if (joyar != NULL) { ++ for (i = 0; i < num_of_joystick; i++) { ++ if (!SDL_JoystickOpened(i)) ++ joyar[i] = SDL_JoystickOpen(i); ++ } ++ ++ } else { ++ SDL_Quit (); ++ exit (1); ++ } ++ ++/*Select the joystick*/ ++ printf ("Press any button or move the axis on the joystick you want to configure...\n"); ++ ++/* Emptying the event queue. My joystick throws ++ * some false event right after it is opened.*/ ++ while (SDL_PollEvent(&e)); ++ ++ while (1) { ++ if (SDL_WaitEvent (&e)){ ++ if (e.type == SDL_JOYAXISMOTION) { ++ JOY_INDEX = e.jaxis.which; ++ break; ++ } else if (e.type == SDL_JOYBUTTONDOWN) { ++ JOY_INDEX = e.jbutton.which; ++ break; ++ } ++ } ++ } ++ printf ("Joystick with index %d selected.\n", JOY_INDEX); ++ ++/* Closing other opened (if any) joystick. */ ++ for (i = 0; i < num_of_joystick; i++) { ++ if (i != JOY_INDEX) { ++ if (SDL_JoystickOpened(i)) ++ SDL_JoystickClose (joyar[i]); ++ } ++ } ++ ++ printf ("Move x-axis to full left and right. Then press a button...\n"); ++ ++ axis_set = 0; ++ axis_ref_set = 0; ++ ++ while (SDL_PollEvent(&e)); ++ while (1) { ++ if (SDL_WaitEvent (&e) == 1) { ++ if (e.type == SDL_JOYAXISMOTION) { ++ if (axis_set == 0) { ++ JOY_XAXIS = e.jaxis.axis; ++ axis_set = 1; ++ } ++ if (axis_set == 1) { ++ if (e.jaxis.axis == JOY_XAXIS) { ++ if (axis_ref_set == 0) { ++ axis_ref = e.jaxis.value; ++ axis_max = axis_ref; ++ axis_min = axis_ref; ++ axis_ref_set = 1; ++ } else { ++ if (e.jaxis.value > axis_max) ++ axis_max = e.jaxis.value; ++ else if (e.jaxis.value < axis_min) ++ axis_min = e.jaxis.value; ++ } ++ } ++ } ++ } else if (e.type == SDL_JOYBUTTONDOWN) { ++ if (axis_set == 1) { ++ if (axis_ref_set == 1) { ++ if (axis_min != axis_max) { ++ JOY_XAXIS_MAXIMUM = axis_max; ++ JOY_XAXIS_MINIMUM = axis_min; ++ JOY_XAXIS_CENTER = axis_min + (axis_max - axis_min)/2; ++ JOY_XAXIS_NULLZONE = (axis_max - axis_min)/(20); /*10% of difference max and center*/ ++ break; ++ } ++ } ++ } ++ } ++ } ++ } ++ ++ printf ("Selected axis %d as x-axis.\n", JOY_XAXIS); ++ printf ("Move y-axis to full up and down. Then press a button...\n"); ++ ++ axis_set = 0; ++ axis_ref_set = 0; ++ ++ while (SDL_PollEvent(&e)); ++ while (1) { ++ if (SDL_WaitEvent (&e) == 1) { ++ if (e.type == SDL_JOYAXISMOTION) { ++ if (e.jaxis.axis != JOY_XAXIS) { ++ if (axis_set == 0) { ++ JOY_YAXIS = e.jaxis.axis; ++ axis_set = 1; ++ } ++ if (axis_set == 1) { ++ if (e.jaxis.axis == JOY_YAXIS) { ++ if (axis_ref_set == 0) { ++ axis_ref = e.jaxis.value; ++ axis_max = axis_ref; ++ axis_min = axis_ref; ++ axis_ref_set = 1; ++ } else { ++ if (e.jaxis.value > axis_max) ++ axis_max = e.jaxis.value; ++ else if (e.jaxis.value < axis_min) ++ axis_min = e.jaxis.value; ++ } ++ } ++ } ++ } ++ } else if (e.type == SDL_JOYBUTTONDOWN) { ++ if (axis_set == 1) { ++ if (axis_ref_set == 1) { ++ if (axis_min != axis_max) { ++ JOY_YAXIS_MAXIMUM = axis_max; ++ JOY_YAXIS_MINIMUM = axis_min; ++ JOY_YAXIS_CENTER = axis_min + (axis_max - axis_min)/2; ++ JOY_YAXIS_NULLZONE = (axis_max - axis_min)/(20); /*10% of difference max and center*/ ++ break; ++ } ++ } ++ } ++ } ++ } ++ } ++ ++ printf ("Selected axis %d as y-yxis.\n", JOY_YAXIS); ++ ++ printf ("Press the button for action:\"up\"...\n"); ++ while (SDL_PollEvent(&e)); ++ while (1) { ++ SDL_WaitEvent (&e); ++ if (e.type == SDL_JOYBUTTONDOWN) { ++ JOY_BUTTON_UP = e.jbutton.button; ++ break; ++ } ++ } ++ printf ("\"up\":%d\n", JOY_BUTTON_UP); ++ ++ printf ("Press the button for action:\"shoot\"...\n"); ++ while (SDL_PollEvent(&e)); ++ while (1) { ++ SDL_WaitEvent (&e); ++ if (e.type == SDL_JOYBUTTONDOWN) { ++ JOY_BUTTON_SHOOT = e.jbutton.button; ++ break; ++ } ++ } ++ printf ("\"shoot\":%d\n", JOY_BUTTON_SHOOT); ++ printf ("Press the button for action:\"toggle fullscreen\"...\n"); ++ while (SDL_PollEvent(&e)); ++ while (1) { ++ SDL_WaitEvent (&e); ++ if (e.type == SDL_JOYBUTTONDOWN) { ++ JOY_BUTTON_TOGGLE_FULLSCREEN = e.jbutton.button; ++ break; ++ } ++ } ++ printf ("\"toggle fullscreen\":%d\n", JOY_BUTTON_TOGGLE_FULLSCREEN); ++ printf ("Press the button for action:\"escape\"...\n"); ++ while (SDL_PollEvent(&e)); ++ while (1) { ++ SDL_WaitEvent (&e); ++ if (e.type == SDL_JOYBUTTONDOWN) { ++ JOY_BUTTON_ESCAPE = e.jbutton.button; ++ break; ++ } ++ } ++ printf ("\"escape\":%d\n", JOY_BUTTON_ESCAPE); ++ SDL_JoystickClose (joyar[JOY_INDEX]); ++ free (joyar); ++ if (save_joystick_settings ()) ++ printf ("Error saving joystick settings.\n"); ++ else ++ printf ("Joystick configuration saved.\n"); ++ } else { ++ printf ("No joystick found.\n"); ++ } ++} ++#endif ++ + int vga_init(void) { ++#ifdef USE_JOYSTICK ++ if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE|SDL_INIT_JOYSTICK) < 0) ++#else + if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0) ++#endif + return -1; + + atexit(SDL_Quit); +@@ -196,6 +509,9 @@ + mod = SDL_GetModState(); + scans[SCANCODE_LEFTCONTROL] = mod & KMOD_LCTRL; + scans[SCANCODE_RIGHTCONTROL] = mod & KMOD_RCTRL; ++#ifdef USE_JOYSTICK ++ scans[SCANCODE_LEFTCONTROL] = SDL_JoystickGetButton (joy, JOY_BUTTON_SHOOT); ++#endif + + while(SDL_PollEvent(&e)) { + if(e.type == SDL_KEYDOWN) { +@@ -241,9 +557,115 @@ + break; + } + } ++#ifdef USE_JOYSTICK ++/*Joystick*/ ++ else if (joy != NULL) { ++ if (e.type == SDL_JOYAXISMOTION) { ++#ifdef DEBUG ++ puts ("Joystick axis motion detected."); ++#endif ++ if (e.jaxis.which == JOY_INDEX) { ++ if (e.jaxis.axis == JOY_XAXIS) { ++#ifdef DEBUG ++ printf ("Axis : X, Value : %i\n", e.jaxis.value); ++#endif ++ if ((JOY_XAXIS_MINIMUM <= e.jaxis.value) && ++ (e.jaxis.value < JOY_XAXIS_CENTER - JOY_XAXIS_NULLZONE)) { ++ scans[SCANCODE_CURSORBLOCKLEFT] = 1; ++ scans[SCANCODE_CURSORBLOCKRIGHT] = 0; ++ updated = 1; ++ } else if ((JOY_XAXIS_CENTER + JOY_XAXIS_NULLZONE < e.jaxis.value) && ++ (e.jaxis.value <= JOY_XAXIS_MAXIMUM)) { ++ scans[SCANCODE_CURSORBLOCKRIGHT] = 1; ++ scans[SCANCODE_CURSORBLOCKLEFT] = 0; ++ updated = 1; ++ } else { ++ scans[SCANCODE_CURSORBLOCKRIGHT] = 0; ++ scans[SCANCODE_CURSORBLOCKLEFT] = 0; ++ } ++ } else if (e.jaxis.axis == JOY_YAXIS) { ++#ifdef DEBUG ++ printf ("Axis : Y, Value : %d\n", e.jaxis.value); ++#endif ++ if ((JOY_YAXIS_MINIMUM <= e.jaxis.value) && ++ (e.jaxis.value < JOY_YAXIS_CENTER - JOY_YAXIS_NULLZONE)) { ++ scans[SCANCODE_CURSORBLOCKUP] = 1; ++ updated = 1; ++ } else if ((JOY_YAXIS_CENTER + JOY_YAXIS_NULLZONE < e.jaxis.value) && ++ (e.jaxis.value <= JOY_YAXIS_MAXIMUM)) { ++ scans[SCANCODE_CURSORBLOCKUP] = 1; ++ updated = 1; ++ } else { ++ scans[SCANCODE_CURSORBLOCKUP] = 0; ++ } ++ } ++ } ++ } else if (e.type == SDL_JOYBUTTONDOWN) { ++ if (e.jbutton.which == JOY_INDEX) { ++ if (e.jbutton.button == JOY_BUTTON_UP) { ++ scans[SCANCODE_CURSORBLOCKUP] = 1; ++ updated = 1; ++/* ++ } else if (e.jbutton.button == JOY_BUTTON_SHOOT) { ++ scans[SCANCODE_LEFTCONTROL] = 1; ++ scans[SCANCODE_RIGHTCONTROL] = 1; ++ updated = 1; ++*/ ++ } else if (e.jbutton.button == JOY_BUTTON_ESCAPE) { ++ scans[SCANCODE_ESCAPE] = 1; ++ updated = 1; ++ } else if (e.jbutton.button == JOY_BUTTON_TOGGLE_FULLSCREEN) { ++ SDL_WM_ToggleFullScreen(screen); ++ } ++ } ++ } else if (e.type == SDL_JOYBUTTONUP) { ++ if (e.jbutton.which == JOY_INDEX) { ++ if (e.jbutton.button == JOY_BUTTON_UP) { ++ scans[SCANCODE_CURSORBLOCKUP] = 0; ++/* ++ } else if (e.jbutton.button == JOY_BUTTON_SHOOT) { ++ scans[SCANCODE_LEFTCONTROL] = 0; ++ scans[SCANCODE_RIGHTCONTROL] = 0; ++*/ ++ } else if (e.jbutton.button == JOY_BUTTON_ESCAPE) { ++ scans[SCANCODE_ESCAPE] = 0; ++ } ++ } ++ } ++ } ++#endif + } +- + return updated; + } + ++#ifdef USE_JOYSTICK ++int joystick_init (void) { ++ SDL_JoystickEventState (SDL_ENABLE); ++ if (SDL_NumJoysticks () >= JOY_INDEX) { ++ joy = SDL_JoystickOpen (JOY_INDEX); ++ ++ if (joy == NULL) { ++#ifdef DEBUG ++ printf ("Failed to open joystick.\n"); ++#endif ++ return (1); ++ } ++ else ++ return (0); ++ } ++ else { ++#ifdef DEBUG ++ printf ("Joystick not found.\n"); ++#endif ++ return (2); ++ } ++} ++ ++void joystick_close (void) { ++ if (SDL_JoystickOpened (JOY_INDEX)) { ++ SDL_JoystickClose (joy); ++ } ++} ++#endif ++ + #endif /* USE_SDL */ +Index: gw3/vgastubs.h +=================================================================== +--- gw3.orig/vgastubs.h 2008-12-16 20:11:30.000000000 +0600 ++++ gw3/vgastubs.h 2008-12-16 20:11:30.000000000 +0600 +@@ -18,6 +18,8 @@ + #define SCANCODE_CURSORBLOCKRIGHT 4 + #define SCANCODE_CURSORBLOCKUP 5 + ++#include ++ + typedef void vga_modeinfo; + + int vga_init(void); +@@ -39,3 +41,11 @@ + void keyboard_close(void); + char *keyboard_getstate(void); + int keyboard_update(void); ++ ++#ifdef USE_JOYSTICK ++int joystick_init (void); ++void joystick_close (void); ++void set_joystick (void); ++int load_joystick_settings (void); ++int save_joystick_settings (void); ++#endif +Index: gw3/README.joystick +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gw3/README.joystick 2008-12-16 20:11:30.000000000 +0600 +@@ -0,0 +1,44 @@ ++ **************** ++ * INTRODUCTION * ++ **************** ++ The joystick support is implemented using SDL. The command line option '-j' will ++prompt you (of course in command line :) with joystick configuration. Do exactly as ++you are asked. The configuration will be saved in a file ".gravitywars-joystick-settings" ++in your home directory. From next time, configurations will be loaded from the file. ++By default, there is no file, and default joystick values (embeded in program code) ++are used. You must use '-j' atleast once for the configuration file to be created. ++ ++ There are also some environment variables which can be used to manually setup your ++joystick. They are parsed after the configuration file, so they overshadow the confi- ++guration file, but are not saved when program exits. ++ ++ ************************* ++ * ENVIRONMENT VARIABLES * ++ ************************* ++ GW_JOY_INDEX ++ GW_JOY_XAXIS ++ GW_JOY_YAXIS ++ GW_JOY_BUTTON_UP ++ GW_JOY_BUTTON_SHOOT ++ GW_JOY_BUTTON_TOGGLE_FULLSCREEN ++ GW_JOY_BUTTON_ESCAPE ++ GW_JOY_XAXIS_CENTER ++ GW_JOY_XAXIS_MINIMUM ++ GW_JOY_XAXIS_MAXIMUM ++ GW_JOY_XAXIS_NULLZONE ++ GW_JOY_YAXIS_CENTER ++ GW_JOY_YAXIS_MINIMUM ++ GW_JOY_YAXIS_MAXIMUM ++ GW_JOY_YAXIS_NULLZONE ++ ++ ******** ++ * BUGS * ++ ******** ++ If you unplug the joystick, or somehow disable joystick event during joystick conf- ++iguration, the program will stuck there. 'killall -HUP gravitywars' will do the job though. ++ ++ ********** ++ * AUTHOR * ++ ********** ++ Titon Barua / titanix ++ titanix88@gmail.com + --- gravitywars-1.102.orig/debian/patches/010_highscores.diff +++ gravitywars-1.102/debian/patches/010_highscores.diff @@ -0,0 +1,47 @@ +Index: gravitywars-1.102/GravityWars101.c +=================================================================== +--- gravitywars-1.102.orig/GravityWars101.c 2006-05-16 06:33:23.000000000 +0200 ++++ gravitywars-1.102/GravityWars101.c 2006-05-16 06:33:58.000000000 +0200 +@@ -215,14 +215,13 @@ + if (ShipScore>HighScore) { + HighScore=ShipScore; + +- strcpy(filename,gamename); +- strcpy(&filename[gamenamelen],"data/hscore.gw"); +- if ( ( fileptr=fopen(filename,"w") )!=NULL) { +- fprintf(fileptr,"%d\n",ShipScore); ++ strcpy(filename,"/var/games/gravitywars/hscore.gw"); ++ if ( ( fileptr=fopen(filename,"w") ) != NULL) { ++ fprintf(fileptr,"%ld\n",ShipScore); + fclose(fileptr); + } + else { +- printf("Can't write the HighScore!!!!"); ++ printf("Can't write the HighScore!!!!\n"); + doPanic(); + } + } +Index: gravitywars-1.102/init.c +=================================================================== +--- gravitywars-1.102.orig/init.c 2006-05-16 06:33:20.000000000 +0200 ++++ gravitywars-1.102/init.c 2006-05-16 06:34:00.000000000 +0200 +@@ -486,8 +486,8 @@ + exit(1); + } + +- strcpy(filename,gamename); +- strcpy(&filename[gamenamelen],"data/hscore.gw"); ++ hs[0]='\0'; ++ strcpy(filename,"/var/games/gravitywars/hscore.gw"); + if ( ( fileptr=fopen(filename,"r") )!=NULL) { + fscanf(fileptr,"%s",hs); + fclose(fileptr); +@@ -498,7 +498,7 @@ + } + + HighScore=atoi(hs); +- ++ return 0; + } + + /*------------------------------------------------------------------- rotGfx */ --- gravitywars-1.102.orig/debian/patches/010_c_syntax_fixes.diff +++ gravitywars-1.102/debian/patches/010_c_syntax_fixes.diff @@ -0,0 +1,27 @@ +Index: gravitywars-1.102/memory.h +=================================================================== +--- gravitywars-1.102.orig/memory.h 2006-05-16 06:33:20.000000000 +0200 ++++ gravitywars-1.102/memory.h 2006-05-16 06:33:21.000000000 +0200 +@@ -4,7 +4,7 @@ + #include + + extern char gamename[128]; +-extern gamenamelen; ++extern int gamenamelen; + + extern FILE *fileptr; + extern char buffer[320*33]; +Index: gravitywars-1.102/moveship.c +=================================================================== +--- gravitywars-1.102.orig/moveship.c 2006-05-16 06:33:20.000000000 +0200 ++++ gravitywars-1.102/moveship.c 2006-05-16 06:33:59.000000000 +0200 +@@ -723,8 +723,8 @@ + } + + +- Explode: + } ++ Explode: + + if (wflag<2) { + vga_waitretrace(); --- gravitywars-1.102.orig/debian/patches/010_escape_exits_title.diff +++ gravitywars-1.102/debian/patches/010_escape_exits_title.diff @@ -0,0 +1,25 @@ +Index: gravitywars-1.102/introutro.c +=================================================================== +--- gravitywars-1.102.orig/introutro.c 1996-08-25 09:48:22.000000000 +0200 ++++ gravitywars-1.102/introutro.c 2006-05-16 06:33:59.000000000 +0200 +@@ -141,6 +141,7 @@ + p1[pal_m]=((((long)pal[pal_m])*pal_n)>>10); + vga_waitretrace(); + gl_setpalette(p1); ++ if(keyboard_update()) goto exitfade; + } + gl_setpalette(pal); + +@@ -199,9 +200,10 @@ + } + exitfade: + +- if (*(scans+SCANCODE_ESCAPE)) ++ if (*(scans+SCANCODE_ESCAPE)) { + escape=TRUE; +- ++ return; ++ } + + for(pal_n=1024; pal_n>=0; pal_n-=16) { + for (pal_m=0; pal_m<=767; pal_m++) --- gravitywars-1.102.orig/debian/patches/010_sdl_port.diff +++ gravitywars-1.102/debian/patches/010_sdl_port.diff @@ -0,0 +1,675 @@ +Index: gravitywars-1.102/GravityWars101.c +=================================================================== +--- gravitywars-1.102.orig/GravityWars101.c 2006-05-16 06:33:25.000000000 +0200 ++++ gravitywars-1.102/GravityWars101.c 2006-05-16 06:33:28.000000000 +0200 +@@ -92,16 +92,24 @@ + } while ( (strncmp(arg[1],codes[n],6)) && (n<99)); + if (n!=99) { + levelnum=n+1; ++#ifndef USE_SDL + if (n_args>2) + delay_len=atoi(arg[2]); ++#endif + } else { ++#ifdef USE_SDL ++ printf("\nUsage: %s [code-to-a-given-level]\n" ++ "(Sure you've got the right code?)\n\n",arg[0]); ++ exit(0); ++#else + if ((arg[1][0]<'0') || (arg[1][0]>'9')) { + printf("\nUsage: %s [code-to-a-given-level] [beam-adjustment]\n" + "(Sure you've got the right code?)\n\n",arg[0]); + exit(0); + } +- else ++ else + delay_len=atoi(arg[1]); ++#endif + } + } + +Index: gravitywars-1.102/Makefile +=================================================================== +--- gravitywars-1.102.orig/Makefile 1996-11-02 16:54:18.000000000 +0100 ++++ gravitywars-1.102/Makefile 2006-05-16 06:33:28.000000000 +0200 +@@ -2,15 +2,23 @@ + # Makefile for Gravity Wars, by Sami Niemi + # + ++USE_SDL=1 ++ + BINDIR=/usr/local/bin + +-CFLAGS=-O2 -s ++ifeq (1,$(USE_SDL)) ++CFLAGS= -g -O2 -Wall -DUSE_SDL `sdl-config --cflags` ++LIBS= -lm `sdl-config --libs` ++else ++CFLAGS= -O2 -Wall ++LIBS= -lm -lvgagl -lvga ++endif ++ + CC=cc +-LIBS=-lm -lvgagl -lvga + TARGET=GravityWars101 + OBJECTS=memory.o macros.o misc.o water.o score.o hole.o bullet.o pixel.o \ + blocks.o introutro.o animate.o init.o makepic.o scroll.o moveship.o \ +- control.o GravityWars101.o ++ control.o vgastubs.o GravityWars101.o + + $(TARGET): $(OBJECTS) + $(CC) $(CFLAGS) $(OBJECTS) $(OBJECTS2) -o $(TARGET) $(LIBS) +@@ -49,6 +57,8 @@ + + control.o: control.c config.h macros.h + ++vgastubs.o: vgastubs.c vgastubs.h ++ + + clean: + rm -f $(OBJECTS) +Index: gravitywars-1.102/blocks.c +=================================================================== +--- gravitywars-1.102.orig/blocks.c 1996-08-25 09:48:22.000000000 +0200 ++++ gravitywars-1.102/blocks.c 2006-05-16 06:33:28.000000000 +0200 +@@ -18,15 +18,22 @@ + + vga_setpage(mask); + ++#ifdef USE_SDL ++ if (1) { ++#else + if (adr < 45024) { ++#endif + + /* NORMAL */ + address=vga_ptr+adr; + for (yy=0; yy<=31; yy++) { +- for (xx=0; xx<=31; xx++) { ++ memcpy(address,dp,32); ++ address+=640; ++ dp+=32; ++ /* for (xx=0; xx<=31; xx++) { + *(address++)=*(dp++); + } +- address+=608; ++ address+=608; */ + } + + } +Index: gravitywars-1.102/control.c +=================================================================== +--- gravitywars-1.102.orig/control.c 2006-05-16 06:33:20.000000000 +0200 ++++ gravitywars-1.102/control.c 2006-05-16 06:33:28.000000000 +0200 +@@ -1,6 +1,10 @@ + /* GravityWars 1.1, (C) Sami Niemi -95 */ + ++#ifdef USE_SDL ++#include "vgastubs.h" ++#else + #include ++#endif + #include "memory.h" + + +Index: gravitywars-1.102/includes.h +=================================================================== +--- gravitywars-1.102.orig/includes.h 1996-08-25 09:48:22.000000000 +0200 ++++ gravitywars-1.102/includes.h 2006-05-16 06:33:28.000000000 +0200 +@@ -1,8 +1,12 @@ + #include ++#ifdef USE_SDL ++#include "vgastubs.h" ++#else + #include + #include + #include + #include ++#endif + #include + #include + #include +Index: gravitywars-1.102/init.c +=================================================================== +--- gravitywars-1.102.orig/init.c 2006-05-16 06:33:26.000000000 +0200 ++++ gravitywars-1.102/init.c 2006-05-16 06:33:28.000000000 +0200 +@@ -1,9 +1,14 @@ ++ + /* GravityWars 1.1, (C) Sami Niemi -95 */ + ++#ifdef USE_SDL ++#include "vgastubs.h" ++#else + #include + #include +-#include + #include ++#endif ++#include + #include "memory.h" + + /*--------------------------------------------------------------- initScreen */ +@@ -12,6 +17,12 @@ + short n,ptr; + uchar reg; + ++ /* This modification for debian lets it stay sgid games, so it can write to ++ * the high score file. */ ++#ifndef USE_SDL ++ setgid(getegid()); ++#endif ++ + vga_init(); + vga_setmode(G640x480x256); + gl_setcontextvga(G640x480x256); +@@ -22,6 +33,9 @@ + gl_setpalette(p0); + + /* Split Screen (sl=SplitScreenLine) */ ++#ifdef USE_SDL ++ vga_setsplitline(464); ++#else + outb(0x18,0x3d4); /* LineCompare */ + outb(208,0x3d5); /* sl&255 */ + outb(7,0x3d4); /* Overflow */ +@@ -30,7 +44,8 @@ + outb(9,0x3d4); /* Maximum Scanline */ + reg=inb(0x3d5); + outb(reg&191,0x3d5); /* outb(reg|((sl&512)>>3),0x3d5) */ +- ++#endif ++ return 0; + } + + /*--------------------------------------------------------------- initParams */ +Index: gravitywars-1.102/introutro.c +=================================================================== +--- gravitywars-1.102.orig/introutro.c 2006-05-16 06:33:24.000000000 +0200 ++++ gravitywars-1.102/introutro.c 2006-05-16 06:33:28.000000000 +0200 +@@ -1,9 +1,13 @@ + /* GravityWars 1.1, (C) Sami Niemi -95 */ + ++#ifdef USE_SDL ++#include "vgastubs.h" ++#else + #include +-#include + #include + #include ++#endif ++#include + #include "memory.h" + + void intro() { +@@ -122,6 +126,9 @@ + + + /* Split Screen (sl=SplitScreenLine) */ ++#ifdef USE_SDL ++ vga_setsplitline(480); ++#else + outb(0x18,0x3d4); /* LineCompare */ + outb(0,0x3d5); /* sl&255 */ + outb(7,0x3d4); /* Overflow */ +@@ -130,7 +137,7 @@ + outb(9,0x3d4); /* Maximum Scanline */ + reg=inb(0x3d5); + outb(reg&191,0x3d5); /* outb(reg|((sl&512)>>3),0x3d5) */ +- ++#endif + + + +@@ -214,6 +221,9 @@ + gl_setpalette(p0); + + /* Split Screen (sl=SplitScreenLine) */ ++#ifdef USE_SDL ++ vga_setsplitline(464); ++#else + outb(0x18,0x3d4); /* LineCompare */ + outb(208,0x3d5); /* sl&255 */ + outb(7,0x3d4); /* Overflow */ +@@ -222,9 +232,8 @@ + outb(9,0x3d4); /* Maximum Scanline */ + reg=inb(0x3d5); + outb(reg&191,0x3d5); /* outb(reg|((sl&512)>>3),0x3d5) */ +- ++#endif + +- + } + + +Index: gravitywars-1.102/moveship.c +=================================================================== +--- gravitywars-1.102.orig/moveship.c 2006-05-16 06:33:21.000000000 +0200 ++++ gravitywars-1.102/moveship.c 2006-05-16 06:33:28.000000000 +0200 +@@ -1,6 +1,11 @@ + /* GravityWars 1.1, (C) Sami Niemi -95 */ + ++#ifdef USE_SDL ++ /* */ ++#else + #include ++#endif ++#include + #include "memory.h" + #include "macros.h" + +@@ -480,6 +485,9 @@ + + /* Roll The Split Screen Down */ + for(sl=464; sl<=480; sl++) { ++#ifdef USE_SDL ++ vga_setsplitline(sl); ++#else + outb(0x18,0x3d4); /* LineCompare */ + outb(sl&255,0x3d5); + outb(7,0x3d4); /* Overflow */ +@@ -488,6 +496,7 @@ + outb(9,0x3d4); /* Maximum Scanline */ + reg=inb(0x3d5); + outb(reg|((sl&512)>>3),0x3d5); ++#endif + vga_waitretrace(); + } + +@@ -617,6 +626,9 @@ + + /* Roll the SplitScreen Up */ + for(sl=480; sl>=464; sl--) { ++#ifdef USE_SDL ++ vga_setsplitline(sl); ++#else + outb(0x18,0x3d4); /* LineCompare */ + outb(sl&255,0x3d5); + outb(7,0x3d4); /* Overflow */ +@@ -625,6 +637,7 @@ + outb(9,0x3d4); /* Maximum Scanline */ + reg=inb(0x3d5); + outb(reg|((sl&512)>>3),0x3d5); ++#endif + vga_waitretrace(); + } + +@@ -667,7 +680,7 @@ + if (blocktype==E_BONUS) { + beep(15000); + +- backptr=shipback[nr]; ++ //backptr=shipback[nr]; + + tmp1=37+(rand()&1); + tmp2=lx+(ly<<4)+(ly<<2); +@@ -684,7 +697,7 @@ + if (blocktype==E_WBONUS) { + beep(15000); + +- backptr=shipback[nr]; ++ //backptr=shipback[nr]; + + tmp2=lx+(ly<<4)+(ly<<2); + +@@ -735,8 +748,11 @@ + putbox(old_x, old_y, shipback[nr]); + putbox(x, y, shipmix); + +- for(n=0; n<=1023; n++) shipback[nr][n]=backptr[n]; ++ //for(n=0; n<=1023; n++) shipback[nr][n]=backptr[n]; ++ memcpy(shipback[nr],backptr,1024); + } ++ ++ return 0; + } + + +Index: gravitywars-1.102/scroll.c +=================================================================== +--- gravitywars-1.102.orig/scroll.c 1996-08-25 10:55:30.000000000 +0200 ++++ gravitywars-1.102/scroll.c 2006-05-16 06:33:28.000000000 +0200 +@@ -71,7 +71,9 @@ + animate(); + #endif + ++#ifndef USE_SDL + for(n=0; n<=delay_len; n++); ++#endif + + #ifdef SCORE + killscore(nr,win_y,y); +@@ -92,9 +94,11 @@ + } + vga_waitretrace(); + ++#ifndef USE_SDL + delay_len=delay_len<<1; + for(n=0; n<=delay_len; n++); + delay_len=delay_len>>1; ++#endif + + #ifdef SCORE + killscore(nr,win_y,y2); +@@ -114,7 +118,9 @@ + animate(); + #endif + ++#ifndef USE_SDL + for(n=0; n<=delay_len; n++); ++#endif + + #ifdef SCORE + killscore(nr,win_y,y); +@@ -133,10 +139,11 @@ + vga_waitretrace(); + gl_setdisplaystart(0,y2-8); + ++#ifndef USE_SDL + delay_len=delay_len<<1; + for(n=0; n<=delay_len; n++); + delay_len=delay_len>>1; +- ++#endif + + #ifdef SCORE + killscore(nr,win_y,y2); +Index: gravitywars-1.102/vgastubs.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gravitywars-1.102/vgastubs.c 2006-05-16 06:33:28.000000000 +0200 +@@ -0,0 +1,249 @@ ++ ++/* GravityWars 1.1, SDL wrapper (C) 2003 Sam Hocevar */ ++ ++#include ++#include ++#include ++ ++#include "memory.h" ++ ++#ifdef USE_SDL ++#include "vgastubs.h" ++ ++#include ++ ++/* VGA */ ++ ++#define WIDTH 640 ++#define HEIGHT 480 ++ ++SDL_Surface *screen; ++SDL_Surface *bg; ++SDL_Rect score_rect, level_rect, game_rect; ++ ++int vga_init(void) { ++ if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0) ++ return -1; ++ ++ atexit(SDL_Quit); ++ ++ return 0; ++} ++ ++int vga_setmode(int mode) { ++ ++ switch(mode) { ++ case G640x480x256: ++ screen = SDL_SetVideoMode(WIDTH, HEIGHT, 8, ++ SDL_HWPALETTE/*|SDL_FULLSCREEN*/); ++ if(!screen) { ++ fprintf(stderr, "error setting %dx%d 8bpp indexed mode: %s\n", ++ WIDTH, HEIGHT, SDL_GetError()); ++ return -1; ++ } ++ break; ++ case TEXT: ++ break; ++ } ++ ++ /* The level area in the background bitmap */ ++ level_rect.w = WIDTH; ++ level_rect.h = HEIGHT; ++ level_rect.x = 0; ++ level_rect.y = 16; /* gets modified, between 16 and 960 */ ++ ++ /* Where our viewport gets blitted */ ++ game_rect.w = WIDTH; ++ game_rect.h = HEIGHT; ++ game_rect.x = 0; ++ game_rect.y = 0; ++ ++ /* The score area in the background bitmap */ ++ score_rect.w = WIDTH; ++ score_rect.h = 0; ++ score_rect.x = 0; ++ score_rect.y = 16; ++ ++ /* Where the score gets blitted - heh, we use NULL! */ ++ ++ return 0; ++} ++ ++/* This one is SDL-only */ ++void vga_setsplitline(int sl) { ++ score_rect.h = 480 - sl; ++ score_rect.y = 16 - (480 - sl); ++} ++ ++#ifndef MIN ++#define MIN(a, b) ((a) < (b) ? (a) : (b)) ++#endif ++#ifndef MAX ++#define MAX(a, b) ((a) > (b) ? (a) : (b)) ++#endif ++ ++int vga_claimvideomemory(int m) { ++ bg = SDL_CreateRGBSurface(SDL_SWSURFACE, WIDTH, m / WIDTH, 8, 0, 0, 0, 0); ++ ++ if(!bg) ++ return -1; ++ ++ /* set the palette to the logical screen palette so that blits ++ won't be translated */ ++ SDL_SetColors(bg, screen->format->palette->colors, 0, 256); ++ ++ vga_setpage(0); ++ ++ return 0; ++} ++ ++unsigned char *vga_getgraphmem(void) { ++ return bg->pixels; ++} ++ ++/* FIXME: implement this as a macro */ ++void vga_setpage(int page) { ++ vga_ptr = bg->pixels + (page << 16); ++} ++ ++void vga_waitretrace(void) { ++ SDL_BlitSurface(bg, &level_rect, screen, &game_rect); ++ SDL_BlitSurface(bg, &score_rect, screen, NULL); ++ SDL_UpdateRect(screen, 0, 0, 0, 0); ++} ++ ++/* gl */ ++ ++void gl_setpalette(void *sp) { ++ SDL_Color cmap[256]; ++ char *cols = (char *)sp; ++ int i; ++ ++ for(i=0; i<256; i++) { ++ cmap[i].r = *cols++ * 4; ++ cmap[i].g = *cols++ * 4; ++ cmap[i].b = *cols++ * 4; ++ } ++ ++ SDL_SetPalette(screen, SDL_PHYSPAL, cmap, 0, 256); ++} ++ ++int gl_setcontextvga(int mode) { ++ return 0; ++} ++ ++void gl_setcontextvirtual(int w, int h, int bpp, int bitspp, void *vbuf) { ++ return; ++} ++ ++void *gl_setdisplaystart(int x, int y) { ++ level_rect.x = x; ++ level_rect.y = y; /* y >= 16 */ ++ ++ return NULL; ++} ++ ++void gl_setpalettecolor(int c, int r, int g, int b) { ++ SDL_Color cmap[1]; ++ cmap[0].r = r * 4; ++ cmap[0].g = g * 4; ++ cmap[0].b = b * 4; ++ ++ SDL_SetColors(screen, cmap, 0, 1); ++} ++ ++/* Mouse */ ++ ++int mouse_init(char *dev, int type, int samplerate) { ++ return 0; ++} ++ ++int mouse_update(void) { ++ return 0; ++} ++ ++int mouse_getbutton(void) { ++ return 0; ++} ++ ++void mouse_close(void) { ++ return; ++} ++ ++/* Keyboard */ ++ ++unsigned char keybuf[256]; ++ ++int keyboard_init(void) { ++ scans = keybuf; ++ memset(scans, 0, 256); ++ return 0; ++} ++ ++void keyboard_close(void) { ++ return; ++} ++ ++char *keyboard_getstate(void) { ++ return scans; ++} ++ ++int keyboard_update(void) { ++ SDL_Event e; ++ int updated = 0; ++ int mod; ++ ++ mod = SDL_GetModState(); ++ scans[SCANCODE_LEFTCONTROL] = mod & KMOD_LCTRL; ++ scans[SCANCODE_RIGHTCONTROL] = mod & KMOD_RCTRL; ++ ++ while(SDL_PollEvent(&e)) { ++ if(e.type == SDL_KEYDOWN) { ++ switch(e.key.keysym.sym) { ++ case SDLK_ESCAPE: ++ scans[SCANCODE_ESCAPE] = 1; ++ updated = 1; ++ break; ++ case SDLK_LEFT: ++ scans[SCANCODE_CURSORBLOCKLEFT] = 1; ++ updated = 1; ++ break; ++ case SDLK_RIGHT: ++ scans[SCANCODE_CURSORBLOCKRIGHT] = 1; ++ updated = 1; ++ break; ++ case SDLK_UP: ++ scans[SCANCODE_CURSORBLOCKUP] = 1; ++ updated = 1; ++ break; ++ case SDLK_f: ++ SDL_WM_ToggleFullScreen(screen); ++ break; ++ default: ++ updated = 1; ++ break; ++ } ++ } else if(e.type == SDL_KEYUP) { ++ switch(e.key.keysym.sym) { ++ case SDLK_ESCAPE: ++ scans[SCANCODE_ESCAPE] = 0; ++ break; ++ case SDLK_LEFT: ++ scans[SCANCODE_CURSORBLOCKLEFT] = 0; ++ break; ++ case SDLK_RIGHT: ++ scans[SCANCODE_CURSORBLOCKRIGHT] = 0; ++ break; ++ case SDLK_UP: ++ scans[SCANCODE_CURSORBLOCKUP] = 0; ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++ return updated; ++} ++ ++#endif /* USE_SDL */ +Index: gravitywars-1.102/vgastubs.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gravitywars-1.102/vgastubs.h 2006-05-16 06:33:28.000000000 +0200 +@@ -0,0 +1,41 @@ ++ ++/* GravityWars 1.1, SDL wrapper (C) 2003 Sam Hocevar */ ++ ++#define TEXT 0 ++#define G640x480x256 1 ++#define MOUSE_MICROSOFT 0 ++#define MOUSE_DEFAULTSAMPLERATE 0 ++#define SCANCODE_ESCAPE 0 ++ ++#define BYTESPERPIXEL 1 ++#define BITSPERPIXEL 8 ++#define VBUF 0 ++ ++#define SCANCODE_ESCAPE 0 ++#define SCANCODE_LEFTCONTROL 1 ++#define SCANCODE_RIGHTCONTROL 2 ++#define SCANCODE_CURSORBLOCKLEFT 3 ++#define SCANCODE_CURSORBLOCKRIGHT 4 ++#define SCANCODE_CURSORBLOCKUP 5 ++ ++typedef void vga_modeinfo; ++ ++int vga_init(void); ++int vga_setmode(int mode); ++void vga_setsplitline(int sl); ++int vga_claimvideomemory(int m); ++unsigned char *vga_getgraphmem(void); ++void vga_setpage(int page); ++void gl_setpalette(void *sp); ++int gl_setcontextvga(int mode); ++void gl_setcontextvirtual(int w, int h, int bpp, int bitspp, void *vbuf); ++void *gl_setdisplaystart(int x, int y); ++void gl_setpalettecolor(int c, int r, int g, int b); ++int mouse_init(char *dev, int type, int samplerate); ++int mouse_update(void); ++int mouse_getbutton(void); ++void mouse_close(void); ++int keyboard_init(void); ++void keyboard_close(void); ++char *keyboard_getstate(void); ++int keyboard_update(void); --- gravitywars-1.102.orig/debian/patches/030_ucase_password.diff +++ gravitywars-1.102/debian/patches/030_ucase_password.diff @@ -0,0 +1,16 @@ +Index: gravitywars-1.102/GravityWars101.c +=================================================================== +--- gravitywars-1.102.orig/GravityWars101.c 2009-04-08 11:23:43.000000000 -0400 ++++ gravitywars-1.102/GravityWars101.c 2009-04-08 11:25:04.000000000 -0400 +@@ -174,9 +174,9 @@ + do { + n++; + #if defined (USE_SDL) && (USE_JOYSTICK) +- } while ( (strncmp(arg[optind],codes[n],6)) && (n<99)); ++ } while ( (strncasecmp(arg[optind],codes[n],6)) && (n<99)); + #else +- } while ( (strncmp(arg[1],codes[n],6)) && (n<99)); ++ } while ( (strncasecmp(arg[1],codes[n],6)) && (n<99)); + #endif + + if (n!=99) {