Added Pachi el Martiano game, it's 640x480 so it's slow like hell
This commit is contained in:
@@ -33,10 +33,10 @@ rm -rf $LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so
|
||||
# ln -sf libsdl_mixer.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_Mixer.so
|
||||
#fi
|
||||
|
||||
#for F in $LOCAL_PATH/../../obj/local/armeabi/libsdl_*.so; do
|
||||
# LIBNAME=`echo $F | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_\(.*\)[.]so@\1@"`
|
||||
# ln -sf libsdl_$LIBNAME.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_$LIBNAME.so
|
||||
#done
|
||||
for F in $LOCAL_PATH/../../obj/local/armeabi/libsdl_*.so; do
|
||||
LIBNAME=`echo $F | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_\(.*\)[.]so@\1@"`
|
||||
ln -sf libsdl_$LIBNAME.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_$LIBNAME.so
|
||||
done
|
||||
|
||||
CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \
|
||||
-fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
|
||||
|
||||
3
project/jni/application/pachi/AUTHORS
Normal file
3
project/jni/application/pachi/AUTHORS
Normal file
@@ -0,0 +1,3 @@
|
||||
Santiago Radeff <dragontech.sourceforge.net> Coding
|
||||
Nicolas Radeff <dragontech.sourceforge.net> Drawing / Gfx
|
||||
Peter Hajba <www.futurecrew.com/skaven> Music
|
||||
30
project/jni/application/pachi/AndroidAppSettings.cfg
Normal file
30
project/jni/application/pachi/AndroidAppSettings.cfg
Normal file
@@ -0,0 +1,30 @@
|
||||
# The application settings for Android libSDL port
|
||||
AppSettingVersion=12
|
||||
LibSdlVersion=1.2
|
||||
AppName="Pachi el marciano"
|
||||
AppFullName=net.sourceforge.dragontech.pachi
|
||||
ScreenOrientation=h
|
||||
InhibitSuspend=n
|
||||
AppDataDownloadUrl="Game data is 30 Mb|http://sourceforge.net/projects/libsdl-android/files/Pachi/pachi.zip/download"
|
||||
SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=n
|
||||
NeedDepthBuffer=n
|
||||
AppUsesMouse=n
|
||||
AppNeedsArrowKeys=y
|
||||
AppUsesJoystick=y
|
||||
AppHandlesJoystickSensitivity=n
|
||||
AppUsesMultitouch=n
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="SPACE RETURN"
|
||||
AppTouchscreenKeyboardKeysAmount=2
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
MultiABI=n
|
||||
AppVersionCode=101
|
||||
AppVersionName="1.01"
|
||||
CompiledLibraries="sdl_mixer"
|
||||
CustomBuildScript=n
|
||||
AppCflags='-O2 -finline-functions'
|
||||
AppLdflags=''
|
||||
AppSubdirsBuild=''
|
||||
AppUseCrystaXToolchain=n
|
||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||
340
project/jni/application/pachi/COPYING
Normal file
340
project/jni/application/pachi/COPYING
Normal 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.
|
||||
450
project/jni/application/pachi/ChangeLog
Normal file
450
project/jni/application/pachi/ChangeLog
Normal file
@@ -0,0 +1,450 @@
|
||||
03-29-04
|
||||
|
||||
* one more code cleanup.
|
||||
* redrawed the "exit" tile.
|
||||
* cleaned the Makefiles
|
||||
|
||||
03-28-04
|
||||
|
||||
* corrected the volumes.
|
||||
* polished the menu background.
|
||||
* polished the menu font.
|
||||
* added the last comic sequence.
|
||||
* corrected some bugs.
|
||||
* writed the credits (thanks Paula Radeff).
|
||||
* added --fullscreen or -f parameter to the command line options.
|
||||
|
||||
03-21-04
|
||||
|
||||
* finished all the drawings of the game.
|
||||
|
||||
03-14-04
|
||||
|
||||
* fixed a level-design map (thanks to Dimitry from Moscow).
|
||||
|
||||
03-07-04
|
||||
|
||||
* drawed some comics for the transition from castle to lab.
|
||||
|
||||
10-05-03
|
||||
|
||||
* finished the cave comic and the castle intro draiwings/paintings.
|
||||
* the castle levelset is available (at least!).
|
||||
|
||||
06-18-03
|
||||
|
||||
* made objects sequence for levels of the castle.
|
||||
|
||||
05-27-03
|
||||
|
||||
* added an icon.
|
||||
|
||||
04-20-03
|
||||
|
||||
* fixed "pieces of objects left sometimes when grabbed" :-) .
|
||||
* added a link to the Debian packages (Mantained by Martin Godisch).
|
||||
|
||||
04-19-03
|
||||
|
||||
* fixed object sequence errors (mainly in 5th stage). -Thanks to Ivonne Dekker for the report-
|
||||
* fixed (i hope so) a monsters colission bug (in the 2nd stage). -thanks to Martin Godisch for the report-
|
||||
|
||||
02-24-03
|
||||
|
||||
* added the cave stage poster.
|
||||
* added the second part of the comic.
|
||||
|
||||
02-23-03
|
||||
|
||||
* painted the second part of the comic.
|
||||
* improved the intro-comic.
|
||||
* done the cave stage poster.
|
||||
* the hint-arrows are displayed 4 times instead of 2.
|
||||
* changed the channel for playing the objseq sample (it caused a noise on my rh8).
|
||||
|
||||
02-09-03
|
||||
|
||||
* added hint arrows (in the first 3 stages).
|
||||
* added first stage poster.
|
||||
* added pause feature.
|
||||
* bugfixes - code cleanup.
|
||||
* started improve intro-comic.
|
||||
* the game starts in fullscreen mode (again).
|
||||
|
||||
02-02-03
|
||||
|
||||
* added intro-comic to the intro
|
||||
|
||||
01-28-03
|
||||
|
||||
* improved titlescreen to be fri (framerate independent).
|
||||
* improved object fading (to be fri and to not leave gamearea).
|
||||
* added a monster (the blob).
|
||||
|
||||
01-27-03
|
||||
|
||||
* drawed a monster (the pipe).
|
||||
* code cleanup.
|
||||
* added intro (titlescreen).
|
||||
* added roommap (to see wich rooms of the current stage are near).
|
||||
* added fadeback() function.
|
||||
* implemented fadeback() to return from game to menu.
|
||||
* improved the menu background.
|
||||
|
||||
01-26-03
|
||||
|
||||
* code cleanup
|
||||
* removed many global variables
|
||||
* removed the powerups feature
|
||||
|
||||
01-06-03
|
||||
|
||||
* code changes
|
||||
* some functions now are called with the x and y params.
|
||||
* removed global variables x and y.
|
||||
|
||||
01-05-03
|
||||
|
||||
* the laboratory rooms are being made (very big!)
|
||||
|
||||
12-15-02
|
||||
|
||||
* Major code cleanup
|
||||
made a struct for the player.
|
||||
many more.
|
||||
* removed fps counter (no need).
|
||||
* added powerup counter (for future powerups feature).
|
||||
* added a dificulty feature, in diferent dificulty levels there is a diferent
|
||||
colission tolerance between monsters and player.
|
||||
* added powerup feature!!!.
|
||||
now every x special objects collected, the player can choose for
|
||||
a powerup (like MSX classic "Nemesis").
|
||||
|
||||
The powerups are:
|
||||
Slowmonsters -> the monsters move 30pix./sec. slower. (done)
|
||||
Superspeed -> the player moves 50pix./sec. faster and the jump becomes longer. (done)
|
||||
Superjump -> the player jumps 50% higher.(done)
|
||||
Slowfall -> the player falls 50% slower.
|
||||
Tiny -> the player is 50% it's size but have the same habilities as normal.
|
||||
|
||||
12-10-02
|
||||
|
||||
* game ported to BeOS (Thanks to Shard)
|
||||
* added handling when click on "Close Window Button" (only works on menu).
|
||||
* added exit game (from menu) pressing ESCAPE key.
|
||||
|
||||
12-07-02
|
||||
|
||||
* updated the data files objects.dat and rooms.dat
|
||||
- now the game can have 50 stage (before 25).
|
||||
- the objects now can have a sequence to be picked
|
||||
|
||||
* added FX (bright_obj). when an object is the next in the
|
||||
sequence to be picked it shows a nice starry FX.
|
||||
|
||||
12-08-02
|
||||
|
||||
* added joystick support by Gorka Olaizola.
|
||||
|
||||
12-01-02
|
||||
|
||||
* major code cleanup.
|
||||
* the game is installable!!! (Thanks (a lot)to Gorka Olaizola)
|
||||
* now you can do:
|
||||
./configure
|
||||
make
|
||||
make install (as root)
|
||||
|
||||
11-28-02
|
||||
|
||||
* the respawn fx is framerate independent.
|
||||
|
||||
11-17-02
|
||||
|
||||
* started making specialFX.
|
||||
* done the respawn FX (with sound).
|
||||
* done the pickobject FX.
|
||||
* done the thunder FX.
|
||||
|
||||
11-10-02
|
||||
|
||||
* its been a long time without updating the changelog...
|
||||
|
||||
things that has been done:
|
||||
|
||||
* Redrawed the sword enemy.
|
||||
* Drawed MANY castle backgrounds.
|
||||
* Drawed MANY objects.
|
||||
* Drawed a couple of tiles.
|
||||
* Drawed the living-dead head and the spinning axe enemies.
|
||||
* Changed the goblin for the bat (now the goblin is in the caves and the bat in the castle).
|
||||
* Made MANY levels, today i think i will finish level 15!!!.
|
||||
* Deleted the music ctgoblin.s3m (only one music for each landscape).
|
||||
* Added castle music.
|
||||
* Added an animation when Pachi is standing (not definitive).
|
||||
|
||||
and maybe more things... in don't remember
|
||||
|
||||
10-30-02
|
||||
|
||||
* Implemented .T8 file format for graphics.
|
||||
* Reduced graphics size from 15Mb to 5Mb (uncompresed) without loosing visual quality.
|
||||
|
||||
|
||||
10-28-02
|
||||
|
||||
* added framerate counter (pressing [F1]).
|
||||
|
||||
10-27-02
|
||||
|
||||
* drawed one more enemy for the caves (the looking eye).
|
||||
* fixed (i hope) a bug that made Pachi falls in some circumstances (doing [alt]+[tab] in windows for example).
|
||||
* thanks to that bugfix now is available (again) the windowed game mode.
|
||||
|
||||
10-20-02
|
||||
|
||||
* Fixed a visual bug (when Pachi stayed very near an enemy, the Pachi "sprite box" was displayed above the enemy).
|
||||
* Drawed two more enemyes for the caves (the pike and the blinking eye).
|
||||
* Changed the music for the caves.
|
||||
|
||||
10-16-02
|
||||
|
||||
* Now codes are available for every stage.
|
||||
|
||||
10-15-02
|
||||
|
||||
* Fixed a bug. (when the player falls one room down, it (sometimes) falls 2).
|
||||
* some floor collision detection bugfixes.
|
||||
|
||||
10-10-02
|
||||
|
||||
* Eliminated windowed game mode (causes a lot of bugs... i'm working on that).
|
||||
|
||||
10-09-02
|
||||
|
||||
* Improved web graphics.
|
||||
* Corrected (at last) the sound in windows (thanks to Sam Latinga for his hint).
|
||||
|
||||
10-07-02
|
||||
|
||||
* added the showcode(); routine to display the code to the next stage.
|
||||
* When the game is won ask for the name to put it in the hall of fame.
|
||||
|
||||
10-04-02
|
||||
|
||||
* added a couple of backgrounds.
|
||||
|
||||
10-03-02
|
||||
|
||||
* a couple of new levels.
|
||||
* added a "Please wait game data loading" when press start game in the main menu.
|
||||
|
||||
09-26-02
|
||||
|
||||
* added hall of fame.
|
||||
* made hall of fame background from the "la calavera del jardinero" sketch.
|
||||
* changed font in hall of fame.
|
||||
|
||||
09-25-02
|
||||
|
||||
* corrected jump control now the max height of the jump is in pixels instead of
|
||||
loops.
|
||||
* adjusted monsters speed in hard level.
|
||||
* recentered the menu options in the main menu.
|
||||
* added a timer and each dificulty level has different time to complete stages.
|
||||
* in the easy dificulty level, the player jumps 10 pixels more high than the
|
||||
other levels.
|
||||
* added sound when the timer is <= 10.
|
||||
* when a stage is completed the player earns 45*difficulty points for each second left.
|
||||
|
||||
09-24-02
|
||||
|
||||
* the game has now faster gameplay.
|
||||
* implemented frame rate independent movement, now the game has the
|
||||
same game speed in every computer.
|
||||
* added 3 difficulty levels to the main menu.
|
||||
* corrected collision detection, it may fail on VERY slow systems.
|
||||
* corrected animation function to be frame rate independent.
|
||||
|
||||
09-23-02
|
||||
|
||||
* added new enemy (the sword).
|
||||
* finished level 6.
|
||||
* added screen blinking and sound when collected the las object of the stage.
|
||||
* improved blinkscreen() to pass the RGB values to blink with.
|
||||
|
||||
09-22-02
|
||||
|
||||
* corrected a small but ugly bug that made the sound very choppy under some
|
||||
windows systems.
|
||||
* improved a bit the jump behavior (now it is less linear).
|
||||
|
||||
09-21-02
|
||||
|
||||
* drawed a new enemy (the goblin's head).
|
||||
* redrawed some tiles.
|
||||
* added new tiles.
|
||||
* edited some levels with the new tiles.
|
||||
* started level 6 (the caves).
|
||||
|
||||
09-20-02
|
||||
|
||||
* translated the ChangeLog to english (well at least my english...).
|
||||
|
||||
09-19-02
|
||||
|
||||
* improved CODE routine on the main menu.
|
||||
* changed some tiles to change the game aspect not to look too blocky.
|
||||
* changed the compile script to use GNU autotool (configure / make).
|
||||
thanks to Daniel T. Chen (crimsun@email.unc.edu).
|
||||
|
||||
09-18-02
|
||||
|
||||
* added a routine to enter a stage code on the main manu.
|
||||
* added sound to the enter CODE on the menu when the code is correct or incorrect.
|
||||
|
||||
09-17-02
|
||||
|
||||
* the page is submitted to Linuxgames, Happypenguin and Freshmeat.
|
||||
|
||||
09-16-02
|
||||
|
||||
* first release of the game demo.
|
||||
* remade the web page (dragontech.sourceforge.net).
|
||||
* the page is uploaded to sourceforge.
|
||||
|
||||
09-15-02
|
||||
|
||||
* decided use the GPL license for the game.
|
||||
* added to the main menu the option HELP and SCREEN (to change the display
|
||||
mode between full screen or windowed).
|
||||
* added a sound to the main menu when moving between options.
|
||||
|
||||
09-14-02
|
||||
|
||||
* changed main screen font and placed in a panel.
|
||||
* added cursor and keypad keys to the game.
|
||||
* started to make a web page.
|
||||
|
||||
09-13-02
|
||||
|
||||
* changed the SDL_LoadBMP for LoadT (.T files are now used).
|
||||
* added a menu to the main screen (just PLAY and EXIT work).
|
||||
* Nicolas (Graphic artist) gone hollyday.
|
||||
|
||||
09-11-02 (code cleanup)
|
||||
|
||||
* remade the loops of the game (intro, menu, etc.).
|
||||
|
||||
09-09-02
|
||||
|
||||
* convert of all the surfaces to DisplayFormat for faster blitting.
|
||||
* the main screen text side scroll is deleted.
|
||||
|
||||
09-08-02
|
||||
|
||||
* the main screen is started to be drawed, i think i will eliminate the text
|
||||
side scroll.
|
||||
|
||||
09-07-02
|
||||
|
||||
* added new graphics for the cemmentery background (evil trees)
|
||||
those were drawed some time ago.
|
||||
* added music in the main screen.
|
||||
* now the end credits dont exit when the credits finish, it loops.
|
||||
* added new (and last) level of cemmentery.
|
||||
* chaged the object counter variable.
|
||||
* added to the score panel a stage title.
|
||||
* changed font for the stage title (same but different color) in the score panel.
|
||||
* the monster-monster collision is corrected again.
|
||||
* added new object graphic (blue gem).
|
||||
|
||||
09-05-02
|
||||
|
||||
* added some new graphics for the second landscape (not level yet).
|
||||
|
||||
09-03-02
|
||||
|
||||
* at last i think the monster-monster collission detection is fine.
|
||||
|
||||
09-02-02
|
||||
|
||||
* corrected a bug that stopped the music twice causing a segfault when you
|
||||
complete the last level and returned to the main screen.
|
||||
* added a object counter on the score panel (thank Gabriel Radeff for the idea).
|
||||
* added a code that is used to select the music for each stage.
|
||||
|
||||
09-01-02
|
||||
|
||||
* improved (again) the print_text() routine, so the font can be selected
|
||||
when calling it.
|
||||
* added end credits screem with vertical text scroll over a graphic.
|
||||
* added music to the end credits.
|
||||
|
||||
08-31-02
|
||||
|
||||
* level 4 fixed.
|
||||
* fixed a problem when te character entered a room in duck state and
|
||||
loose a life, it reapears one tile below (cause of the heigh is the
|
||||
half when ducked).
|
||||
|
||||
08-24-02
|
||||
|
||||
* new level (4).
|
||||
* changed the acces mode for files to binary, before the levels
|
||||
were not correctly readed in windows.
|
||||
* new tiles.
|
||||
* added "set score to 0" when exiting game.
|
||||
|
||||
08-23-02
|
||||
|
||||
* added the jumping frame.
|
||||
* added a screen blink and sound when loose a life.
|
||||
|
||||
08-21-02
|
||||
|
||||
* improved the print_text() routine to print static text.
|
||||
* added score, lives and level indicator to the gamepanel.
|
||||
* changed font for the scores.
|
||||
* when the character jumps and touches the head with a tile,
|
||||
the jump ends and he starts falling.
|
||||
* added the falling frame for Pachi.
|
||||
* added some tiles.
|
||||
|
||||
08-20-02
|
||||
|
||||
* drawed Pachi falling.
|
||||
* drawed cementery poster (end-credits).
|
||||
|
||||
08-19-02
|
||||
|
||||
* completed the animation frames of Pachi walking.
|
||||
* change of the color of "The Death" monster (before brown, now some sort of cyan).
|
||||
|
||||
08-02-02
|
||||
|
||||
* now Pachi have 10 animation frames for each action.
|
||||
* completed the animation of Pachi ducked.
|
||||
* the monsters detect when collide with another monster and change the direction.
|
||||
* two more playable levels.
|
||||
* the gamepanel is changed.
|
||||
|
||||
|
||||
07-31-02 (code cleanup)
|
||||
|
||||
* Begin of loging.
|
||||
* change some variable names:
|
||||
P_ afect player.
|
||||
M_ afect monsters.
|
||||
R_ afect rooms.
|
||||
* added more comments to the code.
|
||||
* deleted the delay routine an the timing.h file.
|
||||
* deleted tileheight and tilewidth variables, now just using tileside.
|
||||
* changed keyboard handling, now when you release the direction keys the
|
||||
character stops moving.
|
||||
* corrected an error that maked posible to duck in the air if falling down
|
||||
(not jumping).
|
||||
* now the character have more animation frames for each action it takes
|
||||
(walk, jump, fall, duck) for now only the walking frames are done.
|
||||
* started adding music.
|
||||
* added sounds for jumping and for picking objects.
|
||||
7
project/jni/application/pachi/INSTALL
Normal file
7
project/jni/application/pachi/INSTALL
Normal file
@@ -0,0 +1,7 @@
|
||||
Just do
|
||||
|
||||
./configure
|
||||
make
|
||||
make install (as root).
|
||||
|
||||
Thanks to Gorka Olaizola (http://helvelte.escomposlinux.org)
|
||||
1
project/jni/application/pachi/NEWS
Normal file
1
project/jni/application/pachi/NEWS
Normal file
@@ -0,0 +1 @@
|
||||
see the ChangeLog.
|
||||
2
project/jni/application/pachi/README
Normal file
2
project/jni/application/pachi/README
Normal file
@@ -0,0 +1,2 @@
|
||||
Pachi el marciano is a cool 2D platforms game inspired in games like
|
||||
Manic Miner, Jet set Willy and more from the 80s.
|
||||
33
project/jni/application/pachi/config.h
Normal file
33
project/jni/application/pachi/config.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
/* #undef STDC_HEADERS */
|
||||
|
||||
#define DATADIR "."
|
||||
#define SCOREDIR "."
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H
|
||||
|
||||
/* Define if you have the pthread library (-lpthread). */
|
||||
/* #undef HAVE_LIBPTHREAD */
|
||||
|
||||
/* Define if you have the SDL_mixer library (-lSDL_mixer). */
|
||||
#define HAVE_LIBSDL_MIXER 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "pachi"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.1"
|
||||
|
||||
56
project/jni/application/pachi/src/credits.h
Normal file
56
project/jni/application/pachi/src/credits.h
Normal file
@@ -0,0 +1,56 @@
|
||||
char creditstext[] =
|
||||
" CONGRATULATIONS!!! \0"
|
||||
" YOU WON THE GAME!! \0"
|
||||
" \0"
|
||||
" NOW THANKS TO YOU, \0"
|
||||
" THE MISTERY IS SOLVED AND PACHI \0"
|
||||
" WILL BE ABLE TO GO BACK TO MARS, \0"
|
||||
" PLAY martian memory \0"
|
||||
" AND VISIT \0"
|
||||
" dragontech.sourceforge.net \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" AND NOW THE CREDITS \0"
|
||||
" \0"
|
||||
" PROJECT MANAGER, PROGRAMMER: \0"
|
||||
" santiago radeff \0"
|
||||
" \0"
|
||||
" DRAWINGS, PACHI FATHER \0"
|
||||
" nicolas radeff \0"
|
||||
" \0"
|
||||
" GRAPHICS: \0"
|
||||
" nicolas radeff \0"
|
||||
" santiago radeff \0"
|
||||
" \0"
|
||||
" MUSICS COMPOSED BY \0"
|
||||
" peter -skaven- hajba \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" THANKS TO THE PROGRAMMERS, \0"
|
||||
" AND PLAYERS FOR THEIR SUPPORT \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" \0"
|
||||
" ThAnKs fOr pLaYiNg \0"
|
||||
" \0";
|
||||
int creditslines = 46; // esta variable determina cuantas lineas de texto hay en los creditos
|
||||
|
||||
|
||||
int creditslinecounter = 0; // esta variable almacena que linea de texto dee imprimirse (es un contador)
|
||||
int needinput = 1; // esta variable indica si debe imprimirse una nueva linea de texto en los creditos
|
||||
int linegone = 0; // esta variable indica cuando una linea de texto ya hizo scroll por completo para imprimir la proxima
|
||||
int wrapcounter = 0; // esta variable es un contador que una vez que termino el texto de los creditos empieza a incrementarse y cuando llega a cierto valor reinicia los creditos
|
||||
char curchar;
|
||||
int charcounter;
|
||||
130
project/jni/application/pachi/src/definitions.h
Normal file
130
project/jni/application/pachi/src/definitions.h
Normal file
@@ -0,0 +1,130 @@
|
||||
SDL_Joystick * joystick;
|
||||
enum joynames {JOY_LEFT, JOY_RIGHT, JOY_UP, JOY_DOWN, JOY_BUTTON0, JOY_BUTTON1};
|
||||
Uint8 joypos[JOY_BUTTON1+1]={0,0,0,0,0,0};
|
||||
// --- Screen related
|
||||
#define screen_w 800
|
||||
#define screen_h 600
|
||||
#define screen_bpp 16
|
||||
|
||||
// --- Room related
|
||||
#define R_tileside 32
|
||||
#define R_maxobjects 5
|
||||
#define R_max_x 40
|
||||
#define R_max_y 10
|
||||
#define R_gamearea_x 28
|
||||
#define R_gamearea_y 15
|
||||
#define R_maxtiles_h 23
|
||||
#define R_maxtiles_v 14
|
||||
#define R_back_x 92
|
||||
#define R_back_y 112
|
||||
#define R_maxbacks_h 8
|
||||
#define R_maxbacks_v 4
|
||||
int R_current; // habitacion actual
|
||||
int R_backdata[R_maxbacks_h][R_maxbacks_v]; //esta matriz contiene la informacion sobre el fondo del nivel actual
|
||||
int R_x; // variable utilizada para ubicar la habitacion actual en la matriz
|
||||
int R_y; // variable utilizada para ubicar la habitacion actual en la matriz
|
||||
int R_object;
|
||||
int roommap[R_max_x][R_max_y]; // mapeado de habitaciones, aca se comprueba que habitaciones pertenecen a cada stage
|
||||
int chk_exits;
|
||||
|
||||
int objects; // cantidad de objetos en la stage actual
|
||||
|
||||
int score = 0;
|
||||
int gameexit, startgame, help, hiscores;
|
||||
|
||||
// --- Timing related
|
||||
double playtime;
|
||||
double roomtime;
|
||||
|
||||
// -- FX related
|
||||
int brightframe;
|
||||
int sequence; // variable que almacena cual es el objeto siguiente en la secuencia (para recogerlos por orden)
|
||||
int fadingobject; // esta variable indica si un objeto es esta desvaneciendo
|
||||
float alphade;
|
||||
#define arrow_left 1
|
||||
#define arrow_right 2
|
||||
#define arrow_up 3
|
||||
#define arrow_down 4
|
||||
|
||||
int namechar;
|
||||
int gameover=0;
|
||||
|
||||
// --- Scores related
|
||||
char playername[]=" ";
|
||||
char scorename[10][10];
|
||||
int scorestage[10];
|
||||
int scoretime[10];
|
||||
int scoredif[10];
|
||||
int scorescore[10];
|
||||
int scorepos;
|
||||
|
||||
int codechar;
|
||||
char code[]="....";
|
||||
int inputloop;
|
||||
|
||||
int menuvalue = 1;
|
||||
int fullscreen = 1;
|
||||
int dificulty = 2;
|
||||
|
||||
// --- Monsters related
|
||||
#define M_w 48
|
||||
#define M_h 48
|
||||
#define M_frames 6
|
||||
#define M_max4room 10
|
||||
#define M_easyspeed 130
|
||||
#define M_normalspeed 150
|
||||
#define M_hardspeed 200
|
||||
|
||||
int M_type[M_max4room];// el 10 es el maximo de monstruos en pantalla
|
||||
float M_x[M_max4room]; // el 10 es el maximo de monstruos en pantalla
|
||||
float M_y[M_max4room];// el 10 es el maximo de monstruos en pantalla
|
||||
float M_old_x[M_max4room];// el 10 es el maximo de monstruos en pantalla
|
||||
float M_old_y[M_max4room];// el 10 es el maximo de monstruos en pantalla
|
||||
int M_direction[M_max4room]; // estas variables se usan para saber si el monstruo va hacia un lado o hacia otro
|
||||
int M_frame = 1;
|
||||
int monsters_c; // cantidad de monstruos en la pantalla actual
|
||||
int M_initspeed=M_normalspeed;
|
||||
int M_speed[4];
|
||||
SDL_Rect monstersrc;
|
||||
SDL_Rect monsterpos;
|
||||
SDL_Rect monsterposreal;
|
||||
SDL_Rect oldmonsterpos;
|
||||
SDL_Rect oldmonsterposreal;
|
||||
|
||||
|
||||
// --- Player related
|
||||
#define maxlives 10
|
||||
#define P_h 64
|
||||
#define P_w 48
|
||||
int respawned=0; // variable que indica cuando el personaje termino de aparecer despues de morirse
|
||||
SDL_Rect playersrc; // esto es para leer del bmp del player el frame a imprimir
|
||||
SDL_Rect playerpos; // esta es la posicion en la pantalla del player (sin contar los bordes del panel)
|
||||
SDL_Rect playerposreal; // esta es la posicion en la pantalla del player (contando los bordes del panel) se utiliza automaticamente
|
||||
SDL_Rect oldplayerpos; //esta es la posicion que abandona el player
|
||||
SDL_Rect oldplayerposreal; //esta es la posicion que abandona el player (contando los bordes del panel)
|
||||
|
||||
// --- Timing related
|
||||
Uint32 lasttime=0;
|
||||
Uint32 curtime=0;
|
||||
double imove=0;
|
||||
double gametimer=0;
|
||||
int minutes, seconds;
|
||||
int oldsec; // variable que almacena el valor de los segundos
|
||||
|
||||
float animcounter = 0; //contador usado para las animaciones de los enemigos y del personaje
|
||||
|
||||
int escape_exit;
|
||||
int game_exit;
|
||||
|
||||
// --- Stage Related
|
||||
#define NUM_STAGES 16
|
||||
|
||||
#define CEMETERY 1
|
||||
#define CAVES 7
|
||||
#define CASTLE 10
|
||||
#define LAB 16
|
||||
#define END 17
|
||||
|
||||
int startstage = 0; // stage inicial
|
||||
int stage; //stage actual
|
||||
int stagecompleted = 0; // esta variable es un flag que se pone en 1 cuando se agarran todos los objetos del nivel
|
||||
94
project/jni/application/pachi/src/faes.cpp
Normal file
94
project/jni/application/pachi/src/faes.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<stdarg.h>
|
||||
#include<string.h>
|
||||
#include<SDL/SDL.h>
|
||||
#include<SDL/SDL_mixer.h>
|
||||
|
||||
#include"definitions.h"
|
||||
#include"structs.h"
|
||||
#include"surfaces.h"
|
||||
#include"sounds.h"
|
||||
#include"config.h"
|
||||
#include"proto.h"
|
||||
#include"credits.h"
|
||||
|
||||
#include"text.h"
|
||||
#include"init.h"
|
||||
#include"gfx.h"
|
||||
#include"input.h"
|
||||
#include"file.h"
|
||||
#include"output.h"
|
||||
#include"stages.h"
|
||||
#include"menu.h"
|
||||
#include"intro.h"
|
||||
#include"gameover.h"
|
||||
#include"player.h"
|
||||
#include"monsters.h"
|
||||
#include"game.h"
|
||||
#include"fx.h"
|
||||
#include"setgame.h"
|
||||
|
||||
void flushevents()
|
||||
{
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event)==1);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
initsdl();
|
||||
|
||||
if(argc > 1)
|
||||
if(strcmp(argv[1], "--fullscreen")==0 || strcmp(argv[1], "-f")==0)
|
||||
screen_mode();
|
||||
|
||||
gameexit=0;
|
||||
startgame=0;
|
||||
intro();
|
||||
init_stages(); // carga los valores de los niveles del juego
|
||||
load_roommap(); // carga el mapeado de habitaciones
|
||||
while(gameexit==0)
|
||||
{
|
||||
flushevents();
|
||||
menu();
|
||||
if(startgame==1)
|
||||
{
|
||||
startgame=0;
|
||||
start_game();
|
||||
}
|
||||
if(help==1)
|
||||
{
|
||||
help=0;
|
||||
do_help();
|
||||
}
|
||||
if(hiscores==1)
|
||||
{
|
||||
hiscores=0;
|
||||
do_hiscores();
|
||||
}
|
||||
}
|
||||
// outro();
|
||||
SDL_JoystickClose(joystick);
|
||||
SDL_Quit();
|
||||
fprintf(stderr,"\nThanks for playing.\n");
|
||||
return 0;
|
||||
}
|
||||
299
project/jni/application/pachi/src/file.h
Normal file
299
project/jni/application/pachi/src/file.h
Normal file
@@ -0,0 +1,299 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void load_gamedata()
|
||||
{
|
||||
background=LoadT8(DATADIR"/Tgfx/gamepanel.T8");
|
||||
backs=LoadT8(DATADIR"/Tgfx/backgrounds.T8");
|
||||
player=LoadT8(DATADIR"/Tgfx/pachi.T8");
|
||||
monsters=LoadT8(DATADIR"/Tgfx/monsters.T8");
|
||||
tiles=LoadT8(DATADIR"/Tgfx/tiles.T8");
|
||||
bright=LoadT8(DATADIR"/Tgfx/bright.T8");
|
||||
left=LoadT8(DATADIR"/Tgfx/left.T8");
|
||||
right=LoadT8(DATADIR"/Tgfx/right.T8");
|
||||
menufont=LoadT8(DATADIR"/fonts/font32v.T8");
|
||||
LoadT(&scorefont,DATADIR"/fonts/font16b.T");
|
||||
LoadT(&scorefont1,DATADIR"/fonts/font16a.T");
|
||||
LoadT(&scorefont2,DATADIR"/fonts/font16c.T");
|
||||
SDL_Surface *temp;
|
||||
temp = SDL_CreateRGBSurface(SDL_SWSURFACE,736,448,16,0,0,0,0); //esto es para reestablecer la pantalla
|
||||
screenbak = SDL_DisplayFormat(temp);
|
||||
SDL_FreeSurface(temp);
|
||||
SDL_SetColorKey(menufont, SDL_SRCCOLORKEY, SDL_MapRGB(menufont->format,0,255,0));
|
||||
SDL_SetColorKey(monsters, SDL_SRCCOLORKEY, SDL_MapRGB(monsters->format,0,255,0));
|
||||
SDL_SetColorKey(player, SDL_SRCCOLORKEY, SDL_MapRGB(player->format,0,0,0)); // el negro es transparente
|
||||
SDL_SetColorKey(tiles, SDL_SRCCOLORKEY, SDL_MapRGB(tiles->format,0,255,0));
|
||||
SDL_SetColorKey(bright, SDL_SRCCOLORKEY, SDL_MapRGB(bright->format,0,255,0));
|
||||
SDL_SetAlpha(bright, SDL_SRCALPHA, 128);
|
||||
SDL_SetColorKey(left, SDL_SRCCOLORKEY, SDL_MapRGB(left->format,0,0,0));
|
||||
SDL_SetColorKey(right, SDL_SRCCOLORKEY, SDL_MapRGB(right->format,0,0,0));
|
||||
|
||||
jump = Mix_LoadWAV(DATADIR"/sounds/jump.wav");
|
||||
obj = Mix_LoadWAV(DATADIR"/sounds/obj.wav");
|
||||
objseq = Mix_LoadWAV(DATADIR"/sounds/objseq.wav");
|
||||
die = Mix_LoadWAV(DATADIR"/sounds/die.wav");
|
||||
timer = Mix_LoadWAV(DATADIR"/sounds/timer.wav");
|
||||
exitlevel = Mix_LoadWAV(DATADIR"/sounds/exit.wav");
|
||||
stageready = Mix_LoadWAV(DATADIR"/sounds/stageready.wav");
|
||||
storm = Mix_LoadWAV(DATADIR"/sounds/storm.wav");
|
||||
respawnsnd = Mix_LoadWAV(DATADIR"/sounds/respawn.wav");
|
||||
|
||||
}
|
||||
void unload_gamedata()
|
||||
{
|
||||
SDL_FreeSurface(background);
|
||||
SDL_FreeSurface(tiles);
|
||||
SDL_FreeSurface(backs);
|
||||
SDL_FreeSurface(player);
|
||||
SDL_FreeSurface(bright);
|
||||
SDL_FreeSurface(monsters);
|
||||
SDL_FreeSurface(screenbak);
|
||||
SDL_FreeSurface(scorefont);
|
||||
SDL_FreeSurface(scorefont1);
|
||||
SDL_FreeSurface(scorefont2);
|
||||
SDL_FreeSurface(menufont);
|
||||
SDL_FreeSurface(left);
|
||||
SDL_FreeSurface(right);
|
||||
|
||||
Mix_FreeChunk(exitlevel);
|
||||
Mix_FreeChunk(jump);
|
||||
Mix_FreeChunk(obj);
|
||||
Mix_FreeChunk(die);
|
||||
Mix_FreeChunk(timer);
|
||||
Mix_FreeChunk(storm);
|
||||
Mix_FreeChunk(stageready);
|
||||
Mix_FreeChunk(respawnsnd);
|
||||
}
|
||||
|
||||
void stop_music()
|
||||
{
|
||||
if(Mix_PlayingMusic())
|
||||
{
|
||||
Mix_FadeOutMusic(1000);
|
||||
SDL_Delay(1000);
|
||||
Mix_FreeMusic(music);
|
||||
}
|
||||
}
|
||||
|
||||
void load_hiscoredata()
|
||||
{
|
||||
background=LoadT8(DATADIR"/Tgfx/gameover.T8");
|
||||
LoadT(&scorefont,DATADIR"/fonts/font16b.T");
|
||||
LoadT(&scorefont1,DATADIR"/fonts/font16d.T");
|
||||
|
||||
FILE *file = fopen(SCOREDIR"/data/scores.dat","rb");
|
||||
for(int a=0; a < 10; a++)
|
||||
{
|
||||
for(int b=0; b < 10; b++)
|
||||
{
|
||||
scorename[a][b]=getc(file);
|
||||
}
|
||||
scorestage[a]=getc(file);
|
||||
int lobyte,hibyte,vhibyte;
|
||||
hibyte=getc(file);
|
||||
lobyte=getc(file);
|
||||
scoretime[a]=(hibyte*256)+lobyte;
|
||||
scoredif[a]=getc(file);
|
||||
vhibyte=getc(file);
|
||||
hibyte=getc(file);
|
||||
lobyte=getc(file);
|
||||
scorescore[a]=(vhibyte*65536)+(hibyte*256)+lobyte;
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
void unload_hiscoredata()
|
||||
{
|
||||
SDL_FreeSurface(background);
|
||||
SDL_FreeSurface(scorefont);
|
||||
SDL_FreeSurface(scorefont1);
|
||||
}
|
||||
void save_hiscoredata()
|
||||
{
|
||||
FILE *file = fopen(SCOREDIR"/data/scores.dat","rb+");
|
||||
|
||||
for(int a=0;a<10;a++)
|
||||
{
|
||||
for(int b=0;b<10;b++)
|
||||
{
|
||||
putc(scorename[a][b],file);
|
||||
}
|
||||
putc(scorestage[a],file);
|
||||
|
||||
int lobyte,hibyte,vhibyte;
|
||||
hibyte=int(scoretime[a]/256);
|
||||
lobyte=int(scoretime[a]-(hibyte+256));
|
||||
|
||||
putc(hibyte,file);
|
||||
putc(lobyte,file);
|
||||
putc(scoredif[a],file);
|
||||
|
||||
vhibyte=int(scorescore[a]/65536);
|
||||
hibyte=int((scorescore[a] - (scorescore[a]/65536))/256);
|
||||
lobyte=int(scorescore[a] - (vhibyte*65536 + hibyte*256));
|
||||
|
||||
putc(vhibyte,file);
|
||||
putc(hibyte,file);
|
||||
putc(lobyte,file);
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void load_helpgfx()
|
||||
{
|
||||
background=LoadT8(DATADIR"/Tgfx/help.T8");
|
||||
LoadT(&scorefont,DATADIR"/fonts/font16b.T");
|
||||
LoadT(&scorefont1,DATADIR"/fonts/font16a.T");
|
||||
SDL_SetColorKey(scorefont, SDL_SRCCOLORKEY, SDL_MapRGB(scorefont->format,0,0,0));
|
||||
SDL_SetColorKey(scorefont1, SDL_SRCCOLORKEY, SDL_MapRGB(scorefont1->format,0,0,0));
|
||||
}
|
||||
void unload_helpgfx()
|
||||
{
|
||||
SDL_FreeSurface(background);
|
||||
SDL_FreeSurface(scorefont);
|
||||
SDL_FreeSurface(scorefont1);
|
||||
}
|
||||
|
||||
void load_menudata()
|
||||
{
|
||||
menufont=LoadT8(DATADIR"/fonts/font32v.T8");
|
||||
menufont1=LoadT8(DATADIR"/fonts/font32r.T8");
|
||||
background=LoadT8(DATADIR"/Tgfx/intro.T8");
|
||||
SDL_SetColorKey(menufont, SDL_SRCCOLORKEY, SDL_MapRGB(menufont->format,0,255,0));
|
||||
SDL_SetColorKey(menufont1, SDL_SRCCOLORKEY, SDL_MapRGB(menufont1->format,0,255,0));
|
||||
|
||||
option=Mix_LoadWAV(DATADIR"/sounds/option.wav");
|
||||
coderight=Mix_LoadWAV(DATADIR"/sounds/exit.wav");
|
||||
codewrong=Mix_LoadWAV(DATADIR"/sounds/die.wav");
|
||||
music=Mix_LoadMUS(DATADIR"/music/menu.s3m.ogg");
|
||||
}
|
||||
void unload_menudata()
|
||||
{
|
||||
SDL_FreeSurface(menufont);
|
||||
SDL_FreeSurface(menufont1);
|
||||
SDL_FreeSurface(background);
|
||||
Mix_FreeChunk(option);
|
||||
Mix_FreeChunk(coderight);
|
||||
Mix_FreeChunk(codewrong);
|
||||
}
|
||||
|
||||
void init_monsters()
|
||||
{
|
||||
FILE *mnstr = fopen(DATADIR"/data/monsters.dat","rb");
|
||||
long filepos = ((R_current-1) * M_max4room*3);
|
||||
fseek(mnstr,filepos,SEEK_SET);
|
||||
for(int n=0;n<=M_max4room-1;n++)
|
||||
{
|
||||
M_type[n]=getc(mnstr);
|
||||
M_x[n]=getc(mnstr)*R_tileside;
|
||||
M_y[n]=getc(mnstr)*R_tileside-M_h+R_tileside;
|
||||
}
|
||||
fclose(mnstr);
|
||||
}
|
||||
|
||||
void load_room()
|
||||
{
|
||||
long filepos;
|
||||
FILE *bck = fopen(DATADIR"/data/backs.dat","rb");
|
||||
filepos = (R_current - 1) * (R_maxbacks_h*R_maxbacks_v); // filepos es el puntero del archivo, lo utilizamos para leer la habitacion donde estemos
|
||||
fseek(bck,filepos,SEEK_SET);
|
||||
int x, y;
|
||||
for(y = 0;y < R_maxbacks_v; y++)
|
||||
{
|
||||
for(x = 0;x < R_maxbacks_h; x++)
|
||||
{
|
||||
R_backdata[x][y]=getc(bck);
|
||||
}
|
||||
}
|
||||
fclose(bck);
|
||||
|
||||
FILE *lvl = fopen(DATADIR"/data/rooms_v2.dat","rb");
|
||||
filepos = (200 + ((R_current-1) * (R_maxtiles_h*R_maxtiles_v))+R_current); // filepos es el puntero del archivo, lo utilizamos para leer la habitacion donde estemos
|
||||
fseek(lvl,filepos,SEEK_SET);
|
||||
|
||||
for(y = 0;y < R_maxtiles_v;y++)
|
||||
{
|
||||
for(x = 0;x < R_maxtiles_h; x++)
|
||||
{
|
||||
mroom.data[x][y]=getc(lvl);
|
||||
}
|
||||
}
|
||||
fclose(lvl);
|
||||
|
||||
int contador;
|
||||
for(contador=0;contador < 5; contador++)
|
||||
{
|
||||
R_object=mobject[((R_current-1)*5)+contador].type;
|
||||
x=mobject[((R_current-1)*5)+contador].x;
|
||||
y=mobject[((R_current-1)*5)+contador].y;
|
||||
if(R_object != 0)
|
||||
mroom.data[x][y]=R_object;
|
||||
}
|
||||
}
|
||||
void load_roommap()
|
||||
{
|
||||
long filepos;
|
||||
int x, y;
|
||||
FILE *lvl = fopen(DATADIR"/data/rooms_v2.dat","rb");
|
||||
|
||||
for(y = 0;y < R_max_y;y++)
|
||||
{
|
||||
for(x = 0;x < R_max_x; x++)
|
||||
{
|
||||
filepos=((x+1)*(R_maxtiles_h*R_maxtiles_v)+(x+1))+(y*(R_max_x*(R_maxtiles_h*R_maxtiles_v)+R_max_x));
|
||||
fseek(lvl,200+filepos,SEEK_SET);
|
||||
roommap[x][y]=getc(lvl);
|
||||
}
|
||||
}
|
||||
fclose(lvl);
|
||||
}
|
||||
void init_objects() // esta rutina copia en la matriz objects el archivo objects.dat
|
||||
{
|
||||
FILE *obj = fopen(DATADIR"/data/objects_v2.dat","rb");
|
||||
for(int n=0;n<2000;n++)
|
||||
{
|
||||
mobject[n].type=getc(obj);
|
||||
mobject[n].x=getc(obj);
|
||||
mobject[n].y=getc(obj);
|
||||
mobject[n].seq=getc(obj);
|
||||
mobject[n].stage=getc(obj);
|
||||
}
|
||||
fclose(obj);
|
||||
}
|
||||
|
||||
void initcredits()
|
||||
{
|
||||
creditslinecounter=0;
|
||||
background=LoadT8(DATADIR"/Tgfx/endcredits.T8");
|
||||
creditsfont=LoadT8(DATADIR"/fonts/font1.T8");
|
||||
SDL_SetColorKey(creditsfont, SDL_SRCCOLORKEY, SDL_MapRGB(creditsfont->format,0,255,0));
|
||||
SDL_Surface *temp;
|
||||
temp = SDL_CreateRGBSurface(SDL_SWSURFACE,600,440,16,0,0,0,0);
|
||||
creditsbuffer = SDL_DisplayFormat(temp);
|
||||
creditsbuffer1 = SDL_DisplayFormat(temp);
|
||||
SDL_FreeSurface(temp);
|
||||
setback();
|
||||
|
||||
music = Mix_LoadMUS(DATADIR"/music/credits.s3m.ogg");
|
||||
}
|
||||
void unloadcredits()
|
||||
{
|
||||
SDL_FreeSurface(creditsbuffer);
|
||||
SDL_FreeSurface(creditsbuffer1);
|
||||
SDL_FreeSurface(background);
|
||||
SDL_FreeSurface(creditsfont);
|
||||
}
|
||||
181
project/jni/application/pachi/src/fx.h
Normal file
181
project/jni/application/pachi/src/fx.h
Normal file
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
Rutina de efectos especiales
|
||||
*/
|
||||
SDL_Surface *fadeobject;
|
||||
SDL_Rect fadingpos; // posicion del objeto que esta desvaneciendose
|
||||
SDL_Rect realfadingpos; // posicion del objeto que esta desvaneciendose en el area de juego
|
||||
float fade_y;
|
||||
|
||||
float scanpos_y=R_gamearea_y - (P_h*P_h);
|
||||
|
||||
|
||||
void respawn() // rutina que hace reaparecer a Pachi
|
||||
{
|
||||
int scanspeed=1500;
|
||||
SDL_Rect P_oldscansrect[P_h];
|
||||
SDL_Rect P_scansrect[P_h];
|
||||
SDL_Rect P_srcscan[P_h];
|
||||
//imprimimos los scans
|
||||
for(int a=P_h-1;a>=0;a--)
|
||||
{
|
||||
P_scansrect[a].x=int(mplayer[dificulty].x+R_gamearea_x);P_scansrect[a].w=mplayer[dificulty].w;P_scansrect[a].h=1;
|
||||
P_scansrect[a].y=int(scanpos_y+(a*P_h));
|
||||
P_srcscan[a].h=1;P_srcscan[a].w=mplayer[dificulty].w;P_srcscan[a].x=(mplayer[dificulty].w*(mplayer[dificulty].frame));P_srcscan[a].y=0+a;
|
||||
P_oldscansrect[a]=P_scansrect[a];
|
||||
|
||||
if((P_scansrect[a].y<mplayer[dificulty].y+R_gamearea_y+P_h-(P_h-a))&&(P_scansrect[a].y>R_gamearea_y))
|
||||
{
|
||||
SDL_BlitSurface(player,&P_srcscan[a],screen,&P_scansrect[a]);
|
||||
SDL_UpdateRect(screen,P_scansrect[a].x,P_scansrect[a].y,P_scansrect[a].w,P_scansrect[a].h);
|
||||
}
|
||||
}
|
||||
if(scanpos_y<mplayer[dificulty].y+P_h)
|
||||
scanpos_y+=scanspeed*imove;
|
||||
else
|
||||
{
|
||||
scanpos_y=R_gamearea_y - (P_h*P_h);
|
||||
respawned=1;
|
||||
imove=0.01;
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
//borramos los scans recuperando el fondo que habia antes
|
||||
|
||||
SDL_Rect bakscansrect[P_h];
|
||||
for(int a=P_h-1;a>=0;a--)
|
||||
{
|
||||
bakscansrect[a]=P_oldscansrect[a];
|
||||
P_oldscansrect[a].x-=R_gamearea_x;
|
||||
P_oldscansrect[a].y-=R_gamearea_y;
|
||||
|
||||
SDL_BlitSurface(screenbak,&P_oldscansrect[a],screen,&bakscansrect[a]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void initfade_object(int x, int y, int object)
|
||||
{
|
||||
alphade=255;
|
||||
object-=200;
|
||||
fadeobject=SDL_CreateRGBSurface(SDL_SWSURFACE,R_tileside,R_tileside,16,0,0,0,0);
|
||||
SDL_SetColorKey(fadeobject,SDL_SRCCOLORKEY,(fadeobject->format,0,255,0));
|
||||
SDL_Rect objectsrc;
|
||||
objectsrc.w=R_tileside;objectsrc.h=R_tileside;
|
||||
objectsrc.y=R_tileside*10;objectsrc.x=R_tileside*object;
|
||||
SDL_BlitSurface(tiles,&objectsrc,fadeobject,NULL);
|
||||
fadingpos.x=x*R_tileside;fadingpos.y=y*R_tileside;
|
||||
fadingpos.w=R_tileside;fadingpos.h=R_tileside;
|
||||
fade_y=fadingpos.y;
|
||||
}
|
||||
|
||||
float fade_object(float alpha)
|
||||
{
|
||||
int fadealpha = int(alpha);
|
||||
SDL_SetAlpha(fadeobject,SDL_SRCALPHA,fadealpha);
|
||||
realfadingpos.x=R_gamearea_x+fadingpos.x;realfadingpos.y=R_gamearea_y+fadingpos.y;realfadingpos.w=fadingpos.w;realfadingpos.h=fadingpos.h;
|
||||
|
||||
SDL_BlitSurface(screenbak,&fadingpos,screen,&realfadingpos);
|
||||
SDL_BlitSurface(fadeobject,NULL,screen,&realfadingpos);
|
||||
SDL_UpdateRect(screen,realfadingpos.x,realfadingpos.y,realfadingpos.w,realfadingpos.h+2);
|
||||
if(fadealpha<5)
|
||||
{
|
||||
fadingobject=0;
|
||||
SDL_BlitSurface(screenbak,&fadingpos,screen,&realfadingpos);
|
||||
print_room();
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha-=500*imove;
|
||||
fade_y-=150*imove;
|
||||
if(fade_y<32)
|
||||
fade_y+=150*imove;
|
||||
fadingpos.y=int(fade_y);
|
||||
}
|
||||
return(alpha);
|
||||
}
|
||||
|
||||
|
||||
void screen_fx()
|
||||
{
|
||||
Mix_Volume(7,128);
|
||||
if(seconds==15 || seconds==45)
|
||||
{
|
||||
if(stage<6) // en el cementerio
|
||||
{
|
||||
if(int(oldsec-1)==int(seconds))
|
||||
{
|
||||
Mix_PlayChannel(7,storm,0);
|
||||
blinkscreen(220,220,255,128);
|
||||
load_room();
|
||||
print_room();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bright_obj(int bright_x, int bright_y)
|
||||
{
|
||||
SDL_Rect brsrc;
|
||||
brsrc.x=(brightframe*40);
|
||||
brsrc.y=0;brsrc.w=40;brsrc.h=40;
|
||||
SDL_Rect brdst;
|
||||
brdst.x=bright_x*R_tileside-4;brdst.y=bright_y*R_tileside-4;brdst.w=40;brdst.h=40;
|
||||
SDL_Rect brdstreal;
|
||||
brdstreal.x=bright_x*R_tileside-4+R_gamearea_x;brdstreal.y=bright_y*R_tileside-4+R_gamearea_y;brdstreal.w=40;brdstreal.h=40;
|
||||
|
||||
SDL_Rect objsrc;
|
||||
objsrc.w=R_tileside;objsrc.w=R_tileside;
|
||||
objsrc.x=(mroom.data[bright_x][bright_y] - (int(mroom.data[bright_x][bright_y]/20) * 20))*R_tileside;
|
||||
objsrc.y=(int(mroom.data[bright_x][bright_y]/20) * R_tileside);
|
||||
SDL_Rect objdst;
|
||||
objdst.x=bright_x*R_tileside;
|
||||
objdst.y=bright_y*R_tileside;
|
||||
objdst.w=R_tileside;objdst.h=R_tileside;
|
||||
SDL_Rect objdstreal;
|
||||
objdstreal.x=bright_x*R_tileside+R_gamearea_x;
|
||||
objdstreal.y=bright_y*R_tileside+R_gamearea_y;
|
||||
objdstreal.w=R_tileside;objdst.h=R_tileside;
|
||||
|
||||
SDL_BlitSurface(screenbak,&brdst,screen,&brdstreal);
|
||||
// SDL_BlitSurface(tiles,&objsrc,screen,&objdstreal);
|
||||
SDL_BlitSurface(bright,&brsrc,screen,&brdstreal);
|
||||
SDL_UpdateRect(screen,brdstreal.x,brdstreal.y,brdstreal.w,brdstreal.h);
|
||||
}
|
||||
|
||||
void show_arrow(int arrow, int show)
|
||||
{
|
||||
SDL_Rect dst;
|
||||
dst.w=150; dst.h=30;dst.y=R_gamearea_y+1;
|
||||
SDL_Rect src;
|
||||
src.w=dst.w; src.h=dst.h; src.y=dst.y - R_gamearea_y;
|
||||
switch(arrow)
|
||||
{
|
||||
case arrow_left:
|
||||
dst.x=R_gamearea_x+1;
|
||||
src.x=dst.x-R_gamearea_x;
|
||||
if(show==1)
|
||||
SDL_BlitSurface(left, NULL, screen, &dst);
|
||||
else
|
||||
SDL_BlitSurface(screenbak, &src, screen, &dst);
|
||||
|
||||
SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
|
||||
break;
|
||||
case arrow_right:
|
||||
dst.x=R_gamearea_x+(R_maxtiles_h*R_tileside)-(10+dst.w);
|
||||
src.x=dst.x-R_gamearea_x;
|
||||
if(show==1)
|
||||
SDL_BlitSurface(right, NULL, screen, &dst);
|
||||
else
|
||||
SDL_BlitSurface(screenbak, &src, screen, &dst);
|
||||
|
||||
SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
|
||||
break;
|
||||
case arrow_up:
|
||||
//fprintf(stderr,"up");
|
||||
break;
|
||||
case arrow_down:
|
||||
//fprintf(stderr,"down");
|
||||
break;
|
||||
}
|
||||
}
|
||||
358
project/jni/application/pachi/src/game.h
Normal file
358
project/jni/application/pachi/src/game.h
Normal file
@@ -0,0 +1,358 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void win_game()
|
||||
{
|
||||
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_09.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_10.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_11.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_12.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_13.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_14.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
|
||||
SDL_FreeSurface(background);
|
||||
initcredits();
|
||||
escape_exit=0;
|
||||
|
||||
while(escape_exit==0)
|
||||
{
|
||||
if(!Mix_PlayingMusic())
|
||||
Mix_PlayMusic(music,0);
|
||||
credits_events();
|
||||
print_credits();
|
||||
}
|
||||
SDL_BlitSurface(background, NULL, screen, NULL);
|
||||
SDL_Flip(screen);
|
||||
stop_music();
|
||||
unloadcredits();
|
||||
}
|
||||
|
||||
void check_exits() // esta funcion se fija si hay salidas disponibles
|
||||
{
|
||||
int y = int(R_current/R_max_x);
|
||||
int x = (R_current-y*R_max_x)-1;
|
||||
int show; // esta variable indica si se debe imprimir la flecha o borrarla
|
||||
if((roomtime>1 && roomtime<1.5) || (roomtime>2 && roomtime <2.5) || (roomtime > 3 && roomtime <3.5) || (roomtime > 4 && roomtime <4.5))
|
||||
show=1;
|
||||
else
|
||||
show=0;
|
||||
|
||||
if(x < R_max_x)
|
||||
if(roommap[x+1][y]==stage)
|
||||
show_arrow(arrow_right, show);
|
||||
if(x > 0)
|
||||
if(roommap[x-1][y]==stage)
|
||||
show_arrow(arrow_left, show);
|
||||
if(y < R_max_y)
|
||||
if(roommap[x][y+1]==stage)
|
||||
show_arrow(arrow_down, show);
|
||||
if(y < 0)
|
||||
if(roommap[x][y-1]==stage)
|
||||
show_arrow(arrow_up, show);
|
||||
}
|
||||
|
||||
void stage_up()
|
||||
{
|
||||
long filepos;
|
||||
SDL_Rect scorerect;
|
||||
scorerect.x = 30; scorerect.y = 484; scorerect.w = 400; scorerect.h = 96;
|
||||
if(stage+1 != CEMETERY && stage+1 != CAVES && stage+1 != CASTLE && stage+1 != LAB)
|
||||
{
|
||||
SDL_FillRect(screen, &scorerect, 0); // limpiamos el cuadrado de los marcadores
|
||||
SDL_UpdateRect(screen, scorerect.x, scorerect.y, scorerect.w, scorerect.h);
|
||||
}
|
||||
mplayer[dificulty].objects = 0; mplayer[dificulty].stageup = 0;
|
||||
mplayer[dificulty].left = 0; mplayer[dificulty].right = 0;
|
||||
mplayer[dificulty].jump = 0; mplayer[dificulty].duck = 0; mplayer[dificulty].jumpcounter = 0;
|
||||
Mix_HaltChannel(-1);
|
||||
// ahora agregamos el puntaje correspondiente al tiempo que nos sobró
|
||||
if(minutes>0||seconds>0) // esto lo hacemos por si se perdio por tiempo
|
||||
{
|
||||
for(int a=int(gametimer);a>0;a--)
|
||||
{
|
||||
score=score+(dificulty*45)+(int(dificulty/3)*45);
|
||||
gametimer--;
|
||||
minutes = int(gametimer/60);
|
||||
seconds = int(gametimer-minutes*60);
|
||||
Mix_Volume(0,100);
|
||||
Mix_PlayChannel(0,timer,0);
|
||||
print_monitor();
|
||||
print_timer();
|
||||
SDL_Delay(20);
|
||||
}
|
||||
}
|
||||
stage++;
|
||||
if(stage <= NUM_STAGES)
|
||||
{
|
||||
gametimer = mstage[stage-1].time-((dificulty-1)*20); // para los niveles normal y dificil el tiempo es 30 y 60 segundos menor respectivamente
|
||||
showcode(mstage[stage-1].code);
|
||||
showposter(stage);
|
||||
|
||||
music=Mix_LoadMUS(mstage[stage-1].music);
|
||||
stagecompleted = 0;
|
||||
FILE *lvl = fopen(DATADIR"/data/rooms_v2.dat","rb");
|
||||
filepos = (stage - 1) * 4; // filepos es el puntero del archivo, lo utilizamos para leer en que habitacion estamos
|
||||
fseek(lvl,filepos,SEEK_SET);
|
||||
R_x = getc(lvl);
|
||||
R_y = getc(lvl);
|
||||
mplayer[dificulty].start_x = getc(lvl) * R_tileside; // variables de posicion inicial en la pantalla
|
||||
mplayer[dificulty].start_y = getc(lvl) * R_tileside; // variables de posicion inicial en la pantalla
|
||||
mplayer[dificulty].x = mplayer[dificulty].start_x;
|
||||
mplayer[dificulty].y = mplayer[dificulty].start_y;
|
||||
R_current = (R_x + ((R_y - 1)*R_max_x));
|
||||
fclose(lvl);
|
||||
init_room();
|
||||
}
|
||||
else
|
||||
{
|
||||
game_exit=1;
|
||||
}
|
||||
}
|
||||
|
||||
void start_game()
|
||||
{
|
||||
LoadT(&font,DATADIR"/fonts/font16d.T");
|
||||
SDL_SetColorKey(font, SDL_SRCCOLORKEY, SDL_MapRGB(font->format,0,0,0));
|
||||
print_text(font,screen,16,16,140,90,"LOADING GAME DATA... PLEASE WAIT");
|
||||
SDL_UpdateRect(screen,140,90,520,16);
|
||||
SDL_FreeSurface(font);
|
||||
|
||||
setgame();
|
||||
|
||||
load_gamedata();
|
||||
init_objects();
|
||||
if(stage+1 != CEMETERY && stage+1 != CAVES && stage+1 != CASTLE && stage+1 != LAB)
|
||||
setback();
|
||||
|
||||
stage_up(); // con esta rutina aumentamos la fase en 1 y leemos la pantalla inicial y la posicion inicial del personaje
|
||||
init_monsters();
|
||||
playtime=SDL_GetTicks();
|
||||
game_exit=0;
|
||||
while(game_exit==0)
|
||||
{
|
||||
game_loop();
|
||||
}
|
||||
playtime=SDL_GetTicks()-playtime;
|
||||
unload_gamedata();
|
||||
stop_music();
|
||||
|
||||
if(stage>NUM_STAGES)
|
||||
{
|
||||
escape_exit=0;
|
||||
win_game();
|
||||
}
|
||||
|
||||
if(mplayer[dificulty].lives == 0 || stage > NUM_STAGES)
|
||||
game_over();
|
||||
}
|
||||
|
||||
void init_room()
|
||||
{
|
||||
roomtime=0; // indica el tiempo que llevamos en una habitacion
|
||||
flushevents();
|
||||
load_room();
|
||||
init_monsters();
|
||||
print_room();
|
||||
if(stage<=3) // solamente se muestra la flecha indicadora en las 3 primeras pantallas
|
||||
chk_exits=1;
|
||||
else
|
||||
chk_exits=0;
|
||||
}
|
||||
|
||||
void animatemonsters()
|
||||
{
|
||||
M_frame++;
|
||||
if(M_frame > M_frames)
|
||||
M_frame=1;
|
||||
}
|
||||
|
||||
void animatefx()
|
||||
{
|
||||
brightframe++;
|
||||
if(brightframe > 9)
|
||||
brightframe=0;
|
||||
}
|
||||
|
||||
void animate() //rutina para la animacion de los sprites
|
||||
{
|
||||
|
||||
int animspeed=100;
|
||||
animcounter=animcounter+(imove*animspeed);
|
||||
if(animcounter > 10)
|
||||
{
|
||||
animatemonsters();
|
||||
animateplayer();
|
||||
animatefx();
|
||||
animcounter = 0;
|
||||
}
|
||||
}
|
||||
void play_music()
|
||||
{
|
||||
if(!Mix_PlayingMusic())
|
||||
Mix_PlayMusic(music,0);
|
||||
}
|
||||
|
||||
void chk_state()
|
||||
{
|
||||
if(mplayer[dificulty].dead==1)
|
||||
{
|
||||
loose_life();
|
||||
if(mplayer[dificulty].lives<1)
|
||||
game_exit=1;
|
||||
else
|
||||
{
|
||||
respawned=0;
|
||||
Mix_Volume(1,90);
|
||||
Mix_PlayChannel(1,respawnsnd,1);
|
||||
while(respawned==0)
|
||||
{
|
||||
delta_time();
|
||||
respawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mplayer[dificulty].stageup==1)
|
||||
{
|
||||
while(Mix_Playing(0))
|
||||
{}
|
||||
stage_up();
|
||||
}
|
||||
if(chk_exits==1 && roomtime < 5)
|
||||
check_exits();
|
||||
}
|
||||
|
||||
double delta_time(void)
|
||||
{
|
||||
curtime=SDL_GetTicks();
|
||||
imove=(curtime-lasttime)/1000.0;
|
||||
lasttime=curtime;
|
||||
if(imove>.2)
|
||||
imove=0.01;
|
||||
return imove;
|
||||
}
|
||||
|
||||
void print_timer()
|
||||
{
|
||||
print_text(scorefont,screen,16,16,224,564,"TIME :");
|
||||
if(minutes==0 && seconds <=10)
|
||||
{
|
||||
Mix_Volume(0,100);
|
||||
font=scorefont2;
|
||||
if((int(oldsec-1)==int(seconds))&& seconds > 0)
|
||||
Mix_PlayChannel(0,timer,0);
|
||||
}
|
||||
else
|
||||
font=scorefont1;
|
||||
|
||||
if(seconds>=10)
|
||||
print_text(font,screen,16,16,352,564,"%d:%d",minutes,seconds);
|
||||
else
|
||||
print_text(font,screen,16,16,352,564,"%d:0%d",minutes,seconds);
|
||||
|
||||
SDL_UpdateRect(screen,224,544,208,40);
|
||||
}
|
||||
|
||||
void do_gametimer()
|
||||
{
|
||||
gametimer-=imove;
|
||||
roomtime+=imove;
|
||||
minutes = int(gametimer/60);
|
||||
seconds = int(gametimer-minutes*60);
|
||||
|
||||
print_timer();
|
||||
screen_fx(); // efectos especiales de pantalla
|
||||
if(minutes==0 && seconds == 0)
|
||||
{
|
||||
stage--;
|
||||
init_objects();
|
||||
loose_life();
|
||||
if(Mix_PlayingMusic())
|
||||
Mix_FreeMusic(music);
|
||||
stage_up();
|
||||
}
|
||||
oldsec=seconds;
|
||||
|
||||
}
|
||||
|
||||
void chk_sequence()
|
||||
{
|
||||
int n;
|
||||
sequence=mstage[stage-1].objects+1;
|
||||
for(n=0;n<2000;n++)
|
||||
{
|
||||
if(mobject[n].stage==stage)
|
||||
{
|
||||
if(mobject[n].seq<sequence && mobject[n].seq>0)
|
||||
sequence=mobject[n].seq;
|
||||
//fprintf(stderr,"stage=%d object stage=%d\n",stage, mobject[n].stage);
|
||||
|
||||
//fprintf(stderr,"proximo objeto de la secuencia es=%d, numero=%d, x=%d, y=%d stage=%d \n",mobject[n].seq, n, mobject[n].x, mobject[n].y, mobject[n].stage);
|
||||
}
|
||||
}
|
||||
int object_is_here=0; // esta variable indica si el objeto que sigue en la secuencia esta en la pantalla actual
|
||||
int bright_x, bright_y; // variables que indica en que posicion debe aparecer el brillo del proximo objeto a recoger
|
||||
for(n=0;n<5;n++)
|
||||
{
|
||||
if(mobject[(R_current-1)*5+n].seq==sequence)
|
||||
{
|
||||
object_is_here=1;
|
||||
bright_x=mobject[(R_current-1)*5+n].x;
|
||||
bright_y=mobject[(R_current-1)*5+n].y;
|
||||
}
|
||||
}
|
||||
if(object_is_here==1)
|
||||
{
|
||||
bright_obj(bright_x, bright_y);
|
||||
}
|
||||
}
|
||||
|
||||
void game_loop()
|
||||
{
|
||||
delta_time();
|
||||
do_gametimer(); // esta rutina decrementa e imprime el timer
|
||||
play_music();
|
||||
game_events();
|
||||
animate();
|
||||
clean_player();
|
||||
if(fadingobject==1) // chquea si se debe eliminar un objeto
|
||||
alphade=fade_object(alphade);
|
||||
print_monsters();
|
||||
print_player();
|
||||
chk_sequence(); // esta rutina se fija cual es el proximo objeto de la sequencia (Bomb Jack feature)
|
||||
chk_state(); // esta rutina chequea si el personaje se murio, o si paso de nivel
|
||||
SDL_Delay(1);
|
||||
}
|
||||
125
project/jni/application/pachi/src/gameover.h
Normal file
125
project/jni/application/pachi/src/gameover.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void show_hiscores()
|
||||
{
|
||||
SDL_SetColorKey(scorefont,SDL_SRCCOLORKEY,SDL_MapRGB(scorefont->format,0,0,0));
|
||||
SDL_SetColorKey(scorefont1,SDL_SRCCOLORKEY,SDL_MapRGB(scorefont1->format,0,0,0));
|
||||
SDL_SetColorKey(scorefont1,SDL_SRCCOLORKEY,SDL_MapRGB(scorefont1->format,0,0,0));
|
||||
char plyername[]=" ";
|
||||
char diflevel[] =" ";
|
||||
print_text(scorefont1,screen,16,16,30, 55," PACHI EL MARCIANO TOP TEN ");//scorename[a]);
|
||||
print_text(scorefont1,screen,16,16,30, 95,"NAME STAGE TIME LEVEL SCORE ");//scorename[a]);
|
||||
print_text(scorefont1,screen,16,16,30,120,"----------------------------------------------");//scorename[a]);
|
||||
print_text(scorefont1,screen,16,16,30,535,"----------------------------------------------");//scorename[a]);
|
||||
|
||||
for(int a=0; a < 10;a++)
|
||||
{
|
||||
strncpy(playername,scorename[a],10);
|
||||
print_text(scorefont,screen,16,16,30,170+(35*a),"%s",playername);//scorename[a]);
|
||||
print_text(scorefont,screen,16,16,268,170+(35*a),"%d",scorestage[a]);
|
||||
int mins=int(scoretime[a]/60);
|
||||
int secs=int(scoretime[a]-(mins*60));
|
||||
if(secs>9)
|
||||
print_text(scorefont,screen,16,16,386,170+(35*a),"%d:%d",mins,secs);
|
||||
else
|
||||
print_text(scorefont,screen,16,16,386,170+(35*a),"%d:0%d",mins,secs);
|
||||
|
||||
if(scoredif[a]==1)
|
||||
strcpy(diflevel," EASY ");
|
||||
if(scoredif[a]==2)
|
||||
strcpy(diflevel,"NORMAL");
|
||||
if(scoredif[a]==3)
|
||||
strcpy(diflevel," HARD ");
|
||||
print_text(scorefont,screen,16,16,502,170+(35*a),"%s",diflevel);
|
||||
print_text(scorefont,screen,16,16,672,170+(35*a),"%d",scorescore[a]);
|
||||
}
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
void do_hiscores()
|
||||
{
|
||||
load_hiscoredata();
|
||||
setback();
|
||||
show_hiscores();
|
||||
escape_exit=0;
|
||||
|
||||
while(escape_exit==0)
|
||||
{
|
||||
credits_events();
|
||||
SDL_Delay(1);
|
||||
}
|
||||
unload_hiscoredata();
|
||||
}
|
||||
|
||||
void do_gameover()
|
||||
{
|
||||
load_hiscoredata();
|
||||
|
||||
char nameplayer[]=" ";
|
||||
strncpy(playername,nameplayer,10);
|
||||
namechar=0;
|
||||
int highscore=0;
|
||||
for(int a=9; a>=0;a--)
|
||||
{
|
||||
if(score>scorescore[a])
|
||||
{
|
||||
highscore=1;
|
||||
scorepos=a;
|
||||
}
|
||||
}
|
||||
if(highscore==1) // si se hizo una buena puntuacion
|
||||
{
|
||||
for(int b=8;b>=scorepos;b--)
|
||||
{
|
||||
strncpy(scorename[b+1],scorename[b],10);
|
||||
scorescore[b+1]=scorescore[b];
|
||||
scorestage[b+1]=scorestage[b];
|
||||
scoretime [b+1]=scoretime [b];
|
||||
scoredif [b+1]=scoredif [b];
|
||||
}
|
||||
inputloop=1;
|
||||
SDL_Rect box;
|
||||
box.x=270;box.y=220;box.w=260;box.h=52;
|
||||
SDL_FillRect(screen,&box,SDL_MapRGB(screen->format,255,255,255));
|
||||
box.x=273;box.y=223;box.w=254;box.h=46;
|
||||
while(inputloop==1)
|
||||
{
|
||||
hiscore_events();
|
||||
SDL_FillRect(screen,&box,SDL_MapRGB(screen->format,0,0,0));
|
||||
print_text(scorefont1,screen,16,16,box.x+10,box.y+5,"ENTER YOUR NAME");
|
||||
print_text(scorefont1,screen,16,16,box.x+51+(namechar*16),box.y+29,".");
|
||||
print_text(scorefont,screen,16,16,box.x+51,box.y+24,"%s",playername);
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
strncpy(scorename[scorepos],playername,10);
|
||||
scorescore[scorepos]=score;
|
||||
scorestage[scorepos]=stage;
|
||||
scoredif[scorepos]=dificulty;
|
||||
scoretime[scorepos]=int(playtime/1000);
|
||||
save_hiscoredata();
|
||||
}
|
||||
|
||||
unload_hiscoredata();
|
||||
}
|
||||
|
||||
void game_over()
|
||||
{
|
||||
do_gameover();
|
||||
do_hiscores();
|
||||
}
|
||||
117
project/jni/application/pachi/src/gfx.h
Normal file
117
project/jni/application/pachi/src/gfx.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/***************************************************************************
|
||||
* Gfx Functions *
|
||||
* ------------- *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
/*
|
||||
LoadT carga un grafico en formato .T de 24 bits en una superficie SDL
|
||||
*/
|
||||
void LoadT(SDL_Surface **Tsurface, char *str)
|
||||
{
|
||||
FILE *Tsrc;
|
||||
|
||||
int T_lwidth, T_hwidth, T_lheight, T_hheight; // bytes alto y bajo de anchura y altura del grafico
|
||||
long T_width, T_height;
|
||||
int R, G, B;
|
||||
Uint32 pixel;
|
||||
|
||||
Tsrc=fopen(str, "rb");
|
||||
if ( Tsrc == NULL)
|
||||
{
|
||||
fprintf(stderr, "can't read from file \n");
|
||||
return;
|
||||
}
|
||||
|
||||
// leer tamaño del bmp
|
||||
T_lwidth = getc(Tsrc);
|
||||
T_hwidth = getc(Tsrc);
|
||||
T_lheight = getc(Tsrc);
|
||||
T_hheight = getc(Tsrc);
|
||||
T_width = T_hwidth*256+T_lwidth;
|
||||
T_height = T_hheight*256+T_lheight;
|
||||
|
||||
SDL_Surface *temp;
|
||||
temp = SDL_CreateRGBSurface(SDL_SWSURFACE,T_width,T_height,24,0,0,0,0);
|
||||
|
||||
if(SDL_MUSTLOCK(temp))
|
||||
SDL_LockSurface(temp);
|
||||
|
||||
for(int n=1;n<=T_height;n++) //el tamaño del grafico es de ancho * alto * 3 (24 bits)
|
||||
{
|
||||
for(int m=1;m<=T_width;m++)
|
||||
{
|
||||
R=getc(Tsrc);
|
||||
G=getc(Tsrc);
|
||||
B=getc(Tsrc);
|
||||
pixel=SDL_MapRGB(temp->format,R,G,B);
|
||||
|
||||
Uint8 *p = (Uint8 *)temp->pixels + (n-1) * temp->pitch + (m-1) * 3;
|
||||
p[0] = pixel & 0xff;
|
||||
p[1] = (pixel >> 8) & 0xff;
|
||||
p[2] = (pixel >> 16) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
if(SDL_MUSTLOCK(temp))
|
||||
SDL_UnlockSurface(temp);
|
||||
*Tsurface = SDL_DisplayFormat(temp);
|
||||
SDL_FreeSurface(temp);
|
||||
fclose(Tsrc);
|
||||
}
|
||||
|
||||
SDL_Surface * LoadT8(char *str)
|
||||
{
|
||||
SDL_Surface *Tsurface;
|
||||
FILE *Tsrc;
|
||||
Tsrc=fopen(str, "rb");
|
||||
if ( Tsrc == NULL)
|
||||
{
|
||||
fprintf(stderr, "can't read from file \n");
|
||||
SDL_Quit();
|
||||
exit(0);
|
||||
}
|
||||
// leer tamaño del bmp
|
||||
fseek(Tsrc,6,SEEK_SET); // Saltamos la cabecera "T-1000"
|
||||
// leemos tamaño del bitmap
|
||||
int wh=getc(Tsrc); int wl=getc(Tsrc); int hh=getc(Tsrc); int hl=getc(Tsrc);
|
||||
int width=wh*256+wl; int height=hh*256+hl;
|
||||
// leemos la paleta
|
||||
int paleta[768];
|
||||
for(int pal=0;pal<768;pal++)
|
||||
paleta[pal]=getc(Tsrc);
|
||||
// leemos el bitmap en una superficie de 24 bits
|
||||
SDL_Surface *temp;
|
||||
temp = SDL_CreateRGBSurface(SDL_SWSURFACE,width,height,24,0,0,0,0);
|
||||
if(SDL_MUSTLOCK(temp))
|
||||
SDL_LockSurface(temp);
|
||||
Uint32 pixel;
|
||||
int x,y,color;
|
||||
for(y=0;y<height;y++) //el tamaño del grafico es de ancho * alto * 3 (24 bits)
|
||||
{
|
||||
for(x=0;x<width;x++)
|
||||
{
|
||||
color=getc(Tsrc);
|
||||
pixel = SDL_MapRGB(temp->format,paleta[color*3],paleta[(color*3)+1],paleta[(color*3)+2]);
|
||||
Uint8 *p = (Uint8 *)temp->pixels + (y) * temp->pitch + (x) * 3;
|
||||
p[0] = pixel & 0xff;
|
||||
p[1] = (pixel >> 8) & 0xff;
|
||||
p[2] = (pixel >> 16) & 0xff;
|
||||
}
|
||||
}
|
||||
if(SDL_MUSTLOCK(temp))
|
||||
SDL_UnlockSurface(temp);
|
||||
Tsurface = SDL_DisplayFormat(temp);
|
||||
SDL_FreeSurface(temp);
|
||||
fclose(Tsrc);
|
||||
return(Tsurface);
|
||||
}
|
||||
55
project/jni/application/pachi/src/init.h
Normal file
55
project/jni/application/pachi/src/init.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void initsdl()
|
||||
{
|
||||
|
||||
int have_joystick=0;
|
||||
|
||||
if(SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0)
|
||||
{
|
||||
fprintf(stderr,"Could not Initialize SDL.\nError: %s\n", SDL_GetError());
|
||||
exit (1);
|
||||
}
|
||||
if(Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0)
|
||||
{
|
||||
fprintf(stderr,"Warning: Couldn't set 44100 Hz 16-bit audio\n: %s\n", SDL_GetError());
|
||||
}
|
||||
SDL_WM_SetIcon(SDL_LoadBMP(DATADIR"/Tgfx/icon.bmp"),NULL);
|
||||
|
||||
fullscreen=0;
|
||||
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp, SDL_HWSURFACE|SDL_DOUBLEBUF);
|
||||
if (screen == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't set the video mode. Quitting.\nError; %s\n", SDL_GetError());
|
||||
exit (1);
|
||||
}
|
||||
|
||||
have_joystick = SDL_NumJoysticks();
|
||||
// fprintf(stderr, "%i joysticks were found.\n", have_joystick );
|
||||
if (have_joystick)
|
||||
{
|
||||
SDL_JoystickEventState(SDL_ENABLE);
|
||||
joystick = SDL_JoystickOpen(0);
|
||||
}
|
||||
|
||||
SDL_ShowCursor(0);
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
SDL_WM_SetCaption("Pachi el marciano", "Pachi el marciano");
|
||||
}
|
||||
401
project/jni/application/pachi/src/input.h
Normal file
401
project/jni/application/pachi/src/input.h
Normal file
@@ -0,0 +1,401 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void credits_events()
|
||||
{
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
check_joystick_events(&event, joypos);
|
||||
if(event.type==SDL_KEYDOWN)
|
||||
if(event.key.keysym.sym==SDLK_ESCAPE || event.key.keysym.sym==SDLK_RETURN || event.key.keysym.sym==SDLK_SPACE)
|
||||
escape_exit=1;
|
||||
if(joypos[JOY_BUTTON0])
|
||||
escape_exit=1;
|
||||
}
|
||||
}
|
||||
|
||||
void pause_events()
|
||||
{
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
if(event.type==SDL_KEYDOWN)
|
||||
if(event.key.keysym.sym==SDLK_h || event.key.keysym.sym==SDLK_F1)
|
||||
escape_exit=1;
|
||||
}
|
||||
}
|
||||
|
||||
void hiscore_events()
|
||||
{
|
||||
int n;
|
||||
SDL_Event event;
|
||||
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_KEYDOWN:
|
||||
{
|
||||
if(event.key.keysym.sym>41)
|
||||
{
|
||||
playername[namechar] = event.key.keysym.sym;
|
||||
if(playername[namechar]>=97 && playername[namechar]<=122)
|
||||
playername[namechar]=event.key.keysym.sym-32;
|
||||
if(namechar < 9)
|
||||
namechar++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(event.key.keysym.sym==SDLK_RETURN || event.key.keysym.sym == SDLK_ESCAPE)
|
||||
inputloop=0;
|
||||
if(event.key.keysym.sym==SDLK_BACKSPACE)
|
||||
{
|
||||
namechar=0;
|
||||
for(n=0;n<10;n++)
|
||||
playername[n] = '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
check_joystick_events(&event, joypos);
|
||||
if (joypos[JOY_UP])
|
||||
{
|
||||
playername[namechar]++;
|
||||
if(playername[namechar]>=97 && playername[namechar]<=122)
|
||||
playername[namechar]-=32;
|
||||
}
|
||||
if (joypos[JOY_DOWN])
|
||||
{
|
||||
playername[namechar]--;
|
||||
if(playername[namechar]>=97 && playername[namechar]<=122)
|
||||
playername[namechar]-=32;
|
||||
}
|
||||
if (joypos[JOY_BUTTON0])
|
||||
{
|
||||
namechar++;
|
||||
if(namechar > 3)
|
||||
namechar=0;
|
||||
}
|
||||
if (joypos[JOY_BUTTON1])
|
||||
inputloop=0;
|
||||
}
|
||||
}
|
||||
|
||||
void menu_events()
|
||||
{
|
||||
SDL_Event event;
|
||||
Uint8 *keys;
|
||||
Mix_Volume(0,100);
|
||||
while(SDL_PollEvent(&event)==1)
|
||||
{
|
||||
if(event.type==SDL_QUIT)
|
||||
gameexit=1;
|
||||
|
||||
check_joystick_events(&event, joypos);
|
||||
keys = SDL_GetKeyState(NULL);
|
||||
if(keys[SDLK_DOWN] || keys[SDLK_KP2] || keys[SDLK_a] || joypos[JOY_DOWN])
|
||||
{
|
||||
Mix_PlayChannel(0,option,0);
|
||||
if(menuvalue == 7)
|
||||
menuvalue=1;
|
||||
else
|
||||
menuvalue++;
|
||||
}
|
||||
if(keys[SDLK_UP] || keys[SDLK_KP8] || keys[SDLK_q] || joypos[JOY_UP])
|
||||
{
|
||||
Mix_PlayChannel(0,option,0);
|
||||
if(menuvalue == 1)
|
||||
menuvalue = 7;
|
||||
else
|
||||
menuvalue--;
|
||||
}
|
||||
if(keys[SDLK_SPACE] || keys[SDLK_RETURN] || joypos[JOY_BUTTON0])
|
||||
{
|
||||
Mix_PlayChannel(0,option,0);
|
||||
|
||||
switch(menuvalue)
|
||||
{
|
||||
case 1:
|
||||
startgame = 1;
|
||||
break;
|
||||
case 2:
|
||||
dificulty++;
|
||||
if(dificulty>3)
|
||||
dificulty=1;
|
||||
break;
|
||||
case 3:
|
||||
screen_mode();
|
||||
setback();
|
||||
joypos[JOY_BUTTON0]=0;
|
||||
break;
|
||||
case 4:
|
||||
do_code();
|
||||
break;
|
||||
case 5:
|
||||
help=1;
|
||||
break;
|
||||
case 6:
|
||||
hiscores=1;
|
||||
break;
|
||||
case 7:
|
||||
gameexit = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(keys[SDLK_ESCAPE])
|
||||
gameexit=1;
|
||||
}
|
||||
}
|
||||
|
||||
void code_events()
|
||||
{
|
||||
int n;
|
||||
SDL_Event event;
|
||||
|
||||
while(SDL_PollEvent(&event)==1)
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_KEYDOWN:
|
||||
{
|
||||
if(event.key.keysym.sym>41)
|
||||
{
|
||||
code[codechar] = event.key.keysym.sym;
|
||||
if(code[codechar]>=97 && code[codechar]<=122)
|
||||
code[codechar]=event.key.keysym.sym-32;
|
||||
if(codechar < 3)
|
||||
codechar++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(event.key.keysym.sym== SDLK_RETURN || event.key.keysym.sym == SDLK_ESCAPE)
|
||||
inputloop=0;
|
||||
if(event.key.keysym.sym== SDLK_BACKSPACE)
|
||||
{
|
||||
SDL_Rect coderect;
|
||||
coderect.x=303;
|
||||
coderect.y=235;
|
||||
coderect.w=194;
|
||||
coderect.h=44;
|
||||
SDL_FillRect(screen, &coderect, SDL_MapRGB(screen->format,0,0,0));
|
||||
|
||||
|
||||
codechar=0;
|
||||
for(int n=0;n<4;n++)
|
||||
code[n] = '.' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
check_joystick_events(&event, joypos);
|
||||
if (joypos[JOY_UP])
|
||||
{
|
||||
code[codechar]++;
|
||||
if(code[codechar]>=97 && code[codechar]<=122)
|
||||
code[codechar]-=32;
|
||||
}
|
||||
if (joypos[JOY_DOWN])
|
||||
{
|
||||
code[codechar]--;
|
||||
if(code[codechar]>=97 && code[codechar]<=122)
|
||||
code[codechar]-=32;
|
||||
}
|
||||
if (joypos[JOY_BUTTON0])
|
||||
{
|
||||
codechar++;
|
||||
if(codechar > 3)
|
||||
codechar=0;
|
||||
}
|
||||
if (joypos[JOY_BUTTON1])
|
||||
inputloop=0;
|
||||
}
|
||||
}
|
||||
|
||||
void check_joystick_events(SDL_Event *event, Uint8 *joypos)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case SDL_JOYAXISMOTION: /* Handle Joystick Motion */
|
||||
if( event->jaxis.axis == 0)
|
||||
{ /* Left-Right movement code goes here */
|
||||
if ( event->jaxis.value < -3200)
|
||||
{
|
||||
joypos[JOY_LEFT]=1;
|
||||
joypos[JOY_RIGHT]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( event->jaxis.value > 3200)
|
||||
{
|
||||
joypos[JOY_LEFT]=0;
|
||||
joypos[JOY_RIGHT]=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
joypos[JOY_LEFT]=0;
|
||||
joypos[JOY_RIGHT]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( event->jaxis.axis == 1)
|
||||
{ /* Up-Down movement code goes here */
|
||||
if ( event->jaxis.value < -3200)
|
||||
{
|
||||
joypos[JOY_UP]=1;
|
||||
joypos[JOY_DOWN]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( event->jaxis.value > 3200)
|
||||
{
|
||||
joypos[JOY_UP]=0;
|
||||
joypos[JOY_DOWN]=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
joypos[JOY_UP]=0;
|
||||
joypos[JOY_DOWN]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDL_JOYBUTTONDOWN: /* Handle Joystick Button Presses */
|
||||
switch (event->jbutton.button)
|
||||
{
|
||||
case 0:
|
||||
joypos[JOY_BUTTON0]=1; break;
|
||||
case 1:
|
||||
joypos[JOY_BUTTON1]=1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SDL_JOYBUTTONUP: /* Handle Joystick Button Releases */
|
||||
switch (event->jbutton.button)
|
||||
{
|
||||
case 0:
|
||||
joypos[JOY_BUTTON0]=0;
|
||||
break;
|
||||
case 1:
|
||||
joypos[JOY_BUTTON1]=0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void game_events()
|
||||
{
|
||||
int n;
|
||||
SDL_Event event;
|
||||
Uint8 *keys;
|
||||
|
||||
if(mplayer[dificulty].lives==0)
|
||||
game_exit = 1;
|
||||
|
||||
|
||||
while(SDL_PollEvent(&event)==1)
|
||||
{
|
||||
check_joystick_events(&event, joypos);
|
||||
keys = SDL_GetKeyState(NULL);
|
||||
|
||||
mplayer[dificulty].left = 0;
|
||||
mplayer[dificulty].right = 0;
|
||||
|
||||
if(keys[SDLK_h] || keys[SDLK_F1])
|
||||
{
|
||||
escape_exit=0;
|
||||
SDL_Rect dst;
|
||||
dst.x=300; dst.y=200; dst.w=192; dst.h=32;
|
||||
SDL_Rect src;
|
||||
src.x=dst.x-R_gamearea_x; src.y=dst.y-R_gamearea_y; src.w=dst.w; src.h=dst.h;
|
||||
print_text(menufont, screen, 32, 32, dst.x, dst.y, "PAUSED");
|
||||
SDL_UpdateRect(screen, dst.x, dst.y , dst.w, dst.h);
|
||||
while(escape_exit==0)
|
||||
{
|
||||
pause_events();
|
||||
SDL_Delay(5);
|
||||
}
|
||||
SDL_BlitSurface(screenbak, &src, screen, &dst);
|
||||
SDL_UpdateRect(screen, dst.x, dst.y , dst.w, dst.w);
|
||||
}
|
||||
if(keys[SDLK_o] || keys[SDLK_LEFT] || keys[SDLK_KP4] || joypos[JOY_LEFT])
|
||||
{
|
||||
mplayer[dificulty].left = 1;
|
||||
mplayer[dificulty].right = 0;
|
||||
mplayer[dificulty].facingleft = 1;
|
||||
}
|
||||
if(keys[SDLK_p] || keys[SDLK_RIGHT] || keys[SDLK_KP6] || joypos[JOY_RIGHT])
|
||||
{
|
||||
mplayer[dificulty].right = 1;
|
||||
mplayer[dificulty].left = 0;
|
||||
mplayer[dificulty].facingleft = 0;
|
||||
}
|
||||
if(keys[SDLK_q] || keys[SDLK_UP] || keys[SDLK_KP8] || joypos[JOY_UP])
|
||||
{
|
||||
if(mplayer[dificulty].duck==1) // en esta rutina tiene que comprobar que si se quiere parar que no tenga nada encima que se lo impida
|
||||
{
|
||||
mplayer[dificulty].duck = 0;
|
||||
mplayer[dificulty].framer = 1;
|
||||
mplayer[dificulty].y = mplayer[dificulty].old_y - (P_h - P_h/2);
|
||||
for(int n=0;n<=mplayer[dificulty].w-1;n++)
|
||||
{
|
||||
int x=int(mplayer[dificulty].x+n)/R_tileside;
|
||||
int y=int((mplayer[dificulty].y - (P_h - P_h/2)+R_tileside)/R_tileside);
|
||||
chk_touched(x,y);
|
||||
if((mroom.data[x][y] >= 80) && (mroom.data[x][y] < 200))
|
||||
{
|
||||
mplayer[dificulty].duck = 1;
|
||||
mplayer[dificulty].framer = 2;
|
||||
mplayer[dificulty].y = mplayer[dificulty].old_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(keys[SDLK_a] || keys[SDLK_DOWN] || keys[SDLK_KP2] || joypos[JOY_DOWN])
|
||||
{
|
||||
if(mplayer[dificulty].duck==0 && mplayer[dificulty].jump == 0 && mplayer[dificulty].infloor == 1)
|
||||
{
|
||||
mplayer[dificulty].y = mplayer[dificulty].y + (P_h - P_h/2);
|
||||
mplayer[dificulty].ducked = 1;
|
||||
}
|
||||
if(mplayer[dificulty].jump == 0 && mplayer[dificulty].infloor == 1)
|
||||
mplayer[dificulty].duck = 1;
|
||||
}
|
||||
if(keys[SDLK_SPACE] || keys[SDLK_KP0] || joypos[JOY_BUTTON0])
|
||||
{
|
||||
if((mplayer[dificulty].infloor==1)&&(mplayer[dificulty].duck==0)&&(mplayer[dificulty].y+P_h/R_tileside==int(mplayer[dificulty].y+P_h/R_tileside)))
|
||||
{
|
||||
mplayer[dificulty].jumpcounter=0;
|
||||
mplayer[dificulty].startjump=int(mplayer[dificulty].y);
|
||||
mplayer[dificulty].upflag=1;
|
||||
mplayer[dificulty].downflag=0;
|
||||
mplayer[dificulty].jump = 1;
|
||||
Mix_Volume(0,100);
|
||||
Mix_PlayChannel(0,jump,0);
|
||||
}
|
||||
}
|
||||
if(keys[SDLK_ESCAPE])
|
||||
{
|
||||
game_exit = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
115
project/jni/application/pachi/src/intro.h
Normal file
115
project/jni/application/pachi/src/intro.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void init_intro()
|
||||
{
|
||||
SDL_Surface *temp;
|
||||
|
||||
dragontech=LoadT8(DATADIR"/Tgfx/dragontech.T8");
|
||||
line1=LoadT8(DATADIR"/Tgfx/line1.T8");
|
||||
line2=LoadT8(DATADIR"/Tgfx/line2.T8");
|
||||
SDL_SetColorKey(dragontech, SDL_SRCCOLORKEY,SDL_MapRGB(dragontech->format,0,255,0));
|
||||
SDL_SetColorKey(line1, SDL_SRCCOLORKEY,SDL_MapRGB(line1->format,0,0,0));
|
||||
SDL_SetColorKey(line2, SDL_SRCCOLORKEY,SDL_MapRGB(line2->format,0,0,0));
|
||||
|
||||
comic_01=LoadT8(DATADIR"/Tgfx/comic_01.T8");
|
||||
|
||||
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, screen_w, screen_h, screen_bpp, 255, 255, 255, 0);
|
||||
SDL_FillRect(temp, NULL, SDL_MapRGB(temp->format,0,0,0));
|
||||
black = SDL_DisplayFormat(temp);
|
||||
|
||||
SDL_FreeSurface(temp);
|
||||
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,0,0,0));
|
||||
}
|
||||
|
||||
void end_intro()
|
||||
{
|
||||
SDL_FreeSurface(dragontech);
|
||||
SDL_FreeSurface(line1);
|
||||
SDL_FreeSurface(line2);
|
||||
SDL_FreeSurface(comic_01);
|
||||
SDL_FreeSurface(black);
|
||||
}
|
||||
|
||||
void intro()
|
||||
{
|
||||
init_intro();
|
||||
double introtime=0;
|
||||
escape_exit=0;
|
||||
float title_alpha=0;
|
||||
int title_done=0;
|
||||
int n=1;
|
||||
while(escape_exit==0)
|
||||
{
|
||||
if(n<=4) // 4 son los pasos a realizar en la primer parte de la intro
|
||||
{
|
||||
if(title_alpha<255)
|
||||
{
|
||||
switch(n)
|
||||
{
|
||||
case 1:
|
||||
title_alpha=intro_blit(dragontech, 160, 100, 480, 170, title_alpha, 80, 1);
|
||||
break;
|
||||
case 2:
|
||||
title_alpha=intro_blit(line1, 60, 300, 600, 40, title_alpha, 80, 1);
|
||||
break;
|
||||
case 3:
|
||||
title_alpha=intro_blit(line2, 160, 350, 600, 40, title_alpha, 80, 1);
|
||||
break;
|
||||
case 4:
|
||||
if(introtime>15)
|
||||
title_alpha=intro_blit(black, 0,0,800,600, title_alpha, 80, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
title_alpha=0;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
credits_events();
|
||||
delta_time();
|
||||
introtime+=imove;
|
||||
SDL_Delay(1);
|
||||
if(introtime>20)
|
||||
escape_exit=1;
|
||||
}
|
||||
|
||||
escape_exit=0; n=1; title_alpha=0; introtime=0;
|
||||
while(escape_exit==0)
|
||||
{
|
||||
if(title_alpha<255)
|
||||
{
|
||||
title_alpha=intro_blit(comic_01, 0, 0, 800, 600, title_alpha, 60, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
title_alpha=0;
|
||||
n++;
|
||||
}
|
||||
credits_events();
|
||||
delta_time();
|
||||
introtime+=imove;
|
||||
SDL_Delay(1);
|
||||
if(introtime>25)
|
||||
escape_exit=1;
|
||||
}
|
||||
|
||||
end_intro();
|
||||
}
|
||||
134
project/jni/application/pachi/src/menu.h
Normal file
134
project/jni/application/pachi/src/menu.h
Normal file
@@ -0,0 +1,134 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void do_code()
|
||||
{
|
||||
Mix_Volume(3,100);
|
||||
SDL_Rect coderect;
|
||||
coderect.x=300;
|
||||
coderect.y=232;
|
||||
coderect.w=200;
|
||||
coderect.h=50;
|
||||
SDL_FillRect(screen, &coderect, SDL_MapRGB(screen->format,255,255,255));
|
||||
coderect.x=303;
|
||||
coderect.y=235;
|
||||
coderect.w=194;
|
||||
coderect.h=44;
|
||||
SDL_FillRect(screen, &coderect, SDL_MapRGB(screen->format,0,0,0));
|
||||
codechar=0;
|
||||
inputloop=1;
|
||||
// SDL_SetColorKey(menufont1,0,SDL_MapRGB(menufont1->format,0,255,0));
|
||||
while(inputloop==1)
|
||||
{
|
||||
code_events();
|
||||
print_text(menufont1, screen, 32, 32, 336, 241, "%s",code);
|
||||
SDL_UpdateRect(screen, 300, 232, 200, 50);
|
||||
}
|
||||
// SDL_SetColorKey(menufont1,SDL_SRCCOLORKEY,SDL_MapRGB(menufont1->format,0,255,0));
|
||||
|
||||
// comparar si el codigo es correcto
|
||||
|
||||
startstage = 0;
|
||||
int right = 0;
|
||||
|
||||
int n;
|
||||
for(n=1;n < NUM_STAGES+1;n++)
|
||||
{
|
||||
if(strcmp(code,mstage[n-1].code)==0)
|
||||
{
|
||||
startstage=n-1;
|
||||
right=1;
|
||||
}
|
||||
}
|
||||
if(right==1)
|
||||
Mix_PlayChannel(3,coderight,0);
|
||||
else
|
||||
Mix_PlayChannel(3,codewrong,0);
|
||||
|
||||
setback();
|
||||
}
|
||||
|
||||
void do_menu()
|
||||
{
|
||||
SDL_Delay(1);
|
||||
font = menufont;
|
||||
|
||||
int menustartpos=156;
|
||||
|
||||
if(menuvalue == 1) font = menufont1; else font = menufont;
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos, " PLAY");
|
||||
if(menuvalue == 2) font = menufont1; else font = menufont;
|
||||
{
|
||||
SDL_Rect restoremenu;
|
||||
restoremenu.x=305; restoremenu.y=menustartpos+(1*40);restoremenu.w=300;restoremenu.h=32;
|
||||
SDL_BlitSurface(background,&restoremenu,screen,&restoremenu);
|
||||
|
||||
if(dificulty==1)
|
||||
{
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos+(1*40), " EASY");
|
||||
}
|
||||
if(dificulty==2)
|
||||
{
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos+(1*40), "NORMAL");
|
||||
}
|
||||
if(dificulty==3)
|
||||
{
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos+(1*40), " HARD");
|
||||
}
|
||||
}
|
||||
if(menuvalue == 3) font = menufont1; else font = menufont;
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos+(2*40), "SCREEN");
|
||||
if(menuvalue == 4) font = menufont1; else font = menufont;
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos+(3*40), " CODE");
|
||||
if(menuvalue == 5) font = menufont1; else font = menufont;
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos+(4*40), " HELP");
|
||||
if(menuvalue == 6) font = menufont1; else font = menufont;
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos+(5*40), "SCORES");
|
||||
if(menuvalue == 7) font = menufont1; else font = menufont;
|
||||
print_text(font, screen, 32, 32 ,305, menustartpos+(6*40), " EXIT");
|
||||
|
||||
SDL_UpdateRect(screen, 300, 160, 240, 300);
|
||||
}
|
||||
|
||||
void menu_loop()
|
||||
{
|
||||
do_menu();
|
||||
if(!Mix_PlayingMusic())
|
||||
Mix_PlayMusic(music,0);
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
void menu()
|
||||
{
|
||||
load_menudata();
|
||||
float alpha=0;
|
||||
while(alpha<255)
|
||||
{
|
||||
alpha=intro_blit(background,0,0,800,600,alpha,200,0);
|
||||
delta_time();
|
||||
}
|
||||
SDL_Flip(screen);
|
||||
menuvalue=1;
|
||||
while(gameexit==0 && startgame==0 && help==0 && hiscores==0)
|
||||
{
|
||||
menu_events();
|
||||
menu_loop();
|
||||
}
|
||||
unload_menudata();
|
||||
stop_music();
|
||||
}
|
||||
215
project/jni/application/pachi/src/monsters.h
Normal file
215
project/jni/application/pachi/src/monsters.h
Normal file
@@ -0,0 +1,215 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
// -------------------------------------------------
|
||||
// RUTINAS DE CHEQUEO DE COLISIONES DE LOS MONSTRUOS
|
||||
// -------------------------------------------------
|
||||
void check_monster_down(int n)
|
||||
{
|
||||
if((M_y[n] + M_h) > (R_tileside*(R_maxtiles_v-1)))
|
||||
{
|
||||
M_direction[n] = 1;
|
||||
M_y[n]--;
|
||||
}
|
||||
if((M_y[n]+M_h)/R_tileside >= int(M_y[n]+M_h)/R_tileside)
|
||||
{
|
||||
for(int m=0;m<=M_w-1;m++)
|
||||
{
|
||||
if(mroom.data[int(M_x[n]+m)/R_tileside][int((M_y[n]+M_h)/R_tileside)] >= 40)
|
||||
{
|
||||
M_direction[n] = 1;
|
||||
M_y[n]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Chequeo de colision contra otro monstruo
|
||||
for(int m=0;m<=M_max4room-1;m++)
|
||||
{
|
||||
if(n!=m && M_type[m]!=0)
|
||||
{
|
||||
if(M_y[n] < M_y[m]+M_h && M_y[n]+M_h > M_y[m])
|
||||
if(M_x[n] < M_x[m]+M_w && M_x[n]+M_w > M_x[m])
|
||||
{
|
||||
M_direction[n] = 1;
|
||||
M_y[n]-=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void check_monster_up(int n)
|
||||
{
|
||||
if(M_y[n] < R_tileside)
|
||||
{
|
||||
M_direction[n] = 0;
|
||||
M_y[n]++;
|
||||
}
|
||||
// if((M_y[n])/R_tileside <= int(M_y[n])/R_tileside)
|
||||
// {
|
||||
for(int m=0;m<=M_w-1;m++)
|
||||
{
|
||||
if(mroom.data[int(M_x[n]+m)/R_tileside][int((M_y[n])/R_tileside)] >= 40)
|
||||
{
|
||||
M_direction[n] = 0;
|
||||
M_y[n]++;
|
||||
}
|
||||
}
|
||||
// }
|
||||
// Chequeo de colision contra otro monstruo
|
||||
for(int m=0;m<=M_max4room-1;m++)
|
||||
{
|
||||
if(m!=n && M_type[m]!=0)
|
||||
{
|
||||
if(M_y[n] < M_y[m]+M_h && M_y[n]+M_h > M_y[m])
|
||||
if(M_x[n] < M_x[m]+M_w && M_x[n]+M_w > M_x[m])
|
||||
{
|
||||
M_direction[n] = 0;
|
||||
M_y[n]+=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void check_monster_left(int n)
|
||||
{
|
||||
if(M_x[n] < R_tileside)
|
||||
{
|
||||
M_direction[n] = 0;
|
||||
M_x[n]++;
|
||||
}
|
||||
if((M_x[n])/R_tileside >= int(M_x[n])/R_tileside)
|
||||
{
|
||||
for(int m=0;m<=M_h-1;m++)
|
||||
{
|
||||
if(mroom.data[int(M_x[n])/R_tileside][int((M_y[n]+m)/R_tileside)] >= 40)
|
||||
{
|
||||
M_direction[n] = 0;
|
||||
M_x[n]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Chequeo de colision contra otro monstruo
|
||||
for(int m=0;m<=M_max4room-1;m++)
|
||||
{
|
||||
if(m!=n && M_type[m]!=0)
|
||||
{
|
||||
if(M_y[n] < M_y[m]+M_h && M_y[n]+M_h > M_y[m])
|
||||
if(M_x[n] < M_x[m]+M_w && M_x[n]+M_w > M_x[m])
|
||||
{
|
||||
M_direction[n] = 0;
|
||||
M_x[n]+=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void check_monster_right(int n)
|
||||
{
|
||||
if((M_x[n] + M_w) > (R_tileside*(R_maxtiles_h-1)))
|
||||
{
|
||||
M_direction[n] = 1;
|
||||
M_x[n]--;
|
||||
}
|
||||
if((M_x[n]+M_w)/R_tileside >= int(M_x[n]+M_w)/R_tileside)
|
||||
{
|
||||
for(int m=0;m<=M_h-1;m++)
|
||||
{
|
||||
if(mroom.data[int(M_x[n]+M_w)/R_tileside][int((M_y[n]+m)/R_tileside)] >= 40)
|
||||
{
|
||||
M_direction[n] = 1;
|
||||
M_x[n]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Chequeo de colision contra otro monstruo
|
||||
for(int m=0;m<=M_max4room-1;m++)
|
||||
{
|
||||
if(m!=n && M_type[m]!=0)
|
||||
{
|
||||
if(M_y[n] < M_y[m]+M_h && M_y[n]+M_h > M_y[m])
|
||||
if(M_x[n] < M_x[m]+M_w && M_x[n]+M_w > M_x[m])
|
||||
{
|
||||
M_direction[n] = 1;
|
||||
M_x[n]-=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void move_monster(int n)
|
||||
{
|
||||
if(M_type[n] > 12) // los monstruos que sean tipo mayor a 12 se mueven en el eje Y y los menores de mueven en el eje X
|
||||
{
|
||||
if(M_direction[n] == 1)
|
||||
{
|
||||
M_y[n]=M_y[n]-(M_speed[dificulty]*imove);
|
||||
check_monster_up(n); //up
|
||||
}
|
||||
if(M_direction[n] == 0)
|
||||
{
|
||||
M_y[n]=M_y[n]+(M_speed[dificulty]*imove);
|
||||
check_monster_down(n); //down
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(M_direction[n] == 1)
|
||||
{
|
||||
M_x[n]=M_x[n]-(M_speed[dificulty]*imove);
|
||||
check_monster_left(n); // left
|
||||
}
|
||||
if(M_direction[n] == 0)
|
||||
{
|
||||
M_x[n]=M_x[n]+(M_speed[dificulty]*imove);
|
||||
check_monster_right(n); //right
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print_monsters()
|
||||
{
|
||||
for(int n=0;n<=M_max4room-1;n++)
|
||||
{
|
||||
if(M_type[n] != 0)
|
||||
{
|
||||
oldmonsterpos.x = int(M_x[n]);
|
||||
oldmonsterpos.y = int(M_y[n]);
|
||||
oldmonsterpos.h = M_h;
|
||||
oldmonsterpos.w = M_w;
|
||||
oldmonsterposreal.x = int(M_x[n]+R_gamearea_x);
|
||||
oldmonsterposreal.y = int(M_y[n]+R_gamearea_y);
|
||||
|
||||
monstersrc.y = M_type[n] * M_h;
|
||||
monstersrc.x = ((M_frame - 1)+(M_direction[n]*M_frames)) * M_w;
|
||||
monstersrc.h = M_h;
|
||||
monstersrc.w = M_w;
|
||||
move_monster(n);
|
||||
|
||||
monsterpos.x = int(M_x[n]);
|
||||
monsterpos.y = int(M_y[n]);
|
||||
monsterposreal.x = monsterpos.x + R_gamearea_x;
|
||||
monsterposreal.y = monsterpos.y + R_gamearea_y;
|
||||
|
||||
SDL_BlitSurface(screenbak, &oldmonsterpos, screen, &oldmonsterposreal);
|
||||
SDL_BlitSurface(monsters, &monstersrc, screen, &monsterposreal);
|
||||
SDL_UpdateRect(screen,oldmonsterposreal.x,oldmonsterposreal.y,M_w,M_h);
|
||||
SDL_UpdateRect(screen,monsterposreal.x,monsterposreal.y,M_w,M_h);
|
||||
}
|
||||
}
|
||||
}
|
||||
363
project/jni/application/pachi/src/output.h
Normal file
363
project/jni/application/pachi/src/output.h
Normal file
@@ -0,0 +1,363 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void screen_mode()
|
||||
{
|
||||
if(fullscreen)
|
||||
{
|
||||
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp,0);
|
||||
fullscreen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp,SDL_FULLSCREEN);
|
||||
fullscreen = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void print_credits()
|
||||
{
|
||||
int creditsfont_h = 25;
|
||||
int creditsfont_w = 18;
|
||||
if(needinput==1) // la variable needinput indica si se debe imprimir una nueva linea de texto
|
||||
{
|
||||
char line2print[100]; // esta es la cadena de texto que contiene el renglon a imprimir
|
||||
|
||||
for(int n=0; n<=37; n++)
|
||||
line2print[n]=creditstext[n+(creditslinecounter*36)];
|
||||
|
||||
print_text(creditsfont, creditsbuffer, creditsfont_w, creditsfont_h, 0,400, line2print);
|
||||
// imprime una linea de texto en la parte de abajo (no imprimible del primer buffer)
|
||||
|
||||
needinput=0;
|
||||
creditslinecounter++;
|
||||
if(creditslinecounter==creditslines)
|
||||
{
|
||||
creditslinecounter--;
|
||||
wrapcounter++;
|
||||
if(wrapcounter==100)
|
||||
{
|
||||
creditslinecounter=0;
|
||||
wrapcounter=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // si no se imprime una nueva linea se debe hacer el scroll entre los buffers
|
||||
{
|
||||
SDL_Rect cbuffer;
|
||||
cbuffer.w = 600;
|
||||
cbuffer.h = 440;
|
||||
cbuffer.x = 0;
|
||||
cbuffer.y = 1;
|
||||
|
||||
SDL_Rect cbuffer1;
|
||||
cbuffer1.w = 600;
|
||||
cbuffer1.h = 400;
|
||||
cbuffer1.x = 0;
|
||||
cbuffer1.y = 0;
|
||||
|
||||
SDL_Rect creditspos;
|
||||
creditspos.w=600;
|
||||
creditspos.h=400;
|
||||
creditspos.x=100;
|
||||
creditspos.y=100;
|
||||
|
||||
SDL_Rect bgpos;
|
||||
bgpos.w=600;
|
||||
bgpos.h=420;
|
||||
bgpos.x=100;
|
||||
bgpos.y=100;
|
||||
|
||||
SDL_SetColorKey(creditsbuffer, 0, 0);
|
||||
SDL_SetAlpha(creditsbuffer, SDL_SRCALPHA, 255);
|
||||
SDL_BlitSurface(creditsbuffer, &cbuffer, creditsbuffer1, &cbuffer1);
|
||||
SDL_BlitSurface(creditsbuffer1, &cbuffer1, creditsbuffer, &cbuffer1);
|
||||
SDL_BlitSurface(background, &bgpos, screen, &bgpos);
|
||||
SDL_SetColorKey(creditsbuffer, SDL_SRCCOLORKEY, SDL_MapRGB(creditsbuffer->format, 0, 255, 0));
|
||||
SDL_SetAlpha(creditsbuffer, SDL_SRCALPHA, 128);
|
||||
SDL_BlitSurface(creditsbuffer, &cbuffer1, screen, &creditspos);
|
||||
SDL_UpdateRect(screen,100,100,600,400);
|
||||
SDL_Delay(50);
|
||||
|
||||
linegone++;
|
||||
if(linegone == creditsfont_h)
|
||||
{
|
||||
needinput = 1;
|
||||
linegone = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void do_help()
|
||||
{
|
||||
load_helpgfx();
|
||||
fadesurface(background, 0, 0, 150);
|
||||
print_text(scorefont, screen, 16, 16, 72, 68, " HOW TO PLAY PACHI EL MARCIANO ");
|
||||
print_text(scorefont1, screen, 16, 16, 72, 120, "KEYS:");
|
||||
print_text(scorefont1, screen, 16, 16,100, 140, "RIGHT : P");
|
||||
print_text(scorefont1, screen, 16, 16,100, 160, "LEFT : O");
|
||||
print_text(scorefont1, screen, 16, 16,100, 180, "DUCK : A");
|
||||
print_text(scorefont1, screen, 16, 16,100, 200, "STAND UP : Q");
|
||||
print_text(scorefont1, screen, 16, 16,100, 220, "JUMP : SPACE");
|
||||
print_text(scorefont1, screen, 16, 16,100, 240, "PAUSE : H OR F1");
|
||||
print_text(scorefont1, screen, 16, 16, 72, 270, "YOU CAN ALSO USE THE CURSOR KEYS / KEYPAD");
|
||||
|
||||
print_text(scorefont, screen, 16, 16, 72, 300, " THE GOAL OF THE GAME IS TO COLLECT ALL ");
|
||||
print_text(scorefont, screen, 16, 16, 72, 320, " THE OBJECTS OF EACH LEVEL, WHEN THIS IS ");
|
||||
print_text(scorefont, screen, 16, 16, 72, 340, " DONE, THE EXIT GATE TO THE NEXT LEVEL ");
|
||||
print_text(scorefont, screen, 16, 16, 72, 360, "WILL APPEAR, BUT BEWARE OF THE ENEMIES...");
|
||||
|
||||
SDL_Flip(screen);
|
||||
escape_exit=0;
|
||||
while(escape_exit == 0)
|
||||
{
|
||||
credits_events();
|
||||
}
|
||||
unload_helpgfx();
|
||||
}
|
||||
|
||||
void print_monitor()
|
||||
{
|
||||
print_text(scorefont1,screen,16,16,30,485,"%s", mstage[stage-1].title);
|
||||
print_text(scorefont,screen,16,16,30,510, "SCORE:%d", score);
|
||||
print_text(scorefont,screen,16,16,30,528, "LIVES:%d", mplayer[dificulty].lives);
|
||||
print_text(scorefont,screen,16,16,30,546, "STAGE:%d", stage);
|
||||
print_text(scorefont,screen,16,16,30,564, "ITEMS:%d/%d",mplayer[dificulty].objects,mstage[stage-1].objects);
|
||||
SDL_UpdateRect(screen, 30, 482, 500, 100);
|
||||
}
|
||||
|
||||
void blinkscreen(int R,int G, int B, int A)
|
||||
{
|
||||
SDL_FillRect(screen,NULL,SDL_MapRGBA(screen->format,R,G,B,A));
|
||||
SDL_Flip(screen);
|
||||
setback();
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
void print_room()
|
||||
{
|
||||
int x,y;
|
||||
SDL_Rect gamearea;
|
||||
gamearea.x=R_gamearea_x;
|
||||
gamearea.y=R_gamearea_y;
|
||||
gamearea.h=448;
|
||||
gamearea.w=736;
|
||||
SDL_FillRect(screen,&gamearea,0);
|
||||
|
||||
SDL_Rect backs_dst;
|
||||
SDL_Rect backs_src;
|
||||
SDL_Rect backs_dstbak;
|
||||
backs_src.w = R_back_x;
|
||||
backs_src.h = R_back_y;
|
||||
backs_dst.w = R_back_x;
|
||||
backs_dst.h = R_back_y;
|
||||
for(x=0;x < R_maxbacks_h;x++)
|
||||
{
|
||||
for(y=0;y < R_maxbacks_v;y++)
|
||||
{
|
||||
backs_dst.x = R_gamearea_x + (x*R_back_x);
|
||||
backs_dst.y = R_gamearea_y + (y*R_back_y);
|
||||
backs_dstbak.x = x*R_back_x;
|
||||
backs_dstbak.y = y*R_back_y;
|
||||
|
||||
backs_src.y = (int(R_backdata[x][y]/6) * R_back_y);
|
||||
backs_src.x = (R_backdata[x][y] - (int(R_backdata[x][y]/6) * 6))*R_back_x;
|
||||
SDL_BlitSurface(backs,&backs_src,screen,&backs_dst);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Rect tiles_dst;
|
||||
SDL_Rect tiles_dstbak;
|
||||
SDL_Rect tiles_src;
|
||||
tiles_src.w = R_tileside;
|
||||
tiles_src.h = R_tileside;
|
||||
for(x=0;x < R_maxtiles_h;x++)
|
||||
{
|
||||
for(y=0;y < R_maxtiles_v;y++)
|
||||
{
|
||||
tiles_dst.x = R_gamearea_x + (x*R_tileside);
|
||||
tiles_dst.y = R_gamearea_y + (y*R_tileside);
|
||||
tiles_dstbak.x = x*R_tileside;
|
||||
tiles_dstbak.y = y*R_tileside;
|
||||
|
||||
tiles_src.y = (int(mroom.data[x][y]/20) * R_tileside);
|
||||
tiles_src.x = (mroom.data[x][y] - (int(mroom.data[x][y]/20) * 20))*R_tileside;
|
||||
if((mroom.data[x][y] != 0) && (mroom.data[x][y] != 239))
|
||||
SDL_BlitSurface(tiles,&tiles_src,screen,&tiles_dst);
|
||||
if(mroom.data[x][y] == 239 && stagecompleted == 1)
|
||||
SDL_BlitSurface(tiles,&tiles_src,screen,&tiles_dst);
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(screen,&gamearea,screenbak,NULL);
|
||||
print_monitor(); //imprime la informacion del jugador (vidas, puntos, etc)
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
void showcode(char *str)
|
||||
{
|
||||
SDL_Rect code;
|
||||
code.x=280; code.y=220;code.w=240;code.h=50;
|
||||
SDL_FillRect(screen,&code,SDL_MapRGB(screen->format,255,255,255));
|
||||
code.x+=2; code.y+=2;code.w-=4;code.h-=4;
|
||||
SDL_FillRect(screen,&code,SDL_MapRGB(screen->format,0,0,0));
|
||||
code.x=280; code.y=220;code.w=240;code.h=50;
|
||||
print_text(scorefont,screen,16,16,code.x+8,code.y+7,"STAGE CODE IS:");
|
||||
print_text(scorefont1,screen,16,16,code.x+90,code.y+27,"%s",str);
|
||||
SDL_UpdateRect(screen, code.x, code.y, code.w, code.h);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0)
|
||||
{
|
||||
credits_events();
|
||||
SDL_Delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void setback()
|
||||
{
|
||||
SDL_BlitSurface(background,NULL,screen,NULL);
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
void fadesurface(SDL_Surface *surface, int x, int y, int speed)
|
||||
{
|
||||
SDL_Rect dst;
|
||||
dst.x=x; dst.y=y;
|
||||
float alpha=0;
|
||||
while(alpha<255)
|
||||
{
|
||||
delta_time();
|
||||
SDL_SetAlpha(surface, SDL_SRCALPHA, int(alpha));
|
||||
SDL_BlitSurface(surface, NULL, screen, &dst);
|
||||
SDL_Flip(screen);
|
||||
alpha+=(speed*imove);
|
||||
}
|
||||
SDL_SetAlpha(surface, 0, 0);
|
||||
SDL_BlitSurface(surface, NULL, screen, &dst);
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
// speed es la velocidad del fade y blackback es un flag que indica si debe poner un fondo de color antes de imprimir (1=negro, 2=blanco)
|
||||
float intro_blit(SDL_Surface *surface, int x, int y, int w, int h, float blit_alpha, int speed, int back)
|
||||
{
|
||||
SDL_Rect dst;
|
||||
dst.x=x; dst.y=y; dst.w=w; dst.h=h;
|
||||
int alpha=int(blit_alpha);
|
||||
SDL_SetAlpha(surface, SDL_SRCALPHA, alpha);
|
||||
blit_alpha+=(speed*imove);
|
||||
SDL_BlitSurface(surface, NULL, screen, &dst);
|
||||
SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
|
||||
if(back==1)
|
||||
{
|
||||
if(blit_alpha<255)
|
||||
SDL_FillRect(screen, &dst, SDL_MapRGB(screen->format,0,0,0));
|
||||
}
|
||||
if(back==2)
|
||||
{
|
||||
if(blit_alpha<255)
|
||||
SDL_FillRect(screen, &dst, SDL_MapRGB(screen->format,255,255,255));
|
||||
}
|
||||
if(blit_alpha>255)
|
||||
{
|
||||
SDL_SetAlpha(surface, 0, 0);
|
||||
SDL_BlitSurface(surface, NULL, screen, &dst);
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
return(blit_alpha);
|
||||
}
|
||||
|
||||
float fade(SDL_Surface *surface, int x, int y, int w, int h, int R, int G, int B, int speed, float blit_alpha)
|
||||
{
|
||||
SDL_Rect dst;
|
||||
dst.x=x; dst.y=y; dst.w=w; dst.h=h;
|
||||
int alpha=int (blit_alpha);
|
||||
SDL_SetAlpha(surface, SDL_SRCALPHA, alpha);
|
||||
blit_alpha-=(speed*imove);
|
||||
SDL_FillRect(screen, &dst, SDL_MapRGB(screen->format,R,G,B));
|
||||
SDL_BlitSurface(surface, NULL, screen, &dst);
|
||||
SDL_UpdateRect(screen, dst.x, dst.y, dst.w, dst.h);
|
||||
return(blit_alpha);
|
||||
}
|
||||
|
||||
void showposter(int num)
|
||||
{
|
||||
if(num==CEMETERY || num==CAVES || num==CASTLE || num==CASTLE+1 || num==LAB)
|
||||
{
|
||||
escape_exit=0;
|
||||
SDL_Surface *temp;
|
||||
switch(num)
|
||||
{
|
||||
case CEMETERY:
|
||||
background=LoadT8(DATADIR"/Tgfx/cemetery.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
break;
|
||||
case CAVES:
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_02.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/cave.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
break;
|
||||
case CASTLE:
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_03.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
break;
|
||||
case CASTLE+1:
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_04.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/castle.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
break;
|
||||
case LAB:
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_05.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_06.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_07.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/comic_08.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
background=LoadT8(DATADIR"/Tgfx/lab.T8");
|
||||
fadesurface(background, 0, 0, 200);
|
||||
escape_exit=0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
while(escape_exit==0) { credits_events(); SDL_Delay(1); }
|
||||
}
|
||||
background=LoadT8(DATADIR"/Tgfx/gamepanel.T8");
|
||||
fadesurface(background, 0, 0, 250);
|
||||
}
|
||||
384
project/jni/application/pachi/src/player.h
Normal file
384
project/jni/application/pachi/src/player.h
Normal file
@@ -0,0 +1,384 @@
|
||||
/***************************************************************************
|
||||
* Pachi el marciano *
|
||||
* ----------------- *
|
||||
* (c) Santiago Radeff (coding) *
|
||||
* (c) Nicolas Radeff (graphics) *
|
||||
* (c) Peter Hajba (music) *
|
||||
* *
|
||||
* T-1000@Bigfoot.com *
|
||||
****************************************************************************
|
||||
*******************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
*******************************************************************/
|
||||
|
||||
void loose_life()
|
||||
{
|
||||
Mix_Volume(4,100);
|
||||
Mix_PlayChannel(4,die,0);
|
||||
blinkscreen(255,0,0,0);
|
||||
mplayer[dificulty].x=mplayer[dificulty].start_x;
|
||||
mplayer[dificulty].y=mplayer[dificulty].start_y;
|
||||
mplayer[dificulty].h=mplayer[dificulty].h;
|
||||
mplayer[dificulty].left=0;
|
||||
mplayer[dificulty].right=0;
|
||||
mplayer[dificulty].jump=0;
|
||||
mplayer[dificulty].duck=0;
|
||||
mplayer[dificulty].lives--;
|
||||
mplayer[dificulty].jumpcounter=0;
|
||||
mplayer[dificulty].dead=0;
|
||||
if(mplayer[dificulty].lives>0)
|
||||
{
|
||||
blinkscreen(255,255,255,0);
|
||||
load_room();
|
||||
print_room();
|
||||
init_monsters();
|
||||
}
|
||||
}
|
||||
|
||||
void pick_obj(int x, int y) // esta rutina elimina el objeto de la matriz objects, lo elimina de la pantalla y le suma la puntuacion conrrespondiente al jugador
|
||||
{
|
||||
initfade_object(x, y, mroom.data[x][y]);
|
||||
fadingobject=1;
|
||||
mroom.data[x][y]=0;
|
||||
for(int n=0;n<5;n++)
|
||||
{
|
||||
if((mobject[(R_current-1)*5+n].x == x) && (mobject[(R_current-1)*5+n].y == y))
|
||||
{
|
||||
score = score + (50*dificulty);
|
||||
if(sequence==mobject[(R_current-1)*5+n].seq)
|
||||
{
|
||||
gametimer=gametimer+5;
|
||||
Mix_Volume(6,128);
|
||||
Mix_PlayChannel(6,objseq,0);
|
||||
}
|
||||
mobject[(R_current-1)*5+n].type = 0;
|
||||
mobject[(R_current-1)*5+n].x = 0;
|
||||
mobject[(R_current-1)*5+n].y = 0;
|
||||
mobject[(R_current-1)*5+n].seq = 0;
|
||||
print_monitor();
|
||||
}
|
||||
}
|
||||
|
||||
mplayer[dificulty].objects++;
|
||||
Mix_Volume(1,100);
|
||||
if(mplayer[dificulty].objects==mstage[stage-1].objects)
|
||||
{
|
||||
stagecompleted = 1;
|
||||
blinkscreen(255,255,255,0);
|
||||
Mix_PlayChannel(1,stageready,0);
|
||||
}
|
||||
else
|
||||
Mix_PlayChannel(1,obj,0);
|
||||
print_room();
|
||||
}
|
||||
|
||||
void chk_touched(int x, int y)
|
||||
{
|
||||
if((mroom.data[x][y] >= 239) && (stagecompleted == 1))
|
||||
{
|
||||
Mix_HaltMusic();
|
||||
Mix_Volume(0,100);
|
||||
Mix_PlayChannel(0,exitlevel,0);
|
||||
mplayer[dificulty].stageup=1;
|
||||
}
|
||||
if((mroom.data[x][y] >= 220) && (mroom.data[x][y] < 239))
|
||||
mplayer[dificulty].dead=1;
|
||||
if((mroom.data[x][y] < 220) && (mroom.data[x][y] >= 200))
|
||||
pick_obj(x,y);
|
||||
}
|
||||
|
||||
void P_chk_right()
|
||||
{
|
||||
int x, y;
|
||||
if(mplayer[dificulty].x + mplayer[dificulty].w >= (R_tileside*R_maxtiles_h))
|
||||
{
|
||||
R_current++;
|
||||
mplayer[dificulty].x = 2;
|
||||
mplayer[dificulty].start_x = int(mplayer[dificulty].x);
|
||||
mplayer[dificulty].start_y = int(mplayer[dificulty].y);
|
||||
if(mplayer[dificulty].duck==1)
|
||||
mplayer[dificulty].start_y=mplayer[dificulty].start_y-(P_h - P_h/2); // P_h es la altura parado y P_h/2 la altura agachado
|
||||
init_room();
|
||||
}
|
||||
|
||||
for(int n=0;n<=mplayer[dificulty].h-mplayer[dificulty].tolerance;n++)
|
||||
{
|
||||
x=int(mplayer[dificulty].x+mplayer[dificulty].w)/R_tileside;
|
||||
y=int((mplayer[dificulty].y+n)/R_tileside);
|
||||
chk_touched(x, y);
|
||||
|
||||
if(mroom.data[x][y] >= 80 && mroom.data[x][y] < 200)
|
||||
mplayer[dificulty].x=mplayer[dificulty].old_x;
|
||||
}
|
||||
}
|
||||
|
||||
void P_chk_left()
|
||||
{
|
||||
int x, y;
|
||||
if(mplayer[dificulty].x < 2)
|
||||
{
|
||||
R_current--;
|
||||
init_room();
|
||||
mplayer[dificulty].x = R_maxtiles_h*R_tileside - mplayer[dificulty].w;
|
||||
mplayer[dificulty].start_x = int(mplayer[dificulty].x); //estas variables son para cuando se pierde una vida se vuelve el player a esta posicion
|
||||
mplayer[dificulty].start_y = int(mplayer[dificulty].y);
|
||||
if(mplayer[dificulty].duck==1)
|
||||
mplayer[dificulty].start_y=mplayer[dificulty].start_y-(P_h - P_h/2);
|
||||
}
|
||||
|
||||
for(int n=0;n<=mplayer[dificulty].h-mplayer[dificulty].tolerance;n++)
|
||||
{
|
||||
x=int(mplayer[dificulty].x)/R_tileside; //posible P_x -1
|
||||
y=int((mplayer[dificulty].y+1+n)/R_tileside);
|
||||
chk_touched(x,y);
|
||||
|
||||
if(mroom.data[x][y] >= 80 && mroom.data[x][y] < 200)
|
||||
mplayer[dificulty].x=mplayer[dificulty].old_x;
|
||||
}
|
||||
}
|
||||
|
||||
void chk_up()
|
||||
{
|
||||
int x, y;
|
||||
if(mplayer[dificulty].y <= 1)
|
||||
{
|
||||
R_current = R_current - R_max_x;
|
||||
mplayer[dificulty].y = float(((R_maxtiles_v-1)*R_tileside) - mplayer[dificulty].h - 1);
|
||||
mplayer[dificulty].start_x = int(mplayer[dificulty].x); //estas variables son para cuando se pierde una vida se vuelve el player a esta posicion
|
||||
mplayer[dificulty].start_y = int(mplayer[dificulty].y);
|
||||
mplayer[dificulty].startjump=int(mplayer[dificulty].y+(R_tileside*1.5));
|
||||
init_room();
|
||||
}
|
||||
for(int n=0;n<=mplayer[dificulty].w-1;n++)
|
||||
{
|
||||
x=int(mplayer[dificulty].x+n)/R_tileside;
|
||||
y=int(mplayer[dificulty].y/R_tileside);
|
||||
chk_touched(x,y); //esta rutina compruba que tipo de tile toca el personaje
|
||||
|
||||
if(mroom.data[x][y] >= 80 && mroom.data[x][y] < 200)
|
||||
{
|
||||
mplayer[dificulty].y=int((y+1)*R_tileside);
|
||||
if(mplayer[dificulty].jump == 1 && mplayer[dificulty].upflag == 1)
|
||||
{
|
||||
mplayer[dificulty].upflag = 0;
|
||||
mplayer[dificulty].downflag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void chk_down()
|
||||
{
|
||||
int x, y;
|
||||
if((mplayer[dificulty].jump==0) || (mplayer[dificulty].downflag==1))
|
||||
{
|
||||
for(int n=0;n<mplayer[dificulty].w ;n++)
|
||||
{
|
||||
x=int(mplayer[dificulty].x+n)/R_tileside;
|
||||
y=int((mplayer[dificulty].y+mplayer[dificulty].h+1)/R_tileside);
|
||||
chk_touched(x,y);
|
||||
|
||||
if(mroom.data[x][y] >= 40 && mroom.data[x][y] < 200)
|
||||
{
|
||||
mplayer[dificulty].y=mplayer[dificulty].old_y;
|
||||
mplayer[dificulty].infloor=1; // esta varible indica si esta en el suelo
|
||||
mplayer[dificulty].y=int((mplayer[dificulty].y+(R_tileside/2))/R_tileside)*R_tileside;
|
||||
mplayer[dificulty].jump=0;
|
||||
mplayer[dificulty].jumpcounter=0;
|
||||
mplayer[dificulty].upflag=0;
|
||||
mplayer[dificulty].downflag=1;
|
||||
}
|
||||
}
|
||||
if(mplayer[dificulty].y >= (R_maxtiles_v*R_tileside) - mplayer[dificulty].h)
|
||||
{
|
||||
R_current = R_current + R_max_x;
|
||||
init_room();
|
||||
mplayer[dificulty].y = 2;
|
||||
mplayer[dificulty].start_x = int(mplayer[dificulty].x); //estas variables son para cuando se pierde una vida se vuelve el player a esta posicion
|
||||
mplayer[dificulty].start_y = int(mplayer[dificulty].y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void chk_colmonsters() //chequear colisiones contra monstruos
|
||||
{
|
||||
for(int n=0;n<=M_max4room-1;n++)
|
||||
{
|
||||
if(M_type[n] != 0)
|
||||
if(mplayer[dificulty].y < M_y[n]+M_h-mplayer[dificulty].tolerance && mplayer[dificulty].y+mplayer[dificulty].h > M_y[n]+mplayer[dificulty].tolerance)
|
||||
if(mplayer[dificulty].x < M_x[n]+M_h-mplayer[dificulty].tolerance && mplayer[dificulty].x+mplayer[dificulty].w > M_x[n]+mplayer[dificulty].tolerance)
|
||||
mplayer[dificulty].dead=1;
|
||||
}
|
||||
}
|
||||
|
||||
void set_player_pos()
|
||||
{
|
||||
if(mplayer[dificulty].dead==0) // si el personaje esta muerto no chequea colisiones
|
||||
{
|
||||
mplayer[dificulty].infloor = 0;
|
||||
mplayer[dificulty].old_x = mplayer[dificulty].x;
|
||||
mplayer[dificulty].old_y = mplayer[dificulty].y;
|
||||
|
||||
chk_colmonsters(); // esta rutina chequea colisiones contra monstruos
|
||||
|
||||
if(mplayer[dificulty].duck == 1)
|
||||
mplayer[dificulty].h=P_h/2;
|
||||
else
|
||||
mplayer[dificulty].h=P_h;
|
||||
|
||||
|
||||
if(mplayer[dificulty].left==1)
|
||||
{
|
||||
if(mplayer[dificulty].duck==1)
|
||||
mplayer[dificulty].speed=mplayer[dificulty].realspeed/2;
|
||||
else
|
||||
mplayer[dificulty].speed=mplayer[dificulty].realspeed;
|
||||
|
||||
mplayer[dificulty].x=mplayer[dificulty].x-(mplayer[dificulty].speed*imove);
|
||||
|
||||
P_chk_left();
|
||||
}
|
||||
if(mplayer[dificulty].right==1)
|
||||
{
|
||||
if(mplayer[dificulty].duck==1)
|
||||
mplayer[dificulty].speed=mplayer[dificulty].realspeed/2;
|
||||
else
|
||||
mplayer[dificulty].speed=mplayer[dificulty].realspeed;
|
||||
|
||||
mplayer[dificulty].x=mplayer[dificulty].x+(mplayer[dificulty].speed*imove);
|
||||
|
||||
P_chk_right();
|
||||
}
|
||||
if(mplayer[dificulty].jump==1)
|
||||
{
|
||||
if(mplayer[dificulty].upflag==1)
|
||||
{
|
||||
mplayer[dificulty].jumpcounter=int(mplayer[dificulty].startjump-mplayer[dificulty].y);
|
||||
|
||||
mplayer[dificulty].maxjump=mplayer[dificulty].realmaxjump;
|
||||
|
||||
if(mplayer[dificulty].jumpcounter <= mplayer[dificulty].maxjump)
|
||||
{
|
||||
if(mplayer[dificulty].jumpcounter >= mplayer[dificulty].maxjump/1.5)
|
||||
{
|
||||
if(mplayer[dificulty].jumpslower==1)
|
||||
{
|
||||
mplayer[dificulty].y=mplayer[dificulty].y+(mplayer[dificulty].fallspeed*imove);
|
||||
mplayer[dificulty].jumpslower=0;
|
||||
}
|
||||
else
|
||||
mplayer[dificulty].jumpslower=1;
|
||||
}
|
||||
mplayer[dificulty].y=mplayer[dificulty].y-(mplayer[dificulty].fallspeed*imove);
|
||||
}
|
||||
else
|
||||
{
|
||||
mplayer[dificulty].downflag = 1;
|
||||
mplayer[dificulty].upflag = 0;
|
||||
}
|
||||
chk_up();
|
||||
}
|
||||
if(mplayer[dificulty].downflag==1)
|
||||
{
|
||||
mplayer[dificulty].jumpcounter=int(mplayer[dificulty].y-mplayer[dificulty].startjump);
|
||||
if(mplayer[dificulty].jumpcounter > 0)
|
||||
{
|
||||
|
||||
mplayer[dificulty].maxjump=mplayer[dificulty].realmaxjump;
|
||||
|
||||
if(mplayer[dificulty].jumpcounter >= mplayer[dificulty].maxjump/1.5)
|
||||
{
|
||||
if(mplayer[dificulty].jumpslower==1)
|
||||
{
|
||||
mplayer[dificulty].y=mplayer[dificulty].y-(mplayer[dificulty].fallspeed*imove);
|
||||
mplayer[dificulty].jumpslower=0;
|
||||
}
|
||||
else
|
||||
mplayer[dificulty].jumpslower=1;
|
||||
}
|
||||
mplayer[dificulty].y=mplayer[dificulty].y+(mplayer[dificulty].fallspeed*imove);
|
||||
}
|
||||
else
|
||||
{
|
||||
mplayer[dificulty].jump = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mplayer[dificulty].jump==0)
|
||||
mplayer[dificulty].y=mplayer[dificulty].y+(mplayer[dificulty].fallspeed*imove); // para que se caiga si no hay suelo debajo
|
||||
chk_down();
|
||||
}
|
||||
oldplayerpos.x = int(mplayer[dificulty].old_x);
|
||||
oldplayerpos.y = int(mplayer[dificulty].old_y);
|
||||
oldplayerpos.w = mplayer[dificulty].w;
|
||||
oldplayerpos.h = mplayer[dificulty].h;
|
||||
if(mplayer[dificulty].ducked==1)
|
||||
{
|
||||
mplayer[dificulty].ducked = 0;
|
||||
oldplayerpos.h = oldplayerpos.h + (P_h - P_h/2);
|
||||
oldplayerpos.y = oldplayerpos.y - (P_h - P_h/2);
|
||||
}
|
||||
playerpos.x = int(mplayer[dificulty].x);
|
||||
playerpos.y = int(mplayer[dificulty].y);
|
||||
}
|
||||
|
||||
void clean_player()
|
||||
{
|
||||
set_player_pos();
|
||||
playerposreal.x = playerpos.x + R_gamearea_x;
|
||||
playerposreal.y = playerpos.y + R_gamearea_y;
|
||||
oldplayerposreal.x = oldplayerpos.x + R_gamearea_x;
|
||||
oldplayerposreal.y = oldplayerpos.y + R_gamearea_y;
|
||||
|
||||
SDL_BlitSurface(screenbak,&oldplayerpos,screen, &oldplayerposreal);
|
||||
}
|
||||
void print_player()
|
||||
{
|
||||
playersrc.y = mplayer[dificulty].framer*P_h;
|
||||
playersrc.x = mplayer[dificulty].w * (mplayer[dificulty].frame - 1 + mplayer[dificulty].facingleft*mplayer[dificulty].frames);
|
||||
playersrc.w = mplayer[dificulty].w;
|
||||
playersrc.h = mplayer[dificulty].h;
|
||||
|
||||
SDL_BlitSurface(player, &playersrc, screen, &playerposreal);
|
||||
SDL_UpdateRect(screen,oldplayerposreal.x,oldplayerposreal.y,P_w,oldplayerpos.h);
|
||||
SDL_UpdateRect(screen,playerposreal.x,playerposreal.y,mplayer[dificulty].w,mplayer[dificulty].h);
|
||||
}
|
||||
|
||||
void animateplayer()
|
||||
{
|
||||
// Esta rutina pone el valor correspondiente a la fila de sprites en el archivo BMP del personaje en la variable framer
|
||||
|
||||
if(mplayer[dificulty].right!=0 || mplayer[dificulty].left != 0)
|
||||
{
|
||||
mplayer[dificulty].frame++;
|
||||
if(mplayer[dificulty].duck==1 && mplayer[dificulty].right==0 && mplayer[dificulty].left==0)
|
||||
mplayer[dificulty].frame--;
|
||||
}
|
||||
|
||||
if(mplayer[dificulty].right==1 || mplayer[dificulty].left == 1)
|
||||
mplayer[dificulty].framer = 1;
|
||||
if(mplayer[dificulty].right==0 && mplayer[dificulty].left == 0 && mplayer[dificulty].duck==0) // parado
|
||||
{
|
||||
mplayer[dificulty].framer = 0;
|
||||
mplayer[dificulty].frame++;
|
||||
}
|
||||
if(mplayer[dificulty].duck==1) // agachado
|
||||
mplayer[dificulty].framer = 2;
|
||||
if(mplayer[dificulty].jump==1 && mplayer[dificulty].upflag==1) // saltando (subiendo)
|
||||
{
|
||||
mplayer[dificulty].framer = 3;
|
||||
mplayer[dificulty].frame = 1;
|
||||
}
|
||||
if(mplayer[dificulty].downflag==1 && mplayer[dificulty].infloor == 0 && mplayer[dificulty].duck== 0) // cayendo o saltando (bajando)
|
||||
{
|
||||
mplayer[dificulty].framer = 3;
|
||||
mplayer[dificulty].frame = 2;
|
||||
}
|
||||
if(mplayer[dificulty].frame > mplayer[dificulty].frames)
|
||||
mplayer[dificulty].frame=1;
|
||||
}
|
||||
44
project/jni/application/pachi/src/proto.h
Normal file
44
project/jni/application/pachi/src/proto.h
Normal file
@@ -0,0 +1,44 @@
|
||||
void stop_music();
|
||||
void credits_events();
|
||||
void menu_events();
|
||||
void setback();
|
||||
void fadesurface(SDL_Surface *surface, int x, int y, int speed);
|
||||
|
||||
void screen_mode();
|
||||
void setgame();
|
||||
void start_game();
|
||||
|
||||
void load_menufont();
|
||||
void unload_menufont();
|
||||
|
||||
void do_code();
|
||||
void do_hiscores();
|
||||
void load_room();
|
||||
void print_room();
|
||||
void init_room();
|
||||
|
||||
void init_objects();
|
||||
void initfade_object(int x, int y, int object);
|
||||
float fade_object(float alpha);
|
||||
|
||||
double delta_time();
|
||||
|
||||
void init_monsters();
|
||||
void print_monsters();
|
||||
|
||||
void chk_touched(int x, int y);
|
||||
void print_player();
|
||||
void animateplayer();
|
||||
void respawn();
|
||||
|
||||
void print_timer();
|
||||
void stage_up();
|
||||
|
||||
void flushevents();
|
||||
void screen_fx();
|
||||
void bright_obj(int bright_x, int bright_y);
|
||||
void check_joystick_events(SDL_Event *event, Uint8 *joypos);
|
||||
void game_loop();
|
||||
void show_arrow(int arrow, int show);
|
||||
|
||||
void win_game();
|
||||
41
project/jni/application/pachi/src/setgame.h
Normal file
41
project/jni/application/pachi/src/setgame.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#define easy 1
|
||||
#define normal 2
|
||||
#define hard 3
|
||||
|
||||
void setgame()
|
||||
{
|
||||
stage=startstage;
|
||||
startstage=0;
|
||||
score=0;
|
||||
gametimer=0;
|
||||
|
||||
mplayer[easy].realspeed=150;
|
||||
mplayer[normal].realspeed=150;
|
||||
mplayer[hard].realspeed=180;
|
||||
|
||||
mplayer[easy].fallspeed=150;
|
||||
mplayer[normal].fallspeed=150;
|
||||
mplayer[hard].fallspeed=180;
|
||||
|
||||
mplayer[easy].realmaxjump=80;
|
||||
mplayer[normal].realmaxjump=70;
|
||||
mplayer[hard].realmaxjump=70;
|
||||
|
||||
mplayer[easy].tolerance=10;
|
||||
mplayer[normal].tolerance=8;
|
||||
mplayer[hard].tolerance=5;
|
||||
|
||||
|
||||
M_speed[easy]=130;
|
||||
M_speed[normal]=150;
|
||||
M_speed[hard]=200;
|
||||
|
||||
for(int n=1;n<=3;n++)
|
||||
{
|
||||
mplayer[n].lives=maxlives;
|
||||
mplayer[n].frames=10;
|
||||
mplayer[n].h=P_h;
|
||||
mplayer[n].w=P_w;
|
||||
}
|
||||
|
||||
}
|
||||
13
project/jni/application/pachi/src/sounds.h
Normal file
13
project/jni/application/pachi/src/sounds.h
Normal file
@@ -0,0 +1,13 @@
|
||||
Mix_Music *music;
|
||||
Mix_Chunk *jump;
|
||||
Mix_Chunk *obj;
|
||||
Mix_Chunk *objseq;
|
||||
Mix_Chunk *die;
|
||||
Mix_Chunk *stageready;
|
||||
Mix_Chunk *exitlevel;
|
||||
Mix_Chunk *timer;
|
||||
Mix_Chunk *storm;
|
||||
Mix_Chunk *respawnsnd;
|
||||
Mix_Chunk *option;
|
||||
Mix_Chunk *coderight;
|
||||
Mix_Chunk *codewrong;
|
||||
98
project/jni/application/pachi/src/stages.h
Normal file
98
project/jni/application/pachi/src/stages.h
Normal file
@@ -0,0 +1,98 @@
|
||||
void init_stages ()
|
||||
{
|
||||
mstage[0].title=" HARD LANDING ! ";
|
||||
mstage[0].music=DATADIR"/music/stage1.s3m.ogg";
|
||||
mstage[0].objects=10;
|
||||
mstage[0].time=190;
|
||||
mstage[0].code="HARD";
|
||||
|
||||
mstage[1].title=" ENTRANCE TO CEMETERY ";
|
||||
mstage[1].music=DATADIR"/music/stage1.s3m.ogg";
|
||||
mstage[1].objects=12;
|
||||
mstage[1].time=205;
|
||||
mstage[1].code="MARS";
|
||||
|
||||
mstage[2].title=" INTO THE CEMETERY (1) ";
|
||||
mstage[2].music=DATADIR"/music/stage1.s3m.ogg";
|
||||
mstage[2].objects=12;
|
||||
mstage[2].time=350;
|
||||
mstage[2].code="CMTR";
|
||||
|
||||
mstage[3].title=" INTO THE CEMETERY (2) ";
|
||||
mstage[3].music=DATADIR"/music/stage1.s3m.ogg";
|
||||
mstage[3].objects=19;
|
||||
mstage[3].time=290;
|
||||
mstage[3].code="TOMB";
|
||||
|
||||
mstage[4].title=" WHERE IS THE EXIT GATE? ";
|
||||
mstage[4].music=DATADIR"/music/stage1.s3m.ogg";
|
||||
mstage[4].objects=18;
|
||||
mstage[4].time=370;
|
||||
mstage[4].code="SKLL";
|
||||
|
||||
mstage[5].title=" PASSAGE TO THE CAVES ";
|
||||
mstage[5].music=DATADIR"/music/stage1.s3m.ogg";
|
||||
mstage[5].objects=10;
|
||||
mstage[5].time=120;
|
||||
mstage[5].code="EVAC";
|
||||
|
||||
mstage[6].title=" THE CAVES ";
|
||||
mstage[6].music=DATADIR"/music/stage2.stm.ogg";
|
||||
mstage[6].objects=14;
|
||||
mstage[6].time=250;
|
||||
mstage[6].code="EYES";
|
||||
|
||||
mstage[7].title=" DEN OF RATS ";
|
||||
mstage[7].music=DATADIR"/music/stage2.stm.ogg";
|
||||
mstage[7].objects=15;
|
||||
mstage[7].time=250;
|
||||
mstage[7].code="RATS";
|
||||
|
||||
mstage[8].title=" THE PIT ";
|
||||
mstage[8].music=DATADIR"/music/stage2.stm.ogg";
|
||||
mstage[8].objects=20;
|
||||
mstage[8].time=300;
|
||||
mstage[8].code="DIRT";
|
||||
|
||||
mstage[9].title=" THE CASTLE GARDENS ";
|
||||
mstage[9].music=DATADIR"/music/stage2.stm.ogg";
|
||||
mstage[9].objects=13;
|
||||
mstage[9].time=210;
|
||||
mstage[9].code="CAST";
|
||||
|
||||
mstage[10].title=" THE CASTLE HALL ";
|
||||
mstage[10].music=DATADIR"/music/stage3.s3m.ogg";
|
||||
mstage[10].objects=15;
|
||||
mstage[10].time=250;
|
||||
mstage[10].code="HALL";
|
||||
|
||||
mstage[11].title=" TOWER ENTRANCE ";
|
||||
mstage[11].music=DATADIR"/music/stage3.s3m.ogg";
|
||||
mstage[11].objects=20;
|
||||
mstage[11].time=150;
|
||||
mstage[11].code="TTWR";
|
||||
|
||||
mstage[12].title=" THE FIRST TOWER ";
|
||||
mstage[12].music=DATADIR"/music/stage3.s3m.ogg";
|
||||
mstage[12].objects=17;
|
||||
mstage[12].time=140;
|
||||
mstage[12].code="TWR1";
|
||||
|
||||
mstage[13].title=" THE TWO TOWERS ";
|
||||
mstage[13].music=DATADIR"/music/stage3.s3m.ogg";
|
||||
mstage[13].objects=26;
|
||||
mstage[13].time=200;
|
||||
mstage[13].code="2TWR";
|
||||
|
||||
mstage[14].title=" THE SECRET PLACE ";
|
||||
mstage[14].music=DATADIR"/music/stage3.s3m.ogg";
|
||||
mstage[14].objects=20;
|
||||
mstage[14].time=150;
|
||||
mstage[14].code="DXTR";
|
||||
|
||||
mstage[15].title=" THE LABORATORY ";
|
||||
mstage[15].music=DATADIR"/music/stage4.s3m.ogg";
|
||||
mstage[15].objects=90;
|
||||
mstage[15].time=540;
|
||||
mstage[15].code="XLAB";
|
||||
}
|
||||
57
project/jni/application/pachi/src/structs.h
Normal file
57
project/jni/application/pachi/src/structs.h
Normal file
@@ -0,0 +1,57 @@
|
||||
struct Cobject
|
||||
{
|
||||
int type;
|
||||
int x;
|
||||
int y;
|
||||
int seq;
|
||||
int stage;
|
||||
};
|
||||
|
||||
struct Cplayer
|
||||
{
|
||||
float x, y; // posiciones x, y
|
||||
float old_x, old_y; // posiciones anteriores de x y
|
||||
int w, h; // anchura y altura
|
||||
int speed; // velocidad
|
||||
int realspeed; // copia de velocidad, se usa para restaurar el valor de speed en caso que haya sido modificado
|
||||
int fallspeed; // velocidad de caida libre
|
||||
int frames; // cantidad de frames de animacion
|
||||
int frame, framer; // frame actual y fila de frames actual (las filas son: quieto, corriendo, agachado, saltando, cayendo)
|
||||
int left, right, jump, duck;
|
||||
int start_x, start_y; // posiciones iniciales en la pantalla
|
||||
int lives; // vidas del jugador
|
||||
int tolerance; // tolerancia de la deteccion de colisiones contra los monstruos
|
||||
int objects; // objetos recogidos en la pantalla actual
|
||||
|
||||
int startjump;
|
||||
int jumpcounter; // contador de altura del selto
|
||||
int maxjump; // altura del salto
|
||||
int realmaxjump; // copia de altura del salto en caso que haya que restaurarlo
|
||||
|
||||
int dead; // inficador si esta muerto
|
||||
int stageup; // indicador si la pantalla esta completa
|
||||
int upflag, downflag;
|
||||
int infloor;
|
||||
int facingleft;
|
||||
int ducked;
|
||||
int jumpslower;
|
||||
};
|
||||
|
||||
struct Cstages
|
||||
{
|
||||
char * title;
|
||||
char * music;
|
||||
int objects;
|
||||
int time;
|
||||
char * code;
|
||||
};
|
||||
|
||||
struct Croom
|
||||
{
|
||||
int data[R_maxtiles_h][R_maxtiles_v]; // los datos (tiles) de la habitacion
|
||||
int stage; // a que stage pertenece
|
||||
};
|
||||
Croom mroom;
|
||||
Cobject mobject[2000]; // almacena los objetos del juego
|
||||
Cplayer mplayer[4];
|
||||
Cstages mstage[NUM_STAGES];
|
||||
35
project/jni/application/pachi/src/surfaces.h
Normal file
35
project/jni/application/pachi/src/surfaces.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// --- Fonts
|
||||
SDL_Surface *font;
|
||||
SDL_Surface *scorefont;
|
||||
SDL_Surface *scorefont1;
|
||||
SDL_Surface *scorefont2;
|
||||
SDL_Surface *menufont;
|
||||
SDL_Surface *menufont1;
|
||||
|
||||
// --- Screen
|
||||
SDL_Surface *screen;
|
||||
SDL_Surface *background;
|
||||
SDL_Surface *backs;
|
||||
SDL_Surface *tiles;
|
||||
SDL_Surface *screenbak;
|
||||
|
||||
// --- FX
|
||||
SDL_Surface *bright;
|
||||
SDL_Surface *creditsbuffer;
|
||||
SDL_Surface *creditsbuffer1;
|
||||
SDL_Surface *creditsfont;
|
||||
SDL_Surface *left;
|
||||
SDL_Surface *right;
|
||||
|
||||
// --- Monsters
|
||||
SDL_Surface *monsters;
|
||||
|
||||
// --- Player
|
||||
SDL_Surface *player;
|
||||
|
||||
// --- Intro
|
||||
SDL_Surface *dragontech;
|
||||
SDL_Surface *line1;
|
||||
SDL_Surface *line2;
|
||||
SDL_Surface *comic_01;
|
||||
SDL_Surface *black;
|
||||
32
project/jni/application/pachi/src/text.h
Normal file
32
project/jni/application/pachi/src/text.h
Normal file
@@ -0,0 +1,32 @@
|
||||
void print_text(SDL_Surface *font, SDL_Surface *surface, int font_w, int font_h, int text_x, int text_y, char *str, ...) //Rutina para imprimir texto estatico en la pantalla
|
||||
{
|
||||
SDL_Rect srctxt; // la posicion donde se encuentra el caracter en el bitmap
|
||||
SDL_Rect dsttxt; // la posicion donde se imprimira el texto
|
||||
|
||||
char texto [100];
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vsprintf(texto, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
srctxt.w = font_w;
|
||||
srctxt.h = font_h;
|
||||
srctxt.y = 0;
|
||||
int linecounter = 0 ; // este contador se utiliza para saber en que linea imprimimos el texto
|
||||
int charpos = 0;
|
||||
for(int charcounter = 0; charcounter <= (strlen(texto));charcounter++)
|
||||
{
|
||||
int curchar=texto[charcounter];
|
||||
if(curchar == 94)
|
||||
{
|
||||
linecounter++;
|
||||
charpos = -1;
|
||||
}
|
||||
srctxt.x = (curchar - 32) * font_w;
|
||||
dsttxt.x = (text_x + (charpos * font_w));
|
||||
dsttxt.y = (text_y + (linecounter * font_h));
|
||||
charpos++;
|
||||
SDL_BlitSurface (font,&srctxt,surface,&dsttxt);
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
sc2
|
||||
pachi
|
||||
1
project/jni/sdl-1.2/include/SDL
Symbolic link
1
project/jni/sdl-1.2/include/SDL
Symbolic link
@@ -0,0 +1 @@
|
||||
.
|
||||
1
project/jni/sdl-1.3/include/SDL
Symbolic link
1
project/jni/sdl-1.3/include/SDL
Symbolic link
@@ -0,0 +1 @@
|
||||
.
|
||||
@@ -4,8 +4,8 @@ include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := sdl_mixer
|
||||
|
||||
LOCAL_CFLAGS := -I$(LOCAL_PATH) -I$(LOCAL_PATH)/.. -I$(LOCAL_PATH)/../sdl-$(SDL_VERSION)/include -I$(LOCAL_PATH)/include \
|
||||
-I$(LOCAL_PATH)/../mad/include -I$(LOCAL_PATH)/../flac/include -I$(LOCAL_PATH)/../ogg/include -I$(LOCAL_PATH)/../vorbis/include \
|
||||
LOCAL_CFLAGS := -I$(LOCAL_PATH) -I$(LOCAL_PATH)/../sdl-$(SDL_VERSION)/include -I$(LOCAL_PATH)/include \
|
||||
-I$(LOCAL_PATH)/../mad/include -I$(LOCAL_PATH)/../flac/include -I$(LOCAL_PATH)/../ogg/include -I$(LOCAL_PATH)/../vorbis/include -I$(LOCAL_PATH)/../tremor/include \
|
||||
-DWAV_MUSIC -DOGG_USE_TREMOR -DOGG_MUSIC -DFLAC_MUSIC
|
||||
|
||||
LOCAL_CPP_EXTENSION := .cpp
|
||||
|
||||
1
project/jni/sdl_mixer/include/SDL
Symbolic link
1
project/jni/sdl_mixer/include/SDL
Symbolic link
@@ -0,0 +1 @@
|
||||
.
|
||||
Reference in New Issue
Block a user