]> github.com/historicalsource and other repositories - gish.git/commitdiff
Initial import. master
authorSimon Morgan <sjm@sjm.io>
Sat, 20 Jun 2015 11:21:33 +0000 (12:21 +0100)
committerSimon Morgan <sjm@sjm.io>
Sat, 20 Jun 2015 11:21:33 +0000 (12:21 +0100)
118 files changed:
COPYING.txt [new file with mode: 0644]
audio/audio.c [new file with mode: 0644]
audio/audio.h [new file with mode: 0644]
game/ai.c [new file with mode: 0644]
game/ai.h [new file with mode: 0644]
game/animation.c [new file with mode: 0644]
game/animation.h [new file with mode: 0644]
game/audio.c [new file with mode: 0644]
game/audio.h [new file with mode: 0644]
game/block.c [new file with mode: 0644]
game/block.h [new file with mode: 0644]
game/boss.c [new file with mode: 0644]
game/boss.h [new file with mode: 0644]
game/config.c [new file with mode: 0644]
game/config.h [new file with mode: 0644]
game/credits.c [new file with mode: 0644]
game/credits.h [new file with mode: 0644]
game/custom.c [new file with mode: 0644]
game/custom.h [new file with mode: 0644]
game/damage.c [new file with mode: 0644]
game/damage.h [new file with mode: 0644]
game/editor.c [new file with mode: 0644]
game/editor.h [new file with mode: 0644]
game/english.h [new file with mode: 0644]
game/game.c [new file with mode: 0644]
game/game.h [new file with mode: 0644]
game/gamemenu.c [new file with mode: 0644]
game/gamemenu.h [new file with mode: 0644]
game/glext.c [new file with mode: 0644]
game/glext.h [new file with mode: 0644]
game/high.c [new file with mode: 0644]
game/high.h [new file with mode: 0644]
game/level.c [new file with mode: 0644]
game/level.h [new file with mode: 0644]
game/lighting.c [new file with mode: 0644]
game/lighting.h [new file with mode: 0644]
game/logic.c [new file with mode: 0644]
game/logic.h [new file with mode: 0644]
game/mainmenu.c [new file with mode: 0644]
game/mainmenu.h [new file with mode: 0644]
game/mappack.c [new file with mode: 0644]
game/mappack.h [new file with mode: 0644]
game/music.c [new file with mode: 0644]
game/music.h [new file with mode: 0644]
game/object.c [new file with mode: 0644]
game/object.h [new file with mode: 0644]
game/objedit.c [new file with mode: 0644]
game/objedit.h [new file with mode: 0644]
game/objfunc.c [new file with mode: 0644]
game/objfunc.h [new file with mode: 0644]
game/options.c [new file with mode: 0644]
game/options.h [new file with mode: 0644]
game/physics.c [new file with mode: 0644]
game/physics.h [new file with mode: 0644]
game/player.c [new file with mode: 0644]
game/player.h [new file with mode: 0644]
game/prerender.c [new file with mode: 0644]
game/prerender.h [new file with mode: 0644]
game/random.c [new file with mode: 0644]
game/random.h [new file with mode: 0644]
game/record.c [new file with mode: 0644]
game/record.h [new file with mode: 0644]
game/render.c [new file with mode: 0644]
game/render.h [new file with mode: 0644]
game/replay.c [new file with mode: 0644]
game/replay.h [new file with mode: 0644]
game/ropeedit.c [new file with mode: 0644]
game/ropeedit.h [new file with mode: 0644]
game/setup.c [new file with mode: 0644]
game/setup.h [new file with mode: 0644]
game/socket.c [new file with mode: 0644]
game/socket.h [new file with mode: 0644]
game/sprite.c [new file with mode: 0644]
game/sprite.h [new file with mode: 0644]
game/texture.c [new file with mode: 0644]
game/texture.h [new file with mode: 0644]
game/tileset.c [new file with mode: 0644]
game/tileset.h [new file with mode: 0644]
game/utils.c [new file with mode: 0644]
game/utils.h [new file with mode: 0644]
game/vsmode.c [new file with mode: 0644]
game/vsmode.h [new file with mode: 0644]
input/joystick.c [new file with mode: 0644]
input/joystick.h [new file with mode: 0644]
input/keyboard.c [new file with mode: 0644]
input/keyboard.h [new file with mode: 0644]
input/mouse.c [new file with mode: 0644]
input/mouse.h [new file with mode: 0644]
main.c [new file with mode: 0644]
math/intersec.c [new file with mode: 0644]
math/intersec.h [new file with mode: 0644]
math/vector.c [new file with mode: 0644]
math/vector.h [new file with mode: 0644]
menu/menu.c [new file with mode: 0644]
menu/menu.h [new file with mode: 0644]
parser/parser.c [new file with mode: 0644]
parser/parser.h [new file with mode: 0644]
physics/bond.c [new file with mode: 0644]
physics/bond.h [new file with mode: 0644]
physics/object.c [new file with mode: 0644]
physics/object.h [new file with mode: 0644]
physics/particle.c [new file with mode: 0644]
physics/particle.h [new file with mode: 0644]
sdl/endian.c [new file with mode: 0644]
sdl/endian.h [new file with mode: 0644]
sdl/event.c [new file with mode: 0644]
sdl/event.h [new file with mode: 0644]
sdl/file.c [new file with mode: 0644]
sdl/file.h [new file with mode: 0644]
sdl/video.c [new file with mode: 0644]
sdl/video.h [new file with mode: 0644]
video/glext.h [new file with mode: 0644]
video/glfunc.c [new file with mode: 0644]
video/glfunc.h [new file with mode: 0644]
video/text.c [new file with mode: 0644]
video/text.h [new file with mode: 0644]
video/texture.c [new file with mode: 0644]
video/texture.h [new file with mode: 0644]

