Subversion Repositories pspware

Compare Revisions

Ignore whitespace Rev 46 → Rev 47

/vendor/vectoroids/1.1.0/mkipk.sh
New file
0,0 → 1,82
#!/bin/sh
 
# mkipk.sh
# generates an ipkg for embedded Vectoroids
 
# Bill Kendrick
# bill@newbreedsoftware.com
 
# 2002.Apr.13 - 2002.Apr.20
 
 
VER=1.1.0
 
 
PACKAGE=vectoroids
TMPDIR=tmp
CONTROL=$TMPDIR/CONTROL/control
ARCH=arm
RM=rm
 
echo "SETTING UP"
mkdir $TMPDIR
mkdir $TMPDIR/CONTROL
 
 
echo
echo "MAKING SURE BINARY EXISTS"
make clean
make embedded
 
echo
echo "CREATING CONTROL FILE"
 
echo "Package: $PACKAGE" > $CONTROL
echo "Priority: optional" >> $CONTROL
echo "Version: $VER" >> $CONTROL
echo "Section: games" >> $CONTROL
echo "Architecture: $ARCH" >> $CONTROL
echo "Maintainer: Bill Kendrick (bill@newbreedsoftware.com)" >> $CONTROL
echo "Description: An asteroids game" >> $CONTROL
 
echo
echo "COPYING DATA FILES"
 
