Upload Jump'n'Bump sources
git-svn-id: svn://kolibrios.org@8526 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
6392fe8202
commit
dadd9561ac
61
contrib/other/jumpnbump/AUTHORS
Executable file
61
contrib/other/jumpnbump/AUTHORS
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
Jump'n'Bump is done by many people. The authors and contributors are listed
|
||||||
|
below. Invented and implemented was Jump'n'Bump by Brainchild Design as a
|
||||||
|
DOS game. Later the source was released and Chuck Mason did the port to
|
||||||
|
Linux using SDL. Some people contributed various stuff to it.
|
||||||
|
The current maintainer is Florian Schulze.
|
||||||
|
|
||||||
|
Mattias Brynervall <matbr656@student.liu.se>
|
||||||
|
Original DOS code.
|
||||||
|
|
||||||
|
Andreas Brynervall <andreasb@acc.umu.se>
|
||||||
|
Martin Magnusson <marma102@student.liu.se>
|
||||||
|
Original Graphics.
|
||||||
|
|
||||||
|
Anders Nilsson <equel@swipnet.se>
|
||||||
|
Original Music.
|
||||||
|
|
||||||
|
Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
The first Linux port using SDL.
|
||||||
|
|
||||||
|
Philippe Brochard <phil.brochard@wanadoo.fr>
|
||||||
|
The jbmenu.tcl script.
|
||||||
|
|
||||||
|
Joe Wreschnig <piman@sacredchao.net>
|
||||||
|
The manual page
|
||||||
|
|
||||||
|
"timecop" <timecop@japan.co.jp>
|
||||||
|
pack and unpack.
|
||||||
|
|
||||||
|
Jon Atkins <jcatki@home.com>
|
||||||
|
The network code of the Linux version.
|
||||||
|
|
||||||
|
Gürkan Sengün <gurkan@linuks.mine.nu>
|
||||||
|
Made the website http://www.jumpbump.mine.nu/ and hosts it. Promotion.
|
||||||
|
|
||||||
|
Florian Schulze <crow@icculus.org>
|
||||||
|
Cleaned up code. Added scaling graphics mode (800x512). Fixed sound.
|
||||||
|
|
||||||
|
Ben Hines <bhines@alumni.ucsd.edu>
|
||||||
|
MacOS X fixes.
|
||||||
|
|
||||||
|
Gil Megidish
|
||||||
|
Made the Kaillera network version.
|
||||||
|
|
||||||
|
David García Rodríguez <bkron@hotmail.com>
|
||||||
|
Level making tutorial.
|
||||||
|
|
||||||
|
Ryan C. Gordon <icculus@clutteredmind.org>
|
||||||
|
Made networking possible again.
|
||||||
|
|
||||||
|
Martin Willemoes Hansen <mwh@sysrq.dk>
|
||||||
|
The python frontend.
|
||||||
|
http://mwh.sysrq.dk/programs/programs.phtml
|
||||||
|
|
||||||
|
Alessandro Gatti <a.gatti@tiscali.it>
|
||||||
|
FreeBSD fixes.
|
||||||
|
|
||||||
|
Ulrich Eckhardt <uli@doommachine.dyndns.org>
|
||||||
|
Cleanup and small patches for enhanced networking.
|
||||||
|
|
||||||
|
Ricardo Cruz <rick2@aeiou.pt>
|
||||||
|
AI functions
|
340
contrib/other/jumpnbump/COPYING
Executable file
340
contrib/other/jumpnbump/COPYING
Executable file
@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
95
contrib/other/jumpnbump/ChangeLog
Executable file
95
contrib/other/jumpnbump/ChangeLog
Executable file
@ -0,0 +1,95 @@
|
|||||||
|
27 Jun 2004 - 1.51
|
||||||
|
- refactored code to make it a bit simpler
|
||||||
|
- Added AI by Ricardo Cruz
|
||||||
|
|
||||||
|
30 Mar 2004 - 1.42
|
||||||
|
- added support for gzip and bzip2 packed levels.
|
||||||
|
|
||||||
|
21 Mar 2003 - 1.41
|
||||||
|
- new scaling filter which works with 8bit graphics. Removed the old scaler
|
||||||
|
completely, now fading and everything else works in scaled up mode.
|
||||||
|
- another attempt to fix sound on big endian systems.
|
||||||
|
|
||||||
|
Sep 2002 - 1.40
|
||||||
|
- manpage update
|
||||||
|
- joystick support added
|
||||||
|
- freebsd ports (thanks rigel from #demoscene)
|
||||||
|
- a while back network code using kaillera was send to me by Gil Megidish,
|
||||||
|
it's not enabled, because it doesn't seem to work good enough.
|
||||||
|
|
||||||
|
17 Aug 2002 - 1.39
|
||||||
|
- added -noflies option
|
||||||
|
- added client/server networking. Thanks to Ryan C. Gordon who did the base
|
||||||
|
work for it.
|
||||||
|
|
||||||
|
11 Aug 2002 - 1.35
|
||||||
|
- gobpack added
|
||||||
|
- documentation updated
|
||||||
|
- little fixes here and there
|
||||||
|
|
||||||
|
2 Aug 2002 - 1.34
|
||||||
|
- fixed too dark font
|
||||||
|
- attempt to fix sound and scaleup on big endian systems
|
||||||
|
|
||||||
|
5 Jul 2002 - 1.33
|
||||||
|
- added -musicnosound option
|
||||||
|
|
||||||
|
15 Jun 2002 - 1.32
|
||||||
|
- fix for off by one in -mirror
|
||||||
|
add icon for application (macosx,windows,x)
|
||||||
|
|
||||||
|
10 Jun 2002 - 1.31
|
||||||
|
- rename jbmenu.tcl to jnbmenu.tcl, make it +x, add
|
||||||
|
options for -mirror and -scaleup
|
||||||
|
update manpage and -h with -scaleup
|
||||||
|
update makefiles accordingly
|
||||||
|
rename pack/unpack to jnbpack/jnbunpack
|
||||||
|
set gametitle
|
||||||
|
|
||||||
|
9 Jun 2002 - 1.3
|
||||||
|
- Added -mirror commandline option to play the level mirrored
|
||||||
|
- Deleting temporary music file
|
||||||
|
|
||||||
|
- 1.2
|
||||||
|
- MacOS X fixes
|
||||||
|
- some endian fixes
|
||||||
|
|
||||||
|
24 Feb 2002 - 1.1
|
||||||
|
- fixed timing problems
|
||||||
|
- fixed crash when temporary music can't be written
|
||||||
|
|
||||||
|
22 Feb 2002 - 1.0
|
||||||
|
- working sound
|
||||||
|
- new scaling graphics mode
|
||||||
|
- cleaned up code
|
||||||
|
|
||||||
|
===========================================================================
|
||||||
|
This is the changelog of the linux version from which this port is derived.
|
||||||
|
|
||||||
|
25 Feb 2001 - 0.69
|
||||||
|
initial linux port, worked fine with freebsd too (chuck mason)
|
||||||
|
|
||||||
|
26 Feb 2001 - 0.69
|
||||||
|
made sound be played (chuck mason)
|
||||||
|
|
||||||
|
03 Mar 2001 - 0.70
|
||||||
|
fixing fps (longislandman)
|
||||||
|
changing player input: 4 player at one keyboard (tarzeau)
|
||||||
|
pack/unpack which packs/unpacks the leveldata (timecop)
|
||||||
|
|
||||||
|
?? Mar 2001 - 0.70
|
||||||
|
network code has been written (longislandman, jonatkins.org)
|
||||||
|
it werks but we won't release it until it's good for the masses,
|
||||||
|
for test and fun play come join #keen on irc.linux.com
|
||||||
|
(be sure to have one udp port open if you have a firewall,
|
||||||
|
and also have sdl-mixer, sdl and sdl-net)
|
||||||
|
|
||||||
|
16 Mar 2001 - 0.70
|
||||||
|
did a new screenshot http://jumpbump.mine.nu/port/jumpbumprocks.jpg
|
||||||
|
wrote a little faq http://jumpbump.mine.nu/port/jumpbumpfaq.txt
|
||||||
|
put online level-selector-menu http://jumpbump.mine.nu/port/jbmenu.tcl
|
||||||
|
(received from philippe brochard, thank you!)
|
||||||
|
|
||||||
|
20 Mar 2001 - 0.72
|
||||||
|
repackaged tarballs with network code jnb-net.tar.gz,
|
||||||
|
menusystem and unpack/pack
|
8
contrib/other/jumpnbump/LINKS
Executable file
8
contrib/other/jumpnbump/LINKS
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
http://www.jumpbump.mine.nu/
|
||||||
|
http://www.icculus.org/jumpnbump/
|
||||||
|
http://freshmeat.net/projects/jumpnbump/
|
||||||
|
http://www.geocities.com/bkron2000
|
||||||
|
http://bloodybunnies.8m.com/
|
||||||
|
http://gohanz.www7.50megs.com/jumpbump/
|
||||||
|
http://brainchilddesign.com/games/jumpnbump/index.html
|
||||||
|
http://www.libsdl.org/
|
24
contrib/other/jumpnbump/Makefile
Executable file
24
contrib/other/jumpnbump/Makefile
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
CC = kos32-gcc
|
||||||
|
LD = kos32-ld
|
||||||
|
|
||||||
|
SDK_DIR = $(abspath ../../sdk)
|
||||||
|
|
||||||
|
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -Dstricmp=strcasecmp -DZLIB_SUPPORT -Dstrnicmp=strncasecmp -DUSE_SDL -DNDEBUG
|
||||||
|
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base 0
|
||||||
|
|
||||||
|
INCLUDES = -I $(SDK_DIR)/sources/newlib/libc/include -I. -I$(SDK_DIR)/sources/SDL-1.2.2_newlib/include -I $(SDK_DIR)/sources/zlib
|
||||||
|
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib -Lsdl
|
||||||
|
|
||||||
|
SRC = fireworks.c main.c menu.c filter.c stub.c
|
||||||
|
|
||||||
|
OBJECTS = $(patsubst %.c, %.o, $(SRC))
|
||||||
|
|
||||||
|
default: $(patsubst %.c,%.o,$(SRC))
|
||||||
|
kos32-ld $(LDFLAGS) $(LIBPATH) --subsystem native -o jumpnbump $(OBJECTS) -ls -lSDLn -lsound -lz -lgcc -lc.dll
|
||||||
|
objcopy jumpnbump -O binary
|
||||||
|
|
||||||
|
%.o : %.c Makefile $(SRC)
|
||||||
|
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm *.o
|
235
contrib/other/jumpnbump/SDL_mixer.h
Executable file
235
contrib/other/jumpnbump/SDL_mixer.h
Executable file
@ -0,0 +1,235 @@
|
|||||||
|
/*
|
||||||
|
MIXERLIB: An audio mixer library based on the SDL library
|
||||||
|
Copyright (C) 1997-1999 Sam Lantinga
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the Free
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Sam Lantinga
|
||||||
|
5635-34 Springhouse Dr.
|
||||||
|
Pleasanton, CA 94588 (USA)
|
||||||
|
slouken@devolution.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MIXER_H_
|
||||||
|
#define _MIXER_H_
|
||||||
|
|
||||||
|
#include "SDL_types.h"
|
||||||
|
#include "SDL_rwops.h"
|
||||||
|
#include "SDL_audio.h"
|
||||||
|
#include "SDL_byteorder.h"
|
||||||
|
#include "begin_code.h"
|
||||||
|
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The default mixer has 8 simultaneous mixing channels */
|
||||||
|
#ifndef MIX_CHANNELS
|
||||||
|
#define MIX_CHANNELS 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Good default values for a PC soundcard */
|
||||||
|
#define MIX_DEFAULT_FREQUENCY 22050
|
||||||
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
|
#define MIX_DEFAULT_FORMAT AUDIO_S16LSB
|
||||||
|
#else
|
||||||
|
#define MIX_DEFAULT_FORMAT AUDIO_S16MSB
|
||||||
|
#endif
|
||||||
|
#define MIX_DEFAULT_CHANNELS 2
|
||||||
|
#define MIX_MAX_VOLUME 128 /* Volume of a chunk */
|
||||||
|
|
||||||
|
/* The internal format for an audio chunk */
|
||||||
|
typedef struct {
|
||||||
|
int allocated;
|
||||||
|
Uint8 *abuf;
|
||||||
|
Uint32 alen;
|
||||||
|
Uint8 volume; /* Per-sample volume, 0-128 */
|
||||||
|
} Mix_Chunk;
|
||||||
|
|
||||||
|
/* The different fading types supported */
|
||||||
|
typedef enum {
|
||||||
|
MIX_NO_FADING,
|
||||||
|
MIX_FADING_OUT,
|
||||||
|
MIX_FADING_IN
|
||||||
|
} Mix_Fading;
|
||||||
|
|
||||||
|
/* The internal format for a music chunk interpreted via mikmod */
|
||||||
|
typedef struct _Mix_Music Mix_Music;
|
||||||
|
|
||||||
|
/* Open the mixer with a certain audio format */
|
||||||
|
extern DECLSPEC int Mix_OpenAudio(int frequency, Uint16 format, int channels,
|
||||||
|
int chunksize);
|
||||||
|
|
||||||
|
/* Dynamically change the number of channels managed by the mixer.
|
||||||
|
If decreasing the number of channels, the upper channels are
|
||||||
|
stopped.
|
||||||
|
This function returns the new number of allocated channels.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_AllocateChannels(int numchans);
|
||||||
|
|
||||||
|
/* Find out what the actual audio device parameters are.
|
||||||
|
This function returns 1 if the audio has been opened, 0 otherwise.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_QuerySpec(int *frequency,Uint16 *format,int *channels);
|
||||||
|
|
||||||
|
/* Load a wave file or a music (.mod .s3m .it .xm) file */
|
||||||
|
extern DECLSPEC Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc);
|
||||||
|
#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)
|
||||||
|
extern DECLSPEC Mix_Music *Mix_LoadMUS(const char *file);
|
||||||
|
|
||||||
|
#if 0 /* This hasn't been hooked into music.c yet */
|
||||||
|
/* Load a music file from an SDL_RWop object (MikMod-specific currently)
|
||||||
|
Matt Campbell (matt@campbellhome.dhs.org) April 2000 */
|
||||||
|
extern DECLSPEC Mix_Music *Mix_LoadMUS_RW(SDL_RWops *rw);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Load a wave file of the mixer format from a memory buffer */
|
||||||
|
extern DECLSPEC Mix_Chunk *Mix_QuickLoad_WAV(Uint8 *mem);
|
||||||
|
|
||||||
|
/* Free an audio chunk previously loaded */
|
||||||
|
extern DECLSPEC void Mix_FreeChunk(Mix_Chunk *chunk);
|
||||||
|
extern DECLSPEC void Mix_FreeMusic(Mix_Music *music);
|
||||||
|
|
||||||
|
/* Set a function that is called after all mixing is performed.
|
||||||
|
This can be used to provide real-time visual display of the audio stream
|
||||||
|
or add a custom mixer filter for the stream data.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void Mix_SetPostMix(void (*mix_func)
|
||||||
|
(void *udata, Uint8 *stream, int len), void *arg);
|
||||||
|
|
||||||
|
/* Add your own music player or additional mixer function.
|
||||||
|
If 'mix_func' is NULL, the default music player is re-enabled.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void Mix_HookMusic(void (*mix_func)
|
||||||
|
(void *udata, Uint8 *stream, int len), void *arg);
|
||||||
|
|
||||||
|
/* Add your own callback when the music has finished playing.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void Mix_HookMusicFinished(void (*music_finished)(void));
|
||||||
|
|
||||||
|
/* Get a pointer to the user data for the current music hook */
|
||||||
|
extern DECLSPEC void *Mix_GetMusicHookData(void);
|
||||||
|
|
||||||
|
/* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate
|
||||||
|
them dynamically to the next sample if requested with a -1 value below.
|
||||||
|
Returns the number of reserved channels.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_ReserveChannels(int num);
|
||||||
|
|
||||||
|
/* Channel grouping functions */
|
||||||
|
|
||||||
|
/* Attach a tag to a channel. A tag can be assigned to several mixer
|
||||||
|
channels, to form groups of channels.
|
||||||
|
If 'tag' is -1, the tag is removed (actually -1 is the tag used to
|
||||||
|
represent the group of all the channels).
|
||||||
|
Returns true if everything was OK.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_GroupChannel(int which, int tag);
|
||||||
|
/* Assign several consecutive channels to a group */
|
||||||
|
extern DECLSPEC int Mix_GroupChannels(int from, int to, int tag);
|
||||||
|
/* Finds the first available channel in a group of channels */
|
||||||
|
extern DECLSPEC int Mix_GroupAvailable(int tag);
|
||||||
|
/* Returns the number of channels in a group. This is also a subtle
|
||||||
|
way to get the total number of channels when 'tag' is -1
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_GroupCount(int tag);
|
||||||
|
/* Finds the "oldest" sample playing in a group of channels */
|
||||||
|
extern DECLSPEC int Mix_GroupOldest(int tag);
|
||||||
|
/* Finds the "most recent" (i.e. last) sample playing in a group of channels */
|
||||||
|
extern DECLSPEC int Mix_GroupNewer(int tag);
|
||||||
|
|
||||||
|
/* Play an audio chunk on a specific channel.
|
||||||
|
If the specified channel is -1, play on the first free channel.
|
||||||
|
If 'loops' is greater than zero, loop the sound that many times.
|
||||||
|
If 'loops' is -1, loop inifinitely (~65000 times).
|
||||||
|
Returns which channel was used to play the sound.
|
||||||
|
*/
|
||||||
|
#define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1)
|
||||||
|
/* The same as above, but the sound is played at most 'ticks' milliseconds */
|
||||||
|
extern DECLSPEC int Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks);
|
||||||
|
extern DECLSPEC int Mix_PlayMusic(Mix_Music *music, int loops);
|
||||||
|
|
||||||
|
/* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */
|
||||||
|
extern DECLSPEC int Mix_FadeInMusic(Mix_Music *music, int loops, int ms);
|
||||||
|
#define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1)
|
||||||
|
extern DECLSPEC int Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks);
|
||||||
|
|
||||||
|
/* Set the volume in the range of 0-128 of a specific channel or chunk.
|
||||||
|
If the specified channel is -1, set volume for all channels.
|
||||||
|
Returns the original volume.
|
||||||
|
If the specified volume is -1, just return the current volume.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_Volume(int channel, int volume);
|
||||||
|
extern DECLSPEC int Mix_VolumeChunk(Mix_Chunk *chunk, int volume);
|
||||||
|
extern DECLSPEC int Mix_VolumeMusic(int volume);
|
||||||
|
|
||||||
|
/* Halt playing of a particular channel */
|
||||||
|
extern DECLSPEC int Mix_HaltChannel(int channel);
|
||||||
|
extern DECLSPEC int Mix_HaltGroup(int tag);
|
||||||
|
extern DECLSPEC int Mix_HaltMusic(void);
|
||||||
|
|
||||||
|
/* Change the expiration delay for a particular channel.
|
||||||
|
The sample will stop playing after the 'ticks' milliseconds have elapsed,
|
||||||
|
or remove the expiration if 'ticks' is -1
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_ExpireChannel(int channel, int ticks);
|
||||||
|
|
||||||
|
/* Halt a channel, fading it out progressively till it's silent
|
||||||
|
The ms parameter indicates the number of milliseconds the fading
|
||||||
|
will take.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_FadeOutChannel(int which, int ms);
|
||||||
|
extern DECLSPEC int Mix_FadeOutGroup(int tag, int ms);
|
||||||
|
extern DECLSPEC int Mix_FadeOutMusic(int ms);
|
||||||
|
|
||||||
|
/* Query the fading status of a channel */
|
||||||
|
extern DECLSPEC Mix_Fading Mix_FadingMusic(void);
|
||||||
|
extern DECLSPEC Mix_Fading Mix_FadingChannel(int which);
|
||||||
|
|
||||||
|
/* Pause/Resume a particular channel */
|
||||||
|
extern DECLSPEC void Mix_Pause(int channel);
|
||||||
|
extern DECLSPEC void Mix_Resume(int channel);
|
||||||
|
extern DECLSPEC int Mix_Paused(int channel);
|
||||||
|
|
||||||
|
/* Pause/Resume the music stream */
|
||||||
|
extern DECLSPEC void Mix_PauseMusic(void);
|
||||||
|
extern DECLSPEC void Mix_ResumeMusic(void);
|
||||||
|
extern DECLSPEC void Mix_RewindMusic(void);
|
||||||
|
extern DECLSPEC int Mix_PausedMusic(void);
|
||||||
|
|
||||||
|
/* Check the status of a specific channel.
|
||||||
|
If the specified channel is -1, check all channels.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int Mix_Playing(int channel);
|
||||||
|
extern DECLSPEC int Mix_PlayingMusic(void);
|
||||||
|
|
||||||
|
/* Stop music and set external music playback command */
|
||||||
|
extern DECLSPEC int Mix_SetMusicCMD(const char *command);
|
||||||
|
|
||||||
|
/* Close the mixer, halting all playing audio */
|
||||||
|
extern DECLSPEC void Mix_CloseAudio(void);
|
||||||
|
|
||||||
|
/* We'll use SDL for reporting errors */
|
||||||
|
#define Mix_SetError SDL_SetError
|
||||||
|
#define Mix_GetError SDL_GetError
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* _MIXER_H_ */
|
5
contrib/other/jumpnbump/TODO
Executable file
5
contrib/other/jumpnbump/TODO
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
- add network code back in
|
||||||
|
- port for dreamcast
|
||||||
|
|
||||||
|
Debian:
|
||||||
|
- the game isn't in update-menus
|
29
contrib/other/jumpnbump/config.h
Executable file
29
contrib/other/jumpnbump/config.h
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* config.h
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CONFIG_H
|
||||||
|
#define __CONFIG_H
|
||||||
|
|
||||||
|
#endif
|
135
contrib/other/jumpnbump/dj.h
Executable file
135
contrib/other/jumpnbump/dj.h
Executable file
@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* dj.h
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef DOS
|
||||||
|
#include <pc.h>
|
||||||
|
#include <dpmi.h>
|
||||||
|
#include <go32.h>
|
||||||
|
#include <sys/nearptr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DJ_SD_TYPE_NOSOUND 0
|
||||||
|
#define DJ_SD_TYPE_SBLASTER 1
|
||||||
|
|
||||||
|
#define DJ_SFX_TYPE_SSS 0
|
||||||
|
#define DJ_SFX_TYPE_WAV 1
|
||||||
|
#define DJ_SFX_TYPE_SMP 2
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct dj_hardware_info {
|
||||||
|
char sd_type;
|
||||||
|
short sd_version;
|
||||||
|
short port;
|
||||||
|
char irq;
|
||||||
|
char dma;
|
||||||
|
} dj_hardware_info;
|
||||||
|
|
||||||
|
typedef struct dj_mixing_info {
|
||||||
|
char sfx_volume, num_sfx_channels;
|
||||||
|
char mod_volume, num_mod_channels;
|
||||||
|
char stereo_mix, auto_mix;
|
||||||
|
unsigned short mixing_freq;
|
||||||
|
unsigned short dma_time, dmabuf_len;
|
||||||
|
char cur_dmabuf;
|
||||||
|
unsigned long dmabuf_address[2];
|
||||||
|
char *mixed_buf;
|
||||||
|
} dj_mixing_info;
|
||||||
|
|
||||||
|
typedef struct sfx_data {
|
||||||
|
char priority;
|
||||||
|
unsigned short default_freq;
|
||||||
|
char default_volume;
|
||||||
|
unsigned long length;
|
||||||
|
char loop;
|
||||||
|
unsigned long loop_start, loop_length;
|
||||||
|
unsigned char *buf;
|
||||||
|
} sfx_data;
|
||||||
|
|
||||||
|
typedef struct dj_mod_info {
|
||||||
|
char num_channels;
|
||||||
|
char speed;
|
||||||
|
short bpm;
|
||||||
|
char order_pos;
|
||||||
|
char pat_pos;
|
||||||
|
char name[20];
|
||||||
|
struct {
|
||||||
|
char name[22];
|
||||||
|
unsigned short length;
|
||||||
|
char finetune;
|
||||||
|
char volume;
|
||||||
|
unsigned short loop_start;
|
||||||
|
unsigned short loop_length;
|
||||||
|
char *buf;
|
||||||
|
} samples[31];
|
||||||
|
char song_length;
|
||||||
|
char num_pat;
|
||||||
|
char pat_order[128];
|
||||||
|
char *pat[128];
|
||||||
|
} dj_mod_info;
|
||||||
|
|
||||||
|
|
||||||
|
extern char dj_init(void);
|
||||||
|
extern void dj_deinit(void);
|
||||||
|
extern void dj_start(void);
|
||||||
|
extern void dj_stop(void);
|
||||||
|
extern void dj_set_nosound(char flag);
|
||||||
|
extern char dj_set_sd(char sd_type, short port, char irq, char dma);
|
||||||
|
extern char dj_autodetect_sd(void);
|
||||||
|
extern void dj_get_sd_string(char *strbuf);
|
||||||
|
extern char dj_set_stereo(char flag);
|
||||||
|
extern void dj_reverse_stereo(char flag);
|
||||||
|
extern void dj_set_auto_mix(char flag);
|
||||||
|
extern unsigned short dj_set_mixing_freq(unsigned short freq);
|
||||||
|
extern void dj_set_dma_time(unsigned short time);
|
||||||
|
extern char dj_get_hardware_info(dj_hardware_info *ptr);
|
||||||
|
extern char dj_get_mixing_info(dj_mixing_info *ptr);
|
||||||
|
extern char dj_get_mod_info(char mod_num, dj_mod_info *ptr);
|
||||||
|
extern void dj_set_fake_vu_speed(unsigned char speed);
|
||||||
|
extern unsigned char dj_get_fake_vu(char channel);
|
||||||
|
extern char dj_reset_sd(void);
|
||||||
|
|
||||||
|
extern char dj_mix_needed(void);
|
||||||
|
extern void dj_mix(void);
|
||||||
|
|
||||||
|
extern char dj_set_num_sfx_channels(char num_channels);
|
||||||
|
extern void dj_set_sfx_volume(char volume);
|
||||||
|
extern char dj_get_sfx_volume(void);
|
||||||
|
extern void dj_play_sfx(unsigned char sfx_num, unsigned short freq, char volume, char panning, unsigned short delay, char channel);
|
||||||
|
extern char dj_get_sfx_settings(unsigned char sfx_num, sfx_data *data);
|
||||||
|
extern char dj_set_sfx_settings(unsigned char sfx_num, sfx_data *data);
|
||||||
|
extern void dj_set_sfx_channel_volume(char channel_num, char volume);
|
||||||
|
extern void dj_stop_sfx_channel(char channel_num);
|
||||||
|
extern char dj_load_sfx(unsigned char *file_handle, char *filename, int file_length, char sfx_type, unsigned char sfx_num);
|
||||||
|
extern void dj_free_sfx(unsigned char sfx_num);
|
||||||
|
|
||||||
|
extern char dj_ready_mod(char mod_num);
|
||||||
|
extern char dj_start_mod(void);
|
||||||
|
extern void dj_stop_mod(void);
|
||||||
|
extern void dj_set_mod_volume(char volume);
|
||||||
|
extern char dj_get_mod_volume(void);
|
||||||
|
extern char dj_load_mod(unsigned char *file_handle, char *filename, char mod_num);
|
||||||
|
extern void dj_free_mod(char mod_num);
|
||||||
|
|
251
contrib/other/jumpnbump/filter.c
Executable file
251
contrib/other/jumpnbump/filter.c
Executable file
@ -0,0 +1,251 @@
|
|||||||
|
/*
|
||||||
|
* filter.c
|
||||||
|
* Copyright (C) 2003 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
The following scaling filter is called advancedmame2x.
|
||||||
|
The implementation found here was possible because of the great ideas of
|
||||||
|
Lucas Pope.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
static int scale2x_inited = 0;
|
||||||
|
static byte lookup_map[4*16];
|
||||||
|
|
||||||
|
void init_scale2x(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (scale2x_inited)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// scale2x takes the following source:
|
||||||
|
// A B C
|
||||||
|
// D E F
|
||||||
|
// G H I
|
||||||
|
//
|
||||||
|
// and doubles the size of E to produce:
|
||||||
|
// E0 E1
|
||||||
|
// E2 E3
|
||||||
|
//
|
||||||
|
// E0 = D == B && B != F && D != H ? D : E;
|
||||||
|
// E1 = B == F && B != D && F != H ? F : E;
|
||||||
|
// E2 = D == H && D != B && H != F ? D : E;
|
||||||
|
// E3 = H == F && D != H && B != F ? F : E;
|
||||||
|
//
|
||||||
|
// to make this comparison regimen faster, we encode source color
|
||||||
|
// equivalency into a single byte with the getCode() macro
|
||||||
|
//
|
||||||
|
// #define getCode(b,f,h,d) ( (b == f)<<0 | (f == h)<<1 | (h == d)<<2 | (d == b)<<3 )
|
||||||
|
|
||||||
|
// encode the scale2x conditionals into a lookup code
|
||||||
|
for (i=0; i<16; i++) {
|
||||||
|
// E0 = D == B && B != F && D != H ? D : E; // 10-0 => 1000 or 1010 => 8 or A
|
||||||
|
lookup_map[0*16+i] = (i == 0x8 || i == 0xA) ? 0 : 1;
|
||||||
|
// E1 = B == F && B != D && F != H ? F : E; // 0-01 => 0101 or 0001 => 5 or 1
|
||||||
|
lookup_map[1*16+i] = (i == 0x5 || i == 0x1) ? 2 : 1;
|
||||||
|
// E2 = D == H && D != B && H != F ? D : E; // 010- => 0101 or 0100 => 5 or 4
|
||||||
|
lookup_map[2*16+i] = (i == 0x4 || i == 0x5) ? 0 : 1;
|
||||||
|
// E3 = H == F && D != H && B != F ? F : E; // -010 => 1010 or 0010 => A or 2
|
||||||
|
lookup_map[3*16+i] = (i == 0xA || i == 0x2) ? 2 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_scale2x(unsigned char *src,
|
||||||
|
int src_width,
|
||||||
|
int src_height,
|
||||||
|
unsigned char *dst)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int dst_width = src_width * 2;
|
||||||
|
int dst_height = src_height * 2;
|
||||||
|
int code;
|
||||||
|
byte rowColors[3];
|
||||||
|
byte *e0;
|
||||||
|
byte *e1;
|
||||||
|
byte *e2;
|
||||||
|
byte *e3;
|
||||||
|
|
||||||
|
if (!scale2x_inited)
|
||||||
|
init_scale2x();
|
||||||
|
|
||||||
|
// special top case - b is always unknown
|
||||||
|
{
|
||||||
|
byte *d;
|
||||||
|
byte *e;
|
||||||
|
byte *f;
|
||||||
|
byte *h;
|
||||||
|
|
||||||
|
e0 = &dst[0];
|
||||||
|
e1 = &dst[1];
|
||||||
|
e2 = &dst[dst_width];
|
||||||
|
e3 = &dst[dst_width + 1];
|
||||||
|
e = &src[0];
|
||||||
|
f = &src[1];
|
||||||
|
h = &src[src_width];
|
||||||
|
|
||||||
|
// special left case - d is unknown
|
||||||
|
rowColors[0] = *e;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *f;
|
||||||
|
code = ( (*f == *h)<<1 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
e++; f++; h++;
|
||||||
|
d = &src[src_width]; // (src_width - 1) + 1
|
||||||
|
e0+=2; e1+=2; e2+=2; e3+=2;
|
||||||
|
|
||||||
|
// normal case
|
||||||
|
for (x=1; x<(src_width-1); x++) {
|
||||||
|
rowColors[0] = *d;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *f;
|
||||||
|
code = ( (*f == *h)<<1 | (*h == *d)<<2 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
d++; e++; f++; h++;
|
||||||
|
e0+=2; e1+=2; e2+=2; e3+=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// special right case - f is unknown
|
||||||
|
rowColors[0] = *d;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *e;
|
||||||
|
code = ( (*h == *d)<<2 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// top and bottom always known
|
||||||
|
for (y=1; y<(src_height-1); y++) {
|
||||||
|
byte *b;
|
||||||
|
byte *d;
|
||||||
|
byte *e;
|
||||||
|
byte *f;
|
||||||
|
byte *h;
|
||||||
|
|
||||||
|
e0 = &dst[y*dst_width*2];
|
||||||
|
e1 = &dst[y*dst_width*2 + 1];
|
||||||
|
e2 = &dst[y*dst_width*2 + dst_width];
|
||||||
|
e3 = &dst[y*dst_width*2 + dst_width + 1];
|
||||||
|
b = &src[y * src_width - src_width];
|
||||||
|
e = &src[y * src_width];
|
||||||
|
f = &src[y * src_width + 1];
|
||||||
|
h = &src[y * src_width + src_width];
|
||||||
|
|
||||||
|
// special left case - d is unknown
|
||||||
|
rowColors[0] = *e;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *f;
|
||||||
|
code = ( (*b == *f)<<0 | (*f == *h)<<1 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
b++; e++; f++; h++;
|
||||||
|
d = &src[y * src_width]; // (y * src_width - 1) + 1
|
||||||
|
e0+=2; e1+=2; e2+=2; e3+=2;
|
||||||
|
|
||||||
|
// normal case
|
||||||
|
for (x=1; x<(src_width-1); x++) {
|
||||||
|
rowColors[0] = *d;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *f;
|
||||||
|
code = ( (*b == *f)<<0 | (*f == *h)<<1 | (*h == *d)<<2 | (*d == *b)<<3 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
b++; d++; e++; f++; h++;
|
||||||
|
e0+=2; e1+=2; e2+=2; e3+=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// special right case - f is unknown
|
||||||
|
rowColors[0] = *d;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *e;
|
||||||
|
code = ( (*h == *d)<<2 | (*d == *b)<<3 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// special bottom case - h is always unknown
|
||||||
|
{
|
||||||
|
byte *b;
|
||||||
|
byte *d;
|
||||||
|
byte *e;
|
||||||
|
byte *f;
|
||||||
|
|
||||||
|
e0 = &dst[y*dst_width*2];
|
||||||
|
e1 = &dst[y*dst_width*2 + 1];
|
||||||
|
e2 = &dst[y*dst_width*2 + dst_width];
|
||||||
|
e3 = &dst[y*dst_width*2 + dst_width + 1];
|
||||||
|
b = &src[y * src_width - src_width];
|
||||||
|
e = &src[y * src_width];
|
||||||
|
f = &src[y * src_width + 1];
|
||||||
|
|
||||||
|
// special left case - d is unknown
|
||||||
|
rowColors[0] = *e;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *f;
|
||||||
|
code = ( (*b == *f)<<0 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
b++; e++; f++;
|
||||||
|
d = &src[y * src_width]; // (y * src_width - 1) + 1
|
||||||
|
e0+=2; e1+=2; e2+=2; e3+=2;
|
||||||
|
|
||||||
|
// normal case
|
||||||
|
for (x=1; x<(src_width-1); x++) {
|
||||||
|
rowColors[0] = *d;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *f;
|
||||||
|
code = ( (*b == *f)<<0 | (*d == *b)<<3 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
b++; d++; e++; f++;
|
||||||
|
e0+=2; e1+=2; e2+=2; e3+=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// special right case - f is unknown
|
||||||
|
rowColors[0] = *d;
|
||||||
|
rowColors[1] = *e;
|
||||||
|
rowColors[2] = *e;
|
||||||
|
code = ( (*d == *b)<<3 );
|
||||||
|
*e0 = rowColors[lookup_map[0*16+code]];
|
||||||
|
*e1 = rowColors[lookup_map[1*16+code]];
|
||||||
|
*e2 = rowColors[lookup_map[2*16+code]];
|
||||||
|
*e3 = rowColors[lookup_map[3*16+code]];
|
||||||
|
}
|
||||||
|
}
|
34
contrib/other/jumpnbump/filter.h
Executable file
34
contrib/other/jumpnbump/filter.h
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* config.h
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __FILTER_H__
|
||||||
|
#define __FILTER_H__
|
||||||
|
|
||||||
|
void do_scale2x(unsigned char *src,
|
||||||
|
int src_width,
|
||||||
|
int src_height,
|
||||||
|
unsigned char *dst);
|
||||||
|
|
||||||
|
#endif // __FILTER_H__
|
249
contrib/other/jumpnbump/fireworks.c
Executable file
249
contrib/other/jumpnbump/fireworks.c
Executable file
@ -0,0 +1,249 @@
|
|||||||
|
/*
|
||||||
|
* fireworks.c
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
|
extern unsigned int ban_map[17][22];
|
||||||
|
|
||||||
|
void fireworks(void)
|
||||||
|
{
|
||||||
|
char *handle;
|
||||||
|
int c1, c2;
|
||||||
|
int s1, s2, s3;
|
||||||
|
char pal[768];
|
||||||
|
struct {
|
||||||
|
int used, direction, colour;
|
||||||
|
int x, y;
|
||||||
|
int x_add, y_add;
|
||||||
|
int timer;
|
||||||
|
int anim, frame, frame_tick, image;
|
||||||
|
} rabbits[20];
|
||||||
|
struct {
|
||||||
|
int x, y;
|
||||||
|
int old_x, old_y;
|
||||||
|
int col;
|
||||||
|
int back[2];
|
||||||
|
} stars[300];
|
||||||
|
|
||||||
|
register_background(NULL, NULL);
|
||||||
|
|
||||||
|
if ((handle = dat_open("level.pcx")) == 0) {
|
||||||
|
strcpy(main_info.error_str, "Error loading 'level.pcx', aborting...\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
read_pcx(handle, mask_pic, JNB_WIDTH*JNB_HEIGHT, pal);
|
||||||
|
|
||||||
|
memset(mask_pic, 0, JNB_WIDTH*JNB_HEIGHT);
|
||||||
|
register_mask(mask_pic);
|
||||||
|
|
||||||
|
recalculate_gob(&rabbit_gobs, pal);
|
||||||
|
recalculate_gob(&object_gobs, pal);
|
||||||
|
|
||||||
|
memset(ban_map, 0, sizeof(ban_map));
|
||||||
|
|
||||||
|
fillpalette(0, 0, 0);
|
||||||
|
|
||||||
|
draw_begin();
|
||||||
|
|
||||||
|
for (c2 = JNB_HEIGHT - 63; c2 < JNB_HEIGHT; c2++) {
|
||||||
|
clear_lines(0, c2, 1, get_color((c2 - 192) >> 2, pal));
|
||||||
|
clear_lines(1, c2, 1, get_color((c2 - 192) >> 2, pal));
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_end();
|
||||||
|
|
||||||
|
setpalette(0, 256, pal);
|
||||||
|
|
||||||
|
for (c1 = 0; c1 < 20; c1++)
|
||||||
|
rabbits[c1].used = 0;
|
||||||
|
|
||||||
|
rabbits[0].used = 1;
|
||||||
|
rabbits[0].colour = rnd(4);
|
||||||
|
rabbits[0].x = (int) (150 + rnd(100)) << 16;
|
||||||
|
rabbits[0].y = 256 << 16;
|
||||||
|
rabbits[0].x_add = ((int) rnd(65535) << 1) - 65536;
|
||||||
|
if (rabbits[0].x_add > 0)
|
||||||
|
rabbits[0].direction = 0;
|
||||||
|
else
|
||||||
|
rabbits[0].direction = 1;
|
||||||
|
rabbits[0].y_add = -262144 + (rnd(16384) * 5);
|
||||||
|
rabbits[0].timer = 30 + rnd(150);
|
||||||
|
rabbits[0].anim = 2;
|
||||||
|
rabbits[0].frame = 0;
|
||||||
|
rabbits[0].frame_tick = 0;
|
||||||
|
rabbits[0].image = player_anims[rabbits[0].anim].frame[rabbits[0].frame].image + rabbits[0].colour * 18 + rabbits[0].direction * 9;
|
||||||
|
|
||||||
|
draw_begin();
|
||||||
|
for (c1 = 0; c1 < 300; c1++) {
|
||||||
|
s1 = rnd(JNB_WIDTH);
|
||||||
|
s2 = rnd(JNB_HEIGHT);
|
||||||
|
s3 = 30 - rnd(7);
|
||||||
|
stars[c1].x = stars[c1].old_x = (s1 << 16);
|
||||||
|
stars[c1].y = stars[c1].old_y = (s2 << 16);
|
||||||
|
stars[c1].col = s3;
|
||||||
|
stars[c1].back[0] = stars[c1].back[1] = get_pixel(0, s1, s2);
|
||||||
|
}
|
||||||
|
draw_end();
|
||||||
|
|
||||||
|
dj_set_nosound(0);
|
||||||
|
|
||||||
|
main_info.page_info[0].num_pobs = 0;
|
||||||
|
main_info.page_info[1].num_pobs = 0;
|
||||||
|
main_info.view_page = 0;
|
||||||
|
main_info.draw_page = 1;
|
||||||
|
|
||||||
|
while (key_pressed(1) == 0) {
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
intr_sysupdate();
|
||||||
|
|
||||||
|
for (c1 = 0; c1 < 300; c1++) {
|
||||||
|
stars[c1].old_x = stars[c1].x;
|
||||||
|
stars[c1].old_y = stars[c1].y;
|
||||||
|
stars[c1].y -= (int) (31 - stars[c1].col) * 16384;
|
||||||
|
if ((stars[c1].y >> 16) < 0)
|
||||||
|
stars[c1].y += JNB_HEIGHT << 16;
|
||||||
|
if ((stars[c1].y >> 16) >= JNB_HEIGHT)
|
||||||
|
stars[c1].y -= JNB_HEIGHT << 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (c1 = 0, c2 = 0; c1 < 20; c1++) {
|
||||||
|
if (rabbits[c1].used == 1)
|
||||||
|
c2++;
|
||||||
|
}
|
||||||
|
if ((c2 == 0 && rnd(10000) < 200) || (c2 == 1 && rnd(10000) < 150) || (c2 == 2 && rnd(10000) < 100) || (c2 == 3 && rnd(10000) < 50)) {
|
||||||
|
for (c1 = 0; c1 < 20; c1++) {
|
||||||
|
if (rabbits[c1].used == 0) {
|
||||||
|
rabbits[c1].used = 1;
|
||||||
|
rabbits[c1].colour = rnd(4);
|
||||||
|
rabbits[c1].x = (int) (150 + rnd(100)) << 16;
|
||||||
|
rabbits[c1].y = 256 << 16;
|
||||||
|
rabbits[c1].x_add = ((int) rnd(65535) << 1) - 65536;
|
||||||
|
if (rabbits[c1].x_add > 0)
|
||||||
|
rabbits[c1].direction = 0;
|
||||||
|
else
|
||||||
|
rabbits[c1].direction = 1;
|
||||||
|
rabbits[c1].y_add = -262144 + (rnd(16384) * 5);
|
||||||
|
rabbits[c1].timer = 30 + rnd(150);
|
||||||
|
rabbits[c1].anim = 2;
|
||||||
|
rabbits[c1].frame = 0;
|
||||||
|
rabbits[c1].frame_tick = 0;
|
||||||
|
rabbits[c1].image = player_anims[rabbits[c1].anim].frame[rabbits[c1].frame].image + rabbits[c1].colour * 18 + rabbits[c1].direction * 9;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
|
||||||
|
main_info.page_info[main_info.draw_page].num_pobs = 0;
|
||||||
|
|
||||||
|
for (c1 = 0; c1 < 20; c1++) {
|
||||||
|
if (rabbits[c1].used == 1) {
|
||||||
|
rabbits[c1].y_add += 2048;
|
||||||
|
if (rabbits[c1].y_add > 36864 && rabbits[c1].anim != 3) {
|
||||||
|
rabbits[c1].anim = 3;
|
||||||
|
rabbits[c1].frame = 0;
|
||||||
|
rabbits[c1].frame_tick = 0;
|
||||||
|
rabbits[c1].image = player_anims[rabbits[c1].anim].frame[rabbits[c1].frame].image + rabbits[c1].colour * 18 + rabbits[c1].direction * 9;
|
||||||
|
}
|
||||||
|
rabbits[c1].x += rabbits[c1].x_add;
|
||||||
|
rabbits[c1].y += rabbits[c1].y_add;
|
||||||
|
if ((rabbits[c1].x >> 16) < 16 || (rabbits[c1].x >> 16) > JNB_WIDTH || (rabbits[c1].y >> 16) > JNB_HEIGHT) {
|
||||||
|
rabbits[c1].used = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rabbits[c1].timer--;
|
||||||
|
if (rabbits[c1].timer <= 0) {
|
||||||
|
rabbits[c1].used = 0;
|
||||||
|
for (c2 = 0; c2 < 6; c2++)
|
||||||
|
add_object(OBJ_FUR, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 44 + rabbits[c1].colour * 8);
|
||||||
|
for (c2 = 0; c2 < 6; c2++)
|
||||||
|
add_object(OBJ_FLESH, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 76);
|
||||||
|
for (c2 = 0; c2 < 6; c2++)
|
||||||
|
add_object(OBJ_FLESH, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 77);
|
||||||
|
for (c2 = 0; c2 < 8; c2++)
|
||||||
|
add_object(OBJ_FLESH, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 78);
|
||||||
|
for (c2 = 0; c2 < 10; c2++)
|
||||||
|
add_object(OBJ_FLESH, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 79);
|
||||||
|
dj_play_sfx(SFX_DEATH, SFX_DEATH_FREQ, 64, 0, 0, -1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rabbits[c1].frame_tick++;
|
||||||
|
if (rabbits[c1].frame_tick >= player_anims[rabbits[c1].anim].frame[rabbits[c1].frame].ticks) {
|
||||||
|
rabbits[c1].frame++;
|
||||||
|
if (rabbits[c1].frame >= player_anims[rabbits[c1].anim].num_frames)
|
||||||
|
rabbits[c1].frame = player_anims[rabbits[c1].anim].restart_frame;
|
||||||
|
rabbits[c1].frame_tick = 0;
|
||||||
|
}
|
||||||
|
rabbits[c1].image = player_anims[rabbits[c1].anim].frame[rabbits[c1].frame].image + rabbits[c1].colour * 18 + rabbits[c1].direction * 9;
|
||||||
|
if (rabbits[c1].used == 1)
|
||||||
|
add_pob(main_info.draw_page, rabbits[c1].x >> 16, rabbits[c1].y >> 16, rabbits[c1].image, &rabbit_gobs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
|
||||||
|
update_objects();
|
||||||
|
|
||||||
|
draw_begin();
|
||||||
|
|
||||||
|
for (c1 = 0; c1 < 300; c1++) {
|
||||||
|
stars[c1].back[main_info.draw_page] = get_pixel(main_info.draw_page, stars[c1].x >> 16, stars[c1].y >> 16);
|
||||||
|
set_pixel(main_info.draw_page, stars[c1].x >> 16, stars[c1].y >> 16, get_color(stars[c1].col, pal));
|
||||||
|
}
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
|
||||||
|
draw_pobs(main_info.draw_page);
|
||||||
|
|
||||||
|
draw_end();
|
||||||
|
|
||||||
|
main_info.draw_page ^= 1;
|
||||||
|
main_info.view_page ^= 1;
|
||||||
|
|
||||||
|
flippage(main_info.view_page);
|
||||||
|
|
||||||
|
wait_vrt(1);
|
||||||
|
|
||||||
|
draw_begin();
|
||||||
|
|
||||||
|
redraw_pob_backgrounds(main_info.draw_page);
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
intr_sysupdate();
|
||||||
|
|
||||||
|
for (c1 = 299; c1 >= 0; c1--) {
|
||||||
|
set_pixel(main_info.draw_page, stars[c1].old_x >> 16, stars[c1].old_y >> 16, stars[c1].back[main_info.draw_page]);
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_end();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dj_set_nosound(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
369
contrib/other/jumpnbump/globals.h
Executable file
369
contrib/other/jumpnbump/globals.h
Executable file
@ -0,0 +1,369 @@
|
|||||||
|
/*
|
||||||
|
* globals.h
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GLOBALS_H
|
||||||
|
#define __GLOBALS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#include <strings.h>
|
||||||
|
#endif
|
||||||
|
#include <time.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <dj.h>
|
||||||
|
|
||||||
|
#ifdef DOS
|
||||||
|
# include <conio.h>
|
||||||
|
# include <dpmi.h>
|
||||||
|
# include <sys/nearptr.h>
|
||||||
|
# include <pc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# include <windows.h>
|
||||||
|
# include <sys/stat.h>
|
||||||
|
# include <io.h>
|
||||||
|
# include "SDL.h"
|
||||||
|
# if USE_SDL_MIXER
|
||||||
|
# include "SDL_mixer.h"
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifdef USE_SDL
|
||||||
|
# include <sys/stat.h>
|
||||||
|
# include "SDL.h"
|
||||||
|
# if USE_SDL_MIXER
|
||||||
|
# include "SDL_mixer.h"
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define JNB_MAX_PLAYERS 4
|
||||||
|
|
||||||
|
#define JNB_INETPORT 11111
|
||||||
|
|
||||||
|
extern int client_player_num;
|
||||||
|
void tellServerPlayerMoved(int playerid, int movement_type, int newval);
|
||||||
|
#define MOVEMENT_LEFT 1
|
||||||
|
#define MOVEMENT_RIGHT 2
|
||||||
|
#define MOVEMENT_UP 3
|
||||||
|
|
||||||
|
#define JNB_VERSION "1.51"
|
||||||
|
|
||||||
|
#define JNB_WIDTH 400
|
||||||
|
#define JNB_HEIGHT 256
|
||||||
|
|
||||||
|
extern int screen_width;
|
||||||
|
extern int screen_height;
|
||||||
|
extern int screen_pitch;
|
||||||
|
extern int scale_up;
|
||||||
|
|
||||||
|
extern int ai[JNB_MAX_PLAYERS];
|
||||||
|
|
||||||
|
#ifndef USE_SDL
|
||||||
|
#define KEY_PL1_LEFT 0xcb
|
||||||
|
#define KEY_PL1_RIGHT 0xcd
|
||||||
|
#define KEY_PL1_JUMP 0xc8
|
||||||
|
#define KEY_PL2_LEFT 0x1e
|
||||||
|
#define KEY_PL2_RIGHT 0x20
|
||||||
|
#define KEY_PL2_JUMP 0x11
|
||||||
|
#else
|
||||||
|
#define KEY_PL1_LEFT SDLK_LEFT
|
||||||
|
#define KEY_PL1_RIGHT SDLK_RIGHT
|
||||||
|
#define KEY_PL1_JUMP SDLK_UP
|
||||||
|
#define KEY_PL2_LEFT SDLK_a
|
||||||
|
#define KEY_PL2_RIGHT SDLK_d
|
||||||
|
#define KEY_PL2_JUMP SDLK_w
|
||||||
|
#define KEY_PL3_LEFT SDLK_j
|
||||||
|
#define KEY_PL3_RIGHT SDLK_l
|
||||||
|
#define KEY_PL3_JUMP SDLK_i
|
||||||
|
#define KEY_PL4_LEFT SDLK_KP4
|
||||||
|
#define KEY_PL4_RIGHT SDLK_KP6
|
||||||
|
#define KEY_PL4_JUMP SDLK_KP8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NUM_POBS 200
|
||||||
|
#define NUM_OBJECTS 200
|
||||||
|
#define NUM_FLIES 20
|
||||||
|
#define NUM_LEFTOVERS 50
|
||||||
|
|
||||||
|
#define OBJ_SPRING 0
|
||||||
|
#define OBJ_SPLASH 1
|
||||||
|
#define OBJ_SMOKE 2
|
||||||
|
#define OBJ_YEL_BUTFLY 3
|
||||||
|
#define OBJ_PINK_BUTFLY 4
|
||||||
|
#define OBJ_FUR 5
|
||||||
|
#define OBJ_FLESH 6
|
||||||
|
#define OBJ_FLESH_TRACE 7
|
||||||
|
|
||||||
|
#define OBJ_ANIM_SPRING 0
|
||||||
|
#define OBJ_ANIM_SPLASH 1
|
||||||
|
#define OBJ_ANIM_SMOKE 2
|
||||||
|
#define OBJ_ANIM_YEL_BUTFLY_RIGHT 3
|
||||||
|
#define OBJ_ANIM_YEL_BUTFLY_LEFT 4
|
||||||
|
#define OBJ_ANIM_PINK_BUTFLY_RIGHT 5
|
||||||
|
#define OBJ_ANIM_PINK_BUTFLY_LEFT 6
|
||||||
|
#define OBJ_ANIM_FLESH_TRACE 7
|
||||||
|
|
||||||
|
#define MOD_MENU 0
|
||||||
|
#define MOD_GAME 1
|
||||||
|
#define MOD_SCORES 2
|
||||||
|
|
||||||
|
#define SFX_JUMP 0
|
||||||
|
#define SFX_LAND 1
|
||||||
|
#define SFX_DEATH 2
|
||||||
|
#define SFX_SPRING 3
|
||||||
|
#define SFX_SPLASH 4
|
||||||
|
#define SFX_FLY 5
|
||||||
|
|
||||||
|
#define NUM_SFX 6
|
||||||
|
|
||||||
|
#define SFX_JUMP_FREQ 15000
|
||||||
|
#define SFX_LAND_FREQ 15000
|
||||||
|
#define SFX_DEATH_FREQ 20000
|
||||||
|
#define SFX_SPRING_FREQ 15000
|
||||||
|
#define SFX_SPLASH_FREQ 12000
|
||||||
|
#define SFX_FLY_FREQ 12000
|
||||||
|
|
||||||
|
#define BAN_VOID 0
|
||||||
|
#define BAN_SOLID 1
|
||||||
|
#define BAN_WATER 2
|
||||||
|
#define BAN_ICE 3
|
||||||
|
#define BAN_SPRING 4
|
||||||
|
|
||||||
|
#ifndef DATA_PATH
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define DATA_PATH "data/jumpbump.dat"
|
||||||
|
#elif _WIN32
|
||||||
|
#define DATA_PATH "data/jumpbump.dat"
|
||||||
|
#else
|
||||||
|
#define DATA_PATH "jumpbump.dat"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int num_images;
|
||||||
|
int *width;
|
||||||
|
int *height;
|
||||||
|
int *hs_x;
|
||||||
|
int *hs_y;
|
||||||
|
void **data;
|
||||||
|
void **orig_data;
|
||||||
|
} gob_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int joy_enabled, mouse_enabled;
|
||||||
|
int no_sound, music_no_sound, no_gore, fireworks;
|
||||||
|
char error_str[256];
|
||||||
|
int draw_page, view_page;
|
||||||
|
struct {
|
||||||
|
int num_pobs;
|
||||||
|
struct {
|
||||||
|
int x, y;
|
||||||
|
int image;
|
||||||
|
gob_t *pob_data;
|
||||||
|
int back_buf_ofs;
|
||||||
|
} pobs[NUM_POBS];
|
||||||
|
} page_info[2];
|
||||||
|
void *pob_backbuf[2];
|
||||||
|
} main_info_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int action_left,action_up,action_right;
|
||||||
|
int enabled, dead_flag;
|
||||||
|
int bumps;
|
||||||
|
int bumped[JNB_MAX_PLAYERS];
|
||||||
|
int x, y;
|
||||||
|
int x_add, y_add;
|
||||||
|
int direction, jump_ready, jump_abort, in_water;
|
||||||
|
int anim, frame, frame_tick, image;
|
||||||
|
} player_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int num_frames;
|
||||||
|
int restart_frame;
|
||||||
|
struct {
|
||||||
|
int image;
|
||||||
|
int ticks;
|
||||||
|
} frame[4];
|
||||||
|
} player_anim_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int used, type;
|
||||||
|
int x, y;
|
||||||
|
int x_add, y_add;
|
||||||
|
int x_acc, y_acc;
|
||||||
|
int anim;
|
||||||
|
int frame, ticks;
|
||||||
|
int image;
|
||||||
|
} object_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x, y;
|
||||||
|
int raw_x, raw_y;
|
||||||
|
int but1, but2;
|
||||||
|
struct {
|
||||||
|
int x1, x2, x3;
|
||||||
|
int y1, y2, y3;
|
||||||
|
} calib_data;
|
||||||
|
} joy_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int but1, but2, but3;
|
||||||
|
} mouse_t;
|
||||||
|
|
||||||
|
extern main_info_t main_info;
|
||||||
|
extern player_t player[JNB_MAX_PLAYERS];
|
||||||
|
extern player_anim_t player_anims[7];
|
||||||
|
extern object_t objects[NUM_OBJECTS];
|
||||||
|
extern joy_t joy;
|
||||||
|
extern mouse_t mouse;
|
||||||
|
|
||||||
|
extern char datfile_name[2048];
|
||||||
|
|
||||||
|
extern char *background_pic;
|
||||||
|
extern char *mask_pic;
|
||||||
|
|
||||||
|
extern gob_t rabbit_gobs;
|
||||||
|
extern gob_t font_gobs;
|
||||||
|
extern gob_t object_gobs;
|
||||||
|
extern gob_t number_gobs;
|
||||||
|
|
||||||
|
|
||||||
|
/* fireworks.c */
|
||||||
|
|
||||||
|
void fireworks(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* main.c */
|
||||||
|
|
||||||
|
void steer_players(void);
|
||||||
|
void position_player(int player_num);
|
||||||
|
void fireworks(void);
|
||||||
|
void add_object(int type, int x, int y, int x_add, int y_add, int anim, int frame);
|
||||||
|
void update_objects(void);
|
||||||
|
int add_pob(int page, int x, int y, int image, gob_t *pob_data);
|
||||||
|
void draw_flies(int page);
|
||||||
|
void draw_pobs(int page);
|
||||||
|
void redraw_flies_background(int page);
|
||||||
|
void redraw_pob_backgrounds(int page);
|
||||||
|
int add_leftovers(int page, int x, int y, int image, gob_t *pob_data);
|
||||||
|
void draw_leftovers(int page);
|
||||||
|
int init_level(int level, char *pal);
|
||||||
|
void deinit_level(void);
|
||||||
|
int init_program(int argc, char *argv[], char *pal);
|
||||||
|
void deinit_program(void);
|
||||||
|
unsigned short rnd(unsigned short max);
|
||||||
|
int read_level(void);
|
||||||
|
unsigned char *dat_open(char *file_name);
|
||||||
|
int dat_filelen(char *file_name);
|
||||||
|
void write_calib_data(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* input.c */
|
||||||
|
|
||||||
|
void update_player_actions(void);
|
||||||
|
void init_inputs(void);
|
||||||
|
int calib_joy(int type);
|
||||||
|
|
||||||
|
/* menu.c */
|
||||||
|
|
||||||
|
int menu(void);
|
||||||
|
int menu_init(void);
|
||||||
|
void menu_deinit(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* gfx.c */
|
||||||
|
|
||||||
|
void set_scaling(int scale);
|
||||||
|
void open_screen(void);
|
||||||
|
void wait_vrt(int mix);
|
||||||
|
void draw_begin(void);
|
||||||
|
void draw_end(void);
|
||||||
|
void flippage(int page);
|
||||||
|
void draw_begin(void);
|
||||||
|
void draw_end(void);
|
||||||
|
void clear_lines(int page, int y, int count, int color);
|
||||||
|
int get_color(int color, char pal[768]);
|
||||||
|
int get_pixel(int page, int x, int y);
|
||||||
|
void set_pixel(int page, int x, int y, int color);
|
||||||
|
void setpalette(int index, int count, char *palette);
|
||||||
|
void fillpalette(int red, int green, int blue);
|
||||||
|
#ifdef DOS
|
||||||
|
void get_block(char page, short x, short y, short width, short height, char *buffer);
|
||||||
|
void put_block(char page, short x, short y, short width, short height, char *buffer);
|
||||||
|
#else
|
||||||
|
void get_block(int page, int x, int y, int width, int height, void *buffer);
|
||||||
|
void put_block(int page, int x, int y, int width, int height, void *buffer);
|
||||||
|
#endif
|
||||||
|
void put_text(int page, int x, int y, char *text, int align);
|
||||||
|
void put_pob(int page, int x, int y, int image, gob_t *gob, int mask, void *mask_pic);
|
||||||
|
int pob_width(int image, gob_t *gob);
|
||||||
|
int pob_height(int image, gob_t *gob);
|
||||||
|
int pob_hs_x(int image, gob_t *gob);
|
||||||
|
int pob_hs_y(int image, gob_t *gob);
|
||||||
|
int read_pcx(unsigned char * handle, void *buffer, int buf_len, char *pal);
|
||||||
|
void register_background(char *pixels, char pal[768]);
|
||||||
|
int register_gob(unsigned char *handle, gob_t *gob, int len);
|
||||||
|
void recalculate_gob(gob_t *gob, char pal[768]);
|
||||||
|
void register_mask(void *pixels);
|
||||||
|
|
||||||
|
/* gfx.c */
|
||||||
|
|
||||||
|
#ifdef USE_SDL
|
||||||
|
/* long filelength(int handle); */
|
||||||
|
void fs_toggle();
|
||||||
|
int intr_sysupdate();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* interrpt.c */
|
||||||
|
|
||||||
|
extern char last_keys[50];
|
||||||
|
|
||||||
|
int hook_keyb_handler(void);
|
||||||
|
void remove_keyb_handler(void);
|
||||||
|
int key_pressed(int key);
|
||||||
|
int addkey(unsigned int key);
|
||||||
|
|
||||||
|
/* sound-linux.c */
|
||||||
|
#ifdef LINUX
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
3590
contrib/other/jumpnbump/main.c
Executable file
3590
contrib/other/jumpnbump/main.c
Executable file
File diff suppressed because it is too large
Load Diff
637
contrib/other/jumpnbump/menu.c
Executable file
637
contrib/other/jumpnbump/menu.c
Executable file
@ -0,0 +1,637 @@
|
|||||||
|
/*
|
||||||
|
* menu.c
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
|
char *menu_background;
|
||||||
|
|
||||||
|
char menu_pal[768];
|
||||||
|
char menu_cur_pal[768];
|
||||||
|
|
||||||
|
char *message[] = {
|
||||||
|
"Jump 'n Bump "JNB_VERSION,
|
||||||
|
"by Brainchild Design in 1998.",
|
||||||
|
"Code by Mattias Brynervall.",
|
||||||
|
"Graphics by Martin Magnusson",
|
||||||
|
"and Andreas Brynervall.",
|
||||||
|
"Music by Anders Nilsson.",
|
||||||
|
"Linux port by Chuck Mason.",
|
||||||
|
"New SDL port by Florian Schulze.",
|
||||||
|
"http://www.icculus.org/jumpnbump/",
|
||||||
|
"Ryan C. Gordon made networking possible again!",
|
||||||
|
"Visit our homepage at:",
|
||||||
|
"http://www.algonet.se/~mattiasb",
|
||||||
|
"Jump 'n Bump is e-mailware.",
|
||||||
|
"That means you're supposed to send us an e-mail!",
|
||||||
|
"Write for example where you're from",
|
||||||
|
"and what you thought about this game.",
|
||||||
|
"If you do that, you will greatly encourage us",
|
||||||
|
"to make more games for you!",
|
||||||
|
"Send your e-mail to: matbr656@student.liu.se",
|
||||||
|
"Oh, and by the way, there're a lot of secrets!",
|
||||||
|
"If you can't find them, you'd better ask us...",
|
||||||
|
"If you'd like to contact a specific member of BCD,",
|
||||||
|
"these are their e-mail addresses:",
|
||||||
|
"Andreas Brynervall: andreasb@acc.umu.se",
|
||||||
|
"Mattias Brynervall: matbr656@student.liu.se",
|
||||||
|
"Martin Magnusson: marma102@student.liu.se",
|
||||||
|
"Anders Nilsson: equel@swipnet.se",
|
||||||
|
""
|
||||||
|
};
|
||||||
|
|
||||||
|
#define NUM_MESSAGES (sizeof(message)/sizeof(char *))
|
||||||
|
|
||||||
|
int menu(void)
|
||||||
|
{
|
||||||
|
int c1;
|
||||||
|
int esc_pressed;
|
||||||
|
int end_loop_flag, new_game_flag, fade_flag;
|
||||||
|
int mod_vol = 0, mod_fade_direction = 0;
|
||||||
|
int cur_message;
|
||||||
|
int fade_dir, fade_count, fade_tick;
|
||||||
|
char fade_pal[48];
|
||||||
|
int update_count;
|
||||||
|
|
||||||
|
if (menu_init() != 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* After a game, we have to release the keys, cause AI player
|
||||||
|
can still be using them */
|
||||||
|
addkey((KEY_PL1_LEFT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL2_LEFT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL3_LEFT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL4_LEFT & 0x7f) | 0x8000);
|
||||||
|
|
||||||
|
addkey((KEY_PL1_RIGHT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL2_RIGHT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL3_RIGHT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL4_RIGHT & 0x7f) | 0x8000);
|
||||||
|
|
||||||
|
addkey((KEY_PL1_JUMP & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL2_JUMP & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL3_JUMP & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL4_JUMP & 0x7f) | 0x8000);
|
||||||
|
|
||||||
|
mod_vol = 0;
|
||||||
|
mod_fade_direction = 1;
|
||||||
|
dj_ready_mod(MOD_MENU);
|
||||||
|
dj_set_mod_volume((char)mod_vol);
|
||||||
|
dj_set_sfx_volume(64);
|
||||||
|
dj_start_mod();
|
||||||
|
dj_set_nosound(0);
|
||||||
|
|
||||||
|
memset(fade_pal, 0, 48);
|
||||||
|
setpalette(240, 16, fade_pal);
|
||||||
|
|
||||||
|
fade_dir = 0;
|
||||||
|
fade_count = 0;
|
||||||
|
fade_tick = 0;
|
||||||
|
cur_message = NUM_MESSAGES - 1;
|
||||||
|
|
||||||
|
main_info.page_info[0].num_pobs = 0;
|
||||||
|
main_info.page_info[1].num_pobs = 0;
|
||||||
|
main_info.view_page = 0;
|
||||||
|
main_info.draw_page = 1;
|
||||||
|
|
||||||
|
esc_pressed = key_pressed(1);
|
||||||
|
end_loop_flag = new_game_flag = 0;
|
||||||
|
|
||||||
|
update_count = 1;
|
||||||
|
while (1) {
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
|
||||||
|
for(c1 = 0; c1 < JNB_MAX_PLAYERS; c1++) // set AI to false
|
||||||
|
ai[c1] = 0;
|
||||||
|
|
||||||
|
while (update_count) {
|
||||||
|
|
||||||
|
if (key_pressed(1) == 1 && esc_pressed == 0) {
|
||||||
|
end_loop_flag = 1;
|
||||||
|
new_game_flag = 0;
|
||||||
|
memset(menu_pal, 0, 768);
|
||||||
|
mod_fade_direction = 0;
|
||||||
|
} else if (key_pressed(1) == 0)
|
||||||
|
esc_pressed = 0;
|
||||||
|
|
||||||
|
update_player_actions();
|
||||||
|
for (c1 = 0; c1 < JNB_MAX_PLAYERS; c1++) {
|
||||||
|
if (end_loop_flag == 1 && new_game_flag == 1) {
|
||||||
|
if ((player[c1].x >> 16) > (165 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add < 0)
|
||||||
|
player[c1].x_add += 16384;
|
||||||
|
else
|
||||||
|
player[c1].x_add += 12288;
|
||||||
|
if (player[c1].x_add > 98304L)
|
||||||
|
player[c1].x_add = 98304L;
|
||||||
|
player[c1].direction = 0;
|
||||||
|
if (player[c1].anim == 0) {
|
||||||
|
player[c1].anim = 1;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
player[c1].enabled = 1;
|
||||||
|
}
|
||||||
|
if (!player[c1].action_up) {
|
||||||
|
if (player[c1].y_add < 0) {
|
||||||
|
player[c1].y_add += 32768;
|
||||||
|
if (player[c1].y_add > 0)
|
||||||
|
player[c1].y_add = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player[c1].y_add += 12288;
|
||||||
|
if (player[c1].y_add > 36864 && player[c1].anim != 3) {
|
||||||
|
player[c1].anim = 3;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
player[c1].y += player[c1].y_add;
|
||||||
|
if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) {
|
||||||
|
if ((player[c1].y >> 16) > (160 + c1 * 2)) {
|
||||||
|
player[c1].y = (160L + c1 * 2) << 16;
|
||||||
|
player[c1].y_add = 0;
|
||||||
|
if (player[c1].anim != 0 && player[c1].anim != 1) {
|
||||||
|
player[c1].anim = 0;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((player[c1].y >> 16) > (138 + c1 * 2)) {
|
||||||
|
player[c1].y = (138L + c1 * 2) << 16;
|
||||||
|
player[c1].y_add = 0;
|
||||||
|
if (player[c1].anim != 0 && player[c1].anim != 1) {
|
||||||
|
player[c1].anim = 0;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
if (!player[c1].action_up)
|
||||||
|
player[c1].jump_ready = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player[c1].x += player[c1].x_add;
|
||||||
|
if ((player[c1].y >> 16) > (138 + c1 * 2)) {
|
||||||
|
if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (190 + c1 * 2)) {
|
||||||
|
player[c1].x = (165L + c1 * 2) << 16;
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
}
|
||||||
|
if ((player[c1].x >> 16) > (190 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) {
|
||||||
|
player[c1].x = (208L + c1 * 2) << 16;
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (player[c1].action_left && player[c1].action_right) {
|
||||||
|
if (player[c1].direction == 1) {
|
||||||
|
if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add > 0) {
|
||||||
|
player[c1].x_add -= 16384;
|
||||||
|
if ((player[c1].y >> 16) >= (160 + c1 * 2))
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else
|
||||||
|
player[c1].x_add -= 12288;
|
||||||
|
}
|
||||||
|
if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add > 0) {
|
||||||
|
player[c1].x_add -= 16384;
|
||||||
|
if ((player[c1].y >> 16) >= (138 + c1 * 2))
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else
|
||||||
|
player[c1].x_add -= 12288;
|
||||||
|
}
|
||||||
|
if (player[c1].x_add < -98304L)
|
||||||
|
player[c1].x_add = -98304L;
|
||||||
|
player[c1].direction = 1;
|
||||||
|
if (player[c1].anim == 0) {
|
||||||
|
player[c1].anim = 1;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add < 0) {
|
||||||
|
player[c1].x_add += 16384;
|
||||||
|
if ((player[c1].y >> 16) >= (160 + c1 * 2))
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else
|
||||||
|
player[c1].x_add += 12288;
|
||||||
|
}
|
||||||
|
if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add < 0) {
|
||||||
|
player[c1].x_add += 16384;
|
||||||
|
if ((player[c1].y >> 16) >= (138 + c1 * 2))
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else
|
||||||
|
player[c1].x_add += 12288;
|
||||||
|
}
|
||||||
|
if (player[c1].x_add > 98304L)
|
||||||
|
player[c1].x_add = 98304L;
|
||||||
|
player[c1].direction = 0;
|
||||||
|
if (player[c1].anim == 0) {
|
||||||
|
player[c1].anim = 1;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (player[c1].action_left) {
|
||||||
|
if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add > 0) {
|
||||||
|
player[c1].x_add -= 16384;
|
||||||
|
if ((player[c1].y >> 16) >= (160 + c1 * 2))
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else
|
||||||
|
player[c1].x_add -= 12288;
|
||||||
|
}
|
||||||
|
if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add > 0) {
|
||||||
|
player[c1].x_add -= 16384;
|
||||||
|
if ((player[c1].y >> 16) >= (138 + c1 * 2))
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else
|
||||||
|
player[c1].x_add -= 12288;
|
||||||
|
}
|
||||||
|
if (player[c1].x_add < -98304L)
|
||||||
|
player[c1].x_add = -98304L;
|
||||||
|
player[c1].direction = 1;
|
||||||
|
if (player[c1].anim == 0) {
|
||||||
|
player[c1].anim = 1;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
} else if (player[c1].action_right) {
|
||||||
|
if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add < 0) {
|
||||||
|
player[c1].x_add += 16384;
|
||||||
|
if ((player[c1].y >> 16) >= (160 + c1 * 2))
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else
|
||||||
|
player[c1].x_add += 12288;
|
||||||
|
}
|
||||||
|
if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add < 0) {
|
||||||
|
player[c1].x_add += 16384;
|
||||||
|
if ((player[c1].y >> 16) >= (138 + c1 * 2))
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else
|
||||||
|
player[c1].x_add += 12288;
|
||||||
|
}
|
||||||
|
if (player[c1].x_add > 98304L)
|
||||||
|
player[c1].x_add = 98304L;
|
||||||
|
player[c1].direction = 0;
|
||||||
|
if (player[c1].anim == 0) {
|
||||||
|
player[c1].anim = 1;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) && (player[c1].y >> 16) >= (160 + c1 * 2)) {
|
||||||
|
if (player[c1].x_add < 0) {
|
||||||
|
player[c1].x_add += 16384;
|
||||||
|
if (player[c1].x_add > 0)
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else if (player[c1].x_add > 0) {
|
||||||
|
player[c1].x_add -= 16384;
|
||||||
|
if (player[c1].x_add < 0)
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) && (player[c1].y >> 16) >= (138 + c1 * 2))) {
|
||||||
|
if (player[c1].x_add < 0) {
|
||||||
|
player[c1].x_add += 16384;
|
||||||
|
if (player[c1].x_add > 0)
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
} else if (player[c1].x_add > 0) {
|
||||||
|
player[c1].x_add -= 16384;
|
||||||
|
if (player[c1].x_add < 0)
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player[c1].anim == 1) {
|
||||||
|
player[c1].anim = 0;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((player[c1].jump_ready == 1) && player[c1].action_up) {
|
||||||
|
if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) {
|
||||||
|
if ((player[c1].y >> 16) >= (160 + c1 * 2)) {
|
||||||
|
player[c1].y_add = -280000L;
|
||||||
|
player[c1].anim = 2;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
player[c1].jump_ready = 0;
|
||||||
|
dj_play_sfx(SFX_JUMP, (unsigned short)(SFX_JUMP_FREQ + rnd(2000) - 1000), 64, 0, 0, -1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((player[c1].y >> 16) >= (138 + c1 * 2)) {
|
||||||
|
player[c1].y_add = -280000L;
|
||||||
|
player[c1].anim = 2;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
player[c1].jump_ready = 0;
|
||||||
|
dj_play_sfx(SFX_JUMP, (unsigned short)(SFX_JUMP_FREQ + rnd(2000) - 1000), 64, 0, 0, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!player[c1].action_up) {
|
||||||
|
if (player[c1].y_add < 0) {
|
||||||
|
player[c1].y_add += 32768;
|
||||||
|
if (player[c1].y_add > 0)
|
||||||
|
player[c1].y_add = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!player[c1].action_up)
|
||||||
|
player[c1].jump_ready = 1;
|
||||||
|
player[c1].y_add += 12288;
|
||||||
|
if (player[c1].y_add > 36864 && player[c1].anim != 3) {
|
||||||
|
player[c1].anim = 3;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
player[c1].y += player[c1].y_add;
|
||||||
|
if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) {
|
||||||
|
if ((player[c1].y >> 16) > (160 + c1 * 2)) {
|
||||||
|
player[c1].y = (160L + c1 * 2) << 16;
|
||||||
|
player[c1].y_add = 0;
|
||||||
|
if (player[c1].anim != 0 && player[c1].anim != 1) {
|
||||||
|
player[c1].anim = 0;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((player[c1].y >> 16) > (138 + c1 * 2)) {
|
||||||
|
player[c1].y = (138L + c1 * 2) << 16;
|
||||||
|
player[c1].y_add = 0;
|
||||||
|
if (player[c1].anim != 0 && player[c1].anim != 1) {
|
||||||
|
player[c1].anim = 0;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player[c1].x += player[c1].x_add;
|
||||||
|
if ((player[c1].x >> 16) < 0) {
|
||||||
|
player[c1].x = 0;
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
}
|
||||||
|
if ((player[c1].x >> 16) > JNB_WIDTH) {
|
||||||
|
end_loop_flag = 1;
|
||||||
|
new_game_flag = 1;
|
||||||
|
memset(menu_pal, 0, 768);
|
||||||
|
mod_fade_direction = 0;
|
||||||
|
}
|
||||||
|
if ((player[c1].y >> 16) > (138 + c1 * 2)) {
|
||||||
|
if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (190 + c1 * 2)) {
|
||||||
|
player[c1].x = (165L + c1 * 2) << 16;
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
}
|
||||||
|
if ((player[c1].x >> 16) > (190 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) {
|
||||||
|
player[c1].x = (208L + c1 * 2) << 16;
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player[c1].frame_tick++;
|
||||||
|
if (player[c1].frame_tick >= player_anims[player[c1].anim].frame[player[c1].frame].ticks) {
|
||||||
|
player[c1].frame++;
|
||||||
|
if (player[c1].frame >= player_anims[player[c1].anim].num_frames)
|
||||||
|
player[c1].frame = player_anims[player[c1].anim].restart_frame;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
}
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
|
||||||
|
main_info.page_info[main_info.draw_page].num_pobs = 0;
|
||||||
|
|
||||||
|
for (c1 = 3; c1 >= 0; c1--)
|
||||||
|
add_pob(main_info.draw_page, player[c1].x >> 16, player[c1].y >> 16, player[c1].image + c1 * 18, &rabbit_gobs);
|
||||||
|
|
||||||
|
update_objects();
|
||||||
|
|
||||||
|
if (update_count == 1) {
|
||||||
|
draw_begin();
|
||||||
|
draw_pobs(main_info.draw_page);
|
||||||
|
draw_end();
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
|
||||||
|
if (mod_fade_direction == 1) {
|
||||||
|
if (mod_vol < 35) {
|
||||||
|
mod_vol++;
|
||||||
|
dj_set_mod_volume((char)mod_vol);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mod_vol > 0) {
|
||||||
|
mod_vol--;
|
||||||
|
dj_set_mod_volume((char)mod_vol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fade_flag = 0;
|
||||||
|
for (c1 = 0; c1 < 720; c1++) {
|
||||||
|
if (menu_cur_pal[c1] < menu_pal[c1]) {
|
||||||
|
menu_cur_pal[c1]++;
|
||||||
|
fade_flag = 1;
|
||||||
|
} else if (menu_cur_pal[c1] > menu_pal[c1]) {
|
||||||
|
menu_cur_pal[c1]--;
|
||||||
|
fade_flag = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fade_flag == 0 && end_loop_flag == 1) {
|
||||||
|
menu_deinit();
|
||||||
|
if (new_game_flag == 1)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
switch (fade_dir) {
|
||||||
|
case 0:
|
||||||
|
if (fade_count < 30) {
|
||||||
|
for (c1 = 0; c1 < 48; c1++) {
|
||||||
|
if (fade_pal[c1] > 0)
|
||||||
|
fade_pal[c1]--;
|
||||||
|
}
|
||||||
|
fade_count++;
|
||||||
|
} else {
|
||||||
|
draw_begin();
|
||||||
|
clear_lines(0, 220, 20, 0);
|
||||||
|
clear_lines(1, 220, 20, 0);
|
||||||
|
|
||||||
|
cur_message++;
|
||||||
|
if (cur_message >= NUM_MESSAGES)
|
||||||
|
cur_message -= NUM_MESSAGES;
|
||||||
|
put_text(0, 200, 220, message[cur_message], 2);
|
||||||
|
put_text(1, 200, 220, message[cur_message], 2);
|
||||||
|
fade_dir = 1;
|
||||||
|
fade_count = 0;
|
||||||
|
fade_tick = 0;
|
||||||
|
draw_end();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (fade_count < 100) {
|
||||||
|
for (c1 = 0; c1 < 48; c1++) {
|
||||||
|
if (fade_pal[c1] < menu_pal[c1 + 720])
|
||||||
|
fade_pal[c1]++;
|
||||||
|
}
|
||||||
|
fade_count++;
|
||||||
|
} else {
|
||||||
|
fade_dir = 0;
|
||||||
|
fade_count = 0;
|
||||||
|
fade_tick = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (c1 = 0; c1 < 48; c1++) {
|
||||||
|
if (fade_pal[c1] > menu_pal[c1 + 720])
|
||||||
|
fade_pal[c1]--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (update_count == 1) {
|
||||||
|
main_info.draw_page ^= 1;
|
||||||
|
main_info.view_page ^= 1;
|
||||||
|
|
||||||
|
flippage(main_info.view_page);
|
||||||
|
|
||||||
|
wait_vrt(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fade_flag != 0) {
|
||||||
|
setpalette(0, 240, menu_cur_pal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (update_count == 1) {
|
||||||
|
setpalette(240, 16, fade_pal);
|
||||||
|
|
||||||
|
dj_mix();
|
||||||
|
|
||||||
|
draw_begin();
|
||||||
|
redraw_pob_backgrounds(main_info.draw_page);
|
||||||
|
draw_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
update_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
update_count = intr_sysupdate();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
menu_deinit();
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int menu_init(void)
|
||||||
|
{
|
||||||
|
char *handle;
|
||||||
|
int c1;
|
||||||
|
|
||||||
|
fillpalette(0, 0, 0);
|
||||||
|
|
||||||
|
if ((handle = dat_open("menu.pcx")) == 0) {
|
||||||
|
strcpy(main_info.error_str, "Error loading 'menu.pcx', aborting...\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (read_pcx(handle, background_pic, JNB_WIDTH*JNB_HEIGHT, menu_pal) != 0) {
|
||||||
|
strcpy(main_info.error_str, "Error loading 'menu.pcx', aborting...\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ((handle = dat_open("menumask.pcx")) == 0) {
|
||||||
|
strcpy(main_info.error_str, "Error loading 'menumask.pcx', aborting...\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (read_pcx(handle, mask_pic, JNB_WIDTH*JNB_HEIGHT, 0) != 0) {
|
||||||
|
strcpy(main_info.error_str, "Error loading 'menumask.pcx', aborting...\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
memset(menu_cur_pal, 0, 768);
|
||||||
|
|
||||||
|
/* fix dark font */
|
||||||
|
for (c1 = 0; c1 < 16; c1++) {
|
||||||
|
menu_pal[(240 + c1) * 3 + 0] = c1 << 2;
|
||||||
|
menu_pal[(240 + c1) * 3 + 1] = c1 << 2;
|
||||||
|
menu_pal[(240 + c1) * 3 + 2] = c1 << 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
recalculate_gob(&rabbit_gobs, menu_pal);
|
||||||
|
recalculate_gob(&font_gobs, menu_pal);
|
||||||
|
recalculate_gob(&object_gobs, menu_pal);
|
||||||
|
register_background(background_pic, menu_pal);
|
||||||
|
register_mask(mask_pic);
|
||||||
|
|
||||||
|
for (c1 = 0; c1 < JNB_MAX_PLAYERS; c1++) {
|
||||||
|
player[c1].enabled = 0;
|
||||||
|
player[c1].x = (long) rnd(150) << 16;
|
||||||
|
player[c1].y = (160L + c1 * 2) << 16;
|
||||||
|
player[c1].x_add = 0;
|
||||||
|
player[c1].y_add = 0;
|
||||||
|
player[c1].direction = rnd(2);
|
||||||
|
player[c1].jump_ready = 1;
|
||||||
|
player[c1].anim = 0;
|
||||||
|
player[c1].frame = 0;
|
||||||
|
player[c1].frame_tick = 0;
|
||||||
|
player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (c1 = 0; c1 < NUM_OBJECTS; c1++)
|
||||||
|
objects[c1].used = 0;
|
||||||
|
|
||||||
|
main_info.page_info[0].num_pobs = 0;
|
||||||
|
main_info.page_info[1].num_pobs = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void menu_deinit(void)
|
||||||
|
{
|
||||||
|
dj_set_nosound(1);
|
||||||
|
}
|
23
contrib/other/jumpnbump/sdl/Makefile
Executable file
23
contrib/other/jumpnbump/sdl/Makefile
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
CC = kos32-gcc
|
||||||
|
LD = kos32-ld
|
||||||
|
|
||||||
|
SDK_DIR = $(abspath ../../../sdk)
|
||||||
|
|
||||||
|
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DUSE_SDL
|
||||||
|
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base 0
|
||||||
|
|
||||||
|
INCLUDES = -I$(SDK_DIR)/sources/newlib/libc/include -I$(SDK_DIR)/sources/SDL-1.2.2_newlib/include -DNDEBUG -I..
|
||||||
|
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
|
||||||
|
|
||||||
|
SRC = gfx.c interrpt.c sound.c input.c
|
||||||
|
|
||||||
|
OBJECTS = $(patsubst %.c, %.o, $(SRC))
|
||||||
|
|
||||||
|
default: $(patsubst %.c,%.o,$(SRC))
|
||||||
|
ar rcs libs.a *.o
|
||||||
|
|
||||||
|
%.o : %.c Makefile $(SRC)
|
||||||
|
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm *.o
|
865
contrib/other/jumpnbump/sdl/gfx.c
Executable file
865
contrib/other/jumpnbump/sdl/gfx.c
Executable file
@ -0,0 +1,865 @@
|
|||||||
|
/*
|
||||||
|
* gfx.c
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "globals.h"
|
||||||
|
#include "SDL_endian.h"
|
||||||
|
#include "SDL.h"
|
||||||
|
#include "filter.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "jumpnbump64.xpm"
|
||||||
|
|
||||||
|
SDL_Surface *icon;
|
||||||
|
|
||||||
|
int screen_width=400;
|
||||||
|
int screen_height=256;
|
||||||
|
int screen_pitch=400;
|
||||||
|
int scale_up=0;
|
||||||
|
int dirty_block_shift=4;
|
||||||
|
|
||||||
|
static SDL_Surface *jnb_surface;
|
||||||
|
static int fullscreen = 0;
|
||||||
|
static int vinited = 0;
|
||||||
|
static void *screen_buffer[2];
|
||||||
|
static int drawing_enable = 0;
|
||||||
|
static void *background = NULL;
|
||||||
|
static int background_drawn;
|
||||||
|
static void *mask = NULL;
|
||||||
|
static int dirty_blocks[2][25*16*2];
|
||||||
|
|
||||||
|
static SDL_Surface *load_xpm_from_array(char **xpm)
|
||||||
|
{
|
||||||
|
#define NEXT_TOKEN { \
|
||||||
|
while ((*p != ' ') && (*p != '\t')) p++; \
|
||||||
|
while ((*p == ' ') || (*p == '\t')) p++; }
|
||||||
|
|
||||||
|
SDL_Surface *surface;
|
||||||
|
char *p;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int colors;
|
||||||
|
int images;
|
||||||
|
int color;
|
||||||
|
int pal[256];
|
||||||
|
int x,y;
|
||||||
|
|
||||||
|
p = *xpm++;
|
||||||
|
|
||||||
|
width = atoi(p);
|
||||||
|
if (width <= 0)
|
||||||
|
return NULL;
|
||||||
|
NEXT_TOKEN;
|
||||||
|
|
||||||
|
height = atoi(p);
|
||||||
|
if (height <= 0)
|
||||||
|
return NULL;
|
||||||
|
NEXT_TOKEN;
|
||||||
|
|
||||||
|
colors = atoi(p);
|
||||||
|
if (colors <= 0)
|
||||||
|
return NULL;
|
||||||
|
NEXT_TOKEN;
|
||||||
|
|
||||||
|
images = atoi(p);
|
||||||
|
if (images <= 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
|
||||||
|
if (!surface)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
SDL_SetColorKey(surface, SDL_SRCCOLORKEY, SDL_MapRGBA(surface->format, 0, 0, 0, 0));
|
||||||
|
while (colors--) {
|
||||||
|
p = *xpm++;
|
||||||
|
|
||||||
|
color = *p++;
|
||||||
|
NEXT_TOKEN;
|
||||||
|
|
||||||
|
if (*p++ != 'c') {
|
||||||
|
SDL_FreeSurface(surface);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
NEXT_TOKEN;
|
||||||
|
|
||||||
|
if (*p == '#')
|
||||||
|
pal[color] = strtoul(++p, NULL, 16) | 0xff000000;
|
||||||
|
else
|
||||||
|
pal[color] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
y = 0;
|
||||||
|
while (y < height) {
|
||||||
|
int *pixels;
|
||||||
|
|
||||||
|
p = *xpm++;
|
||||||
|
|
||||||
|
pixels = (int *)&((char *)surface->pixels)[y++ * surface->pitch];
|
||||||
|
x = 0;
|
||||||
|
while (x < width) {
|
||||||
|
Uint8 r,g,b,a;
|
||||||
|
|
||||||
|
if (*p == '\0') {
|
||||||
|
SDL_FreeSurface(surface);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
r = (pal[(int)*p] >> 16) & 0xff;
|
||||||
|
b = (pal[(int)*p] & 0xff);
|
||||||
|
g = (pal[(int)*p] >> 8) & 0xff;
|
||||||
|
a = (pal[(int)*p] >> 24) & 0xff;
|
||||||
|
pixels[x] = SDL_MapRGBA(surface->format, r, g, b, a);
|
||||||
|
x++;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char *get_vgaptr(int page, int x, int y)
|
||||||
|
{
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
return (unsigned char *)screen_buffer[page] + (y*screen_pitch)+(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void set_scaling(int scale)
|
||||||
|
{
|
||||||
|
if (scale==1) {
|
||||||
|
screen_width=800;
|
||||||
|
screen_height=512;
|
||||||
|
scale_up=1;
|
||||||
|
dirty_block_shift=5;
|
||||||
|
screen_pitch=screen_width;
|
||||||
|
} else {
|
||||||
|
screen_width=400;
|
||||||
|
screen_height=256;
|
||||||
|
scale_up=0;
|
||||||
|
dirty_block_shift=4;
|
||||||
|
screen_pitch=screen_width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void open_screen(void)
|
||||||
|
{
|
||||||
|
int lval = 0;
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
lval = SDL_Init(SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO );
|
||||||
|
if (lval < 0) {
|
||||||
|
fprintf(stderr, "SDL ERROR: %s\n", SDL_GetError());
|
||||||
|
//exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
flags = SDL_SWSURFACE;
|
||||||
|
if (fullscreen)
|
||||||
|
flags |= SDL_FULLSCREEN;
|
||||||
|
jnb_surface = SDL_SetVideoMode(screen_width, screen_height, 8, flags);
|
||||||
|
|
||||||
|
if (!jnb_surface) {
|
||||||
|
fprintf(stderr, "SDL ERROR: %s\n", SDL_GetError());
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fullscreen)
|
||||||
|
SDL_ShowCursor(0);
|
||||||
|
else
|
||||||
|
SDL_ShowCursor(1);
|
||||||
|
|
||||||
|
SDL_WM_SetCaption("Jump'n'Bump","");
|
||||||
|
|
||||||
|
icon=load_xpm_from_array(jumpnbump_xpm);
|
||||||
|
if (icon==NULL) {
|
||||||
|
printf("Couldn't load icon\n");
|
||||||
|
} else {
|
||||||
|
SDL_WM_SetIcon(icon,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
vinited = 1;
|
||||||
|
|
||||||
|
memset(dirty_blocks, 0, sizeof(dirty_blocks));
|
||||||
|
|
||||||
|
screen_buffer[0]=malloc(screen_width*screen_height);
|
||||||
|
screen_buffer[1]=malloc(screen_width*screen_height);
|
||||||
|
|
||||||
|
/*
|
||||||
|
dirty_blocks[0]=malloc(sizeof(int)*25*16+1000);
|
||||||
|
dirty_blocks[1]=malloc(sizeof(int)*25*16+1000);
|
||||||
|
*/
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fs_toggle()
|
||||||
|
{
|
||||||
|
if (!vinited) {
|
||||||
|
fullscreen ^= 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (SDL_WM_ToggleFullScreen(jnb_surface))
|
||||||
|
fullscreen ^= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wait_vrt(int mix)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void clear_page(int page, int color)
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
unsigned char *buf = get_vgaptr(page, 0, 0);
|
||||||
|
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
for (i=0; i<(25*16); i++)
|
||||||
|
dirty_blocks[page][i] = 1;
|
||||||
|
|
||||||
|
for (i=0; i<screen_height; i++)
|
||||||
|
for (j=0; j<screen_width; j++)
|
||||||
|
*buf++ = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void clear_lines(int page, int y, int count, int color)
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
if (scale_up) {
|
||||||
|
count *= 2;
|
||||||
|
y *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<count; i++) {
|
||||||
|
if ((i+y)<screen_height) {
|
||||||
|
unsigned char *buf = get_vgaptr(page, 0, i+y);
|
||||||
|
for (j=0; j<screen_width; j++)
|
||||||
|
*buf++ = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count = ((y+count)>>dirty_block_shift) - (y>>dirty_block_shift) + 1;
|
||||||
|
y >>= dirty_block_shift;
|
||||||
|
for (i=0; i<count; i++)
|
||||||
|
for (j=0; j<25; j++)
|
||||||
|
dirty_blocks[page][(y+i)*25+j] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int get_color(int color, char pal[768])
|
||||||
|
{
|
||||||
|
assert(color<256);
|
||||||
|
assert(pal);
|
||||||
|
return SDL_MapRGB(jnb_surface->format, (Uint8)(pal[color*3+0]<<2), (Uint8)(pal[color*3+1]<<2), (Uint8)(pal[color*3+2]<<2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int get_pixel(int page, int x, int y)
|
||||||
|
{
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
if (scale_up) {
|
||||||
|
x *= 2;
|
||||||
|
y *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(x<screen_width);
|
||||||
|
assert(y<screen_height);
|
||||||
|
|
||||||
|
return *(unsigned char *)get_vgaptr(page, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void set_pixel(int page, int x, int y, int color)
|
||||||
|
{
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
if (scale_up) {
|
||||||
|
x *= 2;
|
||||||
|
y *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(x<screen_width);
|
||||||
|
assert(y<screen_height);
|
||||||
|
|
||||||
|
dirty_blocks[page][(y>>dirty_block_shift)*25+(x>>dirty_block_shift)] = 1;
|
||||||
|
|
||||||
|
*(unsigned char *)get_vgaptr(page, x, y) = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void flippage(int page)
|
||||||
|
{
|
||||||
|
int x,y;
|
||||||
|
unsigned char *src;
|
||||||
|
unsigned char *dest;
|
||||||
|
|
||||||
|
assert(drawing_enable==0);
|
||||||
|
|
||||||
|
SDL_LockSurface(jnb_surface);
|
||||||
|
if (!jnb_surface->pixels) {
|
||||||
|
|
||||||
|
for (x=0; x<(25*16); x++) {
|
||||||
|
dirty_blocks[0][x] = 1;
|
||||||
|
dirty_blocks[1][x] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dest=(unsigned char *)jnb_surface->pixels;
|
||||||
|
src=screen_buffer[page];
|
||||||
|
for (y=0; y<screen_height; y++) {
|
||||||
|
for (x=0; x<25; x++) {
|
||||||
|
int count;
|
||||||
|
int test_x;
|
||||||
|
|
||||||
|
count=0;
|
||||||
|
test_x=x;
|
||||||
|
while ( (test_x<25) && (dirty_blocks[page][(y>>dirty_block_shift)*25+test_x]) ) {
|
||||||
|
count++;
|
||||||
|
test_x++;
|
||||||
|
}
|
||||||
|
if (count) {
|
||||||
|
memcpy( &dest[y*jnb_surface->pitch+(x<<dirty_block_shift)],
|
||||||
|
&src[y*screen_pitch+((x<<dirty_block_shift))],
|
||||||
|
((16<<dirty_block_shift)>>4)*count);
|
||||||
|
}
|
||||||
|
x = test_x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memset(&dirty_blocks[page], 0, sizeof(int)*25*16);
|
||||||
|
SDL_UnlockSurface(jnb_surface);
|
||||||
|
SDL_Flip(jnb_surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw_begin(void)
|
||||||
|
{
|
||||||
|
assert(drawing_enable==0);
|
||||||
|
|
||||||
|
drawing_enable = 1;
|
||||||
|
if (background_drawn == 0) {
|
||||||
|
if (background) {
|
||||||
|
put_block(0, 0, 0, JNB_WIDTH, JNB_HEIGHT, background);
|
||||||
|
put_block(1, 0, 0, JNB_WIDTH, JNB_HEIGHT, background);
|
||||||
|
} else {
|
||||||
|
clear_page(0, 0);
|
||||||
|
clear_page(1, 0);
|
||||||
|
}
|
||||||
|
background_drawn = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw_end(void)
|
||||||
|
{
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
drawing_enable = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setpalette(int index, int count, char *palette)
|
||||||
|
{
|
||||||
|
SDL_Color colors[256];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
assert(drawing_enable==0);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
colors[i+index].r = palette[i * 3 + 0] << 2;
|
||||||
|
colors[i+index].g = palette[i * 3 + 1] << 2;
|
||||||
|
colors[i+index].b = palette[i * 3 + 2] << 2;
|
||||||
|
}
|
||||||
|
SDL_SetColors(jnb_surface, &colors[index], index, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fillpalette(int red, int green, int blue)
|
||||||
|
{
|
||||||
|
SDL_Color colors[256];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
assert(drawing_enable==0);
|
||||||
|
|
||||||
|
for (i = 0; i < 256; i++) {
|
||||||
|
colors[i].r = red << 2;
|
||||||
|
colors[i].g = green << 2;
|
||||||
|
colors[i].b = blue << 2;
|
||||||
|
}
|
||||||
|
SDL_SetColors(jnb_surface, colors, 0, 256);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void get_block(int page, int x, int y, int width, int height, void *buffer)
|
||||||
|
{
|
||||||
|
unsigned char *buffer_ptr, *vga_ptr;
|
||||||
|
int h;
|
||||||
|
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
if (scale_up) {
|
||||||
|
x *= 2;
|
||||||
|
y *= 2;
|
||||||
|
width *= 2;
|
||||||
|
height *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x < 0)
|
||||||
|
x = 0;
|
||||||
|
if (y < 0)
|
||||||
|
y = 0;
|
||||||
|
if (y + height >= screen_height)
|
||||||
|
height = screen_height - y;
|
||||||
|
if (x + width >= screen_width)
|
||||||
|
width = screen_width - x;
|
||||||
|
if (width<=0)
|
||||||
|
return;
|
||||||
|
if(height<=0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
vga_ptr = get_vgaptr(page, x, y);
|
||||||
|
buffer_ptr = buffer;
|
||||||
|
for (h = 0; h < height; h++) {
|
||||||
|
memcpy(buffer_ptr, vga_ptr, width);
|
||||||
|
vga_ptr += screen_pitch;
|
||||||
|
buffer_ptr += width;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void put_block(int page, int x, int y, int width, int height, void *buffer)
|
||||||
|
{
|
||||||
|
int h;
|
||||||
|
unsigned char *vga_ptr, *buffer_ptr;
|
||||||
|
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
if (scale_up) {
|
||||||
|
x *= 2;
|
||||||
|
y *= 2;
|
||||||
|
width *= 2;
|
||||||
|
height *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x < 0)
|
||||||
|
x = 0;
|
||||||
|
if (y < 0)
|
||||||
|
y = 0;
|
||||||
|
if (y + height >= screen_height)
|
||||||
|
height = screen_height - y;
|
||||||
|
if (x + width >= screen_width)
|
||||||
|
width = screen_width - x;
|
||||||
|
if (width<=0)
|
||||||
|
return;
|
||||||
|
if(height<=0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
vga_ptr = get_vgaptr(page, x, y);
|
||||||
|
buffer_ptr = buffer;
|
||||||
|
for (h = 0; h < height; h++) {
|
||||||
|
memcpy(vga_ptr, buffer_ptr, width);
|
||||||
|
vga_ptr += screen_pitch;
|
||||||
|
buffer_ptr += width;
|
||||||
|
}
|
||||||
|
width = ((x+width)>>dirty_block_shift) - (x>>dirty_block_shift) + 1;
|
||||||
|
height = ((y+height)>>dirty_block_shift) - (y>>dirty_block_shift) + 1;
|
||||||
|
x >>= dirty_block_shift;
|
||||||
|
y >>= dirty_block_shift;
|
||||||
|
while (width--)
|
||||||
|
for (h=0; h<height; h++)
|
||||||
|
dirty_blocks[page][(y+h)*25+(x+width)] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void put_text(int page, int x, int y, char *text, int align)
|
||||||
|
{
|
||||||
|
int c1;
|
||||||
|
int t1;
|
||||||
|
int width;
|
||||||
|
int cur_x;
|
||||||
|
int image;
|
||||||
|
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
|
||||||
|
if (text == NULL || strlen(text) == 0)
|
||||||
|
return;
|
||||||
|
if (font_gobs.num_images == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
width = 0;
|
||||||
|
c1 = 0;
|
||||||
|
while (text[c1] != 0) {
|
||||||
|
t1 = text[c1];
|
||||||
|
c1++;
|
||||||
|
if (t1 == ' ') {
|
||||||
|
width += 5;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (t1 >= 33 && t1 <= 34)
|
||||||
|
image = t1 - 33;
|
||||||
|
|
||||||
|
else if (t1 >= 39 && t1 <= 41)
|
||||||
|
image = t1 - 37;
|
||||||
|
|
||||||
|
else if (t1 >= 44 && t1 <= 59)
|
||||||
|
image = t1 - 39;
|
||||||
|
|
||||||
|
else if (t1 >= 64 && t1 <= 90)
|
||||||
|
image = t1 - 43;
|
||||||
|
|
||||||
|
else if (t1 >= 97 && t1 <= 122)
|
||||||
|
image = t1 - 49;
|
||||||
|
|
||||||
|
else if (t1 == '~')
|
||||||
|
image = 74;
|
||||||
|
|
||||||
|
else if (t1 == 0x84)
|
||||||
|
image = 75;
|
||||||
|
|
||||||
|
else if (t1 == 0x86)
|
||||||
|
image = 76;
|
||||||
|
|
||||||
|
else if (t1 == 0x8e)
|
||||||
|
image = 77;
|
||||||
|
|
||||||
|
else if (t1 == 0x8f)
|
||||||
|
image = 78;
|
||||||
|
|
||||||
|
else if (t1 == 0x94)
|
||||||
|
image = 79;
|
||||||
|
|
||||||
|
else if (t1 == 0x99)
|
||||||
|
image = 80;
|
||||||
|
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
width += pob_width(image, &font_gobs) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (align) {
|
||||||
|
case 0:
|
||||||
|
cur_x = x;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
cur_x = x - width;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
cur_x = x - width / 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cur_x = 0; /* this should cause error? -Chuck */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
c1 = 0;
|
||||||
|
|
||||||
|
while (text[c1] != 0) {
|
||||||
|
t1 = text[c1];
|
||||||
|
c1++;
|
||||||
|
if (t1 == ' ') {
|
||||||
|
cur_x += 5;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (t1 >= 33 && t1 <= 34)
|
||||||
|
image = t1 - 33;
|
||||||
|
|
||||||
|
else if (t1 >= 39 && t1 <= 41)
|
||||||
|
image = t1 - 37;
|
||||||
|
|
||||||
|
else if (t1 >= 44 && t1 <= 59)
|
||||||
|
image = t1 - 39;
|
||||||
|
|
||||||
|
else if (t1 >= 64 && t1 <= 90)
|
||||||
|
image = t1 - 43;
|
||||||
|
|
||||||
|
else if (t1 >= 97 && t1 <= 122)
|
||||||
|
image = t1 - 49;
|
||||||
|
|
||||||
|
else if (t1 == '~')
|
||||||
|
image = 74;
|
||||||
|
|
||||||
|
else if (t1 == 0x84)
|
||||||
|
image = 75;
|
||||||
|
|
||||||
|
else if (t1 == 0x86)
|
||||||
|
image = 76;
|
||||||
|
|
||||||
|
else if (t1 == 0x8e)
|
||||||
|
image = 77;
|
||||||
|
|
||||||
|
else if (t1 == 0x8f)
|
||||||
|
image = 78;
|
||||||
|
|
||||||
|
else if (t1 == 0x94)
|
||||||
|
image = 79;
|
||||||
|
|
||||||
|
else if (t1 == 0x99)
|
||||||
|
image = 80;
|
||||||
|
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
put_pob(page, cur_x, y, image, &font_gobs, 1, mask_pic);
|
||||||
|
cur_x += pob_width(image, &font_gobs) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void put_pob(int page, int x, int y, int image, gob_t *gob, int use_mask, void *mask_pic)
|
||||||
|
{
|
||||||
|
int c1, c2;
|
||||||
|
int pob_x, pob_y;
|
||||||
|
int width, height;
|
||||||
|
int draw_width, draw_height;
|
||||||
|
int colour;
|
||||||
|
unsigned char *vga_ptr;
|
||||||
|
unsigned char *pob_ptr;
|
||||||
|
unsigned char *mask_ptr;
|
||||||
|
|
||||||
|
assert(drawing_enable==1);
|
||||||
|
assert(gob);
|
||||||
|
assert(image>=0);
|
||||||
|
assert(image<gob->num_images);
|
||||||
|
|
||||||
|
if (scale_up) {
|
||||||
|
x *= 2;
|
||||||
|
y *= 2;
|
||||||
|
width = draw_width = gob->width[image]*2;
|
||||||
|
height = draw_height = gob->height[image]*2;
|
||||||
|
x -= gob->hs_x[image]*2;
|
||||||
|
y -= gob->hs_y[image]*2;
|
||||||
|
} else {
|
||||||
|
width = draw_width = gob->width[image];
|
||||||
|
height = draw_height = gob->height[image];
|
||||||
|
x -= gob->hs_x[image];
|
||||||
|
y -= gob->hs_y[image];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((x + width) <= 0 || x >= screen_width)
|
||||||
|
return;
|
||||||
|
if ((y + height) <= 0 || y >= screen_height)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pob_x = 0;
|
||||||
|
pob_y = 0;
|
||||||
|
if (x < 0) {
|
||||||
|
pob_x -= x;
|
||||||
|
draw_width += x;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if ((x + width) > screen_width)
|
||||||
|
draw_width -= x + width - screen_width;
|
||||||
|
if (y < 0) {
|
||||||
|
pob_y -= y;
|
||||||
|
draw_height += y;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
if ((y + height) > screen_height)
|
||||||
|
draw_height -= y + height - screen_height;
|
||||||
|
|
||||||
|
vga_ptr = get_vgaptr(page, x, y);
|
||||||
|
pob_ptr = ((unsigned char *)gob->data[image]) + ((pob_y * width) + pob_x);
|
||||||
|
mask_ptr = ((unsigned char *)mask) + ((y * screen_pitch) + (x));
|
||||||
|
for (c1 = 0; c1 < draw_height; c1++) {
|
||||||
|
for (c2 = 0; c2 < draw_width; c2++) {
|
||||||
|
colour = *mask_ptr;
|
||||||
|
if (use_mask == 0 || (use_mask == 1 && colour == 0)) {
|
||||||
|
colour = *pob_ptr;
|
||||||
|
if (colour != 0) {
|
||||||
|
*vga_ptr = colour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vga_ptr++;
|
||||||
|
pob_ptr++;
|
||||||
|
mask_ptr++;
|
||||||
|
}
|
||||||
|
pob_ptr += width - c2;
|
||||||
|
vga_ptr += (screen_width - c2);
|
||||||
|
mask_ptr += (screen_width - c2);
|
||||||
|
}
|
||||||
|
draw_width = ((x+draw_width)>>dirty_block_shift) - (x>>dirty_block_shift) + 1;
|
||||||
|
draw_height = ((y+draw_height)>>dirty_block_shift) - (y>>dirty_block_shift) + 1;
|
||||||
|
x >>= dirty_block_shift;
|
||||||
|
y >>= dirty_block_shift;
|
||||||
|
while (draw_width--)
|
||||||
|
for (c1=0; c1<draw_height; c1++)
|
||||||
|
dirty_blocks[page][(y+c1)*25+(x+draw_width)] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pob_width(int image, gob_t *gob)
|
||||||
|
{
|
||||||
|
assert(gob);
|
||||||
|
assert(image>=0);
|
||||||
|
assert(image<gob->num_images);
|
||||||
|
return gob->width[image];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pob_height(int image, gob_t *gob)
|
||||||
|
{
|
||||||
|
assert(gob);
|
||||||
|
assert(image>=0);
|
||||||
|
assert(image<gob->num_images);
|
||||||
|
return gob->height[image];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pob_hs_x(int image, gob_t *gob)
|
||||||
|
{
|
||||||
|
assert(gob);
|
||||||
|
assert(image>=0);
|
||||||
|
assert(image<gob->num_images);
|
||||||
|
return gob->hs_x[image];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pob_hs_y(int image, gob_t *gob)
|
||||||
|
{
|
||||||
|
assert(gob);
|
||||||
|
assert(image>=0);
|
||||||
|
assert(image<gob->num_images);
|
||||||
|
return gob->hs_y[image];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int read_pcx(unsigned char * handle, void *buf, int buf_len, char *pal)
|
||||||
|
{
|
||||||
|
unsigned char *buffer=buf;
|
||||||
|
short c1;
|
||||||
|
short a, b;
|
||||||
|
long ofs1;
|
||||||
|
if (buffer != 0) {
|
||||||
|
handle += 128;
|
||||||
|
ofs1 = 0;
|
||||||
|
while (ofs1 < buf_len) {
|
||||||
|
a = *(handle++);
|
||||||
|
if ((a & 0xc0) == 0xc0) {
|
||||||
|
b = *(handle++);
|
||||||
|
a &= 0x3f;
|
||||||
|
for (c1 = 0; c1 < a && ofs1 < buf_len; c1++)
|
||||||
|
buffer[ofs1++] = (char) b;
|
||||||
|
} else
|
||||||
|
buffer[ofs1++] = (char) a;
|
||||||
|
}
|
||||||
|
if (pal != 0) {
|
||||||
|
handle++;
|
||||||
|
for (c1 = 0; c1 < 768; c1++)
|
||||||
|
pal[c1] = *(handle++) /*fgetc(handle)*/ >> 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void register_background(char *pixels, char pal[768])
|
||||||
|
{
|
||||||
|
if (background) {
|
||||||
|
free(background);
|
||||||
|
background = NULL;
|
||||||
|
}
|
||||||
|
background_drawn = 0;
|
||||||
|
if (!pixels)
|
||||||
|
return;
|
||||||
|
assert(pal);
|
||||||
|
if (scale_up) {
|
||||||
|
background = malloc(screen_pitch*screen_height);
|
||||||
|
assert(background);
|
||||||
|
do_scale2x((unsigned char *)pixels, JNB_WIDTH, JNB_HEIGHT, (unsigned char *)background);
|
||||||
|
} else {
|
||||||
|
background = malloc(JNB_WIDTH*JNB_HEIGHT);
|
||||||
|
assert(background);
|
||||||
|
memcpy(background, pixels, JNB_WIDTH*JNB_HEIGHT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int register_gob(unsigned char *handle, gob_t *gob, int len)
|
||||||
|
{
|
||||||
|
unsigned char *gob_data;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
gob_data = malloc(len);
|
||||||
|
memcpy(gob_data, handle, len);
|
||||||
|
|
||||||
|
gob->num_images = (short)((gob_data[0]) + (gob_data[1] << 8));
|
||||||
|
|
||||||
|
gob->width = malloc(gob->num_images*sizeof(int));
|
||||||
|
gob->height = malloc(gob->num_images*sizeof(int));
|
||||||
|
gob->hs_x = malloc(gob->num_images*sizeof(int));
|
||||||
|
gob->hs_y = malloc(gob->num_images*sizeof(int));
|
||||||
|
gob->data = malloc(gob->num_images*sizeof(void *));
|
||||||
|
gob->orig_data = malloc(gob->num_images*sizeof(void *));
|
||||||
|
for (i=0; i<gob->num_images; i++) {
|
||||||
|
int image_size;
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
offset = (gob_data[i*4+2]) + (gob_data[i*4+3] << 8) + (gob_data[i*4+4] << 16) + (gob_data[i*4+5] << 24);
|
||||||
|
|
||||||
|
gob->width[i] = (short)((gob_data[offset]) + (gob_data[offset+1] << 8)); offset += 2;
|
||||||
|
gob->height[i] = (short)((gob_data[offset]) + (gob_data[offset+1] << 8)); offset += 2;
|
||||||
|
gob->hs_x[i] = (short)((gob_data[offset]) + (gob_data[offset+1] << 8)); offset += 2;
|
||||||
|
gob->hs_y[i] = (short)((gob_data[offset]) + (gob_data[offset+1] << 8)); offset += 2;
|
||||||
|
|
||||||
|
image_size = gob->width[i] * gob->height[i];
|
||||||
|
gob->orig_data[i] = malloc(image_size);
|
||||||
|
memcpy(gob->orig_data[i], &gob_data[offset], image_size);
|
||||||
|
if (scale_up) {
|
||||||
|
image_size = gob->width[i] * gob->height[i] * 4;
|
||||||
|
gob->data[i] = malloc(image_size);
|
||||||
|
do_scale2x((unsigned char *)gob->orig_data[i], gob->width[i], gob->height[i], (unsigned char *)gob->data[i]);
|
||||||
|
} else {
|
||||||
|
gob->data[i] = (unsigned short *)gob->orig_data[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(gob_data);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void recalculate_gob(gob_t *gob, char pal[768])
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void register_mask(void *pixels)
|
||||||
|
{
|
||||||
|
if (mask) {
|
||||||
|
free(mask);
|
||||||
|
mask = NULL;
|
||||||
|
}
|
||||||
|
assert(pixels);
|
||||||
|
if (scale_up) {
|
||||||
|
mask = malloc(screen_pitch*screen_height);
|
||||||
|
assert(mask);
|
||||||
|
do_scale2x((unsigned char *)pixels, JNB_WIDTH, JNB_HEIGHT, (unsigned char *)mask);
|
||||||
|
} else {
|
||||||
|
mask = malloc(JNB_WIDTH*JNB_HEIGHT);
|
||||||
|
assert(mask);
|
||||||
|
memcpy(mask, pixels, JNB_WIDTH*JNB_HEIGHT);
|
||||||
|
}
|
||||||
|
}
|
113
contrib/other/jumpnbump/sdl/input.c
Executable file
113
contrib/other/jumpnbump/sdl/input.c
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* input.c
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int num_joys=0;
|
||||||
|
static SDL_Joystick *joys[4];
|
||||||
|
|
||||||
|
/* assumes joysticks have at least one button, could check numbuttons first? */
|
||||||
|
#define JOY_LEFT(num) (num_joys>num && SDL_JoystickGetAxis(joys[num], 0)<-3200)
|
||||||
|
#define JOY_RIGHT(num) (num_joys>num && SDL_JoystickGetAxis(joys[num], 0)>3200)
|
||||||
|
/* I find using the vertical axis to be annoying -- dnb */
|
||||||
|
#define JOY_JUMP(num) (num_joys>num && SDL_JoystickGetButton(joys[num], 0))
|
||||||
|
|
||||||
|
int calib_joy(int type)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void update_player_actions(void)
|
||||||
|
{
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
if (client_player_num < 0) {
|
||||||
|
tmp = (key_pressed(KEY_PL1_LEFT) == 1) || JOY_LEFT(3);
|
||||||
|
if (tmp != player[0].action_left)
|
||||||
|
tellServerPlayerMoved(0, MOVEMENT_LEFT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL1_RIGHT) == 1) || JOY_RIGHT(3);
|
||||||
|
if (tmp != player[0].action_right)
|
||||||
|
tellServerPlayerMoved(0, MOVEMENT_RIGHT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL1_JUMP) == 1) || JOY_JUMP(3);
|
||||||
|
if (tmp != player[0].action_up)
|
||||||
|
tellServerPlayerMoved(0, MOVEMENT_UP, tmp);
|
||||||
|
|
||||||
|
tmp = (key_pressed(KEY_PL2_LEFT) == 1) || JOY_LEFT(2);
|
||||||
|
if (tmp != player[1].action_left)
|
||||||
|
tellServerPlayerMoved(1, MOVEMENT_LEFT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL2_RIGHT) == 1) || JOY_RIGHT(2);
|
||||||
|
if (tmp != player[1].action_right)
|
||||||
|
tellServerPlayerMoved(1, MOVEMENT_RIGHT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL2_JUMP) == 1) || JOY_JUMP(2);
|
||||||
|
if (tmp != player[1].action_up)
|
||||||
|
tellServerPlayerMoved(1, MOVEMENT_UP, tmp);
|
||||||
|
|
||||||
|
tmp = (key_pressed(KEY_PL3_LEFT) == 1) || JOY_LEFT(1);
|
||||||
|
if (tmp != player[2].action_left)
|
||||||
|
tellServerPlayerMoved(2, MOVEMENT_LEFT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL3_RIGHT) == 1) || JOY_RIGHT(1);
|
||||||
|
if (tmp != player[2].action_right)
|
||||||
|
tellServerPlayerMoved(2, MOVEMENT_RIGHT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL3_JUMP) == 1) || JOY_JUMP(1);
|
||||||
|
if (tmp != player[2].action_up)
|
||||||
|
tellServerPlayerMoved(2, MOVEMENT_UP, tmp);
|
||||||
|
|
||||||
|
tmp = (key_pressed(KEY_PL4_LEFT) == 1) || JOY_LEFT(0);
|
||||||
|
if (tmp != player[3].action_left)
|
||||||
|
tellServerPlayerMoved(3, MOVEMENT_LEFT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL4_RIGHT) == 1) || JOY_RIGHT(0);
|
||||||
|
if (tmp != player[3].action_right)
|
||||||
|
tellServerPlayerMoved(3, MOVEMENT_RIGHT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL4_JUMP) == 1) || JOY_JUMP(0);
|
||||||
|
if (tmp != player[3].action_up)
|
||||||
|
tellServerPlayerMoved(3, MOVEMENT_UP, tmp);
|
||||||
|
} else {
|
||||||
|
tmp = (key_pressed(KEY_PL1_LEFT) == 1) || JOY_LEFT(0);
|
||||||
|
if (tmp != player[client_player_num].action_left)
|
||||||
|
tellServerPlayerMoved(client_player_num, MOVEMENT_LEFT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL1_RIGHT) == 1) || JOY_RIGHT(0);
|
||||||
|
if (tmp != player[client_player_num].action_right)
|
||||||
|
tellServerPlayerMoved(client_player_num, MOVEMENT_RIGHT, tmp);
|
||||||
|
tmp = (key_pressed(KEY_PL1_JUMP) == 1) || JOY_JUMP(0);
|
||||||
|
if (tmp != player[client_player_num].action_up)
|
||||||
|
tellServerPlayerMoved(client_player_num, MOVEMENT_UP, tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_inputs(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
num_joys = SDL_NumJoysticks();
|
||||||
|
for(i = 0; i < 4 && i < num_joys; ++i)
|
||||||
|
joys[i] = SDL_JoystickOpen(i);
|
||||||
|
|
||||||
|
main_info.mouse_enabled = 0;
|
||||||
|
main_info.joy_enabled = 0;
|
||||||
|
}
|
462
contrib/other/jumpnbump/sdl/interrpt.c
Executable file
462
contrib/other/jumpnbump/sdl/interrpt.c
Executable file
@ -0,0 +1,462 @@
|
|||||||
|
/*
|
||||||
|
* interrpt.c
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
|
#ifdef USE_KAILLERA
|
||||||
|
#include "SDL_thread.h"
|
||||||
|
#include "SDL_mutex.h"
|
||||||
|
#include <kailleraclient.h>
|
||||||
|
|
||||||
|
char local_keyb[256];
|
||||||
|
#endif /* USE_KAILLERA */
|
||||||
|
|
||||||
|
char keyb[256];
|
||||||
|
char last_keys[50];
|
||||||
|
|
||||||
|
#ifdef USE_KAILLERA
|
||||||
|
|
||||||
|
/* information about the party in this session */
|
||||||
|
static int my_player = -1;
|
||||||
|
static int my_numplayers = -1;
|
||||||
|
|
||||||
|
/* semaphore for controlling kaillera thread */
|
||||||
|
static SDL_sem *game_start_sem = NULL;
|
||||||
|
|
||||||
|
/* keys supported on my end */
|
||||||
|
static int my_player_up = -1;
|
||||||
|
static int my_player_left = -1;
|
||||||
|
static int my_player_right = 1;
|
||||||
|
|
||||||
|
/* values for the kaillera client interface */
|
||||||
|
static char kaillera_app_name[] = "Jump 'n Bump";
|
||||||
|
static char kaillera_game_name[] = "Jump 'n Bump\0\0";
|
||||||
|
|
||||||
|
static int player_keys[4][3] = {
|
||||||
|
{
|
||||||
|
KEY_PL1_LEFT,
|
||||||
|
KEY_PL1_RIGHT,
|
||||||
|
KEY_PL1_JUMP
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KEY_PL2_LEFT,
|
||||||
|
KEY_PL2_RIGHT,
|
||||||
|
KEY_PL2_JUMP
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KEY_PL3_LEFT,
|
||||||
|
KEY_PL3_RIGHT,
|
||||||
|
KEY_PL3_JUMP
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KEY_PL4_LEFT,
|
||||||
|
KEY_PL4_RIGHT,
|
||||||
|
KEY_PL4_JUMP
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static int WINAPI kaillera_game_callback(char *game, int player, int numplayers)
|
||||||
|
{
|
||||||
|
int length;
|
||||||
|
int urand;
|
||||||
|
unsigned char random[8];
|
||||||
|
|
||||||
|
if (strcmp(game, kaillera_game_name) != 0) {
|
||||||
|
printf("unknown game selected: %s\n", game);
|
||||||
|
|
||||||
|
my_player = -1;
|
||||||
|
goto release;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("start network game with %d players\n", numplayers);
|
||||||
|
printf("I am player %d\n", player);
|
||||||
|
|
||||||
|
my_player = player;
|
||||||
|
my_numplayers = numplayers;
|
||||||
|
|
||||||
|
my_player_up = player_keys[player-1][0] & 0xff;
|
||||||
|
my_player_left = player_keys[player-1][1] & 0xff;
|
||||||
|
my_player_right = player_keys[player-1][2] & 0xff;
|
||||||
|
|
||||||
|
/* initialize randomizer agreed by all players */
|
||||||
|
random[0] = time(0) & 0xff;
|
||||||
|
random[1] = random[2] = random[3] = 0x00;
|
||||||
|
length = kailleraModifyPlayValues(&random, sizeof(random[0]));
|
||||||
|
if (length < 0) {
|
||||||
|
goto release;
|
||||||
|
}
|
||||||
|
|
||||||
|
urand = random[3] << 24 | random[2] << 16 | random[1] << 8 | random[0];
|
||||||
|
srand(urand);
|
||||||
|
|
||||||
|
release:
|
||||||
|
|
||||||
|
SDL_SemPost(game_start_sem);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static kailleraInfos kaillera_data = {
|
||||||
|
kaillera_app_name,
|
||||||
|
kaillera_game_name,
|
||||||
|
kaillera_game_callback,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static void print_version()
|
||||||
|
{
|
||||||
|
char version[16];
|
||||||
|
|
||||||
|
kailleraGetVersion(version);
|
||||||
|
printf("using kaillera version %s\n", version);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int kaillera_thread(void *arg)
|
||||||
|
{
|
||||||
|
kailleraInit();
|
||||||
|
|
||||||
|
/* print_version(); */
|
||||||
|
|
||||||
|
kailleraSetInfos(&kaillera_data);
|
||||||
|
|
||||||
|
kailleraSelectServerDialog(0);
|
||||||
|
if (SDL_SemValue(game_start_sem) == 0) {
|
||||||
|
/* server dialog returned and game didnt start */
|
||||||
|
|
||||||
|
/* release blocking thread */
|
||||||
|
my_player = -1;
|
||||||
|
SDL_SemPost(game_start_sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int start_kaillera_thread(void)
|
||||||
|
{
|
||||||
|
SDL_Thread *thread;
|
||||||
|
|
||||||
|
game_start_sem = SDL_CreateSemaphore(0);
|
||||||
|
|
||||||
|
thread = SDL_CreateThread(kaillera_thread, NULL);
|
||||||
|
if (!thread) {
|
||||||
|
printf("SDL_CreateThread failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int addkey(unsigned int key)
|
||||||
|
{
|
||||||
|
/* it doesnt matter if a player presses keys
|
||||||
|
* that control other bunnies. whatever is sent
|
||||||
|
* is packed by pack_keys()
|
||||||
|
*/
|
||||||
|
if (!(key & 0x8000)) {
|
||||||
|
local_keyb[key & 0x7fff] = 1;
|
||||||
|
} else
|
||||||
|
local_keyb[key & 0x7fff] = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove_keyb_handler(void)
|
||||||
|
{
|
||||||
|
kailleraShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
int pack_keys(void)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
rv = local_keyb[my_player_up];
|
||||||
|
rv |= local_keyb[my_player_left] << 1;
|
||||||
|
rv |= local_keyb[my_player_right] << 2;
|
||||||
|
rv |= local_keyb[1] << 3;
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
void unpack_keys(int player, char value)
|
||||||
|
{
|
||||||
|
keyb[player_keys[player][0] & 0xff] = (value >> 0) & 1;
|
||||||
|
keyb[player_keys[player][1] & 0xff] = (value >> 1) & 1;
|
||||||
|
keyb[player_keys[player][2] & 0xff] = (value >> 2) & 1;
|
||||||
|
|
||||||
|
/* escape key is shared among all users */
|
||||||
|
keyb[1] |= (value >> 3) & 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int update_kaillera_keys(void)
|
||||||
|
{
|
||||||
|
char keys[8];
|
||||||
|
int length;
|
||||||
|
int player;
|
||||||
|
|
||||||
|
keys[0] = pack_keys();
|
||||||
|
length = kailleraModifyPlayValues(&keys, sizeof(keys[0]));
|
||||||
|
|
||||||
|
if (length < 0) {
|
||||||
|
/* terminate session */
|
||||||
|
printf("** LOST CONNECTION **\n");
|
||||||
|
kailleraEndGame();
|
||||||
|
my_player = -1;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (player=0; player<length; player++) {
|
||||||
|
unpack_keys(player, keys[player]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int hook_keyb_handler(void)
|
||||||
|
{
|
||||||
|
SDL_EnableUNICODE(1);
|
||||||
|
memset((void *) last_keys, 0, sizeof(last_keys));
|
||||||
|
|
||||||
|
start_kaillera_thread();
|
||||||
|
SDL_SemWait(game_start_sem);
|
||||||
|
if (my_player < 0) {
|
||||||
|
printf("GAME ABORTED!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("GAME STARTS!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int key_pressed(int key)
|
||||||
|
{
|
||||||
|
if (key == 1 && my_player < 0) {
|
||||||
|
/* if game completed or aborted, post ESC */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyb[(unsigned char) key];
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* USE_KAILLERA */
|
||||||
|
|
||||||
|
int addkey(unsigned int key)
|
||||||
|
{
|
||||||
|
int c1;
|
||||||
|
|
||||||
|
if (!(key & 0x8000)) {
|
||||||
|
keyb[key & 0x7fff] = 1;
|
||||||
|
for (c1 = 48; c1 > 0; c1--)
|
||||||
|
last_keys[c1] = last_keys[c1 - 1];
|
||||||
|
last_keys[0] = key & 0x7fff;
|
||||||
|
} else
|
||||||
|
keyb[key & 0x7fff] = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove_keyb_handler(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int hook_keyb_handler(void)
|
||||||
|
{
|
||||||
|
SDL_EnableUNICODE(1);
|
||||||
|
memset((void *) last_keys, 0, sizeof(last_keys));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int key_pressed(int key)
|
||||||
|
{
|
||||||
|
return keyb[(unsigned char) key];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* USE_KAILLERA */
|
||||||
|
|
||||||
|
int intr_sysupdate()
|
||||||
|
{
|
||||||
|
SDL_Event e;
|
||||||
|
int i = 0;
|
||||||
|
static int last_time = 0;
|
||||||
|
int now, time_diff;
|
||||||
|
|
||||||
|
while (SDL_PollEvent(&e)) {
|
||||||
|
switch (e.type) {
|
||||||
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
|
case SDL_MOUSEBUTTONUP:
|
||||||
|
if(e.button.state == SDL_PRESSED &&
|
||||||
|
((key_pressed(KEY_PL3_LEFT) && e.button.button == SDL_BUTTON_RIGHT) ||
|
||||||
|
(key_pressed(KEY_PL3_RIGHT) && e.button.button == SDL_BUTTON_LEFT) ||
|
||||||
|
(e.button.button == SDL_BUTTON_LEFT && e.button.button == SDL_BUTTON_RIGHT) ||
|
||||||
|
e.button.button == SDL_BUTTON_MIDDLE))
|
||||||
|
{
|
||||||
|
addkey(KEY_PL3_JUMP & 0x7f);
|
||||||
|
}
|
||||||
|
else if(e.button.state == SDL_RELEASED &&
|
||||||
|
((key_pressed(KEY_PL3_LEFT) && e.button.button == SDL_BUTTON_RIGHT) ||
|
||||||
|
(key_pressed(KEY_PL3_RIGHT) && e.button.button == SDL_BUTTON_LEFT) ||
|
||||||
|
e.button.button == SDL_BUTTON_MIDDLE))
|
||||||
|
{
|
||||||
|
addkey((KEY_PL3_JUMP & 0x7f) | 0x8000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e.button.button == SDL_BUTTON_LEFT)
|
||||||
|
{
|
||||||
|
SDLKey sym = KEY_PL3_LEFT;
|
||||||
|
sym &= 0x7f;
|
||||||
|
if(e.button.state == SDL_RELEASED)
|
||||||
|
{
|
||||||
|
if(key_pressed(KEY_PL3_JUMP) && (SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(SDL_BUTTON_RIGHT)))
|
||||||
|
addkey(KEY_PL3_RIGHT & 0x7f);
|
||||||
|
else
|
||||||
|
sym |= 0x8000;
|
||||||
|
}
|
||||||
|
addkey(sym);
|
||||||
|
}
|
||||||
|
else if(e.button.button == SDL_BUTTON_RIGHT)
|
||||||
|
{
|
||||||
|
SDLKey sym = KEY_PL3_RIGHT;
|
||||||
|
sym &= 0x7f;
|
||||||
|
if (e.button.state == SDL_RELEASED)
|
||||||
|
{
|
||||||
|
if(key_pressed(KEY_PL3_JUMP) && (SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(SDL_BUTTON_LEFT)))
|
||||||
|
addkey(KEY_PL3_LEFT & 0x7f);
|
||||||
|
else
|
||||||
|
sym |= 0x8000;
|
||||||
|
}
|
||||||
|
addkey(sym);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDL_KEYDOWN:
|
||||||
|
case SDL_KEYUP:
|
||||||
|
switch (e.key.keysym.sym) {
|
||||||
|
case SDLK_F12:
|
||||||
|
if (e.type == SDL_KEYDOWN) {
|
||||||
|
SDL_Quit();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDLK_F10:
|
||||||
|
if (e.type == SDL_KEYDOWN) {
|
||||||
|
fs_toggle();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDLK_1:
|
||||||
|
if (e.type == SDL_KEYUP)
|
||||||
|
ai[0] = !ai[0];
|
||||||
|
|
||||||
|
/* Release keys, otherwise it will continue moving that way */
|
||||||
|
addkey((KEY_PL1_LEFT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL1_RIGHT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL1_JUMP & 0x7f) | 0x8000);
|
||||||
|
break;
|
||||||
|
case SDLK_2:
|
||||||
|
if (e.type == SDL_KEYUP)
|
||||||
|
ai[1] = !ai[1];
|
||||||
|
|
||||||
|
/* Release keys, otherwise it will continue moving that way */
|
||||||
|
addkey((KEY_PL2_LEFT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL2_RIGHT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL2_JUMP & 0x7f) | 0x8000);
|
||||||
|
break;
|
||||||
|
case SDLK_3:
|
||||||
|
if (e.type == SDL_KEYUP)
|
||||||
|
ai[2] = !ai[2];
|
||||||
|
|
||||||
|
/* Release keys, otherwise it will continue moving that way */
|
||||||
|
addkey((KEY_PL3_LEFT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL3_RIGHT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL3_JUMP & 0x7f) | 0x8000);
|
||||||
|
break;
|
||||||
|
case SDLK_4:
|
||||||
|
if (e.type == SDL_KEYUP)
|
||||||
|
ai[3] = !ai[3];
|
||||||
|
|
||||||
|
/* Release keys, otherwise it will continue moving that way */
|
||||||
|
addkey((KEY_PL4_LEFT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL4_RIGHT & 0x7f) | 0x8000);
|
||||||
|
addkey((KEY_PL4_JUMP & 0x7f) | 0x8000);
|
||||||
|
break;
|
||||||
|
case SDLK_ESCAPE:
|
||||||
|
if (e.type == SDL_KEYUP)
|
||||||
|
addkey(1 | 0x8000);
|
||||||
|
else
|
||||||
|
addkey(1 & 0x7f);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
e.key.keysym.sym &= 0x7f;
|
||||||
|
if (e.type == SDL_KEYUP)
|
||||||
|
e.key.keysym.sym |= 0x8000;
|
||||||
|
addkey(e.key.keysym.sym);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Delay(1);
|
||||||
|
now = SDL_GetTicks();
|
||||||
|
time_diff = now - last_time;
|
||||||
|
if (time_diff>0) {
|
||||||
|
i = time_diff / (1000 / 60);
|
||||||
|
if (i) {
|
||||||
|
last_time = now;
|
||||||
|
} else {
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
tmp = (1000/60) - i - 10;
|
||||||
|
if (tmp>0)
|
||||||
|
SDL_Delay(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (!then)
|
||||||
|
SDL_Delay(1);
|
||||||
|
else {
|
||||||
|
then = (1000 / 60) - (now - then);
|
||||||
|
if (then > 0 && then < 1000)
|
||||||
|
SDL_Delay(then);
|
||||||
|
}
|
||||||
|
then = now;
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef USE_KAILLERA
|
||||||
|
if (my_player >= 0) {
|
||||||
|
update_kaillera_keys();
|
||||||
|
i=1;
|
||||||
|
}
|
||||||
|
#endif /* USE_KAILLERA */
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
196
contrib/other/jumpnbump/sdl/jumpnbump128.xpm
Executable file
196
contrib/other/jumpnbump/sdl/jumpnbump128.xpm
Executable file
@ -0,0 +1,196 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char * jumpnbump_xpm[] = {
|
||||||
|
"128 128 65 1",
|
||||||
|
" c None",
|
||||||
|
". c #06070A",
|
||||||
|
"+ c #B6B6B6",
|
||||||
|
"@ c #F60202",
|
||||||
|
"# c #727272",
|
||||||
|
"$ c #B60202",
|
||||||
|
"% c #5A5C5D",
|
||||||
|
"& c #FC8622",
|
||||||
|
"* c #3A1602",
|
||||||
|
"= c #C6C6C6",
|
||||||
|
"- c #A6221A",
|
||||||
|
"; c #8E8E8E",
|
||||||
|
"> c #D6D6D6",
|
||||||
|
", c #FB8E24",
|
||||||
|
"' c #4A2A1A",
|
||||||
|
") c #E6E6E6",
|
||||||
|
"! c #CE7222",
|
||||||
|
"~ c #505252",
|
||||||
|
"{ c #A15A1F",
|
||||||
|
"] c #F79B37",
|
||||||
|
"^ c #FEB666",
|
||||||
|
"/ c #AE5A0A",
|
||||||
|
"( c #D66C16",
|
||||||
|
"_ c #DE6A18",
|
||||||
|
": c #EFEEEE",
|
||||||
|
"< c #7A0202",
|
||||||
|
"[ c #FEA640",
|
||||||
|
"} c #664833",
|
||||||
|
"| c #CCA085",
|
||||||
|
"1 c #2A2A32",
|
||||||
|
"2 c #895F38",
|
||||||
|
"3 c #3C3A3F",
|
||||||
|
"4 c #EAAE7C",
|
||||||
|
"5 c #A8805B",
|
||||||
|
"6 c #9E9E9E",
|
||||||
|
"7 c #FEC68E",
|
||||||
|
"8 c #BB5E0F",
|
||||||
|
"9 c #EE3A3A",
|
||||||
|
"0 c #AF5207",
|
||||||
|
"a c #FEAE42",
|
||||||
|
"b c #5A2A02",
|
||||||
|
"c c #F8F6F9",
|
||||||
|
"d c #636262",
|
||||||
|
"e c #CB6312",
|
||||||
|
"f c #E67215",
|
||||||
|
"g c #8E4202",
|
||||||
|
"h c #1D1C20",
|
||||||
|
"i c #6A3202",
|
||||||
|
"j c #7A685D",
|
||||||
|
"k c #A4500C",
|
||||||
|
"l c #F5781A",
|
||||||
|
"m c #7A7A7A",
|
||||||
|
"n c #F6CEA6",
|
||||||
|
"o c #4A4242",
|
||||||
|
"p c #FEDEBF",
|
||||||
|
"q c #FDFEFD",
|
||||||
|
"r c #D67A3A",
|
||||||
|
"s c #FDA64D",
|
||||||
|
"t c #7A3A02",
|
||||||
|
"u c #B64242",
|
||||||
|
"v c #FE7A12",
|
||||||
|
"w c #6A6A6A",
|
||||||
|
"x c #DE7A2A",
|
||||||
|
"y c #150D0C",
|
||||||
|
"z c #FEAE4C",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" 6;;66 ",
|
||||||
|
" 6;;66 ",
|
||||||
|
" 6;;;## ",
|
||||||
|
" mm 6;;;#### ",
|
||||||
|
" ##m mm;#dwmm ",
|
||||||
|
" ##m mm;mw#mm ",
|
||||||
|
" %%%~ m;;;#~% ",
|
||||||
|
" mm#=66 ~~~3 ;66#dmm ",
|
||||||
|
" ;;m+6666 ~~~3 #6;;%w66 ",
|
||||||
|
" ;;m+;666 + ~~~~3 #;;;%w66 ",
|
||||||
|
" ;;m+66;6 + ~~~~3 #6;;~w66 ",
|
||||||
|
" 666+++::66 66d6 ~%~~o m;6~%d6 ",
|
||||||
|
" 6>;;==qq6 +##~; ~%~%3w #6m~~; ",
|
||||||
|
" 6:++mm::6 +;ddw6 ~~dd1~ ;;m6#mm6 ",
|
||||||
|
" 6)++mm::6 +;ddw6 ~~dd1~ ;;m6wmm6 ",
|
||||||
|
" 6c::##==q6 ==;mddm+ ~%ww33 ;;;;;w666 ",
|
||||||
|
" ;)qq++66q6 ++6mmm+= %%##%o mmm6;m66; ",
|
||||||
|
" 6=qq))66:6 7744=+++666+ %%###m66 mm#6;;66 ",
|
||||||
|
" 6=qq))66)6 7744=+++666+ %%###m66 mmm6m;66 ",
|
||||||
|
" 6qqcc==)q66[]]]||===>=++= %om#m;;;;mmm6;;6; ",
|
||||||
|
" 4;::qq))>q66z[4z==>)))===> 33wwmmmmd;;;6;;;; ",
|
||||||
|
" 4;::qq))>q66a[44==>)))===> 3w#mmmmd;;;6;;;; ",
|
||||||
|
" 4;::qq))>q66s[44==>)))===> 3wwmmmmd;;;6;;;; ",
|
||||||
|
" za[[]5))cccc:cqq^[==>>)cc>=>>n^ 1%%mmmm#;;;m;m55 ",
|
||||||
|
" xszz[[[[[[[aa[|++ccqqcqqqn4==))c))>>==^]77|.oo#mmm##mm;;m55r{}2 ",
|
||||||
|
" e8zzaz[aa[s[sss[]jj==qqqqqqp=))::c)))>44s[[s,y11w###m;;;66666m1y.ii&&, ",
|
||||||
|
" 8ezzaas[a[sa[^sz]#j==qqqqqqp=))::c)))>44ss[s,.11d###m;;;66666m1.yii&&& ",
|
||||||
|
" 22]z[[z[[aas[^^77r|++ccqqqq:>))ccq::>=^4s[,,lb..ow##m;666;;666#yhxx&&&lvv, ",
|
||||||
|
" /zzzzzz[[z^zsn:ppccqqqcqqq:ccqqc))=^ss]&!!!*hh~w##;66666hw#+633tt,&&&&&&&&,,, ",
|
||||||
|
" txsszszsz^z77pcqqqqqqqqqqqqqqqqc))n]fffe88}}%ddw##;666661.y66mm''&&&&&&&&&&&&&&&] ",
|
||||||
|
" ta[zzz^^^7ppcqqqqqqqqqqqqqqqqqcqq4r_((822~~~~%w##m;m;6+w..d+66~}ff&&v&v&&&v&&v&&vlv ",
|
||||||
|
" t[[zza^^^7ppcqqqqqqqqcqqqqqqqqcqq4!((!822}~~~%d##m;;;6+w..%+66~}lf&&&&&v&&&&&&&&vvv ",
|
||||||
|
" 'ee^aaazs^:cqqqqqqqqqqqqqqqqqqqqqc^!!e0}t11oo%d##m;;;;6611166;ddflv&&,&&&v&&&&,&vs] ",
|
||||||
|
" '!!^zzzss^::qqqqqqqqqqqqqcqqqqqqqc^!!ekt}11oo%d##m;;;66611h6662j_l&&,,&&&&&&,,]&x ",
|
||||||
|
" bb,zszzs^::qqqqqqqqqqqqqqqqqqcqqqn!!e{''yh33%dwwm;;;;;6%dh666jjxx&&,&&v&&&&&&&& ",
|
||||||
|
" bb]zzzzz^::qqqqqqqqcqqqqqqqqqqqqqn!!ek''yy33%dwwm;m;;;6ddy666#jxxv&&,&&,,x&,&&& ",
|
||||||
|
" gzzs^s=))qqcc::qqqqccqqqqqqqccqq]]e{**yy33~%dd#mmm;;;mm3;;;mmrr],&&&,]]&,&&] ",
|
||||||
|
" *//lfr=::cq6666qqqqqqcqqqqqqqqqc44eg...h33o~%%wmm#m#;;;;;;;mm''g_&&,&&,vvss ",
|
||||||
|
" ikkffx+>>))hh66qqq:;;=qqqqqcqqqq77!g.y.13oo~~%w####mm;;;m55uubb**bb{8eess ",
|
||||||
|
" ik0ffr+>>))hy66qqq:;;=qqqqqcqqqq77!gy..1ooo~%%d####m#;;;;;5uubby*bbkeeess ",
|
||||||
|
" g00_fllvvvvlvr++);..::qqq;..>qqqqqqqqqqnnx0*y.1333o%%%ddww##w#m#99@@tttibb*b00&x ",
|
||||||
|
" kgkl&vvvvlvlvv&lvlrr|~yyccqqq~yhcqqqqqqqqqqnnx8**11*h13oo~%%%ddwwd%2--$$bbgkeef,]]]]zz ",
|
||||||
|
" t8vvvvvvvvvvvvvv&l822ppccc.ddqqqqqqqqqc:44!eii*yyyh133o~~~%~~oo~o<<tt00x&[[[sss[[]] ",
|
||||||
|
" t8vvvvvvvvvv&lvlll8{{ppcccyddqqqqqqqqqq:44!8ii*yhyy133o~~~%~~oo~~<<tt88x,[[[[[[[[]] ",
|
||||||
|
" 0/lvvl&lvll&lvvvvllllssp.66qqqqcqqqqqprreegg****y.yh11113o3~}2/__,][[[[[[[[[[[[[[] ",
|
||||||
|
" 00lv&lvvllvvv&vlvlvllssp.66qqqqccqqqqprre8gg****..hh11113o3}o2{__],[[[[[[[[[[[[[[, ",
|
||||||
|
" t8ll&vv&vlvvvvvvvlllfl{nnqcqqqqq::)=rree88k*yy.....hhh}{e!fv][[a[[[[[[[[[[[[[[[[[ ",
|
||||||
|
" {{_lvvvlv&lvlvvvlvvlv&&^:cccc:>>>|!feekg*.....y*t!x!l,]s[sz[[[[[[s][[][[[[[[[[]z ",
|
||||||
|
" {{(vlvvvvll&vvvllvvlv&&^ccccc:>>>|r!eekk*.....*ytf!fl,][[[z[[[[[[[s[[[[[][[[[[]z ",
|
||||||
|
" ikklf&v&lvvvlvvlvvlvvl,44===>>|!ee__ib..**gevv][sszz[zz[[[[s][[[[[[][[[[[[[[[, ",
|
||||||
|
" ibi**/&&&vvvl&vllvvvvllvv&l4|4re_(e_gg{l]][saazss[a[z[[s[s]zs[]s[[[[[[[[][[[[[]] ",
|
||||||
|
" iiiiiiiiiff&,&&lv&vlvllv&lll&l(_((fff&[[aszzasaas[aasa[sz[z[[[[s[[[[[[[[[[[[[[[[[[[ ",
|
||||||
|
" iiiiiiiiiff&&&&vlvvvvv&v&lllll__f_ffl&[[asazzsaasaaasa[zz[z[[[[[[[]s[[][[[[[[[[[[[[ ",
|
||||||
|
" iiiiiiiii**i8&&lv&&&&vlvf00ttbbb0e!fazssazzzs[ssaaa[sasaaszs][[azs[[[[s[[s][[[[[[[[ ",
|
||||||
|
" iiiiiiiiibiiiii((vvfe{kbiiiiiibbkekk]zzzzzasaz[[z[[[a[[zs[[zzs[sz[as]z[[]zs[s[[[[[[[ ",
|
||||||
|
" iiiiiiiiiiiiiiiiibb*iiiiiiiiiiii/_kk!zzzsszzzsaszzzz[z[aaaszs[[aaszss[sza[][[][][[], ",
|
||||||
|
" iiiiiiiiiiiiiiiiibb*iiiiiiiiiiii8_kkezzzssazzszazszs[z[aaz[zz[[aasass[saa[s[[s[][[]] ",
|
||||||
|
" iiiiiiiiiiiiiiiiibi*iiiiiiiiiiii/_kk!zzzzszzzzzzzazz]z[aaz[zzs]a[sas][saa[[[[[[]]] ",
|
||||||
|
" iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitt8f//0sszzzzzzszzzzzz[sassas[assaaz]zas[[ass][&! ",
|
||||||
|
" iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitte(eek!^^szzzsz[szazzzzs[[saaz[[zz[za]za[sx,!5d# ",
|
||||||
|
" iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitte(eek!^aaazzzzs]szzzzasaasazz[[zz[z[[sa[[,r58dw ",
|
||||||
|
" iiib-iiiiiiiiiiiiiiiiiiiiiiiiiitt_fee/k]]szzzzzzzszzazzz[[asaas]aazz[[]r5m#www#wd ",
|
||||||
|
" iiiiiibiiiiiiiiiiiiiiiiiiiiiiiigke__(/k//zszzzszzzss]szzssz[zszz[[,!88k2dd#mwww ",
|
||||||
|
" iiiiiib-iiiiiiiiiiiiiiiiiiiiiiikg(e((8kkk!^szzzsszszzzazzszz[[xx08kk00kwm#ww ",
|
||||||
|
" iiiiiiiibiiiiiiiiiiiiiiiiiiiiii0k_(((e0k0k]z^[zzzzzzzszszz,!/8k/k00000{w##ww ",
|
||||||
|
" iiiiiiiiiiib-iiiib-iiib-iiiiiiik0_(((8000g]^^szazzszzzzzzz]!80kk000000{w##ww ",
|
||||||
|
" iiiiiiiiiiiiibiiiiibiiiiibiiiii08(e((e0//k/[[zsszzzzz],r880k00000000002#m#wwmm ",
|
||||||
|
" iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiie8(e((e0//0k88s^]]x8//k0k00000000000000######w#w ",
|
||||||
|
" iiiiiiiiiiiiiiiiiiiiiiiiii-biii88(e((e///0k8ezz]]r08/00/000/000k000000j##m##www; ",
|
||||||
|
" iiiiiib-iiiiiiiiiiiiiiiiiiiiiii8e_e((e0//0ge8sz]]x/8/0kkk0k0k0000k0000######w#w; ",
|
||||||
|
" iiiiiibi-biiiiiiiiiiiiiiiiit!!(e((e/k/0/kk{e{0k000000000000k0000k{/w#w######w# ",
|
||||||
|
" iiiiiiiiiiiib-iiiiiiiiiiiit8e(ee(e/k0/{k0kkkk/kkk00/0k000k/0000022#w#########ww ",
|
||||||
|
" iiiiiiiiiibiiiiibiiiiikeeeeeee8//k/00/k//00000k0000k0000k0{2jj#############w ",
|
||||||
|
" iiiiiiiiib-iiiiiiiiiiigeeeeeee8//k/00/k//00k00000000000000{2jj#w############ ",
|
||||||
|
" iiiiiiiiiiibiiiiiiiiik__!eeee8kk//kk/0/0//kk00k0k/k00{{2jw#m######w#ww#wwwww ",
|
||||||
|
" b-iiiiiiiii-iiiiiiii0e(eeeeeekk/k00/k0k0kkk000000{22jj##################ww# ",
|
||||||
|
" iiiiiiiiibiiiiiiii/eeeeee8e00k/kk0k00k/k00/k{{jw##wwww############www;; ",
|
||||||
|
" iiiiiiiiiiiiiiiiii8ee8ee(8e00//kk0kk0k00k000{{jw#mwwww##m#########w#w;; ",
|
||||||
|
" iiiiiiiiiiiiiiii0eeee88ee000/kk/k0/k000k2jww#w##w#######ww#####w# ",
|
||||||
|
" iiiiiiiiiiiiii!eee8!8(888kk/00000k2j2j##ww#www###www#w#mw#dw ",
|
||||||
|
" iiiiiii-biiiieeee8eee888kk0k000/k2j2###ww#ww###wwwwww#m ",
|
||||||
|
" iiiibiiiiiiii!eee8eeee88kk000k0k{222j##wwmwww##w#wwwwwm ",
|
||||||
|
" iiiiiiibtte88!888/80000kk{222#www#ww##ww##wwdd#; ",
|
||||||
|
" iiiibbgk88e88e880!e{jjjw#ww##wwwmwww#wdd## ",
|
||||||
|
" tbbbkg!88/0//x wwww#www##mww##wdm ",
|
||||||
|
" tbbkk088! wwww##wwww#dw;; ",
|
||||||
|
" }bbk/088! wwww##w#ww#dw;; ",
|
||||||
|
" 88 ww#wwddd# ",
|
||||||
|
" www# ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
100
contrib/other/jumpnbump/sdl/jumpnbump32.xpm
Executable file
100
contrib/other/jumpnbump/sdl/jumpnbump32.xpm
Executable file
@ -0,0 +1,100 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char * jumpnbump_xpm[] = {
|
||||||
|
"32 32 65 1",
|
||||||
|
" c None",
|
||||||
|
". c #261814",
|
||||||
|
"+ c #B3B3B2",
|
||||||
|
"@ c #EC7818",
|
||||||
|
"# c #747373",
|
||||||
|
"$ c #B83A18",
|
||||||
|
"% c #6D6D6B",
|
||||||
|
"& c #C8C1BB",
|
||||||
|
"* c #6B3203",
|
||||||
|
"= c #DB8434",
|
||||||
|
"- c #E28A32",
|
||||||
|
"; c #DCCEC6",
|
||||||
|
"> c #CA7C30",
|
||||||
|
", c #A05618",
|
||||||
|
"' c #2A262A",
|
||||||
|
") c #999998",
|
||||||
|
"! c #F59239",
|
||||||
|
"~ c #9B4E10",
|
||||||
|
"{ c #EFE8E4",
|
||||||
|
"] c #FDB055",
|
||||||
|
"^ c #AB530B",
|
||||||
|
"/ c #3A363A",
|
||||||
|
"( c #8F8E8D",
|
||||||
|
"_ c #CE6915",
|
||||||
|
": c #6A4E3A",
|
||||||
|
"< c #BEB8B2",
|
||||||
|
"[ c #EF9A47",
|
||||||
|
"} c #F4F1F0",
|
||||||
|
"| c #C0691C",
|
||||||
|
"1 c #661834",
|
||||||
|
"2 c #C8A68C",
|
||||||
|
"3 c #434143",
|
||||||
|
"4 c #894209",
|
||||||
|
"5 c #C2610F",
|
||||||
|
"6 c #F79E3F",
|
||||||
|
"7 c #848482",
|
||||||
|
"8 c #504C4C",
|
||||||
|
"9 c #5E2E06",
|
||||||
|
"0 c #823E06",
|
||||||
|
"a c #F6C29E",
|
||||||
|
"b c #EAB68A",
|
||||||
|
"c c #967A60",
|
||||||
|
"d c #D6A67A",
|
||||||
|
"e c #8B6241",
|
||||||
|
"f c #B66016",
|
||||||
|
"g c #FDA542",
|
||||||
|
"h c #FCFCFD",
|
||||||
|
"i c #846A54",
|
||||||
|
"j c #E6A86C",
|
||||||
|
"k c #ABA7A5",
|
||||||
|
"l c #BA590C",
|
||||||
|
"m c #F8DCC2",
|
||||||
|
"n c #AE9276",
|
||||||
|
"o c #864C1E",
|
||||||
|
"p c #585757",
|
||||||
|
"q c #E0DDDB",
|
||||||
|
"r c #733403",
|
||||||
|
"s c #5E3A1E",
|
||||||
|
"t c #7B7B7B",
|
||||||
|
"u c #FEAA48",
|
||||||
|
"v c #F68627",
|
||||||
|
"w c #F97B13",
|
||||||
|
"x c #746D6A",
|
||||||
|
"y c #DAB69E",
|
||||||
|
"z c #B45A0F",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" )) ",
|
||||||
|
" x (7# ",
|
||||||
|
" )k p8 (## ",
|
||||||
|
" k)& ((p3 (%) ",
|
||||||
|
" }k<< kt(p8 7t( ",
|
||||||
|
" qq+h b+(+p%)7() ",
|
||||||
|
" )}{&6y;& 8#t7( ",
|
||||||
|
" vuuu[q}}bq{;]ppt7(|: ",
|
||||||
|
" >ugu]kqh{}{&[~3t((tsvwv ",
|
||||||
|
" ,=]]{hhhhh{-f8p7)px#@vvvvv ",
|
||||||
|
" ,]]}hhhhhhjo'8t(tp7@vvvvv ",
|
||||||
|
" ~>j{&{{}hhms.8%t7%cf|w!! ",
|
||||||
|
" ~__w@@nt})}hhm4./p%%#$*05! ",
|
||||||
|
" ^@www@=a<hhh;,..//8:$=66g6 ",
|
||||||
|
" ~_ww@w@6{hqdl119o=!uggggg ",
|
||||||
|
" *0_wwwwv[d_l~|6guuggggggg ",
|
||||||
|
" *9*~z_l~~~|6uuuugggugggggg ",
|
||||||
|
" ******9**45guu]uugugugg66! ",
|
||||||
|
" *********4_-]uuuuguuu[>c ",
|
||||||
|
" ***9*****~_^-]]]u6=zfi% ",
|
||||||
|
" ***r**9**l_^^[!=|^^^^x%% ",
|
||||||
|
" 9********l5z^||^^^^^,##x% ",
|
||||||
|
" ******r5_l^^^^^^^ex%%x%% ",
|
||||||
|
" ***r*055fz^^,^e%x####t# ",
|
||||||
|
" ****0_5l^^,exx%%#%%% ",
|
||||||
|
" **4555ex%%%%% ",
|
||||||
|
" *~l %x%## ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
132
contrib/other/jumpnbump/sdl/jumpnbump64.xpm
Executable file
132
contrib/other/jumpnbump/sdl/jumpnbump64.xpm
Executable file
@ -0,0 +1,132 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char * jumpnbump_xpm[] = {
|
||||||
|
"64 64 65 1",
|
||||||
|
" c None",
|
||||||
|
". c #171010",
|
||||||
|
"+ c #B2B2B2",
|
||||||
|
"@ c #E61E1A",
|
||||||
|
"# c #6E6C6B",
|
||||||
|
"$ c #C20606",
|
||||||
|
"% c #D0C6C4",
|
||||||
|
"& c #FA7A12",
|
||||||
|
"* c #411A05",
|
||||||
|
"= c #D06D19",
|
||||||
|
"- c #DA8636",
|
||||||
|
"; c #5B5B5B",
|
||||||
|
"> c #979696",
|
||||||
|
", c #F18A2D",
|
||||||
|
"' c #D9D6D4",
|
||||||
|
") c #7D0A5E",
|
||||||
|
"! c #BD752F",
|
||||||
|
"~ c #E8DED9",
|
||||||
|
"{ c #BABABA",
|
||||||
|
"] c #8B8A88",
|
||||||
|
"^ c #F28E39",
|
||||||
|
"/ c #724E32",
|
||||||
|
"( c #5A2A02",
|
||||||
|
"_ c #CA6410",
|
||||||
|
": c #E7E3DF",
|
||||||
|
"< c #FEB256",
|
||||||
|
"[ c #AB5309",
|
||||||
|
"} c #D69256",
|
||||||
|
"| c #EEEAEA",
|
||||||
|
"1 c #563216",
|
||||||
|
"2 c #828282",
|
||||||
|
"3 c #C26210",
|
||||||
|
"4 c #6A3202",
|
||||||
|
"5 c #875F3D",
|
||||||
|
"6 c #D5B5A0",
|
||||||
|
"7 c #832907",
|
||||||
|
"8 c #D9711E",
|
||||||
|
"9 c #EF9E49",
|
||||||
|
"0 c #F2F2F2",
|
||||||
|
"a c #302C2F",
|
||||||
|
"b c #7A7A7A",
|
||||||
|
"c c #C6AA92",
|
||||||
|
"d c #434043",
|
||||||
|
"e c #FECA96",
|
||||||
|
"f c #BA5A0A",
|
||||||
|
"g c #A64911",
|
||||||
|
"h c #FB8321",
|
||||||
|
"i c #E5A673",
|
||||||
|
"j c #AD621E",
|
||||||
|
"k c #505150",
|
||||||
|
"l c #7E6552",
|
||||||
|
"m c #A9A6A3",
|
||||||
|
"n c #F5B683",
|
||||||
|
"o c #843F05",
|
||||||
|
"p c #FAA23A",
|
||||||
|
"q c #9E5A26",
|
||||||
|
"r c #FAD6BA",
|
||||||
|
"s c #92765A",
|
||||||
|
"t c #974C0A",
|
||||||
|
"u c #FCFCFD",
|
||||||
|
"v c #F07616",
|
||||||
|
"w c #FEA847",
|
||||||
|
"x c #727272",
|
||||||
|
"y c #F5993F",
|
||||||
|
"z c #222026",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" >>> ",
|
||||||
|
" >>2b ",
|
||||||
|
" #x ]2b#x ",
|
||||||
|
" k;k 2]2x# ",
|
||||||
|
" 2+m ;dd ]>b#b ",
|
||||||
|
" ]mm>> ;ka >>#;> ",
|
||||||
|
" %>++0 ]] kkkd 22xx ",
|
||||||
|
" :+>m|> mx] ;k;a 2xx2 ",
|
||||||
|
" 0:bb': m2#> k;;d ]2b2> ",
|
||||||
|
" |u+m+u {m2b+ ;;#k 222>> ",
|
||||||
|
" %0''m0 n6++m> ;;#b> b]>>> ",
|
||||||
|
" m000%~mpyi6%%%+ ;k#2]]x]>> ",
|
||||||
|
" >:uu:%cww6%':'% d#bxb]]>] ",
|
||||||
|
" www!'u000|<i':0:%'n a;2b2]2]] ",
|
||||||
|
" ,wwwwww<}m|0uu|e6'00''%pnc.dxxxb]]]!j/ ",
|
||||||
|
" !<<pwwww<ws{{uuu:'|0|:'6wy,.z#x2]>>>]k.4-h ",
|
||||||
|
" j-wwww<w<e6%%uuu|:000:%iy-81zkb]>>2b]2dj&h&&, ",
|
||||||
|
" q-w<w<<e|uuuuu0uuuu0'p,_j/;;;b]>>#z;>]dv,,hhhhhhh ",
|
||||||
|
" t9<<<nruuuuuuuuuuuuri8f5ddk;x]]>]dd]c;8hhh,h,h^hh ",
|
||||||
|
" o-<<w<:uuuuuuuuuuuuue-[/aad;x2]>>;ax>#8&,,hhhh^h, ",
|
||||||
|
" 4!ww<nruuuuuuuuuuuuur-q4zzd;x2]>>#dx>x8h,,&hh,^h ",
|
||||||
|
" t-ww6:u0u0uuuuuuuuu09j*..d;#b22>bkb>b8^hh,^,hhy ",
|
||||||
|
" t8,c'0b+{u0{:uuuuuuej..zdk;#xx22xb]jooot=&yy ",
|
||||||
|
" f8&v=v&-cmz%:u'k:uuuuuur=*.zdd;;###xsxf@41((4_^^ ",
|
||||||
|
" t[vvv&&&&&v-#.|0u'k0uuuuu0r=*.aaakk;;##x5g$4otf=^yp ",
|
||||||
|
" [&&&&&&&&&f5~|0'buuuuuu0%=4*..zdkkk;kdk)7t8hpypppp ",
|
||||||
|
" 3&&&&&&&&&v&&nr+uuuuuu|}=o***.zaaadd/q3vpwwpppwwy ",
|
||||||
|
" t=&&&&&&&&&&v^ru0uu|:'}_ft*.)..z1q8h^wwwpwwppppww ",
|
||||||
|
" j8&&&&&&&&&&^n||0:'683g*)))(j8,^py<wwwpppwppppw ",
|
||||||
|
" of8&&&&&&&&h&pi{%c-_=4)((q,ppww<wwwppwwpwwwwppp ",
|
||||||
|
" 44(o=&&&&&&&&&&&^}-==vf!^wpwwwwwwwwpwwpppwpwpwppp ",
|
||||||
|
" 44444q_=vv&v=_=_=jf__,wpw<wwww<pwwwwpwwwppwwpppwww ",
|
||||||
|
" 44444444[[3gt(4444g_f9w<wwwwwwwpwwwwwwwwwwwpwwpppp ",
|
||||||
|
" 4444444444(*444444t_f9w<ww<<wwwwwwp<wwwwwwwppwppp^ ",
|
||||||
|
" 444444444444(447444g_f9<wwwww<w<p<wwwpwwpwwwwwy, ",
|
||||||
|
" 4444474447444444444[__-w<<<w<ww<pwwwwwwwwwwwy-!! ",
|
||||||
|
" 744444444(444444474[8_fyww<wwwwwwwwwwww<wwy!ssxx ",
|
||||||
|
" 444444444474444444o3__[f-<<ww<<w<ww<w,=_3!jx## ",
|
||||||
|
" 444444444444444444o38=f[[p<ww<w<<wy-=j[[[[q### ",
|
||||||
|
" 447(74444444474444g___f[[fwwwwwwy8f[[[[[[[lx## ",
|
||||||
|
" 4444444444444(4444g_==fqft=<98ff[[[[[[[[[[xxx## ",
|
||||||
|
" 4444447(7(47444474t___f[[t=9-8[[[[[[[[[g[[xxx### ",
|
||||||
|
" 444444444444444g=__3[f[[[[[[[[[[[[[[[[5xxbxx## ",
|
||||||
|
" 4444444444444of_=_3[[[[[j[[[[[[[[[[ql##x#xxx## ",
|
||||||
|
" 444444444444o___33[[[[[[[[[[[[[[qlxbxx######## ",
|
||||||
|
" 44444474444o3____[j[[[[[q[[[qql#xxxxxxxxxxxxx ",
|
||||||
|
" 444444444t3f3_ff[[[[[[[g[55####xxxxx#x##] ",
|
||||||
|
" 44444474t3__33[[[[[[[qq5#x######x#xx;x ",
|
||||||
|
" 444444t__33ff[[[qqll#xx######b ",
|
||||||
|
" 44444[_33j33q55l######x### ",
|
||||||
|
" 44(4[f3f3 #####x##x;## ",
|
||||||
|
" 4offf #######bb ",
|
||||||
|
" #x ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
568
contrib/other/jumpnbump/sdl/sound.c
Executable file
568
contrib/other/jumpnbump/sdl/sound.c
Executable file
@ -0,0 +1,568 @@
|
|||||||
|
/*
|
||||||
|
* sound.c
|
||||||
|
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2001 Chuck Mason <cemason@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Florian Schulze <crow@icculus.org>
|
||||||
|
*
|
||||||
|
* This file is part of Jump'n'Bump.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump 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.
|
||||||
|
*
|
||||||
|
* Jump'n'Bump is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "globals.h"
|
||||||
|
#include <limits.h>
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include "SDL.h"
|
||||||
|
|
||||||
|
#ifndef NO_SDL_MIXER
|
||||||
|
#include "SDL_mixer.h"
|
||||||
|
|
||||||
|
static Mix_Music *current_music = (Mix_Music *) NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sfx_data sounds[NUM_SFX];
|
||||||
|
|
||||||
|
static int SAMPLECOUNT = 512;
|
||||||
|
|
||||||
|
#define MAX_CHANNELS 32
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* loop flag */
|
||||||
|
int loop;
|
||||||
|
/* The channel step amount... */
|
||||||
|
unsigned int step;
|
||||||
|
/* ... and a 0.16 bit remainder of last step. */
|
||||||
|
unsigned int stepremainder;
|
||||||
|
unsigned int samplerate;
|
||||||
|
/* The channel data pointers, start and end. */
|
||||||
|
signed short* data;
|
||||||
|
signed short* startdata;
|
||||||
|
signed short* enddata;
|
||||||
|
/* Hardware left and right channel volume lookup. */
|
||||||
|
int leftvol;
|
||||||
|
int rightvol;
|
||||||
|
} channel_info_t;
|
||||||
|
|
||||||
|
channel_info_t channelinfo[MAX_CHANNELS];
|
||||||
|
|
||||||
|
/* Sample rate in samples/second */
|
||||||
|
int audio_rate = 44100;
|
||||||
|
int global_sfx_volume = 0;
|
||||||
|
/*
|
||||||
|
// This function loops all active (internal) sound
|
||||||
|
// channels, retrieves a given number of samples
|
||||||
|
// from the raw sound data, modifies it according
|
||||||
|
// to the current (internal) channel parameters,
|
||||||
|
// mixes the per channel samples into the given
|
||||||
|
// mixing buffer, and clamping it to the allowed
|
||||||
|
// range.
|
||||||
|
//
|
||||||
|
// This function currently supports only 16bit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void stopchan(int i)
|
||||||
|
{
|
||||||
|
if (channelinfo[i].data) {
|
||||||
|
memset(&channelinfo[i], 0, sizeof(channel_info_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// This function adds a sound to the
|
||||||
|
// list of currently active sounds,
|
||||||
|
// which is maintained as a given number
|
||||||
|
// (eight, usually) of internal channels.
|
||||||
|
// Returns a handle.
|
||||||
|
*/
|
||||||
|
int addsfx(signed short *data, int len, int loop, int samplerate, int channel)
|
||||||
|
{
|
||||||
|
stopchan(channel);
|
||||||
|
|
||||||
|
/* We will handle the new SFX. */
|
||||||
|
/* Set pointer to raw data. */
|
||||||
|
channelinfo[channel].data = data;
|
||||||
|
channelinfo[channel].startdata = data;
|
||||||
|
|
||||||
|
/* Set pointer to end of raw data. */
|
||||||
|
channelinfo[channel].enddata = channelinfo[channel].data + len - 1;
|
||||||
|
channelinfo[channel].samplerate = samplerate;
|
||||||
|
|
||||||
|
channelinfo[channel].loop = loop;
|
||||||
|
channelinfo[channel].stepremainder = 0;
|
||||||
|
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void updateSoundParams(int slot, int volume)
|
||||||
|
{
|
||||||
|
int rightvol;
|
||||||
|
int leftvol;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Set stepping
|
||||||
|
// MWM 2000-12-24: Calculates proportion of channel samplerate
|
||||||
|
// to global samplerate for mixing purposes.
|
||||||
|
// Patched to shift left *then* divide, to minimize roundoff errors
|
||||||
|
// as well as to use SAMPLERATE as defined above, not to assume 11025 Hz
|
||||||
|
*/
|
||||||
|
channelinfo[slot].step = ((channelinfo[slot].samplerate<<16)/audio_rate);
|
||||||
|
|
||||||
|
leftvol = volume;
|
||||||
|
rightvol= volume;
|
||||||
|
|
||||||
|
/* Sanity check, clamp volume. */
|
||||||
|
if (rightvol < 0)
|
||||||
|
rightvol = 0;
|
||||||
|
if (rightvol > 127)
|
||||||
|
rightvol = 127;
|
||||||
|
|
||||||
|
if (leftvol < 0)
|
||||||
|
leftvol = 0;
|
||||||
|
if (leftvol > 127)
|
||||||
|
leftvol = 127;
|
||||||
|
|
||||||
|
channelinfo[slot].leftvol = leftvol;
|
||||||
|
channelinfo[slot].rightvol = rightvol;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void mix_sound(void *unused, Uint8 *stream, int len)
|
||||||
|
{
|
||||||
|
/* Mix current sound data. */
|
||||||
|
/* Data, from raw sound, for right and left. */
|
||||||
|
register int sample;
|
||||||
|
register int dl;
|
||||||
|
register int dr;
|
||||||
|
|
||||||
|
/* Pointers in audio stream, left, right, end. */
|
||||||
|
signed short* leftout;
|
||||||
|
signed short* rightout;
|
||||||
|
signed short* leftend;
|
||||||
|
/* Step in stream, left and right, thus two. */
|
||||||
|
int step;
|
||||||
|
|
||||||
|
/* Mixing channel index. */
|
||||||
|
int chan;
|
||||||
|
|
||||||
|
/* Left and right channel */
|
||||||
|
/* are in audio stream, alternating. */
|
||||||
|
leftout = (signed short *)stream;
|
||||||
|
rightout = ((signed short *)stream)+1;
|
||||||
|
step = 2;
|
||||||
|
|
||||||
|
/* Determine end, for left channel only */
|
||||||
|
/* (right channel is implicit). */
|
||||||
|
leftend = leftout + (len/4)*step;
|
||||||
|
|
||||||
|
/* Mix sounds into the mixing buffer. */
|
||||||
|
/* Loop over step*SAMPLECOUNT, */
|
||||||
|
/* that is 512 values for two channels. */
|
||||||
|
while (leftout != leftend) {
|
||||||
|
/* Reset left/right value. */
|
||||||
|
dl = *leftout * 256;
|
||||||
|
dr = *rightout * 256;
|
||||||
|
|
||||||
|
/* Love thy L2 chache - made this a loop. */
|
||||||
|
/* Now more channels could be set at compile time */
|
||||||
|
/* as well. Thus loop those channels. */
|
||||||
|
for ( chan = 0; chan < MAX_CHANNELS; chan++ ) {
|
||||||
|
/* Check channel, if active. */
|
||||||
|
if (channelinfo[chan].data) {
|
||||||
|
/* Get the raw data from the channel. */
|
||||||
|
/* no filtering */
|
||||||
|
/* sample = *channelinfo[chan].data; */
|
||||||
|
/* linear filtering */
|
||||||
|
sample = (int)(((int)channelinfo[chan].data[0] * (int)(0x10000 - channelinfo[chan].stepremainder))
|
||||||
|
+ ((int)channelinfo[chan].data[1] * (int)(channelinfo[chan].stepremainder))) >> 16;
|
||||||
|
|
||||||
|
/* Add left and right part */
|
||||||
|
/* for this channel (sound) */
|
||||||
|
/* to the current data. */
|
||||||
|
/* Adjust volume accordingly. */
|
||||||
|
dl += sample * (channelinfo[chan].leftvol * global_sfx_volume) / 128;
|
||||||
|
dr += sample * (channelinfo[chan].rightvol * global_sfx_volume) / 128;
|
||||||
|
/* Increment index ??? */
|
||||||
|
channelinfo[chan].stepremainder += channelinfo[chan].step;
|
||||||
|
/* MSB is next sample??? */
|
||||||
|
channelinfo[chan].data += channelinfo[chan].stepremainder >> 16;
|
||||||
|
/* Limit to LSB??? */
|
||||||
|
channelinfo[chan].stepremainder &= 0xffff;
|
||||||
|
|
||||||
|
/* Check whether we are done. */
|
||||||
|
if (channelinfo[chan].data >= channelinfo[chan].enddata) {
|
||||||
|
if (channelinfo[chan].loop) {
|
||||||
|
channelinfo[chan].data = channelinfo[chan].startdata;
|
||||||
|
} else {
|
||||||
|
stopchan(chan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clamp to range. Left hardware channel. */
|
||||||
|
/* Has been char instead of short. */
|
||||||
|
/* if (dl > 127) *leftout = 127; */
|
||||||
|
/* else if (dl < -128) *leftout = -128; */
|
||||||
|
/* else *leftout = dl; */
|
||||||
|
|
||||||
|
dl = dl / 256;
|
||||||
|
dr = dr / 256;
|
||||||
|
|
||||||
|
if (dl > SHRT_MAX)
|
||||||
|
*leftout = SHRT_MAX;
|
||||||
|
else if (dl < SHRT_MIN)
|
||||||
|
*leftout = SHRT_MIN;
|
||||||
|
else
|
||||||
|
*leftout = (signed short)dl;
|
||||||
|
|
||||||
|
/* Same for right hardware channel. */
|
||||||
|
if (dr > SHRT_MAX)
|
||||||
|
*rightout = SHRT_MAX;
|
||||||
|
else if (dr < SHRT_MIN)
|
||||||
|
*rightout = SHRT_MIN;
|
||||||
|
else
|
||||||
|
*rightout = (signed short)dr;
|
||||||
|
|
||||||
|
/* Increment current pointers in stream */
|
||||||
|
leftout += step;
|
||||||
|
rightout += step;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* misc handling */
|
||||||
|
|
||||||
|
char dj_init(void)
|
||||||
|
{
|
||||||
|
Uint16 audio_format = MIX_DEFAULT_FORMAT;
|
||||||
|
int audio_channels = 2;
|
||||||
|
int audio_buffers = 4096;
|
||||||
|
|
||||||
|
open_screen();
|
||||||
|
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
audio_buffers = SAMPLECOUNT*audio_rate/11025;
|
||||||
|
|
||||||
|
memset(channelinfo, 0, sizeof(channelinfo));
|
||||||
|
memset(sounds, 0, sizeof(sounds));
|
||||||
|
|
||||||
|
#ifndef NO_SDL_MIXER
|
||||||
|
if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) {
|
||||||
|
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
|
||||||
|
main_info.no_sound = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
|
||||||
|
printf("Opened audio at %dHz %dbit %s, %d bytes audio buffer\n", audio_rate, (audio_format & 0xFF), (audio_channels > 1) ? "stereo" : "mono", audio_buffers);
|
||||||
|
|
||||||
|
Mix_SetMusicCMD(getenv("MUSIC_CMD"));
|
||||||
|
|
||||||
|
Mix_SetPostMix(mix_sound, NULL);
|
||||||
|
#else
|
||||||
|
main_info.no_sound = 1;
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_deinit(void)
|
||||||
|
{
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifndef NO_SDL_MIXER
|
||||||
|
Mix_HaltMusic();
|
||||||
|
if (current_music)
|
||||||
|
Mix_FreeMusic(current_music);
|
||||||
|
current_music = NULL;
|
||||||
|
|
||||||
|
Mix_CloseAudio();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_start(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_stop(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
char dj_autodetect_sd(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char dj_set_stereo(char flag)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_set_auto_mix(char flag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short dj_set_mixing_freq(unsigned short freq)
|
||||||
|
{
|
||||||
|
return freq;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_set_dma_time(unsigned short time)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_set_nosound(char flag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mix handling */
|
||||||
|
|
||||||
|
void dj_mix(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sfx handling */
|
||||||
|
|
||||||
|
char dj_set_num_sfx_channels(char num_channels)
|
||||||
|
{
|
||||||
|
return num_channels;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_set_sfx_volume(char volume)
|
||||||
|
{
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SDL_LockAudio();
|
||||||
|
global_sfx_volume = volume*2;
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_play_sfx(unsigned char sfx_num, unsigned short freq, char volume, char panning, unsigned short delay, char channel)
|
||||||
|
{
|
||||||
|
int slot;
|
||||||
|
|
||||||
|
if (main_info.music_no_sound || main_info.no_sound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (channel<0) {
|
||||||
|
for (slot=0; slot<MAX_CHANNELS; slot++)
|
||||||
|
if (channelinfo[slot].data==NULL)
|
||||||
|
break;
|
||||||
|
if (slot>=MAX_CHANNELS)
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
slot = channel;
|
||||||
|
|
||||||
|
SDL_LockAudio();
|
||||||
|
addsfx((short *)sounds[sfx_num].buf, sounds[sfx_num].length, sounds[sfx_num].loop, freq, slot);
|
||||||
|
updateSoundParams(slot, volume*2);
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
char dj_get_sfx_settings(unsigned char sfx_num, sfx_data *data)
|
||||||
|
{
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
memcpy(data, &sounds[sfx_num], sizeof(sfx_data));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char dj_set_sfx_settings(unsigned char sfx_num, sfx_data *data)
|
||||||
|
{
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
memcpy(&sounds[sfx_num], data, sizeof(sfx_data));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_set_sfx_channel_volume(char channel_num, char volume)
|
||||||
|
{
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SDL_LockAudio();
|
||||||
|
updateSoundParams(channel_num, volume*2);
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_stop_sfx_channel(char channel_num)
|
||||||
|
{
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SDL_LockAudio();
|
||||||
|
stopchan(channel_num);
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
char dj_load_sfx(unsigned char * file_handle, char *filename, int file_length, char sfx_type, unsigned char sfx_num)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned char *src;
|
||||||
|
unsigned short *dest;
|
||||||
|
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
sounds[sfx_num].buf = malloc(file_length);
|
||||||
|
|
||||||
|
memcpy(sounds[sfx_num].buf, file_handle, file_length);
|
||||||
|
|
||||||
|
sounds[sfx_num].length = file_length / 2;
|
||||||
|
src = sounds[sfx_num].buf;
|
||||||
|
dest = (unsigned short *)sounds[sfx_num].buf;
|
||||||
|
for (i=0; i<sounds[sfx_num].length; i++)
|
||||||
|
{
|
||||||
|
unsigned short temp;
|
||||||
|
temp = src[0] + (src[1] << 8);
|
||||||
|
*dest = temp;
|
||||||
|
src += 2;
|
||||||
|
dest++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_free_sfx(unsigned char sfx_num)
|
||||||
|
{
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
free(sounds[sfx_num].buf);
|
||||||
|
memset(&sounds[sfx_num], 0, sizeof(sfx_data));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mod handling */
|
||||||
|
|
||||||
|
char dj_ready_mod(char mod_num)
|
||||||
|
{
|
||||||
|
#ifndef NO_SDL_MIXER
|
||||||
|
FILE *tmp;
|
||||||
|
# if ((defined _MSC_VER) || (defined __MINGW32__))
|
||||||
|
char filename[] = "jnb.tmpmusic.mod";
|
||||||
|
# else
|
||||||
|
char filename[] = "/tmp/jnb.tmpmusic.mod";
|
||||||
|
# endif
|
||||||
|
unsigned char *fp;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
switch (mod_num) {
|
||||||
|
case MOD_MENU:
|
||||||
|
fp = dat_open("jump.mod");
|
||||||
|
len = dat_filelen("jump.mod");
|
||||||
|
break;
|
||||||
|
case MOD_GAME:
|
||||||
|
fp = dat_open("bump.mod");
|
||||||
|
len = dat_filelen("bump.mod");
|
||||||
|
break;
|
||||||
|
case MOD_SCORES:
|
||||||
|
fp = dat_open("scores.mod");
|
||||||
|
len = dat_filelen("scores.mod");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "bogus parameter to dj_ready_mod()\n");
|
||||||
|
fp = NULL;
|
||||||
|
len = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Mix_PlayingMusic())
|
||||||
|
Mix_FadeOutMusic(1500);
|
||||||
|
|
||||||
|
if (current_music) {
|
||||||
|
Mix_FreeMusic(current_music);
|
||||||
|
current_music = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fp == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = fopen(filename, "wb");
|
||||||
|
if (tmp) {
|
||||||
|
fwrite(fp, len, 1, tmp);
|
||||||
|
fflush(tmp);
|
||||||
|
fclose(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
current_music = Mix_LoadMUS(filename);
|
||||||
|
unlink(filename);
|
||||||
|
if (current_music == NULL) {
|
||||||
|
fprintf(stderr, "Couldn't load music: %s\n", SDL_GetError());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char dj_start_mod(void)
|
||||||
|
{
|
||||||
|
#ifndef NO_SDL_MIXER
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
Mix_VolumeMusic(0);
|
||||||
|
Mix_PlayMusic(current_music, -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_stop_mod(void)
|
||||||
|
{
|
||||||
|
#ifndef NO_SDL_MIXER
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Mix_HaltMusic();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_set_mod_volume(char volume)
|
||||||
|
{
|
||||||
|
#ifndef NO_SDL_MIXER
|
||||||
|
if (main_info.no_sound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Mix_VolumeMusic(volume);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
char dj_load_mod(unsigned char * file_handle, char *filename, char mod_num)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dj_free_mod(char mod_num)
|
||||||
|
{
|
||||||
|
}
|
24
contrib/other/jumpnbump/stub.c
Executable file
24
contrib/other/jumpnbump/stub.c
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
int SDL_JoystickGetAxis(void){return -1;}
|
||||||
|
int SDL_JoystickGetButton(void){return -1;}
|
||||||
|
int SDL_NumJoysticks (void) {return -1;}
|
||||||
|
int SDL_JoystickOpen(void) {return -1;}
|
||||||
|
|
||||||
|
Mix_VolumeMusic(void) {}
|
||||||
|
Mix_PlayMusic(void) {}
|
||||||
|
|
||||||
|
Mix_PlayingMusic(void) {}
|
||||||
|
Mix_FadeOutMusic(void) {}
|
||||||
|
|
||||||
|
Mix_FreeMusic(void) {}
|
||||||
|
Mix_LoadMUS(void) {}
|
||||||
|
|
||||||
|
Mix_HaltMusic(void) {}
|
||||||
|
|
||||||
|
Mix_CloseAudio(void) {}
|
||||||
|
|
||||||
|
Mix_OpenAudio(void) {}
|
||||||
|
Mix_QuerySpec(void) {}
|
||||||
|
Mix_SetMusicCMD(void) {}
|
||||||
|
Mix_SetPostMix(void) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user