pax_global_header00006660000000000000000000000064150671167120014520gustar00rootroot0000000000000052 comment=030b568c4bc90ea8c6422b2ac970598dbb8faa29 JoesCat-xinvaders3d-030b568/000077500000000000000000000000001506711671200155515ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/AUTHORS000066400000000000000000000003051506711671200166170ustar00rootroot00000000000000Authors: Don Llopis , 2000jan22 Bill Kendrick Jarmo Pussinen Thomas Boutell Peter da Silva Sam Bushell Andreas Jeitler Chris Butler Peter da Silva Joe Da Silva William Lupinacci JoesCat-xinvaders3d-030b568/COPYING000066400000000000000000000431051506711671200166070ustar00rootroot00000000000000 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. Copyright (C) 19yy 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) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 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. JoesCat-xinvaders3d-030b568/Changelog000066400000000000000000000123051506711671200173640ustar00rootroot00000000000000xinvaders3d or xinv3d (1.37.0) * No Changes made. This is just an update to get beyond the unexpected confusion created between 1.31, 1.36, and 1.3.6 version values. Reading earlier zip files and imports like Don's zip file Feb 2000 = 1.31, and HP-UX fixes 2022-03-01 and then Debian's later 1.3.6 fixes it appears best to get beyond git tag 1.31 which might be stalling some automated release watcher program.? Also chose tag to be above 1.36. -- Joe Da Silva 2025 Sep 30 xinvaders3d or xinv3d (1.9.0) * Thanks to orchardstreet for fixing titlebar to exit cleanly and also for simplifying player left/right rotation return. -- Joe Da Silva 2024 May 09 xinvaders3d or xinv3d (1.8.0) * Added build option "./configure --enable-as-xinv3d" so that Xinvaders3D builds binary, man file, and desktop as Xinv3D. * Added desktop scalable icon. -- Joe Da Silva 2024 Apr 05 xinvaders3d (1.7.0) * Added player_2, two player duel mode to Xinvaders3d game. -- Joe Da Silva 2023 July 17 xinvaders3d (1.6.0) * Thanks to jamesbond3142 for fixing a segfault seen in 64bit and also for adding lrint (as per information in issue #1). * usleep () added to reduce CPU energy crunching to ~ 100fps. * Improve FPS by updating hi_score and pscore during scoring. * Added an alien pause during the "Get Ready!!" screen pause. * Updated manual to include Don in authors, thanks to others. -- Joe Da Silva 2023 July 16 xinvaders3d (1.5.0) * Renamed xinv3d to xinvaders3d to avoid package confusion if both programs loaded at same time on the same computer. -- Joe Da Silva 2023 Feb 23 xinv3d (1.4.0) * This started as a resurection of a Debian orphaned program 'xinv3d' brought up to date and made buildable with current PCs. See URL: https://github.com/JoesCat/xinv3d Thanks to Debian's Ricardo Mones for suggesting rethreading from an earlier release. This version starts from earliest release found == version 1.31 based on an ibiblio tarball. NOTE: No CVS file system found therefore started fresh 1.31. * Imported code HP-UX (1.31) fixes, 2000feb07, unknown author. * Imported fixes and improvements, the moving of game text to gtext.h, and a detailed history added to README all done by Chris Butler for Debian's xinv3d ver{1.3.6-1...1.3.6-6}. NOTE: This import is smaller than a complete 1.3.6-6 clone. * Import xinv3d.6 manual written by Chris Butler for Debian's xinv3d 1.3.6-1 (but may be used by others). * Speed-up vector font drawing by changing multiplications to a few value increments. This benefits lower-powered CPUs. * Bug-fix for lower-right quadrant void of stars. * Timer-math bugfix that makes game seem to run very slowly on very fast computer even though game is running at thousands of frames per second. * Updated xinv3d to be built using autoreconf -i and automake. Added freedesktop and new icons (resolves Debian #738066). * Replaced old make. Bumped version number from 1.3x to 1.4.0 -- Joe Da Silva 2022 Mar 05 xinv3d (1.3.1) * Fixed drawing order. Objects were being drawn in reverse. -- Don Llopis 2000 Feb 07 xinv3d (1.3) * Many thanks to Thomas Boutell, he has contributed a Windows port of XInvaders 3D. See README.win for more information. * XInvaders 3D DOS port finished. XInvaders 3D will now run as a full-screen 640x480x8 DOS game. For windows users it will run in a DOS window just fine. I used DJGPP+Allegro to port it. See README.dos for more information. * Added Vector-fonts. All text graphics have been replaced with Vector-fonts. Gives the game a cleaner look. * New player blinking routine. Player now cycles through red colors, rather than being drawn each alternate frame, when a new level has been started. * New special effect: 1-UP indicator. When 7500pts have been reached a new life is indicated by a nice little vector 1-UP floating towards the player. * New alien-shoot missile routine. Aliens now shoot more. * New Distance-of-Point-to-Line routine, used for collision detection. * Added fix for FreeBSD systems, thanks to Peter da Silva. * Fixed ZONE_HEIGHT bug in game.c, which was generating bad pointers, thanks to Sam Bushell. * Cleaned up code, for portability reasons, thanks to Thomas Boutell for his help. * Left-Shift key is no longer being used. -- Don Llopis 2000 Feb 05 xinv3d (1.2) * Cleaned up some more code. * Adjusted formation movement. * Changed missile color to yellow, suggested by Mattia Engdeg. * Fixed some warnings which the pedantic flag generates, thanks to Jarmo Pussinen for pointing them out. -- Don Llopis xinv3d (1.1) * Fixed incompatible pointer warnings, and an updated README. * Fixed window manager bug which Bill Kendrick pointed out. * Windows were opening at an odd width and height under the Enlightenment Window manager. -- Don Llopis 2000 Jan 22 xinv3d (1.0) * Initial Release. -- Don Llopis 2000 Jan 22 01:40 JoesCat-xinvaders3d-030b568/Makefile.am000066400000000000000000000043321506711671200176070ustar00rootroot00000000000000# Makefile.am - build XINVADERS 3D - 3d Shoot'em up # Copyright (C) 2022 Jose Da Silva # # 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 # SUBDIRS = . desktop ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} bin_PROGRAMS = noinst_PROGRAMS = man_MANS = if !WANTXINV3D bin_PROGRAMS += xinvaders3d noinst_PROGRAMS += xinv3d man_MANS += xinvaders3d.6 endif if WANTXINV3D bin_PROGRAMS += xinv3d noinst_PROGRAMS += xinvaders3d man_MANS += xinv3d.6 endif invaderCode = aliens.c camera.c effects.c game.c object.c mat4x4.c player.c vec4x1.c main-x11.c noinst_HEADERS = camera.h defines.h externs.h game.h gtext.h mat4x4.h object.h system.h vec4x1.h xinvaders3d_CPPFLAGS = ${CFLAGS} ${WCFLAGS} xinvaders3d_LDFLAGS = ${LDFLAGS} xinvaders3d_LDADD = -lX11 -lm xinvaders3d_SOURCES = ${invaderCode} xinvaders3d.$(OBJEXT): ${noinst_HEADERS} xinv3d_CPPFLAGS = ${CFLAGS} ${WCFLAGS} xinv3d_LDFLAGS = ${LDFLAGS} xinv3d_LDADD = -lX11 -lm xinv3d_SOURCES = ${invaderCode} xinv3d.$(OBJEXT): ${noinst_HEADERS} DISTCLEANFILES = xinv3d.6 DISTCHECK_CONFIGURE_FLAGS = --enable-debuggame --enable-debugkeyboard --disable-silent-rules --enable-as-xinv3d EXTRA_DIST = \ AUTHORS Changelog main-dos.c main-w.c Makefile.dos Makefile.lin \ README.md README.dos README.win xinvaders3d.jpg xinvaders3d.6.in \ packaging/xinvaders3d.spec.in packaging/xinvaders3d.spec \ m4/ax_check_compile_flag.m4 ${noinst_HEADERS} nodist_EXTRA_DATA = .git .github xinvaders3d.6 xinv3d.6 strip: ${STRIP} ${builddir}/xinvaders3d ${STRIP} ${builddir}/xinv3d xinv3d.6: cp ${builddir}/xinvaders3d.6 ${builddir}/xinv3d.6 clean-local: rm -f ${builddir}/xinv3d.6 JoesCat-xinvaders3d-030b568/Makefile.dos000066400000000000000000000021301506711671200177710ustar00rootroot00000000000000all: game CC = gcc LIBS = -lalleg -lm OBJS = game.o aliens.o player.o effects.o \ object.o camera.o main-dos.o vec4x1.o mat4x4.o DEPENDS = #CFLAGS = -pg -Wall -pedantic -ansi #CFLAGS = -ansi #OPTIONS = -D_GNU_SOURCE -DGAME_LINUX_X11 -DGAME_DEBUG OPTIONS= -DGAME_LINUX_X11 .c.o: $(DEPENDS) $(CC) -c $(CFLAGS) $(OPTIONS) $< -o $@ game: $(OBJS) $(DEPENDS) $(CC) -o xinv3d $(OBJS) $(LIBS) $(OPTIONS) clean: del *.o del xinv3d.exe aliens.o: aliens.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \ object.h externs.h camera.o: camera.c mat4x4.h vec4x1.h camera.h effects.o: effects.c game.h vec4x1.h mat4x4.h camera.h system.h \ defines.h object.h externs.h game.o: game.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \ object.h externs.h object.o: object.c mat4x4.h vec4x1.h defines.h object.h main-dos.o: main-dos.c game.h vec4x1.h mat4x4.h camera.h system.h \ defines.h object.h externs.h mat4x4.o: mat4x4.c mat4x4.h vec4x1.h player.o: player.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \ object.h externs.h vec4x1.o: vec4x1.c vec4x1.h JoesCat-xinvaders3d-030b568/Makefile.lin000066400000000000000000000021361506711671200177740ustar00rootroot00000000000000all: game CC = gcc XLIB = -L/usr/X11R6/lib -I/usr/X11R6/include LIBS = -lm -lX11 OBJS = game.o aliens.o player.o effects.o \ object.o camera.o main-x11.o vec4x1.o mat4x4.o DEPENDS = #CFLAGS = -g -Wall -pedantic -ansi CFLAGS = -ansi #OPTIONS = -D_GNU_SOURCE -DGAME_LINUX_X11 -DGAME_DEBUG OPTIONS= -DGAME_LINUX_X11 .c.o: $(DEPENDS) $(CC) -c $(CFLAGS) $(OPTIONS) $< -o $@ game: $(OBJS) $(DEPENDS) $(CC) -o xinv3d $(OBJS) $(XLIB) $(LIBS) $(OPTIONS) clean: rm *.o rm xinv3d aliens.o: aliens.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \ object.h externs.h camera.o: camera.c mat4x4.h vec4x1.h camera.h effects.o: effects.c game.h vec4x1.h mat4x4.h camera.h system.h \ defines.h object.h externs.h game.o: game.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \ object.h externs.h object.o: object.c mat4x4.h vec4x1.h defines.h object.h main-x11.o: main-x11.c game.h vec4x1.h mat4x4.h camera.h system.h \ defines.h object.h externs.h mat4x4.o: mat4x4.c mat4x4.h vec4x1.h player.o: player.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \ object.h externs.h vec4x1.o: vec4x1.c vec4x1.h JoesCat-xinvaders3d-030b568/README.dos000066400000000000000000000014541506711671200172210ustar00rootroot00000000000000See the file README for complete information about XInvaders 3D in general. This file covers MS-DOS issues only. INFORMATION FOR PLAYERS: This is the MS-DOS port of XInvaders 3D. It should run on any IBM-PC or compatible, running some version of MS-DOS greater than 6.0. To start the game, just type: xinv3d. See README for instructions. MS-DOS port done by Don Llopis (dllopi01@fiu.edu). INFORMATION FOR PROGRAMMERS: To build the game, type: make -f Makefile.dos You must have the latest version of DJGPP (a 32bit DOS compiler) and at least version 3.12 of the Allegro graphics library. If you make any modifications to the code, please keep ALL DOS-specific code in main-dos.c. Both DJGPP and Allegro can be found here: http://www.delorie.com/djgpp/ Have Fun! Don Llopis dllopi01@fiu.edu JoesCat-xinvaders3d-030b568/README.md000066400000000000000000000120741506711671200170340ustar00rootroot00000000000000# XInvaders 3D XInvaders 3D is a vector-graphics Space Invaders clone for the X Window System. You are a lone star fighter facing endless waves of space aliens. Your sole objective is to shoot down as many aliens as you can. All objects are represented with 3D vector graphics, allowing the aliens to grow in size as they move closer to you. ![](xinvaders3d.jpg) ## Objective: Clear all the aliens in each level. The UFO yields bonus points if hit. A new life will be added every 7500 points. Game-over: either if the player has lost all its lives or if the alien formation reaches the player position. ## Point System: From bottom to top: ``` - Row 0 aliens yield 10 pts - Row 1 aliens yield 50 pts - Row 2 aliens yield 100 pts - Row 3 aliens yield 150 pts - Row 4 aliens yield 200 pts - UFO yields 500 pts ``` ## Keys: ``` - SPACE : Fire Missile - Left Arrow : move left - Right Arrow : move right - Up Arrow : move up - Down Arrow : move down - q : Reset game - f : Show frame-rate - p : Pause game - ESC : Terminate Program ``` ## Two Player Duel: Two players can also play in a duel for highest points. You will need two keyboards, otherwise it will be difficult to play. ## Two Player Keys: ``` - a : Fire Missile - i : move up - j : move left - k : move right - m : move down - 1 : lone star fighter mode - 2 : two player horizontal split screen - 3 : two player vertical split screen ``` ## Original Author and Original Website (year2000): Don Llopis del23@users.sourceforge.net http://xinvaders3d.sourceforge.net ### Original Greetings (from Don Llopis, year2000): Greets to the following people whose games helped inspire this project: - Bill Kendrick: who wrote ICBM3d http://www.newbreedsoftware.com - Yuusuke Hashimoto: who wrote XSoldier http://www.surfline.ne.jp/hachi/xsoldier.html - James Eibisch: who wrote a Space Invaders clone in quick-basic http://www.revolver.demon.co.uk/coding/index.html Thanks to the following people who contributed to the development of XInvaders3d: - Thomas Boutell for contributing the Windows Port of XInvaders, and misc code fixes. - Sam Bushell for the ZONE_HEIGHT bug fix. - Andreas Jeitler for creating the RPM package. - Chris Butler for creating the DEB package. - Peter da Silva for the FreeBSD fix. - Bill Kendrick for the Window Manager fix. ### Additional Greetings (from Joe Da Silva, year2022): Fetched a number of past fixes and patches plus did some bug fixes and improvements up to version 1.3.6. Added updated autoconf, found and fixed a few more quirks and bugs, plus added two player duel mode. ## How To Compile And Play Xinvaders 3D: There are four different methods you can use. ### 1 - Distro Specific Install This is always the recommended method. Install Xinvaders from your distro's repositories. This will be custom to your distro, and you should be able to find Xinvaders listed in the games menu folder. ### 2 - Original Method 1. Requirements: gcc and Xlib (with include header files) 2. Rename or copy Makefile.lin to Makefile so that you can run make 3. Compile the game, type: make 4. Run the game, type: ./xinvaders3d Note: You may have to edit the Makefile depending on where your headers and libraries are. Note: This only creates the binary program xinvaders3d in the same directory. Note: For other systems please see the README.xxx for that system. ### 3 - Release Tag For users who do not have autoconf or automake available, there are release tagpoints. The first release was [![v1.5.0]](https://github.com/JoesCat/xinvaders3d/releases/tag/1.5.0) Download the -dist- file and expand it so that you can run it. NOTE: Distros that are planning to follow xinv3d instead of xinvaders3d should use "./configure --enable-as-xinv3d" to build the project as xinv3d. The xinv3d option was added with v1.8.0 Installing on Linux ```sh ./configure make make check sudo make install ``` Note: .configure will stop if you are missing any development include headers. Please install the developer versions of any missing libraries since the include files are also needed for building the program. The default install location is /usr/local/bin/xinvaders3d and you should also find it in your desktop games menu folder. ### 4 - Latest development files For users or developers wanting to run the latest update, you will need to install autoconf and automake tools as well as the developer versions of any missing files and libraries. Then, download the latest code. Next, you need to create the ./configure script if you do not have it yet ```sh autoreconf -i (or use 'autoreconf --install --force' for more modern setups) automake --foreign -Wall ``` After you have created ./configure, you can run ./configure --help to show other options, or for a default build and install on Linux, run: ```sh ./configure make sudo make install ``` The default install location is /usr/local/bin/xinvaders3d and you should also find icons in your desktop games menu folder. JoesCat-xinvaders3d-030b568/README.win000066400000000000000000000020161506711671200172240ustar00rootroot00000000000000See the file README for complete information about XInvaders 3D in general. This file covers Microsoft Windows issues only. INFORMATION FOR PLAYERS: This Windows port of XInvaders 3D runs on Windows 95, 98, NT, and 2000. To start the game, just launch xinv3d.exe. See README for instructions, or look at "How to Play" on the system menu after you start the game. This Windows port was done by Thomas Boutell (boutell@boutell.com). INFORMATION FOR PROGRAMMERS: To build the game, just add all of the .c files to a "Win32 Application" project, including main-w.c, but excluding main-x11.c and any other main-*.c files for non-Windows operating systems. Then, BE SURE TO DEFINE THE PREPROCESSOR MACRO GAME_WIN32. If you prefer Makefiles, use the Unix Makefile as a guide. This game is very easy to build with any Windows development environment. If you make any modifications to the code, please keep ALL Windows-specific code in main-w.c where it belongs! Windows-specific questions? Contact Thomas Boutell (boutell@boutell.com). JoesCat-xinvaders3d-030b568/aliens.c000066400000000000000000001045131506711671200171740ustar00rootroot00000000000000/*------------------------------------------------------------------ aliens.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis +Copyright(C) 2022 Jose Da Silva 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 ------------------------------------------------------------------*/ #include "game.h" #define ALIEN_RADIUS 20.0f #define ALIEN_RADIUS_SQUARED 400.0f #define BOMB_RADIUS 20.0f #define BOMB_RADIUS_SQUARED 400.0f #define UFO_RADIUS 20.0f #define UFO_RADIUS_SQUARED 400.0f #define UFO_MIN_X_POS -600.0f #define UFO_MAX_X_POS 600.0f #define UFO_Z_POS -950.0f #define FORMATION_X_INC 75.0f #define FORMATION_Y_INC 100.0f #define FORMATION_MAX_X_POS 550.0f #define FORMATION_MIN_X_POS -550.0f #define FORMATION_MAX_Y_POS 450.0f #define FORMATION_MIN_Y_POS 50.0f #define FORMATION_MAX_Z_POS -850.0f #define FORMATION_MIN_Z_POS 50.0f enum alien_enum { MAX_FORMATIONS = 5, MAX_ALIENS = 40, ALIENS_PER_FORMATION = 8, MAX_BOMBS = 12, LEFT = 0, RIGHT = 1, FORWARD = 2, DIRECTION_TOGGLE = 1, ANIMATION_TOGGLE = 1, MAX_COLUMNS = 8, START_LEAD_COLUMN = 7, FORMATION_STEP = 3, /* dist_between_aliens / thrust */ FORWARD_START = 21, /* formation x FORMATION_STEP */ FORWARD_MAX = 45, /* must calc by hand */ FORWARD_MIN = 0, DROP_BOMB_TIME = 500, /* 0.5 sec */ DROP_BOMB_CHANCE_1 = 50, DROP_BOMB_CHANCE_2 = 40, UFO_ZONE = 9, UFO_LIGHTS_CYCLE = 250, SPAWN_UFO_TIME = 5000, SPAWN_UFO_CHANCE_1 = 10, SPAWN_UFO_CHANCE_2 = 5 }; OBJECT aliens [MAX_ALIENS]; OBJECT bombs [MAX_BOMBS]; OBJECT alien_ufo, *ufo; OBJECT the_formation; OBJLIST flist[MAX_FORMATIONS], *af_list; OBJLIST abomblist, *abombs; /* formation speed in msec */ static int fspeed[9] = { 1000, 750, 500, 400, 400, 300, 200, 150, 100 }; static VEC fstart_pos = { FORMATION_MIN_X_POS, FORMATION_MIN_Y_POS, FORMATION_MAX_Z_POS, 1.0f }; static VEC fstart_dir = { 0.0f, 0.0f, 1.0f, 1.0f }; static VEC fthrust[3] = { { -25.0f, 0.0f, 0.0f, 1.0f }, { 25.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 100.0f, 1.0f } }; static VEC abomb_thrust = { 0.0f, 0.0f, 25.0f, 1.0f }; static VEC ufo_thrust = { 5.0f, 0.0f, 0.0f, 1.0f }; static VEC avert1[48] = { { -20.0f, 20.0f, 0.0f, 1.0f }, /* A0: body*/ { 20.0f, 20.0f, 0.0f, 1.0f }, { 20.0f, 0.0f, 0.0f, 1.0f }, { -20.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f }, /* A0: legs*/ { -20.0f, -10.0f, 0.0f, 1.0f }, { -15.0f, -15.0f, 0.0f, 1.0f }, { -20.0f, -25.0f, 0.0f, 1.0f }, { 20.0f, -10.0f, 0.0f, 1.0f }, { 15.0f, -15.0f, 0.0f, 1.0f }, { 20.0f, -25.0f, 0.0f, 1.0f }, { 0.0f, 10.0f, 0.0f, 1.0f }, /* A0: eyes*/ { -15.0, 18.0f, 0.0f, 1.0f }, { -15.0, 2.0f, 0.0f, 1.0f }, { 15.0, 18.0f, 0.0f, 1.0f }, { 15.0, 2.0f, 0.0f, 1.0f }, { -15.0f, 20.0f, 0.0f, 1.0f }, /* A1: body*/ { 15.0f, 20.0f, 0.0f, 1.0f }, { 5.0f, 0.0f, 0.0f, 1.0f }, { -5.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f }, /* A1: legs*/ { -20.0f, -10.0f, 0.0f, 1.0f }, { -15.0f, -15.0f, 0.0f, 1.0f }, { -20.0f, -25.0f, 0.0f, 1.0f }, { 20.0f, -10.0f, 0.0f, 1.0f }, { 15.0f, -15.0f, 0.0f, 1.0f }, { 20.0f, -25.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f }, /* A1: eyes*/ { -20.0, 15.0f, 0.0f, 1.0f }, { -15.0, 0.0f, 0.0f, 1.0f }, { 20.0, 15.0f, 0.0f, 1.0f }, { 15.0, 0.0f, 0.0f, 1.0f }, { -5.0f, 20.0f, 0.0f, 1.0f }, /* A2: body*/ { 5.0f, 20.0f, 0.0f, 1.0f }, { 20.0f, 0.0f, 0.0f, 1.0f }, { -20.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f }, /* A2: legs*/ { -20.0f, -10.0f, 0.0f, 1.0f }, { -15.0f, -15.0f, 0.0f, 1.0f }, { -20.0f, -25.0f, 0.0f, 1.0f }, { 20.0f, -10.0f, 0.0f, 1.0f }, { 15.0f, -15.0f, 0.0f, 1.0f }, { 20.0f, -25.0f, 0.0f, 1.0f }, { 0.0f, 20.0f, 0.0f, 1.0f }, /* A2: eyes*/ { -20.0, 25.0f, 0.0f, 1.0f }, { -15.0, 15.0f, 0.0f, 1.0f }, { 20.0, 25.0f, 0.0f, 1.0f }, { 15.0, 15.0f, 0.0f, 1.0f } }; static VEC avert2[48] = { { -20.0f, 20.0f, 0.0f, 1.0f }, /*A0: body*/ { 20.0f, 20.0f, 0.0f, 1.0f }, { 20.0f, 0.0f, 0.0f, 1.0f }, { -20.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f }, /*A0: legs*/ { -10.0f, -5.0f, 0.0f, 1.0f }, { -5.0f, -10.0f, 0.0f, 1.0f }, { -10.0f, -25.0f, 0.0f, 1.0f }, { 10.0f, -5.0f, 0.0f, 1.0f }, { 5.0f, -10.0f, 0.0f, 1.0f }, { 10.0f, -25.0f, 0.0f, 1.0f }, { 0.0f, 15.0f, 0.0f, 1.0f }, /* A0: eyes*/ { -10.0, 25.0f, 0.0f, 1.0f }, { -15.0, 7.0f, 0.0f, 1.0f }, { 10.0, 25.0f, 0.0f, 1.0f }, { 15.0, 7.0f, 0.0f, 1.0f }, { -15.0f, 20.0f, 0.0f, 1.0f }, /* A1: body*/ { 15.0f, 20.0f, 0.0f, 1.0f }, { 5.0f, 0.0f, 0.0f, 1.0f }, { -5.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f }, /*A1: legs*/ { -10.0f, -5.0f, 0.0f, 1.0f }, { -5.0f, -10.0f, 0.0f, 1.0f }, { -10.0f, -30.0f, 0.0f, 1.0f }, { 10.0f, -5.0f, 0.0f, 1.0f }, { 5.0f, -10.0f, 0.0f, 1.0f }, { 10.0f, -30.0f, 0.0f, 1.0f }, { 0.0f, 10.0f, 0.0f, 1.0f }, /* A1: eyes*/ { -20.0, 15.0f, 0.0f, 1.0f }, { -15.0, 0.0f, 0.0f, 1.0f }, { 20.0, 15.0f, 0.0f, 1.0f }, { 15.0, 0.0f, 0.0f, 1.0f }, { -5.0f, 20.0f, 0.0f, 1.0f }, /* A2: body*/ { 5.0f, 20.0f, 0.0f, 1.0f }, { 20.0f, 0.0f, 0.0f, 1.0f }, { -20.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f }, /*A2: legs*/ { -10.0f, -5.0f, 0.0f, 1.0f }, { -5.0f, -10.0f, 0.0f, 1.0f }, { -10.0f, -30.0f, 0.0f, 1.0f }, { 10.0f, -5.0f, 0.0f, 1.0f }, { 5.0f, -10.0f, 0.0f, 1.0f }, { 10.0f, -30.0f, 0.0f, 1.0f }, { 0.0f, 5.0f, 0.0f, 1.0f }, /* A2: eyes*/ { -20.0, 20.0f, 0.0f, 1.0f }, { -15.0, 0.0f, 0.0f, 1.0f }, { 20.0, 20.0f, 0.0f, 1.0f }, { 15.0, 0.0f, 0.0f, 1.0f } }; static VEC abomb_vert[3] = { { -10.0f, 0.0f, -10.0f, 1.0f }, { 0.0f, 0.0f, 10.0f, 1.0f }, { 10.0f, 0.0f, -10.0f, 1.0f } }; static VEC abomb_vert2[3] = { { 0.0f, 10.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 10.0f, 1.0f }, { 0.0f, -10.0f, 0.0f, 1.0f } }; static VEC uvert1[17] = { { -20.0f, 0.0f, 0.0f, 1.0f }, /* UFO body */ { -10.0f, 10.0f, 0.0f, 1.0f }, { 10.0f, 10.0f, 0.0f, 1.0f }, { 20.0f, 0.0f, 0.0f, 1.0f }, { -20.0f, -20.0f, 0.0f, 1.0f }, /* left leg */ { -10.0f, 0.0f, 0.0f, 1.0f }, { -5.0f, 0.0f, 0.0f, 1.0f }, { 20.0f, -20.0f, 0.0f, 1.0f }, /* right leg */ { 10.0f, 0.0f, 0.0f, 1.0f }, { 5.0f, 0.0f, 0.0f, 1.0f }, { -10.0f, 10.0f, 0.0f, 1.0f }, /* top */ { 0.0f, 20.0f, 0.0f, 1.0f }, { 10.0f, 10.0f, 1.0f, 1.0f }, { -15.0f, 5.0f, 0.0f, 1.0f }, /* windows */ { -5.0f, 5.0f, 0.0f, 1.0f }, { 5.0f, 5.0f, 0.0f, 1.0f }, { 15.0f, 5.0f, 0.0f, 1.0f } }; static int fmove; /* FORMATION move sideways timer */ static int fforward; /* FORMATION move forward counter */ static int fforward_max; /* FORMATION move forward max */ static int fleadcol; /* FORMATION lead column */ static int fanim; /* FORMATION animation counter */ static int fdir; /* FORMATION movement direction */ static int fscur; /* FORMATION speed variable */ static int drop_bomb; /* drop bomb timer */ static int fcolumn[MAX_COLUMNS]; /* FORMATION column count */ static int spawn_ufo; /* spawn ufo timer */ static int ucolor; /* ufo lights cycle timer */ static void Add_bomb ( OBJECT * ); /*================================================================*/ void Aliens_init ( void ) { int i, j; VEC tmp_pos; OBJECT *alien; OBJLIST *f_ptr; /* initialize formations */ /* * the formation is a dummy-object used for * object-sorting purposes */ Object_init ( &the_formation ); Object_set_drawfn ( &the_formation, Aliens_draw ); Vector_copy ( fstart_pos, the_formation.pos ); the_formation.zone = ZONE_8; gv->formation_zone = ZONE_8; gv->alien_count = MAX_ALIENS; fmove = 0; fforward = FORWARD_START; fforward_max = FORWARD_MAX; fleadcol = START_LEAD_COLUMN; fdir = RIGHT; fanim = 0; fscur = 0; drop_bomb = 0; /* place aliens into their appropriate formations */ /* 8 aliens per formation -- total of 5 formations */ af_list = &flist[0]; f_ptr = &flist[0]; alien = &aliens[0]; Vector_init ( tmp_pos ); for ( i = 0; i < MAX_COLUMNS; i++ ) fcolumn[i] = 0; for ( i = 0; i < MAX_FORMATIONS; i++ ) { Objlist_clear ( f_ptr ); Vector_copy ( fstart_pos, tmp_pos ); tmp_pos[YPOS] += (FORMATION_Y_INC * i); for ( j = 0; j < ALIENS_PER_FORMATION; j++ ) { Object_init ( alien ); Object_set_pos ( alien, tmp_pos ); Object_set_dir ( alien, fstart_dir ); alien->zone = gv->formation_zone; alien->zheight = i; alien->vpos = j; alien->radius = ALIEN_RADIUS; alien->radius_squared = ALIEN_RADIUS_SQUARED; Objlist_add ( f_ptr, alien ); tmp_pos[XPOS] += FORMATION_X_INC; fcolumn[j] +=1; alien++; } f_ptr++; } /* initialize alien bombs */ for ( i = 0; i < MAX_BOMBS; i++ ) { Object_init ( &bombs[i] ); bombs[i].radius = BOMB_RADIUS; bombs[i].radius_squared = BOMB_RADIUS_SQUARED; Object_set_drawfn ( &bombs[i], Alien_missile_draw ); } abombs = &abomblist; Objlist_clear ( abombs ); /* initialize the UFO */ spawn_ufo = 0; gv->ufo_zone = ZONE_9; ufo = &alien_ufo; Object_init ( ufo ); Object_set_drawfn ( ufo, Ufo_draw ); ufo->radius = UFO_RADIUS; ufo->radius_squared = UFO_RADIUS_SQUARED; ufo->delay = 0; ucolor = 0; } /*================================================================*/ void Update_fcolumn ( OBJECT *obj ) { int i, j, tmp; if ( gv->alien_count == 0 ) return; i = obj->vpos; fcolumn[i] -= 1; /* select new lead-column if current lead-column is empty */ if ( fleadcol == i && fcolumn[i] == 0 ) { j = fleadcol; if ( fdir == LEFT ) { while ( j < MAX_COLUMNS ) { if ( fcolumn[j] > 0 ) break; j++; } tmp = (j-fleadcol) * 3; } else { while ( j > -1 ) { if ( fcolumn[j] > 0 ) break; j--; } tmp = (fleadcol-j) * 3; } fforward -= tmp; fleadcol = j; } /* update alien movement speed */ if ( ( gv->alien_count % 5 ) == 0 ) fscur++; } void Aliens_update ( void ) { int i, j, fdir_save, chance; OBJECT *alien, *abomb, *tmp; /* move alien bombs */ drop_bomb += gv->msec; abomb = abombs->head; while ( abomb ) { Vector_copy ( abomb->pos, abomb->old_pos ); abomb->pos[ZPOS] += abomb_thrust[ZPOS] * gv->fadjust; if ( abomb->pos[ZPOS] > 0.0 ) { abomb->active = FALSE; tmp = abomb->next; Objlist_del ( abombs, abomb ); abomb = tmp; } else { Object_update_zone ( abomb ); abomb = abomb->next; } } /* update alien formation */ if ( gv->alien_count > 0 && \ ( player1->active || ( gv->pduel && player2->active ) ) ) { fmove += gv->msec; if ( fmove > fspeed[fscur] ) { while ( fmove > fspeed[fscur] ) fmove -= fspeed[fscur]; fforward++; fanim ^= ANIMATION_TOGGLE; fdir_save = fdir; /* is it time to move the formation forward?? */ if ( fforward == fforward_max ) { fforward = 0; gv->formation_zone--; the_formation.zone--; Vector_addd ( the_formation.pos, fthrust[FORWARD] ); /* choose new lead column */ if ( fdir == LEFT ) { i = MAX_COLUMNS - 1; while ( i > -1 ) { if ( fcolumn[i] > 0 ) break; i--; } fforward = ( ( i - fleadcol ) * FORMATION_STEP ); fdir_save = RIGHT; } else { i = 0; while ( i < MAX_COLUMNS ) { if ( fcolumn[i] > 0 ) break; i++; } fforward = ( ( fleadcol - i ) * FORMATION_STEP ); fdir_save = LEFT; } fleadcol = i; fdir = FORWARD; } for ( i = 0; i < MAX_FORMATIONS; i++ ) { alien = (af_list+i)->head; while ( alien ) { Vector_addd ( alien->pos, fthrust[fdir] ); Object_update_zone ( alien ); alien = alien->next; } } fdir = fdir_save; } } /* move ufo */ if ( ufo->active ) { /* adjust velocity according to frame time */ /* set new position */ ufo->pos[XPOS] += ufo_thrust[XPOS] * gv->fadjust; ufo->pos[YPOS] += ufo_thrust[YPOS] * gv->fadjust; ufo->pos[ZPOS] += ufo_thrust[ZPOS] * gv->fadjust; Object_update_zone ( ufo ); if ( ufo->pos[XPOS] > UFO_MAX_X_POS ) { Jumpgate_open ( ufo->pos, RIGHT ); ufo->active = FALSE; } } else { spawn_ufo += gv->msec; if ( spawn_ufo > SPAWN_UFO_TIME ) { spawn_ufo -= SPAWN_UFO_TIME; Ufo_spawn (); } } /* drop a bomb or two */ if ( drop_bomb > DROP_BOMB_TIME ) { drop_bomb -= DROP_BOMB_TIME; chance = rand() % DROP_BOMB_CHANCE_1; if ( chance < DROP_BOMB_CHANCE_2 ) { /* pick formation in front of highest score player */ if ( gv->pduel && gv->pscore2 > gv->pscore1 ) i = pm2->zheight; else i = pm1->zheight; if ( i >= 0 && i < ZONE_HEIGHT_MAX ) { alien = (af_list+i)->head; if ( alien ) { /* pick an alien who will drop a bomb */ j = (rand() % (af_list+i)->obj_count ); while ( j ) { alien = alien->next; j--; } /* find an inactive bomb and use it */ Add_bomb ( alien ); } } /* pick a random formation */ i = rand () % MAX_FORMATIONS; alien = (af_list+i)->head; if ( alien ) { /* pick an alien who will drop a bomb */ j = (rand() % (af_list+i)->obj_count ); while ( j ) { alien = alien->next; j--; } /* find an inactive bomb and use it */ Add_bomb ( alien ); } } } } /*================================================================*/ static void Add_bomb ( OBJECT *alien ) { int i; OBJECT *abomb; for ( i = 0; i < MAX_BOMBS; i++ ) { abomb = &bombs[i]; if ( abomb->active == FALSE ) { abomb->active = TRUE; Vector_copy ( alien->pos, abomb->pos ); Vector_copy ( alien->pos, abomb->old_pos ); Objlist_add ( abombs, abomb ); break; } } } /*================================================================*/ void Aliens_draw ( OBJECT *obj, MAT r1, MAT r2 ) { OBJECT *alien; VEC tmp[16]; MAT tmp_mat; int p1[32], p2[32], fmodel; int i, j, x1R, y1B, x2L, y2T; x1R = gv->x1r; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; for ( i = 0; i < MAX_FORMATIONS; i++ ) { if ( i == MAX_FORMATIONS-1 ) fmodel = 2; else if ( i > 1 ) fmodel = 1; else fmodel = 0; alien = (af_list+i)->head; while ( alien ) { Matrix_vec_mult ( r1, alien->pos, tmp[0] ); Camera_project_points ( tmp, p1, 1 ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); if ( fanim ) Matrix_vec_multn ( tmp_mat, &avert2[fmodel*16], tmp, 16 ); else Matrix_vec_multn ( tmp_mat, &avert1[fmodel*16], tmp, 16 ); Camera_project_points ( tmp, p1, 16 ); if ( gv->pduel ) { Matrix_vec_mult ( r2, alien->pos, tmp[0] ); Camera_project_points ( tmp, p2, 1 ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); if ( fanim ) Matrix_vec_multn ( tmp_mat, &avert2[fmodel*16], tmp, 16 ); else Matrix_vec_multn ( tmp_mat, &avert1[fmodel*16], tmp, 16 ); Camera_project_points ( tmp, p2, 16 ); if ( gv->phorizontal ) { for ( j = 1; j < 32; j += 2 ) { p1[j] /= 2; p2[j] = p2[j] / 2 + y2T; } } else if ( gv->pvertical ) { for ( j = 0; j < 32; j += 2 ) { p1[j] /= 2; p2[j] = p2[j] / 2 + x2L; } } else { for ( j = 0; j < 32; j += 2 ) { p1[j] /= 2; p2[j] = p2[j] / 2 + x2L; } for ( j = 1; j < 32; j += 2 ) { p1[j] /= 2; p2[j] = p2[j] / 2 + y2T; } } /* body */ if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], GREEN ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], GREEN ); if ( p2[4] >= x2L && p2[6] >= x2L && \ p2[5] >= y2T && p2[7] >= y2T ) Draw_line ( p2[4], p2[5], p2[6], p2[7], GREEN ); if ( p2[6] >= x2L && p2[0] >= x2L && \ p2[7] >= y2T && p2[1] >= y2T ) Draw_line ( p2[6], p2[7], p2[0], p2[1], GREEN ); /* left leg */ if ( p2[8] >= x2L && p2[10] >= x2L && \ p2[9] >= y2T && p2[11] >= y2T ) Draw_line ( p2[8], p2[9], p2[10], p2[11], GREEN ); if ( p2[10] >= x2L && p2[12] >= x2L && \ p2[11] >= y2T && p2[13] >= y2T ) Draw_line ( p2[10], p2[11], p2[12], p2[13], GREEN ); if ( p2[12] >= x2L && p2[8] >= x2L && \ p2[13] >= y2T && p2[9] >= y2T ) Draw_line ( p2[12], p2[13], p2[8], p2[9], GREEN ); if ( p2[10] >= x2L && p2[14] >= x2L && \ p2[11] >= y2T && p2[15] >= y2T ) Draw_line ( p2[10], p2[11], p2[14], p2[15], GREEN ); if ( p2[14] >= x2L && p2[12] >= x2L && \ p2[15] >= y2T && p2[13] >= y2T ) Draw_line ( p2[14], p2[15], p2[12], p2[13], GREEN ); /* right leg */ if ( p2[8] >= x2L && p2[16] >= x2L && \ p2[9] >= y2T && p2[17] >= y2T ) Draw_line ( p2[8], p2[9], p2[16], p2[17], GREEN ); if ( p2[16] >= x2L && p2[18] >= x2L && \ p2[17] >= y2T && p2[19] >= y2T ) Draw_line ( p2[16], p2[17], p2[18], p2[19], GREEN ); if ( p2[18] >= x2L && p2[8] >= x2L && \ p2[19] >= y2T && p2[9] >= y2T ) Draw_line ( p2[18], p2[19], p2[8], p2[9], GREEN ); if ( p2[16] >= x2L && p2[20] >= x2L && \ p2[17] >= y2T && p2[21] >= y2T ) Draw_line ( p2[16], p2[17], p2[20], p2[21], GREEN ); if ( p2[20] >= x2L && p2[18] >= x2L && \ p2[21] >= y2T && p2[19] >= y2T ) Draw_line ( p2[20], p2[21], p2[18], p2[19], GREEN ); /* left eye */ if ( p2[22] >= x2L && p2[24] >= x2L && \ p2[23] >= y2T && p2[25] >= y2T ) Draw_line ( p2[22], p2[23], p2[24], p2[25], RED ); if ( p2[24] >= x2L && p2[26] >= x2L && \ p2[25] >= y2T && p2[27] >= y2T ) Draw_line ( p2[24], p2[25], p2[26], p2[27], RED ); if ( p2[26] >= x2L && p2[22] >= x2L && \ p2[27] >= y2T && p2[23] >= y2T ) Draw_line ( p2[26], p2[27], p2[22], p2[23], RED ); /* right eye */ if ( p2[22] >= x2L && p2[28] >= x2L && \ p2[23] >= y2T && p2[29] >= y2T ) Draw_line ( p2[22], p2[23], p2[28], p2[29], RED ); if ( p2[28] >= x2L && p2[30] >= x2L && \ p2[29] >= y2T && p2[31] >= y2T ) Draw_line ( p2[28], p2[29], p2[30], p2[31], RED ); if ( p2[30] >= x2L && p2[22] >= x2L && \ p2[31] >= y2T && p2[23] >= y2T ) Draw_line ( p2[30], p2[31], p2[22], p2[23], RED ); } /* body */ if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], GREEN ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], GREEN ); if ( p1[4] < x1R && p1[6] < x1R && \ p1[5] < y1B && p1[7] < y1B ) Draw_line ( p1[4], p1[5], p1[6], p1[7], GREEN ); if ( p1[6] < x1R && p1[0] < x1R && \ p1[7] < y1B && p1[1] < y1B ) Draw_line ( p1[6], p1[7], p1[0], p1[1], GREEN ); /* left leg */ if ( p1[8] < x1R && p1[10] < x1R && \ p1[9] < y1B && p1[11] < y1B ) Draw_line ( p1[8], p1[9], p1[10], p1[11], GREEN ); if ( p1[10] < x1R && p1[12] < x1R && \ p1[11] < y1B && p1[13] < y1B ) Draw_line ( p1[10], p1[11], p1[12], p1[13], GREEN ); if ( p1[12] < x1R && p1[8] < x1R && \ p1[13] < y1B && p1[9] < y1B ) Draw_line ( p1[12], p1[13], p1[8], p1[9], GREEN ); if ( p1[10] < x1R && p1[14] < x1R && \ p1[11] < y1B && p1[15] < y1B ) Draw_line ( p1[10], p1[11], p1[14], p1[15], GREEN ); if ( p1[14] < x1R && p1[12] < x1R && \ p1[15] < y1B && p1[13] < y1B ) Draw_line ( p1[14], p1[15], p1[12], p1[13], GREEN ); /* right leg */ if ( p1[8] < x1R && p1[16] < x1R && \ p1[9] < y1B && p1[17] < y1B ) Draw_line ( p1[8], p1[9], p1[16], p1[17], GREEN ); if ( p1[16] < x1R && p1[18] < x1R && \ p1[17] < y1B && p1[19] < y1B ) Draw_line ( p1[16], p1[17], p1[18], p1[19], GREEN ); if ( p1[18] < x1R && p1[8] < x1R && \ p1[19] < y1B && p1[9] < y1B ) Draw_line ( p1[18], p1[19], p1[8], p1[9], GREEN ); if ( p1[16] < x1R && p1[20] < x1R && \ p1[17] < y1B && p1[21] < y1B ) Draw_line ( p1[16], p1[17], p1[20], p1[21], GREEN ); if ( p1[20] < x1R && p1[18] < x1R && \ p1[21] < y1B && p1[19] < y1B ) Draw_line ( p1[20], p1[21], p1[18], p1[19], GREEN ); /* left eye */ if ( p1[22] < x1R && p1[24] < x1R && \ p1[23] < y1B && p1[25] < y1B ) Draw_line ( p1[22], p1[23], p1[24], p1[25], RED ); if ( p1[24] < x1R && p1[26] < x1R && \ p1[25] < y1B && p1[27] < y1B ) Draw_line ( p1[24], p1[25], p1[26], p1[27], RED ); if ( p1[26] < x1R && p1[22] < x1R && \ p1[27] < y1B && p1[23] < y1B ) Draw_line ( p1[26], p1[27], p1[22], p1[23], RED ); /* right eye */ if ( p1[22] < x1R && p1[28] < x1R && \ p1[23] < y1B && p1[29] < y1B ) Draw_line ( p1[22], p1[23], p1[28], p1[29], RED ); if ( p1[28] < x1R && p1[30] < x1R && \ p1[29] < y1B && p1[31] < y1B ) Draw_line ( p1[28], p1[29], p1[30], p1[31], RED ); if ( p1[30] < x1R && p1[22] < x1R && \ p1[31] < y1B && p1[23] < y1B ) Draw_line ( p1[30], p1[31], p1[22], p1[23], RED ); alien = alien->next; } } } void Alien_missile_draw ( OBJECT *obj, MAT r1, MAT r2 ) { MAT tmp_mat1, tmp_mat2; VEC tmp[3]; int x1R, y1B, x2L, y2T; int p1[6], p2[6], p3[6], p4[6]; x1R = gv->x1r; y1B = gv->y1b; Matrix_vec_mult ( r1, obj->pos, tmp[0] ); Matrix_copy ( r1, tmp_mat1 ); Matrix_set_trans ( tmp_mat1, tmp[0] ); Matrix_vec_multn ( tmp_mat1, abomb_vert, tmp, 3 ); Camera_project_points ( tmp, p1, 3 ); Matrix_vec_multn ( tmp_mat1, abomb_vert2, tmp, 3 ); Camera_project_points ( tmp, p3, 3 ); if ( gv->pduel ) { x2L = gv->x2l; y2T = gv->y2t; Matrix_vec_mult ( r2, obj->pos, tmp[0] ); Matrix_copy ( r2, tmp_mat2 ); Matrix_set_trans ( tmp_mat2, tmp[0] ); Matrix_vec_multn ( tmp_mat2, abomb_vert, tmp, 3 ); Camera_project_points ( tmp, p2, 3 ); Matrix_vec_multn ( tmp_mat2, abomb_vert2, tmp, 3 ); Camera_project_points ( tmp, p4, 3 ); if ( gv->phorizontal ) { p1[1] /= 2; p1[3] /= 2; p1[5] /= 2; p3[1] /= 2; p3[3] /= 2; p3[5] /= 2; p2[1] = p2[1] / 2 + y2T; p2[3] = p2[3] / 2 + y2T; p2[5] = p2[5] / 2 + y2T; p4[1] = p4[1] / 2 + y2T; p4[3] = p4[3] / 2 + y2T; p4[5] = p4[5] / 2 + y2T; } else if ( gv->pvertical ) { p1[0] /= 2; p1[2] /= 2; p1[4] /= 2; p3[0] /= 2; p3[2] /= 2; p3[4] /= 2; p2[0] = p2[0] / 2 + x2L; p2[2] = p2[2] / 2 + x2L; p2[4] = p2[4] / 2 + x2L; p4[0] = p4[0] / 2 + x2L; p4[2] = p4[2] / 2 + x2L; p4[4] = p4[4] / 2 + x2L; } else { p1[0] /= 2; p1[2] /= 2; p1[4] /= 2; p3[0] /= 2; p3[2] /= 2; p3[4] /= 2; p2[0] = p2[0] / 2 + x2L; p2[2] = p2[2] / 2 + x2L; p2[4] = p2[4] / 2 + x2L; p4[0] = p4[0] / 2 + x2L; p4[2] = p4[2] / 2 + x2L; p4[4] = p4[4] / 2 + x2L; p1[1] /= 2; p1[3] /= 2; p1[5] /= 2; p3[1] /= 2; p3[3] /= 2; p3[5] /= 2; p2[1] = p2[1] / 2 + y2T; p2[3] = p2[3] / 2 + y2T; p2[5] = p2[5] / 2 + y2T; p4[1] = p4[1] / 2 + y2T; p4[3] = p4[3] / 2 + y2T; p4[5] = p4[5] / 2 + y2T; } if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], YELLOW ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], YELLOW ); if ( p2[4] >= x2L && p2[0] >= x2L && \ p2[5] >= y2T && p2[1] >= y2T ) Draw_line ( p2[4], p2[5], p2[0], p2[1], YELLOW ); if ( p4[0] >= x2L && p4[2] >= x2L && \ p4[1] >= y2T && p4[3] >= y2T ) Draw_line ( p4[0], p4[1], p4[2], p4[3], YELLOW ); if ( p2[2] >= x2L && p4[4] >= x2L && \ p2[3] >= y2T && p4[5] >= y2T ) Draw_line ( p4[2], p4[3], p4[4], p4[5], YELLOW ); if ( p4[4] >= x2L && p4[0] >= x2L && \ p4[5] >= y2T && p4[1] >= y2T ) Draw_line ( p4[4], p4[5], p4[0], p4[1], YELLOW ); } if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], YELLOW ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], YELLOW ); if ( p1[4] < x1R && p1[0] < x1R && \ p1[5] < y1B && p1[1] < y1B ) Draw_line ( p1[4], p1[5], p1[0], p1[1], YELLOW ); if ( p3[0] < x1R && p3[2] < x1R && \ p3[1] < y1B && p3[3] < y1B ) Draw_line ( p3[0], p3[1], p3[2], p3[3], YELLOW ); if ( p3[2] < x1R && p3[4] < x1R && \ p3[3] < y1B && p3[5] < y1B ) Draw_line ( p3[2], p3[3], p3[4], p3[5], YELLOW ); if ( p3[4] < x1R && p3[0] < x1R && \ p3[5] < y1B && p3[1] < y1B ) Draw_line ( p3[4], p3[5], p3[0], p3[1], YELLOW ); } /*================================================================*/ void Ufo_spawn ( void ) { int height; float y, z; height = rand() % MAX_FORMATIONS; y = ( (float)(height) * 100.0f ) + 50.0f; z = UFO_Z_POS; ufo->zone = UFO_ZONE; ufo->zheight = height; Vector_set ( ufo->pos, UFO_MIN_X_POS, y, z ); Jumpgate_open ( ufo->pos, LEFT ); ufo->active = TRUE; } void Ufo_draw ( OBJECT *obj, MAT r1, MAT r2 ) { MAT tmp_mat; VEC tmp[17]; int p1[34], p2[34]; int i, x1R, y1B, x2L, y2T; unsigned int color; x1R = gv->x1r; y1B = gv->y1b; ufo->delay += gv->msec; if ( ufo->delay > UFO_LIGHTS_CYCLE ) { ufo->delay -= UFO_LIGHTS_CYCLE; ucolor++; if ( ucolor >= 4 ) ucolor = 0; } color = RED - ( ucolor * 15 ); Matrix_vec_mult ( r1, obj->pos, tmp[0] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, uvert1, tmp, 17 ); Camera_project_points ( tmp, p1, 17 ); if ( gv->pduel ) { x2L = gv->x2l; y2T = gv->y2t; Matrix_vec_mult ( r2, obj->pos, tmp[0] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, uvert1, tmp, 17 ); Camera_project_points ( tmp, p2, 17 ); if ( gv->phorizontal ) { for ( i = 1; i < 34; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } else if ( gv->pvertical ) { for ( i = 0; i < 34; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } } else { for ( i = 0; i < 34; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } for ( i = 1; i < 34; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], GREEN ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], GREEN ); if ( p2[4] >= x2L && p2[6] >= x2L && \ p2[5] >= y2T && p2[7] >= y2T ) Draw_line ( p2[4], p2[5], p2[6], p2[7], GREEN ); if ( p2[6] >= x2L && p2[0] >= x2L && \ p2[7] >= y2T && p2[1] >= y2T ) Draw_line ( p2[6], p2[7], p2[0], p2[1], GREEN ); if ( p2[8] >= x2L && p2[10] >= x2L && \ p2[9] >= y2T && p2[11] >= y2T ) Draw_line ( p2[8], p2[9], p2[10], p2[11], GREEN ); if ( p2[8] >= x2L && p2[12] >= x2L && \ p2[9] >= y2T && p2[13] >= y2T ) Draw_line ( p2[8], p2[9], p2[12], p2[13], GREEN ); if ( p2[14] >= x2L && p2[16] >= x2L && \ p2[15] >= y2T && p2[17] >= y2T ) Draw_line ( p2[14], p2[15], p2[16], p2[17], GREEN ); if ( p2[14] >= x2L && p2[18] >= x2L && \ p2[15] >= y2T && p2[19] >= y2T ) Draw_line ( p2[14], p2[15], p2[18], p2[19], GREEN ); if ( p2[20] >= x2L && p2[22] >= x2L && \ p2[21] >= y2T && p2[23] >= y2T ) Draw_line ( p2[20], p2[21], p2[22], p2[23], GREEN ); if ( p2[22] >= x2L && p2[24] >= x2L && \ p2[23] >= y2T && p2[25] >= y2T ) Draw_line ( p2[22], p2[23], p2[24], p2[25], GREEN ); if ( p2[26] >= x2L && p2[27] >= y2T ) Draw_point ( p2[26], p2[27], color ); if ( p2[28] >= x2L && p2[29] >= y2T ) Draw_point ( p2[28], p2[29], color ); if ( p2[30] >= x2L && p2[31] >= y2T ) Draw_point ( p2[30], p2[31], color ); if ( p2[32] >= x2L && p2[33] >= y2T ) Draw_point ( p2[32], p2[33], color ); } if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], GREEN ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], GREEN ); if ( p1[4] < x1R && p1[6] < x1R && \ p1[5] < y1B && p1[7] < y1B ) Draw_line ( p1[4], p1[5], p1[6], p1[7], GREEN ); if ( p1[6] < x1R && p1[0] < x1R && \ p1[7] < y1B && p1[1] < y1B ) Draw_line ( p1[6], p1[7], p1[0], p1[1], GREEN ); if ( p1[8] < x1R && p1[10] < x1R && \ p1[9] < y1B && p1[11] < y1B ) Draw_line ( p1[8], p1[9], p1[10], p1[11], GREEN ); if ( p1[8] < x1R && p1[12] < x1R && \ p1[9] < y1B && p1[33] < y1B ) Draw_line ( p1[8], p1[9], p1[12], p1[13], GREEN ); if ( p1[14] < x1R && p1[16] < x1R && \ p1[15] < y1B && p1[17] < y1B ) Draw_line ( p1[14], p1[15], p1[16], p1[17], GREEN ); if ( p1[14] < x1R && p1[18] < x1R && \ p1[15] < y1B && p1[19] < y1B ) Draw_line ( p1[14], p1[15], p1[18], p1[19], GREEN ); if ( p1[20] < x1R && p1[22] < x1R && \ p1[21] < y1B && p1[23] < y1B ) Draw_line ( p1[20], p1[21], p1[22], p1[23], GREEN ); if ( p1[22] < x1R && p1[24] < x1R && \ p1[23] < y1B && p1[25] < y1B ) Draw_line ( p1[22], p1[23], p1[24], p1[25], GREEN ); if ( p1[26] < x1R && p1[27] < y1B ) Draw_point ( p1[26], p1[27], color ); if ( p1[28] < x1R && p1[29] < y1B ) Draw_point ( p1[28], p1[29], color ); if ( p1[30] < x1R && p1[31] < y1B ) Draw_point ( p1[30], p1[31], color ); if ( p1[32] < x1R && p1[33] < y1B ) Draw_point ( p1[32], p1[33], color ); } /*================================================================*/ JoesCat-xinvaders3d-030b568/camera.c000066400000000000000000000100071506711671200171430ustar00rootroot00000000000000/*------------------------------------------------------------------ camera.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #include #include #include #include "mat4x4.h" #include "vec4x1.h" #include "camera.h" /* local variables */ static float hfov, vfov, hpc, vpc; static float screen_width, screen_height, half_screen_width, \ half_screen_height; static float aspect_ratio; static float hadjust, vadjust; static MAT r_2_l_1, r_2_l_2; void Camera_init ( unsigned int width, unsigned int height, float fov ) { screen_width = (float) width; screen_height = (float) height; half_screen_width = screen_width / 2.0f; half_screen_height = screen_height / 2.0f; /* calculate horizontal & vertical field of view */ /* horizontal compensate = HALF_SCREEN_WIDTH / tan ( degrees / 2 ) vertical compensate = HALF_SCREEN_HEIGHT / tan ( degrees / 2 ) see "Building 3d Game Engine" by Brian Hook */ hfov = vfov = fov; hpc = half_screen_width / tan ( hfov/1.5f ); vpc = half_screen_height / tan ( vfov/1.5f ); /* adjust aspect ratio if screen not square ( ie. 4/3 ratio )*/ aspect_ratio = screen_height / screen_height; /* calculate perspective adjustment values */ hadjust = hpc; vadjust = (vpc * aspect_ratio); /* initialize coordinate system conversion mat */ Matrix_id ( r_2_l_1 ); r_2_l_1[2][2] = -1.0f; Matrix_id ( r_2_l_2 ); r_2_l_2[2][2] = -1.0f; } void Camera_project_point ( VEC a, int b[2] ) { if ( a[2] < 0.0 ) { b[0] = b[1] = 0; return; } b[0] = (int) ( a[0] * hadjust / a[2] + half_screen_width ); b[1] = (int) ( -a[1] * vadjust / a[2] + half_screen_height ); } void Camera_project_points ( VEC a[], int b[], int n ) { int i, j; for ( i=0, j=0; i@])], [],[enable_debuggame=no]) makeDebug=no if test "x$enable_debuggame" = xyes || test "x$enable_debuggame" = xtrue ; then makeDebuggame=yes AC_DEFINE([GAME_DEBUG],1,[Define if debugging game using printf.]) fi AC_ARG_ENABLE([debugkeyboard], [AS_HELP_STRING([--enable-debugkeyboard], [Enable Keyboard debugging printf mode on commandline @<:@default=no@:>@])], [],[enable_debugkeyboard=no]) makeDebugkeyboard=no if test "x$enable_debugkeyboard" = xyes || test "x$enable_debugkeyboard" = xtrue ; then makeDebugkeyboard=yes AC_DEFINE([GAME_DEBUG_KEYBOARD],1,[Define if debugging Keyboard using printf.]) fi # Enable xinv3d backwards compatibility AC_ARG_ENABLE([as_xinv3d], [AS_HELP_STRING([--enable-as-xinv3d], [Install Game as xinv3d for backwards compatibility @<:@default=no@:>@])], [],[enable_as_xinv3d=no]) make_as_xinv3d=no make_as_xinvaders3d=xinvaders3d make_as_xinvaders3d_fn=XInvaders3D make_as_xinvaders3d_uc=XINVADERS3D if test "x$enable_as_xinv3d" = xyes || test "x$enable_as_xinv3d" = xtrue ; then make_as_xinv3d=yes make_as_xinvaders3d=xinv3d make_as_xinvaders3d_fn=XInv3D make_as_xinvaders3d_uc=XINV3D fi AM_CONDITIONAL([WANTXINV3D],[test x$make_as_xinv3d = xyes]) AC_SUBST([make_as_xinvaders3d]) AC_SUBST([make_as_xinvaders3d_fn]) AC_SUBST([make_as_xinvaders3d_uc]) #------------------------------------------- # Check for and add usable compiler warnings WCFLAGS="" AC_LANG_PUSH([C]) AX_CHECK_COMPILE_FLAG([-Wall],[WCFLAGS="$WCFLAGS -Wall"]) AX_CHECK_COMPILE_FLAG([-Wextra],[WCFLAGS="$WCFLAGS -Wextra"]) AX_CHECK_COMPILE_FLAG([-Wcast-align],[WCFLAGS="$WCFLAGS -Wcast-align"]) AX_CHECK_COMPILE_FLAG([-Wbad-function-cast],[WCFLAGS="$WCFLAGS -Wbad-function-cast"]) AX_CHECK_COMPILE_FLAG([-Wc++-compat],[WCFLAGS="$WCFLAGS -Wc++-compat"]) AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes],[WCFLAGS="$WCFLAGS -Wmissing-prototypes"]) AX_CHECK_COMPILE_FLAG([-Wunused],[WCFLAGS="$WCFLAGS -Wunused"]) AX_CHECK_COMPILE_FLAG([-Wdeprecated-declarations],[WCFLAGS="$WCFLAGS -Wdeprecated-declarations"]) AC_LANG_POP AC_SUBST([WCFLAGS]) #------------------------------------------- AC_CONFIG_FILES([ Makefile xinvaders3d.6 desktop/Makefile desktop/xinvaders3d.desktop desktop/xinvaders3d.appdata.xml desktop/xinvaders3d.xml desktop/xinvaders3d.metainfo.xml packaging/xinvaders3d.spec]) AC_OUTPUT AC_MSG_NOTICE([ Configuration: Source code location ${srcdir} Build code location ${builddir} Destination prefix ${prefix} Host Operating System ${host} Compiler ${CC} Config CFLAGS "${CFLAGS}" Config WFLAGS "${WCFLAGS}" Config LDFLAGS "${LDFLAGS}" Build project as ${make_as_xinvaders3d_fn} ]) JoesCat-xinvaders3d-030b568/defines.h000066400000000000000000000044501506711671200173420ustar00rootroot00000000000000/*------------------------------------------------------------------ defines.h: Game Constants XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #ifndef GAME_DEFINES #define GAME_DEFINES #define REFERENCE_FRAMERATE 30.0 /* 30 fps */ enum color_names { BLACK=0, RED=63, GREEN=127, BLUE=191, YELLOW=192, WHITE=255 }; enum zone_enum { ZONE_0 = 0, ZONE_1 = 1, ZONE_2 = 2, ZONE_3 = 3, ZONE_4 = 4, ZONE_5 = 5, ZONE_6 = 6, ZONE_7 = 7, ZONE_8 = 8, ZONE_9 = 9, ZONE_MAX = 10, ZONE_HEIGHT_MAX = 5, ZONE_WIDTH = 100, ZONE_HEIGHT = 100 }; enum game_enum { LOGO_TIME = 10000, /* 10 sec */ READY_TIME = 3000, /* 3 sec */ GAMEOVER_TIME = 15000, /* 15 sec */ PLAYER_LIVES_START = 3, HISCORE = 10000, /* 10,000 pts */ UFO_BONUS = 500, /* 500 pts */ PLAYER_LIFE_BONUS = 7500, /* every 7500pts */ PLAYER_LIFE_MAX = 5, INITGAME = 0, NEWGAME = 1, NEWLEVEL = 2, XPOS = 0, YPOS = 1, ZPOS = 2, MAX_OBJECTS = 100 }; /* TRUE and FALSE defined using #ifdefs instead, and only if they aren't defined already. Please stick to this, as the include files needed for timers on at least one platform define TRUE and FALSE, resulting in an error if they are part of an enumeration. TBB */ #ifndef TRUE #define TRUE 1 #endif /* TRUE */ #ifndef FALSE #define FALSE 0 #endif /* FALSE */ #endif JoesCat-xinvaders3d-030b568/desktop/000077500000000000000000000000001506711671200172225ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/desktop/128x128/000077500000000000000000000000001506711671200201575ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/desktop/128x128/xinvaders3d.png000066400000000000000000000026501506711671200231220ustar00rootroot00000000000000PNG  IHDRPLTE3f3333f333ff3fffff3f3f̙3f3333f3333333333f3333333f3f33ff3f3f3f3333f3333333f3̙333333f333ff3ffffff3f33f3ff3f3f3ffff3fffffffffff3fffffff3fff̙ffff3fffff3f̙3333f33̙3ff3ffff̙f3f̙3f̙̙3f̙3f3333f333ff3fffff̙̙3̙f̙̙̙3f̙3f3f3333f333ff3fffff3f3f̙3fez|tRNSəj pHYs  c ?BIDATxQ1EY_ T' mU8&q֑Tn%[";ځ|{^u2,f\u1P0j=L PP=|st@!<+{` do; Ϊ@* CYTqY){Jd|\҆\- j @->h8:><2\ [53A?}J, ؝5[t=ŗIENDB`JoesCat-xinvaders3d-030b568/desktop/256x256/000077500000000000000000000000001506711671200201635ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/desktop/256x256/xinvaders3d.png000066400000000000000000000033701506711671200231260ustar00rootroot00000000000000PNG  IHDRkXTPLTE3f3333f333ff3fffff3f3f̙3f3333f3333333333f3333333f3f33ff3f3f3f3333f3333333f3̙333333f333ff3ffffff3f33f3ff3f3f3ffff3fffffffffff3fffffff3fff̙ffff3fffff3f̙3333f33̙3ff3ffff̙f3f̙3f̙̙3f̙3f3333f333ff3fffff̙̙3̙f̙̙̙3f̙3f3f3333f333ff3fffff3f3f̙3fez|tRNSəj pHYs  c ?IDATxA POg3i44nT=vy6ggց \\PsS֧g/|zzc?=z:׀-{}.0ZSb{n@=>>jbrrXbuvVmW`Uv`kUERXMչRxt~@:?^ /ΏH xt~@:?^ /ΏH xt~@:?^ /ΏH sH~?Vx|IENDB`JoesCat-xinvaders3d-030b568/desktop/32x32/000077500000000000000000000000001506711671200200035ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/desktop/32x32/xinvaders3d.png000066400000000000000000000024151506711671200227450ustar00rootroot00000000000000PNG  IHDR DPLTE3f3333f333ff3fffff3f3f̙3f3333f3333333333f3333333f3f33ff3f3f3f3333f3333333f3̙333333f333ff3ffffff3f33f3ff3f3f3ffff3fffffffffff3fffffff3fff̙ffff3fffff3f̙3333f33̙3ff3ffff̙f3f̙3f̙̙3f̙3f3333f333ff3fffff̙̙3̙f̙̙̙3f̙3f3f3333f333ff3fffff3f3f̙3fez|tRNSəj pHYs  c ?IDAT8 0D߁HRK qAD4W˼N|GMȷĪBz1,)PUG])0bcٰ[뭫Lm)g-D05m|Q (%/>!?r#GA:ZIENDB`JoesCat-xinvaders3d-030b568/desktop/32x32/xinvaders3d.xpm000066400000000000000000000023341506711671200227650ustar00rootroot00000000000000/* XPM */ static char *dummy[]={ "32 32 3 1", "# c #000000", "a c #00ff00", ". c #ff0000", ".##############################.", "...########aaaaaaaaaa########...", "#.#.######a##########a######.#.#", "#.##..###a############a###..##.#", "#.####.#a##############a#.####.#", "##.####..##############..####.##", "##.###a##.############.##a###.##", "##.##a####..########..####a##.##", "###.a#######.######.#######a.###", "###.#########..##..#########.###", "##a.#########......#########.a##", "#a##.#####...######...#####.##a#", "a###.#....############....#.###a", "aaaa..aaaaaaaaaaaaaaaaaaaa..aaaa", "############aaa##aaa############", "##########aa##a##a##aa##########", "########aa###a####a###aa########", "#######aa####a####a####aa#######", "#######a#aa#a######a#aa#a#######", "#######a##a#a######a#a##a#######", "#######a###a########a###a#######", "#######a###a########a###a#######", "#######a##a##########a##a#######", "#######a##a##########a##a#######", "#######a##a##########a##a#######", "#######a#a############a#a#######", "#######a#a############a#a#######", "#######a#a############a#a#######", "#######aa##############aa#######", "#######aa##############aa#######", "#######aa##############aa#######", "#######a################a#######"}; JoesCat-xinvaders3d-030b568/desktop/64x64/000077500000000000000000000000001506711671200200155ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/desktop/64x64/xinvaders3d.png000066400000000000000000000025271506711671200227630ustar00rootroot00000000000000PNG  IHDR@@PLTE3f3333f333ff3fffff3f3f̙3f3333f3333333333f3333333f3f33ff3f3f3f3333f3333333f3̙333333f333ff3ffffff3f33f3ff3f3f3ffff3fffffffffff3fffffff3fff̙ffff3fffff3f̙3333f33̙3ff3ffff̙f3f̙3f̙̙3f̙3f3333f333ff3fffff̙̙3̙f̙̙̙3f̙3f3f3333f333ff3fffff3f3f̙3fez|tRNSəj pHYs  c ?IDATX[0E]I MBȇL&qG"RhF2 hΒh(* xkp+<o,g`#ԋҀ #$5)Ȗ醵JjT2tE [$nLa>]s+7q Ku 0$ n(5`|?o>;aT~?ByXCIENDB`JoesCat-xinvaders3d-030b568/desktop/Makefile.am000066400000000000000000000100261506711671200212550ustar00rootroot00000000000000# Makefile.am - build XINVADERS 3D - 3d Shoot'em up # Copyright (C) 2022 Jose Da Silva # # 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 # appdatadir = ${datarootdir}/appdata appdata_DATA = deskpixsdir = ${datarootdir}/pixmaps deskpixs_DATA = desktopdir = ${datarootdir}/applications desktop_DATA = ICONSDIR = ${datarootdir}/icons HICOLORDIR = ${datarootdir}/icons/hicolor hicolor32x32dir = ${HICOLORDIR}/32x32/apps hicolor64x64dir = ${HICOLORDIR}/64x64/apps hicolor128x128dir = ${HICOLORDIR}/128x128/apps hicolor256x256dir = ${HICOLORDIR}/256x256/apps hicolorscalabledir = ${HICOLORDIR}/scalable/apps hicolor32x32_DATA = hicolor64x64_DATA = hicolor128x128_DATA = hicolor256x256_DATA = hicolorscalable_DATA = metainfodir = ${datarootdir}/metainfo metainfo_DATA = mimedir = ${datarootdir}/mime mimepackagesdir = ${datarootdir}/mime/packages mimepackages_DATA = if !WANTXINV3D appdata_DATA += xinvaders3d.appdata.xml deskpixs_DATA += 32x32/xinvaders3d.xpm 32x32/xinvaders3d.png desktop_DATA += xinvaders3d.desktop hicolor32x32_DATA += 32x32/xinvaders3d.png hicolor64x64_DATA += 64x64/xinvaders3d.png hicolor128x128_DATA += 128x128/xinvaders3d.png hicolor256x256_DATA += 256x256/xinvaders3d.png hicolorscalable_DATA += svg/xinvaders3d.svgz metainfo_DATA += xinvaders3d.metainfo.xml mimepackages_DATA += xinvaders3d.xml endif if WANTXINV3D appdata_DATA += xinv3d.appdata.xml deskpixs_DATA += ${builddir}/32x32/xinv3d.xpm ${builddir}/32x32/xinv3d.png desktop_DATA += xinv3d.desktop hicolor32x32_DATA += ${builddir}/32x32/xinv3d.png hicolor64x64_DATA += ${builddir}/64x64/xinv3d.png hicolor128x128_DATA += ${builddir}/128x128/xinv3d.png hicolor256x256_DATA += ${builddir}/256x256/xinv3d.png hicolorscalable_DATA += ${builddir}/svg/xinv3d.svgz metainfo_DATA += xinv3d.metainfo.xml mimepackages_DATA += xinv3d.xml endif EXTRA_DIST = \ xinvaders3d.appdata.xml.in xinvaders3d.metainfo.xml.in \ xinvaders3d.xml.in 32x32/xinvaders3d.xpm 32x32/xinvaders3d.png \ 64x64/xinvaders3d.png 128x128/xinvaders3d.png 256x256/xinvaders3d.png \ svg/xinvaders3d.svgz xinvaders3d.desktop.in xinv3d.desktop: cp ${builddir}/xinvaders3d.desktop ${builddir}/xinv3d.desktop xinv3d.appdata.xml: cp ${builddir}/xinvaders3d.appdata.xml ${builddir}/xinv3d.appdata.xml xinv3d.metainfo.xml: cp ${builddir}/xinvaders3d.metainfo.xml ${builddir}/xinv3d.metainfo.xml xinv3d.xml: cp ${builddir}/xinvaders3d.xml ${builddir}/xinv3d.xml 32x32/xinv3d.xpm: mkdir -p ${builddir}/32x32 cp ${srcdir}/32x32/xinvaders3d.xpm ${builddir}/32x32/xinv3d.xpm 32x32/xinv3d.png: mkdir -p ${builddir}/32x32 cp ${srcdir}/32x32/xinvaders3d.png ${builddir}/32x32/xinv3d.png 64x64/xinv3d.png: mkdir -p ${builddir}/64x64 cp ${srcdir}/64x64/xinvaders3d.png ${builddir}/64x64/xinv3d.png 128x128/xinv3d.png: mkdir -p ${builddir}/128x128 cp ${srcdir}/128x128/xinvaders3d.png ${builddir}/128x128/xinv3d.png 256x256/xinv3d.png: mkdir -p ${builddir}/256x256 cp ${srcdir}/256x256/xinvaders3d.png ${builddir}/256x256/xinv3d.png svg/xinv3d.svgz: mkdir -p ${builddir}/svg cp ${srcdir}/svg/xinvaders3d.svgz ${builddir}/svg/xinv3d.svgz clean-local: rm -f ${builddir}/xinv3d.desktop rm -f ${builddir}/xinv3d.appdata.xml rm -f ${builddir}/xinv3d.metainfo.xml rm -f ${builddir}/xinv3d.xml rm -f ${builddir}/32x32/xinv3d.png rm -f ${builddir}/32x32/xinv3d.xpm rm -f ${builddir}/64x64/xinv3d.png rm -f ${builddir}/128x128/xinv3d.png rm -f ${builddir}/256x256/xinv3d.png rm -f ${builddir}/svg/xinv3d.svgz JoesCat-xinvaders3d-030b568/desktop/svg/000077500000000000000000000000001506711671200200215ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/desktop/svg/xinvaders3d.svgz000066400000000000000000000004041506711671200231640ustar00rootroot00000000000000exinvaders3d.svgMn0FA.đcr ٌތFF ׆\ZRiiڐbAABCir1FQ:gݯV3P5#3]@;`!y&Y! CXsѥ[NɸξBS*nL|;W?=yo(ݟq~gINzקWKjn8zo=F|I5>kfhJoesCat-xinvaders3d-030b568/desktop/xinvaders3d.appdata.xml.in000066400000000000000000000007271506711671200242220ustar00rootroot00000000000000 @make_as_xinvaders3d@.desktop CC0-1.0 @make_as_xinvaders3d_fn@

@make_as_xinvaders3d@ is a 3D vector-based space-invaders clone for the X Window System.

https://github.com/JoesCat/xinvaders3d
JoesCat-xinvaders3d-030b568/desktop/xinvaders3d.desktop.in000066400000000000000000000006651506711671200234630ustar00rootroot00000000000000[Desktop Entry] Version=1.0 Name=@make_as_xinvaders3d_fn@ GenericName=X Invaders 3D Game Comment=@make_as_xinvaders3d_fn@ is a 3D Vector Graphics Space Invaders clone for X11. TryExec=@make_as_xinvaders3d@ Exec=@make_as_xinvaders3d@ Icon=@make_as_xinvaders3d@ StartupNotify=true Terminal=false Type=Application Categories=Game;ArcadeGame; MimeType=application/x-@make_as_xinvaders3d@ Keywords=space;invaders;action;arcade;game;X;window; JoesCat-xinvaders3d-030b568/desktop/xinvaders3d.metainfo.xml.in000066400000000000000000000052111506711671200244030ustar00rootroot00000000000000 @make_as_xinvaders3d@ @make_as_xinvaders3d@.desktop CC0-1.0 @make_as_xinvaders3d_fn@ 3D space invaders for X

@make_as_xinvaders3d_fn@ is a 3D vector-based space-invaders clone for the X Window System.

You are a lone star fighter facing endless waves of space aliens. Your sole objective is to shoot down as many aliens as you can. All objects are represented with 3D vector graphics, allowing the aliens to grow in size as they move closer to you.

@make_as_xinvaders3d_fn@ es un clon de space-invaders basado en vectores en 3D para el sistema X Window.

Eres un piloto que se enfrenta a interminables oleadas de extraterrestres. Tienes que disparar a tantos alienígenas como puedas. Todos los Aliens están representados en gráficos vectoriales en 3D.

@make_as_xinvaders3d_fn@ est un clone vectoriel d'envahisseurs spatiaux 3D pour le système X Window.

Vous êtes un combattant solitaire face à des vagues interminables d'extraterrestres. Votre seul objectif est d'abattre autant d'extraterrestres que vous le pouvez. Tous les objets sont représentés avec des graphiques vectoriels 3D, permettant la les extraterrestres grandissent à mesure qu'ils se rapprochent de vous.

@make_as_xinvaders3d_fn@ é um clone de space-invaders baseado em vetor 3D para o X11.

Você é um piloto enfrentando ondas intermináveis de alienígenas do espaço. Você tem que atirar no maior número de alienígenas que puder. Todos os alienígenas são representados em gráficos vetoriais 3D.

https://github.com/JoesCat/xinvaders3d/raw/master/xinvaders3d.jpg https://github.com/JoesCat/xinvaders3d https://github.com/JoesCat/xinvaders3d#readme https://github.com/JoesCat/xinvaders3d/issues digital@joescat.com GPL Don Llopis
JoesCat-xinvaders3d-030b568/desktop/xinvaders3d.xml.in000066400000000000000000000006001506711671200225770ustar00rootroot00000000000000 @make_as_xinvaders3d_fn@ scores JoesCat-xinvaders3d-030b568/effects.c000066400000000000000000000531601506711671200173410ustar00rootroot00000000000000/*------------------------------------------------------------------ effects.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis +Copyright(C) 2023 Jose Da Silva 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 ------------------------------------------------------------------*/ #include "game.h" /*------------------------------------------------------------------ * Stars * * ------------------------------------------------------------------*/ enum stars_enum { MAX_STARS = 100 }; struct STARSSTRUCT { VEC pos; int thrust; unsigned int color; } stars[MAX_STARS]; VEC star_start = { 0.0f, 0.0f, -2000.0f, 1.0f }; VEC star_thrust[4] = { { 0.0f, 0.0f, 50.0f, 1.0f }, { 0.0f, 0.0f, 25.0f, 1.0f }, { 0.0f, 0.0f, 15.0f, 1.0f }, { 0.0f, 0.0f, 10.0f, 1.0f } }; void Stars_init ( void ) { int i, m; for ( i=0; ix1l; x1R = gv->x1r; y1T = gv->y1t; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; if ( gv->pduel ) { if ( gv->phorizontal ) { Draw_line ( x1L, y1B, x1R, y1B, WHITE ); } else if ( gv->pvertical ) { Draw_line ( x1R, y1T, x1R, y1B, WHITE ); } } for ( i=0; ifadjust; if ( stars[i].pos[ZPOS] > -1.0f ) { m = rand() % 4; stars[i].pos[XPOS] = (float)((rand () % 1600) - 800); stars[i].pos[YPOS] = (float)((rand () % 1600) - 800); stars[i].thrust = m; stars[i].color = WHITE - (m*15); stars[i].pos[ZPOS] = -2000.0f; } Matrix_vec_mult ( r1, stars[i].pos, tmp ); Camera_project_point ( tmp, p1 ); if ( gv->pduel ) { Matrix_vec_mult ( r2, stars[i].pos, tmp ); Camera_project_point ( tmp, p2 ); if ( gv->phorizontal ) { p1[1] /= 2; p2[1] = p2[1] / 2 + y2T; } else if ( gv->pvertical ) { p1[0] /= 2; p2[0] = p2[0] / 2 + x2L; } else { p1[0] /= 2; p1[1] /= 2; p2[0] = p2[0] / 2 + x2L; p2[1] = p2[1] / 2 + y2T; } if ( ( p2[0] >= x2L ) && ( p2[1] >= y2T ) ) Draw_point ( p2[0], p2[1], stars[i].color ); } if ( ( p1[0] < x1R ) && ( p1[1] < y1B ) ) Draw_point ( p1[0], p1[1], stars[i].color ); } } /*------------------------------------------------------------------ * Explosions * * ------------------------------------------------------------------*/ #define EXPLOSION_ROT 0.23f enum explosions_enum { MAX_EXPLOSIONS = 10, MAX_PARTICLES = 4, EXPLOSIONS_LIFE = 1500, /* 1.5 sec */ EXPLOSION_BLEND_TIME = 375, /* 0.375 sec */ EXPLOSION_COLOR_INC = 15 }; struct EXPLOSIONSTRUCT { VEC pos[MAX_PARTICLES]; int thrust[MAX_PARTICLES]; long frame; long blend; int color; int active; } explosions[MAX_EXPLOSIONS]; static int ecur; /* EXPLOSION index */ static int ecount; /* EXPLOSION count */ static int pcur; /* THURST index */ static float erot; /* EXPLOSIONS rotation */ /* shard/particle thrust vectors */ VEC pthrust[8] = { {-2.0f, 0.0f, 0.0f, 1.0f}, {0.0f, -2.0f, 0.0f, 1.0f}, {2.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 2.0f, 0.0f, 1.0f}, {-2.0f, 2.0f, 0.0f, 1.0f}, {2.0f, -2.0f, 0.0f, 1.0f}, {-2.0f, -2.0f, 0.0f, 1.0f}, {2.0f, 2.0f, 0.0f, 1.0f} }; VEC shard[3] = { {-5.0f, 0.0f, 0.0f, 1.0f}, { 0.0f, 5.0f, 0.0f, 1.0f}, { 5.0f, -5.0f, 0.0f, 1.0f} }; void Explosions_clear ( void ) { int i, j; ecur = 0; ecount = 0; pcur = 0; erot = 0.0f; for ( i=0; ipos, explosions[ecur].pos[0] ); Vector_copy ( obj->pos, explosions[ecur].pos[1] ); Vector_copy ( obj->pos, explosions[ecur].pos[2] ); Vector_copy ( obj->pos, explosions[ecur].pos[3] ); explosions[ecur].thrust[0] = pcur; explosions[ecur].thrust[1] = pcur+1; explosions[ecur].thrust[2] = pcur+2; explosions[ecur].thrust[3] = pcur+3; ecur++; pcur += 4; ecount++; if ( ecur > MAX_EXPLOSIONS-1 ) ecur = 0; if ( pcur == 8 ) pcur = 0; } void Explosions_draw ( MAT r1, MAT r2) { int i, j, k, p1[6], p2[6]; int x1R, y1B, x2L, y2T; VEC tmp[3], shard_tmp[3]; MAT tmp_mat, tmp_mat2, erot_mat; x1R = gv->x1r; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; erot += EXPLOSION_ROT * gv->fadjust; Matrix_x_rot ( tmp_mat, erot ); Matrix_z_rot ( tmp_mat2, erot ); Matrix_mult ( tmp_mat, tmp_mat2, erot_mat ); Matrix_vec_multn ( erot_mat, shard, shard_tmp, 3 ); for ( i=0; imsec; if ( explosions[i].frame > EXPLOSIONS_LIFE ) { explosions[i].active = FALSE; ecount--; } explosions[i].blend += gv->msec; if ( explosions[i].blend > EXPLOSION_BLEND_TIME ) { explosions[i].blend -= EXPLOSION_BLEND_TIME; explosions[i].color -= EXPLOSION_COLOR_INC; } for ( j=0; jfadjust; explosions[i].pos[j][YPOS] += pthrust[k][YPOS] * gv->fadjust; explosions[i].pos[j][ZPOS] += pthrust[k][ZPOS] * gv->fadjust; Matrix_vec_mult ( r1, explosions[i].pos[j], tmp[0] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, shard_tmp, tmp, 3 ); Camera_project_points ( tmp, p1, 3 ); if ( gv->pduel ) { Matrix_vec_mult ( r2, explosions[i].pos[j], tmp[0] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, shard_tmp, tmp, 3 ); Camera_project_points ( tmp, p2, 3 ); if ( gv->phorizontal ) { p1[1] /= 2; p1[3] /= 2; p1[5] /= 2; p2[1] = p2[1] / 2 + y2T; p2[3] = p2[3] / 2 + y2T; p2[5] = p2[5] / 2 + y2T; } else if ( gv->pvertical ) { p1[0] /= 2; p1[2] /= 2; p1[4] /= 2; p2[0] = p2[0] / 2 + x2L; p2[2] = p2[2] / 2 + x2L; p2[4] = p2[4] / 2 + x2L; } else { p1[0] /= 2; p1[2] /= 2; p1[4] /= 2; p2[0] = p2[0] / 2 + x2L; p2[2] = p2[2] / 2 + x2L; p2[4] = p2[4] / 2 + x2L; p1[1] /= 2; p1[3] /= 2; p1[5] /= 2; p2[1] = p2[1] / 2 + y2T; p2[3] = p2[3] / 2 + y2T; p2[5] = p2[5] / 2 + y2T; } if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], explosions[i].color ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], explosions[i].color ); if ( p2[4] >= x2L && p2[0] >= x2L && \ p2[5] >= y2T && p2[1] >= y2T ) Draw_line ( p2[4], p2[5], p2[0], p2[1], explosions[i].color ); } if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], explosions[i].color ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], explosions[i].color ); if ( p1[4] < x1R && p1[0] < x1R && \ p1[5] < y1B && p1[1] < y1B ) Draw_line ( p1[4], p1[5], p1[0], p1[1], explosions[i].color ); } } } } /*------------------------------------------------------------------ * Jump-gate * * ------------------------------------------------------------------*/ enum jumpgate_enum { MAX_JUMPGATES = 4, JUMPGATE_TIME = 10000, JUMPGATE_ANIM = 250, JUMPGATE_FRAMES = 3 }; struct JUMPGATESTRUCT { int active; long time; long anim; long frame; int dir; VEC pos; } jgates[MAX_JUMPGATES]; static int jgcur; /* JUMPGATE index */ static int jcount; /* JUMPGATE counter */ static VEC jgvert[32] = { {-10.0f, 0.0f, 10.0f, 1.0f}, {-0.0f, 10.0f, -10.0f, 1.0f}, {10.0f, 0.0f, -10.0f, 1.0f}, {0.0f, -10.0f, 10.0f, 1.0f}, {-30.0f, 0.0f, 30.0f, 1.0f}, {0.0f, 30.0f, -30.0f, 1.0f}, {30.0f, 0.0f, -30.0f, 1.0f}, {0.0f, -30.0f, 30.0f, 1.0f}, {-50.0f, 0.0f, 50.0f, 1.0f}, {0.0f, 50.0f, -50.0f, 1.0f}, {50.0f, 0.0f, -50.0f, 1.0f}, {0.0f, -50.0f, 50.0f, 1.0f}, {-70.0f, 0.0f, 70.0f, 1.0f}, {0.0f, 70.0f, -70.0f, 1.0f}, {70.0f, 0.0f, -70.0f, 1.0f}, {0.0f, -70.0f, 70.0f, 1.0f}, {-10.0f, 0.0f, -10.0f, 1.0f}, {0.0f, 10.0f, 10.0f, 1.0f}, {10.0f, 0.0f, 10.0f, 1.0f}, {0.0f, -10.0f, -10.0f, 1.0f}, {-30.0f, 0.0f, -30.0f, 1.0f}, {0.0f, 30.0f, 30.0f, 1.0f}, {30.0f, 0.0f, 30.0f, 1.0f}, {0.0f, -30.0f, -30.0f, 1.0f}, {-50.0f, 0.0f, -50.0f, 1.0f}, {0.0f, 50.0f, 50.0f, 1.0f}, {50.0f, 0.0f, 50.0f, 1.0f}, {0.0f, -50.0f, -50.0f, 1.0f}, {-70.0f, 0.0f, -70.0f, 1.0f}, {0.0f, 70.0f, 70.0f, 1.0f}, {70.0f, 0.0f, 70.0f, 1.0f}, {0.0f, -70.0f, -70.0f, 1.0f} }; void Jumpgate_init ( void ) { int i; for ( i=0; i MAX_JUMPGATES-1 ) return; jgates[jgcur].active = TRUE; jgates[jgcur].time = 0; jgates[jgcur].anim = 0; jgates[jgcur].frame = 0; jgates[jgcur].dir = dir * 16; Vector_copy ( pos, jgates[jgcur].pos ); jgcur++; if ( jgcur > MAX_JUMPGATES-1 ) jgcur = 0; jcount++; } void Jumpgate_animate ( MAT r1, MAT r2 ) { MAT tmp_mat; VEC tmp[16]; int i, j, p1[32], p2[32], f0; int x1R, y1B, x2L, y2T; x1R = gv->x1r; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; for ( i=0; imsec; jgates[i].anim += gv->msec; if ( jgates[i].anim > JUMPGATE_ANIM ) { jgates[i].anim -= JUMPGATE_ANIM; jgates[i].frame += 1; if ( jgates[i].frame > JUMPGATE_FRAMES ) jgates[i].frame = 0; } if ( jgates[i].time > JUMPGATE_TIME ) { jgates[i].active = FALSE; jcount--; } /* draw jumpgate */ Matrix_vec_mult ( r1, jgates[i].pos, tmp[0] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); f0 = ( jgates[i].frame + 1 ) * 4; Matrix_vec_multn ( tmp_mat, &jgvert[jgates[i].dir], tmp, f0 ); Camera_project_points ( tmp, p1, f0 ); if ( gv->pduel ) { Matrix_vec_mult ( r2, jgates[i].pos, tmp[0] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); f0 = ( jgates[i].frame + 1 ) * 4; Matrix_vec_multn ( tmp_mat, &jgvert[jgates[i].dir], tmp, f0 ); Camera_project_points ( tmp, p2, f0 ); for ( j=0; j<((f0*2)-4); j+=8 ) { if ( gv->phorizontal ) { p1[1+j] /= 2; p1[3+j] /= 2; p1[5+j] /= 2; p1[7+j] /= 2; p2[1+j] = p2[1+j] / 2 + y2T; p2[3+j] = p2[3+j] / 2 + y2T; p2[5+j] = p2[5+j] / 2 + y2T; p2[7+j] = p2[7+j] / 2 + y2T; } else if ( gv->pvertical ) { p1[0+j] /= 2; p1[2+j] /= 2; p1[4+j] /= 2; p1[6+j] /= 2; p2[0+j] = p2[0+j] / 2 + x2L; p2[2+j] = p2[2+j] / 2 + x2L; p2[4+j] = p2[4+j] / 2 + x2L; p2[6+j] = p2[6+j] / 2 + x2L; } else { p1[0+j] /= 2; p1[2+j] /= 2; p1[4+j] /= 2; p1[6+j] /= 2; p2[0+j] = p2[0+j] / 2 + x2L; p2[2+j] = p2[2+j] / 2 + x2L; p2[4+j] = p2[4+j] / 2 + x2L; p2[6+j] = p2[6+j] / 2 + x2L; p1[1+j] /= 2; p1[3+j] /= 2; p1[5+j] /= 2; p1[7+j] /= 2; p2[1+j] = p2[1+j] / 2 + y2T; p2[3+j] = p2[3+j] / 2 + y2T; p2[5+j] = p2[5+j] / 2 + y2T; p2[7+j] = p2[7+j] / 2 + y2T; } if ( p2[0+j] >= x2L && p2[2+j] >= x2L && \ p2[1+j] >= y2T && p2[3+j] >= y2T ) Draw_line ( p2[0+j], p2[1+j], p2[2+j], p2[3+j], GREEN ); if ( p2[2+j] >= x2L && p2[4+j] >= x2L && \ p2[3+j] >= y2T && p2[5+j] >= y2T ) Draw_line ( p2[2+j], p2[3+j], p2[4+j], p2[5+j], GREEN ); if ( p2[4+j] >= x2L && p2[6+j] >= x2L && \ p2[5+j] >= y2T && p2[7+j] >= y2T ) Draw_line ( p2[4+j], p2[5+j], p2[6+j], p2[7+j], GREEN ); if ( p2[6+j] >= x2L && p2[0+j] >= x2L && \ p2[7+j] >= y2T && p2[1+j] >= y2T ) Draw_line ( p2[6+j], p2[7+j], p2[0+j], p2[1+j], GREEN ); } } for ( j=0; j<((f0*2)-4); j+=8 ) { if ( p1[0+j] < x1R && p1[2+j] < x1R && \ p1[1+j] < y1B && p1[3+j] < y1B ) Draw_line ( p1[0+j], p1[1+j], p1[2+j], p1[3+j], GREEN ); if ( p1[2+j] < x1R && p1[4+j] < x1R && \ p1[3+j] < y1B && p1[5+j] < y1B ) Draw_line ( p1[2+j], p1[3+j], p1[4+j], p1[5+j], GREEN ); if ( p1[4+j] < x1R && p1[6+j] < x1R && \ p1[5+j] < y1B && p1[7+j] < y1B ) Draw_line ( p1[4+j], p1[5+j], p1[6+j], p1[7+j], GREEN ); if ( p1[6+j] < x1R && p1[0+j] < x1R && \ p1[7+j] < y1B && p1[1+j] < y1B ) Draw_line ( p1[6+j], p1[7+j], p1[0+j], p1[1+j], GREEN ); } } } } /*------------------------------------------------------------------ * One-up!!! * * ------------------------------------------------------------------*/ enum oneup_enum { ONEUP_LIFE = 2000, ONEUP_BLEND_TIME = 200 }; struct ONEUPSTRUCT { VEC pos; long frame; long blend; long color; int active; }one_up; static VEC one_up_vert[10] = { {-40.0f, 20.0f, 0.0f, 1.0f} , /* 1 */ {-40.0f, -20.0f, 0.0f, 1.0f }, {-20.0f, 20.0f, 0.0f, 1.0f }, /* U */ {-20.0f, -20.0f, 0.0f, 1.0f }, { 10.0f, -20.0f, 0.0f, 1.0f }, { 10.0f, 20.0f, 0.0f, 1.0f }, { 20.0f, 20.0f, 0.0f, 1.0f }, /* P */ { 20.0f, -20.0f, 0.0f, 1.0f }, { 60.0f, 0.0f, 0.0f, 1.0f }, { 20.0f, 0.0f, 0.0, 1.0f } }; static VEC oneup_thrust = { 0.0f, 0.0f, 10.0f, 1.0f }; void One_up_init ( void ) { one_up.active = FALSE; } void One_up_add ( OBJECT *obj ) { if ( one_up.active == FALSE ) { one_up.active = TRUE; Vector_copy ( obj->pos, one_up.pos ); one_up.frame = 0; one_up.blend = 0; one_up.color = WHITE; } } void One_up_draw ( MAT r1, MAT r2 ) { int p1[20], p2[20]; int i, x1R, y1B, x2L, y2T; VEC tmp[10]; MAT tmp_mat; x1R = gv->x1r; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; if ( one_up.active ) { one_up.pos[ZPOS] += oneup_thrust[ZPOS] * gv->fadjust; if ( one_up.pos[ZPOS] > -50.0f ) one_up.active = FALSE; one_up.frame += gv->msec; if ( one_up.frame > ONEUP_LIFE ) { one_up.active = FALSE; } one_up.blend += gv->msec; if ( one_up.blend > ONEUP_BLEND_TIME ) { one_up.blend -= ONEUP_BLEND_TIME; one_up.color -= 3; } /* draw one_up */ Matrix_vec_mult ( r1, one_up.pos, tmp[0] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, one_up_vert, tmp, 10 ); Camera_project_points ( tmp, p1, 10 ); if ( gv->pduel ) { /* draw one_up */ Matrix_vec_mult ( r2, one_up.pos, tmp[0] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, one_up_vert, tmp, 10 ); Camera_project_points ( tmp, p2, 10 ); if ( gv->phorizontal ) { for ( i = 1; i < 20; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } else if ( gv->pvertical ) { for ( i = 0; i < 20; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } } else { for ( i = 0; i < 20; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } for ( i = 1; i < 20; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], one_up.color ); if ( p2[4] >= x2L && p2[6] >= x2L && \ p2[5] >= y2T && p2[7] >= y2T ) Draw_line ( p2[4], p2[5], p2[6], p2[7], one_up.color ); if ( p2[6] >= x2L && p2[8] >= x2L && \ p2[7] >= y2T && p2[9] >= y2T ) Draw_line ( p2[6], p2[7], p2[8], p2[9], one_up.color ); if ( p2[8] >= x2L && p2[10] >= x2L && \ p2[9] >= y2T && p2[11] >= y2T ) Draw_line ( p2[8], p2[9], p2[10], p2[11], one_up.color ); if ( p2[12] >= x2L && p2[14] >= x2L && \ p2[13] >= y2T && p2[15] >= y2T ) Draw_line ( p2[12], p2[13], p2[14], p2[15], one_up.color ); if ( p2[12] >= x2L && p2[13] >= x2L && \ p2[13] >= y2T && p2[17] >= y2T ) Draw_line ( p2[12], p2[13], p2[16], p2[17], one_up.color ); if ( p2[16] >= x2L && p2[18] >= x2L && \ p2[17] >= y2T && p2[19] >= y2T ) Draw_line ( p2[16], p2[17], p2[18], p2[19], one_up.color ); } /* draw 1 */ if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], one_up.color ); /* draw U */ if ( p1[4] < x1R && p1[6] < x1R && \ p1[5] < y1B && p1[7] < y1B ) Draw_line ( p1[4], p1[5], p1[6], p1[7], one_up.color ); if ( p1[6] < x1R && p1[8] < x1R && \ p1[7] < y1B && p1[9] < y1B ) Draw_line ( p1[6], p1[7], p1[8], p1[9], one_up.color ); if ( p1[8] < x1R && p1[10] < x1R && \ p1[9] < y1B && p1[11] < y1B ) Draw_line ( p1[8], p1[9], p1[10], p1[11], one_up.color ); /* draw P */ if ( p1[12] < x1R && p1[14] < x1R && \ p1[13] < y1B && p1[15] < y1B ) Draw_line ( p1[12], p1[13], p1[14], p1[15], one_up.color ); if ( p1[12] < x1R && p1[13] < x1R && \ p1[13] < y1B && p1[17] < y1B ) Draw_line ( p1[12], p1[13], p1[16], p1[17], one_up.color ); if ( p1[16] < x1R && p1[18] < x1R && \ p1[17] < y1B && p1[19] < y1B ) Draw_line ( p1[16], p1[17], p1[18], p1[19], one_up.color ); } } JoesCat-xinvaders3d-030b568/externs.h000066400000000000000000000062721506711671200174210ustar00rootroot00000000000000/*------------------------------------------------------------------ externs.h: Global Game Variables XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ /* general game variables */ typedef struct GAMEVARSSTRUCT GAMEVARS; struct GAMEVARSSTRUCT { /* obj pointers for rendering */ OBJECT *gobjs[MAX_OBJECTS]; int gobjcount; double fps; /* frames per second */ double ftime; /* frame-time in milliseconds as double */ double fadjust; /* frame-time adjust = rfps / ftime */ long msec; /* frame-time in milliseconds as int */ long fcount; /* frames rendered */ double rfps; /* reference frames per second */ double fpsavg; /* just an approx running fps average */ int fpsfast; /* count-down, we consider fast if zero */ long sw_t; /* stop-watch current # of seconds */ long sw_save; /* stop-watch pause */ long win_width; long win_height; int key_QUIT; int key_UP1; int key_DOWN1; int key_LEFT1; int key_RIGHT1; int key_FIRE1; int key_1PLAYER; int key_DUELPLAY; int key_DUELPLAY_H; int key_DUELPLAY_V; int key_UP2; int key_DOWN2; int key_LEFT2; int key_RIGHT2; int key_FIRE2; /* */ int formation_zone; int ufo_zone; int alien_count; /* flags */ int display_fps; int paused; int gameover; int new_level; int intro_done; long hi_score; long pscore1; /* player's current score */ long pscore2; long pbonus1; /* player bonus counter */ long pbonus2; int plives1; /* player's current # of lives */ int plives2; int pblink1; /* player invunerable */ int pblink2; int pduel; /* one players, or player duel */ int pfocus; /* player focus 0 or 1 */ int phorizontal; int pvertical; int *hi_score_c[20]; int *pscore_c1[20]; int *pscore_c2[20]; int x1l, x1r, y1t, y1b, x2l, x2r, y2t, y2b; }; /* game.c */ extern GAMEVARS gvars, *gv; /* arrays for both 'about' and 'rules'. Null-terminated so that code to handle them only has to be written once. TBB 1.22 */ extern char *game_about_info[]; extern char *game_rules_info[]; /* timer.c : timer(s) */ extern TIMER gtimer, *gt; /* player.c : the player(s) */ extern OBJECT *player1, *player2; extern OBJECT *pm1, *pm2; /* alien.c : the aliens, bombs, and ufo */ extern OBJECT *ufo; extern OBJECT the_formation; extern OBJLIST *af_list; extern OBJLIST *abombs; JoesCat-xinvaders3d-030b568/game.c000066400000000000000000000763331506711671200166420ustar00rootroot00000000000000/*------------------------------------------------------------------ game.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis +Copyright(C) 2023 Jose Da Silva 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 ------------------------------------------------------------------*/ #include "game.h" #include "gtext.h" #include #define SW_UPDATE gv->sw_t += gv->msec #define SW_PAUSE gv->sw_save = gv->sw_t #define SW_UNPAUSE gv->sw_t = gv->sw_save #define SW_RESET gv->sw_t = gv->sw_save = 0 static VEC cam_up = { 0.0f, 1.0f, 0.0f, 1.0f }; static VEC cam_from = { 0.0f, 0.0f, 100.0f, 1.0f }; static VEC cam_at = { 0.0f, 0.0f, 0.0f, 1.0f }; static void Add_obj_2_world ( OBJECT * ); static void Clear_obj_list ( void ); static void Sort_obj_list ( void ); static void Draw_obj_list ( MAT, MAT ); static int Z_compare ( const void *obj0, const void *obj1 ); static float Dist_pt_2_line ( VEC p, VEC l0, VEC l1 ); static void Draw_vector_font ( int *s[], int x, int y, unsigned int color ); /*------------------------------------------------------------------ * Variables ------------------------------------------------------------------*/ GAMEVARS gvars, *gv; TIMER gtimer, *gt; static long score_table[ZONE_HEIGHT_MAX] = { 10L, 50L, 100L, 150L, 200L }; /*================================================================*/ static void Game_scores ( long new_score, int focus ) { int i; char buffer[256], tmp_num[2]; if ( focus ) { if ( new_score > gv->pscore2 ) { gv->pscore2 = new_score; /* convert hi-score into a vector-font */ sprintf ( buffer, "%ld", new_score ); tmp_num[0] = '0'; tmp_num[1] = '\0'; for ( i = 0; buffer[i]; i++ ) { tmp_num[0] = buffer[i]; gv->pscore_c2[i] = NUMBER[atoi(tmp_num)]; } gv->pscore_c2[i] = NULL; } } else { /* let's reserve hi_score for lone defender */ if ( gv->pduel == 0 && new_score > gv->hi_score ) { gv->hi_score = new_score; sprintf ( buffer, "%ld", new_score ); tmp_num[0] = '0'; tmp_num[1] = '\0'; for ( i = 0; buffer[i]; i++ ) { tmp_num[0] = buffer[i]; gv->hi_score_c[i] = NUMBER[atoi(tmp_num)]; } gv->hi_score_c[i] = NULL; } if ( new_score > gv->pscore1 ) { gv->pscore1 = new_score; /* convert hi-score into a vector-font */ sprintf ( buffer, "%ld", new_score ); tmp_num[0] = '0'; tmp_num[1] = '\0'; for ( i = 0; buffer[i]; i++ ) { tmp_num[0] = buffer[i]; gv->pscore_c1[i] = NUMBER[atoi(tmp_num)]; } gv->pscore_c1[i] = NULL; } } } static void Game_scores_draw ( void ) { if ( gv->pduel ) { if ( gv->phorizontal ) { Draw_vector_font ( SCORE, 30, 8, RED ); Draw_vector_font ( gv->pscore_c1, 210, 8, RED ); Draw_vector_font ( SCORE, 30, 248, GREEN ); Draw_vector_font ( gv->pscore_c2, 210, 248, GREEN ); } else if ( gv->pvertical ) { Draw_vector_font ( SCORE, 30, 8, RED ); Draw_vector_font ( gv->pscore_c1, 30, 48, RED ); Draw_vector_font ( SCORE, 350, 8, GREEN ); Draw_vector_font ( gv->pscore_c2, 350, 48, GREEN ); } else { Draw_vector_font ( SCORE, 30, 8, RED ); Draw_vector_font ( gv->pscore_c1, 30, 48, RED ); Draw_vector_font ( SCORE, 350, 248, GREEN ); Draw_vector_font ( gv->pscore_c2, 350, 288, GREEN ); } } else { Draw_vector_font ( SCORE, 150, 14, GREEN ); Draw_vector_font ( gv->pscore_c1, 330, 14, GREEN ); } } /*================================================================*/ void Game_main ( void ) { while ( Handle_events() ) { /* get start-time of current frame */ gv->msec = Timer_msec ( gt ); gv->ftime = (double)gv->msec/1000L; gv->fps = 1.0 / gv->ftime; gv->fadjust = gv->rfps / gv->fps; (*Game_actionfn)(); Update_display (); /* let game sleep for about 10msec */ if ( gv->fpsfast ) { gv->fpsavg = ( gv->fpsavg + gv->fps ) / 2; if ( gv->fpsavg > 100 ) gv->fpsfast--; } else usleep(10000); } } /*================================================================*/ void (*Game_actionfn) (); /*================================================================*/ int Game_init ( float win_width, float win_height ) { /* initialize variables and timers */ gv = &gvars; gv->win_width = (long)win_width; gv->win_height = (long)win_height; gv->pduel = gv->phorizontal = gv->pvertical = 0; gv->x1l = gv->y1t = 0; gv->x1r = (int)gv->win_width; gv->y1b = (int)gv->win_height; Game_init_vars ( INITGAME ); Game_init_keys (); Stars_init (); Jumpgate_init (); Camera_init ( win_width, win_height, 0.785398163 ); gt = >imer; Timer_init( gt ); /* setup stopwatch timer and run menu */ SW_RESET; Game_actionfn = Game_menu; return TRUE; } /*================================================================*/ void Game_init_vars ( int init_type ) { switch ( init_type ) { case INITGAME: gv->rfps = REFERENCE_FRAMERATE; gv->display_fps = FALSE; gv->fpsavg = -1000000; gv->fpsfast = 1000; gv->pscore1 = 0; gv->hi_score = -1; Game_scores ( HISCORE, 0 ); case NEWGAME: gv->paused = FALSE; gv->gameover = FALSE; gv->pscore2 = -1; Game_scores ( 0, 1 ); gv->pscore1 = -1; Game_scores ( 0, 0 ); gv->pbonus1 = gv->pbonus2 = 0; gv->plives1 = gv->plives2 = PLAYER_LIVES_START; case NEWLEVEL: gv->fcount = 0; gv->msec = 0; gv->ftime = 0.0; gv->fps = 0.0; gv->fadjust = 0.0; gv->new_level = FALSE; gv->pfocus = 0; default: break; } } /*================================================================*/ void Game_init_keys ( void ) { gv->key_QUIT = FALSE; gv->key_FIRE1 = FALSE; gv->key_UP1 = FALSE; gv->key_DOWN1 = FALSE; gv->key_LEFT1 = FALSE; gv->key_RIGHT1 = FALSE; gv->key_1PLAYER = FALSE; gv->key_DUELPLAY_H = FALSE; gv->key_DUELPLAY_V = FALSE; gv->key_DUELPLAY = FALSE; gv->key_FIRE2 = FALSE; gv->key_UP2 = FALSE; gv->key_DOWN2 = FALSE; gv->key_LEFT2 = FALSE; gv->key_RIGHT2 = FALSE; } /*================================================================*/ void Game_newlevel ( void ) { srand ( time( NULL ) ); Game_init_vars ( NEWLEVEL ); Game_init_keys (); Stars_init (); Explosions_clear (); Jumpgate_init (); One_up_init (); Player_init ( 0 ); Player_init ( 1 ); Aliens_init (); SW_RESET; Game_actionfn = Game_ready; } /*================================================================*/ void Game_menu ( void ) { static int blink = 0; static int color = 0; int i; MAT cam_mat; Camera_transform ( cam_mat, cam_up, cam_from, cam_at, 0 ); Stars_draw ( cam_mat, cam_mat ); if ( gv->pduel ) Game_scores_draw (); else { Draw_vector_font ( HI_SCORE, 120, 15, GREEN ); Draw_vector_font ( gv->hi_score_c, 360, 15, GREEN ); } blink += gv->msec; if ( blink > 250 ) { color++; blink -= 250; if ( color > 3 ) color = 0; } i = RED - ( color * 15 ); Draw_vector_font ( XINVADERS3D_LOGO, 160, 150, GREEN ); Draw_vector_font ( PRESS, 40, 400, i ); Draw_vector_font ( FIRE, 220, 400, i ); Draw_vector_font ( TO, 370, 400, i ); Draw_vector_font ( START, 460, 400, i ); if ( gv->key_FIRE1 || ( gv->pduel && gv->key_FIRE2 ) ) { Game_actionfn = Game_newlevel; } if ( gv->key_1PLAYER ) { gv->pduel = gv->phorizontal = gv->pvertical = 0; gv->x1l = -(int)(gv->win_width); /* let x11 chop this */ gv->y1t = -(int)(gv->win_height); /* let x11 chop this */ gv->x1r = (int)(gv->win_width)*2; /* let x11 chop this */ gv->y1b = (int)(gv->win_height)*2; /* let x11 chop this */ } else if ( gv->key_DUELPLAY_H ) { gv->pduel = gv->phorizontal = 1; gv->pvertical = 0; gv->x1l = -(int)(gv->win_width); /* let x11 chop this */ gv->y1t = -(int)(gv->win_height); /* let x11 chop this */ gv->x1r = (int)(gv->win_width)*2; /* let x11 chop this */ gv->y1b = (int)(gv->win_height)/2; gv->x2l = -(int)(gv->win_width); /* let x11 chop this */ gv->y2t = (int)(gv->win_height)/2 + 1; gv->x2r = (int)(gv->win_width)*2; /* let x11 chop this */ gv->y2b = (int)(gv->win_height)*2; /* let x11 chop this */ } else if ( gv->key_DUELPLAY_V ) { gv->pduel = gv->pvertical = 1; gv->phorizontal = 0; gv->x1l = -(int)(gv->win_width); /* let x11 chop this */ gv->y1t = -(int)(gv->win_height); /* let x11 chop this */ gv->x1r = (int)(gv->win_width)/2; gv->y1b = (int)(gv->win_height)*2; /* let x11 chop this */ gv->x2l = (int)(gv->win_width)/2 + 1; gv->y2t = -(int)(gv->win_height); /* let x11 chop this */ gv->x2r = (int)(gv->win_width)*2; /* let x11 chop this */ gv->y2b = (int)(gv->win_height)*2; /* let x11 chop this */ } else if ( gv->key_DUELPLAY ) { gv->pduel = 1; gv->phorizontal = gv->pvertical = 0; gv->x1l = -(int)(gv->win_width); /* let x11 chop this */ gv->y1t = -(int)(gv->win_height); /* let x11 chop this */ gv->x1r = (int)(gv->win_width)/2; gv->y1b = (int)(gv->win_height)/2; gv->x2l = (int)(gv->win_width)/2 + 1; gv->y2t = (int)(gv->win_height)/2 + 1; gv->x2r = (int)(gv->win_width)*2; /* let x11 chop this */ gv->y2b = (int)(gv->win_height)*2; /* let x11 chop this */ } } /*================================================================*/ void Game_ready ( void ) { static int blink = 0; static int color = 0; int i; MAT cam_mat; Camera_transform ( cam_mat, cam_up, cam_from, cam_at, 0 ); Stars_draw ( cam_mat, cam_mat ); blink += gv->msec; if ( blink > 250 ) { blink -= 250; color++; if ( color == 3 ) color = 0; } i = RED - ( color * 15 ); Draw_vector_font ( GET, 140, 200, i ); Draw_vector_font ( READY, 260, 200, i ); Game_overlay (); SW_UPDATE; if ( gv->key_FIRE1 || gv->sw_t > READY_TIME || \ ( gv->pduel && gv->key_FIRE2 ) ) { SW_RESET; Game_actionfn = Game_run; } } /*================================================================*/ void Game_paused_toggle ( void ) { static void (*saved_action_fn)( void ) = NULL; gv->paused ^= TRUE; if ( gv->paused ) { SW_PAUSE; saved_action_fn = Game_actionfn; Game_actionfn = Game_paused; } else { SW_UNPAUSE; Game_actionfn = saved_action_fn; } } void Game_paused ( void ) { MAT cam_mat; Camera_transform ( cam_mat, cam_up, cam_from, cam_at, 0 ); Stars_draw ( cam_mat, cam_mat ); Draw_vector_font ( PAUSED, 230, 200, RED ); Game_overlay (); SW_UPDATE; } /*================================================================*/ void Game_reset ( void ) { SW_RESET; Game_init_vars ( INITGAME ); Game_init_keys (); Game_actionfn = Game_menu; } void Game_gameover ( void ) { MAT cam_mat1, cam_mat2; Camera_transform ( cam_mat1, cam_up, cam_from, cam_at, 0 ); Camera_transform ( cam_mat2, cam_up, cam_from, cam_at, 1 ); Stars_draw ( cam_mat1, cam_mat2 ); Draw_vector_font ( GAME, 185, 200, RED ); Draw_vector_font ( OVER, 335, 200, RED ); Game_overlay (); SW_UPDATE; if ( gv->key_FIRE1 || gv->sw_t > GAMEOVER_TIME || \ ( gv->pduel && gv->key_FIRE2 ) ) { SW_RESET; Game_init_vars ( NEWGAME ); Game_init_keys (); Game_actionfn = Game_menu; } } /*================================================================*/ void Game_overlay ( void ) { char buffer[256]; int i, x, x1, x2, y1, y2; int life[6] = { 0, 25, 25, 25, 12, 0 }; Game_scores_draw (); if ( gv->display_fps ) { if ( gv->ftime > 0.0f ) { sprintf ( buffer, "FPS:%3.0f:(%1.3f):ms(%ld)", gv->fps, \ gv->fadjust,gv->msec ); } else sprintf ( buffer, "FPS: n/a" ); Draw_text ( buffer, 0, 475, RED ); } x1 = x2 = 0; y1 = y2 = 425; if ( gv->pduel ) { if ( gv->phorizontal ) y1 -= 240; else if ( gv->pvertical ) x2 += 320; else { x2 += 320; y1 -= 240; } if ( gv->plives2 > 1 ) { for ( i = 0, x = 15+x2; i < (gv->plives2-1); i++ ) { Draw_line ( life[0]+x, life[1]+y2, life[2]+x, life[3]+y2, GREEN ); Draw_line ( life[2]+x, life[3]+y2, life[4]+x, life[5]+y2, GREEN ); Draw_line ( life[4]+x, life[5]+y2, life[0]+x, life[1]+y2, GREEN ); x+= 30; } #ifdef GAME_DEBUG sprintf ( buffer, "Lives: %d", gv->plives2-1 ); Draw_text ( buffer, x2+230, y2+45, GREEN ); #endif } } if ( gv->plives1 > 1 ) { for ( i = 0, x = 15; i < (gv->plives1-1); i++ ) { Draw_line ( life[0]+x, life[1]+y1, life[2]+x, life[3]+y1, GREEN ); Draw_line ( life[2]+x, life[3]+y1, life[4]+x, life[5]+y1, GREEN ); Draw_line ( life[4]+x, life[5]+y1, life[0]+x, life[1]+y1, GREEN ); x+= 30; } #ifdef GAME_DEBUG sprintf ( buffer, "Lives: %d", gv->plives1-1 ); Draw_text ( buffer, 550-x2, y1+45, GREEN ); #endif } #ifdef GAME_DEBUG sprintf ( buffer, "Time: %10.0fs", (double)gv->sw_t/1000); Draw_text ( buffer, 0, 470, RED ); if ( gv->pduel ) sprintf ( buffer, "U:%d D:%d L:%d R:%d F:%d - U:%d D:%d L:%d R:%d F:%d", \ gv->key_UP1, gv->key_DOWN1, gv->key_LEFT1, gv->key_RIGHT1, \ gv->key_FIRE1, gv->key_UP2, gv->key_DOWN2, gv->key_LEFT2, \ gv->key_RIGHT2, gv->key_FIRE2 ); else sprintf ( buffer, "U: %d D: %d L: %d R: %d F: %d", \ gv->key_UP1, gv->key_DOWN1, gv->key_LEFT1, gv->key_RIGHT1, \ gv->key_FIRE1 ); Draw_text ( buffer, 200, 470, WHITE ); #endif } /*================================================================*/ void Game_run ( void ) { float dist = 0.0f; OBJECT *alien1, *alien2, *abomb; VEC up1 = { 0.0f, 1.0f, 0.0f, 1.0f }; VEC from1 = { 0.0f, 25.0f, 100.0f, 1.0f }; VEC at1 = { 0.0f, 0.0f, -100.0f, 1.0f }; VEC up2 = { 0.0f, 1.0f, 0.0f, 1.0f }; VEC from2 = { 0.0f, 25.0f, 100.0f, 1.0f }; VEC at2 = { 0.0f, 0.0f, -100.0f, 1.0f }; MAT cam_mat1, cam_mat2; int hit1, hit2; /* prepare for new frame */ Clear_obj_list (); /* update-player1 */ if ( player1->active ) player1->actionfn ( player1 ); /* update camera1 */ Vector_addd ( from1, player1->pos ); Vector_addd ( at1, player1->pos ); Camera_transform ( cam_mat1, up1, from1, at1, 0 ); if ( gv->pduel ) { /* update-player2 */ if ( player2->active ) player2->actionfn ( player2 ); /* update camera2 */ Vector_addd ( from2, player2->pos ); Vector_addd ( at2, player2->pos ); Camera_transform ( cam_mat2, up2, from2, at2, 1 ); } /* Do collisions checking : test player_missile(s) vs aliens */ hit1 = hit2 = 0; if ( pm1->active && pm1->zone == gv->formation_zone && \ pm1->zheight > -1 && pm1->zheight < ZONE_HEIGHT_MAX ) { hit1 = 1; /* if so which height-level?? */ alien1 = (af_list+pm1->zheight)->head; } if ( gv->pduel && \ pm2->active && pm2->zone == gv->formation_zone && \ pm2->zheight > -1 && pm2->zheight < ZONE_HEIGHT_MAX ) { hit2 = 1; alien2 = (af_list+pm2->zheight)->head; } if ( hit1 && hit2 && alien1 == alien2 ) { /* * slim posibility that both players will hit the same aliens, * so we need to check each player's missile vs each alien. */ while ( alien1 ) { hit1 = hit2 = 0; dist = Dist_pt_2_line ( alien1->pos, pm1->old_pos, pm1->pos ) - \ pm1->radius_squared - 1.0f; if ( dist < alien1->radius_squared ) { hit1 = 1; pm1->active = FALSE; Game_scores ( gv->pscore1 + score_table[pm1->zheight], 0 ); gv->pbonus1 += score_table[pm1->zheight]; if ( gv->pbonus1 > PLAYER_LIFE_BONUS-1 ) { gv->pbonus1 -= PLAYER_LIFE_BONUS; if ( gv->plives1 < PLAYER_LIFE_MAX ) { gv->plives1++; hit1 = 2; } } } dist = Dist_pt_2_line ( alien1->pos, pm2->old_pos, pm2->pos ) - \ pm2->radius_squared - 1.0f; if ( dist < alien1->radius_squared ) { hit2 = 1; pm2->active = FALSE; Game_scores ( gv->pscore2 + score_table[pm1->zheight], 1 ); gv->pbonus2 += score_table[pm1->zheight]; if ( gv->pbonus2 > PLAYER_LIFE_BONUS-1 ) { gv->pbonus2 -= PLAYER_LIFE_BONUS; if ( gv->plives2 < PLAYER_LIFE_MAX ) { gv->plives2++; hit2 = 2; } } } if ( hit1 || hit2 ) { alien1->active = FALSE; gv->alien_count--; Objlist_del ( (af_list+pm1->zheight), alien1 ); Explosions_add ( alien1 ); Update_fcolumn ( alien1 ); /* update player score & alien count */ if ( ( hit1 > 1 ) || ( hit2 > 1 ) ) One_up_add ( alien1 ); if ( gv->alien_count == 0 ) { gv->new_level = TRUE; break; } } alien1 = alien1->next; } hit1 = hit2 = 0; } if ( hit1 ) { while ( alien1 ) { dist = Dist_pt_2_line ( alien1->pos, pm1->old_pos, pm1->pos ) - \ pm1->radius_squared - 1.0f; if ( dist < alien1->radius_squared ) { pm1->active = alien1->active = FALSE; gv->alien_count--; Objlist_del ( (af_list+pm1->zheight), alien1 ); Explosions_add ( alien1 ); Update_fcolumn ( alien1 ); /* update player score & alien count */ Game_scores ( gv->pscore1 + score_table[pm1->zheight], 0 ); gv->pbonus1 += score_table[pm1->zheight]; if ( gv->pbonus1 > PLAYER_LIFE_BONUS-1 ) { gv->pbonus1 -= PLAYER_LIFE_BONUS; if ( gv->plives1 < PLAYER_LIFE_MAX ) { gv->plives1++; One_up_add ( alien1 ); } } if ( gv->alien_count == 0 ) gv->new_level = TRUE; break; } alien1 = alien1->next; } } if ( hit2 ) { while ( alien2 ) { dist = Dist_pt_2_line ( alien2->pos, pm2->old_pos, pm2->pos ) - \ pm2->radius_squared - 1.0f; if ( dist < alien2->radius_squared ) { pm2->active = alien2->active = FALSE; gv->alien_count--; Objlist_del ( (af_list+pm2->zheight), alien2 ); Explosions_add ( alien2 ); Update_fcolumn ( alien2 ); /* update player score & alien count */ Game_scores ( gv->pscore2 + score_table[pm2->zheight], 1 ); gv->pbonus2 += score_table[pm2->zheight]; if ( gv->pbonus2 > PLAYER_LIFE_BONUS-1 ) { gv->pbonus2 -= PLAYER_LIFE_BONUS; if ( gv->plives2 < PLAYER_LIFE_MAX ) { gv->plives2++; One_up_add ( alien2 ); } } if ( gv->alien_count == 0 ) gv->new_level = TRUE; break; } alien2 = alien2->next; } } /* is player missile(s) in the UFO zone?? */ if ( ufo->active ) { /* * allow for very slim possibility that both players hit UFO * hit the UFO at the same time, therefore test for hit first, * and then add the score(s) afterwards. */ hit1 = hit2 = 0; if ( pm1->active && \ ( pm1->zone == ufo->zone ) && ( pm1->zheight == ufo->zheight ) ) { dist = Dist_pt_2_line ( ufo->pos, pm1->old_pos, pm1->pos ) - \ pm1->radius_squared - 1.0f; if ( dist < ufo->radius_squared ) hit1 = 1; } if ( gv->pduel && pm2->active && \ ( pm2->zone == ufo->zone ) && ( pm2->zheight == ufo->zheight ) ) { dist = Dist_pt_2_line ( ufo->pos, pm2->old_pos, pm2->pos ) - \ pm2->radius_squared - 1.0f; if ( dist < ufo->radius_squared ) hit2 = 1; } if ( hit1 ) { pm1->active = ufo->active = FALSE; Game_scores ( gv->pscore1 + UFO_BONUS, 0 ); gv->pbonus1 += UFO_BONUS; if ( gv->pbonus1 > PLAYER_LIFE_BONUS-1 ) { gv->pbonus1 -= PLAYER_LIFE_BONUS; if ( gv->plives1 < PLAYER_LIFE_MAX ) gv->plives1++; } } if ( hit2 ) { pm2->active = ufo->active = FALSE; Game_scores ( gv->pscore2 + UFO_BONUS, 1 ); gv->pbonus2 += UFO_BONUS; if ( gv->pbonus2 > PLAYER_LIFE_BONUS-1 ) { gv->pbonus2 -= PLAYER_LIFE_BONUS; if ( gv->plives2 < PLAYER_LIFE_MAX ) gv->plives2++; } } if ( hit1 || hit2 ) { Explosions_add ( ufo ); if ( ( hit1 > 1 ) || ( hit2 > 1 ) ) One_up_add ( ufo ); } } /* alien bombs vs player(s) */ if ( !gv->gameover ) { hit1 = hit2 = 0; if ( player1->active && !gv->pblink1 ) hit1 = 1; if ( gv->pduel && player2->active && !gv->pblink2 ) hit2 = 1; if ( hit1 || hit2 ) { for (abomb = abombs->head; abomb != NULL; abomb = abomb->next ) { /* one bomb might hit one or both players */ if ( hit1 && \ abomb->zone == player1->zone && \ abomb->zheight == player1->zheight ) { dist = Dist_pt_2_line ( player1->pos, abomb->old_pos, abomb->pos ) - \ abomb->radius_squared - 1.0f; if ( dist < player1->radius_squared ) { player1->active = FALSE; Explosions_add ( player1 ); hit1 = 2; } } if ( hit2 && \ abomb->zone == player2->zone && \ abomb->zheight == player2->zheight ) { dist = Dist_pt_2_line ( player2->pos, abomb->old_pos, abomb->pos ) - \ abomb->radius_squared - 1.0f; if ( dist < player2->radius_squared ) { player2->active = FALSE; Explosions_add ( player2 ); hit2 = 2; } } if ( hit1 > 1 || hit2 > 1 ) { abomb->active = FALSE; Objlist_del ( abombs, abomb ); if ( hit1 > 1 ) hit1 = 0; if ( hit2 > 1 ) hit2 = 0; } if ( !( hit1 || hit2 ) ) break; } } } /* * player(s) vs aliens: * if the remaining aliens reach the player_zone * then the game is over! Reduce the number of * remaining lives to zero and blowup the player(s) and * then initiate a game-over! */ if ( gv->formation_zone == ZONE_0 ) { gv->plives1 = gv->plives2 = 0; if ( player1->active ) { Explosions_add ( player1 ); player1->active = FALSE; } if ( gv->pduel && player2->active ) { Explosions_add ( player2 ); player2->active = FALSE; } } /* * * Move Objects and Update Animations : * formation, alien_bombs, ufo, and player_missile * */ Aliens_update (); if ( pm1->active ) pm1->actionfn ( pm1 ); if ( ( gv->pduel ) && ( pm2->active ) ) pm2->actionfn ( pm2 ); /* * * Draw Objects : * * special effects * alien: formation, bombs, and ufo * player missile * player * */ Stars_draw ( cam_mat1, cam_mat2 ); Jumpgate_animate ( cam_mat1, cam_mat2 ); Explosions_draw ( cam_mat1, cam_mat2 ); One_up_draw ( cam_mat1, cam_mat2 ); /* * major hack!! this is NOT the right way to draw in 3d * may the universe forgive my transgression! * ...but it's KISS and visually seems close enough :-P * */ if ( ufo->active ) Add_obj_2_world ( ufo ); Add_obj_2_world ( &the_formation ); for (abomb=abombs->head; abomb != NULL; abomb=abomb->next ) { Add_obj_2_world ( abomb ); } if ( pm1->active ) Add_obj_2_world ( pm1 ); if ( player1->active ) Add_obj_2_world ( player1 ); if ( gv->pduel ) { if ( pm2->active ) Add_obj_2_world ( pm2 ); if ( player2->active ) Add_obj_2_world ( player2 ); } Sort_obj_list (); Draw_obj_list ( cam_mat1, cam_mat2 ); SW_UPDATE; Game_overlay (); /* * Before acknowledging flags make sure ALL explosions * are finished: * gameover flag has precedence over newlevel flag * since it is possible for a player to have killed * all the aliens but then get killed by an alien bomb * resulting in both a newlevel and gameover condition!! */ if ( Explosions_count() == 0 ) { hit1 = hit2 = 0; if ( gv->pduel ) { if ( player1->active == FALSE && \ player2->active == FALSE ) hit2 = 1; } else { if ( player1->active == FALSE ) hit1 = 1; } if ( hit2 ) { /* reduce player life and check for gameover */ gv->plives1--; gv->plives2--; if ( gv->plives1 <= 0 || gv->plives2 <= 0 ) gv->gameover = TRUE; Player_init ( 0 ); Player_init ( 1 ); SW_RESET; Game_actionfn = Game_ready; } else if ( hit1 ) { /* reduce player life and check for gameover */ gv->plives1--; if ( gv->plives1 <= 0 ) gv->gameover = TRUE; Player_init ( 0 ); SW_RESET; Game_actionfn = Game_ready; } if ( gv->gameover ) { SW_RESET; Game_actionfn = Game_gameover; } else { if ( gv->new_level && ( Objlist_count ( abombs ) == 0 ) ) { SW_RESET; Game_actionfn = Game_newlevel; } } } } /*================================================================*/ void Object_update_zone ( OBJECT *obj ) { obj->zone = lrint ( floor ( (double)(obj->pos[ZPOS]/-ZONE_WIDTH) ) ); obj->zheight = lrint ( floor ( (double)(obj->pos[YPOS]/ZONE_HEIGHT) ) ); } /*================================================================*/ static void Draw_vector_font ( int *s[], int x, int y, unsigned int color ) { int *letter, segments, x1, y1, x2, y2; /* first integer of pointer array is always # of line segments */ while ( (letter=*s++) ) { segments=*letter++; while ( --segments>=0 ) { x1 = (*letter++)+x; y1 = (*letter++)+y; x2 = (*letter++)+x; y2 = (*letter++)+y; Draw_line( x1, y1, x2, y2, color ); } x += 30; } } /*================================================================*/ static void Add_obj_2_world ( OBJECT *obj ) { int i; i = gv->gobjcount; if ( i < MAX_OBJECTS-1 ) { gv->gobjs[i] = obj; gv->gobjcount++; } } static void Clear_obj_list ( void ) { gv->gobjcount = 0; } static void Sort_obj_list ( void ) { qsort ( gv->gobjs, gv->gobjcount, sizeof ( OBJECT * ), Z_compare ); } static int Z_compare ( const void *obj0, const void *obj1 ) { OBJECT *o0, *o1; o0 = ( OBJECT * ) obj0; o1 = ( OBJECT * ) obj1; if ( o0->pos[ZPOS] < o1->pos[ZPOS] ) return -1; else if ( o0->pos[ZPOS] > o1->pos[ZPOS] ) return 1; else return 0; } static void Draw_obj_list ( MAT r1, MAT r2 ) { int i; OBJECT *obj; if ( gv->gobjcount > 0 ) { i = 0; while ( i < gv->gobjcount ) { obj = gv->gobjs[i]; obj->drawfn ( obj, r1, r2 ); i++; } } } /*================================================================*/ static float Dist_pt_2_line ( VEC p, VEC l0, VEC l1 ) { VEC l0_p; VEC l0_l1; VEC q; float n, d, w, t, dist; /* * calc adjusted position of projectile along the * line segment formed by old_pos to new_pos * use this for calculating distance between moving * objects. This must be done since movement is * not in discreet amounts due to varying framerates. * * routine uses the properties of the unit vector * and dot product. see ``Computer Graphics: * principles and practice'' appendix for * explaination. Then checks to see if generated * line falls within the line segment l0l1 * */ Vector_sub ( p, l0, l0_p ); Vector_sub ( l1, l0, l0_l1 ); /* * don't try to take Vector_norm if division by zero * will result. TBB * * check using Vec_mag_squared instead of * xpos == 0 && ypos == 0 && zpos == 0 * Don */ if ( Vector_mag_squared ( l0_l1 ) < 1.0f ) { q[XPOS] = l0[XPOS]; q[YPOS] = l0[YPOS]; q[ZPOS] = l0[ZPOS]; dist = Vector_dist_squared ( q, p ); } else { d = l1[ZPOS] - l0[ZPOS]; /* l0 and l1 are very close */ if ( (d > -0.025 ) && ( d < 0.025 ) ) { q[XPOS] = l0[XPOS]; q[YPOS] = l0[YPOS]; q[ZPOS] = l0[ZPOS]; dist = Vector_dist_squared ( q, p ); } else { Vector_norm ( l0_l1 ); w = Vector_dot ( l0_p, l0_l1 ); q[XPOS] = l0[XPOS] + ( l0_l1[XPOS] * w ); q[YPOS] = l0[YPOS] + ( l0_l1[YPOS] * w ); q[ZPOS] = l0[ZPOS] + ( l0_l1[ZPOS] * w ); n = q[ZPOS] - l0[ZPOS]; t = n / d; if ( ( t > -0.025f ) && ( t < 1.5f ) ) dist = Vector_dist_squared ( q, p ); else dist = 1000000.0f; } } return dist; } JoesCat-xinvaders3d-030b568/game.h000066400000000000000000000117311506711671200166360ustar00rootroot00000000000000/*------------------------------------------------------------------ game.h: Game main header XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #ifndef GAME_MAIN_HEADER #define GAME_MAIN_HEADER /*------------------------------------------------------------------ * * Standard Includes * ------------------------------------------------------------------*/ #include #include #include #include #include /*------------------------------------------------------------------ * * Vector, Matrix, and Camera functions * ------------------------------------------------------------------*/ #include "vec4x1.h" #include "mat4x4.h" #include "camera.h" /*------------------------------------------------------------------ * * System specific Functions, Graphics primitives, and Timming * ------------------------------------------------------------------*/ #include "system.h" /*------------------------------------------------------------------ * * Game Defines * ------------------------------------------------------------------*/ #include "defines.h" /*------------------------------------------------------------------ * * Object Managment Struct & Funtions : object.c * ------------------------------------------------------------------*/ #include "object.h" /*------------------------------------------------------------------ * * Game-Logic Funtions : game.c * ------------------------------------------------------------------*/ extern void Game_main ( void ); /* initialization functions */ extern int Game_init ( float, float ); extern void Game_init_vars ( int ); extern void Game_init_keys ( void ); /* Game action function(s) */ extern void (*Game_actionfn)(); extern void Game_newlevel ( void ); extern void Game_gameover ( void ); extern void Game_paused_toggle ( void ); extern void Game_paused ( void ); extern void Game_reset ( void ); extern void Game_menu ( void ); extern void Game_ready ( void ); extern void Game_run ( void ); extern void Game_overlay ( void ); /* misc game related functions */ extern void Object_update_zone ( OBJECT *obj ); /*------------------------------------------------------------------ * * Player's Functions : player.c * ------------------------------------------------------------------*/ extern void Player_init ( int ); extern void Player_blink1 ( OBJECT *, MAT, MAT ); extern void Player_blink2 ( OBJECT *, MAT, MAT ); extern void Player_draw1 ( OBJECT *, MAT, MAT ); extern void Player_draw2 ( OBJECT *, MAT, MAT ); extern void Player_update1 ( OBJECT * ); extern void Player_update2 ( OBJECT * ); extern void Player_missile_update ( OBJECT * ); extern void Player_missile_draw1 ( OBJECT *, MAT, MAT ); extern void Player_missile_draw2 ( OBJECT *, MAT, MAT ); /*------------------------------------------------------------------ * * Aliens' Functions : aliens.c * ------------------------------------------------------------------*/ extern void Aliens_init ( void ); extern void Aliens_update ( void ); extern void Update_fcolumn ( OBJECT * ); extern void Aliens_draw ( OBJECT *, MAT, MAT ); extern void Alien_missile_draw ( OBJECT *, MAT, MAT ); extern void Ufo_spawn ( void ); extern void Ufo_draw ( OBJECT *, MAT, MAT ); /*------------------------------------------------------------------ * * Special-Effects Functions : effects.c * ------------------------------------------------------------------*/ /* stars */ extern void Stars_init ( void ); extern void Stars_draw ( MAT, MAT ); /* explosions */ extern void Explosions_add ( OBJECT * ); extern void Explosions_clear ( void ); extern void Explosions_draw ( MAT, MAT ); extern int Explosions_count ( void ); /* jump-gate */ extern void Jumpgate_init ( void ); extern void Jumpgate_open ( VEC, int ); extern void Jumpgate_animate ( MAT, MAT ); /* one-up */ extern void One_up_init ( void ); extern void One_up_add ( OBJECT * ); extern void One_up_draw ( MAT, MAT ); /*------------------------------------------------------------------ * * Game Variables * ------------------------------------------------------------------*/ #include "externs.h" #endif JoesCat-xinvaders3d-030b568/gtext.h000066400000000000000000000122301506711671200170530ustar00rootroot00000000000000#ifndef XINVADERS3D_GAMETEXT #define XINVADERS3D_GAMETEXT /* XInvaders3d game Text */ /* use a null terminator, so code doesn't have to be changed in many places. Don't use \n; assume a line break suitable to the particular platform should be generated after each line. TBB */ char *game_about_info[] = { "Thanks for playing XInvaders 3D.", "XInvaders 3D v1.7.0, Copyright 2000 Don Llopis", "XInvaders 3D comes with ABSOLUTELY NO WARRANTY.", "This is free software, and you are welcome to", "redistribute it under certain conditions. See", "file named COPYING for more information.", "Latest version of the game can be found at:", "https://github.com/JoesCat/xinvaders3d/releases", NULL }; char *game_rules_info[] = { "Keys:", "SPACE: Fire Missile", "Left Arrow: move left", "Right Arrow: move right", "Up Arrow: move up", "Down Arrow: move down", "f: Show frame-rate", "p: Pause game", "q: reset game", "ESC: Quit program", "1: Lone Defender", "2: 2 Player Duel H", "3: 2 Player Duel V", "a: Fire Missile, player2", "i: move up, player2", "j: move left, player2", "k: move right, player2", "m: move down, player2", NULL }; /* * Not so nice vector-fonts: * perhaps one day, when the universe is kinder to me, * I'll implement a nice vector-font system. But * until the universe lets me go on my trip, * the stuff below stays! */ static int A[17] = { 4, 0, 0, 24, 0, 0, 12, 24, 12, 0, 0, 0, 24, 24, 0, 24, 24 }; static int C[13] = { 3, 0, 0, 24, 0, 0, 0, 0, 24, 0, 24, 24, 24 }; static int D[13] = { 3, 0, 0, 0, 24, 0, 0, 24, 12, 0, 24, 24, 12 }; static int E[17] = { 4, 0, 0, 24, 0, 0, 12, 24, 12, 0, 24, 24, 24, 0, 0, 0, 24 }; static int EXCLAMATION[33] = { 8, 0, 0, 24, 0, 5, 19, 15, 19, 0, 0, 5, 19, 24, 0, 15, 19, 5, 25, 15, 25, 5, 30, 15, 30, 5, 25, 5, 30, 15, 25, 15, 30 }; static int F[13] = { 3, 0, 0, 0, 24, 0, 0, 24, 0, 0, 12, 24, 12 }; static int G[17] = { 4, 24, 0, 0, 12, 0, 12, 24, 24, 24, 24, 24, 12, 24, 12, 12, 12 }; static int H[13] = { 3, 0, 0, 0, 24, 0, 12, 24, 12, 24, 0, 24, 24 }; static int I[13] = { 3, 0, 0, 24, 0, 0, 24, 24, 24, 12, 0, 12, 24 }; static int M[17] = { 4, 0, 0, 0, 24, 0, 0, 12, 12, 12, 12, 24, 0, 24, 0, 24, 24 }; static int N[13] = { 3, 0, 0, 0, 24, 0, 0, 24, 24, 24, 0, 24, 24 }; static int O[17] = { 4, 0, 0, 24, 0, 0, 0, 0, 24, 0, 24, 24, 24, 24, 0, 24, 24 }; static int P[13] = { 3, 0, 0, 0, 24, 0, 0, 24, 12, 24, 12, 0, 12 }; static int R[17] = { 4, 0, 0, 0, 24, 0, 0, 24, 12, 0, 12, 24, 12, 0, 12, 24, 24 }; static int S[13] = { 3, 24, 0, 0, 5, 0, 5, 24, 15, 24, 15, 0, 24 }; static int T[9] = { 2, 0, 0, 24, 0, 12, 0, 12, 24 }; static int U[13] = { 3, 0, 0, 0, 24, 0, 24, 24, 24, 24, 24, 24, 0 }; static int V[9] = { 2, 0, 0, 12, 24, 24, 0, 12, 24 }; static int X[9] = { 2, 0, 0, 24, 24, 24, 0, 0,24 }; static int Y[13] = { 3, 0, 0, 12, 12, 12, 12, 24, 0, 12, 12, 12, 24 }; static int ZERO[21] = { 5, 0, 0, 24, 24, 0, 0, 24, 0, 0, 24, 24, 24, 0, 0, 0, 24, 24, 0, 24, 24 }; static int ONE[5] = { 1, 12, 0, 12, 24 }; static int TWO[21] = { 5, 0, 0, 24, 0, 24, 0, 24, 12, 24, 12, 0, 12, 0, 12, 0, 24, 0, 24, 24, 24 }; static int THREE[17] = { 4, 0, 0, 24, 0, 24, 12, 0, 12, 0, 24, 24, 24, 24, 0, 24, 24 }; static int FOUR[13] = { 3, 0, 0, 0, 12, 0, 12, 24, 12, 24, 0, 24, 24 }; static int FIVE[21] = { 5, 0, 0, 24, 0, 0, 0, 0, 12, 0, 12, 24, 12, 24, 12, 24, 24, 24, 24, 0, 24 }; static int SIX[17] = { 4, 0, 0, 0, 24, 0, 24, 24, 24, 24, 24, 24, 12, 24, 12, 0, 12 }; static int SEVEN[9] = { 2, 0, 0, 24, 0, 24, 0, 0, 24 }; static int EIGHT[21] = { 5, 0, 0, 24, 0, 0, 12, 24, 12, 0, 24, 24, 24, 0, 0, 0, 24, 24, 0, 24, 24 }; static int NINE[17] = { 4, 0, 0, 24, 0, 0, 12, 24, 12, 0, 0, 0, 12, 24, 0, 24, 24 }; static int *NUMBER[10] = { &ZERO[0], &ONE[0], &TWO[0], &THREE[0], &FOUR[0], &FIVE[0], &SIX[0], &SEVEN[0], &EIGHT[0], &NINE[0] }; static int *XINVADERS3D_LOGO[] = { &X[0], &I[0], &N[0], &V[0], &A[0], &D[0], &E[0], &R[0], &S[0], &THREE[0], &D[0], NULL }; static int *GET[] = { &G[0], &E[0], &T[0], NULL }; static int *READY[] = { &R[0], &E[0], &A[0], &D[0], &Y[0], &EXCLAMATION[0], &EXCLAMATION[0], NULL }; static int *GAME[] = { &G[0], &A[0], &M[0], &E[0], NULL }; static int *OVER[] = { &O[0], &V[0], &E[0], &R[0], NULL }; static int *PAUSED[] = { &P[0], &A[0], &U[0], &S[0], &E[0], &D[0], NULL }; static int *SCORE[] = { &S[0], &C[0], &O[0], &R[0], &E[0], NULL }; static int *HI_SCORE[] = { &H[0], &I[0], &S[0], &C[0], &O[0], &R[0], &E[0], NULL }; static int *PRESS[] = { &P[0], &R[0], &E[0], &S[0], &S[0], NULL }; static int *FIRE[] = { &F[0], &I[0], &R[0], &E[0], NULL }; static int *TO[] = { &T[0], &O[0], NULL }; static int *START[] = { &S[0], &T[0], &A[0], &R[0], &T[0], NULL }; #endif JoesCat-xinvaders3d-030b568/m4/000077500000000000000000000000001506711671200160715ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/m4/ax_check_compile_flag.m4000066400000000000000000000064021506711671200226030ustar00rootroot00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # 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 3 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, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 4 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS JoesCat-xinvaders3d-030b568/main-dos.c000066400000000000000000000127661506711671200174400ustar00rootroot00000000000000/*------------------------------------------------------------------ main-dos.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #include #include "game.h" /* ahh the simplicity of DOS!!! */ BITMAP *buffer; PALETTE pal; /*================================================================*/ /*------------------------------------------------------------------ * main * * ------------------------------------------------------------------*/ int main ( int argc, char **argv ) { int i; if ( !Graphics_init ( WIN_WIDTH, WIN_HEIGHT ) ) { fprintf ( stderr, "Error: could not initialize graphics!\n" ); exit ( -1 ); } if ( !Game_init ( WIN_WIDTH, WIN_HEIGHT ) ) { fprintf ( stderr, "Error: could not initialize game data!\n" ); exit ( -1 ); } Game_main (); Graphics_shutdown (); /* print contact information */ i = 0; while ( game_about_info[i] ) { printf ( "%s\n", game_about_info[i] ); i++; } return 0; } END_OF_MAIN(); /*================================================================*/ int Graphics_init ( unsigned int win_width, unsigned int win_height ) { int i, j; allegro_init (); install_keyboard (); if ( set_gfx_mode ( GFX_AUTODETECT, 640, 480, 0, 0 ) != 0 ) { set_gfx_mode ( GFX_TEXT, 0, 0, 0, 0 ); return FALSE; } buffer = create_bitmap ( win_width, win_height ); set_clip ( buffer, 0, 0, win_width-1, win_height-1 ); clear ( buffer ); /* load default color scheme */ /* red */ for ( i=0, j=0; i<64; i++, j++ ) { pal[i].r = j; pal[i].g = pal[i].b = 0; } /* green */ for ( i=64, j=0; i<128; i++, j++ ) { pal[i].g = j; pal[i].r = pal[i].b = 0; } /* blue */ for ( i=128, j=0; i<192; i++, j++ ) { pal[i].b = j; pal[i].r = pal[i].g = 0; } /* white */ for ( i=192, j=0; i<256; i++, j++ ) { pal[i].r = pal[i].g = pal[i].b = j; } /* yellow */ pal[192].r = 63; pal[192].g = 63; pal[192].b = 32; set_palette ( pal ); return TRUE; } /*================================================================*/ void Graphics_shutdown ( void ) { destroy_bitmap ( buffer ); set_gfx_mode ( GFX_TEXT, 0, 0, 0, 0 ); } /*================================================================*/ int Update_display ( void ) { vsync (); blit ( buffer, screen, 0, 0, 0, 0, WIN_WIDTH, WIN_HEIGHT ); clear ( buffer ); return TRUE; } /*================================================================*/ int Handle_events ( void ) { gv->key_UP = ( key[KEY_UP] ) ? TRUE : FALSE; gv->key_DOWN = ( key[KEY_DOWN] ) ? TRUE : FALSE; gv->key_LEFT = ( key[KEY_LEFT] ) ? TRUE : FALSE; gv->key_RIGHT = ( key[KEY_RIGHT] ) ? TRUE : FALSE; gv->key_FIRE = ( key[KEY_SPACE] ) ? TRUE : FALSE; if ( key[KEY_F] ) gv->display_fps ^= TRUE; if ( key[KEY_P] ) Game_paused_toggle (); if ( key[KEY_Q] ) Game_reset (); if ( key[KEY_ESC] ) return FALSE; return TRUE; } /*================================================================*/ void Draw_line ( int x0, int y0, int x1, int y1, unsigned int color ) { line ( buffer, x0, y0, x1, y1, color ); } /*================================================================*/ void Draw_point ( int x0, int y0, unsigned int color ) { rectfill ( buffer, x0-1, y0-1, x0+1, y0+1, color ); } /*================================================================*/ void Draw_text ( char *message, int x0, int y0, unsigned int color ) { textout ( buffer, font, message, x0, y0-10, color ); } /*================================================================*/ /*------------------------------------------------------------------ * * System msec & sec Timer functions * ------------------------------------------------------------------*/ void Timer_init ( TIMER *t ) { t->init_time_stamp = time ( NULL ); while ( gettimeofday ( &(t->t0), NULL ) < 0 ); while ( gettimeofday ( &(t->t1), NULL ) < 0 ); } /*================================================================*/ CLOCK_T Timer_ticks ( void ) { return clock (); } /*================================================================*/ double Timer_sec ( TIMER *t ) { return difftime ( time(NULL), t->init_time_stamp ); } /*================================================================*/ long Timer_msec ( TIMER *t ) { long msec; if ( gettimeofday ( &(t->t1), NULL ) < 0 ) return -1; msec = ((t->t1.tv_sec-t->t0.tv_sec)*1000L)+ ((t->t1.tv_usec-t->t0.tv_usec)/1000L); t->t0.tv_sec = t->t1.tv_sec; t->t0.tv_usec = t->t1.tv_usec; return msec; } /*================================================================*/ JoesCat-xinvaders3d-030b568/main-w.c000066400000000000000000000315171506711671200171140ustar00rootroot00000000000000/*------------------------------------------------------------------ main-w.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis WIN32 port by Thomas Boutell 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 ------------------------------------------------------------------*/ #include #include #include "game.h" /*================================================================*/ /* WIN32 globals */ HINSTANCE hInst; HWND win; HPEN color_table_pens [MAX_COLORS]; HBRUSH color_table_brushes [MAX_COLORS]; unsigned short color_data [MAX_COLORS][3]; HPEN blackPen; HBRUSH blackBrush; /* Menu item IDs for the message boxes */ #define aboutItemId 1000 #define rulesItemId 1001 /* window buffers */ HDC double_buffer_dc; HBITMAP double_buffer; HBITMAP double_buffer_old_bitmap; /* misc window info */ char *window_name = "3d"; unsigned int window_width, window_height, display_width, display_height; static void showGameInfo(char **gameInfo, char *title, char *append); /*================================================================*/ int PASCAL WinMain(HINSTANCE hInstCurrent, HINSTANCE hInstPrevious, LPSTR lpszCmdLine, int nCmdShow) { hInst = hInstCurrent; if ( !Graphics_init ( WIN_WIDTH, WIN_HEIGHT ) ) { MessageBox(0, "Error: could not initialize graphics!\n", "XInvaders 3D Error", MB_ICONEXCLAMATION); exit ( -1 ); } if ( !Game_init ( WIN_WIDTH, WIN_HEIGHT ) ) { MessageBox(0, "Error: could not initialize game data!\n", "XInvaders 3D Error", MB_ICONEXCLAMATION); exit ( -1 ); } /* run the game until ESC key is pressed */ while ( Handle_events () ) { /* get start-time of current frame */ gv->msec = Timer_msec ( gt ); gv->ftime = (double)gv->msec/1000L; gv->fps = 1.0 / gv->ftime; gv->fadjust = gv->rfps / gv->fps; /* do game */ (*Game_actionfn)(); /* get end-time of current frame, msec elapsed, and calc fps */ /* update display */ Update_display (); } Graphics_shutdown (); showGameInfo(game_about_info, "About XInvaders 3D", "Ported to Windows by Thomas Boutell"); return 0; } long FAR PASCAL winv3dWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); /*================================================================*/ int Graphics_init ( unsigned int win_width, unsigned int win_height ) { int i, j, width, height; HDC hdc; HPEN oldPen; HBRUSH oldBrush; WNDCLASS wc; MENUITEMINFO menuitem; HMENU menu; int count; width = win_width; height = (int) win_height; window_width = win_width; window_height = win_height; /* Create a window class */ wc.style = 0; wc.lpfnWndProc = winv3dWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInst; wc.hIcon = 0; /* LoadIcon(hInst, MAKEINTRESOURCE(WINV3D_ICON)); */ wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = 0; wc.lpszMenuName = 0; wc.lpszClassName = "xinv3d"; if (!RegisterClass(&wc)) { return FALSE; } /* create a simple window*/ win = CreateWindow( "xinv3d", "xinv3d", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, window_width, window_height, HWND_DESKTOP, 0, hInst, 0); /* Get the system menu, so that we can install an about option that explains how to play */ menu = GetSystemMenu(win, FALSE); count = GetMenuItemCount(menu); memset(&menuitem, 0, sizeof(menuitem)); menuitem.fType = MFT_STRING; menuitem.fMask = MIIM_TYPE | MIIM_ID; menuitem.wID = aboutItemId; menuitem.dwTypeData = (DWORD) "&About xinv3d"; menuitem.cch = strlen("&About xinv3d"); menuitem.cbSize = sizeof(menuitem); InsertMenuItem(menu, count, TRUE, &menuitem); memset(&menuitem, 0, sizeof(menuitem)); menuitem.fType = MFT_STRING; menuitem.fMask = MIIM_TYPE | MIIM_ID; menuitem.wID = rulesItemId; menuitem.dwTypeData = (DWORD) "&How to Play"; menuitem.cch = strlen("&How to Play"); menuitem.cbSize = sizeof(menuitem); InsertMenuItem(menu, count, TRUE, &menuitem); /* load default color scheme */ /* red */ for ( i=0, j=0; i<64; i++, j++ ) { color_data[i][0] = 1024 * j; color_data[i][1] = color_data[i][2] = 0; } /* green */ for ( i=64, j=0; i<128; i++, j++ ) { color_data[i][1] = 1024 * j; color_data[i][0] = color_data[i][2] = 0; } /* blue */ for ( i=128, j=0; i<192; i++, j++ ) { color_data[i][2] = 1024 * j; color_data[i][0] = color_data[i][1] = 0; } /* white */ for ( i=192, j=0; i<256; i++, j++ ) { color_data[i][0] = color_data[i][1] = color_data[i][2] = j * 1024; } /* yellow */ color_data[192][0] = 63 * 1024; color_data[192][1] = 63 * 1024; color_data[192][2] = 32 * 1024; for ( i=0; i> 8, color_data[i][1] >> 8, color_data[i][2] >> 8)); color_table_brushes[i] = CreateSolidBrush( RGB(color_data[i][0] >> 8, color_data[i][1] >> 8, color_data[i][2] >> 8)); } blackPen = color_table_pens[BLACK]; blackBrush = color_table_brushes[BLACK]; /* create double buffer */ hdc = GetDC(win); double_buffer = CreateCompatibleBitmap( hdc, window_width, window_height); double_buffer_dc = CreateCompatibleDC(hdc); double_buffer_old_bitmap = SelectObject( double_buffer_dc, double_buffer); SetBkColor(double_buffer_dc, RGB(0, 0, 0)); ReleaseDC(win, hdc); oldPen = SelectObject(double_buffer_dc, blackPen); oldBrush = SelectObject(double_buffer_dc, blackBrush); Rectangle(double_buffer_dc, 0, 0, window_width, window_height); SelectObject(double_buffer_dc, oldPen); SelectObject(double_buffer_dc, oldBrush); /* display the window */ ShowWindow(win, SW_SHOW); return TRUE; } /*================================================================*/ void Graphics_shutdown ( void ) { int i; SelectObject(double_buffer_dc, double_buffer_old_bitmap); DeleteDC(double_buffer_dc); DeleteObject(double_buffer); for ( i=0; i> 8, color_data[color][1] >> 8, color_data[color][2] >> 8)); /* draw text */ TextOut(double_buffer_dc, x0, y0, message, strlen(message)); } /*================================================================*/ long FAR PASCAL winv3dWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { /* * Process whatever messages you want here and send the * rest to DefWindowProc. */ case WM_KEYDOWN: if (lParam & 0x4000000) { /* Repeat */ break; } /* Not Repeat */ switch (wParam) { case VK_SPACE: gv->key_FIRE = TRUE; break; case VK_UP: gv->key_UP = TRUE; break; case VK_DOWN: gv->key_DOWN = TRUE; break; case VK_LEFT: gv->key_LEFT = TRUE; break; case VK_RIGHT: gv->key_RIGHT = TRUE; break; case VK_ESCAPE: /* quit! */ PostMessage(win, WM_QUIT, 0, 0L); return FALSE; break; default: break; } break; case WM_CHAR: switch (wParam) { case 'f': /* display frames per second */ gv->display_fps ^= TRUE; break; case 'p': /* pause */ Game_paused_toggle (); break; case 'q': Game_reset (); break; default: break; } break; case WM_KEYUP: switch (wParam) { case VK_SPACE: gv->key_FIRE = FALSE; break; case VK_UP: gv->key_UP = FALSE; break; case VK_DOWN: gv->key_DOWN = FALSE; break; case VK_LEFT: gv->key_LEFT = FALSE; break; case VK_RIGHT: gv->key_RIGHT = FALSE; break; default: break; } break; case WM_SYSCOMMAND: switch (wParam) { case SC_CLOSE: PostMessage(win, WM_QUIT, 0, 0L); break; case aboutItemId: showGameInfo(game_about_info, "About XInvaders 3D", "Ported to Windows by Thomas Boutell"); break; case rulesItemId: showGameInfo(game_rules_info, "How to Play XInvaders 3D", 0); break; default: /* Inherit default behavior */ return (DefWindowProc(hwnd, msg, wParam, lParam)); } default: /* Inherit default behavior */ return (DefWindowProc(hwnd, msg, wParam, lParam)); } return 0L; } static void showGameInfo(char **gameInfo, char *title, char *append) { /* Must be less than 16K to work properly. */ char message[16384]; strcpy(message, ""); while (*gameInfo) { strcat(message, *gameInfo); strcat(message, "\r\n"); gameInfo++; } if (append) { strcat(message, append); } MessageBox(win, message, title ? title : "XInvaders 3D", MB_ICONINFORMATION); } void Timer_init ( TIMER *t ) { long msec; t->init_time_stamp = time ( NULL ); msec = GetTickCount(); t->t0.tv_sec = msec / 1000; t->t0.tv_usec = (msec % 1000) * 1000; t->t1 = t->t0; } /*================================================================*/ CLOCK_T Timer_ticks ( void ) { return clock (); } /*================================================================*/ double Timer_sec ( TIMER *t ) { return difftime ( time(NULL), t->init_time_stamp ); } /*================================================================*/ long Timer_msec ( TIMER *t ) { long msec = GetTickCount(); t->t1.tv_sec = msec / 1000; t->t1.tv_usec = (msec % 1000) * 1000; msec = ((t->t1.tv_sec-t->t0.tv_sec)*1000L)+ ((t->t1.tv_usec-t->t0.tv_usec)/1000L); t->t0.tv_sec = t->t1.tv_sec; t->t0.tv_usec = t->t1.tv_usec; return msec; } JoesCat-xinvaders3d-030b568/main-x11.c000066400000000000000000000377741506711671200172720ustar00rootroot00000000000000/*------------------------------------------------------------------ main-x11.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #include #include #include #include #include #ifdef __FreeBSD__ #include #endif #include "game.h" /*================================================================*/ /* window structs */ Display *display; int screen_num; Window win; Screen *screen_ptr; XFontStruct *font_info; /* gc's & color data */ GC black_gc, color_gc, text_gc; XGCValues gc_values; unsigned long gc_valuemask = 0; XColor color_info; unsigned int color_table [MAX_COLORS]; unsigned short color_data [MAX_COLORS][3]; /* window buffers */ Pixmap double_buffer; /* misc window info */ char *display_name = NULL; char *window_name = "XInvaders 3D"; XTextProperty wname; char *font_name = "10x20"; unsigned int window_width, window_height, display_width, display_height; Atom wmDeleteMessage; /*------------------------------------------------------------------ * main * * ------------------------------------------------------------------*/ int main ( int argc, char **argv ) { int i; #ifdef __FreeBSD__ fpsetmask(0); #endif if ( !Graphics_init ( WIN_WIDTH, WIN_HEIGHT ) ) { fprintf ( stderr, "Error: could not initialize graphics!\n" ); exit ( -1 ); } if ( !Game_init ( WIN_WIDTH, WIN_HEIGHT ) ) { Graphics_shutdown (); fprintf ( stderr, "Error: could not initialize game data!\n" ); exit ( -1 ); } Game_main (); Graphics_shutdown (); /* print contact information */ i = 0; while ( game_about_info[i] ) { fprintf ( stderr, "%s\n", game_about_info[i] ); i++; } return 0; } /*================================================================*/ int Graphics_init ( unsigned int win_width, unsigned int win_height ) { int i, j; window_width = win_width; window_height = win_height; display = XOpenDisplay ( display_name ); if ( !display ) return FALSE; screen_num = DefaultScreen ( display ); screen_ptr = DefaultScreenOfDisplay ( display ); win = XCreateSimpleWindow ( display, RootWindow ( display, screen_num ), 0, 0, window_width, window_height, 1, BlackPixel ( display, screen_num ), WhitePixel ( display, screen_num ) ); XSelectInput ( display, win, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask ); XStringListToTextProperty ( &window_name, 1, &wname ); XSetWMProperties ( display, win, &wname, NULL, NULL, 0, NULL, NULL, NULL ); /* create GCs for clearing, text, & drawing */ black_gc = XCreateGC ( display, win, gc_valuemask, &gc_values ); color_gc = XCreateGC ( display, win, gc_valuemask, &gc_values ); text_gc = XCreateGC ( display, win, gc_valuemask, &gc_values ); /* Get atom and indicate X11 client is willing to participate */ wmDeleteMessage = XInternAtom ( display, "WM_DELETE_WINDOW", False ); XSetWMProtocols ( display, win, &wmDeleteMessage, 1 ); /* load default font */ font_info = XLoadQueryFont ( display, font_name ); if ( !font_info ) perror ( "WARNING: could not load default font.\n" ); else XSetFont ( display, text_gc, font_info->fid ); /* load default color scheme */ /* red */ for ( i=0, j=0; i<64; i++, j++ ) { color_data[i][0] = 1024 * j; color_data[i][1] = color_data[i][2] = 0; } /* green */ for ( i=64, j=0; i<128; i++, j++ ) { color_data[i][1] = 1024 * j; color_data[i][0] = color_data[i][2] = 0; } /* blue */ for ( i=128, j=0; i<192; i++, j++ ) { color_data[i][2] = 1024 * j; color_data[i][0] = color_data[i][1] = 0; } /* white */ for ( i=192, j=0; i<256; i++, j++ ) { color_data[i][0] = color_data[i][1] = color_data[i][2] = j * 1024; } /* yellow */ color_data[192][0] = 63 * 1024; color_data[192][1] = 63 * 1024; color_data[192][2] = 32 * 1024; for ( i=0; ifid ); XFreeGC ( display, black_gc ); XFreeGC ( display, color_gc ); XFreeGC ( display, text_gc ); XAutoRepeatOn ( display ); XCloseDisplay ( display ); free ( wname.value ); } /*================================================================*/ int Update_display ( void ) { XCopyArea ( display, double_buffer, win, black_gc, 0, 0, window_width, window_height, 0, 0 ); XFillRectangle ( display, double_buffer, black_gc, 0, 0, window_width, window_height ); return TRUE; } /*================================================================*/ int Handle_events ( void ) { XEvent event; KeySym keysym; XSync ( display, False ); while ( XPending ( display ) ) { XNextEvent ( display, &event ); switch ( event.type ) { case Expose: break; case EnterNotify: /* turn off auto-repeat */ XAutoRepeatOff ( display ); break; case LeaveNotify: /* turn on auto-repeat */ XAutoRepeatOn ( display ); break; case KeyPress: keysym = XLookupKeysym ( &(event.xkey), 0 ); switch ( keysym ) { case XK_space: gv->key_FIRE1 = TRUE; break; case XK_Up: case XK_KP_Up: gv->key_UP1 = TRUE; break; case XK_Down: case XK_KP_Down: gv->key_DOWN1 = TRUE; break; case XK_Left: case XK_KP_Left: gv->key_LEFT1 = TRUE; break; case XK_Right: case XK_KP_Right: gv->key_RIGHT1 = TRUE; break; case XK_a: case XK_A: gv->key_FIRE2 = TRUE; break; case XK_i: case XK_I: gv->key_UP2 = TRUE; break; case XK_m: case XK_M: gv->key_DOWN2 = TRUE; break; case XK_j: case XK_J: gv->key_LEFT2 = TRUE; break; case XK_k: case XK_K: gv->key_RIGHT2 = TRUE; break; case XK_f: case XK_F: /* display frames per second */ gv->display_fps ^= TRUE; break; case XK_p: case XK_P: /* pause */ Game_paused_toggle (); break; case XK_q: case XK_Q: Game_reset (); break; case XK_Escape: /* quit! */ return FALSE; break; case XK_1: gv->key_1PLAYER = TRUE; break; case XK_2: gv->key_DUELPLAY_H = TRUE; break; case XK_3: gv->key_DUELPLAY_V = TRUE; break; case XK_4: gv->key_DUELPLAY = TRUE; break; default: break; } break; case KeyRelease: keysym = XLookupKeysym ( &(event.xkey), 0 ); switch ( keysym ) { case XK_space: gv->key_FIRE1 = FALSE; break; case XK_Up: case XK_KP_Up: gv->key_UP1 = FALSE; break; case XK_Down: case XK_KP_Down: gv->key_DOWN1 = FALSE; break; case XK_Left: case XK_KP_Left: gv->key_LEFT1 = FALSE; break; case XK_Right: case XK_KP_Right: gv->key_RIGHT1 = FALSE; break; case XK_a: case XK_A: gv->key_FIRE2 = FALSE; break; case XK_i: case XK_I: gv->key_UP2 = FALSE; break; case XK_m: case XK_M: gv->key_DOWN2 = FALSE; break; case XK_j: case XK_J: gv->key_LEFT2 = FALSE; break; case XK_k: case XK_K: gv->key_RIGHT2 = FALSE; break; case XK_1: gv->key_1PLAYER = FALSE; break; case XK_2: gv->key_DUELPLAY_H = FALSE; break; case XK_3: gv->key_DUELPLAY_V = FALSE; break; case XK_4: gv->key_DUELPLAY = FALSE; break; default: break; } break; case ClientMessage: if ( event.xclient.data.l[0] >= 0 && ((unsigned long int) \ event.xclient.data.l[0]) == wmDeleteMessage ) { /* titlebar quit! */ return FALSE; } break; default: break; } } return TRUE; } /*================================================================*/ void Draw_line ( int x0, int y0, int x1, int y1, unsigned int color ) { XSetForeground ( display, color_gc, color_table[color] ); XDrawLine ( display, double_buffer, color_gc, x0, y0, x1, y1 ); } /*================================================================*/ void Draw_point ( int x0, int y0, unsigned int color ) { XSetForeground ( display, color_gc, color_table[color] ); XFillRectangle ( display, double_buffer, color_gc, x0-3, y0+3, 3, 3 ); } /*================================================================*/ void Draw_text ( char *message, int x0, int y0, unsigned int color ) { XSetForeground ( display, text_gc, color_table[color] ); XDrawString ( display, double_buffer, text_gc, x0, y0, message, strlen ( message ) ); } /*================================================================*/ /*------------------------------------------------------------------ * * System msec & sec Timer functions * ------------------------------------------------------------------*/ void Timer_init ( TIMER *t ) { t->init_time_stamp = time ( NULL ); gettimeofday ( &(t->t0), NULL ); gettimeofday ( &(t->t1), NULL ); } /*================================================================*/ CLOCK_T Timer_ticks ( void ) { return clock (); } /*================================================================*/ double Timer_sec ( TIMER *t ) { return difftime ( time(NULL), t->init_time_stamp ); } /*================================================================*/ long Timer_msec ( TIMER *t ) { long msec; if ( gettimeofday ( &(t->t1), NULL ) < 0 ) return -1; msec = ((t->t1.tv_sec-t->t0.tv_sec)*1000L)+ ((t->t1.tv_usec-t->t0.tv_usec)/1000L); if ( msec > 0) { /* we need to update right away for slow computers, but for * really fast computers we need to accumilate time before * we can update these values. Seconds followed loosely. */ t->t0.tv_usec += msec*1000; if ( t->t0.tv_usec >= 1000000 ) { t->t0.tv_usec -= 1000000; t->t0.tv_sec = t->t1.tv_sec; } } return msec; } /*================================================================*/ JoesCat-xinvaders3d-030b568/mat4x4.c000066400000000000000000000150401506711671200170360ustar00rootroot00000000000000/*------------------------------------------------------------------ mat4x4.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #include #include #include #include #include "mat4x4.h" /*================================================================*/ void Matrix_id ( MAT a ) { memset ( a, 0, sizeof ( MAT ) ); a[0][0] = a[1][1] = a[2][2] = a[3][3] = 1.0f; } /*================================================================*/ void Matrix_zero ( MAT a ) { memset ( a, 0, sizeof (MAT ) ); } /*================================================================*/ void Matrix_copy ( MAT a, MAT b ) { memcpy ( b, a, sizeof ( MAT ) ); } /*================================================================*/ void Matrix_print ( MAT a ) { int i, j; for ( i=0; i<4; i++ ) { for (j=0; j<4; j++ ) fprintf ( stderr, "%5.5f ", a[i][j] ); fprintf ( stderr, "\n" ); } } /*================================================================*/ void Matrix_mult ( MAT a, MAT b, MAT c ) { int i; for ( i=0; i<4; i++ ) { c[i][0] = ( a[i][0] * b[0][0] ) + ( a[i][1] * b[1][0] ) + ( a[i][2] * b[2][0] ) + ( a[i][3] * b[3][0] ); c[i][1] = ( a[i][0] * b[0][1] ) + ( a[i][1] * b[1][1] ) + ( a[i][2] * b[2][1] ) + ( a[i][3] * b[3][1] ); c[i][2] = ( a[i][0] * b[0][2] ) + ( a[i][1] * b[1][2] ) + ( a[i][2] * b[2][2] ) + ( a[i][3] * b[3][2] ); c[i][3] = ( a[i][0] * b[0][3] ) + ( a[i][1] * b[1][3] ) + ( a[i][2] * b[2][3] ) + ( a[i][3] * b[3][3] ); } } /*================================================================*/ void Matrix_transpose ( MAT a, MAT b ) { b[0][0] = a[0][0]; b[0][1] = a[1][0]; b[0][2] = a[2][0]; b[0][3] = b[3][0]; b[1][0] = a[0][1]; b[1][1] = a[1][1]; b[1][2] = a[2][1]; b[1][3] = b[3][1]; b[2][0] = a[0][2]; b[2][1] = a[1][2]; b[2][2] = a[2][2]; b[2][3] = b[3][2]; b[3][0] = a[0][3]; b[3][1] = a[1][3]; b[3][2] = a[2][3]; b[3][3] = b[3][3]; } /*================================================================*/ void Matrix_vec_mult ( MAT a, VEC b, VEC c ) { c[0] = ( a[0][0] * b[0] ) + ( a[0][1] * b[1] ) + ( a[0][2] * b[2] ) + ( a[0][3] * b[3] ); c[1] = ( a[1][0] * b[0] ) + ( a[1][1] * b[1] ) + ( a[1][2] * b[2] ) + ( a[1][3] * b[3] ); c[2] = ( a[2][0] * b[0] ) + ( a[2][1] * b[1] ) + ( a[2][2] * b[2] ) + ( a[2][3] * b[3] ); c[3] = ( a[3][0] * b[0] ) + ( a[3][1] * b[1] ) + ( a[3][2] * b[2] ) + ( a[3][3] * b[3] ); } /*================================================================*/ void Matrix_vec_multn ( MAT a, VEC b[], VEC c[], int num ) { int i; for ( i=0; i #include #include #include "mat4x4.h" #include "vec4x1.h" #include "defines.h" #include "object.h" /*================================================================*/ void Objlist_clear ( OBJLIST *lst ) { lst->obj_count = 0; lst->head = NULL; lst->tail = NULL; } /*================================================================*/ void Objlist_add ( OBJLIST *lst, OBJECT *obj ) { OBJECT *tmp; if ( lst->head ) { tmp = lst->tail; lst->tail->next = obj; /* move tail forward */ lst->tail = lst->tail->next; lst->tail->prev = tmp; lst->tail->next = NULL; } /* empty list so initialize head and tail */ else { lst->head = lst->tail = obj; lst->head->prev = lst->tail->prev = NULL; lst->head->next = lst->tail->next = NULL; } lst->obj_count++; } /*================================================================*/ void Objlist_del ( OBJLIST *lst, OBJECT *obj ) { if ( lst->head ) { /* is the object at the head of the list */ if ( obj->prev == NULL ) { /* is object both at head and tail */ if ( obj->next == NULL ) { lst->head = lst->tail = NULL; obj->next = obj->prev = NULL; } else { lst->head = obj->next; lst->head->prev = NULL; } } /* is the object at the end of the list */ else if ( obj->next == NULL ) { lst->tail = obj->prev; lst->tail->next = NULL; } /* otherwise object somewhere in the list */ else { obj->prev->next = obj->next; obj->next->prev = obj->prev; } obj->next = obj->prev = NULL; lst->obj_count--; } } /*================================================================*/ int Objlist_count ( OBJLIST *lst ) { return lst->obj_count; } /*================================================================*/ OBJECT * Object_new ( void ) { OBJECT *obj; obj = ( OBJECT * ) malloc ( sizeof ( OBJECT ) ); return obj; } /*================================================================*/ void Object_delete ( OBJECT *obj ) { free ( obj ); obj = NULL; } /*================================================================*/ void Object_init ( OBJECT *obj ) { obj->active = FALSE; obj->frame = 0L; obj->delay = 0L; obj->max_frame = 0L; obj->zone = 0L; obj->zheight = 0L; Vector_init ( obj->pos ); Vector_init ( obj->old_pos ); Vector_init ( obj->dir ); Vector_init ( obj->thrust ); obj->actionfn = NULL; obj->drawfn = NULL; obj->next = NULL; obj->prev = NULL; } /*================================================================*/ void Object_set_actionfn ( OBJECT *obj, PFV1 actionfn ) { obj->actionfn = actionfn; } /*================================================================*/ void Object_set_drawfn ( OBJECT *obj, PFV2 drawfn ) { obj->drawfn = drawfn; } /*================================================================*/ void Object_set_model ( OBJECT *obj, MODEL *model ) { obj->model = model; } /*================================================================*/ void Object_set_pos ( OBJECT *obj, VEC pos ) { Vector_copy ( pos, obj->pos ); } /*================================================================*/ void Object_get_pos ( OBJECT *obj, VEC pos ) { Vector_copy ( obj->pos, pos ); } /*================================================================*/ void Object_set_dir ( OBJECT *obj, VEC dir ) { Vector_copy ( dir, obj->dir ); } /*================================================================*/ void Object_get_dir ( OBJECT *obj, VEC dir ) { Vector_copy ( obj->dir, dir ); } /*================================================================*/ void Object_draw ( OBJECT *obj ) { } /*================================================================*/ JoesCat-xinvaders3d-030b568/object.h000066400000000000000000000060051506711671200171710ustar00rootroot00000000000000/*------------------------------------------------------------------ object.h: Model Data, Object, and Object-List managment struct & functions XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #ifndef OBJECT_HEADER #define OBJECT_HEADER typedef struct MODELSTRUCT MODEL; typedef struct OBJECTSTRUCT OBJECT; typedef struct OBJLISTSTRUCT OBJLIST; typedef void (*PFV1) ( OBJECT * ); typedef void (*PFV2) ( OBJECT *, MAT, MAT ); /*------------------------------------------------------------------ * MODEL: * Model data management Struct & Funtions * ------------------------------------------------------------------*/ struct MODELSTRUCT { int num_vertex; int num_polys; }; /*------------------------------------------------------------------ * OBJECT: * Object Managment Struct & Funtions * ------------------------------------------------------------------*/ struct OBJECTSTRUCT { int active; long frame; long delay; long max_frame; int zone; int zheight; int vpos; float radius; float radius_squared; double rot; VEC pos; VEC old_pos; VEC dir; VEC thrust; PFV1 actionfn; PFV2 drawfn; MODEL *model; OBJECT *next; OBJECT *prev; }; extern OBJECT * Object_new ( void ); extern void Object_delete ( OBJECT * ); extern void Object_init ( OBJECT * ); extern void Object_set_actionfn ( OBJECT *, PFV1 ); extern void Object_set_drawfn ( OBJECT *, PFV2 ); extern void Object_set_model ( OBJECT *, MODEL * ); extern void Object_set_pos ( OBJECT *, VEC ); extern void Object_get_pos ( OBJECT *, VEC ); extern void Object_set_dir ( OBJECT *, VEC ); extern void Object_get_dir ( OBJECT *, VEC ); extern void Object_draw ( OBJECT * ); /*------------------------------------------------------------------ * OBJLIST: * gobject list managment struct & routines * ------------------------------------------------------------------*/ struct OBJLISTSTRUCT { int obj_count; OBJECT *head; OBJECT *tail; }; extern void Objlist_clear ( OBJLIST * ); extern void Objlist_add ( OBJLIST *, OBJECT * ); extern void Objlist_del ( OBJLIST *, OBJECT * ); extern int Objlist_count ( OBJLIST * ); #endif JoesCat-xinvaders3d-030b568/packaging/000077500000000000000000000000001506711671200174755ustar00rootroot00000000000000JoesCat-xinvaders3d-030b568/packaging/xinvaders3d.spec.in000066400000000000000000000030131506711671200232050ustar00rootroot00000000000000Name: @make_as_xinvaders3d@ Version: @XINVADERS3D_VERSION@ Release: 0 Summary: 3D space-invaders clone on X Window System. License: GPLv2+ Group: Games/Arcade Url: https://github.com/JoesCat/xinvaders3d/ Source0: https://github.com/JoesCat/xinvaders3d/archive/%{version}/%{name}-dist-%{version}.tar.gz BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc BuildRequires: make BuildRequires: pkgconfig(x11) %description XInvaders 3D is a 3D vector-based space-invaders clone for the X Window System. You are a lone star fighter facing endless waves of space aliens. Your sole objective is to shoot down as many aliens as you can. All objects are represented with 3D vector graphics, allowing the aliens to grow in size as they move closer to you. %prep %setup ‑q %build #%autoreconf -i #%automake %configure --bindir=%{_gamesbindir} %make_build %install %make_install bindir=%{_gamesbindir} datadir=%{_datadir} mandir=%{_mandir} %clean rm -rf $RPM_BUILD_ROOT %files %doc %attr(0644, root, man) %{_mandir}/man6/%{name}.6* %attr(0755, root, games) %{_gamesbindir}/%{name} %{_datadir}/appdata/%{name}.appdata.xml %{_datadir}/applications/%{name}.desktop %{_iconsdir}/hicolor/128x128/apps/%{name}.png %{_iconsdir}/hicolor/256x256/apps/%{name}.png %{_iconsdir}/hicolor/32x32/apps/%{name}.png %{_iconsdir}/hicolor/64x64/apps/%{name}.png %{_iconsdir}/hicolor/scalable/apps/%{name}.svgz %{_datadir}/metainfo/%{name}.metainfo.xml %{_datadir}/mime/packages/%{name}.xml %{_datadir}/pixmaps/%{name}.png %{_datadir}/pixmaps/%{name}.xpm JoesCat-xinvaders3d-030b568/player.c000066400000000000000000001021371506711671200172150ustar00rootroot00000000000000/*------------------------------------------------------------------ player.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis +Copyright(C) 2023 Jose Da Silva 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 ------------------------------------------------------------------*/ #include "game.h" /*================================================================*/ #define PLAYER_RADIUS 20.0f #define PLAYER_RADIUS_SQUARED 400.0f #define MISSLE_RADIUS 20.0f #define MISSLE_RADIUS_SQUARED 400.0f #define MAX_X 550.0f #define MIN_X -550.0f #define MAX_Y 450.0f #define MIN_Y 50.0f #define ROT_Z 0.087266463 /* 5 degrees per frame */ #define MAX_ROT 0.785398163 /* max of 45 degrees */ enum player_enum { PLAYER_BLINK = TRUE, PLAYER_BLINK_TIME = 5000 /* 5.0 sec */ }; OBJECT player_1, player_2, *player1, *player2; OBJECT player_missile1, player_missile2, *pm1, *pm2; static VEC start_pos = { 0.0f, 250.0f, -25.0f, 1.0f }; static VEC start_dir = { 0.0f, 0.0f, -1.0f, 1.0f }; static VEC thrust_up = { 0.0f, 10.0f, 0.0f, 1.0f }; static VEC thrust_down = { 0.0f, -10.0f, 0.0f, 1.0f }; static VEC thrust_left = { -10.0f, 0.0f, 0.0f, 1.0f }; static VEC thrust_right = { 10.0f, 0.0f, 0.0f, 1.0f }; static VEC missile_offset = { 0.0f, 0.0f, 0.0f, 1.0f }; static VEC missile_thrust = { 0.0f, 0.0f, -50.0f, 1.0f }; static int pcolor1, pcolor2; /* Player colors */ /*================================================================*/ void Player_init ( int pnum ) { if ( pnum ) { player2 = &player_2; gv->pblink2 = TRUE; Object_init ( player2 ); Object_set_actionfn ( player2, Player_update2 ); Object_set_drawfn ( player2, Player_blink2 ); Object_set_pos ( player2, start_pos ); Object_set_dir ( player2, start_dir ); player2->active = TRUE; player2->radius = PLAYER_RADIUS; player2->radius_squared = PLAYER_RADIUS_SQUARED; player2->frame = 0; player2->rot = 0.0; pcolor2 = BLUE; Object_update_zone ( player2 ); pm2 = &player_missile2; Object_init ( pm2 ); pm2->radius = MISSLE_RADIUS; pm2->radius_squared = MISSLE_RADIUS_SQUARED; Object_set_actionfn ( pm2, Player_missile_update ); Object_set_drawfn ( pm2, Player_missile_draw2 ); } else { player1 = &player_1; gv->pblink1 = TRUE; Object_init ( player1 ); Object_set_actionfn ( player1, Player_update1 ); Object_set_drawfn ( player1, Player_blink1 ); Object_set_pos ( player1, start_pos ); Object_set_dir ( player1, start_dir ); player1->active = TRUE; player1->radius = PLAYER_RADIUS; player1->radius_squared = PLAYER_RADIUS_SQUARED; player1->frame = 0; player1->rot = 0.0; pcolor1 = RED; Object_update_zone ( player1 ); pm1 = &player_missile1; Object_init ( pm1 ); pm1->radius = MISSLE_RADIUS; pm1->radius_squared = MISSLE_RADIUS_SQUARED; Object_set_actionfn ( pm1, Player_missile_update ); Object_set_drawfn ( pm1, Player_missile_draw1 ); } } /*================================================================*/ void Player_update1 ( OBJECT *obj ) { if ( gv->key_UP1 ) { obj->pos[YPOS] += thrust_up[YPOS] * gv->fadjust; Object_update_zone ( obj ); if ( obj->pos[YPOS] > MAX_Y ) obj->pos[YPOS] = MAX_Y; } if ( gv->key_DOWN1 ) { obj->pos[YPOS] += thrust_down[YPOS] * gv->fadjust; Object_update_zone ( obj ); if ( obj->pos[YPOS] < MIN_Y ) obj->pos[YPOS] = MIN_Y; } if ( gv->key_LEFT1 ) { obj->pos[XPOS] += thrust_left[XPOS] * gv->fadjust; player1->rot += ROT_Z * gv->fadjust; if ( obj->pos[XPOS] < MIN_X ) obj->pos[XPOS] = MIN_X; if ( player1->rot > MAX_ROT ) player1->rot = MAX_ROT; } if ( gv->key_RIGHT1 ) { obj->pos[XPOS] += thrust_right[XPOS] * gv->fadjust; player1->rot -= ROT_Z * gv->fadjust; if ( obj->pos[XPOS] > MAX_X ) obj->pos[XPOS] = MAX_X; if ( player1->rot < -MAX_ROT ) player1->rot = -MAX_ROT; } if ( player1->rot && gv->key_LEFT1 == FALSE && gv->key_RIGHT1 == FALSE ) { if ( player1->rot > 0 ) { player1->rot -= ROT_Z * gv->fadjust; if ( player1->rot < 0 ) player1->rot = 0; } else { player1->rot += ROT_Z * gv->fadjust; if ( player1->rot > 0 ) player1->rot = 0; } } if ( gv->key_FIRE1 && !pm1->active ) { pm1->active = TRUE; pm1->zone = obj->zone; pm1->zheight = obj->zheight; Vector_init ( pm1->pos ); Vector_copy ( obj->pos, pm1->pos ); Vector_copy ( obj->pos, pm1->old_pos ); Vector_addd ( pm1->pos, missile_offset ); } } void Player_update2 ( OBJECT *obj ) { if ( gv->key_UP2 ) { obj->pos[YPOS] += thrust_up[YPOS] * gv->fadjust; Object_update_zone ( obj ); if ( obj->pos[YPOS] > MAX_Y ) obj->pos[YPOS] = MAX_Y; } if ( gv->key_DOWN2 ) { obj->pos[YPOS] += thrust_down[YPOS] * gv->fadjust; Object_update_zone ( obj ); if ( obj->pos[YPOS] < MIN_Y ) obj->pos[YPOS] = MIN_Y; } if ( gv->key_LEFT2 ) { obj->pos[XPOS] += thrust_left[XPOS] * gv->fadjust; player2->rot += ROT_Z * gv->fadjust; if ( obj->pos[XPOS] < MIN_X ) obj->pos[XPOS] = MIN_X; if ( player2->rot > MAX_ROT ) player2->rot = MAX_ROT; } if ( gv->key_RIGHT2 ) { obj->pos[XPOS] += thrust_right[XPOS] * gv->fadjust; player2->rot -= ROT_Z * gv->fadjust; if ( obj->pos[XPOS] > MAX_X ) obj->pos[XPOS] = MAX_X; if ( player2->rot < -MAX_ROT ) player2->rot = -MAX_ROT; } if ( player2->rot && gv->key_LEFT2 == FALSE && gv->key_RIGHT2 == FALSE ) { if ( player2->rot > 0 ) { player2->rot -= ROT_Z * gv->fadjust; if ( player2->rot < 0 ) player2->rot = 0; } else { player2->rot += ROT_Z * gv->fadjust; if ( player2->rot > 0 ) player2->rot = 0; } } if ( gv->key_FIRE2 && !pm2->active ) { pm2->active = TRUE; pm2->zone = obj->zone; pm2->zheight = obj->zheight; Vector_init ( pm2->pos ); Vector_copy ( obj->pos, pm2->pos ); Vector_copy ( obj->pos, pm2->old_pos ); Vector_addd ( pm2->pos, missile_offset ); } } void Player_blink1 ( OBJECT *obj, MAT r1, MAT r2 ) { static long blink = 0; static int color = 0; blink += gv->msec; if ( blink > 50 ) { blink -= 250; color++; if ( color >= 3 ) color = 0; } pcolor1 = RED - color * 15; obj->frame += gv->msec; if ( obj->frame > PLAYER_BLINK_TIME ) { pcolor1 = RED; gv->pblink1 = FALSE; Object_set_drawfn ( obj, Player_draw1 ); } Player_draw1 ( obj, r1, r2 ); } void Player_blink2 ( OBJECT *obj, MAT r1, MAT r2 ) { static long blink = 0; static int color = 0; blink += gv->msec; if ( blink > 50 ) { blink -= 250; color++; if ( color >= 3 ) color = 0; } pcolor2 = BLUE - color * 15; obj->frame += gv->msec; if ( obj->frame > PLAYER_BLINK_TIME ) { pcolor2 = BLUE; gv->pblink2 = FALSE; Object_set_drawfn ( obj, Player_draw2 ); } Player_draw2 ( obj, r1, r2 ); } static VEC player_vert [16] = { { -5.0f, 0.0f, 15.0f, 1.0f }, /*body*/ { -10.0f, 0.0f, -20.0f, 1.0f }, { 10.0f, 0.0f, -20.0f, 1.0f }, { 5.0f, 0.0f, 15.0f, 1.0f }, { -5.0f, 10.0f, -18.0f, 1.0f }, { 5.0f, 10.0f, -18.0f, 1.0f }, { -5.0f, 0.0f, 20.0f, 1.0f }, /* left e*/ { -10.0f, 0.0f, -15.0f, 1.0f }, { -12.0f, 0.0f, -12.0f, 1.0f }, { -10.0f, 0.0f, 25.0f, 1.0f }, { 5.0f, 0.0f, 20.0f, 1.0f }, /* re */ { 10.0f, 0.0f, -15.0f, 1.0f }, { 12.0f, 0.0f, -12.0f, 1.0f }, { 10.0f, 0.0f, 25.0f, 1.0f }, { -20.0f, -5.0f, 35.0f, 1.0f }, /*lw*/ { 20.0f, -5.0f, 35.0f, 1.0f } }; /*rw*/ static VEC player_vert1 [16] = { { -5.0f, 0.0f, 15.0f, 1.0f }, /*body*/ { -10.0f, 0.0f, -20.0f, 1.0f }, { 10.0f, 0.0f, -20.0f, 1.0f }, { 5.0f, 0.0f, 15.0f, 1.0f }, { -5.0f, 10.0f, -18.0f, 1.0f }, { 5.0f, 10.0f, -18.0f, 1.0f }, { -5.0f, 0.0f, 20.0f, 1.0f }, /* left e*/ { -10.0f, 0.0f, -15.0f, 1.0f }, { -12.0f, 0.0f, -12.0f, 1.0f }, { -10.0f, 0.0f, 25.0f, 1.0f }, { 5.0f, 0.0f, 20.0f, 1.0f }, /* re */ { 10.0f, 0.0f, -15.0f, 1.0f }, { 12.0f, 0.0f, -12.0f, 1.0f }, { 10.0f, 0.0f, 25.0f, 1.0f }, { -20.0f, -5.0f, 35.0f, 1.0f }, /*lw*/ { 20.0f, -5.0f, 35.0f, 1.0f } }; /*rw*/ static VEC cross_hairs[4] = { { -15.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 15.0f, 0.0f, 1.0f }, { 15.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, -15.0f, 0.0f, 1.0f } }; void Player_draw1 ( OBJECT *obj, MAT r1, MAT r2 ) { int pcol, p1[32], p2[32]; int i, x1R, y1B, x2L, y2T; VEC tmp[16], rot_vert[16]; MAT tmp_mat, rot_mat; VEC offset; x1R = gv->x1r; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; pcol = pcolor1; if ( gv->pduel ) { Matrix_vec_mult ( r2, obj->pos, tmp[0] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_z_rot ( rot_mat, player1->rot ); Matrix_vec_multn ( rot_mat, player_vert, rot_vert, 16 ); Matrix_vec_multn ( tmp_mat, rot_vert, tmp, 16 ); Camera_project_points ( tmp, p2, 16 ); } Matrix_vec_mult ( r1, obj->pos, tmp[0] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_z_rot ( rot_mat, player1->rot ); Matrix_vec_multn ( rot_mat, player_vert, rot_vert, 16 ); Matrix_vec_multn ( tmp_mat, rot_vert, tmp, 16 ); Camera_project_points ( tmp, p1, 16 ); if ( gv->pduel ) { if ( gv->phorizontal ) { for ( i = 1; i < 32; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } else if ( gv->pvertical ) { for ( i = 0; i < 32; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } } else { for ( i = 0; i < 32; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } for ( i = 1; i < 32; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } /* body bottom */ if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], pcol ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], pcol ); if ( p2[4] >= x2L && p2[6] >= x2L && \ p2[5] >= y2T && p2[7] >= y2T ) Draw_line ( p2[4], p2[5], p2[6], p2[7], pcol ); if ( p2[6] >= x2L && p2[0] >= x2L && \ p2[7] >= y2T && p2[1] >= y2T ) Draw_line ( p2[6], p2[7], p2[0], p2[1], pcol ); /* body top */ if ( p2[0] >= x2L && p2[8] >= x2L && \ p2[1] >= y2T && p2[9] >= y2T ) Draw_line ( p2[0], p2[1], p2[8], p2[9], pcol ); if ( p2[2] >= x2L && p2[2] >= x2L && \ p2[3] >= y2T && p2[3] >= y2T ) Draw_line ( p2[8], p2[9], p2[2], p2[3], pcol ); if ( p2[4] >= x2L && p2[10] >= x2L && \ p2[5] >= y2T && p2[11] >= y2T ) Draw_line ( p2[4], p2[5], p2[10], p2[11], pcol ); if ( p2[10] >= x2L && p2[6] >= x2L && \ p2[11] >= y2T && p2[7] >= y2T ) Draw_line ( p2[10], p2[11], p2[6], p2[7], pcol ); if ( p2[8] >= x2L && p2[10] >= x2L && \ p2[9] >= y2T && p2[11] >= y2T ) Draw_line ( p2[8], p2[9], p2[10], p2[11], pcol ); /* left e */ if ( p2[12] >= x2L && p2[14] >= x2L && \ p2[13] >= y2T && p2[15] >= y2T ) Draw_line ( p2[12], p2[13], p2[14], p2[15], pcol ); if ( p2[14] >= x2L && p2[16] >= x2L && \ p2[15] >= y2T && p2[17] >= y2T ) Draw_line ( p2[14], p2[15], p2[16], p2[17], pcol ); if ( p2[16] >= x2L && p2[18] >= x2L && \ p2[17] >= y2T && p2[19] >= y2T ) Draw_line ( p2[16], p2[17], p2[18], p2[19], pcol ); if ( p2[18] >= x2L && p2[12] >= x2L && \ p2[19] >= y2T && p2[13] >= y2T ) Draw_line ( p2[18], p2[19], p2[12], p2[13], pcol ); /* right e */ if ( p2[20] >= x2L && p2[22] >= x2L && \ p2[21] >= y2T && p2[23] >= y2T ) Draw_line ( p2[20], p2[21], p2[22], p2[23], pcol ); if ( p2[22] >= x2L && p2[24] >= x2L && \ p2[23] >= y2T && p2[25] >= y2T ) Draw_line ( p2[22], p2[23], p2[24], p2[25], pcol ); if ( p2[24] >= x2L && p2[26] >= x2L && \ p2[25] >= y2T && p2[27] >= y2T ) Draw_line ( p2[24], p2[25], p2[26], p2[27], pcol ); if ( p2[26] >= x2L && p2[20] >= x2L && \ p2[27] >= y2T && p2[21] >= y2T ) Draw_line ( p2[26], p2[27], p2[20], p2[21], pcol ); /* left wing */ if ( p2[28] >= x2L && p2[16] >= x2L && \ p2[29] >= y2T && p2[17] >= y2T ) Draw_line ( p2[28], p2[29], p2[16], p2[17], pcol ); if ( p2[28] >= x2L && p2[18] >= x2L && \ p2[29] >= y2T && p2[19] >= y2T ) Draw_line ( p2[28], p2[29], p2[18], p2[19], pcol ); /* right wing */ if ( p2[30] >= x2L && p2[24] >= x2L && \ p2[31] >= y2T && p2[25] >= y2T ) Draw_line ( p2[30], p2[31], p2[24], p2[25], pcol ); if ( p2[30] >= x2L && p2[26] >= x2L && \ p2[31] >= y2T && p2[27] >= y2T ) Draw_line ( p2[30], p2[31], p2[26], p2[27], pcol ); } /* body bottom */ if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], pcol ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], pcol ); if ( p1[4] < x1R && p1[6] < x1R && \ p1[5] < y1B && p1[7] < y1B ) Draw_line ( p1[4], p1[5], p1[6], p1[7], pcol ); if ( p1[6] < x1R && p1[0] < x1R && \ p1[7] < y1B && p1[1] < y1B ) Draw_line ( p1[6], p1[7], p1[0], p1[1], pcol ); /* body top */ if ( p1[0] < x1R && p1[8] < x1R && \ p1[1] < y1B && p1[9] < y1B ) Draw_line ( p1[0], p1[1], p1[8], p1[9], pcol ); if ( p1[8] < x1R && p1[2] < x1R && \ p1[9] < y1B && p1[3] < y1B ) Draw_line ( p1[8], p1[9], p1[2], p1[3], pcol ); if ( p1[4] < x1R && p1[10] < x1R && \ p1[5] < y1B && p1[11] < y1B ) Draw_line ( p1[4], p1[5], p1[10], p1[11], pcol ); if ( p1[10] < x1R && p1[6] < x1R && \ p1[11] < y1B && p1[7] < y1B ) Draw_line ( p1[10], p1[11], p1[6], p1[7], pcol ); if ( p1[8] < x1R && p1[10] < x1R && \ p1[9] < y1B && p1[11] < y1B ) Draw_line ( p1[8], p1[9], p1[10], p1[11], pcol ); /* left e */ if ( p1[12] < x1R && p1[14] < x1R && \ p1[13] < y1B && p1[15] < y1B ) Draw_line ( p1[12], p1[13], p1[14], p1[15], pcol ); if ( p1[14] < x1R && p1[16] < x1R && \ p1[15] < y1B && p1[17] < y1B ) Draw_line ( p1[14], p1[15], p1[16], p1[17], pcol ); if ( p1[16] < x1R && p1[18] < x1R && \ p1[17] < y1B && p1[19] < y1B ) Draw_line ( p1[16], p1[17], p1[18], p1[19], pcol ); if ( p1[18] < x1R && p1[12] < x1R && \ p1[19] < y1B && p1[13] < y1B ) Draw_line ( p1[18], p1[19], p1[12], p1[13], pcol ); /* right e */ if ( p1[20] < x1R && p1[22] < x1R && \ p1[21] < y1B && p1[23] < y1B ) Draw_line ( p1[20], p1[21], p1[22], p1[23], pcol ); if ( p1[22] < x1R && p1[24] < x1R && \ p1[23] < y1B && p1[25] < y1B ) Draw_line ( p1[22], p1[23], p1[24], p1[25], pcol ); if ( p1[24] < x1R && p1[26] < x1R && \ p1[25] < y1B && p1[27] < y1B ) Draw_line ( p1[24], p1[25], p1[26], p1[27], pcol ); if ( p1[26] < x1R && p1[20] < x1R && \ p1[27] < y1B && p1[21] < y1B ) Draw_line ( p1[26], p1[27], p1[20], p1[21], pcol ); /* left wing */ if ( p1[28] < x1R && p1[16] < x1R && \ p1[29] < y1B && p1[17] < y1B ) Draw_line ( p1[28], p1[29], p1[16], p1[17], pcol ); if ( p1[28] < x1R && p1[18] < x1R && \ p1[29] < y1B && p1[19] < y1B ) Draw_line ( p1[28], p1[29], p1[18], p1[19], pcol ); /* right wing */ if ( p1[30] < x1R && p1[24] < x1R && \ p1[31] < y1B && p1[25] < y1B ) Draw_line ( p1[30], p1[31], p1[24], p1[25], pcol ); if ( p1[30] < x1R && p1[26] < x1R && \ p1[31] < y1B && p1[27] < y1B ) Draw_line ( p1[30], p1[31], p1[26], p1[27], pcol ); /* update cross-hairs */ Vector_copy ( obj->pos, tmp[0] ); Vector_init ( offset ); offset[ZPOS] = -((gv->formation_zone * 100.0f) + 50.0f); Vector_addd ( tmp[0], offset ); Matrix_vec_mult ( r1, tmp[0], tmp[1] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[1] ); Matrix_vec_multn ( rot_mat, cross_hairs, rot_vert, 4 ); Matrix_vec_multn ( tmp_mat, rot_vert, tmp, 4 ); Camera_project_points ( tmp, p1, 4 ); if ( gv->pduel ) { if ( gv->phorizontal ) { for ( i = 1; i < 8; i += 2 ) p1[i] /= 2; } else if ( gv->pvertical ) { for ( i = 0; i < 8; i += 2 ) p1[i] /= 2; } else { for ( i = 0; i < 8; i++ ) p1[i] /= 2; } } if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], WHITE ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], WHITE ); if ( p1[4] < x1R && p1[6] < x1R && \ p1[5] < y1B && p1[7] < y1B ) Draw_line ( p1[4], p1[5], p1[6], p1[7], WHITE ); if ( p1[6] < x1R && p1[0] < x1R && \ p1[7] < y1B && p1[1] < y1B ) Draw_line ( p1[6], p1[7], p1[0], p1[1], WHITE ); } void Player_draw2 ( OBJECT *obj, MAT r1, MAT r2 ) { int pcol, p1[32], p2[32]; int i, x1R, y1B, x2L, y2T; VEC tmp[16], rot_vert[16]; MAT tmp_mat, rot_mat; VEC offset; x1R = gv->x1r; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; pcol = pcolor2; Matrix_vec_mult ( r1, obj->pos, tmp[0] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_z_rot ( rot_mat, player2->rot ); Matrix_vec_multn ( rot_mat, player_vert, rot_vert, 16 ); Matrix_vec_multn ( tmp_mat, rot_vert, tmp, 16 ); Camera_project_points ( tmp, p1, 16 ); Matrix_vec_mult ( r2, obj->pos, tmp[0] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_z_rot ( rot_mat, player2->rot ); Matrix_vec_multn ( rot_mat, player_vert, rot_vert, 16 ); Matrix_vec_multn ( tmp_mat, rot_vert, tmp, 16 ); Camera_project_points ( tmp, p2, 16 ); if ( gv->phorizontal ) { for ( i = 1; i < 32; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } else if ( gv->pvertical ) { for ( i = 0; i < 32; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } } else { for ( i = 0; i < 32; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } for ( i = 1; i < 32; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } /* body bottom */ if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], pcol ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], pcol ); if ( p1[4] < x1R && p1[6] < x1R && \ p1[5] < y1B && p1[7] < y1B ) Draw_line ( p1[4], p1[5], p1[6], p1[7], pcol ); if ( p1[6] < x1R && p1[0] < x1R && \ p1[7] < y1B && p1[1] < y1B ) Draw_line ( p1[6], p1[7], p1[0], p1[1], pcol ); if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], pcol ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], pcol ); if ( p2[4] >= x2L && p2[6] >= x2L && \ p2[5] >= y2T && p2[7] >= y2T ) Draw_line ( p2[4], p2[5], p2[6], p2[7], pcol ); if ( p2[6] >= x2L && p2[0] >= x2L && \ p2[7] >= y2T && p2[1] >= y2T ) Draw_line ( p2[6], p2[7], p2[0], p2[1], pcol ); /* body top */ if ( p1[0] < x1R && p1[8] < x1R && \ p1[1] < y1B && p1[9] < y1B ) Draw_line ( p1[0], p1[1], p1[8], p1[9], pcol ); if ( p1[8] < x1R && p1[2] < x1R && \ p1[9] < y1B && p1[3] < y1B ) Draw_line ( p1[8], p1[9], p1[2], p1[3], pcol ); if ( p1[4] < x1R && p1[10] < x1R && \ p1[5] < y1B && p1[11] < y1B ) Draw_line ( p1[4], p1[5], p1[10], p1[11], pcol ); if ( p1[10] < x1R && p1[6] < x1R && \ p1[11] < y1B && p1[7] < y1B ) Draw_line ( p1[10], p1[11], p1[6], p1[7], pcol ); if ( p1[8] < x1R && p1[10] < x1R && \ p1[9] < y1B && p1[11] < y1B ) Draw_line ( p1[8], p1[9], p1[10], p1[11], pcol ); if ( p2[0] >= x2L && p2[8] >= x2L && \ p2[1] >= y2T && p2[9] >= y2T ) Draw_line ( p2[0], p2[1], p2[8], p2[9], pcol ); if ( p2[8] >= x2L && p2[2] >= x2L && \ p2[9] >= y2T && p2[3] >= y2T ) Draw_line ( p2[8], p2[9], p2[2], p2[3], pcol ); if ( p2[4] >= x2L && p2[10] >= x2L && \ p2[5] >= y2T && p2[11] >= y2T ) Draw_line ( p2[4], p2[5], p2[10], p2[11], pcol ); if ( p2[10] >= x2L && p2[6] >= x2L && \ p2[11] >= y2T && p2[7] >= y2T ) Draw_line ( p2[10], p2[11], p2[6], p2[7], pcol ); if ( p2[8] >= x2L && p2[10] >= x2L && \ p2[9] >= y2T && p2[11] >= y2T ) Draw_line ( p2[8], p2[9], p2[10], p2[11], pcol ); /* left e */ if ( p1[12] < x1R && p1[14] < x1R && \ p1[13] < y1B && p1[15] < y1B ) Draw_line ( p1[12], p1[13], p1[14], p1[15], pcol ); if ( p1[14] < x1R && p1[16] < x1R && \ p1[15] < y1B && p1[17] < y1B ) Draw_line ( p1[14], p1[15], p1[16], p1[17], pcol ); if ( p1[16] < x1R && p1[18] < x1R && \ p1[17] < y1B && p1[19] < y1B ) Draw_line ( p1[16], p1[17], p1[18], p1[19], pcol ); if ( p1[18] < x1R && p1[12] < x1R && \ p1[19] < y1B && p1[13] < y1B ) Draw_line ( p1[18], p1[19], p1[12], p1[13], pcol ); if ( p2[12] >= x2L && p2[14] >= x2L && \ p2[13] >= y2T && p2[15] >= y2T ) Draw_line ( p2[12], p2[13], p2[14], p2[15], pcol ); if ( p2[14] >= x2L && p2[16] >= x2L && \ p2[15] >= y2T && p2[17] >= y2T ) Draw_line ( p2[14], p2[15], p2[16], p2[17], pcol ); if ( p2[16] >= x2L && p2[18] >= x2L && \ p2[17] >= y2T && p2[19] >= y2T ) Draw_line ( p2[16], p2[17], p2[18], p2[19], pcol ); if ( p2[18] >= x2L && p2[12] >= x2L && \ p2[19] >= y2T && p2[13] >= y2T ) Draw_line ( p2[18], p2[19], p2[12], p2[13], pcol ); /* right e */ if ( p1[20] < x1R && p1[22] < x1R && \ p1[21] < y1B && p1[23] < y1B ) Draw_line ( p1[20], p1[21], p1[22], p1[23], pcol ); if ( p1[22] < x1R && p1[24] < x1R && \ p1[23] < y1B && p1[25] < y1B ) Draw_line ( p1[22], p1[23], p1[24], p1[25], pcol ); if ( p1[24] < x1R && p1[26] < x1R && \ p1[25] < y1B && p1[27] < y1B ) Draw_line ( p1[24], p1[25], p1[26], p1[27], pcol ); if ( p1[26] < x1R && p1[20] < x1R && \ p1[27] < y1B && p1[21] < y1B ) Draw_line ( p1[26], p1[27], p1[20], p1[21], pcol ); if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[20], p2[21], p2[22], p2[23], pcol ); if ( p2[22] >= x2L && p2[24] >= x2L && \ p2[23] >= y2T && p2[25] >= y2T ) Draw_line ( p2[22], p2[23], p2[24], p2[25], pcol ); if ( p2[24] >= x2L && p2[26] >= x2L && \ p2[25] >= y2T && p2[27] >= y2T ) Draw_line ( p2[24], p2[25], p2[26], p2[27], pcol ); if ( p2[26] >= x2L && p2[20] >= x2L && \ p2[27] >= y2T && p2[21] >= y2T ) Draw_line ( p2[26], p2[27], p2[20], p2[21], pcol ); /* left wing */ if ( p1[28] < x1R && p1[16] < x1R && \ p1[29] < y1B && p1[17] < y1B ) Draw_line ( p1[28], p1[29], p1[16], p1[17], pcol ); if ( p1[28] < x1R && p1[18] < x1R && \ p1[29] < y1B && p1[19] < y1B ) Draw_line ( p1[28], p1[29], p1[18], p1[19], pcol ); if ( p2[28] >= x2L && p2[16] >= x2L && \ p2[29] >= y2T && p2[17] >= y2T ) Draw_line ( p2[28], p2[29], p2[16], p2[17], pcol ); if ( p2[28] >= x2L && p2[18] >= x2L && \ p2[29] >= y2T && p2[19] >= y2T ) Draw_line ( p2[28], p2[29], p2[18], p2[19], pcol ); /* right wing */ if ( p1[30] < x1R && p1[24] < x1R && \ p1[31] < y1B && p1[25] < y1B ) Draw_line ( p1[30], p1[31], p1[24], p1[25], pcol ); if ( p1[30] < x1R && p1[26] < x1R && \ p1[31] < y1B && p1[27] < y1B ) Draw_line ( p1[30], p1[31], p1[26], p1[27], pcol ); if ( p2[30] >= x2L && p2[24] >= x2L && \ p2[31] >= y2T && p2[25] >= y2T ) Draw_line ( p2[30], p2[31], p2[24], p2[25], pcol ); if ( p2[30] >= x2L && p2[26] >= x2L && \ p2[31] >= y2T && p2[27] >= y2T ) Draw_line ( p2[30], p2[31], p2[26], p2[27], pcol ); /* update cross-hairs */ Vector_copy ( obj->pos, tmp[0] ); Vector_init ( offset ); offset[ZPOS] = -((gv->formation_zone * 100.0f) + 50.0f); Vector_addd ( tmp[0], offset ); Matrix_vec_mult ( r2, tmp[0], tmp[1] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[1] ); Matrix_vec_multn ( rot_mat, cross_hairs, rot_vert, 4 ); Matrix_vec_multn ( tmp_mat, rot_vert, tmp, 4 ); Camera_project_points ( tmp, p2, 4 ); if ( gv->phorizontal ) { for ( i = 1; i < 8; i += 2 ) p2[i] = p2[i] / 2 + y2T; } else if ( gv->pvertical ) { for ( i = 0; i < 8; i += 2 ) p2[i] = p2[i] / 2 + x2L; } else { for ( i = 0; i < 8; i += 2 ) p2[i] = p2[i] / 2 + x2L; for ( i = 1; i < 8; i += 2 ) p2[i] = p2[i] / 2 + y2T; } if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], WHITE ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], WHITE ); if ( p2[4] >= x2L && p2[6] >= x2L && \ p2[5] >= y2T && p2[7] >= y2T ) Draw_line ( p2[4], p2[5], p2[6], p2[7], WHITE ); if ( p2[6] >= x2L && p2[0] >= x2L && \ p2[7] >= y2T && p2[1] >= y2T ) Draw_line ( p2[6], p2[7], p2[0], p2[1], WHITE ); } /*================================================================*/ void Player_missile_update ( OBJECT *obj ) { Vector_copy ( obj->pos, obj->old_pos ); obj->pos[ZPOS] += missile_thrust[ZPOS] * gv->fadjust; Object_update_zone ( obj ); if ( obj->zone > ZONE_9 ) obj->active = FALSE; } static VEC missile_vert[4] = { {-10.0f, 0.0f, -5.0f, 1.0f}, {0.0f, 0.0f, -10.0f, 1.0f}, {10.0f, 0.0f, -5.0f, 1.0f}, {0.0f, 0.0f, 20.0f, 1.0f} }; void Player_missile_draw1 ( OBJECT *obj, MAT r1, MAT r2 ) { VEC tmp[4]; MAT tmp_mat; int i, x1R, y1B, x2L, y2T; int p1[8], p2[8]; x1R = gv->x1r; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; Matrix_vec_mult ( r1, obj->pos, tmp[0] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, missile_vert, tmp, 4 ); Camera_project_points ( tmp, p1, 4 ); if ( gv->pduel ) { Matrix_vec_mult ( r2, obj->pos, tmp[0] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, missile_vert, tmp, 4 ); Camera_project_points ( tmp, p2, 4 ); if ( gv->phorizontal ) { for ( i = 1; i < 8; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } else if ( gv->pvertical ) { for ( i = 0; i < 8; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } } else { for ( i = 0; i < 8; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } for ( i = 1; i < 8; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], YELLOW ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], YELLOW ); if ( p2[4] >= x2L && p2[6] >= x2L && \ p2[5] >= y2T && p2[7] >= y2T ) Draw_line ( p2[4], p2[5], p2[6], p2[7], YELLOW ); if ( p2[6] >= x2L && p2[0] >= x2L && \ p2[7] >= y2T && p2[1] >= y2T ) Draw_line ( p2[6], p2[7], p2[0], p2[1], YELLOW ); } if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], YELLOW ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], YELLOW ); if ( p1[4] < x1R && p1[6] < x1R && \ p1[5] < y1B && p1[7] < y1B ) Draw_line ( p1[4], p1[5], p1[6], p1[7], YELLOW ); if ( p1[6] < x1R && p1[0] < x1R && \ p1[7] < y1B && p1[1] < y1B ) Draw_line ( p1[6], p1[7], p1[0], p1[1], YELLOW ); } void Player_missile_draw2 ( OBJECT *obj, MAT r1, MAT r2 ) { VEC tmp[4]; MAT tmp_mat; int i, x1R, y1B, x2L, y2T; int p1[8], p2[8]; x1R = gv->x1r; y1B = gv->y1b; x2L = gv->x2l; y2T = gv->y2t; Matrix_vec_mult ( r1, obj->pos, tmp[0] ); Matrix_copy ( r1, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, missile_vert, tmp, 4 ); Camera_project_points ( tmp, p1, 4 ); Matrix_vec_mult ( r2, obj->pos, tmp[0] ); Matrix_copy ( r2, tmp_mat ); Matrix_set_trans ( tmp_mat, tmp[0] ); Matrix_vec_multn ( tmp_mat, missile_vert, tmp, 4 ); Camera_project_points ( tmp, p2, 4 ); if ( gv->phorizontal ) { for ( i = 1; i < 8; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } else if ( gv->pvertical ) { for ( i = 0; i < 8; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } } else { for ( i = 0; i < 8; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + x2L; } for ( i = 1; i < 8; i += 2 ) { p1[i] /= 2; p2[i] = p2[i] / 2 + y2T; } } if ( p1[0] < x1R && p1[2] < x1R && \ p1[1] < y1B && p1[3] < y1B ) Draw_line ( p1[0], p1[1], p1[2], p1[3], WHITE ); if ( p1[2] < x1R && p1[4] < x1R && \ p1[3] < y1B && p1[5] < y1B ) Draw_line ( p1[2], p1[3], p1[4], p1[5], WHITE ); if ( p1[4] < x1R && p1[6] < x1R && \ p1[5] < y1B && p1[7] < y1B ) Draw_line ( p1[4], p1[5], p1[6], p1[7], WHITE ); if ( p1[6] < x1R && p1[0] < x1R && \ p1[7] < y1B && p1[1] < y1B ) Draw_line ( p1[6], p1[7], p1[0], p1[1], WHITE ); if ( p2[0] >= x2L && p2[2] >= x2L && \ p2[1] >= y2T && p2[3] >= y2T ) Draw_line ( p2[0], p2[1], p2[2], p2[3], WHITE ); if ( p2[2] >= x2L && p2[4] >= x2L && \ p2[3] >= y2T && p2[5] >= y2T ) Draw_line ( p2[2], p2[3], p2[4], p2[5], WHITE ); if ( p2[4] >= x2L && p2[6] >= x2L && \ p2[5] >= y2T && p2[7] >= y2T ) Draw_line ( p2[4], p2[5], p2[6], p2[7], WHITE ); if ( p2[6] >= x2L && p2[0] >= x2L && \ p2[7] >= y2T && p2[1] >= y2T ) Draw_line ( p2[6], p2[7], p2[0], p2[1], WHITE ); } /*================================================================*/ JoesCat-xinvaders3d-030b568/system.h000066400000000000000000000051661506711671200172560ustar00rootroot00000000000000/*------------------------------------------------------------------ system.h: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #ifndef GAME_SYSTEM_FUNCTIONS #define GAME_SYSTEM_FUNCTIONS /*------------------------------------------------------------------ * * Misc Functions & Graphics primitives: * LINUX/X11 : main-x11.c * ------------------------------------------------------------------*/ #define WIN_WIDTH 640 #define WIN_HEIGHT 480 #define MAX_COLORS 256 extern int Graphics_init ( unsigned int, unsigned int ); extern void Graphics_shutdown ( void ); extern int Update_display ( void ); extern int Handle_events ( void ); extern void Draw_line ( int, int, int, int, unsigned int ); extern void Draw_point ( int, int, unsigned int ); extern void Draw_text ( char *, int, int, unsigned int ); /*------------------------------------------------------------------ * * System msec & sec Timer functions: * LINUX/X11 : main-x11.c * ------------------------------------------------------------------*/ #ifdef GAME_LINUX_X11 #include #include #include #define TIME_T time_t #define TIMEVAL struct timeval #define CLOCK_T clock_t #elif GAME_DOS_DJGPP #include #include #include #define TIME_T time_t #define TIMEVAL struct timeval #define CLOCK_T clock_t #elif GAME_WIN32 #include #define TIME_T time_t #define TIMEVAL struct timeval #define CLOCK_T clock_t #endif typedef struct TIMERSTRUCT TIMER; struct TIMERSTRUCT { TIME_T init_time_stamp; TIMEVAL t0; TIMEVAL t1; }; extern void Timer_init ( TIMER * ); extern CLOCK_T Timer_ticks ( void ); extern double Timer_sec ( TIMER * ); extern long Timer_msec ( TIMER * ); #endif JoesCat-xinvaders3d-030b568/vec4x1.c000066400000000000000000000074741506711671200170430ustar00rootroot00000000000000/*------------------------------------------------------------------ vec4x1.c: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #include #include #include #include #include "vec4x1.h" /*================================================================*/ void Vector_init ( VEC a ) { a[0] = a[1] = a[2] = 0.0f; a[3] = 1.0f; } /*================================================================*/ void Vector_set ( VEC a, float x, float y, float z ) { a[0] = x; a[1] = y; a[2] = z; a[3] = 1.0f; } /*================================================================*/ void Vector_copy ( VEC a, VEC b ) { memcpy ( b, a, sizeof ( VEC ) ); } /*================================================================*/ void Vector_print ( VEC a ) { fprintf ( stderr, "%5.5f %5.5f %5.5f\n", a[0], a[1], a[2] ); } /*================================================================*/ void Vector_negate ( VEC a ) { a[0] *= -1.0f; a[1] *= -1.0f; a[2] *= -1.0f; } /*================================================================*/ void Vector_add ( VEC a, VEC b, VEC c ) { c[0] = a[0] + b[0]; c[1] = a[1] + b[1]; c[2] = a[2] + b[2]; } void Vector_addd ( VEC a, VEC b ) { a[0] = a[0] + b[0]; a[1] = a[1] + b[1]; a[2] = a[2] + b[2]; } /*================================================================*/ void Vector_sub ( VEC a, VEC b, VEC c ) { c[0] = a[0] - b[0]; c[1] = a[1] - b[1]; c[2] = a[2] - b[2]; } void Vector_subb ( VEC a, VEC b ) { a[0] = a[0] - b[0]; a[1] = a[1] - b[1]; a[2] = a[2] - b[2]; } /*================================================================*/ void Vector_cross ( VEC a, VEC b, VEC c ) { c[0] = ( a[1] * b[2] ) - ( a[2] * b[1] ); c[1] = ( a[2] * b[0] ) - ( a[0] * b[2] ); c[2] = ( a[0] * b[1] ) - ( a[1] * b[0] ); } /*================================================================*/ float Vector_mag ( VEC a ) { return (float) sqrt ( ( a[0] * a[0] + a[1] * a[1] + a[2] * a[2] ) ); } float Vector_mag_squared ( VEC a ) { return ( a[0] * a[0] + a[1] * a[1] + a[2] * a[2] ); } /*================================================================*/ float Vector_dist ( VEC a, VEC b ) { float x, y, z; x = b[0] - a[0]; y = b[1] - a[1]; z = b[2] - a[2]; return (float) sqrt ( (x*x) + (y*y) + (z*z) ); } /*================================================================*/ float Vector_dist_squared ( VEC a, VEC b ) { float x, y, z; x = b[0] - a[0]; y = b[1] - a[1]; z = b[2] - a[2]; return ( (x*x) + (y*y) + (z*z) ); } /*================================================================*/ float Vector_dot ( VEC a, VEC b ) { return ( (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) ); } /*================================================================*/ void Vector_norm ( VEC a ) { float len; len = (float) sqrt ( (a[0] * a[0]) + (a[1] * a[1]) + (a[2] * a[2]) ); a[0] /= len; a[1] /= len; a[2] /= len; } /*================================================================*/ JoesCat-xinvaders3d-030b568/vec4x1.h000066400000000000000000000032561506711671200170420ustar00rootroot00000000000000/*------------------------------------------------------------------ vec4x1.h: XINVADERS 3D - 3d Shoot'em up Copyright (C) 2000 Don Llopis 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 ------------------------------------------------------------------*/ #ifndef VEC4x1_DEF #define VEC4x1_DEF typedef float VEC [4]; extern void Vector_init ( VEC ); extern void Vector_set ( VEC, float, float, float ); extern void Vector_copy ( VEC, VEC ); extern void Vector_print ( VEC ); extern void Vector_negate ( VEC ); extern void Vector_add ( VEC, VEC, VEC ); extern void Vector_addd ( VEC, VEC ); extern void Vector_sub ( VEC, VEC, VEC ); extern void Vector_subb ( VEC, VEC ); extern void Vector_cross ( VEC, VEC, VEC ); extern float Vector_mag ( VEC ); extern float Vector_mag_squared ( VEC ); extern float Vector_dist ( VEC, VEC ); extern float Vector_dist_squared ( VEC, VEC ); extern float Vector_dot ( VEC, VEC ); extern void Vector_norm ( VEC ); #endif JoesCat-xinvaders3d-030b568/xinvaders3d.6.in000066400000000000000000000065631506711671200205110ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH @make_as_xinvaders3d_uc@ 6 "March 31, 2024" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME @make_as_xinvaders3d@ \- X Invaders 3D .SH SYNOPSIS .B @make_as_xinvaders3d@ .SH DESCRIPTION @make_as_xinvaders3d_fn@ is a 3D vector-based space invaders clone for the X Window System. You are a lone star fighter facing endless waves of space aliens. Your sole objective is to shoot down as many aliens as you can. All objects are represented with 3D vector graphics, allowing the aliens to grow in size as they move closer to you. .PP .SH KEYS .TP .I SPACE Fire Missile .TP .I Left Arrow move left .TP .I Right Arrow move right .TP .I Up Arrow move up .TP .I Down Arrow move down .TP .I q Reset game .TP .I f Show frame-rate .TP .I p Pause game .TP .I ESC Terminate Program .SH PLAYING THE GAME Clear all the aliens in each level. Background UFO which comes out of Jump-gates which appear to the left yields bonus points if hit. A new life will be added every 7500 points. .nf From bottom to top: Row 0 aliens yield 10 pts Row 1 aliens yield 50 pts Row 2 aliens yield 100 pts Row 3 aliens yield 150 pts Row 4 aliens yield 200 pts UFO yields 500 pts .fi Game is over either if the player has lost all its lives or if the alien formation reaches the players position. .SH TWO PLAYER MODE Two players can also play at the same time. It is advised you should have a second keyboard for the second player. .PP .SH KEYS .TP .I a Fire Missile .TP .I i move up .TP .I j move left .TP .I k move right .TP .I m move down .TP .I 1 One Player Lone Defender mode .TP .I 2 Two Player mode, split horizontal screen .TP .I 3 Two Player mode, split vertical screen .SH OPTIONS .B @make_as_xinvaders3d@ takes no command-line options. .SH AUTHORS @make_as_xinvaders3d_fn@ was created (C)2000 by Don Llopis , with inspiration from Bill Kendrick: who wrote ICBM3d http://www.newbreedsoftware.com, Yuusuke Hashimoto: who wrote XSoldier http://www.surfline.ne.jp/hachi/xsoldier.html, and James Eibisch: who wrote a Space Invaders clone in quick-basic http://www.revolver.demon.co.uk/coding/index.html Also thanks to Thomas Boutell for contributing the Windows Port of XInvaders, and misc code fixes. Sam Bushell for the ZONE_HEIGHT bug fix. Andreas Jeitler for creating the RPM package. Chris Butler for creating the DEB package. Peter da Silva for the FreeBSD fix. Bill Kendrick for the Window Manager fix. This manual page was written by Chris Butler , for the Debian GNU/Linux system, 2000feb06 (but may be used by others) and adapted for Xinvaders3D, 2023feb23 Collected several bugfixes from various sources plus, found and fixed a few bugs, and also added a couple more improvements, and Duel mode (see Changelog for list) by Jose Da Silva, https://github.com/JoesCat/xinvaders3d JoesCat-xinvaders3d-030b568/xinvaders3d.jpg000066400000000000000000000636751506711671200205260ustar00rootroot00000000000000JFIFHHC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222h"T!1AQUaq"246Bt#$R5br%3DSTcsCEd,!1AQ"2aqB ?9jN͑`eӽ'z(?_?O5V)́P H?(gaVrв:^v5n?7/SRNc~F,tJ$s$k)j CASRUADޤVP R#2fX^M" fL6^NԤ K,,]f QBeE492&,ḏd([33"ŏlḏbM1Y&ݼZː.FB.J7\eo6Ƈ6A_}i ^n1{sѰ\}J\5 h浔ssiIZq=[דREak Hrp\KZ׻Kz'[-$ s{Hײd3D"\6dasFAfwȊ (kpܐ^ֻiftULBu,kYMDH 0hqQ(M`<&tK;(vS *mMQt2ֹ҃fmd0Fo}6/wjh#Iv/\߸,og8܍nFpT266㸩ᒦ,cde\iT3LL$O7pwJi!2ge`5^)y!z̙,RbE92Œ4[33,Y-,fXJg2fX(҅9s/+7)HYu2(,fY̰AXJ@d(QHKH@DP"!!.',aUrײ9 ؀HR9d_͂ﰨ8BWUı<4T򖸐A<wzW咊 >ثBFW kF[ɃDY!d[{\CZCUr8)Sb3E_Q6#? oQ?-g$.s?J{5QOS5G168J61kp|ѸgoK|khJN}3oK|iJ^|54QחΚR/M)zޗ:DhG:gKƝ3z_w_3DCtΗ}/:gKƾf}D!G:gKƱ:^|5DQ'>:^|4/[{_)ML'[R{_tΗ=/|O4}3toI|k3jOw_4Y~hGgKƝ3zOw_3X4}3toI|i:^|54OS?hG:gKƝ3zOw_3ױz_L/[_Lzޗ,Su gLzޓӦtoI|kM,X=L/3zOwN'񯙢z_L/[{_Lzړ,x%zCtΗ=/:eKƾfQ'>:^|5'񯙢zCtʗ=/:gKƾf'>:^|4/[{_KOΙ'LzޓRmOQ? :hgLzڔӦtmH?|kh~hG:gKԇƝ3jA_3'DhG:gKƝ3zOw_3,x''B>:^|4/[{_':hgLzޓӦtoI|kh~tΙ'Lzޓ=D!G:gKƝ3zOw_3DML/[_tΗ=/|O4}/tmI|k=2zOw_3E~3zOwNR'񯙢zCtΗ=/:gKԞƾf'>:^|4z_w_3E>~tΚR/LzޗG4}3toK|i:^|54N/:ΚR/M)zޗ:CJ>XQs2>Sqk~\aĸRkd48l^QP(̶hm !%~mK'FьU,>Vj^cpA!D@DDD@} ,iF2Z)`9K D?K(#ou(1*#lX llnVmw eM PXde=ٶrd;`YB/n. X+&WMplo $C~Y{53ҮIknlyF ooT`k7j.U6RSO9(x=hާEQy;'GsghsAdTAZ8P(6 oT`QW3jj f[B^K } =1hw{iaCfdNͩn7M:,w )M\=7Y0Y*\)H#qՌ6z]9~O?Oߋoc -*N)|rBv=дYet{m 0T$sɎV =Ͷ?MVS;[N`5B<EݾL!045|4Ѿ8 )ؕn??z=4:)eq#Y" %aԾ[[>|ﭯX6YXrn U?wzEnG#3TE6+.%PsghmOE#MUk1Zyä|%VzlgS)0n&-fW/3OK\@}(Vj\oUDED@DDD@^8eFn{lrN;{pMg3bp&_-ND& pH7Iͭu^jI'Ue*Ob ZcZ0Ł<45TAAyggE;&hk.khAQtVXlBng^иo'zns[S '/eզ8?H?8?ڣCPSt9=~)O# 9m;̷!cDKSEMg^0\Ost.R i$t| iTAk*ʱٸ< Xr=;+Ki$jK$,{޵^U Qc߂W<&7|mwײ l\H .,v)8e)esm'zkot6;^ɱɘE$4aԵZɜ86dDsUZV:U{g^Д MC*&26de71'VWnB"+?߇ lu3俛{^ڣUKU/u(?i[mqj6sJO )HcíZUM&X#kPR૵$IV`Jg_VomqH!J68dwnQa6ᩔxFT3]a-KHk#6zj)-T,~*c])uRTSI,s=9-\z5a6[7jM'F@no, j^^||ۜW:hڝJ;V|1isr {Te1iuD@DDD@DDD@DD9+z_E=6_v8>X}*gF9aU|"($""" """ k, """ """ """ "" \cQX@{W+%ůcF YYQ_TL>ٞ߀ZDDD@DDD@DDD@J֗|ODi~]l%Uo{>5yUpA!D@DDD@&jiM ,{QD@DDD@DDi $ ';H%8`@DDD@=+7k\١SRO%װeD@L2zhyȩgfh5{ "" """ """ ""/"o/ ''U,>Vj\uDED@DDD@DDD@DDD@DDD@DDD@dl#kdT0Ҙ#F: W&D@ HX(#Zƺm}kJ si};ko J" Ÿ,sE Jl4ܘFNX23&iHֶkNX@e,͸9MDD@DDD@K|֗1|ODi~^\,>VjWU[ρp>MDDD@DDD@mD@\` 觩HG7%T8X,n \sJ|M*k 1.phWTPjEu'-7 8X4%j(iB/Lnk&d>'dA&՚QZs0\^Αi])Fp[RLGsB,-"[cI1hܷap0r>R'lm^SBg@8_ 0a#otԈZ҈n{養NnH/loVn,O)4Noln̥ͪE>I21r# o-p Z&Ym  .ct$nRm5"KA=ip!zJUQ0kúgH #C 6)YQE-#i滁؂&O+b1 #vփV# 3s-{U~ !8eQsB,r&\+tt{X\ l}K}&SZaؗ84zP\%[!"WЖDvͰQXZ]`mKB>hҋ&^rsK%+|-;Æ8`/c#An.HilU"i Fl[mAZܮEږM:"KR)㙦?am{BȝȀ""[洿`z'%az/Ns˓Ҫ| TjJ{5Q5n" """ """ 2-}v+ J'1|b=An ` E-CMBN2u?'TEKrc1#vڝ5|C>k+d ( q n;h94+X4؛e n;x+f\g :)wd<^"4K~vyScTuRSM)d'#y] l/p(yl^dU#W7={`$I뼓| ~ꚩ2Z# mm w<V Y.5<3fqo4ةҴCŷǂNK־rRg$ј\M #ӹne$f|m[[mk [*1qѾG5J ]ֳN]˲ĪT+c]q9&,qm)w+N 72 p$vyBnnKIY %1^WōyZ*}L4B.\Nrw6WeIT0LUFqs]{^׷4޹ǸԼqKJo|b LΗ;nE/ǹW㴕TG8&)%eqUjcŹ;4 f+,smkimjq97(C\Uv!rӸ*U%j~ WЇyE<2'9'yOj0~id5nR[q'iQJVL>SIi]m<,R\pWI a8*"aZ@{Cos٦As{Y_ kp\F_Nщkgőmp8l'h*֏}^75{1Yr6WػMqMW'ոQN4،TAQT@i!'n\}ōT2ZrFtcTY^D}x,Usn!D"35h;¯WO<>٤qs(kDD 3(88حh TYT1'X9 _洿az/Ns˓Ҫ| TjJ{5Q5n" """ """ е^Fynlo +l<:Ag0XTؖnN3ft' [p09SUK$`m 4MM{ש&b =;TЪ& Í+՞\7{s62It zb(L43f :@ܯB@kERSi*M-QT83Kja>U=So*)6J:YFڸZ DrkrCxZ`X0Ano̽Z@b?v|}nvWDSZ1lL1`e%a$F**ekb > 2Ӽ;E6xwN~T"J5"V>$6<@%Һ[s;@UH(*ee5L΂4vf_PUj|6v~ZtjIbS*>avlyfrKb&4\=\Si*M-[ۓa$ޥMkԪVQJ\G#j$8Y#%7[rnj/~B֞zko68q:9Ɨ#m+6ߒV%PʬJ0C$m؛RDJ")$""MEC# 4m֣ $M &imNq%kK~'r[Կ`z/NrϓҪ| TjJ{5Q5t"($""" """ ""&ԚH D96nF.NǁMܺY!SǛ0o[LIkq;1U:!Fm^s1J*F^Z Iap|p #U$[}գ$ËY[= tOEL@tQ8fakӨ%5-.Ipse <40Mf07b|;4 ,2 k9 `7W\Ţʘb[kZ$S(;Z4)#۾+? kAG_,;kKءm ޷y0P۫.m79Kyd(!ksm feSTyD+\&Y$1R)aE tԴjf,cJVG8b`(&g,գ$ՖqqDEbs| "=/Wx?'0ꊊ"&)ZCb}|}Kx >R/蜗/bYpU[ρ^rUo{>5:WDDD@DDD@DDm["y@8jjֳڔnmt3<^2G+mFg \ weU8Ɋڱpem8mcq^i%d@8:6ฦ]\ɹꤻveUCqBƍ\ Djy]qJ7:r=0FoJh) Xqo ǍR,$I#[GW&W9Sa#1f7.񡶚UFy3i\?T~wjIA\ͦ"( ,~:_o)%ʶ*9vl'(=p6\ЃolєuJ=.7XMΆoA(stp]PQju5mFWk\TBZܬoC<I.>USMŌ9rT'fFڰsBsa6:63>imoaP~Pu%cr6o'& li ;f+M&f#'y3IF;Ϳ\"]3f9K1KK[Q K*Ѻ@ lyFr-pi`'U6.v0>9_mbW4ipSpL>SFq:FۇfwK ޠcl[) 2C 7}ڵWSղ.9eݲݷ鈹\32'.c\.K}7%q-5'lڣ)Kg۱O)g<'Եcxk\rWoc[|cA}˧*W0.wC9KOwe.>7=kָXqX<$5m {N[q5nun6g, vXEA$<u}H^U]Yǜ6mIFxe Po띞C-L ]Y↙4e(W5gz.B q4\l6 lU\\ȣCun>N4x{F3@lcM#yݧ[<:Of͖SQ'l}LHI=+tk.@m* 0Z(-Z|Z}J˕6a`w7,V^Enżl<$5Q!GY .';,":4yDGi.b.0>Y )lZ;y#O:uELdL>n['356~*.Pދ5NDED@DDD@DDD@Yް U 4ߚ/[omzRIWL/,'l h"BI")zFlmlZQGrok-|@ Z2/kpZE"4Ԣ"Ln R3!idbF]oY>nvAOwQ 䓠ړބR DFF8Xj{)KrJox qAH"͈PtURC 1d P H9M4XE)jdy],/{NդE!*T\S򒲛5l*Ӝ8eokyr 7TUR~gֺȪ)u/[(>p }%hEdQHd6s]/b"Ortړk~ o<6<\^?Q)>Hi>IRR٢~Y{/QΦHR$Ѻad-p,)$OQ--DsFCcWIQHw|2M1=d--f@MuN݀^^z*9qٹ7AFD4Ly iEnVMª(jk!`0[%~O,q6H)޵,xiDDZ387''q!C-T.13RtmS@}[5 ?9/Zo=l',>VjWU[ρyopA!D@DDD@DDYX@@$Yam~P; > JJY443KA^;?U;EkM5NDED@DDD@DD,,k E%dS ,LUtƌ6:A&݂T5_Pw jj?%Q\Lu9nG;Ko_rj9I_S -ddǁ "NR7XWOSRiia'ΌfӺU:ux|Ox9Cdoqrlv]sxF"6ieiБeu)ۘhH7a,JM1kr]$cz(*$ `4f;[ܦbmŪ Y4Α@&j?`9È JzG#^6*d4LinQ000Ѡ_f[iĻr9Ͽ K\*,BLC ^mnč^R5ڰX :%GeaډAz#PMơvy% E3[BZHt|q k ]Yf(ClF>\E,5R1tYG^[6gA $ZE-w踷8RLmT9;Aڪᥱᅑ, &j$la.ڃe; -Uv'Y t G&α@7s^(pJ.yF\_(tN7g6L:ܛ x;_M +F3~ XŪ3uPJ?/DS5ta "E0gC$k Ե,1QUaZ&B9!.ݚk MmUR֗j,-ce;s8sNΕVg95 Ί=4u.Nw 8Qg40[( ԃc5,JN]y5TK %{]kp f⸥k↾*(-Gfqt <іHDZLjIrNWU"tY:i715,IDmujRq'U:9>F(hFoDZV摍vv k gjZ7%i|l<`Fnn.mNa!k3fms.ƛ΋ō& YDYa vV4̼8_nG.L:ly6%vF䷻VZn~yu ZVU+/yI:KA[-G U,>Vj^[\DPHDDD@DDD@XE ٫gܣ"| kpDe _+q'`QkȮ瓪M1pּlobykZFܵe*|JU/̌Yآ͆[}% |N# ]`yivj^Ii^ې5YMTeMrn(r-i˲*覶ߡS%PAaMM=*7b[bɃspH?<3Oz[%^ԵUk_GN⾔A11͸:E-\] ꞅ9mcqphKɒO^$-{AiYk:)M3 rzu[k. ko{s KAA$d\\(/cPذ H,H&|d4k/5j{F04.kNXxRA.s/̮r/m/z2H|ƹQiLtςwO)F4}ccQW2߻y͐jW>KI#S`X e0W#ZB[5\,V" ""/a\?q',>VjWU[ρyopA!HfI71 ?%GDD@DDD@DD@^Vn/t| u!UdeDP.hn3kp!fT`ubN浠qn߹hCYVሶ Ķ2mvq8c1P7. pӜ&e$ 9MK厡:EU }EEu;d9+dmM7:.Mڛ%ñg26m屢8`;C{Hs$r0բџQ몱YtuhX$ԅmV0cPR20$ y۫S:%rutY'*h٧jOb- Y$mu {bXU;>YLKLB c8E/&7豹%&,Mpt޹O<6g?!%X, uq?x_ut_; h6 kZ {I ;XƱÃ.ΤNj,p]$Yc^`K3Sͬ6Y &־SU $f^ mhF4.]TM??aodqjb6"}yXJjJcŽm |}9$Z~Q8dvfnEkzYC[AknMϓEDpM6\ Ѡp7إa$Ni!J6nۍ H;{W+ٻl&()Odq&s 6;ږ8iݣJ@9@T9 TW$L=!ܢ]p]{V_GEWje204_ꉎga@i|t3s4l;:E_=|{Kx KF൒54]`-sdMps-kP^?/TLcZFܮ J*9't|٦p mIcmv ZOIXHjcc MXlWi>Zӭ J|Rw^{p5@=KާV5c5D \_`(KqT.[E 0 摱.M:]ϞidQ>w6[܀,DZs4KUD4OaAЮcpRH\MvVy-Uhnn7_4%ep"nmeSbWI㨍ܘKZl?8eemL# laRyA#]׹QXu%8lM{m4myf͡w^RTGD(VN}ں .7+ D@DDWiNK֛0OE#|',>VjWU[ρyopA!D@DDePބj:&'"G ^4]M0gc.m4ݳ^QeZ,XXRX"-:vB<\ J^(S H(pFo:-3N!%8YU7etGU*1i)ɖFCC{~bNkUJRbU#!znu^@hv\;! lxž "_t3F1l~JS_f|ͺ[G;jFf܋6+T& 3M YO},qZȑecvF28메5y#&@i5 Ou1>MO~ b]Zzx+JM8U Xv1w[3\Zbh%s7$rl6b$oŒ0h"iVjWU[ρyopA!D@YX[iu`o;.om=Ԓ;$Q7@;T4mlaiFv )8ytm"ǃܠl= mY-̓rVKωՊye77[n5f )`},>7i#L>C]ݛv▭ ܶs zrn=S.ɩR6v?*W} X" , #7,]#COϹNb,Fh>LA%#DdӻrI3XcYrkQU=? 6?NNݽUQAOEd*VK"P=2k#qgni|p|×Nu7ﲳm43,c;tPڋѬV5OUDs eq;;Dɜ< l#VO66]}M~KGQ mOLFg qٽQl!x_9y\4 #NF.qѭs]I vRXR(e@H]h|kz$QQFWO +tF6?nb[PUvU ܾ8 Ү_FLi&Yƴ\f٦ͅzGca9ב[ѴnEnsCI4⤉<# \66-Ev51TW&wLGLse;RdusD\P6itC3Zf#5KOgPԍov(cjtUOSsFiynkf-i}?'JcᕐDfiuD#)YÄmgo~8XVx<SG7I&{Jݵl9)4VU5;l ŹsN|Re8㦠[*<㋝`tɇ ϓP$oSx}zSS3 gSK/.չU4.["ajP""" %kM~'r_`z/W98NX}*gF9aU'B""B" "" 4urK'NhsH)OOkDUsY'u::*ׂ> l^ײlhr{-mu;mMD3:I.sk%aJI`" ,iXD5OжGq:xMOz)#sdxr35JG\55<7S|QuMm;;49J|KUq|*Ime#>\Tg[4.6s⌯0蝭E3]o47 _trT9rJ đ[6Hi%>s?AG޴WI_ =iJ,$I:_s-.CSVaй6#dͫbHm7^Æzl69l!3Jk;汬QhY쌝p䏻nۿÇE%&ݷbO$ZqrI.8$XF$Bjlofv⢺sJ]J$mq~Gs$𸭑e6Nsm$(Qť͔j/b2q]5,!ପ഑GO+y揔󘸴+IՍ^7E 4t6';@yY僝R{ӣ?өR{h4$kY8ry\Am[mvWb:h 7@w84.?T)~75m+ #;uU/H=G88au8{vd;+ $Ǒ-l^đB׷Pltֲ wapUSL0biK#pͭe,'1ņ 3>yRMr]66ڨ E'!q{Nn =UAS `%m B+m)n͕81SMOSIr9 @('45#SH$n~ $F{N;Nua#P*FO#staﺓar .˚iN:%~-)(s'S伟|Dl{.j'[[57uCba4}+INe\jld"ZIu WbHqJg9K3ֳ'nنR:dX]KXQQOJ6(6^OMz"8T2Xڙ^GKs ov-VAACQPm}jjke{;#u`q HUO$4<62rIIзg'0󏑮com^UC*8ڗ"-" ""/bo/8|Q͓Ҫ| TjJ{5Q5t."($"""o@DDD@DD'rf*jZ"Rj&qۙXlU:m[Ҿ];Y͍)߰v8sq{_i1I\p{߸(ebf@RoGm,EHZ#a}-:bL3 H.Hn5> FE#]{/K `#.~Z氒i$8i$7D 㻦f*8t{ym,Vi(#q'+iHYk7TT:y3yB+jv"!,"`l>?qz4.VjWU[ρpNDED@Va*10L2'[۽U"}l-Lٛ`ckk %aDDD@D@}L06l@jzu8@M0!TbWt@4 w*JOSNXۖ1XܷCM$nk=ky٭3<}w{}{ErKcT4{9~n-#OGyD4s xyf|3ݘOv3$q$+"v""DDD@1!c u^UQL_sh}H (""5yDDX#FpvzfTkLIq#[jW6N%^PlVZ6#PA[*΍GO:Jw{Er䶄tuMȨe8lףpomG H|sٷ?s6/NyiXˍ" """ """ %kK'r[洿az/NrϓҪ| TjJ{5Q5t"($""" a:Vt.AD@Y SzU-C3=Pd sN}7G(_S)\~nGD1mlrNhz=6 ޵VAns*9*ʹd7Zѝ@:XVIJN\@DDD@G%|Olo- ;ZڜViF]B@DDD@DDz8Fм 0U2a;/xi|$K۷hg8xPѲ{Kl4kaQ?O7-ۧZQDDD@d4YZ= <+uuR CVk*UDՎa6w~ńJr;DE%" ""'}6:hu٢""" """ ""BΉKObԈRkiLqUҚwj׷aQز^\,xUGsif<"DDF-sMA̳INJ{5QX}*gF'J""B" """ """ """ dxuz67Kb9`I]~J" """ """ """ """ """ >o/蜖/"Uo{>5yU pA!D@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DD9-Z_E=5_v\,>VjWU[ρqMaz0WaE3cշ.{,)QE/DXӂ,a6VV7 W~-58|utQgleٌn):]Եi+XDDD@+\F:_#kfc  X܁}m`éiªdi̲  Af" """ ék_ sDRF[;*l(""" """ """ """ """ %~mK'rWԿ`z.˓Ҫ| TjJ{5Q\oU? eEPt"짃G'AĐLBgb^54_@m5ܤN< OTF~QBEQS(We/NQmK95BUmE0<ŠX|aԢv]#eh{?"J\?'6TVj"!zN[O5ˇ9 ܢb5&+/f0 ѠдC+♲4sH (IURU}q^U/d:hFs=j-՚'kc" """ """ """ """ """ """ """ ""7"_/_ a'Uo{>1+X}*gF&˂l~i%{b>W壧>ުSDJqE2XhZEjMG$&{./{ tUȚ":q--?=1}pdzD֫RjhXݹa**1I`" """ """ "" 5UBF9Gn߭TdDD@DDD@DDD@DDD@DDD@}c7_9+j_E=kKҪ| Tk'&zPUQ!ynWs@UOC>ў%ѱFWht?QDFWht?JQ~=3ĝǺFxh:uy'C>ў$e+·^}ў$e+·^}ў$e+·^}ў$e+·^}ў$e+·^}ў$e+·^}ў$e+·^}ў$e+·^}ў$e+·^}