mkdir -p $TMPDIR/opt/QtPalmtop/share/vectoroids
cp -R data/* $TMPDIR/opt/QtPalmtop/share/vectoroids
 
echo
echo "CREATING BINARIES"
 
mkdir -p $TMPDIR/opt/QtPalmtop/bin/
echo "vectoroids" > $TMPDIR/opt/QtPalmtop/bin/vectoroids.sh
cp vectoroids $TMPDIR/opt/QtPalmtop/bin/
 
 
echo "CREATING ICON AND DESKTOP FILE"
 
mkdir -p $TMPDIR/opt/QtPalmtop/pics/
cp data/images/icon.png $TMPDIR/opt/QtPalmtop/pics/vectoroids.png
 
mkdir -p $TMPDIR/opt/QtPalmtop/apps/Games/
DESKTOP=$TMPDIR/opt/QtPalmtop/apps/Games/vectoroids.desktop
echo "[Desktop Entry]" > $DESKTOP
echo "Comment=Asteroids game" >> $DESKTOP
echo "Exec=vectoroids.sh" >> $DESKTOP
echo "Icon=vectoroids" >> $DESKTOP
echo "Type=Application" >> $DESKTOP
echo "Name=Vectoroids" >> $DESKTOP
 
 
echo
echo "CREATING IPK..."
 
ipkg-build $TMPDIR
 
echo
echo "CLEANING UP"
 
$RM -r $TMPDIR
 
echo
 
Property changes:
Added: svn:executable
Index: 1.1.0/vectoroids.6
===================================================================
--- 1.1.0/vectoroids.6 (revision 0)
+++ 1.1.0/vectoroids.6 (revision 47)
@@ -0,0 +1,46 @@
+.TH "vectoroids" "6" "v1.1.0 - 2002.04.20" "Bill Kendrick" "Games"
+.SH "NAME"
+.LP
+vectoroids \- A vector-based asteroid\-shooting game written in libSDL.
+.SH "SYNTAX"
+.LP
+vectoroids [\fIoptions\fP]
+.SH "DESCRIPTION"
+.LP
+Use the \fBleft\fR and \fBright\fR keys (or joystick) to rotate your ship.
+Use the \fBup\fR key (joystick \fBfire\-A\fR) to thrust,
+and \fBspace\fR (or joystick \fBfire\-B\fR) to fire bullets.
+.br
+Destroy all of the asteroids to progress to the next level.
+.SH "OPTIONS"
+.LP
+.TP
+\fB\-\-nosound\fR
+Disables sound and music.
+.TP
+\fB\-\-fullscreen\fR
+Runs in fullscreen mode, if possible.
+.TP
+\fB\-\-help\fR
+Output help information and exit.
+.TP
+\fB\-\-version\fR
+Output version information and exit.
+.TP
+\fB\-\-usage\fR
+Displays acceptable command\-line options.
+.TP
+\fB\-\-copying\fR
+Displays copying information.
+.SH "FILES"
+\fI/usr/local/share/vectoroids/\fP \- Sound, music and graphics data.
+.TP
+\fI~/.vectoroidsrc\fP \- Paused game state and high score data.
+.LP
+.SH "AUTHORS"
+.LP
+Bill Kendrick <bill@newbreedsoftware.com> \- Programming
+.br
+Mike Faltiss <deadchannel@hotmail.com> \- Music
+.LP
+See "README.txt" and "CHANGES.txt" for full credits.
Index: 1.1.0/CHANGES.txt
===================================================================
--- 1.1.0/CHANGES.txt (revision 0)
+++ 1.1.0/CHANGES.txt (revision 47)
@@ -0,0 +1,118 @@
+CHANGES.txt for "Vectoroids"
+
+by Bill Kendrick
+bill@newbreedsoftware.com
+http://www.newbreedsoftware.com/vectoroids/
+
+April 20, 2002
+
+Version 1.1.0
+
+
+2002.04.20 (1.1.0)
+ * Lowered volume of game-over sound (it was ear-piercing on the Zaurus!)
+
+ * Reduced length of shots in embedded version (screen is smaller...)
+
+ * Reduced max. number of asteroids on screen at once for embedded version
+
+
+2002.04.14 (1.0.9)
+ * Fixed compile error for desktop version. (Thanks Christian Steigies)
+
+ * Tweaked embedded version
+
+ - Made score and level smaller
+
+ - Made ship's flame look better
+
+ - Made zooming 'LEVEL' display brighter
+
+ - Increased contrast and blur of background image
+
+ - Reduced background image to 8bit, shrinking its file size
+
+ * Update version number in docs and man page.
+
+
+2002.04.13 (1.0.8)
+ * Created 'embedded' target (for iPaq and Zaurus PDAs running Linux)
+
+
+2002.01.03 (1.0.7)
+ * Makefile update
+
+ - Install target changes by Christian T. Steigies <cts@debian.org>
+
+
+2002.01.02/2001.01.03 (1.0.6/1.0.6b)
+ * Documentation update
+
+ - Updated music author's (Mike Faltiss's) contact info. in README.txt
+
+
+2001.12.02 (1.0.5)
+ * More MSVC++ fixes
+ (Thanks to Ton Fleuren)
+
+ - "DATA_PREFIX" get's #define'd to "data/" if it wasn't defined by
+ the compiler.
+
+ * Fullscreen tweak
+
+ - Mouse pointer is now hidden during the game in fullscreen mode.
+
+
+2001.12.02 (1.0.4)
+ * Code tweaks for cleaner compilation under MS Visual C++ compiler
+ (Thanks to Jason Hall and Joshua Goldstein)
+
+ - Added "-pedantic" and "-ansi" to CFLAGS in Makefile
+ - State-file is stored in current directory (folder) if "_WIN32" was
+ #define'd (which it should be under MSVC++)
+ (filename: "vectoroids-state.dat")
+
+
+2001.12.01 (1.0.3)
+ * Bug fixes and tweaks:
+
+ - Joystick 'Up' no longer thrusts (directions interfered too much with
+ Fire-A control, especially on gamepads)
+ - "GAME OVER" text display bugfix.
+
+
+2001.12.01 (1.0.2)
+ * Makefile tweak
+
+ - Created the 'man/man6/' directory path, if it doesn't exist.
+
+
+2001.12.01 (1.0.1)
+ * Gameplay tweaks:
+ (The screen-size increase, even with the larger objects, made
+ Vectoroids 1.0 much easier than Agendaroids. The changes below make
+ the game more difficult (and hopefully, therefore, more entertaining))
+
+ - Ship's inertia reduces more slowly
+ - Reduced number of bullets allowed on screen to 2
+ - Asteroids have a faster initial speed
+
+
+2001.12.01 (1.0)
+ * Initial port from X-Window interface for Linux PDAs ("Agendaroids")
+ to libSDL for No Starch / Loki contest ("Vectoroids"):
+
+ - X-Window calls replaced with SDL calls.
+ - Added joystick support.
+ - Size increased to 480x480.
+ - Color added.
+ - Background photo added.
+ - Digitized sound effects added.
+ - Music added.
+ - On-screen stylus controls removed.
+ - Ship rotates with more granularity.
+ - Framerate increased.
+ - Command-line options added
+ ("--help", "--usage", "--copying", "--version" displays, and
+ "--fullscreen" and "--nosound" options)
+ - Ship icons in lives-left display at top right shrink when you die.
Index: 1.1.0/COPYING.txt
===================================================================
--- 1.1.0/COPYING.txt (revision 0)
+++ 1.1.0/COPYING.txt (revision 47)
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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.
+
+ 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. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Index: 1.1.0/data/sounds/bullet.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/bullet.wav
===================================================================
--- 1.1.0/data/sounds/bullet.wav (revision 0)
+++ 1.1.0/data/sounds/bullet.wav (revision 47)
/1.1.0/data/sounds/bullet.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/sounds/ast1.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/ast1.wav
===================================================================
--- 1.1.0/data/sounds/ast1.wav (revision 0)
+++ 1.1.0/data/sounds/ast1.wav (revision 47)
/1.1.0/data/sounds/ast1.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/sounds/ast2.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/ast2.wav
===================================================================
--- 1.1.0/data/sounds/ast2.wav (revision 0)
+++ 1.1.0/data/sounds/ast2.wav (revision 47)
/1.1.0/data/sounds/ast2.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/sounds/thrust.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/thrust.wav
===================================================================
--- 1.1.0/data/sounds/thrust.wav (revision 0)
+++ 1.1.0/data/sounds/thrust.wav (revision 47)
/1.1.0/data/sounds/thrust.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/sounds/ast3.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/ast3.wav
===================================================================
--- 1.1.0/data/sounds/ast3.wav (revision 0)
+++ 1.1.0/data/sounds/ast3.wav (revision 47)
/1.1.0/data/sounds/ast3.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/sounds/ast4.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/ast4.wav
===================================================================
--- 1.1.0/data/sounds/ast4.wav (revision 0)
+++ 1.1.0/data/sounds/ast4.wav (revision 47)
/1.1.0/data/sounds/ast4.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/sounds/explode.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/explode.wav
===================================================================
--- 1.1.0/data/sounds/explode.wav (revision 0)
+++ 1.1.0/data/sounds/explode.wav (revision 47)
/1.1.0/data/sounds/explode.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/sounds/extralife.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/extralife.wav
===================================================================
--- 1.1.0/data/sounds/extralife.wav (revision 0)
+++ 1.1.0/data/sounds/extralife.wav (revision 47)
/1.1.0/data/sounds/extralife.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/sounds/gameover.wav
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/sounds/gameover.wav
===================================================================
--- 1.1.0/data/sounds/gameover.wav (revision 0)
+++ 1.1.0/data/sounds/gameover.wav (revision 47)
/1.1.0/data/sounds/gameover.wav
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/music/decision.txt
===================================================================
--- 1.1.0/data/music/decision.txt (revision 0)
+++ 1.1.0/data/music/decision.txt (revision 47)
@@ -0,0 +1,100 @@
+ . .
+ . . . .
+ . : . _ : .
+ : | __ . /\\ | :____
+ _____|_ | // \:/ .\ | | /
+ _/ . |// : \_| _/__
+ \ \____: |__ . _ \ _ \_
+ :\_________/:\_\\ //_/:\____| /:
+ :::::::::::::::::\__/:::::::oMI\_____/::
+
+ - This is the main infomation file for the digital music kings -
+
+ - Member list -
+
+ Acid Rain [Musician/Grafix/Founder/Organizer!%]
+ Hadji [Musician/Co-Organizer/Founder!%]
+ Party [Musician/Whatever he wants to do!]
+ Reefa [Musician]
+ NiteWynd [Musician]
+ Green Cloud Poet [Grafix]
+ Electro Maniac [Musician]
+ Bitbyter [Coder!]
+ Supreme [Grafix]
+ Electron [Coder & BBS (WHQ)]
+ Mhz [Musician]
+ Krystall [Musician!]
+ Hector [Musician]
+
+
+
+If you want to try out for Digital Music Kings, contact one of the leaders
+ Hadji or Acid Rain.
+
+ * = Kicked Out / On Trial
+ ! = Person(s) who can take matter's into there own hands
+
+ % = A Leader of dMk
+
+ If you are interested in joining dMk, E-Mail one of the leaders
+ at the following address(s)
+
+ Acid Rain
+
+ acidrain@suburbia.apana.org.au (Suburbia)
+ acidrain@break.apana.org.au (BreakDownBBS / BDC WHQ)
+
+
+ Hadji
+ hadji@netcom.com
+
+ Mhz
+ mhz@fmmhost.com
+
+ Hector
+ hector@werple.mira.net.au (Werple)
+
+ Electron
+
+ root@break.apana.org.au (BreakDown)
+
+ Bitbyter
+
+ bitbyter@break.apana.org.au (BreakDown)
+
+ Party
+
+ party@suuburbia.apana.org.au (Suburbia)
+ party@break.apana.org.au (BreakDown)
+
+
+ or write to:-->
+
+ (Acid Rain) (Hadji) (Mhz) (Hector)
+ Shane C. Yates. Mike Faltiss. 108 Lay Road, Dirk McKenzie
+ 22 Ireland Ave. 9916 Church Road. Melbourne, Pq 241 Neerim Rd
+ Wantirna Sth. Dallas, TX 75238. CANADA. Carnegie
+ Victoria 3152. USA. Victoria 3163
+ AUSTRALIA. AUSTRALIA
+ Phone Number: +613-887-1313
+
+ Call our BBS':
+
+ Break Down BBS (WHQ!) Area 51 (USHQ!)
+ +613-532-0010 (up to 14.4k) +1-609-737-7980
+ +613-555-2445 (28.8k Line) 14.4k, Great music files!
+ 28.8k/14.4k/9600k/2400k Sysop: Taz [Dua]
+ over a 4 gig files online! Kosmic WHQ!
+ (and still growing fast) DUA WHQ!
+ Sysop: Electron / dMk / BDC RadicalRhythms USHQ!
+
+Info file by: Acid Rain / dMkCall: Bass Kult
+Location: Dallas, TX
+Sysop: Prospect House
+Co-Sysop: Hadji
+For great techno/rave/drug files including .mod, .s3m, .txt, etc...
+For all your tracked music needs.
+Number: (214)240-2017
+
+***Note: Temporily, Bass Kult is only messages. There has been a harddrive
+ crash.***
\ No newline at end of file
Index: 1.1.0/data/music/decision.s3m
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/music/decision.s3m
===================================================================
--- 1.1.0/data/music/decision.s3m (revision 0)
+++ 1.1.0/data/music/decision.s3m (revision 47)
/1.1.0/data/music/decision.s3m
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/images/.xvpics/redspot-e.bmp
===================================================================
--- 1.1.0/data/images/.xvpics/redspot-e.bmp (revision 0)
+++ 1.1.0/data/images/.xvpics/redspot-e.bmp (revision 47)
@@ -0,0 +1,5 @@
+P7 332
+#IMGINFO:240x320 Indexed (77878 bytes)
+#END_OF_COMMENTS
+45 60 255
+ˆ‰ˆÑՉ¨ˆ‰¨Œ©¬©¬Í¬¨­¬‰¨iˆdidhEhdidˆidˆIdihDIdI¬‰¬ÖЅˆˆ­ˆ©¬­Ì­Ð­Ì­±¨¨d‰ˆhidheh‰dh‰dhiDhEheHÕÌ­­hˆ©¬­¬Í°Í±ÐÍѬѬѬ͌©Œ©h‰dˆiˆ‰hd‰hDiDidhiÌѱh…¬­Ð­ÐͬÑÌÍЭÑÌͰɬ­¬­ˆˆ‰ˆˆ‰h…H„IhdiˆEŒEÌ­¬e¬­ÌÕÌÑ­ÐÑðÑÕÐÕñб̩¬­ˆ©l…¬h‰„ihˆehheˆmˆiỈˆ­¬Í°ÑÐÑñÐÕÕõÑÔñÕ°Ñͬ­¨ˆ‰ˆ‰hˆeˆh‰h…hh‰Œi‰leˆ¨ÍЭÐÍôÑÑÐÑÑÐÑÐÕÑÐͱ¬‰¨ˆ‰ˆ‰hˆih©h©hˆˆm‰hI¨­°ÑÍÐÑÐÑÐÍÍ̬ɬ¨ÍÐÑѬˆˆeˆiˆˆ­ˆ­ˆ­ˆ‰Œ‰himD¬Í¬ÑÌÑÕÌÑÐÍ̭ȬɈÈѬѬ‰ˆ‰hi¨ˆ¬©¬‰­Œ‰Œ‰hmiHÐͬÑÑÌÕÐÑÌ̩ͨȨ©¨¬Í¬©hˆ¨­¬­±¬©¬¬i­mˆmiHiЭÌÑÑÐÍЩ̨ȩ¬¤¨©¨¬©¬‰hˆ©°Í±¬­±­°‰­ŒihiHeÌÍбÌÍÌ©¬È¨©¨¨¨…¨ÈŒ©ˆi„¬­­°­­ÐŽ¬­Œ­ŒiHidIÌÑÐͨ¨­È¨©¨¨¨©¨¨¨©ˆˆiˆ©¬­¬Ñ±­±¬Ž¬±¬iˆIdIhDÌÑȌɨ¨­¤¨¨©¨¨¨©ˆˆi„ˆ­¬­­°­±­­°±ˆ‰hiHiDHEÌͨ¨­¨¨¨©¨¨È­¤Œ¤‰h‰h¨­ˆ­±Í‘¬±­±Œ‰h‰HiDId(Ęɬ¨©¨¨ˆÉ¨¬¥ˆˆˆeŒ‰¨ˆ©°­±­±Œ­¬iiŒihiheHE$HȬ©¨¨Í„̈ɨˆ¨…ˆh‰ˆ¨‰Œ©°®¬±­Œ­ˆD‰H‰HiDIDD%¨ˆ©È¨¬¥Œ¤‰¨ˆ„ih­ˆ­ˆ­ˆ­­¬­¬‰¬iŒehihiHdIDI$ ¨ˆ¥¬¨¤‰¨hˆ…hiˆ­¬¨­¬Í¬­Œ‰Œiˆih‰hEhDIDI$D%h„‰ˆˆi„h‰heŒ©°‰ˆˆ©­Œ­ˆ©l‰h‰hh‰l…HiDIDHE$D%$heˆhidˆ‰¬­¬‰ˆ¨ˆ©l…hh‰hdhiˆeHdIhEHD%D$%$ˆ‰Œ‰ˆ©­‰¬­ˆ­±Ñ±¬­h‰h‰h‰ˆ‰l„ihEhDIDIDHE$ %$±Í°©Œ‰ˆiŒ‰ŒÑ²Õ±Õ±­ˆ‰h©l…ŒˆehiDdIDHe(ED$%D ±Ì²Œ‰ˆ±h‰‰Œ‰°ÒµÖ±Õ±­ˆiˆˆˆeˆidHeHDiDID$E$D%$¬‰ˆiˆˆm¨­Õ±Ö±µÒµˆ‰ˆˆiˆidhEhDIdEHDE(D%D$!$$¨i¬ˆiˆ‰¬ÑµÒµ±±Õ‰Œ…l‰heHDidIhDED(AH$%D$!$$h‰ˆi¬iˆˆÍ±±µÑ²°‰ˆh‰leHEHiˆmDEH$ED$E$$%$$ ˆ‰hi¬iˆ­h‰¬±±­±­ˆh‰Œ‰ihIDdmHEDDI$D%D$$%$ !ˆ‰Œ‰ˆ‰Œ…hŒi¨‰hˆ‰ˆŒiDiDHidE(DED$I$$E$ $ ˆ‰ˆˆ„iˆihˆ‰hih„miˆhiHeHdE$HED$EH$E$$% $!h‰h„„mˆ‰h„ihiDhih‰HiDDIDHEDD%HD%D$%$$! h…l„ˆ‰ˆiˆhehIdhiŒiihiDIdHED(EDD)DD%$D $ ˆ‰ˆ‰ˆˆdihEhhiDihiˆIhEhHEd(EDIDD%H$E $$$ ˆ‰ˆ‰ˆhiDhEDiDhiDihheHiDIDDIDDIDD%D$%$$   ˆiˆidHeHdIhEDhiDiHdiDDIDIDDIDDE(D!$$% $%h…HhEDHeHiDdIHehDIDdI$iDDIDDI$E$D$%$$! dIhdIhEhiDHidIdHEHDeHEHEHDIDD%D$%$$ !  DihheHEhHeheHdIDhEHIDiDHED)D$ %$$   $Dih­hIdIhDidIdHeHEHhEHEDHED)$D % $   DihhEhiDiDhEHiDhEHiDIDD)DD%D$$!$ $! !DDIdIDdIDHEhEhHeHIDEHD%D$$%D % $ !  DihDIdIDDiDiHdIDIDHED$%D$ %$$   $$ DId$iDhEHEHidHId%HDE$D$% $$!$$$    DDIDIdHEhEhIhId)DDI $D%$ $$!$     DDIDiDHEhEhIhE(DE$D$!$$$ %$  %$$$ DIDHeHEHDiDID$E$$ E$$ $ $ $%$$$$DIDHEHEhD%DHE$D!$$$$!$$ $!  !  $DIDHEDHE$D%D$$!D$$% $$$!$      DIDDI$D%D$$E (@D $!$  $$ !$ D$EHD%D$%D$ %D$D $ $%$ !    H%D$D!(@$%$D %$$ $%$ !    $$A$$D%$ $$%@$ %$  %$ $ %  $$%$@$%$$ $%$ $   $$$%$$$ $$% $$D$$ $%  $   !$    $$%$ $% $$ !$   $$$$$$$ $$!$@% $$ %$        $ $% $ $$  !$$$$!$%$D$% $$%  !       $ $$  !    !     $ ! $$ $    $  !
\ No newline at end of file
Index: 1.1.0/data/images/.xvpics/redspot-e.jpg
===================================================================
--- 1.1.0/data/images/.xvpics/redspot-e.jpg (revision 0)
+++ 1.1.0/data/images/.xvpics/redspot-e.jpg (revision 47)
@@ -0,0 +1,5 @@
+P7 332
+#IMGINFO:240x320 RGB (4036 bytes)
+#END_OF_COMMENTS
+45 60 255
+DHelŽhDhEhHehhihhihiHdIDHEDHDEDHDEhDIDHED(EDDhIh‰mDhDihhIh‰hihmhiheHHeHDEh$iDDHEHEh$EHDEHDhIˆEHhelhih‰li‰lihh‰lihEhiHDIdHEHdIDHEDDIDHEh‰lEHdmhiˆil‰hiˆmˆih‰hihIhhIhEhHeHDEHDEHDIDIDhihDihmˆil‰ˆmˆˆˆmˆhiHidhIDiHdIDHEHDIdDIHIEhiDhihh‰ŒiŒˆmŒiˆmheHhiDHeHDIdHEHDiDIHi$iDhihiŒiˆmˆˆmˆm‰l‰ŒiˆmdIhHeHHeHDIdHiDiHIhEIHEDhiŒiŒ‰hhˆihˆI„liˆmihDiDHeHHehIhiDIhIhIIDIHhihh‰l‰ˆl‰hh‰dhhel‰hiHhEHdIhEldiHiiHIhEiHIH%h‰liˆmˆˆihh‰hdhidhihHiDiHih‰HihiHiIhIhIIHe(Ihiˆmˆh‰hhdihdhhehDŒEHeHihileliiLiiDmELeIHEHDh‰hhhiˆhD‰HdhdhehhEhDIhhihimihIhiIhMeHiH)EHDh‰ŒhehhidhHdidhdhiHDeHhihiiliiHimhIiHIhEHE(EHh‰hhidhhdhEhdhheHdHEHhiihiliiHmihIiHiDIHEHE$Dh‰H„hiHdhdihhdIdhDIDhiHihmihIimhIhIEHi(EDH%D%hˆEˆHdihdhhEhdHeHDiHiHeliihMihIhIdIHIDIDIDE$$dhihhdihDˆHehDHeHDmDiHihiilIihIhIDIDi(e$HED$%DhdihhdIdhDhEHDihiDiHihmIhiDmiDiHHEHEHEDH%D$%DhdihDhdIdHEDhiHiHihihmEliIHeHiHDIDIDID$I$E$$DHeHDiDHEHDiHihIdHihiIdIhIhDIHEhIDHED$I$E$$EDHEdHEHHihiIhEhIhIdiHDIDiHDIHeHEHDIDD)D$E$$%$DiHdIhiIhiHiHihimiliDIDhEhIDIhDEH$EHD%D(E $%$himhIdMeHIDiHiljlmeHHeHIdIHdID$IDD%HD%$DD%hmiHiElEhIHelimmiliDIhEhHEHDIDDEH$EH%$D%$ $%hIhEHIdIHidmimmhnŒiHIdIDhIDDE(DEDH%D$E$$$%$ $hEhIHiDIhiH‰milnhmIdHiDIDD)DDID$ED$$E$$%$$ %DIhEHhIDihimilmiIhIdIHi$ID$eLE$HE$$E$$D% % DiHDiHiDIhihMiihIdHIiHIDEH$iHED$E($E ( E$ HeHHeHiDIhDIhEhHEhIHiIHED(EDHE$D%$D$%$D$$ DiHHeHeHDIHdIDHEHeHIiHI$d%HD$E$$E$D$%D$ $DHeHEhHEhEHDIDHEHeHIHIDEH$E$D$E$D%$H %$$DHEhIdHIdIDHEHDEHIDiHE(DE$DI$D%D$%D$$%$ DiHdIHiDHEDIDD)dHEHIDD)DEH$D%D$I$D% $$%$DiHdIDIDH%DDDI$i$DIDIDD)DD$E(D%D$E$$%$ DiDHEH$EHDED(e(DEHEDD)D$DE(E$D%D$%$ $ DHEDH%DDID$IDDE(EDH%DD)DD%D(A($E$ $%$DD)d)DDIDHE$IDDID$EH$EH%DD)$D%$D%$  D$iIHDEH$EHEDHED$IDE(DE(DE$E$$$% $$D)dIHEHDEHDE(DEH%DHED$I$ED( ED % $d)DIDHEDID$IDDI$IDD)D$E$D%$$$ $  $DEH$EDH%DD)DDID)DD%H$A( $%$ $  $DI$DID$EH$EHED(ED(E$D%$$ $$!$ $ D$ED(EDH%DEH(EDI$D%D$$% $$ $$! $DE(DED)DDIDI$ID$E$$$$!$$ $  $$DE(DED(EDIDI$D%$D$$!$$ $  $DID%DHE$HE$E$$D$% $$  %  $DI$EDH%D$E$D$%$DD!$ $  $$DI$E$D%H $D%$$ $% $  $  $DE(D%$D% $$$D!$ $ $$ %$D%D$%D$$ %$D$$ %  $  $H!$$$D% $$$ %$   $$ $%D$ $$% $$  $!  $$ %$$ $$ %$ $$ $ $$ %$ $$ !$  $ $ $$$!$ $ $ !$ $ $ $!$$ $ $  $ $  %  $$ $  $! $$ $$   
\ No newline at end of file
Index: 1.1.0/data/images/icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/images/icon.png
===================================================================
--- 1.1.0/data/images/icon.png (revision 0)
+++ 1.1.0/data/images/icon.png (revision 47)
/1.1.0/data/images/icon.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/images/redspot-e.bmp
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/images/redspot-e.bmp
===================================================================
--- 1.1.0/data/images/redspot-e.bmp (revision 0)
+++ 1.1.0/data/images/redspot-e.bmp (revision 47)
/1.1.0/data/images/redspot-e.bmp
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/data/images/redspot.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 1.1.0/data/images/redspot.jpg
===================================================================
--- 1.1.0/data/images/redspot.jpg (revision 0)
+++ 1.1.0/data/images/redspot.jpg (revision 47)
/1.1.0/data/images/redspot.jpg
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 1.1.0/README.txt
===================================================================
--- 1.1.0/README.txt (revision 0)
+++ 1.1.0/README.txt (revision 47)
@@ -0,0 +1,289 @@
+README.txt for "Vectoroids"
+
+(Based on "Agendaroids")
+
+by Bill Kendrick
+bill@newbreedsoftware.com
+http://www.newbreedsoftware.com/vectoroids/
+
+November 30, 2001 - April 20, 2002
+
+Version 1.1.0
+
+
+About:
+------
+ "Vectoroids" is a vector-based rock-shooting game similar to the
+ arcade classic "Asteroids." It is an SDL game based on the source for
+ "Agendaroids," an X-Window game written for the Agenda VR3 Linux-based PDA
+ written by the same author.
+
+ (This game is being entered into the "SDL Game Under 1 Megabyte" contest
+ held by No Starch Press / Loki Entertainment Software in late 2001.)
+
+
+Installation Procedure:
+-----------------------
+ Requirements:
+ -------------
+ "Vectoroids" uses the Simple DirectMedia Layer multimedia library
+ (aka "libSDL"), as well as two helper libraries:
+ "SDL_image" and, optionally (for music and sound) "SDL_mixer".
+
+ All three of these are available from the official SDL website:
+
+ http://www.libsdl.org/
+
+
+ Compilation:
+ ------------
+ To compile the game from its source, simply invoke the command "make":
+
+ $ make
+
+
+ If you wish to build the game with no sound support (ie, SDL_mixer is
+ not available, or you don't have a sound card), you can build the
+ 'nosound' target:
+
+ $ make nosound
+
+
+ If you wish to build the game with no joystick support (ie, you're
+ using a very old version of libSDL, which doesn't support joysticks),
+ you can add the setting "JOY=NO" to the 'make' command. For example:
+
+ $ make JOY=NO
+
+
+ If you wish to have Vectoroids and/or it's data files (sound, music
+ and graphics) installed somewhere other than the default location
+ of "/usr/local/bin/" and "/usr/local/share/vectoroids/", you can
+ override the "PREFIX" and/or "DATA_PREFIX" values used by the Makefile.
+
+ For example:
+
+ $ make PREFIX=/home/username/
+
+ ...will cause the "vectoroids" program to be copied into
+ the directory '/home/username/bin/', the data files copied into
+ the directory '/home/username/share/vectoroids/', and the man pages
+ copied into '/home/username/man/man6/'.
+
+ Or:
+
+ $ make PREFIX=/usr DATA_PREFIX=/opt/games/vectoroids-data/
+
+ ...will cause the program to be copied into '/usr/bin/',
+ the data files into '/opt/games/vectoroids-data/', etc.
+
+ (You can also edit the Makefile manually, if you wish.)
+
+
+ Installation:
+ -------------
+ Once compiled, you must now install the program. You do this
+ by running 'make' with an "install" target.
+
+ If you're copying the files to a directory you can't write into
+ (eg, normal users should not be able to write into "/usr/local/bin/"),
+ you will need to temporarily switch to the 'superuser' (aka "root").
+
+ $ su
+ Password: [enter the root password]
+ # make install
+ # exit
+
+
+ Clean Up:
+ ---------
+ If, for some reason, you wish to keep the unarchived "vectoroids/"
+ directory around, but want to delete the compiled object and program
+ files, you can run:
+
+ make clean
+
+
+Running Vectoroids:
+-------------------
+ Once installed (assuming the directory in which the "vectoroids"
+ program file was copied is listed somewhere in your shell's "$PATH"
+ environment variable; it should be), simply call the program:
+
+ $ vectoroids & [the "&" is optional, and just puts the game's
+ process in the 'background,' so that your terminal
+ remains available for more commands]
+
+
+ Available command-line options:
+
+ Info Options:
+ -------------
+ --help Displays a brief help message explaining the game
+ -h and its controls, and then quits.
+
+ --usage Displays the available command-line options, and
+ -u then quits.
+
+ --version Displays the version of the program which is being
+ -v run, and then quits.
+
+ --copying Displays copyright information, and then quits.
+ -c
+
+
+ Settings:
+ ---------
+ --fullscreen If possible, the game will run in fullscreen mode,
+ -f rather than in a window.
+
+ --nosound Disables sound and music.
+ -q
+
+
+Title Screen:
+-------------
+ The title screen displays the title and credits.
+
+ The high score is displayed at the top of the screen.
+ If a game has been played since loading Vectoroids, the last score
+ is displayed just below. (If it is the same as the high score, it will
+ be blinking.)
+
+ * To begin a game, click the word "START" with the mouse.
+ Unless the "CONTINUE" option is available, pressing [Space] on
+ the keyboard, or pushing any button on the joystick will also start
+ a new game.
+
+ * To continue a paused game, click "CONTINUE" with the mouse.
+ If this option is available, pressing [Space] or pushing a
+ joystick button will also continue the current game.
+
+ * To quit, either close the game's window, or press the [Escape] key
+ on your keyboard. (Note: Any currently-paused game will be saved,
+ so when you run Vectoroids again later, you can continue where you
+ left of.)
+
+
+The Game:
+---------
+ Game Controls:
+ --------------
+ The game can be played with either the keyboard, or a joystick.
+ (The joystick must have at least two axes (directions) and
+ two fire buttons.)
+
+ * [Left] / [Right] on the keyboard
+ [Left] / [Right] on the joystick
+
+ Rotate ship counter-clockwise and clockwise, respectively.
+
+
+ * [Up] on the keyboard
+ [Fire-A] on the joystick
+
+ Thrusts the ship in the direction it is currently facing.
+
+
+ * [Space] on the keyboard
+ [Fire-B] on the joystick
+
+ Fires a bullet in the direction the ship is facing.
+
+
+ * Either [Shift] on the keyboard
+
+ Re-spawns your ship after you die, even if the game thinks there
+ are still too many asteroids near the center of the screen...
+
+
+ Status Display:
+ ---------------
+ The following is displayed at the top of the screen during the game,
+ from left to right:
+
+ * Score
+
+ Your current score.
+
+
+ * Level
+
+ The level of the game you are currently playing.
+
+
+ * Lives
+
+ Miniature spaceships which represent how many extra lives you have left.
+
+
+ Also, sometimes text (for example, what level you are on when you enter
+ a new level) appears on the center of the screen for a moment.
+
+
+ Scoring:
+ --------
+ Each rock you shoot (or crash into) gains you points. The smaller the
+ rock, the more points you gain.
+
+ Every 10,000 points, you also receive an extra ship.
+
+
+ Levels:
+ -------
+ After all rocks have been destroyed, you move on to the next level,
+ which begins with more rocks than the previous started with...
+
+
+Credits:
+--------
+ Programming:
+ ------------
+ Original "Agendaroids":
+ by Bill Kendrick
+ bill@newbreedsoftware.com
+ May 21, 2001 - October 9, 2001 (version of code-base used)
+ http://www.newbreedsoftware.com/agendaroids/
+
+ SDL Port:
+ by Bill Kendrick
+ November 30, 2001 - December 1, 2001
+ http://www.newbreedsoftware.com/vectoroids/
+
+ Graphics:
+ ---------
+ Jupiter photo:
+ Obtained by NASA's Voyager 1 probe - In the Public Domain
+ Photo taken on February 25, 1979
+ http://nssdc.gsfc.nasa.gov/photo_gallery/photogallery-jupiter.html
+ Photo ID: P-2115
+ (Manipulated using The Gimp; http://www.gimp.org/ )
+
+ Game Icon:
+ Bill Kendrick
+
+ Sounds:
+ -------
+ Obtained from various free sound-effect archives on the web.
+ (Some effects altered using Sox, by Chris Bagwell;
+ http://home.sprynet.com/~cbagwell/sox.html )
+
+ Music:
+ ------
+ "Decision" (decision.s3m)
+ by Mike Faltiss (Hadji / Digital Music Kings)
+ deadchannel@hotmail.com
+ April 1995
+
+
+Contact Information:
+--------------------
+ Bill Kendrick
+ 675 Alvarado Ave., Apt. #27
+ Davis, Calif.
+ 95616-0620
+ USA
+
+ Email: bill@newbreedsoftware.com
+ Phone: 530-759-1019
+
Index: 1.1.0/Makefile
===================================================================
--- 1.1.0/Makefile (revision 0)
+++ 1.1.0/Makefile (revision 47)
@@ -0,0 +1,64 @@
+# makefile for Vectoroids
+
+# (Based on Agendaroids)
+
+# by Bill Kendrick
+# bill@newbreedsoftware.com
+# http://www.newbreedsoftware.com/vectoroids/
+
+# November 30, 2001 - April 13, 2002
+
+
+PREFIX=/usr/local
+MAN_PREFIX=$(PREFIX)
+BIN_PREFIX=$(PREFIX)/bin
+DATA_PREFIX=$(PREFIX)/share/vectoroids/
+JOY=YES
+TARGET_DEF=LINUX
+SDL_LIB=$(shell sdl-config --libs) $(MIXER) -lSDL_image
+
+NOSOUNDFLAG=__SOUND
+MIXER=-lSDL_mixer
+
+CFLAGS=-Wall -Wno-long-long -pedantic -ansi -O2 \
+ $(shell sdl-config --cflags) -D$(NOSOUNDFLAG) \
+ -DDATA_PREFIX=\"$(DATA_PREFIX)\" -DJOY_$(JOY) -D$(TARGET_DEF)
+
+
+all: vectoroids
+
+embedded:
+ make vectoroids TARGET_DEF=EMBEDDED MIXER= JOY=NO \
+ DATA_PREFIX=/opt/QtPalmtop/share/vectoroids/ \
+ SDL_LIB="/usr/local/arm/lib/libSDL_mixer.a /usr/local/arm/lib/libSDL.a -L/usr/local/arm/lib/ -lpthread -L/opt/Qtopia/sharp/lib -lqpe -lqte" \
+ CC=/usr/local/arm/bin/arm-linux-gcc
+ /usr/local/arm/bin/arm-linux-strip vectoroids
+
+
+emtest:
+ make vectoroids TARGET_DEF=EMBEDDED
+
+nosound:
+ make vectoroids MIXER= NOSOUNDFLAG=NOSOUND
+
+install:
+ install -d $(DATA_PREFIX)
+ cp -R data/* $(DATA_PREFIX)
+ chmod -R a+rX,g-w,o-w $(DATA_PREFIX)
+ cp vectoroids $(BIN_PREFIX)
+ chmod a+rx,g-w,o-w $(BIN_PREFIX)/vectoroids
+ install -d $(MAN_PREFIX)/man/man6/
+ cp vectoroids.6 $(MAN_PREFIX)/man/man6/
+ chmod a+rx,g-w,o-w $(MAN_PREFIX)/man/man6/vectoroids.6
+
+
+clean:
+ -rm vectoroids
+ -rm *.o
+
+
+vectoroids: vectoroids.o
+ $(CC) $(CFLAGS) vectoroids.o -o vectoroids $(SDL_LIB)
+
+
+vectoroids.o: vectoroids.c
Index: 1.1.0/vectoroids.c
===================================================================
--- 1.1.0/vectoroids.c (revision 0)
+++ 1.1.0/vectoroids.c (revision 47)
@@ -0,0 +1,3014 @@
+/*
+ vectoroids.c
+
+ An asteroid shooting game with vector graphics.
+ Based on "Agendaroids."
+
+ by Bill Kendrick
+ bill@newbreedsoftware.com
+ http://www.newbreedsoftware.com/vectoroids/
+
+ November 30, 2001 - April 20, 2002
+*/
+
+#define VER_VERSION "1.1.0"
+#define VER_DATE "2002.04.20"
+
+#ifndef EMBEDDED
+#define STATE_FORMAT_VERSION "2001.12.01"
+#else
+#define STATE_FORMAT_VERSION "2001.12.01e"
+#endif
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <SDL.h>
+#include <SDL_image.h>
+#ifndef NOSOUND
+#include <SDL_mixer.h>
+#endif
+
+
+#ifndef DATA_PREFIX
+#define DATA_PREFIX "data/"
+#endif
+
+
+/* Constraints: */
+
+#ifndef EMBEDDED
+ #define NUM_BULLETS 2
+#else
+ #define NUM_BULLETS 3
+#endif
+
+#ifndef EMBEDDED
+ #define NUM_ASTEROIDS 20
+ #define NUM_BITS 50
+#else
+ #define NUM_ASTEROIDS 15
+ #define NUM_BITS 25
+#endif
+
+#define AST_SIDES 6
+#ifndef EMBEDDED
+ #define AST_RADIUS 10
+ #define SHIP_RADIUS 20
+#else
+ #define AST_RADIUS 7
+ #define SHIP_RADIUS 12
+#endif
+
+#define ZOOM_START 40
+#define ONEUP_SCORE 10000
+#define FPS 50
+
+#ifndef EMBEDDED
+ #define WIDTH 480
+ #define HEIGHT 480
+#else
+ #define WIDTH 240
+ #define HEIGHT 320
+#endif
+
+
+
+enum { FALSE, TRUE };
+
+#define LEFT_EDGE 0x0001
+#define RIGHT_EDGE 0x0002
+#define TOP_EDGE 0x0004
+#define BOTTOM_EDGE 0x0008
+
+
+/* Types: */
+
+typedef struct letter_type {
+ int x, y;
+ int xm, ym;
+} letter_type;
+
+typedef struct bullet_type {
+ int timer;
+ int x, y;
+ int xm, ym;
+} bullet_type;
+
+typedef struct shape_type {
+ int radius;
+ int angle;
+} shape_type;
+
+typedef struct asteroid_type {
+ int alive, size;
+ int x, y;
+ int xm, ym;
+ int angle, angle_m;
+ shape_type shape[AST_SIDES];
+} asteroid_type;
+
+typedef struct bit_type {
+ int timer;
+ int x, y;
+ int xm, ym;
+} bit_type;
+
+typedef struct color_type {
+ Uint8 r;
+ Uint8 g;
+ Uint8 b;
+} color_type;
+
+
+/* Data: */
+
+enum {
+ SND_BULLET,
+ SND_AST1,
+ SND_AST2,
+ SND_AST3,
+ SND_AST4,
+ SND_THRUST,
+ SND_EXPLODE,
+ SND_GAMEOVER,
+ SND_EXTRALIFE,
+ NUM_SOUNDS
+};
+
+char * sound_names[NUM_SOUNDS] = {
+ DATA_PREFIX "sounds/bullet.wav",
+ DATA_PREFIX "sounds/ast1.wav",
+ DATA_PREFIX "sounds/ast2.wav",
+ DATA_PREFIX "sounds/ast3.wav",
+ DATA_PREFIX "sounds/ast4.wav",
+ DATA_PREFIX "sounds/thrust.wav",
+ DATA_PREFIX "sounds/explode.wav",
+ DATA_PREFIX "sounds/gameover.wav",
+ DATA_PREFIX "sounds/extralife.wav"
+};
+
+#define CHAN_THRUST 0
+
+char * mus_game_name = DATA_PREFIX "music/decision.s3m";
+
+
+#ifdef JOY_YES
+#define JOY_A 0
+#define JOY_B 1
+#define JOY_X 0
+#define JOY_Y 1
+#endif
+
+
+/* Globals: */
+
+SDL_Surface * screen, * bkgd;
+#ifndef NOSOUND
+Mix_Chunk * sounds[NUM_SOUNDS];
+Mix_Music * game_music;
+#endif
+#ifdef JOY_YES
+SDL_Joystick *js;
+#endif
+bullet_type bullets[NUM_BULLETS];
+asteroid_type asteroids[NUM_ASTEROIDS];
+bit_type bits[NUM_BITS];
+int use_sound, use_joystick, fullscreen, text_zoom;
+char zoom_str[24];
+int x, y, xm, ym, angle;
+int player_alive, player_die_timer;
+int lives, score, high, level, game_pending;
+
+
+/* Trig junk: (thanks to Atari BASIC for this) */
+
+int trig[12] = {
+ 1024,
+ 1014,
+ 984,
+ 935,
+ 868,
+ 784,
+ 685,
+ 572,
+ 448,
+ 316,
+ 117,
+ 0
+};
+
+
+/* Characters: */
+
+int char_vectors[36][5][4] = {
+ {
+ /* 0 */
+ { 0, 0, 1, 0 },
+ { 1, 0, 1, 2 },
+ { 1, 2, 0, 2 },
+ { 0, 2, 0, 0 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* 1 */
+ { 1, 0, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* 2 */
+ { 1, 0, 0, 0 },
+ { 1, 0, 1, 1 },
+ { 0, 1, 1, 1 },
+ { 0, 1, 0, 2 },
+ { 1, 2, 0, 2 },
+ },
+
+ {
+ /* 3 */
+ { 0, 0, 1, 0 },
+ { 1, 0, 1, 2 },
+ { 0, 1, 1, 1 },
+ { 0, 2, 1, 2 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* 4 */
+ { 1, 0, 1, 2 },
+ { 0, 0, 0, 1 },
+ { 0, 1, 1, 1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* 5 */
+ { 1, 0, 0, 0 },
+ { 0, 0, 0, 1 },
+ { 0, 1, 1, 1 },
+ { 1, 1, 1, 2 },
+ { 1, 2, 0, 2 }
+ },
+
+ {
+ /* 6 */
+ { 1, 0, 0, 0 },
+ { 0, 0, 0, 2 },
+ { 0, 2, 1, 2 },
+ { 1, 2, 1, 1 },
+ { 1, 1, 0, 1 }
+ },
+
+ {
+ /* 7 */
+ { 0, 0, 1, 0 },
+ { 1, 0, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* 8 */
+ { 0, 0, 1, 0 },
+ { 0, 0, 0, 2 },
+ { 1, 0, 1, 2 },
+ { 0, 2, 1, 2 },
+ { 0, 1, 1, 1 }
+ },
+
+ {
+ /* 9 */
+ { 1, 0, 1, 2 },
+ { 0, 0, 1, 0 },
+ { 0, 0, 0, 1 },
+ { 0, 1, 1, 1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* A */
+ { 0, 2, 0, 1 },
+ { 0, 1, 1, 0 },
+ { 1, 0, 1, 2 },
+ { 0, 1, 1, 1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* B */
+ { 0, 2, 0, 0 },
+ { 0, 0, 1, 0 },
+ { 1, 0, 0, 1 },
+ { 0, 1, 1, 2 },
+ { 1, 2, 0, 2 }
+ },
+
+ {
+ /* C */
+ { 1, 0, 0, 0 },
+ { 0, 0, 0, 2 },
+ { 0, 2, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* D */
+ { 0, 0, 1, 1 },
+ { 1, 1, 0, 2 },
+ { 0, 2, 0, 0 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* E */
+ { 1, 0, 0, 0 },
+ { 0, 0, 0, 2 },
+ { 0, 2, 1, 2 },
+ { 0, 1, 1, 1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* F */
+ { 1, 0, 0, 0 },
+ { 0, 0, 0, 2 },
+ { 0, 1, 1, 1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* G */
+ { 1, 0, 0, 0 },
+ { 0, 0, 0, 2 },
+ { 0, 2, 1, 2 },
+ { 1, 2, 1, 1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* H */
+ { 0, 0, 0, 2 },
+ { 1, 0, 1, 2 },
+ { 0, 1, 1, 1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* I */
+ { 1, 0, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* J */
+ { 1, 0, 1, 2 },
+ { 1, 2, 0, 2 },
+ { 0, 2, 0, 1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* K */
+ { 0, 0, 0, 2 },
+ { 1, 0, 0, 1 },
+ { 0, 1, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* L */
+ { 0, 0, 0, 2 },
+ { 0, 2, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* M */
+ { 0, 0, 0, 2 },
+ { 1, 0, 1, 2 },
+ { 0, 0, 1, 1 },
+ { 0, 1, 1, 0 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* N */
+ { 0, 2, 0, 0 },
+ { 0, 0, 1, 2 },
+ { 1, 2, 1, 0 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* O */
+ { 0, 0, 1, 0 },
+ { 1, 0, 1, 2 },
+ { 1, 2, 0, 2 },
+ { 0, 2, 0, 0 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* P */
+ { 0, 2, 0, 0 },
+ { 0, 0, 1, 0 },
+ { 1, 0, 1, 1 },
+ { 1, 1, 0, 1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* Q */
+ { 0, 0, 1, 0 },
+ { 1, 0, 1, 2 },
+ { 1, 2, 0, 2 },
+ { 0, 2, 0, 0 },
+ { 0, 1, 1, 2 }
+ },
+
+ {
+ /* R */
+ { 0, 2, 0, 0 },
+ { 0, 0, 1, 0 },
+ { 1, 0, 1, 1 },
+ { 1, 1, 0, 1 },
+ { 0, 1, 1, 2 }
+ },
+
+ {
+ /* S */
+ { 1, 0, 0, 0 },
+ { 0, 0, 0, 1 },
+ { 0, 1, 1, 1 },
+ { 1, 1, 1, 2 },
+ { 1, 2, 0, 2 }
+ },
+
+ {
+ /* T */
+ { 0, 0, 1, 0 },
+ { 1, 0, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* U */
+ { 0, 0, 0, 2 },
+ { 0, 2, 1, 2 },
+ { 1, 2, 1, 0 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* V */
+ { 0, 0, 0, 1 },
+ { 0, 1, 1, 2 },
+ { 1, 2, 1, 0 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* W */
+ { 0, 0, 0, 2 },
+ { 1, 0, 1, 2 },
+ { 0, 1, 1, 2 },
+ { 0, 2, 1, 1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* X */
+ { 0, 0, 1, 2 },
+ { 0, 2, 1, 0 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* Y */
+ { 0, 0, 1, 1 },
+ { 1, 0, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ },
+
+ {
+ /* Z */
+ { 0, 0, 1, 0 },
+ { 1, 0, 0, 2 },
+ { 0, 2, 1, 2 },
+ { -1, -1, -1, -1 },
+ { -1, -1, -1, -1 }
+ }
+};
+
+
+
+/* Local function prototypes: */
+
+int title(void);
+int game(void);
+void finish(void);
+void setup(int argc, char * argv[]);
+void seticon(void);
+int fast_cos(int v);
+int fast_sin(int v);
+void draw_line(int x1, int y1, color_type c1,
+ int x2, int y2, color_type c2);
+int clip(int * x1, int * y1, int * x2, int * y2);
+color_type mkcolor(int r, int g, int b);
+void sdl_drawline(int x1, int y1, color_type c1,
+ int x2, int y2, color_type c2);
+unsigned char encode(float x, float y);
+void drawvertline(int x, int y1, color_type c1,
+ int y2, color_type c2);
+void putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel);
+void draw_segment(int r1, int a1,
+ color_type c1,
+ int r2, int a2,
+ color_type c2,
+ int cx, int cy, int ang);
+void add_bullet(int x, int y, int a, int xm, int ym);
+void add_asteroid(int x, int y, int xm, int ym, int size);
+void add_bit(int x, int y, int xm, int ym);
+void draw_asteroid(int size, int x, int y, int angle, shape_type * shape);
+void playsound(int snd);
+void hurt_asteroid(int j, int xm, int ym, int exp_size);
+void add_score(int amount);
+void draw_char(char c, int x, int y, int r, color_type cl);
+void draw_text(char * str, int x, int y, int s, color_type c);
+void draw_thick_line(int x1, int y1, color_type c1,
+ int x2, int y2, color_type c2);
+void reset_level(void);
+void show_version(void);
+void show_usage(FILE * f, char * prg);
+SDL_Surface * set_vid_mode(unsigned flags);
+void draw_centered_text(char * str, int y, int s, color_type c);
+
+
+/* --- MAIN --- */
+
+int main(int argc, char * argv[])
+{
+ int done;
+ FILE * fi;
+ char statefile[256], buf[256];
+
+
+ setup(argc, argv);
+
+
+ /* Set defaults: */
+
+ score = 0;
+ high = 0;
+ game_pending = 0;
+
+
+ /* Load state from disk: */
+
+#ifndef _WIN32
+ /* snprintf(statefile, sizeof(statefile), "%s/.vectoroids-state",
+ getenv("HOME")); */
+ sprintf(statefile, "%s/.vectoroids-state",
+ getenv("HOME"));
+#else
+ sprintf(statefile, "vectoroids-state.dat");
+#endif
+
+ fi = fopen(statefile, "r");
+ if (fi != NULL)
+ {
+ /* Skip comment line: */
+
+ fgets(buf, sizeof(buf), fi);
+
+
+ /* Grab statefile version: */
+
+ fgets(buf, sizeof(buf), fi);
+ buf[strlen(buf) - 1] = '\0';
+
+ if (strcmp(buf, STATE_FORMAT_VERSION) != 0)
+ {
+ fprintf(stderr, "Vectoroids state file format has been updated.\n"
+ "Old game state is unreadable. Sorry!\n");
+ }
+ else
+ {
+ game_pending = fgetc(fi);
+ lives = fgetc(fi);
+ level = fgetc(fi);
+ player_alive = fgetc(fi);
+ player_die_timer = fgetc(fi);
+ fread(&score, sizeof(int), 1, fi);
+ fread(&high, sizeof(int), 1, fi);
+ fread(&x, sizeof(int), 1, fi);
+ fread(&y, sizeof(int), 1, fi);
+ fread(&xm, sizeof(int), 1, fi);
+ fread(&ym, sizeof(int), 1, fi);
+ fread(&angle, sizeof(int), 1, fi);
+ fread(bullets, sizeof(bullet_type), NUM_BULLETS, fi);
+ fread(asteroids, sizeof(asteroid_type), NUM_ASTEROIDS, fi);
+ fread(bits, sizeof(bit_type), NUM_BITS, fi);
+ }
+
+ fclose(fi);
+ }
+
+
+
+ /* Main app loop! */
+
+ do
+ {
+ done = title();
+
+ if (!done)
+ {
+ done = game();
+ }
+ }
+ while (!done);
+
+
+ /* Save state: */
+
+ fi = fopen(statefile, "w");
+ if (fi == NULL)
+ {
+ perror(statefile);
+ }
+ else
+ {
+ fprintf(fi, "Vectoroids State File\n");
+ fprintf(fi, "%s\n", STATE_FORMAT_VERSION);
+
+ fputc(game_pending, fi);
+ fputc(lives, fi);
+ fputc(level, fi);
+ fputc(player_alive, fi);
+ fputc(player_die_timer, fi);
+ fwrite(&score, sizeof(int), 1, fi);
+ fwrite(&high, sizeof(int), 1, fi);
+ fwrite(&x, sizeof(int), 1, fi);
+ fwrite(&y, sizeof(int), 1, fi);
+ fwrite(&xm, sizeof(int), 1, fi);
+ fwrite(&ym, sizeof(int), 1, fi);
+ fwrite(&angle, sizeof(int), 1, fi);
+ fwrite(bullets, sizeof(bullet_type), NUM_BULLETS, fi);
+ fwrite(asteroids, sizeof(asteroid_type), NUM_ASTEROIDS, fi);
+ fwrite(bits, sizeof(bit_type), NUM_BITS, fi);
+
+ fclose(fi);
+ }
+
+ finish();
+
+ return(0);
+}
+
+
+/* Title screen: */
+
+int title(void)
+{
+ int done, quit;
+ int i, snapped, angle, size, counter, x, y, xm, ym, z1, z2, z3;
+ SDL_Event event;
+ SDLKey key;
+ Uint32 now_time, last_time;
+ char * titlestr = "VECTOROIDS";
+ char str[20];
+ letter_type letters[11];
+
+
+ /* Reset letters: */
+
+ snapped = 0;
+
+ for (i = 0; i < strlen(titlestr); i++)
+ {
+ letters[i].x = (rand() % WIDTH);
+ letters[i].y = (rand() % HEIGHT);
+ letters[i].xm = 0;
+ letters[i].ym = 0;
+ }
+
+ x = (rand() % WIDTH);
+ y = (rand() % HEIGHT);
+ xm = (rand() % 4) + 2;
+ ym = (rand() % 10) - 5;
+
+ counter = 0;
+ angle = 0;
+ size = 40;
+
+ done = 0;
+ quit = 0;
+
+ do
+ {
+ last_time = SDL_GetTicks();
+
+ counter++;
+
+
+ /* Rotate rock: */
+
+ angle = ((angle + 2) % 360);
+
+
+ /* Make rock grow: */
+
+ if ((counter % 3) == 0)
+ {
+ if (size > 1)
+ size--;
+ }
+
+
+ /* Move rock: */
+
+ x = x + xm;
+
+ if (x >= WIDTH)
+ x = x - WIDTH;
+
+ y = y + ym;
+
+ if (y >= HEIGHT)
+ y = y - HEIGHT;
+ else if (y < 0)
+ y = y + HEIGHT;
+
+
+ /* Handle events: */
+
+ while (SDL_PollEvent(&event) > 0)
+ {
+ if (event.type == SDL_QUIT)
+ {
+ done = 1;
+ quit = 1;
+ }
+ else if (event.type == SDL_KEYDOWN)
+ {
+ key = event.key.keysym.sym;
+
+ if (key == SDLK_SPACE)
+ {
+ done = 1;
+ }
+ else if (key == SDLK_ESCAPE)
+ {
+ done = 1;
+ quit = 1;
+ }
+ }
+#ifdef JOY_YES
+ else if (event.type == SDL_JOYBUTTONDOWN)
+ {
+ done = 1;
+ }
+#endif
+ else if (event.type == SDL_MOUSEBUTTONDOWN)
+ {
+ if (event.button.x >= (WIDTH - 50) / 2 &&
+ event.button.x <= (WIDTH + 50) / 2 &&
+ event.button.y >= 180 && event.button.y <= 195)
+ {
+ /* Start! */
+
+ game_pending = 0;
+ done = 1;
+ }
+ else if (event.button.x >= (WIDTH - 80) / 2 &&
+ event.button.x <= (WIDTH + 80) / 2 &&
+ event.button.y >= 200 && event.button.y <= 215 &&
+ game_pending)
+ {
+ done = 1;
+ }
+ }
+ }
+
+
+ /* Move title characters: */
+
+ if (snapped < strlen(titlestr))
+ {
+ for (i = 0; i < strlen(titlestr); i++)
+ {
+ letters[i].x = letters[i].x + letters[i].xm;
+ letters[i].y = letters[i].y + letters[i].ym;
+
+
+ /* Home in on final spot! */
+
+ if (letters[i].x > ((WIDTH - (strlen(titlestr) * 14)) / 2 +
+ (i * 14)) &&
+ letters[i].xm > -4)
+ letters[i].xm--;
+ else if (letters[i].x < ((WIDTH - (strlen(titlestr) * 14)) / 2 +
+ (i * 14)) &&
+ letters[i].xm < 4)
+ letters[i].xm++;
+
+ if (letters[i].y > 100 && letters[i].ym > -4)
+ letters[i].ym--;
+ else if (letters[i].y < 100 && letters[i].ym < 4)
+ letters[i].ym++;
+
+
+ /* Snap into place: */
+
+ if (letters[i].x >= ((WIDTH - (strlen(titlestr) * 14)) / 2 +
+ (i * 14)) - 8 &&
+ letters[i].x <= ((WIDTH - (strlen(titlestr) * 14)) / 2 +
+ (i * 14)) + 8 &&
+ letters[i].y >= 92 &&
+ letters[i].y <= 108 &&
+ (letters[i].xm != 0 ||
+ letters[i].ym != 0))
+ {
+ letters[i].x = ((WIDTH - (strlen(titlestr) * 14)) / 2 + (i * 14));
+ letters[i].xm = 0;
+
+ letters[i].y = 100;
+ letters[i].ym = 0;
+
+ snapped++;
+ }
+ }
+ }
+
+
+ /* Draw screen: */
+
+ /* (Erase first) */
+
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+
+
+ /* (Title) */
+
+ if (snapped != strlen(titlestr))
+ {
+ for (i = 0; i < strlen(titlestr); i++)
+ {
+ draw_char(titlestr[i], letters[i].x, letters[i].y, 10,
+ mkcolor(255, 255, 255));
+ }
+ }
+ else
+ {
+ for (i = 0; i < strlen(titlestr); i++)
+ {
+ z1 = (i + counter) % 255;
+ z2 = ((i + counter + 128) * 2) % 255;
+ z3 = ((i + counter) * 5) % 255;
+
+ draw_char(titlestr[i], letters[i].x, letters[i].y, 10,
+ mkcolor(z1, z2, z3));
+ }
+ }
+
+
+ /* (Credits) */
+
+ if (snapped == strlen(titlestr))
+ {
+ draw_centered_text("BY BILL KENDRICK", 140, 5,
+ mkcolor(128, 128,128));
+ draw_centered_text("NEW BREED SOFTWARE", 155, 5,
+ mkcolor(96, 96, 96));
+
+ sprintf(str, "HIGH %.6d", high);
+ draw_text(str, (WIDTH - 110) / 2, 5, 5, mkcolor(128, 255, 255));
+ draw_text(str, (WIDTH - 110) / 2 + 1, 6, 5, mkcolor(128, 255, 255));
+
+ if (score != 0 && (score != high || (counter % 20) < 10))
+ {
+ if (game_pending == 0)
+ sprintf(str, "LAST %.6d", score);
+ else
+ sprintf(str, "SCR %.6d", score);
+ draw_text(str, (WIDTH - 110) / 2, 25, 5, mkcolor(128, 128, 255));
+ draw_text(str, (WIDTH - 110) / 2 + 1, 26, 5, mkcolor(128, 128, 255));
+ }
+ }
+
+
+ draw_text("START", (WIDTH - 50) / 2, 180, 5, mkcolor(0, 255, 0));
+
+ if (game_pending)
+ draw_text("CONTINUE", (WIDTH - 80) / 2, 200, 5, mkcolor(0, 255, 0));
+
+
+ /* (Giant rock) */
+
+ draw_segment(40 / size, 0, mkcolor(255, 255, 255),
+ 30 / size, 30, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(30 / size, 30, mkcolor(255, 255, 255),
+ 40 / size, 55, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(40 / size, 55, mkcolor(255, 255, 255),
+ 25 / size, 90, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(25 / size, 90, mkcolor(255, 255, 255),
+ 40 / size, 120, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(40 / size, 120, mkcolor(255, 255, 255),
+ 35 / size, 130, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(35 / size, 130, mkcolor(255, 255, 255),
+ 40 / size, 160, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(40 / size, 160, mkcolor(255, 255, 255),
+ 30 / size, 200, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(30 / size, 200, mkcolor(255, 255, 255),
+ 45 / size, 220, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(45 / size, 220, mkcolor(255, 255, 255),
+ 25 / size, 265, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(25 / size, 265, mkcolor(255, 255, 255),
+ 30 / size, 300, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(30 / size, 300, mkcolor(255, 255, 255),
+ 45 / size, 335, mkcolor(255, 255, 255),
+ x, y, angle);
+ draw_segment(45 / size, 335, mkcolor(255, 255, 255),
+ 40 / size, 0, mkcolor(255, 255, 255),
+ x, y, angle);
+
+
+ /* Flush and pause! */
+
+ SDL_Flip(screen);
+
+ now_time = SDL_GetTicks();
+
+ if (now_time < last_time + (1000 / FPS))
+ {
+ SDL_Delay(last_time + 1000 / FPS - now_time);
+ }
+ }
+ while (!done);
+
+ return(quit);
+}
+
+
+
+/* --- GAME --- */
+
+int game(void)
+{
+ int done, quit, counter;
+ int i, j;
+ int num_asteroids_alive;
+ SDL_Event event;
+ SDLKey key;
+ int left_pressed, right_pressed, up_pressed, shift_pressed;
+ char str[10];
+ Uint32 now_time, last_time;
+
+
+ done = 0;
+ quit = 0;
+ counter = 0;
+
+ left_pressed = 0;
+ right_pressed = 0;
+ up_pressed = 0;
+ shift_pressed = 0;
+
+ if (game_pending == 0)
+ {
+ lives = 3;
+ score = 0;
+
+ player_alive = 1;
+ player_die_timer = 0;
+ angle = 90;
+ x = (WIDTH / 2) << 4;
+ y = (HEIGHT / 2) << 4;
+ xm = 0;
+ ym = 0;
+
+ level = 1;
+ reset_level();
+ }
+
+ game_pending = 1;
+
+
+ /* Hide mouse cursor: */
+
+ if (fullscreen)
+ SDL_ShowCursor(0);
+
+
+ /* Play music: */
+
+#ifndef NOSOUND
+ if (use_sound)
+ {
+ if (!Mix_PlayingMusic())
+ Mix_PlayMusic(game_music, -1);
+ }
+#endif
+
+
+ do
+ {
+ last_time = SDL_GetTicks();
+ counter++;
+
+
+ /* Handle events: */
+
+ while (SDL_PollEvent(&event) > 0)
+ {
+ if (event.type == SDL_QUIT)
+ {
+ /* Quit! */
+
+ done = 1;
+ quit = 1;
+ }
+ else if (event.type == SDL_KEYDOWN ||
+ event.type == SDL_KEYUP)
+ {
+ key = event.key.keysym.sym;
+
+ if (event.type == SDL_KEYDOWN)
+ {
+ if (key == SDLK_ESCAPE)
+ {
+ /* Return to menu! */
+
+ done = 1;
+ }
+
+
+ /* Key press... */
+
+ if (key == SDLK_RIGHT)
+ {
+ /* Rotate CW */
+
+ left_pressed = 0;
+ right_pressed = 1;
+ }
+ else if (key == SDLK_LEFT)
+ {
+ /* Rotate CCW */
+
+ left_pressed = 1;
+ right_pressed = 0;
+ }
+ else if (key == SDLK_UP)
+ {
+ /* Thrust! */
+
+ up_pressed = 1;
+ }
+ else if ((key == SDLK_SPACE) &&
+ player_alive)
+ {
+ /* Fire a bullet! */
+
+ add_bullet(x >> 4, y >> 4, angle, xm, ym);
+ }
+
+ if (key == SDLK_LSHIFT ||
+ key == SDLK_RSHIFT)
+ {
+ /* Respawn now (if applicable) */
+
+ shift_pressed = 1;
+ }
+ }
+ else if (event.type == SDL_KEYUP)
+ {
+ /* Key release... */
+
+ if (key == SDLK_RIGHT)
+ {
+ right_pressed = 0;
+ }
+ else if (key == SDLK_LEFT)
+ {
+ left_pressed = 0;
+ }
+ else if (key == SDLK_UP)
+ {
+ up_pressed = 0;
+ }
+
+ if (key == SDLK_LSHIFT ||
+ key == SDLK_RSHIFT)
+ {
+ /* Respawn now (if applicable) */
+
+ shift_pressed = 0;
+ }
+ }
+ }
+#ifdef JOY_YES
+ else if (event.type == SDL_JOYBUTTONDOWN &&
+ player_alive)
+ {
+ if (event.jbutton.button == JOY_B)
+ {
+ /* Fire a bullet! */
+
+ add_bullet(x >> 4, y >> 4, angle, xm, ym);
+ }
+ else if (event.jbutton.button == JOY_A)
+ {
+ /* Thrust: */
+
+ up_pressed = 1;
+ }
+ else
+ {
+ shift_pressed = 1;
+ }
+ }
+ else if (event.type == SDL_JOYBUTTONUP)
+ {
+ if (event.jbutton.button == JOY_A)
+ {
+ /* Stop thrust: */
+
+ up_pressed = 0;
+ }
+ else if (event.jbutton.button != JOY_B)
+ {
+ shift_pressed = 0;
+ }
+ }
+ else if (event.type == SDL_JOYAXISMOTION)
+ {
+ if (event.jaxis.axis == JOY_X)
+ {
+ if (event.jaxis.value < -256)
+ {
+ left_pressed = 1;
+ right_pressed = 0;
+ }
+ else if (event.jaxis.value > 256)
+ {
+ left_pressed = 0;
+ right_pressed = 1;
+ }
+ else
+ {
+ left_pressed = 0;
+ right_pressed = 0;
+ }
+ }
+ }
+#endif
+ }
+
+
+ /* Rotate ship: */
+
+ if (right_pressed)
+ {
+ angle = angle - 8;
+ if (angle < 0)
+ angle = angle + 360;
+ }
+ else if (left_pressed)
+ {
+ angle = angle + 8;
+ if (angle >= 360)
+ angle = angle - 360;
+ }
+
+
+ /* Thrust ship: */
+
+ if (up_pressed && player_alive)
+ {
+ /* Move forward: */
+
+ xm = xm + ((fast_cos(angle >> 3) * 3) >> 10);
+ ym = ym - ((fast_sin(angle >> 3) * 3) >> 10);
+
+
+ /* Start thruster sound: */
+#ifndef NOSOUND
+ if (use_sound)
+ {
+ if (!Mix_Playing(CHAN_THRUST))
+ {
+#ifndef EMBEDDED
+ Mix_PlayChannel(CHAN_THRUST, sounds[SND_THRUST], -1);
+#else
+ Mix_PlayChannel(-1, sounds[SND_THRUST], 0);
+#endif
+ }
+ }
+#endif
+ }
+ else
+ {
+ /* Slow down (unrealistic, but.. feh!) */
+
+ if ((counter % 20) == 0)
+ {
+ xm = (xm * 7) / 8;
+ ym = (ym * 7) / 8;
+ }
+
+
+ /* Stop thruster sound: */
+
+#ifndef NOSOUND
+ if (use_sound)
+ {
+ if (Mix_Playing(CHAN_THRUST))
+ {
+#ifndef EMBEDDED
+ Mix_HaltChannel(CHAN_THRUST);
+#endif
+ }
+ }
+#endif
+ }
+
+
+ /* Handle player death: */
+
+ if (player_alive == 0)
+ {
+ player_die_timer--;
+
+ if (player_die_timer <= 0)
+ {
+ if (lives > 0)
+ {
+ /* Reset player: */
+
+ player_die_timer = 0;
+ angle = 90;
+ x = (WIDTH / 2) << 4;
+ y = (HEIGHT / 2) << 4;
+ xm = 0;
+ ym = 0;
+
+
+ /* Only bring player back when it's alright to! */
+
+ player_alive = 1;
+
+ if (!shift_pressed)
+ {
+ for (i = 0; i < NUM_ASTEROIDS && player_alive; i++)
+ {
+ if (asteroids[i].alive)
+ {
+ if (asteroids[i].x >= (x >> 4) - (WIDTH / 5) &&
+ asteroids[i].x <= (x >> 4) + (WIDTH / 5) &&
+ asteroids[i].y >= (y >> 4) - (HEIGHT / 5) &&
+ asteroids[i].y <= (y >> 4) + (HEIGHT / 5))
+ {
+ /* If any asteroid is too close for comfort,
+ don't bring ship back yet! */
+
+ player_alive = 0;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ done = 1;
+ game_pending = 0;
+ }
+ }
+ }
+
+
+ /* Erase screen: */
+
+ SDL_BlitSurface(bkgd, NULL, screen, NULL);
+
+
+ /* Move ship: */
+
+ x = x + xm;
+ y = y + ym;
+
+
+ /* Wrap ship around edges of screen: */
+
+ if (x >= (WIDTH << 4))
+ x = x - (WIDTH << 4);
+ else if (x < 0)
+ x = x + (WIDTH << 4);
+
+ if (y >= (HEIGHT << 4))
+ y = y - (HEIGHT << 4);
+ else if (y < 0)
+ y = y + (HEIGHT << 4);
+
+
+ /* Move bullets: */
+
+ for (i = 0; i < NUM_BULLETS; i++)
+ {
+ if (bullets[i].timer >= 0)
+ {
+ /* Bullet wears out: */
+
+ bullets[i].timer--;
+
+
+ /* Move bullet: */
+
+ bullets[i].x = bullets[i].x + bullets[i].xm;
+ bullets[i].y = bullets[i].y + bullets[i].ym;
+
+
+ /* Wrap bullet around edges of screen: */
+
+ if (bullets[i].x >= WIDTH)
+ bullets[i].x = bullets[i].x - WIDTH;
+ else if (bullets[i].x < 0)
+ bullets[i].x = bullets[i].x + WIDTH;
+
+ if (bullets[i].y >= HEIGHT)
+ bullets[i].y = bullets[i].y - HEIGHT;
+ else if (bullets[i].y < 0)
+ bullets[i].y = bullets[i].y + HEIGHT;
+
+
+ /* Check for collision with any asteroids! */
+
+ for (j = 0; j < NUM_ASTEROIDS; j++)
+ {
+ if (bullets[i].timer > 0 && asteroids[j].alive)
+ {
+ if ((bullets[i].x + 5 >=
+ asteroids[j].x - asteroids[j].size * AST_RADIUS) &&
+ (bullets[i].x - 5<=
+ asteroids[j].x + asteroids[j].size * AST_RADIUS) &&
+ (bullets[i].y + 5 >=
+ asteroids[j].y - asteroids[j].size * AST_RADIUS) &&
+ (bullets[i].y - 5 <=
+ asteroids[j].y + asteroids[j].size * AST_RADIUS))
+ {
+ /* Remove bullet! */
+
+ bullets[i].timer = 0;
+
+
+ hurt_asteroid(j, bullets[i].xm, bullets[i].ym,
+ asteroids[j].size * 3);
+ }
+ }
+ }
+ }
+ }
+
+
+ /* Move asteroids: */
+
+ num_asteroids_alive = 0;
+
+ for (i = 0; i < NUM_ASTEROIDS; i++)
+ {
+ if (asteroids[i].alive)
+ {
+ num_asteroids_alive++;
+
+ /* Move asteroid: */
+
+ if ((counter % 4) == 0)
+ {
+ asteroids[i].x = asteroids[i].x + asteroids[i].xm;
+ asteroids[i].y = asteroids[i].y + asteroids[i].ym;
+ }
+
+
+ /* Wrap asteroid around edges of screen: */
+
+ if (asteroids[i].x >= WIDTH)
+ asteroids[i].x = asteroids[i].x - WIDTH;
+ else if (asteroids[i].x < 0)
+ asteroids[i].x = asteroids[i].x + WIDTH;
+
+ if (asteroids[i].y >= HEIGHT)
+ asteroids[i].y = asteroids[i].y - HEIGHT;
+ else if (asteroids[i].y < 0)
+ asteroids[i].y = asteroids[i].y + HEIGHT;
+
+
+ /* Rotate asteroid: */
+
+ asteroids[i].angle = (asteroids[i].angle +
+ asteroids[i].angle_m);
+
+
+ /* Wrap rotation angle... */
+
+ if (asteroids[i].angle < 0)
+ asteroids[i].angle = asteroids[i].angle + 360;
+ else if (asteroids[i].angle >= 360)
+ asteroids[i].angle = asteroids[i].angle - 360;
+
+
+ /* See if we collided with the player: */
+
+ if (asteroids[i].x >= (x >> 4) - SHIP_RADIUS &&
+ asteroids[i].x <= (x >> 4) + SHIP_RADIUS &&
+ asteroids[i].y >= (y >> 4) - SHIP_RADIUS &&
+ asteroids[i].y <= (y >> 4) + SHIP_RADIUS &&
+ player_alive)
+ {
+ hurt_asteroid(i, xm >> 4, ym >> 4, NUM_BITS);
+
+ player_alive = 0;
+ player_die_timer = 30;
+
+ playsound(SND_EXPLODE);
+
+ /* Stop thruster sound: */
+
+#ifndef NOSOUND
+ if (use_sound)
+ {
+ if (Mix_Playing(CHAN_THRUST))
+ {
+#ifndef EMBEDDED
+ Mix_HaltChannel(CHAN_THRUST);
+#endif
+ }
+ }
+#endif
+
+ lives--;
+
+ if (lives == 0)
+ {
+#ifndef NOSOUND
+ if (use_sound)
+ {
+ playsound(SND_GAMEOVER);
+ playsound(SND_GAMEOVER);
+ playsound(SND_GAMEOVER);
+ /* Mix_PlayChannel(CHAN_THRUST,
+ sounds[SND_GAMEOVER], 0); */
+ }
+#endif
+ player_die_timer = 100;
+ }
+ }
+ }
+ }
+
+
+ /* Move bits: */
+
+ for (i = 0; i < NUM_BITS; i++)
+ {
+ if (bits[i].timer > 0)
+ {
+ /* Countdown bit's lifespan: */
+
+ bits[i].timer--;
+
+
+ /* Move the bit: */
+
+ bits[i].x = bits[i].x + bits[i].xm;
+ bits[i].y = bits[i].y + bits[i].ym;
+
+
+ /* Wrap bit around edges of screen: */
+
+ if (bits[i].x >= WIDTH)
+ bits[i].x = bits[i].x - WIDTH;
+ else if (bits[i].x < 0)
+ bits[i].x = bits[i].x + WIDTH;
+
+ if (bits[i].y >= HEIGHT)
+ bits[i].y = bits[i].y - HEIGHT;
+ else if (bits[i].y < 0)
+ bits[i].y = bits[i].y + HEIGHT;
+ }
+ }
+
+
+ /* Draw ship: */
+
+ if (player_alive)
+ {
+ draw_segment(SHIP_RADIUS, 0, mkcolor(128, 128, 255),
+ SHIP_RADIUS / 2, 135, mkcolor(0, 0, 192),
+ x >> 4, y >> 4,
+ angle);
+
+ draw_segment(SHIP_RADIUS / 2, 135, mkcolor(0, 0, 192),
+ 0, 0, mkcolor(64, 64, 230),
+ x >> 4, y >> 4,
+ angle);
+
+ draw_segment(0, 0, mkcolor(64, 64, 230),
+ SHIP_RADIUS / 2, 225, mkcolor(0, 0, 192),
+ x >> 4, y >> 4,
+ angle);
+
+ draw_segment(SHIP_RADIUS / 2, 225, mkcolor(0, 0, 192),
+ SHIP_RADIUS, 0, mkcolor(128, 128, 255),
+ x >> 4, y >> 4,
+ angle);
+
+
+ /* Draw flame: */
+
+ if (up_pressed)
+ {
+#ifndef EMBEDDED
+ draw_segment(0, 0, mkcolor(255, 255, 255),
+ (rand() % 20), 180, mkcolor(255, 0, 0),
+ x >> 4, y >> 4,
+ angle);
+#else
+ i = (rand() % 128) + 128;
+
+ draw_segment(0, 0, mkcolor(255, i, i),
+ (rand() % 20), 180, mkcolor(255, i, i),
+ x >> 4, y >> 4,
+ angle);
+#endif
+ }
+ }
+
+
+ /* Draw bullets: */
+
+ for (i = 0; i < NUM_BULLETS; i++)
+ {
+ if (bullets[i].timer >= 0)
+ {
+ draw_line(bullets[i].x - (rand() % 3) - bullets[i].xm * 2,
+ bullets[i].y - (rand() % 3) - bullets[i].ym * 2,
+ mkcolor((rand() % 3) * 128,
+ (rand() % 3) * 128,
+ (rand() % 3) * 128),
+ bullets[i].x + (rand() % 3) - bullets[i].xm * 2,
+ bullets[i].y + (rand() % 3) - bullets[i].ym * 2,
+ mkcolor((rand() % 3) * 128,
+ (rand() % 3) * 128,
+ (rand() % 3) * 128));
+
+ draw_line(bullets[i].x + (rand() % 3) - bullets[i].xm * 2,
+ bullets[i].y - (rand() % 3) - bullets[i].ym * 2,
+ mkcolor((rand() % 3) * 128,
+ (rand() % 3) * 128,
+ (rand() % 3) * 128),
+ bullets[i].x - (rand() % 3) - bullets[i].xm * 2,
+ bullets[i].y + (rand() % 3) - bullets[i].ym * 2,
+ mkcolor((rand() % 3) * 128,
+ (rand() % 3) * 128,
+ (rand() % 3) * 128));
+
+
+
+ draw_thick_line(bullets[i].x - (rand() % 5),
+ bullets[i].y - (rand() % 5),
+ mkcolor((rand() % 3) * 128 + 64,
+ (rand() % 3) * 128 + 64,
+ (rand() % 3) * 128 + 64),
+ bullets[i].x + (rand() % 5),
+ bullets[i].y + (rand() % 5),
+ mkcolor((rand() % 3) * 128 + 64,
+ (rand() % 3) * 128 + 64,
+ (rand() % 3) * 128 + 64));
+
+ draw_thick_line(bullets[i].x + (rand() % 5),
+ bullets[i].y - (rand() % 5),
+ mkcolor((rand() % 3) * 128 + 64,
+ (rand() % 3) * 128 + 64,
+ (rand() % 3) * 128 + 64),
+ bullets[i].x - (rand() % 5),
+ bullets[i].y + (rand() % 5),
+ mkcolor((rand() % 3) * 128 + 64,
+ (rand() % 3) * 128 + 64,
+ (rand() % 3) * 128 + 64));
+ }
+ }
+
+
+ /* Draw asteroids: */
+
+ for (i = 0; i < NUM_ASTEROIDS; i++)
+ {
+ if (asteroids[i].alive)
+ {
+ draw_asteroid(asteroids[i].size,
+ asteroids[i].x, asteroids[i].y,
+ asteroids[i].angle,
+ asteroids[i].shape);
+ }
+ }
+
+
+ /* Draw bits: */
+
+ for (i = 0; i < NUM_BITS; i++)
+ {
+ if (bits[i].timer > 0)
+ {
+ draw_line(bits[i].x, bits[i].y, mkcolor(255, 255, 255),
+ bits[i].x + bits[i].xm,
+ bits[i].y + bits[i].ym, mkcolor(255, 255, 255));
+ }
+ }
+
+
+ /* Draw score: */
+
+#ifndef EMBEDDED
+ sprintf(str, "%.6d", score);
+ draw_text(str, 3, 3, 14, mkcolor(255, 255, 255));
+ draw_text(str, 4, 4, 14, mkcolor(255, 255, 255));
+#else
+ sprintf(str, "%.6d", score);
+ draw_text(str, 3, 3, 10, mkcolor(255, 255, 255));
+ draw_text(str, 4, 4, 10, mkcolor(255, 255, 255));
+#endif
+
+
+ /* Level: */
+
+#ifndef EMBEDDED
+ sprintf(str, "%d", level);
+ draw_text(str, (WIDTH - 14) / 2, 3, 14, mkcolor(255, 255, 255));
+ draw_text(str, (WIDTH - 14) / 2 + 1, 4, 14, mkcolor(255, 255, 255));
+#else
+ sprintf(str, "%d", level);
+ draw_text(str, (WIDTH - 14) / 2, 3, 10, mkcolor(255, 255, 255));
+ draw_text(str, (WIDTH - 14) / 2 + 1, 4, 10, mkcolor(255, 255, 255));
+#endif
+
+
+ /* Draw lives: */
+
+ for (i = 0; i < lives; i++)
+ {
+ draw_segment(16, 0, mkcolor(255, 255, 255),
+ 4, 135, mkcolor(255, 255, 255),
+ WIDTH - 10 - i * 10, 20,
+ 90);
+
+ draw_segment(8, 135, mkcolor(255, 255, 255),
+ 0, 0, mkcolor(255, 255, 255),
+ WIDTH - 10 - i * 10, 20,
+ 90);
+
+ draw_segment(0, 0, mkcolor(255, 255, 255),
+ 8, 225, mkcolor(255, 255, 255),
+ WIDTH - 10 - i * 10, 20,
+ 90);
+
+ draw_segment(8, 225, mkcolor(255, 255, 255),
+ 16, 0, mkcolor(255, 255, 255),
+ WIDTH - 10 - i * 10, 20,
+ 90);
+ }
+
+
+ if (player_die_timer > 0)
+ {
+ if (player_die_timer > 30)
+ j = 30;
+ else
+ j = player_die_timer;
+
+ draw_segment((16 * j) / 30, 0, mkcolor(255, 255, 255),
+ (4 * j) / 30, 135, mkcolor(255, 255, 255),
+ WIDTH - 10 - i * 10, 20,
+ 90);
+
+ draw_segment((8 * j) / 30, 135, mkcolor(255, 255, 255),
+ 0, 0, mkcolor(255, 255, 255),
+ WIDTH - 10 - i * 10, 20,
+ 90);
+
+ draw_segment(0, 0, mkcolor(255, 255, 255),
+ (8 * j) / 30, 225, mkcolor(255, 255, 255),
+ WIDTH - 10 - i * 10, 20,
+ 90);
+
+ draw_segment((8 * j) / 30, 225, mkcolor(255, 255, 255),
+ (16 * j) / 30, 0, mkcolor(255, 255, 255),
+ WIDTH - 10 - i * 10, 20,
+ 90);
+
+ }
+
+
+ /* Zooming level effect: */
+
+ if (text_zoom > 0)
+ {
+ if ((counter % 2) == 0)
+ text_zoom--;
+
+#ifndef EMBEDDED
+ draw_text(zoom_str, (WIDTH - (strlen(zoom_str) * text_zoom)) / 2,
+ (HEIGHT - text_zoom) / 2,
+ text_zoom, mkcolor(text_zoom * (256 / ZOOM_START), 0, 0));
+#else
+ draw_text(zoom_str, (WIDTH - (strlen(zoom_str) * text_zoom)) / 2,
+ (HEIGHT - text_zoom) / 2,
+ text_zoom, mkcolor(text_zoom * (256 / ZOOM_START), 128, 128));
+#endif
+ }
+
+
+ /* Game over? */
+
+ if (player_alive == 0 && lives == 0)
+ {
+ if (player_die_timer > 14)
+ {
+ draw_text("GAME OVER",
+ (WIDTH - 9 * player_die_timer) / 2,
+ (HEIGHT - player_die_timer) / 2,
+ player_die_timer,
+ mkcolor(rand() % 255,
+ rand() % 255,
+ rand() % 255));
+ }
+ else
+ {
+ draw_text("GAME OVER",
+ (WIDTH - 9 * 14) / 2,
+ (HEIGHT - 14) / 2,
+ 14,
+ mkcolor(255, 255, 255));
+
+ }
+ }
+
+
+ /* Go to next level? */
+
+ if (num_asteroids_alive == 0)
+ {
+ level++;
+
+ reset_level();
+ }
+
+
+ /* Flush and pause! */
+
+ SDL_Flip(screen);
+
+ now_time = SDL_GetTicks();
+
+ if (now_time < last_time + (1000 / FPS))
+ {
+ SDL_Delay(last_time + 1000 / FPS - now_time);
+ }
+ }
+ while (!done);
+
+
+ /* Record, if a high score: */
+
+ if (score >= high)
+ {
+ high = score;
+ }
+
+
+ /* Display mouse cursor: */
+
+ if (fullscreen)
+ SDL_ShowCursor(1);
+
+
+ return(quit);
+}
+
+
+void finish(void)
+{
+ SDL_Quit();
+}
+
+
+void setup(int argc, char * argv[])
+{
+ int i;
+ SDL_Surface * tmp;
+
+
+ /* Options: */
+
+ score = 0;
+ use_sound = TRUE;
+ fullscreen = FALSE;
+
+
+ /* Check command-line options: */
+
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp(argv[i], "--fullscreen") == 0 ||
+ strcmp(argv[i], "-f") == 0)
+ {
+ fullscreen = TRUE;
+ }
+ else if (strcmp(argv[i], "--nosound") == 0 ||
+ strcmp(argv[i], "-q") == 0)
+ {
+ use_sound = FALSE;
+ }
+ else if (strcmp(argv[i], "--help") == 0 ||
+ strcmp(argv[i], "-h") == 0)
+ {
+ show_version();
+
+ printf("\n"
+ "Programming: Bill Kendrick, New Breed Software - bill@newbreedsoftware.com\n"
+ "Music: Mike Faltiss (Hadji/Digital Music Kings) - deadchannel@hotmail.com\n"
+ "\n"
+ "Keyboard controls:\n"
+ " Left/Right - Rotate ship\n"
+ " Up - Thrust engines\n"
+ " Space - Fire weapons\n"
+ " Shift - Respawn after death (or wait)\n"
+ " Escape - Return to title screen\n"
+ "\n"
+ "Joystick controls:\n"
+ " Left/Right - Rotate ship\n"
+ " Fire-A - Thrust engines\n"
+ " Fire-B - Fire weapons\n"
+ "\n"
+ "Run with \"--usage\" for command-line options...\n"
+ "Run with \"--copying\" for copying information...\n"
+ "\n");
+
+ exit(0);
+ }
+ else if (strcmp(argv[i], "--version") == 0 ||
+ strcmp(argv[i], "-v") == 0)
+ {
+ show_version();
+ printf("State format file version " STATE_FORMAT_VERSION "\n");
+ exit(0);
+ }
+ else if (strcmp(argv[i], "--copying") == 0 ||
+ strcmp(argv[i], "-c") == 0)
+ {
+ show_version();
+ printf("\n"
+ "This program is free software; you can redistribute it\n"
+ "and/or modify it under the terms of the GNU General Public\n"
+ "License as published by the Free Software Foundation;\n"
+ "either version 2 of the License, or (at your option) any\n"
+ "later version.\n"
+ "\n"
+ "This program is distributed in the hope that it will be\n"
+ "useful and entertaining, but WITHOUT ANY WARRANTY; without\n"
+ "even the implied warranty of MERCHANTABILITY or FITNESS\n"
+ "FOR A PARTICULAR PURPOSE. See the GNU General Public\n"
+ "License for more details.\n"
+ "\n");
+ printf("You should have received a copy of the GNU General Public\n"
+ "License along with this program; if not, write to the Free\n"
+ "Software Foundation, Inc., 59 Temple Place, Suite 330,\n"
+ "Boston, MA 02111-1307 USA\n"
+ "\n");
+ exit(0);
+ }
+ else if (strcmp(argv[i], "--usage") == 0 ||
+ strcmp(argv[i], "-u") == 0)
+ {
+ show_usage(stdout, argv[0]);
+ exit(0);
+ }
+ else
+ {
+ show_usage(stderr, argv[0]);
+ exit(1);
+ }
+ }
+
+
+ /* Seed random number generator: */
+
+ srand(SDL_GetTicks());
+
+
+ /* Init SDL video: */
+
+ if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ {
+ fprintf(stderr,
+ "\nError: I could not initialize video!\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+ exit(1);
+ }
+
+
+ /* Init joysticks: */
+
+#ifdef JOY_YES
+ use_joystick = 1;
+
+ if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
+ {
+ fprintf(stderr,
+ "\nWarning: I could not initialize joystick.\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+
+ use_joystick = 0;
+ }
+ else
+ {
+ /* Look for joysticks: */
+
+ if (SDL_NumJoysticks() <= 0)
+ {
+ fprintf(stderr,
+ "\nWarning: No joysticks available.\n");
+
+ use_joystick = 0;
+ }
+ else
+ {
+ /* Open joystick: */
+
+ js = SDL_JoystickOpen(0);
+
+ if (js == NULL)
+ {
+ fprintf(stderr,
+ "\nWarning: Could not open joystick 1.\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+
+ use_joystick = 0;
+ }
+ else
+ {
+ /* Check for proper stick configuration: */
+
+ if (SDL_JoystickNumAxes(js) < 2)
+ {
+ fprintf(stderr,
+ "\nWarning: Joystick doesn't have enough axes!\n");
+
+ use_joystick = 0;
+ }
+ else
+ {
+ if (SDL_JoystickNumButtons(js) < 2)
+ {
+ fprintf(stderr,
+ "\nWarning: Joystick doesn't have enough "
+ "buttons!\n");
+
+ use_joystick = 0;
+ }
+ }
+ }
+ }
+ }
+#else
+ use_joystick = 0;
+#endif
+
+
+ /* Open window: */
+
+ if (fullscreen)
+ {
+ screen = set_vid_mode(SDL_FULLSCREEN | SDL_HWSURFACE);
+
+ if (screen == NULL)
+ {
+ fprintf(stderr,
+ "\nWarning: I could not set up fullscreen video for "
+ "%dx%d mode.\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", WIDTH, HEIGHT, SDL_GetError());
+ fullscreen = 0;
+ }
+ }
+
+ if (!fullscreen)
+ {
+ screen = set_vid_mode(0);
+
+ if (screen == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I could not open the display.\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+ exit(1);
+ }
+ }
+
+
+ /* Load background image: */
+
+#ifndef EMBEDDED
+ tmp = IMG_Load(DATA_PREFIX "images/redspot.jpg");
+
+ if (tmp == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I could not open the background image:\n"
+ DATA_PREFIX "images/redspot.jpg\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+ exit(1);
+ }
+
+ bkgd = SDL_DisplayFormat(tmp);
+ if (bkgd == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I couldn't convert the background image"
+ "to the display format!\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+ exit(1);
+ }
+
+ SDL_FreeSurface(tmp);
+
+#else
+
+ tmp = SDL_LoadBMP(DATA_PREFIX "images/redspot-e.bmp");
+
+ if (tmp == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I could not open the background image:\n"
+ DATA_PREFIX "images/redspot-e.bmp\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+ exit(1);
+ }
+
+ bkgd = SDL_DisplayFormat(tmp);
+ if (bkgd == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I couldn't convert the background image"
+ "to the display format!\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+ exit(1);
+ }
+
+ SDL_FreeSurface(tmp);
+#endif
+
+
+#ifndef NOSOUND
+ /* Init sound: */
+
+ if (use_sound)
+ {
+ if (Mix_OpenAudio(22050, AUDIO_S16, 2, 512) < 0)
+ {
+ fprintf(stderr,
+ "\nWarning: I could not set up audio for 22050 Hz "
+ "16-bit stereo.\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", SDL_GetError());
+ use_sound = FALSE;
+ }
+ }
+
+
+ /* Load sound files: */
+
+ if (use_sound)
+ {
+ for (i = 0; i < NUM_SOUNDS; i++)
+ {
+ sounds[i] = Mix_LoadWAV(sound_names[i]);
+ if (sounds[i] == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I could not load the sound file:\n"
+ "%s\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", sound_names[i], SDL_GetError());
+ exit(1);
+ }
+ }
+
+
+ game_music = Mix_LoadMUS(mus_game_name);
+ if (game_music == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I could not load the music file:\n"
+ "%s\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", mus_game_name, SDL_GetError());
+ exit(1);
+ }
+ }
+#endif
+
+
+ seticon();
+ SDL_WM_SetCaption("Vectoroids", "Vectoroids");
+}
+
+
+/* Set the window's icon: */
+
+void seticon(void)
+{
+#ifndef EMBEDDED
+ int masklen;
+ Uint8 * mask;
+ SDL_Surface * icon;
+
+
+ /* Load icon into a surface: */
+
+ icon = IMG_Load(DATA_PREFIX "images/icon.png");
+ if (icon == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I could not load the icon image: %s\n"
+ "The Simple DirectMedia error that occured was:\n"
+ "%s\n\n", DATA_PREFIX "images/icon.png", SDL_GetError());
+ exit(1);
+ }
+
+
+ /* Create mask: */
+
+ masklen = (((icon -> w) + 7) / 8) * (icon -> h);
+ mask = malloc(masklen * sizeof(Uint8));
+ memset(mask, 0xFF, masklen);
+
+
+ /* Set icon: */
+
+ SDL_WM_SetIcon(icon, mask);
+
+
+ /* Free icon surface & mask: */
+
+ free(mask);
+ SDL_FreeSurface(icon);
+#endif
+}
+
+
+/* Fast approximate-integer, table-based cosine! Whee! */
+
+int fast_cos(int angle)
+{
+ angle = (angle % 45);
+
+ if (angle < 12)
+ return(trig[angle]);
+ else if (angle < 23)
+ return(-trig[10 - (angle - 12)]);
+ else if (angle < 34)
+ return(-trig[angle - 22]);
+ else
+ return(trig[45 - angle]);
+}
+
+
+/* Sine based on fast cosine... */
+
+int fast_sin(int angle)
+{
+ return(- fast_cos((angle + 11) % 45));
+}
+
+
+/* Draw a line: */
+
+void draw_line(int x1, int y1, color_type c1,
+ int x2, int y2, color_type c2)
+{
+ sdl_drawline(x1, y1, c1, x2, y2, c2);
+
+ if (x1 < 0 || x2 < 0)
+ {
+ sdl_drawline(x1 + WIDTH, y1, c1, x2 + WIDTH, y2, c2);
+ }
+ else if (x1 >= WIDTH || x2 >= WIDTH)
+ {
+ sdl_drawline(x1 - WIDTH, y1, c1, x2 - WIDTH, y2, c2);
+ }
+
+ if (y1 < 0 || y2 < 0)
+ {
+ sdl_drawline(x1, y1 + HEIGHT, c1, x2, y2 + HEIGHT, c2);
+ }
+ else if (y1 >= HEIGHT || y2 >= HEIGHT)
+ {
+ sdl_drawline(x1, y1 - HEIGHT, c1, x2, y2 - HEIGHT, c2);
+ }
+}
+
+
+/* Create a color_type struct out of RGB values: */
+
+color_type mkcolor(int r, int g, int b)
+{
+ color_type c;
+
+ if (r > 255)
+ r = 255;
+ if (g > 255)
+ g = 255;
+ if (b > 255)
+ b = 255;
+
+ c.r = (Uint8) r;
+ c.g = (Uint8) g;
+ c.b = (Uint8) b;
+
+ return c;
+}
+
+
+/* Draw a line on an SDL surface: */
+
+void sdl_drawline(int x1, int y1, color_type c1,
+ int x2, int y2, color_type c2)
+{
+ int dx, dy;
+#ifndef EMBEDDED
+ float cr, cg, cb, rd, gd, bd;
+#endif
+ float m, b;
+
+
+ if (clip(&x1, &y1, &x2, &y2))
+ {
+ dx = x2 - x1;
+ dy = y2 - y1;
+
+ if (dx != 0)
+ {
+ m = ((float) dy) / ((float) dx);
+ b = y1 - m * x1;
+
+ if (x2 >= x1)
+ dx = 1;
+ else
+ dx = -1;
+
+#ifndef EMBEDDED
+ cr = c1.r;
+ cg = c1.g;
+ cb = c1.b;
+
+ rd = (float) (c2.r - c1.r) / (float) (x2 - x1) * dx;
+ gd = (float) (c2.g - c1.g) / (float) (x2 - x1) * dx;
+ bd = (float) (c2.b - c1.b) / (float) (x2 - x1) * dx;
+#endif
+
+ while (x1 != x2)
+ {
+ y1 = m * x1 + b;
+ y2 = m * (x1 + dx) + b;
+
+#ifndef EMBEDDED
+ drawvertline(x1, y1, mkcolor(cr, cg, cb),
+ y2, mkcolor(cr + rd, cg + gd, cb + bd));
+#else
+ drawvertline(x1, y1, mkcolor(c1.r, c1.g, c1.b),
+ y2, mkcolor(c1.r, c1.g, c1.b));
+#endif
+
+ x1 = x1 + dx;
+
+
+#ifndef EMBEDDED
+ cr = cr + rd;
+ cg = cg + gd;
+ cb = cb + bd;
+#endif
+ }
+ }
+ else
+ drawvertline(x1, y1, c1, y2, c2);
+ }
+}
+
+
+/* Clip lines to window: */
+
+int clip(int * x1, int * y1, int * x2, int * y2)
+{
+#ifndef EMBEDDED
+
+ float fx1, fx2, fy1, fy2, tmp;
+ float m;
+ unsigned char code1, code2;
+ int done, draw, swapped;
+ unsigned char ctmp;
+ fx1 = (float) *x1;
+ fy1 = (float) *y1;
+ fx2 = (float) *x2;
+ fy2 = (float) *y2;
+
+
+ done = FALSE;
+ draw = FALSE;
+ m = 0;
+ swapped = FALSE;
+
+
+ while (!done)
+ {
+ code1 = encode(fx1, fy1);
+ code2 = encode(fx2, fy2);
+
+ if (!(code1 | code2))
+ {
+ done = TRUE;
+ draw = TRUE;
+ }
+ else if (code1 & code2)
+ {
+ done = TRUE;
+ }
+ else
+ {
+ if (!code1)
+ {
+ swapped = TRUE;
+ tmp = fx1;
+ fx1 = fx2;
+ fx2 = tmp;
+
+ tmp = fy1;
+ fy1 = fy2;
+ fy2 = tmp;
+
+ ctmp = code1;
+ code1 = code2;
+ code2 = ctmp;
+ }
+
+
+ if (fx2 != fx1)
+ m = (fy2 - fy1) / (fx2 - fx1);
+ else
+ m = 1;
+
+ if (code1 & LEFT_EDGE)
+ {
+ fy1 += ((0 - (fx1)) * m);
+ fx1 = 0;
+ }
+ else if (code1 & RIGHT_EDGE)
+ {
+ fy1 += (((WIDTH - 1) - (fx1)) * m);
+ fx1 = (WIDTH - 1);
+ }
+ else if (code1 & TOP_EDGE)
+ {
+ if (fx2 != fx1)
+ fx1 += ((0 - (fy1)) / m);
+ fy1 = 0;
+ }
+ else if (code1 & BOTTOM_EDGE)
+ {
+ if (fx2 != fx1)
+ fx1 += (((HEIGHT - 1) - (fy1)) / m);
+ fy1 = (HEIGHT - 1);
+ }
+ }
+ }
+
+
+ if (swapped)
+ {
+ tmp = fx1;
+ fx1 = fx2;
+ fx2 = tmp;
+
+ tmp = fy1;
+ fy1 = fy2;
+ fy2 = tmp;
+ }
+
+
+ *x1 = (int) fx1;
+ *y1 = (int) fy1;
+ *x2 = (int) fx2;
+ *y2 = (int) fy2;
+
+ return(draw);
+#else
+
+ if (*x1 < 0 || *x1 >= WIDTH ||
+ *y1 < 0 || *y1 >= HEIGHT ||
+ *x2 < 0 || *x2 >= WIDTH ||
+ *y2 < 0 || *y2 >= HEIGHT)
+ return FALSE;
+ else
+ return TRUE;
+
+
+#endif
+}
+
+
+/* Where does this line clip? */
+
+unsigned char encode(float x, float y)
+{
+ unsigned char code;
+
+ code = 0x00;
+
+ if (x < 0.0)
+ code = code | LEFT_EDGE;
+ else if (x >= (float) WIDTH)
+ code = code | RIGHT_EDGE;
+
+ if (y < 0.0)
+ code = code | TOP_EDGE;
+ else if (y >= (float) HEIGHT)
+ code = code | BOTTOM_EDGE;
+
+ return code;
+}
+
+
+/* Draw a verticle line: */
+
+void drawvertline(int x, int y1, color_type c1,
+ int y2, color_type c2)
+{
+ int tmp, dy;
+#ifndef EMBEDDED
+ float cr, cg, cb, rd, gd, bd;
+#else
+ int cr, cg, cb;
+#endif
+
+ if (y1 > y2)
+ {
+ tmp = y1;
+ y1 = y2;
+ y2 = tmp;
+
+#ifndef EMBEDDED
+ tmp = c1.r;
+ c1.r = c2.r;
+ c2.r = tmp;
+
+ tmp = c1.g;
+ c1.g = c2.g;
+ c2.g = tmp;
+
+ tmp = c1.b;
+ c1.b = c2.b;
+ c2.b = tmp;
+#endif
+ }
+
+ cr = c1.r;
+ cg = c1.g;
+ cb = c1.b;
+
+#ifndef EMBEDDED
+ if (y1 != y2)
+ {
+ rd = (float) (c2.r - c1.r) / (float) (y2 - y1);
+ gd = (float) (c2.g - c1.g) / (float) (y2 - y1);
+ bd = (float) (c2.b - c1.b) / (float) (y2 - y1);
+ }
+ else
+ {
+ rd = 0;
+ gd = 0;
+ bd = 0;
+ }
+#endif
+
+ for (dy = y1; dy <= y2; dy++)
+ {
+ putpixel(screen, x + 1, dy + 1, SDL_MapRGB(screen->format, 0, 0, 0));
+
+ putpixel(screen, x, dy, SDL_MapRGB(screen->format,
+ (Uint8) cr,
+ (Uint8) cg,
+ (Uint8) cb));
+
+#ifndef EMBEDDED
+ cr = cr + rd;
+ cg = cg + gd;
+ cb = cb + bd;
+#endif
+ }
+}
+
+
+/* Draw a single pixel into the surface: */
+
+void putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
+{
+ int bpp;
+ Uint8 * p;
+
+
+ /* Assuming the X/Y values are within the bounds of this surface... */
+
+ if (x >= 0 && y >= 0 && x < WIDTH && y < HEIGHT)
+ {
+ /* Determine bytes-per-pixel for the surface in question: */
+
+ bpp = surface->format->BytesPerPixel;
+
+
+ /* Set a pointer to the exact location in memory of the pixel
+ in question: */
+
+ p = (((Uint8 *) surface->pixels) + /* Start at beginning of RAM */
+ (y * surface->pitch) + /* Go down Y lines */
+ (x * bpp)); /* Go in X pixels */
+
+
+ /* Set the (correctly-sized) piece of data in the surface's RAM
+ to the pixel value sent in: */
+
+ if (bpp == 1)
+ *p = pixel;
+ else if (bpp == 2)
+ *(Uint16 *)p = pixel;
+ else if (bpp == 3)
+ {
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ {
+ p[0] = (pixel >> 16) & 0xff;
+ p[1] = (pixel >> 8) & 0xff;
+ p[2] = pixel & 0xff;
+ }
+ else
+ {
+ p[0] = pixel & 0xff;
+ p[1] = (pixel >> 8) & 0xff;
+ p[2] = (pixel >> 16) & 0xff;
+ }
+ }
+ else if (bpp == 4)
+ {
+ *(Uint32 *)p = pixel;
+ }
+ }
+}
+
+
+
+/* Draw a line segment, rotated around a center point: */
+
+void draw_segment(int r1, int a1,
+ color_type c1,
+ int r2, int a2,
+ color_type c2,
+ int cx, int cy, int a)
+{
+ draw_line(((fast_cos((a1 + a) >> 3) * r1) >> 10) + cx,
+ cy - ((fast_sin((a1 + a) >> 3) * r1) >> 10),
+ c1,
+ ((fast_cos((a2 + a) >> 3) * r2) >> 10) + cx,
+ cy - ((fast_sin((a2 + a) >> 3) * r2) >> 10),
+ c2);
+}
+
+
+/* Add a bullet: */
+
+void add_bullet(int x, int y, int a, int xm, int ym)
+{
+ int i, found;
+
+ found = -1;
+
+ for (i = 0; i < NUM_BULLETS && found == -1; i++)
+ {
+ if (bullets[i].timer <= 0)
+ found = i;
+ }
+
+ if (found != -1)
+ {
+#ifndef EMBEDDED
+ bullets[found].timer = 50;
+#else
+ bullets[found].timer = 30;
+#endif
+
+ bullets[found].x = x;
+ bullets[found].y = y;
+
+ bullets[found].xm = ((fast_cos(a >> 3) * 5) >> 10) + (xm >> 4);
+ bullets[found].ym = - ((fast_sin(a >> 3) * 5) >> 10) + (ym >> 4);
+
+
+ playsound(SND_BULLET);
+ }
+}
+
+
+/* Add an asteroid: */
+
+void add_asteroid(int x, int y, int xm, int ym, int size)
+{
+ int i, found;
+
+
+ /* Find a slot: */
+
+ found = -1;
+
+ for (i = 0; i < NUM_ASTEROIDS && found == -1; i++)
+ {
+ if (asteroids[i].alive == 0)
+ found = i;
+ }
+
+
+ /* Hack: No asteroids should be stationary! */
+
+ while (xm == 0)
+ {
+ xm = (rand() % 3) - 1;
+ }
+
+
+ if (found != -1)
+ {
+ asteroids[found].alive = 1;
+
+ asteroids[found].x = x;
+ asteroids[found].y = y;
+ asteroids[found].xm = xm;
+ asteroids[found].ym = ym;
+
+ asteroids[found].angle = (rand() % 360);
+ asteroids[found].angle_m = (rand() % 6) - 3;
+
+ asteroids[found].size = size;
+
+ for (i = 0; i < AST_SIDES; i++)
+ {
+ asteroids[found].shape[i].radius = (rand() % 3);
+ asteroids[found].shape[i].angle = i * 60 + (rand() % 40);
+ }
+ }
+}
+
+
+/* Add a bit: */
+
+void add_bit(int x, int y, int xm, int ym)
+{
+ int i, found;
+
+ found = -1;
+
+ for (i = 0; i < NUM_BITS && found == -1; i++)
+ {
+ if (bits[i].timer <= 0)
+ found = i;
+ }
+
+
+ if (found != -1)
+ {
+ bits[found].timer = 16;
+
+ bits[found].x = x;
+ bits[found].y = y;
+ bits[found].xm = xm;
+ bits[found].ym = ym;
+ }
+}
+
+
+/* Draw an asteroid: */
+
+void draw_asteroid(int size, int x, int y, int angle, shape_type * shape)
+{
+ int i, b1, b2;
+ int div;
+
+#ifndef EMBEDDED
+ div = 240;
+#else
+ div = 120;
+#endif
+
+ for (i = 0; i < AST_SIDES - 1; i++)
+ {
+ b1 = (((shape[i].angle + angle) % 180) * 255) / div;
+ b2 = (((shape[i + 1].angle + angle) % 180) * 255) / div;
+
+ draw_segment((size * (AST_RADIUS - shape[i].radius)),
+ shape[i].angle, mkcolor(b1, b1, b1),
+ (size * (AST_RADIUS - shape[i + 1].radius)),
+ shape[i + 1].angle, mkcolor(b2, b2, b2),
+ x, y,
+ angle);
+ }
+
+ b1 = (((shape[AST_SIDES - 1].angle + angle) % 180) * 255) / div;
+ b2 = (((shape[0].angle + angle) % 180) * 255) / div;
+
+ draw_segment((size * (AST_RADIUS - shape[AST_SIDES - 1].radius)),
+ shape[AST_SIDES - 1].angle, mkcolor(b1, b1, b1),
+ (size * (AST_RADIUS - shape[0].radius)),
+ shape[0].angle, mkcolor(b2, b2, b2),
+ x, y,
+ angle);
+}
+
+
+/* Queue a sound! */
+
+void playsound(int snd)
+{
+ int which, i;
+
+#ifndef NOSOUND
+ if (use_sound)
+ {
+#ifdef EMBEDDED
+ which = -1;
+#else
+ which = (rand() % 3) + CHAN_THRUST;
+ for (i = CHAN_THRUST; i < 4; i++)
+ {
+ if (!Mix_Playing(i))
+ which = i;
+ }
+#endif
+
+ Mix_PlayChannel(which, sounds[snd], 0);
+ }
+#endif
+}
+
+
+/* Break an asteroid and add an explosion: */
+
+void hurt_asteroid(int j, int xm, int ym, int exp_size)
+{
+ int k;
+
+ add_score(100 / (asteroids[j].size + 1));
+
+ if (asteroids[j].size > 1)
+ {
+ /* Break the rock into two smaller ones! */
+
+ add_asteroid(asteroids[j].x,
+ asteroids[j].y,
+ ((asteroids[j].xm + xm) / 2),
+ (asteroids[j].ym + ym),
+ asteroids[j].size - 1);
+
+ add_asteroid(asteroids[j].x,
+ asteroids[j].y,
+ (asteroids[j].xm + xm),
+ ((asteroids[j].ym + ym) / 2),
+ asteroids[j].size - 1);
+ }
+
+
+ /* Make the original go away: */
+
+ asteroids[j].alive = 0;
+
+
+ /* Add explosion: */
+
+ playsound(SND_AST1 + (asteroids[j].size) - 1);
+
+ for (k = 0; k < exp_size; k++)
+ {
+ add_bit((asteroids[j].x -
+ (asteroids[j].size * AST_RADIUS) +
+ (rand() % (AST_RADIUS * 2))),
+ (asteroids[j].y -
+ (asteroids[j].size * AST_RADIUS) +
+ (rand() % (AST_RADIUS * 2))),
+ ((rand() % (asteroids[j].size * 3)) -
+ (asteroids[j].size) +
+ ((xm + asteroids[j].xm) / 3)),
+ ((rand() % (asteroids[j].size * 3)) -
+ (asteroids[j].size) +
+ ((ym + asteroids[j].ym) / 3)));
+ }
+}
+
+
+/* Increment score: */
+
+void add_score(int amount)
+{
+ /* See if they deserve a new life: */
+
+ if (score / ONEUP_SCORE < (score + amount) / ONEUP_SCORE)
+ {
+ lives++;
+ strcpy(zoom_str, "EXTRA LIFE");
+ text_zoom = ZOOM_START;
+ playsound(SND_EXTRALIFE);
+ }
+
+
+
+ /* Add to score: */
+
+ score = score + amount;
+}
+
+
+/* Draw a character: */
+
+void draw_char(char c, int x, int y, int r, color_type cl)
+{
+ int i, v;
+
+ /* Which vector is this character? */
+
+ v = -1;
+ if (c >= '0' && c <= '9')
+ v = (c - '0');
+ else if (c >= 'A' && c <= 'Z')
+ v = (c - 'A') + 10;
+
+
+ if (v != -1)
+ {
+ for (i = 0; i < 5; i++)
+ {
+ if (char_vectors[v][i][0] != -1)
+ {
+ draw_line(x + (char_vectors[v][i][0] * r),
+ y + (char_vectors[v][i][1] * r),
+ cl,
+ x + (char_vectors[v][i][2] * r),
+ y + (char_vectors[v][i][3] * r),
+ cl);
+ }
+ }
+ }
+}
+
+
+void draw_text(char * str, int x, int y, int s, color_type c)
+{
+ int i;
+
+ for (i = 0; i < strlen(str); i++)
+ draw_char(str[i], i * (s + 3) + x, y, s, c);
+}
+
+
+void draw_thick_line(int x1, int y1, color_type c1,
+ int x2, int y2, color_type c2)
+{
+ draw_line(x1, y1, c1, x2, y2, c2);
+ draw_line(x1 + 1, y1 + 1, c1, x2 + 1, y2 + 1, c2);
+}
+
+
+void reset_level(void)
+{
+ int i;
+
+
+ for (i = 0; i < NUM_BULLETS; i++)
+ bullets[i].timer = 0;
+
+ for (i = 0; i < NUM_ASTEROIDS; i++)
+ asteroids[i].alive = 0;
+
+ for (i = 0; i < NUM_BITS; i++)
+ bits[i].timer = 0;
+
+ for (i = 0; i < (level + 1) && i < 10; i++)
+ {
+#ifndef EMBEDDED
+ add_asteroid(/* x */ (rand() % 40) + ((WIDTH - 40) * (rand() % 2)),
+ /* y */ (rand() % HEIGHT),
+ /* xm */ (rand() % 9) - 4,
+ /* ym */ ((rand() % 9) - 4) * 4,
+ /* size */ (rand() % 3) + 2);
+#else
+ add_asteroid(/* x */ (rand() % WIDTH),
+ /* y */ (rand() % 40) + ((HEIGHT - 40) * (rand() % 2)),
+ /* xm */ ((rand() % 9) - 4) * 4,
+ /* ym */ (rand() % 9) - 4,
+ /* size */ (rand() % 3) + 2);
+#endif
+ }
+
+
+ sprintf(zoom_str, "LEVEL %d", level);
+
+ text_zoom = ZOOM_START;
+}
+
+
+/* Show program version: */
+
+void show_version(void)
+{
+ printf("Vectoroids - Version " VER_VERSION " (" VER_DATE ")\n");
+}
+
+
+/* Show usage display: */
+
+void show_usage(FILE * f, char * prg)
+{
+ fprintf(f, "Usage: %s {--help | --usage | --version | --copying }\n"
+ " %s [--fullscreen] [--nosound]\n\n", prg, prg);
+}
+
+
+/* Set video mode: */
+/* Contributed to "Defendguin" by Mattias Engdegard <f91-men@nada.kth.se> */
+
+SDL_Surface * set_vid_mode(unsigned flags)
+{
+ /* Prefer 16bpp, but also prefer native modes to emulated 16bpp. */
+
+ int depth;
+
+ depth = SDL_VideoModeOK(WIDTH, HEIGHT, 16, flags);
+ return depth ? SDL_SetVideoMode(WIDTH, HEIGHT, depth, flags) : NULL;
+}
+
+
+/* Draw text, centered horizontally: */
+
+void draw_centered_text(char * str, int y, int s, color_type c)
+{
+ draw_text(str, (WIDTH - strlen(str) * (s + 3)) / 2, y, s, c);
+}
+