diff --git a/COPYING.txt b/COPYING.txt
new file mode 100644 (file)
index 0000000..96e4591
--- /dev/null
@@ -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.
+\f
+                   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.)
+\f
+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.
+\f
+  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.
+\f
+  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
+\f
+       Appendix: 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) 19yy  <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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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.
diff --git a/audio/audio.c b/audio/audio.c
new file mode 100644 (file)
index 0000000..dbe3edb
--- /dev/null
@@ -0,0 +1,220 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void setupaudio(void)\r
+  {\r
+  int count;\r
+  ALsizei size,freq;\r
+  ALenum format;\r
+  ALvoid *data;\r
+  ALboolean loop;\r
+  int changeddir;\r
+\r
+  aldevice=alcOpenDevice(NULL);\r
+  if (aldevice!=NULL)\r
+    {\r
+    alcontext=alcCreateContext(aldevice,NULL);\r
+    if (alcontext!=NULL)\r
+      {\r
+      alcMakeContextCurrent(alcontext);\r
+      soundenabled=1;\r
+      }\r
+    }\r
+\r
+  if (!soundenabled)\r
+    return;\r
+\r
+  for (count=0;count<2;count++)\r
+    alGenBuffers(1,&oggbuffer[count]);\r
+  for (count=0;count<30;count++)\r
+    alGenBuffers(1,&soundbuffer[count]);\r
+\r
+  changeddir=chdir("sound");\r
+\r
+  loadwav(0,"blockbreak.wav");\r
+  loadwav(1,"rockhit.wav");\r
+  loadwav(2,"fleshhit.wav");\r
+  loadwav(3,"ropebreak.wav");\r
+  loadwav(4,"chainbreak.wav");\r
+  loadwav(5,"gishhit.wav");\r
+  loadwav(6,"rockfriction.wav");\r
+  loadwav(7,"squish.wav");\r
+  loadwav(8,"secrets1.wav");\r
+  loadwav(9,"secrets2.wav");\r
+  loadwav(10,"amber.wav");\r
+  loadwav(11,"nibattack.wav");\r
+  loadwav(12,"visattack.wav");\r
+  loadwav(13,"bobattack.wav");\r
+  loadwav(14,"switch.wav");\r
+  loadwav(15,"points.wav");\r
+  loadwav(16,"gishhurt.wav");\r
+  loadwav(17,"splash.wav");\r
+  loadwav(18,"lava.wav");\r
+  loadwav(19,"necksnap.wav");\r
+  loadwav(20,"tarball.wav");\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+\r
+#ifndef DEMO\r
+  changeddir=chdir("data");\r
+\r
+  loadwav(21,"cubemap.dat");\r
+  loadwav(22,"specular.dat");\r
+  loadwav(23,"stencil.dat");\r
+  loadwav(24,"pixel.dat");\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+#endif\r
+\r
+  alGenSources(1,&oggsource);\r
+\r
+  for (count=0;count<12;count++)\r
+    alGenSources(1,&sound[count].alname);\r
+\r
+  //alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);\r
+  }\r
+\r
+int updateogg(void)\r
+  {\r
+  int processed;\r
+  int buffernum;\r
+  int active;\r
+\r
+  if (!soundenabled)\r
+    return(1);\r
+  if (!option.music)\r
+    return(1);\r
+\r
+  active=1;\r
+\r
+  alGetSourcei(oggsource,AL_BUFFERS_PROCESSED,&processed);\r
+\r
+  while (processed>0)\r
+    {\r
+    alSourceUnqueueBuffers(oggsource,1,&buffernum);\r
+\r
+    active=streamogg(buffernum);\r
+\r
+    if (active)\r
+      alSourceQueueBuffers(oggsource,1,&buffernum);\r
+\r
+    processed--;\r
+    }\r
+  if (!active)\r
+    {\r
+    game.songnum=-1;\r
+    /*\r
+    if (level.gametype<10)\r
+      {\r
+      game.songnum++;\r
+      if (game.songnum>3)\r
+        game.songnum=0;\r
+      }\r
+    */\r
+    }\r
+  return(active);\r
+  }\r
+\r
+int streamogg(int buffernum)\r
+  {\r
+  int size;\r
+  int section;\r
+  int result;\r
+  int count;\r
+  char temp;\r
+\r
+  size=0;\r
+  while (size<OGGBUFFERSIZE)\r
+    {\r
+    result=ov_read(&oggstream[0],oggdata+size,OGGBUFFERSIZE-size,0,2,1,&section);\r
+\r
+    if (result>0)\r
+      size+=result;\r
+    else\r
+      goto streamoggbypass;\r
+    }\r
+  streamoggbypass:;\r
+\r
+  if (size==0)\r
+    return(0);\r
+\r
+  if (bigendian)\r
+  for (count=0;count<size/2;count++)\r
+    {\r
+    temp=oggdata[count*2];\r
+    oggdata[count*2]=oggdata[count*2+1];\r
+    oggdata[count*2+1]=temp;\r
+    }\r
+\r
+  alBufferData(buffernum,oggformat,oggdata,size,vorbisinfo->rate);\r
+\r
+  return(1);\r
+  }\r
+\r
+void shutdownaudio(void)\r
+  {\r
+  alcontext=alcGetCurrentContext();\r
+  aldevice=alcGetContextsDevice(alcontext);\r
+  alcMakeContextCurrent(NULL);\r
+  alcDestroyContext(alcontext);\r
+  alcCloseDevice(aldevice);\r
+\r
+  //ov_clear(&oggstream[0]);\r
+  }\r
+\r
+void loadwav(int buffernum,char *filename)\r
+  {\r
+  int count;\r
+  SDL_AudioSpec wavspec;\r
+  unsigned int wavlength;\r
+  unsigned char *wavbuffer;\r
+  unsigned char temp;\r
+  ALenum format;\r
+\r
+  if (SDL_LoadWAV(filename,&wavspec,&wavbuffer,&wavlength))\r
+    {\r
+    if (wavspec.channels==1)\r
+      {\r
+      if (wavspec.format==AUDIO_U8 || wavspec.format==AUDIO_S8)\r
+        format=AL_FORMAT_MONO8;\r
+      else\r
+        format=AL_FORMAT_MONO16;\r
+\r
+      if (bigendian)\r
+      if (format==AL_FORMAT_MONO16)\r
+        {\r
+        for (count=0;count<wavlength/2;count++)\r
+          {\r
+          temp=wavbuffer[count*2+0];\r
+          wavbuffer[count*2+0]=wavbuffer[count*2+1];\r
+          wavbuffer[count*2+1]=temp;\r
+          }\r
+        }\r
+\r
+      alBufferData(soundbuffer[buffernum],format,wavbuffer,wavlength,wavspec.freq);\r
+      bufferloaded[buffernum]=1;\r
+      }\r
+    SDL_FreeWAV(wavbuffer);\r
+    }\r
+  }\r
+\r
diff --git a/audio/audio.h b/audio/audio.h
new file mode 100644 (file)
index 0000000..d5bb4d2
--- /dev/null
@@ -0,0 +1,46 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+#define OGGBUFFERSIZE 4096*8\r
+\r
+void setupaudio(void);\r
+int updateogg(void);\r
+int streamogg(int buffernum);\r
+void shutdownaudio(void);\r
+void loadwav(int buffernum,char *filename);\r
+\r
+ALCcontext *alcontext;\r
+ALCdevice *aldevice;\r
+\r
+int soundenabled;\r
+ALuint soundbuffer[64];\r
+int bufferloaded[64];\r
+\r
+OggVorbis_File oggstream[2];\r
+\r
+vorbis_info *vorbisinfo;\r
+vorbis_comment *vorbiscomment;\r
+\r
+ALenum oggformat;\r
+char oggdata[OGGBUFFERSIZE];\r
+\r
+ALuint oggsource;\r
+ALuint oggbuffer[2];\r
diff --git a/game/ai.c b/game/ai.c
new file mode 100644 (file)
index 0000000..031e73e
--- /dev/null
+++ b/game/ai.c
@@ -0,0 +1,137 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void objectai(int objectnum)\r
+  {\r
+  float vec[3];\r
+  float intersectpoint[3];\r
+  float normal[3];\r
+  float scale;\r
+\r
+  object[objectnum].axis[0]=0.0f;\r
+  object[objectnum].axis[1]=0.0f;\r
+  object[objectnum].button=0;\r
+\r
+  if (object[objectnum].type==1)\r
+  if (game.levelnum==34)\r
+    {\r
+    /*\r
+    object[objectnum].axis[0]=-object[0].axis[0];\r
+    object[objectnum].axis[1]=object[0].axis[0];\r
+    object[objectnum].button=object[0].button;\r
+    */\r
+    subtractvectors(vec,object[0].position,object[objectnum].position);\r
+    if (vec[0]<-0.5f)\r
+      object[objectnum].axis[0]=-1.0f;\r
+    if (vec[0]>0.5f)\r
+      object[objectnum].axis[0]=1.0f;\r
+    if (vectorlength(vec)<2.0f)\r
+      object[objectnum].button|=8;\r
+    /*\r
+    subtractvectors(vec,object[2].position,object[objectnum].position);\r
+    if (vectorlength(vec)>3.0f)\r
+      object[objectnum].button=1;\r
+    */\r
+    }\r
+  if (object[objectnum].type==4)\r
+    {\r
+    if (object[0].idata[0]==0)\r
+    if (fabs(object[0].position[0]-object[objectnum].position[0])<12.0f)\r
+    if (fabs(object[0].position[1]-object[objectnum].position[1])<8.0f)\r
+      {\r
+      if (object[objectnum].beasttype!=7 && object[objectnum].beasttype!=13)\r
+        {\r
+        subtractvectors(vec,object[0].position,object[objectnum].position);\r
+        if ((vec[0]>-2.5f && vec[0]<0.0f && object[objectnum].direction==0) || (vec[0]<2.5f && vec[0]>0.0f && object[objectnum].direction==1))\r
+        if (fabs(vec[1])<1.0f)\r
+          object[objectnum].button|=1;\r
+\r
+        //if (object[objectnum].beasttype==12)\r
+        //if ((game.framenum&511)==0)\r
+        //  object[objectnum].button|=2;\r
+\r
+        if ((rnd()&7)!=7)\r
+          {\r
+          if (object[0].position[0]<object[objectnum].position[0])\r
+            object[objectnum].axis[0]-=1.0f;\r
+          else\r
+            object[objectnum].axis[0]+=1.0f;\r
+  \r
+          if (object[objectnum].beasttype!=12)\r
+          if ((rnd()&255)==0)\r
+            object[objectnum].button|=2;\r
+\r
+          if (object[objectnum].beasttype==12)\r
+          if ((rnd()&255)==0 && (rnd()&1)==0)\r
+            object[objectnum].button|=2;\r
+          }\r
+        }\r
+      else\r
+        {\r
+        subtractvectors(vec,object[0].position,object[objectnum].position);\r
+        if (vec[0]>-8.0f && vec[0]<8.0f)\r
+        if (fabs(vec[1])<6.0f)\r
+        if ((game.framenum&127)==0)\r
+          object[objectnum].button|=1;\r
+        /*\r
+          if (object[0].position[0]<object[objectnum].position[0]-5.0f)\r
+            object[objectnum].axis[0]-=1.0f;\r
+          if (object[0].position[0]>object[objectnum].position[0]+5.0f)\r
+            object[objectnum].axis[0]+=1.0f;\r
+        */\r
+        //if (object[0].position[0]<object[objectnum].position[0])\r
+        if (object[0].position[0]<object[objectnum].position[0]-5.0f)\r
+          {\r
+          scaleaddvectors(vec,object[objectnum].position,object[objectnum].orientation[0],-3.0f);\r
+          scaleaddvectors(vec,vec,object[objectnum].orientation[1],-2.0);\r
+          if (lineintersectlevel(intersectpoint,normal,&scale,object[objectnum].position,vec))\r
+            object[objectnum].axis[0]-=1.0f;\r
+          else\r
+            {\r
+            if (object[objectnum].velocity[0]<-0.01f)\r
+              object[objectnum].axis[0]+=1.0f;\r
+            }\r
+          }\r
+        if (object[0].position[0]>object[objectnum].position[0]+5.0f)\r
+          {\r
+          scaleaddvectors(vec,object[objectnum].position,object[objectnum].orientation[0],3.0f);\r
+          scaleaddvectors(vec,vec,object[objectnum].orientation[1],-2.0f);\r
+          if (lineintersectlevel(intersectpoint,normal,&scale,object[objectnum].position,vec))\r
+            object[objectnum].axis[0]+=1.0f;\r
+          else\r
+            {\r
+            if (object[objectnum].velocity[0]>0.01f)\r
+              object[objectnum].axis[0]-=1.0f;\r
+            }\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
+  if (object[objectnum].axis[0]<-1.0f)\r
+    object[objectnum].axis[0]=-1.0f;\r
+  if (object[objectnum].axis[0]>1.0f)\r
+    object[objectnum].axis[0]=1.0f;\r
+  if (object[objectnum].axis[1]<-1.0f)\r
+    object[objectnum].axis[1]=-1.0f;\r
+  if (object[objectnum].axis[1]>1.0f)\r
+    object[objectnum].axis[1]=1.0f;\r
+  }\r
diff --git a/game/ai.h b/game/ai.h
new file mode 100644 (file)
index 0000000..4eeee01
--- /dev/null
+++ b/game/ai.h
@@ -0,0 +1,22 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void objectai(int objectnum);\r
diff --git a/game/animation.c b/game/animation.c
new file mode 100644 (file)
index 0000000..56a6ae2
--- /dev/null
@@ -0,0 +1,1358 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void objectanimation(void)\r
+  {\r
+  int count,count2;\r
+  int particlelist[2];\r
+  float vec[3];\r
+  float intersectpoint[3];\r
+  float normal[3];\r
+  float scale;\r
+\r
+  for (count=0;count<numofobjects;count++)\r
+    {\r
+    if (object[count].type==1)\r
+      {\r
+      /*\r
+      for (count2=0;count2<object[count].numofparticles;count2++)\r
+      if ((rand()&8191)==0)\r
+        createparticle(5,particle[object[count].particle[count2]].position,particle[object[count].particle[count2]].velocity,0.125f,-1,100);\r
+      */\r
+\r
+      if (object[count].frame==12)\r
+        {\r
+        object[count].framedelay+=0.125f;\r
+        if (object[count].framedelay>=1.0f)\r
+          {\r
+          object[count].frame=0;\r
+          object[count].framedelay=0.0f;\r
+          }\r
+        }\r
+\r
+      if (object[count].numoforientations==0)\r
+        {\r
+        if (object[count].frame>=5 && object[count].frame<=7)\r
+          object[count].frame=1;\r
+        if (object[count].frame<4)\r
+          {\r
+          object[count].framedelay+=1.0f;\r
+          if (object[count].framedelay>=4.0f)\r
+            {\r
+            object[count].frame++;\r
+            object[count].framedelay=0.0f;\r
+            }\r
+          }\r
+        }\r
+      else\r
+        {\r
+        if (object[count].frame>0 && object[count].frame<=4)\r
+          {\r
+          object[count].framedelay+=1.0f;\r
+          if (object[count].framedelay>=4.0f)\r
+            {\r
+            object[count].frame--;\r
+            object[count].framedelay=0.0f;\r
+            }\r
+          }\r
+        if (object[count].frame==0)\r
+          if ((rnd()&255)==0)\r
+            object[count].frame=5;\r
+\r
+        if (object[count].frame>=5 && object[count].frame<=7)\r
+          {\r
+          object[count].framedelay+=1.0f;\r
+          if (object[count].framedelay>=4.0f)\r
+            {\r
+            object[count].frame++;\r
+            if (object[count].frame==8)\r
+              object[count].frame=0;\r
+            object[count].framedelay=0.0f;\r
+            }\r
+          }\r
+        }\r
+      if ((object[count].button&8)==8)\r
+      if (object[count].frame<8)\r
+        {\r
+        object[count].frame=8;\r
+        object[count].framedelay=0.0f;\r
+        }\r
+\r
+      if (object[count].frame>=8 && object[count].frame<=11)\r
+        {\r
+        object[count].framedelay+=1.0f;\r
+        if (object[count].framedelay>=4.0f)\r
+          {\r
+          if ((object[count].button&8)==8)\r
+            {\r
+            if (object[count].frame<11)\r
+              object[count].frame++;\r
+            }\r
+          else\r
+            {\r
+            if (object[count].frame>7)\r
+              object[count].frame--;\r
+            if (object[count].frame==7)\r
+              object[count].frame=0;\r
+            }\r
+          object[count].framedelay=0.0f;\r
+          }\r
+        }\r
+      }\r
+    if (object[count].type==4)\r
+      {\r
+      if (object[count].animationtype==0 || object[count].animationtype==1)\r
+      if ((object[count].button&1)==1)\r
+        {\r
+        object[count].animationtype=2;\r
+        object[count].frame=0;\r
+        object[count].framedelay=0.0f;\r
+        }\r
+      if (object[count].beasttype==12)\r
+      if (object[count].animationtype==0)\r
+      if ((object[count].button&2)==2)\r
+        {\r
+        object[count].animationtype=1;\r
+        object[count].frame=0;\r
+        object[count].framedelay=0.0f;\r
+        }\r
+      if (object[count].animationtype==0)\r
+        {\r
+        if (object[count].link!=-1)\r
+          {\r
+          object[object[count].link].texturenum=animation[object[count].animationnum+32].stand[0];\r
+          if (fabs(object[0].position[0]-object[count].position[0])<1.5f)\r
+          if (object[0].position[1]>object[count].position[1])\r
+            object[object[count].link].texturenum=animation[object[count].animationnum+32].stand[1];\r
+          }\r
+\r
+        object[count].framedelay+=0.1f;\r
+        if (object[count].framedelay>=1.0f)\r
+          {\r
+          object[count].framedelay=0.0f;\r
+          object[count].frame++;\r
+          if (object[count].frame>=animation[object[count].animationnum].stand[1])\r
+            object[count].frame=0;\r
+          }\r
+        object[count].texturenum=animation[object[count].animationnum].stand[0]+object[count].frame;\r
+        if (vectorlength(object[count].velocity)>=0.01f)\r
+          {\r
+          object[count].animationtype=1;\r
+          object[count].frame=0;\r
+          object[count].framedelay=0.0f;\r
+          }\r
+        }\r
+      if (object[count].animationtype==1)\r
+        {\r
+        if (object[count].link!=-1)\r
+          {\r
+          object[object[count].link].texturenum=animation[object[count].animationnum+32].walk[0];\r
+          if (fabs(object[0].position[0]-object[count].position[0])<1.5f)\r
+          if (object[0].position[1]>object[count].position[1])\r
+            object[object[count].link].texturenum=animation[object[count].animationnum+32].stand[1];\r
+          }\r
+        if (object[count].beasttype!=12)\r
+          object[count].framedelay+=vectorlength(object[count].velocity)*6.0f;\r
+        else\r
+          object[count].framedelay+=0.2f;\r
+        if (object[count].framedelay>=1.0f)\r
+          {\r
+          object[count].framedelay=0.0f;\r
+          object[count].frame++;\r
+          if (object[count].frame>=animation[object[count].animationnum].walk[1])\r
+            {\r
+            object[count].frame=0;\r
+            if (object[count].beasttype==12)\r
+              object[count].animationtype=0;\r
+            }\r
+          }\r
+        object[count].texturenum=animation[object[count].animationnum].walk[0]+object[count].frame;\r
+        if (object[count].beasttype!=12)\r
+        if (vectorlength(object[count].velocity)<0.01f)\r
+          {\r
+          object[count].animationtype=0;\r
+          object[count].frame=0;\r
+          object[count].framedelay=0.0f;\r
+          }\r
+        if (object[count].beasttype==12)\r
+        if (object[count].frame==4)\r
+        if (object[count].framedelay==0.0f)\r
+          {\r
+          addvectors(vec,object[count].position,yaxis);\r
+          createbeast(11,vec,1.0f,1.0f,1.0f,0.2f);\r
+          object[numofobjects-1].timetolive=512;\r
+          object[numofobjects-1].link=-1;\r
+          for (count2=0;count2<4;count2++)\r
+            {\r
+            particle[object[numofobjects-1].particle[count2]].velocity[1]=0.08f;\r
+            if (object[count].direction==0)\r
+              particle[object[numofobjects-1].particle[count2]].velocity[0]=-0.04f;\r
+            else\r
+              particle[object[numofobjects-1].particle[count2]].velocity[0]=0.04f;\r
+            }\r
+          }\r
+        }\r
+      if (object[count].animationtype==2)\r
+        {\r
+        if (object[count].link!=-1)\r
+          object[object[count].link].texturenum=animation[object[count].animationnum+32].attack[0];\r
+\r
+        object[count].framedelay+=0.2f;\r
+        if (object[count].framedelay>=1.0f)\r
+          {\r
+          object[count].framedelay=0.0f;\r
+          object[count].frame++;\r
+          if (object[count].frame>=animation[object[count].animationnum].attack[1])\r
+            {\r
+            object[count].animationtype=0;\r
+            object[count].frame=0;\r
+            }\r
+          }\r
+        object[count].texturenum=animation[object[count].animationnum].attack[0]+object[count].frame;\r
+\r
+        if (object[count].frame==1)\r
+        if (object[count].framedelay==0.0f)\r
+          {\r
+          if (object[count].beasttype<3 || object[count].beasttype==8 || object[count].beasttype==11 || object[count].beasttype==16)\r
+            playsound(11,object[count].position,NULL,0.25f,0,0.7f,-1,0);\r
+          else if (object[count].beasttype==7 || object[count].beasttype==13)\r
+            playsound(12,object[count].position,NULL,0.5f,0,1.0f,-1,0);\r
+          else\r
+            playsound(13,object[count].position,NULL,0.5f,0,1.0f,-1,0);\r
+          }\r
+\r
+        if (object[count].frame==5)\r
+          {\r
+          //if (object[count].beasttype!=7 && object[count].beasttype!=13)\r
+            {\r
+            scale=1.25f;\r
+            if (object[count].beasttype<3 || object[count].beasttype==8 || object[count].beasttype==11 || object[count].beasttype==16)\r
+              scale=0.75f;\r
+            if (object[count].beasttype==15)\r
+              scale=1.5f;\r
+            if (object[count].beasttype==7 || object[count].beasttype==13)\r
+              scale=3.0f;\r
+  \r
+            if (object[count].direction==0)\r
+              scaleaddvectors(vec,object[count].position,object[count].orientation[0],-scale);\r
+            if (object[count].direction==1)\r
+              scaleaddvectors(vec,object[count].position,object[count].orientation[0],scale);\r
+            if (lineintersectobject(intersectpoint,normal,&scale,object[count].position,vec,0,particlelist))\r
+              {\r
+              scale=0.06f;\r
+              if (object[count].beasttype<3)\r
+                scale=0.03f;\r
+              if (object[count].beasttype==15)\r
+                scale=0.15f;\r
+  \r
+              if (object[count].direction==0)\r
+                {\r
+                scaleaddvectors(particle[particlelist[0]].velocity,particle[particlelist[0]].velocity,object[count].orientation[0],-scale);\r
+                scaleaddvectors(particle[particlelist[1]].velocity,particle[particlelist[1]].velocity,object[count].orientation[0],-scale);\r
+                }\r
+              if (object[count].direction==1)\r
+                {\r
+                scaleaddvectors(particle[particlelist[0]].velocity,particle[particlelist[0]].velocity,object[count].orientation[0],scale);\r
+                scaleaddvectors(particle[particlelist[1]].velocity,particle[particlelist[1]].velocity,object[count].orientation[0],scale);\r
+                }\r
+              if (object[count].beasttype<3 || object[count].beasttype==11)\r
+                object[0].hitpoints-=20;\r
+              else\r
+                object[0].hitpoints-=40;\r
+              if (object[count].beasttype==15)\r
+                object[0].hitpoints-=40;\r
+              }\r
+            }\r
+          if (object[count].beasttype==7 || object[count].beasttype==13)\r
+          if (object[count].framedelay==0.0f)\r
+            {\r
+            if (object[count].beasttype==7)\r
+              createbeast(2,object[count].position,1.0f,1.0f,1.0f,0.2f);\r
+            else\r
+              createbeast(8,object[count].position,1.0f,1.0f,1.0f,0.2f);\r
+            object[numofobjects-1].timetolive=512;\r
+            object[numofobjects-1].link=-1;\r
+            for (count2=0;count2<4;count2++)\r
+              {\r
+              if (object[count].direction==0)\r
+                particle[object[numofobjects-1].particle[count2]].velocity[0]=-0.08f;\r
+              else\r
+                particle[object[numofobjects-1].particle[count2]].velocity[0]=0.08f;\r
+              }\r
+            }\r
+          }\r
+        }\r
+      if (object[count].timetolive>=0 && object[count].timetolive<45)\r
+        {\r
+        if (object[count].timetolive==44)\r
+          {\r
+          if (object[count].beasttype<3 || object[count].beasttype==8 || object[count].beasttype==11 || object[count].beasttype==16)\r
+            {\r
+            game.score[0]+=100*game.combo;\r
+            createsprite(100*game.combo,object[count].position);\r
+            game.combo++;\r
+            game.combodelay+=100;\r
+            if (game.combodelay>250)\r
+              game.combodelay=250;\r
+            playsound(7,object[count].position,NULL,1.0f,0,1.0f,-1,0);\r
+            }\r
+          else\r
+            {\r
+            game.score[0]+=200*game.combo;\r
+            createsprite(200*game.combo,object[count].position);\r
+            game.combo++;\r
+            game.combodelay+=100;\r
+            if (game.combodelay>250)\r
+              game.combodelay=250;\r
+            playsound(19,object[count].position,NULL,1.0f,0,1.0f,-1,0);\r
+            }\r
+\r
+          for (count2=0;count2<10;count2++)\r
+            {\r
+            vec[0]=(float)((rnd()&255)-127)/1270.0f;\r
+            vec[1]=(float)((rnd()&255)-127)/1270.0f;\r
+            vec[2]=0.0f;\r
+            addvectors(vec,vec,object[count].velocity);\r
+\r
+            createparticle(5,object[count].position,vec,0.25f,-1,100+(rnd()&63));\r
+            particle[numofparticles-1].rendersize=0.125+(float)(rnd()&127)/1000.0f;\r
+            particle[numofparticles-1].texturenum=367;\r
+            if (object[count].beasttype==11 || object[count].beasttype==12)\r
+              particle[numofparticles-1].texturenum=364;\r
+            if (object[count].beasttype==0 || object[count].beasttype==3 || object[count].beasttype==4)\r
+              particle[numofparticles-1].texturenum=365;\r
+            }\r
+          }\r
+\r
+        if (object[count].link!=-1)\r
+          {\r
+          object[object[count].link].texturenum=animation[object[count].animationnum+32].die[0];\r
+          if (object[object[count].link].timetolive>150)\r
+            object[object[count].link].timetolive=150;\r
+          }\r
+        object[count].animationtype=3;\r
+        object[count].frame=8-object[count].timetolive/5;\r
+        object[count].framedelay=0.0f;\r
+        object[count].texturenum=animation[object[count].animationnum].die[0]+object[count].frame;\r
+        }\r
+      }\r
+    }\r
+  if (game.levelnum==34)\r
+  if (object[1].type==2)\r
+  if ((rnd()&255)==0)\r
+    {\r
+    object[1].texturenum=64+(rnd()&3);\r
+    }\r
+  }\r
+\r
+void loadanimations(void)\r
+  {\r
+  int count,count2;\r
+  int changeddir;\r
+  char filename[32]="bibatk01.tga";\r
+\r
+  changeddir=chdir("animation");\r
+\r
+  count2=0;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"bibsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"bibwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"bibatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"nibdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=1;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"nibsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"nibwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"nibatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"nibdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=2;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"ribsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"ribwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"ribatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"ribdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=3;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"mumsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"mumwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"mumatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"mumdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    count2+=32;\r
+  \r
+    animation[count2].stand[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"mumhed01.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"mumhed02.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"mumhed03.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].stand[1]=numofanimations;\r
+    loadtexturetga(numofanimations,"mumhed05.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"mumhed06.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+    }\r
+\r
+  count2=4;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"sklsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"sklwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"sklatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"skldie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    count2+=32;\r
+  \r
+    animation[count2].stand[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"sklhed01.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"sklhed02.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"sklhed03.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].stand[1]=numofanimations;\r
+    loadtexturetga(numofanimations,"sklhed05.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"sklhed06.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+    }\r
+\r
+  count2=5;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"zomsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"zomwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"zomatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"zomdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    count2+=32;\r
+  \r
+    animation[count2].stand[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"zomhed01.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"zomhed02.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"zomhed03.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].stand[1]=numofanimations;\r
+    loadtexturetga(numofanimations,"zomhed05.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"zomhed06.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+    }\r
+\r
+  count2=6;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"gimsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"gimwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"gimatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"gimdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    count2+=32;\r
+  \r
+    animation[count2].stand[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed01.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed02.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed03.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].stand[1]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed05.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed06.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+    }\r
+\r
+  count2=7;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"vissta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"viswlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"visatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"visdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=8;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"aibsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"aibwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"aibatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"aibdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=9;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"altsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"altwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"altatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"altdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    count2+=32;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed01.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed02.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed03.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].stand[1]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed05.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"gimhed06.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+    }\r
+\r
+  count2=10;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"frksta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"frkwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"frkatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"frkdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    count2+=32;\r
+  \r
+    animation[count2].stand[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"frkhed01.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"frkhed02.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"frkhed03.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].stand[1]=numofanimations;\r
+    loadtexturetga(numofanimations,"frkhed05.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    loadtexturetga(numofanimations,"frkhed06.tga",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+    numofanimations++;\r
+    }\r
+\r
+  count2=11;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"pibsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"pibwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"pibatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"pibdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=12;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"sepsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"sepspw");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=8;\r
+    strcpy(filename,"sepatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"sepdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=13;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"sissta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"siswlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"sisatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"sisdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=14;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=5;\r
+    strcpy(filename,"ghosta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=5;\r
+    strcpy(filename,"ghowlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=8;\r
+    strcpy(filename,"ghoatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"ghodie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=15;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"bassta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"baswlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"basatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"basdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  count2=16;\r
+  if (animation[count2].loaded==2)\r
+    {\r
+    animation[count2].loaded=1;\r
+\r
+    animation[count2].stand[0]=numofanimations;\r
+    animation[count2].stand[1]=6;\r
+    strcpy(filename,"satsta");\r
+    for (count=1;count<=animation[count2].stand[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].walk[0]=numofanimations;\r
+    animation[count2].walk[1]=9;\r
+    strcpy(filename,"satwlk");\r
+    for (count=1;count<=animation[count2].walk[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].attack[0]=numofanimations;\r
+    animation[count2].attack[1]=9;\r
+    strcpy(filename,"satatk");\r
+    for (count=1;count<=animation[count2].attack[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+  \r
+    animation[count2].die[0]=numofanimations;\r
+    animation[count2].die[1]=9;\r
+    strcpy(filename,"ribdie");\r
+    for (count=1;count<=animation[count2].die[1];count++)\r
+      {\r
+      filename[6]=48+(count/10)%10;\r
+      filename[7]=48+count%10;\r
+      loadtexturetga(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR);\r
+      numofanimations++;\r
+      }\r
+    }\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+  }\r
diff --git a/game/animation.h b/game/animation.h
new file mode 100644 (file)
index 0000000..8650564
--- /dev/null
@@ -0,0 +1,33 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void objectanimation(void);\r
+void loadanimations(void);\r
+\r
+int numofanimations;\r
+struct\r
+  {\r
+  int loaded;\r
+  int stand[2];\r
+  int walk[2];\r
+  int attack[2];\r
+  int die[2];\r
+  } animation[128];\r
diff --git a/game/audio.c b/game/audio.c
new file mode 100644 (file)
index 0000000..3ba7a74
--- /dev/null
@@ -0,0 +1,192 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void soundsimulation(float position[3],float orientation[3][3])\r
+  {\r
+  int count;\r
+  int state;\r
+  float vec[3];\r
+  float alorientation[6];\r
+  float intersectpoint[3];\r
+  float normal[3];\r
+  float scale;\r
+\r
+  if (!soundenabled)\r
+    return;\r
+  if (!option.sound)\r
+    return;\r
+\r
+  alListenerfv(AL_POSITION,position);\r
+  zerovector(vec);\r
+  alListenerfv(AL_VELOCITY,vec);\r
+  scalevector(alorientation,orientation[2],-1.0f);\r
+  copyvector(alorientation+3,orientation[1]);\r
+  alListenerfv(AL_ORIENTATION,alorientation);\r
+\r
+  if (game.currentsongnum!=-1)\r
+    {\r
+    if (game.exit!=0)\r
+      scale=0.3f-(float)(100-game.exitdelay)*0.003f;\r
+    else\r
+      scale=0.3f;\r
+\r
+    alSourcef(oggsource,AL_GAIN,scale*option.musicvolume);\r
+    }\r
+  else\r
+    alSourceStop(oggsource);\r
+\r
+  count=0;\r
+  while (count<numofsounds)\r
+    {\r
+    updateogg();\r
+\r
+    alGetSourcei(sound[count].alname,AL_SOURCE_STATE,&state);\r
+    while (count<numofsounds && sound[count].delay==0 && state!=AL_PLAYING && !sound[count].looping)\r
+      {\r
+      deletesound(count);\r
+      alGetSourcei(sound[count].alname,AL_SOURCE_STATE,&state);\r
+      }\r
+    count++;\r
+    }\r
+  }\r
+\r
+void playsound(int buffernum,float position[3],float velocity[3],float volume,int looping,float pitch,int objectnum,int objectsoundnum)\r
+  {\r
+  int count,count2;\r
+  float vec[3];\r
+  float intersectpoint[3];\r
+  float normal[3];\r
+  float scale;\r
+\r
+  if (!soundenabled)\r
+    return;\r
+\r
+  if (!option.sound)\r
+    return;\r
+\r
+  if (numofsounds>=12)\r
+    return;\r
+\r
+  if (game.oldschool==2)\r
+    {\r
+    if (buffernum==5)\r
+      buffernum=21;\r
+    if (buffernum==10)\r
+      buffernum=23;\r
+    if (buffernum<21)\r
+      return;\r
+    }\r
+\r
+  if (objectnum!=-1)\r
+  if (object[objectnum].soundnum[objectsoundnum]!=-1)\r
+    return;\r
+\r
+  if (!bufferloaded[buffernum])\r
+    return;\r
+\r
+  count2=0;\r
+  for (count=0;count<numofsounds;count++)\r
+    {\r
+    if (sound[count].buffernum==buffernum)\r
+      count2++;\r
+    }\r
+\r
+  //if (buffernum==0)\r
+  if (buffernum!=10 && buffernum!=15)\r
+  if (count2>=2)\r
+    return;\r
+\r
+  if (game.oldschool==2)\r
+  if (count2>=1)\r
+    return;\r
+\r
+  if (volume<0.0f)\r
+    volume=0.0f;\r
+  if (volume>1.0f)\r
+    volume=1.0f;\r
+  if (pitch<0.0f)\r
+    pitch=0.0f;\r
+  if (pitch>1.0f)\r
+    pitch=1.0f;\r
+\r
+  volume*=option.soundvolume;\r
+\r
+  sound[numofsounds].buffernum=buffernum;\r
+  sound[numofsounds].objectnum=-1;\r
+  sound[numofsounds].looping=looping;\r
+  sound[numofsounds].pitchshift=0;\r
+  alSourcei(sound[numofsounds].alname,AL_BUFFER,soundbuffer[buffernum]);\r
+  alSourcei(sound[numofsounds].alname,AL_LOOPING,looping);\r
+  alSourcefv(sound[numofsounds].alname,AL_POSITION,position);\r
+  if (velocity!=NULL)\r
+    scalevector(vec,velocity,PHYSICSCYCLE);\r
+  else\r
+    zerovector(vec);\r
+  alSourcefv(sound[numofsounds].alname,AL_VELOCITY,vec);\r
+  alSourcef(sound[numofsounds].alname,AL_REFERENCE_DISTANCE,5.0f);\r
+  alSourcef(sound[numofsounds].alname,AL_PITCH,pitch);\r
+\r
+  alSourcef(sound[numofsounds].alname,AL_GAIN,volume);\r
+\r
+  alSourcePlay(sound[numofsounds].alname);\r
+\r
+  updateogg();\r
+\r
+  sound[numofsounds].objectnum=objectnum;\r
+  object[objectnum].soundnum[objectsoundnum]=numofsounds;\r
+\r
+  numofsounds++;\r
+  }\r
+\r
+void deletesound(int soundnum)\r
+  {\r
+  int count,count2;\r
+  ALuint alnametemp;\r
+\r
+  if (!soundenabled)\r
+    return;\r
+\r
+  if (soundnum<0)\r
+    return;\r
+  if (soundnum>=numofsounds)\r
+    return;\r
+\r
+  if (sound[soundnum].objectnum!=-1)\r
+  for (count=0;count<4;count++)\r
+  if (object[sound[soundnum].objectnum].soundnum[count]==soundnum)\r
+    object[sound[soundnum].objectnum].soundnum[count]=-1;\r
+\r
+  numofsounds--;\r
+\r
+  alSourceStop(sound[soundnum].alname);\r
+\r
+  if (soundnum==numofsounds)\r
+    return;\r
+\r
+  alnametemp=sound[soundnum].alname;\r
+  memcpy(&sound[soundnum],&sound[numofsounds],sizeof(sound[soundnum]));\r
+  sound[numofsounds].alname=alnametemp;\r
+\r
+  if (sound[numofsounds].objectnum!=-1)\r
+  for (count=0;count<4;count++)\r
+  if (object[sound[numofsounds].objectnum].soundnum[count]==numofsounds)\r
+    object[sound[numofsounds].objectnum].soundnum[count]=soundnum;\r
+  }\r
diff --git a/game/audio.h b/game/audio.h
new file mode 100644 (file)
index 0000000..2c4fdce
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void soundsimulation(float position[3],float orientation[3][3]);\r
+void playsound(int buffernum,float position[3],float velocity[3],float volume,int looping,float pitch,int objectnum,int objectsoundnum);\r
+void deletesound(int soundnum);\r
+\r
+int numofsounds;\r
+struct\r
+  {\r
+  int buffernum;\r
+  int objectnum;\r
+  int looping;\r
+  int pitchshift;\r
+  ALuint alname;\r
+  int delay;\r
+  } sound[64];\r
+\r
diff --git a/game/block.c b/game/block.c
new file mode 100644 (file)
index 0000000..9f9043b
--- /dev/null
@@ -0,0 +1,328 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void saveblock(int blocknum)\r
+  {\r
+  int count;\r
+  int changeddir;\r
+  char filename[13]="blck000.blk";\r
+\r
+  changeddir=chdir("block");\r
+\r
+  filename[4]=48+(blocknum/100)%10;\r
+  filename[5]=48+(blocknum/10)%10;\r
+  filename[6]=48+blocknum%10;\r
+\r
+  if ((fp=fopen(filename,"wb"))!=NULL)\r
+    {\r
+    fwrite2(&block[blocknum].numoflines,4,1,fp);\r
+    for (count=0;count<block[blocknum].numoflines;count++)\r
+      fwrite2(block[blocknum].line[count],4,8,fp);\r
+\r
+    fclose(fp);\r
+    }\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+  }\r
+\r
+void loadblock(int blocknum)\r
+  {\r
+  int count;\r
+  int changeddir;\r
+  char filename[13]="blck000.blk";\r
+\r
+  changeddir=chdir("block");\r
+\r
+  filename[4]=48+(blocknum/100)%10;\r
+  filename[5]=48+(blocknum/10)%10;\r
+  filename[6]=48+blocknum%10;\r
+\r
+  block[blocknum].numoflines=0;\r
+  /*\r
+  if ((fp=fopen(filename,"rb"))!=NULL)\r
+    {\r
+    fread2(&block[blocknum].numoflines,4,1,fp);\r
+    for (count=0;count<block[blocknum].numoflines;count++)\r
+      {\r
+      fread2(block[blocknum].line[count],4,8,fp);\r
+      if (block[blocknum].line[count][4]==0.0f)\r
+        block[blocknum].line[count][4]=1.0f;\r
+      block[blocknum].friction=block[blocknum].line[count][4];\r
+      if (blocknum==160)\r
+        block[blocknum].breakpoint=0.125f*0.25f;\r
+      if (blocknum==161)\r
+        block[blocknum].breakpoint=0.125f*0.5f;\r
+      if (blocknum==162)\r
+        block[blocknum].breakpoint=0.125f;\r
+      if (blocknum==163)\r
+        block[blocknum].breakpoint=0.25f;\r
+      if (blocknum==164)\r
+        block[blocknum].breakpoint=0.5f;\r
+      if (blocknum==165)\r
+        block[blocknum].breakpoint=1.0f;\r
+      if (blocknum==166)\r
+        block[blocknum].breakpoint=2.0f;\r
+      if (blocknum==167)\r
+        block[blocknum].breakpoint=0.125f*0.5f;\r
+      block[blocknum].middamage=0;\r
+      block[blocknum].foredamage=0;\r
+      block[blocknum].density=0.0f;\r
+      block[blocknum].drag=0.0f;\r
+      block[blocknum].animation=0;\r
+      }\r
+\r
+    fclose(fp);\r
+    }\r
+  */\r
+\r
+  block[blocknum].numoflines=4;\r
+  count=0;\r
+  block[blocknum].line[count][0]=0.0f;\r
+  block[blocknum].line[count][1]=1.0f;\r
+  block[blocknum].line[count][2]=1.0f;\r
+  block[blocknum].line[count][3]=1.0f;\r
+  count=1;\r
+  block[blocknum].line[count][0]=1.0f;\r
+  block[blocknum].line[count][1]=1.0f;\r
+  block[blocknum].line[count][2]=1.0f;\r
+  block[blocknum].line[count][3]=0.0f;\r
+  count=2;\r
+  block[blocknum].line[count][0]=1.0f;\r
+  block[blocknum].line[count][1]=0.0f;\r
+  block[blocknum].line[count][2]=0.0f;\r
+  block[blocknum].line[count][3]=0.0f;\r
+  count=3;\r
+  block[blocknum].line[count][0]=0.0f;\r
+  block[blocknum].line[count][1]=0.0f;\r
+  block[blocknum].line[count][2]=0.0f;\r
+  block[blocknum].line[count][3]=1.0f;\r
+\r
+  block[blocknum].friction=1.0f;\r
+  block[blocknum].breakpoint=0.0f;\r
+  block[blocknum].middamage=0;\r
+  block[blocknum].foredamage=0;\r
+  block[blocknum].density=0.0f;\r
+  block[blocknum].drag=0.0f;\r
+  block[blocknum].animation=0;\r
+\r
+  setupblockflags(blocknum);\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+  }\r
+\r
+void setupblockflags(blocknum)\r
+  {\r
+  int count;\r
+\r
+  block[blocknum].flags=0;\r
+  for (count=0;count<block[blocknum].numoflines;count++)\r
+    {\r
+    if (block[blocknum].line[count][0]==0.0f)\r
+    if (block[blocknum].line[count][1]==1.0f)\r
+    if (block[blocknum].line[count][2]==1.0f)\r
+    if (block[blocknum].line[count][3]==1.0f)\r
+      block[blocknum].flags|=1;\r
+    \r
+    if (block[blocknum].line[count][0]==1.0f)\r
+    if (block[blocknum].line[count][1]==1.0f)\r
+    if (block[blocknum].line[count][2]==1.0f)\r
+    if (block[blocknum].line[count][3]==0.0f)\r
+      block[blocknum].flags|=2;\r
+    \r
+    if (block[blocknum].line[count][0]==1.0f)\r
+    if (block[blocknum].line[count][1]==0.0f)\r
+    if (block[blocknum].line[count][2]==0.0f)\r
+    if (block[blocknum].line[count][3]==0.0f)\r
+      block[blocknum].flags|=4;\r
+    \r
+    if (block[blocknum].line[count][0]==0.0f)\r
+    if (block[blocknum].line[count][1]==0.0f)\r
+    if (block[blocknum].line[count][2]==0.0f)\r
+    if (block[blocknum].line[count][3]==1.0f)\r
+      block[blocknum].flags|=8;\r
+    }\r
+  }\r
+\r
+void setupblockalpha(int blocknum)\r
+  {\r
+  int count,count2;\r
+  float x,y;\r
+  int yline;\r
+  int xleft,xright;\r
+  int xleftadd,xrightadd;\r
+  int xstart,xend;\r
+  int vertleft,vertright;\r
+  int vertleftnext,vertrightnext;\r
+  int yend;\r
+\r
+  numofpolygontemps=0;\r
+\r
+  for (count=0;count<block[blocknum].numoflines;count++)\r
+    {\r
+    x=block[blocknum].line[count][0];\r
+    y=block[blocknum].line[count][1];\r
+    y=1.0f-y;\r
+\r
+    for (count2=0;count2<numofpolygontemps;count2++)\r
+    if (x==polygontemp[count2].vertex[polygontemp[count2].numofverts-1][0])\r
+    if (y==polygontemp[count2].vertex[polygontemp[count2].numofverts-1][1])\r
+      {\r
+      x=block[blocknum].line[count][2];\r
+      y=block[blocknum].line[count][3];\r
+      y=1.0f-y;\r
+\r
+      polygontemp[count2].vertex[polygontemp[count2].numofverts][0]=x;\r
+      polygontemp[count2].vertex[polygontemp[count2].numofverts][1]=y;\r
+      polygontemp[count2].numofverts++;\r
+\r
+      goto createpolybypass;\r
+      }\r
+\r
+    polygontemp[numofpolygontemps].numofverts=0;\r
+\r
+    polygontemp[numofpolygontemps].vertex[polygontemp[numofpolygontemps].numofverts][0]=x;\r
+    polygontemp[numofpolygontemps].vertex[polygontemp[numofpolygontemps].numofverts][1]=y;\r
+    polygontemp[numofpolygontemps].numofverts++;\r
+\r
+    x=block[blocknum].line[count][2];\r
+    y=block[blocknum].line[count][3];\r
+    y=1.0f-y;\r
+\r
+    polygontemp[numofpolygontemps].vertex[polygontemp[numofpolygontemps].numofverts][0]=x;\r
+    polygontemp[numofpolygontemps].vertex[polygontemp[numofpolygontemps].numofverts][1]=y;\r
+    polygontemp[numofpolygontemps].numofverts++;\r
+    numofpolygontemps++;\r
+\r
+    createpolybypass:;\r
+    }\r
+\r
+  for (count2=0;count2<numofpolygontemps;count2++)\r
+    polygontemp[count2].numofverts--;\r
+\r
+  for (count2=0;count2<numofpolygontemps;count2++)\r
+  for (count=0;count<polygontemp[count2].numofverts;count++)\r
+    {\r
+    polygontemp[count2].ivertex[count][0]=polygontemp[count2].vertex[count][0]*(texture[blocknum].sizex+0);\r
+    polygontemp[count2].ivertex[count][1]=polygontemp[count2].vertex[count][1]*(texture[blocknum].sizey+0);\r
+    }\r
+\r
+\r
+  for (count2=0;count2<numofpolygontemps;count2++)\r
+  if (polygontemp[count2].numofverts>2)\r
+    {\r
+    yline=polygontemp[count2].ivertex[0][1];\r
+    xleft=polygontemp[count2].ivertex[0][0];\r
+    xright=polygontemp[count2].ivertex[0][0];\r
+    vertleft=0;\r
+    vertright=0;\r
+\r
+    for (count=1;count<polygontemp[count2].numofverts;count++)\r
+      {\r
+      if (yline>polygontemp[count2].ivertex[count][1] || (yline==polygontemp[count2].ivertex[count][1] && xleft>polygontemp[count2].ivertex[count][0]))\r
+        {\r
+        yline=polygontemp[count2].ivertex[count][1];\r
+        xleft=polygontemp[count2].ivertex[count][0];\r
+        xright=polygontemp[count2].ivertex[count][0];\r
+        vertleft=count;\r
+        vertright=count;\r
+        }\r
+      }\r
+\r
+    if (yline<0)\r
+      yline=0;\r
+\r
+    yend=polygontemp[count2].ivertex[0][1];\r
+    for (count=1;count<polygontemp[count2].numofverts;count++)\r
+      if (yend<polygontemp[count2].ivertex[count][1])\r
+        yend=polygontemp[count2].ivertex[count][1];\r
+\r
+    xleft<<=16;\r
+    xright<<=16;\r
+\r
+    if (vertleft>0)\r
+      vertleftnext=vertleft-1;\r
+    else\r
+      vertleftnext=polygontemp[count2].numofverts-1;\r
+\r
+    xleftadd=(polygontemp[count2].ivertex[vertleftnext][0]<<16)-xleft;\r
+    if ((polygontemp[count2].ivertex[vertleftnext][1]-yline)>0)\r
+      xleftadd/=(polygontemp[count2].ivertex[vertleftnext][1]-yline);\r
+\r
+    vertrightnext=(vertright+1)%polygontemp[count2].numofverts;\r
+\r
+    xrightadd=(polygontemp[count2].ivertex[vertrightnext][0]<<16)-xright;\r
+    if ((polygontemp[count2].ivertex[vertrightnext][1]-yline)>0)\r
+      xrightadd/=(polygontemp[count2].ivertex[vertrightnext][1]-yline);\r
+\r
+    while (yline<yend && yline<texture[blocknum].sizey)\r
+      {\r
+      xleft+=xleftadd;\r
+      xright+=xrightadd;\r
+\r
+      if (yline==polygontemp[count2].ivertex[vertleftnext][1])\r
+        {\r
+        vertleft=vertleftnext;\r
+\r
+        if (vertleft>0)\r
+          vertleftnext=vertleft-1;\r
+        else\r
+          vertleftnext=polygontemp[count2].numofverts-1;\r
+\r
+        xleftadd=(polygontemp[count2].ivertex[vertleftnext][0]<<16)-xleft;\r
+        if ((polygontemp[count2].ivertex[vertleftnext][1]-yline)>0)\r
+          xleftadd/=(polygontemp[count2].ivertex[vertleftnext][1]-yline);\r
+        }\r
+      if (yline==polygontemp[count2].ivertex[vertrightnext][1])\r
+        {\r
+        vertright=vertrightnext;\r
+\r
+        vertrightnext=(vertright+1)%polygontemp[count2].numofverts;\r
+    \r
+        xrightadd=(polygontemp[count2].ivertex[vertrightnext][0]<<16)-xright;\r
+        if ((polygontemp[count2].ivertex[vertrightnext][1]-yline)>0)\r
+          xrightadd/=(polygontemp[count2].ivertex[vertrightnext][1]-yline);\r
+        }\r
+\r
+      xstart=xleft>>16;\r
+      if (xstart<0)\r
+        xstart=0;\r
+      if (xstart>texture[blocknum].sizex-1)\r
+        xstart=texture[blocknum].sizex-1;\r
+      xend=xright>>16;\r
+      if (xend<0)\r
+        xend=0;\r
+      if (xend>texture[blocknum].sizex)\r
+        xend=texture[blocknum].sizex;\r
+\r
+      while (xstart<xend)\r
+        {\r
+        if (!bigendian)\r
+          texture[blocknum].rgba[0][yline*texture[blocknum].sizex+xstart]|=0xFF000000;\r
+        else\r
+          texture[blocknum].rgba[0][yline*texture[blocknum].sizex+xstart]|=0x000000FF;\r
+        xstart++;\r
+        }\r
+      yline++;\r
+      }\r
+    }\r
+  }\r
diff --git a/game/block.h b/game/block.h
new file mode 100644 (file)
index 0000000..854308b
--- /dev/null
@@ -0,0 +1,48 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void saveblock(int blocknum);\r
+void loadblock(int blocknum);\r
+void setupblockflags(blocknum);\r
+void setupblockalpha(int blocknum);\r
+\r
+struct\r
+  {\r
+  int numoflines;\r
+  float line[64][8];\r
+  float friction;\r
+  float breakpoint;\r
+  int middamage;\r
+  int foredamage;\r
+  float density;\r
+  float drag;\r
+  int animation;\r
+  int animationspeed;\r
+  int flags;\r
+  } block[1024];\r
+\r
+int numofpolygontemps;\r
+struct\r
+  {\r
+  int numofverts;\r
+  float vertex[16][2];\r
+  int ivertex[16][2];\r
+  } polygontemp[16];\r
diff --git a/game/boss.c b/game/boss.c
new file mode 100644 (file)
index 0000000..9c692a7
--- /dev/null
@@ -0,0 +1,147 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void createboss(int type,float position[3])\r
+  {\r
+  memset(&boss[numofbosses],0,sizeof(boss[0]));\r
+\r
+  boss[numofbosses].type=type;\r
+  boss[numofbosses].timetolive=10000;\r
+  copyvector(boss[numofbosses].position,position);\r
+  boss[numofbosses].animationnum=14;\r
+  boss[numofbosses].size[0]=3.0f;\r
+  boss[numofbosses].size[1]=3.0f;\r
+\r
+  numofbosses++;\r
+  }\r
+\r
+void bosssimulation(void)\r
+  {\r
+  int count,count2;\r
+  float vec[3];\r
+\r
+  for (count=0;count<numofbosses;count++)\r
+    {\r
+    if (boss[count].timetolive>100)\r
+      {\r
+      subtractvectors(vec,object[0].position,boss[count].position);\r
+      if (boss[count].animationtype!=2)\r
+      if (vectorlength(vec)<3.0f)\r
+        {\r
+        boss[count].animationtype=2;\r
+        boss[count].frame=0;\r
+        boss[count].framedelay=0.0f;\r
+        }\r
+      if (boss[count].animationtype==2)\r
+      if (vectorlength(vec)>=3.0f)\r
+        {\r
+        boss[count].animationtype=1;\r
+        boss[count].frame=0;\r
+        boss[count].framedelay=0.0f;\r
+        }\r
+\r
+      if (vectorlength(vec)>2.5f)\r
+        scaleaddvectors(boss[count].velocity,boss[count].velocity,vec,0.003f);\r
+      scalevector(boss[count].velocity,boss[count].velocity,0.75f);\r
+      addvectors(boss[count].position,boss[count].position,boss[count].velocity);\r
+\r
+      if (boss[count].animationtype!=2)\r
+        {\r
+        boss[count].framedelay+=0.1f;\r
+        if (boss[count].framedelay>=1.0f)\r
+          {\r
+          boss[count].framedelay=0.0f;\r
+          boss[count].frame++;\r
+          if (boss[count].frame>=animation[boss[count].animationnum].walk[1])\r
+            boss[count].frame=0;\r
+          }\r
+        boss[count].texturenum=animation[boss[count].animationnum].walk[0]+boss[count].frame;\r
+        }\r
+      else\r
+        {\r
+        boss[count].framedelay+=0.15f;\r
+        if (boss[count].framedelay>=1.0f)\r
+          {\r
+          boss[count].framedelay=0.0f;\r
+          boss[count].frame++;\r
+          if (boss[count].frame>=animation[boss[count].animationnum].attack[1])\r
+            boss[count].frame=0;\r
+          }\r
+        boss[count].texturenum=animation[boss[count].animationnum].attack[0]+boss[count].frame;\r
+\r
+        if (boss[count].frame==3)\r
+          object[0].hitpoints-=10;\r
+        }\r
+\r
+      if (boss[count].velocity[0]>0.0f)\r
+        boss[count].direction=0;\r
+      else\r
+        boss[count].direction=1;\r
+  \r
+      if (frame.numoflights>1)\r
+      if (boss[count].timetolive>150)\r
+        boss[count].timetolive=150;\r
+      }\r
+    if (boss[count].timetolive<45)\r
+      {\r
+      boss[count].animationtype=3;\r
+      boss[count].frame=0;\r
+      boss[count].framedelay=0.0f;\r
+      boss[count].texturenum=animation[boss[count].animationnum].die[0]+8-boss[count].timetolive/5;\r
+      }\r
+    }\r
+  }\r
+\r
+void bosstimetolive(void)\r
+  {\r
+  int count;\r
+\r
+  count=0;\r
+  while (count<numofbosses)\r
+    {\r
+    if (boss[count].timetolive<10000)\r
+      boss[count].timetolive--;\r
+    while (count<numofbosses && boss[count].timetolive<0)\r
+      {\r
+      deleteboss(count);\r
+\r
+      if (boss[count].timetolive<10000)\r
+        boss[count].timetolive--;\r
+      }\r
+    count++;\r
+    }\r
+  }\r
+\r
+void deleteboss(int bossnum)\r
+  {\r
+  if (bossnum<0)\r
+    return;\r
+  if (bossnum>=numofbosses)\r
+    return;\r
+\r
+  numofbosses--;\r
+\r
+  if (bossnum==numofbosses)\r
+    return;\r
+\r
+  memcpy(&boss[bossnum],&boss[numofbosses],sizeof(boss[0]));\r
+  }\r
+\r
diff --git a/game/boss.h b/game/boss.h
new file mode 100644 (file)
index 0000000..569ba5c
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void createboss(int type,float position[3]);\r
+void bosssimulation(void);\r
+void bosstimetolive(void);\r
+void deleteboss(int bossnum);\r
+\r
+int numofbosses;\r
+struct\r
+  {\r
+  int type;\r
+  float position[3];\r
+  float velocity[3];\r
+  int timetolive;\r
+  int direction;\r
+  int texturenum;\r
+  int animationnum;\r
+  int animationtype;\r
+  int frame;\r
+  float size[2];\r
+  float framedelay;\r
+  } boss[16];\r
diff --git a/game/config.c b/game/config.c
new file mode 100644 (file)
index 0000000..4ce50b7
--- /dev/null
@@ -0,0 +1,310 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void loadconfig(void)\r
+  {\r
+  int count,count2;\r
+  char tempstr[32];\r
+\r
+  config.resolutionx=800;\r
+  config.resolutiony=600;\r
+  config.bitsperpixel=32;\r
+  config.depthbits=24;\r
+  config.stencilbits=8;\r
+  config.fullscreen=0;\r
+  config.sound=1;\r
+  config.music=1;\r
+  config.joystick=1;\r
+\r
+  option.sound=1;\r
+  option.music=1;\r
+  option.soundvolume=1.0f;\r
+  option.musicvolume=1.0f;\r
+\r
+  control[0].key[0]=SCAN_LEFT;\r
+  control[0].key[1]=SCAN_RIGHT;\r
+  control[0].key[2]=SCAN_DOWN;\r
+  control[0].key[3]=SCAN_UP;\r
+  control[0].key[4]=SCAN_A;\r
+  control[0].key[5]=SCAN_SPACE;\r
+  control[0].key[6]=SCAN_S;\r
+  control[0].key[7]=SCAN_D;\r
+  control[0].joysticknum=0;\r
+  control[0].axis[0]=0;\r
+  control[0].axis[1]=1;\r
+  for (count=0;count<4;count++)\r
+    control[0].button[count]=-1;\r
+  for (count=0;count<4;count++)\r
+    control[0].button[count+4]=count;\r
+  control[0].button[8]=5;\r
+\r
+  control[1].joysticknum=-1;\r
+  control[1].axis[0]=0;\r
+  control[1].axis[1]=1;\r
+  for (count=0;count<4;count++)\r
+    control[1].button[count]=-1;\r
+  for (count=0;count<4;count++)\r
+    control[1].button[count+4]=count;\r
+\r
+  control[2].joysticknum=-1;\r
+  control[2].axis[0]=0;\r
+  control[2].axis[1]=1;\r
+  for (count=0;count<4;count++)\r
+    control[2].button[count]=-1;\r
+  for (count=0;count<4;count++)\r
+    control[2].button[count+4]=count;\r
+\r
+  control[3].joysticknum=-1;\r
+  control[3].axis[0]=0;\r
+  control[3].axis[1]=1;\r
+  for (count=0;count<4;count++)\r
+    control[3].button[count]=-1;\r
+  for (count=0;count<4;count++)\r
+    control[3].button[count+4]=count;\r
+\r
+  loadtextfile("config.txt");\r
+  optionreadint(&config.resolutionx,"screenwidth=");\r
+  optionreadint(&config.resolutiony,"screenheight=");\r
+  optionreadint(&config.bitsperpixel,"bitsperpixel=");\r
+  optionreadint(&config.depthbits,"depthbits=");\r
+  optionreadint(&config.stencilbits,"stencilbits=");\r
+  optionreadint(&config.fullscreen,"fullscreen=");\r
+  optionreadint(&config.sound,"sound=");\r
+  optionreadint(&config.music,"music=");\r
+  optionreadint(&config.joystick,"joystick=");\r
+\r
+  optionreadint(&option.sound,"soundon=");\r
+  optionreadint(&option.music,"musicon=");\r
+  count=-1;\r
+  optionreadint(&count,"soundvolume=");\r
+  if (count!=-1)\r
+    option.soundvolume=(float)count/100.0f;\r
+  count=-1;\r
+  optionreadint(&count,"musicvolume=");\r
+  if (count!=-1)\r
+    option.musicvolume=(float)count/100.0f;\r
+\r
+  for (count=0;count<4;count++)\r
+    {\r
+    for (count2=0;count2<16;count2++)\r
+      {\r
+      sprintf(tempstr,"player%dkey%d=",count+1,count2+1);\r
+      optionreadint(&control[count].key[count2],tempstr);\r
+      }\r
+\r
+    sprintf(tempstr,"player%djoysticknum=",count+1);\r
+    optionreadint(&control[count].joysticknum,tempstr);\r
+\r
+    for (count2=0;count2<4;count2++)\r
+      {\r
+      sprintf(tempstr,"player%daxis%d=",count+1,count2+1);\r
+      optionreadint(&control[count].axis[count2],tempstr);\r
+      }\r
+    for (count2=0;count2<16;count2++)\r
+      {\r
+      sprintf(tempstr,"player%dbutton%d=",count+1,count2+1);\r
+      optionreadint(&control[count].button[count2],tempstr);\r
+      }\r
+    }\r
+\r
+  windowinfo.resolutionx=config.resolutionx;\r
+  windowinfo.resolutiony=config.resolutiony;\r
+  windowinfo.bitsperpixel=config.bitsperpixel;\r
+  windowinfo.depthbits=config.depthbits;\r
+  windowinfo.stencilbits=config.stencilbits;\r
+  windowinfo.fullscreen=config.fullscreen;\r
+  }\r
+\r
+void saveconfig(void)\r
+  {\r
+  int count,count2;\r
+  char tempstr[32];\r
+\r
+  config.resolutionx=windowinfo.resolutionx;\r
+  config.resolutiony=windowinfo.resolutiony;\r
+  config.bitsperpixel=windowinfo.bitsperpixel;\r
+  config.depthbits=windowinfo.depthbits;\r
+  config.stencilbits=windowinfo.stencilbits;\r
+  config.fullscreen=windowinfo.fullscreen;\r
+\r
+  if ((fp=fopen("config.txt","wb"))==NULL)\r
+    return;\r
+\r
+  optionwriteint(&config.resolutionx,"screenwidth=");\r
+  optionwriteint(&config.resolutiony,"screenheight=");\r
+  optionwriteint(&config.bitsperpixel,"bitsperpixel=");\r
+  optionwriteint(&config.depthbits,"depthbits=");\r
+  optionwriteint(&config.stencilbits,"stencilbits=");\r
+  optionwriteint(&config.fullscreen,"fullscreen=");\r
+  optionwriteint(&config.sound,"sound=");\r
+  optionwriteint(&config.music,"music=");\r
+  optionwriteint(&config.joystick,"joystick=");\r
+\r
+  optionwriteint(&option.sound,"soundon=");\r
+  optionwriteint(&option.music,"musicon=");\r
+  count=option.soundvolume*100.0f;\r
+  optionwriteint(&count,"soundvolume=");\r
+  count=option.musicvolume*100.0f;\r
+  optionwriteint(&count,"musicvolume=");\r
+\r
+  for (count=0;count<4;count++)\r
+    {\r
+    for (count2=0;count2<16;count2++)\r
+      {\r
+      sprintf(tempstr,"player%dkey%d=",count+1,count2+1);\r
+      optionwriteint(&control[count].key[count2],tempstr);\r
+      }\r
+\r
+    sprintf(tempstr,"player%djoysticknum=",count+1);\r
+    optionwriteint(&control[count].joysticknum,tempstr);\r
+\r
+    for (count2=0;count2<4;count2++)\r
+      {\r
+      sprintf(tempstr,"player%daxis%d=",count+1,count2+1);\r
+      optionwriteint(&control[count].axis[count2],tempstr);\r
+      }\r
+    for (count2=0;count2<16;count2++)\r
+      {\r
+      sprintf(tempstr,"player%dbutton%d=",count+1,count2+1);\r
+      optionwriteint(&control[count].button[count2],tempstr);\r
+      }\r
+    }\r
+\r
+  fclose(fp);\r
+  }\r
+\r
+void notsupportedmenu(void)\r
+  {\r
+  int count;\r
+  char *glvendor;\r
+  char *glrenderer;\r
+  char *glversion;\r
+  char *ext;\r
+\r
+  glvendor=(char *) glGetString(GL_VENDOR);\r
+  glrenderer=(char *) glGetString(GL_RENDERER);\r
+  glversion=(char *) glGetString(GL_VERSION);\r
+  ext=(char *) glGetString(GL_EXTENSIONS);\r
+\r
+  resetmenuitems();\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem("Exit",8,8,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+    count=352;\r
+    createmenuitem("NVIDIA Drivers",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    count+=16;\r
+    createmenuitem("ATI Drivers",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    count+=16;\r
+    createmenuitem("Intel Drivers",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    count+=16;\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    count=224;\r
+    drawtext("Multitexture required",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    count+=16;\r
+    count+=16;\r
+    drawtext("Make sure you have the",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    count+=16;\r
+    drawtext("latest video card drivers",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    count+=16;\r
+    drawtext("for your computer",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    count+=16;\r
+\r
+    count=432;\r
+    drawtext("GL_VERSION: /s",8,count,12,1.0f,1.0f,1.0f,1.0f,glversion);\r
+    count+=12;\r
+    drawtext("GL_VENDOR: /s",8,count,12,1.0f,1.0f,1.0f,1.0f,glvendor);\r
+    count+=12;\r
+    drawtext("GL_RENDERER: /s",8,count,12,1.0f,1.0f,1.0f,1.0f,glrenderer);\r
+    count+=12;\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if (menuitem[1].active)\r
+      {\r
+      launchwebpage("www.nvidia.com/content/drivers/drivers.asp");\r
+      menuitem[1].active=0;\r
+      }\r
+    if (menuitem[2].active)\r
+      {\r
+      launchwebpage("ati.amd.com/support/driver.html");\r
+      menuitem[2].active=0;\r
+      }\r
+    if (menuitem[3].active)\r
+      {\r
+      launchwebpage("downloadcenter.intel.com");\r
+      menuitem[3].active=0;\r
+      }\r
+    }\r
+\r
+  resetmenuitems();\r
+\r
+  if ((fp=fopen("glreport.txt","wb"))==NULL)\r
+    return;\r
+\r
+  fprintf(fp,"%s\r\n",glversion);\r
+  fprintf(fp,"%s\r\n",glvendor);\r
+  fprintf(fp,"%s\r\n",glrenderer);\r
+  fprintf(fp,"%s\r\n",ext);\r
+  }\r
+\r
+void optionreadint(int *ptr,char *str)\r
+  {\r
+  if (findstring(str))\r
+    *ptr=getint();\r
+\r
+  parser.textloc=0;\r
+  }\r
+\r
+void optionwriteint(int *ptr,char *str)\r
+  {\r
+  fprintf(fp,"%s%d\r\n",str,*ptr);\r
+  }\r
+\r
+void optionreadstring(char *ptr,char *str,int size)\r
+  {\r
+  if (findstring(str))\r
+    getstring(ptr,size);\r
+\r
+  parser.textloc=0;\r
+  }\r
+\r
+void optionwritestring(char *ptr,char *str,int size)\r
+  {\r
+  fprintf(fp,"%s%s\r\n",str,ptr);\r
+  }\r
+\r
diff --git a/game/config.h b/game/config.h
new file mode 100644 (file)
index 0000000..df7a3c2
--- /dev/null
@@ -0,0 +1,28 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void loadconfig(void);\r
+void saveconfig(void);\r
+void notsupportedmenu(void);\r
+void optionreadint(int *ptr,char *str);\r
+void optionwriteint(int *ptr,char *str);\r
+void optionreadstring(char *ptr,char *str,int size);\r
+void optionwritestring(char *ptr,char *str,int size);\r
diff --git a/game/credits.c b/game/credits.c
new file mode 100644 (file)
index 0000000..53477b2
--- /dev/null
@@ -0,0 +1,196 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void creditsmenu(void)\r
+  {\r
+  int count,count2;\r
+  int secretsequence;\r
+  float vec[3];\r
+\r
+  secretsequence=0;\r
+\r
+  resetmenuitems();\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+               count=sizeof(TXT_GISHUSES+1)*12+64;\r
+    createmenuitem("SDL",count,400,12,1.0f,1.0f,1.0f,1.0f);\r
+    createmenuitem("OpenGL",count+5*12,400,12,1.0f,1.0f,1.0f,1.0f);\r
+    createmenuitem("OpenAL",count+5*12+8*12,400,12,1.0f,1.0f,1.0f,1.0f);\r
+    createmenuitem("Ogg Vorbis",count+5*12+8*12+8*12,400,12,1.0f,1.0f,1.0f,1.0f);\r
+    createmenuitem("Mendo Mate",64,388,12,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    if (secretsequence==0)\r
+      count2=SCAN_S;\r
+    if (secretsequence==1)\r
+      count2=SCAN_U;\r
+    if (secretsequence==2)\r
+      count2=SCAN_P;\r
+    if (secretsequence==3)\r
+      count2=SCAN_E;\r
+    if (secretsequence==4)\r
+      count2=SCAN_R;\r
+    if (secretsequence==5)\r
+      count2=SCAN_S;\r
+    if (secretsequence==6)\r
+      count2=SCAN_I;\r
+    if (secretsequence==7)\r
+      count2=SCAN_Z;\r
+    if (secretsequence==8)\r
+      count2=SCAN_E;\r
+    if (secretsequence==9)\r
+      count2=SCAN_M;\r
+    if (secretsequence==10)\r
+      count2=SCAN_E;\r
+\r
+    if (secretsequence==11)\r
+      {\r
+      if (game.supersize==0)\r
+        {\r
+        vec[0]=0.0f;\r
+        vec[1]=0.0f;\r
+        vec[2]=0.0f;\r
+        playsound(12,vec,NULL,0.4f,0,1.0f,-1,0);\r
+        }\r
+      game.supersize=1;\r
+      }\r
+\r
+    for (count=0;count<256;count++)\r
+    if (keyboard[count] && !prevkeyboard[count])\r
+      {\r
+      if (count==count2)\r
+        secretsequence++;\r
+      else\r
+        secretsequence=0;\r
+      }\r
+  \r
+    updateogg();\r
+    checkmusic();\r
+    game.songnum=8;\r
+    soundsimulation(view.position,view.orientation);\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(580);\r
+\r
+    drawtext(TXT_CREDITS,(320|TEXT_CENTER),48,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    count=64;\r
+    count+=12;\r
+    drawtext(TXT_DESIGN,64,count,12,0.5f,0.5f,0.5f,1.0f);\r
+    count+=12;\r
+    drawtext("Edmund McMillen",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    drawtext("Alex Austin",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    drawtext("Josiah Pisciotta",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    count+=12;\r
+    drawtext(TXT_PROGRAMMING,64,count,12,0.5f,0.5f,0.5f,1.0f);\r
+    count+=12;\r
+    drawtext("Alex Austin",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    drawtext("Josiah Pisciotta",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    count+=12;\r
+    drawtext(TXT_ART,64,count,12,0.5f,0.5f,0.5f,1.0f);\r
+    count+=12;\r
+    drawtext("Edmund McMillen",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    count+=12;\r
+    drawtext(TXT_SOUND_MUSIC,64,count,12,0.5f,0.5f,0.5f,1.0f);\r
+    count+=12;\r
+    drawtext("Game Audio Magic",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    count+=12;\r
+    drawtext(TXT_ADDITIONAL_DIALOG,64,count,12,0.5f,0.5f,0.5f,1.0f);\r
+    count+=12;\r
+    drawtext("Dave Strock",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    count+=12;\r
+    drawtext(TXT_ADDITIONAL_CONTENT,64,count,12,0.5f,0.5f,0.5f,1.0f);\r
+    count+=12;\r
+    drawtext("Riftmaster",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    drawtext("Will Stamper",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    count+=12;\r
+    drawtext(TXT_THANKS,64,count,12,0.5f,0.5f,0.5f,1.0f);\r
+    count+=12;\r
+    drawtext("Ed thanks Danielle",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    drawtext("Beta Testers",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    drawtext("Roy Sawyers",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    //drawtext("Mendo Mate",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+    count+=12;\r
+    drawtext(TXT_GISHUSES"    ,       ,       , ",64,count,12,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if (menuitem[1].active)\r
+      {\r
+      launchwebpage("www.libsdl.org");\r
+      menuitem[1].active=0;\r
+      }\r
+    if (menuitem[2].active)\r
+      {\r
+      launchwebpage("www.opengl.org");\r
+      menuitem[2].active=0;\r
+      }\r
+    if (menuitem[3].active)\r
+      {\r
+      launchwebpage("www.openal.org");\r
+      menuitem[3].active=0;\r
+      }\r
+    if (menuitem[4].active)\r
+      {\r
+      launchwebpage("www.xiph.org");\r
+      menuitem[4].active=0;\r
+      }\r
+    if (menuitem[5].active)\r
+      {\r
+      launchwebpage("www.mendomate.com");\r
+      menuitem[5].active=0;\r
+      }\r
+    }\r
+\r
+  resetmenuitems();\r
+  }\r
diff --git a/game/credits.h b/game/credits.h
new file mode 100644 (file)
index 0000000..f10e48d
--- /dev/null
@@ -0,0 +1,22 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void creditsmenu(void);\r
diff --git a/game/custom.c b/game/custom.c
new file mode 100644 (file)
index 0000000..8267e67
--- /dev/null
@@ -0,0 +1,627 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void custommenu(void)\r
+  {\r
+  int count;\r
+\r
+  resetmenuitems();\r
+\r
+  joymenunum=1;\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_EXIT,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+    count=352;\r
+    createmenuitem(TXT_PLAY_CAMPAIGN,48,count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_C);\r
+    count+=16;\r
+    createmenuitem(TXT_LOAD_LEVEL,48,count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_L);\r
+    count+=16;\r
+    createmenuitem(TXT_LEVEL_EDITOR,48,count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_E);\r
+    count+=16;\r
+    createmenuitem(TXT_CAMPAIGN_EDITOR,48,count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_A);\r
+    count+=16;\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    updateogg();\r
+    checkmusic();\r
+    game.songnum=8;\r
+    soundsimulation(view.position,view.orientation);\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(620);\r
+\r
+    drawtext(TXT_CUSTOM_LEVELS,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if (menuitem[1].active)\r
+      {\r
+      game.songnum=-1;\r
+      checkmusic();\r
+\r
+      game.editing=0;\r
+\r
+      playcampaignmenu();\r
+      }\r
+    if (menuitem[2].active)\r
+      {\r
+      game.songnum=-1;\r
+      checkmusic();\r
+\r
+      game.editing=0;\r
+\r
+      loadlevelmenu();\r
+      }\r
+    if (menuitem[3].active)\r
+      {\r
+      game.songnum=-1;\r
+      checkmusic();\r
+\r
+      game.editing=1;\r
+      game.levelnum=0;\r
+      createlevel();\r
+      gameloop();\r
+\r
+      game.editing=0;\r
+      }\r
+    if (menuitem[4].active)\r
+      {\r
+      newmappackmenu();\r
+      }\r
+    }\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void loadlevelmenu(void)\r
+  {\r
+  int count,count2;\r
+  int changeddir;\r
+  int numoffiles;\r
+  int pagenum;\r
+\r
+  changeddir=chdir("level");\r
+\r
+  listfiles("*.lvl",levellist,0);\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+\r
+  numoffiles=0;\r
+  while (levellist[numoffiles][0]!=0)\r
+    numoffiles++;\r
+\r
+  pagenum=0;\r
+\r
+  resetmenuitems();\r
+\r
+  joymenunum=1;\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+    count=0;\r
+    for (count2=0;count2<8;count2++)\r
+    if (pagenum+count<numoffiles)\r
+      {\r
+      createmenuitem(levellist[pagenum+count],64,320+count2*12,12,1.0f,1.0f,1.0f,1.0f);\r
+      count++;\r
+      }\r
+    for (count2=0;count2<8;count2++)\r
+    if (pagenum+count<numoffiles)\r
+      {\r
+      createmenuitem(levellist[pagenum+count],256,320+count2*12,12,1.0f,1.0f,1.0f,1.0f);\r
+      count++;\r
+      }\r
+    for (count2=0;count2<8;count2++)\r
+    if (pagenum+count<numoffiles)\r
+      {\r
+      createmenuitem(levellist[pagenum+count],448,320+count2*12,12,1.0f,1.0f,1.0f,1.0f);\r
+      count++;\r
+      }\r
+\r
+    createmenuitem(TXT_PAGE_UP,(304|TEXT_END),416,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_PAGEUP);\r
+    setmenuitem(MO_SET,&pagenum,pagenum-24);\r
+    if (pagenum<24)\r
+      setmenuitem(MO_HIGHLIGHT,0);\r
+\r
+    createmenuitem(TXT_PAGE_DOWN,320,416,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_PAGEDOWN);\r
+    setmenuitem(MO_SET,&pagenum,pagenum+24);\r
+    if (pagenum+24>=numoffiles)\r
+      setmenuitem(MO_HIGHLIGHT,0);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(620);\r
+\r
+    drawtext(TXT_LOAD_LEVEL,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    for (count=1;count<=24;count++)\r
+    if (pagenum+count-1<numoffiles)\r
+    if (menuitem[count].active)\r
+      {\r
+      game.editing=0;\r
+      game.levelnum=0;\r
+      loadlevel(levellist[pagenum+count-1]);\r
+      gameloop();\r
+\r
+      joymenunum=count;\r
+      }\r
+    }\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void playcampaignmenu(void)\r
+  {\r
+  int count,count2;\r
+  int changeddir;\r
+  int numoffiles;\r
+  int pagenum;\r
+\r
+  changeddir=chdir("level");\r
+\r
+  listfiles("*.gmp",levellist,0);\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+\r
+  numoffiles=0;\r
+  while (levellist[numoffiles][0]!=0)\r
+    numoffiles++;\r
+\r
+  pagenum=0;\r
+\r
+  resetmenuitems();\r
+\r
+  joymenunum=1;\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+    count=0;\r
+    for (count2=0;count2<8;count2++)\r
+    if (pagenum+count<numoffiles)\r
+      {\r
+      createmenuitem(levellist[pagenum+count],64,320+count2*12,12,1.0f,1.0f,1.0f,1.0f);\r
+      count++;\r
+      }\r
+    for (count2=0;count2<8;count2++)\r
+    if (pagenum+count<numoffiles)\r
+      {\r
+      createmenuitem(levellist[pagenum+count],256,320+count2*12,12,1.0f,1.0f,1.0f,1.0f);\r
+      count++;\r
+      }\r
+    for (count2=0;count2<8;count2++)\r
+    if (pagenum+count<numoffiles)\r
+      {\r
+      createmenuitem(levellist[pagenum+count],448,320+count2*12,12,1.0f,1.0f,1.0f,1.0f);\r
+      count++;\r
+      }\r
+\r
+    createmenuitem(TXT_PAGE_UP,(304|TEXT_END),416,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_PAGEUP);\r
+    setmenuitem(MO_SET,&pagenum,pagenum-24);\r
+    if (pagenum<24)\r
+      setmenuitem(MO_HIGHLIGHT,0);\r
+\r
+    createmenuitem(TXT_PAGE_DOWN,320,416,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_PAGEDOWN);\r
+    setmenuitem(MO_SET,&pagenum,pagenum+24);\r
+    if (pagenum+24>=numoffiles)\r
+      setmenuitem(MO_HIGHLIGHT,0);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(620);\r
+\r
+    drawtext(TXT_PLAY_CAMPAIGN,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    for (count=1;count<=24;count++)\r
+    if (pagenum+count-1<numoffiles)\r
+    if (menuitem[count].active)\r
+      {\r
+      strcpy(mappack.filename,levellist[pagenum+count-1]);\r
+      loadmappack();\r
+      campaignmenu();\r
+      }\r
+    }\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void campaignmenu(void)\r
+  {\r
+  int count;\r
+\r
+  loadplayermappack();\r
+\r
+  resetmenuitems();\r
+\r
+  joymenunum=1;\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+    count=352;\r
+    if (playermappack[playernum].levelnum>0)\r
+      {\r
+      createmenuitem(TXT_CONTINUE,48,count,16,1.0f,1.0f,1.0f,1.0f);\r
+      setmenuitem(MO_HOTKEY,SCAN_C);\r
+      count+=16;\r
+      }\r
+    else\r
+      createmenuitemempty();\r
+    createmenuitem(TXT_NEW_GAME,48,count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_N);\r
+    count+=16;\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(620);\r
+\r
+    drawtext(mappack.name,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    if (player[playernum].levelnum>0)\r
+      drawtext(TXT_PLAYER_INFO_MAPPACK,(320|TEXT_CENTER),320,12,1.0f,1.0f,1.0f,1.0f,mappack.levelname[playermappack[playernum].levelnum-1],playermappack[playernum].numoflives,playermappack[playernum].totalscore,playermappack[playernum].highscore);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if (menuitem[1].active || menuitem[2].active)\r
+      {\r
+      if (menuitem[2].active)\r
+        {\r
+        playerdifficultymenu();\r
+        if (game.difficulty==-1)\r
+          {\r
+          game.difficulty=0;\r
+          goto newgamebypass;\r
+          }\r
+\r
+        playermappack[playernum].difficulty=game.difficulty;\r
+\r
+        playermappack[playernum].levelnum=1;\r
+        playermappack[playernum].totalscore=0;\r
+        playermappack[playernum].numoflives=5;\r
+        if (playermappack[playernum].difficulty==3)\r
+          playermappack[playernum].numoflives=0;\r
+        }\r
+\r
+      mappackpregamemenu();\r
+\r
+      newgamebypass:;\r
+      }\r
+    }\r
+\r
+  resetmenuitems();\r
+\r
+  saveplayermappack();\r
+  }\r
+\r
+void loadplayermappack(void)\r
+  {\r
+  int count;\r
+  int version;\r
+  int changeddir;\r
+  char filename[32];\r
+\r
+  changeddir=chdir("player");\r
+\r
+  count=0;\r
+  while (count<24 && mappack.filename[count]!='.')\r
+    {\r
+    filename[count]=mappack.filename[count];\r
+    count++;\r
+    }\r
+  filename[count]=0;\r
+\r
+  strcat(filename,".gpp");\r
+\r
+  playermappack[playernum].levelnum=0;\r
+\r
+  if ((fp=fopen(filename,"rb"))!=NULL)\r
+    {\r
+    fread2(&version,4,1,fp);\r
+    if (version==1)\r
+      {\r
+      for (count=0;count<8;count++)\r
+        {\r
+        fread2(&playermappack[count].levelnum,4,1,fp);\r
+        fread2(&playermappack[count].numoflives,4,1,fp);\r
+        fread2(&playermappack[count].totalscore,4,1,fp);\r
+        fread2(&playermappack[count].difficulty,4,1,fp);\r
+        fread2(&player[count].highscore,4,1,fp);\r
+        }\r
+      }\r
+    fclose(fp);\r
+    }\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+  }\r
+\r
+void saveplayermappack(void)\r
+  {\r
+  int count;\r
+  int version;\r
+  int changeddir;\r
+  char filename[32];\r
+\r
+  changeddir=chdir("player");\r
+\r
+  count=0;\r
+  while (count<24 && mappack.filename[count]!='.')\r
+    {\r
+    filename[count]=mappack.filename[count];\r
+    count++;\r
+    }\r
+  filename[count]=0;\r
+\r
+  strcat(filename,".gpp");\r
+\r
+  if ((fp=fopen(filename,"wb"))!=NULL)\r
+    {\r
+    version=1;\r
+    fwrite2(&version,4,1,fp);\r
+    for (count=0;count<8;count++)\r
+      {\r
+      fwrite2(&playermappack[count].levelnum,4,1,fp);\r
+      fwrite2(&playermappack[count].numoflives,4,1,fp);\r
+      fwrite2(&playermappack[count].totalscore,4,1,fp);\r
+      fwrite2(&playermappack[count].difficulty,4,1,fp);\r
+      fwrite2(&player[count].highscore,4,1,fp);\r
+      }\r
+    fclose(fp);\r
+    }\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+  }\r
+\r
+void loadmappack(void)\r
+  {\r
+  int count;\r
+  int version;\r
+  int changeddir;\r
+\r
+  changeddir=chdir("level");\r
+\r
+  if ((fp=fopen(mappack.filename,"rb"))!=NULL)\r
+    {\r
+    fread2(&version,4,1,fp);\r
+\r
+    if (version==1)\r
+      {\r
+      fread2(&mappack.numoflevels,4,1,fp);\r
+      fread2(mappack.name,1,32,fp);\r
+      for (count=0;count<64;count++)\r
+        {\r
+        fread2(mappack.level[count],1,32,fp);\r
+        fread2(mappack.levelname[count],1,32,fp);\r
+        fread2(mappack.levelmusic[count],1,32,fp);\r
+        }\r
+      for (count=0;count<16;count++)\r
+        fread2(mappack.ending[count],1,64,fp);\r
+      }\r
+\r
+    fclose(fp);\r
+    }\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+  }\r
+\r
+void savemappack(void)\r
+  {\r
+  int count;\r
+  int version;\r
+  int changeddir;\r
+\r
+  changeddir=chdir("level");\r
+\r
+  if ((fp=fopen(mappack.filename,"wb"))!=NULL)\r
+    {\r
+    version=1;\r
+    fwrite2(&version,4,1,fp);\r
+\r
+    fwrite2(&mappack.numoflevels,4,1,fp);\r
+    fwrite2(mappack.name,1,32,fp);\r
+    for (count=0;count<64;count++)\r
+      {\r
+      fwrite2(mappack.level[count],1,32,fp);\r
+      fwrite2(mappack.levelname[count],1,32,fp);\r
+      fwrite2(mappack.levelmusic[count],1,32,fp);\r
+      }\r
+    for (count=0;count<16;count++)\r
+      fwrite2(mappack.ending[count],1,64,fp);\r
+\r
+    fclose(fp);\r
+    }\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+  }\r
+\r
+void newmappackmenu(void)\r
+  {\r
+  int count;\r
+\r
+  joystickmenu=0;\r
+\r
+  resetmenuitems();\r
+\r
+  while (!menuitem[0].active && !menuitem[1].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+    createmenuitem(TXT_SAVE,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f);\r
+    createmenuitem(TXT_ADD_LEVEL,(640|TEXT_END),464,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_A);\r
+    createmenuitem(TXT_DELETE_LEVEL,0,464,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_DELETE);\r
+\r
+    createmenuitem(TXT_FILENAME"        ",0,32,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_STRINGINPUT,mappack.filename);\r
+    setmenuitem(MO_HOTKEY,SCAN_ENTER);\r
+\r
+    createmenuitem(TXT_NAME"            ",0,64,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_STRINGINPUT,mappack.name);\r
+\r
+    createmenuitem(TXT_LEVEL" "TXT_FILENAME"    ",0,128,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_STRINGINPUT,mappack.level[mappack.numoflevels]);\r
+    setmenuitem(MO_HOTKEY,SCAN_F);\r
+\r
+    createmenuitem(TXT_LEVELNAME"      ",0,160,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_STRINGINPUT,mappack.levelname[mappack.numoflevels]);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    drawtext(TXT_FILENAME,320,52,12,1.0f,1.0f,1.0f,1.0f);\r
+    drawtext(TXT_LEVELNAME,480,52,12,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    for (count=0;count<mappack.numoflevels;count++)\r
+      {\r
+      drawtext(mappack.level[count],320,64+count*12,12,1.0f,1.0f,1.0f,1.0f);\r
+      drawtext(mappack.levelname[count],480,64+count*12,12,1.0f,1.0f,1.0f,1.0f);\r
+      }\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if (menuitem[2].active)\r
+      {\r
+      if (mappack.level[mappack.numoflevels][0]!=0)\r
+      if (mappack.numoflevels<63)\r
+        {\r
+        strcpy(mappack.level[mappack.numoflevels+1],mappack.level[mappack.numoflevels]);\r
+        strcpy(mappack.levelname[mappack.numoflevels+1],mappack.levelname[mappack.numoflevels]);\r
+        mappack.numoflevels++;\r
+        }\r
+      menuitem[2].active=0;\r
+      }\r
+    if (menuitem[3].active)\r
+      {\r
+      if (mappack.numoflevels>0)\r
+        mappack.numoflevels--;\r
+      menuitem[3].active=0;\r
+      }\r
+    }\r
+\r
+  if (menuitem[1].active)\r
+    savemappack();\r
+\r
+  resetmenuitems();\r
+\r
+  joystickmenu=1;\r
+  }\r
+\r
diff --git a/game/custom.h b/game/custom.h
new file mode 100644 (file)
index 0000000..22c4f76
--- /dev/null
@@ -0,0 +1,54 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void custommenu(void);\r
+void loadlevelmenu(void);\r
+void playcampaignmenu(void);\r
+void campaignmenu(void);\r
+void loadplayermappack(void);\r
+void saveplayermappack(void);\r
+void loadmappack(void);\r
+void savemappack(void);\r
+void newmappackmenu(void);\r
+\r
+char levellist[1024][32];\r
+\r
+struct\r
+  {\r
+  int active;\r
+  int numoflevels;\r
+  char filename[32];\r
+  char name[32];\r
+  char level[64][32];\r
+  char levelname[64][32];\r
+  char levelmusic[64][32];\r
+  char ending[16][64];\r
+  } mappack;\r
+\r
+struct\r
+  {\r
+  int levelnum;\r
+  int numoflives;\r
+  int totalscore;\r
+  int difficulty;\r
+  int highscore;\r
+  } playermappack[16];\r
+\r
diff --git a/game/damage.c b/game/damage.c
new file mode 100644 (file)
index 0000000..5bebf4c
--- /dev/null
@@ -0,0 +1,30 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void applydamageobject(int objectnum,int hitpoints)\r
+  {\r
+  if (level.gametype<10)\r
+  if (object[objectnum].damagedelay<=0)\r
+    {\r
+    object[objectnum].hitpoints-=hitpoints;\r
+    object[objectnum].damagedelay=50;\r
+    }\r
+  }\r
diff --git a/game/damage.h b/game/damage.h
new file mode 100644 (file)
index 0000000..cac6c06
--- /dev/null
@@ -0,0 +1,22 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void applydamageobject(int objectnum,int hitpoints);\r
diff --git a/game/editor.c b/game/editor.c
new file mode 100644 (file)
index 0000000..ce35167
--- /dev/null
@@ -0,0 +1,949 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void editlevel(void)\r
+  {\r
+  int count,count2;\r
+  int x,y;\r
+  int simtimer;\r
+  int simcount;\r
+  float vec[3];\r
+\r
+  simtimer=SDL_GetTicks();\r
+\r
+  resetmenuitems();\r
+\r
+  joystickmenu=0;\r
+\r
+  editor.active=1;\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);\r
+    glStencilMask(~0);\r
+    glClearStencil(0);\r
+    glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);\r
+    glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE);\r
+    glStencilMask(0);\r
+\r
+    setuptextdisplay();\r
+    glColor3fv(level.ambient[3]);\r
+    if (level.background[0]!=0)\r
+      displaybackground(660);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem("",0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_F1);\r
+    createmenuitem(TXT_LEVELNAME"     ",(640|TEXT_END),448,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_STRINGINPUT,editor.filename);\r
+    setmenuitem(MO_HOTKEY,SCAN_ENTER);\r
+    createmenuitem(TXT_GAMETYPE,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_INTINPUT,&level.gametype);\r
+    createmenuitem(TXT_GAMETIME,(640|TEXT_END),32,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_INTINPUT,&level.time);\r
+    createmenuitem(TXT_RED"  ",(640|TEXT_END),64,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_FLOATINPUT,&level.ambient[editor.mode][0]);\r
+    createmenuitem(TXT_GREEN,(640|TEXT_END),96,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_FLOATINPUT,&level.ambient[editor.mode][1]);\r
+    createmenuitem(TXT_BLUE" ",(640|TEXT_END),128,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_FLOATINPUT,&level.ambient[editor.mode][2]);\r
+    createmenuitem(TXT_BACKGROUND"     ",(640|TEXT_END),416,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_STRINGINPUT,&level.background);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkmenuitems();\r
+\r
+    view.zoom=10.0f;\r
+    if (keyboard[SCAN_EQUALS])\r
+      view.zoom=20.0f;\r
+    if (keyboard[SCAN_MINUS])\r
+      view.zoom=5.0f;\r
+\r
+    view.zoomx=view.zoom+0.5f;\r
+    view.zoomy=view.zoom*0.75f+0.5f;\r
+\r
+    setuporthoviewport(0,0,640,480,view.zoom,view.zoom*0.75f,20.0f);\r
+    setupviewpoint(view.position,view.orientation);\r
+\r
+    setupframelighting();\r
+\r
+    setuprenderobjects();\r
+\r
+    scalevector(level.ambient[editor.mode],level.ambient[editor.mode],2.0f);\r
+\r
+    if (!editor.showgrid)\r
+      rendershadows();\r
+\r
+    if (!editor.showgrid || editor.mode==0)\r
+      renderlevelback();\r
+    if (!editor.showgrid || editor.mode==1)\r
+      renderlevel();\r
+    renderobjects();\r
+    if (!editor.showgrid || editor.mode==2)\r
+      renderlevelfore();\r
+\r
+    scalevector(level.ambient[editor.mode],level.ambient[editor.mode],0.5f);\r
+\r
+    if (editor.showlines)\r
+      renderlevellines();\r
+\r
+    rendereditblocks();\r
+\r
+    glDisable(GL_TEXTURE_2D);\r
+\r
+    for (count=0;count<8;count++)\r
+      {\r
+      glBegin(GL_LINES);\r
+\r
+      if (count==0)\r
+        glColor4f(0.0f,1.0f,0.0f,1.0f);\r
+      if (count==1)\r
+        glColor4f(0.0f,1.0f,1.0f,1.0f);\r
+      if (count==2)\r
+        glColor4f(1.0f,1.0f,0.0f,1.0f);\r
+      if (count==3)\r
+        glColor4f(1.0f,0.0f,1.0f,1.0f);\r
+      if (count==4)\r
+        glColor4f(0.0f,0.5f,0.0f,1.0f);\r
+      if (count==5)\r
+        glColor4f(0.0f,0.5f,0.5f,1.0f);\r
+      if (count==6)\r
+        glColor4f(0.5f,0.5f,0.0f,1.0f);\r
+      if (count==7)\r
+        glColor4f(0.5f,0.0f,0.5f,1.0f);\r
+  \r
+      glVertex3f(level.area[count][0],level.area[count][1],0.0f);\r
+      glVertex3f(level.area[count][2],level.area[count][1],0.0f);\r
+\r
+      glVertex3f(level.area[count][2],level.area[count][1],0.0f);\r
+      glVertex3f(level.area[count][2],level.area[count][3],0.0f);\r
+\r
+      glVertex3f(level.area[count][2],level.area[count][3],0.0f);\r
+      glVertex3f(level.area[count][0],level.area[count][3],0.0f);\r
+\r
+      glVertex3f(level.area[count][0],level.area[count][3],0.0f);\r
+      glVertex3f(level.area[count][0],level.area[count][1],0.0f);\r
+\r
+      glEnd();\r
+      }\r
+    glEnable(GL_TEXTURE_2D);\r
+\r
+    setuptextdisplay();\r
+\r
+    glBindTexture(GL_TEXTURE_2D,texture[editor.blocknum].glname);\r
+\r
+    glBegin(GL_QUADS);\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+\r
+    vec[0]=0.0f;\r
+    vec[1]=416.0f;\r
+    convertscreenvertex(vec,font.sizex,font.sizey);\r
+    glTexCoord2f(0.0f,0.0f);\r
+    glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+    vec[0]=64.0f;\r
+    vec[1]=416.0f;\r
+    convertscreenvertex(vec,font.sizex,font.sizey);\r
+    glTexCoord2f(1.0f,0.0f);\r
+    glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+    vec[0]=64.0f;\r
+    vec[1]=480.0f;\r
+    convertscreenvertex(vec,font.sizex,font.sizey);\r
+    glTexCoord2f(1.0f,1.0f);\r
+    glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+    vec[0]=0.0f;\r
+    vec[1]=480.0f;\r
+    convertscreenvertex(vec,font.sizex,font.sizey);\r
+    glTexCoord2f(0.0f,1.0f);\r
+    glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+    glEnd();\r
+\r
+    if (editor.mode==0)\r
+      drawtext(TXT_BACKGROUND,0,384,16,1.0f,1.0f,1.0f,1.0f);\r
+    if (editor.mode==1)\r
+      drawtext(TXT_MIDGROUND,0,384,16,1.0f,1.0f,1.0f,1.0f);\r
+    if (editor.mode==2)\r
+      drawtext(TXT_FOREGROUND,0,384,16,1.0f,1.0f,1.0f,1.0f);\r
+    if (editor.mode==3)\r
+      drawtext(TXT_WAYBACKGROUND,0,384,16,1.0f,1.0f,1.0f,1.0f);\r
+    drawtext(TXT_TILESET":/i",0,368,16,1.0f,1.0f,1.0f,1.0f,level.tileset);\r
+    drawtext(TXT_TILE":/i",0,400,16,1.0f,1.0f,1.0f,1.0f,editor.blocknum);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if (!menuinputkeyboard)\r
+      {\r
+      if (keyboard[SCAN_L] && !prevkeyboard[SCAN_L])\r
+        editor.showlines^=1;\r
+      if (keyboard[SCAN_K] && !prevkeyboard[SCAN_K])\r
+        editor.showgrid^=1;\r
+\r
+      x=view.position[0]+(float)(mouse.x-320)/32.0f;\r
+      y=view.position[1]+(float)(240-mouse.y)/32.0f;\r
+  \r
+      if (!editor.paste)\r
+        {\r
+        if (!keyboard[SCAN_SHIFT])\r
+          {\r
+          if (mouse.lmb)\r
+            setblock(x,y,editor.blocknum);\r
+          if (mouse.rmb && (editor.editstart[0]==0 && editor.editstart[1]==0))\r
+            setblock(x,y,0);\r
+          }\r
+        else\r
+          {\r
+          if (mouse.lmb && !prevmouse.lmb)\r
+            {\r
+            editor.editstart[0]=x;\r
+            editor.editstart[1]=y;\r
+            }\r
+          if (mouse.lmb && (editor.editstart[0]!=0 || editor.editstart[1]!=0))\r
+            {\r
+            if (editor.editstart[0]<x)\r
+              {\r
+              editor.editarea[0][0]=editor.editstart[0];\r
+              editor.editarea[1][0]=x;\r
+              }\r
+            else\r
+              {\r
+              editor.editarea[0][0]=x;\r
+              editor.editarea[1][0]=editor.editstart[0];\r
+              }\r
+            if (editor.editstart[1]<y)\r
+              {\r
+              editor.editarea[0][1]=editor.editstart[1];\r
+              editor.editarea[1][1]=y;\r
+              }\r
+            else\r
+              {\r
+              editor.editarea[0][1]=y;\r
+              editor.editarea[1][1]=editor.editstart[1];\r
+              }\r
+            }\r
+          }\r
+        if (editor.editstart[0]!=0 || editor.editstart[1]!=0)\r
+          {\r
+          count=-1;\r
+          if (keyboard[SCAN_5])\r
+            count=0;\r
+          if (keyboard[SCAN_6])\r
+            count=1;\r
+          if (keyboard[SCAN_7])\r
+            count=2;\r
+          if (keyboard[SCAN_8])\r
+            count=3;\r
+          if (count!=-1)\r
+            {\r
+            if (keyboard[SCAN_SHIFT])\r
+              count+=4;\r
+\r
+            level.area[count][0]=editor.editarea[0][0];\r
+            level.area[count][1]=editor.editarea[0][1];\r
+            level.area[count][2]=editor.editarea[1][0]+1.0f;\r
+            level.area[count][3]=editor.editarea[1][1]+1.0f;\r
+            }\r
+          }\r
+        if (keyboard[SCAN_ESC] || (!mouse.rmb && prevmouse.rmb))\r
+          {\r
+          editor.editstart[0]=0;\r
+          editor.editstart[1]=0;\r
+          editor.editarea[0][0]=0;\r
+          editor.editarea[0][1]=0;\r
+          editor.editarea[1][0]=0;\r
+          editor.editarea[1][1]=0;\r
+          }\r
+        if (keyboard[SCAN_C] && !prevkeyboard[SCAN_C])\r
+          {\r
+          editor.copysize[0]=editor.editarea[1][0]-editor.editarea[0][0];\r
+          editor.copysize[1]=editor.editarea[1][1]-editor.editarea[0][1];\r
+          for (count=0;count<=editor.copysize[1];count++)\r
+          for (count2=0;count2<=editor.copysize[0];count2++)\r
+            editor.copybuffer[count][count2]=getblock(editor.editarea[0][0]+count2,editor.editarea[0][1]+count);\r
+    \r
+          editor.paste=1;\r
+          editor.editstart[0]=0;\r
+          editor.editstart[1]=0;\r
+          editor.editarea[0][0]=0;\r
+          editor.editarea[0][1]=0;\r
+          editor.editarea[1][0]=0;\r
+          editor.editarea[1][1]=0;\r
+          }\r
+        if (keyboard[SCAN_DELETE] && !prevkeyboard[SCAN_DELETE])\r
+          {\r
+          editor.copysize[0]=editor.editarea[1][0]-editor.editarea[0][0];\r
+          editor.copysize[1]=editor.editarea[1][1]-editor.editarea[0][1];\r
+          for (count=0;count<=editor.copysize[1];count++)\r
+          for (count2=0;count2<=editor.copysize[0];count2++)\r
+            setblock(editor.editarea[0][0]+count2,editor.editarea[0][1]+count,0);\r
+          }\r
+        if (keyboard[SCAN_B] && !prevkeyboard[SCAN_B])\r
+          {\r
+          editor.copysize[0]=editor.editarea[1][0]-editor.editarea[0][0];\r
+          editor.copysize[1]=editor.editarea[1][1]-editor.editarea[0][1];\r
+          for (count=0;count<=editor.copysize[1];count++)\r
+          for (count2=0;count2<=editor.copysize[0];count2++)\r
+            setblock(editor.editarea[0][0]+count2,editor.editarea[0][1]+count,editor.blocknum);\r
+          }\r
+        if (keyboard[SCAN_V] && !prevkeyboard[SCAN_V])\r
+          editor.paste=1;\r
+        }\r
+      else\r
+        {\r
+        if (mouse.lmb && !prevmouse.lmb)\r
+          {\r
+          for (count=0;count<=editor.copysize[1];count++)\r
+          for (count2=0;count2<=editor.copysize[0];count2++)\r
+            setblock(x+count2,y+count,editor.copybuffer[count][count2]);\r
+          }\r
+        if (keyboard[SCAN_ESC] || (!mouse.rmb && prevmouse.rmb))\r
+          editor.paste=0;\r
+        }\r
+      if (keyboard[SCAN_G])\r
+        editor.blocknum=getblock(x,y);\r
+      if (keyboard[SCAN_Q] && !prevkeyboard[SCAN_Q])\r
+        {\r
+        if (!keyboard[SCAN_SHIFT])\r
+          editor.blocknum++;\r
+        else\r
+          editor.blocknum+=10;\r
+        if (editor.blocknum>255)\r
+          editor.blocknum=255;\r
+        }\r
+      if (keyboard[SCAN_Z] && !prevkeyboard[SCAN_Z])\r
+        {\r
+        if (!keyboard[SCAN_SHIFT])\r
+          editor.blocknum--;\r
+        else\r
+          editor.blocknum-=10;\r
+        if (editor.blocknum<0)\r
+          editor.blocknum=0;\r
+        }\r
+\r
+      if (keyboard[SCAN_LFT_BRACKET] && !prevkeyboard[SCAN_LFT_BRACKET])\r
+      if (level.tileset>0)\r
+        level.tileset--;\r
+      if (keyboard[SCAN_RGT_BRACKET] && !prevkeyboard[SCAN_RGT_BRACKET])\r
+      if (level.tileset<7)\r
+        level.tileset++;\r
+  \r
+      if (keyboard[SCAN_1])\r
+        editor.mode=0;\r
+      if (keyboard[SCAN_2])\r
+        editor.mode=1;\r
+      if (keyboard[SCAN_3])\r
+        editor.mode=2;\r
+      if (keyboard[SCAN_4])\r
+        editor.mode=3;\r
+      }\r
+\r
+    simcount=0;\r
+    while (SDL_GetTicks()-simtimer>20 && simcount<5)\r
+      {\r
+      simcount++;\r
+      count=SDL_GetTicks()-simtimer-20;\r
+      simtimer=SDL_GetTicks()-count;\r
+\r
+      if (!menuinputkeyboard)\r
+        {\r
+        if (keyboard[SCAN_W])\r
+          view.position[1]+=0.2f;\r
+        if (keyboard[SCAN_S])\r
+          view.position[1]-=0.2f;\r
+        if (keyboard[SCAN_A])\r
+          view.position[0]-=0.2f;\r
+        if (keyboard[SCAN_D])\r
+          view.position[0]+=0.2f;\r
+        }\r
+      }\r
+    if (!menuinputkeyboard)\r
+      {\r
+      if (keyboard[SCAN_F7] && !prevkeyboard[SCAN_F7])\r
+        {\r
+        loadlevel(editor.filename);\r
+        setuplevel();\r
+        setupgame();\r
+        }\r
+      if (keyboard[SCAN_F5] && !prevkeyboard[SCAN_F5])\r
+        {\r
+        setuplevel();\r
+        setupgame();\r
+        }\r
+      if (keyboard[SCAN_F9] && !prevkeyboard[SCAN_F9])\r
+        savelevel(editor.filename);\r
+      if (keyboard[SCAN_F2] && !prevkeyboard[SCAN_F2])\r
+        {\r
+        editblock();\r
+        simtimer=SDL_GetTicks();\r
+        }\r
+      if (keyboard[SCAN_F3] && !prevkeyboard[SCAN_F3])\r
+        {\r
+        editlevelobjects();\r
+        simtimer=SDL_GetTicks();\r
+        }\r
+      if (keyboard[SCAN_F4] && !prevkeyboard[SCAN_F4])\r
+        {\r
+        editlevelrope();\r
+        simtimer=SDL_GetTicks();\r
+        }\r
+      if (keyboard[SCAN_T] && !prevkeyboard[SCAN_T])\r
+        {\r
+        edittextures();\r
+        simtimer=SDL_GetTicks();\r
+        }\r
+      }\r
+    }\r
+\r
+  editor.active=0;\r
+\r
+  joystickmenu=1;\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void setblock(int x,int y,int blocknum)\r
+  {\r
+  if (x<0)\r
+    return;\r
+  if (x>=256)\r
+    return;\r
+  if (y<0)\r
+    return;\r
+  if (y>=256)\r
+    return;\r
+\r
+  if (editor.mode==0)\r
+    level.backgrid[y][x]=blocknum;\r
+  if (editor.mode==1)\r
+    level.grid[y][x]=blocknum;\r
+  if (editor.mode==2)\r
+    level.foregrid[y][x]=blocknum;\r
+\r
+  setuplevellines(x-1,y-1,x+1,y+1);\r
+  }\r
+\r
+int getblock(int x,int y)\r
+  {\r
+  int blocknum;\r
+\r
+  if (x<0)\r
+    return(0);\r
+  if (x>=256)\r
+    return(0);\r
+  if (y<0)\r
+    return(0);\r
+  if (y>=256)\r
+    return(0);\r
+\r
+  if (editor.mode==0)\r
+    blocknum=level.backgrid[y][x];\r
+  if (editor.mode==1)\r
+    blocknum=level.grid[y][x];\r
+  if (editor.mode==2)\r
+    blocknum=level.foregrid[y][x];\r
+\r
+  return(blocknum);\r
+  }\r
+\r
+void rendereditblocks(void)\r
+  {\r
+  int count,count2;\r
+  int x,y;\r
+  int blocknum;\r
+  float vec[3];\r
+\r
+  glDisable(GL_TEXTURE_2D);\r
+\r
+  glBegin(GL_LINES);\r
+\r
+  glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+\r
+  if (!editor.paste)\r
+    {\r
+    for (count=editor.editarea[0][1];count<=editor.editarea[1][1];count++)\r
+    for (count2=editor.editarea[0][0];count2<=editor.editarea[1][0];count2++)\r
+      {\r
+      glVertex3f((float)count2+0.0f,(float)count+1.0f,0.0f);\r
+      glVertex3f((float)count2+1.0f,(float)count+1.0f,0.0f);\r
+  \r
+      glVertex3f((float)count2+1.0f,(float)count+1.0f,0.0f);\r
+      glVertex3f((float)count2+1.0f,(float)count+0.0f,0.0f);\r
+  \r
+      glVertex3f((float)count2+1.0f,(float)count+0.0f,0.0f);\r
+      glVertex3f((float)count2+0.0f,(float)count+0.0f,0.0f);\r
+  \r
+      glVertex3f((float)count2+0.0f,(float)count+0.0f,0.0f);\r
+      glVertex3f((float)count2+0.0f,(float)count+1.0f,0.0f);\r
+      }\r
+    }\r
+  else\r
+    {\r
+    x=view.position[0]+(float)(mouse.x-320)/32.0f;\r
+    y=view.position[1]+(float)(240-mouse.y)/32.0f;\r
+\r
+    for (count=0;count<=editor.copysize[1];count++)\r
+    for (count2=0;count2<=editor.copysize[0];count2++)\r
+      {\r
+      glVertex3f((float)(x+count2)+0.0f,(float)(y+count)+1.0f,0.0f);\r
+      glVertex3f((float)(x+count2)+1.0f,(float)(y+count)+1.0f,0.0f);\r
+  \r
+      glVertex3f((float)(x+count2)+1.0f,(float)(y+count)+1.0f,0.0f);\r
+      glVertex3f((float)(x+count2)+1.0f,(float)(y+count)+0.0f,0.0f);\r
+  \r
+      glVertex3f((float)(x+count2)+1.0f,(float)(y+count)+0.0f,0.0f);\r
+      glVertex3f((float)(x+count2)+0.0f,(float)(y+count)+0.0f,0.0f);\r
+  \r
+      glVertex3f((float)(x+count2)+0.0f,(float)(y+count)+0.0f,0.0f);\r
+      glVertex3f((float)(x+count2)+0.0f,(float)(y+count)+1.0f,0.0f);\r
+      }\r
+    }\r
+  glEnd();\r
+\r
+  glEnable(GL_TEXTURE_2D);\r
+  }\r
+\r
+void editblock(void)\r
+  {\r
+  int count,count2,count3;\r
+  int x,y;\r
+  int simtimer;\r
+  int simcount;\r
+  float friction;\r
+  float vec[3],vec2[3];\r
+  float normal[3];\r
+  char filename[13]="text000.tga";\r
+  int changeddir;\r
+\r
+  /*\r
+  changeddir=changetilesetdir();\r
+\r
+  filename[4]=48+(editor.blocknum/100)%10;\r
+  filename[5]=48+(editor.blocknum/10)%10;\r
+  filename[6]=48+editor.blocknum%10;\r
+  loadtexturetga(999,filename,0,GL_CLAMP,GL_CLAMP,GL_NEAREST,GL_NEAREST);\r
+\r
+  if (changeddir==0)\r
+    chdir("..");\r
+  */\r
+\r
+  copytexture(999,editor.blocknum);\r
+  texture[999].magfilter=GL_NEAREST;\r
+  texture[999].minfilter=GL_NEAREST;\r
+  setuptexture(999);\r
+\r
+  simtimer=SDL_GetTicks();\r
+\r
+  friction=1.0f;\r
+\r
+  resetmenuitems();\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_EXIT,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+    count=32;\r
+    createmenuitem(TXT_FRICTION,(640|TEXT_END),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_FLOATINPUT,&block[editor.blocknum].friction);\r
+    setmenuitem(MO_HOTKEY,SCAN_F);\r
+    count+=32;\r
+    createmenuitem(TXT_BREAKPOINT,(640|TEXT_END),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_FLOATINPUT,&block[editor.blocknum].breakpoint);\r
+    setmenuitem(MO_HOTKEY,SCAN_B);\r
+    count+=32;\r
+    createmenuitem(TXT_MIDDAMAGE,(640|TEXT_END),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_INTINPUT,&block[editor.blocknum].middamage);\r
+    setmenuitem(MO_HOTKEY,SCAN_M);\r
+    count+=32;\r
+    createmenuitem(TXT_FOREDAMAGE,(640|TEXT_END),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_INTINPUT,&block[editor.blocknum].foredamage);\r
+    setmenuitem(MO_HOTKEY,SCAN_O);\r
+    count+=32;\r
+    createmenuitem(TXT_DENSITY,(640|TEXT_END),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_FLOATINPUT,&block[editor.blocknum].density);\r
+    setmenuitem(MO_HOTKEY,SCAN_D);\r
+    count+=32;\r
+    createmenuitem(TXT_DRAG"   ",(640|TEXT_END),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_FLOATINPUT,&block[editor.blocknum].drag);\r
+    setmenuitem(MO_HOTKEY,SCAN_R);\r
+    count+=32;\r
+    createmenuitem(TXT_ANIMATION,(640|TEXT_END),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_INTINPUT,&block[editor.blocknum].animation);\r
+    setmenuitem(MO_HOTKEY,SCAN_N);\r
+    count+=32;\r
+    createmenuitem(TXT_ANIMATESPD,(640|TEXT_END),count,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_INTINPUT,&block[editor.blocknum].animationspeed);\r
+    setmenuitem(MO_HOTKEY,SCAN_S);\r
+    count+=32;\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkmenuitems();\r
+\r
+    if (!menuinputkeyboard)\r
+      {\r
+      if (keyboard[SCAN_DELETE] && !prevkeyboard[SCAN_DELETE])\r
+      if (block[editor.blocknum].numoflines>0)\r
+        block[editor.blocknum].numoflines--;\r
+      }\r
+    if (mouse.x<464)\r
+      {\r
+      if (mouse.lmb && !prevmouse.lmb)\r
+        {\r
+        x=(mouse.x+6-32)/12;\r
+        y=(mouse.y+6-32)/12;\r
+        if (x<0)\r
+          x=0;\r
+        if (y<0)\r
+          y=0;\r
+        if (x>32)\r
+          x=32;\r
+        if (y>32)\r
+          y=32;\r
+        vec[0]=(float)x/32.0f;\r
+        vec[1]=1.0f-(float)y/32.0f;\r
+  \r
+        block[editor.blocknum].line[block[editor.blocknum].numoflines][0]=vec[0];\r
+        block[editor.blocknum].line[block[editor.blocknum].numoflines][1]=vec[1];\r
+        }\r
+      x=abs(mouse.x+6-32)/12;\r
+      y=abs(mouse.y+6-32)/12;\r
+      if (x<0)\r
+        x=0;\r
+      if (y<0)\r
+        y=0;\r
+      if (x>32)\r
+        x=32;\r
+      if (y>32)\r
+        y=32;\r
+      vec[0]=(float)x/32.0f;\r
+      vec[1]=1.0f-(float)y/32.0f;\r
+  \r
+      block[editor.blocknum].line[block[editor.blocknum].numoflines][2]=vec[0];\r
+      block[editor.blocknum].line[block[editor.blocknum].numoflines][3]=vec[1];\r
+      block[editor.blocknum].line[block[editor.blocknum].numoflines][4]=friction;\r
+      if (!mouse.lmb && prevmouse.lmb)\r
+      if (block[editor.blocknum].line[block[editor.blocknum].numoflines][0]!=block[editor.blocknum].line[block[editor.blocknum].numoflines][2] || block[editor.blocknum].line[block[editor.blocknum].numoflines][1]!=block[editor.blocknum].line[block[editor.blocknum].numoflines][3])\r
+        block[editor.blocknum].numoflines++;\r
+      }\r
+\r
+    setupblockflags(editor.blocknum);\r
+\r
+    setuptextdisplay();\r
+\r
+    glDisable(GL_TEXTURE_2D);\r
+  \r
+    glBegin(GL_LINES);\r
+\r
+\r
+    glColor4f(0.0f,1.0f,0.0f,1.0f);\r
+\r
+    for (count=0;count<=4;count++)\r
+      {\r
+      vec[0]=16.0f;\r
+      vec[1]=32.0f+96.0f*(float)count;\r
+      convertscreenvertex(vec,font.sizex,font.sizey);\r
+      glVertex3f(vec[0],vec[1],-1.0f);\r
+  \r
+      vec[0]=32.0f+400.0f;\r
+      vec[1]=32.0f+96.0f*(float)count;\r
+      convertscreenvertex(vec,font.sizex,font.sizey);\r
+      glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+      vec[0]=32.0f+96.0f*(float)count;\r
+      vec[1]=16.0f;\r
+      convertscreenvertex(vec,font.sizex,font.sizey);\r
+      glVertex3f(vec[0],vec[1],-1.0f);\r
+  \r
+      vec[0]=32.0f+96.0f*(float)count;\r
+      vec[1]=32.0f+400.0f;\r
+      convertscreenvertex(vec,font.sizex,font.sizey);\r
+      glVertex3f(vec[0],vec[1],-1.0f);\r
+      }\r
+    glEnd();\r
+  \r
+    glEnable(GL_TEXTURE_2D);\r
+\r
+\r
+    glBindTexture(GL_TEXTURE_2D,texture[999].glname);\r
+\r
+    glBegin(GL_QUADS);\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+\r
+    vec[0]=32.0f;\r
+    vec[1]=32.0f;\r
+    convertscreenvertex(vec,font.sizex,font.sizey);\r
+    glTexCoord2f(0.0f,0.0f);\r
+    glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+    vec[0]=32.0f+384.0f;\r
+    vec[1]=32.0f;\r
+    convertscreenvertex(vec,font.sizex,font.sizey);\r
+    glTexCoord2f(1.0f,0.0f);\r
+    glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+    vec[0]=32.0f+384.0f;\r
+    vec[1]=32.0f+384.0f;\r
+    convertscreenvertex(vec,font.sizex,font.sizey);\r
+    glTexCoord2f(1.0f,1.0f);\r
+    glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+    vec[0]=32.0f;\r
+    vec[1]=32.0f+384.0f;\r
+    convertscreenvertex(vec,font.sizex,font.sizey);\r
+    glTexCoord2f(0.0f,1.0f);\r
+    glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+    glEnd();\r
+\r
+\r
+    glDisable(GL_TEXTURE_2D);\r
+  \r
+    glBegin(GL_LINES);\r
+  \r
+    if (mouse.x<464)\r
+    if (mouse.lmb)\r
+      block[editor.blocknum].numoflines++;\r
+\r
+    for (count=0;count<block[editor.blocknum].numoflines;count++)\r
+      {\r
+      glColor4f(1.0f,0.0f,0.0f,1.0f);\r
+\r
+      vec[0]=32.0f+block[editor.blocknum].line[count][0]*384.0f;\r
+      vec[1]=32.0f+384.0f-block[editor.blocknum].line[count][1]*384.0f;\r
+      convertscreenvertex(vec,font.sizex,font.sizey);\r
+      glVertex3f(vec[0],vec[1],-1.0f);\r
+\r
+      glColor4f(0.0f,0.0f,1.0f,1.0f);\r
+\r
+      vec[0]=32.0f+block[editor.blocknum].line[count][2]*384.0f;\r
+      vec[1]=32.0f+384.0f-block[editor.blocknum].line[count][3]*384.0f;\r
+      convertscreenvertex(vec,font.sizex,font.sizey);\r
+      glVertex3f(vec[0],vec[1],-1.0f);\r
+      }\r
+\r
+    if (mouse.x<464)\r
+    if (mouse.lmb)\r
+      block[editor.blocknum].numoflines--;\r
+\r
+    glEnd();\r
+  \r
+    glEnable(GL_TEXTURE_2D);\r
+\r
+    drawtext(TXT_LINES":/i",0,432,12,1.0f,1.0f,1.0f,1.0f,block[editor.blocknum].numoflines);\r
+    drawtext(TXT_ALPHA":/i",0,448,12,1.0f,1.0f,1.0f,1.0f,texture[editor.blocknum].isalpha);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if (keyboard[SCAN_A] && !prevkeyboard[SCAN_A])\r
+      {\r
+      for (count=0;count<texture[editor.blocknum].sizey;count++)\r
+      for (count2=0;count2<texture[editor.blocknum].sizex;count2++)\r
+      if (!bigendian)\r
+        texture[editor.blocknum].rgba[0][count*texture[editor.blocknum].sizex+count2]&=0xFFFFFF;\r
+      else\r
+        texture[editor.blocknum].rgba[0][count*texture[editor.blocknum].sizex+count2]&=0xFFFFFF00;\r
+\r
+      setupblockalpha(editor.blocknum);\r
+\r
+      texture[editor.blocknum].isalpha=0;\r
+      for (count=0;count<texture[editor.blocknum].sizey;count++)\r
+      for (count2=0;count2<texture[editor.blocknum].sizex;count2++)\r
+        {\r
+        if (!bigendian)\r
+        if ((texture[editor.blocknum].rgba[0][count*texture[editor.blocknum].sizex+count2]&0xFF000000)!=0xFF000000)\r
+          texture[editor.blocknum].isalpha=1;\r
+  \r
+        if (bigendian)\r
+        if ((texture[editor.blocknum].rgba[0][count*texture[editor.blocknum].sizex+count2]&0x000000FF)!=0x000000FF)\r
+          texture[editor.blocknum].isalpha=1;\r
+        }\r
+\r
+      /*\r
+      texture[editor.blocknum].isalpha=0;\r
+\r
+      for (count=0;count<texture[editor.blocknum].sizey;count++)\r
+      for (count2=0;count2<texture[editor.blocknum].sizex;count2++)\r
+        {\r
+        texture[editor.blocknum].rgba[0][count*texture[editor.blocknum].sizex+count2]|=0xFF000000;\r
+\r
+        for (count3=0;count3<block[editor.blocknum].numoflines;count3++)\r
+          {\r
+          vec[0]=((float)count2+0.5f)/(float)texture[editor.blocknum].sizex;\r
+          vec[1]=1.0f-((float)count+0.5f)/(float)texture[editor.blocknum].sizey;\r
+          vec[2]=0.0f;\r
+          vec[0]-=block[editor.blocknum].line[count3][0];\r
+          vec[1]-=block[editor.blocknum].line[count3][1];\r
+          vec2[0]=block[editor.blocknum].line[count3][2]-block[editor.blocknum].line[count3][0];\r
+          vec2[1]=block[editor.blocknum].line[count3][3]-block[editor.blocknum].line[count3][1];\r
+          vec2[2]=0.0f;\r
+          crossproduct(normal,vec,vec2);\r
+          if (normal[2]>0.0f)\r
+            {\r
+            texture[editor.blocknum].rgba[0][count*texture[editor.blocknum].sizex+count2]&=0xFFFFFF;\r
+            texture[editor.blocknum].isalpha=1;\r
+            }\r
+          }\r
+        }\r
+      */\r
+\r
+      setuptexture(editor.blocknum);\r
+\r
+      memcpy(texture[999].rgba[0],texture[editor.blocknum].rgba[0],texture[editor.blocknum].sizex*texture[editor.blocknum].sizey*4);\r
+      setuptexture(999);\r
+      }\r
+\r
+    if (keyboard[SCAN_Q] && !prevkeyboard[SCAN_Q])\r
+      {\r
+      if (!keyboard[SCAN_SHIFT])\r
+        editor.blocknum++;\r
+      else\r
+        editor.blocknum+=10;\r
+      if (editor.blocknum>255)\r
+        editor.blocknum=255;\r
+\r
+      copytexture(999,editor.blocknum);\r
+      texture[999].magfilter=GL_NEAREST;\r
+      texture[999].minfilter=GL_NEAREST;\r
+      setuptexture(999);\r
+      /*\r
+      changeddir=changetilesetdir();\r
+    \r
+      filename[4]=48+(editor.blocknum/100)%10;\r
+      filename[5]=48+(editor.blocknum/10)%10;\r
+      filename[6]=48+editor.blocknum%10;\r
+      loadtexturetga(999,filename,0,GL_CLAMP,GL_CLAMP,GL_NEAREST,GL_NEAREST);\r
+    \r
+      if (changeddir==0)\r
+        chdir("..");\r
+      */\r
+      }\r
+    if (keyboard[SCAN_Z] && !prevkeyboard[SCAN_Z])\r
+      {\r
+      if (!keyboard[SCAN_SHIFT])\r
+        editor.blocknum--;\r
+      else\r
+        editor.blocknum-=10;\r
+      if (editor.blocknum<0)\r
+        editor.blocknum=0;\r
+\r
+      copytexture(999,editor.blocknum);\r
+      texture[999].magfilter=GL_NEAREST;\r
+      texture[999].minfilter=GL_NEAREST;\r
+      setuptexture(999);\r
+\r
+      /*\r
+      changeddir=changetilesetdir();\r
+    \r
+      filename[4]=48+(editor.blocknum/100)%10;\r
+      filename[5]=48+(editor.blocknum/10)%10;\r
+      filename[6]=48+editor.blocknum%10;\r
+      loadtexturetga(999,filename,0,GL_CLAMP,GL_CLAMP,GL_NEAREST,GL_NEAREST);\r
+    \r
+      if (changeddir==0)\r
+        chdir("..");\r
+      */\r
+      }\r
+    /*\r
+    if (keyboard[SCAN_F4] && !prevkeyboard[SCAN_F4])\r
+      {\r
+      changeddir=changetilesetdir();\r
+      loadblock(editor.blocknum);\r
+\r
+      if (changeddir==0)\r
+        chdir("..");\r
+      }\r
+    if (keyboard[SCAN_F9] && !prevkeyboard[SCAN_F9])\r
+      {\r
+      changeddir=changetilesetdir();\r
+      saveblock(editor.blocknum);\r
+\r
+      if (changeddir==0)\r
+        chdir("..");\r
+      }\r
+    */\r
+\r
+    simcount=0;\r
+    while (SDL_GetTicks()-simtimer>20 && simcount<5)\r
+      {\r
+      simcount++;\r
+      count=SDL_GetTicks()-simtimer-20;\r
+      simtimer=SDL_GetTicks()-count;\r
+      }\r
+    }\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void renderlevellines(void)\r
+  {\r
+  int count,count2,count3;\r
+  int blocknum;\r
+  float vec[3];\r
+\r
+  glDisable(GL_TEXTURE_2D);\r
+\r
+  glBegin(GL_LINES);\r
+\r
+  glColor4f(0.0f,0.0f,1.0f,1.0f);\r
+\r
+  for (count=view.position[1]-32;count<view.position[1]+32;count++)\r
+  if (count>=0 && count<256)\r
+  for (count2=view.position[0]-32;count2<view.position[0]+32;count2++)\r
+  if (count2>=0 && count2<256)\r
+    {\r
+    blocknum=level.grid[count][count2];\r
+    for (count3=0;count3<block[blocknum].numoflines;count3++)\r
+    if (((level.gridflags[count][count2]>>count3)&1)==0)\r
+      {\r
+      vec[0]=(float)count2+block[blocknum].line[count3][0];\r
+      vec[1]=(float)count+block[blocknum].line[count3][1];\r
+      glVertex3f(vec[0],vec[1],0.0f);\r
+\r
+      vec[0]=(float)count2+block[blocknum].line[count3][2];\r
+      vec[1]=(float)count+block[blocknum].line[count3][3];\r
+      glVertex3f(vec[0],vec[1],0.0f);\r
+      }\r
+    }\r
+\r
+  glEnd();\r
+\r
+  glEnable(GL_TEXTURE_2D);\r
+  }\r
diff --git a/game/editor.h b/game/editor.h
new file mode 100644 (file)
index 0000000..35c1853
--- /dev/null
@@ -0,0 +1,45 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void editlevel(void);\r
+void setblock(int x,int y,int blocknum);\r
+int getblock(int x,int y);\r
+void rendereditblocks(void);\r
+void editblock(void);\r
+void renderlevellines(void);\r
+\r
+struct\r
+  {\r
+  int active;\r
+  int mode;\r
+  int showgrid;\r
+  int showlines;\r
+  int blocknum;\r
+  int objecttype;\r
+  int objectnum;\r
+  char filename[32];\r
+  int editstart[2];\r
+  int editarea[2][2];\r
+  int copysize[2];\r
+  int copybuffer[128][128];\r
+  int paste;\r
+  } editor;\r
+\r
diff --git a/game/english.h b/game/english.h
new file mode 100644 (file)
index 0000000..3af6be2
--- /dev/null
@@ -0,0 +1,429 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+//logic.c\r
+#define TXT_TOUCHDOWN_GRAY                                                     "Touchdown Gray!"\r
+#define TXT_FIELDGOAL_GRAY                                                     "Field Goal Gray!"\r
+#define TXT_TOUCHDOWN_GISH                                                     "Touchdown Gish!"\r
+#define TXT_FIELDGOAL_GISH                                                     "Field Goal Gish!"\r
+#define TXT_GRAYWINS_ROUND                                                     "Gray Wins Round!"\r
+#define TXT_GISHWINS_ROUND                                                     "Gish Wins Round!"\r
+#define TXT_COMBO                                                                                              "Combo"\r
+\r
+#define TXT_DIALOG2_LINE1                                                              "Hey there, look"\r
+#define TXT_DIALOG2_LINE2                                                              "what the cat"\r
+#define TXT_DIALOG2_LINE3                                                              "flushed down, its"\r
+#define TXT_DIALOG2_LINE4                                                              "our old buddy"\r
+#define TXT_DIALOG2_LINE5                                                              "Gish... whaddya"\r
+#define TXT_DIALOG2_LINE6                                                              "say boys, lets"\r
+#define TXT_DIALOG2_LINE7                                                              "show old Gishy"\r
+#define TXT_DIALOG2_LINE8                                                              "here a good"\r
+#define TXT_DIALOG2_LINE9                                                              "time...HONEY"\r
+#define TXT_DIALOG2_LINE10                                                     "BUCKET STYLE!"\r
+\r
+#define TXT_DIALOG3_LINE1                                                              "Well well well,"\r
+#define TXT_DIALOG3_LINE2                                                              "it be one o dem"\r
+#define TXT_DIALOG3_LINE3                                                              "blobby tings..."\r
+#define TXT_DIALOG3_LINE4                                                              "HAR HAR HAR dis"\r
+#define TXT_DIALOG3_LINE5                                                              "one won't be"\r
+#define TXT_DIALOG3_LINE6                                                              "gettin away so"\r
+#define TXT_DIALOG3_LINE7                                                              "easy naw.  Why"\r
+#define TXT_DIALOG3_LINE8                                                              "you be lookin"\r
+#define TXT_DIALOG3_LINE9                                                              "so worried dere?"\r
+\r
+#define TXT_DIALOG4_LINE1                                                              "I be jus lookin"\r
+#define TXT_DIALOG4_LINE2                                                              "to talk s'all..."\r
+#define TXT_DIALOG4_LINE3                                                              "HAR HAR HAR,"\r
+#define TXT_DIALOG4_LINE4                                                              "good ol Paunchy"\r
+#define TXT_DIALOG4_LINE5                                                              "gunna be cookin"\r
+#define TXT_DIALOG4_LINE6                                                              "up some"\r
+#define TXT_DIALOG4_LINE7                                                              "tar-iffic gumbo"\r
+#define TXT_DIALOG4_LINE8                                                              "dis night, I"\r
+#define TXT_DIALOG4_LINE9                                                              "garontee"\r
+\r
+#define TXT_DIALOG5_LINE1                                                              "Oh, look who it"\r
+#define TXT_DIALOG5_LINE2                                                              "is sister, its"\r
+#define TXT_DIALOG5_LINE3                                                              "the Gish..Yess,"\r
+#define TXT_DIALOG5_LINE4                                                              "Gish..We have"\r
+#define TXT_DIALOG5_LINE5                                                              "been waiting for"\r
+#define TXT_DIALOG5_LINE6                                                              "you little one,"\r
+#define TXT_DIALOG5_LINE7                                                              "you have many"\r
+#define TXT_DIALOG5_LINE8                                                              "'determined'"\r
+#define TXT_DIALOG5_LINE9                                                              "admirers..Yess,"\r
+#define TXT_DIALOG5_LINE10                                                     "determined.."\r
+\r
+#define TXT_DIALOG6_LINE1                                                              "Your little"\r
+#define TXT_DIALOG6_LINE2                                                              "adventure ends"\r
+#define TXT_DIALOG6_LINE3                                                              "here, there is"\r
+#define TXT_DIALOG6_LINE4                                                              "no happy ending"\r
+#define TXT_DIALOG6_LINE5                                                              "for you now..."\r
+#define TXT_DIALOG6_LINE6                                                              "Yess no happy"\r
+#define TXT_DIALOG6_LINE7                                                              "for you!"\r
+\r
+#define TXT_DIALOG7_LINE1                                                              "RRRAAAWLL, YOU"\r
+#define TXT_DIALOG7_LINE2                                                              "AGAIN! I'LL TEAR"\r
+#define TXT_DIALOG7_LINE3                                                              "THE FLESH FROM"\r
+#define TXT_DIALOG7_LINE4                                                              "YOUR BONES!!!"\r
+#define TXT_DIALOG7_LINE5                                                              "RRRAAAWLL!.."\r
+#define TXT_DIALOG7_LINE6                                                              "Wait.. You're"\r
+#define TXT_DIALOG7_LINE7                                                              "not her..."\r
+#define TXT_DIALOG7_LINE8                                                              "another tar"\r
+#define TXT_DIALOG7_LINE9                                                              "blob? rrrrrr.."\r
+\r
+#define TXT_DIALOG8_LINE1                                                              "Either way I'll"\r
+#define TXT_DIALOG8_LINE2                                                              "teach you to"\r
+#define TXT_DIALOG8_LINE3                                                              "disturb my"\r
+#define TXT_DIALOG8_LINE4                                                              "sleep!"\r
+#define TXT_DIALOG8_LINE5                                                              "Prepare to"\r
+#define TXT_DIALOG8_LINE6                                                              "be shredded!"\r
+\r
+#define TXT_DIALOG9_LINE1                                                              "Ah we meet again"\r
+#define TXT_DIALOG9_LINE2                                                              "little one...."\r
+#define TXT_DIALOG9_LINE3                                                              "Yess, again...."\r
+#define TXT_DIALOG9_LINE4                                                              "Do you enjoy our"\r
+#define TXT_DIALOG9_LINE5                                                              "clever disguises"\r
+#define TXT_DIALOG9_LINE6                                                              "little Gish?  I"\r
+#define TXT_DIALOG9_LINE7                                                              "think we blend in"\r
+#define TXT_DIALOG9_LINE8                                                              "quite well..Yess,"\r
+#define TXT_DIALOG9_LINE9                                                              "quite well..."\r
+\r
+#define TXT_DIALOG10_LINE1                                                     "BAH! Enough talk"\r
+#define TXT_DIALOG10_LINE2                                                     "small fry, this"\r
+#define TXT_DIALOG10_LINE3                                                     "time it won't be"\r
+#define TXT_DIALOG10_LINE4                                                     "so easy..Yess, no"\r
+#define TXT_DIALOG10_LINE5                                                     "happy for you!!"\r
+\r
+#define TXT_DIALOG11_LINE1                                                     "Hello Gish"\r
+#define TXT_DIALOG11_LINE2                                                     "What, you don't"\r
+#define TXT_DIALOG11_LINE3                                                     "remember me? We"\r
+#define TXT_DIALOG11_LINE4                                                     "went to the same"\r
+#define TXT_DIALOG11_LINE5                                                     "highschool, I sat"\r
+#define TXT_DIALOG11_LINE6                                                     "behind you in"\r
+#define TXT_DIALOG11_LINE7                                                     "math class, I lived"\r
+#define TXT_DIALOG11_LINE8                                                     "next door to you"\r
+#define TXT_DIALOG11_LINE9                                                     "for 6 years!  HOW"\r
+#define TXT_DIALOG11_LINE10                                                    "CAN YOU NOT KNOW"\r
+#define TXT_DIALOG11_LINE11                                                    "WHO I AM?"\r
+#define TXT_DIALOG11_LINE12                                                    "Everyday I see"\r
+#define TXT_DIALOG11_LINE13                                                    "you with HER!"\r
+#define TXT_DIALOG11_LINE14                                                    "Its...its just"\r
+#define TXT_DIALOG11_LINE15                                                    "not right...you"\r
+#define TXT_DIALOG11_LINE16                                                    "should be MINE, "\r
+#define TXT_DIALOG11_LINE17                                                    "she could never"\r
+#define TXT_DIALOG11_LINE18                                                    "love you like I do"\r
+#define TXT_DIALOG11_LINE19                                                    "GISH! WE were meant"\r
+#define TXT_DIALOG11_LINE20                                                    "to be together!"\r
+#define TXT_DIALOG11_LINE21                                                    "HERA+GISH=TRUE LOVE!"\r
+#define TXT_DIALOG11_LINE22                                                    "MARRY ME GISH,"\r
+#define TXT_DIALOG11_LINE23                                                    "MARRY ME NOW IN"\r
+#define TXT_DIALOG11_LINE24                                                    "THIS CHURCH OR YOUR"\r
+#define TXT_DIALOG11_LINE25                                                    "LITTLE TRAMP OF A"\r
+#define TXT_DIALOG11_LINE26                                                    "GIRL FRIEND WILL"\r
+#define TXT_DIALOG11_LINE27                                                    "NEVER LIVE TO SEE"\r
+#define TXT_DIALOG11_LINE28                                                    "THE LIGHT OF DAY!"\r
+#define TXT_DIALOG11_LINE29             "..."\r
+#define TXT_DIALOG11_LINE30                                                    "WHAT DO YOU MEAN NO!"\r
+#define TXT_DIALOG11_LINE31                                                    "YOU LOSER, HOW DARE"\r
+#define TXT_DIALOG11_LINE32                                                    "YOU REJECT ME!  IF"\r
+#define TXT_DIALOG11_LINE33                                                    "I CAN'T HAVE YOU..."\r
+#define TXT_DIALOG11_LINE34                                                    "NO ONE CAN!"\r
+\r
+#define TXT_DIALOG12_LINE1                                                     "I AM SATAN!!!"\r
+#define TXT_DIALOG12_LINE2                                                     "You have proven your"\r
+#define TXT_DIALOG12_LINE3                                                     "worthiness to me, join"\r
+#define TXT_DIALOG12_LINE4                                                     "me in my quest to rule"\r
+#define TXT_DIALOG12_LINE5                                                     "the world and I shall"\r
+#define TXT_DIALOG12_LINE6                                                     "grant you eternal life."\r
+#define TXT_DIALOG12_LINE7                                                     "Join Satan?"\r
+#define TXT_DIALOG12_LINE8                                                     "*OK"\r
+#define TXT_DIALOG12_LINE9                                                     " Never"\r
+#define TXT_DIALOG12_LINE10                                                    "Join Satan?"\r
+#define TXT_DIALOG12_LINE11                                                    " OK"\r
+#define TXT_DIALOG12_LINE12                                                    "*Never"\r
+#define TXT_DIALOG12_LINE13                                                    "OK cool, I don't really"\r
+#define TXT_DIALOG12_LINE14                                                    "have a world domination"\r
+#define TXT_DIALOG12_LINE15                                                    "plan right now, you"\r
+#define TXT_DIALOG12_LINE16                                                    "have any ideas?"\r
+#define TXT_DIALOG12_LINE17                                                    "No?  Allright, give me"\r
+#define TXT_DIALOG12_LINE18                                                    "some time to come up"\r
+#define TXT_DIALOG12_LINE19                                                    "with something..."\r
+#define TXT_DIALOG12_LINE20                                                    "Damn Me, I'm not much of"\r
+#define TXT_DIALOG12_LINE21                                                    "an idea guy..."\r
+#define TXT_DIALOG12_LINE22                                                    "I gotta go"\r
+#define TXT_DIALOG12_LINE23                                                    "You sure you don't want"\r
+#define TXT_DIALOG12_LINE24                                                    "to hang out?  I have a"\r
+#define TXT_DIALOG12_LINE25                                                    "bunch of DVDs, a plasma"\r
+#define TXT_DIALOG12_LINE26                                                    "screen TV, Triptych..."\r
+#define TXT_DIALOG12_LINE27                                                    "OK, fine, whatever dude,"\r
+#define TXT_DIALOG12_LINE28                                                    "all I gave you is eternal"\r
+#define TXT_DIALOG12_LINE29                                                    "life."\r
+#define TXT_DIALOG12_LINE30                                                    "Very well then,"\r
+#define TXT_DIALOG12_LINE31                                                    "PREPARE TO DIE!!!"\r
+\r
+#define TXT_GETREADY                                                                           "Get Ready"\r
+#define TXT_TIE                                                                                                        "Its A Tie!"\r
+\r
+#define TXT_TUTORIAL_LINE1                                                     "Press the '/s' key to slide down"\r
+#define TXT_TUTORIAL_LINE2                                                     "the hole."\r
+#define TXT_TUTORIAL_LINE3                                                     "Switches and buttons sometimes"\r
+#define TXT_TUTORIAL_LINE4                                                     "open doors."\r
+#define TXT_TUTORIAL_LINE5                                                     "Press the '/s' key to stick to"\r
+#define TXT_TUTORIAL_LINE6                                                     "the wall.  Press the '/s' key"\r
+#define TXT_TUTORIAL_LINE7                                                     "to begin climbing"\r
+#define TXT_TUTORIAL_LINE8                                                     "Press the '/s' key to jump."\r
+#define TXT_TUTORIAL_LINE9                                                     "Gish jumps best when he is"\r
+#define TXT_TUTORIAL_LINE10                                                    "the most compressed, bouncing"\r
+#define TXT_TUTORIAL_LINE11                                                    "up and down will help you get"\r
+#define TXT_TUTORIAL_LINE12                                                    "higher and higher."\r
+#define TXT_TUTORIAL_LINE13                                                    "Press the '/s' key to break"\r
+#define TXT_TUTORIAL_LINE14                                                    "these blocks."\r
+#define TXT_TUTORIAL_LINE15                                                    "Press the '/s' key to stick to"\r
+#define TXT_TUTORIAL_LINE16                                                    "the wall.  Press the '/s' and"\r
+#define TXT_TUTORIAL_LINE17                                                    "'/s' keys to climb. If you are"\r
+#define TXT_TUTORIAL_LINE18                                                    "stuck to the floor, quickly release"\r
+#define TXT_TUTORIAL_LINE19                                                    "and then press the stick key"\r
+#define TXT_TUTORIAL_MOVEMENT                                          "Movement"\r
+#define TXT_TUTORIAL_STICK                                                     "Stick"\r
+#define TXT_TUTORIAL_JUMP                                                              "Jump"\r
+#define TXT_TUTORIAL_SLIDE                                                     "Slide"\r
+#define TXT_TUTORIAL_HEAVY                                                     "Heavy"\r
+\r
+//mainmenu.c\r
+#define TXT_LOADING                                                                                    "Loading..."\r
+#define TXT_TURBO_EDITION                                                              "Turbo Edition"\r
+#define TXT_COPYRIGHT                   "Gish (c) 2007 Cryptic Sea"\r
+#define TXT_EXIT                                                                                               "Exit"\r
+#define TXT_START                                                                                              "Start"\r
+#define TXT_VERSUS                                                                                     "Versus"\r
+#define TXT_OPTIONS                                                                                    "Options"\r
+#define TXT_CREDITS                                                                                    "Credits"\r
+#define TXT_BUYNOW                                                                                     "Buy Now!"\r
+#define TXT_BACK                                                                                               "Back"\r
+#define TXT_SUMO                                                                                               "Sumo"\r
+#define TXT_FOOTBALL                                                                           "Football"\r
+#define TXT_GREED                                                                                              "Greed"\r
+#define TXT_PITFIGHT                                                                           "Pitfight"\r
+#define TXT_DRAGSTER                                                                           "Dragster"\r
+#define TXT_COLLECTION                                                                 "Collection"\r
+#define TXT_RACING                                                                                     "Racing"\r
+#define TXT_NEXT                                                                                               "Next"\r
+\r
+//credits.c\r
+#define TXT_DESIGN                                                                                     "Design"\r
+#define TXT_PROGRAMMING                                                                        "Programming"\r
+#define TXT_ART                                                                                                        "Art"\r
+#define TXT_SOUND_MUSIC                                                                        "Sound//Music"\r
+#define TXT_ADDITIONAL_DIALOG                                          "Additional Dialog & Sounds"\r
+#define TXT_ADDITIONAL_CONTENT                                 "Additional Level Design & Art"\r
+#define TXT_THANKS                                                                                     "Thanks"\r
+#define TXT_GISHUSES                                                                           "Gish uses"\r
+\r
+//editor.c\r
+#define TXT_LEVELNAME                                                                          "Level Name"\r
+#define TXT_GAMETYPE                                                                           "Gametype"\r
+#define TXT_GAMETIME                                                                           "Gametime"\r
+#define TXT_RED                                                                                                        "Red"\r
+#define TXT_GREEN                                                                                              "Green"\r
+#define TXT_BLUE                                                                                               "Blue"\r
+#define TXT_BACKGROUND                                                                 "Background"\r
+#define TXT_MIDGROUND                                                                          "MIDGROUND"\r
+#define TXT_FOREGROUND                                                                 "FOREGROUND"\r
+#define TXT_WAYBACKGROUND                                                              "WAYBACKGROUND"\r
+#define TXT_TILESET                                                                                    "TILESET"\r
+#define TXT_TILE                                                                                               "TILE"\r
+#define TXT_FRICTION                                                                           "Friction"\r
+#define TXT_BREAKPOINT                                                                 "Breakpoint"\r
+#define TXT_MIDDAMAGE                                                                          "Middamage"\r
+#define TXT_FOREDAMAGE                                                                 "Foredamage"\r
+#define TXT_DENSITY                                                                                    "Density"\r
+#define TXT_DRAG                                                                                               "Drag"\r
+#define TXT_ANIMATION                                                                          "Animation"\r
+#define TXT_ANIMATESPD                                                                 "AnimateSpd"\r
+#define TXT_LINES                                                                                              "Lines"\r
+#define TXT_ALPHA                                                                                              "Alpha"\r
+//game.c\r
+#define TXT_REPLAY                                                                                     "Replay"\r
+#define TXT_PAUSED                                                                                     "Paused"\r
+#define TXT_PRESS_P                                                                                    "Press P to continue"\r
+#define TXT_LOADINGEDITOR                                                              "Loading Editor"\r
+#define TXT_RETURN_TO_GAME                                                     "Return To Game"\r
+#define TXT_RESETLEVEL_MINUSONE                                        "Restart Level (-1 Life)"\r
+#define TXT_RESETLEVEL                                                                 "Restart Level"\r
+#define TXT_EXITGAME_MINUSONE                                          "Exit Game (-1 Life)"\r
+#define TXT_EXITGAME                                                                           "Exit Game"\r
+#define TXT_TIMEUP                                                                                     "TIME UP!"\r
+#define TXT_COMPLETE                                                                           "COMPLETE"\r
+#define TXT_WARPZONE                                                                           "WARP ZONE!"\r
+#define TXT_OOPS                                                                                               "OOPS!"\r
+//gamemenu.c\r
+#define TXT_NEXTLEVEL                                                                          "Next Level"\r
+#define TXT_ENDING                                                                                     "Ending"\r
+#define TXT_SMALL_AMBER                                                                        "Small Amber"\r
+#define TXT_MEDIUM_AMBER                                                               "Medium Amber"\r
+#define TXT_LARGE_AMBER                                                                        "Large Amber"\r
+#define TXT_TARBALLS                                                                           "Tarballs"\r
+#define TXT_EXTRA_LIVES                                                                        "Extra Lives"\r
+#define TXT_SECRETS                                                                                    "Secrets"\r
+#define TXT_LIFE_BONUS                                                                 "Life Bonus"\r
+#define TXT_LEVEL_POINTS                                                               "Level Points"\r
+#define TXT_GF_RESCUING_BONUS                                          "Girlfriend Rescuing Bonus:1"\r
+#define TXT_BOSS_POINTS                                                                        "Boss Points"\r
+#define TXT_TOTAL_POINTS                                                               "Total Points"\r
+#define TXT_LIVES                                                                                              "Lives"\r
+#define TXT_POINTS                                                                                     "Points"\r
+#define TXT_ISLE_OF_THE                                                                        "Isle of the"\r
+#define TXT_DEAD                                                                                               "Dead"\r
+#define TXT_SATANS_LAIR                                                                        "Satan's Lair"\r
+#define TXT_CONTINUE                                                                           "Continue"\r
+#define TXT_GAME_OVER                                                                          "GAME OVER"\r
+\r
+#define TXT_ENDING_LINE1                                                               "After rescuing Brea from the"\r
+#define TXT_ENDING_LINE2                                                               "clutches of that obsessed psycho"\r
+#define TXT_ENDING_LINE3                                                               "Hera, Gish and Brea went on to"\r
+#define TXT_ENDING_LINE4                                                               "become world renowned "\r
+#define TXT_ENDING_LINE5                                                               "Entomologists and had the world's"\r
+#define TXT_ENDING_LINE6                                                               "first legal inter-species marriage"\r
+#define TXT_ENDING_LINE7                                                               "Hera was never heard from again,"\r
+#define TXT_ENDING_LINE8                                                               "though some say they can hear her"\r
+#define TXT_ENDING_LINE9                                                               "calling Gish's name from the"\r
+#define TXT_ENDING_LINE10                                                              "depths of Gehenna.  Sadly, to"\r
+#define TXT_ENDING_LINE11                                                              "this day no one seems to remember"\r
+#define TXT_ENDING_LINE12                                                              "who she was..."\r
+\r
+#define TXT_ENDING_BAD_LINE1                                           "After letting Brea fall into the"\r
+#define TXT_ENDING_BAD_LINE2                                           "pit of lava, Gish went on to lead"\r
+#define TXT_ENDING_BAD_LINE3                                           "a life of celibacy, volunteering"\r
+#define TXT_ENDING_BAD_LINE4                                           "most of his time to charity"\r
+#define TXT_ENDING_BAD_LINE5                                           "organizations that specialize in"\r
+#define TXT_ENDING_BAD_LINE6                                           "bringing lava awareness to the"\r
+#define TXT_ENDING_BAD_LINE7                                           "mainstream."\r
+#define TXT_ENDING_BAD_LINE8                                           "Hera was never heard from again,"\r
+#define TXT_ENDING_BAD_LINE9                                           "though some say they can hear her"\r
+#define TXT_ENDING_BAD_LINE10                                          "calling Gish's name from the"\r
+#define TXT_ENDING_BAD_LINE11                                          "depths of Gehenna.  Sadly, to"\r
+#define TXT_ENDING_BAD_LINE12                                          "this day no one seems to remember"\r
+#define TXT_ENDING_BAD_LINE13                                          "who she was..."\r
+\r
+#define TXT_NEW_VS_MODE                                                                        "New Vs. Mode Unlocked"\r
+#define TXT_NEW_VS_LEVEL                                                               "New Vs. Levels Unlocked"\r
+#define TXT_MINI_GISH_MODE                                                     "Mini Gish Mode Unlocked"\r
+\r
+//high.c\r
+#define TXT_SAVEREPLAY                                                                 "Save Replay"\r
+#define TXT_LEVEL                                                                                      "Level"\r
+#define TXT_LEVEL_HIGHSCORE                                                    "Level /i High Scores"\r
+#define TXT_NAME                                                                                               "Name"\r
+#define TXT_TIME                                                                                               "Time"\r
+#define TXT_REPLAYSAVED                                                                        "Replay Saved"\r
+//objedit.c\r
+#define TXT_OBJECTSET                                                                          "OBJECTSET"\r
+#define TXT_OBJECTNUM                                                                          "OBJECTNUM"\r
+#define TXT_OBJECTYPE                                                                          "OBJECTTYPE"\r
+#define TXT_OBJECTS                                                                                    "OBJECTS"\r
+#define TXT_ROPES                                                                                              "ROPES"\r
+#define TXT_LINK                                                                                               "LINK"\r
+//options.c\r
+#define TXT_VIDEOOPTIONS                                                               "Video Options"\r
+#define TXT_NONE                                                                                               "None"\r
+#define TXT_JOY1                                                                                               "Joy1"\r
+#define TXT_JOY2                                                                                               "Joy2"\r
+#define TXT_JOY3                                                                                               "Joy3"\r
+#define TXT_JOY4                                                                                               "Joy4"\r
+#define TXT_SOUND_ON                                                                           "Sound On"\r
+#define TXT_SOUND_OFF                                                                          "Sound Off"\r
+#define TXT_MUSIC_ON                                                                           "Music On"\r
+#define TXT_MUSIC_OFF                                                                          "Music Off"\r
+#define TXT_PLAYER                                                                                     "Player"\r
+#define TXT_KEY                                                                                                        "Key"\r
+#define TXT_JOYSTICK                                                                           "Joystick"\r
+#define TXT_PLAYER1                                                                                    "Player 1"\r
+#define TXT_MOVE_LEFT                                                                          "Move Left"\r
+#define TXT_BUTTON                                                                                     "Button"\r
+#define TXT_AXIS                                                                                               "Axis"\r
+#define TXT_MOVE_RIGHT                                                                 "Move Right"\r
+#define TXT_MOVE_DOWN                                                                          "Move Down"\r
+#define TXT_MOVE_UP                                                                                    "Move Up"\r
+#define TXT_STICK                                                                                              "Stick"\r
+#define TXT_START_PAUSE                                                                        "Start//Pause"\r
+#define TXT_PLAYER2                                                                                    "Player 2"\r
+#define TXT_APPLY                                                                                              "Apply"\r
+#define TXT_FULLSCREEN                                                                 "Fullscreen"\r
+#define TXT_16BIT                                                                                              "16 bit"\r
+#define TXT_32BIT                                                                                              "32 bit"\r
+#define TXT_RESOLUTION                                                                 "Resolution"\r
+#define TXT_COLOR                                                                                              "Color"\r
+#define TXT_OPENGLINFO                                                                 "OpenGL Info"\r
+#define TXT_JUMP                                                                                               "Jump"\r
+#define TXT_STICK                                                                                              "Stick"\r
+#define TXT_SLIDE                                                                                              "Slide"\r
+#define TXT_HEAVY                                                                                              "Heavy"\r
+\r
+//player.c\r
+#define TXT_DELETE_PLAYER                                                              "Delete Player"\r
+#define TXT_CREATE                                                                                     "Create"\r
+#define TXT_PLAYER_INFO                                                                        "Level /i-/i Lives /i Score /i High /i"\r
+#define        TXT_NEW_PLAYER                                                                  "/i-New Player"                                                                                                                         \r
+#define TXT_CHOOSE_PLAYER                                                              "Choose Player"\r
+#define TXT_ENTER_NAME                                                                 "Enter Name"\r
+#define TXT_DELETE_Y_N                                                                 "Delete /s? (Y//N)"\r
+#define TXT_COLLECTION_GAME                                                    "Collection Game"\r
+#define TXT_NEW_GAME                                                                           "New Game"\r
+#define TXT_PRACTICE                    "Practice"\r
+#define TXT_SINGLE_LEVEL                                                               "Single Level"\r
+#define TXT_NEW_LEVEL                                                                          "New Level"\r
+#define TXT_EASY                                                                                               "Easy" \r
+#define TXT_NORMAL                                                                                     "Normal"\r
+#define TXT_HARD                                                                                               "Hard"\r
+#define TXT_LUDICROUS                                                                          "Ludicrous"\r
+#define TXT_MINI_GISH                                                                          "Mini Gish"\r
+#define TXT_HIGH_SCORE                                                                 "High Scores"\r
+#define TXT_COLLECTION_MODE                                                    "Collection Mode"\r
+#define TXT_SELECT_DIFFICULTY                                          "Select Difficulty"\r
+\r
+//replay.c\r
+#define TXT_PLAY_REPLAY                                                                        "Play Replay"\r
+#define TXT_FILENAME                                                                           "Filename"\r
+#define TXT_REPLAY_MODE                                                                        "Replay Mode"\r
+\r
+//ropeedit.c\r
+#define TXT_PLAY_REPLAY                                                                        "Play Replay"\r
+#define TXT_NUMOFROPES                                                                 "NUMOFROPES"\r
+#define TXT_TEXTURENUM                                                                 "TEXTURENUM"\r
+\r
+//texture.c\r
+#define TXT_LOAD_TILESET                                                               "Load Tileset"\r
+#define TXT_LEVEL_NAME                                                                 "Level Name"\r
+\r
+#define TXT_PLAYER3                     "Player 3"\r
+#define TXT_PLAYER4                     "Player 4"\r
+#define TXT_4_PLAYER                    "4 Player"\r
+#define TXT_CANCEL                      "Cancel"\r
+#define TXT_CUSTOM_LEVELS               "Custom Levels"\r
+#define TXT_LOAD_LEVEL                  "Load Level"\r
+#define TXT_PAGE_UP                     "Page Up"\r
+#define TXT_PAGE_DOWN                   "Page Down"\r
+#define TXT_PLAY_CAMPAIGN               "Play Campaign"\r
+#define TXT_PLAYER_INFO_MAPPACK         "Level /s Lives /i Score /i High /i"\r
+#define TXT_SAVE                        "Save"\r
+#define TXT_CAMPAIGN_EDITOR             "Campaign Editor"\r
+#define TXT_LEVEL_EDITOR                "Level Editor"\r
+#define TXT_ADD_LEVEL                   "Add Level"\r
+#define TXT_DELETE_LEVEL                "Delete Level"\r
diff --git a/game/game.c b/game/game.c
new file mode 100644 (file)
index 0000000..2248885
--- /dev/null
@@ -0,0 +1,861 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void gameloop(void)\r
+  {\r
+  int count,count2;\r
+  int simtimer;\r
+  int simcount;\r
+  int frametimer,fps;\r
+  float vec[3];\r
+  char filename[13]="text000.tga";\r
+  int scorenum;\r
+  unsigned int x;\r
+\r
+  game.godparticle=-1;\r
+\r
+  game.oldschool=0;\r
+  if (game.levelnum==64)\r
+    game.oldschool=1;\r
+  if (game.levelnum==65)\r
+    {\r
+    game.oldschool=2;\r
+    game.oldschoolsound=-200;\r
+    }\r
+  if (game.levelnum==66)\r
+    game.oldschool=3;\r
+\r
+  srand(time(NULL));\r
+\r
+  setuplevel();\r
+  setupgame();\r
+\r
+  simtimer=SDL_GetTicks();\r
+\r
+  game.exit=0;\r
+\r
+  scorenum=-1;\r
+\r
+  resetmenuitems();\r
+\r
+  while ((game.exit<2 || game.exitdelay>0) && !windowinfo.shutdown)\r
+    {\r
+    frametimer=SDL_GetTicks();\r
+\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);\r
+    glStencilMask(~0);\r
+    glClearStencil(0);\r
+    glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);\r
+    glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE);\r
+    glStencilMask(0);\r
+\r
+    setuptextdisplay();\r
+    glColor3fv(level.ambient[3]);\r
+    if (level.background[0]!=0)\r
+      displaybackground(660);\r
+\r
+    if (game.over!=0 && level.gametype<10)\r
+    if (game.exit==0)\r
+      {\r
+      if (game.over>=3 && game.over<=5)\r
+        {\r
+        game.exit=5;\r
+        game.exitdelay=100;\r
+        }\r
+      if (game.over==2)\r
+        {\r
+        game.exit=4;\r
+        game.exitdelay=100;\r
+        }\r
+      if (game.over==1)\r
+        {\r
+        game.exit=3;\r
+        game.exitdelay=100;\r
+        if (game.levelnum==65)\r
+          game.exitdelay=200;\r
+        }\r
+      }\r
+\r
+    numofmenuitems=0;\r
+    if (game.exit==0)\r
+      {\r
+      createmenuitem("",0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+      setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+      setmenuitem(MO_SET,&game.exit,1);\r
+      }\r
+    if (game.exit==1)\r
+      {\r
+      count=240;\r
+\r
+      if (game.over==0)\r
+        {\r
+        createmenuitem(TXT_RETURN_TO_GAME,(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+        setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+        setmenuitem(MO_SET,&game.exit,0);\r
+        }\r
+      else\r
+        createmenuitemempty();\r
+      count+=16;\r
+\r
+      if (game.levelnum<64)\r
+        {\r
+        if (level.gametype==0 && (game.levelnum>0 || mappack.active) && !game.playreplay)\r
+          createmenuitem(TXT_RESETLEVEL_MINUSONE,(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+        else\r
+          createmenuitem(TXT_RESETLEVEL,(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+        setmenuitem(MO_HOTKEY,SCAN_R);\r
+        if (level.gametype==0)\r
+          setmenuitem(MO_SET,&game.exit,3);\r
+        count+=16;\r
+        }\r
+      else\r
+        createmenuitemempty();\r
+\r
+      if (game.over==0 && game.levelnum<64 && level.gametype==0 && game.levelnum>0 && !game.playreplay)\r
+        createmenuitem(TXT_EXITGAME_MINUSONE,(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+      else\r
+        createmenuitem(TXT_EXITGAME,(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f);\r
+      setmenuitem(MO_HOTKEY,SCAN_E);\r
+      setmenuitem(MO_SET,&game.exit,2);\r
+      count+=16;\r
+      }\r
+    if (game.exit==3)\r
+      {\r
+      if (game.time>0)\r
+        {\r
+        createmenuitem("       ",(320|TEXT_CENTER),(240|TEXT_CENTER),20,1.0f,1.0f,1.0f,1.0f);\r
+        setmenuitem(MO_SET,&game.exitdelay,0);\r
+        }\r
+      else\r
+        {\r
+        createmenuitem(TXT_TIMEUP,(320|TEXT_CENTER),(240|TEXT_CENTER),20,1.0f,1.0f,1.0f,1.0f);\r
+        setmenuitem(MO_SET,&game.exitdelay,0);\r
+        }\r
+      }\r
+    if (game.exit==4)\r
+      {\r
+      createmenuitem(TXT_COMPLETE,524|TEXT_CENTER,266,20,1.0f,1.0f,1.0f,1.0f);\r
+      setmenuitem(MO_IMAGE,462);\r
+      setmenuitem(MO_RESIZE,(320|TEXT_CENTER),(240|TEXT_CENTER),256,128);\r
+      setmenuitem(MO_SET,&game.exitdelay,0);\r
+      }\r
+    if (game.exit==5)\r
+      {\r
+      if (game.levelnum!=34)\r
+        {\r
+        createmenuitem(TXT_WARPZONE,(320|TEXT_CENTER),(240|TEXT_CENTER),24,1.0f,1.0f,1.0f,1.0f);\r
+        setmenuitem(MO_SET,&game.exitdelay,0);\r
+        }\r
+      else\r
+        {\r
+        //createmenuitem("OOPS!",(320|TEXT_CENTER),(240|TEXT_CENTER),24,1.0f,1.0f,1.0f,1.0f);\r
+        //setmenuitem(MO_SET,&game.exitdelay,0);\r
+        createmenuitem(TXT_OOPS,(320|TEXT_CENTER),(240|TEXT_CENTER),24,1.0f,1.0f,1.0f,1.0f);\r
+        setmenuitem(MO_IMAGE,465);\r
+        setmenuitem(MO_RESIZE,(320|TEXT_CENTER),(240|TEXT_CENTER),256,128);\r
+        setmenuitem(MO_SET,&game.exitdelay,0);\r
+        }\r
+      }\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    if (game.exit==1)\r
+    if (level.gametype!=0)\r
+    if (menuitem[1].active)\r
+      {\r
+      setuplevel();\r
+      setupgame();\r
+\r
+      game.exit=0;\r
+      menuitem[1].active=0;\r
+      }\r
+\r
+    if (game.dialog>0)\r
+      {\r
+      if (game.levelnum!=68 || (game.dialog!=13 && game.dialog!=14))\r
+        {\r
+        if (game.dialogdelay>0)\r
+          game.dialogdelay--;\r
+  \r
+        count2=0;\r
+        if (game.dialogdelay==0)\r
+          count2=1;\r
+        for (count=4;count<8;count++)\r
+        if (keyboard[control[0].key[count]] && !prevkeyboard[control[0].key[count]])\r
+          count2=1;\r
+        if (control[0].joysticknum!=-1)\r
+        for (count=4;count<8;count++)\r
+        if (control[0].button[count]!=-1)\r
+        if (joystick[control[0].joysticknum].button[control[0].button[count]] && !prevjoystick[control[0].joysticknum].button[control[0].button[count]])\r
+          count2=1;\r
+  \r
+        if (count2==1)\r
+          {\r
+          game.dialog--;\r
+          game.dialogdelay=1000;\r
+\r
+          if (game.levelnum==68)\r
+          if (game.dialog==4)\r
+            {\r
+            game.numoflives=99;\r
+            game.exit=4;\r
+            game.exitdelay=0;\r
+            }\r
+          }\r
+        }\r
+      else\r
+        {\r
+        count2=0;\r
+        if (keyboard[control[0].key[2]] && !prevkeyboard[control[0].key[2]])\r
+          count2=1;\r
+        if (keyboard[control[0].key[3]] && !prevkeyboard[control[0].key[3]])\r
+          count2=1;\r
+        if (control[0].joysticknum!=-1)\r
+          {\r
+          if (joystick[control[0].joysticknum].axis[1]>=0.5f && prevjoystick[control[0].joysticknum].axis[1]<0.5f)\r
+            count2=1;\r
+          if (joystick[control[0].joysticknum].axis[1]<=-0.5f && prevjoystick[control[0].joysticknum].axis[1]>-0.5f)\r
+            count2=1;\r
+          }\r
+        if (count2==1)\r
+          {\r
+          if (game.dialog==14)\r
+            game.dialog=13;\r
+          else\r
+            game.dialog=14;\r
+          }\r
+\r
+        count2=0;\r
+        for (count=4;count<8;count++)\r
+        if (keyboard[control[0].key[count]] && !prevkeyboard[control[0].key[count]])\r
+          count2=1;\r
+        if (control[0].joysticknum!=-1)\r
+        for (count=4;count<8;count++)\r
+        if (control[0].button[count]!=-1)\r
+        if (joystick[control[0].joysticknum].button[control[0].button[count]] && !prevjoystick[control[0].joysticknum].button[control[0].button[count]])\r
+          count2=1;\r
+\r
+        if (count2==1)\r
+          {\r
+          if (game.dialog==14)\r
+            game.dialog=12;\r
+          else\r
+            game.dialog=1;\r
+          }\r
+        }\r
+      }\r
+    checkmusic();\r
+\r
+    if (game.levelnum>=1 && game.levelnum<=7)\r
+      game.songnum=0;\r
+    if (game.levelnum>=8 && game.levelnum<=14)\r
+      game.songnum=1;\r
+    if (game.levelnum>=15 && game.levelnum<=21)\r
+      game.songnum=2;\r
+    if (game.levelnum>=22 && game.levelnum<=28)\r
+      game.songnum=3;\r
+    if (game.levelnum>=29 && game.levelnum<=32)\r
+      game.songnum=4;\r
+    if (game.bosslevel)\r
+      game.songnum=5;\r
+    if (game.levelnum==64)\r
+      game.songnum=6;\r
+    if (game.levelnum==67)\r
+      game.songnum=2;\r
+\r
+    if (game.levelnum==0)\r
+      {\r
+      if (game.songnum==-1)\r
+        game.songnum=rand()%5;\r
+      }\r
+    if (level.gametype==11)\r
+      game.songnum=7;\r
+    /*\r
+    if (level.gametype==10)\r
+      game.songnum=4;\r
+    if (level.gametype==11)\r
+      game.songnum=5;\r
+    if (level.gametype==12)\r
+      game.songnum=4;\r
+    */\r
+#ifdef TESTIT\r
+    if (keyboard[SCAN_M] && !prevkeyboard[SCAN_M])\r
+      {\r
+      game.songnum++;\r
+      if (game.songnum>3)\r
+        game.songnum=0;\r
+      }\r
+    if (keyboard[SCAN_N] && !prevkeyboard[SCAN_N])\r
+      game.songnum=-1;\r
+    if (keyboard[SCAN_T] && !prevkeyboard[SCAN_T])\r
+      game.turbomode^=1;\r
+#endif\r
+    if (game.levelnum==0)\r
+    if (keyboard[SCAN_F5] && !prevkeyboard[SCAN_F5])\r
+      {\r
+      setuplevel();\r
+      setupgame();\r
+      }\r
+    if (keyboard[SCAN_P] && !prevkeyboard[SCAN_P] && game.exit==0)\r
+      game.pause^=1;\r
+    //if (keyboard[SCAN_R] && !prevkeyboard[SCAN_R])\r
+    //  movie.record^=1;\r
+\r
+    view.zoom=10.0f;\r
+#ifdef TESTIT\r
+    if (keyboard[SCAN_EQUALS])\r
+      view.zoom=20.0f;\r
+    if (keyboard[SCAN_MINUS])\r
+      view.zoom=5.0f;\r
+#endif\r
+    if (game.oldschool==2)\r
+      view.zoom=16.0f;\r
+    if (game.oldschool==3)\r
+      view.zoom=26.0f;\r
+\r
+    if (level.gametype==15)\r
+      view.zoom=24.0f;\r
+    if (level.gametype==16)\r
+      view.zoom=24.0f;\r
+    if (level.gametype==17 || level.gametype==18)\r
+      view.zoom=14.0f;\r
+\r
+    view.zoomx=view.zoom+0.5f;\r
+    view.zoomy=view.zoom*0.75f+0.5f;\r
+    //view.zoomy=view.zoom*0.5625f+0.5f;\r
+\r
+    setuporthoviewport(0,0,640,480,view.zoom,view.zoom*0.75f,20.0f);\r
+    //setuporthoviewport(0,0,640,480,view.zoom,view.zoom*0.5625f,20.0f);\r
+    setupviewpoint(view.position,view.orientation);\r
+\r
+    if (game.oldschool==1)// || game.oldschool==3)\r
+      glViewport(0,0,256,256);\r
+    if (game.oldschool==2)\r
+      glViewport(0,0,128,128);\r
+\r
+    soundsimulation(view.position,view.orientation);\r
+\r
+    setupframelighting();\r
+\r
+    setuprenderobjects();\r
+\r
+    /*\r
+    resettimer(4);\r
+    resettimer(5);\r
+    resettimer(6);\r
+    resettimer(7);\r
+    */\r
+\r
+    //starttimer(4);\r
+\r
+    rendershadows();\r
+\r
+    //stoptimer(4);\r
+\r
+    //starttimer(5);\r
+\r
+    renderlevelback();\r
+\r
+    //stoptimer(5);\r
+\r
+    //starttimer(6);\r
+\r
+    renderparticles();\r
+\r
+    //if (!keyboard[SCAN_B])\r
+    renderobjects();\r
+\r
+    renderparticles2();\r
+\r
+    //stoptimer(6);\r
+\r
+    //starttimer(7);\r
+\r
+    renderlevel();\r
+#ifdef TESTIT\r
+    if (keyboard[SCAN_B])\r
+      renderbonds();\r
+#endif\r
+    renderlevelfore();\r
+\r
+    //stoptimer(7);\r
+\r
+    if (game.oldschool==1)// || game.oldschool==3)\r
+      {\r
+      glBindTexture(GL_TEXTURE_2D,texture[334].glname);\r
+      glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,256,256,0);\r
+      }\r
+    if (game.oldschool==2)\r
+      {\r
+      glBindTexture(GL_TEXTURE_2D,texture[333].glname);\r
+      glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,128,128,0);\r
+      }\r
+\r
+    if (game.oldschool==1 || game.oldschool==2)// || game.oldschool==3)\r
+      {\r
+      setuptextdisplay();\r
+  \r
+      if (game.oldschool==1)// || game.oldschool==3)\r
+        glBindTexture(GL_TEXTURE_2D,texture[334].glname);\r
+      if (game.oldschool==2)\r
+        glBindTexture(GL_TEXTURE_2D,texture[333].glname);\r
+  \r
+      glBegin(GL_QUADS);\r
+    \r
+      glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    \r
+      glTexCoord2f(0.0f,1.0f);\r
+      glVertex3f(-1.0f,0.75f,-1.0f);\r
+    \r
+      glTexCoord2f(1.0f,1.0f);\r
+      glVertex3f(1.0f,0.75f,-1.0f);\r
+    \r
+      glTexCoord2f(1.0f,0.0f);\r
+      glVertex3f(1.0f,-0.75f,-1.0f);\r
+    \r
+      glTexCoord2f(0.0f,0.0f);\r
+      glVertex3f(-1.0f,-0.75f,-1.0f);\r
+    \r
+      glEnd();\r
+      }\r
+\r
+    setuptextdisplay();\r
+\r
+    if (game.exit==4 || game.exit==5)\r
+      {\r
+      glDisable(GL_TEXTURE_2D);\r
+\r
+      glBegin(GL_QUADS);\r
+    \r
+      glColor4f(0.0f,0.0f,0.0f,(float)(100-game.exitdelay)*0.01f);\r
+    \r
+      glVertex3f(-1.0f,0.75f,-1.0f);\r
+      glVertex3f(1.0f,0.75f,-1.0f);\r
+      glVertex3f(1.0f,-0.75f,-1.0f);\r
+      glVertex3f(-1.0f,-0.75f,-1.0f);\r
+    \r
+      glEnd();\r
+\r
+      glEnable(GL_TEXTURE_2D);\r
+      }\r
+    if (game.exit==3)\r
+      {\r
+      glDisable(GL_TEXTURE_2D);\r
+\r
+      glBegin(GL_QUADS);\r
+\r
+      if (game.exitdelay>50)\r
+        glColor4f(0.5f,0.0f,0.0f,(float)(100-game.exitdelay)*0.01f);\r
+      else\r
+        glColor4f(1.0f-(float)(100-game.exitdelay)*0.01f,0.0f,0.0f,(float)(100-game.exitdelay)*0.01f);\r
+    \r
+      glVertex3f(-1.0f,0.75f,-1.0f);\r
+      glVertex3f(1.0f,0.75f,-1.0f);\r
+      glVertex3f(1.0f,-0.75f,-1.0f);\r
+      glVertex3f(-1.0f,-0.75f,-1.0f);\r
+    \r
+      glEnd();\r
+\r
+      glEnable(GL_TEXTURE_2D);\r
+      }\r
+\r
+    if (game.oldschool==0 && !game.bosslevel && level.gametype!=15)\r
+      rendersprites();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+\r
+    drawbackground(640,0,0,256,256,640,480);\r
+    drawbackground(641,256,0,256,256,640,480);\r
+    drawbackground(642,512,0,256,256,640,480);\r
+    drawbackground(643,0,256,256,256,640,480);\r
+    drawbackground(644,256,256,256,256,640,480);\r
+    drawbackground(645,512,256,256,256,640,480);\r
+\r
+    //if (game.turbomode)\r
+    //  drawbackground(529,28,64,64,32,640,480);\r
+\r
+    gamedisplay();\r
+\r
+    drawmenuitems();\r
+\r
+    if (game.exit==3 || game.exit==4 || game.exit==5)\r
+    if (game.exitdelay<20)\r
+      {\r
+      glDisable(GL_TEXTURE_2D);\r
+\r
+      glBegin(GL_QUADS);\r
+    \r
+      glColor4f(0.0f,0.0f,0.0f,(float)(20-game.exitdelay)*0.05f);\r
+    \r
+      glVertex3f(-1.0f,0.75f,-1.0f);\r
+      glVertex3f(1.0f,0.75f,-1.0f);\r
+      glVertex3f(1.0f,-0.75f,-1.0f);\r
+      glVertex3f(-1.0f,-0.75f,-1.0f);\r
+    \r
+      glEnd();\r
+\r
+      glEnable(GL_TEXTURE_2D);\r
+      }\r
+    if (movie.record)\r
+      {\r
+      if (movie.framenum<game.framenum/2)\r
+        recordframe();\r
+      drawtext("RECORD",0,64,16,1.0f,0.0f,0.0f,1.0f);\r
+      }\r
+#ifdef TESTIT\r
+    /*\r
+    fuckedup[0]=timer[0].totaltime;\r
+    fuckedup[1]=timer[1].totaltime;\r
+    fuckedup[2]=timer[2].totaltime;\r
+    fuckedup[3]=timer[3].totaltime;\r
+    fuckedup[4]=timer[4].totaltime;\r
+    fuckedup[5]=timer[5].totaltime;\r
+    fuckedup[6]=timer[6].totaltime;\r
+    fuckedup[7]=timer[7].totaltime;\r
+    fuckedup[8]=timer[8].totaltime;\r
+    fuckedup[9]=frame.numoflights;\r
+    fuckedup[10]=numofsounds;\r
+    fuckedup[11]=game.bonus[7];\r
+    fuckedup[12]=numofanimations;\r
+    */\r
+    fuckedup[7]=game.levelnum;\r
+    for (count=0;count<16;count++)\r
+      {\r
+      if (fuckedup[count]<8000000)\r
+        drawtext("/i",0,128+count*12,12,1.0f,1.0f,1.0f,1.0f,fuckedup[count]);\r
+      else\r
+        drawtext("/i",0,128+count*12,12,1.0f,0.0f,0.0f,1.0f,fuckedup[count]);\r
+      }\r
+\r
+    drawtext("/f",0,368,16,1.0f,1.0f,1.0f,1.0f,object[0].data[0]);\r
+    drawtext("/f",0,384,16,1.0f,1.0f,1.0f,1.0f,object[0].data[1]);\r
+    drawtext("/i",0,400,16,1.0f,1.0f,1.0f,1.0f,fps);\r
+    drawtext("/i",0,416,16,1.0f,1.0f,1.0f,1.0f,numofbonds);\r
+    drawtext("/i",0,432,16,1.0f,1.0f,1.0f,1.0f,numofparticles);\r
+    drawtext("/i",0,448,16,1.0f,1.0f,1.0f,1.0f,numofobjects);\r
+    drawtext("/i",0,464,16,1.0f,1.0f,1.0f,1.0f,numofobjectrenders);\r
+#endif\r
+\r
+    if (game.playreplay)\r
+      drawtext(TXT_REPLAY,(612|TEXT_END),64,16,1.0f,1.0f,0.0f,1.0f);\r
+\r
+    if (game.pause && game.exit==0)\r
+      {\r
+      drawtext(TXT_PAUSED,(320|TEXT_CENTER),240,16,1.0f,1.0f,1.0f,1.0f);\r
+      drawtext(TXT_PRESS_P,(320|TEXT_CENTER),256,12,1.0f,1.0f,1.0f,1.0f);\r
+      }\r
+\r
+    if (game.exit!=0 || game.godmode)\r
+      drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    simcount=0;\r
+    game.simspeed=20;\r
+    if (game.turbomode)\r
+      game.simspeed=15;\r
+\r
+    while (SDL_GetTicks()-simtimer<=game.simspeed)\r
+      SDL_Delay(1);\r
+\r
+    while (SDL_GetTicks()-simtimer>game.simspeed && simcount<3)\r
+      {\r
+      simcount++;\r
+      count=SDL_GetTicks()-simtimer-game.simspeed;\r
+      simtimer=SDL_GetTicks()-count;\r
+      if (simcount==3)\r
+        simtimer=SDL_GetTicks();\r
+\r
+      if (game.exitdelay>0)\r
+      if (!game.editing)\r
+        game.exitdelay--;\r
+      if (keyboard[SCAN_ESC])\r
+        game.exitdelay=0;\r
+\r
+      if (game.exit==0 && !game.pause && game.dialog==0 && !game.over)\r
+        {\r
+        getinputs();\r
+\r
+        if (!game.playreplay)\r
+          saveinputs();\r
+        else\r
+          loadinputs();\r
+\r
+        //resettimer(8);\r
+        //starttimer(8);\r
+\r
+        if (game.startdelay==0)\r
+          simulation();\r
+        gamelogic();\r
+\r
+        //stoptimer(8);\r
+        }\r
+      }\r
+\r
+    if (game.levelnum==0 && game.editing)\r
+    if (keyboard[SCAN_F1] && !prevkeyboard[SCAN_F1])\r
+      {\r
+      game.songnum=-1;\r
+      checkmusic();\r
+\r
+      for (count=numofsounds-1;count>=0;count--)\r
+        deletesound(count);\r
+\r
+      setuptextdisplay();\r
+    \r
+      drawtext(TXT_LOADINGEDITOR,(320|TEXT_CENTER),240,16,1.0f,1.0f,1.0f,1.0f);\r
+    \r
+      SDL_GL_SwapBuffers();\r
+\r
+      for (count=0;count<20;count++)\r
+      if (animation[count].loaded==0)\r
+        animation[count].loaded=2;\r
+\r
+      loadanimations();\r
+\r
+      editlevel();\r
+\r
+      savelevel("backup.lvl");\r
+\r
+      simtimer=SDL_GetTicks();\r
+      }\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if ((SDL_GetTicks()-frametimer)!=0)\r
+      fps=1000/(SDL_GetTicks()-frametimer);\r
+    }\r
+\r
+  game.songnum=-1;\r
+  checkmusic();\r
+\r
+  for (count=numofsounds-1;count>=0;count--)\r
+    deletesound(count);\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void simulation(void)\r
+  {\r
+  int count,count2;\r
+  float vec[3],vec2[3];\r
+  float intersectpoint[3];\r
+  float normal[3];\r
+  float scale;\r
+\r
+  game.framenum++;\r
+\r
+  if (game.godmode)\r
+  if (!game.playreplay)\r
+    {\r
+    vec[0]=view.position[0]+(float)(mouse.x-320)/32.0f;\r
+    vec[1]=view.position[1]+(float)(240-mouse.y)/32.0f;\r
+    vec[2]=0.0f;\r
+\r
+    if (mouse.lmb)\r
+      {\r
+      if (game.godparticle==-1)\r
+        {\r
+        game.godparticle=numofparticles;\r
+        createparticle(16,vec,NULL,10000.0f,-1,10000);\r
+\r
+        for (count=0;count<numofparticles;count++)\r
+        if (count!=game.godparticle)\r
+        if (particle[count].type==3)\r
+          {\r
+          subtractvectors(vec2,vec,particle[count].position);\r
+          if (vectorlength(vec2)<3.0f)\r
+            createbond(count,game.godparticle,16,-1);\r
+          }\r
+        }\r
+      else\r
+        {\r
+        subtractvectors(vec2,vec,particle[game.godparticle].position);\r
+        scaleaddvectors2(vec2,vec2,particle[game.godparticle].velocity,-4.0f);\r
+\r
+        scale=vectorlength(vec2);\r
+        normalizevector(vec2,vec2);\r
+        scale*=0.01f;\r
+\r
+        scaleaddvectors2(particle[game.godparticle].velocity,particle[game.godparticle].velocity,vec2,scale);\r
+        }\r
+      }\r
+    else\r
+      {\r
+      if (game.godparticle!=-1)\r
+        {\r
+        deleteparticle(game.godparticle);\r
+        game.godparticle=-1;\r
+        }\r
+      }\r
+    }\r
+\r
+  particlesimulation();\r
+  particletimetolive();\r
+\r
+  //physicstemp.numofbonds=0;\r
+\r
+  for (count=0;count<numofobjects;count++)\r
+    object[count].prevhitpoints=object[count].hitpoints;\r
+\r
+  if (level.gametype!=16)\r
+  for (count=0;count<numofparticles;count++)\r
+    particle[count].velocity[1]-=particle[count].gravity;\r
+\r
+  for (count=0;count<numofparticles;count++)\r
+    if (particle[count].levelcollision)\r
+      particlecollision(count);\r
+\r
+  for (count=0;count<numofobjects;count++)\r
+    {\r
+    updateogg();\r
+    objectcollision(count);\r
+    }\r
+\r
+  for (count=0;count<numofobjects;count++)\r
+    {\r
+    updateogg();\r
+    objectcollisionobject(count);\r
+    }\r
+\r
+  objectcycle();\r
+  objectanimation();\r
+\r
+  updateogg();\r
+\r
+  bondsimulation2();\r
+  checkbonds();\r
+  objecttimetolive();\r
+\r
+  spritesimulation();\r
+  spritetimetolive();\r
+\r
+  bosssimulation();\r
+  bosstimetolive();\r
+\r
+  for (count=0;count<numofobjects;count++)\r
+    {\r
+    if (object[count].type==1)\r
+      {\r
+      if (object[count].hitpoints<0)\r
+        object[count].hitpoints=0;\r
+\r
+      if (object[count].hitpoints<object[count].prevhitpoints)\r
+        {\r
+        for (count2=0;count2<=(object[count].prevhitpoints-object[count].hitpoints)/20;count2++)\r
+          {\r
+          vec[0]=(float)((rnd()&255)-127)/1270.0f;\r
+          vec[1]=(float)((rnd()&255)-127)/1270.0f;\r
+          vec[2]=0.0f;\r
+          addvectors(vec,vec,object[count].velocity);\r
+  \r
+          createparticle(5,object[count].position,vec,0.25f,-1,100+(rnd()&63));\r
+          particle[numofparticles-1].rendersize=0.125+(float)(rnd()&127)/1000.0f;\r
+          if (count==0)\r
+            particle[numofparticles-1].texturenum=368;\r
+          else if (count==1)\r
+            particle[numofparticles-1].texturenum=363;\r
+          else if (count==2)\r
+            particle[numofparticles-1].texturenum=383+40;\r
+          else\r
+            particle[numofparticles-1].texturenum=383+60;\r
+          }\r
+        object[count].frame=12;\r
+        object[count].framedelay=0.0f;\r
+        playsound(16,object[count].position,NULL,0.5f,0,1.0f,count,2);\r
+        }\r
+      }\r
+    }\r
+  }\r
+\r
+void getinputs(void)\r
+  {\r
+  int count;\r
+\r
+  for (count=0;count<4;count++)\r
+    {\r
+    object[count].axis[0]=0.0f;\r
+    object[count].axis[1]=0.0f;\r
+    object[count].button=0;\r
+    }\r
+  for (count=0;count<4;count++)\r
+    {\r
+    if (keyboard[control[count].key[0]])\r
+      object[count].axis[0]-=1.0f;\r
+    if (keyboard[control[count].key[1]])\r
+      object[count].axis[0]+=1.0f;\r
+    if (keyboard[control[count].key[2]])\r
+      object[count].axis[1]-=1.0f;\r
+    if (keyboard[control[count].key[3]])\r
+      object[count].axis[1]+=1.0f;\r
+    if (keyboard[control[count].key[4]])\r
+      object[count].button|=1;\r
+    if (keyboard[control[count].key[5]])\r
+      object[count].button|=2;\r
+    if (keyboard[control[count].key[6]])\r
+      object[count].button|=4;\r
+    if (keyboard[control[count].key[7]])\r
+      object[count].button|=8;\r
+\r
+    if (control[count].joysticknum!=-1)\r
+      {\r
+      object[count].axis[0]+=joystick[control[count].joysticknum].axis[0];\r
+      object[count].axis[1]+=joystick[control[count].joysticknum].axis[1];\r
+\r
+      if (control[count].button[0]!=-1)\r
+      if (joystick[control[count].joysticknum].button[control[count].button[0]])\r
+        object[count].axis[0]-=1.0f;\r
+      if (control[count].button[1]!=-1)\r
+      if (joystick[control[count].joysticknum].button[control[count].button[1]])\r
+        object[count].axis[0]+=1.0f;\r
+      if (control[count].button[2]!=-1)\r
+      if (joystick[control[count].joysticknum].button[control[count].button[2]])\r
+        object[count].axis[1]-=1.0f;\r
+      if (control[count].button[3]!=-1)\r
+      if (joystick[control[count].joysticknum].button[control[count].button[3]])\r
+        object[count].axis[1]+=1.0f;\r
+\r
+      if (control[count].button[4]!=-1)\r
+      if (joystick[control[count].joysticknum].button[control[count].button[4]])\r
+        object[count].button|=1;\r
+      if (control[count].button[5]!=-1)\r
+      if (joystick[control[count].joysticknum].button[control[count].button[5]])\r
+        object[count].button|=2;\r
+      if (control[count].button[6]!=-1)\r
+      if (joystick[control[count].joysticknum].button[control[count].button[6]])\r
+        object[count].button|=4;\r
+      if (control[count].button[7]!=-1)\r
+      if (joystick[control[count].joysticknum].button[control[count].button[7]])\r
+        object[count].button|=8;\r
+      }\r
+    if (object[count].axis[0]<-1.0f)\r
+      object[count].axis[0]=-1.0f;\r
+    if (object[count].axis[0]>1.0f)\r
+      object[count].axis[0]=1.0f;\r
+    if (object[count].axis[1]<-1.0f)\r
+      object[count].axis[1]=-1.0f;\r
+    if (object[count].axis[1]>1.0f)\r
+      object[count].axis[1]=1.0f;\r
+    }\r
+  }\r
diff --git a/game/game.h b/game/game.h
new file mode 100644 (file)
index 0000000..5a19d5b
--- /dev/null
@@ -0,0 +1,71 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void gameloop(void);\r
+void renderlevel(void);\r
+void simulation(void);\r
+void getinputs(void);\r
+\r
+struct\r
+  {\r
+  float position[3];\r
+  float orientation[3][3];\r
+  float zoom;\r
+  int zoomx;\r
+  int zoomy;\r
+  } view;\r
+\r
+struct\r
+  {\r
+  int pause;\r
+  int type;\r
+  int framenum;\r
+  int levelnum;\r
+  int bosslevel;\r
+  int dialog;\r
+  int dialogdelay;\r
+  int songnum;\r
+  int currentsongnum;\r
+  int time;\r
+  int score[4];\r
+  int combo;\r
+  int combodelay;\r
+  int totalscore;\r
+  int difficulty;\r
+  int bonus[16];\r
+  int numofbonus[16];\r
+  int scoredelay;\r
+  int startdelay;\r
+  int exitdelay;\r
+  int over;\r
+  int numoflives;\r
+  char text[256];\r
+  int exit;\r
+  int oldschool;\r
+  int oldschoolsound;\r
+  int turbomode;\r
+  int supersize;\r
+  int simspeed;\r
+  int playreplay;\r
+  int editing;\r
+  int godmode;\r
+  int godparticle;\r
+  } game;\r
diff --git a/game/gamemenu.c b/game/gamemenu.c
new file mode 100644 (file)
index 0000000..5abea43
--- /dev/null
@@ -0,0 +1,690 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void postgamemenu(void)\r
+  {\r
+  int count;\r
+  int scoretemp;\r
+  int scorecountdelay;\r
+  int simtimer;\r
+  int simcount;\r
+\r
+  savereplay(game.levelnum+100);\r
+\r
+  scoretemp=game.totalscore;\r
+  scorecountdelay=0;\r
+\r
+  simtimer=SDL_GetTicks();\r
+\r
+  resetmenuitems();\r
+\r
+  joymenunum=1;\r
+\r
+  while (!menuitem[0].active && !menuitem[1].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+    if (game.levelnum!=34)\r
+      {\r
+      createmenuitem(TXT_NEXTLEVEL,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f);\r
+      setmenuitem(MO_HOTKEY,SCAN_N);\r
+      }\r
+    else\r
+      {\r
+      createmenuitem(TXT_ENDING,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f);\r
+      setmenuitem(MO_HOTKEY,SCAN_N);\r
+      }\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    soundsimulation(view.position,view.orientation);\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(580);\r
+\r
+    drawbackground(468,(320|TEXT_CENTER),48,384,64,640,480);\r
+    drawbackground(469,400,160,128,128,640,480);\r
+\r
+    if (!game.bosslevel)\r
+      {\r
+      count=128;\r
+      drawtext(TXT_SMALL_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[5],game.numofbonus[5]);\r
+      count+=16;\r
+      drawtext(TXT_MEDIUM_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[6],game.numofbonus[6]);\r
+      count+=16;\r
+      drawtext(TXT_LARGE_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[7],game.numofbonus[7]);\r
+      count+=16;\r
+      drawtext(TXT_TARBALLS" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[4],game.numofbonus[4]);\r
+      count+=16;\r
+      drawtext(TXT_EXTRA_LIVES" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[3],game.numofbonus[3]);\r
+      count+=16;\r
+      drawtext(TXT_SECRETS" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[8],game.numofbonus[8]);\r
+      count+=16;\r
+\r
+      drawtext(TXT_LIFE_BONUS":/i",64,352,16,1.0f,1.0f,1.0f,1.0f,(object[0].hitpoints/50)*10);\r
+      drawtext(TXT_LEVEL_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10);\r
+      }\r
+    else\r
+      {\r
+      if (game.levelnum==34 && game.exit==4)\r
+        drawtext(TXT_GF_RESCUING_BONUS,64,336,16,1.0f,1.0f,1.0f,1.0f);\r
+      drawtext(TXT_LIFE_BONUS":/i",64,352,16,1.0f,1.0f,1.0f,1.0f,(object[0].hitpoints/50)*10);\r
+      if (game.levelnum==34 && game.exit==4)\r
+        drawtext(TXT_BOSS_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10-1);\r
+      else\r
+        drawtext(TXT_BOSS_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10);\r
+      }\r
+\r
+    drawtext(TXT_TOTAL_POINTS":/i",64,384,16,1.0f,1.0f,1.0f,1.0f,scoretemp);\r
+    drawtext("+/i",64+19*16,384,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(scoretemp-game.totalscore));\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    simcount=0;\r
+    while (SDL_GetTicks()-simtimer>20 && simcount<5)\r
+      {\r
+      simcount++;\r
+      count=SDL_GetTicks()-simtimer-20;\r
+      simtimer=SDL_GetTicks()-count;\r
+\r
+      scorecountdelay++;\r
+\r
+      if (scorecountdelay>=25)\r
+      if (scoretemp<game.totalscore+game.score[0])\r
+        {\r
+        if (scoretemp<=game.totalscore+game.score[0]-10)\r
+          scoretemp+=10;\r
+        else\r
+          scoretemp++;\r
+        if ((scorecountdelay&1)==1)\r
+          playsound(15,view.position,NULL,0.2f,0,1.0f,-1,0);\r
+        }\r
+      }\r
+    }\r
+\r
+  if (menuitem[0].active)\r
+    game.exit=2;\r
+\r
+  for (count=numofsounds-1;count>=0;count--)\r
+    deletesound(count);\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void pregamemenu(void)\r
+  {\r
+  int count,count2;\r
+  int simtimer;\r
+  int simcount;\r
+  int startdelay;\r
+\r
+  game.exit=0;\r
+\r
+  startdelay=0;\r
+  simtimer=SDL_GetTicks();\r
+\r
+  resetmenuitems();\r
+\r
+  joymenunum=1;\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+    createmenuitem(TXT_START,(320|TEXT_CENTER),320,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_S);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(540);\r
+\r
+#ifdef TESTIT\r
+  if (game.levelnum>=1 && game.levelnum<=34)\r
+    {\r
+    if (keyboard[SCAN_R] && !prevkeyboard[SCAN_R])\r
+    if (game.levelnum<34)\r
+      game.levelnum++;\r
+    if (keyboard[SCAN_F] && !prevkeyboard[SCAN_F])\r
+    if (game.levelnum>1)\r
+      game.levelnum--;\r
+    }\r
+#endif\r
+\r
+    if (game.levelnum<35)\r
+      {\r
+      count=(game.levelnum-1)/7+1;\r
+      count2=(game.levelnum-1)%7+1;\r
+      if (count==1)\r
+        drawbackground(521,(320|TEXT_CENTER),48,192,192,640,480);\r
+      if (count==2)\r
+        drawbackground(522,(320|TEXT_CENTER),48,192,192,640,480);\r
+      if (count==3)\r
+        drawbackground(523,(320|TEXT_CENTER),48,192,192,640,480);\r
+      if (count==4)\r
+        drawbackground(524,(320|TEXT_CENTER),48,192,192,640,480);\r
+      if (count==5)\r
+        drawbackground(525,(320|TEXT_CENTER),48,192,192,640,480);\r
+\r
+      drawtext("/i-/i",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f,count,count2);\r
+      drawtext(TXT_LIVES" /i",(320|TEXT_CENTER),272,16,1.0f,1.0f,1.0f,1.0f,game.numoflives);\r
+      drawtext(TXT_POINTS" /i",(320|TEXT_CENTER),288,16,1.0f,1.0f,1.0f,1.0f,game.totalscore);\r
+      }\r
+    if (game.levelnum==64)\r
+      {\r
+      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);\r
+      drawtext(" -1",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);\r
+      }\r
+    if (game.levelnum==65)\r
+      {\r
+      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);\r
+      drawtext(" -2",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);\r
+      }\r
+    if (game.levelnum==66)\r
+      {\r
+      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);\r
+      drawtext(" -3",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);\r
+      }\r
+    if (game.levelnum==67)\r
+      {\r
+      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);\r
+      drawtext(TXT_ISLE_OF_THE,(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);\r
+      drawtext(TXT_DEAD,(320|TEXT_CENTER),272,16,1.0f,1.0f,1.0f,1.0f);\r
+      }\r
+    if (game.levelnum==68)\r
+      {\r
+      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);\r
+      drawtext(TXT_SATANS_LAIR,(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);\r
+      }\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+\r
+    if (menuitem[1].active)// || startdelay>=150)\r
+      {\r
+      loadstorylevel(game.levelnum);\r
+\r
+      gameloop();\r
+\r
+      if (game.exit==2 || game.exit==3)\r
+      if (game.levelnum<64)\r
+        {\r
+        if (game.numoflives<99)\r
+          game.numoflives--;\r
+        if (game.numoflives<0)\r
+          {\r
+          if (player[playernum].highscore<game.totalscore)\r
+            player[playernum].highscore=game.totalscore;\r
+\r
+          game.totalscore=0;\r
+          game.numoflives=5;\r
+          if (game.difficulty==1)\r
+            {\r
+            count2=(game.levelnum-1)%7+1;\r
+            if (count2!=7)\r
+              {\r
+              count=(game.levelnum-1)/7;\r
+              game.levelnum=count*7+1;\r
+              }\r
+            }\r
+          if (game.difficulty>=2)\r
+            game.levelnum=0;\r
+\r
+          gameovermenu();\r
+\r
+          goto changelevelbypass;\r
+          }\r
+        }\r
+\r
+#ifdef DEMO\r
+      if (game.levelnum==4)\r
+      if (game.exit==4 || game.exit==5)\r
+        {\r
+        game.score[0]+=(object[0].hitpoints/50)*10;\r
+        postgamemenu();\r
+        game.totalscore+=game.score[0];\r
+\r
+        endingmenu();\r
+        menuitem[0].active=1;\r
+\r
+        game.levelnum=5;\r
+\r
+        goto changelevelbypass;\r
+        }\r
+#endif\r
+      if (game.levelnum==34)\r
+      if (game.exit==4 || game.exit==5)\r
+        {\r
+        game.score[0]=10000;\r
+        if (game.levelnum==34 && game.exit==4)\r
+          game.score[0]+=1;\r
+\r
+        game.score[0]+=(object[0].hitpoints/50)*10;\r
+        postgamemenu();\r
+        game.totalscore+=game.score[0];\r
+\r
+        endingmenu();\r
+        menuitem[0].active=1;\r
+\r
+        game.levelnum=35;\r
+\r
+        goto changelevelbypass;\r
+        }\r
+\r
+      if (game.exit==4)\r
+        {\r
+        //if (!game.bosslevel)\r
+        if (game.levelnum!=68 || game.dialog==0)\r
+          {\r
+          if (game.levelnum==6)\r
+            game.score[0]=1000;\r
+          if (game.levelnum==13)\r
+            game.score[0]=2000;\r
+          if (game.levelnum==20)\r
+            game.score[0]=3000;\r
+          if (game.levelnum==27)\r
+            game.score[0]=4000;\r
+          if (game.levelnum==33)\r
+            game.score[0]=5000;\r
+          if (game.levelnum==34)\r
+            game.score[0]=10000;\r
+          if (game.levelnum==68)\r
+            game.score[0]=20000;\r
+\r
+          //if (game.levelnum==34 && game.exit==4)\r
+          //  game.score[0]+=10;\r
+\r
+          game.oldschool=0;\r
+          game.score[0]+=(object[0].hitpoints/50)*10;\r
+          postgamemenu();\r
+          game.totalscore+=game.score[0];\r
+          if (game.exit==2)\r
+            {\r
+            game.exit=4;\r
+            menuitem[0].active=1;\r
+            }\r
+          }\r
+        if (game.levelnum<35)\r
+          game.levelnum++;\r
+        }\r
+      if (game.levelnum==64)\r
+        {\r
+        game.levelnum=4;\r
+        if (game.over==3)\r
+          game.levelnum=22;\r
+        if (game.over==4)\r
+          game.levelnum=15;\r
+        if (game.over==5)\r
+          game.levelnum=8;\r
+\r
+        goto changelevelbypass;\r
+        }\r
+      if (game.levelnum==65)\r
+        {\r
+        game.levelnum=9;\r
+\r
+        goto changelevelbypass;\r
+        }\r
+      if (game.levelnum==66)\r
+        {\r
+        game.levelnum=26;\r
+\r
+        goto changelevelbypass;\r
+        }\r
+      if (game.levelnum==67)\r
+        {\r
+        if (game.exit==2 || game.exit==3)\r
+          game.levelnum=19;\r
+        else\r
+          game.levelnum=68;\r
+\r
+        goto changelevelbypass;\r
+        }\r
+      if (game.levelnum==68)\r
+        {\r
+        game.levelnum=19;\r
+\r
+        goto changelevelbypass;\r
+        }\r
+      if (game.exit==5)\r
+        {\r
+        game.totalscore+=game.score[0];\r
+\r
+        if (game.levelnum==3)\r
+          game.levelnum=64;\r
+        if (game.levelnum==4)\r
+          game.levelnum=24;\r
+        if (game.levelnum==8)\r
+          game.levelnum=65;\r
+        if (game.levelnum==18)\r
+          game.levelnum=67;\r
+        if (game.levelnum==25)\r
+          game.levelnum=66;\r
+\r
+        goto changelevelbypass;\r
+        }\r
+\r
+      changelevelbypass:;\r
+\r
+      simtimer=SDL_GetTicks();\r
+      startdelay=0;\r
+\r
+      joymenunum=1;\r
+      }\r
+\r
+    simcount=0;\r
+    while (SDL_GetTicks()-simtimer>20 && simcount<5)\r
+      {\r
+      simcount++;\r
+      count=SDL_GetTicks()-simtimer-20;\r
+      simtimer=SDL_GetTicks()-count;\r
+\r
+      //startdelay++;\r
+      }\r
+\r
+    if (game.exit==2)\r
+      menuitem[0].active=1;\r
+    }\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void gameovermenu(void)\r
+  {\r
+  int count;\r
+  int scoretemp;\r
+  int scorecountdelay;\r
+  int simtimer;\r
+  int simcount;\r
+\r
+  resetmenuitems();\r
+\r
+  joymenunum=1;\r
+\r
+  while (!menuitem[0].active && !menuitem[1].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+    if (game.difficulty<2)\r
+      {\r
+      createmenuitem(TXT_CONTINUE,(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);\r
+      setmenuitem(MO_HOTKEY,SCAN_C);\r
+      }\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(580);\r
+\r
+    drawtext(TXT_GAME_OVER,(320|TEXT_CENTER),224,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+    }\r
+\r
+  if (menuitem[0].active)\r
+    game.exit=2;\r
+  if (menuitem[1].active)\r
+    game.exit=3;\r
+\r
+  resetmenuitems();\r
+  }\r
+\r
+void endingmenu(void)\r
+  {\r
+#ifndef DEMO\r
+  int count;\r
+\r
+  resetmenuitems();\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem("Next",(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(580);\r
+\r
+    count=192;\r
+    if (game.exit==4)\r
+      {\r
+      drawbackground(520,(320|TEXT_CENTER),48,256,128,640,480);\r
+\r
+      drawtext(TXT_ENDING_LINE1,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE2,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE3,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE4,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE5,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE6,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE7,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE8,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE9,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE10,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE11,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_LINE12,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      }\r
+    if (game.exit==5)\r
+      {\r
+      drawbackground(519,(320|TEXT_CENTER),48,256,128,640,480);\r
+\r
+      drawtext(TXT_ENDING_BAD_LINE1,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE2,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE3,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE4,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE5,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE6,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE7,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE8,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE9,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE10,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE11,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE12,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      drawtext(TXT_ENDING_BAD_LINE13,64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+      count+=14;\r
+      }\r
+\r
+    drawtext(TXT_TOTAL_POINTS":/i",64,400,16,1.0f,1.0f,1.0f,1.0f,game.totalscore);\r
+    if (player[playernum].difficulty==1 || player[playernum].difficulty==2)\r
+      drawtext(TXT_NEW_VS_MODE,64,416,16,1.0f,1.0f,1.0f,1.0f);\r
+    if (player[playernum].difficulty==2)\r
+      drawtext(TXT_NEW_VS_LEVEL,64,432,16,1.0f,1.0f,1.0f,1.0f);\r
+    if (player[playernum].difficulty==3)\r
+      drawtext(TXT_MINI_GISH_MODE,64,432,16,1.0f,1.0f,1.0f,1.0f);\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+    }\r
+\r
+  resetmenuitems();\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(560);\r
+\r
+    if (game.exit==5)\r
+      drawbackground(256+68,288,320,96,96,640,480);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+    }\r
+\r
+  resetmenuitems();\r
+#endif\r
+#ifdef DEMO\r
+  int count;\r
+\r
+  resetmenuitems();\r
+\r
+  while (!menuitem[0].active && !windowinfo.shutdown)\r
+    {\r
+    glClearColor(0.0f,0.0f,0.0f,0.0f);\r
+    glClear(GL_COLOR_BUFFER_BIT);\r
+\r
+    numofmenuitems=0;\r
+    createmenuitem("Next",(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f);\r
+    setmenuitem(MO_HOTKEY,SCAN_ESC);\r
+\r
+    checksystemmessages();\r
+    checkkeyboard();\r
+    checkmouse();\r
+    checkjoystick();\r
+    checkmenuitems();\r
+\r
+    setuptextdisplay();\r
+\r
+    glColor4f(1.0f,1.0f,1.0f,1.0f);\r
+    displaybackground(580);\r
+\r
+    count=128;\r
+\r
+    drawtext("Congratulations, you have completed",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+    drawtext("the demo.  Buy the full game and get:",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+    count+=14;\r
+    drawtext("-34 action packed story mode levels",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+    drawtext("-23 time trial collection challenges",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+    drawtext("-5 competitive versus modes",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+    drawtext("-5 hidden bonus levels",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+    drawtext("-6 intense boss fights",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+    drawtext("-Over 55 secrets to discover",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+    drawtext("-And much much more...",64,count,14,1.0f,1.0f,1.0f,1.0f);\r
+    count+=14;\r
+\r
+    drawtext("Total Points:/i",64,400,16,1.0f,1.0f,1.0f,1.0f,game.totalscore);\r
+\r
+    drawmenuitems();\r
+\r
+    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);\r
+\r
+    SDL_GL_SwapBuffers();\r
+    }\r
+\r
+  resetmenuitems();\r
+#endif\r
+  }\r
+\r
diff --git a/game/gamemenu.h b/game/gamemenu.h
new file mode 100644 (file)
index 0000000..049b095
--- /dev/null
@@ -0,0 +1,25 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void postgamemenu(void);\r
+void pregamemenu(void);\r
+void gameovermenu(void);\r
+void endingmenu(void);\r
diff --git a/game/glext.c b/game/glext.c
new file mode 100644 (file)
index 0000000..ce38dd7
--- /dev/null
@@ -0,0 +1,55 @@
+/*\r
+Copyright (C) 2005, 2010 - Cryptic Sea\r
+\r
+This file is part of Gish.\r
+\r
+Gish is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+\r
+See the GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+*/\r
+\r
+void loadglextentions(void)\r
+  {\r
+  char *ext;\r
+  char *glversion;\r
+\r